"use strict";
var ILoveMDConverter = (() => {
  var __create = Object.create;
  var __defProp = Object.defineProperty;
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  var __getOwnPropNames = Object.getOwnPropertyNames;
  var __getProtoOf = Object.getPrototypeOf;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __typeError = (msg) => {
    throw TypeError(msg);
  };
  var __defNormalProp = (obj2, key, value) => key in obj2 ? __defProp(obj2, key, { enumerable: true, configurable: true, writable: true, value }) : obj2[key] = value;
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
    get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
  }) : x)(function(x) {
    if (typeof require !== "undefined") return require.apply(this, arguments);
    throw Error('Dynamic require of "' + x + '" is not supported');
  });
  var __esm = (fn, res, err) => function __init() {
    if (err) throw err[0];
    try {
      return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
    } catch (e) {
      throw err = [e], e;
    }
  };
  var __commonJS = (cb2, mod) => function __require2() {
    try {
      return mod || (0, cb2[__getOwnPropNames(cb2)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
    } catch (e) {
      throw mod = 0, e;
    }
  };
  var __export = (target, all) => {
    for (var name in all)
      __defProp(target, name, { get: all[name], enumerable: true });
  };
  var __copyProps = (to, from, except, desc) => {
    if (from && typeof from === "object" || typeof from === "function") {
      for (let key of __getOwnPropNames(from))
        if (!__hasOwnProp.call(to, key) && key !== except)
          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
    }
    return to;
  };
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
    // If the importer is in node compatibility mode or this is not an ESM
    // file that has been converted to a CommonJS file using a Babel-
    // compatible transform (i.e. "__esModule" has not been set), then set
    // "default" to the CommonJS "module.exports" for node compatibility.
    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
    mod
  ));
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  var __publicField = (obj2, key, value) => __defNormalProp(obj2, typeof key !== "symbol" ? key + "" : key, value);
  var __accessCheck = (obj2, member, msg) => member.has(obj2) || __typeError("Cannot " + msg);
  var __privateGet = (obj2, member, getter) => (__accessCheck(obj2, member, "read from private field"), getter ? getter.call(obj2) : member.get(obj2));
  var __privateAdd = (obj2, member, value) => member.has(obj2) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj2) : member.set(obj2, value);
  var __privateSet = (obj2, member, value, setter) => (__accessCheck(obj2, member, "write to private field"), setter ? setter.call(obj2, value) : member.set(obj2, value), value);
  var __privateMethod = (obj2, member, method) => (__accessCheck(obj2, member, "access private method"), method);
  var __privateWrapper = (obj2, member, setter, getter) => ({
    set _(value) {
      __privateSet(obj2, member, value, setter);
    },
    get _() {
      return __privateGet(obj2, member, getter);
    }
  });

  // node_modules/papaparse/papaparse.min.js
  var require_papaparse_min = __commonJS({
    "node_modules/papaparse/papaparse.min.js"(exports2, module2) {
      ((e, t) => {
        "function" == typeof define && define.amd ? define([], t) : "object" == typeof module2 && "undefined" != typeof exports2 ? module2.exports = t() : e.Papa = t();
      })(exports2, function r() {
        var n = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== n ? n : {};
        var d, s = !n.document && !!n.postMessage, a = n.IS_PAPA_WORKER || false, o = {}, h = 0, v = {};
        function P(e) {
          return 65279 === e.charCodeAt(0) ? e.slice(1) : e;
        }
        function u(e) {
          this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, function(e2) {
            var t = b(e2);
            t.chunkSize = parseInt(t.chunkSize), e2.step || e2.chunk || (t.chunkSize = null);
            this._handle = new i(t), (this._handle.streamer = this)._config = t;
          }.call(this, e), this.parseChunk = function(t, e2) {
            var i2 = parseInt(this._config.skipFirstNLines) || 0;
            if (this.isFirstChunk && 0 < i2) {
              let e3 = this._config.newline;
              e3 || (r2 = this._config.quoteChar || '"', e3 = this._handle.guessLineEndings(t, r2)), t = [...t.split(e3).slice(i2)].join(e3);
            }
            this.isFirstChunk && q(this._config.beforeFirstChunk) && void 0 !== (r2 = this._config.beforeFirstChunk(t)) && (t = r2), this.isFirstChunk = false, this._halted = false;
            var i2 = this._partialLine + t, r2 = (this._partialLine = "", this._handle.parse(i2, this._baseIndex, !this._finished));
            if (!this._handle.paused() && !this._handle.aborted()) {
              t = r2.meta.cursor, i2 = (this._finished || (this._partialLine = i2.substring(t - this._baseIndex), this._baseIndex = t), r2 && r2.data && (this._rowCount += r2.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview);
              if (a) n.postMessage({ results: r2, workerId: v.WORKER_ID, finished: i2 });
              else if (q(this._config.chunk) && !e2) {
                if (this._config.chunk(r2, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true);
                this._completeResults = r2 = void 0;
              }
              return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(r2.data), this._completeResults.errors = this._completeResults.errors.concat(r2.errors), this._completeResults.meta = r2.meta), this._completed || !i2 || !q(this._config.complete) || r2 && r2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i2 || r2 && r2.meta.paused || this._nextChunk(), r2;
            }
            this._halted = true;
          }, this._sendError = function(e2) {
            q(this._config.error) ? this._config.error(e2) : a && this._config.error && n.postMessage({ workerId: v.WORKER_ID, error: e2, finished: false });
          };
        }
        function f(e) {
          var r2;
          (e = e || {}).chunkSize || (e.chunkSize = v.RemoteChunkSize), u.call(this, e), this._nextChunk = s ? function() {
            this._readChunk(), this._chunkLoaded();
          } : function() {
            this._readChunk();
          }, this.stream = function(e2) {
            this._input = e2, this._nextChunk();
          }, this._readChunk = function() {
            if (this._finished) this._chunkLoaded();
            else {
              if (r2 = new XMLHttpRequest(), this._config.withCredentials && (r2.withCredentials = this._config.withCredentials), s || (r2.onload = y(this._chunkLoaded, this), r2.onerror = y(this._chunkError, this)), r2.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !s), this._config.downloadRequestHeaders) {
                var e2, t = this._config.downloadRequestHeaders;
                for (e2 in t) r2.setRequestHeader(e2, t[e2]);
              }
              var i2;
              this._config.chunkSize && (i2 = this._start + this._config.chunkSize - 1, r2.setRequestHeader("Range", "bytes=" + this._start + "-" + i2));
              try {
                r2.send(this._config.downloadRequestBody);
              } catch (e3) {
                this._chunkError(e3.message);
              }
              s && 0 === r2.status && this._chunkError();
            }
          }, this._chunkLoaded = function() {
            4 === r2.readyState && (r2.status < 200 || 400 <= r2.status ? this._chunkError() : (this._start += this._config.chunkSize || r2.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((e2) => null !== (e2 = e2.getResponseHeader("Content-Range")) ? parseInt(e2.substring(e2.lastIndexOf("/") + 1)) : -1)(r2), this.parseChunk(r2.responseText)));
          }, this._chunkError = function(e2) {
            e2 = r2.statusText || e2;
            this._sendError(new Error(e2));
          };
        }
        function l2(e) {
          (e = e || {}).chunkSize || (e.chunkSize = v.LocalChunkSize), u.call(this, e);
          var i2, r2, n2 = "undefined" != typeof FileReader;
          this.stream = function(e2) {
            this._input = e2, r2 = e2.slice || e2.webkitSlice || e2.mozSlice, n2 ? ((i2 = new FileReader()).onload = y(this._chunkLoaded, this), i2.onerror = y(this._chunkError, this)) : i2 = new FileReaderSync(), this._nextChunk();
          }, this._nextChunk = function() {
            this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
          }, this._readChunk = function() {
            var e2 = this._input, t = (this._config.chunkSize && (t = Math.min(this._start + this._config.chunkSize, this._input.size), e2 = r2.call(e2, this._start, t)), i2.readAsText(e2, this._config.encoding));
            n2 || this._chunkLoaded({ target: { result: t } });
          }, this._chunkLoaded = function(e2) {
            this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e2.target.result);
          }, this._chunkError = function() {
            this._sendError(i2.error);
          };
        }
        function c(e) {
          var i2;
          u.call(this, e = e || {}), this.stream = function(e2) {
            return i2 = e2, this._nextChunk();
          }, this._nextChunk = function() {
            var e2, t;
            if (!this._finished) return e2 = this._config.chunkSize, i2 = e2 ? (t = i2.substring(0, e2), i2.substring(e2)) : (t = i2, ""), this._finished = !i2, this.parseChunk(t);
          };
        }
        function p(e) {
          u.call(this, e = e || {});
          var t = [], i2 = true, r2 = false;
          this.pause = function() {
            u.prototype.pause.apply(this, arguments), this._input.pause();
          }, this.resume = function() {
            u.prototype.resume.apply(this, arguments), this._input.resume();
          }, this.stream = function(e2) {
            this._input = e2, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
          }, this._checkIsFinished = function() {
            r2 && 1 === t.length && (this._finished = true);
          }, this._nextChunk = function() {
            this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : i2 = true;
          }, this._streamData = y(function(e2) {
            try {
              t.push("string" == typeof e2 ? e2 : e2.toString(this._config.encoding)), i2 && (i2 = false, this._checkIsFinished(), this.parseChunk(t.shift()));
            } catch (e3) {
              this._streamError(e3);
            }
          }, this), this._streamError = y(function(e2) {
            this._streamCleanUp(), this._sendError(e2);
          }, this), this._streamEnd = y(function() {
            this._streamCleanUp(), r2 = true, this._streamData("");
          }, this), this._streamCleanUp = y(function() {
            this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
          }, this);
        }
        function i(m2) {
          var n2, s2, a2, t, o2 = Math.pow(2, 53), h2 = -o2, u2 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, d2 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, i2 = this, r2 = 0, f2 = 0, l3 = false, e = false, c2 = [], p2 = { data: [], errors: [], meta: {} };
          function y2(e2) {
            return "greedy" === m2.skipEmptyLines ? "" === e2.join("").trim() : 1 === e2.length && 0 === e2[0].length;
          }
          function g2() {
            if (p2 && a2 && (k("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v.DefaultDelimiter + "'"), a2 = false), m2.skipEmptyLines && (p2.data = p2.data.filter(function(e3) {
              return !y2(e3);
            })), _4()) {
              let t3 = function(e3, t4) {
                e3 = P(e3), q(m2.transformHeader) && (e3 = m2.transformHeader(e3, t4)), c2.push(e3);
              };
              var t2 = t3;
              if (p2) if (Array.isArray(p2.data[0])) {
                for (var e2 = 0; _4() && e2 < p2.data.length; e2++) p2.data[e2].forEach(t3);
                p2.data.splice(0, 1);
              } else p2.data.forEach(t3);
            }
            function i3(e3, t3) {
              for (var i4 = m2.header ? {} : [], r4 = 0; r4 < e3.length; r4++) {
                var n3 = r4, s3 = e3[r4], s3 = ((e4, t4) => ((e5) => (m2.dynamicTypingFunction && void 0 === m2.dynamicTyping[e5] && (m2.dynamicTyping[e5] = m2.dynamicTypingFunction(e5)), true === (m2.dynamicTyping[e5] || m2.dynamicTyping)))(e4) ? "true" === t4 || "TRUE" === t4 || "false" !== t4 && "FALSE" !== t4 && (((e5) => {
                  if (u2.test(e5)) {
                    e5 = parseFloat(e5);
                    if (h2 < e5 && e5 < o2) return 1;
                  }
                })(t4) ? parseFloat(t4) : d2.test(t4) ? new Date(t4) : "" === t4 ? null : t4) : t4)(n3 = m2.header ? r4 >= c2.length ? "__parsed_extra" : c2[r4] : n3, s3 = m2.transform ? m2.transform(s3, n3) : s3);
                "__parsed_extra" === n3 ? (i4[n3] = i4[n3] || [], i4[n3].push(s3)) : i4[n3] = s3;
              }
              return m2.header && (r4 > c2.length ? k("FieldMismatch", "TooManyFields", "Too many fields: expected " + c2.length + " fields but parsed " + r4, f2 + t3) : r4 < c2.length && k("FieldMismatch", "TooFewFields", "Too few fields: expected " + c2.length + " fields but parsed " + r4, f2 + t3)), i4;
            }
            var r3;
            p2 && (m2.header || m2.dynamicTyping || m2.transform) && (r3 = 1, !p2.data.length || Array.isArray(p2.data[0]) ? (p2.data = p2.data.map(i3), r3 = p2.data.length) : p2.data = i3(p2.data, 0), m2.header && p2.meta && (p2.meta.fields = c2), f2 += r3);
          }
          function _4() {
            return m2.header && 0 === c2.length;
          }
          function k(e2, t2, i3, r3) {
            e2 = { type: e2, code: t2, message: i3 };
            void 0 !== r3 && (e2.row = r3), p2.errors.push(e2);
          }
          q(m2.step) && (t = m2.step, m2.step = function(e2) {
            p2 = e2, _4() ? g2() : (g2(), 0 !== p2.data.length && (r2 += e2.data.length, m2.preview && r2 > m2.preview ? s2.abort() : (p2.data = p2.data[0], t(p2, i2))));
          }), this.parse = function(e2, t2, i3) {
            var r3 = m2.quoteChar || '"', r3 = (m2.newline || (m2.newline = this.guessLineEndings(e2, r3)), a2 = false, m2.delimiter ? q(m2.delimiter) && (m2.delimiter = m2.delimiter(e2), p2.meta.delimiter = m2.delimiter) : ((r3 = ((e3, t3, i4, r4, n3) => {
              var s3, a3, o3, h3;
              n3 = n3 || [",", "	", "|", ";", v.RECORD_SEP, v.UNIT_SEP];
              for (var u3 = 0; u3 < n3.length; u3++) {
                for (var d3, f3 = n3[u3], l4 = 0, c3 = 0, p3 = 0, g3 = (o3 = void 0, new E({ comments: r4, delimiter: f3, newline: t3, preview: 10 }).parse(e3)), _5 = 0; _5 < g3.data.length; _5++) i4 && y2(g3.data[_5]) ? p3++ : (d3 = g3.data[_5].length, c3 += d3, void 0 === o3 ? o3 = d3 : 0 < d3 && (l4 += Math.abs(d3 - o3), o3 = d3));
                0 < g3.data.length && (c3 /= g3.data.length - p3), (void 0 === a3 || l4 <= a3) && (void 0 === h3 || h3 < c3) && 1.99 < c3 && (a3 = l4, s3 = f3, h3 = c3);
              }
              return { successful: !!(m2.delimiter = s3), bestDelimiter: s3 };
            })(e2, m2.newline, m2.skipEmptyLines, m2.comments, m2.delimitersToGuess)).successful ? m2.delimiter = r3.bestDelimiter : (a2 = true, m2.delimiter = v.DefaultDelimiter), p2.meta.delimiter = m2.delimiter), b(m2));
            return m2.preview && m2.header && r3.preview++, n2 = e2, s2 = new E(r3), p2 = s2.parse(n2, t2, i3), g2(), l3 ? { meta: { paused: true } } : p2 || { meta: { paused: false } };
          }, this.paused = function() {
            return l3;
          }, this.pause = function() {
            l3 = true, s2.abort(), n2 = q(m2.chunk) ? "" : n2.substring(s2.getCharIndex());
          }, this.resume = function() {
            i2.streamer._halted ? (l3 = false, i2.streamer.parseChunk(n2, true)) : setTimeout(i2.resume, 3);
          }, this.aborted = function() {
            return e;
          }, this.abort = function() {
            e = true, s2.abort(), p2.meta.aborted = true, q(m2.complete) && m2.complete(p2), n2 = "";
          }, this.guessLineEndings = function(e2, t2) {
            e2 = e2.substring(0, 1048576);
            var t2 = new RegExp(U(t2) + "([^]*?)" + U(t2), "gm"), i3 = (e2 = e2.replace(t2, "")).split("\r"), t2 = e2.split("\n"), e2 = 1 < t2.length && t2[0].length < i3[0].length;
            if (1 === i3.length || e2) return "\n";
            for (var r3 = 0, n3 = 0; n3 < i3.length; n3++) "\n" === i3[n3][0] && r3++;
            return r3 >= i3.length / 2 ? "\r\n" : "\r";
          };
        }
        function U(e) {
          return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
        }
        function E(C) {
          var S = (C = C || {}).delimiter, O = C.newline, x = C.comments, I = C.step, A = C.preview, T = C.fastMode, D = null, L = false, F = null == C.quoteChar ? '"' : C.quoteChar, j = F;
          if (void 0 !== C.escapeChar && (j = C.escapeChar), ("string" != typeof S || -1 < v.BAD_DELIMITERS.indexOf(S)) && (S = ","), x === S) throw new Error("Comment character same as delimiter");
          true === x ? x = "#" : ("string" != typeof x || -1 < v.BAD_DELIMITERS.indexOf(x)) && (x = false), "\n" !== O && "\r" !== O && "\r\n" !== O && (O = "\n");
          var z = 0, M = false;
          this.parse = function(i2, t, r2) {
            if ("string" != typeof i2) throw new Error("Input must be a string");
            var n2 = i2.length, e = S.length, s2 = O.length, a2 = x.length, o2 = q(I), h2 = [], u2 = [], d2 = [], f2 = z = 0;
            if (!i2) return w();
            if (T || false !== T && -1 === i2.indexOf(F)) {
              for (var l3 = i2.split(O), c2 = 0; c2 < l3.length; c2++) {
                if (d2 = l3[c2], z += d2.length, c2 !== l3.length - 1) z += O.length;
                else if (r2) return w();
                if (!x || d2.substring(0, a2) !== x) {
                  if (o2) {
                    if (h2 = [], k(d2.split(S)), R(), M) return w();
                  } else k(d2.split(S));
                  if (A && A <= c2) return h2 = h2.slice(0, A), w(true);
                }
              }
              return w();
            }
            for (var p2 = i2.indexOf(S, z), g2 = i2.indexOf(O, z), _4 = new RegExp(U(j) + U(F), "g"), m2 = i2.indexOf(F, z); ; ) if (i2[z] === F) for (m2 = z, z++; ; ) {
              if (-1 === (m2 = i2.indexOf(F, m2 + 1))) return r2 || u2.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h2.length, index: z }), E2();
              if (m2 === n2 - 1) return E2(i2.substring(z, m2).replace(_4, F));
              if (F === j && i2[m2 + 1] === j) m2++;
              else if (F === j || 0 === m2 || i2[m2 - 1] !== j) {
                -1 !== p2 && p2 < m2 + 1 && (p2 = i2.indexOf(S, m2 + 1));
                var y2 = v2(-1 === (g2 = -1 !== g2 && g2 < m2 + 1 ? i2.indexOf(O, m2 + 1) : g2) ? p2 : Math.min(p2, g2));
                if (i2.substr(m2 + 1 + y2, e) === S) {
                  d2.push(i2.substring(z, m2).replace(_4, F)), i2[z = m2 + 1 + y2 + e] !== F && (m2 = i2.indexOf(F, z)), p2 = i2.indexOf(S, z), g2 = i2.indexOf(O, z);
                  break;
                }
                y2 = v2(g2);
                if (i2.substring(m2 + 1 + y2, m2 + 1 + y2 + s2) === O) {
                  if (d2.push(i2.substring(z, m2).replace(_4, F)), b2(m2 + 1 + y2 + s2), p2 = i2.indexOf(S, z), m2 = i2.indexOf(F, z), o2 && (R(), M)) return w();
                  if (A && h2.length >= A) return w(true);
                  break;
                }
                u2.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h2.length, index: z }), m2++;
              }
            }
            else if (x && 0 === d2.length && i2.substring(z, z + a2) === x) {
              if (-1 === g2) return w();
              z = g2 + s2, g2 = i2.indexOf(O, z), p2 = i2.indexOf(S, z);
            } else if (-1 !== p2 && (p2 < g2 || -1 === g2)) d2.push(i2.substring(z, p2)), z = p2 + e, p2 = i2.indexOf(S, z);
            else {
              if (-1 === g2) break;
              if (d2.push(i2.substring(z, g2)), b2(g2 + s2), o2 && (R(), M)) return w();
              if (A && h2.length >= A) return w(true);
            }
            return E2();
            function k(e2) {
              h2.push(e2), f2 = z;
            }
            function v2(e2) {
              var t2 = 0;
              return t2 = -1 !== e2 && (e2 = i2.substring(m2 + 1, e2)) && "" === e2.trim() ? e2.length : t2;
            }
            function E2(e2) {
              return r2 || (void 0 === e2 && (e2 = i2.substring(z)), d2.push(e2), z = n2, k(d2), o2 && R()), w();
            }
            function b2(e2) {
              z = e2, k(d2), d2 = [], g2 = i2.indexOf(O, z);
            }
            function w(e2) {
              if (C.header && !t && h2.length && !L) {
                var s3 = h2[0], a3 = /* @__PURE__ */ Object.create(null), o3 = new Set(s3);
                let n3 = false;
                for (let r3 = 0; r3 < s3.length; r3++) {
                  let i3 = P(s3[r3]);
                  if (a3[i3 = q(C.transformHeader) ? C.transformHeader(i3, r3) : i3]) {
                    let e3, t2 = a3[i3];
                    for (; e3 = i3 + "_" + t2, t2++, o3.has(e3); ) ;
                    o3.add(e3), s3[r3] = e3, a3[i3]++, n3 = true, (D = null === D ? {} : D)[e3] = i3;
                  } else a3[i3] = 1, s3[r3] = i3;
                  o3.add(i3);
                }
                n3 && console.warn("Duplicate headers found and renamed."), L = true;
              }
              return { data: h2, errors: u2, meta: { delimiter: S, linebreak: O, aborted: M, truncated: !!e2, cursor: f2 + (t || 0), renamedHeaders: D } };
            }
            function R() {
              I(w()), h2 = [], u2 = [];
            }
          }, this.abort = function() {
            M = true;
          }, this.getCharIndex = function() {
            return z;
          };
        }
        function g(e) {
          var t = e.data, i2 = o[t.workerId], r2 = false;
          if (t.error) i2.userError(t.error, t.file);
          else if (t.results && t.results.data) {
            var n2 = { abort: function() {
              r2 = true, _3(t.workerId, { data: [], errors: [], meta: { aborted: true } });
            }, pause: m, resume: m };
            if (q(i2.userStep)) {
              for (var s2 = 0; s2 < t.results.data.length && (i2.userStep({ data: t.results.data[s2], errors: t.results.errors, meta: t.results.meta }, n2), !r2); s2++) ;
              delete t.results;
            } else q(i2.userChunk) && (i2.userChunk(t.results, n2, t.file), delete t.results);
          }
          t.finished && !r2 && _3(t.workerId, t.results);
        }
        function _3(e, t) {
          var i2 = o[e];
          q(i2.userComplete) && i2.userComplete(t), i2.terminate(), delete o[e];
        }
        function m() {
          throw new Error("Not implemented.");
        }
        function b(e) {
          if ("object" != typeof e || null === e) return e;
          var t, i2 = Array.isArray(e) ? [] : {};
          for (t in e) i2[t] = b(e[t]);
          return i2;
        }
        function y(e, t) {
          return function() {
            e.apply(t, arguments);
          };
        }
        function q(e) {
          return "function" == typeof e;
        }
        return v.parse = function(e, t) {
          var i2 = (t = t || {}).dynamicTyping || false;
          q(i2) && (t.dynamicTypingFunction = i2, i2 = {});
          if (t.dynamicTyping = i2, t.transform = !!q(t.transform) && t.transform, !t.worker || !v.WORKERS_SUPPORTED) return i2 = null, v.NODE_STREAM_INPUT, "string" == typeof e ? (e = P(e), i2 = new (t.download ? f : c)(t)) : true === e.readable && q(e.read) && q(e.on) ? i2 = new p(t) : (n.File && e instanceof File || e instanceof Object) && (i2 = new l2(t)), i2.stream(e);
          (i2 = (() => {
            var e2;
            return !!v.WORKERS_SUPPORTED && (e2 = (() => {
              var e3 = n.URL || n.webkitURL || null, t2 = r.toString();
              return v.BLOB_URL || (v.BLOB_URL = e3.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", t2, ")();"], { type: "text/javascript" })));
            })(), (e2 = new n.Worker(e2)).onmessage = g, e2.id = h++, o[e2.id] = e2);
          })()).userStep = t.step, i2.userChunk = t.chunk, i2.userComplete = t.complete, i2.userError = t.error, t.step = q(t.step), t.chunk = q(t.chunk), t.complete = q(t.complete), t.error = q(t.error), delete t.worker, i2.postMessage({ input: e, config: t, workerId: i2.id });
        }, v.unparse = function(e, t) {
          var s2 = false, _4 = true, m2 = ",", y2 = "\r\n", a2 = '"', o2 = a2 + a2, i2 = false, r2 = null, h2 = false, u2 = ((() => {
            if ("object" == typeof t) {
              if ("string" != typeof t.delimiter || v.BAD_DELIMITERS.filter(function(e2) {
                return -1 !== t.delimiter.indexOf(e2);
              }).length || (m2 = t.delimiter), "boolean" != typeof t.quotes && "function" != typeof t.quotes && !Array.isArray(t.quotes) || (s2 = t.quotes), "boolean" != typeof t.skipEmptyLines && "string" != typeof t.skipEmptyLines || (i2 = t.skipEmptyLines), "string" == typeof t.newline && (y2 = t.newline), "string" == typeof t.quoteChar && (a2 = t.quoteChar, o2 = a2 + a2), "boolean" == typeof t.header && (_4 = t.header), Array.isArray(t.columns)) {
                if (0 === t.columns.length) throw new Error("Option columns is empty");
                r2 = t.columns;
              }
              void 0 !== t.escapeChar && (o2 = t.escapeChar + a2), t.escapeFormulae instanceof RegExp ? h2 = t.escapeFormulae : "boolean" == typeof t.escapeFormulae && t.escapeFormulae && (h2 = /^[=+\-@\t\r].*$/);
            }
          })(), new RegExp(U(a2), "g"));
          "string" == typeof e && (e = JSON.parse(e));
          if (Array.isArray(e)) {
            if (!e.length || Array.isArray(e[0])) return n2(null, e, i2);
            if ("object" == typeof e[0]) return n2(r2 || Object.keys(e[0]), e, i2);
          } else if ("object" == typeof e) return "string" == typeof e.data && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || r2), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : "object" == typeof e.data[0] ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || "object" == typeof e.data[0] || (e.data = [e.data])), n2(e.fields || [], e.data || [], i2);
          throw new Error("Unable to serialize unrecognized input");
          function n2(e2, t2, i3) {
            var r3 = "", n3 = ("string" == typeof e2 && (e2 = JSON.parse(e2)), "string" == typeof t2 && (t2 = JSON.parse(t2)), Array.isArray(e2) && 0 < e2.length), s3 = !Array.isArray(t2[0]);
            if (n3 && _4) {
              for (var a3 = 0; a3 < e2.length; a3++) 0 < a3 && (r3 += m2), r3 += k(e2[a3], a3);
              0 < t2.length && (r3 += y2);
            }
            for (var o3 = 0; o3 < t2.length; o3++) {
              var h3 = (n3 ? e2 : t2[o3]).length, u3 = false, d2 = n3 ? 0 === Object.keys(t2[o3]).length : 0 === t2[o3].length;
              if (i3 && !n3 && (u3 = "greedy" === i3 ? "" === t2[o3].join("").trim() : 1 === t2[o3].length && 0 === t2[o3][0].length), "greedy" === i3 && n3) {
                for (var f2 = [], l3 = 0; l3 < h3; l3++) {
                  var c2 = s3 ? e2[l3] : l3;
                  f2.push(t2[o3][c2]);
                }
                u3 = "" === f2.join("").trim();
              }
              if (!u3) {
                for (var p2 = 0; p2 < h3; p2++) {
                  0 < p2 && !d2 && (r3 += m2);
                  var g2 = n3 && s3 ? e2[p2] : p2;
                  r3 += k(t2[o3][g2], p2);
                }
                o3 < t2.length - 1 && (!i3 || 0 < h3 && !d2) && (r3 += y2);
              }
            }
            return r3;
          }
          function k(e2, t2) {
            var i3, r3, n3;
            return null == e2 ? "" : e2.constructor === Date ? JSON.stringify(e2).slice(1, 25) : (n3 = false, h2 && "string" == typeof e2 && h2.test(e2) && (e2 = "'" + e2, n3 = true), r3 = (i3 = e2.toString()).replace(u2, o2), (n3 = n3 || true === s2 || "function" == typeof s2 && s2(e2, t2) || Array.isArray(s2) && s2[t2] || ((e3, t3) => {
              for (var i4 = 0; i4 < t3.length; i4++) if (-1 < e3.indexOf(t3[i4])) return true;
              return false;
            })(r3, v.BAD_DELIMITERS) || -1 < r3.indexOf(m2) || -1 < i3.indexOf(a2) || " " === r3.charAt(0) || " " === r3.charAt(r3.length - 1)) ? a2 + r3 + a2 : r3);
          }
        }, v.RECORD_SEP = String.fromCharCode(30), v.UNIT_SEP = String.fromCharCode(31), v.BYTE_ORDER_MARK = "\uFEFF", v.BAD_DELIMITERS = ["\r", "\n", '"', v.BYTE_ORDER_MARK], v.WORKERS_SUPPORTED = !s && !!n.Worker, v.NODE_STREAM_INPUT = 1, v.LocalChunkSize = 10485760, v.RemoteChunkSize = 5242880, v.DefaultDelimiter = ",", v.Parser = E, v.ParserHandle = i, v.NetworkStreamer = f, v.FileStreamer = l2, v.StringStreamer = c, v.ReadableStreamStreamer = p, n.jQuery && ((d = n.jQuery).fn.parse = function(o2) {
          var i2 = o2.config || {}, h2 = [];
          return this.each(function(e2) {
            if (!("INPUT" === d(this).prop("tagName").toUpperCase() && "file" === d(this).attr("type").toLowerCase() && n.FileReader) || !this.files || 0 === this.files.length) return true;
            for (var t = 0; t < this.files.length; t++) h2.push({ file: this.files[t], inputElem: this, instanceConfig: d.extend({}, i2) });
          }), e(), this;
          function e() {
            if (0 === h2.length) q(o2.complete) && o2.complete();
            else {
              var e2, t, i3, r2, n2 = h2[0];
              if (q(o2.before)) {
                var s2 = o2.before(n2.file, n2.inputElem);
                if ("object" == typeof s2) {
                  if ("abort" === s2.action) return e2 = "AbortError", t = n2.file, i3 = n2.inputElem, r2 = s2.reason, void (q(o2.error) && o2.error({ name: e2 }, t, i3, r2));
                  if ("skip" === s2.action) return void u2();
                  "object" == typeof s2.config && (n2.instanceConfig = d.extend(n2.instanceConfig, s2.config));
                } else if ("skip" === s2) return void u2();
              }
              var a2 = n2.instanceConfig.complete;
              n2.instanceConfig.complete = function(e3) {
                q(a2) && a2(e3, n2.file, n2.inputElem), u2();
              }, v.parse(n2.file, n2.instanceConfig);
            }
          }
          function u2() {
            h2.splice(0, 1), e();
          }
        }), a && (n.onmessage = function(e) {
          e = e.data;
          void 0 === v.WORKER_ID && e && (v.WORKER_ID = e.workerId);
          "string" == typeof e.input ? n.postMessage({ workerId: v.WORKER_ID, results: v.parse(e.input, e.config), finished: true }) : (n.File && e.input instanceof File || e.input instanceof Object) && (e = v.parse(e.input, e.config)) && n.postMessage({ workerId: v.WORKER_ID, results: e, finished: true });
        }), (f.prototype = Object.create(u.prototype)).constructor = f, (l2.prototype = Object.create(u.prototype)).constructor = l2, (c.prototype = Object.create(c.prototype)).constructor = c, (p.prototype = Object.create(u.prototype)).constructor = p, v;
      });
    }
  });

  // node_modules/underscore/modules/_setup.js
  var VERSION, root2, ArrayProto, ObjProto, SymbolProto, push, slice, toString, hasOwnProperty, supportsArrayBuffer, supportsDataView, nativeIsArray, nativeKeys, nativeCreate, nativeIsView, _isNaN, _isFinite, hasEnumBug, nonEnumerableProps, MAX_ARRAY_INDEX;
  var init_setup = __esm({
    "node_modules/underscore/modules/_setup.js"() {
      VERSION = "1.13.8";
      root2 = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || Function("return this")() || {};
      ArrayProto = Array.prototype;
      ObjProto = Object.prototype;
      SymbolProto = typeof Symbol !== "undefined" ? Symbol.prototype : null;
      push = ArrayProto.push;
      slice = ArrayProto.slice;
      toString = ObjProto.toString;
      hasOwnProperty = ObjProto.hasOwnProperty;
      supportsArrayBuffer = typeof ArrayBuffer !== "undefined";
      supportsDataView = typeof DataView !== "undefined";
      nativeIsArray = Array.isArray;
      nativeKeys = Object.keys;
      nativeCreate = Object.create;
      nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
      _isNaN = isNaN;
      _isFinite = isFinite;
      hasEnumBug = !{ toString: null }.propertyIsEnumerable("toString");
      nonEnumerableProps = [
        "valueOf",
        "isPrototypeOf",
        "toString",
        "propertyIsEnumerable",
        "hasOwnProperty",
        "toLocaleString"
      ];
      MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
    }
  });

  // node_modules/underscore/modules/restArguments.js
  function restArguments(func, startIndex) {
    startIndex = startIndex == null ? func.length - 1 : +startIndex;
    return function() {
      var length = Math.max(arguments.length - startIndex, 0), rest2 = Array(length), index = 0;
      for (; index < length; index++) {
        rest2[index] = arguments[index + startIndex];
      }
      switch (startIndex) {
        case 0:
          return func.call(this, rest2);
        case 1:
          return func.call(this, arguments[0], rest2);
        case 2:
          return func.call(this, arguments[0], arguments[1], rest2);
      }
      var args = Array(startIndex + 1);
      for (index = 0; index < startIndex; index++) {
        args[index] = arguments[index];
      }
      args[startIndex] = rest2;
      return func.apply(this, args);
    };
  }
  var init_restArguments = __esm({
    "node_modules/underscore/modules/restArguments.js"() {
    }
  });

  // node_modules/underscore/modules/isObject.js
  function isObject2(obj2) {
    var type = typeof obj2;
    return type === "function" || type === "object" && !!obj2;
  }
  var init_isObject = __esm({
    "node_modules/underscore/modules/isObject.js"() {
    }
  });

  // node_modules/underscore/modules/isNull.js
  function isNull(obj2) {
    return obj2 === null;
  }
  var init_isNull = __esm({
    "node_modules/underscore/modules/isNull.js"() {
    }
  });

  // node_modules/underscore/modules/isUndefined.js
  function isUndefined(obj2) {
    return obj2 === void 0;
  }
  var init_isUndefined = __esm({
    "node_modules/underscore/modules/isUndefined.js"() {
    }
  });

  // node_modules/underscore/modules/isBoolean.js
  function isBoolean(obj2) {
    return obj2 === true || obj2 === false || toString.call(obj2) === "[object Boolean]";
  }
  var init_isBoolean = __esm({
    "node_modules/underscore/modules/isBoolean.js"() {
      init_setup();
    }
  });

  // node_modules/underscore/modules/isElement.js
  function isElement(obj2) {
    return !!(obj2 && obj2.nodeType === 1);
  }
  var init_isElement = __esm({
    "node_modules/underscore/modules/isElement.js"() {
    }
  });

  // node_modules/underscore/modules/_tagTester.js
  function tagTester(name) {
    var tag = "[object " + name + "]";
    return function(obj2) {
      return toString.call(obj2) === tag;
    };
  }
  var init_tagTester = __esm({
    "node_modules/underscore/modules/_tagTester.js"() {
      init_setup();
    }
  });

  // node_modules/underscore/modules/isString.js
  var isString_default;
  var init_isString = __esm({
    "node_modules/underscore/modules/isString.js"() {
      init_tagTester();
      isString_default = tagTester("String");
    }
  });

  // node_modules/underscore/modules/isNumber.js
  var isNumber_default;
  var init_isNumber = __esm({
    "node_modules/underscore/modules/isNumber.js"() {
      init_tagTester();
      isNumber_default = tagTester("Number");
    }
  });

  // node_modules/underscore/modules/isDate.js
  var isDate_default;
  var init_isDate = __esm({
    "node_modules/underscore/modules/isDate.js"() {
      init_tagTester();
      isDate_default = tagTester("Date");
    }
  });

  // node_modules/underscore/modules/isRegExp.js
  var isRegExp_default;
  var init_isRegExp = __esm({
    "node_modules/underscore/modules/isRegExp.js"() {
      init_tagTester();
      isRegExp_default = tagTester("RegExp");
    }
  });

  // node_modules/underscore/modules/isError.js
  var isError_default;
  var init_isError = __esm({
    "node_modules/underscore/modules/isError.js"() {
      init_tagTester();
      isError_default = tagTester("Error");
    }
  });

  // node_modules/underscore/modules/isSymbol.js
  var isSymbol_default;
  var init_isSymbol = __esm({
    "node_modules/underscore/modules/isSymbol.js"() {
      init_tagTester();
      isSymbol_default = tagTester("Symbol");
    }
  });

  // node_modules/underscore/modules/isArrayBuffer.js
  var isArrayBuffer_default;
  var init_isArrayBuffer = __esm({
    "node_modules/underscore/modules/isArrayBuffer.js"() {
      init_tagTester();
      isArrayBuffer_default = tagTester("ArrayBuffer");
    }
  });

  // node_modules/underscore/modules/isFunction.js
  var isFunction, nodelist, isFunction_default;
  var init_isFunction = __esm({
    "node_modules/underscore/modules/isFunction.js"() {
      init_tagTester();
      init_setup();
      isFunction = tagTester("Function");
      nodelist = root2.document && root2.document.childNodes;
      if (typeof /./ != "function" && typeof Int8Array != "object" && typeof nodelist != "function") {
        isFunction = function(obj2) {
          return typeof obj2 == "function" || false;
        };
      }
      isFunction_default = isFunction;
    }
  });

  // node_modules/underscore/modules/_hasObjectTag.js
  var hasObjectTag_default;
  var init_hasObjectTag = __esm({
    "node_modules/underscore/modules/_hasObjectTag.js"() {
      init_tagTester();
      hasObjectTag_default = tagTester("Object");
    }
  });

  // node_modules/underscore/modules/_stringTagBug.js
  var hasDataViewBug, isIE11;
  var init_stringTagBug = __esm({
    "node_modules/underscore/modules/_stringTagBug.js"() {
      init_setup();
      init_hasObjectTag();
      hasDataViewBug = supportsDataView && (!/\[native code\]/.test(String(DataView)) || hasObjectTag_default(new DataView(new ArrayBuffer(8))));
      isIE11 = typeof Map !== "undefined" && hasObjectTag_default(/* @__PURE__ */ new Map());
    }
  });

  // node_modules/underscore/modules/isDataView.js
  function alternateIsDataView(obj2) {
    return obj2 != null && isFunction_default(obj2.getInt8) && isArrayBuffer_default(obj2.buffer);
  }
  var isDataView, isDataView_default;
  var init_isDataView = __esm({
    "node_modules/underscore/modules/isDataView.js"() {
      init_tagTester();
      init_isFunction();
      init_isArrayBuffer();
      init_stringTagBug();
      isDataView = tagTester("DataView");
      isDataView_default = hasDataViewBug ? alternateIsDataView : isDataView;
    }
  });

  // node_modules/underscore/modules/isArray.js
  var isArray_default;
  var init_isArray = __esm({
    "node_modules/underscore/modules/isArray.js"() {
      init_setup();
      init_tagTester();
      isArray_default = nativeIsArray || tagTester("Array");
    }
  });

  // node_modules/underscore/modules/_has.js
  function has2(obj2, key) {
    return obj2 != null && hasOwnProperty.call(obj2, key);
  }
  var init_has = __esm({
    "node_modules/underscore/modules/_has.js"() {
      init_setup();
    }
  });

  // node_modules/underscore/modules/isArguments.js
  var isArguments, isArguments_default;
  var init_isArguments = __esm({
    "node_modules/underscore/modules/isArguments.js"() {
      init_tagTester();
      init_has();
      isArguments = tagTester("Arguments");
      (function() {
        if (!isArguments(arguments)) {
          isArguments = function(obj2) {
            return has2(obj2, "callee");
          };
        }
      })();
      isArguments_default = isArguments;
    }
  });

  // node_modules/underscore/modules/isFinite.js
  function isFinite2(obj2) {
    return !isSymbol_default(obj2) && _isFinite(obj2) && !isNaN(parseFloat(obj2));
  }
  var init_isFinite = __esm({
    "node_modules/underscore/modules/isFinite.js"() {
      init_setup();
      init_isSymbol();
    }
  });

  // node_modules/underscore/modules/isNaN.js
  function isNaN2(obj2) {
    return isNumber_default(obj2) && _isNaN(obj2);
  }
  var init_isNaN = __esm({
    "node_modules/underscore/modules/isNaN.js"() {
      init_setup();
      init_isNumber();
    }
  });

  // node_modules/underscore/modules/constant.js
  function constant(value) {
    return function() {
      return value;
    };
  }
  var init_constant = __esm({
    "node_modules/underscore/modules/constant.js"() {
    }
  });

  // node_modules/underscore/modules/_createSizePropertyCheck.js
  function createSizePropertyCheck(getSizeProperty) {
    return function(collection) {
      var sizeProperty = getSizeProperty(collection);
      return typeof sizeProperty == "number" && sizeProperty >= 0 && sizeProperty <= MAX_ARRAY_INDEX;
    };
  }
  var init_createSizePropertyCheck = __esm({
    "node_modules/underscore/modules/_createSizePropertyCheck.js"() {
      init_setup();
    }
  });

  // node_modules/underscore/modules/_shallowProperty.js
  function shallowProperty(key) {
    return function(obj2) {
      return obj2 == null ? void 0 : obj2[key];
    };
  }
  var init_shallowProperty = __esm({
    "node_modules/underscore/modules/_shallowProperty.js"() {
    }
  });

  // node_modules/underscore/modules/_getByteLength.js
  var getByteLength_default;
  var init_getByteLength = __esm({
    "node_modules/underscore/modules/_getByteLength.js"() {
      init_shallowProperty();
      getByteLength_default = shallowProperty("byteLength");
    }
  });

  // node_modules/underscore/modules/_isBufferLike.js
  var isBufferLike_default;
  var init_isBufferLike = __esm({
    "node_modules/underscore/modules/_isBufferLike.js"() {
      init_createSizePropertyCheck();
      init_getByteLength();
      isBufferLike_default = createSizePropertyCheck(getByteLength_default);
    }
  });

  // node_modules/underscore/modules/isTypedArray.js
  function isTypedArray(obj2) {
    return nativeIsView ? nativeIsView(obj2) && !isDataView_default(obj2) : isBufferLike_default(obj2) && typedArrayPattern.test(toString.call(obj2));
  }
  var typedArrayPattern, isTypedArray_default;
  var init_isTypedArray = __esm({
    "node_modules/underscore/modules/isTypedArray.js"() {
      init_setup();
      init_isDataView();
      init_constant();
      init_isBufferLike();
      typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
      isTypedArray_default = supportsArrayBuffer ? isTypedArray : constant(false);
    }
  });

  // node_modules/underscore/modules/_getLength.js
  var getLength_default;
  var init_getLength = __esm({
    "node_modules/underscore/modules/_getLength.js"() {
      init_shallowProperty();
      getLength_default = shallowProperty("length");
    }
  });

  // node_modules/underscore/modules/_collectNonEnumProps.js
  function emulatedSet(keys3) {
    var hash = {};
    for (var l2 = keys3.length, i = 0; i < l2; ++i) hash[keys3[i]] = true;
    return {
      contains: function(key) {
        return hash[key] === true;
      },
      push: function(key) {
        hash[key] = true;
        return keys3.push(key);
      }
    };
  }
  function collectNonEnumProps(obj2, keys3) {
    keys3 = emulatedSet(keys3);
    var nonEnumIdx = nonEnumerableProps.length;
    var constructor = obj2.constructor;
    var proto = isFunction_default(constructor) && constructor.prototype || ObjProto;
    var prop = "constructor";
    if (has2(obj2, prop) && !keys3.contains(prop)) keys3.push(prop);
    while (nonEnumIdx--) {
      prop = nonEnumerableProps[nonEnumIdx];
      if (prop in obj2 && obj2[prop] !== proto[prop] && !keys3.contains(prop)) {
        keys3.push(prop);
      }
    }
  }
  var init_collectNonEnumProps = __esm({
    "node_modules/underscore/modules/_collectNonEnumProps.js"() {
      init_setup();
      init_isFunction();
      init_has();
    }
  });

  // node_modules/underscore/modules/keys.js
  function keys2(obj2) {
    if (!isObject2(obj2)) return [];
    if (nativeKeys) return nativeKeys(obj2);
    var keys3 = [];
    for (var key in obj2) if (has2(obj2, key)) keys3.push(key);
    if (hasEnumBug) collectNonEnumProps(obj2, keys3);
    return keys3;
  }
  var init_keys = __esm({
    "node_modules/underscore/modules/keys.js"() {
      init_isObject();
      init_setup();
      init_has();
      init_collectNonEnumProps();
    }
  });

  // node_modules/underscore/modules/isEmpty.js
  function isEmpty(obj2) {
    if (obj2 == null) return true;
    var length = getLength_default(obj2);
    if (typeof length == "number" && (isArray_default(obj2) || isString_default(obj2) || isArguments_default(obj2))) return length === 0;
    return getLength_default(keys2(obj2)) === 0;
  }
  var init_isEmpty = __esm({
    "node_modules/underscore/modules/isEmpty.js"() {
      init_getLength();
      init_isArray();
      init_isString();
      init_isArguments();
      init_keys();
    }
  });

  // node_modules/underscore/modules/isMatch.js
  function isMatch(object2, attrs) {
    var _keys = keys2(attrs), length = _keys.length;
    if (object2 == null) return !length;
    var obj2 = Object(object2);
    for (var i = 0; i < length; i++) {
      var key = _keys[i];
      if (attrs[key] !== obj2[key] || !(key in obj2)) return false;
    }
    return true;
  }
  var init_isMatch = __esm({
    "node_modules/underscore/modules/isMatch.js"() {
      init_keys();
    }
  });

  // node_modules/underscore/modules/underscore.js
  function _(obj2) {
    if (obj2 instanceof _) return obj2;
    if (!(this instanceof _)) return new _(obj2);
    this._wrapped = obj2;
  }
  var init_underscore = __esm({
    "node_modules/underscore/modules/underscore.js"() {
      init_setup();
      _.VERSION = VERSION;
      _.prototype.value = function() {
        return this._wrapped;
      };
      _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
      _.prototype.toString = function() {
        return String(this._wrapped);
      };
    }
  });

  // node_modules/underscore/modules/_toBufferView.js
  function toBufferView(bufferSource) {
    return new Uint8Array(
      bufferSource.buffer || bufferSource,
      bufferSource.byteOffset || 0,
      getByteLength_default(bufferSource)
    );
  }
  var init_toBufferView = __esm({
    "node_modules/underscore/modules/_toBufferView.js"() {
      init_getByteLength();
    }
  });

  // node_modules/underscore/modules/isEqual.js
  function isEqual(a, b) {
    var todo = [{ a, b }];
    var aStack = [], bStack = [];
    while (todo.length) {
      var frame = todo.pop();
      if (frame === true) {
        aStack.pop();
        bStack.pop();
        continue;
      }
      a = frame.a;
      b = frame.b;
      if (a === b) {
        if (a !== 0 || 1 / a === 1 / b) continue;
        return false;
      }
      if (a == null || b == null) return false;
      if (a !== a) {
        if (b !== b) continue;
        return false;
      }
      var type = typeof a;
      if (type !== "function" && type !== "object" && typeof b != "object") return false;
      if (a instanceof _) a = a._wrapped;
      if (b instanceof _) b = b._wrapped;
      var className = toString.call(a);
      if (className !== toString.call(b)) return false;
      if (hasDataViewBug && className == "[object Object]" && isDataView_default(a)) {
        if (!isDataView_default(b)) return false;
        className = tagDataView;
      }
      switch (className) {
        // These types are compared by value.
        case "[object RegExp]":
        // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
        case "[object String]":
          if ("" + a === "" + b) continue;
          return false;
        case "[object Number]":
          todo.push({ a: +a, b: +b });
          continue;
        case "[object Date]":
        case "[object Boolean]":
          if (+a === +b) continue;
          return false;
        case "[object Symbol]":
          if (SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b)) continue;
          return false;
        case "[object ArrayBuffer]":
        case tagDataView:
          todo.push({ a: toBufferView(a), b: toBufferView(b) });
          continue;
      }
      var areArrays = className === "[object Array]";
      if (!areArrays && isTypedArray_default(a)) {
        var byteLength = getByteLength_default(a);
        if (byteLength !== getByteLength_default(b)) return false;
        if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) continue;
        areArrays = true;
      }
      if (!areArrays) {
        if (typeof a != "object" || typeof b != "object") return false;
        var aCtor = a.constructor, bCtor = b.constructor;
        if (aCtor !== bCtor && !(isFunction_default(aCtor) && aCtor instanceof aCtor && isFunction_default(bCtor) && bCtor instanceof bCtor) && ("constructor" in a && "constructor" in b)) {
          return false;
        }
      }
      var length = aStack.length;
      while (length--) {
        if (aStack[length] === a) {
          if (bStack[length] === b) break;
          return false;
        }
      }
      if (length >= 0) continue;
      aStack.push(a);
      bStack.push(b);
      todo.push(true);
      if (areArrays) {
        length = a.length;
        if (length !== b.length) return false;
        while (length--) {
          todo.push({ a: a[length], b: b[length] });
        }
      } else {
        var _keys = keys2(a), key;
        length = _keys.length;
        if (keys2(b).length !== length) return false;
        while (length--) {
          key = _keys[length];
          if (!has2(b, key)) return false;
          todo.push({ a: a[key], b: b[key] });
        }
      }
    }
    return true;
  }
  var tagDataView;
  var init_isEqual = __esm({
    "node_modules/underscore/modules/isEqual.js"() {
      init_underscore();
      init_setup();
      init_getByteLength();
      init_isTypedArray();
      init_isFunction();
      init_stringTagBug();
      init_isDataView();
      init_keys();
      init_has();
      init_toBufferView();
      tagDataView = "[object DataView]";
    }
  });

  // node_modules/underscore/modules/allKeys.js
  function allKeys(obj2) {
    if (!isObject2(obj2)) return [];
    var keys3 = [];
    for (var key in obj2) keys3.push(key);
    if (hasEnumBug) collectNonEnumProps(obj2, keys3);
    return keys3;
  }
  var init_allKeys = __esm({
    "node_modules/underscore/modules/allKeys.js"() {
      init_isObject();
      init_setup();
      init_collectNonEnumProps();
    }
  });

  // node_modules/underscore/modules/_methodFingerprint.js
  function ie11fingerprint(methods) {
    var length = getLength_default(methods);
    return function(obj2) {
      if (obj2 == null) return false;
      var keys3 = allKeys(obj2);
      if (getLength_default(keys3)) return false;
      for (var i = 0; i < length; i++) {
        if (!isFunction_default(obj2[methods[i]])) return false;
      }
      return methods !== weakMapMethods || !isFunction_default(obj2[forEachName]);
    };
  }
  var forEachName, hasName, commonInit, mapTail, mapMethods, weakMapMethods, setMethods;
  var init_methodFingerprint = __esm({
    "node_modules/underscore/modules/_methodFingerprint.js"() {
      init_getLength();
      init_isFunction();
      init_allKeys();
      forEachName = "forEach";
      hasName = "has";
      commonInit = ["clear", "delete"];
      mapTail = ["get", hasName, "set"];
      mapMethods = commonInit.concat(forEachName, mapTail);
      weakMapMethods = commonInit.concat(mapTail);
      setMethods = ["add"].concat(commonInit, forEachName, hasName);
    }
  });

  // node_modules/underscore/modules/isMap.js
  var isMap_default;
  var init_isMap = __esm({
    "node_modules/underscore/modules/isMap.js"() {
      init_tagTester();
      init_stringTagBug();
      init_methodFingerprint();
      isMap_default = isIE11 ? ie11fingerprint(mapMethods) : tagTester("Map");
    }
  });

  // node_modules/underscore/modules/isWeakMap.js
  var isWeakMap_default;
  var init_isWeakMap = __esm({
    "node_modules/underscore/modules/isWeakMap.js"() {
      init_tagTester();
      init_stringTagBug();
      init_methodFingerprint();
      isWeakMap_default = isIE11 ? ie11fingerprint(weakMapMethods) : tagTester("WeakMap");
    }
  });

  // node_modules/underscore/modules/isSet.js
  var isSet_default;
  var init_isSet = __esm({
    "node_modules/underscore/modules/isSet.js"() {
      init_tagTester();
      init_stringTagBug();
      init_methodFingerprint();
      isSet_default = isIE11 ? ie11fingerprint(setMethods) : tagTester("Set");
    }
  });

  // node_modules/underscore/modules/isWeakSet.js
  var isWeakSet_default;
  var init_isWeakSet = __esm({
    "node_modules/underscore/modules/isWeakSet.js"() {
      init_tagTester();
      isWeakSet_default = tagTester("WeakSet");
    }
  });

  // node_modules/underscore/modules/values.js
  function values(obj2) {
    var _keys = keys2(obj2);
    var length = _keys.length;
    var values2 = Array(length);
    for (var i = 0; i < length; i++) {
      values2[i] = obj2[_keys[i]];
    }
    return values2;
  }
  var init_values = __esm({
    "node_modules/underscore/modules/values.js"() {
      init_keys();
    }
  });

  // node_modules/underscore/modules/pairs.js
  function pairs(obj2) {
    var _keys = keys2(obj2);
    var length = _keys.length;
    var pairs2 = Array(length);
    for (var i = 0; i < length; i++) {
      pairs2[i] = [_keys[i], obj2[_keys[i]]];
    }
    return pairs2;
  }
  var init_pairs = __esm({
    "node_modules/underscore/modules/pairs.js"() {
      init_keys();
    }
  });

  // node_modules/underscore/modules/invert.js
  function invert(obj2) {
    var result2 = {};
    var _keys = keys2(obj2);
    for (var i = 0, length = _keys.length; i < length; i++) {
      result2[obj2[_keys[i]]] = _keys[i];
    }
    return result2;
  }
  var init_invert = __esm({
    "node_modules/underscore/modules/invert.js"() {
      init_keys();
    }
  });

  // node_modules/underscore/modules/functions.js
  function functions(obj2) {
    var names = [];
    for (var key in obj2) {
      if (isFunction_default(obj2[key])) names.push(key);
    }
    return names.sort();
  }
  var init_functions = __esm({
    "node_modules/underscore/modules/functions.js"() {
      init_isFunction();
    }
  });

  // node_modules/underscore/modules/_createAssigner.js
  function createAssigner(keysFunc, defaults) {
    return function(obj2) {
      var length = arguments.length;
      if (defaults) obj2 = Object(obj2);
      if (length < 2 || obj2 == null) return obj2;
      for (var index = 1; index < length; index++) {
        var source = arguments[index], keys3 = keysFunc(source), l2 = keys3.length;
        for (var i = 0; i < l2; i++) {
          var key = keys3[i];
          if (!defaults || obj2[key] === void 0) obj2[key] = source[key];
        }
      }
      return obj2;
    };
  }
  var init_createAssigner = __esm({
    "node_modules/underscore/modules/_createAssigner.js"() {
    }
  });

  // node_modules/underscore/modules/extend.js
  var extend_default;
  var init_extend = __esm({
    "node_modules/underscore/modules/extend.js"() {
      init_createAssigner();
      init_allKeys();
      extend_default = createAssigner(allKeys);
    }
  });

  // node_modules/underscore/modules/extendOwn.js
  var extendOwn_default;
  var init_extendOwn = __esm({
    "node_modules/underscore/modules/extendOwn.js"() {
      init_createAssigner();
      init_keys();
      extendOwn_default = createAssigner(keys2);
    }
  });

  // node_modules/underscore/modules/defaults.js
  var defaults_default;
  var init_defaults = __esm({
    "node_modules/underscore/modules/defaults.js"() {
      init_createAssigner();
      init_allKeys();
      defaults_default = createAssigner(allKeys, true);
    }
  });

  // node_modules/underscore/modules/_baseCreate.js
  function ctor() {
    return function() {
    };
  }
  function baseCreate(prototype) {
    if (!isObject2(prototype)) return {};
    if (nativeCreate) return nativeCreate(prototype);
    var Ctor = ctor();
    Ctor.prototype = prototype;
    var result2 = new Ctor();
    Ctor.prototype = null;
    return result2;
  }
  var init_baseCreate = __esm({
    "node_modules/underscore/modules/_baseCreate.js"() {
      init_isObject();
      init_setup();
    }
  });

  // node_modules/underscore/modules/create.js
  function create(prototype, props) {
    var result2 = baseCreate(prototype);
    if (props) extendOwn_default(result2, props);
    return result2;
  }
  var init_create = __esm({
    "node_modules/underscore/modules/create.js"() {
      init_baseCreate();
      init_extendOwn();
    }
  });

  // node_modules/underscore/modules/clone.js
  function clone(obj2) {
    if (!isObject2(obj2)) return obj2;
    return isArray_default(obj2) ? obj2.slice() : extend_default({}, obj2);
  }
  var init_clone = __esm({
    "node_modules/underscore/modules/clone.js"() {
      init_isObject();
      init_isArray();
      init_extend();
    }
  });

  // node_modules/underscore/modules/tap.js
  function tap(obj2, interceptor) {
    interceptor(obj2);
    return obj2;
  }
  var init_tap = __esm({
    "node_modules/underscore/modules/tap.js"() {
    }
  });

  // node_modules/underscore/modules/toPath.js
  function toPath(path) {
    return isArray_default(path) ? path : [path];
  }
  var init_toPath = __esm({
    "node_modules/underscore/modules/toPath.js"() {
      init_underscore();
      init_isArray();
      _.toPath = toPath;
    }
  });

  // node_modules/underscore/modules/_toPath.js
  function toPath2(path) {
    return _.toPath(path);
  }
  var init_toPath2 = __esm({
    "node_modules/underscore/modules/_toPath.js"() {
      init_underscore();
      init_toPath();
    }
  });

  // node_modules/underscore/modules/_deepGet.js
  function deepGet(obj2, path) {
    var length = path.length;
    for (var i = 0; i < length; i++) {
      if (obj2 == null) return void 0;
      obj2 = obj2[path[i]];
    }
    return length ? obj2 : void 0;
  }
  var init_deepGet = __esm({
    "node_modules/underscore/modules/_deepGet.js"() {
    }
  });

  // node_modules/underscore/modules/get.js
  function get(object2, path, defaultValue) {
    var value = deepGet(object2, toPath2(path));
    return isUndefined(value) ? defaultValue : value;
  }
  var init_get = __esm({
    "node_modules/underscore/modules/get.js"() {
      init_toPath2();
      init_deepGet();
      init_isUndefined();
    }
  });

  // node_modules/underscore/modules/has.js
  function has3(obj2, path) {
    path = toPath2(path);
    var length = path.length;
    for (var i = 0; i < length; i++) {
      var key = path[i];
      if (!has2(obj2, key)) return false;
      obj2 = obj2[key];
    }
    return !!length;
  }
  var init_has2 = __esm({
    "node_modules/underscore/modules/has.js"() {
      init_has();
      init_toPath2();
    }
  });

  // node_modules/underscore/modules/identity.js
  function identity(value) {
    return value;
  }
  var init_identity = __esm({
    "node_modules/underscore/modules/identity.js"() {
    }
  });

  // node_modules/underscore/modules/matcher.js
  function matcher(attrs) {
    attrs = extendOwn_default({}, attrs);
    return function(obj2) {
      return isMatch(obj2, attrs);
    };
  }
  var init_matcher = __esm({
    "node_modules/underscore/modules/matcher.js"() {
      init_extendOwn();
      init_isMatch();
    }
  });

  // node_modules/underscore/modules/property.js
  function property(path) {
    path = toPath2(path);
    return function(obj2) {
      return deepGet(obj2, path);
    };
  }
  var init_property = __esm({
    "node_modules/underscore/modules/property.js"() {
      init_deepGet();
      init_toPath2();
    }
  });

  // node_modules/underscore/modules/_optimizeCb.js
  function optimizeCb(func, context, argCount) {
    if (context === void 0) return func;
    switch (argCount == null ? 3 : argCount) {
      case 1:
        return function(value) {
          return func.call(context, value);
        };
      // The 2-argument case is omitted because we’re not using it.
      case 3:
        return function(value, index, collection) {
          return func.call(context, value, index, collection);
        };
      case 4:
        return function(accumulator, value, index, collection) {
          return func.call(context, accumulator, value, index, collection);
        };
    }
    return function() {
      return func.apply(context, arguments);
    };
  }
  var init_optimizeCb = __esm({
    "node_modules/underscore/modules/_optimizeCb.js"() {
    }
  });

  // node_modules/underscore/modules/_baseIteratee.js
  function baseIteratee(value, context, argCount) {
    if (value == null) return identity;
    if (isFunction_default(value)) return optimizeCb(value, context, argCount);
    if (isObject2(value) && !isArray_default(value)) return matcher(value);
    return property(value);
  }
  var init_baseIteratee = __esm({
    "node_modules/underscore/modules/_baseIteratee.js"() {
      init_identity();
      init_isFunction();
      init_isObject();
      init_isArray();
      init_matcher();
      init_property();
      init_optimizeCb();
    }
  });

  // node_modules/underscore/modules/iteratee.js
  function iteratee(value, context) {
    return baseIteratee(value, context, Infinity);
  }
  var init_iteratee = __esm({
    "node_modules/underscore/modules/iteratee.js"() {
      init_underscore();
      init_baseIteratee();
      _.iteratee = iteratee;
    }
  });

  // node_modules/underscore/modules/_cb.js
  function cb(value, context, argCount) {
    if (_.iteratee !== iteratee) return _.iteratee(value, context);
    return baseIteratee(value, context, argCount);
  }
  var init_cb = __esm({
    "node_modules/underscore/modules/_cb.js"() {
      init_underscore();
      init_baseIteratee();
      init_iteratee();
    }
  });

  // node_modules/underscore/modules/mapObject.js
  function mapObject(obj2, iteratee2, context) {
    iteratee2 = cb(iteratee2, context);
    var _keys = keys2(obj2), length = _keys.length, results = {};
    for (var index = 0; index < length; index++) {
      var currentKey = _keys[index];
      results[currentKey] = iteratee2(obj2[currentKey], currentKey, obj2);
    }
    return results;
  }
  var init_mapObject = __esm({
    "node_modules/underscore/modules/mapObject.js"() {
      init_cb();
      init_keys();
    }
  });

  // node_modules/underscore/modules/noop.js
  function noop() {
  }
  var init_noop = __esm({
    "node_modules/underscore/modules/noop.js"() {
    }
  });

  // node_modules/underscore/modules/propertyOf.js
  function propertyOf(obj2) {
    if (obj2 == null) return noop;
    return function(path) {
      return get(obj2, path);
    };
  }
  var init_propertyOf = __esm({
    "node_modules/underscore/modules/propertyOf.js"() {
      init_noop();
      init_get();
    }
  });

  // node_modules/underscore/modules/times.js
  function times(n, iteratee2, context) {
    var accum = Array(Math.max(0, n));
    iteratee2 = optimizeCb(iteratee2, context, 1);
    for (var i = 0; i < n; i++) accum[i] = iteratee2(i);
    return accum;
  }
  var init_times = __esm({
    "node_modules/underscore/modules/times.js"() {
      init_optimizeCb();
    }
  });

  // node_modules/underscore/modules/random.js
  function random(min2, max2) {
    if (max2 == null) {
      max2 = min2;
      min2 = 0;
    }
    return min2 + Math.floor(Math.random() * (max2 - min2 + 1));
  }
  var init_random = __esm({
    "node_modules/underscore/modules/random.js"() {
    }
  });

  // node_modules/underscore/modules/now.js
  var now_default;
  var init_now = __esm({
    "node_modules/underscore/modules/now.js"() {
      now_default = Date.now || function() {
        return (/* @__PURE__ */ new Date()).getTime();
      };
    }
  });

  // node_modules/underscore/modules/_createEscaper.js
  function createEscaper(map2) {
    var escaper = function(match) {
      return map2[match];
    };
    var source = "(?:" + keys2(map2).join("|") + ")";
    var testRegexp = RegExp(source);
    var replaceRegexp = RegExp(source, "g");
    return function(string) {
      string = string == null ? "" : "" + string;
      return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
    };
  }
  var init_createEscaper = __esm({
    "node_modules/underscore/modules/_createEscaper.js"() {
      init_keys();
    }
  });

  // node_modules/underscore/modules/_escapeMap.js
  var escapeMap_default;
  var init_escapeMap = __esm({
    "node_modules/underscore/modules/_escapeMap.js"() {
      escapeMap_default = {
        "&": "&amp;",
        "<": "&lt;",
        ">": "&gt;",
        '"': "&quot;",
        "'": "&#x27;",
        "`": "&#x60;"
      };
    }
  });

  // node_modules/underscore/modules/escape.js
  var escape_default;
  var init_escape = __esm({
    "node_modules/underscore/modules/escape.js"() {
      init_createEscaper();
      init_escapeMap();
      escape_default = createEscaper(escapeMap_default);
    }
  });

  // node_modules/underscore/modules/_unescapeMap.js
  var unescapeMap_default;
  var init_unescapeMap = __esm({
    "node_modules/underscore/modules/_unescapeMap.js"() {
      init_invert();
      init_escapeMap();
      unescapeMap_default = invert(escapeMap_default);
    }
  });

  // node_modules/underscore/modules/unescape.js
  var unescape_default;
  var init_unescape = __esm({
    "node_modules/underscore/modules/unescape.js"() {
      init_createEscaper();
      init_unescapeMap();
      unescape_default = createEscaper(unescapeMap_default);
    }
  });

  // node_modules/underscore/modules/templateSettings.js
  var templateSettings_default;
  var init_templateSettings = __esm({
    "node_modules/underscore/modules/templateSettings.js"() {
      init_underscore();
      templateSettings_default = _.templateSettings = {
        evaluate: /<%([\s\S]+?)%>/g,
        interpolate: /<%=([\s\S]+?)%>/g,
        escape: /<%-([\s\S]+?)%>/g
      };
    }
  });

  // node_modules/underscore/modules/template.js
  function escapeChar(match) {
    return "\\" + escapes[match];
  }
  function template(text, settings, oldSettings) {
    if (!settings && oldSettings) settings = oldSettings;
    settings = defaults_default({}, settings, _.templateSettings);
    var matcher2 = RegExp([
      (settings.escape || noMatch).source,
      (settings.interpolate || noMatch).source,
      (settings.evaluate || noMatch).source
    ].join("|") + "|$", "g");
    var index = 0;
    var source = "__p+='";
    text.replace(matcher2, function(match, escape2, interpolate, evaluate, offset) {
      source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
      index = offset + match.length;
      if (escape2) {
        source += "'+\n((__t=(" + escape2 + "))==null?'':_.escape(__t))+\n'";
      } else if (interpolate) {
        source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
      } else if (evaluate) {
        source += "';\n" + evaluate + "\n__p+='";
      }
      return match;
    });
    source += "';\n";
    var argument = settings.variable;
    if (argument) {
      if (!bareIdentifier.test(argument)) throw new Error(
        "variable is not a bare identifier: " + argument
      );
    } else {
      source = "with(obj||{}){\n" + source + "}\n";
      argument = "obj";
    }
    source = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + source + "return __p;\n";
    var render;
    try {
      render = new Function(argument, "_", source);
    } catch (e) {
      e.source = source;
      throw e;
    }
    var template2 = function(data) {
      return render.call(this, data, _);
    };
    template2.source = "function(" + argument + "){\n" + source + "}";
    return template2;
  }
  var noMatch, escapes, escapeRegExp, bareIdentifier;
  var init_template = __esm({
    "node_modules/underscore/modules/template.js"() {
      init_defaults();
      init_underscore();
      init_templateSettings();
      noMatch = /(.)^/;
      escapes = {
        "'": "'",
        "\\": "\\",
        "\r": "r",
        "\n": "n",
        "\u2028": "u2028",
        "\u2029": "u2029"
      };
      escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
      bareIdentifier = /^\s*(\w|\$)+\s*$/;
    }
  });

  // node_modules/underscore/modules/result.js
  function result(obj2, path, fallback) {
    path = toPath2(path);
    var length = path.length;
    if (!length) {
      return isFunction_default(fallback) ? fallback.call(obj2) : fallback;
    }
    for (var i = 0; i < length; i++) {
      var prop = obj2 == null ? void 0 : obj2[path[i]];
      if (prop === void 0) {
        prop = fallback;
        i = length;
      }
      obj2 = isFunction_default(prop) ? prop.call(obj2) : prop;
    }
    return obj2;
  }
  var init_result = __esm({
    "node_modules/underscore/modules/result.js"() {
      init_isFunction();
      init_toPath2();
    }
  });

  // node_modules/underscore/modules/uniqueId.js
  function uniqueId(prefix) {
    var id = ++idCounter + "";
    return prefix ? prefix + id : id;
  }
  var idCounter;
  var init_uniqueId = __esm({
    "node_modules/underscore/modules/uniqueId.js"() {
      idCounter = 0;
    }
  });

  // node_modules/underscore/modules/chain.js
  function chain(obj2) {
    var instance = _(obj2);
    instance._chain = true;
    return instance;
  }
  var init_chain = __esm({
    "node_modules/underscore/modules/chain.js"() {
      init_underscore();
    }
  });

  // node_modules/underscore/modules/_executeBound.js
  function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
    if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
    var self2 = baseCreate(sourceFunc.prototype);
    var result2 = sourceFunc.apply(self2, args);
    if (isObject2(result2)) return result2;
    return self2;
  }
  var init_executeBound = __esm({
    "node_modules/underscore/modules/_executeBound.js"() {
      init_baseCreate();
      init_isObject();
    }
  });

  // node_modules/underscore/modules/partial.js
  var partial, partial_default;
  var init_partial = __esm({
    "node_modules/underscore/modules/partial.js"() {
      init_restArguments();
      init_executeBound();
      init_underscore();
      partial = restArguments(function(func, boundArgs) {
        var placeholder = partial.placeholder;
        var bound = function() {
          var position = 0, length = boundArgs.length;
          var args = Array(length);
          for (var i = 0; i < length; i++) {
            args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
          }
          while (position < arguments.length) args.push(arguments[position++]);
          return executeBound(func, bound, this, this, args);
        };
        return bound;
      });
      partial.placeholder = _;
      partial_default = partial;
    }
  });

  // node_modules/underscore/modules/bind.js
  var bind_default;
  var init_bind = __esm({
    "node_modules/underscore/modules/bind.js"() {
      init_restArguments();
      init_isFunction();
      init_executeBound();
      bind_default = restArguments(function(func, context, args) {
        if (!isFunction_default(func)) throw new TypeError("Bind must be called on a function");
        var bound = restArguments(function(callArgs) {
          return executeBound(func, bound, context, this, args.concat(callArgs));
        });
        return bound;
      });
    }
  });

  // node_modules/underscore/modules/_isArrayLike.js
  var isArrayLike_default;
  var init_isArrayLike = __esm({
    "node_modules/underscore/modules/_isArrayLike.js"() {
      init_createSizePropertyCheck();
      init_getLength();
      isArrayLike_default = createSizePropertyCheck(getLength_default);
    }
  });

  // node_modules/underscore/modules/_flatten.js
  function flatten(input, depth, strict) {
    if (!depth && depth !== 0) depth = Infinity;
    var output = [], idx = 0, i = 0, length = getLength_default(input) || 0, stack = [];
    while (true) {
      if (i >= length) {
        if (!stack.length) break;
        var frame = stack.pop();
        i = frame.i;
        input = frame.v;
        length = getLength_default(input);
        continue;
      }
      var value = input[i++];
      if (stack.length >= depth) {
        output[idx++] = value;
      } else if (isArrayLike_default(value) && (isArray_default(value) || isArguments_default(value))) {
        stack.push({ i, v: input });
        i = 0;
        input = value;
        length = getLength_default(input);
      } else if (!strict) {
        output[idx++] = value;
      }
    }
    return output;
  }
  var init_flatten = __esm({
    "node_modules/underscore/modules/_flatten.js"() {
      init_getLength();
      init_isArrayLike();
      init_isArray();
      init_isArguments();
    }
  });

  // node_modules/underscore/modules/bindAll.js
  var bindAll_default;
  var init_bindAll = __esm({
    "node_modules/underscore/modules/bindAll.js"() {
      init_restArguments();
      init_flatten();
      init_bind();
      bindAll_default = restArguments(function(obj2, keys3) {
        keys3 = flatten(keys3, false, false);
        var index = keys3.length;
        if (index < 1) throw new Error("bindAll must be passed function names");
        while (index--) {
          var key = keys3[index];
          obj2[key] = bind_default(obj2[key], obj2);
        }
        return obj2;
      });
    }
  });

  // node_modules/underscore/modules/memoize.js
  function memoize(func, hasher) {
    var memoize2 = function(key) {
      var cache = memoize2.cache;
      var address = "" + (hasher ? hasher.apply(this, arguments) : key);
      if (!has2(cache, address)) cache[address] = func.apply(this, arguments);
      return cache[address];
    };
    memoize2.cache = {};
    return memoize2;
  }
  var init_memoize = __esm({
    "node_modules/underscore/modules/memoize.js"() {
      init_has();
    }
  });

  // node_modules/underscore/modules/delay.js
  var delay_default;
  var init_delay = __esm({
    "node_modules/underscore/modules/delay.js"() {
      init_restArguments();
      delay_default = restArguments(function(func, wait, args) {
        return setTimeout(function() {
          return func.apply(null, args);
        }, wait);
      });
    }
  });

  // node_modules/underscore/modules/defer.js
  var defer_default;
  var init_defer = __esm({
    "node_modules/underscore/modules/defer.js"() {
      init_partial();
      init_delay();
      init_underscore();
      defer_default = partial_default(delay_default, _, 1);
    }
  });

  // node_modules/underscore/modules/throttle.js
  function throttle(func, wait, options) {
    var timeout, context, args, result2;
    var previous = 0;
    if (!options) options = {};
    var later = function() {
      previous = options.leading === false ? 0 : now_default();
      timeout = null;
      result2 = func.apply(context, args);
      if (!timeout) context = args = null;
    };
    var throttled = function() {
      var _now = now_default();
      if (!previous && options.leading === false) previous = _now;
      var remaining = wait - (_now - previous);
      context = this;
      args = arguments;
      if (remaining <= 0 || remaining > wait) {
        if (timeout) {
          clearTimeout(timeout);
          timeout = null;
        }
        previous = _now;
        result2 = func.apply(context, args);
        if (!timeout) context = args = null;
      } else if (!timeout && options.trailing !== false) {
        timeout = setTimeout(later, remaining);
      }
      return result2;
    };
    throttled.cancel = function() {
      clearTimeout(timeout);
      previous = 0;
      timeout = context = args = null;
    };
    return throttled;
  }
  var init_throttle = __esm({
    "node_modules/underscore/modules/throttle.js"() {
      init_now();
    }
  });

  // node_modules/underscore/modules/debounce.js
  function debounce(func, wait, immediate) {
    var timeout, previous, args, result2, context;
    var later = function() {
      var passed = now_default() - previous;
      if (wait > passed) {
        timeout = setTimeout(later, wait - passed);
      } else {
        timeout = null;
        if (!immediate) result2 = func.apply(context, args);
        if (!timeout) args = context = null;
      }
    };
    var debounced = restArguments(function(_args) {
      context = this;
      args = _args;
      previous = now_default();
      if (!timeout) {
        timeout = setTimeout(later, wait);
        if (immediate) result2 = func.apply(context, args);
      }
      return result2;
    });
    debounced.cancel = function() {
      clearTimeout(timeout);
      timeout = args = context = null;
    };
    return debounced;
  }
  var init_debounce = __esm({
    "node_modules/underscore/modules/debounce.js"() {
      init_restArguments();
      init_now();
    }
  });

  // node_modules/underscore/modules/wrap.js
  function wrap(func, wrapper) {
    return partial_default(wrapper, func);
  }
  var init_wrap = __esm({
    "node_modules/underscore/modules/wrap.js"() {
      init_partial();
    }
  });

  // node_modules/underscore/modules/negate.js
  function negate(predicate) {
    return function() {
      return !predicate.apply(this, arguments);
    };
  }
  var init_negate = __esm({
    "node_modules/underscore/modules/negate.js"() {
    }
  });

  // node_modules/underscore/modules/compose.js
  function compose() {
    var args = arguments;
    var start = args.length - 1;
    return function() {
      var i = start;
      var result2 = args[start].apply(this, arguments);
      while (i--) result2 = args[i].call(this, result2);
      return result2;
    };
  }
  var init_compose = __esm({
    "node_modules/underscore/modules/compose.js"() {
    }
  });

  // node_modules/underscore/modules/after.js
  function after(times2, func) {
    return function() {
      if (--times2 < 1) {
        return func.apply(this, arguments);
      }
    };
  }
  var init_after = __esm({
    "node_modules/underscore/modules/after.js"() {
    }
  });

  // node_modules/underscore/modules/before.js
  function before(times2, func) {
    var memo;
    return function() {
      if (--times2 > 0) {
        memo = func.apply(this, arguments);
      }
      if (times2 <= 1) func = null;
      return memo;
    };
  }
  var init_before = __esm({
    "node_modules/underscore/modules/before.js"() {
    }
  });

  // node_modules/underscore/modules/once.js
  var once_default;
  var init_once = __esm({
    "node_modules/underscore/modules/once.js"() {
      init_partial();
      init_before();
      once_default = partial_default(before, 2);
    }
  });

  // node_modules/underscore/modules/findKey.js
  function findKey(obj2, predicate, context) {
    predicate = cb(predicate, context);
    var _keys = keys2(obj2), key;
    for (var i = 0, length = _keys.length; i < length; i++) {
      key = _keys[i];
      if (predicate(obj2[key], key, obj2)) return key;
    }
  }
  var init_findKey = __esm({
    "node_modules/underscore/modules/findKey.js"() {
      init_cb();
      init_keys();
    }
  });

  // node_modules/underscore/modules/_createPredicateIndexFinder.js
  function createPredicateIndexFinder(dir) {
    return function(array, predicate, context) {
      predicate = cb(predicate, context);
      var length = getLength_default(array);
      var index = dir > 0 ? 0 : length - 1;
      for (; index >= 0 && index < length; index += dir) {
        if (predicate(array[index], index, array)) return index;
      }
      return -1;
    };
  }
  var init_createPredicateIndexFinder = __esm({
    "node_modules/underscore/modules/_createPredicateIndexFinder.js"() {
      init_cb();
      init_getLength();
    }
  });

  // node_modules/underscore/modules/findIndex.js
  var findIndex_default;
  var init_findIndex = __esm({
    "node_modules/underscore/modules/findIndex.js"() {
      init_createPredicateIndexFinder();
      findIndex_default = createPredicateIndexFinder(1);
    }
  });

  // node_modules/underscore/modules/findLastIndex.js
  var findLastIndex_default;
  var init_findLastIndex = __esm({
    "node_modules/underscore/modules/findLastIndex.js"() {
      init_createPredicateIndexFinder();
      findLastIndex_default = createPredicateIndexFinder(-1);
    }
  });

  // node_modules/underscore/modules/sortedIndex.js
  function sortedIndex(array, obj2, iteratee2, context) {
    iteratee2 = cb(iteratee2, context, 1);
    var value = iteratee2(obj2);
    var low = 0, high = getLength_default(array);
    while (low < high) {
      var mid = Math.floor((low + high) / 2);
      if (iteratee2(array[mid]) < value) low = mid + 1;
      else high = mid;
    }
    return low;
  }
  var init_sortedIndex = __esm({
    "node_modules/underscore/modules/sortedIndex.js"() {
      init_cb();
      init_getLength();
    }
  });

  // node_modules/underscore/modules/_createIndexFinder.js
  function createIndexFinder(dir, predicateFind, sortedIndex2) {
    return function(array, item, idx) {
      var i = 0, length = getLength_default(array);
      if (typeof idx == "number") {
        if (dir > 0) {
          i = idx >= 0 ? idx : Math.max(idx + length, i);
        } else {
          length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
        }
      } else if (sortedIndex2 && idx && length) {
        idx = sortedIndex2(array, item);
        return array[idx] === item ? idx : -1;
      }
      if (item !== item) {
        idx = predicateFind(slice.call(array, i, length), isNaN2);
        return idx >= 0 ? idx + i : -1;
      }
      for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
        if (array[idx] === item) return idx;
      }
      return -1;
    };
  }
  var init_createIndexFinder = __esm({
    "node_modules/underscore/modules/_createIndexFinder.js"() {
      init_getLength();
      init_setup();
      init_isNaN();
    }
  });

  // node_modules/underscore/modules/indexOf.js
  var indexOf_default;
  var init_indexOf = __esm({
    "node_modules/underscore/modules/indexOf.js"() {
      init_sortedIndex();
      init_findIndex();
      init_createIndexFinder();
      indexOf_default = createIndexFinder(1, findIndex_default, sortedIndex);
    }
  });

  // node_modules/underscore/modules/lastIndexOf.js
  var lastIndexOf_default;
  var init_lastIndexOf = __esm({
    "node_modules/underscore/modules/lastIndexOf.js"() {
      init_findLastIndex();
      init_createIndexFinder();
      lastIndexOf_default = createIndexFinder(-1, findLastIndex_default);
    }
  });

  // node_modules/underscore/modules/find.js
  function find(obj2, predicate, context) {
    var keyFinder = isArrayLike_default(obj2) ? findIndex_default : findKey;
    var key = keyFinder(obj2, predicate, context);
    if (key !== void 0 && key !== -1) return obj2[key];
  }
  var init_find = __esm({
    "node_modules/underscore/modules/find.js"() {
      init_isArrayLike();
      init_findIndex();
      init_findKey();
    }
  });

  // node_modules/underscore/modules/findWhere.js
  function findWhere(obj2, attrs) {
    return find(obj2, matcher(attrs));
  }
  var init_findWhere = __esm({
    "node_modules/underscore/modules/findWhere.js"() {
      init_find();
      init_matcher();
    }
  });

  // node_modules/underscore/modules/each.js
  function each(obj2, iteratee2, context) {
    iteratee2 = optimizeCb(iteratee2, context);
    var i, length;
    if (isArrayLike_default(obj2)) {
      for (i = 0, length = obj2.length; i < length; i++) {
        iteratee2(obj2[i], i, obj2);
      }
    } else {
      var _keys = keys2(obj2);
      for (i = 0, length = _keys.length; i < length; i++) {
        iteratee2(obj2[_keys[i]], _keys[i], obj2);
      }
    }
    return obj2;
  }
  var init_each = __esm({
    "node_modules/underscore/modules/each.js"() {
      init_optimizeCb();
      init_isArrayLike();
      init_keys();
    }
  });

  // node_modules/underscore/modules/map.js
  function map(obj2, iteratee2, context) {
    iteratee2 = cb(iteratee2, context);
    var _keys = !isArrayLike_default(obj2) && keys2(obj2), length = (_keys || obj2).length, results = Array(length);
    for (var index = 0; index < length; index++) {
      var currentKey = _keys ? _keys[index] : index;
      results[index] = iteratee2(obj2[currentKey], currentKey, obj2);
    }
    return results;
  }
  var init_map = __esm({
    "node_modules/underscore/modules/map.js"() {
      init_cb();
      init_isArrayLike();
      init_keys();
    }
  });

  // node_modules/underscore/modules/_createReduce.js
  function createReduce(dir) {
    var reducer = function(obj2, iteratee2, memo, initial2) {
      var _keys = !isArrayLike_default(obj2) && keys2(obj2), length = (_keys || obj2).length, index = dir > 0 ? 0 : length - 1;
      if (!initial2) {
        memo = obj2[_keys ? _keys[index] : index];
        index += dir;
      }
      for (; index >= 0 && index < length; index += dir) {
        var currentKey = _keys ? _keys[index] : index;
        memo = iteratee2(memo, obj2[currentKey], currentKey, obj2);
      }
      return memo;
    };
    return function(obj2, iteratee2, memo, context) {
      var initial2 = arguments.length >= 3;
      return reducer(obj2, optimizeCb(iteratee2, context, 4), memo, initial2);
    };
  }
  var init_createReduce = __esm({
    "node_modules/underscore/modules/_createReduce.js"() {
      init_isArrayLike();
      init_keys();
      init_optimizeCb();
    }
  });

  // node_modules/underscore/modules/reduce.js
  var reduce_default;
  var init_reduce = __esm({
    "node_modules/underscore/modules/reduce.js"() {
      init_createReduce();
      reduce_default = createReduce(1);
    }
  });

  // node_modules/underscore/modules/reduceRight.js
  var reduceRight_default;
  var init_reduceRight = __esm({
    "node_modules/underscore/modules/reduceRight.js"() {
      init_createReduce();
      reduceRight_default = createReduce(-1);
    }
  });

  // node_modules/underscore/modules/filter.js
  function filter(obj2, predicate, context) {
    var results = [];
    predicate = cb(predicate, context);
    each(obj2, function(value, index, list) {
      if (predicate(value, index, list)) results.push(value);
    });
    return results;
  }
  var init_filter = __esm({
    "node_modules/underscore/modules/filter.js"() {
      init_cb();
      init_each();
    }
  });

  // node_modules/underscore/modules/reject.js
  function reject(obj2, predicate, context) {
    return filter(obj2, negate(cb(predicate)), context);
  }
  var init_reject = __esm({
    "node_modules/underscore/modules/reject.js"() {
      init_filter();
      init_negate();
      init_cb();
    }
  });

  // node_modules/underscore/modules/every.js
  function every(obj2, predicate, context) {
    predicate = cb(predicate, context);
    var _keys = !isArrayLike_default(obj2) && keys2(obj2), length = (_keys || obj2).length;
    for (var index = 0; index < length; index++) {
      var currentKey = _keys ? _keys[index] : index;
      if (!predicate(obj2[currentKey], currentKey, obj2)) return false;
    }
    return true;
  }
  var init_every = __esm({
    "node_modules/underscore/modules/every.js"() {
      init_cb();
      init_isArrayLike();
      init_keys();
    }
  });

  // node_modules/underscore/modules/some.js
  function some(obj2, predicate, context) {
    predicate = cb(predicate, context);
    var _keys = !isArrayLike_default(obj2) && keys2(obj2), length = (_keys || obj2).length;
    for (var index = 0; index < length; index++) {
      var currentKey = _keys ? _keys[index] : index;
      if (predicate(obj2[currentKey], currentKey, obj2)) return true;
    }
    return false;
  }
  var init_some = __esm({
    "node_modules/underscore/modules/some.js"() {
      init_cb();
      init_isArrayLike();
      init_keys();
    }
  });

  // node_modules/underscore/modules/contains.js
  function contains(obj2, item, fromIndex, guard) {
    if (!isArrayLike_default(obj2)) obj2 = values(obj2);
    if (typeof fromIndex != "number" || guard) fromIndex = 0;
    return indexOf_default(obj2, item, fromIndex) >= 0;
  }
  var init_contains = __esm({
    "node_modules/underscore/modules/contains.js"() {
      init_isArrayLike();
      init_values();
      init_indexOf();
    }
  });

  // node_modules/underscore/modules/invoke.js
  var invoke_default;
  var init_invoke = __esm({
    "node_modules/underscore/modules/invoke.js"() {
      init_restArguments();
      init_isFunction();
      init_map();
      init_deepGet();
      init_toPath2();
      invoke_default = restArguments(function(obj2, path, args) {
        var contextPath, func;
        if (isFunction_default(path)) {
          func = path;
        } else {
          path = toPath2(path);
          contextPath = path.slice(0, -1);
          path = path[path.length - 1];
        }
        return map(obj2, function(context) {
          var method = func;
          if (!method) {
            if (contextPath && contextPath.length) {
              context = deepGet(context, contextPath);
            }
            if (context == null) return void 0;
            method = context[path];
          }
          return method == null ? method : method.apply(context, args);
        });
      });
    }
  });

  // node_modules/underscore/modules/pluck.js
  function pluck(obj2, key) {
    return map(obj2, property(key));
  }
  var init_pluck = __esm({
    "node_modules/underscore/modules/pluck.js"() {
      init_map();
      init_property();
    }
  });

  // node_modules/underscore/modules/where.js
  function where(obj2, attrs) {
    return filter(obj2, matcher(attrs));
  }
  var init_where = __esm({
    "node_modules/underscore/modules/where.js"() {
      init_filter();
      init_matcher();
    }
  });

  // node_modules/underscore/modules/max.js
  function max(obj2, iteratee2, context) {
    var result2 = -Infinity, lastComputed = -Infinity, value, computed;
    if (iteratee2 == null || typeof iteratee2 == "number" && typeof obj2[0] != "object" && obj2 != null) {
      obj2 = isArrayLike_default(obj2) ? obj2 : values(obj2);
      for (var i = 0, length = obj2.length; i < length; i++) {
        value = obj2[i];
        if (value != null && value > result2) {
          result2 = value;
        }
      }
    } else {
      iteratee2 = cb(iteratee2, context);
      each(obj2, function(v, index, list) {
        computed = iteratee2(v, index, list);
        if (computed > lastComputed || computed === -Infinity && result2 === -Infinity) {
          result2 = v;
          lastComputed = computed;
        }
      });
    }
    return result2;
  }
  var init_max = __esm({
    "node_modules/underscore/modules/max.js"() {
      init_isArrayLike();
      init_values();
      init_cb();
      init_each();
    }
  });

  // node_modules/underscore/modules/min.js
  function min(obj2, iteratee2, context) {
    var result2 = Infinity, lastComputed = Infinity, value, computed;
    if (iteratee2 == null || typeof iteratee2 == "number" && typeof obj2[0] != "object" && obj2 != null) {
      obj2 = isArrayLike_default(obj2) ? obj2 : values(obj2);
      for (var i = 0, length = obj2.length; i < length; i++) {
        value = obj2[i];
        if (value != null && value < result2) {
          result2 = value;
        }
      }
    } else {
      iteratee2 = cb(iteratee2, context);
      each(obj2, function(v, index, list) {
        computed = iteratee2(v, index, list);
        if (computed < lastComputed || computed === Infinity && result2 === Infinity) {
          result2 = v;
          lastComputed = computed;
        }
      });
    }
    return result2;
  }
  var init_min = __esm({
    "node_modules/underscore/modules/min.js"() {
      init_isArrayLike();
      init_values();
      init_cb();
      init_each();
    }
  });

  // node_modules/underscore/modules/toArray.js
  function toArray(obj2) {
    if (!obj2) return [];
    if (isArray_default(obj2)) return slice.call(obj2);
    if (isString_default(obj2)) {
      return obj2.match(reStrSymbol);
    }
    if (isArrayLike_default(obj2)) return map(obj2, identity);
    return values(obj2);
  }
  var reStrSymbol;
  var init_toArray = __esm({
    "node_modules/underscore/modules/toArray.js"() {
      init_isArray();
      init_setup();
      init_isString();
      init_isArrayLike();
      init_map();
      init_identity();
      init_values();
      reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
    }
  });

  // node_modules/underscore/modules/sample.js
  function sample(obj2, n, guard) {
    if (n == null || guard) {
      if (!isArrayLike_default(obj2)) obj2 = values(obj2);
      return obj2[random(obj2.length - 1)];
    }
    var sample2 = toArray(obj2);
    var length = getLength_default(sample2);
    n = Math.max(Math.min(n, length), 0);
    var last2 = length - 1;
    for (var index = 0; index < n; index++) {
      var rand = random(index, last2);
      var temp = sample2[index];
      sample2[index] = sample2[rand];
      sample2[rand] = temp;
    }
    return sample2.slice(0, n);
  }
  var init_sample = __esm({
    "node_modules/underscore/modules/sample.js"() {
      init_isArrayLike();
      init_values();
      init_getLength();
      init_random();
      init_toArray();
    }
  });

  // node_modules/underscore/modules/shuffle.js
  function shuffle(obj2) {
    return sample(obj2, Infinity);
  }
  var init_shuffle = __esm({
    "node_modules/underscore/modules/shuffle.js"() {
      init_sample();
    }
  });

  // node_modules/underscore/modules/sortBy.js
  function sortBy(obj2, iteratee2, context) {
    var index = 0;
    iteratee2 = cb(iteratee2, context);
    return pluck(map(obj2, function(value, key, list) {
      return {
        value,
        index: index++,
        criteria: iteratee2(value, key, list)
      };
    }).sort(function(left, right) {
      var a = left.criteria;
      var b = right.criteria;
      if (a !== b) {
        if (a > b || a === void 0) return 1;
        if (a < b || b === void 0) return -1;
      }
      return left.index - right.index;
    }), "value");
  }
  var init_sortBy = __esm({
    "node_modules/underscore/modules/sortBy.js"() {
      init_cb();
      init_pluck();
      init_map();
    }
  });

  // node_modules/underscore/modules/_group.js
  function group(behavior, partition) {
    return function(obj2, iteratee2, context) {
      var result2 = partition ? [[], []] : {};
      iteratee2 = cb(iteratee2, context);
      each(obj2, function(value, index) {
        var key = iteratee2(value, index, obj2);
        behavior(result2, value, key);
      });
      return result2;
    };
  }
  var init_group = __esm({
    "node_modules/underscore/modules/_group.js"() {
      init_cb();
      init_each();
    }
  });

  // node_modules/underscore/modules/groupBy.js
  var groupBy_default;
  var init_groupBy = __esm({
    "node_modules/underscore/modules/groupBy.js"() {
      init_group();
      init_has();
      groupBy_default = group(function(result2, value, key) {
        if (has2(result2, key)) result2[key].push(value);
        else result2[key] = [value];
      });
    }
  });

  // node_modules/underscore/modules/indexBy.js
  var indexBy_default;
  var init_indexBy = __esm({
    "node_modules/underscore/modules/indexBy.js"() {
      init_group();
      indexBy_default = group(function(result2, value, key) {
        result2[key] = value;
      });
    }
  });

  // node_modules/underscore/modules/countBy.js
  var countBy_default;
  var init_countBy = __esm({
    "node_modules/underscore/modules/countBy.js"() {
      init_group();
      init_has();
      countBy_default = group(function(result2, value, key) {
        if (has2(result2, key)) result2[key]++;
        else result2[key] = 1;
      });
    }
  });

  // node_modules/underscore/modules/partition.js
  var partition_default;
  var init_partition = __esm({
    "node_modules/underscore/modules/partition.js"() {
      init_group();
      partition_default = group(function(result2, value, pass) {
        result2[pass ? 0 : 1].push(value);
      }, true);
    }
  });

  // node_modules/underscore/modules/size.js
  function size(obj2) {
    if (obj2 == null) return 0;
    return isArrayLike_default(obj2) ? obj2.length : keys2(obj2).length;
  }
  var init_size = __esm({
    "node_modules/underscore/modules/size.js"() {
      init_isArrayLike();
      init_keys();
    }
  });

  // node_modules/underscore/modules/_keyInObj.js
  function keyInObj(value, key, obj2) {
    return key in obj2;
  }
  var init_keyInObj = __esm({
    "node_modules/underscore/modules/_keyInObj.js"() {
    }
  });

  // node_modules/underscore/modules/pick.js
  var pick_default;
  var init_pick = __esm({
    "node_modules/underscore/modules/pick.js"() {
      init_restArguments();
      init_isFunction();
      init_optimizeCb();
      init_allKeys();
      init_keyInObj();
      init_flatten();
      pick_default = restArguments(function(obj2, keys3) {
        var result2 = {}, iteratee2 = keys3[0];
        if (obj2 == null) return result2;
        if (isFunction_default(iteratee2)) {
          if (keys3.length > 1) iteratee2 = optimizeCb(iteratee2, keys3[1]);
          keys3 = allKeys(obj2);
        } else {
          iteratee2 = keyInObj;
          keys3 = flatten(keys3, false, false);
          obj2 = Object(obj2);
        }
        for (var i = 0, length = keys3.length; i < length; i++) {
          var key = keys3[i];
          var value = obj2[key];
          if (iteratee2(value, key, obj2)) result2[key] = value;
        }
        return result2;
      });
    }
  });

  // node_modules/underscore/modules/omit.js
  var omit_default;
  var init_omit = __esm({
    "node_modules/underscore/modules/omit.js"() {
      init_restArguments();
      init_isFunction();
      init_negate();
      init_map();
      init_flatten();
      init_contains();
      init_pick();
      omit_default = restArguments(function(obj2, keys3) {
        var iteratee2 = keys3[0], context;
        if (isFunction_default(iteratee2)) {
          iteratee2 = negate(iteratee2);
          if (keys3.length > 1) context = keys3[1];
        } else {
          keys3 = map(flatten(keys3, false, false), String);
          iteratee2 = function(value, key) {
            return !contains(keys3, key);
          };
        }
        return pick_default(obj2, iteratee2, context);
      });
    }
  });

  // node_modules/underscore/modules/initial.js
  function initial(array, n, guard) {
    return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
  }
  var init_initial = __esm({
    "node_modules/underscore/modules/initial.js"() {
      init_setup();
    }
  });

  // node_modules/underscore/modules/first.js
  function first(array, n, guard) {
    if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
    if (n == null || guard) return array[0];
    return initial(array, array.length - n);
  }
  var init_first = __esm({
    "node_modules/underscore/modules/first.js"() {
      init_initial();
    }
  });

  // node_modules/underscore/modules/rest.js
  function rest(array, n, guard) {
    return slice.call(array, n == null || guard ? 1 : n);
  }
  var init_rest = __esm({
    "node_modules/underscore/modules/rest.js"() {
      init_setup();
    }
  });

  // node_modules/underscore/modules/last.js
  function last(array, n, guard) {
    if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
    if (n == null || guard) return array[array.length - 1];
    return rest(array, Math.max(0, array.length - n));
  }
  var init_last = __esm({
    "node_modules/underscore/modules/last.js"() {
      init_rest();
    }
  });

  // node_modules/underscore/modules/compact.js
  function compact(array) {
    return filter(array, Boolean);
  }
  var init_compact = __esm({
    "node_modules/underscore/modules/compact.js"() {
      init_filter();
    }
  });

  // node_modules/underscore/modules/flatten.js
  function flatten2(array, depth) {
    return flatten(array, depth, false);
  }
  var init_flatten2 = __esm({
    "node_modules/underscore/modules/flatten.js"() {
      init_flatten();
    }
  });

  // node_modules/underscore/modules/difference.js
  var difference_default;
  var init_difference = __esm({
    "node_modules/underscore/modules/difference.js"() {
      init_restArguments();
      init_flatten();
      init_filter();
      init_contains();
      difference_default = restArguments(function(array, rest2) {
        rest2 = flatten(rest2, true, true);
        return filter(array, function(value) {
          return !contains(rest2, value);
        });
      });
    }
  });

  // node_modules/underscore/modules/without.js
  var without_default;
  var init_without = __esm({
    "node_modules/underscore/modules/without.js"() {
      init_restArguments();
      init_difference();
      without_default = restArguments(function(array, otherArrays) {
        return difference_default(array, otherArrays);
      });
    }
  });

  // node_modules/underscore/modules/uniq.js
  function uniq(array, isSorted, iteratee2, context) {
    if (!isBoolean(isSorted)) {
      context = iteratee2;
      iteratee2 = isSorted;
      isSorted = false;
    }
    if (iteratee2 != null) iteratee2 = cb(iteratee2, context);
    var result2 = [];
    var seen = [];
    for (var i = 0, length = getLength_default(array); i < length; i++) {
      var value = array[i], computed = iteratee2 ? iteratee2(value, i, array) : value;
      if (isSorted && !iteratee2) {
        if (!i || seen !== computed) result2.push(value);
        seen = computed;
      } else if (iteratee2) {
        if (!contains(seen, computed)) {
          seen.push(computed);
          result2.push(value);
        }
      } else if (!contains(result2, value)) {
        result2.push(value);
      }
    }
    return result2;
  }
  var init_uniq = __esm({
    "node_modules/underscore/modules/uniq.js"() {
      init_isBoolean();
      init_cb();
      init_getLength();
      init_contains();
    }
  });

  // node_modules/underscore/modules/union.js
  var union_default;
  var init_union = __esm({
    "node_modules/underscore/modules/union.js"() {
      init_restArguments();
      init_uniq();
      init_flatten();
      union_default = restArguments(function(arrays) {
        return uniq(flatten(arrays, true, true));
      });
    }
  });

  // node_modules/underscore/modules/intersection.js
  function intersection(array) {
    var result2 = [];
    var argsLength = arguments.length;
    for (var i = 0, length = getLength_default(array); i < length; i++) {
      var item = array[i];
      if (contains(result2, item)) continue;
      var j;
      for (j = 1; j < argsLength; j++) {
        if (!contains(arguments[j], item)) break;
      }
      if (j === argsLength) result2.push(item);
    }
    return result2;
  }
  var init_intersection = __esm({
    "node_modules/underscore/modules/intersection.js"() {
      init_getLength();
      init_contains();
    }
  });

  // node_modules/underscore/modules/unzip.js
  function unzip(array) {
    var length = array && max(array, getLength_default).length || 0;
    var result2 = Array(length);
    for (var index = 0; index < length; index++) {
      result2[index] = pluck(array, index);
    }
    return result2;
  }
  var init_unzip = __esm({
    "node_modules/underscore/modules/unzip.js"() {
      init_max();
      init_getLength();
      init_pluck();
    }
  });

  // node_modules/underscore/modules/zip.js
  var zip_default;
  var init_zip = __esm({
    "node_modules/underscore/modules/zip.js"() {
      init_restArguments();
      init_unzip();
      zip_default = restArguments(unzip);
    }
  });

  // node_modules/underscore/modules/object.js
  function object(list, values2) {
    var result2 = {};
    for (var i = 0, length = getLength_default(list); i < length; i++) {
      if (values2) {
        result2[list[i]] = values2[i];
      } else {
        result2[list[i][0]] = list[i][1];
      }
    }
    return result2;
  }
  var init_object = __esm({
    "node_modules/underscore/modules/object.js"() {
      init_getLength();
    }
  });

  // node_modules/underscore/modules/range.js
  function range(start, stop, step) {
    if (stop == null) {
      stop = start || 0;
      start = 0;
    }
    if (!step) {
      step = stop < start ? -1 : 1;
    }
    var length = Math.max(Math.ceil((stop - start) / step), 0);
    var range2 = Array(length);
    for (var idx = 0; idx < length; idx++, start += step) {
      range2[idx] = start;
    }
    return range2;
  }
  var init_range = __esm({
    "node_modules/underscore/modules/range.js"() {
    }
  });

  // node_modules/underscore/modules/chunk.js
  function chunk(array, count) {
    if (count == null || count < 1) return [];
    var result2 = [];
    var i = 0, length = array.length;
    while (i < length) {
      result2.push(slice.call(array, i, i += count));
    }
    return result2;
  }
  var init_chunk = __esm({
    "node_modules/underscore/modules/chunk.js"() {
      init_setup();
    }
  });

  // node_modules/underscore/modules/_chainResult.js
  function chainResult(instance, obj2) {
    return instance._chain ? _(obj2).chain() : obj2;
  }
  var init_chainResult = __esm({
    "node_modules/underscore/modules/_chainResult.js"() {
      init_underscore();
    }
  });

  // node_modules/underscore/modules/mixin.js
  function mixin(obj2) {
    each(functions(obj2), function(name) {
      var func = _[name] = obj2[name];
      _.prototype[name] = function() {
        var args = [this._wrapped];
        push.apply(args, arguments);
        return chainResult(this, func.apply(_, args));
      };
    });
    return _;
  }
  var init_mixin = __esm({
    "node_modules/underscore/modules/mixin.js"() {
      init_underscore();
      init_each();
      init_functions();
      init_setup();
      init_chainResult();
    }
  });

  // node_modules/underscore/modules/underscore-array-methods.js
  var underscore_array_methods_default;
  var init_underscore_array_methods = __esm({
    "node_modules/underscore/modules/underscore-array-methods.js"() {
      init_underscore();
      init_each();
      init_setup();
      init_chainResult();
      each(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function(name) {
        var method = ArrayProto[name];
        _.prototype[name] = function() {
          var obj2 = this._wrapped;
          if (obj2 != null) {
            method.apply(obj2, arguments);
            if ((name === "shift" || name === "splice") && obj2.length === 0) {
              delete obj2[0];
            }
          }
          return chainResult(this, obj2);
        };
      });
      each(["concat", "join", "slice"], function(name) {
        var method = ArrayProto[name];
        _.prototype[name] = function() {
          var obj2 = this._wrapped;
          if (obj2 != null) obj2 = method.apply(obj2, arguments);
          return chainResult(this, obj2);
        };
      });
      underscore_array_methods_default = _;
    }
  });

  // node_modules/underscore/modules/index.js
  var modules_exports = {};
  __export(modules_exports, {
    VERSION: () => VERSION,
    after: () => after,
    all: () => every,
    allKeys: () => allKeys,
    any: () => some,
    assign: () => extendOwn_default,
    before: () => before,
    bind: () => bind_default,
    bindAll: () => bindAll_default,
    chain: () => chain,
    chunk: () => chunk,
    clone: () => clone,
    collect: () => map,
    compact: () => compact,
    compose: () => compose,
    constant: () => constant,
    contains: () => contains,
    countBy: () => countBy_default,
    create: () => create,
    debounce: () => debounce,
    default: () => underscore_array_methods_default,
    defaults: () => defaults_default,
    defer: () => defer_default,
    delay: () => delay_default,
    detect: () => find,
    difference: () => difference_default,
    drop: () => rest,
    each: () => each,
    escape: () => escape_default,
    every: () => every,
    extend: () => extend_default,
    extendOwn: () => extendOwn_default,
    filter: () => filter,
    find: () => find,
    findIndex: () => findIndex_default,
    findKey: () => findKey,
    findLastIndex: () => findLastIndex_default,
    findWhere: () => findWhere,
    first: () => first,
    flatten: () => flatten2,
    foldl: () => reduce_default,
    foldr: () => reduceRight_default,
    forEach: () => each,
    functions: () => functions,
    get: () => get,
    groupBy: () => groupBy_default,
    has: () => has3,
    head: () => first,
    identity: () => identity,
    include: () => contains,
    includes: () => contains,
    indexBy: () => indexBy_default,
    indexOf: () => indexOf_default,
    initial: () => initial,
    inject: () => reduce_default,
    intersection: () => intersection,
    invert: () => invert,
    invoke: () => invoke_default,
    isArguments: () => isArguments_default,
    isArray: () => isArray_default,
    isArrayBuffer: () => isArrayBuffer_default,
    isBoolean: () => isBoolean,
    isDataView: () => isDataView_default,
    isDate: () => isDate_default,
    isElement: () => isElement,
    isEmpty: () => isEmpty,
    isEqual: () => isEqual,
    isError: () => isError_default,
    isFinite: () => isFinite2,
    isFunction: () => isFunction_default,
    isMap: () => isMap_default,
    isMatch: () => isMatch,
    isNaN: () => isNaN2,
    isNull: () => isNull,
    isNumber: () => isNumber_default,
    isObject: () => isObject2,
    isRegExp: () => isRegExp_default,
    isSet: () => isSet_default,
    isString: () => isString_default,
    isSymbol: () => isSymbol_default,
    isTypedArray: () => isTypedArray_default,
    isUndefined: () => isUndefined,
    isWeakMap: () => isWeakMap_default,
    isWeakSet: () => isWeakSet_default,
    iteratee: () => iteratee,
    keys: () => keys2,
    last: () => last,
    lastIndexOf: () => lastIndexOf_default,
    map: () => map,
    mapObject: () => mapObject,
    matcher: () => matcher,
    matches: () => matcher,
    max: () => max,
    memoize: () => memoize,
    methods: () => functions,
    min: () => min,
    mixin: () => mixin,
    negate: () => negate,
    noop: () => noop,
    now: () => now_default,
    object: () => object,
    omit: () => omit_default,
    once: () => once_default,
    pairs: () => pairs,
    partial: () => partial_default,
    partition: () => partition_default,
    pick: () => pick_default,
    pluck: () => pluck,
    property: () => property,
    propertyOf: () => propertyOf,
    random: () => random,
    range: () => range,
    reduce: () => reduce_default,
    reduceRight: () => reduceRight_default,
    reject: () => reject,
    rest: () => rest,
    restArguments: () => restArguments,
    result: () => result,
    sample: () => sample,
    select: () => filter,
    shuffle: () => shuffle,
    size: () => size,
    some: () => some,
    sortBy: () => sortBy,
    sortedIndex: () => sortedIndex,
    tail: () => rest,
    take: () => first,
    tap: () => tap,
    template: () => template,
    templateSettings: () => templateSettings_default,
    throttle: () => throttle,
    times: () => times,
    toArray: () => toArray,
    toPath: () => toPath,
    transpose: () => unzip,
    unescape: () => unescape_default,
    union: () => union_default,
    uniq: () => uniq,
    unique: () => uniq,
    uniqueId: () => uniqueId,
    unzip: () => unzip,
    values: () => values,
    where: () => where,
    without: () => without_default,
    wrap: () => wrap,
    zip: () => zip_default
  });
  var init_modules = __esm({
    "node_modules/underscore/modules/index.js"() {
      init_setup();
      init_restArguments();
      init_isObject();
      init_isNull();
      init_isUndefined();
      init_isBoolean();
      init_isElement();
      init_isString();
      init_isNumber();
      init_isDate();
      init_isRegExp();
      init_isError();
      init_isSymbol();
      init_isArrayBuffer();
      init_isDataView();
      init_isArray();
      init_isFunction();
      init_isArguments();
      init_isFinite();
      init_isNaN();
      init_isTypedArray();
      init_isEmpty();
      init_isMatch();
      init_isEqual();
      init_isMap();
      init_isWeakMap();
      init_isSet();
      init_isWeakSet();
      init_keys();
      init_allKeys();
      init_values();
      init_pairs();
      init_invert();
      init_functions();
      init_extend();
      init_extendOwn();
      init_defaults();
      init_create();
      init_clone();
      init_tap();
      init_get();
      init_has2();
      init_mapObject();
      init_identity();
      init_constant();
      init_noop();
      init_toPath();
      init_property();
      init_propertyOf();
      init_matcher();
      init_times();
      init_random();
      init_now();
      init_escape();
      init_unescape();
      init_templateSettings();
      init_template();
      init_result();
      init_uniqueId();
      init_chain();
      init_iteratee();
      init_partial();
      init_bind();
      init_bindAll();
      init_memoize();
      init_delay();
      init_defer();
      init_throttle();
      init_debounce();
      init_wrap();
      init_negate();
      init_compose();
      init_after();
      init_before();
      init_once();
      init_findKey();
      init_findIndex();
      init_findLastIndex();
      init_sortedIndex();
      init_indexOf();
      init_lastIndexOf();
      init_find();
      init_findWhere();
      init_each();
      init_map();
      init_reduce();
      init_reduceRight();
      init_filter();
      init_reject();
      init_every();
      init_some();
      init_contains();
      init_invoke();
      init_pluck();
      init_where();
      init_max();
      init_min();
      init_shuffle();
      init_sample();
      init_sortBy();
      init_groupBy();
      init_indexBy();
      init_countBy();
      init_partition();
      init_toArray();
      init_size();
      init_pick();
      init_omit();
      init_first();
      init_initial();
      init_last();
      init_rest();
      init_compact();
      init_flatten2();
      init_without();
      init_uniq();
      init_union();
      init_intersection();
      init_difference();
      init_unzip();
      init_zip();
      init_object();
      init_range();
      init_chunk();
      init_mixin();
      init_underscore_array_methods();
    }
  });

  // node_modules/underscore/modules/index-default.js
  var _2, index_default_default;
  var init_index_default = __esm({
    "node_modules/underscore/modules/index-default.js"() {
      init_modules();
      init_modules();
      _2 = mixin(modules_exports);
      _2._ = _2;
      index_default_default = _2;
    }
  });

  // node_modules/underscore/modules/index-all.js
  var index_all_exports = {};
  __export(index_all_exports, {
    VERSION: () => VERSION,
    after: () => after,
    all: () => every,
    allKeys: () => allKeys,
    any: () => some,
    assign: () => extendOwn_default,
    before: () => before,
    bind: () => bind_default,
    bindAll: () => bindAll_default,
    chain: () => chain,
    chunk: () => chunk,
    clone: () => clone,
    collect: () => map,
    compact: () => compact,
    compose: () => compose,
    constant: () => constant,
    contains: () => contains,
    countBy: () => countBy_default,
    create: () => create,
    debounce: () => debounce,
    default: () => index_default_default,
    defaults: () => defaults_default,
    defer: () => defer_default,
    delay: () => delay_default,
    detect: () => find,
    difference: () => difference_default,
    drop: () => rest,
    each: () => each,
    escape: () => escape_default,
    every: () => every,
    extend: () => extend_default,
    extendOwn: () => extendOwn_default,
    filter: () => filter,
    find: () => find,
    findIndex: () => findIndex_default,
    findKey: () => findKey,
    findLastIndex: () => findLastIndex_default,
    findWhere: () => findWhere,
    first: () => first,
    flatten: () => flatten2,
    foldl: () => reduce_default,
    foldr: () => reduceRight_default,
    forEach: () => each,
    functions: () => functions,
    get: () => get,
    groupBy: () => groupBy_default,
    has: () => has3,
    head: () => first,
    identity: () => identity,
    include: () => contains,
    includes: () => contains,
    indexBy: () => indexBy_default,
    indexOf: () => indexOf_default,
    initial: () => initial,
    inject: () => reduce_default,
    intersection: () => intersection,
    invert: () => invert,
    invoke: () => invoke_default,
    isArguments: () => isArguments_default,
    isArray: () => isArray_default,
    isArrayBuffer: () => isArrayBuffer_default,
    isBoolean: () => isBoolean,
    isDataView: () => isDataView_default,
    isDate: () => isDate_default,
    isElement: () => isElement,
    isEmpty: () => isEmpty,
    isEqual: () => isEqual,
    isError: () => isError_default,
    isFinite: () => isFinite2,
    isFunction: () => isFunction_default,
    isMap: () => isMap_default,
    isMatch: () => isMatch,
    isNaN: () => isNaN2,
    isNull: () => isNull,
    isNumber: () => isNumber_default,
    isObject: () => isObject2,
    isRegExp: () => isRegExp_default,
    isSet: () => isSet_default,
    isString: () => isString_default,
    isSymbol: () => isSymbol_default,
    isTypedArray: () => isTypedArray_default,
    isUndefined: () => isUndefined,
    isWeakMap: () => isWeakMap_default,
    isWeakSet: () => isWeakSet_default,
    iteratee: () => iteratee,
    keys: () => keys2,
    last: () => last,
    lastIndexOf: () => lastIndexOf_default,
    map: () => map,
    mapObject: () => mapObject,
    matcher: () => matcher,
    matches: () => matcher,
    max: () => max,
    memoize: () => memoize,
    methods: () => functions,
    min: () => min,
    mixin: () => mixin,
    negate: () => negate,
    noop: () => noop,
    now: () => now_default,
    object: () => object,
    omit: () => omit_default,
    once: () => once_default,
    pairs: () => pairs,
    partial: () => partial_default,
    partition: () => partition_default,
    pick: () => pick_default,
    pluck: () => pluck,
    property: () => property,
    propertyOf: () => propertyOf,
    random: () => random,
    range: () => range,
    reduce: () => reduce_default,
    reduceRight: () => reduceRight_default,
    reject: () => reject,
    rest: () => rest,
    restArguments: () => restArguments,
    result: () => result,
    sample: () => sample,
    select: () => filter,
    shuffle: () => shuffle,
    size: () => size,
    some: () => some,
    sortBy: () => sortBy,
    sortedIndex: () => sortedIndex,
    tail: () => rest,
    take: () => first,
    tap: () => tap,
    template: () => template,
    templateSettings: () => templateSettings_default,
    throttle: () => throttle,
    times: () => times,
    toArray: () => toArray,
    toPath: () => toPath,
    transpose: () => unzip,
    unescape: () => unescape_default,
    union: () => union_default,
    uniq: () => uniq,
    unique: () => uniq,
    uniqueId: () => uniqueId,
    unzip: () => unzip,
    values: () => values,
    where: () => where,
    without: () => without_default,
    wrap: () => wrap,
    zip: () => zip_default
  });
  var init_index_all = __esm({
    "node_modules/underscore/modules/index-all.js"() {
      init_index_default();
      init_modules();
    }
  });

  // node_modules/bluebird/js/release/es5.js
  var require_es5 = __commonJS({
    "node_modules/bluebird/js/release/es5.js"(exports2, module2) {
      var isES5 = (function() {
        "use strict";
        return this === void 0;
      })();
      if (isES5) {
        module2.exports = {
          freeze: Object.freeze,
          defineProperty: Object.defineProperty,
          getDescriptor: Object.getOwnPropertyDescriptor,
          keys: Object.keys,
          names: Object.getOwnPropertyNames,
          getPrototypeOf: Object.getPrototypeOf,
          isArray: Array.isArray,
          isES5,
          propertyIsWritable: function(obj2, prop) {
            var descriptor = Object.getOwnPropertyDescriptor(obj2, prop);
            return !!(!descriptor || descriptor.writable || descriptor.set);
          }
        };
      } else {
        has4 = {}.hasOwnProperty;
        str = {}.toString;
        proto = {}.constructor.prototype;
        ObjectKeys = function(o) {
          var ret2 = [];
          for (var key in o) {
            if (has4.call(o, key)) {
              ret2.push(key);
            }
          }
          return ret2;
        };
        ObjectGetDescriptor = function(o, key) {
          return { value: o[key] };
        };
        ObjectDefineProperty = function(o, key, desc) {
          o[key] = desc.value;
          return o;
        };
        ObjectFreeze = function(obj2) {
          return obj2;
        };
        ObjectGetPrototypeOf = function(obj2) {
          try {
            return Object(obj2).constructor.prototype;
          } catch (e) {
            return proto;
          }
        };
        ArrayIsArray = function(obj2) {
          try {
            return str.call(obj2) === "[object Array]";
          } catch (e) {
            return false;
          }
        };
        module2.exports = {
          isArray: ArrayIsArray,
          keys: ObjectKeys,
          names: ObjectKeys,
          defineProperty: ObjectDefineProperty,
          getDescriptor: ObjectGetDescriptor,
          freeze: ObjectFreeze,
          getPrototypeOf: ObjectGetPrototypeOf,
          isES5,
          propertyIsWritable: function() {
            return true;
          }
        };
      }
      var has4;
      var str;
      var proto;
      var ObjectKeys;
      var ObjectGetDescriptor;
      var ObjectDefineProperty;
      var ObjectFreeze;
      var ObjectGetPrototypeOf;
      var ArrayIsArray;
    }
  });

  // node_modules/bluebird/js/release/util.js
  var require_util = __commonJS({
    "node_modules/bluebird/js/release/util.js"(exports, module) {
      "use strict";
      var es5 = require_es5();
      var canEvaluate = typeof navigator == "undefined";
      var errorObj = { e: {} };
      var tryCatchTarget;
      var globalObject = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : exports !== void 0 ? exports : null;
      function tryCatcher() {
        try {
          var target = tryCatchTarget;
          tryCatchTarget = null;
          return target.apply(this, arguments);
        } catch (e) {
          errorObj.e = e;
          return errorObj;
        }
      }
      function tryCatch(fn) {
        tryCatchTarget = fn;
        return tryCatcher;
      }
      var inherits = function(Child, Parent) {
        var hasProp = {}.hasOwnProperty;
        function T() {
          this.constructor = Child;
          this.constructor$ = Parent;
          for (var propertyName in Parent.prototype) {
            if (hasProp.call(Parent.prototype, propertyName) && propertyName.charAt(propertyName.length - 1) !== "$") {
              this[propertyName + "$"] = Parent.prototype[propertyName];
            }
          }
        }
        T.prototype = Parent.prototype;
        Child.prototype = new T();
        return Child.prototype;
      };
      function isPrimitive(val) {
        return val == null || val === true || val === false || typeof val === "string" || typeof val === "number";
      }
      function isObject(value) {
        return typeof value === "function" || typeof value === "object" && value !== null;
      }
      function maybeWrapAsError(maybeError) {
        if (!isPrimitive(maybeError)) return maybeError;
        return new Error(safeToString(maybeError));
      }
      function withAppended(target, appendee) {
        var len = target.length;
        var ret2 = new Array(len + 1);
        var i;
        for (i = 0; i < len; ++i) {
          ret2[i] = target[i];
        }
        ret2[i] = appendee;
        return ret2;
      }
      function getDataPropertyOrDefault(obj2, key, defaultValue) {
        if (es5.isES5) {
          var desc = Object.getOwnPropertyDescriptor(obj2, key);
          if (desc != null) {
            return desc.get == null && desc.set == null ? desc.value : defaultValue;
          }
        } else {
          return {}.hasOwnProperty.call(obj2, key) ? obj2[key] : void 0;
        }
      }
      function notEnumerableProp(obj2, name, value) {
        if (isPrimitive(obj2)) return obj2;
        var descriptor = {
          value,
          configurable: true,
          enumerable: false,
          writable: true
        };
        es5.defineProperty(obj2, name, descriptor);
        return obj2;
      }
      function thrower(r) {
        throw r;
      }
      var inheritedDataKeys = (function() {
        var excludedPrototypes = [
          Array.prototype,
          Object.prototype,
          Function.prototype
        ];
        var isExcludedProto = function(val) {
          for (var i = 0; i < excludedPrototypes.length; ++i) {
            if (excludedPrototypes[i] === val) {
              return true;
            }
          }
          return false;
        };
        if (es5.isES5) {
          var getKeys = Object.getOwnPropertyNames;
          return function(obj2) {
            var ret2 = [];
            var visitedKeys = /* @__PURE__ */ Object.create(null);
            while (obj2 != null && !isExcludedProto(obj2)) {
              var keys3;
              try {
                keys3 = getKeys(obj2);
              } catch (e) {
                return ret2;
              }
              for (var i = 0; i < keys3.length; ++i) {
                var key = keys3[i];
                if (visitedKeys[key]) continue;
                visitedKeys[key] = true;
                var desc = Object.getOwnPropertyDescriptor(obj2, key);
                if (desc != null && desc.get == null && desc.set == null) {
                  ret2.push(key);
                }
              }
              obj2 = es5.getPrototypeOf(obj2);
            }
            return ret2;
          };
        } else {
          var hasProp = {}.hasOwnProperty;
          return function(obj2) {
            if (isExcludedProto(obj2)) return [];
            var ret2 = [];
            enumeration: for (var key in obj2) {
              if (hasProp.call(obj2, key)) {
                ret2.push(key);
              } else {
                for (var i = 0; i < excludedPrototypes.length; ++i) {
                  if (hasProp.call(excludedPrototypes[i], key)) {
                    continue enumeration;
                  }
                }
                ret2.push(key);
              }
            }
            return ret2;
          };
        }
      })();
      var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
      function isClass(fn) {
        try {
          if (typeof fn === "function") {
            var keys3 = es5.names(fn.prototype);
            var hasMethods = es5.isES5 && keys3.length > 1;
            var hasMethodsOtherThanConstructor = keys3.length > 0 && !(keys3.length === 1 && keys3[0] === "constructor");
            var hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
            if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) {
              return true;
            }
          }
          return false;
        } catch (e) {
          return false;
        }
      }
      function toFastProperties(obj) {
        function FakeConstructor() {
        }
        FakeConstructor.prototype = obj;
        var l = 8;
        while (l--) new FakeConstructor();
        return obj;
        eval(obj);
      }
      var rident = /^[a-z$_][a-z$_0-9]*$/i;
      function isIdentifier(str) {
        return rident.test(str);
      }
      function filledRange(count, prefix, suffix) {
        var ret2 = new Array(count);
        for (var i = 0; i < count; ++i) {
          ret2[i] = prefix + i + suffix;
        }
        return ret2;
      }
      function safeToString(obj2) {
        try {
          return obj2 + "";
        } catch (e) {
          return "[no string representation]";
        }
      }
      function isError(obj2) {
        return obj2 !== null && typeof obj2 === "object" && typeof obj2.message === "string" && typeof obj2.name === "string";
      }
      function markAsOriginatingFromRejection(e) {
        try {
          notEnumerableProp(e, "isOperational", true);
        } catch (ignore) {
        }
      }
      function originatesFromRejection(e) {
        if (e == null) return false;
        return e instanceof Error["__BluebirdErrorTypes__"].OperationalError || e["isOperational"] === true;
      }
      function canAttachTrace(obj2) {
        return isError(obj2) && es5.propertyIsWritable(obj2, "stack");
      }
      var ensureErrorObject = (function() {
        if (!("stack" in new Error())) {
          return function(value) {
            if (canAttachTrace(value)) return value;
            try {
              throw new Error(safeToString(value));
            } catch (err) {
              return err;
            }
          };
        } else {
          return function(value) {
            if (canAttachTrace(value)) return value;
            return new Error(safeToString(value));
          };
        }
      })();
      function classString(obj2) {
        return {}.toString.call(obj2);
      }
      function copyDescriptors(from, to, filter2) {
        var keys3 = es5.names(from);
        for (var i = 0; i < keys3.length; ++i) {
          var key = keys3[i];
          if (filter2(key)) {
            try {
              es5.defineProperty(to, key, es5.getDescriptor(from, key));
            } catch (ignore) {
            }
          }
        }
      }
      var asArray = function(v) {
        if (es5.isArray(v)) {
          return v;
        }
        return null;
      };
      if (typeof Symbol !== "undefined" && Symbol.iterator) {
        ArrayFrom = typeof Array.from === "function" ? function(v) {
          return Array.from(v);
        } : function(v) {
          var ret2 = [];
          var it = v[Symbol.iterator]();
          var itResult;
          while (!(itResult = it.next()).done) {
            ret2.push(itResult.value);
          }
          return ret2;
        };
        asArray = function(v) {
          if (es5.isArray(v)) {
            return v;
          } else if (v != null && typeof v[Symbol.iterator] === "function") {
            return ArrayFrom(v);
          }
          return null;
        };
      }
      var ArrayFrom;
      var isNode = typeof process !== "undefined" && classString(process).toLowerCase() === "[object process]";
      var hasEnvVariables = typeof process !== "undefined" && typeof process.env !== "undefined";
      function env(key) {
        return hasEnvVariables ? process.env[key] : void 0;
      }
      function getNativePromise() {
        if (typeof Promise === "function") {
          try {
            var promise = new Promise(function() {
            });
            if ({}.toString.call(promise) === "[object Promise]") {
              return Promise;
            }
          } catch (e) {
          }
        }
      }
      function domainBind(self2, cb2) {
        return self2.bind(cb2);
      }
      var ret = {
        isClass,
        isIdentifier,
        inheritedDataKeys,
        getDataPropertyOrDefault,
        thrower,
        isArray: es5.isArray,
        asArray,
        notEnumerableProp,
        isPrimitive,
        isObject,
        isError,
        canEvaluate,
        errorObj,
        tryCatch,
        inherits,
        withAppended,
        maybeWrapAsError,
        toFastProperties,
        filledRange,
        toString: safeToString,
        canAttachTrace,
        ensureErrorObject,
        originatesFromRejection,
        markAsOriginatingFromRejection,
        classString,
        copyDescriptors,
        hasDevTools: typeof chrome !== "undefined" && chrome && typeof chrome.loadTimes === "function",
        isNode,
        hasEnvVariables,
        env,
        global: globalObject,
        getNativePromise,
        domainBind
      };
      ret.isRecentNode = ret.isNode && (function() {
        var version3 = process.versions.node.split(".").map(Number);
        return version3[0] === 0 && version3[1] > 10 || version3[0] > 0;
      })();
      if (ret.isNode) ret.toFastProperties(process);
      try {
        throw new Error();
      } catch (e) {
        ret.lastLineError = e;
      }
      module.exports = ret;
    }
  });

  // node_modules/bluebird/js/release/schedule.js
  var require_schedule = __commonJS({
    "node_modules/bluebird/js/release/schedule.js"(exports2, module2) {
      "use strict";
      var util = require_util();
      var schedule;
      var noAsyncScheduler = function() {
        throw new Error("No async scheduler available\n\n    See http://goo.gl/MqrFmX\n");
      };
      var NativePromise = util.getNativePromise();
      if (util.isNode && typeof MutationObserver === "undefined") {
        GlobalSetImmediate = global.setImmediate;
        ProcessNextTick = process.nextTick;
        schedule = util.isRecentNode ? function(fn) {
          GlobalSetImmediate.call(global, fn);
        } : function(fn) {
          ProcessNextTick.call(process, fn);
        };
      } else if (typeof NativePromise === "function" && typeof NativePromise.resolve === "function") {
        nativePromise = NativePromise.resolve();
        schedule = function(fn) {
          nativePromise.then(fn);
        };
      } else if (typeof MutationObserver !== "undefined" && !(typeof window !== "undefined" && window.navigator && (window.navigator.standalone || window.cordova))) {
        schedule = (function() {
          var div = document.createElement("div");
          var opts = { attributes: true };
          var toggleScheduled = false;
          var div2 = document.createElement("div");
          var o2 = new MutationObserver(function() {
            div.classList.toggle("foo");
            toggleScheduled = false;
          });
          o2.observe(div2, opts);
          var scheduleToggle = function() {
            if (toggleScheduled) return;
            toggleScheduled = true;
            div2.classList.toggle("foo");
          };
          return function schedule2(fn) {
            var o = new MutationObserver(function() {
              o.disconnect();
              fn();
            });
            o.observe(div, opts);
            scheduleToggle();
          };
        })();
      } else if (typeof setImmediate !== "undefined") {
        schedule = function(fn) {
          setImmediate(fn);
        };
      } else if (typeof setTimeout !== "undefined") {
        schedule = function(fn) {
          setTimeout(fn, 0);
        };
      } else {
        schedule = noAsyncScheduler;
      }
      var GlobalSetImmediate;
      var ProcessNextTick;
      var nativePromise;
      module2.exports = schedule;
    }
  });

  // node_modules/bluebird/js/release/queue.js
  var require_queue = __commonJS({
    "node_modules/bluebird/js/release/queue.js"(exports2, module2) {
      "use strict";
      function arrayMove(src, srcIndex, dst, dstIndex, len) {
        for (var j = 0; j < len; ++j) {
          dst[j + dstIndex] = src[j + srcIndex];
          src[j + srcIndex] = void 0;
        }
      }
      function Queue(capacity) {
        this._capacity = capacity;
        this._length = 0;
        this._front = 0;
      }
      Queue.prototype._willBeOverCapacity = function(size2) {
        return this._capacity < size2;
      };
      Queue.prototype._pushOne = function(arg) {
        var length = this.length();
        this._checkCapacity(length + 1);
        var i = this._front + length & this._capacity - 1;
        this[i] = arg;
        this._length = length + 1;
      };
      Queue.prototype.push = function(fn, receiver, arg) {
        var length = this.length() + 3;
        if (this._willBeOverCapacity(length)) {
          this._pushOne(fn);
          this._pushOne(receiver);
          this._pushOne(arg);
          return;
        }
        var j = this._front + length - 3;
        this._checkCapacity(length);
        var wrapMask = this._capacity - 1;
        this[j + 0 & wrapMask] = fn;
        this[j + 1 & wrapMask] = receiver;
        this[j + 2 & wrapMask] = arg;
        this._length = length;
      };
      Queue.prototype.shift = function() {
        var front = this._front, ret2 = this[front];
        this[front] = void 0;
        this._front = front + 1 & this._capacity - 1;
        this._length--;
        return ret2;
      };
      Queue.prototype.length = function() {
        return this._length;
      };
      Queue.prototype._checkCapacity = function(size2) {
        if (this._capacity < size2) {
          this._resizeTo(this._capacity << 1);
        }
      };
      Queue.prototype._resizeTo = function(capacity) {
        var oldCapacity = this._capacity;
        this._capacity = capacity;
        var front = this._front;
        var length = this._length;
        var moveItemsCount = front + length & oldCapacity - 1;
        arrayMove(this, 0, this, oldCapacity, moveItemsCount);
      };
      module2.exports = Queue;
    }
  });

  // node_modules/bluebird/js/release/async.js
  var require_async = __commonJS({
    "node_modules/bluebird/js/release/async.js"(exports2, module2) {
      "use strict";
      var firstLineError;
      try {
        throw new Error();
      } catch (e) {
        firstLineError = e;
      }
      var schedule = require_schedule();
      var Queue = require_queue();
      var util = require_util();
      function Async() {
        this._customScheduler = false;
        this._isTickUsed = false;
        this._lateQueue = new Queue(16);
        this._normalQueue = new Queue(16);
        this._haveDrainedQueues = false;
        this._trampolineEnabled = true;
        var self2 = this;
        this.drainQueues = function() {
          self2._drainQueues();
        };
        this._schedule = schedule;
      }
      Async.prototype.setScheduler = function(fn) {
        var prev = this._schedule;
        this._schedule = fn;
        this._customScheduler = true;
        return prev;
      };
      Async.prototype.hasCustomScheduler = function() {
        return this._customScheduler;
      };
      Async.prototype.enableTrampoline = function() {
        this._trampolineEnabled = true;
      };
      Async.prototype.disableTrampolineIfNecessary = function() {
        if (util.hasDevTools) {
          this._trampolineEnabled = false;
        }
      };
      Async.prototype.haveItemsQueued = function() {
        return this._isTickUsed || this._haveDrainedQueues;
      };
      Async.prototype.fatalError = function(e, isNode2) {
        if (isNode2) {
          process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) + "\n");
          process.exit(2);
        } else {
          this.throwLater(e);
        }
      };
      Async.prototype.throwLater = function(fn, arg) {
        if (arguments.length === 1) {
          arg = fn;
          fn = function() {
            throw arg;
          };
        }
        if (typeof setTimeout !== "undefined") {
          setTimeout(function() {
            fn(arg);
          }, 0);
        } else try {
          this._schedule(function() {
            fn(arg);
          });
        } catch (e) {
          throw new Error("No async scheduler available\n\n    See http://goo.gl/MqrFmX\n");
        }
      };
      function AsyncInvokeLater(fn, receiver, arg) {
        this._lateQueue.push(fn, receiver, arg);
        this._queueTick();
      }
      function AsyncInvoke(fn, receiver, arg) {
        this._normalQueue.push(fn, receiver, arg);
        this._queueTick();
      }
      function AsyncSettlePromises(promise) {
        this._normalQueue._pushOne(promise);
        this._queueTick();
      }
      if (!util.hasDevTools) {
        Async.prototype.invokeLater = AsyncInvokeLater;
        Async.prototype.invoke = AsyncInvoke;
        Async.prototype.settlePromises = AsyncSettlePromises;
      } else {
        Async.prototype.invokeLater = function(fn, receiver, arg) {
          if (this._trampolineEnabled) {
            AsyncInvokeLater.call(this, fn, receiver, arg);
          } else {
            this._schedule(function() {
              setTimeout(function() {
                fn.call(receiver, arg);
              }, 100);
            });
          }
        };
        Async.prototype.invoke = function(fn, receiver, arg) {
          if (this._trampolineEnabled) {
            AsyncInvoke.call(this, fn, receiver, arg);
          } else {
            this._schedule(function() {
              fn.call(receiver, arg);
            });
          }
        };
        Async.prototype.settlePromises = function(promise) {
          if (this._trampolineEnabled) {
            AsyncSettlePromises.call(this, promise);
          } else {
            this._schedule(function() {
              promise._settlePromises();
            });
          }
        };
      }
      Async.prototype._drainQueue = function(queue) {
        while (queue.length() > 0) {
          var fn = queue.shift();
          if (typeof fn !== "function") {
            fn._settlePromises();
            continue;
          }
          var receiver = queue.shift();
          var arg = queue.shift();
          fn.call(receiver, arg);
        }
      };
      Async.prototype._drainQueues = function() {
        this._drainQueue(this._normalQueue);
        this._reset();
        this._haveDrainedQueues = true;
        this._drainQueue(this._lateQueue);
      };
      Async.prototype._queueTick = function() {
        if (!this._isTickUsed) {
          this._isTickUsed = true;
          this._schedule(this.drainQueues);
        }
      };
      Async.prototype._reset = function() {
        this._isTickUsed = false;
      };
      module2.exports = Async;
      module2.exports.firstLineError = firstLineError;
    }
  });

  // node_modules/bluebird/js/release/errors.js
  var require_errors = __commonJS({
    "node_modules/bluebird/js/release/errors.js"(exports2, module2) {
      "use strict";
      var es52 = require_es5();
      var Objectfreeze = es52.freeze;
      var util = require_util();
      var inherits2 = util.inherits;
      var notEnumerableProp2 = util.notEnumerableProp;
      function subError(nameProperty, defaultMessage) {
        function SubError(message) {
          if (!(this instanceof SubError)) return new SubError(message);
          notEnumerableProp2(
            this,
            "message",
            typeof message === "string" ? message : defaultMessage
          );
          notEnumerableProp2(this, "name", nameProperty);
          if (Error.captureStackTrace) {
            Error.captureStackTrace(this, this.constructor);
          } else {
            Error.call(this);
          }
        }
        inherits2(SubError, Error);
        return SubError;
      }
      var _TypeError;
      var _RangeError;
      var Warning = subError("Warning", "warning");
      var CancellationError = subError("CancellationError", "cancellation error");
      var TimeoutError = subError("TimeoutError", "timeout error");
      var AggregateError = subError("AggregateError", "aggregate error");
      try {
        _TypeError = TypeError;
        _RangeError = RangeError;
      } catch (e) {
        _TypeError = subError("TypeError", "type error");
        _RangeError = subError("RangeError", "range error");
      }
      var methods = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");
      for (i = 0; i < methods.length; ++i) {
        if (typeof Array.prototype[methods[i]] === "function") {
          AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
        }
      }
      var i;
      es52.defineProperty(AggregateError.prototype, "length", {
        value: 0,
        configurable: false,
        writable: true,
        enumerable: true
      });
      AggregateError.prototype["isOperational"] = true;
      var level = 0;
      AggregateError.prototype.toString = function() {
        var indent = Array(level * 4 + 1).join(" ");
        var ret2 = "\n" + indent + "AggregateError of:\n";
        level++;
        indent = Array(level * 4 + 1).join(" ");
        for (var i2 = 0; i2 < this.length; ++i2) {
          var str = this[i2] === this ? "[Circular AggregateError]" : this[i2] + "";
          var lines = str.split("\n");
          for (var j = 0; j < lines.length; ++j) {
            lines[j] = indent + lines[j];
          }
          str = lines.join("\n");
          ret2 += str + "\n";
        }
        level--;
        return ret2;
      };
      function OperationalError(message) {
        if (!(this instanceof OperationalError))
          return new OperationalError(message);
        notEnumerableProp2(this, "name", "OperationalError");
        notEnumerableProp2(this, "message", message);
        this.cause = message;
        this["isOperational"] = true;
        if (message instanceof Error) {
          notEnumerableProp2(this, "message", message.message);
          notEnumerableProp2(this, "stack", message.stack);
        } else if (Error.captureStackTrace) {
          Error.captureStackTrace(this, this.constructor);
        }
      }
      inherits2(OperationalError, Error);
      var errorTypes = Error["__BluebirdErrorTypes__"];
      if (!errorTypes) {
        errorTypes = Objectfreeze({
          CancellationError,
          TimeoutError,
          OperationalError,
          RejectionError: OperationalError,
          AggregateError
        });
        es52.defineProperty(Error, "__BluebirdErrorTypes__", {
          value: errorTypes,
          writable: false,
          enumerable: false,
          configurable: false
        });
      }
      module2.exports = {
        Error,
        TypeError: _TypeError,
        RangeError: _RangeError,
        CancellationError: errorTypes.CancellationError,
        OperationalError: errorTypes.OperationalError,
        TimeoutError: errorTypes.TimeoutError,
        AggregateError: errorTypes.AggregateError,
        Warning
      };
    }
  });

  // node_modules/bluebird/js/release/thenables.js
  var require_thenables = __commonJS({
    "node_modules/bluebird/js/release/thenables.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2) {
        var util = require_util();
        var errorObj2 = util.errorObj;
        var isObject3 = util.isObject;
        function tryConvertToPromise(obj2, context) {
          if (isObject3(obj2)) {
            if (obj2 instanceof Promise2) return obj2;
            var then = getThen(obj2);
            if (then === errorObj2) {
              if (context) context._pushContext();
              var ret2 = Promise2.reject(then.e);
              if (context) context._popContext();
              return ret2;
            } else if (typeof then === "function") {
              if (isAnyBluebirdPromise(obj2)) {
                var ret2 = new Promise2(INTERNAL2);
                obj2._then(
                  ret2._fulfill,
                  ret2._reject,
                  void 0,
                  ret2,
                  null
                );
                return ret2;
              }
              return doThenable(obj2, then, context);
            }
          }
          return obj2;
        }
        function doGetThen(obj2) {
          return obj2.then;
        }
        function getThen(obj2) {
          try {
            return doGetThen(obj2);
          } catch (e) {
            errorObj2.e = e;
            return errorObj2;
          }
        }
        var hasProp = {}.hasOwnProperty;
        function isAnyBluebirdPromise(obj2) {
          try {
            return hasProp.call(obj2, "_promise0");
          } catch (e) {
            return false;
          }
        }
        function doThenable(x, then, context) {
          var promise = new Promise2(INTERNAL2);
          var ret2 = promise;
          if (context) context._pushContext();
          promise._captureStackTrace();
          if (context) context._popContext();
          var synchronous = true;
          var result2 = util.tryCatch(then).call(x, resolve, reject2);
          synchronous = false;
          if (promise && result2 === errorObj2) {
            promise._rejectCallback(result2.e, true, true);
            promise = null;
          }
          function resolve(value) {
            if (!promise) return;
            promise._resolveCallback(value);
            promise = null;
          }
          function reject2(reason) {
            if (!promise) return;
            promise._rejectCallback(reason, synchronous, true);
            promise = null;
          }
          return ret2;
        }
        return tryConvertToPromise;
      };
    }
  });

  // node_modules/bluebird/js/release/promise_array.js
  var require_promise_array = __commonJS({
    "node_modules/bluebird/js/release/promise_array.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, apiRejection, Proxyable) {
        var util = require_util();
        var isArray = util.isArray;
        function toResolutionValue(val) {
          switch (val) {
            case -2:
              return [];
            case -3:
              return {};
          }
        }
        function PromiseArray(values2) {
          var promise = this._promise = new Promise2(INTERNAL2);
          if (values2 instanceof Promise2) {
            promise._propagateFrom(values2, 3);
          }
          promise._setOnCancel(this);
          this._values = values2;
          this._length = 0;
          this._totalResolved = 0;
          this._init(void 0, -2);
        }
        util.inherits(PromiseArray, Proxyable);
        PromiseArray.prototype.length = function() {
          return this._length;
        };
        PromiseArray.prototype.promise = function() {
          return this._promise;
        };
        PromiseArray.prototype._init = function init(_3, resolveValueIfEmpty) {
          var values2 = tryConvertToPromise(this._values, this._promise);
          if (values2 instanceof Promise2) {
            values2 = values2._target();
            var bitField = values2._bitField;
            ;
            this._values = values2;
            if ((bitField & 50397184) === 0) {
              this._promise._setAsyncGuaranteed();
              return values2._then(
                init,
                this._reject,
                void 0,
                this,
                resolveValueIfEmpty
              );
            } else if ((bitField & 33554432) !== 0) {
              values2 = values2._value();
            } else if ((bitField & 16777216) !== 0) {
              return this._reject(values2._reason());
            } else {
              return this._cancel();
            }
          }
          values2 = util.asArray(values2);
          if (values2 === null) {
            var err = apiRejection(
              "expecting an array or an iterable object but got " + util.classString(values2)
            ).reason();
            this._promise._rejectCallback(err, false);
            return;
          }
          if (values2.length === 0) {
            if (resolveValueIfEmpty === -5) {
              this._resolveEmptyArray();
            } else {
              this._resolve(toResolutionValue(resolveValueIfEmpty));
            }
            return;
          }
          this._iterate(values2);
        };
        PromiseArray.prototype._iterate = function(values2) {
          var len = this.getActualLength(values2.length);
          this._length = len;
          this._values = this.shouldCopyValues() ? new Array(len) : this._values;
          var result2 = this._promise;
          var isResolved = false;
          var bitField = null;
          for (var i = 0; i < len; ++i) {
            var maybePromise = tryConvertToPromise(values2[i], result2);
            if (maybePromise instanceof Promise2) {
              maybePromise = maybePromise._target();
              bitField = maybePromise._bitField;
            } else {
              bitField = null;
            }
            if (isResolved) {
              if (bitField !== null) {
                maybePromise.suppressUnhandledRejections();
              }
            } else if (bitField !== null) {
              if ((bitField & 50397184) === 0) {
                maybePromise._proxy(this, i);
                this._values[i] = maybePromise;
              } else if ((bitField & 33554432) !== 0) {
                isResolved = this._promiseFulfilled(maybePromise._value(), i);
              } else if ((bitField & 16777216) !== 0) {
                isResolved = this._promiseRejected(maybePromise._reason(), i);
              } else {
                isResolved = this._promiseCancelled(i);
              }
            } else {
              isResolved = this._promiseFulfilled(maybePromise, i);
            }
          }
          if (!isResolved) result2._setAsyncGuaranteed();
        };
        PromiseArray.prototype._isResolved = function() {
          return this._values === null;
        };
        PromiseArray.prototype._resolve = function(value) {
          this._values = null;
          this._promise._fulfill(value);
        };
        PromiseArray.prototype._cancel = function() {
          if (this._isResolved() || !this._promise._isCancellable()) return;
          this._values = null;
          this._promise._cancel();
        };
        PromiseArray.prototype._reject = function(reason) {
          this._values = null;
          this._promise._rejectCallback(reason, false);
        };
        PromiseArray.prototype._promiseFulfilled = function(value, index) {
          this._values[index] = value;
          var totalResolved = ++this._totalResolved;
          if (totalResolved >= this._length) {
            this._resolve(this._values);
            return true;
          }
          return false;
        };
        PromiseArray.prototype._promiseCancelled = function() {
          this._cancel();
          return true;
        };
        PromiseArray.prototype._promiseRejected = function(reason) {
          this._totalResolved++;
          this._reject(reason);
          return true;
        };
        PromiseArray.prototype._resultCancelled = function() {
          if (this._isResolved()) return;
          var values2 = this._values;
          this._cancel();
          if (values2 instanceof Promise2) {
            values2.cancel();
          } else {
            for (var i = 0; i < values2.length; ++i) {
              if (values2[i] instanceof Promise2) {
                values2[i].cancel();
              }
            }
          }
        };
        PromiseArray.prototype.shouldCopyValues = function() {
          return true;
        };
        PromiseArray.prototype.getActualLength = function(len) {
          return len;
        };
        return PromiseArray;
      };
    }
  });

  // node_modules/bluebird/js/release/context.js
  var require_context = __commonJS({
    "node_modules/bluebird/js/release/context.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2) {
        var longStackTraces = false;
        var contextStack = [];
        Promise2.prototype._promiseCreated = function() {
        };
        Promise2.prototype._pushContext = function() {
        };
        Promise2.prototype._popContext = function() {
          return null;
        };
        Promise2._peekContext = Promise2.prototype._peekContext = function() {
        };
        function Context() {
          this._trace = new Context.CapturedTrace(peekContext());
        }
        Context.prototype._pushContext = function() {
          if (this._trace !== void 0) {
            this._trace._promiseCreated = null;
            contextStack.push(this._trace);
          }
        };
        Context.prototype._popContext = function() {
          if (this._trace !== void 0) {
            var trace = contextStack.pop();
            var ret2 = trace._promiseCreated;
            trace._promiseCreated = null;
            return ret2;
          }
          return null;
        };
        function createContext() {
          if (longStackTraces) return new Context();
        }
        function peekContext() {
          var lastIndex = contextStack.length - 1;
          if (lastIndex >= 0) {
            return contextStack[lastIndex];
          }
          return void 0;
        }
        Context.CapturedTrace = null;
        Context.create = createContext;
        Context.deactivateLongStackTraces = function() {
        };
        Context.activateLongStackTraces = function() {
          var Promise_pushContext = Promise2.prototype._pushContext;
          var Promise_popContext = Promise2.prototype._popContext;
          var Promise_PeekContext = Promise2._peekContext;
          var Promise_peekContext = Promise2.prototype._peekContext;
          var Promise_promiseCreated = Promise2.prototype._promiseCreated;
          Context.deactivateLongStackTraces = function() {
            Promise2.prototype._pushContext = Promise_pushContext;
            Promise2.prototype._popContext = Promise_popContext;
            Promise2._peekContext = Promise_PeekContext;
            Promise2.prototype._peekContext = Promise_peekContext;
            Promise2.prototype._promiseCreated = Promise_promiseCreated;
            longStackTraces = false;
          };
          longStackTraces = true;
          Promise2.prototype._pushContext = Context.prototype._pushContext;
          Promise2.prototype._popContext = Context.prototype._popContext;
          Promise2._peekContext = Promise2.prototype._peekContext = peekContext;
          Promise2.prototype._promiseCreated = function() {
            var ctx = this._peekContext();
            if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
          };
        };
        return Context;
      };
    }
  });

  // node_modules/bluebird/js/release/debuggability.js
  var require_debuggability = __commonJS({
    "node_modules/bluebird/js/release/debuggability.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, Context) {
        var getDomain = Promise2._getDomain;
        var async = Promise2._async;
        var Warning = require_errors().Warning;
        var util = require_util();
        var canAttachTrace2 = util.canAttachTrace;
        var unhandledRejectionHandled;
        var possiblyUnhandledRejection;
        var bluebirdFramePattern = /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
        var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
        var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
        var stackFramePattern = null;
        var formatStack = null;
        var indentStackFrames = false;
        var printWarning;
        var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && (util.env("BLUEBIRD_DEBUG") || util.env("NODE_ENV") === "development"));
        var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && (debugging || util.env("BLUEBIRD_WARNINGS")));
        var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
        var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
        Promise2.prototype.suppressUnhandledRejections = function() {
          var target = this._target();
          target._bitField = target._bitField & ~1048576 | 524288;
        };
        Promise2.prototype._ensurePossibleRejectionHandled = function() {
          if ((this._bitField & 524288) !== 0) return;
          this._setRejectionIsUnhandled();
          async.invokeLater(this._notifyUnhandledRejection, this, void 0);
        };
        Promise2.prototype._notifyUnhandledRejectionIsHandled = function() {
          fireRejectionEvent(
            "rejectionHandled",
            unhandledRejectionHandled,
            void 0,
            this
          );
        };
        Promise2.prototype._setReturnedNonUndefined = function() {
          this._bitField = this._bitField | 268435456;
        };
        Promise2.prototype._returnedNonUndefined = function() {
          return (this._bitField & 268435456) !== 0;
        };
        Promise2.prototype._notifyUnhandledRejection = function() {
          if (this._isRejectionUnhandled()) {
            var reason = this._settledValue();
            this._setUnhandledRejectionIsNotified();
            fireRejectionEvent(
              "unhandledRejection",
              possiblyUnhandledRejection,
              reason,
              this
            );
          }
        };
        Promise2.prototype._setUnhandledRejectionIsNotified = function() {
          this._bitField = this._bitField | 262144;
        };
        Promise2.prototype._unsetUnhandledRejectionIsNotified = function() {
          this._bitField = this._bitField & ~262144;
        };
        Promise2.prototype._isUnhandledRejectionNotified = function() {
          return (this._bitField & 262144) > 0;
        };
        Promise2.prototype._setRejectionIsUnhandled = function() {
          this._bitField = this._bitField | 1048576;
        };
        Promise2.prototype._unsetRejectionIsUnhandled = function() {
          this._bitField = this._bitField & ~1048576;
          if (this._isUnhandledRejectionNotified()) {
            this._unsetUnhandledRejectionIsNotified();
            this._notifyUnhandledRejectionIsHandled();
          }
        };
        Promise2.prototype._isRejectionUnhandled = function() {
          return (this._bitField & 1048576) > 0;
        };
        Promise2.prototype._warn = function(message, shouldUseOwnTrace, promise) {
          return warn2(message, shouldUseOwnTrace, promise || this);
        };
        Promise2.onPossiblyUnhandledRejection = function(fn) {
          var domain = getDomain();
          possiblyUnhandledRejection = typeof fn === "function" ? domain === null ? fn : util.domainBind(domain, fn) : void 0;
        };
        Promise2.onUnhandledRejectionHandled = function(fn) {
          var domain = getDomain();
          unhandledRejectionHandled = typeof fn === "function" ? domain === null ? fn : util.domainBind(domain, fn) : void 0;
        };
        var disableLongStackTraces = function() {
        };
        Promise2.longStackTraces = function() {
          if (async.haveItemsQueued() && !config.longStackTraces) {
            throw new Error("cannot enable long stack traces after promises have been created\n\n    See http://goo.gl/MqrFmX\n");
          }
          if (!config.longStackTraces && longStackTracesIsSupported()) {
            var Promise_captureStackTrace = Promise2.prototype._captureStackTrace;
            var Promise_attachExtraTrace = Promise2.prototype._attachExtraTrace;
            config.longStackTraces = true;
            disableLongStackTraces = function() {
              if (async.haveItemsQueued() && !config.longStackTraces) {
                throw new Error("cannot enable long stack traces after promises have been created\n\n    See http://goo.gl/MqrFmX\n");
              }
              Promise2.prototype._captureStackTrace = Promise_captureStackTrace;
              Promise2.prototype._attachExtraTrace = Promise_attachExtraTrace;
              Context.deactivateLongStackTraces();
              async.enableTrampoline();
              config.longStackTraces = false;
            };
            Promise2.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
            Promise2.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
            Context.activateLongStackTraces();
            async.disableTrampolineIfNecessary();
          }
        };
        Promise2.hasLongStackTraces = function() {
          return config.longStackTraces && longStackTracesIsSupported();
        };
        var fireDomEvent = (function() {
          try {
            if (typeof CustomEvent === "function") {
              var event = new CustomEvent("CustomEvent");
              util.global.dispatchEvent(event);
              return function(name, event2) {
                var domEvent = new CustomEvent(name.toLowerCase(), {
                  detail: event2,
                  cancelable: true
                });
                return !util.global.dispatchEvent(domEvent);
              };
            } else if (typeof Event === "function") {
              var event = new Event("CustomEvent");
              util.global.dispatchEvent(event);
              return function(name, event2) {
                var domEvent = new Event(name.toLowerCase(), {
                  cancelable: true
                });
                domEvent.detail = event2;
                return !util.global.dispatchEvent(domEvent);
              };
            } else {
              var event = document.createEvent("CustomEvent");
              event.initCustomEvent("testingtheevent", false, true, {});
              util.global.dispatchEvent(event);
              return function(name, event2) {
                var domEvent = document.createEvent("CustomEvent");
                domEvent.initCustomEvent(
                  name.toLowerCase(),
                  false,
                  true,
                  event2
                );
                return !util.global.dispatchEvent(domEvent);
              };
            }
          } catch (e) {
          }
          return function() {
            return false;
          };
        })();
        var fireGlobalEvent = (function() {
          if (util.isNode) {
            return function() {
              return process.emit.apply(process, arguments);
            };
          } else {
            if (!util.global) {
              return function() {
                return false;
              };
            }
            return function(name) {
              var methodName = "on" + name.toLowerCase();
              var method = util.global[methodName];
              if (!method) return false;
              method.apply(util.global, [].slice.call(arguments, 1));
              return true;
            };
          }
        })();
        function generatePromiseLifecycleEventObject(name, promise) {
          return { promise };
        }
        var eventToObjectGenerator = {
          promiseCreated: generatePromiseLifecycleEventObject,
          promiseFulfilled: generatePromiseLifecycleEventObject,
          promiseRejected: generatePromiseLifecycleEventObject,
          promiseResolved: generatePromiseLifecycleEventObject,
          promiseCancelled: generatePromiseLifecycleEventObject,
          promiseChained: function(name, promise, child) {
            return { promise, child };
          },
          warning: function(name, warning) {
            return { warning };
          },
          unhandledRejection: function(name, reason, promise) {
            return { reason, promise };
          },
          rejectionHandled: generatePromiseLifecycleEventObject
        };
        var activeFireEvent = function(name) {
          var globalEventFired = false;
          try {
            globalEventFired = fireGlobalEvent.apply(null, arguments);
          } catch (e) {
            async.throwLater(e);
            globalEventFired = true;
          }
          var domEventFired = false;
          try {
            domEventFired = fireDomEvent(
              name,
              eventToObjectGenerator[name].apply(null, arguments)
            );
          } catch (e) {
            async.throwLater(e);
            domEventFired = true;
          }
          return domEventFired || globalEventFired;
        };
        Promise2.config = function(opts) {
          opts = Object(opts);
          if ("longStackTraces" in opts) {
            if (opts.longStackTraces) {
              Promise2.longStackTraces();
            } else if (!opts.longStackTraces && Promise2.hasLongStackTraces()) {
              disableLongStackTraces();
            }
          }
          if ("warnings" in opts) {
            var warningsOption = opts.warnings;
            config.warnings = !!warningsOption;
            wForgottenReturn = config.warnings;
            if (util.isObject(warningsOption)) {
              if ("wForgottenReturn" in warningsOption) {
                wForgottenReturn = !!warningsOption.wForgottenReturn;
              }
            }
          }
          if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
            if (async.haveItemsQueued()) {
              throw new Error(
                "cannot enable cancellation after promises are in use"
              );
            }
            Promise2.prototype._clearCancellationData = cancellationClearCancellationData;
            Promise2.prototype._propagateFrom = cancellationPropagateFrom;
            Promise2.prototype._onCancel = cancellationOnCancel;
            Promise2.prototype._setOnCancel = cancellationSetOnCancel;
            Promise2.prototype._attachCancellationCallback = cancellationAttachCancellationCallback;
            Promise2.prototype._execute = cancellationExecute;
            propagateFromFunction = cancellationPropagateFrom;
            config.cancellation = true;
          }
          if ("monitoring" in opts) {
            if (opts.monitoring && !config.monitoring) {
              config.monitoring = true;
              Promise2.prototype._fireEvent = activeFireEvent;
            } else if (!opts.monitoring && config.monitoring) {
              config.monitoring = false;
              Promise2.prototype._fireEvent = defaultFireEvent;
            }
          }
          return Promise2;
        };
        function defaultFireEvent() {
          return false;
        }
        Promise2.prototype._fireEvent = defaultFireEvent;
        Promise2.prototype._execute = function(executor, resolve, reject2) {
          try {
            executor(resolve, reject2);
          } catch (e) {
            return e;
          }
        };
        Promise2.prototype._onCancel = function() {
        };
        Promise2.prototype._setOnCancel = function(handler) {
          ;
        };
        Promise2.prototype._attachCancellationCallback = function(onCancel) {
          ;
        };
        Promise2.prototype._captureStackTrace = function() {
        };
        Promise2.prototype._attachExtraTrace = function() {
        };
        Promise2.prototype._clearCancellationData = function() {
        };
        Promise2.prototype._propagateFrom = function(parent, flags) {
          ;
          ;
        };
        function cancellationExecute(executor, resolve, reject2) {
          var promise = this;
          try {
            executor(resolve, reject2, function(onCancel) {
              if (typeof onCancel !== "function") {
                throw new TypeError("onCancel must be a function, got: " + util.toString(onCancel));
              }
              promise._attachCancellationCallback(onCancel);
            });
          } catch (e) {
            return e;
          }
        }
        function cancellationAttachCancellationCallback(onCancel) {
          if (!this._isCancellable()) return this;
          var previousOnCancel = this._onCancel();
          if (previousOnCancel !== void 0) {
            if (util.isArray(previousOnCancel)) {
              previousOnCancel.push(onCancel);
            } else {
              this._setOnCancel([previousOnCancel, onCancel]);
            }
          } else {
            this._setOnCancel(onCancel);
          }
        }
        function cancellationOnCancel() {
          return this._onCancelField;
        }
        function cancellationSetOnCancel(onCancel) {
          this._onCancelField = onCancel;
        }
        function cancellationClearCancellationData() {
          this._cancellationParent = void 0;
          this._onCancelField = void 0;
        }
        function cancellationPropagateFrom(parent, flags) {
          if ((flags & 1) !== 0) {
            this._cancellationParent = parent;
            var branchesRemainingToCancel = parent._branchesRemainingToCancel;
            if (branchesRemainingToCancel === void 0) {
              branchesRemainingToCancel = 0;
            }
            parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
          }
          if ((flags & 2) !== 0 && parent._isBound()) {
            this._setBoundTo(parent._boundTo);
          }
        }
        function bindingPropagateFrom(parent, flags) {
          if ((flags & 2) !== 0 && parent._isBound()) {
            this._setBoundTo(parent._boundTo);
          }
        }
        var propagateFromFunction = bindingPropagateFrom;
        function boundValueFunction() {
          var ret2 = this._boundTo;
          if (ret2 !== void 0) {
            if (ret2 instanceof Promise2) {
              if (ret2.isFulfilled()) {
                return ret2.value();
              } else {
                return void 0;
              }
            }
          }
          return ret2;
        }
        function longStackTracesCaptureStackTrace() {
          this._trace = new CapturedTrace(this._peekContext());
        }
        function longStackTracesAttachExtraTrace(error, ignoreSelf) {
          if (canAttachTrace2(error)) {
            var trace = this._trace;
            if (trace !== void 0) {
              if (ignoreSelf) trace = trace._parent;
            }
            if (trace !== void 0) {
              trace.attachExtraTrace(error);
            } else if (!error.__stackCleaned__) {
              var parsed = parseStackAndMessage(error);
              util.notEnumerableProp(
                error,
                "stack",
                parsed.message + "\n" + parsed.stack.join("\n")
              );
              util.notEnumerableProp(error, "__stackCleaned__", true);
            }
          }
        }
        function checkForgottenReturns(returnValue, promiseCreated, name, promise, parent) {
          if (returnValue === void 0 && promiseCreated !== null && wForgottenReturn) {
            if (parent !== void 0 && parent._returnedNonUndefined()) return;
            if ((promise._bitField & 65535) === 0) return;
            if (name) name = name + " ";
            var handlerLine = "";
            var creatorLine = "";
            if (promiseCreated._trace) {
              var traceLines = promiseCreated._trace.stack.split("\n");
              var stack = cleanStack(traceLines);
              for (var i = stack.length - 1; i >= 0; --i) {
                var line = stack[i];
                if (!nodeFramePattern.test(line)) {
                  var lineMatches = line.match(parseLinePattern);
                  if (lineMatches) {
                    handlerLine = "at " + lineMatches[1] + ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
                  }
                  break;
                }
              }
              if (stack.length > 0) {
                var firstUserLine = stack[0];
                for (var i = 0; i < traceLines.length; ++i) {
                  if (traceLines[i] === firstUserLine) {
                    if (i > 0) {
                      creatorLine = "\n" + traceLines[i - 1];
                    }
                    break;
                  }
                }
              }
            }
            var msg = "a promise was created in a " + name + "handler " + handlerLine + "but was not returned from it, see http://goo.gl/rRqMUw" + creatorLine;
            promise._warn(msg, true, promiseCreated);
          }
        }
        function deprecated(name, replacement) {
          var message = name + " is deprecated and will be removed in a future version.";
          if (replacement) message += " Use " + replacement + " instead.";
          return warn2(message);
        }
        function warn2(message, shouldUseOwnTrace, promise) {
          if (!config.warnings) return;
          var warning = new Warning(message);
          var ctx;
          if (shouldUseOwnTrace) {
            promise._attachExtraTrace(warning);
          } else if (config.longStackTraces && (ctx = Promise2._peekContext())) {
            ctx.attachExtraTrace(warning);
          } else {
            var parsed = parseStackAndMessage(warning);
            warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
          }
          if (!activeFireEvent("warning", warning)) {
            formatAndLogError(warning, "", true);
          }
        }
        function reconstructStack(message, stacks) {
          for (var i = 0; i < stacks.length - 1; ++i) {
            stacks[i].push("From previous event:");
            stacks[i] = stacks[i].join("\n");
          }
          if (i < stacks.length) {
            stacks[i] = stacks[i].join("\n");
          }
          return message + "\n" + stacks.join("\n");
        }
        function removeDuplicateOrEmptyJumps(stacks) {
          for (var i = 0; i < stacks.length; ++i) {
            if (stacks[i].length === 0 || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]) {
              stacks.splice(i, 1);
              i--;
            }
          }
        }
        function removeCommonRoots(stacks) {
          var current = stacks[0];
          for (var i = 1; i < stacks.length; ++i) {
            var prev = stacks[i];
            var currentLastIndex = current.length - 1;
            var currentLastLine = current[currentLastIndex];
            var commonRootMeetPoint = -1;
            for (var j = prev.length - 1; j >= 0; --j) {
              if (prev[j] === currentLastLine) {
                commonRootMeetPoint = j;
                break;
              }
            }
            for (var j = commonRootMeetPoint; j >= 0; --j) {
              var line = prev[j];
              if (current[currentLastIndex] === line) {
                current.pop();
                currentLastIndex--;
              } else {
                break;
              }
            }
            current = prev;
          }
        }
        function cleanStack(stack) {
          var ret2 = [];
          for (var i = 0; i < stack.length; ++i) {
            var line = stack[i];
            var isTraceLine = "    (No stack trace)" === line || stackFramePattern.test(line);
            var isInternalFrame = isTraceLine && shouldIgnore(line);
            if (isTraceLine && !isInternalFrame) {
              if (indentStackFrames && line.charAt(0) !== " ") {
                line = "    " + line;
              }
              ret2.push(line);
            }
          }
          return ret2;
        }
        function stackFramesAsArray(error) {
          var stack = error.stack.replace(/\s+$/g, "").split("\n");
          for (var i = 0; i < stack.length; ++i) {
            var line = stack[i];
            if ("    (No stack trace)" === line || stackFramePattern.test(line)) {
              break;
            }
          }
          if (i > 0 && error.name != "SyntaxError") {
            stack = stack.slice(i);
          }
          return stack;
        }
        function parseStackAndMessage(error) {
          var stack = error.stack;
          var message = error.toString();
          stack = typeof stack === "string" && stack.length > 0 ? stackFramesAsArray(error) : ["    (No stack trace)"];
          return {
            message,
            stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
          };
        }
        function formatAndLogError(error, title, isSoft) {
          if (typeof console !== "undefined") {
            var message;
            if (util.isObject(error)) {
              var stack = error.stack;
              message = title + formatStack(stack, error);
            } else {
              message = title + String(error);
            }
            if (typeof printWarning === "function") {
              printWarning(message, isSoft);
            } else if (typeof console.log === "function" || typeof console.log === "object") {
              console.log(message);
            }
          }
        }
        function fireRejectionEvent(name, localHandler, reason, promise) {
          var localEventFired = false;
          try {
            if (typeof localHandler === "function") {
              localEventFired = true;
              if (name === "rejectionHandled") {
                localHandler(promise);
              } else {
                localHandler(reason, promise);
              }
            }
          } catch (e) {
            async.throwLater(e);
          }
          if (name === "unhandledRejection") {
            if (!activeFireEvent(name, reason, promise) && !localEventFired) {
              formatAndLogError(reason, "Unhandled rejection ");
            }
          } else {
            activeFireEvent(name, promise);
          }
        }
        function formatNonError(obj2) {
          var str;
          if (typeof obj2 === "function") {
            str = "[function " + (obj2.name || "anonymous") + "]";
          } else {
            str = obj2 && typeof obj2.toString === "function" ? obj2.toString() : util.toString(obj2);
            var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
            if (ruselessToString.test(str)) {
              try {
                var newStr = JSON.stringify(obj2);
                str = newStr;
              } catch (e) {
              }
            }
            if (str.length === 0) {
              str = "(empty array)";
            }
          }
          return "(<" + snip(str) + ">, no stack trace)";
        }
        function snip(str) {
          var maxChars = 41;
          if (str.length < maxChars) {
            return str;
          }
          return str.substr(0, maxChars - 3) + "...";
        }
        function longStackTracesIsSupported() {
          return typeof captureStackTrace === "function";
        }
        var shouldIgnore = function() {
          return false;
        };
        var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
        function parseLineInfo(line) {
          var matches = line.match(parseLineInfoRegex);
          if (matches) {
            return {
              fileName: matches[1],
              line: parseInt(matches[2], 10)
            };
          }
        }
        function setBounds(firstLineError, lastLineError) {
          if (!longStackTracesIsSupported()) return;
          var firstStackLines = firstLineError.stack.split("\n");
          var lastStackLines = lastLineError.stack.split("\n");
          var firstIndex = -1;
          var lastIndex = -1;
          var firstFileName;
          var lastFileName;
          for (var i = 0; i < firstStackLines.length; ++i) {
            var result2 = parseLineInfo(firstStackLines[i]);
            if (result2) {
              firstFileName = result2.fileName;
              firstIndex = result2.line;
              break;
            }
          }
          for (var i = 0; i < lastStackLines.length; ++i) {
            var result2 = parseLineInfo(lastStackLines[i]);
            if (result2) {
              lastFileName = result2.fileName;
              lastIndex = result2.line;
              break;
            }
          }
          if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex) {
            return;
          }
          shouldIgnore = function(line) {
            if (bluebirdFramePattern.test(line)) return true;
            var info2 = parseLineInfo(line);
            if (info2) {
              if (info2.fileName === firstFileName && (firstIndex <= info2.line && info2.line <= lastIndex)) {
                return true;
              }
            }
            return false;
          };
        }
        function CapturedTrace(parent) {
          this._parent = parent;
          this._promisesCreated = 0;
          var length = this._length = 1 + (parent === void 0 ? 0 : parent._length);
          captureStackTrace(this, CapturedTrace);
          if (length > 32) this.uncycle();
        }
        util.inherits(CapturedTrace, Error);
        Context.CapturedTrace = CapturedTrace;
        CapturedTrace.prototype.uncycle = function() {
          var length = this._length;
          if (length < 2) return;
          var nodes = [];
          var stackToIndex = {};
          for (var i = 0, node = this; node !== void 0; ++i) {
            nodes.push(node);
            node = node._parent;
          }
          length = this._length = i;
          for (var i = length - 1; i >= 0; --i) {
            var stack = nodes[i].stack;
            if (stackToIndex[stack] === void 0) {
              stackToIndex[stack] = i;
            }
          }
          for (var i = 0; i < length; ++i) {
            var currentStack = nodes[i].stack;
            var index = stackToIndex[currentStack];
            if (index !== void 0 && index !== i) {
              if (index > 0) {
                nodes[index - 1]._parent = void 0;
                nodes[index - 1]._length = 1;
              }
              nodes[i]._parent = void 0;
              nodes[i]._length = 1;
              var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
              if (index < length - 1) {
                cycleEdgeNode._parent = nodes[index + 1];
                cycleEdgeNode._parent.uncycle();
                cycleEdgeNode._length = cycleEdgeNode._parent._length + 1;
              } else {
                cycleEdgeNode._parent = void 0;
                cycleEdgeNode._length = 1;
              }
              var currentChildLength = cycleEdgeNode._length + 1;
              for (var j = i - 2; j >= 0; --j) {
                nodes[j]._length = currentChildLength;
                currentChildLength++;
              }
              return;
            }
          }
        };
        CapturedTrace.prototype.attachExtraTrace = function(error) {
          if (error.__stackCleaned__) return;
          this.uncycle();
          var parsed = parseStackAndMessage(error);
          var message = parsed.message;
          var stacks = [parsed.stack];
          var trace = this;
          while (trace !== void 0) {
            stacks.push(cleanStack(trace.stack.split("\n")));
            trace = trace._parent;
          }
          removeCommonRoots(stacks);
          removeDuplicateOrEmptyJumps(stacks);
          util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
          util.notEnumerableProp(error, "__stackCleaned__", true);
        };
        var captureStackTrace = (function stackDetection() {
          var v8stackFramePattern = /^\s*at\s*/;
          var v8stackFormatter = function(stack, error) {
            if (typeof stack === "string") return stack;
            if (error.name !== void 0 && error.message !== void 0) {
              return error.toString();
            }
            return formatNonError(error);
          };
          if (typeof Error.stackTraceLimit === "number" && typeof Error.captureStackTrace === "function") {
            Error.stackTraceLimit += 6;
            stackFramePattern = v8stackFramePattern;
            formatStack = v8stackFormatter;
            var captureStackTrace2 = Error.captureStackTrace;
            shouldIgnore = function(line) {
              return bluebirdFramePattern.test(line);
            };
            return function(receiver, ignoreUntil) {
              Error.stackTraceLimit += 6;
              captureStackTrace2(receiver, ignoreUntil);
              Error.stackTraceLimit -= 6;
            };
          }
          var err = new Error();
          if (typeof err.stack === "string" && err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
            stackFramePattern = /@/;
            formatStack = v8stackFormatter;
            indentStackFrames = true;
            return function captureStackTrace3(o) {
              o.stack = new Error().stack;
            };
          }
          var hasStackAfterThrow;
          try {
            throw new Error();
          } catch (e) {
            hasStackAfterThrow = "stack" in e;
          }
          if (!("stack" in err) && hasStackAfterThrow && typeof Error.stackTraceLimit === "number") {
            stackFramePattern = v8stackFramePattern;
            formatStack = v8stackFormatter;
            return function captureStackTrace3(o) {
              Error.stackTraceLimit += 6;
              try {
                throw new Error();
              } catch (e) {
                o.stack = e.stack;
              }
              Error.stackTraceLimit -= 6;
            };
          }
          formatStack = function(stack, error) {
            if (typeof stack === "string") return stack;
            if ((typeof error === "object" || typeof error === "function") && error.name !== void 0 && error.message !== void 0) {
              return error.toString();
            }
            return formatNonError(error);
          };
          return null;
        })([]);
        if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
          printWarning = function(message) {
            console.warn(message);
          };
          if (util.isNode && process.stderr.isTTY) {
            printWarning = function(message, isSoft) {
              var color = isSoft ? "\x1B[33m" : "\x1B[31m";
              console.warn(color + message + "\x1B[0m\n");
            };
          } else if (!util.isNode && typeof new Error().stack === "string") {
            printWarning = function(message, isSoft) {
              console.warn(
                "%c" + message,
                isSoft ? "color: darkorange" : "color: red"
              );
            };
          }
        }
        var config = {
          warnings,
          longStackTraces: false,
          cancellation: false,
          monitoring: false
        };
        if (longStackTraces) Promise2.longStackTraces();
        return {
          longStackTraces: function() {
            return config.longStackTraces;
          },
          warnings: function() {
            return config.warnings;
          },
          cancellation: function() {
            return config.cancellation;
          },
          monitoring: function() {
            return config.monitoring;
          },
          propagateFromFunction: function() {
            return propagateFromFunction;
          },
          boundValueFunction: function() {
            return boundValueFunction;
          },
          checkForgottenReturns,
          setBounds,
          warn: warn2,
          deprecated,
          CapturedTrace,
          fireDomEvent,
          fireGlobalEvent
        };
      };
    }
  });

  // node_modules/bluebird/js/release/finally.js
  var require_finally = __commonJS({
    "node_modules/bluebird/js/release/finally.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, tryConvertToPromise) {
        var util = require_util();
        var CancellationError = Promise2.CancellationError;
        var errorObj2 = util.errorObj;
        function PassThroughHandlerContext(promise, type, handler) {
          this.promise = promise;
          this.type = type;
          this.handler = handler;
          this.called = false;
          this.cancelPromise = null;
        }
        PassThroughHandlerContext.prototype.isFinallyHandler = function() {
          return this.type === 0;
        };
        function FinallyHandlerCancelReaction(finallyHandler2) {
          this.finallyHandler = finallyHandler2;
        }
        FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
          checkCancel(this.finallyHandler);
        };
        function checkCancel(ctx, reason) {
          if (ctx.cancelPromise != null) {
            if (arguments.length > 1) {
              ctx.cancelPromise._reject(reason);
            } else {
              ctx.cancelPromise._cancel();
            }
            ctx.cancelPromise = null;
            return true;
          }
          return false;
        }
        function succeed() {
          return finallyHandler.call(this, this.promise._target()._settledValue());
        }
        function fail(reason) {
          if (checkCancel(this, reason)) return;
          errorObj2.e = reason;
          return errorObj2;
        }
        function finallyHandler(reasonOrValue) {
          var promise = this.promise;
          var handler = this.handler;
          if (!this.called) {
            this.called = true;
            var ret2 = this.isFinallyHandler() ? handler.call(promise._boundValue()) : handler.call(promise._boundValue(), reasonOrValue);
            if (ret2 !== void 0) {
              promise._setReturnedNonUndefined();
              var maybePromise = tryConvertToPromise(ret2, promise);
              if (maybePromise instanceof Promise2) {
                if (this.cancelPromise != null) {
                  if (maybePromise._isCancelled()) {
                    var reason = new CancellationError("late cancellation observer");
                    promise._attachExtraTrace(reason);
                    errorObj2.e = reason;
                    return errorObj2;
                  } else if (maybePromise.isPending()) {
                    maybePromise._attachCancellationCallback(
                      new FinallyHandlerCancelReaction(this)
                    );
                  }
                }
                return maybePromise._then(
                  succeed,
                  fail,
                  void 0,
                  this,
                  void 0
                );
              }
            }
          }
          if (promise.isRejected()) {
            checkCancel(this);
            errorObj2.e = reasonOrValue;
            return errorObj2;
          } else {
            checkCancel(this);
            return reasonOrValue;
          }
        }
        Promise2.prototype._passThrough = function(handler, type, success, fail2) {
          if (typeof handler !== "function") return this.then();
          return this._then(
            success,
            fail2,
            void 0,
            new PassThroughHandlerContext(this, type, handler),
            void 0
          );
        };
        Promise2.prototype.lastly = Promise2.prototype["finally"] = function(handler) {
          return this._passThrough(
            handler,
            0,
            finallyHandler,
            finallyHandler
          );
        };
        Promise2.prototype.tap = function(handler) {
          return this._passThrough(handler, 1, finallyHandler);
        };
        return PassThroughHandlerContext;
      };
    }
  });

  // node_modules/bluebird/js/release/catch_filter.js
  var require_catch_filter = __commonJS({
    "node_modules/bluebird/js/release/catch_filter.js"(exports2, module2) {
      "use strict";
      module2.exports = function(NEXT_FILTER) {
        var util = require_util();
        var getKeys = require_es5().keys;
        var tryCatch2 = util.tryCatch;
        var errorObj2 = util.errorObj;
        function catchFilter(instances, cb2, promise) {
          return function(e) {
            var boundTo = promise._boundValue();
            predicateLoop: for (var i = 0; i < instances.length; ++i) {
              var item = instances[i];
              if (item === Error || item != null && item.prototype instanceof Error) {
                if (e instanceof item) {
                  return tryCatch2(cb2).call(boundTo, e);
                }
              } else if (typeof item === "function") {
                var matchesPredicate = tryCatch2(item).call(boundTo, e);
                if (matchesPredicate === errorObj2) {
                  return matchesPredicate;
                } else if (matchesPredicate) {
                  return tryCatch2(cb2).call(boundTo, e);
                }
              } else if (util.isObject(e)) {
                var keys3 = getKeys(item);
                for (var j = 0; j < keys3.length; ++j) {
                  var key = keys3[j];
                  if (item[key] != e[key]) {
                    continue predicateLoop;
                  }
                }
                return tryCatch2(cb2).call(boundTo, e);
              }
            }
            return NEXT_FILTER;
          };
        }
        return catchFilter;
      };
    }
  });

  // node_modules/bluebird/js/release/nodeback.js
  var require_nodeback = __commonJS({
    "node_modules/bluebird/js/release/nodeback.js"(exports2, module2) {
      "use strict";
      var util = require_util();
      var maybeWrapAsError2 = util.maybeWrapAsError;
      var errors = require_errors();
      var OperationalError = errors.OperationalError;
      var es52 = require_es5();
      function isUntypedError(obj2) {
        return obj2 instanceof Error && es52.getPrototypeOf(obj2) === Error.prototype;
      }
      var rErrorKey = /^(?:name|message|stack|cause)$/;
      function wrapAsOperationalError(obj2) {
        var ret2;
        if (isUntypedError(obj2)) {
          ret2 = new OperationalError(obj2);
          ret2.name = obj2.name;
          ret2.message = obj2.message;
          ret2.stack = obj2.stack;
          var keys3 = es52.keys(obj2);
          for (var i = 0; i < keys3.length; ++i) {
            var key = keys3[i];
            if (!rErrorKey.test(key)) {
              ret2[key] = obj2[key];
            }
          }
          return ret2;
        }
        util.markAsOriginatingFromRejection(obj2);
        return obj2;
      }
      function nodebackForPromise(promise, multiArgs) {
        return function(err, value) {
          if (promise === null) return;
          if (err) {
            var wrapped = wrapAsOperationalError(maybeWrapAsError2(err));
            promise._attachExtraTrace(wrapped);
            promise._reject(wrapped);
          } else if (!multiArgs) {
            promise._fulfill(value);
          } else {
            var $_len = arguments.length;
            var args = new Array(Math.max($_len - 1, 0));
            for (var $_i = 1; $_i < $_len; ++$_i) {
              args[$_i - 1] = arguments[$_i];
            }
            ;
            promise._fulfill(args);
          }
          promise = null;
        };
      }
      module2.exports = nodebackForPromise;
    }
  });

  // node_modules/bluebird/js/release/method.js
  var require_method = __commonJS({
    "node_modules/bluebird/js/release/method.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, apiRejection, debug) {
        var util = require_util();
        var tryCatch2 = util.tryCatch;
        Promise2.method = function(fn) {
          if (typeof fn !== "function") {
            throw new Promise2.TypeError("expecting a function but got " + util.classString(fn));
          }
          return function() {
            var ret2 = new Promise2(INTERNAL2);
            ret2._captureStackTrace();
            ret2._pushContext();
            var value = tryCatch2(fn).apply(this, arguments);
            var promiseCreated = ret2._popContext();
            debug.checkForgottenReturns(
              value,
              promiseCreated,
              "Promise.method",
              ret2
            );
            ret2._resolveFromSyncValue(value);
            return ret2;
          };
        };
        Promise2.attempt = Promise2["try"] = function(fn) {
          if (typeof fn !== "function") {
            return apiRejection("expecting a function but got " + util.classString(fn));
          }
          var ret2 = new Promise2(INTERNAL2);
          ret2._captureStackTrace();
          ret2._pushContext();
          var value;
          if (arguments.length > 1) {
            debug.deprecated("calling Promise.try with more than 1 argument");
            var arg = arguments[1];
            var ctx = arguments[2];
            value = util.isArray(arg) ? tryCatch2(fn).apply(ctx, arg) : tryCatch2(fn).call(ctx, arg);
          } else {
            value = tryCatch2(fn)();
          }
          var promiseCreated = ret2._popContext();
          debug.checkForgottenReturns(
            value,
            promiseCreated,
            "Promise.try",
            ret2
          );
          ret2._resolveFromSyncValue(value);
          return ret2;
        };
        Promise2.prototype._resolveFromSyncValue = function(value) {
          if (value === util.errorObj) {
            this._rejectCallback(value.e, false);
          } else {
            this._resolveCallback(value, true);
          }
        };
      };
    }
  });

  // node_modules/bluebird/js/release/bind.js
  var require_bind = __commonJS({
    "node_modules/bluebird/js/release/bind.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, debug) {
        var calledBind = false;
        var rejectThis = function(_3, e) {
          this._reject(e);
        };
        var targetRejected = function(e, context) {
          context.promiseRejectionQueued = true;
          context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
        };
        var bindingResolved = function(thisArg, context) {
          if ((this._bitField & 50397184) === 0) {
            this._resolveCallback(context.target);
          }
        };
        var bindingRejected = function(e, context) {
          if (!context.promiseRejectionQueued) this._reject(e);
        };
        Promise2.prototype.bind = function(thisArg) {
          if (!calledBind) {
            calledBind = true;
            Promise2.prototype._propagateFrom = debug.propagateFromFunction();
            Promise2.prototype._boundValue = debug.boundValueFunction();
          }
          var maybePromise = tryConvertToPromise(thisArg);
          var ret2 = new Promise2(INTERNAL2);
          ret2._propagateFrom(this, 1);
          var target = this._target();
          ret2._setBoundTo(maybePromise);
          if (maybePromise instanceof Promise2) {
            var context = {
              promiseRejectionQueued: false,
              promise: ret2,
              target,
              bindingPromise: maybePromise
            };
            target._then(INTERNAL2, targetRejected, void 0, ret2, context);
            maybePromise._then(
              bindingResolved,
              bindingRejected,
              void 0,
              ret2,
              context
            );
            ret2._setOnCancel(maybePromise);
          } else {
            ret2._resolveCallback(target);
          }
          return ret2;
        };
        Promise2.prototype._setBoundTo = function(obj2) {
          if (obj2 !== void 0) {
            this._bitField = this._bitField | 2097152;
            this._boundTo = obj2;
          } else {
            this._bitField = this._bitField & ~2097152;
          }
        };
        Promise2.prototype._isBound = function() {
          return (this._bitField & 2097152) === 2097152;
        };
        Promise2.bind = function(thisArg, value) {
          return Promise2.resolve(value).bind(thisArg);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/cancel.js
  var require_cancel = __commonJS({
    "node_modules/bluebird/js/release/cancel.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, PromiseArray, apiRejection, debug) {
        var util = require_util();
        var tryCatch2 = util.tryCatch;
        var errorObj2 = util.errorObj;
        var async = Promise2._async;
        Promise2.prototype["break"] = Promise2.prototype.cancel = function() {
          if (!debug.cancellation()) return this._warn("cancellation is disabled");
          var promise = this;
          var child = promise;
          while (promise._isCancellable()) {
            if (!promise._cancelBy(child)) {
              if (child._isFollowing()) {
                child._followee().cancel();
              } else {
                child._cancelBranched();
              }
              break;
            }
            var parent = promise._cancellationParent;
            if (parent == null || !parent._isCancellable()) {
              if (promise._isFollowing()) {
                promise._followee().cancel();
              } else {
                promise._cancelBranched();
              }
              break;
            } else {
              if (promise._isFollowing()) promise._followee().cancel();
              promise._setWillBeCancelled();
              child = promise;
              promise = parent;
            }
          }
        };
        Promise2.prototype._branchHasCancelled = function() {
          this._branchesRemainingToCancel--;
        };
        Promise2.prototype._enoughBranchesHaveCancelled = function() {
          return this._branchesRemainingToCancel === void 0 || this._branchesRemainingToCancel <= 0;
        };
        Promise2.prototype._cancelBy = function(canceller) {
          if (canceller === this) {
            this._branchesRemainingToCancel = 0;
            this._invokeOnCancel();
            return true;
          } else {
            this._branchHasCancelled();
            if (this._enoughBranchesHaveCancelled()) {
              this._invokeOnCancel();
              return true;
            }
          }
          return false;
        };
        Promise2.prototype._cancelBranched = function() {
          if (this._enoughBranchesHaveCancelled()) {
            this._cancel();
          }
        };
        Promise2.prototype._cancel = function() {
          if (!this._isCancellable()) return;
          this._setCancelled();
          async.invoke(this._cancelPromises, this, void 0);
        };
        Promise2.prototype._cancelPromises = function() {
          if (this._length() > 0) this._settlePromises();
        };
        Promise2.prototype._unsetOnCancel = function() {
          this._onCancelField = void 0;
        };
        Promise2.prototype._isCancellable = function() {
          return this.isPending() && !this._isCancelled();
        };
        Promise2.prototype.isCancellable = function() {
          return this.isPending() && !this.isCancelled();
        };
        Promise2.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
          if (util.isArray(onCancelCallback)) {
            for (var i = 0; i < onCancelCallback.length; ++i) {
              this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
            }
          } else if (onCancelCallback !== void 0) {
            if (typeof onCancelCallback === "function") {
              if (!internalOnly) {
                var e = tryCatch2(onCancelCallback).call(this._boundValue());
                if (e === errorObj2) {
                  this._attachExtraTrace(e.e);
                  async.throwLater(e.e);
                }
              }
            } else {
              onCancelCallback._resultCancelled(this);
            }
          }
        };
        Promise2.prototype._invokeOnCancel = function() {
          var onCancelCallback = this._onCancel();
          this._unsetOnCancel();
          async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
        };
        Promise2.prototype._invokeInternalOnCancel = function() {
          if (this._isCancellable()) {
            this._doInvokeOnCancel(this._onCancel(), true);
            this._unsetOnCancel();
          }
        };
        Promise2.prototype._resultCancelled = function() {
          this.cancel();
        };
      };
    }
  });

  // node_modules/bluebird/js/release/direct_resolve.js
  var require_direct_resolve = __commonJS({
    "node_modules/bluebird/js/release/direct_resolve.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2) {
        function returner() {
          return this.value;
        }
        function thrower2() {
          throw this.reason;
        }
        Promise2.prototype["return"] = Promise2.prototype.thenReturn = function(value) {
          if (value instanceof Promise2) value.suppressUnhandledRejections();
          return this._then(
            returner,
            void 0,
            void 0,
            { value },
            void 0
          );
        };
        Promise2.prototype["throw"] = Promise2.prototype.thenThrow = function(reason) {
          return this._then(
            thrower2,
            void 0,
            void 0,
            { reason },
            void 0
          );
        };
        Promise2.prototype.catchThrow = function(reason) {
          if (arguments.length <= 1) {
            return this._then(
              void 0,
              thrower2,
              void 0,
              { reason },
              void 0
            );
          } else {
            var _reason = arguments[1];
            var handler = function() {
              throw _reason;
            };
            return this.caught(reason, handler);
          }
        };
        Promise2.prototype.catchReturn = function(value) {
          if (arguments.length <= 1) {
            if (value instanceof Promise2) value.suppressUnhandledRejections();
            return this._then(
              void 0,
              returner,
              void 0,
              { value },
              void 0
            );
          } else {
            var _value = arguments[1];
            if (_value instanceof Promise2) _value.suppressUnhandledRejections();
            var handler = function() {
              return _value;
            };
            return this.caught(value, handler);
          }
        };
      };
    }
  });

  // node_modules/bluebird/js/release/synchronous_inspection.js
  var require_synchronous_inspection = __commonJS({
    "node_modules/bluebird/js/release/synchronous_inspection.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2) {
        function PromiseInspection(promise) {
          if (promise !== void 0) {
            promise = promise._target();
            this._bitField = promise._bitField;
            this._settledValueField = promise._isFateSealed() ? promise._settledValue() : void 0;
          } else {
            this._bitField = 0;
            this._settledValueField = void 0;
          }
        }
        PromiseInspection.prototype._settledValue = function() {
          return this._settledValueField;
        };
        var value = PromiseInspection.prototype.value = function() {
          if (!this.isFulfilled()) {
            throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n    See http://goo.gl/MqrFmX\n");
          }
          return this._settledValue();
        };
        var reason = PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function() {
          if (!this.isRejected()) {
            throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n    See http://goo.gl/MqrFmX\n");
          }
          return this._settledValue();
        };
        var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
          return (this._bitField & 33554432) !== 0;
        };
        var isRejected = PromiseInspection.prototype.isRejected = function() {
          return (this._bitField & 16777216) !== 0;
        };
        var isPending = PromiseInspection.prototype.isPending = function() {
          return (this._bitField & 50397184) === 0;
        };
        var isResolved = PromiseInspection.prototype.isResolved = function() {
          return (this._bitField & 50331648) !== 0;
        };
        PromiseInspection.prototype.isCancelled = function() {
          return (this._bitField & 8454144) !== 0;
        };
        Promise2.prototype.__isCancelled = function() {
          return (this._bitField & 65536) === 65536;
        };
        Promise2.prototype._isCancelled = function() {
          return this._target().__isCancelled();
        };
        Promise2.prototype.isCancelled = function() {
          return (this._target()._bitField & 8454144) !== 0;
        };
        Promise2.prototype.isPending = function() {
          return isPending.call(this._target());
        };
        Promise2.prototype.isRejected = function() {
          return isRejected.call(this._target());
        };
        Promise2.prototype.isFulfilled = function() {
          return isFulfilled.call(this._target());
        };
        Promise2.prototype.isResolved = function() {
          return isResolved.call(this._target());
        };
        Promise2.prototype.value = function() {
          return value.call(this._target());
        };
        Promise2.prototype.reason = function() {
          var target = this._target();
          target._unsetRejectionIsUnhandled();
          return reason.call(target);
        };
        Promise2.prototype._value = function() {
          return this._settledValue();
        };
        Promise2.prototype._reason = function() {
          this._unsetRejectionIsUnhandled();
          return this._settledValue();
        };
        Promise2.PromiseInspection = PromiseInspection;
      };
    }
  });

  // node_modules/bluebird/js/release/join.js
  var require_join = __commonJS({
    "node_modules/bluebird/js/release/join.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, INTERNAL2, async, getDomain) {
        var util = require_util();
        var canEvaluate2 = util.canEvaluate;
        var tryCatch2 = util.tryCatch;
        var errorObj2 = util.errorObj;
        var reject2;
        if (true) {
          if (canEvaluate2) {
            var thenCallback = function(i2) {
              return new Function("value", "holder", "                             \n            'use strict';                                                    \n            holder.pIndex = value;                                           \n            holder.checkFulfillment(this);                                   \n            ".replace(/Index/g, i2));
            };
            var promiseSetter = function(i2) {
              return new Function("promise", "holder", "                           \n            'use strict';                                                    \n            holder.pIndex = promise;                                         \n            ".replace(/Index/g, i2));
            };
            var generateHolderClass = function(total) {
              var props = new Array(total);
              for (var i2 = 0; i2 < props.length; ++i2) {
                props[i2] = "this.p" + (i2 + 1);
              }
              var assignment = props.join(" = ") + " = null;";
              var cancellationCode = "var promise;\n" + props.map(function(prop) {
                return "                                                         \n                promise = " + prop + ";                                      \n                if (promise instanceof Promise) {                            \n                    promise.cancel();                                        \n                }                                                            \n            ";
              }).join("\n");
              var passedArguments = props.join(", ");
              var name = "Holder$" + total;
              var code = "return function(tryCatch, errorObj, Promise, async) {    \n            'use strict';                                                    \n            function [TheName](fn) {                                         \n                [TheProperties]                                              \n                this.fn = fn;                                                \n                this.asyncNeeded = true;                                     \n                this.now = 0;                                                \n            }                                                                \n                                                                             \n            [TheName].prototype._callFunction = function(promise) {          \n                promise._pushContext();                                      \n                var ret = tryCatch(this.fn)([ThePassedArguments]);           \n                promise._popContext();                                       \n                if (ret === errorObj) {                                      \n                    promise._rejectCallback(ret.e, false);                   \n                } else {                                                     \n                    promise._resolveCallback(ret);                           \n                }                                                            \n            };                                                               \n                                                                             \n            [TheName].prototype.checkFulfillment = function(promise) {       \n                var now = ++this.now;                                        \n                if (now === [TheTotal]) {                                    \n                    if (this.asyncNeeded) {                                  \n                        async.invoke(this._callFunction, this, promise);     \n                    } else {                                                 \n                        this._callFunction(promise);                         \n                    }                                                        \n                                                                             \n                }                                                            \n            };                                                               \n                                                                             \n            [TheName].prototype._resultCancelled = function() {              \n                [CancellationCode]                                           \n            };                                                               \n                                                                             \n            return [TheName];                                                \n        }(tryCatch, errorObj, Promise, async);                               \n        ";
              code = code.replace(/\[TheName\]/g, name).replace(/\[TheTotal\]/g, total).replace(/\[ThePassedArguments\]/g, passedArguments).replace(/\[TheProperties\]/g, assignment).replace(/\[CancellationCode\]/g, cancellationCode);
              return new Function("tryCatch", "errorObj", "Promise", "async", code)(tryCatch2, errorObj2, Promise2, async);
            };
            var holderClasses = [];
            var thenCallbacks = [];
            var promiseSetters = [];
            for (var i = 0; i < 8; ++i) {
              holderClasses.push(generateHolderClass(i + 1));
              thenCallbacks.push(thenCallback(i + 1));
              promiseSetters.push(promiseSetter(i + 1));
            }
            reject2 = function(reason) {
              this._reject(reason);
            };
          }
        }
        Promise2.join = function() {
          var last2 = arguments.length - 1;
          var fn;
          if (last2 > 0 && typeof arguments[last2] === "function") {
            fn = arguments[last2];
            if (true) {
              if (last2 <= 8 && canEvaluate2) {
                var ret2 = new Promise2(INTERNAL2);
                ret2._captureStackTrace();
                var HolderClass = holderClasses[last2 - 1];
                var holder = new HolderClass(fn);
                var callbacks = thenCallbacks;
                for (var i2 = 0; i2 < last2; ++i2) {
                  var maybePromise = tryConvertToPromise(arguments[i2], ret2);
                  if (maybePromise instanceof Promise2) {
                    maybePromise = maybePromise._target();
                    var bitField = maybePromise._bitField;
                    ;
                    if ((bitField & 50397184) === 0) {
                      maybePromise._then(
                        callbacks[i2],
                        reject2,
                        void 0,
                        ret2,
                        holder
                      );
                      promiseSetters[i2](maybePromise, holder);
                      holder.asyncNeeded = false;
                    } else if ((bitField & 33554432) !== 0) {
                      callbacks[i2].call(
                        ret2,
                        maybePromise._value(),
                        holder
                      );
                    } else if ((bitField & 16777216) !== 0) {
                      ret2._reject(maybePromise._reason());
                    } else {
                      ret2._cancel();
                    }
                  } else {
                    callbacks[i2].call(ret2, maybePromise, holder);
                  }
                }
                if (!ret2._isFateSealed()) {
                  if (holder.asyncNeeded) {
                    var domain = getDomain();
                    if (domain !== null) {
                      holder.fn = util.domainBind(domain, holder.fn);
                    }
                  }
                  ret2._setAsyncGuaranteed();
                  ret2._setOnCancel(holder);
                }
                return ret2;
              }
            }
          }
          var $_len = arguments.length;
          var args = new Array($_len);
          for (var $_i = 0; $_i < $_len; ++$_i) {
            args[$_i] = arguments[$_i];
          }
          ;
          if (fn) args.pop();
          var ret2 = new PromiseArray(args).promise();
          return fn !== void 0 ? ret2.spread(fn) : ret2;
        };
      };
    }
  });

  // node_modules/bluebird/js/release/map.js
  var require_map = __commonJS({
    "node_modules/bluebird/js/release/map.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug) {
        var getDomain = Promise2._getDomain;
        var util = require_util();
        var tryCatch2 = util.tryCatch;
        var errorObj2 = util.errorObj;
        var async = Promise2._async;
        function MappingPromiseArray(promises, fn, limit, _filter) {
          this.constructor$(promises);
          this._promise._captureStackTrace();
          var domain = getDomain();
          this._callback = domain === null ? fn : util.domainBind(domain, fn);
          this._preservedValues = _filter === INTERNAL2 ? new Array(this.length()) : null;
          this._limit = limit;
          this._inFlight = 0;
          this._queue = [];
          async.invoke(this._asyncInit, this, void 0);
        }
        util.inherits(MappingPromiseArray, PromiseArray);
        MappingPromiseArray.prototype._asyncInit = function() {
          this._init$(void 0, -2);
        };
        MappingPromiseArray.prototype._init = function() {
        };
        MappingPromiseArray.prototype._promiseFulfilled = function(value, index) {
          var values2 = this._values;
          var length = this.length();
          var preservedValues = this._preservedValues;
          var limit = this._limit;
          if (index < 0) {
            index = index * -1 - 1;
            values2[index] = value;
            if (limit >= 1) {
              this._inFlight--;
              this._drainQueue();
              if (this._isResolved()) return true;
            }
          } else {
            if (limit >= 1 && this._inFlight >= limit) {
              values2[index] = value;
              this._queue.push(index);
              return false;
            }
            if (preservedValues !== null) preservedValues[index] = value;
            var promise = this._promise;
            var callback = this._callback;
            var receiver = promise._boundValue();
            promise._pushContext();
            var ret2 = tryCatch2(callback).call(receiver, value, index, length);
            var promiseCreated = promise._popContext();
            debug.checkForgottenReturns(
              ret2,
              promiseCreated,
              preservedValues !== null ? "Promise.filter" : "Promise.map",
              promise
            );
            if (ret2 === errorObj2) {
              this._reject(ret2.e);
              return true;
            }
            var maybePromise = tryConvertToPromise(ret2, this._promise);
            if (maybePromise instanceof Promise2) {
              maybePromise = maybePromise._target();
              var bitField = maybePromise._bitField;
              ;
              if ((bitField & 50397184) === 0) {
                if (limit >= 1) this._inFlight++;
                values2[index] = maybePromise;
                maybePromise._proxy(this, (index + 1) * -1);
                return false;
              } else if ((bitField & 33554432) !== 0) {
                ret2 = maybePromise._value();
              } else if ((bitField & 16777216) !== 0) {
                this._reject(maybePromise._reason());
                return true;
              } else {
                this._cancel();
                return true;
              }
            }
            values2[index] = ret2;
          }
          var totalResolved = ++this._totalResolved;
          if (totalResolved >= length) {
            if (preservedValues !== null) {
              this._filter(values2, preservedValues);
            } else {
              this._resolve(values2);
            }
            return true;
          }
          return false;
        };
        MappingPromiseArray.prototype._drainQueue = function() {
          var queue = this._queue;
          var limit = this._limit;
          var values2 = this._values;
          while (queue.length > 0 && this._inFlight < limit) {
            if (this._isResolved()) return;
            var index = queue.pop();
            this._promiseFulfilled(values2[index], index);
          }
        };
        MappingPromiseArray.prototype._filter = function(booleans, values2) {
          var len = values2.length;
          var ret2 = new Array(len);
          var j = 0;
          for (var i = 0; i < len; ++i) {
            if (booleans[i]) ret2[j++] = values2[i];
          }
          ret2.length = j;
          this._resolve(ret2);
        };
        MappingPromiseArray.prototype.preservedValues = function() {
          return this._preservedValues;
        };
        function map2(promises, fn, options, _filter) {
          if (typeof fn !== "function") {
            return apiRejection("expecting a function but got " + util.classString(fn));
          }
          var limit = 0;
          if (options !== void 0) {
            if (typeof options === "object" && options !== null) {
              if (typeof options.concurrency !== "number") {
                return Promise2.reject(
                  new TypeError("'concurrency' must be a number but it is " + util.classString(options.concurrency))
                );
              }
              limit = options.concurrency;
            } else {
              return Promise2.reject(new TypeError(
                "options argument must be an object but it is " + util.classString(options)
              ));
            }
          }
          limit = typeof limit === "number" && isFinite(limit) && limit >= 1 ? limit : 0;
          return new MappingPromiseArray(promises, fn, limit, _filter).promise();
        }
        Promise2.prototype.map = function(fn, options) {
          return map2(this, fn, options, null);
        };
        Promise2.map = function(promises, fn, options, _filter) {
          return map2(promises, fn, options, _filter);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/call_get.js
  var require_call_get = __commonJS({
    "node_modules/bluebird/js/release/call_get.js"(exports2, module2) {
      "use strict";
      var cr = Object.create;
      if (cr) {
        callerCache = cr(null);
        getterCache = cr(null);
        callerCache[" size"] = getterCache[" size"] = 0;
      }
      var callerCache;
      var getterCache;
      module2.exports = function(Promise2) {
        var util = require_util();
        var canEvaluate2 = util.canEvaluate;
        var isIdentifier2 = util.isIdentifier;
        var getMethodCaller;
        var getGetter;
        if (true) {
          var makeMethodCaller = function(methodName) {
            return new Function("ensureMethod", "                                    \n        return function(obj) {                                               \n            'use strict'                                                     \n            var len = this.length;                                           \n            ensureMethod(obj, 'methodName');                                 \n            switch(len) {                                                    \n                case 1: return obj.methodName(this[0]);                      \n                case 2: return obj.methodName(this[0], this[1]);             \n                case 3: return obj.methodName(this[0], this[1], this[2]);    \n                case 0: return obj.methodName();                             \n                default:                                                     \n                    return obj.methodName.apply(obj, this);                  \n            }                                                                \n        };                                                                   \n        ".replace(/methodName/g, methodName))(ensureMethod);
          };
          var makeGetter = function(propertyName) {
            return new Function("obj", "                                             \n        'use strict';                                                        \n        return obj.propertyName;                                             \n        ".replace("propertyName", propertyName));
          };
          var getCompiled = function(name, compiler, cache) {
            var ret2 = cache[name];
            if (typeof ret2 !== "function") {
              if (!isIdentifier2(name)) {
                return null;
              }
              ret2 = compiler(name);
              cache[name] = ret2;
              cache[" size"]++;
              if (cache[" size"] > 512) {
                var keys3 = Object.keys(cache);
                for (var i = 0; i < 256; ++i) delete cache[keys3[i]];
                cache[" size"] = keys3.length - 256;
              }
            }
            return ret2;
          };
          getMethodCaller = function(name) {
            return getCompiled(name, makeMethodCaller, callerCache);
          };
          getGetter = function(name) {
            return getCompiled(name, makeGetter, getterCache);
          };
        }
        function ensureMethod(obj2, methodName) {
          var fn;
          if (obj2 != null) fn = obj2[methodName];
          if (typeof fn !== "function") {
            var message = "Object " + util.classString(obj2) + " has no method '" + util.toString(methodName) + "'";
            throw new Promise2.TypeError(message);
          }
          return fn;
        }
        function caller(obj2) {
          var methodName = this.pop();
          var fn = ensureMethod(obj2, methodName);
          return fn.apply(obj2, this);
        }
        Promise2.prototype.call = function(methodName) {
          var $_len = arguments.length;
          var args = new Array(Math.max($_len - 1, 0));
          for (var $_i = 1; $_i < $_len; ++$_i) {
            args[$_i - 1] = arguments[$_i];
          }
          ;
          if (true) {
            if (canEvaluate2) {
              var maybeCaller = getMethodCaller(methodName);
              if (maybeCaller !== null) {
                return this._then(
                  maybeCaller,
                  void 0,
                  void 0,
                  args,
                  void 0
                );
              }
            }
          }
          args.push(methodName);
          return this._then(caller, void 0, void 0, args, void 0);
        };
        function namedGetter(obj2) {
          return obj2[this];
        }
        function indexedGetter(obj2) {
          var index = +this;
          if (index < 0) index = Math.max(0, index + obj2.length);
          return obj2[index];
        }
        Promise2.prototype.get = function(propertyName) {
          var isIndex = typeof propertyName === "number";
          var getter;
          if (!isIndex) {
            if (canEvaluate2) {
              var maybeGetter = getGetter(propertyName);
              getter = maybeGetter !== null ? maybeGetter : namedGetter;
            } else {
              getter = namedGetter;
            }
          } else {
            getter = indexedGetter;
          }
          return this._then(getter, void 0, void 0, propertyName, void 0);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/using.js
  var require_using = __commonJS({
    "node_modules/bluebird/js/release/using.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL2, debug) {
        var util = require_util();
        var TypeError2 = require_errors().TypeError;
        var inherits2 = require_util().inherits;
        var errorObj2 = util.errorObj;
        var tryCatch2 = util.tryCatch;
        var NULL = {};
        function thrower2(e) {
          setTimeout(function() {
            throw e;
          }, 0);
        }
        function castPreservingDisposable(thenable) {
          var maybePromise = tryConvertToPromise(thenable);
          if (maybePromise !== thenable && typeof thenable._isDisposable === "function" && typeof thenable._getDisposer === "function" && thenable._isDisposable()) {
            maybePromise._setDisposable(thenable._getDisposer());
          }
          return maybePromise;
        }
        function dispose(resources, inspection) {
          var i = 0;
          var len = resources.length;
          var ret2 = new Promise2(INTERNAL2);
          function iterator() {
            if (i >= len) return ret2._fulfill();
            var maybePromise = castPreservingDisposable(resources[i++]);
            if (maybePromise instanceof Promise2 && maybePromise._isDisposable()) {
              try {
                maybePromise = tryConvertToPromise(
                  maybePromise._getDisposer().tryDispose(inspection),
                  resources.promise
                );
              } catch (e) {
                return thrower2(e);
              }
              if (maybePromise instanceof Promise2) {
                return maybePromise._then(
                  iterator,
                  thrower2,
                  null,
                  null,
                  null
                );
              }
            }
            iterator();
          }
          iterator();
          return ret2;
        }
        function Disposer(data, promise, context) {
          this._data = data;
          this._promise = promise;
          this._context = context;
        }
        Disposer.prototype.data = function() {
          return this._data;
        };
        Disposer.prototype.promise = function() {
          return this._promise;
        };
        Disposer.prototype.resource = function() {
          if (this.promise().isFulfilled()) {
            return this.promise().value();
          }
          return NULL;
        };
        Disposer.prototype.tryDispose = function(inspection) {
          var resource = this.resource();
          var context = this._context;
          if (context !== void 0) context._pushContext();
          var ret2 = resource !== NULL ? this.doDispose(resource, inspection) : null;
          if (context !== void 0) context._popContext();
          this._promise._unsetDisposable();
          this._data = null;
          return ret2;
        };
        Disposer.isDisposer = function(d) {
          return d != null && typeof d.resource === "function" && typeof d.tryDispose === "function";
        };
        function FunctionDisposer(fn, promise, context) {
          this.constructor$(fn, promise, context);
        }
        inherits2(FunctionDisposer, Disposer);
        FunctionDisposer.prototype.doDispose = function(resource, inspection) {
          var fn = this.data();
          return fn.call(resource, resource, inspection);
        };
        function maybeUnwrapDisposer(value) {
          if (Disposer.isDisposer(value)) {
            this.resources[this.index]._setDisposable(value);
            return value.promise();
          }
          return value;
        }
        function ResourceList(length) {
          this.length = length;
          this.promise = null;
          this[length - 1] = null;
        }
        ResourceList.prototype._resultCancelled = function() {
          var len = this.length;
          for (var i = 0; i < len; ++i) {
            var item = this[i];
            if (item instanceof Promise2) {
              item.cancel();
            }
          }
        };
        Promise2.using = function() {
          var len = arguments.length;
          if (len < 2) return apiRejection(
            "you must pass at least 2 arguments to Promise.using"
          );
          var fn = arguments[len - 1];
          if (typeof fn !== "function") {
            return apiRejection("expecting a function but got " + util.classString(fn));
          }
          var input;
          var spreadArgs = true;
          if (len === 2 && Array.isArray(arguments[0])) {
            input = arguments[0];
            len = input.length;
            spreadArgs = false;
          } else {
            input = arguments;
            len--;
          }
          var resources = new ResourceList(len);
          for (var i = 0; i < len; ++i) {
            var resource = input[i];
            if (Disposer.isDisposer(resource)) {
              var disposer = resource;
              resource = resource.promise();
              resource._setDisposable(disposer);
            } else {
              var maybePromise = tryConvertToPromise(resource);
              if (maybePromise instanceof Promise2) {
                resource = maybePromise._then(maybeUnwrapDisposer, null, null, {
                  resources,
                  index: i
                }, void 0);
              }
            }
            resources[i] = resource;
          }
          var reflectedResources = new Array(resources.length);
          for (var i = 0; i < reflectedResources.length; ++i) {
            reflectedResources[i] = Promise2.resolve(resources[i]).reflect();
          }
          var resultPromise = Promise2.all(reflectedResources).then(function(inspections) {
            for (var i2 = 0; i2 < inspections.length; ++i2) {
              var inspection = inspections[i2];
              if (inspection.isRejected()) {
                errorObj2.e = inspection.error();
                return errorObj2;
              } else if (!inspection.isFulfilled()) {
                resultPromise.cancel();
                return;
              }
              inspections[i2] = inspection.value();
            }
            promise._pushContext();
            fn = tryCatch2(fn);
            var ret2 = spreadArgs ? fn.apply(void 0, inspections) : fn(inspections);
            var promiseCreated = promise._popContext();
            debug.checkForgottenReturns(
              ret2,
              promiseCreated,
              "Promise.using",
              promise
            );
            return ret2;
          });
          var promise = resultPromise.lastly(function() {
            var inspection = new Promise2.PromiseInspection(resultPromise);
            return dispose(resources, inspection);
          });
          resources.promise = promise;
          promise._setOnCancel(resources);
          return promise;
        };
        Promise2.prototype._setDisposable = function(disposer) {
          this._bitField = this._bitField | 131072;
          this._disposer = disposer;
        };
        Promise2.prototype._isDisposable = function() {
          return (this._bitField & 131072) > 0;
        };
        Promise2.prototype._getDisposer = function() {
          return this._disposer;
        };
        Promise2.prototype._unsetDisposable = function() {
          this._bitField = this._bitField & ~131072;
          this._disposer = void 0;
        };
        Promise2.prototype.disposer = function(fn) {
          if (typeof fn === "function") {
            return new FunctionDisposer(fn, this, createContext());
          }
          throw new TypeError2();
        };
      };
    }
  });

  // node_modules/bluebird/js/release/timers.js
  var require_timers = __commonJS({
    "node_modules/bluebird/js/release/timers.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2, debug) {
        var util = require_util();
        var TimeoutError = Promise2.TimeoutError;
        function HandleWrapper(handle) {
          this.handle = handle;
        }
        HandleWrapper.prototype._resultCancelled = function() {
          clearTimeout(this.handle);
        };
        var afterValue = function(value) {
          return delay(+this).thenReturn(value);
        };
        var delay = Promise2.delay = function(ms, value) {
          var ret2;
          var handle;
          if (value !== void 0) {
            ret2 = Promise2.resolve(value)._then(afterValue, null, null, ms, void 0);
            if (debug.cancellation() && value instanceof Promise2) {
              ret2._setOnCancel(value);
            }
          } else {
            ret2 = new Promise2(INTERNAL2);
            handle = setTimeout(function() {
              ret2._fulfill();
            }, +ms);
            if (debug.cancellation()) {
              ret2._setOnCancel(new HandleWrapper(handle));
            }
            ret2._captureStackTrace();
          }
          ret2._setAsyncGuaranteed();
          return ret2;
        };
        Promise2.prototype.delay = function(ms) {
          return delay(ms, this);
        };
        var afterTimeout = function(promise, message, parent) {
          var err;
          if (typeof message !== "string") {
            if (message instanceof Error) {
              err = message;
            } else {
              err = new TimeoutError("operation timed out");
            }
          } else {
            err = new TimeoutError(message);
          }
          util.markAsOriginatingFromRejection(err);
          promise._attachExtraTrace(err);
          promise._reject(err);
          if (parent != null) {
            parent.cancel();
          }
        };
        function successClear(value) {
          clearTimeout(this.handle);
          return value;
        }
        function failureClear(reason) {
          clearTimeout(this.handle);
          throw reason;
        }
        Promise2.prototype.timeout = function(ms, message) {
          ms = +ms;
          var ret2, parent;
          var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
            if (ret2.isPending()) {
              afterTimeout(ret2, message, parent);
            }
          }, ms));
          if (debug.cancellation()) {
            parent = this.then();
            ret2 = parent._then(
              successClear,
              failureClear,
              void 0,
              handleWrapper,
              void 0
            );
            ret2._setOnCancel(handleWrapper);
          } else {
            ret2 = this._then(
              successClear,
              failureClear,
              void 0,
              handleWrapper,
              void 0
            );
          }
          return ret2;
        };
      };
    }
  });

  // node_modules/bluebird/js/release/generators.js
  var require_generators = __commonJS({
    "node_modules/bluebird/js/release/generators.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, apiRejection, INTERNAL2, tryConvertToPromise, Proxyable, debug) {
        var errors = require_errors();
        var TypeError2 = errors.TypeError;
        var util = require_util();
        var errorObj2 = util.errorObj;
        var tryCatch2 = util.tryCatch;
        var yieldHandlers = [];
        function promiseFromYieldHandler(value, yieldHandlers2, traceParent) {
          for (var i = 0; i < yieldHandlers2.length; ++i) {
            traceParent._pushContext();
            var result2 = tryCatch2(yieldHandlers2[i])(value);
            traceParent._popContext();
            if (result2 === errorObj2) {
              traceParent._pushContext();
              var ret2 = Promise2.reject(errorObj2.e);
              traceParent._popContext();
              return ret2;
            }
            var maybePromise = tryConvertToPromise(result2, traceParent);
            if (maybePromise instanceof Promise2) return maybePromise;
          }
          return null;
        }
        function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
          if (debug.cancellation()) {
            var internal = new Promise2(INTERNAL2);
            var _finallyPromise = this._finallyPromise = new Promise2(INTERNAL2);
            this._promise = internal.lastly(function() {
              return _finallyPromise;
            });
            internal._captureStackTrace();
            internal._setOnCancel(this);
          } else {
            var promise = this._promise = new Promise2(INTERNAL2);
            promise._captureStackTrace();
          }
          this._stack = stack;
          this._generatorFunction = generatorFunction;
          this._receiver = receiver;
          this._generator = void 0;
          this._yieldHandlers = typeof yieldHandler === "function" ? [yieldHandler].concat(yieldHandlers) : yieldHandlers;
          this._yieldedPromise = null;
          this._cancellationPhase = false;
        }
        util.inherits(PromiseSpawn, Proxyable);
        PromiseSpawn.prototype._isResolved = function() {
          return this._promise === null;
        };
        PromiseSpawn.prototype._cleanup = function() {
          this._promise = this._generator = null;
          if (debug.cancellation() && this._finallyPromise !== null) {
            this._finallyPromise._fulfill();
            this._finallyPromise = null;
          }
        };
        PromiseSpawn.prototype._promiseCancelled = function() {
          if (this._isResolved()) return;
          var implementsReturn = typeof this._generator["return"] !== "undefined";
          var result2;
          if (!implementsReturn) {
            var reason = new Promise2.CancellationError(
              "generator .return() sentinel"
            );
            Promise2.coroutine.returnSentinel = reason;
            this._promise._attachExtraTrace(reason);
            this._promise._pushContext();
            result2 = tryCatch2(this._generator["throw"]).call(
              this._generator,
              reason
            );
            this._promise._popContext();
          } else {
            this._promise._pushContext();
            result2 = tryCatch2(this._generator["return"]).call(
              this._generator,
              void 0
            );
            this._promise._popContext();
          }
          this._cancellationPhase = true;
          this._yieldedPromise = null;
          this._continue(result2);
        };
        PromiseSpawn.prototype._promiseFulfilled = function(value) {
          this._yieldedPromise = null;
          this._promise._pushContext();
          var result2 = tryCatch2(this._generator.next).call(this._generator, value);
          this._promise._popContext();
          this._continue(result2);
        };
        PromiseSpawn.prototype._promiseRejected = function(reason) {
          this._yieldedPromise = null;
          this._promise._attachExtraTrace(reason);
          this._promise._pushContext();
          var result2 = tryCatch2(this._generator["throw"]).call(this._generator, reason);
          this._promise._popContext();
          this._continue(result2);
        };
        PromiseSpawn.prototype._resultCancelled = function() {
          if (this._yieldedPromise instanceof Promise2) {
            var promise = this._yieldedPromise;
            this._yieldedPromise = null;
            promise.cancel();
          }
        };
        PromiseSpawn.prototype.promise = function() {
          return this._promise;
        };
        PromiseSpawn.prototype._run = function() {
          this._generator = this._generatorFunction.call(this._receiver);
          this._receiver = this._generatorFunction = void 0;
          this._promiseFulfilled(void 0);
        };
        PromiseSpawn.prototype._continue = function(result2) {
          var promise = this._promise;
          if (result2 === errorObj2) {
            this._cleanup();
            if (this._cancellationPhase) {
              return promise.cancel();
            } else {
              return promise._rejectCallback(result2.e, false);
            }
          }
          var value = result2.value;
          if (result2.done === true) {
            this._cleanup();
            if (this._cancellationPhase) {
              return promise.cancel();
            } else {
              return promise._resolveCallback(value);
            }
          } else {
            var maybePromise = tryConvertToPromise(value, this._promise);
            if (!(maybePromise instanceof Promise2)) {
              maybePromise = promiseFromYieldHandler(
                maybePromise,
                this._yieldHandlers,
                this._promise
              );
              if (maybePromise === null) {
                this._promiseRejected(
                  new TypeError2(
                    "A value %s was yielded that could not be treated as a promise\n\n    See http://goo.gl/MqrFmX\n\n".replace("%s", value) + "From coroutine:\n" + this._stack.split("\n").slice(1, -7).join("\n")
                  )
                );
                return;
              }
            }
            maybePromise = maybePromise._target();
            var bitField = maybePromise._bitField;
            ;
            if ((bitField & 50397184) === 0) {
              this._yieldedPromise = maybePromise;
              maybePromise._proxy(this, null);
            } else if ((bitField & 33554432) !== 0) {
              Promise2._async.invoke(
                this._promiseFulfilled,
                this,
                maybePromise._value()
              );
            } else if ((bitField & 16777216) !== 0) {
              Promise2._async.invoke(
                this._promiseRejected,
                this,
                maybePromise._reason()
              );
            } else {
              this._promiseCancelled();
            }
          }
        };
        Promise2.coroutine = function(generatorFunction, options) {
          if (typeof generatorFunction !== "function") {
            throw new TypeError2("generatorFunction must be a function\n\n    See http://goo.gl/MqrFmX\n");
          }
          var yieldHandler = Object(options).yieldHandler;
          var PromiseSpawn$ = PromiseSpawn;
          var stack = new Error().stack;
          return function() {
            var generator = generatorFunction.apply(this, arguments);
            var spawn = new PromiseSpawn$(
              void 0,
              void 0,
              yieldHandler,
              stack
            );
            var ret2 = spawn.promise();
            spawn._generator = generator;
            spawn._promiseFulfilled(void 0);
            return ret2;
          };
        };
        Promise2.coroutine.addYieldHandler = function(fn) {
          if (typeof fn !== "function") {
            throw new TypeError2("expecting a function but got " + util.classString(fn));
          }
          yieldHandlers.push(fn);
        };
        Promise2.spawn = function(generatorFunction) {
          debug.deprecated("Promise.spawn()", "Promise.coroutine()");
          if (typeof generatorFunction !== "function") {
            return apiRejection("generatorFunction must be a function\n\n    See http://goo.gl/MqrFmX\n");
          }
          var spawn = new PromiseSpawn(generatorFunction, this);
          var ret2 = spawn.promise();
          spawn._run(Promise2.spawn);
          return ret2;
        };
      };
    }
  });

  // node_modules/bluebird/js/release/nodeify.js
  var require_nodeify = __commonJS({
    "node_modules/bluebird/js/release/nodeify.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2) {
        var util = require_util();
        var async = Promise2._async;
        var tryCatch2 = util.tryCatch;
        var errorObj2 = util.errorObj;
        function spreadAdapter(val, nodeback) {
          var promise = this;
          if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
          var ret2 = tryCatch2(nodeback).apply(promise._boundValue(), [null].concat(val));
          if (ret2 === errorObj2) {
            async.throwLater(ret2.e);
          }
        }
        function successAdapter(val, nodeback) {
          var promise = this;
          var receiver = promise._boundValue();
          var ret2 = val === void 0 ? tryCatch2(nodeback).call(receiver, null) : tryCatch2(nodeback).call(receiver, null, val);
          if (ret2 === errorObj2) {
            async.throwLater(ret2.e);
          }
        }
        function errorAdapter(reason, nodeback) {
          var promise = this;
          if (!reason) {
            var newReason = new Error(reason + "");
            newReason.cause = reason;
            reason = newReason;
          }
          var ret2 = tryCatch2(nodeback).call(promise._boundValue(), reason);
          if (ret2 === errorObj2) {
            async.throwLater(ret2.e);
          }
        }
        Promise2.prototype.asCallback = Promise2.prototype.nodeify = function(nodeback, options) {
          if (typeof nodeback == "function") {
            var adapter = successAdapter;
            if (options !== void 0 && Object(options).spread) {
              adapter = spreadAdapter;
            }
            this._then(
              adapter,
              errorAdapter,
              void 0,
              this,
              nodeback
            );
          }
          return this;
        };
      };
    }
  });

  // node_modules/bluebird/js/release/promisify.js
  var require_promisify = __commonJS({
    "node_modules/bluebird/js/release/promisify.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2) {
        var THIS = {};
        var util = require_util();
        var nodebackForPromise = require_nodeback();
        var withAppended2 = util.withAppended;
        var maybeWrapAsError2 = util.maybeWrapAsError;
        var canEvaluate2 = util.canEvaluate;
        var TypeError2 = require_errors().TypeError;
        var defaultSuffix = "Async";
        var defaultPromisified = { __isPromisified__: true };
        var noCopyProps = [
          "arity",
          "length",
          "name",
          "arguments",
          "caller",
          "callee",
          "prototype",
          "__isPromisified__"
        ];
        var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
        var defaultFilter = function(name) {
          return util.isIdentifier(name) && name.charAt(0) !== "_" && name !== "constructor";
        };
        function propsFilter(key) {
          return !noCopyPropsPattern.test(key);
        }
        function isPromisified(fn) {
          try {
            return fn.__isPromisified__ === true;
          } catch (e) {
            return false;
          }
        }
        function hasPromisified(obj2, key, suffix) {
          var val = util.getDataPropertyOrDefault(
            obj2,
            key + suffix,
            defaultPromisified
          );
          return val ? isPromisified(val) : false;
        }
        function checkValid(ret2, suffix, suffixRegexp) {
          for (var i = 0; i < ret2.length; i += 2) {
            var key = ret2[i];
            if (suffixRegexp.test(key)) {
              var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
              for (var j = 0; j < ret2.length; j += 2) {
                if (ret2[j] === keyWithoutAsyncSuffix) {
                  throw new TypeError2("Cannot promisify an API that has normal methods with '%s'-suffix\n\n    See http://goo.gl/MqrFmX\n".replace("%s", suffix));
                }
              }
            }
          }
        }
        function promisifiableMethods(obj2, suffix, suffixRegexp, filter2) {
          var keys3 = util.inheritedDataKeys(obj2);
          var ret2 = [];
          for (var i = 0; i < keys3.length; ++i) {
            var key = keys3[i];
            var value = obj2[key];
            var passesDefaultFilter = filter2 === defaultFilter ? true : defaultFilter(key, value, obj2);
            if (typeof value === "function" && !isPromisified(value) && !hasPromisified(obj2, key, suffix) && filter2(key, value, obj2, passesDefaultFilter)) {
              ret2.push(key, value);
            }
          }
          checkValid(ret2, suffix, suffixRegexp);
          return ret2;
        }
        var escapeIdentRegex = function(str) {
          return str.replace(/([$])/, "\\$");
        };
        var makeNodePromisifiedEval;
        if (true) {
          var switchCaseArgumentOrder = function(likelyArgumentCount) {
            var ret2 = [likelyArgumentCount];
            var min2 = Math.max(0, likelyArgumentCount - 1 - 3);
            for (var i = likelyArgumentCount - 1; i >= min2; --i) {
              ret2.push(i);
            }
            for (var i = likelyArgumentCount + 1; i <= 3; ++i) {
              ret2.push(i);
            }
            return ret2;
          };
          var argumentSequence = function(argumentCount) {
            return util.filledRange(argumentCount, "_arg", "");
          };
          var parameterDeclaration = function(parameterCount2) {
            return util.filledRange(
              Math.max(parameterCount2, 3),
              "_arg",
              ""
            );
          };
          var parameterCount = function(fn) {
            if (typeof fn.length === "number") {
              return Math.max(Math.min(fn.length, 1023 + 1), 0);
            }
            return 0;
          };
          makeNodePromisifiedEval = function(callback, receiver, originalName, fn, _3, multiArgs) {
            var newParameterCount = Math.max(0, parameterCount(fn) - 1);
            var argumentOrder = switchCaseArgumentOrder(newParameterCount);
            var shouldProxyThis = typeof callback === "string" || receiver === THIS;
            function generateCallForArgumentCount(count) {
              var args = argumentSequence(count).join(", ");
              var comma = count > 0 ? ", " : "";
              var ret2;
              if (shouldProxyThis) {
                ret2 = "ret = callback.call(this, {{args}}, nodeback); break;\n";
              } else {
                ret2 = receiver === void 0 ? "ret = callback({{args}}, nodeback); break;\n" : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
              }
              return ret2.replace("{{args}}", args).replace(", ", comma);
            }
            function generateArgumentSwitchCase() {
              var ret2 = "";
              for (var i = 0; i < argumentOrder.length; ++i) {
                ret2 += "case " + argumentOrder[i] + ":" + generateCallForArgumentCount(argumentOrder[i]);
              }
              ret2 += "                                                             \n        default:                                                             \n            var args = new Array(len + 1);                                   \n            var i = 0;                                                       \n            for (var i = 0; i < len; ++i) {                                  \n               args[i] = arguments[i];                                       \n            }                                                                \n            args[i] = nodeback;                                              \n            [CodeForCall]                                                    \n            break;                                                           \n        ".replace("[CodeForCall]", shouldProxyThis ? "ret = callback.apply(this, args);\n" : "ret = callback.apply(receiver, args);\n");
              return ret2;
            }
            var getFunctionCode = typeof callback === "string" ? "this != null ? this['" + callback + "'] : fn" : "fn";
            var body = "'use strict';                                                \n        var ret = function (Parameters) {                                    \n            'use strict';                                                    \n            var len = arguments.length;                                      \n            var promise = new Promise(INTERNAL);                             \n            promise._captureStackTrace();                                    \n            var nodeback = nodebackForPromise(promise, " + multiArgs + ");   \n            var ret;                                                         \n            var callback = tryCatch([GetFunctionCode]);                      \n            switch(len) {                                                    \n                [CodeForSwitchCase]                                          \n            }                                                                \n            if (ret === errorObj) {                                          \n                promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n            }                                                                \n            if (!promise._isFateSealed()) promise._setAsyncGuaranteed();     \n            return promise;                                                  \n        };                                                                   \n        notEnumerableProp(ret, '__isPromisified__', true);                   \n        return ret;                                                          \n    ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()).replace("[GetFunctionCode]", getFunctionCode);
            body = body.replace("Parameters", parameterDeclaration(newParameterCount));
            return new Function(
              "Promise",
              "fn",
              "receiver",
              "withAppended",
              "maybeWrapAsError",
              "nodebackForPromise",
              "tryCatch",
              "errorObj",
              "notEnumerableProp",
              "INTERNAL",
              body
            )(
              Promise2,
              fn,
              receiver,
              withAppended2,
              maybeWrapAsError2,
              nodebackForPromise,
              util.tryCatch,
              util.errorObj,
              util.notEnumerableProp,
              INTERNAL2
            );
          };
        }
        function makeNodePromisifiedClosure(callback, receiver, _3, fn, __, multiArgs) {
          var defaultThis = /* @__PURE__ */ (function() {
            return this;
          })();
          var method = callback;
          if (typeof method === "string") {
            callback = fn;
          }
          function promisified() {
            var _receiver = receiver;
            if (receiver === THIS) _receiver = this;
            var promise = new Promise2(INTERNAL2);
            promise._captureStackTrace();
            var cb2 = typeof method === "string" && this !== defaultThis ? this[method] : callback;
            var fn2 = nodebackForPromise(promise, multiArgs);
            try {
              cb2.apply(_receiver, withAppended2(arguments, fn2));
            } catch (e) {
              promise._rejectCallback(maybeWrapAsError2(e), true, true);
            }
            if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
            return promise;
          }
          util.notEnumerableProp(promisified, "__isPromisified__", true);
          return promisified;
        }
        var makeNodePromisified = canEvaluate2 ? makeNodePromisifiedEval : makeNodePromisifiedClosure;
        function promisifyAll(obj2, suffix, filter2, promisifier, multiArgs) {
          var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
          var methods = promisifiableMethods(obj2, suffix, suffixRegexp, filter2);
          for (var i = 0, len = methods.length; i < len; i += 2) {
            var key = methods[i];
            var fn = methods[i + 1];
            var promisifiedKey = key + suffix;
            if (promisifier === makeNodePromisified) {
              obj2[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
            } else {
              var promisified = promisifier(fn, function() {
                return makeNodePromisified(
                  key,
                  THIS,
                  key,
                  fn,
                  suffix,
                  multiArgs
                );
              });
              util.notEnumerableProp(promisified, "__isPromisified__", true);
              obj2[promisifiedKey] = promisified;
            }
          }
          util.toFastProperties(obj2);
          return obj2;
        }
        function promisify(callback, receiver, multiArgs) {
          return makeNodePromisified(
            callback,
            receiver,
            void 0,
            callback,
            null,
            multiArgs
          );
        }
        Promise2.promisify = function(fn, options) {
          if (typeof fn !== "function") {
            throw new TypeError2("expecting a function but got " + util.classString(fn));
          }
          if (isPromisified(fn)) {
            return fn;
          }
          options = Object(options);
          var receiver = options.context === void 0 ? THIS : options.context;
          var multiArgs = !!options.multiArgs;
          var ret2 = promisify(fn, receiver, multiArgs);
          util.copyDescriptors(fn, ret2, propsFilter);
          return ret2;
        };
        Promise2.promisifyAll = function(target, options) {
          if (typeof target !== "function" && typeof target !== "object") {
            throw new TypeError2("the target of promisifyAll must be an object or a function\n\n    See http://goo.gl/MqrFmX\n");
          }
          options = Object(options);
          var multiArgs = !!options.multiArgs;
          var suffix = options.suffix;
          if (typeof suffix !== "string") suffix = defaultSuffix;
          var filter2 = options.filter;
          if (typeof filter2 !== "function") filter2 = defaultFilter;
          var promisifier = options.promisifier;
          if (typeof promisifier !== "function") promisifier = makeNodePromisified;
          if (!util.isIdentifier(suffix)) {
            throw new RangeError("suffix must be a valid identifier\n\n    See http://goo.gl/MqrFmX\n");
          }
          var keys3 = util.inheritedDataKeys(target);
          for (var i = 0; i < keys3.length; ++i) {
            var value = target[keys3[i]];
            if (keys3[i] !== "constructor" && util.isClass(value)) {
              promisifyAll(
                value.prototype,
                suffix,
                filter2,
                promisifier,
                multiArgs
              );
              promisifyAll(value, suffix, filter2, promisifier, multiArgs);
            }
          }
          return promisifyAll(target, suffix, filter2, promisifier, multiArgs);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/props.js
  var require_props = __commonJS({
    "node_modules/bluebird/js/release/props.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, apiRejection) {
        var util = require_util();
        var isObject3 = util.isObject;
        var es52 = require_es5();
        var Es6Map;
        if (typeof Map === "function") Es6Map = Map;
        var mapToEntries = /* @__PURE__ */ (function() {
          var index = 0;
          var size2 = 0;
          function extractEntry(value, key) {
            this[index] = value;
            this[index + size2] = key;
            index++;
          }
          return function mapToEntries2(map2) {
            size2 = map2.size;
            index = 0;
            var ret2 = new Array(map2.size * 2);
            map2.forEach(extractEntry, ret2);
            return ret2;
          };
        })();
        var entriesToMap = function(entries) {
          var ret2 = new Es6Map();
          var length = entries.length / 2 | 0;
          for (var i = 0; i < length; ++i) {
            var key = entries[length + i];
            var value = entries[i];
            ret2.set(key, value);
          }
          return ret2;
        };
        function PropertiesPromiseArray(obj2) {
          var isMap = false;
          var entries;
          if (Es6Map !== void 0 && obj2 instanceof Es6Map) {
            entries = mapToEntries(obj2);
            isMap = true;
          } else {
            var keys3 = es52.keys(obj2);
            var len = keys3.length;
            entries = new Array(len * 2);
            for (var i = 0; i < len; ++i) {
              var key = keys3[i];
              entries[i] = obj2[key];
              entries[i + len] = key;
            }
          }
          this.constructor$(entries);
          this._isMap = isMap;
          this._init$(void 0, -3);
        }
        util.inherits(PropertiesPromiseArray, PromiseArray);
        PropertiesPromiseArray.prototype._init = function() {
        };
        PropertiesPromiseArray.prototype._promiseFulfilled = function(value, index) {
          this._values[index] = value;
          var totalResolved = ++this._totalResolved;
          if (totalResolved >= this._length) {
            var val;
            if (this._isMap) {
              val = entriesToMap(this._values);
            } else {
              val = {};
              var keyOffset = this.length();
              for (var i = 0, len = this.length(); i < len; ++i) {
                val[this._values[i + keyOffset]] = this._values[i];
              }
            }
            this._resolve(val);
            return true;
          }
          return false;
        };
        PropertiesPromiseArray.prototype.shouldCopyValues = function() {
          return false;
        };
        PropertiesPromiseArray.prototype.getActualLength = function(len) {
          return len >> 1;
        };
        function props(promises) {
          var ret2;
          var castValue = tryConvertToPromise(promises);
          if (!isObject3(castValue)) {
            return apiRejection("cannot await properties of a non-object\n\n    See http://goo.gl/MqrFmX\n");
          } else if (castValue instanceof Promise2) {
            ret2 = castValue._then(
              Promise2.props,
              void 0,
              void 0,
              void 0,
              void 0
            );
          } else {
            ret2 = new PropertiesPromiseArray(castValue).promise();
          }
          if (castValue instanceof Promise2) {
            ret2._propagateFrom(castValue, 2);
          }
          return ret2;
        }
        Promise2.prototype.props = function() {
          return props(this);
        };
        Promise2.props = function(promises) {
          return props(promises);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/race.js
  var require_race = __commonJS({
    "node_modules/bluebird/js/release/race.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, apiRejection) {
        var util = require_util();
        var raceLater = function(promise) {
          return promise.then(function(array) {
            return race(array, promise);
          });
        };
        function race(promises, parent) {
          var maybePromise = tryConvertToPromise(promises);
          if (maybePromise instanceof Promise2) {
            return raceLater(maybePromise);
          } else {
            promises = util.asArray(promises);
            if (promises === null)
              return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
          }
          var ret2 = new Promise2(INTERNAL2);
          if (parent !== void 0) {
            ret2._propagateFrom(parent, 3);
          }
          var fulfill = ret2._fulfill;
          var reject2 = ret2._reject;
          for (var i = 0, len = promises.length; i < len; ++i) {
            var val = promises[i];
            if (val === void 0 && !(i in promises)) {
              continue;
            }
            Promise2.cast(val)._then(fulfill, reject2, void 0, ret2, null);
          }
          return ret2;
        }
        Promise2.race = function(promises) {
          return race(promises, void 0);
        };
        Promise2.prototype.race = function() {
          return race(this, void 0);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/reduce.js
  var require_reduce = __commonJS({
    "node_modules/bluebird/js/release/reduce.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug) {
        var getDomain = Promise2._getDomain;
        var util = require_util();
        var tryCatch2 = util.tryCatch;
        function ReductionPromiseArray(promises, fn, initialValue, _each) {
          this.constructor$(promises);
          var domain = getDomain();
          this._fn = domain === null ? fn : util.domainBind(domain, fn);
          if (initialValue !== void 0) {
            initialValue = Promise2.resolve(initialValue);
            initialValue._attachCancellationCallback(this);
          }
          this._initialValue = initialValue;
          this._currentCancellable = null;
          if (_each === INTERNAL2) {
            this._eachValues = Array(this._length);
          } else if (_each === 0) {
            this._eachValues = null;
          } else {
            this._eachValues = void 0;
          }
          this._promise._captureStackTrace();
          this._init$(void 0, -5);
        }
        util.inherits(ReductionPromiseArray, PromiseArray);
        ReductionPromiseArray.prototype._gotAccum = function(accum) {
          if (this._eachValues !== void 0 && this._eachValues !== null && accum !== INTERNAL2) {
            this._eachValues.push(accum);
          }
        };
        ReductionPromiseArray.prototype._eachComplete = function(value) {
          if (this._eachValues !== null) {
            this._eachValues.push(value);
          }
          return this._eachValues;
        };
        ReductionPromiseArray.prototype._init = function() {
        };
        ReductionPromiseArray.prototype._resolveEmptyArray = function() {
          this._resolve(this._eachValues !== void 0 ? this._eachValues : this._initialValue);
        };
        ReductionPromiseArray.prototype.shouldCopyValues = function() {
          return false;
        };
        ReductionPromiseArray.prototype._resolve = function(value) {
          this._promise._resolveCallback(value);
          this._values = null;
        };
        ReductionPromiseArray.prototype._resultCancelled = function(sender) {
          if (sender === this._initialValue) return this._cancel();
          if (this._isResolved()) return;
          this._resultCancelled$();
          if (this._currentCancellable instanceof Promise2) {
            this._currentCancellable.cancel();
          }
          if (this._initialValue instanceof Promise2) {
            this._initialValue.cancel();
          }
        };
        ReductionPromiseArray.prototype._iterate = function(values2) {
          this._values = values2;
          var value;
          var i;
          var length = values2.length;
          if (this._initialValue !== void 0) {
            value = this._initialValue;
            i = 0;
          } else {
            value = Promise2.resolve(values2[0]);
            i = 1;
          }
          this._currentCancellable = value;
          if (!value.isRejected()) {
            for (; i < length; ++i) {
              var ctx = {
                accum: null,
                value: values2[i],
                index: i,
                length,
                array: this
              };
              value = value._then(gotAccum, void 0, void 0, ctx, void 0);
            }
          }
          if (this._eachValues !== void 0) {
            value = value._then(this._eachComplete, void 0, void 0, this, void 0);
          }
          value._then(completed, completed, void 0, value, this);
        };
        Promise2.prototype.reduce = function(fn, initialValue) {
          return reduce2(this, fn, initialValue, null);
        };
        Promise2.reduce = function(promises, fn, initialValue, _each) {
          return reduce2(promises, fn, initialValue, _each);
        };
        function completed(valueOrReason, array) {
          if (this.isFulfilled()) {
            array._resolve(valueOrReason);
          } else {
            array._reject(valueOrReason);
          }
        }
        function reduce2(promises, fn, initialValue, _each) {
          if (typeof fn !== "function") {
            return apiRejection("expecting a function but got " + util.classString(fn));
          }
          var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
          return array.promise();
        }
        function gotAccum(accum) {
          this.accum = accum;
          this.array._gotAccum(accum);
          var value = tryConvertToPromise(this.value, this.array._promise);
          if (value instanceof Promise2) {
            this.array._currentCancellable = value;
            return value._then(gotValue, void 0, void 0, this, void 0);
          } else {
            return gotValue.call(this, value);
          }
        }
        function gotValue(value) {
          var array = this.array;
          var promise = array._promise;
          var fn = tryCatch2(array._fn);
          promise._pushContext();
          var ret2;
          if (array._eachValues !== void 0) {
            ret2 = fn.call(promise._boundValue(), value, this.index, this.length);
          } else {
            ret2 = fn.call(
              promise._boundValue(),
              this.accum,
              value,
              this.index,
              this.length
            );
          }
          if (ret2 instanceof Promise2) {
            array._currentCancellable = ret2;
          }
          var promiseCreated = promise._popContext();
          debug.checkForgottenReturns(
            ret2,
            promiseCreated,
            array._eachValues !== void 0 ? "Promise.each" : "Promise.reduce",
            promise
          );
          return ret2;
        }
      };
    }
  });

  // node_modules/bluebird/js/release/settle.js
  var require_settle = __commonJS({
    "node_modules/bluebird/js/release/settle.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, PromiseArray, debug) {
        var PromiseInspection = Promise2.PromiseInspection;
        var util = require_util();
        function SettledPromiseArray(values2) {
          this.constructor$(values2);
        }
        util.inherits(SettledPromiseArray, PromiseArray);
        SettledPromiseArray.prototype._promiseResolved = function(index, inspection) {
          this._values[index] = inspection;
          var totalResolved = ++this._totalResolved;
          if (totalResolved >= this._length) {
            this._resolve(this._values);
            return true;
          }
          return false;
        };
        SettledPromiseArray.prototype._promiseFulfilled = function(value, index) {
          var ret2 = new PromiseInspection();
          ret2._bitField = 33554432;
          ret2._settledValueField = value;
          return this._promiseResolved(index, ret2);
        };
        SettledPromiseArray.prototype._promiseRejected = function(reason, index) {
          var ret2 = new PromiseInspection();
          ret2._bitField = 16777216;
          ret2._settledValueField = reason;
          return this._promiseResolved(index, ret2);
        };
        Promise2.settle = function(promises) {
          debug.deprecated(".settle()", ".reflect()");
          return new SettledPromiseArray(promises).promise();
        };
        Promise2.prototype.settle = function() {
          return Promise2.settle(this);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/some.js
  var require_some = __commonJS({
    "node_modules/bluebird/js/release/some.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, PromiseArray, apiRejection) {
        var util = require_util();
        var RangeError2 = require_errors().RangeError;
        var AggregateError = require_errors().AggregateError;
        var isArray = util.isArray;
        var CANCELLATION = {};
        function SomePromiseArray(values2) {
          this.constructor$(values2);
          this._howMany = 0;
          this._unwrap = false;
          this._initialized = false;
        }
        util.inherits(SomePromiseArray, PromiseArray);
        SomePromiseArray.prototype._init = function() {
          if (!this._initialized) {
            return;
          }
          if (this._howMany === 0) {
            this._resolve([]);
            return;
          }
          this._init$(void 0, -5);
          var isArrayResolved = isArray(this._values);
          if (!this._isResolved() && isArrayResolved && this._howMany > this._canPossiblyFulfill()) {
            this._reject(this._getRangeError(this.length()));
          }
        };
        SomePromiseArray.prototype.init = function() {
          this._initialized = true;
          this._init();
        };
        SomePromiseArray.prototype.setUnwrap = function() {
          this._unwrap = true;
        };
        SomePromiseArray.prototype.howMany = function() {
          return this._howMany;
        };
        SomePromiseArray.prototype.setHowMany = function(count) {
          this._howMany = count;
        };
        SomePromiseArray.prototype._promiseFulfilled = function(value) {
          this._addFulfilled(value);
          if (this._fulfilled() === this.howMany()) {
            this._values.length = this.howMany();
            if (this.howMany() === 1 && this._unwrap) {
              this._resolve(this._values[0]);
            } else {
              this._resolve(this._values);
            }
            return true;
          }
          return false;
        };
        SomePromiseArray.prototype._promiseRejected = function(reason) {
          this._addRejected(reason);
          return this._checkOutcome();
        };
        SomePromiseArray.prototype._promiseCancelled = function() {
          if (this._values instanceof Promise2 || this._values == null) {
            return this._cancel();
          }
          this._addRejected(CANCELLATION);
          return this._checkOutcome();
        };
        SomePromiseArray.prototype._checkOutcome = function() {
          if (this.howMany() > this._canPossiblyFulfill()) {
            var e = new AggregateError();
            for (var i = this.length(); i < this._values.length; ++i) {
              if (this._values[i] !== CANCELLATION) {
                e.push(this._values[i]);
              }
            }
            if (e.length > 0) {
              this._reject(e);
            } else {
              this._cancel();
            }
            return true;
          }
          return false;
        };
        SomePromiseArray.prototype._fulfilled = function() {
          return this._totalResolved;
        };
        SomePromiseArray.prototype._rejected = function() {
          return this._values.length - this.length();
        };
        SomePromiseArray.prototype._addRejected = function(reason) {
          this._values.push(reason);
        };
        SomePromiseArray.prototype._addFulfilled = function(value) {
          this._values[this._totalResolved++] = value;
        };
        SomePromiseArray.prototype._canPossiblyFulfill = function() {
          return this.length() - this._rejected();
        };
        SomePromiseArray.prototype._getRangeError = function(count) {
          var message = "Input array must contain at least " + this._howMany + " items but contains only " + count + " items";
          return new RangeError2(message);
        };
        SomePromiseArray.prototype._resolveEmptyArray = function() {
          this._reject(this._getRangeError(0));
        };
        function some2(promises, howMany) {
          if ((howMany | 0) !== howMany || howMany < 0) {
            return apiRejection("expecting a positive integer\n\n    See http://goo.gl/MqrFmX\n");
          }
          var ret2 = new SomePromiseArray(promises);
          var promise = ret2.promise();
          ret2.setHowMany(howMany);
          ret2.init();
          return promise;
        }
        Promise2.some = function(promises, howMany) {
          return some2(promises, howMany);
        };
        Promise2.prototype.some = function(howMany) {
          return some2(this, howMany);
        };
        Promise2._SomePromiseArray = SomePromiseArray;
      };
    }
  });

  // node_modules/bluebird/js/release/filter.js
  var require_filter = __commonJS({
    "node_modules/bluebird/js/release/filter.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2) {
        var PromiseMap = Promise2.map;
        Promise2.prototype.filter = function(fn, options) {
          return PromiseMap(this, fn, options, INTERNAL2);
        };
        Promise2.filter = function(promises, fn, options) {
          return PromiseMap(promises, fn, options, INTERNAL2);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/each.js
  var require_each = __commonJS({
    "node_modules/bluebird/js/release/each.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2, INTERNAL2) {
        var PromiseReduce = Promise2.reduce;
        var PromiseAll = Promise2.all;
        function promiseAllThis() {
          return PromiseAll(this);
        }
        function PromiseMapSeries(promises, fn) {
          return PromiseReduce(promises, fn, INTERNAL2, INTERNAL2);
        }
        Promise2.prototype.each = function(fn) {
          return PromiseReduce(this, fn, INTERNAL2, 0)._then(promiseAllThis, void 0, void 0, this, void 0);
        };
        Promise2.prototype.mapSeries = function(fn) {
          return PromiseReduce(this, fn, INTERNAL2, INTERNAL2);
        };
        Promise2.each = function(promises, fn) {
          return PromiseReduce(promises, fn, INTERNAL2, 0)._then(promiseAllThis, void 0, void 0, promises, void 0);
        };
        Promise2.mapSeries = PromiseMapSeries;
      };
    }
  });

  // node_modules/bluebird/js/release/any.js
  var require_any = __commonJS({
    "node_modules/bluebird/js/release/any.js"(exports2, module2) {
      "use strict";
      module2.exports = function(Promise2) {
        var SomePromiseArray = Promise2._SomePromiseArray;
        function any(promises) {
          var ret2 = new SomePromiseArray(promises);
          var promise = ret2.promise();
          ret2.setHowMany(1);
          ret2.setUnwrap();
          ret2.init();
          return promise;
        }
        Promise2.any = function(promises) {
          return any(promises);
        };
        Promise2.prototype.any = function() {
          return any(this);
        };
      };
    }
  });

  // node_modules/bluebird/js/release/promise.js
  var require_promise = __commonJS({
    "node_modules/bluebird/js/release/promise.js"(exports2, module2) {
      "use strict";
      module2.exports = function() {
        var makeSelfResolutionError = function() {
          return new TypeError2("circular promise resolution chain\n\n    See http://goo.gl/MqrFmX\n");
        };
        var reflectHandler = function() {
          return new Promise2.PromiseInspection(this._target());
        };
        var apiRejection = function(msg) {
          return Promise2.reject(new TypeError2(msg));
        };
        function Proxyable() {
        }
        var UNDEFINED_BINDING = {};
        var util = require_util();
        var getDomain;
        if (util.isNode) {
          getDomain = function() {
            var ret2 = process.domain;
            if (ret2 === void 0) ret2 = null;
            return ret2;
          };
        } else {
          getDomain = function() {
            return null;
          };
        }
        util.notEnumerableProp(Promise2, "_getDomain", getDomain);
        var es52 = require_es5();
        var Async = require_async();
        var async = new Async();
        es52.defineProperty(Promise2, "_async", { value: async });
        var errors = require_errors();
        var TypeError2 = Promise2.TypeError = errors.TypeError;
        Promise2.RangeError = errors.RangeError;
        var CancellationError = Promise2.CancellationError = errors.CancellationError;
        Promise2.TimeoutError = errors.TimeoutError;
        Promise2.OperationalError = errors.OperationalError;
        Promise2.RejectionError = errors.OperationalError;
        Promise2.AggregateError = errors.AggregateError;
        var INTERNAL2 = function() {
        };
        var APPLY = {};
        var NEXT_FILTER = {};
        var tryConvertToPromise = require_thenables()(Promise2, INTERNAL2);
        var PromiseArray = require_promise_array()(
          Promise2,
          INTERNAL2,
          tryConvertToPromise,
          apiRejection,
          Proxyable
        );
        var Context = require_context()(Promise2);
        var createContext = Context.create;
        var debug = require_debuggability()(Promise2, Context);
        var CapturedTrace = debug.CapturedTrace;
        var PassThroughHandlerContext = require_finally()(Promise2, tryConvertToPromise);
        var catchFilter = require_catch_filter()(NEXT_FILTER);
        var nodebackForPromise = require_nodeback();
        var errorObj2 = util.errorObj;
        var tryCatch2 = util.tryCatch;
        function check(self2, executor) {
          if (typeof executor !== "function") {
            throw new TypeError2("expecting a function but got " + util.classString(executor));
          }
          if (self2.constructor !== Promise2) {
            throw new TypeError2("the promise constructor cannot be invoked directly\n\n    See http://goo.gl/MqrFmX\n");
          }
        }
        function Promise2(executor) {
          this._bitField = 0;
          this._fulfillmentHandler0 = void 0;
          this._rejectionHandler0 = void 0;
          this._promise0 = void 0;
          this._receiver0 = void 0;
          if (executor !== INTERNAL2) {
            check(this, executor);
            this._resolveFromExecutor(executor);
          }
          this._promiseCreated();
          this._fireEvent("promiseCreated", this);
        }
        Promise2.prototype.toString = function() {
          return "[object Promise]";
        };
        Promise2.prototype.caught = Promise2.prototype["catch"] = function(fn) {
          var len = arguments.length;
          if (len > 1) {
            var catchInstances = new Array(len - 1), j = 0, i;
            for (i = 0; i < len - 1; ++i) {
              var item = arguments[i];
              if (util.isObject(item)) {
                catchInstances[j++] = item;
              } else {
                return apiRejection("expecting an object but got A catch statement predicate " + util.classString(item));
              }
            }
            catchInstances.length = j;
            fn = arguments[i];
            return this.then(void 0, catchFilter(catchInstances, fn, this));
          }
          return this.then(void 0, fn);
        };
        Promise2.prototype.reflect = function() {
          return this._then(
            reflectHandler,
            reflectHandler,
            void 0,
            this,
            void 0
          );
        };
        Promise2.prototype.then = function(didFulfill, didReject) {
          if (debug.warnings() && arguments.length > 0 && typeof didFulfill !== "function" && typeof didReject !== "function") {
            var msg = ".then() only accepts functions but was passed: " + util.classString(didFulfill);
            if (arguments.length > 1) {
              msg += ", " + util.classString(didReject);
            }
            this._warn(msg);
          }
          return this._then(didFulfill, didReject, void 0, void 0, void 0);
        };
        Promise2.prototype.done = function(didFulfill, didReject) {
          var promise = this._then(didFulfill, didReject, void 0, void 0, void 0);
          promise._setIsFinal();
        };
        Promise2.prototype.spread = function(fn) {
          if (typeof fn !== "function") {
            return apiRejection("expecting a function but got " + util.classString(fn));
          }
          return this.all()._then(fn, void 0, void 0, APPLY, void 0);
        };
        Promise2.prototype.toJSON = function() {
          var ret2 = {
            isFulfilled: false,
            isRejected: false,
            fulfillmentValue: void 0,
            rejectionReason: void 0
          };
          if (this.isFulfilled()) {
            ret2.fulfillmentValue = this.value();
            ret2.isFulfilled = true;
          } else if (this.isRejected()) {
            ret2.rejectionReason = this.reason();
            ret2.isRejected = true;
          }
          return ret2;
        };
        Promise2.prototype.all = function() {
          if (arguments.length > 0) {
            this._warn(".all() was passed arguments but it does not take any");
          }
          return new PromiseArray(this).promise();
        };
        Promise2.prototype.error = function(fn) {
          return this.caught(util.originatesFromRejection, fn);
        };
        Promise2.getNewLibraryCopy = module2.exports;
        Promise2.is = function(val) {
          return val instanceof Promise2;
        };
        Promise2.fromNode = Promise2.fromCallback = function(fn) {
          var ret2 = new Promise2(INTERNAL2);
          ret2._captureStackTrace();
          var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs : false;
          var result2 = tryCatch2(fn)(nodebackForPromise(ret2, multiArgs));
          if (result2 === errorObj2) {
            ret2._rejectCallback(result2.e, true);
          }
          if (!ret2._isFateSealed()) ret2._setAsyncGuaranteed();
          return ret2;
        };
        Promise2.all = function(promises) {
          return new PromiseArray(promises).promise();
        };
        Promise2.cast = function(obj2) {
          var ret2 = tryConvertToPromise(obj2);
          if (!(ret2 instanceof Promise2)) {
            ret2 = new Promise2(INTERNAL2);
            ret2._captureStackTrace();
            ret2._setFulfilled();
            ret2._rejectionHandler0 = obj2;
          }
          return ret2;
        };
        Promise2.resolve = Promise2.fulfilled = Promise2.cast;
        Promise2.reject = Promise2.rejected = function(reason) {
          var ret2 = new Promise2(INTERNAL2);
          ret2._captureStackTrace();
          ret2._rejectCallback(reason, true);
          return ret2;
        };
        Promise2.setScheduler = function(fn) {
          if (typeof fn !== "function") {
            throw new TypeError2("expecting a function but got " + util.classString(fn));
          }
          return async.setScheduler(fn);
        };
        Promise2.prototype._then = function(didFulfill, didReject, _3, receiver, internalData) {
          var haveInternalData = internalData !== void 0;
          var promise = haveInternalData ? internalData : new Promise2(INTERNAL2);
          var target = this._target();
          var bitField = target._bitField;
          if (!haveInternalData) {
            promise._propagateFrom(this, 3);
            promise._captureStackTrace();
            if (receiver === void 0 && (this._bitField & 2097152) !== 0) {
              if (!((bitField & 50397184) === 0)) {
                receiver = this._boundValue();
              } else {
                receiver = target === this ? void 0 : this._boundTo;
              }
            }
            this._fireEvent("promiseChained", this, promise);
          }
          var domain = getDomain();
          if (!((bitField & 50397184) === 0)) {
            var handler, value, settler = target._settlePromiseCtx;
            if ((bitField & 33554432) !== 0) {
              value = target._rejectionHandler0;
              handler = didFulfill;
            } else if ((bitField & 16777216) !== 0) {
              value = target._fulfillmentHandler0;
              handler = didReject;
              target._unsetRejectionIsUnhandled();
            } else {
              settler = target._settlePromiseLateCancellationObserver;
              value = new CancellationError("late cancellation observer");
              target._attachExtraTrace(value);
              handler = didReject;
            }
            async.invoke(settler, target, {
              handler: domain === null ? handler : typeof handler === "function" && util.domainBind(domain, handler),
              promise,
              receiver,
              value
            });
          } else {
            target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
          }
          return promise;
        };
        Promise2.prototype._length = function() {
          return this._bitField & 65535;
        };
        Promise2.prototype._isFateSealed = function() {
          return (this._bitField & 117506048) !== 0;
        };
        Promise2.prototype._isFollowing = function() {
          return (this._bitField & 67108864) === 67108864;
        };
        Promise2.prototype._setLength = function(len) {
          this._bitField = this._bitField & -65536 | len & 65535;
        };
        Promise2.prototype._setFulfilled = function() {
          this._bitField = this._bitField | 33554432;
          this._fireEvent("promiseFulfilled", this);
        };
        Promise2.prototype._setRejected = function() {
          this._bitField = this._bitField | 16777216;
          this._fireEvent("promiseRejected", this);
        };
        Promise2.prototype._setFollowing = function() {
          this._bitField = this._bitField | 67108864;
          this._fireEvent("promiseResolved", this);
        };
        Promise2.prototype._setIsFinal = function() {
          this._bitField = this._bitField | 4194304;
        };
        Promise2.prototype._isFinal = function() {
          return (this._bitField & 4194304) > 0;
        };
        Promise2.prototype._unsetCancelled = function() {
          this._bitField = this._bitField & ~65536;
        };
        Promise2.prototype._setCancelled = function() {
          this._bitField = this._bitField | 65536;
          this._fireEvent("promiseCancelled", this);
        };
        Promise2.prototype._setWillBeCancelled = function() {
          this._bitField = this._bitField | 8388608;
        };
        Promise2.prototype._setAsyncGuaranteed = function() {
          if (async.hasCustomScheduler()) return;
          this._bitField = this._bitField | 134217728;
        };
        Promise2.prototype._receiverAt = function(index) {
          var ret2 = index === 0 ? this._receiver0 : this[index * 4 - 4 + 3];
          if (ret2 === UNDEFINED_BINDING) {
            return void 0;
          } else if (ret2 === void 0 && this._isBound()) {
            return this._boundValue();
          }
          return ret2;
        };
        Promise2.prototype._promiseAt = function(index) {
          return this[index * 4 - 4 + 2];
        };
        Promise2.prototype._fulfillmentHandlerAt = function(index) {
          return this[index * 4 - 4 + 0];
        };
        Promise2.prototype._rejectionHandlerAt = function(index) {
          return this[index * 4 - 4 + 1];
        };
        Promise2.prototype._boundValue = function() {
        };
        Promise2.prototype._migrateCallback0 = function(follower) {
          var bitField = follower._bitField;
          var fulfill = follower._fulfillmentHandler0;
          var reject2 = follower._rejectionHandler0;
          var promise = follower._promise0;
          var receiver = follower._receiverAt(0);
          if (receiver === void 0) receiver = UNDEFINED_BINDING;
          this._addCallbacks(fulfill, reject2, promise, receiver, null);
        };
        Promise2.prototype._migrateCallbackAt = function(follower, index) {
          var fulfill = follower._fulfillmentHandlerAt(index);
          var reject2 = follower._rejectionHandlerAt(index);
          var promise = follower._promiseAt(index);
          var receiver = follower._receiverAt(index);
          if (receiver === void 0) receiver = UNDEFINED_BINDING;
          this._addCallbacks(fulfill, reject2, promise, receiver, null);
        };
        Promise2.prototype._addCallbacks = function(fulfill, reject2, promise, receiver, domain) {
          var index = this._length();
          if (index >= 65535 - 4) {
            index = 0;
            this._setLength(0);
          }
          if (index === 0) {
            this._promise0 = promise;
            this._receiver0 = receiver;
            if (typeof fulfill === "function") {
              this._fulfillmentHandler0 = domain === null ? fulfill : util.domainBind(domain, fulfill);
            }
            if (typeof reject2 === "function") {
              this._rejectionHandler0 = domain === null ? reject2 : util.domainBind(domain, reject2);
            }
          } else {
            var base = index * 4 - 4;
            this[base + 2] = promise;
            this[base + 3] = receiver;
            if (typeof fulfill === "function") {
              this[base + 0] = domain === null ? fulfill : util.domainBind(domain, fulfill);
            }
            if (typeof reject2 === "function") {
              this[base + 1] = domain === null ? reject2 : util.domainBind(domain, reject2);
            }
          }
          this._setLength(index + 1);
          return index;
        };
        Promise2.prototype._proxy = function(proxyable, arg) {
          this._addCallbacks(void 0, void 0, arg, proxyable, null);
        };
        Promise2.prototype._resolveCallback = function(value, shouldBind) {
          if ((this._bitField & 117506048) !== 0) return;
          if (value === this)
            return this._rejectCallback(makeSelfResolutionError(), false);
          var maybePromise = tryConvertToPromise(value, this);
          if (!(maybePromise instanceof Promise2)) return this._fulfill(value);
          if (shouldBind) this._propagateFrom(maybePromise, 2);
          var promise = maybePromise._target();
          if (promise === this) {
            this._reject(makeSelfResolutionError());
            return;
          }
          var bitField = promise._bitField;
          if ((bitField & 50397184) === 0) {
            var len = this._length();
            if (len > 0) promise._migrateCallback0(this);
            for (var i = 1; i < len; ++i) {
              promise._migrateCallbackAt(this, i);
            }
            this._setFollowing();
            this._setLength(0);
            this._setFollowee(promise);
          } else if ((bitField & 33554432) !== 0) {
            this._fulfill(promise._value());
          } else if ((bitField & 16777216) !== 0) {
            this._reject(promise._reason());
          } else {
            var reason = new CancellationError("late cancellation observer");
            promise._attachExtraTrace(reason);
            this._reject(reason);
          }
        };
        Promise2.prototype._rejectCallback = function(reason, synchronous, ignoreNonErrorWarnings) {
          var trace = util.ensureErrorObject(reason);
          var hasStack = trace === reason;
          if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
            var message = "a promise was rejected with a non-error: " + util.classString(reason);
            this._warn(message, true);
          }
          this._attachExtraTrace(trace, synchronous ? hasStack : false);
          this._reject(reason);
        };
        Promise2.prototype._resolveFromExecutor = function(executor) {
          var promise = this;
          this._captureStackTrace();
          this._pushContext();
          var synchronous = true;
          var r = this._execute(executor, function(value) {
            promise._resolveCallback(value);
          }, function(reason) {
            promise._rejectCallback(reason, synchronous);
          });
          synchronous = false;
          this._popContext();
          if (r !== void 0) {
            promise._rejectCallback(r, true);
          }
        };
        Promise2.prototype._settlePromiseFromHandler = function(handler, receiver, value, promise) {
          var bitField = promise._bitField;
          if ((bitField & 65536) !== 0) return;
          promise._pushContext();
          var x;
          if (receiver === APPLY) {
            if (!value || typeof value.length !== "number") {
              x = errorObj2;
              x.e = new TypeError2("cannot .spread() a non-array: " + util.classString(value));
            } else {
              x = tryCatch2(handler).apply(this._boundValue(), value);
            }
          } else {
            x = tryCatch2(handler).call(receiver, value);
          }
          var promiseCreated = promise._popContext();
          bitField = promise._bitField;
          if ((bitField & 65536) !== 0) return;
          if (x === NEXT_FILTER) {
            promise._reject(value);
          } else if (x === errorObj2) {
            promise._rejectCallback(x.e, false);
          } else {
            debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
            promise._resolveCallback(x);
          }
        };
        Promise2.prototype._target = function() {
          var ret2 = this;
          while (ret2._isFollowing()) ret2 = ret2._followee();
          return ret2;
        };
        Promise2.prototype._followee = function() {
          return this._rejectionHandler0;
        };
        Promise2.prototype._setFollowee = function(promise) {
          this._rejectionHandler0 = promise;
        };
        Promise2.prototype._settlePromise = function(promise, handler, receiver, value) {
          var isPromise = promise instanceof Promise2;
          var bitField = this._bitField;
          var asyncGuaranteed = (bitField & 134217728) !== 0;
          if ((bitField & 65536) !== 0) {
            if (isPromise) promise._invokeInternalOnCancel();
            if (receiver instanceof PassThroughHandlerContext && receiver.isFinallyHandler()) {
              receiver.cancelPromise = promise;
              if (tryCatch2(handler).call(receiver, value) === errorObj2) {
                promise._reject(errorObj2.e);
              }
            } else if (handler === reflectHandler) {
              promise._fulfill(reflectHandler.call(receiver));
            } else if (receiver instanceof Proxyable) {
              receiver._promiseCancelled(promise);
            } else if (isPromise || promise instanceof PromiseArray) {
              promise._cancel();
            } else {
              receiver.cancel();
            }
          } else if (typeof handler === "function") {
            if (!isPromise) {
              handler.call(receiver, value, promise);
            } else {
              if (asyncGuaranteed) promise._setAsyncGuaranteed();
              this._settlePromiseFromHandler(handler, receiver, value, promise);
            }
          } else if (receiver instanceof Proxyable) {
            if (!receiver._isResolved()) {
              if ((bitField & 33554432) !== 0) {
                receiver._promiseFulfilled(value, promise);
              } else {
                receiver._promiseRejected(value, promise);
              }
            }
          } else if (isPromise) {
            if (asyncGuaranteed) promise._setAsyncGuaranteed();
            if ((bitField & 33554432) !== 0) {
              promise._fulfill(value);
            } else {
              promise._reject(value);
            }
          }
        };
        Promise2.prototype._settlePromiseLateCancellationObserver = function(ctx) {
          var handler = ctx.handler;
          var promise = ctx.promise;
          var receiver = ctx.receiver;
          var value = ctx.value;
          if (typeof handler === "function") {
            if (!(promise instanceof Promise2)) {
              handler.call(receiver, value, promise);
            } else {
              this._settlePromiseFromHandler(handler, receiver, value, promise);
            }
          } else if (promise instanceof Promise2) {
            promise._reject(value);
          }
        };
        Promise2.prototype._settlePromiseCtx = function(ctx) {
          this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
        };
        Promise2.prototype._settlePromise0 = function(handler, value, bitField) {
          var promise = this._promise0;
          var receiver = this._receiverAt(0);
          this._promise0 = void 0;
          this._receiver0 = void 0;
          this._settlePromise(promise, handler, receiver, value);
        };
        Promise2.prototype._clearCallbackDataAtIndex = function(index) {
          var base = index * 4 - 4;
          this[base + 2] = this[base + 3] = this[base + 0] = this[base + 1] = void 0;
        };
        Promise2.prototype._fulfill = function(value) {
          var bitField = this._bitField;
          if ((bitField & 117506048) >>> 16) return;
          if (value === this) {
            var err = makeSelfResolutionError();
            this._attachExtraTrace(err);
            return this._reject(err);
          }
          this._setFulfilled();
          this._rejectionHandler0 = value;
          if ((bitField & 65535) > 0) {
            if ((bitField & 134217728) !== 0) {
              this._settlePromises();
            } else {
              async.settlePromises(this);
            }
          }
        };
        Promise2.prototype._reject = function(reason) {
          var bitField = this._bitField;
          if ((bitField & 117506048) >>> 16) return;
          this._setRejected();
          this._fulfillmentHandler0 = reason;
          if (this._isFinal()) {
            return async.fatalError(reason, util.isNode);
          }
          if ((bitField & 65535) > 0) {
            async.settlePromises(this);
          } else {
            this._ensurePossibleRejectionHandled();
          }
        };
        Promise2.prototype._fulfillPromises = function(len, value) {
          for (var i = 1; i < len; i++) {
            var handler = this._fulfillmentHandlerAt(i);
            var promise = this._promiseAt(i);
            var receiver = this._receiverAt(i);
            this._clearCallbackDataAtIndex(i);
            this._settlePromise(promise, handler, receiver, value);
          }
        };
        Promise2.prototype._rejectPromises = function(len, reason) {
          for (var i = 1; i < len; i++) {
            var handler = this._rejectionHandlerAt(i);
            var promise = this._promiseAt(i);
            var receiver = this._receiverAt(i);
            this._clearCallbackDataAtIndex(i);
            this._settlePromise(promise, handler, receiver, reason);
          }
        };
        Promise2.prototype._settlePromises = function() {
          var bitField = this._bitField;
          var len = bitField & 65535;
          if (len > 0) {
            if ((bitField & 16842752) !== 0) {
              var reason = this._fulfillmentHandler0;
              this._settlePromise0(this._rejectionHandler0, reason, bitField);
              this._rejectPromises(len, reason);
            } else {
              var value = this._rejectionHandler0;
              this._settlePromise0(this._fulfillmentHandler0, value, bitField);
              this._fulfillPromises(len, value);
            }
            this._setLength(0);
          }
          this._clearCancellationData();
        };
        Promise2.prototype._settledValue = function() {
          var bitField = this._bitField;
          if ((bitField & 33554432) !== 0) {
            return this._rejectionHandler0;
          } else if ((bitField & 16777216) !== 0) {
            return this._fulfillmentHandler0;
          }
        };
        function deferResolve(v) {
          this.promise._resolveCallback(v);
        }
        function deferReject(v) {
          this.promise._rejectCallback(v, false);
        }
        Promise2.defer = Promise2.pending = function() {
          debug.deprecated("Promise.defer", "new Promise");
          var promise = new Promise2(INTERNAL2);
          return {
            promise,
            resolve: deferResolve,
            reject: deferReject
          };
        };
        util.notEnumerableProp(
          Promise2,
          "_makeSelfResolutionError",
          makeSelfResolutionError
        );
        require_method()(
          Promise2,
          INTERNAL2,
          tryConvertToPromise,
          apiRejection,
          debug
        );
        require_bind()(Promise2, INTERNAL2, tryConvertToPromise, debug);
        require_cancel()(Promise2, PromiseArray, apiRejection, debug);
        require_direct_resolve()(Promise2);
        require_synchronous_inspection()(Promise2);
        require_join()(
          Promise2,
          PromiseArray,
          tryConvertToPromise,
          INTERNAL2,
          async,
          getDomain
        );
        Promise2.Promise = Promise2;
        Promise2.version = "3.4.7";
        require_map()(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug);
        require_call_get()(Promise2);
        require_using()(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL2, debug);
        require_timers()(Promise2, INTERNAL2, debug);
        require_generators()(Promise2, apiRejection, INTERNAL2, tryConvertToPromise, Proxyable, debug);
        require_nodeify()(Promise2);
        require_promisify()(Promise2, INTERNAL2);
        require_props()(Promise2, PromiseArray, tryConvertToPromise, apiRejection);
        require_race()(Promise2, INTERNAL2, tryConvertToPromise, apiRejection);
        require_reduce()(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug);
        require_settle()(Promise2, PromiseArray, debug);
        require_some()(Promise2, PromiseArray, apiRejection);
        require_filter()(Promise2, INTERNAL2);
        require_each()(Promise2, INTERNAL2);
        require_any()(Promise2);
        util.toFastProperties(Promise2);
        util.toFastProperties(Promise2.prototype);
        function fillTypes(value) {
          var p = new Promise2(INTERNAL2);
          p._fulfillmentHandler0 = value;
          p._rejectionHandler0 = value;
          p._promise0 = value;
          p._receiver0 = value;
        }
        fillTypes({ a: 1 });
        fillTypes({ b: 2 });
        fillTypes({ c: 3 });
        fillTypes(1);
        fillTypes(function() {
        });
        fillTypes(void 0);
        fillTypes(false);
        fillTypes(new Promise2(INTERNAL2));
        debug.setBounds(Async.firstLineError, util.lastLineError);
        return Promise2;
      };
    }
  });

  // node_modules/mammoth/lib/promises.js
  var require_promises = __commonJS({
    "node_modules/mammoth/lib/promises.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var bluebird = require_promise()();
      exports2.defer = defer;
      exports2.when = bluebird.resolve;
      exports2.resolve = bluebird.resolve;
      exports2.all = bluebird.all;
      exports2.props = bluebird.props;
      exports2.reject = bluebird.reject;
      exports2.promisify = bluebird.promisify;
      exports2.mapSeries = bluebird.mapSeries;
      exports2.attempt = bluebird.attempt;
      exports2.nfcall = function(func) {
        var args = Array.prototype.slice.call(arguments, 1);
        var promisedFunc = bluebird.promisify(func);
        return promisedFunc.apply(null, args);
      };
      bluebird.prototype.fail = bluebird.prototype.caught;
      bluebird.prototype.also = function(func) {
        return this.then(function(value) {
          var returnValue = _3.extend({}, value, func(value));
          return bluebird.props(returnValue);
        });
      };
      function defer() {
        var resolve;
        var reject2;
        var promise = new bluebird.Promise(function(resolveArg, rejectArg) {
          resolve = resolveArg;
          reject2 = rejectArg;
        });
        return {
          resolve,
          reject: reject2,
          promise
        };
      }
    }
  });

  // node_modules/mammoth/lib/documents.js
  var require_documents = __commonJS({
    "node_modules/mammoth/lib/documents.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var types = exports2.types = {
        document: "document",
        paragraph: "paragraph",
        run: "run",
        text: "text",
        tab: "tab",
        checkbox: "checkbox",
        hyperlink: "hyperlink",
        noteReference: "noteReference",
        image: "image",
        note: "note",
        commentReference: "commentReference",
        comment: "comment",
        table: "table",
        tableRow: "tableRow",
        tableCell: "tableCell",
        "break": "break",
        bookmarkStart: "bookmarkStart"
      };
      function Document(children, options) {
        options = options || {};
        return {
          type: types.document,
          children,
          notes: options.notes || new Notes({}),
          comments: options.comments || []
        };
      }
      function Paragraph(children, properties) {
        properties = properties || {};
        var indent = properties.indent || {};
        return {
          type: types.paragraph,
          children,
          styleId: properties.styleId || null,
          styleName: properties.styleName || null,
          numbering: properties.numbering || null,
          alignment: properties.alignment || null,
          indent: {
            start: indent.start || null,
            end: indent.end || null,
            firstLine: indent.firstLine || null,
            hanging: indent.hanging || null
          }
        };
      }
      function Run(children, properties) {
        properties = properties || {};
        return {
          type: types.run,
          children,
          styleId: properties.styleId || null,
          styleName: properties.styleName || null,
          isBold: !!properties.isBold,
          isUnderline: !!properties.isUnderline,
          isItalic: !!properties.isItalic,
          isStrikethrough: !!properties.isStrikethrough,
          isAllCaps: !!properties.isAllCaps,
          isSmallCaps: !!properties.isSmallCaps,
          verticalAlignment: properties.verticalAlignment || verticalAlignment.baseline,
          font: properties.font || null,
          fontSize: properties.fontSize || null,
          highlight: properties.highlight || null
        };
      }
      var verticalAlignment = {
        baseline: "baseline",
        superscript: "superscript",
        subscript: "subscript"
      };
      function Text(value) {
        return {
          type: types.text,
          value
        };
      }
      function Tab() {
        return {
          type: types.tab
        };
      }
      function Checkbox(options) {
        return {
          type: types.checkbox,
          checked: options.checked
        };
      }
      function Hyperlink(children, options) {
        return {
          type: types.hyperlink,
          children,
          href: options.href,
          anchor: options.anchor,
          targetFrame: options.targetFrame
        };
      }
      function NoteReference(options) {
        return {
          type: types.noteReference,
          noteType: options.noteType,
          noteId: options.noteId
        };
      }
      function Notes(notes) {
        this._notes = _3.indexBy(notes, function(note) {
          return noteKey(note.noteType, note.noteId);
        });
      }
      Notes.prototype.resolve = function(reference) {
        return this.findNoteByKey(noteKey(reference.noteType, reference.noteId));
      };
      Notes.prototype.findNoteByKey = function(key) {
        return this._notes[key] || null;
      };
      function Note(options) {
        return {
          type: types.note,
          noteType: options.noteType,
          noteId: options.noteId,
          body: options.body
        };
      }
      function commentReference(options) {
        return {
          type: types.commentReference,
          commentId: options.commentId
        };
      }
      function comment(options) {
        return {
          type: types.comment,
          commentId: options.commentId,
          body: options.body,
          authorName: options.authorName,
          authorInitials: options.authorInitials
        };
      }
      function noteKey(noteType, id) {
        return noteType + "-" + id;
      }
      function Image2(options) {
        return {
          type: types.image,
          // `read` is retained for backwards compatibility, but other read
          // methods should be preferred.
          read: function(encoding) {
            if (encoding) {
              return options.readImage(encoding);
            } else {
              return options.readImage().then(function(arrayBuffer) {
                return Buffer.from(arrayBuffer);
              });
            }
          },
          readAsArrayBuffer: function() {
            return options.readImage();
          },
          readAsBase64String: function() {
            return options.readImage("base64");
          },
          readAsBuffer: function() {
            return options.readImage().then(function(arrayBuffer) {
              return Buffer.from(arrayBuffer);
            });
          },
          altText: options.altText,
          contentType: options.contentType
        };
      }
      function Table(children, properties) {
        properties = properties || {};
        return {
          type: types.table,
          children,
          styleId: properties.styleId || null,
          styleName: properties.styleName || null
        };
      }
      function TableRow(children, options) {
        options = options || {};
        return {
          type: types.tableRow,
          children,
          isHeader: options.isHeader || false
        };
      }
      function TableCell(children, options) {
        options = options || {};
        return {
          type: types.tableCell,
          children,
          colSpan: options.colSpan == null ? 1 : options.colSpan,
          rowSpan: options.rowSpan == null ? 1 : options.rowSpan
        };
      }
      function Break(breakType) {
        return {
          type: types["break"],
          breakType
        };
      }
      function BookmarkStart(options) {
        return {
          type: types.bookmarkStart,
          name: options.name
        };
      }
      exports2.document = exports2.Document = Document;
      exports2.paragraph = exports2.Paragraph = Paragraph;
      exports2.run = exports2.Run = Run;
      exports2.text = exports2.Text = Text;
      exports2.tab = exports2.Tab = Tab;
      exports2.checkbox = exports2.Checkbox = Checkbox;
      exports2.Hyperlink = Hyperlink;
      exports2.noteReference = exports2.NoteReference = NoteReference;
      exports2.Notes = Notes;
      exports2.Note = Note;
      exports2.commentReference = commentReference;
      exports2.comment = comment;
      exports2.Image = Image2;
      exports2.Table = Table;
      exports2.TableRow = TableRow;
      exports2.TableCell = TableCell;
      exports2.lineBreak = Break("line");
      exports2.pageBreak = Break("page");
      exports2.columnBreak = Break("column");
      exports2.BookmarkStart = BookmarkStart;
      exports2.verticalAlignment = verticalAlignment;
    }
  });

  // node_modules/mammoth/lib/results.js
  var require_results = __commonJS({
    "node_modules/mammoth/lib/results.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      exports2.Result = Result;
      exports2.success = success;
      exports2.warning = warning;
      exports2.error = error;
      function Result(value, messages) {
        this.value = value;
        this.messages = messages || [];
      }
      Result.prototype.map = function(func) {
        return new Result(func(this.value), this.messages);
      };
      Result.prototype.flatMap = function(func) {
        var funcResult = func(this.value);
        return new Result(funcResult.value, combineMessages([this, funcResult]));
      };
      Result.prototype.flatMapThen = function(func) {
        var that = this;
        return func(this.value).then(function(otherResult) {
          return new Result(otherResult.value, combineMessages([that, otherResult]));
        });
      };
      Result.combine = function(results) {
        var values2 = _3.flatten(_3.pluck(results, "value"));
        var messages = combineMessages(results);
        return new Result(values2, messages);
      };
      function success(value) {
        return new Result(value, []);
      }
      function warning(message) {
        return {
          type: "warning",
          message
        };
      }
      function error(exception) {
        return {
          type: "error",
          message: exception.message,
          error: exception
        };
      }
      function combineMessages(results) {
        var messages = [];
        _3.flatten(_3.pluck(results, "messages"), true).forEach(function(message) {
          if (!containsMessage(messages, message)) {
            messages.push(message);
          }
        });
        return messages;
      }
      function containsMessage(messages, message) {
        return _3.find(messages, isSameMessage.bind(null, message)) !== void 0;
      }
      function isSameMessage(first2, second) {
        return first2.type === second.type && first2.message === second.message;
      }
    }
  });

  // node_modules/base64-js/index.js
  var require_base64_js = __commonJS({
    "node_modules/base64-js/index.js"(exports2) {
      "use strict";
      exports2.byteLength = byteLength;
      exports2.toByteArray = toByteArray;
      exports2.fromByteArray = fromByteArray;
      var lookup = [];
      var revLookup = [];
      var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
      var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
      for (i = 0, len = code.length; i < len; ++i) {
        lookup[i] = code[i];
        revLookup[code.charCodeAt(i)] = i;
      }
      var i;
      var len;
      revLookup["-".charCodeAt(0)] = 62;
      revLookup["_".charCodeAt(0)] = 63;
      function getLens(b64) {
        var len2 = b64.length;
        if (len2 % 4 > 0) {
          throw new Error("Invalid string. Length must be a multiple of 4");
        }
        var validLen = b64.indexOf("=");
        if (validLen === -1) validLen = len2;
        var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
        return [validLen, placeHoldersLen];
      }
      function byteLength(b64) {
        var lens = getLens(b64);
        var validLen = lens[0];
        var placeHoldersLen = lens[1];
        return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
      }
      function _byteLength(b64, validLen, placeHoldersLen) {
        return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
      }
      function toByteArray(b64) {
        var tmp;
        var lens = getLens(b64);
        var validLen = lens[0];
        var placeHoldersLen = lens[1];
        var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
        var curByte = 0;
        var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
        var i2;
        for (i2 = 0; i2 < len2; i2 += 4) {
          tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
          arr[curByte++] = tmp >> 16 & 255;
          arr[curByte++] = tmp >> 8 & 255;
          arr[curByte++] = tmp & 255;
        }
        if (placeHoldersLen === 2) {
          tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
          arr[curByte++] = tmp & 255;
        }
        if (placeHoldersLen === 1) {
          tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
          arr[curByte++] = tmp >> 8 & 255;
          arr[curByte++] = tmp & 255;
        }
        return arr;
      }
      function tripletToBase64(num) {
        return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
      }
      function encodeChunk(uint8, start, end) {
        var tmp;
        var output = [];
        for (var i2 = start; i2 < end; i2 += 3) {
          tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
          output.push(tripletToBase64(tmp));
        }
        return output.join("");
      }
      function fromByteArray(uint8) {
        var tmp;
        var len2 = uint8.length;
        var extraBytes = len2 % 3;
        var parts = [];
        var maxChunkLength = 16383;
        for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
          parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
        }
        if (extraBytes === 1) {
          tmp = uint8[len2 - 1];
          parts.push(
            lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
          );
        } else if (extraBytes === 2) {
          tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
          parts.push(
            lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
          );
        }
        return parts.join("");
      }
    }
  });

  // node_modules/jszip/dist/jszip.min.js
  var require_jszip_min = __commonJS({
    "node_modules/jszip/dist/jszip.min.js"(exports2, module2) {
      !(function(e) {
        if ("object" == typeof exports2 && "undefined" != typeof module2) module2.exports = e();
        else if ("function" == typeof define && define.amd) define([], e);
        else {
          ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e();
        }
      })(function() {
        return (function s(a, o, h) {
          function u(r, e2) {
            if (!o[r]) {
              if (!a[r]) {
                var t = "function" == typeof __require && __require;
                if (!e2 && t) return t(r, true);
                if (l2) return l2(r, true);
                var n = new Error("Cannot find module '" + r + "'");
                throw n.code = "MODULE_NOT_FOUND", n;
              }
              var i = o[r] = { exports: {} };
              a[r][0].call(i.exports, function(e3) {
                var t2 = a[r][1][e3];
                return u(t2 || e3);
              }, i, i.exports, s, a, o, h);
            }
            return o[r].exports;
          }
          for (var l2 = "function" == typeof __require && __require, e = 0; e < h.length; e++) u(h[e]);
          return u;
        })({ 1: [function(e, t, r) {
          "use strict";
          var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
          r.encode = function(e2) {
            for (var t2, r2, n, i, s, a, o, h = [], u = 0, l2 = e2.length, f = l2, c2 = "string" !== d.getTypeOf(e2); u < e2.length; ) f = l2 - u, n = c2 ? (t2 = e2[u++], r2 = u < l2 ? e2[u++] : 0, u < l2 ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l2 ? e2.charCodeAt(u++) : 0, u < l2 ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o));
            return h.join("");
          }, r.decode = function(e2) {
            var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:";
            if (e2.substr(0, u.length) === u) throw new Error("Invalid base64 input, it looks like a data url.");
            var l2, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
            if (e2.charAt(e2.length - 1) === p.charAt(64) && f--, e2.charAt(e2.length - 2) === p.charAt(64) && f--, f % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
            for (l2 = c.uint8array ? new Uint8Array(0 | f) : new Array(0 | f); o < e2.length; ) t2 = p.indexOf(e2.charAt(o++)) << 2 | (i = p.indexOf(e2.charAt(o++))) >> 4, r2 = (15 & i) << 4 | (s = p.indexOf(e2.charAt(o++))) >> 2, n = (3 & s) << 6 | (a = p.indexOf(e2.charAt(o++))), l2[h++] = t2, 64 !== s && (l2[h++] = r2), 64 !== a && (l2[h++] = n);
            return l2;
          };
        }, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) {
          "use strict";
          var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe");
          function o(e2, t2, r2, n2, i2) {
            this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2;
          }
          o.prototype = { getContentWorker: function() {
            var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this;
            return e2.on("end", function() {
              if (this.streamInfo.data_length !== t2.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
            }), e2;
          }, getCompressedWorker: function() {
            return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
          } }, o.createWorkerFrom = function(e2, t2, r2) {
            return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2);
          }, t.exports = o;
        }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) {
          "use strict";
          var n = e("./stream/GenericWorker");
          r.STORE = { magic: "\0\0", compressWorker: function() {
            return new n("STORE compression");
          }, uncompressWorker: function() {
            return new n("STORE decompression");
          } }, r.DEFLATE = e("./flate");
        }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) {
          "use strict";
          var n = e("./utils");
          var o = (function() {
            for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
              e2 = r2;
              for (var n2 = 0; n2 < 8; n2++) e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
              t2[r2] = e2;
            }
            return t2;
          })();
          t.exports = function(e2, t2) {
            return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? (function(e3, t3, r2, n2) {
              var i = o, s = n2 + r2;
              e3 ^= -1;
              for (var a = n2; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])];
              return -1 ^ e3;
            })(0 | t2, e2, e2.length, 0) : (function(e3, t3, r2, n2) {
              var i = o, s = n2 + r2;
              e3 ^= -1;
              for (var a = n2; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))];
              return -1 ^ e3;
            })(0 | t2, e2, e2.length, 0) : 0;
          };
        }, { "./utils": 32 }], 5: [function(e, t, r) {
          "use strict";
          r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null;
        }, {}], 6: [function(e, t, r) {
          "use strict";
          var n = null;
          n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n };
        }, { lie: 37 }], 7: [function(e, t, r) {
          "use strict";
          var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), a = e("./stream/GenericWorker"), o = n ? "uint8array" : "array";
          function h(e2, t2) {
            a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {};
          }
          r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) {
            this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false);
          }, h.prototype.flush = function() {
            a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true);
          }, h.prototype.cleanUp = function() {
            a.prototype.cleanUp.call(this), this._pako = null;
          }, h.prototype._createPako = function() {
            this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 });
            var t2 = this;
            this._pako.onData = function(e2) {
              t2.push({ data: e2, meta: t2.meta });
            };
          }, r.compressWorker = function(e2) {
            return new h("Deflate", e2);
          }, r.uncompressWorker = function() {
            return new h("Inflate", {});
          };
        }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) {
          "use strict";
          function A(e2, t2) {
            var r2, n2 = "";
            for (r2 = 0; r2 < t2; r2++) n2 += String.fromCharCode(255 & e2), e2 >>>= 8;
            return n2;
          }
          function n(e2, t2, r2, n2, i2, s2) {
            var a, o, h = e2.file, u = e2.compression, l2 = s2 !== O.utf8encode, f = I.transformTo("string", s2(h.name)), c = I.transformTo("string", O.utf8encode(h.name)), d = h.comment, p = I.transformTo("string", s2(d)), m = I.transformTo("string", O.utf8encode(d)), _3 = c.length !== h.name.length, g = m.length !== d.length, b = "", v = "", y = "", w = h.dir, k = h.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
            t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize);
            var S = 0;
            t2 && (S |= 8), l2 || !_3 && !g || (S |= 2048);
            var z = 0, C = 0;
            w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= (function(e3, t3) {
              var r3 = e3;
              return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16;
            })(h.unixPermissions, w)) : (C = 20, z |= (function(e3) {
              return 63 & (e3 || 0);
            })(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _3 && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y);
            var E = "";
            return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p };
          }
          var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R = e("../signature");
          function s(e2, t2, r2, n2) {
            i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t2, this.zipPlatform = r2, this.encodeFileName = n2, this.streamFiles = e2, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
          }
          I.inherits(s, i), s.prototype.push = function(e2) {
            var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length;
            this.accumulate ? this.contentBuffer.push(e2) : (this.bytesWritten += e2.data.length, i.prototype.push.call(this, { data: e2.data, meta: { currentFile: this.currentFile, percent: r2 ? (t2 + 100 * (r2 - n2 - 1)) / r2 : 100 } }));
          }, s.prototype.openedSource = function(e2) {
            this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name;
            var t2 = this.streamFiles && !e2.file.dir;
            if (t2) {
              var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
              this.push({ data: r2.fileRecord, meta: { percent: 0 } });
            } else this.accumulate = true;
          }, s.prototype.closedSource = function(e2) {
            this.accumulate = false;
            var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
            if (this.dirRecords.push(r2.dirRecord), t2) this.push({ data: (function(e3) {
              return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4);
            })(e2), meta: { percent: 100 } });
            else for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
            this.currentFile = null;
          }, s.prototype.flush = function() {
            for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) this.push({ data: this.dirRecords[t2], meta: { percent: 100 } });
            var r2 = this.bytesWritten - e2, n2 = (function(e3, t3, r3, n3, i2) {
              var s2 = I.transformTo("string", i2(n3));
              return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2;
            })(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName);
            this.push({ data: n2, meta: { percent: 100 } });
          }, s.prototype.prepareNextSource = function() {
            this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
          }, s.prototype.registerPrevious = function(e2) {
            this._sources.push(e2);
            var t2 = this;
            return e2.on("data", function(e3) {
              t2.processChunk(e3);
            }), e2.on("end", function() {
              t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end();
            }), e2.on("error", function(e3) {
              t2.error(e3);
            }), this;
          }, s.prototype.resume = function() {
            return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true));
          }, s.prototype.error = function(e2) {
            var t2 = this._sources;
            if (!i.prototype.error.call(this, e2)) return false;
            for (var r2 = 0; r2 < t2.length; r2++) try {
              t2[r2].error(e2);
            } catch (e3) {
            }
            return true;
          }, s.prototype.lock = function() {
            i.prototype.lock.call(this);
            for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++) e2[t2].lock();
          }, t.exports = s;
        }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) {
          "use strict";
          var u = e("../compressions"), n = e("./ZipFileWorker");
          r.generateWorker = function(e2, a, t2) {
            var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0;
            try {
              e2.forEach(function(e3, t3) {
                h++;
                var r2 = (function(e4, t4) {
                  var r3 = e4 || t4, n3 = u[r3];
                  if (!n3) throw new Error(r3 + " is not a valid compression method !");
                  return n3;
                })(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date;
                t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o);
              }), o.entriesCount = h;
            } catch (e3) {
              o.error(e3);
            }
            return o;
          };
        }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) {
          "use strict";
          function n() {
            if (!(this instanceof n)) return new n();
            if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
            this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
              var e2 = new n();
              for (var t2 in this) "function" != typeof this[t2] && (e2[t2] = this[t2]);
              return e2;
            };
          }
          (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(e2, t2) {
            return new n().loadAsync(e2, t2);
          }, n.external = e("./external"), t.exports = n;
        }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) {
          "use strict";
          var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l2 = e("./nodejsUtils");
          function f(n2) {
            return new i.Promise(function(e2, t2) {
              var r2 = n2.decompressed.getContentWorker().pipe(new a());
              r2.on("error", function(e3) {
                t2(e3);
              }).on("end", function() {
                r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2();
              }).resume();
            });
          }
          t.exports = function(e2, o) {
            var h = this;
            return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n.utf8decode }), l2.isNode && l2.isStream(e2) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e2, true, o.optimizedBinaryString, o.base64).then(function(e3) {
              var t2 = new s(o);
              return t2.load(e3), t2;
            }).then(function(e3) {
              var t2 = [i.Promise.resolve(e3)], r2 = e3.files;
              if (o.checkCRC32) for (var n2 = 0; n2 < r2.length; n2++) t2.push(f(r2[n2]));
              return i.Promise.all(t2);
            }).then(function(e3) {
              for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) {
                var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr);
                h.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h.file(a2).unsafeOriginalName = s2);
              }
              return t2.zipComment.length && (h.comment = t2.zipComment), h;
            });
          };
        }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) {
          "use strict";
          var n = e("../utils"), i = e("../stream/GenericWorker");
          function s(e2, t2) {
            i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2);
          }
          n.inherits(s, i), s.prototype._bindStream = function(e2) {
            var t2 = this;
            (this._stream = e2).pause(), e2.on("data", function(e3) {
              t2.push({ data: e3, meta: { percent: 0 } });
            }).on("error", function(e3) {
              t2.isPaused ? this.generatedError = e3 : t2.error(e3);
            }).on("end", function() {
              t2.isPaused ? t2._upstreamEnded = true : t2.end();
            });
          }, s.prototype.pause = function() {
            return !!i.prototype.pause.call(this) && (this._stream.pause(), true);
          }, s.prototype.resume = function() {
            return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true);
          }, t.exports = s;
        }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) {
          "use strict";
          var i = e("readable-stream").Readable;
          function n(e2, t2, r2) {
            i.call(this, t2), this._helper = e2;
            var n2 = this;
            e2.on("data", function(e3, t3) {
              n2.push(e3) || n2._helper.pause(), r2 && r2(t3);
            }).on("error", function(e3) {
              n2.emit("error", e3);
            }).on("end", function() {
              n2.push(null);
            });
          }
          e("../utils").inherits(n, i), n.prototype._read = function() {
            this._helper.resume();
          }, t.exports = n;
        }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) {
          "use strict";
          t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) {
            if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(e2, t2);
            if ("number" == typeof e2) throw new Error('The "data" argument must not be a number');
            return new Buffer(e2, t2);
          }, allocBuffer: function(e2) {
            if (Buffer.alloc) return Buffer.alloc(e2);
            var t2 = new Buffer(e2);
            return t2.fill(0), t2;
          }, isBuffer: function(e2) {
            return Buffer.isBuffer(e2);
          }, isStream: function(e2) {
            return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume;
          } };
        }, {}], 15: [function(e, t, r) {
          "use strict";
          function s(e2, t2, r2) {
            var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f);
            s2.date = s2.date || /* @__PURE__ */ new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e2 = g(e2)), s2.createFolders && (n2 = _3(e2)) && b.call(this, n2, true);
            var a2 = "string" === i2 && false === s2.binary && false === s2.base64;
            r2 && void 0 !== r2.binary || (s2.binary = !a2), (t2 instanceof c && 0 === t2.uncompressedSize || s2.dir || !t2 || 0 === t2.length) && (s2.base64 = false, s2.binary = true, t2 = "", s2.compression = "STORE", i2 = "string");
            var o2 = null;
            o2 = t2 instanceof c || t2 instanceof l2 ? t2 : p.isNode && p.isStream(t2) ? new m(e2, t2) : u.prepareContent(e2, t2, s2.binary, s2.optimizedBinaryString, s2.base64);
            var h2 = new d(e2, o2, s2);
            this.files[e2] = h2;
          }
          var i = e("./utf8"), u = e("./utils"), l2 = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), f = e("./defaults"), c = e("./compressedObject"), d = e("./zipObject"), o = e("./generate"), p = e("./nodejsUtils"), m = e("./nodejs/NodejsStreamInputAdapter"), _3 = function(e2) {
            "/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1));
            var t2 = e2.lastIndexOf("/");
            return 0 < t2 ? e2.substring(0, t2) : "";
          }, g = function(e2) {
            return "/" !== e2.slice(-1) && (e2 += "/"), e2;
          }, b = function(e2, t2) {
            return t2 = void 0 !== t2 ? t2 : f.createFolders, e2 = g(e2), this.files[e2] || s.call(this, e2, null, { dir: true, createFolders: t2 }), this.files[e2];
          };
          function h(e2) {
            return "[object RegExp]" === Object.prototype.toString.call(e2);
          }
          var n = { load: function() {
            throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
          }, forEach: function(e2) {
            var t2, r2, n2;
            for (t2 in this.files) n2 = this.files[t2], (r2 = t2.slice(this.root.length, t2.length)) && t2.slice(0, this.root.length) === this.root && e2(r2, n2);
          }, filter: function(r2) {
            var n2 = [];
            return this.forEach(function(e2, t2) {
              r2(e2, t2) && n2.push(t2);
            }), n2;
          }, file: function(e2, t2, r2) {
            if (1 !== arguments.length) return e2 = this.root + e2, s.call(this, e2, t2, r2), this;
            if (h(e2)) {
              var n2 = e2;
              return this.filter(function(e3, t3) {
                return !t3.dir && n2.test(e3);
              });
            }
            var i2 = this.files[this.root + e2];
            return i2 && !i2.dir ? i2 : null;
          }, folder: function(r2) {
            if (!r2) return this;
            if (h(r2)) return this.filter(function(e3, t3) {
              return t3.dir && r2.test(e3);
            });
            var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone();
            return n2.root = t2.name, n2;
          }, remove: function(r2) {
            r2 = this.root + r2;
            var e2 = this.files[r2];
            if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir) delete this.files[r2];
            else for (var t2 = this.filter(function(e3, t3) {
              return t3.name.slice(0, r2.length) === r2;
            }), n2 = 0; n2 < t2.length; n2++) delete this.files[t2[n2].name];
            return this;
          }, generate: function() {
            throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
          }, generateInternalStream: function(e2) {
            var t2, r2 = {};
            try {
              if ((r2 = u.extend(e2 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r2.type.toLowerCase(), r2.compression = r2.compression.toUpperCase(), "binarystring" === r2.type && (r2.type = "string"), !r2.type) throw new Error("No output type specified.");
              u.checkSupport(r2.type), "darwin" !== r2.platform && "freebsd" !== r2.platform && "linux" !== r2.platform && "sunos" !== r2.platform || (r2.platform = "UNIX"), "win32" === r2.platform && (r2.platform = "DOS");
              var n2 = r2.comment || this.comment || "";
              t2 = o.generateWorker(this, r2, n2);
            } catch (e3) {
              (t2 = new l2("error")).error(e3);
            }
            return new a(t2, r2.type || "string", r2.mimeType);
          }, generateAsync: function(e2, t2) {
            return this.generateInternalStream(e2).accumulate(t2);
          }, generateNodeStream: function(e2, t2) {
            return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2);
          } };
          t.exports = n;
        }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, t, r) {
          "use strict";
          t.exports = e("stream");
        }, { stream: void 0 }], 17: [function(e, t, r) {
          "use strict";
          var n = e("./DataReader");
          function i(e2) {
            n.call(this, e2);
            for (var t2 = 0; t2 < this.data.length; t2++) e2[t2] = 255 & e2[t2];
          }
          e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) {
            return this.data[this.zero + e2];
          }, i.prototype.lastIndexOfSignature = function(e2) {
            for (var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.length - 4; 0 <= s; --s) if (this.data[s] === t2 && this.data[s + 1] === r2 && this.data[s + 2] === n2 && this.data[s + 3] === i2) return s - this.zero;
            return -1;
          }, i.prototype.readAndCheckSignature = function(e2) {
            var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4);
            return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3];
          }, i.prototype.readData = function(e2) {
            if (this.checkOffset(e2), 0 === e2) return [];
            var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
            return this.index += e2, t2;
          }, t.exports = i;
        }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) {
          "use strict";
          var n = e("../utils");
          function i(e2) {
            this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0;
          }
          i.prototype = { checkOffset: function(e2) {
            this.checkIndex(this.index + e2);
          }, checkIndex: function(e2) {
            if (this.length < this.zero + e2 || e2 < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?");
          }, setIndex: function(e2) {
            this.checkIndex(e2), this.index = e2;
          }, skip: function(e2) {
            this.setIndex(this.index + e2);
          }, byteAt: function() {
          }, readInt: function(e2) {
            var t2, r2 = 0;
            for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--) r2 = (r2 << 8) + this.byteAt(t2);
            return this.index += e2, r2;
          }, readString: function(e2) {
            return n.transformTo("string", this.readData(e2));
          }, readData: function() {
          }, lastIndexOfSignature: function() {
          }, readAndCheckSignature: function() {
          }, readDate: function() {
            var e2 = this.readInt(4);
            return new Date(Date.UTC(1980 + (e2 >> 25 & 127), (e2 >> 21 & 15) - 1, e2 >> 16 & 31, e2 >> 11 & 31, e2 >> 5 & 63, (31 & e2) << 1));
          } }, t.exports = i;
        }, { "../utils": 32 }], 19: [function(e, t, r) {
          "use strict";
          var n = e("./Uint8ArrayReader");
          function i(e2) {
            n.call(this, e2);
          }
          e("../utils").inherits(i, n), i.prototype.readData = function(e2) {
            this.checkOffset(e2);
            var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
            return this.index += e2, t2;
          }, t.exports = i;
        }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) {
          "use strict";
          var n = e("./DataReader");
          function i(e2) {
            n.call(this, e2);
          }
          e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) {
            return this.data.charCodeAt(this.zero + e2);
          }, i.prototype.lastIndexOfSignature = function(e2) {
            return this.data.lastIndexOf(e2) - this.zero;
          }, i.prototype.readAndCheckSignature = function(e2) {
            return e2 === this.readData(4);
          }, i.prototype.readData = function(e2) {
            this.checkOffset(e2);
            var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
            return this.index += e2, t2;
          }, t.exports = i;
        }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) {
          "use strict";
          var n = e("./ArrayReader");
          function i(e2) {
            n.call(this, e2);
          }
          e("../utils").inherits(i, n), i.prototype.readData = function(e2) {
            if (this.checkOffset(e2), 0 === e2) return new Uint8Array(0);
            var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2);
            return this.index += e2, t2;
          }, t.exports = i;
        }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, t, r) {
          "use strict";
          var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader");
          t.exports = function(e2) {
            var t2 = n.getTypeOf(e2);
            return n.checkSupport(t2), "string" !== t2 || i.uint8array ? "nodebuffer" === t2 ? new o(e2) : i.uint8array ? new h(n.transformTo("uint8array", e2)) : new s(n.transformTo("array", e2)) : new a(e2);
          };
        }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) {
          "use strict";
          r.LOCAL_FILE_HEADER = "PK", r.CENTRAL_FILE_HEADER = "PK", r.CENTRAL_DIRECTORY_END = "PK", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK", r.DATA_DESCRIPTOR = "PK\x07\b";
        }, {}], 24: [function(e, t, r) {
          "use strict";
          var n = e("./GenericWorker"), i = e("../utils");
          function s(e2) {
            n.call(this, "ConvertWorker to " + e2), this.destType = e2;
          }
          i.inherits(s, n), s.prototype.processChunk = function(e2) {
            this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta });
          }, t.exports = s;
        }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) {
          "use strict";
          var n = e("./GenericWorker"), i = e("../crc32");
          function s() {
            n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
          }
          e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) {
            this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2);
          }, t.exports = s;
        }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) {
          "use strict";
          var n = e("../utils"), i = e("./GenericWorker");
          function s(e2) {
            i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0);
          }
          n.inherits(s, i), s.prototype.processChunk = function(e2) {
            if (e2) {
              var t2 = this.streamInfo[this.propName] || 0;
              this.streamInfo[this.propName] = t2 + e2.data.length;
            }
            i.prototype.processChunk.call(this, e2);
          }, t.exports = s;
        }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) {
          "use strict";
          var n = e("../utils"), i = e("./GenericWorker");
          function s(e2) {
            i.call(this, "DataWorker");
            var t2 = this;
            this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) {
              t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat();
            }, function(e3) {
              t2.error(e3);
            });
          }
          n.inherits(s, i), s.prototype.cleanUp = function() {
            i.prototype.cleanUp.call(this), this.data = null;
          }, s.prototype.resume = function() {
            return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true);
          }, s.prototype._tickAndRepeat = function() {
            this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true));
          }, s.prototype._tick = function() {
            if (this.isPaused || this.isFinished) return false;
            var e2 = null, t2 = Math.min(this.max, this.index + 16384);
            if (this.index >= this.max) return this.end();
            switch (this.type) {
              case "string":
                e2 = this.data.substring(this.index, t2);
                break;
              case "uint8array":
                e2 = this.data.subarray(this.index, t2);
                break;
              case "array":
              case "nodebuffer":
                e2 = this.data.slice(this.index, t2);
            }
            return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
          }, t.exports = s;
        }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) {
          "use strict";
          function n(e2) {
            this.name = e2 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null;
          }
          n.prototype = { push: function(e2) {
            this.emit("data", e2);
          }, end: function() {
            if (this.isFinished) return false;
            this.flush();
            try {
              this.emit("end"), this.cleanUp(), this.isFinished = true;
            } catch (e2) {
              this.emit("error", e2);
            }
            return true;
          }, error: function(e2) {
            return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true);
          }, on: function(e2, t2) {
            return this._listeners[e2].push(t2), this;
          }, cleanUp: function() {
            this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
          }, emit: function(e2, t2) {
            if (this._listeners[e2]) for (var r2 = 0; r2 < this._listeners[e2].length; r2++) this._listeners[e2][r2].call(this, t2);
          }, pipe: function(e2) {
            return e2.registerPrevious(this);
          }, registerPrevious: function(e2) {
            if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
            this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2;
            var t2 = this;
            return e2.on("data", function(e3) {
              t2.processChunk(e3);
            }), e2.on("end", function() {
              t2.end();
            }), e2.on("error", function(e3) {
              t2.error(e3);
            }), this;
          }, pause: function() {
            return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true);
          }, resume: function() {
            if (!this.isPaused || this.isFinished) return false;
            var e2 = this.isPaused = false;
            return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2;
          }, flush: function() {
          }, processChunk: function(e2) {
            this.push(e2);
          }, withStreamInfo: function(e2, t2) {
            return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this;
          }, mergeStreamInfo: function() {
            for (var e2 in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]);
          }, lock: function() {
            if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
            this.isLocked = true, this.previous && this.previous.lock();
          }, toString: function() {
            var e2 = "Worker " + this.name;
            return this.previous ? this.previous + " -> " + e2 : e2;
          } }, t.exports = n;
        }, {}], 29: [function(e, t, r) {
          "use strict";
          var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null;
          if (n.nodestream) try {
            o = e("../nodejs/NodejsStreamOutputAdapter");
          } catch (e2) {
          }
          function l2(e2, o2) {
            return new a.Promise(function(t2, r2) {
              var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType;
              e2.on("data", function(e3, t3) {
                n2.push(e3), o2 && o2(t3);
              }).on("error", function(e3) {
                n2 = [], r2(e3);
              }).on("end", function() {
                try {
                  var e3 = (function(e4, t3, r3) {
                    switch (e4) {
                      case "blob":
                        return h.newBlob(h.transformTo("arraybuffer", t3), r3);
                      case "base64":
                        return u.encode(t3);
                      default:
                        return h.transformTo(e4, t3);
                    }
                  })(s2, (function(e4, t3) {
                    var r3, n3 = 0, i3 = null, s3 = 0;
                    for (r3 = 0; r3 < t3.length; r3++) s3 += t3[r3].length;
                    switch (e4) {
                      case "string":
                        return t3.join("");
                      case "array":
                        return Array.prototype.concat.apply([], t3);
                      case "uint8array":
                        for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++) i3.set(t3[r3], n3), n3 += t3[r3].length;
                        return i3;
                      case "nodebuffer":
                        return Buffer.concat(t3);
                      default:
                        throw new Error("concat : unsupported type '" + e4 + "'");
                    }
                  })(i2, n2), a2);
                  t2(e3);
                } catch (e4) {
                  r2(e4);
                }
                n2 = [];
              }).resume();
            });
          }
          function f(e2, t2, r2) {
            var n2 = t2;
            switch (t2) {
              case "blob":
              case "arraybuffer":
                n2 = "uint8array";
                break;
              case "base64":
                n2 = "string";
            }
            try {
              this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock();
            } catch (e3) {
              this._worker = new s("error"), this._worker.error(e3);
            }
          }
          f.prototype = { accumulate: function(e2) {
            return l2(this, e2);
          }, on: function(e2, t2) {
            var r2 = this;
            return "data" === e2 ? this._worker.on(e2, function(e3) {
              t2.call(r2, e3.data, e3.meta);
            }) : this._worker.on(e2, function() {
              h.delay(t2, arguments, r2);
            }), this;
          }, resume: function() {
            return h.delay(this._worker.resume, [], this._worker), this;
          }, pause: function() {
            return this._worker.pause(), this;
          }, toNodejsStream: function(e2) {
            if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType) throw new Error(this._outputType + " is not supported by this method");
            return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2);
          } }, t.exports = f;
        }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) {
          "use strict";
          if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) r.blob = false;
          else {
            var n = new ArrayBuffer(0);
            try {
              r.blob = 0 === new Blob([n], { type: "application/zip" }).size;
            } catch (e2) {
              try {
                var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
                i.append(n), r.blob = 0 === i.getBlob("application/zip").size;
              } catch (e3) {
                r.blob = false;
              }
            }
          }
          try {
            r.nodestream = !!e("readable-stream").Readable;
          } catch (e2) {
            r.nodestream = false;
          }
        }, { "readable-stream": 16 }], 31: [function(e, t, s) {
          "use strict";
          for (var o = e("./utils"), h = e("./support"), r = e("./nodejsUtils"), n = e("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++) u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1;
          u[254] = u[254] = 1;
          function a() {
            n.call(this, "utf-8 decode"), this.leftOver = null;
          }
          function l2() {
            n.call(this, "utf-8 encode");
          }
          s.utf8encode = function(e2) {
            return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : (function(e3) {
              var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0;
              for (i2 = 0; i2 < a2; i2++) 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4;
              for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2);
              return t2;
            })(e2);
          }, s.utf8decode = function(e2) {
            return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : (function(e3) {
              var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2);
              for (t2 = r2 = 0; t2 < s2; ) if ((n2 = e3[t2++]) < 128) a2[r2++] = n2;
              else if (4 < (i2 = u[n2])) a2[r2++] = 65533, t2 += i2 - 1;
              else {
                for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; ) n2 = n2 << 6 | 63 & e3[t2++], i2--;
                1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2);
              }
              return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2);
            })(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2));
          }, o.inherits(a, n), a.prototype.processChunk = function(e2) {
            var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data);
            if (this.leftOver && this.leftOver.length) {
              if (h.uint8array) {
                var r2 = t2;
                (t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length);
              } else t2 = this.leftOver.concat(t2);
              this.leftOver = null;
            }
            var n2 = (function(e3, t3) {
              var r3;
              for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) r3--;
              return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3;
            })(t2), i2 = t2;
            n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta });
          }, a.prototype.flush = function() {
            this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
          }, s.Utf8DecodeWorker = a, o.inherits(l2, n), l2.prototype.processChunk = function(e2) {
            this.push({ data: s.utf8encode(e2.data), meta: e2.meta });
          }, s.Utf8EncodeWorker = l2;
        }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) {
          "use strict";
          var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external");
          function n(e2) {
            return e2;
          }
          function l2(e2, t2) {
            for (var r2 = 0; r2 < e2.length; ++r2) t2[r2] = 255 & e2.charCodeAt(r2);
            return t2;
          }
          e("setimmediate"), a.newBlob = function(t2, r2) {
            a.checkSupport("blob");
            try {
              return new Blob([t2], { type: r2 });
            } catch (e2) {
              try {
                var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
                return n2.append(t2), n2.getBlob(r2);
              } catch (e3) {
                throw new Error("Bug : can't construct the Blob.");
              }
            }
          };
          var i = { stringifyByChunk: function(e2, t2, r2) {
            var n2 = [], i2 = 0, s2 = e2.length;
            if (s2 <= r2) return String.fromCharCode.apply(null, e2);
            for (; i2 < s2; ) "array" === t2 || "nodebuffer" === t2 ? n2.push(String.fromCharCode.apply(null, e2.slice(i2, Math.min(i2 + r2, s2)))) : n2.push(String.fromCharCode.apply(null, e2.subarray(i2, Math.min(i2 + r2, s2)))), i2 += r2;
            return n2.join("");
          }, stringifyByChar: function(e2) {
            for (var t2 = "", r2 = 0; r2 < e2.length; r2++) t2 += String.fromCharCode(e2[r2]);
            return t2;
          }, applyCanBeUsed: { uint8array: (function() {
            try {
              return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length;
            } catch (e2) {
              return false;
            }
          })(), nodebuffer: (function() {
            try {
              return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length;
            } catch (e2) {
              return false;
            }
          })() } };
          function s(e2) {
            var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true;
            if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) for (; 1 < t2; ) try {
              return i.stringifyByChunk(e2, r2, t2);
            } catch (e3) {
              t2 = Math.floor(t2 / 2);
            }
            return i.stringifyByChar(e2);
          }
          function f(e2, t2) {
            for (var r2 = 0; r2 < e2.length; r2++) t2[r2] = e2[r2];
            return t2;
          }
          a.applyFromCharCode = s;
          var c = {};
          c.string = { string: n, array: function(e2) {
            return l2(e2, new Array(e2.length));
          }, arraybuffer: function(e2) {
            return c.string.uint8array(e2).buffer;
          }, uint8array: function(e2) {
            return l2(e2, new Uint8Array(e2.length));
          }, nodebuffer: function(e2) {
            return l2(e2, r.allocBuffer(e2.length));
          } }, c.array = { string: s, array: n, arraybuffer: function(e2) {
            return new Uint8Array(e2).buffer;
          }, uint8array: function(e2) {
            return new Uint8Array(e2);
          }, nodebuffer: function(e2) {
            return r.newBufferFrom(e2);
          } }, c.arraybuffer = { string: function(e2) {
            return s(new Uint8Array(e2));
          }, array: function(e2) {
            return f(new Uint8Array(e2), new Array(e2.byteLength));
          }, arraybuffer: n, uint8array: function(e2) {
            return new Uint8Array(e2);
          }, nodebuffer: function(e2) {
            return r.newBufferFrom(new Uint8Array(e2));
          } }, c.uint8array = { string: s, array: function(e2) {
            return f(e2, new Array(e2.length));
          }, arraybuffer: function(e2) {
            return e2.buffer;
          }, uint8array: n, nodebuffer: function(e2) {
            return r.newBufferFrom(e2);
          } }, c.nodebuffer = { string: s, array: function(e2) {
            return f(e2, new Array(e2.length));
          }, arraybuffer: function(e2) {
            return c.nodebuffer.uint8array(e2).buffer;
          }, uint8array: function(e2) {
            return f(e2, new Uint8Array(e2.length));
          }, nodebuffer: n }, a.transformTo = function(e2, t2) {
            if (t2 = t2 || "", !e2) return t2;
            a.checkSupport(e2);
            var r2 = a.getTypeOf(t2);
            return c[r2][e2](t2);
          }, a.resolve = function(e2) {
            for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) {
              var i2 = t2[n2];
              "." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2));
            }
            return r2.join("/");
          }, a.getTypeOf = function(e2) {
            return "string" == typeof e2 ? "string" : "[object Array]" === Object.prototype.toString.call(e2) ? "array" : o.nodebuffer && r.isBuffer(e2) ? "nodebuffer" : o.uint8array && e2 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e2 instanceof ArrayBuffer ? "arraybuffer" : void 0;
          }, a.checkSupport = function(e2) {
            if (!o[e2.toLowerCase()]) throw new Error(e2 + " is not supported by this platform");
          }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) {
            var t2, r2, n2 = "";
            for (r2 = 0; r2 < (e2 || "").length; r2++) n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase();
            return n2;
          }, a.delay = function(e2, t2, r2) {
            setImmediate(function() {
              e2.apply(r2 || null, t2 || []);
            });
          }, a.inherits = function(e2, t2) {
            function r2() {
            }
            r2.prototype = t2.prototype, e2.prototype = new r2();
          }, a.extend = function() {
            var e2, t2, r2 = {};
            for (e2 = 0; e2 < arguments.length; e2++) for (t2 in arguments[e2]) Object.prototype.hasOwnProperty.call(arguments[e2], t2) && void 0 === r2[t2] && (r2[t2] = arguments[e2][t2]);
            return r2;
          }, a.prepareContent = function(r2, e2, n2, i2, s2) {
            return u.Promise.resolve(e2).then(function(n3) {
              return o.blob && (n3 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n3))) && "undefined" != typeof FileReader ? new u.Promise(function(t2, r3) {
                var e3 = new FileReader();
                e3.onload = function(e4) {
                  t2(e4.target.result);
                }, e3.onerror = function(e4) {
                  r3(e4.target.error);
                }, e3.readAsArrayBuffer(n3);
              }) : n3;
            }).then(function(e3) {
              var t2 = a.getTypeOf(e3);
              return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = (function(e4) {
                return l2(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length));
              })(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
            });
          };
        }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) {
          "use strict";
          var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support");
          function h(e2) {
            this.files = [], this.loadOptions = e2;
          }
          h.prototype = { checkSignature: function(e2) {
            if (!this.reader.readAndCheckSignature(e2)) {
              this.reader.index -= 4;
              var t2 = this.reader.readString(4);
              throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")");
            }
          }, isSignature: function(e2, t2) {
            var r2 = this.reader.index;
            this.reader.setIndex(e2);
            var n2 = this.reader.readString(4) === t2;
            return this.reader.setIndex(r2), n2;
          }, readBlockEndOfCentral: function() {
            this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2);
            var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2);
            this.zipComment = this.loadOptions.decodeFileName(r2);
          }, readBlockZip64EndOfCentral: function() {
            this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {};
            for (var e2, t2, r2, n2 = this.zip64EndOfCentralSize - 44; 0 < n2; ) e2 = this.reader.readInt(2), t2 = this.reader.readInt(4), r2 = this.reader.readData(t2), this.zip64ExtensibleData[e2] = { id: e2, length: t2, value: r2 };
          }, readBlockZip64EndOfCentralLocator: function() {
            if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) throw new Error("Multi-volumes zip are not supported");
          }, readLocalFiles: function() {
            var e2, t2;
            for (e2 = 0; e2 < this.files.length; e2++) t2 = this.files[e2], this.reader.setIndex(t2.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t2.readLocalPart(this.reader), t2.handleUTF8(), t2.processAttributes();
          }, readCentralDir: function() {
            var e2;
            for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); ) (e2 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e2);
            if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
          }, readEndOfCentral: function() {
            var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);
            if (e2 < 0) throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory");
            this.reader.setIndex(e2);
            var t2 = e2;
            if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) {
              if (this.zip64 = true, (e2 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
              if (this.reader.setIndex(e2), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
              this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
            }
            var r2 = this.centralDirOffset + this.centralDirSize;
            this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize);
            var n2 = t2 - r2;
            if (0 < n2) this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2);
            else if (n2 < 0) throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes.");
          }, prepareReader: function(e2) {
            this.reader = n(e2);
          }, load: function(e2) {
            this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
          } }, t.exports = h;
        }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) {
          "use strict";
          var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support");
          function l2(e2, t2) {
            this.options = e2, this.loadOptions = t2;
          }
          l2.prototype = { isEncrypted: function() {
            return 1 == (1 & this.bitFlag);
          }, useUTF8: function() {
            return 2048 == (2048 & this.bitFlag);
          }, readLocalPart: function(e2) {
            var t2, r2;
            if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");
            if (null === (t2 = (function(e3) {
              for (var t3 in h) if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) return h[t3];
              return null;
            })(this.compressionMethod))) throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")");
            this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize));
          }, readCentralPart: function(e2) {
            this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4);
            var t2 = e2.readInt(2);
            if (this.extraFieldsLength = e2.readInt(2), this.fileCommentLength = e2.readInt(2), this.diskNumberStart = e2.readInt(2), this.internalFileAttributes = e2.readInt(2), this.externalFileAttributes = e2.readInt(4), this.localHeaderOffset = e2.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported");
            e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength);
          }, processAttributes: function() {
            this.unixPermissions = null, this.dosPermissions = null;
            var e2 = this.versionMadeBy >> 8;
            this.dir = !!(16 & this.externalFileAttributes), 0 == e2 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e2 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true);
          }, parseZIP64ExtraField: function() {
            if (this.extraFields[1]) {
              var e2 = n(this.extraFields[1].value);
              this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e2.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e2.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e2.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e2.readInt(4));
            }
          }, readExtraFields: function(e2) {
            var t2, r2, n2, i2 = e2.index + this.extraFieldsLength;
            for (this.extraFields || (this.extraFields = {}); e2.index + 4 < i2; ) t2 = e2.readInt(2), r2 = e2.readInt(2), n2 = e2.readData(r2), this.extraFields[t2] = { id: t2, length: r2, value: n2 };
            e2.setIndex(i2);
          }, handleUTF8: function() {
            var e2 = u.uint8array ? "uint8array" : "array";
            if (this.useUTF8()) this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment);
            else {
              var t2 = this.findExtraFieldUnicodePath();
              if (null !== t2) this.fileNameStr = t2;
              else {
                var r2 = s.transformTo(e2, this.fileName);
                this.fileNameStr = this.loadOptions.decodeFileName(r2);
              }
              var n2 = this.findExtraFieldUnicodeComment();
              if (null !== n2) this.fileCommentStr = n2;
              else {
                var i2 = s.transformTo(e2, this.fileComment);
                this.fileCommentStr = this.loadOptions.decodeFileName(i2);
              }
            }
          }, findExtraFieldUnicodePath: function() {
            var e2 = this.extraFields[28789];
            if (e2) {
              var t2 = n(e2.value);
              return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5));
            }
            return null;
          }, findExtraFieldUnicodeComment: function() {
            var e2 = this.extraFields[25461];
            if (e2) {
              var t2 = n(e2.value);
              return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5));
            }
            return null;
          } }, t.exports = l2;
        }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) {
          "use strict";
          function n(e2, t2, r2) {
            this.name = e2, this.dir = r2.dir, this.date = r2.date, this.comment = r2.comment, this.unixPermissions = r2.unixPermissions, this.dosPermissions = r2.dosPermissions, this._data = t2, this._dataBinary = r2.binary, this.options = { compression: r2.compression, compressionOptions: r2.compressionOptions };
          }
          var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker");
          n.prototype = { internalStream: function(e2) {
            var t2 = null, r2 = "string";
            try {
              if (!e2) throw new Error("No output type specified.");
              var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2;
              "binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker();
              var i2 = !this._dataBinary;
              i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker()));
            } catch (e3) {
              (t2 = new h("error")).error(e3);
            }
            return new s(t2, r2, "");
          }, async: function(e2, t2) {
            return this.internalStream(e2).accumulate(t2);
          }, nodeStream: function(e2, t2) {
            return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2);
          }, _compressWorker: function(e2, t2) {
            if (this._data instanceof o && this._data.compression.magic === e2.magic) return this._data.getCompressedWorker();
            var r2 = this._decompressWorker();
            return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2);
          }, _decompressWorker: function() {
            return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data);
          } };
          for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l2 = function() {
            throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
          }, f = 0; f < u.length; f++) n.prototype[u[f]] = l2;
          t.exports = n;
        }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l2, t) {
          (function(t2) {
            "use strict";
            var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver;
            if (e2) {
              var i = 0, s = new e2(u), a = t2.document.createTextNode("");
              s.observe(a, { characterData: true }), r = function() {
                a.data = i = ++i % 2;
              };
            } else if (t2.setImmediate || void 0 === t2.MessageChannel) r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() {
              var e3 = t2.document.createElement("script");
              e3.onreadystatechange = function() {
                u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null;
              }, t2.document.documentElement.appendChild(e3);
            } : function() {
              setTimeout(u, 0);
            };
            else {
              var o = new t2.MessageChannel();
              o.port1.onmessage = u, r = function() {
                o.port2.postMessage(0);
              };
            }
            var h = [];
            function u() {
              var e3, t3;
              n = true;
              for (var r2 = h.length; r2; ) {
                for (t3 = h, h = [], e3 = -1; ++e3 < r2; ) t3[e3]();
                r2 = h.length;
              }
              n = false;
            }
            l2.exports = function(e3) {
              1 !== h.push(e3) || n || r();
            };
          }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
        }, {}], 37: [function(e, t, r) {
          "use strict";
          var i = e("immediate");
          function u() {
          }
          var l2 = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"];
          function o(e2) {
            if ("function" != typeof e2) throw new TypeError("resolver must be a function");
            this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2);
          }
          function h(e2, t2, r2) {
            this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected);
          }
          function f(t2, r2, n2) {
            i(function() {
              var e2;
              try {
                e2 = r2(n2);
              } catch (e3) {
                return l2.reject(t2, e3);
              }
              e2 === t2 ? l2.reject(t2, new TypeError("Cannot resolve promise with itself")) : l2.resolve(t2, e2);
            });
          }
          function c(e2) {
            var t2 = e2 && e2.then;
            if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2) return function() {
              t2.apply(e2, arguments);
            };
          }
          function d(t2, e2) {
            var r2 = false;
            function n2(e3) {
              r2 || (r2 = true, l2.reject(t2, e3));
            }
            function i2(e3) {
              r2 || (r2 = true, l2.resolve(t2, e3));
            }
            var s2 = p(function() {
              e2(i2, n2);
            });
            "error" === s2.status && n2(s2.value);
          }
          function p(e2, t2) {
            var r2 = {};
            try {
              r2.value = e2(t2), r2.status = "success";
            } catch (e3) {
              r2.status = "error", r2.value = e3;
            }
            return r2;
          }
          (t.exports = o).prototype.finally = function(t2) {
            if ("function" != typeof t2) return this;
            var r2 = this.constructor;
            return this.then(function(e2) {
              return r2.resolve(t2()).then(function() {
                return e2;
              });
            }, function(e2) {
              return r2.resolve(t2()).then(function() {
                throw e2;
              });
            });
          }, o.prototype.catch = function(e2) {
            return this.then(null, e2);
          }, o.prototype.then = function(e2, t2) {
            if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s) return this;
            var r2 = new this.constructor(u);
            this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2));
            return r2;
          }, h.prototype.callFulfilled = function(e2) {
            l2.resolve(this.promise, e2);
          }, h.prototype.otherCallFulfilled = function(e2) {
            f(this.promise, this.onFulfilled, e2);
          }, h.prototype.callRejected = function(e2) {
            l2.reject(this.promise, e2);
          }, h.prototype.otherCallRejected = function(e2) {
            f(this.promise, this.onRejected, e2);
          }, l2.resolve = function(e2, t2) {
            var r2 = p(c, t2);
            if ("error" === r2.status) return l2.reject(e2, r2.value);
            var n2 = r2.value;
            if (n2) d(e2, n2);
            else {
              e2.state = a, e2.outcome = t2;
              for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; ) e2.queue[i2].callFulfilled(t2);
            }
            return e2;
          }, l2.reject = function(e2, t2) {
            e2.state = s, e2.outcome = t2;
            for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; ) e2.queue[r2].callRejected(t2);
            return e2;
          }, o.resolve = function(e2) {
            if (e2 instanceof this) return e2;
            return l2.resolve(new this(u), e2);
          }, o.reject = function(e2) {
            var t2 = new this(u);
            return l2.reject(t2, e2);
          }, o.all = function(e2) {
            var r2 = this;
            if ("[object Array]" !== Object.prototype.toString.call(e2)) return this.reject(new TypeError("must be an array"));
            var n2 = e2.length, i2 = false;
            if (!n2) return this.resolve([]);
            var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u);
            for (; ++t2 < n2; ) h2(e2[t2], t2);
            return o2;
            function h2(e3, t3) {
              r2.resolve(e3).then(function(e4) {
                s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l2.resolve(o2, s2));
              }, function(e4) {
                i2 || (i2 = true, l2.reject(o2, e4));
              });
            }
          }, o.race = function(e2) {
            var t2 = this;
            if ("[object Array]" !== Object.prototype.toString.call(e2)) return this.reject(new TypeError("must be an array"));
            var r2 = e2.length, n2 = false;
            if (!r2) return this.resolve([]);
            var i2 = -1, s2 = new this(u);
            for (; ++i2 < r2; ) a2 = e2[i2], t2.resolve(a2).then(function(e3) {
              n2 || (n2 = true, l2.resolve(s2, e3));
            }, function(e3) {
              n2 || (n2 = true, l2.reject(s2, e3));
            });
            var a2;
            return s2;
          };
        }, { immediate: 36 }], 38: [function(e, t, r) {
          "use strict";
          var n = {};
          (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n;
        }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) {
          "use strict";
          var a = e("./zlib/deflate"), o = e("./utils/common"), h = e("./utils/strings"), i = e("./zlib/messages"), s = e("./zlib/zstream"), u = Object.prototype.toString, l2 = 0, f = -1, c = 0, d = 8;
          function p(e2) {
            if (!(this instanceof p)) return new p(e2);
            this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {});
            var t2 = this.options;
            t2.raw && 0 < t2.windowBits ? t2.windowBits = -t2.windowBits : t2.gzip && 0 < t2.windowBits && t2.windowBits < 16 && (t2.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0;
            var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy);
            if (r2 !== l2) throw new Error(i[r2]);
            if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) {
              var n2;
              if (n2 = "string" == typeof t2.dictionary ? h.string2buf(t2.dictionary) : "[object ArrayBuffer]" === u.call(t2.dictionary) ? new Uint8Array(t2.dictionary) : t2.dictionary, (r2 = a.deflateSetDictionary(this.strm, n2)) !== l2) throw new Error(i[r2]);
              this._dict_set = true;
            }
          }
          function n(e2, t2) {
            var r2 = new p(t2);
            if (r2.push(e2, true), r2.err) throw r2.msg || i[r2.err];
            return r2.result;
          }
          p.prototype.push = function(e2, t2) {
            var r2, n2, i2 = this.strm, s2 = this.options.chunkSize;
            if (this.ended) return false;
            n2 = t2 === ~~t2 ? t2 : true === t2 ? 4 : 0, "string" == typeof e2 ? i2.input = h.string2buf(e2) : "[object ArrayBuffer]" === u.call(e2) ? i2.input = new Uint8Array(e2) : i2.input = e2, i2.next_in = 0, i2.avail_in = i2.input.length;
            do {
              if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r2 = a.deflate(i2, n2)) && r2 !== l2) return this.onEnd(r2), !(this.ended = true);
              0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n2 && 2 !== n2) || ("string" === this.options.to ? this.onData(h.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out)));
            } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2);
            return 4 === n2 ? (r2 = a.deflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === l2) : 2 !== n2 || (this.onEnd(l2), !(i2.avail_out = 0));
          }, p.prototype.onData = function(e2) {
            this.chunks.push(e2);
          }, p.prototype.onEnd = function(e2) {
            e2 === l2 && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg;
          }, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) {
            return (t2 = t2 || {}).raw = true, n(e2, t2);
          }, r.gzip = function(e2, t2) {
            return (t2 = t2 || {}).gzip = true, n(e2, t2);
          };
        }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) {
          "use strict";
          var c = e("./zlib/inflate"), d = e("./utils/common"), p = e("./utils/strings"), m = e("./zlib/constants"), n = e("./zlib/messages"), i = e("./zlib/zstream"), s = e("./zlib/gzheader"), _3 = Object.prototype.toString;
          function a(e2) {
            if (!(this instanceof a)) return new a(e2);
            this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {});
            var t2 = this.options;
            t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits && (t2.windowBits = -15)), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0;
            var r2 = c.inflateInit2(this.strm, t2.windowBits);
            if (r2 !== m.Z_OK) throw new Error(n[r2]);
            this.header = new s(), c.inflateGetHeader(this.strm, this.header);
          }
          function o(e2, t2) {
            var r2 = new a(t2);
            if (r2.push(e2, true), r2.err) throw r2.msg || n[r2.err];
            return r2.result;
          }
          a.prototype.push = function(e2, t2) {
            var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l2 = this.options.dictionary, f = false;
            if (this.ended) return false;
            n2 = t2 === ~~t2 ? t2 : true === t2 ? m.Z_FINISH : m.Z_NO_FLUSH, "string" == typeof e2 ? h.input = p.binstring2buf(e2) : "[object ArrayBuffer]" === _3.call(e2) ? h.input = new Uint8Array(e2) : h.input = e2, h.next_in = 0, h.avail_in = h.input.length;
            do {
              if (0 === h.avail_out && (h.output = new d.Buf8(u), h.next_out = 0, h.avail_out = u), (r2 = c.inflate(h, m.Z_NO_FLUSH)) === m.Z_NEED_DICT && l2 && (o2 = "string" == typeof l2 ? p.string2buf(l2) : "[object ArrayBuffer]" === _3.call(l2) ? new Uint8Array(l2) : l2, r2 = c.inflateSetDictionary(this.strm, o2)), r2 === m.Z_BUF_ERROR && true === f && (r2 = m.Z_OK, f = false), r2 !== m.Z_STREAM_END && r2 !== m.Z_OK) return this.onEnd(r2), !(this.ended = true);
              h.next_out && (0 !== h.avail_out && r2 !== m.Z_STREAM_END && (0 !== h.avail_in || n2 !== m.Z_FINISH && n2 !== m.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h.output, h.next_out), s2 = h.next_out - i2, a2 = p.buf2string(h.output, i2), h.next_out = s2, h.avail_out = u - s2, s2 && d.arraySet(h.output, h.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = true);
            } while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END);
            return r2 === m.Z_STREAM_END && (n2 = m.Z_FINISH), n2 === m.Z_FINISH ? (r2 = c.inflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === m.Z_OK) : n2 !== m.Z_SYNC_FLUSH || (this.onEnd(m.Z_OK), !(h.avail_out = 0));
          }, a.prototype.onData = function(e2) {
            this.chunks.push(e2);
          }, a.prototype.onEnd = function(e2) {
            e2 === m.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg;
          }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) {
            return (t2 = t2 || {}).raw = true, o(e2, t2);
          }, r.ungzip = o;
        }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, t, r) {
          "use strict";
          var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array;
          r.assign = function(e2) {
            for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) {
              var r2 = t2.shift();
              if (r2) {
                if ("object" != typeof r2) throw new TypeError(r2 + "must be non-object");
                for (var n2 in r2) r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]);
              }
            }
            return e2;
          }, r.shrinkBuf = function(e2, t2) {
            return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2);
          };
          var i = { arraySet: function(e2, t2, r2, n2, i2) {
            if (t2.subarray && e2.subarray) e2.set(t2.subarray(r2, r2 + n2), i2);
            else for (var s2 = 0; s2 < n2; s2++) e2[i2 + s2] = t2[r2 + s2];
          }, flattenChunks: function(e2) {
            var t2, r2, n2, i2, s2, a;
            for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++) n2 += e2[t2].length;
            for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++) s2 = e2[t2], a.set(s2, i2), i2 += s2.length;
            return a;
          } }, s = { arraySet: function(e2, t2, r2, n2, i2) {
            for (var s2 = 0; s2 < n2; s2++) e2[i2 + s2] = t2[r2 + s2];
          }, flattenChunks: function(e2) {
            return [].concat.apply([], e2);
          } };
          r.setTyped = function(e2) {
            e2 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s));
          }, r.setTyped(n);
        }, {}], 42: [function(e, t, r) {
          "use strict";
          var h = e("./common"), i = true, s = true;
          try {
            String.fromCharCode.apply(null, [0]);
          } catch (e2) {
            i = false;
          }
          try {
            String.fromCharCode.apply(null, new Uint8Array(1));
          } catch (e2) {
            s = false;
          }
          for (var u = new h.Buf8(256), n = 0; n < 256; n++) u[n] = 252 <= n ? 6 : 248 <= n ? 5 : 240 <= n ? 4 : 224 <= n ? 3 : 192 <= n ? 2 : 1;
          function l2(e2, t2) {
            if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i)) return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2));
            for (var r2 = "", n2 = 0; n2 < t2; n2++) r2 += String.fromCharCode(e2[n2]);
            return r2;
          }
          u[254] = u[254] = 1, r.string2buf = function(e2) {
            var t2, r2, n2, i2, s2, a = e2.length, o = 0;
            for (i2 = 0; i2 < a; i2++) 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4;
            for (t2 = new h.Buf8(o), i2 = s2 = 0; s2 < o; i2++) 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2);
            return t2;
          }, r.buf2binstring = function(e2) {
            return l2(e2, e2.length);
          }, r.binstring2buf = function(e2) {
            for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++) t2[r2] = e2.charCodeAt(r2);
            return t2;
          }, r.buf2string = function(e2, t2) {
            var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a);
            for (r2 = n2 = 0; r2 < a; ) if ((i2 = e2[r2++]) < 128) o[n2++] = i2;
            else if (4 < (s2 = u[i2])) o[n2++] = 65533, r2 += s2 - 1;
            else {
              for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; ) i2 = i2 << 6 | 63 & e2[r2++], s2--;
              1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2);
            }
            return l2(o, n2);
          }, r.utf8border = function(e2, t2) {
            var r2;
            for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); ) r2--;
            return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2;
          };
        }, { "./common": 41 }], 43: [function(e, t, r) {
          "use strict";
          t.exports = function(e2, t2, r2, n) {
            for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) {
              for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; ) ;
              i %= 65521, s %= 65521;
            }
            return i | s << 16 | 0;
          };
        }, {}], 44: [function(e, t, r) {
          "use strict";
          t.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 };
        }, {}], 45: [function(e, t, r) {
          "use strict";
          var o = (function() {
            for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
              e2 = r2;
              for (var n = 0; n < 8; n++) e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
              t2[r2] = e2;
            }
            return t2;
          })();
          t.exports = function(e2, t2, r2, n) {
            var i = o, s = n + r2;
            e2 ^= -1;
            for (var a = n; a < s; a++) e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])];
            return -1 ^ e2;
          };
        }, {}], 46: [function(e, t, r) {
          "use strict";
          var h, c = e("../utils/common"), u = e("./trees"), d = e("./adler32"), p = e("./crc32"), n = e("./messages"), l2 = 0, f = 4, m = 0, _3 = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4;
          function R(e2, t2) {
            return e2.msg = n[t2], t2;
          }
          function T(e2) {
            return (e2 << 1) - (4 < e2 ? 9 : 0);
          }
          function D(e2) {
            for (var t2 = e2.length; 0 <= --t2; ) e2[t2] = 0;
          }
          function F(e2) {
            var t2 = e2.state, r2 = t2.pending;
            r2 > e2.avail_out && (r2 = e2.avail_out), 0 !== r2 && (c.arraySet(e2.output, t2.pending_buf, t2.pending_out, r2, e2.next_out), e2.next_out += r2, t2.pending_out += r2, e2.total_out += r2, e2.avail_out -= r2, t2.pending -= r2, 0 === t2.pending && (t2.pending_out = 0));
          }
          function N(e2, t2) {
            u._tr_flush_block(e2, 0 <= e2.block_start ? e2.block_start : -1, e2.strstart - e2.block_start, t2), e2.block_start = e2.strstart, F(e2.strm);
          }
          function U(e2, t2) {
            e2.pending_buf[e2.pending++] = t2;
          }
          function P(e2, t2) {
            e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2;
          }
          function L(e2, t2) {
            var r2, n2, i2 = e2.max_chain_length, s2 = e2.strstart, a2 = e2.prev_length, o2 = e2.nice_match, h2 = e2.strstart > e2.w_size - z ? e2.strstart - (e2.w_size - z) : 0, u2 = e2.window, l3 = e2.w_mask, f2 = e2.prev, c2 = e2.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
            e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead);
            do {
              if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) {
                s2 += 2, r2++;
                do {
                } while (u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && s2 < c2);
                if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) {
                  if (e2.match_start = t2, o2 <= (a2 = n2)) break;
                  d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
                }
              }
            } while ((t2 = f2[t2 & l3]) > h2 && 0 != --i2);
            return a2 <= e2.lookahead ? a2 : e2.lookahead;
          }
          function j(e2) {
            var t2, r2, n2, i2, s2, a2, o2, h2, u2, l3, f2 = e2.w_size;
            do {
              if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) {
                for (c.arraySet(e2.window, e2.window, f2, f2, 0), e2.match_start -= f2, e2.strstart -= f2, e2.block_start -= f2, t2 = r2 = e2.hash_size; n2 = e2.head[--t2], e2.head[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) ;
                for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) ;
                i2 += f2;
              }
              if (0 === e2.strm.avail_in) break;
              if (a2 = e2.strm, o2 = e2.window, h2 = e2.strstart + e2.lookahead, u2 = i2, l3 = void 0, l3 = a2.avail_in, u2 < l3 && (l3 = u2), r2 = 0 === l3 ? 0 : (a2.avail_in -= l3, c.arraySet(o2, a2.input, a2.next_in, l3, h2), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l3, h2) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l3, h2)), a2.next_in += l3, a2.total_in += l3, l3), e2.lookahead += r2, e2.lookahead + e2.insert >= x) for (s2 = e2.strstart - e2.insert, e2.ins_h = e2.window[s2], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + 1]) & e2.hash_mask; e2.insert && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + x - 1]) & e2.hash_mask, e2.prev[s2 & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = s2, s2++, e2.insert--, !(e2.lookahead + e2.insert < x)); ) ;
            } while (e2.lookahead < z && 0 !== e2.strm.avail_in);
          }
          function Z(e2, t2) {
            for (var r2, n2; ; ) {
              if (e2.lookahead < z) {
                if (j(e2), e2.lookahead < z && t2 === l2) return A;
                if (0 === e2.lookahead) break;
              }
              if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 !== r2 && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2)), e2.match_length >= x) if (n2 = u._tr_tally(e2, e2.strstart - e2.match_start, e2.match_length - x), e2.lookahead -= e2.match_length, e2.match_length <= e2.max_lazy_match && e2.lookahead >= x) {
                for (e2.match_length--; e2.strstart++, e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart, 0 != --e2.match_length; ) ;
                e2.strstart++;
              } else e2.strstart += e2.match_length, e2.match_length = 0, e2.ins_h = e2.window[e2.strstart], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + 1]) & e2.hash_mask;
              else n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++;
              if (n2 && (N(e2, false), 0 === e2.strm.avail_out)) return A;
            }
            return e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I;
          }
          function W(e2, t2) {
            for (var r2, n2, i2; ; ) {
              if (e2.lookahead < z) {
                if (j(e2), e2.lookahead < z && t2 === l2) return A;
                if (0 === e2.lookahead) break;
              }
              if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), e2.prev_length = e2.match_length, e2.prev_match = e2.match_start, e2.match_length = x - 1, 0 !== r2 && e2.prev_length < e2.max_lazy_match && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2), e2.match_length <= 5 && (1 === e2.strategy || e2.match_length === x && 4096 < e2.strstart - e2.match_start) && (e2.match_length = x - 1)), e2.prev_length >= x && e2.match_length <= e2.prev_length) {
                for (i2 = e2.strstart + e2.lookahead - x, n2 = u._tr_tally(e2, e2.strstart - 1 - e2.prev_match, e2.prev_length - x), e2.lookahead -= e2.prev_length - 1, e2.prev_length -= 2; ++e2.strstart <= i2 && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 != --e2.prev_length; ) ;
                if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out)) return A;
              } else if (e2.match_available) {
                if ((n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1])) && N(e2, false), e2.strstart++, e2.lookahead--, 0 === e2.strm.avail_out) return A;
              } else e2.match_available = 1, e2.strstart++, e2.lookahead--;
            }
            return e2.match_available && (n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1]), e2.match_available = 0), e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I;
          }
          function M(e2, t2, r2, n2, i2) {
            this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2;
          }
          function H() {
            this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
          }
          function G(e2) {
            var t2;
            return e2 && e2.state ? (e2.total_in = e2.total_out = 0, e2.data_type = i, (t2 = e2.state).pending = 0, t2.pending_out = 0, t2.wrap < 0 && (t2.wrap = -t2.wrap), t2.status = t2.wrap ? C : E, e2.adler = 2 === t2.wrap ? 0 : 1, t2.last_flush = l2, u._tr_init(t2), m) : R(e2, _3);
          }
          function K(e2) {
            var t2 = G(e2);
            return t2 === m && (function(e3) {
              e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0;
            })(e2.state), t2;
          }
          function Y(e2, t2, r2, n2, i2, s2) {
            if (!e2) return _3;
            var a2 = 1;
            if (t2 === g && (t2 = 6), n2 < 0 ? (a2 = 0, n2 = -n2) : 15 < n2 && (a2 = 2, n2 -= 16), i2 < 1 || y < i2 || r2 !== v || n2 < 8 || 15 < n2 || t2 < 0 || 9 < t2 || s2 < 0 || b < s2) return R(e2, _3);
            8 === n2 && (n2 = 9);
            var o2 = new H();
            return (e2.state = o2).strm = e2, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n2, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t2, o2.strategy = s2, o2.method = r2, K(e2);
          }
          h = [new M(0, 0, 0, 0, function(e2, t2) {
            var r2 = 65535;
            for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) {
              if (e2.lookahead <= 1) {
                if (j(e2), 0 === e2.lookahead && t2 === l2) return A;
                if (0 === e2.lookahead) break;
              }
              e2.strstart += e2.lookahead, e2.lookahead = 0;
              var n2 = e2.block_start + r2;
              if ((0 === e2.strstart || e2.strstart >= n2) && (e2.lookahead = e2.strstart - n2, e2.strstart = n2, N(e2, false), 0 === e2.strm.avail_out)) return A;
              if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out)) return A;
            }
            return e2.insert = 0, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : (e2.strstart > e2.block_start && (N(e2, false), e2.strm.avail_out), A);
          }), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e2, t2) {
            return Y(e2, t2, v, 15, 8, 0);
          }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) {
            return e2 && e2.state ? 2 !== e2.state.wrap ? _3 : (e2.state.gzhead = t2, m) : _3;
          }, r.deflate = function(e2, t2) {
            var r2, n2, i2, s2;
            if (!e2 || !e2.state || 5 < t2 || t2 < 0) return e2 ? R(e2, _3) : _3;
            if (n2 = e2.state, !e2.output || !e2.input && 0 !== e2.avail_in || 666 === n2.status && t2 !== f) return R(e2, 0 === e2.avail_out ? -5 : _3);
            if (n2.strm = e2, r2 = n2.last_flush, n2.last_flush = t2, n2.status === C) if (2 === n2.wrap) e2.adler = 0, U(n2, 31), U(n2, 139), U(n2, 8), n2.gzhead ? (U(n2, (n2.gzhead.text ? 1 : 0) + (n2.gzhead.hcrc ? 2 : 0) + (n2.gzhead.extra ? 4 : 0) + (n2.gzhead.name ? 8 : 0) + (n2.gzhead.comment ? 16 : 0)), U(n2, 255 & n2.gzhead.time), U(n2, n2.gzhead.time >> 8 & 255), U(n2, n2.gzhead.time >> 16 & 255), U(n2, n2.gzhead.time >> 24 & 255), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 255 & n2.gzhead.os), n2.gzhead.extra && n2.gzhead.extra.length && (U(n2, 255 & n2.gzhead.extra.length), U(n2, n2.gzhead.extra.length >> 8 & 255)), n2.gzhead.hcrc && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending, 0)), n2.gzindex = 0, n2.status = 69) : (U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 3), n2.status = E);
            else {
              var a2 = v + (n2.w_bits - 8 << 4) << 8;
              a2 |= (2 <= n2.strategy || n2.level < 2 ? 0 : n2.level < 6 ? 1 : 6 === n2.level ? 2 : 3) << 6, 0 !== n2.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n2.status = E, P(n2, a2), 0 !== n2.strstart && (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), e2.adler = 1;
            }
            if (69 === n2.status) if (n2.gzhead.extra) {
              for (i2 = n2.pending; n2.gzindex < (65535 & n2.gzhead.extra.length) && (n2.pending !== n2.pending_buf_size || (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending !== n2.pending_buf_size)); ) U(n2, 255 & n2.gzhead.extra[n2.gzindex]), n2.gzindex++;
              n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), n2.gzindex === n2.gzhead.extra.length && (n2.gzindex = 0, n2.status = 73);
            } else n2.status = 73;
            if (73 === n2.status) if (n2.gzhead.name) {
              i2 = n2.pending;
              do {
                if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) {
                  s2 = 1;
                  break;
                }
                s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2);
              } while (0 !== s2);
              n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.gzindex = 0, n2.status = 91);
            } else n2.status = 91;
            if (91 === n2.status) if (n2.gzhead.comment) {
              i2 = n2.pending;
              do {
                if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) {
                  s2 = 1;
                  break;
                }
                s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2);
              } while (0 !== s2);
              n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103);
            } else n2.status = 103;
            if (103 === n2.status && (n2.gzhead.hcrc ? (n2.pending + 2 > n2.pending_buf_size && F(e2), n2.pending + 2 <= n2.pending_buf_size && (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), e2.adler = 0, n2.status = E)) : n2.status = E), 0 !== n2.pending) {
              if (F(e2), 0 === e2.avail_out) return n2.last_flush = -1, m;
            } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) return R(e2, -5);
            if (666 === n2.status && 0 !== e2.avail_in) return R(e2, -5);
            if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l2 && 666 !== n2.status) {
              var o2 = 2 === n2.strategy ? (function(e3, t3) {
                for (var r3; ; ) {
                  if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) {
                    if (t3 === l2) return A;
                    break;
                  }
                  if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out)) return A;
                }
                return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
              })(n2, t2) : 3 === n2.strategy ? (function(e3, t3) {
                for (var r3, n3, i3, s3, a3 = e3.window; ; ) {
                  if (e3.lookahead <= S) {
                    if (j(e3), e3.lookahead <= S && t3 === l2) return A;
                    if (0 === e3.lookahead) break;
                  }
                  if (e3.match_length = 0, e3.lookahead >= x && 0 < e3.strstart && (n3 = a3[i3 = e3.strstart - 1]) === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]) {
                    s3 = e3.strstart + S;
                    do {
                    } while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && i3 < s3);
                    e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead);
                  }
                  if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out)) return A;
                }
                return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
              })(n2, t2) : h[n2.level].func(n2, t2);
              if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) return 0 === e2.avail_out && (n2.last_flush = -1), m;
              if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out)) return n2.last_flush = -1, m;
            }
            return t2 !== f ? m : n2.wrap <= 0 ? 1 : (2 === n2.wrap ? (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), U(n2, e2.adler >> 16 & 255), U(n2, e2.adler >> 24 & 255), U(n2, 255 & e2.total_in), U(n2, e2.total_in >> 8 & 255), U(n2, e2.total_in >> 16 & 255), U(n2, e2.total_in >> 24 & 255)) : (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), F(e2), 0 < n2.wrap && (n2.wrap = -n2.wrap), 0 !== n2.pending ? m : 1);
          }, r.deflateEnd = function(e2) {
            var t2;
            return e2 && e2.state ? (t2 = e2.state.status) !== C && 69 !== t2 && 73 !== t2 && 91 !== t2 && 103 !== t2 && t2 !== E && 666 !== t2 ? R(e2, _3) : (e2.state = null, t2 === E ? R(e2, -3) : m) : _3;
          }, r.deflateSetDictionary = function(e2, t2) {
            var r2, n2, i2, s2, a2, o2, h2, u2, l3 = t2.length;
            if (!e2 || !e2.state) return _3;
            if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead) return _3;
            for (1 === s2 && (e2.adler = d(e2.adler, t2, l3, 0)), r2.wrap = 0, l3 >= r2.w_size && (0 === s2 && (D(r2.head), r2.strstart = 0, r2.block_start = 0, r2.insert = 0), u2 = new c.Buf8(r2.w_size), c.arraySet(u2, t2, l3 - r2.w_size, r2.w_size, 0), t2 = u2, l3 = r2.w_size), a2 = e2.avail_in, o2 = e2.next_in, h2 = e2.input, e2.avail_in = l3, e2.next_in = 0, e2.input = t2, j(r2); r2.lookahead >= x; ) {
              for (n2 = r2.strstart, i2 = r2.lookahead - (x - 1); r2.ins_h = (r2.ins_h << r2.hash_shift ^ r2.window[n2 + x - 1]) & r2.hash_mask, r2.prev[n2 & r2.w_mask] = r2.head[r2.ins_h], r2.head[r2.ins_h] = n2, n2++, --i2; ) ;
              r2.strstart = n2, r2.lookahead = x - 1, j(r2);
            }
            return r2.strstart += r2.lookahead, r2.block_start = r2.strstart, r2.insert = r2.lookahead, r2.lookahead = 0, r2.match_length = r2.prev_length = x - 1, r2.match_available = 0, e2.next_in = o2, e2.input = h2, e2.avail_in = a2, r2.wrap = s2, m;
          }, r.deflateInfo = "pako deflate (from Nodeca project)";
        }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) {
          "use strict";
          t.exports = function() {
            this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false;
          };
        }, {}], 48: [function(e, t, r) {
          "use strict";
          t.exports = function(e2, t2) {
            var r2, n, i, s, a, o, h, u, l2, f, c, d, p, m, _3, g, b, v, y, w, k, x, S, z, C;
            r2 = e2.state, n = e2.next_in, z = e2.input, i = n + (e2.avail_in - 5), s = e2.next_out, C = e2.output, a = s - (t2 - e2.avail_out), o = s + (e2.avail_out - 257), h = r2.dmax, u = r2.wsize, l2 = r2.whave, f = r2.wnext, c = r2.window, d = r2.hold, p = r2.bits, m = r2.lencode, _3 = r2.distcode, g = (1 << r2.lenbits) - 1, b = (1 << r2.distbits) - 1;
            e: do {
              p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g];
              t: for (; ; ) {
                if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) C[s++] = 65535 & v;
                else {
                  if (!(16 & y)) {
                    if (0 == (64 & y)) {
                      v = m[(65535 & v) + (d & (1 << y) - 1)];
                      continue t;
                    }
                    if (32 & y) {
                      r2.mode = 12;
                      break e;
                    }
                    e2.msg = "invalid literal/length code", r2.mode = 30;
                    break e;
                  }
                  w = 65535 & v, (y &= 15) && (p < y && (d += z[n++] << p, p += 8), w += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = _3[d & b];
                  r: for (; ; ) {
                    if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) {
                      if (0 == (64 & y)) {
                        v = _3[(65535 & v) + (d & (1 << y) - 1)];
                        continue r;
                      }
                      e2.msg = "invalid distance code", r2.mode = 30;
                      break e;
                    }
                    if (k = 65535 & v, p < (y &= 15) && (d += z[n++] << p, (p += 8) < y && (d += z[n++] << p, p += 8)), h < (k += d & (1 << y) - 1)) {
                      e2.msg = "invalid distance too far back", r2.mode = 30;
                      break e;
                    }
                    if (d >>>= y, p -= y, (y = s - a) < k) {
                      if (l2 < (y = k - y) && r2.sane) {
                        e2.msg = "invalid distance too far back", r2.mode = 30;
                        break e;
                      }
                      if (S = c, (x = 0) === f) {
                        if (x += u - y, y < w) {
                          for (w -= y; C[s++] = c[x++], --y; ) ;
                          x = s - k, S = C;
                        }
                      } else if (f < y) {
                        if (x += u + f - y, (y -= f) < w) {
                          for (w -= y; C[s++] = c[x++], --y; ) ;
                          if (x = 0, f < w) {
                            for (w -= y = f; C[s++] = c[x++], --y; ) ;
                            x = s - k, S = C;
                          }
                        }
                      } else if (x += f - y, y < w) {
                        for (w -= y; C[s++] = c[x++], --y; ) ;
                        x = s - k, S = C;
                      }
                      for (; 2 < w; ) C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3;
                      w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++]));
                    } else {
                      for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); ) ;
                      w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++]));
                    }
                    break;
                  }
                }
                break;
              }
            } while (n < i && s < o);
            n -= w = p >> 3, d &= (1 << (p -= w << 3)) - 1, e2.next_in = n, e2.next_out = s, e2.avail_in = n < i ? i - n + 5 : 5 - (n - i), e2.avail_out = s < o ? o - s + 257 : 257 - (s - o), r2.hold = d, r2.bits = p;
          };
        }, {}], 49: [function(e, t, r) {
          "use strict";
          var I = e("../utils/common"), O = e("./adler32"), B = e("./crc32"), R = e("./inffast"), T = e("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n = 852, i = 592;
          function L(e2) {
            return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24);
          }
          function s() {
            this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
          }
          function a(e2) {
            var t2;
            return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = P, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new I.Buf32(n), t2.distcode = t2.distdyn = new I.Buf32(i), t2.sane = 1, t2.back = -1, N) : U;
          }
          function o(e2) {
            var t2;
            return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U;
          }
          function h(e2, t2) {
            var r2, n2;
            return e2 && e2.state ? (n2 = e2.state, t2 < 0 ? (r2 = 0, t2 = -t2) : (r2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2) ? U : (null !== n2.window && n2.wbits !== t2 && (n2.window = null), n2.wrap = r2, n2.wbits = t2, o(e2))) : U;
          }
          function u(e2, t2) {
            var r2, n2;
            return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U;
          }
          var l2, f, c = true;
          function j(e2) {
            if (c) {
              var t2;
              for (l2 = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; ) e2.lens[t2++] = 8;
              for (; t2 < 256; ) e2.lens[t2++] = 9;
              for (; t2 < 280; ) e2.lens[t2++] = 7;
              for (; t2 < 288; ) e2.lens[t2++] = 8;
              for (T(D, e2.lens, 0, 288, l2, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; ) e2.lens[t2++] = 5;
              T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false;
            }
            e2.lencode = l2, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5;
          }
          function Z(e2, t2, r2, n2) {
            var i2, s2 = e2.state;
            return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n2 >= s2.wsize ? (I.arraySet(s2.window, t2, r2 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n2 < (i2 = s2.wsize - s2.wnext) && (i2 = n2), I.arraySet(s2.window, t2, r2 - n2, i2, s2.wnext), (n2 -= i2) ? (I.arraySet(s2.window, t2, r2 - n2, n2, 0), s2.wnext = n2, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0;
          }
          r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) {
            return u(e2, 15);
          }, r.inflateInit2 = u, r.inflate = function(e2, t2) {
            var r2, n2, i2, s2, a2, o2, h2, u2, l3, f2, c2, d, p, m, _3, g, b, v, y, w, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
            if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) return U;
            12 === (r2 = e2.state).mode && (r2.mode = 13), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l3 = r2.bits, f2 = o2, c2 = h2, x = N;
            e: for (; ; ) switch (r2.mode) {
              case P:
                if (0 === r2.wrap) {
                  r2.mode = 13;
                  break;
                }
                for (; l3 < 16; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                if (2 & r2.wrap && 35615 === u2) {
                  E[r2.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0), l3 = u2 = 0, r2.mode = 2;
                  break;
                }
                if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) {
                  e2.msg = "incorrect header check", r2.mode = 30;
                  break;
                }
                if (8 != (15 & u2)) {
                  e2.msg = "unknown compression method", r2.mode = 30;
                  break;
                }
                if (l3 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits) r2.wbits = k;
                else if (k > r2.wbits) {
                  e2.msg = "invalid window size", r2.mode = 30;
                  break;
                }
                r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l3 = u2 = 0;
                break;
              case 2:
                for (; l3 < 16; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                if (r2.flags = u2, 8 != (255 & r2.flags)) {
                  e2.msg = "unknown compression method", r2.mode = 30;
                  break;
                }
                if (57344 & r2.flags) {
                  e2.msg = "unknown header flags set", r2.mode = 30;
                  break;
                }
                r2.head && (r2.head.text = u2 >> 8 & 1), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l3 = u2 = 0, r2.mode = 3;
              case 3:
                for (; l3 < 32; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                r2.head && (r2.head.time = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r2.check = B(r2.check, E, 4, 0)), l3 = u2 = 0, r2.mode = 4;
              case 4:
                for (; l3 < 16; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                r2.head && (r2.head.xflags = 255 & u2, r2.head.os = u2 >> 8), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l3 = u2 = 0, r2.mode = 5;
              case 5:
                if (1024 & r2.flags) {
                  for (; l3 < 16; ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  r2.length = u2, r2.head && (r2.head.extra_len = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l3 = u2 = 0;
                } else r2.head && (r2.head.extra = null);
                r2.mode = 6;
              case 6:
                if (1024 & r2.flags && (o2 < (d = r2.length) && (d = o2), d && (r2.head && (k = r2.head.extra_len - r2.length, r2.head.extra || (r2.head.extra = new Array(r2.head.extra_len)), I.arraySet(r2.head.extra, n2, s2, d, k)), 512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, r2.length -= d), r2.length)) break e;
                r2.length = 0, r2.mode = 7;
              case 7:
                if (2048 & r2.flags) {
                  if (0 === o2) break e;
                  for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; ) ;
                  if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) break e;
                } else r2.head && (r2.head.name = null);
                r2.length = 0, r2.mode = 8;
              case 8:
                if (4096 & r2.flags) {
                  if (0 === o2) break e;
                  for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; ) ;
                  if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) break e;
                } else r2.head && (r2.head.comment = null);
                r2.mode = 9;
              case 9:
                if (512 & r2.flags) {
                  for (; l3 < 16; ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  if (u2 !== (65535 & r2.check)) {
                    e2.msg = "header crc mismatch", r2.mode = 30;
                    break;
                  }
                  l3 = u2 = 0;
                }
                r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12;
                break;
              case 10:
                for (; l3 < 32; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                e2.adler = r2.check = L(u2), l3 = u2 = 0, r2.mode = 11;
              case 11:
                if (0 === r2.havedict) return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l3, 2;
                e2.adler = r2.check = 1, r2.mode = 12;
              case 12:
                if (5 === t2 || 6 === t2) break e;
              case 13:
                if (r2.last) {
                  u2 >>>= 7 & l3, l3 -= 7 & l3, r2.mode = 27;
                  break;
                }
                for (; l3 < 3; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                switch (r2.last = 1 & u2, l3 -= 1, 3 & (u2 >>>= 1)) {
                  case 0:
                    r2.mode = 14;
                    break;
                  case 1:
                    if (j(r2), r2.mode = 20, 6 !== t2) break;
                    u2 >>>= 2, l3 -= 2;
                    break e;
                  case 2:
                    r2.mode = 17;
                    break;
                  case 3:
                    e2.msg = "invalid block type", r2.mode = 30;
                }
                u2 >>>= 2, l3 -= 2;
                break;
              case 14:
                for (u2 >>>= 7 & l3, l3 -= 7 & l3; l3 < 32; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                if ((65535 & u2) != (u2 >>> 16 ^ 65535)) {
                  e2.msg = "invalid stored block lengths", r2.mode = 30;
                  break;
                }
                if (r2.length = 65535 & u2, l3 = u2 = 0, r2.mode = 15, 6 === t2) break e;
              case 15:
                r2.mode = 16;
              case 16:
                if (d = r2.length) {
                  if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d) break e;
                  I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d;
                  break;
                }
                r2.mode = 12;
                break;
              case 17:
                for (; l3 < 14; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                if (r2.nlen = 257 + (31 & u2), u2 >>>= 5, l3 -= 5, r2.ndist = 1 + (31 & u2), u2 >>>= 5, l3 -= 5, r2.ncode = 4 + (15 & u2), u2 >>>= 4, l3 -= 4, 286 < r2.nlen || 30 < r2.ndist) {
                  e2.msg = "too many length or distance symbols", r2.mode = 30;
                  break;
                }
                r2.have = 0, r2.mode = 18;
              case 18:
                for (; r2.have < r2.ncode; ) {
                  for (; l3 < 3; ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  r2.lens[A[r2.have++]] = 7 & u2, u2 >>>= 3, l3 -= 3;
                }
                for (; r2.have < 19; ) r2.lens[A[r2.have++]] = 0;
                if (r2.lencode = r2.lendyn, r2.lenbits = 7, S = { bits: r2.lenbits }, x = T(0, r2.lens, 0, 19, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) {
                  e2.msg = "invalid code lengths set", r2.mode = 30;
                  break;
                }
                r2.have = 0, r2.mode = 19;
              case 19:
                for (; r2.have < r2.nlen + r2.ndist; ) {
                  for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_3 = C >>> 24) <= l3); ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  if (b < 16) u2 >>>= _3, l3 -= _3, r2.lens[r2.have++] = b;
                  else {
                    if (16 === b) {
                      for (z = _3 + 2; l3 < z; ) {
                        if (0 === o2) break e;
                        o2--, u2 += n2[s2++] << l3, l3 += 8;
                      }
                      if (u2 >>>= _3, l3 -= _3, 0 === r2.have) {
                        e2.msg = "invalid bit length repeat", r2.mode = 30;
                        break;
                      }
                      k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l3 -= 2;
                    } else if (17 === b) {
                      for (z = _3 + 3; l3 < z; ) {
                        if (0 === o2) break e;
                        o2--, u2 += n2[s2++] << l3, l3 += 8;
                      }
                      l3 -= _3, k = 0, d = 3 + (7 & (u2 >>>= _3)), u2 >>>= 3, l3 -= 3;
                    } else {
                      for (z = _3 + 7; l3 < z; ) {
                        if (0 === o2) break e;
                        o2--, u2 += n2[s2++] << l3, l3 += 8;
                      }
                      l3 -= _3, k = 0, d = 11 + (127 & (u2 >>>= _3)), u2 >>>= 7, l3 -= 7;
                    }
                    if (r2.have + d > r2.nlen + r2.ndist) {
                      e2.msg = "invalid bit length repeat", r2.mode = 30;
                      break;
                    }
                    for (; d--; ) r2.lens[r2.have++] = k;
                  }
                }
                if (30 === r2.mode) break;
                if (0 === r2.lens[256]) {
                  e2.msg = "invalid code -- missing end-of-block", r2.mode = 30;
                  break;
                }
                if (r2.lenbits = 9, S = { bits: r2.lenbits }, x = T(D, r2.lens, 0, r2.nlen, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) {
                  e2.msg = "invalid literal/lengths set", r2.mode = 30;
                  break;
                }
                if (r2.distbits = 6, r2.distcode = r2.distdyn, S = { bits: r2.distbits }, x = T(F, r2.lens, r2.nlen, r2.ndist, r2.distcode, 0, r2.work, S), r2.distbits = S.bits, x) {
                  e2.msg = "invalid distances set", r2.mode = 30;
                  break;
                }
                if (r2.mode = 20, 6 === t2) break e;
              case 20:
                r2.mode = 21;
              case 21:
                if (6 <= o2 && 258 <= h2) {
                  e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l3, R(e2, c2), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l3 = r2.bits, 12 === r2.mode && (r2.back = -1);
                  break;
                }
                for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_3 = C >>> 24) <= l3); ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                if (g && 0 == (240 & g)) {
                  for (v = _3, y = g, w = b; g = (C = r2.lencode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_3 = C >>> 24) <= l3); ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  u2 >>>= v, l3 -= v, r2.back += v;
                }
                if (u2 >>>= _3, l3 -= _3, r2.back += _3, r2.length = b, 0 === g) {
                  r2.mode = 26;
                  break;
                }
                if (32 & g) {
                  r2.back = -1, r2.mode = 12;
                  break;
                }
                if (64 & g) {
                  e2.msg = "invalid literal/length code", r2.mode = 30;
                  break;
                }
                r2.extra = 15 & g, r2.mode = 22;
              case 22:
                if (r2.extra) {
                  for (z = r2.extra; l3 < z; ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l3 -= r2.extra, r2.back += r2.extra;
                }
                r2.was = r2.length, r2.mode = 23;
              case 23:
                for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_3 = C >>> 24) <= l3); ) {
                  if (0 === o2) break e;
                  o2--, u2 += n2[s2++] << l3, l3 += 8;
                }
                if (0 == (240 & g)) {
                  for (v = _3, y = g, w = b; g = (C = r2.distcode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_3 = C >>> 24) <= l3); ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  u2 >>>= v, l3 -= v, r2.back += v;
                }
                if (u2 >>>= _3, l3 -= _3, r2.back += _3, 64 & g) {
                  e2.msg = "invalid distance code", r2.mode = 30;
                  break;
                }
                r2.offset = b, r2.extra = 15 & g, r2.mode = 24;
              case 24:
                if (r2.extra) {
                  for (z = r2.extra; l3 < z; ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l3 -= r2.extra, r2.back += r2.extra;
                }
                if (r2.offset > r2.dmax) {
                  e2.msg = "invalid distance too far back", r2.mode = 30;
                  break;
                }
                r2.mode = 25;
              case 25:
                if (0 === h2) break e;
                if (d = c2 - h2, r2.offset > d) {
                  if ((d = r2.offset - d) > r2.whave && r2.sane) {
                    e2.msg = "invalid distance too far back", r2.mode = 30;
                    break;
                  }
                  p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window;
                } else m = i2, p = a2 - r2.offset, d = r2.length;
                for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; ) ;
                0 === r2.length && (r2.mode = 21);
                break;
              case 26:
                if (0 === h2) break e;
                i2[a2++] = r2.length, h2--, r2.mode = 21;
                break;
              case 27:
                if (r2.wrap) {
                  for (; l3 < 32; ) {
                    if (0 === o2) break e;
                    o2--, u2 |= n2[s2++] << l3, l3 += 8;
                  }
                  if (c2 -= h2, e2.total_out += c2, r2.total += c2, c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, a2 - c2) : O(r2.check, i2, c2, a2 - c2)), c2 = h2, (r2.flags ? u2 : L(u2)) !== r2.check) {
                    e2.msg = "incorrect data check", r2.mode = 30;
                    break;
                  }
                  l3 = u2 = 0;
                }
                r2.mode = 28;
              case 28:
                if (r2.wrap && r2.flags) {
                  for (; l3 < 32; ) {
                    if (0 === o2) break e;
                    o2--, u2 += n2[s2++] << l3, l3 += 8;
                  }
                  if (u2 !== (4294967295 & r2.total)) {
                    e2.msg = "incorrect length check", r2.mode = 30;
                    break;
                  }
                  l3 = u2 = 0;
                }
                r2.mode = 29;
              case 29:
                x = 1;
                break e;
              case 30:
                x = -3;
                break e;
              case 31:
                return -4;
              case 32:
              default:
                return U;
            }
            return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l3, (r2.wsize || c2 !== e2.avail_out && r2.mode < 30 && (r2.mode < 27 || 4 !== t2)) && Z(e2, e2.output, e2.next_out, c2 - e2.avail_out) ? (r2.mode = 31, -4) : (f2 -= e2.avail_in, c2 -= e2.avail_out, e2.total_in += f2, e2.total_out += c2, r2.total += c2, r2.wrap && c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, e2.next_out - c2) : O(r2.check, i2, c2, e2.next_out - c2)), e2.data_type = r2.bits + (r2.last ? 64 : 0) + (12 === r2.mode ? 128 : 0) + (20 === r2.mode || 15 === r2.mode ? 256 : 0), (0 == f2 && 0 === c2 || 4 === t2) && x === N && (x = -5), x);
          }, r.inflateEnd = function(e2) {
            if (!e2 || !e2.state) return U;
            var t2 = e2.state;
            return t2.window && (t2.window = null), e2.state = null, N;
          }, r.inflateGetHeader = function(e2, t2) {
            var r2;
            return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U;
          }, r.inflateSetDictionary = function(e2, t2) {
            var r2, n2 = t2.length;
            return e2 && e2.state ? 0 !== (r2 = e2.state).wrap && 11 !== r2.mode ? U : 11 === r2.mode && O(1, t2, n2, 0) !== r2.check ? -3 : Z(e2, t2, n2, n2) ? (r2.mode = 31, -4) : (r2.havedict = 1, N) : U;
          }, r.inflateInfo = "pako inflate (from Nodeca project)";
        }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) {
          "use strict";
          var D = e("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
          t.exports = function(e2, t2, r2, n, i, s, a, o) {
            var h, u, l2, f, c, d, p, m, _3, g = o.bits, b = 0, v = 0, y = 0, w = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R = null, T = 0;
            for (b = 0; b <= 15; b++) O[b] = 0;
            for (v = 0; v < n; v++) O[t2[r2 + v]]++;
            for (k = g, w = 15; 1 <= w && 0 === O[w]; w--) ;
            if (w < k && (k = w), 0 === w) return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0;
            for (y = 1; y < w && 0 === O[y]; y++) ;
            for (k < y && (k = y), b = z = 1; b <= 15; b++) if (z <<= 1, (z -= O[b]) < 0) return -1;
            if (0 < z && (0 === e2 || 1 !== w)) return -1;
            for (B[1] = 0, b = 1; b < 15; b++) B[b + 1] = B[b] + O[b];
            for (v = 0; v < n; v++) 0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v);
            if (d = 0 === e2 ? (A = R = a, 19) : 1 === e2 ? (A = F, I -= 257, R = N, T -= 257, 256) : (A = U, R = P, -1), b = y, c = s, S = v = E = 0, l2 = -1, f = (C = 1 << (x = k)) - 1, 1 === e2 && 852 < C || 2 === e2 && 592 < C) return 1;
            for (; ; ) {
              for (p = b - S, _3 = a[v] < d ? (m = 0, a[v]) : a[v] > d ? (m = R[T + a[v]], A[I + a[v]]) : (m = 96, 0), h = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h)] = p << 24 | m << 16 | _3 | 0, 0 !== u; ) ;
              for (h = 1 << b - 1; E & h; ) h >>= 1;
              if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) {
                if (b === w) break;
                b = t2[r2 + a[v]];
              }
              if (k < b && (E & f) !== l2) {
                for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); ) x++, z <<= 1;
                if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C) return 1;
                i[l2 = E & f] = k << 24 | x << 16 | c - s | 0;
              }
            }
            return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0;
          };
        }, { "../utils/common": 41 }], 51: [function(e, t, r) {
          "use strict";
          t.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" };
        }, {}], 52: [function(e, t, r) {
          "use strict";
          var i = e("../utils/common"), o = 0, h = 1;
          function n(e2) {
            for (var t2 = e2.length; 0 <= --t2; ) e2[t2] = 0;
          }
          var s = 0, a = 29, u = 256, l2 = u + 1 + a, f = 30, c = 19, _3 = 2 * l2 + 1, g = 15, d = 16, p = 7, m = 256, b = 16, v = 17, y = 18, w = [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], k = [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], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l2 + 2));
          n(z);
          var C = new Array(2 * f);
          n(C);
          var E = new Array(512);
          n(E);
          var A = new Array(256);
          n(A);
          var I = new Array(a);
          n(I);
          var O, B, R, T = new Array(f);
          function D(e2, t2, r2, n2, i2) {
            this.static_tree = e2, this.extra_bits = t2, this.extra_base = r2, this.elems = n2, this.max_length = i2, this.has_stree = e2 && e2.length;
          }
          function F(e2, t2) {
            this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2;
          }
          function N(e2) {
            return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)];
          }
          function U(e2, t2) {
            e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255;
          }
          function P(e2, t2, r2) {
            e2.bi_valid > d - r2 ? (e2.bi_buf |= t2 << e2.bi_valid & 65535, U(e2, e2.bi_buf), e2.bi_buf = t2 >> d - e2.bi_valid, e2.bi_valid += r2 - d) : (e2.bi_buf |= t2 << e2.bi_valid & 65535, e2.bi_valid += r2);
          }
          function L(e2, t2, r2) {
            P(e2, r2[2 * t2], r2[2 * t2 + 1]);
          }
          function j(e2, t2) {
            for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; ) ;
            return r2 >>> 1;
          }
          function Z(e2, t2, r2) {
            var n2, i2, s2 = new Array(g + 1), a2 = 0;
            for (n2 = 1; n2 <= g; n2++) s2[n2] = a2 = a2 + r2[n2 - 1] << 1;
            for (i2 = 0; i2 <= t2; i2++) {
              var o2 = e2[2 * i2 + 1];
              0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2));
            }
          }
          function W(e2) {
            var t2;
            for (t2 = 0; t2 < l2; t2++) e2.dyn_ltree[2 * t2] = 0;
            for (t2 = 0; t2 < f; t2++) e2.dyn_dtree[2 * t2] = 0;
            for (t2 = 0; t2 < c; t2++) e2.bl_tree[2 * t2] = 0;
            e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0;
          }
          function M(e2) {
            8 < e2.bi_valid ? U(e2, e2.bi_buf) : 0 < e2.bi_valid && (e2.pending_buf[e2.pending++] = e2.bi_buf), e2.bi_buf = 0, e2.bi_valid = 0;
          }
          function H(e2, t2, r2, n2) {
            var i2 = 2 * t2, s2 = 2 * r2;
            return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2];
          }
          function G(e2, t2, r2) {
            for (var n2 = e2.heap[r2], i2 = r2 << 1; i2 <= e2.heap_len && (i2 < e2.heap_len && H(t2, e2.heap[i2 + 1], e2.heap[i2], e2.depth) && i2++, !H(t2, n2, e2.heap[i2], e2.depth)); ) e2.heap[r2] = e2.heap[i2], r2 = i2, i2 <<= 1;
            e2.heap[r2] = n2;
          }
          function K(e2, t2, r2) {
            var n2, i2, s2, a2, o2 = 0;
            if (0 !== e2.last_lit) for (; n2 = e2.pending_buf[e2.d_buf + 2 * o2] << 8 | e2.pending_buf[e2.d_buf + 2 * o2 + 1], i2 = e2.pending_buf[e2.l_buf + o2], o2++, 0 === n2 ? L(e2, i2, t2) : (L(e2, (s2 = A[i2]) + u + 1, t2), 0 !== (a2 = w[s2]) && P(e2, i2 -= I[s2], a2), L(e2, s2 = N(--n2), r2), 0 !== (a2 = k[s2]) && P(e2, n2 -= T[s2], a2)), o2 < e2.last_lit; ) ;
            L(e2, m, t2);
          }
          function Y(e2, t2) {
            var r2, n2, i2, s2 = t2.dyn_tree, a2 = t2.stat_desc.static_tree, o2 = t2.stat_desc.has_stree, h2 = t2.stat_desc.elems, u2 = -1;
            for (e2.heap_len = 0, e2.heap_max = _3, r2 = 0; r2 < h2; r2++) 0 !== s2[2 * r2] ? (e2.heap[++e2.heap_len] = u2 = r2, e2.depth[r2] = 0) : s2[2 * r2 + 1] = 0;
            for (; e2.heap_len < 2; ) s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]);
            for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) G(e2, s2, r2);
            for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; ) ;
            e2.heap[--e2.heap_max] = e2.heap[1], (function(e3, t3) {
              var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l3 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0;
              for (s3 = 0; s3 <= g; s3++) e3.bl_count[s3] = 0;
              for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _3; r3++) p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l3[2 * n3 + 1] + a3)));
              if (0 !== m2) {
                do {
                  for (s3 = p2 - 1; 0 === e3.bl_count[s3]; ) s3--;
                  e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2;
                } while (0 < m2);
                for (s3 = p2; 0 !== s3; s3--) for (n3 = e3.bl_count[s3]; 0 !== n3; ) u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--);
              }
            })(e2, t2), Z(s2, u2, e2.bl_count);
          }
          function X(e2, t2, r2) {
            var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
            for (0 === a2 && (h2 = 138, u2 = 3), t2[2 * (r2 + 1) + 1] = 65535, n2 = 0; n2 <= r2; n2++) i2 = a2, a2 = t2[2 * (n2 + 1) + 1], ++o2 < h2 && i2 === a2 || (o2 < u2 ? e2.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e2.bl_tree[2 * i2]++, e2.bl_tree[2 * b]++) : o2 <= 10 ? e2.bl_tree[2 * v]++ : e2.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4));
          }
          function V(e2, t2, r2) {
            var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
            for (0 === a2 && (h2 = 138, u2 = 3), n2 = 0; n2 <= r2; n2++) if (i2 = a2, a2 = t2[2 * (n2 + 1) + 1], !(++o2 < h2 && i2 === a2)) {
              if (o2 < u2) for (; L(e2, i2, e2.bl_tree), 0 != --o2; ) ;
              else 0 !== i2 ? (i2 !== s2 && (L(e2, i2, e2.bl_tree), o2--), L(e2, b, e2.bl_tree), P(e2, o2 - 3, 2)) : o2 <= 10 ? (L(e2, v, e2.bl_tree), P(e2, o2 - 3, 3)) : (L(e2, y, e2.bl_tree), P(e2, o2 - 11, 7));
              s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4);
            }
          }
          n(T);
          var q = false;
          function J(e2, t2, r2, n2) {
            P(e2, (s << 1) + (n2 ? 1 : 0), 3), (function(e3, t3, r3, n3) {
              M(e3), n3 && (U(e3, r3), U(e3, ~r3)), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3;
            })(e2, t2, r2, true);
          }
          r._tr_init = function(e2) {
            q || ((function() {
              var e3, t2, r2, n2, i2, s2 = new Array(g + 1);
              for (n2 = r2 = 0; n2 < a - 1; n2++) for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) A[r2++] = n2;
              for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++) for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++) E[i2++] = n2;
              for (i2 >>= 7; n2 < f; n2++) for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++) E[256 + i2++] = n2;
              for (t2 = 0; t2 <= g; t2++) s2[t2] = 0;
              for (e3 = 0; e3 <= 143; ) z[2 * e3 + 1] = 8, e3++, s2[8]++;
              for (; e3 <= 255; ) z[2 * e3 + 1] = 9, e3++, s2[9]++;
              for (; e3 <= 279; ) z[2 * e3 + 1] = 7, e3++, s2[7]++;
              for (; e3 <= 287; ) z[2 * e3 + 1] = 8, e3++, s2[8]++;
              for (Z(z, l2 + 1, s2), e3 = 0; e3 < f; e3++) C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5);
              O = new D(z, w, u + 1, l2, g), B = new D(C, k, 0, f, g), R = new D(new Array(0), x, 0, c, p);
            })(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2);
          }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) {
            var i2, s2, a2 = 0;
            0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = (function(e3) {
              var t3, r3 = 4093624447;
              for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) return o;
              if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) return h;
              for (t3 = 32; t3 < u; t3++) if (0 !== e3.dyn_ltree[2 * t3]) return h;
              return o;
            })(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = (function(e3) {
              var t3;
              for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--) ;
              return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3;
            })(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), (function(e3, t3, r3, n3) {
              var i3;
              for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++) P(e3, e3.bl_tree[2 * S[i3] + 1], 3);
              V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1);
            })(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2);
          }, r._tr_tally = function(e2, t2, r2) {
            return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1;
          }, r._tr_align = function(e2) {
            P(e2, 2, 3), L(e2, m, z), (function(e3) {
              16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8);
            })(e2);
          };
        }, { "../utils/common": 41 }], 53: [function(e, t, r) {
          "use strict";
          t.exports = function() {
            this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
          };
        }, {}], 54: [function(e, t, r) {
          (function(e2) {
            !(function(r2, n) {
              "use strict";
              if (!r2.setImmediate) {
                var i, s, t2, a, o = 1, h = {}, u = false, l2 = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2);
                e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) {
                  process.nextTick(function() {
                    c(e4);
                  });
                } : (function() {
                  if (r2.postMessage && !r2.importScripts) {
                    var e4 = true, t3 = r2.onmessage;
                    return r2.onmessage = function() {
                      e4 = false;
                    }, r2.postMessage("", "*"), r2.onmessage = t3, e4;
                  }
                })() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) {
                  r2.postMessage(a + e4, "*");
                }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) {
                  c(e4.data);
                }, function(e4) {
                  t2.port2.postMessage(e4);
                }) : l2 && "onreadystatechange" in l2.createElement("script") ? (s = l2.documentElement, function(e4) {
                  var t3 = l2.createElement("script");
                  t3.onreadystatechange = function() {
                    c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null;
                  }, s.appendChild(t3);
                }) : function(e4) {
                  setTimeout(c, 0, e4);
                }, e3.setImmediate = function(e4) {
                  "function" != typeof e4 && (e4 = new Function("" + e4));
                  for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++) t3[r3] = arguments[r3 + 1];
                  var n2 = { callback: e4, args: t3 };
                  return h[o] = n2, i(o), o++;
                }, e3.clearImmediate = f;
              }
              function f(e4) {
                delete h[e4];
              }
              function c(e4) {
                if (u) setTimeout(c, 0, e4);
                else {
                  var t3 = h[e4];
                  if (t3) {
                    u = true;
                    try {
                      !(function(e5) {
                        var t4 = e5.callback, r3 = e5.args;
                        switch (r3.length) {
                          case 0:
                            t4();
                            break;
                          case 1:
                            t4(r3[0]);
                            break;
                          case 2:
                            t4(r3[0], r3[1]);
                            break;
                          case 3:
                            t4(r3[0], r3[1], r3[2]);
                            break;
                          default:
                            t4.apply(n, r3);
                        }
                      })(t3);
                    } finally {
                      f(e4), u = false;
                    }
                  }
                }
              }
              function d(e4) {
                e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length));
              }
            })("undefined" == typeof self ? void 0 === e2 ? this : e2 : self);
          }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
        }, {}] }, {}, [10])(10);
      });
    }
  });

  // node_modules/mammoth/lib/zipfile.js
  var require_zipfile = __commonJS({
    "node_modules/mammoth/lib/zipfile.js"(exports2) {
      var base64js = require_base64_js();
      var JSZip = require_jszip_min();
      exports2.openArrayBuffer = openArrayBuffer;
      exports2.splitPath = splitPath;
      exports2.joinPath = joinPath;
      function openArrayBuffer(arrayBuffer) {
        return JSZip.loadAsync(arrayBuffer).then(function(zipFile) {
          function exists(name) {
            return zipFile.file(name) !== null;
          }
          function read(name, encoding) {
            return zipFile.file(name).async("uint8array").then(function(array) {
              if (encoding === "base64") {
                return base64js.fromByteArray(array);
              } else if (encoding) {
                var decoder = new TextDecoder(encoding);
                return decoder.decode(array);
              } else {
                return array;
              }
            });
          }
          function write(name, contents) {
            zipFile.file(name, contents);
          }
          function toArrayBuffer() {
            return zipFile.generateAsync({ type: "arraybuffer" });
          }
          return {
            exists,
            read,
            write,
            toArrayBuffer
          };
        });
      }
      function splitPath(path) {
        var lastIndex = path.lastIndexOf("/");
        if (lastIndex === -1) {
          return { dirname: "", basename: path };
        } else {
          return {
            dirname: path.substring(0, lastIndex),
            basename: path.substring(lastIndex + 1)
          };
        }
      }
      function joinPath() {
        var nonEmptyPaths = Array.prototype.filter.call(arguments, function(path) {
          return path;
        });
        var relevantPaths = [];
        nonEmptyPaths.forEach(function(path) {
          if (/^\//.test(path)) {
            relevantPaths = [path];
          } else {
            relevantPaths.push(path);
          }
        });
        return relevantPaths.join("/");
      }
    }
  });

  // node_modules/mammoth/lib/xml/nodes.js
  var require_nodes = __commonJS({
    "node_modules/mammoth/lib/xml/nodes.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      exports2.Element = Element;
      exports2.element = function(name, attributes, children) {
        return new Element(name, attributes, children);
      };
      exports2.text = function(value) {
        return {
          type: "text",
          value
        };
      };
      var emptyElement = exports2.emptyElement = {
        first: function() {
          return null;
        },
        firstOrEmpty: function() {
          return emptyElement;
        },
        attributes: {},
        children: []
      };
      function Element(name, attributes, children) {
        this.type = "element";
        this.name = name;
        this.attributes = attributes || {};
        this.children = children || [];
      }
      Element.prototype.first = function(name) {
        return _3.find(this.children, function(child) {
          return child.name === name;
        });
      };
      Element.prototype.firstOrEmpty = function(name) {
        return this.first(name) || emptyElement;
      };
      Element.prototype.getElementsByTagName = function(name) {
        var elements = _3.filter(this.children, function(child) {
          return child.name === name;
        });
        return toElementList(elements);
      };
      Element.prototype.text = function() {
        if (this.children.length === 0) {
          return "";
        } else if (this.children.length !== 1 || this.children[0].type !== "text") {
          throw new Error("Not implemented");
        }
        return this.children[0].value;
      };
      var elementListPrototype = {
        getElementsByTagName: function(name) {
          return toElementList(_3.flatten(this.map(function(element) {
            return element.getElementsByTagName(name);
          }, true)));
        }
      };
      function toElementList(array) {
        return _3.extend(array, elementListPrototype);
      }
    }
  });

  // node_modules/@xmldom/xmldom/lib/conventions.js
  var require_conventions = __commonJS({
    "node_modules/@xmldom/xmldom/lib/conventions.js"(exports2) {
      "use strict";
      function find2(list, predicate, ac) {
        if (ac === void 0) {
          ac = Array.prototype;
        }
        if (list && typeof ac.find === "function") {
          return ac.find.call(list, predicate);
        }
        for (var i = 0; i < list.length; i++) {
          if (Object.prototype.hasOwnProperty.call(list, i)) {
            var item = list[i];
            if (predicate.call(void 0, item, i, list)) {
              return item;
            }
          }
        }
      }
      function freeze(object2, oc) {
        if (oc === void 0) {
          oc = Object;
        }
        return oc && typeof oc.freeze === "function" ? oc.freeze(object2) : object2;
      }
      function assign(target, source) {
        if (target === null || typeof target !== "object") {
          throw new TypeError("target is not an object");
        }
        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
        return target;
      }
      var MIME_TYPE = freeze({
        /**
         * `text/html`, the only mime type that triggers treating an XML document as HTML.
         *
         * @see DOMParser.SupportedType.isHTML
         * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
         * @see https://en.wikipedia.org/wiki/HTML Wikipedia
         * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
         * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
         */
        HTML: "text/html",
        /**
         * Helper method to check a mime type if it indicates an HTML document
         *
         * @param {string} [value]
         * @returns {boolean}
         *
         * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
         * @see https://en.wikipedia.org/wiki/HTML Wikipedia
         * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
         * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring 	 */
        isHTML: function(value) {
          return value === MIME_TYPE.HTML;
        },
        /**
         * `application/xml`, the standard mime type for XML documents.
         *
         * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
         * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
         * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
         */
        XML_APPLICATION: "application/xml",
        /**
         * `text/html`, an alias for `application/xml`.
         *
         * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
         * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
         * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
         */
        XML_TEXT: "text/xml",
        /**
         * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
         * but is parsed as an XML document.
         *
         * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
         * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
         * @see https://en.wikipedia.org/wiki/XHTML Wikipedia
         */
        XML_XHTML_APPLICATION: "application/xhtml+xml",
        /**
         * `image/svg+xml`,
         *
         * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
         * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
         * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
         */
        XML_SVG_IMAGE: "image/svg+xml"
      });
      var NAMESPACE = freeze({
        /**
         * The XHTML namespace.
         *
         * @see http://www.w3.org/1999/xhtml
         */
        HTML: "http://www.w3.org/1999/xhtml",
        /**
         * Checks if `uri` equals `NAMESPACE.HTML`.
         *
         * @param {string} [uri]
         *
         * @see NAMESPACE.HTML
         */
        isHTML: function(uri) {
          return uri === NAMESPACE.HTML;
        },
        /**
         * The SVG namespace.
         *
         * @see http://www.w3.org/2000/svg
         */
        SVG: "http://www.w3.org/2000/svg",
        /**
         * The `xml:` namespace.
         *
         * @see http://www.w3.org/XML/1998/namespace
         */
        XML: "http://www.w3.org/XML/1998/namespace",
        /**
         * The `xmlns:` namespace
         *
         * @see https://www.w3.org/2000/xmlns/
         */
        XMLNS: "http://www.w3.org/2000/xmlns/"
      });
      exports2.assign = assign;
      exports2.find = find2;
      exports2.freeze = freeze;
      exports2.MIME_TYPE = MIME_TYPE;
      exports2.NAMESPACE = NAMESPACE;
    }
  });

  // node_modules/@xmldom/xmldom/lib/dom.js
  var require_dom = __commonJS({
    "node_modules/@xmldom/xmldom/lib/dom.js"(exports2) {
      var conventions = require_conventions();
      var find2 = conventions.find;
      var NAMESPACE = conventions.NAMESPACE;
      function notEmptyString(input) {
        return input !== "";
      }
      function splitOnASCIIWhitespace(input) {
        return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
      }
      function orderedSetReducer(current, element) {
        if (!current.hasOwnProperty(element)) {
          current[element] = true;
        }
        return current;
      }
      function toOrderedSet(input) {
        if (!input) return [];
        var list = splitOnASCIIWhitespace(input);
        return Object.keys(list.reduce(orderedSetReducer, {}));
      }
      function arrayIncludes(list) {
        return function(element) {
          return list && list.indexOf(element) !== -1;
        };
      }
      function copy(src, dest) {
        for (var p in src) {
          if (Object.prototype.hasOwnProperty.call(src, p)) {
            dest[p] = src[p];
          }
        }
      }
      function _extends(Class, Super) {
        var pt = Class.prototype;
        if (!(pt instanceof Super)) {
          let t2 = function() {
          };
          var t = t2;
          ;
          t2.prototype = Super.prototype;
          t2 = new t2();
          copy(pt, t2);
          Class.prototype = pt = t2;
        }
        if (pt.constructor != Class) {
          if (typeof Class != "function") {
            console.error("unknown Class:" + Class);
          }
          pt.constructor = Class;
        }
      }
      var NodeType = {};
      var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
      var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
      var TEXT_NODE = NodeType.TEXT_NODE = 3;
      var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
      var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
      var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
      var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
      var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
      var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
      var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
      var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
      var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
      var ExceptionCode = {};
      var ExceptionMessage = {};
      var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
      var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
      var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
      var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
      var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
      var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
      var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
      var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
      var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
      var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10);
      var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
      var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
      var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
      var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
      var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
      function DOMException(code, message) {
        if (message instanceof Error) {
          var error = message;
        } else {
          error = this;
          Error.call(this, ExceptionMessage[code]);
          this.message = ExceptionMessage[code];
          if (Error.captureStackTrace) Error.captureStackTrace(this, DOMException);
        }
        error.code = code;
        if (message) this.message = this.message + ": " + message;
        return error;
      }
      DOMException.prototype = Error.prototype;
      copy(ExceptionCode, DOMException);
      function NodeList() {
      }
      NodeList.prototype = {
        /**
         * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
         * @standard level1
         */
        length: 0,
        /**
         * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
         * @standard level1
         * @param index  unsigned long
         *   Index into the collection.
         * @return Node
         * 	The node at the indexth position in the NodeList, or null if that is not a valid index.
         */
        item: function(index) {
          return index >= 0 && index < this.length ? this[index] : null;
        },
        toString: function(isHTML, nodeFilter, options) {
          var requireWellFormed = !!options && !!options.requireWellFormed;
          for (var buf = [], i = 0; i < this.length; i++) {
            serializeToString(this[i], buf, isHTML, nodeFilter, null, requireWellFormed);
          }
          return buf.join("");
        },
        /**
         * @private
         * @param {function (Node):boolean} predicate
         * @returns {Node[]}
         */
        filter: function(predicate) {
          return Array.prototype.filter.call(this, predicate);
        },
        /**
         * @private
         * @param {Node} item
         * @returns {number}
         */
        indexOf: function(item) {
          return Array.prototype.indexOf.call(this, item);
        }
      };
      function LiveNodeList(node, refresh) {
        this._node = node;
        this._refresh = refresh;
        _updateLiveList(this);
      }
      function _updateLiveList(list) {
        var inc = list._node._inc || list._node.ownerDocument._inc;
        if (list._inc !== inc) {
          var ls = list._refresh(list._node);
          __set__(list, "length", ls.length);
          if (!list.$$length || ls.length < list.$$length) {
            for (var i = ls.length; i in list; i++) {
              if (Object.prototype.hasOwnProperty.call(list, i)) {
                delete list[i];
              }
            }
          }
          copy(ls, list);
          list._inc = inc;
        }
      }
      LiveNodeList.prototype.item = function(i) {
        _updateLiveList(this);
        return this[i] || null;
      };
      _extends(LiveNodeList, NodeList);
      function NamedNodeMap() {
      }
      function _findNodeIndex(list, node) {
        var i = list.length;
        while (i--) {
          if (list[i] === node) {
            return i;
          }
        }
      }
      function _addNamedNode(el, list, newAttr, oldAttr) {
        if (oldAttr) {
          list[_findNodeIndex(list, oldAttr)] = newAttr;
        } else {
          list[list.length++] = newAttr;
        }
        if (el) {
          newAttr.ownerElement = el;
          var doc = el.ownerDocument;
          if (doc) {
            oldAttr && _onRemoveAttribute(doc, el, oldAttr);
            _onAddAttribute(doc, el, newAttr);
          }
        }
      }
      function _removeNamedNode(el, list, attr) {
        var i = _findNodeIndex(list, attr);
        if (i >= 0) {
          var lastIndex = list.length - 1;
          while (i < lastIndex) {
            list[i] = list[++i];
          }
          list.length = lastIndex;
          if (el) {
            var doc = el.ownerDocument;
            if (doc) {
              _onRemoveAttribute(doc, el, attr);
              attr.ownerElement = null;
            }
          }
        } else {
          throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
        }
      }
      NamedNodeMap.prototype = {
        length: 0,
        item: NodeList.prototype.item,
        getNamedItem: function(key) {
          var i = this.length;
          while (i--) {
            var attr = this[i];
            if (attr.nodeName == key) {
              return attr;
            }
          }
        },
        setNamedItem: function(attr) {
          var el = attr.ownerElement;
          if (el && el != this._ownerElement) {
            throw new DOMException(INUSE_ATTRIBUTE_ERR);
          }
          var oldAttr = this.getNamedItem(attr.nodeName);
          _addNamedNode(this._ownerElement, this, attr, oldAttr);
          return oldAttr;
        },
        /* returns Node */
        setNamedItemNS: function(attr) {
          var el = attr.ownerElement, oldAttr;
          if (el && el != this._ownerElement) {
            throw new DOMException(INUSE_ATTRIBUTE_ERR);
          }
          oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
          _addNamedNode(this._ownerElement, this, attr, oldAttr);
          return oldAttr;
        },
        /* returns Node */
        removeNamedItem: function(key) {
          var attr = this.getNamedItem(key);
          _removeNamedNode(this._ownerElement, this, attr);
          return attr;
        },
        // raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
        //for level2
        removeNamedItemNS: function(namespaceURI, localName) {
          var attr = this.getNamedItemNS(namespaceURI, localName);
          _removeNamedNode(this._ownerElement, this, attr);
          return attr;
        },
        getNamedItemNS: function(namespaceURI, localName) {
          var i = this.length;
          while (i--) {
            var node = this[i];
            if (node.localName == localName && node.namespaceURI == namespaceURI) {
              return node;
            }
          }
          return null;
        }
      };
      function DOMImplementation() {
      }
      DOMImplementation.prototype = {
        /**
         * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
         * The different implementations fairly diverged in what kind of features were reported.
         * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
         *
         * @deprecated It is deprecated and modern browsers return true in all cases.
         *
         * @param {string} feature
         * @param {string} [version]
         * @returns {boolean} always true
         *
         * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
         * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
         * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
         */
        hasFeature: function(feature, version3) {
          return true;
        },
        /**
         * Creates an XML Document object of the specified type with its document element.
         *
         * __It behaves slightly different from the description in the living standard__:
         * - There is no interface/class `XMLDocument`, it returns a `Document` instance.
         * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
         * - this implementation is not validating names or qualified names
         *   (when parsing XML strings, the SAX parser takes care of that)
         *
         * @param {string|null} namespaceURI
         * @param {string} qualifiedName
         * @param {DocumentType=null} doctype
         * @returns {Document}
         *
         * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
         * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
         * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument  DOM Level 2 Core
         *
         * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
         * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
         * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
         */
        createDocument: function(namespaceURI, qualifiedName, doctype) {
          var doc = new Document();
          doc.implementation = this;
          doc.childNodes = new NodeList();
          doc.doctype = doctype || null;
          if (doctype) {
            doc.appendChild(doctype);
          }
          if (qualifiedName) {
            var root3 = doc.createElementNS(namespaceURI, qualifiedName);
            doc.appendChild(root3);
          }
          return doc;
        },
        /**
         * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
         *
         * __This implementation differs from the specification:__
         * - this implementation is not validating names or qualified names
         *   (when parsing XML strings, the SAX parser takes care of that)
         *
         * Note: `internalSubset` can only be introduced via a direct property write to `node.internalSubset` after creation.
         * Creation-time validation of `publicId`, `systemId` is not enforced.
         * The serializer-level check covers all mutation vectors, including direct property writes.
         * `internalSubset` is only serialized as `[ ... ]` when both `publicId` and `systemId` are
         * absent (empty or `'.'`) — if either external identifier is present, `internalSubset` is
         * silently omitted from the serialized output.
         *
         * @param {string} qualifiedName
         * @param {string} [publicId]
         * The external subset public identifier. Stored verbatim including surrounding quotes.
         * When serialized with `requireWellFormed: true` (via the 4th-parameter options object),
         * throws `DOMException` with code `INVALID_STATE_ERR` if the value is non-empty and does
         * not match the XML `PubidLiteral` production (W3C DOM Parsing §3.2.1.3; XML 1.0 [12]).
         * @param {string} [systemId]
         * The external subset system identifier. Stored verbatim including surrounding quotes.
         * When serialized with `requireWellFormed: true`, throws `DOMException` with code
         * `INVALID_STATE_ERR` if the value is non-empty and does not match the XML `SystemLiteral`
         * production (W3C DOM Parsing §3.2.1.3; XML 1.0 [11]).
         * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
         * 				  or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
         *
         * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
         * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
         * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
         *
         * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
         * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
         * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
         */
        createDocumentType: function(qualifiedName, publicId, systemId) {
          var node = new DocumentType();
          node.name = qualifiedName;
          node.nodeName = qualifiedName;
          node.publicId = publicId || "";
          node.systemId = systemId || "";
          return node;
        }
      };
      function Node3() {
      }
      Node3.prototype = {
        firstChild: null,
        lastChild: null,
        previousSibling: null,
        nextSibling: null,
        attributes: null,
        parentNode: null,
        childNodes: null,
        ownerDocument: null,
        nodeValue: null,
        namespaceURI: null,
        prefix: null,
        localName: null,
        // Modified in DOM Level 2:
        insertBefore: function(newChild, refChild) {
          return _insertBefore(this, newChild, refChild);
        },
        replaceChild: function(newChild, oldChild) {
          _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
          if (oldChild) {
            this.removeChild(oldChild);
          }
        },
        removeChild: function(oldChild) {
          return _removeChild(this, oldChild);
        },
        appendChild: function(newChild) {
          return this.insertBefore(newChild, null);
        },
        hasChildNodes: function() {
          return this.firstChild != null;
        },
        cloneNode: function(deep) {
          return cloneNode(this.ownerDocument || this, this, deep);
        },
        // Modified in DOM Level 2:
        /**
         * Puts the specified node and all of its subtree into a "normalized" form. In a normalized
         * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.
         *
         * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`
         * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text
         * nodes.
         *
         * This method iteratively traverses all child nodes to normalize all descendant nodes within
         * the subtree.
         *
         * @throws {DOMException}
         * May throw a DOMException if operations within removeChild or appendData (which are
         * potentially invoked in this method) do not meet their specific constraints.
         * @see {@link Node.removeChild}
         * @see {@link CharacterData.appendData}
         * @see ../docs/walk-dom.md.
         */
        normalize: function() {
          walkDOM(this, null, {
            enter: function(node) {
              var child = node.firstChild;
              while (child) {
                var next2 = child.nextSibling;
                if (next2 !== null && next2.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
                  node.removeChild(next2);
                  child.appendData(next2.data);
                } else {
                  child = next2;
                }
              }
              return true;
            }
          });
        },
        // Introduced in DOM Level 2:
        isSupported: function(feature, version3) {
          return this.ownerDocument.implementation.hasFeature(feature, version3);
        },
        // Introduced in DOM Level 2:
        hasAttributes: function() {
          return this.attributes.length > 0;
        },
        /**
         * Look up the prefix associated to the given namespace URI, starting from this node.
         * **The default namespace declarations are ignored by this method.**
         * See Namespace Prefix Lookup for details on the algorithm used by this method.
         *
         * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._
         *
         * @param {string | null} namespaceURI
         * @returns {string | null}
         * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix
         * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo
         * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
         * @see https://github.com/xmldom/xmldom/issues/322
         */
        lookupPrefix: function(namespaceURI) {
          var el = this;
          while (el) {
            var map2 = el._nsMap;
            if (map2) {
              for (var n in map2) {
                if (Object.prototype.hasOwnProperty.call(map2, n) && map2[n] === namespaceURI) {
                  return n;
                }
              }
            }
            el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
          }
          return null;
        },
        // Introduced in DOM Level 3:
        lookupNamespaceURI: function(prefix) {
          var el = this;
          while (el) {
            var map2 = el._nsMap;
            if (map2) {
              if (Object.prototype.hasOwnProperty.call(map2, prefix)) {
                return map2[prefix];
              }
            }
            el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
          }
          return null;
        },
        // Introduced in DOM Level 3:
        isDefaultNamespace: function(namespaceURI) {
          var prefix = this.lookupPrefix(namespaceURI);
          return prefix == null;
        }
      };
      function _xmlEncoder(c) {
        return c == "<" && "&lt;" || c == ">" && "&gt;" || c == "&" && "&amp;" || c == '"' && "&quot;" || "&#" + c.charCodeAt() + ";";
      }
      copy(NodeType, Node3);
      copy(NodeType, Node3.prototype);
      function _visitNode(node, callback) {
        return walkDOM(node, null, { enter: function(n) {
          return callback(n) ? walkDOM.STOP : true;
        } }) === walkDOM.STOP;
      }
      function walkDOM(node, context, callbacks) {
        var stack = [{ node, context, phase: walkDOM.ENTER }];
        while (stack.length > 0) {
          var frame = stack.pop();
          if (frame.phase === walkDOM.ENTER) {
            var childContext = callbacks.enter(frame.node, frame.context);
            if (childContext === walkDOM.STOP) {
              return walkDOM.STOP;
            }
            stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
            if (childContext === null || childContext === void 0) {
              continue;
            }
            var child = frame.node.lastChild;
            while (child) {
              stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
              child = child.previousSibling;
            }
          } else {
            if (callbacks.exit) {
              callbacks.exit(frame.node, frame.context);
            }
          }
        }
      }
      walkDOM.STOP = /* @__PURE__ */ Symbol("walkDOM.STOP");
      walkDOM.ENTER = 0;
      walkDOM.EXIT = 1;
      function Document() {
        this.ownerDocument = this;
      }
      function _onAddAttribute(doc, el, newAttr) {
        doc && doc._inc++;
        var ns = newAttr.namespaceURI;
        if (ns === NAMESPACE.XMLNS) {
          el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value;
        }
      }
      function _onRemoveAttribute(doc, el, newAttr, remove2) {
        doc && doc._inc++;
        var ns = newAttr.namespaceURI;
        if (ns === NAMESPACE.XMLNS) {
          delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
        }
      }
      function _onUpdateChild(doc, el, newChild) {
        if (doc && doc._inc) {
          doc._inc++;
          var cs = el.childNodes;
          if (newChild) {
            cs[cs.length++] = newChild;
          } else {
            var child = el.firstChild;
            var i = 0;
            while (child) {
              cs[i++] = child;
              child = child.nextSibling;
            }
            cs.length = i;
            delete cs[cs.length];
          }
        }
      }
      function _removeChild(parentNode, child) {
        var previous = child.previousSibling;
        var next2 = child.nextSibling;
        if (previous) {
          previous.nextSibling = next2;
        } else {
          parentNode.firstChild = next2;
        }
        if (next2) {
          next2.previousSibling = previous;
        } else {
          parentNode.lastChild = previous;
        }
        child.parentNode = null;
        child.previousSibling = null;
        child.nextSibling = null;
        _onUpdateChild(parentNode.ownerDocument, parentNode);
        return child;
      }
      function hasValidParentNodeType(node) {
        return node && (node.nodeType === Node3.DOCUMENT_NODE || node.nodeType === Node3.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node3.ELEMENT_NODE);
      }
      function hasInsertableNodeType(node) {
        return node && (isElementNode(node) || isTextNode(node) || isDocTypeNode(node) || node.nodeType === Node3.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node3.COMMENT_NODE || node.nodeType === Node3.PROCESSING_INSTRUCTION_NODE);
      }
      function isDocTypeNode(node) {
        return node && node.nodeType === Node3.DOCUMENT_TYPE_NODE;
      }
      function isElementNode(node) {
        return node && node.nodeType === Node3.ELEMENT_NODE;
      }
      function isTextNode(node) {
        return node && node.nodeType === Node3.TEXT_NODE;
      }
      function isElementInsertionPossible(doc, child) {
        var parentChildNodes = doc.childNodes || [];
        if (find2(parentChildNodes, isElementNode) || isDocTypeNode(child)) {
          return false;
        }
        var docTypeNode = find2(parentChildNodes, isDocTypeNode);
        return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
      }
      function isElementReplacementPossible(doc, child) {
        var parentChildNodes = doc.childNodes || [];
        function hasElementChildThatIsNotChild(node) {
          return isElementNode(node) && node !== child;
        }
        if (find2(parentChildNodes, hasElementChildThatIsNotChild)) {
          return false;
        }
        var docTypeNode = find2(parentChildNodes, isDocTypeNode);
        return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
      }
      function assertPreInsertionValidity1to5(parent, node, child) {
        if (!hasValidParentNodeType(parent)) {
          throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
        }
        if (child && child.parentNode !== parent) {
          throw new DOMException(NOT_FOUND_ERR, "child not in parent");
        }
        if (
          // 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException.
          !hasInsertableNodeType(node) || // 5. If either `node` is a Text node and `parent` is a document,
          // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0
          // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)
          // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException.
          isDocTypeNode(node) && parent.nodeType !== Node3.DOCUMENT_NODE
        ) {
          throw new DOMException(
            HIERARCHY_REQUEST_ERR,
            "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType
          );
        }
      }
      function assertPreInsertionValidityInDocument(parent, node, child) {
        var parentChildNodes = parent.childNodes || [];
        var nodeChildNodes = node.childNodes || [];
        if (node.nodeType === Node3.DOCUMENT_FRAGMENT_NODE) {
          var nodeChildElements = nodeChildNodes.filter(isElementNode);
          if (nodeChildElements.length > 1 || find2(nodeChildNodes, isTextNode)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
          }
          if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
          }
        }
        if (isElementNode(node)) {
          if (!isElementInsertionPossible(parent, child)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
          }
        }
        if (isDocTypeNode(node)) {
          if (find2(parentChildNodes, isDocTypeNode)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
          }
          var parentElementChild = find2(parentChildNodes, isElementNode);
          if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
          }
          if (!child && parentElementChild) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
          }
        }
      }
      function assertPreReplacementValidityInDocument(parent, node, child) {
        var parentChildNodes = parent.childNodes || [];
        var nodeChildNodes = node.childNodes || [];
        if (node.nodeType === Node3.DOCUMENT_FRAGMENT_NODE) {
          var nodeChildElements = nodeChildNodes.filter(isElementNode);
          if (nodeChildElements.length > 1 || find2(nodeChildNodes, isTextNode)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
          }
          if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
          }
        }
        if (isElementNode(node)) {
          if (!isElementReplacementPossible(parent, child)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
          }
        }
        if (isDocTypeNode(node)) {
          let hasDoctypeChildThatIsNotChild2 = function(node2) {
            return isDocTypeNode(node2) && node2 !== child;
          };
          var hasDoctypeChildThatIsNotChild = hasDoctypeChildThatIsNotChild2;
          if (find2(parentChildNodes, hasDoctypeChildThatIsNotChild2)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
          }
          var parentElementChild = find2(parentChildNodes, isElementNode);
          if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
            throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
          }
        }
      }
      function _insertBefore(parent, node, child, _inDocumentAssertion) {
        assertPreInsertionValidity1to5(parent, node, child);
        if (parent.nodeType === Node3.DOCUMENT_NODE) {
          (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
        }
        var cp = node.parentNode;
        if (cp) {
          cp.removeChild(node);
        }
        if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
          var newFirst = node.firstChild;
          if (newFirst == null) {
            return node;
          }
          var newLast = node.lastChild;
        } else {
          newFirst = newLast = node;
        }
        var pre = child ? child.previousSibling : parent.lastChild;
        newFirst.previousSibling = pre;
        newLast.nextSibling = child;
        if (pre) {
          pre.nextSibling = newFirst;
        } else {
          parent.firstChild = newFirst;
        }
        if (child == null) {
          parent.lastChild = newLast;
        } else {
          child.previousSibling = newLast;
        }
        do {
          newFirst.parentNode = parent;
          var targetDoc = parent.ownerDocument || parent;
          _updateOwnerDocument(newFirst, targetDoc);
        } while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
        _onUpdateChild(parent.ownerDocument || parent, parent);
        if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
          node.firstChild = node.lastChild = null;
        }
        return node;
      }
      function _updateOwnerDocument(node, newOwnerDocument) {
        if (node.ownerDocument === newOwnerDocument) {
          return;
        }
        node.ownerDocument = newOwnerDocument;
        if (node.nodeType === ELEMENT_NODE && node.attributes) {
          for (var i = 0; i < node.attributes.length; i++) {
            var attr = node.attributes.item(i);
            if (attr) {
              attr.ownerDocument = newOwnerDocument;
            }
          }
        }
        var child = node.firstChild;
        while (child) {
          _updateOwnerDocument(child, newOwnerDocument);
          child = child.nextSibling;
        }
      }
      function _appendSingleChild(parentNode, newChild) {
        if (newChild.parentNode) {
          newChild.parentNode.removeChild(newChild);
        }
        newChild.parentNode = parentNode;
        newChild.previousSibling = parentNode.lastChild;
        newChild.nextSibling = null;
        if (newChild.previousSibling) {
          newChild.previousSibling.nextSibling = newChild;
        } else {
          parentNode.firstChild = newChild;
        }
        parentNode.lastChild = newChild;
        _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
        var targetDoc = parentNode.ownerDocument || parentNode;
        _updateOwnerDocument(newChild, targetDoc);
        return newChild;
      }
      Document.prototype = {
        //implementation : null,
        nodeName: "#document",
        nodeType: DOCUMENT_NODE,
        /**
         * The DocumentType node of the document.
         *
         * @readonly
         * @type DocumentType
         */
        doctype: null,
        documentElement: null,
        _inc: 1,
        insertBefore: function(newChild, refChild) {
          if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
            var child = newChild.firstChild;
            while (child) {
              var next2 = child.nextSibling;
              this.insertBefore(child, refChild);
              child = next2;
            }
            return newChild;
          }
          _insertBefore(this, newChild, refChild);
          _updateOwnerDocument(newChild, this);
          if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
            this.documentElement = newChild;
          }
          return newChild;
        },
        removeChild: function(oldChild) {
          if (this.documentElement == oldChild) {
            this.documentElement = null;
          }
          return _removeChild(this, oldChild);
        },
        replaceChild: function(newChild, oldChild) {
          _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
          _updateOwnerDocument(newChild, this);
          if (oldChild) {
            this.removeChild(oldChild);
          }
          if (isElementNode(newChild)) {
            this.documentElement = newChild;
          }
        },
        // Introduced in DOM Level 2:
        importNode: function(importedNode, deep) {
          return importNode(this, importedNode, deep);
        },
        // Introduced in DOM Level 2:
        getElementById: function(id) {
          var rtv = null;
          _visitNode(this.documentElement, function(node) {
            if (node.nodeType == ELEMENT_NODE) {
              if (node.getAttribute("id") == id) {
                rtv = node;
                return true;
              }
            }
          });
          return rtv;
        },
        /**
         * The `getElementsByClassName` method of `Document` interface returns an array-like object
         * of all child elements which have **all** of the given class name(s).
         *
         * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
         *
         *
         * Warning: This is a live LiveNodeList.
         * Changes in the DOM will reflect in the array as the changes occur.
         * If an element selected by this array no longer qualifies for the selector,
         * it will automatically be removed. Be aware of this for iteration purposes.
         *
         * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
         *
         * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
         * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
         */
        getElementsByClassName: function(classNames) {
          var classNamesSet = toOrderedSet(classNames);
          return new LiveNodeList(this, function(base) {
            var ls = [];
            if (classNamesSet.length > 0) {
              _visitNode(base.documentElement, function(node) {
                if (node !== base && node.nodeType === ELEMENT_NODE) {
                  var nodeClassNames = node.getAttribute("class");
                  if (nodeClassNames) {
                    var matches = classNames === nodeClassNames;
                    if (!matches) {
                      var nodeClassNamesSet = toOrderedSet(nodeClassNames);
                      matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
                    }
                    if (matches) {
                      ls.push(node);
                    }
                  }
                }
              });
            }
            return ls;
          });
        },
        //document factory method:
        createElement: function(tagName) {
          var node = new Element();
          node.ownerDocument = this;
          node.nodeName = tagName;
          node.tagName = tagName;
          node.localName = tagName;
          node.childNodes = new NodeList();
          var attrs = node.attributes = new NamedNodeMap();
          attrs._ownerElement = node;
          return node;
        },
        createDocumentFragment: function() {
          var node = new DocumentFragment();
          node.ownerDocument = this;
          node.childNodes = new NodeList();
          return node;
        },
        createTextNode: function(data) {
          var node = new Text();
          node.ownerDocument = this;
          node.appendData(data);
          return node;
        },
        createComment: function(data) {
          var node = new Comment2();
          node.ownerDocument = this;
          node.appendData(data);
          return node;
        },
        /**
         * Returns a new CDATASection node whose data is `data`.
         *
         * __This implementation differs from the specification:__
         * - calling this method on an HTML document does not throw `NotSupportedError`.
         *
         * @param {string} data
         * @returns {CDATASection}
         * @throws DOMException with code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`.
         * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection
         * @see https://dom.spec.whatwg.org/#dom-document-createcdatasection
         */
        createCDATASection: function(data) {
          if (data.indexOf("]]>") !== -1) {
            throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]>"');
          }
          var node = new CDATASection();
          node.ownerDocument = this;
          node.appendData(data);
          return node;
        },
        /**
         * Returns a ProcessingInstruction node whose target is target and data is data.
         *
         * __This implementation differs from the specification:__
         * - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
         *
         * Note: When the resulting document is serialized with `requireWellFormed: true`, the
         * serializer throws with code `INVALID_STATE_ERR` if `.data` contains `?>` (W3C DOM Parsing
         * §3.2.1.7). Without that option the data is emitted verbatim.
         *
         * @param {string} target
         * @param {string} data
         * @returns {ProcessingInstruction}
         * @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction
         * @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
         * @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7
         */
        createProcessingInstruction: function(target, data) {
          var node = new ProcessingInstruction();
          node.ownerDocument = this;
          node.tagName = node.nodeName = node.target = target;
          node.nodeValue = node.data = data;
          return node;
        },
        createAttribute: function(name) {
          var node = new Attr();
          node.ownerDocument = this;
          node.name = name;
          node.nodeName = name;
          node.localName = name;
          node.specified = true;
          return node;
        },
        createEntityReference: function(name) {
          var node = new EntityReference();
          node.ownerDocument = this;
          node.nodeName = name;
          return node;
        },
        // Introduced in DOM Level 2:
        createElementNS: function(namespaceURI, qualifiedName) {
          var node = new Element();
          var pl = qualifiedName.split(":");
          var attrs = node.attributes = new NamedNodeMap();
          node.childNodes = new NodeList();
          node.ownerDocument = this;
          node.nodeName = qualifiedName;
          node.tagName = qualifiedName;
          node.namespaceURI = namespaceURI;
          if (pl.length == 2) {
            node.prefix = pl[0];
            node.localName = pl[1];
          } else {
            node.localName = qualifiedName;
          }
          attrs._ownerElement = node;
          return node;
        },
        // Introduced in DOM Level 2:
        createAttributeNS: function(namespaceURI, qualifiedName) {
          var node = new Attr();
          var pl = qualifiedName.split(":");
          node.ownerDocument = this;
          node.nodeName = qualifiedName;
          node.name = qualifiedName;
          node.namespaceURI = namespaceURI;
          node.specified = true;
          if (pl.length == 2) {
            node.prefix = pl[0];
            node.localName = pl[1];
          } else {
            node.localName = qualifiedName;
          }
          return node;
        }
      };
      _extends(Document, Node3);
      function Element() {
        this._nsMap = {};
      }
      Element.prototype = {
        nodeType: ELEMENT_NODE,
        hasAttribute: function(name) {
          return this.getAttributeNode(name) != null;
        },
        getAttribute: function(name) {
          var attr = this.getAttributeNode(name);
          return attr && attr.value || "";
        },
        getAttributeNode: function(name) {
          return this.attributes.getNamedItem(name);
        },
        setAttribute: function(name, value) {
          var attr = this.ownerDocument.createAttribute(name);
          attr.value = attr.nodeValue = "" + value;
          this.setAttributeNode(attr);
        },
        removeAttribute: function(name) {
          var attr = this.getAttributeNode(name);
          attr && this.removeAttributeNode(attr);
        },
        //four real opeartion method
        appendChild: function(newChild) {
          if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
            return this.insertBefore(newChild, null);
          } else {
            return _appendSingleChild(this, newChild);
          }
        },
        setAttributeNode: function(newAttr) {
          return this.attributes.setNamedItem(newAttr);
        },
        setAttributeNodeNS: function(newAttr) {
          return this.attributes.setNamedItemNS(newAttr);
        },
        removeAttributeNode: function(oldAttr) {
          return this.attributes.removeNamedItem(oldAttr.nodeName);
        },
        //get real attribute name,and remove it by removeAttributeNode
        removeAttributeNS: function(namespaceURI, localName) {
          var old = this.getAttributeNodeNS(namespaceURI, localName);
          old && this.removeAttributeNode(old);
        },
        hasAttributeNS: function(namespaceURI, localName) {
          return this.getAttributeNodeNS(namespaceURI, localName) != null;
        },
        getAttributeNS: function(namespaceURI, localName) {
          var attr = this.getAttributeNodeNS(namespaceURI, localName);
          return attr && attr.value || "";
        },
        setAttributeNS: function(namespaceURI, qualifiedName, value) {
          var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
          attr.value = attr.nodeValue = "" + value;
          this.setAttributeNode(attr);
        },
        getAttributeNodeNS: function(namespaceURI, localName) {
          return this.attributes.getNamedItemNS(namespaceURI, localName);
        },
        getElementsByTagName: function(tagName) {
          return new LiveNodeList(this, function(base) {
            var ls = [];
            _visitNode(base, function(node) {
              if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) {
                ls.push(node);
              }
            });
            return ls;
          });
        },
        getElementsByTagNameNS: function(namespaceURI, localName) {
          return new LiveNodeList(this, function(base) {
            var ls = [];
            _visitNode(base, function(node) {
              if (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) {
                ls.push(node);
              }
            });
            return ls;
          });
        }
      };
      Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
      Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
      _extends(Element, Node3);
      function Attr() {
      }
      Attr.prototype.nodeType = ATTRIBUTE_NODE;
      _extends(Attr, Node3);
      function CharacterData() {
      }
      CharacterData.prototype = {
        data: "",
        substringData: function(offset, count) {
          return this.data.substring(offset, offset + count);
        },
        appendData: function(text) {
          text = this.data + text;
          this.nodeValue = this.data = text;
          this.length = text.length;
        },
        insertData: function(offset, text) {
          this.replaceData(offset, 0, text);
        },
        appendChild: function(newChild) {
          throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
        },
        deleteData: function(offset, count) {
          this.replaceData(offset, count, "");
        },
        replaceData: function(offset, count, text) {
          var start = this.data.substring(0, offset);
          var end = this.data.substring(offset + count);
          text = start + text + end;
          this.nodeValue = this.data = text;
          this.length = text.length;
        }
      };
      _extends(CharacterData, Node3);
      function Text() {
      }
      Text.prototype = {
        nodeName: "#text",
        nodeType: TEXT_NODE,
        splitText: function(offset) {
          var text = this.data;
          var newText = text.substring(offset);
          text = text.substring(0, offset);
          this.data = this.nodeValue = text;
          this.length = text.length;
          var newNode = this.ownerDocument.createTextNode(newText);
          if (this.parentNode) {
            this.parentNode.insertBefore(newNode, this.nextSibling);
          }
          return newNode;
        }
      };
      _extends(Text, CharacterData);
      function Comment2() {
      }
      Comment2.prototype = {
        nodeName: "#comment",
        nodeType: COMMENT_NODE
      };
      _extends(Comment2, CharacterData);
      function CDATASection() {
      }
      CDATASection.prototype = {
        nodeName: "#cdata-section",
        nodeType: CDATA_SECTION_NODE
      };
      _extends(CDATASection, CharacterData);
      function DocumentType() {
      }
      DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
      _extends(DocumentType, Node3);
      function Notation() {
      }
      Notation.prototype.nodeType = NOTATION_NODE;
      _extends(Notation, Node3);
      function Entity() {
      }
      Entity.prototype.nodeType = ENTITY_NODE;
      _extends(Entity, Node3);
      function EntityReference() {
      }
      EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
      _extends(EntityReference, Node3);
      function DocumentFragment() {
      }
      DocumentFragment.prototype.nodeName = "#document-fragment";
      DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
      _extends(DocumentFragment, Node3);
      function ProcessingInstruction() {
      }
      ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
      _extends(ProcessingInstruction, Node3);
      function XMLSerializer() {
      }
      XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter, options) {
        return nodeSerializeToString.call(node, isHtml, nodeFilter, options);
      };
      Node3.prototype.toString = nodeSerializeToString;
      function nodeSerializeToString(isHtml, nodeFilter, options) {
        var requireWellFormed = !!options && !!options.requireWellFormed;
        var buf = [];
        var refNode = this.nodeType == 9 && this.documentElement || this;
        var prefix = refNode.prefix;
        var uri = refNode.namespaceURI;
        if (uri && prefix == null) {
          var prefix = refNode.lookupPrefix(uri);
          if (prefix == null) {
            var visibleNamespaces = [
              { namespace: uri, prefix: null }
              //{namespace:uri,prefix:''}
            ];
          }
        }
        serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces, requireWellFormed);
        return buf.join("");
      }
      function needNamespaceDefine(node, isHTML, visibleNamespaces) {
        var prefix = node.prefix || "";
        var uri = node.namespaceURI;
        if (!uri) {
          return false;
        }
        if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {
          return false;
        }
        var i = visibleNamespaces.length;
        while (i--) {
          var ns = visibleNamespaces[i];
          if (ns.prefix === prefix) {
            return ns.namespace !== uri;
          }
        }
        return true;
      }
      function addSerializedAttribute(buf, qualifiedName, value) {
        buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
      }
      function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
        if (!visibleNamespaces) {
          visibleNamespaces = [];
        }
        walkDOM(node, { ns: visibleNamespaces, isHTML }, {
          enter: function(n, ctx) {
            var ns = ctx.ns;
            var html = ctx.isHTML;
            if (nodeFilter) {
              n = nodeFilter(n);
              if (n) {
                if (typeof n == "string") {
                  buf.push(n);
                  return null;
                }
              } else {
                return null;
              }
            }
            switch (n.nodeType) {
              case ELEMENT_NODE:
                var attrs = n.attributes;
                var len = attrs.length;
                var nodeName = n.tagName;
                html = NAMESPACE.isHTML(n.namespaceURI) || html;
                var prefixedNodeName = nodeName;
                if (!html && !n.prefix && n.namespaceURI) {
                  var defaultNS;
                  for (var ai = 0; ai < attrs.length; ai++) {
                    if (attrs.item(ai).name === "xmlns") {
                      defaultNS = attrs.item(ai).value;
                      break;
                    }
                  }
                  if (!defaultNS) {
                    for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
                      var nsEntry = ns[nsi];
                      if (nsEntry.prefix === "" && nsEntry.namespace === n.namespaceURI) {
                        defaultNS = nsEntry.namespace;
                        break;
                      }
                    }
                  }
                  if (defaultNS !== n.namespaceURI) {
                    for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
                      var nsEntry = ns[nsi];
                      if (nsEntry.namespace === n.namespaceURI) {
                        if (nsEntry.prefix) {
                          prefixedNodeName = nsEntry.prefix + ":" + nodeName;
                        }
                        break;
                      }
                    }
                  }
                }
                buf.push("<", prefixedNodeName);
                var childNs = ns.slice();
                for (var i = 0; i < len; i++) {
                  var attr = attrs.item(i);
                  if (attr.prefix == "xmlns") {
                    childNs.push({ prefix: attr.localName, namespace: attr.value });
                  } else if (attr.nodeName == "xmlns") {
                    childNs.push({ prefix: "", namespace: attr.value });
                  }
                }
                for (var i = 0; i < len; i++) {
                  var attr = attrs.item(i);
                  if (needNamespaceDefine(attr, html, childNs)) {
                    var attrPrefix = attr.prefix || "";
                    var uri = attr.namespaceURI;
                    addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri);
                    childNs.push({ prefix: attrPrefix, namespace: uri });
                  }
                  var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
                  if (filteredAttr) {
                    if (typeof filteredAttr === "string") {
                      buf.push(filteredAttr);
                    } else {
                      addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
                    }
                  }
                }
                if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
                  var nodePrefix = n.prefix || "";
                  var uri = n.namespaceURI;
                  addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri);
                  childNs.push({ prefix: nodePrefix, namespace: uri });
                }
                var child = n.firstChild;
                if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
                  buf.push(">");
                  if (html && /^script$/i.test(nodeName)) {
                    while (child) {
                      if (child.data) {
                        buf.push(child.data);
                      } else {
                        serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
                      }
                      child = child.nextSibling;
                    }
                    buf.push("</", nodeName, ">");
                    return null;
                  }
                  return { ns: childNs, isHTML: html, tag: prefixedNodeName };
                } else {
                  buf.push("/>");
                  return null;
                }
              case DOCUMENT_NODE:
              case DOCUMENT_FRAGMENT_NODE:
                return { ns: ns.slice(), isHTML: html, tag: null };
              case ATTRIBUTE_NODE:
                addSerializedAttribute(buf, n.name, n.value);
                return null;
              case TEXT_NODE:
                buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
                return null;
              case CDATA_SECTION_NODE:
                if (requireWellFormed && n.data.indexOf("]]>") !== -1) {
                  throw new DOMException(INVALID_STATE_ERR, 'The CDATASection data contains "]]>"');
                }
                buf.push("<![CDATA[", n.data.replace(/]]>/g, "]]]]><![CDATA[>"), "]]>");
                return null;
              case COMMENT_NODE:
                if (requireWellFormed && n.data.indexOf("-->") !== -1) {
                  throw new DOMException(INVALID_STATE_ERR, 'The comment node data contains "-->"');
                }
                buf.push("<!--", n.data, "-->");
                return null;
              case DOCUMENT_TYPE_NODE:
                if (requireWellFormed) {
                  if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
                    throw new DOMException(INVALID_STATE_ERR, "DocumentType publicId is not a valid PubidLiteral");
                  }
                  if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) {
                    throw new DOMException(INVALID_STATE_ERR, "DocumentType systemId is not a valid SystemLiteral");
                  }
                  if (n.internalSubset && n.internalSubset.indexOf("]>") !== -1) {
                    throw new DOMException(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]>"');
                  }
                }
                var pubid = n.publicId;
                var sysid = n.systemId;
                buf.push("<!DOCTYPE ", n.name);
                if (pubid) {
                  buf.push(" PUBLIC ", pubid);
                  if (sysid && sysid != ".") {
                    buf.push(" ", sysid);
                  }
                  buf.push(">");
                } else if (sysid && sysid != ".") {
                  buf.push(" SYSTEM ", sysid, ">");
                } else {
                  var sub = n.internalSubset;
                  if (sub) {
                    buf.push(" [", sub, "]");
                  }
                  buf.push(">");
                }
                return null;
              case PROCESSING_INSTRUCTION_NODE:
                if (requireWellFormed && n.data.indexOf("?>") !== -1) {
                  throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
                }
                buf.push("<?", n.target, " ", n.data, "?>");
                return null;
              case ENTITY_REFERENCE_NODE:
                buf.push("&", n.nodeName, ";");
                return null;
              //case ENTITY_NODE:
              //case NOTATION_NODE:
              default:
                buf.push("??", n.nodeName);
                return null;
            }
          },
          exit: function(n, childCtx) {
            if (childCtx && childCtx.tag) {
              buf.push("</", childCtx.tag, ">");
            }
          }
        });
      }
      function importNode(doc, node, deep) {
        var destRoot;
        walkDOM(node, null, {
          enter: function(srcNode, destParent) {
            var destNode = srcNode.cloneNode(false);
            destNode.ownerDocument = doc;
            destNode.parentNode = null;
            if (destParent === null) {
              destRoot = destNode;
            } else {
              destParent.appendChild(destNode);
            }
            var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
            return shouldDeep ? destNode : null;
          }
        });
        return destRoot;
      }
      function cloneNode(doc, node, deep) {
        var destRoot;
        walkDOM(node, null, {
          enter: function(srcNode, destParent) {
            var destNode = new srcNode.constructor();
            for (var n in srcNode) {
              if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
                var v = srcNode[n];
                if (typeof v != "object") {
                  if (v != destNode[n]) {
                    destNode[n] = v;
                  }
                }
              }
            }
            if (srcNode.childNodes) {
              destNode.childNodes = new NodeList();
            }
            destNode.ownerDocument = doc;
            var shouldDeep = deep;
            switch (destNode.nodeType) {
              case ELEMENT_NODE:
                var attrs = srcNode.attributes;
                var attrs2 = destNode.attributes = new NamedNodeMap();
                var len = attrs.length;
                attrs2._ownerElement = destNode;
                for (var i = 0; i < len; i++) {
                  destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
                }
                break;
              case ATTRIBUTE_NODE:
                shouldDeep = true;
            }
            if (destParent !== null) {
              destParent.appendChild(destNode);
            } else {
              destRoot = destNode;
            }
            return shouldDeep ? destNode : null;
          }
        });
        return destRoot;
      }
      function __set__(object2, key, value) {
        object2[key] = value;
      }
      try {
        if (Object.defineProperty) {
          Object.defineProperty(LiveNodeList.prototype, "length", {
            get: function() {
              _updateLiveList(this);
              return this.$$length;
            }
          });
          Object.defineProperty(Node3.prototype, "textContent", {
            get: function() {
              if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
                var buf = [];
                walkDOM(this, null, {
                  enter: function(n) {
                    if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
                      return true;
                    }
                    if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
                      return null;
                    }
                    buf.push(n.nodeValue);
                  }
                });
                return buf.join("");
              }
              return this.nodeValue;
            },
            set: function(data) {
              switch (this.nodeType) {
                case ELEMENT_NODE:
                case DOCUMENT_FRAGMENT_NODE:
                  while (this.firstChild) {
                    this.removeChild(this.firstChild);
                  }
                  if (data || String(data)) {
                    this.appendChild(this.ownerDocument.createTextNode(data));
                  }
                  break;
                default:
                  this.data = data;
                  this.value = data;
                  this.nodeValue = data;
              }
            }
          });
          __set__ = function(object2, key, value) {
            object2["$$" + key] = value;
          };
        }
      } catch (e) {
      }
      exports2.DocumentType = DocumentType;
      exports2.DOMException = DOMException;
      exports2.DOMImplementation = DOMImplementation;
      exports2.Element = Element;
      exports2.Node = Node3;
      exports2.NodeList = NodeList;
      exports2.walkDOM = walkDOM;
      exports2.XMLSerializer = XMLSerializer;
    }
  });

  // node_modules/@xmldom/xmldom/lib/entities.js
  var require_entities = __commonJS({
    "node_modules/@xmldom/xmldom/lib/entities.js"(exports2) {
      "use strict";
      var freeze = require_conventions().freeze;
      exports2.XML_ENTITIES = freeze({
        amp: "&",
        apos: "'",
        gt: ">",
        lt: "<",
        quot: '"'
      });
      exports2.HTML_ENTITIES = freeze({
        Aacute: "\xC1",
        aacute: "\xE1",
        Abreve: "\u0102",
        abreve: "\u0103",
        ac: "\u223E",
        acd: "\u223F",
        acE: "\u223E\u0333",
        Acirc: "\xC2",
        acirc: "\xE2",
        acute: "\xB4",
        Acy: "\u0410",
        acy: "\u0430",
        AElig: "\xC6",
        aelig: "\xE6",
        af: "\u2061",
        Afr: "\u{1D504}",
        afr: "\u{1D51E}",
        Agrave: "\xC0",
        agrave: "\xE0",
        alefsym: "\u2135",
        aleph: "\u2135",
        Alpha: "\u0391",
        alpha: "\u03B1",
        Amacr: "\u0100",
        amacr: "\u0101",
        amalg: "\u2A3F",
        AMP: "&",
        amp: "&",
        And: "\u2A53",
        and: "\u2227",
        andand: "\u2A55",
        andd: "\u2A5C",
        andslope: "\u2A58",
        andv: "\u2A5A",
        ang: "\u2220",
        ange: "\u29A4",
        angle: "\u2220",
        angmsd: "\u2221",
        angmsdaa: "\u29A8",
        angmsdab: "\u29A9",
        angmsdac: "\u29AA",
        angmsdad: "\u29AB",
        angmsdae: "\u29AC",
        angmsdaf: "\u29AD",
        angmsdag: "\u29AE",
        angmsdah: "\u29AF",
        angrt: "\u221F",
        angrtvb: "\u22BE",
        angrtvbd: "\u299D",
        angsph: "\u2222",
        angst: "\xC5",
        angzarr: "\u237C",
        Aogon: "\u0104",
        aogon: "\u0105",
        Aopf: "\u{1D538}",
        aopf: "\u{1D552}",
        ap: "\u2248",
        apacir: "\u2A6F",
        apE: "\u2A70",
        ape: "\u224A",
        apid: "\u224B",
        apos: "'",
        ApplyFunction: "\u2061",
        approx: "\u2248",
        approxeq: "\u224A",
        Aring: "\xC5",
        aring: "\xE5",
        Ascr: "\u{1D49C}",
        ascr: "\u{1D4B6}",
        Assign: "\u2254",
        ast: "*",
        asymp: "\u2248",
        asympeq: "\u224D",
        Atilde: "\xC3",
        atilde: "\xE3",
        Auml: "\xC4",
        auml: "\xE4",
        awconint: "\u2233",
        awint: "\u2A11",
        backcong: "\u224C",
        backepsilon: "\u03F6",
        backprime: "\u2035",
        backsim: "\u223D",
        backsimeq: "\u22CD",
        Backslash: "\u2216",
        Barv: "\u2AE7",
        barvee: "\u22BD",
        Barwed: "\u2306",
        barwed: "\u2305",
        barwedge: "\u2305",
        bbrk: "\u23B5",
        bbrktbrk: "\u23B6",
        bcong: "\u224C",
        Bcy: "\u0411",
        bcy: "\u0431",
        bdquo: "\u201E",
        becaus: "\u2235",
        Because: "\u2235",
        because: "\u2235",
        bemptyv: "\u29B0",
        bepsi: "\u03F6",
        bernou: "\u212C",
        Bernoullis: "\u212C",
        Beta: "\u0392",
        beta: "\u03B2",
        beth: "\u2136",
        between: "\u226C",
        Bfr: "\u{1D505}",
        bfr: "\u{1D51F}",
        bigcap: "\u22C2",
        bigcirc: "\u25EF",
        bigcup: "\u22C3",
        bigodot: "\u2A00",
        bigoplus: "\u2A01",
        bigotimes: "\u2A02",
        bigsqcup: "\u2A06",
        bigstar: "\u2605",
        bigtriangledown: "\u25BD",
        bigtriangleup: "\u25B3",
        biguplus: "\u2A04",
        bigvee: "\u22C1",
        bigwedge: "\u22C0",
        bkarow: "\u290D",
        blacklozenge: "\u29EB",
        blacksquare: "\u25AA",
        blacktriangle: "\u25B4",
        blacktriangledown: "\u25BE",
        blacktriangleleft: "\u25C2",
        blacktriangleright: "\u25B8",
        blank: "\u2423",
        blk12: "\u2592",
        blk14: "\u2591",
        blk34: "\u2593",
        block: "\u2588",
        bne: "=\u20E5",
        bnequiv: "\u2261\u20E5",
        bNot: "\u2AED",
        bnot: "\u2310",
        Bopf: "\u{1D539}",
        bopf: "\u{1D553}",
        bot: "\u22A5",
        bottom: "\u22A5",
        bowtie: "\u22C8",
        boxbox: "\u29C9",
        boxDL: "\u2557",
        boxDl: "\u2556",
        boxdL: "\u2555",
        boxdl: "\u2510",
        boxDR: "\u2554",
        boxDr: "\u2553",
        boxdR: "\u2552",
        boxdr: "\u250C",
        boxH: "\u2550",
        boxh: "\u2500",
        boxHD: "\u2566",
        boxHd: "\u2564",
        boxhD: "\u2565",
        boxhd: "\u252C",
        boxHU: "\u2569",
        boxHu: "\u2567",
        boxhU: "\u2568",
        boxhu: "\u2534",
        boxminus: "\u229F",
        boxplus: "\u229E",
        boxtimes: "\u22A0",
        boxUL: "\u255D",
        boxUl: "\u255C",
        boxuL: "\u255B",
        boxul: "\u2518",
        boxUR: "\u255A",
        boxUr: "\u2559",
        boxuR: "\u2558",
        boxur: "\u2514",
        boxV: "\u2551",
        boxv: "\u2502",
        boxVH: "\u256C",
        boxVh: "\u256B",
        boxvH: "\u256A",
        boxvh: "\u253C",
        boxVL: "\u2563",
        boxVl: "\u2562",
        boxvL: "\u2561",
        boxvl: "\u2524",
        boxVR: "\u2560",
        boxVr: "\u255F",
        boxvR: "\u255E",
        boxvr: "\u251C",
        bprime: "\u2035",
        Breve: "\u02D8",
        breve: "\u02D8",
        brvbar: "\xA6",
        Bscr: "\u212C",
        bscr: "\u{1D4B7}",
        bsemi: "\u204F",
        bsim: "\u223D",
        bsime: "\u22CD",
        bsol: "\\",
        bsolb: "\u29C5",
        bsolhsub: "\u27C8",
        bull: "\u2022",
        bullet: "\u2022",
        bump: "\u224E",
        bumpE: "\u2AAE",
        bumpe: "\u224F",
        Bumpeq: "\u224E",
        bumpeq: "\u224F",
        Cacute: "\u0106",
        cacute: "\u0107",
        Cap: "\u22D2",
        cap: "\u2229",
        capand: "\u2A44",
        capbrcup: "\u2A49",
        capcap: "\u2A4B",
        capcup: "\u2A47",
        capdot: "\u2A40",
        CapitalDifferentialD: "\u2145",
        caps: "\u2229\uFE00",
        caret: "\u2041",
        caron: "\u02C7",
        Cayleys: "\u212D",
        ccaps: "\u2A4D",
        Ccaron: "\u010C",
        ccaron: "\u010D",
        Ccedil: "\xC7",
        ccedil: "\xE7",
        Ccirc: "\u0108",
        ccirc: "\u0109",
        Cconint: "\u2230",
        ccups: "\u2A4C",
        ccupssm: "\u2A50",
        Cdot: "\u010A",
        cdot: "\u010B",
        cedil: "\xB8",
        Cedilla: "\xB8",
        cemptyv: "\u29B2",
        cent: "\xA2",
        CenterDot: "\xB7",
        centerdot: "\xB7",
        Cfr: "\u212D",
        cfr: "\u{1D520}",
        CHcy: "\u0427",
        chcy: "\u0447",
        check: "\u2713",
        checkmark: "\u2713",
        Chi: "\u03A7",
        chi: "\u03C7",
        cir: "\u25CB",
        circ: "\u02C6",
        circeq: "\u2257",
        circlearrowleft: "\u21BA",
        circlearrowright: "\u21BB",
        circledast: "\u229B",
        circledcirc: "\u229A",
        circleddash: "\u229D",
        CircleDot: "\u2299",
        circledR: "\xAE",
        circledS: "\u24C8",
        CircleMinus: "\u2296",
        CirclePlus: "\u2295",
        CircleTimes: "\u2297",
        cirE: "\u29C3",
        cire: "\u2257",
        cirfnint: "\u2A10",
        cirmid: "\u2AEF",
        cirscir: "\u29C2",
        ClockwiseContourIntegral: "\u2232",
        CloseCurlyDoubleQuote: "\u201D",
        CloseCurlyQuote: "\u2019",
        clubs: "\u2663",
        clubsuit: "\u2663",
        Colon: "\u2237",
        colon: ":",
        Colone: "\u2A74",
        colone: "\u2254",
        coloneq: "\u2254",
        comma: ",",
        commat: "@",
        comp: "\u2201",
        compfn: "\u2218",
        complement: "\u2201",
        complexes: "\u2102",
        cong: "\u2245",
        congdot: "\u2A6D",
        Congruent: "\u2261",
        Conint: "\u222F",
        conint: "\u222E",
        ContourIntegral: "\u222E",
        Copf: "\u2102",
        copf: "\u{1D554}",
        coprod: "\u2210",
        Coproduct: "\u2210",
        COPY: "\xA9",
        copy: "\xA9",
        copysr: "\u2117",
        CounterClockwiseContourIntegral: "\u2233",
        crarr: "\u21B5",
        Cross: "\u2A2F",
        cross: "\u2717",
        Cscr: "\u{1D49E}",
        cscr: "\u{1D4B8}",
        csub: "\u2ACF",
        csube: "\u2AD1",
        csup: "\u2AD0",
        csupe: "\u2AD2",
        ctdot: "\u22EF",
        cudarrl: "\u2938",
        cudarrr: "\u2935",
        cuepr: "\u22DE",
        cuesc: "\u22DF",
        cularr: "\u21B6",
        cularrp: "\u293D",
        Cup: "\u22D3",
        cup: "\u222A",
        cupbrcap: "\u2A48",
        CupCap: "\u224D",
        cupcap: "\u2A46",
        cupcup: "\u2A4A",
        cupdot: "\u228D",
        cupor: "\u2A45",
        cups: "\u222A\uFE00",
        curarr: "\u21B7",
        curarrm: "\u293C",
        curlyeqprec: "\u22DE",
        curlyeqsucc: "\u22DF",
        curlyvee: "\u22CE",
        curlywedge: "\u22CF",
        curren: "\xA4",
        curvearrowleft: "\u21B6",
        curvearrowright: "\u21B7",
        cuvee: "\u22CE",
        cuwed: "\u22CF",
        cwconint: "\u2232",
        cwint: "\u2231",
        cylcty: "\u232D",
        Dagger: "\u2021",
        dagger: "\u2020",
        daleth: "\u2138",
        Darr: "\u21A1",
        dArr: "\u21D3",
        darr: "\u2193",
        dash: "\u2010",
        Dashv: "\u2AE4",
        dashv: "\u22A3",
        dbkarow: "\u290F",
        dblac: "\u02DD",
        Dcaron: "\u010E",
        dcaron: "\u010F",
        Dcy: "\u0414",
        dcy: "\u0434",
        DD: "\u2145",
        dd: "\u2146",
        ddagger: "\u2021",
        ddarr: "\u21CA",
        DDotrahd: "\u2911",
        ddotseq: "\u2A77",
        deg: "\xB0",
        Del: "\u2207",
        Delta: "\u0394",
        delta: "\u03B4",
        demptyv: "\u29B1",
        dfisht: "\u297F",
        Dfr: "\u{1D507}",
        dfr: "\u{1D521}",
        dHar: "\u2965",
        dharl: "\u21C3",
        dharr: "\u21C2",
        DiacriticalAcute: "\xB4",
        DiacriticalDot: "\u02D9",
        DiacriticalDoubleAcute: "\u02DD",
        DiacriticalGrave: "`",
        DiacriticalTilde: "\u02DC",
        diam: "\u22C4",
        Diamond: "\u22C4",
        diamond: "\u22C4",
        diamondsuit: "\u2666",
        diams: "\u2666",
        die: "\xA8",
        DifferentialD: "\u2146",
        digamma: "\u03DD",
        disin: "\u22F2",
        div: "\xF7",
        divide: "\xF7",
        divideontimes: "\u22C7",
        divonx: "\u22C7",
        DJcy: "\u0402",
        djcy: "\u0452",
        dlcorn: "\u231E",
        dlcrop: "\u230D",
        dollar: "$",
        Dopf: "\u{1D53B}",
        dopf: "\u{1D555}",
        Dot: "\xA8",
        dot: "\u02D9",
        DotDot: "\u20DC",
        doteq: "\u2250",
        doteqdot: "\u2251",
        DotEqual: "\u2250",
        dotminus: "\u2238",
        dotplus: "\u2214",
        dotsquare: "\u22A1",
        doublebarwedge: "\u2306",
        DoubleContourIntegral: "\u222F",
        DoubleDot: "\xA8",
        DoubleDownArrow: "\u21D3",
        DoubleLeftArrow: "\u21D0",
        DoubleLeftRightArrow: "\u21D4",
        DoubleLeftTee: "\u2AE4",
        DoubleLongLeftArrow: "\u27F8",
        DoubleLongLeftRightArrow: "\u27FA",
        DoubleLongRightArrow: "\u27F9",
        DoubleRightArrow: "\u21D2",
        DoubleRightTee: "\u22A8",
        DoubleUpArrow: "\u21D1",
        DoubleUpDownArrow: "\u21D5",
        DoubleVerticalBar: "\u2225",
        DownArrow: "\u2193",
        Downarrow: "\u21D3",
        downarrow: "\u2193",
        DownArrowBar: "\u2913",
        DownArrowUpArrow: "\u21F5",
        DownBreve: "\u0311",
        downdownarrows: "\u21CA",
        downharpoonleft: "\u21C3",
        downharpoonright: "\u21C2",
        DownLeftRightVector: "\u2950",
        DownLeftTeeVector: "\u295E",
        DownLeftVector: "\u21BD",
        DownLeftVectorBar: "\u2956",
        DownRightTeeVector: "\u295F",
        DownRightVector: "\u21C1",
        DownRightVectorBar: "\u2957",
        DownTee: "\u22A4",
        DownTeeArrow: "\u21A7",
        drbkarow: "\u2910",
        drcorn: "\u231F",
        drcrop: "\u230C",
        Dscr: "\u{1D49F}",
        dscr: "\u{1D4B9}",
        DScy: "\u0405",
        dscy: "\u0455",
        dsol: "\u29F6",
        Dstrok: "\u0110",
        dstrok: "\u0111",
        dtdot: "\u22F1",
        dtri: "\u25BF",
        dtrif: "\u25BE",
        duarr: "\u21F5",
        duhar: "\u296F",
        dwangle: "\u29A6",
        DZcy: "\u040F",
        dzcy: "\u045F",
        dzigrarr: "\u27FF",
        Eacute: "\xC9",
        eacute: "\xE9",
        easter: "\u2A6E",
        Ecaron: "\u011A",
        ecaron: "\u011B",
        ecir: "\u2256",
        Ecirc: "\xCA",
        ecirc: "\xEA",
        ecolon: "\u2255",
        Ecy: "\u042D",
        ecy: "\u044D",
        eDDot: "\u2A77",
        Edot: "\u0116",
        eDot: "\u2251",
        edot: "\u0117",
        ee: "\u2147",
        efDot: "\u2252",
        Efr: "\u{1D508}",
        efr: "\u{1D522}",
        eg: "\u2A9A",
        Egrave: "\xC8",
        egrave: "\xE8",
        egs: "\u2A96",
        egsdot: "\u2A98",
        el: "\u2A99",
        Element: "\u2208",
        elinters: "\u23E7",
        ell: "\u2113",
        els: "\u2A95",
        elsdot: "\u2A97",
        Emacr: "\u0112",
        emacr: "\u0113",
        empty: "\u2205",
        emptyset: "\u2205",
        EmptySmallSquare: "\u25FB",
        emptyv: "\u2205",
        EmptyVerySmallSquare: "\u25AB",
        emsp: "\u2003",
        emsp13: "\u2004",
        emsp14: "\u2005",
        ENG: "\u014A",
        eng: "\u014B",
        ensp: "\u2002",
        Eogon: "\u0118",
        eogon: "\u0119",
        Eopf: "\u{1D53C}",
        eopf: "\u{1D556}",
        epar: "\u22D5",
        eparsl: "\u29E3",
        eplus: "\u2A71",
        epsi: "\u03B5",
        Epsilon: "\u0395",
        epsilon: "\u03B5",
        epsiv: "\u03F5",
        eqcirc: "\u2256",
        eqcolon: "\u2255",
        eqsim: "\u2242",
        eqslantgtr: "\u2A96",
        eqslantless: "\u2A95",
        Equal: "\u2A75",
        equals: "=",
        EqualTilde: "\u2242",
        equest: "\u225F",
        Equilibrium: "\u21CC",
        equiv: "\u2261",
        equivDD: "\u2A78",
        eqvparsl: "\u29E5",
        erarr: "\u2971",
        erDot: "\u2253",
        Escr: "\u2130",
        escr: "\u212F",
        esdot: "\u2250",
        Esim: "\u2A73",
        esim: "\u2242",
        Eta: "\u0397",
        eta: "\u03B7",
        ETH: "\xD0",
        eth: "\xF0",
        Euml: "\xCB",
        euml: "\xEB",
        euro: "\u20AC",
        excl: "!",
        exist: "\u2203",
        Exists: "\u2203",
        expectation: "\u2130",
        ExponentialE: "\u2147",
        exponentiale: "\u2147",
        fallingdotseq: "\u2252",
        Fcy: "\u0424",
        fcy: "\u0444",
        female: "\u2640",
        ffilig: "\uFB03",
        fflig: "\uFB00",
        ffllig: "\uFB04",
        Ffr: "\u{1D509}",
        ffr: "\u{1D523}",
        filig: "\uFB01",
        FilledSmallSquare: "\u25FC",
        FilledVerySmallSquare: "\u25AA",
        fjlig: "fj",
        flat: "\u266D",
        fllig: "\uFB02",
        fltns: "\u25B1",
        fnof: "\u0192",
        Fopf: "\u{1D53D}",
        fopf: "\u{1D557}",
        ForAll: "\u2200",
        forall: "\u2200",
        fork: "\u22D4",
        forkv: "\u2AD9",
        Fouriertrf: "\u2131",
        fpartint: "\u2A0D",
        frac12: "\xBD",
        frac13: "\u2153",
        frac14: "\xBC",
        frac15: "\u2155",
        frac16: "\u2159",
        frac18: "\u215B",
        frac23: "\u2154",
        frac25: "\u2156",
        frac34: "\xBE",
        frac35: "\u2157",
        frac38: "\u215C",
        frac45: "\u2158",
        frac56: "\u215A",
        frac58: "\u215D",
        frac78: "\u215E",
        frasl: "\u2044",
        frown: "\u2322",
        Fscr: "\u2131",
        fscr: "\u{1D4BB}",
        gacute: "\u01F5",
        Gamma: "\u0393",
        gamma: "\u03B3",
        Gammad: "\u03DC",
        gammad: "\u03DD",
        gap: "\u2A86",
        Gbreve: "\u011E",
        gbreve: "\u011F",
        Gcedil: "\u0122",
        Gcirc: "\u011C",
        gcirc: "\u011D",
        Gcy: "\u0413",
        gcy: "\u0433",
        Gdot: "\u0120",
        gdot: "\u0121",
        gE: "\u2267",
        ge: "\u2265",
        gEl: "\u2A8C",
        gel: "\u22DB",
        geq: "\u2265",
        geqq: "\u2267",
        geqslant: "\u2A7E",
        ges: "\u2A7E",
        gescc: "\u2AA9",
        gesdot: "\u2A80",
        gesdoto: "\u2A82",
        gesdotol: "\u2A84",
        gesl: "\u22DB\uFE00",
        gesles: "\u2A94",
        Gfr: "\u{1D50A}",
        gfr: "\u{1D524}",
        Gg: "\u22D9",
        gg: "\u226B",
        ggg: "\u22D9",
        gimel: "\u2137",
        GJcy: "\u0403",
        gjcy: "\u0453",
        gl: "\u2277",
        gla: "\u2AA5",
        glE: "\u2A92",
        glj: "\u2AA4",
        gnap: "\u2A8A",
        gnapprox: "\u2A8A",
        gnE: "\u2269",
        gne: "\u2A88",
        gneq: "\u2A88",
        gneqq: "\u2269",
        gnsim: "\u22E7",
        Gopf: "\u{1D53E}",
        gopf: "\u{1D558}",
        grave: "`",
        GreaterEqual: "\u2265",
        GreaterEqualLess: "\u22DB",
        GreaterFullEqual: "\u2267",
        GreaterGreater: "\u2AA2",
        GreaterLess: "\u2277",
        GreaterSlantEqual: "\u2A7E",
        GreaterTilde: "\u2273",
        Gscr: "\u{1D4A2}",
        gscr: "\u210A",
        gsim: "\u2273",
        gsime: "\u2A8E",
        gsiml: "\u2A90",
        Gt: "\u226B",
        GT: ">",
        gt: ">",
        gtcc: "\u2AA7",
        gtcir: "\u2A7A",
        gtdot: "\u22D7",
        gtlPar: "\u2995",
        gtquest: "\u2A7C",
        gtrapprox: "\u2A86",
        gtrarr: "\u2978",
        gtrdot: "\u22D7",
        gtreqless: "\u22DB",
        gtreqqless: "\u2A8C",
        gtrless: "\u2277",
        gtrsim: "\u2273",
        gvertneqq: "\u2269\uFE00",
        gvnE: "\u2269\uFE00",
        Hacek: "\u02C7",
        hairsp: "\u200A",
        half: "\xBD",
        hamilt: "\u210B",
        HARDcy: "\u042A",
        hardcy: "\u044A",
        hArr: "\u21D4",
        harr: "\u2194",
        harrcir: "\u2948",
        harrw: "\u21AD",
        Hat: "^",
        hbar: "\u210F",
        Hcirc: "\u0124",
        hcirc: "\u0125",
        hearts: "\u2665",
        heartsuit: "\u2665",
        hellip: "\u2026",
        hercon: "\u22B9",
        Hfr: "\u210C",
        hfr: "\u{1D525}",
        HilbertSpace: "\u210B",
        hksearow: "\u2925",
        hkswarow: "\u2926",
        hoarr: "\u21FF",
        homtht: "\u223B",
        hookleftarrow: "\u21A9",
        hookrightarrow: "\u21AA",
        Hopf: "\u210D",
        hopf: "\u{1D559}",
        horbar: "\u2015",
        HorizontalLine: "\u2500",
        Hscr: "\u210B",
        hscr: "\u{1D4BD}",
        hslash: "\u210F",
        Hstrok: "\u0126",
        hstrok: "\u0127",
        HumpDownHump: "\u224E",
        HumpEqual: "\u224F",
        hybull: "\u2043",
        hyphen: "\u2010",
        Iacute: "\xCD",
        iacute: "\xED",
        ic: "\u2063",
        Icirc: "\xCE",
        icirc: "\xEE",
        Icy: "\u0418",
        icy: "\u0438",
        Idot: "\u0130",
        IEcy: "\u0415",
        iecy: "\u0435",
        iexcl: "\xA1",
        iff: "\u21D4",
        Ifr: "\u2111",
        ifr: "\u{1D526}",
        Igrave: "\xCC",
        igrave: "\xEC",
        ii: "\u2148",
        iiiint: "\u2A0C",
        iiint: "\u222D",
        iinfin: "\u29DC",
        iiota: "\u2129",
        IJlig: "\u0132",
        ijlig: "\u0133",
        Im: "\u2111",
        Imacr: "\u012A",
        imacr: "\u012B",
        image: "\u2111",
        ImaginaryI: "\u2148",
        imagline: "\u2110",
        imagpart: "\u2111",
        imath: "\u0131",
        imof: "\u22B7",
        imped: "\u01B5",
        Implies: "\u21D2",
        in: "\u2208",
        incare: "\u2105",
        infin: "\u221E",
        infintie: "\u29DD",
        inodot: "\u0131",
        Int: "\u222C",
        int: "\u222B",
        intcal: "\u22BA",
        integers: "\u2124",
        Integral: "\u222B",
        intercal: "\u22BA",
        Intersection: "\u22C2",
        intlarhk: "\u2A17",
        intprod: "\u2A3C",
        InvisibleComma: "\u2063",
        InvisibleTimes: "\u2062",
        IOcy: "\u0401",
        iocy: "\u0451",
        Iogon: "\u012E",
        iogon: "\u012F",
        Iopf: "\u{1D540}",
        iopf: "\u{1D55A}",
        Iota: "\u0399",
        iota: "\u03B9",
        iprod: "\u2A3C",
        iquest: "\xBF",
        Iscr: "\u2110",
        iscr: "\u{1D4BE}",
        isin: "\u2208",
        isindot: "\u22F5",
        isinE: "\u22F9",
        isins: "\u22F4",
        isinsv: "\u22F3",
        isinv: "\u2208",
        it: "\u2062",
        Itilde: "\u0128",
        itilde: "\u0129",
        Iukcy: "\u0406",
        iukcy: "\u0456",
        Iuml: "\xCF",
        iuml: "\xEF",
        Jcirc: "\u0134",
        jcirc: "\u0135",
        Jcy: "\u0419",
        jcy: "\u0439",
        Jfr: "\u{1D50D}",
        jfr: "\u{1D527}",
        jmath: "\u0237",
        Jopf: "\u{1D541}",
        jopf: "\u{1D55B}",
        Jscr: "\u{1D4A5}",
        jscr: "\u{1D4BF}",
        Jsercy: "\u0408",
        jsercy: "\u0458",
        Jukcy: "\u0404",
        jukcy: "\u0454",
        Kappa: "\u039A",
        kappa: "\u03BA",
        kappav: "\u03F0",
        Kcedil: "\u0136",
        kcedil: "\u0137",
        Kcy: "\u041A",
        kcy: "\u043A",
        Kfr: "\u{1D50E}",
        kfr: "\u{1D528}",
        kgreen: "\u0138",
        KHcy: "\u0425",
        khcy: "\u0445",
        KJcy: "\u040C",
        kjcy: "\u045C",
        Kopf: "\u{1D542}",
        kopf: "\u{1D55C}",
        Kscr: "\u{1D4A6}",
        kscr: "\u{1D4C0}",
        lAarr: "\u21DA",
        Lacute: "\u0139",
        lacute: "\u013A",
        laemptyv: "\u29B4",
        lagran: "\u2112",
        Lambda: "\u039B",
        lambda: "\u03BB",
        Lang: "\u27EA",
        lang: "\u27E8",
        langd: "\u2991",
        langle: "\u27E8",
        lap: "\u2A85",
        Laplacetrf: "\u2112",
        laquo: "\xAB",
        Larr: "\u219E",
        lArr: "\u21D0",
        larr: "\u2190",
        larrb: "\u21E4",
        larrbfs: "\u291F",
        larrfs: "\u291D",
        larrhk: "\u21A9",
        larrlp: "\u21AB",
        larrpl: "\u2939",
        larrsim: "\u2973",
        larrtl: "\u21A2",
        lat: "\u2AAB",
        lAtail: "\u291B",
        latail: "\u2919",
        late: "\u2AAD",
        lates: "\u2AAD\uFE00",
        lBarr: "\u290E",
        lbarr: "\u290C",
        lbbrk: "\u2772",
        lbrace: "{",
        lbrack: "[",
        lbrke: "\u298B",
        lbrksld: "\u298F",
        lbrkslu: "\u298D",
        Lcaron: "\u013D",
        lcaron: "\u013E",
        Lcedil: "\u013B",
        lcedil: "\u013C",
        lceil: "\u2308",
        lcub: "{",
        Lcy: "\u041B",
        lcy: "\u043B",
        ldca: "\u2936",
        ldquo: "\u201C",
        ldquor: "\u201E",
        ldrdhar: "\u2967",
        ldrushar: "\u294B",
        ldsh: "\u21B2",
        lE: "\u2266",
        le: "\u2264",
        LeftAngleBracket: "\u27E8",
        LeftArrow: "\u2190",
        Leftarrow: "\u21D0",
        leftarrow: "\u2190",
        LeftArrowBar: "\u21E4",
        LeftArrowRightArrow: "\u21C6",
        leftarrowtail: "\u21A2",
        LeftCeiling: "\u2308",
        LeftDoubleBracket: "\u27E6",
        LeftDownTeeVector: "\u2961",
        LeftDownVector: "\u21C3",
        LeftDownVectorBar: "\u2959",
        LeftFloor: "\u230A",
        leftharpoondown: "\u21BD",
        leftharpoonup: "\u21BC",
        leftleftarrows: "\u21C7",
        LeftRightArrow: "\u2194",
        Leftrightarrow: "\u21D4",
        leftrightarrow: "\u2194",
        leftrightarrows: "\u21C6",
        leftrightharpoons: "\u21CB",
        leftrightsquigarrow: "\u21AD",
        LeftRightVector: "\u294E",
        LeftTee: "\u22A3",
        LeftTeeArrow: "\u21A4",
        LeftTeeVector: "\u295A",
        leftthreetimes: "\u22CB",
        LeftTriangle: "\u22B2",
        LeftTriangleBar: "\u29CF",
        LeftTriangleEqual: "\u22B4",
        LeftUpDownVector: "\u2951",
        LeftUpTeeVector: "\u2960",
        LeftUpVector: "\u21BF",
        LeftUpVectorBar: "\u2958",
        LeftVector: "\u21BC",
        LeftVectorBar: "\u2952",
        lEg: "\u2A8B",
        leg: "\u22DA",
        leq: "\u2264",
        leqq: "\u2266",
        leqslant: "\u2A7D",
        les: "\u2A7D",
        lescc: "\u2AA8",
        lesdot: "\u2A7F",
        lesdoto: "\u2A81",
        lesdotor: "\u2A83",
        lesg: "\u22DA\uFE00",
        lesges: "\u2A93",
        lessapprox: "\u2A85",
        lessdot: "\u22D6",
        lesseqgtr: "\u22DA",
        lesseqqgtr: "\u2A8B",
        LessEqualGreater: "\u22DA",
        LessFullEqual: "\u2266",
        LessGreater: "\u2276",
        lessgtr: "\u2276",
        LessLess: "\u2AA1",
        lesssim: "\u2272",
        LessSlantEqual: "\u2A7D",
        LessTilde: "\u2272",
        lfisht: "\u297C",
        lfloor: "\u230A",
        Lfr: "\u{1D50F}",
        lfr: "\u{1D529}",
        lg: "\u2276",
        lgE: "\u2A91",
        lHar: "\u2962",
        lhard: "\u21BD",
        lharu: "\u21BC",
        lharul: "\u296A",
        lhblk: "\u2584",
        LJcy: "\u0409",
        ljcy: "\u0459",
        Ll: "\u22D8",
        ll: "\u226A",
        llarr: "\u21C7",
        llcorner: "\u231E",
        Lleftarrow: "\u21DA",
        llhard: "\u296B",
        lltri: "\u25FA",
        Lmidot: "\u013F",
        lmidot: "\u0140",
        lmoust: "\u23B0",
        lmoustache: "\u23B0",
        lnap: "\u2A89",
        lnapprox: "\u2A89",
        lnE: "\u2268",
        lne: "\u2A87",
        lneq: "\u2A87",
        lneqq: "\u2268",
        lnsim: "\u22E6",
        loang: "\u27EC",
        loarr: "\u21FD",
        lobrk: "\u27E6",
        LongLeftArrow: "\u27F5",
        Longleftarrow: "\u27F8",
        longleftarrow: "\u27F5",
        LongLeftRightArrow: "\u27F7",
        Longleftrightarrow: "\u27FA",
        longleftrightarrow: "\u27F7",
        longmapsto: "\u27FC",
        LongRightArrow: "\u27F6",
        Longrightarrow: "\u27F9",
        longrightarrow: "\u27F6",
        looparrowleft: "\u21AB",
        looparrowright: "\u21AC",
        lopar: "\u2985",
        Lopf: "\u{1D543}",
        lopf: "\u{1D55D}",
        loplus: "\u2A2D",
        lotimes: "\u2A34",
        lowast: "\u2217",
        lowbar: "_",
        LowerLeftArrow: "\u2199",
        LowerRightArrow: "\u2198",
        loz: "\u25CA",
        lozenge: "\u25CA",
        lozf: "\u29EB",
        lpar: "(",
        lparlt: "\u2993",
        lrarr: "\u21C6",
        lrcorner: "\u231F",
        lrhar: "\u21CB",
        lrhard: "\u296D",
        lrm: "\u200E",
        lrtri: "\u22BF",
        lsaquo: "\u2039",
        Lscr: "\u2112",
        lscr: "\u{1D4C1}",
        Lsh: "\u21B0",
        lsh: "\u21B0",
        lsim: "\u2272",
        lsime: "\u2A8D",
        lsimg: "\u2A8F",
        lsqb: "[",
        lsquo: "\u2018",
        lsquor: "\u201A",
        Lstrok: "\u0141",
        lstrok: "\u0142",
        Lt: "\u226A",
        LT: "<",
        lt: "<",
        ltcc: "\u2AA6",
        ltcir: "\u2A79",
        ltdot: "\u22D6",
        lthree: "\u22CB",
        ltimes: "\u22C9",
        ltlarr: "\u2976",
        ltquest: "\u2A7B",
        ltri: "\u25C3",
        ltrie: "\u22B4",
        ltrif: "\u25C2",
        ltrPar: "\u2996",
        lurdshar: "\u294A",
        luruhar: "\u2966",
        lvertneqq: "\u2268\uFE00",
        lvnE: "\u2268\uFE00",
        macr: "\xAF",
        male: "\u2642",
        malt: "\u2720",
        maltese: "\u2720",
        Map: "\u2905",
        map: "\u21A6",
        mapsto: "\u21A6",
        mapstodown: "\u21A7",
        mapstoleft: "\u21A4",
        mapstoup: "\u21A5",
        marker: "\u25AE",
        mcomma: "\u2A29",
        Mcy: "\u041C",
        mcy: "\u043C",
        mdash: "\u2014",
        mDDot: "\u223A",
        measuredangle: "\u2221",
        MediumSpace: "\u205F",
        Mellintrf: "\u2133",
        Mfr: "\u{1D510}",
        mfr: "\u{1D52A}",
        mho: "\u2127",
        micro: "\xB5",
        mid: "\u2223",
        midast: "*",
        midcir: "\u2AF0",
        middot: "\xB7",
        minus: "\u2212",
        minusb: "\u229F",
        minusd: "\u2238",
        minusdu: "\u2A2A",
        MinusPlus: "\u2213",
        mlcp: "\u2ADB",
        mldr: "\u2026",
        mnplus: "\u2213",
        models: "\u22A7",
        Mopf: "\u{1D544}",
        mopf: "\u{1D55E}",
        mp: "\u2213",
        Mscr: "\u2133",
        mscr: "\u{1D4C2}",
        mstpos: "\u223E",
        Mu: "\u039C",
        mu: "\u03BC",
        multimap: "\u22B8",
        mumap: "\u22B8",
        nabla: "\u2207",
        Nacute: "\u0143",
        nacute: "\u0144",
        nang: "\u2220\u20D2",
        nap: "\u2249",
        napE: "\u2A70\u0338",
        napid: "\u224B\u0338",
        napos: "\u0149",
        napprox: "\u2249",
        natur: "\u266E",
        natural: "\u266E",
        naturals: "\u2115",
        nbsp: "\xA0",
        nbump: "\u224E\u0338",
        nbumpe: "\u224F\u0338",
        ncap: "\u2A43",
        Ncaron: "\u0147",
        ncaron: "\u0148",
        Ncedil: "\u0145",
        ncedil: "\u0146",
        ncong: "\u2247",
        ncongdot: "\u2A6D\u0338",
        ncup: "\u2A42",
        Ncy: "\u041D",
        ncy: "\u043D",
        ndash: "\u2013",
        ne: "\u2260",
        nearhk: "\u2924",
        neArr: "\u21D7",
        nearr: "\u2197",
        nearrow: "\u2197",
        nedot: "\u2250\u0338",
        NegativeMediumSpace: "\u200B",
        NegativeThickSpace: "\u200B",
        NegativeThinSpace: "\u200B",
        NegativeVeryThinSpace: "\u200B",
        nequiv: "\u2262",
        nesear: "\u2928",
        nesim: "\u2242\u0338",
        NestedGreaterGreater: "\u226B",
        NestedLessLess: "\u226A",
        NewLine: "\n",
        nexist: "\u2204",
        nexists: "\u2204",
        Nfr: "\u{1D511}",
        nfr: "\u{1D52B}",
        ngE: "\u2267\u0338",
        nge: "\u2271",
        ngeq: "\u2271",
        ngeqq: "\u2267\u0338",
        ngeqslant: "\u2A7E\u0338",
        nges: "\u2A7E\u0338",
        nGg: "\u22D9\u0338",
        ngsim: "\u2275",
        nGt: "\u226B\u20D2",
        ngt: "\u226F",
        ngtr: "\u226F",
        nGtv: "\u226B\u0338",
        nhArr: "\u21CE",
        nharr: "\u21AE",
        nhpar: "\u2AF2",
        ni: "\u220B",
        nis: "\u22FC",
        nisd: "\u22FA",
        niv: "\u220B",
        NJcy: "\u040A",
        njcy: "\u045A",
        nlArr: "\u21CD",
        nlarr: "\u219A",
        nldr: "\u2025",
        nlE: "\u2266\u0338",
        nle: "\u2270",
        nLeftarrow: "\u21CD",
        nleftarrow: "\u219A",
        nLeftrightarrow: "\u21CE",
        nleftrightarrow: "\u21AE",
        nleq: "\u2270",
        nleqq: "\u2266\u0338",
        nleqslant: "\u2A7D\u0338",
        nles: "\u2A7D\u0338",
        nless: "\u226E",
        nLl: "\u22D8\u0338",
        nlsim: "\u2274",
        nLt: "\u226A\u20D2",
        nlt: "\u226E",
        nltri: "\u22EA",
        nltrie: "\u22EC",
        nLtv: "\u226A\u0338",
        nmid: "\u2224",
        NoBreak: "\u2060",
        NonBreakingSpace: "\xA0",
        Nopf: "\u2115",
        nopf: "\u{1D55F}",
        Not: "\u2AEC",
        not: "\xAC",
        NotCongruent: "\u2262",
        NotCupCap: "\u226D",
        NotDoubleVerticalBar: "\u2226",
        NotElement: "\u2209",
        NotEqual: "\u2260",
        NotEqualTilde: "\u2242\u0338",
        NotExists: "\u2204",
        NotGreater: "\u226F",
        NotGreaterEqual: "\u2271",
        NotGreaterFullEqual: "\u2267\u0338",
        NotGreaterGreater: "\u226B\u0338",
        NotGreaterLess: "\u2279",
        NotGreaterSlantEqual: "\u2A7E\u0338",
        NotGreaterTilde: "\u2275",
        NotHumpDownHump: "\u224E\u0338",
        NotHumpEqual: "\u224F\u0338",
        notin: "\u2209",
        notindot: "\u22F5\u0338",
        notinE: "\u22F9\u0338",
        notinva: "\u2209",
        notinvb: "\u22F7",
        notinvc: "\u22F6",
        NotLeftTriangle: "\u22EA",
        NotLeftTriangleBar: "\u29CF\u0338",
        NotLeftTriangleEqual: "\u22EC",
        NotLess: "\u226E",
        NotLessEqual: "\u2270",
        NotLessGreater: "\u2278",
        NotLessLess: "\u226A\u0338",
        NotLessSlantEqual: "\u2A7D\u0338",
        NotLessTilde: "\u2274",
        NotNestedGreaterGreater: "\u2AA2\u0338",
        NotNestedLessLess: "\u2AA1\u0338",
        notni: "\u220C",
        notniva: "\u220C",
        notnivb: "\u22FE",
        notnivc: "\u22FD",
        NotPrecedes: "\u2280",
        NotPrecedesEqual: "\u2AAF\u0338",
        NotPrecedesSlantEqual: "\u22E0",
        NotReverseElement: "\u220C",
        NotRightTriangle: "\u22EB",
        NotRightTriangleBar: "\u29D0\u0338",
        NotRightTriangleEqual: "\u22ED",
        NotSquareSubset: "\u228F\u0338",
        NotSquareSubsetEqual: "\u22E2",
        NotSquareSuperset: "\u2290\u0338",
        NotSquareSupersetEqual: "\u22E3",
        NotSubset: "\u2282\u20D2",
        NotSubsetEqual: "\u2288",
        NotSucceeds: "\u2281",
        NotSucceedsEqual: "\u2AB0\u0338",
        NotSucceedsSlantEqual: "\u22E1",
        NotSucceedsTilde: "\u227F\u0338",
        NotSuperset: "\u2283\u20D2",
        NotSupersetEqual: "\u2289",
        NotTilde: "\u2241",
        NotTildeEqual: "\u2244",
        NotTildeFullEqual: "\u2247",
        NotTildeTilde: "\u2249",
        NotVerticalBar: "\u2224",
        npar: "\u2226",
        nparallel: "\u2226",
        nparsl: "\u2AFD\u20E5",
        npart: "\u2202\u0338",
        npolint: "\u2A14",
        npr: "\u2280",
        nprcue: "\u22E0",
        npre: "\u2AAF\u0338",
        nprec: "\u2280",
        npreceq: "\u2AAF\u0338",
        nrArr: "\u21CF",
        nrarr: "\u219B",
        nrarrc: "\u2933\u0338",
        nrarrw: "\u219D\u0338",
        nRightarrow: "\u21CF",
        nrightarrow: "\u219B",
        nrtri: "\u22EB",
        nrtrie: "\u22ED",
        nsc: "\u2281",
        nsccue: "\u22E1",
        nsce: "\u2AB0\u0338",
        Nscr: "\u{1D4A9}",
        nscr: "\u{1D4C3}",
        nshortmid: "\u2224",
        nshortparallel: "\u2226",
        nsim: "\u2241",
        nsime: "\u2244",
        nsimeq: "\u2244",
        nsmid: "\u2224",
        nspar: "\u2226",
        nsqsube: "\u22E2",
        nsqsupe: "\u22E3",
        nsub: "\u2284",
        nsubE: "\u2AC5\u0338",
        nsube: "\u2288",
        nsubset: "\u2282\u20D2",
        nsubseteq: "\u2288",
        nsubseteqq: "\u2AC5\u0338",
        nsucc: "\u2281",
        nsucceq: "\u2AB0\u0338",
        nsup: "\u2285",
        nsupE: "\u2AC6\u0338",
        nsupe: "\u2289",
        nsupset: "\u2283\u20D2",
        nsupseteq: "\u2289",
        nsupseteqq: "\u2AC6\u0338",
        ntgl: "\u2279",
        Ntilde: "\xD1",
        ntilde: "\xF1",
        ntlg: "\u2278",
        ntriangleleft: "\u22EA",
        ntrianglelefteq: "\u22EC",
        ntriangleright: "\u22EB",
        ntrianglerighteq: "\u22ED",
        Nu: "\u039D",
        nu: "\u03BD",
        num: "#",
        numero: "\u2116",
        numsp: "\u2007",
        nvap: "\u224D\u20D2",
        nVDash: "\u22AF",
        nVdash: "\u22AE",
        nvDash: "\u22AD",
        nvdash: "\u22AC",
        nvge: "\u2265\u20D2",
        nvgt: ">\u20D2",
        nvHarr: "\u2904",
        nvinfin: "\u29DE",
        nvlArr: "\u2902",
        nvle: "\u2264\u20D2",
        nvlt: "<\u20D2",
        nvltrie: "\u22B4\u20D2",
        nvrArr: "\u2903",
        nvrtrie: "\u22B5\u20D2",
        nvsim: "\u223C\u20D2",
        nwarhk: "\u2923",
        nwArr: "\u21D6",
        nwarr: "\u2196",
        nwarrow: "\u2196",
        nwnear: "\u2927",
        Oacute: "\xD3",
        oacute: "\xF3",
        oast: "\u229B",
        ocir: "\u229A",
        Ocirc: "\xD4",
        ocirc: "\xF4",
        Ocy: "\u041E",
        ocy: "\u043E",
        odash: "\u229D",
        Odblac: "\u0150",
        odblac: "\u0151",
        odiv: "\u2A38",
        odot: "\u2299",
        odsold: "\u29BC",
        OElig: "\u0152",
        oelig: "\u0153",
        ofcir: "\u29BF",
        Ofr: "\u{1D512}",
        ofr: "\u{1D52C}",
        ogon: "\u02DB",
        Ograve: "\xD2",
        ograve: "\xF2",
        ogt: "\u29C1",
        ohbar: "\u29B5",
        ohm: "\u03A9",
        oint: "\u222E",
        olarr: "\u21BA",
        olcir: "\u29BE",
        olcross: "\u29BB",
        oline: "\u203E",
        olt: "\u29C0",
        Omacr: "\u014C",
        omacr: "\u014D",
        Omega: "\u03A9",
        omega: "\u03C9",
        Omicron: "\u039F",
        omicron: "\u03BF",
        omid: "\u29B6",
        ominus: "\u2296",
        Oopf: "\u{1D546}",
        oopf: "\u{1D560}",
        opar: "\u29B7",
        OpenCurlyDoubleQuote: "\u201C",
        OpenCurlyQuote: "\u2018",
        operp: "\u29B9",
        oplus: "\u2295",
        Or: "\u2A54",
        or: "\u2228",
        orarr: "\u21BB",
        ord: "\u2A5D",
        order: "\u2134",
        orderof: "\u2134",
        ordf: "\xAA",
        ordm: "\xBA",
        origof: "\u22B6",
        oror: "\u2A56",
        orslope: "\u2A57",
        orv: "\u2A5B",
        oS: "\u24C8",
        Oscr: "\u{1D4AA}",
        oscr: "\u2134",
        Oslash: "\xD8",
        oslash: "\xF8",
        osol: "\u2298",
        Otilde: "\xD5",
        otilde: "\xF5",
        Otimes: "\u2A37",
        otimes: "\u2297",
        otimesas: "\u2A36",
        Ouml: "\xD6",
        ouml: "\xF6",
        ovbar: "\u233D",
        OverBar: "\u203E",
        OverBrace: "\u23DE",
        OverBracket: "\u23B4",
        OverParenthesis: "\u23DC",
        par: "\u2225",
        para: "\xB6",
        parallel: "\u2225",
        parsim: "\u2AF3",
        parsl: "\u2AFD",
        part: "\u2202",
        PartialD: "\u2202",
        Pcy: "\u041F",
        pcy: "\u043F",
        percnt: "%",
        period: ".",
        permil: "\u2030",
        perp: "\u22A5",
        pertenk: "\u2031",
        Pfr: "\u{1D513}",
        pfr: "\u{1D52D}",
        Phi: "\u03A6",
        phi: "\u03C6",
        phiv: "\u03D5",
        phmmat: "\u2133",
        phone: "\u260E",
        Pi: "\u03A0",
        pi: "\u03C0",
        pitchfork: "\u22D4",
        piv: "\u03D6",
        planck: "\u210F",
        planckh: "\u210E",
        plankv: "\u210F",
        plus: "+",
        plusacir: "\u2A23",
        plusb: "\u229E",
        pluscir: "\u2A22",
        plusdo: "\u2214",
        plusdu: "\u2A25",
        pluse: "\u2A72",
        PlusMinus: "\xB1",
        plusmn: "\xB1",
        plussim: "\u2A26",
        plustwo: "\u2A27",
        pm: "\xB1",
        Poincareplane: "\u210C",
        pointint: "\u2A15",
        Popf: "\u2119",
        popf: "\u{1D561}",
        pound: "\xA3",
        Pr: "\u2ABB",
        pr: "\u227A",
        prap: "\u2AB7",
        prcue: "\u227C",
        prE: "\u2AB3",
        pre: "\u2AAF",
        prec: "\u227A",
        precapprox: "\u2AB7",
        preccurlyeq: "\u227C",
        Precedes: "\u227A",
        PrecedesEqual: "\u2AAF",
        PrecedesSlantEqual: "\u227C",
        PrecedesTilde: "\u227E",
        preceq: "\u2AAF",
        precnapprox: "\u2AB9",
        precneqq: "\u2AB5",
        precnsim: "\u22E8",
        precsim: "\u227E",
        Prime: "\u2033",
        prime: "\u2032",
        primes: "\u2119",
        prnap: "\u2AB9",
        prnE: "\u2AB5",
        prnsim: "\u22E8",
        prod: "\u220F",
        Product: "\u220F",
        profalar: "\u232E",
        profline: "\u2312",
        profsurf: "\u2313",
        prop: "\u221D",
        Proportion: "\u2237",
        Proportional: "\u221D",
        propto: "\u221D",
        prsim: "\u227E",
        prurel: "\u22B0",
        Pscr: "\u{1D4AB}",
        pscr: "\u{1D4C5}",
        Psi: "\u03A8",
        psi: "\u03C8",
        puncsp: "\u2008",
        Qfr: "\u{1D514}",
        qfr: "\u{1D52E}",
        qint: "\u2A0C",
        Qopf: "\u211A",
        qopf: "\u{1D562}",
        qprime: "\u2057",
        Qscr: "\u{1D4AC}",
        qscr: "\u{1D4C6}",
        quaternions: "\u210D",
        quatint: "\u2A16",
        quest: "?",
        questeq: "\u225F",
        QUOT: '"',
        quot: '"',
        rAarr: "\u21DB",
        race: "\u223D\u0331",
        Racute: "\u0154",
        racute: "\u0155",
        radic: "\u221A",
        raemptyv: "\u29B3",
        Rang: "\u27EB",
        rang: "\u27E9",
        rangd: "\u2992",
        range: "\u29A5",
        rangle: "\u27E9",
        raquo: "\xBB",
        Rarr: "\u21A0",
        rArr: "\u21D2",
        rarr: "\u2192",
        rarrap: "\u2975",
        rarrb: "\u21E5",
        rarrbfs: "\u2920",
        rarrc: "\u2933",
        rarrfs: "\u291E",
        rarrhk: "\u21AA",
        rarrlp: "\u21AC",
        rarrpl: "\u2945",
        rarrsim: "\u2974",
        Rarrtl: "\u2916",
        rarrtl: "\u21A3",
        rarrw: "\u219D",
        rAtail: "\u291C",
        ratail: "\u291A",
        ratio: "\u2236",
        rationals: "\u211A",
        RBarr: "\u2910",
        rBarr: "\u290F",
        rbarr: "\u290D",
        rbbrk: "\u2773",
        rbrace: "}",
        rbrack: "]",
        rbrke: "\u298C",
        rbrksld: "\u298E",
        rbrkslu: "\u2990",
        Rcaron: "\u0158",
        rcaron: "\u0159",
        Rcedil: "\u0156",
        rcedil: "\u0157",
        rceil: "\u2309",
        rcub: "}",
        Rcy: "\u0420",
        rcy: "\u0440",
        rdca: "\u2937",
        rdldhar: "\u2969",
        rdquo: "\u201D",
        rdquor: "\u201D",
        rdsh: "\u21B3",
        Re: "\u211C",
        real: "\u211C",
        realine: "\u211B",
        realpart: "\u211C",
        reals: "\u211D",
        rect: "\u25AD",
        REG: "\xAE",
        reg: "\xAE",
        ReverseElement: "\u220B",
        ReverseEquilibrium: "\u21CB",
        ReverseUpEquilibrium: "\u296F",
        rfisht: "\u297D",
        rfloor: "\u230B",
        Rfr: "\u211C",
        rfr: "\u{1D52F}",
        rHar: "\u2964",
        rhard: "\u21C1",
        rharu: "\u21C0",
        rharul: "\u296C",
        Rho: "\u03A1",
        rho: "\u03C1",
        rhov: "\u03F1",
        RightAngleBracket: "\u27E9",
        RightArrow: "\u2192",
        Rightarrow: "\u21D2",
        rightarrow: "\u2192",
        RightArrowBar: "\u21E5",
        RightArrowLeftArrow: "\u21C4",
        rightarrowtail: "\u21A3",
        RightCeiling: "\u2309",
        RightDoubleBracket: "\u27E7",
        RightDownTeeVector: "\u295D",
        RightDownVector: "\u21C2",
        RightDownVectorBar: "\u2955",
        RightFloor: "\u230B",
        rightharpoondown: "\u21C1",
        rightharpoonup: "\u21C0",
        rightleftarrows: "\u21C4",
        rightleftharpoons: "\u21CC",
        rightrightarrows: "\u21C9",
        rightsquigarrow: "\u219D",
        RightTee: "\u22A2",
        RightTeeArrow: "\u21A6",
        RightTeeVector: "\u295B",
        rightthreetimes: "\u22CC",
        RightTriangle: "\u22B3",
        RightTriangleBar: "\u29D0",
        RightTriangleEqual: "\u22B5",
        RightUpDownVector: "\u294F",
        RightUpTeeVector: "\u295C",
        RightUpVector: "\u21BE",
        RightUpVectorBar: "\u2954",
        RightVector: "\u21C0",
        RightVectorBar: "\u2953",
        ring: "\u02DA",
        risingdotseq: "\u2253",
        rlarr: "\u21C4",
        rlhar: "\u21CC",
        rlm: "\u200F",
        rmoust: "\u23B1",
        rmoustache: "\u23B1",
        rnmid: "\u2AEE",
        roang: "\u27ED",
        roarr: "\u21FE",
        robrk: "\u27E7",
        ropar: "\u2986",
        Ropf: "\u211D",
        ropf: "\u{1D563}",
        roplus: "\u2A2E",
        rotimes: "\u2A35",
        RoundImplies: "\u2970",
        rpar: ")",
        rpargt: "\u2994",
        rppolint: "\u2A12",
        rrarr: "\u21C9",
        Rrightarrow: "\u21DB",
        rsaquo: "\u203A",
        Rscr: "\u211B",
        rscr: "\u{1D4C7}",
        Rsh: "\u21B1",
        rsh: "\u21B1",
        rsqb: "]",
        rsquo: "\u2019",
        rsquor: "\u2019",
        rthree: "\u22CC",
        rtimes: "\u22CA",
        rtri: "\u25B9",
        rtrie: "\u22B5",
        rtrif: "\u25B8",
        rtriltri: "\u29CE",
        RuleDelayed: "\u29F4",
        ruluhar: "\u2968",
        rx: "\u211E",
        Sacute: "\u015A",
        sacute: "\u015B",
        sbquo: "\u201A",
        Sc: "\u2ABC",
        sc: "\u227B",
        scap: "\u2AB8",
        Scaron: "\u0160",
        scaron: "\u0161",
        sccue: "\u227D",
        scE: "\u2AB4",
        sce: "\u2AB0",
        Scedil: "\u015E",
        scedil: "\u015F",
        Scirc: "\u015C",
        scirc: "\u015D",
        scnap: "\u2ABA",
        scnE: "\u2AB6",
        scnsim: "\u22E9",
        scpolint: "\u2A13",
        scsim: "\u227F",
        Scy: "\u0421",
        scy: "\u0441",
        sdot: "\u22C5",
        sdotb: "\u22A1",
        sdote: "\u2A66",
        searhk: "\u2925",
        seArr: "\u21D8",
        searr: "\u2198",
        searrow: "\u2198",
        sect: "\xA7",
        semi: ";",
        seswar: "\u2929",
        setminus: "\u2216",
        setmn: "\u2216",
        sext: "\u2736",
        Sfr: "\u{1D516}",
        sfr: "\u{1D530}",
        sfrown: "\u2322",
        sharp: "\u266F",
        SHCHcy: "\u0429",
        shchcy: "\u0449",
        SHcy: "\u0428",
        shcy: "\u0448",
        ShortDownArrow: "\u2193",
        ShortLeftArrow: "\u2190",
        shortmid: "\u2223",
        shortparallel: "\u2225",
        ShortRightArrow: "\u2192",
        ShortUpArrow: "\u2191",
        shy: "\xAD",
        Sigma: "\u03A3",
        sigma: "\u03C3",
        sigmaf: "\u03C2",
        sigmav: "\u03C2",
        sim: "\u223C",
        simdot: "\u2A6A",
        sime: "\u2243",
        simeq: "\u2243",
        simg: "\u2A9E",
        simgE: "\u2AA0",
        siml: "\u2A9D",
        simlE: "\u2A9F",
        simne: "\u2246",
        simplus: "\u2A24",
        simrarr: "\u2972",
        slarr: "\u2190",
        SmallCircle: "\u2218",
        smallsetminus: "\u2216",
        smashp: "\u2A33",
        smeparsl: "\u29E4",
        smid: "\u2223",
        smile: "\u2323",
        smt: "\u2AAA",
        smte: "\u2AAC",
        smtes: "\u2AAC\uFE00",
        SOFTcy: "\u042C",
        softcy: "\u044C",
        sol: "/",
        solb: "\u29C4",
        solbar: "\u233F",
        Sopf: "\u{1D54A}",
        sopf: "\u{1D564}",
        spades: "\u2660",
        spadesuit: "\u2660",
        spar: "\u2225",
        sqcap: "\u2293",
        sqcaps: "\u2293\uFE00",
        sqcup: "\u2294",
        sqcups: "\u2294\uFE00",
        Sqrt: "\u221A",
        sqsub: "\u228F",
        sqsube: "\u2291",
        sqsubset: "\u228F",
        sqsubseteq: "\u2291",
        sqsup: "\u2290",
        sqsupe: "\u2292",
        sqsupset: "\u2290",
        sqsupseteq: "\u2292",
        squ: "\u25A1",
        Square: "\u25A1",
        square: "\u25A1",
        SquareIntersection: "\u2293",
        SquareSubset: "\u228F",
        SquareSubsetEqual: "\u2291",
        SquareSuperset: "\u2290",
        SquareSupersetEqual: "\u2292",
        SquareUnion: "\u2294",
        squarf: "\u25AA",
        squf: "\u25AA",
        srarr: "\u2192",
        Sscr: "\u{1D4AE}",
        sscr: "\u{1D4C8}",
        ssetmn: "\u2216",
        ssmile: "\u2323",
        sstarf: "\u22C6",
        Star: "\u22C6",
        star: "\u2606",
        starf: "\u2605",
        straightepsilon: "\u03F5",
        straightphi: "\u03D5",
        strns: "\xAF",
        Sub: "\u22D0",
        sub: "\u2282",
        subdot: "\u2ABD",
        subE: "\u2AC5",
        sube: "\u2286",
        subedot: "\u2AC3",
        submult: "\u2AC1",
        subnE: "\u2ACB",
        subne: "\u228A",
        subplus: "\u2ABF",
        subrarr: "\u2979",
        Subset: "\u22D0",
        subset: "\u2282",
        subseteq: "\u2286",
        subseteqq: "\u2AC5",
        SubsetEqual: "\u2286",
        subsetneq: "\u228A",
        subsetneqq: "\u2ACB",
        subsim: "\u2AC7",
        subsub: "\u2AD5",
        subsup: "\u2AD3",
        succ: "\u227B",
        succapprox: "\u2AB8",
        succcurlyeq: "\u227D",
        Succeeds: "\u227B",
        SucceedsEqual: "\u2AB0",
        SucceedsSlantEqual: "\u227D",
        SucceedsTilde: "\u227F",
        succeq: "\u2AB0",
        succnapprox: "\u2ABA",
        succneqq: "\u2AB6",
        succnsim: "\u22E9",
        succsim: "\u227F",
        SuchThat: "\u220B",
        Sum: "\u2211",
        sum: "\u2211",
        sung: "\u266A",
        Sup: "\u22D1",
        sup: "\u2283",
        sup1: "\xB9",
        sup2: "\xB2",
        sup3: "\xB3",
        supdot: "\u2ABE",
        supdsub: "\u2AD8",
        supE: "\u2AC6",
        supe: "\u2287",
        supedot: "\u2AC4",
        Superset: "\u2283",
        SupersetEqual: "\u2287",
        suphsol: "\u27C9",
        suphsub: "\u2AD7",
        suplarr: "\u297B",
        supmult: "\u2AC2",
        supnE: "\u2ACC",
        supne: "\u228B",
        supplus: "\u2AC0",
        Supset: "\u22D1",
        supset: "\u2283",
        supseteq: "\u2287",
        supseteqq: "\u2AC6",
        supsetneq: "\u228B",
        supsetneqq: "\u2ACC",
        supsim: "\u2AC8",
        supsub: "\u2AD4",
        supsup: "\u2AD6",
        swarhk: "\u2926",
        swArr: "\u21D9",
        swarr: "\u2199",
        swarrow: "\u2199",
        swnwar: "\u292A",
        szlig: "\xDF",
        Tab: "	",
        target: "\u2316",
        Tau: "\u03A4",
        tau: "\u03C4",
        tbrk: "\u23B4",
        Tcaron: "\u0164",
        tcaron: "\u0165",
        Tcedil: "\u0162",
        tcedil: "\u0163",
        Tcy: "\u0422",
        tcy: "\u0442",
        tdot: "\u20DB",
        telrec: "\u2315",
        Tfr: "\u{1D517}",
        tfr: "\u{1D531}",
        there4: "\u2234",
        Therefore: "\u2234",
        therefore: "\u2234",
        Theta: "\u0398",
        theta: "\u03B8",
        thetasym: "\u03D1",
        thetav: "\u03D1",
        thickapprox: "\u2248",
        thicksim: "\u223C",
        ThickSpace: "\u205F\u200A",
        thinsp: "\u2009",
        ThinSpace: "\u2009",
        thkap: "\u2248",
        thksim: "\u223C",
        THORN: "\xDE",
        thorn: "\xFE",
        Tilde: "\u223C",
        tilde: "\u02DC",
        TildeEqual: "\u2243",
        TildeFullEqual: "\u2245",
        TildeTilde: "\u2248",
        times: "\xD7",
        timesb: "\u22A0",
        timesbar: "\u2A31",
        timesd: "\u2A30",
        tint: "\u222D",
        toea: "\u2928",
        top: "\u22A4",
        topbot: "\u2336",
        topcir: "\u2AF1",
        Topf: "\u{1D54B}",
        topf: "\u{1D565}",
        topfork: "\u2ADA",
        tosa: "\u2929",
        tprime: "\u2034",
        TRADE: "\u2122",
        trade: "\u2122",
        triangle: "\u25B5",
        triangledown: "\u25BF",
        triangleleft: "\u25C3",
        trianglelefteq: "\u22B4",
        triangleq: "\u225C",
        triangleright: "\u25B9",
        trianglerighteq: "\u22B5",
        tridot: "\u25EC",
        trie: "\u225C",
        triminus: "\u2A3A",
        TripleDot: "\u20DB",
        triplus: "\u2A39",
        trisb: "\u29CD",
        tritime: "\u2A3B",
        trpezium: "\u23E2",
        Tscr: "\u{1D4AF}",
        tscr: "\u{1D4C9}",
        TScy: "\u0426",
        tscy: "\u0446",
        TSHcy: "\u040B",
        tshcy: "\u045B",
        Tstrok: "\u0166",
        tstrok: "\u0167",
        twixt: "\u226C",
        twoheadleftarrow: "\u219E",
        twoheadrightarrow: "\u21A0",
        Uacute: "\xDA",
        uacute: "\xFA",
        Uarr: "\u219F",
        uArr: "\u21D1",
        uarr: "\u2191",
        Uarrocir: "\u2949",
        Ubrcy: "\u040E",
        ubrcy: "\u045E",
        Ubreve: "\u016C",
        ubreve: "\u016D",
        Ucirc: "\xDB",
        ucirc: "\xFB",
        Ucy: "\u0423",
        ucy: "\u0443",
        udarr: "\u21C5",
        Udblac: "\u0170",
        udblac: "\u0171",
        udhar: "\u296E",
        ufisht: "\u297E",
        Ufr: "\u{1D518}",
        ufr: "\u{1D532}",
        Ugrave: "\xD9",
        ugrave: "\xF9",
        uHar: "\u2963",
        uharl: "\u21BF",
        uharr: "\u21BE",
        uhblk: "\u2580",
        ulcorn: "\u231C",
        ulcorner: "\u231C",
        ulcrop: "\u230F",
        ultri: "\u25F8",
        Umacr: "\u016A",
        umacr: "\u016B",
        uml: "\xA8",
        UnderBar: "_",
        UnderBrace: "\u23DF",
        UnderBracket: "\u23B5",
        UnderParenthesis: "\u23DD",
        Union: "\u22C3",
        UnionPlus: "\u228E",
        Uogon: "\u0172",
        uogon: "\u0173",
        Uopf: "\u{1D54C}",
        uopf: "\u{1D566}",
        UpArrow: "\u2191",
        Uparrow: "\u21D1",
        uparrow: "\u2191",
        UpArrowBar: "\u2912",
        UpArrowDownArrow: "\u21C5",
        UpDownArrow: "\u2195",
        Updownarrow: "\u21D5",
        updownarrow: "\u2195",
        UpEquilibrium: "\u296E",
        upharpoonleft: "\u21BF",
        upharpoonright: "\u21BE",
        uplus: "\u228E",
        UpperLeftArrow: "\u2196",
        UpperRightArrow: "\u2197",
        Upsi: "\u03D2",
        upsi: "\u03C5",
        upsih: "\u03D2",
        Upsilon: "\u03A5",
        upsilon: "\u03C5",
        UpTee: "\u22A5",
        UpTeeArrow: "\u21A5",
        upuparrows: "\u21C8",
        urcorn: "\u231D",
        urcorner: "\u231D",
        urcrop: "\u230E",
        Uring: "\u016E",
        uring: "\u016F",
        urtri: "\u25F9",
        Uscr: "\u{1D4B0}",
        uscr: "\u{1D4CA}",
        utdot: "\u22F0",
        Utilde: "\u0168",
        utilde: "\u0169",
        utri: "\u25B5",
        utrif: "\u25B4",
        uuarr: "\u21C8",
        Uuml: "\xDC",
        uuml: "\xFC",
        uwangle: "\u29A7",
        vangrt: "\u299C",
        varepsilon: "\u03F5",
        varkappa: "\u03F0",
        varnothing: "\u2205",
        varphi: "\u03D5",
        varpi: "\u03D6",
        varpropto: "\u221D",
        vArr: "\u21D5",
        varr: "\u2195",
        varrho: "\u03F1",
        varsigma: "\u03C2",
        varsubsetneq: "\u228A\uFE00",
        varsubsetneqq: "\u2ACB\uFE00",
        varsupsetneq: "\u228B\uFE00",
        varsupsetneqq: "\u2ACC\uFE00",
        vartheta: "\u03D1",
        vartriangleleft: "\u22B2",
        vartriangleright: "\u22B3",
        Vbar: "\u2AEB",
        vBar: "\u2AE8",
        vBarv: "\u2AE9",
        Vcy: "\u0412",
        vcy: "\u0432",
        VDash: "\u22AB",
        Vdash: "\u22A9",
        vDash: "\u22A8",
        vdash: "\u22A2",
        Vdashl: "\u2AE6",
        Vee: "\u22C1",
        vee: "\u2228",
        veebar: "\u22BB",
        veeeq: "\u225A",
        vellip: "\u22EE",
        Verbar: "\u2016",
        verbar: "|",
        Vert: "\u2016",
        vert: "|",
        VerticalBar: "\u2223",
        VerticalLine: "|",
        VerticalSeparator: "\u2758",
        VerticalTilde: "\u2240",
        VeryThinSpace: "\u200A",
        Vfr: "\u{1D519}",
        vfr: "\u{1D533}",
        vltri: "\u22B2",
        vnsub: "\u2282\u20D2",
        vnsup: "\u2283\u20D2",
        Vopf: "\u{1D54D}",
        vopf: "\u{1D567}",
        vprop: "\u221D",
        vrtri: "\u22B3",
        Vscr: "\u{1D4B1}",
        vscr: "\u{1D4CB}",
        vsubnE: "\u2ACB\uFE00",
        vsubne: "\u228A\uFE00",
        vsupnE: "\u2ACC\uFE00",
        vsupne: "\u228B\uFE00",
        Vvdash: "\u22AA",
        vzigzag: "\u299A",
        Wcirc: "\u0174",
        wcirc: "\u0175",
        wedbar: "\u2A5F",
        Wedge: "\u22C0",
        wedge: "\u2227",
        wedgeq: "\u2259",
        weierp: "\u2118",
        Wfr: "\u{1D51A}",
        wfr: "\u{1D534}",
        Wopf: "\u{1D54E}",
        wopf: "\u{1D568}",
        wp: "\u2118",
        wr: "\u2240",
        wreath: "\u2240",
        Wscr: "\u{1D4B2}",
        wscr: "\u{1D4CC}",
        xcap: "\u22C2",
        xcirc: "\u25EF",
        xcup: "\u22C3",
        xdtri: "\u25BD",
        Xfr: "\u{1D51B}",
        xfr: "\u{1D535}",
        xhArr: "\u27FA",
        xharr: "\u27F7",
        Xi: "\u039E",
        xi: "\u03BE",
        xlArr: "\u27F8",
        xlarr: "\u27F5",
        xmap: "\u27FC",
        xnis: "\u22FB",
        xodot: "\u2A00",
        Xopf: "\u{1D54F}",
        xopf: "\u{1D569}",
        xoplus: "\u2A01",
        xotime: "\u2A02",
        xrArr: "\u27F9",
        xrarr: "\u27F6",
        Xscr: "\u{1D4B3}",
        xscr: "\u{1D4CD}",
        xsqcup: "\u2A06",
        xuplus: "\u2A04",
        xutri: "\u25B3",
        xvee: "\u22C1",
        xwedge: "\u22C0",
        Yacute: "\xDD",
        yacute: "\xFD",
        YAcy: "\u042F",
        yacy: "\u044F",
        Ycirc: "\u0176",
        ycirc: "\u0177",
        Ycy: "\u042B",
        ycy: "\u044B",
        yen: "\xA5",
        Yfr: "\u{1D51C}",
        yfr: "\u{1D536}",
        YIcy: "\u0407",
        yicy: "\u0457",
        Yopf: "\u{1D550}",
        yopf: "\u{1D56A}",
        Yscr: "\u{1D4B4}",
        yscr: "\u{1D4CE}",
        YUcy: "\u042E",
        yucy: "\u044E",
        Yuml: "\u0178",
        yuml: "\xFF",
        Zacute: "\u0179",
        zacute: "\u017A",
        Zcaron: "\u017D",
        zcaron: "\u017E",
        Zcy: "\u0417",
        zcy: "\u0437",
        Zdot: "\u017B",
        zdot: "\u017C",
        zeetrf: "\u2128",
        ZeroWidthSpace: "\u200B",
        Zeta: "\u0396",
        zeta: "\u03B6",
        Zfr: "\u2128",
        zfr: "\u{1D537}",
        ZHcy: "\u0416",
        zhcy: "\u0436",
        zigrarr: "\u21DD",
        Zopf: "\u2124",
        zopf: "\u{1D56B}",
        Zscr: "\u{1D4B5}",
        zscr: "\u{1D4CF}",
        zwj: "\u200D",
        zwnj: "\u200C"
      });
      exports2.entityMap = exports2.HTML_ENTITIES;
    }
  });

  // node_modules/@xmldom/xmldom/lib/sax.js
  var require_sax = __commonJS({
    "node_modules/@xmldom/xmldom/lib/sax.js"(exports2) {
      var NAMESPACE = require_conventions().NAMESPACE;
      var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
      var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
      var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
      var S_TAG = 0;
      var S_ATTR = 1;
      var S_ATTR_SPACE = 2;
      var S_EQ = 3;
      var S_ATTR_NOQUOT_VALUE = 4;
      var S_ATTR_END = 5;
      var S_TAG_SPACE = 6;
      var S_TAG_CLOSE = 7;
      function ParseError(message, locator) {
        this.message = message;
        this.locator = locator;
        if (Error.captureStackTrace) Error.captureStackTrace(this, ParseError);
      }
      ParseError.prototype = new Error();
      ParseError.prototype.name = ParseError.name;
      function XMLReader() {
      }
      XMLReader.prototype = {
        parse: function(source, defaultNSMap, entityMap) {
          var domBuilder = this.domBuilder;
          domBuilder.startDocument();
          _copy(defaultNSMap, defaultNSMap = {});
          parse(
            source,
            defaultNSMap,
            entityMap,
            domBuilder,
            this.errorHandler
          );
          domBuilder.endDocument();
        }
      };
      function parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
        function fixedFromCharCode(code) {
          if (code > 65535) {
            code -= 65536;
            var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023);
            return String.fromCharCode(surrogate1, surrogate2);
          } else {
            return String.fromCharCode(code);
          }
        }
        function entityReplacer(a2) {
          var k = a2.slice(1, -1);
          if (Object.hasOwnProperty.call(entityMap, k)) {
            return entityMap[k];
          } else if (k.charAt(0) === "#") {
            return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x")));
          } else {
            errorHandler.error("entity not found:" + a2);
            return a2;
          }
        }
        function appendText(end2) {
          if (end2 > start) {
            var xt = source.substring(start, end2).replace(/&#?\w+;/g, entityReplacer);
            locator && position(start);
            domBuilder.characters(xt, 0, end2 - start);
            start = end2;
          }
        }
        function position(p, m) {
          while (p >= lineEnd && (m = linePattern.exec(source))) {
            lineStart = m.index;
            lineEnd = lineStart + m[0].length;
            locator.lineNumber++;
          }
          locator.columnNumber = p - lineStart + 1;
        }
        var lineStart = 0;
        var lineEnd = 0;
        var linePattern = /.*(?:\r\n?|\n)|.*$/g;
        var locator = domBuilder.locator;
        var parseStack = [{ currentNSMap: defaultNSMapCopy }];
        var closeMap = {};
        var start = 0;
        while (true) {
          try {
            var tagStart = source.indexOf("<", start);
            if (tagStart < 0) {
              if (!source.substr(start).match(/^\s*$/)) {
                var doc = domBuilder.doc;
                var text = doc.createTextNode(source.substr(start));
                doc.appendChild(text);
                domBuilder.currentElement = text;
              }
              return;
            }
            if (tagStart > start) {
              appendText(tagStart);
            }
            switch (source.charAt(tagStart + 1)) {
              case "/":
                var end = source.indexOf(">", tagStart + 3);
                var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, "");
                var config = parseStack.pop();
                if (end < 0) {
                  tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
                  errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName);
                  end = tagStart + 1 + tagName.length;
                } else if (tagName.match(/\s</)) {
                  tagName = tagName.replace(/[\s<].*/, "");
                  errorHandler.error("end tag name: " + tagName + " maybe not complete");
                  end = tagStart + 1 + tagName.length;
                }
                var localNSMap = config.localNSMap;
                var endMatch = config.tagName == tagName;
                var endIgnoreCaseMach = endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase();
                if (endIgnoreCaseMach) {
                  domBuilder.endElement(config.uri, config.localName, tagName);
                  if (localNSMap) {
                    for (var prefix in localNSMap) {
                      if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
                        domBuilder.endPrefixMapping(prefix);
                      }
                    }
                  }
                  if (!endMatch) {
                    errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
                  }
                } else {
                  parseStack.push(config);
                }
                end++;
                break;
              // end elment
              case "?":
                locator && position(tagStart);
                end = parseInstruction(source, tagStart, domBuilder);
                break;
              case "!":
                locator && position(tagStart);
                end = parseDCC(source, tagStart, domBuilder, errorHandler);
                break;
              default:
                locator && position(tagStart);
                var el = new ElementAttributes();
                var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
                var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler);
                var len = el.length;
                if (!el.closed && fixSelfClosed(source, end, el.tagName, closeMap)) {
                  el.closed = true;
                  if (!entityMap.nbsp) {
                    errorHandler.warning("unclosed xml attribute");
                  }
                }
                if (locator && len) {
                  var locator2 = copyLocator(locator, {});
                  for (var i = 0; i < len; i++) {
                    var a = el[i];
                    position(a.offset);
                    a.locator = copyLocator(locator, {});
                  }
                  domBuilder.locator = locator2;
                  if (appendElement(el, domBuilder, currentNSMap)) {
                    parseStack.push(el);
                  }
                  domBuilder.locator = locator;
                } else {
                  if (appendElement(el, domBuilder, currentNSMap)) {
                    parseStack.push(el);
                  }
                }
                if (NAMESPACE.isHTML(el.uri) && !el.closed) {
                  end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
                } else {
                  end++;
                }
            }
          } catch (e) {
            if (e instanceof ParseError) {
              throw e;
            }
            errorHandler.error("element parse error: " + e);
            end = -1;
          }
          if (end > start) {
            start = end;
          } else {
            appendText(Math.max(tagStart, start) + 1);
          }
        }
      }
      function copyLocator(f, t) {
        t.lineNumber = f.lineNumber;
        t.columnNumber = f.columnNumber;
        return t;
      }
      function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) {
        function addAttribute(qname, value2, startIndex) {
          if (el.attributeNames.hasOwnProperty(qname)) {
            errorHandler.fatalError("Attribute " + qname + " redefined");
          }
          el.addValue(
            qname,
            // @see https://www.w3.org/TR/xml/#AVNormalize
            // since the xmldom sax parser does not "interpret" DTD the following is not implemented:
            // - recursive replacement of (DTD) entity references
            // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA
            value2.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, entityReplacer),
            startIndex
          );
        }
        var attrName;
        var value;
        var p = ++start;
        var s = S_TAG;
        while (true) {
          var c = source.charAt(p);
          switch (c) {
            case "=":
              if (s === S_ATTR) {
                attrName = source.slice(start, p);
                s = S_EQ;
              } else if (s === S_ATTR_SPACE) {
                s = S_EQ;
              } else {
                throw new Error("attribute equal must after attrName");
              }
              break;
            case "'":
            case '"':
              if (s === S_EQ || s === S_ATTR) {
                if (s === S_ATTR) {
                  errorHandler.warning('attribute value must after "="');
                  attrName = source.slice(start, p);
                }
                start = p + 1;
                p = source.indexOf(c, start);
                if (p > 0) {
                  value = source.slice(start, p);
                  addAttribute(attrName, value, start - 1);
                  s = S_ATTR_END;
                } else {
                  throw new Error("attribute value no end '" + c + "' match");
                }
              } else if (s == S_ATTR_NOQUOT_VALUE) {
                value = source.slice(start, p);
                addAttribute(attrName, value, start);
                errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!");
                start = p + 1;
                s = S_ATTR_END;
              } else {
                throw new Error('attribute value must after "="');
              }
              break;
            case "/":
              switch (s) {
                case S_TAG:
                  el.setTagName(source.slice(start, p));
                case S_ATTR_END:
                case S_TAG_SPACE:
                case S_TAG_CLOSE:
                  s = S_TAG_CLOSE;
                  el.closed = true;
                case S_ATTR_NOQUOT_VALUE:
                case S_ATTR:
                  break;
                case S_ATTR_SPACE:
                  el.closed = true;
                  break;
                //case S_EQ:
                default:
                  throw new Error("attribute invalid close char('/')");
              }
              break;
            case "":
              errorHandler.error("unexpected end of input");
              if (s == S_TAG) {
                el.setTagName(source.slice(start, p));
              }
              return p;
            case ">":
              switch (s) {
                case S_TAG:
                  el.setTagName(source.slice(start, p));
                case S_ATTR_END:
                case S_TAG_SPACE:
                case S_TAG_CLOSE:
                  break;
                //normal
                case S_ATTR_NOQUOT_VALUE:
                //Compatible state
                case S_ATTR:
                  value = source.slice(start, p);
                  if (value.slice(-1) === "/") {
                    el.closed = true;
                    value = value.slice(0, -1);
                  }
                case S_ATTR_SPACE:
                  if (s === S_ATTR_SPACE) {
                    value = attrName;
                  }
                  if (s == S_ATTR_NOQUOT_VALUE) {
                    errorHandler.warning('attribute "' + value + '" missed quot(")!');
                    addAttribute(attrName, value, start);
                  } else {
                    if (!NAMESPACE.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) {
                      errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!');
                    }
                    addAttribute(value, value, start);
                  }
                  break;
                case S_EQ:
                  throw new Error("attribute value missed!!");
              }
              return p;
            /*xml space '\x20' | #x9 | #xD | #xA; */
            case "\x80":
              c = " ";
            default:
              if (c <= " ") {
                switch (s) {
                  case S_TAG:
                    el.setTagName(source.slice(start, p));
                    s = S_TAG_SPACE;
                    break;
                  case S_ATTR:
                    attrName = source.slice(start, p);
                    s = S_ATTR_SPACE;
                    break;
                  case S_ATTR_NOQUOT_VALUE:
                    var value = source.slice(start, p);
                    errorHandler.warning('attribute "' + value + '" missed quot(")!!');
                    addAttribute(attrName, value, start);
                  case S_ATTR_END:
                    s = S_TAG_SPACE;
                    break;
                }
              } else {
                switch (s) {
                  //case S_TAG:void();break;
                  //case S_ATTR:void();break;
                  //case S_ATTR_NOQUOT_VALUE:void();break;
                  case S_ATTR_SPACE:
                    var tagName = el.tagName;
                    if (!NAMESPACE.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
                      errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!');
                    }
                    addAttribute(attrName, attrName, start);
                    start = p;
                    s = S_ATTR;
                    break;
                  case S_ATTR_END:
                    errorHandler.warning('attribute space is required"' + attrName + '"!!');
                  case S_TAG_SPACE:
                    s = S_ATTR;
                    start = p;
                    break;
                  case S_EQ:
                    s = S_ATTR_NOQUOT_VALUE;
                    start = p;
                    break;
                  case S_TAG_CLOSE:
                    throw new Error("elements closed character '/' and '>' must be connected to");
                }
              }
          }
          p++;
        }
      }
      function appendElement(el, domBuilder, currentNSMap) {
        var tagName = el.tagName;
        var localNSMap = null;
        var i = el.length;
        while (i--) {
          var a = el[i];
          var qName = a.qName;
          var value = a.value;
          var nsp = qName.indexOf(":");
          if (nsp > 0) {
            var prefix = a.prefix = qName.slice(0, nsp);
            var localName = qName.slice(nsp + 1);
            var nsPrefix = prefix === "xmlns" && localName;
          } else {
            localName = qName;
            prefix = null;
            nsPrefix = qName === "xmlns" && "";
          }
          a.localName = localName;
          if (nsPrefix !== false) {
            if (localNSMap == null) {
              localNSMap = {};
              _copy(currentNSMap, currentNSMap = {});
            }
            currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
            a.uri = NAMESPACE.XMLNS;
            domBuilder.startPrefixMapping(nsPrefix, value);
          }
        }
        var i = el.length;
        while (i--) {
          a = el[i];
          var prefix = a.prefix;
          if (prefix) {
            if (prefix === "xml") {
              a.uri = NAMESPACE.XML;
            }
            if (prefix !== "xmlns") {
              a.uri = currentNSMap[prefix || ""];
            }
          }
        }
        var nsp = tagName.indexOf(":");
        if (nsp > 0) {
          prefix = el.prefix = tagName.slice(0, nsp);
          localName = el.localName = tagName.slice(nsp + 1);
        } else {
          prefix = null;
          localName = el.localName = tagName;
        }
        var ns = el.uri = currentNSMap[prefix || ""];
        domBuilder.startElement(ns, localName, tagName, el);
        if (el.closed) {
          domBuilder.endElement(ns, localName, tagName);
          if (localNSMap) {
            for (prefix in localNSMap) {
              if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
                domBuilder.endPrefixMapping(prefix);
              }
            }
          }
        } else {
          el.currentNSMap = currentNSMap;
          el.localNSMap = localNSMap;
          return true;
        }
      }
      function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
        if (/^(?:script|textarea)$/i.test(tagName)) {
          var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd);
          var text = source.substring(elStartEnd + 1, elEndStart);
          if (/[&<]/.test(text)) {
            if (/^script$/i.test(tagName)) {
              domBuilder.characters(text, 0, text.length);
              return elEndStart;
            }
            text = text.replace(/&#?\w+;/g, entityReplacer);
            domBuilder.characters(text, 0, text.length);
            return elEndStart;
          }
        }
        return elStartEnd + 1;
      }
      function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
        var pos = closeMap[tagName];
        if (pos == null) {
          pos = source.lastIndexOf("</" + tagName + ">");
          if (pos < elStartEnd) {
            pos = source.lastIndexOf("</" + tagName);
          }
          closeMap[tagName] = pos;
        }
        return pos < elStartEnd;
      }
      function _copy(source, target) {
        for (var n in source) {
          if (Object.prototype.hasOwnProperty.call(source, n)) {
            target[n] = source[n];
          }
        }
      }
      function parseDCC(source, start, domBuilder, errorHandler) {
        var next2 = source.charAt(start + 2);
        switch (next2) {
          case "-":
            if (source.charAt(start + 3) === "-") {
              var end = source.indexOf("-->", start + 4);
              if (end > start) {
                domBuilder.comment(source, start + 4, end - start - 4);
                return end + 3;
              } else {
                errorHandler.error("Unclosed comment");
                return -1;
              }
            } else {
              return -1;
            }
          default:
            if (source.substr(start + 3, 6) == "CDATA[") {
              var end = source.indexOf("]]>", start + 9);
              domBuilder.startCDATA();
              domBuilder.characters(source, start + 9, end - start - 9);
              domBuilder.endCDATA();
              return end + 3;
            }
            var matchs = split(source, start);
            var len = matchs.length;
            if (len > 1 && /!doctype/i.test(matchs[0][0])) {
              var name = matchs[1][0];
              var pubid = false;
              var sysid = false;
              if (len > 3) {
                if (/^public$/i.test(matchs[2][0])) {
                  pubid = matchs[3][0];
                  sysid = len > 4 && matchs[4][0];
                } else if (/^system$/i.test(matchs[2][0])) {
                  sysid = matchs[3][0];
                }
              }
              var lastMatch = matchs[len - 1];
              domBuilder.startDTD(name, pubid, sysid);
              domBuilder.endDTD();
              return lastMatch.index + lastMatch[0].length;
            }
        }
        return -1;
      }
      function parseInstruction(source, start, domBuilder) {
        var end = source.indexOf("?>", start);
        if (end) {
          var match = source.substring(start, end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
          if (match) {
            var len = match[0].length;
            domBuilder.processingInstruction(match[1], match[2]);
            return end + 2;
          } else {
            return -1;
          }
        }
        return -1;
      }
      function ElementAttributes() {
        this.attributeNames = {};
      }
      ElementAttributes.prototype = {
        setTagName: function(tagName) {
          if (!tagNamePattern.test(tagName)) {
            throw new Error("invalid tagName:" + tagName);
          }
          this.tagName = tagName;
        },
        addValue: function(qName, value, offset) {
          if (!tagNamePattern.test(qName)) {
            throw new Error("invalid attribute:" + qName);
          }
          this.attributeNames[qName] = this.length;
          this[this.length++] = { qName, value, offset };
        },
        length: 0,
        getLocalName: function(i) {
          return this[i].localName;
        },
        getLocator: function(i) {
          return this[i].locator;
        },
        getQName: function(i) {
          return this[i].qName;
        },
        getURI: function(i) {
          return this[i].uri;
        },
        getValue: function(i) {
          return this[i].value;
        }
        //	,getIndex:function(uri, localName)){
        //		if(localName){
        //
        //		}else{
        //			var qName = uri
        //		}
        //	},
        //	getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
        //	getType:function(uri,localName){}
        //	getType:function(i){},
      };
      function split(source, start) {
        var match;
        var buf = [];
        var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
        reg.lastIndex = start;
        reg.exec(source);
        while (match = reg.exec(source)) {
          buf.push(match);
          if (match[1]) return buf;
        }
      }
      exports2.XMLReader = XMLReader;
      exports2.ParseError = ParseError;
    }
  });

  // node_modules/@xmldom/xmldom/lib/dom-parser.js
  var require_dom_parser = __commonJS({
    "node_modules/@xmldom/xmldom/lib/dom-parser.js"(exports2) {
      var conventions = require_conventions();
      var dom = require_dom();
      var entities = require_entities();
      var sax = require_sax();
      var DOMImplementation = dom.DOMImplementation;
      var NAMESPACE = conventions.NAMESPACE;
      var ParseError = sax.ParseError;
      var XMLReader = sax.XMLReader;
      function normalizeLineEndings(input) {
        return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028]/g, "\n");
      }
      function DOMParser(options) {
        this.options = options || { locator: {} };
      }
      DOMParser.prototype.parseFromString = function(source, mimeType) {
        var options = this.options;
        var sax2 = new XMLReader();
        var domBuilder = options.domBuilder || new DOMHandler();
        var errorHandler = options.errorHandler;
        var locator = options.locator;
        var defaultNSMap = options.xmlns || {};
        var isHTML = /\/x?html?$/.test(mimeType);
        var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
        if (locator) {
          domBuilder.setDocumentLocator(locator);
        }
        sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator);
        sax2.domBuilder = options.domBuilder || domBuilder;
        if (isHTML) {
          defaultNSMap[""] = NAMESPACE.HTML;
        }
        defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
        var normalize = options.normalizeLineEndings || normalizeLineEndings;
        if (source && typeof source === "string") {
          sax2.parse(
            normalize(source),
            defaultNSMap,
            entityMap
          );
        } else {
          sax2.errorHandler.error("invalid doc source");
        }
        return domBuilder.doc;
      };
      function buildErrorHandler(errorImpl, domBuilder, locator) {
        if (!errorImpl) {
          if (domBuilder instanceof DOMHandler) {
            return domBuilder;
          }
          errorImpl = domBuilder;
        }
        var errorHandler = {};
        var isCallback = errorImpl instanceof Function;
        locator = locator || {};
        function build2(key) {
          var fn = errorImpl[key];
          if (!fn && isCallback) {
            fn = errorImpl.length == 2 ? function(msg) {
              errorImpl(key, msg);
            } : errorImpl;
          }
          errorHandler[key] = fn && function(msg) {
            fn("[xmldom " + key + "]	" + msg + _locator(locator));
          } || function() {
          };
        }
        build2("warning");
        build2("error");
        build2("fatalError");
        return errorHandler;
      }
      function DOMHandler() {
        this.cdata = false;
      }
      function position(locator, node) {
        node.lineNumber = locator.lineNumber;
        node.columnNumber = locator.columnNumber;
      }
      DOMHandler.prototype = {
        startDocument: function() {
          this.doc = new DOMImplementation().createDocument(null, null, null);
          if (this.locator) {
            this.doc.documentURI = this.locator.systemId;
          }
        },
        startElement: function(namespaceURI, localName, qName, attrs) {
          var doc = this.doc;
          var el = doc.createElementNS(namespaceURI, qName || localName);
          var len = attrs.length;
          appendElement(this, el);
          this.currentElement = el;
          this.locator && position(this.locator, el);
          for (var i = 0; i < len; i++) {
            var namespaceURI = attrs.getURI(i);
            var value = attrs.getValue(i);
            var qName = attrs.getQName(i);
            var attr = doc.createAttributeNS(namespaceURI, qName);
            this.locator && position(attrs.getLocator(i), attr);
            attr.value = attr.nodeValue = value;
            el.setAttributeNode(attr);
          }
        },
        endElement: function(namespaceURI, localName, qName) {
          var current = this.currentElement;
          var tagName = current.tagName;
          this.currentElement = current.parentNode;
        },
        startPrefixMapping: function(prefix, uri) {
        },
        endPrefixMapping: function(prefix) {
        },
        processingInstruction: function(target, data) {
          var ins = this.doc.createProcessingInstruction(target, data);
          this.locator && position(this.locator, ins);
          appendElement(this, ins);
        },
        ignorableWhitespace: function(ch, start, length) {
        },
        characters: function(chars, start, length) {
          chars = _toString.apply(this, arguments);
          if (chars) {
            if (this.cdata) {
              var charNode = this.doc.createCDATASection(chars);
            } else {
              var charNode = this.doc.createTextNode(chars);
            }
            if (this.currentElement) {
              this.currentElement.appendChild(charNode);
            } else if (/^\s*$/.test(chars)) {
              this.doc.appendChild(charNode);
            }
            this.locator && position(this.locator, charNode);
          }
        },
        skippedEntity: function(name) {
        },
        endDocument: function() {
          this.doc.normalize();
        },
        setDocumentLocator: function(locator) {
          if (this.locator = locator) {
            locator.lineNumber = 0;
          }
        },
        //LexicalHandler
        comment: function(chars, start, length) {
          chars = _toString.apply(this, arguments);
          var comm = this.doc.createComment(chars);
          this.locator && position(this.locator, comm);
          appendElement(this, comm);
        },
        startCDATA: function() {
          this.cdata = true;
        },
        endCDATA: function() {
          this.cdata = false;
        },
        startDTD: function(name, publicId, systemId) {
          var impl = this.doc.implementation;
          if (impl && impl.createDocumentType) {
            var dt = impl.createDocumentType(name, publicId, systemId);
            this.locator && position(this.locator, dt);
            appendElement(this, dt);
            this.doc.doctype = dt;
          }
        },
        /**
         * @see org.xml.sax.ErrorHandler
         * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
         */
        warning: function(error) {
          console.warn("[xmldom warning]	" + error, _locator(this.locator));
        },
        error: function(error) {
          console.error("[xmldom error]	" + error, _locator(this.locator));
        },
        fatalError: function(error) {
          throw new ParseError(error, this.locator);
        }
      };
      function _locator(l2) {
        if (l2) {
          return "\n@" + (l2.systemId || "") + "#[line:" + l2.lineNumber + ",col:" + l2.columnNumber + "]";
        }
      }
      function _toString(chars, start, length) {
        if (typeof chars == "string") {
          return chars.substr(start, length);
        } else {
          if (chars.length >= start + length || start) {
            return new java.lang.String(chars, start, length) + "";
          }
          return chars;
        }
      }
      "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) {
        DOMHandler.prototype[key] = function() {
          return null;
        };
      });
      function appendElement(hander, node) {
        if (!hander.currentElement) {
          hander.doc.appendChild(node);
        } else {
          hander.currentElement.appendChild(node);
        }
      }
      exports2.__DOMHandler = DOMHandler;
      exports2.normalizeLineEndings = normalizeLineEndings;
      exports2.DOMParser = DOMParser;
    }
  });

  // node_modules/@xmldom/xmldom/lib/index.js
  var require_lib = __commonJS({
    "node_modules/@xmldom/xmldom/lib/index.js"(exports2) {
      var dom = require_dom();
      exports2.DOMImplementation = dom.DOMImplementation;
      exports2.XMLSerializer = dom.XMLSerializer;
      exports2.DOMParser = require_dom_parser().DOMParser;
    }
  });

  // node_modules/mammoth/lib/xml/xmldom.js
  var require_xmldom = __commonJS({
    "node_modules/mammoth/lib/xml/xmldom.js"(exports2) {
      var xmldom = require_lib();
      var dom = require_dom();
      function parseFromString(string) {
        var error = null;
        var domParser = new xmldom.DOMParser({
          errorHandler: function(level, message) {
            error = { level, message };
          }
        });
        var document2 = domParser.parseFromString(string);
        if (error === null) {
          return document2;
        } else {
          throw new Error(error.level + ": " + error.message);
        }
      }
      exports2.parseFromString = parseFromString;
      exports2.Node = dom.Node;
    }
  });

  // node_modules/mammoth/lib/xml/reader.js
  var require_reader = __commonJS({
    "node_modules/mammoth/lib/xml/reader.js"(exports2) {
      var promises = require_promises();
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var xmldom = require_xmldom();
      var nodes = require_nodes();
      var Element = nodes.Element;
      exports2.readString = readString;
      var Node3 = xmldom.Node;
      function readString(xmlString, namespaceMap) {
        namespaceMap = namespaceMap || {};
        try {
          var document2 = xmldom.parseFromString(xmlString, "text/xml");
        } catch (error) {
          return promises.reject(error);
        }
        if (document2.documentElement.tagName === "parsererror") {
          return promises.resolve(new Error(document2.documentElement.textContent));
        }
        function convertNode(node) {
          switch (node.nodeType) {
            case Node3.ELEMENT_NODE:
              return convertElement(node);
            case Node3.TEXT_NODE:
              return nodes.text(node.nodeValue);
          }
        }
        function convertElement(element) {
          var convertedName = convertName(element);
          var convertedChildren = [];
          _3.forEach(element.childNodes, function(childNode) {
            var convertedNode = convertNode(childNode);
            if (convertedNode) {
              convertedChildren.push(convertedNode);
            }
          });
          var convertedAttributes = {};
          _3.forEach(element.attributes, function(attribute) {
            convertedAttributes[convertName(attribute)] = attribute.value;
          });
          return new Element(convertedName, convertedAttributes, convertedChildren);
        }
        function convertName(node) {
          if (node.namespaceURI) {
            var mappedPrefix = namespaceMap[node.namespaceURI];
            var prefix;
            if (mappedPrefix) {
              prefix = mappedPrefix + ":";
            } else {
              prefix = "{" + node.namespaceURI + "}";
            }
            return prefix + node.localName;
          } else {
            return node.localName;
          }
        }
        return promises.resolve(convertNode(document2.documentElement));
      }
    }
  });

  // node_modules/xmlbuilder/lib/Utility.js
  var require_Utility = __commonJS({
    "node_modules/xmlbuilder/lib/Utility.js"(exports2, module2) {
      (function() {
        var assign, getValue, isArray, isEmpty2, isFunction2, isObject3, isPlainObject, slice2 = [].slice, hasProp = {}.hasOwnProperty;
        assign = function() {
          var i, key, len, source, sources, target;
          target = arguments[0], sources = 2 <= arguments.length ? slice2.call(arguments, 1) : [];
          if (isFunction2(Object.assign)) {
            Object.assign.apply(null, arguments);
          } else {
            for (i = 0, len = sources.length; i < len; i++) {
              source = sources[i];
              if (source != null) {
                for (key in source) {
                  if (!hasProp.call(source, key)) continue;
                  target[key] = source[key];
                }
              }
            }
          }
          return target;
        };
        isFunction2 = function(val) {
          return !!val && Object.prototype.toString.call(val) === "[object Function]";
        };
        isObject3 = function(val) {
          var ref;
          return !!val && ((ref = typeof val) === "function" || ref === "object");
        };
        isArray = function(val) {
          if (isFunction2(Array.isArray)) {
            return Array.isArray(val);
          } else {
            return Object.prototype.toString.call(val) === "[object Array]";
          }
        };
        isEmpty2 = function(val) {
          var key;
          if (isArray(val)) {
            return !val.length;
          } else {
            for (key in val) {
              if (!hasProp.call(val, key)) continue;
              return false;
            }
            return true;
          }
        };
        isPlainObject = function(val) {
          var ctor2, proto;
          return isObject3(val) && (proto = Object.getPrototypeOf(val)) && (ctor2 = proto.constructor) && typeof ctor2 === "function" && ctor2 instanceof ctor2 && Function.prototype.toString.call(ctor2) === Function.prototype.toString.call(Object);
        };
        getValue = function(obj2) {
          if (isFunction2(obj2.valueOf)) {
            return obj2.valueOf();
          } else {
            return obj2;
          }
        };
        module2.exports.assign = assign;
        module2.exports.isFunction = isFunction2;
        module2.exports.isObject = isObject3;
        module2.exports.isArray = isArray;
        module2.exports.isEmpty = isEmpty2;
        module2.exports.isPlainObject = isPlainObject;
        module2.exports.getValue = getValue;
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLAttribute.js
  var require_XMLAttribute = __commonJS({
    "node_modules/xmlbuilder/lib/XMLAttribute.js"(exports2, module2) {
      (function() {
        var XMLAttribute;
        module2.exports = XMLAttribute = (function() {
          function XMLAttribute2(parent, name, value) {
            this.options = parent.options;
            this.stringify = parent.stringify;
            this.parent = parent;
            if (name == null) {
              throw new Error("Missing attribute name. " + this.debugInfo(name));
            }
            if (value == null) {
              throw new Error("Missing attribute value. " + this.debugInfo(name));
            }
            this.name = this.stringify.attName(name);
            this.value = this.stringify.attValue(value);
          }
          XMLAttribute2.prototype.clone = function() {
            return Object.create(this);
          };
          XMLAttribute2.prototype.toString = function(options) {
            return this.options.writer.set(options).attribute(this);
          };
          XMLAttribute2.prototype.debugInfo = function(name) {
            name = name || this.name;
            if (name == null) {
              return "parent: <" + this.parent.name + ">";
            } else {
              return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
            }
          };
          return XMLAttribute2;
        })();
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLElement.js
  var require_XMLElement = __commonJS({
    "node_modules/xmlbuilder/lib/XMLElement.js"(exports2, module2) {
      (function() {
        var XMLAttribute, XMLElement, XMLNode, getValue, isFunction2, isObject3, ref, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        ref = require_Utility(), isObject3 = ref.isObject, isFunction2 = ref.isFunction, getValue = ref.getValue;
        XMLNode = require_XMLNode();
        XMLAttribute = require_XMLAttribute();
        module2.exports = XMLElement = (function(superClass) {
          extend2(XMLElement2, superClass);
          function XMLElement2(parent, name, attributes) {
            XMLElement2.__super__.constructor.call(this, parent);
            if (name == null) {
              throw new Error("Missing element name. " + this.debugInfo());
            }
            this.name = this.stringify.eleName(name);
            this.attributes = {};
            if (attributes != null) {
              this.attribute(attributes);
            }
            if (parent.isDocument) {
              this.isRoot = true;
              this.documentObject = parent;
              parent.rootObject = this;
            }
          }
          XMLElement2.prototype.clone = function() {
            var att, attName, clonedSelf, ref1;
            clonedSelf = Object.create(this);
            if (clonedSelf.isRoot) {
              clonedSelf.documentObject = null;
            }
            clonedSelf.attributes = {};
            ref1 = this.attributes;
            for (attName in ref1) {
              if (!hasProp.call(ref1, attName)) continue;
              att = ref1[attName];
              clonedSelf.attributes[attName] = att.clone();
            }
            clonedSelf.children = [];
            this.children.forEach(function(child) {
              var clonedChild;
              clonedChild = child.clone();
              clonedChild.parent = clonedSelf;
              return clonedSelf.children.push(clonedChild);
            });
            return clonedSelf;
          };
          XMLElement2.prototype.attribute = function(name, value) {
            var attName, attValue;
            if (name != null) {
              name = getValue(name);
            }
            if (isObject3(name)) {
              for (attName in name) {
                if (!hasProp.call(name, attName)) continue;
                attValue = name[attName];
                this.attribute(attName, attValue);
              }
            } else {
              if (isFunction2(value)) {
                value = value.apply();
              }
              if (!this.options.skipNullAttributes || value != null) {
                this.attributes[name] = new XMLAttribute(this, name, value);
              }
            }
            return this;
          };
          XMLElement2.prototype.removeAttribute = function(name) {
            var attName, i, len;
            if (name == null) {
              throw new Error("Missing attribute name. " + this.debugInfo());
            }
            name = getValue(name);
            if (Array.isArray(name)) {
              for (i = 0, len = name.length; i < len; i++) {
                attName = name[i];
                delete this.attributes[attName];
              }
            } else {
              delete this.attributes[name];
            }
            return this;
          };
          XMLElement2.prototype.toString = function(options) {
            return this.options.writer.set(options).element(this);
          };
          XMLElement2.prototype.att = function(name, value) {
            return this.attribute(name, value);
          };
          XMLElement2.prototype.a = function(name, value) {
            return this.attribute(name, value);
          };
          return XMLElement2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLCData.js
  var require_XMLCData = __commonJS({
    "node_modules/xmlbuilder/lib/XMLCData.js"(exports2, module2) {
      (function() {
        var XMLCData, XMLNode, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLCData = (function(superClass) {
          extend2(XMLCData2, superClass);
          function XMLCData2(parent, text) {
            XMLCData2.__super__.constructor.call(this, parent);
            if (text == null) {
              throw new Error("Missing CDATA text. " + this.debugInfo());
            }
            this.text = this.stringify.cdata(text);
          }
          XMLCData2.prototype.clone = function() {
            return Object.create(this);
          };
          XMLCData2.prototype.toString = function(options) {
            return this.options.writer.set(options).cdata(this);
          };
          return XMLCData2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLComment.js
  var require_XMLComment = __commonJS({
    "node_modules/xmlbuilder/lib/XMLComment.js"(exports2, module2) {
      (function() {
        var XMLComment, XMLNode, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLComment = (function(superClass) {
          extend2(XMLComment2, superClass);
          function XMLComment2(parent, text) {
            XMLComment2.__super__.constructor.call(this, parent);
            if (text == null) {
              throw new Error("Missing comment text. " + this.debugInfo());
            }
            this.text = this.stringify.comment(text);
          }
          XMLComment2.prototype.clone = function() {
            return Object.create(this);
          };
          XMLComment2.prototype.toString = function(options) {
            return this.options.writer.set(options).comment(this);
          };
          return XMLComment2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDeclaration.js
  var require_XMLDeclaration = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDeclaration.js"(exports2, module2) {
      (function() {
        var XMLDeclaration, XMLNode, isObject3, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        isObject3 = require_Utility().isObject;
        XMLNode = require_XMLNode();
        module2.exports = XMLDeclaration = (function(superClass) {
          extend2(XMLDeclaration2, superClass);
          function XMLDeclaration2(parent, version3, encoding, standalone) {
            var ref;
            XMLDeclaration2.__super__.constructor.call(this, parent);
            if (isObject3(version3)) {
              ref = version3, version3 = ref.version, encoding = ref.encoding, standalone = ref.standalone;
            }
            if (!version3) {
              version3 = "1.0";
            }
            this.version = this.stringify.xmlVersion(version3);
            if (encoding != null) {
              this.encoding = this.stringify.xmlEncoding(encoding);
            }
            if (standalone != null) {
              this.standalone = this.stringify.xmlStandalone(standalone);
            }
          }
          XMLDeclaration2.prototype.toString = function(options) {
            return this.options.writer.set(options).declaration(this);
          };
          return XMLDeclaration2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDTDAttList.js
  var require_XMLDTDAttList = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDTDAttList.js"(exports2, module2) {
      (function() {
        var XMLDTDAttList, XMLNode, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLDTDAttList = (function(superClass) {
          extend2(XMLDTDAttList2, superClass);
          function XMLDTDAttList2(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
            XMLDTDAttList2.__super__.constructor.call(this, parent);
            if (elementName == null) {
              throw new Error("Missing DTD element name. " + this.debugInfo());
            }
            if (attributeName == null) {
              throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
            }
            if (!attributeType) {
              throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
            }
            if (!defaultValueType) {
              throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
            }
            if (defaultValueType.indexOf("#") !== 0) {
              defaultValueType = "#" + defaultValueType;
            }
            if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
              throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
            }
            if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
              throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
            }
            this.elementName = this.stringify.eleName(elementName);
            this.attributeName = this.stringify.attName(attributeName);
            this.attributeType = this.stringify.dtdAttType(attributeType);
            this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
            this.defaultValueType = defaultValueType;
          }
          XMLDTDAttList2.prototype.toString = function(options) {
            return this.options.writer.set(options).dtdAttList(this);
          };
          return XMLDTDAttList2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDTDEntity.js
  var require_XMLDTDEntity = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDTDEntity.js"(exports2, module2) {
      (function() {
        var XMLDTDEntity, XMLNode, isObject3, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        isObject3 = require_Utility().isObject;
        XMLNode = require_XMLNode();
        module2.exports = XMLDTDEntity = (function(superClass) {
          extend2(XMLDTDEntity2, superClass);
          function XMLDTDEntity2(parent, pe, name, value) {
            XMLDTDEntity2.__super__.constructor.call(this, parent);
            if (name == null) {
              throw new Error("Missing DTD entity name. " + this.debugInfo(name));
            }
            if (value == null) {
              throw new Error("Missing DTD entity value. " + this.debugInfo(name));
            }
            this.pe = !!pe;
            this.name = this.stringify.eleName(name);
            if (!isObject3(value)) {
              this.value = this.stringify.dtdEntityValue(value);
            } else {
              if (!value.pubID && !value.sysID) {
                throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
              }
              if (value.pubID && !value.sysID) {
                throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
              }
              if (value.pubID != null) {
                this.pubID = this.stringify.dtdPubID(value.pubID);
              }
              if (value.sysID != null) {
                this.sysID = this.stringify.dtdSysID(value.sysID);
              }
              if (value.nData != null) {
                this.nData = this.stringify.dtdNData(value.nData);
              }
              if (this.pe && this.nData) {
                throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
              }
            }
          }
          XMLDTDEntity2.prototype.toString = function(options) {
            return this.options.writer.set(options).dtdEntity(this);
          };
          return XMLDTDEntity2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDTDElement.js
  var require_XMLDTDElement = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDTDElement.js"(exports2, module2) {
      (function() {
        var XMLDTDElement, XMLNode, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLDTDElement = (function(superClass) {
          extend2(XMLDTDElement2, superClass);
          function XMLDTDElement2(parent, name, value) {
            XMLDTDElement2.__super__.constructor.call(this, parent);
            if (name == null) {
              throw new Error("Missing DTD element name. " + this.debugInfo());
            }
            if (!value) {
              value = "(#PCDATA)";
            }
            if (Array.isArray(value)) {
              value = "(" + value.join(",") + ")";
            }
            this.name = this.stringify.eleName(name);
            this.value = this.stringify.dtdElementValue(value);
          }
          XMLDTDElement2.prototype.toString = function(options) {
            return this.options.writer.set(options).dtdElement(this);
          };
          return XMLDTDElement2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDTDNotation.js
  var require_XMLDTDNotation = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDTDNotation.js"(exports2, module2) {
      (function() {
        var XMLDTDNotation, XMLNode, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLDTDNotation = (function(superClass) {
          extend2(XMLDTDNotation2, superClass);
          function XMLDTDNotation2(parent, name, value) {
            XMLDTDNotation2.__super__.constructor.call(this, parent);
            if (name == null) {
              throw new Error("Missing DTD notation name. " + this.debugInfo(name));
            }
            if (!value.pubID && !value.sysID) {
              throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
            }
            this.name = this.stringify.eleName(name);
            if (value.pubID != null) {
              this.pubID = this.stringify.dtdPubID(value.pubID);
            }
            if (value.sysID != null) {
              this.sysID = this.stringify.dtdSysID(value.sysID);
            }
          }
          XMLDTDNotation2.prototype.toString = function(options) {
            return this.options.writer.set(options).dtdNotation(this);
          };
          return XMLDTDNotation2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDocType.js
  var require_XMLDocType = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDocType.js"(exports2, module2) {
      (function() {
        var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNode, isObject3, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        isObject3 = require_Utility().isObject;
        XMLNode = require_XMLNode();
        XMLDTDAttList = require_XMLDTDAttList();
        XMLDTDEntity = require_XMLDTDEntity();
        XMLDTDElement = require_XMLDTDElement();
        XMLDTDNotation = require_XMLDTDNotation();
        module2.exports = XMLDocType = (function(superClass) {
          extend2(XMLDocType2, superClass);
          function XMLDocType2(parent, pubID, sysID) {
            var ref, ref1;
            XMLDocType2.__super__.constructor.call(this, parent);
            this.name = "!DOCTYPE";
            this.documentObject = parent;
            if (isObject3(pubID)) {
              ref = pubID, pubID = ref.pubID, sysID = ref.sysID;
            }
            if (sysID == null) {
              ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];
            }
            if (pubID != null) {
              this.pubID = this.stringify.dtdPubID(pubID);
            }
            if (sysID != null) {
              this.sysID = this.stringify.dtdSysID(sysID);
            }
          }
          XMLDocType2.prototype.element = function(name, value) {
            var child;
            child = new XMLDTDElement(this, name, value);
            this.children.push(child);
            return this;
          };
          XMLDocType2.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
            var child;
            child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
            this.children.push(child);
            return this;
          };
          XMLDocType2.prototype.entity = function(name, value) {
            var child;
            child = new XMLDTDEntity(this, false, name, value);
            this.children.push(child);
            return this;
          };
          XMLDocType2.prototype.pEntity = function(name, value) {
            var child;
            child = new XMLDTDEntity(this, true, name, value);
            this.children.push(child);
            return this;
          };
          XMLDocType2.prototype.notation = function(name, value) {
            var child;
            child = new XMLDTDNotation(this, name, value);
            this.children.push(child);
            return this;
          };
          XMLDocType2.prototype.toString = function(options) {
            return this.options.writer.set(options).docType(this);
          };
          XMLDocType2.prototype.ele = function(name, value) {
            return this.element(name, value);
          };
          XMLDocType2.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
            return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
          };
          XMLDocType2.prototype.ent = function(name, value) {
            return this.entity(name, value);
          };
          XMLDocType2.prototype.pent = function(name, value) {
            return this.pEntity(name, value);
          };
          XMLDocType2.prototype.not = function(name, value) {
            return this.notation(name, value);
          };
          XMLDocType2.prototype.up = function() {
            return this.root() || this.documentObject;
          };
          return XMLDocType2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLRaw.js
  var require_XMLRaw = __commonJS({
    "node_modules/xmlbuilder/lib/XMLRaw.js"(exports2, module2) {
      (function() {
        var XMLNode, XMLRaw, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLRaw = (function(superClass) {
          extend2(XMLRaw2, superClass);
          function XMLRaw2(parent, text) {
            XMLRaw2.__super__.constructor.call(this, parent);
            if (text == null) {
              throw new Error("Missing raw text. " + this.debugInfo());
            }
            this.value = this.stringify.raw(text);
          }
          XMLRaw2.prototype.clone = function() {
            return Object.create(this);
          };
          XMLRaw2.prototype.toString = function(options) {
            return this.options.writer.set(options).raw(this);
          };
          return XMLRaw2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLText.js
  var require_XMLText = __commonJS({
    "node_modules/xmlbuilder/lib/XMLText.js"(exports2, module2) {
      (function() {
        var XMLNode, XMLText, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLText = (function(superClass) {
          extend2(XMLText2, superClass);
          function XMLText2(parent, text) {
            XMLText2.__super__.constructor.call(this, parent);
            if (text == null) {
              throw new Error("Missing element text. " + this.debugInfo());
            }
            this.value = this.stringify.eleText(text);
          }
          XMLText2.prototype.clone = function() {
            return Object.create(this);
          };
          XMLText2.prototype.toString = function(options) {
            return this.options.writer.set(options).text(this);
          };
          return XMLText2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLProcessingInstruction.js
  var require_XMLProcessingInstruction = __commonJS({
    "node_modules/xmlbuilder/lib/XMLProcessingInstruction.js"(exports2, module2) {
      (function() {
        var XMLNode, XMLProcessingInstruction, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLProcessingInstruction = (function(superClass) {
          extend2(XMLProcessingInstruction2, superClass);
          function XMLProcessingInstruction2(parent, target, value) {
            XMLProcessingInstruction2.__super__.constructor.call(this, parent);
            if (target == null) {
              throw new Error("Missing instruction target. " + this.debugInfo());
            }
            this.target = this.stringify.insTarget(target);
            if (value) {
              this.value = this.stringify.insValue(value);
            }
          }
          XMLProcessingInstruction2.prototype.clone = function() {
            return Object.create(this);
          };
          XMLProcessingInstruction2.prototype.toString = function(options) {
            return this.options.writer.set(options).processingInstruction(this);
          };
          return XMLProcessingInstruction2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDummy.js
  var require_XMLDummy = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDummy.js"(exports2, module2) {
      (function() {
        var XMLDummy, XMLNode, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLNode = require_XMLNode();
        module2.exports = XMLDummy = (function(superClass) {
          extend2(XMLDummy2, superClass);
          function XMLDummy2(parent) {
            XMLDummy2.__super__.constructor.call(this, parent);
            this.isDummy = true;
          }
          XMLDummy2.prototype.clone = function() {
            return Object.create(this);
          };
          XMLDummy2.prototype.toString = function(options) {
            return "";
          };
          return XMLDummy2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLNode.js
  var require_XMLNode = __commonJS({
    "node_modules/xmlbuilder/lib/XMLNode.js"(exports2, module2) {
      (function() {
        var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty2, isFunction2, isObject3, ref, hasProp = {}.hasOwnProperty;
        ref = require_Utility(), isObject3 = ref.isObject, isFunction2 = ref.isFunction, isEmpty2 = ref.isEmpty, getValue = ref.getValue;
        XMLElement = null;
        XMLCData = null;
        XMLComment = null;
        XMLDeclaration = null;
        XMLDocType = null;
        XMLRaw = null;
        XMLText = null;
        XMLProcessingInstruction = null;
        XMLDummy = null;
        module2.exports = XMLNode = (function() {
          function XMLNode2(parent) {
            this.parent = parent;
            if (this.parent) {
              this.options = this.parent.options;
              this.stringify = this.parent.stringify;
            }
            this.children = [];
            if (!XMLElement) {
              XMLElement = require_XMLElement();
              XMLCData = require_XMLCData();
              XMLComment = require_XMLComment();
              XMLDeclaration = require_XMLDeclaration();
              XMLDocType = require_XMLDocType();
              XMLRaw = require_XMLRaw();
              XMLText = require_XMLText();
              XMLProcessingInstruction = require_XMLProcessingInstruction();
              XMLDummy = require_XMLDummy();
            }
          }
          XMLNode2.prototype.element = function(name, attributes, text) {
            var childNode, item, j, k, key, lastChild, len, len1, ref1, ref2, val;
            lastChild = null;
            if (attributes === null && text == null) {
              ref1 = [{}, null], attributes = ref1[0], text = ref1[1];
            }
            if (attributes == null) {
              attributes = {};
            }
            attributes = getValue(attributes);
            if (!isObject3(attributes)) {
              ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
            }
            if (name != null) {
              name = getValue(name);
            }
            if (Array.isArray(name)) {
              for (j = 0, len = name.length; j < len; j++) {
                item = name[j];
                lastChild = this.element(item);
              }
            } else if (isFunction2(name)) {
              lastChild = this.element(name.apply());
            } else if (isObject3(name)) {
              for (key in name) {
                if (!hasProp.call(name, key)) continue;
                val = name[key];
                if (isFunction2(val)) {
                  val = val.apply();
                }
                if (isObject3(val) && isEmpty2(val)) {
                  val = null;
                }
                if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
                  lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
                } else if (!this.options.separateArrayItems && Array.isArray(val)) {
                  for (k = 0, len1 = val.length; k < len1; k++) {
                    item = val[k];
                    childNode = {};
                    childNode[key] = item;
                    lastChild = this.element(childNode);
                  }
                } else if (isObject3(val)) {
                  lastChild = this.element(key);
                  lastChild.element(val);
                } else {
                  lastChild = this.element(key, val);
                }
              }
            } else if (this.options.skipNullNodes && text === null) {
              lastChild = this.dummy();
            } else {
              if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
                lastChild = this.text(text);
              } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
                lastChild = this.cdata(text);
              } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
                lastChild = this.comment(text);
              } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
                lastChild = this.raw(text);
              } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
                lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
              } else {
                lastChild = this.node(name, attributes, text);
              }
            }
            if (lastChild == null) {
              throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
            }
            return lastChild;
          };
          XMLNode2.prototype.insertBefore = function(name, attributes, text) {
            var child, i, removed;
            if (this.isRoot) {
              throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
            }
            i = this.parent.children.indexOf(this);
            removed = this.parent.children.splice(i);
            child = this.parent.element(name, attributes, text);
            Array.prototype.push.apply(this.parent.children, removed);
            return child;
          };
          XMLNode2.prototype.insertAfter = function(name, attributes, text) {
            var child, i, removed;
            if (this.isRoot) {
              throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
            }
            i = this.parent.children.indexOf(this);
            removed = this.parent.children.splice(i + 1);
            child = this.parent.element(name, attributes, text);
            Array.prototype.push.apply(this.parent.children, removed);
            return child;
          };
          XMLNode2.prototype.remove = function() {
            var i, ref1;
            if (this.isRoot) {
              throw new Error("Cannot remove the root element. " + this.debugInfo());
            }
            i = this.parent.children.indexOf(this);
            [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1;
            return this.parent;
          };
          XMLNode2.prototype.node = function(name, attributes, text) {
            var child, ref1;
            if (name != null) {
              name = getValue(name);
            }
            attributes || (attributes = {});
            attributes = getValue(attributes);
            if (!isObject3(attributes)) {
              ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
            }
            child = new XMLElement(this, name, attributes);
            if (text != null) {
              child.text(text);
            }
            this.children.push(child);
            return child;
          };
          XMLNode2.prototype.text = function(value) {
            var child;
            child = new XMLText(this, value);
            this.children.push(child);
            return this;
          };
          XMLNode2.prototype.cdata = function(value) {
            var child;
            child = new XMLCData(this, value);
            this.children.push(child);
            return this;
          };
          XMLNode2.prototype.comment = function(value) {
            var child;
            child = new XMLComment(this, value);
            this.children.push(child);
            return this;
          };
          XMLNode2.prototype.commentBefore = function(value) {
            var child, i, removed;
            i = this.parent.children.indexOf(this);
            removed = this.parent.children.splice(i);
            child = this.parent.comment(value);
            Array.prototype.push.apply(this.parent.children, removed);
            return this;
          };
          XMLNode2.prototype.commentAfter = function(value) {
            var child, i, removed;
            i = this.parent.children.indexOf(this);
            removed = this.parent.children.splice(i + 1);
            child = this.parent.comment(value);
            Array.prototype.push.apply(this.parent.children, removed);
            return this;
          };
          XMLNode2.prototype.raw = function(value) {
            var child;
            child = new XMLRaw(this, value);
            this.children.push(child);
            return this;
          };
          XMLNode2.prototype.dummy = function() {
            var child;
            child = new XMLDummy(this);
            this.children.push(child);
            return child;
          };
          XMLNode2.prototype.instruction = function(target, value) {
            var insTarget, insValue, instruction, j, len;
            if (target != null) {
              target = getValue(target);
            }
            if (value != null) {
              value = getValue(value);
            }
            if (Array.isArray(target)) {
              for (j = 0, len = target.length; j < len; j++) {
                insTarget = target[j];
                this.instruction(insTarget);
              }
            } else if (isObject3(target)) {
              for (insTarget in target) {
                if (!hasProp.call(target, insTarget)) continue;
                insValue = target[insTarget];
                this.instruction(insTarget, insValue);
              }
            } else {
              if (isFunction2(value)) {
                value = value.apply();
              }
              instruction = new XMLProcessingInstruction(this, target, value);
              this.children.push(instruction);
            }
            return this;
          };
          XMLNode2.prototype.instructionBefore = function(target, value) {
            var child, i, removed;
            i = this.parent.children.indexOf(this);
            removed = this.parent.children.splice(i);
            child = this.parent.instruction(target, value);
            Array.prototype.push.apply(this.parent.children, removed);
            return this;
          };
          XMLNode2.prototype.instructionAfter = function(target, value) {
            var child, i, removed;
            i = this.parent.children.indexOf(this);
            removed = this.parent.children.splice(i + 1);
            child = this.parent.instruction(target, value);
            Array.prototype.push.apply(this.parent.children, removed);
            return this;
          };
          XMLNode2.prototype.declaration = function(version3, encoding, standalone) {
            var doc, xmldec;
            doc = this.document();
            xmldec = new XMLDeclaration(doc, version3, encoding, standalone);
            if (doc.children[0] instanceof XMLDeclaration) {
              doc.children[0] = xmldec;
            } else {
              doc.children.unshift(xmldec);
            }
            return doc.root() || doc;
          };
          XMLNode2.prototype.doctype = function(pubID, sysID) {
            var child, doc, doctype, i, j, k, len, len1, ref1, ref2;
            doc = this.document();
            doctype = new XMLDocType(doc, pubID, sysID);
            ref1 = doc.children;
            for (i = j = 0, len = ref1.length; j < len; i = ++j) {
              child = ref1[i];
              if (child instanceof XMLDocType) {
                doc.children[i] = doctype;
                return doctype;
              }
            }
            ref2 = doc.children;
            for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) {
              child = ref2[i];
              if (child.isRoot) {
                doc.children.splice(i, 0, doctype);
                return doctype;
              }
            }
            doc.children.push(doctype);
            return doctype;
          };
          XMLNode2.prototype.up = function() {
            if (this.isRoot) {
              throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
            }
            return this.parent;
          };
          XMLNode2.prototype.root = function() {
            var node;
            node = this;
            while (node) {
              if (node.isDocument) {
                return node.rootObject;
              } else if (node.isRoot) {
                return node;
              } else {
                node = node.parent;
              }
            }
          };
          XMLNode2.prototype.document = function() {
            var node;
            node = this;
            while (node) {
              if (node.isDocument) {
                return node;
              } else {
                node = node.parent;
              }
            }
          };
          XMLNode2.prototype.end = function(options) {
            return this.document().end(options);
          };
          XMLNode2.prototype.prev = function() {
            var i;
            i = this.parent.children.indexOf(this);
            while (i > 0 && this.parent.children[i - 1].isDummy) {
              i = i - 1;
            }
            if (i < 1) {
              throw new Error("Already at the first node. " + this.debugInfo());
            }
            return this.parent.children[i - 1];
          };
          XMLNode2.prototype.next = function() {
            var i;
            i = this.parent.children.indexOf(this);
            while (i < this.parent.children.length - 1 && this.parent.children[i + 1].isDummy) {
              i = i + 1;
            }
            if (i === -1 || i === this.parent.children.length - 1) {
              throw new Error("Already at the last node. " + this.debugInfo());
            }
            return this.parent.children[i + 1];
          };
          XMLNode2.prototype.importDocument = function(doc) {
            var clonedRoot;
            clonedRoot = doc.root().clone();
            clonedRoot.parent = this;
            clonedRoot.isRoot = false;
            this.children.push(clonedRoot);
            return this;
          };
          XMLNode2.prototype.debugInfo = function(name) {
            var ref1, ref2;
            name = name || this.name;
            if (name == null && !((ref1 = this.parent) != null ? ref1.name : void 0)) {
              return "";
            } else if (name == null) {
              return "parent: <" + this.parent.name + ">";
            } else if (!((ref2 = this.parent) != null ? ref2.name : void 0)) {
              return "node: <" + name + ">";
            } else {
              return "node: <" + name + ">, parent: <" + this.parent.name + ">";
            }
          };
          XMLNode2.prototype.ele = function(name, attributes, text) {
            return this.element(name, attributes, text);
          };
          XMLNode2.prototype.nod = function(name, attributes, text) {
            return this.node(name, attributes, text);
          };
          XMLNode2.prototype.txt = function(value) {
            return this.text(value);
          };
          XMLNode2.prototype.dat = function(value) {
            return this.cdata(value);
          };
          XMLNode2.prototype.com = function(value) {
            return this.comment(value);
          };
          XMLNode2.prototype.ins = function(target, value) {
            return this.instruction(target, value);
          };
          XMLNode2.prototype.doc = function() {
            return this.document();
          };
          XMLNode2.prototype.dec = function(version3, encoding, standalone) {
            return this.declaration(version3, encoding, standalone);
          };
          XMLNode2.prototype.dtd = function(pubID, sysID) {
            return this.doctype(pubID, sysID);
          };
          XMLNode2.prototype.e = function(name, attributes, text) {
            return this.element(name, attributes, text);
          };
          XMLNode2.prototype.n = function(name, attributes, text) {
            return this.node(name, attributes, text);
          };
          XMLNode2.prototype.t = function(value) {
            return this.text(value);
          };
          XMLNode2.prototype.d = function(value) {
            return this.cdata(value);
          };
          XMLNode2.prototype.c = function(value) {
            return this.comment(value);
          };
          XMLNode2.prototype.r = function(value) {
            return this.raw(value);
          };
          XMLNode2.prototype.i = function(target, value) {
            return this.instruction(target, value);
          };
          XMLNode2.prototype.u = function() {
            return this.up();
          };
          XMLNode2.prototype.importXMLBuilder = function(doc) {
            return this.importDocument(doc);
          };
          return XMLNode2;
        })();
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLStringifier.js
  var require_XMLStringifier = __commonJS({
    "node_modules/xmlbuilder/lib/XMLStringifier.js"(exports2, module2) {
      (function() {
        var XMLStringifier, bind = function(fn, me) {
          return function() {
            return fn.apply(me, arguments);
          };
        }, hasProp = {}.hasOwnProperty;
        module2.exports = XMLStringifier = (function() {
          function XMLStringifier2(options) {
            this.assertLegalChar = bind(this.assertLegalChar, this);
            var key, ref, value;
            options || (options = {});
            this.noDoubleEncoding = options.noDoubleEncoding;
            ref = options.stringify || {};
            for (key in ref) {
              if (!hasProp.call(ref, key)) continue;
              value = ref[key];
              this[key] = value;
            }
          }
          XMLStringifier2.prototype.eleName = function(val) {
            val = "" + val || "";
            return this.assertLegalChar(val);
          };
          XMLStringifier2.prototype.eleText = function(val) {
            val = "" + val || "";
            return this.assertLegalChar(this.elEscape(val));
          };
          XMLStringifier2.prototype.cdata = function(val) {
            val = "" + val || "";
            val = val.replace("]]>", "]]]]><![CDATA[>");
            return this.assertLegalChar(val);
          };
          XMLStringifier2.prototype.comment = function(val) {
            val = "" + val || "";
            if (val.match(/--/)) {
              throw new Error("Comment text cannot contain double-hypen: " + val);
            }
            return this.assertLegalChar(val);
          };
          XMLStringifier2.prototype.raw = function(val) {
            return "" + val || "";
          };
          XMLStringifier2.prototype.attName = function(val) {
            return val = "" + val || "";
          };
          XMLStringifier2.prototype.attValue = function(val) {
            val = "" + val || "";
            return this.attEscape(val);
          };
          XMLStringifier2.prototype.insTarget = function(val) {
            return "" + val || "";
          };
          XMLStringifier2.prototype.insValue = function(val) {
            val = "" + val || "";
            if (val.match(/\?>/)) {
              throw new Error("Invalid processing instruction value: " + val);
            }
            return val;
          };
          XMLStringifier2.prototype.xmlVersion = function(val) {
            val = "" + val || "";
            if (!val.match(/1\.[0-9]+/)) {
              throw new Error("Invalid version number: " + val);
            }
            return val;
          };
          XMLStringifier2.prototype.xmlEncoding = function(val) {
            val = "" + val || "";
            if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
              throw new Error("Invalid encoding: " + val);
            }
            return val;
          };
          XMLStringifier2.prototype.xmlStandalone = function(val) {
            if (val) {
              return "yes";
            } else {
              return "no";
            }
          };
          XMLStringifier2.prototype.dtdPubID = function(val) {
            return "" + val || "";
          };
          XMLStringifier2.prototype.dtdSysID = function(val) {
            return "" + val || "";
          };
          XMLStringifier2.prototype.dtdElementValue = function(val) {
            return "" + val || "";
          };
          XMLStringifier2.prototype.dtdAttType = function(val) {
            return "" + val || "";
          };
          XMLStringifier2.prototype.dtdAttDefault = function(val) {
            if (val != null) {
              return "" + val || "";
            } else {
              return val;
            }
          };
          XMLStringifier2.prototype.dtdEntityValue = function(val) {
            return "" + val || "";
          };
          XMLStringifier2.prototype.dtdNData = function(val) {
            return "" + val || "";
          };
          XMLStringifier2.prototype.convertAttKey = "@";
          XMLStringifier2.prototype.convertPIKey = "?";
          XMLStringifier2.prototype.convertTextKey = "#text";
          XMLStringifier2.prototype.convertCDataKey = "#cdata";
          XMLStringifier2.prototype.convertCommentKey = "#comment";
          XMLStringifier2.prototype.convertRawKey = "#raw";
          XMLStringifier2.prototype.assertLegalChar = function(str) {
            var res;
            res = str.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/);
            if (res) {
              throw new Error("Invalid character in string: " + str + " at index " + res.index);
            }
            return str;
          };
          XMLStringifier2.prototype.elEscape = function(str) {
            var ampregex;
            ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
            return str.replace(ampregex, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\r/g, "&#xD;");
          };
          XMLStringifier2.prototype.attEscape = function(str) {
            var ampregex;
            ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
            return str.replace(ampregex, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;").replace(/\t/g, "&#x9;").replace(/\n/g, "&#xA;").replace(/\r/g, "&#xD;");
          };
          return XMLStringifier2;
        })();
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLWriterBase.js
  var require_XMLWriterBase = __commonJS({
    "node_modules/xmlbuilder/lib/XMLWriterBase.js"(exports2, module2) {
      (function() {
        var XMLWriterBase, hasProp = {}.hasOwnProperty;
        module2.exports = XMLWriterBase = (function() {
          function XMLWriterBase2(options) {
            var key, ref, ref1, ref2, ref3, ref4, ref5, ref6, value;
            options || (options = {});
            this.pretty = options.pretty || false;
            this.allowEmpty = (ref = options.allowEmpty) != null ? ref : false;
            if (this.pretty) {
              this.indent = (ref1 = options.indent) != null ? ref1 : "  ";
              this.newline = (ref2 = options.newline) != null ? ref2 : "\n";
              this.offset = (ref3 = options.offset) != null ? ref3 : 0;
              this.dontprettytextnodes = (ref4 = options.dontprettytextnodes) != null ? ref4 : 0;
            } else {
              this.indent = "";
              this.newline = "";
              this.offset = 0;
              this.dontprettytextnodes = 0;
            }
            this.spacebeforeslash = (ref5 = options.spacebeforeslash) != null ? ref5 : "";
            if (this.spacebeforeslash === true) {
              this.spacebeforeslash = " ";
            }
            this.newlinedefault = this.newline;
            this.prettydefault = this.pretty;
            ref6 = options.writer || {};
            for (key in ref6) {
              if (!hasProp.call(ref6, key)) continue;
              value = ref6[key];
              this[key] = value;
            }
          }
          XMLWriterBase2.prototype.set = function(options) {
            var key, ref, value;
            options || (options = {});
            if ("pretty" in options) {
              this.pretty = options.pretty;
            }
            if ("allowEmpty" in options) {
              this.allowEmpty = options.allowEmpty;
            }
            if (this.pretty) {
              this.indent = "indent" in options ? options.indent : "  ";
              this.newline = "newline" in options ? options.newline : "\n";
              this.offset = "offset" in options ? options.offset : 0;
              this.dontprettytextnodes = "dontprettytextnodes" in options ? options.dontprettytextnodes : 0;
            } else {
              this.indent = "";
              this.newline = "";
              this.offset = 0;
              this.dontprettytextnodes = 0;
            }
            this.spacebeforeslash = "spacebeforeslash" in options ? options.spacebeforeslash : "";
            if (this.spacebeforeslash === true) {
              this.spacebeforeslash = " ";
            }
            this.newlinedefault = this.newline;
            this.prettydefault = this.pretty;
            ref = options.writer || {};
            for (key in ref) {
              if (!hasProp.call(ref, key)) continue;
              value = ref[key];
              this[key] = value;
            }
            return this;
          };
          XMLWriterBase2.prototype.space = function(level) {
            var indent;
            if (this.pretty) {
              indent = (level || 0) + this.offset + 1;
              if (indent > 0) {
                return new Array(indent).join(this.indent);
              } else {
                return "";
              }
            } else {
              return "";
            }
          };
          return XMLWriterBase2;
        })();
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLStringWriter.js
  var require_XMLStringWriter = __commonJS({
    "node_modules/xmlbuilder/lib/XMLStringWriter.js"(exports2, module2) {
      (function() {
        var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLText, XMLWriterBase, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLDeclaration = require_XMLDeclaration();
        XMLDocType = require_XMLDocType();
        XMLCData = require_XMLCData();
        XMLComment = require_XMLComment();
        XMLElement = require_XMLElement();
        XMLRaw = require_XMLRaw();
        XMLText = require_XMLText();
        XMLProcessingInstruction = require_XMLProcessingInstruction();
        XMLDummy = require_XMLDummy();
        XMLDTDAttList = require_XMLDTDAttList();
        XMLDTDElement = require_XMLDTDElement();
        XMLDTDEntity = require_XMLDTDEntity();
        XMLDTDNotation = require_XMLDTDNotation();
        XMLWriterBase = require_XMLWriterBase();
        module2.exports = XMLStringWriter = (function(superClass) {
          extend2(XMLStringWriter2, superClass);
          function XMLStringWriter2(options) {
            XMLStringWriter2.__super__.constructor.call(this, options);
          }
          XMLStringWriter2.prototype.document = function(doc) {
            var child, i, len, r, ref;
            this.textispresent = false;
            r = "";
            ref = doc.children;
            for (i = 0, len = ref.length; i < len; i++) {
              child = ref[i];
              if (child instanceof XMLDummy) {
                continue;
              }
              r += (function() {
                switch (false) {
                  case !(child instanceof XMLDeclaration):
                    return this.declaration(child);
                  case !(child instanceof XMLDocType):
                    return this.docType(child);
                  case !(child instanceof XMLComment):
                    return this.comment(child);
                  case !(child instanceof XMLProcessingInstruction):
                    return this.processingInstruction(child);
                  default:
                    return this.element(child, 0);
                }
              }).call(this);
            }
            if (this.pretty && r.slice(-this.newline.length) === this.newline) {
              r = r.slice(0, -this.newline.length);
            }
            return r;
          };
          XMLStringWriter2.prototype.attribute = function(att) {
            return " " + att.name + '="' + att.value + '"';
          };
          XMLStringWriter2.prototype.cdata = function(node, level) {
            return this.space(level) + "<![CDATA[" + node.text + "]]>" + this.newline;
          };
          XMLStringWriter2.prototype.comment = function(node, level) {
            return this.space(level) + "<!-- " + node.text + " -->" + this.newline;
          };
          XMLStringWriter2.prototype.declaration = function(node, level) {
            var r;
            r = this.space(level);
            r += '<?xml version="' + node.version + '"';
            if (node.encoding != null) {
              r += ' encoding="' + node.encoding + '"';
            }
            if (node.standalone != null) {
              r += ' standalone="' + node.standalone + '"';
            }
            r += this.spacebeforeslash + "?>";
            r += this.newline;
            return r;
          };
          XMLStringWriter2.prototype.docType = function(node, level) {
            var child, i, len, r, ref;
            level || (level = 0);
            r = this.space(level);
            r += "<!DOCTYPE " + node.root().name;
            if (node.pubID && node.sysID) {
              r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
            } else if (node.sysID) {
              r += ' SYSTEM "' + node.sysID + '"';
            }
            if (node.children.length > 0) {
              r += " [";
              r += this.newline;
              ref = node.children;
              for (i = 0, len = ref.length; i < len; i++) {
                child = ref[i];
                r += (function() {
                  switch (false) {
                    case !(child instanceof XMLDTDAttList):
                      return this.dtdAttList(child, level + 1);
                    case !(child instanceof XMLDTDElement):
                      return this.dtdElement(child, level + 1);
                    case !(child instanceof XMLDTDEntity):
                      return this.dtdEntity(child, level + 1);
                    case !(child instanceof XMLDTDNotation):
                      return this.dtdNotation(child, level + 1);
                    case !(child instanceof XMLCData):
                      return this.cdata(child, level + 1);
                    case !(child instanceof XMLComment):
                      return this.comment(child, level + 1);
                    case !(child instanceof XMLProcessingInstruction):
                      return this.processingInstruction(child, level + 1);
                    default:
                      throw new Error("Unknown DTD node type: " + child.constructor.name);
                  }
                }).call(this);
              }
              r += "]";
            }
            r += this.spacebeforeslash + ">";
            r += this.newline;
            return r;
          };
          XMLStringWriter2.prototype.element = function(node, level) {
            var att, child, i, j, len, len1, name, r, ref, ref1, ref2, space, textispresentwasset;
            level || (level = 0);
            textispresentwasset = false;
            if (this.textispresent) {
              this.newline = "";
              this.pretty = false;
            } else {
              this.newline = this.newlinedefault;
              this.pretty = this.prettydefault;
            }
            space = this.space(level);
            r = "";
            r += space + "<" + node.name;
            ref = node.attributes;
            for (name in ref) {
              if (!hasProp.call(ref, name)) continue;
              att = ref[name];
              r += this.attribute(att);
            }
            if (node.children.length === 0 || node.children.every(function(e) {
              return e.value === "";
            })) {
              if (this.allowEmpty) {
                r += "></" + node.name + ">" + this.newline;
              } else {
                r += this.spacebeforeslash + "/>" + this.newline;
              }
            } else if (this.pretty && node.children.length === 1 && node.children[0].value != null) {
              r += ">";
              r += node.children[0].value;
              r += "</" + node.name + ">" + this.newline;
            } else {
              if (this.dontprettytextnodes) {
                ref1 = node.children;
                for (i = 0, len = ref1.length; i < len; i++) {
                  child = ref1[i];
                  if (child.value != null) {
                    this.textispresent++;
                    textispresentwasset = true;
                    break;
                  }
                }
              }
              if (this.textispresent) {
                this.newline = "";
                this.pretty = false;
                space = this.space(level);
              }
              r += ">" + this.newline;
              ref2 = node.children;
              for (j = 0, len1 = ref2.length; j < len1; j++) {
                child = ref2[j];
                r += (function() {
                  switch (false) {
                    case !(child instanceof XMLCData):
                      return this.cdata(child, level + 1);
                    case !(child instanceof XMLComment):
                      return this.comment(child, level + 1);
                    case !(child instanceof XMLElement):
                      return this.element(child, level + 1);
                    case !(child instanceof XMLRaw):
                      return this.raw(child, level + 1);
                    case !(child instanceof XMLText):
                      return this.text(child, level + 1);
                    case !(child instanceof XMLProcessingInstruction):
                      return this.processingInstruction(child, level + 1);
                    case !(child instanceof XMLDummy):
                      return "";
                    default:
                      throw new Error("Unknown XML node type: " + child.constructor.name);
                  }
                }).call(this);
              }
              if (textispresentwasset) {
                this.textispresent--;
              }
              if (!this.textispresent) {
                this.newline = this.newlinedefault;
                this.pretty = this.prettydefault;
              }
              r += space + "</" + node.name + ">" + this.newline;
            }
            return r;
          };
          XMLStringWriter2.prototype.processingInstruction = function(node, level) {
            var r;
            r = this.space(level) + "<?" + node.target;
            if (node.value) {
              r += " " + node.value;
            }
            r += this.spacebeforeslash + "?>" + this.newline;
            return r;
          };
          XMLStringWriter2.prototype.raw = function(node, level) {
            return this.space(level) + node.value + this.newline;
          };
          XMLStringWriter2.prototype.text = function(node, level) {
            return this.space(level) + node.value + this.newline;
          };
          XMLStringWriter2.prototype.dtdAttList = function(node, level) {
            var r;
            r = this.space(level) + "<!ATTLIST " + node.elementName + " " + node.attributeName + " " + node.attributeType;
            if (node.defaultValueType !== "#DEFAULT") {
              r += " " + node.defaultValueType;
            }
            if (node.defaultValue) {
              r += ' "' + node.defaultValue + '"';
            }
            r += this.spacebeforeslash + ">" + this.newline;
            return r;
          };
          XMLStringWriter2.prototype.dtdElement = function(node, level) {
            return this.space(level) + "<!ELEMENT " + node.name + " " + node.value + this.spacebeforeslash + ">" + this.newline;
          };
          XMLStringWriter2.prototype.dtdEntity = function(node, level) {
            var r;
            r = this.space(level) + "<!ENTITY";
            if (node.pe) {
              r += " %";
            }
            r += " " + node.name;
            if (node.value) {
              r += ' "' + node.value + '"';
            } else {
              if (node.pubID && node.sysID) {
                r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
              } else if (node.sysID) {
                r += ' SYSTEM "' + node.sysID + '"';
              }
              if (node.nData) {
                r += " NDATA " + node.nData;
              }
            }
            r += this.spacebeforeslash + ">" + this.newline;
            return r;
          };
          XMLStringWriter2.prototype.dtdNotation = function(node, level) {
            var r;
            r = this.space(level) + "<!NOTATION " + node.name;
            if (node.pubID && node.sysID) {
              r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
            } else if (node.pubID) {
              r += ' PUBLIC "' + node.pubID + '"';
            } else if (node.sysID) {
              r += ' SYSTEM "' + node.sysID + '"';
            }
            r += this.spacebeforeslash + ">" + this.newline;
            return r;
          };
          XMLStringWriter2.prototype.openNode = function(node, level) {
            var att, name, r, ref;
            level || (level = 0);
            if (node instanceof XMLElement) {
              r = this.space(level) + "<" + node.name;
              ref = node.attributes;
              for (name in ref) {
                if (!hasProp.call(ref, name)) continue;
                att = ref[name];
                r += this.attribute(att);
              }
              r += (node.children ? ">" : "/>") + this.newline;
              return r;
            } else {
              r = this.space(level) + "<!DOCTYPE " + node.rootNodeName;
              if (node.pubID && node.sysID) {
                r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
              } else if (node.sysID) {
                r += ' SYSTEM "' + node.sysID + '"';
              }
              r += (node.children ? " [" : ">") + this.newline;
              return r;
            }
          };
          XMLStringWriter2.prototype.closeNode = function(node, level) {
            level || (level = 0);
            switch (false) {
              case !(node instanceof XMLElement):
                return this.space(level) + "</" + node.name + ">" + this.newline;
              case !(node instanceof XMLDocType):
                return this.space(level) + "]>" + this.newline;
            }
          };
          return XMLStringWriter2;
        })(XMLWriterBase);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDocument.js
  var require_XMLDocument = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDocument.js"(exports2, module2) {
      (function() {
        var XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        isPlainObject = require_Utility().isPlainObject;
        XMLNode = require_XMLNode();
        XMLStringifier = require_XMLStringifier();
        XMLStringWriter = require_XMLStringWriter();
        module2.exports = XMLDocument = (function(superClass) {
          extend2(XMLDocument2, superClass);
          function XMLDocument2(options) {
            XMLDocument2.__super__.constructor.call(this, null);
            this.name = "?xml";
            options || (options = {});
            if (!options.writer) {
              options.writer = new XMLStringWriter();
            }
            this.options = options;
            this.stringify = new XMLStringifier(options);
            this.isDocument = true;
          }
          XMLDocument2.prototype.end = function(writer) {
            var writerOptions;
            if (!writer) {
              writer = this.options.writer;
            } else if (isPlainObject(writer)) {
              writerOptions = writer;
              writer = this.options.writer.set(writerOptions);
            }
            return writer.document(this);
          };
          XMLDocument2.prototype.toString = function(options) {
            return this.options.writer.set(options).document(this);
          };
          return XMLDocument2;
        })(XMLNode);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLDocumentCB.js
  var require_XMLDocumentCB = __commonJS({
    "node_modules/xmlbuilder/lib/XMLDocumentCB.js"(exports2, module2) {
      (function() {
        var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction2, isObject3, isPlainObject, ref, hasProp = {}.hasOwnProperty;
        ref = require_Utility(), isObject3 = ref.isObject, isFunction2 = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
        XMLElement = require_XMLElement();
        XMLCData = require_XMLCData();
        XMLComment = require_XMLComment();
        XMLRaw = require_XMLRaw();
        XMLText = require_XMLText();
        XMLProcessingInstruction = require_XMLProcessingInstruction();
        XMLDeclaration = require_XMLDeclaration();
        XMLDocType = require_XMLDocType();
        XMLDTDAttList = require_XMLDTDAttList();
        XMLDTDEntity = require_XMLDTDEntity();
        XMLDTDElement = require_XMLDTDElement();
        XMLDTDNotation = require_XMLDTDNotation();
        XMLAttribute = require_XMLAttribute();
        XMLStringifier = require_XMLStringifier();
        XMLStringWriter = require_XMLStringWriter();
        module2.exports = XMLDocumentCB = (function() {
          function XMLDocumentCB2(options, onData, onEnd) {
            var writerOptions;
            this.name = "?xml";
            options || (options = {});
            if (!options.writer) {
              options.writer = new XMLStringWriter(options);
            } else if (isPlainObject(options.writer)) {
              writerOptions = options.writer;
              options.writer = new XMLStringWriter(writerOptions);
            }
            this.options = options;
            this.writer = options.writer;
            this.stringify = new XMLStringifier(options);
            this.onDataCallback = onData || function() {
            };
            this.onEndCallback = onEnd || function() {
            };
            this.currentNode = null;
            this.currentLevel = -1;
            this.openTags = {};
            this.documentStarted = false;
            this.documentCompleted = false;
            this.root = null;
          }
          XMLDocumentCB2.prototype.node = function(name, attributes, text) {
            var ref1, ref2;
            if (name == null) {
              throw new Error("Missing node name.");
            }
            if (this.root && this.currentLevel === -1) {
              throw new Error("Document can only have one root node. " + this.debugInfo(name));
            }
            this.openCurrent();
            name = getValue(name);
            if (attributes === null && text == null) {
              ref1 = [{}, null], attributes = ref1[0], text = ref1[1];
            }
            if (attributes == null) {
              attributes = {};
            }
            attributes = getValue(attributes);
            if (!isObject3(attributes)) {
              ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
            }
            this.currentNode = new XMLElement(this, name, attributes);
            this.currentNode.children = false;
            this.currentLevel++;
            this.openTags[this.currentLevel] = this.currentNode;
            if (text != null) {
              this.text(text);
            }
            return this;
          };
          XMLDocumentCB2.prototype.element = function(name, attributes, text) {
            if (this.currentNode && this.currentNode instanceof XMLDocType) {
              return this.dtdElement.apply(this, arguments);
            } else {
              return this.node(name, attributes, text);
            }
          };
          XMLDocumentCB2.prototype.attribute = function(name, value) {
            var attName, attValue;
            if (!this.currentNode || this.currentNode.children) {
              throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
            }
            if (name != null) {
              name = getValue(name);
            }
            if (isObject3(name)) {
              for (attName in name) {
                if (!hasProp.call(name, attName)) continue;
                attValue = name[attName];
                this.attribute(attName, attValue);
              }
            } else {
              if (isFunction2(value)) {
                value = value.apply();
              }
              if (!this.options.skipNullAttributes || value != null) {
                this.currentNode.attributes[name] = new XMLAttribute(this, name, value);
              }
            }
            return this;
          };
          XMLDocumentCB2.prototype.text = function(value) {
            var node;
            this.openCurrent();
            node = new XMLText(this, value);
            this.onData(this.writer.text(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.cdata = function(value) {
            var node;
            this.openCurrent();
            node = new XMLCData(this, value);
            this.onData(this.writer.cdata(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.comment = function(value) {
            var node;
            this.openCurrent();
            node = new XMLComment(this, value);
            this.onData(this.writer.comment(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.raw = function(value) {
            var node;
            this.openCurrent();
            node = new XMLRaw(this, value);
            this.onData(this.writer.raw(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.instruction = function(target, value) {
            var i, insTarget, insValue, len, node;
            this.openCurrent();
            if (target != null) {
              target = getValue(target);
            }
            if (value != null) {
              value = getValue(value);
            }
            if (Array.isArray(target)) {
              for (i = 0, len = target.length; i < len; i++) {
                insTarget = target[i];
                this.instruction(insTarget);
              }
            } else if (isObject3(target)) {
              for (insTarget in target) {
                if (!hasProp.call(target, insTarget)) continue;
                insValue = target[insTarget];
                this.instruction(insTarget, insValue);
              }
            } else {
              if (isFunction2(value)) {
                value = value.apply();
              }
              node = new XMLProcessingInstruction(this, target, value);
              this.onData(this.writer.processingInstruction(node, this.currentLevel + 1), this.currentLevel + 1);
            }
            return this;
          };
          XMLDocumentCB2.prototype.declaration = function(version3, encoding, standalone) {
            var node;
            this.openCurrent();
            if (this.documentStarted) {
              throw new Error("declaration() must be the first node.");
            }
            node = new XMLDeclaration(this, version3, encoding, standalone);
            this.onData(this.writer.declaration(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.doctype = function(root3, pubID, sysID) {
            this.openCurrent();
            if (root3 == null) {
              throw new Error("Missing root node name.");
            }
            if (this.root) {
              throw new Error("dtd() must come before the root node.");
            }
            this.currentNode = new XMLDocType(this, pubID, sysID);
            this.currentNode.rootNodeName = root3;
            this.currentNode.children = false;
            this.currentLevel++;
            this.openTags[this.currentLevel] = this.currentNode;
            return this;
          };
          XMLDocumentCB2.prototype.dtdElement = function(name, value) {
            var node;
            this.openCurrent();
            node = new XMLDTDElement(this, name, value);
            this.onData(this.writer.dtdElement(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
            var node;
            this.openCurrent();
            node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
            this.onData(this.writer.dtdAttList(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.entity = function(name, value) {
            var node;
            this.openCurrent();
            node = new XMLDTDEntity(this, false, name, value);
            this.onData(this.writer.dtdEntity(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.pEntity = function(name, value) {
            var node;
            this.openCurrent();
            node = new XMLDTDEntity(this, true, name, value);
            this.onData(this.writer.dtdEntity(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.notation = function(name, value) {
            var node;
            this.openCurrent();
            node = new XMLDTDNotation(this, name, value);
            this.onData(this.writer.dtdNotation(node, this.currentLevel + 1), this.currentLevel + 1);
            return this;
          };
          XMLDocumentCB2.prototype.up = function() {
            if (this.currentLevel < 0) {
              throw new Error("The document node has no parent.");
            }
            if (this.currentNode) {
              if (this.currentNode.children) {
                this.closeNode(this.currentNode);
              } else {
                this.openNode(this.currentNode);
              }
              this.currentNode = null;
            } else {
              this.closeNode(this.openTags[this.currentLevel]);
            }
            delete this.openTags[this.currentLevel];
            this.currentLevel--;
            return this;
          };
          XMLDocumentCB2.prototype.end = function() {
            while (this.currentLevel >= 0) {
              this.up();
            }
            return this.onEnd();
          };
          XMLDocumentCB2.prototype.openCurrent = function() {
            if (this.currentNode) {
              this.currentNode.children = true;
              return this.openNode(this.currentNode);
            }
          };
          XMLDocumentCB2.prototype.openNode = function(node) {
            if (!node.isOpen) {
              if (!this.root && this.currentLevel === 0 && node instanceof XMLElement) {
                this.root = node;
              }
              this.onData(this.writer.openNode(node, this.currentLevel), this.currentLevel);
              return node.isOpen = true;
            }
          };
          XMLDocumentCB2.prototype.closeNode = function(node) {
            if (!node.isClosed) {
              this.onData(this.writer.closeNode(node, this.currentLevel), this.currentLevel);
              return node.isClosed = true;
            }
          };
          XMLDocumentCB2.prototype.onData = function(chunk2, level) {
            this.documentStarted = true;
            return this.onDataCallback(chunk2, level + 1);
          };
          XMLDocumentCB2.prototype.onEnd = function() {
            this.documentCompleted = true;
            return this.onEndCallback();
          };
          XMLDocumentCB2.prototype.debugInfo = function(name) {
            if (name == null) {
              return "";
            } else {
              return "node: <" + name + ">";
            }
          };
          XMLDocumentCB2.prototype.ele = function() {
            return this.element.apply(this, arguments);
          };
          XMLDocumentCB2.prototype.nod = function(name, attributes, text) {
            return this.node(name, attributes, text);
          };
          XMLDocumentCB2.prototype.txt = function(value) {
            return this.text(value);
          };
          XMLDocumentCB2.prototype.dat = function(value) {
            return this.cdata(value);
          };
          XMLDocumentCB2.prototype.com = function(value) {
            return this.comment(value);
          };
          XMLDocumentCB2.prototype.ins = function(target, value) {
            return this.instruction(target, value);
          };
          XMLDocumentCB2.prototype.dec = function(version3, encoding, standalone) {
            return this.declaration(version3, encoding, standalone);
          };
          XMLDocumentCB2.prototype.dtd = function(root3, pubID, sysID) {
            return this.doctype(root3, pubID, sysID);
          };
          XMLDocumentCB2.prototype.e = function(name, attributes, text) {
            return this.element(name, attributes, text);
          };
          XMLDocumentCB2.prototype.n = function(name, attributes, text) {
            return this.node(name, attributes, text);
          };
          XMLDocumentCB2.prototype.t = function(value) {
            return this.text(value);
          };
          XMLDocumentCB2.prototype.d = function(value) {
            return this.cdata(value);
          };
          XMLDocumentCB2.prototype.c = function(value) {
            return this.comment(value);
          };
          XMLDocumentCB2.prototype.r = function(value) {
            return this.raw(value);
          };
          XMLDocumentCB2.prototype.i = function(target, value) {
            return this.instruction(target, value);
          };
          XMLDocumentCB2.prototype.att = function() {
            if (this.currentNode && this.currentNode instanceof XMLDocType) {
              return this.attList.apply(this, arguments);
            } else {
              return this.attribute.apply(this, arguments);
            }
          };
          XMLDocumentCB2.prototype.a = function() {
            if (this.currentNode && this.currentNode instanceof XMLDocType) {
              return this.attList.apply(this, arguments);
            } else {
              return this.attribute.apply(this, arguments);
            }
          };
          XMLDocumentCB2.prototype.ent = function(name, value) {
            return this.entity(name, value);
          };
          XMLDocumentCB2.prototype.pent = function(name, value) {
            return this.pEntity(name, value);
          };
          XMLDocumentCB2.prototype.not = function(name, value) {
            return this.notation(name, value);
          };
          return XMLDocumentCB2;
        })();
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/XMLStreamWriter.js
  var require_XMLStreamWriter = __commonJS({
    "node_modules/xmlbuilder/lib/XMLStreamWriter.js"(exports2, module2) {
      (function() {
        var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase, extend2 = function(child, parent) {
          for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
          }
          function ctor2() {
            this.constructor = child;
          }
          ctor2.prototype = parent.prototype;
          child.prototype = new ctor2();
          child.__super__ = parent.prototype;
          return child;
        }, hasProp = {}.hasOwnProperty;
        XMLDeclaration = require_XMLDeclaration();
        XMLDocType = require_XMLDocType();
        XMLCData = require_XMLCData();
        XMLComment = require_XMLComment();
        XMLElement = require_XMLElement();
        XMLRaw = require_XMLRaw();
        XMLText = require_XMLText();
        XMLProcessingInstruction = require_XMLProcessingInstruction();
        XMLDummy = require_XMLDummy();
        XMLDTDAttList = require_XMLDTDAttList();
        XMLDTDElement = require_XMLDTDElement();
        XMLDTDEntity = require_XMLDTDEntity();
        XMLDTDNotation = require_XMLDTDNotation();
        XMLWriterBase = require_XMLWriterBase();
        module2.exports = XMLStreamWriter = (function(superClass) {
          extend2(XMLStreamWriter2, superClass);
          function XMLStreamWriter2(stream, options) {
            XMLStreamWriter2.__super__.constructor.call(this, options);
            this.stream = stream;
          }
          XMLStreamWriter2.prototype.document = function(doc) {
            var child, i, j, len, len1, ref, ref1, results;
            ref = doc.children;
            for (i = 0, len = ref.length; i < len; i++) {
              child = ref[i];
              child.isLastRootNode = false;
            }
            doc.children[doc.children.length - 1].isLastRootNode = true;
            ref1 = doc.children;
            results = [];
            for (j = 0, len1 = ref1.length; j < len1; j++) {
              child = ref1[j];
              if (child instanceof XMLDummy) {
                continue;
              }
              switch (false) {
                case !(child instanceof XMLDeclaration):
                  results.push(this.declaration(child));
                  break;
                case !(child instanceof XMLDocType):
                  results.push(this.docType(child));
                  break;
                case !(child instanceof XMLComment):
                  results.push(this.comment(child));
                  break;
                case !(child instanceof XMLProcessingInstruction):
                  results.push(this.processingInstruction(child));
                  break;
                default:
                  results.push(this.element(child));
              }
            }
            return results;
          };
          XMLStreamWriter2.prototype.attribute = function(att) {
            return this.stream.write(" " + att.name + '="' + att.value + '"');
          };
          XMLStreamWriter2.prototype.cdata = function(node, level) {
            return this.stream.write(this.space(level) + "<![CDATA[" + node.text + "]]>" + this.endline(node));
          };
          XMLStreamWriter2.prototype.comment = function(node, level) {
            return this.stream.write(this.space(level) + "<!-- " + node.text + " -->" + this.endline(node));
          };
          XMLStreamWriter2.prototype.declaration = function(node, level) {
            this.stream.write(this.space(level));
            this.stream.write('<?xml version="' + node.version + '"');
            if (node.encoding != null) {
              this.stream.write(' encoding="' + node.encoding + '"');
            }
            if (node.standalone != null) {
              this.stream.write(' standalone="' + node.standalone + '"');
            }
            this.stream.write(this.spacebeforeslash + "?>");
            return this.stream.write(this.endline(node));
          };
          XMLStreamWriter2.prototype.docType = function(node, level) {
            var child, i, len, ref;
            level || (level = 0);
            this.stream.write(this.space(level));
            this.stream.write("<!DOCTYPE " + node.root().name);
            if (node.pubID && node.sysID) {
              this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
            } else if (node.sysID) {
              this.stream.write(' SYSTEM "' + node.sysID + '"');
            }
            if (node.children.length > 0) {
              this.stream.write(" [");
              this.stream.write(this.endline(node));
              ref = node.children;
              for (i = 0, len = ref.length; i < len; i++) {
                child = ref[i];
                switch (false) {
                  case !(child instanceof XMLDTDAttList):
                    this.dtdAttList(child, level + 1);
                    break;
                  case !(child instanceof XMLDTDElement):
                    this.dtdElement(child, level + 1);
                    break;
                  case !(child instanceof XMLDTDEntity):
                    this.dtdEntity(child, level + 1);
                    break;
                  case !(child instanceof XMLDTDNotation):
                    this.dtdNotation(child, level + 1);
                    break;
                  case !(child instanceof XMLCData):
                    this.cdata(child, level + 1);
                    break;
                  case !(child instanceof XMLComment):
                    this.comment(child, level + 1);
                    break;
                  case !(child instanceof XMLProcessingInstruction):
                    this.processingInstruction(child, level + 1);
                    break;
                  default:
                    throw new Error("Unknown DTD node type: " + child.constructor.name);
                }
              }
              this.stream.write("]");
            }
            this.stream.write(this.spacebeforeslash + ">");
            return this.stream.write(this.endline(node));
          };
          XMLStreamWriter2.prototype.element = function(node, level) {
            var att, child, i, len, name, ref, ref1, space;
            level || (level = 0);
            space = this.space(level);
            this.stream.write(space + "<" + node.name);
            ref = node.attributes;
            for (name in ref) {
              if (!hasProp.call(ref, name)) continue;
              att = ref[name];
              this.attribute(att);
            }
            if (node.children.length === 0 || node.children.every(function(e) {
              return e.value === "";
            })) {
              if (this.allowEmpty) {
                this.stream.write("></" + node.name + ">");
              } else {
                this.stream.write(this.spacebeforeslash + "/>");
              }
            } else if (this.pretty && node.children.length === 1 && node.children[0].value != null) {
              this.stream.write(">");
              this.stream.write(node.children[0].value);
              this.stream.write("</" + node.name + ">");
            } else {
              this.stream.write(">" + this.newline);
              ref1 = node.children;
              for (i = 0, len = ref1.length; i < len; i++) {
                child = ref1[i];
                switch (false) {
                  case !(child instanceof XMLCData):
                    this.cdata(child, level + 1);
                    break;
                  case !(child instanceof XMLComment):
                    this.comment(child, level + 1);
                    break;
                  case !(child instanceof XMLElement):
                    this.element(child, level + 1);
                    break;
                  case !(child instanceof XMLRaw):
                    this.raw(child, level + 1);
                    break;
                  case !(child instanceof XMLText):
                    this.text(child, level + 1);
                    break;
                  case !(child instanceof XMLProcessingInstruction):
                    this.processingInstruction(child, level + 1);
                    break;
                  case !(child instanceof XMLDummy):
                    "";
                    break;
                  default:
                    throw new Error("Unknown XML node type: " + child.constructor.name);
                }
              }
              this.stream.write(space + "</" + node.name + ">");
            }
            return this.stream.write(this.endline(node));
          };
          XMLStreamWriter2.prototype.processingInstruction = function(node, level) {
            this.stream.write(this.space(level) + "<?" + node.target);
            if (node.value) {
              this.stream.write(" " + node.value);
            }
            return this.stream.write(this.spacebeforeslash + "?>" + this.endline(node));
          };
          XMLStreamWriter2.prototype.raw = function(node, level) {
            return this.stream.write(this.space(level) + node.value + this.endline(node));
          };
          XMLStreamWriter2.prototype.text = function(node, level) {
            return this.stream.write(this.space(level) + node.value + this.endline(node));
          };
          XMLStreamWriter2.prototype.dtdAttList = function(node, level) {
            this.stream.write(this.space(level) + "<!ATTLIST " + node.elementName + " " + node.attributeName + " " + node.attributeType);
            if (node.defaultValueType !== "#DEFAULT") {
              this.stream.write(" " + node.defaultValueType);
            }
            if (node.defaultValue) {
              this.stream.write(' "' + node.defaultValue + '"');
            }
            return this.stream.write(this.spacebeforeslash + ">" + this.endline(node));
          };
          XMLStreamWriter2.prototype.dtdElement = function(node, level) {
            this.stream.write(this.space(level) + "<!ELEMENT " + node.name + " " + node.value);
            return this.stream.write(this.spacebeforeslash + ">" + this.endline(node));
          };
          XMLStreamWriter2.prototype.dtdEntity = function(node, level) {
            this.stream.write(this.space(level) + "<!ENTITY");
            if (node.pe) {
              this.stream.write(" %");
            }
            this.stream.write(" " + node.name);
            if (node.value) {
              this.stream.write(' "' + node.value + '"');
            } else {
              if (node.pubID && node.sysID) {
                this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
              } else if (node.sysID) {
                this.stream.write(' SYSTEM "' + node.sysID + '"');
              }
              if (node.nData) {
                this.stream.write(" NDATA " + node.nData);
              }
            }
            return this.stream.write(this.spacebeforeslash + ">" + this.endline(node));
          };
          XMLStreamWriter2.prototype.dtdNotation = function(node, level) {
            this.stream.write(this.space(level) + "<!NOTATION " + node.name);
            if (node.pubID && node.sysID) {
              this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
            } else if (node.pubID) {
              this.stream.write(' PUBLIC "' + node.pubID + '"');
            } else if (node.sysID) {
              this.stream.write(' SYSTEM "' + node.sysID + '"');
            }
            return this.stream.write(this.spacebeforeslash + ">" + this.endline(node));
          };
          XMLStreamWriter2.prototype.endline = function(node) {
            if (!node.isLastRootNode) {
              return this.newline;
            } else {
              return "";
            }
          };
          return XMLStreamWriter2;
        })(XMLWriterBase);
      }).call(exports2);
    }
  });

  // node_modules/xmlbuilder/lib/index.js
  var require_lib2 = __commonJS({
    "node_modules/xmlbuilder/lib/index.js"(exports2, module2) {
      (function() {
        var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction2, ref;
        ref = require_Utility(), assign = ref.assign, isFunction2 = ref.isFunction;
        XMLDocument = require_XMLDocument();
        XMLDocumentCB = require_XMLDocumentCB();
        XMLStringWriter = require_XMLStringWriter();
        XMLStreamWriter = require_XMLStreamWriter();
        module2.exports.create = function(name, xmldec, doctype, options) {
          var doc, root3;
          if (name == null) {
            throw new Error("Root element needs a name.");
          }
          options = assign({}, xmldec, doctype, options);
          doc = new XMLDocument(options);
          root3 = doc.element(name);
          if (!options.headless) {
            doc.declaration(options);
            if (options.pubID != null || options.sysID != null) {
              doc.doctype(options);
            }
          }
          return root3;
        };
        module2.exports.begin = function(options, onData, onEnd) {
          var ref1;
          if (isFunction2(options)) {
            ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
            options = {};
          }
          if (onData) {
            return new XMLDocumentCB(options, onData, onEnd);
          } else {
            return new XMLDocument(options);
          }
        };
        module2.exports.stringWriter = function(options) {
          return new XMLStringWriter(options);
        };
        module2.exports.streamWriter = function(stream, options) {
          return new XMLStreamWriter(stream, options);
        };
      }).call(exports2);
    }
  });

  // node_modules/mammoth/lib/xml/writer.js
  var require_writer = __commonJS({
    "node_modules/mammoth/lib/xml/writer.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var xmlbuilder = require_lib2();
      exports2.writeString = writeString;
      function writeString(root3, namespaces) {
        var uriToPrefix = _3.invert(namespaces);
        var nodeWriters = {
          element: writeElement,
          text: writeTextNode
        };
        function writeNode(builder, node) {
          return nodeWriters[node.type](builder, node);
        }
        function writeElement(builder, element) {
          var elementBuilder = builder.element(mapElementName(element.name), element.attributes);
          element.children.forEach(function(child) {
            writeNode(elementBuilder, child);
          });
        }
        function mapElementName(name) {
          var longFormMatch = /^\{(.*)\}(.*)$/.exec(name);
          if (longFormMatch) {
            var prefix = uriToPrefix[longFormMatch[1]];
            return prefix + (prefix === "" ? "" : ":") + longFormMatch[2];
          } else {
            return name;
          }
        }
        function writeDocument(root4) {
          var builder = xmlbuilder.create(mapElementName(root4.name), {
            version: "1.0",
            encoding: "UTF-8",
            standalone: true
          });
          _3.forEach(namespaces, function(uri, prefix) {
            var key = "xmlns" + (prefix === "" ? "" : ":" + prefix);
            builder.attribute(key, uri);
          });
          root4.children.forEach(function(child) {
            writeNode(builder, child);
          });
          return builder.end();
        }
        return writeDocument(root3);
      }
      function writeTextNode(builder, node) {
        builder.text(node.value);
      }
    }
  });

  // node_modules/mammoth/lib/xml/index.js
  var require_xml = __commonJS({
    "node_modules/mammoth/lib/xml/index.js"(exports2) {
      var nodes = require_nodes();
      exports2.Element = nodes.Element;
      exports2.element = nodes.element;
      exports2.emptyElement = nodes.emptyElement;
      exports2.text = nodes.text;
      exports2.readString = require_reader().readString;
      exports2.writeString = require_writer().writeString;
    }
  });

  // node_modules/mammoth/lib/docx/office-xml-reader.js
  var require_office_xml_reader = __commonJS({
    "node_modules/mammoth/lib/docx/office-xml-reader.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var promises = require_promises();
      var xml = require_xml();
      exports2.read = read;
      exports2.readXmlFromZipFile = readXmlFromZipFile;
      var xmlNamespaceMap = {
        // Transitional format
        "http://schemas.openxmlformats.org/wordprocessingml/2006/main": "w",
        "http://schemas.openxmlformats.org/officeDocument/2006/relationships": "r",
        "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing": "wp",
        "http://schemas.openxmlformats.org/drawingml/2006/main": "a",
        "http://schemas.openxmlformats.org/drawingml/2006/picture": "pic",
        // Strict format
        "http://purl.oclc.org/ooxml/wordprocessingml/main": "w",
        "http://purl.oclc.org/ooxml/officeDocument/relationships": "r",
        "http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing": "wp",
        "http://purl.oclc.org/ooxml/drawingml/main": "a",
        "http://purl.oclc.org/ooxml/drawingml/picture": "pic",
        // Common
        "http://schemas.openxmlformats.org/package/2006/content-types": "content-types",
        "http://schemas.openxmlformats.org/package/2006/relationships": "relationships",
        "http://schemas.openxmlformats.org/markup-compatibility/2006": "mc",
        "urn:schemas-microsoft-com:vml": "v",
        "urn:schemas-microsoft-com:office:word": "office-word",
        // [MS-DOCX]: Word Extensions to the Office Open XML (.docx) File Format
        // https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b839fe1f-e1ca-4fa6-8c26-5954d0abbccd
        "http://schemas.microsoft.com/office/word/2010/wordml": "wordml"
      };
      function read(xmlString) {
        return xml.readString(xmlString, xmlNamespaceMap).then(function(document2) {
          return collapseAlternateContent(document2)[0];
        });
      }
      function readXmlFromZipFile(docxFile, path) {
        if (docxFile.exists(path)) {
          return docxFile.read(path, "utf-8").then(stripUtf8Bom).then(read);
        } else {
          return promises.resolve(null);
        }
      }
      function stripUtf8Bom(xmlString) {
        return xmlString.replace(/^\uFEFF/g, "");
      }
      function collapseAlternateContent(node) {
        if (node.type === "element") {
          if (node.name === "mc:AlternateContent") {
            return node.firstOrEmpty("mc:Fallback").children;
          } else {
            node.children = _3.flatten(node.children.map(collapseAlternateContent, true));
            return [node];
          }
        } else {
          return [node];
        }
      }
    }
  });

  // node_modules/dingbat-to-unicode/dist/dingbats.js
  var require_dingbats = __commonJS({
    "node_modules/dingbat-to-unicode/dist/dingbats.js"(exports2) {
      "use strict";
      Object.defineProperty(exports2, "__esModule", { value: true });
      var dingbats = [
        { "Typeface name": "Symbol", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
        { "Typeface name": "Symbol", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "33", "Unicode hex": "21" },
        { "Typeface name": "Symbol", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "8704", "Unicode hex": "2200" },
        { "Typeface name": "Symbol", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "35", "Unicode hex": "23" },
        { "Typeface name": "Symbol", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "8707", "Unicode hex": "2203" },
        { "Typeface name": "Symbol", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "37", "Unicode hex": "25" },
        { "Typeface name": "Symbol", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "38", "Unicode hex": "26" },
        { "Typeface name": "Symbol", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "8717", "Unicode hex": "220D" },
        { "Typeface name": "Symbol", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "40", "Unicode hex": "28" },
        { "Typeface name": "Symbol", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "41", "Unicode hex": "29" },
        { "Typeface name": "Symbol", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "42", "Unicode hex": "2A" },
        { "Typeface name": "Symbol", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "43", "Unicode hex": "2B" },
        { "Typeface name": "Symbol", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "44", "Unicode hex": "2C" },
        { "Typeface name": "Symbol", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "8722", "Unicode hex": "2212" },
        { "Typeface name": "Symbol", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "46", "Unicode hex": "2E" },
        { "Typeface name": "Symbol", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "47", "Unicode hex": "2F" },
        { "Typeface name": "Symbol", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "48", "Unicode hex": "30" },
        { "Typeface name": "Symbol", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "49", "Unicode hex": "31" },
        { "Typeface name": "Symbol", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "50", "Unicode hex": "32" },
        { "Typeface name": "Symbol", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "51", "Unicode hex": "33" },
        { "Typeface name": "Symbol", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "52", "Unicode hex": "34" },
        { "Typeface name": "Symbol", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "53", "Unicode hex": "35" },
        { "Typeface name": "Symbol", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "54", "Unicode hex": "36" },
        { "Typeface name": "Symbol", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "55", "Unicode hex": "37" },
        { "Typeface name": "Symbol", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "56", "Unicode hex": "38" },
        { "Typeface name": "Symbol", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "57", "Unicode hex": "39" },
        { "Typeface name": "Symbol", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "58", "Unicode hex": "3A" },
        { "Typeface name": "Symbol", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "59", "Unicode hex": "3B" },
        { "Typeface name": "Symbol", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "60", "Unicode hex": "3C" },
        { "Typeface name": "Symbol", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "61", "Unicode hex": "3D" },
        { "Typeface name": "Symbol", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "62", "Unicode hex": "3E" },
        { "Typeface name": "Symbol", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "63", "Unicode hex": "3F" },
        { "Typeface name": "Symbol", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "8773", "Unicode hex": "2245" },
        { "Typeface name": "Symbol", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "913", "Unicode hex": "391" },
        { "Typeface name": "Symbol", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "914", "Unicode hex": "392" },
        { "Typeface name": "Symbol", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "935", "Unicode hex": "3A7" },
        { "Typeface name": "Symbol", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "916", "Unicode hex": "394" },
        { "Typeface name": "Symbol", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "917", "Unicode hex": "395" },
        { "Typeface name": "Symbol", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "934", "Unicode hex": "3A6" },
        { "Typeface name": "Symbol", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "915", "Unicode hex": "393" },
        { "Typeface name": "Symbol", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "919", "Unicode hex": "397" },
        { "Typeface name": "Symbol", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "921", "Unicode hex": "399" },
        { "Typeface name": "Symbol", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "977", "Unicode hex": "3D1" },
        { "Typeface name": "Symbol", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "922", "Unicode hex": "39A" },
        { "Typeface name": "Symbol", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "923", "Unicode hex": "39B" },
        { "Typeface name": "Symbol", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "924", "Unicode hex": "39C" },
        { "Typeface name": "Symbol", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "925", "Unicode hex": "39D" },
        { "Typeface name": "Symbol", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "927", "Unicode hex": "39F" },
        { "Typeface name": "Symbol", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "928", "Unicode hex": "3A0" },
        { "Typeface name": "Symbol", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "920", "Unicode hex": "398" },
        { "Typeface name": "Symbol", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "929", "Unicode hex": "3A1" },
        { "Typeface name": "Symbol", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "931", "Unicode hex": "3A3" },
        { "Typeface name": "Symbol", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "932", "Unicode hex": "3A4" },
        { "Typeface name": "Symbol", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "933", "Unicode hex": "3A5" },
        { "Typeface name": "Symbol", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "962", "Unicode hex": "3C2" },
        { "Typeface name": "Symbol", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "937", "Unicode hex": "3A9" },
        { "Typeface name": "Symbol", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "926", "Unicode hex": "39E" },
        { "Typeface name": "Symbol", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "936", "Unicode hex": "3A8" },
        { "Typeface name": "Symbol", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "918", "Unicode hex": "396" },
        { "Typeface name": "Symbol", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "91", "Unicode hex": "5B" },
        { "Typeface name": "Symbol", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "8756", "Unicode hex": "2234" },
        { "Typeface name": "Symbol", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "93", "Unicode hex": "5D" },
        { "Typeface name": "Symbol", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "8869", "Unicode hex": "22A5" },
        { "Typeface name": "Symbol", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "95", "Unicode hex": "5F" },
        { "Typeface name": "Symbol", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "8254", "Unicode hex": "203E" },
        { "Typeface name": "Symbol", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "945", "Unicode hex": "3B1" },
        { "Typeface name": "Symbol", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "946", "Unicode hex": "3B2" },
        { "Typeface name": "Symbol", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "967", "Unicode hex": "3C7" },
        { "Typeface name": "Symbol", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "948", "Unicode hex": "3B4" },
        { "Typeface name": "Symbol", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "949", "Unicode hex": "3B5" },
        { "Typeface name": "Symbol", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "966", "Unicode hex": "3C6" },
        { "Typeface name": "Symbol", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "947", "Unicode hex": "3B3" },
        { "Typeface name": "Symbol", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "951", "Unicode hex": "3B7" },
        { "Typeface name": "Symbol", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "953", "Unicode hex": "3B9" },
        { "Typeface name": "Symbol", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "981", "Unicode hex": "3D5" },
        { "Typeface name": "Symbol", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "954", "Unicode hex": "3BA" },
        { "Typeface name": "Symbol", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "955", "Unicode hex": "3BB" },
        { "Typeface name": "Symbol", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "956", "Unicode hex": "3BC" },
        { "Typeface name": "Symbol", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "957", "Unicode hex": "3BD" },
        { "Typeface name": "Symbol", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "959", "Unicode hex": "3BF" },
        { "Typeface name": "Symbol", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "960", "Unicode hex": "3C0" },
        { "Typeface name": "Symbol", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "952", "Unicode hex": "3B8" },
        { "Typeface name": "Symbol", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "961", "Unicode hex": "3C1" },
        { "Typeface name": "Symbol", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "963", "Unicode hex": "3C3" },
        { "Typeface name": "Symbol", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "964", "Unicode hex": "3C4" },
        { "Typeface name": "Symbol", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "965", "Unicode hex": "3C5" },
        { "Typeface name": "Symbol", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "982", "Unicode hex": "3D6" },
        { "Typeface name": "Symbol", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "969", "Unicode hex": "3C9" },
        { "Typeface name": "Symbol", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "958", "Unicode hex": "3BE" },
        { "Typeface name": "Symbol", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "968", "Unicode hex": "3C8" },
        { "Typeface name": "Symbol", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "950", "Unicode hex": "3B6" },
        { "Typeface name": "Symbol", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "123", "Unicode hex": "7B" },
        { "Typeface name": "Symbol", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "124", "Unicode hex": "7C" },
        { "Typeface name": "Symbol", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "125", "Unicode hex": "7D" },
        { "Typeface name": "Symbol", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "126", "Unicode hex": "7E" },
        { "Typeface name": "Symbol", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "8364", "Unicode hex": "20AC" },
        { "Typeface name": "Symbol", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "978", "Unicode hex": "3D2" },
        { "Typeface name": "Symbol", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "8242", "Unicode hex": "2032" },
        { "Typeface name": "Symbol", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "8804", "Unicode hex": "2264" },
        { "Typeface name": "Symbol", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "8260", "Unicode hex": "2044" },
        { "Typeface name": "Symbol", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "8734", "Unicode hex": "221E" },
        { "Typeface name": "Symbol", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "402", "Unicode hex": "192" },
        { "Typeface name": "Symbol", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "9827", "Unicode hex": "2663" },
        { "Typeface name": "Symbol", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "9830", "Unicode hex": "2666" },
        { "Typeface name": "Symbol", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "9829", "Unicode hex": "2665" },
        { "Typeface name": "Symbol", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "9824", "Unicode hex": "2660" },
        { "Typeface name": "Symbol", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "8596", "Unicode hex": "2194" },
        { "Typeface name": "Symbol", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "8592", "Unicode hex": "2190" },
        { "Typeface name": "Symbol", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "8593", "Unicode hex": "2191" },
        { "Typeface name": "Symbol", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "8594", "Unicode hex": "2192" },
        { "Typeface name": "Symbol", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "8595", "Unicode hex": "2193" },
        { "Typeface name": "Symbol", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "176", "Unicode hex": "B0" },
        { "Typeface name": "Symbol", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "177", "Unicode hex": "B1" },
        { "Typeface name": "Symbol", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "8243", "Unicode hex": "2033" },
        { "Typeface name": "Symbol", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "8805", "Unicode hex": "2265" },
        { "Typeface name": "Symbol", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "215", "Unicode hex": "D7" },
        { "Typeface name": "Symbol", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "8733", "Unicode hex": "221D" },
        { "Typeface name": "Symbol", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "8706", "Unicode hex": "2202" },
        { "Typeface name": "Symbol", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "8226", "Unicode hex": "2022" },
        { "Typeface name": "Symbol", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "247", "Unicode hex": "F7" },
        { "Typeface name": "Symbol", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "8800", "Unicode hex": "2260" },
        { "Typeface name": "Symbol", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "8801", "Unicode hex": "2261" },
        { "Typeface name": "Symbol", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "8776", "Unicode hex": "2248" },
        { "Typeface name": "Symbol", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "8230", "Unicode hex": "2026" },
        { "Typeface name": "Symbol", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "9168", "Unicode hex": "23D0" },
        { "Typeface name": "Symbol", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "9135", "Unicode hex": "23AF" },
        { "Typeface name": "Symbol", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "8629", "Unicode hex": "21B5" },
        { "Typeface name": "Symbol", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "8501", "Unicode hex": "2135" },
        { "Typeface name": "Symbol", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "8465", "Unicode hex": "2111" },
        { "Typeface name": "Symbol", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "8476", "Unicode hex": "211C" },
        { "Typeface name": "Symbol", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "8472", "Unicode hex": "2118" },
        { "Typeface name": "Symbol", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "8855", "Unicode hex": "2297" },
        { "Typeface name": "Symbol", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "8853", "Unicode hex": "2295" },
        { "Typeface name": "Symbol", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "8709", "Unicode hex": "2205" },
        { "Typeface name": "Symbol", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "8745", "Unicode hex": "2229" },
        { "Typeface name": "Symbol", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "8746", "Unicode hex": "222A" },
        { "Typeface name": "Symbol", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "8835", "Unicode hex": "2283" },
        { "Typeface name": "Symbol", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "8839", "Unicode hex": "2287" },
        { "Typeface name": "Symbol", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "8836", "Unicode hex": "2284" },
        { "Typeface name": "Symbol", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "8834", "Unicode hex": "2282" },
        { "Typeface name": "Symbol", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "8838", "Unicode hex": "2286" },
        { "Typeface name": "Symbol", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "8712", "Unicode hex": "2208" },
        { "Typeface name": "Symbol", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "8713", "Unicode hex": "2209" },
        { "Typeface name": "Symbol", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "8736", "Unicode hex": "2220" },
        { "Typeface name": "Symbol", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "8711", "Unicode hex": "2207" },
        { "Typeface name": "Symbol", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "174", "Unicode hex": "AE" },
        { "Typeface name": "Symbol", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "169", "Unicode hex": "A9" },
        { "Typeface name": "Symbol", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "8482", "Unicode hex": "2122" },
        { "Typeface name": "Symbol", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "8719", "Unicode hex": "220F" },
        { "Typeface name": "Symbol", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "8730", "Unicode hex": "221A" },
        { "Typeface name": "Symbol", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "8901", "Unicode hex": "22C5" },
        { "Typeface name": "Symbol", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "172", "Unicode hex": "AC" },
        { "Typeface name": "Symbol", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "8743", "Unicode hex": "2227" },
        { "Typeface name": "Symbol", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "8744", "Unicode hex": "2228" },
        { "Typeface name": "Symbol", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "8660", "Unicode hex": "21D4" },
        { "Typeface name": "Symbol", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "8656", "Unicode hex": "21D0" },
        { "Typeface name": "Symbol", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "8657", "Unicode hex": "21D1" },
        { "Typeface name": "Symbol", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "8658", "Unicode hex": "21D2" },
        { "Typeface name": "Symbol", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "8659", "Unicode hex": "21D3" },
        { "Typeface name": "Symbol", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "9674", "Unicode hex": "25CA" },
        { "Typeface name": "Symbol", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "12296", "Unicode hex": "3008" },
        { "Typeface name": "Symbol", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "174", "Unicode hex": "AE" },
        { "Typeface name": "Symbol", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "169", "Unicode hex": "A9" },
        { "Typeface name": "Symbol", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "8482", "Unicode hex": "2122" },
        { "Typeface name": "Symbol", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "8721", "Unicode hex": "2211" },
        { "Typeface name": "Symbol", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "9115", "Unicode hex": "239B" },
        { "Typeface name": "Symbol", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "9116", "Unicode hex": "239C" },
        { "Typeface name": "Symbol", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "9117", "Unicode hex": "239D" },
        { "Typeface name": "Symbol", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "9121", "Unicode hex": "23A1" },
        { "Typeface name": "Symbol", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "9122", "Unicode hex": "23A2" },
        { "Typeface name": "Symbol", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "9123", "Unicode hex": "23A3" },
        { "Typeface name": "Symbol", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "9127", "Unicode hex": "23A7" },
        { "Typeface name": "Symbol", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "9128", "Unicode hex": "23A8" },
        { "Typeface name": "Symbol", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "9129", "Unicode hex": "23A9" },
        { "Typeface name": "Symbol", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "9130", "Unicode hex": "23AA" },
        { "Typeface name": "Symbol", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "63743", "Unicode hex": "F8FF" },
        { "Typeface name": "Symbol", "Dingbat dec": "241", "Dingbat hex": "F1", "Unicode dec": "12297", "Unicode hex": "3009" },
        { "Typeface name": "Symbol", "Dingbat dec": "242", "Dingbat hex": "F2", "Unicode dec": "8747", "Unicode hex": "222B" },
        { "Typeface name": "Symbol", "Dingbat dec": "243", "Dingbat hex": "F3", "Unicode dec": "8992", "Unicode hex": "2320" },
        { "Typeface name": "Symbol", "Dingbat dec": "244", "Dingbat hex": "F4", "Unicode dec": "9134", "Unicode hex": "23AE" },
        { "Typeface name": "Symbol", "Dingbat dec": "245", "Dingbat hex": "F5", "Unicode dec": "8993", "Unicode hex": "2321" },
        { "Typeface name": "Symbol", "Dingbat dec": "246", "Dingbat hex": "F6", "Unicode dec": "9118", "Unicode hex": "239E" },
        { "Typeface name": "Symbol", "Dingbat dec": "247", "Dingbat hex": "F7", "Unicode dec": "9119", "Unicode hex": "239F" },
        { "Typeface name": "Symbol", "Dingbat dec": "248", "Dingbat hex": "F8", "Unicode dec": "9120", "Unicode hex": "23A0" },
        { "Typeface name": "Symbol", "Dingbat dec": "249", "Dingbat hex": "F9", "Unicode dec": "9124", "Unicode hex": "23A4" },
        { "Typeface name": "Symbol", "Dingbat dec": "250", "Dingbat hex": "FA", "Unicode dec": "9125", "Unicode hex": "23A5" },
        { "Typeface name": "Symbol", "Dingbat dec": "251", "Dingbat hex": "FB", "Unicode dec": "9126", "Unicode hex": "23A6" },
        { "Typeface name": "Symbol", "Dingbat dec": "252", "Dingbat hex": "FC", "Unicode dec": "9131", "Unicode hex": "23AB" },
        { "Typeface name": "Symbol", "Dingbat dec": "253", "Dingbat hex": "FD", "Unicode dec": "9132", "Unicode hex": "23AC" },
        { "Typeface name": "Symbol", "Dingbat dec": "254", "Dingbat hex": "FE", "Unicode dec": "9133", "Unicode hex": "23AD" },
        { "Typeface name": "Webdings", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
        { "Typeface name": "Webdings", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "128375", "Unicode hex": "1F577" },
        { "Typeface name": "Webdings", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "128376", "Unicode hex": "1F578" },
        { "Typeface name": "Webdings", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "128370", "Unicode hex": "1F572" },
        { "Typeface name": "Webdings", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "128374", "Unicode hex": "1F576" },
        { "Typeface name": "Webdings", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "127942", "Unicode hex": "1F3C6" },
        { "Typeface name": "Webdings", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "127894", "Unicode hex": "1F396" },
        { "Typeface name": "Webdings", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "128391", "Unicode hex": "1F587" },
        { "Typeface name": "Webdings", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "128488", "Unicode hex": "1F5E8" },
        { "Typeface name": "Webdings", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "128489", "Unicode hex": "1F5E9" },
        { "Typeface name": "Webdings", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "128496", "Unicode hex": "1F5F0" },
        { "Typeface name": "Webdings", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "128497", "Unicode hex": "1F5F1" },
        { "Typeface name": "Webdings", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "127798", "Unicode hex": "1F336" },
        { "Typeface name": "Webdings", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "127895", "Unicode hex": "1F397" },
        { "Typeface name": "Webdings", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "128638", "Unicode hex": "1F67E" },
        { "Typeface name": "Webdings", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "128636", "Unicode hex": "1F67C" },
        { "Typeface name": "Webdings", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "128469", "Unicode hex": "1F5D5" },
        { "Typeface name": "Webdings", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "128470", "Unicode hex": "1F5D6" },
        { "Typeface name": "Webdings", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "128471", "Unicode hex": "1F5D7" },
        { "Typeface name": "Webdings", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "9204", "Unicode hex": "23F4" },
        { "Typeface name": "Webdings", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "9205", "Unicode hex": "23F5" },
        { "Typeface name": "Webdings", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "9206", "Unicode hex": "23F6" },
        { "Typeface name": "Webdings", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "9207", "Unicode hex": "23F7" },
        { "Typeface name": "Webdings", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "9194", "Unicode hex": "23EA" },
        { "Typeface name": "Webdings", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "9193", "Unicode hex": "23E9" },
        { "Typeface name": "Webdings", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "9198", "Unicode hex": "23EE" },
        { "Typeface name": "Webdings", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "9197", "Unicode hex": "23ED" },
        { "Typeface name": "Webdings", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "9208", "Unicode hex": "23F8" },
        { "Typeface name": "Webdings", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "9209", "Unicode hex": "23F9" },
        { "Typeface name": "Webdings", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "9210", "Unicode hex": "23FA" },
        { "Typeface name": "Webdings", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "128474", "Unicode hex": "1F5DA" },
        { "Typeface name": "Webdings", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "128499", "Unicode hex": "1F5F3" },
        { "Typeface name": "Webdings", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "128736", "Unicode hex": "1F6E0" },
        { "Typeface name": "Webdings", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "127959", "Unicode hex": "1F3D7" },
        { "Typeface name": "Webdings", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "127960", "Unicode hex": "1F3D8" },
        { "Typeface name": "Webdings", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "127961", "Unicode hex": "1F3D9" },
        { "Typeface name": "Webdings", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "127962", "Unicode hex": "1F3DA" },
        { "Typeface name": "Webdings", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "127964", "Unicode hex": "1F3DC" },
        { "Typeface name": "Webdings", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "127981", "Unicode hex": "1F3ED" },
        { "Typeface name": "Webdings", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "127963", "Unicode hex": "1F3DB" },
        { "Typeface name": "Webdings", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "127968", "Unicode hex": "1F3E0" },
        { "Typeface name": "Webdings", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "127958", "Unicode hex": "1F3D6" },
        { "Typeface name": "Webdings", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "127965", "Unicode hex": "1F3DD" },
        { "Typeface name": "Webdings", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "128739", "Unicode hex": "1F6E3" },
        { "Typeface name": "Webdings", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "128269", "Unicode hex": "1F50D" },
        { "Typeface name": "Webdings", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "127956", "Unicode hex": "1F3D4" },
        { "Typeface name": "Webdings", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "128065", "Unicode hex": "1F441" },
        { "Typeface name": "Webdings", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "128066", "Unicode hex": "1F442" },
        { "Typeface name": "Webdings", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "127966", "Unicode hex": "1F3DE" },
        { "Typeface name": "Webdings", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "127957", "Unicode hex": "1F3D5" },
        { "Typeface name": "Webdings", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "128740", "Unicode hex": "1F6E4" },
        { "Typeface name": "Webdings", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "127967", "Unicode hex": "1F3DF" },
        { "Typeface name": "Webdings", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "128755", "Unicode hex": "1F6F3" },
        { "Typeface name": "Webdings", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "128364", "Unicode hex": "1F56C" },
        { "Typeface name": "Webdings", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "128363", "Unicode hex": "1F56B" },
        { "Typeface name": "Webdings", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "128360", "Unicode hex": "1F568" },
        { "Typeface name": "Webdings", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "128264", "Unicode hex": "1F508" },
        { "Typeface name": "Webdings", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "127892", "Unicode hex": "1F394" },
        { "Typeface name": "Webdings", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "127893", "Unicode hex": "1F395" },
        { "Typeface name": "Webdings", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "128492", "Unicode hex": "1F5EC" },
        { "Typeface name": "Webdings", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "128637", "Unicode hex": "1F67D" },
        { "Typeface name": "Webdings", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "128493", "Unicode hex": "1F5ED" },
        { "Typeface name": "Webdings", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "128490", "Unicode hex": "1F5EA" },
        { "Typeface name": "Webdings", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "128491", "Unicode hex": "1F5EB" },
        { "Typeface name": "Webdings", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "11156", "Unicode hex": "2B94" },
        { "Typeface name": "Webdings", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "10004", "Unicode hex": "2714" },
        { "Typeface name": "Webdings", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "128690", "Unicode hex": "1F6B2" },
        { "Typeface name": "Webdings", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "11036", "Unicode hex": "2B1C" },
        { "Typeface name": "Webdings", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "128737", "Unicode hex": "1F6E1" },
        { "Typeface name": "Webdings", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "128230", "Unicode hex": "1F4E6" },
        { "Typeface name": "Webdings", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "128753", "Unicode hex": "1F6F1" },
        { "Typeface name": "Webdings", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "11035", "Unicode hex": "2B1B" },
        { "Typeface name": "Webdings", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "128657", "Unicode hex": "1F691" },
        { "Typeface name": "Webdings", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "128712", "Unicode hex": "1F6C8" },
        { "Typeface name": "Webdings", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "128745", "Unicode hex": "1F6E9" },
        { "Typeface name": "Webdings", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "128752", "Unicode hex": "1F6F0" },
        { "Typeface name": "Webdings", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "128968", "Unicode hex": "1F7C8" },
        { "Typeface name": "Webdings", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "128372", "Unicode hex": "1F574" },
        { "Typeface name": "Webdings", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "11044", "Unicode hex": "2B24" },
        { "Typeface name": "Webdings", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "128741", "Unicode hex": "1F6E5" },
        { "Typeface name": "Webdings", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "128660", "Unicode hex": "1F694" },
        { "Typeface name": "Webdings", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "128472", "Unicode hex": "1F5D8" },
        { "Typeface name": "Webdings", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "128473", "Unicode hex": "1F5D9" },
        { "Typeface name": "Webdings", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "10067", "Unicode hex": "2753" },
        { "Typeface name": "Webdings", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "128754", "Unicode hex": "1F6F2" },
        { "Typeface name": "Webdings", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "128647", "Unicode hex": "1F687" },
        { "Typeface name": "Webdings", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "128653", "Unicode hex": "1F68D" },
        { "Typeface name": "Webdings", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "9971", "Unicode hex": "26F3" },
        { "Typeface name": "Webdings", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "10680", "Unicode hex": "29B8" },
        { "Typeface name": "Webdings", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "8854", "Unicode hex": "2296" },
        { "Typeface name": "Webdings", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "128685", "Unicode hex": "1F6AD" },
        { "Typeface name": "Webdings", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "128494", "Unicode hex": "1F5EE" },
        { "Typeface name": "Webdings", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "9168", "Unicode hex": "23D0" },
        { "Typeface name": "Webdings", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "128495", "Unicode hex": "1F5EF" },
        { "Typeface name": "Webdings", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "128498", "Unicode hex": "1F5F2" },
        { "Typeface name": "Webdings", "Dingbat dec": "128", "Dingbat hex": "80", "Unicode dec": "128697", "Unicode hex": "1F6B9" },
        { "Typeface name": "Webdings", "Dingbat dec": "129", "Dingbat hex": "81", "Unicode dec": "128698", "Unicode hex": "1F6BA" },
        { "Typeface name": "Webdings", "Dingbat dec": "130", "Dingbat hex": "82", "Unicode dec": "128713", "Unicode hex": "1F6C9" },
        { "Typeface name": "Webdings", "Dingbat dec": "131", "Dingbat hex": "83", "Unicode dec": "128714", "Unicode hex": "1F6CA" },
        { "Typeface name": "Webdings", "Dingbat dec": "132", "Dingbat hex": "84", "Unicode dec": "128700", "Unicode hex": "1F6BC" },
        { "Typeface name": "Webdings", "Dingbat dec": "133", "Dingbat hex": "85", "Unicode dec": "128125", "Unicode hex": "1F47D" },
        { "Typeface name": "Webdings", "Dingbat dec": "134", "Dingbat hex": "86", "Unicode dec": "127947", "Unicode hex": "1F3CB" },
        { "Typeface name": "Webdings", "Dingbat dec": "135", "Dingbat hex": "87", "Unicode dec": "9975", "Unicode hex": "26F7" },
        { "Typeface name": "Webdings", "Dingbat dec": "136", "Dingbat hex": "88", "Unicode dec": "127938", "Unicode hex": "1F3C2" },
        { "Typeface name": "Webdings", "Dingbat dec": "137", "Dingbat hex": "89", "Unicode dec": "127948", "Unicode hex": "1F3CC" },
        { "Typeface name": "Webdings", "Dingbat dec": "138", "Dingbat hex": "8A", "Unicode dec": "127946", "Unicode hex": "1F3CA" },
        { "Typeface name": "Webdings", "Dingbat dec": "139", "Dingbat hex": "8B", "Unicode dec": "127940", "Unicode hex": "1F3C4" },
        { "Typeface name": "Webdings", "Dingbat dec": "140", "Dingbat hex": "8C", "Unicode dec": "127949", "Unicode hex": "1F3CD" },
        { "Typeface name": "Webdings", "Dingbat dec": "141", "Dingbat hex": "8D", "Unicode dec": "127950", "Unicode hex": "1F3CE" },
        { "Typeface name": "Webdings", "Dingbat dec": "142", "Dingbat hex": "8E", "Unicode dec": "128664", "Unicode hex": "1F698" },
        { "Typeface name": "Webdings", "Dingbat dec": "143", "Dingbat hex": "8F", "Unicode dec": "128480", "Unicode hex": "1F5E0" },
        { "Typeface name": "Webdings", "Dingbat dec": "144", "Dingbat hex": "90", "Unicode dec": "128738", "Unicode hex": "1F6E2" },
        { "Typeface name": "Webdings", "Dingbat dec": "145", "Dingbat hex": "91", "Unicode dec": "128176", "Unicode hex": "1F4B0" },
        { "Typeface name": "Webdings", "Dingbat dec": "146", "Dingbat hex": "92", "Unicode dec": "127991", "Unicode hex": "1F3F7" },
        { "Typeface name": "Webdings", "Dingbat dec": "147", "Dingbat hex": "93", "Unicode dec": "128179", "Unicode hex": "1F4B3" },
        { "Typeface name": "Webdings", "Dingbat dec": "148", "Dingbat hex": "94", "Unicode dec": "128106", "Unicode hex": "1F46A" },
        { "Typeface name": "Webdings", "Dingbat dec": "149", "Dingbat hex": "95", "Unicode dec": "128481", "Unicode hex": "1F5E1" },
        { "Typeface name": "Webdings", "Dingbat dec": "150", "Dingbat hex": "96", "Unicode dec": "128482", "Unicode hex": "1F5E2" },
        { "Typeface name": "Webdings", "Dingbat dec": "151", "Dingbat hex": "97", "Unicode dec": "128483", "Unicode hex": "1F5E3" },
        { "Typeface name": "Webdings", "Dingbat dec": "152", "Dingbat hex": "98", "Unicode dec": "10031", "Unicode hex": "272F" },
        { "Typeface name": "Webdings", "Dingbat dec": "153", "Dingbat hex": "99", "Unicode dec": "128388", "Unicode hex": "1F584" },
        { "Typeface name": "Webdings", "Dingbat dec": "154", "Dingbat hex": "9A", "Unicode dec": "128389", "Unicode hex": "1F585" },
        { "Typeface name": "Webdings", "Dingbat dec": "155", "Dingbat hex": "9B", "Unicode dec": "128387", "Unicode hex": "1F583" },
        { "Typeface name": "Webdings", "Dingbat dec": "156", "Dingbat hex": "9C", "Unicode dec": "128390", "Unicode hex": "1F586" },
        { "Typeface name": "Webdings", "Dingbat dec": "157", "Dingbat hex": "9D", "Unicode dec": "128441", "Unicode hex": "1F5B9" },
        { "Typeface name": "Webdings", "Dingbat dec": "158", "Dingbat hex": "9E", "Unicode dec": "128442", "Unicode hex": "1F5BA" },
        { "Typeface name": "Webdings", "Dingbat dec": "159", "Dingbat hex": "9F", "Unicode dec": "128443", "Unicode hex": "1F5BB" },
        { "Typeface name": "Webdings", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "128373", "Unicode hex": "1F575" },
        { "Typeface name": "Webdings", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "128368", "Unicode hex": "1F570" },
        { "Typeface name": "Webdings", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "128445", "Unicode hex": "1F5BD" },
        { "Typeface name": "Webdings", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "128446", "Unicode hex": "1F5BE" },
        { "Typeface name": "Webdings", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "128203", "Unicode hex": "1F4CB" },
        { "Typeface name": "Webdings", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "128466", "Unicode hex": "1F5D2" },
        { "Typeface name": "Webdings", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "128467", "Unicode hex": "1F5D3" },
        { "Typeface name": "Webdings", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "128366", "Unicode hex": "1F56E" },
        { "Typeface name": "Webdings", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "128218", "Unicode hex": "1F4DA" },
        { "Typeface name": "Webdings", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "128478", "Unicode hex": "1F5DE" },
        { "Typeface name": "Webdings", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "128479", "Unicode hex": "1F5DF" },
        { "Typeface name": "Webdings", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "128451", "Unicode hex": "1F5C3" },
        { "Typeface name": "Webdings", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "128450", "Unicode hex": "1F5C2" },
        { "Typeface name": "Webdings", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "128444", "Unicode hex": "1F5BC" },
        { "Typeface name": "Webdings", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "127917", "Unicode hex": "1F3AD" },
        { "Typeface name": "Webdings", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "127900", "Unicode hex": "1F39C" },
        { "Typeface name": "Webdings", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "127896", "Unicode hex": "1F398" },
        { "Typeface name": "Webdings", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "127897", "Unicode hex": "1F399" },
        { "Typeface name": "Webdings", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "127911", "Unicode hex": "1F3A7" },
        { "Typeface name": "Webdings", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "128191", "Unicode hex": "1F4BF" },
        { "Typeface name": "Webdings", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "127902", "Unicode hex": "1F39E" },
        { "Typeface name": "Webdings", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "128247", "Unicode hex": "1F4F7" },
        { "Typeface name": "Webdings", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "127903", "Unicode hex": "1F39F" },
        { "Typeface name": "Webdings", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "127916", "Unicode hex": "1F3AC" },
        { "Typeface name": "Webdings", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "128253", "Unicode hex": "1F4FD" },
        { "Typeface name": "Webdings", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "128249", "Unicode hex": "1F4F9" },
        { "Typeface name": "Webdings", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "128254", "Unicode hex": "1F4FE" },
        { "Typeface name": "Webdings", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "128251", "Unicode hex": "1F4FB" },
        { "Typeface name": "Webdings", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "127898", "Unicode hex": "1F39A" },
        { "Typeface name": "Webdings", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "127899", "Unicode hex": "1F39B" },
        { "Typeface name": "Webdings", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "128250", "Unicode hex": "1F4FA" },
        { "Typeface name": "Webdings", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "128187", "Unicode hex": "1F4BB" },
        { "Typeface name": "Webdings", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "128421", "Unicode hex": "1F5A5" },
        { "Typeface name": "Webdings", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "128422", "Unicode hex": "1F5A6" },
        { "Typeface name": "Webdings", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "128423", "Unicode hex": "1F5A7" },
        { "Typeface name": "Webdings", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "128377", "Unicode hex": "1F579" },
        { "Typeface name": "Webdings", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "127918", "Unicode hex": "1F3AE" },
        { "Typeface name": "Webdings", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "128379", "Unicode hex": "1F57B" },
        { "Typeface name": "Webdings", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "128380", "Unicode hex": "1F57C" },
        { "Typeface name": "Webdings", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "128223", "Unicode hex": "1F4DF" },
        { "Typeface name": "Webdings", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "128385", "Unicode hex": "1F581" },
        { "Typeface name": "Webdings", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "128384", "Unicode hex": "1F580" },
        { "Typeface name": "Webdings", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "128424", "Unicode hex": "1F5A8" },
        { "Typeface name": "Webdings", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "128425", "Unicode hex": "1F5A9" },
        { "Typeface name": "Webdings", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "128447", "Unicode hex": "1F5BF" },
        { "Typeface name": "Webdings", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "128426", "Unicode hex": "1F5AA" },
        { "Typeface name": "Webdings", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "128476", "Unicode hex": "1F5DC" },
        { "Typeface name": "Webdings", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "128274", "Unicode hex": "1F512" },
        { "Typeface name": "Webdings", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "128275", "Unicode hex": "1F513" },
        { "Typeface name": "Webdings", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "128477", "Unicode hex": "1F5DD" },
        { "Typeface name": "Webdings", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "128229", "Unicode hex": "1F4E5" },
        { "Typeface name": "Webdings", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "128228", "Unicode hex": "1F4E4" },
        { "Typeface name": "Webdings", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "128371", "Unicode hex": "1F573" },
        { "Typeface name": "Webdings", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "127779", "Unicode hex": "1F323" },
        { "Typeface name": "Webdings", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "127780", "Unicode hex": "1F324" },
        { "Typeface name": "Webdings", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "127781", "Unicode hex": "1F325" },
        { "Typeface name": "Webdings", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "127782", "Unicode hex": "1F326" },
        { "Typeface name": "Webdings", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "9729", "Unicode hex": "2601" },
        { "Typeface name": "Webdings", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "127784", "Unicode hex": "1F328" },
        { "Typeface name": "Webdings", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "127783", "Unicode hex": "1F327" },
        { "Typeface name": "Webdings", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "127785", "Unicode hex": "1F329" },
        { "Typeface name": "Webdings", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "127786", "Unicode hex": "1F32A" },
        { "Typeface name": "Webdings", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "127788", "Unicode hex": "1F32C" },
        { "Typeface name": "Webdings", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "127787", "Unicode hex": "1F32B" },
        { "Typeface name": "Webdings", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "127772", "Unicode hex": "1F31C" },
        { "Typeface name": "Webdings", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "127777", "Unicode hex": "1F321" },
        { "Typeface name": "Webdings", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "128715", "Unicode hex": "1F6CB" },
        { "Typeface name": "Webdings", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "128719", "Unicode hex": "1F6CF" },
        { "Typeface name": "Webdings", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "127869", "Unicode hex": "1F37D" },
        { "Typeface name": "Webdings", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "127864", "Unicode hex": "1F378" },
        { "Typeface name": "Webdings", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "128718", "Unicode hex": "1F6CE" },
        { "Typeface name": "Webdings", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "128717", "Unicode hex": "1F6CD" },
        { "Typeface name": "Webdings", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "9413", "Unicode hex": "24C5" },
        { "Typeface name": "Webdings", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "9855", "Unicode hex": "267F" },
        { "Typeface name": "Webdings", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "128710", "Unicode hex": "1F6C6" },
        { "Typeface name": "Webdings", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "128392", "Unicode hex": "1F588" },
        { "Typeface name": "Webdings", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "127891", "Unicode hex": "1F393" },
        { "Typeface name": "Webdings", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "128484", "Unicode hex": "1F5E4" },
        { "Typeface name": "Webdings", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "128485", "Unicode hex": "1F5E5" },
        { "Typeface name": "Webdings", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "128486", "Unicode hex": "1F5E6" },
        { "Typeface name": "Webdings", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "128487", "Unicode hex": "1F5E7" },
        { "Typeface name": "Webdings", "Dingbat dec": "241", "Dingbat hex": "F1", "Unicode dec": "128746", "Unicode hex": "1F6EA" },
        { "Typeface name": "Webdings", "Dingbat dec": "242", "Dingbat hex": "F2", "Unicode dec": "128063", "Unicode hex": "1F43F" },
        { "Typeface name": "Webdings", "Dingbat dec": "243", "Dingbat hex": "F3", "Unicode dec": "128038", "Unicode hex": "1F426" },
        { "Typeface name": "Webdings", "Dingbat dec": "244", "Dingbat hex": "F4", "Unicode dec": "128031", "Unicode hex": "1F41F" },
        { "Typeface name": "Webdings", "Dingbat dec": "245", "Dingbat hex": "F5", "Unicode dec": "128021", "Unicode hex": "1F415" },
        { "Typeface name": "Webdings", "Dingbat dec": "246", "Dingbat hex": "F6", "Unicode dec": "128008", "Unicode hex": "1F408" },
        { "Typeface name": "Webdings", "Dingbat dec": "247", "Dingbat hex": "F7", "Unicode dec": "128620", "Unicode hex": "1F66C" },
        { "Typeface name": "Webdings", "Dingbat dec": "248", "Dingbat hex": "F8", "Unicode dec": "128622", "Unicode hex": "1F66E" },
        { "Typeface name": "Webdings", "Dingbat dec": "249", "Dingbat hex": "F9", "Unicode dec": "128621", "Unicode hex": "1F66D" },
        { "Typeface name": "Webdings", "Dingbat dec": "250", "Dingbat hex": "FA", "Unicode dec": "128623", "Unicode hex": "1F66F" },
        { "Typeface name": "Webdings", "Dingbat dec": "251", "Dingbat hex": "FB", "Unicode dec": "128506", "Unicode hex": "1F5FA" },
        { "Typeface name": "Webdings", "Dingbat dec": "252", "Dingbat hex": "FC", "Unicode dec": "127757", "Unicode hex": "1F30D" },
        { "Typeface name": "Webdings", "Dingbat dec": "253", "Dingbat hex": "FD", "Unicode dec": "127759", "Unicode hex": "1F30F" },
        { "Typeface name": "Webdings", "Dingbat dec": "254", "Dingbat hex": "FE", "Unicode dec": "127758", "Unicode hex": "1F30E" },
        { "Typeface name": "Webdings", "Dingbat dec": "255", "Dingbat hex": "FF", "Unicode dec": "128330", "Unicode hex": "1F54A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
        { "Typeface name": "Wingdings", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "128393", "Unicode hex": "1F589" },
        { "Typeface name": "Wingdings", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "9986", "Unicode hex": "2702" },
        { "Typeface name": "Wingdings", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "9985", "Unicode hex": "2701" },
        { "Typeface name": "Wingdings", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "128083", "Unicode hex": "1F453" },
        { "Typeface name": "Wingdings", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "128365", "Unicode hex": "1F56D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "128366", "Unicode hex": "1F56E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "128367", "Unicode hex": "1F56F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "128383", "Unicode hex": "1F57F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "9990", "Unicode hex": "2706" },
        { "Typeface name": "Wingdings", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "128386", "Unicode hex": "1F582" },
        { "Typeface name": "Wingdings", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "128387", "Unicode hex": "1F583" },
        { "Typeface name": "Wingdings", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "128234", "Unicode hex": "1F4EA" },
        { "Typeface name": "Wingdings", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "128235", "Unicode hex": "1F4EB" },
        { "Typeface name": "Wingdings", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "128236", "Unicode hex": "1F4EC" },
        { "Typeface name": "Wingdings", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "128237", "Unicode hex": "1F4ED" },
        { "Typeface name": "Wingdings", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "128448", "Unicode hex": "1F5C0" },
        { "Typeface name": "Wingdings", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "128449", "Unicode hex": "1F5C1" },
        { "Typeface name": "Wingdings", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "128462", "Unicode hex": "1F5CE" },
        { "Typeface name": "Wingdings", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "128463", "Unicode hex": "1F5CF" },
        { "Typeface name": "Wingdings", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "128464", "Unicode hex": "1F5D0" },
        { "Typeface name": "Wingdings", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "128452", "Unicode hex": "1F5C4" },
        { "Typeface name": "Wingdings", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "8987", "Unicode hex": "231B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "128430", "Unicode hex": "1F5AE" },
        { "Typeface name": "Wingdings", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "128432", "Unicode hex": "1F5B0" },
        { "Typeface name": "Wingdings", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "128434", "Unicode hex": "1F5B2" },
        { "Typeface name": "Wingdings", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "128435", "Unicode hex": "1F5B3" },
        { "Typeface name": "Wingdings", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "128436", "Unicode hex": "1F5B4" },
        { "Typeface name": "Wingdings", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "128427", "Unicode hex": "1F5AB" },
        { "Typeface name": "Wingdings", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "128428", "Unicode hex": "1F5AC" },
        { "Typeface name": "Wingdings", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "9991", "Unicode hex": "2707" },
        { "Typeface name": "Wingdings", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "9997", "Unicode hex": "270D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "128398", "Unicode hex": "1F58E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "9996", "Unicode hex": "270C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "128399", "Unicode hex": "1F58F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "128077", "Unicode hex": "1F44D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "128078", "Unicode hex": "1F44E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "9756", "Unicode hex": "261C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "9758", "Unicode hex": "261E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "9757", "Unicode hex": "261D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "9759", "Unicode hex": "261F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "128400", "Unicode hex": "1F590" },
        { "Typeface name": "Wingdings", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "9786", "Unicode hex": "263A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "128528", "Unicode hex": "1F610" },
        { "Typeface name": "Wingdings", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "9785", "Unicode hex": "2639" },
        { "Typeface name": "Wingdings", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "128163", "Unicode hex": "1F4A3" },
        { "Typeface name": "Wingdings", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "128369", "Unicode hex": "1F571" },
        { "Typeface name": "Wingdings", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "127987", "Unicode hex": "1F3F3" },
        { "Typeface name": "Wingdings", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "127985", "Unicode hex": "1F3F1" },
        { "Typeface name": "Wingdings", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "9992", "Unicode hex": "2708" },
        { "Typeface name": "Wingdings", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "9788", "Unicode hex": "263C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "127778", "Unicode hex": "1F322" },
        { "Typeface name": "Wingdings", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "10052", "Unicode hex": "2744" },
        { "Typeface name": "Wingdings", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "128326", "Unicode hex": "1F546" },
        { "Typeface name": "Wingdings", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "10014", "Unicode hex": "271E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "128328", "Unicode hex": "1F548" },
        { "Typeface name": "Wingdings", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "10016", "Unicode hex": "2720" },
        { "Typeface name": "Wingdings", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "10017", "Unicode hex": "2721" },
        { "Typeface name": "Wingdings", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "9770", "Unicode hex": "262A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "9775", "Unicode hex": "262F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "128329", "Unicode hex": "1F549" },
        { "Typeface name": "Wingdings", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "9784", "Unicode hex": "2638" },
        { "Typeface name": "Wingdings", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "9800", "Unicode hex": "2648" },
        { "Typeface name": "Wingdings", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "9801", "Unicode hex": "2649" },
        { "Typeface name": "Wingdings", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "9802", "Unicode hex": "264A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "9803", "Unicode hex": "264B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "9804", "Unicode hex": "264C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "9805", "Unicode hex": "264D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "9806", "Unicode hex": "264E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "9807", "Unicode hex": "264F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "9808", "Unicode hex": "2650" },
        { "Typeface name": "Wingdings", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "9809", "Unicode hex": "2651" },
        { "Typeface name": "Wingdings", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "9810", "Unicode hex": "2652" },
        { "Typeface name": "Wingdings", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "9811", "Unicode hex": "2653" },
        { "Typeface name": "Wingdings", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "128624", "Unicode hex": "1F670" },
        { "Typeface name": "Wingdings", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "128629", "Unicode hex": "1F675" },
        { "Typeface name": "Wingdings", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "9899", "Unicode hex": "26AB" },
        { "Typeface name": "Wingdings", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "128318", "Unicode hex": "1F53E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "9724", "Unicode hex": "25FC" },
        { "Typeface name": "Wingdings", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "128911", "Unicode hex": "1F78F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "128912", "Unicode hex": "1F790" },
        { "Typeface name": "Wingdings", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "10065", "Unicode hex": "2751" },
        { "Typeface name": "Wingdings", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "10066", "Unicode hex": "2752" },
        { "Typeface name": "Wingdings", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "128927", "Unicode hex": "1F79F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "10731", "Unicode hex": "29EB" },
        { "Typeface name": "Wingdings", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "9670", "Unicode hex": "25C6" },
        { "Typeface name": "Wingdings", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "10070", "Unicode hex": "2756" },
        { "Typeface name": "Wingdings", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "11049", "Unicode hex": "2B29" },
        { "Typeface name": "Wingdings", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "8999", "Unicode hex": "2327" },
        { "Typeface name": "Wingdings", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "11193", "Unicode hex": "2BB9" },
        { "Typeface name": "Wingdings", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "8984", "Unicode hex": "2318" },
        { "Typeface name": "Wingdings", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "127989", "Unicode hex": "1F3F5" },
        { "Typeface name": "Wingdings", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "127990", "Unicode hex": "1F3F6" },
        { "Typeface name": "Wingdings", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "128630", "Unicode hex": "1F676" },
        { "Typeface name": "Wingdings", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "128631", "Unicode hex": "1F677" },
        { "Typeface name": "Wingdings", "Dingbat dec": "127", "Dingbat hex": "7F", "Unicode dec": "9647", "Unicode hex": "25AF" },
        { "Typeface name": "Wingdings", "Dingbat dec": "128", "Dingbat hex": "80", "Unicode dec": "127243", "Unicode hex": "1F10B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "129", "Dingbat hex": "81", "Unicode dec": "10112", "Unicode hex": "2780" },
        { "Typeface name": "Wingdings", "Dingbat dec": "130", "Dingbat hex": "82", "Unicode dec": "10113", "Unicode hex": "2781" },
        { "Typeface name": "Wingdings", "Dingbat dec": "131", "Dingbat hex": "83", "Unicode dec": "10114", "Unicode hex": "2782" },
        { "Typeface name": "Wingdings", "Dingbat dec": "132", "Dingbat hex": "84", "Unicode dec": "10115", "Unicode hex": "2783" },
        { "Typeface name": "Wingdings", "Dingbat dec": "133", "Dingbat hex": "85", "Unicode dec": "10116", "Unicode hex": "2784" },
        { "Typeface name": "Wingdings", "Dingbat dec": "134", "Dingbat hex": "86", "Unicode dec": "10117", "Unicode hex": "2785" },
        { "Typeface name": "Wingdings", "Dingbat dec": "135", "Dingbat hex": "87", "Unicode dec": "10118", "Unicode hex": "2786" },
        { "Typeface name": "Wingdings", "Dingbat dec": "136", "Dingbat hex": "88", "Unicode dec": "10119", "Unicode hex": "2787" },
        { "Typeface name": "Wingdings", "Dingbat dec": "137", "Dingbat hex": "89", "Unicode dec": "10120", "Unicode hex": "2788" },
        { "Typeface name": "Wingdings", "Dingbat dec": "138", "Dingbat hex": "8A", "Unicode dec": "10121", "Unicode hex": "2789" },
        { "Typeface name": "Wingdings", "Dingbat dec": "139", "Dingbat hex": "8B", "Unicode dec": "127244", "Unicode hex": "1F10C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "140", "Dingbat hex": "8C", "Unicode dec": "10122", "Unicode hex": "278A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "141", "Dingbat hex": "8D", "Unicode dec": "10123", "Unicode hex": "278B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "142", "Dingbat hex": "8E", "Unicode dec": "10124", "Unicode hex": "278C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "143", "Dingbat hex": "8F", "Unicode dec": "10125", "Unicode hex": "278D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "144", "Dingbat hex": "90", "Unicode dec": "10126", "Unicode hex": "278E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "145", "Dingbat hex": "91", "Unicode dec": "10127", "Unicode hex": "278F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "146", "Dingbat hex": "92", "Unicode dec": "10128", "Unicode hex": "2790" },
        { "Typeface name": "Wingdings", "Dingbat dec": "147", "Dingbat hex": "93", "Unicode dec": "10129", "Unicode hex": "2791" },
        { "Typeface name": "Wingdings", "Dingbat dec": "148", "Dingbat hex": "94", "Unicode dec": "10130", "Unicode hex": "2792" },
        { "Typeface name": "Wingdings", "Dingbat dec": "149", "Dingbat hex": "95", "Unicode dec": "10131", "Unicode hex": "2793" },
        { "Typeface name": "Wingdings", "Dingbat dec": "150", "Dingbat hex": "96", "Unicode dec": "128610", "Unicode hex": "1F662" },
        { "Typeface name": "Wingdings", "Dingbat dec": "151", "Dingbat hex": "97", "Unicode dec": "128608", "Unicode hex": "1F660" },
        { "Typeface name": "Wingdings", "Dingbat dec": "152", "Dingbat hex": "98", "Unicode dec": "128609", "Unicode hex": "1F661" },
        { "Typeface name": "Wingdings", "Dingbat dec": "153", "Dingbat hex": "99", "Unicode dec": "128611", "Unicode hex": "1F663" },
        { "Typeface name": "Wingdings", "Dingbat dec": "154", "Dingbat hex": "9A", "Unicode dec": "128606", "Unicode hex": "1F65E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "155", "Dingbat hex": "9B", "Unicode dec": "128604", "Unicode hex": "1F65C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "156", "Dingbat hex": "9C", "Unicode dec": "128605", "Unicode hex": "1F65D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "157", "Dingbat hex": "9D", "Unicode dec": "128607", "Unicode hex": "1F65F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "158", "Dingbat hex": "9E", "Unicode dec": "8729", "Unicode hex": "2219" },
        { "Typeface name": "Wingdings", "Dingbat dec": "159", "Dingbat hex": "9F", "Unicode dec": "8226", "Unicode hex": "2022" },
        { "Typeface name": "Wingdings", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "11037", "Unicode hex": "2B1D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "11096", "Unicode hex": "2B58" },
        { "Typeface name": "Wingdings", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "128902", "Unicode hex": "1F786" },
        { "Typeface name": "Wingdings", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "128904", "Unicode hex": "1F788" },
        { "Typeface name": "Wingdings", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "128906", "Unicode hex": "1F78A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "128907", "Unicode hex": "1F78B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "128319", "Unicode hex": "1F53F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "9642", "Unicode hex": "25AA" },
        { "Typeface name": "Wingdings", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "128910", "Unicode hex": "1F78E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "128961", "Unicode hex": "1F7C1" },
        { "Typeface name": "Wingdings", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "128965", "Unicode hex": "1F7C5" },
        { "Typeface name": "Wingdings", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "9733", "Unicode hex": "2605" },
        { "Typeface name": "Wingdings", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "128971", "Unicode hex": "1F7CB" },
        { "Typeface name": "Wingdings", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "128975", "Unicode hex": "1F7CF" },
        { "Typeface name": "Wingdings", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "128979", "Unicode hex": "1F7D3" },
        { "Typeface name": "Wingdings", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "128977", "Unicode hex": "1F7D1" },
        { "Typeface name": "Wingdings", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "11216", "Unicode hex": "2BD0" },
        { "Typeface name": "Wingdings", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "8982", "Unicode hex": "2316" },
        { "Typeface name": "Wingdings", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "11214", "Unicode hex": "2BCE" },
        { "Typeface name": "Wingdings", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "11215", "Unicode hex": "2BCF" },
        { "Typeface name": "Wingdings", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "11217", "Unicode hex": "2BD1" },
        { "Typeface name": "Wingdings", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "10026", "Unicode hex": "272A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "10032", "Unicode hex": "2730" },
        { "Typeface name": "Wingdings", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "128336", "Unicode hex": "1F550" },
        { "Typeface name": "Wingdings", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "128337", "Unicode hex": "1F551" },
        { "Typeface name": "Wingdings", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "128338", "Unicode hex": "1F552" },
        { "Typeface name": "Wingdings", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "128339", "Unicode hex": "1F553" },
        { "Typeface name": "Wingdings", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "128340", "Unicode hex": "1F554" },
        { "Typeface name": "Wingdings", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "128341", "Unicode hex": "1F555" },
        { "Typeface name": "Wingdings", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "128342", "Unicode hex": "1F556" },
        { "Typeface name": "Wingdings", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "128343", "Unicode hex": "1F557" },
        { "Typeface name": "Wingdings", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "128344", "Unicode hex": "1F558" },
        { "Typeface name": "Wingdings", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "128345", "Unicode hex": "1F559" },
        { "Typeface name": "Wingdings", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "128346", "Unicode hex": "1F55A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "128347", "Unicode hex": "1F55B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "11184", "Unicode hex": "2BB0" },
        { "Typeface name": "Wingdings", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "11185", "Unicode hex": "2BB1" },
        { "Typeface name": "Wingdings", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "11186", "Unicode hex": "2BB2" },
        { "Typeface name": "Wingdings", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "11187", "Unicode hex": "2BB3" },
        { "Typeface name": "Wingdings", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "11188", "Unicode hex": "2BB4" },
        { "Typeface name": "Wingdings", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "11189", "Unicode hex": "2BB5" },
        { "Typeface name": "Wingdings", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "11190", "Unicode hex": "2BB6" },
        { "Typeface name": "Wingdings", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "11191", "Unicode hex": "2BB7" },
        { "Typeface name": "Wingdings", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "128618", "Unicode hex": "1F66A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "128619", "Unicode hex": "1F66B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "128597", "Unicode hex": "1F655" },
        { "Typeface name": "Wingdings", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "128596", "Unicode hex": "1F654" },
        { "Typeface name": "Wingdings", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "128599", "Unicode hex": "1F657" },
        { "Typeface name": "Wingdings", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "128598", "Unicode hex": "1F656" },
        { "Typeface name": "Wingdings", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "128592", "Unicode hex": "1F650" },
        { "Typeface name": "Wingdings", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "128593", "Unicode hex": "1F651" },
        { "Typeface name": "Wingdings", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "128594", "Unicode hex": "1F652" },
        { "Typeface name": "Wingdings", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "128595", "Unicode hex": "1F653" },
        { "Typeface name": "Wingdings", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "9003", "Unicode hex": "232B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "8998", "Unicode hex": "2326" },
        { "Typeface name": "Wingdings", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "11160", "Unicode hex": "2B98" },
        { "Typeface name": "Wingdings", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "11162", "Unicode hex": "2B9A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "11161", "Unicode hex": "2B99" },
        { "Typeface name": "Wingdings", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "11163", "Unicode hex": "2B9B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "11144", "Unicode hex": "2B88" },
        { "Typeface name": "Wingdings", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "11146", "Unicode hex": "2B8A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "11145", "Unicode hex": "2B89" },
        { "Typeface name": "Wingdings", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "11147", "Unicode hex": "2B8B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "129128", "Unicode hex": "1F868" },
        { "Typeface name": "Wingdings", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "129130", "Unicode hex": "1F86A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "129129", "Unicode hex": "1F869" },
        { "Typeface name": "Wingdings", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "129131", "Unicode hex": "1F86B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "129132", "Unicode hex": "1F86C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "129133", "Unicode hex": "1F86D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "129135", "Unicode hex": "1F86F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "129134", "Unicode hex": "1F86E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "129144", "Unicode hex": "1F878" },
        { "Typeface name": "Wingdings", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "129146", "Unicode hex": "1F87A" },
        { "Typeface name": "Wingdings", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "129145", "Unicode hex": "1F879" },
        { "Typeface name": "Wingdings", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "129147", "Unicode hex": "1F87B" },
        { "Typeface name": "Wingdings", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "129148", "Unicode hex": "1F87C" },
        { "Typeface name": "Wingdings", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "129149", "Unicode hex": "1F87D" },
        { "Typeface name": "Wingdings", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "129151", "Unicode hex": "1F87F" },
        { "Typeface name": "Wingdings", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "129150", "Unicode hex": "1F87E" },
        { "Typeface name": "Wingdings", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "8678", "Unicode hex": "21E6" },
        { "Typeface name": "Wingdings", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "8680", "Unicode hex": "21E8" },
        { "Typeface name": "Wingdings", "Dingbat dec": "241", "Dingbat hex": "F1", "Unicode dec": "8679", "Unicode hex": "21E7" },
        { "Typeface name": "Wingdings", "Dingbat dec": "242", "Dingbat hex": "F2", "Unicode dec": "8681", "Unicode hex": "21E9" },
        { "Typeface name": "Wingdings", "Dingbat dec": "243", "Dingbat hex": "F3", "Unicode dec": "11012", "Unicode hex": "2B04" },
        { "Typeface name": "Wingdings", "Dingbat dec": "244", "Dingbat hex": "F4", "Unicode dec": "8691", "Unicode hex": "21F3" },
        { "Typeface name": "Wingdings", "Dingbat dec": "245", "Dingbat hex": "F5", "Unicode dec": "11009", "Unicode hex": "2B01" },
        { "Typeface name": "Wingdings", "Dingbat dec": "246", "Dingbat hex": "F6", "Unicode dec": "11008", "Unicode hex": "2B00" },
        { "Typeface name": "Wingdings", "Dingbat dec": "247", "Dingbat hex": "F7", "Unicode dec": "11011", "Unicode hex": "2B03" },
        { "Typeface name": "Wingdings", "Dingbat dec": "248", "Dingbat hex": "F8", "Unicode dec": "11010", "Unicode hex": "2B02" },
        { "Typeface name": "Wingdings", "Dingbat dec": "249", "Dingbat hex": "F9", "Unicode dec": "129196", "Unicode hex": "1F8AC" },
        { "Typeface name": "Wingdings", "Dingbat dec": "250", "Dingbat hex": "FA", "Unicode dec": "129197", "Unicode hex": "1F8AD" },
        { "Typeface name": "Wingdings", "Dingbat dec": "251", "Dingbat hex": "FB", "Unicode dec": "128502", "Unicode hex": "1F5F6" },
        { "Typeface name": "Wingdings", "Dingbat dec": "252", "Dingbat hex": "FC", "Unicode dec": "10003", "Unicode hex": "2713" },
        { "Typeface name": "Wingdings", "Dingbat dec": "253", "Dingbat hex": "FD", "Unicode dec": "128503", "Unicode hex": "1F5F7" },
        { "Typeface name": "Wingdings", "Dingbat dec": "254", "Dingbat hex": "FE", "Unicode dec": "128505", "Unicode hex": "1F5F9" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "128394", "Unicode hex": "1F58A" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "128395", "Unicode hex": "1F58B" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "128396", "Unicode hex": "1F58C" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "128397", "Unicode hex": "1F58D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "9988", "Unicode hex": "2704" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "9984", "Unicode hex": "2700" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "128382", "Unicode hex": "1F57E" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "128381", "Unicode hex": "1F57D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "128453", "Unicode hex": "1F5C5" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "128454", "Unicode hex": "1F5C6" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "128455", "Unicode hex": "1F5C7" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "128456", "Unicode hex": "1F5C8" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "128457", "Unicode hex": "1F5C9" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "128458", "Unicode hex": "1F5CA" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "128459", "Unicode hex": "1F5CB" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "128460", "Unicode hex": "1F5CC" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "128461", "Unicode hex": "1F5CD" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "128203", "Unicode hex": "1F4CB" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "128465", "Unicode hex": "1F5D1" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "128468", "Unicode hex": "1F5D4" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "128437", "Unicode hex": "1F5B5" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "128438", "Unicode hex": "1F5B6" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "128439", "Unicode hex": "1F5B7" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "128440", "Unicode hex": "1F5B8" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "128429", "Unicode hex": "1F5AD" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "128431", "Unicode hex": "1F5AF" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "128433", "Unicode hex": "1F5B1" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "128402", "Unicode hex": "1F592" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "128403", "Unicode hex": "1F593" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "128408", "Unicode hex": "1F598" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "128409", "Unicode hex": "1F599" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "128410", "Unicode hex": "1F59A" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "128411", "Unicode hex": "1F59B" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "128072", "Unicode hex": "1F448" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "128073", "Unicode hex": "1F449" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "128412", "Unicode hex": "1F59C" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "128413", "Unicode hex": "1F59D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "128414", "Unicode hex": "1F59E" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "128415", "Unicode hex": "1F59F" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "128416", "Unicode hex": "1F5A0" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "128417", "Unicode hex": "1F5A1" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "128070", "Unicode hex": "1F446" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "128071", "Unicode hex": "1F447" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "128418", "Unicode hex": "1F5A2" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "128419", "Unicode hex": "1F5A3" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "128401", "Unicode hex": "1F591" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "128500", "Unicode hex": "1F5F4" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "128504", "Unicode hex": "1F5F8" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "128501", "Unicode hex": "1F5F5" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "9745", "Unicode hex": "2611" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "11197", "Unicode hex": "2BBD" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "9746", "Unicode hex": "2612" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "11198", "Unicode hex": "2BBE" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "11199", "Unicode hex": "2BBF" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "128711", "Unicode hex": "1F6C7" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "10680", "Unicode hex": "29B8" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "128625", "Unicode hex": "1F671" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "128628", "Unicode hex": "1F674" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "128626", "Unicode hex": "1F672" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "128627", "Unicode hex": "1F673" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "8253", "Unicode hex": "203D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "128633", "Unicode hex": "1F679" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "128634", "Unicode hex": "1F67A" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "128635", "Unicode hex": "1F67B" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "128614", "Unicode hex": "1F666" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "128612", "Unicode hex": "1F664" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "128613", "Unicode hex": "1F665" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "128615", "Unicode hex": "1F667" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "128602", "Unicode hex": "1F65A" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "128600", "Unicode hex": "1F658" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "128601", "Unicode hex": "1F659" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "128603", "Unicode hex": "1F65B" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "9450", "Unicode hex": "24EA" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "9312", "Unicode hex": "2460" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "9313", "Unicode hex": "2461" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "9314", "Unicode hex": "2462" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "9315", "Unicode hex": "2463" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "9316", "Unicode hex": "2464" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "9317", "Unicode hex": "2465" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "9318", "Unicode hex": "2466" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "9319", "Unicode hex": "2467" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "9320", "Unicode hex": "2468" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "9321", "Unicode hex": "2469" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "9471", "Unicode hex": "24FF" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "10102", "Unicode hex": "2776" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "10103", "Unicode hex": "2777" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "10104", "Unicode hex": "2778" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "10105", "Unicode hex": "2779" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "10106", "Unicode hex": "277A" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "10107", "Unicode hex": "277B" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "10108", "Unicode hex": "277C" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "10109", "Unicode hex": "277D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "10110", "Unicode hex": "277E" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "10111", "Unicode hex": "277F" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "128", "Dingbat hex": "80", "Unicode dec": "9737", "Unicode hex": "2609" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "129", "Dingbat hex": "81", "Unicode dec": "127765", "Unicode hex": "1F315" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "130", "Dingbat hex": "82", "Unicode dec": "9789", "Unicode hex": "263D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "131", "Dingbat hex": "83", "Unicode dec": "9790", "Unicode hex": "263E" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "132", "Dingbat hex": "84", "Unicode dec": "11839", "Unicode hex": "2E3F" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "133", "Dingbat hex": "85", "Unicode dec": "10013", "Unicode hex": "271D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "134", "Dingbat hex": "86", "Unicode dec": "128327", "Unicode hex": "1F547" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "135", "Dingbat hex": "87", "Unicode dec": "128348", "Unicode hex": "1F55C" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "136", "Dingbat hex": "88", "Unicode dec": "128349", "Unicode hex": "1F55D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "137", "Dingbat hex": "89", "Unicode dec": "128350", "Unicode hex": "1F55E" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "138", "Dingbat hex": "8A", "Unicode dec": "128351", "Unicode hex": "1F55F" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "139", "Dingbat hex": "8B", "Unicode dec": "128352", "Unicode hex": "1F560" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "140", "Dingbat hex": "8C", "Unicode dec": "128353", "Unicode hex": "1F561" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "141", "Dingbat hex": "8D", "Unicode dec": "128354", "Unicode hex": "1F562" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "142", "Dingbat hex": "8E", "Unicode dec": "128355", "Unicode hex": "1F563" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "143", "Dingbat hex": "8F", "Unicode dec": "128356", "Unicode hex": "1F564" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "144", "Dingbat hex": "90", "Unicode dec": "128357", "Unicode hex": "1F565" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "145", "Dingbat hex": "91", "Unicode dec": "128358", "Unicode hex": "1F566" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "146", "Dingbat hex": "92", "Unicode dec": "128359", "Unicode hex": "1F567" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "147", "Dingbat hex": "93", "Unicode dec": "128616", "Unicode hex": "1F668" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "148", "Dingbat hex": "94", "Unicode dec": "128617", "Unicode hex": "1F669" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "149", "Dingbat hex": "95", "Unicode dec": "8901", "Unicode hex": "22C5" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "150", "Dingbat hex": "96", "Unicode dec": "128900", "Unicode hex": "1F784" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "151", "Dingbat hex": "97", "Unicode dec": "10625", "Unicode hex": "2981" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "152", "Dingbat hex": "98", "Unicode dec": "9679", "Unicode hex": "25CF" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "153", "Dingbat hex": "99", "Unicode dec": "9675", "Unicode hex": "25CB" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "154", "Dingbat hex": "9A", "Unicode dec": "128901", "Unicode hex": "1F785" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "155", "Dingbat hex": "9B", "Unicode dec": "128903", "Unicode hex": "1F787" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "156", "Dingbat hex": "9C", "Unicode dec": "128905", "Unicode hex": "1F789" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "157", "Dingbat hex": "9D", "Unicode dec": "8857", "Unicode hex": "2299" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "158", "Dingbat hex": "9E", "Unicode dec": "10687", "Unicode hex": "29BF" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "159", "Dingbat hex": "9F", "Unicode dec": "128908", "Unicode hex": "1F78C" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "128909", "Unicode hex": "1F78D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "9726", "Unicode hex": "25FE" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "9632", "Unicode hex": "25A0" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "9633", "Unicode hex": "25A1" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "128913", "Unicode hex": "1F791" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "128914", "Unicode hex": "1F792" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "128915", "Unicode hex": "1F793" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "128916", "Unicode hex": "1F794" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "9635", "Unicode hex": "25A3" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "128917", "Unicode hex": "1F795" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "128918", "Unicode hex": "1F796" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "128919", "Unicode hex": "1F797" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "128920", "Unicode hex": "1F798" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "11049", "Unicode hex": "2B29" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "11045", "Unicode hex": "2B25" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "9671", "Unicode hex": "25C7" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "128922", "Unicode hex": "1F79A" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "9672", "Unicode hex": "25C8" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "128923", "Unicode hex": "1F79B" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "128924", "Unicode hex": "1F79C" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "128925", "Unicode hex": "1F79D" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "128926", "Unicode hex": "1F79E" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "11050", "Unicode hex": "2B2A" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "11047", "Unicode hex": "2B27" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "9674", "Unicode hex": "25CA" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "128928", "Unicode hex": "1F7A0" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "9686", "Unicode hex": "25D6" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "9687", "Unicode hex": "25D7" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "11210", "Unicode hex": "2BCA" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "11211", "Unicode hex": "2BCB" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "11200", "Unicode hex": "2BC0" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "11201", "Unicode hex": "2BC1" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "11039", "Unicode hex": "2B1F" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "11202", "Unicode hex": "2BC2" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "11043", "Unicode hex": "2B23" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "11042", "Unicode hex": "2B22" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "11203", "Unicode hex": "2BC3" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "11204", "Unicode hex": "2BC4" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "128929", "Unicode hex": "1F7A1" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "128930", "Unicode hex": "1F7A2" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "128931", "Unicode hex": "1F7A3" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "128932", "Unicode hex": "1F7A4" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "128933", "Unicode hex": "1F7A5" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "128934", "Unicode hex": "1F7A6" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "128935", "Unicode hex": "1F7A7" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "128936", "Unicode hex": "1F7A8" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "128937", "Unicode hex": "1F7A9" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "128938", "Unicode hex": "1F7AA" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "128939", "Unicode hex": "1F7AB" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "128940", "Unicode hex": "1F7AC" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "128941", "Unicode hex": "1F7AD" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "128942", "Unicode hex": "1F7AE" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "128943", "Unicode hex": "1F7AF" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "128944", "Unicode hex": "1F7B0" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "128945", "Unicode hex": "1F7B1" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "128946", "Unicode hex": "1F7B2" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "128947", "Unicode hex": "1F7B3" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "128948", "Unicode hex": "1F7B4" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "128949", "Unicode hex": "1F7B5" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "128950", "Unicode hex": "1F7B6" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "128951", "Unicode hex": "1F7B7" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "128952", "Unicode hex": "1F7B8" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "128953", "Unicode hex": "1F7B9" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "128954", "Unicode hex": "1F7BA" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "128955", "Unicode hex": "1F7BB" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "128956", "Unicode hex": "1F7BC" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "128957", "Unicode hex": "1F7BD" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "128958", "Unicode hex": "1F7BE" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "128959", "Unicode hex": "1F7BF" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "128960", "Unicode hex": "1F7C0" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "128962", "Unicode hex": "1F7C2" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "128964", "Unicode hex": "1F7C4" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "128966", "Unicode hex": "1F7C6" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "128969", "Unicode hex": "1F7C9" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "128970", "Unicode hex": "1F7CA" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "10038", "Unicode hex": "2736" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "128972", "Unicode hex": "1F7CC" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "128974", "Unicode hex": "1F7CE" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "128976", "Unicode hex": "1F7D0" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "128978", "Unicode hex": "1F7D2" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "10041", "Unicode hex": "2739" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "241", "Dingbat hex": "F1", "Unicode dec": "128963", "Unicode hex": "1F7C3" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "242", "Dingbat hex": "F2", "Unicode dec": "128967", "Unicode hex": "1F7C7" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "243", "Dingbat hex": "F3", "Unicode dec": "10031", "Unicode hex": "272F" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "244", "Dingbat hex": "F4", "Unicode dec": "128973", "Unicode hex": "1F7CD" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "245", "Dingbat hex": "F5", "Unicode dec": "128980", "Unicode hex": "1F7D4" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "246", "Dingbat hex": "F6", "Unicode dec": "11212", "Unicode hex": "2BCC" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "247", "Dingbat hex": "F7", "Unicode dec": "11213", "Unicode hex": "2BCD" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "248", "Dingbat hex": "F8", "Unicode dec": "8251", "Unicode hex": "203B" },
        { "Typeface name": "Wingdings 2", "Dingbat dec": "249", "Dingbat hex": "F9", "Unicode dec": "8258", "Unicode hex": "2042" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "11104", "Unicode hex": "2B60" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "11106", "Unicode hex": "2B62" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "11105", "Unicode hex": "2B61" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "11107", "Unicode hex": "2B63" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "11110", "Unicode hex": "2B66" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "11111", "Unicode hex": "2B67" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "11113", "Unicode hex": "2B69" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "11112", "Unicode hex": "2B68" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "11120", "Unicode hex": "2B70" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "11122", "Unicode hex": "2B72" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "11121", "Unicode hex": "2B71" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "11123", "Unicode hex": "2B73" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "11126", "Unicode hex": "2B76" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "11128", "Unicode hex": "2B78" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "11131", "Unicode hex": "2B7B" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "11133", "Unicode hex": "2B7D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "11108", "Unicode hex": "2B64" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "11109", "Unicode hex": "2B65" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "11114", "Unicode hex": "2B6A" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "11116", "Unicode hex": "2B6C" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "11115", "Unicode hex": "2B6B" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "11117", "Unicode hex": "2B6D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "11085", "Unicode hex": "2B4D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "11168", "Unicode hex": "2BA0" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "11169", "Unicode hex": "2BA1" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "11170", "Unicode hex": "2BA2" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "11171", "Unicode hex": "2BA3" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "11172", "Unicode hex": "2BA4" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "11173", "Unicode hex": "2BA5" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "11174", "Unicode hex": "2BA6" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "11175", "Unicode hex": "2BA7" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "11152", "Unicode hex": "2B90" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "11153", "Unicode hex": "2B91" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "11154", "Unicode hex": "2B92" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "11155", "Unicode hex": "2B93" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "11136", "Unicode hex": "2B80" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "11139", "Unicode hex": "2B83" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "11134", "Unicode hex": "2B7E" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "11135", "Unicode hex": "2B7F" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "11140", "Unicode hex": "2B84" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "11142", "Unicode hex": "2B86" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "11141", "Unicode hex": "2B85" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "11143", "Unicode hex": "2B87" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "11151", "Unicode hex": "2B8F" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "11149", "Unicode hex": "2B8D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "11150", "Unicode hex": "2B8E" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "11148", "Unicode hex": "2B8C" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "11118", "Unicode hex": "2B6E" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "11119", "Unicode hex": "2B6F" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "9099", "Unicode hex": "238B" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "8996", "Unicode hex": "2324" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "8963", "Unicode hex": "2303" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "8997", "Unicode hex": "2325" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "9251", "Unicode hex": "2423" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "9085", "Unicode hex": "237D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "8682", "Unicode hex": "21EA" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "11192", "Unicode hex": "2BB8" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "129184", "Unicode hex": "1F8A0" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "129185", "Unicode hex": "1F8A1" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "129186", "Unicode hex": "1F8A2" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "129187", "Unicode hex": "1F8A3" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "129188", "Unicode hex": "1F8A4" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "129189", "Unicode hex": "1F8A5" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "129190", "Unicode hex": "1F8A6" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "129191", "Unicode hex": "1F8A7" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "129192", "Unicode hex": "1F8A8" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "129193", "Unicode hex": "1F8A9" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "129194", "Unicode hex": "1F8AA" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "129195", "Unicode hex": "1F8AB" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "129104", "Unicode hex": "1F850" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "129106", "Unicode hex": "1F852" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "129105", "Unicode hex": "1F851" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "129107", "Unicode hex": "1F853" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "129108", "Unicode hex": "1F854" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "129109", "Unicode hex": "1F855" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "129111", "Unicode hex": "1F857" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "129110", "Unicode hex": "1F856" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "129112", "Unicode hex": "1F858" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "129113", "Unicode hex": "1F859" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "9650", "Unicode hex": "25B2" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "9660", "Unicode hex": "25BC" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "9651", "Unicode hex": "25B3" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "9661", "Unicode hex": "25BD" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "9664", "Unicode hex": "25C0" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "9654", "Unicode hex": "25B6" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "9665", "Unicode hex": "25C1" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "9655", "Unicode hex": "25B7" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "9699", "Unicode hex": "25E3" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "9698", "Unicode hex": "25E2" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "9700", "Unicode hex": "25E4" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "9701", "Unicode hex": "25E5" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "128896", "Unicode hex": "1F780" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "128898", "Unicode hex": "1F782" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "128897", "Unicode hex": "1F781" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "128", "Dingbat hex": "80", "Unicode dec": "128899", "Unicode hex": "1F783" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "129", "Dingbat hex": "81", "Unicode dec": "11205", "Unicode hex": "2BC5" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "130", "Dingbat hex": "82", "Unicode dec": "11206", "Unicode hex": "2BC6" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "131", "Dingbat hex": "83", "Unicode dec": "11207", "Unicode hex": "2BC7" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "132", "Dingbat hex": "84", "Unicode dec": "11208", "Unicode hex": "2BC8" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "133", "Dingbat hex": "85", "Unicode dec": "11164", "Unicode hex": "2B9C" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "134", "Dingbat hex": "86", "Unicode dec": "11166", "Unicode hex": "2B9E" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "135", "Dingbat hex": "87", "Unicode dec": "11165", "Unicode hex": "2B9D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "136", "Dingbat hex": "88", "Unicode dec": "11167", "Unicode hex": "2B9F" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "137", "Dingbat hex": "89", "Unicode dec": "129040", "Unicode hex": "1F810" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "138", "Dingbat hex": "8A", "Unicode dec": "129042", "Unicode hex": "1F812" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "139", "Dingbat hex": "8B", "Unicode dec": "129041", "Unicode hex": "1F811" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "140", "Dingbat hex": "8C", "Unicode dec": "129043", "Unicode hex": "1F813" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "141", "Dingbat hex": "8D", "Unicode dec": "129044", "Unicode hex": "1F814" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "142", "Dingbat hex": "8E", "Unicode dec": "129046", "Unicode hex": "1F816" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "143", "Dingbat hex": "8F", "Unicode dec": "129045", "Unicode hex": "1F815" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "144", "Dingbat hex": "90", "Unicode dec": "129047", "Unicode hex": "1F817" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "145", "Dingbat hex": "91", "Unicode dec": "129048", "Unicode hex": "1F818" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "146", "Dingbat hex": "92", "Unicode dec": "129050", "Unicode hex": "1F81A" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "147", "Dingbat hex": "93", "Unicode dec": "129049", "Unicode hex": "1F819" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "148", "Dingbat hex": "94", "Unicode dec": "129051", "Unicode hex": "1F81B" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "149", "Dingbat hex": "95", "Unicode dec": "129052", "Unicode hex": "1F81C" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "150", "Dingbat hex": "96", "Unicode dec": "129054", "Unicode hex": "1F81E" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "151", "Dingbat hex": "97", "Unicode dec": "129053", "Unicode hex": "1F81D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "152", "Dingbat hex": "98", "Unicode dec": "129055", "Unicode hex": "1F81F" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "153", "Dingbat hex": "99", "Unicode dec": "129024", "Unicode hex": "1F800" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "154", "Dingbat hex": "9A", "Unicode dec": "129026", "Unicode hex": "1F802" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "155", "Dingbat hex": "9B", "Unicode dec": "129025", "Unicode hex": "1F801" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "156", "Dingbat hex": "9C", "Unicode dec": "129027", "Unicode hex": "1F803" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "157", "Dingbat hex": "9D", "Unicode dec": "129028", "Unicode hex": "1F804" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "158", "Dingbat hex": "9E", "Unicode dec": "129030", "Unicode hex": "1F806" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "159", "Dingbat hex": "9F", "Unicode dec": "129029", "Unicode hex": "1F805" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "129031", "Unicode hex": "1F807" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "129032", "Unicode hex": "1F808" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "129034", "Unicode hex": "1F80A" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "129033", "Unicode hex": "1F809" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "129035", "Unicode hex": "1F80B" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "129056", "Unicode hex": "1F820" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "129058", "Unicode hex": "1F822" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "129060", "Unicode hex": "1F824" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "129062", "Unicode hex": "1F826" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "129064", "Unicode hex": "1F828" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "129066", "Unicode hex": "1F82A" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "129068", "Unicode hex": "1F82C" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "129180", "Unicode hex": "1F89C" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "129181", "Unicode hex": "1F89D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "129182", "Unicode hex": "1F89E" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "129183", "Unicode hex": "1F89F" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "129070", "Unicode hex": "1F82E" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "129072", "Unicode hex": "1F830" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "129074", "Unicode hex": "1F832" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "129076", "Unicode hex": "1F834" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "129078", "Unicode hex": "1F836" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "129080", "Unicode hex": "1F838" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "129082", "Unicode hex": "1F83A" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "129081", "Unicode hex": "1F839" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "129083", "Unicode hex": "1F83B" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "129176", "Unicode hex": "1F898" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "129178", "Unicode hex": "1F89A" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "129177", "Unicode hex": "1F899" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "129179", "Unicode hex": "1F89B" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "129084", "Unicode hex": "1F83C" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "129086", "Unicode hex": "1F83E" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "129085", "Unicode hex": "1F83D" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "129087", "Unicode hex": "1F83F" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "129088", "Unicode hex": "1F840" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "129090", "Unicode hex": "1F842" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "129089", "Unicode hex": "1F841" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "129091", "Unicode hex": "1F843" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "129092", "Unicode hex": "1F844" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "129094", "Unicode hex": "1F846" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "129093", "Unicode hex": "1F845" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "129095", "Unicode hex": "1F847" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "11176", "Unicode hex": "2BA8" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "11177", "Unicode hex": "2BA9" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "11178", "Unicode hex": "2BAA" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "11179", "Unicode hex": "2BAB" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "11180", "Unicode hex": "2BAC" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "11181", "Unicode hex": "2BAD" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "11182", "Unicode hex": "2BAE" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "11183", "Unicode hex": "2BAF" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "129120", "Unicode hex": "1F860" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "129122", "Unicode hex": "1F862" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "129121", "Unicode hex": "1F861" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "129123", "Unicode hex": "1F863" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "129124", "Unicode hex": "1F864" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "129125", "Unicode hex": "1F865" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "129127", "Unicode hex": "1F867" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "129126", "Unicode hex": "1F866" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "129136", "Unicode hex": "1F870" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "129138", "Unicode hex": "1F872" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "129137", "Unicode hex": "1F871" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "129139", "Unicode hex": "1F873" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "129140", "Unicode hex": "1F874" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "129141", "Unicode hex": "1F875" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "129143", "Unicode hex": "1F877" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "129142", "Unicode hex": "1F876" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "129152", "Unicode hex": "1F880" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "129154", "Unicode hex": "1F882" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "129153", "Unicode hex": "1F881" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "129155", "Unicode hex": "1F883" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "129156", "Unicode hex": "1F884" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "129157", "Unicode hex": "1F885" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "129159", "Unicode hex": "1F887" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "129158", "Unicode hex": "1F886" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "129168", "Unicode hex": "1F890" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "129170", "Unicode hex": "1F892" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "129169", "Unicode hex": "1F891" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "129171", "Unicode hex": "1F893" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "129172", "Unicode hex": "1F894" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "129174", "Unicode hex": "1F896" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "129173", "Unicode hex": "1F895" },
        { "Typeface name": "Wingdings 3", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "129175", "Unicode hex": "1F897" }
      ];
      exports2.default = dingbats;
    }
  });

  // node_modules/dingbat-to-unicode/dist/index.js
  var require_dist = __commonJS({
    "node_modules/dingbat-to-unicode/dist/index.js"(exports2) {
      "use strict";
      var __importDefault = exports2 && exports2.__importDefault || function(mod) {
        return mod && mod.__esModule ? mod : { "default": mod };
      };
      Object.defineProperty(exports2, "__esModule", { value: true });
      exports2.hex = exports2.dec = exports2.codePoint = void 0;
      var dingbats_1 = __importDefault(require_dingbats());
      var dingbatsByCodePoint = {};
      var fromCodePoint = String.fromCodePoint ? String.fromCodePoint : fromCodePointPolyfill;
      for (_i = 0, dingbats_2 = dingbats_1.default; _i < dingbats_2.length; _i++) {
        dingbat = dingbats_2[_i];
        codePoint_1 = parseInt(dingbat["Unicode dec"], 10);
        scalarValue = {
          codePoint: codePoint_1,
          string: fromCodePoint(codePoint_1)
        };
        dingbatsByCodePoint[dingbat["Typeface name"].toUpperCase() + "_" + dingbat["Dingbat dec"]] = scalarValue;
      }
      var dingbat;
      var codePoint_1;
      var scalarValue;
      var _i;
      var dingbats_2;
      function codePoint(typeface, codePoint2) {
        return dingbatsByCodePoint[typeface.toUpperCase() + "_" + codePoint2];
      }
      exports2.codePoint = codePoint;
      function dec2(typeface, dec3) {
        return codePoint(typeface, parseInt(dec3, 10));
      }
      exports2.dec = dec2;
      function hex(typeface, hex2) {
        return codePoint(typeface, parseInt(hex2, 16));
      }
      exports2.hex = hex;
      function fromCodePointPolyfill(codePoint2) {
        if (codePoint2 <= 65535) {
          return String.fromCharCode(codePoint2);
        } else {
          var highSurrogate = Math.floor((codePoint2 - 65536) / 1024) + 55296;
          var lowSurrogate = (codePoint2 - 65536) % 1024 + 56320;
          return String.fromCharCode(highSurrogate, lowSurrogate);
        }
      }
    }
  });

  // node_modules/mammoth/lib/transforms.js
  var require_transforms = __commonJS({
    "node_modules/mammoth/lib/transforms.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      exports2.paragraph = paragraph;
      exports2.run = run;
      exports2._elements = elements;
      exports2._elementsOfType = elementsOfType;
      exports2.getDescendantsOfType = getDescendantsOfType;
      exports2.getDescendants = getDescendants;
      function paragraph(transform) {
        return elementsOfType("paragraph", transform);
      }
      function run(transform) {
        return elementsOfType("run", transform);
      }
      function elementsOfType(elementType, transform) {
        return elements(function(element) {
          if (element.type === elementType) {
            return transform(element);
          } else {
            return element;
          }
        });
      }
      function elements(transform) {
        return function transformElement(element) {
          if (element.children) {
            var children = _3.map(element.children, transformElement);
            element = _3.extend(element, { children });
          }
          return transform(element);
        };
      }
      function getDescendantsOfType(element, type) {
        return getDescendants(element).filter(function(descendant) {
          return descendant.type === type;
        });
      }
      function getDescendants(element) {
        var descendants = [];
        visitDescendants(element, function(descendant) {
          descendants.push(descendant);
        });
        return descendants;
      }
      function visitDescendants(element, visit) {
        if (element.children) {
          element.children.forEach(function(child) {
            visitDescendants(child, visit);
            visit(child);
          });
        }
      }
    }
  });

  // node_modules/mammoth/lib/docx/uris.js
  var require_uris = __commonJS({
    "node_modules/mammoth/lib/docx/uris.js"(exports2) {
      exports2.uriToZipEntryName = uriToZipEntryName;
      exports2.replaceFragment = replaceFragment;
      function uriToZipEntryName(base, uri) {
        if (uri.charAt(0) === "/") {
          return uri.substr(1);
        } else {
          return base + "/" + uri;
        }
      }
      function replaceFragment(uri, fragment) {
        var hashIndex = uri.indexOf("#");
        if (hashIndex !== -1) {
          uri = uri.substring(0, hashIndex);
        }
        return uri + "#" + fragment;
      }
    }
  });

  // node_modules/mammoth/lib/docx/body-reader.js
  var require_body_reader = __commonJS({
    "node_modules/mammoth/lib/docx/body-reader.js"(exports2) {
      exports2.createBodyReader = createBodyReader;
      exports2._readNumberingProperties = readNumberingProperties;
      var dingbatToUnicode = require_dist();
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var documents = require_documents();
      var Result = require_results().Result;
      var warning = require_results().warning;
      var xml = require_xml();
      var transforms = require_transforms();
      var uris = require_uris();
      function createBodyReader(options) {
        return {
          readXmlElement: function(element) {
            return new BodyReader(options).readXmlElement(element);
          },
          readXmlElements: function(elements) {
            return new BodyReader(options).readXmlElements(elements);
          }
        };
      }
      function BodyReader(options) {
        var complexFieldStack = [];
        var currentInstrText = [];
        var deletedParagraphContents = [];
        var relationships = options.relationships;
        var contentTypes = options.contentTypes;
        var docxFile = options.docxFile;
        var files = options.files;
        var numbering = options.numbering;
        var styles = options.styles;
        function readXmlElements(elements) {
          var results = elements.map(readXmlElement);
          return combineResults(results);
        }
        function readXmlElement(element) {
          if (element.type === "element") {
            var handler = xmlElementReaders[element.name];
            if (handler) {
              return handler(element);
            } else if (!Object.prototype.hasOwnProperty.call(ignoreElements, element.name)) {
              var message = warning("An unrecognised element was ignored: " + element.name);
              return emptyResultWithMessages([message]);
            }
          }
          return emptyResult();
        }
        function readParagraphProperties(element) {
          return readParagraphStyle(element).map(function(style) {
            return {
              type: "paragraphProperties",
              styleId: style.styleId,
              styleName: style.name,
              alignment: element.firstOrEmpty("w:jc").attributes["w:val"],
              numbering: readNumberingProperties(style.styleId, element.firstOrEmpty("w:numPr"), numbering),
              indent: readParagraphIndent(element.firstOrEmpty("w:ind"))
            };
          });
        }
        function readParagraphIndent(element) {
          return {
            start: element.attributes["w:start"] || element.attributes["w:left"],
            end: element.attributes["w:end"] || element.attributes["w:right"],
            firstLine: element.attributes["w:firstLine"],
            hanging: element.attributes["w:hanging"]
          };
        }
        function readRunProperties(element) {
          return readRunStyle(element).map(function(style) {
            var fontSizeString = element.firstOrEmpty("w:sz").attributes["w:val"];
            var fontSize = /^[0-9]+$/.test(fontSizeString) ? parseInt(fontSizeString, 10) / 2 : null;
            return {
              type: "runProperties",
              styleId: style.styleId,
              styleName: style.name,
              verticalAlignment: element.firstOrEmpty("w:vertAlign").attributes["w:val"],
              font: element.firstOrEmpty("w:rFonts").attributes["w:ascii"],
              fontSize,
              isBold: readBooleanElement(element.first("w:b")),
              isUnderline: readUnderline(element.first("w:u")),
              isItalic: readBooleanElement(element.first("w:i")),
              isStrikethrough: readBooleanElement(element.first("w:strike")),
              isAllCaps: readBooleanElement(element.first("w:caps")),
              isSmallCaps: readBooleanElement(element.first("w:smallCaps")),
              highlight: readHighlightValue(element.firstOrEmpty("w:highlight").attributes["w:val"])
            };
          });
        }
        function readUnderline(element) {
          if (element) {
            var value = element.attributes["w:val"];
            return value !== void 0 && value !== "false" && value !== "0" && value !== "none";
          } else {
            return false;
          }
        }
        function readBooleanElement(element) {
          if (element) {
            var value = element.attributes["w:val"];
            return value !== "false" && value !== "0";
          } else {
            return false;
          }
        }
        function readBooleanAttributeValue(value) {
          return value !== "false" && value !== "0";
        }
        function readHighlightValue(value) {
          if (!value || value === "none") {
            return null;
          } else {
            return value;
          }
        }
        function readParagraphStyle(element) {
          return readStyle(element, "w:pStyle", "Paragraph", styles.findParagraphStyleById);
        }
        function readRunStyle(element) {
          return readStyle(element, "w:rStyle", "Run", styles.findCharacterStyleById);
        }
        function readTableStyle(element) {
          return readStyle(element, "w:tblStyle", "Table", styles.findTableStyleById);
        }
        function readStyle(element, styleTagName, styleType, findStyleById) {
          var messages = [];
          var styleElement = element.first(styleTagName);
          var styleId = null;
          var name = null;
          if (styleElement) {
            styleId = styleElement.attributes["w:val"];
            if (styleId) {
              var style = findStyleById(styleId);
              if (style) {
                name = style.name;
              } else {
                messages.push(undefinedStyleWarning(styleType, styleId));
              }
            }
          }
          return elementResultWithMessages({ styleId, name }, messages);
        }
        function readFldChar(element) {
          var type = element.attributes["w:fldCharType"];
          if (type === "begin") {
            complexFieldStack.push({ type: "begin", fldChar: element });
            currentInstrText = [];
          } else if (type === "end") {
            var complexFieldEnd = complexFieldStack.pop();
            if (complexFieldEnd.type === "begin") {
              complexFieldEnd = parseCurrentInstrText(complexFieldEnd);
            }
            if (complexFieldEnd.type === "checkbox") {
              return elementResult(documents.checkbox({
                checked: complexFieldEnd.checked
              }));
            }
          } else if (type === "separate") {
            var complexFieldSeparate = complexFieldStack.pop();
            var complexField = parseCurrentInstrText(complexFieldSeparate);
            complexFieldStack.push(complexField);
          }
          return emptyResult();
        }
        function currentHyperlinkOptions() {
          var topHyperlink = _3.last(complexFieldStack.filter(function(complexField) {
            return complexField.type === "hyperlink";
          }));
          return topHyperlink ? topHyperlink.options : null;
        }
        function parseCurrentInstrText(complexField) {
          return parseInstrText(
            currentInstrText.join(""),
            complexField.type === "begin" ? complexField.fldChar : xml.emptyElement
          );
        }
        function parseInstrText(instrText, fldChar) {
          var linkResult = /^\s*HYPERLINK\s+(\\l\s+)?(?:"(.*)"|([^\\]\S*))/.exec(instrText);
          if (linkResult) {
            var location = linkResult[2] === void 0 ? linkResult[3] : linkResult[2];
            var options2 = linkResult[1] === void 0 ? { href: location } : { anchor: location };
            return { type: "hyperlink", options: options2 };
          }
          var checkboxResult = /\s*FORMCHECKBOX\s*/.exec(instrText);
          if (checkboxResult) {
            var checkboxElement = fldChar.firstOrEmpty("w:ffData").firstOrEmpty("w:checkBox");
            var checkedElement = checkboxElement.first("w:checked");
            var checked = checkedElement == null ? readBooleanElement(checkboxElement.first("w:default")) : readBooleanElement(checkedElement);
            return { type: "checkbox", checked };
          }
          return { type: "unknown" };
        }
        function readInstrText(element) {
          currentInstrText.push(element.text());
          return emptyResult();
        }
        function readSymbol(element) {
          var font = element.attributes["w:font"];
          var char = element.attributes["w:char"];
          var unicodeCharacter = dingbatToUnicode.hex(font, char);
          if (unicodeCharacter == null && /^F0..$/.test(char)) {
            unicodeCharacter = dingbatToUnicode.hex(font, char.substring(2));
          }
          if (unicodeCharacter == null) {
            return emptyResultWithMessages([warning(
              "A w:sym element with an unsupported character was ignored: char " + char + " in font " + font
            )]);
          } else {
            return elementResult(new documents.Text(unicodeCharacter.string));
          }
        }
        function noteReferenceReader(noteType) {
          return function(element) {
            var noteId = element.attributes["w:id"];
            return elementResult(new documents.NoteReference({
              noteType,
              noteId
            }));
          };
        }
        function readCommentReference(element) {
          return elementResult(documents.commentReference({
            commentId: element.attributes["w:id"]
          }));
        }
        function readChildElements(element) {
          return readXmlElements(element.children);
        }
        var xmlElementReaders = {
          "w:p": function(element) {
            var paragraphPropertiesElement = element.firstOrEmpty("w:pPr");
            var isDeleted = !!paragraphPropertiesElement.firstOrEmpty("w:rPr").first("w:del");
            if (isDeleted) {
              element.children.forEach(function(child) {
                deletedParagraphContents.push(child);
              });
              return emptyResult();
            } else {
              var childrenXml = element.children;
              if (deletedParagraphContents.length > 0) {
                childrenXml = deletedParagraphContents.concat(childrenXml);
                deletedParagraphContents = [];
              }
              return ReadResult.map(
                readParagraphProperties(paragraphPropertiesElement),
                readXmlElements(childrenXml),
                function(properties, children) {
                  return new documents.Paragraph(children, properties);
                }
              ).insertExtra();
            }
          },
          "w:r": function(element) {
            return ReadResult.map(
              readRunProperties(element.firstOrEmpty("w:rPr")),
              readXmlElements(element.children),
              function(properties, children) {
                var hyperlinkOptions = currentHyperlinkOptions();
                if (hyperlinkOptions !== null) {
                  children = [new documents.Hyperlink(children, hyperlinkOptions)];
                }
                return new documents.Run(children, properties);
              }
            );
          },
          "w:fldChar": readFldChar,
          "w:instrText": readInstrText,
          "w:t": function(element) {
            return elementResult(new documents.Text(element.text()));
          },
          "w:tab": function(element) {
            return elementResult(new documents.Tab());
          },
          "w:noBreakHyphen": function() {
            return elementResult(new documents.Text("\u2011"));
          },
          "w:softHyphen": function(element) {
            return elementResult(new documents.Text("\xAD"));
          },
          "w:sym": readSymbol,
          "w:hyperlink": function(element) {
            var relationshipId = element.attributes["r:id"];
            var anchor = element.attributes["w:anchor"];
            return readXmlElements(element.children).map(function(children) {
              function create2(options2) {
                var targetFrame = element.attributes["w:tgtFrame"] || null;
                return new documents.Hyperlink(
                  children,
                  _3.extend({ targetFrame }, options2)
                );
              }
              if (relationshipId) {
                var href = relationships.findTargetByRelationshipId(relationshipId);
                if (anchor) {
                  href = uris.replaceFragment(href, anchor);
                }
                return create2({ href });
              } else if (anchor) {
                return create2({ anchor });
              } else {
                return children;
              }
            });
          },
          "w:tbl": readTable,
          "w:tr": readTableRow,
          "w:tc": readTableCell,
          "w:footnoteReference": noteReferenceReader("footnote"),
          "w:endnoteReference": noteReferenceReader("endnote"),
          "w:commentReference": readCommentReference,
          "w:br": function(element) {
            var breakType = element.attributes["w:type"];
            if (breakType == null || breakType === "textWrapping") {
              return elementResult(documents.lineBreak);
            } else if (breakType === "page") {
              return elementResult(documents.pageBreak);
            } else if (breakType === "column") {
              return elementResult(documents.columnBreak);
            } else {
              return emptyResultWithMessages([warning("Unsupported break type: " + breakType)]);
            }
          },
          "w:bookmarkStart": function(element) {
            var name = element.attributes["w:name"];
            if (name === "_GoBack") {
              return emptyResult();
            } else {
              return elementResult(new documents.BookmarkStart({ name }));
            }
          },
          "mc:AlternateContent": function(element) {
            return readChildElements(element.firstOrEmpty("mc:Fallback"));
          },
          "w:sdt": function(element) {
            var contentResult = readXmlElements(element.firstOrEmpty("w:sdtContent").children);
            return contentResult.map(function(content) {
              var checkbox = element.firstOrEmpty("w:sdtPr").first("wordml:checkbox");
              if (checkbox) {
                var checkedElement = checkbox.first("wordml:checked");
                var isChecked = !!checkedElement && readBooleanAttributeValue(
                  checkedElement.attributes["wordml:val"]
                );
                var documentCheckbox = documents.checkbox({
                  checked: isChecked
                });
                var hasCheckbox = false;
                var replacedContent = content.map(transforms._elementsOfType(
                  documents.types.text,
                  function(text) {
                    if (text.value.length > 0 && !hasCheckbox) {
                      hasCheckbox = true;
                      return documentCheckbox;
                    } else {
                      return text;
                    }
                  }
                ));
                if (hasCheckbox) {
                  return replacedContent;
                } else {
                  return documentCheckbox;
                }
              } else {
                return content;
              }
            });
          },
          "w:ins": readChildElements,
          "w:object": readChildElements,
          "w:smartTag": readChildElements,
          "w:drawing": readChildElements,
          "w:pict": function(element) {
            return readChildElements(element).toExtra();
          },
          "v:roundrect": readChildElements,
          "v:shape": readChildElements,
          "v:textbox": readChildElements,
          "w:txbxContent": readChildElements,
          "wp:inline": readDrawingElement,
          "wp:anchor": readDrawingElement,
          "v:imagedata": readImageData,
          "v:group": readChildElements,
          "v:rect": readChildElements
        };
        return {
          readXmlElement,
          readXmlElements
        };
        function readTable(element) {
          var propertiesResult = readTableProperties(element.firstOrEmpty("w:tblPr"));
          return readXmlElements(element.children).flatMap(calculateRowSpans).flatMap(function(children) {
            return propertiesResult.map(function(properties) {
              return documents.Table(children, properties);
            });
          });
        }
        function readTableProperties(element) {
          return readTableStyle(element).map(function(style) {
            return {
              styleId: style.styleId,
              styleName: style.name
            };
          });
        }
        function readTableRow(element) {
          var properties = element.firstOrEmpty("w:trPr");
          var isDeleted = !!properties.first("w:del");
          if (isDeleted) {
            return emptyResult();
          }
          var isHeader = !!properties.first("w:tblHeader");
          return readXmlElements(element.children).map(function(children) {
            return documents.TableRow(children, { isHeader });
          });
        }
        function readTableCell(element) {
          return readXmlElements(element.children).map(function(children) {
            var properties = element.firstOrEmpty("w:tcPr");
            var gridSpan = properties.firstOrEmpty("w:gridSpan").attributes["w:val"];
            var colSpan = gridSpan ? parseInt(gridSpan, 10) : 1;
            var cell = documents.TableCell(children, { colSpan });
            cell._vMerge = readVMerge(properties);
            return cell;
          });
        }
        function readVMerge(properties) {
          var element = properties.first("w:vMerge");
          if (element) {
            var val = element.attributes["w:val"];
            return val === "continue" || !val;
          } else {
            return null;
          }
        }
        function calculateRowSpans(rows) {
          var unexpectedNonRows = _3.any(rows, function(row) {
            return row.type !== documents.types.tableRow;
          });
          if (unexpectedNonRows) {
            removeVMergeProperties(rows);
            return elementResultWithMessages(rows, [warning(
              "unexpected non-row element in table, cell merging may be incorrect"
            )]);
          }
          var unexpectedNonCells = _3.any(rows, function(row) {
            return _3.any(row.children, function(cell) {
              return cell.type !== documents.types.tableCell;
            });
          });
          if (unexpectedNonCells) {
            removeVMergeProperties(rows);
            return elementResultWithMessages(rows, [warning(
              "unexpected non-cell element in table row, cell merging may be incorrect"
            )]);
          }
          var columns = {};
          rows.forEach(function(row) {
            var cellIndex = 0;
            row.children.forEach(function(cell) {
              if (cell._vMerge && columns[cellIndex]) {
                columns[cellIndex].rowSpan++;
              } else {
                columns[cellIndex] = cell;
                cell._vMerge = false;
              }
              cellIndex += cell.colSpan;
            });
          });
          rows.forEach(function(row) {
            row.children = row.children.filter(function(cell) {
              return !cell._vMerge;
            });
            row.children.forEach(function(cell) {
              delete cell._vMerge;
            });
          });
          return elementResult(rows);
        }
        function removeVMergeProperties(rows) {
          rows.forEach(function(row) {
            var cells = transforms.getDescendantsOfType(row, documents.types.tableCell);
            cells.forEach(function(cell) {
              delete cell._vMerge;
            });
          });
        }
        function readDrawingElement(element) {
          var blips = element.getElementsByTagName("a:graphic").getElementsByTagName("a:graphicData").getElementsByTagName("pic:pic").getElementsByTagName("pic:blipFill").getElementsByTagName("a:blip");
          return combineResults(blips.map(readBlip.bind(null, element)));
        }
        function readBlip(element, blip) {
          var propertiesElement = element.firstOrEmpty("wp:docPr");
          var properties = propertiesElement.attributes;
          var altText = isBlank2(properties.descr) ? properties.title : properties.descr;
          var blipImageFile = findBlipImageFile(blip);
          if (blipImageFile === null) {
            return emptyResultWithMessages([warning("Could not find image file for a:blip element")]);
          }
          return readImage(blipImageFile, altText).map(function(imageElement) {
            var hlinkClickElement = propertiesElement.firstOrEmpty("a:hlinkClick");
            var relationshipId = hlinkClickElement.attributes["r:id"];
            if (relationshipId) {
              var href = relationships.findTargetByRelationshipId(relationshipId);
              return new documents.Hyperlink([imageElement], { href });
            } else {
              return imageElement;
            }
          });
        }
        function isBlank2(value) {
          return value == null || /^\s*$/.test(value);
        }
        function findBlipImageFile(blip) {
          var embedRelationshipId = blip.attributes["r:embed"];
          var linkRelationshipId = blip.attributes["r:link"];
          if (embedRelationshipId) {
            return findEmbeddedImageFile(embedRelationshipId);
          } else if (linkRelationshipId) {
            var imagePath = relationships.findTargetByRelationshipId(linkRelationshipId);
            return {
              path: imagePath,
              read: files.read.bind(files, imagePath)
            };
          } else {
            return null;
          }
        }
        function readImageData(element) {
          var relationshipId = element.attributes["r:id"];
          if (relationshipId) {
            return readImage(
              findEmbeddedImageFile(relationshipId),
              element.attributes["o:title"]
            );
          } else {
            return emptyResultWithMessages([warning("A v:imagedata element without a relationship ID was ignored")]);
          }
        }
        function findEmbeddedImageFile(relationshipId) {
          var path = uris.uriToZipEntryName("word", relationships.findTargetByRelationshipId(relationshipId));
          return {
            path,
            read: docxFile.read.bind(docxFile, path)
          };
        }
        function readImage(imageFile, altText) {
          var contentType = contentTypes.findContentType(imageFile.path);
          var image = documents.Image({
            readImage: imageFile.read,
            altText,
            contentType
          });
          var warnings = supportedImageTypes[contentType] ? [] : warning("Image of type " + contentType + " is unlikely to display in web browsers");
          return elementResultWithMessages(image, warnings);
        }
        function undefinedStyleWarning(type, styleId) {
          return warning(
            type + " style with ID " + styleId + " was referenced but not defined in the document"
          );
        }
      }
      function readNumberingProperties(styleId, element, numbering) {
        var level = element.firstOrEmpty("w:ilvl").attributes["w:val"];
        var numId = element.firstOrEmpty("w:numId").attributes["w:val"];
        if (level !== void 0 && numId !== void 0) {
          return numbering.findLevel(numId, level);
        }
        if (styleId != null) {
          var levelByStyleId = numbering.findLevelByParagraphStyleId(styleId);
          if (levelByStyleId != null) {
            return levelByStyleId;
          }
        }
        if (numId !== void 0) {
          return numbering.findLevel(numId, "0");
        }
        return null;
      }
      var supportedImageTypes = {
        "image/png": true,
        "image/gif": true,
        "image/jpeg": true,
        "image/svg+xml": true,
        "image/tiff": true
      };
      var ignoreElements = {
        "office-word:wrap": true,
        "v:shadow": true,
        "v:shapetype": true,
        "w:annotationRef": true,
        "w:bookmarkEnd": true,
        "w:sectPr": true,
        "w:proofErr": true,
        "w:lastRenderedPageBreak": true,
        "w:commentRangeStart": true,
        "w:commentRangeEnd": true,
        "w:del": true,
        "w:footnoteRef": true,
        "w:endnoteRef": true,
        "w:pPr": true,
        "w:rPr": true,
        "w:tblPr": true,
        "w:tblGrid": true,
        "w:trPr": true,
        "w:tcPr": true
      };
      function emptyResultWithMessages(messages) {
        return new ReadResult(null, null, messages);
      }
      function emptyResult() {
        return new ReadResult(null);
      }
      function elementResult(element) {
        return new ReadResult(element);
      }
      function elementResultWithMessages(element, messages) {
        return new ReadResult(element, null, messages);
      }
      function ReadResult(element, extra, messages) {
        this.value = element || [];
        this.extra = extra || [];
        this._result = new Result({
          element: this.value,
          extra
        }, messages);
        this.messages = this._result.messages;
      }
      ReadResult.prototype.toExtra = function() {
        return new ReadResult(null, joinElements(this.extra, this.value), this.messages);
      };
      ReadResult.prototype.insertExtra = function() {
        var extra = this.extra;
        if (extra && extra.length) {
          return new ReadResult(joinElements(this.value, extra), null, this.messages);
        } else {
          return this;
        }
      };
      ReadResult.prototype.map = function(func) {
        var result2 = this._result.map(function(value) {
          return func(value.element);
        });
        return new ReadResult(result2.value, this.extra, result2.messages);
      };
      ReadResult.prototype.flatMap = function(func) {
        var result2 = this._result.flatMap(function(value) {
          return func(value.element)._result;
        });
        return new ReadResult(result2.value.element, joinElements(this.extra, result2.value.extra), result2.messages);
      };
      ReadResult.map = function(first2, second, func) {
        return new ReadResult(
          func(first2.value, second.value),
          joinElements(first2.extra, second.extra),
          first2.messages.concat(second.messages)
        );
      };
      function combineResults(results) {
        var result2 = Result.combine(_3.pluck(results, "_result"));
        return new ReadResult(
          _3.flatten(_3.pluck(result2.value, "element")),
          _3.filter(_3.flatten(_3.pluck(result2.value, "extra")), identity2),
          result2.messages
        );
      }
      function joinElements(first2, second) {
        return _3.flatten([first2, second]);
      }
      function identity2(value) {
        return value;
      }
    }
  });

  // node_modules/mammoth/lib/docx/document-xml-reader.js
  var require_document_xml_reader = __commonJS({
    "node_modules/mammoth/lib/docx/document-xml-reader.js"(exports2) {
      exports2.DocumentXmlReader = DocumentXmlReader;
      var documents = require_documents();
      var Result = require_results().Result;
      function DocumentXmlReader(options) {
        var bodyReader = options.bodyReader;
        function convertXmlToDocument(element) {
          var body = element.first("w:body");
          if (body == null) {
            throw new Error("Could not find the body element: are you sure this is a docx file?");
          }
          var result2 = bodyReader.readXmlElements(body.children).map(function(children) {
            return new documents.Document(children, {
              notes: options.notes,
              comments: options.comments
            });
          });
          return new Result(result2.value, result2.messages);
        }
        return {
          convertXmlToDocument
        };
      }
    }
  });

  // node_modules/mammoth/lib/docx/relationships-reader.js
  var require_relationships_reader = __commonJS({
    "node_modules/mammoth/lib/docx/relationships-reader.js"(exports2) {
      exports2.readRelationships = readRelationships;
      exports2.defaultValue = new Relationships([]);
      exports2.Relationships = Relationships;
      function readRelationships(element) {
        var relationships = [];
        element.children.forEach(function(child) {
          if (child.name === "relationships:Relationship") {
            var relationship = {
              relationshipId: child.attributes.Id,
              target: child.attributes.Target,
              type: child.attributes.Type
            };
            relationships.push(relationship);
          }
        });
        return new Relationships(relationships);
      }
      function Relationships(relationships) {
        var targetsByRelationshipId = {};
        relationships.forEach(function(relationship) {
          targetsByRelationshipId[relationship.relationshipId] = relationship.target;
        });
        var targetsByType = {};
        relationships.forEach(function(relationship) {
          if (!targetsByType[relationship.type]) {
            targetsByType[relationship.type] = [];
          }
          targetsByType[relationship.type].push(relationship.target);
        });
        return {
          findTargetByRelationshipId: function(relationshipId) {
            return targetsByRelationshipId[relationshipId];
          },
          findTargetsByType: function(type) {
            return targetsByType[type] || [];
          }
        };
      }
    }
  });

  // node_modules/mammoth/lib/docx/content-types-reader.js
  var require_content_types_reader = __commonJS({
    "node_modules/mammoth/lib/docx/content-types-reader.js"(exports2) {
      exports2.readContentTypesFromXml = readContentTypesFromXml;
      var fallbackContentTypes = {
        "png": "png",
        "gif": "gif",
        "jpeg": "jpeg",
        "jpg": "jpeg",
        "tif": "tiff",
        "tiff": "tiff",
        "bmp": "bmp"
      };
      exports2.defaultContentTypes = contentTypes({}, {});
      function readContentTypesFromXml(element) {
        var extensionDefaults = {};
        var overrides = {};
        element.children.forEach(function(child) {
          if (child.name === "content-types:Default") {
            extensionDefaults[child.attributes.Extension] = child.attributes.ContentType;
          }
          if (child.name === "content-types:Override") {
            var name = child.attributes.PartName;
            if (name.charAt(0) === "/") {
              name = name.substring(1);
            }
            overrides[name] = child.attributes.ContentType;
          }
        });
        return contentTypes(overrides, extensionDefaults);
      }
      function contentTypes(overrides, extensionDefaults) {
        return {
          findContentType: function(path) {
            var overrideContentType = overrides[path];
            if (overrideContentType) {
              return overrideContentType;
            } else {
              var pathParts = path.split(".");
              var extension = pathParts[pathParts.length - 1];
              if (extensionDefaults.hasOwnProperty(extension)) {
                return extensionDefaults[extension];
              } else {
                var fallback = fallbackContentTypes[extension.toLowerCase()];
                if (fallback) {
                  return "image/" + fallback;
                } else {
                  return null;
                }
              }
            }
          }
        };
      }
    }
  });

  // node_modules/mammoth/lib/docx/numbering-xml.js
  var require_numbering_xml = __commonJS({
    "node_modules/mammoth/lib/docx/numbering-xml.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      exports2.readNumberingXml = readNumberingXml;
      exports2.Numbering = Numbering;
      exports2.defaultNumbering = new Numbering({}, {});
      function Numbering(nums, abstractNums, styles) {
        var allLevels = _3.flatten(_3.values(abstractNums).map(function(abstractNum) {
          return _3.values(abstractNum.levels);
        }));
        var levelsByParagraphStyleId = _3.indexBy(
          allLevels.filter(function(level) {
            return level.paragraphStyleId != null;
          }),
          "paragraphStyleId"
        );
        function findLevel(numId, level) {
          var num = nums[numId];
          if (num) {
            var abstractNum = abstractNums[num.abstractNumId];
            if (!abstractNum) {
              return null;
            } else if (abstractNum.numStyleLink == null) {
              return abstractNums[num.abstractNumId].levels[level];
            } else {
              var style = styles.findNumberingStyleById(abstractNum.numStyleLink);
              return findLevel(style.numId, level);
            }
          } else {
            return null;
          }
        }
        function findLevelByParagraphStyleId(styleId) {
          return levelsByParagraphStyleId[styleId] || null;
        }
        return {
          findLevel,
          findLevelByParagraphStyleId
        };
      }
      function readNumberingXml(root3, options) {
        if (!options || !options.styles) {
          throw new Error("styles is missing");
        }
        var abstractNums = readAbstractNums(root3);
        var nums = readNums(root3, abstractNums);
        return new Numbering(nums, abstractNums, options.styles);
      }
      function readAbstractNums(root3) {
        var abstractNums = {};
        root3.getElementsByTagName("w:abstractNum").forEach(function(element) {
          var id = element.attributes["w:abstractNumId"];
          abstractNums[id] = readAbstractNum(element);
        });
        return abstractNums;
      }
      function readAbstractNum(element) {
        var levels = {};
        var levelWithoutIndex = null;
        element.getElementsByTagName("w:lvl").forEach(function(levelElement) {
          var levelIndex = levelElement.attributes["w:ilvl"];
          var numFmt = levelElement.firstOrEmpty("w:numFmt").attributes["w:val"];
          var isOrdered = numFmt !== "bullet";
          var paragraphStyleId = levelElement.firstOrEmpty("w:pStyle").attributes["w:val"];
          if (levelIndex === void 0) {
            levelWithoutIndex = {
              isOrdered,
              level: "0",
              paragraphStyleId
            };
          } else {
            levels[levelIndex] = {
              isOrdered,
              level: levelIndex,
              paragraphStyleId
            };
          }
        });
        if (levelWithoutIndex !== null && levels[levelWithoutIndex.level] === void 0) {
          levels[levelWithoutIndex.level] = levelWithoutIndex;
        }
        var numStyleLink = element.firstOrEmpty("w:numStyleLink").attributes["w:val"];
        return { levels, numStyleLink };
      }
      function readNums(root3) {
        var nums = {};
        root3.getElementsByTagName("w:num").forEach(function(element) {
          var numId = element.attributes["w:numId"];
          var abstractNumId = element.first("w:abstractNumId").attributes["w:val"];
          nums[numId] = { abstractNumId };
        });
        return nums;
      }
    }
  });

  // node_modules/mammoth/lib/docx/styles-reader.js
  var require_styles_reader = __commonJS({
    "node_modules/mammoth/lib/docx/styles-reader.js"(exports2) {
      exports2.readStylesXml = readStylesXml;
      exports2.Styles = Styles;
      exports2.defaultStyles = new Styles({}, {});
      function Styles(paragraphStyles, characterStyles, tableStyles, numberingStyles) {
        return {
          findParagraphStyleById: function(styleId) {
            return paragraphStyles[styleId];
          },
          findCharacterStyleById: function(styleId) {
            return characterStyles[styleId];
          },
          findTableStyleById: function(styleId) {
            return tableStyles[styleId];
          },
          findNumberingStyleById: function(styleId) {
            return numberingStyles[styleId];
          }
        };
      }
      Styles.EMPTY = new Styles({}, {}, {}, {});
      function readStylesXml(root3) {
        var paragraphStyles = {};
        var characterStyles = {};
        var tableStyles = {};
        var numberingStyles = {};
        var styles = {
          "paragraph": paragraphStyles,
          "character": characterStyles,
          "table": tableStyles,
          "numbering": numberingStyles
        };
        root3.getElementsByTagName("w:style").forEach(function(styleElement) {
          var style = readStyleElement(styleElement);
          var styleSet = styles[style.type];
          if (styleSet && styleSet[style.styleId] === void 0) {
            styleSet[style.styleId] = style;
          }
        });
        return new Styles(paragraphStyles, characterStyles, tableStyles, numberingStyles);
      }
      function readStyleElement(styleElement) {
        var type = styleElement.attributes["w:type"];
        if (type === "numbering") {
          return readNumberingStyleElement(type, styleElement);
        } else {
          var styleId = readStyleId(styleElement);
          var name = styleName(styleElement);
          return { type, styleId, name };
        }
      }
      function styleName(styleElement) {
        var nameElement = styleElement.first("w:name");
        return nameElement ? nameElement.attributes["w:val"] : null;
      }
      function readNumberingStyleElement(type, styleElement) {
        var styleId = readStyleId(styleElement);
        var numId = styleElement.firstOrEmpty("w:pPr").firstOrEmpty("w:numPr").firstOrEmpty("w:numId").attributes["w:val"];
        return { type, numId, styleId };
      }
      function readStyleId(styleElement) {
        return styleElement.attributes["w:styleId"];
      }
    }
  });

  // node_modules/mammoth/lib/docx/notes-reader.js
  var require_notes_reader = __commonJS({
    "node_modules/mammoth/lib/docx/notes-reader.js"(exports2) {
      var documents = require_documents();
      var Result = require_results().Result;
      exports2.createFootnotesReader = createReader.bind(exports2, "footnote");
      exports2.createEndnotesReader = createReader.bind(exports2, "endnote");
      function createReader(noteType, bodyReader) {
        function readNotesXml(element) {
          return Result.combine(element.getElementsByTagName("w:" + noteType).filter(isFootnoteElement).map(readFootnoteElement));
        }
        function isFootnoteElement(element) {
          var type = element.attributes["w:type"];
          return type !== "continuationSeparator" && type !== "separator";
        }
        function readFootnoteElement(footnoteElement) {
          var id = footnoteElement.attributes["w:id"];
          return bodyReader.readXmlElements(footnoteElement.children).map(function(body) {
            return documents.Note({ noteType, noteId: id, body });
          });
        }
        return readNotesXml;
      }
    }
  });

  // node_modules/mammoth/lib/docx/comments-reader.js
  var require_comments_reader = __commonJS({
    "node_modules/mammoth/lib/docx/comments-reader.js"(exports2) {
      var documents = require_documents();
      var Result = require_results().Result;
      function createCommentsReader(bodyReader) {
        function readCommentsXml(element) {
          return Result.combine(element.getElementsByTagName("w:comment").map(readCommentElement));
        }
        function readCommentElement(element) {
          var id = element.attributes["w:id"];
          function readOptionalAttribute(name) {
            return (element.attributes[name] || "").trim() || null;
          }
          return bodyReader.readXmlElements(element.children).map(function(body) {
            return documents.comment({
              commentId: id,
              body,
              authorName: readOptionalAttribute("w:author"),
              authorInitials: readOptionalAttribute("w:initials")
            });
          });
        }
        return readCommentsXml;
      }
      exports2.createCommentsReader = createCommentsReader;
    }
  });

  // node_modules/mammoth/browser/docx/files.js
  var require_files = __commonJS({
    "node_modules/mammoth/browser/docx/files.js"(exports2) {
      var promises = require_promises();
      exports2.Files = Files;
      function Files() {
        function read(uri) {
          return promises.reject(new Error("could not open external image: '" + uri + "'\ncannot open linked files from a web browser"));
        }
        return {
          read
        };
      }
    }
  });

  // node_modules/mammoth/lib/docx/docx-reader.js
  var require_docx_reader = __commonJS({
    "node_modules/mammoth/lib/docx/docx-reader.js"(exports2) {
      exports2.read = read;
      exports2._findPartPaths = findPartPaths;
      var promises = require_promises();
      var documents = require_documents();
      var Result = require_results().Result;
      var zipfile = require_zipfile();
      var readXmlFromZipFile = require_office_xml_reader().readXmlFromZipFile;
      var createBodyReader = require_body_reader().createBodyReader;
      var DocumentXmlReader = require_document_xml_reader().DocumentXmlReader;
      var relationshipsReader = require_relationships_reader();
      var contentTypesReader = require_content_types_reader();
      var numberingXml = require_numbering_xml();
      var stylesReader = require_styles_reader();
      var notesReader = require_notes_reader();
      var commentsReader = require_comments_reader();
      var Files = require_files().Files;
      function read(docxFile, input, options) {
        input = input || {};
        options = options || {};
        var files = new Files({
          externalFileAccess: options.externalFileAccess,
          relativeToFile: input.path
        });
        return promises.props({
          contentTypes: readContentTypesFromZipFile(docxFile),
          partPaths: findPartPaths(docxFile),
          docxFile,
          files
        }).also(function(result2) {
          return {
            styles: readStylesFromZipFile(docxFile, result2.partPaths.styles)
          };
        }).also(function(result2) {
          return {
            numbering: readNumberingFromZipFile(docxFile, result2.partPaths.numbering, result2.styles)
          };
        }).also(function(result2) {
          return {
            footnotes: readXmlFileWithBody(result2.partPaths.footnotes, result2, function(bodyReader, xml) {
              if (xml) {
                return notesReader.createFootnotesReader(bodyReader)(xml);
              } else {
                return new Result([]);
              }
            }),
            endnotes: readXmlFileWithBody(result2.partPaths.endnotes, result2, function(bodyReader, xml) {
              if (xml) {
                return notesReader.createEndnotesReader(bodyReader)(xml);
              } else {
                return new Result([]);
              }
            }),
            comments: readXmlFileWithBody(result2.partPaths.comments, result2, function(bodyReader, xml) {
              if (xml) {
                return commentsReader.createCommentsReader(bodyReader)(xml);
              } else {
                return new Result([]);
              }
            })
          };
        }).also(function(result2) {
          return {
            notes: result2.footnotes.flatMap(function(footnotes) {
              return result2.endnotes.map(function(endnotes) {
                return new documents.Notes(footnotes.concat(endnotes));
              });
            })
          };
        }).then(function(result2) {
          return readXmlFileWithBody(result2.partPaths.mainDocument, result2, function(bodyReader, xml) {
            return result2.notes.flatMap(function(notes) {
              return result2.comments.flatMap(function(comments) {
                var reader = new DocumentXmlReader({
                  bodyReader,
                  notes,
                  comments
                });
                return reader.convertXmlToDocument(xml);
              });
            });
          });
        });
      }
      function findPartPaths(docxFile) {
        return readPackageRelationships(docxFile).then(function(packageRelationships) {
          var mainDocumentPath = findPartPath({
            docxFile,
            relationships: packageRelationships,
            relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
            basePath: "",
            fallbackPath: "word/document.xml"
          });
          if (!docxFile.exists(mainDocumentPath)) {
            throw new Error("Could not find main document part. Are you sure this is a valid .docx file?");
          }
          return xmlFileReader({
            filename: relationshipsFilename(mainDocumentPath),
            readElement: relationshipsReader.readRelationships,
            defaultValue: relationshipsReader.defaultValue
          })(docxFile).then(function(documentRelationships) {
            function findPartRelatedToMainDocument(name) {
              return findPartPath({
                docxFile,
                relationships: documentRelationships,
                relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" + name,
                basePath: zipfile.splitPath(mainDocumentPath).dirname,
                fallbackPath: "word/" + name + ".xml"
              });
            }
            return {
              mainDocument: mainDocumentPath,
              comments: findPartRelatedToMainDocument("comments"),
              endnotes: findPartRelatedToMainDocument("endnotes"),
              footnotes: findPartRelatedToMainDocument("footnotes"),
              numbering: findPartRelatedToMainDocument("numbering"),
              styles: findPartRelatedToMainDocument("styles")
            };
          });
        });
      }
      function findPartPath(options) {
        var docxFile = options.docxFile;
        var relationships = options.relationships;
        var relationshipType = options.relationshipType;
        var basePath = options.basePath;
        var fallbackPath = options.fallbackPath;
        var targets = relationships.findTargetsByType(relationshipType);
        var normalisedTargets = targets.map(function(target) {
          return stripPrefix(zipfile.joinPath(basePath, target), "/");
        });
        var validTargets = normalisedTargets.filter(function(target) {
          return docxFile.exists(target);
        });
        if (validTargets.length === 0) {
          return fallbackPath;
        } else {
          return validTargets[0];
        }
      }
      function stripPrefix(value, prefix) {
        if (value.substring(0, prefix.length) === prefix) {
          return value.substring(prefix.length);
        } else {
          return value;
        }
      }
      function xmlFileReader(options) {
        return function(zipFile) {
          return readXmlFromZipFile(zipFile, options.filename).then(function(element) {
            return element ? options.readElement(element) : options.defaultValue;
          });
        };
      }
      function readXmlFileWithBody(filename, options, func) {
        var readRelationshipsFromZipFile = xmlFileReader({
          filename: relationshipsFilename(filename),
          readElement: relationshipsReader.readRelationships,
          defaultValue: relationshipsReader.defaultValue
        });
        return readRelationshipsFromZipFile(options.docxFile).then(function(relationships) {
          var bodyReader = new createBodyReader({
            relationships,
            contentTypes: options.contentTypes,
            docxFile: options.docxFile,
            numbering: options.numbering,
            styles: options.styles,
            files: options.files
          });
          return readXmlFromZipFile(options.docxFile, filename).then(function(xml) {
            return func(bodyReader, xml);
          });
        });
      }
      function relationshipsFilename(filename) {
        var split = zipfile.splitPath(filename);
        return zipfile.joinPath(split.dirname, "_rels", split.basename + ".rels");
      }
      var readContentTypesFromZipFile = xmlFileReader({
        filename: "[Content_Types].xml",
        readElement: contentTypesReader.readContentTypesFromXml,
        defaultValue: contentTypesReader.defaultContentTypes
      });
      function readNumberingFromZipFile(zipFile, path, styles) {
        return xmlFileReader({
          filename: path,
          readElement: function(element) {
            return numberingXml.readNumberingXml(element, { styles });
          },
          defaultValue: numberingXml.defaultNumbering
        })(zipFile);
      }
      function readStylesFromZipFile(zipFile, path) {
        return xmlFileReader({
          filename: path,
          readElement: stylesReader.readStylesXml,
          defaultValue: stylesReader.defaultStyles
        })(zipFile);
      }
      var readPackageRelationships = xmlFileReader({
        filename: "_rels/.rels",
        readElement: relationshipsReader.readRelationships,
        defaultValue: relationshipsReader.defaultValue
      });
    }
  });

  // node_modules/mammoth/lib/docx/style-map.js
  var require_style_map = __commonJS({
    "node_modules/mammoth/lib/docx/style-map.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var promises = require_promises();
      var xml = require_xml();
      exports2.writeStyleMap = writeStyleMap;
      exports2.readStyleMap = readStyleMap;
      var schema = "http://schemas.zwobble.org/mammoth/style-map";
      var styleMapPath = "mammoth/style-map";
      var styleMapAbsolutePath = "/" + styleMapPath;
      function writeStyleMap(docxFile, styleMap) {
        docxFile.write(styleMapPath, styleMap);
        return updateRelationships(docxFile).then(function() {
          return updateContentTypes(docxFile);
        });
      }
      function updateRelationships(docxFile) {
        var path = "word/_rels/document.xml.rels";
        var relationshipsUri = "http://schemas.openxmlformats.org/package/2006/relationships";
        var relationshipElementName = "{" + relationshipsUri + "}Relationship";
        return docxFile.read(path, "utf8").then(xml.readString).then(function(relationshipsContainer) {
          var relationships = relationshipsContainer.children;
          addOrUpdateElement(relationships, relationshipElementName, "Id", {
            "Id": "rMammothStyleMap",
            "Type": schema,
            "Target": styleMapAbsolutePath
          });
          var namespaces = { "": relationshipsUri };
          return docxFile.write(path, xml.writeString(relationshipsContainer, namespaces));
        });
      }
      function updateContentTypes(docxFile) {
        var path = "[Content_Types].xml";
        var contentTypesUri = "http://schemas.openxmlformats.org/package/2006/content-types";
        var overrideName = "{" + contentTypesUri + "}Override";
        return docxFile.read(path, "utf8").then(xml.readString).then(function(typesElement) {
          var children = typesElement.children;
          addOrUpdateElement(children, overrideName, "PartName", {
            "PartName": styleMapAbsolutePath,
            "ContentType": "text/prs.mammoth.style-map"
          });
          var namespaces = { "": contentTypesUri };
          return docxFile.write(path, xml.writeString(typesElement, namespaces));
        });
      }
      function addOrUpdateElement(elements, name, identifyingAttribute, attributes) {
        var existingElement = _3.find(elements, function(element) {
          return element.name === name && element.attributes[identifyingAttribute] === attributes[identifyingAttribute];
        });
        if (existingElement) {
          existingElement.attributes = attributes;
        } else {
          elements.push(xml.element(name, attributes));
        }
      }
      function readStyleMap(docxFile) {
        if (docxFile.exists(styleMapPath)) {
          return docxFile.read(styleMapPath, "utf8");
        } else {
          return promises.resolve(null);
        }
      }
    }
  });

  // node_modules/mammoth/lib/html/ast.js
  var require_ast = __commonJS({
    "node_modules/mammoth/lib/html/ast.js"(exports2) {
      var htmlPaths = require_html_paths();
      function nonFreshElement(tagName, attributes, children) {
        return elementWithTag(
          htmlPaths.element(tagName, attributes, { fresh: false }),
          children
        );
      }
      function freshElement(tagName, attributes, children) {
        var tag = htmlPaths.element(tagName, attributes, { fresh: true });
        return elementWithTag(tag, children);
      }
      function elementWithTag(tag, children) {
        return {
          type: "element",
          tag,
          children: children || []
        };
      }
      function text(value) {
        return {
          type: "text",
          value
        };
      }
      var forceWrite = {
        type: "forceWrite"
      };
      exports2.freshElement = freshElement;
      exports2.nonFreshElement = nonFreshElement;
      exports2.elementWithTag = elementWithTag;
      exports2.text = text;
      exports2.forceWrite = forceWrite;
      var voidTagNames = {
        "br": true,
        "hr": true,
        "img": true,
        "input": true
      };
      function isVoidElement(node) {
        return node.children.length === 0 && voidTagNames[node.tag.tagName];
      }
      exports2.isVoidElement = isVoidElement;
    }
  });

  // node_modules/mammoth/lib/html/simplify.js
  var require_simplify = __commonJS({
    "node_modules/mammoth/lib/html/simplify.js"(exports2, module2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var ast = require_ast();
      function simplify(nodes) {
        return collapse(removeEmpty(nodes));
      }
      function collapse(nodes) {
        var children = [];
        nodes.map(collapseNode).forEach(function(child) {
          appendChild(children, child);
        });
        return children;
      }
      function collapseNode(node) {
        return collapsers[node.type](node);
      }
      var collapsers = {
        element: collapseElement,
        text: identity2,
        forceWrite: identity2
      };
      function collapseElement(node) {
        return ast.elementWithTag(node.tag, collapse(node.children));
      }
      function identity2(value) {
        return value;
      }
      function appendChild(children, child) {
        var lastChild = children[children.length - 1];
        if (child.type === "element" && !child.tag.fresh && lastChild && lastChild.type === "element" && child.tag.matchesElement(lastChild.tag)) {
          if (child.tag.separator) {
            appendChild(lastChild.children, ast.text(child.tag.separator));
          }
          child.children.forEach(function(grandChild) {
            appendChild(lastChild.children, grandChild);
          });
        } else {
          children.push(child);
        }
      }
      function removeEmpty(nodes) {
        return flatMap(nodes, function(node) {
          return emptiers[node.type](node);
        });
      }
      function flatMap(values2, func) {
        return _3.flatten(_3.map(values2, func), true);
      }
      var emptiers = {
        element: elementEmptier,
        text: textEmptier,
        forceWrite: neverEmpty
      };
      function neverEmpty(node) {
        return [node];
      }
      function elementEmptier(element) {
        var children = removeEmpty(element.children);
        if (children.length === 0 && !ast.isVoidElement(element)) {
          return [];
        } else {
          return [ast.elementWithTag(element.tag, children)];
        }
      }
      function textEmptier(node) {
        if (node.value.length === 0) {
          return [];
        } else {
          return [node];
        }
      }
      module2.exports = simplify;
    }
  });

  // node_modules/mammoth/lib/html/index.js
  var require_html = __commonJS({
    "node_modules/mammoth/lib/html/index.js"(exports2) {
      var ast = require_ast();
      exports2.freshElement = ast.freshElement;
      exports2.nonFreshElement = ast.nonFreshElement;
      exports2.elementWithTag = ast.elementWithTag;
      exports2.text = ast.text;
      exports2.forceWrite = ast.forceWrite;
      exports2.simplify = require_simplify();
      function write(writer, nodes) {
        nodes.forEach(function(node) {
          writeNode(writer, node);
        });
      }
      function writeNode(writer, node) {
        toStrings[node.type](writer, node);
      }
      var toStrings = {
        element: generateElementString,
        text: generateTextString,
        forceWrite: function() {
        }
      };
      function generateElementString(writer, node) {
        if (ast.isVoidElement(node)) {
          writer.selfClosing(node.tag.tagName, node.tag.attributes);
        } else {
          writer.open(node.tag.tagName, node.tag.attributes);
          write(writer, node.children);
          writer.close(node.tag.tagName);
        }
      }
      function generateTextString(writer, node) {
        writer.text(node.value);
      }
      exports2.write = write;
    }
  });

  // node_modules/mammoth/lib/styles/html-paths.js
  var require_html_paths = __commonJS({
    "node_modules/mammoth/lib/styles/html-paths.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var html = require_html();
      exports2.topLevelElement = topLevelElement;
      exports2.elements = elements;
      exports2.element = element;
      function topLevelElement(tagName, attributes) {
        return elements([element(tagName, attributes, { fresh: true })]);
      }
      function elements(elementStyles) {
        return new HtmlPath(elementStyles.map(function(elementStyle) {
          if (_3.isString(elementStyle)) {
            return element(elementStyle);
          } else {
            return elementStyle;
          }
        }));
      }
      function HtmlPath(elements2) {
        this._elements = elements2;
      }
      HtmlPath.prototype.wrap = function wrap2(children) {
        var result2 = children();
        for (var index = this._elements.length - 1; index >= 0; index--) {
          result2 = this._elements[index].wrapNodes(result2);
        }
        return result2;
      };
      function element(tagName, attributes, options) {
        options = options || {};
        return new Element(tagName, attributes, options);
      }
      function Element(tagName, attributes, options) {
        var tagNames = {};
        if (_3.isArray(tagName)) {
          tagName.forEach(function(tagName2) {
            tagNames[tagName2] = true;
          });
          tagName = tagName[0];
        } else {
          tagNames[tagName] = true;
        }
        this.tagName = tagName;
        this.tagNames = tagNames;
        this.attributes = attributes || {};
        this.fresh = options.fresh;
        this.separator = options.separator;
      }
      Element.prototype.matchesElement = function(element2) {
        return this.tagNames[element2.tagName] && _3.isEqual(this.attributes || {}, element2.attributes || {});
      };
      Element.prototype.wrap = function wrap2(generateNodes) {
        return this.wrapNodes(generateNodes());
      };
      Element.prototype.wrapNodes = function wrapNodes(nodes) {
        return [html.elementWithTag(this, nodes)];
      };
      exports2.empty = elements([]);
      exports2.ignore = {
        wrap: function() {
          return [];
        }
      };
    }
  });

  // node_modules/mammoth/lib/images.js
  var require_images = __commonJS({
    "node_modules/mammoth/lib/images.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var promises = require_promises();
      var Html = require_html();
      exports2.imgElement = imgElement;
      function imgElement(func) {
        return function(element, messages) {
          return promises.when(func(element)).then(function(result2) {
            var attributes = {};
            if (element.altText) {
              attributes.alt = element.altText;
            }
            _3.extend(attributes, result2);
            return [Html.freshElement("img", attributes)];
          });
        };
      }
      exports2.inline = exports2.imgElement;
      exports2.dataUri = imgElement(function(element) {
        return element.readAsBase64String().then(function(imageBuffer) {
          return {
            src: "data:" + element.contentType + ";base64," + imageBuffer
          };
        });
      });
    }
  });

  // node_modules/mammoth/lib/writers/html-writer.js
  var require_html_writer = __commonJS({
    "node_modules/mammoth/lib/writers/html-writer.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      exports2.writer = writer;
      function writer(options) {
        options = options || {};
        if (options.prettyPrint) {
          return prettyWriter();
        } else {
          return simpleWriter();
        }
      }
      var indentedElements = {
        div: true,
        p: true,
        ul: true,
        li: true
      };
      function prettyWriter() {
        var indentationLevel = 0;
        var indentation = "  ";
        var stack = [];
        var start = true;
        var inText = false;
        var writer2 = simpleWriter();
        function open(tagName, attributes) {
          if (indentedElements[tagName]) {
            indent();
          }
          stack.push(tagName);
          writer2.open(tagName, attributes);
          if (indentedElements[tagName]) {
            indentationLevel++;
          }
          start = false;
        }
        function close(tagName) {
          if (indentedElements[tagName]) {
            indentationLevel--;
            indent();
          }
          stack.pop();
          writer2.close(tagName);
        }
        function text(value) {
          startText();
          var text2 = isInPre() ? value : value.replace("\n", "\n" + indentation);
          writer2.text(text2);
        }
        function selfClosing(tagName, attributes) {
          indent();
          writer2.selfClosing(tagName, attributes);
        }
        function insideIndentedElement() {
          return stack.length === 0 || indentedElements[stack[stack.length - 1]];
        }
        function startText() {
          if (!inText) {
            indent();
            inText = true;
          }
        }
        function indent() {
          inText = false;
          if (!start && insideIndentedElement() && !isInPre()) {
            writer2._append("\n");
            for (var i = 0; i < indentationLevel; i++) {
              writer2._append(indentation);
            }
          }
        }
        function isInPre() {
          return _3.some(stack, function(tagName) {
            return tagName === "pre";
          });
        }
        return {
          asString: writer2.asString,
          open,
          close,
          text,
          selfClosing
        };
      }
      function simpleWriter() {
        var fragments = [];
        function open(tagName, attributes) {
          var attributeString = generateAttributeString(attributes);
          fragments.push("<" + tagName + attributeString + ">");
        }
        function close(tagName) {
          fragments.push("</" + tagName + ">");
        }
        function selfClosing(tagName, attributes) {
          var attributeString = generateAttributeString(attributes);
          fragments.push("<" + tagName + attributeString + " />");
        }
        function generateAttributeString(attributes) {
          return _3.map(attributes, function(value, key) {
            return " " + key + '="' + escapeHtmlAttribute(value) + '"';
          }).join("");
        }
        function text(value) {
          fragments.push(escapeHtmlText(value));
        }
        function append(html) {
          fragments.push(html);
        }
        function asString() {
          return fragments.join("");
        }
        return {
          asString,
          open,
          close,
          text,
          selfClosing,
          _append: append
        };
      }
      function escapeHtmlText(value) {
        return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
      }
      function escapeHtmlAttribute(value) {
        return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
      }
    }
  });

  // node_modules/mammoth/lib/writers/markdown-writer.js
  var require_markdown_writer = __commonJS({
    "node_modules/mammoth/lib/writers/markdown-writer.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      function symmetricMarkdownElement(end) {
        return markdownElement(end, end);
      }
      function markdownElement(start, end) {
        return function() {
          return { start, end };
        };
      }
      function markdownLink(attributes) {
        var href = attributes.href || "";
        if (href) {
          return {
            start: "[",
            end: "](" + href + ")",
            anchorPosition: "before"
          };
        } else {
          return {};
        }
      }
      function markdownImage(attributes) {
        var src = attributes.src || "";
        var altText = attributes.alt || "";
        if (src || altText) {
          return { start: "![" + altText + "](" + src + ")" };
        } else {
          return {};
        }
      }
      function markdownList(options) {
        return function(attributes, list) {
          return {
            start: list ? "\n" : "",
            end: list ? "" : "\n",
            list: {
              isOrdered: options.isOrdered,
              indent: list ? list.indent + 1 : 0,
              count: 0
            }
          };
        };
      }
      function markdownListItem(attributes, list, listItem) {
        list = list || { indent: 0, isOrdered: false, count: 0 };
        list.count++;
        listItem.hasClosed = false;
        var bullet = list.isOrdered ? list.count + "." : "-";
        var start = repeatString("	", list.indent) + bullet + " ";
        return {
          start,
          end: function() {
            if (!listItem.hasClosed) {
              listItem.hasClosed = true;
              return "\n";
            }
          }
        };
      }
      var htmlToMarkdown = {
        "p": markdownElement("", "\n\n"),
        "br": markdownElement("", "  \n"),
        "ul": markdownList({ isOrdered: false }),
        "ol": markdownList({ isOrdered: true }),
        "li": markdownListItem,
        "strong": symmetricMarkdownElement("__"),
        "em": symmetricMarkdownElement("*"),
        "a": markdownLink,
        "img": markdownImage
      };
      (function() {
        for (var i = 1; i <= 6; i++) {
          htmlToMarkdown["h" + i] = markdownElement(repeatString("#", i) + " ", "\n\n");
        }
      })();
      function repeatString(value, count) {
        return new Array(count + 1).join(value);
      }
      function markdownWriter() {
        var fragments = [];
        var elementStack = [];
        var list = null;
        var listItem = {};
        function open(tagName, attributes) {
          attributes = attributes || {};
          var createElement = htmlToMarkdown[tagName] || function() {
            return {};
          };
          var element = createElement(attributes, list, listItem);
          elementStack.push({ end: element.end, list });
          if (element.list) {
            list = element.list;
          }
          var anchorBeforeStart = element.anchorPosition === "before";
          if (anchorBeforeStart) {
            writeAnchor(attributes);
          }
          fragments.push(element.start || "");
          if (!anchorBeforeStart) {
            writeAnchor(attributes);
          }
        }
        function writeAnchor(attributes) {
          if (attributes.id) {
            fragments.push('<a id="' + attributes.id + '"></a>');
          }
        }
        function close(tagName) {
          var element = elementStack.pop();
          list = element.list;
          var end = _3.isFunction(element.end) ? element.end() : element.end;
          fragments.push(end || "");
        }
        function selfClosing(tagName, attributes) {
          open(tagName, attributes);
          close(tagName);
        }
        function text(value) {
          fragments.push(escapeMarkdown2(value));
        }
        function asString() {
          return fragments.join("");
        }
        return {
          asString,
          open,
          close,
          text,
          selfClosing
        };
      }
      exports2.writer = markdownWriter;
      function escapeMarkdown2(value) {
        return value.replace(/\\/g, "\\\\").replace(/([\`\*_\{\}\[\]\(\)\#\+\-\.\!])/g, "\\$1");
      }
    }
  });

  // node_modules/mammoth/lib/writers/index.js
  var require_writers = __commonJS({
    "node_modules/mammoth/lib/writers/index.js"(exports2) {
      var htmlWriter = require_html_writer();
      var markdownWriter = require_markdown_writer();
      exports2.writer = writer;
      function writer(options) {
        options = options || {};
        if (options.outputFormat === "markdown") {
          return markdownWriter.writer();
        } else {
          return htmlWriter.writer(options);
        }
      }
    }
  });

  // node_modules/mammoth/lib/document-to-html.js
  var require_document_to_html = __commonJS({
    "node_modules/mammoth/lib/document-to-html.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var promises = require_promises();
      var documents = require_documents();
      var htmlPaths = require_html_paths();
      var results = require_results();
      var images = require_images();
      var Html = require_html();
      var writers = require_writers();
      exports2.DocumentConverter = DocumentConverter;
      function DocumentConverter(options) {
        return {
          convertToHtml: function(element) {
            var comments = _3.indexBy(
              element.type === documents.types.document ? element.comments : [],
              "commentId"
            );
            var conversion = new DocumentConversion(options, comments);
            return conversion.convertToHtml(element);
          }
        };
      }
      function DocumentConversion(options, comments) {
        var noteNumber = 1;
        var noteReferences = [];
        var referencedComments = [];
        options = _3.extend({ ignoreEmptyParagraphs: true }, options);
        var idPrefix = options.idPrefix === void 0 ? "" : options.idPrefix;
        var ignoreEmptyParagraphs = options.ignoreEmptyParagraphs;
        var defaultParagraphStyle = htmlPaths.topLevelElement("p");
        var styleMap = options.styleMap || [];
        function convertToHtml(document2) {
          var messages = [];
          var html = elementToHtml(document2, messages, {});
          var deferredNodes = [];
          walkHtml(html, function(node) {
            if (node.type === "deferred") {
              deferredNodes.push(node);
            }
          });
          var deferredValues = {};
          return promises.mapSeries(deferredNodes, function(deferred) {
            return deferred.value().then(function(value) {
              deferredValues[deferred.id] = value;
            });
          }).then(function() {
            function replaceDeferred(nodes) {
              return flatMap(nodes, function(node) {
                if (node.type === "deferred") {
                  return deferredValues[node.id];
                } else if (node.children) {
                  return [
                    _3.extend({}, node, {
                      children: replaceDeferred(node.children)
                    })
                  ];
                } else {
                  return [node];
                }
              });
            }
            var writer = writers.writer({
              prettyPrint: options.prettyPrint,
              outputFormat: options.outputFormat
            });
            Html.write(writer, Html.simplify(replaceDeferred(html)));
            return new results.Result(writer.asString(), messages);
          });
        }
        function convertElements(elements, messages, options2) {
          return flatMap(elements, function(element) {
            return elementToHtml(element, messages, options2);
          });
        }
        function elementToHtml(element, messages, options2) {
          if (!options2) {
            throw new Error("options not set");
          }
          var handler = elementConverters[element.type];
          if (handler) {
            return handler(element, messages, options2);
          } else {
            return [];
          }
        }
        function convertParagraph(element, messages, options2) {
          return htmlPathForParagraph(element, messages).wrap(function() {
            var content = convertElements(element.children, messages, options2);
            if (ignoreEmptyParagraphs) {
              return content;
            } else {
              return [Html.forceWrite].concat(content);
            }
          });
        }
        function htmlPathForParagraph(element, messages) {
          var style = findStyle(element);
          if (style) {
            return style.to;
          } else {
            if (element.styleId) {
              messages.push(unrecognisedStyleWarning("paragraph", element));
            }
            return defaultParagraphStyle;
          }
        }
        function convertRun(run, messages, options2) {
          var nodes = function() {
            return convertElements(run.children, messages, options2);
          };
          var paths = [];
          if (run.highlight !== null) {
            var path = findHtmlPath({ type: "highlight", color: run.highlight });
            if (path) {
              paths.push(path);
            }
          }
          if (run.isSmallCaps) {
            paths.push(findHtmlPathForRunProperty("smallCaps"));
          }
          if (run.isAllCaps) {
            paths.push(findHtmlPathForRunProperty("allCaps"));
          }
          if (run.isStrikethrough) {
            paths.push(findHtmlPathForRunProperty("strikethrough", "s"));
          }
          if (run.isUnderline) {
            paths.push(findHtmlPathForRunProperty("underline"));
          }
          if (run.verticalAlignment === documents.verticalAlignment.subscript) {
            paths.push(htmlPaths.element("sub", {}, { fresh: false }));
          }
          if (run.verticalAlignment === documents.verticalAlignment.superscript) {
            paths.push(htmlPaths.element("sup", {}, { fresh: false }));
          }
          if (run.isItalic) {
            paths.push(findHtmlPathForRunProperty("italic", "em"));
          }
          if (run.isBold) {
            paths.push(findHtmlPathForRunProperty("bold", "strong"));
          }
          var stylePath = htmlPaths.empty;
          var style = findStyle(run);
          if (style) {
            stylePath = style.to;
          } else if (run.styleId) {
            messages.push(unrecognisedStyleWarning("run", run));
          }
          paths.push(stylePath);
          paths.forEach(function(path2) {
            nodes = path2.wrap.bind(path2, nodes);
          });
          return nodes();
        }
        function findHtmlPathForRunProperty(elementType, defaultTagName) {
          var path = findHtmlPath({ type: elementType });
          if (path) {
            return path;
          } else if (defaultTagName) {
            return htmlPaths.element(defaultTagName, {}, { fresh: false });
          } else {
            return htmlPaths.empty;
          }
        }
        function findHtmlPath(element, defaultPath) {
          var style = findStyle(element);
          return style ? style.to : defaultPath;
        }
        function findStyle(element) {
          for (var i = 0; i < styleMap.length; i++) {
            if (styleMap[i].from.matches(element)) {
              return styleMap[i];
            }
          }
        }
        function recoveringConvertImage(convertImage) {
          return function(image, messages) {
            return promises.attempt(function() {
              return convertImage(image, messages);
            }).caught(function(error) {
              messages.push(results.error(error));
              return [];
            });
          };
        }
        function noteHtmlId(note) {
          return referentHtmlId(note.noteType, note.noteId);
        }
        function noteRefHtmlId(note) {
          return referenceHtmlId(note.noteType, note.noteId);
        }
        function referentHtmlId(referenceType, referenceId) {
          return htmlId(referenceType + "-" + referenceId);
        }
        function referenceHtmlId(referenceType, referenceId) {
          return htmlId(referenceType + "-ref-" + referenceId);
        }
        function htmlId(suffix) {
          return idPrefix + suffix;
        }
        var defaultTablePath = htmlPaths.elements([
          htmlPaths.element("table", {}, { fresh: true })
        ]);
        function convertTable(element, messages, options2) {
          return findHtmlPath(element, defaultTablePath).wrap(function() {
            return convertTableChildren(element, messages, options2);
          });
        }
        function convertTableChildren(element, messages, options2) {
          var bodyIndex = _3.findIndex(element.children, function(child) {
            return !child.type === documents.types.tableRow || !child.isHeader;
          });
          if (bodyIndex === -1) {
            bodyIndex = element.children.length;
          }
          var children;
          if (bodyIndex === 0) {
            children = convertElements(
              element.children,
              messages,
              _3.extend({}, options2, { isTableHeader: false })
            );
          } else {
            var headRows = convertElements(
              element.children.slice(0, bodyIndex),
              messages,
              _3.extend({}, options2, { isTableHeader: true })
            );
            var bodyRows = convertElements(
              element.children.slice(bodyIndex),
              messages,
              _3.extend({}, options2, { isTableHeader: false })
            );
            children = [
              Html.freshElement("thead", {}, headRows),
              Html.freshElement("tbody", {}, bodyRows)
            ];
          }
          return [Html.forceWrite].concat(children);
        }
        function convertTableRow(element, messages, options2) {
          var children = convertElements(element.children, messages, options2);
          return [
            Html.freshElement("tr", {}, [Html.forceWrite].concat(children))
          ];
        }
        function convertTableCell(element, messages, options2) {
          var tagName = options2.isTableHeader ? "th" : "td";
          var children = convertElements(element.children, messages, options2);
          var attributes = {};
          if (element.colSpan !== 1) {
            attributes.colspan = element.colSpan.toString();
          }
          if (element.rowSpan !== 1) {
            attributes.rowspan = element.rowSpan.toString();
          }
          return [
            Html.freshElement(tagName, attributes, [Html.forceWrite].concat(children))
          ];
        }
        function convertCommentReference(reference, messages, options2) {
          return findHtmlPath(reference, htmlPaths.ignore).wrap(function() {
            var comment = comments[reference.commentId];
            var count = referencedComments.length + 1;
            var label = "[" + commentAuthorLabel(comment) + count + "]";
            referencedComments.push({ label, comment });
            return [
              Html.freshElement("a", {
                href: "#" + referentHtmlId("comment", reference.commentId),
                id: referenceHtmlId("comment", reference.commentId)
              }, [Html.text(label)])
            ];
          });
        }
        function convertComment(referencedComment, messages, options2) {
          var label = referencedComment.label;
          var comment = referencedComment.comment;
          var body = convertElements(comment.body, messages, options2).concat([
            Html.nonFreshElement("p", {}, [
              Html.text(" "),
              Html.freshElement("a", { "href": "#" + referenceHtmlId("comment", comment.commentId) }, [
                Html.text("\u2191")
              ])
            ])
          ]);
          return [
            Html.freshElement(
              "dt",
              { "id": referentHtmlId("comment", comment.commentId) },
              [Html.text("Comment " + label)]
            ),
            Html.freshElement("dd", {}, body)
          ];
        }
        function convertBreak(element, messages, options2) {
          return htmlPathForBreak(element).wrap(function() {
            return [];
          });
        }
        function htmlPathForBreak(element) {
          var style = findStyle(element);
          if (style) {
            return style.to;
          } else if (element.breakType === "line") {
            return htmlPaths.topLevelElement("br");
          } else {
            return htmlPaths.empty;
          }
        }
        var elementConverters = {
          "document": function(document2, messages, options2) {
            var children = convertElements(document2.children, messages, options2);
            var notes = noteReferences.map(function(noteReference) {
              return document2.notes.resolve(noteReference);
            });
            var notesNodes = convertElements(notes, messages, options2);
            return children.concat([
              Html.freshElement("ol", {}, notesNodes),
              Html.freshElement("dl", {}, flatMap(referencedComments, function(referencedComment) {
                return convertComment(referencedComment, messages, options2);
              }))
            ]);
          },
          "paragraph": convertParagraph,
          "run": convertRun,
          "text": function(element, messages, options2) {
            return [Html.text(element.value)];
          },
          "tab": function(element, messages, options2) {
            return [Html.text("	")];
          },
          "hyperlink": function(element, messages, options2) {
            var href = element.anchor ? "#" + htmlId(element.anchor) : element.href;
            var attributes = { href };
            if (element.targetFrame != null) {
              attributes.target = element.targetFrame;
            }
            var children = convertElements(element.children, messages, options2);
            return [Html.nonFreshElement("a", attributes, children)];
          },
          "checkbox": function(element) {
            var attributes = { type: "checkbox" };
            if (element.checked) {
              attributes["checked"] = "checked";
            }
            return [Html.freshElement("input", attributes)];
          },
          "bookmarkStart": function(element, messages, options2) {
            var anchor = Html.freshElement("a", {
              id: htmlId(element.name)
            }, [Html.forceWrite]);
            return [anchor];
          },
          "noteReference": function(element, messages, options2) {
            noteReferences.push(element);
            var anchor = Html.freshElement("a", {
              href: "#" + noteHtmlId(element),
              id: noteRefHtmlId(element)
            }, [Html.text("[" + noteNumber++ + "]")]);
            return [Html.freshElement("sup", {}, [anchor])];
          },
          "note": function(element, messages, options2) {
            var children = convertElements(element.body, messages, options2);
            var backLink = Html.elementWithTag(htmlPaths.element("p", {}, { fresh: false }), [
              Html.text(" "),
              Html.freshElement("a", { href: "#" + noteRefHtmlId(element) }, [Html.text("\u2191")])
            ]);
            var body = children.concat([backLink]);
            return Html.freshElement("li", { id: noteHtmlId(element) }, body);
          },
          "commentReference": convertCommentReference,
          "comment": convertComment,
          "image": deferredConversion(recoveringConvertImage(options.convertImage || images.dataUri)),
          "table": convertTable,
          "tableRow": convertTableRow,
          "tableCell": convertTableCell,
          "break": convertBreak
        };
        return {
          convertToHtml
        };
      }
      var deferredId = 1;
      function deferredConversion(func) {
        return function(element, messages, options) {
          return [
            {
              type: "deferred",
              id: deferredId++,
              value: function() {
                return func(element, messages, options);
              }
            }
          ];
        };
      }
      function unrecognisedStyleWarning(type, element) {
        return results.warning(
          "Unrecognised " + type + " style: '" + element.styleName + "' (Style ID: " + element.styleId + ")"
        );
      }
      function flatMap(values2, func) {
        return _3.flatten(values2.map(func), true);
      }
      function walkHtml(nodes, callback) {
        nodes.forEach(function(node) {
          callback(node);
          if (node.children) {
            walkHtml(node.children, callback);
          }
        });
      }
      var commentAuthorLabel = exports2.commentAuthorLabel = function commentAuthorLabel2(comment) {
        return comment.authorInitials || "";
      };
    }
  });

  // node_modules/mammoth/lib/raw-text.js
  var require_raw_text = __commonJS({
    "node_modules/mammoth/lib/raw-text.js"(exports2) {
      var documents = require_documents();
      function convertElementToRawText(element) {
        if (element.type === "text") {
          return element.value;
        } else if (element.type === documents.types.tab) {
          return "	";
        } else {
          var tail = element.type === "paragraph" ? "\n\n" : "";
          return (element.children || []).map(convertElementToRawText).join("") + tail;
        }
      }
      exports2.convertElementToRawText = convertElementToRawText;
    }
  });

  // node_modules/lop/lib/TokenIterator.js
  var require_TokenIterator = __commonJS({
    "node_modules/lop/lib/TokenIterator.js"(exports2, module2) {
      var TokenIterator = module2.exports = function(tokens, startIndex) {
        this._tokens = tokens;
        this._startIndex = startIndex || 0;
      };
      TokenIterator.prototype.head = function() {
        return this._tokens[this._startIndex];
      };
      TokenIterator.prototype.tail = function(startIndex) {
        return new TokenIterator(this._tokens, this._startIndex + 1);
      };
      TokenIterator.prototype.toArray = function() {
        return this._tokens.slice(this._startIndex);
      };
      TokenIterator.prototype.end = function() {
        return this._tokens[this._tokens.length - 1];
      };
      TokenIterator.prototype.to = function(end) {
        var start = this.head().source;
        var endToken = end.head() || end.end();
        return start.to(endToken.source);
      };
    }
  });

  // node_modules/lop/lib/parser.js
  var require_parser = __commonJS({
    "node_modules/lop/lib/parser.js"(exports2) {
      var TokenIterator = require_TokenIterator();
      exports2.Parser = function(options) {
        var parseTokens = function(parser, tokens) {
          return parser(new TokenIterator(tokens));
        };
        return {
          parseTokens
        };
      };
    }
  });

  // node_modules/option/index.js
  var require_option = __commonJS({
    "node_modules/option/index.js"(exports2) {
      exports2.none = /* @__PURE__ */ Object.create({
        value: function() {
          throw new Error("Called value on none");
        },
        isNone: function() {
          return true;
        },
        isSome: function() {
          return false;
        },
        map: function() {
          return exports2.none;
        },
        flatMap: function() {
          return exports2.none;
        },
        filter: function() {
          return exports2.none;
        },
        toArray: function() {
          return [];
        },
        orElse: callOrReturn,
        valueOrElse: callOrReturn
      });
      function callOrReturn(value) {
        if (typeof value == "function") {
          return value();
        } else {
          return value;
        }
      }
      exports2.some = function(value) {
        return new Some(value);
      };
      var Some = function(value) {
        this._value = value;
      };
      Some.prototype.value = function() {
        return this._value;
      };
      Some.prototype.isNone = function() {
        return false;
      };
      Some.prototype.isSome = function() {
        return true;
      };
      Some.prototype.map = function(func) {
        return new Some(func(this._value));
      };
      Some.prototype.flatMap = function(func) {
        return func(this._value);
      };
      Some.prototype.filter = function(predicate) {
        return predicate(this._value) ? this : exports2.none;
      };
      Some.prototype.toArray = function() {
        return [this._value];
      };
      Some.prototype.orElse = function(value) {
        return this;
      };
      Some.prototype.valueOrElse = function(value) {
        return this._value;
      };
      exports2.isOption = function(value) {
        return value === exports2.none || value instanceof Some;
      };
      exports2.fromNullable = function(value) {
        if (value == null) {
          return exports2.none;
        }
        return new Some(value);
      };
    }
  });

  // node_modules/lop/lib/parsing-results.js
  var require_parsing_results = __commonJS({
    "node_modules/lop/lib/parsing-results.js"(exports2, module2) {
      module2.exports = {
        failure: function(errors, remaining) {
          if (errors.length < 1) {
            throw new Error("Failure must have errors");
          }
          return new Result({
            status: "failure",
            remaining,
            errors
          });
        },
        error: function(errors, remaining) {
          if (errors.length < 1) {
            throw new Error("Failure must have errors");
          }
          return new Result({
            status: "error",
            remaining,
            errors
          });
        },
        success: function(value, remaining, source) {
          return new Result({
            status: "success",
            value,
            source,
            remaining,
            errors: []
          });
        },
        cut: function(remaining) {
          return new Result({
            status: "cut",
            remaining,
            errors: []
          });
        }
      };
      var Result = function(options) {
        this._value = options.value;
        this._status = options.status;
        this._hasValue = options.value !== void 0;
        this._remaining = options.remaining;
        this._source = options.source;
        this._errors = options.errors;
      };
      Result.prototype.map = function(func) {
        if (this._hasValue) {
          return new Result({
            value: func(this._value, this._source),
            status: this._status,
            remaining: this._remaining,
            source: this._source,
            errors: this._errors
          });
        } else {
          return this;
        }
      };
      Result.prototype.changeRemaining = function(remaining) {
        return new Result({
          value: this._value,
          status: this._status,
          remaining,
          source: this._source,
          errors: this._errors
        });
      };
      Result.prototype.isSuccess = function() {
        return this._status === "success" || this._status === "cut";
      };
      Result.prototype.isFailure = function() {
        return this._status === "failure";
      };
      Result.prototype.isError = function() {
        return this._status === "error";
      };
      Result.prototype.isCut = function() {
        return this._status === "cut";
      };
      Result.prototype.value = function() {
        return this._value;
      };
      Result.prototype.remaining = function() {
        return this._remaining;
      };
      Result.prototype.source = function() {
        return this._source;
      };
      Result.prototype.errors = function() {
        return this._errors;
      };
    }
  });

  // node_modules/lop/lib/errors.js
  var require_errors2 = __commonJS({
    "node_modules/lop/lib/errors.js"(exports2) {
      exports2.error = function(options) {
        return new Error2(options);
      };
      var Error2 = function(options) {
        this.expected = options.expected;
        this.actual = options.actual;
        this._location = options.location;
      };
      Error2.prototype.describe = function() {
        var locationDescription = this._location ? this._location.describe() + ":\n" : "";
        return locationDescription + "Expected " + this.expected + "\nbut got " + this.actual;
      };
      Error2.prototype.lineNumber = function() {
        return this._location.lineNumber();
      };
      Error2.prototype.characterNumber = function() {
        return this._location.characterNumber();
      };
    }
  });

  // node_modules/lop/lib/lazy-iterators.js
  var require_lazy_iterators = __commonJS({
    "node_modules/lop/lib/lazy-iterators.js"(exports2) {
      var fromArray = exports2.fromArray = function(array) {
        var index = 0;
        var hasNext = function() {
          return index < array.length;
        };
        return new LazyIterator({
          hasNext,
          next: function() {
            if (!hasNext()) {
              throw new Error("No more elements");
            } else {
              return array[index++];
            }
          }
        });
      };
      var LazyIterator = function(iterator) {
        this._iterator = iterator;
      };
      LazyIterator.prototype.map = function(func) {
        var iterator = this._iterator;
        return new LazyIterator({
          hasNext: function() {
            return iterator.hasNext();
          },
          next: function() {
            return func(iterator.next());
          }
        });
      };
      LazyIterator.prototype.filter = function(condition) {
        var iterator = this._iterator;
        var moved = false;
        var hasNext = false;
        var next2;
        var moveIfNecessary = function() {
          if (moved) {
            return;
          }
          moved = true;
          hasNext = false;
          while (iterator.hasNext() && !hasNext) {
            next2 = iterator.next();
            hasNext = condition(next2);
          }
        };
        return new LazyIterator({
          hasNext: function() {
            moveIfNecessary();
            return hasNext;
          },
          next: function() {
            moveIfNecessary();
            var toReturn = next2;
            moved = false;
            return toReturn;
          }
        });
      };
      LazyIterator.prototype.first = function() {
        var iterator = this._iterator;
        if (this._iterator.hasNext()) {
          return iterator.next();
        } else {
          return null;
        }
      };
      LazyIterator.prototype.toArray = function() {
        var result2 = [];
        while (this._iterator.hasNext()) {
          result2.push(this._iterator.next());
        }
        return result2;
      };
    }
  });

  // node_modules/lop/lib/rules.js
  var require_rules = __commonJS({
    "node_modules/lop/lib/rules.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var options = require_option();
      var results = require_parsing_results();
      var errors = require_errors2();
      var lazyIterators = require_lazy_iterators();
      exports2.token = function(tokenType, value) {
        var matchValue = value !== void 0;
        return function(input) {
          var token = input.head();
          if (token && token.name === tokenType && (!matchValue || token.value === value)) {
            return results.success(token.value, input.tail(), token.source);
          } else {
            var expected = describeToken({ name: tokenType, value });
            return describeTokenMismatch(input, expected);
          }
        };
      };
      exports2.tokenOfType = function(tokenType) {
        return exports2.token(tokenType);
      };
      exports2.firstOf = function(name, parsers) {
        if (!_3.isArray(parsers)) {
          parsers = Array.prototype.slice.call(arguments, 1);
        }
        return function(input) {
          return lazyIterators.fromArray(parsers).map(function(parser) {
            return parser(input);
          }).filter(function(result2) {
            return result2.isSuccess() || result2.isError();
          }).first() || describeTokenMismatch(input, name);
        };
      };
      exports2.then = function(parser, func) {
        return function(input) {
          var result2 = parser(input);
          if (!result2.map) {
            console.log(result2);
          }
          return result2.map(func);
        };
      };
      exports2.sequence = function() {
        var parsers = Array.prototype.slice.call(arguments, 0);
        var rule = function(input) {
          var result2 = _3.foldl(parsers, function(memo, parser) {
            var result3 = memo.result;
            var hasCut = memo.hasCut;
            if (!result3.isSuccess()) {
              return { result: result3, hasCut };
            }
            var subResult = parser(result3.remaining());
            if (subResult.isCut()) {
              return { result: result3, hasCut: true };
            } else if (subResult.isSuccess()) {
              var values2;
              if (parser.isCaptured) {
                values2 = result3.value().withValue(parser, subResult.value());
              } else {
                values2 = result3.value();
              }
              var remaining = subResult.remaining();
              var source2 = input.to(remaining);
              return {
                result: results.success(values2, remaining, source2),
                hasCut
              };
            } else if (hasCut) {
              return { result: results.error(subResult.errors(), subResult.remaining()), hasCut };
            } else {
              return { result: subResult, hasCut };
            }
          }, { result: results.success(new SequenceValues(), input), hasCut: false }).result;
          var source = input.to(result2.remaining());
          return result2.map(function(values2) {
            return values2.withValue(exports2.sequence.source, source);
          });
        };
        rule.head = function() {
          var firstCapture = _3.find(parsers, isCapturedRule);
          return exports2.then(
            rule,
            exports2.sequence.extract(firstCapture)
          );
        };
        rule.map = function(func) {
          return exports2.then(
            rule,
            function(result2) {
              return func.apply(this, result2.toArray());
            }
          );
        };
        function isCapturedRule(subRule) {
          return subRule.isCaptured;
        }
        return rule;
      };
      var SequenceValues = function(values2, valuesArray) {
        this._values = values2 || {};
        this._valuesArray = valuesArray || [];
      };
      SequenceValues.prototype.withValue = function(rule, value) {
        if (rule.captureName && rule.captureName in this._values) {
          throw new Error('Cannot add second value for capture "' + rule.captureName + '"');
        } else {
          var newValues = _3.clone(this._values);
          newValues[rule.captureName] = value;
          var newValuesArray = this._valuesArray.concat([value]);
          return new SequenceValues(newValues, newValuesArray);
        }
      };
      SequenceValues.prototype.get = function(rule) {
        if (rule.captureName in this._values) {
          return this._values[rule.captureName];
        } else {
          throw new Error('No value for capture "' + rule.captureName + '"');
        }
      };
      SequenceValues.prototype.toArray = function() {
        return this._valuesArray;
      };
      exports2.sequence.capture = function(rule, name) {
        var captureRule = function() {
          return rule.apply(this, arguments);
        };
        captureRule.captureName = name;
        captureRule.isCaptured = true;
        return captureRule;
      };
      exports2.sequence.extract = function(rule) {
        return function(result2) {
          return result2.get(rule);
        };
      };
      exports2.sequence.applyValues = function(func) {
        var rules2 = Array.prototype.slice.call(arguments, 1);
        return function(result2) {
          var values2 = rules2.map(function(rule) {
            return result2.get(rule);
          });
          return func.apply(this, values2);
        };
      };
      exports2.sequence.source = {
        captureName: "\u2603source\u2603"
      };
      exports2.sequence.cut = function() {
        return function(input) {
          return results.cut(input);
        };
      };
      exports2.optional = function(rule) {
        return function(input) {
          var result2 = rule(input);
          if (result2.isSuccess()) {
            return result2.map(options.some);
          } else if (result2.isFailure()) {
            return results.success(options.none, input);
          } else {
            return result2;
          }
        };
      };
      exports2.zeroOrMoreWithSeparator = function(rule, separator) {
        return repeatedWithSeparator(rule, separator, false);
      };
      exports2.oneOrMoreWithSeparator = function(rule, separator) {
        return repeatedWithSeparator(rule, separator, true);
      };
      var zeroOrMore = exports2.zeroOrMore = function(rule) {
        return function(input) {
          var values2 = [];
          var result2;
          while ((result2 = rule(input)) && result2.isSuccess()) {
            input = result2.remaining();
            values2.push(result2.value());
          }
          if (result2.isError()) {
            return result2;
          } else {
            return results.success(values2, input);
          }
        };
      };
      exports2.oneOrMore = function(rule) {
        return exports2.oneOrMoreWithSeparator(rule, noOpRule);
      };
      function noOpRule(input) {
        return results.success(null, input);
      }
      var repeatedWithSeparator = function(rule, separator, isOneOrMore) {
        return function(input) {
          var result2 = rule(input);
          if (result2.isSuccess()) {
            var mainRule = exports2.sequence.capture(rule, "main");
            var remainingRule = zeroOrMore(exports2.then(
              exports2.sequence(separator, mainRule),
              exports2.sequence.extract(mainRule)
            ));
            var remainingResult = remainingRule(result2.remaining());
            return results.success([result2.value()].concat(remainingResult.value()), remainingResult.remaining());
          } else if (isOneOrMore || result2.isError()) {
            return result2;
          } else {
            return results.success([], input);
          }
        };
      };
      exports2.leftAssociative = function(leftRule, rightRule, func) {
        var rights;
        if (func) {
          rights = [{ func, rule: rightRule }];
        } else {
          rights = rightRule;
        }
        rights = rights.map(function(right) {
          return exports2.then(right.rule, function(rightValue) {
            return function(leftValue, source) {
              return right.func(leftValue, rightValue, source);
            };
          });
        });
        var repeatedRule = exports2.firstOf.apply(null, ["rules"].concat(rights));
        return function(input) {
          var start = input;
          var leftResult = leftRule(input);
          if (!leftResult.isSuccess()) {
            return leftResult;
          }
          var repeatedResult = repeatedRule(leftResult.remaining());
          while (repeatedResult.isSuccess()) {
            var remaining = repeatedResult.remaining();
            var source = start.to(repeatedResult.remaining());
            var right = repeatedResult.value();
            leftResult = results.success(
              right(leftResult.value(), source),
              remaining,
              source
            );
            repeatedResult = repeatedRule(leftResult.remaining());
          }
          if (repeatedResult.isError()) {
            return repeatedResult;
          }
          return leftResult;
        };
      };
      exports2.leftAssociative.firstOf = function() {
        return Array.prototype.slice.call(arguments, 0);
      };
      exports2.nonConsuming = function(rule) {
        return function(input) {
          return rule(input).changeRemaining(input);
        };
      };
      var describeToken = function(token) {
        if (token.value) {
          return token.name + ' "' + token.value + '"';
        } else {
          return token.name;
        }
      };
      function describeTokenMismatch(input, expected) {
        var error;
        var token = input.head();
        if (token) {
          error = errors.error({
            expected,
            actual: describeToken(token),
            location: token.source
          });
        } else {
          error = errors.error({
            expected,
            actual: "end of tokens"
          });
        }
        return results.failure([error], input);
      }
    }
  });

  // node_modules/lop/lib/StringSource.js
  var require_StringSource = __commonJS({
    "node_modules/lop/lib/StringSource.js"(exports2, module2) {
      var StringSource = module2.exports = function(string, description) {
        var self2 = {
          asString: function() {
            return string;
          },
          range: function(startIndex, endIndex) {
            return new StringSourceRange(string, description, startIndex, endIndex);
          }
        };
        return self2;
      };
      var StringSourceRange = function(string, description, startIndex, endIndex) {
        this._string = string;
        this._description = description;
        this._startIndex = startIndex;
        this._endIndex = endIndex;
      };
      StringSourceRange.prototype.to = function(otherRange) {
        return new StringSourceRange(this._string, this._description, this._startIndex, otherRange._endIndex);
      };
      StringSourceRange.prototype.describe = function() {
        var position = this._position();
        var description = this._description ? this._description + "\n" : "";
        return description + "Line number: " + position.lineNumber + "\nCharacter number: " + position.characterNumber;
      };
      StringSourceRange.prototype.lineNumber = function() {
        return this._position().lineNumber;
      };
      StringSourceRange.prototype.characterNumber = function() {
        return this._position().characterNumber;
      };
      StringSourceRange.prototype._position = function() {
        var self2 = this;
        var index = 0;
        var nextNewLine = function() {
          return self2._string.indexOf("\n", index);
        };
        var lineNumber = 1;
        while (nextNewLine() !== -1 && nextNewLine() < this._startIndex) {
          index = nextNewLine() + 1;
          lineNumber += 1;
        }
        var characterNumber = this._startIndex - index + 1;
        return { lineNumber, characterNumber };
      };
    }
  });

  // node_modules/lop/lib/Token.js
  var require_Token = __commonJS({
    "node_modules/lop/lib/Token.js"(exports2, module2) {
      module2.exports = function(name, value, source) {
        this.name = name;
        this.value = value;
        if (source) {
          this.source = source;
        }
      };
    }
  });

  // node_modules/lop/lib/bottom-up.js
  var require_bottom_up = __commonJS({
    "node_modules/lop/lib/bottom-up.js"(exports2) {
      var rules2 = require_rules();
      var results = require_parsing_results();
      exports2.parser = function(name, prefixRules, infixRuleBuilders) {
        var self2 = {
          rule,
          leftAssociative,
          rightAssociative
        };
        var infixRules = new InfixRules(infixRuleBuilders.map(createInfixRule));
        var prefixRule = rules2.firstOf(name, prefixRules);
        function createInfixRule(infixRuleBuilder) {
          return {
            name: infixRuleBuilder.name,
            rule: lazyRule(infixRuleBuilder.ruleBuilder.bind(null, self2))
          };
        }
        function rule() {
          return createRule(infixRules);
        }
        function leftAssociative(name2) {
          return createRule(infixRules.untilExclusive(name2));
        }
        function rightAssociative(name2) {
          return createRule(infixRules.untilInclusive(name2));
        }
        function createRule(infixRules2) {
          return apply.bind(null, infixRules2);
        }
        function apply(infixRules2, tokens) {
          var leftResult = prefixRule(tokens);
          if (leftResult.isSuccess()) {
            return infixRules2.apply(leftResult);
          } else {
            return leftResult;
          }
        }
        return self2;
      };
      function InfixRules(infixRules) {
        function untilExclusive(name) {
          return new InfixRules(infixRules.slice(0, ruleNames().indexOf(name)));
        }
        function untilInclusive(name) {
          return new InfixRules(infixRules.slice(0, ruleNames().indexOf(name) + 1));
        }
        function ruleNames() {
          return infixRules.map(function(rule) {
            return rule.name;
          });
        }
        function apply(leftResult) {
          var currentResult;
          var source;
          while (true) {
            currentResult = applyToTokens(leftResult.remaining());
            if (currentResult.isSuccess()) {
              source = leftResult.source().to(currentResult.source());
              leftResult = results.success(
                currentResult.value()(leftResult.value(), source),
                currentResult.remaining(),
                source
              );
            } else if (currentResult.isFailure()) {
              return leftResult;
            } else {
              return currentResult;
            }
          }
        }
        function applyToTokens(tokens) {
          return rules2.firstOf("infix", infixRules.map(function(infix) {
            return infix.rule;
          }))(tokens);
        }
        return {
          apply,
          untilExclusive,
          untilInclusive
        };
      }
      exports2.infix = function(name, ruleBuilder) {
        function map2(func) {
          return exports2.infix(name, function(parser) {
            var rule = ruleBuilder(parser);
            return function(tokens) {
              var result2 = rule(tokens);
              return result2.map(function(right) {
                return function(left, source) {
                  return func(left, right, source);
                };
              });
            };
          });
        }
        return {
          name,
          ruleBuilder,
          map: map2
        };
      };
      var lazyRule = function(ruleBuilder) {
        var rule;
        return function(input) {
          if (!rule) {
            rule = ruleBuilder();
          }
          return rule(input);
        };
      };
    }
  });

  // node_modules/lop/lib/regex-tokeniser.js
  var require_regex_tokeniser = __commonJS({
    "node_modules/lop/lib/regex-tokeniser.js"(exports2) {
      var Token = require_Token();
      var StringSource = require_StringSource();
      exports2.RegexTokeniser = RegexTokeniser;
      function RegexTokeniser(rules2) {
        rules2 = rules2.map(function(rule) {
          return {
            name: rule.name,
            regex: new RegExp(rule.regex.source, "g")
          };
        });
        function tokenise(input, description) {
          var source = new StringSource(input, description);
          var index = 0;
          var tokens = [];
          while (index < input.length) {
            var result2 = readNextToken(input, index, source);
            index = result2.endIndex;
            tokens.push(result2.token);
          }
          tokens.push(endToken(input, source));
          return tokens;
        }
        function readNextToken(string, startIndex, source) {
          for (var i = 0; i < rules2.length; i++) {
            var regex = rules2[i].regex;
            regex.lastIndex = startIndex;
            var result2 = regex.exec(string);
            if (result2) {
              var endIndex = startIndex + result2[0].length;
              if (result2.index === startIndex && endIndex > startIndex) {
                var value = result2[1];
                var token = new Token(
                  rules2[i].name,
                  value,
                  source.range(startIndex, endIndex)
                );
                return { token, endIndex };
              }
            }
          }
          var endIndex = startIndex + 1;
          var token = new Token(
            "unrecognisedCharacter",
            string.substring(startIndex, endIndex),
            source.range(startIndex, endIndex)
          );
          return { token, endIndex };
        }
        function endToken(input, source) {
          return new Token(
            "end",
            null,
            source.range(input.length, input.length)
          );
        }
        return {
          tokenise
        };
      }
    }
  });

  // node_modules/lop/index.js
  var require_lop = __commonJS({
    "node_modules/lop/index.js"(exports2) {
      exports2.Parser = require_parser().Parser;
      exports2.rules = require_rules();
      exports2.errors = require_errors2();
      exports2.results = require_parsing_results();
      exports2.StringSource = require_StringSource();
      exports2.Token = require_Token();
      exports2.bottomUp = require_bottom_up();
      exports2.RegexTokeniser = require_regex_tokeniser().RegexTokeniser;
      exports2.rule = function(ruleBuilder) {
        var rule;
        return function(input) {
          if (!rule) {
            rule = ruleBuilder();
          }
          return rule(input);
        };
      };
    }
  });

  // node_modules/mammoth/lib/styles/document-matchers.js
  var require_document_matchers = __commonJS({
    "node_modules/mammoth/lib/styles/document-matchers.js"(exports2) {
      exports2.paragraph = paragraph;
      exports2.run = run;
      exports2.table = table;
      exports2.bold = new Matcher("bold");
      exports2.italic = new Matcher("italic");
      exports2.underline = new Matcher("underline");
      exports2.strikethrough = new Matcher("strikethrough");
      exports2.allCaps = new Matcher("allCaps");
      exports2.smallCaps = new Matcher("smallCaps");
      exports2.highlight = highlight;
      exports2.commentReference = new Matcher("commentReference");
      exports2.lineBreak = new BreakMatcher({ breakType: "line" });
      exports2.pageBreak = new BreakMatcher({ breakType: "page" });
      exports2.columnBreak = new BreakMatcher({ breakType: "column" });
      exports2.equalTo = equalTo;
      exports2.startsWith = startsWith;
      function paragraph(options) {
        return new Matcher("paragraph", options);
      }
      function run(options) {
        return new Matcher("run", options);
      }
      function table(options) {
        return new Matcher("table", options);
      }
      function highlight(options) {
        return new HighlightMatcher(options);
      }
      function Matcher(elementType, options) {
        options = options || {};
        this._elementType = elementType;
        this._styleId = options.styleId;
        this._styleName = options.styleName;
        if (options.list) {
          this._listIndex = options.list.levelIndex;
          this._listIsOrdered = options.list.isOrdered;
        }
      }
      Matcher.prototype.matches = function(element) {
        return element.type === this._elementType && (this._styleId === void 0 || element.styleId === this._styleId) && (this._styleName === void 0 || element.styleName && this._styleName.operator(this._styleName.operand, element.styleName)) && (this._listIndex === void 0 || isList(element, this._listIndex, this._listIsOrdered)) && (this._breakType === void 0 || this._breakType === element.breakType);
      };
      function HighlightMatcher(options) {
        options = options || {};
        this._color = options.color;
      }
      HighlightMatcher.prototype.matches = function(element) {
        return element.type === "highlight" && (this._color === void 0 || element.color === this._color);
      };
      function BreakMatcher(options) {
        options = options || {};
        this._breakType = options.breakType;
      }
      BreakMatcher.prototype.matches = function(element) {
        return element.type === "break" && (this._breakType === void 0 || element.breakType === this._breakType);
      };
      function isList(element, levelIndex, isOrdered) {
        return element.numbering && element.numbering.level == levelIndex && element.numbering.isOrdered == isOrdered;
      }
      function equalTo(value) {
        return {
          operator: operatorEqualTo,
          operand: value
        };
      }
      function startsWith(value) {
        return {
          operator: operatorStartsWith,
          operand: value
        };
      }
      function operatorEqualTo(first2, second) {
        return first2.toUpperCase() === second.toUpperCase();
      }
      function operatorStartsWith(first2, second) {
        return second.toUpperCase().indexOf(first2.toUpperCase()) === 0;
      }
    }
  });

  // node_modules/mammoth/lib/styles/parser/tokeniser.js
  var require_tokeniser = __commonJS({
    "node_modules/mammoth/lib/styles/parser/tokeniser.js"(exports2) {
      var lop = require_lop();
      var RegexTokeniser = lop.RegexTokeniser;
      exports2.tokenise = tokenise;
      var stringPrefix = "'((?:\\\\.|[^'])*)";
      function tokenise(string) {
        var identifierCharacter = "(?:[a-zA-Z\\-_]|\\\\.)";
        var tokeniser = new RegexTokeniser([
          { name: "identifier", regex: new RegExp("(" + identifierCharacter + "(?:" + identifierCharacter + "|[0-9])*)") },
          { name: "dot", regex: /\./ },
          { name: "colon", regex: /:/ },
          { name: "gt", regex: />/ },
          { name: "whitespace", regex: /\s+/ },
          { name: "arrow", regex: /=>/ },
          { name: "equals", regex: /=/ },
          { name: "startsWith", regex: /\^=/ },
          { name: "open-paren", regex: /\(/ },
          { name: "close-paren", regex: /\)/ },
          { name: "open-square-bracket", regex: /\[/ },
          { name: "close-square-bracket", regex: /\]/ },
          { name: "string", regex: new RegExp(stringPrefix + "'") },
          { name: "unterminated-string", regex: new RegExp(stringPrefix) },
          { name: "integer", regex: /([0-9]+)/ },
          { name: "choice", regex: /\|/ },
          { name: "bang", regex: /(!)/ }
        ]);
        return tokeniser.tokenise(string);
      }
    }
  });

  // node_modules/mammoth/lib/style-reader.js
  var require_style_reader = __commonJS({
    "node_modules/mammoth/lib/style-reader.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var lop = require_lop();
      var documentMatchers = require_document_matchers();
      var htmlPaths = require_html_paths();
      var tokenise = require_tokeniser().tokenise;
      var results = require_results();
      exports2.readHtmlPath = readHtmlPath;
      exports2.readDocumentMatcher = readDocumentMatcher;
      exports2.readStyle = readStyle;
      function readStyle(string) {
        return parseString(styleRule, string);
      }
      function createStyleRule() {
        return lop.rules.sequence(
          lop.rules.sequence.capture(documentMatcherRule()),
          lop.rules.tokenOfType("whitespace"),
          lop.rules.tokenOfType("arrow"),
          lop.rules.sequence.capture(lop.rules.optional(lop.rules.sequence(
            lop.rules.tokenOfType("whitespace"),
            lop.rules.sequence.capture(htmlPathRule())
          ).head())),
          lop.rules.tokenOfType("end")
        ).map(function(documentMatcher, htmlPath) {
          return {
            from: documentMatcher,
            to: htmlPath.valueOrElse(htmlPaths.empty)
          };
        });
      }
      function readDocumentMatcher(string) {
        return parseString(documentMatcherRule(), string);
      }
      function documentMatcherRule() {
        var sequence = lop.rules.sequence;
        var identifierToConstant = function(identifier, constant2) {
          return lop.rules.then(
            lop.rules.token("identifier", identifier),
            function() {
              return constant2;
            }
          );
        };
        var paragraphRule = identifierToConstant("p", documentMatchers.paragraph);
        var runRule = identifierToConstant("r", documentMatchers.run);
        var elementTypeRule = lop.rules.firstOf(
          "p or r or table",
          paragraphRule,
          runRule
        );
        var styleIdRule = lop.rules.sequence(
          lop.rules.tokenOfType("dot"),
          lop.rules.sequence.cut(),
          lop.rules.sequence.capture(identifierRule)
        ).map(function(styleId) {
          return { styleId };
        });
        var styleNameMatcherRule = lop.rules.firstOf(
          "style name matcher",
          lop.rules.then(
            lop.rules.sequence(
              lop.rules.tokenOfType("equals"),
              lop.rules.sequence.cut(),
              lop.rules.sequence.capture(stringRule)
            ).head(),
            function(styleName) {
              return { styleName: documentMatchers.equalTo(styleName) };
            }
          ),
          lop.rules.then(
            lop.rules.sequence(
              lop.rules.tokenOfType("startsWith"),
              lop.rules.sequence.cut(),
              lop.rules.sequence.capture(stringRule)
            ).head(),
            function(styleName) {
              return { styleName: documentMatchers.startsWith(styleName) };
            }
          )
        );
        var styleNameRule = lop.rules.sequence(
          lop.rules.tokenOfType("open-square-bracket"),
          lop.rules.sequence.cut(),
          lop.rules.token("identifier", "style-name"),
          lop.rules.sequence.capture(styleNameMatcherRule),
          lop.rules.tokenOfType("close-square-bracket")
        ).head();
        var listTypeRule = lop.rules.firstOf(
          "list type",
          identifierToConstant("ordered-list", { isOrdered: true }),
          identifierToConstant("unordered-list", { isOrdered: false })
        );
        var listRule = sequence(
          lop.rules.tokenOfType("colon"),
          sequence.capture(listTypeRule),
          sequence.cut(),
          lop.rules.tokenOfType("open-paren"),
          sequence.capture(integerRule),
          lop.rules.tokenOfType("close-paren")
        ).map(function(listType, levelNumber) {
          return {
            list: {
              isOrdered: listType.isOrdered,
              levelIndex: levelNumber - 1
            }
          };
        });
        function createMatcherSuffixesRule(rules2) {
          var matcherSuffix = lop.rules.firstOf.apply(
            lop.rules.firstOf,
            ["matcher suffix"].concat(rules2)
          );
          var matcherSuffixes = lop.rules.zeroOrMore(matcherSuffix);
          return lop.rules.then(matcherSuffixes, function(suffixes) {
            var matcherOptions = {};
            suffixes.forEach(function(suffix) {
              _3.extend(matcherOptions, suffix);
            });
            return matcherOptions;
          });
        }
        var paragraphOrRun = sequence(
          sequence.capture(elementTypeRule),
          sequence.capture(createMatcherSuffixesRule([
            styleIdRule,
            styleNameRule,
            listRule
          ]))
        ).map(function(createMatcher, matcherOptions) {
          return createMatcher(matcherOptions);
        });
        var table = sequence(
          lop.rules.token("identifier", "table"),
          sequence.capture(createMatcherSuffixesRule([
            styleIdRule,
            styleNameRule
          ]))
        ).map(function(options) {
          return documentMatchers.table(options);
        });
        var bold = identifierToConstant("b", documentMatchers.bold);
        var italic = identifierToConstant("i", documentMatchers.italic);
        var underline = identifierToConstant("u", documentMatchers.underline);
        var strikethrough = identifierToConstant("strike", documentMatchers.strikethrough);
        var allCaps = identifierToConstant("all-caps", documentMatchers.allCaps);
        var smallCaps = identifierToConstant("small-caps", documentMatchers.smallCaps);
        var highlight = sequence(
          lop.rules.token("identifier", "highlight"),
          lop.rules.sequence.capture(lop.rules.optional(lop.rules.sequence(
            lop.rules.tokenOfType("open-square-bracket"),
            lop.rules.sequence.cut(),
            lop.rules.token("identifier", "color"),
            lop.rules.tokenOfType("equals"),
            lop.rules.sequence.capture(stringRule),
            lop.rules.tokenOfType("close-square-bracket")
          ).head()))
        ).map(function(color) {
          return documentMatchers.highlight({
            color: color.valueOrElse(void 0)
          });
        });
        var commentReference = identifierToConstant("comment-reference", documentMatchers.commentReference);
        var breakMatcher = sequence(
          lop.rules.token("identifier", "br"),
          sequence.cut(),
          lop.rules.tokenOfType("open-square-bracket"),
          lop.rules.token("identifier", "type"),
          lop.rules.tokenOfType("equals"),
          sequence.capture(stringRule),
          lop.rules.tokenOfType("close-square-bracket")
        ).map(function(breakType) {
          switch (breakType) {
            case "line":
              return documentMatchers.lineBreak;
            case "page":
              return documentMatchers.pageBreak;
            case "column":
              return documentMatchers.columnBreak;
            default:
          }
        });
        return lop.rules.firstOf(
          "element type",
          paragraphOrRun,
          table,
          bold,
          italic,
          underline,
          strikethrough,
          allCaps,
          smallCaps,
          highlight,
          commentReference,
          breakMatcher
        );
      }
      function readHtmlPath(string) {
        return parseString(htmlPathRule(), string);
      }
      function htmlPathRule() {
        var capture = lop.rules.sequence.capture;
        var whitespaceRule = lop.rules.tokenOfType("whitespace");
        var freshRule = lop.rules.then(
          lop.rules.optional(lop.rules.sequence(
            lop.rules.tokenOfType("colon"),
            lop.rules.token("identifier", "fresh")
          )),
          function(option) {
            return option.map(function() {
              return true;
            }).valueOrElse(false);
          }
        );
        var separatorRule = lop.rules.then(
          lop.rules.optional(lop.rules.sequence(
            lop.rules.tokenOfType("colon"),
            lop.rules.token("identifier", "separator"),
            lop.rules.tokenOfType("open-paren"),
            capture(stringRule),
            lop.rules.tokenOfType("close-paren")
          ).head()),
          function(option) {
            return option.valueOrElse("");
          }
        );
        var tagNamesRule = lop.rules.oneOrMoreWithSeparator(
          identifierRule,
          lop.rules.tokenOfType("choice")
        );
        var styleElementRule = lop.rules.sequence(
          capture(tagNamesRule),
          capture(lop.rules.zeroOrMore(attributeOrClassRule)),
          capture(freshRule),
          capture(separatorRule)
        ).map(function(tagName, attributesList, fresh, separator) {
          var attributes = {};
          var options = {};
          attributesList.forEach(function(attribute) {
            if (attribute.append && attributes[attribute.name]) {
              attributes[attribute.name] += " " + attribute.value;
            } else {
              attributes[attribute.name] = attribute.value;
            }
          });
          if (fresh) {
            options.fresh = true;
          }
          if (separator) {
            options.separator = separator;
          }
          return htmlPaths.element(tagName, attributes, options);
        });
        return lop.rules.firstOf(
          "html path",
          lop.rules.then(lop.rules.tokenOfType("bang"), function() {
            return htmlPaths.ignore;
          }),
          lop.rules.then(
            lop.rules.zeroOrMoreWithSeparator(
              styleElementRule,
              lop.rules.sequence(
                whitespaceRule,
                lop.rules.tokenOfType("gt"),
                whitespaceRule
              )
            ),
            htmlPaths.elements
          )
        );
      }
      var identifierRule = lop.rules.then(
        lop.rules.tokenOfType("identifier"),
        decodeEscapeSequences
      );
      var integerRule = lop.rules.tokenOfType("integer");
      var stringRule = lop.rules.then(
        lop.rules.tokenOfType("string"),
        decodeEscapeSequences
      );
      var escapeSequences = {
        "n": "\n",
        "r": "\r",
        "t": "	"
      };
      function decodeEscapeSequences(value) {
        return value.replace(/\\(.)/g, function(match, code) {
          return escapeSequences[code] || code;
        });
      }
      var attributeRule = lop.rules.sequence(
        lop.rules.tokenOfType("open-square-bracket"),
        lop.rules.sequence.cut(),
        lop.rules.sequence.capture(identifierRule),
        lop.rules.tokenOfType("equals"),
        lop.rules.sequence.capture(stringRule),
        lop.rules.tokenOfType("close-square-bracket")
      ).map(function(name, value) {
        return { name, value, append: false };
      });
      var classRule = lop.rules.sequence(
        lop.rules.tokenOfType("dot"),
        lop.rules.sequence.cut(),
        lop.rules.sequence.capture(identifierRule)
      ).map(function(className) {
        return { name: "class", value: className, append: true };
      });
      var attributeOrClassRule = lop.rules.firstOf(
        "attribute or class",
        attributeRule,
        classRule
      );
      function parseString(rule, string) {
        var tokens = tokenise(string);
        var parser = lop.Parser();
        var parseResult = parser.parseTokens(rule, tokens);
        if (parseResult.isSuccess()) {
          return results.success(parseResult.value());
        } else {
          return new results.Result(null, [results.warning(describeFailure(string, parseResult))]);
        }
      }
      function describeFailure(input, parseResult) {
        return "Did not understand this style mapping, so ignored it: " + input + "\n" + parseResult.errors().map(describeError).join("\n");
      }
      function describeError(error) {
        return "Error was at character number " + error.characterNumber() + ": Expected " + error.expected + " but got " + error.actual;
      }
      var styleRule = createStyleRule();
    }
  });

  // node_modules/mammoth/lib/options-reader.js
  var require_options_reader = __commonJS({
    "node_modules/mammoth/lib/options-reader.js"(exports2) {
      exports2.readOptions = readOptions;
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var defaultStyleMap = exports2._defaultStyleMap = [
        "p.Heading1 => h1:fresh",
        "p.Heading2 => h2:fresh",
        "p.Heading3 => h3:fresh",
        "p.Heading4 => h4:fresh",
        "p.Heading5 => h5:fresh",
        "p.Heading6 => h6:fresh",
        "p[style-name='Heading 1'] => h1:fresh",
        "p[style-name='Heading 2'] => h2:fresh",
        "p[style-name='Heading 3'] => h3:fresh",
        "p[style-name='Heading 4'] => h4:fresh",
        "p[style-name='Heading 5'] => h5:fresh",
        "p[style-name='Heading 6'] => h6:fresh",
        "p[style-name='heading 1'] => h1:fresh",
        "p[style-name='heading 2'] => h2:fresh",
        "p[style-name='heading 3'] => h3:fresh",
        "p[style-name='heading 4'] => h4:fresh",
        "p[style-name='heading 5'] => h5:fresh",
        "p[style-name='heading 6'] => h6:fresh",
        // Apple Pages
        "p.Heading => h1:fresh",
        "p[style-name='Heading'] => h1:fresh",
        "r[style-name='Strong'] => strong",
        "p[style-name='footnote text'] => p:fresh",
        "r[style-name='footnote reference'] =>",
        "p[style-name='endnote text'] => p:fresh",
        "r[style-name='endnote reference'] =>",
        "p[style-name='annotation text'] => p:fresh",
        "r[style-name='annotation reference'] =>",
        // LibreOffice
        "p[style-name='Footnote'] => p:fresh",
        "r[style-name='Footnote anchor'] =>",
        "p[style-name='Endnote'] => p:fresh",
        "r[style-name='Endnote anchor'] =>",
        "p:unordered-list(1) => ul > li:fresh",
        "p:unordered-list(2) => ul|ol > li > ul > li:fresh",
        "p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh",
        "p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh",
        "p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh",
        "p:ordered-list(1) => ol > li:fresh",
        "p:ordered-list(2) => ul|ol > li > ol > li:fresh",
        "p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh",
        "p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh",
        "p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh",
        "r[style-name='Hyperlink'] =>",
        "p[style-name='Normal'] => p:fresh",
        // Apple Pages
        "p.Body => p:fresh",
        "p[style-name='Body'] => p:fresh"
      ];
      var standardOptions = exports2._standardOptions = {
        externalFileAccess: false,
        transformDocument: identity2,
        includeDefaultStyleMap: true,
        includeEmbeddedStyleMap: true
      };
      function readOptions(options) {
        options = options || {};
        return _3.extend({}, standardOptions, options, {
          customStyleMap: readStyleMap(options.styleMap),
          readStyleMap: function() {
            var styleMap = this.customStyleMap;
            if (this.includeEmbeddedStyleMap) {
              styleMap = styleMap.concat(readStyleMap(this.embeddedStyleMap));
            }
            if (this.includeDefaultStyleMap) {
              styleMap = styleMap.concat(defaultStyleMap);
            }
            return styleMap;
          }
        });
      }
      function readStyleMap(styleMap) {
        if (!styleMap) {
          return [];
        } else if (_3.isString(styleMap)) {
          return styleMap.split("\n").map(function(line) {
            return line.trim();
          }).filter(function(line) {
            return line !== "" && line.charAt(0) !== "#";
          });
        } else {
          return styleMap;
        }
      }
      function identity2(value) {
        return value;
      }
    }
  });

  // node_modules/mammoth/browser/unzip.js
  var require_unzip = __commonJS({
    "node_modules/mammoth/browser/unzip.js"(exports2) {
      var promises = require_promises();
      var zipfile = require_zipfile();
      exports2.openZip = openZip;
      function openZip(options) {
        if (options.arrayBuffer) {
          return promises.resolve(zipfile.openArrayBuffer(options.arrayBuffer));
        } else {
          return promises.reject(new Error("Could not find file in options"));
        }
      }
    }
  });

  // node_modules/mammoth/lib/underline.js
  var require_underline = __commonJS({
    "node_modules/mammoth/lib/underline.js"(exports2) {
      var htmlPaths = require_html_paths();
      var Html = require_html();
      exports2.element = element;
      function element(name) {
        return function(html) {
          return Html.elementWithTag(htmlPaths.element(name), [html]);
        };
      }
    }
  });

  // node_modules/mammoth/lib/index.js
  var require_lib3 = __commonJS({
    "node_modules/mammoth/lib/index.js"(exports2) {
      var _3 = (init_index_all(), __toCommonJS(index_all_exports));
      var docxReader = require_docx_reader();
      var docxStyleMap = require_style_map();
      var DocumentConverter = require_document_to_html().DocumentConverter;
      var convertElementToRawText = require_raw_text().convertElementToRawText;
      var readStyle = require_style_reader().readStyle;
      var readOptions = require_options_reader().readOptions;
      var unzip2 = require_unzip();
      var Result = require_results().Result;
      exports2.convertToHtml = convertToHtml;
      exports2.convertToMarkdown = convertToMarkdown;
      exports2.convert = convert;
      exports2.extractRawText = extractRawText;
      exports2.images = require_images();
      exports2.transforms = require_transforms();
      exports2.underline = require_underline();
      exports2.embedStyleMap = embedStyleMap;
      exports2.readEmbeddedStyleMap = readEmbeddedStyleMap;
      function convertToHtml(input, options) {
        return convert(input, options);
      }
      function convertToMarkdown(input, options) {
        var markdownOptions = Object.create(options || {});
        markdownOptions.outputFormat = "markdown";
        return convert(input, markdownOptions);
      }
      function convert(input, options) {
        options = readOptions(options);
        return unzip2.openZip(input).tap(function(docxFile) {
          return docxStyleMap.readStyleMap(docxFile).then(function(styleMap) {
            options.embeddedStyleMap = styleMap;
          });
        }).then(function(docxFile) {
          return docxReader.read(docxFile, input, options).then(function(documentResult) {
            return documentResult.map(options.transformDocument);
          }).then(function(documentResult) {
            return convertDocumentToHtml(documentResult, options);
          });
        });
      }
      function readEmbeddedStyleMap(input) {
        return unzip2.openZip(input).then(docxStyleMap.readStyleMap);
      }
      function convertDocumentToHtml(documentResult, options) {
        var styleMapResult = parseStyleMap(options.readStyleMap());
        var parsedOptions = _3.extend({}, options, {
          styleMap: styleMapResult.value
        });
        var documentConverter = new DocumentConverter(parsedOptions);
        return documentResult.flatMapThen(function(document2) {
          return styleMapResult.flatMapThen(function(styleMap) {
            return documentConverter.convertToHtml(document2);
          });
        });
      }
      function parseStyleMap(styleMap) {
        return Result.combine((styleMap || []).map(readStyle)).map(function(styleMap2) {
          return styleMap2.filter(function(styleMapping) {
            return !!styleMapping;
          });
        });
      }
      function extractRawText(input) {
        return unzip2.openZip(input).then(docxReader.read).then(function(documentResult) {
          return documentResult.map(convertElementToRawText);
        });
      }
      function embedStyleMap(input, styleMap) {
        return unzip2.openZip(input).tap(function(docxFile) {
          return docxStyleMap.writeStyleMap(docxFile, styleMap);
        }).then(function(docxFile) {
          return docxFile.toArrayBuffer();
        }).then(function(arrayBuffer) {
          return {
            toArrayBuffer: function() {
              return arrayBuffer;
            },
            toBuffer: function() {
              return Buffer.from(arrayBuffer);
            }
          };
        });
      }
      exports2.styleMapping = function() {
        throw new Error(`Use a raw string instead of mammoth.styleMapping e.g. "p[style-name='Title'] => h1" instead of mammoth.styleMapping("p[style-name='Title'] => h1")`);
      };
    }
  });

  // node_modules/pdfjs-dist/build/pdf.mjs
  var pdf_exports = {};
  __export(pdf_exports, {
    AbortException: () => AbortException,
    AnnotationEditorLayer: () => AnnotationEditorLayer,
    AnnotationEditorParamsType: () => AnnotationEditorParamsType,
    AnnotationEditorType: () => AnnotationEditorType,
    AnnotationEditorUIManager: () => AnnotationEditorUIManager,
    AnnotationLayer: () => AnnotationLayer,
    AnnotationMode: () => AnnotationMode,
    AnnotationType: () => AnnotationType,
    CSSConstants: () => CSSConstants,
    ColorPicker: () => ColorPicker,
    DOMSVGFactory: () => DOMSVGFactory,
    DrawLayer: () => DrawLayer,
    FeatureTest: () => FeatureTest,
    GlobalWorkerOptions: () => GlobalWorkerOptions,
    ImageKind: () => ImageKind,
    InvalidPDFException: () => InvalidPDFException,
    MathClamp: () => MathClamp,
    OPS: () => OPS,
    OutputScale: () => OutputScale,
    PDFDataRangeTransport: () => PDFDataRangeTransport,
    PDFDateString: () => PDFDateString,
    PDFWorker: () => PDFWorker,
    PasswordException: () => PasswordException,
    PasswordResponses: () => PasswordResponses,
    PermissionFlag: () => PermissionFlag,
    PixelsPerInch: () => PixelsPerInch,
    RenderingCancelledException: () => RenderingCancelledException,
    ResponseException: () => ResponseException,
    SignatureExtractor: () => SignatureExtractor,
    SupportedImageMimeTypes: () => SupportedImageMimeTypes,
    TextLayer: () => TextLayer,
    TextLayerImages: () => TextLayerImages,
    TouchManager: () => TouchManager,
    Util: () => Util,
    VerbosityLevel: () => VerbosityLevel,
    XfaLayer: () => XfaLayer,
    applyOpacity: () => applyOpacity,
    build: () => build,
    createValidAbsoluteUrl: () => createValidAbsoluteUrl,
    fetchData: () => fetchData,
    findContrastColor: () => findContrastColor,
    getDocument: () => getDocument,
    getFilenameFromUrl: () => getFilenameFromUrl,
    getPdfFilenameFromUrl: () => getPdfFilenameFromUrl,
    getRGB: () => getRGB,
    getRGBA: () => getRGBA,
    getUuid: () => getUuid,
    isDataScheme: () => isDataScheme,
    isPdfFile: () => isPdfFile,
    isValidExplicitDest: () => isValidExplicitDest,
    makeArr: () => makeArr,
    makeMap: () => makeMap,
    makeObj: () => makeObj,
    makeSet: () => makeSet,
    noContextMenu: () => noContextMenu,
    normalizeUnicode: () => normalizeUnicode,
    renderRichText: () => renderRichText,
    setLayerDimensions: () => setLayerDimensions,
    shadow: () => shadow,
    stopEvent: () => stopEvent,
    updateUrlHash: () => updateUrlHash,
    version: () => version2
  });
  function setVerbosityLevel(level) {
    if (Number.isInteger(level)) {
      verbosity = level;
    }
  }
  function getVerbosityLevel() {
    return verbosity;
  }
  function info(msg) {
    if (verbosity >= VerbosityLevel.INFOS) {
      console.info(`Info: ${msg}`);
    }
  }
  function warn(msg) {
    if (verbosity >= VerbosityLevel.WARNINGS) {
      console.warn(`Warning: ${msg}`);
    }
  }
  function unreachable(msg) {
    throw new Error(msg);
  }
  function assert(cond, msg) {
    if (!cond) {
      unreachable(msg);
    }
  }
  function _isValidProtocol(url) {
    switch (url?.protocol) {
      case "http:":
      case "https:":
      case "ftp:":
      case "mailto:":
      case "tel:":
        return true;
      default:
        return false;
    }
  }
  function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
    if (!url) {
      return null;
    }
    if (options && typeof url === "string") {
      if (options.addDefaultProtocol && url.startsWith("www.")) {
        const dots = url.match(/\./g);
        if (dots?.length >= 2) {
          url = `http://${url}`;
        }
      }
      if (options.tryConvertEncoding) {
        try {
          url = stringToUTF8String(url);
        } catch {
        }
      }
    }
    const absoluteUrl = baseUrl ? URL.parse(url, baseUrl) : URL.parse(url);
    return _isValidProtocol(absoluteUrl) ? absoluteUrl : null;
  }
  function updateUrlHash(url, hash, allowRel = false) {
    const res = URL.parse(url);
    if (res) {
      res.hash = hash;
      return res.href;
    }
    if (allowRel && createValidAbsoluteUrl(url, "http://example.com")) {
      return url.split("#", 1)[0] + `${hash ? `#${hash}` : ""}`;
    }
    return "";
  }
  function stripPath(str) {
    return str.substring(str.lastIndexOf("/") + 1);
  }
  function shadow(obj2, prop, value, nonSerializable = false) {
    Object.defineProperty(obj2, prop, {
      value,
      enumerable: !nonSerializable,
      configurable: true,
      writable: false
    });
    return value;
  }
  function bytesToString(bytes) {
    if (typeof bytes !== "object" || bytes?.length === void 0) {
      unreachable("Invalid argument for bytesToString");
    }
    const length = bytes.length;
    const MAX_ARGUMENT_COUNT = 8192;
    if (length < MAX_ARGUMENT_COUNT) {
      return String.fromCharCode.apply(null, bytes);
    }
    const strBuf = [];
    for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
      const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
      const chunk2 = bytes.subarray(i, chunkEnd);
      strBuf.push(String.fromCharCode.apply(null, chunk2));
    }
    return strBuf.join("");
  }
  function stringToBytes(str) {
    if (typeof str !== "string") {
      unreachable("Invalid argument for stringToBytes");
    }
    const length = str.length;
    const bytes = new Uint8Array(length);
    for (let i = 0; i < length; ++i) {
      bytes[i] = str.charCodeAt(i) & 255;
    }
    return bytes;
  }
  function stringToUTF8String(str) {
    return decodeURIComponent(escape(str));
  }
  function normalizeUnicode(str) {
    if (!NormalizeRegex) {
      NormalizeRegex = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;
      NormalizationMap = /* @__PURE__ */ new Map([["\uFB05", "\u017Ft"]]);
    }
    return str.replaceAll(NormalizeRegex, (_3, p1, p2) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2));
  }
  function getUuid() {
    if (typeof crypto.randomUUID === "function") {
      return crypto.randomUUID();
    }
    const buf = new Uint8Array(32);
    crypto.getRandomValues(buf);
    return bytesToString(buf);
  }
  function _isValidExplicitDest(validRef, validName, dest) {
    if (!Array.isArray(dest) || dest.length < 2) {
      return false;
    }
    const [page, zoom, ...args] = dest;
    if (!validRef(page) && !Number.isInteger(page)) {
      return false;
    }
    if (!validName(zoom)) {
      return false;
    }
    const argsLen = args.length;
    let allowNull = true;
    switch (zoom.name) {
      case "XYZ":
        if (argsLen < 2 || argsLen > 3) {
          return false;
        }
        break;
      case "Fit":
      case "FitB":
        return argsLen === 0;
      case "FitH":
      case "FitBH":
      case "FitV":
      case "FitBV":
        if (argsLen > 1) {
          return false;
        }
        break;
      case "FitR":
        if (argsLen !== 4) {
          return false;
        }
        allowNull = false;
        break;
      default:
        return false;
    }
    for (const arg of args) {
      if (typeof arg === "number" || allowNull && arg === null) {
        continue;
      }
      return false;
    }
    return true;
  }
  function MathClamp(v, min2, max2) {
    return Math.min(Math.max(v, min2), max2);
  }
  async function fetchData(url, type = "text") {
    if (isValidFetchUrl(url, document.baseURI)) {
      const response = await fetch(url);
      if (!response.ok) {
        throw new Error(response.statusText);
      }
      switch (type) {
        case "blob":
          return response.blob();
        case "bytes":
          return response.bytes();
        case "json":
          return response.json();
      }
      return response.text();
    }
    return new Promise((resolve, reject2) => {
      const request = new XMLHttpRequest();
      request.open("GET", url, true);
      request.responseType = type === "bytes" ? "arraybuffer" : type;
      request.onreadystatechange = () => {
        if (request.readyState !== XMLHttpRequest.DONE) {
          return;
        }
        if (request.status === 200 || request.status === 0) {
          switch (type) {
            case "bytes":
              resolve(new Uint8Array(request.response));
              return;
            case "blob":
            case "json":
              resolve(request.response);
              return;
          }
          resolve(request.responseText);
          return;
        }
        reject2(new Error(request.statusText));
      };
      request.send(null);
    });
  }
  function isDataScheme(url) {
    const ii = url.length;
    let i = 0;
    while (i < ii && url[i].trim() === "") {
      i++;
    }
    return url.substring(i, i + 5).toLowerCase() === "data:";
  }
  function isPdfFile(filename) {
    return typeof filename === "string" && /\.pdf$/i.test(filename);
  }
  function getFilenameFromUrl(url) {
    [url] = url.split(/[#?]/, 1);
    return stripPath(url);
  }
  function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
    if (typeof url !== "string") {
      return defaultFilename;
    }
    if (isDataScheme(url)) {
      warn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');
      return defaultFilename;
    }
    const getURL = (urlString) => {
      try {
        return new URL(urlString);
      } catch {
      }
      try {
        return new URL(decodeURIComponent(urlString));
      } catch {
      }
      try {
        return new URL(urlString, "https://foo.bar");
      } catch {
      }
      try {
        return new URL(decodeURIComponent(urlString), "https://foo.bar");
      } catch {
      }
      return null;
    };
    const newURL = getURL(url);
    if (!newURL) {
      return defaultFilename;
    }
    const decode = (name) => {
      try {
        let decoded = decodeURIComponent(name);
        if (decoded.includes("/")) {
          decoded = stripPath(decoded);
          if (decoded.length === 4 && pdfRegex.test(decoded)) {
            return name;
          }
        }
        return decoded;
      } catch {
        return name;
      }
    };
    const pdfRegex = /\.pdf$/i;
    const filename = stripPath(newURL.pathname);
    if (pdfRegex.test(filename)) {
      return decode(filename);
    }
    if (newURL.searchParams.size > 0) {
      const getLast = (iterator) => [...iterator].findLast((v) => pdfRegex.test(v));
      const name = getLast(newURL.searchParams.values()) ?? getLast(newURL.searchParams.keys());
      if (name) {
        return decode(name);
      }
    }
    if (newURL.hash) {
      const reFilename = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
      const hashFilename = reFilename.exec(newURL.hash);
      if (hashFilename) {
        return decode(hashFilename[0]);
      }
    }
    return defaultFilename;
  }
  function isValidFetchUrl(url, baseUrl) {
    const res = baseUrl ? URL.parse(url, baseUrl) : URL.parse(url);
    return /https?:/.test(res?.protocol ?? "");
  }
  function noContextMenu(e) {
    e.preventDefault();
  }
  function stopEvent(e) {
    e.preventDefault();
    e.stopPropagation();
  }
  function getRGBA(color) {
    if (color.startsWith("#")) {
      const hex = color.slice(1);
      return [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16), hex.length >= 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1];
    }
    if (color.startsWith("rgb(")) {
      const [r, g, b] = color.slice(4, -1).split(",").map((x) => parseInt(x, 10));
      return [r, g, b, 1];
    }
    if (color.startsWith("rgba(")) {
      const parts = color.slice(5, -1).split(",");
      return [parseInt(parts[0], 10), parseInt(parts[1], 10), parseInt(parts[2], 10), parseFloat(parts[3])];
    }
    const m = color.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);
    if (m) {
      return [Math.round(parseFloat(m[1]) * 255), Math.round(parseFloat(m[2]) * 255), Math.round(parseFloat(m[3]) * 255), m[4] !== void 0 && m[4] !== "none" ? parseFloat(m[4]) : 1];
    }
    return null;
  }
  function getRGB(color) {
    const rgba = getRGBA(color);
    if (!rgba) {
      warn(`Not a valid color format: "${color}"`);
      return [0, 0, 0];
    }
    return rgba.slice(0, 3);
  }
  function getColorValues(colors) {
    const span = document.createElement("span");
    span.style.visibility = "hidden";
    span.style.colorScheme = "only light";
    document.body.append(span);
    for (const name of colors.keys()) {
      span.style.color = name;
      const computedColor = window.getComputedStyle(span).color;
      colors.set(name, getRGB(computedColor));
    }
    span.remove();
  }
  function getCurrentTransform(ctx) {
    const {
      a,
      b,
      c,
      d,
      e,
      f
    } = ctx.getTransform();
    return [a, b, c, d, e, f];
  }
  function getCurrentTransformInverse(ctx) {
    const {
      a,
      b,
      c,
      d,
      e,
      f
    } = ctx.getTransform().invertSelf();
    return [a, b, c, d, e, f];
  }
  function setLayerDimensions(div, viewport, mustFlip = false, mustRotate = true) {
    if (viewport instanceof PageViewport) {
      const {
        pageWidth,
        pageHeight
      } = viewport.rawDims;
      const {
        style
      } = div;
      const widthStr = `round(down, var(--total-scale-factor) * ${pageWidth}px, var(--scale-round-x))`, heightStr = `round(down, var(--total-scale-factor) * ${pageHeight}px, var(--scale-round-y))`;
      if (!mustFlip || viewport.rotation % 180 === 0) {
        style.width = widthStr;
        style.height = heightStr;
      } else {
        style.width = heightStr;
        style.height = widthStr;
      }
    }
    if (mustRotate) {
      div.setAttribute("data-main-rotation", viewport.rotation);
    }
  }
  function applyOpacity(color, opacity) {
    opacity = MathClamp(opacity ?? 1, 0, 1);
    const white = 255 * (1 - opacity);
    return color.map((c) => Math.round(c * opacity + white));
  }
  function RGBToHSL(rgb, output) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const max2 = Math.max(r, g, b);
    const min2 = Math.min(r, g, b);
    const l2 = (max2 + min2) / 2;
    if (max2 === min2) {
      output[0] = output[1] = 0;
    } else {
      const d = max2 - min2;
      output[1] = l2 < 0.5 ? d / (max2 + min2) : d / (2 - max2 - min2);
      switch (max2) {
        case r:
          output[0] = ((g - b) / d + (g < b ? 6 : 0)) * 60;
          break;
        case g:
          output[0] = ((b - r) / d + 2) * 60;
          break;
        case b:
          output[0] = ((r - g) / d + 4) * 60;
          break;
      }
    }
    output[2] = l2;
  }
  function HSLToRGB(hsl, output) {
    const h = hsl[0];
    const s = hsl[1];
    const l2 = hsl[2];
    const c = (1 - Math.abs(2 * l2 - 1)) * s;
    const x = c * (1 - Math.abs(h / 60 % 2 - 1));
    const m = l2 - c / 2;
    switch (Math.floor(h / 60)) {
      case 0:
        output[0] = c + m;
        output[1] = x + m;
        output[2] = m;
        break;
      case 1:
        output[0] = x + m;
        output[1] = c + m;
        output[2] = m;
        break;
      case 2:
        output[0] = m;
        output[1] = c + m;
        output[2] = x + m;
        break;
      case 3:
        output[0] = m;
        output[1] = x + m;
        output[2] = c + m;
        break;
      case 4:
        output[0] = x + m;
        output[1] = m;
        output[2] = c + m;
        break;
      case 5:
      case 6:
        output[0] = c + m;
        output[1] = m;
        output[2] = x + m;
        break;
    }
  }
  function computeLuminance(x) {
    return x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
  }
  function contrastRatio(hsl1, hsl2, output) {
    HSLToRGB(hsl1, output);
    output.map(computeLuminance);
    const lum1 = 0.2126 * output[0] + 0.7152 * output[1] + 0.0722 * output[2];
    HSLToRGB(hsl2, output);
    output.map(computeLuminance);
    const lum2 = 0.2126 * output[0] + 0.7152 * output[1] + 0.0722 * output[2];
    return lum1 > lum2 ? (lum1 + 0.05) / (lum2 + 0.05) : (lum2 + 0.05) / (lum1 + 0.05);
  }
  function findContrastColor(baseColor, fixedColor) {
    const key = baseColor[0] + baseColor[1] * 256 + baseColor[2] * 65536 + fixedColor[0] * 16777216 + fixedColor[1] * 4294967296 + fixedColor[2] * 1099511627776;
    let cachedValue = contrastCache.get(key);
    if (cachedValue) {
      return cachedValue;
    }
    const array = new Float32Array(9);
    const output = array.subarray(0, 3);
    const baseHSL = array.subarray(3, 6);
    RGBToHSL(baseColor, baseHSL);
    const fixedHSL = array.subarray(6, 9);
    RGBToHSL(fixedColor, fixedHSL);
    const isFixedColorDark = fixedHSL[2] < 0.5;
    const minContrast = isFixedColorDark ? 12 : 4.5;
    baseHSL[2] = isFixedColorDark ? Math.sqrt(baseHSL[2]) : 1 - Math.sqrt(1 - baseHSL[2]);
    if (contrastRatio(baseHSL, fixedHSL, output) < minContrast) {
      let start, end;
      if (isFixedColorDark) {
        start = baseHSL[2];
        end = 1;
      } else {
        start = 0;
        end = baseHSL[2];
      }
      const PRECISION = 5e-3;
      while (end - start > PRECISION) {
        const mid = baseHSL[2] = (start + end) / 2;
        if (isFixedColorDark === contrastRatio(baseHSL, fixedHSL, output) < minContrast) {
          start = mid;
        } else {
          end = mid;
        }
      }
      baseHSL[2] = isFixedColorDark ? end : start;
    }
    HSLToRGB(baseHSL, output);
    cachedValue = Util.makeHexColor(Math.round(output[0] * 255), Math.round(output[1] * 255), Math.round(output[2] * 255));
    contrastCache.set(key, cachedValue);
    return cachedValue;
  }
  function renderRichText({
    html,
    dir,
    className
  }, container) {
    const fragment = document.createDocumentFragment();
    if (typeof html === "string") {
      const p = document.createElement("p");
      p.dir = dir || "auto";
      const lines = html.split(/\r\n?|\n/);
      for (let i = 0, ii = lines.length; i < ii; ++i) {
        const line = lines[i];
        p.append(document.createTextNode(line));
        if (i < ii - 1) {
          p.append(document.createElement("br"));
        }
      }
      fragment.append(p);
    } else {
      XfaLayer.render({
        xfaHtml: html,
        div: fragment,
        intent: "richText"
      });
    }
    fragment.firstElementChild.classList.add("richText", className);
    container.append(fragment);
  }
  function makePathFromDrawOPS(data) {
    const path = new Path2D();
    if (!data) {
      return path;
    }
    for (let i = 0, ii = data.length; i < ii; ) {
      switch (data[i++]) {
        case DrawOPS.moveTo:
          path.moveTo(data[i++], data[i++]);
          break;
        case DrawOPS.lineTo:
          path.lineTo(data[i++], data[i++]);
          break;
        case DrawOPS.curveTo:
          path.bezierCurveTo(data[i++], data[i++], data[i++], data[i++], data[i++], data[i++]);
          break;
        case DrawOPS.quadraticCurveTo:
          path.quadraticCurveTo(data[i++], data[i++], data[i++], data[i++]);
          break;
        case DrawOPS.closePath:
          path.closePath();
          break;
        default:
          warn(`Unrecognized drawing path operator: ${data[i - 1]}`);
          break;
      }
    }
    return path;
  }
  function bindEvents(obj2, element, names) {
    for (const name of names) {
      element.addEventListener(name, obj2[name].bind(obj2));
    }
  }
  function expandBBox(array, index, minX, minY, maxX, maxY) {
    array[index * 4 + 0] = Math.min(array[index * 4 + 0], minX);
    array[index * 4 + 1] = Math.min(array[index * 4 + 1], minY);
    array[index * 4 + 2] = Math.max(array[index * 4 + 2], maxX);
    array[index * 4 + 3] = Math.max(array[index * 4 + 3], maxY);
  }
  function scaleCharBBox(scaleX, scaleY, x, y, bbox) {
    let temp;
    if (scaleX) {
      if (scaleX < 0) {
        temp = bbox[0];
        bbox[0] = bbox[2];
        bbox[2] = temp;
      }
      bbox[0] *= scaleX;
      bbox[2] *= scaleX;
      if (scaleY < 0) {
        temp = bbox[1];
        bbox[1] = bbox[3];
        bbox[3] = temp;
      }
      bbox[1] *= scaleY;
      bbox[3] *= scaleY;
    } else {
      bbox.fill(0);
    }
    bbox[0] += x;
    bbox[1] += y;
    bbox[2] += x;
    bbox[3] += y;
  }
  function getUrlProp(val) {
    if (val instanceof URL) {
      return val;
    }
    if (typeof val === "string") {
      if (isNodeJS) {
        if (/^[a-z][a-z0-9\-+.]+:/i.test(val)) {
          return new URL(val);
        }
        const url2 = process.getBuiltinModule("url");
        return new URL(url2.pathToFileURL(val));
      }
      const url = URL.parse(val, window.location);
      if (url) {
        return url;
      }
    }
    throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");
  }
  function getDataProp(val) {
    if (isNodeJS && typeof Buffer !== "undefined" && val instanceof Buffer) {
      throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
    }
    if (val instanceof Uint8Array && val.byteLength === val.buffer.byteLength) {
      return val;
    }
    if (typeof val === "string") {
      return stringToBytes(val);
    }
    if (val instanceof ArrayBuffer || ArrayBuffer.isView(val) || typeof val === "object" && !isNaN(val?.length)) {
      return new Uint8Array(val);
    }
    throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");
  }
  function getFactoryUrlProp(val) {
    if (typeof val !== "string") {
      return null;
    }
    if (val.endsWith("/")) {
      return val;
    }
    throw new Error(`Invalid factory url: "${val}" must include trailing slash.`);
  }
  function onFn() {
  }
  function wrapReason(ex) {
    if (ex instanceof AbortException || ex instanceof InvalidPDFException || ex instanceof PasswordException || ex instanceof ResponseException || ex instanceof UnknownErrorException) {
      return ex;
    }
    if (!(ex instanceof Error || typeof ex === "object" && ex !== null)) {
      unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
    }
    switch (ex.name) {
      case "AbortException":
        return new AbortException(ex.message);
      case "InvalidPDFException":
        return new InvalidPDFException(ex.message);
      case "PasswordException":
        return new PasswordException(ex.message, ex.code);
      case "ResponseException":
        return new ResponseException(ex.message, ex.status, ex.missing);
      case "UnknownErrorException":
        return new UnknownErrorException(ex.message, ex.details);
    }
    return new UnknownErrorException(ex.message, ex.toString());
  }
  function blend(fg, bg, alpha) {
    return Math.round(alpha * fg + (1 - alpha) * bg);
  }
  async function node_utils_fetchData(url) {
    const fs = process.getBuiltinModule("fs/promises");
    const data = await fs.readFile(url);
    return new Uint8Array(data);
  }
  function convertBlackAndWhiteToRGBA({
    src,
    srcPos = 0,
    dest,
    width,
    height,
    nonBlackColor = 4294967295,
    inverseDecode = false
  }) {
    const black = FeatureTest.isLittleEndian ? 4278190080 : 255;
    const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
    const widthInSource = width >> 3;
    const widthRemainder = width & 7;
    const xorMask = zeroMapping ^ oneMapping;
    const srcLength = src.length;
    dest = new Uint32Array(dest.buffer);
    let destPos = 0;
    for (let i = 0; i < height; ++i) {
      for (const max2 = srcPos + widthInSource; srcPos < max2; ++srcPos, destPos += 8) {
        const elem2 = src[srcPos];
        dest[destPos] = zeroMapping ^ -(elem2 >> 7 & 1) & xorMask;
        dest[destPos + 1] = zeroMapping ^ -(elem2 >> 6 & 1) & xorMask;
        dest[destPos + 2] = zeroMapping ^ -(elem2 >> 5 & 1) & xorMask;
        dest[destPos + 3] = zeroMapping ^ -(elem2 >> 4 & 1) & xorMask;
        dest[destPos + 4] = zeroMapping ^ -(elem2 >> 3 & 1) & xorMask;
        dest[destPos + 5] = zeroMapping ^ -(elem2 >> 2 & 1) & xorMask;
        dest[destPos + 6] = zeroMapping ^ -(elem2 >> 1 & 1) & xorMask;
        dest[destPos + 7] = zeroMapping ^ -(elem2 & 1) & xorMask;
      }
      if (widthRemainder === 0) {
        continue;
      }
      const elem = srcPos < srcLength ? src[srcPos++] : 255;
      for (let j = 0; j < widthRemainder; ++j, ++destPos) {
        dest[destPos] = zeroMapping ^ -(elem >> 7 - j & 1) & xorMask;
      }
    }
    return {
      srcPos,
      destPos
    };
  }
  function convertRGBToRGBA({
    src,
    srcPos = 0,
    dest,
    destPos = 0,
    width,
    height
  }) {
    let i = 0;
    const len = width * height * 3;
    const len32 = len >> 2;
    const src32 = new Uint32Array(src.buffer, srcPos, len32);
    const alphaMask = FeatureTest.isLittleEndian ? 4278190080 : 255;
    if (FeatureTest.isLittleEndian) {
      for (; i < len32 - 2; i += 3, destPos += 4) {
        const s1 = src32[i], s2 = src32[i + 1], s3 = src32[i + 2];
        dest[destPos] = s1 | alphaMask;
        dest[destPos + 1] = s1 >>> 24 | s2 << 8 | alphaMask;
        dest[destPos + 2] = s2 >>> 16 | s3 << 16 | alphaMask;
        dest[destPos + 3] = s3 >>> 8 | alphaMask;
      }
      for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) {
        dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | alphaMask;
      }
    } else {
      for (; i < len32 - 2; i += 3, destPos += 4) {
        const s1 = src32[i], s2 = src32[i + 1], s3 = src32[i + 2];
        dest[destPos] = s1 | alphaMask;
        dest[destPos + 1] = s1 << 24 | s2 >>> 8 | alphaMask;
        dest[destPos + 2] = s2 << 16 | s3 >>> 16 | alphaMask;
        dest[destPos + 3] = s3 << 8 | alphaMask;
      }
      for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) {
        dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | alphaMask;
      }
    }
    return {
      srcPos: srcPos + len,
      destPos
    };
  }
  function initGPU() {
    return _webGPU.init();
  }
  function isGPUReady() {
    return _webGPU.isReady;
  }
  function loadMeshShader() {
    _webGPU.loadMeshShader();
  }
  function drawMeshWithGPU(posData, colData, vertexCount, context, backgroundColor, paddedWidth, paddedHeight, borderSize) {
    return _webGPU.draw(posData, colData, vertexCount, context, backgroundColor, paddedWidth, paddedHeight, borderSize);
  }
  function applyBoundingBox(ctx, bbox) {
    if (!bbox) {
      return;
    }
    const width = bbox[2] - bbox[0];
    const height = bbox[3] - bbox[1];
    const region = new Path2D();
    region.rect(bbox[0], bbox[1], width, height);
    ctx.clip(region);
  }
  function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
    const coords = context.coords, colors = context.colors;
    const bytes = data.data, rowSize = data.width * 4;
    let tmp;
    if (coords[p1 * 2 + 1] > coords[p2 * 2 + 1]) {
      tmp = p1;
      p1 = p2;
      p2 = tmp;
      tmp = c1;
      c1 = c2;
      c2 = tmp;
    }
    if (coords[p2 * 2 + 1] > coords[p3 * 2 + 1]) {
      tmp = p2;
      p2 = p3;
      p3 = tmp;
      tmp = c2;
      c2 = c3;
      c3 = tmp;
    }
    if (coords[p1 * 2 + 1] > coords[p2 * 2 + 1]) {
      tmp = p1;
      p1 = p2;
      p2 = tmp;
      tmp = c1;
      c1 = c2;
      c2 = tmp;
    }
    const x1 = (coords[p1 * 2] + context.offsetX) * context.scaleX;
    const y1 = (coords[p1 * 2 + 1] + context.offsetY) * context.scaleY;
    const x2 = (coords[p2 * 2] + context.offsetX) * context.scaleX;
    const y2 = (coords[p2 * 2 + 1] + context.offsetY) * context.scaleY;
    const x3 = (coords[p3 * 2] + context.offsetX) * context.scaleX;
    const y3 = (coords[p3 * 2 + 1] + context.offsetY) * context.scaleY;
    if (y1 >= y3) {
      return;
    }
    const c1r = colors[c1 * 4], c1g = colors[c1 * 4 + 1], c1b = colors[c1 * 4 + 2];
    const c2r = colors[c2 * 4], c2g = colors[c2 * 4 + 1], c2b = colors[c2 * 4 + 2];
    const c3r = colors[c3 * 4], c3g = colors[c3 * 4 + 1], c3b = colors[c3 * 4 + 2];
    const minY = Math.round(y1), maxY = Math.round(y3);
    let xa, car, cag, cab;
    let xb, cbr, cbg, cbb;
    for (let y = minY; y <= maxY; y++) {
      if (y < y2) {
        const k2 = y < y1 ? 0 : (y1 - y) / (y1 - y2);
        xa = x1 - (x1 - x2) * k2;
        car = c1r - (c1r - c2r) * k2;
        cag = c1g - (c1g - c2g) * k2;
        cab = c1b - (c1b - c2b) * k2;
      } else {
        let k2;
        if (y > y3) {
          k2 = 1;
        } else if (y2 === y3) {
          k2 = 0;
        } else {
          k2 = (y2 - y) / (y2 - y3);
        }
        xa = x2 - (x2 - x3) * k2;
        car = c2r - (c2r - c3r) * k2;
        cag = c2g - (c2g - c3g) * k2;
        cab = c2b - (c2b - c3b) * k2;
      }
      let k;
      if (y < y1) {
        k = 0;
      } else if (y > y3) {
        k = 1;
      } else {
        k = (y1 - y) / (y1 - y3);
      }
      xb = x1 - (x1 - x3) * k;
      cbr = c1r - (c1r - c3r) * k;
      cbg = c1g - (c1g - c3g) * k;
      cbb = c1b - (c1b - c3b) * k;
      const x1_ = Math.round(Math.min(xa, xb));
      const x2_ = Math.round(Math.max(xa, xb));
      let j = rowSize * y + x1_ * 4;
      for (let x = x1_; x <= x2_; x++) {
        k = (xa - x) / (xa - xb);
        if (k < 0) {
          k = 0;
        } else if (k > 1) {
          k = 1;
        }
        bytes[j++] = car - (car - cbr) * k | 0;
        bytes[j++] = cag - (cag - cbg) * k | 0;
        bytes[j++] = cab - (cab - cbb) * k | 0;
        bytes[j++] = 255;
      }
    }
  }
  function getShadingPattern(IR) {
    switch (IR[0]) {
      case "RadialAxial":
        return new RadialAxialShadingPattern(IR);
      case "Mesh":
        return new MeshShadingPattern(IR);
      case "Dummy":
        return new DummyShadingPattern();
    }
    throw new Error(`Unknown IR type: ${IR[0]}`);
  }
  function mirrorContextOperations(ctx, destCtx) {
    if (ctx._removeMirroring) {
      throw new Error("Context is already forwarding operations.");
    }
    const originalMethods = /* @__PURE__ */ new Map();
    for (const name of ["save", "restore", "rotate", "scale", "translate", "transform", "setTransform", "resetTransform", "clip", "moveTo", "lineTo", "bezierCurveTo", "quadraticCurveTo", "arc", "arcTo", "ellipse", "rect", "roundRect", "closePath", "beginPath"]) {
      const original = ctx[name];
      if (typeof original !== "function" || typeof destCtx[name] !== "function") {
        continue;
      }
      originalMethods.set(name, original);
      ctx[name] = function(...args) {
        destCtx[name](...args);
        return original.apply(this, args);
      };
    }
    ctx._removeMirroring = () => {
      for (const [name, original] of originalMethods) {
        ctx[name] = original;
      }
      delete ctx._removeMirroring;
    };
  }
  function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH) {
    const [a, b, c, d, tx, ty] = getCurrentTransform(ctx);
    if (b === 0 && c === 0) {
      const tlX = destX * a + tx;
      const rTlX = Math.round(tlX);
      const tlY = destY * d + ty;
      const rTlY = Math.round(tlY);
      const brX = (destX + destW) * a + tx;
      const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
      const brY = (destY + destH) * d + ty;
      const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
      ctx.setTransform(Math.sign(a), 0, 0, Math.sign(d), rTlX, rTlY);
      ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rWidth, rHeight);
      ctx.setTransform(a, b, c, d, tx, ty);
      return [rWidth, rHeight];
    }
    if (a === 0 && d === 0) {
      const tlX = destY * c + tx;
      const rTlX = Math.round(tlX);
      const tlY = destX * b + ty;
      const rTlY = Math.round(tlY);
      const brX = (destY + destH) * c + tx;
      const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
      const brY = (destX + destW) * b + ty;
      const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
      ctx.setTransform(0, Math.sign(b), Math.sign(c), 0, rTlX, rTlY);
      ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rHeight, rWidth);
      ctx.setTransform(a, b, c, d, tx, ty);
      return [rHeight, rWidth];
    }
    ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH);
    const scaleX = Math.hypot(a, b);
    const scaleY = Math.hypot(c, d);
    return [scaleX * destW, scaleY * destH];
  }
  function putBinaryImageData(ctx, imgData) {
    const {
      width,
      height,
      kind
    } = imgData;
    const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
    const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
    const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
    const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
    let srcPos = 0;
    const src = imgData.data;
    const dest = chunkImgData.data;
    let i;
    if (kind === ImageKind.GRAYSCALE_1BPP) {
      for (i = 0; i < totalChunks; i++) {
        ({
          srcPos
        } = convertBlackAndWhiteToRGBA({
          src,
          srcPos,
          dest,
          width,
          height: i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight
        }));
        ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
      }
    } else if (kind === ImageKind.RGBA_32BPP) {
      let j = 0;
      let elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
      for (i = 0; i < fullChunks; i++) {
        dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
        srcPos += elemsInThisChunk;
        ctx.putImageData(chunkImgData, 0, j);
        j += FULL_CHUNK_HEIGHT;
      }
      if (i < totalChunks) {
        elemsInThisChunk = width * partialChunkHeight * 4;
        dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
        ctx.putImageData(chunkImgData, 0, j);
      }
    } else if (kind === ImageKind.RGB_24BPP) {
      for (i = 0; i < totalChunks; i++) {
        ({
          srcPos
        } = convertRGBToRGBA({
          src,
          srcPos,
          dest: new Uint32Array(dest.buffer),
          width,
          height: i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight
        }));
        ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
      }
    } else {
      throw new Error(`bad image kind: ${kind}`);
    }
  }
  function putBinaryImageMask(ctx, imgData) {
    if (imgData.bitmap) {
      ctx.drawImage(imgData.bitmap, 0, 0);
      return;
    }
    const {
      width,
      height
    } = imgData;
    const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
    const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
    const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
    const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
    let srcPos = 0;
    const src = imgData.data;
    const dest = chunkImgData.data;
    for (let i = 0; i < totalChunks; i++) {
      ({
        srcPos
      } = convertBlackAndWhiteToRGBA({
        src,
        srcPos,
        dest,
        width,
        height: i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight,
        nonBlackColor: 0
      }));
      ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
    }
  }
  function copyCtxState(sourceCtx, destCtx) {
    const properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"];
    for (const property2 of properties) {
      if (sourceCtx[property2] !== void 0) {
        destCtx[property2] = sourceCtx[property2];
      }
    }
    if (sourceCtx.setLineDash !== void 0) {
      destCtx.setLineDash(sourceCtx.getLineDash());
      destCtx.lineDashOffset = sourceCtx.lineDashOffset;
    }
  }
  function resetCtxToDefault(ctx) {
    ctx.strokeStyle = ctx.fillStyle = "#000000";
    ctx.fillRule = "nonzero";
    ctx.globalAlpha = 1;
    ctx.lineWidth = 1;
    ctx.lineCap = "butt";
    ctx.lineJoin = "miter";
    ctx.miterLimit = 10;
    ctx.globalCompositeOperation = "source-over";
    ctx.font = "10px sans-serif";
    if (ctx.setLineDash !== void 0) {
      ctx.setLineDash([]);
      ctx.lineDashOffset = 0;
    }
    const {
      filter: filter2
    } = ctx;
    if (filter2 !== "none" && filter2 !== "") {
      ctx.filter = "none";
    }
  }
  function getImageSmoothingEnabled(transform, interpolate) {
    if (interpolate) {
      return true;
    }
    Util.singularValueDecompose2dScale(transform, XY);
    const actualScale = Math.fround(OutputScale.pixelRatio * PixelsPerInch.PDF_TO_CSS_UNITS);
    return XY[0] <= actualScale && XY[1] <= actualScale;
  }
  function getFilenameFromContentDispositionHeader(contentDisposition) {
    let needsEncodingFixup = true;
    let tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition);
    if (tmp) {
      tmp = tmp[1];
      let filename = rfc2616unquote(tmp);
      filename = unescape(filename);
      filename = rfc5987decode(filename);
      filename = rfc2047decode(filename);
      return fixupEncoding(filename);
    }
    tmp = rfc2231getparam(contentDisposition);
    if (tmp) {
      const filename = rfc2047decode(tmp);
      return fixupEncoding(filename);
    }
    tmp = toParamRegExp("filename", "i").exec(contentDisposition);
    if (tmp) {
      tmp = tmp[1];
      let filename = rfc2616unquote(tmp);
      filename = rfc2047decode(filename);
      return fixupEncoding(filename);
    }
    function toParamRegExp(attributePattern, flags) {
      return new RegExp("(?:^|;)\\s*" + attributePattern + '\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)', flags);
    }
    function textdecode(encoding, value) {
      if (encoding) {
        if (!/^[\x00-\xFF]+$/.test(value)) {
          return value;
        }
        try {
          const decoder = new TextDecoder(encoding, {
            fatal: true
          });
          const buffer = stringToBytes(value);
          value = decoder.decode(buffer);
          needsEncodingFixup = false;
        } catch {
        }
      }
      return value;
    }
    function fixupEncoding(value) {
      if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
        value = textdecode("utf-8", value);
        if (needsEncodingFixup) {
          value = textdecode("iso-8859-1", value);
        }
      }
      return value;
    }
    function rfc2231getparam(contentDispositionStr) {
      const matches = [];
      let match;
      const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
      while ((match = iter.exec(contentDispositionStr)) !== null) {
        let [, n, quot, part] = match;
        n = parseInt(n, 10);
        if (n in matches) {
          if (n === 0) {
            break;
          }
          continue;
        }
        matches[n] = [quot, part];
      }
      const parts = [];
      for (let n = 0; n < matches.length; ++n) {
        if (!(n in matches)) {
          break;
        }
        let [quot, part] = matches[n];
        part = rfc2616unquote(part);
        if (quot) {
          part = unescape(part);
          if (n === 0) {
            part = rfc5987decode(part);
          }
        }
        parts.push(part);
      }
      return parts.join("");
    }
    function rfc2616unquote(value) {
      if (value.startsWith('"')) {
        const parts = value.slice(1).split('\\"');
        for (let i = 0; i < parts.length; ++i) {
          const quotindex = parts[i].indexOf('"');
          if (quotindex !== -1) {
            parts[i] = parts[i].slice(0, quotindex);
            parts.length = i + 1;
          }
          parts[i] = parts[i].replaceAll(/\\(.)/g, "$1");
        }
        value = parts.join('"');
      }
      return value;
    }
    function rfc5987decode(extvalue) {
      const encodingend = extvalue.indexOf("'");
      if (encodingend === -1) {
        return extvalue;
      }
      const encoding = extvalue.slice(0, encodingend);
      const langvalue = extvalue.slice(encodingend + 1);
      const value = langvalue.replace(/^[^']*'/, "");
      return textdecode(encoding, value);
    }
    function rfc2047decode(value) {
      if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) {
        return value;
      }
      return value.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi, function(matches, charset, encoding, text) {
        if (encoding === "q" || encoding === "Q") {
          text = text.replaceAll("_", " ");
          text = text.replaceAll(/=([0-9a-f]{2})/gi, function(match, hex) {
            return String.fromCharCode(parseInt(hex, 16));
          });
          return textdecode(charset, text);
        }
        try {
          text = atob(text);
        } catch {
        }
        return textdecode(charset, text);
      });
    }
    return "";
  }
  function createHeaders(isHttp, httpHeaders) {
    const headers = new Headers();
    if (!isHttp || !httpHeaders || typeof httpHeaders !== "object") {
      return headers;
    }
    for (const key in httpHeaders) {
      const val = httpHeaders[key];
      if (val !== void 0) {
        headers.append(key, val);
      }
    }
    return headers;
  }
  function getResponseOrigin(url) {
    return URL.parse(url)?.origin ?? null;
  }
  function validateRangeRequestCapabilities({
    responseHeaders,
    isHttp,
    rangeChunkSize,
    disableRange
  }) {
    const rv = {
      contentLength: 0,
      isRangeSupported: false
    };
    const length = parseInt(responseHeaders.get("Content-Length"), 10);
    if (!Number.isInteger(length)) {
      return rv;
    }
    rv.contentLength = length;
    if (length <= 2 * rangeChunkSize) {
      return rv;
    }
    if (disableRange || !isHttp) {
      return rv;
    }
    if (responseHeaders.get("Accept-Ranges") !== "bytes") {
      return rv;
    }
    const contentEncoding = responseHeaders.get("Content-Encoding") || "identity";
    if (contentEncoding === "identity") {
      rv.isRangeSupported = true;
    }
    return rv;
  }
  function extractFilenameFromHeader(responseHeaders) {
    const contentDisposition = responseHeaders.get("Content-Disposition");
    if (contentDisposition) {
      let filename = getFilenameFromContentDispositionHeader(contentDisposition);
      if (filename.includes("%")) {
        try {
          filename = decodeURIComponent(filename);
        } catch {
        }
      }
      if (isPdfFile(filename)) {
        return filename;
      }
    }
    return null;
  }
  function createResponseError(status, url) {
    return new ResponseException(`Unexpected server response (${status}) while retrieving PDF "${url.href}".`, status, status === 404 || status === 0 && url.protocol === "file:");
  }
  function ensureResponseOrigin(rangeOrigin, origin) {
    if (rangeOrigin !== origin) {
      throw new Error(`Expected range response-origin "${rangeOrigin}" to match "${origin}".`);
    }
  }
  function fetchUrl(url, headers, withCredentials, abortController) {
    return fetch(url, {
      method: "GET",
      headers,
      signal: abortController.signal,
      mode: "cors",
      credentials: withCredentials ? "include" : "same-origin",
      redirect: "follow"
    });
  }
  function ensureResponseStatus(status, url) {
    if (status !== 200 && status !== 206) {
      throw createResponseError(status, url);
    }
  }
  function getArrayBuffer(val) {
    if (val instanceof Uint8Array) {
      return val.buffer;
    }
    if (val instanceof ArrayBuffer) {
      return val;
    }
    throw new Error(`getArrayBuffer - unexpected data: ${val}`);
  }
  function transport_stream_getArrayBuffer(val) {
    return val instanceof Uint8Array && val.byteLength === val.buffer.byteLength ? val.buffer : new Uint8Array(val).buffer;
  }
  function endRequests() {
    for (const capability of this._requests) {
      capability.resolve({
        value: void 0,
        done: true
      });
    }
    this._requests.length = 0;
  }
  function network_getArrayBuffer(val) {
    return typeof val !== "string" ? val : stringToBytes(val).buffer;
  }
  function getReadableStream(url, opts = null) {
    const fs = process.getBuiltinModule("fs");
    const {
      Readable
    } = process.getBuiltinModule("stream");
    const readStream = fs.createReadStream(url, opts);
    return Readable.toWeb(readStream);
  }
  function getNetworkStream(url) {
    return isValidFetchUrl(url) ? PDFFetchStream : isNodeJS ? PDFNodeStream : PDFNetworkStream;
  }
  function getDocument(src = {}) {
    const task = new PDFDocumentLoadingTask();
    const {
      docId
    } = task;
    const url = src.url ? getUrlProp(src.url) : null;
    const data = src.data ? getDataProp(src.data) : null;
    const httpHeaders = src.httpHeaders || null;
    const withCredentials = src.withCredentials === true;
    const password = src.password ?? null;
    const rangeTransport = src.range instanceof PDFDataRangeTransport ? src.range : null;
    const rangeChunkSize = Number.isInteger(src.rangeChunkSize) && src.rangeChunkSize > 0 ? src.rangeChunkSize : 2 ** 16;
    let worker = src.worker instanceof PDFWorker ? src.worker : null;
    const verbosity2 = src.verbosity;
    const docBaseUrl = typeof src.docBaseUrl === "string" && !isDataScheme(src.docBaseUrl) ? src.docBaseUrl : null;
    const cMapUrl = getFactoryUrlProp(src.cMapUrl);
    const cMapPacked = src.cMapPacked !== false;
    const iccUrl = getFactoryUrlProp(src.iccUrl);
    const standardFontDataUrl = getFactoryUrlProp(src.standardFontDataUrl);
    const wasmUrl = getFactoryUrlProp(src.wasmUrl);
    const ignoreErrors = src.stopAtErrors !== true;
    const maxImageSize = Number.isInteger(src.maxImageSize) && src.maxImageSize > -1 ? src.maxImageSize : -1;
    const isOffscreenCanvasSupported = typeof src.isOffscreenCanvasSupported === "boolean" ? src.isOffscreenCanvasSupported : !isNodeJS;
    const isImageDecoderSupported = typeof src.isImageDecoderSupported === "boolean" ? src.isImageDecoderSupported : !isNodeJS;
    const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes) ? src.canvasMaxAreaInBytes : -1;
    const disableFontFace = typeof src.disableFontFace === "boolean" ? src.disableFontFace : isNodeJS;
    const fontExtraProperties = src.fontExtraProperties === true;
    const enableXfa = src.enableXfa === true;
    const ownerDocument = src.ownerDocument || globalThis.document;
    const disableRange = src.disableRange === true;
    const disableStream = src.disableStream === true;
    const disableAutoFetch = src.disableAutoFetch === true;
    const pdfBug = src.pdfBug === true;
    const CanvasFactory = src.CanvasFactory || (isNodeJS ? NodeCanvasFactory : DOMCanvasFactory);
    const FilterFactory = src.FilterFactory || (isNodeJS ? NodeFilterFactory : DOMFilterFactory);
    const BinaryDataFactory = src.BinaryDataFactory || (isNodeJS ? NodeBinaryDataFactory : DOMBinaryDataFactory);
    const enableHWA = src.enableHWA === true;
    const enableWebGPU = src.enableWebGPU === true;
    const gpuPromise = enableWebGPU ? initGPU() : Promise.resolve(false);
    const useWasm = src.useWasm !== false;
    const pagesMapper = src.pagesMapper || new PagesMapper();
    const useSystemFonts = typeof src.useSystemFonts === "boolean" ? src.useSystemFonts : !isNodeJS && !disableFontFace;
    const useWorkerFetch = typeof src.useWorkerFetch === "boolean" ? src.useWorkerFetch : !!(BinaryDataFactory === DOMBinaryDataFactory && cMapUrl && cMapPacked && standardFontDataUrl && wasmUrl && isValidFetchUrl(cMapUrl, document.baseURI) && isValidFetchUrl(standardFontDataUrl, document.baseURI) && isValidFetchUrl(wasmUrl, document.baseURI));
    const styleElement = null;
    setVerbosityLevel(verbosity2);
    const transportFactory = {
      canvasFactory: new CanvasFactory({
        ownerDocument,
        enableHWA
      }),
      filterFactory: new FilterFactory({
        docId,
        ownerDocument
      }),
      binaryDataFactory: useWorkerFetch ? null : new BinaryDataFactory({
        cMapUrl,
        standardFontDataUrl,
        wasmUrl
      })
    };
    if (!worker) {
      worker = PDFWorker.create({
        verbosity: verbosity2,
        port: GlobalWorkerOptions.workerPort
      });
      task._worker = worker;
    }
    const docParams = {
      docId,
      apiVersion: "6.2.108",
      data,
      password,
      disableAutoFetch,
      rangeChunkSize,
      docBaseUrl,
      enableXfa,
      evaluatorOptions: {
        maxImageSize,
        disableFontFace,
        ignoreErrors,
        isOffscreenCanvasSupported,
        isImageDecoderSupported,
        canvasMaxAreaInBytes,
        fontExtraProperties,
        useSystemFonts,
        useWasm,
        useWorkerFetch,
        cMapUrl,
        cMapPacked,
        iccUrl,
        standardFontDataUrl,
        wasmUrl,
        hasGPU: false
      }
    };
    const transportParams = {
      ownerDocument,
      pdfBug,
      styleElement,
      enableHWA,
      loadingParams: {
        disableAutoFetch,
        enableXfa
      }
    };
    Promise.all([worker.promise, gpuPromise]).then(function([, hasGPU]) {
      if (worker.destroyed) {
        throw new Error("Worker was destroyed");
      }
      docParams.evaluatorOptions.hasGPU = hasGPU;
      const workerIdPromise = worker.messageHandler.sendWithPromise("GetDocRequest", docParams, data ? [data.buffer] : null);
      let networkStream;
      if (data) {
      } else if (rangeTransport) {
        networkStream = new PDFDataTransportStream({
          pdfDataRangeTransport: rangeTransport,
          disableRange,
          disableStream
        });
      } else if (url) {
        const NetworkStream = getNetworkStream(url);
        networkStream = new NetworkStream({
          url,
          httpHeaders,
          withCredentials,
          rangeChunkSize,
          disableRange,
          disableStream
        });
      } else {
        throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");
      }
      return workerIdPromise.then((workerId) => {
        if (worker.destroyed) {
          throw new Error("Worker was destroyed");
        }
        const messageHandler = new MessageHandler(docId, workerId, worker.port);
        const transport = new WorkerTransport(messageHandler, task, networkStream, transportParams, transportFactory, pagesMapper);
        task._transport = transport;
        if (task.destroyed) {
          throw new Error("Loading aborted");
        }
        messageHandler.send("Ready", null);
      });
    }).catch(task._capability.reject).finally(task._setupCapability.resolve);
    return task;
  }
  function makeColorComp(n) {
    return Math.floor(MathClamp(n, 0, 1) * 255).toString(16).padStart(2, "0");
  }
  function scaleAndClamp(x) {
    return MathClamp(x, 0, 1) * 255;
  }
  function compareTextLayers(a, b) {
    if (a === b) {
      return 0;
    }
    return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
  }
  function getTextLayer(node) {
    if (!node) {
      return null;
    }
    if (node.nodeType === Node.ELEMENT_NODE) {
      return node.closest(".textLayer");
    }
    return node.parentElement?.closest(".textLayer") || null;
  }
  function isPointBefore(nodeA, offsetA, nodeB, offsetB) {
    if (nodeA === nodeB) {
      return offsetA <= offsetB;
    }
    const relation = nodeA.compareDocumentPosition(nodeB);
    if (relation & Node.DOCUMENT_POSITION_FOLLOWING) {
      return true;
    }
    if (relation & Node.DOCUMENT_POSITION_PRECEDING) {
      return false;
    }
    return null;
  }
  function normalizeEdgeBoundary(container, offset, textLayer) {
    if (container.nodeType !== Node.ELEMENT_NODE || !container.classList.contains("textLayer") || offset !== container.childNodes.length) {
      return {
        container,
        offset
      };
    }
    let lastNode = container.lastChild;
    if (lastNode?.nodeType === Node.ELEMENT_NODE && lastNode.classList.contains("endOfContent")) {
      lastNode = lastNode.previousSibling;
    }
    if (!lastNode || !textLayer.contains(lastNode)) {
      return null;
    }
    if (lastNode.nodeType === Node.TEXT_NODE) {
      return {
        container: lastNode,
        offset: lastNode.textContent.length
      };
    }
    return {
      container: lastNode,
      offset: lastNode.childNodes.length
    };
  }
  function percentage(value) {
    return `${(value * 100).toFixed(2)}%`;
  }
  var import_meta, isNodeJS, BBOX_INIT, F32_BBOX_INIT, FONT_IDENTITY_MATRIX, SVG_NS, RenderingIntentFlag, AnnotationMode, AnnotationPrefix, AnnotationEditorPrefix, AnnotationEditorType, AnnotationEditorParamsType, PermissionFlag, TextRenderingMode, ImageKind, AnnotationType, AnnotationBorderStyleType, VerbosityLevel, OPS, DrawOPS, PasswordResponses, verbosity, BaseException, PasswordException, UnknownErrorException, InvalidPDFException, ResponseException, FormatError, AbortException, FeatureTest, _Util_static, getExtremumOnCurve_fn, getExtremum_fn, Util, NormalizeRegex, NormalizationMap, makeArr, makeMap, makeObj, makeSet, PageViewport, XfaText, disallowedRichTextStyleRegExp, disallowedEventHandlerAttrRegExp, _XfaLayer_static, createElement_fn, XfaLayer, _PixelsPerInch, PixelsPerInch, RenderingCancelledException, _started, StatTimer, _regex, PDFDateString, OutputScale, SupportedImageMimeTypes, ColorScheme, CSSConstants, contrastCache, _toolbar, _colorPicker, _editor, _buttons, _altText, _comment, _commentButtonDivider, _signatureDescriptionButton, _l10nRemove, _EditorToolbar_static, pointerDown_fn, _EditorToolbar_instances, focusIn_fn, focusOut_fn, addListenersToElement_fn, divider_get, _EditorToolbar, EditorToolbar, _buttons2, _toolbar2, _uiManager, _FloatingToolbar_instances, render_fn, getLastPoint_fn, makeButton_fn, FloatingToolbar, INTERNAL_EVT, internalOpt, _pointerId, _pointerIds, _moveTimestamp, _pointerType, _CurrentPointers, CurrentPointers, _id, IdManager, _baseId, _id2, _cache, _ImageManager_instances, get_fn, _ImageManager, ImageManager, _commands, _locked, _maxSize, _position, CommandManager, _KeyboardManager_static, parseShortcut_fn, codeToKey_fn, _KeyboardManager, KeyboardManager, _ColorManager, ColorManager, _abortController, _activeEditor, _allEditableAnnotations, _allEditors, _allLayers, _savedAllLayers, _altTextManager, _annotationStorage, _changedExistingAnnotations, _commandManager, _commentManager, _copyPasteAC, _currentDrawingSession, _currentPageIndex, _deletedAnnotationsElementIds, _draggingEditors, _editorTypes, _editorsToRescale, _enableHighlightFloatingButton, _enableUpdatedAddImage, _enableNewAltTextWhenAddingImage, _filterFactory, _focusMainContainerTimeoutId, _focusManagerAC, _highlightColors, _highlightWhenShiftUp, _floatingToolbar, _idManager, _isEnabled, _isPointerDown, _isWaiting, _keyboardManagerAC, _lastActiveElement, _mainHighlightColorPicker, _missingCanvases, _mlManager, _mode, _selectedEditors, _selectedTextNode, _signatureManager, _pageColors, _showAllStates, _pdfDocument, _previousStates, _translation, _translationTimeoutId, _container, _viewer, _viewerAlert, _updateModeCapability, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn, getLayerForTextLayer_fn, displayFloatingToolbar_fn, selectionChange_fn, onSelectEnd_fn, addSelectionListener_fn, addFocusManager_fn, removeFocusManager_fn, addKeyboardManager_fn, removeKeyboardManager_fn, addCopyPasteListeners_fn, removeCopyPasteListeners_fn, addDragAndDropListeners_fn, dispatchUpdateStates_fn, dispatchUpdateUI_fn, enableAll_fn, disableAll_fn, addEditorToLayer_fn, lastSelectedEditor_get, isEmpty_fn, selectEditors_fn, _AnnotationEditorUIManager, AnnotationEditorUIManager, _altText2, _altTextDecorative, _altTextButton, _altTextButtonLabel, _altTextTooltip, _altTextTooltipTimeout, _altTextWasFromKeyBoard, _badge, _editor2, _guessedText, _textWithDisclaimer, _useNewAltTextFlow, _l10nNewButton, _AltText_instances, label_get, setState_fn, _AltText, AltText, _commentStandaloneButton, _commentToolbarButton, _commentWasFromKeyBoard, _editor3, _initialText, _richText, _text, _date, _deleted, _popupPosition, _Comment_instances, render_fn2, Comment, _container2, _isPinching, _isPinchingStopped, _isPinchingDisabled, _onPinchStart, _onPinching, _onPinchEnd, _pointerDownAC, _signal, _touchInfo, _touchManagerAC, _touchMoveAC, _TouchManager_instances, onTouchStart_fn, onTouchMove_fn, onTouchEnd_fn, _TouchManager, TouchManager, _accessibilityData, _allResizerDivs, _altText3, _comment2, _commentStandaloneButton2, _disabled, _dragPointerId, _dragPointerType, _resizersDiv, _lastPointerCoords, _savedDimensions, _fakeAnnotation, _focusAC, _focusedResizerName, _hasBeenClicked, _initialRect, _isEditing, _isInEditMode, _isResizerEnabledForKeyboard, _moveInDOMTimeout, _prevDragX, _prevDragY, _telemetryTimeouts, _touchManager, _isDraggable, _zIndex, _AnnotationEditor_instances, translate_fn, _AnnotationEditor_static, rotatePoint_fn, getRotationMatrix_fn, createResizers_fn, resizerPointerdown_fn, resize_fn, addResizeToUndoStack_fn, resizerPointermove_fn, touchPinchStartCallback_fn, touchPinchCallback_fn, touchPinchEndCallback_fn, selectOnPointerEvent_fn, setUpDragSession_fn, addFocusListeners_fn, resizerKeydown_fn, resizerBlur_fn, resizerFocus_fn, setResizerTabIndex_fn, stopResizing_fn, _AnnotationEditor, AnnotationEditor, FakeEditor, SEED, MASK_HIGH, MASK_LOW, MurmurHash3_64, SerializableEmpty, _modified, _modifiedIds, _editorsMap, _storage, _AnnotationStorage_instances, setModified_fn, AnnotationStorage, _serializable, PrintAnnotationStorage, FORCED_DEPENDENCY_LABEL, floor, ceil, EMPTY_BBOX, _bboxes, _coords, BBoxReader, ensureDebugMetadata, _baseTransformStack, _clipBox, _pendingBBox, _canvasWidth, _canvasHeight, _bboxesCoords, _bboxes2, _CanvasBBoxTracker_instances, initializeBBoxes_fn, CanvasBBoxTracker, _simple, _incremental, _namedDependencies, _pendingDependencies, _fontBBoxTrustworthy, _debugMetadata, _recordDebugMetadataDepenencyAfterRestore, _bboxTracker, CanvasDependencyTracker, _dependencyTracker, _opIdx, _ignoreBBoxes, _nestingLevel, _savesLevel, _CanvasNestedDependencyTracker, CanvasNestedDependencyTracker, Dependencies, _canvasWidth2, _canvasHeight2, _capacity, _count, _coords2, _CoordsArray, _CanvasImagesTracker, CanvasImagesTracker, _systemFonts, _styleSheet, _FontLoader_instances, getStyleSheet_fn, FontLoader, _fontData, FontFaceObject, CSS_FONT_INFO, SYSTEM_FONT_INFO, _FONT_INFO, FONT_INFO, PATTERN_INFO, _buffer, _decoder, _view, _CssFontInfo_instances, readString_fn, CssFontInfo, _buffer2, _decoder2, _view2, _SystemFontInfo_instances, readString_fn2, SystemFontInfo, _buffer3, _decoder3, _view3, _FontInfo_instances, readBoolean_fn, readNumber_fn, readArray_fn, readString_fn3, getDataOffsets_fn, FontInfo, PatternInfo, _buffer4, FontPathInfo, isRefProxy, isNameProxy, isValidExplicitDest, _listeners, _deferred, LoopbackPort, CallbackKind, StreamKind, _messageAC, _MessageHandler_instances, onMessage_fn, createStreamSink_fn, processStreamMessage_fn, deleteStreamController_fn, MessageHandler, _errorStr, BaseBinaryDataFactory, DOMBinaryDataFactory, _enableHWA, BaseCanvasFactory, DOMCanvasFactory, BaseFilterFactory, _baseUrl, __cache, __defs, _docId, _document, __hcmCache, _id3, _DOMFilterFactory_instances, cache_get, hcmCache_get, defs_get, createTables_fn, createUrl_fn, addLuminosityConversion_fn, addGrayConversion_fn, createFilter_fn, appendFeFunc_fn, addTransferMapConversion_fn, addTransferMapAlphaConversion_fn, getRGB_fn, getRGBA_fn, resetDefsColor_fn, getOpaqueTextColor_fn, DOMFilterFactory, NodeFilterFactory, NodeCanvasFactory, NodeBinaryDataFactory, MESH_WGSL, _initPromise, _device, _meshPipeline, _preferredFormat, _WebGPU_instances, initGPU_fn, WebGPU, _webGPU, PathType, BaseShadingPattern, RadialAxialShadingPattern, MeshShadingPattern, DummyShadingPattern, PaintType, _TilingPattern, TilingPattern, MIN_FONT_SIZE, MAX_FONT_SIZE, EXECUTION_TIME, EXECUTION_STEPS, FULL_CHUNK_HEIGHT, SCALE_MATRIX, XY, CanvasExtraState, LINE_CAP_STYLES, LINE_JOIN_STYLES, NORMAL_CLIP, EO_CLIP, _knockoutGroupLevel, _knockoutElementDepth, _knockoutTempCanvasEntry, _knockoutSavedCtx, _knockoutSavedSMaskCtx, _knockoutSavedGCO, _knockoutElementAlpha, _knockoutFilterCache, _knockoutElementGroupMeta, _groupStackMeta, _CanvasGraphics_instances, restoreInitialState_fn, drawFilter_fn, createKnockoutMaskCanvas_fn, getOrCreatePooledEntry_fn, compositeKnockoutSurface_fn, beginKnockoutElement_fn, endKnockoutElement_fn, getScaledPath_fn, convertGroupToGray_fn, destroyKnockoutPools_fn, _CanvasGraphics, CanvasGraphics, _PDFStreamReader, _PDFStreamRangeReader, BasePDFStream, BasePDFStreamReader, BasePDFStreamRangeReader, PDFFetchStream, PDFFetchStreamReader, PDFFetchStreamRangeReader, _PDFDataTransportStream_instances, onReceiveData_fn, PDFDataTransportStream, _endRequests, PDFDataTransportStreamReader, _endRequests2, PDFDataTransportStreamRangeReader, OK_RESPONSE, PARTIAL_CONTENT_RESPONSE, _pendingRequests, _PDFNetworkStream_instances, onProgress_fn, onStateChange_fn, PDFNetworkStream, _endRequests3, _PDFNetworkStreamReader_instances, onHeadersReceived_fn, onDone_fn, onError_fn, onProgress_fn2, PDFNetworkStreamReader, _endRequests4, _PDFNetworkStreamRangeReader_instances, onHeadersReceived_fn2, onDone_fn2, onError_fn2, PDFNetworkStreamRangeReader, PDFNodeStream, PDFNodeStreamReader, PDFNodeStreamRangeReader, _port, _src, GlobalWorkerOptions, _map, _data, Metadata, INTERNAL, _isDisplay, _isPrint, _userSet, _visible, OptionalContentGroup, _cachedGetHash, _groups, _initialHash, _order, _rawData, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn, _OptionalContentConfig, OptionalContentConfig, _pageNumberToId, _prevPageNumbers, _pagesNumber, _clipboard, _savedData, _PagesMapper_instances, ensureInit_fn, buildIdToPageNumber_fn, updatePrevPageNumbers_fn, PagesMapper, INITIAL_DATA, dataObj, _objs, PDFObjects, MAX_TEXT_DIVS_TO_RENDER, DEFAULT_FONT_SIZE, _capability, _container3, _disableProcessItems, _fontInspectorEnabled, _imagesHandler, _lang, _layoutTextParams, _pageHeight, _pageWidth, _reader, _rootContainer, _rotation, _scale, _styleCache, _textContentItemsStr, _textContentSource, _textDivs, _textDivProperties, _transform, _ascentCache, _canvasContexts, _canvasCtxFonts, _minFontSize, _pendingTextLayers, _TextLayer_instances, processItems_fn, appendText_fn, layout_fn, _TextLayer_static, getCtx_fn, ensureCtxFont_fn, ensureMinFontSizeComputed_fn, getAscent_fn, _TextLayer, TextLayer, RENDERING_CANCELLED_TIMEOUT, _docId2, _PDFDocumentLoadingTask, PDFDocumentLoadingTask, _capability2, _listener, PDFDataRangeTransport, PDFDocumentProxy, _pendingCleanup, _pagesMapper, _PDFPageProxy_instances, tryCleanup_fn, _PDFPageProxy, PDFPageProxy, _capability3, _messageHandler, _port2, _webWorker, _fakeWorkerId, _isWorkerDisabled, _workerPorts, _PDFWorker_instances, resolve_fn, initializeFromPort_fn, initialize_fn, setupFakeWorker_fn, _PDFWorker_static, mainThreadWorkerMessageHandler_get, _PDFWorker, PDFWorker, _fullReader, _methodPromises, _networkStream, _pageCache, _pagePromises, _pageRefCache, _passwordCapability, _WorkerTransport_instances, cacheSimpleMethod_fn, onProgress_fn3, WorkerTransport, RenderTask, _rAF, _canvasInUse, _InternalRenderTask, InternalRenderTask, version2, build, _button, _buttonSwatch, _defaultColor, _dropdown, _dropdownWasFromKeyboard, _isMainColorPicker, _editor4, _eventBus, _openDropdownAC, _uiManager2, _l10nColor, _ColorPicker_instances, getDropdownRoot_fn, colorSelect_fn, keyDown_fn, openDropdown_fn, pointerDown_fn2, isDropdownVisible_get, _ColorPicker, ColorPicker, _input, _hasAlpha, _editor5, _uiManager3, _l10nColor2, _BasicColorPicker, BasicColorPicker, ColorConverters, BaseSVGFactory, DOMSVGFactory, annotation_layer_DEFAULT_FONT_SIZE, GetElementsByNameSet, TIMEZONE_OFFSET, AnnotationElementFactory, _updates, _hasBorder, _popupElement, _AnnotationElement_instances, setRectEdited_fn, _AnnotationElement, AnnotationElement, EditorAnnotationElement, _LinkAnnotationElement_instances, setInternalLink_fn, bindAttachment_fn, bindSetOCGState_fn, LinkAnnotationElement, TextAnnotationElement, WidgetAnnotationElement, TextWidgetAnnotationElement, SignatureWidgetAnnotationElement, CheckboxWidgetAnnotationElement, RadioButtonWidgetAnnotationElement, PushButtonWidgetAnnotationElement, ChoiceWidgetAnnotationElement, _PopupAnnotationElement_instances, createPopup_fn, PopupAnnotationElement, _commentManager2, _boundKeyDown, _boundHide, _boundShow, _boundToggle, _color, _container4, _contentsObj, _dateObj, _elements, _parent, _parentRect, _pinned, _popup, _popupAbortController, _position2, _commentButton, _commentButtonPosition, _popupPosition2, _rect, _richText2, _titleObj, _updates2, _wasVisible, _firstElement, _commentText, _PopupElement_instances, addEventListeners_fn, setCommentButtonPosition_fn, updateCommentButtonPosition_fn, updateColor_fn, html_get, fontSize_get, fontColor_get, makePopupContent_fn, keyDown_fn2, setPosition_fn, toggle_fn, show_fn, hide_fn, PopupElement, FreeTextAnnotationElement, _line, LineAnnotationElement, _square, SquareAnnotationElement, _circle, CircleAnnotationElement, _polyline, PolylineAnnotationElement, PolygonAnnotationElement, CaretAnnotationElement, _polylinesGroupElement, _polylines, _InkAnnotationElement_instances, getTransform_fn, InkAnnotationElement, HighlightAnnotationElement, UnderlineAnnotationElement, SquigglyAnnotationElement, StrikeOutAnnotationElement, StampAnnotationElement, _trigger, _FileAttachmentAnnotationElement_instances, download_fn, FileAttachmentAnnotationElement, _abortController2, _contentUrl, _media, _MediaAnnotationElement_instances, load_fn, revokeContentUrl_fn, MediaAnnotationElement, _accessibilityManager, _annotationCanvasMap, _annotationStorage2, _editableAnnotations, _structTreeLayer, _linkService, _elements2, _hasAriaAttributesFromStructTree, _AnnotationLayer_instances, addElementsToDOM_fn, setAnnotationCanvasMap_fn, _AnnotationLayer, AnnotationLayer, EOL_PATTERN, _content, _editorDivId, _editModeAC, _fontSize, _FreeTextEditor_instances, updateFontSize_fn, updateColor_fn2, extractText_fn, setEditorDimensions_fn, _FreeTextEditor_static, getNodeContent_fn, setContent_fn, serializeContent_fn, deserializeContent_fn, hasElementChanged_fn, _FreeTextEditor, FreeTextEditor, Outline, _box, _bottom, _innerMargin, _isLTR, _top, _last, _lastX, _lastY, _min, _min_dist, _scaleFactor, _thickness, _points, _MIN_DIST, _MIN_DIFF, _MIN, _FreeDrawOutliner_instances, getLastCoords_fn, toSVGPathTwoPoints_fn, toSVGPathStart_fn, toSVGPathEnd_fn, getOutlineTwoPoints_fn, getOutlineStart_fn, getOutlineEnd_fn, _FreeDrawOutliner, FreeDrawOutliner, _box2, _bbox, _innerMargin2, _isLTR2, _points2, _scaleFactor2, _outline, _FreeDrawOutline_instances, computeMinMax_fn, FreeDrawOutline, _box3, _firstPoint, _lastPoint, _verticalEdges, _intervals, _HighlightOutliner_instances, getOutlines_fn, binarySearch_fn, insert_fn, remove_fn, breakEdge_fn, HighlightOutliner, _box4, _outlines, HighlightOutline, FreeHighlightOutliner, FreeHighlightOutline, _anchorNode, _anchorOffset, _boxes, _clipPathId, _colorPicker2, _focusOutlines, _focusNode, _focusOffset, _highlightDiv, _highlightOutlines, _id4, _isFreeHighlight, _firstPoint2, _lastPoint2, _outlineId, _text2, _thickness2, _methodOfCreation, _HighlightEditor_instances, createOutlines_fn, createFreeOutlines_fn, updateColor_fn3, updateThickness_fn, changeThickness_fn, cleanDrawLayer_fn, addToDrawLayer_fn, _HighlightEditor_static, rotateBbox_fn, keydown_fn, setCaret_fn, getRotation_fn, serializeBoxes_fn, serializeOutlines_fn, highlightMove_fn, endHighlight_fn, hasElementChanged_fn2, _HighlightEditor, HighlightEditor, _svgProperties, DrawingOptions, _drawOutlines, _mustBeCommitted, _currentDraw, _currentDrawingAC, _currentDrawingOptions, _DrawingEditor_instances, createDrawOutlines_fn, createDrawing_fn, cleanDrawLayer_fn2, addToDrawLayer_fn2, convertToParentSpace_fn, convertToDrawSpace_fn, updateBbox_fn, rotateBox_fn, _DrawingEditor, DrawingEditor, _last2, _line2, _lines, _rotation2, _thickness3, _points3, _lastSVGPath, _lastIndex, _outlines2, _parentWidth, _parentHeight, _InkDrawOutliner_instances, normalizePoint_fn, InkDrawOutliner, _bbox2, _currentRotation, _innerMargin3, _lines2, _parentWidth2, _parentHeight2, _parentScale, _rotation3, _thickness4, _InkDrawOutline_instances, getMarginComponents_fn, getBBoxWithNoMargin_fn, computeBbox_fn, updateThickness_fn2, InkDrawOutline, InkDrawingOptions, _InkEditor_instances, hasElementChanged_fn3, _InkEditor, InkEditor, ContourDrawOutline, BASE_HEADER_LENGTH, POINTS_PROPERTIES_NUMBER, _PARAMETERS, _SignatureExtractor_static, neighborIndexToId_fn, _neighborIdToIndex, clockwiseNonZero_fn, counterClockwiseNonZero_fn, findContours_fn, douglasPeuckerHelper_fn, douglasPeucker_fn, bilateralFilter_fn, getHistogram_fn, toUint8_fn, guessThreshold_fn, getGrayPixels_fn, SignatureExtractor, SignatureOptions, DrawnSignatureOptions, _isExtracted, _description, _signatureData, _signatureUUID, _SignatureEditor, SignatureEditor, _bitmap, _bitmapId, _bitmapPromise, _bitmapUrl, _bitmapFile, _bitmapFileName, _canvas, _missingCanvas, _resizeTimeoutId, _isSvg, _hasBeenAddedInUndoStack, _StampEditor_instances, getBitmapFetched_fn, getBitmapDone_fn, getBitmap_fn, createCanvas_fn, scaleBitmap_fn, drawBitmap_fn, serializeBitmap_fn, hasElementChanged_fn4, StampEditor, _accessibilityManager2, _allowClick, _annotationLayer, _clickAC, _editorFocusTimeoutId, _editors, _hadPointerDown, _isDisabling, _isEnabling, _drawingAC, _focusedElement, _textLayer, _textSelectionAC, _textLayerDblClickAC, _lastPointerDownTimestamp, _uiManager4, _editorTypes2, _AnnotationEditorLayer_instances, allEditorsIterator_get, textLayerPointerDown_fn, currentEditorType_get, createNewEditor_fn, getCenterPoint_fn, cleanup_fn, _AnnotationEditorLayer, AnnotationEditorLayer, _parent2, _mapping, _textLayer2, _filterFactory2, _pageColors2, _textLayerObserver, _toUpdate, _id5, _selectionId, _selectionChangeAC, _selections, _isSelecting, _textLayerSet, _textLayers, _DrawLayer_static, cleanupTextLayerSelection_fn, hasSelection_fn, getOrderedTextLayers_fn, selectionChange_fn2, setBox_fn, _DrawLayer_instances, createSVG_fn, createClipPath_fn, updateProperties_fn, _DrawLayer, DrawLayer, _coordinates, _coordinatesByElement, _getPageCanvas, _minSize, _pageWidth2, _pageHeight2, _activeImage, _TextLayerImages_instances, createImagePlaceholder_fn, _TextLayerImages, TextLayerImages;
  var init_pdf = __esm({
    "node_modules/pdfjs-dist/build/pdf.mjs"() {
      import_meta = {};
      isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
      BBOX_INIT = [Infinity, Infinity, -Infinity, -Infinity];
      F32_BBOX_INIT = new Float32Array(BBOX_INIT);
      FONT_IDENTITY_MATRIX = [1e-3, 0, 0, 1e-3, 0, 0];
      SVG_NS = "http://www.w3.org/2000/svg";
      RenderingIntentFlag = {
        ANY: 1,
        DISPLAY: 2,
        PRINT: 4,
        SAVE: 8,
        ANNOTATIONS_FORMS: 16,
        ANNOTATIONS_STORAGE: 32,
        ANNOTATIONS_DISABLE: 64,
        IS_EDITING: 128,
        OPLIST: 256
      };
      AnnotationMode = {
        DISABLE: 0,
        ENABLE: 1,
        ENABLE_FORMS: 2,
        ENABLE_STORAGE: 3
      };
      AnnotationPrefix = "pdfjs_internal_id_";
      AnnotationEditorPrefix = "pdfjs_internal_editor_";
      AnnotationEditorType = {
        DISABLE: -1,
        NONE: 0,
        FREETEXT: 3,
        HIGHLIGHT: 9,
        STAMP: 13,
        INK: 15,
        POPUP: 16,
        SIGNATURE: 101,
        COMMENT: 102
      };
      AnnotationEditorParamsType = {
        RESIZE: 1,
        CREATE: 2,
        FREETEXT_SIZE: 11,
        FREETEXT_COLOR: 12,
        FREETEXT_OPACITY: 13,
        INK_COLOR: 21,
        INK_THICKNESS: 22,
        INK_OPACITY: 23,
        INK_COLOR_AND_OPACITY: 24,
        HIGHLIGHT_COLOR: 31,
        HIGHLIGHT_THICKNESS: 32,
        HIGHLIGHT_FREE: 33,
        HIGHLIGHT_SHOW_ALL: 34,
        DRAW_STEP: 41
      };
      PermissionFlag = {
        PRINT: 4,
        MODIFY_CONTENTS: 8,
        COPY: 16,
        MODIFY_ANNOTATIONS: 32,
        FILL_INTERACTIVE_FORMS: 256,
        COPY_FOR_ACCESSIBILITY: 512,
        ASSEMBLE: 1024,
        PRINT_HIGH_QUALITY: 2048
      };
      TextRenderingMode = {
        FILL: 0,
        STROKE: 1,
        FILL_STROKE: 2,
        INVISIBLE: 3,
        FILL_ADD_TO_PATH: 4,
        STROKE_ADD_TO_PATH: 5,
        FILL_STROKE_ADD_TO_PATH: 6,
        ADD_TO_PATH: 7,
        FILL_STROKE_MASK: 3,
        ADD_TO_PATH_FLAG: 4
      };
      ImageKind = {
        GRAYSCALE_1BPP: 1,
        RGB_24BPP: 2,
        RGBA_32BPP: 3
      };
      AnnotationType = {
        TEXT: 1,
        LINK: 2,
        FREETEXT: 3,
        LINE: 4,
        SQUARE: 5,
        CIRCLE: 6,
        POLYGON: 7,
        POLYLINE: 8,
        HIGHLIGHT: 9,
        UNDERLINE: 10,
        SQUIGGLY: 11,
        STRIKEOUT: 12,
        STAMP: 13,
        CARET: 14,
        INK: 15,
        POPUP: 16,
        FILEATTACHMENT: 17,
        SOUND: 18,
        MOVIE: 19,
        WIDGET: 20,
        SCREEN: 21,
        PRINTERMARK: 22,
        TRAPNET: 23,
        WATERMARK: 24,
        THREED: 25,
        REDACT: 26,
        RICHMEDIA: 27
      };
      AnnotationBorderStyleType = {
        SOLID: 1,
        DASHED: 2,
        BEVELED: 3,
        INSET: 4,
        UNDERLINE: 5
      };
      VerbosityLevel = {
        ERRORS: 0,
        WARNINGS: 1,
        INFOS: 5
      };
      OPS = {
        dependency: 1,
        setLineWidth: 2,
        setLineCap: 3,
        setLineJoin: 4,
        setMiterLimit: 5,
        setDash: 6,
        setRenderingIntent: 7,
        setFlatness: 8,
        setGState: 9,
        save: 10,
        restore: 11,
        transform: 12,
        moveTo: 13,
        lineTo: 14,
        curveTo: 15,
        curveTo2: 16,
        curveTo3: 17,
        closePath: 18,
        rectangle: 19,
        stroke: 20,
        closeStroke: 21,
        fill: 22,
        eoFill: 23,
        fillStroke: 24,
        eoFillStroke: 25,
        closeFillStroke: 26,
        closeEOFillStroke: 27,
        endPath: 28,
        clip: 29,
        eoClip: 30,
        beginText: 31,
        endText: 32,
        setCharSpacing: 33,
        setWordSpacing: 34,
        setHScale: 35,
        setLeading: 36,
        setFont: 37,
        setTextRenderingMode: 38,
        setTextRise: 39,
        moveText: 40,
        setLeadingMoveText: 41,
        setTextMatrix: 42,
        nextLine: 43,
        showText: 44,
        showSpacedText: 45,
        nextLineShowText: 46,
        nextLineSetSpacingShowText: 47,
        setCharWidth: 48,
        setCharWidthAndBounds: 49,
        setStrokeColorSpace: 50,
        setFillColorSpace: 51,
        setStrokeColor: 52,
        setStrokeColorN: 53,
        setFillColor: 54,
        setFillColorN: 55,
        setStrokeGray: 56,
        setFillGray: 57,
        setStrokeRGBColor: 58,
        setFillRGBColor: 59,
        setStrokeCMYKColor: 60,
        setFillCMYKColor: 61,
        shadingFill: 62,
        beginInlineImage: 63,
        beginImageData: 64,
        endInlineImage: 65,
        paintXObject: 66,
        markPoint: 67,
        markPointProps: 68,
        beginMarkedContent: 69,
        beginMarkedContentProps: 70,
        endMarkedContent: 71,
        beginCompat: 72,
        endCompat: 73,
        paintFormXObjectBegin: 74,
        paintFormXObjectEnd: 75,
        beginGroup: 76,
        endGroup: 77,
        beginAnnotation: 80,
        endAnnotation: 81,
        paintImageMaskXObject: 83,
        paintImageMaskXObjectGroup: 84,
        paintImageXObject: 85,
        paintInlineImageXObject: 86,
        paintInlineImageXObjectGroup: 87,
        paintImageXObjectRepeat: 88,
        paintImageMaskXObjectRepeat: 89,
        paintSolidColorImageMask: 90,
        constructPath: 91,
        setStrokeTransparent: 92,
        setFillTransparent: 93,
        rawFillPath: 94
      };
      DrawOPS = {
        moveTo: 0,
        lineTo: 1,
        curveTo: 2,
        quadraticCurveTo: 3,
        closePath: 4
      };
      PasswordResponses = {
        NEED_PASSWORD: 1,
        INCORRECT_PASSWORD: 2
      };
      verbosity = VerbosityLevel.WARNINGS;
      BaseException = (function BaseExceptionClosure() {
        function BaseException2(message, name) {
          this.message = message;
          this.name = name;
        }
        BaseException2.prototype = new Error();
        BaseException2.constructor = BaseException2;
        return BaseException2;
      })();
      PasswordException = class extends BaseException {
        constructor(msg, code) {
          super(msg, "PasswordException");
          this.code = code;
        }
      };
      UnknownErrorException = class extends BaseException {
        constructor(msg, details) {
          super(msg, "UnknownErrorException");
          this.details = details;
        }
      };
      InvalidPDFException = class extends BaseException {
        constructor(msg) {
          super(msg, "InvalidPDFException");
        }
      };
      ResponseException = class extends BaseException {
        constructor(msg, status, missing) {
          super(msg, "ResponseException");
          this.status = status;
          this.missing = missing;
        }
      };
      FormatError = class extends BaseException {
        constructor(msg) {
          super(msg, "FormatError");
        }
      };
      AbortException = class extends BaseException {
        constructor(msg) {
          super(msg, "AbortException");
        }
      };
      FeatureTest = class {
        static get isLittleEndian() {
          const buffer8 = new Uint8Array(4);
          buffer8[0] = 1;
          const view32 = new Uint32Array(buffer8.buffer, 0, 1);
          return shadow(this, "isLittleEndian", view32[0] === 1);
        }
        static get isOffscreenCanvasSupported() {
          return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
        }
        static get isImageDecoderSupported() {
          return shadow(this, "isImageDecoderSupported", typeof ImageDecoder !== "undefined");
        }
        static get isFloat16ArraySupported() {
          return shadow(this, "isFloat16ArraySupported", typeof Float16Array !== "undefined");
        }
        static get isSanitizerSupported() {
          return shadow(this, "isSanitizerSupported", typeof Sanitizer !== "undefined");
        }
        static get platform() {
          const {
            platform,
            userAgent
          } = navigator;
          return shadow(this, "platform", {
            isAndroid: userAgent.includes("Android"),
            isLinux: platform.includes("Linux"),
            isMac: platform.includes("Mac"),
            isWindows: platform.includes("Win"),
            isFirefox: userAgent.includes("Firefox")
          });
        }
        static get isCanvasFilterSupported() {
          let ctx;
          if (this.isOffscreenCanvasSupported) {
            ctx = new OffscreenCanvas(1, 1).getContext("2d");
          } else if (typeof document !== "undefined") {
            ctx = document.createElement("canvas").getContext("2d");
          }
          return shadow(this, "isCanvasFilterSupported", ctx?.filter !== void 0);
        }
        static get isAlphaColorInputSupported() {
          if (typeof document === "undefined") {
            return shadow(this, "isAlphaColorInputSupported", false);
          }
          const input = document.createElement("input");
          input.type = "color";
          input.setAttribute("alpha", "");
          input.value = "#ff000080";
          return shadow(this, "isAlphaColorInputSupported", input.value !== "#ff0000");
        }
        static get isBackdropFilterSupported() {
          return shadow(this, "isBackdropFilterSupported", typeof CSS !== "undefined" && CSS.supports("backdrop-filter", "blur(1px)"));
        }
      };
      Util = class {
        static get hexNums() {
          return shadow(this, "hexNums", Array.from(Array(256).keys(), (n) => n.toString(16).padStart(2, "0")));
        }
        static makeHexColor(r, g, b) {
          return `#${this.hexNums[r]}${this.hexNums[g]}${this.hexNums[b]}`;
        }
        static transform(m1, m2) {
          return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
        }
        static multiplyByDOMMatrix(m, md) {
          return [m[0] * md.a + m[2] * md.b, m[1] * md.a + m[3] * md.b, m[0] * md.c + m[2] * md.d, m[1] * md.c + m[3] * md.d, m[0] * md.e + m[2] * md.f + m[4], m[1] * md.e + m[3] * md.f + m[5]];
        }
        static applyTransform(p, m, pos = 0) {
          const p0 = p[pos];
          const p1 = p[pos + 1];
          p[pos] = p0 * m[0] + p1 * m[2] + m[4];
          p[pos + 1] = p0 * m[1] + p1 * m[3] + m[5];
        }
        static applyTransformToBezier(p, transform, pos = 0) {
          const m0 = transform[0];
          const m1 = transform[1];
          const m2 = transform[2];
          const m3 = transform[3];
          const m4 = transform[4];
          const m5 = transform[5];
          for (let i = 0; i < 6; i += 2) {
            const pI = p[pos + i];
            const pI1 = p[pos + i + 1];
            p[pos + i] = pI * m0 + pI1 * m2 + m4;
            p[pos + i + 1] = pI * m1 + pI1 * m3 + m5;
          }
        }
        static applyInverseTransform(p, m) {
          const p0 = p[0];
          const p1 = p[1];
          const d = m[0] * m[3] - m[1] * m[2];
          p[0] = (p0 * m[3] - p1 * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
          p[1] = (-p0 * m[1] + p1 * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
        }
        static axialAlignedBoundingBox(rect, transform, output) {
          const m0 = transform[0];
          const m1 = transform[1];
          const m2 = transform[2];
          const m3 = transform[3];
          const m4 = transform[4];
          const m5 = transform[5];
          const r0 = rect[0];
          const r1 = rect[1];
          const r2 = rect[2];
          const r3 = rect[3];
          let a0 = m0 * r0 + m4;
          let a2 = a0;
          let a1 = m0 * r2 + m4;
          let a3 = a1;
          let b0 = m3 * r1 + m5;
          let b2 = b0;
          let b1 = m3 * r3 + m5;
          let b3 = b1;
          if (m1 !== 0 || m2 !== 0) {
            const m1r0 = m1 * r0;
            const m1r2 = m1 * r2;
            const m2r1 = m2 * r1;
            const m2r3 = m2 * r3;
            a0 += m2r1;
            a3 += m2r1;
            a1 += m2r3;
            a2 += m2r3;
            b0 += m1r0;
            b3 += m1r0;
            b1 += m1r2;
            b2 += m1r2;
          }
          output[0] = Math.min(output[0], a0, a1, a2, a3);
          output[1] = Math.min(output[1], b0, b1, b2, b3);
          output[2] = Math.max(output[2], a0, a1, a2, a3);
          output[3] = Math.max(output[3], b0, b1, b2, b3);
        }
        static inverseTransform(m) {
          const d = m[0] * m[3] - m[1] * m[2];
          return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
        }
        static singularValueDecompose2dScale(matrix, output) {
          const m0 = matrix[0];
          const m1 = matrix[1];
          const m2 = matrix[2];
          const m3 = matrix[3];
          const a = m0 ** 2 + m1 ** 2;
          const b = m0 * m2 + m1 * m3;
          const c = m2 ** 2 + m3 ** 2;
          const first2 = (a + c) / 2;
          const second = Math.sqrt(first2 ** 2 - (a * c - b ** 2));
          output[0] = Math.sqrt(first2 + second || 1);
          output[1] = Math.sqrt(first2 - second || 1);
        }
        static normalizeRect(rect) {
          const r = rect.slice(0);
          if (rect[0] > rect[2]) {
            r[0] = rect[2];
            r[2] = rect[0];
          }
          if (rect[1] > rect[3]) {
            r[1] = rect[3];
            r[3] = rect[1];
          }
          return r;
        }
        static intersect(rect1, rect2) {
          const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
          const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
          if (xLow > xHigh) {
            return null;
          }
          const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
          const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
          if (yLow > yHigh) {
            return null;
          }
          return [xLow, yLow, xHigh, yHigh];
        }
        static pointBoundingBox(x, y, minMax) {
          minMax[0] = Math.min(minMax[0], x);
          minMax[1] = Math.min(minMax[1], y);
          minMax[2] = Math.max(minMax[2], x);
          minMax[3] = Math.max(minMax[3], y);
        }
        static rectBoundingBox(x0, y0, x1, y1, minMax) {
          minMax[0] = Math.min(minMax[0], x0, x1);
          minMax[1] = Math.min(minMax[1], y0, y1);
          minMax[2] = Math.max(minMax[2], x0, x1);
          minMax[3] = Math.max(minMax[3], y0, y1);
        }
        static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
          minMax[0] = Math.min(minMax[0], x0, x3);
          minMax[1] = Math.min(minMax[1], y0, y3);
          minMax[2] = Math.max(minMax[2], x0, x3);
          minMax[3] = Math.max(minMax[3], y0, y3);
          __privateMethod(this, _Util_static, getExtremum_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
          __privateMethod(this, _Util_static, getExtremum_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
        }
      };
      _Util_static = new WeakSet();
      getExtremumOnCurve_fn = function(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {
        if (t <= 0 || t >= 1) {
          return;
        }
        const mt = 1 - t;
        const tt = t * t;
        const ttt = tt * t;
        const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;
        const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;
        minMax[0] = Math.min(minMax[0], x);
        minMax[1] = Math.min(minMax[1], y);
        minMax[2] = Math.max(minMax[2], x);
        minMax[3] = Math.max(minMax[3], y);
      };
      getExtremum_fn = function(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {
        if (Math.abs(a) < 1e-12) {
          if (Math.abs(b) >= 1e-12) {
            __privateMethod(this, _Util_static, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax);
          }
          return;
        }
        const delta = b ** 2 - 4 * c * a;
        if (delta < 0) {
          return;
        }
        const sqrtDelta = Math.sqrt(delta);
        const a2 = 2 * a;
        __privateMethod(this, _Util_static, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax);
        __privateMethod(this, _Util_static, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax);
      };
      __privateAdd(Util, _Util_static);
      NormalizeRegex = null;
      NormalizationMap = null;
      makeArr = () => [];
      makeMap = () => /* @__PURE__ */ new Map();
      makeObj = () => /* @__PURE__ */ Object.create(null);
      makeSet = () => /* @__PURE__ */ new Set();
      if (typeof Iterator.prototype.join !== "function") {
        Iterator.prototype.join = function(separator) {
          return [...this].join(separator);
        };
      }
      PageViewport = class _PageViewport {
        constructor({
          viewBox,
          userUnit,
          scale,
          rotation,
          offsetX = 0,
          offsetY = 0,
          dontFlip = false
        }) {
          this.viewBox = viewBox;
          this.userUnit = userUnit;
          this.scale = scale;
          this.rotation = rotation;
          this.offsetX = offsetX;
          this.offsetY = offsetY;
          scale *= userUnit;
          const centerX = (viewBox[2] + viewBox[0]) / 2;
          const centerY = (viewBox[3] + viewBox[1]) / 2;
          let rotateA, rotateB, rotateC, rotateD;
          rotation %= 360;
          if (rotation < 0) {
            rotation += 360;
          }
          switch (rotation) {
            case 180:
              rotateA = -1;
              rotateB = 0;
              rotateC = 0;
              rotateD = 1;
              break;
            case 90:
              rotateA = 0;
              rotateB = 1;
              rotateC = 1;
              rotateD = 0;
              break;
            case 270:
              rotateA = 0;
              rotateB = -1;
              rotateC = -1;
              rotateD = 0;
              break;
            case 0:
              rotateA = 1;
              rotateB = 0;
              rotateC = 0;
              rotateD = -1;
              break;
            default:
              throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
          }
          if (dontFlip) {
            rotateC = -rotateC;
            rotateD = -rotateD;
          }
          let offsetCanvasX, offsetCanvasY;
          let width, height;
          if (rotateA === 0) {
            offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
            offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
            width = (viewBox[3] - viewBox[1]) * scale;
            height = (viewBox[2] - viewBox[0]) * scale;
          } else {
            offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
            offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
            width = (viewBox[2] - viewBox[0]) * scale;
            height = (viewBox[3] - viewBox[1]) * scale;
          }
          this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
          this.width = width;
          this.height = height;
        }
        get rawDims() {
          const dims = this.viewBox;
          return shadow(this, "rawDims", {
            pageWidth: dims[2] - dims[0],
            pageHeight: dims[3] - dims[1],
            pageX: dims[0],
            pageY: dims[1]
          });
        }
        clone({
          scale = this.scale,
          rotation = this.rotation,
          offsetX = this.offsetX,
          offsetY = this.offsetY,
          dontFlip = false
        } = {}) {
          return new _PageViewport({
            viewBox: this.viewBox.slice(),
            userUnit: this.userUnit,
            scale,
            rotation,
            offsetX,
            offsetY,
            dontFlip
          });
        }
        convertToViewportPoint(x, y) {
          const p = [x, y];
          Util.applyTransform(p, this.transform);
          return p;
        }
        convertToPdfPoint(x, y) {
          const p = [x, y];
          Util.applyInverseTransform(p, this.transform);
          return p;
        }
      };
      XfaText = class _XfaText {
        static textContent(xfa) {
          const items = [];
          const output = {
            items,
            styles: /* @__PURE__ */ Object.create(null)
          };
          function walk(node) {
            if (!node) {
              return;
            }
            let str = null;
            const name = node.name;
            if (name === "#text") {
              str = node.value;
            } else if (!_XfaText.shouldBuildText(name)) {
              return;
            } else if (node?.attributes?.textContent) {
              str = node.attributes.textContent;
            } else if (node.value) {
              str = node.value;
            }
            if (str !== null) {
              items.push({
                str
              });
            }
            if (!node.children) {
              return;
            }
            for (const child of node.children) {
              walk(child);
            }
          }
          walk(xfa);
          return output;
        }
        static shouldBuildText(name) {
          return !(name === "textarea" || name === "input" || name === "option" || name === "select");
        }
      };
      disallowedRichTextStyleRegExp = /url\(|image-set\(/i;
      disallowedEventHandlerAttrRegExp = /^on/i;
      XfaLayer = class {
        static get _allowedHtmlElements() {
          return shadow(this, "_allowedHtmlElements", /* @__PURE__ */ new Set(["a", "b", "br", "button", "div", "i", "img", "input", "label", "li", "ol", "option", "p", "select", "span", "sub", "sup", "textarea", "ul"]));
        }
        static get _allowedSvgElements() {
          return shadow(this, "_allowedSvgElements", /* @__PURE__ */ new Set(["ellipse", "line", "path", "rect", "svg"]));
        }
        static get _allowedRichTextElements() {
          return shadow(this, "_allowedRichTextElements", /* @__PURE__ */ new Set(["a", "b", "br", "div", "i", "li", "ol", "p", "span", "sub", "sup", "ul"]));
        }
        static get _allowedRichTextAttributes() {
          return shadow(this, "_allowedRichTextAttributes", /* @__PURE__ */ new Set(["class", "dir", "style"]));
        }
        static get _allowedRichTextStyles() {
          return shadow(this, "_allowedRichTextStyles", /* @__PURE__ */ new Set(["color", "font", "fontFamily", "fontSize", "fontStretch", "fontStyle", "fontWeight", "kerningMode", "letterSpacing", "lineHeight", "margin", "marginBottom", "marginLeft", "marginRight", "marginTop", "orphans", "paddingLeft", "paddingRight", "breakAfter", "breakBefore", "breakInside", "tabInterval", "tabStop", "textAlign", "textDecoration", "textIndent", "transform", "verticalAlign", "widows"]));
        }
        static setupStorage(html, id, element, storage, intent) {
          const storedData = storage.getValue(id, {
            value: null
          });
          switch (element.name) {
            case "textarea":
              if (storedData.value !== null) {
                html.textContent = storedData.value;
              }
              if (intent === "print") {
                break;
              }
              html.addEventListener("input", (event) => {
                storage.setValue(id, {
                  value: event.target.value
                });
              });
              break;
            case "input":
              if (element.attributes.type === "radio" || element.attributes.type === "checkbox") {
                if (storedData.value === element.attributes.xfaOn) {
                  html.setAttribute("checked", true);
                } else if (storedData.value === element.attributes.xfaOff) {
                  html.removeAttribute("checked");
                }
                if (intent === "print") {
                  break;
                }
                html.addEventListener("change", (event) => {
                  storage.setValue(id, {
                    value: event.target.checked ? event.target.getAttribute("xfaOn") : event.target.getAttribute("xfaOff")
                  });
                });
              } else {
                if (storedData.value !== null) {
                  html.setAttribute("value", storedData.value);
                }
                if (intent === "print") {
                  break;
                }
                html.addEventListener("input", (event) => {
                  storage.setValue(id, {
                    value: event.target.value
                  });
                });
              }
              break;
            case "select":
              if (storedData.value !== null) {
                html.setAttribute("value", storedData.value);
                for (const option of element.children) {
                  if (option.attributes.value === storedData.value) {
                    option.attributes.selected = true;
                  } else if (Object.hasOwn(option.attributes, "selected")) {
                    delete option.attributes.selected;
                  }
                }
              }
              html.addEventListener("input", (event) => {
                const options = event.target.options;
                const value = options.selectedIndex === -1 ? "" : options[options.selectedIndex].value;
                storage.setValue(id, {
                  value
                });
              });
              break;
          }
        }
        static setAttributes({
          html,
          element,
          storage = null,
          intent,
          linkService
        }) {
          const {
            attributes
          } = element;
          const isHTMLAnchorElement = html instanceof HTMLAnchorElement;
          if (attributes.type === "radio") {
            attributes.name = `${attributes.name}-${intent}`;
          }
          for (const [key, value] of Object.entries(attributes)) {
            if (value === null || value === void 0) {
              continue;
            }
            if (disallowedEventHandlerAttrRegExp.test(key)) {
              continue;
            }
            if (intent === "richText" && !this._allowedRichTextAttributes.has(key)) {
              continue;
            }
            switch (key) {
              case "class":
                if (value.length) {
                  html.setAttribute(key, value.join(" "));
                }
                break;
              case "dataId":
                break;
              case "id":
                html.setAttribute("data-element-id", value);
                break;
              case "style":
                if (intent === "richText") {
                  const allowedStyles = this._allowedRichTextStyles;
                  for (const [styleName, styleValue] of Object.entries(value)) {
                    if (allowedStyles.has(styleName) && !disallowedRichTextStyleRegExp.test(styleValue)) {
                      html.style[styleName] = styleValue;
                    }
                  }
                } else {
                  Object.assign(html.style, value);
                }
                break;
              case "textContent":
                html.textContent = value;
                break;
              default:
                if (!isHTMLAnchorElement || key !== "href" && key !== "newWindow") {
                  html.setAttribute(key, value);
                }
            }
          }
          if (isHTMLAnchorElement) {
            linkService?.addLinkAttributes(html, attributes.href, attributes.newWindow);
          }
          if (storage && attributes.dataId) {
            this.setupStorage(html, attributes.dataId, element, storage);
          }
        }
        static render(parameters) {
          const storage = parameters.annotationStorage;
          const linkService = parameters.linkService;
          const root3 = parameters.xfaHtml;
          const intent = parameters.intent || "display";
          const rootHtml = __privateMethod(this, _XfaLayer_static, createElement_fn).call(this, root3.name, root3.attributes?.xmlns, intent) ?? document.createElement("div");
          if (root3.attributes) {
            this.setAttributes({
              html: rootHtml,
              element: root3,
              intent,
              linkService
            });
          }
          const isNotForRichText = intent !== "richText";
          const rootDiv = parameters.div;
          rootDiv.append(rootHtml);
          if (parameters.viewport) {
            const transform = `matrix(${parameters.viewport.transform.join(",")})`;
            rootDiv.style.transform = transform;
          }
          if (isNotForRichText) {
            rootDiv.setAttribute("class", "xfaLayer xfaFont");
          }
          const textDivs = [];
          if (root3.children.length === 0) {
            if (root3.value) {
              const node = document.createTextNode(root3.value);
              rootHtml.append(node);
              if (isNotForRichText && XfaText.shouldBuildText(root3.name)) {
                textDivs.push(node);
              }
            }
            return {
              textDivs
            };
          }
          const stack = [[root3, -1, rootHtml]];
          while (stack.length > 0) {
            const [parent, i, html] = stack.at(-1);
            if (i + 1 === parent.children.length) {
              stack.pop();
              continue;
            }
            const child = parent.children[++stack.at(-1)[1]];
            if (child === null) {
              continue;
            }
            const {
              name
            } = child;
            if (name === "#text") {
              const node = document.createTextNode(child.value);
              textDivs.push(node);
              html.append(node);
              continue;
            }
            const childHtml = __privateMethod(this, _XfaLayer_static, createElement_fn).call(this, name, child.attributes?.xmlns, intent);
            if (!childHtml) {
              continue;
            }
            html.append(childHtml);
            if (child.attributes) {
              this.setAttributes({
                html: childHtml,
                element: child,
                storage,
                intent,
                linkService
              });
            }
            if (child.children?.length > 0) {
              stack.push([child, -1, childHtml]);
            } else if (child.value) {
              const node = document.createTextNode(child.value);
              if (isNotForRichText && XfaText.shouldBuildText(name)) {
                textDivs.push(node);
              }
              childHtml.append(node);
            }
          }
          for (const el of rootDiv.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea")) {
            el.setAttribute("readOnly", true);
          }
          return {
            textDivs
          };
        }
        static update(parameters) {
          const transform = `matrix(${parameters.viewport.transform.join(",")})`;
          parameters.div.style.transform = transform;
          parameters.div.hidden = false;
        }
        static getPageViewport(xfaPage, {
          scale = 1,
          rotation = 0
        }) {
          const {
            width,
            height
          } = xfaPage.attributes.style;
          return new PageViewport({
            viewBox: [0, 0, parseInt(width, 10), parseInt(height, 10)],
            userUnit: 1,
            scale,
            rotation
          });
        }
      };
      _XfaLayer_static = new WeakSet();
      createElement_fn = function(name, xmlns, intent) {
        if (intent === "richText") {
          return !xmlns && this._allowedRichTextElements.has(name) ? document.createElement(name) : null;
        }
        if (xmlns) {
          return xmlns === SVG_NS && this._allowedSvgElements.has(name) ? document.createElementNS(SVG_NS, name) : null;
        }
        return this._allowedHtmlElements.has(name) ? document.createElement(name) : null;
      };
      __privateAdd(XfaLayer, _XfaLayer_static);
      _PixelsPerInch = class _PixelsPerInch {
      };
      __publicField(_PixelsPerInch, "CSS", 96);
      __publicField(_PixelsPerInch, "PDF", 72);
      __publicField(_PixelsPerInch, "PDF_TO_CSS_UNITS", _PixelsPerInch.CSS / _PixelsPerInch.PDF);
      PixelsPerInch = _PixelsPerInch;
      RenderingCancelledException = class extends BaseException {
        constructor(msg, extraDelay = 0) {
          super(msg, "RenderingCancelledException");
          this.extraDelay = extraDelay;
        }
      };
      StatTimer = class {
        constructor() {
          __privateAdd(this, _started, /* @__PURE__ */ new Map());
          __publicField(this, "times", []);
        }
        time(name) {
          if (__privateGet(this, _started).has(name)) {
            warn(`Timer is already running for ${name}`);
          }
          __privateGet(this, _started).set(name, Date.now());
        }
        timeEnd(name) {
          if (!__privateGet(this, _started).has(name)) {
            warn(`Timer has not been started for ${name}`);
          }
          this.times.push({
            name,
            start: __privateGet(this, _started).get(name),
            end: Date.now()
          });
          __privateGet(this, _started).delete(name);
        }
        toString() {
          const longest = Math.max(...this.times.map((t) => t.name.length));
          return this.times.map((t) => `${t.name.padEnd(longest)} ${t.end - t.start}ms
`).join("");
        }
      };
      _started = new WeakMap();
      PDFDateString = class {
        static toDateObject(input) {
          if (input instanceof Date) {
            return input;
          }
          if (!input || typeof input !== "string") {
            return null;
          }
          __privateGet(this, _regex) || __privateSet(this, _regex, new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?"));
          const matches = __privateGet(this, _regex).exec(input);
          if (!matches) {
            return null;
          }
          const year = parseInt(matches[1], 10);
          let month = parseInt(matches[2], 10);
          month = month >= 1 && month <= 12 ? month - 1 : 0;
          let day = parseInt(matches[3], 10);
          day = day >= 1 && day <= 31 ? day : 1;
          let hour = parseInt(matches[4], 10);
          hour = hour >= 0 && hour <= 23 ? hour : 0;
          let minute = parseInt(matches[5], 10);
          minute = minute >= 0 && minute <= 59 ? minute : 0;
          let second = parseInt(matches[6], 10);
          second = second >= 0 && second <= 59 ? second : 0;
          const universalTimeRelation = matches[7] || "Z";
          let offsetHour = parseInt(matches[8], 10);
          offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;
          let offsetMinute = parseInt(matches[9], 10) || 0;
          offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;
          if (universalTimeRelation === "-") {
            hour += offsetHour;
            minute += offsetMinute;
          } else if (universalTimeRelation === "+") {
            hour -= offsetHour;
            minute -= offsetMinute;
          }
          return new Date(Date.UTC(year, month, day, hour, minute, second));
        }
      };
      _regex = new WeakMap();
      __privateAdd(PDFDateString, _regex);
      OutputScale = class _OutputScale {
        constructor() {
          const {
            pixelRatio
          } = _OutputScale;
          this.sx = pixelRatio;
          this.sy = pixelRatio;
        }
        get scaled() {
          return this.sx !== 1 || this.sy !== 1;
        }
        get symmetric() {
          return this.sx === this.sy;
        }
        limitCanvas(width, height, maxPixels, maxDim, capAreaFactor = -1) {
          let maxAreaScale = Infinity, maxWidthScale = Infinity, maxHeightScale = Infinity;
          maxPixels = _OutputScale.capPixels(maxPixels, capAreaFactor);
          if (maxPixels > 0) {
            maxAreaScale = Math.sqrt(maxPixels / (width * height));
          }
          if (maxDim !== -1) {
            maxWidthScale = maxDim / width;
            maxHeightScale = maxDim / height;
          }
          const maxScale = Math.min(maxAreaScale, maxWidthScale, maxHeightScale);
          if (this.sx > maxScale || this.sy > maxScale) {
            this.sx = maxScale;
            this.sy = maxScale;
            return true;
          }
          return false;
        }
        static get pixelRatio() {
          return globalThis.devicePixelRatio || 1;
        }
        static capPixels(maxPixels, capAreaFactor) {
          if (capAreaFactor >= 0) {
            const winPixels = Math.ceil(window.screen.availWidth * window.screen.availHeight * this.pixelRatio ** 2 * (1 + capAreaFactor / 100));
            return maxPixels > 0 ? Math.min(maxPixels, winPixels) : winPixels;
          }
          return maxPixels;
        }
      };
      SupportedImageMimeTypes = ["image/apng", "image/avif", "image/bmp", "image/gif", "image/jpeg", "image/png", "image/svg+xml", "image/webp", "image/x-icon"];
      ColorScheme = class {
        static get isDarkMode() {
          return shadow(this, "isDarkMode", !!window?.matchMedia?.("(prefers-color-scheme: dark)").matches);
        }
      };
      CSSConstants = class {
        static get commentForegroundColor() {
          const element = document.createElement("span");
          element.classList.add("comment", "sidebar");
          const {
            style
          } = element;
          style.width = style.height = "0";
          style.display = "none";
          style.color = "var(--comment-fg-color)";
          document.body.append(element);
          const {
            color
          } = window.getComputedStyle(element);
          element.remove();
          return shadow(this, "commentForegroundColor", getRGB(color));
        }
      };
      contrastCache = /* @__PURE__ */ new Map();
      _EditorToolbar = class _EditorToolbar {
        constructor(editor) {
          __privateAdd(this, _EditorToolbar_instances);
          __privateAdd(this, _toolbar, null);
          __privateAdd(this, _colorPicker, null);
          __privateAdd(this, _editor);
          __privateAdd(this, _buttons, null);
          __privateAdd(this, _altText, null);
          __privateAdd(this, _comment, null);
          __privateAdd(this, _commentButtonDivider, null);
          __privateAdd(this, _signatureDescriptionButton, null);
          __privateSet(this, _editor, editor);
          __privateGet(_EditorToolbar, _l10nRemove) || __privateSet(_EditorToolbar, _l10nRemove, Object.freeze({
            freetext: "pdfjs-editor-remove-freetext-button",
            highlight: "pdfjs-editor-remove-highlight-button",
            ink: "pdfjs-editor-remove-ink-button",
            stamp: "pdfjs-editor-remove-stamp-button",
            signature: "pdfjs-editor-remove-signature-button"
          }));
        }
        render() {
          const editToolbar = __privateSet(this, _toolbar, document.createElement("div"));
          editToolbar.classList.add("editToolbar", "hidden");
          editToolbar.setAttribute("role", "toolbar");
          const signal = __privateGet(this, _editor)._uiManager._signal;
          if (signal instanceof AbortSignal && !signal.aborted) {
            editToolbar.addEventListener("contextmenu", noContextMenu, {
              signal
            });
            editToolbar.addEventListener("pointerdown", __privateMethod(_EditorToolbar, _EditorToolbar_static, pointerDown_fn), {
              signal
            });
          }
          const buttons = __privateSet(this, _buttons, document.createElement("div"));
          buttons.className = "buttons";
          editToolbar.append(buttons);
          const position = __privateGet(this, _editor).toolbarPosition;
          if (position) {
            const {
              style
            } = editToolbar;
            const x = __privateGet(this, _editor)._uiManager.direction === "ltr" ? 1 - position[0] : position[0];
            style.insetInlineEnd = `${100 * x}%`;
            style.top = `calc(${100 * position[1]}% + var(--editor-toolbar-vert-offset))`;
          }
          return editToolbar;
        }
        get div() {
          return __privateGet(this, _toolbar);
        }
        hide() {
          __privateGet(this, _toolbar).classList.add("hidden");
          __privateGet(this, _colorPicker)?.hideDropdown();
        }
        show() {
          __privateGet(this, _toolbar).classList.remove("hidden");
          __privateGet(this, _altText)?.shown();
          __privateGet(this, _comment)?.shown();
        }
        addDeleteButton() {
          const {
            editorType,
            _uiManager: _uiManager5
          } = __privateGet(this, _editor);
          const button = document.createElement("button");
          button.classList.add("basic", "deleteButton");
          button.tabIndex = 0;
          button.setAttribute("data-l10n-id", __privateGet(_EditorToolbar, _l10nRemove)[editorType]);
          if (__privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button)) {
            button.addEventListener("click", (e) => {
              _uiManager5.delete();
            }, {
              signal: _uiManager5._signal
            });
          }
          __privateGet(this, _buttons).append(button);
        }
        async addAltText(altText) {
          const button = await altText.render();
          __privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button);
          __privateGet(this, _buttons).append(button, __privateGet(this, _EditorToolbar_instances, divider_get));
          __privateSet(this, _altText, altText);
        }
        addComment(comment, beforeElement = null) {
          if (__privateGet(this, _comment)) {
            return;
          }
          const button = comment.renderForToolbar();
          if (!button) {
            return;
          }
          __privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button);
          const divider = __privateSet(this, _commentButtonDivider, __privateGet(this, _EditorToolbar_instances, divider_get));
          if (!beforeElement) {
            __privateGet(this, _buttons).append(button, divider);
          } else {
            __privateGet(this, _buttons).insertBefore(button, beforeElement);
            __privateGet(this, _buttons).insertBefore(divider, beforeElement);
          }
          __privateSet(this, _comment, comment);
          comment.toolbar = this;
        }
        addColorPicker(colorPicker) {
          if (__privateGet(this, _colorPicker)) {
            return;
          }
          __privateSet(this, _colorPicker, colorPicker);
          const button = colorPicker.renderButton();
          __privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button);
          __privateGet(this, _buttons).append(button, __privateGet(this, _EditorToolbar_instances, divider_get));
        }
        async addEditSignatureButton(signatureManager) {
          const button = __privateSet(this, _signatureDescriptionButton, await signatureManager.renderEditButton(__privateGet(this, _editor)));
          __privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button);
          __privateGet(this, _buttons).append(button, __privateGet(this, _EditorToolbar_instances, divider_get));
        }
        removeButton(name) {
          switch (name) {
            case "comment":
              __privateGet(this, _comment)?.removeToolbarCommentButton();
              __privateSet(this, _comment, null);
              __privateGet(this, _commentButtonDivider)?.remove();
              __privateSet(this, _commentButtonDivider, null);
              break;
          }
        }
        async addButton(name, tool) {
          switch (name) {
            case "colorPicker":
              if (tool) {
                this.addColorPicker(tool);
              }
              break;
            case "altText":
              if (tool) {
                await this.addAltText(tool);
              }
              break;
            case "editSignature":
              if (tool) {
                await this.addEditSignatureButton(tool);
              }
              break;
            case "delete":
              this.addDeleteButton();
              break;
            case "comment":
              if (tool) {
                this.addComment(tool);
              }
              break;
          }
        }
        async addButtonBefore(name, tool, beforeSelector) {
          if (!tool && name === "comment") {
            return;
          }
          const beforeElement = __privateGet(this, _buttons).querySelector(beforeSelector);
          if (!beforeElement) {
            return;
          }
          if (name === "comment") {
            this.addComment(tool, beforeElement);
          }
        }
        updateEditSignatureButton(description) {
          if (__privateGet(this, _signatureDescriptionButton)) {
            __privateGet(this, _signatureDescriptionButton).title = description;
          }
        }
        remove() {
          __privateGet(this, _toolbar).remove();
          __privateGet(this, _colorPicker)?.destroy();
          __privateSet(this, _colorPicker, null);
        }
      };
      _toolbar = new WeakMap();
      _colorPicker = new WeakMap();
      _editor = new WeakMap();
      _buttons = new WeakMap();
      _altText = new WeakMap();
      _comment = new WeakMap();
      _commentButtonDivider = new WeakMap();
      _signatureDescriptionButton = new WeakMap();
      _l10nRemove = new WeakMap();
      _EditorToolbar_static = new WeakSet();
      pointerDown_fn = function(e) {
        e.stopPropagation();
      };
      _EditorToolbar_instances = new WeakSet();
      focusIn_fn = function(e) {
        __privateGet(this, _editor)._focusEventsAllowed = false;
        stopEvent(e);
      };
      focusOut_fn = function(e) {
        __privateGet(this, _editor)._focusEventsAllowed = true;
        stopEvent(e);
      };
      addListenersToElement_fn = function(element) {
        const signal = __privateGet(this, _editor)._uiManager._signal;
        if (!(signal instanceof AbortSignal) || signal.aborted) {
          return false;
        }
        element.addEventListener("focusin", __privateMethod(this, _EditorToolbar_instances, focusIn_fn).bind(this), {
          capture: true,
          signal
        });
        element.addEventListener("focusout", __privateMethod(this, _EditorToolbar_instances, focusOut_fn).bind(this), {
          capture: true,
          signal
        });
        element.addEventListener("contextmenu", noContextMenu, {
          signal
        });
        return true;
      };
      divider_get = function() {
        const divider = document.createElement("div");
        divider.className = "divider";
        return divider;
      };
      __privateAdd(_EditorToolbar, _EditorToolbar_static);
      __privateAdd(_EditorToolbar, _l10nRemove, null);
      EditorToolbar = _EditorToolbar;
      FloatingToolbar = class {
        constructor(uiManager) {
          __privateAdd(this, _FloatingToolbar_instances);
          __privateAdd(this, _buttons2, null);
          __privateAdd(this, _toolbar2, null);
          __privateAdd(this, _uiManager);
          __privateSet(this, _uiManager, uiManager);
        }
        show(parent, boxes, isLTR) {
          const [x, y] = __privateMethod(this, _FloatingToolbar_instances, getLastPoint_fn).call(this, boxes, isLTR);
          const {
            style
          } = __privateGet(this, _toolbar2) || __privateSet(this, _toolbar2, __privateMethod(this, _FloatingToolbar_instances, render_fn).call(this));
          parent.append(__privateGet(this, _toolbar2));
          style.insetInlineEnd = `${100 * x}%`;
          style.top = `calc(${100 * y}% + var(--editor-toolbar-vert-offset))`;
        }
        hide() {
          __privateGet(this, _toolbar2).remove();
        }
      };
      _buttons2 = new WeakMap();
      _toolbar2 = new WeakMap();
      _uiManager = new WeakMap();
      _FloatingToolbar_instances = new WeakSet();
      render_fn = function() {
        const editToolbar = __privateSet(this, _toolbar2, document.createElement("div"));
        editToolbar.className = "editToolbar";
        editToolbar.setAttribute("role", "toolbar");
        const signal = __privateGet(this, _uiManager)._signal;
        if (signal instanceof AbortSignal && !signal.aborted) {
          editToolbar.addEventListener("contextmenu", noContextMenu, {
            signal
          });
        }
        const buttons = __privateSet(this, _buttons2, document.createElement("div"));
        buttons.className = "buttons";
        editToolbar.append(buttons);
        if (__privateGet(this, _uiManager).hasCommentManager()) {
          __privateMethod(this, _FloatingToolbar_instances, makeButton_fn).call(this, "commentButton", `pdfjs-comment-floating-button`, "pdfjs-comment-floating-button-label", () => {
            __privateGet(this, _uiManager).commentSelection("floating_button");
          });
        }
        __privateMethod(this, _FloatingToolbar_instances, makeButton_fn).call(this, "highlightButton", `pdfjs-highlight-floating-button1`, "pdfjs-highlight-floating-button-label", () => {
          __privateGet(this, _uiManager).highlightSelection("floating_button");
        });
        return editToolbar;
      };
      getLastPoint_fn = function(boxes, isLTR) {
        let lastY = 0;
        let lastX = 0;
        for (const box of boxes) {
          const y = box.y + box.height;
          if (y < lastY) {
            continue;
          }
          const x = box.x + (isLTR ? box.width : 0);
          if (y > lastY) {
            lastX = x;
            lastY = y;
            continue;
          }
          if (isLTR) {
            if (x > lastX) {
              lastX = x;
            }
          } else if (x < lastX) {
            lastX = x;
          }
        }
        return [isLTR ? 1 - lastX : lastX, lastY];
      };
      makeButton_fn = function(buttonClass, l10nId, labelL10nId, clickHandler) {
        const button = document.createElement("button");
        button.classList.add("basic", buttonClass);
        button.tabIndex = 0;
        button.setAttribute("data-l10n-id", l10nId);
        const span = document.createElement("span");
        button.append(span);
        span.className = "visuallyHidden";
        span.setAttribute("data-l10n-id", labelL10nId);
        const signal = __privateGet(this, _uiManager)._signal;
        if (signal instanceof AbortSignal && !signal.aborted) {
          button.addEventListener("contextmenu", noContextMenu, {
            signal
          });
          button.addEventListener("click", clickHandler, {
            signal
          });
        }
        __privateGet(this, _buttons2).append(button);
      };
      INTERNAL_EVT = "f63eb798-ea37-4556-98de-f8303ee5a694";
      internalOpt = Object.freeze({
        internal: INTERNAL_EVT
      });
      _CurrentPointers = class _CurrentPointers {
        static initializeAndAddPointerId(pointerId) {
          (__privateGet(_CurrentPointers, _pointerIds) || __privateSet(_CurrentPointers, _pointerIds, /* @__PURE__ */ new Set())).add(pointerId);
        }
        static setPointer(pointerType, pointerId) {
          __privateGet(_CurrentPointers, _pointerId) || __privateSet(_CurrentPointers, _pointerId, pointerId);
          __privateGet(_CurrentPointers, _pointerType) ?? __privateSet(_CurrentPointers, _pointerType, pointerType);
        }
        static setTimeStamp(timeStamp) {
          __privateSet(_CurrentPointers, _moveTimestamp, timeStamp);
        }
        static isSamePointerId(pointerId) {
          return __privateGet(_CurrentPointers, _pointerId) === pointerId;
        }
        static isSamePointerIdOrRemove(pointerId) {
          if (__privateGet(_CurrentPointers, _pointerId) === pointerId) {
            return true;
          }
          __privateGet(_CurrentPointers, _pointerIds)?.delete(pointerId);
          return false;
        }
        static isSamePointerType(pointerType) {
          return __privateGet(_CurrentPointers, _pointerType) === pointerType;
        }
        static isInitializedAndDifferentPointerType(pointerType) {
          return __privateGet(_CurrentPointers, _pointerType) !== null && !_CurrentPointers.isSamePointerType(pointerType);
        }
        static isSameTimeStamp(timeStamp) {
          return __privateGet(_CurrentPointers, _moveTimestamp) === timeStamp;
        }
        static isUsingMultiplePointers() {
          return __privateGet(_CurrentPointers, _pointerIds)?.size >= 1;
        }
        static clearPointerType() {
          __privateSet(_CurrentPointers, _pointerType, null);
        }
        static clearPointerIds() {
          __privateSet(_CurrentPointers, _pointerId, NaN);
          __privateSet(_CurrentPointers, _pointerIds, null);
        }
        static clearTimeStamp() {
          __privateSet(_CurrentPointers, _moveTimestamp, NaN);
        }
      };
      _pointerId = new WeakMap();
      _pointerIds = new WeakMap();
      _moveTimestamp = new WeakMap();
      _pointerType = new WeakMap();
      __privateAdd(_CurrentPointers, _pointerId, NaN);
      __privateAdd(_CurrentPointers, _pointerIds, null);
      __privateAdd(_CurrentPointers, _moveTimestamp, NaN);
      __privateAdd(_CurrentPointers, _pointerType, null);
      CurrentPointers = _CurrentPointers;
      IdManager = class {
        constructor() {
          __privateAdd(this, _id, 0);
        }
        get id() {
          return `${AnnotationEditorPrefix}${__privateWrapper(this, _id)._++}`;
        }
      };
      _id = new WeakMap();
      _ImageManager = class _ImageManager {
        constructor() {
          __privateAdd(this, _ImageManager_instances);
          __privateAdd(this, _baseId, getUuid());
          __privateAdd(this, _id2, 0);
          __privateAdd(this, _cache, null);
        }
        static get _isSVGFittingCanvas() {
          const svg = `data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${SVG_NS}"><rect width="1" height="1" style="fill:red;"/></svg>`;
          const canvas = new OffscreenCanvas(1, 3);
          const ctx = canvas.getContext("2d", {
            willReadFrequently: true
          });
          const image = new Image();
          image.src = svg;
          const promise = image.decode().then(() => {
            ctx.drawImage(image, 0, 0, 1, 1, 0, 0, 1, 3);
            return new Uint32Array(ctx.getImageData(0, 0, 1, 1).data.buffer)[0] === 0;
          });
          return shadow(this, "_isSVGFittingCanvas", promise);
        }
        async getFromFile(file) {
          const {
            lastModified,
            name,
            size: size2,
            type
          } = file;
          return __privateMethod(this, _ImageManager_instances, get_fn).call(this, `${lastModified}_${name}_${size2}_${type}`, file);
        }
        async getFromUrl(url) {
          return __privateMethod(this, _ImageManager_instances, get_fn).call(this, url, url);
        }
        async getFromBlob(id, blobPromise) {
          const blob = await blobPromise;
          return __privateMethod(this, _ImageManager_instances, get_fn).call(this, id, blob);
        }
        async getFromId(id) {
          __privateGet(this, _cache) || __privateSet(this, _cache, /* @__PURE__ */ new Map());
          const data = __privateGet(this, _cache).get(id);
          if (!data) {
            return null;
          }
          if (data.bitmap) {
            data.refCounter += 1;
            return data;
          }
          if (data.file) {
            return this.getFromFile(data.file);
          }
          if (data.blobPromise) {
            const {
              blobPromise
            } = data;
            delete data.blobPromise;
            return this.getFromBlob(data.id, blobPromise);
          }
          return this.getFromUrl(data.url);
        }
        getFromCanvas(id, canvas) {
          __privateGet(this, _cache) || __privateSet(this, _cache, /* @__PURE__ */ new Map());
          let data = __privateGet(this, _cache).get(id);
          if (data?.bitmap) {
            data.refCounter += 1;
            return data;
          }
          const offscreen = new OffscreenCanvas(canvas.width, canvas.height);
          const ctx = offscreen.getContext("2d");
          ctx.drawImage(canvas, 0, 0);
          data = {
            bitmap: offscreen.transferToImageBitmap(),
            id: `image_${__privateGet(this, _baseId)}_${__privateWrapper(this, _id2)._++}`,
            refCounter: 1,
            isSvg: false
          };
          __privateGet(this, _cache).set(id, data);
          __privateGet(this, _cache).set(data.id, data);
          return data;
        }
        getSvgUrl(id) {
          const data = __privateGet(this, _cache).get(id);
          if (!data?.isSvg) {
            return null;
          }
          return data.svgUrl;
        }
        deleteId(id) {
          __privateGet(this, _cache) || __privateSet(this, _cache, /* @__PURE__ */ new Map());
          const data = __privateGet(this, _cache).get(id);
          if (!data) {
            return;
          }
          data.refCounter -= 1;
          if (data.refCounter !== 0) {
            return;
          }
          const {
            bitmap
          } = data;
          if (!data.url && !data.file) {
            const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
            const ctx = canvas.getContext("bitmaprenderer");
            ctx.transferFromImageBitmap(bitmap);
            data.blobPromise = canvas.convertToBlob();
          }
          bitmap.close?.();
          data.bitmap = null;
        }
        isValidId(id) {
          return id.startsWith(`image_${__privateGet(this, _baseId)}_`);
        }
      };
      _baseId = new WeakMap();
      _id2 = new WeakMap();
      _cache = new WeakMap();
      _ImageManager_instances = new WeakSet();
      get_fn = async function(key, rawData) {
        __privateGet(this, _cache) || __privateSet(this, _cache, /* @__PURE__ */ new Map());
        let data = __privateGet(this, _cache).get(key);
        if (data === null) {
          return null;
        }
        if (data?.bitmap) {
          data.refCounter += 1;
          return data;
        }
        try {
          data || (data = {
            bitmap: null,
            id: `image_${__privateGet(this, _baseId)}_${__privateWrapper(this, _id2)._++}`,
            refCounter: 0,
            isSvg: false
          });
          let image;
          if (typeof rawData === "string") {
            data.url = rawData;
            image = await fetchData(rawData, "blob");
          } else if (rawData instanceof File) {
            image = data.file = rawData;
          } else if (rawData instanceof Blob) {
            image = rawData;
          }
          if (image.type === "image/svg+xml") {
            const mustRemoveAspectRatioPromise = _ImageManager._isSVGFittingCanvas;
            const fileReader = new FileReader();
            const imageElement = new Image();
            const imagePromise = new Promise((resolve, reject2) => {
              imageElement.onload = () => {
                data.bitmap = imageElement;
                data.isSvg = true;
                resolve();
              };
              fileReader.onload = async () => {
                const url = data.svgUrl = fileReader.result;
                imageElement.src = await mustRemoveAspectRatioPromise ? `${url}#svgView(preserveAspectRatio(none))` : url;
              };
              imageElement.onerror = fileReader.onerror = reject2;
            });
            fileReader.readAsDataURL(image);
            await imagePromise;
          } else {
            data.bitmap = await createImageBitmap(image);
          }
          data.refCounter = 1;
        } catch (e) {
          warn(e);
          data = null;
        }
        __privateGet(this, _cache).set(key, data);
        if (data) {
          __privateGet(this, _cache).set(data.id, data);
        }
        return data;
      };
      ImageManager = _ImageManager;
      CommandManager = class {
        constructor(maxSize = 128) {
          __privateAdd(this, _commands, []);
          __privateAdd(this, _locked, false);
          __privateAdd(this, _maxSize);
          __privateAdd(this, _position, -1);
          __privateSet(this, _maxSize, maxSize);
        }
        add({
          cmd,
          undo,
          post,
          mustExec,
          type = NaN,
          overwriteIfSameType = false,
          keepUndo = false
        }) {
          if (mustExec) {
            cmd();
          }
          if (__privateGet(this, _locked)) {
            return;
          }
          const save = {
            cmd,
            undo,
            post,
            type
          };
          if (__privateGet(this, _position) === -1) {
            if (__privateGet(this, _commands).length > 0) {
              __privateGet(this, _commands).length = 0;
            }
            __privateSet(this, _position, 0);
            __privateGet(this, _commands).push(save);
            return;
          }
          if (overwriteIfSameType && __privateGet(this, _commands)[__privateGet(this, _position)].type === type) {
            if (keepUndo) {
              save.undo = __privateGet(this, _commands)[__privateGet(this, _position)].undo;
            }
            __privateGet(this, _commands)[__privateGet(this, _position)] = save;
            return;
          }
          const next2 = __privateGet(this, _position) + 1;
          if (next2 === __privateGet(this, _maxSize)) {
            __privateGet(this, _commands).splice(0, 1);
          } else {
            __privateSet(this, _position, next2);
            if (next2 < __privateGet(this, _commands).length) {
              __privateGet(this, _commands).splice(next2);
            }
          }
          __privateGet(this, _commands).push(save);
        }
        undo() {
          if (__privateGet(this, _position) === -1) {
            return;
          }
          __privateSet(this, _locked, true);
          const {
            undo,
            post
          } = __privateGet(this, _commands)[__privateGet(this, _position)];
          undo();
          post?.();
          __privateSet(this, _locked, false);
          __privateSet(this, _position, __privateGet(this, _position) - 1);
        }
        redo() {
          if (__privateGet(this, _position) < __privateGet(this, _commands).length - 1) {
            __privateSet(this, _position, __privateGet(this, _position) + 1);
            __privateSet(this, _locked, true);
            const {
              cmd,
              post
            } = __privateGet(this, _commands)[__privateGet(this, _position)];
            cmd();
            post?.();
            __privateSet(this, _locked, false);
          }
        }
        hasSomethingToUndo() {
          return __privateGet(this, _position) !== -1;
        }
        hasSomethingToRedo() {
          return __privateGet(this, _position) < __privateGet(this, _commands).length - 1;
        }
        cleanType(type) {
          if (__privateGet(this, _position) === -1) {
            return;
          }
          for (let i = __privateGet(this, _position); i >= 0; i--) {
            if (__privateGet(this, _commands)[i].type !== type) {
              __privateGet(this, _commands).splice(i + 1, __privateGet(this, _position) - i);
              __privateSet(this, _position, i);
              return;
            }
          }
          __privateGet(this, _commands).length = 0;
          __privateSet(this, _position, -1);
        }
        destroy() {
          __privateSet(this, _commands, null);
        }
      };
      _commands = new WeakMap();
      _locked = new WeakMap();
      _maxSize = new WeakMap();
      _position = new WeakMap();
      _KeyboardManager = class _KeyboardManager {
        constructor(callbacks) {
          var _a;
          this.callbacks = /* @__PURE__ */ new Map();
          const {
            isMac
          } = FeatureTest.platform;
          for (const [keys3, callback, options = {}] of callbacks) {
            const hasMacOverride = keys3.some((k) => k.startsWith("mac+"));
            for (const key of keys3) {
              let shortcut = key;
              if (hasMacOverride) {
                const isMacKey = key.startsWith("mac+");
                if (isMac !== isMacKey) {
                  continue;
                }
                if (isMacKey) {
                  shortcut = key.slice(4);
                }
              }
              const [keyName, modifiers] = __privateMethod(_a = _KeyboardManager, _KeyboardManager_static, parseShortcut_fn).call(_a, shortcut);
              if (keyName === null) {
                continue;
              }
              this.callbacks.getOrInsertComputed(keyName, makeArr).push({
                callback,
                options,
                modifiers
              });
            }
          }
        }
        exec(self2, event) {
          var _a;
          let shortcuts = this.callbacks.get(event.key);
          if (!shortcuts) {
            if (/^[a-z]$/i.test(event.key)) {
              return;
            }
            const fallback = __privateMethod(_a = _KeyboardManager, _KeyboardManager_static, codeToKey_fn).call(_a, event.code);
            if (fallback === null || fallback === event.key) {
              return;
            }
            shortcuts = this.callbacks.get(fallback);
            if (!shortcuts) {
              return;
            }
          }
          const eventModifiers = (event.altKey ? _KeyboardManager.ALT : 0) | (event.ctrlKey ? _KeyboardManager.CTRL : 0) | (event.metaKey ? _KeyboardManager.META : 0) | (event.shiftKey ? _KeyboardManager.SHIFT : 0);
          const info2 = shortcuts.find((shortcut) => shortcut.modifiers === eventModifiers);
          if (!info2) {
            return;
          }
          const {
            callback,
            options: {
              bubbles = false,
              args = [],
              checker = null
            }
          } = info2;
          if (checker && !checker(self2, event)) {
            return;
          }
          callback.bind(self2, ...args, event)();
          if (!bubbles) {
            stopEvent(event);
          }
        }
      };
      _KeyboardManager_static = new WeakSet();
      parseShortcut_fn = function(value) {
        let keyPart = null;
        let modifiers = 0;
        for (let part of value.split("+")) {
          part = part.trim();
          if (!part) {
            continue;
          }
          const upper = part.toUpperCase();
          const modifier = _KeyboardManager[upper];
          if (modifier) {
            modifiers |= modifier;
            continue;
          }
          if (keyPart !== null) {
            warn(`KeyboardManager: multiple keys in shortcut "${value}"`);
            break;
          }
          keyPart = upper === "SPACE" ? " " : part;
        }
        if (keyPart === null) {
          warn(`KeyboardManager: no key found in shortcut "${value}"`);
        }
        return [keyPart, modifiers];
      };
      codeToKey_fn = function(code) {
        const match = /^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(code);
        if (!match) {
          return null;
        }
        return match[1]?.toLowerCase() ?? match[2];
      };
      __privateAdd(_KeyboardManager, _KeyboardManager_static);
      __publicField(_KeyboardManager, "ALT", 1);
      __publicField(_KeyboardManager, "CTRL", 2);
      __publicField(_KeyboardManager, "META", 4);
      __publicField(_KeyboardManager, "SHIFT", 8);
      KeyboardManager = _KeyboardManager;
      _ColorManager = class _ColorManager {
        get _colors() {
          const colors = /* @__PURE__ */ new Map([["CanvasText", null], ["Canvas", null]]);
          getColorValues(colors);
          return shadow(this, "_colors", colors);
        }
        convert(color) {
          const rgb = getRGB(color);
          if (!window.matchMedia("(forced-colors: active)").matches) {
            return rgb;
          }
          for (const [name, RGB] of this._colors) {
            if (RGB.every((x, i) => x === rgb[i])) {
              return _ColorManager._colorsMapping.get(name);
            }
          }
          return rgb;
        }
        getHexCode(name) {
          const rgb = this._colors.get(name);
          if (!rgb) {
            return name;
          }
          return Util.makeHexColor(...rgb);
        }
      };
      __publicField(_ColorManager, "_colorsMapping", /* @__PURE__ */ new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]));
      ColorManager = _ColorManager;
      _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
        constructor(container, viewer, viewerAlert, altTextManager, commentManager, signatureManager, eventBus, pdfDocument, pageColors, highlightColors, enableHighlightFloatingButton, enableUpdatedAddImage, enableNewAltTextWhenAddingImage, mlManager, editorUndoBar, supportsPinchToZoom) {
          __privateAdd(this, _AnnotationEditorUIManager_instances);
          __privateAdd(this, _abortController, new AbortController());
          __privateAdd(this, _activeEditor, null);
          __privateAdd(this, _allEditableAnnotations, null);
          __privateAdd(this, _allEditors, /* @__PURE__ */ new Map());
          __privateAdd(this, _allLayers, /* @__PURE__ */ new Map());
          __privateAdd(this, _savedAllLayers, null);
          __privateAdd(this, _altTextManager, null);
          __privateAdd(this, _annotationStorage, null);
          __privateAdd(this, _changedExistingAnnotations, null);
          __privateAdd(this, _commandManager, new CommandManager());
          __privateAdd(this, _commentManager, null);
          __privateAdd(this, _copyPasteAC, null);
          __privateAdd(this, _currentDrawingSession, null);
          __privateAdd(this, _currentPageIndex, 0);
          __privateAdd(this, _deletedAnnotationsElementIds, /* @__PURE__ */ new Set());
          __privateAdd(this, _draggingEditors, null);
          __privateAdd(this, _editorTypes, null);
          __privateAdd(this, _editorsToRescale, /* @__PURE__ */ new Set());
          __publicField(this, "_editorUndoBar", null);
          __privateAdd(this, _enableHighlightFloatingButton, false);
          __privateAdd(this, _enableUpdatedAddImage, false);
          __privateAdd(this, _enableNewAltTextWhenAddingImage, false);
          __privateAdd(this, _filterFactory, null);
          __privateAdd(this, _focusMainContainerTimeoutId, null);
          __privateAdd(this, _focusManagerAC, null);
          __privateAdd(this, _highlightColors, null);
          __privateAdd(this, _highlightWhenShiftUp, false);
          __privateAdd(this, _floatingToolbar, null);
          __privateAdd(this, _idManager, new IdManager());
          __privateAdd(this, _isEnabled, false);
          __privateAdd(this, _isPointerDown, false);
          __privateAdd(this, _isWaiting, false);
          __privateAdd(this, _keyboardManagerAC, null);
          __privateAdd(this, _lastActiveElement, null);
          __privateAdd(this, _mainHighlightColorPicker, null);
          __privateAdd(this, _missingCanvases, null);
          __privateAdd(this, _mlManager, null);
          __privateAdd(this, _mode, AnnotationEditorType.NONE);
          __privateAdd(this, _selectedEditors, /* @__PURE__ */ new Set());
          __privateAdd(this, _selectedTextNode, null);
          __privateAdd(this, _signatureManager, null);
          __privateAdd(this, _pageColors, null);
          __privateAdd(this, _showAllStates, null);
          __privateAdd(this, _pdfDocument, null);
          __privateAdd(this, _previousStates, {
            isEditing: false,
            isEmpty: true,
            hasSomethingToUndo: false,
            hasSomethingToRedo: false,
            hasSelectedEditor: false,
            hasSelectedText: false
          });
          __privateAdd(this, _translation, [0, 0]);
          __privateAdd(this, _translationTimeoutId, null);
          __privateAdd(this, _container, null);
          __privateAdd(this, _viewer, null);
          __privateAdd(this, _viewerAlert, null);
          __privateAdd(this, _updateModeCapability, null);
          const signal = this._signal = __privateGet(this, _abortController).signal;
          __privateSet(this, _container, container);
          __privateSet(this, _viewer, viewer);
          __privateSet(this, _viewerAlert, viewerAlert);
          __privateSet(this, _altTextManager, altTextManager);
          __privateSet(this, _commentManager, commentManager);
          __privateSet(this, _signatureManager, signatureManager);
          __privateSet(this, _pdfDocument, pdfDocument);
          this._eventBus = eventBus;
          const evtOpts = {
            signal,
            ...internalOpt
          };
          eventBus.on("editingaction", this.onEditingAction.bind(this), evtOpts);
          eventBus.on("pagechanging", this.onPageChanging.bind(this), evtOpts);
          eventBus.on("scalechanging", this.onScaleChanging.bind(this), evtOpts);
          eventBus.on("rotationchanging", this.onRotationChanging.bind(this), evtOpts);
          eventBus.on("setpreference", this.onSetPreference.bind(this), evtOpts);
          eventBus.on("switchannotationeditorparams", (evt) => this.updateParams(evt.type, evt.value), evtOpts);
          window.addEventListener("pointerdown", () => {
            __privateSet(this, _isPointerDown, true);
          }, {
            capture: true,
            signal
          });
          window.addEventListener("pointerup", () => {
            __privateSet(this, _isPointerDown, false);
          }, {
            capture: true,
            signal
          });
          window.addEventListener("beforeunload", this.endCurrentEditing.bind(this), {
            capture: true,
            signal
          });
          __privateMethod(this, _AnnotationEditorUIManager_instances, addSelectionListener_fn).call(this);
          __privateMethod(this, _AnnotationEditorUIManager_instances, addDragAndDropListeners_fn).call(this);
          __privateMethod(this, _AnnotationEditorUIManager_instances, addKeyboardManager_fn).call(this);
          __privateSet(this, _annotationStorage, pdfDocument.annotationStorage);
          __privateSet(this, _filterFactory, pdfDocument.filterFactory);
          __privateSet(this, _pageColors, pageColors);
          __privateSet(this, _highlightColors, highlightColors || null);
          __privateSet(this, _enableHighlightFloatingButton, enableHighlightFloatingButton);
          __privateSet(this, _enableUpdatedAddImage, enableUpdatedAddImage);
          __privateSet(this, _enableNewAltTextWhenAddingImage, enableNewAltTextWhenAddingImage);
          __privateSet(this, _mlManager, mlManager || null);
          this.viewParameters = {
            realScale: PixelsPerInch.PDF_TO_CSS_UNITS,
            rotation: 0
          };
          this.isShiftKeyDown = false;
          this._editorUndoBar = editorUndoBar || null;
          this._supportsPinchToZoom = supportsPinchToZoom !== false;
          commentManager?.setSidebarUiManager(this);
        }
        static get _keyboardManager() {
          const proto = _AnnotationEditorUIManager.prototype;
          const arrowChecker = (self2) => __privateGet(self2, _container).contains(document.activeElement) && document.activeElement.tagName !== "BUTTON" && self2.hasSomethingToControl();
          const textInputChecker = (_self, {
            target: el
          }) => {
            if (el instanceof HTMLInputElement) {
              const {
                type
              } = el;
              return type !== "text" && type !== "number";
            }
            return true;
          };
          const small = this.TRANSLATE_SMALL;
          const big = this.TRANSLATE_BIG;
          return shadow(this, "_keyboardManager", new KeyboardManager([[["ctrl+a", "mac+meta+a"], proto.selectAll, {
            checker: textInputChecker
          }], [["ctrl+z", "mac+meta+z"], proto.undo, {
            checker: textInputChecker
          }], [["ctrl+y", "ctrl+shift+z", "mac+meta+shift+z", "ctrl+shift+Z", "mac+meta+shift+Z"], proto.redo, {
            checker: textInputChecker
          }], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete", "mac+Delete"], proto.delete, {
            checker: textInputChecker
          }], [["Enter"], proto.addNewEditorFromKeyboard, {
            checker: (self2, {
              target: el
            }) => !(el instanceof HTMLButtonElement) && __privateGet(self2, _container).contains(el) && !self2.isEnterHandled
          }], [["Space"], proto.addNewEditorFromKeyboard, {
            checker: (self2, {
              target: el
            }) => !(el instanceof HTMLButtonElement) && __privateGet(self2, _container).contains(document.activeElement)
          }], [["Escape"], proto.unselectAll], [["ArrowLeft"], proto.translateSelectedEditors, {
            args: [-small, 0],
            checker: arrowChecker
          }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto.translateSelectedEditors, {
            args: [-big, 0],
            checker: arrowChecker
          }], [["ArrowRight"], proto.translateSelectedEditors, {
            args: [small, 0],
            checker: arrowChecker
          }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto.translateSelectedEditors, {
            args: [big, 0],
            checker: arrowChecker
          }], [["ArrowUp"], proto.translateSelectedEditors, {
            args: [0, -small],
            checker: arrowChecker
          }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto.translateSelectedEditors, {
            args: [0, -big],
            checker: arrowChecker
          }], [["ArrowDown"], proto.translateSelectedEditors, {
            args: [0, small],
            checker: arrowChecker
          }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto.translateSelectedEditors, {
            args: [0, big],
            checker: arrowChecker
          }]]));
        }
        destroy() {
          __privateGet(this, _updateModeCapability)?.resolve();
          __privateSet(this, _updateModeCapability, null);
          __privateGet(this, _abortController)?.abort();
          __privateSet(this, _abortController, null);
          this._signal = null;
          for (const layer of __privateGet(this, _allLayers).values()) {
            layer.destroy();
          }
          __privateGet(this, _allLayers).clear();
          __privateGet(this, _allEditors).clear();
          __privateGet(this, _editorsToRescale).clear();
          __privateGet(this, _missingCanvases)?.clear();
          __privateSet(this, _activeEditor, null);
          __privateGet(this, _selectedEditors).clear();
          __privateGet(this, _commandManager).destroy();
          __privateGet(this, _altTextManager)?.destroy();
          __privateGet(this, _commentManager)?.destroy();
          __privateGet(this, _signatureManager)?.destroy();
          __privateGet(this, _floatingToolbar)?.hide();
          __privateSet(this, _floatingToolbar, null);
          __privateGet(this, _mainHighlightColorPicker)?.destroy();
          __privateSet(this, _mainHighlightColorPicker, null);
          __privateSet(this, _allEditableAnnotations, null);
          if (__privateGet(this, _focusMainContainerTimeoutId)) {
            clearTimeout(__privateGet(this, _focusMainContainerTimeoutId));
            __privateSet(this, _focusMainContainerTimeoutId, null);
          }
          if (__privateGet(this, _translationTimeoutId)) {
            clearTimeout(__privateGet(this, _translationTimeoutId));
            __privateSet(this, _translationTimeoutId, null);
          }
          this._editorUndoBar?.destroy();
          __privateSet(this, _pdfDocument, null);
        }
        combinedSignal(ac) {
          return AbortSignal.any([this._signal, ac.signal]);
        }
        get mlManager() {
          return __privateGet(this, _mlManager);
        }
        get useNewAltTextFlow() {
          return __privateGet(this, _enableUpdatedAddImage);
        }
        get useNewAltTextWhenAddingImage() {
          return __privateGet(this, _enableNewAltTextWhenAddingImage);
        }
        get hcmFilter() {
          return shadow(this, "hcmFilter", __privateGet(this, _pageColors) ? __privateGet(this, _filterFactory).addHCMFilter(__privateGet(this, _pageColors).foreground, __privateGet(this, _pageColors).background) : "none");
        }
        get direction() {
          return shadow(this, "direction", getComputedStyle(__privateGet(this, _container)).direction);
        }
        get _highlightColors() {
          return shadow(this, "_highlightColors", __privateGet(this, _highlightColors) ? new Map(__privateGet(this, _highlightColors).split(",").map((pair) => {
            pair = pair.split("=").map((x) => x.trim());
            pair[1] = pair[1].toUpperCase();
            return pair;
          })) : null);
        }
        get highlightColors() {
          const {
            _highlightColors: _highlightColors2
          } = this;
          if (!_highlightColors2) {
            return shadow(this, "highlightColors", null);
          }
          const map2 = /* @__PURE__ */ new Map();
          const hasHCM = !!__privateGet(this, _pageColors);
          for (const [name, color] of _highlightColors2) {
            const isNameForHCM = name.endsWith("_HCM");
            if (hasHCM && isNameForHCM) {
              map2.set(name.replace("_HCM", ""), color);
              continue;
            }
            if (!hasHCM && !isNameForHCM) {
              map2.set(name, color);
            }
          }
          return shadow(this, "highlightColors", map2);
        }
        get highlightColorNames() {
          return shadow(this, "highlightColorNames", this.highlightColors ? new Map(Array.from(this.highlightColors, (e) => e.reverse())) : null);
        }
        getNonHCMColor(color) {
          if (!this._highlightColors) {
            return color;
          }
          const colorName = this.highlightColorNames.get(color);
          return this._highlightColors.get(colorName) || color;
        }
        getNonHCMColorName(color) {
          return this.highlightColorNames.get(color) || color;
        }
        setCurrentDrawingSession(layer) {
          if (layer) {
            this.unselectAll();
            this.disableUserSelect(true);
          } else {
            this.disableUserSelect(false);
          }
          __privateSet(this, _currentDrawingSession, layer);
        }
        setMainHighlightColorPicker(colorPicker) {
          __privateSet(this, _mainHighlightColorPicker, colorPicker);
        }
        editAltText(editor, firstTime = false) {
          __privateGet(this, _altTextManager)?.editAltText(this, editor, firstTime);
        }
        hasCommentManager() {
          return !!__privateGet(this, _commentManager);
        }
        editComment(editor, posX, posY, options) {
          __privateGet(this, _commentManager)?.showDialog(this, editor, posX, posY, options);
        }
        selectComment(pageIndex, uid) {
          const layer = __privateGet(this, _allLayers).get(pageIndex);
          const editor = layer?.getEditorByUID(uid);
          editor?.toggleComment(true, true);
        }
        updateComment(editor) {
          __privateGet(this, _commentManager)?.updateComment(editor.getData());
        }
        updatePopupColor(editor) {
          __privateGet(this, _commentManager)?.updatePopupColor(editor);
        }
        removeComment(editor) {
          __privateGet(this, _commentManager)?.removeComments([editor.uid]);
        }
        deleteComment(editor, savedData) {
          const undo = () => {
            editor.comment = savedData;
          };
          const cmd = () => {
            this._editorUndoBar?.show(undo, "comment");
            this.toggleComment(null);
            editor.comment = null;
          };
          this.addCommands({
            cmd,
            undo,
            mustExec: true
          });
        }
        toggleComment(editor, isSelected, visibility = void 0) {
          __privateGet(this, _commentManager)?.toggleCommentPopup(editor, isSelected, visibility);
        }
        makeCommentColor(color, opacity) {
          return color && __privateGet(this, _commentManager)?.makeCommentColor(color, opacity) || null;
        }
        getCommentDialogElement() {
          return __privateGet(this, _commentManager)?.dialogElement || null;
        }
        async waitForEditorsRendered(pageNumber) {
          if (__privateGet(this, _allLayers).has(pageNumber - 1)) {
            return;
          }
          const {
            resolve,
            promise
          } = Promise.withResolvers();
          const onEditorsRendered = (evt) => {
            if (evt.pageNumber === pageNumber) {
              this._eventBus.off("editorsrendered", onEditorsRendered);
              resolve();
            }
          };
          this._eventBus.on("editorsrendered", onEditorsRendered, internalOpt);
          await promise;
        }
        getSignature(editor) {
          __privateGet(this, _signatureManager)?.getSignature({
            uiManager: this,
            editor
          });
        }
        get signatureManager() {
          return __privateGet(this, _signatureManager);
        }
        switchToMode(mode, callback) {
          this._eventBus.on("annotationeditormodechanged", callback, {
            once: true,
            signal: this._signal,
            ...internalOpt
          });
          this._eventBus.dispatch("showannotationeditorui", {
            source: this,
            mode
          });
        }
        setPreference(name, value) {
          this._eventBus.dispatch("setpreference", {
            source: this,
            name,
            value
          });
        }
        onSetPreference({
          name,
          value
        }) {
          switch (name) {
            case "enableNewAltTextWhenAddingImage":
              __privateSet(this, _enableNewAltTextWhenAddingImage, value);
              break;
          }
        }
        onPageChanging({
          pageNumber
        }) {
          __privateSet(this, _currentPageIndex, pageNumber - 1);
        }
        deletePage(id) {
          for (const editor of this.getEditors(id)) {
            editor.remove();
          }
          __privateGet(this, _allLayers).delete(id);
          if (__privateGet(this, _currentPageIndex) === id) {
            __privateSet(this, _currentPageIndex, 0);
          }
        }
        focusMainContainer() {
          __privateGet(this, _container).focus();
        }
        findParent(x, y) {
          for (const layer of __privateGet(this, _allLayers).values()) {
            const {
              x: layerX,
              y: layerY,
              width,
              height
            } = layer.div.getBoundingClientRect();
            if (x >= layerX && x <= layerX + width && y >= layerY && y <= layerY + height) {
              return layer;
            }
          }
          return null;
        }
        disableUserSelect(value = false) {
          __privateGet(this, _viewer).classList.toggle("noUserSelect", value);
        }
        addShouldRescale(editor) {
          __privateGet(this, _editorsToRescale).add(editor);
        }
        removeShouldRescale(editor) {
          __privateGet(this, _editorsToRescale).delete(editor);
        }
        onScaleChanging({
          scale
        }) {
          this.commitOrRemove();
          this.viewParameters.realScale = scale * PixelsPerInch.PDF_TO_CSS_UNITS;
          for (const editor of __privateGet(this, _editorsToRescale)) {
            editor.onScaleChanging();
          }
          __privateGet(this, _currentDrawingSession)?.onScaleChanging();
        }
        onRotationChanging({
          pagesRotation
        }) {
          this.commitOrRemove();
          this.viewParameters.rotation = pagesRotation;
        }
        highlightSelection(methodOfCreation = "", comment = false) {
          const selection = document.getSelection();
          if (!selection || selection.isCollapsed) {
            return;
          }
          const {
            anchorNode,
            anchorOffset,
            focusNode,
            focusOffset
          } = selection;
          const text = selection.toString();
          const anchorElement = __privateMethod(this, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn).call(this, selection);
          const textLayer = anchorElement.closest(".textLayer");
          const boxes = this.getSelectionBoxes(textLayer);
          if (!boxes) {
            return;
          }
          selection.empty();
          const layer = __privateMethod(this, _AnnotationEditorUIManager_instances, getLayerForTextLayer_fn).call(this, textLayer);
          const isNoneMode = __privateGet(this, _mode) === AnnotationEditorType.NONE;
          const callback = () => {
            const editor = layer?.createAndAddNewEditor({
              x: 0,
              y: 0
            }, false, {
              methodOfCreation,
              boxes,
              anchorNode,
              anchorOffset,
              focusNode,
              focusOffset,
              text
            });
            if (isNoneMode) {
              this.showAllEditors("highlight", true, true);
            }
            if (comment) {
              editor?.editComment();
            }
          };
          if (isNoneMode) {
            this.switchToMode(AnnotationEditorType.HIGHLIGHT, callback);
            return;
          }
          callback();
        }
        commentSelection(methodOfCreation = "") {
          this.highlightSelection(methodOfCreation, true);
        }
        endCurrentEditing() {
          this.commitOrRemove();
          this.currentLayer?.endDrawingSession(false);
        }
        getAndRemoveDataFromAnnotationStorage(annotationId) {
          if (!__privateGet(this, _annotationStorage)) {
            return null;
          }
          const key = `${AnnotationEditorPrefix}${annotationId}`;
          const storedValue = __privateGet(this, _annotationStorage).getRawValue(key);
          if (storedValue) {
            __privateGet(this, _annotationStorage).remove(key);
          }
          return storedValue;
        }
        addToAnnotationStorage(editor) {
          if (!editor.isEmpty() && __privateGet(this, _annotationStorage) && !__privateGet(this, _annotationStorage).has(editor.id)) {
            __privateGet(this, _annotationStorage).setValue(editor.id, editor);
          }
        }
        a11yAlert(messageId, args = null) {
          const viewerAlert = __privateGet(this, _viewerAlert);
          if (!viewerAlert) {
            return;
          }
          viewerAlert.setAttribute("data-l10n-id", messageId);
          if (args) {
            viewerAlert.setAttribute("data-l10n-args", JSON.stringify(args));
          } else {
            viewerAlert.removeAttribute("data-l10n-args");
          }
        }
        blur() {
          this.isShiftKeyDown = false;
          if (__privateGet(this, _highlightWhenShiftUp)) {
            __privateSet(this, _highlightWhenShiftUp, false);
            __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
          }
          if (!this.hasSelection) {
            return;
          }
          const {
            activeElement
          } = document;
          for (const editor of __privateGet(this, _selectedEditors)) {
            if (editor.div.contains(activeElement)) {
              __privateSet(this, _lastActiveElement, [editor, activeElement]);
              editor._focusEventsAllowed = false;
              break;
            }
          }
        }
        focus() {
          if (!__privateGet(this, _lastActiveElement)) {
            return;
          }
          const [lastEditor, lastActiveElement] = __privateGet(this, _lastActiveElement);
          __privateSet(this, _lastActiveElement, null);
          lastActiveElement.addEventListener("focusin", () => {
            lastEditor._focusEventsAllowed = true;
          }, {
            once: true,
            signal: this._signal
          });
          lastActiveElement.focus();
        }
        addEditListeners() {
          __privateMethod(this, _AnnotationEditorUIManager_instances, addKeyboardManager_fn).call(this);
          this.setEditingState(true);
        }
        removeEditListeners() {
          __privateMethod(this, _AnnotationEditorUIManager_instances, removeKeyboardManager_fn).call(this);
          this.setEditingState(false);
        }
        dragOver(event) {
          for (const {
            type
          } of event.dataTransfer.items) {
            for (const editorType of __privateGet(this, _editorTypes)) {
              if (editorType.isHandlingMimeForPasting(type)) {
                event.dataTransfer.dropEffect = "copy";
                event.preventDefault();
                return;
              }
            }
          }
        }
        drop(event) {
          for (const item of event.dataTransfer.items) {
            for (const editorType of __privateGet(this, _editorTypes)) {
              if (editorType.isHandlingMimeForPasting(item.type)) {
                editorType.paste(item, this.currentLayer);
                event.preventDefault();
                return;
              }
            }
          }
        }
        copy(event) {
          event.preventDefault();
          __privateGet(this, _activeEditor)?.commitOrRemove();
          if (!this.hasSelection) {
            return;
          }
          const editors = [];
          for (const editor of __privateGet(this, _selectedEditors)) {
            const serialized = editor.serialize(true);
            if (serialized) {
              editors.push(serialized);
            }
          }
          if (editors.length === 0) {
            return;
          }
          event.clipboardData.setData("application/pdfjs", JSON.stringify(editors));
        }
        cut(event) {
          this.copy(event);
          this.delete();
        }
        async paste(event) {
          event.preventDefault();
          const {
            clipboardData
          } = event;
          for (const item of clipboardData.items) {
            for (const editorType of __privateGet(this, _editorTypes)) {
              if (editorType.isHandlingMimeForPasting(item.type)) {
                editorType.paste(item, this.currentLayer);
                return;
              }
            }
          }
          let data = clipboardData.getData("application/pdfjs");
          if (!data) {
            return;
          }
          try {
            data = JSON.parse(data);
          } catch (ex) {
            warn(`paste: "${ex.message}".`);
            return;
          }
          if (!Array.isArray(data)) {
            return;
          }
          this.unselectAll();
          const layer = this.currentLayer;
          try {
            const newEditors = [];
            for (const editor of data) {
              const deserializedEditor = await layer.deserialize(editor);
              if (!deserializedEditor) {
                return;
              }
              newEditors.push(deserializedEditor);
            }
            const cmd = () => {
              for (const editor of newEditors) {
                __privateMethod(this, _AnnotationEditorUIManager_instances, addEditorToLayer_fn).call(this, editor);
              }
              __privateMethod(this, _AnnotationEditorUIManager_instances, selectEditors_fn).call(this, newEditors);
            };
            const undo = () => {
              for (const editor of newEditors) {
                editor.remove();
              }
            };
            this.addCommands({
              cmd,
              undo,
              mustExec: true
            });
          } catch (ex) {
            warn(`paste: "${ex.message}".`);
          }
        }
        keydown(event) {
          if (!this.isShiftKeyDown && event.key === "Shift") {
            this.isShiftKeyDown = true;
          }
          if (__privateGet(this, _mode) !== AnnotationEditorType.NONE && !this.isEditorHandlingKeyboard) {
            _AnnotationEditorUIManager._keyboardManager.exec(this, event);
          }
        }
        keyup(event) {
          if (this.isShiftKeyDown && event.key === "Shift") {
            this.isShiftKeyDown = false;
            if (__privateGet(this, _highlightWhenShiftUp)) {
              __privateSet(this, _highlightWhenShiftUp, false);
              __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
            }
          }
        }
        onEditingAction({
          name
        }) {
          switch (name) {
            case "undo":
            case "redo":
            case "delete":
            case "selectAll":
              this[name]();
              break;
            case "highlightSelection":
              this.highlightSelection("context_menu");
              break;
            case "commentSelection":
              this.commentSelection("context_menu");
              break;
          }
        }
        updatePageIndex(oldPageIndex, newPageIndex) {
          for (const editor of this.getEditors(oldPageIndex)) {
            editor.pageIndex = newPageIndex;
          }
          const layer = __privateGet(this, _savedAllLayers).get(oldPageIndex);
          if (layer) {
            layer.pageIndex = newPageIndex;
            __privateGet(this, _allLayers).set(newPageIndex, layer);
            if (__privateGet(this, _isEnabled)) {
              layer.enable();
            } else {
              layer.disable();
            }
          }
        }
        startUpdatePages() {
          __privateSet(this, _savedAllLayers, new Map(__privateGet(this, _allLayers)));
          __privateGet(this, _allLayers).clear();
        }
        endUpdatePages() {
          __privateSet(this, _savedAllLayers, null);
        }
        clonePage(pageIndex, newPageIndex) {
          for (const editor of this.getEditors(pageIndex)) {
            const serialized = editor.serialize(editor.mode !== AnnotationEditorType.HIGHLIGHT);
            if (!serialized) {
              continue;
            }
            serialized.pageIndex = newPageIndex;
            serialized.id = this.getId();
            serialized.isClone = true;
            delete serialized.popupRef;
            __privateGet(this, _annotationStorage).setValue(serialized.id, serialized);
          }
        }
        findClonesForPage(layer) {
          const promises = [];
          const {
            pageIndex
          } = layer;
          for (const [id, editor] of __privateGet(this, _annotationStorage)) {
            if (editor.pageIndex === pageIndex && editor.isClone) {
              __privateGet(this, _annotationStorage).remove(id);
              promises.push(layer.deserialize(editor).then((deserializedEditor) => {
                if (deserializedEditor) {
                  deserializedEditor.isClone = true;
                  layer.addOrRebuild(deserializedEditor);
                }
              }));
            }
          }
          return Promise.all(promises);
        }
        setEditingState(isEditing) {
          if (isEditing) {
            __privateMethod(this, _AnnotationEditorUIManager_instances, addFocusManager_fn).call(this);
            __privateMethod(this, _AnnotationEditorUIManager_instances, addCopyPasteListeners_fn).call(this);
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
              isEditing: __privateGet(this, _mode) !== AnnotationEditorType.NONE,
              isEmpty: __privateMethod(this, _AnnotationEditorUIManager_instances, isEmpty_fn).call(this),
              hasSomethingToUndo: __privateGet(this, _commandManager).hasSomethingToUndo(),
              hasSomethingToRedo: __privateGet(this, _commandManager).hasSomethingToRedo(),
              hasSelectedEditor: false
            });
          } else {
            __privateMethod(this, _AnnotationEditorUIManager_instances, removeFocusManager_fn).call(this);
            __privateMethod(this, _AnnotationEditorUIManager_instances, removeCopyPasteListeners_fn).call(this);
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
              isEditing: false
            });
            this.disableUserSelect(false);
          }
        }
        registerEditorTypes(types) {
          if (__privateGet(this, _editorTypes)) {
            return;
          }
          __privateSet(this, _editorTypes, types);
          for (const editorType of __privateGet(this, _editorTypes)) {
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateUI_fn).call(this, editorType.defaultPropertiesToUpdate);
          }
        }
        getId() {
          return __privateGet(this, _idManager).id;
        }
        get currentLayer() {
          return __privateGet(this, _allLayers).get(__privateGet(this, _currentPageIndex));
        }
        getLayer(pageIndex) {
          return __privateGet(this, _allLayers).get(pageIndex);
        }
        get currentPageIndex() {
          return __privateGet(this, _currentPageIndex);
        }
        addLayer(layer) {
          __privateGet(this, _allLayers).set(layer.pageIndex, layer);
          if (__privateGet(this, _isEnabled)) {
            layer.enable();
          } else {
            layer.disable();
          }
        }
        removeLayer(layer) {
          __privateGet(this, _allLayers).delete(layer.pageIndex);
        }
        async updateMode(mode, editId = null, isFromUser = false, isFromKeyboard = false, mustEnterInEditMode = false, editComment = false) {
          if (__privateGet(this, _mode) === mode) {
            return;
          }
          if (__privateGet(this, _updateModeCapability)) {
            await __privateGet(this, _updateModeCapability).promise;
            if (!__privateGet(this, _updateModeCapability)) {
              return;
            }
          }
          __privateSet(this, _updateModeCapability, Promise.withResolvers());
          __privateGet(this, _currentDrawingSession)?.commitOrRemove();
          if (__privateGet(this, _mode) === AnnotationEditorType.POPUP) {
            __privateGet(this, _commentManager)?.hideSidebar();
          }
          __privateGet(this, _commentManager)?.destroyPopup();
          __privateSet(this, _mode, mode);
          if (mode === AnnotationEditorType.NONE) {
            this.setEditingState(false);
            __privateMethod(this, _AnnotationEditorUIManager_instances, disableAll_fn).call(this);
            for (const editor of __privateGet(this, _allEditors).values()) {
              editor.hideStandaloneCommentButton();
            }
            this._editorUndoBar?.hide();
            this.toggleComment(null);
            __privateGet(this, _updateModeCapability).resolve();
            return;
          }
          for (const editor of __privateGet(this, _allEditors).values()) {
            editor.addStandaloneCommentButton();
          }
          if (mode === AnnotationEditorType.SIGNATURE) {
            await __privateGet(this, _signatureManager)?.loadSignatures();
          }
          if (isFromUser) {
            CurrentPointers.clearPointerType();
          }
          this.setEditingState(true);
          await __privateMethod(this, _AnnotationEditorUIManager_instances, enableAll_fn).call(this);
          this.unselectAll();
          for (const layer of __privateGet(this, _allLayers).values()) {
            layer.updateMode(mode);
          }
          if (mode === AnnotationEditorType.POPUP) {
            __privateGet(this, _allEditableAnnotations) || __privateSet(this, _allEditableAnnotations, await __privateGet(this, _pdfDocument).getAnnotationsByType(new Set(__privateGet(this, _editorTypes).map((editorClass) => editorClass._editorType))));
            const elementIds = /* @__PURE__ */ new Set();
            const allComments = [];
            for (const editor of __privateGet(this, _allEditors).values()) {
              const {
                annotationElementId,
                hasComment,
                deleted
              } = editor;
              if (annotationElementId) {
                elementIds.add(annotationElementId);
              }
              if (hasComment && !deleted) {
                allComments.push(editor.getData());
              }
            }
            for (const annotation of __privateGet(this, _allEditableAnnotations)) {
              const {
                id,
                popupRef,
                contentsObj
              } = annotation;
              if (popupRef && contentsObj?.str && !elementIds.has(id) && !__privateGet(this, _deletedAnnotationsElementIds).has(id)) {
                allComments.push(annotation);
              }
            }
            __privateGet(this, _commentManager)?.showSidebar(allComments);
          }
          if (!editId) {
            if (isFromKeyboard) {
              this.addNewEditorFromKeyboard();
            }
            __privateGet(this, _updateModeCapability).resolve();
            return;
          }
          for (const editor of __privateGet(this, _allEditors).values()) {
            if (editor.uid === editId) {
              this.setSelected(editor);
              if (editComment) {
                editor.editComment();
              } else if (mustEnterInEditMode) {
                editor.enterInEditMode();
              } else {
                editor.focus();
              }
            } else {
              editor.unselect();
            }
          }
          __privateGet(this, _updateModeCapability).resolve();
        }
        addNewEditorFromKeyboard() {
          if (this.currentLayer.canCreateNewEmptyEditor()) {
            this.currentLayer.addNewEditor();
          }
        }
        updateToolbar(options) {
          if (options.mode === __privateGet(this, _mode)) {
            return;
          }
          this._eventBus.dispatch("switchannotationeditormode", {
            source: this,
            ...options
          });
        }
        updateParams(type, value) {
          if (!__privateGet(this, _editorTypes)) {
            return;
          }
          switch (type) {
            case AnnotationEditorParamsType.CREATE:
              this.currentLayer.addNewEditor(value);
              return;
            case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:
              this._eventBus.dispatch("reporttelemetry", {
                source: this,
                details: {
                  type: "editing",
                  data: {
                    type: "highlight",
                    action: "toggle_visibility"
                  }
                }
              });
              (__privateGet(this, _showAllStates) || __privateSet(this, _showAllStates, /* @__PURE__ */ new Map())).set(type, value);
              this.showAllEditors("highlight", value);
              break;
          }
          if (this.hasSelection) {
            for (const editor of __privateGet(this, _selectedEditors)) {
              editor.updateParams(type, value);
            }
          } else {
            for (const editorType of __privateGet(this, _editorTypes)) {
              editorType.updateDefaultParams(type, value);
            }
          }
        }
        showAllEditors(type, visible, updateButton = false) {
          for (const editor of __privateGet(this, _allEditors).values()) {
            if (editor.editorType === type) {
              editor.show(visible);
            }
          }
          const state = __privateGet(this, _showAllStates)?.get(AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL) ?? true;
          if (state !== visible) {
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateUI_fn).call(this, [[AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL, visible]]);
          }
        }
        enableWaiting(mustWait = false) {
          if (__privateGet(this, _isWaiting) === mustWait) {
            return;
          }
          __privateSet(this, _isWaiting, mustWait);
          for (const layer of __privateGet(this, _allLayers).values()) {
            if (mustWait) {
              layer.disableClick();
            } else {
              layer.enableClick();
            }
            layer.div.classList.toggle("waiting", mustWait);
          }
        }
        *getEditors(pageIndex) {
          for (const editor of __privateGet(this, _allEditors).values()) {
            if (editor.pageIndex === pageIndex) {
              yield editor;
            }
          }
        }
        getEditor(id) {
          return __privateGet(this, _allEditors).get(id);
        }
        addEditor(editor) {
          __privateGet(this, _allEditors).set(editor.id, editor);
        }
        removeEditor(editor) {
          if (editor.div.contains(document.activeElement)) {
            if (__privateGet(this, _focusMainContainerTimeoutId)) {
              clearTimeout(__privateGet(this, _focusMainContainerTimeoutId));
            }
            __privateSet(this, _focusMainContainerTimeoutId, setTimeout(() => {
              this.focusMainContainer();
              __privateSet(this, _focusMainContainerTimeoutId, null);
            }, 0));
          }
          __privateGet(this, _allEditors).delete(editor.id);
          if (editor.annotationElementId) {
            __privateGet(this, _missingCanvases)?.delete(editor.annotationElementId);
          }
          this.unselect(editor);
          if (!editor.annotationElementId || !__privateGet(this, _deletedAnnotationsElementIds).has(editor.annotationElementId)) {
            __privateGet(this, _annotationStorage)?.remove(editor.id);
          }
        }
        addDeletedAnnotationElement(editor) {
          __privateGet(this, _deletedAnnotationsElementIds).add(editor.annotationElementId);
          this.addChangedExistingAnnotation(editor);
          editor.deleted = true;
        }
        isDeletedAnnotationElement(annotationElementId) {
          return __privateGet(this, _deletedAnnotationsElementIds).has(annotationElementId);
        }
        removeDeletedAnnotationElement(editor) {
          __privateGet(this, _deletedAnnotationsElementIds).delete(editor.annotationElementId);
          this.removeChangedExistingAnnotation(editor);
          editor.deleted = false;
        }
        setActiveEditor(editor) {
          if (__privateGet(this, _activeEditor) === editor) {
            return;
          }
          __privateSet(this, _activeEditor, editor);
          if (editor) {
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateUI_fn).call(this, editor.propertiesToUpdate);
          }
        }
        updateUI(editor) {
          if (__privateGet(this, _AnnotationEditorUIManager_instances, lastSelectedEditor_get) === editor) {
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateUI_fn).call(this, editor.propertiesToUpdate);
          }
        }
        updateUIForDefaultProperties(editorType) {
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateUI_fn).call(this, editorType.defaultPropertiesToUpdate);
        }
        toggleSelected(editor) {
          if (__privateGet(this, _selectedEditors).has(editor)) {
            __privateGet(this, _selectedEditors).delete(editor);
            editor.unselect();
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
              hasSelectedEditor: this.hasSelection
            });
            return;
          }
          __privateGet(this, _selectedEditors).add(editor);
          editor.select();
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateUI_fn).call(this, editor.propertiesToUpdate);
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
            hasSelectedEditor: true
          });
        }
        setSelected(editor) {
          this.updateToolbar({
            mode: editor.mode,
            editId: editor.uid
          });
          __privateGet(this, _currentDrawingSession)?.commitOrRemove();
          for (const ed of __privateGet(this, _selectedEditors)) {
            if (ed !== editor) {
              ed.unselect();
            }
          }
          __privateGet(this, _commentManager)?.destroyPopup();
          __privateGet(this, _selectedEditors).clear();
          __privateGet(this, _selectedEditors).add(editor);
          editor.select();
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateUI_fn).call(this, editor.propertiesToUpdate);
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
            hasSelectedEditor: true
          });
        }
        get firstSelectedEditor() {
          return __privateGet(this, _selectedEditors).values().next().value;
        }
        unselect(editor) {
          editor.unselect();
          __privateGet(this, _selectedEditors).delete(editor);
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
            hasSelectedEditor: this.hasSelection
          });
        }
        get hasSelection() {
          return __privateGet(this, _selectedEditors).size !== 0;
        }
        get isEnterHandled() {
          return __privateGet(this, _selectedEditors).size === 1 && this.firstSelectedEditor.isEnterHandled;
        }
        undo() {
          __privateGet(this, _commandManager).undo();
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
            hasSomethingToUndo: __privateGet(this, _commandManager).hasSomethingToUndo(),
            hasSomethingToRedo: true,
            isEmpty: __privateMethod(this, _AnnotationEditorUIManager_instances, isEmpty_fn).call(this)
          });
          this._editorUndoBar?.hide();
        }
        redo() {
          __privateGet(this, _commandManager).redo();
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
            hasSomethingToUndo: true,
            hasSomethingToRedo: __privateGet(this, _commandManager).hasSomethingToRedo(),
            isEmpty: __privateMethod(this, _AnnotationEditorUIManager_instances, isEmpty_fn).call(this)
          });
        }
        addCommands(params) {
          __privateGet(this, _commandManager).add(params);
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
            hasSomethingToUndo: true,
            hasSomethingToRedo: false,
            isEmpty: __privateMethod(this, _AnnotationEditorUIManager_instances, isEmpty_fn).call(this)
          });
        }
        cleanUndoStack(type) {
          __privateGet(this, _commandManager).cleanType(type);
        }
        delete() {
          this.commitOrRemove();
          const drawingEditor = this.currentLayer?.endDrawingSession(true);
          if (!this.hasSelection && !drawingEditor) {
            return;
          }
          const editors = drawingEditor ? [drawingEditor] : [...__privateGet(this, _selectedEditors)];
          const cmd = () => {
            this._editorUndoBar?.show(undo, editors.length === 1 ? editors[0].editorType : editors.length);
            for (const editor of editors) {
              editor.remove();
            }
          };
          const undo = () => {
            for (const editor of editors) {
              __privateMethod(this, _AnnotationEditorUIManager_instances, addEditorToLayer_fn).call(this, editor);
            }
          };
          this.addCommands({
            cmd,
            undo,
            mustExec: true
          });
        }
        commitOrRemove() {
          __privateGet(this, _activeEditor)?.commitOrRemove();
        }
        hasSomethingToControl() {
          return __privateGet(this, _activeEditor) || this.hasSelection;
        }
        selectAll() {
          for (const editor of __privateGet(this, _selectedEditors)) {
            editor.commit();
          }
          __privateMethod(this, _AnnotationEditorUIManager_instances, selectEditors_fn).call(this, __privateGet(this, _allEditors).values());
        }
        unselectAll() {
          if (__privateGet(this, _activeEditor)) {
            __privateGet(this, _activeEditor).commitOrRemove();
            if (__privateGet(this, _mode) !== AnnotationEditorType.NONE) {
              return;
            }
          }
          if (__privateGet(this, _currentDrawingSession)?.commitOrRemove()) {
            return;
          }
          __privateGet(this, _commentManager)?.destroyPopup();
          if (!this.hasSelection) {
            return;
          }
          for (const editor of __privateGet(this, _selectedEditors)) {
            editor.unselect();
          }
          __privateGet(this, _selectedEditors).clear();
          __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
            hasSelectedEditor: false
          });
        }
        translateSelectedEditors(x, y, noCommit = false) {
          if (!noCommit) {
            this.commitOrRemove();
          }
          if (!this.hasSelection) {
            return;
          }
          __privateGet(this, _translation)[0] += x;
          __privateGet(this, _translation)[1] += y;
          const [totalX, totalY] = __privateGet(this, _translation);
          const editors = [...__privateGet(this, _selectedEditors)];
          const TIME_TO_WAIT = 1e3;
          if (__privateGet(this, _translationTimeoutId)) {
            clearTimeout(__privateGet(this, _translationTimeoutId));
          }
          __privateSet(this, _translationTimeoutId, setTimeout(() => {
            __privateSet(this, _translationTimeoutId, null);
            __privateGet(this, _translation)[0] = __privateGet(this, _translation)[1] = 0;
            this.addCommands({
              cmd: () => {
                for (const editor of editors) {
                  if (__privateGet(this, _allEditors).has(editor.id)) {
                    editor.translateInPage(totalX, totalY);
                    editor.translationDone();
                  }
                }
              },
              undo: () => {
                for (const editor of editors) {
                  if (__privateGet(this, _allEditors).has(editor.id)) {
                    editor.translateInPage(-totalX, -totalY);
                    editor.translationDone();
                  }
                }
              },
              mustExec: false
            });
          }, TIME_TO_WAIT));
          for (const editor of editors) {
            editor.translateInPage(x, y);
            editor.translationDone();
          }
        }
        setUpDragSession() {
          if (!this.hasSelection) {
            return;
          }
          this.disableUserSelect(true);
          __privateSet(this, _draggingEditors, /* @__PURE__ */ new Map());
          for (const editor of __privateGet(this, _selectedEditors)) {
            __privateGet(this, _draggingEditors).set(editor, {
              savedX: editor.x,
              savedY: editor.y,
              savedPageIndex: editor.pageIndex,
              newX: 0,
              newY: 0,
              newPageIndex: -1
            });
          }
        }
        endDragSession() {
          if (!__privateGet(this, _draggingEditors)) {
            return false;
          }
          this.disableUserSelect(false);
          const map2 = __privateGet(this, _draggingEditors);
          __privateSet(this, _draggingEditors, null);
          let mustBeAddedInUndoStack = false;
          for (const [{
            x,
            y,
            pageIndex
          }, value] of map2) {
            value.newX = x;
            value.newY = y;
            value.newPageIndex = pageIndex;
            mustBeAddedInUndoStack || (mustBeAddedInUndoStack = x !== value.savedX || y !== value.savedY || pageIndex !== value.savedPageIndex);
          }
          if (!mustBeAddedInUndoStack) {
            return false;
          }
          const move = (editor, x, y, pageIndex) => {
            if (__privateGet(this, _allEditors).has(editor.id)) {
              const parent = __privateGet(this, _allLayers).get(pageIndex);
              if (parent) {
                editor._setParentAndPosition(parent, x, y);
              } else {
                editor.pageIndex = pageIndex;
                editor.x = x;
                editor.y = y;
              }
            }
          };
          this.addCommands({
            cmd: () => {
              for (const [editor, {
                newX,
                newY,
                newPageIndex
              }] of map2) {
                move(editor, newX, newY, newPageIndex);
              }
            },
            undo: () => {
              for (const [editor, {
                savedX,
                savedY,
                savedPageIndex
              }] of map2) {
                move(editor, savedX, savedY, savedPageIndex);
              }
            },
            mustExec: true
          });
          return true;
        }
        dragSelectedEditors(tx, ty) {
          if (!__privateGet(this, _draggingEditors)) {
            return;
          }
          for (const editor of __privateGet(this, _draggingEditors).keys()) {
            editor.drag(tx, ty);
          }
        }
        rebuild(editor) {
          if (editor.parent === null) {
            const parent = this.getLayer(editor.pageIndex);
            if (parent) {
              parent.changeParent(editor);
              parent.addOrRebuild(editor);
            } else {
              this.addEditor(editor);
              this.addToAnnotationStorage(editor);
              editor.rebuild();
            }
          } else {
            editor.parent.addOrRebuild(editor);
          }
        }
        get isEditorHandlingKeyboard() {
          return this.getActive()?.shouldGetKeyboardEvents() || __privateGet(this, _selectedEditors).size === 1 && this.firstSelectedEditor.shouldGetKeyboardEvents();
        }
        isActive(editor) {
          return __privateGet(this, _activeEditor) === editor;
        }
        getActive() {
          return __privateGet(this, _activeEditor);
        }
        getMode() {
          return __privateGet(this, _mode);
        }
        isEditingMode() {
          return __privateGet(this, _mode) !== AnnotationEditorType.NONE;
        }
        get imageManager() {
          return shadow(this, "imageManager", new ImageManager());
        }
        getSelectionBoxes(textLayer) {
          if (!textLayer) {
            return null;
          }
          const selection = document.getSelection();
          for (let i = 0, ii = selection.rangeCount; i < ii; i++) {
            if (!textLayer.contains(selection.getRangeAt(i).commonAncestorContainer)) {
              return null;
            }
          }
          const {
            x: layerX,
            y: layerY,
            width: parentWidth,
            height: parentHeight
          } = textLayer.getBoundingClientRect();
          let rotator;
          switch (textLayer.getAttribute("data-main-rotation")) {
            case "90":
              rotator = (x, y, w, h) => ({
                x: (y - layerY) / parentHeight,
                y: 1 - (x + w - layerX) / parentWidth,
                width: h / parentHeight,
                height: w / parentWidth
              });
              break;
            case "180":
              rotator = (x, y, w, h) => ({
                x: 1 - (x + w - layerX) / parentWidth,
                y: 1 - (y + h - layerY) / parentHeight,
                width: w / parentWidth,
                height: h / parentHeight
              });
              break;
            case "270":
              rotator = (x, y, w, h) => ({
                x: 1 - (y + h - layerY) / parentHeight,
                y: (x - layerX) / parentWidth,
                width: h / parentHeight,
                height: w / parentWidth
              });
              break;
            default:
              rotator = (x, y, w, h) => ({
                x: (x - layerX) / parentWidth,
                y: (y - layerY) / parentHeight,
                width: w / parentWidth,
                height: h / parentHeight
              });
              break;
          }
          const boxes = [];
          for (let i = 0, ii = selection.rangeCount; i < ii; i++) {
            const range2 = selection.getRangeAt(i);
            if (range2.collapsed) {
              continue;
            }
            for (const {
              x,
              y,
              width,
              height
            } of range2.getClientRects()) {
              if (width === 0 || height === 0) {
                continue;
              }
              boxes.push(rotator(x, y, width, height));
            }
          }
          return boxes.length === 0 ? null : boxes;
        }
        addChangedExistingAnnotation({
          annotationElementId,
          id
        }) {
          (__privateGet(this, _changedExistingAnnotations) || __privateSet(this, _changedExistingAnnotations, /* @__PURE__ */ new Map())).set(annotationElementId, id);
        }
        removeChangedExistingAnnotation({
          annotationElementId
        }) {
          __privateGet(this, _changedExistingAnnotations)?.delete(annotationElementId);
        }
        renderAnnotationElement(annotation) {
          const editorId = __privateGet(this, _changedExistingAnnotations)?.get(annotation.data.id);
          if (!editorId) {
            return;
          }
          const editor = __privateGet(this, _annotationStorage).getRawValue(editorId);
          if (!editor) {
            return;
          }
          if (__privateGet(this, _mode) === AnnotationEditorType.NONE && !editor.hasBeenModified) {
            return;
          }
          editor.renderAnnotationElement(annotation);
        }
        setMissingCanvas(annotationId, annotationElementId, canvas) {
          const editor = __privateGet(this, _missingCanvases)?.get(annotationId);
          if (!editor) {
            return;
          }
          editor.setCanvas(annotationElementId, canvas);
          __privateGet(this, _missingCanvases).delete(annotationId);
        }
        addMissingCanvas(annotationId, editor) {
          (__privateGet(this, _missingCanvases) || __privateSet(this, _missingCanvases, /* @__PURE__ */ new Map())).set(annotationId, editor);
        }
      };
      _abortController = new WeakMap();
      _activeEditor = new WeakMap();
      _allEditableAnnotations = new WeakMap();
      _allEditors = new WeakMap();
      _allLayers = new WeakMap();
      _savedAllLayers = new WeakMap();
      _altTextManager = new WeakMap();
      _annotationStorage = new WeakMap();
      _changedExistingAnnotations = new WeakMap();
      _commandManager = new WeakMap();
      _commentManager = new WeakMap();
      _copyPasteAC = new WeakMap();
      _currentDrawingSession = new WeakMap();
      _currentPageIndex = new WeakMap();
      _deletedAnnotationsElementIds = new WeakMap();
      _draggingEditors = new WeakMap();
      _editorTypes = new WeakMap();
      _editorsToRescale = new WeakMap();
      _enableHighlightFloatingButton = new WeakMap();
      _enableUpdatedAddImage = new WeakMap();
      _enableNewAltTextWhenAddingImage = new WeakMap();
      _filterFactory = new WeakMap();
      _focusMainContainerTimeoutId = new WeakMap();
      _focusManagerAC = new WeakMap();
      _highlightColors = new WeakMap();
      _highlightWhenShiftUp = new WeakMap();
      _floatingToolbar = new WeakMap();
      _idManager = new WeakMap();
      _isEnabled = new WeakMap();
      _isPointerDown = new WeakMap();
      _isWaiting = new WeakMap();
      _keyboardManagerAC = new WeakMap();
      _lastActiveElement = new WeakMap();
      _mainHighlightColorPicker = new WeakMap();
      _missingCanvases = new WeakMap();
      _mlManager = new WeakMap();
      _mode = new WeakMap();
      _selectedEditors = new WeakMap();
      _selectedTextNode = new WeakMap();
      _signatureManager = new WeakMap();
      _pageColors = new WeakMap();
      _showAllStates = new WeakMap();
      _pdfDocument = new WeakMap();
      _previousStates = new WeakMap();
      _translation = new WeakMap();
      _translationTimeoutId = new WeakMap();
      _container = new WeakMap();
      _viewer = new WeakMap();
      _viewerAlert = new WeakMap();
      _updateModeCapability = new WeakMap();
      _AnnotationEditorUIManager_instances = new WeakSet();
      getAnchorElementForSelection_fn = function({
        anchorNode
      }) {
        return anchorNode.nodeType === Node.TEXT_NODE ? anchorNode.parentElement : anchorNode;
      };
      getLayerForTextLayer_fn = function(textLayer) {
        const {
          currentLayer
        } = this;
        if (currentLayer.hasTextLayer(textLayer)) {
          return currentLayer;
        }
        for (const layer of __privateGet(this, _allLayers).values()) {
          if (layer.hasTextLayer(textLayer)) {
            return layer;
          }
        }
        return null;
      };
      displayFloatingToolbar_fn = function() {
        const selection = document.getSelection();
        if (!selection || selection.isCollapsed) {
          return;
        }
        const anchorElement = __privateMethod(this, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn).call(this, selection);
        const textLayer = anchorElement.closest(".textLayer");
        const boxes = this.getSelectionBoxes(textLayer);
        if (!boxes) {
          return;
        }
        __privateGet(this, _floatingToolbar) || __privateSet(this, _floatingToolbar, new FloatingToolbar(this));
        __privateGet(this, _floatingToolbar).show(textLayer, boxes, this.direction === "ltr");
      };
      selectionChange_fn = function() {
        const selection = document.getSelection();
        if (!selection || selection.isCollapsed) {
          if (__privateGet(this, _selectedTextNode)) {
            __privateGet(this, _floatingToolbar)?.hide();
            __privateSet(this, _selectedTextNode, null);
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
              hasSelectedText: false
            });
          }
          return;
        }
        const {
          anchorNode
        } = selection;
        if (anchorNode === __privateGet(this, _selectedTextNode)) {
          return;
        }
        const anchorElement = __privateMethod(this, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn).call(this, selection);
        const textLayer = anchorElement.closest(".textLayer");
        if (!textLayer) {
          if (__privateGet(this, _selectedTextNode)) {
            __privateGet(this, _floatingToolbar)?.hide();
            __privateSet(this, _selectedTextNode, null);
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
              hasSelectedText: false
            });
          }
          return;
        }
        __privateGet(this, _floatingToolbar)?.hide();
        __privateSet(this, _selectedTextNode, anchorNode);
        __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
          hasSelectedText: true
        });
        if (__privateGet(this, _mode) !== AnnotationEditorType.HIGHLIGHT && __privateGet(this, _mode) !== AnnotationEditorType.NONE) {
          return;
        }
        if (__privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT) {
          this.showAllEditors("highlight", true, true);
        }
        __privateSet(this, _highlightWhenShiftUp, this.isShiftKeyDown);
        if (!this.isShiftKeyDown) {
          const activeLayer = __privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT ? __privateMethod(this, _AnnotationEditorUIManager_instances, getLayerForTextLayer_fn).call(this, textLayer) : null;
          activeLayer?.toggleDrawing();
          if (__privateGet(this, _isPointerDown)) {
            const ac = new AbortController();
            const signal = this.combinedSignal(ac);
            const pointerup = (e) => {
              if (e.type === "pointerup" && e.button !== 0) {
                return;
              }
              ac.abort();
              activeLayer?.toggleDrawing(true);
              if (e.type === "pointerup") {
                __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
              }
            };
            window.addEventListener("pointerup", pointerup, {
              signal
            });
            window.addEventListener("blur", pointerup, {
              signal
            });
          } else {
            activeLayer?.toggleDrawing(true);
            __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
          }
        }
      };
      onSelectEnd_fn = function(methodOfCreation = "") {
        if (__privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT) {
          this.highlightSelection(methodOfCreation);
        } else if (__privateGet(this, _enableHighlightFloatingButton)) {
          __privateMethod(this, _AnnotationEditorUIManager_instances, displayFloatingToolbar_fn).call(this);
        }
      };
      addSelectionListener_fn = function() {
        document.addEventListener("selectionchange", __privateMethod(this, _AnnotationEditorUIManager_instances, selectionChange_fn).bind(this), {
          signal: this._signal
        });
      };
      addFocusManager_fn = function() {
        if (__privateGet(this, _focusManagerAC)) {
          return;
        }
        __privateSet(this, _focusManagerAC, new AbortController());
        const signal = this.combinedSignal(__privateGet(this, _focusManagerAC));
        window.addEventListener("focus", this.focus.bind(this), {
          signal
        });
        window.addEventListener("blur", this.blur.bind(this), {
          signal
        });
      };
      removeFocusManager_fn = function() {
        __privateGet(this, _focusManagerAC)?.abort();
        __privateSet(this, _focusManagerAC, null);
      };
      addKeyboardManager_fn = function() {
        if (__privateGet(this, _keyboardManagerAC)) {
          return;
        }
        __privateSet(this, _keyboardManagerAC, new AbortController());
        const signal = this.combinedSignal(__privateGet(this, _keyboardManagerAC));
        window.addEventListener("keydown", this.keydown.bind(this), {
          signal
        });
        window.addEventListener("keyup", this.keyup.bind(this), {
          signal
        });
      };
      removeKeyboardManager_fn = function() {
        __privateGet(this, _keyboardManagerAC)?.abort();
        __privateSet(this, _keyboardManagerAC, null);
      };
      addCopyPasteListeners_fn = function() {
        if (__privateGet(this, _copyPasteAC)) {
          return;
        }
        __privateSet(this, _copyPasteAC, new AbortController());
        const signal = this.combinedSignal(__privateGet(this, _copyPasteAC));
        document.addEventListener("copy", this.copy.bind(this), {
          signal
        });
        document.addEventListener("cut", this.cut.bind(this), {
          signal
        });
        document.addEventListener("paste", this.paste.bind(this), {
          signal
        });
      };
      removeCopyPasteListeners_fn = function() {
        __privateGet(this, _copyPasteAC)?.abort();
        __privateSet(this, _copyPasteAC, null);
      };
      addDragAndDropListeners_fn = function() {
        const signal = this._signal;
        document.addEventListener("dragover", this.dragOver.bind(this), {
          signal
        });
        document.addEventListener("drop", this.drop.bind(this), {
          signal
        });
      };
      dispatchUpdateStates_fn = function(details) {
        const hasChanged = Object.entries(details).some(([key, value]) => __privateGet(this, _previousStates)[key] !== value);
        if (hasChanged) {
          this._eventBus.dispatch("editingstateschanged", {
            source: this,
            details: Object.assign(__privateGet(this, _previousStates), details)
          });
          if (__privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT && details.hasSelectedEditor === false) {
            __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateUI_fn).call(this, [[AnnotationEditorParamsType.HIGHLIGHT_FREE, true]]);
          }
        }
      };
      dispatchUpdateUI_fn = function(details) {
        this._eventBus.dispatch("annotationeditorparamschanged", {
          source: this,
          details
        });
      };
      enableAll_fn = async function() {
        if (!__privateGet(this, _isEnabled)) {
          __privateSet(this, _isEnabled, true);
          const promises = [];
          for (const layer of __privateGet(this, _allLayers).values()) {
            promises.push(layer.enable());
          }
          await Promise.all(promises);
          for (const editor of __privateGet(this, _allEditors).values()) {
            editor.enable();
          }
        }
      };
      disableAll_fn = function() {
        this.unselectAll();
        if (__privateGet(this, _isEnabled)) {
          __privateSet(this, _isEnabled, false);
          for (const layer of __privateGet(this, _allLayers).values()) {
            layer.disable();
          }
          for (const editor of __privateGet(this, _allEditors).values()) {
            editor.disable();
          }
        }
      };
      addEditorToLayer_fn = function(editor) {
        const layer = __privateGet(this, _allLayers).get(editor.pageIndex);
        if (layer) {
          layer.addOrRebuild(editor);
        } else {
          this.addEditor(editor);
          this.addToAnnotationStorage(editor);
        }
      };
      lastSelectedEditor_get = function() {
        let ed = null;
        for (ed of __privateGet(this, _selectedEditors)) {
        }
        return ed;
      };
      isEmpty_fn = function() {
        if (__privateGet(this, _allEditors).size === 0) {
          return true;
        }
        if (__privateGet(this, _allEditors).size === 1) {
          for (const editor of __privateGet(this, _allEditors).values()) {
            return editor.isEmpty();
          }
        }
        return false;
      };
      selectEditors_fn = function(editors) {
        for (const editor of __privateGet(this, _selectedEditors)) {
          editor.unselect();
        }
        __privateGet(this, _selectedEditors).clear();
        for (const editor of editors) {
          if (editor.isEmpty()) {
            continue;
          }
          __privateGet(this, _selectedEditors).add(editor);
          editor.select();
        }
        __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
          hasSelectedEditor: this.hasSelection
        });
      };
      __publicField(_AnnotationEditorUIManager, "TRANSLATE_SMALL", 1);
      __publicField(_AnnotationEditorUIManager, "TRANSLATE_BIG", 10);
      AnnotationEditorUIManager = _AnnotationEditorUIManager;
      _AltText = class _AltText {
        constructor(editor) {
          __privateAdd(this, _AltText_instances);
          __privateAdd(this, _altText2, null);
          __privateAdd(this, _altTextDecorative, false);
          __privateAdd(this, _altTextButton, null);
          __privateAdd(this, _altTextButtonLabel, null);
          __privateAdd(this, _altTextTooltip, null);
          __privateAdd(this, _altTextTooltipTimeout, null);
          __privateAdd(this, _altTextWasFromKeyBoard, false);
          __privateAdd(this, _badge, null);
          __privateAdd(this, _editor2, null);
          __privateAdd(this, _guessedText, null);
          __privateAdd(this, _textWithDisclaimer, null);
          __privateAdd(this, _useNewAltTextFlow, false);
          __privateSet(this, _editor2, editor);
          __privateSet(this, _useNewAltTextFlow, editor._uiManager.useNewAltTextFlow);
          __privateGet(_AltText, _l10nNewButton) || __privateSet(_AltText, _l10nNewButton, Object.freeze({
            added: "pdfjs-editor-new-alt-text-added-button",
            "added-label": "pdfjs-editor-new-alt-text-added-button-label",
            missing: "pdfjs-editor-new-alt-text-missing-button",
            "missing-label": "pdfjs-editor-new-alt-text-missing-button-label",
            review: "pdfjs-editor-new-alt-text-to-review-button",
            "review-label": "pdfjs-editor-new-alt-text-to-review-button-label"
          }));
        }
        static initialize(l10n) {
          _AltText._l10n ?? (_AltText._l10n = l10n);
        }
        async render() {
          const altText = __privateSet(this, _altTextButton, document.createElement("button"));
          altText.className = "altText";
          altText.tabIndex = "0";
          const label = __privateSet(this, _altTextButtonLabel, document.createElement("span"));
          altText.append(label);
          if (__privateGet(this, _useNewAltTextFlow)) {
            altText.classList.add("new");
            altText.setAttribute("data-l10n-id", __privateGet(_AltText, _l10nNewButton).missing);
            label.setAttribute("data-l10n-id", __privateGet(_AltText, _l10nNewButton)["missing-label"]);
          } else {
            altText.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button");
            label.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button-label");
          }
          const signal = __privateGet(this, _editor2)._uiManager._signal;
          altText.addEventListener("contextmenu", noContextMenu, {
            signal
          });
          altText.addEventListener("pointerdown", (event) => event.stopPropagation(), {
            signal
          });
          const onClick = (event) => {
            event.preventDefault();
            __privateGet(this, _editor2)._uiManager.editAltText(__privateGet(this, _editor2));
            if (__privateGet(this, _useNewAltTextFlow)) {
              __privateGet(this, _editor2)._reportTelemetry({
                action: "pdfjs.image.alt_text.image_status_label_clicked",
                data: {
                  label: __privateGet(this, _AltText_instances, label_get)
                }
              });
            }
          };
          altText.addEventListener("click", onClick, {
            capture: true,
            signal
          });
          altText.addEventListener("keydown", (event) => {
            if (event.target === altText && event.key === "Enter") {
              __privateSet(this, _altTextWasFromKeyBoard, true);
              onClick(event);
            }
          }, {
            signal
          });
          await __privateMethod(this, _AltText_instances, setState_fn).call(this);
          return altText;
        }
        finish() {
          if (!__privateGet(this, _altTextButton)) {
            return;
          }
          __privateGet(this, _altTextButton).focus({
            focusVisible: __privateGet(this, _altTextWasFromKeyBoard)
          });
          __privateSet(this, _altTextWasFromKeyBoard, false);
        }
        isEmpty() {
          if (__privateGet(this, _useNewAltTextFlow)) {
            return __privateGet(this, _altText2) === null;
          }
          return !__privateGet(this, _altText2) && !__privateGet(this, _altTextDecorative);
        }
        hasData() {
          if (__privateGet(this, _useNewAltTextFlow)) {
            return __privateGet(this, _altText2) !== null || !!__privateGet(this, _guessedText);
          }
          return this.isEmpty();
        }
        get guessedText() {
          return __privateGet(this, _guessedText);
        }
        async setGuessedText(guessedText) {
          if (__privateGet(this, _altText2) !== null) {
            return;
          }
          __privateSet(this, _guessedText, guessedText);
          __privateSet(this, _textWithDisclaimer, await _AltText._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer", {
            generatedAltText: guessedText
          }));
          __privateMethod(this, _AltText_instances, setState_fn).call(this);
        }
        toggleAltTextBadge(visibility = false) {
          if (!__privateGet(this, _useNewAltTextFlow) || __privateGet(this, _altText2)) {
            __privateGet(this, _badge)?.remove();
            __privateSet(this, _badge, null);
            return;
          }
          if (!__privateGet(this, _badge)) {
            const badge = __privateSet(this, _badge, document.createElement("div"));
            badge.className = "noAltTextBadge";
            __privateGet(this, _editor2).div.append(badge);
          }
          __privateGet(this, _badge).classList.toggle("hidden", !visibility);
        }
        serialize(isForCopying) {
          let altText = __privateGet(this, _altText2);
          if (!isForCopying && __privateGet(this, _guessedText) === altText) {
            altText = __privateGet(this, _textWithDisclaimer);
          }
          return {
            altText,
            decorative: __privateGet(this, _altTextDecorative),
            guessedText: __privateGet(this, _guessedText),
            textWithDisclaimer: __privateGet(this, _textWithDisclaimer)
          };
        }
        get data() {
          return {
            altText: __privateGet(this, _altText2),
            decorative: __privateGet(this, _altTextDecorative)
          };
        }
        set data({
          altText,
          decorative,
          guessedText,
          textWithDisclaimer,
          cancel = false
        }) {
          if (guessedText) {
            __privateSet(this, _guessedText, guessedText);
            __privateSet(this, _textWithDisclaimer, textWithDisclaimer);
          }
          if (__privateGet(this, _altText2) === altText && __privateGet(this, _altTextDecorative) === decorative) {
            return;
          }
          if (!cancel) {
            __privateSet(this, _altText2, altText);
            __privateSet(this, _altTextDecorative, decorative);
          }
          __privateMethod(this, _AltText_instances, setState_fn).call(this);
        }
        toggle(enabled = false) {
          if (!__privateGet(this, _altTextButton)) {
            return;
          }
          if (!enabled && __privateGet(this, _altTextTooltipTimeout)) {
            clearTimeout(__privateGet(this, _altTextTooltipTimeout));
            __privateSet(this, _altTextTooltipTimeout, null);
          }
          __privateGet(this, _altTextButton).disabled = !enabled;
        }
        shown() {
          __privateGet(this, _editor2)._reportTelemetry({
            action: "pdfjs.image.alt_text.image_status_label_displayed",
            data: {
              label: __privateGet(this, _AltText_instances, label_get)
            }
          });
        }
        destroy() {
          __privateGet(this, _altTextButton)?.remove();
          __privateSet(this, _altTextButton, null);
          __privateSet(this, _altTextButtonLabel, null);
          __privateSet(this, _altTextTooltip, null);
          __privateGet(this, _badge)?.remove();
          __privateSet(this, _badge, null);
        }
      };
      _altText2 = new WeakMap();
      _altTextDecorative = new WeakMap();
      _altTextButton = new WeakMap();
      _altTextButtonLabel = new WeakMap();
      _altTextTooltip = new WeakMap();
      _altTextTooltipTimeout = new WeakMap();
      _altTextWasFromKeyBoard = new WeakMap();
      _badge = new WeakMap();
      _editor2 = new WeakMap();
      _guessedText = new WeakMap();
      _textWithDisclaimer = new WeakMap();
      _useNewAltTextFlow = new WeakMap();
      _l10nNewButton = new WeakMap();
      _AltText_instances = new WeakSet();
      label_get = function() {
        return __privateGet(this, _altText2) && "added" || __privateGet(this, _altText2) === null && this.guessedText && "review" || "missing";
      };
      setState_fn = async function() {
        const button = __privateGet(this, _altTextButton);
        if (!button) {
          return;
        }
        if (__privateGet(this, _useNewAltTextFlow)) {
          button.classList.toggle("done", !!__privateGet(this, _altText2));
          button.setAttribute("data-l10n-id", __privateGet(_AltText, _l10nNewButton)[__privateGet(this, _AltText_instances, label_get)]);
          __privateGet(this, _altTextButtonLabel)?.setAttribute("data-l10n-id", __privateGet(_AltText, _l10nNewButton)[`${__privateGet(this, _AltText_instances, label_get)}-label`]);
          if (!__privateGet(this, _altText2)) {
            __privateGet(this, _altTextTooltip)?.remove();
            return;
          }
        } else {
          if (!__privateGet(this, _altText2) && !__privateGet(this, _altTextDecorative)) {
            button.classList.remove("done");
            __privateGet(this, _altTextTooltip)?.remove();
            return;
          }
          button.classList.add("done");
          button.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-edit-button");
        }
        let tooltip = __privateGet(this, _altTextTooltip);
        if (!tooltip) {
          __privateSet(this, _altTextTooltip, tooltip = document.createElement("span"));
          tooltip.className = "tooltip";
          tooltip.setAttribute("role", "tooltip");
          tooltip.id = `alt-text-tooltip-${__privateGet(this, _editor2).id}`;
          const DELAY_TO_SHOW_TOOLTIP = 100;
          const signal = __privateGet(this, _editor2)._uiManager._signal;
          signal.addEventListener("abort", () => {
            clearTimeout(__privateGet(this, _altTextTooltipTimeout));
            __privateSet(this, _altTextTooltipTimeout, null);
          }, {
            once: true
          });
          button.addEventListener("mouseenter", () => {
            __privateSet(this, _altTextTooltipTimeout, setTimeout(() => {
              __privateSet(this, _altTextTooltipTimeout, null);
              __privateGet(this, _altTextTooltip).classList.add("show");
              __privateGet(this, _editor2)._reportTelemetry({
                action: "alt_text_tooltip"
              });
            }, DELAY_TO_SHOW_TOOLTIP));
          }, {
            signal
          });
          button.addEventListener("mouseleave", () => {
            if (__privateGet(this, _altTextTooltipTimeout)) {
              clearTimeout(__privateGet(this, _altTextTooltipTimeout));
              __privateSet(this, _altTextTooltipTimeout, null);
            }
            __privateGet(this, _altTextTooltip)?.classList.remove("show");
          }, {
            signal
          });
        }
        if (__privateGet(this, _altTextDecorative)) {
          tooltip.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-decorative-tooltip");
        } else {
          tooltip.removeAttribute("data-l10n-id");
          tooltip.textContent = __privateGet(this, _altText2);
        }
        if (!tooltip.parentNode) {
          button.append(tooltip);
        }
        const element = __privateGet(this, _editor2).getElementForAltText();
        element?.setAttribute("aria-describedby", tooltip.id);
      };
      __privateAdd(_AltText, _l10nNewButton, null);
      __publicField(_AltText, "_l10n", null);
      AltText = _AltText;
      Comment = class {
        constructor(editor) {
          __privateAdd(this, _Comment_instances);
          __privateAdd(this, _commentStandaloneButton, null);
          __privateAdd(this, _commentToolbarButton, null);
          __privateAdd(this, _commentWasFromKeyBoard, false);
          __privateAdd(this, _editor3, null);
          __privateAdd(this, _initialText, null);
          __privateAdd(this, _richText, null);
          __privateAdd(this, _text, null);
          __privateAdd(this, _date, null);
          __privateAdd(this, _deleted, false);
          __privateAdd(this, _popupPosition, null);
          __privateSet(this, _editor3, editor);
        }
        renderForToolbar() {
          const button = __privateSet(this, _commentToolbarButton, document.createElement("button"));
          button.className = "comment";
          return __privateMethod(this, _Comment_instances, render_fn2).call(this, button, false);
        }
        renderForStandalone() {
          const button = __privateSet(this, _commentStandaloneButton, document.createElement("button"));
          button.className = "annotationCommentButton";
          const position = __privateGet(this, _editor3).commentButtonPosition;
          if (position) {
            const {
              style
            } = button;
            style.insetInlineEnd = `calc(${100 * (__privateGet(this, _editor3)._uiManager.direction === "ltr" ? 1 - position[0] : position[0])}% - var(--comment-button-dim))`;
            style.top = `calc(${100 * position[1]}% - var(--comment-button-dim))`;
            const color = __privateGet(this, _editor3).commentButtonColor;
            if (color) {
              style.backgroundColor = color;
            }
          }
          return __privateMethod(this, _Comment_instances, render_fn2).call(this, button, true);
        }
        focusButton() {
          setTimeout(() => {
            (__privateGet(this, _commentStandaloneButton) ?? __privateGet(this, _commentToolbarButton))?.focus();
          }, 0);
        }
        onUpdatedColor() {
          if (!__privateGet(this, _commentStandaloneButton)) {
            return;
          }
          const color = __privateGet(this, _editor3).commentButtonColor;
          if (color) {
            __privateGet(this, _commentStandaloneButton).style.backgroundColor = color;
          }
          __privateGet(this, _editor3)._uiManager.updatePopupColor(__privateGet(this, _editor3));
        }
        get commentButtonWidth() {
          return (__privateGet(this, _commentStandaloneButton)?.getBoundingClientRect().width ?? 0) / __privateGet(this, _editor3).parent.boundingClientRect.width;
        }
        get commentPopupPositionInLayer() {
          if (__privateGet(this, _popupPosition)) {
            return __privateGet(this, _popupPosition);
          }
          if (!__privateGet(this, _commentStandaloneButton)) {
            return null;
          }
          const {
            x,
            y,
            height
          } = __privateGet(this, _commentStandaloneButton).getBoundingClientRect();
          const {
            x: parentX,
            y: parentY,
            width: parentWidth,
            height: parentHeight
          } = __privateGet(this, _editor3).parent.boundingClientRect;
          return [(x - parentX) / parentWidth, (y + height - parentY) / parentHeight];
        }
        set commentPopupPositionInLayer(pos) {
          __privateSet(this, _popupPosition, pos);
        }
        hasDefaultPopupPosition() {
          return __privateGet(this, _popupPosition) === null;
        }
        removeStandaloneCommentButton() {
          __privateGet(this, _commentStandaloneButton)?.remove();
          __privateSet(this, _commentStandaloneButton, null);
        }
        removeToolbarCommentButton() {
          __privateGet(this, _commentToolbarButton)?.remove();
          __privateSet(this, _commentToolbarButton, null);
        }
        setCommentButtonStates({
          selected,
          hasPopup
        }) {
          if (!__privateGet(this, _commentStandaloneButton)) {
            return;
          }
          __privateGet(this, _commentStandaloneButton).classList.toggle("selected", selected);
          __privateGet(this, _commentStandaloneButton).ariaExpanded = hasPopup;
        }
        edit(options) {
          const position = this.commentPopupPositionInLayer;
          let posX, posY;
          if (position) {
            [posX, posY] = position;
          } else {
            [posX, posY] = __privateGet(this, _editor3).commentButtonPosition;
            const {
              width,
              height,
              x,
              y
            } = __privateGet(this, _editor3);
            posX = x + posX * width;
            posY = y + posY * height;
          }
          const parentDimensions = __privateGet(this, _editor3).parent.boundingClientRect;
          const {
            x: parentX,
            y: parentY,
            width: parentWidth,
            height: parentHeight
          } = parentDimensions;
          __privateGet(this, _editor3)._uiManager.editComment(__privateGet(this, _editor3), parentX + posX * parentWidth, parentY + posY * parentHeight, {
            ...options,
            parentDimensions
          });
        }
        finish() {
          if (!__privateGet(this, _commentToolbarButton)) {
            return;
          }
          __privateGet(this, _commentToolbarButton).focus({
            focusVisible: __privateGet(this, _commentWasFromKeyBoard)
          });
          __privateSet(this, _commentWasFromKeyBoard, false);
        }
        isDeleted() {
          return __privateGet(this, _deleted) || __privateGet(this, _text) === "";
        }
        isEmpty() {
          return __privateGet(this, _text) === null;
        }
        hasBeenEdited() {
          return this.isDeleted() || __privateGet(this, _text) !== __privateGet(this, _initialText);
        }
        serialize() {
          return this.data;
        }
        get data() {
          return {
            text: __privateGet(this, _text),
            richText: __privateGet(this, _richText),
            date: __privateGet(this, _date),
            deleted: this.isDeleted()
          };
        }
        set data(text) {
          if (text !== __privateGet(this, _text)) {
            __privateSet(this, _richText, null);
          }
          if (text === null) {
            __privateSet(this, _text, "");
            __privateSet(this, _deleted, true);
            return;
          }
          __privateSet(this, _text, text);
          __privateSet(this, _date, /* @__PURE__ */ new Date());
          __privateSet(this, _deleted, false);
        }
        restoreData({
          text,
          richText,
          date
        }) {
          __privateSet(this, _text, text);
          __privateSet(this, _richText, richText);
          __privateSet(this, _date, date);
          __privateSet(this, _deleted, false);
        }
        setInitialText(text, richText = null) {
          __privateSet(this, _initialText, text);
          this.data = text;
          __privateSet(this, _date, null);
          __privateSet(this, _richText, richText);
        }
        shown() {
        }
        destroy() {
          __privateGet(this, _commentToolbarButton)?.remove();
          __privateSet(this, _commentToolbarButton, null);
          __privateGet(this, _commentStandaloneButton)?.remove();
          __privateSet(this, _commentStandaloneButton, null);
          __privateSet(this, _text, "");
          __privateSet(this, _richText, null);
          __privateSet(this, _date, null);
          __privateSet(this, _editor3, null);
          __privateSet(this, _commentWasFromKeyBoard, false);
          __privateSet(this, _deleted, false);
        }
      };
      _commentStandaloneButton = new WeakMap();
      _commentToolbarButton = new WeakMap();
      _commentWasFromKeyBoard = new WeakMap();
      _editor3 = new WeakMap();
      _initialText = new WeakMap();
      _richText = new WeakMap();
      _text = new WeakMap();
      _date = new WeakMap();
      _deleted = new WeakMap();
      _popupPosition = new WeakMap();
      _Comment_instances = new WeakSet();
      render_fn2 = function(comment, isStandalone) {
        if (!__privateGet(this, _editor3)._uiManager.hasCommentManager()) {
          return null;
        }
        comment.tabIndex = "0";
        comment.ariaHasPopup = "dialog";
        if (isStandalone) {
          comment.ariaControls = "commentPopup";
          comment.setAttribute("data-l10n-id", "pdfjs-show-comment-button");
        } else {
          comment.ariaControlsElements = [__privateGet(this, _editor3)._uiManager.getCommentDialogElement()];
          comment.setAttribute("data-l10n-id", "pdfjs-editor-add-comment-button");
        }
        const signal = __privateGet(this, _editor3)._uiManager._signal;
        if (!(signal instanceof AbortSignal) || signal.aborted) {
          return comment;
        }
        comment.addEventListener("contextmenu", noContextMenu, {
          signal
        });
        if (isStandalone) {
          comment.addEventListener("focusin", (e) => {
            __privateGet(this, _editor3)._focusEventsAllowed = false;
            stopEvent(e);
          }, {
            capture: true,
            signal
          });
          comment.addEventListener("focusout", (e) => {
            __privateGet(this, _editor3)._focusEventsAllowed = true;
            stopEvent(e);
          }, {
            capture: true,
            signal
          });
        }
        comment.addEventListener("pointerdown", (event) => event.stopPropagation(), {
          signal
        });
        const onClick = (event) => {
          event.preventDefault();
          if (comment === __privateGet(this, _commentToolbarButton)) {
            this.edit();
          } else {
            __privateGet(this, _editor3).toggleComment(true);
          }
        };
        comment.addEventListener("click", onClick, {
          capture: true,
          signal
        });
        comment.addEventListener("keydown", (event) => {
          if (event.target === comment && event.key === "Enter") {
            __privateSet(this, _commentWasFromKeyBoard, true);
            onClick(event);
          }
        }, {
          signal
        });
        comment.addEventListener("pointerenter", () => {
          __privateGet(this, _editor3).toggleComment(false, true);
        }, {
          signal
        });
        comment.addEventListener("pointerleave", () => {
          __privateGet(this, _editor3).toggleComment(false, false);
        }, {
          signal
        });
        return comment;
      };
      _TouchManager = class _TouchManager {
        constructor({
          container,
          isPinchingDisabled = null,
          isPinchingStopped = null,
          onPinchStart = null,
          onPinching = null,
          onPinchEnd = null,
          signal
        }) {
          __privateAdd(this, _TouchManager_instances);
          __privateAdd(this, _container2);
          __privateAdd(this, _isPinching, false);
          __privateAdd(this, _isPinchingStopped, null);
          __privateAdd(this, _isPinchingDisabled);
          __privateAdd(this, _onPinchStart);
          __privateAdd(this, _onPinching);
          __privateAdd(this, _onPinchEnd);
          __privateAdd(this, _pointerDownAC, null);
          __privateAdd(this, _signal);
          __privateAdd(this, _touchInfo, null);
          __privateAdd(this, _touchManagerAC);
          __privateAdd(this, _touchMoveAC, null);
          __privateSet(this, _container2, container);
          __privateSet(this, _isPinchingStopped, isPinchingStopped);
          __privateSet(this, _isPinchingDisabled, isPinchingDisabled);
          __privateSet(this, _onPinchStart, onPinchStart);
          __privateSet(this, _onPinching, onPinching);
          __privateSet(this, _onPinchEnd, onPinchEnd);
          __privateSet(this, _touchManagerAC, new AbortController());
          __privateSet(this, _signal, AbortSignal.any([signal, __privateGet(this, _touchManagerAC).signal]));
          container.addEventListener("touchstart", __privateMethod(this, _TouchManager_instances, onTouchStart_fn).bind(this), {
            passive: false,
            signal: __privateGet(this, _signal)
          });
        }
        get MIN_TOUCH_DISTANCE_TO_PINCH() {
          return 35 / OutputScale.pixelRatio;
        }
        destroy() {
          __privateGet(this, _touchManagerAC)?.abort();
          __privateSet(this, _touchManagerAC, null);
          __privateGet(this, _pointerDownAC)?.abort();
          __privateSet(this, _pointerDownAC, null);
        }
      };
      _container2 = new WeakMap();
      _isPinching = new WeakMap();
      _isPinchingStopped = new WeakMap();
      _isPinchingDisabled = new WeakMap();
      _onPinchStart = new WeakMap();
      _onPinching = new WeakMap();
      _onPinchEnd = new WeakMap();
      _pointerDownAC = new WeakMap();
      _signal = new WeakMap();
      _touchInfo = new WeakMap();
      _touchManagerAC = new WeakMap();
      _touchMoveAC = new WeakMap();
      _TouchManager_instances = new WeakSet();
      onTouchStart_fn = function(evt) {
        var _a, _b, _c;
        if ((_a = __privateGet(this, _isPinchingDisabled)) == null ? void 0 : _a.call(this)) {
          return;
        }
        if (evt.touches.length === 1) {
          if (__privateGet(this, _pointerDownAC)) {
            return;
          }
          const pointerDownAC = __privateSet(this, _pointerDownAC, new AbortController());
          const signal = AbortSignal.any([__privateGet(this, _signal), pointerDownAC.signal]);
          const container = __privateGet(this, _container2);
          const opts = {
            capture: true,
            signal,
            passive: false
          };
          const cancelPointerDown = (e) => {
            if (e.pointerType === "touch") {
              __privateGet(this, _pointerDownAC)?.abort();
              __privateSet(this, _pointerDownAC, null);
            }
          };
          container.addEventListener("pointerdown", (e) => {
            if (e.pointerType === "touch") {
              stopEvent(e);
              cancelPointerDown(e);
            }
          }, opts);
          container.addEventListener("pointerup", cancelPointerDown, opts);
          container.addEventListener("pointercancel", cancelPointerDown, opts);
          return;
        }
        if (!__privateGet(this, _touchMoveAC)) {
          __privateSet(this, _touchMoveAC, new AbortController());
          const signal = AbortSignal.any([__privateGet(this, _signal), __privateGet(this, _touchMoveAC).signal]);
          const container = __privateGet(this, _container2);
          const opt = {
            signal,
            capture: false,
            passive: false
          };
          container.addEventListener("touchmove", __privateMethod(this, _TouchManager_instances, onTouchMove_fn).bind(this), opt);
          const onTouchEnd = __privateMethod(this, _TouchManager_instances, onTouchEnd_fn).bind(this);
          container.addEventListener("touchend", onTouchEnd, opt);
          container.addEventListener("touchcancel", onTouchEnd, opt);
          opt.capture = true;
          container.addEventListener("pointerdown", stopEvent, opt);
          container.addEventListener("pointermove", stopEvent, opt);
          container.addEventListener("pointercancel", stopEvent, opt);
          container.addEventListener("pointerup", stopEvent, opt);
          (_b = __privateGet(this, _onPinchStart)) == null ? void 0 : _b.call(this);
        }
        stopEvent(evt);
        if (evt.touches.length !== 2 || ((_c = __privateGet(this, _isPinchingStopped)) == null ? void 0 : _c.call(this))) {
          __privateSet(this, _touchInfo, null);
          return;
        }
        let [touch0, touch1] = evt.touches;
        if (touch0.identifier > touch1.identifier) {
          [touch0, touch1] = [touch1, touch0];
        }
        __privateSet(this, _touchInfo, {
          touch0X: touch0.screenX,
          touch0Y: touch0.screenY,
          touch1X: touch1.screenX,
          touch1Y: touch1.screenY
        });
      };
      onTouchMove_fn = function(evt) {
        var _a;
        if (!__privateGet(this, _touchInfo) || evt.touches.length !== 2) {
          return;
        }
        stopEvent(evt);
        let [touch0, touch1] = evt.touches;
        if (touch0.identifier > touch1.identifier) {
          [touch0, touch1] = [touch1, touch0];
        }
        const {
          screenX: screen0X,
          screenY: screen0Y
        } = touch0;
        const {
          screenX: screen1X,
          screenY: screen1Y
        } = touch1;
        const touchInfo = __privateGet(this, _touchInfo);
        const {
          touch0X: pTouch0X,
          touch0Y: pTouch0Y,
          touch1X: pTouch1X,
          touch1Y: pTouch1Y
        } = touchInfo;
        const prevGapX = pTouch1X - pTouch0X;
        const prevGapY = pTouch1Y - pTouch0Y;
        const currGapX = screen1X - screen0X;
        const currGapY = screen1Y - screen0Y;
        const distance = Math.hypot(currGapX, currGapY) || 1;
        const pDistance = Math.hypot(prevGapX, prevGapY) || 1;
        if (!__privateGet(this, _isPinching) && Math.abs(pDistance - distance) <= _TouchManager.MIN_TOUCH_DISTANCE_TO_PINCH) {
          return;
        }
        touchInfo.touch0X = screen0X;
        touchInfo.touch0Y = screen0Y;
        touchInfo.touch1X = screen1X;
        touchInfo.touch1Y = screen1Y;
        if (!__privateGet(this, _isPinching)) {
          __privateSet(this, _isPinching, true);
          return;
        }
        const origin = [(screen0X + screen1X) / 2, (screen0Y + screen1Y) / 2];
        (_a = __privateGet(this, _onPinching)) == null ? void 0 : _a.call(this, origin, pDistance, distance);
      };
      onTouchEnd_fn = function(evt) {
        var _a;
        if (evt.touches.length >= 2) {
          return;
        }
        if (__privateGet(this, _touchMoveAC)) {
          __privateGet(this, _touchMoveAC).abort();
          __privateSet(this, _touchMoveAC, null);
          (_a = __privateGet(this, _onPinchEnd)) == null ? void 0 : _a.call(this);
        }
        if (!__privateGet(this, _touchInfo)) {
          return;
        }
        stopEvent(evt);
        __privateSet(this, _touchInfo, null);
        __privateSet(this, _isPinching, false);
      };
      TouchManager = _TouchManager;
      _AnnotationEditor = class _AnnotationEditor {
        constructor(parameters) {
          __privateAdd(this, _AnnotationEditor_instances);
          __privateAdd(this, _accessibilityData, null);
          __privateAdd(this, _allResizerDivs, null);
          __privateAdd(this, _altText3, null);
          __privateAdd(this, _comment2, null);
          __privateAdd(this, _commentStandaloneButton2, null);
          __privateAdd(this, _disabled, false);
          __privateAdd(this, _dragPointerId, null);
          __privateAdd(this, _dragPointerType, "");
          __privateAdd(this, _resizersDiv, null);
          __privateAdd(this, _lastPointerCoords, null);
          __privateAdd(this, _savedDimensions, null);
          __privateAdd(this, _fakeAnnotation, null);
          __privateAdd(this, _focusAC, null);
          __privateAdd(this, _focusedResizerName, "");
          __privateAdd(this, _hasBeenClicked, false);
          __privateAdd(this, _initialRect, null);
          __privateAdd(this, _isEditing, false);
          __privateAdd(this, _isInEditMode, false);
          __privateAdd(this, _isResizerEnabledForKeyboard, false);
          __privateAdd(this, _moveInDOMTimeout, null);
          __privateAdd(this, _prevDragX, 0);
          __privateAdd(this, _prevDragY, 0);
          __privateAdd(this, _telemetryTimeouts, null);
          __privateAdd(this, _touchManager, null);
          __publicField(this, "isSelected", false);
          __publicField(this, "_isCopy", false);
          __publicField(this, "_editToolbar", null);
          __publicField(this, "_initialOptions", /* @__PURE__ */ Object.create(null));
          __publicField(this, "_initialData", null);
          __publicField(this, "_isVisible", true);
          __publicField(this, "_uiManager", null);
          __publicField(this, "_focusEventsAllowed", true);
          __privateAdd(this, _isDraggable, false);
          __privateAdd(this, _zIndex, _AnnotationEditor._zIndex++);
          this.parent = parameters.parent;
          this.id = parameters.id;
          this.width = this.height = null;
          this.pageIndex = parameters.parent.pageIndex;
          this.name = parameters.name;
          this.div = null;
          this._uiManager = parameters.uiManager;
          this.annotationElementId = null;
          this._willKeepAspectRatio = false;
          this._initialOptions.isCentered = parameters.isCentered;
          this._structTreeParentId = null;
          this.annotationElementId = parameters.annotationElementId || null;
          this.creationDate = parameters.creationDate || /* @__PURE__ */ new Date();
          this.modificationDate = parameters.modificationDate || null;
          this.canAddComment = true;
          const {
            rotation,
            rawDims: {
              pageWidth,
              pageHeight,
              pageX,
              pageY
            }
          } = this.parent.viewport;
          this.rotation = rotation;
          this.pageRotation = (360 + rotation - this._uiManager.viewParameters.rotation) % 360;
          this.pageDimensions = [pageWidth, pageHeight];
          this.pageTranslation = [pageX, pageY];
          const [width, height] = this.parentDimensions;
          this.x = parameters.x / width;
          this.y = parameters.y / height;
          this.isAttachedToDOM = false;
          this.deleted = false;
        }
        static get _resizerKeyboardManager() {
          const resize = _AnnotationEditor.prototype._resizeWithKeyboard;
          const small = AnnotationEditorUIManager.TRANSLATE_SMALL;
          const big = AnnotationEditorUIManager.TRANSLATE_BIG;
          return shadow(this, "_resizerKeyboardManager", new KeyboardManager([[["ArrowLeft"], resize, {
            args: [-small, 0]
          }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], resize, {
            args: [-big, 0]
          }], [["ArrowRight"], resize, {
            args: [small, 0]
          }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], resize, {
            args: [big, 0]
          }], [["ArrowUp"], resize, {
            args: [0, -small]
          }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], resize, {
            args: [0, -big]
          }], [["ArrowDown"], resize, {
            args: [0, small]
          }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], resize, {
            args: [0, big]
          }], [["Escape"], _AnnotationEditor.prototype._stopResizingWithKeyboard]]));
        }
        updatePageIndex(newPageIndex) {
          this.pageIndex = newPageIndex;
        }
        get editorType() {
          return Object.getPrototypeOf(this).constructor._type;
        }
        get mode() {
          return Object.getPrototypeOf(this).constructor._editorType;
        }
        static get isDrawer() {
          return false;
        }
        static get _defaultLineColor() {
          return shadow(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText"));
        }
        static deleteAnnotationElement(editor) {
          const fakeEditor = new FakeEditor({
            id: editor._uiManager.getId(),
            parent: editor.parent,
            uiManager: editor._uiManager
          });
          fakeEditor.annotationElementId = editor.annotationElementId;
          fakeEditor.deleted = true;
          fakeEditor._uiManager.addToAnnotationStorage(fakeEditor);
        }
        static initialize(l10n, _uiManager5) {
          _AnnotationEditor._l10n ?? (_AnnotationEditor._l10n = l10n);
          _AnnotationEditor._l10nAlert ?? (_AnnotationEditor._l10nAlert = Object.freeze({
            highlight: "pdfjs-editor-highlight-added-alert",
            freetext: "pdfjs-editor-freetext-added-alert",
            ink: "pdfjs-editor-ink-added-alert",
            stamp: "pdfjs-editor-stamp-added-alert",
            signature: "pdfjs-editor-signature-added-alert"
          }));
          _AnnotationEditor._l10nResizer ?? (_AnnotationEditor._l10nResizer = Object.freeze({
            topLeft: "pdfjs-editor-resizer-top-left",
            topMiddle: "pdfjs-editor-resizer-top-middle",
            topRight: "pdfjs-editor-resizer-top-right",
            middleRight: "pdfjs-editor-resizer-middle-right",
            bottomRight: "pdfjs-editor-resizer-bottom-right",
            bottomMiddle: "pdfjs-editor-resizer-bottom-middle",
            bottomLeft: "pdfjs-editor-resizer-bottom-left",
            middleLeft: "pdfjs-editor-resizer-middle-left"
          }));
          if (_AnnotationEditor._borderLineWidth !== -1) {
            return;
          }
          const style = getComputedStyle(document.documentElement);
          _AnnotationEditor._borderLineWidth = parseFloat(style.getPropertyValue("--outline-width")) || 0;
        }
        static updateDefaultParams(_type, _value) {
        }
        static get defaultPropertiesToUpdate() {
          return [];
        }
        static isHandlingMimeForPasting(mime) {
          return false;
        }
        static paste(item, parent) {
          unreachable("Not implemented");
        }
        get propertiesToUpdate() {
          return [];
        }
        get _isDraggable() {
          return __privateGet(this, _isDraggable);
        }
        set _isDraggable(value) {
          __privateSet(this, _isDraggable, value);
          this.div?.classList.toggle("draggable", value);
        }
        get uid() {
          return this.annotationElementId || this.id;
        }
        get isEnterHandled() {
          return true;
        }
        center() {
          const [pageWidth, pageHeight] = this.pageDimensions;
          switch (this.parentRotation) {
            case 90:
              this.x -= this.height * pageHeight / (pageWidth * 2);
              this.y += this.width * pageWidth / (pageHeight * 2);
              break;
            case 180:
              this.x += this.width / 2;
              this.y += this.height / 2;
              break;
            case 270:
              this.x += this.height * pageHeight / (pageWidth * 2);
              this.y -= this.width * pageWidth / (pageHeight * 2);
              break;
            default:
              this.x -= this.width / 2;
              this.y -= this.height / 2;
              break;
          }
          this.fixAndSetPosition();
        }
        addCommands(params) {
          this._uiManager.addCommands(params);
        }
        get currentLayer() {
          return this._uiManager.currentLayer;
        }
        setInBackground() {
          this.div.style.zIndex = 0;
        }
        setInForeground() {
          this.div.style.zIndex = __privateGet(this, _zIndex);
        }
        setParent(parent) {
          if (parent !== null) {
            this.pageIndex = parent.pageIndex;
            this.pageDimensions = parent.pageDimensions;
          } else {
            __privateMethod(this, _AnnotationEditor_instances, stopResizing_fn).call(this);
            __privateGet(this, _fakeAnnotation)?.remove();
            __privateSet(this, _fakeAnnotation, null);
          }
          this.parent = parent;
        }
        focusin(event) {
          if (!this._focusEventsAllowed) {
            return;
          }
          if (!__privateGet(this, _hasBeenClicked)) {
            this.parent.setSelected(this);
          } else {
            __privateSet(this, _hasBeenClicked, false);
          }
        }
        focusout(event) {
          if (!this._focusEventsAllowed) {
            return;
          }
          if (!this.isAttachedToDOM) {
            return;
          }
          const target = event.relatedTarget;
          if (target?.closest(`#${this.id}`)) {
            return;
          }
          event.preventDefault();
          if (!this.parent?.isMultipleSelection) {
            this.commitOrRemove();
          }
        }
        commitOrRemove() {
          if (this.isEmpty()) {
            this.remove();
          } else {
            this.commit();
          }
        }
        commit() {
          if (!this.isInEditMode()) {
            return;
          }
          this.addToAnnotationStorage();
        }
        addToAnnotationStorage() {
          this._uiManager.addToAnnotationStorage(this);
        }
        setAt(x, y, tx, ty) {
          const [width, height] = this.parentDimensions;
          [tx, ty] = this.screenToPageTranslation(tx, ty);
          this.x = (x + tx) / width;
          this.y = (y + ty) / height;
          this.fixAndSetPosition();
        }
        _moveAfterPaste(baseX, baseY) {
          if (this.isClone) {
            delete this.isClone;
            return;
          }
          const [parentWidth, parentHeight] = this.parentDimensions;
          this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
          this._onTranslated();
        }
        translate(x, y) {
          __privateMethod(this, _AnnotationEditor_instances, translate_fn).call(this, this.parentDimensions, x, y);
        }
        translateInPage(x, y) {
          __privateGet(this, _initialRect) || __privateSet(this, _initialRect, [this.x, this.y, this.width, this.height]);
          __privateMethod(this, _AnnotationEditor_instances, translate_fn).call(this, this.pageDimensions, x, y);
          this.div.scrollIntoView({
            block: "nearest"
          });
        }
        translationDone() {
          this._onTranslated(this.x, this.y);
        }
        drag(tx, ty) {
          __privateGet(this, _initialRect) || __privateSet(this, _initialRect, [this.x, this.y, this.width, this.height]);
          const {
            div,
            parentDimensions: [parentWidth, parentHeight]
          } = this;
          this.x += tx / parentWidth;
          this.y += ty / parentHeight;
          if (this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) {
            const {
              x: x2,
              y: y2
            } = this.div.getBoundingClientRect();
            if (this.parent.findNewParent(this, x2, y2)) {
              this.x -= Math.floor(this.x);
              this.y -= Math.floor(this.y);
            }
          }
          let {
            x,
            y
          } = this;
          const [bx, by] = this.getBaseTranslation();
          x += bx;
          y += by;
          const {
            style
          } = div;
          style.left = `${(100 * x).toFixed(2)}%`;
          style.top = `${(100 * y).toFixed(2)}%`;
          this._onTranslating(x, y);
          div.scrollIntoView({
            block: "nearest"
          });
        }
        _onTranslating(x, y) {
        }
        _onTranslated(x, y) {
        }
        get _hasBeenMoved() {
          return !!__privateGet(this, _initialRect) && (__privateGet(this, _initialRect)[0] !== this.x || __privateGet(this, _initialRect)[1] !== this.y);
        }
        get _hasBeenResized() {
          return !!__privateGet(this, _initialRect) && (__privateGet(this, _initialRect)[2] !== this.width || __privateGet(this, _initialRect)[3] !== this.height);
        }
        getBaseTranslation() {
          const [parentWidth, parentHeight] = this.parentDimensions;
          const {
            _borderLineWidth
          } = _AnnotationEditor;
          const x = _borderLineWidth / parentWidth;
          const y = _borderLineWidth / parentHeight;
          switch (this.rotation) {
            case 90:
              return [-x, y];
            case 180:
              return [x, y];
            case 270:
              return [x, -y];
            default:
              return [-x, -y];
          }
        }
        get _mustFixPosition() {
          return true;
        }
        fixAndSetPosition(rotation = this.rotation) {
          const {
            div: {
              style
            },
            pageDimensions: [pageWidth, pageHeight]
          } = this;
          let {
            x,
            y,
            width,
            height
          } = this;
          width *= pageWidth;
          height *= pageHeight;
          x *= pageWidth;
          y *= pageHeight;
          if (this._mustFixPosition) {
            switch (rotation) {
              case 0:
                x = MathClamp(x, 0, pageWidth - width);
                y = MathClamp(y, 0, pageHeight - height);
                break;
              case 90:
                x = MathClamp(x, 0, pageWidth - height);
                y = MathClamp(y, width, pageHeight);
                break;
              case 180:
                x = MathClamp(x, width, pageWidth);
                y = MathClamp(y, height, pageHeight);
                break;
              case 270:
                x = MathClamp(x, height, pageWidth);
                y = MathClamp(y, 0, pageHeight - width);
                break;
            }
          }
          this.x = x /= pageWidth;
          this.y = y /= pageHeight;
          const [bx, by] = this.getBaseTranslation();
          x += bx;
          y += by;
          style.left = `${(100 * x).toFixed(2)}%`;
          style.top = `${(100 * y).toFixed(2)}%`;
          this.moveInDOM();
        }
        screenToPageTranslation(x, y) {
          var _a;
          return __privateMethod(_a = _AnnotationEditor, _AnnotationEditor_static, rotatePoint_fn).call(_a, x, y, this.parentRotation);
        }
        pageTranslationToScreen(x, y) {
          var _a;
          return __privateMethod(_a = _AnnotationEditor, _AnnotationEditor_static, rotatePoint_fn).call(_a, x, y, 360 - this.parentRotation);
        }
        get parentScale() {
          return this._uiManager.viewParameters.realScale;
        }
        get parentRotation() {
          return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360;
        }
        get parentDimensions() {
          const {
            parentScale,
            pageDimensions: [pageWidth, pageHeight]
          } = this;
          return [pageWidth * parentScale, pageHeight * parentScale];
        }
        setDims() {
          const {
            div: {
              style
            },
            width,
            height
          } = this;
          style.width = `${(100 * width).toFixed(2)}%`;
          style.height = `${(100 * height).toFixed(2)}%`;
        }
        getInitialTranslation() {
          return [0, 0];
        }
        _onResized() {
        }
        static _round(x) {
          return Math.round(x * 1e4) / 1e4;
        }
        _onResizing() {
        }
        altTextFinish() {
          __privateGet(this, _altText3)?.finish();
        }
        get toolbarButtons() {
          return null;
        }
        async addEditToolbar() {
          if (this._editToolbar || __privateGet(this, _isInEditMode)) {
            return this._editToolbar;
          }
          this._editToolbar = new EditorToolbar(this);
          this.div.append(this._editToolbar.render());
          const {
            toolbarButtons
          } = this;
          if (toolbarButtons) {
            for (const [name, tool] of toolbarButtons) {
              await this._editToolbar.addButton(name, tool);
            }
          }
          if (!this.hasComment) {
            this._editToolbar.addButton("comment", this.addCommentButton());
          }
          this._editToolbar.addButton("delete");
          return this._editToolbar;
        }
        addCommentButtonInToolbar() {
          this._editToolbar?.addButtonBefore("comment", this.addCommentButton(), ".deleteButton");
        }
        removeCommentButtonFromToolbar() {
          this._editToolbar?.removeButton("comment");
        }
        removeEditToolbar() {
          this._editToolbar?.remove();
          this._editToolbar = null;
          __privateGet(this, _altText3)?.destroy();
        }
        addContainer(container) {
          const editToolbarDiv = this._editToolbar?.div;
          if (editToolbarDiv) {
            editToolbarDiv.before(container);
          } else {
            this.div.append(container);
          }
        }
        getClientDimensions() {
          return this.div.getBoundingClientRect();
        }
        createAltText() {
          if (!__privateGet(this, _altText3)) {
            AltText.initialize(_AnnotationEditor._l10n);
            __privateSet(this, _altText3, new AltText(this));
            if (__privateGet(this, _accessibilityData)) {
              __privateGet(this, _altText3).data = __privateGet(this, _accessibilityData);
              __privateSet(this, _accessibilityData, null);
            }
          }
          return __privateGet(this, _altText3);
        }
        get altTextData() {
          return __privateGet(this, _altText3)?.data;
        }
        set altTextData(data) {
          if (!__privateGet(this, _altText3)) {
            return;
          }
          __privateGet(this, _altText3).data = data;
        }
        get guessedAltText() {
          return __privateGet(this, _altText3)?.guessedText;
        }
        async setGuessedAltText(text) {
          await __privateGet(this, _altText3)?.setGuessedText(text);
        }
        serializeAltText(isForCopying) {
          return __privateGet(this, _altText3)?.serialize(isForCopying);
        }
        hasAltText() {
          return !!__privateGet(this, _altText3) && !__privateGet(this, _altText3).isEmpty();
        }
        hasAltTextData() {
          return __privateGet(this, _altText3)?.hasData() ?? false;
        }
        focusCommentButton() {
          __privateGet(this, _comment2)?.focusButton();
        }
        addCommentButton() {
          return this.canAddComment ? __privateGet(this, _comment2) || __privateSet(this, _comment2, new Comment(this)) : null;
        }
        addStandaloneCommentButton() {
          if (!this._uiManager.hasCommentManager()) {
            return;
          }
          if (__privateGet(this, _commentStandaloneButton2)) {
            if (this._uiManager.isEditingMode()) {
              __privateGet(this, _commentStandaloneButton2).classList.remove("hidden");
            }
            return;
          }
          if (!this.hasComment) {
            return;
          }
          __privateSet(this, _commentStandaloneButton2, __privateGet(this, _comment2).renderForStandalone());
          this.div.append(__privateGet(this, _commentStandaloneButton2));
        }
        removeStandaloneCommentButton() {
          __privateGet(this, _comment2).removeStandaloneCommentButton();
          __privateSet(this, _commentStandaloneButton2, null);
        }
        hideStandaloneCommentButton() {
          __privateGet(this, _commentStandaloneButton2)?.classList.add("hidden");
        }
        get comment() {
          if (!__privateGet(this, _comment2)) {
            return null;
          }
          const {
            data: {
              richText,
              text,
              date,
              deleted
            }
          } = __privateGet(this, _comment2);
          return {
            text,
            richText,
            date,
            deleted,
            color: this.getNonHCMColor(),
            opacity: this.opacity ?? 1
          };
        }
        set comment(value) {
          __privateGet(this, _comment2) || __privateSet(this, _comment2, new Comment(this));
          if (typeof value === "object" && value !== null) {
            __privateGet(this, _comment2).restoreData(value);
          } else {
            __privateGet(this, _comment2).data = value;
          }
          if (this.hasComment) {
            this.removeCommentButtonFromToolbar();
            this.addStandaloneCommentButton();
            this._uiManager.updateComment(this);
          } else {
            this.addCommentButtonInToolbar();
            this.removeStandaloneCommentButton();
            this._uiManager.removeComment(this);
          }
        }
        setCommentData({
          comment,
          popupRef,
          richText
        }) {
          if (!popupRef) {
            return;
          }
          __privateGet(this, _comment2) || __privateSet(this, _comment2, new Comment(this));
          __privateGet(this, _comment2).setInitialText(comment, richText);
          if (!this.annotationElementId) {
            return;
          }
          const storedData = this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);
          if (storedData) {
            this.updateFromAnnotationLayer(storedData);
          }
        }
        get hasEditedComment() {
          return __privateGet(this, _comment2)?.hasBeenEdited();
        }
        get hasDeletedComment() {
          return __privateGet(this, _comment2)?.isDeleted();
        }
        get hasComment() {
          return !!__privateGet(this, _comment2) && !__privateGet(this, _comment2).isEmpty() && !__privateGet(this, _comment2).isDeleted();
        }
        async editComment(options) {
          __privateGet(this, _comment2) || __privateSet(this, _comment2, new Comment(this));
          __privateGet(this, _comment2).edit(options);
        }
        toggleComment(isSelected, visibility = void 0) {
          if (this.hasComment) {
            this._uiManager.toggleComment(this, isSelected, visibility);
          }
        }
        setSelectedCommentButton(selected) {
          __privateGet(this, _comment2).setSelectedButton(selected);
        }
        addComment(serialized) {
          if (this.hasEditedComment) {
            const DEFAULT_POPUP_WIDTH = 180;
            const DEFAULT_POPUP_HEIGHT = 100;
            const [, , , trY] = serialized.rect;
            const [pageWidth] = this.pageDimensions;
            const [pageX] = this.pageTranslation;
            const blX = pageX + pageWidth + 1;
            const blY = trY - DEFAULT_POPUP_HEIGHT;
            const trX = blX + DEFAULT_POPUP_WIDTH;
            serialized.popup = {
              contents: this.comment.text,
              deleted: this.comment.deleted,
              rect: [blX, blY, trX, trY]
            };
          }
        }
        updateFromAnnotationLayer({
          popup: {
            contents,
            deleted
          }
        }) {
          __privateGet(this, _comment2).data = deleted ? null : contents;
        }
        get parentBoundingClientRect() {
          return this.parent.boundingClientRect;
        }
        render() {
          const div = this.div = document.createElement("div");
          div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360);
          div.className = this.name;
          div.setAttribute("id", this.id);
          div.tabIndex = __privateGet(this, _disabled) ? -1 : 0;
          div.setAttribute("role", "application");
          if (this.defaultL10nId) {
            div.setAttribute("data-l10n-id", this.defaultL10nId);
          }
          if (!this._isVisible) {
            div.classList.add("hidden");
          }
          this.setInForeground();
          __privateMethod(this, _AnnotationEditor_instances, addFocusListeners_fn).call(this);
          const [parentWidth, parentHeight] = this.parentDimensions;
          if (this.parentRotation % 180 !== 0) {
            div.style.maxWidth = `${(100 * parentHeight / parentWidth).toFixed(2)}%`;
            div.style.maxHeight = `${(100 * parentWidth / parentHeight).toFixed(2)}%`;
          }
          const [tx, ty] = this.getInitialTranslation();
          this.translate(tx, ty);
          bindEvents(this, div, ["keydown", "pointerdown", "dblclick"]);
          if (this.isResizable && this._uiManager._supportsPinchToZoom) {
            __privateGet(this, _touchManager) || __privateSet(this, _touchManager, new TouchManager({
              container: div,
              isPinchingDisabled: () => !this.isSelected,
              onPinchStart: __privateMethod(this, _AnnotationEditor_instances, touchPinchStartCallback_fn).bind(this),
              onPinching: __privateMethod(this, _AnnotationEditor_instances, touchPinchCallback_fn).bind(this),
              onPinchEnd: __privateMethod(this, _AnnotationEditor_instances, touchPinchEndCallback_fn).bind(this),
              signal: this._uiManager._signal
            }));
          }
          this.addStandaloneCommentButton();
          this._uiManager._editorUndoBar?.hide();
          return div;
        }
        pointerdown(event) {
          const {
            isMac
          } = FeatureTest.platform;
          if (event.button !== 0 || event.ctrlKey && isMac) {
            event.preventDefault();
            return;
          }
          __privateSet(this, _hasBeenClicked, true);
          if (this._isDraggable) {
            __privateMethod(this, _AnnotationEditor_instances, setUpDragSession_fn).call(this, event);
            return;
          }
          __privateMethod(this, _AnnotationEditor_instances, selectOnPointerEvent_fn).call(this, event);
        }
        _onStartDragging() {
        }
        _onStopDragging() {
        }
        moveInDOM() {
          if (__privateGet(this, _moveInDOMTimeout)) {
            clearTimeout(__privateGet(this, _moveInDOMTimeout));
          }
          __privateSet(this, _moveInDOMTimeout, setTimeout(() => {
            __privateSet(this, _moveInDOMTimeout, null);
            this.parent?.moveEditorInDOM(this);
          }, 0));
        }
        _setParentAndPosition(parent, x, y) {
          parent.changeParent(this);
          this.x = x;
          this.y = y;
          this.fixAndSetPosition();
          this._onTranslated();
        }
        getRect(tx, ty, rotation = this.rotation) {
          const scale = this.parentScale;
          const [pageWidth, pageHeight] = this.pageDimensions;
          const [pageX, pageY] = this.pageTranslation;
          const shiftX = tx / scale;
          const shiftY = ty / scale;
          const x = this.x * pageWidth;
          const y = this.y * pageHeight;
          const width = this.width * pageWidth;
          const height = this.height * pageHeight;
          switch (rotation) {
            case 0:
              return [x + shiftX + pageX, pageHeight - y - shiftY - height + pageY, x + shiftX + width + pageX, pageHeight - y - shiftY + pageY];
            case 90:
              return [x + shiftY + pageX, pageHeight - y + shiftX + pageY, x + shiftY + height + pageX, pageHeight - y + shiftX + width + pageY];
            case 180:
              return [x - shiftX - width + pageX, pageHeight - y + shiftY + pageY, x - shiftX + pageX, pageHeight - y + shiftY + height + pageY];
            case 270:
              return [x - shiftY - height + pageX, pageHeight - y - shiftX - width + pageY, x - shiftY + pageX, pageHeight - y - shiftX + pageY];
            default:
              throw new Error("Invalid rotation");
          }
        }
        getRectInCurrentCoords(rect, pageHeight) {
          const [x1, y1, x2, y2] = rect;
          const width = x2 - x1;
          const height = y2 - y1;
          switch (this.rotation) {
            case 0:
              return [x1, pageHeight - y2, width, height];
            case 90:
              return [x1, pageHeight - y1, height, width];
            case 180:
              return [x2, pageHeight - y1, width, height];
            case 270:
              return [x2, pageHeight - y2, height, width];
            default:
              throw new Error("Invalid rotation");
          }
        }
        getPDFRect() {
          return this.getRect(0, 0);
        }
        getNonHCMColor() {
          return this.color && _AnnotationEditor._colorManager.convert(this._uiManager.getNonHCMColor(this.color));
        }
        onUpdatedColor() {
          __privateGet(this, _comment2)?.onUpdatedColor();
        }
        getData() {
          const {
            comment: {
              text: str,
              color,
              date,
              opacity,
              deleted,
              richText
            },
            uid: id,
            pageIndex,
            creationDate,
            modificationDate
          } = this;
          return {
            id,
            pageIndex,
            rect: this.getPDFRect(),
            richText,
            contentsObj: {
              str
            },
            creationDate,
            modificationDate: date || modificationDate,
            popupRef: !deleted,
            color,
            opacity
          };
        }
        onceAdded(focus) {
        }
        isEmpty() {
          return false;
        }
        enableEditMode() {
          if (this.isInEditMode()) {
            return false;
          }
          this.parent.setEditingState(false);
          __privateSet(this, _isInEditMode, true);
          return true;
        }
        disableEditMode() {
          if (!this.isInEditMode()) {
            return false;
          }
          this.parent.setEditingState(true);
          __privateSet(this, _isInEditMode, false);
          return true;
        }
        isInEditMode() {
          return __privateGet(this, _isInEditMode);
        }
        shouldGetKeyboardEvents() {
          return __privateGet(this, _isResizerEnabledForKeyboard);
        }
        needsToBeRebuilt() {
          return this.div && !this.isAttachedToDOM;
        }
        get isOnScreen() {
          const {
            top,
            left,
            bottom,
            right
          } = this.getClientDimensions();
          const {
            innerHeight,
            innerWidth
          } = window;
          return left < innerWidth && right > 0 && top < innerHeight && bottom > 0;
        }
        rebuild() {
          __privateMethod(this, _AnnotationEditor_instances, addFocusListeners_fn).call(this);
        }
        rotate(_angle) {
        }
        resize() {
        }
        serializeDeleted() {
          return {
            id: this.annotationElementId,
            deleted: true,
            pageIndex: this.pageIndex,
            popupRef: this._initialData?.popupRef || ""
          };
        }
        serialize(isForCopying = false, context = null) {
          return {
            annotationType: this.mode,
            pageIndex: this.pageIndex,
            rect: this.getPDFRect(),
            rotation: this.rotation,
            structTreeParentId: this._structTreeParentId,
            popupRef: this._initialData?.popupRef || ""
          };
        }
        static async deserialize(data, parent, uiManager) {
          const editor = new this.prototype.constructor({
            parent,
            id: uiManager.getId(),
            uiManager,
            annotationElementId: data.annotationElementId,
            creationDate: data.creationDate,
            modificationDate: data.modificationDate
          });
          editor.rotation = data.rotation;
          __privateSet(editor, _accessibilityData, data.accessibilityData);
          editor._isCopy = data.isCopy || false;
          const [pageWidth, pageHeight] = editor.pageDimensions;
          const [x, y, width, height] = editor.getRectInCurrentCoords(data.rect, pageHeight);
          editor.x = x / pageWidth;
          editor.y = y / pageHeight;
          editor.width = width / pageWidth;
          editor.height = height / pageHeight;
          return editor;
        }
        get hasBeenModified() {
          return !!this.annotationElementId && (this.deleted || this.serialize() !== null);
        }
        remove() {
          __privateGet(this, _focusAC)?.abort();
          __privateSet(this, _focusAC, null);
          if (!this.isEmpty()) {
            this.commit();
          }
          if (this.parent) {
            this.parent.remove(this);
          } else {
            this._uiManager.removeEditor(this);
          }
          this.hideCommentPopup();
          if (__privateGet(this, _moveInDOMTimeout)) {
            clearTimeout(__privateGet(this, _moveInDOMTimeout));
            __privateSet(this, _moveInDOMTimeout, null);
          }
          __privateMethod(this, _AnnotationEditor_instances, stopResizing_fn).call(this);
          this.removeEditToolbar();
          if (__privateGet(this, _telemetryTimeouts)) {
            for (const timeout of __privateGet(this, _telemetryTimeouts).values()) {
              clearTimeout(timeout);
            }
            __privateSet(this, _telemetryTimeouts, null);
          }
          this.parent = null;
          __privateGet(this, _touchManager)?.destroy();
          __privateSet(this, _touchManager, null);
          __privateGet(this, _fakeAnnotation)?.remove();
          __privateSet(this, _fakeAnnotation, null);
        }
        get isResizable() {
          return false;
        }
        makeResizable() {
          if (this.isResizable) {
            __privateMethod(this, _AnnotationEditor_instances, createResizers_fn).call(this);
            __privateGet(this, _resizersDiv).classList.remove("hidden");
          }
        }
        get toolbarPosition() {
          return null;
        }
        get commentButtonPosition() {
          return this._uiManager.direction === "ltr" ? [1, 0] : [0, 0];
        }
        get commentButtonPositionInPage() {
          const {
            commentButtonPosition: [posX, posY]
          } = this;
          const [blX, blY, trX, trY] = this.getPDFRect();
          return [_AnnotationEditor._round(blX + (trX - blX) * posX), _AnnotationEditor._round(blY + (trY - blY) * (1 - posY))];
        }
        get commentButtonColor() {
          return this._uiManager.makeCommentColor(this.getNonHCMColor(), this.opacity);
        }
        get commentPopupPosition() {
          return __privateGet(this, _comment2).commentPopupPositionInLayer;
        }
        set commentPopupPosition(pos) {
          __privateGet(this, _comment2).commentPopupPositionInLayer = pos;
        }
        hasDefaultPopupPosition() {
          return __privateGet(this, _comment2).hasDefaultPopupPosition();
        }
        get commentButtonWidth() {
          return __privateGet(this, _comment2).commentButtonWidth;
        }
        get elementBeforePopup() {
          return this.div;
        }
        setCommentButtonStates(options) {
          __privateGet(this, _comment2)?.setCommentButtonStates(options);
        }
        keydown(event) {
          if (!this.isResizable || event.target !== this.div || event.key !== "Enter") {
            return;
          }
          this._uiManager.setSelected(this);
          __privateSet(this, _savedDimensions, {
            savedX: this.x,
            savedY: this.y,
            savedWidth: this.width,
            savedHeight: this.height
          });
          const children = __privateGet(this, _resizersDiv).children;
          if (!__privateGet(this, _allResizerDivs)) {
            __privateSet(this, _allResizerDivs, Array.from(children));
            const boundResizerKeydown = __privateMethod(this, _AnnotationEditor_instances, resizerKeydown_fn).bind(this);
            const boundResizerBlur = __privateMethod(this, _AnnotationEditor_instances, resizerBlur_fn).bind(this);
            const signal = this._uiManager._signal;
            for (const div of __privateGet(this, _allResizerDivs)) {
              const name = div.getAttribute("data-resizer-name");
              div.setAttribute("role", "spinbutton");
              div.addEventListener("keydown", boundResizerKeydown, {
                signal
              });
              div.addEventListener("blur", boundResizerBlur, {
                signal
              });
              div.addEventListener("focus", __privateMethod(this, _AnnotationEditor_instances, resizerFocus_fn).bind(this, name), {
                signal
              });
              div.setAttribute("data-l10n-id", _AnnotationEditor._l10nResizer[name]);
            }
          }
          const first2 = __privateGet(this, _allResizerDivs)[0];
          let firstPosition = 0;
          for (const div of children) {
            if (div === first2) {
              break;
            }
            firstPosition++;
          }
          const nextFirstPosition = (360 - this.rotation + this.parentRotation) % 360 / 90 * (__privateGet(this, _allResizerDivs).length / 4);
          if (nextFirstPosition !== firstPosition) {
            if (nextFirstPosition < firstPosition) {
              for (let i2 = 0; i2 < firstPosition - nextFirstPosition; i2++) {
                __privateGet(this, _resizersDiv).append(__privateGet(this, _resizersDiv).firstElementChild);
              }
            } else if (nextFirstPosition > firstPosition) {
              for (let i2 = 0; i2 < nextFirstPosition - firstPosition; i2++) {
                __privateGet(this, _resizersDiv).firstElementChild.before(__privateGet(this, _resizersDiv).lastElementChild);
              }
            }
            let i = 0;
            for (const child of children) {
              const div = __privateGet(this, _allResizerDivs)[i++];
              const name = div.getAttribute("data-resizer-name");
              child.setAttribute("data-l10n-id", _AnnotationEditor._l10nResizer[name]);
            }
          }
          __privateMethod(this, _AnnotationEditor_instances, setResizerTabIndex_fn).call(this, 0);
          __privateSet(this, _isResizerEnabledForKeyboard, true);
          __privateGet(this, _resizersDiv).firstElementChild.focus({
            focusVisible: true
          });
          event.preventDefault();
          event.stopImmediatePropagation();
        }
        _resizeWithKeyboard(x, y) {
          if (!__privateGet(this, _isResizerEnabledForKeyboard)) {
            return;
          }
          __privateMethod(this, _AnnotationEditor_instances, resizerPointermove_fn).call(this, __privateGet(this, _focusedResizerName), {
            deltaX: x,
            deltaY: y,
            fromKeyboard: true
          });
        }
        _stopResizingWithKeyboard() {
          __privateMethod(this, _AnnotationEditor_instances, stopResizing_fn).call(this);
          this.div.focus();
        }
        select() {
          if (this.isSelected && this._editToolbar) {
            this._editToolbar.show();
            return;
          }
          this.isSelected = true;
          this.makeResizable();
          this.div?.classList.add("selectedEditor");
          if (!this._editToolbar) {
            this.addEditToolbar().then(() => {
              if (this.div?.classList.contains("selectedEditor")) {
                this._editToolbar?.show();
              }
            });
            return;
          }
          this._editToolbar?.show();
          __privateGet(this, _altText3)?.toggleAltTextBadge(false);
        }
        focus() {
          if (this.div && !this.div.contains(document.activeElement)) {
            setTimeout(() => this.div?.focus({
              preventScroll: true
            }), 0);
          }
        }
        unselect() {
          if (!this.isSelected) {
            return;
          }
          this.isSelected = false;
          __privateGet(this, _resizersDiv)?.classList.add("hidden");
          this.div?.classList.remove("selectedEditor");
          if (this.div?.contains(document.activeElement)) {
            this._uiManager.currentLayer.div.focus({
              preventScroll: true
            });
          }
          this._editToolbar?.hide();
          __privateGet(this, _altText3)?.toggleAltTextBadge(true);
          this.hideCommentPopup();
        }
        hideCommentPopup() {
          if (this.hasComment) {
            this._uiManager.toggleComment(null);
          }
        }
        updateParams(type, value) {
        }
        disableEditing() {
        }
        enableEditing() {
        }
        get canChangeContent() {
          return false;
        }
        enterInEditMode() {
          if (!this.canChangeContent) {
            return;
          }
          this.enableEditMode();
          this.div.focus();
        }
        dblclick(event) {
          if (event.target.nodeName === "BUTTON") {
            return;
          }
          this.enterInEditMode();
          this.parent.updateToolbar({
            mode: this.constructor._editorType,
            editId: this.uid
          });
        }
        getElementForAltText() {
          return this.div;
        }
        get contentDiv() {
          return this.div;
        }
        get isEditing() {
          return __privateGet(this, _isEditing);
        }
        set isEditing(value) {
          __privateSet(this, _isEditing, value);
          if (!this.parent) {
            return;
          }
          if (value) {
            this.parent.setSelected(this);
            this.parent.setActiveEditor(this);
          } else {
            this.parent.setActiveEditor(null);
          }
        }
        static get MIN_SIZE() {
          return 16;
        }
        static canCreateNewEmptyEditor() {
          return true;
        }
        get telemetryInitialData() {
          return {
            action: "added"
          };
        }
        get telemetryFinalData() {
          return null;
        }
        _reportTelemetry(data, mustWait = false) {
          if (mustWait) {
            __privateGet(this, _telemetryTimeouts) || __privateSet(this, _telemetryTimeouts, /* @__PURE__ */ new Map());
            const {
              action
            } = data;
            let timeout = __privateGet(this, _telemetryTimeouts).get(action);
            if (timeout) {
              clearTimeout(timeout);
            }
            timeout = setTimeout(() => {
              this._reportTelemetry(data);
              __privateGet(this, _telemetryTimeouts).delete(action);
              if (__privateGet(this, _telemetryTimeouts).size === 0) {
                __privateSet(this, _telemetryTimeouts, null);
              }
            }, _AnnotationEditor._telemetryTimeout);
            __privateGet(this, _telemetryTimeouts).set(action, timeout);
            return;
          }
          data.type || (data.type = this.editorType);
          this._uiManager._eventBus.dispatch("reporttelemetry", {
            source: this,
            details: {
              type: "editing",
              data
            }
          });
        }
        show(visible = this._isVisible) {
          this.div.classList.toggle("hidden", !visible);
          this._isVisible = visible;
        }
        enable() {
          if (this.div) {
            this.div.tabIndex = 0;
          }
          __privateSet(this, _disabled, false);
        }
        disable() {
          if (this.div) {
            this.div.tabIndex = -1;
          }
          __privateSet(this, _disabled, true);
        }
        updateFakeAnnotationElement(annotationLayer) {
          if (!__privateGet(this, _fakeAnnotation) && !this.deleted) {
            __privateSet(this, _fakeAnnotation, annotationLayer.addFakeAnnotation(this));
            return;
          }
          if (this.deleted) {
            __privateGet(this, _fakeAnnotation).remove();
            __privateSet(this, _fakeAnnotation, null);
            return;
          }
          if (this.hasEditedComment || this._hasBeenMoved || this._hasBeenResized) {
            __privateGet(this, _fakeAnnotation).updateEdited({
              rect: this.getPDFRect(),
              popup: this.comment
            });
          }
        }
        renderAnnotationElement(annotation) {
          if (this.deleted) {
            annotation.hide();
            return null;
          }
          let content = annotation.container.querySelector(".annotationContent");
          if (!content) {
            content = document.createElement("div");
            content.classList.add("annotationContent", this.editorType);
            annotation.container.prepend(content);
          } else if (content.nodeName === "CANVAS") {
            const canvas = content;
            content = document.createElement("div");
            content.classList.add("annotationContent", this.editorType);
            canvas.before(content);
          }
          return content;
        }
        resetAnnotationElement(annotation) {
          const {
            firstElementChild
          } = annotation.container;
          if (firstElementChild?.nodeName === "DIV" && firstElementChild.classList.contains("annotationContent")) {
            firstElementChild.remove();
          }
        }
      };
      _accessibilityData = new WeakMap();
      _allResizerDivs = new WeakMap();
      _altText3 = new WeakMap();
      _comment2 = new WeakMap();
      _commentStandaloneButton2 = new WeakMap();
      _disabled = new WeakMap();
      _dragPointerId = new WeakMap();
      _dragPointerType = new WeakMap();
      _resizersDiv = new WeakMap();
      _lastPointerCoords = new WeakMap();
      _savedDimensions = new WeakMap();
      _fakeAnnotation = new WeakMap();
      _focusAC = new WeakMap();
      _focusedResizerName = new WeakMap();
      _hasBeenClicked = new WeakMap();
      _initialRect = new WeakMap();
      _isEditing = new WeakMap();
      _isInEditMode = new WeakMap();
      _isResizerEnabledForKeyboard = new WeakMap();
      _moveInDOMTimeout = new WeakMap();
      _prevDragX = new WeakMap();
      _prevDragY = new WeakMap();
      _telemetryTimeouts = new WeakMap();
      _touchManager = new WeakMap();
      _isDraggable = new WeakMap();
      _zIndex = new WeakMap();
      _AnnotationEditor_instances = new WeakSet();
      translate_fn = function([width, height], x, y) {
        [x, y] = this.screenToPageTranslation(x, y);
        this.x += x / width;
        this.y += y / height;
        this._onTranslating(this.x, this.y);
        this.fixAndSetPosition();
      };
      _AnnotationEditor_static = new WeakSet();
      rotatePoint_fn = function(x, y, angle) {
        switch (angle) {
          case 90:
            return [y, -x];
          case 180:
            return [-x, -y];
          case 270:
            return [-y, x];
          default:
            return [x, y];
        }
      };
      getRotationMatrix_fn = function(rotation) {
        switch (rotation) {
          case 90: {
            const [pageWidth, pageHeight] = this.pageDimensions;
            return [0, -pageWidth / pageHeight, pageHeight / pageWidth, 0];
          }
          case 180:
            return [-1, 0, 0, -1];
          case 270: {
            const [pageWidth, pageHeight] = this.pageDimensions;
            return [0, pageWidth / pageHeight, -pageHeight / pageWidth, 0];
          }
          default:
            return [1, 0, 0, 1];
        }
      };
      createResizers_fn = function() {
        if (__privateGet(this, _resizersDiv)) {
          return;
        }
        __privateSet(this, _resizersDiv, document.createElement("div"));
        __privateGet(this, _resizersDiv).classList.add("resizers");
        const classes = this._willKeepAspectRatio ? ["topLeft", "topRight", "bottomRight", "bottomLeft"] : ["topLeft", "topMiddle", "topRight", "middleRight", "bottomRight", "bottomMiddle", "bottomLeft", "middleLeft"];
        const signal = this._uiManager._signal;
        for (const name of classes) {
          const div = document.createElement("div");
          __privateGet(this, _resizersDiv).append(div);
          div.classList.add("resizer", name);
          div.setAttribute("data-resizer-name", name);
          div.addEventListener("pointerdown", __privateMethod(this, _AnnotationEditor_instances, resizerPointerdown_fn).bind(this, name), {
            signal
          });
          div.addEventListener("contextmenu", noContextMenu, {
            signal
          });
          div.tabIndex = -1;
        }
        this.div.prepend(__privateGet(this, _resizersDiv));
      };
      resizerPointerdown_fn = function(name, event) {
        event.preventDefault();
        const {
          isMac
        } = FeatureTest.platform;
        if (event.button !== 0 || event.ctrlKey && isMac) {
          return;
        }
        __privateGet(this, _altText3)?.toggle(false);
        const savedDraggable = this._isDraggable;
        this._isDraggable = false;
        __privateSet(this, _lastPointerCoords, [event.screenX, event.screenY]);
        const ac = new AbortController();
        const signal = this._uiManager.combinedSignal(ac);
        this.parent.togglePointerEvents(false);
        window.addEventListener("pointermove", __privateMethod(this, _AnnotationEditor_instances, resizerPointermove_fn).bind(this, name), {
          passive: true,
          capture: true,
          signal
        });
        window.addEventListener("touchmove", stopEvent, {
          passive: false,
          signal
        });
        window.addEventListener("contextmenu", noContextMenu, {
          signal
        });
        __privateSet(this, _savedDimensions, {
          savedX: this.x,
          savedY: this.y,
          savedWidth: this.width,
          savedHeight: this.height
        });
        const savedParentCursor = this.parent.div.style.cursor;
        const savedCursor = this.div.style.cursor;
        this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(event.target).cursor;
        const pointerUpCallback = () => {
          ac.abort();
          this.parent.togglePointerEvents(true);
          __privateGet(this, _altText3)?.toggle(true);
          this._isDraggable = savedDraggable;
          this.parent.div.style.cursor = savedParentCursor;
          this.div.style.cursor = savedCursor;
          __privateMethod(this, _AnnotationEditor_instances, addResizeToUndoStack_fn).call(this);
        };
        window.addEventListener("pointerup", pointerUpCallback, {
          signal
        });
        window.addEventListener("blur", pointerUpCallback, {
          signal
        });
      };
      resize_fn = function(x, y, width, height) {
        this.width = width;
        this.height = height;
        this.x = x;
        this.y = y;
        this.setDims();
        this.fixAndSetPosition();
        this._onResized();
      };
      addResizeToUndoStack_fn = function() {
        if (!__privateGet(this, _savedDimensions)) {
          return;
        }
        const {
          savedX,
          savedY,
          savedWidth,
          savedHeight
        } = __privateGet(this, _savedDimensions);
        __privateSet(this, _savedDimensions, null);
        const newX = this.x;
        const newY = this.y;
        const newWidth = this.width;
        const newHeight = this.height;
        if (newX === savedX && newY === savedY && newWidth === savedWidth && newHeight === savedHeight) {
          return;
        }
        this.addCommands({
          cmd: __privateMethod(this, _AnnotationEditor_instances, resize_fn).bind(this, newX, newY, newWidth, newHeight),
          undo: __privateMethod(this, _AnnotationEditor_instances, resize_fn).bind(this, savedX, savedY, savedWidth, savedHeight),
          mustExec: true
        });
      };
      resizerPointermove_fn = function(name, event) {
        const [parentWidth, parentHeight] = this.parentDimensions;
        const savedX = this.x;
        const savedY = this.y;
        const savedWidth = this.width;
        const savedHeight = this.height;
        const minWidth = _AnnotationEditor.MIN_SIZE / parentWidth;
        const minHeight = _AnnotationEditor.MIN_SIZE / parentHeight;
        const rotationMatrix = __privateMethod(this, _AnnotationEditor_instances, getRotationMatrix_fn).call(this, this.rotation);
        const transf = (x, y) => [rotationMatrix[0] * x + rotationMatrix[2] * y, rotationMatrix[1] * x + rotationMatrix[3] * y];
        const invRotationMatrix = __privateMethod(this, _AnnotationEditor_instances, getRotationMatrix_fn).call(this, 360 - this.rotation);
        const invTransf = (x, y) => [invRotationMatrix[0] * x + invRotationMatrix[2] * y, invRotationMatrix[1] * x + invRotationMatrix[3] * y];
        let getPoint;
        let getOpposite;
        let isDiagonal = false;
        let isHorizontal = false;
        switch (name) {
          case "topLeft":
            isDiagonal = true;
            getPoint = (w, h) => [0, 0];
            getOpposite = (w, h) => [w, h];
            break;
          case "topMiddle":
            getPoint = (w, h) => [w / 2, 0];
            getOpposite = (w, h) => [w / 2, h];
            break;
          case "topRight":
            isDiagonal = true;
            getPoint = (w, h) => [w, 0];
            getOpposite = (w, h) => [0, h];
            break;
          case "middleRight":
            isHorizontal = true;
            getPoint = (w, h) => [w, h / 2];
            getOpposite = (w, h) => [0, h / 2];
            break;
          case "bottomRight":
            isDiagonal = true;
            getPoint = (w, h) => [w, h];
            getOpposite = (w, h) => [0, 0];
            break;
          case "bottomMiddle":
            getPoint = (w, h) => [w / 2, h];
            getOpposite = (w, h) => [w / 2, 0];
            break;
          case "bottomLeft":
            isDiagonal = true;
            getPoint = (w, h) => [0, h];
            getOpposite = (w, h) => [w, 0];
            break;
          case "middleLeft":
            isHorizontal = true;
            getPoint = (w, h) => [0, h / 2];
            getOpposite = (w, h) => [w, h / 2];
            break;
        }
        const point = getPoint(savedWidth, savedHeight);
        const oppositePoint = getOpposite(savedWidth, savedHeight);
        let transfOppositePoint = transf(...oppositePoint);
        const oppositeX = _AnnotationEditor._round(savedX + transfOppositePoint[0]);
        const oppositeY = _AnnotationEditor._round(savedY + transfOppositePoint[1]);
        let ratioX = 1;
        let ratioY = 1;
        let deltaX, deltaY;
        if (!event.fromKeyboard) {
          const {
            screenX,
            screenY
          } = event;
          const [lastScreenX, lastScreenY] = __privateGet(this, _lastPointerCoords);
          [deltaX, deltaY] = this.screenToPageTranslation(screenX - lastScreenX, screenY - lastScreenY);
          __privateGet(this, _lastPointerCoords)[0] = screenX;
          __privateGet(this, _lastPointerCoords)[1] = screenY;
        } else {
          ({
            deltaX,
            deltaY
          } = event);
        }
        [deltaX, deltaY] = invTransf(deltaX / parentWidth, deltaY / parentHeight);
        if (isDiagonal) {
          const oldDiag = Math.hypot(savedWidth, savedHeight);
          ratioX = ratioY = Math.max(Math.min(Math.hypot(oppositePoint[0] - point[0] - deltaX, oppositePoint[1] - point[1] - deltaY) / oldDiag, 1 / savedWidth, 1 / savedHeight), minWidth / savedWidth, minHeight / savedHeight);
        } else if (isHorizontal) {
          ratioX = MathClamp(Math.abs(oppositePoint[0] - point[0] - deltaX), minWidth, 1) / savedWidth;
        } else {
          ratioY = MathClamp(Math.abs(oppositePoint[1] - point[1] - deltaY), minHeight, 1) / savedHeight;
        }
        const newWidth = _AnnotationEditor._round(savedWidth * ratioX);
        const newHeight = _AnnotationEditor._round(savedHeight * ratioY);
        transfOppositePoint = transf(...getOpposite(newWidth, newHeight));
        const newX = oppositeX - transfOppositePoint[0];
        const newY = oppositeY - transfOppositePoint[1];
        __privateGet(this, _initialRect) || __privateSet(this, _initialRect, [this.x, this.y, this.width, this.height]);
        this.width = newWidth;
        this.height = newHeight;
        this.x = newX;
        this.y = newY;
        this.setDims();
        this.fixAndSetPosition();
        this._onResizing();
      };
      touchPinchStartCallback_fn = function() {
        __privateSet(this, _savedDimensions, {
          savedX: this.x,
          savedY: this.y,
          savedWidth: this.width,
          savedHeight: this.height
        });
        __privateGet(this, _altText3)?.toggle(false);
        this.parent.togglePointerEvents(false);
      };
      touchPinchCallback_fn = function(_origin, prevDistance, distance) {
        const slowDownFactor = 0.7;
        let factor = slowDownFactor * (distance / prevDistance) + 1 - slowDownFactor;
        if (factor === 1) {
          return;
        }
        const rotationMatrix = __privateMethod(this, _AnnotationEditor_instances, getRotationMatrix_fn).call(this, this.rotation);
        const transf = (x, y) => [rotationMatrix[0] * x + rotationMatrix[2] * y, rotationMatrix[1] * x + rotationMatrix[3] * y];
        const [parentWidth, parentHeight] = this.parentDimensions;
        const savedX = this.x;
        const savedY = this.y;
        const savedWidth = this.width;
        const savedHeight = this.height;
        const minWidth = _AnnotationEditor.MIN_SIZE / parentWidth;
        const minHeight = _AnnotationEditor.MIN_SIZE / parentHeight;
        factor = Math.max(Math.min(factor, 1 / savedWidth, 1 / savedHeight), minWidth / savedWidth, minHeight / savedHeight);
        const newWidth = _AnnotationEditor._round(savedWidth * factor);
        const newHeight = _AnnotationEditor._round(savedHeight * factor);
        if (newWidth === savedWidth && newHeight === savedHeight) {
          return;
        }
        __privateGet(this, _initialRect) || __privateSet(this, _initialRect, [savedX, savedY, savedWidth, savedHeight]);
        const transfCenterPoint = transf(savedWidth / 2, savedHeight / 2);
        const centerX = _AnnotationEditor._round(savedX + transfCenterPoint[0]);
        const centerY = _AnnotationEditor._round(savedY + transfCenterPoint[1]);
        const newTransfCenterPoint = transf(newWidth / 2, newHeight / 2);
        this.x = centerX - newTransfCenterPoint[0];
        this.y = centerY - newTransfCenterPoint[1];
        this.width = newWidth;
        this.height = newHeight;
        this.setDims();
        this.fixAndSetPosition();
        this._onResizing();
      };
      touchPinchEndCallback_fn = function() {
        __privateGet(this, _altText3)?.toggle(true);
        this.parent.togglePointerEvents(true);
        __privateMethod(this, _AnnotationEditor_instances, addResizeToUndoStack_fn).call(this);
      };
      selectOnPointerEvent_fn = function(event) {
        const {
          isMac
        } = FeatureTest.platform;
        if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
          this.parent.toggleSelected(this);
        } else {
          this.parent.setSelected(this);
        }
      };
      setUpDragSession_fn = function(event) {
        const {
          isSelected
        } = this;
        this._uiManager.setUpDragSession();
        let hasDraggingStarted = false;
        const ac = new AbortController();
        const signal = this._uiManager.combinedSignal(ac);
        const opts = {
          capture: true,
          passive: false,
          signal
        };
        const cancelDrag = (e) => {
          ac.abort();
          __privateSet(this, _dragPointerId, null);
          __privateSet(this, _hasBeenClicked, false);
          if (!this._uiManager.endDragSession()) {
            __privateMethod(this, _AnnotationEditor_instances, selectOnPointerEvent_fn).call(this, e);
          }
          if (hasDraggingStarted) {
            this._onStopDragging();
          }
        };
        if (isSelected) {
          __privateSet(this, _prevDragX, event.clientX);
          __privateSet(this, _prevDragY, event.clientY);
          __privateSet(this, _dragPointerId, event.pointerId);
          __privateSet(this, _dragPointerType, event.pointerType);
          window.addEventListener("pointermove", (e) => {
            if (!hasDraggingStarted) {
              hasDraggingStarted = true;
              this._uiManager.toggleComment(this, true, false);
              this._onStartDragging();
            }
            const {
              clientX: x,
              clientY: y,
              pointerId
            } = e;
            if (pointerId !== __privateGet(this, _dragPointerId)) {
              stopEvent(e);
              return;
            }
            const [tx, ty] = this.screenToPageTranslation(x - __privateGet(this, _prevDragX), y - __privateGet(this, _prevDragY));
            __privateSet(this, _prevDragX, x);
            __privateSet(this, _prevDragY, y);
            this._uiManager.dragSelectedEditors(tx, ty);
          }, opts);
          window.addEventListener("touchmove", stopEvent, opts);
          window.addEventListener("pointerdown", (e) => {
            if (e.pointerType === __privateGet(this, _dragPointerType)) {
              if (__privateGet(this, _touchManager) || e.isPrimary) {
                cancelDrag(e);
              }
            }
            stopEvent(e);
          }, opts);
        }
        const pointerUpCallback = (e) => {
          if (!__privateGet(this, _dragPointerId) || __privateGet(this, _dragPointerId) === e.pointerId) {
            cancelDrag(e);
            return;
          }
          stopEvent(e);
        };
        window.addEventListener("pointerup", pointerUpCallback, {
          signal
        });
        window.addEventListener("blur", pointerUpCallback, {
          signal
        });
      };
      addFocusListeners_fn = function() {
        if (__privateGet(this, _focusAC) || !this.div) {
          return;
        }
        __privateSet(this, _focusAC, new AbortController());
        const signal = this._uiManager.combinedSignal(__privateGet(this, _focusAC));
        this.div.addEventListener("focusin", this.focusin.bind(this), {
          signal
        });
        this.div.addEventListener("focusout", this.focusout.bind(this), {
          signal
        });
      };
      resizerKeydown_fn = function(event) {
        _AnnotationEditor._resizerKeyboardManager.exec(this, event);
      };
      resizerBlur_fn = function(event) {
        if (__privateGet(this, _isResizerEnabledForKeyboard) && event.relatedTarget?.parentNode !== __privateGet(this, _resizersDiv)) {
          __privateMethod(this, _AnnotationEditor_instances, stopResizing_fn).call(this);
        }
      };
      resizerFocus_fn = function(name) {
        __privateSet(this, _focusedResizerName, __privateGet(this, _isResizerEnabledForKeyboard) ? name : "");
      };
      setResizerTabIndex_fn = function(value) {
        if (!__privateGet(this, _allResizerDivs)) {
          return;
        }
        for (const div of __privateGet(this, _allResizerDivs)) {
          div.tabIndex = value;
        }
      };
      stopResizing_fn = function() {
        __privateSet(this, _isResizerEnabledForKeyboard, false);
        __privateMethod(this, _AnnotationEditor_instances, setResizerTabIndex_fn).call(this, -1);
        __privateMethod(this, _AnnotationEditor_instances, addResizeToUndoStack_fn).call(this);
      };
      __privateAdd(_AnnotationEditor, _AnnotationEditor_static);
      __publicField(_AnnotationEditor, "_l10n", null);
      __publicField(_AnnotationEditor, "_l10nAlert", null);
      __publicField(_AnnotationEditor, "_l10nResizer", null);
      __publicField(_AnnotationEditor, "_borderLineWidth", -1);
      __publicField(_AnnotationEditor, "_colorManager", new ColorManager());
      __publicField(_AnnotationEditor, "_zIndex", 1);
      __publicField(_AnnotationEditor, "_telemetryTimeout", 1e3);
      AnnotationEditor = _AnnotationEditor;
      FakeEditor = class extends AnnotationEditor {
        constructor(params) {
          super(params);
          this.annotationElementId = params.annotationElementId;
          this.deleted = true;
        }
        serialize() {
          return this.serializeDeleted();
        }
      };
      SEED = 3285377520;
      MASK_HIGH = 4294901760;
      MASK_LOW = 65535;
      MurmurHash3_64 = class {
        constructor(seed) {
          this.h1 = seed ? seed & 4294967295 : SEED;
          this.h2 = seed ? seed & 4294967295 : SEED;
        }
        update(input) {
          let data, length;
          if (typeof input === "string") {
            data = new Uint8Array(input.length * 2);
            length = 0;
            for (let i = 0, ii = input.length; i < ii; i++) {
              const code = input.charCodeAt(i);
              if (code <= 255) {
                data[length++] = code;
              } else {
                data[length++] = code >>> 8;
                data[length++] = code & 255;
              }
            }
          } else if (ArrayBuffer.isView(input)) {
            data = input.slice();
            length = data.byteLength;
          } else {
            throw new Error("Invalid data format, must be a string or TypedArray.");
          }
          const blockCounts = length >> 2;
          const tailLength = length - blockCounts * 4;
          const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
          let k1 = 0, k2 = 0;
          let h1 = this.h1, h2 = this.h2;
          const C1 = 3432918353, C2 = 461845907;
          const C1_LOW = C1 & MASK_LOW, C2_LOW = C2 & MASK_LOW;
          for (let i = 0; i < blockCounts; i++) {
            if (i & 1) {
              k1 = dataUint32[i];
              k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
              k1 = k1 << 15 | k1 >>> 17;
              k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
              h1 ^= k1;
              h1 = h1 << 13 | h1 >>> 19;
              h1 = h1 * 5 + 3864292196;
            } else {
              k2 = dataUint32[i];
              k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
              k2 = k2 << 15 | k2 >>> 17;
              k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
              h2 ^= k2;
              h2 = h2 << 13 | h2 >>> 19;
              h2 = h2 * 5 + 3864292196;
            }
          }
          k1 = 0;
          switch (tailLength) {
            case 3:
              k1 ^= data[blockCounts * 4 + 2] << 16;
            case 2:
              k1 ^= data[blockCounts * 4 + 1] << 8;
            case 1:
              k1 ^= data[blockCounts * 4];
              k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
              k1 = k1 << 15 | k1 >>> 17;
              k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
              if (blockCounts & 1) {
                h1 ^= k1;
              } else {
                h2 ^= k1;
              }
          }
          this.h1 = h1;
          this.h2 = h2;
        }
        hexdigest() {
          let h1 = this.h1, h2 = this.h2;
          h1 ^= h2 >>> 1;
          h1 = h1 * 3981806797 & MASK_HIGH | h1 * 36045 & MASK_LOW;
          h2 = h2 * 4283543511 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 2950163797 & MASK_HIGH) >>> 16;
          h1 ^= h2 >>> 1;
          h1 = h1 * 444984403 & MASK_HIGH | h1 * 60499 & MASK_LOW;
          h2 = h2 * 3301882366 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 3120437893 & MASK_HIGH) >>> 16;
          h1 ^= h2 >>> 1;
          return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
        }
      };
      SerializableEmpty = Object.freeze({
        map: null,
        hash: "",
        transfer: void 0
      });
      AnnotationStorage = class {
        constructor() {
          __privateAdd(this, _AnnotationStorage_instances);
          __privateAdd(this, _modified, false);
          __privateAdd(this, _modifiedIds, null);
          __privateAdd(this, _editorsMap, null);
          __privateAdd(this, _storage, /* @__PURE__ */ new Map());
          __publicField(this, "onSetModified", null);
          __publicField(this, "onResetModified", null);
          __publicField(this, "onAnnotationEditor", null);
        }
        getValue(key, defaultValue) {
          const value = __privateGet(this, _storage).get(key);
          if (value === void 0) {
            return defaultValue;
          }
          return Object.assign(defaultValue, value);
        }
        getRawValue(key) {
          return __privateGet(this, _storage).get(key);
        }
        remove(key) {
          const storedValue = __privateGet(this, _storage).get(key);
          if (storedValue === void 0) {
            return;
          }
          if (storedValue instanceof AnnotationEditor) {
            __privateGet(this, _editorsMap).delete(storedValue.annotationElementId);
          }
          __privateGet(this, _storage).delete(key);
          if (__privateGet(this, _storage).size === 0) {
            this.resetModified();
          }
          if (__privateGet(this, _storage).values().some((v) => v instanceof AnnotationEditor)) {
            return;
          }
          this.onAnnotationEditor?.(null);
        }
        setValue(key, value) {
          const obj2 = __privateGet(this, _storage).get(key);
          let modified = false;
          if (obj2 !== void 0) {
            for (const [entry, val] of Object.entries(value)) {
              if (obj2[entry] !== val) {
                modified = true;
                obj2[entry] = val;
              }
            }
          } else {
            modified = true;
            __privateGet(this, _storage).set(key, value);
          }
          if (modified) {
            __privateMethod(this, _AnnotationStorage_instances, setModified_fn).call(this);
          }
          if (value instanceof AnnotationEditor) {
            (__privateGet(this, _editorsMap) || __privateSet(this, _editorsMap, /* @__PURE__ */ new Map())).set(value.annotationElementId, value);
            this.onAnnotationEditor?.(value.constructor._type);
          }
        }
        has(key) {
          return __privateGet(this, _storage).has(key);
        }
        get size() {
          return __privateGet(this, _storage).size;
        }
        resetModified() {
          if (__privateGet(this, _modified)) {
            __privateSet(this, _modified, false);
            this.onResetModified?.();
          }
        }
        get print() {
          return new PrintAnnotationStorage(this);
        }
        get serializable() {
          if (__privateGet(this, _storage).size === 0) {
            return SerializableEmpty;
          }
          const map2 = /* @__PURE__ */ new Map(), hash = new MurmurHash3_64(), transfer = [];
          const context = /* @__PURE__ */ Object.create(null);
          let hasBitmap = false;
          for (const [key, val] of __privateGet(this, _storage)) {
            const serialized = val instanceof AnnotationEditor ? val.serialize(false, context) : val;
            if (val.page) {
              val.pageIndex = val.page._pageIndex;
              delete val.page;
            }
            if (serialized) {
              map2.set(key, serialized);
              hash.update(`${key}:${JSON.stringify(serialized)}`);
              hasBitmap || (hasBitmap = !!serialized.bitmap);
            }
          }
          if (hasBitmap) {
            for (const value of map2.values()) {
              if (value.bitmap) {
                transfer.push(value.bitmap);
              }
            }
          }
          return map2.size > 0 ? {
            map: map2,
            hash: hash.hexdigest(),
            transfer
          } : SerializableEmpty;
        }
        get editorStats() {
          let stats = null;
          const typeToEditor = /* @__PURE__ */ new Map();
          let numberOfEditedComments = 0;
          let numberOfDeletedComments = 0;
          for (const value of __privateGet(this, _storage).values()) {
            if (!(value instanceof AnnotationEditor)) {
              if (value.popup) {
                if (value.popup.deleted) {
                  numberOfDeletedComments += 1;
                } else {
                  numberOfEditedComments += 1;
                }
              }
              continue;
            }
            if (value.isCommentDeleted) {
              numberOfDeletedComments += 1;
            } else if (value.hasEditedComment) {
              numberOfEditedComments += 1;
            }
            const editorStats = value.telemetryFinalData;
            if (!editorStats) {
              continue;
            }
            const {
              type
            } = editorStats;
            typeToEditor.getOrInsertComputed(type, () => Object.getPrototypeOf(value).constructor);
            stats || (stats = /* @__PURE__ */ Object.create(null));
            const map2 = stats[type] || (stats[type] = /* @__PURE__ */ new Map());
            for (const [key, val] of Object.entries(editorStats)) {
              if (key === "type") {
                continue;
              }
              const counters = map2.getOrInsertComputed(key, makeMap);
              counters.set(val, (counters.get(val) ?? 0) + 1);
            }
          }
          if (numberOfDeletedComments > 0 || numberOfEditedComments > 0) {
            stats || (stats = /* @__PURE__ */ Object.create(null));
            stats.comments = {
              deleted: numberOfDeletedComments,
              edited: numberOfEditedComments
            };
          }
          if (!stats) {
            return null;
          }
          for (const [type, editor] of typeToEditor) {
            stats[type] = editor.computeTelemetryFinalData(stats[type]);
          }
          return stats;
        }
        resetModifiedIds() {
          __privateSet(this, _modifiedIds, null);
        }
        updateEditor(annotationId, data) {
          const value = __privateGet(this, _editorsMap)?.get(annotationId);
          if (value) {
            value.updateFromAnnotationLayer(data);
            return true;
          }
          return false;
        }
        getEditor(annotationId) {
          return __privateGet(this, _editorsMap)?.get(annotationId) || null;
        }
        get modifiedIds() {
          if (__privateGet(this, _modifiedIds)) {
            return __privateGet(this, _modifiedIds);
          }
          const ids = [];
          if (__privateGet(this, _editorsMap)) {
            for (const value of __privateGet(this, _editorsMap).values()) {
              if (!value.serialize()) {
                continue;
              }
              ids.push(value.annotationElementId);
            }
          }
          let hash = "";
          if (ids.length) {
            const h = new MurmurHash3_64();
            h.update(ids.join(","));
            hash = h.hexdigest();
          }
          return __privateSet(this, _modifiedIds, {
            ids: new Set(ids),
            hash
          });
        }
        [Symbol.iterator]() {
          return __privateGet(this, _storage).entries();
        }
      };
      _modified = new WeakMap();
      _modifiedIds = new WeakMap();
      _editorsMap = new WeakMap();
      _storage = new WeakMap();
      _AnnotationStorage_instances = new WeakSet();
      setModified_fn = function() {
        if (!__privateGet(this, _modified)) {
          __privateSet(this, _modified, true);
          this.onSetModified?.();
        }
      };
      PrintAnnotationStorage = class extends AnnotationStorage {
        constructor(parent) {
          super();
          __privateAdd(this, _serializable, SerializableEmpty);
          const {
            serializable
          } = parent;
          if (serializable === SerializableEmpty) {
            return;
          }
          const {
            map: map2,
            hash,
            transfer
          } = serializable;
          const clone2 = structuredClone(map2, transfer ? {
            transfer
          } : null);
          __privateSet(this, _serializable, {
            map: clone2,
            hash,
            transfer: []
          });
        }
        get print() {
          unreachable("Should not call PrintAnnotationStorage.print");
        }
        get serializable() {
          return __privateGet(this, _serializable);
        }
        get modifiedIds() {
          return shadow(this, "modifiedIds", {
            ids: /* @__PURE__ */ new Set(),
            hash: ""
          });
        }
      };
      _serializable = new WeakMap();
      FORCED_DEPENDENCY_LABEL = "__forcedDependency";
      ({
        floor,
        ceil
      } = Math);
      EMPTY_BBOX = new Uint32Array(new Uint8Array([255, 255, 0, 0]).buffer)[0];
      BBoxReader = class {
        constructor(bboxes, coords) {
          __privateAdd(this, _bboxes);
          __privateAdd(this, _coords);
          __privateSet(this, _bboxes, bboxes);
          __privateSet(this, _coords, coords);
        }
        get length() {
          return __privateGet(this, _bboxes).length;
        }
        isEmpty(i) {
          return __privateGet(this, _bboxes)[i] === EMPTY_BBOX;
        }
        minX(i) {
          return __privateGet(this, _coords)[i * 4 + 0] / 256;
        }
        minY(i) {
          return __privateGet(this, _coords)[i * 4 + 1] / 256;
        }
        maxX(i) {
          return (__privateGet(this, _coords)[i * 4 + 2] + 1) / 256;
        }
        maxY(i) {
          return (__privateGet(this, _coords)[i * 4 + 3] + 1) / 256;
        }
      };
      _bboxes = new WeakMap();
      _coords = new WeakMap();
      ensureDebugMetadata = (map2, key) => map2?.getOrInsertComputed(key, () => ({
        dependencies: /* @__PURE__ */ new Set(),
        isRenderingOperation: false
      }));
      CanvasBBoxTracker = class {
        constructor(canvas, operationsCount) {
          __privateAdd(this, _CanvasBBoxTracker_instances);
          __privateAdd(this, _baseTransformStack, [[1, 0, 0, 1, 0, 0]]);
          __privateAdd(this, _clipBox, [-Infinity, -Infinity, Infinity, Infinity]);
          __privateAdd(this, _pendingBBox, new Float64Array(BBOX_INIT));
          __publicField(this, "_pendingBBoxIdx", -1);
          __privateAdd(this, _canvasWidth);
          __privateAdd(this, _canvasHeight);
          __privateAdd(this, _bboxesCoords);
          __privateAdd(this, _bboxes2);
          __publicField(this, "_savesStack", []);
          __publicField(this, "_markedContentStack", []);
          __privateSet(this, _canvasWidth, canvas.width);
          __privateSet(this, _canvasHeight, canvas.height);
          __privateMethod(this, _CanvasBBoxTracker_instances, initializeBBoxes_fn).call(this, operationsCount);
        }
        growOperationsCount(operationsCount) {
          if (operationsCount >= __privateGet(this, _bboxes2).length) {
            __privateMethod(this, _CanvasBBoxTracker_instances, initializeBBoxes_fn).call(this, operationsCount, __privateGet(this, _bboxes2));
          }
        }
        get clipBox() {
          return __privateGet(this, _clipBox);
        }
        save(opIdx) {
          __privateSet(this, _clipBox, {
            __proto__: __privateGet(this, _clipBox)
          });
          this._savesStack.push(opIdx);
          return this;
        }
        restore(opIdx, onSavePopped) {
          const previous = Object.getPrototypeOf(__privateGet(this, _clipBox));
          if (previous === null) {
            return this;
          }
          __privateSet(this, _clipBox, previous);
          const lastSave = this._savesStack.pop();
          if (lastSave !== void 0) {
            onSavePopped?.(lastSave, opIdx);
            __privateGet(this, _bboxes2)[opIdx] = __privateGet(this, _bboxes2)[lastSave];
          }
          return this;
        }
        recordOpenMarker(idx) {
          this._savesStack.push(idx);
          return this;
        }
        getOpenMarker() {
          if (this._savesStack.length === 0) {
            return null;
          }
          return this._savesStack.at(-1);
        }
        recordCloseMarker(opIdx, onSavePopped) {
          const lastSave = this._savesStack.pop();
          if (lastSave !== void 0) {
            onSavePopped?.(lastSave, opIdx);
            __privateGet(this, _bboxes2)[opIdx] = __privateGet(this, _bboxes2)[lastSave];
          }
          return this;
        }
        beginMarkedContent(opIdx) {
          this._markedContentStack.push(opIdx);
          return this;
        }
        endMarkedContent(opIdx, onSavePopped) {
          const lastSave = this._markedContentStack.pop();
          if (lastSave !== void 0) {
            onSavePopped?.(lastSave, opIdx);
            __privateGet(this, _bboxes2)[opIdx] = __privateGet(this, _bboxes2)[lastSave];
          }
          return this;
        }
        pushBaseTransform(ctx) {
          __privateGet(this, _baseTransformStack).push(Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform()));
          return this;
        }
        popBaseTransform() {
          if (__privateGet(this, _baseTransformStack).length > 1) {
            __privateGet(this, _baseTransformStack).pop();
          }
          return this;
        }
        resetBBox(idx) {
          if (this._pendingBBoxIdx !== idx) {
            this._pendingBBoxIdx = idx;
            __privateGet(this, _pendingBBox).set(BBOX_INIT, 0);
          }
          return this;
        }
        recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
          const transform = Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform());
          const clipBox = BBOX_INIT.slice();
          Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform, clipBox);
          const intersection2 = Util.intersect(__privateGet(this, _clipBox), clipBox);
          if (intersection2) {
            __privateGet(this, _clipBox)[0] = intersection2[0];
            __privateGet(this, _clipBox)[1] = intersection2[1];
            __privateGet(this, _clipBox)[2] = intersection2[2];
            __privateGet(this, _clipBox)[3] = intersection2[3];
          } else {
            __privateGet(this, _clipBox)[0] = __privateGet(this, _clipBox)[1] = Infinity;
            __privateGet(this, _clipBox)[2] = __privateGet(this, _clipBox)[3] = -Infinity;
          }
          return this;
        }
        recordBBox(idx, ctx, minX, maxX, minY, maxY) {
          const clipBox = __privateGet(this, _clipBox);
          if (clipBox[0] === Infinity) {
            return this;
          }
          const transform = Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform());
          if (clipBox[0] === -Infinity) {
            Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform, __privateGet(this, _pendingBBox));
            return this;
          }
          const bbox = BBOX_INIT.slice();
          Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform, bbox);
          __privateGet(this, _pendingBBox)[0] = MathClamp(bbox[0], clipBox[0], __privateGet(this, _pendingBBox)[0]);
          __privateGet(this, _pendingBBox)[1] = MathClamp(bbox[1], clipBox[1], __privateGet(this, _pendingBBox)[1]);
          __privateGet(this, _pendingBBox)[2] = MathClamp(bbox[2], __privateGet(this, _pendingBBox)[2], clipBox[2]);
          __privateGet(this, _pendingBBox)[3] = MathClamp(bbox[3], __privateGet(this, _pendingBBox)[3], clipBox[3]);
          return this;
        }
        recordFullPageBBox(idx) {
          __privateGet(this, _pendingBBox)[0] = Math.max(0, __privateGet(this, _clipBox)[0]);
          __privateGet(this, _pendingBBox)[1] = Math.max(0, __privateGet(this, _clipBox)[1]);
          __privateGet(this, _pendingBBox)[2] = Math.min(__privateGet(this, _canvasWidth), __privateGet(this, _clipBox)[2]);
          __privateGet(this, _pendingBBox)[3] = Math.min(__privateGet(this, _canvasHeight), __privateGet(this, _clipBox)[3]);
          return this;
        }
        recordOperation(idx, preserve = false, dependencyLists) {
          if (this._pendingBBoxIdx !== idx) {
            return this;
          }
          const minX = floor(__privateGet(this, _pendingBBox)[0] * 256 / __privateGet(this, _canvasWidth));
          const minY = floor(__privateGet(this, _pendingBBox)[1] * 256 / __privateGet(this, _canvasHeight));
          const maxX = ceil(__privateGet(this, _pendingBBox)[2] * 256 / __privateGet(this, _canvasWidth));
          const maxY = ceil(__privateGet(this, _pendingBBox)[3] * 256 / __privateGet(this, _canvasHeight));
          expandBBox(__privateGet(this, _bboxesCoords), idx, minX, minY, maxX, maxY);
          if (dependencyLists) {
            for (const dependencies of dependencyLists) {
              for (const depIdx of dependencies) {
                if (depIdx !== idx) {
                  expandBBox(__privateGet(this, _bboxesCoords), depIdx, minX, minY, maxX, maxY);
                }
              }
            }
          }
          if (!preserve) {
            this._pendingBBoxIdx = -1;
          }
          return this;
        }
        bboxToClipBoxDropOperation(idx) {
          if (this._pendingBBoxIdx === idx) {
            this._pendingBBoxIdx = -1;
            __privateGet(this, _clipBox)[0] = Math.max(__privateGet(this, _clipBox)[0], __privateGet(this, _pendingBBox)[0]);
            __privateGet(this, _clipBox)[1] = Math.max(__privateGet(this, _clipBox)[1], __privateGet(this, _pendingBBox)[1]);
            __privateGet(this, _clipBox)[2] = Math.min(__privateGet(this, _clipBox)[2], __privateGet(this, _pendingBBox)[2]);
            __privateGet(this, _clipBox)[3] = Math.min(__privateGet(this, _clipBox)[3], __privateGet(this, _pendingBBox)[3]);
          }
          return this;
        }
        take() {
          return new BBoxReader(__privateGet(this, _bboxes2), __privateGet(this, _bboxesCoords));
        }
        takeDebugMetadata() {
          throw new Error("Unreachable");
        }
        recordSimpleData(name, idx) {
          return this;
        }
        recordIncrementalData(name, idx) {
          return this;
        }
        resetIncrementalData(name, idx) {
          return this;
        }
        recordNamedData(name, idx) {
          return this;
        }
        recordSimpleDataFromNamed(name, depName, fallbackIdx) {
          return this;
        }
        recordFutureForcedDependency(name, idx) {
          return this;
        }
        inheritSimpleDataAsFutureForcedDependencies(names) {
          return this;
        }
        inheritPendingDependenciesAsFutureForcedDependencies() {
          return this;
        }
        recordCharacterBBox(idx, ctx, font, scale = 1, x = 0, y = 0, getMeasure) {
          return this;
        }
        getSimpleIndex(dependencyName) {
          return void 0;
        }
        recordDependencies(idx, dependencyNames) {
          return this;
        }
        recordNamedDependency(idx, name) {
          return this;
        }
        recordShowTextOperation(idx, preserve = false) {
          return this;
        }
      };
      _baseTransformStack = new WeakMap();
      _clipBox = new WeakMap();
      _pendingBBox = new WeakMap();
      _canvasWidth = new WeakMap();
      _canvasHeight = new WeakMap();
      _bboxesCoords = new WeakMap();
      _bboxes2 = new WeakMap();
      _CanvasBBoxTracker_instances = new WeakSet();
      initializeBBoxes_fn = function(operationsCount, oldBBoxes) {
        const buffer = new ArrayBuffer(operationsCount * 4);
        __privateSet(this, _bboxesCoords, new Uint8ClampedArray(buffer));
        __privateSet(this, _bboxes2, new Uint32Array(buffer));
        if (oldBBoxes && oldBBoxes.length > 0) {
          __privateGet(this, _bboxes2).set(oldBBoxes);
          __privateGet(this, _bboxes2).fill(EMPTY_BBOX, oldBBoxes.length);
        } else {
          __privateGet(this, _bboxes2).fill(EMPTY_BBOX);
        }
      };
      CanvasDependencyTracker = class {
        constructor(bboxTracker, recordDebugMetadata = false) {
          __privateAdd(this, _simple, {
            __proto__: null
          });
          __privateAdd(this, _incremental, {
            __proto__: null,
            transform: [],
            moveText: [],
            sameLineText: [],
            [FORCED_DEPENDENCY_LABEL]: []
          });
          __privateAdd(this, _namedDependencies, /* @__PURE__ */ new Map());
          __privateAdd(this, _pendingDependencies, /* @__PURE__ */ new Set());
          __privateAdd(this, _fontBBoxTrustworthy, /* @__PURE__ */ new Map());
          __privateAdd(this, _debugMetadata);
          __privateAdd(this, _recordDebugMetadataDepenencyAfterRestore);
          __privateAdd(this, _bboxTracker);
          __privateSet(this, _bboxTracker, bboxTracker);
          if (recordDebugMetadata) {
            __privateSet(this, _debugMetadata, /* @__PURE__ */ new Map());
            __privateSet(this, _recordDebugMetadataDepenencyAfterRestore, (lastSave, opIdx) => {
              ensureDebugMetadata(__privateGet(this, _debugMetadata), opIdx).dependencies.add(lastSave);
            });
          }
        }
        get clipBox() {
          return __privateGet(this, _bboxTracker).clipBox;
        }
        growOperationsCount(operationsCount) {
          __privateGet(this, _bboxTracker).growOperationsCount(operationsCount);
        }
        save(opIdx) {
          __privateSet(this, _simple, {
            __proto__: __privateGet(this, _simple)
          });
          __privateSet(this, _incremental, {
            __proto__: __privateGet(this, _incremental),
            transform: {
              __proto__: __privateGet(this, _incremental).transform
            },
            moveText: {
              __proto__: __privateGet(this, _incremental).moveText
            },
            sameLineText: {
              __proto__: __privateGet(this, _incremental).sameLineText
            },
            [FORCED_DEPENDENCY_LABEL]: {
              __proto__: __privateGet(this, _incremental)[FORCED_DEPENDENCY_LABEL]
            }
          });
          __privateGet(this, _bboxTracker).save(opIdx);
          return this;
        }
        restore(opIdx) {
          __privateGet(this, _bboxTracker).restore(opIdx, __privateGet(this, _recordDebugMetadataDepenencyAfterRestore));
          const previous = Object.getPrototypeOf(__privateGet(this, _simple));
          if (previous === null) {
            return this;
          }
          __privateSet(this, _simple, previous);
          __privateSet(this, _incremental, Object.getPrototypeOf(__privateGet(this, _incremental)));
          return this;
        }
        recordOpenMarker(opIdx) {
          __privateGet(this, _bboxTracker).recordOpenMarker(opIdx, __privateGet(this, _recordDebugMetadataDepenencyAfterRestore));
          return this;
        }
        getOpenMarker() {
          return __privateGet(this, _bboxTracker).getOpenMarker();
        }
        recordCloseMarker(opIdx) {
          __privateGet(this, _bboxTracker).recordCloseMarker(opIdx, __privateGet(this, _recordDebugMetadataDepenencyAfterRestore));
          return this;
        }
        beginMarkedContent(opIdx) {
          __privateGet(this, _bboxTracker).beginMarkedContent(opIdx);
          return this;
        }
        endMarkedContent(opIdx) {
          __privateGet(this, _bboxTracker).endMarkedContent(opIdx, __privateGet(this, _recordDebugMetadataDepenencyAfterRestore));
          return this;
        }
        pushBaseTransform(ctx) {
          __privateGet(this, _bboxTracker).pushBaseTransform(ctx);
          return this;
        }
        popBaseTransform() {
          __privateGet(this, _bboxTracker).popBaseTransform();
          return this;
        }
        recordSimpleData(name, idx) {
          __privateGet(this, _simple)[name] = idx;
          return this;
        }
        recordIncrementalData(name, idx) {
          __privateGet(this, _incremental)[name].push(idx);
          return this;
        }
        resetIncrementalData(name, idx) {
          __privateGet(this, _incremental)[name].length = 0;
          return this;
        }
        recordNamedData(name, idx) {
          __privateGet(this, _namedDependencies).set(name, idx);
          return this;
        }
        recordSimpleDataFromNamed(name, depName, fallbackIdx) {
          __privateGet(this, _simple)[name] = __privateGet(this, _namedDependencies).get(depName) ?? fallbackIdx;
        }
        recordFutureForcedDependency(name, idx) {
          this.recordIncrementalData(FORCED_DEPENDENCY_LABEL, idx);
          return this;
        }
        inheritSimpleDataAsFutureForcedDependencies(names) {
          for (const name of names) {
            if (name in __privateGet(this, _simple)) {
              this.recordFutureForcedDependency(name, __privateGet(this, _simple)[name]);
            }
          }
          return this;
        }
        inheritPendingDependenciesAsFutureForcedDependencies() {
          for (const dep of __privateGet(this, _pendingDependencies)) {
            this.recordFutureForcedDependency(FORCED_DEPENDENCY_LABEL, dep);
          }
          return this;
        }
        resetBBox(idx) {
          __privateGet(this, _bboxTracker).resetBBox(idx);
          return this;
        }
        recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
          __privateGet(this, _bboxTracker).recordClipBox(idx, ctx, minX, maxX, minY, maxY);
          return this;
        }
        recordBBox(idx, ctx, minX, maxX, minY, maxY) {
          __privateGet(this, _bboxTracker).recordBBox(idx, ctx, minX, maxX, minY, maxY);
          return this;
        }
        recordCharacterBBox(idx, ctx, font, scale = 1, x = 0, y = 0, getMeasure) {
          const fontBBox = font.bbox;
          let isBBoxTrustworthy;
          let computedBBox;
          if (fontBBox) {
            isBBoxTrustworthy = fontBBox[2] !== fontBBox[0] && fontBBox[3] !== fontBBox[1] && __privateGet(this, _fontBBoxTrustworthy).get(font);
            if (isBBoxTrustworthy !== false) {
              computedBBox = [0, 0, 0, 0];
              Util.axialAlignedBoundingBox(fontBBox, font.fontMatrix, computedBBox);
              if (scale !== 1 || x !== 0 || y !== 0) {
                scaleCharBBox(scale, -scale, x, y, computedBBox);
              }
              if (isBBoxTrustworthy) {
                return this.recordBBox(idx, ctx, computedBBox[0], computedBBox[2], computedBBox[1], computedBBox[3]);
              }
            }
          }
          if (!getMeasure) {
            return this.recordFullPageBBox(idx);
          }
          const measure = getMeasure();
          if (fontBBox && computedBBox && isBBoxTrustworthy === void 0) {
            isBBoxTrustworthy = computedBBox[0] <= x - measure.actualBoundingBoxLeft && computedBBox[2] >= x + measure.actualBoundingBoxRight && computedBBox[1] <= y - measure.actualBoundingBoxAscent && computedBBox[3] >= y + measure.actualBoundingBoxDescent;
            __privateGet(this, _fontBBoxTrustworthy).set(font, isBBoxTrustworthy);
            if (isBBoxTrustworthy) {
              return this.recordBBox(idx, ctx, computedBBox[0], computedBBox[2], computedBBox[1], computedBBox[3]);
            }
          }
          return this.recordBBox(idx, ctx, x - measure.actualBoundingBoxLeft, x + measure.actualBoundingBoxRight, y - measure.actualBoundingBoxAscent, y + measure.actualBoundingBoxDescent);
        }
        recordFullPageBBox(idx) {
          __privateGet(this, _bboxTracker).recordFullPageBBox(idx);
          return this;
        }
        getSimpleIndex(dependencyName) {
          return __privateGet(this, _simple)[dependencyName];
        }
        recordDependencies(idx, dependencyNames) {
          const pendingDependencies = __privateGet(this, _pendingDependencies);
          const simple = __privateGet(this, _simple);
          const incremental = __privateGet(this, _incremental);
          for (const name of dependencyNames) {
            if (name in __privateGet(this, _simple)) {
              pendingDependencies.add(simple[name]);
            } else if (name in incremental) {
              incremental[name].forEach(pendingDependencies.add, pendingDependencies);
            }
          }
          return this;
        }
        recordNamedDependency(idx, name) {
          if (__privateGet(this, _namedDependencies).has(name)) {
            __privateGet(this, _pendingDependencies).add(__privateGet(this, _namedDependencies).get(name));
          }
          return this;
        }
        recordOperation(idx, preserve = false) {
          this.recordDependencies(idx, [FORCED_DEPENDENCY_LABEL]);
          if (__privateGet(this, _debugMetadata)) {
            const metadata = ensureDebugMetadata(__privateGet(this, _debugMetadata), idx);
            const {
              dependencies
            } = metadata;
            __privateGet(this, _pendingDependencies).forEach(dependencies.add, dependencies);
            __privateGet(this, _bboxTracker)._savesStack.forEach(dependencies.add, dependencies);
            __privateGet(this, _bboxTracker)._markedContentStack.forEach(dependencies.add, dependencies);
            dependencies.delete(idx);
            metadata.isRenderingOperation = true;
          }
          const needsCleanup = !preserve && idx === __privateGet(this, _bboxTracker)._pendingBBoxIdx;
          __privateGet(this, _bboxTracker).recordOperation(idx, preserve, [__privateGet(this, _pendingDependencies), __privateGet(this, _bboxTracker)._savesStack, __privateGet(this, _bboxTracker)._markedContentStack]);
          if (needsCleanup) {
            __privateGet(this, _pendingDependencies).clear();
          }
          return this;
        }
        recordShowTextOperation(idx, preserve = false) {
          const deps = Array.from(__privateGet(this, _pendingDependencies));
          this.recordOperation(idx, preserve);
          this.recordIncrementalData("sameLineText", idx);
          for (const dep of deps) {
            this.recordIncrementalData("sameLineText", dep);
          }
          return this;
        }
        bboxToClipBoxDropOperation(idx, preserve = false) {
          const needsCleanup = !preserve && idx === __privateGet(this, _bboxTracker)._pendingBBoxIdx;
          __privateGet(this, _bboxTracker).bboxToClipBoxDropOperation(idx);
          if (needsCleanup) {
            __privateGet(this, _pendingDependencies).clear();
          }
          return this;
        }
        take() {
          __privateGet(this, _fontBBoxTrustworthy).clear();
          return __privateGet(this, _bboxTracker).take();
        }
        takeDebugMetadata() {
          return __privateGet(this, _debugMetadata);
        }
      };
      _simple = new WeakMap();
      _incremental = new WeakMap();
      _namedDependencies = new WeakMap();
      _pendingDependencies = new WeakMap();
      _fontBBoxTrustworthy = new WeakMap();
      _debugMetadata = new WeakMap();
      _recordDebugMetadataDepenencyAfterRestore = new WeakMap();
      _bboxTracker = new WeakMap();
      _CanvasNestedDependencyTracker = class _CanvasNestedDependencyTracker {
        constructor(dependencyTracker, opIdx, ignoreBBoxes) {
          __privateAdd(this, _dependencyTracker);
          __privateAdd(this, _opIdx);
          __privateAdd(this, _ignoreBBoxes);
          __privateAdd(this, _nestingLevel, 0);
          __privateAdd(this, _savesLevel, 0);
          if (dependencyTracker instanceof _CanvasNestedDependencyTracker && __privateGet(dependencyTracker, _ignoreBBoxes) === !!ignoreBBoxes) {
            return dependencyTracker;
          }
          __privateSet(this, _dependencyTracker, dependencyTracker);
          __privateSet(this, _opIdx, opIdx);
          __privateSet(this, _ignoreBBoxes, !!ignoreBBoxes);
        }
        get clipBox() {
          return __privateGet(this, _dependencyTracker).clipBox;
        }
        growOperationsCount() {
          throw new Error("Unreachable");
        }
        save(opIdx) {
          __privateWrapper(this, _savesLevel)._++;
          __privateGet(this, _dependencyTracker).save(__privateGet(this, _opIdx));
          return this;
        }
        restore(opIdx) {
          if (__privateGet(this, _savesLevel) > 0) {
            __privateGet(this, _dependencyTracker).restore(__privateGet(this, _opIdx));
            __privateWrapper(this, _savesLevel)._--;
          }
          return this;
        }
        recordOpenMarker(idx) {
          __privateWrapper(this, _nestingLevel)._++;
          return this;
        }
        getOpenMarker() {
          return __privateGet(this, _nestingLevel) > 0 ? __privateGet(this, _opIdx) : __privateGet(this, _dependencyTracker).getOpenMarker();
        }
        recordCloseMarker(idx) {
          __privateWrapper(this, _nestingLevel)._--;
          return this;
        }
        beginMarkedContent(opIdx) {
          return this;
        }
        endMarkedContent(opIdx) {
          return this;
        }
        pushBaseTransform(ctx) {
          __privateGet(this, _dependencyTracker).pushBaseTransform(ctx);
          return this;
        }
        popBaseTransform() {
          __privateGet(this, _dependencyTracker).popBaseTransform();
          return this;
        }
        recordSimpleData(name, idx) {
          __privateGet(this, _dependencyTracker).recordSimpleData(name, __privateGet(this, _opIdx));
          return this;
        }
        recordIncrementalData(name, idx) {
          __privateGet(this, _dependencyTracker).recordIncrementalData(name, __privateGet(this, _opIdx));
          return this;
        }
        resetIncrementalData(name, idx) {
          __privateGet(this, _dependencyTracker).resetIncrementalData(name, __privateGet(this, _opIdx));
          return this;
        }
        recordNamedData(name, idx) {
          return this;
        }
        recordSimpleDataFromNamed(name, depName, fallbackIdx) {
          __privateGet(this, _dependencyTracker).recordSimpleDataFromNamed(name, depName, __privateGet(this, _opIdx));
          return this;
        }
        recordFutureForcedDependency(name, idx) {
          __privateGet(this, _dependencyTracker).recordFutureForcedDependency(name, __privateGet(this, _opIdx));
          return this;
        }
        inheritSimpleDataAsFutureForcedDependencies(names) {
          __privateGet(this, _dependencyTracker).inheritSimpleDataAsFutureForcedDependencies(names);
          return this;
        }
        inheritPendingDependenciesAsFutureForcedDependencies() {
          __privateGet(this, _dependencyTracker).inheritPendingDependenciesAsFutureForcedDependencies();
          return this;
        }
        resetBBox(idx) {
          if (!__privateGet(this, _ignoreBBoxes)) {
            __privateGet(this, _dependencyTracker).resetBBox(__privateGet(this, _opIdx));
          }
          return this;
        }
        recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
          if (!__privateGet(this, _ignoreBBoxes)) {
            __privateGet(this, _dependencyTracker).recordClipBox(__privateGet(this, _opIdx), ctx, minX, maxX, minY, maxY);
          }
          return this;
        }
        recordBBox(idx, ctx, minX, maxX, minY, maxY) {
          if (!__privateGet(this, _ignoreBBoxes)) {
            __privateGet(this, _dependencyTracker).recordBBox(__privateGet(this, _opIdx), ctx, minX, maxX, minY, maxY);
          }
          return this;
        }
        recordCharacterBBox(idx, ctx, font, scale, x, y, getMeasure) {
          if (!__privateGet(this, _ignoreBBoxes)) {
            __privateGet(this, _dependencyTracker).recordCharacterBBox(__privateGet(this, _opIdx), ctx, font, scale, x, y, getMeasure);
          }
          return this;
        }
        recordFullPageBBox(idx) {
          if (!__privateGet(this, _ignoreBBoxes)) {
            __privateGet(this, _dependencyTracker).recordFullPageBBox(__privateGet(this, _opIdx));
          }
          return this;
        }
        getSimpleIndex(dependencyName) {
          return __privateGet(this, _dependencyTracker).getSimpleIndex(dependencyName);
        }
        recordDependencies(idx, dependencyNames) {
          __privateGet(this, _dependencyTracker).recordDependencies(__privateGet(this, _opIdx), dependencyNames);
          return this;
        }
        recordNamedDependency(idx, name) {
          __privateGet(this, _dependencyTracker).recordNamedDependency(__privateGet(this, _opIdx), name);
          return this;
        }
        recordOperation(idx) {
          __privateGet(this, _dependencyTracker).recordOperation(__privateGet(this, _opIdx), true);
          return this;
        }
        recordShowTextOperation(idx) {
          __privateGet(this, _dependencyTracker).recordShowTextOperation(__privateGet(this, _opIdx), true);
          return this;
        }
        bboxToClipBoxDropOperation(idx) {
          if (!__privateGet(this, _ignoreBBoxes)) {
            __privateGet(this, _dependencyTracker).bboxToClipBoxDropOperation(__privateGet(this, _opIdx), true);
          }
          return this;
        }
        take() {
          throw new Error("Unreachable");
        }
        takeDebugMetadata() {
          throw new Error("Unreachable");
        }
      };
      _dependencyTracker = new WeakMap();
      _opIdx = new WeakMap();
      _ignoreBBoxes = new WeakMap();
      _nestingLevel = new WeakMap();
      _savesLevel = new WeakMap();
      CanvasNestedDependencyTracker = _CanvasNestedDependencyTracker;
      Dependencies = {
        stroke: ["path", "transform", "filter", "strokeColor", "strokeAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "dash"],
        fill: ["path", "transform", "filter", "fillColor", "fillAlpha", "globalCompositeOperation", "SMask"],
        imageXObject: ["transform", "SMask", "filter", "fillAlpha", "strokeAlpha", "globalCompositeOperation"],
        rawFillPath: ["filter", "fillColor", "fillAlpha"],
        showText: ["transform", "leading", "charSpacing", "wordSpacing", "hScale", "textRise", "moveText", "textMatrix", "font", "fontObj", "filter", "fillColor", "textRenderingMode", "SMask", "fillAlpha", "strokeAlpha", "globalCompositeOperation", "sameLineText"],
        transform: ["transform"],
        transformAndFill: ["transform", "fillColor"]
      };
      _CanvasImagesTracker = class _CanvasImagesTracker {
        constructor(canvas) {
          __privateAdd(this, _canvasWidth2);
          __privateAdd(this, _canvasHeight2);
          __privateAdd(this, _capacity, 4);
          __privateAdd(this, _count, 0);
          __privateAdd(this, _coords2, new (__privateGet(_CanvasImagesTracker, _CoordsArray))(__privateGet(this, _capacity) * 6));
          __privateSet(this, _canvasWidth2, canvas.width);
          __privateSet(this, _canvasHeight2, canvas.height);
        }
        record(ctx, width, height, clipBox) {
          if (__privateGet(this, _count) === __privateGet(this, _capacity)) {
            __privateSet(this, _capacity, __privateGet(this, _capacity) * 2);
            const newCoords = new (__privateGet(_CanvasImagesTracker, _CoordsArray))(__privateGet(this, _capacity) * 6);
            newCoords.set(__privateGet(this, _coords2));
            __privateSet(this, _coords2, newCoords);
          }
          const transform = getCurrentTransform(ctx);
          let coords;
          if (clipBox[0] !== Infinity) {
            const bbox = BBOX_INIT.slice();
            Util.axialAlignedBoundingBox([0, -height, width, 0], transform, bbox);
            const finalBBox = Util.intersect(clipBox, bbox);
            if (!finalBBox) {
              return;
            }
            const [minX, minY, maxX, maxY] = finalBBox;
            if (minX !== bbox[0] || minY !== bbox[1] || maxX !== bbox[2] || maxY !== bbox[3]) {
              const rotationAngle = Math.atan2(transform[1], transform[0]);
              const sin = Math.abs(Math.sin(rotationAngle));
              const cos = Math.abs(Math.cos(rotationAngle));
              if (sin < 1e-6 || cos < 1e-6 || Math.abs(sin - cos) < 1e-6) {
                coords = [minX, minY, minX, maxY, maxX, minY];
              } else {
                const finalBBoxWidth = maxX - minX;
                const finalBBoxHeight = maxY - minY;
                const sin2 = sin * sin;
                const cos2 = cos * cos;
                const cosSin = cos * sin;
                const denom = cos2 - sin2;
                const a = (finalBBoxHeight * cos2 - finalBBoxWidth * cosSin) / denom;
                const b = (finalBBoxHeight * cosSin - finalBBoxWidth * sin2) / denom;
                coords = [minX + b, minY, minX, minY + a, maxX, maxY - a];
              }
            }
          }
          if (!coords) {
            coords = [0, -height, 0, 0, width, -height];
            Util.applyTransform(coords, transform, 0);
            Util.applyTransform(coords, transform, 2);
            Util.applyTransform(coords, transform, 4);
          }
          coords[0] /= __privateGet(this, _canvasWidth2);
          coords[1] /= __privateGet(this, _canvasHeight2);
          coords[2] /= __privateGet(this, _canvasWidth2);
          coords[3] /= __privateGet(this, _canvasHeight2);
          coords[4] /= __privateGet(this, _canvasWidth2);
          coords[5] /= __privateGet(this, _canvasHeight2);
          __privateGet(this, _coords2).set(coords, __privateGet(this, _count) * 6);
          __privateWrapper(this, _count)._++;
        }
        take() {
          return __privateGet(this, _coords2).subarray(0, __privateGet(this, _count) * 6);
        }
      };
      _canvasWidth2 = new WeakMap();
      _canvasHeight2 = new WeakMap();
      _capacity = new WeakMap();
      _count = new WeakMap();
      _coords2 = new WeakMap();
      _CoordsArray = new WeakMap();
      __privateAdd(_CanvasImagesTracker, _CoordsArray, FeatureTest.isFloat16ArraySupported ? Float16Array : Float32Array);
      CanvasImagesTracker = _CanvasImagesTracker;
      FontLoader = class {
        constructor({
          ownerDocument = globalThis.document,
          styleElement = null
        }) {
          __privateAdd(this, _FontLoader_instances);
          __privateAdd(this, _systemFonts, /* @__PURE__ */ new Set());
          __privateAdd(this, _styleSheet, null);
          this._document = ownerDocument;
          this.nativeFontFaces = /* @__PURE__ */ new Set();
          this.styleElement = null;
          this.loadingRequests = [];
          this.loadTestFontId = 0;
        }
        addNativeFontFace(nativeFontFace) {
          this.nativeFontFaces.add(nativeFontFace);
          this._document.fonts.add(nativeFontFace);
        }
        removeNativeFontFace(nativeFontFace) {
          this.nativeFontFaces.delete(nativeFontFace);
          this._document.fonts.delete(nativeFontFace);
        }
        insertRule(rule) {
          const styleSheet = __privateMethod(this, _FontLoader_instances, getStyleSheet_fn).call(this);
          styleSheet.insertRule(rule, styleSheet.cssRules.length);
        }
        clear() {
          for (const nativeFontFace of this.nativeFontFaces) {
            this._document.fonts.delete(nativeFontFace);
          }
          this.nativeFontFaces.clear();
          __privateGet(this, _systemFonts).clear();
          if (__privateGet(this, _styleSheet)) {
            const {
              adoptedStyleSheets
            } = this._document;
            if (adoptedStyleSheets?.includes(__privateGet(this, _styleSheet))) {
              this._document.adoptedStyleSheets = adoptedStyleSheets.filter((styleSheet) => styleSheet !== __privateGet(this, _styleSheet));
            }
            __privateSet(this, _styleSheet, null);
          }
          if (this.styleElement) {
            this.styleElement.remove();
            this.styleElement = null;
          }
        }
        async loadSystemFont({
          systemFontInfo: info2,
          disableFontFace,
          _inspectFont
        }) {
          if (!info2 || __privateGet(this, _systemFonts).has(info2.loadedName)) {
            return;
          }
          assert(!disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set.");
          if (this.isFontLoadingAPISupported) {
            const {
              loadedName,
              src,
              style
            } = info2;
            const fontFace = new FontFace(loadedName, src, style);
            this.addNativeFontFace(fontFace);
            try {
              await fontFace.load();
              __privateGet(this, _systemFonts).add(loadedName);
              _inspectFont?.(info2);
            } catch {
              warn(`Cannot load system font: ${info2.baseFontName}, installing it could help to improve PDF rendering.`);
              this.removeNativeFontFace(fontFace);
            }
            return;
          }
          unreachable("Not implemented: loadSystemFont without the Font Loading API.");
        }
        async bind(font) {
          if (font.attached || font.missingFile && !font.systemFontInfo) {
            return;
          }
          font.attached = true;
          if (font.systemFontInfo) {
            await this.loadSystemFont(font);
            return;
          }
          if (this.isFontLoadingAPISupported) {
            const nativeFontFace = font.createNativeFontFace();
            if (nativeFontFace) {
              this.addNativeFontFace(nativeFontFace);
              try {
                await nativeFontFace.loaded;
              } catch (ex) {
                warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
                font.disableFontFace = true;
                throw ex;
              }
            }
            return;
          }
          const rule = font.createFontFaceRule();
          if (rule) {
            this.insertRule(rule);
            if (this.isSyncFontLoadingSupported) {
              return;
            }
            await new Promise((resolve) => {
              const request = this._queueLoadingCallback(resolve);
              this._prepareFontLoadEvent(font, request);
            });
          }
        }
        get isFontLoadingAPISupported() {
          const hasFonts = !!this._document?.fonts;
          return shadow(this, "isFontLoadingAPISupported", hasFonts);
        }
        get isSyncFontLoadingSupported() {
          return shadow(this, "isSyncFontLoadingSupported", isNodeJS || FeatureTest.platform.isFirefox);
        }
        _queueLoadingCallback(callback) {
          function completeRequest() {
            assert(!request.done, "completeRequest() cannot be called twice.");
            request.done = true;
            while (loadingRequests.length > 0 && loadingRequests[0].done) {
              const otherRequest = loadingRequests.shift();
              setTimeout(otherRequest.callback, 0);
            }
          }
          const {
            loadingRequests
          } = this;
          const request = {
            done: false,
            complete: completeRequest,
            callback
          };
          loadingRequests.push(request);
          return request;
        }
        get _loadTestFont() {
          const testFont = atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");
          return shadow(this, "_loadTestFont", testFont);
        }
        _prepareFontLoadEvent(font, request) {
          function int32(data2, offset) {
            return data2.charCodeAt(offset) << 24 | data2.charCodeAt(offset + 1) << 16 | data2.charCodeAt(offset + 2) << 8 | data2.charCodeAt(offset + 3) & 255;
          }
          function string32(value) {
            return String.fromCharCode(value >> 24 & 255, value >> 16 & 255, value >> 8 & 255, value & 255);
          }
          function spliceString(s, offset, remove2, insert) {
            const chunk1 = s.substring(0, offset);
            const chunk2 = s.substring(offset + remove2);
            return chunk1 + insert + chunk2;
          }
          let i, ii;
          const canvas = this._document.createElement("canvas");
          canvas.width = 1;
          canvas.height = 1;
          const ctx = canvas.getContext("2d");
          let called = 0;
          function isFontReady(name, callback) {
            if (++called > 30) {
              warn("Load test font never loaded.");
              callback();
              return;
            }
            ctx.font = "30px " + name;
            ctx.fillText(".", 0, 20);
            const imageData = ctx.getImageData(0, 0, 1, 1);
            if (imageData.data[3] > 0) {
              callback();
              return;
            }
            setTimeout(isFontReady.bind(null, name, callback));
          }
          const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`;
          let data = this._loadTestFont;
          const COMMENT_OFFSET = 976;
          data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);
          const CFF_CHECKSUM_OFFSET = 16;
          const XXXX_VALUE = 1482184792;
          let checksum = int32(data, CFF_CHECKSUM_OFFSET);
          for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
            checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;
          }
          if (i < loadTestFontId.length) {
            checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0;
          }
          data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, string32(checksum));
          const url = `url(data:font/opentype;base64,${btoa(data)});`;
          const rule = `@font-face {font-family:"${loadTestFontId}";src:${url}}`;
          this.insertRule(rule);
          const div = this._document.createElement("div");
          div.style.visibility = "hidden";
          div.style.width = div.style.height = "10px";
          div.style.position = "absolute";
          div.style.top = div.style.left = "0px";
          for (const name of [font.loadedName, loadTestFontId]) {
            const span = this._document.createElement("span");
            span.textContent = "Hi";
            span.style.fontFamily = name;
            div.append(span);
          }
          this._document.body.append(div);
          isFontReady(loadTestFontId, () => {
            div.remove();
            request.complete();
          });
        }
      };
      _systemFonts = new WeakMap();
      _styleSheet = new WeakMap();
      _FontLoader_instances = new WeakSet();
      getStyleSheet_fn = function() {
        if (__privateGet(this, _styleSheet)) {
          return __privateGet(this, _styleSheet);
        }
        const StyleSheet = this._document.defaultView?.CSSStyleSheet || globalThis.CSSStyleSheet;
        if (!this.styleElement && StyleSheet) {
          const {
            adoptedStyleSheets
          } = this._document;
          if (adoptedStyleSheets) {
            const styleSheet = new StyleSheet();
            adoptedStyleSheets.push(styleSheet);
            return __privateSet(this, _styleSheet, styleSheet);
          }
        }
        if (!this.styleElement) {
          this.styleElement = this._document.createElement("style");
          this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement);
        }
        return __privateSet(this, _styleSheet, this.styleElement.sheet);
      };
      FontFaceObject = class {
        constructor(translatedData, inspectFont = null, charProcOperatorList, extra) {
          __publicField(this, "compiledGlyphs", /* @__PURE__ */ Object.create(null));
          __privateAdd(this, _fontData);
          __privateSet(this, _fontData, translatedData);
          this._inspectFont = inspectFont;
          if (charProcOperatorList) {
            this.charProcOperatorList = charProcOperatorList;
          }
          if (extra) {
            Object.assign(this, extra);
          }
        }
        createNativeFontFace() {
          if (!this.data || this.disableFontFace) {
            return null;
          }
          let nativeFontFace;
          if (!this.cssFontInfo) {
            nativeFontFace = new FontFace(this.loadedName, this.data, {});
          } else {
            const css = {
              weight: this.cssFontInfo.fontWeight
            };
            if (this.cssFontInfo.italicAngle) {
              css.style = `oblique ${this.cssFontInfo.italicAngle}deg`;
            }
            nativeFontFace = new FontFace(this.cssFontInfo.fontFamily, this.data, css);
          }
          this._inspectFont?.(this);
          return nativeFontFace;
        }
        createFontFaceRule() {
          if (!this.data || this.disableFontFace) {
            return null;
          }
          const url = `url(data:${this.mimetype};base64,${this.data.toBase64()});`;
          let rule;
          if (!this.cssFontInfo) {
            rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`;
          } else {
            let css = `font-weight: ${this.cssFontInfo.fontWeight};`;
            if (this.cssFontInfo.italicAngle) {
              css += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;
            }
            rule = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${css}src:${url}}`;
          }
          this._inspectFont?.(this, url);
          return rule;
        }
        getPathGenerator(objs, character) {
          if (this.compiledGlyphs[character] !== void 0) {
            return this.compiledGlyphs[character];
          }
          const objId = this.loadedName + "_path_" + character;
          let cmds;
          try {
            cmds = objs.get(objId);
          } catch (ex) {
            warn(`getPathGenerator - ignoring character: "${ex}".`);
          }
          const path = makePathFromDrawOPS(cmds?.path);
          if (!this.fontExtraProperties) {
            objs.delete(objId);
          }
          return this.compiledGlyphs[character] = path;
        }
        get black() {
          return __privateGet(this, _fontData).black;
        }
        get bold() {
          return __privateGet(this, _fontData).bold;
        }
        get disableFontFace() {
          return __privateGet(this, _fontData).disableFontFace;
        }
        set disableFontFace(value) {
          shadow(this, "disableFontFace", !!value);
        }
        get fontExtraProperties() {
          return __privateGet(this, _fontData).fontExtraProperties;
        }
        get isInvalidPDFjsFont() {
          return __privateGet(this, _fontData).isInvalidPDFjsFont;
        }
        get isType3Font() {
          return __privateGet(this, _fontData).isType3Font;
        }
        get italic() {
          return __privateGet(this, _fontData).italic;
        }
        get missingFile() {
          return __privateGet(this, _fontData).missingFile;
        }
        get remeasure() {
          return __privateGet(this, _fontData).remeasure;
        }
        get vertical() {
          return __privateGet(this, _fontData).vertical;
        }
        get ascent() {
          return __privateGet(this, _fontData).ascent;
        }
        get defaultWidth() {
          return __privateGet(this, _fontData).defaultWidth;
        }
        get descent() {
          return __privateGet(this, _fontData).descent;
        }
        get bbox() {
          return __privateGet(this, _fontData).bbox;
        }
        get fontMatrix() {
          return __privateGet(this, _fontData).fontMatrix;
        }
        get fallbackName() {
          return __privateGet(this, _fontData).fallbackName;
        }
        get loadedName() {
          return __privateGet(this, _fontData).loadedName;
        }
        get mimetype() {
          return __privateGet(this, _fontData).mimetype;
        }
        get name() {
          return __privateGet(this, _fontData).name;
        }
        get data() {
          return __privateGet(this, _fontData).data;
        }
        clearData() {
          __privateGet(this, _fontData).clearData();
        }
        get cssFontInfo() {
          return __privateGet(this, _fontData).cssFontInfo;
        }
        get systemFontInfo() {
          return __privateGet(this, _fontData).systemFontInfo;
        }
        get defaultVMetrics() {
          return __privateGet(this, _fontData).defaultVMetrics;
        }
      };
      _fontData = new WeakMap();
      CSS_FONT_INFO = class {
      };
      __publicField(CSS_FONT_INFO, "strings", ["fontFamily", "fontWeight", "italicAngle"]);
      SYSTEM_FONT_INFO = class {
      };
      __publicField(SYSTEM_FONT_INFO, "strings", ["css", "loadedName", "baseFontName", "src"]);
      _FONT_INFO = class _FONT_INFO {
      };
      __publicField(_FONT_INFO, "bools", ["black", "bold", "disableFontFace", "fontExtraProperties", "isInvalidPDFjsFont", "isType3Font", "italic", "missingFile", "remeasure", "vertical"]);
      __publicField(_FONT_INFO, "numbers", ["ascent", "defaultWidth", "descent"]);
      __publicField(_FONT_INFO, "strings", ["fallbackName", "loadedName", "mimetype", "name"]);
      __publicField(_FONT_INFO, "OFFSET_NUMBERS", Math.ceil(_FONT_INFO.bools.length * 2 / 8));
      __publicField(_FONT_INFO, "OFFSET_BBOX", _FONT_INFO.OFFSET_NUMBERS + _FONT_INFO.numbers.length * 8);
      __publicField(_FONT_INFO, "OFFSET_FONT_MATRIX", _FONT_INFO.OFFSET_BBOX + 1 + 2 * 4);
      __publicField(_FONT_INFO, "OFFSET_DEFAULT_VMETRICS", _FONT_INFO.OFFSET_FONT_MATRIX + 1 + 8 * 6);
      __publicField(_FONT_INFO, "OFFSET_STRINGS", _FONT_INFO.OFFSET_DEFAULT_VMETRICS + 1 + 2 * 3);
      FONT_INFO = _FONT_INFO;
      PATTERN_INFO = class {
      };
      __publicField(PATTERN_INFO, "KIND", 0);
      __publicField(PATTERN_INFO, "HAS_BBOX", 1);
      __publicField(PATTERN_INFO, "HAS_BACKGROUND", 2);
      __publicField(PATTERN_INFO, "SHADING_TYPE", 3);
      __publicField(PATTERN_INFO, "N_COORD", 4);
      __publicField(PATTERN_INFO, "N_COLOR", 8);
      __publicField(PATTERN_INFO, "N_STOP", 12);
      __publicField(PATTERN_INFO, "N_FIGURES", 16);
      CssFontInfo = class {
        constructor(buffer) {
          __privateAdd(this, _CssFontInfo_instances);
          __privateAdd(this, _buffer);
          __privateAdd(this, _decoder, new TextDecoder());
          __privateAdd(this, _view);
          __privateSet(this, _buffer, buffer);
          __privateSet(this, _view, new DataView(buffer));
        }
        get fontFamily() {
          return __privateMethod(this, _CssFontInfo_instances, readString_fn).call(this, 0);
        }
        get fontWeight() {
          return __privateMethod(this, _CssFontInfo_instances, readString_fn).call(this, 1);
        }
        get italicAngle() {
          return __privateMethod(this, _CssFontInfo_instances, readString_fn).call(this, 2);
        }
      };
      _buffer = new WeakMap();
      _decoder = new WeakMap();
      _view = new WeakMap();
      _CssFontInfo_instances = new WeakSet();
      readString_fn = function(index) {
        assert(index < CSS_FONT_INFO.strings.length, "Invalid string index");
        let offset = 0;
        for (let i = 0; i < index; i++) {
          offset += __privateGet(this, _view).getUint32(offset) + 4;
        }
        const length = __privateGet(this, _view).getUint32(offset);
        return __privateGet(this, _decoder).decode(new Uint8Array(__privateGet(this, _buffer), offset + 4, length));
      };
      SystemFontInfo = class {
        constructor(buffer) {
          __privateAdd(this, _SystemFontInfo_instances);
          __privateAdd(this, _buffer2);
          __privateAdd(this, _decoder2, new TextDecoder());
          __privateAdd(this, _view2);
          __privateSet(this, _buffer2, buffer);
          __privateSet(this, _view2, new DataView(buffer));
        }
        get guessFallback() {
          return __privateGet(this, _view2).getUint8(0) !== 0;
        }
        get css() {
          return __privateMethod(this, _SystemFontInfo_instances, readString_fn2).call(this, 0);
        }
        get loadedName() {
          return __privateMethod(this, _SystemFontInfo_instances, readString_fn2).call(this, 1);
        }
        get baseFontName() {
          return __privateMethod(this, _SystemFontInfo_instances, readString_fn2).call(this, 2);
        }
        get src() {
          return __privateMethod(this, _SystemFontInfo_instances, readString_fn2).call(this, 3);
        }
        get style() {
          let offset = 1;
          offset += 4 + __privateGet(this, _view2).getUint32(offset);
          const styleLength = __privateGet(this, _view2).getUint32(offset);
          const style = __privateGet(this, _decoder2).decode(new Uint8Array(__privateGet(this, _buffer2), offset + 4, styleLength));
          offset += 4 + styleLength;
          const weightLength = __privateGet(this, _view2).getUint32(offset);
          const weight = __privateGet(this, _decoder2).decode(new Uint8Array(__privateGet(this, _buffer2), offset + 4, weightLength));
          return {
            style,
            weight
          };
        }
      };
      _buffer2 = new WeakMap();
      _decoder2 = new WeakMap();
      _view2 = new WeakMap();
      _SystemFontInfo_instances = new WeakSet();
      readString_fn2 = function(index) {
        assert(index < SYSTEM_FONT_INFO.strings.length, "Invalid string index");
        let offset = 5;
        for (let i = 0; i < index; i++) {
          offset += __privateGet(this, _view2).getUint32(offset) + 4;
        }
        const length = __privateGet(this, _view2).getUint32(offset);
        return __privateGet(this, _decoder2).decode(new Uint8Array(__privateGet(this, _buffer2), offset + 4, length));
      };
      FontInfo = class {
        constructor({
          buffer,
          extra
        }) {
          __privateAdd(this, _FontInfo_instances);
          __privateAdd(this, _buffer3);
          __privateAdd(this, _decoder3, new TextDecoder());
          __privateAdd(this, _view3);
          __privateSet(this, _buffer3, buffer);
          __privateSet(this, _view3, new DataView(buffer));
          if (extra) {
            Object.assign(this, extra);
          }
        }
        get black() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 0);
        }
        get bold() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 1);
        }
        get disableFontFace() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 2);
        }
        get fontExtraProperties() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 3);
        }
        get isInvalidPDFjsFont() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 4);
        }
        get isType3Font() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 5);
        }
        get italic() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 6);
        }
        get missingFile() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 7);
        }
        get remeasure() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 8);
        }
        get vertical() {
          return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 9);
        }
        get ascent() {
          return __privateMethod(this, _FontInfo_instances, readNumber_fn).call(this, 0);
        }
        get defaultWidth() {
          return __privateMethod(this, _FontInfo_instances, readNumber_fn).call(this, 1);
        }
        get descent() {
          return __privateMethod(this, _FontInfo_instances, readNumber_fn).call(this, 2);
        }
        get bbox() {
          return __privateMethod(this, _FontInfo_instances, readArray_fn).call(this, FONT_INFO.OFFSET_BBOX, 4, "getInt16", 2);
        }
        get fontMatrix() {
          return __privateMethod(this, _FontInfo_instances, readArray_fn).call(this, FONT_INFO.OFFSET_FONT_MATRIX, 6, "getFloat64", 8);
        }
        get defaultVMetrics() {
          return __privateMethod(this, _FontInfo_instances, readArray_fn).call(this, FONT_INFO.OFFSET_DEFAULT_VMETRICS, 3, "getInt16", 2);
        }
        get fallbackName() {
          return __privateMethod(this, _FontInfo_instances, readString_fn3).call(this, 0);
        }
        get loadedName() {
          return __privateMethod(this, _FontInfo_instances, readString_fn3).call(this, 1);
        }
        get mimetype() {
          return __privateMethod(this, _FontInfo_instances, readString_fn3).call(this, 2);
        }
        get name() {
          return __privateMethod(this, _FontInfo_instances, readString_fn3).call(this, 3);
        }
        get data() {
          const {
            offset,
            length
          } = __privateMethod(this, _FontInfo_instances, getDataOffsets_fn).call(this);
          return length === 0 ? void 0 : new Uint8Array(__privateGet(this, _buffer3), offset + 4, length);
        }
        clearData() {
          const {
            offset,
            length
          } = __privateMethod(this, _FontInfo_instances, getDataOffsets_fn).call(this);
          if (length === 0) {
            return;
          }
          __privateGet(this, _view3).setUint32(offset, 0);
          __privateSet(this, _buffer3, new Uint8Array(__privateGet(this, _buffer3), 0, offset + 4).slice().buffer);
          __privateSet(this, _view3, new DataView(__privateGet(this, _buffer3)));
        }
        get cssFontInfo() {
          let offset = FONT_INFO.OFFSET_STRINGS;
          const stringsLength = __privateGet(this, _view3).getUint32(offset);
          offset += 4 + stringsLength;
          const systemFontInfoLength = __privateGet(this, _view3).getUint32(offset);
          offset += 4 + systemFontInfoLength;
          const cssFontInfoLength = __privateGet(this, _view3).getUint32(offset);
          if (cssFontInfoLength === 0) {
            return null;
          }
          const cssFontInfoData = new Uint8Array(cssFontInfoLength);
          cssFontInfoData.set(new Uint8Array(__privateGet(this, _buffer3), offset + 4, cssFontInfoLength));
          return new CssFontInfo(cssFontInfoData.buffer);
        }
        get systemFontInfo() {
          let offset = FONT_INFO.OFFSET_STRINGS;
          const stringsLength = __privateGet(this, _view3).getUint32(offset);
          offset += 4 + stringsLength;
          const systemFontInfoLength = __privateGet(this, _view3).getUint32(offset);
          if (systemFontInfoLength === 0) {
            return null;
          }
          const systemFontInfoData = new Uint8Array(systemFontInfoLength);
          systemFontInfoData.set(new Uint8Array(__privateGet(this, _buffer3), offset + 4, systemFontInfoLength));
          return new SystemFontInfo(systemFontInfoData.buffer);
        }
      };
      _buffer3 = new WeakMap();
      _decoder3 = new WeakMap();
      _view3 = new WeakMap();
      _FontInfo_instances = new WeakSet();
      readBoolean_fn = function(index) {
        assert(index < FONT_INFO.bools.length, "Invalid boolean index");
        const byteOffset = Math.floor(index / 4);
        const bitOffset = index * 2 % 8;
        const value = __privateGet(this, _view3).getUint8(byteOffset) >> bitOffset & 3;
        return value === 0 ? void 0 : value === 2;
      };
      readNumber_fn = function(index) {
        assert(index < FONT_INFO.numbers.length, "Invalid number index");
        return __privateGet(this, _view3).getFloat64(FONT_INFO.OFFSET_NUMBERS + index * 8);
      };
      readArray_fn = function(offset, arrLen, lookupName, increment) {
        const len = __privateGet(this, _view3).getUint8(offset);
        if (len === 0) {
          return void 0;
        }
        assert(len === arrLen, "Invalid array length.");
        offset += 1;
        const arr = new Array(len);
        for (let i = 0; i < len; i++) {
          arr[i] = __privateGet(this, _view3)[lookupName](offset, true);
          offset += increment;
        }
        return arr;
      };
      readString_fn3 = function(index) {
        assert(index < FONT_INFO.strings.length, "Invalid string index");
        let offset = FONT_INFO.OFFSET_STRINGS + 4;
        for (let i = 0; i < index; i++) {
          offset += __privateGet(this, _view3).getUint32(offset) + 4;
        }
        const length = __privateGet(this, _view3).getUint32(offset);
        return __privateGet(this, _decoder3).decode(new Uint8Array(__privateGet(this, _buffer3), offset + 4, length));
      };
      getDataOffsets_fn = function() {
        let offset = FONT_INFO.OFFSET_STRINGS;
        const stringsLength = __privateGet(this, _view3).getUint32(offset);
        offset += 4 + stringsLength;
        const systemFontInfoLength = __privateGet(this, _view3).getUint32(offset);
        offset += 4 + systemFontInfoLength;
        const cssFontInfoLength = __privateGet(this, _view3).getUint32(offset);
        offset += 4 + cssFontInfoLength;
        const length = __privateGet(this, _view3).getUint32(offset);
        return {
          offset,
          length
        };
      };
      PatternInfo = class {
        constructor(buffer) {
          this.buffer = buffer;
          this.view = new DataView(buffer);
          this.data = new Uint8Array(buffer);
        }
        getIR() {
          const dataView = this.view;
          const kind = this.data[PATTERN_INFO.KIND];
          const hasBBox = !!this.data[PATTERN_INFO.HAS_BBOX];
          const hasBackground = !!this.data[PATTERN_INFO.HAS_BACKGROUND];
          const nCoord = dataView.getUint32(PATTERN_INFO.N_COORD, true);
          const nColor = dataView.getUint32(PATTERN_INFO.N_COLOR, true);
          const nStop = dataView.getUint32(PATTERN_INFO.N_STOP, true);
          let offset = 20;
          const coords = new Float32Array(this.buffer, offset, nCoord * 2);
          offset += nCoord * 8;
          const colors = new Uint8Array(this.buffer, offset, nColor * 4);
          offset += nColor * 4;
          const stops = [];
          for (let i = 0; i < nStop; ++i) {
            const p = dataView.getFloat32(offset, true);
            offset += 4;
            const rgb = dataView.getUint32(offset, true);
            offset += 4;
            stops.push([p, `#${rgb.toString(16).padStart(6, "0")}`]);
          }
          let bbox = null;
          if (hasBBox) {
            bbox = [];
            for (let i = 0; i < 4; ++i) {
              bbox.push(dataView.getFloat32(offset, true));
              offset += 4;
            }
          }
          let background = null;
          if (hasBackground) {
            background = new Uint8Array(this.buffer, offset, 3);
            offset += 3;
          }
          if (kind === 1) {
            return ["RadialAxial", "axial", bbox, stops, Array.from(coords.slice(0, 2)), Array.from(coords.slice(2, 4)), null, null];
          }
          if (kind === 2) {
            return ["RadialAxial", "radial", bbox, stops, [coords[0], coords[1]], [coords[3], coords[4]], coords[2], coords[5]];
          }
          if (kind === 3) {
            const shadingType = this.data[PATTERN_INFO.SHADING_TYPE];
            let bounds = null;
            if (coords.length > 0) {
              bounds = BBOX_INIT.slice();
              for (let i = 0, ii = coords.length; i < ii; i += 2) {
                Util.pointBoundingBox(coords[i], coords[i + 1], bounds);
              }
            }
            return ["Mesh", shadingType, coords, colors, nCoord, bounds, bbox, background];
          }
          throw new Error(`Unsupported pattern kind: ${kind}`);
        }
      };
      FontPathInfo = class {
        constructor(buffer) {
          __privateAdd(this, _buffer4);
          __privateSet(this, _buffer4, buffer);
        }
        get path() {
          if (FeatureTest.isFloat16ArraySupported) {
            return new Float16Array(__privateGet(this, _buffer4));
          }
          return new Float32Array(__privateGet(this, _buffer4));
        }
      };
      _buffer4 = new WeakMap();
      isRefProxy = (v) => typeof v === "object" && Number.isInteger(v?.num) && v.num >= 0 && Number.isInteger(v?.gen) && v.gen >= 0;
      isNameProxy = (v) => typeof v === "object" && typeof v?.name === "string";
      isValidExplicitDest = _isValidExplicitDest.bind(null, isRefProxy, isNameProxy);
      LoopbackPort = class {
        constructor() {
          __privateAdd(this, _listeners, /* @__PURE__ */ new Map());
          __privateAdd(this, _deferred, Promise.resolve());
        }
        postMessage(obj2, transfer) {
          const event = {
            data: structuredClone(obj2, transfer ? {
              transfer
            } : null)
          };
          __privateGet(this, _deferred).then(() => {
            for (const [listener] of __privateGet(this, _listeners)) {
              listener.call(this, event);
            }
          });
        }
        addEventListener(name, listener, options = null) {
          let rmAbort = null;
          if (options?.signal instanceof AbortSignal) {
            const {
              signal
            } = options;
            if (signal.aborted) {
              warn("LoopbackPort - cannot use an `aborted` signal.");
              return;
            }
            const onAbort = () => this.removeEventListener(name, listener);
            rmAbort = () => signal.removeEventListener("abort", onAbort);
            signal.addEventListener("abort", onAbort);
          }
          __privateGet(this, _listeners).set(listener, rmAbort);
        }
        removeEventListener(name, listener) {
          const rmAbort = __privateGet(this, _listeners).get(listener);
          rmAbort?.();
          __privateGet(this, _listeners).delete(listener);
        }
        terminate() {
          for (const [, rmAbort] of __privateGet(this, _listeners)) {
            rmAbort?.();
          }
          __privateGet(this, _listeners).clear();
        }
      };
      _listeners = new WeakMap();
      _deferred = new WeakMap();
      CallbackKind = {
        DATA: 1,
        ERROR: 2
      };
      StreamKind = {
        CANCEL: 1,
        CANCEL_COMPLETE: 2,
        CLOSE: 3,
        ENQUEUE: 4,
        ERROR: 5,
        PULL: 6,
        PULL_COMPLETE: 7,
        START_COMPLETE: 8
      };
      MessageHandler = class {
        constructor(sourceName, targetName, comObj) {
          __privateAdd(this, _MessageHandler_instances);
          __privateAdd(this, _messageAC, new AbortController());
          this.sourceName = sourceName;
          this.targetName = targetName;
          this.comObj = comObj;
          this.callbackId = 1;
          this.streamId = 1;
          this.streamSinks = /* @__PURE__ */ Object.create(null);
          this.streamControllers = /* @__PURE__ */ Object.create(null);
          this.callbackCapabilities = /* @__PURE__ */ Object.create(null);
          this.actionHandler = /* @__PURE__ */ Object.create(null);
          comObj.addEventListener("message", __privateMethod(this, _MessageHandler_instances, onMessage_fn).bind(this), {
            signal: __privateGet(this, _messageAC).signal
          });
        }
        on(actionName, handler) {
          const ah = this.actionHandler;
          if (ah[actionName]) {
            throw new Error(`There is already an actionName called "${actionName}"`);
          }
          ah[actionName] = handler;
        }
        send(actionName, data, transfers) {
          this.comObj.postMessage({
            sourceName: this.sourceName,
            targetName: this.targetName,
            action: actionName,
            data
          }, transfers);
        }
        sendWithPromise(actionName, data, transfers) {
          const callbackId = this.callbackId++;
          const capability = Promise.withResolvers();
          this.callbackCapabilities[callbackId] = capability;
          try {
            this.comObj.postMessage({
              sourceName: this.sourceName,
              targetName: this.targetName,
              action: actionName,
              callbackId,
              data
            }, transfers);
          } catch (ex) {
            capability.reject(ex);
          }
          return capability.promise;
        }
        sendWithStream(actionName, data, queueingStrategy, transfers) {
          const streamId = this.streamId++, sourceName = this.sourceName, targetName = this.targetName, comObj = this.comObj;
          return new ReadableStream({
            start: (controller) => {
              const startCapability = Promise.withResolvers();
              this.streamControllers[streamId] = {
                controller,
                startCall: startCapability,
                pullCall: null,
                cancelCall: null,
                isClosed: false
              };
              comObj.postMessage({
                sourceName,
                targetName,
                action: actionName,
                streamId,
                data,
                desiredSize: controller.desiredSize
              }, transfers);
              return startCapability.promise;
            },
            pull: (controller) => {
              const pullCapability = Promise.withResolvers();
              this.streamControllers[streamId].pullCall = pullCapability;
              comObj.postMessage({
                sourceName,
                targetName,
                stream: StreamKind.PULL,
                streamId,
                desiredSize: controller.desiredSize
              });
              return pullCapability.promise;
            },
            cancel: (reason) => {
              assert(reason instanceof Error, "cancel must have a valid reason");
              const cancelCapability = Promise.withResolvers();
              this.streamControllers[streamId].cancelCall = cancelCapability;
              this.streamControllers[streamId].isClosed = true;
              comObj.postMessage({
                sourceName,
                targetName,
                stream: StreamKind.CANCEL,
                streamId,
                reason: wrapReason(reason)
              });
              return cancelCapability.promise;
            }
          }, queueingStrategy);
        }
        destroy() {
          __privateGet(this, _messageAC)?.abort();
          __privateSet(this, _messageAC, null);
        }
      };
      _messageAC = new WeakMap();
      _MessageHandler_instances = new WeakSet();
      onMessage_fn = function({
        data
      }) {
        if (data.targetName !== this.sourceName) {
          return;
        }
        if (data.stream) {
          __privateMethod(this, _MessageHandler_instances, processStreamMessage_fn).call(this, data);
          return;
        }
        if (data.callback) {
          const callbackId = data.callbackId;
          const capability = this.callbackCapabilities[callbackId];
          if (!capability) {
            throw new Error(`Cannot resolve callback ${callbackId}`);
          }
          delete this.callbackCapabilities[callbackId];
          if (data.callback === CallbackKind.DATA) {
            capability.resolve(data.data);
          } else if (data.callback === CallbackKind.ERROR) {
            capability.reject(wrapReason(data.reason));
          } else {
            throw new Error("Unexpected callback case");
          }
          return;
        }
        const action = this.actionHandler[data.action];
        if (!action) {
          throw new Error(`Unknown action from worker: ${data.action}`);
        }
        if (data.callbackId) {
          const sourceName = this.sourceName, targetName = data.sourceName, comObj = this.comObj;
          Promise.try(action, data.data).then(function(result2) {
            comObj.postMessage({
              sourceName,
              targetName,
              callback: CallbackKind.DATA,
              callbackId: data.callbackId,
              data: result2
            });
          }, function(reason) {
            comObj.postMessage({
              sourceName,
              targetName,
              callback: CallbackKind.ERROR,
              callbackId: data.callbackId,
              reason: wrapReason(reason)
            });
          });
          return;
        }
        if (data.streamId) {
          __privateMethod(this, _MessageHandler_instances, createStreamSink_fn).call(this, data);
          return;
        }
        action(data.data);
      };
      createStreamSink_fn = function(data) {
        const streamId = data.streamId, sourceName = this.sourceName, targetName = data.sourceName, comObj = this.comObj;
        const self2 = this, action = this.actionHandler[data.action];
        const streamSink = {
          enqueue(chunk2, size2 = 1, transfers) {
            if (this.isCancelled) {
              return;
            }
            const lastDesiredSize = this.desiredSize;
            this.desiredSize -= size2;
            if (lastDesiredSize > 0 && this.desiredSize <= 0) {
              this.sinkCapability = Promise.withResolvers();
              this.ready = this.sinkCapability.promise;
            }
            comObj.postMessage({
              sourceName,
              targetName,
              stream: StreamKind.ENQUEUE,
              streamId,
              chunk: chunk2
            }, transfers);
          },
          close() {
            if (this.isCancelled) {
              return;
            }
            this.isCancelled = true;
            comObj.postMessage({
              sourceName,
              targetName,
              stream: StreamKind.CLOSE,
              streamId
            });
            delete self2.streamSinks[streamId];
          },
          error(reason) {
            assert(reason instanceof Error, "error must have a valid reason");
            if (this.isCancelled) {
              return;
            }
            this.isCancelled = true;
            comObj.postMessage({
              sourceName,
              targetName,
              stream: StreamKind.ERROR,
              streamId,
              reason: wrapReason(reason)
            });
          },
          sinkCapability: Promise.withResolvers(),
          onPull: null,
          onCancel: null,
          isCancelled: false,
          desiredSize: data.desiredSize,
          ready: null
        };
        streamSink.sinkCapability.resolve();
        streamSink.ready = streamSink.sinkCapability.promise;
        this.streamSinks[streamId] = streamSink;
        Promise.try(action, data.data, streamSink).then(function() {
          comObj.postMessage({
            sourceName,
            targetName,
            stream: StreamKind.START_COMPLETE,
            streamId,
            success: true
          });
        }, function(reason) {
          comObj.postMessage({
            sourceName,
            targetName,
            stream: StreamKind.START_COMPLETE,
            streamId,
            reason: wrapReason(reason)
          });
        });
      };
      processStreamMessage_fn = function(data) {
        const streamId = data.streamId, sourceName = this.sourceName, targetName = data.sourceName, comObj = this.comObj;
        const streamController = this.streamControllers[streamId], streamSink = this.streamSinks[streamId];
        switch (data.stream) {
          case StreamKind.START_COMPLETE:
            if (data.success) {
              streamController.startCall.resolve();
            } else {
              streamController.startCall.reject(wrapReason(data.reason));
            }
            break;
          case StreamKind.PULL_COMPLETE:
            if (data.success) {
              streamController.pullCall.resolve();
            } else {
              streamController.pullCall.reject(wrapReason(data.reason));
            }
            break;
          case StreamKind.PULL:
            if (!streamSink) {
              comObj.postMessage({
                sourceName,
                targetName,
                stream: StreamKind.PULL_COMPLETE,
                streamId,
                success: true
              });
              break;
            }
            if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
              streamSink.sinkCapability.resolve();
            }
            streamSink.desiredSize = data.desiredSize;
            Promise.try(streamSink.onPull || onFn).then(function() {
              comObj.postMessage({
                sourceName,
                targetName,
                stream: StreamKind.PULL_COMPLETE,
                streamId,
                success: true
              });
            }, function(reason) {
              comObj.postMessage({
                sourceName,
                targetName,
                stream: StreamKind.PULL_COMPLETE,
                streamId,
                reason: wrapReason(reason)
              });
            });
            break;
          case StreamKind.ENQUEUE:
            assert(streamController, "enqueue should have stream controller");
            if (streamController.isClosed) {
              break;
            }
            streamController.controller.enqueue(data.chunk);
            break;
          case StreamKind.CLOSE:
            assert(streamController, "close should have stream controller");
            if (streamController.isClosed) {
              break;
            }
            streamController.isClosed = true;
            streamController.controller.close();
            __privateMethod(this, _MessageHandler_instances, deleteStreamController_fn).call(this, streamController, streamId);
            break;
          case StreamKind.ERROR:
            assert(streamController, "error should have stream controller");
            streamController.controller.error(wrapReason(data.reason));
            __privateMethod(this, _MessageHandler_instances, deleteStreamController_fn).call(this, streamController, streamId);
            break;
          case StreamKind.CANCEL_COMPLETE:
            if (data.success) {
              streamController.cancelCall.resolve();
            } else {
              streamController.cancelCall.reject(wrapReason(data.reason));
            }
            __privateMethod(this, _MessageHandler_instances, deleteStreamController_fn).call(this, streamController, streamId);
            break;
          case StreamKind.CANCEL:
            if (!streamSink) {
              break;
            }
            const dataReason = wrapReason(data.reason);
            Promise.try(streamSink.onCancel || onFn, dataReason).then(function() {
              comObj.postMessage({
                sourceName,
                targetName,
                stream: StreamKind.CANCEL_COMPLETE,
                streamId,
                success: true
              });
            }, function(reason) {
              comObj.postMessage({
                sourceName,
                targetName,
                stream: StreamKind.CANCEL_COMPLETE,
                streamId,
                reason: wrapReason(reason)
              });
            });
            streamSink.sinkCapability.reject(dataReason);
            streamSink.isCancelled = true;
            delete this.streamSinks[streamId];
            break;
          default:
            throw new Error("Unexpected stream case");
        }
      };
      deleteStreamController_fn = async function(streamController, streamId) {
        await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
        delete this.streamControllers[streamId];
      };
      BaseBinaryDataFactory = class {
        constructor({
          cMapUrl = null,
          standardFontDataUrl = null,
          wasmUrl = null
        }) {
          __privateAdd(this, _errorStr, Object.freeze({
            cMapUrl: "CMap",
            standardFontDataUrl: "font",
            wasmUrl: "wasm"
          }));
          this.cMapUrl = cMapUrl;
          this.standardFontDataUrl = standardFontDataUrl;
          this.wasmUrl = wasmUrl;
        }
        async fetch({
          kind,
          filename
        }) {
          switch (kind) {
            case "cMapUrl":
            case "standardFontDataUrl":
            case "wasmUrl":
              break;
            default:
              unreachable(`Not implemented: ${kind}`);
          }
          const baseUrl = this[kind];
          if (!baseUrl) {
            throw new Error(`Ensure that the \`${kind}\` API parameter is provided.`);
          }
          const url = `${baseUrl}${filename}`;
          return this._fetch(url, kind).catch((reason) => {
            throw new Error(`Unable to load ${__privateGet(this, _errorStr)[kind]} data at: ${url}`);
          });
        }
        async _fetch(url, kind) {
          unreachable("Abstract method `_fetch` called.");
        }
      };
      _errorStr = new WeakMap();
      DOMBinaryDataFactory = class extends BaseBinaryDataFactory {
        async _fetch(url, kind) {
          const type = kind === "cMapUrl" && !url.endsWith(".bcmap") ? "text" : "bytes";
          const data = await fetchData(url, type);
          return data instanceof Uint8Array ? data : stringToBytes(data);
        }
      };
      BaseCanvasFactory = class {
        constructor({
          enableHWA = false
        }) {
          __privateAdd(this, _enableHWA, false);
          __privateSet(this, _enableHWA, enableHWA);
        }
        create(width, height) {
          if (width <= 0 || height <= 0) {
            throw new Error("Invalid canvas size");
          }
          const canvas = this._createCanvas(width, height);
          return {
            canvas,
            context: canvas.getContext("2d", {
              willReadFrequently: !__privateGet(this, _enableHWA)
            })
          };
        }
        reset({
          canvas
        }, width, height) {
          if (!canvas) {
            throw new Error("Canvas is not specified");
          }
          if (width <= 0 || height <= 0) {
            throw new Error("Invalid canvas size");
          }
          canvas.width = width;
          canvas.height = height;
        }
        destroy(canvasAndContext) {
          const {
            canvas
          } = canvasAndContext;
          if (!canvas) {
            throw new Error("Canvas is not specified");
          }
          canvas.width = canvas.height = 0;
          canvasAndContext.canvas = null;
          canvasAndContext.context = null;
        }
        _createCanvas(width, height) {
          unreachable("Abstract method `_createCanvas` called.");
        }
      };
      _enableHWA = new WeakMap();
      DOMCanvasFactory = class extends BaseCanvasFactory {
        constructor({
          ownerDocument = globalThis.document,
          enableHWA = false
        }) {
          super({
            enableHWA
          });
          this._document = ownerDocument;
        }
        _createCanvas(width, height) {
          const canvas = this._document.createElement("canvas");
          canvas.width = width;
          canvas.height = height;
          return canvas;
        }
      };
      BaseFilterFactory = class {
        addFilter(maps) {
          return "none";
        }
        addHCMFilter(fgColor, bgColor) {
          return "none";
        }
        addAlphaFilter(map2) {
          return "none";
        }
        addLuminosityFilter(map2) {
          return "none";
        }
        addKnockoutFilter(alpha = 0) {
          return "none";
        }
        addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
          return "none";
        }
        addSelectionHCMFilter(fgColor, bgColor) {
          return "none";
        }
        addSelectionFilter() {
          return "none";
        }
        createSelectionStyle(pageColors = null) {
          return null;
        }
        destroy(keepHCM = false) {
        }
      };
      DOMFilterFactory = class extends BaseFilterFactory {
        constructor({
          docId,
          ownerDocument = globalThis.document
        }) {
          super();
          __privateAdd(this, _DOMFilterFactory_instances);
          __privateAdd(this, _baseUrl);
          __privateAdd(this, __cache);
          __privateAdd(this, __defs);
          __privateAdd(this, _docId);
          __privateAdd(this, _document);
          __privateAdd(this, __hcmCache);
          __privateAdd(this, _id3, 0);
          __privateSet(this, _docId, docId);
          __privateSet(this, _document, ownerDocument);
        }
        addFilter(maps) {
          if (!maps) {
            return "none";
          }
          let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(maps);
          if (value) {
            return value;
          }
          const [tableR, tableG, tableB] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, maps);
          const key = maps.length === 1 ? tableR : `${tableR}${tableG}${tableB}`;
          value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(key);
          if (value) {
            __privateGet(this, _DOMFilterFactory_instances, cache_get).set(maps, value);
            return value;
          }
          const id = `g_${__privateGet(this, _docId)}_transfer_map_${__privateWrapper(this, _id3)._++}`;
          const url = __privateMethod(this, _DOMFilterFactory_instances, createUrl_fn).call(this, id);
          __privateGet(this, _DOMFilterFactory_instances, cache_get).set(maps, url);
          __privateGet(this, _DOMFilterFactory_instances, cache_get).set(key, url);
          const filter2 = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
          __privateMethod(this, _DOMFilterFactory_instances, addTransferMapConversion_fn).call(this, tableR, tableG, tableB, filter2);
          return url;
        }
        addHCMFilter(fgColor, bgColor) {
          const key = `${fgColor}-${bgColor}`;
          const filterName = "base";
          let info2 = __privateGet(this, _DOMFilterFactory_instances, hcmCache_get).get(filterName);
          if (info2?.key === key) {
            return info2.url;
          }
          if (info2) {
            info2.filter?.remove();
            info2.key = key;
            info2.url = "none";
            info2.filter = null;
          } else {
            info2 = {
              key,
              url: "none",
              filter: null
            };
            __privateGet(this, _DOMFilterFactory_instances, hcmCache_get).set(filterName, info2);
          }
          if (!fgColor || !bgColor) {
            return info2.url;
          }
          const fgRGB = __privateMethod(this, _DOMFilterFactory_instances, getRGB_fn).call(this, fgColor);
          fgColor = Util.makeHexColor(...fgRGB);
          const bgRGB = __privateMethod(this, _DOMFilterFactory_instances, getRGB_fn).call(this, bgColor);
          bgColor = Util.makeHexColor(...bgRGB);
          __privateMethod(this, _DOMFilterFactory_instances, resetDefsColor_fn).call(this);
          if (fgColor === "#000000" && bgColor === "#ffffff" || fgColor === bgColor) {
            return info2.url;
          }
          const map2 = new Array(256);
          for (let i = 0; i <= 255; i++) {
            const x = i / 255;
            map2[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
          }
          const table = map2.join(",");
          const id = `g_${__privateGet(this, _docId)}_hcm_filter`;
          const filter2 = info2.filter = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
          __privateMethod(this, _DOMFilterFactory_instances, addTransferMapConversion_fn).call(this, table, table, table, filter2);
          __privateMethod(this, _DOMFilterFactory_instances, addGrayConversion_fn).call(this, filter2);
          const getSteps = (c, n) => {
            const start = fgRGB[c] / 255;
            const end = bgRGB[c] / 255;
            const arr = new Array(n + 1);
            for (let i = 0; i <= n; i++) {
              arr[i] = start + i / n * (end - start);
            }
            return arr.join(",");
          };
          __privateMethod(this, _DOMFilterFactory_instances, addTransferMapConversion_fn).call(this, getSteps(0, 5), getSteps(1, 5), getSteps(2, 5), filter2);
          info2.url = __privateMethod(this, _DOMFilterFactory_instances, createUrl_fn).call(this, id);
          return info2.url;
        }
        addSelectionHCMFilter(fgColor, bgColor) {
          return this.addHighlightHCMFilter("selection", fgColor, bgColor, "HighlightText", "Highlight");
        }
        addSelectionFilter() {
          return this.addHighlightHCMFilter("selection_default", "black", "white", "HighlightText", "Highlight");
        }
        createSelectionStyle(pageColors = null) {
          const filter2 = pageColors ? this.addSelectionHCMFilter(pageColors.foreground, pageColors.background) : this.addSelectionFilter();
          if (filter2 === "none" || !FeatureTest.platform.isFirefox) {
            return null;
          }
          return {
            "backdrop-filter": filter2,
            "background-color": "transparent"
          };
        }
        addAlphaFilter(map2) {
          let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(map2);
          if (value) {
            return value;
          }
          const [tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [map2]);
          const key = `alpha_${tableA}`;
          value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(key);
          if (value) {
            __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map2, value);
            return value;
          }
          const id = `g_${__privateGet(this, _docId)}_alpha_map_${__privateWrapper(this, _id3)._++}`;
          const url = __privateMethod(this, _DOMFilterFactory_instances, createUrl_fn).call(this, id);
          __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map2, url);
          __privateGet(this, _DOMFilterFactory_instances, cache_get).set(key, url);
          const filter2 = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
          __privateMethod(this, _DOMFilterFactory_instances, addTransferMapAlphaConversion_fn).call(this, tableA, filter2);
          return url;
        }
        addLuminosityFilter(map2) {
          let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(map2 || "luminosity");
          if (value) {
            return value;
          }
          let tableA, key;
          if (map2) {
            [tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [map2]);
            key = `luminosity_${tableA}`;
          } else {
            key = "luminosity";
          }
          value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(key);
          if (value) {
            __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map2, value);
            return value;
          }
          const id = `g_${__privateGet(this, _docId)}_luminosity_map_${__privateWrapper(this, _id3)._++}`;
          const url = __privateMethod(this, _DOMFilterFactory_instances, createUrl_fn).call(this, id);
          __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map2, url);
          __privateGet(this, _DOMFilterFactory_instances, cache_get).set(key, url);
          const filter2 = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
          __privateMethod(this, _DOMFilterFactory_instances, addLuminosityConversion_fn).call(this, filter2);
          if (map2) {
            __privateMethod(this, _DOMFilterFactory_instances, addTransferMapAlphaConversion_fn).call(this, tableA, filter2);
          }
          return url;
        }
        addKnockoutFilter(alpha = 0) {
          const slope = alpha > 0 ? Math.min(1 / alpha, 1e6) : 1e6;
          const key = `knockout_${slope}`;
          const value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(key);
          if (value) {
            return value;
          }
          const id = `g_${__privateGet(this, _docId)}_knockout_filter_${__privateWrapper(this, _id3)._++}`;
          const url = __privateMethod(this, _DOMFilterFactory_instances, createUrl_fn).call(this, id);
          __privateGet(this, _DOMFilterFactory_instances, cache_get).set(key, url);
          const filter2 = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
          const feComponentTransfer = __privateGet(this, _document).createElementNS(SVG_NS, "feComponentTransfer");
          filter2.append(feComponentTransfer);
          const feFuncA = __privateGet(this, _document).createElementNS(SVG_NS, "feFuncA");
          feFuncA.setAttribute("type", "linear");
          feFuncA.setAttribute("slope", `${slope}`);
          feFuncA.setAttribute("intercept", "0");
          feComponentTransfer.append(feFuncA);
          return url;
        }
        addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
          const key = `${fgColor}-${bgColor}-${newFgColor}-${newBgColor}`;
          let info2 = __privateGet(this, _DOMFilterFactory_instances, hcmCache_get).get(filterName);
          if (info2?.key === key) {
            return info2.url;
          }
          if (info2) {
            info2.filter?.remove();
            info2.key = key;
            info2.url = "none";
            info2.filter = null;
          } else {
            info2 = {
              key,
              url: "none",
              filter: null
            };
            __privateGet(this, _DOMFilterFactory_instances, hcmCache_get).set(filterName, info2);
          }
          if (!fgColor || !bgColor) {
            return info2.url;
          }
          const [fgRGB, bgRGB] = [fgColor, bgColor].map(__privateMethod(this, _DOMFilterFactory_instances, getRGB_fn).bind(this));
          let fgGray = Math.round(0.2126 * fgRGB[0] + 0.7152 * fgRGB[1] + 0.0722 * fgRGB[2]);
          let bgGray = Math.round(0.2126 * bgRGB[0] + 0.7152 * bgRGB[1] + 0.0722 * bgRGB[2]);
          let [newFgRGB, newBgRGB] = [newFgColor, newBgColor].map(__privateMethod(this, _DOMFilterFactory_instances, getOpaqueTextColor_fn).bind(this));
          if (bgGray < fgGray) {
            [fgGray, bgGray, newFgRGB, newBgRGB] = [bgGray, fgGray, newBgRGB, newFgRGB];
          }
          __privateMethod(this, _DOMFilterFactory_instances, resetDefsColor_fn).call(this);
          const getSteps = (fg, bg, n) => {
            const arr = new Array(256);
            const step = (bgGray - fgGray) / n;
            const newStart = fg / 255;
            const newStep = (bg - fg) / (255 * n);
            let prev = 0;
            for (let i = 0; i <= n; i++) {
              const k = Math.round(fgGray + i * step);
              const value = newStart + i * newStep;
              for (let j = prev; j <= k; j++) {
                arr[j] = value;
              }
              prev = k + 1;
            }
            for (let i = prev; i < 256; i++) {
              arr[i] = arr[prev - 1];
            }
            return arr.join(",");
          };
          const id = `g_${__privateGet(this, _docId)}_hcm_${filterName}_filter`;
          const filter2 = info2.filter = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
          __privateMethod(this, _DOMFilterFactory_instances, addGrayConversion_fn).call(this, filter2);
          __privateMethod(this, _DOMFilterFactory_instances, addTransferMapConversion_fn).call(this, getSteps(newFgRGB[0], newBgRGB[0], 5), getSteps(newFgRGB[1], newBgRGB[1], 5), getSteps(newFgRGB[2], newBgRGB[2], 5), filter2);
          info2.url = __privateMethod(this, _DOMFilterFactory_instances, createUrl_fn).call(this, id);
          return info2.url;
        }
        destroy(keepHCM = false) {
          if (keepHCM && __privateGet(this, __hcmCache)?.size) {
            return;
          }
          __privateGet(this, __defs)?.parentNode.parentNode.remove();
          __privateSet(this, __defs, null);
          __privateGet(this, __cache)?.clear();
          __privateSet(this, __cache, null);
          __privateGet(this, __hcmCache)?.clear();
          __privateSet(this, __hcmCache, null);
          __privateSet(this, _id3, 0);
        }
      };
      _baseUrl = new WeakMap();
      __cache = new WeakMap();
      __defs = new WeakMap();
      _docId = new WeakMap();
      _document = new WeakMap();
      __hcmCache = new WeakMap();
      _id3 = new WeakMap();
      _DOMFilterFactory_instances = new WeakSet();
      cache_get = function() {
        return __privateGet(this, __cache) || __privateSet(this, __cache, /* @__PURE__ */ new Map());
      };
      hcmCache_get = function() {
        return __privateGet(this, __hcmCache) || __privateSet(this, __hcmCache, /* @__PURE__ */ new Map());
      };
      defs_get = function() {
        if (!__privateGet(this, __defs)) {
          const div = __privateGet(this, _document).createElement("div");
          const {
            style
          } = div;
          style.colorScheme = "only light";
          style.visibility = "hidden";
          style.contain = "strict";
          style.width = style.height = 0;
          style.position = "absolute";
          style.top = style.left = 0;
          style.zIndex = -1;
          const svg = __privateGet(this, _document).createElementNS(SVG_NS, "svg");
          svg.setAttribute("width", 0);
          svg.setAttribute("height", 0);
          __privateSet(this, __defs, __privateGet(this, _document).createElementNS(SVG_NS, "defs"));
          div.append(svg);
          svg.append(__privateGet(this, __defs));
          __privateGet(this, _document).body.append(div);
        }
        return __privateGet(this, __defs);
      };
      createTables_fn = function(maps) {
        if (maps.length === 1) {
          const mapR2 = maps[0];
          const buffer = new Array(256);
          for (let i = 0; i < 256; i++) {
            buffer[i] = mapR2[i] / 255;
          }
          const table = buffer.join(",");
          return [table, table, table];
        }
        const [mapR, mapG, mapB] = maps;
        const bufferR = new Array(256);
        const bufferG = new Array(256);
        const bufferB = new Array(256);
        for (let i = 0; i < 256; i++) {
          bufferR[i] = mapR[i] / 255;
          bufferG[i] = mapG[i] / 255;
          bufferB[i] = mapB[i] / 255;
        }
        return [bufferR.join(","), bufferG.join(","), bufferB.join(",")];
      };
      createUrl_fn = function(id) {
        if (__privateGet(this, _baseUrl) === void 0) {
          __privateSet(this, _baseUrl, "");
          const url = __privateGet(this, _document).URL;
          if (url !== __privateGet(this, _document).baseURI) {
            if (isDataScheme(url)) {
              warn('#createUrl: ignore "data:"-URL for performance reasons.');
            } else {
              __privateSet(this, _baseUrl, updateUrlHash(url, ""));
            }
          }
        }
        return `url(${__privateGet(this, _baseUrl)}#${id})`;
      };
      addLuminosityConversion_fn = function(filter2) {
        const feColorMatrix = __privateGet(this, _document).createElementNS(SVG_NS, "feColorMatrix");
        feColorMatrix.setAttribute("type", "matrix");
        feColorMatrix.setAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0");
        filter2.append(feColorMatrix);
      };
      addGrayConversion_fn = function(filter2) {
        const feColorMatrix = __privateGet(this, _document).createElementNS(SVG_NS, "feColorMatrix");
        feColorMatrix.setAttribute("type", "matrix");
        feColorMatrix.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0");
        filter2.append(feColorMatrix);
      };
      createFilter_fn = function(id) {
        const filter2 = __privateGet(this, _document).createElementNS(SVG_NS, "filter");
        filter2.setAttribute("color-interpolation-filters", "sRGB");
        filter2.setAttribute("id", id);
        __privateGet(this, _DOMFilterFactory_instances, defs_get).append(filter2);
        return filter2;
      };
      appendFeFunc_fn = function(feComponentTransfer, func, table) {
        const feFunc = __privateGet(this, _document).createElementNS(SVG_NS, func);
        feFunc.setAttribute("type", "discrete");
        feFunc.setAttribute("tableValues", table);
        feComponentTransfer.append(feFunc);
      };
      addTransferMapConversion_fn = function(rTable, gTable, bTable, filter2) {
        const feComponentTransfer = __privateGet(this, _document).createElementNS(SVG_NS, "feComponentTransfer");
        filter2.append(feComponentTransfer);
        __privateMethod(this, _DOMFilterFactory_instances, appendFeFunc_fn).call(this, feComponentTransfer, "feFuncR", rTable);
        __privateMethod(this, _DOMFilterFactory_instances, appendFeFunc_fn).call(this, feComponentTransfer, "feFuncG", gTable);
        __privateMethod(this, _DOMFilterFactory_instances, appendFeFunc_fn).call(this, feComponentTransfer, "feFuncB", bTable);
      };
      addTransferMapAlphaConversion_fn = function(aTable, filter2) {
        const feComponentTransfer = __privateGet(this, _document).createElementNS(SVG_NS, "feComponentTransfer");
        filter2.append(feComponentTransfer);
        __privateMethod(this, _DOMFilterFactory_instances, appendFeFunc_fn).call(this, feComponentTransfer, "feFuncA", aTable);
      };
      getRGB_fn = function(color) {
        __privateGet(this, _DOMFilterFactory_instances, defs_get).style.color = "CanvasText";
        __privateGet(this, _DOMFilterFactory_instances, defs_get).style.backgroundColor = color;
        return getRGB(getComputedStyle(__privateGet(this, _DOMFilterFactory_instances, defs_get)).getPropertyValue("background-color"));
      };
      getRGBA_fn = function(color) {
        __privateGet(this, _DOMFilterFactory_instances, defs_get).style.color = "CanvasText";
        __privateGet(this, _DOMFilterFactory_instances, defs_get).style.backgroundColor = color;
        return getRGBA(getComputedStyle(__privateGet(this, _DOMFilterFactory_instances, defs_get)).getPropertyValue("background-color"));
      };
      resetDefsColor_fn = function() {
        __privateGet(this, _DOMFilterFactory_instances, defs_get).style.color = "";
        __privateGet(this, _DOMFilterFactory_instances, defs_get).style.backgroundColor = "";
      };
      getOpaqueTextColor_fn = function(color) {
        const [r, g, b, alpha] = __privateMethod(this, _DOMFilterFactory_instances, getRGBA_fn).call(this, color);
        if (alpha === 1) {
          return [r, g, b];
        }
        const [canvasR, canvasG, canvasB] = __privateMethod(this, _DOMFilterFactory_instances, getRGB_fn).call(this, "Canvas");
        return [blend(r, canvasR, alpha), blend(g, canvasG, alpha), blend(b, canvasB, alpha)];
      };
      if (isNodeJS) {
        warn("Please use the `legacy` build in Node.js environments.");
      }
      NodeFilterFactory = class extends BaseFilterFactory {
      };
      NodeCanvasFactory = class extends BaseCanvasFactory {
        _createCanvas(width, height) {
          const require2 = process.getBuiltinModule("module").createRequire(import_meta.url);
          const canvas = require2("@napi-rs/canvas");
          return canvas.createCanvas(width, height);
        }
      };
      NodeBinaryDataFactory = class extends BaseBinaryDataFactory {
        async _fetch(url, kind) {
          return node_utils_fetchData(url);
        }
      };
      MESH_WGSL = `
struct Uniforms {
  offsetX      : f32,
  offsetY      : f32,
  scaleX       : f32,
  scaleY       : f32,
  paddedWidth  : f32,
  paddedHeight : f32,
  borderSize   : f32,
  _pad         : f32,
};

@group(0) @binding(0) var<uniform> u : Uniforms;

struct VertexInput {
  @location(0) position : vec2<f32>,
  @location(1) color    : vec4<f32>,
};

struct VertexOutput {
  @builtin(position) position : vec4<f32>,
  @location(0)       color    : vec3<f32>,
};

@vertex
fn vs_main(in : VertexInput) -> VertexOutput {
  var out : VertexOutput;
  let cx = (in.position.x + u.offsetX) * u.scaleX;
  let cy = (in.position.y + u.offsetY) * u.scaleY;
  out.position = vec4<f32>(
    ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
    1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
    0.0,
    1.0
  );
  out.color = in.color.rgb;
  return out;
}

@fragment
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
  return vec4<f32>(in.color, 1.0);
}
`;
      WebGPU = class {
        constructor() {
          __privateAdd(this, _WebGPU_instances);
          __privateAdd(this, _initPromise, null);
          __privateAdd(this, _device, null);
          __privateAdd(this, _meshPipeline, null);
          __privateAdd(this, _preferredFormat, null);
        }
        init() {
          return __privateGet(this, _initPromise) || __privateSet(this, _initPromise, __privateMethod(this, _WebGPU_instances, initGPU_fn).call(this));
        }
        get isReady() {
          return __privateGet(this, _device) !== null;
        }
        loadMeshShader() {
          if (!__privateGet(this, _device) || __privateGet(this, _meshPipeline)) {
            return;
          }
          const shaderModule = __privateGet(this, _device).createShaderModule({
            code: MESH_WGSL
          });
          __privateSet(this, _meshPipeline, __privateGet(this, _device).createRenderPipeline({
            layout: "auto",
            vertex: {
              module: shaderModule,
              entryPoint: "vs_main",
              buffers: [{
                arrayStride: 2 * 4,
                attributes: [{
                  shaderLocation: 0,
                  offset: 0,
                  format: "float32x2"
                }]
              }, {
                arrayStride: 4,
                attributes: [{
                  shaderLocation: 1,
                  offset: 0,
                  format: "unorm8x4"
                }]
              }]
            },
            fragment: {
              module: shaderModule,
              entryPoint: "fs_main",
              targets: [{
                format: __privateGet(this, _preferredFormat)
              }]
            },
            primitive: {
              topology: "triangle-list"
            }
          }));
        }
        draw(posData, colData, vertexCount, context, backgroundColor, paddedWidth, paddedHeight, borderSize) {
          this.loadMeshShader();
          const device = __privateGet(this, _device);
          const {
            offsetX,
            offsetY,
            scaleX,
            scaleY
          } = context;
          const posBuffer = device.createBuffer({
            size: Math.max(posData.byteLength, 4),
            usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
          });
          if (posData.byteLength > 0) {
            device.queue.writeBuffer(posBuffer, 0, posData);
          }
          const colBuffer = device.createBuffer({
            size: Math.max(colData.byteLength, 4),
            usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
          });
          if (colData.byteLength > 0) {
            device.queue.writeBuffer(colBuffer, 0, colData);
          }
          const uniformBuffer = device.createBuffer({
            size: 8 * 4,
            usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
          });
          device.queue.writeBuffer(uniformBuffer, 0, new Float32Array([offsetX, offsetY, scaleX, scaleY, paddedWidth, paddedHeight, borderSize, 0]));
          const bindGroup = device.createBindGroup({
            layout: __privateGet(this, _meshPipeline).getBindGroupLayout(0),
            entries: [{
              binding: 0,
              resource: {
                buffer: uniformBuffer
              }
            }]
          });
          const offscreen = new OffscreenCanvas(paddedWidth, paddedHeight);
          const gpuCtx = offscreen.getContext("webgpu");
          gpuCtx.configure({
            device,
            format: __privateGet(this, _preferredFormat),
            alphaMode: backgroundColor ? "opaque" : "premultiplied"
          });
          const clearValue = backgroundColor ? {
            r: backgroundColor[0] / 255,
            g: backgroundColor[1] / 255,
            b: backgroundColor[2] / 255,
            a: 1
          } : {
            r: 0,
            g: 0,
            b: 0,
            a: 0
          };
          const commandEncoder = device.createCommandEncoder();
          const renderPass = commandEncoder.beginRenderPass({
            colorAttachments: [{
              view: gpuCtx.getCurrentTexture().createView(),
              clearValue,
              loadOp: "clear",
              storeOp: "store"
            }]
          });
          if (vertexCount > 0) {
            renderPass.setPipeline(__privateGet(this, _meshPipeline));
            renderPass.setBindGroup(0, bindGroup);
            renderPass.setVertexBuffer(0, posBuffer);
            renderPass.setVertexBuffer(1, colBuffer);
            renderPass.draw(vertexCount);
          }
          renderPass.end();
          device.queue.submit([commandEncoder.finish()]);
          posBuffer.destroy();
          colBuffer.destroy();
          uniformBuffer.destroy();
          return offscreen.transferToImageBitmap();
        }
      };
      _initPromise = new WeakMap();
      _device = new WeakMap();
      _meshPipeline = new WeakMap();
      _preferredFormat = new WeakMap();
      _WebGPU_instances = new WeakSet();
      initGPU_fn = async function() {
        if (!globalThis.navigator?.gpu) {
          return false;
        }
        try {
          const adapter = await navigator.gpu.requestAdapter();
          if (!adapter) {
            return false;
          }
          __privateSet(this, _preferredFormat, navigator.gpu.getPreferredCanvasFormat());
          __privateSet(this, _device, await adapter.requestDevice());
          return true;
        } catch {
          return false;
        }
      };
      _webGPU = new WebGPU();
      PathType = {
        FILL: "Fill",
        STROKE: "Stroke",
        SHADING: "Shading"
      };
      BaseShadingPattern = class {
        constructor() {
          __publicField(this, "matrix", null);
        }
        isModifyingCurrentTransform() {
          return false;
        }
        getPattern() {
          unreachable("Abstract method `getPattern` called.");
        }
      };
      RadialAxialShadingPattern = class extends BaseShadingPattern {
        constructor(IR) {
          super();
          this._type = IR[1];
          this._bbox = IR[2];
          this._colorStops = IR[3];
          this._p0 = IR[4];
          this._p1 = IR[5];
          this._r0 = IR[6];
          this._r1 = IR[7];
        }
        isOriginBased() {
          return this._p0[0] === 0 && this._p0[1] === 0 && (!this.isRadial() || this._p1[0] === 0 && this._p1[1] === 0);
        }
        isRadial() {
          return this._type === "radial";
        }
        areConic() {
          if (!this.isRadial()) {
            return false;
          }
          const dist = Math.hypot(this._p0[0] - this._p1[0], this._p0[1] - this._p1[1]);
          return dist + this._r1 > this._r0 && dist + this._r0 > this._r1;
        }
        _createGradient(ctx, transform = null) {
          let grad;
          let firstPoint = this._p0;
          let secondPoint = this._p1;
          if (transform) {
            firstPoint = firstPoint.slice();
            secondPoint = secondPoint.slice();
            Util.applyTransform(firstPoint, transform);
            Util.applyTransform(secondPoint, transform);
          }
          if (this._type === "axial") {
            grad = ctx.createLinearGradient(firstPoint[0], firstPoint[1], secondPoint[0], secondPoint[1]);
          } else if (this._type === "radial") {
            let r0 = this._r0;
            let r1 = this._r1;
            if (transform) {
              const scale = new Float32Array(2);
              Util.singularValueDecompose2dScale(transform, scale);
              r0 *= scale[0];
              r1 *= scale[0];
            }
            grad = ctx.createRadialGradient(firstPoint[0], firstPoint[1], r0, secondPoint[0], secondPoint[1], r1);
          }
          for (const colorStop of this._colorStops) {
            grad.addColorStop(colorStop[0], colorStop[1]);
          }
          return grad;
        }
        _createReversedGradient(ctx, transform = null) {
          let firstPoint = this._p1;
          let secondPoint = this._p0;
          if (transform) {
            firstPoint = firstPoint.slice();
            secondPoint = secondPoint.slice();
            Util.applyTransform(firstPoint, transform);
            Util.applyTransform(secondPoint, transform);
          }
          let r0 = this._r1;
          let r1 = this._r0;
          if (transform) {
            const scale = new Float32Array(2);
            Util.singularValueDecompose2dScale(transform, scale);
            r0 *= scale[0];
            r1 *= scale[0];
          }
          const grad = ctx.createRadialGradient(firstPoint[0], firstPoint[1], r0, secondPoint[0], secondPoint[1], r1);
          const reversedStops = this._colorStops.map(([t, c]) => [1 - t, c]).reverse();
          for (const [t, c] of reversedStops) {
            grad.addColorStop(t, c);
          }
          return grad;
        }
        getPattern(ctx, owner, inverse, pathType) {
          let pattern;
          if (pathType === PathType.STROKE || pathType === PathType.FILL) {
            if (this.isOriginBased()) {
              let transf = Util.transform(inverse, owner.baseTransform);
              if (this.matrix) {
                transf = Util.transform(transf, this.matrix);
              }
              const precision = 1e-3;
              const n1 = Math.hypot(transf[0], transf[1]);
              const n2 = Math.hypot(transf[2], transf[3]);
              const ps = (transf[0] * transf[2] + transf[1] * transf[3]) / (n1 * n2);
              if (Math.abs(ps) < precision) {
                if (this.isRadial()) {
                  if (Math.abs(n1 - n2) < precision) {
                    return this._createGradient(ctx, transf);
                  }
                } else {
                  return this._createGradient(ctx, transf);
                }
              }
            }
            const ownerBBox = owner.current.getClippedPathBoundingBox(pathType, getCurrentTransform(ctx)) || [0, 0, 0, 0];
            const width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;
            const height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;
            const tmpCanvas = owner.canvasFactory.create(width, height);
            const tmpCtx = tmpCanvas.context;
            tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
            tmpCtx.beginPath();
            tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
            tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);
            inverse = Util.transform(inverse, [1, 0, 0, 1, ownerBBox[0], ownerBBox[1]]);
            tmpCtx.transform(...owner.baseTransform);
            if (this.matrix) {
              tmpCtx.transform(...this.matrix);
            }
            applyBoundingBox(tmpCtx, this._bbox);
            if (this.areConic()) {
              tmpCtx.fillStyle = this._createReversedGradient(tmpCtx);
              tmpCtx.fill();
            }
            tmpCtx.fillStyle = this._createGradient(tmpCtx);
            tmpCtx.fill();
            pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
            owner.canvasFactory.destroy(tmpCanvas);
            const domMatrix = new DOMMatrix(inverse);
            pattern.setTransform(domMatrix);
          } else {
            if (this.areConic()) {
              ctx.save();
              applyBoundingBox(ctx, this._bbox);
              ctx.fillStyle = this._createReversedGradient(ctx);
              ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
              ctx.restore();
            }
            applyBoundingBox(ctx, this._bbox);
            pattern = this._createGradient(ctx);
          }
          return pattern;
        }
      };
      MeshShadingPattern = class extends BaseShadingPattern {
        constructor(IR) {
          super();
          this._posData = IR[2];
          this._colData = IR[3];
          this._vertexCount = IR[4];
          this._bounds = IR[5];
          this._bbox = IR[6];
          this._background = IR[7];
          loadMeshShader();
        }
        _createMeshCanvas(combinedScale, backgroundColor, canvasFactory) {
          const EXPECTED_SCALE = 1.1;
          const MAX_PATTERN_SIZE = 3e3;
          const BORDER_SIZE = 2;
          const offsetX = Math.floor(this._bounds[0]);
          const offsetY = Math.floor(this._bounds[1]);
          const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;
          const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;
          const width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE) || 1;
          const height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE) || 1;
          const scaleX = boundsWidth ? boundsWidth / width : 1;
          const scaleY = boundsHeight ? boundsHeight / height : 1;
          const context = {
            coords: this._posData,
            colors: this._colData,
            offsetX: -offsetX,
            offsetY: -offsetY,
            scaleX: 1 / scaleX,
            scaleY: 1 / scaleY
          };
          const paddedWidth = width + BORDER_SIZE * 2;
          const paddedHeight = height + BORDER_SIZE * 2;
          const tmpCanvas = canvasFactory.create(paddedWidth, paddedHeight);
          if (isGPUReady() && this._vertexCount > 48) {
            tmpCanvas.context.drawImage(drawMeshWithGPU(this._posData, this._colData, this._vertexCount, context, backgroundColor, paddedWidth, paddedHeight, BORDER_SIZE), 0, 0);
          } else {
            const data = tmpCanvas.context.createImageData(width, height);
            if (backgroundColor) {
              const bytes = data.data;
              for (let i = 0, ii = bytes.length; i < ii; i += 4) {
                bytes[i] = backgroundColor[0];
                bytes[i + 1] = backgroundColor[1];
                bytes[i + 2] = backgroundColor[2];
                bytes[i + 3] = 255;
              }
            }
            for (let i = 0, ii = this._vertexCount; i < ii; i += 3) {
              drawTriangle(data, context, i, i + 1, i + 2, i, i + 1, i + 2);
            }
            tmpCanvas.context.putImageData(data, BORDER_SIZE, BORDER_SIZE);
          }
          return {
            canvas: tmpCanvas.canvas,
            offsetX: offsetX - BORDER_SIZE * scaleX,
            offsetY: offsetY - BORDER_SIZE * scaleY,
            scaleX,
            scaleY
          };
        }
        isModifyingCurrentTransform() {
          return true;
        }
        getPattern(ctx, owner, inverse, pathType) {
          applyBoundingBox(ctx, this._bbox);
          const scale = new Float32Array(2);
          if (pathType === PathType.SHADING) {
            Util.singularValueDecompose2dScale(getCurrentTransform(ctx), scale);
          } else if (this.matrix) {
            Util.singularValueDecompose2dScale(this.matrix, scale);
            const [matrixScaleX, matrixScaleY] = scale;
            Util.singularValueDecompose2dScale(owner.baseTransform, scale);
            scale[0] *= matrixScaleX;
            scale[1] *= matrixScaleY;
          } else {
            Util.singularValueDecompose2dScale(owner.baseTransform, scale);
          }
          const temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : this._background, owner.canvasFactory);
          if (pathType !== PathType.SHADING) {
            ctx.setTransform(...owner.baseTransform);
            if (this.matrix) {
              ctx.transform(...this.matrix);
            }
          }
          ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
          ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
          const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat");
          owner.canvasFactory.destroy(temporaryPatternCanvas);
          return pattern;
        }
      };
      DummyShadingPattern = class extends BaseShadingPattern {
        getPattern() {
          return "hotpink";
        }
      };
      PaintType = {
        COLORED: 1,
        UNCOLORED: 2
      };
      _TilingPattern = class _TilingPattern {
        constructor(IR, ctx, canvasGraphicsFactory, baseTransform) {
          this.color = IR[1];
          this.operatorList = IR[2];
          this.matrix = IR[3];
          this.bbox = IR[4];
          this.xstep = IR[5];
          this.ystep = IR[6];
          this.paintType = IR[7];
          this.tilingType = IR[8];
          this.needsIsolation = IR[9] ?? true;
          this.ctx = ctx;
          this.canvasGraphicsFactory = canvasGraphicsFactory;
          this.baseTransform = baseTransform;
          this.patternBaseMatrix = this.matrix ? Util.transform(baseTransform, this.matrix) : baseTransform;
        }
        canSkipPatternCanvas([width, height, offsetX, offsetY]) {
          const [x0, y0, x1, y1] = this.bbox;
          const absXStep = Math.abs(this.xstep);
          const absYStep = Math.abs(this.ystep);
          if (width > absXStep + 1e-6 || height > absYStep + 1e-6) {
            return null;
          }
          const nXFirst = Math.floor((offsetX - x1) / absXStep) + 1;
          const nXLast = Math.ceil((offsetX + width - x0) / absXStep) - 1;
          const nYFirst = Math.floor((offsetY - y1) / absYStep) + 1;
          const nYLast = Math.ceil((offsetY + height - y0) / absYStep) - 1;
          return nXLast <= nXFirst && nYLast <= nYFirst ? [nXFirst, nYFirst] : null;
        }
        updatePatternDims(clippedBBox, dims) {
          const inv = Util.inverseTransform(this.patternBaseMatrix);
          const c1 = [clippedBBox[0], clippedBBox[1]];
          const c2 = [clippedBBox[2], clippedBBox[3]];
          Util.applyTransform(c1, inv);
          Util.applyTransform(c2, inv);
          dims[0] = Math.abs(c2[0] - c1[0]);
          dims[1] = Math.abs(c2[1] - c1[1]);
          dims[2] = Math.min(c1[0], c2[0]);
          dims[3] = Math.min(c1[1], c2[1]);
        }
        _renderTileCanvas(owner, opIdx, dimx, dimy) {
          const [x0, y0, x1, y1] = this.bbox;
          const tmpCanvas = owner.canvasFactory.create(dimx.size, dimy.size);
          const tmpCtx = tmpCanvas.context;
          const graphics = this.canvasGraphicsFactory.createCanvasGraphics(tmpCtx, opIdx);
          graphics.groupLevel = owner.groupLevel;
          this.setFillAndStrokeStyleToContext(graphics, this.paintType, this.color);
          tmpCtx.translate(-dimx.scale * x0, -dimy.scale * y0);
          graphics.transform(0, dimx.scale, 0, 0, dimy.scale, 0, 0);
          tmpCtx.save();
          graphics.dependencyTracker?.save();
          this.clipBbox(graphics, x0, y0, x1, y1);
          graphics.baseTransform = getCurrentTransform(graphics.ctx);
          graphics.executeOperatorList(this.operatorList);
          graphics.endDrawing();
          graphics.dependencyTracker?.restore();
          tmpCtx.restore();
          return tmpCanvas;
        }
        _getCombinedScales() {
          const scale = new Float32Array(2);
          Util.singularValueDecompose2dScale(this.matrix, scale);
          const [matrixScaleX, matrixScaleY] = scale;
          Util.singularValueDecompose2dScale(this.baseTransform, scale);
          return [matrixScaleX * scale[0], matrixScaleY * scale[1]];
        }
        drawPattern(owner, path, useEOFill = false, [n, m], opIdx) {
          const [x0, y0, x1, y1] = this.bbox;
          const dependencyTracker = owner.dependencyTracker;
          if (dependencyTracker) {
            owner.dependencyTracker = new CanvasNestedDependencyTracker(dependencyTracker, opIdx);
          }
          owner.save();
          if (useEOFill) {
            owner.ctx.clip(path, "evenodd");
          } else {
            owner.ctx.clip(path);
          }
          owner.ctx.setTransform(...this.patternBaseMatrix);
          owner.ctx.translate(n * this.xstep, m * this.ystep);
          if (this.needsIsolation || owner.ctx.globalAlpha !== 1 || owner.ctx.globalCompositeOperation !== "source-over" || owner.inSMaskMode) {
            const bboxWidth = x1 - x0;
            const bboxHeight = y1 - y0;
            const [combinedScaleX, combinedScaleY] = this._getCombinedScales();
            const dimx = this.getSizeAndScale(bboxWidth, this.ctx.canvas.width, combinedScaleX);
            const dimy = this.getSizeAndScale(bboxHeight, this.ctx.canvas.height, combinedScaleY);
            const tmpCanvas = this._renderTileCanvas(owner, opIdx, dimx, dimy);
            owner.ctx.drawImage(tmpCanvas.canvas, x0, y0, bboxWidth, bboxHeight);
            owner.canvasFactory.destroy(tmpCanvas);
          } else {
            this.setFillAndStrokeStyleToContext(owner, this.paintType, this.color);
            this.clipBbox(owner, x0, y0, x1, y1);
            owner.baseTransformStack.push(owner.baseTransform);
            owner.baseTransform = getCurrentTransform(owner.ctx);
            owner.executeOperatorList(this.operatorList);
            owner.baseTransform = owner.baseTransformStack.pop();
          }
          owner.restore();
          if (dependencyTracker) {
            owner.dependencyTracker = dependencyTracker;
          }
        }
        createPatternCanvas(owner, opIdx) {
          const [x0, y0, x1, y1] = this.bbox;
          const width = x1 - x0;
          const height = y1 - y0;
          let {
            xstep,
            ystep
          } = this;
          xstep = Math.abs(xstep);
          ystep = Math.abs(ystep);
          info("TilingType: " + this.tilingType);
          const [combinedScaleX, combinedScaleY] = this._getCombinedScales();
          let canvasWidth = width, canvasHeight = height, redrawHorizontally = false, redrawVertically = false;
          if (Math.ceil(xstep * combinedScaleX) >= Math.ceil(width * combinedScaleX)) {
            canvasWidth = xstep;
          } else {
            redrawHorizontally = true;
          }
          if (Math.ceil(ystep * combinedScaleY) >= Math.ceil(height * combinedScaleY)) {
            canvasHeight = ystep;
          } else {
            redrawVertically = true;
          }
          const dimx = this.getSizeAndScale(canvasWidth, this.ctx.canvas.width, combinedScaleX);
          const dimy = this.getSizeAndScale(canvasHeight, this.ctx.canvas.height, combinedScaleY);
          const tmpCanvas = this._renderTileCanvas(owner, opIdx, dimx, dimy);
          if (redrawHorizontally || redrawVertically) {
            const image = tmpCanvas.canvas;
            if (redrawHorizontally) {
              canvasWidth = xstep;
            }
            if (redrawVertically) {
              canvasHeight = ystep;
            }
            const dimx2 = this.getSizeAndScale(canvasWidth, this.ctx.canvas.width, combinedScaleX);
            const dimy2 = this.getSizeAndScale(canvasHeight, this.ctx.canvas.height, combinedScaleY);
            const xSize = dimx2.size;
            const ySize = dimy2.size;
            const tmpCanvas2 = owner.canvasFactory.create(xSize, ySize);
            const tmpCtx2 = tmpCanvas2.context;
            const ii = redrawHorizontally ? Math.floor(width / xstep) : 0;
            const jj = redrawVertically ? Math.floor(height / ystep) : 0;
            for (let i = 0; i <= ii; i++) {
              for (let j = 0; j <= jj; j++) {
                tmpCtx2.drawImage(image, xSize * i, ySize * j, xSize, ySize, 0, 0, xSize, ySize);
              }
            }
            owner.canvasFactory.destroy(tmpCanvas);
            return {
              canvas: tmpCanvas2.canvas,
              canvasEntry: tmpCanvas2,
              scaleX: dimx2.scale,
              scaleY: dimy2.scale,
              offsetX: x0,
              offsetY: y0
            };
          }
          return {
            canvas: tmpCanvas.canvas,
            canvasEntry: tmpCanvas,
            scaleX: dimx.scale,
            scaleY: dimy.scale,
            offsetX: x0,
            offsetY: y0
          };
        }
        getSizeAndScale(step, realOutputSize, scale) {
          const maxSize = Math.max(_TilingPattern.MAX_PATTERN_SIZE, realOutputSize);
          let size2 = Math.ceil(step * scale);
          if (size2 >= maxSize) {
            size2 = maxSize;
          } else {
            scale = size2 / step;
          }
          return {
            scale,
            size: size2
          };
        }
        clipBbox(graphics, x0, y0, x1, y1) {
          const bboxWidth = x1 - x0;
          const bboxHeight = y1 - y0;
          const clip = new Path2D();
          clip.rect(x0, y0, bboxWidth, bboxHeight);
          Util.axialAlignedBoundingBox([x0, y0, x1, y1], getCurrentTransform(graphics.ctx), graphics.current.minMax);
          graphics.ctx.clip(clip);
          graphics.current.updateClipFromPath();
        }
        setFillAndStrokeStyleToContext(graphics, paintType, color) {
          const context = graphics.ctx, current = graphics.current;
          current.patternFill = current.patternStroke = false;
          switch (paintType) {
            case PaintType.COLORED:
              const {
                fillStyle,
                strokeStyle
              } = this.ctx;
              context.fillStyle = current.fillColor = fillStyle;
              context.strokeStyle = current.strokeColor = strokeStyle;
              break;
            case PaintType.UNCOLORED:
              context.fillStyle = context.strokeStyle = color;
              current.fillColor = current.strokeColor = color;
              break;
            default:
              throw new FormatError(`Unsupported paint type: ${paintType}`);
          }
        }
        isModifyingCurrentTransform() {
          return false;
        }
        getPattern(ctx, owner, inverse, pathType, opIdx) {
          const matrix = pathType !== PathType.SHADING ? Util.transform(inverse, this.patternBaseMatrix) : inverse;
          const temporaryPatternCanvas = this.createPatternCanvas(owner, opIdx);
          let domMatrix = new DOMMatrix(matrix);
          domMatrix = domMatrix.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
          domMatrix = domMatrix.scale(1 / temporaryPatternCanvas.scaleX, 1 / temporaryPatternCanvas.scaleY);
          const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat");
          owner.canvasFactory.destroy(temporaryPatternCanvas.canvasEntry);
          pattern.setTransform(domMatrix);
          return pattern;
        }
      };
      __publicField(_TilingPattern, "MAX_PATTERN_SIZE", 3e3);
      TilingPattern = _TilingPattern;
      MIN_FONT_SIZE = 16;
      MAX_FONT_SIZE = 100;
      EXECUTION_TIME = 15;
      EXECUTION_STEPS = 10;
      FULL_CHUNK_HEIGHT = 16;
      SCALE_MATRIX = new DOMMatrix();
      XY = new Float32Array(2);
      CanvasExtraState = class {
        constructor(width, height) {
          __publicField(this, "alphaIsShape", false);
          __publicField(this, "fontSize", 0);
          __publicField(this, "fontSizeScale", 1);
          __publicField(this, "textMatrix", null);
          __publicField(this, "textMatrixScale", 1);
          __publicField(this, "fontMatrix", FONT_IDENTITY_MATRIX);
          __publicField(this, "leading", 0);
          __publicField(this, "x", 0);
          __publicField(this, "y", 0);
          __publicField(this, "lineX", 0);
          __publicField(this, "lineY", 0);
          __publicField(this, "charSpacing", 0);
          __publicField(this, "wordSpacing", 0);
          __publicField(this, "textHScale", 1);
          __publicField(this, "textRenderingMode", TextRenderingMode.FILL);
          __publicField(this, "textRise", 0);
          __publicField(this, "fillColor", "#000000");
          __publicField(this, "strokeColor", "#000000");
          __publicField(this, "tilingPatternDims", null);
          __publicField(this, "patternFill", false);
          __publicField(this, "patternStroke", false);
          __publicField(this, "fillAlpha", 1);
          __publicField(this, "strokeAlpha", 1);
          __publicField(this, "lineWidth", 1);
          __publicField(this, "activeSMask", null);
          __publicField(this, "transferMaps", "none");
          __publicField(this, "minMax", F32_BBOX_INIT.slice());
          this.clipBox = new Float32Array([0, 0, width, height]);
        }
        clone() {
          const clone2 = Object.create(this);
          clone2.clipBox = this.clipBox.slice();
          clone2.minMax = this.minMax.slice();
          clone2.tilingPatternDims = this.tilingPatternDims?.slice();
          return clone2;
        }
        getPathBoundingBox(pathType = PathType.FILL, transform = null) {
          const box = this.minMax.slice();
          if (pathType === PathType.STROKE) {
            if (!transform) {
              unreachable("Stroke bounding box must include transform.");
            }
            Util.singularValueDecompose2dScale(transform, XY);
            const xStrokePad = XY[0] * this.lineWidth / 2;
            const yStrokePad = XY[1] * this.lineWidth / 2;
            box[0] -= xStrokePad;
            box[1] -= yStrokePad;
            box[2] += xStrokePad;
            box[3] += yStrokePad;
          }
          return box;
        }
        updateClipFromPath() {
          const intersect = Util.intersect(this.clipBox, this.getPathBoundingBox());
          this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);
        }
        isEmptyClip() {
          return this.minMax[0] === Infinity;
        }
        startNewPathAndClipBox(box) {
          this.clipBox.set(box, 0);
          this.minMax.set(F32_BBOX_INIT, 0);
        }
        getClippedPathBoundingBox(pathType = PathType.FILL, transform = null) {
          return Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));
        }
      };
      LINE_CAP_STYLES = ["butt", "round", "square"];
      LINE_JOIN_STYLES = ["miter", "round", "bevel"];
      NORMAL_CLIP = {};
      EO_CLIP = {};
      _CanvasGraphics = class _CanvasGraphics {
        constructor(canvasCtx, commonObjs, objs, canvasFactory, filterFactory, {
          optionalContentConfig,
          markedContentStack = null
        }, annotationCanvasMap, pageColors, dependencyTracker, imagesTracker) {
          __privateAdd(this, _CanvasGraphics_instances);
          __privateAdd(this, _knockoutGroupLevel, 0);
          __privateAdd(this, _knockoutElementDepth, 0);
          __privateAdd(this, _knockoutTempCanvasEntry, null);
          __privateAdd(this, _knockoutSavedCtx, null);
          __privateAdd(this, _knockoutSavedSMaskCtx, null);
          __privateAdd(this, _knockoutSavedGCO, null);
          __privateAdd(this, _knockoutElementAlpha, 1);
          __privateAdd(this, _knockoutFilterCache);
          __privateAdd(this, _knockoutElementGroupMeta, null);
          __privateAdd(this, _groupStackMeta, []);
          this.ctx = canvasCtx;
          this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
          this.stateStack = [];
          this.pendingClip = null;
          this.pendingEOFill = false;
          this.commonObjs = commonObjs;
          this.objs = objs;
          this.canvasFactory = canvasFactory;
          this.filterFactory = filterFactory;
          this.groupStack = [];
          this.baseTransform = null;
          this.baseTransformStack = [];
          this.groupLevel = 0;
          this.smaskStack = [];
          this.tempSMask = null;
          this.smaskGroupCanvases = [];
          this.smaskPreparedEntry = null;
          this.smaskPreparedFor = null;
          this.smaskPreparedOffsetX = 0;
          this.smaskPreparedOffsetY = 0;
          this.smaskPreparedOOBAlpha = null;
          this.suspendedCtx = null;
          this.contentVisible = true;
          this.markedContentStack = markedContentStack || [];
          this.optionalContentConfig = optionalContentConfig;
          this.cachedPatterns = /* @__PURE__ */ new Map();
          this.annotationCanvasMap = annotationCanvasMap;
          this.viewportScale = 1;
          this.outputScaleX = 1;
          this.outputScaleY = 1;
          this.pageColors = pageColors;
          this._cachedScaleForStroking = [-1, 0];
          this._cachedGetSinglePixelWidth = null;
          this._cachedBitmapsMap = /* @__PURE__ */ new Map();
          this.dependencyTracker = dependencyTracker ?? null;
          this.imagesTracker = imagesTracker ?? null;
        }
        getObject(opIdx, data, fallback = null) {
          if (typeof data === "string") {
            this.dependencyTracker?.recordNamedDependency(opIdx, data);
            return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
          }
          return fallback;
        }
        beginDrawing({
          transform,
          viewport,
          transparency = false,
          background = null
        }) {
          const width = this.ctx.canvas.width;
          const height = this.ctx.canvas.height;
          const savedFillStyle = this.ctx.fillStyle;
          this.ctx.fillStyle = background || "#ffffff";
          this.ctx.fillRect(0, 0, width, height);
          this.ctx.fillStyle = savedFillStyle;
          if (transparency) {
            const transparentCanvas = this.transparentCanvasEntry = this.canvasFactory.create(width, height);
            this.compositeCtx = this.ctx;
            ({
              canvas: this.transparentCanvas,
              context: this.ctx
            } = transparentCanvas);
            this.ctx.save();
            this.ctx.transform(...getCurrentTransform(this.compositeCtx));
          }
          this.ctx.save();
          resetCtxToDefault(this.ctx);
          if (transform) {
            this.ctx.transform(...transform);
            this.outputScaleX = transform[0];
            this.outputScaleY = transform[3];
          }
          this.ctx.transform(...viewport.transform);
          this.viewportScale = viewport.scale;
          this.baseTransform = getCurrentTransform(this.ctx);
        }
        executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper, operationsFilter) {
          const argsArray = operatorList.argsArray;
          const fnArray = operatorList.fnArray;
          let i = executionStartIdx || 0;
          const argsArrayLen = argsArray.length;
          if (argsArrayLen === i) {
            return i;
          }
          const chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function";
          const endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;
          let steps = 0;
          const commonObjs = this.commonObjs;
          const objs = this.objs;
          let fnId, fnArgs;
          while (true) {
            if (stepper !== void 0) {
              if (i === stepper.nextBreakPoint) {
                stepper.breakIt(i, continueCallback);
                return i;
              }
              if (stepper.shouldSkip(i)) {
                if (++i === argsArrayLen) {
                  return i;
                }
                continue;
              }
            }
            if (!operationsFilter || operationsFilter(i)) {
              fnId = fnArray[i];
              fnArgs = argsArray[i] ?? null;
              if (fnId !== OPS.dependency) {
                if (fnArgs === null) {
                  this[fnId](i);
                } else {
                  this[fnId](i, ...fnArgs);
                }
              } else {
                for (const depObjId of fnArgs) {
                  this.dependencyTracker?.recordNamedData(depObjId, i);
                  const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
                  if (!objsPool.has(depObjId)) {
                    objsPool.get(depObjId, continueCallback);
                    return i;
                  }
                }
              }
            }
            i++;
            if (i === argsArrayLen) {
              return i;
            }
            if (chunkOperations && ++steps > EXECUTION_STEPS) {
              if (Date.now() > endTime) {
                continueCallback();
                return i;
              }
              steps = 0;
            }
          }
        }
        endDrawing() {
          __privateMethod(this, _CanvasGraphics_instances, restoreInitialState_fn).call(this);
          for (const canvas of this.smaskGroupCanvases) {
            this.canvasFactory.destroy(canvas);
          }
          this.smaskGroupCanvases.length = 0;
          this._clearPreparedSMask();
          this.tempSMask = null;
          this.smaskStack.length = 0;
          for (const meta of __privateGet(this, _groupStackMeta)) {
            __privateMethod(this, _CanvasGraphics_instances, destroyKnockoutPools_fn).call(this, meta);
          }
          __privateGet(this, _groupStackMeta).length = 0;
          __privateSet(this, _knockoutTempCanvasEntry, null);
          __privateSet(this, _knockoutSavedCtx, null);
          __privateSet(this, _knockoutSavedSMaskCtx, null);
          __privateSet(this, _knockoutSavedGCO, null);
          __privateSet(this, _knockoutElementAlpha, 1);
          __privateSet(this, _knockoutElementGroupMeta, null);
          __privateSet(this, _knockoutElementDepth, 0);
          __privateSet(this, _knockoutGroupLevel, 0);
          this.cachedPatterns.clear();
          for (const cache of this._cachedBitmapsMap.values()) {
            for (const canvas of cache.values()) {
              if (typeof HTMLCanvasElement !== "undefined" && canvas instanceof HTMLCanvasElement) {
                canvas.width = canvas.height = 0;
              }
            }
            cache.clear();
          }
          this._cachedBitmapsMap.clear();
          __privateMethod(this, _CanvasGraphics_instances, drawFilter_fn).call(this);
        }
        _scaleImage(img, inverseTransform) {
          const width = img.width ?? img.displayWidth;
          const height = img.height ?? img.displayHeight;
          const widthScale = Math.max(Math.hypot(inverseTransform[0], inverseTransform[1]), 1);
          const heightScale = Math.max(Math.hypot(inverseTransform[2], inverseTransform[3]), 1);
          const scaleSteps = [];
          let ws = widthScale, hs = heightScale, pw = width, ph = height;
          while (ws > 2 && pw > 1 || hs > 2 && ph > 1) {
            let nw = pw, nh = ph;
            if (ws > 2 && pw > 1) {
              nw = Math.ceil(pw / 2);
              ws /= pw / nw;
            }
            if (hs > 2 && ph > 1) {
              nh = Math.ceil(ph / 2);
              hs /= ph / nh;
            }
            scaleSteps.push({
              newWidth: nw,
              newHeight: nh
            });
            pw = nw;
            ph = nh;
          }
          if (scaleSteps.length === 0) {
            return {
              img,
              paintWidth: width,
              paintHeight: height,
              tmpCanvas: null
            };
          }
          if (scaleSteps.length === 1) {
            const {
              newWidth,
              newHeight
            } = scaleSteps[0];
            const tmpCanvas = this.canvasFactory.create(newWidth, newHeight);
            tmpCanvas.context.drawImage(img, 0, 0, width, height, 0, 0, newWidth, newHeight);
            return {
              img: tmpCanvas.canvas,
              paintWidth: newWidth,
              paintHeight: newHeight,
              tmpCanvas
            };
          }
          let readEntry = this.canvasFactory.create(1, 1);
          let writeEntry = this.canvasFactory.create(1, 1);
          let paintWidth = width, paintHeight = height;
          let source = img;
          for (const {
            newWidth,
            newHeight
          } of scaleSteps) {
            this.canvasFactory.reset(writeEntry, newWidth, newHeight);
            writeEntry.context.drawImage(source, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);
            [readEntry, writeEntry] = [writeEntry, readEntry];
            source = readEntry.canvas;
            paintWidth = newWidth;
            paintHeight = newHeight;
          }
          this.canvasFactory.destroy(writeEntry);
          return {
            img: readEntry.canvas,
            paintWidth,
            paintHeight,
            tmpCanvas: readEntry
          };
        }
        _createMaskCanvas(opIdx, img) {
          const ctx = this.ctx;
          const {
            width,
            height
          } = img;
          const fillColor = this.current.fillColor;
          const isPatternFill = this.current.patternFill;
          const currentTransform = getCurrentTransform(ctx);
          let cache, cacheKey, scaled, maskCanvas;
          if ((img.bitmap || img.data) && img.count > 1) {
            const mainKey = img.bitmap || img.data.buffer;
            cacheKey = JSON.stringify(isPatternFill ? currentTransform : [currentTransform.slice(0, 4), fillColor]);
            cache = this._cachedBitmapsMap.getOrInsertComputed(mainKey, makeMap);
            const cachedImage = cache.get(cacheKey);
            if (cachedImage && !isPatternFill) {
              const offsetX2 = Math.round(Math.min(currentTransform[0], currentTransform[2]) + currentTransform[4]);
              const offsetY2 = Math.round(Math.min(currentTransform[1], currentTransform[3]) + currentTransform[5]);
              this.dependencyTracker?.recordDependencies(opIdx, Dependencies.transformAndFill);
              return {
                canvas: cachedImage,
                offsetX: offsetX2,
                offsetY: offsetY2
              };
            }
            scaled = cachedImage;
          }
          if (!scaled) {
            maskCanvas = this.canvasFactory.create(width, height);
            putBinaryImageMask(maskCanvas.context, img);
          }
          let maskToCanvas = Util.transform(currentTransform, [1 / width, 0, 0, -1 / height, 0, 0]);
          maskToCanvas = Util.transform(maskToCanvas, [1, 0, 0, 1, 0, -height]);
          const minMax = F32_BBOX_INIT.slice();
          Util.axialAlignedBoundingBox([0, 0, width, height], maskToCanvas, minMax);
          const [minX, minY, maxX, maxY] = minMax;
          const drawnWidth = Math.round(maxX - minX) || 1;
          const drawnHeight = Math.round(maxY - minY) || 1;
          const fillCanvas = this.canvasFactory.create(drawnWidth, drawnHeight);
          const fillCtx = fillCanvas.context;
          const offsetX = minX;
          const offsetY = minY;
          fillCtx.translate(-offsetX, -offsetY);
          fillCtx.transform(...maskToCanvas);
          let scaledEntry = null;
          if (!scaled) {
            const scaleResult = this._scaleImage(maskCanvas.canvas, getCurrentTransformInverse(fillCtx));
            scaled = scaleResult.img;
            scaledEntry = scaleResult.tmpCanvas;
            if (scaled !== maskCanvas.canvas) {
              this.canvasFactory.destroy(maskCanvas);
              maskCanvas = null;
            }
            if (cache && isPatternFill) {
              cache.set(cacheKey, scaled);
              scaledEntry = null;
              maskCanvas = null;
            }
          }
          fillCtx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(fillCtx), img.interpolate);
          drawImageAtIntegerCoords(fillCtx, scaled, 0, 0, scaled.width, scaled.height, 0, 0, width, height);
          if (scaledEntry) {
            this.canvasFactory.destroy(scaledEntry);
          }
          if (maskCanvas) {
            this.canvasFactory.destroy(maskCanvas);
          }
          fillCtx.globalCompositeOperation = "source-in";
          const inverse = Util.transform(getCurrentTransformInverse(fillCtx), [1, 0, 0, 1, -offsetX, -offsetY]);
          fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, PathType.FILL, opIdx) : fillColor;
          fillCtx.fillRect(0, 0, width, height);
          if (cache && !isPatternFill) {
            cache.set(cacheKey, fillCanvas.canvas);
          }
          this.dependencyTracker?.recordDependencies(opIdx, Dependencies.transformAndFill);
          return {
            canvas: fillCanvas.canvas,
            canvasEntry: cache && !isPatternFill ? null : fillCanvas,
            offsetX: Math.round(offsetX),
            offsetY: Math.round(offsetY)
          };
        }
        setLineWidth(opIdx, width) {
          this.dependencyTracker?.recordSimpleData("lineWidth", opIdx);
          if (width !== this.current.lineWidth) {
            this._cachedScaleForStroking[0] = -1;
          }
          this.current.lineWidth = width;
          this.ctx.lineWidth = width;
        }
        setLineCap(opIdx, style) {
          this.dependencyTracker?.recordSimpleData("lineCap", opIdx);
          this.ctx.lineCap = LINE_CAP_STYLES[style];
        }
        setLineJoin(opIdx, style) {
          this.dependencyTracker?.recordSimpleData("lineJoin", opIdx);
          this.ctx.lineJoin = LINE_JOIN_STYLES[style];
        }
        setMiterLimit(opIdx, limit) {
          this.dependencyTracker?.recordSimpleData("miterLimit", opIdx);
          this.ctx.miterLimit = limit;
        }
        setDash(opIdx, dashArray, dashPhase) {
          this.dependencyTracker?.recordSimpleData("dash", opIdx);
          const ctx = this.ctx;
          if (ctx.setLineDash !== void 0) {
            ctx.setLineDash(dashArray);
            ctx.lineDashOffset = dashPhase;
          }
        }
        setRenderingIntent(opIdx, intent) {
        }
        setFlatness(opIdx, flatness) {
        }
        setGState(opIdx, states) {
          for (const [key, value] of states) {
            switch (key) {
              case "LW":
                this.setLineWidth(opIdx, value);
                break;
              case "LC":
                this.setLineCap(opIdx, value);
                break;
              case "LJ":
                this.setLineJoin(opIdx, value);
                break;
              case "ML":
                this.setMiterLimit(opIdx, value);
                break;
              case "D":
                this.setDash(opIdx, value[0], value[1]);
                break;
              case "RI":
                this.setRenderingIntent(opIdx, value);
                break;
              case "FL":
                this.setFlatness(opIdx, value);
                break;
              case "Font":
                this.setFont(opIdx, value[0], value[1]);
                break;
              case "CA":
                this.dependencyTracker?.recordSimpleData("strokeAlpha", opIdx);
                this.current.strokeAlpha = value;
                break;
              case "ca":
                this.dependencyTracker?.recordSimpleData("fillAlpha", opIdx);
                this.ctx.globalAlpha = this.current.fillAlpha = value;
                break;
              case "BM":
                this.dependencyTracker?.recordSimpleData("globalCompositeOperation", opIdx);
                this.ctx.globalCompositeOperation = value;
                break;
              case "SMask":
                this.dependencyTracker?.recordSimpleData("SMask", opIdx);
                this.current.activeSMask = value ? this.tempSMask : null;
                if (this.current.activeSMask) {
                  this.current.activeSMask.blendMode = this.ctx.globalCompositeOperation;
                }
                this.tempSMask = null;
                this.checkSMaskState(opIdx);
                break;
              case "TR":
                this.dependencyTracker?.recordSimpleData("filter", opIdx);
                this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(value);
                break;
            }
          }
        }
        get inSMaskMode() {
          return !!this.suspendedCtx;
        }
        _clearPreparedSMask() {
          if (this.smaskPreparedEntry) {
            this.canvasFactory.destroy(this.smaskPreparedEntry);
            this.smaskPreparedEntry = null;
          }
          this.smaskPreparedFor = null;
          this.smaskPreparedOffsetX = 0;
          this.smaskPreparedOffsetY = 0;
          this.smaskPreparedOOBAlpha = null;
        }
        _ensurePreparedSMask(smask) {
          if (smask === this.smaskPreparedFor) {
            return;
          }
          this._clearPreparedSMask();
          this._prepareSMaskCanvas(smask);
        }
        checkSMaskState(opIdx) {
          const inSMaskMode = this.inSMaskMode;
          if (this.current.activeSMask && !inSMaskMode) {
            this.beginSMaskMode(opIdx);
          } else if (!this.current.activeSMask && inSMaskMode) {
            this.endSMaskMode();
          } else if (this.current.activeSMask && inSMaskMode) {
            this._ensurePreparedSMask(this.current.activeSMask);
          }
        }
        _prepareSMaskCanvas(smask) {
          const {
            canvas: maskCanvas,
            subtype,
            backdrop,
            transferMap
          } = smask;
          const hasFilter = subtype === "Luminosity" || subtype === "Alpha" && transferMap;
          if (!hasFilter && !(subtype === "Luminosity" && backdrop)) {
            this.smaskPreparedFor = smask;
            return;
          }
          let filteredOOBAlpha;
          if (subtype === "Luminosity" && backdrop) {
            const [r, g, b] = getRGBA(backdrop);
            const inputAlpha = Math.round(0.3 * r + 0.59 * g + 0.11 * b);
            filteredOOBAlpha = transferMap?.[inputAlpha] ?? inputAlpha;
          } else {
            filteredOOBAlpha = transferMap?.[0] ?? 0;
          }
          const SMASK_LAYER_TO_MASK_AREA_RATIO = 4;
          const {
            width: layerW,
            height: layerH
          } = this.ctx.canvas;
          const maskArea = maskCanvas.width * maskCanvas.height;
          const useLayerSize = layerW * layerH < SMASK_LAYER_TO_MASK_AREA_RATIO * maskArea;
          const filterSpec = hasFilter ? {
            url: subtype === "Alpha" ? this.filterFactory.addAlphaFilter(transferMap) : this.filterFactory.addLuminosityFilter(transferMap),
            subtype,
            transferMap
          } : null;
          const bakedBackdrop = subtype === "Luminosity" ? backdrop : null;
          let preparedEntry, offsetX, offsetY;
          if (useLayerSize) {
            preparedEntry = this._bakeSMaskCanvas(maskCanvas, smask.offsetX, smask.offsetY, layerW, layerH, bakedBackdrop, filterSpec);
            offsetX = 0;
            offsetY = 0;
          } else {
            preparedEntry = this._bakeSMaskCanvas(maskCanvas, 0, 0, maskCanvas.width, maskCanvas.height, bakedBackdrop, filterSpec);
            offsetX = smask.offsetX;
            offsetY = smask.offsetY;
          }
          this.smaskPreparedEntry = preparedEntry;
          this.smaskPreparedFor = smask;
          this.smaskPreparedOffsetX = offsetX;
          this.smaskPreparedOffsetY = offsetY;
          this.smaskPreparedOOBAlpha = !useLayerSize && filteredOOBAlpha !== 0 ? filteredOOBAlpha : null;
        }
        _bakeSMaskCanvas(maskCanvas, drawX, drawY, w, h, backdrop, filterSpec) {
          if (!backdrop && !filterSpec) {
            unreachable("_bakeSMaskCanvas with neither backdrop nor filter");
          }
          const srcEntry = this.canvasFactory.create(w, h);
          const sCtx = srcEntry.context;
          sCtx.drawImage(maskCanvas, drawX, drawY);
          if (backdrop) {
            sCtx.globalCompositeOperation = "destination-atop";
            sCtx.fillStyle = backdrop;
            sCtx.fillRect(0, 0, w, h);
          }
          if (!filterSpec) {
            return srcEntry;
          }
          const preparedEntry = this.canvasFactory.create(w, h);
          const pCtx = preparedEntry.context;
          pCtx.filter = filterSpec.url;
          const filterApplied = FeatureTest.isCanvasFilterSupported && pCtx.filter !== "none" && pCtx.filter !== "";
          pCtx.drawImage(srcEntry.canvas, 0, 0);
          if (FeatureTest.isCanvasFilterSupported) {
            pCtx.filter = "none";
          }
          if (!filterApplied) {
            const img = pCtx.getImageData(0, 0, w, h);
            const {
              data
            } = img;
            const {
              transferMap
            } = filterSpec;
            if (filterSpec.subtype === "Luminosity") {
              for (let i = 0, ii = data.length; i < ii; i += 4) {
                const a = 0.3 * data[i] + 0.59 * data[i + 1] + 0.11 * data[i + 2] + 0.5 | 0;
                data[i] = data[i + 1] = data[i + 2] = 0;
                data[i + 3] = transferMap?.[a] ?? a;
              }
            } else {
              for (let i = 3, ii = data.length; i < ii; i += 4) {
                data[i] = transferMap[data[i]];
              }
            }
            pCtx.putImageData(img, 0, 0);
          }
          this.canvasFactory.destroy(srcEntry);
          return preparedEntry;
        }
        beginSMaskMode(opIdx) {
          if (this.inSMaskMode) {
            throw new Error("beginSMaskMode called while already in smask mode");
          }
          const {
            width: drawnWidth,
            height: drawnHeight
          } = this.ctx.canvas;
          const scratchCanvas = this.canvasFactory.create(drawnWidth, drawnHeight);
          this.smaskScratchCanvas = scratchCanvas;
          this.suspendedCtx = this.ctx;
          const ctx = this.ctx = scratchCanvas.context;
          ctx.setTransform(this.suspendedCtx.getTransform());
          copyCtxState(this.suspendedCtx, ctx);
          mirrorContextOperations(ctx, this.suspendedCtx);
          this._ensurePreparedSMask(this.current.activeSMask);
          this.setGState(opIdx, [["BM", "source-over"]]);
        }
        endSMaskMode() {
          if (!this.inSMaskMode) {
            throw new Error("endSMaskMode called while not in smask mode");
          }
          this.ctx._removeMirroring();
          copyCtxState(this.ctx, this.suspendedCtx);
          this.ctx = this.suspendedCtx;
          this.suspendedCtx = null;
          this.canvasFactory.destroy(this.smaskScratchCanvas);
          this.smaskScratchCanvas = null;
          this._clearPreparedSMask();
        }
        compose(dirtyBox) {
          if (!this.current.activeSMask) {
            return;
          }
          dirtyBox = dirtyBox ? [Math.floor(dirtyBox[0]), Math.floor(dirtyBox[1]), Math.ceil(dirtyBox[2]), Math.ceil(dirtyBox[3])] : [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
          const smask = this.current.activeSMask;
          const suspendedCtx = this.suspendedCtx;
          const applySMaskInPlace = __privateGet(this, _knockoutElementDepth) > 0 && suspendedCtx === this.ctx;
          this.composeSMask(applySMaskInPlace ? null : suspendedCtx, smask, this.ctx, dirtyBox);
          if (applySMaskInPlace) {
            return;
          }
          this.ctx.save();
          this.ctx.setTransform(1, 0, 0, 1, 0, 0);
          this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
          this.ctx.restore();
        }
        composeSMask(ctx, smask, layerCtx, layerBox) {
          const layerOffsetX = layerBox[0];
          const layerOffsetY = layerBox[1];
          const layerWidth = layerBox[2] - layerOffsetX;
          const layerHeight = layerBox[3] - layerOffsetY;
          if (layerWidth === 0 || layerHeight === 0) {
            return;
          }
          const preparedEntry = this.smaskPreparedEntry;
          if (preparedEntry) {
            let clipX = layerOffsetX;
            let clipY = layerOffsetY;
            let clipW = layerWidth;
            let clipH = layerHeight;
            const oobAlpha = this.smaskPreparedOOBAlpha;
            const hasOOBAlpha = oobAlpha !== null;
            if (hasOOBAlpha) {
              clipX = Math.max(layerOffsetX, smask.offsetX);
              clipY = Math.max(layerOffsetY, smask.offsetY);
              const x1 = Math.min(layerOffsetX + layerWidth, smask.offsetX + smask.canvas.width);
              const y1 = Math.min(layerOffsetY + layerHeight, smask.offsetY + smask.canvas.height);
              clipW = x1 - clipX;
              clipH = y1 - clipY;
            }
            if (clipW > 0 && clipH > 0) {
              const srcX = clipX - this.smaskPreparedOffsetX;
              const srcY = clipY - this.smaskPreparedOffsetY;
              layerCtx.save();
              layerCtx.globalAlpha = 1;
              layerCtx.setTransform(1, 0, 0, 1, 0, 0);
              const clip = new Path2D();
              clip.rect(clipX, clipY, clipW, clipH);
              layerCtx.clip(clip);
              layerCtx.globalCompositeOperation = "destination-in";
              layerCtx.drawImage(preparedEntry.canvas, srcX, srcY, clipW, clipH, clipX, clipY, clipW, clipH);
              layerCtx.restore();
            }
            if (hasOOBAlpha && oobAlpha < 255) {
              this._applySMaskOOBAlpha(layerCtx, layerOffsetX, layerOffsetY, layerWidth, layerHeight, clipX, clipY, clipX + clipW, clipY + clipH, oobAlpha);
            }
          } else {
            this.genericComposeSMask(smask, layerCtx, layerWidth, layerHeight, layerOffsetX, layerOffsetY);
          }
          if (!ctx) {
            return;
          }
          ctx.save();
          ctx.globalAlpha = 1;
          ctx.globalCompositeOperation = smask.blendMode || "source-over";
          ctx.setTransform(1, 0, 0, 1, 0, 0);
          ctx.drawImage(layerCtx.canvas, layerOffsetX, layerOffsetY, layerWidth, layerHeight, layerOffsetX, layerOffsetY, layerWidth, layerHeight);
          ctx.restore();
        }
        _applySMaskOOBAlpha(layerCtx, layerOffsetX, layerOffsetY, layerWidth, layerHeight, maskX0, maskY0, maskX1, maskY1, alpha) {
          const hasInnerCutout = maskX0 < maskX1 && maskY0 < maskY1;
          if (hasInnerCutout && maskX0 === layerOffsetX && maskY0 === layerOffsetY && maskX1 === layerOffsetX + layerWidth && maskY1 === layerOffsetY + layerHeight) {
            return;
          }
          const path = new Path2D();
          path.rect(layerOffsetX, layerOffsetY, layerWidth, layerHeight);
          if (hasInnerCutout) {
            path.rect(maskX0, maskY0, maskX1 - maskX0, maskY1 - maskY0);
          }
          layerCtx.save();
          layerCtx.globalAlpha = alpha / 255;
          layerCtx.setTransform(1, 0, 0, 1, 0, 0);
          layerCtx.clip(path, "evenodd");
          layerCtx.globalCompositeOperation = "destination-in";
          layerCtx.fillStyle = "#000000";
          layerCtx.fillRect(layerOffsetX, layerOffsetY, layerWidth, layerHeight);
          layerCtx.restore();
        }
        genericComposeSMask(smask, layerCtx, width, height, layerOffsetX, layerOffsetY) {
          const {
            context: maskCtx,
            offsetX: maskOffsetX,
            offsetY: maskOffsetY
          } = smask;
          layerCtx.save();
          layerCtx.globalAlpha = 1;
          layerCtx.setTransform(1, 0, 0, 1, 0, 0);
          const clip = new Path2D();
          clip.rect(layerOffsetX, layerOffsetY, width, height);
          layerCtx.clip(clip);
          layerCtx.globalCompositeOperation = "destination-in";
          layerCtx.drawImage(maskCtx.canvas, layerOffsetX - maskOffsetX, layerOffsetY - maskOffsetY, width, height, layerOffsetX, layerOffsetY, width, height);
          layerCtx.restore();
        }
        save(opIdx) {
          if (this.inSMaskMode) {
            copyCtxState(this.ctx, this.suspendedCtx);
          }
          this.ctx.save();
          const old = this.current;
          this.stateStack.push(old);
          this.current = old.clone();
          this.dependencyTracker?.save(opIdx);
        }
        restore(opIdx) {
          this.dependencyTracker?.restore(opIdx);
          if (this.stateStack.length === 0) {
            if (this.inSMaskMode) {
              this.endSMaskMode();
            }
            return;
          }
          this.current = this.stateStack.pop();
          this.ctx.restore();
          if (this.inSMaskMode) {
            copyCtxState(this.suspendedCtx, this.ctx);
            this.ctx.setTransform(this.suspendedCtx.getTransform());
          }
          this.checkSMaskState(opIdx);
          this.pendingClip = null;
          this._cachedScaleForStroking[0] = -1;
          this._cachedGetSinglePixelWidth = null;
        }
        transform(opIdx, a, b, c, d, e, f) {
          this.dependencyTracker?.recordIncrementalData("transform", opIdx);
          this.ctx.transform(a, b, c, d, e, f);
          this._cachedScaleForStroking[0] = -1;
          this._cachedGetSinglePixelWidth = null;
        }
        constructPath(opIdx, op, data, minMax) {
          let [path] = data;
          if (!minMax) {
            path || (path = data[0] = new Path2D());
            if (op !== OPS.stroke && op !== OPS.closeStroke) {
              this.current.tilingPatternDims = null;
            }
            this[op](opIdx, path);
            return;
          }
          if (this.dependencyTracker !== null) {
            const outerExtraSize = op === OPS.stroke ? this.current.lineWidth / 2 : 0;
            this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, this.ctx, minMax[0] - outerExtraSize, minMax[2] + outerExtraSize, minMax[1] - outerExtraSize, minMax[3] + outerExtraSize).recordDependencies(opIdx, ["transform"]);
          }
          if (!(path instanceof Path2D)) {
            path = data[0] = makePathFromDrawOPS(path);
          }
          Util.axialAlignedBoundingBox(minMax, getCurrentTransform(this.ctx), this.current.minMax);
          const tilingDims = this.current.tilingPatternDims;
          if (tilingDims && op !== OPS.stroke && op !== OPS.closeStroke && this.current.fillColor instanceof TilingPattern) {
            const clippedBBox = Util.intersect(this.current.clipBox, this.current.minMax);
            if (!clippedBBox) {
              this.current.tilingPatternDims = null;
            } else {
              this.current.fillColor.updatePatternDims(clippedBBox, tilingDims);
            }
          }
          this[op](opIdx, path);
          this._pathStartIdx = opIdx;
        }
        closePath(opIdx) {
          this.ctx.closePath();
        }
        stroke(opIdx, path, consumePath = true) {
          const started = consumePath && __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.strokeAlpha);
          const ctx = this.ctx;
          const strokeColor = this.current.strokeColor;
          ctx.globalAlpha = this.current.strokeAlpha;
          if (this.contentVisible) {
            if (typeof strokeColor === "object" && strokeColor?.getPattern) {
              const baseTransform = strokeColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
              ctx.save();
              ctx.strokeStyle = strokeColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.STROKE, opIdx);
              if (baseTransform) {
                const newPath = new Path2D();
                newPath.addPath(path, ctx.getTransform().invertSelf().multiplySelf(baseTransform));
                path = newPath;
              }
              this.rescaleAndStroke(path, false);
              ctx.restore();
            } else {
              this.rescaleAndStroke(path, true);
            }
          }
          this.dependencyTracker?.recordDependencies(opIdx, Dependencies.stroke);
          if (consumePath) {
            this.consumePath(opIdx, path, this.current.getClippedPathBoundingBox(PathType.STROKE, getCurrentTransform(this.ctx)));
          }
          ctx.globalAlpha = this.current.fillAlpha;
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        closeStroke(opIdx, path) {
          this.stroke(opIdx, path);
        }
        fill(opIdx, path, consumePath = true) {
          const started = consumePath && __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          const ctx = this.ctx;
          const fillColor = this.current.fillColor;
          const isPatternFill = this.current.patternFill;
          let needRestore = false;
          const intersect = this.current.getClippedPathBoundingBox();
          this.dependencyTracker?.recordDependencies(opIdx, Dependencies.fill);
          if (isPatternFill) {
            const dims = this.current.tilingPatternDims;
            const tileIdx = dims && fillColor.canSkipPatternCanvas(dims);
            if (tileIdx) {
              fillColor.drawPattern(this, path, this.pendingEOFill, tileIdx, opIdx);
              this.pendingEOFill = false;
              if (consumePath) {
                this.consumePath(opIdx, path, intersect);
              }
              this.current.tilingPatternDims = null;
              __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
              return;
            }
            const baseTransform = fillColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
            this.dependencyTracker?.save(opIdx);
            ctx.save();
            ctx.fillStyle = fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL, opIdx);
            if (baseTransform) {
              const newPath = new Path2D();
              newPath.addPath(path, ctx.getTransform().invertSelf().multiplySelf(baseTransform));
              path = newPath;
            }
            needRestore = true;
          }
          if (this.contentVisible && intersect !== null) {
            if (this.pendingEOFill) {
              ctx.fill(path, "evenodd");
              this.pendingEOFill = false;
            } else {
              ctx.fill(path);
            }
          }
          if (needRestore) {
            ctx.restore();
            this.dependencyTracker?.restore(opIdx);
          }
          if (consumePath) {
            this.consumePath(opIdx, path, intersect);
          }
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        eoFill(opIdx, path) {
          this.pendingEOFill = true;
          this.fill(opIdx, path);
        }
        fillStroke(opIdx, path) {
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, Math.min(this.current.fillAlpha, this.current.strokeAlpha));
          this.fill(opIdx, path, false);
          this.stroke(opIdx, path, false);
          this.consumePath(opIdx, path);
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        eoFillStroke(opIdx, path) {
          this.pendingEOFill = true;
          this.fillStroke(opIdx, path);
        }
        closeFillStroke(opIdx, path) {
          this.fillStroke(opIdx, path);
        }
        closeEOFillStroke(opIdx, path) {
          this.pendingEOFill = true;
          this.fillStroke(opIdx, path);
        }
        endPath(opIdx, path) {
          this.consumePath(opIdx, path);
        }
        rawFillPath(opIdx, path) {
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          this.ctx.fill(path);
          this.dependencyTracker?.recordDependencies(opIdx, Dependencies.rawFillPath).recordOperation(opIdx);
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        clip(opIdx) {
          this.dependencyTracker?.recordFutureForcedDependency("clipMode", opIdx);
          this.pendingClip = NORMAL_CLIP;
        }
        eoClip(opIdx) {
          this.dependencyTracker?.recordFutureForcedDependency("clipMode", opIdx);
          this.pendingClip = EO_CLIP;
        }
        beginText(opIdx) {
          this.current.textMatrix = null;
          this.current.textMatrixScale = 1;
          this.current.x = this.current.lineX = 0;
          this.current.y = this.current.lineY = 0;
          this.dependencyTracker?.recordOpenMarker(opIdx).resetIncrementalData("sameLineText").resetIncrementalData("moveText", opIdx);
        }
        endText(opIdx) {
          const paths = this.pendingTextPaths;
          const ctx = this.ctx;
          if (this.dependencyTracker) {
            const {
              dependencyTracker
            } = this;
            if (paths !== void 0) {
              dependencyTracker.recordFutureForcedDependency("textClip", dependencyTracker.getOpenMarker()).recordFutureForcedDependency("textClip", opIdx);
            }
            dependencyTracker.recordCloseMarker(opIdx);
          }
          if (paths !== void 0) {
            const newPath = new Path2D();
            const invTransf = ctx.getTransform().invertSelf();
            for (const {
              transform,
              x,
              y,
              fontSize,
              path
            } of paths) {
              if (!path) {
                continue;
              }
              newPath.addPath(path, new DOMMatrix(transform).preMultiplySelf(invTransf).translate(x, y).scale(fontSize, -fontSize));
            }
            ctx.clip(newPath);
          }
          delete this.pendingTextPaths;
        }
        setCharSpacing(opIdx, spacing) {
          this.dependencyTracker?.recordSimpleData("charSpacing", opIdx);
          this.current.charSpacing = spacing;
        }
        setWordSpacing(opIdx, spacing) {
          this.dependencyTracker?.recordSimpleData("wordSpacing", opIdx);
          this.current.wordSpacing = spacing;
        }
        setHScale(opIdx, scale) {
          this.dependencyTracker?.recordSimpleData("hScale", opIdx);
          this.current.textHScale = scale / 100;
        }
        setLeading(opIdx, leading) {
          this.dependencyTracker?.recordSimpleData("leading", opIdx);
          this.current.leading = -leading;
        }
        setFont(opIdx, fontRefName, size2) {
          this.dependencyTracker?.recordSimpleData("font", opIdx).recordSimpleDataFromNamed("fontObj", fontRefName, opIdx);
          const fontObj = this.commonObjs.get(fontRefName);
          const current = this.current;
          if (!fontObj) {
            throw new Error(`Can't find font for ${fontRefName}`);
          }
          current.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
          if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {
            warn("Invalid font matrix for font " + fontRefName);
          }
          if (size2 < 0) {
            size2 = -size2;
            current.fontDirection = -1;
          } else {
            current.fontDirection = 1;
          }
          this.current.font = fontObj;
          this.current.fontSize = size2;
          if (fontObj.isType3Font) {
            return;
          }
          const name = fontObj.loadedName || "sans-serif";
          const typeface = fontObj.systemFontInfo?.css || `"${name}", ${fontObj.fallbackName}`;
          let bold = "normal";
          if (fontObj.black) {
            bold = "900";
          } else if (fontObj.bold) {
            bold = "bold";
          }
          const italic = fontObj.italic ? "italic" : "normal";
          const browserFontSize = MathClamp(size2, MIN_FONT_SIZE, MAX_FONT_SIZE);
          this.current.fontSizeScale = size2 / browserFontSize;
          this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
        }
        setTextRenderingMode(opIdx, mode) {
          this.dependencyTracker?.recordSimpleData("textRenderingMode", opIdx);
          this.current.textRenderingMode = mode;
        }
        setTextRise(opIdx, rise) {
          this.dependencyTracker?.recordSimpleData("textRise", opIdx);
          this.current.textRise = rise;
        }
        moveText(opIdx, x, y) {
          this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText", opIdx);
          this.current.x = this.current.lineX += x;
          this.current.y = this.current.lineY += y;
        }
        setLeadingMoveText(opIdx, x, y) {
          this.setLeading(opIdx, -y);
          this.moveText(opIdx, x, y);
        }
        setTextMatrix(opIdx, matrix) {
          this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix", opIdx);
          const {
            current
          } = this;
          current.textMatrix = matrix;
          current.textMatrixScale = Math.hypot(matrix[0], matrix[1]);
          current.x = current.lineX = 0;
          current.y = current.lineY = 0;
        }
        nextLine(opIdx) {
          this.moveText(opIdx, 0, this.current.leading);
          this.dependencyTracker?.recordIncrementalData("moveText", this.dependencyTracker.getSimpleIndex("leading") ?? opIdx);
        }
        paintChar(opIdx, character, x, y, patternFillTransform, patternStrokeTransform) {
          const ctx = this.ctx;
          const current = this.current;
          const font = current.font;
          const textRenderingMode = current.textRenderingMode;
          const fontSize = current.fontSize / current.fontSizeScale;
          const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
          const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
          const patternFill = current.patternFill && !font.missingFile;
          const patternStroke = current.patternStroke && !font.missingFile;
          let path;
          if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
            path = font.getPathGenerator(this.commonObjs, character);
          }
          if (path && (font.disableFontFace || patternFill || patternStroke)) {
            ctx.save();
            ctx.translate(x, y);
            ctx.scale(fontSize, -fontSize);
            this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font);
            let currentTransform;
            if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
              if (patternFillTransform) {
                currentTransform = ctx.getTransform();
                ctx.setTransform(...patternFillTransform);
                const scaledPath = __privateMethod(this, _CanvasGraphics_instances, getScaledPath_fn).call(this, path, currentTransform, patternFillTransform);
                ctx.fill(scaledPath);
              } else {
                ctx.fill(path);
              }
            }
            if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
              if (patternStrokeTransform) {
                currentTransform || (currentTransform = ctx.getTransform());
                ctx.setTransform(...patternStrokeTransform);
                const {
                  a,
                  b,
                  c,
                  d
                } = currentTransform;
                const invPatternTransform = Util.inverseTransform(patternStrokeTransform);
                const transf = Util.transform([a, b, c, d, 0, 0], invPatternTransform);
                Util.singularValueDecompose2dScale(transf, XY);
                ctx.lineWidth *= Math.max(XY[0], XY[1]) / fontSize;
                ctx.stroke(__privateMethod(this, _CanvasGraphics_instances, getScaledPath_fn).call(this, path, currentTransform, patternStrokeTransform));
              } else {
                ctx.lineWidth /= fontSize;
                ctx.stroke(path);
              }
            }
            ctx.restore();
          } else {
            if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
              ctx.fillText(character, x, y);
              this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font, fontSize, x, y, () => ctx.measureText(character));
            }
            if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
              if (this.dependencyTracker) {
                this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font, fontSize, x, y, () => ctx.measureText(character)).recordDependencies(opIdx, Dependencies.stroke);
              }
              ctx.strokeText(character, x, y);
            }
          }
          if (isAddToPathSet) {
            const paths = this.pendingTextPaths || (this.pendingTextPaths = []);
            paths.push({
              transform: getCurrentTransform(ctx),
              x,
              y,
              fontSize,
              path
            });
            this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font, fontSize, x, y);
          }
        }
        get isFontSubpixelAAEnabled() {
          const tmpCanvas = this.canvasFactory.create(10, 10);
          const ctx = tmpCanvas.context;
          ctx.scale(1.5, 1);
          ctx.fillText("I", 0, 10);
          const data = ctx.getImageData(0, 0, 10, 10).data;
          this.canvasFactory.destroy(tmpCanvas);
          let enabled = false;
          for (let i = 3; i < data.length; i += 4) {
            if (data[i] > 0 && data[i] < 255) {
              enabled = true;
              break;
            }
          }
          return shadow(this, "isFontSubpixelAAEnabled", enabled);
        }
        showText(opIdx, glyphs) {
          if (this.dependencyTracker) {
            this.dependencyTracker.recordDependencies(opIdx, Dependencies.showText).resetBBox(opIdx);
            if (this.current.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG) {
              this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
            }
          }
          const current = this.current;
          const font = current.font;
          if (font.isType3Font) {
            const started2 = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, current.fillAlpha);
            this.showType3Text(opIdx, glyphs);
            this.dependencyTracker?.recordShowTextOperation(opIdx);
            __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started2);
            return;
          }
          const fontSize = current.fontSize;
          if (fontSize === 0) {
            this.dependencyTracker?.recordOperation(opIdx);
            return;
          }
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, current.fillAlpha);
          const ctx = this.ctx;
          const fontSizeScale = current.fontSizeScale;
          const charSpacing = current.charSpacing;
          const wordSpacing = current.wordSpacing;
          const fontDirection = current.fontDirection;
          const textHScale = current.textHScale * fontDirection;
          const glyphsLength = glyphs.length;
          const vertical = font.vertical;
          const spacingDir = vertical ? 1 : -1;
          const defaultVMetrics = font.defaultVMetrics;
          const widthAdvanceScale = fontSize * current.fontMatrix[0];
          const simpleFillText = current.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
          ctx.save();
          if (current.textMatrix) {
            ctx.transform(...current.textMatrix);
          }
          ctx.translate(current.x, current.y + current.textRise);
          if (fontDirection > 0) {
            ctx.scale(textHScale, -1);
          } else {
            ctx.scale(textHScale, 1);
          }
          let patternFillTransform, patternStrokeTransform;
          const fillStrokeMode = current.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
          const needsFill = fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE;
          const needsStroke = fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE;
          let lineWidth = current.lineWidth;
          const scale = current.textMatrixScale;
          if (scale === 0 || lineWidth === 0) {
            if (needsStroke) {
              lineWidth = this.getSinglePixelWidth();
            }
          } else {
            lineWidth /= scale;
          }
          if (fontSizeScale !== 1) {
            ctx.scale(fontSizeScale, fontSizeScale);
            lineWidth /= fontSizeScale;
          }
          ctx.lineWidth = lineWidth;
          if (needsFill && current.patternFill) {
            ctx.save();
            const pattern = current.fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL, opIdx);
            patternFillTransform = getCurrentTransform(ctx);
            ctx.restore();
            ctx.fillStyle = pattern;
          }
          if (needsStroke && current.patternStroke) {
            ctx.save();
            const pattern = current.strokeColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.STROKE, opIdx);
            patternStrokeTransform = getCurrentTransform(ctx);
            ctx.restore();
            ctx.strokeStyle = pattern;
          }
          if (font.isInvalidPDFjsFont) {
            const chars = [];
            let width = 0;
            for (const glyph of glyphs) {
              chars.push(glyph.unicode);
              width += glyph.width;
            }
            const joinedChars = chars.join("");
            ctx.fillText(joinedChars, 0, 0);
            if (this.dependencyTracker !== null) {
              const measure = ctx.measureText(joinedChars);
              this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure.actualBoundingBoxLeft, measure.actualBoundingBoxRight, -measure.actualBoundingBoxAscent, measure.actualBoundingBoxDescent).recordShowTextOperation(opIdx);
            }
            current.x += width * widthAdvanceScale * textHScale;
            ctx.restore();
            this.compose();
            __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
            return;
          }
          let x = 0, i;
          for (i = 0; i < glyphsLength; ++i) {
            const glyph = glyphs[i];
            if (typeof glyph === "number") {
              x += spacingDir * glyph * fontSize / 1e3;
              continue;
            }
            let restoreNeeded = false;
            const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
            const character = glyph.fontChar;
            const accent = glyph.accent;
            let scaledX, scaledY;
            let width = glyph.width;
            if (vertical) {
              const vmetric = glyph.vmetric || defaultVMetrics;
              const vx = -(glyph.vmetric ? vmetric[1] : width * 0.5) * widthAdvanceScale;
              const vy = vmetric[2] * widthAdvanceScale;
              width = vmetric ? -vmetric[0] : width;
              scaledX = vx / fontSizeScale;
              scaledY = (x + vy) / fontSizeScale;
            } else {
              scaledX = x / fontSizeScale;
              scaledY = 0;
            }
            let measure;
            if (font.remeasure && width > 0) {
              measure = ctx.measureText(character);
              const measuredWidth = measure.width * 1e3 / fontSize * fontSizeScale;
              if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
                const characterScaleX = width / measuredWidth;
                restoreNeeded = true;
                ctx.save();
                ctx.scale(characterScaleX, 1);
                scaledX /= characterScaleX;
              } else if (width !== measuredWidth) {
                scaledX += (width - measuredWidth) / 2e3 * fontSize / fontSizeScale;
              }
            }
            if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
              if (simpleFillText && !accent) {
                ctx.fillText(character, scaledX, scaledY);
                this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, measure ? {
                  bbox: null
                } : font, fontSize / fontSizeScale, scaledX, scaledY, () => measure ?? ctx.measureText(character));
              } else {
                this.paintChar(opIdx, character, scaledX, scaledY, patternFillTransform, patternStrokeTransform);
                if (accent) {
                  const scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale;
                  const scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale;
                  this.paintChar(opIdx, accent.fontChar, scaledAccentX, scaledAccentY, patternFillTransform, patternStrokeTransform);
                }
              }
            }
            const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
            x += charWidth;
            if (restoreNeeded) {
              ctx.restore();
            }
          }
          if (vertical) {
            current.y -= x;
          } else {
            current.x += x * textHScale;
          }
          ctx.restore();
          this.compose();
          this.dependencyTracker?.recordShowTextOperation(opIdx);
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        showType3Text(opIdx, glyphs) {
          const ctx = this.ctx;
          const current = this.current;
          const font = current.font;
          const fontSize = current.fontSize;
          const fontDirection = current.fontDirection;
          const spacingDir = font.vertical ? 1 : -1;
          const charSpacing = current.charSpacing;
          const wordSpacing = current.wordSpacing;
          const textHScale = current.textHScale * fontDirection;
          const fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;
          const glyphsLength = glyphs.length;
          const isTextInvisible = current.textRenderingMode === TextRenderingMode.INVISIBLE;
          let i, glyph, width, spacingLength;
          if (isTextInvisible || fontSize === 0) {
            return;
          }
          this._cachedScaleForStroking[0] = -1;
          this._cachedGetSinglePixelWidth = null;
          ctx.save();
          if (current.textMatrix) {
            ctx.transform(...current.textMatrix);
          }
          ctx.translate(current.x, current.y + current.textRise);
          ctx.scale(textHScale, fontDirection);
          const dependencyTracker = this.dependencyTracker;
          this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
          for (i = 0; i < glyphsLength; ++i) {
            glyph = glyphs[i];
            if (typeof glyph === "number") {
              spacingLength = spacingDir * glyph * fontSize / 1e3;
              this.ctx.translate(spacingLength, 0);
              current.x += spacingLength * textHScale;
              continue;
            }
            const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
            const operatorList = font.charProcOperatorList[glyph.operatorListId];
            if (!operatorList) {
              warn(`Type3 character "${glyph.operatorListId}" is not available.`);
            } else if (this.contentVisible) {
              this.save();
              if (operatorList.fnArray[0] === OPS.setCharWidth) {
                current.fillAlpha = current.strokeAlpha = 1;
                ctx.globalAlpha = 1;
              }
              ctx.scale(fontSize, fontSize);
              ctx.transform(...fontMatrix);
              this.executeOperatorList(operatorList);
              this.restore();
            }
            const p = [glyph.width, 0];
            Util.applyTransform(p, fontMatrix);
            width = p[0] * fontSize + spacing;
            ctx.translate(width, 0);
            current.x += width * textHScale;
          }
          ctx.restore();
          if (dependencyTracker) {
            this.dependencyTracker = dependencyTracker;
          }
        }
        setCharWidth(opIdx, xWidth, yWidth) {
        }
        setCharWidthAndBounds(opIdx, xWidth, yWidth, llx, lly, urx, ury) {
          const clip = new Path2D();
          clip.rect(llx, lly, urx - llx, ury - lly);
          this.ctx.clip(clip);
          this.dependencyTracker?.recordBBox(opIdx, this.ctx, llx, urx, lly, ury).recordClipBox(opIdx, this.ctx, llx, urx, lly, ury);
          this.endPath(opIdx);
        }
        getColorN_Pattern(opIdx, IR) {
          let pattern;
          if (IR[0] === "TilingPattern") {
            const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
            const canvasGraphicsFactory = {
              createCanvasGraphics: (ctx, renderingOpIdx) => new _CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
                optionalContentConfig: this.optionalContentConfig,
                markedContentStack: this.markedContentStack
              }, void 0, void 0, this.dependencyTracker ? new CanvasNestedDependencyTracker(this.dependencyTracker, renderingOpIdx, true) : null)
            };
            pattern = new TilingPattern(IR, this.ctx, canvasGraphicsFactory, baseTransform);
          } else {
            pattern = this._getPattern(opIdx, IR[1], IR[2]);
          }
          return pattern;
        }
        setStrokeColorN(opIdx, ...args) {
          this.dependencyTracker?.recordSimpleData("strokeColor", opIdx);
          this.current.strokeColor = this.getColorN_Pattern(opIdx, args);
          this.current.patternStroke = true;
        }
        setFillColorN(opIdx, ...args) {
          this.dependencyTracker?.recordSimpleData("fillColor", opIdx);
          const pattern = this.current.fillColor = this.getColorN_Pattern(opIdx, args);
          this.current.patternFill = true;
          this.current.tilingPatternDims = pattern instanceof TilingPattern ? [0, 0, 0, 0] : null;
        }
        setStrokeRGBColor(opIdx, color) {
          this.dependencyTracker?.recordSimpleData("strokeColor", opIdx);
          this.ctx.strokeStyle = this.current.strokeColor = color;
          this.current.patternStroke = false;
        }
        setStrokeTransparent(opIdx) {
          this.dependencyTracker?.recordSimpleData("strokeColor", opIdx);
          this.ctx.strokeStyle = this.current.strokeColor = "transparent";
          this.current.patternStroke = false;
        }
        setFillRGBColor(opIdx, color) {
          this.dependencyTracker?.recordSimpleData("fillColor", opIdx);
          this.ctx.fillStyle = this.current.fillColor = color;
          this.current.patternFill = false;
          this.current.tilingPatternDims = null;
        }
        setFillTransparent(opIdx) {
          this.dependencyTracker?.recordSimpleData("fillColor", opIdx);
          this.ctx.fillStyle = this.current.fillColor = "transparent";
          this.current.patternFill = false;
          this.current.tilingPatternDims = null;
        }
        _getPattern(opIdx, objId, matrix = null) {
          const pattern = this.cachedPatterns.getOrInsertComputed(objId, () => getShadingPattern(this.getObject(opIdx, objId)));
          if (matrix) {
            pattern.matrix = matrix;
          }
          return pattern;
        }
        shadingFill(opIdx, objId) {
          if (!this.contentVisible) {
            return;
          }
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          const ctx = this.ctx;
          this.save(opIdx);
          const pattern = this._getPattern(opIdx, objId);
          ctx.fillStyle = pattern.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.SHADING, opIdx);
          const inv = getCurrentTransformInverse(ctx);
          if (inv) {
            const {
              width,
              height
            } = ctx.canvas;
            const minMax = F32_BBOX_INIT.slice();
            Util.axialAlignedBoundingBox([0, 0, width, height], inv, minMax);
            const [x0, y0, x1, y1] = minMax;
            this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
          } else {
            this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
          }
          this.dependencyTracker?.resetBBox(opIdx).recordFullPageBBox(opIdx).recordDependencies(opIdx, Dependencies.transform).recordDependencies(opIdx, Dependencies.fill).recordOperation(opIdx);
          this.compose(this.current.getClippedPathBoundingBox());
          this.restore(opIdx);
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        beginInlineImage() {
          unreachable("Should not call beginInlineImage");
        }
        beginImageData() {
          unreachable("Should not call beginImageData");
        }
        paintFormXObjectBegin(opIdx, matrix, bbox) {
          if (!this.contentVisible) {
            return;
          }
          this.save(opIdx);
          this.baseTransformStack.push(this.baseTransform);
          if (matrix) {
            this.transform(opIdx, ...matrix);
          }
          this.baseTransform = getCurrentTransform(this.ctx);
          if (bbox) {
            Util.axialAlignedBoundingBox(bbox, this.baseTransform, this.current.minMax);
            const [x0, y0, x1, y1] = bbox;
            const clip = new Path2D();
            clip.rect(x0, y0, x1 - x0, y1 - y0);
            this.ctx.clip(clip);
            this.dependencyTracker?.recordClipBox(opIdx, this.ctx, x0, x1, y0, y1);
            this.endPath(opIdx);
          }
        }
        paintFormXObjectEnd(opIdx) {
          if (!this.contentVisible) {
            return;
          }
          this.restore(opIdx);
          this.baseTransform = this.baseTransformStack.pop();
        }
        beginGroup(opIdx, group2) {
          if (!this.contentVisible) {
            return;
          }
          this.save(opIdx);
          const {
            inSMaskMode
          } = this;
          if (inSMaskMode) {
            this.endSMaskMode();
            this.current.activeSMask = null;
          }
          const currentCtx = this.ctx;
          if ((!group2.needsIsolation || !group2.isolated && !group2.hasSoftMask) && !group2.knockout && !group2.isGray && __privateGet(this, _knockoutGroupLevel) === 0 && currentCtx.globalAlpha === 1 && currentCtx.globalCompositeOperation === "source-over" && !inSMaskMode) {
            if (group2.bbox) {
              let clip = new Path2D();
              const [x0, y0, x1, y1] = group2.bbox;
              clip.rect(x0, y0, x1 - x0, y1 - y0);
              if (group2.matrix) {
                const path = new Path2D();
                path.addPath(clip, new DOMMatrix(group2.matrix));
                clip = path;
              }
              currentCtx.clip(clip);
            }
            this.groupStack.push(null);
            __privateGet(this, _groupStackMeta).push(null);
            this.groupLevel++;
            return;
          }
          if (!group2.isolated && !group2.knockout && __privateGet(this, _knockoutGroupLevel) === 0) {
            info("TODO: Fully support non-isolated non-knockout groups.");
          }
          const currentTransform = getCurrentTransform(currentCtx);
          if (group2.matrix) {
            currentCtx.transform(...group2.matrix);
          }
          const canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
          let bounds;
          if (group2.bbox) {
            bounds = F32_BBOX_INIT.slice();
            Util.axialAlignedBoundingBox(group2.bbox, getCurrentTransform(currentCtx), bounds);
            bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
          } else {
            bounds = canvasBounds;
          }
          const offsetX = Math.floor(bounds[0]);
          const offsetY = Math.floor(bounds[1]);
          const drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
          const drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
          this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);
          const scratchCanvas = this.canvasFactory.create(drawnWidth, drawnHeight);
          if (group2.smask) {
            this.smaskGroupCanvases.push(scratchCanvas);
          }
          const groupCtx = scratchCanvas.context;
          const backdropCtx = group2.knockout && !group2.isolated ? currentCtx : null;
          const hasInnerBackdrop = !group2.isolated && !group2.knockout && !group2.smask && group2.needsIsolation && __privateGet(this, _knockoutGroupLevel) > 0;
          const knockoutMaskEntry = group2.knockout ? this.canvasFactory.create(drawnWidth, drawnHeight) : null;
          const savedKnockoutLevel = __privateGet(this, _knockoutGroupLevel);
          if (group2.knockout) {
            __privateWrapper(this, _knockoutGroupLevel)._++;
          } else {
            __privateSet(this, _knockoutGroupLevel, 0);
          }
          groupCtx.translate(-offsetX, -offsetY);
          groupCtx.transform(...currentTransform);
          const needsBackdropCopy = !group2.isolated && !group2.smask && group2.needsIsolation;
          const replaceBackdrop = needsBackdropCopy && !inSMaskMode && savedKnockoutLevel === 0 && !group2.knockout && !group2.isGray && group2.hasSoftMask && currentCtx.globalAlpha === 1 && currentCtx.globalCompositeOperation === "source-over" && this.current.transferMaps === "none";
          if (needsBackdropCopy && (inSMaskMode || replaceBackdrop)) {
            groupCtx.save();
            groupCtx.setTransform(1, 0, 0, 1, 0, 0);
            groupCtx.drawImage(currentCtx.canvas, -offsetX, -offsetY);
            groupCtx.restore();
          }
          if (group2.bbox) {
            let clip = new Path2D();
            const [x0, y0, x1, y1] = group2.bbox;
            clip.rect(x0, y0, x1 - x0, y1 - y0);
            if (group2.matrix) {
              const path = new Path2D();
              path.addPath(clip, new DOMMatrix(group2.matrix));
              clip = path;
            }
            groupCtx.clip(clip);
          }
          if (group2.smask) {
            this.smaskStack.push({
              canvas: scratchCanvas.canvas,
              context: groupCtx,
              offsetX,
              offsetY,
              subtype: group2.smask.subtype,
              backdrop: group2.smask.backdrop,
              transferMap: group2.smask.transferMap || null
            });
          }
          if (!group2.smask || this.dependencyTracker) {
            currentCtx.setTransform(1, 0, 0, 1, 0, 0);
            currentCtx.translate(offsetX, offsetY);
            currentCtx.save();
          }
          copyCtxState(currentCtx, groupCtx);
          this.ctx = groupCtx;
          this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha", "strokeAlpha", "globalCompositeOperation"]).pushBaseTransform(currentCtx);
          this.setGState(opIdx, [["BM", "source-over"], ["ca", 1], ["CA", 1], ["TR", null]]);
          this.groupStack.push(currentCtx);
          __privateGet(this, _groupStackMeta).push({
            backdropCtx,
            savedKnockoutLevel,
            offsetX,
            offsetY,
            hasInnerBackdrop,
            replaceBackdrop,
            knockoutMaskEntry,
            knockoutTempEntry: null,
            knockoutBackdropEntry: null
          });
          this.groupLevel++;
        }
        endGroup(opIdx, group2) {
          if (!this.contentVisible) {
            return;
          }
          this.groupLevel--;
          const groupCtx = this.ctx;
          const ctx = this.groupStack.pop();
          const groupMeta = __privateGet(this, _groupStackMeta).pop();
          if (groupMeta) {
            __privateSet(this, _knockoutGroupLevel, groupMeta.savedKnockoutLevel);
          }
          if (ctx === null) {
            this.restore(opIdx);
            return;
          }
          if (group2.isGray) {
            __privateMethod(this, _CanvasGraphics_instances, convertGroupToGray_fn).call(this, groupCtx);
          }
          this.ctx = ctx;
          this.ctx.imageSmoothingEnabled = false;
          this.dependencyTracker?.popBaseTransform();
          if (group2.smask) {
            this.tempSMask = this.smaskStack.pop();
            this.restore(opIdx);
            if (this.dependencyTracker) {
              this.ctx.restore();
              if (this.inSMaskMode) {
                this.ctx.setTransform(this.suspendedCtx.getTransform());
              }
            }
            __privateMethod(this, _CanvasGraphics_instances, destroyKnockoutPools_fn).call(this, groupMeta);
          } else {
            this.ctx.restore();
            const currentMtx = getCurrentTransform(this.ctx);
            this.restore(opIdx);
            this.ctx.save();
            this.ctx.setTransform(...currentMtx);
            const dirtyBox = F32_BBOX_INIT.slice();
            Util.axialAlignedBoundingBox([0, 0, groupCtx.canvas.width, groupCtx.canvas.height], currentMtx, dirtyBox);
            const parentGroupMeta = __privateGet(this, _groupStackMeta).at(-1);
            if (__privateGet(this, _knockoutGroupLevel) > 0) {
              if (groupMeta.hasInnerBackdrop) {
                const {
                  width,
                  height
                } = groupCtx.canvas;
                const colorEntry = this.canvasFactory.create(width, height);
                const colorCtx = colorEntry.context;
                colorCtx.drawImage(ctx.canvas, groupMeta.offsetX, groupMeta.offsetY, width, height, 0, 0, width, height);
                colorCtx.globalCompositeOperation = "source-over";
                colorCtx.drawImage(groupCtx.canvas, 0, 0);
                const shapeMaskEntry = __privateMethod(this, _CanvasGraphics_instances, createKnockoutMaskCanvas_fn).call(this, groupCtx.canvas);
                colorCtx.globalCompositeOperation = "destination-in";
                colorCtx.drawImage(shapeMaskEntry.canvas, 0, 0);
                const sourceCompositeOperation = this.ctx.globalCompositeOperation;
                const sourceAlpha = this.ctx.globalAlpha;
                const sourceFilter = this.ctx.filter;
                this.ctx.save();
                this.ctx.setTransform(...currentMtx);
                this.ctx.globalAlpha = 1;
                if (FeatureTest.isCanvasFilterSupported) {
                  this.ctx.filter = "none";
                }
                this.ctx.globalCompositeOperation = "destination-out";
                this.ctx.drawImage(shapeMaskEntry.canvas, 0, 0);
                this.ctx.globalCompositeOperation = sourceCompositeOperation;
                this.ctx.globalAlpha = sourceAlpha;
                if (FeatureTest.isCanvasFilterSupported) {
                  this.ctx.filter = sourceFilter ?? "none";
                }
                this.ctx.drawImage(colorEntry.canvas, 0, 0);
                this.ctx.restore();
                this.canvasFactory.destroy(shapeMaskEntry);
                this.canvasFactory.destroy(colorEntry);
              } else {
                const backdropCtx = parentGroupMeta?.backdropCtx ?? null;
                __privateMethod(this, _CanvasGraphics_instances, compositeKnockoutSurface_fn).call(this, this.ctx, groupCtx.canvas, {
                  backdropCanvas: backdropCtx?.canvas ?? null,
                  destTransform: currentMtx,
                  backdropOffset: backdropCtx ? [parentGroupMeta.offsetX + groupMeta.offsetX, parentGroupMeta.offsetY + groupMeta.offsetY] : [0, 0],
                  sourceAlpha: this.ctx.globalAlpha,
                  sourceFilter: this.ctx.filter
                });
              }
            } else {
              if (groupMeta.replaceBackdrop) {
                const clip = new Path2D();
                clip.rect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height);
                this.ctx.clip(clip);
                this.ctx.globalCompositeOperation = "copy";
              }
              this.ctx.drawImage(groupCtx.canvas, 0, 0);
            }
            this.ctx.restore();
            this.canvasFactory.destroy({
              canvas: groupCtx.canvas,
              context: groupCtx
            });
            __privateMethod(this, _CanvasGraphics_instances, destroyKnockoutPools_fn).call(this, groupMeta);
            this.compose(dirtyBox);
          }
        }
        beginAnnotation(opIdx, id, rect, transform, matrix, hasOwnCanvas, canvasName) {
          __privateMethod(this, _CanvasGraphics_instances, restoreInitialState_fn).call(this);
          resetCtxToDefault(this.ctx);
          this.ctx.save();
          this.save(opIdx);
          if (this.baseTransform) {
            this.ctx.setTransform(...this.baseTransform);
          }
          if (rect) {
            const width = rect[2] - rect[0];
            const height = rect[3] - rect[1];
            if (hasOwnCanvas && this.annotationCanvasMap) {
              transform = transform.slice();
              transform[4] -= rect[0];
              transform[5] -= rect[1];
              rect = rect.slice();
              rect[0] = rect[1] = 0;
              rect[2] = width;
              rect[3] = height;
              Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx), XY);
              const {
                viewportScale
              } = this;
              const canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);
              const canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);
              this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);
              const {
                canvas,
                context
              } = this.annotationCanvas;
              if (canvasName) {
                const canvases = this.annotationCanvasMap.getOrInsertComputed(id, makeArr);
                canvas.setAttribute("data-canvas-name", canvasName);
                const index = canvases.findIndex((c) => c.getAttribute("data-canvas-name") === canvasName);
                if (index === -1) {
                  canvases.push(canvas);
                } else {
                  canvases[index] = canvas;
                }
              } else {
                this.annotationCanvasMap.set(id, canvas);
              }
              this.annotationCanvas.savedCtx = this.ctx;
              this.ctx = context;
              this.ctx.save();
              this.ctx.setTransform(XY[0], 0, 0, -XY[1], 0, height * XY[1]);
              resetCtxToDefault(this.ctx);
            } else {
              resetCtxToDefault(this.ctx);
              this.endPath(opIdx);
              const clip = new Path2D();
              clip.rect(rect[0], rect[1], width, height);
              this.ctx.clip(clip);
            }
          }
          this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
          this.baseTransformStack.push(this.baseTransform);
          this.transform(opIdx, ...transform);
          this.transform(opIdx, ...matrix);
          this.baseTransform = getCurrentTransform(this.ctx);
        }
        endAnnotation(opIdx) {
          if (this.annotationCanvas) {
            this.ctx.restore();
            __privateMethod(this, _CanvasGraphics_instances, drawFilter_fn).call(this);
            this.ctx = this.annotationCanvas.savedCtx;
            delete this.annotationCanvas.savedCtx;
            delete this.annotationCanvas;
          }
          this.baseTransform = this.baseTransformStack.pop();
        }
        paintImageMaskXObject(opIdx, img) {
          if (!this.contentVisible) {
            return;
          }
          const count = img.count;
          img = this.getObject(opIdx, img.data, img);
          img.count = count;
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          const ctx = this.ctx;
          const mask = this._createMaskCanvas(opIdx, img);
          const maskCanvas = mask.canvas;
          ctx.save();
          ctx.setTransform(1, 0, 0, 1, 0, 0);
          ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
          this.dependencyTracker?.resetBBox(opIdx).recordBBox(opIdx, this.ctx, mask.offsetX, mask.offsetX + maskCanvas.width, mask.offsetY, mask.offsetY + maskCanvas.height).recordOperation(opIdx);
          ctx.restore();
          if (mask.canvasEntry) {
            this.canvasFactory.destroy(mask.canvasEntry);
          }
          this.compose();
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        paintImageMaskXObjectRepeat(opIdx, img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
          if (!this.contentVisible) {
            return;
          }
          img = this.getObject(opIdx, img.data, img);
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          const ctx = this.ctx;
          ctx.save();
          const currentTransform = getCurrentTransform(ctx);
          ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
          const mask = this._createMaskCanvas(opIdx, img);
          ctx.setTransform(1, 0, 0, 1, mask.offsetX - currentTransform[4], mask.offsetY - currentTransform[5]);
          this.dependencyTracker?.resetBBox(opIdx);
          for (let i = 0, ii = positions.length; i < ii; i += 2) {
            const trans = Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
            ctx.drawImage(mask.canvas, trans[4], trans[5]);
            this.dependencyTracker?.recordBBox(opIdx, this.ctx, trans[4], trans[4] + mask.canvas.width, trans[5], trans[5] + mask.canvas.height);
          }
          ctx.restore();
          if (mask.canvasEntry) {
            this.canvasFactory.destroy(mask.canvasEntry);
          }
          this.compose();
          this.dependencyTracker?.recordOperation(opIdx);
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        paintImageMaskXObjectGroup(opIdx, images) {
          if (!this.contentVisible) {
            return;
          }
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          const ctx = this.ctx;
          const fillColor = this.current.fillColor;
          const isPatternFill = this.current.patternFill;
          this.dependencyTracker?.resetBBox(opIdx).recordDependencies(opIdx, Dependencies.transformAndFill);
          for (const image of images) {
            const {
              data,
              width,
              height,
              transform
            } = image;
            const maskCanvas = this.canvasFactory.create(width, height);
            const maskCtx = maskCanvas.context;
            maskCtx.save();
            const img = this.getObject(opIdx, data, image);
            putBinaryImageMask(maskCtx, img);
            maskCtx.globalCompositeOperation = "source-in";
            maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, getCurrentTransformInverse(ctx), PathType.FILL, opIdx) : fillColor;
            maskCtx.fillRect(0, 0, width, height);
            maskCtx.restore();
            ctx.save();
            ctx.transform(...transform);
            ctx.scale(1, -1);
            drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
            this.canvasFactory.destroy(maskCanvas);
            this.dependencyTracker?.recordBBox(opIdx, ctx, 0, width, 0, height);
            ctx.restore();
          }
          this.compose();
          this.dependencyTracker?.recordOperation(opIdx);
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        paintImageXObject(opIdx, objId) {
          if (!this.contentVisible) {
            return;
          }
          const imgData = this.getObject(opIdx, objId);
          if (!imgData) {
            warn("Dependent image isn't ready yet");
            return;
          }
          this.paintInlineImageXObject(opIdx, imgData);
        }
        paintImageXObjectRepeat(opIdx, objId, scaleX, scaleY, positions) {
          if (!this.contentVisible) {
            return;
          }
          const imgData = this.getObject(opIdx, objId);
          if (!imgData) {
            warn("Dependent image isn't ready yet");
            return;
          }
          const width = imgData.width;
          const height = imgData.height;
          const map2 = [];
          for (let i = 0, ii = positions.length; i < ii; i += 2) {
            map2.push({
              transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
              x: 0,
              y: 0,
              w: width,
              h: height
            });
          }
          this.paintInlineImageXObjectGroup(opIdx, imgData, map2);
        }
        applyTransferMapsToCanvas(ctx) {
          if (this.current.transferMaps !== "none") {
            ctx.filter = this.current.transferMaps;
            ctx.drawImage(ctx.canvas, 0, 0);
            ctx.filter = "none";
          }
          return ctx.canvas;
        }
        applyTransferMapsToBitmap(imgData) {
          if (this.current.transferMaps === "none") {
            return {
              img: imgData.bitmap,
              canvasEntry: null
            };
          }
          const {
            bitmap,
            width,
            height
          } = imgData;
          const tmpCanvas = this.canvasFactory.create(width, height);
          const tmpCtx = tmpCanvas.context;
          tmpCtx.filter = this.current.transferMaps;
          tmpCtx.drawImage(bitmap, 0, 0);
          tmpCtx.filter = "none";
          return {
            img: tmpCanvas.canvas,
            canvasEntry: tmpCanvas
          };
        }
        paintInlineImageXObject(opIdx, imgData) {
          if (!this.contentVisible) {
            return;
          }
          const width = imgData.width;
          const height = imgData.height;
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          const ctx = this.ctx;
          this.save(opIdx);
          const {
            filter: filter2
          } = ctx;
          if (filter2 !== "none" && filter2 !== "") {
            ctx.filter = "none";
          }
          ctx.scale(1 / width, -1 / height);
          let imgToPaint;
          let inlineImgCanvas = null;
          if (imgData.bitmap) {
            const result2 = this.applyTransferMapsToBitmap(imgData);
            imgToPaint = result2.img;
            inlineImgCanvas = result2.canvasEntry;
          } else {
            const tmpCanvas = this.canvasFactory.create(width, height);
            putBinaryImageData(tmpCanvas.context, imgData);
            imgToPaint = this.applyTransferMapsToCanvas(tmpCanvas.context);
            inlineImgCanvas = tmpCanvas;
          }
          const scaled = this._scaleImage(imgToPaint, getCurrentTransformInverse(ctx));
          ctx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(ctx), imgData.interpolate);
          if (this.dependencyTracker) {
            this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, ctx, 0, width, -height, 0).recordDependencies(opIdx, Dependencies.imageXObject).recordOperation(opIdx);
            this.imagesTracker?.record(ctx, width, height, this.dependencyTracker.clipBox);
          }
          drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);
          if (scaled.tmpCanvas) {
            this.canvasFactory.destroy(scaled.tmpCanvas);
          }
          if (inlineImgCanvas) {
            this.canvasFactory.destroy(inlineImgCanvas);
          }
          this.compose();
          this.restore(opIdx);
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        paintInlineImageXObjectGroup(opIdx, imgData, map2) {
          if (!this.contentVisible) {
            return;
          }
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          const ctx = this.ctx;
          let imgToPaint;
          let inlineImgCanvas = null;
          if (imgData.bitmap) {
            imgToPaint = imgData.bitmap;
          } else {
            const w = imgData.width;
            const h = imgData.height;
            const tmpCanvas = this.canvasFactory.create(w, h);
            putBinaryImageData(tmpCanvas.context, imgData);
            imgToPaint = this.applyTransferMapsToCanvas(tmpCanvas.context);
            inlineImgCanvas = tmpCanvas;
          }
          this.dependencyTracker?.resetBBox(opIdx);
          for (const entry of map2) {
            ctx.save();
            ctx.transform(...entry.transform);
            ctx.scale(1, -1);
            drawImageAtIntegerCoords(ctx, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
            this.dependencyTracker?.recordBBox(opIdx, ctx, 0, 1, -1, 0);
            ctx.restore();
          }
          if (inlineImgCanvas) {
            this.canvasFactory.destroy(inlineImgCanvas);
          }
          this.dependencyTracker?.recordOperation(opIdx);
          this.compose();
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        paintSolidColorImageMask(opIdx) {
          if (!this.contentVisible) {
            return;
          }
          const started = __privateMethod(this, _CanvasGraphics_instances, beginKnockoutElement_fn).call(this, this.current.fillAlpha);
          this.dependencyTracker?.resetBBox(opIdx).recordBBox(opIdx, this.ctx, 0, 1, 0, 1).recordDependencies(opIdx, Dependencies.fill).recordOperation(opIdx);
          this.ctx.fillRect(0, 0, 1, 1);
          this.compose();
          __privateMethod(this, _CanvasGraphics_instances, endKnockoutElement_fn).call(this, started);
        }
        markPoint(opIdx, tag) {
        }
        markPointProps(opIdx, tag, properties) {
        }
        beginMarkedContent(opIdx, tag) {
          this.dependencyTracker?.beginMarkedContent(opIdx);
          this.markedContentStack.push({
            visible: true
          });
        }
        beginMarkedContentProps(opIdx, tag, properties) {
          this.dependencyTracker?.beginMarkedContent(opIdx);
          if (tag === "OC") {
            this.markedContentStack.push({
              visible: this.optionalContentConfig.isVisible(properties)
            });
          } else {
            this.markedContentStack.push({
              visible: true
            });
          }
          this.contentVisible = this.isContentVisible();
        }
        endMarkedContent(opIdx) {
          this.dependencyTracker?.endMarkedContent(opIdx);
          this.markedContentStack.pop();
          this.contentVisible = this.isContentVisible();
        }
        beginCompat(opIdx) {
        }
        endCompat(opIdx) {
        }
        consumePath(opIdx, path, clipBox) {
          const isEmpty2 = this.current.isEmptyClip();
          if (this.pendingClip) {
            this.current.updateClipFromPath();
          }
          if (!this.pendingClip) {
            this.compose(clipBox);
          }
          const ctx = this.ctx;
          if (this.pendingClip) {
            if (!isEmpty2) {
              if (this.pendingClip === EO_CLIP) {
                ctx.clip(path, "evenodd");
              } else {
                ctx.clip(path);
              }
            }
            this.pendingClip = null;
            this.dependencyTracker?.bboxToClipBoxDropOperation(opIdx).recordFutureForcedDependency("clipPath", opIdx);
          } else {
            this.dependencyTracker?.recordOperation(opIdx);
          }
          this.current.startNewPathAndClipBox(this.current.clipBox);
        }
        getSinglePixelWidth() {
          if (!this._cachedGetSinglePixelWidth) {
            const m = getCurrentTransform(this.ctx);
            if (m[1] === 0 && m[2] === 0) {
              this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(m[0]), Math.abs(m[3]));
            } else {
              const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
              const normX = Math.hypot(m[0], m[2]);
              const normY = Math.hypot(m[1], m[3]);
              this._cachedGetSinglePixelWidth = Math.max(normX, normY) / absDet;
            }
          }
          return this._cachedGetSinglePixelWidth;
        }
        getScaleForStroking() {
          if (this._cachedScaleForStroking[0] === -1) {
            const {
              lineWidth
            } = this.current;
            const {
              a,
              b,
              c,
              d
            } = this.ctx.getTransform();
            let scaleX, scaleY;
            if (b === 0 && c === 0) {
              const normX = Math.abs(a);
              const normY = Math.abs(d);
              if (normX === normY) {
                if (lineWidth === 0) {
                  scaleX = scaleY = 1 / normX;
                } else {
                  const scaledLineWidth = normX * lineWidth;
                  scaleX = scaleY = scaledLineWidth < 1 ? 1 / scaledLineWidth : 1;
                }
              } else if (lineWidth === 0) {
                scaleX = 1 / normX;
                scaleY = 1 / normY;
              } else {
                const scaledXLineWidth = normX * lineWidth;
                const scaledYLineWidth = normY * lineWidth;
                scaleX = scaledXLineWidth < 1 ? 1 / scaledXLineWidth : 1;
                scaleY = scaledYLineWidth < 1 ? 1 / scaledYLineWidth : 1;
              }
            } else {
              const absDet = Math.abs(a * d - b * c);
              const normX = Math.hypot(a, b);
              const normY = Math.hypot(c, d);
              if (lineWidth === 0) {
                scaleX = normY / absDet;
                scaleY = normX / absDet;
              } else {
                const baseArea = lineWidth * absDet;
                scaleX = normY > baseArea ? normY / baseArea : 1;
                scaleY = normX > baseArea ? normX / baseArea : 1;
              }
            }
            this._cachedScaleForStroking[0] = scaleX;
            this._cachedScaleForStroking[1] = scaleY;
          }
          return this._cachedScaleForStroking;
        }
        rescaleAndStroke(path, saveRestore) {
          const {
            ctx,
            current: {
              lineWidth
            }
          } = this;
          const [scaleX, scaleY] = this.getScaleForStroking();
          if (scaleX === scaleY) {
            ctx.lineWidth = (lineWidth || 1) * scaleX;
            ctx.stroke(path);
            return;
          }
          const dashes = ctx.getLineDash();
          if (saveRestore) {
            ctx.save();
          }
          ctx.scale(scaleX, scaleY);
          SCALE_MATRIX.a = 1 / scaleX;
          SCALE_MATRIX.d = 1 / scaleY;
          const newPath = new Path2D();
          newPath.addPath(path, SCALE_MATRIX);
          if (dashes.length > 0) {
            const scale = Math.max(scaleX, scaleY);
            ctx.setLineDash(dashes.map((x) => x / scale));
            ctx.lineDashOffset /= scale;
          }
          ctx.lineWidth = lineWidth || 1;
          ctx.stroke(newPath);
          if (saveRestore) {
            ctx.restore();
          }
        }
        isContentVisible() {
          for (let i = this.markedContentStack.length - 1; i >= 0; i--) {
            if (!this.markedContentStack[i].visible) {
              return false;
            }
          }
          return true;
        }
      };
      _knockoutGroupLevel = new WeakMap();
      _knockoutElementDepth = new WeakMap();
      _knockoutTempCanvasEntry = new WeakMap();
      _knockoutSavedCtx = new WeakMap();
      _knockoutSavedSMaskCtx = new WeakMap();
      _knockoutSavedGCO = new WeakMap();
      _knockoutElementAlpha = new WeakMap();
      _knockoutFilterCache = new WeakMap();
      _knockoutElementGroupMeta = new WeakMap();
      _groupStackMeta = new WeakMap();
      _CanvasGraphics_instances = new WeakSet();
      restoreInitialState_fn = function() {
        while (this.stateStack.length || this.inSMaskMode) {
          this.restore();
        }
        this.current.activeSMask = null;
        this.ctx.restore();
        if (this.transparentCanvas) {
          this.ctx = this.compositeCtx;
          this.ctx.save();
          this.ctx.setTransform(1, 0, 0, 1, 0, 0);
          this.ctx.drawImage(this.transparentCanvas, 0, 0);
          this.ctx.restore();
          this.canvasFactory.destroy(this.transparentCanvasEntry);
          this.transparentCanvas = null;
          this.transparentCanvasEntry = null;
        }
      };
      drawFilter_fn = function() {
        if (this.pageColors) {
          const hcmFilterId = this.filterFactory.addHCMFilter(this.pageColors.foreground, this.pageColors.background);
          if (hcmFilterId !== "none") {
            const savedFilter = this.ctx.filter;
            this.ctx.filter = hcmFilterId;
            this.ctx.drawImage(this.ctx.canvas, 0, 0);
            this.ctx.filter = savedFilter;
          }
        }
      };
      createKnockoutMaskCanvas_fn = function(sourceCanvas, reuseEntry = null, alpha = 1) {
        const {
          width,
          height
        } = sourceCanvas;
        const maskEntry = reuseEntry ?? this.canvasFactory.create(width, height);
        const maskCtx = maskEntry.context;
        alpha = Math.round(alpha * 255) / 255;
        const needsAlphaScaling = alpha < 1;
        if (needsAlphaScaling && __privateGet(this, _knockoutFilterCache) === void 0) {
          __privateSet(this, _knockoutFilterCache, FeatureTest.isCanvasFilterSupported ? /* @__PURE__ */ new Map() : "none");
        }
        let knockoutFilter = "none";
        if (needsAlphaScaling && __privateGet(this, _knockoutFilterCache) instanceof Map) {
          knockoutFilter = __privateGet(this, _knockoutFilterCache).getOrInsertComputed(alpha, () => this.filterFactory.addKnockoutFilter(alpha));
        }
        if (!needsAlphaScaling || knockoutFilter !== "none") {
          if (reuseEntry) {
            maskCtx.save();
            maskCtx.setTransform(1, 0, 0, 1, 0, 0);
            maskCtx.clearRect(0, 0, width, height);
            maskCtx.restore();
          }
          maskCtx.filter = knockoutFilter;
          maskCtx.drawImage(sourceCanvas, 0, 0);
          maskCtx.filter = "none";
          return maskEntry;
        }
        const sourceData = sourceCanvas.getContext("2d", {
          willReadFrequently: true
        }).getImageData(0, 0, width, height);
        const maskData = maskCtx.createImageData(width, height);
        const sourcePixels = sourceData.data, maskPixels = maskData.data;
        const alphaScale = alpha > 0 ? 1 / alpha : 1e6;
        for (let i = 3, ii = sourcePixels.length; i < ii; i += 4) {
          maskPixels[i] = Math.min(Math.round(sourcePixels[i] * alphaScale), 255);
        }
        maskCtx.putImageData(maskData, 0, 0);
        return maskEntry;
      };
      getOrCreatePooledEntry_fn = function(meta, key, width, height) {
        let entry = meta?.[key] ?? null;
        if (entry && (entry.canvas.width !== width || entry.canvas.height !== height)) {
          this.canvasFactory.destroy(entry);
          entry = null;
        }
        if (!entry) {
          entry = this.canvasFactory.create(width, height);
          if (meta) {
            meta[key] = entry;
          }
          return entry;
        }
        const ctx = entry.context;
        ctx.save();
        ctx.setTransform(1, 0, 0, 1, 0, 0);
        ctx.clearRect(0, 0, width, height);
        ctx.restore();
        return entry;
      };
      compositeKnockoutSurface_fn = function(destCtx, surfaceCanvas, options = {}) {
        const {
          backdropCanvas = null,
          destTransform = [1, 0, 0, 1, 0, 0],
          backdropOffset = [0, 0],
          reuseMaskEntry = null,
          poolMeta = null,
          sourceAlpha = 1,
          sourceFilter = "none",
          knockoutAlpha = 1
        } = options;
        const {
          width,
          height
        } = surfaceCanvas;
        const knockoutMaskEntry = __privateMethod(this, _CanvasGraphics_instances, createKnockoutMaskCanvas_fn).call(this, surfaceCanvas, reuseMaskEntry, knockoutAlpha);
        const sourceCompositeOperation = destCtx.globalCompositeOperation;
        destCtx.save();
        destCtx.setTransform(...destTransform);
        destCtx.globalAlpha = 1;
        if (FeatureTest.isCanvasFilterSupported) {
          destCtx.filter = "none";
        }
        destCtx.globalCompositeOperation = "destination-out";
        destCtx.drawImage(knockoutMaskEntry.canvas, 0, 0);
        if (backdropCanvas) {
          const [bx, by] = backdropOffset;
          const backdropEntry = __privateMethod(this, _CanvasGraphics_instances, getOrCreatePooledEntry_fn).call(this, poolMeta, "knockoutBackdropEntry", width, height);
          const backdropCtx = backdropEntry.context;
          backdropCtx.drawImage(backdropCanvas, bx, by, width, height, 0, 0, width, height);
          backdropCtx.globalCompositeOperation = "destination-in";
          backdropCtx.drawImage(knockoutMaskEntry.canvas, 0, 0);
          backdropCtx.globalCompositeOperation = "source-over";
          destCtx.globalCompositeOperation = "destination-over";
          destCtx.drawImage(backdropEntry.canvas, 0, 0);
          if (!poolMeta) {
            this.canvasFactory.destroy(backdropEntry);
          }
        }
        destCtx.globalCompositeOperation = sourceCompositeOperation;
        destCtx.globalAlpha = sourceAlpha;
        if (FeatureTest.isCanvasFilterSupported) {
          destCtx.filter = sourceFilter ?? "none";
        }
        destCtx.drawImage(surfaceCanvas, 0, 0);
        destCtx.restore();
        if (!reuseMaskEntry) {
          this.canvasFactory.destroy(knockoutMaskEntry);
        }
      };
      beginKnockoutElement_fn = function(alpha = 1) {
        if (__privateGet(this, _knockoutGroupLevel) === 0 || __privateGet(this, _knockoutElementDepth) > 0 || !this.contentVisible) {
          return false;
        }
        __privateWrapper(this, _knockoutElementDepth)._++;
        __privateSet(this, _knockoutElementAlpha, alpha);
        const groupMeta = __privateGet(this, _groupStackMeta).at(-1);
        const {
          canvas
        } = this.ctx;
        const tempEntry = __privateMethod(this, _CanvasGraphics_instances, getOrCreatePooledEntry_fn).call(this, groupMeta, "knockoutTempEntry", canvas.width, canvas.height);
        __privateSet(this, _knockoutTempCanvasEntry, tempEntry);
        const tempCtx = tempEntry.context;
        tempCtx.save();
        tempCtx.setTransform(this.ctx.getTransform());
        copyCtxState(this.ctx, tempCtx);
        __privateSet(this, _knockoutSavedGCO, tempCtx.globalCompositeOperation);
        tempCtx.globalCompositeOperation = "source-over";
        mirrorContextOperations(tempCtx, this.ctx);
        __privateSet(this, _knockoutElementGroupMeta, groupMeta);
        __privateSet(this, _knockoutSavedCtx, this.ctx);
        __privateSet(this, _knockoutSavedSMaskCtx, this.suspendedCtx);
        this.ctx = tempCtx;
        if (this.inSMaskMode) {
          this.suspendedCtx = tempCtx;
        }
        return true;
      };
      endKnockoutElement_fn = function(started) {
        if (!started) {
          return;
        }
        const tempEntry = __privateGet(this, _knockoutTempCanvasEntry);
        const savedCtx = __privateGet(this, _knockoutSavedCtx);
        const savedSMaskCtx = __privateGet(this, _knockoutSavedSMaskCtx);
        const tempCtx = tempEntry.context;
        __privateSet(this, _knockoutTempCanvasEntry, null);
        __privateSet(this, _knockoutSavedCtx, null);
        __privateSet(this, _knockoutSavedSMaskCtx, null);
        if (this.inSMaskMode && this.suspendedCtx === tempCtx && this.ctx !== tempCtx) {
          this.endSMaskMode();
        }
        if (this.inSMaskMode) {
          this.suspendedCtx = savedSMaskCtx;
        }
        this.ctx._removeMirroring();
        this.ctx.globalCompositeOperation = __privateGet(this, _knockoutSavedGCO);
        __privateSet(this, _knockoutSavedGCO, null);
        copyCtxState(this.ctx, savedCtx);
        this.ctx = savedCtx;
        const groupMeta = __privateGet(this, _knockoutElementGroupMeta);
        __privateSet(this, _knockoutElementGroupMeta, null);
        const knockoutAlpha = __privateGet(this, _knockoutElementAlpha);
        __privateSet(this, _knockoutElementAlpha, 1);
        try {
          __privateMethod(this, _CanvasGraphics_instances, compositeKnockoutSurface_fn).call(this, savedSMaskCtx ?? savedCtx, tempEntry.canvas, {
            backdropCanvas: groupMeta?.backdropCtx?.canvas ?? null,
            backdropOffset: groupMeta?.backdropCtx ? [groupMeta.offsetX, groupMeta.offsetY] : [0, 0],
            reuseMaskEntry: groupMeta?.knockoutMaskEntry ?? null,
            poolMeta: groupMeta,
            knockoutAlpha
          });
        } finally {
          tempCtx.restore();
          __privateWrapper(this, _knockoutElementDepth)._--;
          if (!groupMeta) {
            this.canvasFactory.destroy(tempEntry);
          }
        }
      };
      getScaledPath_fn = function(path, currentTransform, transform) {
        const newPath = new Path2D();
        newPath.addPath(path, new DOMMatrix(transform).invertSelf().multiplySelf(currentTransform));
        return newPath;
      };
      convertGroupToGray_fn = function(groupCtx) {
        const {
          canvas
        } = groupCtx;
        const {
          width,
          height
        } = canvas;
        if (FeatureTest.isCanvasFilterSupported) {
          groupCtx.save();
          groupCtx.setTransform(1, 0, 0, 1, 0, 0);
          groupCtx.filter = "grayscale(1)";
          groupCtx.globalAlpha = 1;
          groupCtx.globalCompositeOperation = "copy";
          groupCtx.drawImage(canvas, 0, 0);
          groupCtx.restore();
          return;
        }
        const imageData = groupCtx.getImageData(0, 0, width, height);
        const {
          data
        } = imageData;
        for (let i = 0, ii = data.length; i < ii; i += 4) {
          const gray = data[i] * 0.2126 + data[i + 1] * 0.7152 + data[i + 2] * 0.0722 + 0.5 | 0;
          data[i] = data[i + 1] = data[i + 2] = gray;
        }
        groupCtx.putImageData(imageData, 0, 0);
      };
      destroyKnockoutPools_fn = function(groupMeta) {
        if (!groupMeta) {
          return;
        }
        if (groupMeta.knockoutMaskEntry) {
          this.canvasFactory.destroy(groupMeta.knockoutMaskEntry);
          groupMeta.knockoutMaskEntry = null;
        }
        if (groupMeta.knockoutTempEntry) {
          this.canvasFactory.destroy(groupMeta.knockoutTempEntry);
          groupMeta.knockoutTempEntry = null;
        }
        if (groupMeta.knockoutBackdropEntry) {
          this.canvasFactory.destroy(groupMeta.knockoutBackdropEntry);
          groupMeta.knockoutBackdropEntry = null;
        }
      };
      CanvasGraphics = _CanvasGraphics;
      for (const op in OPS) {
        if (CanvasGraphics.prototype[op] !== void 0) {
          CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
        }
      }
      BasePDFStream = class {
        constructor(source, PDFStreamReader, PDFStreamRangeReader) {
          __privateAdd(this, _PDFStreamReader, null);
          __privateAdd(this, _PDFStreamRangeReader, null);
          __publicField(this, "_fullReader", null);
          __publicField(this, "_rangeReaders", /* @__PURE__ */ new Set());
          __publicField(this, "_source", null);
          this._source = source;
          __privateSet(this, _PDFStreamReader, PDFStreamReader);
          __privateSet(this, _PDFStreamRangeReader, PDFStreamRangeReader);
        }
        get _progressiveDataLength() {
          return this._fullReader?._loaded ?? 0;
        }
        getFullReader() {
          assert(!this._fullReader, "BasePDFStream.getFullReader can only be called once.");
          return this._fullReader = new (__privateGet(this, _PDFStreamReader))(this);
        }
        getRangeReader(begin, end) {
          if (end <= this._progressiveDataLength) {
            return null;
          }
          const reader = new (__privateGet(this, _PDFStreamRangeReader))(this, begin, end);
          this._rangeReaders.add(reader);
          return reader;
        }
        cancelAllRequests(reason) {
          this._fullReader?.cancel(reason);
          for (const reader of new Set(this._rangeReaders)) {
            reader.cancel(reason);
          }
        }
      };
      _PDFStreamReader = new WeakMap();
      _PDFStreamRangeReader = new WeakMap();
      BasePDFStreamReader = class {
        constructor(stream) {
          __publicField(this, "onProgress", null);
          __publicField(this, "_contentLength", 0);
          __publicField(this, "_filename", null);
          __publicField(this, "_headersCapability", Promise.withResolvers());
          __publicField(this, "_isRangeSupported", false);
          __publicField(this, "_isStreamingSupported", false);
          __publicField(this, "_loaded", 0);
          __publicField(this, "_stream", null);
          this._stream = stream;
        }
        _callOnProgress() {
          this.onProgress?.({
            loaded: this._loaded,
            total: this._contentLength
          });
        }
        get headersReady() {
          return this._headersCapability.promise;
        }
        get filename() {
          return this._filename;
        }
        get contentLength() {
          return this._contentLength;
        }
        get isRangeSupported() {
          return this._isRangeSupported;
        }
        get isStreamingSupported() {
          return this._isStreamingSupported;
        }
        async read() {
          unreachable("Abstract method `read` called");
        }
        cancel(reason) {
          unreachable("Abstract method `cancel` called");
        }
      };
      BasePDFStreamRangeReader = class {
        constructor(stream, begin, end) {
          __publicField(this, "_stream", null);
          this._stream = stream;
        }
        async read() {
          unreachable("Abstract method `read` called");
        }
        cancel(reason) {
          unreachable("Abstract method `cancel` called");
        }
      };
      PDFFetchStream = class extends BasePDFStream {
        constructor(source) {
          super(source, PDFFetchStreamReader, PDFFetchStreamRangeReader);
          __publicField(this, "_responseOrigin", null);
          const {
            httpHeaders,
            url
          } = source;
          assert(/https?:/.test(url.protocol), "PDFFetchStream only supports http(s):// URLs.");
          this.headers = createHeaders(true, httpHeaders);
        }
      };
      PDFFetchStreamReader = class extends BasePDFStreamReader {
        constructor(stream) {
          super(stream);
          __publicField(this, "_abortController", new AbortController());
          __publicField(this, "_reader", null);
          const {
            disableRange,
            disableStream,
            rangeChunkSize,
            url,
            withCredentials
          } = stream._source;
          this._isStreamingSupported = !disableStream;
          const headers = new Headers(stream.headers);
          fetchUrl(url, headers, withCredentials, this._abortController).then((response) => {
            stream._responseOrigin = getResponseOrigin(response.url);
            ensureResponseStatus(response.status, url);
            this._reader = response.body.getReader();
            const responseHeaders = response.headers;
            const {
              contentLength,
              isRangeSupported
            } = validateRangeRequestCapabilities({
              responseHeaders,
              isHttp: true,
              rangeChunkSize,
              disableRange
            });
            this._contentLength = contentLength;
            this._isRangeSupported = isRangeSupported;
            this._filename = extractFilenameFromHeader(responseHeaders);
            if (!this._isStreamingSupported && this._isRangeSupported) {
              this.cancel(new AbortException("Streaming is disabled."));
            }
            this._headersCapability.resolve();
          }).catch(this._headersCapability.reject);
        }
        async read() {
          await this._headersCapability.promise;
          const {
            value,
            done
          } = await this._reader.read();
          if (done) {
            return {
              value,
              done
            };
          }
          this._loaded += value.byteLength;
          this._callOnProgress();
          return {
            value: getArrayBuffer(value),
            done: false
          };
        }
        cancel(reason) {
          this._reader?.cancel(reason);
          this._abortController.abort();
        }
      };
      PDFFetchStreamRangeReader = class extends BasePDFStreamRangeReader {
        constructor(stream, begin, end) {
          super(stream, begin, end);
          __publicField(this, "_abortController", new AbortController());
          __publicField(this, "_readCapability", Promise.withResolvers());
          __publicField(this, "_reader", null);
          const {
            url,
            withCredentials
          } = stream._source;
          const headers = new Headers(stream.headers);
          headers.append("Range", `bytes=${begin}-${end - 1}`);
          fetchUrl(url, headers, withCredentials, this._abortController).then((response) => {
            const responseOrigin = getResponseOrigin(response.url);
            ensureResponseOrigin(responseOrigin, stream._responseOrigin);
            ensureResponseStatus(response.status, url);
            this._reader = response.body.getReader();
            this._readCapability.resolve();
          }).catch(this._readCapability.reject);
        }
        async read() {
          await this._readCapability.promise;
          const {
            value,
            done
          } = await this._reader.read();
          if (done) {
            return {
              value,
              done
            };
          }
          return {
            value: getArrayBuffer(value),
            done: false
          };
        }
        cancel(reason) {
          this._reader?.cancel(reason);
          this._abortController.abort();
        }
      };
      PDFDataTransportStream = class extends BasePDFStream {
        constructor(source) {
          super(source, PDFDataTransportStreamReader, PDFDataTransportStreamRangeReader);
          __privateAdd(this, _PDFDataTransportStream_instances);
          __publicField(this, "_progressiveDone", false);
          __publicField(this, "_queuedChunks", []);
          const {
            pdfDataRangeTransport
          } = source;
          const {
            initialData,
            progressiveDone
          } = pdfDataRangeTransport;
          if (initialData?.length > 0) {
            const buffer = transport_stream_getArrayBuffer(initialData);
            this._queuedChunks.push(buffer);
          }
          this._progressiveDone = progressiveDone;
          const listener = (args) => {
            switch (args.type) {
              case "range":
              case "progressiveRead":
                __privateMethod(this, _PDFDataTransportStream_instances, onReceiveData_fn).call(this, args.begin, args.chunk);
                break;
              case "progressiveDone":
                this._fullReader?.progressiveDone();
                this._progressiveDone = true;
                break;
            }
          };
          pdfDataRangeTransport.transportReady(listener);
        }
        getFullReader() {
          const reader = super.getFullReader();
          this._queuedChunks = null;
          return reader;
        }
        getRangeReader(begin, end) {
          const reader = super.getRangeReader(begin, end);
          if (reader) {
            reader.onDone = () => this._rangeReaders.delete(reader);
            this._source.pdfDataRangeTransport.requestDataRange(begin, end);
          }
          return reader;
        }
        cancelAllRequests(reason) {
          super.cancelAllRequests(reason);
          this._source.pdfDataRangeTransport.abort();
        }
      };
      _PDFDataTransportStream_instances = new WeakSet();
      onReceiveData_fn = function(begin, chunk2) {
        const buffer = transport_stream_getArrayBuffer(chunk2);
        if (begin === void 0) {
          if (this._fullReader) {
            this._fullReader._enqueue(buffer);
          } else {
            this._queuedChunks.push(buffer);
          }
        } else {
          const rangeReader = this._rangeReaders.keys().find((r) => r._begin === begin);
          assert(rangeReader, "#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
          rangeReader._enqueue(buffer);
        }
      };
      PDFDataTransportStreamReader = class extends BasePDFStreamReader {
        constructor(stream) {
          super(stream);
          __privateAdd(this, _endRequests, endRequests.bind(this));
          __publicField(this, "_done", false);
          __publicField(this, "_queuedChunks", null);
          __publicField(this, "_requests", []);
          const {
            pdfDataRangeTransport,
            disableRange,
            disableStream
          } = stream._source;
          const {
            length,
            contentDispositionFilename
          } = pdfDataRangeTransport;
          this._queuedChunks = stream._queuedChunks || [];
          for (const chunk2 of this._queuedChunks) {
            this._loaded += chunk2.byteLength;
          }
          this._done = stream._progressiveDone;
          this._contentLength = length;
          this._isStreamingSupported = !disableStream;
          this._isRangeSupported = !disableRange;
          if (isPdfFile(contentDispositionFilename)) {
            this._filename = contentDispositionFilename;
          }
          this._headersCapability.resolve();
          const loaded = this._loaded;
          Promise.resolve().then(() => {
            if (loaded > 0 && this._loaded === loaded) {
              this._callOnProgress();
            }
          });
        }
        _enqueue(chunk2) {
          if (this._done) {
            return;
          }
          if (this._requests.length > 0) {
            const capability = this._requests.shift();
            capability.resolve({
              value: chunk2,
              done: false
            });
          } else {
            this._queuedChunks.push(chunk2);
          }
          this._loaded += chunk2.byteLength;
          this._callOnProgress();
        }
        async read() {
          if (this._queuedChunks.length > 0) {
            const chunk2 = this._queuedChunks.shift();
            return {
              value: chunk2,
              done: false
            };
          }
          if (this._done) {
            return {
              value: void 0,
              done: true
            };
          }
          const capability = Promise.withResolvers();
          this._requests.push(capability);
          return capability.promise;
        }
        cancel(reason) {
          this._done = true;
          __privateGet(this, _endRequests).call(this);
        }
        progressiveDone() {
          this._done || (this._done = true);
          if (this._queuedChunks.length === 0) {
            __privateGet(this, _endRequests).call(this);
          }
        }
      };
      _endRequests = new WeakMap();
      PDFDataTransportStreamRangeReader = class extends BasePDFStreamRangeReader {
        constructor(stream, begin, end) {
          super(stream, begin, end);
          __privateAdd(this, _endRequests2, endRequests.bind(this));
          __publicField(this, "onDone", null);
          __publicField(this, "_begin", -1);
          __publicField(this, "_done", false);
          __publicField(this, "_queuedChunk", null);
          __publicField(this, "_requests", []);
          this._begin = begin;
        }
        _enqueue(chunk2) {
          if (this._done) {
            return;
          }
          if (this._requests.length === 0) {
            this._queuedChunk = chunk2;
          } else {
            const capability = this._requests.shift();
            capability.resolve({
              value: chunk2,
              done: false
            });
            __privateGet(this, _endRequests2).call(this);
          }
          this._done = true;
          this.onDone?.();
        }
        async read() {
          if (this._queuedChunk) {
            const chunk2 = this._queuedChunk;
            this._queuedChunk = null;
            return {
              value: chunk2,
              done: false
            };
          }
          if (this._done) {
            return {
              value: void 0,
              done: true
            };
          }
          const capability = Promise.withResolvers();
          this._requests.push(capability);
          return capability.promise;
        }
        cancel(reason) {
          this._done = true;
          __privateGet(this, _endRequests2).call(this);
          this.onDone?.();
        }
      };
      _endRequests2 = new WeakMap();
      OK_RESPONSE = 200;
      PARTIAL_CONTENT_RESPONSE = 206;
      PDFNetworkStream = class extends BasePDFStream {
        constructor(source) {
          super(source, PDFNetworkStreamReader, PDFNetworkStreamRangeReader);
          __privateAdd(this, _PDFNetworkStream_instances);
          __privateAdd(this, _pendingRequests, /* @__PURE__ */ new WeakMap());
          __publicField(this, "_responseOrigin", null);
          const {
            httpHeaders,
            url
          } = source;
          this.url = url;
          this.isHttp = /https?:/.test(url.protocol);
          this.headers = createHeaders(this.isHttp, httpHeaders);
        }
        _request(args) {
          const xhr = new XMLHttpRequest();
          const pendingRequest = {
            validateStatus: null,
            onHeadersReceived: args.onHeadersReceived,
            onDone: args.onDone,
            onError: args.onError,
            onProgress: args.onProgress
          };
          __privateGet(this, _pendingRequests).set(xhr, pendingRequest);
          xhr.open("GET", this.url);
          xhr.withCredentials = this._source.withCredentials;
          for (const [key, val] of this.headers) {
            xhr.setRequestHeader(key, val);
          }
          if (this.isHttp && "begin" in args && "end" in args) {
            xhr.setRequestHeader("Range", `bytes=${args.begin}-${args.end - 1}`);
            pendingRequest.validateStatus = (status) => status === PARTIAL_CONTENT_RESPONSE || status === OK_RESPONSE;
          } else {
            pendingRequest.validateStatus = (status) => status === OK_RESPONSE;
          }
          xhr.responseType = "arraybuffer";
          assert(args.onError, "Expected `onError` callback to be provided.");
          xhr.onerror = () => args.onError(xhr.status);
          xhr.onreadystatechange = __privateMethod(this, _PDFNetworkStream_instances, onStateChange_fn).bind(this, xhr);
          xhr.onprogress = __privateMethod(this, _PDFNetworkStream_instances, onProgress_fn).bind(this, xhr);
          xhr.send(null);
          return xhr;
        }
        _abortRequest(xhr) {
          if (__privateGet(this, _pendingRequests).has(xhr)) {
            __privateGet(this, _pendingRequests).delete(xhr);
            xhr.abort();
          }
        }
        getRangeReader(begin, end) {
          const reader = super.getRangeReader(begin, end);
          if (reader) {
            reader.onClosed = () => this._rangeReaders.delete(reader);
          }
          return reader;
        }
      };
      _pendingRequests = new WeakMap();
      _PDFNetworkStream_instances = new WeakSet();
      onProgress_fn = function(xhr, evt) {
        const pendingRequest = __privateGet(this, _pendingRequests).get(xhr);
        pendingRequest?.onProgress?.(evt);
      };
      onStateChange_fn = function(xhr, evt) {
        const pendingRequest = __privateGet(this, _pendingRequests).get(xhr);
        if (!pendingRequest) {
          return;
        }
        if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
          pendingRequest.onHeadersReceived();
          delete pendingRequest.onHeadersReceived;
        }
        if (xhr.readyState !== 4) {
          return;
        }
        if (!__privateGet(this, _pendingRequests).has(xhr)) {
          return;
        }
        __privateGet(this, _pendingRequests).delete(xhr);
        if (xhr.status === 0 && this.isHttp) {
          pendingRequest.onError(xhr.status);
          return;
        }
        const xhrStatus = xhr.status || OK_RESPONSE;
        if (!pendingRequest.validateStatus(xhrStatus)) {
          pendingRequest.onError(xhr.status);
          return;
        }
        const chunk2 = network_getArrayBuffer(xhr.response);
        if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
          const rangeHeader = xhr.getResponseHeader("Content-Range");
          if (/bytes \d+-\d+\/\d+/.test(rangeHeader)) {
            pendingRequest.onDone(chunk2);
          } else {
            warn(`Missing or invalid "Content-Range" header.`);
            pendingRequest.onError(0);
          }
        } else if (chunk2) {
          pendingRequest.onDone(chunk2);
        } else {
          pendingRequest.onError(xhr.status);
        }
      };
      PDFNetworkStreamReader = class extends BasePDFStreamReader {
        constructor(stream) {
          super(stream);
          __privateAdd(this, _PDFNetworkStreamReader_instances);
          __privateAdd(this, _endRequests3, endRequests.bind(this));
          __publicField(this, "_cachedChunks", []);
          __publicField(this, "_done", false);
          __publicField(this, "_requests", []);
          __publicField(this, "_storedError", null);
          this._fullRequestXhr = stream._request({
            onHeadersReceived: __privateMethod(this, _PDFNetworkStreamReader_instances, onHeadersReceived_fn).bind(this),
            onDone: __privateMethod(this, _PDFNetworkStreamReader_instances, onDone_fn).bind(this),
            onError: __privateMethod(this, _PDFNetworkStreamReader_instances, onError_fn).bind(this),
            onProgress: __privateMethod(this, _PDFNetworkStreamReader_instances, onProgress_fn2).bind(this)
          });
        }
        async read() {
          await this._headersCapability.promise;
          if (this._storedError) {
            throw this._storedError;
          }
          if (this._cachedChunks.length > 0) {
            const chunk2 = this._cachedChunks.shift();
            return {
              value: chunk2,
              done: false
            };
          }
          if (this._done) {
            return {
              value: void 0,
              done: true
            };
          }
          const capability = Promise.withResolvers();
          this._requests.push(capability);
          return capability.promise;
        }
        cancel(reason) {
          this._done = true;
          this._headersCapability.reject(reason);
          __privateGet(this, _endRequests3).call(this);
          this._stream._abortRequest(this._fullRequestXhr);
          this._fullRequestXhr = null;
        }
      };
      _endRequests3 = new WeakMap();
      _PDFNetworkStreamReader_instances = new WeakSet();
      onHeadersReceived_fn = function() {
        const stream = this._stream;
        const {
          disableRange,
          rangeChunkSize
        } = stream._source;
        const fullRequestXhr = this._fullRequestXhr;
        stream._responseOrigin = getResponseOrigin(fullRequestXhr.responseURL);
        const rawResponseHeaders = fullRequestXhr.getAllResponseHeaders();
        const responseHeaders = new Headers(rawResponseHeaders ? rawResponseHeaders.trimStart().replace(/[^\S ]+$/, "").split(/[\r\n]+/).map((x) => {
          const [key, ...val] = x.split(": ");
          return [key, val.join(": ")];
        }) : []);
        const {
          contentLength,
          isRangeSupported
        } = validateRangeRequestCapabilities({
          responseHeaders,
          isHttp: stream.isHttp,
          rangeChunkSize,
          disableRange
        });
        this._contentLength = contentLength;
        this._isRangeSupported = isRangeSupported;
        this._filename = extractFilenameFromHeader(responseHeaders);
        if (this._isRangeSupported) {
          stream._abortRequest(fullRequestXhr);
        }
        this._headersCapability.resolve();
      };
      onDone_fn = function(chunk2) {
        if (this._requests.length > 0) {
          const capability = this._requests.shift();
          capability.resolve({
            value: chunk2,
            done: false
          });
        } else {
          this._cachedChunks.push(chunk2);
        }
        this._done = true;
        if (this._cachedChunks.length === 0) {
          __privateGet(this, _endRequests3).call(this);
        }
      };
      onError_fn = function(status) {
        this._storedError = createResponseError(status, this._stream.url);
        this._headersCapability.reject(this._storedError);
        for (const capability of this._requests) {
          capability.reject(this._storedError);
        }
        this._requests.length = 0;
        this._cachedChunks.length = 0;
      };
      onProgress_fn2 = function(evt) {
        this.onProgress?.({
          loaded: evt.loaded,
          total: evt.lengthComputable ? evt.total : this._contentLength
        });
      };
      PDFNetworkStreamRangeReader = class extends BasePDFStreamRangeReader {
        constructor(stream, begin, end) {
          super(stream, begin, end);
          __privateAdd(this, _PDFNetworkStreamRangeReader_instances);
          __privateAdd(this, _endRequests4, endRequests.bind(this));
          __publicField(this, "onClosed", null);
          __publicField(this, "_done", false);
          __publicField(this, "_queuedChunk", null);
          __publicField(this, "_requests", []);
          __publicField(this, "_storedError", null);
          this._requestXhr = stream._request({
            begin,
            end,
            onHeadersReceived: __privateMethod(this, _PDFNetworkStreamRangeReader_instances, onHeadersReceived_fn2).bind(this),
            onDone: __privateMethod(this, _PDFNetworkStreamRangeReader_instances, onDone_fn2).bind(this),
            onError: __privateMethod(this, _PDFNetworkStreamRangeReader_instances, onError_fn2).bind(this),
            onProgress: null
          });
        }
        async read() {
          if (this._storedError) {
            throw this._storedError;
          }
          if (this._queuedChunk !== null) {
            const chunk2 = this._queuedChunk;
            this._queuedChunk = null;
            return {
              value: chunk2,
              done: false
            };
          }
          if (this._done) {
            return {
              value: void 0,
              done: true
            };
          }
          const capability = Promise.withResolvers();
          this._requests.push(capability);
          return capability.promise;
        }
        cancel(reason) {
          this._done = true;
          __privateGet(this, _endRequests4).call(this);
          this._stream._abortRequest(this._requestXhr);
          this.onClosed?.();
        }
      };
      _endRequests4 = new WeakMap();
      _PDFNetworkStreamRangeReader_instances = new WeakSet();
      onHeadersReceived_fn2 = function() {
        const responseOrigin = getResponseOrigin(this._requestXhr?.responseURL);
        try {
          ensureResponseOrigin(responseOrigin, this._stream._responseOrigin);
        } catch (ex) {
          this._storedError = ex;
          __privateMethod(this, _PDFNetworkStreamRangeReader_instances, onError_fn2).call(this, 0);
        }
      };
      onDone_fn2 = function(chunk2) {
        if (this._requests.length > 0) {
          const capability = this._requests.shift();
          capability.resolve({
            value: chunk2,
            done: false
          });
        } else {
          this._queuedChunk = chunk2;
        }
        this._done = true;
        __privateGet(this, _endRequests4).call(this);
        this.onClosed?.();
      };
      onError_fn2 = function(status) {
        this._storedError ?? (this._storedError = createResponseError(status, this._stream.url));
        for (const capability of this._requests) {
          capability.reject(this._storedError);
        }
        this._requests.length = 0;
        this._queuedChunk = null;
      };
      PDFNodeStream = class extends BasePDFStream {
        constructor(source) {
          super(source, PDFNodeStreamReader, PDFNodeStreamRangeReader);
          const {
            url
          } = source;
          assert(url.protocol === "file:", "PDFNodeStream only supports file:// URLs.");
        }
      };
      PDFNodeStreamReader = class extends BasePDFStreamReader {
        constructor(stream) {
          super(stream);
          __publicField(this, "_reader", null);
          const {
            disableRange,
            disableStream,
            rangeChunkSize,
            url
          } = stream._source;
          this._isStreamingSupported = !disableStream;
          const fs = process.getBuiltinModule("fs/promises");
          fs.lstat(url).then((stat) => {
            const readableStream = getReadableStream(url);
            this._reader = readableStream.getReader();
            const {
              size: size2
            } = stat;
            this._contentLength = size2;
            this._isRangeSupported = !disableRange && size2 > 2 * rangeChunkSize;
            if (!this._isStreamingSupported && this._isRangeSupported) {
              this.cancel(new AbortException("Streaming is disabled."));
            }
            this._headersCapability.resolve();
          }).catch((error) => {
            if (error.code === "ENOENT") {
              error = createResponseError(0, url);
            }
            this._headersCapability.reject(error);
          });
        }
        async read() {
          await this._headersCapability.promise;
          const {
            value,
            done
          } = await this._reader.read();
          if (done) {
            return {
              value,
              done
            };
          }
          this._loaded += value.byteLength;
          this._callOnProgress();
          return {
            value: getArrayBuffer(value),
            done: false
          };
        }
        cancel(reason) {
          this._reader?.cancel(reason);
        }
      };
      PDFNodeStreamRangeReader = class extends BasePDFStreamRangeReader {
        constructor(stream, begin, end) {
          super(stream, begin, end);
          __publicField(this, "_readCapability", Promise.withResolvers());
          __publicField(this, "_reader", null);
          const {
            url
          } = stream._source;
          try {
            const readableStream = getReadableStream(url, {
              start: begin,
              end: end - 1
            });
            this._reader = readableStream.getReader();
            this._readCapability.resolve();
          } catch (error) {
            this._readCapability.reject(error);
          }
        }
        async read() {
          await this._readCapability.promise;
          const {
            value,
            done
          } = await this._reader.read();
          if (done) {
            return {
              value,
              done
            };
          }
          return {
            value: getArrayBuffer(value),
            done: false
          };
        }
        cancel(reason) {
          this._reader?.cancel(reason);
        }
      };
      GlobalWorkerOptions = class {
        static get workerPort() {
          return __privateGet(this, _port);
        }
        static set workerPort(val) {
          if (!(typeof Worker !== "undefined" && val instanceof Worker) && val !== null) {
            throw new Error("Invalid `workerPort` type.");
          }
          __privateSet(this, _port, val);
        }
        static get workerSrc() {
          return __privateGet(this, _src);
        }
        static set workerSrc(val) {
          if (typeof val !== "string") {
            throw new Error("Invalid `workerSrc` type.");
          }
          __privateSet(this, _src, val);
        }
      };
      _port = new WeakMap();
      _src = new WeakMap();
      __privateAdd(GlobalWorkerOptions, _port, null);
      __privateAdd(GlobalWorkerOptions, _src, "");
      Metadata = class {
        constructor({
          parsedData,
          rawData
        }) {
          __privateAdd(this, _map);
          __privateAdd(this, _data);
          __privateSet(this, _map, parsedData);
          __privateSet(this, _data, rawData);
        }
        getRaw() {
          return __privateGet(this, _data);
        }
        get(name) {
          return __privateGet(this, _map).get(name) ?? null;
        }
        [Symbol.iterator]() {
          return __privateGet(this, _map).entries();
        }
      };
      _map = new WeakMap();
      _data = new WeakMap();
      INTERNAL = /* @__PURE__ */ Symbol("INTERNAL");
      OptionalContentGroup = class {
        constructor(renderingIntent, {
          name,
          intent,
          usage,
          rbGroups
        }) {
          __privateAdd(this, _isDisplay, false);
          __privateAdd(this, _isPrint, false);
          __privateAdd(this, _userSet, false);
          __privateAdd(this, _visible, true);
          __privateSet(this, _isDisplay, !!(renderingIntent & RenderingIntentFlag.DISPLAY));
          __privateSet(this, _isPrint, !!(renderingIntent & RenderingIntentFlag.PRINT));
          this.name = name;
          this.intent = intent;
          this.usage = usage;
          this.rbGroups = rbGroups;
        }
        get visible() {
          if (__privateGet(this, _userSet)) {
            return __privateGet(this, _visible);
          }
          if (!__privateGet(this, _visible)) {
            return false;
          }
          const {
            print,
            view
          } = this.usage;
          if (__privateGet(this, _isDisplay)) {
            return view?.viewState !== "OFF";
          } else if (__privateGet(this, _isPrint)) {
            return print?.printState !== "OFF";
          }
          return true;
        }
        _setVisible(internal, visible, userSet = false) {
          if (internal !== INTERNAL) {
            unreachable("Internal method `_setVisible` called.");
          }
          __privateSet(this, _userSet, userSet);
          __privateSet(this, _visible, visible);
        }
        get serializable() {
          return {
            userSet: __privateGet(this, _userSet),
            visible: __privateGet(this, _visible)
          };
        }
      };
      _isDisplay = new WeakMap();
      _isPrint = new WeakMap();
      _userSet = new WeakMap();
      _visible = new WeakMap();
      _OptionalContentConfig = class _OptionalContentConfig {
        constructor(data, renderingIntent = RenderingIntentFlag.DISPLAY, groupState = null) {
          __privateAdd(this, _OptionalContentConfig_instances);
          __privateAdd(this, _cachedGetHash, null);
          __privateAdd(this, _groups, /* @__PURE__ */ new Map());
          __privateAdd(this, _initialHash, null);
          __privateAdd(this, _order, null);
          __privateAdd(this, _rawData);
          __publicField(this, "creator", null);
          __publicField(this, "name", null);
          __privateSet(this, _rawData, data);
          this.renderingIntent = renderingIntent;
          if (data === null) {
            return;
          }
          this.name = data.name;
          this.creator = data.creator;
          __privateSet(this, _order, data.order);
          for (const group2 of data.groups) {
            __privateGet(this, _groups).set(group2.id, new OptionalContentGroup(renderingIntent, group2));
          }
          if (groupState) {
            if (groupState.size !== __privateGet(this, _groups).size) {
              unreachable("Incorrect serialized groupState.");
            }
            for (const [id, group2] of groupState) {
              __privateGet(this, _groups).get(id)._setVisible(INTERNAL, group2.visible, group2.userSet);
            }
          } else {
            if (data.baseState === "OFF") {
              for (const group2 of __privateGet(this, _groups).values()) {
                group2._setVisible(INTERNAL, false);
              }
            }
            for (const on of data.on) {
              __privateGet(this, _groups).get(on)._setVisible(INTERNAL, true);
            }
            for (const off of data.off) {
              __privateGet(this, _groups).get(off)._setVisible(INTERNAL, false);
            }
          }
          __privateSet(this, _initialHash, this.getHash());
        }
        isVisible(group2) {
          if (__privateGet(this, _groups).size === 0) {
            return true;
          }
          if (!group2) {
            info("Optional content group not defined.");
            return true;
          }
          if (group2.type === "OCG") {
            if (!__privateGet(this, _groups).has(group2.id)) {
              warn(`Optional content group not found: ${group2.id}`);
              return true;
            }
            return __privateGet(this, _groups).get(group2.id).visible;
          } else if (group2.type === "OCMD") {
            if (group2.expression) {
              return __privateMethod(this, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn).call(this, group2.expression);
            }
            if (!group2.policy || group2.policy === "AnyOn") {
              for (const id of group2.ids) {
                if (!__privateGet(this, _groups).has(id)) {
                  warn(`Optional content group not found: ${id}`);
                  return true;
                }
                if (__privateGet(this, _groups).get(id).visible) {
                  return true;
                }
              }
              return false;
            } else if (group2.policy === "AllOn") {
              for (const id of group2.ids) {
                if (!__privateGet(this, _groups).has(id)) {
                  warn(`Optional content group not found: ${id}`);
                  return true;
                }
                if (!__privateGet(this, _groups).get(id).visible) {
                  return false;
                }
              }
              return true;
            } else if (group2.policy === "AnyOff") {
              for (const id of group2.ids) {
                if (!__privateGet(this, _groups).has(id)) {
                  warn(`Optional content group not found: ${id}`);
                  return true;
                }
                if (!__privateGet(this, _groups).get(id).visible) {
                  return true;
                }
              }
              return false;
            } else if (group2.policy === "AllOff") {
              for (const id of group2.ids) {
                if (!__privateGet(this, _groups).has(id)) {
                  warn(`Optional content group not found: ${id}`);
                  return true;
                }
                if (__privateGet(this, _groups).get(id).visible) {
                  return false;
                }
              }
              return true;
            }
            warn(`Unknown optional content policy ${group2.policy}.`);
            return true;
          }
          warn(`Unknown group type ${group2.type}.`);
          return true;
        }
        setVisibility(id, visible = true, preserveRB = true) {
          const group2 = __privateGet(this, _groups).get(id);
          if (!group2) {
            warn(`Optional content group not found: ${id}`);
            return;
          }
          if (preserveRB && visible && group2.rbGroups.length) {
            for (const rbGroup of group2.rbGroups) {
              for (const otherId of rbGroup) {
                if (otherId !== id) {
                  __privateGet(this, _groups).get(otherId)?._setVisible(INTERNAL, false, true);
                }
              }
            }
          }
          group2._setVisible(INTERNAL, !!visible, true);
          __privateSet(this, _cachedGetHash, null);
        }
        setOCGState({
          state,
          preserveRB
        }) {
          let operator;
          for (const elem of state) {
            switch (elem) {
              case "ON":
              case "OFF":
              case "Toggle":
                operator = elem;
                continue;
            }
            const group2 = __privateGet(this, _groups).get(elem);
            if (!group2) {
              continue;
            }
            switch (operator) {
              case "ON":
                this.setVisibility(elem, true, preserveRB);
                break;
              case "OFF":
                this.setVisibility(elem, false, preserveRB);
                break;
              case "Toggle":
                this.setVisibility(elem, !group2.visible, preserveRB);
                break;
            }
          }
          __privateSet(this, _cachedGetHash, null);
        }
        get hasInitialVisibility() {
          return __privateGet(this, _initialHash) === null || this.getHash() === __privateGet(this, _initialHash);
        }
        getOrder() {
          if (!__privateGet(this, _groups).size) {
            return null;
          }
          if (__privateGet(this, _order)) {
            return __privateGet(this, _order).slice();
          }
          return [...__privateGet(this, _groups).keys()];
        }
        getGroup(id) {
          return __privateGet(this, _groups).get(id) || null;
        }
        getHash() {
          if (__privateGet(this, _cachedGetHash) !== null) {
            return __privateGet(this, _cachedGetHash);
          }
          const hash = new MurmurHash3_64();
          for (const [id, group2] of __privateGet(this, _groups)) {
            hash.update(`${id}:${group2.visible}`);
          }
          return __privateSet(this, _cachedGetHash, hash.hexdigest());
        }
        [Symbol.iterator]() {
          return __privateGet(this, _groups).entries();
        }
        get serializable() {
          const groupState = /* @__PURE__ */ new Map();
          for (const [id, group2] of __privateGet(this, _groups)) {
            groupState.set(id, group2.serializable);
          }
          return {
            data: __privateGet(this, _rawData),
            renderingIntent: this.renderingIntent,
            groupState
          };
        }
        static fromSerializable({
          data,
          renderingIntent,
          groupState
        }) {
          return new _OptionalContentConfig(data, renderingIntent, groupState);
        }
      };
      _cachedGetHash = new WeakMap();
      _groups = new WeakMap();
      _initialHash = new WeakMap();
      _order = new WeakMap();
      _rawData = new WeakMap();
      _OptionalContentConfig_instances = new WeakSet();
      evaluateVisibilityExpression_fn = function(array) {
        const length = array.length;
        if (length < 2) {
          return true;
        }
        const operator = array[0];
        for (let i = 1; i < length; i++) {
          const element = array[i];
          let state;
          if (Array.isArray(element)) {
            state = __privateMethod(this, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn).call(this, element);
          } else if (__privateGet(this, _groups).has(element)) {
            state = __privateGet(this, _groups).get(element).visible;
          } else {
            warn(`Optional content group not found: ${element}`);
            return true;
          }
          switch (operator) {
            case "And":
              if (!state) {
                return false;
              }
              break;
            case "Or":
              if (state) {
                return true;
              }
              break;
            case "Not":
              return !state;
            default:
              return true;
          }
        }
        return operator === "And";
      };
      OptionalContentConfig = _OptionalContentConfig;
      PagesMapper = class {
        constructor() {
          __privateAdd(this, _PagesMapper_instances);
          __privateAdd(this, _pageNumberToId, null);
          __privateAdd(this, _prevPageNumbers, null);
          __privateAdd(this, _pagesNumber, 0);
          __privateAdd(this, _clipboard, null);
          __privateAdd(this, _savedData, null);
        }
        get pagesNumber() {
          return __privateGet(this, _pagesNumber);
        }
        set pagesNumber(n) {
          if (__privateGet(this, _pagesNumber) === n) {
            return;
          }
          __privateSet(this, _pagesNumber, n);
          __privateSet(this, _pageNumberToId, null);
          __privateSet(this, _prevPageNumbers, null);
        }
        movePages(selectedPages, pagesToMove, index) {
          __privateMethod(this, _PagesMapper_instances, ensureInit_fn).call(this);
          const pageNumberToId = __privateGet(this, _pageNumberToId);
          const prevIdToPageNumber = __privateMethod(this, _PagesMapper_instances, buildIdToPageNumber_fn).call(this);
          const movedCount = pagesToMove.length;
          const mappedPagesToMove = new Uint32Array(movedCount);
          let removedBeforeTarget = 0;
          for (let i = 0; i < movedCount; i++) {
            const pageIndex = pagesToMove[i] - 1;
            mappedPagesToMove[i] = pageNumberToId[pageIndex];
            if (pageIndex < index) {
              removedBeforeTarget++;
            }
          }
          const pagesNumber = __privateGet(this, _pagesNumber);
          const remainingLen = pagesNumber - movedCount;
          const adjustedTarget = MathClamp(index - removedBeforeTarget, 0, remainingLen);
          for (let i = 0, r = 0; i < pagesNumber; i++) {
            if (!selectedPages.has(i + 1)) {
              pageNumberToId[r++] = pageNumberToId[i];
            }
          }
          pageNumberToId.copyWithin(adjustedTarget + movedCount, adjustedTarget, remainingLen);
          pageNumberToId.set(mappedPagesToMove, adjustedTarget);
          __privateMethod(this, _PagesMapper_instances, updatePrevPageNumbers_fn).call(this, prevIdToPageNumber);
          if (pageNumberToId.every((id, i) => id === i + 1)) {
            __privateSet(this, _pageNumberToId, null);
          }
        }
        deletePages(pagesToDelete) {
          __privateMethod(this, _PagesMapper_instances, ensureInit_fn).call(this);
          const pageNumberToId = __privateGet(this, _pageNumberToId);
          const prevIdToPageNumber = __privateMethod(this, _PagesMapper_instances, buildIdToPageNumber_fn).call(this);
          __privateSet(this, _savedData, {
            pageNumberToId: pageNumberToId.slice(),
            pagesNumber: __privateGet(this, _pagesNumber),
            prevPageNumbers: __privateGet(this, _prevPageNumbers).slice()
          });
          const newN = __privateGet(this, _pagesNumber) - pagesToDelete.length;
          __privateSet(this, _pagesNumber, newN);
          const newPageNumberToId = __privateSet(this, _pageNumberToId, new Uint32Array(newN));
          __privateSet(this, _prevPageNumbers, new Int32Array(newN));
          let sourceIndex = 0;
          let destIndex = 0;
          for (const pageNumber of pagesToDelete) {
            const pageIndex = pageNumber - 1;
            if (pageIndex !== sourceIndex) {
              newPageNumberToId.set(pageNumberToId.subarray(sourceIndex, pageIndex), destIndex);
              destIndex += pageIndex - sourceIndex;
            }
            sourceIndex = pageIndex + 1;
          }
          if (sourceIndex < pageNumberToId.length) {
            newPageNumberToId.set(pageNumberToId.subarray(sourceIndex), destIndex);
          }
          __privateMethod(this, _PagesMapper_instances, updatePrevPageNumbers_fn).call(this, prevIdToPageNumber, new Set(pagesToDelete));
        }
        cancelDelete() {
          if (__privateGet(this, _savedData)) {
            __privateSet(this, _pageNumberToId, __privateGet(this, _savedData).pageNumberToId);
            __privateSet(this, _pagesNumber, __privateGet(this, _savedData).pagesNumber);
            __privateSet(this, _prevPageNumbers, __privateGet(this, _savedData).prevPageNumbers);
            __privateSet(this, _savedData, null);
          }
        }
        cleanSavedData() {
          __privateSet(this, _savedData, null);
        }
        copyPages(pagesToCopy) {
          __privateMethod(this, _PagesMapper_instances, ensureInit_fn).call(this);
          __privateSet(this, _clipboard, {
            pageNumbers: pagesToCopy,
            pageIds: pagesToCopy.map((n) => __privateGet(this, _pageNumberToId)[n - 1])
          });
        }
        cancelCopy() {
          __privateSet(this, _clipboard, null);
        }
        pastePages(index) {
          __privateMethod(this, _PagesMapper_instances, ensureInit_fn).call(this);
          const pageNumberToId = __privateGet(this, _pageNumberToId);
          const prevIdToPageNumber = __privateMethod(this, _PagesMapper_instances, buildIdToPageNumber_fn).call(this);
          const {
            pageNumbers: copiedPageNumbers,
            pageIds: copiedPageIds
          } = __privateGet(this, _clipboard);
          const newN = __privateGet(this, _pagesNumber) + copiedPageNumbers.length;
          __privateSet(this, _pagesNumber, newN);
          const newPageNumberToId = __privateSet(this, _pageNumberToId, new Uint32Array(newN));
          __privateSet(this, _prevPageNumbers, new Int32Array(newN));
          newPageNumberToId.set(pageNumberToId.subarray(0, index), 0);
          newPageNumberToId.set(copiedPageIds, index);
          newPageNumberToId.set(pageNumberToId.subarray(index), index + copiedPageNumbers.length);
          __privateMethod(this, _PagesMapper_instances, updatePrevPageNumbers_fn).call(this, prevIdToPageNumber, null, index, copiedPageNumbers);
          __privateSet(this, _clipboard, null);
        }
        hasBeenAltered() {
          return __privateGet(this, _pageNumberToId) !== null;
        }
        getPageMappingForSaving(idToPageNumber = null) {
          idToPageNumber ?? (idToPageNumber = __privateMethod(this, _PagesMapper_instances, buildIdToPageNumber_fn).call(this));
          let nCopy = 0;
          for (const pageNumbers of idToPageNumber.values()) {
            nCopy = Math.max(nCopy, pageNumbers.length);
          }
          const extractParams = new Array(nCopy);
          for (let i = 0; i < nCopy; i++) {
            extractParams[i] = {
              document: null,
              pageIndices: [],
              includePages: []
            };
          }
          for (const [id, pageNumbers] of idToPageNumber) {
            for (let i = 0, ii = pageNumbers.length; i < ii; i++) {
              extractParams[i].includePages.push([id - 1, pageNumbers[i] - 1]);
            }
          }
          for (const {
            includePages,
            pageIndices
          } of extractParams) {
            includePages.sort((a, b) => a[0] - b[0]);
            for (let i = 0, ii = includePages.length; i < ii; i++) {
              pageIndices.push(includePages[i][1]);
              includePages[i] = includePages[i][0];
            }
          }
          return extractParams;
        }
        extractPages(extractedPageNumbers) {
          extractedPageNumbers = Array.from(extractedPageNumbers).sort((a, b) => a - b);
          const usedIds = /* @__PURE__ */ new Map();
          for (let i = 0, ii = extractedPageNumbers.length; i < ii; i++) {
            const id = this.getPageId(extractedPageNumbers[i]);
            const usedPageNumbers = usedIds.getOrInsertComputed(id, makeArr);
            usedPageNumbers.push(i + 1);
          }
          return this.getPageMappingForSaving(usedIds);
        }
        getPrevPageNumber(pageNumber) {
          return __privateGet(this, _prevPageNumbers)?.[pageNumber - 1] ?? 0;
        }
        getPageNumber(id) {
          if (!__privateGet(this, _pageNumberToId)) {
            return id;
          }
          const pageNumberToId = __privateGet(this, _pageNumberToId);
          for (let i = 0, ii = __privateGet(this, _pagesNumber); i < ii; i++) {
            if (pageNumberToId[i] === id) {
              return i + 1;
            }
          }
          return 0;
        }
        getPageId(pageNumber) {
          return __privateGet(this, _pageNumberToId)?.[pageNumber - 1] ?? pageNumber;
        }
        getMapping() {
          return __privateGet(this, _pageNumberToId)?.subarray(0, this.pagesNumber);
        }
      };
      _pageNumberToId = new WeakMap();
      _prevPageNumbers = new WeakMap();
      _pagesNumber = new WeakMap();
      _clipboard = new WeakMap();
      _savedData = new WeakMap();
      _PagesMapper_instances = new WeakSet();
      ensureInit_fn = function() {
        if (__privateGet(this, _pageNumberToId)) {
          return;
        }
        const n = __privateGet(this, _pagesNumber);
        const pageNumberToId = __privateSet(this, _pageNumberToId, new Uint32Array(n));
        for (let i = 0; i < n; i++) {
          pageNumberToId[i] = i + 1;
        }
        __privateSet(this, _prevPageNumbers, new Int32Array(pageNumberToId));
      };
      buildIdToPageNumber_fn = function() {
        const idToPageNumber = /* @__PURE__ */ new Map();
        const pageNumberToId = __privateGet(this, _pageNumberToId);
        for (let i = 0, ii = __privateGet(this, _pagesNumber); i < ii; i++) {
          const id = pageNumberToId[i];
          const pageNumbers = idToPageNumber.get(id);
          if (pageNumbers) {
            pageNumbers.push(i + 1);
          } else {
            idToPageNumber.set(id, [i + 1]);
          }
        }
        return idToPageNumber;
      };
      updatePrevPageNumbers_fn = function(prevIdToPageNumber, deletedPageNumbers = null, pasteIndex = -1, copiedPageNumbers = null) {
        const prevPageNumbers = __privateGet(this, _prevPageNumbers);
        const newPageNumberToId = __privateGet(this, _pageNumberToId);
        const pasteEnd = pasteIndex + (copiedPageNumbers?.length ?? 0);
        const idsIndices = /* @__PURE__ */ new Map();
        for (let i = 0, ii = __privateGet(this, _pagesNumber); i < ii; i++) {
          if (i >= pasteIndex && i < pasteEnd) {
            prevPageNumbers[i] = -copiedPageNumbers[i - pasteIndex];
            continue;
          }
          const id = newPageNumberToId[i];
          const oldPositions = prevIdToPageNumber.get(id);
          let j = idsIndices.get(id) || 0;
          if (deletedPageNumbers && oldPositions) {
            while (j < oldPositions.length && deletedPageNumbers.has(oldPositions[j])) {
              j++;
            }
          }
          prevPageNumbers[i] = oldPositions?.[j];
          idsIndices.set(id, j + 1);
        }
      };
      INITIAL_DATA = /* @__PURE__ */ Symbol("INITIAL_DATA");
      dataObj = () => ({
        ...Promise.withResolvers(),
        data: INITIAL_DATA
      });
      PDFObjects = class {
        constructor() {
          __privateAdd(this, _objs, /* @__PURE__ */ new Map());
        }
        get(objId, callback = null) {
          if (callback) {
            const obj3 = __privateGet(this, _objs).getOrInsertComputed(objId, dataObj);
            obj3.promise.then(() => callback(obj3.data));
            return null;
          }
          const obj2 = __privateGet(this, _objs).get(objId);
          if (!obj2 || obj2.data === INITIAL_DATA) {
            throw new Error(`Requesting object that isn't resolved yet ${objId}.`);
          }
          return obj2.data;
        }
        has(objId) {
          const obj2 = __privateGet(this, _objs).get(objId);
          return !!obj2 && obj2.data !== INITIAL_DATA;
        }
        delete(objId) {
          const obj2 = __privateGet(this, _objs).get(objId);
          if (!obj2 || obj2.data === INITIAL_DATA) {
            return false;
          }
          __privateGet(this, _objs).delete(objId);
          return true;
        }
        resolve(objId, data = null) {
          const obj2 = __privateGet(this, _objs).getOrInsertComputed(objId, dataObj);
          if (obj2.data !== INITIAL_DATA) {
            throw new Error(`Object already resolved ${objId}.`);
          }
          obj2.data = data;
          obj2.resolve();
        }
        clear() {
          for (const {
            data
          } of __privateGet(this, _objs).values()) {
            data?.bitmap?.close();
          }
          __privateGet(this, _objs).clear();
        }
        *[Symbol.iterator]() {
          for (const [objId, {
            data
          }] of __privateGet(this, _objs)) {
            if (data !== INITIAL_DATA) {
              yield [objId, data];
            }
          }
        }
      };
      _objs = new WeakMap();
      MAX_TEXT_DIVS_TO_RENDER = 1e5;
      DEFAULT_FONT_SIZE = 30;
      _TextLayer = class _TextLayer {
        constructor({
          textContentSource,
          images,
          container,
          viewport
        }) {
          __privateAdd(this, _TextLayer_instances);
          __privateAdd(this, _capability, Promise.withResolvers());
          __privateAdd(this, _container3, null);
          __privateAdd(this, _disableProcessItems, false);
          __privateAdd(this, _fontInspectorEnabled, !!globalThis.FontInspector?.enabled);
          __privateAdd(this, _imagesHandler, null);
          __privateAdd(this, _lang, null);
          __privateAdd(this, _layoutTextParams, null);
          __privateAdd(this, _pageHeight, 0);
          __privateAdd(this, _pageWidth, 0);
          __privateAdd(this, _reader, null);
          __privateAdd(this, _rootContainer, null);
          __privateAdd(this, _rotation, 0);
          __privateAdd(this, _scale, 0);
          __privateAdd(this, _styleCache, /* @__PURE__ */ Object.create(null));
          __privateAdd(this, _textContentItemsStr, []);
          __privateAdd(this, _textContentSource, null);
          __privateAdd(this, _textDivs, []);
          __privateAdd(this, _textDivProperties, /* @__PURE__ */ new WeakMap());
          __privateAdd(this, _transform, null);
          var _a;
          if (textContentSource instanceof ReadableStream) {
            __privateSet(this, _textContentSource, textContentSource);
          } else if (typeof textContentSource === "object") {
            __privateSet(this, _textContentSource, new ReadableStream({
              start(controller) {
                controller.enqueue(textContentSource);
                controller.close();
              }
            }));
          } else {
            throw new Error('No "textContentSource" parameter specified.');
          }
          __privateSet(this, _container3, __privateSet(this, _rootContainer, container));
          __privateSet(this, _imagesHandler, images);
          __privateSet(this, _scale, viewport.scale * OutputScale.pixelRatio);
          __privateSet(this, _rotation, viewport.rotation);
          __privateSet(this, _layoutTextParams, {
            div: null,
            properties: null,
            ctx: null
          });
          const {
            pageWidth,
            pageHeight,
            pageX,
            pageY
          } = viewport.rawDims;
          __privateSet(this, _transform, [1, 0, 0, -1, -pageX, pageY + pageHeight]);
          __privateSet(this, _pageWidth, pageWidth);
          __privateSet(this, _pageHeight, pageHeight);
          __privateMethod(_a = _TextLayer, _TextLayer_static, ensureMinFontSizeComputed_fn).call(_a);
          container.style.setProperty("--min-font-size", __privateGet(_TextLayer, _minFontSize));
          setLayerDimensions(container, viewport);
          __privateGet(this, _capability).promise.finally(() => {
            __privateGet(_TextLayer, _pendingTextLayers).delete(this);
            __privateSet(this, _layoutTextParams, null);
            __privateSet(this, _styleCache, null);
          }).catch(() => {
          });
        }
        static get fontFamilyMap() {
          const {
            isWindows,
            isFirefox
          } = FeatureTest.platform;
          return shadow(this, "fontFamilyMap", /* @__PURE__ */ new Map([["sans-serif", `${isWindows && isFirefox ? "Calibri, " : ""}sans-serif`], ["monospace", `${isWindows && isFirefox ? "Lucida Console, " : ""}monospace`]]));
        }
        render() {
          if (__privateGet(this, _imagesHandler)) {
            __privateGet(this, _container3).append(__privateGet(this, _imagesHandler).render());
          }
          const pump = () => {
            __privateGet(this, _reader).read().then(({
              value,
              done
            }) => {
              if (done) {
                __privateGet(this, _capability).resolve();
                return;
              }
              __privateGet(this, _lang) ?? __privateSet(this, _lang, value.lang);
              Object.assign(__privateGet(this, _styleCache), value.styles);
              __privateMethod(this, _TextLayer_instances, processItems_fn).call(this, value.items);
              pump();
            }, __privateGet(this, _capability).reject);
          };
          __privateSet(this, _reader, __privateGet(this, _textContentSource).getReader());
          __privateGet(_TextLayer, _pendingTextLayers).add(this);
          pump();
          return __privateGet(this, _capability).promise;
        }
        update({
          viewport,
          onBefore = null
        }) {
          var _a;
          const scale = viewport.scale * OutputScale.pixelRatio;
          const rotation = viewport.rotation;
          if (rotation !== __privateGet(this, _rotation)) {
            onBefore?.();
            __privateSet(this, _rotation, rotation);
            setLayerDimensions(__privateGet(this, _rootContainer), {
              rotation
            });
          }
          if (scale !== __privateGet(this, _scale)) {
            onBefore?.();
            __privateSet(this, _scale, scale);
            const params = {
              div: null,
              properties: null,
              ctx: __privateMethod(_a = _TextLayer, _TextLayer_static, getCtx_fn).call(_a, __privateGet(this, _lang))
            };
            for (const div of __privateGet(this, _textDivs)) {
              params.properties = __privateGet(this, _textDivProperties).get(div);
              params.div = div;
              __privateMethod(this, _TextLayer_instances, layout_fn).call(this, params);
            }
          }
        }
        cancel() {
          const abortEx = new AbortException("TextLayer task cancelled.");
          __privateGet(this, _reader)?.cancel(abortEx).catch(() => {
          });
          __privateSet(this, _reader, null);
          __privateGet(this, _capability).reject(abortEx);
        }
        get textDivs() {
          return __privateGet(this, _textDivs);
        }
        get textContentItemsStr() {
          return __privateGet(this, _textContentItemsStr);
        }
        static cleanup() {
          if (__privateGet(this, _pendingTextLayers).size > 0) {
            return;
          }
          __privateGet(this, _ascentCache).clear();
          for (const {
            canvas
          } of __privateGet(this, _canvasContexts).values()) {
            canvas.remove();
          }
          __privateGet(this, _canvasContexts).clear();
        }
      };
      _capability = new WeakMap();
      _container3 = new WeakMap();
      _disableProcessItems = new WeakMap();
      _fontInspectorEnabled = new WeakMap();
      _imagesHandler = new WeakMap();
      _lang = new WeakMap();
      _layoutTextParams = new WeakMap();
      _pageHeight = new WeakMap();
      _pageWidth = new WeakMap();
      _reader = new WeakMap();
      _rootContainer = new WeakMap();
      _rotation = new WeakMap();
      _scale = new WeakMap();
      _styleCache = new WeakMap();
      _textContentItemsStr = new WeakMap();
      _textContentSource = new WeakMap();
      _textDivs = new WeakMap();
      _textDivProperties = new WeakMap();
      _transform = new WeakMap();
      _ascentCache = new WeakMap();
      _canvasContexts = new WeakMap();
      _canvasCtxFonts = new WeakMap();
      _minFontSize = new WeakMap();
      _pendingTextLayers = new WeakMap();
      _TextLayer_instances = new WeakSet();
      processItems_fn = function(items) {
        var _a, _b;
        if (__privateGet(this, _disableProcessItems)) {
          return;
        }
        (_b = __privateGet(this, _layoutTextParams)).ctx ?? (_b.ctx = __privateMethod(_a = _TextLayer, _TextLayer_static, getCtx_fn).call(_a, __privateGet(this, _lang)));
        const textDivs = __privateGet(this, _textDivs), textContentItemsStr = __privateGet(this, _textContentItemsStr);
        for (const item of items) {
          if (textDivs.length > MAX_TEXT_DIVS_TO_RENDER) {
            warn("Ignoring additional textDivs for performance reasons.");
            __privateSet(this, _disableProcessItems, true);
            return;
          }
          if (item.str === void 0) {
            if (item.type === "beginMarkedContentProps" || item.type === "beginMarkedContent") {
              const parent = __privateGet(this, _container3);
              __privateSet(this, _container3, document.createElement("span"));
              __privateGet(this, _container3).classList.add("markedContent");
              if (item.id) {
                __privateGet(this, _container3).setAttribute("id", item.id);
              }
              if (item.tag === "Artifact") {
                __privateGet(this, _container3).ariaHidden = true;
              }
              parent.append(__privateGet(this, _container3));
            } else if (item.type === "endMarkedContent") {
              __privateSet(this, _container3, __privateGet(this, _container3).parentNode);
            }
            continue;
          }
          textContentItemsStr.push(item.str);
          __privateMethod(this, _TextLayer_instances, appendText_fn).call(this, item);
        }
      };
      appendText_fn = function(geom) {
        var _a;
        const textDiv = document.createElement("span");
        const textDivProperties = {
          angle: 0,
          canvasWidth: 0,
          hasText: geom.str !== "",
          hasEOL: geom.hasEOL,
          fontSize: 0
        };
        __privateGet(this, _textDivs).push(textDiv);
        const tx = Util.transform(__privateGet(this, _transform), geom.transform);
        let angle = Math.atan2(tx[1], tx[0]);
        const style = __privateGet(this, _styleCache)[geom.fontName];
        if (style.vertical) {
          angle += Math.PI / 2;
        }
        let fontFamily = __privateGet(this, _fontInspectorEnabled) && style.fontSubstitution || style.fontFamily;
        fontFamily = _TextLayer.fontFamilyMap.get(fontFamily) || fontFamily;
        const fontHeight = Math.hypot(tx[2], tx[3]);
        const fontAscent = fontHeight * __privateMethod(_a = _TextLayer, _TextLayer_static, getAscent_fn).call(_a, fontFamily, style, __privateGet(this, _lang));
        let left, top;
        if (angle === 0) {
          left = tx[4];
          top = tx[5] - fontAscent;
        } else {
          left = tx[4] + fontAscent * Math.sin(angle);
          top = tx[5] - fontAscent * Math.cos(angle);
        }
        const divStyle = textDiv.style;
        divStyle.left = `${(100 * left / __privateGet(this, _pageWidth)).toFixed(2)}%`;
        divStyle.top = `${(100 * top / __privateGet(this, _pageHeight)).toFixed(2)}%`;
        divStyle.setProperty("--font-height", `${fontHeight.toFixed(2)}px`);
        divStyle.fontFamily = fontFamily;
        textDivProperties.fontSize = fontHeight;
        textDiv.setAttribute("role", "presentation");
        textDiv.textContent = geom.str;
        textDiv.dir = geom.dir;
        if (__privateGet(this, _fontInspectorEnabled)) {
          textDiv.dataset.fontName = style.fontSubstitutionLoadedName || geom.fontName;
        }
        if (angle !== 0) {
          textDivProperties.angle = angle * (180 / Math.PI);
        }
        let shouldScaleText = false;
        if (geom.str.length > 1) {
          shouldScaleText = true;
        } else if (geom.str !== " " && geom.transform[0] !== geom.transform[3]) {
          const absScaleX = Math.abs(geom.transform[0]), absScaleY = Math.abs(geom.transform[3]);
          if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {
            shouldScaleText = true;
          }
        }
        if (shouldScaleText) {
          textDivProperties.canvasWidth = style.vertical ? geom.height : geom.width;
        }
        __privateGet(this, _textDivProperties).set(textDiv, textDivProperties);
        __privateGet(this, _layoutTextParams).div = textDiv;
        __privateGet(this, _layoutTextParams).properties = textDivProperties;
        __privateMethod(this, _TextLayer_instances, layout_fn).call(this, __privateGet(this, _layoutTextParams));
        if (textDivProperties.hasText) {
          __privateGet(this, _container3).append(textDiv);
        }
        if (textDivProperties.hasEOL) {
          const br = document.createElement("br");
          br.setAttribute("role", "presentation");
          __privateGet(this, _container3).append(br);
        }
      };
      layout_fn = function(params) {
        var _a;
        const {
          div,
          properties,
          ctx
        } = params;
        const {
          style
        } = div;
        if (properties.canvasWidth !== 0 && properties.hasText) {
          const {
            fontFamily
          } = style;
          const {
            canvasWidth,
            fontSize
          } = properties;
          __privateMethod(_a = _TextLayer, _TextLayer_static, ensureCtxFont_fn).call(_a, ctx, fontSize * __privateGet(this, _scale), fontFamily);
          const {
            width
          } = ctx.measureText(div.textContent);
          if (width > 0) {
            style.setProperty("--scale-x", canvasWidth * __privateGet(this, _scale) / width);
          }
        }
        if (properties.angle !== 0) {
          style.setProperty("--rotate", `${properties.angle}deg`);
        }
      };
      _TextLayer_static = new WeakSet();
      getCtx_fn = function(lang = null) {
        let ctx = __privateGet(this, _canvasContexts).get(lang || (lang = ""));
        if (!ctx) {
          const canvas = document.createElement("canvas");
          canvas.style.cssText = "position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal";
          canvas.lang = lang;
          document.body.append(canvas);
          ctx = canvas.getContext("2d", {
            alpha: false,
            willReadFrequently: true
          });
          __privateGet(this, _canvasContexts).set(lang, ctx);
          __privateGet(this, _canvasCtxFonts).set(ctx, {
            size: 0,
            family: ""
          });
        }
        return ctx;
      };
      ensureCtxFont_fn = function(ctx, size2, family) {
        const cached = __privateGet(this, _canvasCtxFonts).get(ctx);
        if (size2 === cached.size && family === cached.family) {
          return;
        }
        ctx.font = `${size2}px ${family}`;
        cached.size = size2;
        cached.family = family;
      };
      ensureMinFontSizeComputed_fn = function() {
        if (__privateGet(this, _minFontSize) !== null) {
          return;
        }
        const div = document.createElement("div");
        div.style.opacity = 0;
        div.style.lineHeight = 1;
        div.style.fontSize = "1px";
        div.style.position = "absolute";
        div.textContent = "X";
        document.body.append(div);
        __privateSet(this, _minFontSize, div.getBoundingClientRect().height);
        div.remove();
      };
      getAscent_fn = function(fontFamily, style, lang) {
        const cachedAscent = __privateGet(this, _ascentCache).get(fontFamily);
        if (cachedAscent) {
          return cachedAscent;
        }
        const ctx = __privateMethod(this, _TextLayer_static, getCtx_fn).call(this, lang);
        ctx.canvas.width = ctx.canvas.height = DEFAULT_FONT_SIZE;
        __privateMethod(this, _TextLayer_static, ensureCtxFont_fn).call(this, ctx, DEFAULT_FONT_SIZE, fontFamily);
        const metrics = ctx.measureText("");
        const ascent = metrics.fontBoundingBoxAscent;
        const descent = Math.abs(metrics.fontBoundingBoxDescent);
        ctx.canvas.width = ctx.canvas.height = 0;
        let ratio = 0.8;
        if (ascent) {
          ratio = ascent / (ascent + descent);
        } else {
          if (FeatureTest.platform.isFirefox) {
            warn("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering.");
          }
          if (style.ascent) {
            ratio = style.ascent;
          } else if (style.descent) {
            ratio = 1 + style.descent;
          }
        }
        __privateGet(this, _ascentCache).set(fontFamily, ratio);
        return ratio;
      };
      __privateAdd(_TextLayer, _TextLayer_static);
      __privateAdd(_TextLayer, _ascentCache, /* @__PURE__ */ new Map());
      __privateAdd(_TextLayer, _canvasContexts, /* @__PURE__ */ new Map());
      __privateAdd(_TextLayer, _canvasCtxFonts, /* @__PURE__ */ new WeakMap());
      __privateAdd(_TextLayer, _minFontSize, null);
      __privateAdd(_TextLayer, _pendingTextLayers, /* @__PURE__ */ new Set());
      TextLayer = _TextLayer;
      RENDERING_CANCELLED_TIMEOUT = 100;
      _PDFDocumentLoadingTask = class _PDFDocumentLoadingTask {
        constructor() {
          __publicField(this, "_capability", Promise.withResolvers());
          __publicField(this, "_setupCapability", Promise.withResolvers());
          __publicField(this, "_transport", null);
          __publicField(this, "_worker", null);
          __publicField(this, "docId", `d${__privateWrapper(_PDFDocumentLoadingTask, _docId2)._++}`);
          __publicField(this, "destroyed", false);
          __publicField(this, "onPassword", null);
          __publicField(this, "onProgress", null);
        }
        get promise() {
          return this._capability.promise;
        }
        async destroy() {
          this.destroyed = true;
          this._capability.promise.catch(() => {
          });
          try {
            if (this._worker?.port) {
              this._worker._pendingDestroy = true;
            }
            await this._setupCapability.promise;
            await this._transport?.destroy();
          } catch (ex) {
            if (this._worker?.port) {
              delete this._worker._pendingDestroy;
            }
            throw ex;
          }
          this._transport = null;
          this._worker?.destroy();
          this._worker = null;
        }
        async getData() {
          return this._transport.getData();
        }
      };
      _docId2 = new WeakMap();
      __privateAdd(_PDFDocumentLoadingTask, _docId2, 0);
      PDFDocumentLoadingTask = _PDFDocumentLoadingTask;
      PDFDataRangeTransport = class {
        constructor(length, initialData, progressiveDone = false, contentDispositionFilename = null) {
          __privateAdd(this, _capability2, Promise.withResolvers());
          __privateAdd(this, _listener, null);
          this.length = length;
          this.initialData = initialData;
          this.progressiveDone = progressiveDone;
          this.contentDispositionFilename = contentDispositionFilename;
        }
        onDataRange(begin, chunk2) {
          __privateGet(this, _listener).call(this, {
            type: "range",
            begin,
            chunk: chunk2
          });
        }
        onDataProgressiveRead(chunk2) {
          __privateGet(this, _capability2).promise.then(() => {
            __privateGet(this, _listener).call(this, {
              type: "progressiveRead",
              chunk: chunk2
            });
          });
        }
        onDataProgressiveDone() {
          __privateGet(this, _capability2).promise.then(() => {
            __privateGet(this, _listener).call(this, {
              type: "progressiveDone"
            });
          });
        }
        transportReady(listener) {
          __privateSet(this, _listener, listener);
          __privateGet(this, _capability2).resolve();
        }
        requestDataRange(begin, end) {
          unreachable("Abstract method PDFDataRangeTransport.requestDataRange");
        }
        abort() {
        }
      };
      _capability2 = new WeakMap();
      _listener = new WeakMap();
      PDFDocumentProxy = class {
        constructor(pdfInfo, transport) {
          this._pdfInfo = pdfInfo;
          this._transport = transport;
        }
        get pagesMapper() {
          return this._transport.pagesMapper;
        }
        get annotationStorage() {
          return this._transport.annotationStorage;
        }
        get canvasFactory() {
          return this._transport.canvasFactory;
        }
        get filterFactory() {
          return this._transport.filterFactory;
        }
        get numPages() {
          return this._pdfInfo.numPages;
        }
        get fingerprints() {
          return this._pdfInfo.fingerprints;
        }
        get isPureXfa() {
          return shadow(this, "isPureXfa", !!this._transport._htmlForXfa);
        }
        get allXfaHtml() {
          return this._transport._htmlForXfa;
        }
        getPage(pageNumber) {
          return this._transport.getPage(pageNumber);
        }
        getPageIndex(ref) {
          return this._transport.getPageIndex(ref);
        }
        getDestinations() {
          return this._transport.getDestinations();
        }
        getDestination(id) {
          return this._transport.getDestination(id);
        }
        getPageLabels() {
          return this._transport.getPageLabels();
        }
        getPageLayout() {
          return this._transport.getPageLayout();
        }
        getPageMode() {
          return this._transport.getPageMode();
        }
        getViewerPreferences() {
          return this._transport.getViewerPreferences();
        }
        getOpenAction() {
          return this._transport.getOpenAction();
        }
        getAttachments() {
          return this._transport.getAttachments();
        }
        getAttachmentContent(id) {
          return this._transport.getAttachmentContent(id);
        }
        getAnnotationsByType(types, pageIndexesToSkip) {
          return this._transport.getAnnotationsByType(types, pageIndexesToSkip);
        }
        getJSActions() {
          return this._transport.getDocJSActions();
        }
        getOutline() {
          return this._transport.getOutline();
        }
        getOptionalContentConfig({
          intent = "display"
        } = {}) {
          const {
            renderingIntent
          } = this._transport.getRenderingIntent(intent);
          return this._transport.getOptionalContentConfig(renderingIntent);
        }
        getPermissions() {
          return this._transport.getPermissions();
        }
        getMetadata() {
          return this._transport.getMetadata();
        }
        getMarkInfo() {
          return this._transport.getMarkInfo();
        }
        getData() {
          return this._transport.getData();
        }
        saveDocument() {
          return this._transport.saveDocument();
        }
        extractPages(pageInfos) {
          return this._transport.extractPages(pageInfos);
        }
        getDownloadInfo() {
          return this._transport.downloadInfoCapability.promise;
        }
        getRawData(data) {
          return this._transport.getRawData(data);
        }
        cleanup(keepLoadedFonts = false) {
          return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);
        }
        cachedPageNumber(ref) {
          return this._transport.cachedPageNumber(ref);
        }
        get loadingParams() {
          return this._transport.loadingParams;
        }
        get loadingTask() {
          return this._transport.loadingTask;
        }
        getFieldObjects() {
          return this._transport.getFieldObjects();
        }
        getSignatures() {
          return this._transport.getSignatures();
        }
        getSignatureData(id) {
          return this._transport.getSignatureData(id);
        }
        hasJSActions() {
          return this._transport.hasJSActions();
        }
        getCalculationOrderIds() {
          return this._transport.getCalculationOrderIds();
        }
      };
      _PDFPageProxy = class _PDFPageProxy {
        constructor(pageIndex, pageInfo, transport, pagesMapper, pdfBug = false) {
          __privateAdd(this, _PDFPageProxy_instances);
          __privateAdd(this, _pendingCleanup, false);
          __privateAdd(this, _pagesMapper, null);
          this._pageIndex = pageIndex;
          this._pageInfo = pageInfo;
          this._transport = transport;
          this._stats = pdfBug ? new StatTimer() : null;
          this._pdfBug = pdfBug;
          this.commonObjs = transport.commonObjs;
          this.objs = new PDFObjects();
          this._intentStates = /* @__PURE__ */ new Map();
          this.destroyed = false;
          this.recordedBBoxes = null;
          __privateSet(this, _pagesMapper, pagesMapper);
          this.imageCoordinates = null;
        }
        clone(id) {
          const clone2 = new _PDFPageProxy(id, this._pageInfo, this._transport, __privateGet(this, _pagesMapper), this._pdfBug);
          clone2.clonedFromIndex = this.clonedFromIndex ?? this._pageIndex;
          this._transport.updatePage(clone2);
          return clone2;
        }
        get pageNumber() {
          return this._pageIndex + 1;
        }
        set pageNumber(value) {
          this._pageIndex = value - 1;
          this._transport.updatePage(this);
        }
        get rotate() {
          return this._pageInfo.rotate;
        }
        get ref() {
          return this._pageInfo.ref;
        }
        get userUnit() {
          return this._pageInfo.userUnit;
        }
        get view() {
          return this._pageInfo.view;
        }
        getViewport({
          scale,
          rotation = this.rotate,
          offsetX = 0,
          offsetY = 0,
          dontFlip = false
        } = {}) {
          return new PageViewport({
            viewBox: this.view,
            userUnit: this.userUnit,
            scale,
            rotation,
            offsetX,
            offsetY,
            dontFlip
          });
        }
        getAnnotations({
          intent = "display"
        } = {}) {
          const {
            renderingIntent
          } = this._transport.getRenderingIntent(intent);
          return this._transport.getAnnotations(this._pageIndex, renderingIntent);
        }
        getJSActions() {
          return this._transport.getPageJSActions(this._pageIndex);
        }
        get filterFactory() {
          return this._transport.filterFactory;
        }
        get isPureXfa() {
          return shadow(this, "isPureXfa", !!this._transport._htmlForXfa);
        }
        async getXfa() {
          return this._transport._htmlForXfa?.children[this._pageIndex] || null;
        }
        render({
          canvasContext,
          canvas = canvasContext.canvas,
          viewport,
          intent = "display",
          annotationMode = AnnotationMode.ENABLE,
          transform = null,
          background = null,
          optionalContentConfigPromise = null,
          annotationCanvasMap = null,
          pageColors = null,
          printAnnotationStorage = null,
          isEditing = false,
          recordImages = false,
          recordOperations = false,
          operationsFilter = null
        }) {
          this._stats?.time("Overall");
          const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, isEditing);
          const {
            renderingIntent,
            cacheKey
          } = intentArgs;
          __privateSet(this, _pendingCleanup, false);
          optionalContentConfigPromise || (optionalContentConfigPromise = this._transport.getOptionalContentConfig(renderingIntent));
          const intentState = this._intentStates.getOrInsertComputed(cacheKey, makeObj);
          if (intentState.streamReaderCancelTimeout) {
            clearTimeout(intentState.streamReaderCancelTimeout);
            intentState.streamReaderCancelTimeout = null;
          }
          const intentPrint = !!(renderingIntent & RenderingIntentFlag.PRINT);
          if (!intentState.displayReadyCapability) {
            intentState.displayReadyCapability = Promise.withResolvers();
            intentState.operatorList = {
              fnArray: [],
              argsArray: [],
              lastChunk: false,
              separateAnnots: null
            };
            this._stats?.time("Page Request");
            this._pumpOperatorList(intentArgs);
          }
          const recordForDebugger = !!(this._pdfBug && globalThis.StepperManager?.enabled);
          const shouldRecordOperations = !!canvas && !this.recordedBBoxes && (recordOperations || recordForDebugger);
          const shouldRecordImages = !!canvas && !this.imageCoordinates && recordImages;
          const complete = (error) => {
            intentState.renderTasks.delete(internalRenderTask);
            if (shouldRecordOperations) {
              const recordedBBoxes = internalRenderTask.gfx?.dependencyTracker.take();
              if (recordedBBoxes) {
                internalRenderTask.stepper?.setOperatorBBoxes(recordedBBoxes, internalRenderTask.gfx.dependencyTracker.takeDebugMetadata());
                if (recordOperations) {
                  this.recordedBBoxes = recordedBBoxes;
                }
              }
            }
            if (shouldRecordImages && !error) {
              this.imageCoordinates = internalRenderTask.gfx?.imagesTracker.take();
            }
            if (intentPrint) {
              __privateSet(this, _pendingCleanup, true);
            }
            __privateMethod(this, _PDFPageProxy_instances, tryCleanup_fn).call(this);
            if (error) {
              internalRenderTask.capability.reject(error);
              this._abortOperatorList({
                intentState,
                reason: error instanceof Error ? error : new Error(error)
              });
            } else {
              internalRenderTask.capability.resolve();
            }
            if (this._stats) {
              this._stats.timeEnd("Rendering");
              this._stats.timeEnd("Overall");
              if (globalThis.Stats?.enabled) {
                globalThis.Stats.add(this.pageNumber, this._stats);
              }
            }
          };
          let dependencyTracker = null;
          let bboxTracker = null;
          if (shouldRecordOperations || shouldRecordImages) {
            bboxTracker = new CanvasBBoxTracker(canvas, intentState.operatorList.length);
          }
          if (shouldRecordOperations) {
            dependencyTracker = new CanvasDependencyTracker(bboxTracker, recordForDebugger);
          }
          const internalRenderTask = new InternalRenderTask({
            callback: complete,
            params: {
              canvas,
              canvasContext,
              dependencyTracker: dependencyTracker ?? bboxTracker,
              imagesTracker: shouldRecordImages ? new CanvasImagesTracker(canvas) : null,
              viewport,
              transform,
              background
            },
            objs: this.objs,
            commonObjs: this.commonObjs,
            annotationCanvasMap,
            operatorList: intentState.operatorList,
            pageIndex: this._pageIndex,
            canvasFactory: this._transport.canvasFactory,
            filterFactory: this._transport.filterFactory,
            useRequestAnimationFrame: !intentPrint,
            pdfBug: this._pdfBug,
            pageColors,
            enableHWA: this._transport.enableHWA,
            operationsFilter
          });
          (intentState.renderTasks || (intentState.renderTasks = /* @__PURE__ */ new Set())).add(internalRenderTask);
          const renderTask = internalRenderTask.task;
          Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(([transparency, optionalContentConfig]) => {
            if (this.destroyed) {
              complete();
              return;
            }
            this._stats?.time("Rendering");
            if (!(optionalContentConfig.renderingIntent & renderingIntent)) {
              throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");
            }
            internalRenderTask.initializeGraphics({
              transparency,
              optionalContentConfig
            });
            internalRenderTask.operatorListChanged();
          }).catch(complete);
          return renderTask;
        }
        getOperatorList({
          intent = "display",
          annotationMode = AnnotationMode.ENABLE,
          printAnnotationStorage = null,
          isEditing = false
        } = {}) {
          function operatorListChanged() {
            if (intentState.operatorList.lastChunk) {
              intentState.opListReadCapability.resolve(intentState.operatorList);
              intentState.renderTasks.delete(opListTask);
            }
          }
          const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, isEditing, true);
          const intentState = this._intentStates.getOrInsertComputed(intentArgs.cacheKey, makeObj);
          let opListTask;
          if (!intentState.opListReadCapability) {
            opListTask = /* @__PURE__ */ Object.create(null);
            opListTask.operatorListChanged = operatorListChanged;
            intentState.opListReadCapability = Promise.withResolvers();
            (intentState.renderTasks || (intentState.renderTasks = /* @__PURE__ */ new Set())).add(opListTask);
            intentState.operatorList = {
              fnArray: [],
              argsArray: [],
              lastChunk: false,
              separateAnnots: null
            };
            this._stats?.time("Page Request");
            this._pumpOperatorList(intentArgs);
          }
          return intentState.opListReadCapability.promise;
        }
        streamTextContent({
          includeMarkedContent = false,
          disableNormalization = false
        } = {}) {
          const TEXT_CONTENT_CHUNK_SIZE = 100;
          return this._transport.messageHandler.sendWithStream("GetTextContent", {
            pageId: __privateGet(this, _pagesMapper).getPageId(this._pageIndex + 1) - 1,
            pageIndex: this._pageIndex,
            includeMarkedContent: includeMarkedContent === true,
            disableNormalization: disableNormalization === true
          }, {
            highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
            size(textContent) {
              return textContent.items.length;
            }
          });
        }
        async getTextContent(params = {}) {
          if (this._transport._htmlForXfa) {
            return this.getXfa().then((xfa) => XfaText.textContent(xfa));
          }
          const readableStream = this.streamTextContent(params);
          const textContent = {
            items: [],
            styles: /* @__PURE__ */ Object.create(null),
            lang: null
          };
          for await (const value of readableStream) {
            textContent.lang ?? (textContent.lang = value.lang);
            Object.assign(textContent.styles, value.styles);
            textContent.items.push(...value.items);
          }
          return textContent;
        }
        getStructTree() {
          return this._transport.getStructTree(this._pageIndex);
        }
        _destroy() {
          this.destroyed = true;
          const waitOn = [];
          for (const intentState of this._intentStates.values()) {
            this._abortOperatorList({
              intentState,
              reason: new Error("Page was destroyed."),
              force: true
            });
            if (intentState.opListReadCapability) {
              continue;
            }
            for (const internalRenderTask of intentState.renderTasks) {
              waitOn.push(internalRenderTask.completed);
              internalRenderTask.cancel();
            }
          }
          this.objs.clear();
          __privateSet(this, _pendingCleanup, false);
          return Promise.all(waitOn);
        }
        cleanup(resetStats = false) {
          __privateSet(this, _pendingCleanup, true);
          const success = __privateMethod(this, _PDFPageProxy_instances, tryCleanup_fn).call(this);
          if (resetStats && success) {
            this._stats && (this._stats = new StatTimer());
          }
          return success;
        }
        _startRenderPage(transparency, cacheKey) {
          const intentState = this._intentStates.get(cacheKey);
          if (!intentState) {
            return;
          }
          this._stats?.timeEnd("Page Request");
          intentState.displayReadyCapability?.resolve(transparency);
        }
        _renderPageChunk(operatorListChunk, intentState) {
          for (let i = 0, ii = operatorListChunk.length; i < ii; i++) {
            intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
            intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);
          }
          intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
          intentState.operatorList.separateAnnots = operatorListChunk.separateAnnots;
          for (const internalRenderTask of intentState.renderTasks) {
            internalRenderTask.operatorListChanged();
          }
          if (operatorListChunk.lastChunk) {
            __privateMethod(this, _PDFPageProxy_instances, tryCleanup_fn).call(this);
          }
        }
        _pumpOperatorList({
          renderingIntent,
          cacheKey,
          annotationStorageSerializable,
          modifiedIds
        }) {
          const {
            map: map2,
            transfer
          } = annotationStorageSerializable;
          const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", {
            pageId: __privateGet(this, _pagesMapper).getPageId(this._pageIndex + 1) - 1,
            pageIndex: this._pageIndex,
            intent: renderingIntent,
            cacheKey,
            annotationStorage: map2,
            modifiedIds
          }, void 0, transfer);
          const reader = readableStream.getReader();
          const intentState = this._intentStates.get(cacheKey);
          intentState.streamReader = reader;
          const pump = () => {
            reader.read().then(({
              value,
              done
            }) => {
              if (done) {
                intentState.streamReader = null;
                return;
              }
              if (this._transport.destroyed) {
                return;
              }
              this._renderPageChunk(value, intentState);
              pump();
            }, (reason) => {
              intentState.streamReader = null;
              if (this._transport.destroyed) {
                return;
              }
              if (intentState.operatorList) {
                intentState.operatorList.lastChunk = true;
                for (const internalRenderTask of intentState.renderTasks) {
                  internalRenderTask.operatorListChanged();
                }
                __privateMethod(this, _PDFPageProxy_instances, tryCleanup_fn).call(this);
              }
              if (intentState.displayReadyCapability) {
                intentState.displayReadyCapability.reject(reason);
              } else if (intentState.opListReadCapability) {
                intentState.opListReadCapability.reject(reason);
              } else {
                throw reason;
              }
            });
          };
          pump();
        }
        _abortOperatorList({
          intentState,
          reason,
          force = false
        }) {
          if (!intentState.streamReader) {
            return;
          }
          if (intentState.streamReaderCancelTimeout) {
            clearTimeout(intentState.streamReaderCancelTimeout);
            intentState.streamReaderCancelTimeout = null;
          }
          if (!force) {
            if (intentState.renderTasks.size > 0) {
              return;
            }
            if (reason instanceof RenderingCancelledException) {
              let delay = RENDERING_CANCELLED_TIMEOUT;
              if (reason.extraDelay > 0 && reason.extraDelay < 1e3) {
                delay += reason.extraDelay;
              }
              intentState.streamReaderCancelTimeout = setTimeout(() => {
                intentState.streamReaderCancelTimeout = null;
                this._abortOperatorList({
                  intentState,
                  reason,
                  force: true
                });
              }, delay);
              return;
            }
          }
          intentState.streamReader.cancel(new AbortException(reason.message)).catch(() => {
          });
          intentState.streamReader = null;
          if (this._transport.destroyed) {
            return;
          }
          for (const [curCacheKey, curIntentState] of this._intentStates) {
            if (curIntentState === intentState) {
              this._intentStates.delete(curCacheKey);
              break;
            }
          }
          this.cleanup();
        }
        get stats() {
          return this._stats;
        }
      };
      _pendingCleanup = new WeakMap();
      _pagesMapper = new WeakMap();
      _PDFPageProxy_instances = new WeakSet();
      tryCleanup_fn = function() {
        if (!__privateGet(this, _pendingCleanup) || this.destroyed) {
          return false;
        }
        for (const {
          renderTasks,
          operatorList
        } of this._intentStates.values()) {
          if (renderTasks.size > 0 || !operatorList.lastChunk) {
            return false;
          }
        }
        this._intentStates.clear();
        this.objs.clear();
        __privateSet(this, _pendingCleanup, false);
        return true;
      };
      PDFPageProxy = _PDFPageProxy;
      _PDFWorker = class _PDFWorker {
        constructor({
          name = null,
          port = null,
          verbosity: verbosity2 = getVerbosityLevel()
        } = {}) {
          __privateAdd(this, _PDFWorker_instances);
          __privateAdd(this, _capability3, Promise.withResolvers());
          __privateAdd(this, _messageHandler, null);
          __privateAdd(this, _port2, null);
          __privateAdd(this, _webWorker, null);
          this.name = name;
          this.destroyed = false;
          this.verbosity = verbosity2;
          if (port) {
            if (__privateGet(_PDFWorker, _workerPorts).has(port)) {
              throw new Error("Cannot use more than one PDFWorker per port.");
            }
            __privateGet(_PDFWorker, _workerPorts).set(port, this);
            __privateMethod(this, _PDFWorker_instances, initializeFromPort_fn).call(this, port);
          } else {
            __privateMethod(this, _PDFWorker_instances, initialize_fn).call(this);
          }
        }
        get promise() {
          return __privateGet(this, _capability3).promise;
        }
        get port() {
          return __privateGet(this, _port2);
        }
        get messageHandler() {
          return __privateGet(this, _messageHandler);
        }
        destroy() {
          this.destroyed = true;
          __privateGet(this, _webWorker)?.terminate();
          __privateSet(this, _webWorker, null);
          __privateGet(_PDFWorker, _workerPorts).delete(__privateGet(this, _port2));
          __privateSet(this, _port2, null);
          __privateGet(this, _messageHandler)?.destroy();
          __privateSet(this, _messageHandler, null);
        }
        static create(params) {
          const cachedPort = __privateGet(this, _workerPorts).get(params?.port);
          if (cachedPort) {
            if (cachedPort._pendingDestroy) {
              throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");
            }
            return cachedPort;
          }
          return new _PDFWorker(params);
        }
        static get workerSrc() {
          if (GlobalWorkerOptions.workerSrc) {
            return GlobalWorkerOptions.workerSrc;
          }
          throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
        }
        static get _setupFakeWorkerGlobal() {
          const loader = async () => {
            if (__privateGet(this, _PDFWorker_static, mainThreadWorkerMessageHandler_get)) {
              return __privateGet(this, _PDFWorker_static, mainThreadWorkerMessageHandler_get);
            }
            const worker = await import(
              /*webpackIgnore: true*/
              /*@vite-ignore*/
              this.workerSrc
            );
            return worker.WorkerMessageHandler;
          };
          return shadow(this, "_setupFakeWorkerGlobal", loader());
        }
      };
      _capability3 = new WeakMap();
      _messageHandler = new WeakMap();
      _port2 = new WeakMap();
      _webWorker = new WeakMap();
      _fakeWorkerId = new WeakMap();
      _isWorkerDisabled = new WeakMap();
      _workerPorts = new WeakMap();
      _PDFWorker_instances = new WeakSet();
      resolve_fn = function() {
        __privateGet(this, _capability3).resolve();
        __privateGet(this, _messageHandler).send("configure", {
          verbosity: this.verbosity
        });
      };
      initializeFromPort_fn = function(port) {
        __privateSet(this, _port2, port);
        __privateSet(this, _messageHandler, new MessageHandler("main", "worker", port));
        __privateGet(this, _messageHandler).on("ready", () => {
        });
        __privateMethod(this, _PDFWorker_instances, resolve_fn).call(this);
      };
      initialize_fn = function() {
        if (__privateGet(_PDFWorker, _isWorkerDisabled) || __privateGet(_PDFWorker, _PDFWorker_static, mainThreadWorkerMessageHandler_get)) {
          __privateMethod(this, _PDFWorker_instances, setupFakeWorker_fn).call(this);
          return;
        }
        let {
          workerSrc
        } = _PDFWorker;
        try {
          if (!_PDFWorker._isSameOrigin(window.location, workerSrc)) {
            workerSrc = _PDFWorker._createCDNWrapper(new URL(workerSrc, window.location).href);
          }
          const worker = new Worker(workerSrc, {
            type: "module"
          });
          const messageHandler = new MessageHandler("main", "worker", worker);
          const terminateEarly = () => {
            ac.abort();
            messageHandler.destroy();
            worker.terminate();
            if (this.destroyed) {
              __privateGet(this, _capability3).reject(new Error("Worker was destroyed"));
            } else {
              __privateMethod(this, _PDFWorker_instances, setupFakeWorker_fn).call(this);
            }
          };
          const ac = new AbortController();
          worker.addEventListener("error", () => {
            if (!__privateGet(this, _webWorker)) {
              terminateEarly();
            }
          }, {
            signal: ac.signal
          });
          messageHandler.on("test", (data) => {
            ac.abort();
            if (this.destroyed || !data) {
              terminateEarly();
              return;
            }
            __privateSet(this, _messageHandler, messageHandler);
            __privateSet(this, _port2, worker);
            __privateSet(this, _webWorker, worker);
            __privateMethod(this, _PDFWorker_instances, resolve_fn).call(this);
          });
          messageHandler.on("ready", (data) => {
            ac.abort();
            if (this.destroyed) {
              terminateEarly();
              return;
            }
            try {
              sendTest();
            } catch {
              __privateMethod(this, _PDFWorker_instances, setupFakeWorker_fn).call(this);
            }
          });
          const sendTest = () => {
            const testObj = new Uint8Array();
            messageHandler.send("test", testObj, [testObj.buffer]);
          };
          sendTest();
          return;
        } catch {
          info("The worker has been disabled.");
        }
        __privateMethod(this, _PDFWorker_instances, setupFakeWorker_fn).call(this);
      };
      setupFakeWorker_fn = function() {
        if (!__privateGet(_PDFWorker, _isWorkerDisabled)) {
          warn("Setting up fake worker.");
          __privateSet(_PDFWorker, _isWorkerDisabled, true);
        }
        _PDFWorker._setupFakeWorkerGlobal.then((WorkerMessageHandler) => {
          if (this.destroyed) {
            __privateGet(this, _capability3).reject(new Error("Worker was destroyed"));
            return;
          }
          const port = new LoopbackPort();
          __privateSet(this, _port2, port);
          const id = `fake${__privateWrapper(_PDFWorker, _fakeWorkerId)._++}`;
          const workerHandler = new MessageHandler(id + "_worker", id, port);
          WorkerMessageHandler.setup(workerHandler, port);
          __privateSet(this, _messageHandler, new MessageHandler(id, id + "_worker", port));
          __privateMethod(this, _PDFWorker_instances, resolve_fn).call(this);
        }).catch((reason) => {
          __privateGet(this, _capability3).reject(new Error(`Setting up fake worker failed: "${reason.message}".`));
        });
      };
      _PDFWorker_static = new WeakSet();
      mainThreadWorkerMessageHandler_get = function() {
        try {
          return globalThis.pdfjsWorker?.WorkerMessageHandler || null;
        } catch {
          return null;
        }
      };
      __privateAdd(_PDFWorker, _PDFWorker_static);
      __privateAdd(_PDFWorker, _fakeWorkerId, 0);
      __privateAdd(_PDFWorker, _isWorkerDisabled, false);
      __privateAdd(_PDFWorker, _workerPorts, /* @__PURE__ */ new WeakMap());
      (() => {
        if (isNodeJS) {
          __privateSet(_PDFWorker, _isWorkerDisabled, true);
          GlobalWorkerOptions.workerSrc || (GlobalWorkerOptions.workerSrc = "./pdf.worker.mjs");
        }
        _PDFWorker._isSameOrigin = (baseUrl, otherUrl) => {
          const base = URL.parse(baseUrl);
          if (!base?.origin || base.origin === "null") {
            return false;
          }
          const other = new URL(otherUrl, base);
          return base.origin === other.origin;
        };
        _PDFWorker._createCDNWrapper = (url) => {
          const wrapper = `await import("${url}");`;
          return URL.createObjectURL(new Blob([wrapper], {
            type: "text/javascript"
          }));
        };
      })();
      PDFWorker = _PDFWorker;
      WorkerTransport = class {
        constructor(messageHandler, loadingTask, networkStream, params, factory, pagesMapper) {
          __privateAdd(this, _WorkerTransport_instances);
          __publicField(this, "downloadInfoCapability", Promise.withResolvers());
          __privateAdd(this, _fullReader, null);
          __privateAdd(this, _methodPromises, /* @__PURE__ */ new Map());
          __privateAdd(this, _networkStream, null);
          __privateAdd(this, _pageCache, /* @__PURE__ */ new Map());
          __privateAdd(this, _pagePromises, /* @__PURE__ */ new Map());
          __privateAdd(this, _pageRefCache, /* @__PURE__ */ new Map());
          __privateAdd(this, _passwordCapability, null);
          this.messageHandler = messageHandler;
          this.loadingTask = loadingTask;
          __privateSet(this, _networkStream, networkStream);
          this.commonObjs = new PDFObjects();
          this.fontLoader = new FontLoader({
            ownerDocument: params.ownerDocument,
            styleElement: params.styleElement
          });
          this.enableHWA = params.enableHWA;
          this.loadingParams = params.loadingParams;
          this._params = params;
          this.canvasFactory = factory.canvasFactory;
          this.filterFactory = factory.filterFactory;
          this.binaryDataFactory = factory.binaryDataFactory;
          this.pagesMapper = pagesMapper;
          this.destroyed = false;
          this.destroyCapability = null;
          this.setupMessageHandler();
        }
        updatePage(page) {
          const {
            _pageIndex
          } = page;
          __privateGet(this, _pageCache).set(_pageIndex, page);
          __privateGet(this, _pagePromises).set(_pageIndex, Promise.resolve(page));
        }
        get annotationStorage() {
          return shadow(this, "annotationStorage", new AnnotationStorage());
        }
        getRenderingIntent(intent, annotationMode = AnnotationMode.ENABLE, printAnnotationStorage = null, isEditing = false, isOpList = false) {
          let renderingIntent = RenderingIntentFlag.DISPLAY;
          let annotationStorageSerializable = SerializableEmpty;
          switch (intent) {
            case "any":
              renderingIntent = RenderingIntentFlag.ANY;
              break;
            case "display":
              break;
            case "print":
              renderingIntent = RenderingIntentFlag.PRINT;
              break;
            default:
              warn(`getRenderingIntent - invalid intent: ${intent}`);
          }
          const annotationStorage = renderingIntent & RenderingIntentFlag.PRINT && printAnnotationStorage instanceof PrintAnnotationStorage ? printAnnotationStorage : this.annotationStorage;
          switch (annotationMode) {
            case AnnotationMode.DISABLE:
              renderingIntent += RenderingIntentFlag.ANNOTATIONS_DISABLE;
              break;
            case AnnotationMode.ENABLE:
              break;
            case AnnotationMode.ENABLE_FORMS:
              renderingIntent += RenderingIntentFlag.ANNOTATIONS_FORMS;
              break;
            case AnnotationMode.ENABLE_STORAGE:
              renderingIntent += RenderingIntentFlag.ANNOTATIONS_STORAGE;
              annotationStorageSerializable = annotationStorage.serializable;
              break;
            default:
              warn(`getRenderingIntent - invalid annotationMode: ${annotationMode}`);
          }
          if (isEditing) {
            renderingIntent += RenderingIntentFlag.IS_EDITING;
          }
          if (isOpList) {
            renderingIntent += RenderingIntentFlag.OPLIST;
          }
          const {
            ids: modifiedIds,
            hash: modifiedIdsHash
          } = annotationStorage.modifiedIds;
          const cacheKeyBuf = [renderingIntent, annotationStorageSerializable.hash, modifiedIdsHash];
          return {
            renderingIntent,
            cacheKey: cacheKeyBuf.join("_"),
            annotationStorageSerializable,
            modifiedIds
          };
        }
        destroy() {
          if (this.destroyCapability) {
            return this.destroyCapability.promise;
          }
          this.destroyed = true;
          this.destroyCapability = Promise.withResolvers();
          __privateGet(this, _passwordCapability)?.reject(new Error("Worker was destroyed during onPassword callback"));
          const waitOn = [];
          for (const page of __privateGet(this, _pageCache).values()) {
            waitOn.push(page._destroy());
          }
          __privateGet(this, _pageCache).clear();
          __privateGet(this, _pagePromises).clear();
          __privateGet(this, _pageRefCache).clear();
          if (Object.hasOwn(this, "annotationStorage")) {
            this.annotationStorage.resetModified();
          }
          const terminated = this.messageHandler.sendWithPromise("Terminate", null);
          waitOn.push(terminated);
          Promise.all(waitOn).then(() => {
            this.commonObjs.clear();
            this.fontLoader.clear();
            __privateGet(this, _methodPromises).clear();
            this.filterFactory.destroy();
            TextLayer.cleanup();
            __privateGet(this, _networkStream)?.cancelAllRequests(new AbortException("Worker was terminated."));
            this.messageHandler?.destroy();
            this.messageHandler = null;
            this.destroyCapability.resolve();
          }, this.destroyCapability.reject);
          return this.destroyCapability.promise;
        }
        setupMessageHandler() {
          const {
            messageHandler,
            loadingTask
          } = this;
          messageHandler.on("GetReader", (data, sink) => {
            assert(__privateGet(this, _networkStream), "GetReader - no `BasePDFStream` instance available.");
            __privateSet(this, _fullReader, __privateGet(this, _networkStream).getFullReader());
            __privateGet(this, _fullReader).onProgress = (evt) => __privateMethod(this, _WorkerTransport_instances, onProgress_fn3).call(this, evt);
            sink.onPull = () => {
              __privateGet(this, _fullReader).read().then(function({
                value,
                done
              }) {
                if (done) {
                  sink.close();
                  return;
                }
                assert(value instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer.");
                sink.enqueue(new Uint8Array(value), 1, [value]);
              }).catch((reason) => {
                sink.error(reason);
              });
            };
            sink.onCancel = (reason) => {
              __privateGet(this, _fullReader).cancel(reason);
              sink.ready.catch((readyReason) => {
                if (this.destroyed) {
                  return;
                }
                throw readyReason;
              });
            };
          });
          messageHandler.on("ReaderHeadersReady", async (data) => {
            await __privateGet(this, _fullReader).headersReady;
            const {
              isStreamingSupported,
              isRangeSupported,
              contentLength
            } = __privateGet(this, _fullReader);
            if (isStreamingSupported && isRangeSupported) {
              __privateGet(this, _fullReader).onProgress = null;
            }
            return {
              isStreamingSupported,
              isRangeSupported,
              contentLength
            };
          });
          messageHandler.on("GetRangeReader", (data, sink) => {
            assert(__privateGet(this, _networkStream), "GetRangeReader - no `BasePDFStream` instance available.");
            const rangeReader = __privateGet(this, _networkStream).getRangeReader(data.begin, data.end);
            if (!rangeReader) {
              sink.close();
              return;
            }
            sink.onPull = () => {
              rangeReader.read().then(function({
                value,
                done
              }) {
                if (done) {
                  sink.close();
                  return;
                }
                assert(value instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer.");
                sink.enqueue(new Uint8Array(value), 1, [value]);
              }).catch((reason) => {
                sink.error(reason);
              });
            };
            sink.onCancel = (reason) => {
              rangeReader.cancel(reason);
              sink.ready.catch((readyReason) => {
                if (this.destroyed) {
                  return;
                }
                throw readyReason;
              });
            };
          });
          messageHandler.on("GetDoc", ({
            pdfInfo
          }) => {
            this.pagesMapper.pagesNumber = pdfInfo.numPages;
            this._numPages = pdfInfo.numPages;
            this._htmlForXfa = pdfInfo.htmlForXfa;
            delete pdfInfo.htmlForXfa;
            loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
          });
          messageHandler.on("DocException", (ex) => {
            loadingTask._capability.reject(wrapReason(ex));
          });
          messageHandler.on("PasswordRequest", (ex) => {
            __privateSet(this, _passwordCapability, Promise.withResolvers());
            try {
              if (!loadingTask.onPassword) {
                throw wrapReason(ex);
              }
              const updatePassword = (password) => {
                if (password instanceof Error) {
                  __privateGet(this, _passwordCapability).reject(password);
                } else {
                  __privateGet(this, _passwordCapability).resolve({
                    password
                  });
                }
              };
              loadingTask.onPassword(updatePassword, ex.code);
            } catch (err) {
              __privateGet(this, _passwordCapability).reject(err);
            }
            return __privateGet(this, _passwordCapability).promise;
          });
          messageHandler.on("DataLoaded", (data) => {
            __privateMethod(this, _WorkerTransport_instances, onProgress_fn3).call(this, {
              loaded: data.length,
              total: data.length
            });
            this.downloadInfoCapability.resolve(data);
          });
          messageHandler.on("StartRenderPage", (data) => {
            if (this.destroyed) {
              return;
            }
            const page = __privateGet(this, _pageCache).get(data.pageIndex);
            page._startRenderPage(data.transparency, data.cacheKey);
          });
          messageHandler.on("commonobj", ([id, type, exportedData]) => {
            if (this.destroyed) {
              return null;
            }
            if (this.commonObjs.has(id)) {
              return null;
            }
            switch (type) {
              case "Font":
                if ("error" in exportedData) {
                  const exportedError = exportedData.error;
                  warn(`Error during font loading: ${exportedError}`);
                  this.commonObjs.resolve(id, exportedError);
                  break;
                }
                const fontData = new FontInfo(exportedData);
                const inspectFont = this._params.pdfBug && globalThis.FontInspector?.enabled ? (font2, url) => globalThis.FontInspector.fontAdded(font2, url) : null;
                const font = new FontFaceObject(fontData, inspectFont, exportedData.charProcOperatorList, exportedData.extra);
                this.fontLoader.bind(font).catch(() => messageHandler.sendWithPromise("FontFallback", {
                  id
                })).finally(() => {
                  if (!font.fontExtraProperties) {
                    font.clearData();
                  }
                  this.commonObjs.resolve(id, font);
                });
                break;
              case "CopyLocalImage":
                const {
                  imageRef
                } = exportedData;
                assert(imageRef, "The imageRef must be defined.");
                for (const pageProxy of __privateGet(this, _pageCache).values()) {
                  for (const [, data] of pageProxy.objs) {
                    if (data?.ref !== imageRef) {
                      continue;
                    }
                    if (!data.dataLen) {
                      return null;
                    }
                    const copy = structuredClone(data);
                    this.commonObjs.resolve(id, copy);
                    return data.dataLen;
                  }
                }
                break;
              case "FontPath":
                this.commonObjs.resolve(id, new FontPathInfo(exportedData));
                break;
              case "Image":
                this.commonObjs.resolve(id, exportedData);
                break;
              case "Pattern":
                const pattern = new PatternInfo(exportedData);
                this.commonObjs.resolve(id, pattern.getIR());
                break;
              default:
                throw new Error(`Got unknown common object type ${type}`);
            }
            return null;
          });
          messageHandler.on("obj", ([id, pageIndex, type, imageData]) => {
            if (this.destroyed) {
              return;
            }
            const pageProxy = __privateGet(this, _pageCache).get(pageIndex);
            if (pageProxy.objs.has(id)) {
              return;
            }
            if (pageProxy._intentStates.size === 0) {
              imageData?.bitmap?.close();
              return;
            }
            switch (type) {
              case "Image":
              case "Pattern":
                pageProxy.objs.resolve(id, imageData);
                break;
              default:
                throw new Error(`Got unknown object type ${type}`);
            }
          });
          messageHandler.on("DocProgress", (data) => {
            if (this.destroyed) {
              return;
            }
            __privateMethod(this, _WorkerTransport_instances, onProgress_fn3).call(this, data);
          });
          messageHandler.on("FetchBinaryData", async (data) => {
            if (this.destroyed) {
              throw new Error("Worker was destroyed.");
            }
            if (!this.binaryDataFactory) {
              throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");
            }
            return this.binaryDataFactory.fetch(data);
          });
        }
        getData() {
          return this.messageHandler.sendWithPromise("GetData", null);
        }
        saveDocument() {
          if (this.annotationStorage.size <= 0) {
            warn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
          }
          const {
            map: map2,
            transfer
          } = this.annotationStorage.serializable;
          return this.messageHandler.sendWithPromise("SaveDocument", {
            isPureXfa: !!this._htmlForXfa,
            numPages: this._numPages,
            annotationStorage: map2,
            filename: __privateGet(this, _fullReader)?.filename ?? null
          }, transfer).finally(() => {
            this.annotationStorage.resetModified();
          });
        }
        extractPages(pageInfos) {
          const params = {
            pageInfos
          };
          let transfer;
          const ImageBitmapCtor = globalThis.ImageBitmap;
          if (typeof ImageBitmapCtor === "function") {
            const infos = Array.isArray(pageInfos) ? pageInfos : [pageInfos];
            for (const pageInfo of infos) {
              if (pageInfo?.image instanceof ImageBitmapCtor) {
                (transfer || (transfer = [])).push(pageInfo.image);
              }
            }
          }
          if (this.annotationStorage.size > 0) {
            const serialized = this.annotationStorage.serializable;
            let {
              map: map2
            } = serialized;
            if (serialized.transfer?.length) {
              if (transfer) {
                transfer.push(...serialized.transfer);
              } else {
                transfer = serialized.transfer;
              }
            }
            const mapping = this.pagesMapper.getMapping();
            if (mapping) {
              const remapped = /* @__PURE__ */ new Map();
              for (const [k, v] of map2) {
                if (v?.pageIndex !== void 0 && v.pageIndex >= 0 && v.pageIndex < mapping.length) {
                  const sourceIdx = mapping[v.pageIndex] - 1;
                  if (sourceIdx !== v.pageIndex) {
                    remapped.set(k, {
                      ...v,
                      pageIndex: sourceIdx
                    });
                    continue;
                  }
                }
                remapped.set(k, v);
              }
              map2 = remapped;
            }
            params.annotationStorage = map2;
          }
          return this.messageHandler.sendWithPromise("ExtractPages", params, transfer).finally(() => {
            this.annotationStorage.resetModified();
          });
        }
        getPage(pageNumber) {
          if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this.pagesMapper.pagesNumber) {
            return Promise.reject(new Error("Invalid page request."));
          }
          const pageIndex = pageNumber - 1;
          const newPageIndex = this.pagesMapper.getPageId(pageNumber) - 1;
          const cachedPromise = __privateGet(this, _pagePromises).get(pageIndex);
          if (cachedPromise) {
            return cachedPromise;
          }
          const promise = this.messageHandler.sendWithPromise("GetPage", {
            pageIndex: newPageIndex
          }).then((pageInfo) => {
            if (this.destroyed) {
              throw new Error("Transport destroyed");
            }
            if (pageInfo.refStr) {
              __privateGet(this, _pageRefCache).set(pageInfo.refStr, newPageIndex);
            }
            const page = new PDFPageProxy(pageIndex, pageInfo, this, this.pagesMapper, this._params.pdfBug);
            __privateGet(this, _pageCache).set(pageIndex, page);
            return page;
          });
          __privateGet(this, _pagePromises).set(pageIndex, promise);
          return promise;
        }
        async getPageIndex(ref) {
          if (!isRefProxy(ref)) {
            throw new Error("Invalid pageIndex request.");
          }
          const index = await this.messageHandler.sendWithPromise("GetPageIndex", {
            num: ref.num,
            gen: ref.gen
          });
          const pageNumber = this.pagesMapper.getPageNumber(index + 1);
          if (pageNumber === 0) {
            throw new Error("GetPageIndex: page has been removed.");
          }
          return pageNumber - 1;
        }
        getAnnotations(pageIndex, intent) {
          return this.messageHandler.sendWithPromise("GetAnnotations", {
            pageIndex: this.pagesMapper.getPageId(pageIndex + 1) - 1,
            intent
          });
        }
        getFieldObjects() {
          return __privateMethod(this, _WorkerTransport_instances, cacheSimpleMethod_fn).call(this, "GetFieldObjects");
        }
        getSignatures() {
          return __privateMethod(this, _WorkerTransport_instances, cacheSimpleMethod_fn).call(this, "GetSignatures");
        }
        getSignatureData(id) {
          return this.messageHandler.sendWithPromise("GetSignatureData", id);
        }
        hasJSActions() {
          return __privateMethod(this, _WorkerTransport_instances, cacheSimpleMethod_fn).call(this, "HasJSActions");
        }
        getCalculationOrderIds() {
          return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
        }
        getDestinations() {
          return this.messageHandler.sendWithPromise("GetDestinations", null);
        }
        getDestination(id) {
          if (typeof id !== "string") {
            return Promise.reject(new Error("Invalid destination request."));
          }
          return this.messageHandler.sendWithPromise("GetDestination", {
            id
          });
        }
        getPageLabels() {
          return this.messageHandler.sendWithPromise("GetPageLabels", null);
        }
        getPageLayout() {
          return this.messageHandler.sendWithPromise("GetPageLayout", null);
        }
        getPageMode() {
          return this.messageHandler.sendWithPromise("GetPageMode", null);
        }
        getViewerPreferences() {
          return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
        }
        getOpenAction() {
          return this.messageHandler.sendWithPromise("GetOpenAction", null);
        }
        getAttachments() {
          return this.messageHandler.sendWithPromise("GetAttachments", null);
        }
        getAttachmentContent(id) {
          return this.messageHandler.sendWithPromise("GetAttachmentContent", id);
        }
        getAnnotationsByType(types, pageIndexesToSkip) {
          return this.messageHandler.sendWithPromise("GetAnnotationsByType", {
            types,
            pageIndexesToSkip
          });
        }
        getDocJSActions() {
          return __privateMethod(this, _WorkerTransport_instances, cacheSimpleMethod_fn).call(this, "GetDocJSActions");
        }
        getPageJSActions(pageIndex) {
          return this.messageHandler.sendWithPromise("GetPageJSActions", {
            pageIndex: this.pagesMapper.getPageId(pageIndex + 1) - 1
          });
        }
        getStructTree(pageIndex) {
          return this.messageHandler.sendWithPromise("GetStructTree", {
            pageIndex: this.pagesMapper.getPageId(pageIndex + 1) - 1
          });
        }
        getOutline() {
          return this.messageHandler.sendWithPromise("GetOutline", null);
        }
        getOptionalContentConfig(renderingIntent) {
          return __privateMethod(this, _WorkerTransport_instances, cacheSimpleMethod_fn).call(this, "GetOptionalContentConfig").then((data) => new OptionalContentConfig(data, renderingIntent));
        }
        getPermissions() {
          return this.messageHandler.sendWithPromise("GetPermissions", null);
        }
        getMetadata() {
          const name = "GetMetadata";
          return __privateGet(this, _methodPromises).getOrInsertComputed(name, () => this.messageHandler.sendWithPromise(name, null).then((results) => ({
            info: results[0],
            metadata: results[1] ? new Metadata(results[1]) : null,
            contentDispositionFilename: __privateGet(this, _fullReader)?.filename ?? null,
            contentLength: __privateGet(this, _fullReader)?.contentLength ?? null,
            hasStructTree: results[2]
          })));
        }
        getMarkInfo() {
          return this.messageHandler.sendWithPromise("GetMarkInfo", null);
        }
        getRawData(data) {
          return this.messageHandler.sendWithPromise("GetRawData", data);
        }
        async startCleanup(keepLoadedFonts = false) {
          if (this.destroyed) {
            return;
          }
          await this.messageHandler.sendWithPromise("Cleanup", null);
          for (const page of __privateGet(this, _pageCache).values()) {
            const cleanupSuccessful = page.cleanup();
            if (!cleanupSuccessful) {
              throw new Error(`startCleanup: Page ${page.pageNumber} is currently rendering.`);
            }
          }
          this.commonObjs.clear();
          if (!keepLoadedFonts) {
            this.fontLoader.clear();
          }
          __privateGet(this, _methodPromises).clear();
          this.filterFactory.destroy(true);
          TextLayer.cleanup();
        }
        cachedPageNumber(ref) {
          if (!isRefProxy(ref)) {
            return null;
          }
          const refStr = ref.gen === 0 ? `${ref.num}R` : `${ref.num}R${ref.gen}`;
          const pageIndex = __privateGet(this, _pageRefCache).get(refStr);
          if (pageIndex >= 0) {
            const pageNumber = this.pagesMapper.getPageNumber(pageIndex + 1);
            if (pageNumber !== 0) {
              return pageNumber;
            }
          }
          return null;
        }
      };
      _fullReader = new WeakMap();
      _methodPromises = new WeakMap();
      _networkStream = new WeakMap();
      _pageCache = new WeakMap();
      _pagePromises = new WeakMap();
      _pageRefCache = new WeakMap();
      _passwordCapability = new WeakMap();
      _WorkerTransport_instances = new WeakSet();
      cacheSimpleMethod_fn = function(name, data = null) {
        return __privateGet(this, _methodPromises).getOrInsertComputed(name, () => this.messageHandler.sendWithPromise(name, data));
      };
      onProgress_fn3 = function({
        loaded,
        total
      }) {
        this.loadingTask.onProgress?.({
          loaded,
          total,
          percent: total ? MathClamp(Math.round(loaded / total * 100), 0, 100) : NaN
        });
      };
      RenderTask = class {
        constructor(internalRenderTask) {
          __publicField(this, "_internalRenderTask", null);
          __publicField(this, "onContinue", null);
          __publicField(this, "onError", null);
          this._internalRenderTask = internalRenderTask;
        }
        get promise() {
          return this._internalRenderTask.capability.promise;
        }
        cancel(extraDelay = 0) {
          this._internalRenderTask.cancel(null, extraDelay);
        }
        get separateAnnots() {
          const {
            separateAnnots
          } = this._internalRenderTask.operatorList;
          if (!separateAnnots) {
            return false;
          }
          const {
            annotationCanvasMap
          } = this._internalRenderTask;
          return separateAnnots.form || separateAnnots.canvas && annotationCanvasMap?.size > 0;
        }
        get imageCoordinates() {
          return this._internalRenderTask.imageCoordinates || null;
        }
      };
      _InternalRenderTask = class _InternalRenderTask {
        constructor({
          callback,
          params,
          objs,
          commonObjs,
          annotationCanvasMap,
          operatorList,
          pageIndex,
          canvasFactory,
          filterFactory,
          useRequestAnimationFrame = false,
          pdfBug = false,
          pageColors = null,
          enableHWA = false,
          operationsFilter = null
        }) {
          __privateAdd(this, _rAF, null);
          this.callback = callback;
          this.params = params;
          this.objs = objs;
          this.commonObjs = commonObjs;
          this.annotationCanvasMap = annotationCanvasMap;
          this.operatorListIdx = null;
          this.operatorList = operatorList;
          this._pageIndex = pageIndex;
          this.canvasFactory = canvasFactory;
          this.filterFactory = filterFactory;
          this._pdfBug = pdfBug;
          this.pageColors = pageColors;
          this.running = false;
          this.graphicsReadyCallback = null;
          this.graphicsReady = false;
          this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined";
          this.cancelled = false;
          this.capability = Promise.withResolvers();
          this.task = new RenderTask(this);
          this._cancelBound = this.cancel.bind(this);
          this._continueBound = this._continue.bind(this);
          this._scheduleNextBound = this._scheduleNext.bind(this);
          this._nextBound = this._next.bind(this);
          this._canvas = params.canvas;
          this._canvasContext = params.canvas ? null : params.canvasContext;
          this._enableHWA = enableHWA;
          this._dependencyTracker = params.dependencyTracker;
          this._imagesTracker = params.imagesTracker;
          this._operationsFilter = operationsFilter;
        }
        get completed() {
          return this.capability.promise.catch(function() {
          });
        }
        initializeGraphics({
          transparency = false,
          optionalContentConfig
        }) {
          if (this.cancelled) {
            return;
          }
          if (this._canvas) {
            if (__privateGet(_InternalRenderTask, _canvasInUse).has(this._canvas)) {
              throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");
            }
            __privateGet(_InternalRenderTask, _canvasInUse).add(this._canvas);
          }
          if (this._pdfBug && globalThis.StepperManager?.enabled) {
            this.stepper = globalThis.StepperManager.create(this._pageIndex);
            this.stepper.init(this.operatorList);
            this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
          }
          const {
            viewport,
            transform,
            background,
            dependencyTracker,
            imagesTracker
          } = this.params;
          const canvasContext = this._canvasContext || this._canvas.getContext("2d", {
            alpha: false,
            willReadFrequently: !this._enableHWA
          });
          this.gfx = new CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
            optionalContentConfig
          }, this.annotationCanvasMap, this.pageColors, dependencyTracker, imagesTracker);
          this.gfx.beginDrawing({
            transform,
            viewport,
            transparency,
            background
          });
          this.operatorListIdx = 0;
          this.graphicsReady = true;
          this.graphicsReadyCallback?.();
        }
        cancel(error = null, extraDelay = 0) {
          this.running = false;
          this.cancelled = true;
          this.gfx?.endDrawing();
          if (__privateGet(this, _rAF)) {
            window.cancelAnimationFrame(__privateGet(this, _rAF));
            __privateSet(this, _rAF, null);
          }
          __privateGet(_InternalRenderTask, _canvasInUse).delete(this._canvas);
          error || (error = new RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, extraDelay));
          this.callback(error);
          this.task.onError?.(error);
        }
        operatorListChanged() {
          if (!this.graphicsReady) {
            this.graphicsReadyCallback || (this.graphicsReadyCallback = this._continueBound);
            return;
          }
          this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length);
          this.stepper?.updateOperatorList(this.operatorList);
          if (this.running) {
            return;
          }
          this._continue();
        }
        _continue() {
          this.running = true;
          if (this.cancelled) {
            return;
          }
          if (this.task.onContinue) {
            this.task.onContinue(this._scheduleNextBound);
          } else {
            this._scheduleNext();
          }
        }
        _scheduleNext() {
          if (this._useRequestAnimationFrame) {
            __privateSet(this, _rAF, window.requestAnimationFrame(() => {
              __privateSet(this, _rAF, null);
              this._nextBound().catch(this._cancelBound);
            }));
          } else {
            Promise.resolve().then(this._nextBound).catch(this._cancelBound);
          }
        }
        async _next() {
          if (this.cancelled) {
            return;
          }
          this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper, this._operationsFilter);
          if (this.operatorListIdx === this.operatorList.argsArray.length) {
            this.running = false;
            if (this.operatorList.lastChunk) {
              this.gfx.endDrawing();
              __privateGet(_InternalRenderTask, _canvasInUse).delete(this._canvas);
              this.callback();
            }
          }
        }
      };
      _rAF = new WeakMap();
      _canvasInUse = new WeakMap();
      __privateAdd(_InternalRenderTask, _canvasInUse, /* @__PURE__ */ new WeakSet());
      InternalRenderTask = _InternalRenderTask;
      version2 = "6.2.108";
      build = "0365cbde0";
      _ColorPicker = class _ColorPicker {
        constructor({
          editor = null,
          uiManager = null
        }) {
          __privateAdd(this, _ColorPicker_instances);
          __privateAdd(this, _button, null);
          __privateAdd(this, _buttonSwatch, null);
          __privateAdd(this, _defaultColor);
          __privateAdd(this, _dropdown, null);
          __privateAdd(this, _dropdownWasFromKeyboard, false);
          __privateAdd(this, _isMainColorPicker, false);
          __privateAdd(this, _editor4, null);
          __privateAdd(this, _eventBus);
          __privateAdd(this, _openDropdownAC, null);
          __privateAdd(this, _uiManager2, null);
          if (editor) {
            __privateSet(this, _isMainColorPicker, false);
            __privateSet(this, _editor4, editor);
          } else {
            __privateSet(this, _isMainColorPicker, true);
          }
          __privateSet(this, _uiManager2, editor?._uiManager || uiManager);
          __privateSet(this, _eventBus, __privateGet(this, _uiManager2)._eventBus);
          __privateSet(this, _defaultColor, editor?.color?.toUpperCase() || __privateGet(this, _uiManager2)?.highlightColors.values().next().value || "#FFFF98");
          __privateGet(_ColorPicker, _l10nColor) || __privateSet(_ColorPicker, _l10nColor, Object.freeze({
            blue: "pdfjs-editor-colorpicker-blue",
            green: "pdfjs-editor-colorpicker-green",
            pink: "pdfjs-editor-colorpicker-pink",
            red: "pdfjs-editor-colorpicker-red",
            yellow: "pdfjs-editor-colorpicker-yellow"
          }));
        }
        static get _keyboardManager() {
          return shadow(this, "_keyboardManager", new KeyboardManager([[["Escape"], _ColorPicker.prototype._hideDropdownFromKeyboard], [["Space"], _ColorPicker.prototype._colorSelectFromKeyboard], [["ArrowDown", "ArrowRight"], _ColorPicker.prototype._moveToNext], [["ArrowUp", "ArrowLeft"], _ColorPicker.prototype._moveToPrevious], [["Home"], _ColorPicker.prototype._moveToBeginning], [["End"], _ColorPicker.prototype._moveToEnd]]));
        }
        renderButton() {
          const button = __privateSet(this, _button, document.createElement("button"));
          button.className = "colorPicker";
          button.tabIndex = "0";
          button.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-button");
          button.ariaHasPopup = "true";
          if (__privateGet(this, _editor4)) {
            button.ariaControls = `${__privateGet(this, _editor4).id}_colorpicker_dropdown`;
          }
          const signal = __privateGet(this, _uiManager2)._signal;
          button.addEventListener("click", __privateMethod(this, _ColorPicker_instances, openDropdown_fn).bind(this), {
            signal
          });
          button.addEventListener("keydown", __privateMethod(this, _ColorPicker_instances, keyDown_fn).bind(this), {
            signal
          });
          const swatch = __privateSet(this, _buttonSwatch, document.createElement("span"));
          swatch.className = "swatch";
          swatch.ariaHidden = "true";
          swatch.style.backgroundColor = __privateGet(this, _defaultColor);
          button.append(swatch);
          return button;
        }
        renderMainDropdown() {
          const dropdown = __privateSet(this, _dropdown, __privateMethod(this, _ColorPicker_instances, getDropdownRoot_fn).call(this));
          dropdown.ariaOrientation = "horizontal";
          dropdown.ariaLabelledBy = "highlightColorPickerLabel";
          return dropdown;
        }
        _colorSelectFromKeyboard(event) {
          if (event.target === __privateGet(this, _button)) {
            __privateMethod(this, _ColorPicker_instances, openDropdown_fn).call(this, event);
            return;
          }
          const color = event.target.getAttribute("data-color");
          if (!color) {
            return;
          }
          __privateMethod(this, _ColorPicker_instances, colorSelect_fn).call(this, color, event);
        }
        _moveToNext(event) {
          if (!__privateGet(this, _ColorPicker_instances, isDropdownVisible_get)) {
            __privateMethod(this, _ColorPicker_instances, openDropdown_fn).call(this, event);
            return;
          }
          if (event.target === __privateGet(this, _button)) {
            __privateGet(this, _dropdown).firstElementChild?.focus();
            return;
          }
          event.target.nextSibling?.focus();
        }
        _moveToPrevious(event) {
          if (event.target === __privateGet(this, _dropdown)?.firstElementChild || event.target === __privateGet(this, _button)) {
            if (__privateGet(this, _ColorPicker_instances, isDropdownVisible_get)) {
              this._hideDropdownFromKeyboard();
            }
            return;
          }
          if (!__privateGet(this, _ColorPicker_instances, isDropdownVisible_get)) {
            __privateMethod(this, _ColorPicker_instances, openDropdown_fn).call(this, event);
          }
          event.target.previousSibling?.focus();
        }
        _moveToBeginning(event) {
          if (!__privateGet(this, _ColorPicker_instances, isDropdownVisible_get)) {
            __privateMethod(this, _ColorPicker_instances, openDropdown_fn).call(this, event);
            return;
          }
          __privateGet(this, _dropdown).firstElementChild?.focus();
        }
        _moveToEnd(event) {
          if (!__privateGet(this, _ColorPicker_instances, isDropdownVisible_get)) {
            __privateMethod(this, _ColorPicker_instances, openDropdown_fn).call(this, event);
            return;
          }
          __privateGet(this, _dropdown).lastElementChild?.focus();
        }
        hideDropdown() {
          __privateGet(this, _dropdown)?.classList.add("hidden");
          __privateGet(this, _button).ariaExpanded = "false";
          __privateGet(this, _openDropdownAC)?.abort();
          __privateSet(this, _openDropdownAC, null);
        }
        _hideDropdownFromKeyboard() {
          if (__privateGet(this, _isMainColorPicker)) {
            return;
          }
          if (!__privateGet(this, _ColorPicker_instances, isDropdownVisible_get)) {
            __privateGet(this, _editor4)?.unselect();
            return;
          }
          this.hideDropdown();
          __privateGet(this, _button).focus({
            preventScroll: true,
            focusVisible: __privateGet(this, _dropdownWasFromKeyboard)
          });
        }
        updateColor(color) {
          if (__privateGet(this, _buttonSwatch)) {
            __privateGet(this, _buttonSwatch).style.backgroundColor = color;
          }
          if (!__privateGet(this, _dropdown)) {
            return;
          }
          const i = __privateGet(this, _uiManager2).highlightColors.values();
          for (const child of __privateGet(this, _dropdown).children) {
            child.ariaSelected = i.next().value === color.toUpperCase();
          }
        }
        destroy() {
          __privateGet(this, _button)?.remove();
          __privateSet(this, _button, null);
          __privateSet(this, _buttonSwatch, null);
          __privateGet(this, _dropdown)?.remove();
          __privateSet(this, _dropdown, null);
        }
      };
      _button = new WeakMap();
      _buttonSwatch = new WeakMap();
      _defaultColor = new WeakMap();
      _dropdown = new WeakMap();
      _dropdownWasFromKeyboard = new WeakMap();
      _isMainColorPicker = new WeakMap();
      _editor4 = new WeakMap();
      _eventBus = new WeakMap();
      _openDropdownAC = new WeakMap();
      _uiManager2 = new WeakMap();
      _l10nColor = new WeakMap();
      _ColorPicker_instances = new WeakSet();
      getDropdownRoot_fn = function() {
        const div = document.createElement("div");
        const signal = __privateGet(this, _uiManager2)._signal;
        div.addEventListener("contextmenu", noContextMenu, {
          signal
        });
        div.className = "dropdown";
        div.role = "listbox";
        div.ariaMultiSelectable = "false";
        div.ariaOrientation = "vertical";
        div.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-dropdown");
        if (__privateGet(this, _editor4)) {
          div.id = `${__privateGet(this, _editor4).id}_colorpicker_dropdown`;
        }
        for (const [name, color] of __privateGet(this, _uiManager2).highlightColors) {
          const button = document.createElement("button");
          button.tabIndex = "0";
          button.role = "option";
          button.setAttribute("data-color", color);
          button.title = name;
          button.setAttribute("data-l10n-id", __privateGet(_ColorPicker, _l10nColor)[name]);
          const swatch = document.createElement("span");
          button.append(swatch);
          swatch.className = "swatch";
          swatch.style.backgroundColor = color;
          button.ariaSelected = color === __privateGet(this, _defaultColor);
          button.addEventListener("click", __privateMethod(this, _ColorPicker_instances, colorSelect_fn).bind(this, color), {
            signal
          });
          div.append(button);
        }
        div.addEventListener("keydown", __privateMethod(this, _ColorPicker_instances, keyDown_fn).bind(this), {
          signal
        });
        return div;
      };
      colorSelect_fn = function(color, event) {
        event.stopPropagation();
        __privateGet(this, _eventBus).dispatch("switchannotationeditorparams", {
          source: this,
          type: AnnotationEditorParamsType.HIGHLIGHT_COLOR,
          value: color
        });
        this.updateColor(color);
      };
      keyDown_fn = function(event) {
        _ColorPicker._keyboardManager.exec(this, event);
      };
      openDropdown_fn = function(event) {
        if (__privateGet(this, _ColorPicker_instances, isDropdownVisible_get)) {
          this.hideDropdown();
          return;
        }
        __privateSet(this, _dropdownWasFromKeyboard, event.detail === 0);
        if (!__privateGet(this, _openDropdownAC)) {
          __privateSet(this, _openDropdownAC, new AbortController());
          window.addEventListener("pointerdown", __privateMethod(this, _ColorPicker_instances, pointerDown_fn2).bind(this), {
            signal: __privateGet(this, _uiManager2).combinedSignal(__privateGet(this, _openDropdownAC))
          });
        }
        __privateGet(this, _button).ariaExpanded = "true";
        if (__privateGet(this, _dropdown)) {
          __privateGet(this, _dropdown).classList.remove("hidden");
          return;
        }
        const root3 = __privateSet(this, _dropdown, __privateMethod(this, _ColorPicker_instances, getDropdownRoot_fn).call(this));
        __privateGet(this, _button).append(root3);
      };
      pointerDown_fn2 = function(event) {
        if (__privateGet(this, _dropdown)?.contains(event.target)) {
          return;
        }
        this.hideDropdown();
      };
      isDropdownVisible_get = function() {
        return __privateGet(this, _dropdown) && !__privateGet(this, _dropdown).classList.contains("hidden");
      };
      __privateAdd(_ColorPicker, _l10nColor, null);
      ColorPicker = _ColorPicker;
      _BasicColorPicker = class _BasicColorPicker {
        constructor(editor) {
          __privateAdd(this, _input, null);
          __privateAdd(this, _hasAlpha, false);
          __privateAdd(this, _editor5, null);
          __privateAdd(this, _uiManager3, null);
          __privateSet(this, _editor5, editor);
          __privateSet(this, _uiManager3, editor._uiManager);
          __privateGet(_BasicColorPicker, _l10nColor2) || __privateSet(_BasicColorPicker, _l10nColor2, Object.freeze({
            freetext: "pdfjs-editor-color-picker-free-text-input",
            ink: "pdfjs-editor-color-picker-ink-input"
          }));
        }
        renderButton() {
          if (__privateGet(this, _input)) {
            return __privateGet(this, _input);
          }
          const {
            editorType,
            colorType,
            colorAndOpacityType,
            opacityType,
            color,
            opacity
          } = __privateGet(this, _editor5);
          const hasAlpha = __privateSet(this, _hasAlpha, FeatureTest.isAlphaColorInputSupported && opacityType !== void 0);
          const input = __privateSet(this, _input, document.createElement("input"));
          input.type = "color";
          if (hasAlpha) {
            input.setAttribute("alpha", "");
            const alphaHex = Util.hexNums[Math.round((opacity ?? 1) * 255)];
            input.value = (color || "#000000") + alphaHex;
          } else {
            input.value = color || "#000000";
          }
          input.className = "basicColorPicker";
          input.tabIndex = 0;
          input.setAttribute("data-l10n-id", __privateGet(_BasicColorPicker, _l10nColor2)[editorType]);
          input.addEventListener("input", () => {
            if (hasAlpha) {
              const rgba = getRGBA(input.value);
              if (!rgba) {
                return;
              }
              const [r, g, b, op] = rgba;
              const hex = Util.makeHexColor(r, g, b);
              if (colorAndOpacityType !== void 0) {
                __privateGet(this, _uiManager3).updateParams(colorAndOpacityType, {
                  color: hex,
                  opacity: op
                });
              } else {
                __privateGet(this, _uiManager3).updateParams(colorType, hex);
                __privateGet(this, _uiManager3).updateParams(opacityType, op);
              }
            } else {
              __privateGet(this, _uiManager3).updateParams(colorType, input.value);
            }
          }, {
            signal: __privateGet(this, _uiManager3)._signal
          });
          return input;
        }
        update(value) {
          if (!__privateGet(this, _input)) {
            return;
          }
          if (__privateGet(this, _hasAlpha)) {
            const alphaHex = Util.hexNums[Math.round(__privateGet(this, _editor5).opacity * 255)];
            __privateGet(this, _input).value = value + alphaHex;
          } else {
            __privateGet(this, _input).value = value;
          }
        }
        updateOpacity(value) {
          if (!__privateGet(this, _input) || !__privateGet(this, _hasAlpha)) {
            return;
          }
          const alphaHex = Util.hexNums[Math.round(value * 255)];
          __privateGet(this, _input).value = __privateGet(this, _editor5).color + alphaHex;
        }
        destroy() {
          __privateGet(this, _input)?.remove();
          __privateSet(this, _input, null);
        }
        hideDropdown() {
        }
      };
      _input = new WeakMap();
      _hasAlpha = new WeakMap();
      _editor5 = new WeakMap();
      _uiManager3 = new WeakMap();
      _l10nColor2 = new WeakMap();
      __privateAdd(_BasicColorPicker, _l10nColor2, null);
      BasicColorPicker = _BasicColorPicker;
      ColorConverters = class {
        static CMYK_G([c, y, m, k]) {
          return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
        }
        static G_CMYK([g]) {
          return ["CMYK", 0, 0, 0, 1 - g];
        }
        static G_RGB([g]) {
          return ["RGB", g, g, g];
        }
        static G_rgb([g]) {
          g = scaleAndClamp(g);
          return [g, g, g];
        }
        static G_HTML([g]) {
          const G = makeColorComp(g);
          return `#${G}${G}${G}`;
        }
        static RGB_G([r, g, b]) {
          return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
        }
        static RGB_rgb(color) {
          return color.map(scaleAndClamp);
        }
        static RGB_HTML(color) {
          return `#${color.map(makeColorComp).join("")}`;
        }
        static T_HTML() {
          return "#00000000";
        }
        static T_rgb() {
          return [null];
        }
        static CMYK_RGB([c, y, m, k]) {
          return ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];
        }
        static CMYK_rgb([c, y, m, k]) {
          return [scaleAndClamp(1 - Math.min(1, c + k)), scaleAndClamp(1 - Math.min(1, m + k)), scaleAndClamp(1 - Math.min(1, y + k))];
        }
        static CMYK_HTML(components) {
          const rgb = this.CMYK_RGB(components).slice(1);
          return this.RGB_HTML(rgb);
        }
        static RGB_CMYK([r, g, b]) {
          const c = 1 - r;
          const m = 1 - g;
          const y = 1 - b;
          const k = Math.min(c, m, y);
          return ["CMYK", c, m, y, k];
        }
      };
      BaseSVGFactory = class {
        create(width, height, skipDimensions = false) {
          if (width <= 0 || height <= 0) {
            throw new Error("Invalid SVG dimensions");
          }
          const svg = this._createSVG("svg:svg");
          svg.setAttribute("version", "1.1");
          if (!skipDimensions) {
            svg.setAttribute("width", `${width}px`);
            svg.setAttribute("height", `${height}px`);
          }
          svg.setAttribute("preserveAspectRatio", "none");
          svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
          return svg;
        }
        createElement(type) {
          if (typeof type !== "string") {
            throw new Error("Invalid SVG element type");
          }
          return this._createSVG(type);
        }
        _createSVG(type) {
          unreachable("Abstract method `_createSVG` called.");
        }
      };
      DOMSVGFactory = class extends BaseSVGFactory {
        _createSVG(type) {
          return document.createElementNS(SVG_NS, type);
        }
      };
      annotation_layer_DEFAULT_FONT_SIZE = 9;
      GetElementsByNameSet = /* @__PURE__ */ new WeakSet();
      TIMEZONE_OFFSET = (/* @__PURE__ */ new Date()).getTimezoneOffset() * 60 * 1e3;
      AnnotationElementFactory = class {
        static create(parameters) {
          const subtype = parameters.data.annotationType;
          switch (subtype) {
            case AnnotationType.LINK:
              return new LinkAnnotationElement(parameters);
            case AnnotationType.TEXT:
              return new TextAnnotationElement(parameters);
            case AnnotationType.WIDGET:
              const fieldType = parameters.data.fieldType;
              switch (fieldType) {
                case "Tx":
                  return new TextWidgetAnnotationElement(parameters);
                case "Btn":
                  if (parameters.data.radioButton) {
                    return new RadioButtonWidgetAnnotationElement(parameters);
                  } else if (parameters.data.checkBox) {
                    return new CheckboxWidgetAnnotationElement(parameters);
                  }
                  return new PushButtonWidgetAnnotationElement(parameters);
                case "Ch":
                  return new ChoiceWidgetAnnotationElement(parameters);
                case "Sig":
                  return new SignatureWidgetAnnotationElement(parameters);
              }
              return new WidgetAnnotationElement(parameters);
            case AnnotationType.POPUP:
              return new PopupAnnotationElement(parameters);
            case AnnotationType.FREETEXT:
              return new FreeTextAnnotationElement(parameters);
            case AnnotationType.LINE:
              return new LineAnnotationElement(parameters);
            case AnnotationType.SQUARE:
              return new SquareAnnotationElement(parameters);
            case AnnotationType.CIRCLE:
              return new CircleAnnotationElement(parameters);
            case AnnotationType.POLYLINE:
              return new PolylineAnnotationElement(parameters);
            case AnnotationType.CARET:
              return new CaretAnnotationElement(parameters);
            case AnnotationType.INK:
              return new InkAnnotationElement(parameters);
            case AnnotationType.POLYGON:
              return new PolygonAnnotationElement(parameters);
            case AnnotationType.HIGHLIGHT:
              return new HighlightAnnotationElement(parameters);
            case AnnotationType.UNDERLINE:
              return new UnderlineAnnotationElement(parameters);
            case AnnotationType.SQUIGGLY:
              return new SquigglyAnnotationElement(parameters);
            case AnnotationType.STRIKEOUT:
              return new StrikeOutAnnotationElement(parameters);
            case AnnotationType.STAMP:
              return new StampAnnotationElement(parameters);
            case AnnotationType.FILEATTACHMENT:
              return new FileAttachmentAnnotationElement(parameters);
            case AnnotationType.RICHMEDIA:
            case AnnotationType.SCREEN:
            case AnnotationType.SOUND:
              return new MediaAnnotationElement(parameters);
            default:
              return new AnnotationElement(parameters);
          }
        }
      };
      _AnnotationElement = class _AnnotationElement {
        constructor(parameters, {
          isRenderable = false,
          ignoreBorder = false,
          createQuadrilaterals = false
        } = {}) {
          __privateAdd(this, _AnnotationElement_instances);
          __privateAdd(this, _updates, null);
          __privateAdd(this, _hasBorder, false);
          __privateAdd(this, _popupElement, null);
          this.isRenderable = isRenderable;
          this.data = parameters.data;
          this.layer = parameters.layer;
          this.linkService = parameters.linkService;
          this.downloadManager = parameters.downloadManager;
          this.imageResourcesPath = parameters.imageResourcesPath;
          this.renderForms = parameters.renderForms;
          this.svgFactory = parameters.svgFactory;
          this.annotationStorage = parameters.annotationStorage;
          this.enableComment = parameters.enableComment;
          this.enableScripting = parameters.enableScripting;
          this.hasJSActions = parameters.hasJSActions;
          this._fieldObjects = parameters.fieldObjects;
          this.parent = parameters.parent;
          this.hasOwnCommentButton = false;
          if (isRenderable) {
            this.contentElement = this.container = this._createContainer(ignoreBorder);
          }
          if (createQuadrilaterals) {
            this._createQuadrilaterals();
          }
        }
        static _hasPopupData({
          contentsObj,
          richText
        }) {
          return !!(contentsObj?.str || richText?.str);
        }
        get _isEditable() {
          return this.data.isEditable;
        }
        get hasPopupData() {
          return _AnnotationElement._hasPopupData(this.data) || this.enableComment && !!this.commentText;
        }
        get commentData() {
          const {
            data
          } = this;
          const editor = this.annotationStorage?.getEditor(data.id);
          if (editor) {
            return editor.getData();
          }
          return data;
        }
        get hasCommentButton() {
          return this.enableComment && this.hasPopupElement;
        }
        get commentButtonPosition() {
          const editor = this.annotationStorage?.getEditor(this.data.id);
          if (editor) {
            return editor.commentButtonPositionInPage;
          }
          const {
            quadPoints,
            inkLists,
            rect
          } = this.data;
          let maxX = -Infinity;
          let maxY = -Infinity;
          if (quadPoints?.length >= 8) {
            for (let i = 0; i < quadPoints.length; i += 8) {
              if (quadPoints[i + 1] > maxY) {
                maxY = quadPoints[i + 1];
                maxX = quadPoints[i + 2];
              } else if (quadPoints[i + 1] === maxY) {
                maxX = Math.max(maxX, quadPoints[i + 2]);
              }
            }
            return [maxX, maxY];
          }
          if (inkLists?.length >= 1) {
            for (const inkList of inkLists) {
              for (let i = 0, ii = inkList.length; i < ii; i += 2) {
                if (inkList[i + 1] > maxY) {
                  maxY = inkList[i + 1];
                  maxX = inkList[i];
                } else if (inkList[i + 1] === maxY) {
                  maxX = Math.max(maxX, inkList[i]);
                }
              }
            }
            if (maxX !== Infinity) {
              return [maxX, maxY];
            }
          }
          if (rect) {
            return [rect[2], rect[3]];
          }
          return null;
        }
        _normalizePoint(point) {
          const {
            page: {
              view
            },
            viewport: {
              rawDims: {
                pageWidth,
                pageHeight,
                pageX,
                pageY
              }
            }
          } = this.parent;
          point[1] = view[3] - point[1] + view[1];
          point[0] = 100 * (point[0] - pageX) / pageWidth;
          point[1] = 100 * (point[1] - pageY) / pageHeight;
          return point;
        }
        get commentText() {
          const {
            data
          } = this;
          return this.annotationStorage.getRawValue(`${AnnotationEditorPrefix}${data.id}`)?.popup?.contents || data.contentsObj?.str || "";
        }
        set commentText(text) {
          const {
            data
          } = this;
          const popup = {
            deleted: !text,
            contents: text || ""
          };
          if (!this.annotationStorage.updateEditor(data.id, {
            popup
          })) {
            this.annotationStorage.setValue(`${AnnotationEditorPrefix}${data.id}`, {
              id: data.id,
              annotationType: data.annotationType,
              page: this.parent.page,
              popup,
              popupRef: data.popupRef,
              modificationDate: /* @__PURE__ */ new Date()
            });
          }
          if (!text) {
            this.removePopup();
          }
        }
        removePopup() {
          (__privateGet(this, _popupElement)?.popup || this.popup)?.remove();
          __privateSet(this, _popupElement, this.popup = null);
        }
        updateEdited(params) {
          if (!this.container) {
            return;
          }
          if (params.rect) {
            __privateGet(this, _updates) || __privateSet(this, _updates, {
              rect: this.data.rect.slice(0)
            });
          }
          const {
            rect,
            popup: newPopup
          } = params;
          if (rect) {
            __privateMethod(this, _AnnotationElement_instances, setRectEdited_fn).call(this, rect);
          }
          let popup = __privateGet(this, _popupElement)?.popup || this.popup;
          if (!popup && newPopup?.text) {
            this._createPopup(newPopup);
            popup = __privateGet(this, _popupElement).popup;
          }
          if (!popup) {
            return;
          }
          popup.updateEdited(params);
          if (newPopup?.deleted) {
            popup.remove();
            __privateSet(this, _popupElement, null);
            this.popup = null;
          }
        }
        resetEdited() {
          if (!__privateGet(this, _updates)) {
            return;
          }
          __privateMethod(this, _AnnotationElement_instances, setRectEdited_fn).call(this, __privateGet(this, _updates).rect);
          __privateGet(this, _popupElement)?.popup.resetEdited();
          __privateSet(this, _updates, null);
        }
        _createContainer(ignoreBorder) {
          const {
            data,
            parent: {
              page,
              viewport
            }
          } = this;
          const container = document.createElement("section");
          container.setAttribute("data-annotation-id", data.id);
          if (!(this instanceof WidgetAnnotationElement) && !(this instanceof LinkAnnotationElement) && !(this instanceof MediaAnnotationElement)) {
            container.tabIndex = 0;
          }
          const {
            style
          } = container;
          style.zIndex = this.parent.zIndex;
          this.parent.zIndex += 2;
          if (data.alternativeText) {
            container.title = data.alternativeText;
          }
          if (data.noRotate) {
            container.classList.add("norotate");
          }
          if (!data.rect || this instanceof PopupAnnotationElement) {
            const {
              rotation: rotation2
            } = data;
            if (!data.hasOwnCanvas && rotation2 !== 0) {
              this.setRotation(rotation2, container);
            }
            return container;
          }
          const {
            width,
            height
          } = this;
          if (!ignoreBorder && data.borderStyle.width > 0) {
            style.borderWidth = `${data.borderStyle.width}px`;
            const horizontalRadius = data.borderStyle.horizontalCornerRadius;
            const verticalRadius = data.borderStyle.verticalCornerRadius;
            if (horizontalRadius > 0 || verticalRadius > 0) {
              const radius = `calc(${horizontalRadius}px * var(--total-scale-factor)) / calc(${verticalRadius}px * var(--total-scale-factor))`;
              style.borderRadius = radius;
            }
            switch (data.borderStyle.style) {
              case AnnotationBorderStyleType.SOLID:
                style.borderStyle = "solid";
                break;
              case AnnotationBorderStyleType.DASHED:
                style.borderStyle = "dashed";
                break;
              case AnnotationBorderStyleType.BEVELED:
                warn("Unimplemented border style: beveled");
                break;
              case AnnotationBorderStyleType.INSET:
                warn("Unimplemented border style: inset");
                break;
              case AnnotationBorderStyleType.UNDERLINE:
                style.borderBottomStyle = "solid";
                break;
              default:
                break;
            }
            const borderColor = data.borderColor || null;
            if (borderColor) {
              __privateSet(this, _hasBorder, true);
              style.borderColor = Util.makeHexColor(...borderColor);
            } else {
              style.borderWidth = 0;
            }
          }
          const rect = Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
          const {
            pageWidth,
            pageHeight,
            pageX,
            pageY
          } = viewport.rawDims;
          style.left = `${100 * (rect[0] - pageX) / pageWidth}%`;
          style.top = `${100 * (rect[1] - pageY) / pageHeight}%`;
          const {
            rotation
          } = data;
          if (data.hasOwnCanvas || rotation === 0) {
            style.width = `${100 * width / pageWidth}%`;
            style.height = `${100 * height / pageHeight}%`;
          } else {
            this.setRotation(rotation, container);
          }
          return container;
        }
        setRotation(angle, container = this.container) {
          if (!this.data.rect) {
            return;
          }
          const {
            pageWidth,
            pageHeight
          } = this.parent.viewport.rawDims;
          let {
            width,
            height
          } = this;
          if (angle % 180 !== 0) {
            [width, height] = [height, width];
          }
          container.style.width = `${100 * width / pageWidth}%`;
          container.style.height = `${100 * height / pageHeight}%`;
          container.setAttribute("data-main-rotation", (360 - angle) % 360);
        }
        get _commonActions() {
          const setColor = (jsName, styleName, event) => {
            const color = event.detail[jsName];
            const colorType = color[0];
            const colorArray = color.slice(1);
            event.target.style[styleName] = ColorConverters[`${colorType}_HTML`](colorArray);
            this.annotationStorage.setValue(this.data.id, {
              [styleName]: ColorConverters[`${colorType}_rgb`](colorArray)
            });
          };
          return shadow(this, "_commonActions", {
            display: (event) => {
              const {
                display
              } = event.detail;
              const hidden = display % 2 === 1;
              this.container.style.visibility = hidden ? "hidden" : "visible";
              this.annotationStorage.setValue(this.data.id, {
                noView: hidden,
                noPrint: display === 1 || display === 2
              });
            },
            print: (event) => {
              this.annotationStorage.setValue(this.data.id, {
                noPrint: !event.detail.print
              });
            },
            hidden: (event) => {
              const {
                hidden
              } = event.detail;
              this.container.style.visibility = hidden ? "hidden" : "visible";
              this.annotationStorage.setValue(this.data.id, {
                noPrint: hidden,
                noView: hidden
              });
            },
            focus: (event) => {
              setTimeout(() => event.target.focus({
                preventScroll: false
              }), 0);
            },
            userName: (event) => {
              event.target.title = event.detail.userName;
            },
            readonly: (event) => {
              event.target.disabled = event.detail.readonly;
            },
            required: (event) => {
              this._setRequired(event.target, event.detail.required);
            },
            bgColor: (event) => {
              setColor("bgColor", "backgroundColor", event);
            },
            fillColor: (event) => {
              setColor("fillColor", "backgroundColor", event);
            },
            fgColor: (event) => {
              setColor("fgColor", "color", event);
            },
            textColor: (event) => {
              setColor("textColor", "color", event);
            },
            borderColor: (event) => {
              setColor("borderColor", "borderColor", event);
            },
            strokeColor: (event) => {
              setColor("strokeColor", "borderColor", event);
            },
            rotation: (event) => {
              const angle = event.detail.rotation;
              this.setRotation(angle);
              this.annotationStorage.setValue(this.data.id, {
                rotation: angle
              });
            }
          });
        }
        _dispatchEventFromSandbox(actions, jsEvent) {
          const commonActions = this._commonActions;
          for (const name of Object.keys(jsEvent.detail)) {
            const action = actions[name] || commonActions[name];
            action?.(jsEvent);
          }
        }
        _setDefaultPropertiesFromJS(element) {
          if (!this.enableScripting) {
            return;
          }
          const storedData = this.annotationStorage.getRawValue(this.data.id);
          if (!storedData) {
            return;
          }
          const commonActions = this._commonActions;
          for (const [actionName, detail] of Object.entries(storedData)) {
            const action = commonActions[actionName];
            if (action) {
              const eventProxy = {
                detail: {
                  [actionName]: detail
                },
                target: element
              };
              action(eventProxy);
              delete storedData[actionName];
            }
          }
        }
        _createQuadrilaterals() {
          if (!this.container) {
            return;
          }
          const {
            quadPoints
          } = this.data;
          if (!quadPoints) {
            return;
          }
          const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect.map((x) => Math.fround(x));
          if (quadPoints.length === 8) {
            const [trX, trY, blX, blY] = quadPoints.subarray(2, 6);
            if (rectTrX === trX && rectTrY === trY && rectBlX === blX && rectBlY === blY) {
              return;
            }
          }
          const {
            style
          } = this.container;
          let svgBuffer;
          if (__privateGet(this, _hasBorder)) {
            const {
              borderColor,
              borderWidth
            } = style;
            style.borderWidth = 0;
            svgBuffer = ["url('data:image/svg+xml;utf8,", `<svg xmlns="${SVG_NS}" preserveAspectRatio="none" viewBox="0 0 1 1">`, `<g fill="transparent" stroke="${borderColor}" stroke-width="${borderWidth}">`];
            this.container.classList.add("hasBorder");
          }
          const width = rectTrX - rectBlX;
          const height = rectTrY - rectBlY;
          const {
            svgFactory
          } = this;
          const svg = svgFactory.createElement("svg");
          svg.classList.add("quadrilateralsContainer");
          svg.setAttribute("width", 0);
          svg.setAttribute("height", 0);
          svg.role = "none";
          const defs = svgFactory.createElement("defs");
          svg.append(defs);
          const clipPath = svgFactory.createElement("clipPath");
          const id = `clippath_${this.data.id}`;
          clipPath.setAttribute("id", id);
          clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
          defs.append(clipPath);
          for (let i = 2, ii = quadPoints.length; i < ii; i += 8) {
            const trX = quadPoints[i];
            const trY = quadPoints[i + 1];
            const blX = quadPoints[i + 2];
            const blY = quadPoints[i + 3];
            const rect = svgFactory.createElement("rect");
            const x = (blX - rectBlX) / width;
            const y = (rectTrY - trY) / height;
            const rectWidth = (trX - blX) / width;
            const rectHeight = (trY - blY) / height;
            rect.setAttribute("x", x);
            rect.setAttribute("y", y);
            rect.setAttribute("width", rectWidth);
            rect.setAttribute("height", rectHeight);
            clipPath.append(rect);
            svgBuffer?.push(`<rect vector-effect="non-scaling-stroke" x="${x}" y="${y}" width="${rectWidth}" height="${rectHeight}"/>`);
          }
          if (__privateGet(this, _hasBorder)) {
            svgBuffer.push(`</g></svg>')`);
            style.backgroundImage = svgBuffer.join("");
          }
          this.container.append(svg);
          this.container.style.clipPath = `url(#${id})`;
        }
        _createPopup(popupData = null) {
          const {
            data
          } = this;
          let contentsObj, modificationDate;
          if (popupData) {
            contentsObj = {
              str: popupData.text
            };
            modificationDate = popupData.date;
          } else {
            contentsObj = data.contentsObj;
            modificationDate = data.modificationDate;
          }
          __privateSet(this, _popupElement, new PopupAnnotationElement({
            data: {
              color: data.color,
              titleObj: data.titleObj,
              modificationDate,
              contentsObj,
              richText: data.richText,
              parentRect: data.rect,
              borderStyle: 0,
              id: `popup_${data.id}`,
              rotation: data.rotation,
              noRotate: true
            },
            linkService: this.linkService,
            parent: this.parent,
            elements: [this]
          }));
        }
        get hasPopupElement() {
          return !!(__privateGet(this, _popupElement) || this.popup || this.data.popupRef);
        }
        get extraPopupElement() {
          return __privateGet(this, _popupElement);
        }
        render() {
          unreachable("Abstract method `AnnotationElement.render` called");
        }
        _getElementsByName(name, skipId = null) {
          const fields = [];
          if (this._fieldObjects) {
            const fieldObj = this._fieldObjects[name] || [];
            for (const {
              page,
              id,
              exportValues
            } of fieldObj) {
              if (page === -1) {
                continue;
              }
              if (id === skipId) {
                continue;
              }
              const exportValue = typeof exportValues === "string" ? exportValues : null;
              const domElement = document.querySelector(`[data-element-id="${id}"]`);
              if (domElement && !GetElementsByNameSet.has(domElement)) {
                warn(`_getElementsByName - element not allowed: ${id}`);
                continue;
              }
              fields.push({
                id,
                exportValue,
                domElement
              });
            }
            return fields;
          }
          for (const domElement of document.getElementsByName(name)) {
            const {
              exportValue
            } = domElement;
            const id = domElement.getAttribute("data-element-id");
            if (id === skipId) {
              continue;
            }
            if (!GetElementsByNameSet.has(domElement)) {
              continue;
            }
            fields.push({
              id,
              exportValue,
              domElement
            });
          }
          return fields;
        }
        show() {
          if (this.container) {
            this.container.hidden = false;
          }
          this.popup?.maybeShow();
        }
        hide() {
          if (this.container) {
            this.container.hidden = true;
          }
          this.popup?.forceHide();
        }
        getElementsToTriggerPopup() {
          return this.container;
        }
        addHighlightArea() {
          const triggers = this.getElementsToTriggerPopup();
          if (Array.isArray(triggers)) {
            for (const element of triggers) {
              element.classList.add("highlightArea");
            }
          } else {
            triggers.classList.add("highlightArea");
          }
        }
        _editOnDoubleClick() {
          if (!this._isEditable) {
            return;
          }
          const {
            annotationEditorType: mode,
            data: {
              id: editId
            }
          } = this;
          this.container.addEventListener("dblclick", () => {
            this.linkService.eventBus?.dispatch("switchannotationeditormode", {
              source: this,
              mode,
              editId,
              mustEnterInEditMode: true
            });
          });
        }
        updateOC(optionalContentConfig) {
          if (!this.data.oc || !optionalContentConfig) {
            return;
          }
          const isVisible = optionalContentConfig.isVisible(this.data.oc);
          if (isVisible) {
            this.show();
          } else {
            this.hide();
          }
        }
        get width() {
          return this.data.rect[2] - this.data.rect[0];
        }
        get height() {
          return this.data.rect[3] - this.data.rect[1];
        }
        _setBackgroundColor(element) {
          const color = this.data.backgroundColor || null;
          element.style.backgroundColor = color === null ? "transparent" : Util.makeHexColor(...color);
        }
      };
      _updates = new WeakMap();
      _hasBorder = new WeakMap();
      _popupElement = new WeakMap();
      _AnnotationElement_instances = new WeakSet();
      setRectEdited_fn = function(rect) {
        const {
          container: {
            style
          },
          data: {
            rect: currentRect,
            rotation
          },
          parent: {
            viewport: {
              rawDims: {
                pageWidth,
                pageHeight,
                pageX,
                pageY
              }
            }
          }
        } = this;
        currentRect?.splice(0, 4, ...rect);
        style.left = `${100 * (rect[0] - pageX) / pageWidth}%`;
        style.top = `${100 * (pageHeight - rect[3] + pageY) / pageHeight}%`;
        if (rotation === 0) {
          style.width = `${100 * (rect[2] - rect[0]) / pageWidth}%`;
          style.height = `${100 * (rect[3] - rect[1]) / pageHeight}%`;
        } else {
          this.setRotation(rotation);
        }
      };
      AnnotationElement = _AnnotationElement;
      EditorAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
          this.editor = parameters.editor;
        }
        render() {
          this.container.className = "editorAnnotation";
          return this.container;
        }
        createOrUpdatePopup() {
          const {
            editor
          } = this;
          if (!editor.hasComment) {
            return;
          }
          this._createPopup(editor.comment);
        }
        get hasCommentButton() {
          return this.enableComment && this.editor.hasComment;
        }
        get commentButtonPosition() {
          return this.editor.commentButtonPositionInPage;
        }
        get commentText() {
          return this.editor.comment.text;
        }
        set commentText(text) {
          this.editor.comment = text;
          if (!text) {
            this.removePopup();
          }
        }
        get commentData() {
          return this.editor.getData();
        }
        remove() {
          this.parent.removeAnnotation(this.data.id);
          this.container.remove();
          this.container = null;
          this.removePopup();
        }
      };
      LinkAnnotationElement = class extends AnnotationElement {
        constructor(parameters, options = null) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: !!options?.ignoreBorder,
            createQuadrilaterals: true
          });
          __privateAdd(this, _LinkAnnotationElement_instances);
          this.isTooltipOnly = parameters.data.isTooltipOnly;
        }
        render() {
          const {
            data,
            linkService
          } = this;
          const link = document.createElement("a");
          link.setAttribute("data-element-id", data.id);
          let isBound = false;
          if (data.url) {
            linkService.addLinkAttributes(link, data.url, data.newWindow);
            isBound = true;
          } else if (data.action) {
            this._bindNamedAction(link, data.action, data.overlaidText);
            isBound = true;
          } else if (data.attachment) {
            __privateMethod(this, _LinkAnnotationElement_instances, bindAttachment_fn).call(this, link, data.attachmentId, data.attachment, data.overlaidText, data.attachmentDest);
            isBound = true;
          } else if (data.setOCGState) {
            __privateMethod(this, _LinkAnnotationElement_instances, bindSetOCGState_fn).call(this, link, data.setOCGState, data.overlaidText);
            isBound = true;
          } else if (data.dest) {
            this._bindLink(link, data.dest, data.overlaidText);
            isBound = true;
          } else {
            if (data.actions && (data.actions.Action || data.actions["Mouse Up"] || data.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions) {
              this._bindJSAction(link, data);
              isBound = true;
            }
            if (data.resetForm) {
              this._bindResetFormAction(link, data.resetForm);
              isBound = true;
            } else if (this.isTooltipOnly && !isBound) {
              this._bindLink(link, "");
              isBound = true;
            }
          }
          this.container.classList.add("linkAnnotation");
          if (isBound) {
            this.contentElement = link;
            this.container.append(link);
          }
          return this.container;
        }
        _bindLink(link, destination, overlaidText = "") {
          link.href = this.linkService.getDestinationHash(destination);
          link.onclick = () => {
            if (destination) {
              this.linkService.goToDestination(destination);
            }
            return false;
          };
          if (destination || destination === "") {
            __privateMethod(this, _LinkAnnotationElement_instances, setInternalLink_fn).call(this);
          }
          if (overlaidText) {
            link.title = overlaidText;
          }
        }
        _bindNamedAction(link, action, overlaidText = "") {
          link.href = this.linkService.getAnchorUrl("");
          link.onclick = () => {
            this.linkService.executeNamedAction(action);
            return false;
          };
          if (overlaidText) {
            link.title = overlaidText;
          }
          __privateMethod(this, _LinkAnnotationElement_instances, setInternalLink_fn).call(this);
        }
        _bindJSAction(link, data) {
          link.href = this.linkService.getAnchorUrl("");
          const map2 = /* @__PURE__ */ new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
          for (const name of Object.keys(data.actions)) {
            const jsName = map2.get(name);
            if (!jsName) {
              continue;
            }
            link[jsName] = () => {
              this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                source: this,
                detail: {
                  id: data.id,
                  name
                }
              });
              return false;
            };
          }
          if (data.overlaidText) {
            link.title = data.overlaidText;
          }
          link.onclick || (link.onclick = () => false);
          __privateMethod(this, _LinkAnnotationElement_instances, setInternalLink_fn).call(this);
        }
        _bindResetFormAction(link, resetForm) {
          const otherClickAction = link.onclick;
          if (!otherClickAction) {
            link.href = this.linkService.getAnchorUrl("");
          }
          __privateMethod(this, _LinkAnnotationElement_instances, setInternalLink_fn).call(this);
          if (!this._fieldObjects) {
            warn(`_bindResetFormAction - "resetForm" action not supported, ensure that the \`fieldObjects\` parameter is provided.`);
            if (!otherClickAction) {
              link.onclick = () => false;
            }
            return;
          }
          link.onclick = () => {
            otherClickAction?.();
            const {
              fields: resetFormFields,
              refs: resetFormRefs,
              include
            } = resetForm;
            const allFields = [];
            if (resetFormFields.length !== 0 || resetFormRefs.length !== 0) {
              const fieldIds = new Set(resetFormRefs);
              for (const fieldName of resetFormFields) {
                const fields = this._fieldObjects[fieldName] || [];
                for (const {
                  id
                } of fields) {
                  fieldIds.add(id);
                }
              }
              for (const fields of Object.values(this._fieldObjects)) {
                for (const field of fields) {
                  if (fieldIds.has(field.id) === include) {
                    allFields.push(field);
                  }
                }
              }
            } else {
              for (const fields of Object.values(this._fieldObjects)) {
                allFields.push(...fields);
              }
            }
            const storage = this.annotationStorage;
            const allIds = [];
            for (const field of allFields) {
              const {
                id
              } = field;
              allIds.push(id);
              switch (field.type) {
                case "text": {
                  const value = field.defaultValue || "";
                  storage.setValue(id, {
                    value
                  });
                  break;
                }
                case "checkbox":
                case "radiobutton": {
                  const value = field.defaultValue === field.exportValues;
                  storage.setValue(id, {
                    value
                  });
                  break;
                }
                case "combobox":
                case "listbox": {
                  const value = field.defaultValue || "";
                  storage.setValue(id, {
                    value
                  });
                  break;
                }
                default:
                  continue;
              }
              const domElement = document.querySelector(`[data-element-id="${id}"]`);
              if (!domElement) {
                continue;
              } else if (!GetElementsByNameSet.has(domElement)) {
                warn(`_bindResetFormAction - element not allowed: ${id}`);
                continue;
              }
              domElement.dispatchEvent(new Event("resetform"));
            }
            if (this.enableScripting) {
              this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                source: this,
                detail: {
                  id: "app",
                  ids: allIds,
                  name: "ResetForm"
                }
              });
            }
            return false;
          };
        }
      };
      _LinkAnnotationElement_instances = new WeakSet();
      setInternalLink_fn = function() {
        this.container.setAttribute("data-internal-link", "");
      };
      bindAttachment_fn = function(link, attachmentId, attachment, overlaidText = "", dest = null) {
        link.href = this.linkService.getAnchorUrl("");
        if (attachment.description) {
          link.title = attachment.description;
        } else if (overlaidText) {
          link.title = overlaidText;
        }
        const openAttachment = async () => {
          const content = await this.linkService.getAttachmentContent(attachmentId);
          if (content) {
            this.downloadManager?.openOrDownloadData(content, attachment.filename, dest);
          }
        };
        link.onclick = () => {
          openAttachment();
          return false;
        };
        __privateMethod(this, _LinkAnnotationElement_instances, setInternalLink_fn).call(this);
      };
      bindSetOCGState_fn = function(link, action, overlaidText = "") {
        link.href = this.linkService.getAnchorUrl("");
        link.onclick = () => {
          this.linkService.executeSetOCGState(action);
          return false;
        };
        if (overlaidText) {
          link.title = overlaidText;
        }
        __privateMethod(this, _LinkAnnotationElement_instances, setInternalLink_fn).call(this);
      };
      TextAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true
          });
        }
        render() {
          this.container.classList.add("textAnnotation");
          const image = document.createElement("img");
          image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg";
          image.setAttribute("data-l10n-id", "pdfjs-text-annotation-type");
          image.setAttribute("data-l10n-args", JSON.stringify({
            type: this.data.name
          }));
          if (!this.data.popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          this.container.append(image);
          return this.container;
        }
      };
      WidgetAnnotationElement = class extends AnnotationElement {
        render() {
          return this.container;
        }
        _getKeyModifier(event) {
          return FeatureTest.platform.isMac ? event.metaKey : event.ctrlKey;
        }
        _setEventListener(element, elementData, baseName, eventName, valueGetter) {
          if (baseName.includes("mouse")) {
            element.addEventListener(baseName, (event) => {
              this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                source: this,
                detail: {
                  id: this.data.id,
                  name: eventName,
                  value: valueGetter(event),
                  shift: event.shiftKey,
                  modifier: this._getKeyModifier(event)
                }
              });
            });
          } else {
            element.addEventListener(baseName, (event) => {
              if (baseName === "blur") {
                if (!elementData.focused || !event.relatedTarget) {
                  return;
                }
                elementData.focused = false;
              } else if (baseName === "focus") {
                if (elementData.focused) {
                  return;
                }
                elementData.focused = true;
              }
              if (!valueGetter) {
                return;
              }
              this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                source: this,
                detail: {
                  id: this.data.id,
                  name: eventName,
                  value: valueGetter(event)
                }
              });
            });
          }
        }
        _setEventListeners(element, elementData, names, getter) {
          for (const [baseName, eventName] of names) {
            if (eventName === "Action" || this.data.actions?.[eventName]) {
              if (eventName === "Focus" || eventName === "Blur") {
                elementData || (elementData = {
                  focused: false
                });
              }
              this._setEventListener(element, elementData, baseName, eventName, getter);
              if (eventName === "Focus" && !this.data.actions?.Blur) {
                this._setEventListener(element, elementData, "blur", "Blur", null);
              } else if (eventName === "Blur" && !this.data.actions?.Focus) {
                this._setEventListener(element, elementData, "focus", "Focus", null);
              }
            }
          }
        }
        _setTextStyle(element) {
          const TEXT_ALIGNMENT = ["left", "center", "right"];
          const {
            fontColor
          } = this.data.defaultAppearanceData;
          const fontSize = this.data.defaultAppearanceData.fontSize || annotation_layer_DEFAULT_FONT_SIZE;
          const style = element.style;
          let computedFontSize;
          const BORDER_SIZE = 2;
          const roundToOneDecimal = (x) => Math.round(10 * x) / 10;
          if (this.data.multiLine) {
            const height = Math.abs(this.data.rect[3] - this.data.rect[1] - BORDER_SIZE);
            const numberOfLines = Math.round(height / /* inlined export .LINE_FACTOR */
            (1.35 * fontSize)) || 1;
            const lineHeight = height / numberOfLines;
            computedFontSize = Math.min(fontSize, roundToOneDecimal(lineHeight / /* inlined export .LINE_FACTOR */
            1.35));
          } else {
            const height = Math.abs(this.data.rect[3] - this.data.rect[1] - BORDER_SIZE);
            computedFontSize = Math.min(fontSize, roundToOneDecimal(height / /* inlined export .LINE_FACTOR */
            1.35));
          }
          style.fontSize = `calc(${computedFontSize}px * var(--total-scale-factor))`;
          style.color = Util.makeHexColor(...fontColor);
          if (this.data.textAlignment !== null && !this.data.comb) {
            style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
          }
        }
        _setRequired(element, isRequired) {
          if (isRequired) {
            element.setAttribute("required", true);
          } else {
            element.removeAttribute("required");
          }
          element.setAttribute("aria-required", isRequired);
        }
      };
      TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
        constructor(parameters) {
          const isRenderable = parameters.renderForms || parameters.data.hasOwnCanvas || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
          super(parameters, {
            isRenderable
          });
        }
        setPropertyOnSiblings(base, key, value, keyInStorage) {
          const storage = this.annotationStorage;
          for (const element of this._getElementsByName(base.name, base.id)) {
            if (element.domElement) {
              element.domElement[key] = value;
            }
            storage.setValue(element.id, {
              [keyInStorage]: value
            });
          }
        }
        render() {
          const storage = this.annotationStorage;
          const id = this.data.id;
          this.container.classList.add("textWidgetAnnotation");
          let element = null;
          if (this.renderForms) {
            const storedData = storage.getValue(id, {
              value: this.data.fieldValue
            });
            let textContent = storedData.value || "";
            const maxLen = storage.getValue(id, {
              charLimit: this.data.maxLen
            }).charLimit;
            if (maxLen && textContent.length > maxLen) {
              textContent = textContent.slice(0, maxLen);
            }
            let fieldFormattedValues = storedData.formattedValue || this.data.textContent?.join("\n") || null;
            if (fieldFormattedValues && this.data.comb) {
              fieldFormattedValues = fieldFormattedValues.replaceAll(/\s+/g, "");
            }
            const elementData = {
              userValue: textContent,
              formattedValue: fieldFormattedValues,
              lastCommittedValue: null,
              commitKey: 1,
              focused: false
            };
            if (this.data.multiLine) {
              element = document.createElement("textarea");
              element.textContent = fieldFormattedValues ?? textContent;
              if (this.data.doNotScroll) {
                element.style.overflowY = "hidden";
              }
            } else {
              element = document.createElement("input");
              element.type = this.data.password ? "password" : "text";
              element.setAttribute("value", fieldFormattedValues ?? textContent);
              if (this.data.doNotScroll) {
                element.style.overflowX = "hidden";
              }
            }
            if (this.data.hasOwnCanvas) {
              this.container.classList.add("hasOwnCanvas");
              if (storage.has(id)) {
                this.container.classList.add("sandboxModified");
              }
            }
            GetElementsByNameSet.add(element);
            this.contentElement = element;
            element.setAttribute("data-element-id", id);
            element.disabled = this.data.readOnly;
            element.name = this.data.fieldName;
            element.tabIndex = 0;
            const {
              datetimeFormat,
              datetimeType,
              timeStep
            } = this.data;
            const hasDateOrTime = !!datetimeType && this.enableScripting;
            if (datetimeFormat) {
              element.title = datetimeFormat;
            }
            this._setRequired(element, this.data.required);
            if (maxLen) {
              element.maxLength = maxLen;
            }
            element.addEventListener("input", (event) => {
              storage.setValue(id, {
                value: event.target.value
              });
              this.setPropertyOnSiblings(element, "value", event.target.value, "value");
              elementData.formattedValue = null;
            });
            element.addEventListener("resetform", (event) => {
              const defaultValue = this.data.defaultFieldValue ?? "";
              element.value = elementData.userValue = defaultValue;
              elementData.formattedValue = null;
            });
            let blurListener = (event) => {
              const {
                formattedValue
              } = elementData;
              if (formattedValue !== null && formattedValue !== void 0) {
                event.target.value = formattedValue;
              }
              event.target.scrollLeft = 0;
            };
            if (this.enableScripting && this.hasJSActions) {
              element.addEventListener("focus", (event) => {
                if (elementData.focused) {
                  return;
                }
                const {
                  target
                } = event;
                if (hasDateOrTime) {
                  target.type = datetimeType;
                  if (timeStep) {
                    target.step = timeStep;
                  }
                }
                if (elementData.userValue) {
                  const value = elementData.userValue;
                  if (hasDateOrTime) {
                    if (datetimeType === "time") {
                      const date = new Date(value);
                      const parts = [date.getHours(), date.getMinutes(), date.getSeconds()];
                      target.value = parts.map((v) => v.toString().padStart(2, "0")).join(":");
                    } else {
                      target.value = new Date(value - TIMEZONE_OFFSET).toISOString().split(datetimeType === "date" ? "T" : ".", 1)[0];
                    }
                  } else {
                    target.value = value;
                  }
                }
                elementData.lastCommittedValue = target.value;
                elementData.commitKey = 1;
                if (!this.data.actions?.Focus) {
                  elementData.focused = true;
                }
              });
              element.addEventListener("updatefromsandbox", (jsEvent) => {
                this.container.classList.add("sandboxModified");
                const actions = {
                  value(event) {
                    elementData.userValue = event.detail.value ?? "";
                    if (!hasDateOrTime) {
                      storage.setValue(id, {
                        value: elementData.userValue.toString()
                      });
                    }
                    event.target.value = elementData.userValue;
                  },
                  formattedValue(event) {
                    const {
                      formattedValue
                    } = event.detail;
                    elementData.formattedValue = formattedValue;
                    if (formattedValue !== null && formattedValue !== void 0 && event.target !== document.activeElement) {
                      event.target.value = formattedValue;
                    }
                    const data = {
                      formattedValue
                    };
                    if (hasDateOrTime) {
                      data.value = formattedValue;
                    }
                    storage.setValue(id, data);
                  },
                  selRange(event) {
                    event.target.setSelectionRange(...event.detail.selRange);
                  },
                  charLimit: (event) => {
                    const {
                      charLimit
                    } = event.detail;
                    const {
                      target
                    } = event;
                    if (charLimit === 0) {
                      target.removeAttribute("maxLength");
                      return;
                    }
                    target.setAttribute("maxLength", charLimit);
                    let value = elementData.userValue;
                    if (!value || value.length <= charLimit) {
                      return;
                    }
                    value = value.slice(0, charLimit);
                    target.value = elementData.userValue = value;
                    storage.setValue(id, {
                      value
                    });
                    this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                      source: this,
                      detail: {
                        id,
                        name: "Keystroke",
                        value,
                        willCommit: true,
                        commitKey: 1,
                        selStart: target.selectionStart,
                        selEnd: target.selectionEnd
                      }
                    });
                  }
                };
                this._dispatchEventFromSandbox(actions, jsEvent);
              });
              element.addEventListener("keydown", (event) => {
                elementData.commitKey = 1;
                let commitKey = -1;
                if (event.key === "Escape") {
                  commitKey = 0;
                } else if (event.key === "Enter" && !this.data.multiLine) {
                  commitKey = 2;
                } else if (event.key === "Tab") {
                  elementData.commitKey = 3;
                }
                if (commitKey === -1) {
                  return;
                }
                const {
                  value
                } = event.target;
                if (elementData.lastCommittedValue === value) {
                  return;
                }
                elementData.lastCommittedValue = value;
                elementData.userValue = value;
                this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                  source: this,
                  detail: {
                    id,
                    name: "Keystroke",
                    value,
                    willCommit: true,
                    commitKey,
                    selStart: event.target.selectionStart,
                    selEnd: event.target.selectionEnd
                  }
                });
              });
              const _blurListener = blurListener;
              blurListener = null;
              element.addEventListener("blur", (event) => {
                if (!elementData.focused || !event.relatedTarget) {
                  return;
                }
                if (!this.data.actions?.Blur) {
                  elementData.focused = false;
                }
                const {
                  target
                } = event;
                let {
                  value
                } = target;
                if (hasDateOrTime) {
                  if (value && datetimeType === "time") {
                    const parts = value.split(":").map((v) => parseInt(v, 10));
                    value = new Date(2e3, 0, 1, parts[0], parts[1], parts[2] || 0).valueOf();
                    target.step = "";
                  } else {
                    if (!value.includes("T")) {
                      value = `${value}T00:00`;
                    }
                    value = new Date(value).valueOf();
                  }
                  target.type = "text";
                }
                elementData.userValue = value;
                if (elementData.lastCommittedValue !== value) {
                  this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                    source: this,
                    detail: {
                      id,
                      name: "Keystroke",
                      value,
                      willCommit: true,
                      commitKey: elementData.commitKey,
                      selStart: event.target.selectionStart,
                      selEnd: event.target.selectionEnd
                    }
                  });
                }
                _blurListener(event);
              });
              if (this.data.actions?.Keystroke) {
                element.addEventListener("beforeinput", (event) => {
                  elementData.lastCommittedValue = null;
                  const {
                    data,
                    target
                  } = event;
                  const {
                    value,
                    selectionStart,
                    selectionEnd
                  } = target;
                  let selStart = selectionStart, selEnd = selectionEnd;
                  switch (event.inputType) {
                    case "deleteWordBackward": {
                      const match = value.substring(0, selectionStart).match(/\w*\W*$/);
                      if (match) {
                        selStart -= match[0].length;
                      }
                      break;
                    }
                    case "deleteWordForward": {
                      const match = value.substring(selectionStart).match(/^\W*\w*/);
                      if (match) {
                        selEnd += match[0].length;
                      }
                      break;
                    }
                    case "deleteContentBackward":
                      if (selectionStart === selectionEnd) {
                        selStart -= 1;
                      }
                      break;
                    case "deleteContentForward":
                      if (selectionStart === selectionEnd) {
                        selEnd += 1;
                      }
                      break;
                  }
                  event.preventDefault();
                  this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                    source: this,
                    detail: {
                      id,
                      name: "Keystroke",
                      value,
                      change: data || "",
                      willCommit: false,
                      selStart,
                      selEnd
                    }
                  });
                });
              }
              this._setEventListeners(element, elementData, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (event) => event.target.value);
            }
            if (blurListener) {
              element.addEventListener("blur", blurListener);
            }
            if (this.data.comb) {
              const fieldWidth = this.data.rect[2] - this.data.rect[0];
              const combWidth = fieldWidth / maxLen;
              element.classList.add("comb");
              element.style.setProperty("--comb-width", `calc(${combWidth}px * var(--total-scale-factor))`);
              const alignment = this.data.textAlignment;
              if (alignment === 1 || alignment === 2) {
                const setCombOffset = () => {
                  const free = maxLen - element.value.length;
                  element.style.setProperty("--comb-offset", `${alignment === 1 ? free >> 1 : free}`);
                };
                setCombOffset();
                for (const evt of ["input", "blur", "resetform", "updatefromsandbox"]) {
                  element.addEventListener(evt, setCombOffset);
                }
              }
            }
          } else {
            element = document.createElement("div");
            element.textContent = this.data.fieldValue;
            element.style.verticalAlign = "middle";
            element.style.display = "table-cell";
            if (this.data.hasOwnCanvas) {
              element.hidden = true;
            }
          }
          this._setTextStyle(element);
          this._setBackgroundColor(element);
          this._setDefaultPropertiesFromJS(element);
          this.container.append(element);
          return this.container;
        }
      };
      SignatureWidgetAnnotationElement = class extends WidgetAnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: !!parameters.data.hasOwnCanvas
          });
        }
      };
      CheckboxWidgetAnnotationElement = class extends WidgetAnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: parameters.renderForms
          });
        }
        render() {
          const storage = this.annotationStorage;
          const data = this.data;
          const id = data.id;
          let value = storage.getValue(id, {
            value: data.exportValue === data.fieldValue
          }).value;
          if (typeof value === "string") {
            value = value !== "Off";
            storage.setValue(id, {
              value
            });
          }
          this.container.classList.add("buttonWidgetAnnotation", "checkBox");
          const element = document.createElement("input");
          GetElementsByNameSet.add(element);
          element.setAttribute("data-element-id", id);
          element.disabled = data.readOnly;
          this._setRequired(element, this.data.required);
          element.type = "checkbox";
          element.name = data.fieldName;
          if (value) {
            element.setAttribute("checked", true);
          }
          element.setAttribute("exportValue", data.exportValue);
          element.tabIndex = 0;
          element.addEventListener("change", (event) => {
            const {
              name,
              checked
            } = event.target;
            for (const checkbox of this._getElementsByName(name, id)) {
              const curChecked = checked && checkbox.exportValue === data.exportValue;
              if (checkbox.domElement) {
                checkbox.domElement.checked = curChecked;
              }
              storage.setValue(checkbox.id, {
                value: curChecked
              });
            }
            storage.setValue(id, {
              value: checked
            });
          });
          element.addEventListener("resetform", (event) => {
            const defaultValue = data.defaultFieldValue || "Off";
            event.target.checked = defaultValue === data.exportValue;
          });
          if (this.enableScripting && this.hasJSActions) {
            element.addEventListener("updatefromsandbox", (jsEvent) => {
              const actions = {
                value(event) {
                  event.target.checked = event.detail.value !== "Off";
                  storage.setValue(id, {
                    value: event.target.checked
                  });
                }
              };
              this._dispatchEventFromSandbox(actions, jsEvent);
            });
            this._setEventListeners(element, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (event) => event.target.checked);
          }
          this._setDefaultPropertiesFromJS(element);
          this.container.append(element);
          return this.container;
        }
      };
      RadioButtonWidgetAnnotationElement = class extends WidgetAnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: parameters.renderForms
          });
        }
        render() {
          this.container.classList.add("buttonWidgetAnnotation", "radioButton");
          const storage = this.annotationStorage;
          const data = this.data;
          const id = data.id;
          let value = storage.getValue(id, {
            value: data.buttonValue !== null && data.fieldValue === data.buttonValue
          }).value;
          if (typeof value === "string") {
            value = value !== data.buttonValue;
            storage.setValue(id, {
              value
            });
          }
          if (value) {
            for (const radio of this._getElementsByName(data.fieldName, id)) {
              storage.setValue(radio.id, {
                value: false
              });
            }
          }
          const element = document.createElement("input");
          GetElementsByNameSet.add(element);
          element.setAttribute("data-element-id", id);
          element.disabled = data.readOnly;
          this._setRequired(element, this.data.required);
          element.type = "radio";
          element.name = data.fieldName;
          if (value) {
            element.setAttribute("checked", true);
          }
          element.tabIndex = 0;
          element.addEventListener("change", (event) => {
            const {
              name,
              checked
            } = event.target;
            for (const radio of this._getElementsByName(name, id)) {
              storage.setValue(radio.id, {
                value: false
              });
            }
            storage.setValue(id, {
              value: checked
            });
          });
          element.addEventListener("resetform", (event) => {
            const defaultValue = data.defaultFieldValue;
            event.target.checked = defaultValue !== null && defaultValue !== void 0 && defaultValue === data.buttonValue;
          });
          if (this.enableScripting && this.hasJSActions) {
            const pdfButtonValue = data.buttonValue;
            element.addEventListener("updatefromsandbox", (jsEvent) => {
              const actions = {
                value: (event) => {
                  const checked = pdfButtonValue === event.detail.value;
                  for (const radio of this._getElementsByName(event.target.name)) {
                    const curChecked = checked && radio.id === id;
                    if (radio.domElement) {
                      radio.domElement.checked = curChecked;
                    }
                    storage.setValue(radio.id, {
                      value: curChecked
                    });
                  }
                }
              };
              this._dispatchEventFromSandbox(actions, jsEvent);
            });
            this._setEventListeners(element, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (event) => event.target.checked);
          }
          this._setDefaultPropertiesFromJS(element);
          this.container.append(element);
          return this.container;
        }
      };
      PushButtonWidgetAnnotationElement = class extends LinkAnnotationElement {
        constructor(parameters) {
          super(parameters, {
            ignoreBorder: parameters.data.hasAppearance
          });
        }
        render() {
          const container = super.render();
          container.classList.add("buttonWidgetAnnotation", "pushButton");
          const linkElement = container.lastChild;
          if (this.enableScripting && this.hasJSActions && linkElement) {
            this._setDefaultPropertiesFromJS(linkElement);
            linkElement.addEventListener("updatefromsandbox", (jsEvent) => {
              this._dispatchEventFromSandbox({}, jsEvent);
            });
          }
          return container;
        }
      };
      ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: parameters.renderForms
          });
        }
        render() {
          this.container.classList.add("choiceWidgetAnnotation");
          const storage = this.annotationStorage;
          const id = this.data.id;
          const storedData = storage.getValue(id, {
            value: this.data.fieldValue
          });
          const selectElement = document.createElement("select");
          GetElementsByNameSet.add(selectElement);
          selectElement.setAttribute("data-element-id", id);
          selectElement.disabled = this.data.readOnly;
          this._setRequired(selectElement, this.data.required);
          selectElement.name = this.data.fieldName;
          selectElement.tabIndex = 0;
          let addAnEmptyEntry = this.data.combo && this.data.options.length > 0;
          if (!this.data.combo) {
            selectElement.size = this.data.options.length;
            if (this.data.multiSelect) {
              selectElement.multiple = true;
            }
          }
          selectElement.addEventListener("resetform", (event) => {
            const defaultValue = this.data.defaultFieldValue;
            for (const option of selectElement.options) {
              option.selected = option.value === defaultValue;
            }
          });
          const fixDisplayValue = (option, value) => {
            const newValue = value.replaceAll(" ", "\xA0");
            option.textContent = newValue;
            if (newValue !== value) {
              option.setAttribute("display-value", value);
            }
          };
          for (const option of this.data.options) {
            const optionElement = document.createElement("option");
            fixDisplayValue(optionElement, option.displayValue);
            optionElement.value = option.exportValue;
            if (storedData.value.includes(option.exportValue)) {
              optionElement.setAttribute("selected", true);
              addAnEmptyEntry = false;
            }
            selectElement.append(optionElement);
          }
          let removeEmptyEntry = null;
          if (addAnEmptyEntry) {
            const noneOptionElement = document.createElement("option");
            noneOptionElement.value = " ";
            noneOptionElement.setAttribute("hidden", true);
            noneOptionElement.setAttribute("selected", true);
            selectElement.prepend(noneOptionElement);
            removeEmptyEntry = () => {
              noneOptionElement.remove();
              selectElement.removeEventListener("input", removeEmptyEntry);
              removeEmptyEntry = null;
            };
            selectElement.addEventListener("input", removeEmptyEntry);
          }
          const getValue = (isExport) => {
            const name = isExport ? "value" : "textContent";
            const {
              options,
              multiple
            } = selectElement;
            if (!multiple) {
              return options.selectedIndex === -1 ? null : options[options.selectedIndex][name];
            }
            return Array.prototype.filter.call(options, (option) => option.selected).map((option) => option[name]);
          };
          let selectedValues = getValue(false);
          const getItems = (event) => {
            const options = event.target.options;
            return Array.prototype.map.call(options, (option) => ({
              displayValue: option.getAttribute("display-value") || option.textContent,
              exportValue: option.value
            }));
          };
          if (this.enableScripting && this.hasJSActions) {
            selectElement.addEventListener("updatefromsandbox", (jsEvent) => {
              const actions = {
                value(event) {
                  removeEmptyEntry?.();
                  const value = event.detail.value;
                  const values2 = new Set(Array.isArray(value) ? value : [value]);
                  for (const option of selectElement.options) {
                    option.selected = values2.has(option.value);
                  }
                  storage.setValue(id, {
                    value: getValue(true)
                  });
                  selectedValues = getValue(false);
                },
                multipleSelection(event) {
                  selectElement.multiple = true;
                },
                remove(event) {
                  const options = selectElement.options;
                  const index = event.detail.remove;
                  options[index].selected = false;
                  selectElement.remove(index);
                  if (options.length > 0) {
                    const i = Array.prototype.findIndex.call(options, (option) => option.selected);
                    if (i === -1) {
                      options[0].selected = true;
                    }
                  }
                  storage.setValue(id, {
                    value: getValue(true),
                    items: getItems(event)
                  });
                  selectedValues = getValue(false);
                },
                clear(event) {
                  while (selectElement.length !== 0) {
                    selectElement.remove(0);
                  }
                  storage.setValue(id, {
                    value: null,
                    items: []
                  });
                  selectedValues = getValue(false);
                },
                insert(event) {
                  const {
                    index,
                    displayValue,
                    exportValue
                  } = event.detail.insert;
                  const selectChild = selectElement.children[index];
                  const optionElement = document.createElement("option");
                  fixDisplayValue(optionElement, displayValue);
                  optionElement.value = exportValue;
                  if (selectChild) {
                    selectChild.before(optionElement);
                  } else {
                    selectElement.append(optionElement);
                  }
                  storage.setValue(id, {
                    value: getValue(true),
                    items: getItems(event)
                  });
                  selectedValues = getValue(false);
                },
                items(event) {
                  const {
                    items
                  } = event.detail;
                  while (selectElement.length !== 0) {
                    selectElement.remove(0);
                  }
                  for (const item of items) {
                    const {
                      displayValue,
                      exportValue
                    } = item;
                    const optionElement = document.createElement("option");
                    fixDisplayValue(optionElement, displayValue);
                    optionElement.value = exportValue;
                    selectElement.append(optionElement);
                  }
                  if (selectElement.options.length > 0) {
                    selectElement.options[0].selected = true;
                  }
                  storage.setValue(id, {
                    value: getValue(true),
                    items: getItems(event)
                  });
                  selectedValues = getValue(false);
                },
                indices(event) {
                  const indices = new Set(event.detail.indices);
                  for (const option of event.target.options) {
                    option.selected = indices.has(option.index);
                  }
                  storage.setValue(id, {
                    value: getValue(true)
                  });
                  selectedValues = getValue(false);
                },
                editable(event) {
                  event.target.disabled = !event.detail.editable;
                }
              };
              this._dispatchEventFromSandbox(actions, jsEvent);
            });
            selectElement.addEventListener("input", (event) => {
              const exportValue = getValue(true);
              const change = getValue(false);
              storage.setValue(id, {
                value: exportValue
              });
              event.preventDefault();
              this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
                source: this,
                detail: {
                  id,
                  name: "Keystroke",
                  value: selectedValues,
                  change,
                  changeEx: exportValue,
                  willCommit: false,
                  commitKey: 1,
                  keyDown: false
                }
              });
            });
            this._setEventListeners(selectElement, null, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"], ["input", "Validate"]], (event) => event.target.value);
          } else {
            selectElement.addEventListener("input", function(event) {
              storage.setValue(id, {
                value: getValue(true)
              });
            });
          }
          if (this.data.combo) {
            this._setTextStyle(selectElement);
          } else {
          }
          this._setBackgroundColor(selectElement);
          this._setDefaultPropertiesFromJS(selectElement);
          this.container.append(selectElement);
          return this.container;
        }
      };
      PopupAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          const {
            data,
            elements,
            parent
          } = parameters;
          const hasCommentManager = !!parent._commentManager;
          super(parameters, {
            isRenderable: !hasCommentManager && AnnotationElement._hasPopupData(data)
          });
          __privateAdd(this, _PopupAnnotationElement_instances);
          this.elements = elements;
          if (hasCommentManager && AnnotationElement._hasPopupData(data)) {
            const popup = this.popup = __privateMethod(this, _PopupAnnotationElement_instances, createPopup_fn).call(this);
            for (const element of elements) {
              element.popup = popup;
            }
          } else {
            this.popup = null;
          }
        }
        render() {
          const {
            container
          } = this;
          container.classList.add("popupAnnotation");
          container.role = "comment";
          const popup = this.popup = __privateMethod(this, _PopupAnnotationElement_instances, createPopup_fn).call(this);
          const elementIds = [];
          for (const element of this.elements) {
            element.popup = popup;
            element.container.ariaHasPopup = "dialog";
            elementIds.push(element.data.id);
            element.addHighlightArea();
          }
          this.container.setAttribute("aria-controls", elementIds.map((id) => `${AnnotationPrefix}${id}`).join(","));
          return this.container;
        }
      };
      _PopupAnnotationElement_instances = new WeakSet();
      createPopup_fn = function() {
        return new PopupElement({
          container: this.container,
          color: this.data.color,
          titleObj: this.data.titleObj,
          modificationDate: this.data.modificationDate || this.data.creationDate,
          contentsObj: this.data.contentsObj,
          richText: this.data.richText,
          rect: this.data.rect,
          parentRect: this.data.parentRect || null,
          parent: this.parent,
          elements: this.elements,
          open: this.data.open,
          commentManager: this.parent._commentManager
        });
      };
      PopupElement = class {
        constructor({
          container,
          color,
          elements,
          titleObj,
          modificationDate,
          contentsObj,
          richText,
          parent,
          rect,
          parentRect,
          open,
          commentManager = null
        }) {
          __privateAdd(this, _PopupElement_instances);
          __privateAdd(this, _commentManager2, null);
          __privateAdd(this, _boundKeyDown, __privateMethod(this, _PopupElement_instances, keyDown_fn2).bind(this));
          __privateAdd(this, _boundHide, __privateMethod(this, _PopupElement_instances, hide_fn).bind(this));
          __privateAdd(this, _boundShow, __privateMethod(this, _PopupElement_instances, show_fn).bind(this));
          __privateAdd(this, _boundToggle, __privateMethod(this, _PopupElement_instances, toggle_fn).bind(this));
          __privateAdd(this, _color, null);
          __privateAdd(this, _container4, null);
          __privateAdd(this, _contentsObj, null);
          __privateAdd(this, _dateObj, null);
          __privateAdd(this, _elements, null);
          __privateAdd(this, _parent, null);
          __privateAdd(this, _parentRect, null);
          __privateAdd(this, _pinned, false);
          __privateAdd(this, _popup, null);
          __privateAdd(this, _popupAbortController, null);
          __privateAdd(this, _position2, null);
          __privateAdd(this, _commentButton, null);
          __privateAdd(this, _commentButtonPosition, null);
          __privateAdd(this, _popupPosition2, null);
          __privateAdd(this, _rect, null);
          __privateAdd(this, _richText2, null);
          __privateAdd(this, _titleObj, null);
          __privateAdd(this, _updates2, null);
          __privateAdd(this, _wasVisible, false);
          __privateAdd(this, _firstElement, null);
          __privateAdd(this, _commentText, null);
          __privateSet(this, _container4, container);
          __privateSet(this, _titleObj, titleObj);
          __privateSet(this, _contentsObj, contentsObj);
          __privateSet(this, _richText2, richText);
          __privateSet(this, _parent, parent);
          __privateSet(this, _color, color);
          __privateSet(this, _rect, rect);
          __privateSet(this, _parentRect, parentRect);
          __privateSet(this, _elements, elements);
          __privateSet(this, _commentManager2, commentManager);
          __privateSet(this, _firstElement, elements[0]);
          __privateSet(this, _dateObj, PDFDateString.toDateObject(modificationDate));
          this.trigger = elements.flatMap((e) => e.getElementsToTriggerPopup());
          if (!commentManager) {
            __privateMethod(this, _PopupElement_instances, addEventListeners_fn).call(this);
            __privateGet(this, _container4).hidden = true;
            if (open) {
              __privateMethod(this, _PopupElement_instances, toggle_fn).call(this);
            }
          }
        }
        renderCommentButton() {
          if (__privateGet(this, _commentButton)) {
            if (!__privateGet(this, _commentButton).parentNode) {
              __privateGet(this, _firstElement).container.after(__privateGet(this, _commentButton));
            }
            return;
          }
          if (!__privateGet(this, _commentButtonPosition)) {
            __privateMethod(this, _PopupElement_instances, setCommentButtonPosition_fn).call(this);
          }
          if (!__privateGet(this, _commentButtonPosition)) {
            return;
          }
          const {
            signal
          } = __privateSet(this, _popupAbortController, new AbortController());
          const hasOwnButton = __privateGet(this, _firstElement).hasOwnCommentButton;
          const togglePopup = () => {
            __privateGet(this, _commentManager2).toggleCommentPopup(this, true, void 0, !hasOwnButton);
          };
          const showPopup = () => {
            __privateGet(this, _commentManager2).toggleCommentPopup(this, false, true, !hasOwnButton);
          };
          const hidePopup = () => {
            __privateGet(this, _commentManager2).toggleCommentPopup(this, false, false);
          };
          if (!hasOwnButton) {
            const button = __privateSet(this, _commentButton, document.createElement("button"));
            button.className = "annotationCommentButton";
            const parentContainer = __privateGet(this, _firstElement).container;
            button.style.zIndex = parseInt(parentContainer.style.zIndex, 10) + 1;
            button.tabIndex = 0;
            button.ariaHasPopup = "dialog";
            button.ariaControls = "commentPopup";
            button.setAttribute("data-l10n-id", "pdfjs-show-comment-button");
            __privateMethod(this, _PopupElement_instances, updateColor_fn).call(this);
            __privateMethod(this, _PopupElement_instances, updateCommentButtonPosition_fn).call(this);
            button.addEventListener("keydown", __privateGet(this, _boundKeyDown), {
              signal
            });
            button.addEventListener("click", togglePopup, {
              signal
            });
            button.addEventListener("pointerenter", showPopup, {
              signal
            });
            button.addEventListener("pointerleave", hidePopup, {
              signal
            });
            parentContainer.after(button);
          } else {
            __privateSet(this, _commentButton, __privateGet(this, _firstElement).container);
            for (const element of this.trigger) {
              element.ariaHasPopup = "dialog";
              element.ariaControls = "commentPopup";
              element.addEventListener("keydown", __privateGet(this, _boundKeyDown), {
                signal
              });
              element.addEventListener("click", togglePopup, {
                signal
              });
              element.addEventListener("pointerenter", showPopup, {
                signal
              });
              element.addEventListener("pointerleave", hidePopup, {
                signal
              });
              element.classList.add("popupTriggerArea");
            }
          }
        }
        get commentButtonColor() {
          const {
            color,
            opacity
          } = __privateGet(this, _firstElement).commentData;
          if (!color) {
            return null;
          }
          return __privateGet(this, _parent)._commentManager.makeCommentColor(color, opacity);
        }
        focusCommentButton() {
          setTimeout(() => {
            __privateGet(this, _commentButton)?.focus();
          }, 0);
        }
        getData() {
          const {
            richText,
            color,
            opacity,
            creationDate,
            modificationDate
          } = __privateGet(this, _firstElement).commentData;
          return {
            contentsObj: {
              str: this.comment
            },
            richText,
            color,
            opacity,
            creationDate,
            modificationDate
          };
        }
        get elementBeforePopup() {
          return __privateGet(this, _commentButton);
        }
        get comment() {
          __privateGet(this, _commentText) || __privateSet(this, _commentText, __privateGet(this, _firstElement).commentText);
          return __privateGet(this, _commentText);
        }
        set comment(text) {
          if (text === this.comment) {
            return;
          }
          __privateGet(this, _firstElement).commentText = __privateSet(this, _commentText, text);
        }
        focus() {
          __privateGet(this, _firstElement).container?.focus();
        }
        get parentBoundingClientRect() {
          return __privateGet(this, _firstElement).layer.getBoundingClientRect();
        }
        setCommentButtonStates({
          selected,
          hasPopup
        }) {
          if (!__privateGet(this, _commentButton)) {
            return;
          }
          __privateGet(this, _commentButton).classList.toggle("selected", selected);
          __privateGet(this, _commentButton).ariaExpanded = hasPopup;
        }
        setSelectedCommentButton(selected) {
          __privateGet(this, _commentButton).classList.toggle("selected", selected);
        }
        get commentPopupPosition() {
          if (__privateGet(this, _popupPosition2)) {
            return __privateGet(this, _popupPosition2);
          }
          const {
            x,
            y,
            height
          } = __privateGet(this, _commentButton).getBoundingClientRect();
          const {
            x: parentX,
            y: parentY,
            width: parentWidth,
            height: parentHeight
          } = __privateGet(this, _firstElement).layer.getBoundingClientRect();
          return [(x - parentX) / parentWidth, (y + height - parentY) / parentHeight];
        }
        set commentPopupPosition(pos) {
          __privateSet(this, _popupPosition2, pos);
        }
        hasDefaultPopupPosition() {
          return __privateGet(this, _popupPosition2) === null;
        }
        get commentButtonPosition() {
          return __privateGet(this, _commentButtonPosition);
        }
        get commentButtonWidth() {
          return __privateGet(this, _commentButton).getBoundingClientRect().width / this.parentBoundingClientRect.width;
        }
        editComment(options) {
          const [posX, posY] = __privateGet(this, _popupPosition2) || this.commentButtonPosition.map((x) => x / 100);
          const parentDimensions = this.parentBoundingClientRect;
          const {
            x: parentX,
            y: parentY,
            width: parentWidth,
            height: parentHeight
          } = parentDimensions;
          __privateGet(this, _commentManager2).showDialog(null, this, parentX + posX * parentWidth, parentY + posY * parentHeight, {
            ...options,
            parentDimensions
          });
        }
        render() {
          if (__privateGet(this, _popup)) {
            return;
          }
          const popup = __privateSet(this, _popup, document.createElement("div"));
          popup.className = "popup";
          if (__privateGet(this, _color)) {
            const baseColor = popup.style.outlineColor = Util.makeHexColor(...__privateGet(this, _color));
            popup.style.backgroundColor = `color-mix(in srgb, ${baseColor} 30%, white)`;
          }
          const header = document.createElement("span");
          header.className = "header";
          if (__privateGet(this, _titleObj)?.str) {
            const title = document.createElement("span");
            title.className = "title";
            header.append(title);
            ({
              dir: title.dir,
              str: title.textContent
            } = __privateGet(this, _titleObj));
          }
          popup.append(header);
          if (__privateGet(this, _dateObj)) {
            const modificationDate = document.createElement("time");
            modificationDate.className = "popupDate";
            modificationDate.setAttribute("data-l10n-id", "pdfjs-annotation-date-time-string");
            modificationDate.setAttribute("data-l10n-args", JSON.stringify({
              dateObj: __privateGet(this, _dateObj).valueOf()
            }));
            modificationDate.dateTime = __privateGet(this, _dateObj).toISOString();
            header.append(modificationDate);
          }
          renderRichText({
            html: __privateGet(this, _PopupElement_instances, html_get) || __privateGet(this, _contentsObj).str,
            dir: __privateGet(this, _contentsObj)?.dir,
            className: "popupContent"
          }, popup);
          __privateGet(this, _container4).append(popup);
        }
        updateEdited({
          rect,
          popup,
          deleted
        }) {
          if (__privateGet(this, _commentManager2)) {
            if (deleted) {
              this.remove();
              __privateSet(this, _commentText, null);
            } else if (popup) {
              if (popup.deleted) {
                this.remove();
              } else {
                __privateMethod(this, _PopupElement_instances, updateColor_fn).call(this);
                __privateSet(this, _commentText, popup.text);
              }
            }
            if (rect) {
              __privateSet(this, _commentButtonPosition, null);
              __privateMethod(this, _PopupElement_instances, setCommentButtonPosition_fn).call(this);
              __privateMethod(this, _PopupElement_instances, updateCommentButtonPosition_fn).call(this);
            }
            return;
          }
          if (deleted || popup?.deleted) {
            this.remove();
            return;
          }
          __privateMethod(this, _PopupElement_instances, addEventListeners_fn).call(this);
          __privateGet(this, _updates2) || __privateSet(this, _updates2, {
            contentsObj: __privateGet(this, _contentsObj),
            richText: __privateGet(this, _richText2)
          });
          if (rect) {
            __privateSet(this, _position2, null);
          }
          if (popup && popup.text) {
            __privateSet(this, _richText2, __privateMethod(this, _PopupElement_instances, makePopupContent_fn).call(this, popup.text));
            __privateSet(this, _dateObj, PDFDateString.toDateObject(popup.date));
            __privateSet(this, _contentsObj, null);
          }
          __privateGet(this, _popup)?.remove();
          __privateSet(this, _popup, null);
        }
        resetEdited() {
          if (!__privateGet(this, _updates2)) {
            return;
          }
          ({
            contentsObj: __privateWrapper(this, _contentsObj)._,
            richText: __privateWrapper(this, _richText2)._
          } = __privateGet(this, _updates2));
          __privateSet(this, _updates2, null);
          __privateGet(this, _popup)?.remove();
          __privateSet(this, _popup, null);
          __privateSet(this, _position2, null);
        }
        remove() {
          __privateGet(this, _popupAbortController)?.abort();
          __privateSet(this, _popupAbortController, null);
          __privateGet(this, _popup)?.remove();
          __privateSet(this, _popup, null);
          __privateSet(this, _wasVisible, false);
          __privateSet(this, _pinned, false);
          __privateGet(this, _commentButton)?.remove();
          __privateSet(this, _commentButton, null);
          if (this.trigger) {
            for (const element of this.trigger) {
              element.classList.remove("popupTriggerArea");
            }
          }
        }
        forceHide() {
          __privateSet(this, _wasVisible, this.isVisible);
          if (!__privateGet(this, _wasVisible)) {
            return;
          }
          __privateGet(this, _container4).hidden = true;
        }
        maybeShow() {
          if (__privateGet(this, _commentManager2)) {
            return;
          }
          __privateMethod(this, _PopupElement_instances, addEventListeners_fn).call(this);
          if (!__privateGet(this, _wasVisible)) {
            return;
          }
          if (!__privateGet(this, _popup)) {
            __privateMethod(this, _PopupElement_instances, show_fn).call(this);
          }
          __privateSet(this, _wasVisible, false);
          __privateGet(this, _container4).hidden = false;
        }
        get isVisible() {
          if (__privateGet(this, _commentManager2)) {
            return false;
          }
          return __privateGet(this, _container4).hidden === false;
        }
      };
      _commentManager2 = new WeakMap();
      _boundKeyDown = new WeakMap();
      _boundHide = new WeakMap();
      _boundShow = new WeakMap();
      _boundToggle = new WeakMap();
      _color = new WeakMap();
      _container4 = new WeakMap();
      _contentsObj = new WeakMap();
      _dateObj = new WeakMap();
      _elements = new WeakMap();
      _parent = new WeakMap();
      _parentRect = new WeakMap();
      _pinned = new WeakMap();
      _popup = new WeakMap();
      _popupAbortController = new WeakMap();
      _position2 = new WeakMap();
      _commentButton = new WeakMap();
      _commentButtonPosition = new WeakMap();
      _popupPosition2 = new WeakMap();
      _rect = new WeakMap();
      _richText2 = new WeakMap();
      _titleObj = new WeakMap();
      _updates2 = new WeakMap();
      _wasVisible = new WeakMap();
      _firstElement = new WeakMap();
      _commentText = new WeakMap();
      _PopupElement_instances = new WeakSet();
      addEventListeners_fn = function() {
        if (__privateGet(this, _popupAbortController)) {
          return;
        }
        __privateSet(this, _popupAbortController, new AbortController());
        const {
          signal
        } = __privateGet(this, _popupAbortController);
        for (const element of this.trigger) {
          element.addEventListener("click", __privateGet(this, _boundToggle), {
            signal
          });
          element.addEventListener("pointerenter", __privateGet(this, _boundShow), {
            signal
          });
          element.addEventListener("pointerleave", __privateGet(this, _boundHide), {
            signal
          });
          element.classList.add("popupTriggerArea");
        }
        for (const element of __privateGet(this, _elements)) {
          element.container?.addEventListener("keydown", __privateGet(this, _boundKeyDown), {
            signal
          });
        }
      };
      setCommentButtonPosition_fn = function() {
        const element = __privateGet(this, _elements).find((e) => e.hasCommentButton);
        if (!element) {
          return;
        }
        __privateSet(this, _commentButtonPosition, element._normalizePoint(element.commentButtonPosition));
      };
      updateCommentButtonPosition_fn = function() {
        if (__privateGet(this, _firstElement).extraPopupElement && !__privateGet(this, _firstElement).editor) {
          return;
        }
        if (!__privateGet(this, _commentButton)) {
          this.renderCommentButton();
        }
        const [x, y] = __privateGet(this, _commentButtonPosition);
        const {
          style
        } = __privateGet(this, _commentButton);
        style.left = `calc(${x}%)`;
        style.top = `calc(${y}% - var(--comment-button-dim))`;
      };
      updateColor_fn = function() {
        if (__privateGet(this, _firstElement).extraPopupElement) {
          return;
        }
        if (!__privateGet(this, _commentButton)) {
          this.renderCommentButton();
        }
        __privateGet(this, _commentButton).style.backgroundColor = this.commentButtonColor || "";
      };
      html_get = function() {
        const richText = __privateGet(this, _richText2);
        const contentsObj = __privateGet(this, _contentsObj);
        if (richText?.str && (!contentsObj?.str || contentsObj.str === richText.str)) {
          return __privateGet(this, _richText2).html || null;
        }
        return null;
      };
      fontSize_get = function() {
        return __privateGet(this, _PopupElement_instances, html_get)?.attributes?.style?.fontSize || 0;
      };
      fontColor_get = function() {
        return __privateGet(this, _PopupElement_instances, html_get)?.attributes?.style?.color || null;
      };
      makePopupContent_fn = function(text) {
        const popupLines = [];
        const popupContent = {
          str: text,
          html: {
            name: "div",
            attributes: {
              dir: "auto"
            },
            children: [{
              name: "p",
              children: popupLines
            }]
          }
        };
        const lineAttributes = {
          style: {
            color: __privateGet(this, _PopupElement_instances, fontColor_get),
            fontSize: __privateGet(this, _PopupElement_instances, fontSize_get) ? `calc(${__privateGet(this, _PopupElement_instances, fontSize_get)}px * var(--total-scale-factor))` : ""
          }
        };
        for (const line of text.split("\n")) {
          popupLines.push({
            name: "span",
            value: line,
            attributes: lineAttributes
          });
        }
        return popupContent;
      };
      keyDown_fn2 = function(event) {
        if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
          return;
        }
        if (event.key === "Enter" || event.key === "Escape" && __privateGet(this, _pinned)) {
          __privateMethod(this, _PopupElement_instances, toggle_fn).call(this);
        }
      };
      setPosition_fn = function() {
        if (__privateGet(this, _position2) !== null) {
          return;
        }
        const {
          page: {
            view
          },
          viewport: {
            rawDims: {
              pageWidth,
              pageHeight,
              pageX,
              pageY
            }
          }
        } = __privateGet(this, _parent);
        let useParentRect = !!__privateGet(this, _parentRect);
        let rect = useParentRect ? __privateGet(this, _parentRect) : __privateGet(this, _rect);
        for (const element of __privateGet(this, _elements)) {
          if (!rect || Util.intersect(element.data.rect, rect) !== null) {
            rect = element.data.rect;
            useParentRect = true;
            break;
          }
        }
        const normalizedRect = Util.normalizeRect([rect[0], view[3] - rect[1] + view[1], rect[2], view[3] - rect[3] + view[1]]);
        const HORIZONTAL_SPACE_AFTER_ANNOTATION = 5;
        const parentWidth = useParentRect ? rect[2] - rect[0] + HORIZONTAL_SPACE_AFTER_ANNOTATION : 0;
        const popupLeft = normalizedRect[0] + parentWidth;
        const popupTop = normalizedRect[1];
        __privateSet(this, _position2, [100 * (popupLeft - pageX) / pageWidth, 100 * (popupTop - pageY) / pageHeight]);
        const {
          style
        } = __privateGet(this, _container4);
        style.left = `${__privateGet(this, _position2)[0]}%`;
        style.top = `${__privateGet(this, _position2)[1]}%`;
      };
      toggle_fn = function() {
        if (__privateGet(this, _commentManager2)) {
          __privateGet(this, _commentManager2).toggleCommentPopup(this, false);
          return;
        }
        __privateSet(this, _pinned, !__privateGet(this, _pinned));
        if (__privateGet(this, _pinned)) {
          __privateMethod(this, _PopupElement_instances, show_fn).call(this);
          __privateGet(this, _container4).addEventListener("click", __privateGet(this, _boundToggle));
          __privateGet(this, _container4).addEventListener("keydown", __privateGet(this, _boundKeyDown));
        } else {
          __privateMethod(this, _PopupElement_instances, hide_fn).call(this);
          __privateGet(this, _container4).removeEventListener("click", __privateGet(this, _boundToggle));
          __privateGet(this, _container4).removeEventListener("keydown", __privateGet(this, _boundKeyDown));
        }
      };
      show_fn = function() {
        if (!__privateGet(this, _popup)) {
          this.render();
        }
        if (!this.isVisible) {
          __privateMethod(this, _PopupElement_instances, setPosition_fn).call(this);
          __privateGet(this, _container4).hidden = false;
          __privateGet(this, _container4).style.zIndex = parseInt(__privateGet(this, _container4).style.zIndex, 10) + 1e3;
        } else if (__privateGet(this, _pinned)) {
          __privateGet(this, _container4).classList.add("focused");
        }
      };
      hide_fn = function() {
        __privateGet(this, _container4).classList.remove("focused");
        if (__privateGet(this, _pinned) || !this.isVisible) {
          return;
        }
        __privateGet(this, _container4).hidden = true;
        __privateGet(this, _container4).style.zIndex = parseInt(__privateGet(this, _container4).style.zIndex, 10) - 1e3;
      };
      FreeTextAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
          this.textContent = parameters.data.textContent;
          this.textPosition = parameters.data.textPosition;
          this.annotationEditorType = AnnotationEditorType.FREETEXT;
        }
        render() {
          this.container.classList.add("freeTextAnnotation");
          if (this.textContent) {
            const content = this.contentElement = document.createElement("div");
            content.classList.add("annotationTextContent");
            content.setAttribute("role", "comment");
            for (const line of this.textContent) {
              const lineSpan = document.createElement("span");
              lineSpan.textContent = line;
              content.append(lineSpan);
            }
            this.container.append(content);
          }
          if (!this.data.popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          this._editOnDoubleClick();
          return this.container;
        }
      };
      LineAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
          __privateAdd(this, _line, null);
        }
        render() {
          this.container.classList.add("lineAnnotation");
          const {
            data,
            width,
            height
          } = this;
          const svg = this.svgFactory.create(width, height, true);
          const line = __privateSet(this, _line, this.svgFactory.createElement("svg:line"));
          line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]);
          line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]);
          line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]);
          line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]);
          line.setAttribute("stroke-width", data.borderStyle.width || 1);
          line.setAttribute("stroke", "transparent");
          line.setAttribute("fill", "transparent");
          svg.append(line);
          this.container.append(svg);
          if (!data.popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          return this.container;
        }
        getElementsToTriggerPopup() {
          return __privateGet(this, _line);
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      };
      _line = new WeakMap();
      SquareAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
          __privateAdd(this, _square, null);
        }
        render() {
          this.container.classList.add("squareAnnotation");
          const {
            data,
            width,
            height
          } = this;
          const svg = this.svgFactory.create(width, height, true);
          const borderWidth = data.borderStyle.width;
          const square = __privateSet(this, _square, this.svgFactory.createElement("svg:rect"));
          square.setAttribute("x", borderWidth / 2);
          square.setAttribute("y", borderWidth / 2);
          square.setAttribute("width", width - borderWidth);
          square.setAttribute("height", height - borderWidth);
          square.setAttribute("stroke-width", borderWidth || 1);
          square.setAttribute("stroke", "transparent");
          square.setAttribute("fill", "transparent");
          svg.append(square);
          this.container.append(svg);
          if (!data.popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          return this.container;
        }
        getElementsToTriggerPopup() {
          return __privateGet(this, _square);
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      };
      _square = new WeakMap();
      CircleAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
          __privateAdd(this, _circle, null);
        }
        render() {
          this.container.classList.add("circleAnnotation");
          const {
            data,
            width,
            height
          } = this;
          const svg = this.svgFactory.create(width, height, true);
          const borderWidth = data.borderStyle.width;
          const circle = __privateSet(this, _circle, this.svgFactory.createElement("svg:ellipse"));
          circle.setAttribute("cx", width / 2);
          circle.setAttribute("cy", height / 2);
          circle.setAttribute("rx", width / 2 - borderWidth / 2);
          circle.setAttribute("ry", height / 2 - borderWidth / 2);
          circle.setAttribute("stroke-width", borderWidth || 1);
          circle.setAttribute("stroke", "transparent");
          circle.setAttribute("fill", "transparent");
          svg.append(circle);
          this.container.append(svg);
          if (!data.popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          return this.container;
        }
        getElementsToTriggerPopup() {
          return __privateGet(this, _circle);
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      };
      _circle = new WeakMap();
      PolylineAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
          __privateAdd(this, _polyline, null);
          this.containerClassName = "polylineAnnotation";
          this.svgElementName = "svg:polyline";
        }
        render() {
          this.container.classList.add(this.containerClassName);
          const {
            data: {
              rect,
              vertices,
              borderStyle,
              popupRef
            },
            width,
            height
          } = this;
          if (!vertices) {
            return this.container;
          }
          const svg = this.svgFactory.create(width, height, true);
          let points = [];
          for (let i = 0, ii = vertices.length; i < ii; i += 2) {
            const x = vertices[i] - rect[0];
            const y = rect[3] - vertices[i + 1];
            points.push(`${x},${y}`);
          }
          points = points.join(" ");
          const polyline = __privateSet(this, _polyline, this.svgFactory.createElement(this.svgElementName));
          polyline.setAttribute("points", points);
          polyline.setAttribute("stroke-width", borderStyle.width || 1);
          polyline.setAttribute("stroke", "transparent");
          polyline.setAttribute("fill", "transparent");
          svg.append(polyline);
          this.container.append(svg);
          if (!popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          return this.container;
        }
        getElementsToTriggerPopup() {
          return __privateGet(this, _polyline);
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      };
      _polyline = new WeakMap();
      PolygonAnnotationElement = class extends PolylineAnnotationElement {
        constructor(parameters) {
          super(parameters);
          this.containerClassName = "polygonAnnotation";
          this.svgElementName = "svg:polygon";
        }
      };
      CaretAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
        }
        render() {
          this.container.classList.add("caretAnnotation");
          if (!this.data.popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          return this.container;
        }
      };
      InkAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
          __privateAdd(this, _InkAnnotationElement_instances);
          __privateAdd(this, _polylinesGroupElement, null);
          __privateAdd(this, _polylines, []);
          this.containerClassName = "inkAnnotation";
          this.svgElementName = "svg:polyline";
          this.annotationEditorType = this.data.it === "InkHighlight" ? AnnotationEditorType.HIGHLIGHT : AnnotationEditorType.INK;
        }
        render() {
          this.container.classList.add(this.containerClassName);
          const {
            data: {
              rect,
              rotation,
              inkLists,
              borderStyle,
              popupRef
            }
          } = this;
          const {
            transform,
            width,
            height
          } = __privateMethod(this, _InkAnnotationElement_instances, getTransform_fn).call(this, rotation, rect);
          const svg = this.svgFactory.create(width, height, true);
          const g = __privateSet(this, _polylinesGroupElement, this.svgFactory.createElement("svg:g"));
          svg.append(g);
          g.setAttribute("stroke-width", borderStyle.width || 1);
          g.setAttribute("stroke-linecap", "round");
          g.setAttribute("stroke-linejoin", "round");
          g.setAttribute("stroke-miterlimit", 10);
          g.setAttribute("stroke", "transparent");
          g.setAttribute("fill", "transparent");
          g.setAttribute("transform", transform);
          for (const inkList of inkLists) {
            const polyline = this.svgFactory.createElement(this.svgElementName);
            __privateGet(this, _polylines).push(polyline);
            polyline.setAttribute("points", inkList.join(","));
            g.append(polyline);
          }
          if (!popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          this.container.append(svg);
          this._editOnDoubleClick();
          return this.container;
        }
        updateEdited(params) {
          super.updateEdited(params);
          const {
            thickness,
            points,
            rect
          } = params;
          const g = __privateGet(this, _polylinesGroupElement);
          if (thickness >= 0) {
            g.setAttribute("stroke-width", thickness || 1);
          }
          if (points) {
            for (let i = 0, ii = __privateGet(this, _polylines).length; i < ii; i++) {
              __privateGet(this, _polylines)[i].setAttribute("points", points[i].join(","));
            }
          }
          if (rect) {
            const {
              transform,
              width,
              height
            } = __privateMethod(this, _InkAnnotationElement_instances, getTransform_fn).call(this, this.data.rotation, rect);
            const root3 = g.parentElement;
            root3.setAttribute("viewBox", `0 0 ${width} ${height}`);
            g.setAttribute("transform", transform);
          }
        }
        getElementsToTriggerPopup() {
          return __privateGet(this, _polylines);
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      };
      _polylinesGroupElement = new WeakMap();
      _polylines = new WeakMap();
      _InkAnnotationElement_instances = new WeakSet();
      getTransform_fn = function(rotation, rect) {
        switch (rotation) {
          case 90:
            return {
              transform: `rotate(90) translate(${-rect[0]},${rect[1]}) scale(1,-1)`,
              width: rect[3] - rect[1],
              height: rect[2] - rect[0]
            };
          case 180:
            return {
              transform: `rotate(180) translate(${-rect[2]},${rect[1]}) scale(1,-1)`,
              width: rect[2] - rect[0],
              height: rect[3] - rect[1]
            };
          case 270:
            return {
              transform: `rotate(270) translate(${-rect[2]},${rect[3]}) scale(1,-1)`,
              width: rect[3] - rect[1],
              height: rect[2] - rect[0]
            };
          default:
            return {
              transform: `translate(${-rect[0]},${rect[3]}) scale(1,-1)`,
              width: rect[2] - rect[0],
              height: rect[3] - rect[1]
            };
        }
      };
      HighlightAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true,
            createQuadrilaterals: true
          });
          this.annotationEditorType = AnnotationEditorType.HIGHLIGHT;
        }
        render() {
          const {
            data: {
              overlaidText,
              popupRef
            }
          } = this;
          if (!popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          this.container.classList.add("highlightAnnotation");
          this._editOnDoubleClick();
          if (overlaidText) {
            const mark = document.createElement("mark");
            mark.classList.add("overlaidText");
            mark.textContent = overlaidText;
            this.container.append(mark);
          }
          return this.container;
        }
      };
      UnderlineAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true,
            createQuadrilaterals: true
          });
        }
        render() {
          const {
            data: {
              overlaidText,
              popupRef
            }
          } = this;
          if (!popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          this.container.classList.add("underlineAnnotation");
          if (overlaidText) {
            const underline = document.createElement("u");
            underline.classList.add("overlaidText");
            underline.textContent = overlaidText;
            this.container.append(underline);
          }
          return this.container;
        }
      };
      SquigglyAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true,
            createQuadrilaterals: true
          });
        }
        render() {
          const {
            data: {
              overlaidText,
              popupRef
            }
          } = this;
          if (!popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          this.container.classList.add("squigglyAnnotation");
          if (overlaidText) {
            const underline = document.createElement("u");
            underline.classList.add("overlaidText");
            underline.textContent = overlaidText;
            this.container.append(underline);
          }
          return this.container;
        }
      };
      StrikeOutAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true,
            createQuadrilaterals: true
          });
        }
        render() {
          const {
            data: {
              overlaidText,
              popupRef
            }
          } = this;
          if (!popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          this.container.classList.add("strikeoutAnnotation");
          if (overlaidText) {
            const strikeout = document.createElement("s");
            strikeout.classList.add("overlaidText");
            strikeout.textContent = overlaidText;
            this.container.append(strikeout);
          }
          return this.container;
        }
      };
      StampAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true,
            ignoreBorder: true
          });
          this.annotationEditorType = AnnotationEditorType.STAMP;
        }
        render() {
          this.container.classList.add("stampAnnotation");
          this.container.setAttribute("role", "img");
          if (!this.data.popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          }
          this._editOnDoubleClick();
          return this.container;
        }
      };
      FileAttachmentAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: true
          });
          __privateAdd(this, _FileAttachmentAnnotationElement_instances);
          __privateAdd(this, _trigger, null);
          const {
            fileId,
            file
          } = this.data;
          this.filename = file.filename;
          this.content = file.content;
          this.fileId = fileId;
          this.linkService.eventBus?.dispatch("fileattachmentannotation", {
            source: this,
            attachmentId: this.fileId,
            ...file
          });
        }
        render() {
          this.container.classList.add("fileAttachmentAnnotation");
          const {
            container,
            data
          } = this;
          let trigger;
          if (data.hasAppearance || data.fillAlpha === 0) {
            trigger = document.createElement("div");
          } else {
            trigger = document.createElement("img");
            trigger.src = `${this.imageResourcesPath}annotation-${/paperclip/i.test(data.name) ? "paperclip" : "pushpin"}.svg`;
            if (data.fillAlpha && data.fillAlpha < 1) {
              trigger.style = `filter: opacity(${Math.round(data.fillAlpha * 100)}%);`;
            }
          }
          trigger.addEventListener("dblclick", __privateMethod(this, _FileAttachmentAnnotationElement_instances, download_fn).bind(this));
          __privateSet(this, _trigger, trigger);
          const {
            isMac
          } = FeatureTest.platform;
          container.addEventListener("keydown", (evt) => {
            if (evt.key === "Enter" && (isMac ? evt.metaKey : evt.ctrlKey)) {
              __privateMethod(this, _FileAttachmentAnnotationElement_instances, download_fn).call(this);
            }
          });
          if (!data.popupRef && this.hasPopupData) {
            this.hasOwnCommentButton = true;
            this._createPopup();
          } else {
            trigger.classList.add("popupTriggerArea");
          }
          container.append(trigger);
          return container;
        }
        getElementsToTriggerPopup() {
          return __privateGet(this, _trigger);
        }
        addHighlightArea() {
          this.container.classList.add("highlightArea");
        }
      };
      _trigger = new WeakMap();
      _FileAttachmentAnnotationElement_instances = new WeakSet();
      download_fn = async function() {
        const {
          fileId,
          filename,
          content: fallbackContent
        } = this;
        const content = await this.linkService.getAttachmentContent(fileId) || fallbackContent;
        if (content) {
          this.downloadManager?.openOrDownloadData(content, filename);
        }
      };
      MediaAnnotationElement = class extends AnnotationElement {
        constructor(parameters) {
          super(parameters, {
            isRenderable: !!parameters.data.richMedia
          });
          __privateAdd(this, _MediaAnnotationElement_instances);
          __privateAdd(this, _abortController2, new AbortController());
          __privateAdd(this, _contentUrl, null);
          __privateAdd(this, _media, null);
        }
        render() {
          this.container.classList.add("mediaAnnotation");
          const {
            filename
          } = this.data.richMedia;
          const button = document.createElement("button");
          button.className = "mediaPlayButton";
          button.type = "button";
          button.title = button.ariaLabel = filename;
          button.addEventListener("click", () => __privateMethod(this, _MediaAnnotationElement_instances, load_fn).call(this, button), {
            signal: __privateGet(this, _abortController2).signal
          });
          this.container.append(button);
          return this.container;
        }
        destroy() {
          __privateGet(this, _abortController2).abort();
          if (__privateGet(this, _media)) {
            __privateGet(this, _media).pause();
            __privateGet(this, _media).removeAttribute("src");
            __privateGet(this, _media).load();
            __privateSet(this, _media, null);
          }
          __privateMethod(this, _MediaAnnotationElement_instances, revokeContentUrl_fn).call(this);
        }
      };
      _abortController2 = new WeakMap();
      _contentUrl = new WeakMap();
      _media = new WeakMap();
      _MediaAnnotationElement_instances = new WeakSet();
      load_fn = async function(button) {
        const {
          fileId,
          filename,
          contentType
        } = this.data.richMedia;
        button.disabled = true;
        let content;
        try {
          content = await this.linkService.getAttachmentContent(fileId);
        } catch {
          return;
        } finally {
          button.disabled = false;
        }
        if (!content || !button.isConnected) {
          return;
        }
        const {
          signal
        } = __privateGet(this, _abortController2);
        const url = URL.createObjectURL(new Blob([content], {
          type: contentType
        }));
        __privateSet(this, _contentUrl, url);
        const isAudio = contentType.startsWith("audio/");
        const media = document.createElement(isAudio ? "audio" : "video");
        __privateSet(this, _media, media);
        media.className = "mediaContent";
        this._setBackgroundColor(media);
        media.src = url;
        media.title = filename;
        media.controls = true;
        media.autoplay = true;
        media.tabIndex = 0;
        if (isAudio) {
          let hovered = false;
          let focused = false;
          const updateControls = () => {
            media.controls = hovered || focused;
          };
          this.container.addEventListener("pointerenter", () => {
            hovered = true;
            updateControls();
          }, {
            signal
          });
          this.container.addEventListener("pointerleave", () => {
            hovered = false;
            updateControls();
          }, {
            signal
          });
          this.container.addEventListener("focusin", () => {
            focused = true;
            updateControls();
          }, {
            signal
          });
          this.container.addEventListener("focusout", () => {
            focused = false;
            updateControls();
          }, {
            signal
          });
        }
        media.addEventListener("emptied", () => __privateMethod(this, _MediaAnnotationElement_instances, revokeContentUrl_fn).call(this, url), {
          once: true,
          signal
        });
        button.replaceWith(media);
        media.play().catch(() => {
        });
      };
      revokeContentUrl_fn = function(url = __privateGet(this, _contentUrl)) {
        if (url && url === __privateGet(this, _contentUrl)) {
          URL.revokeObjectURL(url);
          __privateSet(this, _contentUrl, null);
        }
      };
      _AnnotationLayer = class _AnnotationLayer {
        constructor({
          div,
          accessibilityManager,
          annotationCanvasMap,
          annotationEditorUIManager,
          page,
          viewport,
          structTreeLayer,
          commentManager,
          linkService,
          annotationStorage
        }) {
          __privateAdd(this, _AnnotationLayer_instances);
          __privateAdd(this, _accessibilityManager, null);
          __privateAdd(this, _annotationCanvasMap, null);
          __privateAdd(this, _annotationStorage2, null);
          __privateAdd(this, _editableAnnotations, /* @__PURE__ */ new Map());
          __privateAdd(this, _structTreeLayer, null);
          __privateAdd(this, _linkService, null);
          __privateAdd(this, _elements2, []);
          __privateAdd(this, _hasAriaAttributesFromStructTree, false);
          __publicField(this, "zIndex", 0);
          this.div = div;
          __privateSet(this, _accessibilityManager, accessibilityManager);
          __privateSet(this, _annotationCanvasMap, annotationCanvasMap);
          __privateSet(this, _structTreeLayer, structTreeLayer || null);
          __privateSet(this, _linkService, linkService || null);
          __privateSet(this, _annotationStorage2, annotationStorage || new AnnotationStorage());
          this.page = page;
          this.viewport = viewport;
          this._annotationEditorUIManager = annotationEditorUIManager;
          this._commentManager = commentManager || null;
        }
        hasEditableAnnotations() {
          return __privateGet(this, _editableAnnotations).size > 0;
        }
        async render(params) {
          const {
            annotations,
            optionalContentConfig
          } = params;
          const layer = this.div;
          setLayerDimensions(layer, this.viewport);
          const popupToElements = /* @__PURE__ */ new Map();
          const popupAnnotations = [];
          const elementParams = {
            data: null,
            layer,
            linkService: __privateGet(this, _linkService),
            downloadManager: params.downloadManager,
            imageResourcesPath: params.imageResourcesPath || "",
            renderForms: params.renderForms !== false,
            svgFactory: new DOMSVGFactory(),
            annotationStorage: __privateGet(this, _annotationStorage2),
            enableComment: params.enableComment === true,
            enableScripting: params.enableScripting === true,
            hasJSActions: params.hasJSActions,
            fieldObjects: params.fieldObjects,
            parent: this,
            elements: null
          };
          for (const data of annotations) {
            if (data.noHTML) {
              continue;
            }
            const isPopupAnnotation = data.annotationType === AnnotationType.POPUP;
            if (!isPopupAnnotation) {
              if (data.rect[2] === data.rect[0] || data.rect[3] === data.rect[1]) {
                continue;
              }
            } else {
              const elements = popupToElements.get(data.id);
              if (!elements) {
                continue;
              }
              if (!this._commentManager) {
                popupAnnotations.push(data);
                continue;
              }
              elementParams.elements = elements;
            }
            elementParams.data = data;
            const element = AnnotationElementFactory.create(elementParams);
            if (!element.isRenderable) {
              continue;
            }
            if (!isPopupAnnotation) {
              __privateGet(this, _elements2).push(element);
              if (data.popupRef) {
                popupToElements.getOrInsertComputed(data.popupRef, makeArr).push(element);
              }
            }
            const rendered = element.render();
            if (data.hidden) {
              rendered.style.visibility = "hidden";
            }
            element.updateOC(optionalContentConfig);
            if (element._isEditable) {
              __privateGet(this, _editableAnnotations).set(element.data.id, element);
              this._annotationEditorUIManager?.renderAnnotationElement(element);
            }
          }
          await __privateMethod(this, _AnnotationLayer_instances, addElementsToDOM_fn).call(this);
          for (const data of popupAnnotations) {
            const elements = elementParams.elements = popupToElements.get(data.id);
            elementParams.data = data;
            const element = AnnotationElementFactory.create(elementParams);
            if (!element.isRenderable) {
              continue;
            }
            const rendered = element.render();
            element.contentElement.id = `${AnnotationPrefix}${data.id}`;
            if (data.hidden) {
              rendered.style.visibility = "hidden";
            }
            elements.at(-1).container.after(rendered);
          }
          __privateMethod(this, _AnnotationLayer_instances, setAnnotationCanvasMap_fn).call(this);
        }
        async addLinkAnnotations(annotations) {
          const elementParams = {
            data: null,
            layer: this.div,
            linkService: __privateGet(this, _linkService),
            svgFactory: new DOMSVGFactory(),
            parent: this
          };
          for (const data of annotations) {
            data.borderStyle || (data.borderStyle = _AnnotationLayer._defaultBorderStyle);
            elementParams.data = data;
            const element = AnnotationElementFactory.create(elementParams);
            if (!element.isRenderable) {
              continue;
            }
            element.render();
            element.contentElement.id = `${AnnotationPrefix}${data.id}`;
            __privateGet(this, _elements2).push(element);
          }
          await __privateMethod(this, _AnnotationLayer_instances, addElementsToDOM_fn).call(this);
        }
        update({
          viewport,
          optionalContentConfig
        }) {
          const layer = this.div;
          this.viewport = viewport;
          setLayerDimensions(layer, {
            rotation: viewport.rotation
          });
          for (const element of __privateGet(this, _elements2)) {
            element.updateOC(optionalContentConfig);
          }
          __privateMethod(this, _AnnotationLayer_instances, setAnnotationCanvasMap_fn).call(this);
          layer.hidden = false;
        }
        destroy() {
          for (const element of __privateGet(this, _elements2)) {
            element.destroy?.();
            __privateGet(this, _accessibilityManager)?.removePointerInTextLayer(element.contentElement);
          }
          __privateGet(this, _elements2).length = 0;
          __privateGet(this, _editableAnnotations).clear();
          this.div.replaceChildren();
        }
        refreshCanvases() {
          __privateMethod(this, _AnnotationLayer_instances, setAnnotationCanvasMap_fn).call(this);
        }
        getEditableAnnotations() {
          return __privateGet(this, _editableAnnotations).values();
        }
        getEditableAnnotation(id) {
          return __privateGet(this, _editableAnnotations).get(id);
        }
        addFakeAnnotation(editor) {
          const {
            div
          } = this;
          const {
            id,
            rotation
          } = editor;
          const element = new EditorAnnotationElement({
            data: {
              id,
              rect: editor.getPDFRect(),
              rotation
            },
            editor,
            layer: div,
            parent: this,
            enableComment: !!this._commentManager,
            linkService: __privateGet(this, _linkService),
            annotationStorage: __privateGet(this, _annotationStorage2)
          });
          element.render();
          element.contentElement.id = `${AnnotationPrefix}${id}`;
          element.createOrUpdatePopup();
          __privateGet(this, _elements2).push(element);
          return element;
        }
        removeAnnotation(id) {
          const index = __privateGet(this, _elements2).findIndex((el) => el.data.id === id);
          if (index < 0) {
            return;
          }
          const [element] = __privateGet(this, _elements2).splice(index, 1);
          __privateGet(this, _accessibilityManager)?.removePointerInTextLayer(element.contentElement);
        }
        updateFakeAnnotations(editors) {
          if (editors.length === 0) {
            return;
          }
          for (const editor of editors) {
            editor.updateFakeAnnotationElement(this);
          }
          __privateMethod(this, _AnnotationLayer_instances, addElementsToDOM_fn).call(this);
        }
        togglePointerEvents(enabled = false) {
          this.div.classList.toggle("disabled", !enabled);
        }
        static get _defaultBorderStyle() {
          return shadow(this, "_defaultBorderStyle", Object.freeze({
            width: 1,
            rawWidth: 1,
            style: AnnotationBorderStyleType.SOLID,
            dashArray: [3],
            horizontalCornerRadius: 0,
            verticalCornerRadius: 0
          }));
        }
      };
      _accessibilityManager = new WeakMap();
      _annotationCanvasMap = new WeakMap();
      _annotationStorage2 = new WeakMap();
      _editableAnnotations = new WeakMap();
      _structTreeLayer = new WeakMap();
      _linkService = new WeakMap();
      _elements2 = new WeakMap();
      _hasAriaAttributesFromStructTree = new WeakMap();
      _AnnotationLayer_instances = new WeakSet();
      addElementsToDOM_fn = async function() {
        if (__privateGet(this, _elements2).length === 0) {
          return;
        }
        this.div.replaceChildren();
        const promises = [];
        if (!__privateGet(this, _hasAriaAttributesFromStructTree)) {
          __privateSet(this, _hasAriaAttributesFromStructTree, true);
          for (const {
            contentElement,
            data: {
              id
            }
          } of __privateGet(this, _elements2)) {
            const annotationId = contentElement.id = `${AnnotationPrefix}${id}`;
            promises.push(__privateGet(this, _structTreeLayer)?.getAriaAttributes(annotationId).then((ariaAttributes) => {
              if (ariaAttributes) {
                for (const [key, value] of ariaAttributes) {
                  contentElement.setAttribute(key, value);
                }
              }
            }));
          }
        }
        __privateGet(this, _elements2).sort(({
          data: {
            rect: [a0, a1, a2, a3]
          }
        }, {
          data: {
            rect: [b0, b1, b2, b3]
          }
        }) => {
          if (a0 === a2 && a1 === a3) {
            return 1;
          }
          if (b0 === b2 && b1 === b3) {
            return -1;
          }
          const top1 = a3;
          const bot1 = a1;
          const mid1 = (a1 + a3) / 2;
          const top2 = b3;
          const bot2 = b1;
          const mid2 = (b1 + b3) / 2;
          if (mid1 >= top2 && mid2 <= bot1) {
            return -1;
          }
          if (mid2 >= top1 && mid1 <= bot2) {
            return 1;
          }
          const centerX1 = (a0 + a2) / 2;
          const centerX2 = (b0 + b2) / 2;
          return centerX1 - centerX2;
        });
        const fragment = document.createDocumentFragment();
        for (const element of __privateGet(this, _elements2)) {
          fragment.append(element.container);
          if (this._commentManager) {
            (element.extraPopupElement?.popup || element.popup)?.renderCommentButton();
          } else if (element.extraPopupElement) {
            fragment.append(element.extraPopupElement.render());
          }
        }
        this.div.append(fragment);
        await Promise.all(promises);
        if (__privateGet(this, _accessibilityManager)) {
          for (const element of __privateGet(this, _elements2)) {
            __privateGet(this, _accessibilityManager).addPointerInTextLayer(element.contentElement, false);
          }
        }
      };
      setAnnotationCanvasMap_fn = function() {
        if (!__privateGet(this, _annotationCanvasMap)) {
          return;
        }
        const layer = this.div;
        for (const [id, canvas] of __privateGet(this, _annotationCanvasMap)) {
          const element = layer.querySelector(`[data-annotation-id="${id}"]`);
          if (!element) {
            continue;
          }
          if (Array.isArray(canvas)) {
            for (const cvs of canvas) {
              cvs.className = "annotationContent";
              cvs.ariaHidden = true;
            }
          } else {
            canvas.className = "annotationContent";
            canvas.ariaHidden = true;
          }
          const toRemove = [];
          for (const child of element.children) {
            if (child.nodeName === "CANVAS") {
              toRemove.push(child);
            }
          }
          for (const child of toRemove) {
            child.remove();
          }
          const firstCanvas = Array.isArray(canvas) ? canvas[0] : canvas;
          const {
            firstChild
          } = element;
          if (!firstChild) {
            element.append(firstCanvas);
          } else if (!firstChild.classList.contains("annotationContent")) {
            firstChild.before(firstCanvas);
          } else {
            firstChild.after(firstCanvas);
          }
          if (Array.isArray(canvas)) {
            let lastCanvas = firstCanvas;
            for (let i = 1, ii = canvas.length; i < ii; i++) {
              lastCanvas.after(canvas[i]);
              lastCanvas = canvas[i];
            }
          }
          __privateGet(this, _annotationCanvasMap).delete(id);
          const editableAnnotation = __privateGet(this, _editableAnnotations).get(id);
          if (!editableAnnotation) {
            continue;
          }
          if (editableAnnotation._hasNoCanvas) {
            this._annotationEditorUIManager?.setMissingCanvas(id, element.id, canvas);
            editableAnnotation._hasNoCanvas = false;
          } else {
            editableAnnotation.canvas = canvas;
          }
        }
      };
      AnnotationLayer = _AnnotationLayer;
      EOL_PATTERN = /\r\n?|\n/g;
      _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
        constructor(params) {
          super({
            ...params,
            name: "freeTextEditor"
          });
          __privateAdd(this, _FreeTextEditor_instances);
          __privateAdd(this, _content, "");
          __privateAdd(this, _editorDivId, `${this.id}-editor`);
          __privateAdd(this, _editModeAC, null);
          __privateAdd(this, _fontSize);
          __publicField(this, "_colorPicker", null);
          this.color = params.color || _FreeTextEditor._defaultColor || AnnotationEditor._defaultLineColor;
          __privateSet(this, _fontSize, params.fontSize || _FreeTextEditor._defaultFontSize);
          if (!this.annotationElementId) {
            this._uiManager.a11yAlert(AnnotationEditor._l10nAlert.freetext);
          }
          this.canAddComment = false;
        }
        static get _keyboardManager() {
          const proto = _FreeTextEditor.prototype;
          const arrowChecker = (self2) => self2.isEmpty();
          const small = AnnotationEditorUIManager.TRANSLATE_SMALL;
          const big = AnnotationEditorUIManager.TRANSLATE_BIG;
          return shadow(this, "_keyboardManager", new KeyboardManager([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], proto.commitOrRemove, {
            bubbles: true
          }], [["ctrl+Enter", "mac+meta+Enter"], proto.commitOrRemove], [["Escape"], proto.commitOrRemove], [["ArrowLeft"], proto._translateEmpty, {
            args: [-small, 0],
            checker: arrowChecker
          }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto._translateEmpty, {
            args: [-big, 0],
            checker: arrowChecker
          }], [["ArrowRight"], proto._translateEmpty, {
            args: [small, 0],
            checker: arrowChecker
          }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto._translateEmpty, {
            args: [big, 0],
            checker: arrowChecker
          }], [["ArrowUp"], proto._translateEmpty, {
            args: [0, -small],
            checker: arrowChecker
          }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto._translateEmpty, {
            args: [0, -big],
            checker: arrowChecker
          }], [["ArrowDown"], proto._translateEmpty, {
            args: [0, small],
            checker: arrowChecker
          }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto._translateEmpty, {
            args: [0, big],
            checker: arrowChecker
          }]]));
        }
        static initialize(l10n, uiManager) {
          AnnotationEditor.initialize(l10n, uiManager);
          const style = getComputedStyle(document.documentElement);
          this._internalPadding = parseFloat(style.getPropertyValue("--freetext-padding"));
        }
        static updateDefaultParams(type, value) {
          switch (type) {
            case AnnotationEditorParamsType.FREETEXT_SIZE:
              _FreeTextEditor._defaultFontSize = value;
              break;
            case AnnotationEditorParamsType.FREETEXT_COLOR:
              _FreeTextEditor._defaultColor = value;
              break;
          }
        }
        updateParams(type, value) {
          switch (type) {
            case AnnotationEditorParamsType.FREETEXT_SIZE:
              __privateMethod(this, _FreeTextEditor_instances, updateFontSize_fn).call(this, value);
              break;
            case AnnotationEditorParamsType.FREETEXT_COLOR:
              __privateMethod(this, _FreeTextEditor_instances, updateColor_fn2).call(this, value);
              break;
          }
        }
        static get defaultPropertiesToUpdate() {
          return [[AnnotationEditorParamsType.FREETEXT_SIZE, _FreeTextEditor._defaultFontSize], [AnnotationEditorParamsType.FREETEXT_COLOR, _FreeTextEditor._defaultColor || AnnotationEditor._defaultLineColor]];
        }
        get propertiesToUpdate() {
          return [[AnnotationEditorParamsType.FREETEXT_SIZE, __privateGet(this, _fontSize)], [AnnotationEditorParamsType.FREETEXT_COLOR, this.color]];
        }
        get toolbarButtons() {
          this._colorPicker || (this._colorPicker = new BasicColorPicker(this));
          return [["colorPicker", this._colorPicker]];
        }
        get colorType() {
          return AnnotationEditorParamsType.FREETEXT_COLOR;
        }
        onUpdatedColor() {
          this.editorDiv.style.color = this.color;
          this._colorPicker?.update(this.color);
          super.onUpdatedColor();
        }
        _translateEmpty(x, y) {
          this._uiManager.translateSelectedEditors(x, y, true);
        }
        getInitialTranslation() {
          const scale = this.parentScale;
          return [-_FreeTextEditor._internalPadding * scale, -(_FreeTextEditor._internalPadding + __privateGet(this, _fontSize)) * scale];
        }
        rebuild() {
          if (!this.parent) {
            return;
          }
          super.rebuild();
          if (this.div === null) {
            return;
          }
          if (!this.isAttachedToDOM) {
            this.parent.add(this);
          }
        }
        enableEditMode() {
          if (!super.enableEditMode()) {
            return false;
          }
          this.overlayDiv.classList.remove("enabled");
          this.editorDiv.contentEditable = true;
          this._isDraggable = false;
          this.div.removeAttribute("aria-activedescendant");
          __privateSet(this, _editModeAC, new AbortController());
          const signal = this._uiManager.combinedSignal(__privateGet(this, _editModeAC));
          this.editorDiv.addEventListener("keydown", this.editorDivKeydown.bind(this), {
            signal
          });
          this.editorDiv.addEventListener("focus", this.editorDivFocus.bind(this), {
            signal
          });
          this.editorDiv.addEventListener("blur", this.editorDivBlur.bind(this), {
            signal
          });
          this.editorDiv.addEventListener("input", this.editorDivInput.bind(this), {
            signal
          });
          this.editorDiv.addEventListener("paste", this.editorDivPaste.bind(this), {
            signal
          });
          return true;
        }
        disableEditMode() {
          if (!super.disableEditMode()) {
            return false;
          }
          this.overlayDiv.classList.add("enabled");
          this.editorDiv.contentEditable = false;
          this.div.setAttribute("aria-activedescendant", __privateGet(this, _editorDivId));
          this._isDraggable = true;
          __privateGet(this, _editModeAC)?.abort();
          __privateSet(this, _editModeAC, null);
          this.div.focus({
            preventScroll: true
          });
          this.isEditing = false;
          this.parent.div.classList.add("freetextEditing");
          return true;
        }
        focusin(event) {
          if (!this._focusEventsAllowed) {
            return;
          }
          super.focusin(event);
          if (event.target !== this.editorDiv) {
            this.editorDiv.focus();
          }
        }
        onceAdded(focus) {
          if (this.width) {
            return;
          }
          this.enableEditMode();
          if (focus) {
            this.editorDiv.focus();
          }
          if (this._initialOptions?.isCentered) {
            this.center();
          }
          this._initialOptions = null;
        }
        isEmpty() {
          return !this.editorDiv || this.editorDiv.innerText.trim() === "";
        }
        remove() {
          this.isEditing = false;
          if (this.parent) {
            this.parent.setEditingState(true);
            this.parent.div.classList.add("freetextEditing");
          }
          super.remove();
        }
        commit() {
          if (!this.isInEditMode()) {
            return;
          }
          super.commit();
          this.disableEditMode();
          const savedText = __privateGet(this, _content);
          const newText = __privateSet(this, _content, __privateMethod(this, _FreeTextEditor_instances, extractText_fn).call(this).trimEnd());
          if (savedText === newText) {
            return;
          }
          const setText = (text) => {
            __privateSet(this, _content, text);
            if (!text) {
              this.remove();
              return;
            }
            __privateMethod(this, _FreeTextEditor_instances, setContent_fn).call(this);
            this._uiManager.rebuild(this);
            __privateMethod(this, _FreeTextEditor_instances, setEditorDimensions_fn).call(this);
          };
          this.addCommands({
            cmd: () => {
              setText(newText);
            },
            undo: () => {
              setText(savedText);
            },
            mustExec: false
          });
          __privateMethod(this, _FreeTextEditor_instances, setEditorDimensions_fn).call(this);
        }
        shouldGetKeyboardEvents() {
          return this.isInEditMode();
        }
        enterInEditMode() {
          this.enableEditMode();
          this.editorDiv.focus();
        }
        keydown(event) {
          if (event.target === this.div && event.key === "Enter") {
            this.enterInEditMode();
            event.preventDefault();
          }
        }
        editorDivKeydown(event) {
          _FreeTextEditor._keyboardManager.exec(this, event);
        }
        editorDivFocus(event) {
          this.isEditing = true;
        }
        editorDivBlur(event) {
          this.isEditing = false;
        }
        editorDivInput(event) {
          this.parent.div.classList.toggle("freetextEditing", this.isEmpty());
        }
        disableEditing() {
          this.editorDiv.setAttribute("role", "comment");
          this.editorDiv.removeAttribute("aria-multiline");
        }
        enableEditing() {
          this.editorDiv.setAttribute("role", "textbox");
          this.editorDiv.setAttribute("aria-multiline", true);
        }
        get canChangeContent() {
          return true;
        }
        render() {
          if (this.div) {
            return this.div;
          }
          let baseX, baseY;
          if (this._isCopy || this.annotationElementId) {
            baseX = this.x;
            baseY = this.y;
          }
          super.render();
          this.editorDiv = document.createElement("div");
          this.editorDiv.className = "internal";
          this.editorDiv.setAttribute("id", __privateGet(this, _editorDivId));
          this.editorDiv.setAttribute("data-l10n-id", "pdfjs-free-text2");
          this.editorDiv.setAttribute("data-l10n-attrs", "default-content");
          this.enableEditing();
          this.editorDiv.contentEditable = true;
          const {
            style
          } = this.editorDiv;
          style.fontSize = `calc(${__privateGet(this, _fontSize)}px * var(--total-scale-factor))`;
          style.color = this.color;
          this.div.append(this.editorDiv);
          this.overlayDiv = document.createElement("div");
          this.overlayDiv.classList.add("overlay", "enabled");
          this.div.append(this.overlayDiv);
          if (this._isCopy || this.annotationElementId) {
            const [parentWidth, parentHeight] = this.parentDimensions;
            if (this.annotationElementId) {
              const {
                position
              } = this._initialData;
              let [tx, ty] = this.getInitialTranslation();
              [tx, ty] = this.pageTranslationToScreen(tx, ty);
              const [pageWidth, pageHeight] = this.pageDimensions;
              const [pageX, pageY] = this.pageTranslation;
              let posX, posY;
              switch (this.rotation) {
                case 0:
                  posX = baseX + (position[0] - pageX) / pageWidth;
                  posY = baseY + this.height - (position[1] - pageY) / pageHeight;
                  break;
                case 90:
                  posX = baseX + (position[0] - pageX) / pageWidth;
                  posY = baseY - (position[1] - pageY) / pageHeight;
                  [tx, ty] = [ty, -tx];
                  break;
                case 180:
                  posX = baseX - this.width + (position[0] - pageX) / pageWidth;
                  posY = baseY - (position[1] - pageY) / pageHeight;
                  [tx, ty] = [-tx, -ty];
                  break;
                case 270:
                  posX = baseX + (position[0] - pageX - this.height * pageHeight) / pageWidth;
                  posY = baseY + (position[1] - pageY - this.width * pageWidth) / pageHeight;
                  [tx, ty] = [-ty, tx];
                  break;
              }
              this.setAt(posX * parentWidth, posY * parentHeight, tx, ty);
            } else {
              this._moveAfterPaste(baseX, baseY);
            }
            __privateMethod(this, _FreeTextEditor_instances, setContent_fn).call(this);
            this._isDraggable = true;
            this.editorDiv.contentEditable = false;
          } else {
            this._isDraggable = false;
            this.editorDiv.contentEditable = true;
          }
          return this.div;
        }
        editorDivPaste(event) {
          var _a, _b, _c;
          const clipboardData = event.clipboardData || window.clipboardData;
          const {
            types
          } = clipboardData;
          if (types.length === 1 && types[0] === "text/plain") {
            return;
          }
          event.preventDefault();
          const paste = __privateMethod(_a = _FreeTextEditor, _FreeTextEditor_static, deserializeContent_fn).call(_a, clipboardData.getData("text") || "").replaceAll(EOL_PATTERN, "\n");
          if (!paste) {
            return;
          }
          const selection = window.getSelection();
          if (!selection.rangeCount) {
            return;
          }
          this.editorDiv.normalize();
          selection.deleteFromDocument();
          const range2 = selection.getRangeAt(0);
          if (!paste.includes("\n")) {
            range2.insertNode(document.createTextNode(paste));
            this.editorDiv.normalize();
            selection.collapseToStart();
            return;
          }
          const {
            startContainer,
            startOffset
          } = range2;
          const bufferBefore = [];
          const bufferAfter = [];
          if (startContainer.nodeType === Node.TEXT_NODE) {
            const parent = startContainer.parentElement;
            bufferAfter.push(startContainer.nodeValue.slice(startOffset).replaceAll(EOL_PATTERN, ""));
            if (parent !== this.editorDiv) {
              let buffer = bufferBefore;
              for (const child of this.editorDiv.childNodes) {
                if (child === parent) {
                  buffer = bufferAfter;
                  continue;
                }
                buffer.push(__privateMethod(_b = _FreeTextEditor, _FreeTextEditor_static, getNodeContent_fn).call(_b, child));
              }
            }
            bufferBefore.push(startContainer.nodeValue.slice(0, startOffset).replaceAll(EOL_PATTERN, ""));
          } else if (startContainer === this.editorDiv) {
            let buffer = bufferBefore;
            let i = 0;
            for (const child of this.editorDiv.childNodes) {
              if (i++ === startOffset) {
                buffer = bufferAfter;
              }
              buffer.push(__privateMethod(_c = _FreeTextEditor, _FreeTextEditor_static, getNodeContent_fn).call(_c, child));
            }
          }
          __privateSet(this, _content, `${bufferBefore.join("\n")}${paste}${bufferAfter.join("\n")}`);
          __privateMethod(this, _FreeTextEditor_instances, setContent_fn).call(this);
          const newRange = new Range();
          let beforeLength = Math.sumPrecise(bufferBefore.map((line) => line.length));
          for (const {
            firstChild
          } of this.editorDiv.childNodes) {
            if (firstChild.nodeType === Node.TEXT_NODE) {
              const length = firstChild.nodeValue.length;
              if (beforeLength <= length) {
                newRange.setStart(firstChild, beforeLength);
                newRange.setEnd(firstChild, beforeLength);
                break;
              }
              beforeLength -= length;
            }
          }
          selection.removeAllRanges();
          selection.addRange(newRange);
        }
        get contentDiv() {
          return this.editorDiv;
        }
        getPDFRect() {
          const padding = _FreeTextEditor._internalPadding * this.parentScale;
          return this.getRect(padding, padding);
        }
        static async deserialize(data, parent, uiManager) {
          var _a;
          let initialData = null;
          if (data instanceof FreeTextAnnotationElement) {
            const {
              data: {
                defaultAppearanceData: {
                  fontSize,
                  fontColor
                },
                rect,
                rotation,
                id,
                popupRef,
                richText,
                contentsObj,
                creationDate,
                modificationDate
              },
              textContent,
              textPosition,
              parent: {
                page: {
                  pageNumber
                }
              }
            } = data;
            if (!textContent?.length) {
              return null;
            }
            initialData = data = {
              annotationType: AnnotationEditorType.FREETEXT,
              color: Array.from(fontColor),
              fontSize,
              value: textContent.join("\n"),
              position: textPosition,
              pageIndex: pageNumber - 1,
              rect: rect.slice(0),
              rotation,
              annotationElementId: id,
              id,
              deleted: false,
              popupRef,
              comment: contentsObj?.str || null,
              richText,
              creationDate,
              modificationDate
            };
          }
          const editor = await super.deserialize(data, parent, uiManager);
          __privateSet(editor, _fontSize, data.fontSize);
          editor.color = Util.makeHexColor(...data.color);
          __privateSet(editor, _content, __privateMethod(_a = _FreeTextEditor, _FreeTextEditor_static, deserializeContent_fn).call(_a, data.value));
          editor._initialData = initialData;
          if (data.comment) {
            editor.setCommentData(data);
          }
          return editor;
        }
        serialize(isForCopying = false) {
          if (this.isEmpty()) {
            return null;
          }
          if (this.deleted) {
            return this.serializeDeleted();
          }
          const color = AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : this.color);
          const serialized = Object.assign(super.serialize(isForCopying), {
            color,
            fontSize: __privateGet(this, _fontSize),
            value: __privateMethod(this, _FreeTextEditor_instances, serializeContent_fn).call(this)
          });
          this.addComment(serialized);
          if (isForCopying) {
            serialized.isCopy = true;
            return serialized;
          }
          if (this.annotationElementId && !__privateMethod(this, _FreeTextEditor_instances, hasElementChanged_fn).call(this, serialized)) {
            return null;
          }
          serialized.id = this.annotationElementId;
          return serialized;
        }
        renderAnnotationElement(annotation) {
          const content = super.renderAnnotationElement(annotation);
          if (!content) {
            return null;
          }
          const {
            style
          } = content;
          style.fontSize = `calc(${__privateGet(this, _fontSize)}px * var(--total-scale-factor))`;
          style.color = this.color;
          content.replaceChildren();
          for (const line of __privateGet(this, _content).split("\n")) {
            const div = document.createElement("div");
            div.append(line ? document.createTextNode(line) : document.createElement("br"));
            content.append(div);
          }
          annotation.updateEdited({
            rect: this.getPDFRect(),
            popup: this._uiManager.hasCommentManager() || this.hasEditedComment ? this.comment : {
              text: __privateGet(this, _content)
            }
          });
          return content;
        }
        resetAnnotationElement(annotation) {
          super.resetAnnotationElement(annotation);
          annotation.resetEdited();
        }
      };
      _content = new WeakMap();
      _editorDivId = new WeakMap();
      _editModeAC = new WeakMap();
      _fontSize = new WeakMap();
      _FreeTextEditor_instances = new WeakSet();
      updateFontSize_fn = function(fontSize) {
        const setFontsize = (size2) => {
          this.editorDiv.style.fontSize = `calc(${size2}px * var(--total-scale-factor))`;
          this.translate(0, -(size2 - __privateGet(this, _fontSize)) * this.parentScale);
          __privateSet(this, _fontSize, size2);
          __privateMethod(this, _FreeTextEditor_instances, setEditorDimensions_fn).call(this);
        };
        const savedFontsize = __privateGet(this, _fontSize);
        this.addCommands({
          cmd: setFontsize.bind(this, fontSize),
          undo: setFontsize.bind(this, savedFontsize),
          post: this._uiManager.updateUI.bind(this._uiManager, this),
          mustExec: true,
          type: AnnotationEditorParamsType.FREETEXT_SIZE,
          overwriteIfSameType: true,
          keepUndo: true
        });
      };
      updateColor_fn2 = function(color) {
        const setColor = (col) => {
          this.color = col;
          this.onUpdatedColor();
        };
        const savedColor = this.color;
        this.addCommands({
          cmd: setColor.bind(this, color),
          undo: setColor.bind(this, savedColor),
          post: this._uiManager.updateUI.bind(this._uiManager, this),
          mustExec: true,
          type: AnnotationEditorParamsType.FREETEXT_COLOR,
          overwriteIfSameType: true,
          keepUndo: true
        });
      };
      extractText_fn = function() {
        var _a;
        const buffer = [];
        this.editorDiv.normalize();
        let prevChild = null;
        for (const child of this.editorDiv.childNodes) {
          if (prevChild?.nodeType === Node.TEXT_NODE && child.nodeName === "BR") {
            continue;
          }
          buffer.push(__privateMethod(_a = _FreeTextEditor, _FreeTextEditor_static, getNodeContent_fn).call(_a, child));
          prevChild = child;
        }
        return buffer.join("\n");
      };
      setEditorDimensions_fn = function() {
        const [parentWidth, parentHeight] = this.parentDimensions;
        let rect;
        if (this.isAttachedToDOM) {
          rect = this.div.getBoundingClientRect();
        } else {
          const {
            currentLayer,
            div
          } = this;
          const savedDisplay = div.style.display;
          const savedVisibility = div.classList.contains("hidden");
          div.classList.remove("hidden");
          div.style.display = "hidden";
          currentLayer.div.append(this.div);
          rect = div.getBoundingClientRect();
          div.remove();
          div.style.display = savedDisplay;
          div.classList.toggle("hidden", savedVisibility);
        }
        if (this.rotation % 180 === this.parentRotation % 180) {
          this.width = rect.width / parentWidth;
          this.height = rect.height / parentHeight;
        } else {
          this.width = rect.height / parentWidth;
          this.height = rect.width / parentHeight;
        }
        this.fixAndSetPosition();
      };
      _FreeTextEditor_static = new WeakSet();
      getNodeContent_fn = function(node) {
        return (node.nodeType === Node.TEXT_NODE ? node.nodeValue : node.innerText).replaceAll(EOL_PATTERN, "");
      };
      setContent_fn = function() {
        this.editorDiv.replaceChildren();
        if (!__privateGet(this, _content)) {
          return;
        }
        for (const line of __privateGet(this, _content).split("\n")) {
          const div = document.createElement("div");
          div.append(line ? document.createTextNode(line) : document.createElement("br"));
          this.editorDiv.append(div);
        }
      };
      serializeContent_fn = function() {
        return __privateGet(this, _content).replaceAll("\xA0", " ");
      };
      deserializeContent_fn = function(content) {
        return content.replaceAll(" ", "\xA0");
      };
      hasElementChanged_fn = function(serialized) {
        const {
          value,
          fontSize,
          color,
          pageIndex
        } = this._initialData;
        return this.hasEditedComment || this._hasBeenMoved || serialized.value !== value || serialized.fontSize !== fontSize || serialized.color.some((c, i) => c !== color[i]) || serialized.pageIndex !== pageIndex;
      };
      __privateAdd(_FreeTextEditor, _FreeTextEditor_static);
      __publicField(_FreeTextEditor, "_freeTextDefaultContent", "");
      __publicField(_FreeTextEditor, "_internalPadding", 0);
      __publicField(_FreeTextEditor, "_defaultColor", null);
      __publicField(_FreeTextEditor, "_defaultFontSize", 10);
      __publicField(_FreeTextEditor, "_type", "freetext");
      __publicField(_FreeTextEditor, "_editorType", AnnotationEditorType.FREETEXT);
      FreeTextEditor = _FreeTextEditor;
      Outline = class {
        toSVGPath() {
          unreachable("Abstract method `toSVGPath` must be implemented.");
        }
        get box() {
          unreachable("Abstract getter `box` must be implemented.");
        }
        serialize(_bbox3, _rotation4) {
          unreachable("Abstract method `serialize` must be implemented.");
        }
        static _rescale(src, tx, ty, sx, sy, dest) {
          dest || (dest = new Float32Array(src.length));
          for (let i = 0, ii = src.length; i < ii; i += 2) {
            dest[i] = tx + src[i] * sx;
            dest[i + 1] = ty + src[i + 1] * sy;
          }
          return dest;
        }
        static _rescaleAndSwap(src, tx, ty, sx, sy, dest) {
          dest || (dest = new Float32Array(src.length));
          for (let i = 0, ii = src.length; i < ii; i += 2) {
            dest[i] = tx + src[i + 1] * sx;
            dest[i + 1] = ty + src[i] * sy;
          }
          return dest;
        }
        static _translate(src, tx, ty, dest) {
          dest || (dest = new Float32Array(src.length));
          for (let i = 0, ii = src.length; i < ii; i += 2) {
            dest[i] = tx + src[i];
            dest[i + 1] = ty + src[i + 1];
          }
          return dest;
        }
        static svgRound(x) {
          return Math.round(x * 1e4);
        }
        static _normalizePoint(x, y, parentWidth, parentHeight, rotation) {
          switch (rotation) {
            case 90:
              return [1 - y / parentWidth, x / parentHeight];
            case 180:
              return [1 - x / parentWidth, 1 - y / parentHeight];
            case 270:
              return [y / parentWidth, 1 - x / parentHeight];
            default:
              return [x / parentWidth, y / parentHeight];
          }
        }
        static createBezierPoints(x1, y1, x2, y2, x3, y3) {
          return [(x1 + 5 * x2) / 6, (y1 + 5 * y2) / 6, (5 * x2 + x3) / 6, (5 * y2 + y3) / 6, (x2 + x3) / 2, (y2 + y3) / 2];
        }
      };
      __publicField(Outline, "PRECISION", 1e-4);
      _FreeDrawOutliner = class _FreeDrawOutliner {
        constructor({
          x,
          y
        }, box, scaleFactor, thickness, isLTR, innerMargin = 0) {
          __privateAdd(this, _FreeDrawOutliner_instances);
          __privateAdd(this, _box);
          __privateAdd(this, _bottom, []);
          __privateAdd(this, _innerMargin);
          __privateAdd(this, _isLTR);
          __privateAdd(this, _top, []);
          __privateAdd(this, _last, new Float32Array(18));
          __privateAdd(this, _lastX);
          __privateAdd(this, _lastY);
          __privateAdd(this, _min);
          __privateAdd(this, _min_dist);
          __privateAdd(this, _scaleFactor);
          __privateAdd(this, _thickness);
          __privateAdd(this, _points, []);
          __privateSet(this, _box, box);
          __privateSet(this, _thickness, thickness * scaleFactor);
          __privateSet(this, _isLTR, isLTR);
          __privateGet(this, _last).set([NaN, NaN, NaN, NaN, x, y], 6);
          __privateSet(this, _innerMargin, innerMargin);
          __privateSet(this, _min_dist, __privateGet(_FreeDrawOutliner, _MIN_DIST) * scaleFactor);
          __privateSet(this, _min, __privateGet(_FreeDrawOutliner, _MIN) * scaleFactor);
          __privateSet(this, _scaleFactor, scaleFactor);
          __privateGet(this, _points).push(x, y);
        }
        isEmpty() {
          return isNaN(__privateGet(this, _last)[8]);
        }
        add({
          x,
          y
        }) {
          __privateSet(this, _lastX, x);
          __privateSet(this, _lastY, y);
          const [layerX, layerY, layerWidth, layerHeight] = __privateGet(this, _box);
          let [x1, y1, x2, y2] = __privateGet(this, _last).subarray(8, 12);
          const diffX = x - x2;
          const diffY = y - y2;
          const d = Math.hypot(diffX, diffY);
          if (d < __privateGet(this, _min)) {
            return false;
          }
          const diffD = d - __privateGet(this, _min_dist);
          const K = diffD / d;
          const shiftX = K * diffX;
          const shiftY = K * diffY;
          let x0 = x1;
          let y0 = y1;
          x1 = x2;
          y1 = y2;
          x2 += shiftX;
          y2 += shiftY;
          __privateGet(this, _points)?.push(x, y);
          const nX = -shiftY / diffD;
          const nY = shiftX / diffD;
          const thX = nX * __privateGet(this, _thickness);
          const thY = nY * __privateGet(this, _thickness);
          __privateGet(this, _last).set(__privateGet(this, _last).subarray(2, 8), 0);
          __privateGet(this, _last).set([x2 + thX, y2 + thY], 4);
          __privateGet(this, _last).set(__privateGet(this, _last).subarray(14, 18), 12);
          __privateGet(this, _last).set([x2 - thX, y2 - thY], 16);
          if (isNaN(__privateGet(this, _last)[6])) {
            if (__privateGet(this, _top).length === 0) {
              __privateGet(this, _last).set([x1 + thX, y1 + thY], 2);
              __privateGet(this, _top).push(NaN, NaN, NaN, NaN, (x1 + thX - layerX) / layerWidth, (y1 + thY - layerY) / layerHeight);
              __privateGet(this, _last).set([x1 - thX, y1 - thY], 14);
              __privateGet(this, _bottom).push(NaN, NaN, NaN, NaN, (x1 - thX - layerX) / layerWidth, (y1 - thY - layerY) / layerHeight);
            }
            __privateGet(this, _last).set([x0, y0, x1, y1, x2, y2], 6);
            return !this.isEmpty();
          }
          __privateGet(this, _last).set([x0, y0, x1, y1, x2, y2], 6);
          const angle = Math.abs(Math.atan2(y0 - y1, x0 - x1) - Math.atan2(shiftY, shiftX));
          if (angle < Math.PI / 2) {
            [x1, y1, x2, y2] = __privateGet(this, _last).subarray(2, 6);
            __privateGet(this, _top).push(NaN, NaN, NaN, NaN, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
            [x1, y1, x0, y0] = __privateGet(this, _last).subarray(14, 18);
            __privateGet(this, _bottom).push(NaN, NaN, NaN, NaN, ((x0 + x1) / 2 - layerX) / layerWidth, ((y0 + y1) / 2 - layerY) / layerHeight);
            return true;
          }
          [x0, y0, x1, y1, x2, y2] = __privateGet(this, _last).subarray(0, 6);
          __privateGet(this, _top).push(((x0 + 5 * x1) / 6 - layerX) / layerWidth, ((y0 + 5 * y1) / 6 - layerY) / layerHeight, ((5 * x1 + x2) / 6 - layerX) / layerWidth, ((5 * y1 + y2) / 6 - layerY) / layerHeight, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
          [x2, y2, x1, y1, x0, y0] = __privateGet(this, _last).subarray(12, 18);
          __privateGet(this, _bottom).push(((x0 + 5 * x1) / 6 - layerX) / layerWidth, ((y0 + 5 * y1) / 6 - layerY) / layerHeight, ((5 * x1 + x2) / 6 - layerX) / layerWidth, ((5 * y1 + y2) / 6 - layerY) / layerHeight, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
          return true;
        }
        toSVGPath() {
          if (this.isEmpty()) {
            return "";
          }
          const top = __privateGet(this, _top);
          const bottom = __privateGet(this, _bottom);
          if (isNaN(__privateGet(this, _last)[6]) && !this.isEmpty()) {
            return __privateMethod(this, _FreeDrawOutliner_instances, toSVGPathTwoPoints_fn).call(this);
          }
          const buffer = [];
          buffer.push(`M${top[4]} ${top[5]}`);
          for (let i = 6; i < top.length; i += 6) {
            if (isNaN(top[i])) {
              buffer.push(`L${top[i + 4]} ${top[i + 5]}`);
            } else {
              buffer.push(`C${top[i]} ${top[i + 1]} ${top[i + 2]} ${top[i + 3]} ${top[i + 4]} ${top[i + 5]}`);
            }
          }
          __privateMethod(this, _FreeDrawOutliner_instances, toSVGPathEnd_fn).call(this, buffer);
          for (let i = bottom.length - 6; i >= 6; i -= 6) {
            if (isNaN(bottom[i])) {
              buffer.push(`L${bottom[i + 4]} ${bottom[i + 5]}`);
            } else {
              buffer.push(`C${bottom[i]} ${bottom[i + 1]} ${bottom[i + 2]} ${bottom[i + 3]} ${bottom[i + 4]} ${bottom[i + 5]}`);
            }
          }
          __privateMethod(this, _FreeDrawOutliner_instances, toSVGPathStart_fn).call(this, buffer);
          return buffer.join(" ");
        }
        newFreeDrawOutline(outline, points, box, scaleFactor, innerMargin, isLTR) {
          return new FreeDrawOutline(outline, points, box, scaleFactor, innerMargin, isLTR);
        }
        getOutlines() {
          const top = __privateGet(this, _top);
          const bottom = __privateGet(this, _bottom);
          const last2 = __privateGet(this, _last);
          const [layerX, layerY, layerWidth, layerHeight] = __privateGet(this, _box);
          const points = new Float32Array((__privateGet(this, _points)?.length ?? 0) + 2);
          for (let i = 0, ii = points.length - 2; i < ii; i += 2) {
            points[i] = (__privateGet(this, _points)[i] - layerX) / layerWidth;
            points[i + 1] = (__privateGet(this, _points)[i + 1] - layerY) / layerHeight;
          }
          points[points.length - 2] = (__privateGet(this, _lastX) - layerX) / layerWidth;
          points[points.length - 1] = (__privateGet(this, _lastY) - layerY) / layerHeight;
          if (isNaN(last2[6]) && !this.isEmpty()) {
            return __privateMethod(this, _FreeDrawOutliner_instances, getOutlineTwoPoints_fn).call(this, points);
          }
          const outline = new Float32Array(__privateGet(this, _top).length + 24 + __privateGet(this, _bottom).length);
          let N = top.length;
          for (let i = 0; i < N; i += 2) {
            if (isNaN(top[i])) {
              outline[i] = outline[i + 1] = NaN;
              continue;
            }
            outline[i] = top[i];
            outline[i + 1] = top[i + 1];
          }
          N = __privateMethod(this, _FreeDrawOutliner_instances, getOutlineEnd_fn).call(this, outline, N);
          for (let i = bottom.length - 6; i >= 6; i -= 6) {
            for (let j = 0; j < 6; j += 2) {
              if (isNaN(bottom[i + j])) {
                outline[N] = outline[N + 1] = NaN;
                N += 2;
                continue;
              }
              outline[N] = bottom[i + j];
              outline[N + 1] = bottom[i + j + 1];
              N += 2;
            }
          }
          __privateMethod(this, _FreeDrawOutliner_instances, getOutlineStart_fn).call(this, outline, N);
          return this.newFreeDrawOutline(outline, points, __privateGet(this, _box), __privateGet(this, _scaleFactor), __privateGet(this, _innerMargin), __privateGet(this, _isLTR));
        }
      };
      _box = new WeakMap();
      _bottom = new WeakMap();
      _innerMargin = new WeakMap();
      _isLTR = new WeakMap();
      _top = new WeakMap();
      _last = new WeakMap();
      _lastX = new WeakMap();
      _lastY = new WeakMap();
      _min = new WeakMap();
      _min_dist = new WeakMap();
      _scaleFactor = new WeakMap();
      _thickness = new WeakMap();
      _points = new WeakMap();
      _MIN_DIST = new WeakMap();
      _MIN_DIFF = new WeakMap();
      _MIN = new WeakMap();
      _FreeDrawOutliner_instances = new WeakSet();
      getLastCoords_fn = function() {
        const lastTop = __privateGet(this, _last).subarray(4, 6);
        const lastBottom = __privateGet(this, _last).subarray(16, 18);
        const [x, y, width, height] = __privateGet(this, _box);
        return [(__privateGet(this, _lastX) + (lastTop[0] - lastBottom[0]) / 2 - x) / width, (__privateGet(this, _lastY) + (lastTop[1] - lastBottom[1]) / 2 - y) / height, (__privateGet(this, _lastX) + (lastBottom[0] - lastTop[0]) / 2 - x) / width, (__privateGet(this, _lastY) + (lastBottom[1] - lastTop[1]) / 2 - y) / height];
      };
      toSVGPathTwoPoints_fn = function() {
        const [x, y, width, height] = __privateGet(this, _box);
        const [lastTopX, lastTopY, lastBottomX, lastBottomY] = __privateMethod(this, _FreeDrawOutliner_instances, getLastCoords_fn).call(this);
        return `M${(__privateGet(this, _last)[2] - x) / width} ${(__privateGet(this, _last)[3] - y) / height} L${(__privateGet(this, _last)[4] - x) / width} ${(__privateGet(this, _last)[5] - y) / height} L${lastTopX} ${lastTopY} L${lastBottomX} ${lastBottomY} L${(__privateGet(this, _last)[16] - x) / width} ${(__privateGet(this, _last)[17] - y) / height} L${(__privateGet(this, _last)[14] - x) / width} ${(__privateGet(this, _last)[15] - y) / height} Z`;
      };
      toSVGPathStart_fn = function(buffer) {
        const bottom = __privateGet(this, _bottom);
        buffer.push(`L${bottom[4]} ${bottom[5]} Z`);
      };
      toSVGPathEnd_fn = function(buffer) {
        const [x, y, width, height] = __privateGet(this, _box);
        const lastTop = __privateGet(this, _last).subarray(4, 6);
        const lastBottom = __privateGet(this, _last).subarray(16, 18);
        const [lastTopX, lastTopY, lastBottomX, lastBottomY] = __privateMethod(this, _FreeDrawOutliner_instances, getLastCoords_fn).call(this);
        buffer.push(`L${(lastTop[0] - x) / width} ${(lastTop[1] - y) / height} L${lastTopX} ${lastTopY} L${lastBottomX} ${lastBottomY} L${(lastBottom[0] - x) / width} ${(lastBottom[1] - y) / height}`);
      };
      getOutlineTwoPoints_fn = function(points) {
        const last2 = __privateGet(this, _last);
        const [layerX, layerY, layerWidth, layerHeight] = __privateGet(this, _box);
        const [lastTopX, lastTopY, lastBottomX, lastBottomY] = __privateMethod(this, _FreeDrawOutliner_instances, getLastCoords_fn).call(this);
        const outline = new Float32Array(36);
        outline.set([NaN, NaN, NaN, NaN, (last2[2] - layerX) / layerWidth, (last2[3] - layerY) / layerHeight, NaN, NaN, NaN, NaN, (last2[4] - layerX) / layerWidth, (last2[5] - layerY) / layerHeight, NaN, NaN, NaN, NaN, lastTopX, lastTopY, NaN, NaN, NaN, NaN, lastBottomX, lastBottomY, NaN, NaN, NaN, NaN, (last2[16] - layerX) / layerWidth, (last2[17] - layerY) / layerHeight, NaN, NaN, NaN, NaN, (last2[14] - layerX) / layerWidth, (last2[15] - layerY) / layerHeight], 0);
        return this.newFreeDrawOutline(outline, points, __privateGet(this, _box), __privateGet(this, _scaleFactor), __privateGet(this, _innerMargin), __privateGet(this, _isLTR));
      };
      getOutlineStart_fn = function(outline, pos) {
        const bottom = __privateGet(this, _bottom);
        outline.set([NaN, NaN, NaN, NaN, bottom[4], bottom[5]], pos);
        return pos += 6;
      };
      getOutlineEnd_fn = function(outline, pos) {
        const lastTop = __privateGet(this, _last).subarray(4, 6);
        const lastBottom = __privateGet(this, _last).subarray(16, 18);
        const [layerX, layerY, layerWidth, layerHeight] = __privateGet(this, _box);
        const [lastTopX, lastTopY, lastBottomX, lastBottomY] = __privateMethod(this, _FreeDrawOutliner_instances, getLastCoords_fn).call(this);
        outline.set([NaN, NaN, NaN, NaN, (lastTop[0] - layerX) / layerWidth, (lastTop[1] - layerY) / layerHeight, NaN, NaN, NaN, NaN, lastTopX, lastTopY, NaN, NaN, NaN, NaN, lastBottomX, lastBottomY, NaN, NaN, NaN, NaN, (lastBottom[0] - layerX) / layerWidth, (lastBottom[1] - layerY) / layerHeight], pos);
        return pos += 24;
      };
      __privateAdd(_FreeDrawOutliner, _MIN_DIST, 8);
      __privateAdd(_FreeDrawOutliner, _MIN_DIFF, 2);
      __privateAdd(_FreeDrawOutliner, _MIN, __privateGet(_FreeDrawOutliner, _MIN_DIST) + __privateGet(_FreeDrawOutliner, _MIN_DIFF));
      FreeDrawOutliner = _FreeDrawOutliner;
      FreeDrawOutline = class extends Outline {
        constructor(outline, points, box, scaleFactor, innerMargin, isLTR) {
          super();
          __privateAdd(this, _FreeDrawOutline_instances);
          __privateAdd(this, _box2);
          __privateAdd(this, _bbox, new Float32Array(4));
          __privateAdd(this, _innerMargin2);
          __privateAdd(this, _isLTR2);
          __privateAdd(this, _points2);
          __privateAdd(this, _scaleFactor2);
          __privateAdd(this, _outline);
          __privateSet(this, _outline, outline);
          __privateSet(this, _points2, points);
          __privateSet(this, _box2, box);
          __privateSet(this, _scaleFactor2, scaleFactor);
          __privateSet(this, _innerMargin2, innerMargin);
          __privateSet(this, _isLTR2, isLTR);
          this.firstPoint = [NaN, NaN];
          this.lastPoint = [NaN, NaN];
          __privateMethod(this, _FreeDrawOutline_instances, computeMinMax_fn).call(this, isLTR);
          const [x, y, width, height] = __privateGet(this, _bbox);
          for (let i = 0, ii = outline.length; i < ii; i += 2) {
            outline[i] = (outline[i] - x) / width;
            outline[i + 1] = (outline[i + 1] - y) / height;
          }
          for (let i = 0, ii = points.length; i < ii; i += 2) {
            points[i] = (points[i] - x) / width;
            points[i + 1] = (points[i + 1] - y) / height;
          }
        }
        toSVGPath() {
          const buffer = [`M${__privateGet(this, _outline)[4]} ${__privateGet(this, _outline)[5]}`];
          for (let i = 6, ii = __privateGet(this, _outline).length; i < ii; i += 6) {
            if (isNaN(__privateGet(this, _outline)[i])) {
              buffer.push(`L${__privateGet(this, _outline)[i + 4]} ${__privateGet(this, _outline)[i + 5]}`);
              continue;
            }
            buffer.push(`C${__privateGet(this, _outline)[i]} ${__privateGet(this, _outline)[i + 1]} ${__privateGet(this, _outline)[i + 2]} ${__privateGet(this, _outline)[i + 3]} ${__privateGet(this, _outline)[i + 4]} ${__privateGet(this, _outline)[i + 5]}`);
          }
          buffer.push("Z");
          return buffer.join(" ");
        }
        serialize([blX, blY, trX, trY], rotation) {
          const width = trX - blX;
          const height = trY - blY;
          let outline;
          let points;
          switch (rotation) {
            case 0:
              outline = Outline._rescale(__privateGet(this, _outline), blX, trY, width, -height);
              points = Outline._rescale(__privateGet(this, _points2), blX, trY, width, -height);
              break;
            case 90:
              outline = Outline._rescaleAndSwap(__privateGet(this, _outline), blX, blY, width, height);
              points = Outline._rescaleAndSwap(__privateGet(this, _points2), blX, blY, width, height);
              break;
            case 180:
              outline = Outline._rescale(__privateGet(this, _outline), trX, blY, -width, height);
              points = Outline._rescale(__privateGet(this, _points2), trX, blY, -width, height);
              break;
            case 270:
              outline = Outline._rescaleAndSwap(__privateGet(this, _outline), trX, trY, -width, -height);
              points = Outline._rescaleAndSwap(__privateGet(this, _points2), trX, trY, -width, -height);
              break;
          }
          return {
            outline: Array.from(outline),
            points: [Array.from(points)]
          };
        }
        get box() {
          return __privateGet(this, _bbox);
        }
        newOutliner(point, box, scaleFactor, thickness, isLTR, innerMargin = 0) {
          return new FreeDrawOutliner(point, box, scaleFactor, thickness, isLTR, innerMargin);
        }
        getNewOutline(thickness, innerMargin) {
          const [x, y, width, height] = __privateGet(this, _bbox);
          const [layerX, layerY, layerWidth, layerHeight] = __privateGet(this, _box2);
          const sx = width * layerWidth;
          const sy = height * layerHeight;
          const tx = x * layerWidth + layerX;
          const ty = y * layerHeight + layerY;
          const outliner = this.newOutliner({
            x: __privateGet(this, _points2)[0] * sx + tx,
            y: __privateGet(this, _points2)[1] * sy + ty
          }, __privateGet(this, _box2), __privateGet(this, _scaleFactor2), thickness, __privateGet(this, _isLTR2), innerMargin ?? __privateGet(this, _innerMargin2));
          for (let i = 2; i < __privateGet(this, _points2).length; i += 2) {
            outliner.add({
              x: __privateGet(this, _points2)[i] * sx + tx,
              y: __privateGet(this, _points2)[i + 1] * sy + ty
            });
          }
          return outliner.getOutlines();
        }
      };
      _box2 = new WeakMap();
      _bbox = new WeakMap();
      _innerMargin2 = new WeakMap();
      _isLTR2 = new WeakMap();
      _points2 = new WeakMap();
      _scaleFactor2 = new WeakMap();
      _outline = new WeakMap();
      _FreeDrawOutline_instances = new WeakSet();
      computeMinMax_fn = function(isLTR) {
        const outline = __privateGet(this, _outline);
        let lastX = outline[4];
        let lastY = outline[5];
        const minMax = [lastX, lastY, lastX, lastY];
        let firstPointX = lastX;
        let firstPointY = lastY;
        let lastPointX = lastX;
        let lastPointY = lastY;
        const ltrCallback = isLTR ? Math.max : Math.min;
        const bezierBbox = new Float32Array(4);
        for (let i = 6, ii = outline.length; i < ii; i += 6) {
          const x = outline[i + 4], y = outline[i + 5];
          if (isNaN(outline[i])) {
            Util.pointBoundingBox(x, y, minMax);
            if (firstPointY > y) {
              firstPointX = x;
              firstPointY = y;
            } else if (firstPointY === y) {
              firstPointX = ltrCallback(firstPointX, x);
            }
            if (lastPointY < y) {
              lastPointX = x;
              lastPointY = y;
            } else if (lastPointY === y) {
              lastPointX = ltrCallback(lastPointX, x);
            }
          } else {
            bezierBbox.set(BBOX_INIT, 0);
            Util.bezierBoundingBox(lastX, lastY, ...outline.slice(i, i + 6), bezierBbox);
            Util.rectBoundingBox(...bezierBbox, minMax);
            if (firstPointY > bezierBbox[1]) {
              firstPointX = bezierBbox[0];
              firstPointY = bezierBbox[1];
            } else if (firstPointY === bezierBbox[1]) {
              firstPointX = ltrCallback(firstPointX, bezierBbox[0]);
            }
            if (lastPointY < bezierBbox[3]) {
              lastPointX = bezierBbox[2];
              lastPointY = bezierBbox[3];
            } else if (lastPointY === bezierBbox[3]) {
              lastPointX = ltrCallback(lastPointX, bezierBbox[2]);
            }
          }
          lastX = x;
          lastY = y;
        }
        const bbox = __privateGet(this, _bbox);
        bbox[0] = minMax[0] - __privateGet(this, _innerMargin2);
        bbox[1] = minMax[1] - __privateGet(this, _innerMargin2);
        bbox[2] = minMax[2] - minMax[0] + 2 * __privateGet(this, _innerMargin2);
        bbox[3] = minMax[3] - minMax[1] + 2 * __privateGet(this, _innerMargin2);
        this.firstPoint = [firstPointX, firstPointY];
        this.lastPoint = [lastPointX, lastPointY];
      };
      HighlightOutliner = class {
        constructor(boxes, borderWidth = 0, innerMargin = 0, isLTR = true) {
          __privateAdd(this, _HighlightOutliner_instances);
          __privateAdd(this, _box3);
          __privateAdd(this, _firstPoint);
          __privateAdd(this, _lastPoint);
          __privateAdd(this, _verticalEdges, []);
          __privateAdd(this, _intervals, []);
          const minMax = BBOX_INIT.slice();
          const NUMBER_OF_DIGITS = 4;
          const EPSILON = 10 ** -NUMBER_OF_DIGITS;
          for (const {
            x,
            y,
            width,
            height
          } of boxes) {
            const x1 = Math.floor((x - borderWidth) / EPSILON) * EPSILON;
            const x2 = Math.ceil((x + width + borderWidth) / EPSILON) * EPSILON;
            const y1 = Math.floor((y - borderWidth) / EPSILON) * EPSILON;
            const y2 = Math.ceil((y + height + borderWidth) / EPSILON) * EPSILON;
            const left = [x1, y1, y2, true];
            const right = [x2, y1, y2, false];
            __privateGet(this, _verticalEdges).push(left, right);
            Util.rectBoundingBox(x1, y1, x2, y2, minMax);
          }
          const bboxWidth = minMax[2] - minMax[0] + 2 * innerMargin;
          const bboxHeight = minMax[3] - minMax[1] + 2 * innerMargin;
          const shiftedMinX = minMax[0] - innerMargin;
          const shiftedMinY = minMax[1] - innerMargin;
          let firstPointX = isLTR ? -Infinity : Infinity;
          let firstPointY = Infinity;
          const lastEdge = __privateGet(this, _verticalEdges).at(isLTR ? -1 : -2);
          const lastPoint = [lastEdge[0], lastEdge[2]];
          for (const edge of __privateGet(this, _verticalEdges)) {
            const [x, y1, y2, left] = edge;
            if (!left && isLTR) {
              if (y1 < firstPointY) {
                firstPointY = y1;
                firstPointX = x;
              } else if (y1 === firstPointY) {
                firstPointX = Math.max(firstPointX, x);
              }
            } else if (left && !isLTR) {
              if (y1 < firstPointY) {
                firstPointY = y1;
                firstPointX = x;
              } else if (y1 === firstPointY) {
                firstPointX = Math.min(firstPointX, x);
              }
            }
            edge[0] = (x - shiftedMinX) / bboxWidth;
            edge[1] = (y1 - shiftedMinY) / bboxHeight;
            edge[2] = (y2 - shiftedMinY) / bboxHeight;
          }
          __privateSet(this, _box3, new Float32Array([shiftedMinX, shiftedMinY, bboxWidth, bboxHeight]));
          __privateSet(this, _firstPoint, [firstPointX, firstPointY]);
          __privateSet(this, _lastPoint, lastPoint);
        }
        getOutlines() {
          __privateGet(this, _verticalEdges).sort((a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2]);
          const outlineVerticalEdges = [];
          for (const edge of __privateGet(this, _verticalEdges)) {
            if (edge[3]) {
              outlineVerticalEdges.push(...__privateMethod(this, _HighlightOutliner_instances, breakEdge_fn).call(this, edge));
              __privateMethod(this, _HighlightOutliner_instances, insert_fn).call(this, edge);
            } else {
              __privateMethod(this, _HighlightOutliner_instances, remove_fn).call(this, edge);
              outlineVerticalEdges.push(...__privateMethod(this, _HighlightOutliner_instances, breakEdge_fn).call(this, edge));
            }
          }
          return __privateMethod(this, _HighlightOutliner_instances, getOutlines_fn).call(this, outlineVerticalEdges);
        }
      };
      _box3 = new WeakMap();
      _firstPoint = new WeakMap();
      _lastPoint = new WeakMap();
      _verticalEdges = new WeakMap();
      _intervals = new WeakMap();
      _HighlightOutliner_instances = new WeakSet();
      getOutlines_fn = function(outlineVerticalEdges) {
        const edges = [];
        const allEdges = /* @__PURE__ */ new Set();
        for (const edge of outlineVerticalEdges) {
          const [x, y1, y2] = edge;
          edges.push([x, y1, edge], [x, y2, edge]);
        }
        edges.sort((a, b) => a[1] - b[1] || a[0] - b[0]);
        for (let i = 0, ii = edges.length; i < ii; i += 2) {
          const edge1 = edges[i][2];
          const edge2 = edges[i + 1][2];
          edge1.push(edge2);
          edge2.push(edge1);
          allEdges.add(edge1);
          allEdges.add(edge2);
        }
        const outlines = [];
        let outline;
        while (allEdges.size > 0) {
          const edge = allEdges.values().next().value;
          let [x, y1, y2, edge1, edge2] = edge;
          allEdges.delete(edge);
          let lastPointX = x;
          let lastPointY = y1;
          outline = [x, y2];
          outlines.push(outline);
          while (true) {
            let e;
            if (allEdges.has(edge1)) {
              e = edge1;
            } else if (allEdges.has(edge2)) {
              e = edge2;
            } else {
              break;
            }
            allEdges.delete(e);
            [x, y1, y2, edge1, edge2] = e;
            if (lastPointX !== x) {
              outline.push(lastPointX, lastPointY, x, lastPointY === y1 ? y1 : y2);
              lastPointX = x;
            }
            lastPointY = lastPointY === y1 ? y2 : y1;
          }
          outline.push(lastPointX, lastPointY);
        }
        return new HighlightOutline(outlines, __privateGet(this, _box3), __privateGet(this, _firstPoint), __privateGet(this, _lastPoint));
      };
      binarySearch_fn = function(y) {
        const array = __privateGet(this, _intervals);
        let start = 0;
        let end = array.length - 1;
        while (start <= end) {
          const middle = start + end >> 1;
          const y1 = array[middle][0];
          if (y1 === y) {
            return middle;
          }
          if (y1 < y) {
            start = middle + 1;
          } else {
            end = middle - 1;
          }
        }
        return end + 1;
      };
      insert_fn = function([, y1, y2]) {
        const index = __privateMethod(this, _HighlightOutliner_instances, binarySearch_fn).call(this, y1);
        __privateGet(this, _intervals).splice(index, 0, [y1, y2]);
      };
      remove_fn = function([, y1, y2]) {
        const index = __privateMethod(this, _HighlightOutliner_instances, binarySearch_fn).call(this, y1);
        for (let i = index; i < __privateGet(this, _intervals).length; i++) {
          const [start, end] = __privateGet(this, _intervals)[i];
          if (start !== y1) {
            break;
          }
          if (start === y1 && end === y2) {
            __privateGet(this, _intervals).splice(i, 1);
            return;
          }
        }
        for (let i = index - 1; i >= 0; i--) {
          const [start, end] = __privateGet(this, _intervals)[i];
          if (start !== y1) {
            break;
          }
          if (start === y1 && end === y2) {
            __privateGet(this, _intervals).splice(i, 1);
            return;
          }
        }
      };
      breakEdge_fn = function(edge) {
        const [x, y1, y2] = edge;
        const results = [[x, y1, y2]];
        const index = __privateMethod(this, _HighlightOutliner_instances, binarySearch_fn).call(this, y2);
        for (let i = 0; i < index; i++) {
          const [start, end] = __privateGet(this, _intervals)[i];
          for (let j = 0, jj = results.length; j < jj; j++) {
            const [, y3, y4] = results[j];
            if (end <= y3 || y4 <= start) {
              continue;
            }
            if (y3 >= start) {
              if (y4 > end) {
                results[j][1] = end;
              } else {
                if (jj === 1) {
                  return [];
                }
                results.splice(j, 1);
                j--;
                jj--;
              }
              continue;
            }
            results[j][2] = start;
            if (y4 > end) {
              results.push([x, end, y4]);
            }
          }
        }
        return results;
      };
      HighlightOutline = class extends Outline {
        constructor(outlines, box, firstPoint, lastPoint) {
          super();
          __privateAdd(this, _box4);
          __privateAdd(this, _outlines);
          __privateSet(this, _outlines, outlines);
          __privateSet(this, _box4, box);
          this.firstPoint = firstPoint;
          this.lastPoint = lastPoint;
        }
        toSVGPath() {
          const buffer = [];
          for (const polygon of __privateGet(this, _outlines)) {
            let [prevX, prevY] = polygon;
            buffer.push(`M${prevX} ${prevY}`);
            for (let i = 2; i < polygon.length; i += 2) {
              const x = polygon[i];
              const y = polygon[i + 1];
              if (x === prevX) {
                buffer.push(`V${y}`);
                prevY = y;
              } else if (y === prevY) {
                buffer.push(`H${x}`);
                prevX = x;
              }
            }
            buffer.push("Z");
          }
          return buffer.join(" ");
        }
        serialize([blX, blY, trX, trY], _rotation4) {
          const outlines = [];
          const width = trX - blX;
          const height = trY - blY;
          for (const outline of __privateGet(this, _outlines)) {
            const points = new Array(outline.length);
            for (let i = 0; i < outline.length; i += 2) {
              points[i] = blX + outline[i] * width;
              points[i + 1] = trY - outline[i + 1] * height;
            }
            outlines.push(points);
          }
          return outlines;
        }
        get box() {
          return __privateGet(this, _box4);
        }
      };
      _box4 = new WeakMap();
      _outlines = new WeakMap();
      FreeHighlightOutliner = class extends FreeDrawOutliner {
        newFreeDrawOutline(outline, points, box, scaleFactor, innerMargin, isLTR) {
          return new FreeHighlightOutline(outline, points, box, scaleFactor, innerMargin, isLTR);
        }
      };
      FreeHighlightOutline = class extends FreeDrawOutline {
        newOutliner(point, box, scaleFactor, thickness, isLTR, innerMargin = 0) {
          return new FreeHighlightOutliner(point, box, scaleFactor, thickness, isLTR, innerMargin);
        }
      };
      _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
        constructor(params) {
          super({
            ...params,
            name: "highlightEditor"
          });
          __privateAdd(this, _HighlightEditor_instances);
          __privateAdd(this, _anchorNode, null);
          __privateAdd(this, _anchorOffset, 0);
          __privateAdd(this, _boxes);
          __privateAdd(this, _clipPathId, null);
          __privateAdd(this, _colorPicker2, null);
          __privateAdd(this, _focusOutlines, null);
          __privateAdd(this, _focusNode, null);
          __privateAdd(this, _focusOffset, 0);
          __privateAdd(this, _highlightDiv, null);
          __privateAdd(this, _highlightOutlines, null);
          __privateAdd(this, _id4, null);
          __privateAdd(this, _isFreeHighlight, false);
          __privateAdd(this, _firstPoint2, null);
          __privateAdd(this, _lastPoint2, null);
          __privateAdd(this, _outlineId, null);
          __privateAdd(this, _text2, "");
          __privateAdd(this, _thickness2);
          __privateAdd(this, _methodOfCreation, "");
          this.color = params.color || _HighlightEditor._defaultColor;
          __privateSet(this, _thickness2, params.thickness || _HighlightEditor._defaultThickness);
          this.opacity = params.opacity || _HighlightEditor._defaultOpacity;
          __privateSet(this, _boxes, params.boxes || null);
          __privateSet(this, _methodOfCreation, params.methodOfCreation || "");
          __privateSet(this, _text2, params.text || "");
          this._isDraggable = false;
          this.defaultL10nId = "pdfjs-editor-highlight-editor";
          if (params.highlightId > -1) {
            __privateSet(this, _isFreeHighlight, true);
            __privateMethod(this, _HighlightEditor_instances, createFreeOutlines_fn).call(this, params);
            __privateMethod(this, _HighlightEditor_instances, addToDrawLayer_fn).call(this);
          } else if (__privateGet(this, _boxes)) {
            __privateSet(this, _anchorNode, params.anchorNode);
            __privateSet(this, _anchorOffset, params.anchorOffset);
            __privateSet(this, _focusNode, params.focusNode);
            __privateSet(this, _focusOffset, params.focusOffset);
            __privateMethod(this, _HighlightEditor_instances, createOutlines_fn).call(this);
            __privateMethod(this, _HighlightEditor_instances, addToDrawLayer_fn).call(this);
            this.rotate(this.rotation);
          }
          if (!this.annotationElementId) {
            this._uiManager.a11yAlert(AnnotationEditor._l10nAlert.highlight);
          }
        }
        static get _keyboardManager() {
          const proto = _HighlightEditor.prototype;
          return shadow(this, "_keyboardManager", new KeyboardManager([[["ArrowLeft"], proto._moveCaret, {
            args: [0]
          }], [["ArrowRight"], proto._moveCaret, {
            args: [1]
          }], [["ArrowUp"], proto._moveCaret, {
            args: [2]
          }], [["ArrowDown"], proto._moveCaret, {
            args: [3]
          }]]));
        }
        get telemetryInitialData() {
          return {
            action: "added",
            type: __privateGet(this, _isFreeHighlight) ? "free_highlight" : "highlight",
            color: this._uiManager.getNonHCMColorName(this.color),
            thickness: __privateGet(this, _thickness2),
            methodOfCreation: __privateGet(this, _methodOfCreation)
          };
        }
        get telemetryFinalData() {
          return {
            type: "highlight",
            color: this._uiManager.getNonHCMColorName(this.color)
          };
        }
        static computeTelemetryFinalData(data) {
          return {
            numberOfColors: data.get("color").size
          };
        }
        static initialize(l10n, uiManager) {
          AnnotationEditor.initialize(l10n, uiManager);
          _HighlightEditor._defaultColor || (_HighlightEditor._defaultColor = uiManager.highlightColors?.values().next().value || "#fff066");
        }
        static updateDefaultParams(type, value) {
          switch (type) {
            case AnnotationEditorParamsType.HIGHLIGHT_COLOR:
              _HighlightEditor._defaultColor = value;
              break;
            case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
              _HighlightEditor._defaultThickness = value;
              break;
          }
        }
        translateInPage(x, y) {
        }
        get toolbarPosition() {
          return __privateGet(this, _lastPoint2);
        }
        get commentButtonPosition() {
          return __privateGet(this, _firstPoint2);
        }
        updateParams(type, value) {
          switch (type) {
            case AnnotationEditorParamsType.HIGHLIGHT_COLOR:
              __privateMethod(this, _HighlightEditor_instances, updateColor_fn3).call(this, value);
              break;
            case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
              __privateMethod(this, _HighlightEditor_instances, updateThickness_fn).call(this, value);
              break;
          }
        }
        static get defaultPropertiesToUpdate() {
          return [[AnnotationEditorParamsType.HIGHLIGHT_COLOR, _HighlightEditor._defaultColor], [AnnotationEditorParamsType.HIGHLIGHT_THICKNESS, _HighlightEditor._defaultThickness]];
        }
        get propertiesToUpdate() {
          return [[AnnotationEditorParamsType.HIGHLIGHT_COLOR, this.color || _HighlightEditor._defaultColor], [AnnotationEditorParamsType.HIGHLIGHT_THICKNESS, __privateGet(this, _thickness2) || _HighlightEditor._defaultThickness], [AnnotationEditorParamsType.HIGHLIGHT_FREE, __privateGet(this, _isFreeHighlight)]];
        }
        onUpdatedColor() {
          this.parent?.drawLayer.updateProperties(__privateGet(this, _id4), {
            root: {
              fill: this.color,
              "fill-opacity": this.opacity
            }
          });
          __privateGet(this, _colorPicker2)?.updateColor(this.color);
          super.onUpdatedColor();
        }
        get toolbarButtons() {
          if (this._uiManager.highlightColors) {
            const colorPicker = __privateSet(this, _colorPicker2, new ColorPicker({
              editor: this
            }));
            return [["colorPicker", colorPicker]];
          }
          return super.toolbarButtons;
        }
        disableEditing() {
          super.disableEditing();
          this.div.classList.toggle("disabled", true);
        }
        enableEditing() {
          super.enableEditing();
          this.div.classList.toggle("disabled", false);
        }
        fixAndSetPosition() {
          return super.fixAndSetPosition(__privateMethod(this, _HighlightEditor_instances, getRotation_fn).call(this));
        }
        getBaseTranslation() {
          return [0, 0];
        }
        getRect(tx, ty) {
          return super.getRect(tx, ty, __privateMethod(this, _HighlightEditor_instances, getRotation_fn).call(this));
        }
        onceAdded(focus) {
          if (!this.annotationElementId) {
            this.parent.addUndoableEditor(this);
          }
          if (focus) {
            this.div.focus();
          }
        }
        remove() {
          __privateMethod(this, _HighlightEditor_instances, cleanDrawLayer_fn).call(this);
          this._reportTelemetry({
            action: "deleted"
          });
          super.remove();
        }
        rebuild() {
          if (!this.parent) {
            return;
          }
          super.rebuild();
          if (this.div === null) {
            return;
          }
          __privateMethod(this, _HighlightEditor_instances, addToDrawLayer_fn).call(this);
          if (!this.isAttachedToDOM) {
            this.parent.add(this);
          }
        }
        setParent(parent) {
          let mustBeSelected = false;
          if (this.parent && !parent) {
            __privateMethod(this, _HighlightEditor_instances, cleanDrawLayer_fn).call(this);
          } else if (parent) {
            __privateMethod(this, _HighlightEditor_instances, addToDrawLayer_fn).call(this, parent);
            mustBeSelected = !this.parent && this.div?.classList.contains("selectedEditor");
          }
          super.setParent(parent);
          this.show(this._isVisible);
          if (mustBeSelected) {
            this.select();
          }
        }
        rotate(angle) {
          var _a, _b, _c;
          const {
            drawLayer
          } = this.parent;
          let box;
          if (__privateGet(this, _isFreeHighlight)) {
            angle = (angle - this.rotation + 360) % 360;
            box = __privateMethod(_a = _HighlightEditor, _HighlightEditor_static, rotateBbox_fn).call(_a, __privateGet(this, _highlightOutlines).box, angle);
          } else {
            box = __privateMethod(_b = _HighlightEditor, _HighlightEditor_static, rotateBbox_fn).call(_b, [this.x, this.y, this.width, this.height], angle);
          }
          drawLayer.updateProperties(__privateGet(this, _id4), {
            bbox: box,
            root: {
              "data-main-rotation": angle
            }
          });
          drawLayer.updateProperties(__privateGet(this, _outlineId), {
            bbox: __privateMethod(_c = _HighlightEditor, _HighlightEditor_static, rotateBbox_fn).call(_c, __privateGet(this, _focusOutlines).box, angle),
            root: {
              "data-main-rotation": angle
            }
          });
        }
        render() {
          if (this.div) {
            return this.div;
          }
          const div = super.render();
          if (__privateGet(this, _text2)) {
            div.setAttribute("aria-label", __privateGet(this, _text2));
            div.setAttribute("role", "mark");
          }
          if (__privateGet(this, _isFreeHighlight)) {
            div.classList.add("free");
          } else {
            this.div.addEventListener("keydown", __privateMethod(this, _HighlightEditor_instances, keydown_fn).bind(this), {
              signal: this._uiManager._signal
            });
          }
          const highlightDiv = __privateSet(this, _highlightDiv, document.createElement("div"));
          div.append(highlightDiv);
          highlightDiv.setAttribute("aria-hidden", "true");
          highlightDiv.className = "internal";
          highlightDiv.style.clipPath = __privateGet(this, _clipPathId);
          this.setDims();
          bindEvents(this, __privateGet(this, _highlightDiv), ["pointerover", "pointerleave"]);
          this.enableEditing();
          return div;
        }
        pointerover() {
          if (!this.isSelected) {
            this.parent?.drawLayer.updateProperties(__privateGet(this, _outlineId), {
              rootClass: {
                hovered: true
              }
            });
          }
        }
        pointerleave() {
          if (!this.isSelected) {
            this.parent?.drawLayer.updateProperties(__privateGet(this, _outlineId), {
              rootClass: {
                hovered: false
              }
            });
          }
        }
        _moveCaret(direction) {
          this.parent.unselect(this);
          switch (direction) {
            case 0:
            case 2:
              __privateMethod(this, _HighlightEditor_instances, setCaret_fn).call(this, true);
              break;
            case 1:
            case 3:
              __privateMethod(this, _HighlightEditor_instances, setCaret_fn).call(this, false);
              break;
          }
        }
        select() {
          super.select();
          if (!__privateGet(this, _outlineId)) {
            return;
          }
          this.parent?.drawLayer.updateProperties(__privateGet(this, _outlineId), {
            rootClass: {
              hovered: false,
              selected: true
            }
          });
        }
        unselect() {
          super.unselect();
          if (!__privateGet(this, _outlineId)) {
            return;
          }
          this.parent?.drawLayer.updateProperties(__privateGet(this, _outlineId), {
            rootClass: {
              selected: false
            }
          });
          if (!__privateGet(this, _isFreeHighlight)) {
            __privateMethod(this, _HighlightEditor_instances, setCaret_fn).call(this, false);
          }
        }
        get _mustFixPosition() {
          return !__privateGet(this, _isFreeHighlight);
        }
        show(visible = this._isVisible) {
          super.show(visible);
          if (this.parent) {
            this.parent.drawLayer.updateProperties(__privateGet(this, _id4), {
              rootClass: {
                hidden: !visible
              }
            });
            this.parent.drawLayer.updateProperties(__privateGet(this, _outlineId), {
              rootClass: {
                hidden: !visible
              }
            });
          }
        }
        static startHighlighting(parent, isLTR, {
          target: textLayer,
          x,
          y
        }) {
          const {
            x: layerX,
            y: layerY,
            width: parentWidth,
            height: parentHeight
          } = textLayer.getBoundingClientRect();
          const ac = new AbortController();
          const signal = parent.combinedSignal(ac);
          const pointerUpCallback = (e) => {
            ac.abort();
            __privateMethod(this, _HighlightEditor_static, endHighlight_fn).call(this, parent, e);
          };
          window.addEventListener("blur", pointerUpCallback, {
            signal
          });
          window.addEventListener("pointerup", pointerUpCallback, {
            signal
          });
          window.addEventListener("pointerdown", stopEvent, {
            capture: true,
            passive: false,
            signal
          });
          window.addEventListener("contextmenu", noContextMenu, {
            signal
          });
          textLayer.addEventListener("pointermove", __privateMethod(this, _HighlightEditor_static, highlightMove_fn).bind(this, parent), {
            signal
          });
          this._freeHighlight = new FreeHighlightOutliner({
            x,
            y
          }, [layerX, layerY, parentWidth, parentHeight], parent.scale, this._defaultThickness / 2, isLTR, 1e-3);
          ({
            id: this._freeHighlightId,
            clipPathId: this._freeHighlightClipId
          } = parent.drawLayer.draw({
            bbox: [0, 0, 1, 1],
            root: {
              viewBox: "0 0 1 1",
              fill: this._defaultColor,
              "fill-opacity": this._defaultOpacity
            },
            rootClass: {
              highlight: true,
              free: true
            },
            path: {
              d: this._freeHighlight.toSVGPath()
            }
          }, true, true));
        }
        static async deserialize(data, parent, uiManager) {
          var _a, _b, _c, _d;
          let initialData = null;
          if (data instanceof HighlightAnnotationElement) {
            const {
              data: {
                quadPoints: quadPoints2,
                rect,
                rotation,
                id,
                color: color2,
                opacity: opacity2,
                popupRef,
                richText,
                contentsObj,
                creationDate,
                modificationDate
              },
              parent: {
                page: {
                  pageNumber
                }
              }
            } = data;
            initialData = data = {
              annotationType: AnnotationEditorType.HIGHLIGHT,
              color: Array.from(color2),
              opacity: opacity2,
              quadPoints: quadPoints2,
              boxes: null,
              pageIndex: pageNumber - 1,
              rect: rect.slice(0),
              rotation,
              annotationElementId: id,
              id,
              deleted: false,
              popupRef,
              richText,
              comment: contentsObj?.str || null,
              creationDate,
              modificationDate
            };
          } else if (data instanceof InkAnnotationElement) {
            const {
              data: {
                inkLists: inkLists2,
                rect,
                rotation,
                id,
                color: color2,
                borderStyle: {
                  rawWidth: thickness
                },
                popupRef,
                richText,
                contentsObj,
                creationDate,
                modificationDate
              },
              parent: {
                page: {
                  pageNumber
                }
              }
            } = data;
            initialData = data = {
              annotationType: AnnotationEditorType.HIGHLIGHT,
              color: Array.from(color2),
              thickness,
              inkLists: inkLists2,
              boxes: null,
              pageIndex: pageNumber - 1,
              rect: rect.slice(0),
              rotation,
              annotationElementId: id,
              id,
              deleted: false,
              popupRef,
              richText,
              comment: contentsObj?.str || null,
              creationDate,
              modificationDate
            };
          }
          const {
            color,
            quadPoints,
            inkLists,
            outlines,
            opacity
          } = data;
          const editor = await super.deserialize(data, parent, uiManager);
          editor.color = Util.makeHexColor(...color);
          editor.opacity = opacity || 1;
          if (inkLists) {
            __privateSet(editor, _thickness2, data.thickness);
          }
          editor._initialData = initialData;
          if (data.comment) {
            editor.setCommentData(data);
          }
          const [pageWidth, pageHeight] = editor.pageDimensions;
          const [pageX, pageY] = editor.pageTranslation;
          if (quadPoints) {
            const boxes = __privateSet(editor, _boxes, []);
            for (let i = 0; i < quadPoints.length; i += 8) {
              boxes.push({
                x: (quadPoints[i] - pageX) / pageWidth,
                y: 1 - (quadPoints[i + 1] - pageY) / pageHeight,
                width: (quadPoints[i + 2] - quadPoints[i]) / pageWidth,
                height: (quadPoints[i + 1] - quadPoints[i + 5]) / pageHeight
              });
            }
            __privateMethod(_a = editor, _HighlightEditor_instances, createOutlines_fn).call(_a);
            __privateMethod(_b = editor, _HighlightEditor_instances, addToDrawLayer_fn).call(_b);
            editor.rotate(editor.rotation);
          } else if (inkLists || outlines) {
            __privateSet(editor, _isFreeHighlight, true);
            const points = (inkLists || outlines.points)[0];
            const point = {
              x: points[0] - pageX,
              y: pageHeight - (points[1] - pageY)
            };
            const outliner = new FreeHighlightOutliner(point, [0, 0, pageWidth, pageHeight], 1, __privateGet(editor, _thickness2) / 2, true, 1e-3);
            for (let i = 0, ii = points.length; i < ii; i += 2) {
              point.x = points[i] - pageX;
              point.y = pageHeight - (points[i + 1] - pageY);
              outliner.add(point);
            }
            const {
              id,
              clipPathId
            } = parent.drawLayer.draw({
              bbox: [0, 0, 1, 1],
              root: {
                viewBox: "0 0 1 1",
                fill: editor.color,
                "fill-opacity": editor._defaultOpacity
              },
              rootClass: {
                highlight: true,
                free: true
              },
              path: {
                d: outliner.toSVGPath()
              }
            }, true, true);
            __privateMethod(_c = editor, _HighlightEditor_instances, createFreeOutlines_fn).call(_c, {
              highlightOutlines: outliner.getOutlines(),
              highlightId: id,
              clipPathId
            });
            __privateMethod(_d = editor, _HighlightEditor_instances, addToDrawLayer_fn).call(_d);
            editor.rotate(editor.parentRotation);
          }
          return editor;
        }
        serialize(isForCopying = false) {
          if (this.isEmpty() || isForCopying) {
            return null;
          }
          if (this.deleted) {
            return this.serializeDeleted();
          }
          const color = AnnotationEditor._colorManager.convert(this._uiManager.getNonHCMColor(this.color));
          const serialized = super.serialize(isForCopying);
          Object.assign(serialized, {
            color,
            opacity: this.opacity,
            thickness: __privateGet(this, _thickness2),
            quadPoints: __privateMethod(this, _HighlightEditor_instances, serializeBoxes_fn).call(this),
            outlines: __privateMethod(this, _HighlightEditor_instances, serializeOutlines_fn).call(this, serialized.rect)
          });
          this.addComment(serialized);
          if (this.annotationElementId && !__privateMethod(this, _HighlightEditor_instances, hasElementChanged_fn2).call(this, serialized)) {
            return null;
          }
          serialized.id = this.annotationElementId;
          return serialized;
        }
        renderAnnotationElement(annotation) {
          if (this.deleted) {
            annotation.hide();
            return null;
          }
          annotation.updateEdited({
            rect: this.getPDFRect(),
            popup: this.comment
          });
          return null;
        }
        static canCreateNewEmptyEditor() {
          return false;
        }
      };
      _anchorNode = new WeakMap();
      _anchorOffset = new WeakMap();
      _boxes = new WeakMap();
      _clipPathId = new WeakMap();
      _colorPicker2 = new WeakMap();
      _focusOutlines = new WeakMap();
      _focusNode = new WeakMap();
      _focusOffset = new WeakMap();
      _highlightDiv = new WeakMap();
      _highlightOutlines = new WeakMap();
      _id4 = new WeakMap();
      _isFreeHighlight = new WeakMap();
      _firstPoint2 = new WeakMap();
      _lastPoint2 = new WeakMap();
      _outlineId = new WeakMap();
      _text2 = new WeakMap();
      _thickness2 = new WeakMap();
      _methodOfCreation = new WeakMap();
      _HighlightEditor_instances = new WeakSet();
      createOutlines_fn = function() {
        const outliner = new HighlightOutliner(__privateGet(this, _boxes), 1e-3);
        __privateSet(this, _highlightOutlines, outliner.getOutlines());
        [this.x, this.y, this.width, this.height] = __privateGet(this, _highlightOutlines).box;
        const outlinerForOutline = new HighlightOutliner(__privateGet(this, _boxes), 25e-4, 1e-3, this._uiManager.direction === "ltr");
        __privateSet(this, _focusOutlines, outlinerForOutline.getOutlines());
        const {
          firstPoint
        } = __privateGet(this, _highlightOutlines);
        __privateSet(this, _firstPoint2, [(firstPoint[0] - this.x) / this.width, (firstPoint[1] - this.y) / this.height]);
        const {
          lastPoint
        } = __privateGet(this, _focusOutlines);
        __privateSet(this, _lastPoint2, [(lastPoint[0] - this.x) / this.width, (lastPoint[1] - this.y) / this.height]);
      };
      createFreeOutlines_fn = function({
        highlightOutlines,
        highlightId,
        clipPathId
      }) {
        var _a, _b;
        __privateSet(this, _highlightOutlines, highlightOutlines);
        const extraThickness = 1.5;
        __privateSet(this, _focusOutlines, highlightOutlines.getNewOutline(__privateGet(this, _thickness2) / 2 + extraThickness, 25e-4));
        if (highlightId >= 0) {
          __privateSet(this, _id4, highlightId);
          __privateSet(this, _clipPathId, clipPathId);
          this.parent.drawLayer.finalizeDraw(highlightId, {
            bbox: highlightOutlines.box,
            path: {
              d: highlightOutlines.toSVGPath()
            }
          });
          __privateSet(this, _outlineId, this.parent.drawLayer.drawOutline({
            rootClass: {
              highlightOutline: true,
              free: true
            },
            bbox: __privateGet(this, _focusOutlines).box,
            path: {
              d: __privateGet(this, _focusOutlines).toSVGPath()
            }
          }, true));
        } else if (this.parent) {
          const angle = this.parent.viewport.rotation;
          this.parent.drawLayer.updateProperties(__privateGet(this, _id4), {
            bbox: __privateMethod(_a = _HighlightEditor, _HighlightEditor_static, rotateBbox_fn).call(_a, __privateGet(this, _highlightOutlines).box, (angle - this.rotation + 360) % 360),
            path: {
              d: highlightOutlines.toSVGPath()
            }
          });
          this.parent.drawLayer.updateProperties(__privateGet(this, _outlineId), {
            bbox: __privateMethod(_b = _HighlightEditor, _HighlightEditor_static, rotateBbox_fn).call(_b, __privateGet(this, _focusOutlines).box, angle),
            path: {
              d: __privateGet(this, _focusOutlines).toSVGPath()
            }
          });
        }
        const [x, y, width, height] = highlightOutlines.box;
        switch (this.rotation) {
          case 0:
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            break;
          case 90: {
            const [pageWidth, pageHeight] = this.parentDimensions;
            this.x = y;
            this.y = 1 - x;
            this.width = width * pageHeight / pageWidth;
            this.height = height * pageWidth / pageHeight;
            break;
          }
          case 180:
            this.x = 1 - x;
            this.y = 1 - y;
            this.width = width;
            this.height = height;
            break;
          case 270: {
            const [pageWidth, pageHeight] = this.parentDimensions;
            this.x = 1 - y;
            this.y = x;
            this.width = width * pageHeight / pageWidth;
            this.height = height * pageWidth / pageHeight;
            break;
          }
        }
        const {
          firstPoint
        } = highlightOutlines;
        __privateSet(this, _firstPoint2, [(firstPoint[0] - x) / width, (firstPoint[1] - y) / height]);
        const {
          lastPoint
        } = __privateGet(this, _focusOutlines);
        __privateSet(this, _lastPoint2, [(lastPoint[0] - x) / width, (lastPoint[1] - y) / height]);
      };
      updateColor_fn3 = function(color) {
        const setColorAndOpacity = (col, opa) => {
          this.color = col;
          this.opacity = opa;
          this.onUpdatedColor();
        };
        const savedColor = this.color;
        const savedOpacity = this.opacity;
        this.addCommands({
          cmd: setColorAndOpacity.bind(this, color, _HighlightEditor._defaultOpacity),
          undo: setColorAndOpacity.bind(this, savedColor, savedOpacity),
          post: this._uiManager.updateUI.bind(this._uiManager, this),
          mustExec: true,
          type: AnnotationEditorParamsType.HIGHLIGHT_COLOR,
          overwriteIfSameType: true,
          keepUndo: true
        });
        this._reportTelemetry({
          action: "color_changed",
          color: this._uiManager.getNonHCMColorName(color)
        }, true);
      };
      updateThickness_fn = function(thickness) {
        const savedThickness = __privateGet(this, _thickness2);
        const setThickness = (th) => {
          __privateSet(this, _thickness2, th);
          __privateMethod(this, _HighlightEditor_instances, changeThickness_fn).call(this, th);
        };
        this.addCommands({
          cmd: setThickness.bind(this, thickness),
          undo: setThickness.bind(this, savedThickness),
          post: this._uiManager.updateUI.bind(this._uiManager, this),
          mustExec: true,
          type: AnnotationEditorParamsType.INK_THICKNESS,
          overwriteIfSameType: true,
          keepUndo: true
        });
        this._reportTelemetry({
          action: "thickness_changed",
          thickness
        }, true);
      };
      changeThickness_fn = function(thickness) {
        if (!__privateGet(this, _isFreeHighlight)) {
          return;
        }
        __privateMethod(this, _HighlightEditor_instances, createFreeOutlines_fn).call(this, {
          highlightOutlines: __privateGet(this, _highlightOutlines).getNewOutline(thickness / 2)
        });
        this.fixAndSetPosition();
        this.setDims();
      };
      cleanDrawLayer_fn = function() {
        if (__privateGet(this, _id4) === null || !this.parent) {
          return;
        }
        this.parent.drawLayer.remove(__privateGet(this, _id4));
        __privateSet(this, _id4, null);
        this.parent.drawLayer.remove(__privateGet(this, _outlineId));
        __privateSet(this, _outlineId, null);
      };
      addToDrawLayer_fn = function(parent = this.parent) {
        if (__privateGet(this, _id4) !== null) {
          return;
        }
        ({
          id: __privateWrapper(this, _id4)._,
          clipPathId: __privateWrapper(this, _clipPathId)._
        } = parent.drawLayer.draw({
          bbox: __privateGet(this, _highlightOutlines).box,
          root: {
            viewBox: "0 0 1 1",
            fill: this.color,
            "fill-opacity": this.opacity
          },
          rootClass: {
            highlight: true,
            free: __privateGet(this, _isFreeHighlight)
          },
          path: {
            d: __privateGet(this, _highlightOutlines).toSVGPath()
          }
        }, false, true));
        __privateSet(this, _outlineId, parent.drawLayer.drawOutline({
          rootClass: {
            highlightOutline: true,
            free: __privateGet(this, _isFreeHighlight)
          },
          bbox: __privateGet(this, _focusOutlines).box,
          path: {
            d: __privateGet(this, _focusOutlines).toSVGPath()
          }
        }, __privateGet(this, _isFreeHighlight)));
        if (__privateGet(this, _highlightDiv)) {
          __privateGet(this, _highlightDiv).style.clipPath = __privateGet(this, _clipPathId);
        }
      };
      _HighlightEditor_static = new WeakSet();
      rotateBbox_fn = function([x, y, width, height], angle) {
        switch (angle) {
          case 90:
            return [1 - y - height, x, height, width];
          case 180:
            return [1 - x - width, 1 - y - height, width, height];
          case 270:
            return [y, 1 - x - width, height, width];
        }
        return [x, y, width, height];
      };
      keydown_fn = function(event) {
        _HighlightEditor._keyboardManager.exec(this, event);
      };
      setCaret_fn = function(start) {
        if (!__privateGet(this, _anchorNode)) {
          return;
        }
        const selection = window.getSelection();
        if (start) {
          selection.setPosition(__privateGet(this, _anchorNode), __privateGet(this, _anchorOffset));
        } else {
          selection.setPosition(__privateGet(this, _focusNode), __privateGet(this, _focusOffset));
        }
      };
      getRotation_fn = function() {
        return __privateGet(this, _isFreeHighlight) ? this.rotation : 0;
      };
      serializeBoxes_fn = function() {
        if (__privateGet(this, _isFreeHighlight)) {
          return null;
        }
        const [pageWidth, pageHeight] = this.pageDimensions;
        const [pageX, pageY] = this.pageTranslation;
        const boxes = __privateGet(this, _boxes);
        const quadPoints = new Float32Array(boxes.length * 8);
        let i = 0;
        for (const {
          x,
          y,
          width,
          height
        } of boxes) {
          const sx = x * pageWidth + pageX;
          const sy = (1 - y) * pageHeight + pageY;
          quadPoints[i] = quadPoints[i + 4] = sx;
          quadPoints[i + 1] = quadPoints[i + 3] = sy;
          quadPoints[i + 2] = quadPoints[i + 6] = sx + width * pageWidth;
          quadPoints[i + 5] = quadPoints[i + 7] = sy - height * pageHeight;
          i += 8;
        }
        return quadPoints;
      };
      serializeOutlines_fn = function(rect) {
        return __privateGet(this, _highlightOutlines).serialize(rect, __privateMethod(this, _HighlightEditor_instances, getRotation_fn).call(this));
      };
      highlightMove_fn = function(parent, event) {
        if (this._freeHighlight.add(event)) {
          parent.drawLayer.updateProperties(this._freeHighlightId, {
            path: {
              d: this._freeHighlight.toSVGPath()
            }
          });
        }
      };
      endHighlight_fn = function(parent, event) {
        if (!this._freeHighlight.isEmpty()) {
          parent.createAndAddNewEditor(event, false, {
            highlightId: this._freeHighlightId,
            highlightOutlines: this._freeHighlight.getOutlines(),
            clipPathId: this._freeHighlightClipId,
            methodOfCreation: "main_toolbar"
          });
        } else {
          parent.drawLayer.remove(this._freeHighlightId);
        }
        this._freeHighlightId = -1;
        this._freeHighlight = null;
        this._freeHighlightClipId = "";
      };
      hasElementChanged_fn2 = function(serialized) {
        const {
          color
        } = this._initialData;
        return this.hasEditedComment || serialized.color.some((c, i) => c !== color[i]);
      };
      __privateAdd(_HighlightEditor, _HighlightEditor_static);
      __publicField(_HighlightEditor, "_defaultColor", null);
      __publicField(_HighlightEditor, "_defaultOpacity", 1);
      __publicField(_HighlightEditor, "_defaultThickness", 12);
      __publicField(_HighlightEditor, "_type", "highlight");
      __publicField(_HighlightEditor, "_editorType", AnnotationEditorType.HIGHLIGHT);
      __publicField(_HighlightEditor, "_freeHighlightId", -1);
      __publicField(_HighlightEditor, "_freeHighlight", null);
      __publicField(_HighlightEditor, "_freeHighlightClipId", "");
      HighlightEditor = _HighlightEditor;
      DrawingOptions = class {
        constructor() {
          __privateAdd(this, _svgProperties, /* @__PURE__ */ Object.create(null));
        }
        updateProperty(name, value) {
          this[name] = value;
          this.updateSVGProperty(name, value);
        }
        updateProperties(properties) {
          if (!properties) {
            return;
          }
          for (const [name, value] of Object.entries(properties)) {
            if (!name.startsWith("_")) {
              this.updateProperty(name, value);
            }
          }
        }
        updateSVGProperty(name, value) {
          __privateGet(this, _svgProperties)[name] = value;
        }
        toSVGProperties() {
          const root3 = __privateGet(this, _svgProperties);
          __privateSet(this, _svgProperties, /* @__PURE__ */ Object.create(null));
          return {
            root: root3
          };
        }
        reset() {
          __privateSet(this, _svgProperties, /* @__PURE__ */ Object.create(null));
        }
        updateAll(options = this) {
          this.updateProperties(options);
        }
        clone() {
          unreachable("Not implemented");
        }
      };
      _svgProperties = new WeakMap();
      _DrawingEditor = class _DrawingEditor extends AnnotationEditor {
        constructor(params) {
          super(params);
          __privateAdd(this, _DrawingEditor_instances);
          __privateAdd(this, _drawOutlines, null);
          __privateAdd(this, _mustBeCommitted);
          __publicField(this, "_colorPicker", null);
          __publicField(this, "_drawId", null);
          __privateSet(this, _mustBeCommitted, params.mustBeCommitted || false);
          this._addOutlines(params);
        }
        onUpdatedColor() {
          this._colorPicker?.update(this.color);
          super.onUpdatedColor();
        }
        onUpdatedOpacity() {
          this._colorPicker?.updateOpacity?.(this.opacity);
        }
        _addOutlines(params) {
          if (params.drawOutlines) {
            __privateMethod(this, _DrawingEditor_instances, createDrawOutlines_fn).call(this, params);
            __privateMethod(this, _DrawingEditor_instances, addToDrawLayer_fn2).call(this);
          }
        }
        static _mergeSVGProperties(p1, p2) {
          const p1Keys = new Set(Object.keys(p1));
          for (const [key, value] of Object.entries(p2)) {
            if (p1Keys.has(key)) {
              Object.assign(p1[key], value);
            } else {
              p1[key] = value;
            }
          }
          return p1;
        }
        static getDefaultDrawingOptions(_options) {
          unreachable("Not implemented");
        }
        static get typesMap() {
          unreachable("Not implemented");
        }
        static get isDrawer() {
          return true;
        }
        static get supportMultipleDrawings() {
          return false;
        }
        static updateDefaultParams(type, value) {
          const propertyName = this.typesMap.get(type);
          if (propertyName) {
            this._defaultDrawingOptions.updateProperty(propertyName, value);
          }
          if (this._currentParent) {
            __privateGet(_DrawingEditor, _currentDraw).updateProperty(propertyName, value);
            this._currentParent.drawLayer.updateProperties(this._currentDrawId, this._defaultDrawingOptions.toSVGProperties());
          }
        }
        updateParams(type, value) {
          const propertyName = this.constructor.typesMap.get(type);
          if (propertyName) {
            this._updateProperty(type, propertyName, value);
          }
        }
        static get defaultPropertiesToUpdate() {
          const properties = [];
          const options = this._defaultDrawingOptions;
          for (const [type, name] of this.typesMap) {
            properties.push([type, options[name]]);
          }
          return properties;
        }
        get propertiesToUpdate() {
          const properties = [];
          const {
            _drawingOptions
          } = this;
          for (const [type, name] of this.constructor.typesMap) {
            properties.push([type, _drawingOptions[name]]);
          }
          return properties;
        }
        _updateProperty(type, name, value) {
          const options = this._drawingOptions;
          const savedValue = options[name];
          const setter = (val) => {
            options.updateProperty(name, val);
            const bbox = __privateGet(this, _drawOutlines).updateProperty(name, val);
            if (bbox) {
              __privateMethod(this, _DrawingEditor_instances, updateBbox_fn).call(this, bbox);
            }
            this.parent?.drawLayer.updateProperties(this._drawId, options.toSVGProperties());
            if (type === this.colorType) {
              this.onUpdatedColor();
            } else if (type === this.opacityType) {
              this.onUpdatedOpacity();
            }
          };
          this.addCommands({
            cmd: setter.bind(this, value),
            undo: setter.bind(this, savedValue),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: true,
            type,
            overwriteIfSameType: true,
            keepUndo: true
          });
        }
        _updateColorAndOpacity(color, opacity) {
          const colorName = this.constructor.typesMap.get(this.colorType);
          const opacityName = this.constructor.typesMap.get(this.opacityType);
          const options = this._drawingOptions;
          const savedColor = options[colorName];
          const savedOpacity = options[opacityName];
          const setter = (c, op) => {
            options.updateProperty(colorName, c);
            options.updateProperty(opacityName, op);
            __privateGet(this, _drawOutlines).updateProperty(colorName, c);
            __privateGet(this, _drawOutlines).updateProperty(opacityName, op);
            this.parent?.drawLayer.updateProperties(this._drawId, options.toSVGProperties());
            this.onUpdatedColor();
            this.onUpdatedOpacity();
          };
          this.addCommands({
            cmd: setter.bind(this, color, opacity),
            undo: setter.bind(this, savedColor, savedOpacity),
            post: this._uiManager.updateUI.bind(this._uiManager, this),
            mustExec: true,
            type: AnnotationEditorParamsType.INK_COLOR_AND_OPACITY,
            overwriteIfSameType: true,
            keepUndo: true
          });
        }
        _onResizing() {
          this.parent?.drawLayer.updateProperties(this._drawId, _DrawingEditor._mergeSVGProperties(__privateGet(this, _drawOutlines).getPathResizingSVGProperties(__privateMethod(this, _DrawingEditor_instances, convertToDrawSpace_fn).call(this)), {
            bbox: __privateMethod(this, _DrawingEditor_instances, rotateBox_fn).call(this)
          }));
        }
        _onResized() {
          this.parent?.drawLayer.updateProperties(this._drawId, _DrawingEditor._mergeSVGProperties(__privateGet(this, _drawOutlines).getPathResizedSVGProperties(__privateMethod(this, _DrawingEditor_instances, convertToDrawSpace_fn).call(this)), {
            bbox: __privateMethod(this, _DrawingEditor_instances, rotateBox_fn).call(this)
          }));
        }
        _onTranslating(_x, _y) {
          this.parent?.drawLayer.updateProperties(this._drawId, {
            bbox: __privateMethod(this, _DrawingEditor_instances, rotateBox_fn).call(this)
          });
        }
        _onTranslated() {
          this.parent?.drawLayer.updateProperties(this._drawId, _DrawingEditor._mergeSVGProperties(__privateGet(this, _drawOutlines).getPathTranslatedSVGProperties(__privateMethod(this, _DrawingEditor_instances, convertToDrawSpace_fn).call(this), this.parentDimensions), {
            bbox: __privateMethod(this, _DrawingEditor_instances, rotateBox_fn).call(this)
          }));
        }
        _onStartDragging() {
          this.parent?.drawLayer.updateProperties(this._drawId, {
            rootClass: {
              moving: true
            }
          });
        }
        _onStopDragging() {
          this.parent?.drawLayer.updateProperties(this._drawId, {
            rootClass: {
              moving: false
            }
          });
        }
        commit() {
          super.commit();
          this.disableEditMode();
          this.disableEditing();
        }
        disableEditing() {
          super.disableEditing();
          this.div.classList.toggle("disabled", true);
        }
        enableEditing() {
          super.enableEditing();
          this.div.classList.toggle("disabled", false);
        }
        getBaseTranslation() {
          return [0, 0];
        }
        get isResizable() {
          return true;
        }
        onceAdded(focus) {
          if (!this.annotationElementId) {
            this.parent.addUndoableEditor(this);
          }
          this._isDraggable = true;
          if (__privateGet(this, _mustBeCommitted)) {
            __privateSet(this, _mustBeCommitted, false);
            this.commit();
            this.parent.setSelected(this);
            if (focus && this.isOnScreen) {
              this.div.focus();
            }
          }
        }
        remove() {
          __privateMethod(this, _DrawingEditor_instances, cleanDrawLayer_fn2).call(this);
          super.remove();
        }
        rebuild() {
          if (!this.parent) {
            return;
          }
          super.rebuild();
          if (this.div === null) {
            return;
          }
          __privateMethod(this, _DrawingEditor_instances, addToDrawLayer_fn2).call(this);
          __privateMethod(this, _DrawingEditor_instances, updateBbox_fn).call(this, __privateGet(this, _drawOutlines).box);
          if (!this.isAttachedToDOM) {
            this.parent.add(this);
          }
        }
        setParent(parent) {
          let mustBeSelected = false;
          if (this.parent && !parent) {
            this._uiManager.removeShouldRescale(this);
            __privateMethod(this, _DrawingEditor_instances, cleanDrawLayer_fn2).call(this);
          } else if (parent) {
            this._uiManager.addShouldRescale(this);
            __privateMethod(this, _DrawingEditor_instances, addToDrawLayer_fn2).call(this, parent);
            mustBeSelected = !this.parent && this.div?.classList.contains("selectedEditor");
          }
          super.setParent(parent);
          if (mustBeSelected) {
            this.select();
          }
        }
        rotate() {
          if (!this.parent) {
            return;
          }
          this.parent.drawLayer.updateProperties(this._drawId, _DrawingEditor._mergeSVGProperties({
            bbox: __privateMethod(this, _DrawingEditor_instances, rotateBox_fn).call(this)
          }, __privateGet(this, _drawOutlines).updateRotation((this.parentRotation - this.rotation + 360) % 360)));
        }
        onScaleChanging() {
          if (!this.parent) {
            return;
          }
          __privateMethod(this, _DrawingEditor_instances, updateBbox_fn).call(this, __privateGet(this, _drawOutlines).updateParentDimensions(this.parentDimensions, this.parent.scale));
        }
        static onScaleChangingWhenDrawing() {
        }
        render() {
          if (this.div) {
            return this.div;
          }
          let baseX, baseY;
          if (this._isCopy) {
            baseX = this.x;
            baseY = this.y;
          }
          const div = super.render();
          div.classList.add("draw");
          const drawDiv = document.createElement("div");
          div.append(drawDiv);
          drawDiv.setAttribute("aria-hidden", "true");
          drawDiv.className = "internal";
          this.setDims();
          this._uiManager.addShouldRescale(this);
          this.disableEditing();
          if (this._isCopy) {
            this._moveAfterPaste(baseX, baseY);
          }
          return div;
        }
        static createDrawerInstance(_x, _y, _parentWidth3, _parentHeight3, _rotation4) {
          unreachable("Not implemented");
        }
        static startDrawing(parent, uiManager, _isLTR3, event) {
          const {
            target,
            offsetX: x,
            offsetY: y,
            pointerId,
            pointerType
          } = event;
          if (CurrentPointers.isInitializedAndDifferentPointerType(pointerType)) {
            return;
          }
          const {
            viewport: {
              rotation
            }
          } = parent;
          const {
            width: parentWidth,
            height: parentHeight
          } = target.getBoundingClientRect();
          const ac = __privateSet(_DrawingEditor, _currentDrawingAC, new AbortController());
          const signal = parent.combinedSignal(ac);
          CurrentPointers.setPointer(pointerType, pointerId);
          window.addEventListener("pointerup", (e) => {
            if (CurrentPointers.isSamePointerIdOrRemove(e.pointerId)) {
              this._endDraw(e);
            }
          }, {
            signal
          });
          window.addEventListener("pointercancel", (e) => {
            if (CurrentPointers.isSamePointerIdOrRemove(e.pointerId)) {
              this._currentParent.endDrawingSession();
            }
          }, {
            signal
          });
          window.addEventListener("pointerdown", (e) => {
            if (!CurrentPointers.isSamePointerType(e.pointerType)) {
              return;
            }
            CurrentPointers.initializeAndAddPointerId(e.pointerId);
            if (__privateGet(_DrawingEditor, _currentDraw).isCancellable()) {
              __privateGet(_DrawingEditor, _currentDraw).removeLastElement();
              if (__privateGet(_DrawingEditor, _currentDraw).isEmpty()) {
                this._currentParent.endDrawingSession(true);
              } else {
                this._endDraw(null);
              }
            }
          }, {
            capture: true,
            passive: false,
            signal
          });
          window.addEventListener("contextmenu", noContextMenu, {
            signal
          });
          target.addEventListener("pointermove", this._drawMove.bind(this), {
            signal
          });
          target.addEventListener("touchmove", (e) => {
            if (CurrentPointers.isSameTimeStamp(e.timeStamp)) {
              stopEvent(e);
            }
          }, {
            signal
          });
          parent.toggleDrawing();
          uiManager._editorUndoBar?.hide();
          if (__privateGet(_DrawingEditor, _currentDraw)) {
            parent.drawLayer.updateProperties(this._currentDrawId, __privateGet(_DrawingEditor, _currentDraw).startNew(x, y, parentWidth, parentHeight, rotation));
            return;
          }
          uiManager.updateUIForDefaultProperties(this);
          __privateSet(_DrawingEditor, _currentDraw, this.createDrawerInstance(x, y, parentWidth, parentHeight, rotation));
          __privateSet(_DrawingEditor, _currentDrawingOptions, this.getDefaultDrawingOptions());
          this._currentParent = parent;
          ({
            id: this._currentDrawId
          } = parent.drawLayer.draw(this._mergeSVGProperties(__privateGet(_DrawingEditor, _currentDrawingOptions).toSVGProperties(), __privateGet(_DrawingEditor, _currentDraw).defaultSVGProperties), true, false));
        }
        static _drawMove(event) {
          CurrentPointers.isSameTimeStamp(event.timeStamp);
          if (!__privateGet(_DrawingEditor, _currentDraw)) {
            return;
          }
          const {
            offsetX,
            offsetY,
            pointerId
          } = event;
          if (!CurrentPointers.isSamePointerId(pointerId)) {
            return;
          }
          if (CurrentPointers.isUsingMultiplePointers()) {
            this._endDraw(event);
            return;
          }
          this._currentParent.drawLayer.updateProperties(this._currentDrawId, __privateGet(_DrawingEditor, _currentDraw).add(offsetX, offsetY));
          CurrentPointers.setTimeStamp(event.timeStamp);
          stopEvent(event);
        }
        static _cleanup(all) {
          if (all) {
            this._currentDrawId = -1;
            this._currentParent = null;
            __privateSet(_DrawingEditor, _currentDraw, null);
            __privateSet(_DrawingEditor, _currentDrawingOptions, null);
            CurrentPointers.clearTimeStamp();
          }
          if (__privateGet(_DrawingEditor, _currentDrawingAC)) {
            __privateGet(_DrawingEditor, _currentDrawingAC).abort();
            __privateSet(_DrawingEditor, _currentDrawingAC, null);
            CurrentPointers.clearPointerIds();
          }
        }
        static _endDraw(event) {
          const parent = this._currentParent;
          if (!parent) {
            return;
          }
          parent.toggleDrawing(true);
          this._cleanup(false);
          if (event?.target === parent.div) {
            parent.drawLayer.updateProperties(this._currentDrawId, __privateGet(_DrawingEditor, _currentDraw).end(event.offsetX, event.offsetY));
          }
          if (this.supportMultipleDrawings) {
            const draw = __privateGet(_DrawingEditor, _currentDraw);
            const drawId = this._currentDrawId;
            const lastElement = draw.getLastElement();
            parent.addCommands({
              cmd: () => {
                parent.drawLayer.updateProperties(drawId, draw.setLastElement(lastElement));
              },
              undo: () => {
                parent.drawLayer.updateProperties(drawId, draw.removeLastElement());
              },
              mustExec: false,
              type: AnnotationEditorParamsType.DRAW_STEP
            });
            return;
          }
          this.endDrawing(false);
        }
        static endDrawing(isAborted) {
          const parent = this._currentParent;
          if (!parent) {
            return null;
          }
          parent.toggleDrawing(true);
          parent.cleanUndoStack(AnnotationEditorParamsType.DRAW_STEP);
          if (!__privateGet(_DrawingEditor, _currentDraw).isEmpty()) {
            const {
              pageDimensions: [pageWidth, pageHeight],
              scale
            } = parent;
            const editor = parent.createAndAddNewEditor({
              offsetX: 0,
              offsetY: 0
            }, false, {
              drawId: this._currentDrawId,
              drawOutlines: __privateGet(_DrawingEditor, _currentDraw).getOutlines(pageWidth * scale, pageHeight * scale, scale, this._INNER_MARGIN),
              drawingOptions: __privateGet(_DrawingEditor, _currentDrawingOptions),
              mustBeCommitted: !isAborted
            });
            this._cleanup(true);
            return editor;
          }
          parent.drawLayer.remove(this._currentDrawId);
          this._cleanup(true);
          return null;
        }
        createDrawingOptions(_data2) {
        }
        static deserializeDraw(_pageX, _pageY, _pageWidth3, _pageHeight3, _innerWidth, _data2) {
          unreachable("Not implemented");
        }
        static async deserialize(data, parent, uiManager) {
          var _a, _b;
          const {
            rawDims: {
              pageWidth,
              pageHeight,
              pageX,
              pageY
            }
          } = parent.viewport;
          const drawOutlines = this.deserializeDraw(pageX, pageY, pageWidth, pageHeight, this._INNER_MARGIN, data);
          const editor = await super.deserialize(data, parent, uiManager);
          editor.createDrawingOptions(data);
          __privateMethod(_a = editor, _DrawingEditor_instances, createDrawOutlines_fn).call(_a, {
            drawOutlines
          });
          __privateMethod(_b = editor, _DrawingEditor_instances, addToDrawLayer_fn2).call(_b);
          editor.onScaleChanging();
          editor.rotate();
          return editor;
        }
        serializeDraw(isForCopying) {
          const [pageX, pageY] = this.pageTranslation;
          const [pageWidth, pageHeight] = this.pageDimensions;
          return __privateGet(this, _drawOutlines).serialize([pageX, pageY, pageWidth, pageHeight], isForCopying);
        }
        renderAnnotationElement(annotation) {
          annotation.updateEdited({
            rect: this.getPDFRect()
          });
          return null;
        }
        static canCreateNewEmptyEditor() {
          return false;
        }
      };
      _drawOutlines = new WeakMap();
      _mustBeCommitted = new WeakMap();
      _currentDraw = new WeakMap();
      _currentDrawingAC = new WeakMap();
      _currentDrawingOptions = new WeakMap();
      _DrawingEditor_instances = new WeakSet();
      createDrawOutlines_fn = function({
        drawOutlines,
        drawId,
        drawingOptions
      }) {
        __privateSet(this, _drawOutlines, drawOutlines);
        this._drawingOptions || (this._drawingOptions = drawingOptions);
        if (!this.annotationElementId) {
          this._uiManager.a11yAlert(AnnotationEditor._l10nAlert[this.editorType]);
        }
        if (drawId >= 0) {
          this._drawId = drawId;
          this.parent.drawLayer.finalizeDraw(drawId, drawOutlines.defaultProperties);
        } else {
          this._drawId = __privateMethod(this, _DrawingEditor_instances, createDrawing_fn).call(this, drawOutlines, this.parent);
        }
        __privateMethod(this, _DrawingEditor_instances, updateBbox_fn).call(this, drawOutlines.box);
      };
      createDrawing_fn = function(drawOutlines, parent) {
        const {
          id
        } = parent.drawLayer.draw(_DrawingEditor._mergeSVGProperties(this._drawingOptions.toSVGProperties(), drawOutlines.defaultSVGProperties), false, false);
        return id;
      };
      cleanDrawLayer_fn2 = function() {
        if (this._drawId === null || !this.parent) {
          return;
        }
        this.parent.drawLayer.remove(this._drawId);
        this._drawId = null;
        this._drawingOptions.reset();
      };
      addToDrawLayer_fn2 = function(parent = this.parent) {
        if (this._drawId !== null && this.parent === parent) {
          return;
        }
        if (this._drawId !== null) {
          this.parent.drawLayer.updateParent(this._drawId, parent.drawLayer);
          return;
        }
        this._drawingOptions.updateAll();
        this._drawId = __privateMethod(this, _DrawingEditor_instances, createDrawing_fn).call(this, __privateGet(this, _drawOutlines), parent);
      };
      convertToParentSpace_fn = function([x, y, width, height]) {
        const {
          parentDimensions: [pW, pH],
          rotation
        } = this;
        switch (rotation) {
          case 90:
            return [y, 1 - x, width * (pH / pW), height * (pW / pH)];
          case 180:
            return [1 - x, 1 - y, width, height];
          case 270:
            return [1 - y, x, width * (pH / pW), height * (pW / pH)];
          default:
            return [x, y, width, height];
        }
      };
      convertToDrawSpace_fn = function() {
        const {
          x,
          y,
          width,
          height,
          parentDimensions: [pW, pH],
          rotation
        } = this;
        switch (rotation) {
          case 90:
            return [1 - y, x, width * (pW / pH), height * (pH / pW)];
          case 180:
            return [1 - x, 1 - y, width, height];
          case 270:
            return [y, 1 - x, width * (pW / pH), height * (pH / pW)];
          default:
            return [x, y, width, height];
        }
      };
      updateBbox_fn = function(bbox) {
        [this.x, this.y, this.width, this.height] = __privateMethod(this, _DrawingEditor_instances, convertToParentSpace_fn).call(this, bbox);
        if (this.div) {
          this.fixAndSetPosition();
          this.setDims();
        }
        this._onResized();
      };
      rotateBox_fn = function() {
        const {
          x,
          y,
          width,
          height,
          rotation,
          parentRotation,
          parentDimensions: [pW, pH]
        } = this;
        switch ((rotation * 4 + parentRotation) / 90) {
          case 1:
            return [1 - y - height, x, height, width];
          case 2:
            return [1 - x - width, 1 - y - height, width, height];
          case 3:
            return [y, 1 - x - width, height, width];
          case 4:
            return [x, y - width * (pW / pH), height * (pH / pW), width * (pW / pH)];
          case 5:
            return [1 - y, x, width * (pW / pH), height * (pH / pW)];
          case 6:
            return [1 - x - height * (pH / pW), 1 - y, height * (pH / pW), width * (pW / pH)];
          case 7:
            return [y - width * (pW / pH), 1 - x - height * (pH / pW), width * (pW / pH), height * (pH / pW)];
          case 8:
            return [x - width, y - height, width, height];
          case 9:
            return [1 - y, x - width, height, width];
          case 10:
            return [1 - x, 1 - y, width, height];
          case 11:
            return [y - height, 1 - x, height, width];
          case 12:
            return [x - height * (pH / pW), y, height * (pH / pW), width * (pW / pH)];
          case 13:
            return [1 - y - width * (pW / pH), x - height * (pH / pW), width * (pW / pH), height * (pH / pW)];
          case 14:
            return [1 - x, 1 - y - width * (pW / pH), height * (pH / pW), width * (pW / pH)];
          case 15:
            return [y, 1 - x, width * (pW / pH), height * (pH / pW)];
          default:
            return [x, y, width, height];
        }
      };
      __publicField(_DrawingEditor, "_currentDrawId", -1);
      __publicField(_DrawingEditor, "_currentParent", null);
      __privateAdd(_DrawingEditor, _currentDraw, null);
      __privateAdd(_DrawingEditor, _currentDrawingAC, null);
      __privateAdd(_DrawingEditor, _currentDrawingOptions, null);
      __publicField(_DrawingEditor, "_INNER_MARGIN", 3);
      DrawingEditor = _DrawingEditor;
      InkDrawOutliner = class {
        constructor(x, y, parentWidth, parentHeight, rotation, thickness) {
          __privateAdd(this, _InkDrawOutliner_instances);
          __privateAdd(this, _last2, new Float64Array(6));
          __privateAdd(this, _line2);
          __privateAdd(this, _lines);
          __privateAdd(this, _rotation2);
          __privateAdd(this, _thickness3);
          __privateAdd(this, _points3);
          __privateAdd(this, _lastSVGPath, "");
          __privateAdd(this, _lastIndex, 0);
          __privateAdd(this, _outlines2, new InkDrawOutline());
          __privateAdd(this, _parentWidth);
          __privateAdd(this, _parentHeight);
          __privateSet(this, _parentWidth, parentWidth);
          __privateSet(this, _parentHeight, parentHeight);
          __privateSet(this, _rotation2, rotation);
          __privateSet(this, _thickness3, thickness);
          [x, y] = __privateMethod(this, _InkDrawOutliner_instances, normalizePoint_fn).call(this, x, y);
          const line = __privateSet(this, _line2, [NaN, NaN, NaN, NaN, x, y]);
          __privateSet(this, _points3, [x, y]);
          __privateSet(this, _lines, [{
            line,
            points: __privateGet(this, _points3)
          }]);
          __privateGet(this, _last2).set(line, 0);
        }
        updateProperty(name, value) {
          if (name === "stroke-width") {
            __privateSet(this, _thickness3, value);
          }
        }
        isEmpty() {
          return !__privateGet(this, _lines)?.length;
        }
        isCancellable() {
          return __privateGet(this, _points3).length <= 10;
        }
        add(x, y) {
          [x, y] = __privateMethod(this, _InkDrawOutliner_instances, normalizePoint_fn).call(this, x, y);
          const [x1, y1, x2, y2] = __privateGet(this, _last2).subarray(2, 6);
          const diffX = x - x2;
          const diffY = y - y2;
          const d = Math.hypot(__privateGet(this, _parentWidth) * diffX, __privateGet(this, _parentHeight) * diffY);
          if (d <= 2) {
            return null;
          }
          __privateGet(this, _points3).push(x, y);
          if (isNaN(x1)) {
            __privateGet(this, _last2).set([x2, y2, x, y], 2);
            __privateGet(this, _line2).push(NaN, NaN, NaN, NaN, x, y);
            return {
              path: {
                d: this.toSVGPath()
              }
            };
          }
          if (isNaN(__privateGet(this, _last2)[0])) {
            __privateGet(this, _line2).splice(6, 6);
          }
          __privateGet(this, _last2).set([x1, y1, x2, y2, x, y], 0);
          __privateGet(this, _line2).push(...Outline.createBezierPoints(x1, y1, x2, y2, x, y));
          return {
            path: {
              d: this.toSVGPath()
            }
          };
        }
        end(x, y) {
          const change = this.add(x, y);
          if (change) {
            return change;
          }
          if (__privateGet(this, _points3).length === 2) {
            return {
              path: {
                d: this.toSVGPath()
              }
            };
          }
          return null;
        }
        startNew(x, y, parentWidth, parentHeight, rotation) {
          __privateSet(this, _parentWidth, parentWidth);
          __privateSet(this, _parentHeight, parentHeight);
          __privateSet(this, _rotation2, rotation);
          [x, y] = __privateMethod(this, _InkDrawOutliner_instances, normalizePoint_fn).call(this, x, y);
          const line = __privateSet(this, _line2, [NaN, NaN, NaN, NaN, x, y]);
          __privateSet(this, _points3, [x, y]);
          const last2 = __privateGet(this, _lines).at(-1);
          if (last2) {
            last2.line = new Float32Array(last2.line);
            last2.points = new Float32Array(last2.points);
          }
          __privateGet(this, _lines).push({
            line,
            points: __privateGet(this, _points3)
          });
          __privateGet(this, _last2).set(line, 0);
          __privateSet(this, _lastIndex, 0);
          this.toSVGPath();
          return null;
        }
        getLastElement() {
          return __privateGet(this, _lines).at(-1);
        }
        setLastElement(element) {
          if (!__privateGet(this, _lines)) {
            return __privateGet(this, _outlines2).setLastElement(element);
          }
          __privateGet(this, _lines).push(element);
          __privateSet(this, _line2, element.line);
          __privateSet(this, _points3, element.points);
          __privateSet(this, _lastIndex, 0);
          return {
            path: {
              d: this.toSVGPath()
            }
          };
        }
        removeLastElement() {
          if (!__privateGet(this, _lines)) {
            return __privateGet(this, _outlines2).removeLastElement();
          }
          __privateGet(this, _lines).pop();
          __privateSet(this, _lastSVGPath, "");
          for (let i = 0, ii = __privateGet(this, _lines).length; i < ii; i++) {
            const {
              line,
              points
            } = __privateGet(this, _lines)[i];
            __privateSet(this, _line2, line);
            __privateSet(this, _points3, points);
            __privateSet(this, _lastIndex, 0);
            this.toSVGPath();
          }
          return {
            path: {
              d: __privateGet(this, _lastSVGPath)
            }
          };
        }
        toSVGPath() {
          const firstX = Outline.svgRound(__privateGet(this, _line2)[4]);
          const firstY = Outline.svgRound(__privateGet(this, _line2)[5]);
          if (__privateGet(this, _points3).length === 2) {
            __privateSet(this, _lastSVGPath, `${__privateGet(this, _lastSVGPath)} M ${firstX} ${firstY} Z`);
            return __privateGet(this, _lastSVGPath);
          }
          if (__privateGet(this, _points3).length <= 6) {
            const i = __privateGet(this, _lastSVGPath).lastIndexOf("M");
            __privateSet(this, _lastSVGPath, `${__privateGet(this, _lastSVGPath).slice(0, i)} M ${firstX} ${firstY}`);
            __privateSet(this, _lastIndex, 6);
          }
          if (__privateGet(this, _points3).length === 4) {
            const secondX = Outline.svgRound(__privateGet(this, _line2)[10]);
            const secondY = Outline.svgRound(__privateGet(this, _line2)[11]);
            __privateSet(this, _lastSVGPath, `${__privateGet(this, _lastSVGPath)} L ${secondX} ${secondY}`);
            __privateSet(this, _lastIndex, 12);
            return __privateGet(this, _lastSVGPath);
          }
          const buffer = [];
          if (__privateGet(this, _lastIndex) === 0) {
            buffer.push(`M ${firstX} ${firstY}`);
            __privateSet(this, _lastIndex, 6);
          }
          for (let i = __privateGet(this, _lastIndex), ii = __privateGet(this, _line2).length; i < ii; i += 6) {
            const [c1x, c1y, c2x, c2y, x, y] = __privateGet(this, _line2).slice(i, i + 6).map(Outline.svgRound);
            buffer.push(`C${c1x} ${c1y} ${c2x} ${c2y} ${x} ${y}`);
          }
          __privateSet(this, _lastSVGPath, __privateGet(this, _lastSVGPath) + buffer.join(" "));
          __privateSet(this, _lastIndex, __privateGet(this, _line2).length);
          return __privateGet(this, _lastSVGPath);
        }
        getOutlines(parentWidth, parentHeight, scale, innerMargin) {
          const last2 = __privateGet(this, _lines).at(-1);
          last2.line = new Float32Array(last2.line);
          last2.points = new Float32Array(last2.points);
          __privateGet(this, _outlines2).build(__privateGet(this, _lines), parentWidth, parentHeight, scale, __privateGet(this, _rotation2), __privateGet(this, _thickness3), innerMargin);
          __privateSet(this, _last2, null);
          __privateSet(this, _line2, null);
          __privateSet(this, _lines, null);
          __privateSet(this, _lastSVGPath, null);
          return __privateGet(this, _outlines2);
        }
        get defaultSVGProperties() {
          return {
            root: {
              viewBox: "0 0 10000 10000"
            },
            rootClass: {
              draw: true
            },
            bbox: [0, 0, 1, 1]
          };
        }
      };
      _last2 = new WeakMap();
      _line2 = new WeakMap();
      _lines = new WeakMap();
      _rotation2 = new WeakMap();
      _thickness3 = new WeakMap();
      _points3 = new WeakMap();
      _lastSVGPath = new WeakMap();
      _lastIndex = new WeakMap();
      _outlines2 = new WeakMap();
      _parentWidth = new WeakMap();
      _parentHeight = new WeakMap();
      _InkDrawOutliner_instances = new WeakSet();
      normalizePoint_fn = function(x, y) {
        return Outline._normalizePoint(x, y, __privateGet(this, _parentWidth), __privateGet(this, _parentHeight), __privateGet(this, _rotation2));
      };
      InkDrawOutline = class extends Outline {
        constructor() {
          super(...arguments);
          __privateAdd(this, _InkDrawOutline_instances);
          __privateAdd(this, _bbox2);
          __privateAdd(this, _currentRotation, 0);
          __privateAdd(this, _innerMargin3);
          __privateAdd(this, _lines2);
          __privateAdd(this, _parentWidth2);
          __privateAdd(this, _parentHeight2);
          __privateAdd(this, _parentScale);
          __privateAdd(this, _rotation3);
          __privateAdd(this, _thickness4);
        }
        build(lines, parentWidth, parentHeight, parentScale, rotation, thickness, innerMargin) {
          __privateSet(this, _parentWidth2, parentWidth);
          __privateSet(this, _parentHeight2, parentHeight);
          __privateSet(this, _parentScale, parentScale);
          __privateSet(this, _rotation3, rotation);
          __privateSet(this, _thickness4, thickness);
          __privateSet(this, _innerMargin3, innerMargin ?? 0);
          __privateSet(this, _lines2, lines);
          __privateMethod(this, _InkDrawOutline_instances, computeBbox_fn).call(this);
        }
        get thickness() {
          return __privateGet(this, _thickness4);
        }
        setLastElement(element) {
          __privateGet(this, _lines2).push(element);
          return {
            path: {
              d: this.toSVGPath()
            }
          };
        }
        removeLastElement() {
          __privateGet(this, _lines2).pop();
          return {
            path: {
              d: this.toSVGPath()
            }
          };
        }
        toSVGPath() {
          const buffer = [];
          for (const {
            line
          } of __privateGet(this, _lines2)) {
            buffer.push(`M${Outline.svgRound(line[4])} ${Outline.svgRound(line[5])}`);
            if (line.length === 6) {
              buffer.push("Z");
              continue;
            }
            if (line.length === 12 && isNaN(line[6])) {
              buffer.push(`L${Outline.svgRound(line[10])} ${Outline.svgRound(line[11])}`);
              continue;
            }
            for (let i = 6, ii = line.length; i < ii; i += 6) {
              const [c1x, c1y, c2x, c2y, x, y] = line.subarray(i, i + 6).map(Outline.svgRound);
              buffer.push(`C${c1x} ${c1y} ${c2x} ${c2y} ${x} ${y}`);
            }
          }
          return buffer.join("");
        }
        serialize([pageX, pageY, pageWidth, pageHeight], isForCopying) {
          const serializedLines = [];
          const serializedPoints = [];
          const [x, y, width, height] = __privateMethod(this, _InkDrawOutline_instances, getBBoxWithNoMargin_fn).call(this);
          let tx, ty, sx, sy, x1, y1, x2, y2, rescaleFn;
          switch (__privateGet(this, _rotation3)) {
            case 0:
              rescaleFn = Outline._rescale;
              tx = pageX;
              ty = pageY + pageHeight;
              sx = pageWidth;
              sy = -pageHeight;
              x1 = pageX + x * pageWidth;
              y1 = pageY + (1 - y - height) * pageHeight;
              x2 = pageX + (x + width) * pageWidth;
              y2 = pageY + (1 - y) * pageHeight;
              break;
            case 90:
              rescaleFn = Outline._rescaleAndSwap;
              tx = pageX;
              ty = pageY;
              sx = pageWidth;
              sy = pageHeight;
              x1 = pageX + y * pageWidth;
              y1 = pageY + x * pageHeight;
              x2 = pageX + (y + height) * pageWidth;
              y2 = pageY + (x + width) * pageHeight;
              break;
            case 180:
              rescaleFn = Outline._rescale;
              tx = pageX + pageWidth;
              ty = pageY;
              sx = -pageWidth;
              sy = pageHeight;
              x1 = pageX + (1 - x - width) * pageWidth;
              y1 = pageY + y * pageHeight;
              x2 = pageX + (1 - x) * pageWidth;
              y2 = pageY + (y + height) * pageHeight;
              break;
            case 270:
              rescaleFn = Outline._rescaleAndSwap;
              tx = pageX + pageWidth;
              ty = pageY + pageHeight;
              sx = -pageWidth;
              sy = -pageHeight;
              x1 = pageX + (1 - y - height) * pageWidth;
              y1 = pageY + (1 - x - width) * pageHeight;
              x2 = pageX + (1 - y) * pageWidth;
              y2 = pageY + (1 - x) * pageHeight;
              break;
          }
          for (const {
            line,
            points
          } of __privateGet(this, _lines2)) {
            serializedLines.push(rescaleFn(line, tx, ty, sx, sy, isForCopying ? new Array(line.length) : null));
            serializedPoints.push(rescaleFn(points, tx, ty, sx, sy, isForCopying ? new Array(points.length) : null));
          }
          return {
            lines: serializedLines,
            points: serializedPoints,
            rect: [x1, y1, x2, y2]
          };
        }
        static deserialize(pageX, pageY, pageWidth, pageHeight, innerMargin, {
          paths: {
            lines,
            points
          },
          rotation,
          thickness
        }) {
          const newLines = [];
          let tx, ty, sx, sy, rescaleFn;
          switch (rotation) {
            case 0:
              rescaleFn = Outline._rescale;
              tx = -pageX / pageWidth;
              ty = pageY / pageHeight + 1;
              sx = 1 / pageWidth;
              sy = -1 / pageHeight;
              break;
            case 90:
              rescaleFn = Outline._rescaleAndSwap;
              tx = -pageY / pageHeight;
              ty = -pageX / pageWidth;
              sx = 1 / pageHeight;
              sy = 1 / pageWidth;
              break;
            case 180:
              rescaleFn = Outline._rescale;
              tx = pageX / pageWidth + 1;
              ty = -pageY / pageHeight;
              sx = -1 / pageWidth;
              sy = 1 / pageHeight;
              break;
            case 270:
              rescaleFn = Outline._rescaleAndSwap;
              tx = pageY / pageHeight + 1;
              ty = pageX / pageWidth + 1;
              sx = -1 / pageHeight;
              sy = -1 / pageWidth;
              break;
          }
          if (!lines) {
            lines = [];
            for (const point of points) {
              const len = point.length;
              if (len === 2) {
                lines.push(new Float32Array([NaN, NaN, NaN, NaN, point[0], point[1]]));
                continue;
              }
              if (len === 4) {
                lines.push(new Float32Array([NaN, NaN, NaN, NaN, point[0], point[1], NaN, NaN, NaN, NaN, point[2], point[3]]));
                continue;
              }
              const line = new Float32Array(3 * (len - 2));
              lines.push(line);
              let [x1, y1, x2, y2] = point.subarray(0, 4);
              line.set([NaN, NaN, NaN, NaN, x1, y1], 0);
              for (let i = 4; i < len; i += 2) {
                const x = point[i];
                const y = point[i + 1];
                line.set(Outline.createBezierPoints(x1, y1, x2, y2, x, y), (i - 2) * 3);
                [x1, y1, x2, y2] = [x2, y2, x, y];
              }
            }
          }
          for (let i = 0, ii = lines.length; i < ii; i++) {
            newLines.push({
              line: rescaleFn(lines[i].map((x) => x ?? NaN), tx, ty, sx, sy),
              points: rescaleFn(points[i].map((x) => x ?? NaN), tx, ty, sx, sy)
            });
          }
          const outlines = new this.prototype.constructor();
          outlines.build(newLines, pageWidth, pageHeight, 1, rotation, thickness, innerMargin);
          return outlines;
        }
        get box() {
          return __privateGet(this, _bbox2);
        }
        updateProperty(name, value) {
          if (name === "stroke-width") {
            return __privateMethod(this, _InkDrawOutline_instances, updateThickness_fn2).call(this, value);
          }
          return null;
        }
        updateParentDimensions([width, height], scale) {
          const [oldMarginX, oldMarginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
          __privateSet(this, _parentWidth2, width);
          __privateSet(this, _parentHeight2, height);
          __privateSet(this, _parentScale, scale);
          const [newMarginX, newMarginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
          const diffMarginX = newMarginX - oldMarginX;
          const diffMarginY = newMarginY - oldMarginY;
          const bbox = __privateGet(this, _bbox2);
          bbox[0] -= diffMarginX;
          bbox[1] -= diffMarginY;
          bbox[2] += 2 * diffMarginX;
          bbox[3] += 2 * diffMarginY;
          return bbox;
        }
        updateRotation(rotation) {
          __privateSet(this, _currentRotation, rotation);
          return {
            path: {
              transform: this.rotationTransform
            }
          };
        }
        get viewBox() {
          return __privateGet(this, _bbox2).map(Outline.svgRound).join(" ");
        }
        get defaultProperties() {
          const [x, y] = __privateGet(this, _bbox2);
          return {
            root: {
              viewBox: this.viewBox
            },
            path: {
              "transform-origin": `${Outline.svgRound(x)} ${Outline.svgRound(y)}`
            }
          };
        }
        get rotationTransform() {
          const [, , width, height] = __privateGet(this, _bbox2);
          let a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
          switch (__privateGet(this, _currentRotation)) {
            case 90:
              b = height / width;
              c = -width / height;
              e = width;
              break;
            case 180:
              a = -1;
              d = -1;
              e = width;
              f = height;
              break;
            case 270:
              b = -height / width;
              c = width / height;
              f = height;
              break;
            default:
              return "";
          }
          return `matrix(${a} ${b} ${c} ${d} ${Outline.svgRound(e)} ${Outline.svgRound(f)})`;
        }
        getPathResizingSVGProperties([newX, newY, newWidth, newHeight]) {
          const [marginX, marginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
          const [x, y, width, height] = __privateGet(this, _bbox2);
          if (Math.abs(width - marginX) <= Outline.PRECISION || Math.abs(height - marginY) <= Outline.PRECISION) {
            const tx = newX + newWidth / 2 - (x + width / 2);
            const ty = newY + newHeight / 2 - (y + height / 2);
            return {
              path: {
                "transform-origin": `${Outline.svgRound(newX)} ${Outline.svgRound(newY)}`,
                transform: `${this.rotationTransform} translate(${tx} ${ty})`
              }
            };
          }
          const s1x = (newWidth - 2 * marginX) / (width - 2 * marginX);
          const s1y = (newHeight - 2 * marginY) / (height - 2 * marginY);
          const s2x = width / newWidth;
          const s2y = height / newHeight;
          return {
            path: {
              "transform-origin": `${Outline.svgRound(x)} ${Outline.svgRound(y)}`,
              transform: `${this.rotationTransform} scale(${s2x} ${s2y}) translate(${Outline.svgRound(marginX)} ${Outline.svgRound(marginY)}) scale(${s1x} ${s1y}) translate(${Outline.svgRound(-marginX)} ${Outline.svgRound(-marginY)})`
            }
          };
        }
        getPathResizedSVGProperties([newX, newY, newWidth, newHeight]) {
          const [marginX, marginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
          const bbox = __privateGet(this, _bbox2);
          const [x, y, width, height] = bbox;
          bbox[0] = newX;
          bbox[1] = newY;
          bbox[2] = newWidth;
          bbox[3] = newHeight;
          if (Math.abs(width - marginX) <= Outline.PRECISION || Math.abs(height - marginY) <= Outline.PRECISION) {
            const tx2 = newX + newWidth / 2 - (x + width / 2);
            const ty2 = newY + newHeight / 2 - (y + height / 2);
            for (const {
              line,
              points
            } of __privateGet(this, _lines2)) {
              Outline._translate(line, tx2, ty2, line);
              Outline._translate(points, tx2, ty2, points);
            }
            return {
              root: {
                viewBox: this.viewBox
              },
              path: {
                "transform-origin": `${Outline.svgRound(newX)} ${Outline.svgRound(newY)}`,
                transform: this.rotationTransform || null,
                d: this.toSVGPath()
              }
            };
          }
          const s1x = (newWidth - 2 * marginX) / (width - 2 * marginX);
          const s1y = (newHeight - 2 * marginY) / (height - 2 * marginY);
          const tx = -s1x * (x + marginX) + newX + marginX;
          const ty = -s1y * (y + marginY) + newY + marginY;
          if (s1x !== 1 || s1y !== 1 || tx !== 0 || ty !== 0) {
            for (const {
              line,
              points
            } of __privateGet(this, _lines2)) {
              Outline._rescale(line, tx, ty, s1x, s1y, line);
              Outline._rescale(points, tx, ty, s1x, s1y, points);
            }
          }
          return {
            root: {
              viewBox: this.viewBox
            },
            path: {
              "transform-origin": `${Outline.svgRound(newX)} ${Outline.svgRound(newY)}`,
              transform: this.rotationTransform || null,
              d: this.toSVGPath()
            }
          };
        }
        getPathTranslatedSVGProperties([newX, newY], parentDimensions) {
          const [newParentWidth, newParentHeight] = parentDimensions;
          const bbox = __privateGet(this, _bbox2);
          const tx = newX - bbox[0];
          const ty = newY - bbox[1];
          if (__privateGet(this, _parentWidth2) === newParentWidth && __privateGet(this, _parentHeight2) === newParentHeight) {
            for (const {
              line,
              points
            } of __privateGet(this, _lines2)) {
              Outline._translate(line, tx, ty, line);
              Outline._translate(points, tx, ty, points);
            }
          } else {
            const sx = __privateGet(this, _parentWidth2) / newParentWidth;
            const sy = __privateGet(this, _parentHeight2) / newParentHeight;
            __privateSet(this, _parentWidth2, newParentWidth);
            __privateSet(this, _parentHeight2, newParentHeight);
            for (const {
              line,
              points
            } of __privateGet(this, _lines2)) {
              Outline._rescale(line, tx, ty, sx, sy, line);
              Outline._rescale(points, tx, ty, sx, sy, points);
            }
            bbox[2] *= sx;
            bbox[3] *= sy;
          }
          bbox[0] = newX;
          bbox[1] = newY;
          return {
            root: {
              viewBox: this.viewBox
            },
            path: {
              d: this.toSVGPath(),
              "transform-origin": `${Outline.svgRound(newX)} ${Outline.svgRound(newY)}`
            }
          };
        }
        get defaultSVGProperties() {
          const bbox = __privateGet(this, _bbox2);
          return {
            root: {
              viewBox: this.viewBox
            },
            rootClass: {
              draw: true
            },
            path: {
              d: this.toSVGPath(),
              "transform-origin": `${Outline.svgRound(bbox[0])} ${Outline.svgRound(bbox[1])}`,
              transform: this.rotationTransform || null
            },
            bbox
          };
        }
      };
      _bbox2 = new WeakMap();
      _currentRotation = new WeakMap();
      _innerMargin3 = new WeakMap();
      _lines2 = new WeakMap();
      _parentWidth2 = new WeakMap();
      _parentHeight2 = new WeakMap();
      _parentScale = new WeakMap();
      _rotation3 = new WeakMap();
      _thickness4 = new WeakMap();
      _InkDrawOutline_instances = new WeakSet();
      getMarginComponents_fn = function(thickness = __privateGet(this, _thickness4)) {
        const margin = __privateGet(this, _innerMargin3) + thickness / 2 * __privateGet(this, _parentScale);
        return __privateGet(this, _rotation3) % 180 === 0 ? [margin / __privateGet(this, _parentWidth2), margin / __privateGet(this, _parentHeight2)] : [margin / __privateGet(this, _parentHeight2), margin / __privateGet(this, _parentWidth2)];
      };
      getBBoxWithNoMargin_fn = function() {
        const [x, y, width, height] = __privateGet(this, _bbox2);
        const [marginX, marginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this, 0);
        return [x + marginX, y + marginY, width - 2 * marginX, height - 2 * marginY];
      };
      computeBbox_fn = function() {
        const bbox = __privateSet(this, _bbox2, F32_BBOX_INIT.slice());
        for (const {
          line
        } of __privateGet(this, _lines2)) {
          if (line.length <= 12) {
            for (let i = 4, ii = line.length; i < ii; i += 6) {
              Util.pointBoundingBox(line[i], line[i + 1], bbox);
            }
            continue;
          }
          let lastX = line[4], lastY = line[5];
          for (let i = 6, ii = line.length; i < ii; i += 6) {
            const [c1x, c1y, c2x, c2y, x, y] = line.subarray(i, i + 6);
            Util.bezierBoundingBox(lastX, lastY, c1x, c1y, c2x, c2y, x, y, bbox);
            lastX = x;
            lastY = y;
          }
        }
        const [marginX, marginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
        bbox[0] = MathClamp(bbox[0] - marginX, 0, 1);
        bbox[1] = MathClamp(bbox[1] - marginY, 0, 1);
        bbox[2] = MathClamp(bbox[2] + marginX, 0, 1);
        bbox[3] = MathClamp(bbox[3] + marginY, 0, 1);
        bbox[2] -= bbox[0];
        bbox[3] -= bbox[1];
      };
      updateThickness_fn2 = function(thickness) {
        const [oldMarginX, oldMarginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
        __privateSet(this, _thickness4, thickness);
        const [newMarginX, newMarginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
        const [diffMarginX, diffMarginY] = [newMarginX - oldMarginX, newMarginY - oldMarginY];
        const bbox = __privateGet(this, _bbox2);
        bbox[0] -= diffMarginX;
        bbox[1] -= diffMarginY;
        bbox[2] += 2 * diffMarginX;
        bbox[3] += 2 * diffMarginY;
        return bbox;
      };
      InkDrawingOptions = class _InkDrawingOptions extends DrawingOptions {
        constructor(viewerParameters) {
          super();
          this._viewParameters = viewerParameters;
          super.updateProperties({
            fill: "none",
            stroke: AnnotationEditor._defaultLineColor,
            "stroke-opacity": 1,
            "stroke-width": 1,
            "stroke-linecap": "round",
            "stroke-linejoin": "round",
            "stroke-miterlimit": 10
          });
        }
        updateSVGProperty(name, value) {
          if (name === "stroke-width") {
            value ?? (value = this["stroke-width"]);
            value *= this._viewParameters.realScale;
          }
          super.updateSVGProperty(name, value);
        }
        clone() {
          const clone2 = new _InkDrawingOptions(this._viewParameters);
          clone2.updateAll(this);
          return clone2;
        }
      };
      _InkEditor = class _InkEditor extends DrawingEditor {
        constructor(params) {
          super({
            ...params,
            name: "inkEditor"
          });
          __privateAdd(this, _InkEditor_instances);
          this._willKeepAspectRatio = true;
          this.defaultL10nId = "pdfjs-editor-ink-editor";
        }
        static initialize(l10n, uiManager) {
          AnnotationEditor.initialize(l10n, uiManager);
          this._defaultDrawingOptions = new InkDrawingOptions(uiManager.viewParameters);
        }
        static getDefaultDrawingOptions(options) {
          const clone2 = this._defaultDrawingOptions.clone();
          clone2.updateProperties(options);
          return clone2;
        }
        static get supportMultipleDrawings() {
          return true;
        }
        static get typesMap() {
          return shadow(this, "typesMap", /* @__PURE__ */ new Map([[AnnotationEditorParamsType.INK_THICKNESS, "stroke-width"], [AnnotationEditorParamsType.INK_COLOR, "stroke"], [AnnotationEditorParamsType.INK_OPACITY, "stroke-opacity"]]));
        }
        static createDrawerInstance(x, y, parentWidth, parentHeight, rotation) {
          return new InkDrawOutliner(x, y, parentWidth, parentHeight, rotation, this._defaultDrawingOptions["stroke-width"]);
        }
        static deserializeDraw(pageX, pageY, pageWidth, pageHeight, innerMargin, data) {
          return InkDrawOutline.deserialize(pageX, pageY, pageWidth, pageHeight, innerMargin, data);
        }
        static async deserialize(data, parent, uiManager) {
          let initialData = null;
          if (data instanceof InkAnnotationElement) {
            const {
              data: {
                inkLists,
                rect,
                rotation,
                id,
                color,
                opacity,
                borderStyle: {
                  rawWidth: thickness
                },
                popupRef,
                richText,
                contentsObj,
                creationDate,
                modificationDate
              },
              parent: {
                page: {
                  pageNumber
                }
              }
            } = data;
            initialData = data = {
              annotationType: AnnotationEditorType.INK,
              color: Array.from(color),
              thickness,
              opacity,
              paths: {
                points: inkLists
              },
              boxes: null,
              pageIndex: pageNumber - 1,
              rect: rect.slice(0),
              rotation,
              annotationElementId: id,
              id,
              deleted: false,
              popupRef,
              richText,
              comment: contentsObj?.str || null,
              creationDate,
              modificationDate
            };
          }
          const editor = await super.deserialize(data, parent, uiManager);
          editor._initialData = initialData;
          if (data.comment) {
            editor.setCommentData(data);
          }
          return editor;
        }
        get toolbarButtons() {
          this._colorPicker || (this._colorPicker = new BasicColorPicker(this));
          return [["colorPicker", this._colorPicker]];
        }
        get colorType() {
          return AnnotationEditorParamsType.INK_COLOR;
        }
        get colorAndOpacityType() {
          return AnnotationEditorParamsType.INK_COLOR_AND_OPACITY;
        }
        get opacityType() {
          return AnnotationEditorParamsType.INK_OPACITY;
        }
        updateParams(type, value) {
          if (type === AnnotationEditorParamsType.INK_COLOR_AND_OPACITY) {
            this._updateColorAndOpacity(value.color, value.opacity);
            return;
          }
          super.updateParams(type, value);
        }
        static updateDefaultParams(type, value) {
          if (type === AnnotationEditorParamsType.INK_COLOR_AND_OPACITY) {
            super.updateDefaultParams(AnnotationEditorParamsType.INK_COLOR, value.color);
            super.updateDefaultParams(AnnotationEditorParamsType.INK_OPACITY, value.opacity);
            return;
          }
          super.updateDefaultParams(type, value);
        }
        get color() {
          return this._drawingOptions.stroke;
        }
        get opacity() {
          return this._drawingOptions["stroke-opacity"];
        }
        onScaleChanging() {
          if (!this.parent) {
            return;
          }
          super.onScaleChanging();
          const {
            _drawId,
            _drawingOptions,
            parent
          } = this;
          _drawingOptions.updateSVGProperty("stroke-width");
          parent.drawLayer.updateProperties(_drawId, _drawingOptions.toSVGProperties());
        }
        static onScaleChangingWhenDrawing() {
          const parent = this._currentParent;
          if (!parent) {
            return;
          }
          super.onScaleChangingWhenDrawing();
          this._defaultDrawingOptions.updateSVGProperty("stroke-width");
          parent.drawLayer.updateProperties(this._currentDrawId, this._defaultDrawingOptions.toSVGProperties());
        }
        createDrawingOptions({
          color,
          thickness,
          opacity
        }) {
          this._drawingOptions = _InkEditor.getDefaultDrawingOptions({
            stroke: Util.makeHexColor(...color),
            "stroke-width": thickness,
            "stroke-opacity": opacity
          });
        }
        serialize(isForCopying = false) {
          if (this.isEmpty()) {
            return null;
          }
          if (this.deleted) {
            return this.serializeDeleted();
          }
          const {
            lines,
            points
          } = this.serializeDraw(isForCopying);
          const {
            _drawingOptions: {
              stroke,
              "stroke-opacity": opacity,
              "stroke-width": thickness
            }
          } = this;
          const serialized = Object.assign(super.serialize(isForCopying), {
            color: AnnotationEditor._colorManager.convert(stroke),
            opacity,
            thickness,
            paths: {
              lines,
              points
            }
          });
          this.addComment(serialized);
          if (isForCopying) {
            serialized.isCopy = true;
            return serialized;
          }
          if (this.annotationElementId && !__privateMethod(this, _InkEditor_instances, hasElementChanged_fn3).call(this, serialized)) {
            return null;
          }
          serialized.id = this.annotationElementId;
          return serialized;
        }
        renderAnnotationElement(annotation) {
          if (this.deleted) {
            annotation.hide();
            return null;
          }
          const {
            points,
            rect
          } = this.serializeDraw(false);
          annotation.updateEdited({
            rect,
            thickness: this._drawingOptions["stroke-width"],
            points,
            popup: this.comment
          });
          return null;
        }
      };
      _InkEditor_instances = new WeakSet();
      hasElementChanged_fn3 = function(serialized) {
        const {
          color,
          thickness,
          opacity,
          pageIndex
        } = this._initialData;
        return this.hasEditedComment || this._hasBeenMoved || this._hasBeenResized || serialized.color.some((c, i) => c !== color[i]) || serialized.thickness !== thickness || serialized.opacity !== opacity || serialized.pageIndex !== pageIndex;
      };
      __publicField(_InkEditor, "_type", "ink");
      __publicField(_InkEditor, "_editorType", AnnotationEditorType.INK);
      __publicField(_InkEditor, "_defaultDrawingOptions", null);
      InkEditor = _InkEditor;
      ContourDrawOutline = class extends InkDrawOutline {
        toSVGPath() {
          let path = super.toSVGPath();
          if (!path.endsWith("Z")) {
            path += "Z";
          }
          return path;
        }
      };
      BASE_HEADER_LENGTH = 8;
      POINTS_PROPERTIES_NUMBER = 3;
      SignatureExtractor = class {
        static extractContoursFromText(text, {
          fontFamily,
          fontStyle,
          fontWeight
        }, pageWidth, pageHeight, rotation, innerMargin) {
          let canvas = new OffscreenCanvas(1, 1);
          let ctx = canvas.getContext("2d", {
            alpha: false
          });
          const fontSize = 200;
          const font = ctx.font = `${fontStyle} ${fontWeight} ${fontSize}px ${fontFamily}`;
          const {
            actualBoundingBoxLeft,
            actualBoundingBoxRight,
            actualBoundingBoxAscent,
            actualBoundingBoxDescent,
            fontBoundingBoxAscent,
            fontBoundingBoxDescent,
            width
          } = ctx.measureText(text);
          const SCALE = 1.5;
          const canvasWidth = Math.ceil(Math.max(Math.abs(actualBoundingBoxLeft) + Math.abs(actualBoundingBoxRight) || 0, width) * SCALE);
          const canvasHeight = Math.ceil(Math.max(Math.abs(actualBoundingBoxAscent) + Math.abs(actualBoundingBoxDescent) || fontSize, Math.abs(fontBoundingBoxAscent) + Math.abs(fontBoundingBoxDescent) || fontSize) * SCALE);
          canvas = new OffscreenCanvas(canvasWidth, canvasHeight);
          ctx = canvas.getContext("2d", {
            alpha: true,
            willReadFrequently: true
          });
          ctx.font = font;
          ctx.filter = "grayscale(1)";
          ctx.fillStyle = "white";
          ctx.fillRect(0, 0, canvasWidth, canvasHeight);
          ctx.fillStyle = "black";
          ctx.fillText(text, canvasWidth * (SCALE - 1) / 2, canvasHeight * (3 - SCALE) / 2);
          const uint8Buf = __privateMethod(this, _SignatureExtractor_static, toUint8_fn).call(this, ctx.getImageData(0, 0, canvasWidth, canvasHeight).data);
          const histogram = __privateMethod(this, _SignatureExtractor_static, getHistogram_fn).call(this, uint8Buf);
          const threshold = __privateMethod(this, _SignatureExtractor_static, guessThreshold_fn).call(this, histogram);
          const contourList = __privateMethod(this, _SignatureExtractor_static, findContours_fn).call(this, uint8Buf, canvasWidth, canvasHeight, threshold);
          return this.processDrawnLines({
            lines: {
              curves: contourList,
              width: canvasWidth,
              height: canvasHeight
            },
            pageWidth,
            pageHeight,
            rotation,
            innerMargin,
            mustSmooth: true,
            areContours: true
          });
        }
        static process(bitmap, pageWidth, pageHeight, rotation, innerMargin) {
          const [uint8Buf, width, height] = __privateMethod(this, _SignatureExtractor_static, getGrayPixels_fn).call(this, bitmap);
          const [buffer, histogram] = __privateMethod(this, _SignatureExtractor_static, bilateralFilter_fn).call(this, uint8Buf, width, height, Math.hypot(width, height) * __privateGet(this, _PARAMETERS).sigmaSFactor, __privateGet(this, _PARAMETERS).sigmaR, __privateGet(this, _PARAMETERS).kernelSize);
          const threshold = __privateMethod(this, _SignatureExtractor_static, guessThreshold_fn).call(this, histogram);
          const contourList = __privateMethod(this, _SignatureExtractor_static, findContours_fn).call(this, buffer, width, height, threshold);
          return this.processDrawnLines({
            lines: {
              curves: contourList,
              width,
              height
            },
            pageWidth,
            pageHeight,
            rotation,
            innerMargin,
            mustSmooth: true,
            areContours: true
          });
        }
        static processDrawnLines({
          lines,
          pageWidth,
          pageHeight,
          rotation,
          innerMargin,
          mustSmooth,
          areContours
        }) {
          if (rotation % 180 !== 0) {
            [pageWidth, pageHeight] = [pageHeight, pageWidth];
          }
          const {
            curves,
            width,
            height
          } = lines;
          const thickness = lines.thickness ?? 0;
          const linesAndPoints = [];
          const ratio = Math.min(pageWidth / width, pageHeight / height);
          const xScale = ratio / pageWidth;
          const yScale = ratio / pageHeight;
          const newCurves = [];
          for (const {
            points
          } of curves) {
            const reducedPoints = mustSmooth ? __privateMethod(this, _SignatureExtractor_static, douglasPeucker_fn).call(this, points) : points;
            if (!reducedPoints) {
              continue;
            }
            newCurves.push(reducedPoints);
            const len = reducedPoints.length;
            const newPoints = new Float32Array(len);
            const line = new Float32Array(3 * (len === 2 ? 2 : len - 2));
            linesAndPoints.push({
              line,
              points: newPoints
            });
            if (len === 2) {
              newPoints[0] = reducedPoints[0] * xScale;
              newPoints[1] = reducedPoints[1] * yScale;
              line.set([NaN, NaN, NaN, NaN, newPoints[0], newPoints[1]], 0);
              continue;
            }
            let [x1, y1, x2, y2] = reducedPoints;
            x1 *= xScale;
            y1 *= yScale;
            x2 *= xScale;
            y2 *= yScale;
            newPoints.set([x1, y1, x2, y2], 0);
            line.set([NaN, NaN, NaN, NaN, x1, y1], 0);
            for (let i = 4; i < len; i += 2) {
              const x = newPoints[i] = reducedPoints[i] * xScale;
              const y = newPoints[i + 1] = reducedPoints[i + 1] * yScale;
              line.set(Outline.createBezierPoints(x1, y1, x2, y2, x, y), (i - 2) * 3);
              [x1, y1, x2, y2] = [x2, y2, x, y];
            }
          }
          if (linesAndPoints.length === 0) {
            return null;
          }
          const outline = areContours ? new ContourDrawOutline() : new InkDrawOutline();
          outline.build(linesAndPoints, pageWidth, pageHeight, 1, rotation, areContours ? 0 : thickness, innerMargin);
          return {
            outline,
            newCurves,
            areContours,
            thickness,
            width,
            height
          };
        }
        static async compressSignature({
          outlines,
          areContours,
          thickness,
          width,
          height
        }) {
          let minDiff = Infinity;
          let maxDiff = -Infinity;
          let outlinesLength = 0;
          for (const points of outlines) {
            outlinesLength += points.length;
            for (let i = 2, ii = points.length; i < ii; i++) {
              const dx = points[i] - points[i - 2];
              minDiff = Math.min(minDiff, dx);
              maxDiff = Math.max(maxDiff, dx);
            }
          }
          let bufferType;
          if (minDiff >= -128 && maxDiff <= 127) {
            bufferType = Int8Array;
          } else if (minDiff >= -32768 && maxDiff <= 32767) {
            bufferType = Int16Array;
          } else {
            bufferType = Int32Array;
          }
          const len = outlines.length;
          const headerLength = BASE_HEADER_LENGTH + POINTS_PROPERTIES_NUMBER * len;
          const header = new Uint32Array(headerLength);
          let offset = 0;
          header[offset++] = headerLength * Uint32Array.BYTES_PER_ELEMENT + (outlinesLength - 2 * len) * bufferType.BYTES_PER_ELEMENT;
          header[offset++] = 0;
          header[offset++] = width;
          header[offset++] = height;
          header[offset++] = areContours ? 0 : 1;
          header[offset++] = Math.max(0, Math.floor(thickness ?? 0));
          header[offset++] = len;
          header[offset++] = bufferType.BYTES_PER_ELEMENT;
          for (const points of outlines) {
            header[offset++] = points.length - 2;
            header[offset++] = points[0];
            header[offset++] = points[1];
          }
          const cs = new CompressionStream("deflate-raw");
          const writer = cs.writable.getWriter();
          await writer.ready;
          writer.write(header);
          const BufferCtor = bufferType.prototype.constructor;
          for (const points of outlines) {
            const diffs = new BufferCtor(points.length - 2);
            for (let i = 2, ii = points.length; i < ii; i++) {
              diffs[i - 2] = points[i] - points[i - 2];
            }
            writer.write(diffs);
          }
          writer.close();
          const bytes = await new Response(cs.readable).bytes();
          return bytes.toBase64();
        }
        static async decompressSignature(signatureData) {
          try {
            const bytes = Uint8Array.fromBase64(signatureData);
            const {
              readable,
              writable
            } = new DecompressionStream("deflate-raw");
            const writer = writable.getWriter();
            await writer.ready;
            writer.write(bytes).then(async () => {
              await writer.ready;
              await writer.close();
            }).catch(() => {
            });
            let data = null;
            let offset = 0;
            for await (const chunk2 of readable) {
              data || (data = new Uint8Array(new Uint32Array(chunk2.buffer, 0, 4)[0]));
              data.set(chunk2, offset);
              offset += chunk2.length;
            }
            const header = new Uint32Array(data.buffer, 0, data.length >> 2);
            const version3 = header[1];
            if (version3 !== 0) {
              throw new Error(`Invalid version: ${version3}`);
            }
            const width = header[2];
            const height = header[3];
            const areContours = header[4] === 0;
            const thickness = header[5];
            const numberOfDrawings = header[6];
            const bufferType = header[7];
            const outlines = [];
            const diffsOffset = (BASE_HEADER_LENGTH + POINTS_PROPERTIES_NUMBER * numberOfDrawings) * Uint32Array.BYTES_PER_ELEMENT;
            let diffs;
            switch (bufferType) {
              case Int8Array.BYTES_PER_ELEMENT:
                diffs = new Int8Array(data.buffer, diffsOffset);
                break;
              case Int16Array.BYTES_PER_ELEMENT:
                diffs = new Int16Array(data.buffer, diffsOffset);
                break;
              case Int32Array.BYTES_PER_ELEMENT:
                diffs = new Int32Array(data.buffer, diffsOffset);
                break;
            }
            offset = 0;
            for (let i = 0; i < numberOfDrawings; i++) {
              const len = header[POINTS_PROPERTIES_NUMBER * i + BASE_HEADER_LENGTH];
              const points = new Float32Array(len + 2);
              outlines.push(points);
              for (let j = 0; j < POINTS_PROPERTIES_NUMBER - 1; j++) {
                points[j] = header[POINTS_PROPERTIES_NUMBER * i + BASE_HEADER_LENGTH + j + 1];
              }
              for (let j = 0; j < len; j++) {
                points[j + 2] = points[j] + diffs[offset++];
              }
            }
            return {
              areContours,
              thickness,
              outlines,
              width,
              height
            };
          } catch (e) {
            warn(`decompressSignature: ${e}`);
            return null;
          }
        }
      };
      _PARAMETERS = new WeakMap();
      _SignatureExtractor_static = new WeakSet();
      neighborIndexToId_fn = function(i0, j0, i, j) {
        i -= i0;
        j -= j0;
        if (i === 0) {
          return j > 0 ? 0 : 4;
        }
        if (i === 1) {
          return j + 6;
        }
        return 2 - j;
      };
      _neighborIdToIndex = new WeakMap();
      clockwiseNonZero_fn = function(buf, width, i0, j0, i, j, offset) {
        const id = __privateMethod(this, _SignatureExtractor_static, neighborIndexToId_fn).call(this, i0, j0, i, j);
        for (let k = 0; k < 8; k++) {
          const kk = (-k + id - offset + 16) % 8;
          const shiftI = __privateGet(this, _neighborIdToIndex)[2 * kk];
          const shiftJ = __privateGet(this, _neighborIdToIndex)[2 * kk + 1];
          if (buf[(i0 + shiftI) * width + (j0 + shiftJ)] !== 0) {
            return kk;
          }
        }
        return -1;
      };
      counterClockwiseNonZero_fn = function(buf, width, i0, j0, i, j, offset) {
        const id = __privateMethod(this, _SignatureExtractor_static, neighborIndexToId_fn).call(this, i0, j0, i, j);
        for (let k = 0; k < 8; k++) {
          const kk = (k + id + offset + 16) % 8;
          const shiftI = __privateGet(this, _neighborIdToIndex)[2 * kk];
          const shiftJ = __privateGet(this, _neighborIdToIndex)[2 * kk + 1];
          if (buf[(i0 + shiftI) * width + (j0 + shiftJ)] !== 0) {
            return kk;
          }
        }
        return -1;
      };
      findContours_fn = function(buf, width, height, threshold) {
        const N = buf.length;
        const types = new Int32Array(N);
        for (let i = 0; i < N; i++) {
          types[i] = buf[i] <= threshold ? 1 : 0;
        }
        for (let i = 1; i < height - 1; i++) {
          types[i * width] = types[i * width + width - 1] = 0;
        }
        for (let i = 0; i < width; i++) {
          types[i] = types[width * height - 1 - i] = 0;
        }
        let nbd = 1;
        let lnbd;
        const contours = [];
        for (let i = 1; i < height - 1; i++) {
          lnbd = 1;
          for (let j = 1; j < width - 1; j++) {
            const ij = i * width + j;
            const pix = types[ij];
            if (pix === 0) {
              continue;
            }
            let i2 = i;
            let j2 = j;
            if (pix === 1 && types[ij - 1] === 0) {
              nbd += 1;
              j2 -= 1;
            } else if (pix >= 1 && types[ij + 1] === 0) {
              nbd += 1;
              j2 += 1;
              if (pix > 1) {
                lnbd = pix;
              }
            } else {
              if (pix !== 1) {
                lnbd = Math.abs(pix);
              }
              continue;
            }
            const points = [j, i];
            const isHole = j2 === j + 1;
            const contour = {
              isHole,
              points,
              id: nbd,
              parent: 0
            };
            contours.push(contour);
            let contour0;
            for (const c of contours) {
              if (c.id === lnbd) {
                contour0 = c;
                break;
              }
            }
            if (!contour0) {
              contour.parent = isHole ? lnbd : 0;
            } else if (contour0.isHole) {
              contour.parent = isHole ? contour0.parent : lnbd;
            } else {
              contour.parent = isHole ? lnbd : contour0.parent;
            }
            const k = __privateMethod(this, _SignatureExtractor_static, clockwiseNonZero_fn).call(this, types, width, i, j, i2, j2, 0);
            if (k === -1) {
              types[ij] = -nbd;
              if (types[ij] !== 1) {
                lnbd = Math.abs(types[ij]);
              }
              continue;
            }
            let shiftI = __privateGet(this, _neighborIdToIndex)[2 * k];
            let shiftJ = __privateGet(this, _neighborIdToIndex)[2 * k + 1];
            const i1 = i + shiftI;
            const j1 = j + shiftJ;
            i2 = i1;
            j2 = j1;
            let i3 = i;
            let j3 = j;
            while (true) {
              const kk = __privateMethod(this, _SignatureExtractor_static, counterClockwiseNonZero_fn).call(this, types, width, i3, j3, i2, j2, 1);
              shiftI = __privateGet(this, _neighborIdToIndex)[2 * kk];
              shiftJ = __privateGet(this, _neighborIdToIndex)[2 * kk + 1];
              const i4 = i3 + shiftI;
              const j4 = j3 + shiftJ;
              points.push(j4, i4);
              const ij3 = i3 * width + j3;
              if (types[ij3 + 1] === 0) {
                types[ij3] = -nbd;
              } else if (types[ij3] === 1) {
                types[ij3] = nbd;
              }
              if (i4 === i && j4 === j && i3 === i1 && j3 === j1) {
                if (types[ij] !== 1) {
                  lnbd = Math.abs(types[ij]);
                }
                break;
              } else {
                i2 = i3;
                j2 = j3;
                i3 = i4;
                j3 = j4;
              }
            }
          }
        }
        return contours;
      };
      douglasPeuckerHelper_fn = function(points, start, end, output) {
        if (end - start <= 4) {
          for (let i = start; i < end - 2; i += 2) {
            output.push(points[i], points[i + 1]);
          }
          return;
        }
        const ax = points[start];
        const ay = points[start + 1];
        const abx = points[end - 4] - ax;
        const aby = points[end - 3] - ay;
        const dist = Math.hypot(abx, aby);
        const nabx = abx / dist;
        const naby = aby / dist;
        const aa = nabx * ay - naby * ax;
        const m = aby / abx;
        const invS = 1 / dist;
        const phi = Math.atan(m);
        const cosPhi = Math.cos(phi);
        const sinPhi = Math.sin(phi);
        const tmax = invS * (Math.abs(cosPhi) + Math.abs(sinPhi));
        const poly = invS * (1 - tmax + tmax ** 2);
        const partialPhi = Math.max(Math.atan(Math.abs(sinPhi + cosPhi) * poly), Math.atan(Math.abs(sinPhi - cosPhi) * poly));
        let dmax = 0;
        let index = start;
        for (let i = start + 2; i < end - 2; i += 2) {
          const d = Math.abs(aa - nabx * points[i + 1] + naby * points[i]);
          if (d > dmax) {
            index = i;
            dmax = d;
          }
        }
        if (dmax > (dist * partialPhi) ** 2) {
          __privateMethod(this, _SignatureExtractor_static, douglasPeuckerHelper_fn).call(this, points, start, index + 2, output);
          __privateMethod(this, _SignatureExtractor_static, douglasPeuckerHelper_fn).call(this, points, index, end, output);
        } else {
          output.push(ax, ay);
        }
      };
      douglasPeucker_fn = function(points) {
        const output = [];
        const len = points.length;
        __privateMethod(this, _SignatureExtractor_static, douglasPeuckerHelper_fn).call(this, points, 0, len, output);
        output.push(points[len - 2], points[len - 1]);
        return output.length <= 4 ? null : output;
      };
      bilateralFilter_fn = function(buf, width, height, sigmaS, sigmaR, kernelSize) {
        const kernel = new Float32Array(kernelSize ** 2);
        const sigmaS2 = -2 * sigmaS ** 2;
        const halfSize = kernelSize >> 1;
        for (let i = 0; i < kernelSize; i++) {
          const x = (i - halfSize) ** 2;
          for (let j = 0; j < kernelSize; j++) {
            kernel[i * kernelSize + j] = Math.exp((x + (j - halfSize) ** 2) / sigmaS2);
          }
        }
        const rangeValues = new Float32Array(256);
        const sigmaR2 = -2 * sigmaR ** 2;
        for (let i = 0; i < 256; i++) {
          rangeValues[i] = Math.exp(i ** 2 / sigmaR2);
        }
        const N = buf.length;
        const out = new Uint8Array(N);
        const histogram = new Uint32Array(256);
        for (let i = 0; i < height; i++) {
          for (let j = 0; j < width; j++) {
            const ij = i * width + j;
            const center = buf[ij];
            let sum = 0;
            let norm = 0;
            for (let k = 0; k < kernelSize; k++) {
              const y = i + k - halfSize;
              if (y < 0 || y >= height) {
                continue;
              }
              for (let l2 = 0; l2 < kernelSize; l2++) {
                const x = j + l2 - halfSize;
                if (x < 0 || x >= width) {
                  continue;
                }
                const neighbour = buf[y * width + x];
                const w = kernel[k * kernelSize + l2] * rangeValues[Math.abs(neighbour - center)];
                sum += neighbour * w;
                norm += w;
              }
            }
            const pix = out[ij] = Math.round(sum / norm);
            histogram[pix]++;
          }
        }
        return [out, histogram];
      };
      getHistogram_fn = function(buf) {
        const histogram = new Uint32Array(256);
        for (const g of buf) {
          histogram[g]++;
        }
        return histogram;
      };
      toUint8_fn = function(buf) {
        const N = buf.length;
        const out = new Uint8ClampedArray(N >> 2);
        let max2 = -Infinity;
        let min2 = Infinity;
        for (let i = 0, ii = out.length; i < ii; i++) {
          const pix = out[i] = buf[i << 2];
          max2 = Math.max(max2, pix);
          min2 = Math.min(min2, pix);
        }
        const ratio = 255 / (max2 - min2);
        for (let i = 0, ii = out.length; i < ii; i++) {
          out[i] = (out[i] - min2) * ratio;
        }
        return out;
      };
      guessThreshold_fn = function(histogram) {
        let i;
        let M = -Infinity;
        let L = -Infinity;
        const min2 = histogram.findIndex((v) => v !== 0);
        let pos = min2;
        let spos = min2;
        for (i = min2; i < 256; i++) {
          const v = histogram[i];
          if (v > M) {
            if (i - pos > L) {
              L = i - pos;
              spos = i - 1;
            }
            M = v;
            pos = i;
          }
        }
        for (i = spos - 1; i >= 0; i--) {
          if (histogram[i] > histogram[i + 1]) {
            break;
          }
        }
        return i;
      };
      getGrayPixels_fn = function(bitmap) {
        const originalBitmap = bitmap;
        const {
          width,
          height
        } = bitmap;
        const {
          maxDim
        } = __privateGet(this, _PARAMETERS);
        let newWidth = width;
        let newHeight = height;
        if (width > maxDim || height > maxDim) {
          let prevWidth = width;
          let prevHeight = height;
          let steps = Math.log2(Math.max(width, height) / maxDim);
          const isteps = Math.floor(steps);
          steps = steps === isteps ? isteps - 1 : isteps;
          for (let i = 0; i < steps; i++) {
            newWidth = Math.ceil(prevWidth / 2);
            newHeight = Math.ceil(prevHeight / 2);
            const offscreen2 = new OffscreenCanvas(newWidth, newHeight);
            const ctx2 = offscreen2.getContext("2d");
            ctx2.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
            prevWidth = newWidth;
            prevHeight = newHeight;
            if (bitmap !== originalBitmap) {
              bitmap.close();
            }
            bitmap = offscreen2.transferToImageBitmap();
          }
          const ratio = Math.min(maxDim / newWidth, maxDim / newHeight);
          newWidth = Math.round(newWidth * ratio);
          newHeight = Math.round(newHeight * ratio);
        }
        const offscreen = new OffscreenCanvas(newWidth, newHeight);
        const ctx = offscreen.getContext("2d", {
          willReadFrequently: true
        });
        ctx.fillStyle = "white";
        ctx.fillRect(0, 0, newWidth, newHeight);
        ctx.filter = "grayscale(1)";
        ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, newWidth, newHeight);
        const grayImage = ctx.getImageData(0, 0, newWidth, newHeight).data;
        const uint8Buf = __privateMethod(this, _SignatureExtractor_static, toUint8_fn).call(this, grayImage);
        return [uint8Buf, newWidth, newHeight];
      };
      __privateAdd(SignatureExtractor, _SignatureExtractor_static);
      __privateAdd(SignatureExtractor, _PARAMETERS, {
        maxDim: 512,
        sigmaSFactor: 0.02,
        sigmaR: 25,
        kernelSize: 16
      });
      __privateAdd(SignatureExtractor, _neighborIdToIndex, new Int32Array([0, 1, -1, 1, -1, 0, -1, -1, 0, -1, 1, -1, 1, 0, 1, 1]));
      SignatureOptions = class _SignatureOptions extends DrawingOptions {
        constructor() {
          super();
          super.updateProperties({
            fill: AnnotationEditor._defaultLineColor,
            "stroke-width": 0
          });
        }
        clone() {
          const clone2 = new _SignatureOptions();
          clone2.updateAll(this);
          return clone2;
        }
      };
      DrawnSignatureOptions = class _DrawnSignatureOptions extends InkDrawingOptions {
        constructor(viewerParameters) {
          super(viewerParameters);
          super.updateProperties({
            stroke: AnnotationEditor._defaultLineColor,
            "stroke-width": 1
          });
        }
        clone() {
          const clone2 = new _DrawnSignatureOptions(this._viewParameters);
          clone2.updateAll(this);
          return clone2;
        }
      };
      _SignatureEditor = class _SignatureEditor extends DrawingEditor {
        constructor(params) {
          super({
            ...params,
            mustBeCommitted: true,
            name: "signatureEditor"
          });
          __privateAdd(this, _isExtracted, false);
          __privateAdd(this, _description, null);
          __privateAdd(this, _signatureData, null);
          __privateAdd(this, _signatureUUID, null);
          this._willKeepAspectRatio = true;
          __privateSet(this, _signatureData, params.signatureData || null);
          __privateSet(this, _description, null);
          this.defaultL10nId = "pdfjs-editor-signature-editor1";
        }
        static initialize(l10n, uiManager) {
          AnnotationEditor.initialize(l10n, uiManager);
          this._defaultDrawingOptions = new SignatureOptions();
          this._defaultDrawnSignatureOptions = new DrawnSignatureOptions(uiManager.viewParameters);
        }
        static getDefaultDrawingOptions(options) {
          const clone2 = this._defaultDrawingOptions.clone();
          clone2.updateProperties(options);
          return clone2;
        }
        static get supportMultipleDrawings() {
          return false;
        }
        static get typesMap() {
          return shadow(this, "typesMap", /* @__PURE__ */ new Map());
        }
        static get isDrawer() {
          return false;
        }
        get telemetryFinalData() {
          return {
            type: "signature",
            hasDescription: !!__privateGet(this, _description)
          };
        }
        static computeTelemetryFinalData(data) {
          const hasDescriptionStats = data.get("hasDescription");
          return {
            hasAltText: hasDescriptionStats.get(true) ?? 0,
            hasNoAltText: hasDescriptionStats.get(false) ?? 0
          };
        }
        get isResizable() {
          return true;
        }
        onScaleChanging() {
          if (this._drawId === null) {
            return;
          }
          super.onScaleChanging();
        }
        render() {
          if (this.div) {
            return this.div;
          }
          let baseX, baseY;
          const {
            _isCopy
          } = this;
          if (_isCopy) {
            this._isCopy = false;
            baseX = this.x;
            baseY = this.y;
          }
          super.render();
          if (this._drawId === null) {
            if (__privateGet(this, _signatureData)) {
              const {
                lines,
                mustSmooth,
                areContours,
                description,
                uuid,
                heightInPage
              } = __privateGet(this, _signatureData);
              const {
                rawDims: {
                  pageWidth,
                  pageHeight
                },
                rotation
              } = this.parent.viewport;
              const outline = SignatureExtractor.processDrawnLines({
                lines,
                pageWidth,
                pageHeight,
                rotation,
                innerMargin: _SignatureEditor._INNER_MARGIN,
                mustSmooth,
                areContours
              });
              this.addSignature(outline, heightInPage, description, uuid);
            } else {
              this.div.setAttribute("data-l10n-args", JSON.stringify({
                description: ""
              }));
              this.div.hidden = true;
              this._uiManager.getSignature(this);
            }
          } else {
            this.div.setAttribute("data-l10n-args", JSON.stringify({
              description: __privateGet(this, _description) || ""
            }));
          }
          if (_isCopy) {
            this._isCopy = true;
            this._moveAfterPaste(baseX, baseY);
          }
          return this.div;
        }
        setUuid(uuid) {
          __privateSet(this, _signatureUUID, uuid);
          this.addEditToolbar();
        }
        getUuid() {
          return __privateGet(this, _signatureUUID);
        }
        get description() {
          return __privateGet(this, _description);
        }
        set description(description) {
          __privateSet(this, _description, description);
          if (!this.div) {
            return;
          }
          this.div.setAttribute("data-l10n-args", JSON.stringify({
            description
          }));
          super.addEditToolbar().then((toolbar) => {
            toolbar?.updateEditSignatureButton(description);
          });
        }
        getSignaturePreview() {
          const {
            newCurves,
            areContours,
            thickness,
            width,
            height
          } = __privateGet(this, _signatureData);
          const maxDim = Math.max(width, height);
          const outlineData = SignatureExtractor.processDrawnLines({
            lines: {
              curves: newCurves.map((points) => ({
                points
              })),
              thickness,
              width,
              height
            },
            pageWidth: maxDim,
            pageHeight: maxDim,
            rotation: 0,
            innerMargin: 0,
            mustSmooth: false,
            areContours
          });
          return {
            areContours,
            outline: outlineData.outline
          };
        }
        get toolbarButtons() {
          if (this._uiManager.signatureManager) {
            return [["editSignature", this._uiManager.signatureManager]];
          }
          return super.toolbarButtons;
        }
        addSignature(data, heightInPage, description, uuid) {
          const {
            x: savedX,
            y: savedY
          } = this;
          const {
            outline
          } = __privateSet(this, _signatureData, data);
          __privateSet(this, _isExtracted, outline instanceof ContourDrawOutline);
          this.description = description;
          let drawingOptions;
          if (__privateGet(this, _isExtracted)) {
            drawingOptions = _SignatureEditor.getDefaultDrawingOptions();
          } else {
            drawingOptions = _SignatureEditor._defaultDrawnSignatureOptions.clone();
            drawingOptions.updateProperties({
              "stroke-width": outline.thickness
            });
          }
          this._addOutlines({
            drawOutlines: outline,
            drawingOptions
          });
          const [, pageHeight] = this.pageDimensions;
          let newHeight = heightInPage / pageHeight;
          newHeight = newHeight >= 1 ? 0.5 : newHeight;
          this.width *= newHeight / this.height;
          if (this.width >= 1) {
            newHeight *= 0.9 / this.width;
            this.width = 0.9;
          }
          this.height = newHeight;
          this.setDims();
          this.x = savedX;
          this.y = savedY;
          this.center();
          this._onResized();
          this.onScaleChanging();
          this.rotate();
          this._uiManager.addToAnnotationStorage(this);
          this.setUuid(uuid);
          this._reportTelemetry({
            action: "pdfjs.signature.inserted",
            data: {
              hasBeenSaved: !!uuid,
              hasDescription: !!description
            }
          });
          this.div.hidden = false;
        }
        getFromImage(bitmap) {
          const {
            rawDims: {
              pageWidth,
              pageHeight
            },
            rotation
          } = this.parent.viewport;
          return SignatureExtractor.process(bitmap, pageWidth, pageHeight, rotation, _SignatureEditor._INNER_MARGIN);
        }
        getFromText(text, fontInfo) {
          const {
            rawDims: {
              pageWidth,
              pageHeight
            },
            rotation
          } = this.parent.viewport;
          return SignatureExtractor.extractContoursFromText(text, fontInfo, pageWidth, pageHeight, rotation, _SignatureEditor._INNER_MARGIN);
        }
        getDrawnSignature(curves) {
          const {
            rawDims: {
              pageWidth,
              pageHeight
            },
            rotation
          } = this.parent.viewport;
          return SignatureExtractor.processDrawnLines({
            lines: curves,
            pageWidth,
            pageHeight,
            rotation,
            innerMargin: _SignatureEditor._INNER_MARGIN,
            mustSmooth: false,
            areContours: false
          });
        }
        createDrawingOptions({
          areContours,
          thickness
        }) {
          if (areContours) {
            this._drawingOptions = _SignatureEditor.getDefaultDrawingOptions();
          } else {
            this._drawingOptions = _SignatureEditor._defaultDrawnSignatureOptions.clone();
            this._drawingOptions.updateProperties({
              "stroke-width": thickness
            });
          }
        }
        serialize(isForCopying = false) {
          if (this.isEmpty()) {
            return null;
          }
          const {
            lines,
            points
          } = this.serializeDraw(isForCopying);
          const {
            _drawingOptions: {
              "stroke-width": thickness
            }
          } = this;
          const serialized = Object.assign(super.serialize(isForCopying), {
            isSignature: true,
            areContours: __privateGet(this, _isExtracted),
            color: [0, 0, 0],
            thickness: __privateGet(this, _isExtracted) ? 0 : thickness
          });
          this.addComment(serialized);
          if (isForCopying) {
            serialized.paths = {
              lines,
              points
            };
            serialized.uuid = __privateGet(this, _signatureUUID);
            serialized.isCopy = true;
          } else {
            serialized.lines = lines;
          }
          if (__privateGet(this, _description)) {
            serialized.accessibilityData = {
              type: "Figure",
              alt: __privateGet(this, _description)
            };
          }
          return serialized;
        }
        static deserializeDraw(pageX, pageY, pageWidth, pageHeight, innerMargin, data) {
          if (data.areContours) {
            return ContourDrawOutline.deserialize(pageX, pageY, pageWidth, pageHeight, innerMargin, data);
          }
          return InkDrawOutline.deserialize(pageX, pageY, pageWidth, pageHeight, innerMargin, data);
        }
        static async deserialize(data, parent, uiManager) {
          const editor = await super.deserialize(data, parent, uiManager);
          __privateSet(editor, _isExtracted, data.areContours);
          editor.description = data.accessibilityData?.alt || "";
          __privateSet(editor, _signatureUUID, data.uuid);
          return editor;
        }
      };
      _isExtracted = new WeakMap();
      _description = new WeakMap();
      _signatureData = new WeakMap();
      _signatureUUID = new WeakMap();
      __publicField(_SignatureEditor, "_type", "signature");
      __publicField(_SignatureEditor, "_editorType", AnnotationEditorType.SIGNATURE);
      __publicField(_SignatureEditor, "_defaultDrawingOptions", null);
      SignatureEditor = _SignatureEditor;
      StampEditor = class extends AnnotationEditor {
        constructor(params) {
          super({
            ...params,
            name: "stampEditor"
          });
          __privateAdd(this, _StampEditor_instances);
          __privateAdd(this, _bitmap, null);
          __privateAdd(this, _bitmapId, null);
          __privateAdd(this, _bitmapPromise, null);
          __privateAdd(this, _bitmapUrl, null);
          __privateAdd(this, _bitmapFile, null);
          __privateAdd(this, _bitmapFileName, "");
          __privateAdd(this, _canvas, null);
          __privateAdd(this, _missingCanvas, false);
          __privateAdd(this, _resizeTimeoutId, null);
          __privateAdd(this, _isSvg, false);
          __privateAdd(this, _hasBeenAddedInUndoStack, false);
          __privateSet(this, _bitmapUrl, params.bitmapUrl);
          __privateSet(this, _bitmapFile, params.bitmapFile);
          this.defaultL10nId = "pdfjs-editor-stamp-editor";
        }
        static initialize(l10n, uiManager) {
          AnnotationEditor.initialize(l10n, uiManager);
        }
        static isHandlingMimeForPasting(mime) {
          return SupportedImageMimeTypes.includes(mime);
        }
        static paste(item, parent) {
          parent.pasteEditor({
            mode: AnnotationEditorType.STAMP
          }, {
            bitmapFile: item.getAsFile()
          });
        }
        altTextFinish() {
          if (this._uiManager.useNewAltTextFlow) {
            this.div.hidden = false;
          }
          super.altTextFinish();
        }
        get telemetryFinalData() {
          return {
            type: "stamp",
            hasAltText: !!this.altTextData?.altText
          };
        }
        static computeTelemetryFinalData(data) {
          const hasAltTextStats = data.get("hasAltText");
          return {
            hasAltText: hasAltTextStats.get(true) ?? 0,
            hasNoAltText: hasAltTextStats.get(false) ?? 0
          };
        }
        async mlGuessAltText(imageData = null, updateAltTextData = true) {
          if (this.hasAltTextData()) {
            return null;
          }
          const {
            mlManager
          } = this._uiManager;
          if (!mlManager) {
            throw new Error("No ML.");
          }
          if (!await mlManager.isEnabledFor("altText")) {
            throw new Error("ML isn't enabled for alt text.");
          }
          const {
            data,
            width,
            height
          } = imageData || this.copyCanvas(null, null, true).imageData;
          const response = await mlManager.guess({
            name: "altText",
            request: {
              data,
              width,
              height,
              channels: data.length / (width * height)
            }
          });
          if (!response) {
            throw new Error("No response from the AI service.");
          }
          if (response.error) {
            throw new Error("Error from the AI service.");
          }
          if (response.cancel) {
            return null;
          }
          if (!response.output) {
            throw new Error("No valid response from the AI service.");
          }
          const altText = response.output;
          await this.setGuessedAltText(altText);
          if (updateAltTextData && !this.hasAltTextData()) {
            this.altTextData = {
              alt: altText,
              decorative: false
            };
          }
          return altText;
        }
        remove() {
          if (__privateGet(this, _bitmapId)) {
            __privateSet(this, _bitmap, null);
            this._uiManager.imageManager.deleteId(__privateGet(this, _bitmapId));
            __privateGet(this, _canvas)?.remove();
            __privateSet(this, _canvas, null);
            if (__privateGet(this, _resizeTimeoutId)) {
              clearTimeout(__privateGet(this, _resizeTimeoutId));
              __privateSet(this, _resizeTimeoutId, null);
            }
          }
          super.remove();
        }
        rebuild() {
          if (!this.parent) {
            if (__privateGet(this, _bitmapId)) {
              __privateMethod(this, _StampEditor_instances, getBitmap_fn).call(this);
            }
            return;
          }
          super.rebuild();
          if (this.div === null) {
            return;
          }
          if (__privateGet(this, _bitmapId) && __privateGet(this, _canvas) === null) {
            __privateMethod(this, _StampEditor_instances, getBitmap_fn).call(this);
          }
          if (!this.isAttachedToDOM) {
            this.parent.add(this);
          }
        }
        onceAdded(focus) {
          this._isDraggable = true;
          if (focus) {
            this.div.focus();
          }
        }
        isEmpty() {
          return !(__privateGet(this, _bitmapPromise) || __privateGet(this, _bitmap) || __privateGet(this, _bitmapUrl) || __privateGet(this, _bitmapFile) || __privateGet(this, _bitmapId) || __privateGet(this, _missingCanvas));
        }
        get toolbarButtons() {
          return [["altText", this.createAltText()]];
        }
        get isResizable() {
          return true;
        }
        render() {
          if (this.div) {
            return this.div;
          }
          let baseX, baseY;
          if (this._isCopy) {
            baseX = this.x;
            baseY = this.y;
          }
          super.render();
          this.div.hidden = true;
          this.createAltText();
          if (!__privateGet(this, _missingCanvas)) {
            if (__privateGet(this, _bitmap)) {
              __privateMethod(this, _StampEditor_instances, createCanvas_fn).call(this);
            } else {
              __privateMethod(this, _StampEditor_instances, getBitmap_fn).call(this);
            }
          }
          if (this._isCopy) {
            this._moveAfterPaste(baseX, baseY);
          }
          this._uiManager.addShouldRescale(this);
          return this.div;
        }
        setCanvas(annotationElementId, canvas) {
          const {
            id: bitmapId,
            bitmap
          } = this._uiManager.imageManager.getFromCanvas(annotationElementId, canvas);
          canvas.remove();
          if (bitmapId && this._uiManager.imageManager.isValidId(bitmapId)) {
            __privateSet(this, _bitmapId, bitmapId);
            if (bitmap) {
              __privateSet(this, _bitmap, bitmap);
            }
            __privateSet(this, _missingCanvas, false);
            __privateMethod(this, _StampEditor_instances, createCanvas_fn).call(this);
          }
        }
        _onResized() {
          this.onScaleChanging();
        }
        onScaleChanging() {
          if (!this.parent) {
            return;
          }
          if (__privateGet(this, _resizeTimeoutId) !== null) {
            clearTimeout(__privateGet(this, _resizeTimeoutId));
          }
          const TIME_TO_WAIT = 200;
          __privateSet(this, _resizeTimeoutId, setTimeout(() => {
            __privateSet(this, _resizeTimeoutId, null);
            __privateMethod(this, _StampEditor_instances, drawBitmap_fn).call(this);
          }, TIME_TO_WAIT));
        }
        copyCanvas(maxDataDimension, maxPreviewDimension, createImageData = false) {
          maxDataDimension || (maxDataDimension = 224);
          const {
            width: bitmapWidth,
            height: bitmapHeight
          } = __privateGet(this, _bitmap);
          const outputScale = new OutputScale();
          let bitmap = __privateGet(this, _bitmap);
          let width = bitmapWidth, height = bitmapHeight;
          let canvas = null;
          if (maxPreviewDimension) {
            if (bitmapWidth > maxPreviewDimension || bitmapHeight > maxPreviewDimension) {
              const ratio = Math.min(maxPreviewDimension / bitmapWidth, maxPreviewDimension / bitmapHeight);
              width = Math.floor(bitmapWidth * ratio);
              height = Math.floor(bitmapHeight * ratio);
            }
            canvas = document.createElement("canvas");
            const scaledWidth = canvas.width = Math.ceil(width * outputScale.sx);
            const scaledHeight = canvas.height = Math.ceil(height * outputScale.sy);
            if (!__privateGet(this, _isSvg)) {
              bitmap = __privateMethod(this, _StampEditor_instances, scaleBitmap_fn).call(this, scaledWidth, scaledHeight);
            }
            const ctx = canvas.getContext("2d");
            ctx.filter = this._uiManager.hcmFilter;
            let white = "white", black = "#cfcfd8";
            if (this._uiManager.hcmFilter !== "none") {
              black = "black";
            } else if (ColorScheme.isDarkMode) {
              white = "#8f8f9d";
              black = "#42414d";
            }
            const boxDim = 15;
            const boxDimWidth = boxDim * outputScale.sx;
            const boxDimHeight = boxDim * outputScale.sy;
            const pattern = new OffscreenCanvas(boxDimWidth * 2, boxDimHeight * 2);
            const patternCtx = pattern.getContext("2d");
            patternCtx.fillStyle = white;
            patternCtx.fillRect(0, 0, boxDimWidth * 2, boxDimHeight * 2);
            patternCtx.fillStyle = black;
            patternCtx.fillRect(0, 0, boxDimWidth, boxDimHeight);
            patternCtx.fillRect(boxDimWidth, boxDimHeight, boxDimWidth, boxDimHeight);
            ctx.fillStyle = ctx.createPattern(pattern, "repeat");
            ctx.fillRect(0, 0, scaledWidth, scaledHeight);
            ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, scaledWidth, scaledHeight);
          }
          let imageData = null;
          if (createImageData) {
            let dataWidth, dataHeight;
            if (outputScale.symmetric && bitmap.width < maxDataDimension && bitmap.height < maxDataDimension) {
              dataWidth = bitmap.width;
              dataHeight = bitmap.height;
            } else {
              bitmap = __privateGet(this, _bitmap);
              if (bitmapWidth > maxDataDimension || bitmapHeight > maxDataDimension) {
                const ratio = Math.min(maxDataDimension / bitmapWidth, maxDataDimension / bitmapHeight);
                dataWidth = Math.floor(bitmapWidth * ratio);
                dataHeight = Math.floor(bitmapHeight * ratio);
                if (!__privateGet(this, _isSvg)) {
                  bitmap = __privateMethod(this, _StampEditor_instances, scaleBitmap_fn).call(this, dataWidth, dataHeight);
                }
              }
            }
            const offscreen = new OffscreenCanvas(dataWidth, dataHeight);
            const offscreenCtx = offscreen.getContext("2d", {
              willReadFrequently: true
            });
            offscreenCtx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, dataWidth, dataHeight);
            imageData = {
              width: dataWidth,
              height: dataHeight,
              data: offscreenCtx.getImageData(0, 0, dataWidth, dataHeight).data
            };
          }
          return {
            canvas,
            width,
            height,
            imageData
          };
        }
        static async deserialize(data, parent, uiManager) {
          let initialData = null;
          let missingCanvas = false;
          if (data instanceof StampAnnotationElement) {
            const {
              data: {
                rect: rect2,
                rotation,
                id,
                structParent,
                popupRef,
                richText,
                contentsObj,
                creationDate,
                modificationDate
              },
              container,
              parent: {
                page: {
                  pageNumber
                }
              },
              canvas
            } = data;
            let bitmapId2, bitmap2;
            if (canvas) {
              delete data.canvas;
              ({
                id: bitmapId2,
                bitmap: bitmap2
              } = uiManager.imageManager.getFromCanvas(container.id, canvas));
              canvas.remove();
            } else {
              missingCanvas = true;
              data._hasNoCanvas = true;
            }
            const altText = (await parent._structTree.getAriaAttributes(`${AnnotationPrefix}${id}`))?.get("aria-label") || "";
            initialData = data = {
              annotationType: AnnotationEditorType.STAMP,
              bitmapId: bitmapId2,
              bitmap: bitmap2,
              pageIndex: pageNumber - 1,
              rect: rect2.slice(0),
              rotation,
              annotationElementId: id,
              id,
              deleted: false,
              accessibilityData: {
                decorative: false,
                altText
              },
              isSvg: false,
              structParent,
              popupRef,
              richText,
              comment: contentsObj?.str || null,
              creationDate,
              modificationDate
            };
          }
          const editor = await super.deserialize(data, parent, uiManager);
          const {
            rect,
            bitmap,
            bitmapUrl,
            bitmapId,
            isSvg,
            accessibilityData
          } = data;
          if (missingCanvas) {
            uiManager.addMissingCanvas(data.id, editor);
            __privateSet(editor, _missingCanvas, true);
          } else if (bitmapId && uiManager.imageManager.isValidId(bitmapId)) {
            __privateSet(editor, _bitmapId, bitmapId);
            if (bitmap) {
              __privateSet(editor, _bitmap, bitmap);
            }
          } else {
            __privateSet(editor, _bitmapUrl, bitmapUrl);
          }
          __privateSet(editor, _isSvg, isSvg);
          const [parentWidth, parentHeight] = editor.pageDimensions;
          editor.width = (rect[2] - rect[0]) / parentWidth;
          editor.height = (rect[3] - rect[1]) / parentHeight;
          if (accessibilityData) {
            editor.altTextData = accessibilityData;
          }
          editor._initialData = initialData;
          if (data.comment) {
            editor.setCommentData(data);
          }
          __privateSet(editor, _hasBeenAddedInUndoStack, !!initialData);
          return editor;
        }
        serialize(isForCopying = false, context = null) {
          if (this.isEmpty()) {
            return null;
          }
          if (this.deleted) {
            return this.serializeDeleted();
          }
          const serialized = Object.assign(super.serialize(isForCopying), {
            bitmapId: __privateGet(this, _bitmapId),
            isSvg: __privateGet(this, _isSvg)
          });
          this.addComment(serialized);
          if (isForCopying) {
            serialized.bitmapUrl = __privateMethod(this, _StampEditor_instances, serializeBitmap_fn).call(this, true);
            serialized.accessibilityData = this.serializeAltText(true);
            serialized.isCopy = true;
            return serialized;
          }
          const {
            decorative,
            altText
          } = this.serializeAltText(false);
          if (!decorative && altText) {
            serialized.accessibilityData = {
              type: "Figure",
              alt: altText
            };
          }
          if (this.annotationElementId) {
            const changes = __privateMethod(this, _StampEditor_instances, hasElementChanged_fn4).call(this, serialized);
            if (changes.isSame) {
              return null;
            }
            if (changes.isSameAltText) {
              delete serialized.accessibilityData;
            } else {
              serialized.accessibilityData.structParent = this._initialData.structParent ?? -1;
            }
            serialized.id = this.annotationElementId;
            delete serialized.bitmapId;
            return serialized;
          }
          if (context === null) {
            return serialized;
          }
          context.stamps || (context.stamps = /* @__PURE__ */ new Map());
          const area = __privateGet(this, _isSvg) ? (serialized.rect[2] - serialized.rect[0]) * (serialized.rect[3] - serialized.rect[1]) : null;
          if (!context.stamps.has(__privateGet(this, _bitmapId))) {
            context.stamps.set(__privateGet(this, _bitmapId), {
              area,
              serialized
            });
            serialized.bitmap = __privateMethod(this, _StampEditor_instances, serializeBitmap_fn).call(this, false);
          } else if (__privateGet(this, _isSvg)) {
            const prevData = context.stamps.get(__privateGet(this, _bitmapId));
            if (area > prevData.area) {
              prevData.area = area;
              prevData.serialized.bitmap.close();
              prevData.serialized.bitmap = __privateMethod(this, _StampEditor_instances, serializeBitmap_fn).call(this, false);
            }
          }
          return serialized;
        }
        renderAnnotationElement(annotation) {
          if (this.deleted) {
            annotation.hide();
            return null;
          }
          annotation.updateEdited({
            rect: this.getPDFRect(),
            popup: this.comment
          });
          return null;
        }
      };
      _bitmap = new WeakMap();
      _bitmapId = new WeakMap();
      _bitmapPromise = new WeakMap();
      _bitmapUrl = new WeakMap();
      _bitmapFile = new WeakMap();
      _bitmapFileName = new WeakMap();
      _canvas = new WeakMap();
      _missingCanvas = new WeakMap();
      _resizeTimeoutId = new WeakMap();
      _isSvg = new WeakMap();
      _hasBeenAddedInUndoStack = new WeakMap();
      _StampEditor_instances = new WeakSet();
      getBitmapFetched_fn = function(data, fromId = false) {
        if (!data) {
          this.remove();
          return;
        }
        __privateSet(this, _bitmap, data.bitmap);
        if (!fromId) {
          __privateSet(this, _bitmapId, data.id);
          __privateSet(this, _isSvg, data.isSvg);
        }
        if (data.file) {
          __privateSet(this, _bitmapFileName, data.file.name);
        }
        __privateMethod(this, _StampEditor_instances, createCanvas_fn).call(this);
      };
      getBitmapDone_fn = function() {
        __privateSet(this, _bitmapPromise, null);
        this._uiManager.enableWaiting(false);
        if (!__privateGet(this, _canvas)) {
          return;
        }
        if (this._uiManager.useNewAltTextWhenAddingImage && this._uiManager.useNewAltTextFlow && __privateGet(this, _bitmap)) {
          this.addEditToolbar().then(() => {
            this._editToolbar.hide();
            this._uiManager.editAltText(this, true);
          });
          return;
        }
        if (!this._uiManager.useNewAltTextWhenAddingImage && this._uiManager.useNewAltTextFlow && __privateGet(this, _bitmap)) {
          this._reportTelemetry({
            action: "pdfjs.image.image_added",
            data: {
              alt_text_modal: false,
              alt_text_type: "empty"
            }
          });
          try {
            this.mlGuessAltText();
          } catch {
          }
        }
        this.div.focus();
      };
      getBitmap_fn = function() {
        if (__privateGet(this, _bitmapId)) {
          this._uiManager.enableWaiting(true);
          this._uiManager.imageManager.getFromId(__privateGet(this, _bitmapId)).then((data) => __privateMethod(this, _StampEditor_instances, getBitmapFetched_fn).call(this, data, true)).finally(() => __privateMethod(this, _StampEditor_instances, getBitmapDone_fn).call(this));
          return;
        }
        if (__privateGet(this, _bitmapUrl)) {
          const url = __privateGet(this, _bitmapUrl);
          __privateSet(this, _bitmapUrl, null);
          this._uiManager.enableWaiting(true);
          __privateSet(this, _bitmapPromise, this._uiManager.imageManager.getFromUrl(url).then((data) => __privateMethod(this, _StampEditor_instances, getBitmapFetched_fn).call(this, data)).finally(() => __privateMethod(this, _StampEditor_instances, getBitmapDone_fn).call(this)));
          return;
        }
        if (__privateGet(this, _bitmapFile)) {
          const file = __privateGet(this, _bitmapFile);
          __privateSet(this, _bitmapFile, null);
          this._uiManager.enableWaiting(true);
          __privateSet(this, _bitmapPromise, this._uiManager.imageManager.getFromFile(file).then((data) => __privateMethod(this, _StampEditor_instances, getBitmapFetched_fn).call(this, data)).finally(() => __privateMethod(this, _StampEditor_instances, getBitmapDone_fn).call(this)));
          return;
        }
        const input = document.createElement("input");
        input.type = "file";
        input.accept = SupportedImageMimeTypes.join(",");
        const signal = this._uiManager._signal;
        __privateSet(this, _bitmapPromise, new Promise((resolve) => {
          input.addEventListener("change", async () => {
            if (!input.files || input.files.length === 0) {
              this.remove();
            } else {
              this._uiManager.enableWaiting(true);
              const data = await this._uiManager.imageManager.getFromFile(input.files[0]);
              this._reportTelemetry({
                action: "pdfjs.image.image_selected",
                data: {
                  alt_text_modal: this._uiManager.useNewAltTextFlow
                }
              });
              __privateMethod(this, _StampEditor_instances, getBitmapFetched_fn).call(this, data);
            }
            resolve();
          }, {
            signal
          });
          input.addEventListener("cancel", () => {
            this.remove();
            resolve();
          }, {
            signal
          });
        }).finally(() => __privateMethod(this, _StampEditor_instances, getBitmapDone_fn).call(this)));
        input.click();
      };
      createCanvas_fn = function() {
        const {
          div
        } = this;
        let {
          width,
          height
        } = __privateGet(this, _bitmap);
        const [pageWidth, pageHeight] = this.pageDimensions;
        const MAX_RATIO = 0.75;
        if (this.width) {
          width = this.width * pageWidth;
          height = this.height * pageHeight;
        } else if (width > MAX_RATIO * pageWidth || height > MAX_RATIO * pageHeight) {
          const factor = Math.min(MAX_RATIO * pageWidth / width, MAX_RATIO * pageHeight / height);
          width *= factor;
          height *= factor;
        }
        this._uiManager.enableWaiting(false);
        const canvas = __privateSet(this, _canvas, document.createElement("canvas"));
        canvas.setAttribute("role", "img");
        this.addContainer(canvas);
        this.width = width / pageWidth;
        this.height = height / pageHeight;
        this.setDims();
        if (this._initialOptions?.isCentered) {
          this.center();
        } else {
          this.fixAndSetPosition();
        }
        this._initialOptions = null;
        if (!this._uiManager.useNewAltTextWhenAddingImage || !this._uiManager.useNewAltTextFlow || this.annotationElementId) {
          div.hidden = false;
        }
        __privateMethod(this, _StampEditor_instances, drawBitmap_fn).call(this);
        if (!__privateGet(this, _hasBeenAddedInUndoStack)) {
          this.parent.addUndoableEditor(this);
          __privateSet(this, _hasBeenAddedInUndoStack, true);
        }
        this._reportTelemetry({
          action: "inserted_image"
        });
        if (__privateGet(this, _bitmapFileName)) {
          this.div.setAttribute("aria-description", __privateGet(this, _bitmapFileName));
        }
        if (!this.annotationElementId) {
          this._uiManager.a11yAlert(AnnotationEditor._l10nAlert.stamp);
        }
      };
      scaleBitmap_fn = function(width, height) {
        const {
          width: bitmapWidth,
          height: bitmapHeight
        } = __privateGet(this, _bitmap);
        let newWidth = bitmapWidth;
        let newHeight = bitmapHeight;
        let bitmap = __privateGet(this, _bitmap);
        while (newWidth > 2 * width || newHeight > 2 * height) {
          const prevWidth = newWidth;
          const prevHeight = newHeight;
          if (newWidth > 2 * width) {
            newWidth = Math.ceil(newWidth / 2);
          }
          if (newHeight > 2 * height) {
            newHeight = Math.ceil(newHeight / 2);
          }
          const offscreen = new OffscreenCanvas(newWidth, newHeight);
          const ctx = offscreen.getContext("2d");
          ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
          bitmap = offscreen.transferToImageBitmap();
        }
        return bitmap;
      };
      drawBitmap_fn = function() {
        const [parentWidth, parentHeight] = this.parentDimensions;
        const {
          width,
          height
        } = this;
        const outputScale = new OutputScale();
        const scaledWidth = Math.ceil(width * parentWidth * outputScale.sx);
        const scaledHeight = Math.ceil(height * parentHeight * outputScale.sy);
        const canvas = __privateGet(this, _canvas);
        if (!canvas || canvas.width === scaledWidth && canvas.height === scaledHeight) {
          return;
        }
        canvas.width = scaledWidth;
        canvas.height = scaledHeight;
        const bitmap = __privateGet(this, _isSvg) ? __privateGet(this, _bitmap) : __privateMethod(this, _StampEditor_instances, scaleBitmap_fn).call(this, scaledWidth, scaledHeight);
        const ctx = canvas.getContext("2d");
        ctx.filter = this._uiManager.hcmFilter;
        ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, scaledWidth, scaledHeight);
      };
      serializeBitmap_fn = function(toUrl) {
        if (toUrl) {
          if (__privateGet(this, _isSvg)) {
            const url = this._uiManager.imageManager.getSvgUrl(__privateGet(this, _bitmapId));
            if (url) {
              return url;
            }
          }
          const canvas = document.createElement("canvas");
          ({
            width: canvas.width,
            height: canvas.height
          } = __privateGet(this, _bitmap));
          const ctx = canvas.getContext("2d");
          ctx.drawImage(__privateGet(this, _bitmap), 0, 0);
          return canvas.toDataURL();
        }
        if (__privateGet(this, _isSvg)) {
          const [pageWidth, pageHeight] = this.pageDimensions;
          const width = Math.round(this.width * pageWidth * PixelsPerInch.PDF_TO_CSS_UNITS);
          const height = Math.round(this.height * pageHeight * PixelsPerInch.PDF_TO_CSS_UNITS);
          const offscreen = new OffscreenCanvas(width, height);
          const ctx = offscreen.getContext("2d");
          ctx.drawImage(__privateGet(this, _bitmap), 0, 0, __privateGet(this, _bitmap).width, __privateGet(this, _bitmap).height, 0, 0, width, height);
          return offscreen.transferToImageBitmap();
        }
        return structuredClone(__privateGet(this, _bitmap));
      };
      hasElementChanged_fn4 = function(serialized) {
        const {
          pageIndex,
          accessibilityData: {
            altText
          }
        } = this._initialData;
        const isSamePageIndex = serialized.pageIndex === pageIndex;
        const isSameAltText = (serialized.accessibilityData?.alt || "") === altText;
        return {
          isSame: !this.hasEditedComment && !this._hasBeenMoved && !this._hasBeenResized && isSamePageIndex && isSameAltText,
          isSameAltText
        };
      };
      __publicField(StampEditor, "_type", "stamp");
      __publicField(StampEditor, "_editorType", AnnotationEditorType.STAMP);
      _AnnotationEditorLayer = class _AnnotationEditorLayer {
        constructor({
          uiManager,
          pageIndex,
          div,
          structTreeLayer,
          accessibilityManager,
          annotationLayer,
          drawLayer,
          textLayer,
          viewport,
          l10n
        }) {
          __privateAdd(this, _AnnotationEditorLayer_instances);
          __privateAdd(this, _accessibilityManager2);
          __privateAdd(this, _allowClick, false);
          __privateAdd(this, _annotationLayer, null);
          __privateAdd(this, _clickAC, null);
          __privateAdd(this, _editorFocusTimeoutId, null);
          __privateAdd(this, _editors, /* @__PURE__ */ new Map());
          __privateAdd(this, _hadPointerDown, false);
          __privateAdd(this, _isDisabling, false);
          __privateAdd(this, _isEnabling, false);
          __privateAdd(this, _drawingAC, null);
          __privateAdd(this, _focusedElement, null);
          __privateAdd(this, _textLayer, null);
          __privateAdd(this, _textSelectionAC, null);
          __privateAdd(this, _textLayerDblClickAC, null);
          __privateAdd(this, _lastPointerDownTimestamp, -1);
          __privateAdd(this, _uiManager4);
          const editorTypes = [...__privateGet(_AnnotationEditorLayer, _editorTypes2).values()];
          if (!_AnnotationEditorLayer._initialized) {
            _AnnotationEditorLayer._initialized = true;
            for (const editorType of editorTypes) {
              editorType.initialize(l10n, uiManager);
            }
          }
          uiManager.registerEditorTypes(editorTypes);
          __privateSet(this, _uiManager4, uiManager);
          this.pageIndex = pageIndex;
          this.div = div;
          __privateSet(this, _accessibilityManager2, accessibilityManager);
          __privateSet(this, _annotationLayer, annotationLayer);
          this.viewport = viewport;
          __privateSet(this, _textLayer, textLayer);
          this.drawLayer = drawLayer;
          this._structTree = structTreeLayer;
          __privateGet(this, _uiManager4).addLayer(this);
        }
        get isEmpty() {
          return __privateGet(this, _editors).size === 0;
        }
        get isInvisible() {
          return this.isEmpty && __privateGet(this, _uiManager4).getMode() === AnnotationEditorType.NONE;
        }
        updateToolbar(options) {
          __privateGet(this, _uiManager4).updateToolbar(options);
        }
        updateMode(mode = __privateGet(this, _uiManager4).getMode()) {
          __privateMethod(this, _AnnotationEditorLayer_instances, cleanup_fn).call(this);
          switch (mode) {
            case AnnotationEditorType.NONE:
              this.div.classList.toggle("nonEditing", true);
              this.disableTextSelection();
              this.togglePointerEvents(false);
              this.toggleAnnotationLayerPointerEvents(true);
              this.disableClick();
              return;
            case AnnotationEditorType.INK:
              this.disableTextSelection();
              this.togglePointerEvents(true);
              this.enableClick();
              break;
            case AnnotationEditorType.HIGHLIGHT:
              this.enableTextSelection();
              this.togglePointerEvents(false);
              this.disableClick();
              break;
            default:
              this.disableTextSelection();
              this.togglePointerEvents(true);
              this.enableClick();
          }
          this.toggleAnnotationLayerPointerEvents(false);
          const {
            classList
          } = this.div;
          classList.toggle("nonEditing", false);
          if (mode === AnnotationEditorType.POPUP) {
            classList.toggle("commentEditing", true);
          } else {
            classList.toggle("commentEditing", false);
            for (const editorType of __privateGet(_AnnotationEditorLayer, _editorTypes2).values()) {
              classList.toggle(`${editorType._type}Editing`, mode === editorType._editorType);
            }
          }
          this.div.hidden = false;
        }
        hasTextLayer(textLayer) {
          return textLayer === __privateGet(this, _textLayer)?.div;
        }
        setEditingState(isEditing) {
          __privateGet(this, _uiManager4).setEditingState(isEditing);
        }
        addCommands(params) {
          __privateGet(this, _uiManager4).addCommands(params);
        }
        cleanUndoStack(type) {
          __privateGet(this, _uiManager4).cleanUndoStack(type);
        }
        toggleDrawing(enabled = false) {
          this.div.classList.toggle("drawing", !enabled);
        }
        togglePointerEvents(enabled = false) {
          this.div.classList.toggle("disabled", !enabled);
        }
        toggleAnnotationLayerPointerEvents(enabled = false) {
          __privateGet(this, _annotationLayer)?.togglePointerEvents(enabled);
        }
        async enable() {
          __privateSet(this, _isEnabling, true);
          this.div.tabIndex = 0;
          this.togglePointerEvents(true);
          this.div.classList.toggle("nonEditing", false);
          __privateGet(this, _textLayerDblClickAC)?.abort();
          __privateSet(this, _textLayerDblClickAC, null);
          const annotationElementIds = /* @__PURE__ */ new Set();
          for (const editor of __privateGet(this, _AnnotationEditorLayer_instances, allEditorsIterator_get)) {
            editor.enableEditing();
            editor.show(true);
            if (editor.annotationElementId) {
              __privateGet(this, _uiManager4).removeChangedExistingAnnotation(editor);
              annotationElementIds.add(editor.annotationElementId);
            }
          }
          const annotationLayer = __privateGet(this, _annotationLayer);
          if (annotationLayer) {
            for (const editable of annotationLayer.getEditableAnnotations()) {
              editable.hide();
              if (__privateGet(this, _uiManager4).isDeletedAnnotationElement(editable.data.id)) {
                continue;
              }
              if (annotationElementIds.has(editable.data.id)) {
                continue;
              }
              const editor = await this.deserialize(editable);
              if (!editor) {
                continue;
              }
              this.addOrRebuild(editor);
              editor.enableEditing();
            }
          }
          __privateSet(this, _isEnabling, false);
          __privateGet(this, _uiManager4)._eventBus.dispatch("editorsrendered", {
            source: this,
            pageNumber: this.pageIndex + 1
          });
        }
        disable() {
          __privateSet(this, _isDisabling, true);
          this.div.tabIndex = -1;
          this.togglePointerEvents(false);
          this.div.classList.toggle("nonEditing", true);
          if (__privateGet(this, _textLayer) && !__privateGet(this, _textLayerDblClickAC)) {
            __privateSet(this, _textLayerDblClickAC, new AbortController());
            const signal = __privateGet(this, _uiManager4).combinedSignal(__privateGet(this, _textLayerDblClickAC));
            __privateGet(this, _textLayer).div.addEventListener("pointerdown", (e) => {
              const DBL_CLICK_THRESHOLD = 500;
              const {
                clientX,
                clientY,
                timeStamp
              } = e;
              const lastPointerDownTimestamp = __privateGet(this, _lastPointerDownTimestamp);
              if (timeStamp - lastPointerDownTimestamp > DBL_CLICK_THRESHOLD) {
                __privateSet(this, _lastPointerDownTimestamp, timeStamp);
                return;
              }
              __privateSet(this, _lastPointerDownTimestamp, -1);
              const {
                classList: classList2
              } = this.div;
              classList2.toggle("getElements", true);
              const elements = document.elementsFromPoint(clientX, clientY);
              classList2.toggle("getElements", false);
              if (!this.div.contains(elements[0])) {
                return;
              }
              let id;
              const regex = new RegExp(`^${AnnotationEditorPrefix}[0-9]+$`);
              for (const element of elements) {
                if (regex.test(element.id)) {
                  id = element.id;
                  break;
                }
              }
              if (!id) {
                return;
              }
              const editor = __privateGet(this, _editors).get(id);
              if (editor?.annotationElementId === null) {
                stopEvent(e);
                editor.dblclick(e);
              }
            }, {
              signal,
              capture: true
            });
          }
          const annotationLayer = __privateGet(this, _annotationLayer);
          const needFakeAnnotation = [];
          if (annotationLayer) {
            const changedAnnotations = /* @__PURE__ */ new Map();
            const resetAnnotations = /* @__PURE__ */ new Map();
            for (const editor of __privateGet(this, _AnnotationEditorLayer_instances, allEditorsIterator_get)) {
              editor.disableEditing();
              if (!editor.annotationElementId) {
                needFakeAnnotation.push(editor);
                continue;
              }
              if (editor.serialize() !== null) {
                changedAnnotations.set(editor.annotationElementId, editor);
                continue;
              } else {
                resetAnnotations.set(editor.annotationElementId, editor);
              }
              this.getEditableAnnotation(editor.annotationElementId)?.show();
              editor.remove();
            }
            for (const editable of annotationLayer.getEditableAnnotations()) {
              const {
                id
              } = editable.data;
              if (__privateGet(this, _uiManager4).isDeletedAnnotationElement(id)) {
                editable.updateEdited({
                  deleted: true
                });
                continue;
              }
              let editor = resetAnnotations.get(id);
              if (editor) {
                editor.resetAnnotationElement(editable);
                editor.show(false);
                editable.show();
                continue;
              }
              editor = changedAnnotations.get(id);
              if (editor) {
                __privateGet(this, _uiManager4).addChangedExistingAnnotation(editor);
                if (editor.renderAnnotationElement(editable)) {
                  editor.show(false);
                }
              }
              editable.show();
            }
          }
          __privateMethod(this, _AnnotationEditorLayer_instances, cleanup_fn).call(this);
          if (this.isEmpty) {
            this.div.hidden = true;
          }
          const {
            classList
          } = this.div;
          for (const editorType of __privateGet(_AnnotationEditorLayer, _editorTypes2).values()) {
            classList.remove(`${editorType._type}Editing`);
          }
          this.disableTextSelection();
          this.toggleAnnotationLayerPointerEvents(true);
          annotationLayer?.updateFakeAnnotations(needFakeAnnotation);
          __privateSet(this, _isDisabling, false);
        }
        getEditableAnnotation(id) {
          return __privateGet(this, _annotationLayer)?.getEditableAnnotation(id) || null;
        }
        setActiveEditor(editor) {
          const currentActive = __privateGet(this, _uiManager4).getActive();
          if (currentActive === editor) {
            return;
          }
          __privateGet(this, _uiManager4).setActiveEditor(editor);
        }
        enableTextSelection() {
          this.div.tabIndex = -1;
          if (__privateGet(this, _textLayer)?.div && !__privateGet(this, _textSelectionAC)) {
            __privateSet(this, _textSelectionAC, new AbortController());
            const signal = __privateGet(this, _uiManager4).combinedSignal(__privateGet(this, _textSelectionAC));
            __privateGet(this, _textLayer).div.addEventListener("pointerdown", __privateMethod(this, _AnnotationEditorLayer_instances, textLayerPointerDown_fn).bind(this), {
              signal
            });
            __privateGet(this, _textLayer).div.classList.add("highlighting");
          }
        }
        disableTextSelection() {
          this.div.tabIndex = 0;
          if (__privateGet(this, _textLayer)?.div && __privateGet(this, _textSelectionAC)) {
            __privateGet(this, _textSelectionAC).abort();
            __privateSet(this, _textSelectionAC, null);
            __privateGet(this, _textLayer).div.classList.remove("highlighting");
          }
        }
        enableClick() {
          if (__privateGet(this, _clickAC)) {
            return;
          }
          __privateSet(this, _clickAC, new AbortController());
          const signal = __privateGet(this, _uiManager4).combinedSignal(__privateGet(this, _clickAC));
          this.div.addEventListener("pointerdown", this.pointerdown.bind(this), {
            signal
          });
          const pointerup = this.pointerup.bind(this);
          this.div.addEventListener("pointerup", pointerup, {
            signal
          });
          this.div.addEventListener("pointercancel", pointerup, {
            signal
          });
        }
        disableClick() {
          __privateGet(this, _clickAC)?.abort();
          __privateSet(this, _clickAC, null);
        }
        attach(editor) {
          __privateGet(this, _editors).set(editor.id, editor);
          const {
            annotationElementId
          } = editor;
          if (annotationElementId && __privateGet(this, _uiManager4).isDeletedAnnotationElement(annotationElementId)) {
            __privateGet(this, _uiManager4).removeDeletedAnnotationElement(editor);
          }
        }
        detach(editor) {
          __privateGet(this, _editors).delete(editor.id);
          __privateGet(this, _accessibilityManager2)?.removePointerInTextLayer(editor.contentDiv);
          if (!__privateGet(this, _isDisabling) && editor.annotationElementId) {
            __privateGet(this, _uiManager4).addDeletedAnnotationElement(editor);
          }
        }
        remove(editor) {
          this.detach(editor);
          __privateGet(this, _uiManager4).removeEditor(editor);
          editor.div.remove();
          editor.isAttachedToDOM = false;
        }
        changeParent(editor) {
          if (editor.parent === this) {
            return;
          }
          if (editor.parent && editor.annotationElementId) {
            __privateGet(this, _uiManager4).addDeletedAnnotationElement(editor);
            AnnotationEditor.deleteAnnotationElement(editor);
            editor.annotationElementId = null;
          }
          this.attach(editor);
          editor.parent?.detach(editor);
          editor.setParent(this);
          if (editor.div && editor.isAttachedToDOM) {
            editor.div.remove();
            this.div.append(editor.div);
          }
        }
        add(editor) {
          if (editor.parent === this && editor.isAttachedToDOM) {
            return;
          }
          this.changeParent(editor);
          __privateGet(this, _uiManager4).addEditor(editor);
          this.attach(editor);
          if (!editor.isAttachedToDOM) {
            const div = editor.render();
            this.div.append(div);
            editor.isAttachedToDOM = true;
          }
          editor.fixAndSetPosition();
          editor.onceAdded(!__privateGet(this, _isEnabling));
          __privateGet(this, _uiManager4).addToAnnotationStorage(editor);
          editor._reportTelemetry(editor.telemetryInitialData);
        }
        moveEditorInDOM(editor) {
          if (!editor.isAttachedToDOM) {
            return;
          }
          const {
            activeElement
          } = document;
          if (editor.div.contains(activeElement) && !__privateGet(this, _editorFocusTimeoutId)) {
            editor._focusEventsAllowed = false;
            __privateSet(this, _editorFocusTimeoutId, setTimeout(() => {
              __privateSet(this, _editorFocusTimeoutId, null);
              if (!editor.div.contains(document.activeElement)) {
                editor.div.addEventListener("focusin", () => {
                  editor._focusEventsAllowed = true;
                }, {
                  once: true,
                  signal: __privateGet(this, _uiManager4)._signal
                });
                activeElement.focus();
              } else {
                editor._focusEventsAllowed = true;
              }
            }, 0));
          }
          editor._structTreeParentId = __privateGet(this, _accessibilityManager2)?.moveElementInDOM(this.div, editor.div, editor.contentDiv, true);
        }
        addOrRebuild(editor) {
          if (editor.needsToBeRebuilt()) {
            editor.parent || (editor.parent = this);
            editor.rebuild();
            editor.show();
          } else {
            this.add(editor);
          }
        }
        addUndoableEditor(editor) {
          const cmd = () => editor._uiManager.rebuild(editor);
          const undo = () => {
            editor.remove();
          };
          this.addCommands({
            cmd,
            undo,
            mustExec: false
          });
        }
        getEditorByUID(uid) {
          for (const editor of __privateGet(this, _editors).values()) {
            if (editor.uid === uid) {
              return editor;
            }
          }
          return null;
        }
        combinedSignal(ac) {
          return __privateGet(this, _uiManager4).combinedSignal(ac);
        }
        canCreateNewEmptyEditor() {
          return __privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get)?.canCreateNewEmptyEditor();
        }
        async pasteEditor(options, params) {
          this.updateToolbar(options);
          await __privateGet(this, _uiManager4).updateMode(options.mode);
          const {
            offsetX,
            offsetY
          } = __privateMethod(this, _AnnotationEditorLayer_instances, getCenterPoint_fn).call(this);
          const id = __privateGet(this, _uiManager4).getId();
          const editor = __privateMethod(this, _AnnotationEditorLayer_instances, createNewEditor_fn).call(this, {
            parent: this,
            id,
            x: offsetX,
            y: offsetY,
            uiManager: __privateGet(this, _uiManager4),
            isCentered: true,
            ...params
          });
          if (editor) {
            this.add(editor);
          }
        }
        async deserialize(data) {
          return await __privateGet(_AnnotationEditorLayer, _editorTypes2).get(data.annotationType ?? data.annotationEditorType)?.deserialize(data, this, __privateGet(this, _uiManager4)) || null;
        }
        createAndAddNewEditor(event, isCentered, data = {}) {
          const id = __privateGet(this, _uiManager4).getId();
          const editor = __privateMethod(this, _AnnotationEditorLayer_instances, createNewEditor_fn).call(this, {
            parent: this,
            id,
            x: event.offsetX,
            y: event.offsetY,
            uiManager: __privateGet(this, _uiManager4),
            isCentered,
            ...data
          });
          if (editor) {
            this.add(editor);
          }
          return editor;
        }
        get boundingClientRect() {
          return this.div.getBoundingClientRect();
        }
        addNewEditor(data = {}) {
          this.createAndAddNewEditor(__privateMethod(this, _AnnotationEditorLayer_instances, getCenterPoint_fn).call(this), true, data);
        }
        setSelected(editor) {
          __privateGet(this, _uiManager4).setSelected(editor);
        }
        toggleSelected(editor) {
          __privateGet(this, _uiManager4).toggleSelected(editor);
        }
        unselect(editor) {
          __privateGet(this, _uiManager4).unselect(editor);
        }
        pointerup(event) {
          const {
            isMac
          } = FeatureTest.platform;
          if (event.button !== 0 || event.ctrlKey && isMac) {
            return;
          }
          if (event.target !== this.div) {
            return;
          }
          if (!__privateGet(this, _hadPointerDown)) {
            return;
          }
          __privateSet(this, _hadPointerDown, false);
          if (__privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get)?.isDrawer && __privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get).supportMultipleDrawings) {
            return;
          }
          if (!__privateGet(this, _allowClick)) {
            __privateSet(this, _allowClick, true);
            return;
          }
          const currentMode = __privateGet(this, _uiManager4).getMode();
          if (currentMode === AnnotationEditorType.STAMP || currentMode === AnnotationEditorType.POPUP || currentMode === AnnotationEditorType.SIGNATURE) {
            __privateGet(this, _uiManager4).unselectAll();
            return;
          }
          this.createAndAddNewEditor(event, false);
        }
        pointerdown(event) {
          if (__privateGet(this, _uiManager4).getMode() === AnnotationEditorType.HIGHLIGHT) {
            this.enableTextSelection();
          }
          if (__privateGet(this, _hadPointerDown)) {
            __privateSet(this, _hadPointerDown, false);
            return;
          }
          const {
            isMac
          } = FeatureTest.platform;
          if (event.button !== 0 || event.ctrlKey && isMac) {
            return;
          }
          if (event.target !== this.div) {
            return;
          }
          __privateSet(this, _hadPointerDown, true);
          if (__privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get)?.isDrawer) {
            this.startDrawingSession(event);
            return;
          }
          const editor = __privateGet(this, _uiManager4).getActive();
          __privateSet(this, _allowClick, !editor || editor.isEmpty());
        }
        startDrawingSession(event) {
          this.div.focus({
            preventScroll: true
          });
          if (__privateGet(this, _drawingAC)) {
            __privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get).startDrawing(this, __privateGet(this, _uiManager4), false, event);
            return;
          }
          __privateGet(this, _uiManager4).setCurrentDrawingSession(this);
          __privateSet(this, _drawingAC, new AbortController());
          const signal = __privateGet(this, _uiManager4).combinedSignal(__privateGet(this, _drawingAC));
          this.div.addEventListener("blur", ({
            relatedTarget
          }) => {
            if (relatedTarget && !this.div.contains(relatedTarget)) {
              __privateSet(this, _focusedElement, null);
              this.commitOrRemove();
            }
          }, {
            signal
          });
          __privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get).startDrawing(this, __privateGet(this, _uiManager4), false, event);
        }
        pause(on) {
          if (on) {
            const {
              activeElement
            } = document;
            if (this.div.contains(activeElement)) {
              __privateSet(this, _focusedElement, activeElement);
            }
            return;
          }
          if (__privateGet(this, _focusedElement)) {
            setTimeout(() => {
              __privateGet(this, _focusedElement)?.focus();
              __privateSet(this, _focusedElement, null);
            }, 0);
          }
        }
        endDrawingSession(isAborted = false) {
          if (!__privateGet(this, _drawingAC)) {
            return null;
          }
          __privateGet(this, _uiManager4).setCurrentDrawingSession(null);
          __privateGet(this, _drawingAC).abort();
          __privateSet(this, _drawingAC, null);
          __privateSet(this, _focusedElement, null);
          return __privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get).endDrawing(isAborted);
        }
        findNewParent(editor, x, y) {
          const layer = __privateGet(this, _uiManager4).findParent(x, y);
          if (layer === null || layer === this) {
            return false;
          }
          layer.changeParent(editor);
          return true;
        }
        commitOrRemove() {
          if (__privateGet(this, _drawingAC)) {
            this.endDrawingSession();
            return true;
          }
          return false;
        }
        onScaleChanging() {
          if (!__privateGet(this, _drawingAC)) {
            return;
          }
          __privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get).onScaleChangingWhenDrawing(this);
        }
        destroy() {
          this.commitOrRemove();
          if (__privateGet(this, _uiManager4).getActive()?.parent === this) {
            __privateGet(this, _uiManager4).commitOrRemove();
            __privateGet(this, _uiManager4).setActiveEditor(null);
          }
          if (__privateGet(this, _editorFocusTimeoutId)) {
            clearTimeout(__privateGet(this, _editorFocusTimeoutId));
            __privateSet(this, _editorFocusTimeoutId, null);
          }
          for (const editor of __privateGet(this, _editors).values()) {
            __privateGet(this, _accessibilityManager2)?.removePointerInTextLayer(editor.contentDiv);
            editor.setParent(null);
            editor.isAttachedToDOM = false;
            editor.div.remove();
          }
          this.div = null;
          __privateGet(this, _editors).clear();
          __privateGet(this, _uiManager4).removeLayer(this);
        }
        async render({
          viewport
        }) {
          this.viewport = viewport;
          setLayerDimensions(this.div, viewport);
          for (const editor of __privateGet(this, _uiManager4).getEditors(this.pageIndex)) {
            this.add(editor);
            editor.rebuild();
          }
          await __privateGet(this, _uiManager4).findClonesForPage(this);
          this.div.hidden = this.isEmpty;
          this.updateMode();
        }
        update({
          viewport
        }) {
          __privateGet(this, _uiManager4).commitOrRemove();
          __privateMethod(this, _AnnotationEditorLayer_instances, cleanup_fn).call(this);
          const oldRotation = this.viewport.rotation;
          const rotation = viewport.rotation;
          this.viewport = viewport;
          setLayerDimensions(this.div, {
            rotation
          });
          if (oldRotation !== rotation) {
            for (const editor of __privateGet(this, _editors).values()) {
              editor.rotate(rotation);
            }
          }
        }
        get pageDimensions() {
          const {
            pageWidth,
            pageHeight
          } = this.viewport.rawDims;
          return [pageWidth, pageHeight];
        }
        get scale() {
          return __privateGet(this, _uiManager4).viewParameters.realScale;
        }
      };
      _accessibilityManager2 = new WeakMap();
      _allowClick = new WeakMap();
      _annotationLayer = new WeakMap();
      _clickAC = new WeakMap();
      _editorFocusTimeoutId = new WeakMap();
      _editors = new WeakMap();
      _hadPointerDown = new WeakMap();
      _isDisabling = new WeakMap();
      _isEnabling = new WeakMap();
      _drawingAC = new WeakMap();
      _focusedElement = new WeakMap();
      _textLayer = new WeakMap();
      _textSelectionAC = new WeakMap();
      _textLayerDblClickAC = new WeakMap();
      _lastPointerDownTimestamp = new WeakMap();
      _uiManager4 = new WeakMap();
      _editorTypes2 = new WeakMap();
      _AnnotationEditorLayer_instances = new WeakSet();
      allEditorsIterator_get = function() {
        return __privateGet(this, _editors).size !== 0 ? __privateGet(this, _editors).values() : __privateGet(this, _uiManager4).getEditors(this.pageIndex);
      };
      textLayerPointerDown_fn = function(event) {
        __privateGet(this, _uiManager4).unselectAll();
        const {
          target
        } = event;
        if (target === __privateGet(this, _textLayer).div || (target.getAttribute("role") === "img" || target.classList.contains("endOfContent") || target.classList.contains("textLayerImages") || target.classList.contains("textLayerImagePlaceholder")) && __privateGet(this, _textLayer).div.contains(target)) {
          const {
            isMac
          } = FeatureTest.platform;
          if (event.button !== 0 || event.ctrlKey && isMac) {
            return;
          }
          __privateGet(this, _uiManager4).showAllEditors("highlight", true, true);
          __privateGet(this, _textLayer).div.classList.add("free");
          this.toggleDrawing();
          HighlightEditor.startHighlighting(this, __privateGet(this, _uiManager4).direction === "ltr", {
            target: __privateGet(this, _textLayer).div,
            x: event.x,
            y: event.y
          });
          __privateGet(this, _textLayer).div.addEventListener("pointerup", () => {
            __privateGet(this, _textLayer).div.classList.remove("free");
            this.toggleDrawing(true);
          }, {
            once: true,
            signal: __privateGet(this, _uiManager4)._signal
          });
          event.preventDefault();
        }
      };
      currentEditorType_get = function() {
        return __privateGet(_AnnotationEditorLayer, _editorTypes2).get(__privateGet(this, _uiManager4).getMode());
      };
      createNewEditor_fn = function(params) {
        const editorType = __privateGet(this, _AnnotationEditorLayer_instances, currentEditorType_get);
        return editorType ? new editorType.prototype.constructor(params) : null;
      };
      getCenterPoint_fn = function() {
        const {
          x,
          y,
          width,
          height
        } = this.boundingClientRect;
        const tlX = Math.max(0, x);
        const tlY = Math.max(0, y);
        const brX = Math.min(window.innerWidth, x + width);
        const brY = Math.min(window.innerHeight, y + height);
        const centerX = (tlX + brX) / 2 - x;
        const centerY = (tlY + brY) / 2 - y;
        const [offsetX, offsetY] = this.viewport.rotation % 180 === 0 ? [centerX, centerY] : [centerY, centerX];
        return {
          offsetX,
          offsetY
        };
      };
      cleanup_fn = function() {
        for (const editor of __privateGet(this, _editors).values()) {
          if (editor.isEmpty()) {
            editor.remove();
          }
        }
      };
      __publicField(_AnnotationEditorLayer, "_initialized", false);
      __privateAdd(_AnnotationEditorLayer, _editorTypes2, new Map([FreeTextEditor, InkEditor, StampEditor, HighlightEditor, SignatureEditor].map((type) => [type._editorType, type])));
      AnnotationEditorLayer = _AnnotationEditorLayer;
      _DrawLayer = class _DrawLayer {
        constructor({
          filterFactory = null,
          pageColors = null,
          pageIndex,
          textLayer = null
        }) {
          __privateAdd(this, _DrawLayer_instances);
          __privateAdd(this, _parent2, null);
          __privateAdd(this, _mapping, /* @__PURE__ */ new Map());
          __privateAdd(this, _textLayer2, null);
          __privateAdd(this, _filterFactory2, null);
          __privateAdd(this, _pageColors2, null);
          __privateAdd(this, _textLayerObserver, null);
          __privateAdd(this, _toUpdate, /* @__PURE__ */ new Map());
          this.pageIndex = pageIndex;
          __privateSet(this, _filterFactory2, filterFactory);
          __privateSet(this, _pageColors2, pageColors);
          if (textLayer) {
            const previousData = __privateGet(_DrawLayer, _textLayers).get(textLayer);
            if (previousData?.selectionDiv) {
              previousData.selectionDiv.remove();
              __privateGet(_DrawLayer, _selections).delete(previousData.selectionDiv);
            }
            __privateGet(_DrawLayer, _textLayers).set(textLayer, {
              drawLayer: this
            });
            __privateGet(_DrawLayer, _textLayerSet).add(textLayer);
            __privateSet(this, _textLayer2, textLayer);
            __privateSet(this, _textLayerObserver, new MutationObserver((records) => {
              var _a, _b;
              if (!__privateGet(this, _parent2) || !__privateGet(this, _textLayer2)?.isConnected || !__privateMethod(_a = _DrawLayer, _DrawLayer_static, hasSelection_fn).call(_a)) {
                return;
              }
              for (const {
                addedNodes
              } of records) {
                for (const node of addedNodes) {
                  if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains("endOfContent")) {
                    __privateMethod(_b = _DrawLayer, _DrawLayer_static, selectionChange_fn2).call(_b);
                    return;
                  }
                }
              }
            }));
            __privateGet(this, _textLayerObserver).observe(textLayer, {
              childList: true
            });
            if (__privateGet(_DrawLayer, _selectionChangeAC) === null) {
              __privateSet(_DrawLayer, _selectionChangeAC, new AbortController());
              const {
                signal
              } = __privateGet(_DrawLayer, _selectionChangeAC);
              document.addEventListener("selectionchange", __privateMethod(_DrawLayer, _DrawLayer_static, selectionChange_fn2).bind(_DrawLayer), {
                signal
              });
              document.addEventListener("pointerdown", () => {
                __privateSet(_DrawLayer, _isSelecting, true);
              }, {
                signal
              });
              document.addEventListener("pointerup", () => {
                __privateSet(_DrawLayer, _isSelecting, false);
              }, {
                signal
              });
              window.addEventListener("blur", () => {
                __privateSet(_DrawLayer, _isSelecting, false);
              }, {
                signal
              });
            }
          }
        }
        setParent(parent) {
          var _a, _b;
          if (!__privateGet(this, _parent2)) {
            __privateSet(this, _parent2, parent);
            if (__privateGet(this, _textLayer2)?.isConnected && __privateMethod(_a = _DrawLayer, _DrawLayer_static, hasSelection_fn).call(_a)) {
              __privateMethod(_b = _DrawLayer, _DrawLayer_static, selectionChange_fn2).call(_b);
            }
            return;
          }
          if (__privateGet(this, _parent2) !== parent) {
            if (__privateGet(this, _mapping).size > 0) {
              for (const root3 of __privateGet(this, _mapping).values()) {
                root3.remove();
                parent.append(root3);
              }
            }
            __privateSet(this, _parent2, parent);
          }
        }
        static get _svgFactory() {
          return shadow(this, "_svgFactory", new DOMSVGFactory());
        }
        draw(properties, isPathUpdatable = false, hasClip = false) {
          const id = __privateWrapper(_DrawLayer, _id5)._++;
          const root3 = __privateMethod(this, _DrawLayer_instances, createSVG_fn).call(this);
          const defs = _DrawLayer._svgFactory.createElement("defs");
          root3.append(defs);
          const path = _DrawLayer._svgFactory.createElement("path");
          defs.append(path);
          const pathId = `path_${id}`;
          path.setAttribute("id", pathId);
          path.setAttribute("vector-effect", "non-scaling-stroke");
          if (isPathUpdatable) {
            __privateGet(this, _toUpdate).set(id, path);
          }
          const clipPathId = hasClip ? __privateMethod(this, _DrawLayer_instances, createClipPath_fn).call(this, defs, pathId) : null;
          const use = _DrawLayer._svgFactory.createElement("use");
          root3.append(use);
          use.setAttribute("href", `#${pathId}`);
          this.updateProperties(root3, properties);
          __privateGet(this, _mapping).set(id, root3);
          return {
            id,
            clipPathId: `url(#${clipPathId})`
          };
        }
        drawOutline(properties, mustRemoveSelfIntersections) {
          const id = __privateWrapper(_DrawLayer, _id5)._++;
          const root3 = __privateMethod(this, _DrawLayer_instances, createSVG_fn).call(this);
          const defs = _DrawLayer._svgFactory.createElement("defs");
          root3.append(defs);
          const path = _DrawLayer._svgFactory.createElement("path");
          defs.append(path);
          const pathId = `path_${id}`;
          path.setAttribute("id", pathId);
          path.setAttribute("vector-effect", "non-scaling-stroke");
          let maskId;
          if (mustRemoveSelfIntersections) {
            const mask = _DrawLayer._svgFactory.createElement("mask");
            defs.append(mask);
            maskId = `mask_${id}`;
            mask.setAttribute("id", maskId);
            mask.setAttribute("maskUnits", "objectBoundingBox");
            const rect = _DrawLayer._svgFactory.createElement("rect");
            mask.append(rect);
            rect.setAttribute("width", "1");
            rect.setAttribute("height", "1");
            rect.setAttribute("fill", "white");
            const use = _DrawLayer._svgFactory.createElement("use");
            mask.append(use);
            use.setAttribute("href", `#${pathId}`);
            use.setAttribute("stroke", "none");
            use.setAttribute("fill", "black");
            use.setAttribute("fill-rule", "nonzero");
            use.classList.add("mask");
          }
          const use1 = _DrawLayer._svgFactory.createElement("use");
          root3.append(use1);
          use1.setAttribute("href", `#${pathId}`);
          if (maskId) {
            use1.setAttribute("mask", `url(#${maskId})`);
          }
          const use2 = use1.cloneNode();
          root3.append(use2);
          use1.classList.add("mainOutline");
          use2.classList.add("secondaryOutline");
          this.updateProperties(root3, properties);
          __privateGet(this, _mapping).set(id, root3);
          return id;
        }
        finalizeDraw(id, properties) {
          __privateGet(this, _toUpdate).delete(id);
          this.updateProperties(id, properties);
        }
        updateProperties(elementOrId, properties) {
          var _a;
          if (!properties) {
            return;
          }
          const {
            root: root3,
            bbox,
            rootClass,
            path
          } = properties;
          const element = typeof elementOrId === "number" ? __privateGet(this, _mapping).get(elementOrId) : elementOrId;
          if (!element) {
            return;
          }
          if (root3) {
            __privateMethod(this, _DrawLayer_instances, updateProperties_fn).call(this, element, root3);
          }
          if (bbox) {
            __privateMethod(_a = _DrawLayer, _DrawLayer_static, setBox_fn).call(_a, element, bbox);
          }
          if (rootClass) {
            const {
              classList
            } = element;
            for (const [className, value] of Object.entries(rootClass)) {
              classList.toggle(className, value);
            }
          }
          if (path) {
            const defs = element.firstElementChild;
            const pathElement = defs.firstElementChild;
            __privateMethod(this, _DrawLayer_instances, updateProperties_fn).call(this, pathElement, path);
          }
        }
        updateParent(id, layer) {
          if (layer === this) {
            return;
          }
          const root3 = __privateGet(this, _mapping).get(id);
          if (!root3) {
            return;
          }
          __privateGet(layer, _parent2).append(root3);
          __privateGet(this, _mapping).delete(id);
          __privateGet(layer, _mapping).set(id, root3);
        }
        remove(id) {
          __privateGet(this, _toUpdate).delete(id);
          if (__privateGet(this, _parent2) === null) {
            return;
          }
          __privateGet(this, _mapping).get(id).remove();
          __privateGet(this, _mapping).delete(id);
        }
        destroy() {
          var _a;
          __privateSet(this, _parent2, null);
          for (const root3 of __privateGet(this, _mapping).values()) {
            root3.remove();
          }
          __privateGet(this, _mapping).clear();
          __privateGet(this, _toUpdate).clear();
          __privateGet(this, _textLayerObserver)?.disconnect();
          __privateSet(this, _textLayerObserver, null);
          if (__privateGet(this, _textLayer2)) {
            const data = __privateGet(_DrawLayer, _textLayers).get(__privateGet(this, _textLayer2));
            if (data?.drawLayer === this) {
              __privateMethod(_a = _DrawLayer, _DrawLayer_static, cleanupTextLayerSelection_fn).call(_a, __privateGet(this, _textLayer2));
              __privateGet(_DrawLayer, _textLayers).delete(__privateGet(this, _textLayer2));
              __privateGet(_DrawLayer, _textLayerSet).delete(__privateGet(this, _textLayer2));
              if (__privateGet(_DrawLayer, _textLayerSet).size === 0) {
                __privateGet(_DrawLayer, _selectionChangeAC)?.abort();
                __privateSet(_DrawLayer, _selectionChangeAC, null);
                __privateSet(_DrawLayer, _isSelecting, false);
              }
            }
            __privateSet(this, _textLayer2, null);
          }
        }
      };
      _parent2 = new WeakMap();
      _mapping = new WeakMap();
      _textLayer2 = new WeakMap();
      _filterFactory2 = new WeakMap();
      _pageColors2 = new WeakMap();
      _textLayerObserver = new WeakMap();
      _toUpdate = new WeakMap();
      _id5 = new WeakMap();
      _selectionId = new WeakMap();
      _selectionChangeAC = new WeakMap();
      _selections = new WeakMap();
      _isSelecting = new WeakMap();
      _textLayerSet = new WeakMap();
      _textLayers = new WeakMap();
      _DrawLayer_static = new WeakSet();
      cleanupTextLayerSelection_fn = function(textLayer) {
        const textLayerData = __privateGet(this, _textLayers).get(textLayer);
        if (!textLayerData?.selectionDiv) {
          return;
        }
        textLayerData.selectionDiv.remove();
        __privateGet(this, _selections).delete(textLayerData.selectionDiv);
        textLayerData.selectionDiv = null;
        textLayerData.path = null;
      };
      hasSelection_fn = function() {
        const selection = document.getSelection();
        return !!selection && !selection.isCollapsed;
      };
      getOrderedTextLayers_fn = function() {
        return __privateGet(this, _textLayerSet).keys().filter((textLayer) => textLayer.isConnected).toArray().sort(compareTextLayers);
      };
      selectionChange_fn2 = function() {
        const selection = document.getSelection();
        if (!selection || selection.isCollapsed) {
          for (const root3 of __privateGet(this, _selections)) {
            root3.remove();
          }
          __privateGet(this, _selections).clear();
          return;
        }
        const rotators = /* @__PURE__ */ new WeakMap();
        const orderedTextLayers = __privateMethod(this, _DrawLayer_static, getOrderedTextLayers_fn).call(this);
        const ranges = [];
        for (let i = 0, ii = selection.rangeCount; i < ii; i++) {
          const range2 = selection.getRangeAt(i);
          if (range2.collapsed) {
            continue;
          }
          let {
            startContainer,
            startOffset,
            endContainer,
            endOffset
          } = range2;
          let startTextLayer = getTextLayer(startContainer);
          let endTextLayer = getTextLayer(endContainer);
          const startMissing = startTextLayer === null;
          const endMissing = endTextLayer === null;
          if (__privateGet(this, _isSelecting) && startMissing !== endMissing) {
            return;
          }
          if (selection.rangeCount === 1) {
            const {
              anchorNode,
              anchorOffset,
              focusNode,
              focusOffset
            } = selection;
            const anchorLayer = getTextLayer(anchorNode);
            const focusLayer = getTextLayer(focusNode);
            const anchorBeforeFocus = isPointBefore(anchorNode, anchorOffset, focusNode, focusOffset);
            if (anchorLayer && focusLayer && anchorBeforeFocus !== null) {
              if (anchorBeforeFocus) {
                startContainer = anchorNode;
                startOffset = anchorOffset;
                startTextLayer = anchorLayer;
                endContainer = focusNode;
                endOffset = focusOffset;
                endTextLayer = focusLayer;
              } else {
                startContainer = focusNode;
                startOffset = focusOffset;
                startTextLayer = focusLayer;
                endContainer = anchorNode;
                endOffset = anchorOffset;
                endTextLayer = anchorLayer;
              }
            }
          }
          const activeTextLayers = orderedTextLayers.filter((textLayer) => range2.intersectsNode(textLayer));
          if (activeTextLayers.length === 0) {
            continue;
          }
          let boundarySubstituted = false;
          if (!startTextLayer) {
            startTextLayer = activeTextLayers[0];
            startContainer = startTextLayer;
            startOffset = 0;
            boundarySubstituted = true;
          }
          if (!endTextLayer) {
            endTextLayer = activeTextLayers.at(-1);
            endContainer = endTextLayer;
            endOffset = endTextLayer.childNodes.length;
            boundarySubstituted = true;
          }
          if (endContainer.nodeType === Node.ELEMENT_NODE) {
            if (endContainer.classList.contains("endOfContent")) {
              const previousNode = endContainer.previousSibling;
              if (!previousNode) {
                continue;
              }
              endContainer = previousNode;
              endOffset = previousNode.nodeType === Node.TEXT_NODE ? previousNode.textContent.length : previousNode.childNodes.length;
            } else if (endContainer.classList.contains("textLayer") && endContainer.childNodes.length === endOffset) {
              const normalizedEnd = normalizeEdgeBoundary(endContainer, endOffset, endTextLayer);
              if (!normalizedEnd) {
                continue;
              }
              endContainer = normalizedEnd.container;
              endOffset = normalizedEnd.offset;
            }
          }
          if (startContainer.nodeType === Node.ELEMENT_NODE) {
            const normalizedStart = normalizeEdgeBoundary(startContainer, startOffset, startTextLayer);
            if (!normalizedStart) {
              continue;
            }
            startContainer = normalizedStart.container;
            startOffset = normalizedStart.offset;
          }
          if (startTextLayer === endTextLayer && !boundarySubstituted && activeTextLayers.includes(startTextLayer)) {
            ranges.push([range2, startTextLayer]);
            continue;
          }
          for (const textLayer of activeTextLayers) {
            const firstNode = textLayer.firstChild;
            if (!firstNode) {
              continue;
            }
            const subRange = document.createRange();
            if (textLayer === startTextLayer) {
              subRange.setStart(startContainer, startOffset);
            } else {
              subRange.setStartBefore(firstNode);
            }
            if (textLayer === endTextLayer) {
              subRange.setEnd(endContainer, endOffset);
            } else {
              const lastNode = textLayer.lastChild;
              if (!lastNode) {
                continue;
              }
              if (lastNode.nodeType === Node.ELEMENT_NODE && lastNode.classList.contains("endOfContent")) {
                const lastTextNode = lastNode.previousSibling;
                if (!lastTextNode) {
                  continue;
                }
                subRange.setEndAfter(lastTextNode);
              } else {
                subRange.setEndAfter(lastNode);
              }
            }
            if (!subRange.collapsed) {
              ranges.push([subRange, textLayer]);
            }
          }
        }
        const selectedTextLayers = new Set(ranges.map((range2) => range2[1]));
        for (const textLayer of __privateGet(this, _textLayerSet)) {
          if (!selectedTextLayers.has(textLayer)) {
            __privateMethod(this, _DrawLayer_static, cleanupTextLayerSelection_fn).call(this, textLayer);
          }
        }
        for (const [range2, textLayer] of ranges) {
          const textLayerData = __privateGet(_DrawLayer, _textLayers).get(textLayer);
          if (!textLayerData) {
            continue;
          }
          let rotator = rotators.get(textLayer);
          if (!rotator) {
            const clientRect = textLayer.getBoundingClientRect();
            rotator = (x, y, w, h) => ({
              x: (x - clientRect.x) / clientRect.width,
              y: (y - clientRect.y) / clientRect.height,
              width: w / clientRect.width,
              height: h / clientRect.height
            });
            rotators.set(textLayer, rotator);
          }
          const boxes = [];
          for (let {
            x,
            y,
            width,
            height
          } of range2.getClientRects()) {
            if (width === 0 || height === 0) {
              continue;
            }
            ({
              x,
              y,
              width,
              height
            } = rotator(x, y, width, height));
            if (width === 1 && height === 1) {
              continue;
            }
            boxes.push(`M${x} ${y} h${width} v${height} h-${width} Z`);
          }
          if (boxes.length === 0) {
            continue;
          }
          const drawLayer = textLayerData.drawLayer;
          let div = textLayerData.selectionDiv;
          let path = textLayerData.path;
          if (!div) {
            const clipPathId = `clip_selection_${__privateWrapper(_DrawLayer, _selectionId)._++}`;
            div = document.createElement("div");
            div.className = "selection";
            div.style.clipPath = `url(#${clipPathId})`;
            const selectionStyle = __privateGet(drawLayer, _filterFactory2)?.createSelectionStyle(__privateGet(drawLayer, _pageColors2));
            if (selectionStyle) {
              for (const [name, value] of Object.entries(selectionStyle)) {
                div.style.setProperty(name, value);
              }
            }
            const svg = _DrawLayer._svgFactory.create(1, 1, true);
            svg.setAttribute("aria-hidden", "true");
            svg.setAttribute("width", "100%");
            svg.setAttribute("height", "100%");
            const clipPath = _DrawLayer._svgFactory.createElement("clipPath");
            clipPath.setAttribute("id", clipPathId);
            clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
            path = _DrawLayer._svgFactory.createElement("path");
            clipPath.append(path);
            svg.append(clipPath);
            div.append(svg);
            textLayerData.path = path;
            textLayerData.selectionDiv = div;
          }
          if (!div.parentNode && __privateGet(drawLayer, _parent2)) {
            __privateGet(drawLayer, _parent2).append(div);
            __privateGet(this, _selections).add(div);
          }
          path.setAttribute("d", boxes.join(" "));
        }
      };
      setBox_fn = function(element, [x, y, width, height]) {
        const {
          style
        } = element;
        style.top = `${100 * y}%`;
        style.left = `${100 * x}%`;
        style.width = `${100 * width}%`;
        style.height = `${100 * height}%`;
      };
      _DrawLayer_instances = new WeakSet();
      createSVG_fn = function() {
        const svg = _DrawLayer._svgFactory.create(1, 1, true);
        __privateGet(this, _parent2).append(svg);
        svg.setAttribute("aria-hidden", "true");
        return svg;
      };
      createClipPath_fn = function(defs, pathId) {
        const clipPath = _DrawLayer._svgFactory.createElement("clipPath");
        defs.append(clipPath);
        const clipPathId = `clip_${pathId}`;
        clipPath.setAttribute("id", clipPathId);
        clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
        const clipPathUse = _DrawLayer._svgFactory.createElement("use");
        clipPath.append(clipPathUse);
        clipPathUse.setAttribute("href", `#${pathId}`);
        clipPathUse.classList.add("clip");
        return clipPathId;
      };
      updateProperties_fn = function(element, properties) {
        for (const [key, value] of Object.entries(properties)) {
          if (value === null) {
            element.removeAttribute(key);
          } else {
            element.setAttribute(key, value);
          }
        }
      };
      __privateAdd(_DrawLayer, _DrawLayer_static);
      __privateAdd(_DrawLayer, _id5, 0);
      __privateAdd(_DrawLayer, _selectionId, 0);
      __privateAdd(_DrawLayer, _selectionChangeAC, null);
      __privateAdd(_DrawLayer, _selections, /* @__PURE__ */ new Set());
      __privateAdd(_DrawLayer, _isSelecting, false);
      __privateAdd(_DrawLayer, _textLayerSet, /* @__PURE__ */ new Set());
      __privateAdd(_DrawLayer, _textLayers, /* @__PURE__ */ new WeakMap());
      DrawLayer = _DrawLayer;
      _TextLayerImages = class _TextLayerImages {
        constructor(minSize, coordinates, viewport, getPageCanvas) {
          __privateAdd(this, _TextLayerImages_instances);
          __privateAdd(this, _coordinates, []);
          __privateAdd(this, _coordinatesByElement, /* @__PURE__ */ new Map());
          __privateAdd(this, _getPageCanvas, null);
          __privateAdd(this, _minSize, 0);
          __privateAdd(this, _pageWidth2, 0);
          __privateAdd(this, _pageHeight2, 0);
          __privateSet(this, _minSize, minSize);
          __privateSet(this, _coordinates, coordinates);
          __privateSet(this, _pageWidth2, viewport.rawDims.pageWidth);
          __privateSet(this, _pageHeight2, viewport.rawDims.pageHeight);
          __privateSet(this, _getPageCanvas, getPageCanvas);
        }
        render() {
          const container = document.createElement("div");
          container.className = "textLayerImages";
          for (let i = 0; i < __privateGet(this, _coordinates).length; i += 6) {
            const el = __privateMethod(this, _TextLayerImages_instances, createImagePlaceholder_fn).call(this, __privateGet(this, _coordinates).subarray(i, i + 6));
            if (el) {
              container.append(el);
            }
          }
          container.addEventListener("contextmenu", (event) => {
            if (!(event.target instanceof HTMLCanvasElement)) {
              return;
            }
            const imgElement = event.target;
            const coords = __privateGet(this, _coordinatesByElement).get(imgElement);
            if (!coords) {
              return;
            }
            const activeImage = __privateGet(_TextLayerImages, _activeImage)?.deref();
            if (activeImage === imgElement) {
              return;
            }
            if (activeImage) {
              activeImage.width = 0;
              activeImage.height = 0;
            }
            __privateSet(_TextLayerImages, _activeImage, new WeakRef(imgElement));
            const {
              inverseTransform,
              x1,
              y1,
              width,
              height
            } = coords;
            const pageCanvas = __privateGet(this, _getPageCanvas).call(this);
            const imageX1 = Math.ceil(x1 * pageCanvas.width);
            const imageY1 = Math.ceil(y1 * pageCanvas.height);
            const imageX2 = Math.floor((x1 + width / __privateGet(this, _pageWidth2)) * pageCanvas.width);
            const imageY2 = Math.floor((y1 + height / __privateGet(this, _pageHeight2)) * pageCanvas.height);
            imgElement.width = imageX2 - imageX1;
            imgElement.height = imageY2 - imageY1;
            const ctx = imgElement.getContext("2d");
            ctx.setTransform(...inverseTransform);
            ctx.translate(-imageX1, -imageY1);
            ctx.drawImage(pageCanvas, 0, 0);
          });
          return container;
        }
      };
      _coordinates = new WeakMap();
      _coordinatesByElement = new WeakMap();
      _getPageCanvas = new WeakMap();
      _minSize = new WeakMap();
      _pageWidth2 = new WeakMap();
      _pageHeight2 = new WeakMap();
      _activeImage = new WeakMap();
      _TextLayerImages_instances = new WeakSet();
      createImagePlaceholder_fn = function([x1, y1, x2, y2, x3, y3]) {
        const width = Math.hypot((x3 - x1) * __privateGet(this, _pageWidth2), (y3 - y1) * __privateGet(this, _pageHeight2));
        const height = Math.hypot((x2 - x1) * __privateGet(this, _pageWidth2), (y2 - y1) * __privateGet(this, _pageHeight2));
        if (width < __privateGet(this, _minSize) || height < __privateGet(this, _minSize)) {
          return null;
        }
        const transform = [(x3 - x1) * __privateGet(this, _pageWidth2) / width, (y3 - y1) * __privateGet(this, _pageHeight2) / width, (x2 - x1) * __privateGet(this, _pageWidth2) / height, (y2 - y1) * __privateGet(this, _pageHeight2) / height, 0, 0];
        const inverseTransform = Util.inverseTransform(transform);
        const imgElement = document.createElement("canvas");
        imgElement.className = "textLayerImagePlaceholder";
        imgElement.width = 0;
        imgElement.height = 0;
        Object.assign(imgElement.style, {
          opacity: 0,
          position: "absolute",
          left: percentage(x1),
          top: percentage(y1),
          width: percentage(width / __privateGet(this, _pageWidth2)),
          height: percentage(height / __privateGet(this, _pageHeight2)),
          transformOrigin: "0% 0%",
          transform: `matrix(${transform.join(",")})`
        });
        __privateGet(this, _coordinatesByElement).set(imgElement, {
          inverseTransform,
          width,
          height,
          x1,
          y1
        });
        return imgElement;
      };
      __privateAdd(_TextLayerImages, _activeImage, null);
      TextLayerImages = _TextLayerImages;
      {
        globalThis._pdfjsTestingUtils = {
          HighlightOutliner
        };
      }
      globalThis.pdfjsLib = {
        AbortException,
        AnnotationEditorLayer,
        AnnotationEditorParamsType,
        AnnotationEditorType,
        AnnotationEditorUIManager,
        AnnotationLayer,
        AnnotationMode,
        AnnotationType,
        applyOpacity,
        build,
        ColorPicker,
        createValidAbsoluteUrl,
        CSSConstants,
        DOMSVGFactory,
        DrawLayer,
        FeatureTest,
        fetchData,
        findContrastColor,
        getDocument,
        getFilenameFromUrl,
        getPdfFilenameFromUrl,
        getRGB,
        getRGBA,
        getUuid,
        GlobalWorkerOptions,
        ImageKind,
        InvalidPDFException,
        isDataScheme,
        isPdfFile,
        isValidExplicitDest,
        makeArr,
        makeMap,
        makeObj,
        makeSet,
        MathClamp,
        noContextMenu,
        normalizeUnicode,
        OPS,
        OutputScale,
        PasswordException,
        PasswordResponses,
        PDFDataRangeTransport,
        PDFDateString,
        PDFWorker,
        PermissionFlag,
        PixelsPerInch,
        RenderingCancelledException,
        renderRichText,
        ResponseException,
        setLayerDimensions,
        shadow,
        SignatureExtractor,
        stopEvent,
        SupportedImageMimeTypes,
        TextLayer,
        TextLayerImages,
        TouchManager,
        updateUrlHash,
        Util,
        VerbosityLevel,
        version: version2,
        XfaLayer
      };
    }
  });

  // lib/converters/toMarkdown.ts
  var toMarkdown_exports = {};
  __export(toMarkdown_exports, {
    convertCsvToMarkdown: () => convertCsvToMarkdown,
    convertDocxToMarkdown: () => convertDocxToMarkdown,
    convertExcelToMarkdown: () => convertExcelToMarkdown,
    convertFileToMarkdown: () => convertFileToMarkdown,
    convertHtmlToMarkdown: () => convertHtmlToMarkdown,
    convertImageToMarkdown: () => convertImageToMarkdown,
    convertJsonToMarkdown: () => convertJsonToMarkdown,
    convertPdfToMarkdown: () => convertPdfToMarkdown,
    convertXmlToMarkdown: () => convertXmlToMarkdown,
    createTurndownService: () => createTurndownService
  });

  // node_modules/turndown/lib/turndown.browser.es.js
  function extend(destination) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) destination[key] = source[key];
      }
    }
    return destination;
  }
  function repeat(character, count) {
    return Array(count + 1).join(character);
  }
  function trimLeadingNewlines(string) {
    return string.replace(/^\n*/, "");
  }
  function trimTrailingNewlines(string) {
    var indexEnd = string.length;
    while (indexEnd > 0 && string[indexEnd - 1] === "\n") indexEnd--;
    return string.substring(0, indexEnd);
  }
  function trimNewlines(string) {
    return trimTrailingNewlines(trimLeadingNewlines(string));
  }
  var blockElements = ["ADDRESS", "ARTICLE", "ASIDE", "AUDIO", "BLOCKQUOTE", "BODY", "CANVAS", "CENTER", "DD", "DIR", "DIV", "DL", "DT", "FIELDSET", "FIGCAPTION", "FIGURE", "FOOTER", "FORM", "FRAMESET", "H1", "H2", "H3", "H4", "H5", "H6", "HEADER", "HGROUP", "HR", "HTML", "ISINDEX", "LI", "MAIN", "MENU", "NAV", "NOFRAMES", "NOSCRIPT", "OL", "OUTPUT", "P", "PRE", "SECTION", "TABLE", "TBODY", "TD", "TFOOT", "TH", "THEAD", "TR", "UL"];
  function isBlock(node) {
    return is(node, blockElements);
  }
  var voidElements = ["AREA", "BASE", "BR", "COL", "COMMAND", "EMBED", "HR", "IMG", "INPUT", "KEYGEN", "LINK", "META", "PARAM", "SOURCE", "TRACK", "WBR"];
  function isVoid(node) {
    return is(node, voidElements);
  }
  function hasVoid(node) {
    return has(node, voidElements);
  }
  var meaningfulWhenBlankElements = ["A", "TABLE", "THEAD", "TBODY", "TFOOT", "TH", "TD", "IFRAME", "SCRIPT", "AUDIO", "VIDEO"];
  function isMeaningfulWhenBlank(node) {
    return is(node, meaningfulWhenBlankElements);
  }
  function hasMeaningfulWhenBlank(node) {
    return has(node, meaningfulWhenBlankElements);
  }
  function is(node, tagNames) {
    return tagNames.indexOf(node.nodeName) >= 0;
  }
  function has(node, tagNames) {
    return node.getElementsByTagName && tagNames.some(function(tagName) {
      return node.getElementsByTagName(tagName).length;
    });
  }
  var markdownEscapes = [[/\\/g, "\\\\"], [/\*/g, "\\*"], [/^-/g, "\\-"], [/^\+ /g, "\\+ "], [/^(=+)/g, "\\$1"], [/^(#{1,6}) /g, "\\$1 "], [/`/g, "\\`"], [/^~~~/g, "\\~~~"], [/\[/g, "\\["], [/\]/g, "\\]"], [/^>/g, "\\>"], [/_/g, "\\_"], [/^(\d+)\. /g, "$1\\. "]];
  function escapeMarkdown(string) {
    return markdownEscapes.reduce(function(accumulator, escape2) {
      return accumulator.replace(escape2[0], escape2[1]);
    }, string);
  }
  var rules = {};
  rules.paragraph = {
    filter: "p",
    replacement: function(content) {
      return "\n\n" + content + "\n\n";
    }
  };
  rules.lineBreak = {
    filter: "br",
    replacement: function(content, node, options) {
      return options.br + "\n";
    }
  };
  rules.heading = {
    filter: ["h1", "h2", "h3", "h4", "h5", "h6"],
    replacement: function(content, node, options) {
      var hLevel = Number(node.nodeName.charAt(1));
      if (options.headingStyle === "setext" && hLevel < 3) {
        var underline = repeat(hLevel === 1 ? "=" : "-", content.length);
        return "\n\n" + content + "\n" + underline + "\n\n";
      } else {
        return "\n\n" + repeat("#", hLevel) + " " + content + "\n\n";
      }
    }
  };
  rules.blockquote = {
    filter: "blockquote",
    replacement: function(content) {
      content = trimNewlines(content).replace(/^/gm, "> ");
      return "\n\n" + content + "\n\n";
    }
  };
  rules.list = {
    filter: ["ul", "ol"],
    replacement: function(content, node) {
      var parent = node.parentNode;
      if (parent.nodeName === "LI" && parent.lastElementChild === node) {
        return "\n" + content;
      } else {
        return "\n\n" + content + "\n\n";
      }
    }
  };
  rules.listItem = {
    filter: "li",
    replacement: function(content, node, options) {
      var prefix = options.bulletListMarker + "   ";
      var parent = node.parentNode;
      if (parent.nodeName === "OL") {
        var start = parent.getAttribute("start");
        var index = Array.prototype.indexOf.call(parent.children, node);
        prefix = (start ? Number(start) + index : index + 1) + ".  ";
      }
      var isParagraph = /\n$/.test(content);
      content = trimNewlines(content) + (isParagraph ? "\n" : "");
      content = content.replace(/\n/gm, "\n" + " ".repeat(prefix.length));
      return prefix + content + (node.nextSibling ? "\n" : "");
    }
  };
  rules.indentedCodeBlock = {
    filter: function(node, options) {
      return options.codeBlockStyle === "indented" && node.nodeName === "PRE" && node.firstChild && node.firstChild.nodeName === "CODE";
    },
    replacement: function(content, node, options) {
      return "\n\n    " + node.firstChild.textContent.replace(/\n/g, "\n    ") + "\n\n";
    }
  };
  rules.fencedCodeBlock = {
    filter: function(node, options) {
      return options.codeBlockStyle === "fenced" && node.nodeName === "PRE" && node.firstChild && node.firstChild.nodeName === "CODE";
    },
    replacement: function(content, node, options) {
      var className = node.firstChild.getAttribute("class") || "";
      var language = (className.match(/language-(\S+)/) || [null, ""])[1];
      var code = node.firstChild.textContent;
      var fenceChar = options.fence.charAt(0);
      var fenceSize = 3;
      var fenceInCodeRegex = new RegExp("^" + fenceChar + "{3,}", "gm");
      var match;
      while (match = fenceInCodeRegex.exec(code)) {
        if (match[0].length >= fenceSize) {
          fenceSize = match[0].length + 1;
        }
      }
      var fence = repeat(fenceChar, fenceSize);
      return "\n\n" + fence + language + "\n" + code.replace(/\n$/, "") + "\n" + fence + "\n\n";
    }
  };
  rules.horizontalRule = {
    filter: "hr",
    replacement: function(content, node, options) {
      return "\n\n" + options.hr + "\n\n";
    }
  };
  rules.inlineLink = {
    filter: function(node, options) {
      return options.linkStyle === "inlined" && node.nodeName === "A" && node.getAttribute("href");
    },
    replacement: function(content, node) {
      var href = escapeLinkDestination(node.getAttribute("href"));
      var title = escapeLinkTitle(cleanAttribute(node.getAttribute("title")));
      var titlePart = title ? ' "' + title + '"' : "";
      return "[" + content + "](" + href + titlePart + ")";
    }
  };
  rules.referenceLink = {
    filter: function(node, options) {
      return options.linkStyle === "referenced" && node.nodeName === "A" && node.getAttribute("href");
    },
    replacement: function(content, node, options) {
      var href = escapeLinkDestination(node.getAttribute("href"));
      var title = cleanAttribute(node.getAttribute("title"));
      if (title) title = ' "' + escapeLinkTitle(title) + '"';
      var replacement;
      var reference;
      switch (options.linkReferenceStyle) {
        case "collapsed":
          replacement = "[" + content + "][]";
          reference = "[" + content + "]: " + href + title;
          break;
        case "shortcut":
          replacement = "[" + content + "]";
          reference = "[" + content + "]: " + href + title;
          break;
        default:
          var id = this.references.length + 1;
          replacement = "[" + content + "][" + id + "]";
          reference = "[" + id + "]: " + href + title;
      }
      this.references.push(reference);
      return replacement;
    },
    references: [],
    append: function(options) {
      var references = "";
      if (this.references.length) {
        references = "\n\n" + this.references.join("\n") + "\n\n";
        this.references = [];
      }
      return references;
    }
  };
  rules.emphasis = {
    filter: ["em", "i"],
    replacement: function(content, node, options) {
      if (!content.trim()) return "";
      return options.emDelimiter + content + options.emDelimiter;
    }
  };
  rules.strong = {
    filter: ["strong", "b"],
    replacement: function(content, node, options) {
      if (!content.trim()) return "";
      return options.strongDelimiter + content + options.strongDelimiter;
    }
  };
  rules.code = {
    filter: function(node) {
      var hasSiblings = node.previousSibling || node.nextSibling;
      var isCodeBlock = node.parentNode.nodeName === "PRE" && !hasSiblings;
      return node.nodeName === "CODE" && !isCodeBlock;
    },
    replacement: function(content) {
      if (!content) return "";
      content = content.replace(/\r?\n|\r/g, " ");
      var extraSpace = /^`|^ .*?[^ ].* $|`$/.test(content) ? " " : "";
      var delimiter = "`";
      var matches = content.match(/`+/gm) || [];
      while (matches.indexOf(delimiter) !== -1) delimiter = delimiter + "`";
      return delimiter + extraSpace + content + extraSpace + delimiter;
    }
  };
  rules.image = {
    filter: "img",
    replacement: function(content, node) {
      var alt = escapeMarkdown(cleanAttribute(node.getAttribute("alt")));
      var src = escapeLinkDestination(node.getAttribute("src") || "");
      var title = cleanAttribute(node.getAttribute("title"));
      var titlePart = title ? ' "' + escapeLinkTitle(title) + '"' : "";
      return src ? "![" + alt + "](" + src + titlePart + ")" : "";
    }
  };
  function cleanAttribute(attribute) {
    return attribute ? attribute.replace(/(\n+\s*)+/g, "\n") : "";
  }
  function escapeLinkDestination(destination) {
    var escaped = destination.replace(/([<>()])/g, "\\$1");
    return escaped.indexOf(" ") >= 0 ? "<" + escaped + ">" : escaped;
  }
  function escapeLinkTitle(title) {
    return title.replace(/"/g, '\\"');
  }
  function Rules(options) {
    this.options = options;
    this._keep = [];
    this._remove = [];
    this.blankRule = {
      replacement: options.blankReplacement
    };
    this.keepReplacement = options.keepReplacement;
    this.defaultRule = {
      replacement: options.defaultReplacement
    };
    this.array = [];
    for (var key in options.rules) this.array.push(options.rules[key]);
  }
  Rules.prototype = {
    add: function(key, rule) {
      this.array.unshift(rule);
    },
    keep: function(filter2) {
      this._keep.unshift({
        filter: filter2,
        replacement: this.keepReplacement
      });
    },
    remove: function(filter2) {
      this._remove.unshift({
        filter: filter2,
        replacement: function() {
          return "";
        }
      });
    },
    forNode: function(node) {
      if (node.isBlank) return this.blankRule;
      var rule;
      if (rule = findRule(this.array, node, this.options)) return rule;
      if (rule = findRule(this._keep, node, this.options)) return rule;
      if (rule = findRule(this._remove, node, this.options)) return rule;
      return this.defaultRule;
    },
    forEach: function(fn) {
      for (var i = 0; i < this.array.length; i++) fn(this.array[i], i);
    }
  };
  function findRule(rules2, node, options) {
    for (var i = 0; i < rules2.length; i++) {
      var rule = rules2[i];
      if (filterValue(rule, node, options)) return rule;
    }
    return void 0;
  }
  function filterValue(rule, node, options) {
    var filter2 = rule.filter;
    if (typeof filter2 === "string") {
      if (filter2 === node.nodeName.toLowerCase()) return true;
    } else if (Array.isArray(filter2)) {
      if (filter2.indexOf(node.nodeName.toLowerCase()) > -1) return true;
    } else if (typeof filter2 === "function") {
      if (filter2.call(rule, node, options)) return true;
    } else {
      throw new TypeError("`filter` needs to be a string, array, or function");
    }
  }
  function collapseWhitespace(options) {
    var element = options.element;
    var isBlock2 = options.isBlock;
    var isVoid2 = options.isVoid;
    var isPre = options.isPre || function(node2) {
      return node2.nodeName === "PRE";
    };
    if (!element.firstChild || isPre(element)) return;
    var prevText = null;
    var keepLeadingWs = false;
    var prev = null;
    var node = next(prev, element, isPre);
    while (node !== element) {
      if (node.nodeType === 3 || node.nodeType === 4) {
        var text = node.data.replace(/[ \r\n\t]+/g, " ");
        if ((!prevText || / $/.test(prevText.data)) && !keepLeadingWs && text[0] === " ") {
          text = text.substr(1);
        }
        if (!text) {
          node = remove(node);
          continue;
        }
        node.data = text;
        prevText = node;
      } else if (node.nodeType === 1) {
        if (isBlock2(node) || node.nodeName === "BR") {
          if (prevText) {
            prevText.data = prevText.data.replace(/ $/, "");
          }
          prevText = null;
          keepLeadingWs = false;
        } else if (isVoid2(node) || isPre(node)) {
          prevText = null;
          keepLeadingWs = true;
        } else if (prevText) {
          keepLeadingWs = false;
        }
      } else {
        node = remove(node);
        continue;
      }
      var nextNode = next(prev, node, isPre);
      prev = node;
      node = nextNode;
    }
    if (prevText) {
      prevText.data = prevText.data.replace(/ $/, "");
      if (!prevText.data) {
        remove(prevText);
      }
    }
  }
  function remove(node) {
    var next2 = node.nextSibling || node.parentNode;
    node.parentNode.removeChild(node);
    return next2;
  }
  function next(prev, current, isPre) {
    if (prev && prev.parentNode === current || isPre(current)) {
      return current.nextSibling || current.parentNode;
    }
    return current.firstChild || current.nextSibling || current.parentNode;
  }
  var root = typeof window !== "undefined" ? window : {};
  function canParseHTMLNatively() {
    var Parser = root.DOMParser;
    var canParse = false;
    try {
      if (new Parser().parseFromString("", "text/html")) {
        canParse = true;
      }
    } catch (e) {
    }
    return canParse;
  }
  function createHTMLParser() {
    var Parser = function() {
    };
    {
      if (shouldUseActiveX()) {
        Parser.prototype.parseFromString = function(string) {
          var doc = new window.ActiveXObject("htmlfile");
          doc.designMode = "on";
          doc.open();
          doc.write(string);
          doc.close();
          return doc;
        };
      } else {
        Parser.prototype.parseFromString = function(string) {
          var doc = document.implementation.createHTMLDocument("");
          doc.open();
          doc.write(string);
          doc.close();
          return doc;
        };
      }
    }
    return Parser;
  }
  function shouldUseActiveX() {
    var useActiveX = false;
    try {
      document.implementation.createHTMLDocument("").open();
    } catch (e) {
      if (root.ActiveXObject) useActiveX = true;
    }
    return useActiveX;
  }
  var HTMLParser = canParseHTMLNatively() ? root.DOMParser : createHTMLParser();
  function RootNode(input, options) {
    var root3;
    if (typeof input === "string") {
      var doc = htmlParser().parseFromString(
        // DOM parsers arrange elements in the <head> and <body>.
        // Wrapping in a custom element ensures elements are reliably arranged in
        // a single element.
        '<x-turndown id="turndown-root">' + input + "</x-turndown>",
        "text/html"
      );
      root3 = doc.getElementById("turndown-root");
    } else {
      root3 = input.cloneNode(true);
    }
    collapseWhitespace({
      element: root3,
      isBlock,
      isVoid,
      isPre: options.preformattedCode ? isPreOrCode : null
    });
    return root3;
  }
  var _htmlParser;
  function htmlParser() {
    _htmlParser = _htmlParser || new HTMLParser();
    return _htmlParser;
  }
  function isPreOrCode(node) {
    return node.nodeName === "PRE" || node.nodeName === "CODE";
  }
  function Node2(node, options) {
    node.isBlock = isBlock(node);
    node.isCode = node.nodeName === "CODE" || node.parentNode.isCode;
    node.isBlank = isBlank(node);
    node.flankingWhitespace = flankingWhitespace(node, options);
    return node;
  }
  function isBlank(node) {
    return !isVoid(node) && !isMeaningfulWhenBlank(node) && /^\s*$/i.test(node.textContent) && !hasVoid(node) && !hasMeaningfulWhenBlank(node);
  }
  function flankingWhitespace(node, options) {
    if (node.isBlock || options.preformattedCode && node.isCode) {
      return {
        leading: "",
        trailing: ""
      };
    }
    var edges = edgeWhitespace(node.textContent);
    if (edges.leadingAscii && isFlankedByWhitespace("left", node, options)) {
      edges.leading = edges.leadingNonAscii;
    }
    if (edges.trailingAscii && isFlankedByWhitespace("right", node, options)) {
      edges.trailing = edges.trailingNonAscii;
    }
    return {
      leading: edges.leading,
      trailing: edges.trailing
    };
  }
  function edgeWhitespace(string) {
    var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
    return {
      leading: m[1],
      // whole string for whitespace-only strings
      leadingAscii: m[2],
      leadingNonAscii: m[3],
      trailing: m[4],
      // empty for whitespace-only strings
      trailingNonAscii: m[5],
      trailingAscii: m[6]
    };
  }
  function isFlankedByWhitespace(side, node, options) {
    var sibling;
    var regExp;
    var isFlanked;
    if (side === "left") {
      sibling = node.previousSibling;
      regExp = / $/;
    } else {
      sibling = node.nextSibling;
      regExp = /^ /;
    }
    if (sibling) {
      if (sibling.nodeType === 3) {
        isFlanked = regExp.test(sibling.nodeValue);
      } else if (options.preformattedCode && sibling.nodeName === "CODE") {
        isFlanked = false;
      } else if (sibling.nodeType === 1 && !isBlock(sibling)) {
        isFlanked = regExp.test(sibling.textContent);
      }
    }
    return isFlanked;
  }
  var reduce = Array.prototype.reduce;
  function TurndownService(options) {
    if (!(this instanceof TurndownService)) return new TurndownService(options);
    var defaults = {
      rules,
      headingStyle: "setext",
      hr: "* * *",
      bulletListMarker: "*",
      codeBlockStyle: "indented",
      fence: "```",
      emDelimiter: "_",
      strongDelimiter: "**",
      linkStyle: "inlined",
      linkReferenceStyle: "full",
      br: "  ",
      preformattedCode: false,
      blankReplacement: function(content, node) {
        return node.isBlock ? "\n\n" : "";
      },
      keepReplacement: function(content, node) {
        return node.isBlock ? "\n\n" + node.outerHTML + "\n\n" : node.outerHTML;
      },
      defaultReplacement: function(content, node) {
        return node.isBlock ? "\n\n" + content + "\n\n" : content;
      }
    };
    this.options = extend({}, defaults, options);
    this.rules = new Rules(this.options);
  }
  TurndownService.prototype = {
    /**
     * The entry point for converting a string or DOM node to Markdown
     * @public
     * @param {String|HTMLElement} input The string or DOM node to convert
     * @returns A Markdown representation of the input
     * @type String
     */
    turndown: function(input) {
      if (!canConvert(input)) {
        throw new TypeError(input + " is not a string, or an element/document/fragment node.");
      }
      if (input === "") return "";
      var output = process2.call(this, new RootNode(input, this.options));
      return postProcess.call(this, output);
    },
    /**
     * Add one or more plugins
     * @public
     * @param {Function|Array} plugin The plugin or array of plugins to add
     * @returns The Turndown instance for chaining
     * @type Object
     */
    use: function(plugin) {
      if (Array.isArray(plugin)) {
        for (var i = 0; i < plugin.length; i++) this.use(plugin[i]);
      } else if (typeof plugin === "function") {
        plugin(this);
      } else {
        throw new TypeError("plugin must be a Function or an Array of Functions");
      }
      return this;
    },
    /**
     * Adds a rule
     * @public
     * @param {String} key The unique key of the rule
     * @param {Object} rule The rule
     * @returns The Turndown instance for chaining
     * @type Object
     */
    addRule: function(key, rule) {
      this.rules.add(key, rule);
      return this;
    },
    /**
     * Keep a node (as HTML) that matches the filter
     * @public
     * @param {String|Array|Function} filter The unique key of the rule
     * @returns The Turndown instance for chaining
     * @type Object
     */
    keep: function(filter2) {
      this.rules.keep(filter2);
      return this;
    },
    /**
     * Remove a node that matches the filter
     * @public
     * @param {String|Array|Function} filter The unique key of the rule
     * @returns The Turndown instance for chaining
     * @type Object
     */
    remove: function(filter2) {
      this.rules.remove(filter2);
      return this;
    },
    /**
     * Escapes Markdown syntax
     * @public
     * @param {String} string The string to escape
     * @returns A string with Markdown syntax escaped
     * @type String
     */
    escape: function(string) {
      return escapeMarkdown(string);
    }
  };
  function process2(parentNode) {
    var self2 = this;
    return reduce.call(parentNode.childNodes, function(output, node) {
      node = new Node2(node, self2.options);
      var replacement = "";
      if (node.nodeType === 3) {
        replacement = node.isCode ? node.nodeValue : self2.escape(node.nodeValue);
      } else if (node.nodeType === 1) {
        replacement = replacementForNode.call(self2, node);
      }
      return join(output, replacement);
    }, "");
  }
  function postProcess(output) {
    var self2 = this;
    this.rules.forEach(function(rule) {
      if (typeof rule.append === "function") {
        output = join(output, rule.append(self2.options));
      }
    });
    return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
  }
  function replacementForNode(node) {
    var rule = this.rules.forNode(node);
    var content = process2.call(this, node);
    var whitespace = node.flankingWhitespace;
    if (whitespace.leading || whitespace.trailing) content = content.trim();
    return whitespace.leading + rule.replacement(content, node, this.options) + whitespace.trailing;
  }
  function join(output, replacement) {
    var s1 = trimTrailingNewlines(output);
    var s2 = trimLeadingNewlines(replacement);
    var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
    var separator = "\n\n".substring(0, nls);
    return s1 + separator + s2;
  }
  function canConvert(input) {
    return input != null && (typeof input === "string" || input.nodeType && (input.nodeType === 1 || input.nodeType === 9 || input.nodeType === 11));
  }

  // node_modules/xlsx/xlsx.mjs
  var XLSX = {};
  XLSX.version = "0.18.5";
  var current_codepage = 1200;
  var current_ansi = 1252;
  var VALID_ANSI = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1e4];
  var CS2CP = {
    /*::[*/
    0: 1252,
    /* ANSI */
    /*::[*/
    1: 65001,
    /* DEFAULT */
    /*::[*/
    2: 65001,
    /* SYMBOL */
    /*::[*/
    77: 1e4,
    /* MAC */
    /*::[*/
    128: 932,
    /* SHIFTJIS */
    /*::[*/
    129: 949,
    /* HANGUL */
    /*::[*/
    130: 1361,
    /* JOHAB */
    /*::[*/
    134: 936,
    /* GB2312 */
    /*::[*/
    136: 950,
    /* CHINESEBIG5 */
    /*::[*/
    161: 1253,
    /* GREEK */
    /*::[*/
    162: 1254,
    /* TURKISH */
    /*::[*/
    163: 1258,
    /* VIETNAMESE */
    /*::[*/
    177: 1255,
    /* HEBREW */
    /*::[*/
    178: 1256,
    /* ARABIC */
    /*::[*/
    186: 1257,
    /* BALTIC */
    /*::[*/
    204: 1251,
    /* RUSSIAN */
    /*::[*/
    222: 874,
    /* THAI */
    /*::[*/
    238: 1250,
    /* EASTEUROPE */
    /*::[*/
    255: 1252,
    /* OEM */
    /*::[*/
    69: 6969
    /* MISC */
  };
  var set_ansi = function(cp) {
    if (VALID_ANSI.indexOf(cp) == -1) return;
    current_ansi = CS2CP[0] = cp;
  };
  function reset_ansi() {
    set_ansi(1252);
  }
  var set_cp = function(cp) {
    current_codepage = cp;
    set_ansi(cp);
  };
  function reset_cp() {
    set_cp(1200);
    reset_ansi();
  }
  function char_codes(data) {
    var o = [];
    for (var i = 0, len = data.length; i < len; ++i) o[i] = data.charCodeAt(i);
    return o;
  }
  function utf16leread(data) {
    var o = [];
    for (var i = 0; i < data.length >> 1; ++i) o[i] = String.fromCharCode(data.charCodeAt(2 * i) + (data.charCodeAt(2 * i + 1) << 8));
    return o.join("");
  }
  function utf16beread(data) {
    var o = [];
    for (var i = 0; i < data.length >> 1; ++i) o[i] = String.fromCharCode(data.charCodeAt(2 * i + 1) + (data.charCodeAt(2 * i) << 8));
    return o.join("");
  }
  var debom = function(data) {
    var c1 = data.charCodeAt(0), c2 = data.charCodeAt(1);
    if (c1 == 255 && c2 == 254) return utf16leread(data.slice(2));
    if (c1 == 254 && c2 == 255) return utf16beread(data.slice(2));
    if (c1 == 65279) return data.slice(1);
    return data;
  };
  var _getchar = function _gc1(x) {
    return String.fromCharCode(x);
  };
  var _getansi = function _ga1(x) {
    return String.fromCharCode(x);
  };
  var $cptable;
  var DENSE = null;
  var DIF_XL = true;
  var Base64_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  function Base64_encode(input) {
    var o = "";
    var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0;
    for (var i = 0; i < input.length; ) {
      c1 = input.charCodeAt(i++);
      e1 = c1 >> 2;
      c2 = input.charCodeAt(i++);
      e2 = (c1 & 3) << 4 | c2 >> 4;
      c3 = input.charCodeAt(i++);
      e3 = (c2 & 15) << 2 | c3 >> 6;
      e4 = c3 & 63;
      if (isNaN(c2)) {
        e3 = e4 = 64;
      } else if (isNaN(c3)) {
        e4 = 64;
      }
      o += Base64_map.charAt(e1) + Base64_map.charAt(e2) + Base64_map.charAt(e3) + Base64_map.charAt(e4);
    }
    return o;
  }
  function Base64_decode(input) {
    var o = "";
    var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0;
    input = input.replace(/[^\w\+\/\=]/g, "");
    for (var i = 0; i < input.length; ) {
      e1 = Base64_map.indexOf(input.charAt(i++));
      e2 = Base64_map.indexOf(input.charAt(i++));
      c1 = e1 << 2 | e2 >> 4;
      o += String.fromCharCode(c1);
      e3 = Base64_map.indexOf(input.charAt(i++));
      c2 = (e2 & 15) << 4 | e3 >> 2;
      if (e3 !== 64) {
        o += String.fromCharCode(c2);
      }
      e4 = Base64_map.indexOf(input.charAt(i++));
      c3 = (e3 & 3) << 6 | e4;
      if (e4 !== 64) {
        o += String.fromCharCode(c3);
      }
    }
    return o;
  }
  var has_buf = /* @__PURE__ */ (function() {
    return typeof Buffer !== "undefined" && typeof process !== "undefined" && typeof process.versions !== "undefined" && !!process.versions.node;
  })();
  var Buffer_from = /* @__PURE__ */ (function() {
    if (typeof Buffer !== "undefined") {
      var nbfs = !Buffer.from;
      if (!nbfs) try {
        Buffer.from("foo", "utf8");
      } catch (e) {
        nbfs = true;
      }
      return nbfs ? function(buf, enc) {
        return enc ? new Buffer(buf, enc) : new Buffer(buf);
      } : Buffer.from.bind(Buffer);
    }
    return function() {
    };
  })();
  function new_raw_buf(len) {
    if (has_buf) return Buffer.alloc ? Buffer.alloc(len) : new Buffer(len);
    return typeof Uint8Array != "undefined" ? new Uint8Array(len) : new Array(len);
  }
  function new_unsafe_buf(len) {
    if (has_buf) return Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : new Buffer(len);
    return typeof Uint8Array != "undefined" ? new Uint8Array(len) : new Array(len);
  }
  var s2a = function s2a2(s) {
    if (has_buf) return Buffer_from(s, "binary");
    return s.split("").map(function(x) {
      return x.charCodeAt(0) & 255;
    });
  };
  function a2s(data) {
    if (Array.isArray(data)) return data.map(function(c) {
      return String.fromCharCode(c);
    }).join("");
    var o = [];
    for (var i = 0; i < data.length; ++i) o[i] = String.fromCharCode(data[i]);
    return o.join("");
  }
  function ab2a(data) {
    if (typeof ArrayBuffer == "undefined") throw new Error("Unsupported");
    if (data instanceof ArrayBuffer) return ab2a(new Uint8Array(data));
    var o = new Array(data.length);
    for (var i = 0; i < data.length; ++i) o[i] = data[i];
    return o;
  }
  var bconcat = has_buf ? function(bufs) {
    return Buffer.concat(bufs.map(function(buf) {
      return Buffer.isBuffer(buf) ? buf : Buffer_from(buf);
    }));
  } : function(bufs) {
    if (typeof Uint8Array !== "undefined") {
      var i = 0, maxlen = 0;
      for (i = 0; i < bufs.length; ++i) maxlen += bufs[i].length;
      var o = new Uint8Array(maxlen);
      var len = 0;
      for (i = 0, maxlen = 0; i < bufs.length; maxlen += len, ++i) {
        len = bufs[i].length;
        if (bufs[i] instanceof Uint8Array) o.set(bufs[i], maxlen);
        else if (typeof bufs[i] == "string") {
          throw "wtf";
        } else o.set(new Uint8Array(bufs[i]), maxlen);
      }
      return o;
    }
    return [].concat.apply([], bufs.map(function(buf) {
      return Array.isArray(buf) ? buf : [].slice.call(buf);
    }));
  };
  function utf8decode(content) {
    var out = [], widx = 0, L = content.length + 250;
    var o = new_raw_buf(content.length + 255);
    for (var ridx = 0; ridx < content.length; ++ridx) {
      var c = content.charCodeAt(ridx);
      if (c < 128) o[widx++] = c;
      else if (c < 2048) {
        o[widx++] = 192 | c >> 6 & 31;
        o[widx++] = 128 | c & 63;
      } else if (c >= 55296 && c < 57344) {
        c = (c & 1023) + 64;
        var d = content.charCodeAt(++ridx) & 1023;
        o[widx++] = 240 | c >> 8 & 7;
        o[widx++] = 128 | c >> 2 & 63;
        o[widx++] = 128 | d >> 6 & 15 | (c & 3) << 4;
        o[widx++] = 128 | d & 63;
      } else {
        o[widx++] = 224 | c >> 12 & 15;
        o[widx++] = 128 | c >> 6 & 63;
        o[widx++] = 128 | c & 63;
      }
      if (widx > L) {
        out.push(o.slice(0, widx));
        widx = 0;
        o = new_raw_buf(65535);
        L = 65530;
      }
    }
    out.push(o.slice(0, widx));
    return bconcat(out);
  }
  var chr0 = /\u0000/g;
  var chr1 = /[\u0001-\u0006]/g;
  function _strrev(x) {
    var o = "", i = x.length - 1;
    while (i >= 0) o += x.charAt(i--);
    return o;
  }
  function pad0(v, d) {
    var t = "" + v;
    return t.length >= d ? t : fill("0", d - t.length) + t;
  }
  function pad_(v, d) {
    var t = "" + v;
    return t.length >= d ? t : fill(" ", d - t.length) + t;
  }
  function rpad_(v, d) {
    var t = "" + v;
    return t.length >= d ? t : t + fill(" ", d - t.length);
  }
  function pad0r1(v, d) {
    var t = "" + Math.round(v);
    return t.length >= d ? t : fill("0", d - t.length) + t;
  }
  function pad0r2(v, d) {
    var t = "" + v;
    return t.length >= d ? t : fill("0", d - t.length) + t;
  }
  var p2_32 = /* @__PURE__ */ Math.pow(2, 32);
  function pad0r(v, d) {
    if (v > p2_32 || v < -p2_32) return pad0r1(v, d);
    var i = Math.round(v);
    return pad0r2(i, d);
  }
  function SSF_isgeneral(s, i) {
    i = i || 0;
    return s.length >= 7 + i && (s.charCodeAt(i) | 32) === 103 && (s.charCodeAt(i + 1) | 32) === 101 && (s.charCodeAt(i + 2) | 32) === 110 && (s.charCodeAt(i + 3) | 32) === 101 && (s.charCodeAt(i + 4) | 32) === 114 && (s.charCodeAt(i + 5) | 32) === 97 && (s.charCodeAt(i + 6) | 32) === 108;
  }
  var days = [
    ["Sun", "Sunday"],
    ["Mon", "Monday"],
    ["Tue", "Tuesday"],
    ["Wed", "Wednesday"],
    ["Thu", "Thursday"],
    ["Fri", "Friday"],
    ["Sat", "Saturday"]
  ];
  var months = [
    ["J", "Jan", "January"],
    ["F", "Feb", "February"],
    ["M", "Mar", "March"],
    ["A", "Apr", "April"],
    ["M", "May", "May"],
    ["J", "Jun", "June"],
    ["J", "Jul", "July"],
    ["A", "Aug", "August"],
    ["S", "Sep", "September"],
    ["O", "Oct", "October"],
    ["N", "Nov", "November"],
    ["D", "Dec", "December"]
  ];
  function SSF_init_table(t) {
    if (!t) t = {};
    t[0] = "General";
    t[1] = "0";
    t[2] = "0.00";
    t[3] = "#,##0";
    t[4] = "#,##0.00";
    t[9] = "0%";
    t[10] = "0.00%";
    t[11] = "0.00E+00";
    t[12] = "# ?/?";
    t[13] = "# ??/??";
    t[14] = "m/d/yy";
    t[15] = "d-mmm-yy";
    t[16] = "d-mmm";
    t[17] = "mmm-yy";
    t[18] = "h:mm AM/PM";
    t[19] = "h:mm:ss AM/PM";
    t[20] = "h:mm";
    t[21] = "h:mm:ss";
    t[22] = "m/d/yy h:mm";
    t[37] = "#,##0 ;(#,##0)";
    t[38] = "#,##0 ;[Red](#,##0)";
    t[39] = "#,##0.00;(#,##0.00)";
    t[40] = "#,##0.00;[Red](#,##0.00)";
    t[45] = "mm:ss";
    t[46] = "[h]:mm:ss";
    t[47] = "mmss.0";
    t[48] = "##0.0E+0";
    t[49] = "@";
    t[56] = '"\u4E0A\u5348/\u4E0B\u5348 "hh"\u6642"mm"\u5206"ss"\u79D2 "';
    return t;
  }
  var table_fmt = {
    0: "General",
    1: "0",
    2: "0.00",
    3: "#,##0",
    4: "#,##0.00",
    9: "0%",
    10: "0.00%",
    11: "0.00E+00",
    12: "# ?/?",
    13: "# ??/??",
    14: "m/d/yy",
    15: "d-mmm-yy",
    16: "d-mmm",
    17: "mmm-yy",
    18: "h:mm AM/PM",
    19: "h:mm:ss AM/PM",
    20: "h:mm",
    21: "h:mm:ss",
    22: "m/d/yy h:mm",
    37: "#,##0 ;(#,##0)",
    38: "#,##0 ;[Red](#,##0)",
    39: "#,##0.00;(#,##0.00)",
    40: "#,##0.00;[Red](#,##0.00)",
    45: "mm:ss",
    46: "[h]:mm:ss",
    47: "mmss.0",
    48: "##0.0E+0",
    49: "@",
    56: '"\u4E0A\u5348/\u4E0B\u5348 "hh"\u6642"mm"\u5206"ss"\u79D2 "'
  };
  var SSF_default_map = {
    5: 37,
    6: 38,
    7: 39,
    8: 40,
    //  5 -> 37 ...  8 -> 40
    23: 0,
    24: 0,
    25: 0,
    26: 0,
    // 23 ->  0 ... 26 ->  0
    27: 14,
    28: 14,
    29: 14,
    30: 14,
    31: 14,
    // 27 -> 14 ... 31 -> 14
    50: 14,
    51: 14,
    52: 14,
    53: 14,
    54: 14,
    // 50 -> 14 ... 58 -> 14
    55: 14,
    56: 14,
    57: 14,
    58: 14,
    59: 1,
    60: 2,
    61: 3,
    62: 4,
    // 59 ->  1 ... 62 ->  4
    67: 9,
    68: 10,
    // 67 ->  9 ... 68 -> 10
    69: 12,
    70: 13,
    71: 14,
    // 69 -> 12 ... 71 -> 14
    72: 14,
    73: 15,
    74: 16,
    75: 17,
    // 72 -> 14 ... 75 -> 17
    76: 20,
    77: 21,
    78: 22,
    // 76 -> 20 ... 78 -> 22
    79: 45,
    80: 46,
    81: 47,
    // 79 -> 45 ... 81 -> 47
    82: 0
    // 82 ->  0 ... 65536 -> 0 (omitted)
  };
  var SSF_default_str = {
    //  5 -- Currency,   0 decimal, black negative
    5: '"$"#,##0_);\\("$"#,##0\\)',
    63: '"$"#,##0_);\\("$"#,##0\\)',
    //  6 -- Currency,   0 decimal, red   negative
    6: '"$"#,##0_);[Red]\\("$"#,##0\\)',
    64: '"$"#,##0_);[Red]\\("$"#,##0\\)',
    //  7 -- Currency,   2 decimal, black negative
    7: '"$"#,##0.00_);\\("$"#,##0.00\\)',
    65: '"$"#,##0.00_);\\("$"#,##0.00\\)',
    //  8 -- Currency,   2 decimal, red   negative
    8: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
    66: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
    // 41 -- Accounting, 0 decimal, No Symbol
    41: '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',
    // 42 -- Accounting, 0 decimal, $  Symbol
    42: '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',
    // 43 -- Accounting, 2 decimal, No Symbol
    43: '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',
    // 44 -- Accounting, 2 decimal, $  Symbol
    44: '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'
  };
  function SSF_frac(x, D, mixed) {
    var sgn = x < 0 ? -1 : 1;
    var B = x * sgn;
    var P_2 = 0, P_1 = 1, P = 0;
    var Q_2 = 1, Q_1 = 0, Q = 0;
    var A = Math.floor(B);
    while (Q_1 < D) {
      A = Math.floor(B);
      P = A * P_1 + P_2;
      Q = A * Q_1 + Q_2;
      if (B - A < 5e-8) break;
      B = 1 / (B - A);
      P_2 = P_1;
      P_1 = P;
      Q_2 = Q_1;
      Q_1 = Q;
    }
    if (Q > D) {
      if (Q_1 > D) {
        Q = Q_2;
        P = P_2;
      } else {
        Q = Q_1;
        P = P_1;
      }
    }
    if (!mixed) return [0, sgn * P, Q];
    var q = Math.floor(sgn * P / Q);
    return [q, sgn * P - q * Q, Q];
  }
  function SSF_parse_date_code(v, opts, b2) {
    if (v > 2958465 || v < 0) return null;
    var date = v | 0, time = Math.floor(86400 * (v - date)), dow = 0;
    var dout = [];
    var out = { D: date, T: time, u: 86400 * (v - date) - time, y: 0, m: 0, d: 0, H: 0, M: 0, S: 0, q: 0 };
    if (Math.abs(out.u) < 1e-6) out.u = 0;
    if (opts && opts.date1904) date += 1462;
    if (out.u > 0.9999) {
      out.u = 0;
      if (++time == 86400) {
        out.T = time = 0;
        ++date;
        ++out.D;
      }
    }
    if (date === 60) {
      dout = b2 ? [1317, 10, 29] : [1900, 2, 29];
      dow = 3;
    } else if (date === 0) {
      dout = b2 ? [1317, 8, 29] : [1900, 1, 0];
      dow = 6;
    } else {
      if (date > 60) --date;
      var d = new Date(1900, 0, 1);
      d.setDate(d.getDate() + date - 1);
      dout = [d.getFullYear(), d.getMonth() + 1, d.getDate()];
      dow = d.getDay();
      if (date < 60) dow = (dow + 6) % 7;
      if (b2) dow = SSF_fix_hijri(d, dout);
    }
    out.y = dout[0];
    out.m = dout[1];
    out.d = dout[2];
    out.S = time % 60;
    time = Math.floor(time / 60);
    out.M = time % 60;
    time = Math.floor(time / 60);
    out.H = time;
    out.q = dow;
    return out;
  }
  var SSFbasedate = /* @__PURE__ */ new Date(1899, 11, 31, 0, 0, 0);
  var SSFdnthresh = /* @__PURE__ */ SSFbasedate.getTime();
  var SSFbase1904 = /* @__PURE__ */ new Date(1900, 2, 1, 0, 0, 0);
  function datenum_local(v, date1904) {
    var epoch = /* @__PURE__ */ v.getTime();
    if (date1904) epoch -= 1461 * 24 * 60 * 60 * 1e3;
    else if (v >= SSFbase1904) epoch += 24 * 60 * 60 * 1e3;
    return (epoch - (SSFdnthresh + (/* @__PURE__ */ v.getTimezoneOffset() - /* @__PURE__ */ SSFbasedate.getTimezoneOffset()) * 6e4)) / (24 * 60 * 60 * 1e3);
  }
  function SSF_strip_decimal(o) {
    return o.indexOf(".") == -1 ? o : o.replace(/(?:\.0*|(\.\d*[1-9])0+)$/, "$1");
  }
  function SSF_normalize_exp(o) {
    if (o.indexOf("E") == -1) return o;
    return o.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/, "$1E").replace(/(E[+-])(\d)$/, "$10$2");
  }
  function SSF_small_exp(v) {
    var w = v < 0 ? 12 : 11;
    var o = SSF_strip_decimal(v.toFixed(12));
    if (o.length <= w) return o;
    o = v.toPrecision(10);
    if (o.length <= w) return o;
    return v.toExponential(5);
  }
  function SSF_large_exp(v) {
    var o = SSF_strip_decimal(v.toFixed(11));
    return o.length > (v < 0 ? 12 : 11) || o === "0" || o === "-0" ? v.toPrecision(6) : o;
  }
  function SSF_general_num(v) {
    var V = Math.floor(Math.log(Math.abs(v)) * Math.LOG10E), o;
    if (V >= -4 && V <= -1) o = v.toPrecision(10 + V);
    else if (Math.abs(V) <= 9) o = SSF_small_exp(v);
    else if (V === 10) o = v.toFixed(10).substr(0, 12);
    else o = SSF_large_exp(v);
    return SSF_strip_decimal(SSF_normalize_exp(o.toUpperCase()));
  }
  function SSF_general(v, opts) {
    switch (typeof v) {
      case "string":
        return v;
      case "boolean":
        return v ? "TRUE" : "FALSE";
      case "number":
        return (v | 0) === v ? v.toString(10) : SSF_general_num(v);
      case "undefined":
        return "";
      case "object":
        if (v == null) return "";
        if (v instanceof Date) return SSF_format(14, datenum_local(v, opts && opts.date1904), opts);
    }
    throw new Error("unsupported value in General format: " + v);
  }
  function SSF_fix_hijri(date, o) {
    o[0] -= 581;
    var dow = date.getDay();
    if (date < 60) dow = (dow + 6) % 7;
    return dow;
  }
  function SSF_write_date(type, fmt, val, ss0) {
    var o = "", ss = 0, tt = 0, y = val.y, out, outl = 0;
    switch (type) {
      case 98:
        y = val.y + 543;
      /* falls through */
      case 121:
        switch (fmt.length) {
          case 1:
          case 2:
            out = y % 100;
            outl = 2;
            break;
          default:
            out = y % 1e4;
            outl = 4;
            break;
        }
        break;
      case 109:
        switch (fmt.length) {
          case 1:
          case 2:
            out = val.m;
            outl = fmt.length;
            break;
          case 3:
            return months[val.m - 1][1];
          case 5:
            return months[val.m - 1][0];
          default:
            return months[val.m - 1][2];
        }
        break;
      case 100:
        switch (fmt.length) {
          case 1:
          case 2:
            out = val.d;
            outl = fmt.length;
            break;
          case 3:
            return days[val.q][0];
          default:
            return days[val.q][1];
        }
        break;
      case 104:
        switch (fmt.length) {
          case 1:
          case 2:
            out = 1 + (val.H + 11) % 12;
            outl = fmt.length;
            break;
          default:
            throw "bad hour format: " + fmt;
        }
        break;
      case 72:
        switch (fmt.length) {
          case 1:
          case 2:
            out = val.H;
            outl = fmt.length;
            break;
          default:
            throw "bad hour format: " + fmt;
        }
        break;
      case 77:
        switch (fmt.length) {
          case 1:
          case 2:
            out = val.M;
            outl = fmt.length;
            break;
          default:
            throw "bad minute format: " + fmt;
        }
        break;
      case 115:
        if (fmt != "s" && fmt != "ss" && fmt != ".0" && fmt != ".00" && fmt != ".000") throw "bad second format: " + fmt;
        if (val.u === 0 && (fmt == "s" || fmt == "ss")) return pad0(val.S, fmt.length);
        if (ss0 >= 2) tt = ss0 === 3 ? 1e3 : 100;
        else tt = ss0 === 1 ? 10 : 1;
        ss = Math.round(tt * (val.S + val.u));
        if (ss >= 60 * tt) ss = 0;
        if (fmt === "s") return ss === 0 ? "0" : "" + ss / tt;
        o = pad0(ss, 2 + ss0);
        if (fmt === "ss") return o.substr(0, 2);
        return "." + o.substr(2, fmt.length - 1);
      case 90:
        switch (fmt) {
          case "[h]":
          case "[hh]":
            out = val.D * 24 + val.H;
            break;
          case "[m]":
          case "[mm]":
            out = (val.D * 24 + val.H) * 60 + val.M;
            break;
          case "[s]":
          case "[ss]":
            out = ((val.D * 24 + val.H) * 60 + val.M) * 60 + Math.round(val.S + val.u);
            break;
          default:
            throw "bad abstime format: " + fmt;
        }
        outl = fmt.length === 3 ? 1 : 2;
        break;
      case 101:
        out = y;
        outl = 1;
        break;
    }
    var outstr = outl > 0 ? pad0(out, outl) : "";
    return outstr;
  }
  function commaify(s) {
    var w = 3;
    if (s.length <= w) return s;
    var j = s.length % w, o = s.substr(0, j);
    for (; j != s.length; j += w) o += (o.length > 0 ? "," : "") + s.substr(j, w);
    return o;
  }
  var pct1 = /%/g;
  function write_num_pct(type, fmt, val) {
    var sfmt = fmt.replace(pct1, ""), mul = fmt.length - sfmt.length;
    return write_num(type, sfmt, val * Math.pow(10, 2 * mul)) + fill("%", mul);
  }
  function write_num_cm(type, fmt, val) {
    var idx = fmt.length - 1;
    while (fmt.charCodeAt(idx - 1) === 44) --idx;
    return write_num(type, fmt.substr(0, idx), val / Math.pow(10, 3 * (fmt.length - idx)));
  }
  function write_num_exp(fmt, val) {
    var o;
    var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1;
    if (fmt.match(/^#+0.0E\+0$/)) {
      if (val == 0) return "0.0E+0";
      else if (val < 0) return "-" + write_num_exp(fmt, -val);
      var period = fmt.indexOf(".");
      if (period === -1) period = fmt.indexOf("E");
      var ee = Math.floor(Math.log(val) * Math.LOG10E) % period;
      if (ee < 0) ee += period;
      o = (val / Math.pow(10, ee)).toPrecision(idx + 1 + (period + ee) % period);
      if (o.indexOf("e") === -1) {
        var fakee = Math.floor(Math.log(val) * Math.LOG10E);
        if (o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length + ee);
        else o += "E+" + (fakee - ee);
        while (o.substr(0, 2) === "0.") {
          o = o.charAt(0) + o.substr(2, period) + "." + o.substr(2 + period);
          o = o.replace(/^0+([1-9])/, "$1").replace(/^0+\./, "0.");
        }
        o = o.replace(/\+-/, "-");
      }
      o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function($$, $1, $2, $3) {
        return $1 + $2 + $3.substr(0, (period + ee) % period) + "." + $3.substr(ee) + "E";
      });
    } else o = val.toExponential(idx);
    if (fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0, o.length - 1) + "0" + o.charAt(o.length - 1);
    if (fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/, "e");
    return o.replace("e", "E");
  }
  var frac1 = /# (\?+)( ?)\/( ?)(\d+)/;
  function write_num_f1(r, aval, sign) {
    var den = parseInt(r[4], 10), rr = Math.round(aval * den), base = Math.floor(rr / den);
    var myn = rr - base * den, myd = den;
    return sign + (base === 0 ? "" : "" + base) + " " + (myn === 0 ? fill(" ", r[1].length + 1 + r[4].length) : pad_(myn, r[1].length) + r[2] + "/" + r[3] + pad0(myd, r[4].length));
  }
  function write_num_f2(r, aval, sign) {
    return sign + (aval === 0 ? "" : "" + aval) + fill(" ", r[1].length + 2 + r[4].length);
  }
  var dec1 = /^#*0*\.([0#]+)/;
  var closeparen = /\).*[0#]/;
  var phone = /\(###\) ###\\?-####/;
  function hashq(str) {
    var o = "", cc;
    for (var i = 0; i != str.length; ++i) switch (cc = str.charCodeAt(i)) {
      case 35:
        break;
      case 63:
        o += " ";
        break;
      case 48:
        o += "0";
        break;
      default:
        o += String.fromCharCode(cc);
    }
    return o;
  }
  function rnd(val, d) {
    var dd = Math.pow(10, d);
    return "" + Math.round(val * dd) / dd;
  }
  function dec(val, d) {
    var _frac = val - Math.floor(val), dd = Math.pow(10, d);
    if (d < ("" + Math.round(_frac * dd)).length) return 0;
    return Math.round(_frac * dd);
  }
  function carry(val, d) {
    if (d < ("" + Math.round((val - Math.floor(val)) * Math.pow(10, d))).length) {
      return 1;
    }
    return 0;
  }
  function flr(val) {
    if (val < 2147483647 && val > -2147483648) return "" + (val >= 0 ? val | 0 : val - 1 | 0);
    return "" + Math.floor(val);
  }
  function write_num_flt(type, fmt, val) {
    if (type.charCodeAt(0) === 40 && !fmt.match(closeparen)) {
      var ffmt = fmt.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
      if (val >= 0) return write_num_flt("n", ffmt, val);
      return "(" + write_num_flt("n", ffmt, -val) + ")";
    }
    if (fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm(type, fmt, val);
    if (fmt.indexOf("%") !== -1) return write_num_pct(type, fmt, val);
    if (fmt.indexOf("E") !== -1) return write_num_exp(fmt, val);
    if (fmt.charCodeAt(0) === 36) return "$" + write_num_flt(type, fmt.substr(fmt.charAt(1) == " " ? 2 : 1), val);
    var o;
    var r, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : "";
    if (fmt.match(/^00+$/)) return sign + pad0r(aval, fmt.length);
    if (fmt.match(/^[#?]+$/)) {
      o = pad0r(val, 0);
      if (o === "0") o = "";
      return o.length > fmt.length ? o : hashq(fmt.substr(0, fmt.length - o.length)) + o;
    }
    if (r = fmt.match(frac1)) return write_num_f1(r, aval, sign);
    if (fmt.match(/^#+0+$/)) return sign + pad0r(aval, fmt.length - fmt.indexOf("0"));
    if (r = fmt.match(dec1)) {
      o = rnd(val, r[1].length).replace(/^([^\.]+)$/, "$1." + hashq(r[1])).replace(/\.$/, "." + hashq(r[1])).replace(/\.(\d*)$/, function($$, $1) {
        return "." + $1 + fill("0", hashq(
          /*::(*/
          r[1]
        ).length - $1.length);
      });
      return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
    }
    fmt = fmt.replace(/^#+([0.])/, "$1");
    if (r = fmt.match(/^(0*)\.(#*)$/)) {
      return sign + rnd(aval, r[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, r[1].length ? "0." : ".");
    }
    if (r = fmt.match(/^#{1,3},##0(\.?)$/)) return sign + commaify(pad0r(aval, 0));
    if (r = fmt.match(/^#,##0\.([#0]*0)$/)) {
      return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify("" + (Math.floor(val) + carry(val, r[1].length))) + "." + pad0(dec(val, r[1].length), r[1].length);
    }
    if (r = fmt.match(/^#,#*,#0/)) return write_num_flt(type, fmt.replace(/^#,#*,/, ""), val);
    if (r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/)) {
      o = _strrev(write_num_flt(type, fmt.replace(/[\\-]/g, ""), val));
      ri = 0;
      return _strrev(_strrev(fmt.replace(/\\/g, "")).replace(/[0#]/g, function(x2) {
        return ri < o.length ? o.charAt(ri++) : x2 === "0" ? "0" : "";
      }));
    }
    if (fmt.match(phone)) {
      o = write_num_flt(type, "##########", val);
      return "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
    }
    var oa = "";
    if (r = fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)) {
      ri = Math.min(
        /*::String(*/
        r[4].length,
        7
      );
      ff = SSF_frac(aval, Math.pow(10, ri) - 1, false);
      o = "" + sign;
      oa = write_num(
        "n",
        /*::String(*/
        r[1],
        ff[1]
      );
      if (oa.charAt(oa.length - 1) == " ") oa = oa.substr(0, oa.length - 1) + "0";
      o += oa + /*::String(*/
      r[2] + "/" + /*::String(*/
      r[3];
      oa = rpad_(ff[2], ri);
      if (oa.length < r[4].length) oa = hashq(r[4].substr(r[4].length - oa.length)) + oa;
      o += oa;
      return o;
    }
    if (r = fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/)) {
      ri = Math.min(Math.max(r[1].length, r[4].length), 7);
      ff = SSF_frac(aval, Math.pow(10, ri) - 1, true);
      return sign + (ff[0] || (ff[1] ? "" : "0")) + " " + (ff[1] ? pad_(ff[1], ri) + r[2] + "/" + r[3] + rpad_(ff[2], ri) : fill(" ", 2 * ri + 1 + r[2].length + r[3].length));
    }
    if (r = fmt.match(/^[#0?]+$/)) {
      o = pad0r(val, 0);
      if (fmt.length <= o.length) return o;
      return hashq(fmt.substr(0, fmt.length - o.length)) + o;
    }
    if (r = fmt.match(/^([#0?]+)\.([#0]+)$/)) {
      o = "" + val.toFixed(Math.min(r[2].length, 10)).replace(/([^0])0+$/, "$1");
      ri = o.indexOf(".");
      var lres = fmt.indexOf(".") - ri, rres = fmt.length - o.length - lres;
      return hashq(fmt.substr(0, lres) + o + fmt.substr(fmt.length - rres));
    }
    if (r = fmt.match(/^00,000\.([#0]*0)$/)) {
      ri = dec(val, r[1].length);
      return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify(flr(val)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function($$) {
        return "00," + ($$.length < 3 ? pad0(0, 3 - $$.length) : "") + $$;
      }) + "." + pad0(ri, r[1].length);
    }
    switch (fmt) {
      case "###,##0.00":
        return write_num_flt(type, "#,##0.00", val);
      case "###,###":
      case "##,###":
      case "#,###":
        var x = commaify(pad0r(aval, 0));
        return x !== "0" ? sign + x : "";
      case "###,###.00":
        return write_num_flt(type, "###,##0.00", val).replace(/^0\./, ".");
      case "#,###.00":
        return write_num_flt(type, "#,##0.00", val).replace(/^0\./, ".");
      default:
    }
    throw new Error("unsupported format |" + fmt + "|");
  }
  function write_num_cm2(type, fmt, val) {
    var idx = fmt.length - 1;
    while (fmt.charCodeAt(idx - 1) === 44) --idx;
    return write_num(type, fmt.substr(0, idx), val / Math.pow(10, 3 * (fmt.length - idx)));
  }
  function write_num_pct2(type, fmt, val) {
    var sfmt = fmt.replace(pct1, ""), mul = fmt.length - sfmt.length;
    return write_num(type, sfmt, val * Math.pow(10, 2 * mul)) + fill("%", mul);
  }
  function write_num_exp2(fmt, val) {
    var o;
    var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1;
    if (fmt.match(/^#+0.0E\+0$/)) {
      if (val == 0) return "0.0E+0";
      else if (val < 0) return "-" + write_num_exp2(fmt, -val);
      var period = fmt.indexOf(".");
      if (period === -1) period = fmt.indexOf("E");
      var ee = Math.floor(Math.log(val) * Math.LOG10E) % period;
      if (ee < 0) ee += period;
      o = (val / Math.pow(10, ee)).toPrecision(idx + 1 + (period + ee) % period);
      if (!o.match(/[Ee]/)) {
        var fakee = Math.floor(Math.log(val) * Math.LOG10E);
        if (o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length + ee);
        else o += "E+" + (fakee - ee);
        o = o.replace(/\+-/, "-");
      }
      o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function($$, $1, $2, $3) {
        return $1 + $2 + $3.substr(0, (period + ee) % period) + "." + $3.substr(ee) + "E";
      });
    } else o = val.toExponential(idx);
    if (fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0, o.length - 1) + "0" + o.charAt(o.length - 1);
    if (fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/, "e");
    return o.replace("e", "E");
  }
  function write_num_int(type, fmt, val) {
    if (type.charCodeAt(0) === 40 && !fmt.match(closeparen)) {
      var ffmt = fmt.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
      if (val >= 0) return write_num_int("n", ffmt, val);
      return "(" + write_num_int("n", ffmt, -val) + ")";
    }
    if (fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm2(type, fmt, val);
    if (fmt.indexOf("%") !== -1) return write_num_pct2(type, fmt, val);
    if (fmt.indexOf("E") !== -1) return write_num_exp2(fmt, val);
    if (fmt.charCodeAt(0) === 36) return "$" + write_num_int(type, fmt.substr(fmt.charAt(1) == " " ? 2 : 1), val);
    var o;
    var r, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : "";
    if (fmt.match(/^00+$/)) return sign + pad0(aval, fmt.length);
    if (fmt.match(/^[#?]+$/)) {
      o = "" + val;
      if (val === 0) o = "";
      return o.length > fmt.length ? o : hashq(fmt.substr(0, fmt.length - o.length)) + o;
    }
    if (r = fmt.match(frac1)) return write_num_f2(r, aval, sign);
    if (fmt.match(/^#+0+$/)) return sign + pad0(aval, fmt.length - fmt.indexOf("0"));
    if (r = fmt.match(dec1)) {
      o = ("" + val).replace(/^([^\.]+)$/, "$1." + hashq(r[1])).replace(/\.$/, "." + hashq(r[1]));
      o = o.replace(/\.(\d*)$/, function($$, $1) {
        return "." + $1 + fill("0", hashq(r[1]).length - $1.length);
      });
      return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
    }
    fmt = fmt.replace(/^#+([0.])/, "$1");
    if (r = fmt.match(/^(0*)\.(#*)$/)) {
      return sign + ("" + aval).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, r[1].length ? "0." : ".");
    }
    if (r = fmt.match(/^#{1,3},##0(\.?)$/)) return sign + commaify("" + aval);
    if (r = fmt.match(/^#,##0\.([#0]*0)$/)) {
      return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify("" + val) + "." + fill("0", r[1].length);
    }
    if (r = fmt.match(/^#,#*,#0/)) return write_num_int(type, fmt.replace(/^#,#*,/, ""), val);
    if (r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/)) {
      o = _strrev(write_num_int(type, fmt.replace(/[\\-]/g, ""), val));
      ri = 0;
      return _strrev(_strrev(fmt.replace(/\\/g, "")).replace(/[0#]/g, function(x2) {
        return ri < o.length ? o.charAt(ri++) : x2 === "0" ? "0" : "";
      }));
    }
    if (fmt.match(phone)) {
      o = write_num_int(type, "##########", val);
      return "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
    }
    var oa = "";
    if (r = fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)) {
      ri = Math.min(
        /*::String(*/
        r[4].length,
        7
      );
      ff = SSF_frac(aval, Math.pow(10, ri) - 1, false);
      o = "" + sign;
      oa = write_num(
        "n",
        /*::String(*/
        r[1],
        ff[1]
      );
      if (oa.charAt(oa.length - 1) == " ") oa = oa.substr(0, oa.length - 1) + "0";
      o += oa + /*::String(*/
      r[2] + "/" + /*::String(*/
      r[3];
      oa = rpad_(ff[2], ri);
      if (oa.length < r[4].length) oa = hashq(r[4].substr(r[4].length - oa.length)) + oa;
      o += oa;
      return o;
    }
    if (r = fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/)) {
      ri = Math.min(Math.max(r[1].length, r[4].length), 7);
      ff = SSF_frac(aval, Math.pow(10, ri) - 1, true);
      return sign + (ff[0] || (ff[1] ? "" : "0")) + " " + (ff[1] ? pad_(ff[1], ri) + r[2] + "/" + r[3] + rpad_(ff[2], ri) : fill(" ", 2 * ri + 1 + r[2].length + r[3].length));
    }
    if (r = fmt.match(/^[#0?]+$/)) {
      o = "" + val;
      if (fmt.length <= o.length) return o;
      return hashq(fmt.substr(0, fmt.length - o.length)) + o;
    }
    if (r = fmt.match(/^([#0]+)\.([#0]+)$/)) {
      o = "" + val.toFixed(Math.min(r[2].length, 10)).replace(/([^0])0+$/, "$1");
      ri = o.indexOf(".");
      var lres = fmt.indexOf(".") - ri, rres = fmt.length - o.length - lres;
      return hashq(fmt.substr(0, lres) + o + fmt.substr(fmt.length - rres));
    }
    if (r = fmt.match(/^00,000\.([#0]*0)$/)) {
      return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify("" + val).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function($$) {
        return "00," + ($$.length < 3 ? pad0(0, 3 - $$.length) : "") + $$;
      }) + "." + pad0(0, r[1].length);
    }
    switch (fmt) {
      case "###,###":
      case "##,###":
      case "#,###":
        var x = commaify("" + aval);
        return x !== "0" ? sign + x : "";
      default:
        if (fmt.match(/\.[0#?]*$/)) return write_num_int(type, fmt.slice(0, fmt.lastIndexOf(".")), val) + hashq(fmt.slice(fmt.lastIndexOf(".")));
    }
    throw new Error("unsupported format |" + fmt + "|");
  }
  function write_num(type, fmt, val) {
    return (val | 0) === val ? write_num_int(type, fmt, val) : write_num_flt(type, fmt, val);
  }
  function SSF_split_fmt(fmt) {
    var out = [];
    var in_str = false;
    for (var i = 0, j = 0; i < fmt.length; ++i) switch (
      /*cc=*/
      fmt.charCodeAt(i)
    ) {
      case 34:
        in_str = !in_str;
        break;
      case 95:
      case 42:
      case 92:
        ++i;
        break;
      case 59:
        out[out.length] = fmt.substr(j, i - j);
        j = i + 1;
    }
    out[out.length] = fmt.substr(j);
    if (in_str === true) throw new Error("Format |" + fmt + "| unterminated string ");
    return out;
  }
  var SSF_abstime = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;
  function fmt_is_date(fmt) {
    var i = 0, c = "", o = "";
    while (i < fmt.length) {
      switch (c = fmt.charAt(i)) {
        case "G":
          if (SSF_isgeneral(fmt, i)) i += 6;
          i++;
          break;
        case '"':
          for (
            ;
            /*cc=*/
            fmt.charCodeAt(++i) !== 34 && i < fmt.length;
          ) {
          }
          ++i;
          break;
        case "\\":
          i += 2;
          break;
        case "_":
          i += 2;
          break;
        case "@":
          ++i;
          break;
        case "B":
        case "b":
          if (fmt.charAt(i + 1) === "1" || fmt.charAt(i + 1) === "2") return true;
        /* falls through */
        case "M":
        case "D":
        case "Y":
        case "H":
        case "S":
        case "E":
        /* falls through */
        case "m":
        case "d":
        case "y":
        case "h":
        case "s":
        case "e":
        case "g":
          return true;
        case "A":
        case "a":
        case "\u4E0A":
          if (fmt.substr(i, 3).toUpperCase() === "A/P") return true;
          if (fmt.substr(i, 5).toUpperCase() === "AM/PM") return true;
          if (fmt.substr(i, 5).toUpperCase() === "\u4E0A\u5348/\u4E0B\u5348") return true;
          ++i;
          break;
        case "[":
          o = c;
          while (fmt.charAt(i++) !== "]" && i < fmt.length) o += fmt.charAt(i);
          if (o.match(SSF_abstime)) return true;
          break;
        case ".":
        /* falls through */
        case "0":
        case "#":
          while (i < fmt.length && ("0#?.,E+-%".indexOf(c = fmt.charAt(++i)) > -1 || c == "\\" && fmt.charAt(i + 1) == "-" && "0#".indexOf(fmt.charAt(i + 2)) > -1)) {
          }
          break;
        case "?":
          while (fmt.charAt(++i) === c) {
          }
          break;
        case "*":
          ++i;
          if (fmt.charAt(i) == " " || fmt.charAt(i) == "*") ++i;
          break;
        case "(":
        case ")":
          ++i;
          break;
        case "1":
        case "2":
        case "3":
        case "4":
        case "5":
        case "6":
        case "7":
        case "8":
        case "9":
          while (i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) {
          }
          break;
        case " ":
          ++i;
          break;
        default:
          ++i;
          break;
      }
    }
    return false;
  }
  function eval_fmt(fmt, v, opts, flen) {
    var out = [], o = "", i = 0, c = "", lst = "t", dt, j, cc;
    var hr = "H";
    while (i < fmt.length) {
      switch (c = fmt.charAt(i)) {
        case "G":
          if (!SSF_isgeneral(fmt, i)) throw new Error("unrecognized character " + c + " in " + fmt);
          out[out.length] = { t: "G", v: "General" };
          i += 7;
          break;
        case '"':
          for (o = ""; (cc = fmt.charCodeAt(++i)) !== 34 && i < fmt.length; ) o += String.fromCharCode(cc);
          out[out.length] = { t: "t", v: o };
          ++i;
          break;
        case "\\":
          var w = fmt.charAt(++i), t = w === "(" || w === ")" ? w : "t";
          out[out.length] = { t, v: w };
          ++i;
          break;
        case "_":
          out[out.length] = { t: "t", v: " " };
          i += 2;
          break;
        case "@":
          out[out.length] = { t: "T", v };
          ++i;
          break;
        case "B":
        case "b":
          if (fmt.charAt(i + 1) === "1" || fmt.charAt(i + 1) === "2") {
            if (dt == null) {
              dt = SSF_parse_date_code(v, opts, fmt.charAt(i + 1) === "2");
              if (dt == null) return "";
            }
            out[out.length] = { t: "X", v: fmt.substr(i, 2) };
            lst = c;
            i += 2;
            break;
          }
        /* falls through */
        case "M":
        case "D":
        case "Y":
        case "H":
        case "S":
        case "E":
          c = c.toLowerCase();
        /* falls through */
        case "m":
        case "d":
        case "y":
        case "h":
        case "s":
        case "e":
        case "g":
          if (v < 0) return "";
          if (dt == null) {
            dt = SSF_parse_date_code(v, opts);
            if (dt == null) return "";
          }
          o = c;
          while (++i < fmt.length && fmt.charAt(i).toLowerCase() === c) o += c;
          if (c === "m" && lst.toLowerCase() === "h") c = "M";
          if (c === "h") c = hr;
          out[out.length] = { t: c, v: o };
          lst = c;
          break;
        case "A":
        case "a":
        case "\u4E0A":
          var q = { t: c, v: c };
          if (dt == null) dt = SSF_parse_date_code(v, opts);
          if (fmt.substr(i, 3).toUpperCase() === "A/P") {
            if (dt != null) q.v = dt.H >= 12 ? "P" : "A";
            q.t = "T";
            hr = "h";
            i += 3;
          } else if (fmt.substr(i, 5).toUpperCase() === "AM/PM") {
            if (dt != null) q.v = dt.H >= 12 ? "PM" : "AM";
            q.t = "T";
            i += 5;
            hr = "h";
          } else if (fmt.substr(i, 5).toUpperCase() === "\u4E0A\u5348/\u4E0B\u5348") {
            if (dt != null) q.v = dt.H >= 12 ? "\u4E0B\u5348" : "\u4E0A\u5348";
            q.t = "T";
            i += 5;
            hr = "h";
          } else {
            q.t = "t";
            ++i;
          }
          if (dt == null && q.t === "T") return "";
          out[out.length] = q;
          lst = c;
          break;
        case "[":
          o = c;
          while (fmt.charAt(i++) !== "]" && i < fmt.length) o += fmt.charAt(i);
          if (o.slice(-1) !== "]") throw 'unterminated "[" block: |' + o + "|";
          if (o.match(SSF_abstime)) {
            if (dt == null) {
              dt = SSF_parse_date_code(v, opts);
              if (dt == null) return "";
            }
            out[out.length] = { t: "Z", v: o.toLowerCase() };
            lst = o.charAt(1);
          } else if (o.indexOf("$") > -1) {
            o = (o.match(/\$([^-\[\]]*)/) || [])[1] || "$";
            if (!fmt_is_date(fmt)) out[out.length] = { t: "t", v: o };
          }
          break;
        /* Numbers */
        case ".":
          if (dt != null) {
            o = c;
            while (++i < fmt.length && (c = fmt.charAt(i)) === "0") o += c;
            out[out.length] = { t: "s", v: o };
            break;
          }
        /* falls through */
        case "0":
        case "#":
          o = c;
          while (++i < fmt.length && "0#?.,E+-%".indexOf(c = fmt.charAt(i)) > -1) o += c;
          out[out.length] = { t: "n", v: o };
          break;
        case "?":
          o = c;
          while (fmt.charAt(++i) === c) o += c;
          out[out.length] = { t: c, v: o };
          lst = c;
          break;
        case "*":
          ++i;
          if (fmt.charAt(i) == " " || fmt.charAt(i) == "*") ++i;
          break;
        // **
        case "(":
        case ")":
          out[out.length] = { t: flen === 1 ? "t" : c, v: c };
          ++i;
          break;
        case "1":
        case "2":
        case "3":
        case "4":
        case "5":
        case "6":
        case "7":
        case "8":
        case "9":
          o = c;
          while (i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o += fmt.charAt(i);
          out[out.length] = { t: "D", v: o };
          break;
        case " ":
          out[out.length] = { t: c, v: c };
          ++i;
          break;
        case "$":
          out[out.length] = { t: "t", v: "$" };
          ++i;
          break;
        default:
          if (",$-+/():!^&'~{}<>=\u20ACacfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error("unrecognized character " + c + " in " + fmt);
          out[out.length] = { t: "t", v: c };
          ++i;
          break;
      }
    }
    var bt = 0, ss0 = 0, ssm;
    for (i = out.length - 1, lst = "t"; i >= 0; --i) {
      switch (out[i].t) {
        case "h":
        case "H":
          out[i].t = hr;
          lst = "h";
          if (bt < 1) bt = 1;
          break;
        case "s":
          if (ssm = out[i].v.match(/\.0+$/)) ss0 = Math.max(ss0, ssm[0].length - 1);
          if (bt < 3) bt = 3;
        /* falls through */
        case "d":
        case "y":
        case "M":
        case "e":
          lst = out[i].t;
          break;
        case "m":
          if (lst === "s") {
            out[i].t = "M";
            if (bt < 2) bt = 2;
          }
          break;
        case "X":
          break;
        case "Z":
          if (bt < 1 && out[i].v.match(/[Hh]/)) bt = 1;
          if (bt < 2 && out[i].v.match(/[Mm]/)) bt = 2;
          if (bt < 3 && out[i].v.match(/[Ss]/)) bt = 3;
      }
    }
    switch (bt) {
      case 0:
        break;
      case 1:
        if (dt.u >= 0.5) {
          dt.u = 0;
          ++dt.S;
        }
        if (dt.S >= 60) {
          dt.S = 0;
          ++dt.M;
        }
        if (dt.M >= 60) {
          dt.M = 0;
          ++dt.H;
        }
        break;
      case 2:
        if (dt.u >= 0.5) {
          dt.u = 0;
          ++dt.S;
        }
        if (dt.S >= 60) {
          dt.S = 0;
          ++dt.M;
        }
        break;
    }
    var nstr = "", jj;
    for (i = 0; i < out.length; ++i) {
      switch (out[i].t) {
        case "t":
        case "T":
        case " ":
        case "D":
          break;
        case "X":
          out[i].v = "";
          out[i].t = ";";
          break;
        case "d":
        case "m":
        case "y":
        case "h":
        case "H":
        case "M":
        case "s":
        case "e":
        case "b":
        case "Z":
          out[i].v = SSF_write_date(out[i].t.charCodeAt(0), out[i].v, dt, ss0);
          out[i].t = "t";
          break;
        case "n":
        case "?":
          jj = i + 1;
          while (out[jj] != null && ((c = out[jj].t) === "?" || c === "D" || (c === " " || c === "t") && out[jj + 1] != null && (out[jj + 1].t === "?" || out[jj + 1].t === "t" && out[jj + 1].v === "/") || out[i].t === "(" && (c === " " || c === "n" || c === ")") || c === "t" && (out[jj].v === "/" || out[jj].v === " " && out[jj + 1] != null && out[jj + 1].t == "?"))) {
            out[i].v += out[jj].v;
            out[jj] = { v: "", t: ";" };
            ++jj;
          }
          nstr += out[i].v;
          i = jj - 1;
          break;
        case "G":
          out[i].t = "t";
          out[i].v = SSF_general(v, opts);
          break;
      }
    }
    var vv = "", myv, ostr;
    if (nstr.length > 0) {
      if (nstr.charCodeAt(0) == 40) {
        myv = v < 0 && nstr.charCodeAt(0) === 45 ? -v : v;
        ostr = write_num("n", nstr, myv);
      } else {
        myv = v < 0 && flen > 1 ? -v : v;
        ostr = write_num("n", nstr, myv);
        if (myv < 0 && out[0] && out[0].t == "t") {
          ostr = ostr.substr(1);
          out[0].v = "-" + out[0].v;
        }
      }
      jj = ostr.length - 1;
      var decpt = out.length;
      for (i = 0; i < out.length; ++i) if (out[i] != null && out[i].t != "t" && out[i].v.indexOf(".") > -1) {
        decpt = i;
        break;
      }
      var lasti = out.length;
      if (decpt === out.length && ostr.indexOf("E") === -1) {
        for (i = out.length - 1; i >= 0; --i) {
          if (out[i] == null || "n?".indexOf(out[i].t) === -1) continue;
          if (jj >= out[i].v.length - 1) {
            jj -= out[i].v.length;
            out[i].v = ostr.substr(jj + 1, out[i].v.length);
          } else if (jj < 0) out[i].v = "";
          else {
            out[i].v = ostr.substr(0, jj + 1);
            jj = -1;
          }
          out[i].t = "t";
          lasti = i;
        }
        if (jj >= 0 && lasti < out.length) out[lasti].v = ostr.substr(0, jj + 1) + out[lasti].v;
      } else if (decpt !== out.length && ostr.indexOf("E") === -1) {
        jj = ostr.indexOf(".") - 1;
        for (i = decpt; i >= 0; --i) {
          if (out[i] == null || "n?".indexOf(out[i].t) === -1) continue;
          j = out[i].v.indexOf(".") > -1 && i === decpt ? out[i].v.indexOf(".") - 1 : out[i].v.length - 1;
          vv = out[i].v.substr(j + 1);
          for (; j >= 0; --j) {
            if (jj >= 0 && (out[i].v.charAt(j) === "0" || out[i].v.charAt(j) === "#")) vv = ostr.charAt(jj--) + vv;
          }
          out[i].v = vv;
          out[i].t = "t";
          lasti = i;
        }
        if (jj >= 0 && lasti < out.length) out[lasti].v = ostr.substr(0, jj + 1) + out[lasti].v;
        jj = ostr.indexOf(".") + 1;
        for (i = decpt; i < out.length; ++i) {
          if (out[i] == null || "n?(".indexOf(out[i].t) === -1 && i !== decpt) continue;
          j = out[i].v.indexOf(".") > -1 && i === decpt ? out[i].v.indexOf(".") + 1 : 0;
          vv = out[i].v.substr(0, j);
          for (; j < out[i].v.length; ++j) {
            if (jj < ostr.length) vv += ostr.charAt(jj++);
          }
          out[i].v = vv;
          out[i].t = "t";
          lasti = i;
        }
      }
    }
    for (i = 0; i < out.length; ++i) if (out[i] != null && "n?".indexOf(out[i].t) > -1) {
      myv = flen > 1 && v < 0 && i > 0 && out[i - 1].v === "-" ? -v : v;
      out[i].v = write_num(out[i].t, out[i].v, myv);
      out[i].t = "t";
    }
    var retval = "";
    for (i = 0; i !== out.length; ++i) if (out[i] != null) retval += out[i].v;
    return retval;
  }
  var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
  function chkcond(v, rr) {
    if (rr == null) return false;
    var thresh = parseFloat(rr[2]);
    switch (rr[1]) {
      case "=":
        if (v == thresh) return true;
        break;
      case ">":
        if (v > thresh) return true;
        break;
      case "<":
        if (v < thresh) return true;
        break;
      case "<>":
        if (v != thresh) return true;
        break;
      case ">=":
        if (v >= thresh) return true;
        break;
      case "<=":
        if (v <= thresh) return true;
        break;
    }
    return false;
  }
  function choose_fmt(f, v) {
    var fmt = SSF_split_fmt(f);
    var l2 = fmt.length, lat = fmt[l2 - 1].indexOf("@");
    if (l2 < 4 && lat > -1) --l2;
    if (fmt.length > 4) throw new Error("cannot find right format for |" + fmt.join("|") + "|");
    if (typeof v !== "number") return [4, fmt.length === 4 || lat > -1 ? fmt[fmt.length - 1] : "@"];
    switch (fmt.length) {
      case 1:
        fmt = lat > -1 ? ["General", "General", "General", fmt[0]] : [fmt[0], fmt[0], fmt[0], "@"];
        break;
      case 2:
        fmt = lat > -1 ? [fmt[0], fmt[0], fmt[0], fmt[1]] : [fmt[0], fmt[1], fmt[0], "@"];
        break;
      case 3:
        fmt = lat > -1 ? [fmt[0], fmt[1], fmt[0], fmt[2]] : [fmt[0], fmt[1], fmt[2], "@"];
        break;
      case 4:
        break;
    }
    var ff = v > 0 ? fmt[0] : v < 0 ? fmt[1] : fmt[2];
    if (fmt[0].indexOf("[") === -1 && fmt[1].indexOf("[") === -1) return [l2, ff];
    if (fmt[0].match(/\[[=<>]/) != null || fmt[1].match(/\[[=<>]/) != null) {
      var m1 = fmt[0].match(cfregex2);
      var m2 = fmt[1].match(cfregex2);
      return chkcond(v, m1) ? [l2, fmt[0]] : chkcond(v, m2) ? [l2, fmt[1]] : [l2, fmt[m1 != null && m2 != null ? 2 : 1]];
    }
    return [l2, ff];
  }
  function SSF_format(fmt, v, o) {
    if (o == null) o = {};
    var sfmt = "";
    switch (typeof fmt) {
      case "string":
        if (fmt == "m/d/yy" && o.dateNF) sfmt = o.dateNF;
        else sfmt = fmt;
        break;
      case "number":
        if (fmt == 14 && o.dateNF) sfmt = o.dateNF;
        else sfmt = (o.table != null ? o.table : table_fmt)[fmt];
        if (sfmt == null) sfmt = o.table && o.table[SSF_default_map[fmt]] || table_fmt[SSF_default_map[fmt]];
        if (sfmt == null) sfmt = SSF_default_str[fmt] || "General";
        break;
    }
    if (SSF_isgeneral(sfmt, 0)) return SSF_general(v, o);
    if (v instanceof Date) v = datenum_local(v, o.date1904);
    var f = choose_fmt(sfmt, v);
    if (SSF_isgeneral(f[1])) return SSF_general(v, o);
    if (v === true) v = "TRUE";
    else if (v === false) v = "FALSE";
    else if (v === "" || v == null) return "";
    return eval_fmt(f[1], v, o, f[0]);
  }
  function SSF_load(fmt, idx) {
    if (typeof idx != "number") {
      idx = +idx || -1;
      for (var i = 0; i < 392; ++i) {
        if (table_fmt[i] == void 0) {
          if (idx < 0) idx = i;
          continue;
        }
        if (table_fmt[i] == fmt) {
          idx = i;
          break;
        }
      }
      if (idx < 0) idx = 391;
    }
    table_fmt[idx] = fmt;
    return idx;
  }
  function make_ssf() {
    table_fmt = SSF_init_table();
  }
  var SSFImplicit = {
    "5": '"$"#,##0_);\\("$"#,##0\\)',
    "6": '"$"#,##0_);[Red]\\("$"#,##0\\)',
    "7": '"$"#,##0.00_);\\("$"#,##0.00\\)',
    "8": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
    "23": "General",
    "24": "General",
    "25": "General",
    "26": "General",
    "27": "m/d/yy",
    "28": "m/d/yy",
    "29": "m/d/yy",
    "30": "m/d/yy",
    "31": "m/d/yy",
    "32": "h:mm:ss",
    "33": "h:mm:ss",
    "34": "h:mm:ss",
    "35": "h:mm:ss",
    "36": "m/d/yy",
    "41": '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',
    "42": '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',
    "43": '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',
    "44": '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',
    "50": "m/d/yy",
    "51": "m/d/yy",
    "52": "m/d/yy",
    "53": "m/d/yy",
    "54": "m/d/yy",
    "55": "m/d/yy",
    "56": "m/d/yy",
    "57": "m/d/yy",
    "58": "m/d/yy",
    "59": "0",
    "60": "0.00",
    "61": "#,##0",
    "62": "#,##0.00",
    "63": '"$"#,##0_);\\("$"#,##0\\)',
    "64": '"$"#,##0_);[Red]\\("$"#,##0\\)',
    "65": '"$"#,##0.00_);\\("$"#,##0.00\\)',
    "66": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
    "67": "0%",
    "68": "0.00%",
    "69": "# ?/?",
    "70": "# ??/??",
    "71": "m/d/yy",
    "72": "m/d/yy",
    "73": "d-mmm-yy",
    "74": "d-mmm",
    "75": "mmm-yy",
    "76": "h:mm",
    "77": "h:mm:ss",
    "78": "m/d/yy h:mm",
    "79": "mm:ss",
    "80": "[h]:mm:ss",
    "81": "mmss.0"
  };
  var dateNFregex = /[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;
  function dateNF_regex(dateNF) {
    var fmt = typeof dateNF == "number" ? table_fmt[dateNF] : dateNF;
    fmt = fmt.replace(dateNFregex, "(\\d+)");
    return new RegExp("^" + fmt + "$");
  }
  function dateNF_fix(str, dateNF, match) {
    var Y = -1, m = -1, d = -1, H = -1, M = -1, S = -1;
    (dateNF.match(dateNFregex) || []).forEach(function(n, i) {
      var v = parseInt(match[i + 1], 10);
      switch (n.toLowerCase().charAt(0)) {
        case "y":
          Y = v;
          break;
        case "d":
          d = v;
          break;
        case "h":
          H = v;
          break;
        case "s":
          S = v;
          break;
        case "m":
          if (H >= 0) M = v;
          else m = v;
          break;
      }
    });
    if (S >= 0 && M == -1 && m >= 0) {
      M = m;
      m = -1;
    }
    var datestr = ("" + (Y >= 0 ? Y : (/* @__PURE__ */ new Date()).getFullYear())).slice(-4) + "-" + ("00" + (m >= 1 ? m : 1)).slice(-2) + "-" + ("00" + (d >= 1 ? d : 1)).slice(-2);
    if (datestr.length == 7) datestr = "0" + datestr;
    if (datestr.length == 8) datestr = "20" + datestr;
    var timestr = ("00" + (H >= 0 ? H : 0)).slice(-2) + ":" + ("00" + (M >= 0 ? M : 0)).slice(-2) + ":" + ("00" + (S >= 0 ? S : 0)).slice(-2);
    if (H == -1 && M == -1 && S == -1) return datestr;
    if (Y == -1 && m == -1 && d == -1) return timestr;
    return datestr + "T" + timestr;
  }
  var CRC32 = /* @__PURE__ */ (function() {
    var CRC322 = {};
    CRC322.version = "1.2.0";
    function signed_crc_table() {
      var c = 0, table = new Array(256);
      for (var n = 0; n != 256; ++n) {
        c = n;
        c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
        c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
        c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
        c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
        c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
        c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
        c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
        c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
        table[n] = c;
      }
      return typeof Int32Array !== "undefined" ? new Int32Array(table) : table;
    }
    var T0 = signed_crc_table();
    function slice_by_16_tables(T) {
      var c = 0, v = 0, n = 0, table = typeof Int32Array !== "undefined" ? new Int32Array(4096) : new Array(4096);
      for (n = 0; n != 256; ++n) table[n] = T[n];
      for (n = 0; n != 256; ++n) {
        v = T[n];
        for (c = 256 + n; c < 4096; c += 256) v = table[c] = v >>> 8 ^ T[v & 255];
      }
      var out = [];
      for (n = 1; n != 16; ++n) out[n - 1] = typeof Int32Array !== "undefined" ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256);
      return out;
    }
    var TT = slice_by_16_tables(T0);
    var T1 = TT[0], T2 = TT[1], T3 = TT[2], T4 = TT[3], T5 = TT[4];
    var T6 = TT[5], T7 = TT[6], T8 = TT[7], T9 = TT[8], Ta = TT[9];
    var Tb = TT[10], Tc = TT[11], Td = TT[12], Te = TT[13], Tf = TT[14];
    function crc32_bstr(bstr, seed) {
      var C = seed ^ -1;
      for (var i = 0, L = bstr.length; i < L; ) C = C >>> 8 ^ T0[(C ^ bstr.charCodeAt(i++)) & 255];
      return ~C;
    }
    function crc32_buf(B, seed) {
      var C = seed ^ -1, L = B.length - 15, i = 0;
      for (; i < L; ) C = Tf[B[i++] ^ C & 255] ^ Te[B[i++] ^ C >> 8 & 255] ^ Td[B[i++] ^ C >> 16 & 255] ^ Tc[B[i++] ^ C >>> 24] ^ Tb[B[i++]] ^ Ta[B[i++]] ^ T9[B[i++]] ^ T8[B[i++]] ^ T7[B[i++]] ^ T6[B[i++]] ^ T5[B[i++]] ^ T4[B[i++]] ^ T3[B[i++]] ^ T2[B[i++]] ^ T1[B[i++]] ^ T0[B[i++]];
      L += 15;
      while (i < L) C = C >>> 8 ^ T0[(C ^ B[i++]) & 255];
      return ~C;
    }
    function crc32_str(str, seed) {
      var C = seed ^ -1;
      for (var i = 0, L = str.length, c = 0, d = 0; i < L; ) {
        c = str.charCodeAt(i++);
        if (c < 128) {
          C = C >>> 8 ^ T0[(C ^ c) & 255];
        } else if (c < 2048) {
          C = C >>> 8 ^ T0[(C ^ (192 | c >> 6 & 31)) & 255];
          C = C >>> 8 ^ T0[(C ^ (128 | c & 63)) & 255];
        } else if (c >= 55296 && c < 57344) {
          c = (c & 1023) + 64;
          d = str.charCodeAt(i++) & 1023;
          C = C >>> 8 ^ T0[(C ^ (240 | c >> 8 & 7)) & 255];
          C = C >>> 8 ^ T0[(C ^ (128 | c >> 2 & 63)) & 255];
          C = C >>> 8 ^ T0[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255];
          C = C >>> 8 ^ T0[(C ^ (128 | d & 63)) & 255];
        } else {
          C = C >>> 8 ^ T0[(C ^ (224 | c >> 12 & 15)) & 255];
          C = C >>> 8 ^ T0[(C ^ (128 | c >> 6 & 63)) & 255];
          C = C >>> 8 ^ T0[(C ^ (128 | c & 63)) & 255];
        }
      }
      return ~C;
    }
    CRC322.table = T0;
    CRC322.bstr = crc32_bstr;
    CRC322.buf = crc32_buf;
    CRC322.str = crc32_str;
    return CRC322;
  })();
  var CFB = /* @__PURE__ */ (function _CFB() {
    var exports2 = {};
    exports2.version = "1.2.1";
    function namecmp(l2, r) {
      var L = l2.split("/"), R = r.split("/");
      for (var i2 = 0, c = 0, Z = Math.min(L.length, R.length); i2 < Z; ++i2) {
        if (c = L[i2].length - R[i2].length) return c;
        if (L[i2] != R[i2]) return L[i2] < R[i2] ? -1 : 1;
      }
      return L.length - R.length;
    }
    function dirname(p) {
      if (p.charAt(p.length - 1) == "/") return p.slice(0, -1).indexOf("/") === -1 ? p : dirname(p.slice(0, -1));
      var c = p.lastIndexOf("/");
      return c === -1 ? p : p.slice(0, c + 1);
    }
    function filename(p) {
      if (p.charAt(p.length - 1) == "/") return filename(p.slice(0, -1));
      var c = p.lastIndexOf("/");
      return c === -1 ? p : p.slice(c + 1);
    }
    function write_dos_date(buf, date) {
      if (typeof date === "string") date = new Date(date);
      var hms = date.getHours();
      hms = hms << 6 | date.getMinutes();
      hms = hms << 5 | date.getSeconds() >>> 1;
      buf.write_shift(2, hms);
      var ymd = date.getFullYear() - 1980;
      ymd = ymd << 4 | date.getMonth() + 1;
      ymd = ymd << 5 | date.getDate();
      buf.write_shift(2, ymd);
    }
    function parse_dos_date(buf) {
      var hms = buf.read_shift(2) & 65535;
      var ymd = buf.read_shift(2) & 65535;
      var val = /* @__PURE__ */ new Date();
      var d = ymd & 31;
      ymd >>>= 5;
      var m = ymd & 15;
      ymd >>>= 4;
      val.setMilliseconds(0);
      val.setFullYear(ymd + 1980);
      val.setMonth(m - 1);
      val.setDate(d);
      var S = hms & 31;
      hms >>>= 5;
      var M = hms & 63;
      hms >>>= 6;
      val.setHours(hms);
      val.setMinutes(M);
      val.setSeconds(S << 1);
      return val;
    }
    function parse_extra_field(blob) {
      prep_blob(blob, 0);
      var o = (
        /*::(*/
        {}
      );
      var flags = 0;
      while (blob.l <= blob.length - 4) {
        var type = blob.read_shift(2);
        var sz = blob.read_shift(2), tgt = blob.l + sz;
        var p = {};
        switch (type) {
          /* UNIX-style Timestamps */
          case 21589:
            {
              flags = blob.read_shift(1);
              if (flags & 1) p.mtime = blob.read_shift(4);
              if (sz > 5) {
                if (flags & 2) p.atime = blob.read_shift(4);
                if (flags & 4) p.ctime = blob.read_shift(4);
              }
              if (p.mtime) p.mt = new Date(p.mtime * 1e3);
            }
            break;
        }
        blob.l = tgt;
        o[type] = p;
      }
      return o;
    }
    var fs;
    function get_fs() {
      return fs || (fs = {});
    }
    function parse(file, options) {
      if (file[0] == 80 && file[1] == 75) return parse_zip2(file, options);
      if ((file[0] | 32) == 109 && (file[1] | 32) == 105) return parse_mad(file, options);
      if (file.length < 512) throw new Error("CFB file size " + file.length + " < 512");
      var mver = 3;
      var ssz = 512;
      var nmfs = 0;
      var difat_sec_cnt = 0;
      var dir_start = 0;
      var minifat_start = 0;
      var difat_start = 0;
      var fat_addrs = [];
      var blob = (
        /*::(*/
        file.slice(0, 512)
      );
      prep_blob(blob, 0);
      var mv = check_get_mver(blob);
      mver = mv[0];
      switch (mver) {
        case 3:
          ssz = 512;
          break;
        case 4:
          ssz = 4096;
          break;
        case 0:
          if (mv[1] == 0) return parse_zip2(file, options);
        /* falls through */
        default:
          throw new Error("Major Version: Expected 3 or 4 saw " + mver);
      }
      if (ssz !== 512) {
        blob = /*::(*/
        file.slice(0, ssz);
        prep_blob(
          blob,
          28
          /* blob.l */
        );
      }
      var header = file.slice(0, ssz);
      check_shifts(blob, mver);
      var dir_cnt = blob.read_shift(4, "i");
      if (mver === 3 && dir_cnt !== 0) throw new Error("# Directory Sectors: Expected 0 saw " + dir_cnt);
      blob.l += 4;
      dir_start = blob.read_shift(4, "i");
      blob.l += 4;
      blob.chk("00100000", "Mini Stream Cutoff Size: ");
      minifat_start = blob.read_shift(4, "i");
      nmfs = blob.read_shift(4, "i");
      difat_start = blob.read_shift(4, "i");
      difat_sec_cnt = blob.read_shift(4, "i");
      for (var q2 = -1, j = 0; j < 109; ++j) {
        q2 = blob.read_shift(4, "i");
        if (q2 < 0) break;
        fat_addrs[j] = q2;
      }
      var sectors = sectorify(file, ssz);
      sleuth_fat(difat_start, difat_sec_cnt, sectors, ssz, fat_addrs);
      var sector_list = make_sector_list(sectors, dir_start, fat_addrs, ssz);
      sector_list[dir_start].name = "!Directory";
      if (nmfs > 0 && minifat_start !== ENDOFCHAIN) sector_list[minifat_start].name = "!MiniFAT";
      sector_list[fat_addrs[0]].name = "!FAT";
      sector_list.fat_addrs = fat_addrs;
      sector_list.ssz = ssz;
      var files = {}, Paths = [], FileIndex = [], FullPaths = [];
      read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start);
      build_full_paths(FileIndex, FullPaths, Paths);
      Paths.shift();
      var o = {
        FileIndex,
        FullPaths
      };
      if (options && options.raw) o.raw = { header, sectors };
      return o;
    }
    function check_get_mver(blob) {
      if (blob[blob.l] == 80 && blob[blob.l + 1] == 75) return [0, 0];
      blob.chk(HEADER_SIGNATURE, "Header Signature: ");
      blob.l += 16;
      var mver = blob.read_shift(2, "u");
      return [blob.read_shift(2, "u"), mver];
    }
    function check_shifts(blob, mver) {
      var shift = 9;
      blob.l += 2;
      switch (shift = blob.read_shift(2)) {
        case 9:
          if (mver != 3) throw new Error("Sector Shift: Expected 9 saw " + shift);
          break;
        case 12:
          if (mver != 4) throw new Error("Sector Shift: Expected 12 saw " + shift);
          break;
        default:
          throw new Error("Sector Shift: Expected 9 or 12 saw " + shift);
      }
      blob.chk("0600", "Mini Sector Shift: ");
      blob.chk("000000000000", "Reserved: ");
    }
    function sectorify(file, ssz) {
      var nsectors = Math.ceil(file.length / ssz) - 1;
      var sectors = [];
      for (var i2 = 1; i2 < nsectors; ++i2) sectors[i2 - 1] = file.slice(i2 * ssz, (i2 + 1) * ssz);
      sectors[nsectors - 1] = file.slice(nsectors * ssz);
      return sectors;
    }
    function build_full_paths(FI, FP, Paths) {
      var i2 = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length;
      var dad = [], q2 = [];
      for (; i2 < pl; ++i2) {
        dad[i2] = q2[i2] = i2;
        FP[i2] = Paths[i2];
      }
      for (; j < q2.length; ++j) {
        i2 = q2[j];
        L = FI[i2].L;
        R = FI[i2].R;
        C = FI[i2].C;
        if (dad[i2] === i2) {
          if (L !== -1 && dad[L] !== L) dad[i2] = dad[L];
          if (R !== -1 && dad[R] !== R) dad[i2] = dad[R];
        }
        if (C !== -1) dad[C] = i2;
        if (L !== -1 && i2 != dad[i2]) {
          dad[L] = dad[i2];
          if (q2.lastIndexOf(L) < j) q2.push(L);
        }
        if (R !== -1 && i2 != dad[i2]) {
          dad[R] = dad[i2];
          if (q2.lastIndexOf(R) < j) q2.push(R);
        }
      }
      for (i2 = 1; i2 < pl; ++i2) if (dad[i2] === i2) {
        if (R !== -1 && dad[R] !== R) dad[i2] = dad[R];
        else if (L !== -1 && dad[L] !== L) dad[i2] = dad[L];
      }
      for (i2 = 1; i2 < pl; ++i2) {
        if (FI[i2].type === 0) continue;
        j = i2;
        if (j != dad[j]) do {
          j = dad[j];
          FP[i2] = FP[j] + "/" + FP[i2];
        } while (j !== 0 && -1 !== dad[j] && j != dad[j]);
        dad[i2] = -1;
      }
      FP[0] += "/";
      for (i2 = 1; i2 < pl; ++i2) {
        if (FI[i2].type !== 2) FP[i2] += "/";
      }
    }
    function get_mfat_entry(entry, payload, mini) {
      var start = entry.start, size2 = entry.size;
      var o = [];
      var idx = start;
      while (mini && size2 > 0 && idx >= 0) {
        o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
        size2 -= MSSZ;
        idx = __readInt32LE(mini, idx * 4);
      }
      if (o.length === 0) return new_buf(0);
      return bconcat(o).slice(0, entry.size);
    }
    function sleuth_fat(idx, cnt, sectors, ssz, fat_addrs) {
      var q2 = ENDOFCHAIN;
      if (idx === ENDOFCHAIN) {
        if (cnt !== 0) throw new Error("DIFAT chain shorter than expected");
      } else if (idx !== -1) {
        var sector = sectors[idx], m = (ssz >>> 2) - 1;
        if (!sector) return;
        for (var i2 = 0; i2 < m; ++i2) {
          if ((q2 = __readInt32LE(sector, i2 * 4)) === ENDOFCHAIN) break;
          fat_addrs.push(q2);
        }
        sleuth_fat(__readInt32LE(sector, ssz - 4), cnt - 1, sectors, ssz, fat_addrs);
      }
    }
    function get_sector_list(sectors, start, fat_addrs, ssz, chkd) {
      var buf = [], buf_chain = [];
      if (!chkd) chkd = [];
      var modulus = ssz - 1, j = 0, jj = 0;
      for (j = start; j >= 0; ) {
        chkd[j] = true;
        buf[buf.length] = j;
        buf_chain.push(sectors[j]);
        var addr = fat_addrs[Math.floor(j * 4 / ssz)];
        jj = j * 4 & modulus;
        if (ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 " + ssz);
        if (!sectors[addr]) break;
        j = __readInt32LE(sectors[addr], jj);
      }
      return { nodes: buf, data: __toBuffer([buf_chain]) };
    }
    function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
      var sl = sectors.length, sector_list = [];
      var chkd = [], buf = [], buf_chain = [];
      var modulus = ssz - 1, i2 = 0, j = 0, k = 0, jj = 0;
      for (i2 = 0; i2 < sl; ++i2) {
        buf = [];
        k = i2 + dir_start;
        if (k >= sl) k -= sl;
        if (chkd[k]) continue;
        buf_chain = [];
        var seen = [];
        for (j = k; j >= 0; ) {
          seen[j] = true;
          chkd[j] = true;
          buf[buf.length] = j;
          buf_chain.push(sectors[j]);
          var addr = fat_addrs[Math.floor(j * 4 / ssz)];
          jj = j * 4 & modulus;
          if (ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 " + ssz);
          if (!sectors[addr]) break;
          j = __readInt32LE(sectors[addr], jj);
          if (seen[j]) break;
        }
        sector_list[k] = { nodes: buf, data: __toBuffer([buf_chain]) };
      }
      return sector_list;
    }
    function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, mini) {
      var minifat_store = 0, pl = Paths.length ? 2 : 0;
      var sector = sector_list[dir_start].data;
      var i2 = 0, namelen = 0, name;
      for (; i2 < sector.length; i2 += 128) {
        var blob = (
          /*::(*/
          sector.slice(i2, i2 + 128)
        );
        prep_blob(blob, 64);
        namelen = blob.read_shift(2);
        name = __utf16le(blob, 0, namelen - pl);
        Paths.push(name);
        var o = {
          name,
          type: blob.read_shift(1),
          color: blob.read_shift(1),
          L: blob.read_shift(4, "i"),
          R: blob.read_shift(4, "i"),
          C: blob.read_shift(4, "i"),
          clsid: blob.read_shift(16),
          state: blob.read_shift(4, "i"),
          start: 0,
          size: 0
        };
        var ctime = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2);
        if (ctime !== 0) o.ct = read_date(blob, blob.l - 8);
        var mtime = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2);
        if (mtime !== 0) o.mt = read_date(blob, blob.l - 8);
        o.start = blob.read_shift(4, "i");
        o.size = blob.read_shift(4, "i");
        if (o.size < 0 && o.start < 0) {
          o.size = o.type = 0;
          o.start = ENDOFCHAIN;
          o.name = "";
        }
        if (o.type === 5) {
          minifat_store = o.start;
          if (nmfs > 0 && minifat_store !== ENDOFCHAIN) sector_list[minifat_store].name = "!StreamData";
        } else if (o.size >= 4096) {
          o.storage = "fat";
          if (sector_list[o.start] === void 0) sector_list[o.start] = get_sector_list(sectors, o.start, sector_list.fat_addrs, sector_list.ssz);
          sector_list[o.start].name = o.name;
          o.content = sector_list[o.start].data.slice(0, o.size);
        } else {
          o.storage = "minifat";
          if (o.size < 0) o.size = 0;
          else if (minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
            o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini] || {}).data);
          }
        }
        if (o.content) prep_blob(o.content, 0);
        files[name] = o;
        FileIndex.push(o);
      }
    }
    function read_date(blob, offset) {
      return new Date((__readUInt32LE(blob, offset + 4) / 1e7 * Math.pow(2, 32) + __readUInt32LE(blob, offset) / 1e7 - 11644473600) * 1e3);
    }
    function read_file(filename2, options) {
      get_fs();
      return parse(fs.readFileSync(filename2), options);
    }
    function read(blob, options) {
      var type = options && options.type;
      if (!type) {
        if (has_buf && Buffer.isBuffer(blob)) type = "buffer";
      }
      switch (type || "base64") {
        case "file":
          return read_file(blob, options);
        case "base64":
          return parse(s2a(Base64_decode(blob)), options);
        case "binary":
          return parse(s2a(blob), options);
      }
      return parse(
        /*::typeof blob == 'string' ? new Buffer(blob, 'utf-8') : */
        blob,
        options
      );
    }
    function init_cfb(cfb, opts) {
      var o = opts || {}, root3 = o.root || "Root Entry";
      if (!cfb.FullPaths) cfb.FullPaths = [];
      if (!cfb.FileIndex) cfb.FileIndex = [];
      if (cfb.FullPaths.length !== cfb.FileIndex.length) throw new Error("inconsistent CFB structure");
      if (cfb.FullPaths.length === 0) {
        cfb.FullPaths[0] = root3 + "/";
        cfb.FileIndex[0] = { name: root3, type: 5 };
      }
      if (o.CLSID) cfb.FileIndex[0].clsid = o.CLSID;
      seed_cfb(cfb);
    }
    function seed_cfb(cfb) {
      var nm = "Sh33tJ5";
      if (CFB.find(cfb, "/" + nm)) return;
      var p = new_buf(4);
      p[0] = 55;
      p[1] = p[3] = 50;
      p[2] = 54;
      cfb.FileIndex.push({ name: nm, type: 2, content: p, size: 4, L: 69, R: 69, C: 69 });
      cfb.FullPaths.push(cfb.FullPaths[0] + nm);
      rebuild_cfb(cfb);
    }
    function rebuild_cfb(cfb, f) {
      init_cfb(cfb);
      var gc = false, s = false;
      for (var i2 = cfb.FullPaths.length - 1; i2 >= 0; --i2) {
        var _file = cfb.FileIndex[i2];
        switch (_file.type) {
          case 0:
            if (s) gc = true;
            else {
              cfb.FileIndex.pop();
              cfb.FullPaths.pop();
            }
            break;
          case 1:
          case 2:
          case 5:
            s = true;
            if (isNaN(_file.R * _file.L * _file.C)) gc = true;
            if (_file.R > -1 && _file.L > -1 && _file.R == _file.L) gc = true;
            break;
          default:
            gc = true;
            break;
        }
      }
      if (!gc && !f) return;
      var now = new Date(1987, 1, 19), j = 0;
      var fullPaths = Object.create ? /* @__PURE__ */ Object.create(null) : {};
      var data = [];
      for (i2 = 0; i2 < cfb.FullPaths.length; ++i2) {
        fullPaths[cfb.FullPaths[i2]] = true;
        if (cfb.FileIndex[i2].type === 0) continue;
        data.push([cfb.FullPaths[i2], cfb.FileIndex[i2]]);
      }
      for (i2 = 0; i2 < data.length; ++i2) {
        var dad = dirname(data[i2][0]);
        s = fullPaths[dad];
        if (!s) {
          data.push([dad, {
            name: filename(dad).replace("/", ""),
            type: 1,
            clsid: HEADER_CLSID,
            ct: now,
            mt: now,
            content: null
          }]);
          fullPaths[dad] = true;
        }
      }
      data.sort(function(x, y) {
        return namecmp(x[0], y[0]);
      });
      cfb.FullPaths = [];
      cfb.FileIndex = [];
      for (i2 = 0; i2 < data.length; ++i2) {
        cfb.FullPaths[i2] = data[i2][0];
        cfb.FileIndex[i2] = data[i2][1];
      }
      for (i2 = 0; i2 < data.length; ++i2) {
        var elt = cfb.FileIndex[i2];
        var nm = cfb.FullPaths[i2];
        elt.name = filename(nm).replace("/", "");
        elt.L = elt.R = elt.C = -(elt.color = 1);
        elt.size = elt.content ? elt.content.length : 0;
        elt.start = 0;
        elt.clsid = elt.clsid || HEADER_CLSID;
        if (i2 === 0) {
          elt.C = data.length > 1 ? 1 : -1;
          elt.size = 0;
          elt.type = 5;
        } else if (nm.slice(-1) == "/") {
          for (j = i2 + 1; j < data.length; ++j) if (dirname(cfb.FullPaths[j]) == nm) break;
          elt.C = j >= data.length ? -1 : j;
          for (j = i2 + 1; j < data.length; ++j) if (dirname(cfb.FullPaths[j]) == dirname(nm)) break;
          elt.R = j >= data.length ? -1 : j;
          elt.type = 1;
        } else {
          if (dirname(cfb.FullPaths[i2 + 1] || "") == dirname(nm)) elt.R = i2 + 1;
          elt.type = 2;
        }
      }
    }
    function _write(cfb, options) {
      var _opts = options || {};
      if (_opts.fileType == "mad") return write_mad(cfb, _opts);
      rebuild_cfb(cfb);
      switch (_opts.fileType) {
        case "zip":
          return write_zip(cfb, _opts);
      }
      var L = (function(cfb2) {
        var mini_size = 0, fat_size = 0;
        for (var i3 = 0; i3 < cfb2.FileIndex.length; ++i3) {
          var file2 = cfb2.FileIndex[i3];
          if (!file2.content) continue;
          var flen2 = file2.content.length;
          if (flen2 > 0) {
            if (flen2 < 4096) mini_size += flen2 + 63 >> 6;
            else fat_size += flen2 + 511 >> 9;
          }
        }
        var dir_cnt = cfb2.FullPaths.length + 3 >> 2;
        var mini_cnt = mini_size + 7 >> 3;
        var mfat_cnt = mini_size + 127 >> 7;
        var fat_base = mini_cnt + fat_size + dir_cnt + mfat_cnt;
        var fat_cnt = fat_base + 127 >> 7;
        var difat_cnt = fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt - 109) / 127);
        while (fat_base + fat_cnt + difat_cnt + 127 >> 7 > fat_cnt) difat_cnt = ++fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt - 109) / 127);
        var L2 = [1, difat_cnt, fat_cnt, mfat_cnt, dir_cnt, fat_size, mini_size, 0];
        cfb2.FileIndex[0].size = mini_size << 6;
        L2[7] = (cfb2.FileIndex[0].start = L2[0] + L2[1] + L2[2] + L2[3] + L2[4] + L2[5]) + (L2[6] + 7 >> 3);
        return L2;
      })(cfb);
      var o = new_buf(L[7] << 9);
      var i2 = 0, T = 0;
      {
        for (i2 = 0; i2 < 8; ++i2) o.write_shift(1, HEADER_SIG[i2]);
        for (i2 = 0; i2 < 8; ++i2) o.write_shift(2, 0);
        o.write_shift(2, 62);
        o.write_shift(2, 3);
        o.write_shift(2, 65534);
        o.write_shift(2, 9);
        o.write_shift(2, 6);
        for (i2 = 0; i2 < 3; ++i2) o.write_shift(2, 0);
        o.write_shift(4, 0);
        o.write_shift(4, L[2]);
        o.write_shift(4, L[0] + L[1] + L[2] + L[3] - 1);
        o.write_shift(4, 0);
        o.write_shift(4, 1 << 12);
        o.write_shift(4, L[3] ? L[0] + L[1] + L[2] - 1 : ENDOFCHAIN);
        o.write_shift(4, L[3]);
        o.write_shift(-4, L[1] ? L[0] - 1 : ENDOFCHAIN);
        o.write_shift(4, L[1]);
        for (i2 = 0; i2 < 109; ++i2) o.write_shift(-4, i2 < L[2] ? L[1] + i2 : -1);
      }
      if (L[1]) {
        for (T = 0; T < L[1]; ++T) {
          for (; i2 < 236 + T * 127; ++i2) o.write_shift(-4, i2 < L[2] ? L[1] + i2 : -1);
          o.write_shift(-4, T === L[1] - 1 ? ENDOFCHAIN : T + 1);
        }
      }
      var chainit = function(w) {
        for (T += w; i2 < T - 1; ++i2) o.write_shift(-4, i2 + 1);
        if (w) {
          ++i2;
          o.write_shift(-4, ENDOFCHAIN);
        }
      };
      T = i2 = 0;
      for (T += L[1]; i2 < T; ++i2) o.write_shift(-4, consts.DIFSECT);
      for (T += L[2]; i2 < T; ++i2) o.write_shift(-4, consts.FATSECT);
      chainit(L[3]);
      chainit(L[4]);
      var j = 0, flen = 0;
      var file = cfb.FileIndex[0];
      for (; j < cfb.FileIndex.length; ++j) {
        file = cfb.FileIndex[j];
        if (!file.content) continue;
        flen = file.content.length;
        if (flen < 4096) continue;
        file.start = T;
        chainit(flen + 511 >> 9);
      }
      chainit(L[6] + 7 >> 3);
      while (o.l & 511) o.write_shift(-4, consts.ENDOFCHAIN);
      T = i2 = 0;
      for (j = 0; j < cfb.FileIndex.length; ++j) {
        file = cfb.FileIndex[j];
        if (!file.content) continue;
        flen = file.content.length;
        if (!flen || flen >= 4096) continue;
        file.start = T;
        chainit(flen + 63 >> 6);
      }
      while (o.l & 511) o.write_shift(-4, consts.ENDOFCHAIN);
      for (i2 = 0; i2 < L[4] << 2; ++i2) {
        var nm = cfb.FullPaths[i2];
        if (!nm || nm.length === 0) {
          for (j = 0; j < 17; ++j) o.write_shift(4, 0);
          for (j = 0; j < 3; ++j) o.write_shift(4, -1);
          for (j = 0; j < 12; ++j) o.write_shift(4, 0);
          continue;
        }
        file = cfb.FileIndex[i2];
        if (i2 === 0) file.start = file.size ? file.start - 1 : ENDOFCHAIN;
        var _nm = i2 === 0 && _opts.root || file.name;
        flen = 2 * (_nm.length + 1);
        o.write_shift(64, _nm, "utf16le");
        o.write_shift(2, flen);
        o.write_shift(1, file.type);
        o.write_shift(1, file.color);
        o.write_shift(-4, file.L);
        o.write_shift(-4, file.R);
        o.write_shift(-4, file.C);
        if (!file.clsid) for (j = 0; j < 4; ++j) o.write_shift(4, 0);
        else o.write_shift(16, file.clsid, "hex");
        o.write_shift(4, file.state || 0);
        o.write_shift(4, 0);
        o.write_shift(4, 0);
        o.write_shift(4, 0);
        o.write_shift(4, 0);
        o.write_shift(4, file.start);
        o.write_shift(4, file.size);
        o.write_shift(4, 0);
      }
      for (i2 = 1; i2 < cfb.FileIndex.length; ++i2) {
        file = cfb.FileIndex[i2];
        if (file.size >= 4096) {
          o.l = file.start + 1 << 9;
          if (has_buf && Buffer.isBuffer(file.content)) {
            file.content.copy(o, o.l, 0, file.size);
            o.l += file.size + 511 & -512;
          } else {
            for (j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]);
            for (; j & 511; ++j) o.write_shift(1, 0);
          }
        }
      }
      for (i2 = 1; i2 < cfb.FileIndex.length; ++i2) {
        file = cfb.FileIndex[i2];
        if (file.size > 0 && file.size < 4096) {
          if (has_buf && Buffer.isBuffer(file.content)) {
            file.content.copy(o, o.l, 0, file.size);
            o.l += file.size + 63 & -64;
          } else {
            for (j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]);
            for (; j & 63; ++j) o.write_shift(1, 0);
          }
        }
      }
      if (has_buf) {
        o.l = o.length;
      } else {
        while (o.l < o.length) o.write_shift(1, 0);
      }
      return o;
    }
    function find2(cfb, path) {
      var UCFullPaths = cfb.FullPaths.map(function(x) {
        return x.toUpperCase();
      });
      var UCPaths = UCFullPaths.map(function(x) {
        var y = x.split("/");
        return y[y.length - (x.slice(-1) == "/" ? 2 : 1)];
      });
      var k = false;
      if (path.charCodeAt(0) === 47) {
        k = true;
        path = UCFullPaths[0].slice(0, -1) + path;
      } else k = path.indexOf("/") !== -1;
      var UCPath = path.toUpperCase();
      var w = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath);
      if (w !== -1) return cfb.FileIndex[w];
      var m = !UCPath.match(chr1);
      UCPath = UCPath.replace(chr0, "");
      if (m) UCPath = UCPath.replace(chr1, "!");
      for (w = 0; w < UCFullPaths.length; ++w) {
        if ((m ? UCFullPaths[w].replace(chr1, "!") : UCFullPaths[w]).replace(chr0, "") == UCPath) return cfb.FileIndex[w];
        if ((m ? UCPaths[w].replace(chr1, "!") : UCPaths[w]).replace(chr0, "") == UCPath) return cfb.FileIndex[w];
      }
      return null;
    }
    var MSSZ = 64;
    var ENDOFCHAIN = -2;
    var HEADER_SIGNATURE = "d0cf11e0a1b11ae1";
    var HEADER_SIG = [208, 207, 17, 224, 161, 177, 26, 225];
    var HEADER_CLSID = "00000000000000000000000000000000";
    var consts = {
      /* 2.1 Compund File Sector Numbers and Types */
      MAXREGSECT: -6,
      DIFSECT: -4,
      FATSECT: -3,
      ENDOFCHAIN,
      FREESECT: -1,
      /* 2.2 Compound File Header */
      HEADER_SIGNATURE,
      HEADER_MINOR_VERSION: "3e00",
      MAXREGSID: -6,
      NOSTREAM: -1,
      HEADER_CLSID,
      /* 2.6.1 Compound File Directory Entry */
      EntryTypes: ["unknown", "storage", "stream", "lockbytes", "property", "root"]
    };
    function write_file(cfb, filename2, options) {
      get_fs();
      var o = _write(cfb, options);
      fs.writeFileSync(filename2, o);
    }
    function a2s2(o) {
      var out = new Array(o.length);
      for (var i2 = 0; i2 < o.length; ++i2) out[i2] = String.fromCharCode(o[i2]);
      return out.join("");
    }
    function write(cfb, options) {
      var o = _write(cfb, options);
      switch (options && options.type || "buffer") {
        case "file":
          get_fs();
          fs.writeFileSync(options.filename, o);
          return o;
        case "binary":
          return typeof o == "string" ? o : a2s2(o);
        case "base64":
          return Base64_encode(typeof o == "string" ? o : a2s2(o));
        case "buffer":
          if (has_buf) return Buffer.isBuffer(o) ? o : Buffer_from(o);
        /* falls through */
        case "array":
          return typeof o == "string" ? s2a(o) : o;
      }
      return o;
    }
    var _zlib;
    function use_zlib(zlib) {
      try {
        var InflateRaw = zlib.InflateRaw;
        var InflRaw = new InflateRaw();
        InflRaw._processChunk(new Uint8Array([3, 0]), InflRaw._finishFlushFlag);
        if (InflRaw.bytesRead) _zlib = zlib;
        else throw new Error("zlib does not expose bytesRead");
      } catch (e) {
        console.error("cannot use native zlib: " + (e.message || e));
      }
    }
    function _inflateRawSync(payload, usz) {
      if (!_zlib) return _inflate(payload, usz);
      var InflateRaw = _zlib.InflateRaw;
      var InflRaw = new InflateRaw();
      var out = InflRaw._processChunk(payload.slice(payload.l), InflRaw._finishFlushFlag);
      payload.l += InflRaw.bytesRead;
      return out;
    }
    function _deflateRawSync(payload) {
      return _zlib ? _zlib.deflateRawSync(payload) : _deflate(payload);
    }
    var CLEN_ORDER = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
    var LEN_LN = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258];
    var DST_LN = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577];
    function bit_swap_8(n) {
      var t = (n << 1 | n << 11) & 139536 | (n << 5 | n << 15) & 558144;
      return (t >> 16 | t >> 8 | t) & 255;
    }
    var use_typed_arrays = typeof Uint8Array !== "undefined";
    var bitswap8 = use_typed_arrays ? new Uint8Array(1 << 8) : [];
    for (var q = 0; q < 1 << 8; ++q) bitswap8[q] = bit_swap_8(q);
    function bit_swap_n(n, b) {
      var rev = bitswap8[n & 255];
      if (b <= 8) return rev >>> 8 - b;
      rev = rev << 8 | bitswap8[n >> 8 & 255];
      if (b <= 16) return rev >>> 16 - b;
      rev = rev << 8 | bitswap8[n >> 16 & 255];
      return rev >>> 24 - b;
    }
    function read_bits_2(buf, bl) {
      var w = bl & 7, h = bl >>> 3;
      return (buf[h] | (w <= 6 ? 0 : buf[h + 1] << 8)) >>> w & 3;
    }
    function read_bits_3(buf, bl) {
      var w = bl & 7, h = bl >>> 3;
      return (buf[h] | (w <= 5 ? 0 : buf[h + 1] << 8)) >>> w & 7;
    }
    function read_bits_4(buf, bl) {
      var w = bl & 7, h = bl >>> 3;
      return (buf[h] | (w <= 4 ? 0 : buf[h + 1] << 8)) >>> w & 15;
    }
    function read_bits_5(buf, bl) {
      var w = bl & 7, h = bl >>> 3;
      return (buf[h] | (w <= 3 ? 0 : buf[h + 1] << 8)) >>> w & 31;
    }
    function read_bits_7(buf, bl) {
      var w = bl & 7, h = bl >>> 3;
      return (buf[h] | (w <= 1 ? 0 : buf[h + 1] << 8)) >>> w & 127;
    }
    function read_bits_n(buf, bl, n) {
      var w = bl & 7, h = bl >>> 3, f = (1 << n) - 1;
      var v = buf[h] >>> w;
      if (n < 8 - w) return v & f;
      v |= buf[h + 1] << 8 - w;
      if (n < 16 - w) return v & f;
      v |= buf[h + 2] << 16 - w;
      if (n < 24 - w) return v & f;
      v |= buf[h + 3] << 24 - w;
      return v & f;
    }
    function write_bits_3(buf, bl, v) {
      var w = bl & 7, h = bl >>> 3;
      if (w <= 5) buf[h] |= (v & 7) << w;
      else {
        buf[h] |= v << w & 255;
        buf[h + 1] = (v & 7) >> 8 - w;
      }
      return bl + 3;
    }
    function write_bits_1(buf, bl, v) {
      var w = bl & 7, h = bl >>> 3;
      v = (v & 1) << w;
      buf[h] |= v;
      return bl + 1;
    }
    function write_bits_8(buf, bl, v) {
      var w = bl & 7, h = bl >>> 3;
      v <<= w;
      buf[h] |= v & 255;
      v >>>= 8;
      buf[h + 1] = v;
      return bl + 8;
    }
    function write_bits_16(buf, bl, v) {
      var w = bl & 7, h = bl >>> 3;
      v <<= w;
      buf[h] |= v & 255;
      v >>>= 8;
      buf[h + 1] = v & 255;
      buf[h + 2] = v >>> 8;
      return bl + 16;
    }
    function realloc(b, sz) {
      var L = b.length, M = 2 * L > sz ? 2 * L : sz + 5, i2 = 0;
      if (L >= sz) return b;
      if (has_buf) {
        var o = new_unsafe_buf(M);
        if (b.copy) b.copy(o);
        else for (; i2 < b.length; ++i2) o[i2] = b[i2];
        return o;
      } else if (use_typed_arrays) {
        var a = new Uint8Array(M);
        if (a.set) a.set(b);
        else for (; i2 < L; ++i2) a[i2] = b[i2];
        return a;
      }
      b.length = M;
      return b;
    }
    function zero_fill_array(n) {
      var o = new Array(n);
      for (var i2 = 0; i2 < n; ++i2) o[i2] = 0;
      return o;
    }
    function build_tree(clens, cmap, MAX) {
      var maxlen = 1, w = 0, i2 = 0, j = 0, ccode = 0, L = clens.length;
      var bl_count = use_typed_arrays ? new Uint16Array(32) : zero_fill_array(32);
      for (i2 = 0; i2 < 32; ++i2) bl_count[i2] = 0;
      for (i2 = L; i2 < MAX; ++i2) clens[i2] = 0;
      L = clens.length;
      var ctree = use_typed_arrays ? new Uint16Array(L) : zero_fill_array(L);
      for (i2 = 0; i2 < L; ++i2) {
        bl_count[w = clens[i2]]++;
        if (maxlen < w) maxlen = w;
        ctree[i2] = 0;
      }
      bl_count[0] = 0;
      for (i2 = 1; i2 <= maxlen; ++i2) bl_count[i2 + 16] = ccode = ccode + bl_count[i2 - 1] << 1;
      for (i2 = 0; i2 < L; ++i2) {
        ccode = clens[i2];
        if (ccode != 0) ctree[i2] = bl_count[ccode + 16]++;
      }
      var cleni = 0;
      for (i2 = 0; i2 < L; ++i2) {
        cleni = clens[i2];
        if (cleni != 0) {
          ccode = bit_swap_n(ctree[i2], maxlen) >> maxlen - cleni;
          for (j = (1 << maxlen + 4 - cleni) - 1; j >= 0; --j)
            cmap[ccode | j << cleni] = cleni & 15 | i2 << 4;
        }
      }
      return maxlen;
    }
    var fix_lmap = use_typed_arrays ? new Uint16Array(512) : zero_fill_array(512);
    var fix_dmap = use_typed_arrays ? new Uint16Array(32) : zero_fill_array(32);
    if (!use_typed_arrays) {
      for (var i = 0; i < 512; ++i) fix_lmap[i] = 0;
      for (i = 0; i < 32; ++i) fix_dmap[i] = 0;
    }
    (function() {
      var dlens = [];
      var i2 = 0;
      for (; i2 < 32; i2++) dlens.push(5);
      build_tree(dlens, fix_dmap, 32);
      var clens = [];
      i2 = 0;
      for (; i2 <= 143; i2++) clens.push(8);
      for (; i2 <= 255; i2++) clens.push(9);
      for (; i2 <= 279; i2++) clens.push(7);
      for (; i2 <= 287; i2++) clens.push(8);
      build_tree(clens, fix_lmap, 288);
    })();
    var _deflateRaw = /* @__PURE__ */ (function _deflateRawIIFE() {
      var DST_LN_RE = use_typed_arrays ? new Uint8Array(32768) : [];
      var j = 0, k = 0;
      for (; j < DST_LN.length - 1; ++j) {
        for (; k < DST_LN[j + 1]; ++k) DST_LN_RE[k] = j;
      }
      for (; k < 32768; ++k) DST_LN_RE[k] = 29;
      var LEN_LN_RE = use_typed_arrays ? new Uint8Array(259) : [];
      for (j = 0, k = 0; j < LEN_LN.length - 1; ++j) {
        for (; k < LEN_LN[j + 1]; ++k) LEN_LN_RE[k] = j;
      }
      function write_stored(data, out) {
        var boff = 0;
        while (boff < data.length) {
          var L = Math.min(65535, data.length - boff);
          var h = boff + L == data.length;
          out.write_shift(1, +h);
          out.write_shift(2, L);
          out.write_shift(2, ~L & 65535);
          while (L-- > 0) out[out.l++] = data[boff++];
        }
        return out.l;
      }
      function write_huff_fixed(data, out) {
        var bl = 0;
        var boff = 0;
        var addrs = use_typed_arrays ? new Uint16Array(32768) : [];
        while (boff < data.length) {
          var L = (
            /* data.length - boff; */
            Math.min(65535, data.length - boff)
          );
          if (L < 10) {
            bl = write_bits_3(out, bl, +!!(boff + L == data.length));
            if (bl & 7) bl += 8 - (bl & 7);
            out.l = bl / 8 | 0;
            out.write_shift(2, L);
            out.write_shift(2, ~L & 65535);
            while (L-- > 0) out[out.l++] = data[boff++];
            bl = out.l * 8;
            continue;
          }
          bl = write_bits_3(out, bl, +!!(boff + L == data.length) + 2);
          var hash = 0;
          while (L-- > 0) {
            var d = data[boff];
            hash = (hash << 5 ^ d) & 32767;
            var match = -1, mlen = 0;
            if (match = addrs[hash]) {
              match |= boff & ~32767;
              if (match > boff) match -= 32768;
              if (match < boff) while (data[match + mlen] == data[boff + mlen] && mlen < 250) ++mlen;
            }
            if (mlen > 2) {
              d = LEN_LN_RE[mlen];
              if (d <= 22) bl = write_bits_8(out, bl, bitswap8[d + 1] >> 1) - 1;
              else {
                write_bits_8(out, bl, 3);
                bl += 5;
                write_bits_8(out, bl, bitswap8[d - 23] >> 5);
                bl += 3;
              }
              var len_eb = d < 8 ? 0 : d - 4 >> 2;
              if (len_eb > 0) {
                write_bits_16(out, bl, mlen - LEN_LN[d]);
                bl += len_eb;
              }
              d = DST_LN_RE[boff - match];
              bl = write_bits_8(out, bl, bitswap8[d] >> 3);
              bl -= 3;
              var dst_eb = d < 4 ? 0 : d - 2 >> 1;
              if (dst_eb > 0) {
                write_bits_16(out, bl, boff - match - DST_LN[d]);
                bl += dst_eb;
              }
              for (var q2 = 0; q2 < mlen; ++q2) {
                addrs[hash] = boff & 32767;
                hash = (hash << 5 ^ data[boff]) & 32767;
                ++boff;
              }
              L -= mlen - 1;
            } else {
              if (d <= 143) d = d + 48;
              else bl = write_bits_1(out, bl, 1);
              bl = write_bits_8(out, bl, bitswap8[d]);
              addrs[hash] = boff & 32767;
              ++boff;
            }
          }
          bl = write_bits_8(out, bl, 0) - 1;
        }
        out.l = (bl + 7) / 8 | 0;
        return out.l;
      }
      return function _deflateRaw2(data, out) {
        if (data.length < 8) return write_stored(data, out);
        return write_huff_fixed(data, out);
      };
    })();
    function _deflate(data) {
      var buf = new_buf(50 + Math.floor(data.length * 1.1));
      var off = _deflateRaw(data, buf);
      return buf.slice(0, off);
    }
    var dyn_lmap = use_typed_arrays ? new Uint16Array(32768) : zero_fill_array(32768);
    var dyn_dmap = use_typed_arrays ? new Uint16Array(32768) : zero_fill_array(32768);
    var dyn_cmap = use_typed_arrays ? new Uint16Array(128) : zero_fill_array(128);
    var dyn_len_1 = 1, dyn_len_2 = 1;
    function dyn(data, boff) {
      var _HLIT = read_bits_5(data, boff) + 257;
      boff += 5;
      var _HDIST = read_bits_5(data, boff) + 1;
      boff += 5;
      var _HCLEN = read_bits_4(data, boff) + 4;
      boff += 4;
      var w = 0;
      var clens = use_typed_arrays ? new Uint8Array(19) : zero_fill_array(19);
      var ctree = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
      var maxlen = 1;
      var bl_count = use_typed_arrays ? new Uint8Array(8) : zero_fill_array(8);
      var next_code = use_typed_arrays ? new Uint8Array(8) : zero_fill_array(8);
      var L = clens.length;
      for (var i2 = 0; i2 < _HCLEN; ++i2) {
        clens[CLEN_ORDER[i2]] = w = read_bits_3(data, boff);
        if (maxlen < w) maxlen = w;
        bl_count[w]++;
        boff += 3;
      }
      var ccode = 0;
      bl_count[0] = 0;
      for (i2 = 1; i2 <= maxlen; ++i2) next_code[i2] = ccode = ccode + bl_count[i2 - 1] << 1;
      for (i2 = 0; i2 < L; ++i2) if ((ccode = clens[i2]) != 0) ctree[i2] = next_code[ccode]++;
      var cleni = 0;
      for (i2 = 0; i2 < L; ++i2) {
        cleni = clens[i2];
        if (cleni != 0) {
          ccode = bitswap8[ctree[i2]] >> 8 - cleni;
          for (var j = (1 << 7 - cleni) - 1; j >= 0; --j) dyn_cmap[ccode | j << cleni] = cleni & 7 | i2 << 3;
        }
      }
      var hcodes = [];
      maxlen = 1;
      for (; hcodes.length < _HLIT + _HDIST; ) {
        ccode = dyn_cmap[read_bits_7(data, boff)];
        boff += ccode & 7;
        switch (ccode >>>= 3) {
          case 16:
            w = 3 + read_bits_2(data, boff);
            boff += 2;
            ccode = hcodes[hcodes.length - 1];
            while (w-- > 0) hcodes.push(ccode);
            break;
          case 17:
            w = 3 + read_bits_3(data, boff);
            boff += 3;
            while (w-- > 0) hcodes.push(0);
            break;
          case 18:
            w = 11 + read_bits_7(data, boff);
            boff += 7;
            while (w-- > 0) hcodes.push(0);
            break;
          default:
            hcodes.push(ccode);
            if (maxlen < ccode) maxlen = ccode;
            break;
        }
      }
      var h1 = hcodes.slice(0, _HLIT), h2 = hcodes.slice(_HLIT);
      for (i2 = _HLIT; i2 < 286; ++i2) h1[i2] = 0;
      for (i2 = _HDIST; i2 < 30; ++i2) h2[i2] = 0;
      dyn_len_1 = build_tree(h1, dyn_lmap, 286);
      dyn_len_2 = build_tree(h2, dyn_dmap, 30);
      return boff;
    }
    function inflate(data, usz) {
      if (data[0] == 3 && !(data[1] & 3)) {
        return [new_raw_buf(usz), 2];
      }
      var boff = 0;
      var header = 0;
      var outbuf = new_unsafe_buf(usz ? usz : 1 << 18);
      var woff = 0;
      var OL = outbuf.length >>> 0;
      var max_len_1 = 0, max_len_2 = 0;
      while ((header & 1) == 0) {
        header = read_bits_3(data, boff);
        boff += 3;
        if (header >>> 1 == 0) {
          if (boff & 7) boff += 8 - (boff & 7);
          var sz = data[boff >>> 3] | data[(boff >>> 3) + 1] << 8;
          boff += 32;
          if (sz > 0) {
            if (!usz && OL < woff + sz) {
              outbuf = realloc(outbuf, woff + sz);
              OL = outbuf.length;
            }
            while (sz-- > 0) {
              outbuf[woff++] = data[boff >>> 3];
              boff += 8;
            }
          }
          continue;
        } else if (header >> 1 == 1) {
          max_len_1 = 9;
          max_len_2 = 5;
        } else {
          boff = dyn(data, boff);
          max_len_1 = dyn_len_1;
          max_len_2 = dyn_len_2;
        }
        for (; ; ) {
          if (!usz && OL < woff + 32767) {
            outbuf = realloc(outbuf, woff + 32767);
            OL = outbuf.length;
          }
          var bits = read_bits_n(data, boff, max_len_1);
          var code = header >>> 1 == 1 ? fix_lmap[bits] : dyn_lmap[bits];
          boff += code & 15;
          code >>>= 4;
          if ((code >>> 8 & 255) === 0) outbuf[woff++] = code;
          else if (code == 256) break;
          else {
            code -= 257;
            var len_eb = code < 8 ? 0 : code - 4 >> 2;
            if (len_eb > 5) len_eb = 0;
            var tgt = woff + LEN_LN[code];
            if (len_eb > 0) {
              tgt += read_bits_n(data, boff, len_eb);
              boff += len_eb;
            }
            bits = read_bits_n(data, boff, max_len_2);
            code = header >>> 1 == 1 ? fix_dmap[bits] : dyn_dmap[bits];
            boff += code & 15;
            code >>>= 4;
            var dst_eb = code < 4 ? 0 : code - 2 >> 1;
            var dst = DST_LN[code];
            if (dst_eb > 0) {
              dst += read_bits_n(data, boff, dst_eb);
              boff += dst_eb;
            }
            if (!usz && OL < tgt) {
              outbuf = realloc(outbuf, tgt + 100);
              OL = outbuf.length;
            }
            while (woff < tgt) {
              outbuf[woff] = outbuf[woff - dst];
              ++woff;
            }
          }
        }
      }
      if (usz) return [outbuf, boff + 7 >>> 3];
      return [outbuf.slice(0, woff), boff + 7 >>> 3];
    }
    function _inflate(payload, usz) {
      var data = payload.slice(payload.l || 0);
      var out = inflate(data, usz);
      payload.l += out[1];
      return out[0];
    }
    function warn_or_throw(wrn, msg) {
      if (wrn) {
        if (typeof console !== "undefined") console.error(msg);
      } else throw new Error(msg);
    }
    function parse_zip2(file, options) {
      var blob = (
        /*::(*/
        file
      );
      prep_blob(blob, 0);
      var FileIndex = [], FullPaths = [];
      var o = {
        FileIndex,
        FullPaths
      };
      init_cfb(o, { root: options.root });
      var i2 = blob.length - 4;
      while ((blob[i2] != 80 || blob[i2 + 1] != 75 || blob[i2 + 2] != 5 || blob[i2 + 3] != 6) && i2 >= 0) --i2;
      blob.l = i2 + 4;
      blob.l += 4;
      var fcnt = blob.read_shift(2);
      blob.l += 6;
      var start_cd = blob.read_shift(4);
      blob.l = start_cd;
      for (i2 = 0; i2 < fcnt; ++i2) {
        blob.l += 20;
        var csz = blob.read_shift(4);
        var usz = blob.read_shift(4);
        var namelen = blob.read_shift(2);
        var efsz = blob.read_shift(2);
        var fcsz = blob.read_shift(2);
        blob.l += 8;
        var offset = blob.read_shift(4);
        var EF = parse_extra_field(
          /*::(*/
          blob.slice(blob.l + namelen, blob.l + namelen + efsz)
          /*:: :any)*/
        );
        blob.l += namelen + efsz + fcsz;
        var L = blob.l;
        blob.l = offset + 4;
        parse_local_file(blob, csz, usz, o, EF);
        blob.l = L;
      }
      return o;
    }
    function parse_local_file(blob, csz, usz, o, EF) {
      blob.l += 2;
      var flags = blob.read_shift(2);
      var meth = blob.read_shift(2);
      var date = parse_dos_date(blob);
      if (flags & 8257) throw new Error("Unsupported ZIP encryption");
      var crc32 = blob.read_shift(4);
      var _csz = blob.read_shift(4);
      var _usz = blob.read_shift(4);
      var namelen = blob.read_shift(2);
      var efsz = blob.read_shift(2);
      var name = "";
      for (var i2 = 0; i2 < namelen; ++i2) name += String.fromCharCode(blob[blob.l++]);
      if (efsz) {
        var ef = parse_extra_field(
          /*::(*/
          blob.slice(blob.l, blob.l + efsz)
          /*:: :any)*/
        );
        if ((ef[21589] || {}).mt) date = ef[21589].mt;
        if (((EF || {})[21589] || {}).mt) date = EF[21589].mt;
      }
      blob.l += efsz;
      var data = blob.slice(blob.l, blob.l + _csz);
      switch (meth) {
        case 8:
          data = _inflateRawSync(blob, _usz);
          break;
        case 0:
          break;
        // TODO: scan for magic number
        default:
          throw new Error("Unsupported ZIP Compression method " + meth);
      }
      var wrn = false;
      if (flags & 8) {
        crc32 = blob.read_shift(4);
        if (crc32 == 134695760) {
          crc32 = blob.read_shift(4);
          wrn = true;
        }
        _csz = blob.read_shift(4);
        _usz = blob.read_shift(4);
      }
      if (_csz != csz) warn_or_throw(wrn, "Bad compressed size: " + csz + " != " + _csz);
      if (_usz != usz) warn_or_throw(wrn, "Bad uncompressed size: " + usz + " != " + _usz);
      cfb_add(o, name, data, { unsafe: true, mt: date });
    }
    function write_zip(cfb, options) {
      var _opts = options || {};
      var out = [], cdirs = [];
      var o = new_buf(1);
      var method = _opts.compression ? 8 : 0, flags = 0;
      var desc = false;
      if (desc) flags |= 8;
      var i2 = 0, j = 0;
      var start_cd = 0, fcnt = 0;
      var root3 = cfb.FullPaths[0], fp = root3, fi = cfb.FileIndex[0];
      var crcs = [];
      var sz_cd = 0;
      for (i2 = 1; i2 < cfb.FullPaths.length; ++i2) {
        fp = cfb.FullPaths[i2].slice(root3.length);
        fi = cfb.FileIndex[i2];
        if (!fi.size || !fi.content || fp == "Sh33tJ5") continue;
        var start = start_cd;
        var namebuf = new_buf(fp.length);
        for (j = 0; j < fp.length; ++j) namebuf.write_shift(1, fp.charCodeAt(j) & 127);
        namebuf = namebuf.slice(0, namebuf.l);
        crcs[fcnt] = CRC32.buf(
          /*::((*/
          fi.content,
          0
        );
        var outbuf = fi.content;
        if (method == 8) outbuf = _deflateRawSync(outbuf);
        o = new_buf(30);
        o.write_shift(4, 67324752);
        o.write_shift(2, 20);
        o.write_shift(2, flags);
        o.write_shift(2, method);
        if (fi.mt) write_dos_date(o, fi.mt);
        else o.write_shift(4, 0);
        o.write_shift(-4, flags & 8 ? 0 : crcs[fcnt]);
        o.write_shift(4, flags & 8 ? 0 : outbuf.length);
        o.write_shift(4, flags & 8 ? 0 : (
          /*::(*/
          fi.content.length
        ));
        o.write_shift(2, namebuf.length);
        o.write_shift(2, 0);
        start_cd += o.length;
        out.push(o);
        start_cd += namebuf.length;
        out.push(namebuf);
        start_cd += outbuf.length;
        out.push(outbuf);
        if (flags & 8) {
          o = new_buf(12);
          o.write_shift(-4, crcs[fcnt]);
          o.write_shift(4, outbuf.length);
          o.write_shift(
            4,
            /*::(*/
            fi.content.length
          );
          start_cd += o.l;
          out.push(o);
        }
        o = new_buf(46);
        o.write_shift(4, 33639248);
        o.write_shift(2, 0);
        o.write_shift(2, 20);
        o.write_shift(2, flags);
        o.write_shift(2, method);
        o.write_shift(4, 0);
        o.write_shift(-4, crcs[fcnt]);
        o.write_shift(4, outbuf.length);
        o.write_shift(
          4,
          /*::(*/
          fi.content.length
        );
        o.write_shift(2, namebuf.length);
        o.write_shift(2, 0);
        o.write_shift(2, 0);
        o.write_shift(2, 0);
        o.write_shift(2, 0);
        o.write_shift(4, 0);
        o.write_shift(4, start);
        sz_cd += o.l;
        cdirs.push(o);
        sz_cd += namebuf.length;
        cdirs.push(namebuf);
        ++fcnt;
      }
      o = new_buf(22);
      o.write_shift(4, 101010256);
      o.write_shift(2, 0);
      o.write_shift(2, 0);
      o.write_shift(2, fcnt);
      o.write_shift(2, fcnt);
      o.write_shift(4, sz_cd);
      o.write_shift(4, start_cd);
      o.write_shift(2, 0);
      return bconcat([bconcat(out), bconcat(cdirs), o]);
    }
    var ContentTypeMap = {
      "htm": "text/html",
      "xml": "text/xml",
      "gif": "image/gif",
      "jpg": "image/jpeg",
      "png": "image/png",
      "mso": "application/x-mso",
      "thmx": "application/vnd.ms-officetheme",
      "sh33tj5": "application/octet-stream"
    };
    function get_content_type(fi, fp) {
      if (fi.ctype) return fi.ctype;
      var ext = fi.name || "", m = ext.match(/\.([^\.]+)$/);
      if (m && ContentTypeMap[m[1]]) return ContentTypeMap[m[1]];
      if (fp) {
        m = (ext = fp).match(/[\.\\]([^\.\\])+$/);
        if (m && ContentTypeMap[m[1]]) return ContentTypeMap[m[1]];
      }
      return "application/octet-stream";
    }
    function write_base64_76(bstr) {
      var data = Base64_encode(bstr);
      var o = [];
      for (var i2 = 0; i2 < data.length; i2 += 76) o.push(data.slice(i2, i2 + 76));
      return o.join("\r\n") + "\r\n";
    }
    function write_quoted_printable(text) {
      var encoded = text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g, function(c) {
        var w = c.charCodeAt(0).toString(16).toUpperCase();
        return "=" + (w.length == 1 ? "0" + w : w);
      });
      encoded = encoded.replace(/ $/mg, "=20").replace(/\t$/mg, "=09");
      if (encoded.charAt(0) == "\n") encoded = "=0D" + encoded.slice(1);
      encoded = encoded.replace(/\r(?!\n)/mg, "=0D").replace(/\n\n/mg, "\n=0A").replace(/([^\r\n])\n/mg, "$1=0A");
      var o = [], split = encoded.split("\r\n");
      for (var si = 0; si < split.length; ++si) {
        var str = split[si];
        if (str.length == 0) {
          o.push("");
          continue;
        }
        for (var i2 = 0; i2 < str.length; ) {
          var end = 76;
          var tmp = str.slice(i2, i2 + end);
          if (tmp.charAt(end - 1) == "=") end--;
          else if (tmp.charAt(end - 2) == "=") end -= 2;
          else if (tmp.charAt(end - 3) == "=") end -= 3;
          tmp = str.slice(i2, i2 + end);
          i2 += end;
          if (i2 < str.length) tmp += "=";
          o.push(tmp);
        }
      }
      return o.join("\r\n");
    }
    function parse_quoted_printable(data) {
      var o = [];
      for (var di = 0; di < data.length; ++di) {
        var line = data[di];
        while (di <= data.length && line.charAt(line.length - 1) == "=") line = line.slice(0, line.length - 1) + data[++di];
        o.push(line);
      }
      for (var oi = 0; oi < o.length; ++oi) o[oi] = o[oi].replace(/[=][0-9A-Fa-f]{2}/g, function($$) {
        return String.fromCharCode(parseInt($$.slice(1), 16));
      });
      return s2a(o.join("\r\n"));
    }
    function parse_mime(cfb, data, root3) {
      var fname = "", cte = "", ctype = "", fdata;
      var di = 0;
      for (; di < 10; ++di) {
        var line = data[di];
        if (!line || line.match(/^\s*$/)) break;
        var m = line.match(/^(.*?):\s*([^\s].*)$/);
        if (m) switch (m[1].toLowerCase()) {
          case "content-location":
            fname = m[2].trim();
            break;
          case "content-type":
            ctype = m[2].trim();
            break;
          case "content-transfer-encoding":
            cte = m[2].trim();
            break;
        }
      }
      ++di;
      switch (cte.toLowerCase()) {
        case "base64":
          fdata = s2a(Base64_decode(data.slice(di).join("")));
          break;
        case "quoted-printable":
          fdata = parse_quoted_printable(data.slice(di));
          break;
        default:
          throw new Error("Unsupported Content-Transfer-Encoding " + cte);
      }
      var file = cfb_add(cfb, fname.slice(root3.length), fdata, { unsafe: true });
      if (ctype) file.ctype = ctype;
    }
    function parse_mad(file, options) {
      if (a2s2(file.slice(0, 13)).toLowerCase() != "mime-version:") throw new Error("Unsupported MAD header");
      var root3 = options && options.root || "";
      var data = (has_buf && Buffer.isBuffer(file) ? file.toString("binary") : a2s2(file)).split("\r\n");
      var di = 0, row = "";
      for (di = 0; di < data.length; ++di) {
        row = data[di];
        if (!/^Content-Location:/i.test(row)) continue;
        row = row.slice(row.indexOf("file"));
        if (!root3) root3 = row.slice(0, row.lastIndexOf("/") + 1);
        if (row.slice(0, root3.length) == root3) continue;
        while (root3.length > 0) {
          root3 = root3.slice(0, root3.length - 1);
          root3 = root3.slice(0, root3.lastIndexOf("/") + 1);
          if (row.slice(0, root3.length) == root3) break;
        }
      }
      var mboundary = (data[1] || "").match(/boundary="(.*?)"/);
      if (!mboundary) throw new Error("MAD cannot find boundary");
      var boundary = "--" + (mboundary[1] || "");
      var FileIndex = [], FullPaths = [];
      var o = {
        FileIndex,
        FullPaths
      };
      init_cfb(o);
      var start_di, fcnt = 0;
      for (di = 0; di < data.length; ++di) {
        var line = data[di];
        if (line !== boundary && line !== boundary + "--") continue;
        if (fcnt++) parse_mime(o, data.slice(start_di, di), root3);
        start_di = di;
      }
      return o;
    }
    function write_mad(cfb, options) {
      var opts = options || {};
      var boundary = opts.boundary || "SheetJS";
      boundary = "------=" + boundary;
      var out = [
        "MIME-Version: 1.0",
        'Content-Type: multipart/related; boundary="' + boundary.slice(2) + '"',
        "",
        "",
        ""
      ];
      var root3 = cfb.FullPaths[0], fp = root3, fi = cfb.FileIndex[0];
      for (var i2 = 1; i2 < cfb.FullPaths.length; ++i2) {
        fp = cfb.FullPaths[i2].slice(root3.length);
        fi = cfb.FileIndex[i2];
        if (!fi.size || !fi.content || fp == "Sh33tJ5") continue;
        fp = fp.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g, function(c) {
          return "_x" + c.charCodeAt(0).toString(16) + "_";
        }).replace(/[\u0080-\uFFFF]/g, function(u) {
          return "_u" + u.charCodeAt(0).toString(16) + "_";
        });
        var ca = fi.content;
        var cstr = has_buf && Buffer.isBuffer(ca) ? ca.toString("binary") : a2s2(ca);
        var dispcnt = 0, L = Math.min(1024, cstr.length), cc = 0;
        for (var csl = 0; csl <= L; ++csl) if ((cc = cstr.charCodeAt(csl)) >= 32 && cc < 128) ++dispcnt;
        var qp = dispcnt >= L * 4 / 5;
        out.push(boundary);
        out.push("Content-Location: " + (opts.root || "file:///C:/SheetJS/") + fp);
        out.push("Content-Transfer-Encoding: " + (qp ? "quoted-printable" : "base64"));
        out.push("Content-Type: " + get_content_type(fi, fp));
        out.push("");
        out.push(qp ? write_quoted_printable(cstr) : write_base64_76(cstr));
      }
      out.push(boundary + "--\r\n");
      return out.join("\r\n");
    }
    function cfb_new(opts) {
      var o = {};
      init_cfb(o, opts);
      return o;
    }
    function cfb_add(cfb, name, content, opts) {
      var unsafe = opts && opts.unsafe;
      if (!unsafe) init_cfb(cfb);
      var file = !unsafe && CFB.find(cfb, name);
      if (!file) {
        var fpath = cfb.FullPaths[0];
        if (name.slice(0, fpath.length) == fpath) fpath = name;
        else {
          if (fpath.slice(-1) != "/") fpath += "/";
          fpath = (fpath + name).replace("//", "/");
        }
        file = { name: filename(name), type: 2 };
        cfb.FileIndex.push(file);
        cfb.FullPaths.push(fpath);
        if (!unsafe) CFB.utils.cfb_gc(cfb);
      }
      file.content = content;
      file.size = content ? content.length : 0;
      if (opts) {
        if (opts.CLSID) file.clsid = opts.CLSID;
        if (opts.mt) file.mt = opts.mt;
        if (opts.ct) file.ct = opts.ct;
      }
      return file;
    }
    function cfb_del(cfb, name) {
      init_cfb(cfb);
      var file = CFB.find(cfb, name);
      if (file) {
        for (var j = 0; j < cfb.FileIndex.length; ++j) if (cfb.FileIndex[j] == file) {
          cfb.FileIndex.splice(j, 1);
          cfb.FullPaths.splice(j, 1);
          return true;
        }
      }
      return false;
    }
    function cfb_mov(cfb, old_name, new_name) {
      init_cfb(cfb);
      var file = CFB.find(cfb, old_name);
      if (file) {
        for (var j = 0; j < cfb.FileIndex.length; ++j) if (cfb.FileIndex[j] == file) {
          cfb.FileIndex[j].name = filename(new_name);
          cfb.FullPaths[j] = new_name;
          return true;
        }
      }
      return false;
    }
    function cfb_gc(cfb) {
      rebuild_cfb(cfb, true);
    }
    exports2.find = find2;
    exports2.read = read;
    exports2.parse = parse;
    exports2.write = write;
    exports2.writeFile = write_file;
    exports2.utils = {
      cfb_new,
      cfb_add,
      cfb_del,
      cfb_mov,
      cfb_gc,
      ReadShift,
      CheckField,
      prep_blob,
      bconcat,
      use_zlib,
      _deflateRaw: _deflate,
      _inflateRaw: _inflate,
      consts
    };
    return exports2;
  })();
  var _fs = void 0;
  function read_binary(path) {
    if (typeof _fs !== "undefined") return _fs.readFileSync(path);
    if (typeof Deno !== "undefined") return Deno.readFileSync(path);
    if (typeof $ !== "undefined" && typeof File !== "undefined" && typeof Folder !== "undefined") try {
      var infile = File(path);
      infile.open("r");
      infile.encoding = "binary";
      var data = infile.read();
      infile.close();
      return data;
    } catch (e) {
      if (!e.message || !e.message.match(/onstruct/)) throw e;
    }
    throw new Error("Cannot access file " + path);
  }
  function keys(o) {
    var ks = Object.keys(o), o2 = [];
    for (var i = 0; i < ks.length; ++i) if (Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]);
    return o2;
  }
  function evert(obj2) {
    var o = [], K = keys(obj2);
    for (var i = 0; i !== K.length; ++i) o[obj2[K[i]]] = K[i];
    return o;
  }
  var basedate = /* @__PURE__ */ new Date(1899, 11, 30, 0, 0, 0);
  function datenum(v, date1904) {
    var epoch = /* @__PURE__ */ v.getTime();
    if (date1904) epoch -= 1462 * 24 * 60 * 60 * 1e3;
    var dnthresh2 = /* @__PURE__ */ basedate.getTime() + (/* @__PURE__ */ v.getTimezoneOffset() - /* @__PURE__ */ basedate.getTimezoneOffset()) * 6e4;
    return (epoch - dnthresh2) / (24 * 60 * 60 * 1e3);
  }
  var refdate = /* @__PURE__ */ new Date();
  var dnthresh = /* @__PURE__ */ basedate.getTime() + (/* @__PURE__ */ refdate.getTimezoneOffset() - /* @__PURE__ */ basedate.getTimezoneOffset()) * 6e4;
  var refoffset = /* @__PURE__ */ refdate.getTimezoneOffset();
  function numdate(v) {
    var out = /* @__PURE__ */ new Date();
    out.setTime(v * 24 * 60 * 60 * 1e3 + dnthresh);
    if (out.getTimezoneOffset() !== refoffset) {
      out.setTime(out.getTime() + (out.getTimezoneOffset() - refoffset) * 6e4);
    }
    return out;
  }
  function parse_isodur(s) {
    var sec = 0, mt = 0, time = false;
    var m = s.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/);
    if (!m) throw new Error("|" + s + "| is not an ISO8601 Duration");
    for (var i = 1; i != m.length; ++i) {
      if (!m[i]) continue;
      mt = 1;
      if (i > 3) time = true;
      switch (m[i].slice(m[i].length - 1)) {
        case "Y":
          throw new Error("Unsupported ISO Duration Field: " + m[i].slice(m[i].length - 1));
        case "D":
          mt *= 24;
        /* falls through */
        case "H":
          mt *= 60;
        /* falls through */
        case "M":
          if (!time) throw new Error("Unsupported ISO Duration Field: M");
          else mt *= 60;
        /* falls through */
        case "S":
          break;
      }
      sec += mt * parseInt(m[i], 10);
    }
    return sec;
  }
  var good_pd_date_1 = /* @__PURE__ */ new Date("2017-02-19T19:06:09.000Z");
  var good_pd_date = /* @__PURE__ */ isNaN(/* @__PURE__ */ good_pd_date_1.getFullYear()) ? /* @__PURE__ */ new Date("2/19/17") : good_pd_date_1;
  var good_pd = /* @__PURE__ */ good_pd_date.getFullYear() == 2017;
  function parseDate(str, fixdate) {
    var d = new Date(str);
    if (good_pd) {
      if (fixdate > 0) d.setTime(d.getTime() + d.getTimezoneOffset() * 60 * 1e3);
      else if (fixdate < 0) d.setTime(d.getTime() - d.getTimezoneOffset() * 60 * 1e3);
      return d;
    }
    if (str instanceof Date) return str;
    if (good_pd_date.getFullYear() == 1917 && !isNaN(d.getFullYear())) {
      var s = d.getFullYear();
      if (str.indexOf("" + s) > -1) return d;
      d.setFullYear(d.getFullYear() + 100);
      return d;
    }
    var n = str.match(/\d+/g) || ["2017", "2", "19", "0", "0", "0"];
    var out = new Date(+n[0], +n[1] - 1, +n[2], +n[3] || 0, +n[4] || 0, +n[5] || 0);
    if (str.indexOf("Z") > -1) out = new Date(out.getTime() - out.getTimezoneOffset() * 60 * 1e3);
    return out;
  }
  function cc2str(arr, debomit) {
    if (has_buf && Buffer.isBuffer(arr)) {
      if (debomit) {
        if (arr[0] == 255 && arr[1] == 254) return utf8write(arr.slice(2).toString("utf16le"));
        if (arr[1] == 254 && arr[2] == 255) return utf8write(utf16beread(arr.slice(2).toString("binary")));
      }
      return arr.toString("binary");
    }
    if (typeof TextDecoder !== "undefined") try {
      if (debomit) {
        if (arr[0] == 255 && arr[1] == 254) return utf8write(new TextDecoder("utf-16le").decode(arr.slice(2)));
        if (arr[0] == 254 && arr[1] == 255) return utf8write(new TextDecoder("utf-16be").decode(arr.slice(2)));
      }
      var rev = {
        "\u20AC": "\x80",
        "\u201A": "\x82",
        "\u0192": "\x83",
        "\u201E": "\x84",
        "\u2026": "\x85",
        "\u2020": "\x86",
        "\u2021": "\x87",
        "\u02C6": "\x88",
        "\u2030": "\x89",
        "\u0160": "\x8A",
        "\u2039": "\x8B",
        "\u0152": "\x8C",
        "\u017D": "\x8E",
        "\u2018": "\x91",
        "\u2019": "\x92",
        "\u201C": "\x93",
        "\u201D": "\x94",
        "\u2022": "\x95",
        "\u2013": "\x96",
        "\u2014": "\x97",
        "\u02DC": "\x98",
        "\u2122": "\x99",
        "\u0161": "\x9A",
        "\u203A": "\x9B",
        "\u0153": "\x9C",
        "\u017E": "\x9E",
        "\u0178": "\x9F"
      };
      if (Array.isArray(arr)) arr = new Uint8Array(arr);
      return new TextDecoder("latin1").decode(arr).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g, function(c) {
        return rev[c] || c;
      });
    } catch (e) {
    }
    var o = [];
    for (var i = 0; i != arr.length; ++i) o.push(String.fromCharCode(arr[i]));
    return o.join("");
  }
  function dup(o) {
    if (typeof JSON != "undefined" && !Array.isArray(o)) return JSON.parse(JSON.stringify(o));
    if (typeof o != "object" || o == null) return o;
    if (o instanceof Date) return new Date(o.getTime());
    var out = {};
    for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
    return out;
  }
  function fill(c, l2) {
    var o = "";
    while (o.length < l2) o += c;
    return o;
  }
  function fuzzynum(s) {
    var v = Number(s);
    if (!isNaN(v)) return isFinite(v) ? v : NaN;
    if (!/\d/.test(s)) return v;
    var wt = 1;
    var ss = s.replace(/([\d]),([\d])/g, "$1$2").replace(/[$]/g, "").replace(/[%]/g, function() {
      wt *= 100;
      return "";
    });
    if (!isNaN(v = Number(ss))) return v / wt;
    ss = ss.replace(/[(](.*)[)]/, function($$, $1) {
      wt = -wt;
      return $1;
    });
    if (!isNaN(v = Number(ss))) return v / wt;
    return v;
  }
  var lower_months = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
  function fuzzydate(s) {
    var o = new Date(s), n = /* @__PURE__ */ new Date(NaN);
    var y = o.getYear(), m = o.getMonth(), d = o.getDate();
    if (isNaN(d)) return n;
    var lower = s.toLowerCase();
    if (lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
      lower = lower.replace(/[^a-z]/g, "").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/, "");
      if (lower.length > 3 && lower_months.indexOf(lower) == -1) return n;
    } else if (lower.match(/[a-z]/)) return n;
    if (y < 0 || y > 8099) return n;
    if ((m > 0 || d > 1) && y != 101) return o;
    if (s.match(/[^-0-9:,\/\\]/)) return n;
    return o;
  }
  var split_regex = /* @__PURE__ */ (function() {
    var safe_split_regex = "abacaba".split(/(:?b)/i).length == 5;
    return function split_regex2(str, re, def) {
      if (safe_split_regex || typeof re == "string") return str.split(re);
      var p = str.split(re), o = [p[0]];
      for (var i = 1; i < p.length; ++i) {
        o.push(def);
        o.push(p[i]);
      }
      return o;
    };
  })();
  function getdatastr(data) {
    if (!data) return null;
    if (data.content && data.type) return cc2str(data.content, true);
    if (data.data) return debom(data.data);
    if (data.asNodeBuffer && has_buf) return debom(data.asNodeBuffer().toString("binary"));
    if (data.asBinary) return debom(data.asBinary());
    if (data._data && data._data.getContent) return debom(cc2str(Array.prototype.slice.call(data._data.getContent(), 0)));
    return null;
  }
  function getdatabin(data) {
    if (!data) return null;
    if (data.data) return char_codes(data.data);
    if (data.asNodeBuffer && has_buf) return data.asNodeBuffer();
    if (data._data && data._data.getContent) {
      var o = data._data.getContent();
      if (typeof o == "string") return char_codes(o);
      return Array.prototype.slice.call(o);
    }
    if (data.content && data.type) return data.content;
    return null;
  }
  function getdata(data) {
    return data && data.name.slice(-4) === ".bin" ? getdatabin(data) : getdatastr(data);
  }
  function safegetzipfile(zip, file) {
    var k = zip.FullPaths || keys(zip.files);
    var f = file.toLowerCase().replace(/[\/]/g, "\\"), g = f.replace(/\\/g, "/");
    for (var i = 0; i < k.length; ++i) {
      var n = k[i].replace(/^Root Entry[\/]/, "").toLowerCase();
      if (f == n || g == n) return zip.files ? zip.files[k[i]] : zip.FileIndex[i];
    }
    return null;
  }
  function getzipfile(zip, file) {
    var o = safegetzipfile(zip, file);
    if (o == null) throw new Error("Cannot find file " + file + " in zip");
    return o;
  }
  function getzipdata(zip, file, safe) {
    if (!safe) return getdata(getzipfile(zip, file));
    if (!file) return null;
    try {
      return getzipdata(zip, file);
    } catch (e) {
      return null;
    }
  }
  function getzipstr(zip, file, safe) {
    if (!safe) return getdatastr(getzipfile(zip, file));
    if (!file) return null;
    try {
      return getzipstr(zip, file);
    } catch (e) {
      return null;
    }
  }
  function getzipbin(zip, file, safe) {
    if (!safe) return getdatabin(getzipfile(zip, file));
    if (!file) return null;
    try {
      return getzipbin(zip, file);
    } catch (e) {
      return null;
    }
  }
  function zipentries(zip) {
    var k = zip.FullPaths || keys(zip.files), o = [];
    for (var i = 0; i < k.length; ++i) if (k[i].slice(-1) != "/") o.push(k[i].replace(/^Root Entry[\/]/, ""));
    return o.sort();
  }
  function zip_add_file(zip, path, content) {
    if (zip.FullPaths) {
      if (typeof content == "string") {
        var res;
        if (has_buf) res = Buffer_from(content);
        else res = utf8decode(content);
        return CFB.utils.cfb_add(zip, path, res);
      }
      CFB.utils.cfb_add(zip, path, content);
    } else zip.file(path, content);
  }
  function zip_read(d, o) {
    switch (o.type) {
      case "base64":
        return CFB.read(d, { type: "base64" });
      case "binary":
        return CFB.read(d, { type: "binary" });
      case "buffer":
      case "array":
        return CFB.read(d, { type: "buffer" });
    }
    throw new Error("Unrecognized type " + o.type);
  }
  function resolve_path(path, base) {
    if (path.charAt(0) == "/") return path.slice(1);
    var result2 = base.split("/");
    if (base.slice(-1) != "/") result2.pop();
    var target = path.split("/");
    while (target.length !== 0) {
      var step = target.shift();
      if (step === "..") result2.pop();
      else if (step !== ".") result2.push(step);
    }
    return result2.join("/");
  }
  var XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n';
  var attregexg = /([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g;
  var tagregex1 = /<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg;
  var tagregex2 = /<[^>]*>/g;
  var tagregex = /* @__PURE__ */ XML_HEADER.match(tagregex1) ? tagregex1 : tagregex2;
  var nsregex = /<\w*:/;
  var nsregex2 = /<(\/?)\w+:/;
  function parsexmltag(tag, skip_root, skip_LC) {
    var z = {};
    var eq = 0, c = 0;
    for (; eq !== tag.length; ++eq) if ((c = tag.charCodeAt(eq)) === 32 || c === 10 || c === 13) break;
    if (!skip_root) z[0] = tag.slice(0, eq);
    if (eq === tag.length) return z;
    var m = tag.match(attregexg), j = 0, v = "", i = 0, q = "", cc = "", quot = 1;
    if (m) for (i = 0; i != m.length; ++i) {
      cc = m[i];
      for (c = 0; c != cc.length; ++c) if (cc.charCodeAt(c) === 61) break;
      q = cc.slice(0, c).trim();
      while (cc.charCodeAt(c + 1) == 32) ++c;
      quot = (eq = cc.charCodeAt(c + 1)) == 34 || eq == 39 ? 1 : 0;
      v = cc.slice(c + 1 + quot, cc.length - quot);
      for (j = 0; j != q.length; ++j) if (q.charCodeAt(j) === 58) break;
      if (j === q.length) {
        if (q.indexOf("_") > 0) q = q.slice(0, q.indexOf("_"));
        z[q] = v;
        if (!skip_LC) z[q.toLowerCase()] = v;
      } else {
        var k = (j === 5 && q.slice(0, 5) === "xmlns" ? "xmlns" : "") + q.slice(j + 1);
        if (z[k] && q.slice(j - 3, j) == "ext") continue;
        z[k] = v;
        if (!skip_LC) z[k.toLowerCase()] = v;
      }
    }
    return z;
  }
  function strip_ns(x) {
    return x.replace(nsregex2, "<$1");
  }
  var encodings = {
    "&quot;": '"',
    "&apos;": "'",
    "&gt;": ">",
    "&lt;": "<",
    "&amp;": "&"
  };
  var rencoding = /* @__PURE__ */ evert(encodings);
  var unescapexml = /* @__PURE__ */ (function() {
    var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
    return function unescapexml2(text) {
      var s = text + "", i = s.indexOf("<![CDATA[");
      if (i == -1) return s.replace(encregex, function($$, $1) {
        return encodings[$$] || String.fromCharCode(parseInt($1, $$.indexOf("x") > -1 ? 16 : 10)) || $$;
      }).replace(coderegex, function(m, c) {
        return String.fromCharCode(parseInt(c, 16));
      });
      var j = s.indexOf("]]>");
      return unescapexml2(s.slice(0, i)) + s.slice(i + 9, j) + unescapexml2(s.slice(j + 3));
    };
  })();
  var decregex = /[&<>'"]/g;
  var htmlcharegex = /[\u0000-\u001f]/g;
  function escapehtml(text) {
    var s = text + "";
    return s.replace(decregex, function(y) {
      return rencoding[y];
    }).replace(/\n/g, "<br/>").replace(htmlcharegex, function(s2) {
      return "&#x" + ("000" + s2.charCodeAt(0).toString(16)).slice(-4) + ";";
    });
  }
  var xlml_fixstr = /* @__PURE__ */ (function() {
    var entregex = /&#(\d+);/g;
    function entrepl($$, $1) {
      return String.fromCharCode(parseInt($1, 10));
    }
    return function xlml_fixstr2(str) {
      return str.replace(entregex, entrepl);
    };
  })();
  function parsexmlbool(value) {
    switch (value) {
      case 1:
      case true:
      case "1":
      case "true":
      case "TRUE":
        return true;
      /* case '0': case 'false': case 'FALSE':*/
      default:
        return false;
    }
  }
  function utf8reada(orig) {
    var out = "", i = 0, c = 0, d = 0, e = 0, f = 0, w = 0;
    while (i < orig.length) {
      c = orig.charCodeAt(i++);
      if (c < 128) {
        out += String.fromCharCode(c);
        continue;
      }
      d = orig.charCodeAt(i++);
      if (c > 191 && c < 224) {
        f = (c & 31) << 6;
        f |= d & 63;
        out += String.fromCharCode(f);
        continue;
      }
      e = orig.charCodeAt(i++);
      if (c < 240) {
        out += String.fromCharCode((c & 15) << 12 | (d & 63) << 6 | e & 63);
        continue;
      }
      f = orig.charCodeAt(i++);
      w = ((c & 7) << 18 | (d & 63) << 12 | (e & 63) << 6 | f & 63) - 65536;
      out += String.fromCharCode(55296 + (w >>> 10 & 1023));
      out += String.fromCharCode(56320 + (w & 1023));
    }
    return out;
  }
  function utf8readb(data) {
    var out = new_raw_buf(2 * data.length), w, i, j = 1, k = 0, ww = 0, c;
    for (i = 0; i < data.length; i += j) {
      j = 1;
      if ((c = data.charCodeAt(i)) < 128) w = c;
      else if (c < 224) {
        w = (c & 31) * 64 + (data.charCodeAt(i + 1) & 63);
        j = 2;
      } else if (c < 240) {
        w = (c & 15) * 4096 + (data.charCodeAt(i + 1) & 63) * 64 + (data.charCodeAt(i + 2) & 63);
        j = 3;
      } else {
        j = 4;
        w = (c & 7) * 262144 + (data.charCodeAt(i + 1) & 63) * 4096 + (data.charCodeAt(i + 2) & 63) * 64 + (data.charCodeAt(i + 3) & 63);
        w -= 65536;
        ww = 55296 + (w >>> 10 & 1023);
        w = 56320 + (w & 1023);
      }
      if (ww !== 0) {
        out[k++] = ww & 255;
        out[k++] = ww >>> 8;
        ww = 0;
      }
      out[k++] = w % 256;
      out[k++] = w >>> 8;
    }
    return out.slice(0, k).toString("ucs2");
  }
  function utf8readc(data) {
    return Buffer_from(data, "binary").toString("utf8");
  }
  var utf8corpus = "foo bar baz\xE2\x98\x83\xF0\x9F\x8D\xA3";
  var utf8read = has_buf && (/* @__PURE__ */ utf8readc(utf8corpus) == /* @__PURE__ */ utf8reada(utf8corpus) && utf8readc || /* @__PURE__ */ utf8readb(utf8corpus) == /* @__PURE__ */ utf8reada(utf8corpus) && utf8readb) || utf8reada;
  var utf8write = has_buf ? function(data) {
    return Buffer_from(data, "utf8").toString("binary");
  } : function(orig) {
    var out = [], i = 0, c = 0, d = 0;
    while (i < orig.length) {
      c = orig.charCodeAt(i++);
      switch (true) {
        case c < 128:
          out.push(String.fromCharCode(c));
          break;
        case c < 2048:
          out.push(String.fromCharCode(192 + (c >> 6)));
          out.push(String.fromCharCode(128 + (c & 63)));
          break;
        case (c >= 55296 && c < 57344):
          c -= 55296;
          d = orig.charCodeAt(i++) - 56320 + (c << 10);
          out.push(String.fromCharCode(240 + (d >> 18 & 7)));
          out.push(String.fromCharCode(144 + (d >> 12 & 63)));
          out.push(String.fromCharCode(128 + (d >> 6 & 63)));
          out.push(String.fromCharCode(128 + (d & 63)));
          break;
        default:
          out.push(String.fromCharCode(224 + (c >> 12)));
          out.push(String.fromCharCode(128 + (c >> 6 & 63)));
          out.push(String.fromCharCode(128 + (c & 63)));
      }
    }
    return out.join("");
  };
  var matchtag = /* @__PURE__ */ (function() {
    var mtcache = {};
    return function matchtag2(f, g) {
      var t = f + "|" + (g || "");
      if (mtcache[t]) return mtcache[t];
      return mtcache[t] = new RegExp("<(?:\\w+:)?" + f + '(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)</(?:\\w+:)?' + f + ">", g || "");
    };
  })();
  var htmldecode = /* @__PURE__ */ (function() {
    var entities = [
      ["nbsp", " "],
      ["middot", "\xB7"],
      ["quot", '"'],
      ["apos", "'"],
      ["gt", ">"],
      ["lt", "<"],
      ["amp", "&"]
    ].map(function(x) {
      return [new RegExp("&" + x[0] + ";", "ig"), x[1]];
    });
    return function htmldecode2(str) {
      var o = str.replace(/^[\t\n\r ]+/, "").replace(/[\t\n\r ]+$/, "").replace(/>\s+/g, ">").replace(/\s+</g, "<").replace(/[\t\n\r ]+/g, " ").replace(/<\s*[bB][rR]\s*\/?>/g, "\n").replace(/<[^>]*>/g, "");
      for (var i = 0; i < entities.length; ++i) o = o.replace(entities[i][0], entities[i][1]);
      return o;
    };
  })();
  var vtregex = /* @__PURE__ */ (function() {
    var vt_cache = {};
    return function vt_regex(bt) {
      if (vt_cache[bt] !== void 0) return vt_cache[bt];
      return vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)</(?:vt:)?" + bt + ">", "g");
    };
  })();
  var vtvregex = /<\/?(?:vt:)?variant>/g;
  var vtmregex = /<(?:vt:)([^>]*)>([\s\S]*)</;
  function parseVector(data, opts) {
    var h = parsexmltag(data);
    var matches = data.match(vtregex(h.baseType)) || [];
    var res = [];
    if (matches.length != h.size) {
      if (opts.WTF) throw new Error("unexpected vector length " + matches.length + " != " + h.size);
      return res;
    }
    matches.forEach(function(x) {
      var v = x.replace(vtvregex, "").match(vtmregex);
      if (v) res.push({ v: utf8read(v[2]), t: v[1] });
    });
    return res;
  }
  var wtregex = /(^\s|\s$|\n)/;
  function wxt_helper(h) {
    return keys(h).map(function(k) {
      return " " + k + '="' + h[k] + '"';
    }).join("");
  }
  function writextag(f, g, h) {
    return "<" + f + (h != null ? wxt_helper(h) : "") + (g != null ? (g.match(wtregex) ? ' xml:space="preserve"' : "") + ">" + g + "</" + f : "/") + ">";
  }
  function xlml_normalize(d) {
    if (has_buf && /*::typeof Buffer !== "undefined" && d != null && d instanceof Buffer &&*/
    Buffer.isBuffer(d)) return d.toString("utf8");
    if (typeof d === "string") return d;
    if (typeof Uint8Array !== "undefined" && d instanceof Uint8Array) return utf8read(a2s(ab2a(d)));
    throw new Error("Bad input format: expected Buffer or string");
  }
  var xlmlregex = /<(\/?)([^\s?><!\/:]*:|)([^\s?<>:\/]+)(?:[\s?:\/][^>]*)?>/mg;
  var XMLNS = {
    CORE_PROPS: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
    CUST_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
    EXT_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",
    CT: "http://schemas.openxmlformats.org/package/2006/content-types",
    RELS: "http://schemas.openxmlformats.org/package/2006/relationships",
    TCMNT: "http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments",
    "dc": "http://purl.org/dc/elements/1.1/",
    "dcterms": "http://purl.org/dc/terms/",
    "dcmitype": "http://purl.org/dc/dcmitype/",
    "mx": "http://schemas.microsoft.com/office/mac/excel/2008/main",
    "r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
    "sjs": "http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties",
    "vt": "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",
    "xsi": "http://www.w3.org/2001/XMLSchema-instance",
    "xsd": "http://www.w3.org/2001/XMLSchema"
  };
  var XMLNS_main = [
    "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
    "http://purl.oclc.org/ooxml/spreadsheetml/main",
    "http://schemas.microsoft.com/office/excel/2006/main",
    "http://schemas.microsoft.com/office/excel/2006/2"
  ];
  function read_double_le(b, idx) {
    var s = 1 - 2 * (b[idx + 7] >>> 7);
    var e = ((b[idx + 7] & 127) << 4) + (b[idx + 6] >>> 4 & 15);
    var m = b[idx + 6] & 15;
    for (var i = 5; i >= 0; --i) m = m * 256 + b[idx + i];
    if (e == 2047) return m == 0 ? s * Infinity : NaN;
    if (e == 0) e = -1022;
    else {
      e -= 1023;
      m += Math.pow(2, 52);
    }
    return s * Math.pow(2, e - 52) * m;
  }
  function write_double_le(b, v, idx) {
    var bs = (v < 0 || 1 / v == -Infinity ? 1 : 0) << 7, e = 0, m = 0;
    var av = bs ? -v : v;
    if (!isFinite(av)) {
      e = 2047;
      m = isNaN(v) ? 26985 : 0;
    } else if (av == 0) e = m = 0;
    else {
      e = Math.floor(Math.log(av) / Math.LN2);
      m = av * Math.pow(2, 52 - e);
      if (e <= -1023 && (!isFinite(m) || m < Math.pow(2, 52))) {
        e = -1022;
      } else {
        m -= Math.pow(2, 52);
        e += 1023;
      }
    }
    for (var i = 0; i <= 5; ++i, m /= 256) b[idx + i] = m & 255;
    b[idx + 6] = (e & 15) << 4 | m & 15;
    b[idx + 7] = e >> 4 | bs;
  }
  var ___toBuffer = function(bufs) {
    var x = [], w = 10240;
    for (var i = 0; i < bufs[0].length; ++i) if (bufs[0][i]) for (var j = 0, L = bufs[0][i].length; j < L; j += w) x.push.apply(x, bufs[0][i].slice(j, j + w));
    return x;
  };
  var __toBuffer = has_buf ? function(bufs) {
    return bufs[0].length > 0 && Buffer.isBuffer(bufs[0][0]) ? Buffer.concat(bufs[0].map(function(x) {
      return Buffer.isBuffer(x) ? x : Buffer_from(x);
    })) : ___toBuffer(bufs);
  } : ___toBuffer;
  var ___utf16le = function(b, s, e) {
    var ss = [];
    for (var i = s; i < e; i += 2) ss.push(String.fromCharCode(__readUInt16LE(b, i)));
    return ss.join("").replace(chr0, "");
  };
  var __utf16le = has_buf ? function(b, s, e) {
    if (!Buffer.isBuffer(b)) return ___utf16le(b, s, e);
    return b.toString("utf16le", s, e).replace(chr0, "");
  } : ___utf16le;
  var ___hexlify = function(b, s, l2) {
    var ss = [];
    for (var i = s; i < s + l2; ++i) ss.push(("0" + b[i].toString(16)).slice(-2));
    return ss.join("");
  };
  var __hexlify = has_buf ? function(b, s, l2) {
    return Buffer.isBuffer(b) ? b.toString("hex", s, s + l2) : ___hexlify(b, s, l2);
  } : ___hexlify;
  var ___utf8 = function(b, s, e) {
    var ss = [];
    for (var i = s; i < e; i++) ss.push(String.fromCharCode(__readUInt8(b, i)));
    return ss.join("");
  };
  var __utf8 = has_buf ? function utf8_b(b, s, e) {
    return Buffer.isBuffer(b) ? b.toString("utf8", s, e) : ___utf8(b, s, e);
  } : ___utf8;
  var ___lpstr = function(b, i) {
    var len = __readUInt32LE(b, i);
    return len > 0 ? __utf8(b, i + 4, i + 4 + len - 1) : "";
  };
  var __lpstr = ___lpstr;
  var ___cpstr = function(b, i) {
    var len = __readUInt32LE(b, i);
    return len > 0 ? __utf8(b, i + 4, i + 4 + len - 1) : "";
  };
  var __cpstr = ___cpstr;
  var ___lpwstr = function(b, i) {
    var len = 2 * __readUInt32LE(b, i);
    return len > 0 ? __utf8(b, i + 4, i + 4 + len - 1) : "";
  };
  var __lpwstr = ___lpwstr;
  var ___lpp4 = function lpp4_(b, i) {
    var len = __readUInt32LE(b, i);
    return len > 0 ? __utf16le(b, i + 4, i + 4 + len) : "";
  };
  var __lpp4 = ___lpp4;
  var ___8lpp4 = function(b, i) {
    var len = __readUInt32LE(b, i);
    return len > 0 ? __utf8(b, i + 4, i + 4 + len) : "";
  };
  var __8lpp4 = ___8lpp4;
  var ___double = function(b, idx) {
    return read_double_le(b, idx);
  };
  var __double = ___double;
  var is_buf = function is_buf_a(a) {
    return Array.isArray(a) || typeof Uint8Array !== "undefined" && a instanceof Uint8Array;
  };
  if (has_buf) {
    __lpstr = function lpstr_b(b, i) {
      if (!Buffer.isBuffer(b)) return ___lpstr(b, i);
      var len = b.readUInt32LE(i);
      return len > 0 ? b.toString("utf8", i + 4, i + 4 + len - 1) : "";
    };
    __cpstr = function cpstr_b(b, i) {
      if (!Buffer.isBuffer(b)) return ___cpstr(b, i);
      var len = b.readUInt32LE(i);
      return len > 0 ? b.toString("utf8", i + 4, i + 4 + len - 1) : "";
    };
    __lpwstr = function lpwstr_b(b, i) {
      if (!Buffer.isBuffer(b)) return ___lpwstr(b, i);
      var len = 2 * b.readUInt32LE(i);
      return b.toString("utf16le", i + 4, i + 4 + len - 1);
    };
    __lpp4 = function lpp4_b(b, i) {
      if (!Buffer.isBuffer(b)) return ___lpp4(b, i);
      var len = b.readUInt32LE(i);
      return b.toString("utf16le", i + 4, i + 4 + len);
    };
    __8lpp4 = function lpp4_8b(b, i) {
      if (!Buffer.isBuffer(b)) return ___8lpp4(b, i);
      var len = b.readUInt32LE(i);
      return b.toString("utf8", i + 4, i + 4 + len);
    };
    __double = function double_(b, i) {
      if (Buffer.isBuffer(b)) return b.readDoubleLE(i);
      return ___double(b, i);
    };
    is_buf = function is_buf_b(a) {
      return Buffer.isBuffer(a) || Array.isArray(a) || typeof Uint8Array !== "undefined" && a instanceof Uint8Array;
    };
  }
  function cpdoit() {
    __utf16le = function(b, s, e) {
      return $cptable.utils.decode(1200, b.slice(s, e)).replace(chr0, "");
    };
    __utf8 = function(b, s, e) {
      return $cptable.utils.decode(65001, b.slice(s, e));
    };
    __lpstr = function(b, i) {
      var len = __readUInt32LE(b, i);
      return len > 0 ? $cptable.utils.decode(current_ansi, b.slice(i + 4, i + 4 + len - 1)) : "";
    };
    __cpstr = function(b, i) {
      var len = __readUInt32LE(b, i);
      return len > 0 ? $cptable.utils.decode(current_codepage, b.slice(i + 4, i + 4 + len - 1)) : "";
    };
    __lpwstr = function(b, i) {
      var len = 2 * __readUInt32LE(b, i);
      return len > 0 ? $cptable.utils.decode(1200, b.slice(i + 4, i + 4 + len - 1)) : "";
    };
    __lpp4 = function(b, i) {
      var len = __readUInt32LE(b, i);
      return len > 0 ? $cptable.utils.decode(1200, b.slice(i + 4, i + 4 + len)) : "";
    };
    __8lpp4 = function(b, i) {
      var len = __readUInt32LE(b, i);
      return len > 0 ? $cptable.utils.decode(65001, b.slice(i + 4, i + 4 + len)) : "";
    };
  }
  if (typeof $cptable !== "undefined") cpdoit();
  var __readUInt8 = function(b, idx) {
    return b[idx];
  };
  var __readUInt16LE = function(b, idx) {
    return b[idx + 1] * (1 << 8) + b[idx];
  };
  var __readInt16LE = function(b, idx) {
    var u = b[idx + 1] * (1 << 8) + b[idx];
    return u < 32768 ? u : (65535 - u + 1) * -1;
  };
  var __readUInt32LE = function(b, idx) {
    return b[idx + 3] * (1 << 24) + (b[idx + 2] << 16) + (b[idx + 1] << 8) + b[idx];
  };
  var __readInt32LE = function(b, idx) {
    return b[idx + 3] << 24 | b[idx + 2] << 16 | b[idx + 1] << 8 | b[idx];
  };
  var __readInt32BE = function(b, idx) {
    return b[idx] << 24 | b[idx + 1] << 16 | b[idx + 2] << 8 | b[idx + 3];
  };
  function ReadShift(size2, t) {
    var o = "", oI, oR, oo = [], w, vv, i, loc;
    switch (t) {
      case "dbcs":
        loc = this.l;
        if (has_buf && Buffer.isBuffer(this)) o = this.slice(this.l, this.l + 2 * size2).toString("utf16le");
        else for (i = 0; i < size2; ++i) {
          o += String.fromCharCode(__readUInt16LE(this, loc));
          loc += 2;
        }
        size2 *= 2;
        break;
      case "utf8":
        o = __utf8(this, this.l, this.l + size2);
        break;
      case "utf16le":
        size2 *= 2;
        o = __utf16le(this, this.l, this.l + size2);
        break;
      case "wstr":
        if (typeof $cptable !== "undefined") o = $cptable.utils.decode(current_codepage, this.slice(this.l, this.l + 2 * size2));
        else return ReadShift.call(this, size2, "dbcs");
        size2 = 2 * size2;
        break;
      /* [MS-OLEDS] 2.1.4 LengthPrefixedAnsiString */
      case "lpstr-ansi":
        o = __lpstr(this, this.l);
        size2 = 4 + __readUInt32LE(this, this.l);
        break;
      case "lpstr-cp":
        o = __cpstr(this, this.l);
        size2 = 4 + __readUInt32LE(this, this.l);
        break;
      /* [MS-OLEDS] 2.1.5 LengthPrefixedUnicodeString */
      case "lpwstr":
        o = __lpwstr(this, this.l);
        size2 = 4 + 2 * __readUInt32LE(this, this.l);
        break;
      /* [MS-OFFCRYPTO] 2.1.2 Length-Prefixed Padded Unicode String (UNICODE-LP-P4) */
      case "lpp4":
        size2 = 4 + __readUInt32LE(this, this.l);
        o = __lpp4(this, this.l);
        if (size2 & 2) size2 += 2;
        break;
      /* [MS-OFFCRYPTO] 2.1.3 Length-Prefixed UTF-8 String (UTF-8-LP-P4) */
      case "8lpp4":
        size2 = 4 + __readUInt32LE(this, this.l);
        o = __8lpp4(this, this.l);
        if (size2 & 3) size2 += 4 - (size2 & 3);
        break;
      case "cstr":
        size2 = 0;
        o = "";
        while ((w = __readUInt8(this, this.l + size2++)) !== 0) oo.push(_getchar(w));
        o = oo.join("");
        break;
      case "_wstr":
        size2 = 0;
        o = "";
        while ((w = __readUInt16LE(this, this.l + size2)) !== 0) {
          oo.push(_getchar(w));
          size2 += 2;
        }
        size2 += 2;
        o = oo.join("");
        break;
      /* sbcs and dbcs support continue records in the SST way TODO codepages */
      case "dbcs-cont":
        o = "";
        loc = this.l;
        for (i = 0; i < size2; ++i) {
          if (this.lens && this.lens.indexOf(loc) !== -1) {
            w = __readUInt8(this, loc);
            this.l = loc + 1;
            vv = ReadShift.call(this, size2 - i, w ? "dbcs-cont" : "sbcs-cont");
            return oo.join("") + vv;
          }
          oo.push(_getchar(__readUInt16LE(this, loc)));
          loc += 2;
        }
        o = oo.join("");
        size2 *= 2;
        break;
      case "cpstr":
        if (typeof $cptable !== "undefined") {
          o = $cptable.utils.decode(current_codepage, this.slice(this.l, this.l + size2));
          break;
        }
      /* falls through */
      case "sbcs-cont":
        o = "";
        loc = this.l;
        for (i = 0; i != size2; ++i) {
          if (this.lens && this.lens.indexOf(loc) !== -1) {
            w = __readUInt8(this, loc);
            this.l = loc + 1;
            vv = ReadShift.call(this, size2 - i, w ? "dbcs-cont" : "sbcs-cont");
            return oo.join("") + vv;
          }
          oo.push(_getchar(__readUInt8(this, loc)));
          loc += 1;
        }
        o = oo.join("");
        break;
      default:
        switch (size2) {
          case 1:
            oI = __readUInt8(this, this.l);
            this.l++;
            return oI;
          case 2:
            oI = (t === "i" ? __readInt16LE : __readUInt16LE)(this, this.l);
            this.l += 2;
            return oI;
          case 4:
          case -4:
            if (t === "i" || (this[this.l + 3] & 128) === 0) {
              oI = (size2 > 0 ? __readInt32LE : __readInt32BE)(this, this.l);
              this.l += 4;
              return oI;
            } else {
              oR = __readUInt32LE(this, this.l);
              this.l += 4;
            }
            return oR;
          case 8:
          case -8:
            if (t === "f") {
              if (size2 == 8) oR = __double(this, this.l);
              else oR = __double([this[this.l + 7], this[this.l + 6], this[this.l + 5], this[this.l + 4], this[this.l + 3], this[this.l + 2], this[this.l + 1], this[this.l + 0]], 0);
              this.l += 8;
              return oR;
            } else size2 = 8;
          /* falls through */
          case 16:
            o = __hexlify(this, this.l, size2);
            break;
        }
    }
    this.l += size2;
    return o;
  }
  var __writeUInt32LE = function(b, val, idx) {
    b[idx] = val & 255;
    b[idx + 1] = val >>> 8 & 255;
    b[idx + 2] = val >>> 16 & 255;
    b[idx + 3] = val >>> 24 & 255;
  };
  var __writeInt32LE = function(b, val, idx) {
    b[idx] = val & 255;
    b[idx + 1] = val >> 8 & 255;
    b[idx + 2] = val >> 16 & 255;
    b[idx + 3] = val >> 24 & 255;
  };
  var __writeUInt16LE = function(b, val, idx) {
    b[idx] = val & 255;
    b[idx + 1] = val >>> 8 & 255;
  };
  function WriteShift(t, val, f) {
    var size2 = 0, i = 0;
    if (f === "dbcs") {
      for (i = 0; i != val.length; ++i) __writeUInt16LE(this, val.charCodeAt(i), this.l + 2 * i);
      size2 = 2 * val.length;
    } else if (f === "sbcs") {
      if (typeof $cptable !== "undefined" && current_ansi == 874) {
        for (i = 0; i != val.length; ++i) {
          var cppayload = $cptable.utils.encode(current_ansi, val.charAt(i));
          this[this.l + i] = cppayload[0];
        }
      } else {
        val = val.replace(/[^\x00-\x7F]/g, "_");
        for (i = 0; i != val.length; ++i) this[this.l + i] = val.charCodeAt(i) & 255;
      }
      size2 = val.length;
    } else if (f === "hex") {
      for (; i < t; ++i) {
        this[this.l++] = parseInt(val.slice(2 * i, 2 * i + 2), 16) || 0;
      }
      return this;
    } else if (f === "utf16le") {
      var end = Math.min(this.l + t, this.length);
      for (i = 0; i < Math.min(val.length, t); ++i) {
        var cc = val.charCodeAt(i);
        this[this.l++] = cc & 255;
        this[this.l++] = cc >> 8;
      }
      while (this.l < end) this[this.l++] = 0;
      return this;
    } else switch (t) {
      case 1:
        size2 = 1;
        this[this.l] = val & 255;
        break;
      case 2:
        size2 = 2;
        this[this.l] = val & 255;
        val >>>= 8;
        this[this.l + 1] = val & 255;
        break;
      case 3:
        size2 = 3;
        this[this.l] = val & 255;
        val >>>= 8;
        this[this.l + 1] = val & 255;
        val >>>= 8;
        this[this.l + 2] = val & 255;
        break;
      case 4:
        size2 = 4;
        __writeUInt32LE(this, val, this.l);
        break;
      case 8:
        size2 = 8;
        if (f === "f") {
          write_double_le(this, val, this.l);
          break;
        }
      /* falls through */
      case 16:
        break;
      case -4:
        size2 = 4;
        __writeInt32LE(this, val, this.l);
        break;
    }
    this.l += size2;
    return this;
  }
  function CheckField(hexstr, fld) {
    var m = __hexlify(this, this.l, hexstr.length >> 1);
    if (m !== hexstr) throw new Error(fld + "Expected " + hexstr + " saw " + m);
    this.l += hexstr.length >> 1;
  }
  function prep_blob(blob, pos) {
    blob.l = pos;
    blob.read_shift = /*::(*/
    ReadShift;
    blob.chk = CheckField;
    blob.write_shift = WriteShift;
  }
  function parsenoop(blob, length) {
    blob.l += length;
  }
  function new_buf(sz) {
    var o = new_raw_buf(sz);
    prep_blob(o, 0);
    return o;
  }
  function recordhopper(data, cb2, opts) {
    if (!data) return;
    var tmpbyte, cntbyte, length;
    prep_blob(data, data.l || 0);
    var L = data.length, RT = 0, tgt = 0;
    while (data.l < L) {
      RT = data.read_shift(1);
      if (RT & 128) RT = (RT & 127) + ((data.read_shift(1) & 127) << 7);
      var R = XLSBRecordEnum[RT] || XLSBRecordEnum[65535];
      tmpbyte = data.read_shift(1);
      length = tmpbyte & 127;
      for (cntbyte = 1; cntbyte < 4 && tmpbyte & 128; ++cntbyte) length += ((tmpbyte = data.read_shift(1)) & 127) << 7 * cntbyte;
      tgt = data.l + length;
      var d = R.f && R.f(data, length, opts);
      data.l = tgt;
      if (cb2(d, R, RT)) return;
    }
  }
  function buf_array() {
    var bufs = [], blksz = has_buf ? 256 : 2048;
    var newblk = function ba_newblk(sz) {
      var o = new_buf(sz);
      prep_blob(o, 0);
      return o;
    };
    var curbuf = newblk(blksz);
    var endbuf = function ba_endbuf() {
      if (!curbuf) return;
      if (curbuf.length > curbuf.l) {
        curbuf = curbuf.slice(0, curbuf.l);
        curbuf.l = curbuf.length;
      }
      if (curbuf.length > 0) bufs.push(curbuf);
      curbuf = null;
    };
    var next2 = function ba_next(sz) {
      if (curbuf && sz < curbuf.length - curbuf.l) return curbuf;
      endbuf();
      return curbuf = newblk(Math.max(sz + 1, blksz));
    };
    var end = function ba_end() {
      endbuf();
      return bconcat(bufs);
    };
    var push2 = function ba_push(buf) {
      endbuf();
      curbuf = buf;
      if (curbuf.l == null) curbuf.l = curbuf.length;
      next2(blksz);
    };
    return { next: next2, push: push2, end, _bufs: bufs };
  }
  function shift_cell_xls(cell, tgt, opts) {
    var out = dup(cell);
    if (tgt.s) {
      if (out.cRel) out.c += tgt.s.c;
      if (out.rRel) out.r += tgt.s.r;
    } else {
      if (out.cRel) out.c += tgt.c;
      if (out.rRel) out.r += tgt.r;
    }
    if (!opts || opts.biff < 12) {
      while (out.c >= 256) out.c -= 256;
      while (out.r >= 65536) out.r -= 65536;
    }
    return out;
  }
  function shift_range_xls(cell, range2, opts) {
    var out = dup(cell);
    out.s = shift_cell_xls(out.s, range2.s, opts);
    out.e = shift_cell_xls(out.e, range2.s, opts);
    return out;
  }
  function encode_cell_xls(c, biff) {
    if (c.cRel && c.c < 0) {
      c = dup(c);
      while (c.c < 0) c.c += biff > 8 ? 16384 : 256;
    }
    if (c.rRel && c.r < 0) {
      c = dup(c);
      while (c.r < 0) c.r += biff > 8 ? 1048576 : biff > 5 ? 65536 : 16384;
    }
    var s = encode_cell(c);
    if (!c.cRel && c.cRel != null) s = fix_col(s);
    if (!c.rRel && c.rRel != null) s = fix_row(s);
    return s;
  }
  function encode_range_xls(r, opts) {
    if (r.s.r == 0 && !r.s.rRel) {
      if (r.e.r == (opts.biff >= 12 ? 1048575 : opts.biff >= 8 ? 65536 : 16384) && !r.e.rRel) {
        return (r.s.cRel ? "" : "$") + encode_col(r.s.c) + ":" + (r.e.cRel ? "" : "$") + encode_col(r.e.c);
      }
    }
    if (r.s.c == 0 && !r.s.cRel) {
      if (r.e.c == (opts.biff >= 12 ? 16383 : 255) && !r.e.cRel) {
        return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r);
      }
    }
    return encode_cell_xls(r.s, opts.biff) + ":" + encode_cell_xls(r.e, opts.biff);
  }
  function decode_row(rowstr) {
    return parseInt(unfix_row(rowstr), 10) - 1;
  }
  function encode_row(row) {
    return "" + (row + 1);
  }
  function fix_row(cstr) {
    return cstr.replace(/([A-Z]|^)(\d+)$/, "$1$$$2");
  }
  function unfix_row(cstr) {
    return cstr.replace(/\$(\d+)$/, "$1");
  }
  function decode_col(colstr) {
    var c = unfix_col(colstr), d = 0, i = 0;
    for (; i !== c.length; ++i) d = 26 * d + c.charCodeAt(i) - 64;
    return d - 1;
  }
  function encode_col(col) {
    if (col < 0) throw new Error("invalid column " + col);
    var s = "";
    for (++col; col; col = Math.floor((col - 1) / 26)) s = String.fromCharCode((col - 1) % 26 + 65) + s;
    return s;
  }
  function fix_col(cstr) {
    return cstr.replace(/^([A-Z])/, "$$$1");
  }
  function unfix_col(cstr) {
    return cstr.replace(/^\$([A-Z])/, "$1");
  }
  function split_cell(cstr) {
    return cstr.replace(/(\$?[A-Z]*)(\$?\d*)/, "$1,$2").split(",");
  }
  function decode_cell(cstr) {
    var R = 0, C = 0;
    for (var i = 0; i < cstr.length; ++i) {
      var cc = cstr.charCodeAt(i);
      if (cc >= 48 && cc <= 57) R = 10 * R + (cc - 48);
      else if (cc >= 65 && cc <= 90) C = 26 * C + (cc - 64);
    }
    return { c: C - 1, r: R - 1 };
  }
  function encode_cell(cell) {
    var col = cell.c + 1;
    var s = "";
    for (; col; col = (col - 1) / 26 | 0) s = String.fromCharCode((col - 1) % 26 + 65) + s;
    return s + (cell.r + 1);
  }
  function decode_range(range2) {
    var idx = range2.indexOf(":");
    if (idx == -1) return { s: decode_cell(range2), e: decode_cell(range2) };
    return { s: decode_cell(range2.slice(0, idx)), e: decode_cell(range2.slice(idx + 1)) };
  }
  function encode_range(cs, ce) {
    if (typeof ce === "undefined" || typeof ce === "number") {
      return encode_range(cs.s, cs.e);
    }
    if (typeof cs !== "string") cs = encode_cell(cs);
    if (typeof ce !== "string") ce = encode_cell(ce);
    return cs == ce ? cs : cs + ":" + ce;
  }
  function safe_decode_range(range2) {
    var o = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
    var idx = 0, i = 0, cc = 0;
    var len = range2.length;
    for (idx = 0; i < len; ++i) {
      if ((cc = range2.charCodeAt(i) - 64) < 1 || cc > 26) break;
      idx = 26 * idx + cc;
    }
    o.s.c = --idx;
    for (idx = 0; i < len; ++i) {
      if ((cc = range2.charCodeAt(i) - 48) < 0 || cc > 9) break;
      idx = 10 * idx + cc;
    }
    o.s.r = --idx;
    if (i === len || cc != 10) {
      o.e.c = o.s.c;
      o.e.r = o.s.r;
      return o;
    }
    ++i;
    for (idx = 0; i != len; ++i) {
      if ((cc = range2.charCodeAt(i) - 64) < 1 || cc > 26) break;
      idx = 26 * idx + cc;
    }
    o.e.c = --idx;
    for (idx = 0; i != len; ++i) {
      if ((cc = range2.charCodeAt(i) - 48) < 0 || cc > 9) break;
      idx = 10 * idx + cc;
    }
    o.e.r = --idx;
    return o;
  }
  function safe_format_cell(cell, v) {
    var q = cell.t == "d" && v instanceof Date;
    if (cell.z != null) try {
      return cell.w = SSF_format(cell.z, q ? datenum(v) : v);
    } catch (e) {
    }
    try {
      return cell.w = SSF_format((cell.XF || {}).numFmtId || (q ? 14 : 0), q ? datenum(v) : v);
    } catch (e) {
      return "" + v;
    }
  }
  function format_cell(cell, v, o) {
    if (cell == null || cell.t == null || cell.t == "z") return "";
    if (cell.w !== void 0) return cell.w;
    if (cell.t == "d" && !cell.z && o && o.dateNF) cell.z = o.dateNF;
    if (cell.t == "e") return BErr[cell.v] || cell.v;
    if (v == void 0) return safe_format_cell(cell, cell.v);
    return safe_format_cell(cell, v);
  }
  function sheet_to_workbook(sheet, opts) {
    var n = opts && opts.sheet ? opts.sheet : "Sheet1";
    var sheets = {};
    sheets[n] = sheet;
    return { SheetNames: [n], Sheets: sheets };
  }
  function sheet_add_aoa(_ws, data, opts) {
    var o = opts || {};
    var dense = _ws ? Array.isArray(_ws) : o.dense;
    if (DENSE != null && dense == null) dense = DENSE;
    var ws = _ws || (dense ? [] : {});
    var _R = 0, _C = 0;
    if (ws && o.origin != null) {
      if (typeof o.origin == "number") _R = o.origin;
      else {
        var _origin = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin;
        _R = _origin.r;
        _C = _origin.c;
      }
      if (!ws["!ref"]) ws["!ref"] = "A1:A1";
    }
    var range2 = { s: { c: 1e7, r: 1e7 }, e: { c: 0, r: 0 } };
    if (ws["!ref"]) {
      var _range = safe_decode_range(ws["!ref"]);
      range2.s.c = _range.s.c;
      range2.s.r = _range.s.r;
      range2.e.c = Math.max(range2.e.c, _range.e.c);
      range2.e.r = Math.max(range2.e.r, _range.e.r);
      if (_R == -1) range2.e.r = _R = _range.e.r + 1;
    }
    for (var R = 0; R != data.length; ++R) {
      if (!data[R]) continue;
      if (!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays");
      for (var C = 0; C != data[R].length; ++C) {
        if (typeof data[R][C] === "undefined") continue;
        var cell = { v: data[R][C] };
        var __R = _R + R, __C = _C + C;
        if (range2.s.r > __R) range2.s.r = __R;
        if (range2.s.c > __C) range2.s.c = __C;
        if (range2.e.r < __R) range2.e.r = __R;
        if (range2.e.c < __C) range2.e.c = __C;
        if (data[R][C] && typeof data[R][C] === "object" && !Array.isArray(data[R][C]) && !(data[R][C] instanceof Date)) cell = data[R][C];
        else {
          if (Array.isArray(cell.v)) {
            cell.f = data[R][C][1];
            cell.v = cell.v[0];
          }
          if (cell.v === null) {
            if (cell.f) cell.t = "n";
            else if (o.nullError) {
              cell.t = "e";
              cell.v = 0;
            } else if (!o.sheetStubs) continue;
            else cell.t = "z";
          } else if (typeof cell.v === "number") cell.t = "n";
          else if (typeof cell.v === "boolean") cell.t = "b";
          else if (cell.v instanceof Date) {
            cell.z = o.dateNF || table_fmt[14];
            if (o.cellDates) {
              cell.t = "d";
              cell.w = SSF_format(cell.z, datenum(cell.v));
            } else {
              cell.t = "n";
              cell.v = datenum(cell.v);
              cell.w = SSF_format(cell.z, cell.v);
            }
          } else cell.t = "s";
        }
        if (dense) {
          if (!ws[__R]) ws[__R] = [];
          if (ws[__R][__C] && ws[__R][__C].z) cell.z = ws[__R][__C].z;
          ws[__R][__C] = cell;
        } else {
          var cell_ref = encode_cell({ c: __C, r: __R });
          if (ws[cell_ref] && ws[cell_ref].z) cell.z = ws[cell_ref].z;
          ws[cell_ref] = cell;
        }
      }
    }
    if (range2.s.c < 1e7) ws["!ref"] = encode_range(range2);
    return ws;
  }
  function aoa_to_sheet(data, opts) {
    return sheet_add_aoa(null, data, opts);
  }
  function parse_Int32LE(data) {
    return data.read_shift(4, "i");
  }
  function parse_XLWideString(data) {
    var cchCharacters = data.read_shift(4);
    return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "dbcs");
  }
  function parse_StrRun(data) {
    return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
  }
  function parse_RichStr(data, length) {
    var start = data.l;
    var flags = data.read_shift(1);
    var str = parse_XLWideString(data);
    var rgsStrRun = [];
    var z = { t: str, h: str };
    if ((flags & 1) !== 0) {
      var dwSizeStrRun = data.read_shift(4);
      for (var i = 0; i != dwSizeStrRun; ++i) rgsStrRun.push(parse_StrRun(data));
      z.r = rgsStrRun;
    } else z.r = [{ ich: 0, ifnt: 0 }];
    data.l = start + length;
    return z;
  }
  var parse_BrtCommentText = parse_RichStr;
  function parse_XLSBCell(data) {
    var col = data.read_shift(4);
    var iStyleRef = data.read_shift(2);
    iStyleRef += data.read_shift(1) << 16;
    data.l++;
    return { c: col, iStyleRef };
  }
  function parse_XLSBShortCell(data) {
    var iStyleRef = data.read_shift(2);
    iStyleRef += data.read_shift(1) << 16;
    data.l++;
    return { c: -1, iStyleRef };
  }
  var parse_XLSBCodeName = parse_XLWideString;
  function parse_XLNullableWideString(data) {
    var cchCharacters = data.read_shift(4);
    return cchCharacters === 0 || cchCharacters === 4294967295 ? "" : data.read_shift(cchCharacters, "dbcs");
  }
  var parse_XLNameWideString = parse_XLWideString;
  var parse_RelID = parse_XLNullableWideString;
  function parse_RkNumber(data) {
    var b = data.slice(data.l, data.l + 4);
    var fX100 = b[0] & 1, fInt = b[0] & 2;
    data.l += 4;
    var RK = fInt === 0 ? __double([0, 0, 0, 0, b[0] & 252, b[1], b[2], b[3]], 0) : __readInt32LE(b, 0) >> 2;
    return fX100 ? RK / 100 : RK;
  }
  function parse_RfX(data) {
    var cell = { s: {}, e: {} };
    cell.s.r = data.read_shift(4);
    cell.e.r = data.read_shift(4);
    cell.s.c = data.read_shift(4);
    cell.e.c = data.read_shift(4);
    return cell;
  }
  var parse_UncheckedRfX = parse_RfX;
  function parse_Xnum(data) {
    if (data.length - data.l < 8) throw "XLS Xnum Buffer underflow";
    return data.read_shift(8, "f");
  }
  function parse_BrtColor(data) {
    var out = {};
    var d = data.read_shift(1);
    var xColorType = d >>> 1;
    var index = data.read_shift(1);
    var nTS = data.read_shift(2, "i");
    var bR = data.read_shift(1);
    var bG = data.read_shift(1);
    var bB = data.read_shift(1);
    data.l++;
    switch (xColorType) {
      case 0:
        out.auto = 1;
        break;
      case 1:
        out.index = index;
        var icv = XLSIcv[index];
        if (icv) out.rgb = rgb2Hex(icv);
        break;
      case 2:
        out.rgb = rgb2Hex([bR, bG, bB]);
        break;
      case 3:
        out.theme = index;
        break;
    }
    if (nTS != 0) out.tint = nTS > 0 ? nTS / 32767 : nTS / 32768;
    return out;
  }
  function parse_FontFlags(data) {
    var d = data.read_shift(1);
    data.l++;
    var out = {
      fBold: d & 1,
      fItalic: d & 2,
      fUnderline: d & 4,
      fStrikeout: d & 8,
      fOutline: d & 16,
      fShadow: d & 32,
      fCondense: d & 64,
      fExtend: d & 128
    };
    return out;
  }
  function parse_ClipboardFormatOrString(o, w) {
    var ClipFmt = { 2: "BITMAP", 3: "METAFILEPICT", 8: "DIB", 14: "ENHMETAFILE" };
    var m = o.read_shift(4);
    switch (m) {
      case 0:
        return "";
      case 4294967295:
      case 4294967294:
        return ClipFmt[o.read_shift(4)] || "";
    }
    if (m > 400) throw new Error("Unsupported Clipboard: " + m.toString(16));
    o.l -= 4;
    return o.read_shift(0, w == 1 ? "lpstr" : "lpwstr");
  }
  function parse_ClipboardFormatOrAnsiString(o) {
    return parse_ClipboardFormatOrString(o, 1);
  }
  function parse_ClipboardFormatOrUnicodeString(o) {
    return parse_ClipboardFormatOrString(o, 2);
  }
  var VT_I2 = 2;
  var VT_I4 = 3;
  var VT_BOOL = 11;
  var VT_VARIANT = 12;
  var VT_UI4 = 19;
  var VT_FILETIME = 64;
  var VT_BLOB = 65;
  var VT_CF = 71;
  var VT_VECTOR_VARIANT = 4108;
  var VT_VECTOR_LPSTR = 4126;
  var VT_STRING = 80;
  var VT_USTR = 81;
  var VT_CUSTOM = [VT_STRING, VT_USTR];
  var DocSummaryPIDDSI = {
    /*::[*/
    1: { n: "CodePage", t: VT_I2 },
    /*::[*/
    2: { n: "Category", t: VT_STRING },
    /*::[*/
    3: { n: "PresentationFormat", t: VT_STRING },
    /*::[*/
    4: { n: "ByteCount", t: VT_I4 },
    /*::[*/
    5: { n: "LineCount", t: VT_I4 },
    /*::[*/
    6: { n: "ParagraphCount", t: VT_I4 },
    /*::[*/
    7: { n: "SlideCount", t: VT_I4 },
    /*::[*/
    8: { n: "NoteCount", t: VT_I4 },
    /*::[*/
    9: { n: "HiddenCount", t: VT_I4 },
    /*::[*/
    10: { n: "MultimediaClipCount", t: VT_I4 },
    /*::[*/
    11: { n: "ScaleCrop", t: VT_BOOL },
    /*::[*/
    12: {
      n: "HeadingPairs",
      t: VT_VECTOR_VARIANT
      /* VT_VECTOR | VT_VARIANT */
    },
    /*::[*/
    13: {
      n: "TitlesOfParts",
      t: VT_VECTOR_LPSTR
      /* VT_VECTOR | VT_LPSTR */
    },
    /*::[*/
    14: { n: "Manager", t: VT_STRING },
    /*::[*/
    15: { n: "Company", t: VT_STRING },
    /*::[*/
    16: { n: "LinksUpToDate", t: VT_BOOL },
    /*::[*/
    17: { n: "CharacterCount", t: VT_I4 },
    /*::[*/
    19: { n: "SharedDoc", t: VT_BOOL },
    /*::[*/
    22: { n: "HyperlinksChanged", t: VT_BOOL },
    /*::[*/
    23: { n: "AppVersion", t: VT_I4, p: "version" },
    /*::[*/
    24: { n: "DigSig", t: VT_BLOB },
    /*::[*/
    26: { n: "ContentType", t: VT_STRING },
    /*::[*/
    27: { n: "ContentStatus", t: VT_STRING },
    /*::[*/
    28: { n: "Language", t: VT_STRING },
    /*::[*/
    29: { n: "Version", t: VT_STRING },
    /*::[*/
    255: {},
    /* [MS-OLEPS] 2.18 */
    /*::[*/
    2147483648: { n: "Locale", t: VT_UI4 },
    /*::[*/
    2147483651: { n: "Behavior", t: VT_UI4 },
    /*::[*/
    1919054434: {}
  };
  var SummaryPIDSI = {
    /*::[*/
    1: { n: "CodePage", t: VT_I2 },
    /*::[*/
    2: { n: "Title", t: VT_STRING },
    /*::[*/
    3: { n: "Subject", t: VT_STRING },
    /*::[*/
    4: { n: "Author", t: VT_STRING },
    /*::[*/
    5: { n: "Keywords", t: VT_STRING },
    /*::[*/
    6: { n: "Comments", t: VT_STRING },
    /*::[*/
    7: { n: "Template", t: VT_STRING },
    /*::[*/
    8: { n: "LastAuthor", t: VT_STRING },
    /*::[*/
    9: { n: "RevNumber", t: VT_STRING },
    /*::[*/
    10: { n: "EditTime", t: VT_FILETIME },
    /*::[*/
    11: { n: "LastPrinted", t: VT_FILETIME },
    /*::[*/
    12: { n: "CreatedDate", t: VT_FILETIME },
    /*::[*/
    13: { n: "ModifiedDate", t: VT_FILETIME },
    /*::[*/
    14: { n: "PageCount", t: VT_I4 },
    /*::[*/
    15: { n: "WordCount", t: VT_I4 },
    /*::[*/
    16: { n: "CharCount", t: VT_I4 },
    /*::[*/
    17: { n: "Thumbnail", t: VT_CF },
    /*::[*/
    18: { n: "Application", t: VT_STRING },
    /*::[*/
    19: { n: "DocSecurity", t: VT_I4 },
    /*::[*/
    255: {},
    /* [MS-OLEPS] 2.18 */
    /*::[*/
    2147483648: { n: "Locale", t: VT_UI4 },
    /*::[*/
    2147483651: { n: "Behavior", t: VT_UI4 },
    /*::[*/
    1919054434: {}
  };
  var CountryEnum = {
    /*::[*/
    1: "US",
    // United States
    /*::[*/
    2: "CA",
    // Canada
    /*::[*/
    3: "",
    // Latin America (except Brazil)
    /*::[*/
    7: "RU",
    // Russia
    /*::[*/
    20: "EG",
    // Egypt
    /*::[*/
    30: "GR",
    // Greece
    /*::[*/
    31: "NL",
    // Netherlands
    /*::[*/
    32: "BE",
    // Belgium
    /*::[*/
    33: "FR",
    // France
    /*::[*/
    34: "ES",
    // Spain
    /*::[*/
    36: "HU",
    // Hungary
    /*::[*/
    39: "IT",
    // Italy
    /*::[*/
    41: "CH",
    // Switzerland
    /*::[*/
    43: "AT",
    // Austria
    /*::[*/
    44: "GB",
    // United Kingdom
    /*::[*/
    45: "DK",
    // Denmark
    /*::[*/
    46: "SE",
    // Sweden
    /*::[*/
    47: "NO",
    // Norway
    /*::[*/
    48: "PL",
    // Poland
    /*::[*/
    49: "DE",
    // Germany
    /*::[*/
    52: "MX",
    // Mexico
    /*::[*/
    55: "BR",
    // Brazil
    /*::[*/
    61: "AU",
    // Australia
    /*::[*/
    64: "NZ",
    // New Zealand
    /*::[*/
    66: "TH",
    // Thailand
    /*::[*/
    81: "JP",
    // Japan
    /*::[*/
    82: "KR",
    // Korea
    /*::[*/
    84: "VN",
    // Viet Nam
    /*::[*/
    86: "CN",
    // China
    /*::[*/
    90: "TR",
    // Turkey
    /*::[*/
    105: "JS",
    // Ramastan
    /*::[*/
    213: "DZ",
    // Algeria
    /*::[*/
    216: "MA",
    // Morocco
    /*::[*/
    218: "LY",
    // Libya
    /*::[*/
    351: "PT",
    // Portugal
    /*::[*/
    354: "IS",
    // Iceland
    /*::[*/
    358: "FI",
    // Finland
    /*::[*/
    420: "CZ",
    // Czech Republic
    /*::[*/
    886: "TW",
    // Taiwan
    /*::[*/
    961: "LB",
    // Lebanon
    /*::[*/
    962: "JO",
    // Jordan
    /*::[*/
    963: "SY",
    // Syria
    /*::[*/
    964: "IQ",
    // Iraq
    /*::[*/
    965: "KW",
    // Kuwait
    /*::[*/
    966: "SA",
    // Saudi Arabia
    /*::[*/
    971: "AE",
    // United Arab Emirates
    /*::[*/
    972: "IL",
    // Israel
    /*::[*/
    974: "QA",
    // Qatar
    /*::[*/
    981: "IR",
    // Iran
    /*::[*/
    65535: "US"
    // United States
  };
  var XLSFillPattern = [
    null,
    "solid",
    "mediumGray",
    "darkGray",
    "lightGray",
    "darkHorizontal",
    "darkVertical",
    "darkDown",
    "darkUp",
    "darkGrid",
    "darkTrellis",
    "lightHorizontal",
    "lightVertical",
    "lightDown",
    "lightUp",
    "lightGrid",
    "lightTrellis",
    "gray125",
    "gray0625"
  ];
  function rgbify(arr) {
    return arr.map(function(x) {
      return [x >> 16 & 255, x >> 8 & 255, x & 255];
    });
  }
  var _XLSIcv = /* @__PURE__ */ rgbify([
    /* Color Constants */
    0,
    16777215,
    16711680,
    65280,
    255,
    16776960,
    16711935,
    65535,
    /* Overridable Defaults */
    0,
    16777215,
    16711680,
    65280,
    255,
    16776960,
    16711935,
    65535,
    8388608,
    32768,
    128,
    8421376,
    8388736,
    32896,
    12632256,
    8421504,
    10066431,
    10040166,
    16777164,
    13434879,
    6684774,
    16744576,
    26316,
    13421823,
    128,
    16711935,
    16776960,
    65535,
    8388736,
    8388608,
    32896,
    255,
    52479,
    13434879,
    13434828,
    16777113,
    10079487,
    16751052,
    13408767,
    16764057,
    3368703,
    3394764,
    10079232,
    16763904,
    16750848,
    16737792,
    6710937,
    9868950,
    13158,
    3381606,
    13056,
    3355392,
    10040064,
    10040166,
    3355545,
    3355443,
    /* Other entries to appease BIFF8/12 */
    16777215,
    /* 0x40 icvForeground ?? */
    0,
    /* 0x41 icvBackground ?? */
    0,
    /* 0x42 icvFrame ?? */
    0,
    /* 0x43 icv3D ?? */
    0,
    /* 0x44 icv3DText ?? */
    0,
    /* 0x45 icv3DHilite ?? */
    0,
    /* 0x46 icv3DShadow ?? */
    0,
    /* 0x47 icvHilite ?? */
    0,
    /* 0x48 icvCtlText ?? */
    0,
    /* 0x49 icvCtlScrl ?? */
    0,
    /* 0x4A icvCtlInv ?? */
    0,
    /* 0x4B icvCtlBody ?? */
    0,
    /* 0x4C icvCtlFrame ?? */
    0,
    /* 0x4D icvCtlFore ?? */
    0,
    /* 0x4E icvCtlBack ?? */
    0,
    /* 0x4F icvCtlNeutral */
    0,
    /* 0x50 icvInfoBk ?? */
    0
    /* 0x51 icvInfoText ?? */
  ]);
  var XLSIcv = /* @__PURE__ */ dup(_XLSIcv);
  var BErr = {
    /*::[*/
    0: "#NULL!",
    /*::[*/
    7: "#DIV/0!",
    /*::[*/
    15: "#VALUE!",
    /*::[*/
    23: "#REF!",
    /*::[*/
    29: "#NAME?",
    /*::[*/
    36: "#NUM!",
    /*::[*/
    42: "#N/A",
    /*::[*/
    43: "#GETTING_DATA",
    /*::[*/
    255: "#WTF?"
  };
  var RBErr = {
    "#NULL!": 0,
    "#DIV/0!": 7,
    "#VALUE!": 15,
    "#REF!": 23,
    "#NAME?": 29,
    "#NUM!": 36,
    "#N/A": 42,
    "#GETTING_DATA": 43,
    "#WTF?": 255
  };
  var ct2type = {
    /* Workbook */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
    "application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks",
    "application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks",
    "application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks",
    /* Worksheet */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets",
    "application/vnd.ms-excel.worksheet": "sheets",
    "application/vnd.ms-excel.binIndexWs": "TODO",
    /* Binary Index */
    /* Chartsheet */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts",
    "application/vnd.ms-excel.chartsheet": "charts",
    /* Macrosheet */
    "application/vnd.ms-excel.macrosheet+xml": "macros",
    "application/vnd.ms-excel.macrosheet": "macros",
    "application/vnd.ms-excel.intlmacrosheet": "TODO",
    "application/vnd.ms-excel.binIndexMs": "TODO",
    /* Binary Index */
    /* Dialogsheet */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs",
    "application/vnd.ms-excel.dialogsheet": "dialogs",
    /* Shared Strings */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
    "application/vnd.ms-excel.sharedStrings": "strs",
    /* Styles */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles",
    "application/vnd.ms-excel.styles": "styles",
    /* File Properties */
    "application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
    "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops",
    "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops",
    /* Custom Data Properties */
    "application/vnd.openxmlformats-officedocument.customXmlProperties+xml": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty": "TODO",
    /* Comments */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
    "application/vnd.ms-excel.comments": "comments",
    "application/vnd.ms-excel.threadedcomments+xml": "threadedcomments",
    "application/vnd.ms-excel.person+xml": "people",
    /* Metadata (Stock/Geography and Dynamic Array) */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
    "application/vnd.ms-excel.sheetMetadata": "metadata",
    /* PivotTable */
    "application/vnd.ms-excel.pivotTable": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml": "TODO",
    /* Chart Objects */
    "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": "TODO",
    /* Chart Colors */
    "application/vnd.ms-office.chartcolorstyle+xml": "TODO",
    /* Chart Style */
    "application/vnd.ms-office.chartstyle+xml": "TODO",
    /* Chart Advanced */
    "application/vnd.ms-office.chartex+xml": "TODO",
    /* Calculation Chain */
    "application/vnd.ms-excel.calcChain": "calcchains",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml": "calcchains",
    /* Printer Settings */
    "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings": "TODO",
    /* ActiveX */
    "application/vnd.ms-office.activeX": "TODO",
    "application/vnd.ms-office.activeX+xml": "TODO",
    /* Custom Toolbars */
    "application/vnd.ms-excel.attachedToolbars": "TODO",
    /* External Data Connections */
    "application/vnd.ms-excel.connections": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": "TODO",
    /* External Links */
    "application/vnd.ms-excel.externalLink": "links",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links",
    /* PivotCache */
    "application/vnd.ms-excel.pivotCacheDefinition": "TODO",
    "application/vnd.ms-excel.pivotCacheRecords": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml": "TODO",
    /* Query Table */
    "application/vnd.ms-excel.queryTable": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml": "TODO",
    /* Shared Workbook */
    "application/vnd.ms-excel.userNames": "TODO",
    "application/vnd.ms-excel.revisionHeaders": "TODO",
    "application/vnd.ms-excel.revisionLog": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml": "TODO",
    /* Single Cell Table */
    "application/vnd.ms-excel.tableSingleCells": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml": "TODO",
    /* Slicer */
    "application/vnd.ms-excel.slicer": "TODO",
    "application/vnd.ms-excel.slicerCache": "TODO",
    "application/vnd.ms-excel.slicer+xml": "TODO",
    "application/vnd.ms-excel.slicerCache+xml": "TODO",
    /* Sort Map */
    "application/vnd.ms-excel.wsSortMap": "TODO",
    /* Table */
    "application/vnd.ms-excel.table": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": "TODO",
    /* Themes */
    "application/vnd.openxmlformats-officedocument.theme+xml": "themes",
    /* Theme Override */
    "application/vnd.openxmlformats-officedocument.themeOverride+xml": "TODO",
    /* Timeline */
    "application/vnd.ms-excel.Timeline+xml": "TODO",
    /* verify */
    "application/vnd.ms-excel.TimelineCache+xml": "TODO",
    /* verify */
    /* VBA */
    "application/vnd.ms-office.vbaProject": "vba",
    "application/vnd.ms-office.vbaProjectSignature": "TODO",
    /* Volatile Dependencies */
    "application/vnd.ms-office.volatileDependencies": "TODO",
    "application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml": "TODO",
    /* Control Properties */
    "application/vnd.ms-excel.controlproperties+xml": "TODO",
    /* Data Model */
    "application/vnd.openxmlformats-officedocument.model+data": "TODO",
    /* Survey */
    "application/vnd.ms-excel.Survey+xml": "TODO",
    /* Drawing */
    "application/vnd.openxmlformats-officedocument.drawing+xml": "drawings",
    "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": "TODO",
    "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml": "TODO",
    "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml": "TODO",
    "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml": "TODO",
    "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml": "TODO",
    /* VML */
    "application/vnd.openxmlformats-officedocument.vmlDrawing": "TODO",
    "application/vnd.openxmlformats-package.relationships+xml": "rels",
    "application/vnd.openxmlformats-officedocument.oleObject": "TODO",
    /* Image */
    "image/png": "TODO",
    "sheet": "js"
  };
  function new_ct() {
    return {
      workbooks: [],
      sheets: [],
      charts: [],
      dialogs: [],
      macros: [],
      rels: [],
      strs: [],
      comments: [],
      threadedcomments: [],
      links: [],
      coreprops: [],
      extprops: [],
      custprops: [],
      themes: [],
      styles: [],
      calcchains: [],
      vba: [],
      drawings: [],
      metadata: [],
      people: [],
      TODO: [],
      xmlns: ""
    };
  }
  function parse_ct(data) {
    var ct = new_ct();
    if (!data || !data.match) return ct;
    var ctext = {};
    (data.match(tagregex) || []).forEach(function(x) {
      var y = parsexmltag(x);
      switch (y[0].replace(nsregex, "<")) {
        case "<?xml":
          break;
        case "<Types":
          ct.xmlns = y["xmlns" + (y[0].match(/<(\w+):/) || ["", ""])[1]];
          break;
        case "<Default":
          ctext[y.Extension] = y.ContentType;
          break;
        case "<Override":
          if (ct[ct2type[y.ContentType]] !== void 0) ct[ct2type[y.ContentType]].push(y.PartName);
          break;
      }
    });
    if (ct.xmlns !== XMLNS.CT) throw new Error("Unknown Namespace: " + ct.xmlns);
    ct.calcchain = ct.calcchains.length > 0 ? ct.calcchains[0] : "";
    ct.sst = ct.strs.length > 0 ? ct.strs[0] : "";
    ct.style = ct.styles.length > 0 ? ct.styles[0] : "";
    ct.defaults = ctext;
    delete ct.calcchains;
    return ct;
  }
  var RELS = {
    WB: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
    SHEET: "http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
    HLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
    VML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",
    XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
    XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",
    XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
    CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
    CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
    CMNT: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
    CORE_PROPS: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
    EXT_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",
    CUST_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",
    SST: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",
    STY: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
    THEME: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
    CHART: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
    CHARTEX: "http://schemas.microsoft.com/office/2014/relationships/chartEx",
    CS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet",
    WS: [
      "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
      "http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"
    ],
    DS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet",
    MS: "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet",
    IMG: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
    DRAW: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",
    XLMETA: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",
    TCMNT: "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",
    PEOPLE: "http://schemas.microsoft.com/office/2017/10/relationships/person",
    VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
  };
  function get_rels_path(file) {
    var n = file.lastIndexOf("/");
    return file.slice(0, n + 1) + "_rels/" + file.slice(n + 1) + ".rels";
  }
  function parse_rels(data, currentFilePath) {
    var rels = { "!id": {} };
    if (!data) return rels;
    if (currentFilePath.charAt(0) !== "/") {
      currentFilePath = "/" + currentFilePath;
    }
    var hash = {};
    (data.match(tagregex) || []).forEach(function(x) {
      var y = parsexmltag(x);
      if (y[0] === "<Relationship") {
        var rel = {};
        rel.Type = y.Type;
        rel.Target = y.Target;
        rel.Id = y.Id;
        if (y.TargetMode) rel.TargetMode = y.TargetMode;
        var canonictarget = y.TargetMode === "External" ? y.Target : resolve_path(y.Target, currentFilePath);
        rels[canonictarget] = rel;
        hash[y.Id] = rel;
      }
    });
    rels["!id"] = hash;
    return rels;
  }
  var CT_ODS = "application/vnd.oasis.opendocument.spreadsheet";
  function parse_manifest(d, opts) {
    var str = xlml_normalize(d);
    var Rn;
    var FEtag;
    while (Rn = xlmlregex.exec(str)) switch (Rn[3]) {
      case "manifest":
        break;
      // 4.2 <manifest:manifest>
      case "file-entry":
        FEtag = parsexmltag(Rn[0], false);
        if (FEtag.path == "/" && FEtag.type !== CT_ODS) throw new Error("This OpenDocument is not a spreadsheet");
        break;
      case "encryption-data":
      // 4.4 <manifest:encryption-data>
      case "algorithm":
      // 4.5 <manifest:algorithm>
      case "start-key-generation":
      // 4.6 <manifest:start-key-generation>
      case "key-derivation":
        throw new Error("Unsupported ODS Encryption");
      default:
        if (opts && opts.WTF) throw Rn;
    }
  }
  var CORE_PROPS = [
    ["cp:category", "Category"],
    ["cp:contentStatus", "ContentStatus"],
    ["cp:keywords", "Keywords"],
    ["cp:lastModifiedBy", "LastAuthor"],
    ["cp:lastPrinted", "LastPrinted"],
    ["cp:revision", "RevNumber"],
    ["cp:version", "Version"],
    ["dc:creator", "Author"],
    ["dc:description", "Comments"],
    ["dc:identifier", "Identifier"],
    ["dc:language", "Language"],
    ["dc:subject", "Subject"],
    ["dc:title", "Title"],
    ["dcterms:created", "CreatedDate", "date"],
    ["dcterms:modified", "ModifiedDate", "date"]
  ];
  var CORE_PROPS_REGEX = /* @__PURE__ */ (function() {
    var r = new Array(CORE_PROPS.length);
    for (var i = 0; i < CORE_PROPS.length; ++i) {
      var f = CORE_PROPS[i];
      var g = "(?:" + f[0].slice(0, f[0].indexOf(":")) + ":)" + f[0].slice(f[0].indexOf(":") + 1);
      r[i] = new RegExp("<" + g + "[^>]*>([\\s\\S]*?)</" + g + ">");
    }
    return r;
  })();
  function parse_core_props(data) {
    var p = {};
    data = utf8read(data);
    for (var i = 0; i < CORE_PROPS.length; ++i) {
      var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]);
      if (cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
      if (f[2] === "date" && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
    }
    return p;
  }
  var EXT_PROPS = [
    ["Application", "Application", "string"],
    ["AppVersion", "AppVersion", "string"],
    ["Company", "Company", "string"],
    ["DocSecurity", "DocSecurity", "string"],
    ["Manager", "Manager", "string"],
    ["HyperlinksChanged", "HyperlinksChanged", "bool"],
    ["SharedDoc", "SharedDoc", "bool"],
    ["LinksUpToDate", "LinksUpToDate", "bool"],
    ["ScaleCrop", "ScaleCrop", "bool"],
    ["HeadingPairs", "HeadingPairs", "raw"],
    ["TitlesOfParts", "TitlesOfParts", "raw"]
  ];
  function load_props_pairs(HP, TOP, props, opts) {
    var v = [];
    if (typeof HP == "string") v = parseVector(HP, opts);
    else for (var j = 0; j < HP.length; ++j) v = v.concat(HP[j].map(function(hp) {
      return { v: hp };
    }));
    var parts = typeof TOP == "string" ? parseVector(TOP, opts).map(function(x) {
      return x.v;
    }) : TOP;
    var idx = 0, len = 0;
    if (parts.length > 0) for (var i = 0; i !== v.length; i += 2) {
      len = +v[i + 1].v;
      switch (v[i].v) {
        case "Worksheets":
        case "\u5DE5\u4F5C\u8868":
        case "\u041B\u0438\u0441\u0442\u044B":
        case "\u0623\u0648\u0631\u0627\u0642 \u0627\u0644\u0639\u0645\u0644":
        case "\u30EF\u30FC\u30AF\u30B7\u30FC\u30C8":
        case "\u05D2\u05DC\u05D9\u05D5\u05E0\u05D5\u05EA \u05E2\u05D1\u05D5\u05D3\u05D4":
        case "Arbeitsbl\xE4tter":
        case "\xC7al\u0131\u015Fma Sayfalar\u0131":
        case "Feuilles de calcul":
        case "Fogli di lavoro":
        case "Folhas de c\xE1lculo":
        case "Planilhas":
        case "Regneark":
        case "Hojas de c\xE1lculo":
        case "Werkbladen":
          props.Worksheets = len;
          props.SheetNames = parts.slice(idx, idx + len);
          break;
        case "Named Ranges":
        case "Rangos con nombre":
        case "\u540D\u524D\u4ED8\u304D\u4E00\u89A7":
        case "Benannte Bereiche":
        case "Navngivne omr\xE5der":
          props.NamedRanges = len;
          props.DefinedNames = parts.slice(idx, idx + len);
          break;
        case "Charts":
        case "Diagramme":
          props.Chartsheets = len;
          props.ChartNames = parts.slice(idx, idx + len);
          break;
      }
      idx += len;
    }
  }
  function parse_ext_props(data, p, opts) {
    var q = {};
    if (!p) p = {};
    data = utf8read(data);
    EXT_PROPS.forEach(function(f) {
      var xml = (data.match(matchtag(f[0])) || [])[1];
      switch (f[2]) {
        case "string":
          if (xml) p[f[1]] = unescapexml(xml);
          break;
        case "bool":
          p[f[1]] = xml === "true";
          break;
        case "raw":
          var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)</" + f[0] + ">"));
          if (cur && cur.length > 0) q[f[1]] = cur[1];
          break;
      }
    });
    if (q.HeadingPairs && q.TitlesOfParts) load_props_pairs(q.HeadingPairs, q.TitlesOfParts, p, opts);
    return p;
  }
  var custregex = /<[^>]+>[^<]*/g;
  function parse_cust_props(data, opts) {
    var p = {}, name = "";
    var m = data.match(custregex);
    if (m) for (var i = 0; i != m.length; ++i) {
      var x = m[i], y = parsexmltag(x);
      switch (y[0]) {
        case "<?xml":
          break;
        case "<Properties":
          break;
        case "<property":
          name = unescapexml(y.name);
          break;
        case "</property>":
          name = null;
          break;
        default:
          if (x.indexOf("<vt:") === 0) {
            var toks = x.split(">");
            var type = toks[0].slice(4), text = toks[1];
            switch (type) {
              case "lpstr":
              case "bstr":
              case "lpwstr":
                p[name] = unescapexml(text);
                break;
              case "bool":
                p[name] = parsexmlbool(text);
                break;
              case "i1":
              case "i2":
              case "i4":
              case "i8":
              case "int":
              case "uint":
                p[name] = parseInt(text, 10);
                break;
              case "r4":
              case "r8":
              case "decimal":
                p[name] = parseFloat(text);
                break;
              case "filetime":
              case "date":
                p[name] = parseDate(text);
                break;
              case "cy":
              case "error":
                p[name] = unescapexml(text);
                break;
              default:
                if (type.slice(-1) == "/") break;
                if (opts.WTF && typeof console !== "undefined") console.warn("Unexpected", x, type, toks);
            }
          } else if (x.slice(0, 2) === "</") {
          } else if (opts.WTF) throw new Error(x);
      }
    }
    return p;
  }
  var XLMLDocPropsMap = {
    Title: "Title",
    Subject: "Subject",
    Author: "Author",
    Keywords: "Keywords",
    Comments: "Description",
    LastAuthor: "LastAuthor",
    RevNumber: "Revision",
    Application: "AppName",
    /* TotalTime: 'TotalTime', */
    LastPrinted: "LastPrinted",
    CreatedDate: "Created",
    ModifiedDate: "LastSaved",
    /* Pages */
    /* Words */
    /* Characters */
    Category: "Category",
    /* PresentationFormat */
    Manager: "Manager",
    Company: "Company",
    /* Guid */
    /* HyperlinkBase */
    /* Bytes */
    /* Lines */
    /* Paragraphs */
    /* CharactersWithSpaces */
    AppVersion: "Version",
    ContentStatus: "ContentStatus",
    /* NOTE: missing from schema */
    Identifier: "Identifier",
    /* NOTE: missing from schema */
    Language: "Language"
    /* NOTE: missing from schema */
  };
  var evert_XLMLDPM;
  function xlml_set_prop(Props, tag, val) {
    if (!evert_XLMLDPM) evert_XLMLDPM = evert(XLMLDocPropsMap);
    tag = evert_XLMLDPM[tag] || tag;
    Props[tag] = val;
  }
  function parse_FILETIME(blob) {
    var dwLowDateTime = blob.read_shift(4), dwHighDateTime = blob.read_shift(4);
    return new Date((dwHighDateTime / 1e7 * Math.pow(2, 32) + dwLowDateTime / 1e7 - 11644473600) * 1e3).toISOString().replace(/\.000/, "");
  }
  function parse_lpstr(blob, type, pad) {
    var start = blob.l;
    var str = blob.read_shift(0, "lpstr-cp");
    if (pad) while (blob.l - start & 3) ++blob.l;
    return str;
  }
  function parse_lpwstr(blob, type, pad) {
    var str = blob.read_shift(0, "lpwstr");
    if (pad) blob.l += 4 - (str.length + 1 & 3) & 3;
    return str;
  }
  function parse_VtStringBase(blob, stringType, pad) {
    if (stringType === 31) return parse_lpwstr(blob);
    return parse_lpstr(blob, stringType, pad);
  }
  function parse_VtString(blob, t, pad) {
    return parse_VtStringBase(blob, t, pad === false ? 0 : 4);
  }
  function parse_VtUnalignedString(blob, t) {
    if (!t) throw new Error("VtUnalignedString must have positive length");
    return parse_VtStringBase(blob, t, 0);
  }
  function parse_VtVecLpwstrValue(blob) {
    var length = blob.read_shift(4);
    var ret2 = [];
    for (var i = 0; i != length; ++i) {
      var start = blob.l;
      ret2[i] = blob.read_shift(0, "lpwstr").replace(chr0, "");
      if (blob.l - start & 2) blob.l += 2;
    }
    return ret2;
  }
  function parse_VtVecUnalignedLpstrValue(blob) {
    var length = blob.read_shift(4);
    var ret2 = [];
    for (var i = 0; i != length; ++i) ret2[i] = blob.read_shift(0, "lpstr-cp").replace(chr0, "");
    return ret2;
  }
  function parse_VtHeadingPair(blob) {
    var start = blob.l;
    var headingString = parse_TypedPropertyValue(blob, VT_USTR);
    if (blob[blob.l] == 0 && blob[blob.l + 1] == 0 && blob.l - start & 2) blob.l += 2;
    var headerParts = parse_TypedPropertyValue(blob, VT_I4);
    return [headingString, headerParts];
  }
  function parse_VtVecHeadingPairValue(blob) {
    var cElements = blob.read_shift(4);
    var out = [];
    for (var i = 0; i < cElements / 2; ++i) out.push(parse_VtHeadingPair(blob));
    return out;
  }
  function parse_dictionary(blob, CodePage) {
    var cnt = blob.read_shift(4);
    var dict = {};
    for (var j = 0; j != cnt; ++j) {
      var pid = blob.read_shift(4);
      var len = blob.read_shift(4);
      dict[pid] = blob.read_shift(len, CodePage === 1200 ? "utf16le" : "utf8").replace(chr0, "").replace(chr1, "!");
      if (CodePage === 1200 && len % 2) blob.l += 2;
    }
    if (blob.l & 3) blob.l = blob.l >> 2 + 1 << 2;
    return dict;
  }
  function parse_BLOB(blob) {
    var size2 = blob.read_shift(4);
    var bytes = blob.slice(blob.l, blob.l + size2);
    blob.l += size2;
    if ((size2 & 3) > 0) blob.l += 4 - (size2 & 3) & 3;
    return bytes;
  }
  function parse_ClipboardData(blob) {
    var o = {};
    o.Size = blob.read_shift(4);
    blob.l += o.Size + 3 - (o.Size - 1) % 4;
    return o;
  }
  function parse_TypedPropertyValue(blob, type, _opts) {
    var t = blob.read_shift(2), ret2, opts = _opts || {};
    blob.l += 2;
    if (type !== VT_VARIANT) {
      if (t !== type && VT_CUSTOM.indexOf(type) === -1 && !((type & 65534) == 4126 && (t & 65534) == 4126)) throw new Error("Expected type " + type + " saw " + t);
    }
    switch (type === VT_VARIANT ? t : type) {
      case 2:
        ret2 = blob.read_shift(2, "i");
        if (!opts.raw) blob.l += 2;
        return ret2;
      case 3:
        ret2 = blob.read_shift(4, "i");
        return ret2;
      case 11:
        return blob.read_shift(4) !== 0;
      case 19:
        ret2 = blob.read_shift(4);
        return ret2;
      case 30:
        return parse_lpstr(blob, t, 4).replace(chr0, "");
      case 31:
        return parse_lpwstr(blob);
      case 64:
        return parse_FILETIME(blob);
      case 65:
        return parse_BLOB(blob);
      case 71:
        return parse_ClipboardData(blob);
      case 80:
        return parse_VtString(blob, t, !opts.raw).replace(chr0, "");
      case 81:
        return parse_VtUnalignedString(
          blob,
          t
          /*, 4*/
        ).replace(chr0, "");
      case 4108:
        return parse_VtVecHeadingPairValue(blob);
      case 4126:
      case 4127:
        return t == 4127 ? parse_VtVecLpwstrValue(blob) : parse_VtVecUnalignedLpstrValue(blob);
      default:
        throw new Error("TypedPropertyValue unrecognized type " + type + " " + t);
    }
  }
  function parse_PropertySet(blob, PIDSI) {
    var start_addr = blob.l;
    var size2 = blob.read_shift(4);
    var NumProps = blob.read_shift(4);
    var Props = [], i = 0;
    var CodePage = 0;
    var Dictionary = -1, DictObj = {};
    for (i = 0; i != NumProps; ++i) {
      var PropID = blob.read_shift(4);
      var Offset = blob.read_shift(4);
      Props[i] = [PropID, Offset + start_addr];
    }
    Props.sort(function(x, y) {
      return x[1] - y[1];
    });
    var PropH = {};
    for (i = 0; i != NumProps; ++i) {
      if (blob.l !== Props[i][1]) {
        var fail = true;
        if (i > 0 && PIDSI) switch (PIDSI[Props[i - 1][0]].t) {
          case 2:
            if (blob.l + 2 === Props[i][1]) {
              blob.l += 2;
              fail = false;
            }
            break;
          case 80:
            if (blob.l <= Props[i][1]) {
              blob.l = Props[i][1];
              fail = false;
            }
            break;
          case 4108:
            if (blob.l <= Props[i][1]) {
              blob.l = Props[i][1];
              fail = false;
            }
            break;
        }
        if ((!PIDSI || i == 0) && blob.l <= Props[i][1]) {
          fail = false;
          blob.l = Props[i][1];
        }
        if (fail) throw new Error("Read Error: Expected address " + Props[i][1] + " at " + blob.l + " :" + i);
      }
      if (PIDSI) {
        var piddsi = PIDSI[Props[i][0]];
        PropH[piddsi.n] = parse_TypedPropertyValue(blob, piddsi.t, { raw: true });
        if (piddsi.p === "version") PropH[piddsi.n] = String(PropH[piddsi.n] >> 16) + "." + ("0000" + String(PropH[piddsi.n] & 65535)).slice(-4);
        if (piddsi.n == "CodePage") switch (PropH[piddsi.n]) {
          case 0:
            PropH[piddsi.n] = 1252;
          /* falls through */
          case 874:
          case 932:
          case 936:
          case 949:
          case 950:
          case 1250:
          case 1251:
          case 1253:
          case 1254:
          case 1255:
          case 1256:
          case 1257:
          case 1258:
          case 1e4:
          case 1200:
          case 1201:
          case 1252:
          case 65e3:
          case -536:
          case 65001:
          case -535:
            set_cp(CodePage = PropH[piddsi.n] >>> 0 & 65535);
            break;
          default:
            throw new Error("Unsupported CodePage: " + PropH[piddsi.n]);
        }
      } else {
        if (Props[i][0] === 1) {
          CodePage = PropH.CodePage = parse_TypedPropertyValue(blob, VT_I2);
          set_cp(CodePage);
          if (Dictionary !== -1) {
            var oldpos = blob.l;
            blob.l = Props[Dictionary][1];
            DictObj = parse_dictionary(blob, CodePage);
            blob.l = oldpos;
          }
        } else if (Props[i][0] === 0) {
          if (CodePage === 0) {
            Dictionary = i;
            blob.l = Props[i + 1][1];
            continue;
          }
          DictObj = parse_dictionary(blob, CodePage);
        } else {
          var name = DictObj[Props[i][0]];
          var val;
          switch (blob[blob.l]) {
            case 65:
              blob.l += 4;
              val = parse_BLOB(blob);
              break;
            case 30:
              blob.l += 4;
              val = parse_VtString(blob, blob[blob.l - 4]).replace(/\u0000+$/, "");
              break;
            case 31:
              blob.l += 4;
              val = parse_VtString(blob, blob[blob.l - 4]).replace(/\u0000+$/, "");
              break;
            case 3:
              blob.l += 4;
              val = blob.read_shift(4, "i");
              break;
            case 19:
              blob.l += 4;
              val = blob.read_shift(4);
              break;
            case 5:
              blob.l += 4;
              val = blob.read_shift(8, "f");
              break;
            case 11:
              blob.l += 4;
              val = parsebool(blob, 4);
              break;
            case 64:
              blob.l += 4;
              val = parseDate(parse_FILETIME(blob));
              break;
            default:
              throw new Error("unparsed value: " + blob[blob.l]);
          }
          PropH[name] = val;
        }
      }
    }
    blob.l = start_addr + size2;
    return PropH;
  }
  function parse_PropertySetStream(file, PIDSI, clsid) {
    var blob = file.content;
    if (!blob) return {};
    prep_blob(blob, 0);
    var NumSets, FMTID0, FMTID1, Offset0, Offset1 = 0;
    blob.chk("feff", "Byte Order: ");
    blob.read_shift(2);
    var SystemIdentifier = blob.read_shift(4);
    var CLSID = blob.read_shift(16);
    if (CLSID !== CFB.utils.consts.HEADER_CLSID && CLSID !== clsid) throw new Error("Bad PropertySet CLSID " + CLSID);
    NumSets = blob.read_shift(4);
    if (NumSets !== 1 && NumSets !== 2) throw new Error("Unrecognized #Sets: " + NumSets);
    FMTID0 = blob.read_shift(16);
    Offset0 = blob.read_shift(4);
    if (NumSets === 1 && Offset0 !== blob.l) throw new Error("Length mismatch: " + Offset0 + " !== " + blob.l);
    else if (NumSets === 2) {
      FMTID1 = blob.read_shift(16);
      Offset1 = blob.read_shift(4);
    }
    var PSet0 = parse_PropertySet(blob, PIDSI);
    var rval = { SystemIdentifier };
    for (var y in PSet0) rval[y] = PSet0[y];
    rval.FMTID = FMTID0;
    if (NumSets === 1) return rval;
    if (Offset1 - blob.l == 2) blob.l += 2;
    if (blob.l !== Offset1) throw new Error("Length mismatch 2: " + blob.l + " !== " + Offset1);
    var PSet1;
    try {
      PSet1 = parse_PropertySet(blob, null);
    } catch (e) {
    }
    for (y in PSet1) rval[y] = PSet1[y];
    rval.FMTID = [FMTID0, FMTID1];
    return rval;
  }
  function parsenoop2(blob, length) {
    blob.read_shift(length);
    return null;
  }
  function parslurp(blob, length, cb2) {
    var arr = [], target = blob.l + length;
    while (blob.l < target) arr.push(cb2(blob, target - blob.l));
    if (target !== blob.l) throw new Error("Slurp error");
    return arr;
  }
  function parsebool(blob, length) {
    return blob.read_shift(length) === 1;
  }
  function parseuint16(blob) {
    return blob.read_shift(2, "u");
  }
  function parseuint16a(blob, length) {
    return parslurp(blob, length, parseuint16);
  }
  function parse_Bes(blob) {
    var v = blob.read_shift(1), t = blob.read_shift(1);
    return t === 1 ? v : v === 1;
  }
  function parse_ShortXLUnicodeString(blob, length, opts) {
    var cch = blob.read_shift(opts && opts.biff >= 12 ? 2 : 1);
    var encoding = "sbcs-cont";
    var cp = current_codepage;
    if (opts && opts.biff >= 8) current_codepage = 1200;
    if (!opts || opts.biff == 8) {
      var fHighByte = blob.read_shift(1);
      if (fHighByte) {
        encoding = "dbcs-cont";
      }
    } else if (opts.biff == 12) {
      encoding = "wstr";
    }
    if (opts.biff >= 2 && opts.biff <= 5) encoding = "cpstr";
    var o = cch ? blob.read_shift(cch, encoding) : "";
    current_codepage = cp;
    return o;
  }
  function parse_XLUnicodeRichExtendedString(blob) {
    var cp = current_codepage;
    current_codepage = 1200;
    var cch = blob.read_shift(2), flags = blob.read_shift(1);
    var fExtSt = flags & 4, fRichSt = flags & 8;
    var width = 1 + (flags & 1);
    var cRun = 0, cbExtRst;
    var z = {};
    if (fRichSt) cRun = blob.read_shift(2);
    if (fExtSt) cbExtRst = blob.read_shift(4);
    var encoding = width == 2 ? "dbcs-cont" : "sbcs-cont";
    var msg = cch === 0 ? "" : blob.read_shift(cch, encoding);
    if (fRichSt) blob.l += 4 * cRun;
    if (fExtSt) blob.l += cbExtRst;
    z.t = msg;
    if (!fRichSt) {
      z.raw = "<t>" + z.t + "</t>";
      z.r = z.t;
    }
    current_codepage = cp;
    return z;
  }
  function parse_XLUnicodeStringNoCch(blob, cch, opts) {
    var retval;
    if (opts) {
      if (opts.biff >= 2 && opts.biff <= 5) return blob.read_shift(cch, "cpstr");
      if (opts.biff >= 12) return blob.read_shift(cch, "dbcs-cont");
    }
    var fHighByte = blob.read_shift(1);
    if (fHighByte === 0) {
      retval = blob.read_shift(cch, "sbcs-cont");
    } else {
      retval = blob.read_shift(cch, "dbcs-cont");
    }
    return retval;
  }
  function parse_XLUnicodeString(blob, length, opts) {
    var cch = blob.read_shift(opts && opts.biff == 2 ? 1 : 2);
    if (cch === 0) {
      blob.l++;
      return "";
    }
    return parse_XLUnicodeStringNoCch(blob, cch, opts);
  }
  function parse_XLUnicodeString2(blob, length, opts) {
    if (opts.biff > 5) return parse_XLUnicodeString(blob, length, opts);
    var cch = blob.read_shift(1);
    if (cch === 0) {
      blob.l++;
      return "";
    }
    return blob.read_shift(cch, opts.biff <= 4 || !blob.lens ? "cpstr" : "sbcs-cont");
  }
  function parse_ControlInfo(blob) {
    var flags = blob.read_shift(1);
    blob.l++;
    var accel = blob.read_shift(2);
    blob.l += 2;
    return [flags, accel];
  }
  function parse_URLMoniker(blob) {
    var len = blob.read_shift(4), start = blob.l;
    var extra = false;
    if (len > 24) {
      blob.l += len - 24;
      if (blob.read_shift(16) === "795881f43b1d7f48af2c825dc4852763") extra = true;
      blob.l = start;
    }
    var url = blob.read_shift((extra ? len - 24 : len) >> 1, "utf16le").replace(chr0, "");
    if (extra) blob.l += 24;
    return url;
  }
  function parse_FileMoniker(blob) {
    var cAnti = blob.read_shift(2);
    var preamble = "";
    while (cAnti-- > 0) preamble += "../";
    var ansiPath = blob.read_shift(0, "lpstr-ansi");
    blob.l += 2;
    if (blob.read_shift(2) != 57005) throw new Error("Bad FileMoniker");
    var sz = blob.read_shift(4);
    if (sz === 0) return preamble + ansiPath.replace(/\\/g, "/");
    var bytes = blob.read_shift(4);
    if (blob.read_shift(2) != 3) throw new Error("Bad FileMoniker");
    var unicodePath = blob.read_shift(bytes >> 1, "utf16le").replace(chr0, "");
    return preamble + unicodePath;
  }
  function parse_HyperlinkMoniker(blob, length) {
    var clsid = blob.read_shift(16);
    length -= 16;
    switch (clsid) {
      case "e0c9ea79f9bace118c8200aa004ba90b":
        return parse_URLMoniker(blob, length);
      case "0303000000000000c000000000000046":
        return parse_FileMoniker(blob, length);
      default:
        throw new Error("Unsupported Moniker " + clsid);
    }
  }
  function parse_HyperlinkString(blob) {
    var len = blob.read_shift(4);
    var o = len > 0 ? blob.read_shift(len, "utf16le").replace(chr0, "") : "";
    return o;
  }
  function parse_Hyperlink(blob, length) {
    var end = blob.l + length;
    var sVer = blob.read_shift(4);
    if (sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer);
    var flags = blob.read_shift(2);
    blob.l += 2;
    var displayName, targetFrameName, moniker, oleMoniker, Loc = "", guid, fileTime;
    if (flags & 16) displayName = parse_HyperlinkString(blob, end - blob.l);
    if (flags & 128) targetFrameName = parse_HyperlinkString(blob, end - blob.l);
    if ((flags & 257) === 257) moniker = parse_HyperlinkString(blob, end - blob.l);
    if ((flags & 257) === 1) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l);
    if (flags & 8) Loc = parse_HyperlinkString(blob, end - blob.l);
    if (flags & 32) guid = blob.read_shift(16);
    if (flags & 64) fileTime = parse_FILETIME(
      blob
      /*, 8*/
    );
    blob.l = end;
    var target = targetFrameName || moniker || oleMoniker || "";
    if (target && Loc) target += "#" + Loc;
    if (!target) target = "#" + Loc;
    if (flags & 2 && target.charAt(0) == "/" && target.charAt(1) != "/") target = "file://" + target;
    var out = { Target: target };
    if (guid) out.guid = guid;
    if (fileTime) out.time = fileTime;
    if (displayName) out.Tooltip = displayName;
    return out;
  }
  function parse_LongRGBA(blob) {
    var r = blob.read_shift(1), g = blob.read_shift(1), b = blob.read_shift(1), a = blob.read_shift(1);
    return [r, g, b, a];
  }
  function parse_LongRGB(blob, length) {
    var x = parse_LongRGBA(blob, length);
    x[3] = 0;
    return x;
  }
  function parse_XLSCell(blob) {
    var rw = blob.read_shift(2);
    var col = blob.read_shift(2);
    var ixfe = blob.read_shift(2);
    return { r: rw, c: col, ixfe };
  }
  function parse_frtHeader(blob) {
    var rt = blob.read_shift(2);
    var flags = blob.read_shift(2);
    blob.l += 8;
    return { type: rt, flags };
  }
  function parse_OptXLUnicodeString(blob, length, opts) {
    return length === 0 ? "" : parse_XLUnicodeString2(blob, length, opts);
  }
  function parse_XTI(blob, length, opts) {
    var w = opts.biff > 8 ? 4 : 2;
    var iSupBook = blob.read_shift(w), itabFirst = blob.read_shift(w, "i"), itabLast = blob.read_shift(w, "i");
    return [iSupBook, itabFirst, itabLast];
  }
  function parse_RkRec(blob) {
    var ixfe = blob.read_shift(2);
    var RK = parse_RkNumber(blob);
    return [ixfe, RK];
  }
  function parse_AddinUdf(blob, length, opts) {
    blob.l += 4;
    length -= 4;
    var l2 = blob.l + length;
    var udfName = parse_ShortXLUnicodeString(blob, length, opts);
    var cb2 = blob.read_shift(2);
    l2 -= blob.l;
    if (cb2 !== l2) throw new Error("Malformed AddinUdf: padding = " + l2 + " != " + cb2);
    blob.l += cb2;
    return udfName;
  }
  function parse_Ref8U(blob) {
    var rwFirst = blob.read_shift(2);
    var rwLast = blob.read_shift(2);
    var colFirst = blob.read_shift(2);
    var colLast = blob.read_shift(2);
    return { s: { c: colFirst, r: rwFirst }, e: { c: colLast, r: rwLast } };
  }
  function parse_RefU(blob) {
    var rwFirst = blob.read_shift(2);
    var rwLast = blob.read_shift(2);
    var colFirst = blob.read_shift(1);
    var colLast = blob.read_shift(1);
    return { s: { c: colFirst, r: rwFirst }, e: { c: colLast, r: rwLast } };
  }
  var parse_Ref = parse_RefU;
  function parse_FtCmo(blob) {
    blob.l += 4;
    var ot = blob.read_shift(2);
    var id = blob.read_shift(2);
    var flags = blob.read_shift(2);
    blob.l += 12;
    return [id, ot, flags];
  }
  function parse_FtNts(blob) {
    var out = {};
    blob.l += 4;
    blob.l += 16;
    out.fSharedNote = blob.read_shift(2);
    blob.l += 4;
    return out;
  }
  function parse_FtCf(blob) {
    var out = {};
    blob.l += 4;
    blob.cf = blob.read_shift(2);
    return out;
  }
  function parse_FtSkip(blob) {
    blob.l += 2;
    blob.l += blob.read_shift(2);
  }
  var FtTab = {
    /*::[*/
    0: parse_FtSkip,
    /* FtEnd */
    /*::[*/
    4: parse_FtSkip,
    /* FtMacro */
    /*::[*/
    5: parse_FtSkip,
    /* FtButton */
    /*::[*/
    6: parse_FtSkip,
    /* FtGmo */
    /*::[*/
    7: parse_FtCf,
    /* FtCf */
    /*::[*/
    8: parse_FtSkip,
    /* FtPioGrbit */
    /*::[*/
    9: parse_FtSkip,
    /* FtPictFmla */
    /*::[*/
    10: parse_FtSkip,
    /* FtCbls */
    /*::[*/
    11: parse_FtSkip,
    /* FtRbo */
    /*::[*/
    12: parse_FtSkip,
    /* FtSbs */
    /*::[*/
    13: parse_FtNts,
    /* FtNts */
    /*::[*/
    14: parse_FtSkip,
    /* FtSbsFmla */
    /*::[*/
    15: parse_FtSkip,
    /* FtGboData */
    /*::[*/
    16: parse_FtSkip,
    /* FtEdoData */
    /*::[*/
    17: parse_FtSkip,
    /* FtRboData */
    /*::[*/
    18: parse_FtSkip,
    /* FtCblsData */
    /*::[*/
    19: parse_FtSkip,
    /* FtLbsData */
    /*::[*/
    20: parse_FtSkip,
    /* FtCblsFmla */
    /*::[*/
    21: parse_FtCmo
  };
  function parse_FtArray(blob, length) {
    var tgt = blob.l + length;
    var fts = [];
    while (blob.l < tgt) {
      var ft = blob.read_shift(2);
      blob.l -= 2;
      try {
        fts.push(FtTab[ft](blob, tgt - blob.l));
      } catch (e) {
        blob.l = tgt;
        return fts;
      }
    }
    if (blob.l != tgt) blob.l = tgt;
    return fts;
  }
  function parse_BOF(blob, length) {
    var o = { BIFFVer: 0, dt: 0 };
    o.BIFFVer = blob.read_shift(2);
    length -= 2;
    if (length >= 2) {
      o.dt = blob.read_shift(2);
      blob.l -= 2;
    }
    switch (o.BIFFVer) {
      case 1536:
      /* BIFF8 */
      case 1280:
      /* BIFF5 */
      case 1024:
      /* BIFF4 */
      case 768:
      /* BIFF3 */
      case 512:
      /* BIFF2 */
      case 2:
      case 7:
        break;
      default:
        if (length > 6) throw new Error("Unexpected BIFF Ver " + o.BIFFVer);
    }
    blob.read_shift(length);
    return o;
  }
  function parse_InterfaceHdr(blob, length) {
    if (length === 0) return 1200;
    if (blob.read_shift(2) !== 1200) {
    }
    return 1200;
  }
  function parse_WriteAccess(blob, length, opts) {
    if (opts.enc) {
      blob.l += length;
      return "";
    }
    var l2 = blob.l;
    var UserName = parse_XLUnicodeString2(blob, 0, opts);
    blob.read_shift(length + l2 - blob.l);
    return UserName;
  }
  function parse_WsBool(blob, length, opts) {
    var flags = opts && opts.biff == 8 || length == 2 ? blob.read_shift(2) : (blob.l += length, 0);
    return { fDialog: flags & 16, fBelow: flags & 64, fRight: flags & 128 };
  }
  function parse_BoundSheet8(blob, length, opts) {
    var pos = blob.read_shift(4);
    var hidden = blob.read_shift(1) & 3;
    var dt = blob.read_shift(1);
    switch (dt) {
      case 0:
        dt = "Worksheet";
        break;
      case 1:
        dt = "Macrosheet";
        break;
      case 2:
        dt = "Chartsheet";
        break;
      case 6:
        dt = "VBAModule";
        break;
    }
    var name = parse_ShortXLUnicodeString(blob, 0, opts);
    if (name.length === 0) name = "Sheet1";
    return { pos, hs: hidden, dt, name };
  }
  function parse_SST(blob, length) {
    var end = blob.l + length;
    var cnt = blob.read_shift(4);
    var ucnt = blob.read_shift(4);
    var strs2 = [];
    for (var i = 0; i != ucnt && blob.l < end; ++i) {
      strs2.push(parse_XLUnicodeRichExtendedString(blob));
    }
    strs2.Count = cnt;
    strs2.Unique = ucnt;
    return strs2;
  }
  function parse_ExtSST(blob, length) {
    var extsst = {};
    extsst.dsst = blob.read_shift(2);
    blob.l += length - 2;
    return extsst;
  }
  function parse_Row(blob) {
    var z = {};
    z.r = blob.read_shift(2);
    z.c = blob.read_shift(2);
    z.cnt = blob.read_shift(2) - z.c;
    var miyRw = blob.read_shift(2);
    blob.l += 4;
    var flags = blob.read_shift(1);
    blob.l += 3;
    if (flags & 7) z.level = flags & 7;
    if (flags & 32) z.hidden = true;
    if (flags & 64) z.hpt = miyRw / 20;
    return z;
  }
  function parse_ForceFullCalculation(blob) {
    var header = parse_frtHeader(blob);
    if (header.type != 2211) throw new Error("Invalid Future Record " + header.type);
    var fullcalc = blob.read_shift(4);
    return fullcalc !== 0;
  }
  function parse_RecalcId(blob) {
    blob.read_shift(2);
    return blob.read_shift(4);
  }
  function parse_DefaultRowHeight(blob, length, opts) {
    var f = 0;
    if (!(opts && opts.biff == 2)) {
      f = blob.read_shift(2);
    }
    var miyRw = blob.read_shift(2);
    if (opts && opts.biff == 2) {
      f = 1 - (miyRw >> 15);
      miyRw &= 32767;
    }
    var fl = { Unsynced: f & 1, DyZero: (f & 2) >> 1, ExAsc: (f & 4) >> 2, ExDsc: (f & 8) >> 3 };
    return [fl, miyRw];
  }
  function parse_Window1(blob) {
    var xWn = blob.read_shift(2), yWn = blob.read_shift(2), dxWn = blob.read_shift(2), dyWn = blob.read_shift(2);
    var flags = blob.read_shift(2), iTabCur = blob.read_shift(2), iTabFirst = blob.read_shift(2);
    var ctabSel = blob.read_shift(2), wTabRatio = blob.read_shift(2);
    return {
      Pos: [xWn, yWn],
      Dim: [dxWn, dyWn],
      Flags: flags,
      CurTab: iTabCur,
      FirstTab: iTabFirst,
      Selected: ctabSel,
      TabRatio: wTabRatio
    };
  }
  function parse_Window2(blob, length, opts) {
    if (opts && opts.biff >= 2 && opts.biff < 5) return {};
    var f = blob.read_shift(2);
    return { RTL: f & 64 };
  }
  function parse_Pane() {
  }
  function parse_Font(blob, length, opts) {
    var o = {
      dyHeight: blob.read_shift(2),
      fl: blob.read_shift(2)
    };
    switch (opts && opts.biff || 8) {
      case 2:
        break;
      case 3:
      case 4:
        blob.l += 2;
        break;
      default:
        blob.l += 10;
        break;
    }
    o.name = parse_ShortXLUnicodeString(blob, 0, opts);
    return o;
  }
  function parse_LabelSst(blob) {
    var cell = parse_XLSCell(blob);
    cell.isst = blob.read_shift(4);
    return cell;
  }
  function parse_Label(blob, length, opts) {
    if (opts.biffguess && opts.biff == 2) opts.biff = 5;
    var target = blob.l + length;
    var cell = parse_XLSCell(blob, 6);
    if (opts.biff == 2) blob.l++;
    var str = parse_XLUnicodeString(blob, target - blob.l, opts);
    cell.val = str;
    return cell;
  }
  function parse_Format(blob, length, opts) {
    var numFmtId = blob.read_shift(2);
    var fmtstr = parse_XLUnicodeString2(blob, 0, opts);
    return [numFmtId, fmtstr];
  }
  var parse_BIFF2Format = parse_XLUnicodeString2;
  function parse_Dimensions(blob, length, opts) {
    var end = blob.l + length;
    var w = opts.biff == 8 || !opts.biff ? 4 : 2;
    var r = blob.read_shift(w), R = blob.read_shift(w);
    var c = blob.read_shift(2), C = blob.read_shift(2);
    blob.l = end;
    return { s: { r, c }, e: { r: R, c: C } };
  }
  function parse_RK(blob) {
    var rw = blob.read_shift(2), col = blob.read_shift(2);
    var rkrec = parse_RkRec(blob);
    return { r: rw, c: col, ixfe: rkrec[0], rknum: rkrec[1] };
  }
  function parse_MulRk(blob, length) {
    var target = blob.l + length - 2;
    var rw = blob.read_shift(2), col = blob.read_shift(2);
    var rkrecs = [];
    while (blob.l < target) rkrecs.push(parse_RkRec(blob));
    if (blob.l !== target) throw new Error("MulRK read error");
    var lastcol = blob.read_shift(2);
    if (rkrecs.length != lastcol - col + 1) throw new Error("MulRK length mismatch");
    return { r: rw, c: col, C: lastcol, rkrec: rkrecs };
  }
  function parse_MulBlank(blob, length) {
    var target = blob.l + length - 2;
    var rw = blob.read_shift(2), col = blob.read_shift(2);
    var ixfes = [];
    while (blob.l < target) ixfes.push(blob.read_shift(2));
    if (blob.l !== target) throw new Error("MulBlank read error");
    var lastcol = blob.read_shift(2);
    if (ixfes.length != lastcol - col + 1) throw new Error("MulBlank length mismatch");
    return { r: rw, c: col, C: lastcol, ixfe: ixfes };
  }
  function parse_CellStyleXF(blob, length, style, opts) {
    var o = {};
    var a = blob.read_shift(4), b = blob.read_shift(4);
    var c = blob.read_shift(4), d = blob.read_shift(2);
    o.patternType = XLSFillPattern[c >> 26];
    if (!opts.cellStyles) return o;
    o.alc = a & 7;
    o.fWrap = a >> 3 & 1;
    o.alcV = a >> 4 & 7;
    o.fJustLast = a >> 7 & 1;
    o.trot = a >> 8 & 255;
    o.cIndent = a >> 16 & 15;
    o.fShrinkToFit = a >> 20 & 1;
    o.iReadOrder = a >> 22 & 2;
    o.fAtrNum = a >> 26 & 1;
    o.fAtrFnt = a >> 27 & 1;
    o.fAtrAlc = a >> 28 & 1;
    o.fAtrBdr = a >> 29 & 1;
    o.fAtrPat = a >> 30 & 1;
    o.fAtrProt = a >> 31 & 1;
    o.dgLeft = b & 15;
    o.dgRight = b >> 4 & 15;
    o.dgTop = b >> 8 & 15;
    o.dgBottom = b >> 12 & 15;
    o.icvLeft = b >> 16 & 127;
    o.icvRight = b >> 23 & 127;
    o.grbitDiag = b >> 30 & 3;
    o.icvTop = c & 127;
    o.icvBottom = c >> 7 & 127;
    o.icvDiag = c >> 14 & 127;
    o.dgDiag = c >> 21 & 15;
    o.icvFore = d & 127;
    o.icvBack = d >> 7 & 127;
    o.fsxButton = d >> 14 & 1;
    return o;
  }
  function parse_XF(blob, length, opts) {
    var o = {};
    o.ifnt = blob.read_shift(2);
    o.numFmtId = blob.read_shift(2);
    o.flags = blob.read_shift(2);
    o.fStyle = o.flags >> 2 & 1;
    length -= 6;
    o.data = parse_CellStyleXF(blob, length, o.fStyle, opts);
    return o;
  }
  function parse_Guts(blob) {
    blob.l += 4;
    var out = [blob.read_shift(2), blob.read_shift(2)];
    if (out[0] !== 0) out[0]--;
    if (out[1] !== 0) out[1]--;
    if (out[0] > 7 || out[1] > 7) throw new Error("Bad Gutters: " + out.join("|"));
    return out;
  }
  function parse_BoolErr(blob, length, opts) {
    var cell = parse_XLSCell(blob, 6);
    if (opts.biff == 2 || length == 9) ++blob.l;
    var val = parse_Bes(blob, 2);
    cell.val = val;
    cell.t = val === true || val === false ? "b" : "e";
    return cell;
  }
  function parse_Number(blob, length, opts) {
    if (opts.biffguess && opts.biff == 2) opts.biff = 5;
    var cell = parse_XLSCell(blob, 6);
    var xnum = parse_Xnum(blob, 8);
    cell.val = xnum;
    return cell;
  }
  var parse_XLHeaderFooter = parse_OptXLUnicodeString;
  function parse_SupBook(blob, length, opts) {
    var end = blob.l + length;
    var ctab = blob.read_shift(2);
    var cch = blob.read_shift(2);
    opts.sbcch = cch;
    if (cch == 1025 || cch == 14849) return [cch, ctab];
    if (cch < 1 || cch > 255) throw new Error("Unexpected SupBook type: " + cch);
    var virtPath = parse_XLUnicodeStringNoCch(blob, cch);
    var rgst = [];
    while (end > blob.l) rgst.push(parse_XLUnicodeString(blob));
    return [cch, ctab, virtPath, rgst];
  }
  function parse_ExternName(blob, length, opts) {
    var flags = blob.read_shift(2);
    var body;
    var o = {
      fBuiltIn: flags & 1,
      fWantAdvise: flags >>> 1 & 1,
      fWantPict: flags >>> 2 & 1,
      fOle: flags >>> 3 & 1,
      fOleLink: flags >>> 4 & 1,
      cf: flags >>> 5 & 1023,
      fIcon: flags >>> 15 & 1
    };
    if (opts.sbcch === 14849) body = parse_AddinUdf(blob, length - 2, opts);
    o.body = body || blob.read_shift(length - 2);
    if (typeof body === "string") o.Name = body;
    return o;
  }
  var XLSLblBuiltIn = [
    "_xlnm.Consolidate_Area",
    "_xlnm.Auto_Open",
    "_xlnm.Auto_Close",
    "_xlnm.Extract",
    "_xlnm.Database",
    "_xlnm.Criteria",
    "_xlnm.Print_Area",
    "_xlnm.Print_Titles",
    "_xlnm.Recorder",
    "_xlnm.Data_Form",
    "_xlnm.Auto_Activate",
    "_xlnm.Auto_Deactivate",
    "_xlnm.Sheet_Title",
    "_xlnm._FilterDatabase"
  ];
  function parse_Lbl(blob, length, opts) {
    var target = blob.l + length;
    var flags = blob.read_shift(2);
    var chKey = blob.read_shift(1);
    var cch = blob.read_shift(1);
    var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2);
    var itab = 0;
    if (!opts || opts.biff >= 5) {
      if (opts.biff != 5) blob.l += 2;
      itab = blob.read_shift(2);
      if (opts.biff == 5) blob.l += 2;
      blob.l += 4;
    }
    var name = parse_XLUnicodeStringNoCch(blob, cch, opts);
    if (flags & 32) name = XLSLblBuiltIn[name.charCodeAt(0)];
    var npflen = target - blob.l;
    if (opts && opts.biff == 2) --npflen;
    var rgce = target == blob.l || cce === 0 || !(npflen > 0) ? [] : parse_NameParsedFormula(blob, npflen, opts, cce);
    return {
      chKey,
      Name: name,
      itab,
      rgce
    };
  }
  function parse_ExternSheet(blob, length, opts) {
    if (opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts);
    var o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2);
    while (len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts));
    if (blob.l != target) throw new Error("Bad ExternSheet: " + blob.l + " != " + target);
    return o;
  }
  function parse_BIFF5ExternSheet(blob, length, opts) {
    if (blob[blob.l + 1] == 3) blob[blob.l]++;
    var o = parse_ShortXLUnicodeString(blob, length, opts);
    return o.charCodeAt(0) == 3 ? o.slice(1) : o;
  }
  function parse_NameCmt(blob, length, opts) {
    if (opts.biff < 8) {
      blob.l += length;
      return;
    }
    var cchName = blob.read_shift(2);
    var cchComment = blob.read_shift(2);
    var name = parse_XLUnicodeStringNoCch(blob, cchName, opts);
    var comment = parse_XLUnicodeStringNoCch(blob, cchComment, opts);
    return [name, comment];
  }
  function parse_ShrFmla(blob, length, opts) {
    var ref = parse_RefU(blob, 6);
    blob.l++;
    var cUse = blob.read_shift(1);
    length -= 8;
    return [parse_SharedParsedFormula(blob, length, opts), cUse, ref];
  }
  function parse_Array(blob, length, opts) {
    var ref = parse_Ref(blob, 6);
    switch (opts.biff) {
      case 2:
        blob.l++;
        length -= 7;
        break;
      case 3:
      case 4:
        blob.l += 2;
        length -= 8;
        break;
      default:
        blob.l += 6;
        length -= 12;
    }
    return [ref, parse_ArrayParsedFormula(blob, length, opts, ref)];
  }
  function parse_MTRSettings(blob) {
    var fMTREnabled = blob.read_shift(4) !== 0;
    var fUserSetThreadCount = blob.read_shift(4) !== 0;
    var cUserThreadCount = blob.read_shift(4);
    return [fMTREnabled, fUserSetThreadCount, cUserThreadCount];
  }
  function parse_NoteSh(blob, length, opts) {
    if (opts.biff < 8) return;
    var row = blob.read_shift(2), col = blob.read_shift(2);
    var flags = blob.read_shift(2), idObj = blob.read_shift(2);
    var stAuthor = parse_XLUnicodeString2(blob, 0, opts);
    if (opts.biff < 8) blob.read_shift(1);
    return [{ r: row, c: col }, stAuthor, idObj, flags];
  }
  function parse_Note(blob, length, opts) {
    return parse_NoteSh(blob, length, opts);
  }
  function parse_MergeCells(blob, length) {
    var merges = [];
    var cmcs = blob.read_shift(2);
    while (cmcs--) merges.push(parse_Ref8U(blob, length));
    return merges;
  }
  function parse_Obj(blob, length, opts) {
    if (opts && opts.biff < 8) return parse_BIFF5Obj(blob, length, opts);
    var cmo = parse_FtCmo(blob, 22);
    var fts = parse_FtArray(blob, length - 22, cmo[1]);
    return { cmo, ft: fts };
  }
  var parse_BIFF5OT = {
    8: function(blob, length) {
      var tgt = blob.l + length;
      blob.l += 10;
      var cf = blob.read_shift(2);
      blob.l += 4;
      blob.l += 2;
      blob.l += 2;
      blob.l += 2;
      blob.l += 4;
      var cchName = blob.read_shift(1);
      blob.l += cchName;
      blob.l = tgt;
      return { fmt: cf };
    }
  };
  function parse_BIFF5Obj(blob, length, opts) {
    blob.l += 4;
    var ot = blob.read_shift(2);
    var id = blob.read_shift(2);
    var grbit = blob.read_shift(2);
    blob.l += 2;
    blob.l += 2;
    blob.l += 2;
    blob.l += 2;
    blob.l += 2;
    blob.l += 2;
    blob.l += 2;
    blob.l += 2;
    blob.l += 2;
    blob.l += 6;
    length -= 36;
    var fts = [];
    fts.push((parse_BIFF5OT[ot] || parsenoop)(blob, length, opts));
    return { cmo: [id, ot, grbit], ft: fts };
  }
  function parse_TxO(blob, length, opts) {
    var s = blob.l;
    var texts = "";
    try {
      blob.l += 4;
      var ot = (opts.lastobj || { cmo: [0, 0] }).cmo[1];
      var controlInfo;
      if ([0, 5, 7, 11, 12, 14].indexOf(ot) == -1) blob.l += 6;
      else controlInfo = parse_ControlInfo(blob, 6, opts);
      var cchText = blob.read_shift(2);
      blob.read_shift(2);
      parseuint16(blob, 2);
      var len = blob.read_shift(2);
      blob.l += len;
      for (var i = 1; i < blob.lens.length - 1; ++i) {
        if (blob.l - s != blob.lens[i]) throw new Error("TxO: bad continue record");
        var hdr = blob[blob.l];
        var t = parse_XLUnicodeStringNoCch(blob, blob.lens[i + 1] - blob.lens[i] - 1);
        texts += t;
        if (texts.length >= (hdr ? cchText : 2 * cchText)) break;
      }
      if (texts.length !== cchText && texts.length !== cchText * 2) {
        throw new Error("cchText: " + cchText + " != " + texts.length);
      }
      blob.l = s + length;
      return { t: texts };
    } catch (e) {
      blob.l = s + length;
      return { t: texts };
    }
  }
  function parse_HLink(blob, length) {
    var ref = parse_Ref8U(blob, 8);
    blob.l += 16;
    var hlink = parse_Hyperlink(blob, length - 24);
    return [ref, hlink];
  }
  function parse_HLinkTooltip(blob, length) {
    blob.read_shift(2);
    var ref = parse_Ref8U(blob, 8);
    var wzTooltip = blob.read_shift((length - 10) / 2, "dbcs-cont");
    wzTooltip = wzTooltip.replace(chr0, "");
    return [ref, wzTooltip];
  }
  function parse_Country(blob) {
    var o = [0, 0], d;
    d = blob.read_shift(2);
    o[0] = CountryEnum[d] || d;
    d = blob.read_shift(2);
    o[1] = CountryEnum[d] || d;
    return o;
  }
  function parse_ClrtClient(blob) {
    var ccv = blob.read_shift(2);
    var o = [];
    while (ccv-- > 0) o.push(parse_LongRGB(blob, 8));
    return o;
  }
  function parse_Palette(blob) {
    var ccv = blob.read_shift(2);
    var o = [];
    while (ccv-- > 0) o.push(parse_LongRGB(blob, 8));
    return o;
  }
  function parse_XFCRC(blob) {
    blob.l += 2;
    var o = { cxfs: 0, crc: 0 };
    o.cxfs = blob.read_shift(2);
    o.crc = blob.read_shift(4);
    return o;
  }
  function parse_ColInfo(blob, length, opts) {
    if (!opts.cellStyles) return parsenoop(blob, length);
    var w = opts && opts.biff >= 12 ? 4 : 2;
    var colFirst = blob.read_shift(w);
    var colLast = blob.read_shift(w);
    var coldx = blob.read_shift(w);
    var ixfe = blob.read_shift(w);
    var flags = blob.read_shift(2);
    if (w == 2) blob.l += 2;
    var o = { s: colFirst, e: colLast, w: coldx, ixfe, flags };
    if (opts.biff >= 5 || !opts.biff) o.level = flags >> 8 & 7;
    return o;
  }
  function parse_Setup(blob, length) {
    var o = {};
    if (length < 32) return o;
    blob.l += 16;
    o.header = parse_Xnum(blob, 8);
    o.footer = parse_Xnum(blob, 8);
    blob.l += 2;
    return o;
  }
  function parse_ShtProps(blob, length, opts) {
    var def = { area: false };
    if (opts.biff != 5) {
      blob.l += length;
      return def;
    }
    var d = blob.read_shift(1);
    blob.l += 3;
    if (d & 16) def.area = true;
    return def;
  }
  var parse_Blank = parse_XLSCell;
  var parse_Scl = parseuint16a;
  var parse_String = parse_XLUnicodeString;
  function parse_ImData(blob) {
    var cf = blob.read_shift(2);
    var env2 = blob.read_shift(2);
    var lcb = blob.read_shift(4);
    var o = { fmt: cf, env: env2, len: lcb, data: blob.slice(blob.l, blob.l + lcb) };
    blob.l += lcb;
    return o;
  }
  function parse_BIFF2STR(blob, length, opts) {
    if (opts.biffguess && opts.biff == 5) opts.biff = 2;
    var cell = parse_XLSCell(blob, 6);
    ++blob.l;
    var str = parse_XLUnicodeString2(blob, length - 7, opts);
    cell.t = "str";
    cell.val = str;
    return cell;
  }
  function parse_BIFF2NUM(blob) {
    var cell = parse_XLSCell(blob, 6);
    ++blob.l;
    var num = parse_Xnum(blob, 8);
    cell.t = "n";
    cell.val = num;
    return cell;
  }
  function parse_BIFF2INT(blob) {
    var cell = parse_XLSCell(blob, 6);
    ++blob.l;
    var num = blob.read_shift(2);
    cell.t = "n";
    cell.val = num;
    return cell;
  }
  function parse_BIFF2STRING(blob) {
    var cch = blob.read_shift(1);
    if (cch === 0) {
      blob.l++;
      return "";
    }
    return blob.read_shift(cch, "sbcs-cont");
  }
  function parse_BIFF2FONTXTRA(blob, length) {
    blob.l += 6;
    blob.l += 2;
    blob.l += 1;
    blob.l += 3;
    blob.l += 1;
    blob.l += length - 13;
  }
  function parse_RString(blob, length, opts) {
    var end = blob.l + length;
    var cell = parse_XLSCell(blob, 6);
    var cch = blob.read_shift(2);
    var str = parse_XLUnicodeStringNoCch(blob, cch, opts);
    blob.l = end;
    cell.t = "str";
    cell.val = str;
    return cell;
  }
  var DBF_SUPPORTED_VERSIONS = [2, 3, 48, 49, 131, 139, 140, 245];
  var DBF = /* @__PURE__ */ (function() {
    var dbf_codepage_map = {
      /* Code Pages Supported by Visual FoxPro */
      /*::[*/
      1: 437,
      /*::[*/
      2: 850,
      /*::[*/
      3: 1252,
      /*::[*/
      4: 1e4,
      /*::[*/
      100: 852,
      /*::[*/
      101: 866,
      /*::[*/
      102: 865,
      /*::[*/
      103: 861,
      /*::[*/
      104: 895,
      /*::[*/
      105: 620,
      /*::[*/
      106: 737,
      /*::[*/
      107: 857,
      /*::[*/
      120: 950,
      /*::[*/
      121: 949,
      /*::[*/
      122: 936,
      /*::[*/
      123: 932,
      /*::[*/
      124: 874,
      /*::[*/
      125: 1255,
      /*::[*/
      126: 1256,
      /*::[*/
      150: 10007,
      /*::[*/
      151: 10029,
      /*::[*/
      152: 10006,
      /*::[*/
      200: 1250,
      /*::[*/
      201: 1251,
      /*::[*/
      202: 1254,
      /*::[*/
      203: 1253,
      /* shapefile DBF extension */
      /*::[*/
      0: 20127,
      /*::[*/
      8: 865,
      /*::[*/
      9: 437,
      /*::[*/
      10: 850,
      /*::[*/
      11: 437,
      /*::[*/
      13: 437,
      /*::[*/
      14: 850,
      /*::[*/
      15: 437,
      /*::[*/
      16: 850,
      /*::[*/
      17: 437,
      /*::[*/
      18: 850,
      /*::[*/
      19: 932,
      /*::[*/
      20: 850,
      /*::[*/
      21: 437,
      /*::[*/
      22: 850,
      /*::[*/
      23: 865,
      /*::[*/
      24: 437,
      /*::[*/
      25: 437,
      /*::[*/
      26: 850,
      /*::[*/
      27: 437,
      /*::[*/
      28: 863,
      /*::[*/
      29: 850,
      /*::[*/
      31: 852,
      /*::[*/
      34: 852,
      /*::[*/
      35: 852,
      /*::[*/
      36: 860,
      /*::[*/
      37: 850,
      /*::[*/
      38: 866,
      /*::[*/
      55: 850,
      /*::[*/
      64: 852,
      /*::[*/
      77: 936,
      /*::[*/
      78: 949,
      /*::[*/
      79: 950,
      /*::[*/
      80: 874,
      /*::[*/
      87: 1252,
      /*::[*/
      88: 1252,
      /*::[*/
      89: 1252,
      /*::[*/
      108: 863,
      /*::[*/
      134: 737,
      /*::[*/
      135: 852,
      /*::[*/
      136: 857,
      /*::[*/
      204: 1257,
      /*::[*/
      255: 16969
    };
    var dbf_reverse_map = evert({
      /*::[*/
      1: 437,
      /*::[*/
      2: 850,
      /*::[*/
      3: 1252,
      /*::[*/
      4: 1e4,
      /*::[*/
      100: 852,
      /*::[*/
      101: 866,
      /*::[*/
      102: 865,
      /*::[*/
      103: 861,
      /*::[*/
      104: 895,
      /*::[*/
      105: 620,
      /*::[*/
      106: 737,
      /*::[*/
      107: 857,
      /*::[*/
      120: 950,
      /*::[*/
      121: 949,
      /*::[*/
      122: 936,
      /*::[*/
      123: 932,
      /*::[*/
      124: 874,
      /*::[*/
      125: 1255,
      /*::[*/
      126: 1256,
      /*::[*/
      150: 10007,
      /*::[*/
      151: 10029,
      /*::[*/
      152: 10006,
      /*::[*/
      200: 1250,
      /*::[*/
      201: 1251,
      /*::[*/
      202: 1254,
      /*::[*/
      203: 1253,
      /*::[*/
      0: 20127
    });
    function dbf_to_aoa(buf, opts) {
      var out = [];
      var d = new_raw_buf(1);
      switch (opts.type) {
        case "base64":
          d = s2a(Base64_decode(buf));
          break;
        case "binary":
          d = s2a(buf);
          break;
        case "buffer":
        case "array":
          d = buf;
          break;
      }
      prep_blob(d, 0);
      var ft = d.read_shift(1);
      var memo = !!(ft & 136);
      var vfp = false, l7 = false;
      switch (ft) {
        case 2:
          break;
        // dBASE II
        case 3:
          break;
        // dBASE III
        case 48:
          vfp = true;
          memo = true;
          break;
        // VFP
        case 49:
          vfp = true;
          memo = true;
          break;
        // VFP with autoincrement
        // 0x43 dBASE IV SQL table files
        // 0x63 dBASE IV SQL system files
        case 131:
          break;
        // dBASE III with memo
        case 139:
          break;
        // dBASE IV with memo
        case 140:
          l7 = true;
          break;
        // dBASE Level 7 with memo
        // case 0xCB dBASE IV SQL table files with memo
        case 245:
          break;
        // FoxPro 2.x with memo
        // case 0xFB FoxBASE
        default:
          throw new Error("DBF Unsupported Version: " + ft.toString(16));
      }
      var nrow = 0, fpos = 521;
      if (ft == 2) nrow = d.read_shift(2);
      d.l += 3;
      if (ft != 2) nrow = d.read_shift(4);
      if (nrow > 1048576) nrow = 1e6;
      if (ft != 2) fpos = d.read_shift(2);
      var rlen = d.read_shift(2);
      var current_cp = opts.codepage || 1252;
      if (ft != 2) {
        d.l += 16;
        d.read_shift(1);
        if (d[d.l] !== 0) current_cp = dbf_codepage_map[d[d.l]];
        d.l += 1;
        d.l += 2;
      }
      if (l7) d.l += 36;
      var fields = [], field = {};
      var hend = Math.min(d.length, ft == 2 ? 521 : fpos - 10 - (vfp ? 264 : 0));
      var ww = l7 ? 32 : 11;
      while (d.l < hend && d[d.l] != 13) {
        field = {};
        field.name = $cptable.utils.decode(current_cp, d.slice(d.l, d.l + ww)).replace(/[\u0000\r\n].*$/g, "");
        d.l += ww;
        field.type = String.fromCharCode(d.read_shift(1));
        if (ft != 2 && !l7) field.offset = d.read_shift(4);
        field.len = d.read_shift(1);
        if (ft == 2) field.offset = d.read_shift(2);
        field.dec = d.read_shift(1);
        if (field.name.length) fields.push(field);
        if (ft != 2) d.l += l7 ? 13 : 14;
        switch (field.type) {
          case "B":
            if ((!vfp || field.len != 8) && opts.WTF) console.log("Skipping " + field.name + ":" + field.type);
            break;
          case "G":
          // General (FoxPro and dBASE L7)
          case "P":
            if (opts.WTF) console.log("Skipping " + field.name + ":" + field.type);
            break;
          case "+":
          // Autoincrement (dBASE L7 only)
          case "0":
          // _NullFlags (VFP only)
          case "@":
          // Timestamp (dBASE L7 only)
          case "C":
          // Character (dBASE II)
          case "D":
          // Date (dBASE III)
          case "F":
          // Float (dBASE IV)
          case "I":
          // Long (VFP and dBASE L7)
          case "L":
          // Logical (dBASE II)
          case "M":
          // Memo (dBASE III)
          case "N":
          // Number (dBASE II)
          case "O":
          // Double (dBASE L7 only)
          case "T":
          // Datetime (VFP only)
          case "Y":
            break;
          default:
            throw new Error("Unknown Field Type: " + field.type);
        }
      }
      if (d[d.l] !== 13) d.l = fpos - 1;
      if (d.read_shift(1) !== 13) throw new Error("DBF Terminator not found " + d.l + " " + d[d.l]);
      d.l = fpos;
      var R = 0, C = 0;
      out[0] = [];
      for (C = 0; C != fields.length; ++C) out[0][C] = fields[C].name;
      while (nrow-- > 0) {
        if (d[d.l] === 42) {
          d.l += rlen;
          continue;
        }
        ++d.l;
        out[++R] = [];
        C = 0;
        for (C = 0; C != fields.length; ++C) {
          var dd = d.slice(d.l, d.l + fields[C].len);
          d.l += fields[C].len;
          prep_blob(dd, 0);
          var s = $cptable.utils.decode(current_cp, dd);
          switch (fields[C].type) {
            case "C":
              if (s.trim().length) out[R][C] = s.replace(/\s+$/, "");
              break;
            case "D":
              if (s.length === 8) out[R][C] = new Date(+s.slice(0, 4), +s.slice(4, 6) - 1, +s.slice(6, 8));
              else out[R][C] = s;
              break;
            case "F":
              out[R][C] = parseFloat(s.trim());
              break;
            case "+":
            case "I":
              out[R][C] = l7 ? dd.read_shift(-4, "i") ^ 2147483648 : dd.read_shift(4, "i");
              break;
            case "L":
              switch (s.trim().toUpperCase()) {
                case "Y":
                case "T":
                  out[R][C] = true;
                  break;
                case "N":
                case "F":
                  out[R][C] = false;
                  break;
                case "":
                case "?":
                  break;
                default:
                  throw new Error("DBF Unrecognized L:|" + s + "|");
              }
              break;
            case "M":
              if (!memo) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16));
              out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10) : dd.read_shift(4));
              break;
            case "N":
              s = s.replace(/\u0000/g, "").trim();
              if (s && s != ".") out[R][C] = +s || 0;
              break;
            case "@":
              out[R][C] = new Date(dd.read_shift(-8, "f") - 621356832e5);
              break;
            case "T":
              out[R][C] = new Date((dd.read_shift(4) - 2440588) * 864e5 + dd.read_shift(4));
              break;
            case "Y":
              out[R][C] = dd.read_shift(4, "i") / 1e4 + dd.read_shift(4, "i") / 1e4 * Math.pow(2, 32);
              break;
            case "O":
              out[R][C] = -dd.read_shift(-8, "f");
              break;
            case "B":
              if (vfp && fields[C].len == 8) {
                out[R][C] = dd.read_shift(8, "f");
                break;
              }
            /* falls through */
            case "G":
            case "P":
              dd.l += fields[C].len;
              break;
            case "0":
              if (fields[C].name === "_NullFlags") break;
            /* falls through */
            default:
              throw new Error("DBF Unsupported data type " + fields[C].type);
          }
        }
      }
      if (ft != 2) {
        if (d.l < d.length && d[d.l++] != 26) throw new Error("DBF EOF Marker missing " + (d.l - 1) + " of " + d.length + " " + d[d.l - 1].toString(16));
      }
      if (opts && opts.sheetRows) out = out.slice(0, opts.sheetRows);
      opts.DBF = fields;
      return out;
    }
    function dbf_to_sheet(buf, opts) {
      var o = opts || {};
      if (!o.dateNF) o.dateNF = "yyyymmdd";
      var ws = aoa_to_sheet(dbf_to_aoa(buf, o), o);
      ws["!cols"] = o.DBF.map(function(field) {
        return {
          wch: field.len,
          DBF: field
        };
      });
      delete o.DBF;
      return ws;
    }
    function dbf_to_workbook(buf, opts) {
      try {
        return sheet_to_workbook(dbf_to_sheet(buf, opts), opts);
      } catch (e) {
        if (opts && opts.WTF) throw e;
      }
      return { SheetNames: [], Sheets: {} };
    }
    var _RLEN = { "B": 8, "C": 250, "L": 1, "D": 8, "?": 0, "": 0 };
    function sheet_to_dbf(ws, opts) {
      var o = opts || {};
      if (+o.codepage >= 0) set_cp(+o.codepage);
      if (o.type == "string") throw new Error("Cannot write DBF to JS string");
      var ba = buf_array();
      var aoa = sheet_to_json(ws, { header: 1, raw: true, cellDates: true });
      var headers = aoa[0], data = aoa.slice(1), cols = ws["!cols"] || [];
      var i = 0, j = 0, hcnt = 0, rlen = 1;
      for (i = 0; i < headers.length; ++i) {
        if (((cols[i] || {}).DBF || {}).name) {
          headers[i] = cols[i].DBF.name;
          ++hcnt;
          continue;
        }
        if (headers[i] == null) continue;
        ++hcnt;
        if (typeof headers[i] === "number") headers[i] = headers[i].toString(10);
        if (typeof headers[i] !== "string") throw new Error("DBF Invalid column name " + headers[i] + " |" + typeof headers[i] + "|");
        if (headers.indexOf(headers[i]) !== i) {
          for (j = 0; j < 1024; ++j)
            if (headers.indexOf(headers[i] + "_" + j) == -1) {
              headers[i] += "_" + j;
              break;
            }
        }
      }
      var range2 = safe_decode_range(ws["!ref"]);
      var coltypes = [];
      var colwidths = [];
      var coldecimals = [];
      for (i = 0; i <= range2.e.c - range2.s.c; ++i) {
        var guess = "", _guess = "", maxlen = 0;
        var col = [];
        for (j = 0; j < data.length; ++j) {
          if (data[j][i] != null) col.push(data[j][i]);
        }
        if (col.length == 0 || headers[i] == null) {
          coltypes[i] = "?";
          continue;
        }
        for (j = 0; j < col.length; ++j) {
          switch (typeof col[j]) {
            /* TODO: check if L2 compat is desired */
            case "number":
              _guess = "B";
              break;
            case "string":
              _guess = "C";
              break;
            case "boolean":
              _guess = "L";
              break;
            case "object":
              _guess = col[j] instanceof Date ? "D" : "C";
              break;
            default:
              _guess = "C";
          }
          maxlen = Math.max(maxlen, String(col[j]).length);
          guess = guess && guess != _guess ? "C" : _guess;
        }
        if (maxlen > 250) maxlen = 250;
        _guess = ((cols[i] || {}).DBF || {}).type;
        if (_guess == "C") {
          if (cols[i].DBF.len > maxlen) maxlen = cols[i].DBF.len;
        }
        if (guess == "B" && _guess == "N") {
          guess = "N";
          coldecimals[i] = cols[i].DBF.dec;
          maxlen = cols[i].DBF.len;
        }
        colwidths[i] = guess == "C" || _guess == "N" ? maxlen : _RLEN[guess] || 0;
        rlen += colwidths[i];
        coltypes[i] = guess;
      }
      var h = ba.next(32);
      h.write_shift(4, 318902576);
      h.write_shift(4, data.length);
      h.write_shift(2, 296 + 32 * hcnt);
      h.write_shift(2, rlen);
      for (i = 0; i < 4; ++i) h.write_shift(4, 0);
      h.write_shift(4, 0 | (+dbf_reverse_map[
        /*::String(*/
        current_ansi
        /*::)*/
      ] || 3) << 8);
      for (i = 0, j = 0; i < headers.length; ++i) {
        if (headers[i] == null) continue;
        var hf = ba.next(32);
        var _f = (headers[i].slice(-10) + "\0\0\0\0\0\0\0\0\0\0\0").slice(0, 11);
        hf.write_shift(1, _f, "sbcs");
        hf.write_shift(1, coltypes[i] == "?" ? "C" : coltypes[i], "sbcs");
        hf.write_shift(4, j);
        hf.write_shift(1, colwidths[i] || _RLEN[coltypes[i]] || 0);
        hf.write_shift(1, coldecimals[i] || 0);
        hf.write_shift(1, 2);
        hf.write_shift(4, 0);
        hf.write_shift(1, 0);
        hf.write_shift(4, 0);
        hf.write_shift(4, 0);
        j += colwidths[i] || _RLEN[coltypes[i]] || 0;
      }
      var hb = ba.next(264);
      hb.write_shift(4, 13);
      for (i = 0; i < 65; ++i) hb.write_shift(4, 0);
      for (i = 0; i < data.length; ++i) {
        var rout = ba.next(rlen);
        rout.write_shift(1, 0);
        for (j = 0; j < headers.length; ++j) {
          if (headers[j] == null) continue;
          switch (coltypes[j]) {
            case "L":
              rout.write_shift(1, data[i][j] == null ? 63 : data[i][j] ? 84 : 70);
              break;
            case "B":
              rout.write_shift(8, data[i][j] || 0, "f");
              break;
            case "N":
              var _n = "0";
              if (typeof data[i][j] == "number") _n = data[i][j].toFixed(coldecimals[j] || 0);
              for (hcnt = 0; hcnt < colwidths[j] - _n.length; ++hcnt) rout.write_shift(1, 32);
              rout.write_shift(1, _n, "sbcs");
              break;
            case "D":
              if (!data[i][j]) rout.write_shift(8, "00000000", "sbcs");
              else {
                rout.write_shift(4, ("0000" + data[i][j].getFullYear()).slice(-4), "sbcs");
                rout.write_shift(2, ("00" + (data[i][j].getMonth() + 1)).slice(-2), "sbcs");
                rout.write_shift(2, ("00" + data[i][j].getDate()).slice(-2), "sbcs");
              }
              break;
            case "C":
              var _s = String(data[i][j] != null ? data[i][j] : "").slice(0, colwidths[j]);
              rout.write_shift(1, _s, "sbcs");
              for (hcnt = 0; hcnt < colwidths[j] - _s.length; ++hcnt) rout.write_shift(1, 32);
              break;
          }
        }
      }
      ba.next(1).write_shift(1, 26);
      return ba.end();
    }
    return {
      to_workbook: dbf_to_workbook,
      to_sheet: dbf_to_sheet,
      from_sheet: sheet_to_dbf
    };
  })();
  var SYLK = /* @__PURE__ */ (function() {
    var sylk_escapes = {
      AA: "\xC0",
      BA: "\xC1",
      CA: "\xC2",
      DA: 195,
      HA: "\xC4",
      JA: 197,
      AE: "\xC8",
      BE: "\xC9",
      CE: "\xCA",
      HE: "\xCB",
      AI: "\xCC",
      BI: "\xCD",
      CI: "\xCE",
      HI: "\xCF",
      AO: "\xD2",
      BO: "\xD3",
      CO: "\xD4",
      DO: 213,
      HO: "\xD6",
      AU: "\xD9",
      BU: "\xDA",
      CU: "\xDB",
      HU: "\xDC",
      Aa: "\xE0",
      Ba: "\xE1",
      Ca: "\xE2",
      Da: 227,
      Ha: "\xE4",
      Ja: 229,
      Ae: "\xE8",
      Be: "\xE9",
      Ce: "\xEA",
      He: "\xEB",
      Ai: "\xEC",
      Bi: "\xED",
      Ci: "\xEE",
      Hi: "\xEF",
      Ao: "\xF2",
      Bo: "\xF3",
      Co: "\xF4",
      Do: 245,
      Ho: "\xF6",
      Au: "\xF9",
      Bu: "\xFA",
      Cu: "\xFB",
      Hu: "\xFC",
      KC: "\xC7",
      Kc: "\xE7",
      q: "\xE6",
      z: "\u0153",
      a: "\xC6",
      j: "\u0152",
      DN: 209,
      Dn: 241,
      Hy: 255,
      S: 169,
      c: 170,
      R: 174,
      "B ": 180,
      /*::[*/
      0: 176,
      /*::[*/
      1: 177,
      /*::[*/
      2: 178,
      /*::[*/
      3: 179,
      /*::[*/
      5: 181,
      /*::[*/
      6: 182,
      /*::[*/
      7: 183,
      Q: 185,
      k: 186,
      b: 208,
      i: 216,
      l: 222,
      s: 240,
      y: 248,
      "!": 161,
      '"': 162,
      "#": 163,
      "(": 164,
      "%": 165,
      "'": 167,
      "H ": 168,
      "+": 171,
      ";": 187,
      "<": 188,
      "=": 189,
      ">": 190,
      "?": 191,
      "{": 223
    };
    var sylk_char_regex = new RegExp("\x1BN(" + keys(sylk_escapes).join("|").replace(/\|\|\|/, "|\\||").replace(/([?()+])/g, "\\$1") + "|\\|)", "gm");
    var sylk_char_fn = function(_3, $1) {
      var o = sylk_escapes[$1];
      return typeof o == "number" ? _getansi(o) : o;
    };
    var decode_sylk_char = function($$, $1, $2) {
      var newcc = $1.charCodeAt(0) - 32 << 4 | $2.charCodeAt(0) - 48;
      return newcc == 59 ? $$ : _getansi(newcc);
    };
    sylk_escapes["|"] = 254;
    function sylk_to_aoa(d, opts) {
      switch (opts.type) {
        case "base64":
          return sylk_to_aoa_str(Base64_decode(d), opts);
        case "binary":
          return sylk_to_aoa_str(d, opts);
        case "buffer":
          return sylk_to_aoa_str(has_buf && Buffer.isBuffer(d) ? d.toString("binary") : a2s(d), opts);
        case "array":
          return sylk_to_aoa_str(cc2str(d), opts);
      }
      throw new Error("Unrecognized type " + opts.type);
    }
    function sylk_to_aoa_str(str, opts) {
      var records = str.split(/[\n\r]+/), R = -1, C = -1, ri = 0, rj = 0, arr = [];
      var formats = [];
      var next_cell_format = null;
      var sht = {}, rowinfo = [], colinfo = [], cw = [];
      var Mval = 0, j;
      if (+opts.codepage >= 0) set_cp(+opts.codepage);
      for (; ri !== records.length; ++ri) {
        Mval = 0;
        var rstr = records[ri].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g, decode_sylk_char).replace(sylk_char_regex, sylk_char_fn);
        var record = rstr.replace(/;;/g, "\0").split(";").map(function(x) {
          return x.replace(/\u0000/g, ";");
        });
        var RT = record[0], val;
        if (rstr.length > 0) switch (RT) {
          case "ID":
            break;
          /* header */
          case "E":
            break;
          /* EOF */
          case "B":
            break;
          /* dimensions */
          case "O":
            break;
          /* options? */
          case "W":
            break;
          /* window? */
          case "P":
            if (record[1].charAt(0) == "P")
              formats.push(rstr.slice(3).replace(/;;/g, ";"));
            break;
          case "C":
            var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1;
            for (rj = 1; rj < record.length; ++rj) switch (record[rj].charAt(0)) {
              case "A":
                break;
              // TODO: comment
              case "X":
                C = parseInt(record[rj].slice(1)) - 1;
                C_seen_X = true;
                break;
              case "Y":
                R = parseInt(record[rj].slice(1)) - 1;
                if (!C_seen_X) C = 0;
                for (j = arr.length; j <= R; ++j) arr[j] = [];
                break;
              case "K":
                val = record[rj].slice(1);
                if (val.charAt(0) === '"') val = val.slice(1, val.length - 1);
                else if (val === "TRUE") val = true;
                else if (val === "FALSE") val = false;
                else if (!isNaN(fuzzynum(val))) {
                  val = fuzzynum(val);
                  if (next_cell_format !== null && fmt_is_date(next_cell_format)) val = numdate(val);
                } else if (!isNaN(fuzzydate(val).getDate())) {
                  val = parseDate(val);
                }
                if (typeof $cptable !== "undefined" && typeof val == "string" && (opts || {}).type != "string" && (opts || {}).codepage) val = $cptable.utils.decode(opts.codepage, val);
                C_seen_K = true;
                break;
              case "E":
                C_seen_E = true;
                var formula = rc_to_a1(record[rj].slice(1), { r: R, c: C });
                arr[R][C] = [arr[R][C], formula];
                break;
              case "S":
                C_seen_S = true;
                arr[R][C] = [arr[R][C], "S5S"];
                break;
              case "G":
                break;
              // unknown
              case "R":
                _R = parseInt(record[rj].slice(1)) - 1;
                break;
              case "C":
                _C = parseInt(record[rj].slice(1)) - 1;
                break;
              default:
                if (opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
            }
            if (C_seen_K) {
              if (arr[R][C] && arr[R][C].length == 2) arr[R][C][0] = val;
              else arr[R][C] = val;
              next_cell_format = null;
            }
            if (C_seen_S) {
              if (C_seen_E) throw new Error("SYLK shared formula cannot have own formula");
              var shrbase = _R > -1 && arr[_R][_C];
              if (!shrbase || !shrbase[1]) throw new Error("SYLK shared formula cannot find base");
              arr[R][C][1] = shift_formula_str(shrbase[1], { r: R - _R, c: C - _C });
            }
            break;
          case "F":
            var F_seen = 0;
            for (rj = 1; rj < record.length; ++rj) switch (record[rj].charAt(0)) {
              case "X":
                C = parseInt(record[rj].slice(1)) - 1;
                ++F_seen;
                break;
              case "Y":
                R = parseInt(record[rj].slice(1)) - 1;
                for (j = arr.length; j <= R; ++j) arr[j] = [];
                break;
              case "M":
                Mval = parseInt(record[rj].slice(1)) / 20;
                break;
              case "F":
                break;
              /* ??? */
              case "G":
                break;
              /* hide grid */
              case "P":
                next_cell_format = formats[parseInt(record[rj].slice(1))];
                break;
              case "S":
                break;
              /* cell style */
              case "D":
                break;
              /* column */
              case "N":
                break;
              /* font */
              case "W":
                cw = record[rj].slice(1).split(" ");
                for (j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) {
                  Mval = parseInt(cw[2], 10);
                  colinfo[j - 1] = Mval === 0 ? { hidden: true } : { wch: Mval };
                  process_col(colinfo[j - 1]);
                }
                break;
              case "C":
                C = parseInt(record[rj].slice(1)) - 1;
                if (!colinfo[C]) colinfo[C] = {};
                break;
              case "R":
                R = parseInt(record[rj].slice(1)) - 1;
                if (!rowinfo[R]) rowinfo[R] = {};
                if (Mval > 0) {
                  rowinfo[R].hpt = Mval;
                  rowinfo[R].hpx = pt2px(Mval);
                } else if (Mval === 0) rowinfo[R].hidden = true;
                break;
              default:
                if (opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
            }
            if (F_seen < 1) next_cell_format = null;
            break;
          default:
            if (opts && opts.WTF) throw new Error("SYLK bad record " + rstr);
        }
      }
      if (rowinfo.length > 0) sht["!rows"] = rowinfo;
      if (colinfo.length > 0) sht["!cols"] = colinfo;
      if (opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
      return [arr, sht];
    }
    function sylk_to_sheet(d, opts) {
      var aoasht = sylk_to_aoa(d, opts);
      var aoa = aoasht[0], ws = aoasht[1];
      var o = aoa_to_sheet(aoa, opts);
      keys(ws).forEach(function(k) {
        o[k] = ws[k];
      });
      return o;
    }
    function sylk_to_workbook(d, opts) {
      return sheet_to_workbook(sylk_to_sheet(d, opts), opts);
    }
    function write_ws_cell_sylk(cell, ws, R, C) {
      var o = "C;Y" + (R + 1) + ";X" + (C + 1) + ";K";
      switch (cell.t) {
        case "n":
          o += cell.v || 0;
          if (cell.f && !cell.F) o += ";E" + a1_to_rc(cell.f, { r: R, c: C });
          break;
        case "b":
          o += cell.v ? "TRUE" : "FALSE";
          break;
        case "e":
          o += cell.w || cell.v;
          break;
        case "d":
          o += '"' + (cell.w || cell.v) + '"';
          break;
        case "s":
          o += '"' + cell.v.replace(/"/g, "").replace(/;/g, ";;") + '"';
          break;
      }
      return o;
    }
    function write_ws_cols_sylk(out, cols) {
      cols.forEach(function(col, i) {
        var rec = "F;W" + (i + 1) + " " + (i + 1) + " ";
        if (col.hidden) rec += "0";
        else {
          if (typeof col.width == "number" && !col.wpx) col.wpx = width2px(col.width);
          if (typeof col.wpx == "number" && !col.wch) col.wch = px2char(col.wpx);
          if (typeof col.wch == "number") rec += Math.round(col.wch);
        }
        if (rec.charAt(rec.length - 1) != " ") out.push(rec);
      });
    }
    function write_ws_rows_sylk(out, rows) {
      rows.forEach(function(row, i) {
        var rec = "F;";
        if (row.hidden) rec += "M0;";
        else if (row.hpt) rec += "M" + 20 * row.hpt + ";";
        else if (row.hpx) rec += "M" + 20 * px2pt(row.hpx) + ";";
        if (rec.length > 2) out.push(rec + "R" + (i + 1));
      });
    }
    function sheet_to_sylk(ws, opts) {
      var preamble = ["ID;PWXL;N;E"], o = [];
      var r = safe_decode_range(ws["!ref"]), cell;
      var dense = Array.isArray(ws);
      var RS = "\r\n";
      preamble.push("P;PGeneral");
      preamble.push("F;P0;DG0G8;M255");
      if (ws["!cols"]) write_ws_cols_sylk(preamble, ws["!cols"]);
      if (ws["!rows"]) write_ws_rows_sylk(preamble, ws["!rows"]);
      preamble.push("B;Y" + (r.e.r - r.s.r + 1) + ";X" + (r.e.c - r.s.c + 1) + ";D" + [r.s.c, r.s.r, r.e.c, r.e.r].join(" "));
      for (var R = r.s.r; R <= r.e.r; ++R) {
        for (var C = r.s.c; C <= r.e.c; ++C) {
          var coord = encode_cell({ r: R, c: C });
          cell = dense ? (ws[R] || [])[C] : ws[coord];
          if (!cell || cell.v == null && (!cell.f || cell.F)) continue;
          o.push(write_ws_cell_sylk(cell, ws, R, C, opts));
        }
      }
      return preamble.join(RS) + RS + o.join(RS) + RS + "E" + RS;
    }
    return {
      to_workbook: sylk_to_workbook,
      to_sheet: sylk_to_sheet,
      from_sheet: sheet_to_sylk
    };
  })();
  var DIF = /* @__PURE__ */ (function() {
    function dif_to_aoa(d, opts) {
      switch (opts.type) {
        case "base64":
          return dif_to_aoa_str(Base64_decode(d), opts);
        case "binary":
          return dif_to_aoa_str(d, opts);
        case "buffer":
          return dif_to_aoa_str(has_buf && Buffer.isBuffer(d) ? d.toString("binary") : a2s(d), opts);
        case "array":
          return dif_to_aoa_str(cc2str(d), opts);
      }
      throw new Error("Unrecognized type " + opts.type);
    }
    function dif_to_aoa_str(str, opts) {
      var records = str.split("\n"), R = -1, C = -1, ri = 0, arr = [];
      for (; ri !== records.length; ++ri) {
        if (records[ri].trim() === "BOT") {
          arr[++R] = [];
          C = 0;
          continue;
        }
        if (R < 0) continue;
        var metadata = records[ri].trim().split(",");
        var type = metadata[0], value = metadata[1];
        ++ri;
        var data = records[ri] || "";
        while ((data.match(/["]/g) || []).length & 1 && ri < records.length - 1) data += "\n" + records[++ri];
        data = data.trim();
        switch (+type) {
          case -1:
            if (data === "BOT") {
              arr[++R] = [];
              C = 0;
              continue;
            } else if (data !== "EOD") throw new Error("Unrecognized DIF special command " + data);
            break;
          case 0:
            if (data === "TRUE") arr[R][C] = true;
            else if (data === "FALSE") arr[R][C] = false;
            else if (!isNaN(fuzzynum(value))) arr[R][C] = fuzzynum(value);
            else if (!isNaN(fuzzydate(value).getDate())) arr[R][C] = parseDate(value);
            else arr[R][C] = value;
            ++C;
            break;
          case 1:
            data = data.slice(1, data.length - 1);
            data = data.replace(/""/g, '"');
            if (DIF_XL && data && data.match(/^=".*"$/)) data = data.slice(2, -1);
            arr[R][C++] = data !== "" ? data : null;
            break;
        }
        if (data === "EOD") break;
      }
      if (opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
      return arr;
    }
    function dif_to_sheet(str, opts) {
      return aoa_to_sheet(dif_to_aoa(str, opts), opts);
    }
    function dif_to_workbook(str, opts) {
      return sheet_to_workbook(dif_to_sheet(str, opts), opts);
    }
    var sheet_to_dif = /* @__PURE__ */ (function() {
      var push_field = function pf(o, topic, v, n, s) {
        o.push(topic);
        o.push(v + "," + n);
        o.push('"' + s.replace(/"/g, '""') + '"');
      };
      var push_value = function po(o, type, v, s) {
        o.push(type + "," + v);
        o.push(type == 1 ? '"' + s.replace(/"/g, '""') + '"' : s);
      };
      return function sheet_to_dif2(ws) {
        var o = [];
        var r = safe_decode_range(ws["!ref"]), cell;
        var dense = Array.isArray(ws);
        push_field(o, "TABLE", 0, 1, "sheetjs");
        push_field(o, "VECTORS", 0, r.e.r - r.s.r + 1, "");
        push_field(o, "TUPLES", 0, r.e.c - r.s.c + 1, "");
        push_field(o, "DATA", 0, 0, "");
        for (var R = r.s.r; R <= r.e.r; ++R) {
          push_value(o, -1, 0, "BOT");
          for (var C = r.s.c; C <= r.e.c; ++C) {
            var coord = encode_cell({ r: R, c: C });
            cell = dense ? (ws[R] || [])[C] : ws[coord];
            if (!cell) {
              push_value(o, 1, 0, "");
              continue;
            }
            switch (cell.t) {
              case "n":
                var val = DIF_XL ? cell.w : cell.v;
                if (!val && cell.v != null) val = cell.v;
                if (val == null) {
                  if (DIF_XL && cell.f && !cell.F) push_value(o, 1, 0, "=" + cell.f);
                  else push_value(o, 1, 0, "");
                } else push_value(o, 0, val, "V");
                break;
              case "b":
                push_value(o, 0, cell.v ? 1 : 0, cell.v ? "TRUE" : "FALSE");
                break;
              case "s":
                push_value(o, 1, 0, !DIF_XL || isNaN(cell.v) ? cell.v : '="' + cell.v + '"');
                break;
              case "d":
                if (!cell.w) cell.w = SSF_format(cell.z || table_fmt[14], datenum(parseDate(cell.v)));
                if (DIF_XL) push_value(o, 0, cell.w, "V");
                else push_value(o, 1, 0, cell.w);
                break;
              default:
                push_value(o, 1, 0, "");
            }
          }
        }
        push_value(o, -1, 0, "EOD");
        var RS = "\r\n";
        var oo = o.join(RS);
        return oo;
      };
    })();
    return {
      to_workbook: dif_to_workbook,
      to_sheet: dif_to_sheet,
      from_sheet: sheet_to_dif
    };
  })();
  var ETH = /* @__PURE__ */ (function() {
    function decode(s) {
      return s.replace(/\\b/g, "\\").replace(/\\c/g, ":").replace(/\\n/g, "\n");
    }
    function encode(s) {
      return s.replace(/\\/g, "\\b").replace(/:/g, "\\c").replace(/\n/g, "\\n");
    }
    function eth_to_aoa(str, opts) {
      var records = str.split("\n"), R = -1, C = -1, ri = 0, arr = [];
      for (; ri !== records.length; ++ri) {
        var record = records[ri].trim().split(":");
        if (record[0] !== "cell") continue;
        var addr = decode_cell(record[1]);
        if (arr.length <= addr.r) {
          for (R = arr.length; R <= addr.r; ++R) if (!arr[R]) arr[R] = [];
        }
        R = addr.r;
        C = addr.c;
        switch (record[2]) {
          case "t":
            arr[R][C] = decode(record[3]);
            break;
          case "v":
            arr[R][C] = +record[3];
            break;
          case "vtf":
            var _f = record[record.length - 1];
          /* falls through */
          case "vtc":
            switch (record[3]) {
              case "nl":
                arr[R][C] = +record[4] ? true : false;
                break;
              default:
                arr[R][C] = +record[4];
                break;
            }
            if (record[2] == "vtf") arr[R][C] = [arr[R][C], _f];
        }
      }
      if (opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows);
      return arr;
    }
    function eth_to_sheet(d, opts) {
      return aoa_to_sheet(eth_to_aoa(d, opts), opts);
    }
    function eth_to_workbook(d, opts) {
      return sheet_to_workbook(eth_to_sheet(d, opts), opts);
    }
    var header = [
      "socialcalc:version:1.5",
      "MIME-Version: 1.0",
      "Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"
    ].join("\n");
    var sep = [
      "--SocialCalcSpreadsheetControlSave",
      "Content-type: text/plain; charset=UTF-8"
    ].join("\n") + "\n";
    var meta = [
      "# SocialCalc Spreadsheet Control Save",
      "part:sheet"
    ].join("\n");
    var end = "--SocialCalcSpreadsheetControlSave--";
    function sheet_to_eth_data(ws) {
      if (!ws || !ws["!ref"]) return "";
      var o = [], oo = [], cell, coord = "";
      var r = decode_range(ws["!ref"]);
      var dense = Array.isArray(ws);
      for (var R = r.s.r; R <= r.e.r; ++R) {
        for (var C = r.s.c; C <= r.e.c; ++C) {
          coord = encode_cell({ r: R, c: C });
          cell = dense ? (ws[R] || [])[C] : ws[coord];
          if (!cell || cell.v == null || cell.t === "z") continue;
          oo = ["cell", coord, "t"];
          switch (cell.t) {
            case "s":
            case "str":
              oo.push(encode(cell.v));
              break;
            case "n":
              if (!cell.f) {
                oo[2] = "v";
                oo[3] = cell.v;
              } else {
                oo[2] = "vtf";
                oo[3] = "n";
                oo[4] = cell.v;
                oo[5] = encode(cell.f);
              }
              break;
            case "b":
              oo[2] = "vt" + (cell.f ? "f" : "c");
              oo[3] = "nl";
              oo[4] = cell.v ? "1" : "0";
              oo[5] = encode(cell.f || (cell.v ? "TRUE" : "FALSE"));
              break;
            case "d":
              var t = datenum(parseDate(cell.v));
              oo[2] = "vtc";
              oo[3] = "nd";
              oo[4] = "" + t;
              oo[5] = cell.w || SSF_format(cell.z || table_fmt[14], t);
              break;
            case "e":
              continue;
          }
          o.push(oo.join(":"));
        }
      }
      o.push("sheet:c:" + (r.e.c - r.s.c + 1) + ":r:" + (r.e.r - r.s.r + 1) + ":tvf:1");
      o.push("valueformat:1:text-wiki");
      return o.join("\n");
    }
    function sheet_to_eth(ws) {
      return [header, sep, meta, sep, sheet_to_eth_data(ws), end].join("\n");
    }
    return {
      to_workbook: eth_to_workbook,
      to_sheet: eth_to_sheet,
      from_sheet: sheet_to_eth
    };
  })();
  var PRN = /* @__PURE__ */ (function() {
    function set_text_arr(data, arr, R, C, o) {
      if (o.raw) arr[R][C] = data;
      else if (data === "") {
      } else if (data === "TRUE") arr[R][C] = true;
      else if (data === "FALSE") arr[R][C] = false;
      else if (!isNaN(fuzzynum(data))) arr[R][C] = fuzzynum(data);
      else if (!isNaN(fuzzydate(data).getDate())) arr[R][C] = parseDate(data);
      else arr[R][C] = data;
    }
    function prn_to_aoa_str(f, opts) {
      var o = opts || {};
      var arr = [];
      if (!f || f.length === 0) return arr;
      var lines = f.split(/[\r\n]/);
      var L = lines.length - 1;
      while (L >= 0 && lines[L].length === 0) --L;
      var start = 10, idx = 0;
      var R = 0;
      for (; R <= L; ++R) {
        idx = lines[R].indexOf(" ");
        if (idx == -1) idx = lines[R].length;
        else idx++;
        start = Math.max(start, idx);
      }
      for (R = 0; R <= L; ++R) {
        arr[R] = [];
        var C = 0;
        set_text_arr(lines[R].slice(0, start).trim(), arr, R, C, o);
        for (C = 1; C <= (lines[R].length - start) / 10 + 1; ++C)
          set_text_arr(lines[R].slice(start + (C - 1) * 10, start + C * 10).trim(), arr, R, C, o);
      }
      if (o.sheetRows) arr = arr.slice(0, o.sheetRows);
      return arr;
    }
    var guess_seps = {
      /*::[*/
      44: ",",
      /*::[*/
      9: "	",
      /*::[*/
      59: ";",
      /*::[*/
      124: "|"
    };
    var guess_sep_weights = {
      /*::[*/
      44: 3,
      /*::[*/
      9: 2,
      /*::[*/
      59: 1,
      /*::[*/
      124: 0
    };
    function guess_sep(str) {
      var cnt = {}, instr = false, end = 0, cc = 0;
      for (; end < str.length; ++end) {
        if ((cc = str.charCodeAt(end)) == 34) instr = !instr;
        else if (!instr && cc in guess_seps) cnt[cc] = (cnt[cc] || 0) + 1;
      }
      cc = [];
      for (end in cnt) if (Object.prototype.hasOwnProperty.call(cnt, end)) {
        cc.push([cnt[end], end]);
      }
      if (!cc.length) {
        cnt = guess_sep_weights;
        for (end in cnt) if (Object.prototype.hasOwnProperty.call(cnt, end)) {
          cc.push([cnt[end], end]);
        }
      }
      cc.sort(function(a, b) {
        return a[0] - b[0] || guess_sep_weights[a[1]] - guess_sep_weights[b[1]];
      });
      return guess_seps[cc.pop()[1]] || 44;
    }
    function dsv_to_sheet_str(str, opts) {
      var o = opts || {};
      var sep = "";
      if (DENSE != null && o.dense == null) o.dense = DENSE;
      var ws = o.dense ? [] : {};
      var range2 = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
      if (str.slice(0, 4) == "sep=") {
        if (str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10) {
          sep = str.charAt(4);
          str = str.slice(7);
        } else if (str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10) {
          sep = str.charAt(4);
          str = str.slice(6);
        } else sep = guess_sep(str.slice(0, 1024));
      } else if (o && o.FS) sep = o.FS;
      else sep = guess_sep(str.slice(0, 1024));
      var R = 0, C = 0, v = 0;
      var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc = 0, startcc = str.charCodeAt(0);
      str = str.replace(/\r\n/mg, "\n");
      var _re = o.dateNF != null ? dateNF_regex(o.dateNF) : null;
      function finish_cell() {
        var s = str.slice(start, end);
        var cell = {};
        if (s.charAt(0) == '"' && s.charAt(s.length - 1) == '"') s = s.slice(1, -1).replace(/""/g, '"');
        if (s.length === 0) cell.t = "z";
        else if (o.raw) {
          cell.t = "s";
          cell.v = s;
        } else if (s.trim().length === 0) {
          cell.t = "s";
          cell.v = s;
        } else if (s.charCodeAt(0) == 61) {
          if (s.charCodeAt(1) == 34 && s.charCodeAt(s.length - 1) == 34) {
            cell.t = "s";
            cell.v = s.slice(2, -1).replace(/""/g, '"');
          } else if (fuzzyfmla(s)) {
            cell.t = "n";
            cell.f = s.slice(1);
          } else {
            cell.t = "s";
            cell.v = s;
          }
        } else if (s == "TRUE") {
          cell.t = "b";
          cell.v = true;
        } else if (s == "FALSE") {
          cell.t = "b";
          cell.v = false;
        } else if (!isNaN(v = fuzzynum(s))) {
          cell.t = "n";
          if (o.cellText !== false) cell.w = s;
          cell.v = v;
        } else if (!isNaN(fuzzydate(s).getDate()) || _re && s.match(_re)) {
          cell.z = o.dateNF || table_fmt[14];
          var k = 0;
          if (_re && s.match(_re)) {
            s = dateNF_fix(s, o.dateNF, s.match(_re) || []);
            k = 1;
          }
          if (o.cellDates) {
            cell.t = "d";
            cell.v = parseDate(s, k);
          } else {
            cell.t = "n";
            cell.v = datenum(parseDate(s, k));
          }
          if (o.cellText !== false) cell.w = SSF_format(cell.z, cell.v instanceof Date ? datenum(cell.v) : cell.v);
          if (!o.cellNF) delete cell.z;
        } else {
          cell.t = "s";
          cell.v = s;
        }
        if (cell.t == "z") {
        } else if (o.dense) {
          if (!ws[R]) ws[R] = [];
          ws[R][C] = cell;
        } else ws[encode_cell({ c: C, r: R })] = cell;
        start = end + 1;
        startcc = str.charCodeAt(start);
        if (range2.e.c < C) range2.e.c = C;
        if (range2.e.r < R) range2.e.r = R;
        if (cc == sepcc) ++C;
        else {
          C = 0;
          ++R;
          if (o.sheetRows && o.sheetRows <= R) return true;
        }
      }
      outer: for (; end < str.length; ++end) switch (cc = str.charCodeAt(end)) {
        case 34:
          if (startcc === 34) instr = !instr;
          break;
        case sepcc:
        case 10:
        case 13:
          if (!instr && finish_cell()) break outer;
          break;
        default:
          break;
      }
      if (end - start > 0) finish_cell();
      ws["!ref"] = encode_range(range2);
      return ws;
    }
    function prn_to_sheet_str(str, opts) {
      if (!(opts && opts.PRN)) return dsv_to_sheet_str(str, opts);
      if (opts.FS) return dsv_to_sheet_str(str, opts);
      if (str.slice(0, 4) == "sep=") return dsv_to_sheet_str(str, opts);
      if (str.indexOf("	") >= 0 || str.indexOf(",") >= 0 || str.indexOf(";") >= 0) return dsv_to_sheet_str(str, opts);
      return aoa_to_sheet(prn_to_aoa_str(str, opts), opts);
    }
    function prn_to_sheet(d, opts) {
      var str = "", bytes = opts.type == "string" ? [0, 0, 0, 0] : firstbyte(d, opts);
      switch (opts.type) {
        case "base64":
          str = Base64_decode(d);
          break;
        case "binary":
          str = d;
          break;
        case "buffer":
          if (opts.codepage == 65001) str = d.toString("utf8");
          else if (opts.codepage && typeof $cptable !== "undefined") str = $cptable.utils.decode(opts.codepage, d);
          else str = has_buf && Buffer.isBuffer(d) ? d.toString("binary") : a2s(d);
          break;
        case "array":
          str = cc2str(d);
          break;
        case "string":
          str = d;
          break;
        default:
          throw new Error("Unrecognized type " + opts.type);
      }
      if (bytes[0] == 239 && bytes[1] == 187 && bytes[2] == 191) str = utf8read(str.slice(3));
      else if (opts.type != "string" && opts.type != "buffer" && opts.codepage == 65001) str = utf8read(str);
      else if (opts.type == "binary" && typeof $cptable !== "undefined" && opts.codepage) str = $cptable.utils.decode(opts.codepage, $cptable.utils.encode(28591, str));
      if (str.slice(0, 19) == "socialcalc:version:") return ETH.to_sheet(opts.type == "string" ? str : utf8read(str), opts);
      return prn_to_sheet_str(str, opts);
    }
    function prn_to_workbook(d, opts) {
      return sheet_to_workbook(prn_to_sheet(d, opts), opts);
    }
    function sheet_to_prn(ws) {
      var o = [];
      var r = safe_decode_range(ws["!ref"]), cell;
      var dense = Array.isArray(ws);
      for (var R = r.s.r; R <= r.e.r; ++R) {
        var oo = [];
        for (var C = r.s.c; C <= r.e.c; ++C) {
          var coord = encode_cell({ r: R, c: C });
          cell = dense ? (ws[R] || [])[C] : ws[coord];
          if (!cell || cell.v == null) {
            oo.push("          ");
            continue;
          }
          var w = (cell.w || (format_cell(cell), cell.w) || "").slice(0, 10);
          while (w.length < 10) w += " ";
          oo.push(w + (C === 0 ? " " : ""));
        }
        o.push(oo.join(""));
      }
      return o.join("\n");
    }
    return {
      to_workbook: prn_to_workbook,
      to_sheet: prn_to_sheet,
      from_sheet: sheet_to_prn
    };
  })();
  function read_wb_ID(d, opts) {
    var o = opts || {}, OLD_WTF = !!o.WTF;
    o.WTF = true;
    try {
      var out = SYLK.to_workbook(d, o);
      o.WTF = OLD_WTF;
      return out;
    } catch (e) {
      o.WTF = OLD_WTF;
      if (!e.message.match(/SYLK bad record ID/) && OLD_WTF) throw e;
      return PRN.to_workbook(d, opts);
    }
  }
  var WK_ = /* @__PURE__ */ (function() {
    function lotushopper(data, cb2, opts) {
      if (!data) return;
      prep_blob(data, data.l || 0);
      var Enum = opts.Enum || WK1Enum;
      while (data.l < data.length) {
        var RT = data.read_shift(2);
        var R = Enum[RT] || Enum[65535];
        var length = data.read_shift(2);
        var tgt = data.l + length;
        var d = R.f && R.f(data, length, opts);
        data.l = tgt;
        if (cb2(d, R, RT)) return;
      }
    }
    function lotus_to_workbook(d, opts) {
      switch (opts.type) {
        case "base64":
          return lotus_to_workbook_buf(s2a(Base64_decode(d)), opts);
        case "binary":
          return lotus_to_workbook_buf(s2a(d), opts);
        case "buffer":
        case "array":
          return lotus_to_workbook_buf(d, opts);
      }
      throw "Unsupported type " + opts.type;
    }
    function lotus_to_workbook_buf(d, opts) {
      if (!d) return d;
      var o = opts || {};
      if (DENSE != null && o.dense == null) o.dense = DENSE;
      var s = o.dense ? [] : {}, n = "Sheet1", next_n = "", sidx = 0;
      var sheets = {}, snames = [], realnames = [];
      var refguess = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } };
      var sheetRows = o.sheetRows || 0;
      if (d[2] == 0) {
        if (d[3] == 8 || d[3] == 9) {
          if (d.length >= 16 && d[14] == 5 && d[15] === 108) throw new Error("Unsupported Works 3 for Mac file");
        }
      }
      if (d[2] == 2) {
        o.Enum = WK1Enum;
        lotushopper(d, function(val, R, RT) {
          switch (RT) {
            case 0:
              o.vers = val;
              if (val >= 4096) o.qpro = true;
              break;
            case 6:
              refguess = val;
              break;
            /* RANGE */
            case 204:
              if (val) next_n = val;
              break;
            /* SHEETNAMECS */
            case 222:
              next_n = val;
              break;
            /* SHEETNAMELP */
            case 15:
            /* LABEL */
            case 51:
              if (!o.qpro) val[1].v = val[1].v.slice(1);
            /* falls through */
            case 13:
            /* INTEGER */
            case 14:
            /* NUMBER */
            case 16:
              if (RT == 14 && (val[2] & 112) == 112 && (val[2] & 15) > 1 && (val[2] & 15) < 15) {
                val[1].z = o.dateNF || table_fmt[14];
                if (o.cellDates) {
                  val[1].t = "d";
                  val[1].v = numdate(val[1].v);
                }
              }
              if (o.qpro) {
                if (val[3] > sidx) {
                  s["!ref"] = encode_range(refguess);
                  sheets[n] = s;
                  snames.push(n);
                  s = o.dense ? [] : {};
                  refguess = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } };
                  sidx = val[3];
                  n = next_n || "Sheet" + (sidx + 1);
                  next_n = "";
                }
              }
              var tmpcell = o.dense ? (s[val[0].r] || [])[val[0].c] : s[encode_cell(val[0])];
              if (tmpcell) {
                tmpcell.t = val[1].t;
                tmpcell.v = val[1].v;
                if (val[1].z != null) tmpcell.z = val[1].z;
                if (val[1].f != null) tmpcell.f = val[1].f;
                break;
              }
              if (o.dense) {
                if (!s[val[0].r]) s[val[0].r] = [];
                s[val[0].r][val[0].c] = val[1];
              } else s[encode_cell(val[0])] = val[1];
              break;
            default:
          }
        }, o);
      } else if (d[2] == 26 || d[2] == 14) {
        o.Enum = WK3Enum;
        if (d[2] == 14) {
          o.qpro = true;
          d.l = 0;
        }
        lotushopper(d, function(val, R, RT) {
          switch (RT) {
            case 204:
              n = val;
              break;
            /* SHEETNAMECS */
            case 22:
              val[1].v = val[1].v.slice(1);
            /* falls through */
            case 23:
            /* NUMBER17 */
            case 24:
            /* NUMBER18 */
            case 25:
            /* FORMULA19 */
            case 37:
            /* NUMBER25 */
            case 39:
            /* NUMBER27 */
            case 40:
              if (val[3] > sidx) {
                s["!ref"] = encode_range(refguess);
                sheets[n] = s;
                snames.push(n);
                s = o.dense ? [] : {};
                refguess = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } };
                sidx = val[3];
                n = "Sheet" + (sidx + 1);
              }
              if (sheetRows > 0 && val[0].r >= sheetRows) break;
              if (o.dense) {
                if (!s[val[0].r]) s[val[0].r] = [];
                s[val[0].r][val[0].c] = val[1];
              } else s[encode_cell(val[0])] = val[1];
              if (refguess.e.c < val[0].c) refguess.e.c = val[0].c;
              if (refguess.e.r < val[0].r) refguess.e.r = val[0].r;
              break;
            case 27:
              if (val[14e3]) realnames[val[14e3][0]] = val[14e3][1];
              break;
            case 1537:
              realnames[val[0]] = val[1];
              if (val[0] == sidx) n = val[1];
              break;
            default:
              break;
          }
        }, o);
      } else throw new Error("Unrecognized LOTUS BOF " + d[2]);
      s["!ref"] = encode_range(refguess);
      sheets[next_n || n] = s;
      snames.push(next_n || n);
      if (!realnames.length) return { SheetNames: snames, Sheets: sheets };
      var osheets = {}, rnames = [];
      for (var i = 0; i < realnames.length; ++i) if (sheets[snames[i]]) {
        rnames.push(realnames[i] || snames[i]);
        osheets[realnames[i]] = sheets[realnames[i]] || sheets[snames[i]];
      } else {
        rnames.push(realnames[i]);
        osheets[realnames[i]] = { "!ref": "A1" };
      }
      return { SheetNames: rnames, Sheets: osheets };
    }
    function sheet_to_wk1(ws, opts) {
      var o = opts || {};
      if (+o.codepage >= 0) set_cp(+o.codepage);
      if (o.type == "string") throw new Error("Cannot write WK1 to JS string");
      var ba = buf_array();
      var range2 = safe_decode_range(ws["!ref"]);
      var dense = Array.isArray(ws);
      var cols = [];
      write_biff_rec(ba, 0, write_BOF_WK1(1030));
      write_biff_rec(ba, 6, write_RANGE(range2));
      var max_R = Math.min(range2.e.r, 8191);
      for (var R = range2.s.r; R <= max_R; ++R) {
        var rr = encode_row(R);
        for (var C = range2.s.c; C <= range2.e.c; ++C) {
          if (R === range2.s.r) cols[C] = encode_col(C);
          var ref = cols[C] + rr;
          var cell = dense ? (ws[R] || [])[C] : ws[ref];
          if (!cell || cell.t == "z") continue;
          if (cell.t == "n") {
            if ((cell.v | 0) == cell.v && cell.v >= -32768 && cell.v <= 32767) write_biff_rec(ba, 13, write_INTEGER(R, C, cell.v));
            else write_biff_rec(ba, 14, write_NUMBER(R, C, cell.v));
          } else {
            var str = format_cell(cell);
            write_biff_rec(ba, 15, write_LABEL(R, C, str.slice(0, 239)));
          }
        }
      }
      write_biff_rec(ba, 1);
      return ba.end();
    }
    function book_to_wk3(wb, opts) {
      var o = opts || {};
      if (+o.codepage >= 0) set_cp(+o.codepage);
      if (o.type == "string") throw new Error("Cannot write WK3 to JS string");
      var ba = buf_array();
      write_biff_rec(ba, 0, write_BOF_WK3(wb));
      for (var i = 0, cnt = 0; i < wb.SheetNames.length; ++i) if ((wb.Sheets[wb.SheetNames[i]] || {})["!ref"]) write_biff_rec(ba, 27, write_XFORMAT_SHEETNAME(wb.SheetNames[i], cnt++));
      var wsidx = 0;
      for (i = 0; i < wb.SheetNames.length; ++i) {
        var ws = wb.Sheets[wb.SheetNames[i]];
        if (!ws || !ws["!ref"]) continue;
        var range2 = safe_decode_range(ws["!ref"]);
        var dense = Array.isArray(ws);
        var cols = [];
        var max_R = Math.min(range2.e.r, 8191);
        for (var R = range2.s.r; R <= max_R; ++R) {
          var rr = encode_row(R);
          for (var C = range2.s.c; C <= range2.e.c; ++C) {
            if (R === range2.s.r) cols[C] = encode_col(C);
            var ref = cols[C] + rr;
            var cell = dense ? (ws[R] || [])[C] : ws[ref];
            if (!cell || cell.t == "z") continue;
            if (cell.t == "n") {
              write_biff_rec(ba, 23, write_NUMBER_17(R, C, wsidx, cell.v));
            } else {
              var str = format_cell(cell);
              write_biff_rec(ba, 22, write_LABEL_16(R, C, wsidx, str.slice(0, 239)));
            }
          }
        }
        ++wsidx;
      }
      write_biff_rec(ba, 1);
      return ba.end();
    }
    function write_BOF_WK1(v) {
      var out = new_buf(2);
      out.write_shift(2, v);
      return out;
    }
    function write_BOF_WK3(wb) {
      var out = new_buf(26);
      out.write_shift(2, 4096);
      out.write_shift(2, 4);
      out.write_shift(4, 0);
      var rows = 0, cols = 0, wscnt = 0;
      for (var i = 0; i < wb.SheetNames.length; ++i) {
        var name = wb.SheetNames[i];
        var ws = wb.Sheets[name];
        if (!ws || !ws["!ref"]) continue;
        ++wscnt;
        var range2 = decode_range(ws["!ref"]);
        if (rows < range2.e.r) rows = range2.e.r;
        if (cols < range2.e.c) cols = range2.e.c;
      }
      if (rows > 8191) rows = 8191;
      out.write_shift(2, rows);
      out.write_shift(1, wscnt);
      out.write_shift(1, cols);
      out.write_shift(2, 0);
      out.write_shift(2, 0);
      out.write_shift(1, 1);
      out.write_shift(1, 2);
      out.write_shift(4, 0);
      out.write_shift(4, 0);
      return out;
    }
    function parse_RANGE(blob, length, opts) {
      var o = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
      if (length == 8 && opts.qpro) {
        o.s.c = blob.read_shift(1);
        blob.l++;
        o.s.r = blob.read_shift(2);
        o.e.c = blob.read_shift(1);
        blob.l++;
        o.e.r = blob.read_shift(2);
        return o;
      }
      o.s.c = blob.read_shift(2);
      o.s.r = blob.read_shift(2);
      if (length == 12 && opts.qpro) blob.l += 2;
      o.e.c = blob.read_shift(2);
      o.e.r = blob.read_shift(2);
      if (length == 12 && opts.qpro) blob.l += 2;
      if (o.s.c == 65535) o.s.c = o.e.c = o.s.r = o.e.r = 0;
      return o;
    }
    function write_RANGE(range2) {
      var out = new_buf(8);
      out.write_shift(2, range2.s.c);
      out.write_shift(2, range2.s.r);
      out.write_shift(2, range2.e.c);
      out.write_shift(2, range2.e.r);
      return out;
    }
    function parse_cell(blob, length, opts) {
      var o = [{ c: 0, r: 0 }, { t: "n", v: 0 }, 0, 0];
      if (opts.qpro && opts.vers != 20768) {
        o[0].c = blob.read_shift(1);
        o[3] = blob.read_shift(1);
        o[0].r = blob.read_shift(2);
        blob.l += 2;
      } else {
        o[2] = blob.read_shift(1);
        o[0].c = blob.read_shift(2);
        o[0].r = blob.read_shift(2);
      }
      return o;
    }
    function parse_LABEL(blob, length, opts) {
      var tgt = blob.l + length;
      var o = parse_cell(blob, length, opts);
      o[1].t = "s";
      if (opts.vers == 20768) {
        blob.l++;
        var len = blob.read_shift(1);
        o[1].v = blob.read_shift(len, "utf8");
        return o;
      }
      if (opts.qpro) blob.l++;
      o[1].v = blob.read_shift(tgt - blob.l, "cstr");
      return o;
    }
    function write_LABEL(R, C, s) {
      var o = new_buf(7 + s.length);
      o.write_shift(1, 255);
      o.write_shift(2, C);
      o.write_shift(2, R);
      o.write_shift(1, 39);
      for (var i = 0; i < o.length; ++i) {
        var cc = s.charCodeAt(i);
        o.write_shift(1, cc >= 128 ? 95 : cc);
      }
      o.write_shift(1, 0);
      return o;
    }
    function parse_INTEGER(blob, length, opts) {
      var o = parse_cell(blob, length, opts);
      o[1].v = blob.read_shift(2, "i");
      return o;
    }
    function write_INTEGER(R, C, v) {
      var o = new_buf(7);
      o.write_shift(1, 255);
      o.write_shift(2, C);
      o.write_shift(2, R);
      o.write_shift(2, v, "i");
      return o;
    }
    function parse_NUMBER(blob, length, opts) {
      var o = parse_cell(blob, length, opts);
      o[1].v = blob.read_shift(8, "f");
      return o;
    }
    function write_NUMBER(R, C, v) {
      var o = new_buf(13);
      o.write_shift(1, 255);
      o.write_shift(2, C);
      o.write_shift(2, R);
      o.write_shift(8, v, "f");
      return o;
    }
    function parse_FORMULA(blob, length, opts) {
      var tgt = blob.l + length;
      var o = parse_cell(blob, length, opts);
      o[1].v = blob.read_shift(8, "f");
      if (opts.qpro) blob.l = tgt;
      else {
        var flen = blob.read_shift(2);
        wk1_fmla_to_csf(blob.slice(blob.l, blob.l + flen), o);
        blob.l += flen;
      }
      return o;
    }
    function wk1_parse_rc(B, V, col) {
      var rel = V & 32768;
      V &= ~32768;
      V = (rel ? B : 0) + (V >= 8192 ? V - 16384 : V);
      return (rel ? "" : "$") + (col ? encode_col(V) : encode_row(V));
    }
    var FuncTab = {
      51: ["FALSE", 0],
      52: ["TRUE", 0],
      70: ["LEN", 1],
      80: ["SUM", 69],
      81: ["AVERAGEA", 69],
      82: ["COUNTA", 69],
      83: ["MINA", 69],
      84: ["MAXA", 69],
      111: ["T", 1]
    };
    var BinOpTab = [
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      // eslint-disable-line no-mixed-spaces-and-tabs
      "",
      "+",
      "-",
      "*",
      "/",
      "^",
      "=",
      "<>",
      // eslint-disable-line no-mixed-spaces-and-tabs
      "<=",
      ">=",
      "<",
      ">",
      "",
      "",
      "",
      "",
      // eslint-disable-line no-mixed-spaces-and-tabs
      "&",
      "",
      "",
      "",
      "",
      "",
      "",
      ""
      // eslint-disable-line no-mixed-spaces-and-tabs
    ];
    function wk1_fmla_to_csf(blob, o) {
      prep_blob(blob, 0);
      var out = [], argc = 0, R = "", C = "", argL = "", argR = "";
      while (blob.l < blob.length) {
        var cc = blob[blob.l++];
        switch (cc) {
          case 0:
            out.push(blob.read_shift(8, "f"));
            break;
          case 1:
            {
              C = wk1_parse_rc(o[0].c, blob.read_shift(2), true);
              R = wk1_parse_rc(o[0].r, blob.read_shift(2), false);
              out.push(C + R);
            }
            break;
          case 2:
            {
              var c = wk1_parse_rc(o[0].c, blob.read_shift(2), true);
              var r = wk1_parse_rc(o[0].r, blob.read_shift(2), false);
              C = wk1_parse_rc(o[0].c, blob.read_shift(2), true);
              R = wk1_parse_rc(o[0].r, blob.read_shift(2), false);
              out.push(c + r + ":" + C + R);
            }
            break;
          case 3:
            if (blob.l < blob.length) {
              console.error("WK1 premature formula end");
              return;
            }
            break;
          case 4:
            out.push("(" + out.pop() + ")");
            break;
          case 5:
            out.push(blob.read_shift(2));
            break;
          case 6:
            {
              var Z = "";
              while (cc = blob[blob.l++]) Z += String.fromCharCode(cc);
              out.push('"' + Z.replace(/"/g, '""') + '"');
            }
            break;
          case 8:
            out.push("-" + out.pop());
            break;
          case 23:
            out.push("+" + out.pop());
            break;
          case 22:
            out.push("NOT(" + out.pop() + ")");
            break;
          case 20:
          case 21:
            {
              argR = out.pop();
              argL = out.pop();
              out.push(["AND", "OR"][cc - 20] + "(" + argL + "," + argR + ")");
            }
            break;
          default:
            if (cc < 32 && BinOpTab[cc]) {
              argR = out.pop();
              argL = out.pop();
              out.push(argL + BinOpTab[cc] + argR);
            } else if (FuncTab[cc]) {
              argc = FuncTab[cc][1];
              if (argc == 69) argc = blob[blob.l++];
              if (argc > out.length) {
                console.error("WK1 bad formula parse 0x" + cc.toString(16) + ":|" + out.join("|") + "|");
                return;
              }
              var args = out.slice(-argc);
              out.length -= argc;
              out.push(FuncTab[cc][0] + "(" + args.join(",") + ")");
            } else if (cc <= 7) return console.error("WK1 invalid opcode " + cc.toString(16));
            else if (cc <= 24) return console.error("WK1 unsupported op " + cc.toString(16));
            else if (cc <= 30) return console.error("WK1 invalid opcode " + cc.toString(16));
            else if (cc <= 115) return console.error("WK1 unsupported function opcode " + cc.toString(16));
            else return console.error("WK1 unrecognized opcode " + cc.toString(16));
        }
      }
      if (out.length == 1) o[1].f = "" + out[0];
      else console.error("WK1 bad formula parse |" + out.join("|") + "|");
    }
    function parse_cell_3(blob) {
      var o = [{ c: 0, r: 0 }, { t: "n", v: 0 }, 0];
      o[0].r = blob.read_shift(2);
      o[3] = blob[blob.l++];
      o[0].c = blob[blob.l++];
      return o;
    }
    function parse_LABEL_16(blob, length) {
      var o = parse_cell_3(blob, length);
      o[1].t = "s";
      o[1].v = blob.read_shift(length - 4, "cstr");
      return o;
    }
    function write_LABEL_16(R, C, wsidx, s) {
      var o = new_buf(6 + s.length);
      o.write_shift(2, R);
      o.write_shift(1, wsidx);
      o.write_shift(1, C);
      o.write_shift(1, 39);
      for (var i = 0; i < s.length; ++i) {
        var cc = s.charCodeAt(i);
        o.write_shift(1, cc >= 128 ? 95 : cc);
      }
      o.write_shift(1, 0);
      return o;
    }
    function parse_NUMBER_18(blob, length) {
      var o = parse_cell_3(blob, length);
      o[1].v = blob.read_shift(2);
      var v = o[1].v >> 1;
      if (o[1].v & 1) {
        switch (v & 7) {
          case 0:
            v = (v >> 3) * 5e3;
            break;
          case 1:
            v = (v >> 3) * 500;
            break;
          case 2:
            v = (v >> 3) / 20;
            break;
          case 3:
            v = (v >> 3) / 200;
            break;
          case 4:
            v = (v >> 3) / 2e3;
            break;
          case 5:
            v = (v >> 3) / 2e4;
            break;
          case 6:
            v = (v >> 3) / 16;
            break;
          case 7:
            v = (v >> 3) / 64;
            break;
        }
      }
      o[1].v = v;
      return o;
    }
    function parse_NUMBER_17(blob, length) {
      var o = parse_cell_3(blob, length);
      var v1 = blob.read_shift(4);
      var v2 = blob.read_shift(4);
      var e = blob.read_shift(2);
      if (e == 65535) {
        if (v1 === 0 && v2 === 3221225472) {
          o[1].t = "e";
          o[1].v = 15;
        } else if (v1 === 0 && v2 === 3489660928) {
          o[1].t = "e";
          o[1].v = 42;
        } else o[1].v = 0;
        return o;
      }
      var s = e & 32768;
      e = (e & 32767) - 16446;
      o[1].v = (1 - s * 2) * (v2 * Math.pow(2, e + 32) + v1 * Math.pow(2, e));
      return o;
    }
    function write_NUMBER_17(R, C, wsidx, v) {
      var o = new_buf(14);
      o.write_shift(2, R);
      o.write_shift(1, wsidx);
      o.write_shift(1, C);
      if (v == 0) {
        o.write_shift(4, 0);
        o.write_shift(4, 0);
        o.write_shift(2, 65535);
        return o;
      }
      var s = 0, e = 0, v1 = 0, v2 = 0;
      if (v < 0) {
        s = 1;
        v = -v;
      }
      e = Math.log2(v) | 0;
      v /= Math.pow(2, e - 31);
      v2 = v >>> 0;
      if ((v2 & 2147483648) == 0) {
        v /= 2;
        ++e;
        v2 = v >>> 0;
      }
      v -= v2;
      v2 |= 2147483648;
      v2 >>>= 0;
      v *= Math.pow(2, 32);
      v1 = v >>> 0;
      o.write_shift(4, v1);
      o.write_shift(4, v2);
      e += 16383 + (s ? 32768 : 0);
      o.write_shift(2, e);
      return o;
    }
    function parse_FORMULA_19(blob, length) {
      var o = parse_NUMBER_17(blob, 14);
      blob.l += length - 14;
      return o;
    }
    function parse_NUMBER_25(blob, length) {
      var o = parse_cell_3(blob, length);
      var v1 = blob.read_shift(4);
      o[1].v = v1 >> 6;
      return o;
    }
    function parse_NUMBER_27(blob, length) {
      var o = parse_cell_3(blob, length);
      var v1 = blob.read_shift(8, "f");
      o[1].v = v1;
      return o;
    }
    function parse_FORMULA_28(blob, length) {
      var o = parse_NUMBER_27(blob, 14);
      blob.l += length - 10;
      return o;
    }
    function parse_SHEETNAMECS(blob, length) {
      return blob[blob.l + length - 1] == 0 ? blob.read_shift(length, "cstr") : "";
    }
    function parse_SHEETNAMELP(blob, length) {
      var len = blob[blob.l++];
      if (len > length - 1) len = length - 1;
      var o = "";
      while (o.length < len) o += String.fromCharCode(blob[blob.l++]);
      return o;
    }
    function parse_SHEETINFOQP(blob, length, opts) {
      if (!opts.qpro || length < 21) return;
      var id = blob.read_shift(1);
      blob.l += 17;
      blob.l += 1;
      blob.l += 2;
      var nm = blob.read_shift(length - 21, "cstr");
      return [id, nm];
    }
    function parse_XFORMAT(blob, length) {
      var o = {}, tgt = blob.l + length;
      while (blob.l < tgt) {
        var dt = blob.read_shift(2);
        if (dt == 14e3) {
          o[dt] = [0, ""];
          o[dt][0] = blob.read_shift(2);
          while (blob[blob.l]) {
            o[dt][1] += String.fromCharCode(blob[blob.l]);
            blob.l++;
          }
          blob.l++;
        }
      }
      return o;
    }
    function write_XFORMAT_SHEETNAME(name, wsidx) {
      var out = new_buf(5 + name.length);
      out.write_shift(2, 14e3);
      out.write_shift(2, wsidx);
      for (var i = 0; i < name.length; ++i) {
        var cc = name.charCodeAt(i);
        out[out.l++] = cc > 127 ? 95 : cc;
      }
      out[out.l++] = 0;
      return out;
    }
    var WK1Enum = {
      /*::[*/
      0: { n: "BOF", f: parseuint16 },
      /*::[*/
      1: { n: "EOF" },
      /*::[*/
      2: { n: "CALCMODE" },
      /*::[*/
      3: { n: "CALCORDER" },
      /*::[*/
      4: { n: "SPLIT" },
      /*::[*/
      5: { n: "SYNC" },
      /*::[*/
      6: { n: "RANGE", f: parse_RANGE },
      /*::[*/
      7: { n: "WINDOW1" },
      /*::[*/
      8: { n: "COLW1" },
      /*::[*/
      9: { n: "WINTWO" },
      /*::[*/
      10: { n: "COLW2" },
      /*::[*/
      11: { n: "NAME" },
      /*::[*/
      12: { n: "BLANK" },
      /*::[*/
      13: { n: "INTEGER", f: parse_INTEGER },
      /*::[*/
      14: { n: "NUMBER", f: parse_NUMBER },
      /*::[*/
      15: { n: "LABEL", f: parse_LABEL },
      /*::[*/
      16: { n: "FORMULA", f: parse_FORMULA },
      /*::[*/
      24: { n: "TABLE" },
      /*::[*/
      25: { n: "ORANGE" },
      /*::[*/
      26: { n: "PRANGE" },
      /*::[*/
      27: { n: "SRANGE" },
      /*::[*/
      28: { n: "FRANGE" },
      /*::[*/
      29: { n: "KRANGE1" },
      /*::[*/
      32: { n: "HRANGE" },
      /*::[*/
      35: { n: "KRANGE2" },
      /*::[*/
      36: { n: "PROTEC" },
      /*::[*/
      37: { n: "FOOTER" },
      /*::[*/
      38: { n: "HEADER" },
      /*::[*/
      39: { n: "SETUP" },
      /*::[*/
      40: { n: "MARGINS" },
      /*::[*/
      41: { n: "LABELFMT" },
      /*::[*/
      42: { n: "TITLES" },
      /*::[*/
      43: { n: "SHEETJS" },
      /*::[*/
      45: { n: "GRAPH" },
      /*::[*/
      46: { n: "NGRAPH" },
      /*::[*/
      47: { n: "CALCCOUNT" },
      /*::[*/
      48: { n: "UNFORMATTED" },
      /*::[*/
      49: { n: "CURSORW12" },
      /*::[*/
      50: { n: "WINDOW" },
      /*::[*/
      51: { n: "STRING", f: parse_LABEL },
      /*::[*/
      55: { n: "PASSWORD" },
      /*::[*/
      56: { n: "LOCKED" },
      /*::[*/
      60: { n: "QUERY" },
      /*::[*/
      61: { n: "QUERYNAME" },
      /*::[*/
      62: { n: "PRINT" },
      /*::[*/
      63: { n: "PRINTNAME" },
      /*::[*/
      64: { n: "GRAPH2" },
      /*::[*/
      65: { n: "GRAPHNAME" },
      /*::[*/
      66: { n: "ZOOM" },
      /*::[*/
      67: { n: "SYMSPLIT" },
      /*::[*/
      68: { n: "NSROWS" },
      /*::[*/
      69: { n: "NSCOLS" },
      /*::[*/
      70: { n: "RULER" },
      /*::[*/
      71: { n: "NNAME" },
      /*::[*/
      72: { n: "ACOMM" },
      /*::[*/
      73: { n: "AMACRO" },
      /*::[*/
      74: { n: "PARSE" },
      /*::[*/
      102: { n: "PRANGES??" },
      /*::[*/
      103: { n: "RRANGES??" },
      /*::[*/
      104: { n: "FNAME??" },
      /*::[*/
      105: { n: "MRANGES??" },
      /*::[*/
      204: { n: "SHEETNAMECS", f: parse_SHEETNAMECS },
      /*::[*/
      222: { n: "SHEETNAMELP", f: parse_SHEETNAMELP },
      /*::[*/
      65535: { n: "" }
    };
    var WK3Enum = {
      /*::[*/
      0: { n: "BOF" },
      /*::[*/
      1: { n: "EOF" },
      /*::[*/
      2: { n: "PASSWORD" },
      /*::[*/
      3: { n: "CALCSET" },
      /*::[*/
      4: { n: "WINDOWSET" },
      /*::[*/
      5: { n: "SHEETCELLPTR" },
      /*::[*/
      6: { n: "SHEETLAYOUT" },
      /*::[*/
      7: { n: "COLUMNWIDTH" },
      /*::[*/
      8: { n: "HIDDENCOLUMN" },
      /*::[*/
      9: { n: "USERRANGE" },
      /*::[*/
      10: { n: "SYSTEMRANGE" },
      /*::[*/
      11: { n: "ZEROFORCE" },
      /*::[*/
      12: { n: "SORTKEYDIR" },
      /*::[*/
      13: { n: "FILESEAL" },
      /*::[*/
      14: { n: "DATAFILLNUMS" },
      /*::[*/
      15: { n: "PRINTMAIN" },
      /*::[*/
      16: { n: "PRINTSTRING" },
      /*::[*/
      17: { n: "GRAPHMAIN" },
      /*::[*/
      18: { n: "GRAPHSTRING" },
      /*::[*/
      19: { n: "??" },
      /*::[*/
      20: { n: "ERRCELL" },
      /*::[*/
      21: { n: "NACELL" },
      /*::[*/
      22: { n: "LABEL16", f: parse_LABEL_16 },
      /*::[*/
      23: { n: "NUMBER17", f: parse_NUMBER_17 },
      /*::[*/
      24: { n: "NUMBER18", f: parse_NUMBER_18 },
      /*::[*/
      25: { n: "FORMULA19", f: parse_FORMULA_19 },
      /*::[*/
      26: { n: "FORMULA1A" },
      /*::[*/
      27: { n: "XFORMAT", f: parse_XFORMAT },
      /*::[*/
      28: { n: "DTLABELMISC" },
      /*::[*/
      29: { n: "DTLABELCELL" },
      /*::[*/
      30: { n: "GRAPHWINDOW" },
      /*::[*/
      31: { n: "CPA" },
      /*::[*/
      32: { n: "LPLAUTO" },
      /*::[*/
      33: { n: "QUERY" },
      /*::[*/
      34: { n: "HIDDENSHEET" },
      /*::[*/
      35: { n: "??" },
      /*::[*/
      37: { n: "NUMBER25", f: parse_NUMBER_25 },
      /*::[*/
      38: { n: "??" },
      /*::[*/
      39: { n: "NUMBER27", f: parse_NUMBER_27 },
      /*::[*/
      40: { n: "FORMULA28", f: parse_FORMULA_28 },
      /*::[*/
      142: { n: "??" },
      /*::[*/
      147: { n: "??" },
      /*::[*/
      150: { n: "??" },
      /*::[*/
      151: { n: "??" },
      /*::[*/
      152: { n: "??" },
      /*::[*/
      153: { n: "??" },
      /*::[*/
      154: { n: "??" },
      /*::[*/
      155: { n: "??" },
      /*::[*/
      156: { n: "??" },
      /*::[*/
      163: { n: "??" },
      /*::[*/
      174: { n: "??" },
      /*::[*/
      175: { n: "??" },
      /*::[*/
      176: { n: "??" },
      /*::[*/
      177: { n: "??" },
      /*::[*/
      184: { n: "??" },
      /*::[*/
      185: { n: "??" },
      /*::[*/
      186: { n: "??" },
      /*::[*/
      187: { n: "??" },
      /*::[*/
      188: { n: "??" },
      /*::[*/
      195: { n: "??" },
      /*::[*/
      201: { n: "??" },
      /*::[*/
      204: { n: "SHEETNAMECS", f: parse_SHEETNAMECS },
      /*::[*/
      205: { n: "??" },
      /*::[*/
      206: { n: "??" },
      /*::[*/
      207: { n: "??" },
      /*::[*/
      208: { n: "??" },
      /*::[*/
      256: { n: "??" },
      /*::[*/
      259: { n: "??" },
      /*::[*/
      260: { n: "??" },
      /*::[*/
      261: { n: "??" },
      /*::[*/
      262: { n: "??" },
      /*::[*/
      263: { n: "??" },
      /*::[*/
      265: { n: "??" },
      /*::[*/
      266: { n: "??" },
      /*::[*/
      267: { n: "??" },
      /*::[*/
      268: { n: "??" },
      /*::[*/
      270: { n: "??" },
      /*::[*/
      271: { n: "??" },
      /*::[*/
      384: { n: "??" },
      /*::[*/
      389: { n: "??" },
      /*::[*/
      390: { n: "??" },
      /*::[*/
      393: { n: "??" },
      /*::[*/
      396: { n: "??" },
      /*::[*/
      512: { n: "??" },
      /*::[*/
      514: { n: "??" },
      /*::[*/
      513: { n: "??" },
      /*::[*/
      516: { n: "??" },
      /*::[*/
      517: { n: "??" },
      /*::[*/
      640: { n: "??" },
      /*::[*/
      641: { n: "??" },
      /*::[*/
      642: { n: "??" },
      /*::[*/
      643: { n: "??" },
      /*::[*/
      644: { n: "??" },
      /*::[*/
      645: { n: "??" },
      /*::[*/
      646: { n: "??" },
      /*::[*/
      647: { n: "??" },
      /*::[*/
      648: { n: "??" },
      /*::[*/
      658: { n: "??" },
      /*::[*/
      659: { n: "??" },
      /*::[*/
      660: { n: "??" },
      /*::[*/
      661: { n: "??" },
      /*::[*/
      662: { n: "??" },
      /*::[*/
      665: { n: "??" },
      /*::[*/
      666: { n: "??" },
      /*::[*/
      768: { n: "??" },
      /*::[*/
      772: { n: "??" },
      /*::[*/
      1537: { n: "SHEETINFOQP", f: parse_SHEETINFOQP },
      /*::[*/
      1600: { n: "??" },
      /*::[*/
      1602: { n: "??" },
      /*::[*/
      1793: { n: "??" },
      /*::[*/
      1794: { n: "??" },
      /*::[*/
      1795: { n: "??" },
      /*::[*/
      1796: { n: "??" },
      /*::[*/
      1920: { n: "??" },
      /*::[*/
      2048: { n: "??" },
      /*::[*/
      2049: { n: "??" },
      /*::[*/
      2052: { n: "??" },
      /*::[*/
      2688: { n: "??" },
      /*::[*/
      10998: { n: "??" },
      /*::[*/
      12849: { n: "??" },
      /*::[*/
      28233: { n: "??" },
      /*::[*/
      28484: { n: "??" },
      /*::[*/
      65535: { n: "" }
    };
    return {
      sheet_to_wk1,
      book_to_wk3,
      to_workbook: lotus_to_workbook
    };
  })();
  function parse_rpr(rpr) {
    var font = {}, m = rpr.match(tagregex), i = 0;
    var pass = false;
    if (m) for (; i != m.length; ++i) {
      var y = parsexmltag(m[i]);
      switch (y[0].replace(/\w*:/g, "")) {
        /* 18.8.12 condense CT_BooleanProperty */
        /* ** not required . */
        case "<condense":
          break;
        /* 18.8.17 extend CT_BooleanProperty */
        /* ** not required . */
        case "<extend":
          break;
        /* 18.8.36 shadow CT_BooleanProperty */
        /* ** not required . */
        case "<shadow":
          if (!y.val) break;
        /* falls through */
        case "<shadow>":
        case "<shadow/>":
          font.shadow = 1;
          break;
        case "</shadow>":
          break;
        /* 18.4.1 charset CT_IntProperty TODO */
        case "<charset":
          if (y.val == "1") break;
          font.cp = CS2CP[parseInt(y.val, 10)];
          break;
        /* 18.4.2 outline CT_BooleanProperty TODO */
        case "<outline":
          if (!y.val) break;
        /* falls through */
        case "<outline>":
        case "<outline/>":
          font.outline = 1;
          break;
        case "</outline>":
          break;
        /* 18.4.5 rFont CT_FontName */
        case "<rFont":
          font.name = y.val;
          break;
        /* 18.4.11 sz CT_FontSize */
        case "<sz":
          font.sz = y.val;
          break;
        /* 18.4.10 strike CT_BooleanProperty */
        case "<strike":
          if (!y.val) break;
        /* falls through */
        case "<strike>":
        case "<strike/>":
          font.strike = 1;
          break;
        case "</strike>":
          break;
        /* 18.4.13 u CT_UnderlineProperty */
        case "<u":
          if (!y.val) break;
          switch (y.val) {
            case "double":
              font.uval = "double";
              break;
            case "singleAccounting":
              font.uval = "single-accounting";
              break;
            case "doubleAccounting":
              font.uval = "double-accounting";
              break;
          }
        /* falls through */
        case "<u>":
        case "<u/>":
          font.u = 1;
          break;
        case "</u>":
          break;
        /* 18.8.2 b */
        case "<b":
          if (y.val == "0") break;
        /* falls through */
        case "<b>":
        case "<b/>":
          font.b = 1;
          break;
        case "</b>":
          break;
        /* 18.8.26 i */
        case "<i":
          if (y.val == "0") break;
        /* falls through */
        case "<i>":
        case "<i/>":
          font.i = 1;
          break;
        case "</i>":
          break;
        /* 18.3.1.15 color CT_Color TODO: tint, theme, auto, indexed */
        case "<color":
          if (y.rgb) font.color = y.rgb.slice(2, 8);
          break;
        case "<color>":
        case "<color/>":
        case "</color>":
          break;
        /* 18.8.18 family ST_FontFamily */
        case "<family":
          font.family = y.val;
          break;
        case "<family>":
        case "<family/>":
        case "</family>":
          break;
        /* 18.4.14 vertAlign CT_VerticalAlignFontProperty TODO */
        case "<vertAlign":
          font.valign = y.val;
          break;
        case "<vertAlign>":
        case "<vertAlign/>":
        case "</vertAlign>":
          break;
        /* 18.8.35 scheme CT_FontScheme TODO */
        case "<scheme":
          break;
        case "<scheme>":
        case "<scheme/>":
        case "</scheme>":
          break;
        /* 18.2.10 extLst CT_ExtensionList ? */
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
          break;
        case "<ext":
          pass = true;
          break;
        case "</ext>":
          pass = false;
          break;
        default:
          if (y[0].charCodeAt(1) !== 47 && !pass) throw new Error("Unrecognized rich format " + y[0]);
      }
    }
    return font;
  }
  var parse_rs = /* @__PURE__ */ (function() {
    var tregex = matchtag("t"), rpregex = matchtag("rPr");
    function parse_r(r) {
      var t = r.match(tregex);
      if (!t) return { t: "s", v: "" };
      var o = { t: "s", v: unescapexml(t[1]) };
      var rpr = r.match(rpregex);
      if (rpr) o.s = parse_rpr(rpr[1]);
      return o;
    }
    var rregex = /<(?:\w+:)?r>/g, rend = /<\/(?:\w+:)?r>/;
    return function parse_rs2(rs) {
      return rs.replace(rregex, "").split(rend).map(parse_r).filter(function(r) {
        return r.v;
      });
    };
  })();
  var rs_to_html = /* @__PURE__ */ (function parse_rs_factory() {
    var nlregex = /(\r\n|\n)/g;
    function parse_rpr2(font, intro, outro) {
      var style = [];
      if (font.u) style.push("text-decoration: underline;");
      if (font.uval) style.push("text-underline-style:" + font.uval + ";");
      if (font.sz) style.push("font-size:" + font.sz + "pt;");
      if (font.outline) style.push("text-effect: outline;");
      if (font.shadow) style.push("text-shadow: auto;");
      intro.push('<span style="' + style.join("") + '">');
      if (font.b) {
        intro.push("<b>");
        outro.push("</b>");
      }
      if (font.i) {
        intro.push("<i>");
        outro.push("</i>");
      }
      if (font.strike) {
        intro.push("<s>");
        outro.push("</s>");
      }
      var align = font.valign || "";
      if (align == "superscript" || align == "super") align = "sup";
      else if (align == "subscript") align = "sub";
      if (align != "") {
        intro.push("<" + align + ">");
        outro.push("</" + align + ">");
      }
      outro.push("</span>");
      return font;
    }
    function r_to_html(r) {
      var terms = [[], r.v, []];
      if (!r.v) return "";
      if (r.s) parse_rpr2(r.s, terms[0], terms[2]);
      return terms[0].join("") + terms[1].replace(nlregex, "<br/>") + terms[2].join("");
    }
    return function parse_rs2(rs) {
      return rs.map(r_to_html).join("");
    };
  })();
  var sitregex = /<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g;
  var sirregex = /<(?:\w+:)?r>/;
  var sirphregex = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;
  function parse_si(x, opts) {
    var html = opts ? opts.cellHTML : true;
    var z = {};
    if (!x) return { t: "" };
    if (x.match(/^\s*<(?:\w+:)?t[^>]*>/)) {
      z.t = unescapexml(utf8read(x.slice(x.indexOf(">") + 1).split(/<\/(?:\w+:)?t>/)[0] || ""));
      z.r = utf8read(x);
      if (html) z.h = escapehtml(z.t);
    } else if (
      /*y = */
      x.match(sirregex)
    ) {
      z.r = utf8read(x);
      z.t = unescapexml(utf8read((x.replace(sirphregex, "").match(sitregex) || []).join("").replace(tagregex, "")));
      if (html) z.h = rs_to_html(parse_rs(z.r));
    }
    return z;
  }
  var sstr0 = /<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/;
  var sstr1 = /<(?:\w+:)?(?:si|sstItem)>/g;
  var sstr2 = /<\/(?:\w+:)?(?:si|sstItem)>/;
  function parse_sst_xml(data, opts) {
    var s = [], ss = "";
    if (!data) return s;
    var sst = data.match(sstr0);
    if (sst) {
      ss = sst[2].replace(sstr1, "").split(sstr2);
      for (var i = 0; i != ss.length; ++i) {
        var o = parse_si(ss[i].trim(), opts);
        if (o != null) s[s.length] = o;
      }
      sst = parsexmltag(sst[1]);
      s.Count = sst.count;
      s.Unique = sst.uniqueCount;
    }
    return s;
  }
  function parse_BrtBeginSst(data) {
    return [data.read_shift(4), data.read_shift(4)];
  }
  function parse_sst_bin(data, opts) {
    var s = [];
    var pass = false;
    recordhopper(data, function hopper_sst(val, R, RT) {
      switch (RT) {
        case 159:
          s.Count = val[0];
          s.Unique = val[1];
          break;
        case 19:
          s.push(val);
          break;
        case 160:
          return true;
        case 35:
          pass = true;
          break;
        case 36:
          pass = false;
          break;
        default:
          if (R.T) {
          }
          if (!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    });
    return s;
  }
  function _JS2ANSI(str) {
    if (typeof $cptable !== "undefined") return $cptable.utils.encode(current_ansi, str);
    var o = [], oo = str.split("");
    for (var i = 0; i < oo.length; ++i) o[i] = oo[i].charCodeAt(0);
    return o;
  }
  function parse_CRYPTOVersion(blob, length) {
    var o = {};
    o.Major = blob.read_shift(2);
    o.Minor = blob.read_shift(2);
    if (length >= 4) blob.l += length - 4;
    return o;
  }
  function parse_DataSpaceVersionInfo(blob) {
    var o = {};
    o.id = blob.read_shift(0, "lpp4");
    o.R = parse_CRYPTOVersion(blob, 4);
    o.U = parse_CRYPTOVersion(blob, 4);
    o.W = parse_CRYPTOVersion(blob, 4);
    return o;
  }
  function parse_DataSpaceMapEntry(blob) {
    var len = blob.read_shift(4);
    var end = blob.l + len - 4;
    var o = {};
    var cnt = blob.read_shift(4);
    var comps = [];
    while (cnt-- > 0) comps.push({ t: blob.read_shift(4), v: blob.read_shift(0, "lpp4") });
    o.name = blob.read_shift(0, "lpp4");
    o.comps = comps;
    if (blob.l != end) throw new Error("Bad DataSpaceMapEntry: " + blob.l + " != " + end);
    return o;
  }
  function parse_DataSpaceMap(blob) {
    var o = [];
    blob.l += 4;
    var cnt = blob.read_shift(4);
    while (cnt-- > 0) o.push(parse_DataSpaceMapEntry(blob));
    return o;
  }
  function parse_DataSpaceDefinition(blob) {
    var o = [];
    blob.l += 4;
    var cnt = blob.read_shift(4);
    while (cnt-- > 0) o.push(blob.read_shift(0, "lpp4"));
    return o;
  }
  function parse_TransformInfoHeader(blob) {
    var o = {};
    blob.read_shift(4);
    blob.l += 4;
    o.id = blob.read_shift(0, "lpp4");
    o.name = blob.read_shift(0, "lpp4");
    o.R = parse_CRYPTOVersion(blob, 4);
    o.U = parse_CRYPTOVersion(blob, 4);
    o.W = parse_CRYPTOVersion(blob, 4);
    return o;
  }
  function parse_Primary(blob) {
    var hdr = parse_TransformInfoHeader(blob);
    hdr.ename = blob.read_shift(0, "8lpp4");
    hdr.blksz = blob.read_shift(4);
    hdr.cmode = blob.read_shift(4);
    if (blob.read_shift(4) != 4) throw new Error("Bad !Primary record");
    return hdr;
  }
  function parse_EncryptionHeader(blob, length) {
    var tgt = blob.l + length;
    var o = {};
    o.Flags = blob.read_shift(4) & 63;
    blob.l += 4;
    o.AlgID = blob.read_shift(4);
    var valid = false;
    switch (o.AlgID) {
      case 26126:
      case 26127:
      case 26128:
        valid = o.Flags == 36;
        break;
      case 26625:
        valid = o.Flags == 4;
        break;
      case 0:
        valid = o.Flags == 16 || o.Flags == 4 || o.Flags == 36;
        break;
      default:
        throw "Unrecognized encryption algorithm: " + o.AlgID;
    }
    if (!valid) throw new Error("Encryption Flags/AlgID mismatch");
    o.AlgIDHash = blob.read_shift(4);
    o.KeySize = blob.read_shift(4);
    o.ProviderType = blob.read_shift(4);
    blob.l += 8;
    o.CSPName = blob.read_shift(tgt - blob.l >> 1, "utf16le");
    blob.l = tgt;
    return o;
  }
  function parse_EncryptionVerifier(blob, length) {
    var o = {}, tgt = blob.l + length;
    blob.l += 4;
    o.Salt = blob.slice(blob.l, blob.l + 16);
    blob.l += 16;
    o.Verifier = blob.slice(blob.l, blob.l + 16);
    blob.l += 16;
    blob.read_shift(4);
    o.VerifierHash = blob.slice(blob.l, tgt);
    blob.l = tgt;
    return o;
  }
  function parse_EncryptionInfo(blob) {
    var vers = parse_CRYPTOVersion(blob);
    switch (vers.Minor) {
      case 2:
        return [vers.Minor, parse_EncInfoStd(blob, vers)];
      case 3:
        return [vers.Minor, parse_EncInfoExt(blob, vers)];
      case 4:
        return [vers.Minor, parse_EncInfoAgl(blob, vers)];
    }
    throw new Error("ECMA-376 Encrypted file unrecognized Version: " + vers.Minor);
  }
  function parse_EncInfoStd(blob) {
    var flags = blob.read_shift(4);
    if ((flags & 63) != 36) throw new Error("EncryptionInfo mismatch");
    var sz = blob.read_shift(4);
    var hdr = parse_EncryptionHeader(blob, sz);
    var verifier = parse_EncryptionVerifier(blob, blob.length - blob.l);
    return { t: "Std", h: hdr, v: verifier };
  }
  function parse_EncInfoExt() {
    throw new Error("File is password-protected: ECMA-376 Extensible");
  }
  function parse_EncInfoAgl(blob) {
    var KeyData = ["saltSize", "blockSize", "keyBits", "hashSize", "cipherAlgorithm", "cipherChaining", "hashAlgorithm", "saltValue"];
    blob.l += 4;
    var xml = blob.read_shift(blob.length - blob.l, "utf8");
    var o = {};
    xml.replace(tagregex, function xml_agile(x) {
      var y = parsexmltag(x);
      switch (strip_ns(y[0])) {
        case "<?xml":
          break;
        case "<encryption":
        case "</encryption>":
          break;
        case "<keyData":
          KeyData.forEach(function(k) {
            o[k] = y[k];
          });
          break;
        case "<dataIntegrity":
          o.encryptedHmacKey = y.encryptedHmacKey;
          o.encryptedHmacValue = y.encryptedHmacValue;
          break;
        case "<keyEncryptors>":
        case "<keyEncryptors":
          o.encs = [];
          break;
        case "</keyEncryptors>":
          break;
        case "<keyEncryptor":
          o.uri = y.uri;
          break;
        case "</keyEncryptor>":
          break;
        case "<encryptedKey":
          o.encs.push(y);
          break;
        default:
          throw y[0];
      }
    });
    return o;
  }
  function parse_RC4CryptoHeader(blob, length) {
    var o = {};
    var vers = o.EncryptionVersionInfo = parse_CRYPTOVersion(blob, 4);
    length -= 4;
    if (vers.Minor != 2) throw new Error("unrecognized minor version code: " + vers.Minor);
    if (vers.Major > 4 || vers.Major < 2) throw new Error("unrecognized major version code: " + vers.Major);
    o.Flags = blob.read_shift(4);
    length -= 4;
    var sz = blob.read_shift(4);
    length -= 4;
    o.EncryptionHeader = parse_EncryptionHeader(blob, sz);
    length -= sz;
    o.EncryptionVerifier = parse_EncryptionVerifier(blob, length);
    return o;
  }
  function parse_RC4Header(blob) {
    var o = {};
    var vers = o.EncryptionVersionInfo = parse_CRYPTOVersion(blob, 4);
    if (vers.Major != 1 || vers.Minor != 1) throw "unrecognized version code " + vers.Major + " : " + vers.Minor;
    o.Salt = blob.read_shift(16);
    o.EncryptedVerifier = blob.read_shift(16);
    o.EncryptedVerifierHash = blob.read_shift(16);
    return o;
  }
  function crypto_CreatePasswordVerifier_Method1(Password) {
    var Verifier = 0, PasswordArray;
    var PasswordDecoded = _JS2ANSI(Password);
    var len = PasswordDecoded.length + 1, i, PasswordByte;
    var Intermediate1, Intermediate2, Intermediate3;
    PasswordArray = new_raw_buf(len);
    PasswordArray[0] = PasswordDecoded.length;
    for (i = 1; i != len; ++i) PasswordArray[i] = PasswordDecoded[i - 1];
    for (i = len - 1; i >= 0; --i) {
      PasswordByte = PasswordArray[i];
      Intermediate1 = (Verifier & 16384) === 0 ? 0 : 1;
      Intermediate2 = Verifier << 1 & 32767;
      Intermediate3 = Intermediate1 | Intermediate2;
      Verifier = Intermediate3 ^ PasswordByte;
    }
    return Verifier ^ 52811;
  }
  var crypto_CreateXorArray_Method1 = /* @__PURE__ */ (function() {
    var PadArray = [187, 255, 255, 186, 255, 255, 185, 128, 0, 190, 15, 0, 191, 15, 0];
    var InitialCode = [57840, 7439, 52380, 33984, 4364, 3600, 61902, 12606, 6258, 57657, 54287, 34041, 10252, 43370, 20163];
    var XorMatrix = [44796, 19929, 39858, 10053, 20106, 40212, 10761, 31585, 63170, 64933, 60267, 50935, 40399, 11199, 17763, 35526, 1453, 2906, 5812, 11624, 23248, 885, 1770, 3540, 7080, 14160, 28320, 56640, 55369, 41139, 20807, 41614, 21821, 43642, 17621, 28485, 56970, 44341, 19019, 38038, 14605, 29210, 60195, 50791, 40175, 10751, 21502, 43004, 24537, 18387, 36774, 3949, 7898, 15796, 31592, 63184, 47201, 24803, 49606, 37805, 14203, 28406, 56812, 17824, 35648, 1697, 3394, 6788, 13576, 27152, 43601, 17539, 35078, 557, 1114, 2228, 4456, 30388, 60776, 51953, 34243, 7079, 14158, 28316, 14128, 28256, 56512, 43425, 17251, 34502, 7597, 13105, 26210, 52420, 35241, 883, 1766, 3532, 4129, 8258, 16516, 33032, 4657, 9314, 18628];
    var Ror = function(Byte) {
      return (Byte / 2 | Byte * 128) & 255;
    };
    var XorRor = function(byte1, byte2) {
      return Ror(byte1 ^ byte2);
    };
    var CreateXorKey_Method1 = function(Password) {
      var XorKey = InitialCode[Password.length - 1];
      var CurrentElement = 104;
      for (var i = Password.length - 1; i >= 0; --i) {
        var Char = Password[i];
        for (var j = 0; j != 7; ++j) {
          if (Char & 64) XorKey ^= XorMatrix[CurrentElement];
          Char *= 2;
          --CurrentElement;
        }
      }
      return XorKey;
    };
    return function(password) {
      var Password = _JS2ANSI(password);
      var XorKey = CreateXorKey_Method1(Password);
      var Index = Password.length;
      var ObfuscationArray = new_raw_buf(16);
      for (var i = 0; i != 16; ++i) ObfuscationArray[i] = 0;
      var Temp, PasswordLastChar, PadIndex;
      if ((Index & 1) === 1) {
        Temp = XorKey >> 8;
        ObfuscationArray[Index] = XorRor(PadArray[0], Temp);
        --Index;
        Temp = XorKey & 255;
        PasswordLastChar = Password[Password.length - 1];
        ObfuscationArray[Index] = XorRor(PasswordLastChar, Temp);
      }
      while (Index > 0) {
        --Index;
        Temp = XorKey >> 8;
        ObfuscationArray[Index] = XorRor(Password[Index], Temp);
        --Index;
        Temp = XorKey & 255;
        ObfuscationArray[Index] = XorRor(Password[Index], Temp);
      }
      Index = 15;
      PadIndex = 15 - Password.length;
      while (PadIndex > 0) {
        Temp = XorKey >> 8;
        ObfuscationArray[Index] = XorRor(PadArray[PadIndex], Temp);
        --Index;
        --PadIndex;
        Temp = XorKey & 255;
        ObfuscationArray[Index] = XorRor(Password[Index], Temp);
        --Index;
        --PadIndex;
      }
      return ObfuscationArray;
    };
  })();
  var crypto_DecryptData_Method1 = function(password, Data, XorArrayIndex, XorArray, O) {
    if (!O) O = Data;
    if (!XorArray) XorArray = crypto_CreateXorArray_Method1(password);
    var Index, Value;
    for (Index = 0; Index != Data.length; ++Index) {
      Value = Data[Index];
      Value ^= XorArray[XorArrayIndex];
      Value = (Value >> 5 | Value << 3) & 255;
      O[Index] = Value;
      ++XorArrayIndex;
    }
    return [O, XorArrayIndex, XorArray];
  };
  var crypto_MakeXorDecryptor = function(password) {
    var XorArrayIndex = 0, XorArray = crypto_CreateXorArray_Method1(password);
    return function(Data) {
      var O = crypto_DecryptData_Method1("", Data, XorArrayIndex, XorArray);
      XorArrayIndex = O[1];
      return O[0];
    };
  };
  function parse_XORObfuscation(blob, length, opts, out) {
    var o = { key: parseuint16(blob), verificationBytes: parseuint16(blob) };
    if (opts.password) o.verifier = crypto_CreatePasswordVerifier_Method1(opts.password);
    out.valid = o.verificationBytes === o.verifier;
    if (out.valid) out.insitu = crypto_MakeXorDecryptor(opts.password);
    return o;
  }
  function parse_FilePassHeader(blob, length, oo) {
    var o = oo || {};
    o.Info = blob.read_shift(2);
    blob.l -= 2;
    if (o.Info === 1) o.Data = parse_RC4Header(blob, length);
    else o.Data = parse_RC4CryptoHeader(blob, length);
    return o;
  }
  function parse_FilePass(blob, length, opts) {
    var o = { Type: opts.biff >= 8 ? blob.read_shift(2) : 0 };
    if (o.Type) parse_FilePassHeader(blob, length - 2, o);
    else parse_XORObfuscation(blob, opts.biff >= 8 ? length : length - 2, opts, o);
    return o;
  }
  var RTF = /* @__PURE__ */ (function() {
    function rtf_to_sheet(d, opts) {
      switch (opts.type) {
        case "base64":
          return rtf_to_sheet_str(Base64_decode(d), opts);
        case "binary":
          return rtf_to_sheet_str(d, opts);
        case "buffer":
          return rtf_to_sheet_str(has_buf && Buffer.isBuffer(d) ? d.toString("binary") : a2s(d), opts);
        case "array":
          return rtf_to_sheet_str(cc2str(d), opts);
      }
      throw new Error("Unrecognized type " + opts.type);
    }
    function rtf_to_sheet_str(str, opts) {
      var o = opts || {};
      var ws = o.dense ? [] : {};
      var rows = str.match(/\\trowd.*?\\row\b/g);
      if (!rows.length) throw new Error("RTF missing table");
      var range2 = { s: { c: 0, r: 0 }, e: { c: 0, r: rows.length - 1 } };
      rows.forEach(function(rowtf, R) {
        if (Array.isArray(ws)) ws[R] = [];
        var rtfre = /\\\w+\b/g;
        var last_index = 0;
        var res;
        var C = -1;
        while (res = rtfre.exec(rowtf)) {
          switch (res[0]) {
            case "\\cell":
              var data = rowtf.slice(last_index, rtfre.lastIndex - res[0].length);
              if (data[0] == " ") data = data.slice(1);
              ++C;
              if (data.length) {
                var cell = { v: data, t: "s" };
                if (Array.isArray(ws)) ws[R][C] = cell;
                else ws[encode_cell({ r: R, c: C })] = cell;
              }
              break;
          }
          last_index = rtfre.lastIndex;
        }
        if (C > range2.e.c) range2.e.c = C;
      });
      ws["!ref"] = encode_range(range2);
      return ws;
    }
    function rtf_to_workbook(d, opts) {
      return sheet_to_workbook(rtf_to_sheet(d, opts), opts);
    }
    function sheet_to_rtf(ws) {
      var o = ["{\\rtf1\\ansi"];
      var r = safe_decode_range(ws["!ref"]), cell;
      var dense = Array.isArray(ws);
      for (var R = r.s.r; R <= r.e.r; ++R) {
        o.push("\\trowd\\trautofit1");
        for (var C = r.s.c; C <= r.e.c; ++C) o.push("\\cellx" + (C + 1));
        o.push("\\pard\\intbl");
        for (C = r.s.c; C <= r.e.c; ++C) {
          var coord = encode_cell({ r: R, c: C });
          cell = dense ? (ws[R] || [])[C] : ws[coord];
          if (!cell || cell.v == null && (!cell.f || cell.F)) continue;
          o.push(" " + (cell.w || (format_cell(cell), cell.w)));
          o.push("\\cell");
        }
        o.push("\\pard\\intbl\\row");
      }
      return o.join("") + "}";
    }
    return {
      to_workbook: rtf_to_workbook,
      to_sheet: rtf_to_sheet,
      from_sheet: sheet_to_rtf
    };
  })();
  function hex2RGB(h) {
    var o = h.slice(h[0] === "#" ? 1 : 0).slice(0, 6);
    return [parseInt(o.slice(0, 2), 16), parseInt(o.slice(2, 4), 16), parseInt(o.slice(4, 6), 16)];
  }
  function rgb2Hex(rgb) {
    for (var i = 0, o = 1; i != 3; ++i) o = o * 256 + (rgb[i] > 255 ? 255 : rgb[i] < 0 ? 0 : rgb[i]);
    return o.toString(16).toUpperCase().slice(1);
  }
  function rgb2HSL(rgb) {
    var R = rgb[0] / 255, G = rgb[1] / 255, B = rgb[2] / 255;
    var M = Math.max(R, G, B), m = Math.min(R, G, B), C = M - m;
    if (C === 0) return [0, 0, R];
    var H6 = 0, S = 0, L2 = M + m;
    S = C / (L2 > 1 ? 2 - L2 : L2);
    switch (M) {
      case R:
        H6 = ((G - B) / C + 6) % 6;
        break;
      case G:
        H6 = (B - R) / C + 2;
        break;
      case B:
        H6 = (R - G) / C + 4;
        break;
    }
    return [H6 / 6, S, L2 / 2];
  }
  function hsl2RGB(hsl) {
    var H = hsl[0], S = hsl[1], L = hsl[2];
    var C = S * 2 * (L < 0.5 ? L : 1 - L), m = L - C / 2;
    var rgb = [m, m, m], h6 = 6 * H;
    var X;
    if (S !== 0) switch (h6 | 0) {
      case 0:
      case 6:
        X = C * h6;
        rgb[0] += C;
        rgb[1] += X;
        break;
      case 1:
        X = C * (2 - h6);
        rgb[0] += X;
        rgb[1] += C;
        break;
      case 2:
        X = C * (h6 - 2);
        rgb[1] += C;
        rgb[2] += X;
        break;
      case 3:
        X = C * (4 - h6);
        rgb[1] += X;
        rgb[2] += C;
        break;
      case 4:
        X = C * (h6 - 4);
        rgb[2] += C;
        rgb[0] += X;
        break;
      case 5:
        X = C * (6 - h6);
        rgb[2] += X;
        rgb[0] += C;
        break;
    }
    for (var i = 0; i != 3; ++i) rgb[i] = Math.round(rgb[i] * 255);
    return rgb;
  }
  function rgb_tint(hex, tint) {
    if (tint === 0) return hex;
    var hsl = rgb2HSL(hex2RGB(hex));
    if (tint < 0) hsl[2] = hsl[2] * (1 + tint);
    else hsl[2] = 1 - (1 - hsl[2]) * (1 - tint);
    return rgb2Hex(hsl2RGB(hsl));
  }
  var DEF_MDW = 6;
  var MAX_MDW = 15;
  var MIN_MDW = 1;
  var MDW = DEF_MDW;
  function width2px(width) {
    return Math.floor((width + Math.round(128 / MDW) / 256) * MDW);
  }
  function px2char(px) {
    return Math.floor((px - 5) / MDW * 100 + 0.5) / 100;
  }
  function char2width(chr) {
    return Math.round((chr * MDW + 5) / MDW * 256) / 256;
  }
  function cycle_width(collw) {
    return char2width(px2char(width2px(collw)));
  }
  function find_mdw_colw(collw) {
    var delta = Math.abs(collw - cycle_width(collw)), _MDW = MDW;
    if (delta > 5e-3) {
      for (MDW = MIN_MDW; MDW < MAX_MDW; ++MDW) if (Math.abs(collw - cycle_width(collw)) <= delta) {
        delta = Math.abs(collw - cycle_width(collw));
        _MDW = MDW;
      }
    }
    MDW = _MDW;
  }
  function process_col(coll) {
    if (coll.width) {
      coll.wpx = width2px(coll.width);
      coll.wch = px2char(coll.wpx);
      coll.MDW = MDW;
    } else if (coll.wpx) {
      coll.wch = px2char(coll.wpx);
      coll.width = char2width(coll.wch);
      coll.MDW = MDW;
    } else if (typeof coll.wch == "number") {
      coll.width = char2width(coll.wch);
      coll.wpx = width2px(coll.width);
      coll.MDW = MDW;
    }
    if (coll.customWidth) delete coll.customWidth;
  }
  var DEF_PPI = 96;
  var PPI = DEF_PPI;
  function px2pt(px) {
    return px * 96 / PPI;
  }
  function pt2px(pt) {
    return pt * PPI / 96;
  }
  var XLMLPatternTypeMap = {
    "None": "none",
    "Solid": "solid",
    "Gray50": "mediumGray",
    "Gray75": "darkGray",
    "Gray25": "lightGray",
    "HorzStripe": "darkHorizontal",
    "VertStripe": "darkVertical",
    "ReverseDiagStripe": "darkDown",
    "DiagStripe": "darkUp",
    "DiagCross": "darkGrid",
    "ThickDiagCross": "darkTrellis",
    "ThinHorzStripe": "lightHorizontal",
    "ThinVertStripe": "lightVertical",
    "ThinReverseDiagStripe": "lightDown",
    "ThinHorzCross": "lightGrid"
  };
  function parse_borders(t, styles, themes, opts) {
    styles.Borders = [];
    var border = {};
    var pass = false;
    (t[0].match(tagregex) || []).forEach(function(x) {
      var y = parsexmltag(x);
      switch (strip_ns(y[0])) {
        case "<borders":
        case "<borders>":
        case "</borders>":
          break;
        /* 18.8.4 border CT_Border */
        case "<border":
        case "<border>":
        case "<border/>":
          border = /*::(*/
          {};
          if (y.diagonalUp) border.diagonalUp = parsexmlbool(y.diagonalUp);
          if (y.diagonalDown) border.diagonalDown = parsexmlbool(y.diagonalDown);
          styles.Borders.push(border);
          break;
        case "</border>":
          break;
        /* note: not in spec, appears to be CT_BorderPr */
        case "<left/>":
          break;
        case "<left":
        case "<left>":
          break;
        case "</left>":
          break;
        /* note: not in spec, appears to be CT_BorderPr */
        case "<right/>":
          break;
        case "<right":
        case "<right>":
          break;
        case "</right>":
          break;
        /* 18.8.43 top CT_BorderPr */
        case "<top/>":
          break;
        case "<top":
        case "<top>":
          break;
        case "</top>":
          break;
        /* 18.8.6 bottom CT_BorderPr */
        case "<bottom/>":
          break;
        case "<bottom":
        case "<bottom>":
          break;
        case "</bottom>":
          break;
        /* 18.8.13 diagonal CT_BorderPr */
        case "<diagonal":
        case "<diagonal>":
        case "<diagonal/>":
          break;
        case "</diagonal>":
          break;
        /* 18.8.25 horizontal CT_BorderPr */
        case "<horizontal":
        case "<horizontal>":
        case "<horizontal/>":
          break;
        case "</horizontal>":
          break;
        /* 18.8.44 vertical CT_BorderPr */
        case "<vertical":
        case "<vertical>":
        case "<vertical/>":
          break;
        case "</vertical>":
          break;
        /* 18.8.37 start CT_BorderPr */
        case "<start":
        case "<start>":
        case "<start/>":
          break;
        case "</start>":
          break;
        /* 18.8.16 end CT_BorderPr */
        case "<end":
        case "<end>":
        case "<end/>":
          break;
        case "</end>":
          break;
        /* 18.8.? color CT_Color */
        case "<color":
        case "<color>":
          break;
        case "<color/>":
        case "</color>":
          break;
        /* 18.2.10 extLst CT_ExtensionList ? */
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
          break;
        case "<ext":
          pass = true;
          break;
        case "</ext>":
          pass = false;
          break;
        default:
          if (opts && opts.WTF) {
            if (!pass) throw new Error("unrecognized " + y[0] + " in borders");
          }
      }
    });
  }
  function parse_fills(t, styles, themes, opts) {
    styles.Fills = [];
    var fill2 = {};
    var pass = false;
    (t[0].match(tagregex) || []).forEach(function(x) {
      var y = parsexmltag(x);
      switch (strip_ns(y[0])) {
        case "<fills":
        case "<fills>":
        case "</fills>":
          break;
        /* 18.8.20 fill CT_Fill */
        case "<fill>":
        case "<fill":
        case "<fill/>":
          fill2 = {};
          styles.Fills.push(fill2);
          break;
        case "</fill>":
          break;
        /* 18.8.24 gradientFill CT_GradientFill */
        case "<gradientFill>":
          break;
        case "<gradientFill":
        case "</gradientFill>":
          styles.Fills.push(fill2);
          fill2 = {};
          break;
        /* 18.8.32 patternFill CT_PatternFill */
        case "<patternFill":
        case "<patternFill>":
          if (y.patternType) fill2.patternType = y.patternType;
          break;
        case "<patternFill/>":
        case "</patternFill>":
          break;
        /* 18.8.3 bgColor CT_Color */
        case "<bgColor":
          if (!fill2.bgColor) fill2.bgColor = {};
          if (y.indexed) fill2.bgColor.indexed = parseInt(y.indexed, 10);
          if (y.theme) fill2.bgColor.theme = parseInt(y.theme, 10);
          if (y.tint) fill2.bgColor.tint = parseFloat(y.tint);
          if (y.rgb) fill2.bgColor.rgb = y.rgb.slice(-6);
          break;
        case "<bgColor/>":
        case "</bgColor>":
          break;
        /* 18.8.19 fgColor CT_Color */
        case "<fgColor":
          if (!fill2.fgColor) fill2.fgColor = {};
          if (y.theme) fill2.fgColor.theme = parseInt(y.theme, 10);
          if (y.tint) fill2.fgColor.tint = parseFloat(y.tint);
          if (y.rgb != null) fill2.fgColor.rgb = y.rgb.slice(-6);
          break;
        case "<fgColor/>":
        case "</fgColor>":
          break;
        /* 18.8.38 stop CT_GradientStop */
        case "<stop":
        case "<stop/>":
          break;
        case "</stop>":
          break;
        /* 18.8.? color CT_Color */
        case "<color":
        case "<color/>":
          break;
        case "</color>":
          break;
        /* 18.2.10 extLst CT_ExtensionList ? */
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
          break;
        case "<ext":
          pass = true;
          break;
        case "</ext>":
          pass = false;
          break;
        default:
          if (opts && opts.WTF) {
            if (!pass) throw new Error("unrecognized " + y[0] + " in fills");
          }
      }
    });
  }
  function parse_fonts(t, styles, themes, opts) {
    styles.Fonts = [];
    var font = {};
    var pass = false;
    (t[0].match(tagregex) || []).forEach(function(x) {
      var y = parsexmltag(x);
      switch (strip_ns(y[0])) {
        case "<fonts":
        case "<fonts>":
        case "</fonts>":
          break;
        /* 18.8.22 font CT_Font */
        case "<font":
        case "<font>":
          break;
        case "</font>":
        case "<font/>":
          styles.Fonts.push(font);
          font = {};
          break;
        /* 18.8.29 name CT_FontName */
        case "<name":
          if (y.val) font.name = utf8read(y.val);
          break;
        case "<name/>":
        case "</name>":
          break;
        /* 18.8.2  b CT_BooleanProperty */
        case "<b":
          font.bold = y.val ? parsexmlbool(y.val) : 1;
          break;
        case "<b/>":
          font.bold = 1;
          break;
        /* 18.8.26 i CT_BooleanProperty */
        case "<i":
          font.italic = y.val ? parsexmlbool(y.val) : 1;
          break;
        case "<i/>":
          font.italic = 1;
          break;
        /* 18.4.13 u CT_UnderlineProperty */
        case "<u":
          switch (y.val) {
            case "none":
              font.underline = 0;
              break;
            case "single":
              font.underline = 1;
              break;
            case "double":
              font.underline = 2;
              break;
            case "singleAccounting":
              font.underline = 33;
              break;
            case "doubleAccounting":
              font.underline = 34;
              break;
          }
          break;
        case "<u/>":
          font.underline = 1;
          break;
        /* 18.4.10 strike CT_BooleanProperty */
        case "<strike":
          font.strike = y.val ? parsexmlbool(y.val) : 1;
          break;
        case "<strike/>":
          font.strike = 1;
          break;
        /* 18.4.2  outline CT_BooleanProperty */
        case "<outline":
          font.outline = y.val ? parsexmlbool(y.val) : 1;
          break;
        case "<outline/>":
          font.outline = 1;
          break;
        /* 18.8.36 shadow CT_BooleanProperty */
        case "<shadow":
          font.shadow = y.val ? parsexmlbool(y.val) : 1;
          break;
        case "<shadow/>":
          font.shadow = 1;
          break;
        /* 18.8.12 condense CT_BooleanProperty */
        case "<condense":
          font.condense = y.val ? parsexmlbool(y.val) : 1;
          break;
        case "<condense/>":
          font.condense = 1;
          break;
        /* 18.8.17 extend CT_BooleanProperty */
        case "<extend":
          font.extend = y.val ? parsexmlbool(y.val) : 1;
          break;
        case "<extend/>":
          font.extend = 1;
          break;
        /* 18.4.11 sz CT_FontSize */
        case "<sz":
          if (y.val) font.sz = +y.val;
          break;
        case "<sz/>":
        case "</sz>":
          break;
        /* 18.4.14 vertAlign CT_VerticalAlignFontProperty */
        case "<vertAlign":
          if (y.val) font.vertAlign = y.val;
          break;
        case "<vertAlign/>":
        case "</vertAlign>":
          break;
        /* 18.8.18 family CT_FontFamily */
        case "<family":
          if (y.val) font.family = parseInt(y.val, 10);
          break;
        case "<family/>":
        case "</family>":
          break;
        /* 18.8.35 scheme CT_FontScheme */
        case "<scheme":
          if (y.val) font.scheme = y.val;
          break;
        case "<scheme/>":
        case "</scheme>":
          break;
        /* 18.4.1 charset CT_IntProperty */
        case "<charset":
          if (y.val == "1") break;
          y.codepage = CS2CP[parseInt(y.val, 10)];
          break;
        /* 18.?.? color CT_Color */
        case "<color":
          if (!font.color) font.color = {};
          if (y.auto) font.color.auto = parsexmlbool(y.auto);
          if (y.rgb) font.color.rgb = y.rgb.slice(-6);
          else if (y.indexed) {
            font.color.index = parseInt(y.indexed, 10);
            var icv = XLSIcv[font.color.index];
            if (font.color.index == 81) icv = XLSIcv[1];
            if (!icv) icv = XLSIcv[1];
            font.color.rgb = icv[0].toString(16) + icv[1].toString(16) + icv[2].toString(16);
          } else if (y.theme) {
            font.color.theme = parseInt(y.theme, 10);
            if (y.tint) font.color.tint = parseFloat(y.tint);
            if (y.theme && themes.themeElements && themes.themeElements.clrScheme) {
              font.color.rgb = rgb_tint(themes.themeElements.clrScheme[font.color.theme].rgb, font.color.tint || 0);
            }
          }
          break;
        case "<color/>":
        case "</color>":
          break;
        /* note: sometimes mc:AlternateContent appears bare */
        case "<AlternateContent":
          pass = true;
          break;
        case "</AlternateContent>":
          pass = false;
          break;
        /* 18.2.10 extLst CT_ExtensionList ? */
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
          break;
        case "<ext":
          pass = true;
          break;
        case "</ext>":
          pass = false;
          break;
        default:
          if (opts && opts.WTF) {
            if (!pass) throw new Error("unrecognized " + y[0] + " in fonts");
          }
      }
    });
  }
  function parse_numFmts(t, styles, opts) {
    styles.NumberFmt = [];
    var k = keys(table_fmt);
    for (var i = 0; i < k.length; ++i) styles.NumberFmt[k[i]] = table_fmt[k[i]];
    var m = t[0].match(tagregex);
    if (!m) return;
    for (i = 0; i < m.length; ++i) {
      var y = parsexmltag(m[i]);
      switch (strip_ns(y[0])) {
        case "<numFmts":
        case "</numFmts>":
        case "<numFmts/>":
        case "<numFmts>":
          break;
        case "<numFmt":
          {
            var f = unescapexml(utf8read(y.formatCode)), j = parseInt(y.numFmtId, 10);
            styles.NumberFmt[j] = f;
            if (j > 0) {
              if (j > 392) {
                for (j = 392; j > 60; --j) if (styles.NumberFmt[j] == null) break;
                styles.NumberFmt[j] = f;
              }
              SSF_load(f, j);
            }
          }
          break;
        case "</numFmt>":
          break;
        default:
          if (opts.WTF) throw new Error("unrecognized " + y[0] + " in numFmts");
      }
    }
  }
  var cellXF_uint = ["numFmtId", "fillId", "fontId", "borderId", "xfId"];
  var cellXF_bool = ["applyAlignment", "applyBorder", "applyFill", "applyFont", "applyNumberFormat", "applyProtection", "pivotButton", "quotePrefix"];
  function parse_cellXfs(t, styles, opts) {
    styles.CellXf = [];
    var xf;
    var pass = false;
    (t[0].match(tagregex) || []).forEach(function(x) {
      var y = parsexmltag(x), i = 0;
      switch (strip_ns(y[0])) {
        case "<cellXfs":
        case "<cellXfs>":
        case "<cellXfs/>":
        case "</cellXfs>":
          break;
        /* 18.8.45 xf CT_Xf */
        case "<xf":
        case "<xf/>":
          xf = y;
          delete xf[0];
          for (i = 0; i < cellXF_uint.length; ++i) if (xf[cellXF_uint[i]])
            xf[cellXF_uint[i]] = parseInt(xf[cellXF_uint[i]], 10);
          for (i = 0; i < cellXF_bool.length; ++i) if (xf[cellXF_bool[i]])
            xf[cellXF_bool[i]] = parsexmlbool(xf[cellXF_bool[i]]);
          if (styles.NumberFmt && xf.numFmtId > 392) {
            for (i = 392; i > 60; --i) if (styles.NumberFmt[xf.numFmtId] == styles.NumberFmt[i]) {
              xf.numFmtId = i;
              break;
            }
          }
          styles.CellXf.push(xf);
          break;
        case "</xf>":
          break;
        /* 18.8.1 alignment CT_CellAlignment */
        case "<alignment":
        case "<alignment/>":
          var alignment = {};
          if (y.vertical) alignment.vertical = y.vertical;
          if (y.horizontal) alignment.horizontal = y.horizontal;
          if (y.textRotation != null) alignment.textRotation = y.textRotation;
          if (y.indent) alignment.indent = y.indent;
          if (y.wrapText) alignment.wrapText = parsexmlbool(y.wrapText);
          xf.alignment = alignment;
          break;
        case "</alignment>":
          break;
        /* 18.8.33 protection CT_CellProtection */
        case "<protection":
          break;
        case "</protection>":
        case "<protection/>":
          break;
        /* note: sometimes mc:AlternateContent appears bare */
        case "<AlternateContent":
          pass = true;
          break;
        case "</AlternateContent>":
          pass = false;
          break;
        /* 18.2.10 extLst CT_ExtensionList ? */
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
          break;
        case "<ext":
          pass = true;
          break;
        case "</ext>":
          pass = false;
          break;
        default:
          if (opts && opts.WTF) {
            if (!pass) throw new Error("unrecognized " + y[0] + " in cellXfs");
          }
      }
    });
  }
  var parse_sty_xml = /* @__PURE__ */ (function make_pstyx() {
    var numFmtRegex = /<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/;
    var cellXfRegex = /<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/;
    var fillsRegex = /<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/;
    var fontsRegex = /<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/;
    var bordersRegex = /<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/;
    return function parse_sty_xml2(data, themes, opts) {
      var styles = {};
      if (!data) return styles;
      data = data.replace(/<!--([\s\S]*?)-->/mg, "").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm, "");
      var t;
      if (t = data.match(numFmtRegex)) parse_numFmts(t, styles, opts);
      if (t = data.match(fontsRegex)) parse_fonts(t, styles, themes, opts);
      if (t = data.match(fillsRegex)) parse_fills(t, styles, themes, opts);
      if (t = data.match(bordersRegex)) parse_borders(t, styles, themes, opts);
      if (t = data.match(cellXfRegex)) parse_cellXfs(t, styles, opts);
      return styles;
    };
  })();
  function parse_BrtFmt(data, length) {
    var numFmtId = data.read_shift(2);
    var stFmtCode = parse_XLWideString(data, length - 2);
    return [numFmtId, stFmtCode];
  }
  function parse_BrtFont(data, length, opts) {
    var out = {};
    out.sz = data.read_shift(2) / 20;
    var grbit = parse_FontFlags(data, 2, opts);
    if (grbit.fItalic) out.italic = 1;
    if (grbit.fCondense) out.condense = 1;
    if (grbit.fExtend) out.extend = 1;
    if (grbit.fShadow) out.shadow = 1;
    if (grbit.fOutline) out.outline = 1;
    if (grbit.fStrikeout) out.strike = 1;
    var bls = data.read_shift(2);
    if (bls === 700) out.bold = 1;
    switch (data.read_shift(2)) {
      /* case 0: out.vertAlign = "baseline"; break; */
      case 1:
        out.vertAlign = "superscript";
        break;
      case 2:
        out.vertAlign = "subscript";
        break;
    }
    var underline = data.read_shift(1);
    if (underline != 0) out.underline = underline;
    var family = data.read_shift(1);
    if (family > 0) out.family = family;
    var bCharSet = data.read_shift(1);
    if (bCharSet > 0) out.charset = bCharSet;
    data.l++;
    out.color = parse_BrtColor(data, 8);
    switch (data.read_shift(1)) {
      /* case 0: out.scheme = "none": break; */
      case 1:
        out.scheme = "major";
        break;
      case 2:
        out.scheme = "minor";
        break;
    }
    out.name = parse_XLWideString(data, length - 21);
    return out;
  }
  var parse_BrtFill = parsenoop;
  function parse_BrtXF(data, length) {
    var tgt = data.l + length;
    var ixfeParent = data.read_shift(2);
    var ifmt = data.read_shift(2);
    data.l = tgt;
    return { ixfe: ixfeParent, numFmtId: ifmt };
  }
  var parse_BrtBorder = parsenoop;
  function parse_sty_bin(data, themes, opts) {
    var styles = {};
    styles.NumberFmt = [];
    for (var y in table_fmt) styles.NumberFmt[y] = table_fmt[y];
    styles.CellXf = [];
    styles.Fonts = [];
    var state = [];
    var pass = false;
    recordhopper(data, function hopper_sty(val, R, RT) {
      switch (RT) {
        case 44:
          styles.NumberFmt[val[0]] = val[1];
          SSF_load(val[1], val[0]);
          break;
        case 43:
          styles.Fonts.push(val);
          if (val.color.theme != null && themes && themes.themeElements && themes.themeElements.clrScheme) {
            val.color.rgb = rgb_tint(themes.themeElements.clrScheme[val.color.theme].rgb, val.color.tint || 0);
          }
          break;
        case 1025:
          break;
        case 45:
          break;
        case 46:
          break;
        case 47:
          if (state[state.length - 1] == 617) {
            styles.CellXf.push(val);
          }
          break;
        case 48:
        /* BrtStyle */
        case 507:
        /* BrtDXF */
        case 572:
        /* BrtMRUColor */
        case 475:
          break;
        case 1171:
        /* BrtDXF14 */
        case 2102:
        /* BrtDXF15 */
        case 1130:
        /* BrtSlicerStyleElement */
        case 512:
        /* BrtTableStyleElement */
        case 2095:
        /* BrtTimelineStyleElement */
        case 3072:
          break;
        case 35:
          pass = true;
          break;
        case 36:
          pass = false;
          break;
        case 37:
          state.push(RT);
          pass = true;
          break;
        case 38:
          state.pop();
          pass = false;
          break;
        default:
          if (R.T > 0) state.push(RT);
          else if (R.T < 0) state.pop();
          else if (!pass || opts.WTF && state[state.length - 1] != 37) throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    });
    return styles;
  }
  var XLSXThemeClrScheme = [
    "</a:lt1>",
    "</a:dk1>",
    "</a:lt2>",
    "</a:dk2>",
    "</a:accent1>",
    "</a:accent2>",
    "</a:accent3>",
    "</a:accent4>",
    "</a:accent5>",
    "</a:accent6>",
    "</a:hlink>",
    "</a:folHlink>"
  ];
  function parse_clrScheme(t, themes, opts) {
    themes.themeElements.clrScheme = [];
    var color = {};
    (t[0].match(tagregex) || []).forEach(function(x) {
      var y = parsexmltag(x);
      switch (y[0]) {
        /* 20.1.6.2 clrScheme (Color Scheme) CT_ColorScheme */
        case "<a:clrScheme":
        case "</a:clrScheme>":
          break;
        /* 20.1.2.3.32 srgbClr CT_SRgbColor */
        case "<a:srgbClr":
          color.rgb = y.val;
          break;
        /* 20.1.2.3.33 sysClr CT_SystemColor */
        case "<a:sysClr":
          color.rgb = y.lastClr;
          break;
        /* 20.1.4.1.1 accent1 (Accent 1) */
        /* 20.1.4.1.2 accent2 (Accent 2) */
        /* 20.1.4.1.3 accent3 (Accent 3) */
        /* 20.1.4.1.4 accent4 (Accent 4) */
        /* 20.1.4.1.5 accent5 (Accent 5) */
        /* 20.1.4.1.6 accent6 (Accent 6) */
        /* 20.1.4.1.9 dk1 (Dark 1) */
        /* 20.1.4.1.10 dk2 (Dark 2) */
        /* 20.1.4.1.15 folHlink (Followed Hyperlink) */
        /* 20.1.4.1.19 hlink (Hyperlink) */
        /* 20.1.4.1.22 lt1 (Light 1) */
        /* 20.1.4.1.23 lt2 (Light 2) */
        case "<a:dk1>":
        case "</a:dk1>":
        case "<a:lt1>":
        case "</a:lt1>":
        case "<a:dk2>":
        case "</a:dk2>":
        case "<a:lt2>":
        case "</a:lt2>":
        case "<a:accent1>":
        case "</a:accent1>":
        case "<a:accent2>":
        case "</a:accent2>":
        case "<a:accent3>":
        case "</a:accent3>":
        case "<a:accent4>":
        case "</a:accent4>":
        case "<a:accent5>":
        case "</a:accent5>":
        case "<a:accent6>":
        case "</a:accent6>":
        case "<a:hlink>":
        case "</a:hlink>":
        case "<a:folHlink>":
        case "</a:folHlink>":
          if (y[0].charAt(1) === "/") {
            themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color;
            color = {};
          } else {
            color.name = y[0].slice(3, y[0].length - 1);
          }
          break;
        default:
          if (opts && opts.WTF) throw new Error("Unrecognized " + y[0] + " in clrScheme");
      }
    });
  }
  function parse_fontScheme() {
  }
  function parse_fmtScheme() {
  }
  var clrsregex = /<a:clrScheme([^>]*)>[\s\S]*<\/a:clrScheme>/;
  var fntsregex = /<a:fontScheme([^>]*)>[\s\S]*<\/a:fontScheme>/;
  var fmtsregex = /<a:fmtScheme([^>]*)>[\s\S]*<\/a:fmtScheme>/;
  function parse_themeElements(data, themes, opts) {
    themes.themeElements = {};
    var t;
    [
      /* clrScheme CT_ColorScheme */
      ["clrScheme", clrsregex, parse_clrScheme],
      /* fontScheme CT_FontScheme */
      ["fontScheme", fntsregex, parse_fontScheme],
      /* fmtScheme CT_StyleMatrix */
      ["fmtScheme", fmtsregex, parse_fmtScheme]
    ].forEach(function(m) {
      if (!(t = data.match(m[1]))) throw new Error(m[0] + " not found in themeElements");
      m[2](t, themes, opts);
    });
  }
  var themeltregex = /<a:themeElements([^>]*)>[\s\S]*<\/a:themeElements>/;
  function parse_theme_xml(data, opts) {
    if (!data || data.length === 0) data = write_theme();
    var t;
    var themes = {};
    if (!(t = data.match(themeltregex))) throw new Error("themeElements not found in theme");
    parse_themeElements(t[0], themes, opts);
    themes.raw = data;
    return themes;
  }
  function write_theme(Themes, opts) {
    if (opts && opts.themeXLSX) return opts.themeXLSX;
    if (Themes && typeof Themes.raw == "string") return Themes.raw;
    var o = [XML_HEADER];
    o[o.length] = '<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">';
    o[o.length] = "<a:themeElements>";
    o[o.length] = '<a:clrScheme name="Office">';
    o[o.length] = '<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>';
    o[o.length] = '<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>';
    o[o.length] = '<a:dk2><a:srgbClr val="1F497D"/></a:dk2>';
    o[o.length] = '<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>';
    o[o.length] = '<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>';
    o[o.length] = '<a:accent2><a:srgbClr val="C0504D"/></a:accent2>';
    o[o.length] = '<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>';
    o[o.length] = '<a:accent4><a:srgbClr val="8064A2"/></a:accent4>';
    o[o.length] = '<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>';
    o[o.length] = '<a:accent6><a:srgbClr val="F79646"/></a:accent6>';
    o[o.length] = '<a:hlink><a:srgbClr val="0000FF"/></a:hlink>';
    o[o.length] = '<a:folHlink><a:srgbClr val="800080"/></a:folHlink>';
    o[o.length] = "</a:clrScheme>";
    o[o.length] = '<a:fontScheme name="Office">';
    o[o.length] = "<a:majorFont>";
    o[o.length] = '<a:latin typeface="Cambria"/>';
    o[o.length] = '<a:ea typeface=""/>';
    o[o.length] = '<a:cs typeface=""/>';
    o[o.length] = '<a:font script="Jpan" typeface="\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF"/>';
    o[o.length] = '<a:font script="Hang" typeface="\uB9D1\uC740 \uACE0\uB515"/>';
    o[o.length] = '<a:font script="Hans" typeface="\u5B8B\u4F53"/>';
    o[o.length] = '<a:font script="Hant" typeface="\u65B0\u7D30\u660E\u9AD4"/>';
    o[o.length] = '<a:font script="Arab" typeface="Times New Roman"/>';
    o[o.length] = '<a:font script="Hebr" typeface="Times New Roman"/>';
    o[o.length] = '<a:font script="Thai" typeface="Tahoma"/>';
    o[o.length] = '<a:font script="Ethi" typeface="Nyala"/>';
    o[o.length] = '<a:font script="Beng" typeface="Vrinda"/>';
    o[o.length] = '<a:font script="Gujr" typeface="Shruti"/>';
    o[o.length] = '<a:font script="Khmr" typeface="MoolBoran"/>';
    o[o.length] = '<a:font script="Knda" typeface="Tunga"/>';
    o[o.length] = '<a:font script="Guru" typeface="Raavi"/>';
    o[o.length] = '<a:font script="Cans" typeface="Euphemia"/>';
    o[o.length] = '<a:font script="Cher" typeface="Plantagenet Cherokee"/>';
    o[o.length] = '<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>';
    o[o.length] = '<a:font script="Tibt" typeface="Microsoft Himalaya"/>';
    o[o.length] = '<a:font script="Thaa" typeface="MV Boli"/>';
    o[o.length] = '<a:font script="Deva" typeface="Mangal"/>';
    o[o.length] = '<a:font script="Telu" typeface="Gautami"/>';
    o[o.length] = '<a:font script="Taml" typeface="Latha"/>';
    o[o.length] = '<a:font script="Syrc" typeface="Estrangelo Edessa"/>';
    o[o.length] = '<a:font script="Orya" typeface="Kalinga"/>';
    o[o.length] = '<a:font script="Mlym" typeface="Kartika"/>';
    o[o.length] = '<a:font script="Laoo" typeface="DokChampa"/>';
    o[o.length] = '<a:font script="Sinh" typeface="Iskoola Pota"/>';
    o[o.length] = '<a:font script="Mong" typeface="Mongolian Baiti"/>';
    o[o.length] = '<a:font script="Viet" typeface="Times New Roman"/>';
    o[o.length] = '<a:font script="Uigh" typeface="Microsoft Uighur"/>';
    o[o.length] = '<a:font script="Geor" typeface="Sylfaen"/>';
    o[o.length] = "</a:majorFont>";
    o[o.length] = "<a:minorFont>";
    o[o.length] = '<a:latin typeface="Calibri"/>';
    o[o.length] = '<a:ea typeface=""/>';
    o[o.length] = '<a:cs typeface=""/>';
    o[o.length] = '<a:font script="Jpan" typeface="\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF"/>';
    o[o.length] = '<a:font script="Hang" typeface="\uB9D1\uC740 \uACE0\uB515"/>';
    o[o.length] = '<a:font script="Hans" typeface="\u5B8B\u4F53"/>';
    o[o.length] = '<a:font script="Hant" typeface="\u65B0\u7D30\u660E\u9AD4"/>';
    o[o.length] = '<a:font script="Arab" typeface="Arial"/>';
    o[o.length] = '<a:font script="Hebr" typeface="Arial"/>';
    o[o.length] = '<a:font script="Thai" typeface="Tahoma"/>';
    o[o.length] = '<a:font script="Ethi" typeface="Nyala"/>';
    o[o.length] = '<a:font script="Beng" typeface="Vrinda"/>';
    o[o.length] = '<a:font script="Gujr" typeface="Shruti"/>';
    o[o.length] = '<a:font script="Khmr" typeface="DaunPenh"/>';
    o[o.length] = '<a:font script="Knda" typeface="Tunga"/>';
    o[o.length] = '<a:font script="Guru" typeface="Raavi"/>';
    o[o.length] = '<a:font script="Cans" typeface="Euphemia"/>';
    o[o.length] = '<a:font script="Cher" typeface="Plantagenet Cherokee"/>';
    o[o.length] = '<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>';
    o[o.length] = '<a:font script="Tibt" typeface="Microsoft Himalaya"/>';
    o[o.length] = '<a:font script="Thaa" typeface="MV Boli"/>';
    o[o.length] = '<a:font script="Deva" typeface="Mangal"/>';
    o[o.length] = '<a:font script="Telu" typeface="Gautami"/>';
    o[o.length] = '<a:font script="Taml" typeface="Latha"/>';
    o[o.length] = '<a:font script="Syrc" typeface="Estrangelo Edessa"/>';
    o[o.length] = '<a:font script="Orya" typeface="Kalinga"/>';
    o[o.length] = '<a:font script="Mlym" typeface="Kartika"/>';
    o[o.length] = '<a:font script="Laoo" typeface="DokChampa"/>';
    o[o.length] = '<a:font script="Sinh" typeface="Iskoola Pota"/>';
    o[o.length] = '<a:font script="Mong" typeface="Mongolian Baiti"/>';
    o[o.length] = '<a:font script="Viet" typeface="Arial"/>';
    o[o.length] = '<a:font script="Uigh" typeface="Microsoft Uighur"/>';
    o[o.length] = '<a:font script="Geor" typeface="Sylfaen"/>';
    o[o.length] = "</a:minorFont>";
    o[o.length] = "</a:fontScheme>";
    o[o.length] = '<a:fmtScheme name="Office">';
    o[o.length] = "<a:fillStyleLst>";
    o[o.length] = '<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>';
    o[o.length] = '<a:gradFill rotWithShape="1">';
    o[o.length] = "<a:gsLst>";
    o[o.length] = '<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>';
    o[o.length] = '<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>';
    o[o.length] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>';
    o[o.length] = "</a:gsLst>";
    o[o.length] = '<a:lin ang="16200000" scaled="1"/>';
    o[o.length] = "</a:gradFill>";
    o[o.length] = '<a:gradFill rotWithShape="1">';
    o[o.length] = "<a:gsLst>";
    o[o.length] = '<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="100000"/><a:shade val="100000"/><a:satMod val="130000"/></a:schemeClr></a:gs>';
    o[o.length] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000"/><a:shade val="100000"/><a:satMod val="350000"/></a:schemeClr></a:gs>';
    o[o.length] = "</a:gsLst>";
    o[o.length] = '<a:lin ang="16200000" scaled="0"/>';
    o[o.length] = "</a:gradFill>";
    o[o.length] = "</a:fillStyleLst>";
    o[o.length] = "<a:lnStyleLst>";
    o[o.length] = '<a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln>';
    o[o.length] = '<a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>';
    o[o.length] = '<a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>';
    o[o.length] = "</a:lnStyleLst>";
    o[o.length] = "<a:effectStyleLst>";
    o[o.length] = "<a:effectStyle>";
    o[o.length] = "<a:effectLst>";
    o[o.length] = '<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>';
    o[o.length] = "</a:effectLst>";
    o[o.length] = "</a:effectStyle>";
    o[o.length] = "<a:effectStyle>";
    o[o.length] = "<a:effectLst>";
    o[o.length] = '<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>';
    o[o.length] = "</a:effectLst>";
    o[o.length] = "</a:effectStyle>";
    o[o.length] = "<a:effectStyle>";
    o[o.length] = "<a:effectLst>";
    o[o.length] = '<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>';
    o[o.length] = "</a:effectLst>";
    o[o.length] = '<a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d>';
    o[o.length] = '<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>';
    o[o.length] = "</a:effectStyle>";
    o[o.length] = "</a:effectStyleLst>";
    o[o.length] = "<a:bgFillStyleLst>";
    o[o.length] = '<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>';
    o[o.length] = '<a:gradFill rotWithShape="1">';
    o[o.length] = "<a:gsLst>";
    o[o.length] = '<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>';
    o[o.length] = '<a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs>';
    o[o.length] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>';
    o[o.length] = "</a:gsLst>";
    o[o.length] = '<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>';
    o[o.length] = "</a:gradFill>";
    o[o.length] = '<a:gradFill rotWithShape="1">';
    o[o.length] = "<a:gsLst>";
    o[o.length] = '<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>';
    o[o.length] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>';
    o[o.length] = "</a:gsLst>";
    o[o.length] = '<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>';
    o[o.length] = "</a:gradFill>";
    o[o.length] = "</a:bgFillStyleLst>";
    o[o.length] = "</a:fmtScheme>";
    o[o.length] = "</a:themeElements>";
    o[o.length] = "<a:objectDefaults>";
    o[o.length] = "<a:spDef>";
    o[o.length] = '<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style>';
    o[o.length] = "</a:spDef>";
    o[o.length] = "<a:lnDef>";
    o[o.length] = '<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style>';
    o[o.length] = "</a:lnDef>";
    o[o.length] = "</a:objectDefaults>";
    o[o.length] = "<a:extraClrSchemeLst/>";
    o[o.length] = "</a:theme>";
    return o.join("");
  }
  function parse_Theme(blob, length, opts) {
    var end = blob.l + length;
    var dwThemeVersion = blob.read_shift(4);
    if (dwThemeVersion === 124226) return;
    if (!opts.cellStyles) {
      blob.l = end;
      return;
    }
    var data = blob.slice(blob.l);
    blob.l = end;
    var zip;
    try {
      zip = zip_read(data, { type: "array" });
    } catch (e) {
      return;
    }
    var themeXML = getzipstr(zip, "theme/theme/theme1.xml", true);
    if (!themeXML) return;
    return parse_theme_xml(themeXML, opts);
  }
  function parse_ColorTheme(blob) {
    return blob.read_shift(4);
  }
  function parse_FullColorExt(blob) {
    var o = {};
    o.xclrType = blob.read_shift(2);
    o.nTintShade = blob.read_shift(2);
    switch (o.xclrType) {
      case 0:
        blob.l += 4;
        break;
      case 1:
        o.xclrValue = parse_IcvXF(blob, 4);
        break;
      case 2:
        o.xclrValue = parse_LongRGBA(blob, 4);
        break;
      case 3:
        o.xclrValue = parse_ColorTheme(blob, 4);
        break;
      case 4:
        blob.l += 4;
        break;
    }
    blob.l += 8;
    return o;
  }
  function parse_IcvXF(blob, length) {
    return parsenoop(blob, length);
  }
  function parse_XFExtGradient(blob, length) {
    return parsenoop(blob, length);
  }
  function parse_ExtProp(blob) {
    var extType = blob.read_shift(2);
    var cb2 = blob.read_shift(2) - 4;
    var o = [extType];
    switch (extType) {
      case 4:
      case 5:
      case 7:
      case 8:
      case 9:
      case 10:
      case 11:
      case 13:
        o[1] = parse_FullColorExt(blob, cb2);
        break;
      case 6:
        o[1] = parse_XFExtGradient(blob, cb2);
        break;
      case 14:
      case 15:
        o[1] = blob.read_shift(cb2 === 1 ? 1 : 2);
        break;
      default:
        throw new Error("Unrecognized ExtProp type: " + extType + " " + cb2);
    }
    return o;
  }
  function parse_XFExt(blob, length) {
    var end = blob.l + length;
    blob.l += 2;
    var ixfe = blob.read_shift(2);
    blob.l += 2;
    var cexts = blob.read_shift(2);
    var ext = [];
    while (cexts-- > 0) ext.push(parse_ExtProp(blob, end - blob.l));
    return { ixfe, ext };
  }
  function update_xfext(xf, xfext) {
    xfext.forEach(function(xfe) {
      switch (xfe[0]) {
        /* 2.5.108 extPropData */
        case 4:
          break;
        /* foreground color */
        case 5:
          break;
        /* background color */
        case 6:
          break;
        /* gradient fill */
        case 7:
          break;
        /* top cell border color */
        case 8:
          break;
        /* bottom cell border color */
        case 9:
          break;
        /* left cell border color */
        case 10:
          break;
        /* right cell border color */
        case 11:
          break;
        /* diagonal cell border color */
        case 13:
          break;
        case 14:
          break;
        /* font scheme */
        case 15:
          break;
      }
    });
  }
  function parse_BrtMdtinfo(data, length) {
    return {
      flags: data.read_shift(4),
      version: data.read_shift(4),
      name: parse_XLWideString(data, length - 8)
    };
  }
  function parse_BrtMdb(data) {
    var out = [];
    var cnt = data.read_shift(4);
    while (cnt-- > 0)
      out.push([data.read_shift(4), data.read_shift(4)]);
    return out;
  }
  function parse_BrtBeginEsmdb(data) {
    data.l += 4;
    return data.read_shift(4) != 0;
  }
  function parse_xlmeta_bin(data, name, _opts) {
    var out = { Types: [], Cell: [], Value: [] };
    var opts = _opts || {};
    var state = [];
    var pass = false;
    var metatype = 2;
    recordhopper(data, function(val, R, RT) {
      switch (RT) {
        case 335:
          out.Types.push({ name: val.name });
          break;
        case 51:
          val.forEach(function(r) {
            if (metatype == 1)
              out.Cell.push({ type: out.Types[r[0] - 1].name, index: r[1] });
            else if (metatype == 0)
              out.Value.push({ type: out.Types[r[0] - 1].name, index: r[1] });
          });
          break;
        case 337:
          metatype = val ? 1 : 0;
          break;
        case 338:
          metatype = 2;
          break;
        case 35:
          state.push(RT);
          pass = true;
          break;
        case 36:
          state.pop();
          pass = false;
          break;
        default:
          if (R.T) {
          } else if (!pass || opts.WTF && state[state.length - 1] != 35)
            throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    });
    return out;
  }
  function parse_xlmeta_xml(data, name, opts) {
    var out = { Types: [], Cell: [], Value: [] };
    if (!data)
      return out;
    var pass = false;
    var metatype = 2;
    var lastmeta;
    data.replace(tagregex, function(x) {
      var y = parsexmltag(x);
      switch (strip_ns(y[0])) {
        case "<?xml":
          break;
        case "<metadata":
        case "</metadata>":
          break;
        case "<metadataTypes":
        case "</metadataTypes>":
          break;
        case "<metadataType":
          out.Types.push({ name: y.name });
          break;
        case "</metadataType>":
          break;
        case "<futureMetadata":
          for (var j = 0; j < out.Types.length; ++j)
            if (out.Types[j].name == y.name)
              lastmeta = out.Types[j];
          break;
        case "</futureMetadata>":
          break;
        case "<bk>":
          break;
        case "</bk>":
          break;
        case "<rc":
          if (metatype == 1)
            out.Cell.push({ type: out.Types[y.t - 1].name, index: +y.v });
          else if (metatype == 0)
            out.Value.push({ type: out.Types[y.t - 1].name, index: +y.v });
          break;
        case "</rc>":
          break;
        case "<cellMetadata":
          metatype = 1;
          break;
        case "</cellMetadata>":
          metatype = 2;
          break;
        case "<valueMetadata":
          metatype = 0;
          break;
        case "</valueMetadata>":
          metatype = 2;
          break;
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
        case "<extLst/>":
          break;
        case "<ext":
          pass = true;
          break;
        case "</ext>":
          pass = false;
          break;
        case "<rvb":
          if (!lastmeta)
            break;
          if (!lastmeta.offsets)
            lastmeta.offsets = [];
          lastmeta.offsets.push(+y.i);
          break;
        default:
          if (!pass && opts.WTF)
            throw new Error("unrecognized " + y[0] + " in metadata");
      }
      return x;
    });
    return out;
  }
  function parse_cc_xml(data) {
    var d = [];
    if (!data) return d;
    var i = 1;
    (data.match(tagregex) || []).forEach(function(x) {
      var y = parsexmltag(x);
      switch (y[0]) {
        case "<?xml":
          break;
        /* 18.6.2  calcChain CT_CalcChain 1 */
        case "<calcChain":
        case "<calcChain>":
        case "</calcChain>":
          break;
        /* 18.6.1  c CT_CalcCell 1 */
        case "<c":
          delete y[0];
          if (y.i) i = y.i;
          else y.i = i;
          d.push(y);
          break;
      }
    });
    return d;
  }
  function parse_BrtCalcChainItem$(data) {
    var out = {};
    out.i = data.read_shift(4);
    var cell = {};
    cell.r = data.read_shift(4);
    cell.c = data.read_shift(4);
    out.r = encode_cell(cell);
    var flags = data.read_shift(1);
    if (flags & 2) out.l = "1";
    if (flags & 8) out.a = "1";
    return out;
  }
  function parse_cc_bin(data, name, opts) {
    var out = [];
    var pass = false;
    recordhopper(data, function hopper_cc(val, R, RT) {
      switch (RT) {
        case 63:
          out.push(val);
          break;
        default:
          if (R.T) {
          } else if (!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    });
    return out;
  }
  function parse_xlink_xml() {
  }
  function parse_xlink_bin(data, rel, name, _opts) {
    if (!data) return data;
    var opts = _opts || {};
    var pass = false, end = false;
    recordhopper(data, function xlink_parse(val, R, RT) {
      if (end) return;
      switch (RT) {
        case 359:
        /* 'BrtSupTabs' */
        case 363:
        /* 'BrtExternTableStart' */
        case 364:
        /* 'BrtExternTableEnd' */
        case 366:
        /* 'BrtExternRowHdr' */
        case 367:
        /* 'BrtExternCellBlank' */
        case 368:
        /* 'BrtExternCellReal' */
        case 369:
        /* 'BrtExternCellBool' */
        case 370:
        /* 'BrtExternCellError' */
        case 371:
        /* 'BrtExternCellString' */
        case 472:
        /* 'BrtExternValueMeta' */
        case 577:
        /* 'BrtSupNameStart' */
        case 578:
        /* 'BrtSupNameValueStart' */
        case 579:
        /* 'BrtSupNameValueEnd' */
        case 580:
        /* 'BrtSupNameNum' */
        case 581:
        /* 'BrtSupNameErr' */
        case 582:
        /* 'BrtSupNameSt' */
        case 583:
        /* 'BrtSupNameNil' */
        case 584:
        /* 'BrtSupNameBool' */
        case 585:
        /* 'BrtSupNameFmla' */
        case 586:
        /* 'BrtSupNameBits' */
        case 587:
          break;
        case 35:
          pass = true;
          break;
        case 36:
          pass = false;
          break;
        default:
          if (R.T) {
          } else if (!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    }, opts);
  }
  function parse_drawing(data, rels) {
    if (!data) return "??";
    var id = (data.match(/<c:chart [^>]*r:id="([^"]*)"/) || ["", ""])[1];
    return rels["!id"][id].Target;
  }
  function sheet_insert_comments(sheet, comments, threaded, people) {
    var dense = Array.isArray(sheet);
    var cell;
    comments.forEach(function(comment) {
      var r = decode_cell(comment.ref);
      if (dense) {
        if (!sheet[r.r]) sheet[r.r] = [];
        cell = sheet[r.r][r.c];
      } else cell = sheet[comment.ref];
      if (!cell) {
        cell = { t: "z" };
        if (dense) sheet[r.r][r.c] = cell;
        else sheet[comment.ref] = cell;
        var range2 = safe_decode_range(sheet["!ref"] || "BDWGO1000001:A1");
        if (range2.s.r > r.r) range2.s.r = r.r;
        if (range2.e.r < r.r) range2.e.r = r.r;
        if (range2.s.c > r.c) range2.s.c = r.c;
        if (range2.e.c < r.c) range2.e.c = r.c;
        var encoded = encode_range(range2);
        if (encoded !== sheet["!ref"]) sheet["!ref"] = encoded;
      }
      if (!cell.c) cell.c = [];
      var o = { a: comment.author, t: comment.t, r: comment.r, T: threaded };
      if (comment.h) o.h = comment.h;
      for (var i = cell.c.length - 1; i >= 0; --i) {
        if (!threaded && cell.c[i].T) return;
        if (threaded && !cell.c[i].T) cell.c.splice(i, 1);
      }
      if (threaded && people) for (i = 0; i < people.length; ++i) {
        if (o.a == people[i].id) {
          o.a = people[i].name || o.a;
          break;
        }
      }
      cell.c.push(o);
    });
  }
  function parse_comments_xml(data, opts) {
    if (data.match(/<(?:\w+:)?comments *\/>/)) return [];
    var authors = [];
    var commentList = [];
    var authtag = data.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/);
    if (authtag && authtag[1]) authtag[1].split(/<\/\w*:?author>/).forEach(function(x) {
      if (x === "" || x.trim() === "") return;
      var a = x.match(/<(?:\w+:)?author[^>]*>(.*)/);
      if (a) authors.push(a[1]);
    });
    var cmnttag = data.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/);
    if (cmnttag && cmnttag[1]) cmnttag[1].split(/<\/\w*:?comment>/).forEach(function(x) {
      if (x === "" || x.trim() === "") return;
      var cm = x.match(/<(?:\w+:)?comment[^>]*>/);
      if (!cm) return;
      var y = parsexmltag(cm[0]);
      var comment = { author: y.authorId && authors[y.authorId] || "sheetjsghost", ref: y.ref, guid: y.guid };
      var cell = decode_cell(y.ref);
      if (opts.sheetRows && opts.sheetRows <= cell.r) return;
      var textMatch = x.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/);
      var rt = !!textMatch && !!textMatch[1] && parse_si(textMatch[1]) || { r: "", t: "", h: "" };
      comment.r = rt.r;
      if (rt.r == "<t></t>") rt.t = rt.h = "";
      comment.t = (rt.t || "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
      if (opts.cellHTML) comment.h = rt.h;
      commentList.push(comment);
    });
    return commentList;
  }
  function parse_tcmnt_xml(data, opts) {
    var out = [];
    var pass = false, comment = {}, tidx = 0;
    data.replace(tagregex, function xml_tcmnt(x, idx) {
      var y = parsexmltag(x);
      switch (strip_ns(y[0])) {
        case "<?xml":
          break;
        /* 2.6.207 ThreadedComments CT_ThreadedComments */
        case "<ThreadedComments":
          break;
        case "</ThreadedComments>":
          break;
        /* 2.6.205 threadedComment CT_ThreadedComment */
        case "<threadedComment":
          comment = { author: y.personId, guid: y.id, ref: y.ref, T: 1 };
          break;
        case "</threadedComment>":
          if (comment.t != null) out.push(comment);
          break;
        case "<text>":
        case "<text":
          tidx = idx + x.length;
          break;
        case "</text>":
          comment.t = data.slice(tidx, idx).replace(/\r\n/g, "\n").replace(/\r/g, "\n");
          break;
        /* 2.6.206 mentions CT_ThreadedCommentMentions TODO */
        case "<mentions":
        case "<mentions>":
          pass = true;
          break;
        case "</mentions>":
          pass = false;
          break;
        /* 2.6.202 mention CT_Mention TODO */
        /* 18.2.10 extLst CT_ExtensionList ? */
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
        case "<extLst/>":
          break;
        /* 18.2.7  ext CT_Extension + */
        case "<ext":
          pass = true;
          break;
        case "</ext>":
          pass = false;
          break;
        default:
          if (!pass && opts.WTF) throw new Error("unrecognized " + y[0] + " in threaded comments");
      }
      return x;
    });
    return out;
  }
  function parse_people_xml(data, opts) {
    var out = [];
    var pass = false;
    data.replace(tagregex, function xml_tcmnt(x) {
      var y = parsexmltag(x);
      switch (strip_ns(y[0])) {
        case "<?xml":
          break;
        /* 2.4.85 personList CT_PersonList */
        case "<personList":
          break;
        case "</personList>":
          break;
        /* 2.6.203 person CT_Person TODO: providers */
        case "<person":
          out.push({ name: y.displayname, id: y.id });
          break;
        case "</person>":
          break;
        /* 18.2.10 extLst CT_ExtensionList ? */
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
        case "<extLst/>":
          break;
        /* 18.2.7  ext CT_Extension + */
        case "<ext":
          pass = true;
          break;
        case "</ext>":
          pass = false;
          break;
        default:
          if (!pass && opts.WTF) throw new Error("unrecognized " + y[0] + " in threaded comments");
      }
      return x;
    });
    return out;
  }
  function parse_BrtBeginComment(data) {
    var out = {};
    out.iauthor = data.read_shift(4);
    var rfx = parse_UncheckedRfX(data, 16);
    out.rfx = rfx.s;
    out.ref = encode_cell(rfx.s);
    data.l += 16;
    return out;
  }
  var parse_BrtCommentAuthor = parse_XLWideString;
  function parse_comments_bin(data, opts) {
    var out = [];
    var authors = [];
    var c = {};
    var pass = false;
    recordhopper(data, function hopper_cmnt(val, R, RT) {
      switch (RT) {
        case 632:
          authors.push(val);
          break;
        case 635:
          c = val;
          break;
        case 637:
          c.t = val.t;
          c.h = val.h;
          c.r = val.r;
          break;
        case 636:
          c.author = authors[c.iauthor];
          delete c.iauthor;
          if (opts.sheetRows && c.rfx && opts.sheetRows <= c.rfx.r) break;
          if (!c.t) c.t = "";
          delete c.rfx;
          out.push(c);
          break;
        case 3072:
          break;
        case 35:
          pass = true;
          break;
        case 36:
          pass = false;
          break;
        case 37:
          break;
        case 38:
          break;
        default:
          if (R.T) {
          } else if (!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    });
    return out;
  }
  var CT_VBA = "application/vnd.ms-office.vbaProject";
  function make_vba_xls(cfb) {
    var newcfb = CFB.utils.cfb_new({ root: "R" });
    cfb.FullPaths.forEach(function(p, i) {
      if (p.slice(-1) === "/" || !p.match(/_VBA_PROJECT_CUR/))
        return;
      var newpath = p.replace(/^[^\/]*/, "R").replace(/\/_VBA_PROJECT_CUR\u0000*/, "");
      CFB.utils.cfb_add(newcfb, newpath, cfb.FileIndex[i].content);
    });
    return CFB.write(newcfb);
  }
  function parse_ds_bin() {
    return { "!type": "dialog" };
  }
  function parse_ds_xml() {
    return { "!type": "dialog" };
  }
  function parse_ms_bin() {
    return { "!type": "macro" };
  }
  function parse_ms_xml() {
    return { "!type": "macro" };
  }
  var rc_to_a1 = /* @__PURE__ */ (function() {
    var rcregex = /(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g;
    var rcbase = { r: 0, c: 0 };
    function rcfunc($$, $1, $2, $3) {
      var cRel = false, rRel = false;
      if ($2.length == 0) rRel = true;
      else if ($2.charAt(0) == "[") {
        rRel = true;
        $2 = $2.slice(1, -1);
      }
      if ($3.length == 0) cRel = true;
      else if ($3.charAt(0) == "[") {
        cRel = true;
        $3 = $3.slice(1, -1);
      }
      var R = $2.length > 0 ? parseInt($2, 10) | 0 : 0, C = $3.length > 0 ? parseInt($3, 10) | 0 : 0;
      if (cRel) C += rcbase.c;
      else --C;
      if (rRel) R += rcbase.r;
      else --R;
      return $1 + (cRel ? "" : "$") + encode_col(C) + (rRel ? "" : "$") + encode_row(R);
    }
    return function rc_to_a12(fstr, base) {
      rcbase = base;
      return fstr.replace(rcregex, rcfunc);
    };
  })();
  var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
  var a1_to_rc = /* @__PURE__ */ (function() {
    return function a1_to_rc2(fstr, base) {
      return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
        var c = decode_col($3) - ($2 ? 0 : base.c);
        var r = decode_row($5) - ($4 ? 0 : base.r);
        var R = r == 0 ? "" : !$4 ? "[" + r + "]" : r + 1;
        var C = c == 0 ? "" : !$2 ? "[" + c + "]" : c + 1;
        return $1 + "R" + R + "C" + C;
      });
    };
  })();
  function shift_formula_str(f, delta) {
    return f.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
      return $1 + ($2 == "$" ? $2 + $3 : encode_col(decode_col($3) + delta.c)) + ($4 == "$" ? $4 + $5 : encode_row(decode_row($5) + delta.r));
    });
  }
  function shift_formula_xlsx(f, range2, cell) {
    var r = decode_range(range2), s = r.s, c = decode_cell(cell);
    var delta = { r: c.r - s.r, c: c.c - s.c };
    return shift_formula_str(f, delta);
  }
  function fuzzyfmla(f) {
    if (f.length == 1) return false;
    return true;
  }
  function _xlfn(f) {
    return f.replace(/_xlfn\./g, "");
  }
  function parseread1(blob) {
    blob.l += 1;
    return;
  }
  function parse_ColRelU(blob, length) {
    var c = blob.read_shift(length == 1 ? 1 : 2);
    return [c & 16383, c >> 14 & 1, c >> 15 & 1];
  }
  function parse_RgceArea(blob, length, opts) {
    var w = 2;
    if (opts) {
      if (opts.biff >= 2 && opts.biff <= 5) return parse_RgceArea_BIFF2(blob, length, opts);
      else if (opts.biff == 12) w = 4;
    }
    var r = blob.read_shift(w), R = blob.read_shift(w);
    var c = parse_ColRelU(blob, 2);
    var C = parse_ColRelU(blob, 2);
    return { s: { r, c: c[0], cRel: c[1], rRel: c[2] }, e: { r: R, c: C[0], cRel: C[1], rRel: C[2] } };
  }
  function parse_RgceArea_BIFF2(blob) {
    var r = parse_ColRelU(blob, 2), R = parse_ColRelU(blob, 2);
    var c = blob.read_shift(1);
    var C = blob.read_shift(1);
    return { s: { r: r[0], c, cRel: r[1], rRel: r[2] }, e: { r: R[0], c: C, cRel: R[1], rRel: R[2] } };
  }
  function parse_RgceAreaRel(blob, length, opts) {
    if (opts.biff < 8) return parse_RgceArea_BIFF2(blob, length, opts);
    var r = blob.read_shift(opts.biff == 12 ? 4 : 2), R = blob.read_shift(opts.biff == 12 ? 4 : 2);
    var c = parse_ColRelU(blob, 2);
    var C = parse_ColRelU(blob, 2);
    return { s: { r, c: c[0], cRel: c[1], rRel: c[2] }, e: { r: R, c: C[0], cRel: C[1], rRel: C[2] } };
  }
  function parse_RgceLoc(blob, length, opts) {
    if (opts && opts.biff >= 2 && opts.biff <= 5) return parse_RgceLoc_BIFF2(blob, length, opts);
    var r = blob.read_shift(opts && opts.biff == 12 ? 4 : 2);
    var c = parse_ColRelU(blob, 2);
    return { r, c: c[0], cRel: c[1], rRel: c[2] };
  }
  function parse_RgceLoc_BIFF2(blob) {
    var r = parse_ColRelU(blob, 2);
    var c = blob.read_shift(1);
    return { r: r[0], c, cRel: r[1], rRel: r[2] };
  }
  function parse_RgceElfLoc(blob) {
    var r = blob.read_shift(2);
    var c = blob.read_shift(2);
    return { r, c: c & 255, fQuoted: !!(c & 16384), cRel: c >> 15, rRel: c >> 15 };
  }
  function parse_RgceLocRel(blob, length, opts) {
    var biff = opts && opts.biff ? opts.biff : 8;
    if (biff >= 2 && biff <= 5) return parse_RgceLocRel_BIFF2(blob, length, opts);
    var r = blob.read_shift(biff >= 12 ? 4 : 2);
    var cl = blob.read_shift(2);
    var cRel = (cl & 16384) >> 14, rRel = (cl & 32768) >> 15;
    cl &= 16383;
    if (rRel == 1) while (r > 524287) r -= 1048576;
    if (cRel == 1) while (cl > 8191) cl = cl - 16384;
    return { r, c: cl, cRel, rRel };
  }
  function parse_RgceLocRel_BIFF2(blob) {
    var rl = blob.read_shift(2);
    var c = blob.read_shift(1);
    var rRel = (rl & 32768) >> 15, cRel = (rl & 16384) >> 14;
    rl &= 16383;
    if (rRel == 1 && rl >= 8192) rl = rl - 16384;
    if (cRel == 1 && c >= 128) c = c - 256;
    return { r: rl, c, cRel, rRel };
  }
  function parse_PtgArea(blob, length, opts) {
    var type = (blob[blob.l++] & 96) >> 5;
    var area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);
    return [type, area];
  }
  function parse_PtgArea3d(blob, length, opts) {
    var type = (blob[blob.l++] & 96) >> 5;
    var ixti = blob.read_shift(2, "i");
    var w = 8;
    if (opts) switch (opts.biff) {
      case 5:
        blob.l += 12;
        w = 6;
        break;
      case 12:
        w = 12;
        break;
    }
    var area = parse_RgceArea(blob, w, opts);
    return [type, ixti, area];
  }
  function parse_PtgAreaErr(blob, length, opts) {
    var type = (blob[blob.l++] & 96) >> 5;
    blob.l += opts && opts.biff > 8 ? 12 : opts.biff < 8 ? 6 : 8;
    return [type];
  }
  function parse_PtgAreaErr3d(blob, length, opts) {
    var type = (blob[blob.l++] & 96) >> 5;
    var ixti = blob.read_shift(2);
    var w = 8;
    if (opts) switch (opts.biff) {
      case 5:
        blob.l += 12;
        w = 6;
        break;
      case 12:
        w = 12;
        break;
    }
    blob.l += w;
    return [type, ixti];
  }
  function parse_PtgAreaN(blob, length, opts) {
    var type = (blob[blob.l++] & 96) >> 5;
    var area = parse_RgceAreaRel(blob, length - 1, opts);
    return [type, area];
  }
  function parse_PtgArray(blob, length, opts) {
    var type = (blob[blob.l++] & 96) >> 5;
    blob.l += opts.biff == 2 ? 6 : opts.biff == 12 ? 14 : 7;
    return [type];
  }
  function parse_PtgAttrBaxcel(blob) {
    var bitSemi = blob[blob.l + 1] & 1;
    var bitBaxcel = 1;
    blob.l += 4;
    return [bitSemi, bitBaxcel];
  }
  function parse_PtgAttrChoose(blob, length, opts) {
    blob.l += 2;
    var offset = blob.read_shift(opts && opts.biff == 2 ? 1 : 2);
    var o = [];
    for (var i = 0; i <= offset; ++i) o.push(blob.read_shift(opts && opts.biff == 2 ? 1 : 2));
    return o;
  }
  function parse_PtgAttrGoto(blob, length, opts) {
    var bitGoto = blob[blob.l + 1] & 255 ? 1 : 0;
    blob.l += 2;
    return [bitGoto, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)];
  }
  function parse_PtgAttrIf(blob, length, opts) {
    var bitIf = blob[blob.l + 1] & 255 ? 1 : 0;
    blob.l += 2;
    return [bitIf, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)];
  }
  function parse_PtgAttrIfError(blob) {
    var bitIf = blob[blob.l + 1] & 255 ? 1 : 0;
    blob.l += 2;
    return [bitIf, blob.read_shift(2)];
  }
  function parse_PtgAttrSemi(blob, length, opts) {
    var bitSemi = blob[blob.l + 1] & 255 ? 1 : 0;
    blob.l += opts && opts.biff == 2 ? 3 : 4;
    return [bitSemi];
  }
  function parse_PtgAttrSpaceType(blob) {
    var type = blob.read_shift(1), cch = blob.read_shift(1);
    return [type, cch];
  }
  function parse_PtgAttrSpace(blob) {
    blob.read_shift(2);
    return parse_PtgAttrSpaceType(blob, 2);
  }
  function parse_PtgAttrSpaceSemi(blob) {
    blob.read_shift(2);
    return parse_PtgAttrSpaceType(blob, 2);
  }
  function parse_PtgRef(blob, length, opts) {
    var type = (blob[blob.l] & 96) >> 5;
    blob.l += 1;
    var loc = parse_RgceLoc(blob, 0, opts);
    return [type, loc];
  }
  function parse_PtgRefN(blob, length, opts) {
    var type = (blob[blob.l] & 96) >> 5;
    blob.l += 1;
    var loc = parse_RgceLocRel(blob, 0, opts);
    return [type, loc];
  }
  function parse_PtgRef3d(blob, length, opts) {
    var type = (blob[blob.l] & 96) >> 5;
    blob.l += 1;
    var ixti = blob.read_shift(2);
    if (opts && opts.biff == 5) blob.l += 12;
    var loc = parse_RgceLoc(blob, 0, opts);
    return [type, ixti, loc];
  }
  function parse_PtgFunc(blob, length, opts) {
    var type = (blob[blob.l] & 96) >> 5;
    blob.l += 1;
    var iftab = blob.read_shift(opts && opts.biff <= 3 ? 1 : 2);
    return [FtabArgc[iftab], Ftab[iftab], type];
  }
  function parse_PtgFuncVar(blob, length, opts) {
    var type = blob[blob.l++];
    var cparams = blob.read_shift(1), tab = opts && opts.biff <= 3 ? [type == 88 ? -1 : 0, blob.read_shift(1)] : parsetab(blob);
    return [cparams, (tab[0] === 0 ? Ftab : Cetab)[tab[1]]];
  }
  function parsetab(blob) {
    return [blob[blob.l + 1] >> 7, blob.read_shift(2) & 32767];
  }
  function parse_PtgAttrSum(blob, length, opts) {
    blob.l += opts && opts.biff == 2 ? 3 : 4;
    return;
  }
  function parse_PtgExp(blob, length, opts) {
    blob.l++;
    if (opts && opts.biff == 12) return [blob.read_shift(4, "i"), 0];
    var row = blob.read_shift(2);
    var col = blob.read_shift(opts && opts.biff == 2 ? 1 : 2);
    return [row, col];
  }
  function parse_PtgErr(blob) {
    blob.l++;
    return BErr[blob.read_shift(1)];
  }
  function parse_PtgInt(blob) {
    blob.l++;
    return blob.read_shift(2);
  }
  function parse_PtgBool(blob) {
    blob.l++;
    return blob.read_shift(1) !== 0;
  }
  function parse_PtgNum(blob) {
    blob.l++;
    return parse_Xnum(blob, 8);
  }
  function parse_PtgStr(blob, length, opts) {
    blob.l++;
    return parse_ShortXLUnicodeString(blob, length - 1, opts);
  }
  function parse_SerAr(blob, biff) {
    var val = [blob.read_shift(1)];
    if (biff == 12) switch (val[0]) {
      case 2:
        val[0] = 4;
        break;
      /* SerBool */
      case 4:
        val[0] = 16;
        break;
      /* SerErr */
      case 0:
        val[0] = 1;
        break;
      /* SerNum */
      case 1:
        val[0] = 2;
        break;
    }
    switch (val[0]) {
      case 4:
        val[1] = parsebool(blob, 1) ? "TRUE" : "FALSE";
        if (biff != 12) blob.l += 7;
        break;
      case 37:
      /* appears to be an alias */
      case 16:
        val[1] = BErr[blob[blob.l]];
        blob.l += biff == 12 ? 4 : 8;
        break;
      case 0:
        blob.l += 8;
        break;
      case 1:
        val[1] = parse_Xnum(blob, 8);
        break;
      case 2:
        val[1] = parse_XLUnicodeString2(blob, 0, { biff: biff > 0 && biff < 8 ? 2 : biff });
        break;
      default:
        throw new Error("Bad SerAr: " + val[0]);
    }
    return val;
  }
  function parse_PtgExtraMem(blob, cce, opts) {
    var count = blob.read_shift(opts.biff == 12 ? 4 : 2);
    var out = [];
    for (var i = 0; i != count; ++i) out.push((opts.biff == 12 ? parse_UncheckedRfX : parse_Ref8U)(blob, 8));
    return out;
  }
  function parse_PtgExtraArray(blob, length, opts) {
    var rows = 0, cols = 0;
    if (opts.biff == 12) {
      rows = blob.read_shift(4);
      cols = blob.read_shift(4);
    } else {
      cols = 1 + blob.read_shift(1);
      rows = 1 + blob.read_shift(2);
    }
    if (opts.biff >= 2 && opts.biff < 8) {
      --rows;
      if (--cols == 0) cols = 256;
    }
    for (var i = 0, o = []; i != rows && (o[i] = []); ++i)
      for (var j = 0; j != cols; ++j) o[i][j] = parse_SerAr(blob, opts.biff);
    return o;
  }
  function parse_PtgName(blob, length, opts) {
    var type = blob.read_shift(1) >>> 5 & 3;
    var w = !opts || opts.biff >= 8 ? 4 : 2;
    var nameindex = blob.read_shift(w);
    switch (opts.biff) {
      case 2:
        blob.l += 5;
        break;
      case 3:
      case 4:
        blob.l += 8;
        break;
      case 5:
        blob.l += 12;
        break;
    }
    return [type, 0, nameindex];
  }
  function parse_PtgNameX(blob, length, opts) {
    if (opts.biff == 5) return parse_PtgNameX_BIFF5(blob, length, opts);
    var type = blob.read_shift(1) >>> 5 & 3;
    var ixti = blob.read_shift(2);
    var nameindex = blob.read_shift(4);
    return [type, ixti, nameindex];
  }
  function parse_PtgNameX_BIFF5(blob) {
    var type = blob.read_shift(1) >>> 5 & 3;
    var ixti = blob.read_shift(2, "i");
    blob.l += 8;
    var nameindex = blob.read_shift(2);
    blob.l += 12;
    return [type, ixti, nameindex];
  }
  function parse_PtgMemArea(blob, length, opts) {
    var type = blob.read_shift(1) >>> 5 & 3;
    blob.l += opts && opts.biff == 2 ? 3 : 4;
    var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2);
    return [type, cce];
  }
  function parse_PtgMemFunc(blob, length, opts) {
    var type = blob.read_shift(1) >>> 5 & 3;
    var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2);
    return [type, cce];
  }
  function parse_PtgRefErr(blob, length, opts) {
    var type = blob.read_shift(1) >>> 5 & 3;
    blob.l += 4;
    if (opts.biff < 8) blob.l--;
    if (opts.biff == 12) blob.l += 2;
    return [type];
  }
  function parse_PtgRefErr3d(blob, length, opts) {
    var type = (blob[blob.l++] & 96) >> 5;
    var ixti = blob.read_shift(2);
    var w = 4;
    if (opts) switch (opts.biff) {
      case 5:
        w = 15;
        break;
      case 12:
        w = 6;
        break;
    }
    blob.l += w;
    return [type, ixti];
  }
  var parse_PtgMemErr = parsenoop;
  var parse_PtgMemNoMem = parsenoop;
  var parse_PtgTbl = parsenoop;
  function parse_PtgElfLoc(blob, length, opts) {
    blob.l += 2;
    return [parse_RgceElfLoc(blob, 4, opts)];
  }
  function parse_PtgElfNoop(blob) {
    blob.l += 6;
    return [];
  }
  var parse_PtgElfCol = parse_PtgElfLoc;
  var parse_PtgElfColS = parse_PtgElfNoop;
  var parse_PtgElfColSV = parse_PtgElfNoop;
  var parse_PtgElfColV = parse_PtgElfLoc;
  function parse_PtgElfLel(blob) {
    blob.l += 2;
    return [parseuint16(blob), blob.read_shift(2) & 1];
  }
  var parse_PtgElfRadical = parse_PtgElfLoc;
  var parse_PtgElfRadicalLel = parse_PtgElfLel;
  var parse_PtgElfRadicalS = parse_PtgElfNoop;
  var parse_PtgElfRw = parse_PtgElfLoc;
  var parse_PtgElfRwV = parse_PtgElfLoc;
  var PtgListRT = [
    "Data",
    "All",
    "Headers",
    "??",
    "?Data2",
    "??",
    "?DataHeaders",
    "??",
    "Totals",
    "??",
    "??",
    "??",
    "?DataTotals",
    "??",
    "??",
    "??",
    "?Current"
  ];
  function parse_PtgList(blob) {
    blob.l += 2;
    var ixti = blob.read_shift(2);
    var flags = blob.read_shift(2);
    var idx = blob.read_shift(4);
    var c = blob.read_shift(2);
    var C = blob.read_shift(2);
    var rt = PtgListRT[flags >> 2 & 31];
    return { ixti, coltype: flags & 3, rt, idx, c, C };
  }
  function parse_PtgSxName(blob) {
    blob.l += 2;
    return [blob.read_shift(4)];
  }
  function parse_PtgSheet(blob, length, opts) {
    blob.l += 5;
    blob.l += 2;
    blob.l += opts.biff == 2 ? 1 : 4;
    return ["PTGSHEET"];
  }
  function parse_PtgEndSheet(blob, length, opts) {
    blob.l += opts.biff == 2 ? 4 : 5;
    return ["PTGENDSHEET"];
  }
  function parse_PtgMemAreaN(blob) {
    var type = blob.read_shift(1) >>> 5 & 3;
    var cce = blob.read_shift(2);
    return [type, cce];
  }
  function parse_PtgMemNoMemN(blob) {
    var type = blob.read_shift(1) >>> 5 & 3;
    var cce = blob.read_shift(2);
    return [type, cce];
  }
  function parse_PtgAttrNoop(blob) {
    blob.l += 4;
    return [0, 0];
  }
  var PtgTypes = {
    /*::[*/
    1: { n: "PtgExp", f: parse_PtgExp },
    /*::[*/
    2: { n: "PtgTbl", f: parse_PtgTbl },
    /*::[*/
    3: { n: "PtgAdd", f: parseread1 },
    /*::[*/
    4: { n: "PtgSub", f: parseread1 },
    /*::[*/
    5: { n: "PtgMul", f: parseread1 },
    /*::[*/
    6: { n: "PtgDiv", f: parseread1 },
    /*::[*/
    7: { n: "PtgPower", f: parseread1 },
    /*::[*/
    8: { n: "PtgConcat", f: parseread1 },
    /*::[*/
    9: { n: "PtgLt", f: parseread1 },
    /*::[*/
    10: { n: "PtgLe", f: parseread1 },
    /*::[*/
    11: { n: "PtgEq", f: parseread1 },
    /*::[*/
    12: { n: "PtgGe", f: parseread1 },
    /*::[*/
    13: { n: "PtgGt", f: parseread1 },
    /*::[*/
    14: { n: "PtgNe", f: parseread1 },
    /*::[*/
    15: { n: "PtgIsect", f: parseread1 },
    /*::[*/
    16: { n: "PtgUnion", f: parseread1 },
    /*::[*/
    17: { n: "PtgRange", f: parseread1 },
    /*::[*/
    18: { n: "PtgUplus", f: parseread1 },
    /*::[*/
    19: { n: "PtgUminus", f: parseread1 },
    /*::[*/
    20: { n: "PtgPercent", f: parseread1 },
    /*::[*/
    21: { n: "PtgParen", f: parseread1 },
    /*::[*/
    22: { n: "PtgMissArg", f: parseread1 },
    /*::[*/
    23: { n: "PtgStr", f: parse_PtgStr },
    /*::[*/
    26: { n: "PtgSheet", f: parse_PtgSheet },
    /*::[*/
    27: { n: "PtgEndSheet", f: parse_PtgEndSheet },
    /*::[*/
    28: { n: "PtgErr", f: parse_PtgErr },
    /*::[*/
    29: { n: "PtgBool", f: parse_PtgBool },
    /*::[*/
    30: { n: "PtgInt", f: parse_PtgInt },
    /*::[*/
    31: { n: "PtgNum", f: parse_PtgNum },
    /*::[*/
    32: { n: "PtgArray", f: parse_PtgArray },
    /*::[*/
    33: { n: "PtgFunc", f: parse_PtgFunc },
    /*::[*/
    34: { n: "PtgFuncVar", f: parse_PtgFuncVar },
    /*::[*/
    35: { n: "PtgName", f: parse_PtgName },
    /*::[*/
    36: { n: "PtgRef", f: parse_PtgRef },
    /*::[*/
    37: { n: "PtgArea", f: parse_PtgArea },
    /*::[*/
    38: { n: "PtgMemArea", f: parse_PtgMemArea },
    /*::[*/
    39: { n: "PtgMemErr", f: parse_PtgMemErr },
    /*::[*/
    40: { n: "PtgMemNoMem", f: parse_PtgMemNoMem },
    /*::[*/
    41: { n: "PtgMemFunc", f: parse_PtgMemFunc },
    /*::[*/
    42: { n: "PtgRefErr", f: parse_PtgRefErr },
    /*::[*/
    43: { n: "PtgAreaErr", f: parse_PtgAreaErr },
    /*::[*/
    44: { n: "PtgRefN", f: parse_PtgRefN },
    /*::[*/
    45: { n: "PtgAreaN", f: parse_PtgAreaN },
    /*::[*/
    46: { n: "PtgMemAreaN", f: parse_PtgMemAreaN },
    /*::[*/
    47: { n: "PtgMemNoMemN", f: parse_PtgMemNoMemN },
    /*::[*/
    57: { n: "PtgNameX", f: parse_PtgNameX },
    /*::[*/
    58: { n: "PtgRef3d", f: parse_PtgRef3d },
    /*::[*/
    59: { n: "PtgArea3d", f: parse_PtgArea3d },
    /*::[*/
    60: { n: "PtgRefErr3d", f: parse_PtgRefErr3d },
    /*::[*/
    61: { n: "PtgAreaErr3d", f: parse_PtgAreaErr3d },
    /*::[*/
    255: {}
  };
  var PtgDupes = {
    /*::[*/
    64: 32,
    /*::[*/
    96: 32,
    /*::[*/
    65: 33,
    /*::[*/
    97: 33,
    /*::[*/
    66: 34,
    /*::[*/
    98: 34,
    /*::[*/
    67: 35,
    /*::[*/
    99: 35,
    /*::[*/
    68: 36,
    /*::[*/
    100: 36,
    /*::[*/
    69: 37,
    /*::[*/
    101: 37,
    /*::[*/
    70: 38,
    /*::[*/
    102: 38,
    /*::[*/
    71: 39,
    /*::[*/
    103: 39,
    /*::[*/
    72: 40,
    /*::[*/
    104: 40,
    /*::[*/
    73: 41,
    /*::[*/
    105: 41,
    /*::[*/
    74: 42,
    /*::[*/
    106: 42,
    /*::[*/
    75: 43,
    /*::[*/
    107: 43,
    /*::[*/
    76: 44,
    /*::[*/
    108: 44,
    /*::[*/
    77: 45,
    /*::[*/
    109: 45,
    /*::[*/
    78: 46,
    /*::[*/
    110: 46,
    /*::[*/
    79: 47,
    /*::[*/
    111: 47,
    /*::[*/
    88: 34,
    /*::[*/
    120: 34,
    /*::[*/
    89: 57,
    /*::[*/
    121: 57,
    /*::[*/
    90: 58,
    /*::[*/
    122: 58,
    /*::[*/
    91: 59,
    /*::[*/
    123: 59,
    /*::[*/
    92: 60,
    /*::[*/
    124: 60,
    /*::[*/
    93: 61,
    /*::[*/
    125: 61
  };
  var Ptg18 = {
    /*::[*/
    1: { n: "PtgElfLel", f: parse_PtgElfLel },
    /*::[*/
    2: { n: "PtgElfRw", f: parse_PtgElfRw },
    /*::[*/
    3: { n: "PtgElfCol", f: parse_PtgElfCol },
    /*::[*/
    6: { n: "PtgElfRwV", f: parse_PtgElfRwV },
    /*::[*/
    7: { n: "PtgElfColV", f: parse_PtgElfColV },
    /*::[*/
    10: { n: "PtgElfRadical", f: parse_PtgElfRadical },
    /*::[*/
    11: { n: "PtgElfRadicalS", f: parse_PtgElfRadicalS },
    /*::[*/
    13: { n: "PtgElfColS", f: parse_PtgElfColS },
    /*::[*/
    15: { n: "PtgElfColSV", f: parse_PtgElfColSV },
    /*::[*/
    16: { n: "PtgElfRadicalLel", f: parse_PtgElfRadicalLel },
    /*::[*/
    25: { n: "PtgList", f: parse_PtgList },
    /*::[*/
    29: { n: "PtgSxName", f: parse_PtgSxName },
    /*::[*/
    255: {}
  };
  var Ptg19 = {
    /*::[*/
    0: { n: "PtgAttrNoop", f: parse_PtgAttrNoop },
    /*::[*/
    1: { n: "PtgAttrSemi", f: parse_PtgAttrSemi },
    /*::[*/
    2: { n: "PtgAttrIf", f: parse_PtgAttrIf },
    /*::[*/
    4: { n: "PtgAttrChoose", f: parse_PtgAttrChoose },
    /*::[*/
    8: { n: "PtgAttrGoto", f: parse_PtgAttrGoto },
    /*::[*/
    16: { n: "PtgAttrSum", f: parse_PtgAttrSum },
    /*::[*/
    32: { n: "PtgAttrBaxcel", f: parse_PtgAttrBaxcel },
    /*::[*/
    33: { n: "PtgAttrBaxcel", f: parse_PtgAttrBaxcel },
    /*::[*/
    64: { n: "PtgAttrSpace", f: parse_PtgAttrSpace },
    /*::[*/
    65: { n: "PtgAttrSpaceSemi", f: parse_PtgAttrSpaceSemi },
    /*::[*/
    128: { n: "PtgAttrIfError", f: parse_PtgAttrIfError },
    /*::[*/
    255: {}
  };
  function parse_RgbExtra(blob, length, rgce, opts) {
    if (opts.biff < 8) return parsenoop(blob, length);
    var target = blob.l + length;
    var o = [];
    for (var i = 0; i !== rgce.length; ++i) {
      switch (rgce[i][0]) {
        case "PtgArray":
          rgce[i][1] = parse_PtgExtraArray(blob, 0, opts);
          o.push(rgce[i][1]);
          break;
        case "PtgMemArea":
          rgce[i][2] = parse_PtgExtraMem(blob, rgce[i][1], opts);
          o.push(rgce[i][2]);
          break;
        case "PtgExp":
          if (opts && opts.biff == 12) {
            rgce[i][1][1] = blob.read_shift(4);
            o.push(rgce[i][1]);
          }
          break;
        case "PtgList":
        /* TODO: PtgList -> PtgExtraList */
        case "PtgElfRadicalS":
        /* TODO: PtgElfRadicalS -> PtgExtraElf */
        case "PtgElfColS":
        /* TODO: PtgElfColS -> PtgExtraElf */
        case "PtgElfColSV":
          throw "Unsupported " + rgce[i][0];
        default:
          break;
      }
    }
    length = target - blob.l;
    if (length !== 0) o.push(parsenoop(blob, length));
    return o;
  }
  function parse_Rgce(blob, length, opts) {
    var target = blob.l + length;
    var R, id, ptgs = [];
    while (target != blob.l) {
      length = target - blob.l;
      id = blob[blob.l];
      R = PtgTypes[id] || PtgTypes[PtgDupes[id]];
      if (id === 24 || id === 25) R = (id === 24 ? Ptg18 : Ptg19)[blob[blob.l + 1]];
      if (!R || !R.f) {
        parsenoop(blob, length);
      } else {
        ptgs.push([R.n, R.f(blob, length, opts)]);
      }
    }
    return ptgs;
  }
  function stringify_array(f) {
    var o = [];
    for (var i = 0; i < f.length; ++i) {
      var x = f[i], r = [];
      for (var j = 0; j < x.length; ++j) {
        var y = x[j];
        if (y) switch (y[0]) {
          // TODO: handle embedded quotes
          case 2:
            r.push('"' + y[1].replace(/"/g, '""') + '"');
            break;
          default:
            r.push(y[1]);
        }
        else r.push("");
      }
      o.push(r.join(","));
    }
    return o.join(";");
  }
  var PtgBinOp = {
    PtgAdd: "+",
    PtgConcat: "&",
    PtgDiv: "/",
    PtgEq: "=",
    PtgGe: ">=",
    PtgGt: ">",
    PtgLe: "<=",
    PtgLt: "<",
    PtgMul: "*",
    PtgNe: "<>",
    PtgPower: "^",
    PtgSub: "-"
  };
  function formula_quote_sheet_name(sname, opts) {
    if (!sname && !(opts && opts.biff <= 5 && opts.biff >= 2)) throw new Error("empty sheet name");
    if (/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(sname)) return "'" + sname + "'";
    return sname;
  }
  function get_ixti_raw(supbooks, ixti, opts) {
    if (!supbooks) return "SH33TJSERR0";
    if (opts.biff > 8 && (!supbooks.XTI || !supbooks.XTI[ixti])) return supbooks.SheetNames[ixti];
    if (!supbooks.XTI) return "SH33TJSERR6";
    var XTI = supbooks.XTI[ixti];
    if (opts.biff < 8) {
      if (ixti > 1e4) ixti -= 65536;
      if (ixti < 0) ixti = -ixti;
      return ixti == 0 ? "" : supbooks.XTI[ixti - 1];
    }
    if (!XTI) return "SH33TJSERR1";
    var o = "";
    if (opts.biff > 8) switch (supbooks[XTI[0]][0]) {
      case 357:
        o = XTI[1] == -1 ? "#REF" : supbooks.SheetNames[XTI[1]];
        return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]];
      case 358:
        if (opts.SID != null) return supbooks.SheetNames[opts.SID];
        return "SH33TJSSAME" + supbooks[XTI[0]][0];
      case 355:
      /* 'BrtSupBookSrc' */
      /* falls through */
      default:
        return "SH33TJSSRC" + supbooks[XTI[0]][0];
    }
    switch (supbooks[XTI[0]][0][0]) {
      case 1025:
        o = XTI[1] == -1 ? "#REF" : supbooks.SheetNames[XTI[1]] || "SH33TJSERR3";
        return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]];
      case 14849:
        return supbooks[XTI[0]].slice(1).map(function(name) {
          return name.Name;
        }).join(";;");
      //return "SH33TJSERR8";
      default:
        if (!supbooks[XTI[0]][0][3]) return "SH33TJSERR2";
        o = XTI[1] == -1 ? "#REF" : supbooks[XTI[0]][0][3][XTI[1]] || "SH33TJSERR4";
        return XTI[1] == XTI[2] ? o : o + ":" + supbooks[XTI[0]][0][3][XTI[2]];
    }
  }
  function get_ixti(supbooks, ixti, opts) {
    var ixtiraw = get_ixti_raw(supbooks, ixti, opts);
    return ixtiraw == "#REF" ? ixtiraw : formula_quote_sheet_name(ixtiraw, opts);
  }
  function stringify_formula(formula, range2, cell, supbooks, opts) {
    var biff = opts && opts.biff || 8;
    var _range = (
      /*range != null ? range :*/
      { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } }
    );
    var stack = [], e1, e2, c, ixti = 0, nameidx = 0, r, sname = "";
    if (!formula[0] || !formula[0][0]) return "";
    var last_sp = -1, sp = "";
    for (var ff = 0, fflen = formula[0].length; ff < fflen; ++ff) {
      var f = formula[0][ff];
      switch (f[0]) {
        case "PtgUminus":
          stack.push("-" + stack.pop());
          break;
        case "PtgUplus":
          stack.push("+" + stack.pop());
          break;
        case "PtgPercent":
          stack.push(stack.pop() + "%");
          break;
        case "PtgAdd":
        /* [MS-XLS] 2.5.198.26 */
        case "PtgConcat":
        /* [MS-XLS] 2.5.198.43 */
        case "PtgDiv":
        /* [MS-XLS] 2.5.198.45 */
        case "PtgEq":
        /* [MS-XLS] 2.5.198.56 */
        case "PtgGe":
        /* [MS-XLS] 2.5.198.64 */
        case "PtgGt":
        /* [MS-XLS] 2.5.198.65 */
        case "PtgLe":
        /* [MS-XLS] 2.5.198.68 */
        case "PtgLt":
        /* [MS-XLS] 2.5.198.69 */
        case "PtgMul":
        /* [MS-XLS] 2.5.198.75 */
        case "PtgNe":
        /* [MS-XLS] 2.5.198.78 */
        case "PtgPower":
        /* [MS-XLS] 2.5.198.82 */
        case "PtgSub":
          e1 = stack.pop();
          e2 = stack.pop();
          if (last_sp >= 0) {
            switch (formula[0][last_sp][1][0]) {
              case 0:
                sp = fill(" ", formula[0][last_sp][1][1]);
                break;
              case 1:
                sp = fill("\r", formula[0][last_sp][1][1]);
                break;
              default:
                sp = "";
                if (opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]);
            }
            e2 = e2 + sp;
            last_sp = -1;
          }
          stack.push(e2 + PtgBinOp[f[0]] + e1);
          break;
        case "PtgIsect":
          e1 = stack.pop();
          e2 = stack.pop();
          stack.push(e2 + " " + e1);
          break;
        case "PtgUnion":
          e1 = stack.pop();
          e2 = stack.pop();
          stack.push(e2 + "," + e1);
          break;
        case "PtgRange":
          e1 = stack.pop();
          e2 = stack.pop();
          stack.push(e2 + ":" + e1);
          break;
        case "PtgAttrChoose":
          break;
        case "PtgAttrGoto":
          break;
        case "PtgAttrIf":
          break;
        case "PtgAttrIfError":
          break;
        case "PtgRef":
          c = shift_cell_xls(f[1][1], _range, opts);
          stack.push(encode_cell_xls(c, biff));
          break;
        case "PtgRefN":
          c = cell ? shift_cell_xls(f[1][1], cell, opts) : f[1][1];
          stack.push(encode_cell_xls(c, biff));
          break;
        case "PtgRef3d":
          ixti = /*::Number(*/
          f[1][1];
          c = shift_cell_xls(f[1][2], _range, opts);
          sname = get_ixti(supbooks, ixti, opts);
          var w = sname;
          stack.push(sname + "!" + encode_cell_xls(c, biff));
          break;
        case "PtgFunc":
        /* [MS-XLS] 2.5.198.62 */
        case "PtgFuncVar":
          var argc = f[1][0], func = f[1][1];
          if (!argc) argc = 0;
          argc &= 127;
          var args = argc == 0 ? [] : stack.slice(-argc);
          stack.length -= argc;
          if (func === "User") func = args.shift();
          stack.push(func + "(" + args.join(",") + ")");
          break;
        case "PtgBool":
          stack.push(f[1] ? "TRUE" : "FALSE");
          break;
        case "PtgInt":
          stack.push(
            /*::String(*/
            f[1]
            /*::)*/
          );
          break;
        case "PtgNum":
          stack.push(String(f[1]));
          break;
        case "PtgStr":
          stack.push('"' + f[1].replace(/"/g, '""') + '"');
          break;
        case "PtgErr":
          stack.push(
            /*::String(*/
            f[1]
            /*::)*/
          );
          break;
        case "PtgAreaN":
          r = shift_range_xls(f[1][1], cell ? { s: cell } : _range, opts);
          stack.push(encode_range_xls(r, opts));
          break;
        case "PtgArea":
          r = shift_range_xls(f[1][1], _range, opts);
          stack.push(encode_range_xls(r, opts));
          break;
        case "PtgArea3d":
          ixti = /*::Number(*/
          f[1][1];
          r = f[1][2];
          sname = get_ixti(supbooks, ixti, opts);
          stack.push(sname + "!" + encode_range_xls(r, opts));
          break;
        case "PtgAttrSum":
          stack.push("SUM(" + stack.pop() + ")");
          break;
        case "PtgAttrBaxcel":
        /* [MS-XLS] 2.5.198.33 */
        case "PtgAttrSemi":
          break;
        case "PtgName":
          nameidx = f[1][2];
          var lbl = (supbooks.names || [])[nameidx - 1] || (supbooks[0] || [])[nameidx];
          var name = lbl ? lbl.Name : "SH33TJSNAME" + String(nameidx);
          if (name && name.slice(0, 6) == "_xlfn." && !opts.xlfn) name = name.slice(6);
          stack.push(name);
          break;
        case "PtgNameX":
          var bookidx = f[1][1];
          nameidx = f[1][2];
          var externbook;
          if (opts.biff <= 5) {
            if (bookidx < 0) bookidx = -bookidx;
            if (supbooks[bookidx]) externbook = supbooks[bookidx][nameidx];
          } else {
            var o = "";
            if (((supbooks[bookidx] || [])[0] || [])[0] == 14849) {
            } else if (((supbooks[bookidx] || [])[0] || [])[0] == 1025) {
              if (supbooks[bookidx][nameidx] && supbooks[bookidx][nameidx].itab > 0) {
                o = supbooks.SheetNames[supbooks[bookidx][nameidx].itab - 1] + "!";
              }
            } else o = supbooks.SheetNames[nameidx - 1] + "!";
            if (supbooks[bookidx] && supbooks[bookidx][nameidx]) o += supbooks[bookidx][nameidx].Name;
            else if (supbooks[0] && supbooks[0][nameidx]) o += supbooks[0][nameidx].Name;
            else {
              var ixtidata = (get_ixti_raw(supbooks, bookidx, opts) || "").split(";;");
              if (ixtidata[nameidx - 1]) o = ixtidata[nameidx - 1];
              else o += "SH33TJSERRX";
            }
            stack.push(o);
            break;
          }
          if (!externbook) externbook = { Name: "SH33TJSERRY" };
          stack.push(externbook.Name);
          break;
        case "PtgParen":
          var lp = "(", rp = ")";
          if (last_sp >= 0) {
            sp = "";
            switch (formula[0][last_sp][1][0]) {
              // $FlowIgnore
              case 2:
                lp = fill(" ", formula[0][last_sp][1][1]) + lp;
                break;
              // $FlowIgnore
              case 3:
                lp = fill("\r", formula[0][last_sp][1][1]) + lp;
                break;
              // $FlowIgnore
              case 4:
                rp = fill(" ", formula[0][last_sp][1][1]) + rp;
                break;
              // $FlowIgnore
              case 5:
                rp = fill("\r", formula[0][last_sp][1][1]) + rp;
                break;
              default:
                if (opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]);
            }
            last_sp = -1;
          }
          stack.push(lp + stack.pop() + rp);
          break;
        case "PtgRefErr":
          stack.push("#REF!");
          break;
        case "PtgRefErr3d":
          stack.push("#REF!");
          break;
        case "PtgExp":
          c = { c: f[1][1], r: f[1][0] };
          var q = { c: cell.c, r: cell.r };
          if (supbooks.sharedf[encode_cell(c)]) {
            var parsedf = supbooks.sharedf[encode_cell(c)];
            stack.push(stringify_formula(parsedf, _range, q, supbooks, opts));
          } else {
            var fnd = false;
            for (e1 = 0; e1 != supbooks.arrayf.length; ++e1) {
              e2 = supbooks.arrayf[e1];
              if (c.c < e2[0].s.c || c.c > e2[0].e.c) continue;
              if (c.r < e2[0].s.r || c.r > e2[0].e.r) continue;
              stack.push(stringify_formula(e2[1], _range, q, supbooks, opts));
              fnd = true;
              break;
            }
            if (!fnd) stack.push(
              /*::String(*/
              f[1]
              /*::)*/
            );
          }
          break;
        case "PtgArray":
          stack.push("{" + stringify_array(
            /*::(*/
            f[1]
            /*:: :any)*/
          ) + "}");
          break;
        case "PtgMemArea":
          break;
        case "PtgAttrSpace":
        /* [MS-XLS] 2.5.198.38 */
        case "PtgAttrSpaceSemi":
          last_sp = ff;
          break;
        case "PtgTbl":
          break;
        case "PtgMemErr":
          break;
        case "PtgMissArg":
          stack.push("");
          break;
        case "PtgAreaErr":
          stack.push("#REF!");
          break;
        case "PtgAreaErr3d":
          stack.push("#REF!");
          break;
        case "PtgList":
          stack.push("Table" + f[1].idx + "[#" + f[1].rt + "]");
          break;
        case "PtgMemAreaN":
        case "PtgMemNoMemN":
        case "PtgAttrNoop":
        case "PtgSheet":
        case "PtgEndSheet":
          break;
        case "PtgMemFunc":
          break;
        case "PtgMemNoMem":
          break;
        case "PtgElfCol":
        /* [MS-XLS] 2.5.198.46 */
        case "PtgElfColS":
        /* [MS-XLS] 2.5.198.47 */
        case "PtgElfColSV":
        /* [MS-XLS] 2.5.198.48 */
        case "PtgElfColV":
        /* [MS-XLS] 2.5.198.49 */
        case "PtgElfLel":
        /* [MS-XLS] 2.5.198.50 */
        case "PtgElfRadical":
        /* [MS-XLS] 2.5.198.51 */
        case "PtgElfRadicalLel":
        /* [MS-XLS] 2.5.198.52 */
        case "PtgElfRadicalS":
        /* [MS-XLS] 2.5.198.53 */
        case "PtgElfRw":
        /* [MS-XLS] 2.5.198.54 */
        case "PtgElfRwV":
          throw new Error("Unsupported ELFs");
        case "PtgSxName":
          throw new Error("Unrecognized Formula Token: " + String(f));
        default:
          throw new Error("Unrecognized Formula Token: " + String(f));
      }
      var PtgNonDisp = ["PtgAttrSpace", "PtgAttrSpaceSemi", "PtgAttrGoto"];
      if (opts.biff != 3) {
        if (last_sp >= 0 && PtgNonDisp.indexOf(formula[0][ff][0]) == -1) {
          f = formula[0][last_sp];
          var _left = true;
          switch (f[1][0]) {
            /* note: some bad XLSB files omit the PtgParen */
            case 4:
              _left = false;
            /* falls through */
            case 0:
              sp = fill(" ", f[1][1]);
              break;
            case 5:
              _left = false;
            /* falls through */
            case 1:
              sp = fill("\r", f[1][1]);
              break;
            default:
              sp = "";
              if (opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + f[1][0]);
          }
          stack.push((_left ? sp : "") + stack.pop() + (_left ? "" : sp));
          last_sp = -1;
        }
      }
    }
    if (stack.length > 1 && opts.WTF) throw new Error("bad formula stack");
    return stack[0];
  }
  function parse_ArrayParsedFormula(blob, length, opts) {
    var target = blob.l + length, len = opts.biff == 2 ? 1 : 2;
    var rgcb, cce = blob.read_shift(len);
    if (cce == 65535) return [[], parsenoop(blob, length - 2)];
    var rgce = parse_Rgce(blob, cce, opts);
    if (length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts);
    blob.l = target;
    return [rgce, rgcb];
  }
  function parse_XLSCellParsedFormula(blob, length, opts) {
    var target = blob.l + length, len = opts.biff == 2 ? 1 : 2;
    var rgcb, cce = blob.read_shift(len);
    if (cce == 65535) return [[], parsenoop(blob, length - 2)];
    var rgce = parse_Rgce(blob, cce, opts);
    if (length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts);
    blob.l = target;
    return [rgce, rgcb];
  }
  function parse_NameParsedFormula(blob, length, opts, cce) {
    var target = blob.l + length;
    var rgce = parse_Rgce(blob, cce, opts);
    var rgcb;
    if (target !== blob.l) rgcb = parse_RgbExtra(blob, target - blob.l, rgce, opts);
    return [rgce, rgcb];
  }
  function parse_SharedParsedFormula(blob, length, opts) {
    var target = blob.l + length;
    var rgcb, cce = blob.read_shift(2);
    var rgce = parse_Rgce(blob, cce, opts);
    if (cce == 65535) return [[], parsenoop(blob, length - 2)];
    if (length !== cce + 2) rgcb = parse_RgbExtra(blob, target - cce - 2, rgce, opts);
    return [rgce, rgcb];
  }
  function parse_FormulaValue(blob) {
    var b;
    if (__readUInt16LE(blob, blob.l + 6) !== 65535) return [parse_Xnum(blob), "n"];
    switch (blob[blob.l]) {
      case 0:
        blob.l += 8;
        return ["String", "s"];
      case 1:
        b = blob[blob.l + 2] === 1;
        blob.l += 8;
        return [b, "b"];
      case 2:
        b = blob[blob.l + 2];
        blob.l += 8;
        return [b, "e"];
      case 3:
        blob.l += 8;
        return ["", "s"];
    }
    return [];
  }
  function parse_Formula(blob, length, opts) {
    var end = blob.l + length;
    var cell = parse_XLSCell(blob, 6);
    if (opts.biff == 2) ++blob.l;
    var val = parse_FormulaValue(blob, 8);
    var flags = blob.read_shift(1);
    if (opts.biff != 2) {
      blob.read_shift(1);
      if (opts.biff >= 5) {
        blob.read_shift(4);
      }
    }
    var cbf = parse_XLSCellParsedFormula(blob, end - blob.l, opts);
    return { cell, val: val[0], formula: cbf, shared: flags >> 3 & 1, tt: val[1] };
  }
  function parse_XLSBParsedFormula(data, length, opts) {
    var cce = data.read_shift(4);
    var rgce = parse_Rgce(data, cce, opts);
    var cb2 = data.read_shift(4);
    var rgcb = cb2 > 0 ? parse_RgbExtra(data, cb2, rgce, opts) : null;
    return [rgce, rgcb];
  }
  var parse_XLSBArrayParsedFormula = parse_XLSBParsedFormula;
  var parse_XLSBCellParsedFormula = parse_XLSBParsedFormula;
  var parse_XLSBNameParsedFormula = parse_XLSBParsedFormula;
  var parse_XLSBSharedParsedFormula = parse_XLSBParsedFormula;
  var Cetab = {
    0: "BEEP",
    1: "OPEN",
    2: "OPEN.LINKS",
    3: "CLOSE.ALL",
    4: "SAVE",
    5: "SAVE.AS",
    6: "FILE.DELETE",
    7: "PAGE.SETUP",
    8: "PRINT",
    9: "PRINTER.SETUP",
    10: "QUIT",
    11: "NEW.WINDOW",
    12: "ARRANGE.ALL",
    13: "WINDOW.SIZE",
    14: "WINDOW.MOVE",
    15: "FULL",
    16: "CLOSE",
    17: "RUN",
    22: "SET.PRINT.AREA",
    23: "SET.PRINT.TITLES",
    24: "SET.PAGE.BREAK",
    25: "REMOVE.PAGE.BREAK",
    26: "FONT",
    27: "DISPLAY",
    28: "PROTECT.DOCUMENT",
    29: "PRECISION",
    30: "A1.R1C1",
    31: "CALCULATE.NOW",
    32: "CALCULATION",
    34: "DATA.FIND",
    35: "EXTRACT",
    36: "DATA.DELETE",
    37: "SET.DATABASE",
    38: "SET.CRITERIA",
    39: "SORT",
    40: "DATA.SERIES",
    41: "TABLE",
    42: "FORMAT.NUMBER",
    43: "ALIGNMENT",
    44: "STYLE",
    45: "BORDER",
    46: "CELL.PROTECTION",
    47: "COLUMN.WIDTH",
    48: "UNDO",
    49: "CUT",
    50: "COPY",
    51: "PASTE",
    52: "CLEAR",
    53: "PASTE.SPECIAL",
    54: "EDIT.DELETE",
    55: "INSERT",
    56: "FILL.RIGHT",
    57: "FILL.DOWN",
    61: "DEFINE.NAME",
    62: "CREATE.NAMES",
    63: "FORMULA.GOTO",
    64: "FORMULA.FIND",
    65: "SELECT.LAST.CELL",
    66: "SHOW.ACTIVE.CELL",
    67: "GALLERY.AREA",
    68: "GALLERY.BAR",
    69: "GALLERY.COLUMN",
    70: "GALLERY.LINE",
    71: "GALLERY.PIE",
    72: "GALLERY.SCATTER",
    73: "COMBINATION",
    74: "PREFERRED",
    75: "ADD.OVERLAY",
    76: "GRIDLINES",
    77: "SET.PREFERRED",
    78: "AXES",
    79: "LEGEND",
    80: "ATTACH.TEXT",
    81: "ADD.ARROW",
    82: "SELECT.CHART",
    83: "SELECT.PLOT.AREA",
    84: "PATTERNS",
    85: "MAIN.CHART",
    86: "OVERLAY",
    87: "SCALE",
    88: "FORMAT.LEGEND",
    89: "FORMAT.TEXT",
    90: "EDIT.REPEAT",
    91: "PARSE",
    92: "JUSTIFY",
    93: "HIDE",
    94: "UNHIDE",
    95: "WORKSPACE",
    96: "FORMULA",
    97: "FORMULA.FILL",
    98: "FORMULA.ARRAY",
    99: "DATA.FIND.NEXT",
    100: "DATA.FIND.PREV",
    101: "FORMULA.FIND.NEXT",
    102: "FORMULA.FIND.PREV",
    103: "ACTIVATE",
    104: "ACTIVATE.NEXT",
    105: "ACTIVATE.PREV",
    106: "UNLOCKED.NEXT",
    107: "UNLOCKED.PREV",
    108: "COPY.PICTURE",
    109: "SELECT",
    110: "DELETE.NAME",
    111: "DELETE.FORMAT",
    112: "VLINE",
    113: "HLINE",
    114: "VPAGE",
    115: "HPAGE",
    116: "VSCROLL",
    117: "HSCROLL",
    118: "ALERT",
    119: "NEW",
    120: "CANCEL.COPY",
    121: "SHOW.CLIPBOARD",
    122: "MESSAGE",
    124: "PASTE.LINK",
    125: "APP.ACTIVATE",
    126: "DELETE.ARROW",
    127: "ROW.HEIGHT",
    128: "FORMAT.MOVE",
    129: "FORMAT.SIZE",
    130: "FORMULA.REPLACE",
    131: "SEND.KEYS",
    132: "SELECT.SPECIAL",
    133: "APPLY.NAMES",
    134: "REPLACE.FONT",
    135: "FREEZE.PANES",
    136: "SHOW.INFO",
    137: "SPLIT",
    138: "ON.WINDOW",
    139: "ON.DATA",
    140: "DISABLE.INPUT",
    142: "OUTLINE",
    143: "LIST.NAMES",
    144: "FILE.CLOSE",
    145: "SAVE.WORKBOOK",
    146: "DATA.FORM",
    147: "COPY.CHART",
    148: "ON.TIME",
    149: "WAIT",
    150: "FORMAT.FONT",
    151: "FILL.UP",
    152: "FILL.LEFT",
    153: "DELETE.OVERLAY",
    155: "SHORT.MENUS",
    159: "SET.UPDATE.STATUS",
    161: "COLOR.PALETTE",
    162: "DELETE.STYLE",
    163: "WINDOW.RESTORE",
    164: "WINDOW.MAXIMIZE",
    166: "CHANGE.LINK",
    167: "CALCULATE.DOCUMENT",
    168: "ON.KEY",
    169: "APP.RESTORE",
    170: "APP.MOVE",
    171: "APP.SIZE",
    172: "APP.MINIMIZE",
    173: "APP.MAXIMIZE",
    174: "BRING.TO.FRONT",
    175: "SEND.TO.BACK",
    185: "MAIN.CHART.TYPE",
    186: "OVERLAY.CHART.TYPE",
    187: "SELECT.END",
    188: "OPEN.MAIL",
    189: "SEND.MAIL",
    190: "STANDARD.FONT",
    191: "CONSOLIDATE",
    192: "SORT.SPECIAL",
    193: "GALLERY.3D.AREA",
    194: "GALLERY.3D.COLUMN",
    195: "GALLERY.3D.LINE",
    196: "GALLERY.3D.PIE",
    197: "VIEW.3D",
    198: "GOAL.SEEK",
    199: "WORKGROUP",
    200: "FILL.GROUP",
    201: "UPDATE.LINK",
    202: "PROMOTE",
    203: "DEMOTE",
    204: "SHOW.DETAIL",
    206: "UNGROUP",
    207: "OBJECT.PROPERTIES",
    208: "SAVE.NEW.OBJECT",
    209: "SHARE",
    210: "SHARE.NAME",
    211: "DUPLICATE",
    212: "APPLY.STYLE",
    213: "ASSIGN.TO.OBJECT",
    214: "OBJECT.PROTECTION",
    215: "HIDE.OBJECT",
    216: "SET.EXTRACT",
    217: "CREATE.PUBLISHER",
    218: "SUBSCRIBE.TO",
    219: "ATTRIBUTES",
    220: "SHOW.TOOLBAR",
    222: "PRINT.PREVIEW",
    223: "EDIT.COLOR",
    224: "SHOW.LEVELS",
    225: "FORMAT.MAIN",
    226: "FORMAT.OVERLAY",
    227: "ON.RECALC",
    228: "EDIT.SERIES",
    229: "DEFINE.STYLE",
    240: "LINE.PRINT",
    243: "ENTER.DATA",
    249: "GALLERY.RADAR",
    250: "MERGE.STYLES",
    251: "EDITION.OPTIONS",
    252: "PASTE.PICTURE",
    253: "PASTE.PICTURE.LINK",
    254: "SPELLING",
    256: "ZOOM",
    259: "INSERT.OBJECT",
    260: "WINDOW.MINIMIZE",
    265: "SOUND.NOTE",
    266: "SOUND.PLAY",
    267: "FORMAT.SHAPE",
    268: "EXTEND.POLYGON",
    269: "FORMAT.AUTO",
    272: "GALLERY.3D.BAR",
    273: "GALLERY.3D.SURFACE",
    274: "FILL.AUTO",
    276: "CUSTOMIZE.TOOLBAR",
    277: "ADD.TOOL",
    278: "EDIT.OBJECT",
    279: "ON.DOUBLECLICK",
    280: "ON.ENTRY",
    281: "WORKBOOK.ADD",
    282: "WORKBOOK.MOVE",
    283: "WORKBOOK.COPY",
    284: "WORKBOOK.OPTIONS",
    285: "SAVE.WORKSPACE",
    288: "CHART.WIZARD",
    289: "DELETE.TOOL",
    290: "MOVE.TOOL",
    291: "WORKBOOK.SELECT",
    292: "WORKBOOK.ACTIVATE",
    293: "ASSIGN.TO.TOOL",
    295: "COPY.TOOL",
    296: "RESET.TOOL",
    297: "CONSTRAIN.NUMERIC",
    298: "PASTE.TOOL",
    302: "WORKBOOK.NEW",
    305: "SCENARIO.CELLS",
    306: "SCENARIO.DELETE",
    307: "SCENARIO.ADD",
    308: "SCENARIO.EDIT",
    309: "SCENARIO.SHOW",
    310: "SCENARIO.SHOW.NEXT",
    311: "SCENARIO.SUMMARY",
    312: "PIVOT.TABLE.WIZARD",
    313: "PIVOT.FIELD.PROPERTIES",
    314: "PIVOT.FIELD",
    315: "PIVOT.ITEM",
    316: "PIVOT.ADD.FIELDS",
    318: "OPTIONS.CALCULATION",
    319: "OPTIONS.EDIT",
    320: "OPTIONS.VIEW",
    321: "ADDIN.MANAGER",
    322: "MENU.EDITOR",
    323: "ATTACH.TOOLBARS",
    324: "VBAActivate",
    325: "OPTIONS.CHART",
    328: "VBA.INSERT.FILE",
    330: "VBA.PROCEDURE.DEFINITION",
    336: "ROUTING.SLIP",
    338: "ROUTE.DOCUMENT",
    339: "MAIL.LOGON",
    342: "INSERT.PICTURE",
    343: "EDIT.TOOL",
    344: "GALLERY.DOUGHNUT",
    350: "CHART.TREND",
    352: "PIVOT.ITEM.PROPERTIES",
    354: "WORKBOOK.INSERT",
    355: "OPTIONS.TRANSITION",
    356: "OPTIONS.GENERAL",
    370: "FILTER.ADVANCED",
    373: "MAIL.ADD.MAILER",
    374: "MAIL.DELETE.MAILER",
    375: "MAIL.REPLY",
    376: "MAIL.REPLY.ALL",
    377: "MAIL.FORWARD",
    378: "MAIL.NEXT.LETTER",
    379: "DATA.LABEL",
    380: "INSERT.TITLE",
    381: "FONT.PROPERTIES",
    382: "MACRO.OPTIONS",
    383: "WORKBOOK.HIDE",
    384: "WORKBOOK.UNHIDE",
    385: "WORKBOOK.DELETE",
    386: "WORKBOOK.NAME",
    388: "GALLERY.CUSTOM",
    390: "ADD.CHART.AUTOFORMAT",
    391: "DELETE.CHART.AUTOFORMAT",
    392: "CHART.ADD.DATA",
    393: "AUTO.OUTLINE",
    394: "TAB.ORDER",
    395: "SHOW.DIALOG",
    396: "SELECT.ALL",
    397: "UNGROUP.SHEETS",
    398: "SUBTOTAL.CREATE",
    399: "SUBTOTAL.REMOVE",
    400: "RENAME.OBJECT",
    412: "WORKBOOK.SCROLL",
    413: "WORKBOOK.NEXT",
    414: "WORKBOOK.PREV",
    415: "WORKBOOK.TAB.SPLIT",
    416: "FULL.SCREEN",
    417: "WORKBOOK.PROTECT",
    420: "SCROLLBAR.PROPERTIES",
    421: "PIVOT.SHOW.PAGES",
    422: "TEXT.TO.COLUMNS",
    423: "FORMAT.CHARTTYPE",
    424: "LINK.FORMAT",
    425: "TRACER.DISPLAY",
    430: "TRACER.NAVIGATE",
    431: "TRACER.CLEAR",
    432: "TRACER.ERROR",
    433: "PIVOT.FIELD.GROUP",
    434: "PIVOT.FIELD.UNGROUP",
    435: "CHECKBOX.PROPERTIES",
    436: "LABEL.PROPERTIES",
    437: "LISTBOX.PROPERTIES",
    438: "EDITBOX.PROPERTIES",
    439: "PIVOT.REFRESH",
    440: "LINK.COMBO",
    441: "OPEN.TEXT",
    442: "HIDE.DIALOG",
    443: "SET.DIALOG.FOCUS",
    444: "ENABLE.OBJECT",
    445: "PUSHBUTTON.PROPERTIES",
    446: "SET.DIALOG.DEFAULT",
    447: "FILTER",
    448: "FILTER.SHOW.ALL",
    449: "CLEAR.OUTLINE",
    450: "FUNCTION.WIZARD",
    451: "ADD.LIST.ITEM",
    452: "SET.LIST.ITEM",
    453: "REMOVE.LIST.ITEM",
    454: "SELECT.LIST.ITEM",
    455: "SET.CONTROL.VALUE",
    456: "SAVE.COPY.AS",
    458: "OPTIONS.LISTS.ADD",
    459: "OPTIONS.LISTS.DELETE",
    460: "SERIES.AXES",
    461: "SERIES.X",
    462: "SERIES.Y",
    463: "ERRORBAR.X",
    464: "ERRORBAR.Y",
    465: "FORMAT.CHART",
    466: "SERIES.ORDER",
    467: "MAIL.LOGOFF",
    468: "CLEAR.ROUTING.SLIP",
    469: "APP.ACTIVATE.MICROSOFT",
    470: "MAIL.EDIT.MAILER",
    471: "ON.SHEET",
    472: "STANDARD.WIDTH",
    473: "SCENARIO.MERGE",
    474: "SUMMARY.INFO",
    475: "FIND.FILE",
    476: "ACTIVE.CELL.FONT",
    477: "ENABLE.TIPWIZARD",
    478: "VBA.MAKE.ADDIN",
    480: "INSERTDATATABLE",
    481: "WORKGROUP.OPTIONS",
    482: "MAIL.SEND.MAILER",
    485: "AUTOCORRECT",
    489: "POST.DOCUMENT",
    491: "PICKLIST",
    493: "VIEW.SHOW",
    494: "VIEW.DEFINE",
    495: "VIEW.DELETE",
    509: "SHEET.BACKGROUND",
    510: "INSERT.MAP.OBJECT",
    511: "OPTIONS.MENONO",
    517: "MSOCHECKS",
    518: "NORMAL",
    519: "LAYOUT",
    520: "RM.PRINT.AREA",
    521: "CLEAR.PRINT.AREA",
    522: "ADD.PRINT.AREA",
    523: "MOVE.BRK",
    545: "HIDECURR.NOTE",
    546: "HIDEALL.NOTES",
    547: "DELETE.NOTE",
    548: "TRAVERSE.NOTES",
    549: "ACTIVATE.NOTES",
    620: "PROTECT.REVISIONS",
    621: "UNPROTECT.REVISIONS",
    647: "OPTIONS.ME",
    653: "WEB.PUBLISH",
    667: "NEWWEBQUERY",
    673: "PIVOT.TABLE.CHART",
    753: "OPTIONS.SAVE",
    755: "OPTIONS.SPELL",
    808: "HIDEALL.INKANNOTS"
  };
  var Ftab = {
    0: "COUNT",
    1: "IF",
    2: "ISNA",
    3: "ISERROR",
    4: "SUM",
    5: "AVERAGE",
    6: "MIN",
    7: "MAX",
    8: "ROW",
    9: "COLUMN",
    10: "NA",
    11: "NPV",
    12: "STDEV",
    13: "DOLLAR",
    14: "FIXED",
    15: "SIN",
    16: "COS",
    17: "TAN",
    18: "ATAN",
    19: "PI",
    20: "SQRT",
    21: "EXP",
    22: "LN",
    23: "LOG10",
    24: "ABS",
    25: "INT",
    26: "SIGN",
    27: "ROUND",
    28: "LOOKUP",
    29: "INDEX",
    30: "REPT",
    31: "MID",
    32: "LEN",
    33: "VALUE",
    34: "TRUE",
    35: "FALSE",
    36: "AND",
    37: "OR",
    38: "NOT",
    39: "MOD",
    40: "DCOUNT",
    41: "DSUM",
    42: "DAVERAGE",
    43: "DMIN",
    44: "DMAX",
    45: "DSTDEV",
    46: "VAR",
    47: "DVAR",
    48: "TEXT",
    49: "LINEST",
    50: "TREND",
    51: "LOGEST",
    52: "GROWTH",
    53: "GOTO",
    54: "HALT",
    55: "RETURN",
    56: "PV",
    57: "FV",
    58: "NPER",
    59: "PMT",
    60: "RATE",
    61: "MIRR",
    62: "IRR",
    63: "RAND",
    64: "MATCH",
    65: "DATE",
    66: "TIME",
    67: "DAY",
    68: "MONTH",
    69: "YEAR",
    70: "WEEKDAY",
    71: "HOUR",
    72: "MINUTE",
    73: "SECOND",
    74: "NOW",
    75: "AREAS",
    76: "ROWS",
    77: "COLUMNS",
    78: "OFFSET",
    79: "ABSREF",
    80: "RELREF",
    81: "ARGUMENT",
    82: "SEARCH",
    83: "TRANSPOSE",
    84: "ERROR",
    85: "STEP",
    86: "TYPE",
    87: "ECHO",
    88: "SET.NAME",
    89: "CALLER",
    90: "DEREF",
    91: "WINDOWS",
    92: "SERIES",
    93: "DOCUMENTS",
    94: "ACTIVE.CELL",
    95: "SELECTION",
    96: "RESULT",
    97: "ATAN2",
    98: "ASIN",
    99: "ACOS",
    100: "CHOOSE",
    101: "HLOOKUP",
    102: "VLOOKUP",
    103: "LINKS",
    104: "INPUT",
    105: "ISREF",
    106: "GET.FORMULA",
    107: "GET.NAME",
    108: "SET.VALUE",
    109: "LOG",
    110: "EXEC",
    111: "CHAR",
    112: "LOWER",
    113: "UPPER",
    114: "PROPER",
    115: "LEFT",
    116: "RIGHT",
    117: "EXACT",
    118: "TRIM",
    119: "REPLACE",
    120: "SUBSTITUTE",
    121: "CODE",
    122: "NAMES",
    123: "DIRECTORY",
    124: "FIND",
    125: "CELL",
    126: "ISERR",
    127: "ISTEXT",
    128: "ISNUMBER",
    129: "ISBLANK",
    130: "T",
    131: "N",
    132: "FOPEN",
    133: "FCLOSE",
    134: "FSIZE",
    135: "FREADLN",
    136: "FREAD",
    137: "FWRITELN",
    138: "FWRITE",
    139: "FPOS",
    140: "DATEVALUE",
    141: "TIMEVALUE",
    142: "SLN",
    143: "SYD",
    144: "DDB",
    145: "GET.DEF",
    146: "REFTEXT",
    147: "TEXTREF",
    148: "INDIRECT",
    149: "REGISTER",
    150: "CALL",
    151: "ADD.BAR",
    152: "ADD.MENU",
    153: "ADD.COMMAND",
    154: "ENABLE.COMMAND",
    155: "CHECK.COMMAND",
    156: "RENAME.COMMAND",
    157: "SHOW.BAR",
    158: "DELETE.MENU",
    159: "DELETE.COMMAND",
    160: "GET.CHART.ITEM",
    161: "DIALOG.BOX",
    162: "CLEAN",
    163: "MDETERM",
    164: "MINVERSE",
    165: "MMULT",
    166: "FILES",
    167: "IPMT",
    168: "PPMT",
    169: "COUNTA",
    170: "CANCEL.KEY",
    171: "FOR",
    172: "WHILE",
    173: "BREAK",
    174: "NEXT",
    175: "INITIATE",
    176: "REQUEST",
    177: "POKE",
    178: "EXECUTE",
    179: "TERMINATE",
    180: "RESTART",
    181: "HELP",
    182: "GET.BAR",
    183: "PRODUCT",
    184: "FACT",
    185: "GET.CELL",
    186: "GET.WORKSPACE",
    187: "GET.WINDOW",
    188: "GET.DOCUMENT",
    189: "DPRODUCT",
    190: "ISNONTEXT",
    191: "GET.NOTE",
    192: "NOTE",
    193: "STDEVP",
    194: "VARP",
    195: "DSTDEVP",
    196: "DVARP",
    197: "TRUNC",
    198: "ISLOGICAL",
    199: "DCOUNTA",
    200: "DELETE.BAR",
    201: "UNREGISTER",
    204: "USDOLLAR",
    205: "FINDB",
    206: "SEARCHB",
    207: "REPLACEB",
    208: "LEFTB",
    209: "RIGHTB",
    210: "MIDB",
    211: "LENB",
    212: "ROUNDUP",
    213: "ROUNDDOWN",
    214: "ASC",
    215: "DBCS",
    216: "RANK",
    219: "ADDRESS",
    220: "DAYS360",
    221: "TODAY",
    222: "VDB",
    223: "ELSE",
    224: "ELSE.IF",
    225: "END.IF",
    226: "FOR.CELL",
    227: "MEDIAN",
    228: "SUMPRODUCT",
    229: "SINH",
    230: "COSH",
    231: "TANH",
    232: "ASINH",
    233: "ACOSH",
    234: "ATANH",
    235: "DGET",
    236: "CREATE.OBJECT",
    237: "VOLATILE",
    238: "LAST.ERROR",
    239: "CUSTOM.UNDO",
    240: "CUSTOM.REPEAT",
    241: "FORMULA.CONVERT",
    242: "GET.LINK.INFO",
    243: "TEXT.BOX",
    244: "INFO",
    245: "GROUP",
    246: "GET.OBJECT",
    247: "DB",
    248: "PAUSE",
    251: "RESUME",
    252: "FREQUENCY",
    253: "ADD.TOOLBAR",
    254: "DELETE.TOOLBAR",
    255: "User",
    256: "RESET.TOOLBAR",
    257: "EVALUATE",
    258: "GET.TOOLBAR",
    259: "GET.TOOL",
    260: "SPELLING.CHECK",
    261: "ERROR.TYPE",
    262: "APP.TITLE",
    263: "WINDOW.TITLE",
    264: "SAVE.TOOLBAR",
    265: "ENABLE.TOOL",
    266: "PRESS.TOOL",
    267: "REGISTER.ID",
    268: "GET.WORKBOOK",
    269: "AVEDEV",
    270: "BETADIST",
    271: "GAMMALN",
    272: "BETAINV",
    273: "BINOMDIST",
    274: "CHIDIST",
    275: "CHIINV",
    276: "COMBIN",
    277: "CONFIDENCE",
    278: "CRITBINOM",
    279: "EVEN",
    280: "EXPONDIST",
    281: "FDIST",
    282: "FINV",
    283: "FISHER",
    284: "FISHERINV",
    285: "FLOOR",
    286: "GAMMADIST",
    287: "GAMMAINV",
    288: "CEILING",
    289: "HYPGEOMDIST",
    290: "LOGNORMDIST",
    291: "LOGINV",
    292: "NEGBINOMDIST",
    293: "NORMDIST",
    294: "NORMSDIST",
    295: "NORMINV",
    296: "NORMSINV",
    297: "STANDARDIZE",
    298: "ODD",
    299: "PERMUT",
    300: "POISSON",
    301: "TDIST",
    302: "WEIBULL",
    303: "SUMXMY2",
    304: "SUMX2MY2",
    305: "SUMX2PY2",
    306: "CHITEST",
    307: "CORREL",
    308: "COVAR",
    309: "FORECAST",
    310: "FTEST",
    311: "INTERCEPT",
    312: "PEARSON",
    313: "RSQ",
    314: "STEYX",
    315: "SLOPE",
    316: "TTEST",
    317: "PROB",
    318: "DEVSQ",
    319: "GEOMEAN",
    320: "HARMEAN",
    321: "SUMSQ",
    322: "KURT",
    323: "SKEW",
    324: "ZTEST",
    325: "LARGE",
    326: "SMALL",
    327: "QUARTILE",
    328: "PERCENTILE",
    329: "PERCENTRANK",
    330: "MODE",
    331: "TRIMMEAN",
    332: "TINV",
    334: "MOVIE.COMMAND",
    335: "GET.MOVIE",
    336: "CONCATENATE",
    337: "POWER",
    338: "PIVOT.ADD.DATA",
    339: "GET.PIVOT.TABLE",
    340: "GET.PIVOT.FIELD",
    341: "GET.PIVOT.ITEM",
    342: "RADIANS",
    343: "DEGREES",
    344: "SUBTOTAL",
    345: "SUMIF",
    346: "COUNTIF",
    347: "COUNTBLANK",
    348: "SCENARIO.GET",
    349: "OPTIONS.LISTS.GET",
    350: "ISPMT",
    351: "DATEDIF",
    352: "DATESTRING",
    353: "NUMBERSTRING",
    354: "ROMAN",
    355: "OPEN.DIALOG",
    356: "SAVE.DIALOG",
    357: "VIEW.GET",
    358: "GETPIVOTDATA",
    359: "HYPERLINK",
    360: "PHONETIC",
    361: "AVERAGEA",
    362: "MAXA",
    363: "MINA",
    364: "STDEVPA",
    365: "VARPA",
    366: "STDEVA",
    367: "VARA",
    368: "BAHTTEXT",
    369: "THAIDAYOFWEEK",
    370: "THAIDIGIT",
    371: "THAIMONTHOFYEAR",
    372: "THAINUMSOUND",
    373: "THAINUMSTRING",
    374: "THAISTRINGLENGTH",
    375: "ISTHAIDIGIT",
    376: "ROUNDBAHTDOWN",
    377: "ROUNDBAHTUP",
    378: "THAIYEAR",
    379: "RTD",
    380: "CUBEVALUE",
    381: "CUBEMEMBER",
    382: "CUBEMEMBERPROPERTY",
    383: "CUBERANKEDMEMBER",
    384: "HEX2BIN",
    385: "HEX2DEC",
    386: "HEX2OCT",
    387: "DEC2BIN",
    388: "DEC2HEX",
    389: "DEC2OCT",
    390: "OCT2BIN",
    391: "OCT2HEX",
    392: "OCT2DEC",
    393: "BIN2DEC",
    394: "BIN2OCT",
    395: "BIN2HEX",
    396: "IMSUB",
    397: "IMDIV",
    398: "IMPOWER",
    399: "IMABS",
    400: "IMSQRT",
    401: "IMLN",
    402: "IMLOG2",
    403: "IMLOG10",
    404: "IMSIN",
    405: "IMCOS",
    406: "IMEXP",
    407: "IMARGUMENT",
    408: "IMCONJUGATE",
    409: "IMAGINARY",
    410: "IMREAL",
    411: "COMPLEX",
    412: "IMSUM",
    413: "IMPRODUCT",
    414: "SERIESSUM",
    415: "FACTDOUBLE",
    416: "SQRTPI",
    417: "QUOTIENT",
    418: "DELTA",
    419: "GESTEP",
    420: "ISEVEN",
    421: "ISODD",
    422: "MROUND",
    423: "ERF",
    424: "ERFC",
    425: "BESSELJ",
    426: "BESSELK",
    427: "BESSELY",
    428: "BESSELI",
    429: "XIRR",
    430: "XNPV",
    431: "PRICEMAT",
    432: "YIELDMAT",
    433: "INTRATE",
    434: "RECEIVED",
    435: "DISC",
    436: "PRICEDISC",
    437: "YIELDDISC",
    438: "TBILLEQ",
    439: "TBILLPRICE",
    440: "TBILLYIELD",
    441: "PRICE",
    442: "YIELD",
    443: "DOLLARDE",
    444: "DOLLARFR",
    445: "NOMINAL",
    446: "EFFECT",
    447: "CUMPRINC",
    448: "CUMIPMT",
    449: "EDATE",
    450: "EOMONTH",
    451: "YEARFRAC",
    452: "COUPDAYBS",
    453: "COUPDAYS",
    454: "COUPDAYSNC",
    455: "COUPNCD",
    456: "COUPNUM",
    457: "COUPPCD",
    458: "DURATION",
    459: "MDURATION",
    460: "ODDLPRICE",
    461: "ODDLYIELD",
    462: "ODDFPRICE",
    463: "ODDFYIELD",
    464: "RANDBETWEEN",
    465: "WEEKNUM",
    466: "AMORDEGRC",
    467: "AMORLINC",
    468: "CONVERT",
    724: "SHEETJS",
    469: "ACCRINT",
    470: "ACCRINTM",
    471: "WORKDAY",
    472: "NETWORKDAYS",
    473: "GCD",
    474: "MULTINOMIAL",
    475: "LCM",
    476: "FVSCHEDULE",
    477: "CUBEKPIMEMBER",
    478: "CUBESET",
    479: "CUBESETCOUNT",
    480: "IFERROR",
    481: "COUNTIFS",
    482: "SUMIFS",
    483: "AVERAGEIF",
    484: "AVERAGEIFS"
  };
  var FtabArgc = {
    2: 1,
    3: 1,
    10: 0,
    15: 1,
    16: 1,
    17: 1,
    18: 1,
    19: 0,
    20: 1,
    21: 1,
    22: 1,
    23: 1,
    24: 1,
    25: 1,
    26: 1,
    27: 2,
    30: 2,
    31: 3,
    32: 1,
    33: 1,
    34: 0,
    35: 0,
    38: 1,
    39: 2,
    40: 3,
    41: 3,
    42: 3,
    43: 3,
    44: 3,
    45: 3,
    47: 3,
    48: 2,
    53: 1,
    61: 3,
    63: 0,
    65: 3,
    66: 3,
    67: 1,
    68: 1,
    69: 1,
    70: 1,
    71: 1,
    72: 1,
    73: 1,
    74: 0,
    75: 1,
    76: 1,
    77: 1,
    79: 2,
    80: 2,
    83: 1,
    85: 0,
    86: 1,
    89: 0,
    90: 1,
    94: 0,
    95: 0,
    97: 2,
    98: 1,
    99: 1,
    101: 3,
    102: 3,
    105: 1,
    106: 1,
    108: 2,
    111: 1,
    112: 1,
    113: 1,
    114: 1,
    117: 2,
    118: 1,
    119: 4,
    121: 1,
    126: 1,
    127: 1,
    128: 1,
    129: 1,
    130: 1,
    131: 1,
    133: 1,
    134: 1,
    135: 1,
    136: 2,
    137: 2,
    138: 2,
    140: 1,
    141: 1,
    142: 3,
    143: 4,
    144: 4,
    161: 1,
    162: 1,
    163: 1,
    164: 1,
    165: 2,
    172: 1,
    175: 2,
    176: 2,
    177: 3,
    178: 2,
    179: 1,
    184: 1,
    186: 1,
    189: 3,
    190: 1,
    195: 3,
    196: 3,
    197: 1,
    198: 1,
    199: 3,
    201: 1,
    207: 4,
    210: 3,
    211: 1,
    212: 2,
    213: 2,
    214: 1,
    215: 1,
    225: 0,
    229: 1,
    230: 1,
    231: 1,
    232: 1,
    233: 1,
    234: 1,
    235: 3,
    244: 1,
    247: 4,
    252: 2,
    257: 1,
    261: 1,
    271: 1,
    273: 4,
    274: 2,
    275: 2,
    276: 2,
    277: 3,
    278: 3,
    279: 1,
    280: 3,
    281: 3,
    282: 3,
    283: 1,
    284: 1,
    285: 2,
    286: 4,
    287: 3,
    288: 2,
    289: 4,
    290: 3,
    291: 3,
    292: 3,
    293: 4,
    294: 1,
    295: 3,
    296: 1,
    297: 3,
    298: 1,
    299: 2,
    300: 3,
    301: 3,
    302: 4,
    303: 2,
    304: 2,
    305: 2,
    306: 2,
    307: 2,
    308: 2,
    309: 3,
    310: 2,
    311: 2,
    312: 2,
    313: 2,
    314: 2,
    315: 2,
    316: 4,
    325: 2,
    326: 2,
    327: 2,
    328: 2,
    331: 2,
    332: 2,
    337: 2,
    342: 1,
    343: 1,
    346: 2,
    347: 1,
    350: 4,
    351: 3,
    352: 1,
    353: 2,
    360: 1,
    368: 1,
    369: 1,
    370: 1,
    371: 1,
    372: 1,
    373: 1,
    374: 1,
    375: 1,
    376: 1,
    377: 1,
    378: 1,
    382: 3,
    385: 1,
    392: 1,
    393: 1,
    396: 2,
    397: 2,
    398: 2,
    399: 1,
    400: 1,
    401: 1,
    402: 1,
    403: 1,
    404: 1,
    405: 1,
    406: 1,
    407: 1,
    408: 1,
    409: 1,
    410: 1,
    414: 4,
    415: 1,
    416: 1,
    417: 2,
    420: 1,
    421: 1,
    422: 2,
    424: 1,
    425: 2,
    426: 2,
    427: 2,
    428: 2,
    430: 3,
    438: 3,
    439: 3,
    440: 3,
    443: 2,
    444: 2,
    445: 2,
    446: 2,
    447: 6,
    448: 6,
    449: 2,
    450: 2,
    464: 2,
    468: 3,
    476: 2,
    479: 1,
    480: 2,
    65535: 0
  };
  function ods_to_csf_formula(f) {
    if (f.slice(0, 3) == "of:") f = f.slice(3);
    if (f.charCodeAt(0) == 61) {
      f = f.slice(1);
      if (f.charCodeAt(0) == 61) f = f.slice(1);
    }
    f = f.replace(/COM\.MICROSOFT\./g, "");
    f = f.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g, function($$, $1) {
      return $1.replace(/\./g, "");
    });
    f = f.replace(/\[.(#[A-Z]*[?!])\]/g, "$1");
    return f.replace(/[;~]/g, ",").replace(/\|/g, ";");
  }
  function ods_to_csf_3D(r) {
    var a = r.split(":");
    var s = a[0].split(".")[0];
    return [s, a[0].split(".")[1] + (a.length > 1 ? ":" + (a[1].split(".")[1] || a[1].split(".")[0]) : "")];
  }
  var strs = {};
  var _ssfopts = {};
  function default_margins(margins, mode) {
    if (!margins) return;
    var defs = [0.7, 0.7, 0.75, 0.75, 0.3, 0.3];
    if (mode == "xlml") defs = [1, 1, 1, 1, 0.5, 0.5];
    if (margins.left == null) margins.left = defs[0];
    if (margins.right == null) margins.right = defs[1];
    if (margins.top == null) margins.top = defs[2];
    if (margins.bottom == null) margins.bottom = defs[3];
    if (margins.header == null) margins.header = defs[4];
    if (margins.footer == null) margins.footer = defs[5];
  }
  function safe_format(p, fmtid, fillid, opts, themes, styles) {
    try {
      if (opts.cellNF) p.z = table_fmt[fmtid];
    } catch (e) {
      if (opts.WTF) throw e;
    }
    if (p.t === "z" && !opts.cellStyles) return;
    if (p.t === "d" && typeof p.v === "string") p.v = parseDate(p.v);
    if ((!opts || opts.cellText !== false) && p.t !== "z") try {
      if (table_fmt[fmtid] == null) SSF_load(SSFImplicit[fmtid] || "General", fmtid);
      if (p.t === "e") p.w = p.w || BErr[p.v];
      else if (fmtid === 0) {
        if (p.t === "n") {
          if ((p.v | 0) === p.v) p.w = p.v.toString(10);
          else p.w = SSF_general_num(p.v);
        } else if (p.t === "d") {
          var dd = datenum(p.v);
          if ((dd | 0) === dd) p.w = dd.toString(10);
          else p.w = SSF_general_num(dd);
        } else if (p.v === void 0) return "";
        else p.w = SSF_general(p.v, _ssfopts);
      } else if (p.t === "d") p.w = SSF_format(fmtid, datenum(p.v), _ssfopts);
      else p.w = SSF_format(fmtid, p.v, _ssfopts);
    } catch (e) {
      if (opts.WTF) throw e;
    }
    if (!opts.cellStyles) return;
    if (fillid != null) try {
      p.s = styles.Fills[fillid];
      if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) {
        p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0);
        if (opts.WTF) p.s.fgColor.raw_rgb = themes.themeElements.clrScheme[p.s.fgColor.theme].rgb;
      }
      if (p.s.bgColor && p.s.bgColor.theme) {
        p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0);
        if (opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb;
      }
    } catch (e) {
      if (opts.WTF && styles.Fills) throw e;
    }
  }
  function parse_ws_xml_dim(ws, s) {
    var d = safe_decode_range(s);
    if (d.s.r <= d.e.r && d.s.c <= d.e.c && d.s.r >= 0 && d.s.c >= 0) ws["!ref"] = encode_range(d);
  }
  var mergecregex = /<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g;
  var sheetdataregex = /<(?:\w+:)?sheetData[^>]*>([\s\S]*)<\/(?:\w+:)?sheetData>/;
  var hlinkregex = /<(?:\w:)?hyperlink [^>]*>/mg;
  var dimregex = /"(\w*:\w*)"/;
  var colregex = /<(?:\w:)?col\b[^>]*[\/]?>/g;
  var afregex = /<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g;
  var marginregex = /<(?:\w:)?pageMargins[^>]*\/>/g;
  var sheetprregex = /<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/;
  var sheetprregex2 = /<(?:\w:)?sheetPr[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetPr)>/;
  var svsregex = /<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/;
  function parse_ws_xml(data, opts, idx, rels, wb, themes, styles) {
    if (!data) return data;
    if (!rels) rels = { "!id": {} };
    if (DENSE != null && opts.dense == null) opts.dense = DENSE;
    var s = opts.dense ? [] : {};
    var refguess = { s: { r: 2e6, c: 2e6 }, e: { r: 0, c: 0 } };
    var data1 = "", data2 = "";
    var mtch = data.match(sheetdataregex);
    if (mtch) {
      data1 = data.slice(0, mtch.index);
      data2 = data.slice(mtch.index + mtch[0].length);
    } else data1 = data2 = data;
    var sheetPr = data1.match(sheetprregex);
    if (sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx);
    else if (sheetPr = data1.match(sheetprregex2)) parse_ws_xml_sheetpr2(sheetPr[0], sheetPr[1] || "", s, wb, idx, styles, themes);
    var ridx = (data1.match(/<(?:\w*:)?dimension/) || { index: -1 }).index;
    if (ridx > 0) {
      var ref = data1.slice(ridx, ridx + 50).match(dimregex);
      if (ref) parse_ws_xml_dim(s, ref[1]);
    }
    var svs = data1.match(svsregex);
    if (svs && svs[1]) parse_ws_xml_sheetviews(svs[1], wb);
    var columns = [];
    if (opts.cellStyles) {
      var cols = data1.match(colregex);
      if (cols) parse_ws_xml_cols(columns, cols);
    }
    if (mtch) parse_ws_xml_data(mtch[1], s, opts, refguess, themes, styles);
    var afilter = data2.match(afregex);
    if (afilter) s["!autofilter"] = parse_ws_xml_autofilter(afilter[0]);
    var merges = [];
    var _merge = data2.match(mergecregex);
    if (_merge) for (ridx = 0; ridx != _merge.length; ++ridx)
      merges[ridx] = safe_decode_range(_merge[ridx].slice(_merge[ridx].indexOf('"') + 1));
    var hlink = data2.match(hlinkregex);
    if (hlink) parse_ws_xml_hlinks(s, hlink, rels);
    var margins = data2.match(marginregex);
    if (margins) s["!margins"] = parse_ws_xml_margins(parsexmltag(margins[0]));
    if (!s["!ref"] && refguess.e.c >= refguess.s.c && refguess.e.r >= refguess.s.r) s["!ref"] = encode_range(refguess);
    if (opts.sheetRows > 0 && s["!ref"]) {
      var tmpref = safe_decode_range(s["!ref"]);
      if (opts.sheetRows <= +tmpref.e.r) {
        tmpref.e.r = opts.sheetRows - 1;
        if (tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r;
        if (tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r;
        if (tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c;
        if (tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c;
        s["!fullref"] = s["!ref"];
        s["!ref"] = encode_range(tmpref);
      }
    }
    if (columns.length > 0) s["!cols"] = columns;
    if (merges.length > 0) s["!merges"] = merges;
    return s;
  }
  function parse_ws_xml_sheetpr(sheetPr, s, wb, idx) {
    var data = parsexmltag(sheetPr);
    if (!wb.Sheets[idx]) wb.Sheets[idx] = {};
    if (data.codeName) wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName));
  }
  function parse_ws_xml_sheetpr2(sheetPr, body, s, wb, idx) {
    parse_ws_xml_sheetpr(sheetPr.slice(0, sheetPr.indexOf(">")), s, wb, idx);
  }
  function parse_ws_xml_hlinks(s, data, rels) {
    var dense = Array.isArray(s);
    for (var i = 0; i != data.length; ++i) {
      var val = parsexmltag(utf8read(data[i]), true);
      if (!val.ref) return;
      var rel = ((rels || {})["!id"] || [])[val.id];
      if (rel) {
        val.Target = rel.Target;
        if (val.location) val.Target += "#" + unescapexml(val.location);
      } else {
        val.Target = "#" + unescapexml(val.location);
        rel = { Target: val.Target, TargetMode: "Internal" };
      }
      val.Rel = rel;
      if (val.tooltip) {
        val.Tooltip = val.tooltip;
        delete val.tooltip;
      }
      var rng = safe_decode_range(val.ref);
      for (var R = rng.s.r; R <= rng.e.r; ++R) for (var C = rng.s.c; C <= rng.e.c; ++C) {
        var addr = encode_cell({ c: C, r: R });
        if (dense) {
          if (!s[R]) s[R] = [];
          if (!s[R][C]) s[R][C] = { t: "z", v: void 0 };
          s[R][C].l = val;
        } else {
          if (!s[addr]) s[addr] = { t: "z", v: void 0 };
          s[addr].l = val;
        }
      }
    }
  }
  function parse_ws_xml_margins(margin) {
    var o = {};
    ["left", "right", "top", "bottom", "header", "footer"].forEach(function(k) {
      if (margin[k]) o[k] = parseFloat(margin[k]);
    });
    return o;
  }
  function parse_ws_xml_cols(columns, cols) {
    var seencol = false;
    for (var coli = 0; coli != cols.length; ++coli) {
      var coll = parsexmltag(cols[coli], true);
      if (coll.hidden) coll.hidden = parsexmlbool(coll.hidden);
      var colm = parseInt(coll.min, 10) - 1, colM = parseInt(coll.max, 10) - 1;
      if (coll.outlineLevel) coll.level = +coll.outlineLevel || 0;
      delete coll.min;
      delete coll.max;
      coll.width = +coll.width;
      if (!seencol && coll.width) {
        seencol = true;
        find_mdw_colw(coll.width);
      }
      process_col(coll);
      while (colm <= colM) columns[colm++] = dup(coll);
    }
  }
  function parse_ws_xml_autofilter(data) {
    var o = { ref: (data.match(/ref="([^"]*)"/) || [])[1] };
    return o;
  }
  var sviewregex = /<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/?>/;
  function parse_ws_xml_sheetviews(data, wb) {
    if (!wb.Views) wb.Views = [{}];
    (data.match(sviewregex) || []).forEach(function(r, i) {
      var tag = parsexmltag(r);
      if (!wb.Views[i]) wb.Views[i] = {};
      if (+tag.zoomScale) wb.Views[i].zoom = +tag.zoomScale;
      if (parsexmlbool(tag.rightToLeft)) wb.Views[i].RTL = true;
    });
  }
  var parse_ws_xml_data = /* @__PURE__ */ (function() {
    var cellregex = /<(?:\w+:)?c[ \/>]/, rowregex = /<\/(?:\w+:)?row>/;
    var rregex = /r=["']([^"']*)["']/, isregex = /<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/;
    var refregex = /ref=["']([^"']*)["']/;
    var match_v = matchtag("v"), match_f = matchtag("f");
    return function parse_ws_xml_data2(sdata, s, opts, guess, themes, styles) {
      var ri = 0, x = "", cells = [], cref = [], idx = 0, i = 0, cc = 0, d = "", p;
      var tag, tagr = 0, tagc = 0;
      var sstr, ftag;
      var fmtid = 0, fillid = 0;
      var do_format = Array.isArray(styles.CellXf), cf;
      var arrayf = [];
      var sharedf = [];
      var dense = Array.isArray(s);
      var rows = [], rowobj = {}, rowrite = false;
      var sheetStubs = !!opts.sheetStubs;
      for (var marr = sdata.split(rowregex), mt = 0, marrlen = marr.length; mt != marrlen; ++mt) {
        x = marr[mt].trim();
        var xlen = x.length;
        if (xlen === 0) continue;
        var rstarti = 0;
        outa: for (ri = 0; ri < xlen; ++ri) switch (
          /*x.charCodeAt(ri)*/
          x[ri]
        ) {
          case ">":
            if (
              /*x.charCodeAt(ri-1) != 47*/
              x[ri - 1] != "/"
            ) {
              ++ri;
              break outa;
            }
            if (opts && opts.cellStyles) {
              tag = parsexmltag(x.slice(rstarti, ri), true);
              tagr = tag.r != null ? parseInt(tag.r, 10) : tagr + 1;
              tagc = -1;
              if (opts.sheetRows && opts.sheetRows < tagr) continue;
              rowobj = {};
              rowrite = false;
              if (tag.ht) {
                rowrite = true;
                rowobj.hpt = parseFloat(tag.ht);
                rowobj.hpx = pt2px(rowobj.hpt);
              }
              if (tag.hidden == "1") {
                rowrite = true;
                rowobj.hidden = true;
              }
              if (tag.outlineLevel != null) {
                rowrite = true;
                rowobj.level = +tag.outlineLevel;
              }
              if (rowrite) rows[tagr - 1] = rowobj;
            }
            break;
          case "<":
            rstarti = ri;
            break;
        }
        if (rstarti >= ri) break;
        tag = parsexmltag(x.slice(rstarti, ri), true);
        tagr = tag.r != null ? parseInt(tag.r, 10) : tagr + 1;
        tagc = -1;
        if (opts.sheetRows && opts.sheetRows < tagr) continue;
        if (guess.s.r > tagr - 1) guess.s.r = tagr - 1;
        if (guess.e.r < tagr - 1) guess.e.r = tagr - 1;
        if (opts && opts.cellStyles) {
          rowobj = {};
          rowrite = false;
          if (tag.ht) {
            rowrite = true;
            rowobj.hpt = parseFloat(tag.ht);
            rowobj.hpx = pt2px(rowobj.hpt);
          }
          if (tag.hidden == "1") {
            rowrite = true;
            rowobj.hidden = true;
          }
          if (tag.outlineLevel != null) {
            rowrite = true;
            rowobj.level = +tag.outlineLevel;
          }
          if (rowrite) rows[tagr - 1] = rowobj;
        }
        cells = x.slice(ri).split(cellregex);
        for (var rslice = 0; rslice != cells.length; ++rslice) if (cells[rslice].trim().charAt(0) != "<") break;
        cells = cells.slice(rslice);
        for (ri = 0; ri != cells.length; ++ri) {
          x = cells[ri].trim();
          if (x.length === 0) continue;
          cref = x.match(rregex);
          idx = ri;
          i = 0;
          cc = 0;
          x = "<c " + (x.slice(0, 1) == "<" ? ">" : "") + x;
          if (cref != null && cref.length === 2) {
            idx = 0;
            d = cref[1];
            for (i = 0; i != d.length; ++i) {
              if ((cc = d.charCodeAt(i) - 64) < 1 || cc > 26) break;
              idx = 26 * idx + cc;
            }
            --idx;
            tagc = idx;
          } else ++tagc;
          for (i = 0; i != x.length; ++i) if (x.charCodeAt(i) === 62) break;
          ++i;
          tag = parsexmltag(x.slice(0, i), true);
          if (!tag.r) tag.r = encode_cell({ r: tagr - 1, c: tagc });
          d = x.slice(i);
          p = { t: "" };
          if ((cref = d.match(match_v)) != null && /*::cref != null && */
          cref[1] !== "") p.v = unescapexml(cref[1]);
          if (opts.cellFormula) {
            if ((cref = d.match(match_f)) != null && /*::cref != null && */
            cref[1] !== "") {
              p.f = unescapexml(utf8read(cref[1])).replace(/\r\n/g, "\n");
              if (!opts.xlfn) p.f = _xlfn(p.f);
              if (
                /*::cref != null && cref[0] != null && */
                cref[0].indexOf('t="array"') > -1
              ) {
                p.F = (d.match(refregex) || [])[1];
                if (p.F.indexOf(":") > -1) arrayf.push([safe_decode_range(p.F), p.F]);
              } else if (
                /*::cref != null && cref[0] != null && */
                cref[0].indexOf('t="shared"') > -1
              ) {
                ftag = parsexmltag(cref[0]);
                var ___f = unescapexml(utf8read(cref[1]));
                if (!opts.xlfn) ___f = _xlfn(___f);
                sharedf[parseInt(ftag.si, 10)] = [ftag, ___f, tag.r];
              }
            } else if (cref = d.match(/<f[^>]*\/>/)) {
              ftag = parsexmltag(cref[0]);
              if (sharedf[ftag.si]) p.f = shift_formula_xlsx(sharedf[ftag.si][1], sharedf[ftag.si][2], tag.r);
            }
            var _tag = decode_cell(tag.r);
            for (i = 0; i < arrayf.length; ++i)
              if (_tag.r >= arrayf[i][0].s.r && _tag.r <= arrayf[i][0].e.r) {
                if (_tag.c >= arrayf[i][0].s.c && _tag.c <= arrayf[i][0].e.c)
                  p.F = arrayf[i][1];
              }
          }
          if (tag.t == null && p.v === void 0) {
            if (p.f || p.F) {
              p.v = 0;
              p.t = "n";
            } else if (!sheetStubs) continue;
            else p.t = "z";
          } else p.t = tag.t || "n";
          if (guess.s.c > tagc) guess.s.c = tagc;
          if (guess.e.c < tagc) guess.e.c = tagc;
          switch (p.t) {
            case "n":
              if (p.v == "" || p.v == null) {
                if (!sheetStubs) continue;
                p.t = "z";
              } else p.v = parseFloat(p.v);
              break;
            case "s":
              if (typeof p.v == "undefined") {
                if (!sheetStubs) continue;
                p.t = "z";
              } else {
                sstr = strs[parseInt(p.v, 10)];
                p.v = sstr.t;
                p.r = sstr.r;
                if (opts.cellHTML) p.h = sstr.h;
              }
              break;
            case "str":
              p.t = "s";
              p.v = p.v != null ? utf8read(p.v) : "";
              if (opts.cellHTML) p.h = escapehtml(p.v);
              break;
            case "inlineStr":
              cref = d.match(isregex);
              p.t = "s";
              if (cref != null && (sstr = parse_si(cref[1]))) {
                p.v = sstr.t;
                if (opts.cellHTML) p.h = sstr.h;
              } else p.v = "";
              break;
            case "b":
              p.v = parsexmlbool(p.v);
              break;
            case "d":
              if (opts.cellDates) p.v = parseDate(p.v, 1);
              else {
                p.v = datenum(parseDate(p.v, 1));
                p.t = "n";
              }
              break;
            /* error string in .w, number in .v */
            case "e":
              if (!opts || opts.cellText !== false) p.w = p.v;
              p.v = RBErr[p.v];
              break;
          }
          fmtid = fillid = 0;
          cf = null;
          if (do_format && tag.s !== void 0) {
            cf = styles.CellXf[tag.s];
            if (cf != null) {
              if (cf.numFmtId != null) fmtid = cf.numFmtId;
              if (opts.cellStyles) {
                if (cf.fillId != null) fillid = cf.fillId;
              }
            }
          }
          safe_format(p, fmtid, fillid, opts, themes, styles);
          if (opts.cellDates && do_format && p.t == "n" && fmt_is_date(table_fmt[fmtid])) {
            p.t = "d";
            p.v = numdate(p.v);
          }
          if (tag.cm && opts.xlmeta) {
            var cm = (opts.xlmeta.Cell || [])[+tag.cm - 1];
            if (cm && cm.type == "XLDAPR") p.D = true;
          }
          if (dense) {
            var _r = decode_cell(tag.r);
            if (!s[_r.r]) s[_r.r] = [];
            s[_r.r][_r.c] = p;
          } else s[tag.r] = p;
        }
      }
      if (rows.length > 0) s["!rows"] = rows;
    };
  })();
  function parse_BrtRowHdr(data, length) {
    var z = {};
    var tgt = data.l + length;
    z.r = data.read_shift(4);
    data.l += 4;
    var miyRw = data.read_shift(2);
    data.l += 1;
    var flags = data.read_shift(1);
    data.l = tgt;
    if (flags & 7) z.level = flags & 7;
    if (flags & 16) z.hidden = true;
    if (flags & 32) z.hpt = miyRw / 20;
    return z;
  }
  var parse_BrtWsDim = parse_UncheckedRfX;
  function parse_BrtWsFmtInfo() {
  }
  function parse_BrtWsProp(data, length) {
    var z = {};
    var f = data[data.l];
    ++data.l;
    z.above = !(f & 64);
    z.left = !(f & 128);
    data.l += 18;
    z.name = parse_XLSBCodeName(data, length - 19);
    return z;
  }
  function parse_BrtCellBlank(data) {
    var cell = parse_XLSBCell(data);
    return [cell];
  }
  function parse_BrtShortBlank(data) {
    var cell = parse_XLSBShortCell(data);
    return [cell];
  }
  function parse_BrtCellBool(data) {
    var cell = parse_XLSBCell(data);
    var fBool = data.read_shift(1);
    return [cell, fBool, "b"];
  }
  function parse_BrtShortBool(data) {
    var cell = parse_XLSBShortCell(data);
    var fBool = data.read_shift(1);
    return [cell, fBool, "b"];
  }
  function parse_BrtCellError(data) {
    var cell = parse_XLSBCell(data);
    var bError = data.read_shift(1);
    return [cell, bError, "e"];
  }
  function parse_BrtShortError(data) {
    var cell = parse_XLSBShortCell(data);
    var bError = data.read_shift(1);
    return [cell, bError, "e"];
  }
  function parse_BrtCellIsst(data) {
    var cell = parse_XLSBCell(data);
    var isst = data.read_shift(4);
    return [cell, isst, "s"];
  }
  function parse_BrtShortIsst(data) {
    var cell = parse_XLSBShortCell(data);
    var isst = data.read_shift(4);
    return [cell, isst, "s"];
  }
  function parse_BrtCellReal(data) {
    var cell = parse_XLSBCell(data);
    var value = parse_Xnum(data);
    return [cell, value, "n"];
  }
  function parse_BrtShortReal(data) {
    var cell = parse_XLSBShortCell(data);
    var value = parse_Xnum(data);
    return [cell, value, "n"];
  }
  function parse_BrtCellRk(data) {
    var cell = parse_XLSBCell(data);
    var value = parse_RkNumber(data);
    return [cell, value, "n"];
  }
  function parse_BrtShortRk(data) {
    var cell = parse_XLSBShortCell(data);
    var value = parse_RkNumber(data);
    return [cell, value, "n"];
  }
  function parse_BrtCellRString(data) {
    var cell = parse_XLSBCell(data);
    var value = parse_RichStr(data);
    return [cell, value, "is"];
  }
  function parse_BrtCellSt(data) {
    var cell = parse_XLSBCell(data);
    var value = parse_XLWideString(data);
    return [cell, value, "str"];
  }
  function parse_BrtShortSt(data) {
    var cell = parse_XLSBShortCell(data);
    var value = parse_XLWideString(data);
    return [cell, value, "str"];
  }
  function parse_BrtFmlaBool(data, length, opts) {
    var end = data.l + length;
    var cell = parse_XLSBCell(data);
    cell.r = opts["!row"];
    var value = data.read_shift(1);
    var o = [cell, value, "b"];
    if (opts.cellFormula) {
      data.l += 2;
      var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts);
      o[3] = stringify_formula(formula, null, cell, opts.supbooks, opts);
    } else data.l = end;
    return o;
  }
  function parse_BrtFmlaError(data, length, opts) {
    var end = data.l + length;
    var cell = parse_XLSBCell(data);
    cell.r = opts["!row"];
    var value = data.read_shift(1);
    var o = [cell, value, "e"];
    if (opts.cellFormula) {
      data.l += 2;
      var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts);
      o[3] = stringify_formula(formula, null, cell, opts.supbooks, opts);
    } else data.l = end;
    return o;
  }
  function parse_BrtFmlaNum(data, length, opts) {
    var end = data.l + length;
    var cell = parse_XLSBCell(data);
    cell.r = opts["!row"];
    var value = parse_Xnum(data);
    var o = [cell, value, "n"];
    if (opts.cellFormula) {
      data.l += 2;
      var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts);
      o[3] = stringify_formula(formula, null, cell, opts.supbooks, opts);
    } else data.l = end;
    return o;
  }
  function parse_BrtFmlaString(data, length, opts) {
    var end = data.l + length;
    var cell = parse_XLSBCell(data);
    cell.r = opts["!row"];
    var value = parse_XLWideString(data);
    var o = [cell, value, "str"];
    if (opts.cellFormula) {
      data.l += 2;
      var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts);
      o[3] = stringify_formula(formula, null, cell, opts.supbooks, opts);
    } else data.l = end;
    return o;
  }
  var parse_BrtMergeCell = parse_UncheckedRfX;
  function parse_BrtHLink(data, length) {
    var end = data.l + length;
    var rfx = parse_UncheckedRfX(data, 16);
    var relId = parse_XLNullableWideString(data);
    var loc = parse_XLWideString(data);
    var tooltip = parse_XLWideString(data);
    var display = parse_XLWideString(data);
    data.l = end;
    var o = { rfx, relId, loc, display };
    if (tooltip) o.Tooltip = tooltip;
    return o;
  }
  function parse_BrtPane() {
  }
  function parse_BrtArrFmla(data, length, opts) {
    var end = data.l + length;
    var rfx = parse_RfX(data, 16);
    var fAlwaysCalc = data.read_shift(1);
    var o = [rfx];
    o[2] = fAlwaysCalc;
    if (opts.cellFormula) {
      var formula = parse_XLSBArrayParsedFormula(data, end - data.l, opts);
      o[1] = formula;
    } else data.l = end;
    return o;
  }
  function parse_BrtShrFmla(data, length, opts) {
    var end = data.l + length;
    var rfx = parse_UncheckedRfX(data, 16);
    var o = [rfx];
    if (opts.cellFormula) {
      var formula = parse_XLSBSharedParsedFormula(data, end - data.l, opts);
      o[1] = formula;
      data.l = end;
    } else data.l = end;
    return o;
  }
  var BrtMarginKeys = ["left", "right", "top", "bottom", "header", "footer"];
  function parse_BrtMargins(data) {
    var margins = {};
    BrtMarginKeys.forEach(function(k) {
      margins[k] = parse_Xnum(data, 8);
    });
    return margins;
  }
  function parse_BrtBeginWsView(data) {
    var f = data.read_shift(2);
    data.l += 28;
    return { RTL: f & 32 };
  }
  function parse_BrtDVal() {
  }
  function parse_BrtDVal14() {
  }
  function parse_ws_bin(data, _opts, idx, rels, wb, themes, styles) {
    if (!data) return data;
    var opts = _opts || {};
    if (!rels) rels = { "!id": {} };
    if (DENSE != null && opts.dense == null) opts.dense = DENSE;
    var s = opts.dense ? [] : {};
    var ref;
    var refguess = { s: { r: 2e6, c: 2e6 }, e: { r: 0, c: 0 } };
    var state = [];
    var pass = false, end = false;
    var row, p, cf, R, C, addr, sstr, rr, cell;
    var merges = [];
    opts.biff = 12;
    opts["!row"] = 0;
    var ai = 0, af = false;
    var arrayf = [];
    var sharedf = {};
    var supbooks = opts.supbooks || /*::(*/
    wb.supbooks || [[]];
    supbooks.sharedf = sharedf;
    supbooks.arrayf = arrayf;
    supbooks.SheetNames = wb.SheetNames || wb.Sheets.map(function(x) {
      return x.name;
    });
    if (!opts.supbooks) {
      opts.supbooks = supbooks;
      if (wb.Names) for (var i = 0; i < wb.Names.length; ++i) supbooks[0][i + 1] = wb.Names[i];
    }
    var colinfo = [], rowinfo = [];
    var seencol = false;
    XLSBRecordEnum[16] = { n: "BrtShortReal", f: parse_BrtShortReal };
    var cm, vm;
    recordhopper(data, function ws_parse(val, RR, RT) {
      if (end) return;
      switch (RT) {
        case 148:
          ref = val;
          break;
        case 0:
          row = val;
          if (opts.sheetRows && opts.sheetRows <= row.r) end = true;
          rr = encode_row(R = row.r);
          opts["!row"] = row.r;
          if (val.hidden || val.hpt || val.level != null) {
            if (val.hpt) val.hpx = pt2px(val.hpt);
            rowinfo[val.r] = val;
          }
          break;
        case 2:
        /* 'BrtCellRk' */
        case 3:
        /* 'BrtCellError' */
        case 4:
        /* 'BrtCellBool' */
        case 5:
        /* 'BrtCellReal' */
        case 6:
        /* 'BrtCellSt' */
        case 7:
        /* 'BrtCellIsst' */
        case 8:
        /* 'BrtFmlaString' */
        case 9:
        /* 'BrtFmlaNum' */
        case 10:
        /* 'BrtFmlaBool' */
        case 11:
        /* 'BrtFmlaError' */
        case 13:
        /* 'BrtShortRk' */
        case 14:
        /* 'BrtShortError' */
        case 15:
        /* 'BrtShortBool' */
        case 16:
        /* 'BrtShortReal' */
        case 17:
        /* 'BrtShortSt' */
        case 18:
        /* 'BrtShortIsst' */
        case 62:
          p = { t: val[2] };
          switch (val[2]) {
            case "n":
              p.v = val[1];
              break;
            case "s":
              sstr = strs[val[1]];
              p.v = sstr.t;
              p.r = sstr.r;
              break;
            case "b":
              p.v = val[1] ? true : false;
              break;
            case "e":
              p.v = val[1];
              if (opts.cellText !== false) p.w = BErr[p.v];
              break;
            case "str":
              p.t = "s";
              p.v = val[1];
              break;
            case "is":
              p.t = "s";
              p.v = val[1].t;
              break;
          }
          if (cf = styles.CellXf[val[0].iStyleRef]) safe_format(p, cf.numFmtId, null, opts, themes, styles);
          C = val[0].c == -1 ? C + 1 : val[0].c;
          if (opts.dense) {
            if (!s[R]) s[R] = [];
            s[R][C] = p;
          } else s[encode_col(C) + rr] = p;
          if (opts.cellFormula) {
            af = false;
            for (ai = 0; ai < arrayf.length; ++ai) {
              var aii = arrayf[ai];
              if (row.r >= aii[0].s.r && row.r <= aii[0].e.r) {
                if (C >= aii[0].s.c && C <= aii[0].e.c) {
                  p.F = encode_range(aii[0]);
                  af = true;
                }
              }
            }
            if (!af && val.length > 3) p.f = val[3];
          }
          if (refguess.s.r > row.r) refguess.s.r = row.r;
          if (refguess.s.c > C) refguess.s.c = C;
          if (refguess.e.r < row.r) refguess.e.r = row.r;
          if (refguess.e.c < C) refguess.e.c = C;
          if (opts.cellDates && cf && p.t == "n" && fmt_is_date(table_fmt[cf.numFmtId])) {
            var _d = SSF_parse_date_code(p.v);
            if (_d) {
              p.t = "d";
              p.v = new Date(_d.y, _d.m - 1, _d.d, _d.H, _d.M, _d.S, _d.u);
            }
          }
          if (cm) {
            if (cm.type == "XLDAPR") p.D = true;
            cm = void 0;
          }
          if (vm) vm = void 0;
          break;
        case 1:
        /* 'BrtCellBlank' */
        case 12:
          if (!opts.sheetStubs || pass) break;
          p = { t: "z", v: void 0 };
          C = val[0].c == -1 ? C + 1 : val[0].c;
          if (opts.dense) {
            if (!s[R]) s[R] = [];
            s[R][C] = p;
          } else s[encode_col(C) + rr] = p;
          if (refguess.s.r > row.r) refguess.s.r = row.r;
          if (refguess.s.c > C) refguess.s.c = C;
          if (refguess.e.r < row.r) refguess.e.r = row.r;
          if (refguess.e.c < C) refguess.e.c = C;
          if (cm) {
            if (cm.type == "XLDAPR") p.D = true;
            cm = void 0;
          }
          if (vm) vm = void 0;
          break;
        case 176:
          merges.push(val);
          break;
        case 49:
          {
            cm = ((opts.xlmeta || {}).Cell || [])[val - 1];
          }
          break;
        case 494:
          var rel = rels["!id"][val.relId];
          if (rel) {
            val.Target = rel.Target;
            if (val.loc) val.Target += "#" + val.loc;
            val.Rel = rel;
          } else if (val.relId == "") {
            val.Target = "#" + val.loc;
          }
          for (R = val.rfx.s.r; R <= val.rfx.e.r; ++R) for (C = val.rfx.s.c; C <= val.rfx.e.c; ++C) {
            if (opts.dense) {
              if (!s[R]) s[R] = [];
              if (!s[R][C]) s[R][C] = { t: "z", v: void 0 };
              s[R][C].l = val;
            } else {
              addr = encode_cell({ c: C, r: R });
              if (!s[addr]) s[addr] = { t: "z", v: void 0 };
              s[addr].l = val;
            }
          }
          break;
        case 426:
          if (!opts.cellFormula) break;
          arrayf.push(val);
          cell = opts.dense ? s[R][C] : s[encode_col(C) + rr];
          cell.f = stringify_formula(val[1], refguess, { r: row.r, c: C }, supbooks, opts);
          cell.F = encode_range(val[0]);
          break;
        case 427:
          if (!opts.cellFormula) break;
          sharedf[encode_cell(val[0].s)] = val[1];
          cell = opts.dense ? s[R][C] : s[encode_col(C) + rr];
          cell.f = stringify_formula(val[1], refguess, { r: row.r, c: C }, supbooks, opts);
          break;
        /* identical to 'ColInfo' in XLS */
        case 60:
          if (!opts.cellStyles) break;
          while (val.e >= val.s) {
            colinfo[val.e--] = { width: val.w / 256, hidden: !!(val.flags & 1), level: val.level };
            if (!seencol) {
              seencol = true;
              find_mdw_colw(val.w / 256);
            }
            process_col(colinfo[val.e + 1]);
          }
          break;
        case 161:
          s["!autofilter"] = { ref: encode_range(val) };
          break;
        case 476:
          s["!margins"] = val;
          break;
        case 147:
          if (!wb.Sheets[idx]) wb.Sheets[idx] = {};
          if (val.name) wb.Sheets[idx].CodeName = val.name;
          if (val.above || val.left) s["!outline"] = { above: val.above, left: val.left };
          break;
        case 137:
          if (!wb.Views) wb.Views = [{}];
          if (!wb.Views[0]) wb.Views[0] = {};
          if (val.RTL) wb.Views[0].RTL = true;
          break;
        case 485:
          break;
        case 64:
        /* 'BrtDVal' */
        case 1053:
          break;
        case 151:
          break;
        case 152:
        /* 'BrtSel' */
        case 175:
        /* 'BrtAFilterDateGroupItem' */
        case 644:
        /* 'BrtActiveX' */
        case 625:
        /* 'BrtBigName' */
        case 562:
        /* 'BrtBkHim' */
        case 396:
        /* 'BrtBrk' */
        case 1112:
        /* 'BrtCFIcon' */
        case 1146:
        /* 'BrtCFRuleExt' */
        case 471:
        /* 'BrtCFVO' */
        case 1050:
        /* 'BrtCFVO14' */
        case 649:
        /* 'BrtCellIgnoreEC' */
        case 1105:
        /* 'BrtCellIgnoreEC14' */
        case 589:
        /* 'BrtCellSmartTagProperty' */
        case 607:
        /* 'BrtCellWatch' */
        case 564:
        /* 'BrtColor' */
        case 1055:
        /* 'BrtColor14' */
        case 168:
        /* 'BrtColorFilter' */
        case 174:
        /* 'BrtCustomFilter' */
        case 1180:
        /* 'BrtCustomFilter14' */
        case 499:
        /* 'BrtDRef' */
        case 507:
        /* 'BrtDXF' */
        case 550:
        /* 'BrtDrawing' */
        case 171:
        /* 'BrtDynamicFilter' */
        case 167:
        /* 'BrtFilter' */
        case 1177:
        /* 'BrtFilter14' */
        case 169:
        /* 'BrtIconFilter' */
        case 1181:
        /* 'BrtIconFilter14' */
        case 551:
        /* 'BrtLegacyDrawing' */
        case 552:
        /* 'BrtLegacyDrawingHF' */
        case 661:
        /* 'BrtListPart' */
        case 639:
        /* 'BrtOleObject' */
        case 478:
        /* 'BrtPageSetup' */
        case 537:
        /* 'BrtPhoneticInfo' */
        case 477:
        /* 'BrtPrintOptions' */
        case 536:
        /* 'BrtRangeProtection' */
        case 1103:
        /* 'BrtRangeProtection14' */
        case 680:
        /* 'BrtRangeProtectionIso' */
        case 1104:
        /* 'BrtRangeProtectionIso14' */
        case 1024:
        /* 'BrtRwDescent' */
        case 663:
        /* 'BrtSheetCalcProp' */
        case 535:
        /* 'BrtSheetProtection' */
        case 678:
        /* 'BrtSheetProtectionIso' */
        case 504:
        /* 'BrtSlc' */
        case 1043:
        /* 'BrtSparkline' */
        case 428:
        /* 'BrtTable' */
        case 170:
        /* 'BrtTop10Filter' */
        case 3072:
        /* 'BrtUid' */
        case 50:
        /* 'BrtValueMeta' */
        case 2070:
        /* 'BrtWebExtension' */
        case 1045:
          break;
        case 35:
          pass = true;
          break;
        case 36:
          pass = false;
          break;
        case 37:
          state.push(RT);
          pass = true;
          break;
        case 38:
          state.pop();
          pass = false;
          break;
        default:
          if (RR.T) {
          } else if (!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    }, opts);
    delete opts.supbooks;
    delete opts["!row"];
    if (!s["!ref"] && (refguess.s.r < 2e6 || ref && (ref.e.r > 0 || ref.e.c > 0 || ref.s.r > 0 || ref.s.c > 0))) s["!ref"] = encode_range(ref || refguess);
    if (opts.sheetRows && s["!ref"]) {
      var tmpref = safe_decode_range(s["!ref"]);
      if (opts.sheetRows <= +tmpref.e.r) {
        tmpref.e.r = opts.sheetRows - 1;
        if (tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r;
        if (tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r;
        if (tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c;
        if (tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c;
        s["!fullref"] = s["!ref"];
        s["!ref"] = encode_range(tmpref);
      }
    }
    if (merges.length > 0) s["!merges"] = merges;
    if (colinfo.length > 0) s["!cols"] = colinfo;
    if (rowinfo.length > 0) s["!rows"] = rowinfo;
    return s;
  }
  function parse_Cache(data) {
    var col = [];
    var num = data.match(/^<c:numCache>/);
    var f;
    (data.match(/<c:pt idx="(\d*)">(.*?)<\/c:pt>/mg) || []).forEach(function(pt) {
      var q = pt.match(/<c:pt idx="(\d*?)"><c:v>(.*)<\/c:v><\/c:pt>/);
      if (!q) return;
      col[+q[1]] = num ? +q[2] : q[2];
    });
    var nf = unescapexml((data.match(/<c:formatCode>([\s\S]*?)<\/c:formatCode>/) || ["", "General"])[1]);
    (data.match(/<c:f>(.*?)<\/c:f>/mg) || []).forEach(function(F) {
      f = F.replace(/<.*?>/g, "");
    });
    return [col, nf, f];
  }
  function parse_chart(data, name, opts, rels, wb, csheet) {
    var cs = csheet || { "!type": "chart" };
    if (!data) return csheet;
    var C = 0, R = 0, col = "A";
    var refguess = { s: { r: 2e6, c: 2e6 }, e: { r: 0, c: 0 } };
    (data.match(/<c:numCache>[\s\S]*?<\/c:numCache>/gm) || []).forEach(function(nc) {
      var cache = parse_Cache(nc);
      refguess.s.r = refguess.s.c = 0;
      refguess.e.c = C;
      col = encode_col(C);
      cache[0].forEach(function(n, i) {
        cs[col + encode_row(i)] = { t: "n", v: n, z: cache[1] };
        R = i;
      });
      if (refguess.e.r < R) refguess.e.r = R;
      ++C;
    });
    if (C > 0) cs["!ref"] = encode_range(refguess);
    return cs;
  }
  function parse_cs_xml(data, opts, idx, rels, wb) {
    if (!data) return data;
    if (!rels) rels = { "!id": {} };
    var s = { "!type": "chart", "!drawel": null, "!rel": "" };
    var m;
    var sheetPr = data.match(sheetprregex);
    if (sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx);
    if (m = data.match(/drawing r:id="(.*?)"/)) s["!rel"] = m[1];
    if (rels["!id"][s["!rel"]]) s["!drawel"] = rels["!id"][s["!rel"]];
    return s;
  }
  function parse_BrtCsProp(data, length) {
    data.l += 10;
    var name = parse_XLWideString(data, length - 10);
    return { name };
  }
  function parse_cs_bin(data, opts, idx, rels, wb) {
    if (!data) return data;
    if (!rels) rels = { "!id": {} };
    var s = { "!type": "chart", "!drawel": null, "!rel": "" };
    var state = [];
    var pass = false;
    recordhopper(data, function cs_parse(val, R, RT) {
      switch (RT) {
        case 550:
          s["!rel"] = val;
          break;
        case 651:
          if (!wb.Sheets[idx]) wb.Sheets[idx] = {};
          if (val.name) wb.Sheets[idx].CodeName = val.name;
          break;
        case 562:
        /* 'BrtBkHim' */
        case 652:
        /* 'BrtCsPageSetup' */
        case 669:
        /* 'BrtCsProtection' */
        case 679:
        /* 'BrtCsProtectionIso' */
        case 551:
        /* 'BrtLegacyDrawing' */
        case 552:
        /* 'BrtLegacyDrawingHF' */
        case 476:
        /* 'BrtMargins' */
        case 3072:
          break;
        case 35:
          pass = true;
          break;
        case 36:
          pass = false;
          break;
        case 37:
          state.push(RT);
          break;
        case 38:
          state.pop();
          break;
        default:
          if (R.T > 0) state.push(RT);
          else if (R.T < 0) state.pop();
          else if (!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    }, opts);
    if (rels["!id"][s["!rel"]]) s["!drawel"] = rels["!id"][s["!rel"]];
    return s;
  }
  var WBPropsDef = [
    ["allowRefreshQuery", false, "bool"],
    ["autoCompressPictures", true, "bool"],
    ["backupFile", false, "bool"],
    ["checkCompatibility", false, "bool"],
    ["CodeName", ""],
    ["date1904", false, "bool"],
    ["defaultThemeVersion", 0, "int"],
    ["filterPrivacy", false, "bool"],
    ["hidePivotFieldList", false, "bool"],
    ["promptedSolutions", false, "bool"],
    ["publishItems", false, "bool"],
    ["refreshAllConnections", false, "bool"],
    ["saveExternalLinkValues", true, "bool"],
    ["showBorderUnselectedTables", true, "bool"],
    ["showInkAnnotation", true, "bool"],
    ["showObjects", "all"],
    ["showPivotChartFilter", false, "bool"],
    ["updateLinks", "userSet"]
  ];
  var WBViewDef = [
    ["activeTab", 0, "int"],
    ["autoFilterDateGrouping", true, "bool"],
    ["firstSheet", 0, "int"],
    ["minimized", false, "bool"],
    ["showHorizontalScroll", true, "bool"],
    ["showSheetTabs", true, "bool"],
    ["showVerticalScroll", true, "bool"],
    ["tabRatio", 600, "int"],
    ["visibility", "visible"]
    //window{Height,Width}, {x,y}Window
  ];
  var SheetDef = [
    //['state', 'visible']
  ];
  var CalcPrDef = [
    ["calcCompleted", "true"],
    ["calcMode", "auto"],
    ["calcOnSave", "true"],
    ["concurrentCalc", "true"],
    ["fullCalcOnLoad", "false"],
    ["fullPrecision", "true"],
    ["iterate", "false"],
    ["iterateCount", "100"],
    ["iterateDelta", "0.001"],
    ["refMode", "A1"]
  ];
  function push_defaults_array(target, defaults) {
    for (var j = 0; j != target.length; ++j) {
      var w = target[j];
      for (var i = 0; i != defaults.length; ++i) {
        var z = defaults[i];
        if (w[z[0]] == null) w[z[0]] = z[1];
        else switch (z[2]) {
          case "bool":
            if (typeof w[z[0]] == "string") w[z[0]] = parsexmlbool(w[z[0]]);
            break;
          case "int":
            if (typeof w[z[0]] == "string") w[z[0]] = parseInt(w[z[0]], 10);
            break;
        }
      }
    }
  }
  function push_defaults(target, defaults) {
    for (var i = 0; i != defaults.length; ++i) {
      var z = defaults[i];
      if (target[z[0]] == null) target[z[0]] = z[1];
      else switch (z[2]) {
        case "bool":
          if (typeof target[z[0]] == "string") target[z[0]] = parsexmlbool(target[z[0]]);
          break;
        case "int":
          if (typeof target[z[0]] == "string") target[z[0]] = parseInt(target[z[0]], 10);
          break;
      }
    }
  }
  function parse_wb_defaults(wb) {
    push_defaults(wb.WBProps, WBPropsDef);
    push_defaults(wb.CalcPr, CalcPrDef);
    push_defaults_array(wb.WBView, WBViewDef);
    push_defaults_array(wb.Sheets, SheetDef);
    _ssfopts.date1904 = parsexmlbool(wb.WBProps.date1904);
  }
  var badchars = /* @__PURE__ */ "][*?/\\".split("");
  function check_ws_name(n, safe) {
    if (n.length > 31) {
      if (safe) return false;
      throw new Error("Sheet names cannot exceed 31 chars");
    }
    var _good = true;
    badchars.forEach(function(c) {
      if (n.indexOf(c) == -1) return;
      if (!safe) throw new Error("Sheet name cannot contain : \\ / ? * [ ]");
      _good = false;
    });
    return _good;
  }
  var wbnsregex = /<\w+:workbook/;
  function parse_wb_xml(data, opts) {
    if (!data) throw new Error("Could not find file");
    var wb = (
      /*::(*/
      { AppVersion: {}, WBProps: {}, WBView: [], Sheets: [], CalcPr: {}, Names: [], xmlns: "" }
    );
    var pass = false, xmlns = "xmlns";
    var dname = {}, dnstart = 0;
    data.replace(tagregex, function xml_wb(x, idx) {
      var y = parsexmltag(x);
      switch (strip_ns(y[0])) {
        case "<?xml":
          break;
        /* 18.2.27 workbook CT_Workbook 1 */
        case "<workbook":
          if (x.match(wbnsregex)) xmlns = "xmlns" + x.match(/<(\w+):/)[1];
          wb.xmlns = y[xmlns];
          break;
        case "</workbook>":
          break;
        /* 18.2.13 fileVersion CT_FileVersion ? */
        case "<fileVersion":
          delete y[0];
          wb.AppVersion = y;
          break;
        case "<fileVersion/>":
        case "</fileVersion>":
          break;
        /* 18.2.12 fileSharing CT_FileSharing ? */
        case "<fileSharing":
          break;
        case "<fileSharing/>":
          break;
        /* 18.2.28 workbookPr CT_WorkbookPr ? */
        case "<workbookPr":
        case "<workbookPr/>":
          WBPropsDef.forEach(function(w) {
            if (y[w[0]] == null) return;
            switch (w[2]) {
              case "bool":
                wb.WBProps[w[0]] = parsexmlbool(y[w[0]]);
                break;
              case "int":
                wb.WBProps[w[0]] = parseInt(y[w[0]], 10);
                break;
              default:
                wb.WBProps[w[0]] = y[w[0]];
            }
          });
          if (y.codeName) wb.WBProps.CodeName = utf8read(y.codeName);
          break;
        case "</workbookPr>":
          break;
        /* 18.2.29 workbookProtection CT_WorkbookProtection ? */
        case "<workbookProtection":
          break;
        case "<workbookProtection/>":
          break;
        /* 18.2.1  bookViews CT_BookViews ? */
        case "<bookViews":
        case "<bookViews>":
        case "</bookViews>":
          break;
        /* 18.2.30   workbookView CT_BookView + */
        case "<workbookView":
        case "<workbookView/>":
          delete y[0];
          wb.WBView.push(y);
          break;
        case "</workbookView>":
          break;
        /* 18.2.20 sheets CT_Sheets 1 */
        case "<sheets":
        case "<sheets>":
        case "</sheets>":
          break;
        // aggregate sheet
        /* 18.2.19   sheet CT_Sheet + */
        case "<sheet":
          switch (y.state) {
            case "hidden":
              y.Hidden = 1;
              break;
            case "veryHidden":
              y.Hidden = 2;
              break;
            default:
              y.Hidden = 0;
          }
          delete y.state;
          y.name = unescapexml(utf8read(y.name));
          delete y[0];
          wb.Sheets.push(y);
          break;
        case "</sheet>":
          break;
        /* 18.2.15 functionGroups CT_FunctionGroups ? */
        case "<functionGroups":
        case "<functionGroups/>":
          break;
        /* 18.2.14   functionGroup CT_FunctionGroup + */
        case "<functionGroup":
          break;
        /* 18.2.9  externalReferences CT_ExternalReferences ? */
        case "<externalReferences":
        case "</externalReferences>":
        case "<externalReferences>":
          break;
        /* 18.2.8    externalReference CT_ExternalReference + */
        case "<externalReference":
          break;
        /* 18.2.6  definedNames CT_DefinedNames ? */
        case "<definedNames/>":
          break;
        case "<definedNames>":
        case "<definedNames":
          pass = true;
          break;
        case "</definedNames>":
          pass = false;
          break;
        /* 18.2.5    definedName CT_DefinedName + */
        case "<definedName":
          {
            dname = {};
            dname.Name = utf8read(y.name);
            if (y.comment) dname.Comment = y.comment;
            if (y.localSheetId) dname.Sheet = +y.localSheetId;
            if (parsexmlbool(y.hidden || "0")) dname.Hidden = true;
            dnstart = idx + x.length;
          }
          break;
        case "</definedName>":
          {
            dname.Ref = unescapexml(utf8read(data.slice(dnstart, idx)));
            wb.Names.push(dname);
          }
          break;
        case "<definedName/>":
          break;
        /* 18.2.2  calcPr CT_CalcPr ? */
        case "<calcPr":
          delete y[0];
          wb.CalcPr = y;
          break;
        case "<calcPr/>":
          delete y[0];
          wb.CalcPr = y;
          break;
        case "</calcPr>":
          break;
        /* 18.2.16 oleSize CT_OleSize ? (ref required) */
        case "<oleSize":
          break;
        /* 18.2.4  customWorkbookViews CT_CustomWorkbookViews ? */
        case "<customWorkbookViews>":
        case "</customWorkbookViews>":
        case "<customWorkbookViews":
          break;
        /* 18.2.3  customWorkbookView CT_CustomWorkbookView + */
        case "<customWorkbookView":
        case "</customWorkbookView>":
          break;
        /* 18.2.18 pivotCaches CT_PivotCaches ? */
        case "<pivotCaches>":
        case "</pivotCaches>":
        case "<pivotCaches":
          break;
        /* 18.2.17 pivotCache CT_PivotCache ? */
        case "<pivotCache":
          break;
        /* 18.2.21 smartTagPr CT_SmartTagPr ? */
        case "<smartTagPr":
        case "<smartTagPr/>":
          break;
        /* 18.2.23 smartTagTypes CT_SmartTagTypes ? */
        case "<smartTagTypes":
        case "<smartTagTypes>":
        case "</smartTagTypes>":
          break;
        /* 18.2.22 smartTagType CT_SmartTagType ? */
        case "<smartTagType":
          break;
        /* 18.2.24 webPublishing CT_WebPublishing ? */
        case "<webPublishing":
        case "<webPublishing/>":
          break;
        /* 18.2.11 fileRecoveryPr CT_FileRecoveryPr ? */
        case "<fileRecoveryPr":
        case "<fileRecoveryPr/>":
          break;
        /* 18.2.26 webPublishObjects CT_WebPublishObjects ? */
        case "<webPublishObjects>":
        case "<webPublishObjects":
        case "</webPublishObjects>":
          break;
        /* 18.2.25 webPublishObject CT_WebPublishObject ? */
        case "<webPublishObject":
          break;
        /* 18.2.10 extLst CT_ExtensionList ? */
        case "<extLst":
        case "<extLst>":
        case "</extLst>":
        case "<extLst/>":
          break;
        /* 18.2.7  ext CT_Extension + */
        case "<ext":
          pass = true;
          break;
        //TODO: check with versions of excel
        case "</ext>":
          pass = false;
          break;
        /* Others */
        case "<ArchID":
          break;
        case "<AlternateContent":
        case "<AlternateContent>":
          pass = true;
          break;
        case "</AlternateContent>":
          pass = false;
          break;
        /* TODO */
        case "<revisionPtr":
          break;
        default:
          if (!pass && opts.WTF) throw new Error("unrecognized " + y[0] + " in workbook");
      }
      return x;
    });
    if (XMLNS_main.indexOf(wb.xmlns) === -1) throw new Error("Unknown Namespace: " + wb.xmlns);
    parse_wb_defaults(wb);
    return wb;
  }
  function parse_BrtBundleSh(data, length) {
    var z = {};
    z.Hidden = data.read_shift(4);
    z.iTabID = data.read_shift(4);
    z.strRelID = parse_RelID(data, length - 8);
    z.name = parse_XLWideString(data);
    return z;
  }
  function parse_BrtWbProp(data, length) {
    var o = {};
    var flags = data.read_shift(4);
    o.defaultThemeVersion = data.read_shift(4);
    var strName = length > 8 ? parse_XLWideString(data) : "";
    if (strName.length > 0) o.CodeName = strName;
    o.autoCompressPictures = !!(flags & 65536);
    o.backupFile = !!(flags & 64);
    o.checkCompatibility = !!(flags & 4096);
    o.date1904 = !!(flags & 1);
    o.filterPrivacy = !!(flags & 8);
    o.hidePivotFieldList = !!(flags & 1024);
    o.promptedSolutions = !!(flags & 16);
    o.publishItems = !!(flags & 2048);
    o.refreshAllConnections = !!(flags & 262144);
    o.saveExternalLinkValues = !!(flags & 128);
    o.showBorderUnselectedTables = !!(flags & 4);
    o.showInkAnnotation = !!(flags & 32);
    o.showObjects = ["all", "placeholders", "none"][flags >> 13 & 3];
    o.showPivotChartFilter = !!(flags & 32768);
    o.updateLinks = ["userSet", "never", "always"][flags >> 8 & 3];
    return o;
  }
  function parse_BrtFRTArchID$(data, length) {
    var o = {};
    data.read_shift(4);
    o.ArchID = data.read_shift(4);
    data.l += length - 8;
    return o;
  }
  function parse_BrtName(data, length, opts) {
    var end = data.l + length;
    data.l += 4;
    data.l += 1;
    var itab = data.read_shift(4);
    var name = parse_XLNameWideString(data);
    var formula = parse_XLSBNameParsedFormula(data, 0, opts);
    var comment = parse_XLNullableWideString(data);
    data.l = end;
    var out = { Name: name, Ptg: formula };
    if (itab < 268435455) out.Sheet = itab;
    if (comment) out.Comment = comment;
    return out;
  }
  function parse_wb_bin(data, opts) {
    var wb = { AppVersion: {}, WBProps: {}, WBView: [], Sheets: [], CalcPr: {}, xmlns: "" };
    var state = [];
    var pass = false;
    if (!opts) opts = {};
    opts.biff = 12;
    var Names = [];
    var supbooks = [[]];
    supbooks.SheetNames = [];
    supbooks.XTI = [];
    XLSBRecordEnum[16] = { n: "BrtFRTArchID$", f: parse_BrtFRTArchID$ };
    recordhopper(data, function hopper_wb(val, R, RT) {
      switch (RT) {
        case 156:
          supbooks.SheetNames.push(val.name);
          wb.Sheets.push(val);
          break;
        case 153:
          wb.WBProps = val;
          break;
        case 39:
          if (val.Sheet != null) opts.SID = val.Sheet;
          val.Ref = stringify_formula(val.Ptg, null, null, supbooks, opts);
          delete opts.SID;
          delete val.Ptg;
          Names.push(val);
          break;
        case 1036:
          break;
        case 357:
        /* 'BrtSupSelf' */
        case 358:
        /* 'BrtSupSame' */
        case 355:
        /* 'BrtSupBookSrc' */
        case 667:
          if (!supbooks[0].length) supbooks[0] = [RT, val];
          else supbooks.push([RT, val]);
          supbooks[supbooks.length - 1].XTI = [];
          break;
        case 362:
          if (supbooks.length === 0) {
            supbooks[0] = [];
            supbooks[0].XTI = [];
          }
          supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val);
          supbooks.XTI = supbooks.XTI.concat(val);
          break;
        case 361:
          break;
        case 2071:
        /* 'BrtAbsPath15' */
        case 158:
        /* 'BrtBookView' */
        case 143:
        /* 'BrtBeginBundleShs' */
        case 664:
        /* 'BrtBeginFnGroup' */
        case 353:
          break;
        /* case 'BrtModelTimeGroupingCalcCol' */
        case 3072:
        /* 'BrtUid' */
        case 3073:
        /* 'BrtRevisionPtr' */
        case 534:
        /* 'BrtBookProtection' */
        case 677:
        /* 'BrtBookProtectionIso' */
        case 157:
        /* 'BrtCalcProp' */
        case 610:
        /* 'BrtCrashRecErr' */
        case 2050:
        /* 'BrtDecoupledPivotCacheID' */
        case 155:
        /* 'BrtFileRecover' */
        case 548:
        /* 'BrtFileSharing' */
        case 676:
        /* 'BrtFileSharingIso' */
        case 128:
        /* 'BrtFileVersion' */
        case 665:
        /* 'BrtFnGroup' */
        case 2128:
        /* 'BrtModelRelationship' */
        case 2125:
        /* 'BrtModelTable' */
        case 549:
        /* 'BrtOleSize' */
        case 2053:
        /* 'BrtPivotTableRef' */
        case 596:
        /* 'BrtSmartTagType' */
        case 2076:
        /* 'BrtTableSlicerCacheID' */
        case 2075:
        /* 'BrtTableSlicerCacheIDs' */
        case 2082:
        /* 'BrtTimelineCachePivotCacheID' */
        case 397:
        /* 'BrtUserBookView' */
        case 154:
        /* 'BrtWbFactoid' */
        case 1117:
        /* 'BrtWbProp14' */
        case 553:
        /* 'BrtWebOpt' */
        case 2091:
          break;
        case 35:
          state.push(RT);
          pass = true;
          break;
        case 36:
          state.pop();
          pass = false;
          break;
        case 37:
          state.push(RT);
          pass = true;
          break;
        case 38:
          state.pop();
          pass = false;
          break;
        case 16:
          break;
        default:
          if (R.T) {
          } else if (!pass || opts.WTF && state[state.length - 1] != 37 && state[state.length - 1] != 35) throw new Error("Unexpected record 0x" + RT.toString(16));
      }
    }, opts);
    parse_wb_defaults(wb);
    wb.Names = Names;
    wb.supbooks = supbooks;
    return wb;
  }
  function parse_wb(data, name, opts) {
    if (name.slice(-4) === ".bin") return parse_wb_bin(data, opts);
    return parse_wb_xml(data, opts);
  }
  function parse_ws(data, name, idx, opts, rels, wb, themes, styles) {
    if (name.slice(-4) === ".bin") return parse_ws_bin(data, opts, idx, rels, wb, themes, styles);
    return parse_ws_xml(data, opts, idx, rels, wb, themes, styles);
  }
  function parse_cs(data, name, idx, opts, rels, wb, themes, styles) {
    if (name.slice(-4) === ".bin") return parse_cs_bin(data, opts, idx, rels, wb, themes, styles);
    return parse_cs_xml(data, opts, idx, rels, wb, themes, styles);
  }
  function parse_ms(data, name, idx, opts, rels, wb, themes, styles) {
    if (name.slice(-4) === ".bin") return parse_ms_bin(data, opts, idx, rels, wb, themes, styles);
    return parse_ms_xml(data, opts, idx, rels, wb, themes, styles);
  }
  function parse_ds(data, name, idx, opts, rels, wb, themes, styles) {
    if (name.slice(-4) === ".bin") return parse_ds_bin(data, opts, idx, rels, wb, themes, styles);
    return parse_ds_xml(data, opts, idx, rels, wb, themes, styles);
  }
  function parse_sty(data, name, themes, opts) {
    if (name.slice(-4) === ".bin") return parse_sty_bin(data, themes, opts);
    return parse_sty_xml(data, themes, opts);
  }
  function parse_theme(data, name, opts) {
    return parse_theme_xml(data, opts);
  }
  function parse_sst(data, name, opts) {
    if (name.slice(-4) === ".bin") return parse_sst_bin(data, opts);
    return parse_sst_xml(data, opts);
  }
  function parse_cmnt(data, name, opts) {
    if (name.slice(-4) === ".bin") return parse_comments_bin(data, opts);
    return parse_comments_xml(data, opts);
  }
  function parse_cc(data, name, opts) {
    if (name.slice(-4) === ".bin") return parse_cc_bin(data, name, opts);
    return parse_cc_xml(data, name, opts);
  }
  function parse_xlink(data, rel, name, opts) {
    if (name.slice(-4) === ".bin") return parse_xlink_bin(data, rel, name, opts);
    return parse_xlink_xml(data, rel, name, opts);
  }
  function parse_xlmeta(data, name, opts) {
    if (name.slice(-4) === ".bin") return parse_xlmeta_bin(data, name, opts);
    return parse_xlmeta_xml(data, name, opts);
  }
  var attregexg2 = /([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g;
  var attregex2 = /([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/;
  function xlml_parsexmltag(tag, skip_root) {
    var words = tag.split(/\s+/);
    var z = [];
    if (!skip_root) z[0] = words[0];
    if (words.length === 1) return z;
    var m = tag.match(attregexg2), y, j, w, i;
    if (m) for (i = 0; i != m.length; ++i) {
      y = m[i].match(attregex2);
      if ((j = y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1, y[2].length - 1);
      else {
        if (y[1].slice(0, 6) === "xmlns:") w = "xmlns" + y[1].slice(6);
        else w = y[1].slice(j + 1);
        z[w] = y[2].slice(1, y[2].length - 1);
      }
    }
    return z;
  }
  function xlml_parsexmltagobj(tag) {
    var words = tag.split(/\s+/);
    var z = {};
    if (words.length === 1) return z;
    var m = tag.match(attregexg2), y, j, w, i;
    if (m) for (i = 0; i != m.length; ++i) {
      y = m[i].match(attregex2);
      if ((j = y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1, y[2].length - 1);
      else {
        if (y[1].slice(0, 6) === "xmlns:") w = "xmlns" + y[1].slice(6);
        else w = y[1].slice(j + 1);
        z[w] = y[2].slice(1, y[2].length - 1);
      }
    }
    return z;
  }
  var XLMLFormatMap;
  function xlml_format(format, value) {
    var fmt = XLMLFormatMap[format] || unescapexml(format);
    if (fmt === "General") return SSF_general(value);
    return SSF_format(fmt, value);
  }
  function xlml_set_custprop(Custprops, key, cp, val) {
    var oval = val;
    switch ((cp[0].match(/dt:dt="([\w.]+)"/) || ["", ""])[1]) {
      case "boolean":
        oval = parsexmlbool(val);
        break;
      case "i2":
      case "int":
        oval = parseInt(val, 10);
        break;
      case "r4":
      case "float":
        oval = parseFloat(val);
        break;
      case "date":
      case "dateTime.tz":
        oval = parseDate(val);
        break;
      case "i8":
      case "string":
      case "fixed":
      case "uuid":
      case "bin.base64":
        break;
      default:
        throw new Error("bad custprop:" + cp[0]);
    }
    Custprops[unescapexml(key)] = oval;
  }
  function safe_format_xlml(cell, nf, o) {
    if (cell.t === "z") return;
    if (!o || o.cellText !== false) try {
      if (cell.t === "e") {
        cell.w = cell.w || BErr[cell.v];
      } else if (nf === "General") {
        if (cell.t === "n") {
          if ((cell.v | 0) === cell.v) cell.w = cell.v.toString(10);
          else cell.w = SSF_general_num(cell.v);
        } else cell.w = SSF_general(cell.v);
      } else cell.w = xlml_format(nf || "General", cell.v);
    } catch (e) {
      if (o.WTF) throw e;
    }
    try {
      var z = XLMLFormatMap[nf] || nf || "General";
      if (o.cellNF) cell.z = z;
      if (o.cellDates && cell.t == "n" && fmt_is_date(z)) {
        var _d = SSF_parse_date_code(cell.v);
        if (_d) {
          cell.t = "d";
          cell.v = new Date(_d.y, _d.m - 1, _d.d, _d.H, _d.M, _d.S, _d.u);
        }
      }
    } catch (e) {
      if (o.WTF) throw e;
    }
  }
  function process_style_xlml(styles, stag, opts) {
    if (opts.cellStyles) {
      if (stag.Interior) {
        var I = stag.Interior;
        if (I.Pattern) I.patternType = XLMLPatternTypeMap[I.Pattern] || I.Pattern;
      }
    }
    styles[stag.ID] = stag;
  }
  function parse_xlml_data(xml, ss, data, cell, base, styles, csty, row, arrayf, o) {
    var nf = "General", sid = cell.StyleID, S = {};
    o = o || {};
    var interiors = [];
    var i = 0;
    if (sid === void 0 && row) sid = row.StyleID;
    if (sid === void 0 && csty) sid = csty.StyleID;
    while (styles[sid] !== void 0) {
      if (styles[sid].nf) nf = styles[sid].nf;
      if (styles[sid].Interior) interiors.push(styles[sid].Interior);
      if (!styles[sid].Parent) break;
      sid = styles[sid].Parent;
    }
    switch (data.Type) {
      case "Boolean":
        cell.t = "b";
        cell.v = parsexmlbool(xml);
        break;
      case "String":
        cell.t = "s";
        cell.r = xlml_fixstr(unescapexml(xml));
        cell.v = xml.indexOf("<") > -1 ? unescapexml(ss || xml).replace(/<.*?>/g, "") : cell.r;
        break;
      case "DateTime":
        if (xml.slice(-1) != "Z") xml += "Z";
        cell.v = (parseDate(xml) - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1e3);
        if (cell.v !== cell.v) cell.v = unescapexml(xml);
        else if (cell.v < 60) cell.v = cell.v - 1;
        if (!nf || nf == "General") nf = "yyyy-mm-dd";
      /* falls through */
      case "Number":
        if (cell.v === void 0) cell.v = +xml;
        if (!cell.t) cell.t = "n";
        break;
      case "Error":
        cell.t = "e";
        cell.v = RBErr[xml];
        if (o.cellText !== false) cell.w = xml;
        break;
      default:
        if (xml == "" && ss == "") {
          cell.t = "z";
        } else {
          cell.t = "s";
          cell.v = xlml_fixstr(ss || xml);
        }
        break;
    }
    safe_format_xlml(cell, nf, o);
    if (o.cellFormula !== false) {
      if (cell.Formula) {
        var fstr = unescapexml(cell.Formula);
        if (fstr.charCodeAt(0) == 61) fstr = fstr.slice(1);
        cell.f = rc_to_a1(fstr, base);
        delete cell.Formula;
        if (cell.ArrayRange == "RC") cell.F = rc_to_a1("RC:RC", base);
        else if (cell.ArrayRange) {
          cell.F = rc_to_a1(cell.ArrayRange, base);
          arrayf.push([safe_decode_range(cell.F), cell.F]);
        }
      } else {
        for (i = 0; i < arrayf.length; ++i)
          if (base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r) {
            if (base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c)
              cell.F = arrayf[i][1];
          }
      }
    }
    if (o.cellStyles) {
      interiors.forEach(function(x) {
        if (!S.patternType && x.patternType) S.patternType = x.patternType;
      });
      cell.s = S;
    }
    if (cell.StyleID !== void 0) cell.ixfe = cell.StyleID;
  }
  function xlml_clean_comment(comment) {
    comment.t = comment.v || "";
    comment.t = comment.t.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
    comment.v = comment.w = comment.ixfe = void 0;
  }
  function parse_xlml_xml(d, _opts) {
    var opts = _opts || {};
    make_ssf();
    var str = debom(xlml_normalize(d));
    if (opts.type == "binary" || opts.type == "array" || opts.type == "base64") {
      if (typeof $cptable !== "undefined") str = $cptable.utils.decode(65001, char_codes(str));
      else str = utf8read(str);
    }
    var opening = str.slice(0, 1024).toLowerCase(), ishtml = false;
    opening = opening.replace(/".*?"/g, "");
    if ((opening.indexOf(">") & 1023) > Math.min(opening.indexOf(",") & 1023, opening.indexOf(";") & 1023)) {
      var _o = dup(opts);
      _o.type = "string";
      return PRN.to_workbook(str, _o);
    }
    if (opening.indexOf("<?xml") == -1) ["html", "table", "head", "meta", "script", "style", "div"].forEach(function(tag) {
      if (opening.indexOf("<" + tag) >= 0) ishtml = true;
    });
    if (ishtml) return html_to_workbook(str, opts);
    XLMLFormatMap = {
      "General Number": "General",
      "General Date": table_fmt[22],
      "Long Date": "dddd, mmmm dd, yyyy",
      "Medium Date": table_fmt[15],
      "Short Date": table_fmt[14],
      "Long Time": table_fmt[19],
      "Medium Time": table_fmt[18],
      "Short Time": table_fmt[20],
      "Currency": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',
      "Fixed": table_fmt[2],
      "Standard": table_fmt[4],
      "Percent": table_fmt[10],
      "Scientific": table_fmt[11],
      "Yes/No": '"Yes";"Yes";"No";@',
      "True/False": '"True";"True";"False";@',
      "On/Off": '"Yes";"Yes";"No";@'
    };
    var Rn;
    var state = [], tmp;
    if (DENSE != null && opts.dense == null) opts.dense = DENSE;
    var sheets = {}, sheetnames = [], cursheet = opts.dense ? [] : {}, sheetname = "";
    var cell = {}, row = {};
    var dtag = xlml_parsexmltag('<Data ss:Type="String">'), didx = 0;
    var c = 0, r = 0;
    var refguess = { s: { r: 2e6, c: 2e6 }, e: { r: 0, c: 0 } };
    var styles = {}, stag = {};
    var ss = "", fidx = 0;
    var merges = [];
    var Props = {}, Custprops = {}, pidx = 0, cp = [];
    var comments = [], comment = {};
    var cstys = [], csty, seencol = false;
    var arrayf = [];
    var rowinfo = [], rowobj = {}, cc = 0, rr = 0;
    var Workbook = { Sheets: [], WBProps: { date1904: false } }, wsprops = {};
    xlmlregex.lastIndex = 0;
    str = str.replace(/<!--([\s\S]*?)-->/mg, "");
    var raw_Rn3 = "";
    while (Rn = xlmlregex.exec(str)) switch (Rn[3] = (raw_Rn3 = Rn[3]).toLowerCase()) {
      case "data":
        if (raw_Rn3 == "data") {
          if (Rn[1] === "/") {
            if ((tmp = state.pop())[0] !== Rn[3]) throw new Error("Bad state: " + tmp.join("|"));
          } else if (Rn[0].charAt(Rn[0].length - 2) !== "/") state.push([Rn[3], true]);
          break;
        }
        if (state[state.length - 1][1]) break;
        if (Rn[1] === "/") parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length - 1][0] == /*"Comment"*/
        "comment" ? comment : cell, { c, r }, styles, cstys[c], row, arrayf, opts);
        else {
          ss = "";
          dtag = xlml_parsexmltag(Rn[0]);
          didx = Rn.index + Rn[0].length;
        }
        break;
      case "cell":
        if (Rn[1] === "/") {
          if (comments.length > 0) cell.c = comments;
          if ((!opts.sheetRows || opts.sheetRows > r) && cell.v !== void 0) {
            if (opts.dense) {
              if (!cursheet[r]) cursheet[r] = [];
              cursheet[r][c] = cell;
            } else cursheet[encode_col(c) + encode_row(r)] = cell;
          }
          if (cell.HRef) {
            cell.l = { Target: unescapexml(cell.HRef) };
            if (cell.HRefScreenTip) cell.l.Tooltip = cell.HRefScreenTip;
            delete cell.HRef;
            delete cell.HRefScreenTip;
          }
          if (cell.MergeAcross || cell.MergeDown) {
            cc = c + (parseInt(cell.MergeAcross, 10) | 0);
            rr = r + (parseInt(cell.MergeDown, 10) | 0);
            merges.push({ s: { c, r }, e: { c: cc, r: rr } });
          }
          if (!opts.sheetStubs) {
            if (cell.MergeAcross) c = cc + 1;
            else ++c;
          } else if (cell.MergeAcross || cell.MergeDown) {
            for (var cma = c; cma <= cc; ++cma) {
              for (var cmd = r; cmd <= rr; ++cmd) {
                if (cma > c || cmd > r) {
                  if (opts.dense) {
                    if (!cursheet[cmd]) cursheet[cmd] = [];
                    cursheet[cmd][cma] = { t: "z" };
                  } else cursheet[encode_col(cma) + encode_row(cmd)] = { t: "z" };
                }
              }
            }
            c = cc + 1;
          } else ++c;
        } else {
          cell = xlml_parsexmltagobj(Rn[0]);
          if (cell.Index) c = +cell.Index - 1;
          if (c < refguess.s.c) refguess.s.c = c;
          if (c > refguess.e.c) refguess.e.c = c;
          if (Rn[0].slice(-2) === "/>") ++c;
          comments = [];
        }
        break;
      case "row":
        if (Rn[1] === "/" || Rn[0].slice(-2) === "/>") {
          if (r < refguess.s.r) refguess.s.r = r;
          if (r > refguess.e.r) refguess.e.r = r;
          if (Rn[0].slice(-2) === "/>") {
            row = xlml_parsexmltag(Rn[0]);
            if (row.Index) r = +row.Index - 1;
          }
          c = 0;
          ++r;
        } else {
          row = xlml_parsexmltag(Rn[0]);
          if (row.Index) r = +row.Index - 1;
          rowobj = {};
          if (row.AutoFitHeight == "0" || row.Height) {
            rowobj.hpx = parseInt(row.Height, 10);
            rowobj.hpt = px2pt(rowobj.hpx);
            rowinfo[r] = rowobj;
          }
          if (row.Hidden == "1") {
            rowobj.hidden = true;
            rowinfo[r] = rowobj;
          }
        }
        break;
      case "worksheet":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw new Error("Bad state: " + tmp.join("|"));
          sheetnames.push(sheetname);
          if (refguess.s.r <= refguess.e.r && refguess.s.c <= refguess.e.c) {
            cursheet["!ref"] = encode_range(refguess);
            if (opts.sheetRows && opts.sheetRows <= refguess.e.r) {
              cursheet["!fullref"] = cursheet["!ref"];
              refguess.e.r = opts.sheetRows - 1;
              cursheet["!ref"] = encode_range(refguess);
            }
          }
          if (merges.length) cursheet["!merges"] = merges;
          if (cstys.length > 0) cursheet["!cols"] = cstys;
          if (rowinfo.length > 0) cursheet["!rows"] = rowinfo;
          sheets[sheetname] = cursheet;
        } else {
          refguess = { s: { r: 2e6, c: 2e6 }, e: { r: 0, c: 0 } };
          r = c = 0;
          state.push([Rn[3], false]);
          tmp = xlml_parsexmltag(Rn[0]);
          sheetname = unescapexml(tmp.Name);
          cursheet = opts.dense ? [] : {};
          merges = [];
          arrayf = [];
          rowinfo = [];
          wsprops = { name: sheetname, Hidden: 0 };
          Workbook.Sheets.push(wsprops);
        }
        break;
      case "table":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw new Error("Bad state: " + tmp.join("|"));
        } else if (Rn[0].slice(-2) == "/>") break;
        else {
          state.push([Rn[3], false]);
          cstys = [];
          seencol = false;
        }
        break;
      case "style":
        if (Rn[1] === "/") process_style_xlml(styles, stag, opts);
        else stag = xlml_parsexmltag(Rn[0]);
        break;
      case "numberformat":
        stag.nf = unescapexml(xlml_parsexmltag(Rn[0]).Format || "General");
        if (XLMLFormatMap[stag.nf]) stag.nf = XLMLFormatMap[stag.nf];
        for (var ssfidx = 0; ssfidx != 392; ++ssfidx) if (table_fmt[ssfidx] == stag.nf) break;
        if (ssfidx == 392) {
          for (ssfidx = 57; ssfidx != 392; ++ssfidx) if (table_fmt[ssfidx] == null) {
            SSF_load(stag.nf, ssfidx);
            break;
          }
        }
        break;
      case "column":
        if (state[state.length - 1][0] !== /*'Table'*/
        "table") break;
        csty = xlml_parsexmltag(Rn[0]);
        if (csty.Hidden) {
          csty.hidden = true;
          delete csty.Hidden;
        }
        if (csty.Width) csty.wpx = parseInt(csty.Width, 10);
        if (!seencol && csty.wpx > 10) {
          seencol = true;
          MDW = DEF_MDW;
          for (var _col = 0; _col < cstys.length; ++_col) if (cstys[_col]) process_col(cstys[_col]);
        }
        if (seencol) process_col(csty);
        cstys[csty.Index - 1 || cstys.length] = csty;
        for (var i = 0; i < +csty.Span; ++i) cstys[cstys.length] = dup(csty);
        break;
      case "namedrange":
        if (Rn[1] === "/") break;
        if (!Workbook.Names) Workbook.Names = [];
        var _NamedRange = parsexmltag(Rn[0]);
        var _DefinedName = {
          Name: _NamedRange.Name,
          Ref: rc_to_a1(_NamedRange.RefersTo.slice(1), { r: 0, c: 0 })
        };
        if (Workbook.Sheets.length > 0) _DefinedName.Sheet = Workbook.Sheets.length - 1;
        Workbook.Names.push(_DefinedName);
        break;
      case "namedcell":
        break;
      case "b":
        break;
      case "i":
        break;
      case "u":
        break;
      case "s":
        break;
      case "em":
        break;
      case "h2":
        break;
      case "h3":
        break;
      case "sub":
        break;
      case "sup":
        break;
      case "span":
        break;
      case "alignment":
        break;
      case "borders":
        break;
      case "border":
        break;
      case "font":
        if (Rn[0].slice(-2) === "/>") break;
        else if (Rn[1] === "/") ss += str.slice(fidx, Rn.index);
        else fidx = Rn.index + Rn[0].length;
        break;
      case "interior":
        if (!opts.cellStyles) break;
        stag.Interior = xlml_parsexmltag(Rn[0]);
        break;
      case "protection":
        break;
      case "author":
      case "title":
      case "description":
      case "created":
      case "keywords":
      case "subject":
      case "category":
      case "company":
      case "lastauthor":
      case "lastsaved":
      case "lastprinted":
      case "version":
      case "revision":
      case "totaltime":
      case "hyperlinkbase":
      case "manager":
      case "contentstatus":
      case "identifier":
      case "language":
      case "appname":
        if (Rn[0].slice(-2) === "/>") break;
        else if (Rn[1] === "/") xlml_set_prop(Props, raw_Rn3, str.slice(pidx, Rn.index));
        else pidx = Rn.index + Rn[0].length;
        break;
      case "paragraphs":
        break;
      case "styles":
      case "workbook":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw new Error("Bad state: " + tmp.join("|"));
        } else state.push([Rn[3], false]);
        break;
      case "comment":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw new Error("Bad state: " + tmp.join("|"));
          xlml_clean_comment(comment);
          comments.push(comment);
        } else {
          state.push([Rn[3], false]);
          tmp = xlml_parsexmltag(Rn[0]);
          comment = { a: tmp.Author };
        }
        break;
      case "autofilter":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw new Error("Bad state: " + tmp.join("|"));
        } else if (Rn[0].charAt(Rn[0].length - 2) !== "/") {
          var AutoFilter = xlml_parsexmltag(Rn[0]);
          cursheet["!autofilter"] = { ref: rc_to_a1(AutoFilter.Range).replace(/\$/g, "") };
          state.push([Rn[3], true]);
        }
        break;
      case "name":
        break;
      case "datavalidation":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw new Error("Bad state: " + tmp.join("|"));
        } else {
          if (Rn[0].charAt(Rn[0].length - 2) !== "/") state.push([Rn[3], true]);
        }
        break;
      case "pixelsperinch":
        break;
      case "componentoptions":
      case "documentproperties":
      case "customdocumentproperties":
      case "officedocumentsettings":
      case "pivottable":
      case "pivotcache":
      case "names":
      case "mapinfo":
      case "pagebreaks":
      case "querytable":
      case "sorting":
      case "schema":
      //case 'data' /*case 'data'*/:
      case "conditionalformatting":
      case "smarttagtype":
      case "smarttags":
      case "excelworkbook":
      case "workbookoptions":
      case "worksheetoptions":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw new Error("Bad state: " + tmp.join("|"));
        } else if (Rn[0].charAt(Rn[0].length - 2) !== "/") state.push([Rn[3], true]);
        break;
      case "null":
        break;
      default:
        if (state.length == 0 && Rn[3] == "document") return parse_fods(str, opts);
        if (state.length == 0 && Rn[3] == "uof") return parse_fods(str, opts);
        var seen = true;
        switch (state[state.length - 1][0]) {
          /* OfficeDocumentSettings */
          case "officedocumentsettings":
            switch (Rn[3]) {
              case "allowpng":
                break;
              case "removepersonalinformation":
                break;
              case "downloadcomponents":
                break;
              case "locationofcomponents":
                break;
              case "colors":
                break;
              case "color":
                break;
              case "index":
                break;
              case "rgb":
                break;
              case "targetscreensize":
                break;
              case "readonlyrecommended":
                break;
              default:
                seen = false;
            }
            break;
          /* ComponentOptions */
          case "componentoptions":
            switch (Rn[3]) {
              case "toolbar":
                break;
              case "hideofficelogo":
                break;
              case "spreadsheetautofit":
                break;
              case "label":
                break;
              case "caption":
                break;
              case "maxheight":
                break;
              case "maxwidth":
                break;
              case "nextsheetnumber":
                break;
              default:
                seen = false;
            }
            break;
          /* ExcelWorkbook */
          case "excelworkbook":
            switch (Rn[3]) {
              case "date1904":
                Workbook.WBProps.date1904 = true;
                break;
              case "windowheight":
                break;
              case "windowwidth":
                break;
              case "windowtopx":
                break;
              case "windowtopy":
                break;
              case "tabratio":
                break;
              case "protectstructure":
                break;
              case "protectwindow":
                break;
              case "protectwindows":
                break;
              case "activesheet":
                break;
              case "displayinknotes":
                break;
              case "firstvisiblesheet":
                break;
              case "supbook":
                break;
              case "sheetname":
                break;
              case "sheetindex":
                break;
              case "sheetindexfirst":
                break;
              case "sheetindexlast":
                break;
              case "dll":
                break;
              case "acceptlabelsinformulas":
                break;
              case "donotsavelinkvalues":
                break;
              case "iteration":
                break;
              case "maxiterations":
                break;
              case "maxchange":
                break;
              case "path":
                break;
              case "xct":
                break;
              case "count":
                break;
              case "selectedsheets":
                break;
              case "calculation":
                break;
              case "uncalced":
                break;
              case "startupprompt":
                break;
              case "crn":
                break;
              case "externname":
                break;
              case "formula":
                break;
              case "colfirst":
                break;
              case "collast":
                break;
              case "wantadvise":
                break;
              case "boolean":
                break;
              case "error":
                break;
              case "text":
                break;
              case "ole":
                break;
              case "noautorecover":
                break;
              case "publishobjects":
                break;
              case "donotcalculatebeforesave":
                break;
              case "number":
                break;
              case "refmoder1c1":
                break;
              case "embedsavesmarttags":
                break;
              default:
                seen = false;
            }
            break;
          /* WorkbookOptions */
          case "workbookoptions":
            switch (Rn[3]) {
              case "owcversion":
                break;
              case "height":
                break;
              case "width":
                break;
              default:
                seen = false;
            }
            break;
          /* WorksheetOptions */
          case "worksheetoptions":
            switch (Rn[3]) {
              case "visible":
                if (Rn[0].slice(-2) === "/>") {
                } else if (Rn[1] === "/") switch (str.slice(pidx, Rn.index)) {
                  case "SheetHidden":
                    wsprops.Hidden = 1;
                    break;
                  case "SheetVeryHidden":
                    wsprops.Hidden = 2;
                    break;
                }
                else pidx = Rn.index + Rn[0].length;
                break;
              case "header":
                if (!cursheet["!margins"]) default_margins(cursheet["!margins"] = {}, "xlml");
                if (!isNaN(+parsexmltag(Rn[0]).Margin)) cursheet["!margins"].header = +parsexmltag(Rn[0]).Margin;
                break;
              case "footer":
                if (!cursheet["!margins"]) default_margins(cursheet["!margins"] = {}, "xlml");
                if (!isNaN(+parsexmltag(Rn[0]).Margin)) cursheet["!margins"].footer = +parsexmltag(Rn[0]).Margin;
                break;
              case "pagemargins":
                var pagemargins = parsexmltag(Rn[0]);
                if (!cursheet["!margins"]) default_margins(cursheet["!margins"] = {}, "xlml");
                if (!isNaN(+pagemargins.Top)) cursheet["!margins"].top = +pagemargins.Top;
                if (!isNaN(+pagemargins.Left)) cursheet["!margins"].left = +pagemargins.Left;
                if (!isNaN(+pagemargins.Right)) cursheet["!margins"].right = +pagemargins.Right;
                if (!isNaN(+pagemargins.Bottom)) cursheet["!margins"].bottom = +pagemargins.Bottom;
                break;
              case "displayrighttoleft":
                if (!Workbook.Views) Workbook.Views = [];
                if (!Workbook.Views[0]) Workbook.Views[0] = {};
                Workbook.Views[0].RTL = true;
                break;
              case "freezepanes":
                break;
              case "frozennosplit":
                break;
              case "splithorizontal":
              case "splitvertical":
                break;
              case "donotdisplaygridlines":
                break;
              case "activerow":
                break;
              case "activecol":
                break;
              case "toprowbottompane":
                break;
              case "leftcolumnrightpane":
                break;
              case "unsynced":
                break;
              case "print":
                break;
              case "printerrors":
                break;
              case "panes":
                break;
              case "scale":
                break;
              case "pane":
                break;
              case "number":
                break;
              case "layout":
                break;
              case "pagesetup":
                break;
              case "selected":
                break;
              case "protectobjects":
                break;
              case "enableselection":
                break;
              case "protectscenarios":
                break;
              case "validprinterinfo":
                break;
              case "horizontalresolution":
                break;
              case "verticalresolution":
                break;
              case "numberofcopies":
                break;
              case "activepane":
                break;
              case "toprowvisible":
                break;
              case "leftcolumnvisible":
                break;
              case "fittopage":
                break;
              case "rangeselection":
                break;
              case "papersizeindex":
                break;
              case "pagelayoutzoom":
                break;
              case "pagebreakzoom":
                break;
              case "filteron":
                break;
              case "fitwidth":
                break;
              case "fitheight":
                break;
              case "commentslayout":
                break;
              case "zoom":
                break;
              case "lefttoright":
                break;
              case "gridlines":
                break;
              case "allowsort":
                break;
              case "allowfilter":
                break;
              case "allowinsertrows":
                break;
              case "allowdeleterows":
                break;
              case "allowinsertcols":
                break;
              case "allowdeletecols":
                break;
              case "allowinserthyperlinks":
                break;
              case "allowformatcells":
                break;
              case "allowsizecols":
                break;
              case "allowsizerows":
                break;
              case "nosummaryrowsbelowdetail":
                if (!cursheet["!outline"]) cursheet["!outline"] = {};
                cursheet["!outline"].above = true;
                break;
              case "tabcolorindex":
                break;
              case "donotdisplayheadings":
                break;
              case "showpagelayoutzoom":
                break;
              case "nosummarycolumnsrightdetail":
                if (!cursheet["!outline"]) cursheet["!outline"] = {};
                cursheet["!outline"].left = true;
                break;
              case "blackandwhite":
                break;
              case "donotdisplayzeros":
                break;
              case "displaypagebreak":
                break;
              case "rowcolheadings":
                break;
              case "donotdisplayoutline":
                break;
              case "noorientation":
                break;
              case "allowusepivottables":
                break;
              case "zeroheight":
                break;
              case "viewablerange":
                break;
              case "selection":
                break;
              case "protectcontents":
                break;
              default:
                seen = false;
            }
            break;
          /* PivotTable */
          case "pivottable":
          case "pivotcache":
            switch (Rn[3]) {
              case "immediateitemsondrop":
                break;
              case "showpagemultipleitemlabel":
                break;
              case "compactrowindent":
                break;
              case "location":
                break;
              case "pivotfield":
                break;
              case "orientation":
                break;
              case "layoutform":
                break;
              case "layoutsubtotallocation":
                break;
              case "layoutcompactrow":
                break;
              case "position":
                break;
              case "pivotitem":
                break;
              case "datatype":
                break;
              case "datafield":
                break;
              case "sourcename":
                break;
              case "parentfield":
                break;
              case "ptlineitems":
                break;
              case "ptlineitem":
                break;
              case "countofsameitems":
                break;
              case "item":
                break;
              case "itemtype":
                break;
              case "ptsource":
                break;
              case "cacheindex":
                break;
              case "consolidationreference":
                break;
              case "filename":
                break;
              case "reference":
                break;
              case "nocolumngrand":
                break;
              case "norowgrand":
                break;
              case "blanklineafteritems":
                break;
              case "hidden":
                break;
              case "subtotal":
                break;
              case "basefield":
                break;
              case "mapchilditems":
                break;
              case "function":
                break;
              case "refreshonfileopen":
                break;
              case "printsettitles":
                break;
              case "mergelabels":
                break;
              case "defaultversion":
                break;
              case "refreshname":
                break;
              case "refreshdate":
                break;
              case "refreshdatecopy":
                break;
              case "versionlastrefresh":
                break;
              case "versionlastupdate":
                break;
              case "versionupdateablemin":
                break;
              case "versionrefreshablemin":
                break;
              case "calculation":
                break;
              default:
                seen = false;
            }
            break;
          /* PageBreaks */
          case "pagebreaks":
            switch (Rn[3]) {
              case "colbreaks":
                break;
              case "colbreak":
                break;
              case "rowbreaks":
                break;
              case "rowbreak":
                break;
              case "colstart":
                break;
              case "colend":
                break;
              case "rowend":
                break;
              default:
                seen = false;
            }
            break;
          /* AutoFilter */
          case "autofilter":
            switch (Rn[3]) {
              case "autofiltercolumn":
                break;
              case "autofiltercondition":
                break;
              case "autofilterand":
                break;
              case "autofilteror":
                break;
              default:
                seen = false;
            }
            break;
          /* QueryTable */
          case "querytable":
            switch (Rn[3]) {
              case "id":
                break;
              case "autoformatfont":
                break;
              case "autoformatpattern":
                break;
              case "querysource":
                break;
              case "querytype":
                break;
              case "enableredirections":
                break;
              case "refreshedinxl9":
                break;
              case "urlstring":
                break;
              case "htmltables":
                break;
              case "connection":
                break;
              case "commandtext":
                break;
              case "refreshinfo":
                break;
              case "notitles":
                break;
              case "nextid":
                break;
              case "columninfo":
                break;
              case "overwritecells":
                break;
              case "donotpromptforfile":
                break;
              case "textwizardsettings":
                break;
              case "source":
                break;
              case "number":
                break;
              case "decimal":
                break;
              case "thousandseparator":
                break;
              case "trailingminusnumbers":
                break;
              case "formatsettings":
                break;
              case "fieldtype":
                break;
              case "delimiters":
                break;
              case "tab":
                break;
              case "comma":
                break;
              case "autoformatname":
                break;
              case "versionlastedit":
                break;
              case "versionlastrefresh":
                break;
              default:
                seen = false;
            }
            break;
          case "datavalidation":
            switch (Rn[3]) {
              case "range":
                break;
              case "type":
                break;
              case "min":
                break;
              case "max":
                break;
              case "sort":
                break;
              case "descending":
                break;
              case "order":
                break;
              case "casesensitive":
                break;
              case "value":
                break;
              case "errorstyle":
                break;
              case "errormessage":
                break;
              case "errortitle":
                break;
              case "inputmessage":
                break;
              case "inputtitle":
                break;
              case "combohide":
                break;
              case "inputhide":
                break;
              case "condition":
                break;
              case "qualifier":
                break;
              case "useblank":
                break;
              case "value1":
                break;
              case "value2":
                break;
              case "format":
                break;
              case "cellrangelist":
                break;
              default:
                seen = false;
            }
            break;
          case "sorting":
          case "conditionalformatting":
            switch (Rn[3]) {
              case "range":
                break;
              case "type":
                break;
              case "min":
                break;
              case "max":
                break;
              case "sort":
                break;
              case "descending":
                break;
              case "order":
                break;
              case "casesensitive":
                break;
              case "value":
                break;
              case "errorstyle":
                break;
              case "errormessage":
                break;
              case "errortitle":
                break;
              case "cellrangelist":
                break;
              case "inputmessage":
                break;
              case "inputtitle":
                break;
              case "combohide":
                break;
              case "inputhide":
                break;
              case "condition":
                break;
              case "qualifier":
                break;
              case "useblank":
                break;
              case "value1":
                break;
              case "value2":
                break;
              case "format":
                break;
              default:
                seen = false;
            }
            break;
          /* MapInfo (schema) */
          case "mapinfo":
          case "schema":
          case "data":
            switch (Rn[3]) {
              case "map":
                break;
              case "entry":
                break;
              case "range":
                break;
              case "xpath":
                break;
              case "field":
                break;
              case "xsdtype":
                break;
              case "filteron":
                break;
              case "aggregate":
                break;
              case "elementtype":
                break;
              case "attributetype":
                break;
              /* These are from xsd (XML Schema Definition) */
              case "schema":
              case "element":
              case "complextype":
              case "datatype":
              case "all":
              case "attribute":
              case "extends":
                break;
              case "row":
                break;
              default:
                seen = false;
            }
            break;
          /* SmartTags (can be anything) */
          case "smarttags":
            break;
          default:
            seen = false;
            break;
        }
        if (seen) break;
        if (Rn[3].match(/!\[CDATA/)) break;
        if (!state[state.length - 1][1]) throw "Unrecognized tag: " + Rn[3] + "|" + state.join("|");
        if (state[state.length - 1][0] === /*'CustomDocumentProperties'*/
        "customdocumentproperties") {
          if (Rn[0].slice(-2) === "/>") break;
          else if (Rn[1] === "/") xlml_set_custprop(Custprops, raw_Rn3, cp, str.slice(pidx, Rn.index));
          else {
            cp = Rn;
            pidx = Rn.index + Rn[0].length;
          }
          break;
        }
        if (opts.WTF) throw "Unrecognized tag: " + Rn[3] + "|" + state.join("|");
    }
    var out = {};
    if (!opts.bookSheets && !opts.bookProps) out.Sheets = sheets;
    out.SheetNames = sheetnames;
    out.Workbook = Workbook;
    out.SSF = dup(table_fmt);
    out.Props = Props;
    out.Custprops = Custprops;
    return out;
  }
  function parse_xlml(data, opts) {
    fix_read_opts(opts = opts || {});
    switch (opts.type || "base64") {
      case "base64":
        return parse_xlml_xml(Base64_decode(data), opts);
      case "binary":
      case "buffer":
      case "file":
        return parse_xlml_xml(data, opts);
      case "array":
        return parse_xlml_xml(a2s(data), opts);
    }
  }
  function parse_compobj(obj2) {
    var v = {};
    var o = obj2.content;
    o.l = 28;
    v.AnsiUserType = o.read_shift(0, "lpstr-ansi");
    v.AnsiClipboardFormat = parse_ClipboardFormatOrAnsiString(o);
    if (o.length - o.l <= 4) return v;
    var m = o.read_shift(4);
    if (m == 0 || m > 40) return v;
    o.l -= 4;
    v.Reserved1 = o.read_shift(0, "lpstr-ansi");
    if (o.length - o.l <= 4) return v;
    m = o.read_shift(4);
    if (m !== 1907505652) return v;
    v.UnicodeClipboardFormat = parse_ClipboardFormatOrUnicodeString(o);
    m = o.read_shift(4);
    if (m == 0 || m > 40) return v;
    o.l -= 4;
    v.Reserved2 = o.read_shift(0, "lpwstr");
  }
  var CONTINUE_RT = [60, 1084, 2066, 2165, 2175];
  function slurp(RecordType, R, blob, length, opts) {
    var l2 = length;
    var bufs = [];
    var d = blob.slice(blob.l, blob.l + l2);
    if (opts && opts.enc && opts.enc.insitu && d.length > 0) switch (RecordType) {
      case 9:
      case 521:
      case 1033:
      case 2057:
      case 47:
      case 405:
      case 225:
      case 406:
      case 312:
      case 404:
      case 10:
        break;
      case 133:
        break;
      default:
        opts.enc.insitu(d);
    }
    bufs.push(d);
    blob.l += l2;
    var nextrt = __readUInt16LE(blob, blob.l), next2 = XLSRecordEnum[nextrt];
    var start = 0;
    while (next2 != null && CONTINUE_RT.indexOf(nextrt) > -1) {
      l2 = __readUInt16LE(blob, blob.l + 2);
      start = blob.l + 4;
      if (nextrt == 2066) start += 4;
      else if (nextrt == 2165 || nextrt == 2175) {
        start += 12;
      }
      d = blob.slice(start, blob.l + 4 + l2);
      bufs.push(d);
      blob.l += 4 + l2;
      next2 = XLSRecordEnum[nextrt = __readUInt16LE(blob, blob.l)];
    }
    var b = bconcat(bufs);
    prep_blob(b, 0);
    var ll = 0;
    b.lens = [];
    for (var j = 0; j < bufs.length; ++j) {
      b.lens.push(ll);
      ll += bufs[j].length;
    }
    if (b.length < length) throw "XLS Record 0x" + RecordType.toString(16) + " Truncated: " + b.length + " < " + length;
    return R.f(b, b.length, opts);
  }
  function safe_format_xf(p, opts, date1904) {
    if (p.t === "z") return;
    if (!p.XF) return;
    var fmtid = 0;
    try {
      fmtid = p.z || p.XF.numFmtId || 0;
      if (opts.cellNF) p.z = table_fmt[fmtid];
    } catch (e) {
      if (opts.WTF) throw e;
    }
    if (!opts || opts.cellText !== false) try {
      if (p.t === "e") {
        p.w = p.w || BErr[p.v];
      } else if (fmtid === 0 || fmtid == "General") {
        if (p.t === "n") {
          if ((p.v | 0) === p.v) p.w = p.v.toString(10);
          else p.w = SSF_general_num(p.v);
        } else p.w = SSF_general(p.v);
      } else p.w = SSF_format(fmtid, p.v, { date1904: !!date1904, dateNF: opts && opts.dateNF });
    } catch (e) {
      if (opts.WTF) throw e;
    }
    if (opts.cellDates && fmtid && p.t == "n" && fmt_is_date(table_fmt[fmtid] || String(fmtid))) {
      var _d = SSF_parse_date_code(p.v);
      if (_d) {
        p.t = "d";
        p.v = new Date(_d.y, _d.m - 1, _d.d, _d.H, _d.M, _d.S, _d.u);
      }
    }
  }
  function make_cell(val, ixfe, t) {
    return { v: val, ixfe, t };
  }
  function parse_workbook(blob, options) {
    var wb = { opts: {} };
    var Sheets = {};
    if (DENSE != null && options.dense == null) options.dense = DENSE;
    var out = options.dense ? [] : {};
    var Directory = {};
    var range2 = {};
    var last_formula = null;
    var sst = [];
    var cur_sheet = "";
    var Preamble = {};
    var lastcell, last_cell = "", cc, cmnt, rngC, rngR;
    var sharedf = {};
    var arrayf = [];
    var temp_val;
    var country;
    var XFs = [];
    var palette = [];
    var Workbook = { Sheets: [], WBProps: { date1904: false }, Views: [{}] }, wsprops = {};
    var get_rgb = function getrgb(icv) {
      if (icv < 8) return XLSIcv[icv];
      if (icv < 64) return palette[icv - 8] || XLSIcv[icv];
      return XLSIcv[icv];
    };
    var process_cell_style = function pcs(cell, line, options2) {
      var xfd = line.XF.data;
      if (!xfd || !xfd.patternType || !options2 || !options2.cellStyles) return;
      line.s = {};
      line.s.patternType = xfd.patternType;
      var t;
      if (t = rgb2Hex(get_rgb(xfd.icvFore))) {
        line.s.fgColor = { rgb: t };
      }
      if (t = rgb2Hex(get_rgb(xfd.icvBack))) {
        line.s.bgColor = { rgb: t };
      }
    };
    var addcell = function addcell2(cell, line, options2) {
      if (file_depth > 1) return;
      if (options2.sheetRows && cell.r >= options2.sheetRows) return;
      if (options2.cellStyles && line.XF && line.XF.data) process_cell_style(cell, line, options2);
      delete line.ixfe;
      delete line.XF;
      lastcell = cell;
      last_cell = encode_cell(cell);
      if (!range2 || !range2.s || !range2.e) range2 = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } };
      if (cell.r < range2.s.r) range2.s.r = cell.r;
      if (cell.c < range2.s.c) range2.s.c = cell.c;
      if (cell.r + 1 > range2.e.r) range2.e.r = cell.r + 1;
      if (cell.c + 1 > range2.e.c) range2.e.c = cell.c + 1;
      if (options2.cellFormula && line.f) {
        for (var afi = 0; afi < arrayf.length; ++afi) {
          if (arrayf[afi][0].s.c > cell.c || arrayf[afi][0].s.r > cell.r) continue;
          if (arrayf[afi][0].e.c < cell.c || arrayf[afi][0].e.r < cell.r) continue;
          line.F = encode_range(arrayf[afi][0]);
          if (arrayf[afi][0].s.c != cell.c || arrayf[afi][0].s.r != cell.r) delete line.f;
          if (line.f) line.f = "" + stringify_formula(arrayf[afi][1], range2, cell, supbooks, opts);
          break;
        }
      }
      {
        if (options2.dense) {
          if (!out[cell.r]) out[cell.r] = [];
          out[cell.r][cell.c] = line;
        } else out[last_cell] = line;
      }
    };
    var opts = {
      enc: false,
      // encrypted
      sbcch: 0,
      // cch in the preceding SupBook
      snames: [],
      // sheetnames
      sharedf,
      // shared formulae by address
      arrayf,
      // array formulae array
      rrtabid: [],
      // RRTabId
      lastuser: "",
      // Last User from WriteAccess
      biff: 8,
      // BIFF version
      codepage: 0,
      // CP from CodePage record
      winlocked: 0,
      // fLockWn from WinProtect
      cellStyles: !!options && !!options.cellStyles,
      WTF: !!options && !!options.wtf
    };
    if (options.password) opts.password = options.password;
    var themes;
    var merges = [];
    var objects = [];
    var colinfo = [], rowinfo = [];
    var seencol = false;
    var supbooks = [];
    supbooks.SheetNames = opts.snames;
    supbooks.sharedf = opts.sharedf;
    supbooks.arrayf = opts.arrayf;
    supbooks.names = [];
    supbooks.XTI = [];
    var last_RT = 0;
    var file_depth = 0;
    var BIFF2Fmt = 0, BIFF2FmtTable = [];
    var FilterDatabases = [];
    var last_lbl;
    opts.codepage = 1200;
    set_cp(1200);
    var seen_codepage = false;
    while (blob.l < blob.length - 1) {
      var s = blob.l;
      var RecordType = blob.read_shift(2);
      if (RecordType === 0 && last_RT === 10) break;
      var length = blob.l === blob.length ? 0 : blob.read_shift(2);
      var R = XLSRecordEnum[RecordType];
      if (R && R.f) {
        if (options.bookSheets) {
          if (last_RT === 133 && RecordType !== 133) break;
        }
        last_RT = RecordType;
        if (R.r === 2 || R.r == 12) {
          var rt = blob.read_shift(2);
          length -= 2;
          if (!opts.enc && rt !== RecordType && ((rt & 255) << 8 | rt >> 8) !== RecordType) throw new Error("rt mismatch: " + rt + "!=" + RecordType);
          if (R.r == 12) {
            blob.l += 10;
            length -= 10;
          }
        }
        var val = {};
        if (RecordType === 10) val = /*::(*/
        R.f(blob, length, opts);
        else val = /*::(*/
        slurp(RecordType, R, blob, length, opts);
        if (file_depth == 0 && [9, 521, 1033, 2057].indexOf(last_RT) === -1) continue;
        switch (RecordType) {
          case 34:
            wb.opts.Date1904 = Workbook.WBProps.date1904 = val;
            break;
          case 134:
            wb.opts.WriteProtect = true;
            break;
          case 47:
            if (!opts.enc) blob.l = 0;
            opts.enc = val;
            if (!options.password) throw new Error("File is password-protected");
            if (val.valid == null) throw new Error("Encryption scheme unsupported");
            if (!val.valid) throw new Error("Password is incorrect");
            break;
          case 92:
            opts.lastuser = val;
            break;
          case 66:
            var cpval = Number(val);
            switch (cpval) {
              case 21010:
                cpval = 1200;
                break;
              case 32768:
                cpval = 1e4;
                break;
              case 32769:
                cpval = 1252;
                break;
            }
            set_cp(opts.codepage = cpval);
            seen_codepage = true;
            break;
          case 317:
            opts.rrtabid = val;
            break;
          case 25:
            opts.winlocked = val;
            break;
          case 439:
            wb.opts["RefreshAll"] = val;
            break;
          case 12:
            wb.opts["CalcCount"] = val;
            break;
          case 16:
            wb.opts["CalcDelta"] = val;
            break;
          case 17:
            wb.opts["CalcIter"] = val;
            break;
          case 13:
            wb.opts["CalcMode"] = val;
            break;
          case 14:
            wb.opts["CalcPrecision"] = val;
            break;
          case 95:
            wb.opts["CalcSaveRecalc"] = val;
            break;
          case 15:
            opts.CalcRefMode = val;
            break;
          // TODO: implement R1C1
          case 2211:
            wb.opts.FullCalc = val;
            break;
          case 129:
            if (val.fDialog) out["!type"] = "dialog";
            if (!val.fBelow) (out["!outline"] || (out["!outline"] = {})).above = true;
            if (!val.fRight) (out["!outline"] || (out["!outline"] = {})).left = true;
            break;
          // TODO
          case 224:
            XFs.push(val);
            break;
          case 430:
            supbooks.push([val]);
            supbooks[supbooks.length - 1].XTI = [];
            break;
          case 35:
          case 547:
            supbooks[supbooks.length - 1].push(val);
            break;
          case 24:
          case 536:
            last_lbl = {
              Name: val.Name,
              Ref: stringify_formula(val.rgce, range2, null, supbooks, opts)
            };
            if (val.itab > 0) last_lbl.Sheet = val.itab - 1;
            supbooks.names.push(last_lbl);
            if (!supbooks[0]) {
              supbooks[0] = [];
              supbooks[0].XTI = [];
            }
            supbooks[supbooks.length - 1].push(val);
            if (val.Name == "_xlnm._FilterDatabase" && val.itab > 0) {
              if (val.rgce && val.rgce[0] && val.rgce[0][0] && val.rgce[0][0][0] == "PtgArea3d")
                FilterDatabases[val.itab - 1] = { ref: encode_range(val.rgce[0][0][1][2]) };
            }
            break;
          case 22:
            opts.ExternCount = val;
            break;
          case 23:
            if (supbooks.length == 0) {
              supbooks[0] = [];
              supbooks[0].XTI = [];
            }
            supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val);
            supbooks.XTI = supbooks.XTI.concat(val);
            break;
          case 2196:
            if (opts.biff < 8) break;
            if (last_lbl != null) last_lbl.Comment = val[1];
            break;
          case 18:
            out["!protect"] = val;
            break;
          /* for sheet or book */
          case 19:
            if (val !== 0 && opts.WTF) console.error("Password verifier: " + val);
            break;
          case 133:
            {
              Directory[val.pos] = val;
              opts.snames.push(val.name);
            }
            break;
          case 10:
            {
              if (--file_depth) break;
              if (range2.e) {
                if (range2.e.r > 0 && range2.e.c > 0) {
                  range2.e.r--;
                  range2.e.c--;
                  out["!ref"] = encode_range(range2);
                  if (options.sheetRows && options.sheetRows <= range2.e.r) {
                    var tmpri = range2.e.r;
                    range2.e.r = options.sheetRows - 1;
                    out["!fullref"] = out["!ref"];
                    out["!ref"] = encode_range(range2);
                    range2.e.r = tmpri;
                  }
                  range2.e.r++;
                  range2.e.c++;
                }
                if (merges.length > 0) out["!merges"] = merges;
                if (objects.length > 0) out["!objects"] = objects;
                if (colinfo.length > 0) out["!cols"] = colinfo;
                if (rowinfo.length > 0) out["!rows"] = rowinfo;
                Workbook.Sheets.push(wsprops);
              }
              if (cur_sheet === "") Preamble = out;
              else Sheets[cur_sheet] = out;
              out = options.dense ? [] : {};
            }
            break;
          case 9:
          case 521:
          case 1033:
          case 2057:
            {
              if (opts.biff === 8) opts.biff = {
                /*::[*/
                9: 2,
                /*::[*/
                521: 3,
                /*::[*/
                1033: 4
              }[RecordType] || {
                /*::[*/
                512: 2,
                /*::[*/
                768: 3,
                /*::[*/
                1024: 4,
                /*::[*/
                1280: 5,
                /*::[*/
                1536: 8,
                /*::[*/
                2: 2,
                /*::[*/
                7: 2
              }[val.BIFFVer] || 8;
              opts.biffguess = val.BIFFVer == 0;
              if (val.BIFFVer == 0 && val.dt == 4096) {
                opts.biff = 5;
                seen_codepage = true;
                set_cp(opts.codepage = 28591);
              }
              if (opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
              if (file_depth++) break;
              out = options.dense ? [] : {};
              if (opts.biff < 8 && !seen_codepage) {
                seen_codepage = true;
                set_cp(opts.codepage = options.codepage || 1252);
              }
              if (opts.biff < 5 || val.BIFFVer == 0 && val.dt == 4096) {
                if (cur_sheet === "") cur_sheet = "Sheet1";
                range2 = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } };
                var fakebs8 = { pos: blob.l - length, name: cur_sheet };
                Directory[fakebs8.pos] = fakebs8;
                opts.snames.push(cur_sheet);
              } else cur_sheet = (Directory[s] || { name: "" }).name;
              if (val.dt == 32) out["!type"] = "chart";
              if (val.dt == 64) out["!type"] = "macro";
              merges = [];
              objects = [];
              opts.arrayf = arrayf = [];
              colinfo = [];
              rowinfo = [];
              seencol = false;
              wsprops = { Hidden: (Directory[s] || { hs: 0 }).hs, name: cur_sheet };
            }
            break;
          case 515:
          case 3:
          case 2:
            {
              if (out["!type"] == "chart") {
                if (options.dense ? (out[val.r] || [])[val.c] : out[encode_cell({ c: val.c, r: val.r })]) ++val.c;
              }
              temp_val = { ixfe: val.ixfe, XF: XFs[val.ixfe] || {}, v: val.val, t: "n" };
              if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
              safe_format_xf(temp_val, options, wb.opts.Date1904);
              addcell({ c: val.c, r: val.r }, temp_val, options);
            }
            break;
          case 5:
          case 517:
            {
              temp_val = { ixfe: val.ixfe, XF: XFs[val.ixfe], v: val.val, t: val.t };
              if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
              safe_format_xf(temp_val, options, wb.opts.Date1904);
              addcell({ c: val.c, r: val.r }, temp_val, options);
            }
            break;
          case 638:
            {
              temp_val = { ixfe: val.ixfe, XF: XFs[val.ixfe], v: val.rknum, t: "n" };
              if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
              safe_format_xf(temp_val, options, wb.opts.Date1904);
              addcell({ c: val.c, r: val.r }, temp_val, options);
            }
            break;
          case 189:
            {
              for (var j = val.c; j <= val.C; ++j) {
                var ixfe = val.rkrec[j - val.c][0];
                temp_val = { ixfe, XF: XFs[ixfe], v: val.rkrec[j - val.c][1], t: "n" };
                if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
                safe_format_xf(temp_val, options, wb.opts.Date1904);
                addcell({ c: j, r: val.r }, temp_val, options);
              }
            }
            break;
          case 6:
          case 518:
          case 1030:
            {
              if (val.val == "String") {
                last_formula = val;
                break;
              }
              temp_val = make_cell(val.val, val.cell.ixfe, val.tt);
              temp_val.XF = XFs[temp_val.ixfe];
              if (options.cellFormula) {
                var _f = val.formula;
                if (_f && _f[0] && _f[0][0] && _f[0][0][0] == "PtgExp") {
                  var _fr = _f[0][0][1][0], _fc = _f[0][0][1][1];
                  var _fe = encode_cell({ r: _fr, c: _fc });
                  if (sharedf[_fe]) temp_val.f = "" + stringify_formula(val.formula, range2, val.cell, supbooks, opts);
                  else temp_val.F = ((options.dense ? (out[_fr] || [])[_fc] : out[_fe]) || {}).F;
                } else temp_val.f = "" + stringify_formula(val.formula, range2, val.cell, supbooks, opts);
              }
              if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
              safe_format_xf(temp_val, options, wb.opts.Date1904);
              addcell(val.cell, temp_val, options);
              last_formula = val;
            }
            break;
          case 7:
          case 519:
            {
              if (last_formula) {
                last_formula.val = val;
                temp_val = make_cell(val, last_formula.cell.ixfe, "s");
                temp_val.XF = XFs[temp_val.ixfe];
                if (options.cellFormula) {
                  temp_val.f = "" + stringify_formula(last_formula.formula, range2, last_formula.cell, supbooks, opts);
                }
                if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
                safe_format_xf(temp_val, options, wb.opts.Date1904);
                addcell(last_formula.cell, temp_val, options);
                last_formula = null;
              } else throw new Error("String record expects Formula");
            }
            break;
          case 33:
          case 545:
            {
              arrayf.push(val);
              var _arraystart = encode_cell(val[0].s);
              cc = options.dense ? (out[val[0].s.r] || [])[val[0].s.c] : out[_arraystart];
              if (options.cellFormula && cc) {
                if (!last_formula) break;
                if (!_arraystart || !cc) break;
                cc.f = "" + stringify_formula(val[1], range2, val[0], supbooks, opts);
                cc.F = encode_range(val[0]);
              }
            }
            break;
          case 1212:
            {
              if (!options.cellFormula) break;
              if (last_cell) {
                if (!last_formula) break;
                sharedf[encode_cell(last_formula.cell)] = val[0];
                cc = options.dense ? (out[last_formula.cell.r] || [])[last_formula.cell.c] : out[encode_cell(last_formula.cell)];
                (cc || {}).f = "" + stringify_formula(val[0], range2, lastcell, supbooks, opts);
              }
            }
            break;
          case 253:
            temp_val = make_cell(sst[val.isst].t, val.ixfe, "s");
            if (sst[val.isst].h) temp_val.h = sst[val.isst].h;
            temp_val.XF = XFs[temp_val.ixfe];
            if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
            safe_format_xf(temp_val, options, wb.opts.Date1904);
            addcell({ c: val.c, r: val.r }, temp_val, options);
            break;
          case 513:
            if (options.sheetStubs) {
              temp_val = { ixfe: val.ixfe, XF: XFs[val.ixfe], t: "z" };
              if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
              safe_format_xf(temp_val, options, wb.opts.Date1904);
              addcell({ c: val.c, r: val.r }, temp_val, options);
            }
            break;
          case 190:
            if (options.sheetStubs) {
              for (var _j = val.c; _j <= val.C; ++_j) {
                var _ixfe = val.ixfe[_j - val.c];
                temp_val = { ixfe: _ixfe, XF: XFs[_ixfe], t: "z" };
                if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
                safe_format_xf(temp_val, options, wb.opts.Date1904);
                addcell({ c: _j, r: val.r }, temp_val, options);
              }
            }
            break;
          case 214:
          case 516:
          case 4:
            temp_val = make_cell(val.val, val.ixfe, "s");
            temp_val.XF = XFs[temp_val.ixfe];
            if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
            safe_format_xf(temp_val, options, wb.opts.Date1904);
            addcell({ c: val.c, r: val.r }, temp_val, options);
            break;
          case 0:
          case 512:
            {
              if (file_depth === 1) range2 = val;
            }
            break;
          case 252:
            {
              sst = val;
            }
            break;
          case 1054:
            {
              if (opts.biff == 4) {
                BIFF2FmtTable[BIFF2Fmt++] = val[1];
                for (var b4idx = 0; b4idx < BIFF2Fmt + 163; ++b4idx) if (table_fmt[b4idx] == val[1]) break;
                if (b4idx >= 163) SSF_load(val[1], BIFF2Fmt + 163);
              } else SSF_load(val[1], val[0]);
            }
            break;
          case 30:
            {
              BIFF2FmtTable[BIFF2Fmt++] = val;
              for (var b2idx = 0; b2idx < BIFF2Fmt + 163; ++b2idx) if (table_fmt[b2idx] == val) break;
              if (b2idx >= 163) SSF_load(val, BIFF2Fmt + 163);
            }
            break;
          case 229:
            merges = merges.concat(val);
            break;
          case 93:
            objects[val.cmo[0]] = opts.lastobj = val;
            break;
          case 438:
            opts.lastobj.TxO = val;
            break;
          case 127:
            opts.lastobj.ImData = val;
            break;
          case 440:
            {
              for (rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR)
                for (rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) {
                  cc = options.dense ? (out[rngR] || [])[rngC] : out[encode_cell({ c: rngC, r: rngR })];
                  if (cc) cc.l = val[1];
                }
            }
            break;
          case 2048:
            {
              for (rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR)
                for (rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) {
                  cc = options.dense ? (out[rngR] || [])[rngC] : out[encode_cell({ c: rngC, r: rngR })];
                  if (cc && cc.l) cc.l.Tooltip = val[1];
                }
            }
            break;
          case 28:
            {
              if (opts.biff <= 5 && opts.biff >= 2) break;
              cc = options.dense ? (out[val[0].r] || [])[val[0].c] : out[encode_cell(val[0])];
              var noteobj = objects[val[2]];
              if (!cc) {
                if (options.dense) {
                  if (!out[val[0].r]) out[val[0].r] = [];
                  cc = out[val[0].r][val[0].c] = { t: "z" };
                } else {
                  cc = out[encode_cell(val[0])] = { t: "z" };
                }
                range2.e.r = Math.max(range2.e.r, val[0].r);
                range2.s.r = Math.min(range2.s.r, val[0].r);
                range2.e.c = Math.max(range2.e.c, val[0].c);
                range2.s.c = Math.min(range2.s.c, val[0].c);
              }
              if (!cc.c) cc.c = [];
              cmnt = { a: val[1], t: noteobj.TxO.t };
              cc.c.push(cmnt);
            }
            break;
          case 2173:
            update_xfext(XFs[val.ixfe], val.ext);
            break;
          case 125:
            {
              if (!opts.cellStyles) break;
              while (val.e >= val.s) {
                colinfo[val.e--] = { width: val.w / 256, level: val.level || 0, hidden: !!(val.flags & 1) };
                if (!seencol) {
                  seencol = true;
                  find_mdw_colw(val.w / 256);
                }
                process_col(colinfo[val.e + 1]);
              }
            }
            break;
          case 520:
            {
              var rowobj = {};
              if (val.level != null) {
                rowinfo[val.r] = rowobj;
                rowobj.level = val.level;
              }
              if (val.hidden) {
                rowinfo[val.r] = rowobj;
                rowobj.hidden = true;
              }
              if (val.hpt) {
                rowinfo[val.r] = rowobj;
                rowobj.hpt = val.hpt;
                rowobj.hpx = pt2px(val.hpt);
              }
            }
            break;
          case 38:
          case 39:
          case 40:
          case 41:
            if (!out["!margins"]) default_margins(out["!margins"] = {});
            out["!margins"][{ 38: "left", 39: "right", 40: "top", 41: "bottom" }[RecordType]] = val;
            break;
          case 161:
            if (!out["!margins"]) default_margins(out["!margins"] = {});
            out["!margins"].header = val.header;
            out["!margins"].footer = val.footer;
            break;
          case 574:
            if (val.RTL) Workbook.Views[0].RTL = true;
            break;
          case 146:
            palette = val;
            break;
          case 2198:
            themes = val;
            break;
          case 140:
            country = val;
            break;
          case 442:
            {
              if (!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook";
              else wsprops.CodeName = val || wsprops.name;
            }
            break;
        }
      } else {
        if (!R) console.error("Missing Info for XLS Record 0x" + RecordType.toString(16));
        blob.l += length;
      }
    }
    wb.SheetNames = keys(Directory).sort(function(a, b) {
      return Number(a) - Number(b);
    }).map(function(x) {
      return Directory[x].name;
    });
    if (!options.bookSheets) wb.Sheets = Sheets;
    if (!wb.SheetNames.length && Preamble["!ref"]) {
      wb.SheetNames.push("Sheet1");
      if (wb.Sheets) wb.Sheets["Sheet1"] = Preamble;
    } else wb.Preamble = Preamble;
    if (wb.Sheets) FilterDatabases.forEach(function(r, i) {
      wb.Sheets[wb.SheetNames[i]]["!autofilter"] = r;
    });
    wb.Strings = sst;
    wb.SSF = dup(table_fmt);
    if (opts.enc) wb.Encryption = opts.enc;
    if (themes) wb.Themes = themes;
    wb.Metadata = {};
    if (country !== void 0) wb.Metadata.Country = country;
    if (supbooks.names.length > 0) Workbook.Names = supbooks.names;
    wb.Workbook = Workbook;
    return wb;
  }
  var PSCLSID = {
    SI: "e0859ff2f94f6810ab9108002b27b3d9",
    DSI: "02d5cdd59c2e1b10939708002b2cf9ae",
    UDI: "05d5cdd59c2e1b10939708002b2cf9ae"
  };
  function parse_xls_props(cfb, props, o) {
    var DSI = CFB.find(cfb, "/!DocumentSummaryInformation");
    if (DSI && DSI.size > 0) try {
      var DocSummary = parse_PropertySetStream(DSI, DocSummaryPIDDSI, PSCLSID.DSI);
      for (var d in DocSummary) props[d] = DocSummary[d];
    } catch (e) {
      if (o.WTF) throw e;
    }
    var SI = CFB.find(cfb, "/!SummaryInformation");
    if (SI && SI.size > 0) try {
      var Summary = parse_PropertySetStream(SI, SummaryPIDSI, PSCLSID.SI);
      for (var s in Summary) if (props[s] == null) props[s] = Summary[s];
    } catch (e) {
      if (o.WTF) throw e;
    }
    if (props.HeadingPairs && props.TitlesOfParts) {
      load_props_pairs(props.HeadingPairs, props.TitlesOfParts, props, o);
      delete props.HeadingPairs;
      delete props.TitlesOfParts;
    }
  }
  function parse_xlscfb(cfb, options) {
    if (!options) options = {};
    fix_read_opts(options);
    reset_cp();
    if (options.codepage) set_ansi(options.codepage);
    var CompObj, WB;
    if (cfb.FullPaths) {
      if (CFB.find(cfb, "/encryption")) throw new Error("File is password-protected");
      CompObj = CFB.find(cfb, "!CompObj");
      WB = CFB.find(cfb, "/Workbook") || CFB.find(cfb, "/Book");
    } else {
      switch (options.type) {
        case "base64":
          cfb = s2a(Base64_decode(cfb));
          break;
        case "binary":
          cfb = s2a(cfb);
          break;
        case "buffer":
          break;
        case "array":
          if (!Array.isArray(cfb)) cfb = Array.prototype.slice.call(cfb);
          break;
      }
      prep_blob(cfb, 0);
      WB = { content: cfb };
    }
    var WorkbookP;
    var _data2;
    if (CompObj) parse_compobj(CompObj);
    if (options.bookProps && !options.bookSheets) WorkbookP = {};
    else {
      var T = has_buf ? "buffer" : "array";
      if (WB && WB.content) WorkbookP = parse_workbook(WB.content, options);
      else if ((_data2 = CFB.find(cfb, "PerfectOffice_MAIN")) && _data2.content) WorkbookP = WK_.to_workbook(_data2.content, (options.type = T, options));
      else if ((_data2 = CFB.find(cfb, "NativeContent_MAIN")) && _data2.content) WorkbookP = WK_.to_workbook(_data2.content, (options.type = T, options));
      else if ((_data2 = CFB.find(cfb, "MN0")) && _data2.content) throw new Error("Unsupported Works 4 for Mac file");
      else throw new Error("Cannot find Workbook stream");
      if (options.bookVBA && cfb.FullPaths && CFB.find(cfb, "/_VBA_PROJECT_CUR/VBA/dir")) WorkbookP.vbaraw = make_vba_xls(cfb);
    }
    var props = {};
    if (cfb.FullPaths) parse_xls_props(
      /*::((*/
      cfb,
      props,
      options
    );
    WorkbookP.Props = WorkbookP.Custprops = props;
    if (options.bookFiles) WorkbookP.cfb = cfb;
    return WorkbookP;
  }
  var XLSBRecordEnum = {
    /*::[*/
    0: {
      /* n:"BrtRowHdr", */
      f: parse_BrtRowHdr
    },
    /*::[*/
    1: {
      /* n:"BrtCellBlank", */
      f: parse_BrtCellBlank
    },
    /*::[*/
    2: {
      /* n:"BrtCellRk", */
      f: parse_BrtCellRk
    },
    /*::[*/
    3: {
      /* n:"BrtCellError", */
      f: parse_BrtCellError
    },
    /*::[*/
    4: {
      /* n:"BrtCellBool", */
      f: parse_BrtCellBool
    },
    /*::[*/
    5: {
      /* n:"BrtCellReal", */
      f: parse_BrtCellReal
    },
    /*::[*/
    6: {
      /* n:"BrtCellSt", */
      f: parse_BrtCellSt
    },
    /*::[*/
    7: {
      /* n:"BrtCellIsst", */
      f: parse_BrtCellIsst
    },
    /*::[*/
    8: {
      /* n:"BrtFmlaString", */
      f: parse_BrtFmlaString
    },
    /*::[*/
    9: {
      /* n:"BrtFmlaNum", */
      f: parse_BrtFmlaNum
    },
    /*::[*/
    10: {
      /* n:"BrtFmlaBool", */
      f: parse_BrtFmlaBool
    },
    /*::[*/
    11: {
      /* n:"BrtFmlaError", */
      f: parse_BrtFmlaError
    },
    /*::[*/
    12: {
      /* n:"BrtShortBlank", */
      f: parse_BrtShortBlank
    },
    /*::[*/
    13: {
      /* n:"BrtShortRk", */
      f: parse_BrtShortRk
    },
    /*::[*/
    14: {
      /* n:"BrtShortError", */
      f: parse_BrtShortError
    },
    /*::[*/
    15: {
      /* n:"BrtShortBool", */
      f: parse_BrtShortBool
    },
    /*::[*/
    16: {
      /* n:"BrtShortReal", */
      f: parse_BrtShortReal
    },
    /*::[*/
    17: {
      /* n:"BrtShortSt", */
      f: parse_BrtShortSt
    },
    /*::[*/
    18: {
      /* n:"BrtShortIsst", */
      f: parse_BrtShortIsst
    },
    /*::[*/
    19: {
      /* n:"BrtSSTItem", */
      f: parse_RichStr
    },
    /*::[*/
    20: {
      /* n:"BrtPCDIMissing" */
    },
    /*::[*/
    21: {
      /* n:"BrtPCDINumber" */
    },
    /*::[*/
    22: {
      /* n:"BrtPCDIBoolean" */
    },
    /*::[*/
    23: {
      /* n:"BrtPCDIError" */
    },
    /*::[*/
    24: {
      /* n:"BrtPCDIString" */
    },
    /*::[*/
    25: {
      /* n:"BrtPCDIDatetime" */
    },
    /*::[*/
    26: {
      /* n:"BrtPCDIIndex" */
    },
    /*::[*/
    27: {
      /* n:"BrtPCDIAMissing" */
    },
    /*::[*/
    28: {
      /* n:"BrtPCDIANumber" */
    },
    /*::[*/
    29: {
      /* n:"BrtPCDIABoolean" */
    },
    /*::[*/
    30: {
      /* n:"BrtPCDIAError" */
    },
    /*::[*/
    31: {
      /* n:"BrtPCDIAString" */
    },
    /*::[*/
    32: {
      /* n:"BrtPCDIADatetime" */
    },
    /*::[*/
    33: {
      /* n:"BrtPCRRecord" */
    },
    /*::[*/
    34: {
      /* n:"BrtPCRRecordDt" */
    },
    /*::[*/
    35: {
      /* n:"BrtFRTBegin", */
      T: 1
    },
    /*::[*/
    36: {
      /* n:"BrtFRTEnd", */
      T: -1
    },
    /*::[*/
    37: {
      /* n:"BrtACBegin", */
      T: 1
    },
    /*::[*/
    38: {
      /* n:"BrtACEnd", */
      T: -1
    },
    /*::[*/
    39: {
      /* n:"BrtName", */
      f: parse_BrtName
    },
    /*::[*/
    40: {
      /* n:"BrtIndexRowBlock" */
    },
    /*::[*/
    42: {
      /* n:"BrtIndexBlock" */
    },
    /*::[*/
    43: {
      /* n:"BrtFont", */
      f: parse_BrtFont
    },
    /*::[*/
    44: {
      /* n:"BrtFmt", */
      f: parse_BrtFmt
    },
    /*::[*/
    45: {
      /* n:"BrtFill", */
      f: parse_BrtFill
    },
    /*::[*/
    46: {
      /* n:"BrtBorder", */
      f: parse_BrtBorder
    },
    /*::[*/
    47: {
      /* n:"BrtXF", */
      f: parse_BrtXF
    },
    /*::[*/
    48: {
      /* n:"BrtStyle" */
    },
    /*::[*/
    49: {
      /* n:"BrtCellMeta", */
      f: parse_Int32LE
    },
    /*::[*/
    50: {
      /* n:"BrtValueMeta" */
    },
    /*::[*/
    51: {
      /* n:"BrtMdb" */
      f: parse_BrtMdb
    },
    /*::[*/
    52: {
      /* n:"BrtBeginFmd", */
      T: 1
    },
    /*::[*/
    53: {
      /* n:"BrtEndFmd", */
      T: -1
    },
    /*::[*/
    54: {
      /* n:"BrtBeginMdx", */
      T: 1
    },
    /*::[*/
    55: {
      /* n:"BrtEndMdx", */
      T: -1
    },
    /*::[*/
    56: {
      /* n:"BrtBeginMdxTuple", */
      T: 1
    },
    /*::[*/
    57: {
      /* n:"BrtEndMdxTuple", */
      T: -1
    },
    /*::[*/
    58: {
      /* n:"BrtMdxMbrIstr" */
    },
    /*::[*/
    59: {
      /* n:"BrtStr" */
    },
    /*::[*/
    60: {
      /* n:"BrtColInfo", */
      f: parse_ColInfo
    },
    /*::[*/
    62: {
      /* n:"BrtCellRString", */
      f: parse_BrtCellRString
    },
    /*::[*/
    63: {
      /* n:"BrtCalcChainItem$", */
      f: parse_BrtCalcChainItem$
    },
    /*::[*/
    64: {
      /* n:"BrtDVal", */
      f: parse_BrtDVal
    },
    /*::[*/
    65: {
      /* n:"BrtSxvcellNum" */
    },
    /*::[*/
    66: {
      /* n:"BrtSxvcellStr" */
    },
    /*::[*/
    67: {
      /* n:"BrtSxvcellBool" */
    },
    /*::[*/
    68: {
      /* n:"BrtSxvcellErr" */
    },
    /*::[*/
    69: {
      /* n:"BrtSxvcellDate" */
    },
    /*::[*/
    70: {
      /* n:"BrtSxvcellNil" */
    },
    /*::[*/
    128: {
      /* n:"BrtFileVersion" */
    },
    /*::[*/
    129: {
      /* n:"BrtBeginSheet", */
      T: 1
    },
    /*::[*/
    130: {
      /* n:"BrtEndSheet", */
      T: -1
    },
    /*::[*/
    131: {
      /* n:"BrtBeginBook", */
      T: 1,
      f: parsenoop,
      p: 0
    },
    /*::[*/
    132: {
      /* n:"BrtEndBook", */
      T: -1
    },
    /*::[*/
    133: {
      /* n:"BrtBeginWsViews", */
      T: 1
    },
    /*::[*/
    134: {
      /* n:"BrtEndWsViews", */
      T: -1
    },
    /*::[*/
    135: {
      /* n:"BrtBeginBookViews", */
      T: 1
    },
    /*::[*/
    136: {
      /* n:"BrtEndBookViews", */
      T: -1
    },
    /*::[*/
    137: {
      /* n:"BrtBeginWsView", */
      T: 1,
      f: parse_BrtBeginWsView
    },
    /*::[*/
    138: {
      /* n:"BrtEndWsView", */
      T: -1
    },
    /*::[*/
    139: {
      /* n:"BrtBeginCsViews", */
      T: 1
    },
    /*::[*/
    140: {
      /* n:"BrtEndCsViews", */
      T: -1
    },
    /*::[*/
    141: {
      /* n:"BrtBeginCsView", */
      T: 1
    },
    /*::[*/
    142: {
      /* n:"BrtEndCsView", */
      T: -1
    },
    /*::[*/
    143: {
      /* n:"BrtBeginBundleShs", */
      T: 1
    },
    /*::[*/
    144: {
      /* n:"BrtEndBundleShs", */
      T: -1
    },
    /*::[*/
    145: {
      /* n:"BrtBeginSheetData", */
      T: 1
    },
    /*::[*/
    146: {
      /* n:"BrtEndSheetData", */
      T: -1
    },
    /*::[*/
    147: {
      /* n:"BrtWsProp", */
      f: parse_BrtWsProp
    },
    /*::[*/
    148: {
      /* n:"BrtWsDim", */
      f: parse_BrtWsDim,
      p: 16
    },
    /*::[*/
    151: {
      /* n:"BrtPane", */
      f: parse_BrtPane
    },
    /*::[*/
    152: {
      /* n:"BrtSel" */
    },
    /*::[*/
    153: {
      /* n:"BrtWbProp", */
      f: parse_BrtWbProp
    },
    /*::[*/
    154: {
      /* n:"BrtWbFactoid" */
    },
    /*::[*/
    155: {
      /* n:"BrtFileRecover" */
    },
    /*::[*/
    156: {
      /* n:"BrtBundleSh", */
      f: parse_BrtBundleSh
    },
    /*::[*/
    157: {
      /* n:"BrtCalcProp" */
    },
    /*::[*/
    158: {
      /* n:"BrtBookView" */
    },
    /*::[*/
    159: {
      /* n:"BrtBeginSst", */
      T: 1,
      f: parse_BrtBeginSst
    },
    /*::[*/
    160: {
      /* n:"BrtEndSst", */
      T: -1
    },
    /*::[*/
    161: {
      /* n:"BrtBeginAFilter", */
      T: 1,
      f: parse_UncheckedRfX
    },
    /*::[*/
    162: {
      /* n:"BrtEndAFilter", */
      T: -1
    },
    /*::[*/
    163: {
      /* n:"BrtBeginFilterColumn", */
      T: 1
    },
    /*::[*/
    164: {
      /* n:"BrtEndFilterColumn", */
      T: -1
    },
    /*::[*/
    165: {
      /* n:"BrtBeginFilters", */
      T: 1
    },
    /*::[*/
    166: {
      /* n:"BrtEndFilters", */
      T: -1
    },
    /*::[*/
    167: {
      /* n:"BrtFilter" */
    },
    /*::[*/
    168: {
      /* n:"BrtColorFilter" */
    },
    /*::[*/
    169: {
      /* n:"BrtIconFilter" */
    },
    /*::[*/
    170: {
      /* n:"BrtTop10Filter" */
    },
    /*::[*/
    171: {
      /* n:"BrtDynamicFilter" */
    },
    /*::[*/
    172: {
      /* n:"BrtBeginCustomFilters", */
      T: 1
    },
    /*::[*/
    173: {
      /* n:"BrtEndCustomFilters", */
      T: -1
    },
    /*::[*/
    174: {
      /* n:"BrtCustomFilter" */
    },
    /*::[*/
    175: {
      /* n:"BrtAFilterDateGroupItem" */
    },
    /*::[*/
    176: {
      /* n:"BrtMergeCell", */
      f: parse_BrtMergeCell
    },
    /*::[*/
    177: {
      /* n:"BrtBeginMergeCells", */
      T: 1
    },
    /*::[*/
    178: {
      /* n:"BrtEndMergeCells", */
      T: -1
    },
    /*::[*/
    179: {
      /* n:"BrtBeginPivotCacheDef", */
      T: 1
    },
    /*::[*/
    180: {
      /* n:"BrtEndPivotCacheDef", */
      T: -1
    },
    /*::[*/
    181: {
      /* n:"BrtBeginPCDFields", */
      T: 1
    },
    /*::[*/
    182: {
      /* n:"BrtEndPCDFields", */
      T: -1
    },
    /*::[*/
    183: {
      /* n:"BrtBeginPCDField", */
      T: 1
    },
    /*::[*/
    184: {
      /* n:"BrtEndPCDField", */
      T: -1
    },
    /*::[*/
    185: {
      /* n:"BrtBeginPCDSource", */
      T: 1
    },
    /*::[*/
    186: {
      /* n:"BrtEndPCDSource", */
      T: -1
    },
    /*::[*/
    187: {
      /* n:"BrtBeginPCDSRange", */
      T: 1
    },
    /*::[*/
    188: {
      /* n:"BrtEndPCDSRange", */
      T: -1
    },
    /*::[*/
    189: {
      /* n:"BrtBeginPCDFAtbl", */
      T: 1
    },
    /*::[*/
    190: {
      /* n:"BrtEndPCDFAtbl", */
      T: -1
    },
    /*::[*/
    191: {
      /* n:"BrtBeginPCDIRun", */
      T: 1
    },
    /*::[*/
    192: {
      /* n:"BrtEndPCDIRun", */
      T: -1
    },
    /*::[*/
    193: {
      /* n:"BrtBeginPivotCacheRecords", */
      T: 1
    },
    /*::[*/
    194: {
      /* n:"BrtEndPivotCacheRecords", */
      T: -1
    },
    /*::[*/
    195: {
      /* n:"BrtBeginPCDHierarchies", */
      T: 1
    },
    /*::[*/
    196: {
      /* n:"BrtEndPCDHierarchies", */
      T: -1
    },
    /*::[*/
    197: {
      /* n:"BrtBeginPCDHierarchy", */
      T: 1
    },
    /*::[*/
    198: {
      /* n:"BrtEndPCDHierarchy", */
      T: -1
    },
    /*::[*/
    199: {
      /* n:"BrtBeginPCDHFieldsUsage", */
      T: 1
    },
    /*::[*/
    200: {
      /* n:"BrtEndPCDHFieldsUsage", */
      T: -1
    },
    /*::[*/
    201: {
      /* n:"BrtBeginExtConnection", */
      T: 1
    },
    /*::[*/
    202: {
      /* n:"BrtEndExtConnection", */
      T: -1
    },
    /*::[*/
    203: {
      /* n:"BrtBeginECDbProps", */
      T: 1
    },
    /*::[*/
    204: {
      /* n:"BrtEndECDbProps", */
      T: -1
    },
    /*::[*/
    205: {
      /* n:"BrtBeginECOlapProps", */
      T: 1
    },
    /*::[*/
    206: {
      /* n:"BrtEndECOlapProps", */
      T: -1
    },
    /*::[*/
    207: {
      /* n:"BrtBeginPCDSConsol", */
      T: 1
    },
    /*::[*/
    208: {
      /* n:"BrtEndPCDSConsol", */
      T: -1
    },
    /*::[*/
    209: {
      /* n:"BrtBeginPCDSCPages", */
      T: 1
    },
    /*::[*/
    210: {
      /* n:"BrtEndPCDSCPages", */
      T: -1
    },
    /*::[*/
    211: {
      /* n:"BrtBeginPCDSCPage", */
      T: 1
    },
    /*::[*/
    212: {
      /* n:"BrtEndPCDSCPage", */
      T: -1
    },
    /*::[*/
    213: {
      /* n:"BrtBeginPCDSCPItem", */
      T: 1
    },
    /*::[*/
    214: {
      /* n:"BrtEndPCDSCPItem", */
      T: -1
    },
    /*::[*/
    215: {
      /* n:"BrtBeginPCDSCSets", */
      T: 1
    },
    /*::[*/
    216: {
      /* n:"BrtEndPCDSCSets", */
      T: -1
    },
    /*::[*/
    217: {
      /* n:"BrtBeginPCDSCSet", */
      T: 1
    },
    /*::[*/
    218: {
      /* n:"BrtEndPCDSCSet", */
      T: -1
    },
    /*::[*/
    219: {
      /* n:"BrtBeginPCDFGroup", */
      T: 1
    },
    /*::[*/
    220: {
      /* n:"BrtEndPCDFGroup", */
      T: -1
    },
    /*::[*/
    221: {
      /* n:"BrtBeginPCDFGItems", */
      T: 1
    },
    /*::[*/
    222: {
      /* n:"BrtEndPCDFGItems", */
      T: -1
    },
    /*::[*/
    223: {
      /* n:"BrtBeginPCDFGRange", */
      T: 1
    },
    /*::[*/
    224: {
      /* n:"BrtEndPCDFGRange", */
      T: -1
    },
    /*::[*/
    225: {
      /* n:"BrtBeginPCDFGDiscrete", */
      T: 1
    },
    /*::[*/
    226: {
      /* n:"BrtEndPCDFGDiscrete", */
      T: -1
    },
    /*::[*/
    227: {
      /* n:"BrtBeginPCDSDTupleCache", */
      T: 1
    },
    /*::[*/
    228: {
      /* n:"BrtEndPCDSDTupleCache", */
      T: -1
    },
    /*::[*/
    229: {
      /* n:"BrtBeginPCDSDTCEntries", */
      T: 1
    },
    /*::[*/
    230: {
      /* n:"BrtEndPCDSDTCEntries", */
      T: -1
    },
    /*::[*/
    231: {
      /* n:"BrtBeginPCDSDTCEMembers", */
      T: 1
    },
    /*::[*/
    232: {
      /* n:"BrtEndPCDSDTCEMembers", */
      T: -1
    },
    /*::[*/
    233: {
      /* n:"BrtBeginPCDSDTCEMember", */
      T: 1
    },
    /*::[*/
    234: {
      /* n:"BrtEndPCDSDTCEMember", */
      T: -1
    },
    /*::[*/
    235: {
      /* n:"BrtBeginPCDSDTCQueries", */
      T: 1
    },
    /*::[*/
    236: {
      /* n:"BrtEndPCDSDTCQueries", */
      T: -1
    },
    /*::[*/
    237: {
      /* n:"BrtBeginPCDSDTCQuery", */
      T: 1
    },
    /*::[*/
    238: {
      /* n:"BrtEndPCDSDTCQuery", */
      T: -1
    },
    /*::[*/
    239: {
      /* n:"BrtBeginPCDSDTCSets", */
      T: 1
    },
    /*::[*/
    240: {
      /* n:"BrtEndPCDSDTCSets", */
      T: -1
    },
    /*::[*/
    241: {
      /* n:"BrtBeginPCDSDTCSet", */
      T: 1
    },
    /*::[*/
    242: {
      /* n:"BrtEndPCDSDTCSet", */
      T: -1
    },
    /*::[*/
    243: {
      /* n:"BrtBeginPCDCalcItems", */
      T: 1
    },
    /*::[*/
    244: {
      /* n:"BrtEndPCDCalcItems", */
      T: -1
    },
    /*::[*/
    245: {
      /* n:"BrtBeginPCDCalcItem", */
      T: 1
    },
    /*::[*/
    246: {
      /* n:"BrtEndPCDCalcItem", */
      T: -1
    },
    /*::[*/
    247: {
      /* n:"BrtBeginPRule", */
      T: 1
    },
    /*::[*/
    248: {
      /* n:"BrtEndPRule", */
      T: -1
    },
    /*::[*/
    249: {
      /* n:"BrtBeginPRFilters", */
      T: 1
    },
    /*::[*/
    250: {
      /* n:"BrtEndPRFilters", */
      T: -1
    },
    /*::[*/
    251: {
      /* n:"BrtBeginPRFilter", */
      T: 1
    },
    /*::[*/
    252: {
      /* n:"BrtEndPRFilter", */
      T: -1
    },
    /*::[*/
    253: {
      /* n:"BrtBeginPNames", */
      T: 1
    },
    /*::[*/
    254: {
      /* n:"BrtEndPNames", */
      T: -1
    },
    /*::[*/
    255: {
      /* n:"BrtBeginPName", */
      T: 1
    },
    /*::[*/
    256: {
      /* n:"BrtEndPName", */
      T: -1
    },
    /*::[*/
    257: {
      /* n:"BrtBeginPNPairs", */
      T: 1
    },
    /*::[*/
    258: {
      /* n:"BrtEndPNPairs", */
      T: -1
    },
    /*::[*/
    259: {
      /* n:"BrtBeginPNPair", */
      T: 1
    },
    /*::[*/
    260: {
      /* n:"BrtEndPNPair", */
      T: -1
    },
    /*::[*/
    261: {
      /* n:"BrtBeginECWebProps", */
      T: 1
    },
    /*::[*/
    262: {
      /* n:"BrtEndECWebProps", */
      T: -1
    },
    /*::[*/
    263: {
      /* n:"BrtBeginEcWpTables", */
      T: 1
    },
    /*::[*/
    264: {
      /* n:"BrtEndECWPTables", */
      T: -1
    },
    /*::[*/
    265: {
      /* n:"BrtBeginECParams", */
      T: 1
    },
    /*::[*/
    266: {
      /* n:"BrtEndECParams", */
      T: -1
    },
    /*::[*/
    267: {
      /* n:"BrtBeginECParam", */
      T: 1
    },
    /*::[*/
    268: {
      /* n:"BrtEndECParam", */
      T: -1
    },
    /*::[*/
    269: {
      /* n:"BrtBeginPCDKPIs", */
      T: 1
    },
    /*::[*/
    270: {
      /* n:"BrtEndPCDKPIs", */
      T: -1
    },
    /*::[*/
    271: {
      /* n:"BrtBeginPCDKPI", */
      T: 1
    },
    /*::[*/
    272: {
      /* n:"BrtEndPCDKPI", */
      T: -1
    },
    /*::[*/
    273: {
      /* n:"BrtBeginDims", */
      T: 1
    },
    /*::[*/
    274: {
      /* n:"BrtEndDims", */
      T: -1
    },
    /*::[*/
    275: {
      /* n:"BrtBeginDim", */
      T: 1
    },
    /*::[*/
    276: {
      /* n:"BrtEndDim", */
      T: -1
    },
    /*::[*/
    277: {
      /* n:"BrtIndexPartEnd" */
    },
    /*::[*/
    278: {
      /* n:"BrtBeginStyleSheet", */
      T: 1
    },
    /*::[*/
    279: {
      /* n:"BrtEndStyleSheet", */
      T: -1
    },
    /*::[*/
    280: {
      /* n:"BrtBeginSXView", */
      T: 1
    },
    /*::[*/
    281: {
      /* n:"BrtEndSXVI", */
      T: -1
    },
    /*::[*/
    282: {
      /* n:"BrtBeginSXVI", */
      T: 1
    },
    /*::[*/
    283: {
      /* n:"BrtBeginSXVIs", */
      T: 1
    },
    /*::[*/
    284: {
      /* n:"BrtEndSXVIs", */
      T: -1
    },
    /*::[*/
    285: {
      /* n:"BrtBeginSXVD", */
      T: 1
    },
    /*::[*/
    286: {
      /* n:"BrtEndSXVD", */
      T: -1
    },
    /*::[*/
    287: {
      /* n:"BrtBeginSXVDs", */
      T: 1
    },
    /*::[*/
    288: {
      /* n:"BrtEndSXVDs", */
      T: -1
    },
    /*::[*/
    289: {
      /* n:"BrtBeginSXPI", */
      T: 1
    },
    /*::[*/
    290: {
      /* n:"BrtEndSXPI", */
      T: -1
    },
    /*::[*/
    291: {
      /* n:"BrtBeginSXPIs", */
      T: 1
    },
    /*::[*/
    292: {
      /* n:"BrtEndSXPIs", */
      T: -1
    },
    /*::[*/
    293: {
      /* n:"BrtBeginSXDI", */
      T: 1
    },
    /*::[*/
    294: {
      /* n:"BrtEndSXDI", */
      T: -1
    },
    /*::[*/
    295: {
      /* n:"BrtBeginSXDIs", */
      T: 1
    },
    /*::[*/
    296: {
      /* n:"BrtEndSXDIs", */
      T: -1
    },
    /*::[*/
    297: {
      /* n:"BrtBeginSXLI", */
      T: 1
    },
    /*::[*/
    298: {
      /* n:"BrtEndSXLI", */
      T: -1
    },
    /*::[*/
    299: {
      /* n:"BrtBeginSXLIRws", */
      T: 1
    },
    /*::[*/
    300: {
      /* n:"BrtEndSXLIRws", */
      T: -1
    },
    /*::[*/
    301: {
      /* n:"BrtBeginSXLICols", */
      T: 1
    },
    /*::[*/
    302: {
      /* n:"BrtEndSXLICols", */
      T: -1
    },
    /*::[*/
    303: {
      /* n:"BrtBeginSXFormat", */
      T: 1
    },
    /*::[*/
    304: {
      /* n:"BrtEndSXFormat", */
      T: -1
    },
    /*::[*/
    305: {
      /* n:"BrtBeginSXFormats", */
      T: 1
    },
    /*::[*/
    306: {
      /* n:"BrtEndSxFormats", */
      T: -1
    },
    /*::[*/
    307: {
      /* n:"BrtBeginSxSelect", */
      T: 1
    },
    /*::[*/
    308: {
      /* n:"BrtEndSxSelect", */
      T: -1
    },
    /*::[*/
    309: {
      /* n:"BrtBeginISXVDRws", */
      T: 1
    },
    /*::[*/
    310: {
      /* n:"BrtEndISXVDRws", */
      T: -1
    },
    /*::[*/
    311: {
      /* n:"BrtBeginISXVDCols", */
      T: 1
    },
    /*::[*/
    312: {
      /* n:"BrtEndISXVDCols", */
      T: -1
    },
    /*::[*/
    313: {
      /* n:"BrtEndSXLocation", */
      T: -1
    },
    /*::[*/
    314: {
      /* n:"BrtBeginSXLocation", */
      T: 1
    },
    /*::[*/
    315: {
      /* n:"BrtEndSXView", */
      T: -1
    },
    /*::[*/
    316: {
      /* n:"BrtBeginSXTHs", */
      T: 1
    },
    /*::[*/
    317: {
      /* n:"BrtEndSXTHs", */
      T: -1
    },
    /*::[*/
    318: {
      /* n:"BrtBeginSXTH", */
      T: 1
    },
    /*::[*/
    319: {
      /* n:"BrtEndSXTH", */
      T: -1
    },
    /*::[*/
    320: {
      /* n:"BrtBeginISXTHRws", */
      T: 1
    },
    /*::[*/
    321: {
      /* n:"BrtEndISXTHRws", */
      T: -1
    },
    /*::[*/
    322: {
      /* n:"BrtBeginISXTHCols", */
      T: 1
    },
    /*::[*/
    323: {
      /* n:"BrtEndISXTHCols", */
      T: -1
    },
    /*::[*/
    324: {
      /* n:"BrtBeginSXTDMPS", */
      T: 1
    },
    /*::[*/
    325: {
      /* n:"BrtEndSXTDMPs", */
      T: -1
    },
    /*::[*/
    326: {
      /* n:"BrtBeginSXTDMP", */
      T: 1
    },
    /*::[*/
    327: {
      /* n:"BrtEndSXTDMP", */
      T: -1
    },
    /*::[*/
    328: {
      /* n:"BrtBeginSXTHItems", */
      T: 1
    },
    /*::[*/
    329: {
      /* n:"BrtEndSXTHItems", */
      T: -1
    },
    /*::[*/
    330: {
      /* n:"BrtBeginSXTHItem", */
      T: 1
    },
    /*::[*/
    331: {
      /* n:"BrtEndSXTHItem", */
      T: -1
    },
    /*::[*/
    332: {
      /* n:"BrtBeginMetadata", */
      T: 1
    },
    /*::[*/
    333: {
      /* n:"BrtEndMetadata", */
      T: -1
    },
    /*::[*/
    334: {
      /* n:"BrtBeginEsmdtinfo", */
      T: 1
    },
    /*::[*/
    335: {
      /* n:"BrtMdtinfo", */
      f: parse_BrtMdtinfo
    },
    /*::[*/
    336: {
      /* n:"BrtEndEsmdtinfo", */
      T: -1
    },
    /*::[*/
    337: {
      /* n:"BrtBeginEsmdb", */
      f: parse_BrtBeginEsmdb,
      T: 1
    },
    /*::[*/
    338: {
      /* n:"BrtEndEsmdb", */
      T: -1
    },
    /*::[*/
    339: {
      /* n:"BrtBeginEsfmd", */
      T: 1
    },
    /*::[*/
    340: {
      /* n:"BrtEndEsfmd", */
      T: -1
    },
    /*::[*/
    341: {
      /* n:"BrtBeginSingleCells", */
      T: 1
    },
    /*::[*/
    342: {
      /* n:"BrtEndSingleCells", */
      T: -1
    },
    /*::[*/
    343: {
      /* n:"BrtBeginList", */
      T: 1
    },
    /*::[*/
    344: {
      /* n:"BrtEndList", */
      T: -1
    },
    /*::[*/
    345: {
      /* n:"BrtBeginListCols", */
      T: 1
    },
    /*::[*/
    346: {
      /* n:"BrtEndListCols", */
      T: -1
    },
    /*::[*/
    347: {
      /* n:"BrtBeginListCol", */
      T: 1
    },
    /*::[*/
    348: {
      /* n:"BrtEndListCol", */
      T: -1
    },
    /*::[*/
    349: {
      /* n:"BrtBeginListXmlCPr", */
      T: 1
    },
    /*::[*/
    350: {
      /* n:"BrtEndListXmlCPr", */
      T: -1
    },
    /*::[*/
    351: {
      /* n:"BrtListCCFmla" */
    },
    /*::[*/
    352: {
      /* n:"BrtListTrFmla" */
    },
    /*::[*/
    353: {
      /* n:"BrtBeginExternals", */
      T: 1
    },
    /*::[*/
    354: {
      /* n:"BrtEndExternals", */
      T: -1
    },
    /*::[*/
    355: {
      /* n:"BrtSupBookSrc", */
      f: parse_RelID
    },
    /*::[*/
    357: {
      /* n:"BrtSupSelf" */
    },
    /*::[*/
    358: {
      /* n:"BrtSupSame" */
    },
    /*::[*/
    359: {
      /* n:"BrtSupTabs" */
    },
    /*::[*/
    360: {
      /* n:"BrtBeginSupBook", */
      T: 1
    },
    /*::[*/
    361: {
      /* n:"BrtPlaceholderName" */
    },
    /*::[*/
    362: {
      /* n:"BrtExternSheet", */
      f: parse_ExternSheet
    },
    /*::[*/
    363: {
      /* n:"BrtExternTableStart" */
    },
    /*::[*/
    364: {
      /* n:"BrtExternTableEnd" */
    },
    /*::[*/
    366: {
      /* n:"BrtExternRowHdr" */
    },
    /*::[*/
    367: {
      /* n:"BrtExternCellBlank" */
    },
    /*::[*/
    368: {
      /* n:"BrtExternCellReal" */
    },
    /*::[*/
    369: {
      /* n:"BrtExternCellBool" */
    },
    /*::[*/
    370: {
      /* n:"BrtExternCellError" */
    },
    /*::[*/
    371: {
      /* n:"BrtExternCellString" */
    },
    /*::[*/
    372: {
      /* n:"BrtBeginEsmdx", */
      T: 1
    },
    /*::[*/
    373: {
      /* n:"BrtEndEsmdx", */
      T: -1
    },
    /*::[*/
    374: {
      /* n:"BrtBeginMdxSet", */
      T: 1
    },
    /*::[*/
    375: {
      /* n:"BrtEndMdxSet", */
      T: -1
    },
    /*::[*/
    376: {
      /* n:"BrtBeginMdxMbrProp", */
      T: 1
    },
    /*::[*/
    377: {
      /* n:"BrtEndMdxMbrProp", */
      T: -1
    },
    /*::[*/
    378: {
      /* n:"BrtBeginMdxKPI", */
      T: 1
    },
    /*::[*/
    379: {
      /* n:"BrtEndMdxKPI", */
      T: -1
    },
    /*::[*/
    380: {
      /* n:"BrtBeginEsstr", */
      T: 1
    },
    /*::[*/
    381: {
      /* n:"BrtEndEsstr", */
      T: -1
    },
    /*::[*/
    382: {
      /* n:"BrtBeginPRFItem", */
      T: 1
    },
    /*::[*/
    383: {
      /* n:"BrtEndPRFItem", */
      T: -1
    },
    /*::[*/
    384: {
      /* n:"BrtBeginPivotCacheIDs", */
      T: 1
    },
    /*::[*/
    385: {
      /* n:"BrtEndPivotCacheIDs", */
      T: -1
    },
    /*::[*/
    386: {
      /* n:"BrtBeginPivotCacheID", */
      T: 1
    },
    /*::[*/
    387: {
      /* n:"BrtEndPivotCacheID", */
      T: -1
    },
    /*::[*/
    388: {
      /* n:"BrtBeginISXVIs", */
      T: 1
    },
    /*::[*/
    389: {
      /* n:"BrtEndISXVIs", */
      T: -1
    },
    /*::[*/
    390: {
      /* n:"BrtBeginColInfos", */
      T: 1
    },
    /*::[*/
    391: {
      /* n:"BrtEndColInfos", */
      T: -1
    },
    /*::[*/
    392: {
      /* n:"BrtBeginRwBrk", */
      T: 1
    },
    /*::[*/
    393: {
      /* n:"BrtEndRwBrk", */
      T: -1
    },
    /*::[*/
    394: {
      /* n:"BrtBeginColBrk", */
      T: 1
    },
    /*::[*/
    395: {
      /* n:"BrtEndColBrk", */
      T: -1
    },
    /*::[*/
    396: {
      /* n:"BrtBrk" */
    },
    /*::[*/
    397: {
      /* n:"BrtUserBookView" */
    },
    /*::[*/
    398: {
      /* n:"BrtInfo" */
    },
    /*::[*/
    399: {
      /* n:"BrtCUsr" */
    },
    /*::[*/
    400: {
      /* n:"BrtUsr" */
    },
    /*::[*/
    401: {
      /* n:"BrtBeginUsers", */
      T: 1
    },
    /*::[*/
    403: {
      /* n:"BrtEOF" */
    },
    /*::[*/
    404: {
      /* n:"BrtUCR" */
    },
    /*::[*/
    405: {
      /* n:"BrtRRInsDel" */
    },
    /*::[*/
    406: {
      /* n:"BrtRREndInsDel" */
    },
    /*::[*/
    407: {
      /* n:"BrtRRMove" */
    },
    /*::[*/
    408: {
      /* n:"BrtRREndMove" */
    },
    /*::[*/
    409: {
      /* n:"BrtRRChgCell" */
    },
    /*::[*/
    410: {
      /* n:"BrtRREndChgCell" */
    },
    /*::[*/
    411: {
      /* n:"BrtRRHeader" */
    },
    /*::[*/
    412: {
      /* n:"BrtRRUserView" */
    },
    /*::[*/
    413: {
      /* n:"BrtRRRenSheet" */
    },
    /*::[*/
    414: {
      /* n:"BrtRRInsertSh" */
    },
    /*::[*/
    415: {
      /* n:"BrtRRDefName" */
    },
    /*::[*/
    416: {
      /* n:"BrtRRNote" */
    },
    /*::[*/
    417: {
      /* n:"BrtRRConflict" */
    },
    /*::[*/
    418: {
      /* n:"BrtRRTQSIF" */
    },
    /*::[*/
    419: {
      /* n:"BrtRRFormat" */
    },
    /*::[*/
    420: {
      /* n:"BrtRREndFormat" */
    },
    /*::[*/
    421: {
      /* n:"BrtRRAutoFmt" */
    },
    /*::[*/
    422: {
      /* n:"BrtBeginUserShViews", */
      T: 1
    },
    /*::[*/
    423: {
      /* n:"BrtBeginUserShView", */
      T: 1
    },
    /*::[*/
    424: {
      /* n:"BrtEndUserShView", */
      T: -1
    },
    /*::[*/
    425: {
      /* n:"BrtEndUserShViews", */
      T: -1
    },
    /*::[*/
    426: {
      /* n:"BrtArrFmla", */
      f: parse_BrtArrFmla
    },
    /*::[*/
    427: {
      /* n:"BrtShrFmla", */
      f: parse_BrtShrFmla
    },
    /*::[*/
    428: {
      /* n:"BrtTable" */
    },
    /*::[*/
    429: {
      /* n:"BrtBeginExtConnections", */
      T: 1
    },
    /*::[*/
    430: {
      /* n:"BrtEndExtConnections", */
      T: -1
    },
    /*::[*/
    431: {
      /* n:"BrtBeginPCDCalcMems", */
      T: 1
    },
    /*::[*/
    432: {
      /* n:"BrtEndPCDCalcMems", */
      T: -1
    },
    /*::[*/
    433: {
      /* n:"BrtBeginPCDCalcMem", */
      T: 1
    },
    /*::[*/
    434: {
      /* n:"BrtEndPCDCalcMem", */
      T: -1
    },
    /*::[*/
    435: {
      /* n:"BrtBeginPCDHGLevels", */
      T: 1
    },
    /*::[*/
    436: {
      /* n:"BrtEndPCDHGLevels", */
      T: -1
    },
    /*::[*/
    437: {
      /* n:"BrtBeginPCDHGLevel", */
      T: 1
    },
    /*::[*/
    438: {
      /* n:"BrtEndPCDHGLevel", */
      T: -1
    },
    /*::[*/
    439: {
      /* n:"BrtBeginPCDHGLGroups", */
      T: 1
    },
    /*::[*/
    440: {
      /* n:"BrtEndPCDHGLGroups", */
      T: -1
    },
    /*::[*/
    441: {
      /* n:"BrtBeginPCDHGLGroup", */
      T: 1
    },
    /*::[*/
    442: {
      /* n:"BrtEndPCDHGLGroup", */
      T: -1
    },
    /*::[*/
    443: {
      /* n:"BrtBeginPCDHGLGMembers", */
      T: 1
    },
    /*::[*/
    444: {
      /* n:"BrtEndPCDHGLGMembers", */
      T: -1
    },
    /*::[*/
    445: {
      /* n:"BrtBeginPCDHGLGMember", */
      T: 1
    },
    /*::[*/
    446: {
      /* n:"BrtEndPCDHGLGMember", */
      T: -1
    },
    /*::[*/
    447: {
      /* n:"BrtBeginQSI", */
      T: 1
    },
    /*::[*/
    448: {
      /* n:"BrtEndQSI", */
      T: -1
    },
    /*::[*/
    449: {
      /* n:"BrtBeginQSIR", */
      T: 1
    },
    /*::[*/
    450: {
      /* n:"BrtEndQSIR", */
      T: -1
    },
    /*::[*/
    451: {
      /* n:"BrtBeginDeletedNames", */
      T: 1
    },
    /*::[*/
    452: {
      /* n:"BrtEndDeletedNames", */
      T: -1
    },
    /*::[*/
    453: {
      /* n:"BrtBeginDeletedName", */
      T: 1
    },
    /*::[*/
    454: {
      /* n:"BrtEndDeletedName", */
      T: -1
    },
    /*::[*/
    455: {
      /* n:"BrtBeginQSIFs", */
      T: 1
    },
    /*::[*/
    456: {
      /* n:"BrtEndQSIFs", */
      T: -1
    },
    /*::[*/
    457: {
      /* n:"BrtBeginQSIF", */
      T: 1
    },
    /*::[*/
    458: {
      /* n:"BrtEndQSIF", */
      T: -1
    },
    /*::[*/
    459: {
      /* n:"BrtBeginAutoSortScope", */
      T: 1
    },
    /*::[*/
    460: {
      /* n:"BrtEndAutoSortScope", */
      T: -1
    },
    /*::[*/
    461: {
      /* n:"BrtBeginConditionalFormatting", */
      T: 1
    },
    /*::[*/
    462: {
      /* n:"BrtEndConditionalFormatting", */
      T: -1
    },
    /*::[*/
    463: {
      /* n:"BrtBeginCFRule", */
      T: 1
    },
    /*::[*/
    464: {
      /* n:"BrtEndCFRule", */
      T: -1
    },
    /*::[*/
    465: {
      /* n:"BrtBeginIconSet", */
      T: 1
    },
    /*::[*/
    466: {
      /* n:"BrtEndIconSet", */
      T: -1
    },
    /*::[*/
    467: {
      /* n:"BrtBeginDatabar", */
      T: 1
    },
    /*::[*/
    468: {
      /* n:"BrtEndDatabar", */
      T: -1
    },
    /*::[*/
    469: {
      /* n:"BrtBeginColorScale", */
      T: 1
    },
    /*::[*/
    470: {
      /* n:"BrtEndColorScale", */
      T: -1
    },
    /*::[*/
    471: {
      /* n:"BrtCFVO" */
    },
    /*::[*/
    472: {
      /* n:"BrtExternValueMeta" */
    },
    /*::[*/
    473: {
      /* n:"BrtBeginColorPalette", */
      T: 1
    },
    /*::[*/
    474: {
      /* n:"BrtEndColorPalette", */
      T: -1
    },
    /*::[*/
    475: {
      /* n:"BrtIndexedColor" */
    },
    /*::[*/
    476: {
      /* n:"BrtMargins", */
      f: parse_BrtMargins
    },
    /*::[*/
    477: {
      /* n:"BrtPrintOptions" */
    },
    /*::[*/
    478: {
      /* n:"BrtPageSetup" */
    },
    /*::[*/
    479: {
      /* n:"BrtBeginHeaderFooter", */
      T: 1
    },
    /*::[*/
    480: {
      /* n:"BrtEndHeaderFooter", */
      T: -1
    },
    /*::[*/
    481: {
      /* n:"BrtBeginSXCrtFormat", */
      T: 1
    },
    /*::[*/
    482: {
      /* n:"BrtEndSXCrtFormat", */
      T: -1
    },
    /*::[*/
    483: {
      /* n:"BrtBeginSXCrtFormats", */
      T: 1
    },
    /*::[*/
    484: {
      /* n:"BrtEndSXCrtFormats", */
      T: -1
    },
    /*::[*/
    485: {
      /* n:"BrtWsFmtInfo", */
      f: parse_BrtWsFmtInfo
    },
    /*::[*/
    486: {
      /* n:"BrtBeginMgs", */
      T: 1
    },
    /*::[*/
    487: {
      /* n:"BrtEndMGs", */
      T: -1
    },
    /*::[*/
    488: {
      /* n:"BrtBeginMGMaps", */
      T: 1
    },
    /*::[*/
    489: {
      /* n:"BrtEndMGMaps", */
      T: -1
    },
    /*::[*/
    490: {
      /* n:"BrtBeginMG", */
      T: 1
    },
    /*::[*/
    491: {
      /* n:"BrtEndMG", */
      T: -1
    },
    /*::[*/
    492: {
      /* n:"BrtBeginMap", */
      T: 1
    },
    /*::[*/
    493: {
      /* n:"BrtEndMap", */
      T: -1
    },
    /*::[*/
    494: {
      /* n:"BrtHLink", */
      f: parse_BrtHLink
    },
    /*::[*/
    495: {
      /* n:"BrtBeginDCon", */
      T: 1
    },
    /*::[*/
    496: {
      /* n:"BrtEndDCon", */
      T: -1
    },
    /*::[*/
    497: {
      /* n:"BrtBeginDRefs", */
      T: 1
    },
    /*::[*/
    498: {
      /* n:"BrtEndDRefs", */
      T: -1
    },
    /*::[*/
    499: {
      /* n:"BrtDRef" */
    },
    /*::[*/
    500: {
      /* n:"BrtBeginScenMan", */
      T: 1
    },
    /*::[*/
    501: {
      /* n:"BrtEndScenMan", */
      T: -1
    },
    /*::[*/
    502: {
      /* n:"BrtBeginSct", */
      T: 1
    },
    /*::[*/
    503: {
      /* n:"BrtEndSct", */
      T: -1
    },
    /*::[*/
    504: {
      /* n:"BrtSlc" */
    },
    /*::[*/
    505: {
      /* n:"BrtBeginDXFs", */
      T: 1
    },
    /*::[*/
    506: {
      /* n:"BrtEndDXFs", */
      T: -1
    },
    /*::[*/
    507: {
      /* n:"BrtDXF" */
    },
    /*::[*/
    508: {
      /* n:"BrtBeginTableStyles", */
      T: 1
    },
    /*::[*/
    509: {
      /* n:"BrtEndTableStyles", */
      T: -1
    },
    /*::[*/
    510: {
      /* n:"BrtBeginTableStyle", */
      T: 1
    },
    /*::[*/
    511: {
      /* n:"BrtEndTableStyle", */
      T: -1
    },
    /*::[*/
    512: {
      /* n:"BrtTableStyleElement" */
    },
    /*::[*/
    513: {
      /* n:"BrtTableStyleClient" */
    },
    /*::[*/
    514: {
      /* n:"BrtBeginVolDeps", */
      T: 1
    },
    /*::[*/
    515: {
      /* n:"BrtEndVolDeps", */
      T: -1
    },
    /*::[*/
    516: {
      /* n:"BrtBeginVolType", */
      T: 1
    },
    /*::[*/
    517: {
      /* n:"BrtEndVolType", */
      T: -1
    },
    /*::[*/
    518: {
      /* n:"BrtBeginVolMain", */
      T: 1
    },
    /*::[*/
    519: {
      /* n:"BrtEndVolMain", */
      T: -1
    },
    /*::[*/
    520: {
      /* n:"BrtBeginVolTopic", */
      T: 1
    },
    /*::[*/
    521: {
      /* n:"BrtEndVolTopic", */
      T: -1
    },
    /*::[*/
    522: {
      /* n:"BrtVolSubtopic" */
    },
    /*::[*/
    523: {
      /* n:"BrtVolRef" */
    },
    /*::[*/
    524: {
      /* n:"BrtVolNum" */
    },
    /*::[*/
    525: {
      /* n:"BrtVolErr" */
    },
    /*::[*/
    526: {
      /* n:"BrtVolStr" */
    },
    /*::[*/
    527: {
      /* n:"BrtVolBool" */
    },
    /*::[*/
    528: {
      /* n:"BrtBeginCalcChain$", */
      T: 1
    },
    /*::[*/
    529: {
      /* n:"BrtEndCalcChain$", */
      T: -1
    },
    /*::[*/
    530: {
      /* n:"BrtBeginSortState", */
      T: 1
    },
    /*::[*/
    531: {
      /* n:"BrtEndSortState", */
      T: -1
    },
    /*::[*/
    532: {
      /* n:"BrtBeginSortCond", */
      T: 1
    },
    /*::[*/
    533: {
      /* n:"BrtEndSortCond", */
      T: -1
    },
    /*::[*/
    534: {
      /* n:"BrtBookProtection" */
    },
    /*::[*/
    535: {
      /* n:"BrtSheetProtection" */
    },
    /*::[*/
    536: {
      /* n:"BrtRangeProtection" */
    },
    /*::[*/
    537: {
      /* n:"BrtPhoneticInfo" */
    },
    /*::[*/
    538: {
      /* n:"BrtBeginECTxtWiz", */
      T: 1
    },
    /*::[*/
    539: {
      /* n:"BrtEndECTxtWiz", */
      T: -1
    },
    /*::[*/
    540: {
      /* n:"BrtBeginECTWFldInfoLst", */
      T: 1
    },
    /*::[*/
    541: {
      /* n:"BrtEndECTWFldInfoLst", */
      T: -1
    },
    /*::[*/
    542: {
      /* n:"BrtBeginECTwFldInfo", */
      T: 1
    },
    /*::[*/
    548: {
      /* n:"BrtFileSharing" */
    },
    /*::[*/
    549: {
      /* n:"BrtOleSize" */
    },
    /*::[*/
    550: {
      /* n:"BrtDrawing", */
      f: parse_RelID
    },
    /*::[*/
    551: {
      /* n:"BrtLegacyDrawing" */
    },
    /*::[*/
    552: {
      /* n:"BrtLegacyDrawingHF" */
    },
    /*::[*/
    553: {
      /* n:"BrtWebOpt" */
    },
    /*::[*/
    554: {
      /* n:"BrtBeginWebPubItems", */
      T: 1
    },
    /*::[*/
    555: {
      /* n:"BrtEndWebPubItems", */
      T: -1
    },
    /*::[*/
    556: {
      /* n:"BrtBeginWebPubItem", */
      T: 1
    },
    /*::[*/
    557: {
      /* n:"BrtEndWebPubItem", */
      T: -1
    },
    /*::[*/
    558: {
      /* n:"BrtBeginSXCondFmt", */
      T: 1
    },
    /*::[*/
    559: {
      /* n:"BrtEndSXCondFmt", */
      T: -1
    },
    /*::[*/
    560: {
      /* n:"BrtBeginSXCondFmts", */
      T: 1
    },
    /*::[*/
    561: {
      /* n:"BrtEndSXCondFmts", */
      T: -1
    },
    /*::[*/
    562: {
      /* n:"BrtBkHim" */
    },
    /*::[*/
    564: {
      /* n:"BrtColor" */
    },
    /*::[*/
    565: {
      /* n:"BrtBeginIndexedColors", */
      T: 1
    },
    /*::[*/
    566: {
      /* n:"BrtEndIndexedColors", */
      T: -1
    },
    /*::[*/
    569: {
      /* n:"BrtBeginMRUColors", */
      T: 1
    },
    /*::[*/
    570: {
      /* n:"BrtEndMRUColors", */
      T: -1
    },
    /*::[*/
    572: {
      /* n:"BrtMRUColor" */
    },
    /*::[*/
    573: {
      /* n:"BrtBeginDVals", */
      T: 1
    },
    /*::[*/
    574: {
      /* n:"BrtEndDVals", */
      T: -1
    },
    /*::[*/
    577: {
      /* n:"BrtSupNameStart" */
    },
    /*::[*/
    578: {
      /* n:"BrtSupNameValueStart" */
    },
    /*::[*/
    579: {
      /* n:"BrtSupNameValueEnd" */
    },
    /*::[*/
    580: {
      /* n:"BrtSupNameNum" */
    },
    /*::[*/
    581: {
      /* n:"BrtSupNameErr" */
    },
    /*::[*/
    582: {
      /* n:"BrtSupNameSt" */
    },
    /*::[*/
    583: {
      /* n:"BrtSupNameNil" */
    },
    /*::[*/
    584: {
      /* n:"BrtSupNameBool" */
    },
    /*::[*/
    585: {
      /* n:"BrtSupNameFmla" */
    },
    /*::[*/
    586: {
      /* n:"BrtSupNameBits" */
    },
    /*::[*/
    587: {
      /* n:"BrtSupNameEnd" */
    },
    /*::[*/
    588: {
      /* n:"BrtEndSupBook", */
      T: -1
    },
    /*::[*/
    589: {
      /* n:"BrtCellSmartTagProperty" */
    },
    /*::[*/
    590: {
      /* n:"BrtBeginCellSmartTag", */
      T: 1
    },
    /*::[*/
    591: {
      /* n:"BrtEndCellSmartTag", */
      T: -1
    },
    /*::[*/
    592: {
      /* n:"BrtBeginCellSmartTags", */
      T: 1
    },
    /*::[*/
    593: {
      /* n:"BrtEndCellSmartTags", */
      T: -1
    },
    /*::[*/
    594: {
      /* n:"BrtBeginSmartTags", */
      T: 1
    },
    /*::[*/
    595: {
      /* n:"BrtEndSmartTags", */
      T: -1
    },
    /*::[*/
    596: {
      /* n:"BrtSmartTagType" */
    },
    /*::[*/
    597: {
      /* n:"BrtBeginSmartTagTypes", */
      T: 1
    },
    /*::[*/
    598: {
      /* n:"BrtEndSmartTagTypes", */
      T: -1
    },
    /*::[*/
    599: {
      /* n:"BrtBeginSXFilters", */
      T: 1
    },
    /*::[*/
    600: {
      /* n:"BrtEndSXFilters", */
      T: -1
    },
    /*::[*/
    601: {
      /* n:"BrtBeginSXFILTER", */
      T: 1
    },
    /*::[*/
    602: {
      /* n:"BrtEndSXFilter", */
      T: -1
    },
    /*::[*/
    603: {
      /* n:"BrtBeginFills", */
      T: 1
    },
    /*::[*/
    604: {
      /* n:"BrtEndFills", */
      T: -1
    },
    /*::[*/
    605: {
      /* n:"BrtBeginCellWatches", */
      T: 1
    },
    /*::[*/
    606: {
      /* n:"BrtEndCellWatches", */
      T: -1
    },
    /*::[*/
    607: {
      /* n:"BrtCellWatch" */
    },
    /*::[*/
    608: {
      /* n:"BrtBeginCRErrs", */
      T: 1
    },
    /*::[*/
    609: {
      /* n:"BrtEndCRErrs", */
      T: -1
    },
    /*::[*/
    610: {
      /* n:"BrtCrashRecErr" */
    },
    /*::[*/
    611: {
      /* n:"BrtBeginFonts", */
      T: 1
    },
    /*::[*/
    612: {
      /* n:"BrtEndFonts", */
      T: -1
    },
    /*::[*/
    613: {
      /* n:"BrtBeginBorders", */
      T: 1
    },
    /*::[*/
    614: {
      /* n:"BrtEndBorders", */
      T: -1
    },
    /*::[*/
    615: {
      /* n:"BrtBeginFmts", */
      T: 1
    },
    /*::[*/
    616: {
      /* n:"BrtEndFmts", */
      T: -1
    },
    /*::[*/
    617: {
      /* n:"BrtBeginCellXFs", */
      T: 1
    },
    /*::[*/
    618: {
      /* n:"BrtEndCellXFs", */
      T: -1
    },
    /*::[*/
    619: {
      /* n:"BrtBeginStyles", */
      T: 1
    },
    /*::[*/
    620: {
      /* n:"BrtEndStyles", */
      T: -1
    },
    /*::[*/
    625: {
      /* n:"BrtBigName" */
    },
    /*::[*/
    626: {
      /* n:"BrtBeginCellStyleXFs", */
      T: 1
    },
    /*::[*/
    627: {
      /* n:"BrtEndCellStyleXFs", */
      T: -1
    },
    /*::[*/
    628: {
      /* n:"BrtBeginComments", */
      T: 1
    },
    /*::[*/
    629: {
      /* n:"BrtEndComments", */
      T: -1
    },
    /*::[*/
    630: {
      /* n:"BrtBeginCommentAuthors", */
      T: 1
    },
    /*::[*/
    631: {
      /* n:"BrtEndCommentAuthors", */
      T: -1
    },
    /*::[*/
    632: {
      /* n:"BrtCommentAuthor", */
      f: parse_BrtCommentAuthor
    },
    /*::[*/
    633: {
      /* n:"BrtBeginCommentList", */
      T: 1
    },
    /*::[*/
    634: {
      /* n:"BrtEndCommentList", */
      T: -1
    },
    /*::[*/
    635: {
      /* n:"BrtBeginComment", */
      T: 1,
      f: parse_BrtBeginComment
    },
    /*::[*/
    636: {
      /* n:"BrtEndComment", */
      T: -1
    },
    /*::[*/
    637: {
      /* n:"BrtCommentText", */
      f: parse_BrtCommentText
    },
    /*::[*/
    638: {
      /* n:"BrtBeginOleObjects", */
      T: 1
    },
    /*::[*/
    639: {
      /* n:"BrtOleObject" */
    },
    /*::[*/
    640: {
      /* n:"BrtEndOleObjects", */
      T: -1
    },
    /*::[*/
    641: {
      /* n:"BrtBeginSxrules", */
      T: 1
    },
    /*::[*/
    642: {
      /* n:"BrtEndSxRules", */
      T: -1
    },
    /*::[*/
    643: {
      /* n:"BrtBeginActiveXControls", */
      T: 1
    },
    /*::[*/
    644: {
      /* n:"BrtActiveX" */
    },
    /*::[*/
    645: {
      /* n:"BrtEndActiveXControls", */
      T: -1
    },
    /*::[*/
    646: {
      /* n:"BrtBeginPCDSDTCEMembersSortBy", */
      T: 1
    },
    /*::[*/
    648: {
      /* n:"BrtBeginCellIgnoreECs", */
      T: 1
    },
    /*::[*/
    649: {
      /* n:"BrtCellIgnoreEC" */
    },
    /*::[*/
    650: {
      /* n:"BrtEndCellIgnoreECs", */
      T: -1
    },
    /*::[*/
    651: {
      /* n:"BrtCsProp", */
      f: parse_BrtCsProp
    },
    /*::[*/
    652: {
      /* n:"BrtCsPageSetup" */
    },
    /*::[*/
    653: {
      /* n:"BrtBeginUserCsViews", */
      T: 1
    },
    /*::[*/
    654: {
      /* n:"BrtEndUserCsViews", */
      T: -1
    },
    /*::[*/
    655: {
      /* n:"BrtBeginUserCsView", */
      T: 1
    },
    /*::[*/
    656: {
      /* n:"BrtEndUserCsView", */
      T: -1
    },
    /*::[*/
    657: {
      /* n:"BrtBeginPcdSFCIEntries", */
      T: 1
    },
    /*::[*/
    658: {
      /* n:"BrtEndPCDSFCIEntries", */
      T: -1
    },
    /*::[*/
    659: {
      /* n:"BrtPCDSFCIEntry" */
    },
    /*::[*/
    660: {
      /* n:"BrtBeginListParts", */
      T: 1
    },
    /*::[*/
    661: {
      /* n:"BrtListPart" */
    },
    /*::[*/
    662: {
      /* n:"BrtEndListParts", */
      T: -1
    },
    /*::[*/
    663: {
      /* n:"BrtSheetCalcProp" */
    },
    /*::[*/
    664: {
      /* n:"BrtBeginFnGroup", */
      T: 1
    },
    /*::[*/
    665: {
      /* n:"BrtFnGroup" */
    },
    /*::[*/
    666: {
      /* n:"BrtEndFnGroup", */
      T: -1
    },
    /*::[*/
    667: {
      /* n:"BrtSupAddin" */
    },
    /*::[*/
    668: {
      /* n:"BrtSXTDMPOrder" */
    },
    /*::[*/
    669: {
      /* n:"BrtCsProtection" */
    },
    /*::[*/
    671: {
      /* n:"BrtBeginWsSortMap", */
      T: 1
    },
    /*::[*/
    672: {
      /* n:"BrtEndWsSortMap", */
      T: -1
    },
    /*::[*/
    673: {
      /* n:"BrtBeginRRSort", */
      T: 1
    },
    /*::[*/
    674: {
      /* n:"BrtEndRRSort", */
      T: -1
    },
    /*::[*/
    675: {
      /* n:"BrtRRSortItem" */
    },
    /*::[*/
    676: {
      /* n:"BrtFileSharingIso" */
    },
    /*::[*/
    677: {
      /* n:"BrtBookProtectionIso" */
    },
    /*::[*/
    678: {
      /* n:"BrtSheetProtectionIso" */
    },
    /*::[*/
    679: {
      /* n:"BrtCsProtectionIso" */
    },
    /*::[*/
    680: {
      /* n:"BrtRangeProtectionIso" */
    },
    /*::[*/
    681: {
      /* n:"BrtDValList" */
    },
    /*::[*/
    1024: {
      /* n:"BrtRwDescent" */
    },
    /*::[*/
    1025: {
      /* n:"BrtKnownFonts" */
    },
    /*::[*/
    1026: {
      /* n:"BrtBeginSXTupleSet", */
      T: 1
    },
    /*::[*/
    1027: {
      /* n:"BrtEndSXTupleSet", */
      T: -1
    },
    /*::[*/
    1028: {
      /* n:"BrtBeginSXTupleSetHeader", */
      T: 1
    },
    /*::[*/
    1029: {
      /* n:"BrtEndSXTupleSetHeader", */
      T: -1
    },
    /*::[*/
    1030: {
      /* n:"BrtSXTupleSetHeaderItem" */
    },
    /*::[*/
    1031: {
      /* n:"BrtBeginSXTupleSetData", */
      T: 1
    },
    /*::[*/
    1032: {
      /* n:"BrtEndSXTupleSetData", */
      T: -1
    },
    /*::[*/
    1033: {
      /* n:"BrtBeginSXTupleSetRow", */
      T: 1
    },
    /*::[*/
    1034: {
      /* n:"BrtEndSXTupleSetRow", */
      T: -1
    },
    /*::[*/
    1035: {
      /* n:"BrtSXTupleSetRowItem" */
    },
    /*::[*/
    1036: {
      /* n:"BrtNameExt" */
    },
    /*::[*/
    1037: {
      /* n:"BrtPCDH14" */
    },
    /*::[*/
    1038: {
      /* n:"BrtBeginPCDCalcMem14", */
      T: 1
    },
    /*::[*/
    1039: {
      /* n:"BrtEndPCDCalcMem14", */
      T: -1
    },
    /*::[*/
    1040: {
      /* n:"BrtSXTH14" */
    },
    /*::[*/
    1041: {
      /* n:"BrtBeginSparklineGroup", */
      T: 1
    },
    /*::[*/
    1042: {
      /* n:"BrtEndSparklineGroup", */
      T: -1
    },
    /*::[*/
    1043: {
      /* n:"BrtSparkline" */
    },
    /*::[*/
    1044: {
      /* n:"BrtSXDI14" */
    },
    /*::[*/
    1045: {
      /* n:"BrtWsFmtInfoEx14" */
    },
    /*::[*/
    1046: {
      /* n:"BrtBeginConditionalFormatting14", */
      T: 1
    },
    /*::[*/
    1047: {
      /* n:"BrtEndConditionalFormatting14", */
      T: -1
    },
    /*::[*/
    1048: {
      /* n:"BrtBeginCFRule14", */
      T: 1
    },
    /*::[*/
    1049: {
      /* n:"BrtEndCFRule14", */
      T: -1
    },
    /*::[*/
    1050: {
      /* n:"BrtCFVO14" */
    },
    /*::[*/
    1051: {
      /* n:"BrtBeginDatabar14", */
      T: 1
    },
    /*::[*/
    1052: {
      /* n:"BrtBeginIconSet14", */
      T: 1
    },
    /*::[*/
    1053: {
      /* n:"BrtDVal14", */
      f: parse_BrtDVal14
    },
    /*::[*/
    1054: {
      /* n:"BrtBeginDVals14", */
      T: 1
    },
    /*::[*/
    1055: {
      /* n:"BrtColor14" */
    },
    /*::[*/
    1056: {
      /* n:"BrtBeginSparklines", */
      T: 1
    },
    /*::[*/
    1057: {
      /* n:"BrtEndSparklines", */
      T: -1
    },
    /*::[*/
    1058: {
      /* n:"BrtBeginSparklineGroups", */
      T: 1
    },
    /*::[*/
    1059: {
      /* n:"BrtEndSparklineGroups", */
      T: -1
    },
    /*::[*/
    1061: {
      /* n:"BrtSXVD14" */
    },
    /*::[*/
    1062: {
      /* n:"BrtBeginSXView14", */
      T: 1
    },
    /*::[*/
    1063: {
      /* n:"BrtEndSXView14", */
      T: -1
    },
    /*::[*/
    1064: {
      /* n:"BrtBeginSXView16", */
      T: 1
    },
    /*::[*/
    1065: {
      /* n:"BrtEndSXView16", */
      T: -1
    },
    /*::[*/
    1066: {
      /* n:"BrtBeginPCD14", */
      T: 1
    },
    /*::[*/
    1067: {
      /* n:"BrtEndPCD14", */
      T: -1
    },
    /*::[*/
    1068: {
      /* n:"BrtBeginExtConn14", */
      T: 1
    },
    /*::[*/
    1069: {
      /* n:"BrtEndExtConn14", */
      T: -1
    },
    /*::[*/
    1070: {
      /* n:"BrtBeginSlicerCacheIDs", */
      T: 1
    },
    /*::[*/
    1071: {
      /* n:"BrtEndSlicerCacheIDs", */
      T: -1
    },
    /*::[*/
    1072: {
      /* n:"BrtBeginSlicerCacheID", */
      T: 1
    },
    /*::[*/
    1073: {
      /* n:"BrtEndSlicerCacheID", */
      T: -1
    },
    /*::[*/
    1075: {
      /* n:"BrtBeginSlicerCache", */
      T: 1
    },
    /*::[*/
    1076: {
      /* n:"BrtEndSlicerCache", */
      T: -1
    },
    /*::[*/
    1077: {
      /* n:"BrtBeginSlicerCacheDef", */
      T: 1
    },
    /*::[*/
    1078: {
      /* n:"BrtEndSlicerCacheDef", */
      T: -1
    },
    /*::[*/
    1079: {
      /* n:"BrtBeginSlicersEx", */
      T: 1
    },
    /*::[*/
    1080: {
      /* n:"BrtEndSlicersEx", */
      T: -1
    },
    /*::[*/
    1081: {
      /* n:"BrtBeginSlicerEx", */
      T: 1
    },
    /*::[*/
    1082: {
      /* n:"BrtEndSlicerEx", */
      T: -1
    },
    /*::[*/
    1083: {
      /* n:"BrtBeginSlicer", */
      T: 1
    },
    /*::[*/
    1084: {
      /* n:"BrtEndSlicer", */
      T: -1
    },
    /*::[*/
    1085: {
      /* n:"BrtSlicerCachePivotTables" */
    },
    /*::[*/
    1086: {
      /* n:"BrtBeginSlicerCacheOlapImpl", */
      T: 1
    },
    /*::[*/
    1087: {
      /* n:"BrtEndSlicerCacheOlapImpl", */
      T: -1
    },
    /*::[*/
    1088: {
      /* n:"BrtBeginSlicerCacheLevelsData", */
      T: 1
    },
    /*::[*/
    1089: {
      /* n:"BrtEndSlicerCacheLevelsData", */
      T: -1
    },
    /*::[*/
    1090: {
      /* n:"BrtBeginSlicerCacheLevelData", */
      T: 1
    },
    /*::[*/
    1091: {
      /* n:"BrtEndSlicerCacheLevelData", */
      T: -1
    },
    /*::[*/
    1092: {
      /* n:"BrtBeginSlicerCacheSiRanges", */
      T: 1
    },
    /*::[*/
    1093: {
      /* n:"BrtEndSlicerCacheSiRanges", */
      T: -1
    },
    /*::[*/
    1094: {
      /* n:"BrtBeginSlicerCacheSiRange", */
      T: 1
    },
    /*::[*/
    1095: {
      /* n:"BrtEndSlicerCacheSiRange", */
      T: -1
    },
    /*::[*/
    1096: {
      /* n:"BrtSlicerCacheOlapItem" */
    },
    /*::[*/
    1097: {
      /* n:"BrtBeginSlicerCacheSelections", */
      T: 1
    },
    /*::[*/
    1098: {
      /* n:"BrtSlicerCacheSelection" */
    },
    /*::[*/
    1099: {
      /* n:"BrtEndSlicerCacheSelections", */
      T: -1
    },
    /*::[*/
    1100: {
      /* n:"BrtBeginSlicerCacheNative", */
      T: 1
    },
    /*::[*/
    1101: {
      /* n:"BrtEndSlicerCacheNative", */
      T: -1
    },
    /*::[*/
    1102: {
      /* n:"BrtSlicerCacheNativeItem" */
    },
    /*::[*/
    1103: {
      /* n:"BrtRangeProtection14" */
    },
    /*::[*/
    1104: {
      /* n:"BrtRangeProtectionIso14" */
    },
    /*::[*/
    1105: {
      /* n:"BrtCellIgnoreEC14" */
    },
    /*::[*/
    1111: {
      /* n:"BrtList14" */
    },
    /*::[*/
    1112: {
      /* n:"BrtCFIcon" */
    },
    /*::[*/
    1113: {
      /* n:"BrtBeginSlicerCachesPivotCacheIDs", */
      T: 1
    },
    /*::[*/
    1114: {
      /* n:"BrtEndSlicerCachesPivotCacheIDs", */
      T: -1
    },
    /*::[*/
    1115: {
      /* n:"BrtBeginSlicers", */
      T: 1
    },
    /*::[*/
    1116: {
      /* n:"BrtEndSlicers", */
      T: -1
    },
    /*::[*/
    1117: {
      /* n:"BrtWbProp14" */
    },
    /*::[*/
    1118: {
      /* n:"BrtBeginSXEdit", */
      T: 1
    },
    /*::[*/
    1119: {
      /* n:"BrtEndSXEdit", */
      T: -1
    },
    /*::[*/
    1120: {
      /* n:"BrtBeginSXEdits", */
      T: 1
    },
    /*::[*/
    1121: {
      /* n:"BrtEndSXEdits", */
      T: -1
    },
    /*::[*/
    1122: {
      /* n:"BrtBeginSXChange", */
      T: 1
    },
    /*::[*/
    1123: {
      /* n:"BrtEndSXChange", */
      T: -1
    },
    /*::[*/
    1124: {
      /* n:"BrtBeginSXChanges", */
      T: 1
    },
    /*::[*/
    1125: {
      /* n:"BrtEndSXChanges", */
      T: -1
    },
    /*::[*/
    1126: {
      /* n:"BrtSXTupleItems" */
    },
    /*::[*/
    1128: {
      /* n:"BrtBeginSlicerStyle", */
      T: 1
    },
    /*::[*/
    1129: {
      /* n:"BrtEndSlicerStyle", */
      T: -1
    },
    /*::[*/
    1130: {
      /* n:"BrtSlicerStyleElement" */
    },
    /*::[*/
    1131: {
      /* n:"BrtBeginStyleSheetExt14", */
      T: 1
    },
    /*::[*/
    1132: {
      /* n:"BrtEndStyleSheetExt14", */
      T: -1
    },
    /*::[*/
    1133: {
      /* n:"BrtBeginSlicerCachesPivotCacheID", */
      T: 1
    },
    /*::[*/
    1134: {
      /* n:"BrtEndSlicerCachesPivotCacheID", */
      T: -1
    },
    /*::[*/
    1135: {
      /* n:"BrtBeginConditionalFormattings", */
      T: 1
    },
    /*::[*/
    1136: {
      /* n:"BrtEndConditionalFormattings", */
      T: -1
    },
    /*::[*/
    1137: {
      /* n:"BrtBeginPCDCalcMemExt", */
      T: 1
    },
    /*::[*/
    1138: {
      /* n:"BrtEndPCDCalcMemExt", */
      T: -1
    },
    /*::[*/
    1139: {
      /* n:"BrtBeginPCDCalcMemsExt", */
      T: 1
    },
    /*::[*/
    1140: {
      /* n:"BrtEndPCDCalcMemsExt", */
      T: -1
    },
    /*::[*/
    1141: {
      /* n:"BrtPCDField14" */
    },
    /*::[*/
    1142: {
      /* n:"BrtBeginSlicerStyles", */
      T: 1
    },
    /*::[*/
    1143: {
      /* n:"BrtEndSlicerStyles", */
      T: -1
    },
    /*::[*/
    1144: {
      /* n:"BrtBeginSlicerStyleElements", */
      T: 1
    },
    /*::[*/
    1145: {
      /* n:"BrtEndSlicerStyleElements", */
      T: -1
    },
    /*::[*/
    1146: {
      /* n:"BrtCFRuleExt" */
    },
    /*::[*/
    1147: {
      /* n:"BrtBeginSXCondFmt14", */
      T: 1
    },
    /*::[*/
    1148: {
      /* n:"BrtEndSXCondFmt14", */
      T: -1
    },
    /*::[*/
    1149: {
      /* n:"BrtBeginSXCondFmts14", */
      T: 1
    },
    /*::[*/
    1150: {
      /* n:"BrtEndSXCondFmts14", */
      T: -1
    },
    /*::[*/
    1152: {
      /* n:"BrtBeginSortCond14", */
      T: 1
    },
    /*::[*/
    1153: {
      /* n:"BrtEndSortCond14", */
      T: -1
    },
    /*::[*/
    1154: {
      /* n:"BrtEndDVals14", */
      T: -1
    },
    /*::[*/
    1155: {
      /* n:"BrtEndIconSet14", */
      T: -1
    },
    /*::[*/
    1156: {
      /* n:"BrtEndDatabar14", */
      T: -1
    },
    /*::[*/
    1157: {
      /* n:"BrtBeginColorScale14", */
      T: 1
    },
    /*::[*/
    1158: {
      /* n:"BrtEndColorScale14", */
      T: -1
    },
    /*::[*/
    1159: {
      /* n:"BrtBeginSxrules14", */
      T: 1
    },
    /*::[*/
    1160: {
      /* n:"BrtEndSxrules14", */
      T: -1
    },
    /*::[*/
    1161: {
      /* n:"BrtBeginPRule14", */
      T: 1
    },
    /*::[*/
    1162: {
      /* n:"BrtEndPRule14", */
      T: -1
    },
    /*::[*/
    1163: {
      /* n:"BrtBeginPRFilters14", */
      T: 1
    },
    /*::[*/
    1164: {
      /* n:"BrtEndPRFilters14", */
      T: -1
    },
    /*::[*/
    1165: {
      /* n:"BrtBeginPRFilter14", */
      T: 1
    },
    /*::[*/
    1166: {
      /* n:"BrtEndPRFilter14", */
      T: -1
    },
    /*::[*/
    1167: {
      /* n:"BrtBeginPRFItem14", */
      T: 1
    },
    /*::[*/
    1168: {
      /* n:"BrtEndPRFItem14", */
      T: -1
    },
    /*::[*/
    1169: {
      /* n:"BrtBeginCellIgnoreECs14", */
      T: 1
    },
    /*::[*/
    1170: {
      /* n:"BrtEndCellIgnoreECs14", */
      T: -1
    },
    /*::[*/
    1171: {
      /* n:"BrtDxf14" */
    },
    /*::[*/
    1172: {
      /* n:"BrtBeginDxF14s", */
      T: 1
    },
    /*::[*/
    1173: {
      /* n:"BrtEndDxf14s", */
      T: -1
    },
    /*::[*/
    1177: {
      /* n:"BrtFilter14" */
    },
    /*::[*/
    1178: {
      /* n:"BrtBeginCustomFilters14", */
      T: 1
    },
    /*::[*/
    1180: {
      /* n:"BrtCustomFilter14" */
    },
    /*::[*/
    1181: {
      /* n:"BrtIconFilter14" */
    },
    /*::[*/
    1182: {
      /* n:"BrtPivotCacheConnectionName" */
    },
    /*::[*/
    2048: {
      /* n:"BrtBeginDecoupledPivotCacheIDs", */
      T: 1
    },
    /*::[*/
    2049: {
      /* n:"BrtEndDecoupledPivotCacheIDs", */
      T: -1
    },
    /*::[*/
    2050: {
      /* n:"BrtDecoupledPivotCacheID" */
    },
    /*::[*/
    2051: {
      /* n:"BrtBeginPivotTableRefs", */
      T: 1
    },
    /*::[*/
    2052: {
      /* n:"BrtEndPivotTableRefs", */
      T: -1
    },
    /*::[*/
    2053: {
      /* n:"BrtPivotTableRef" */
    },
    /*::[*/
    2054: {
      /* n:"BrtSlicerCacheBookPivotTables" */
    },
    /*::[*/
    2055: {
      /* n:"BrtBeginSxvcells", */
      T: 1
    },
    /*::[*/
    2056: {
      /* n:"BrtEndSxvcells", */
      T: -1
    },
    /*::[*/
    2057: {
      /* n:"BrtBeginSxRow", */
      T: 1
    },
    /*::[*/
    2058: {
      /* n:"BrtEndSxRow", */
      T: -1
    },
    /*::[*/
    2060: {
      /* n:"BrtPcdCalcMem15" */
    },
    /*::[*/
    2067: {
      /* n:"BrtQsi15" */
    },
    /*::[*/
    2068: {
      /* n:"BrtBeginWebExtensions", */
      T: 1
    },
    /*::[*/
    2069: {
      /* n:"BrtEndWebExtensions", */
      T: -1
    },
    /*::[*/
    2070: {
      /* n:"BrtWebExtension" */
    },
    /*::[*/
    2071: {
      /* n:"BrtAbsPath15" */
    },
    /*::[*/
    2072: {
      /* n:"BrtBeginPivotTableUISettings", */
      T: 1
    },
    /*::[*/
    2073: {
      /* n:"BrtEndPivotTableUISettings", */
      T: -1
    },
    /*::[*/
    2075: {
      /* n:"BrtTableSlicerCacheIDs" */
    },
    /*::[*/
    2076: {
      /* n:"BrtTableSlicerCacheID" */
    },
    /*::[*/
    2077: {
      /* n:"BrtBeginTableSlicerCache", */
      T: 1
    },
    /*::[*/
    2078: {
      /* n:"BrtEndTableSlicerCache", */
      T: -1
    },
    /*::[*/
    2079: {
      /* n:"BrtSxFilter15" */
    },
    /*::[*/
    2080: {
      /* n:"BrtBeginTimelineCachePivotCacheIDs", */
      T: 1
    },
    /*::[*/
    2081: {
      /* n:"BrtEndTimelineCachePivotCacheIDs", */
      T: -1
    },
    /*::[*/
    2082: {
      /* n:"BrtTimelineCachePivotCacheID" */
    },
    /*::[*/
    2083: {
      /* n:"BrtBeginTimelineCacheIDs", */
      T: 1
    },
    /*::[*/
    2084: {
      /* n:"BrtEndTimelineCacheIDs", */
      T: -1
    },
    /*::[*/
    2085: {
      /* n:"BrtBeginTimelineCacheID", */
      T: 1
    },
    /*::[*/
    2086: {
      /* n:"BrtEndTimelineCacheID", */
      T: -1
    },
    /*::[*/
    2087: {
      /* n:"BrtBeginTimelinesEx", */
      T: 1
    },
    /*::[*/
    2088: {
      /* n:"BrtEndTimelinesEx", */
      T: -1
    },
    /*::[*/
    2089: {
      /* n:"BrtBeginTimelineEx", */
      T: 1
    },
    /*::[*/
    2090: {
      /* n:"BrtEndTimelineEx", */
      T: -1
    },
    /*::[*/
    2091: {
      /* n:"BrtWorkBookPr15" */
    },
    /*::[*/
    2092: {
      /* n:"BrtPCDH15" */
    },
    /*::[*/
    2093: {
      /* n:"BrtBeginTimelineStyle", */
      T: 1
    },
    /*::[*/
    2094: {
      /* n:"BrtEndTimelineStyle", */
      T: -1
    },
    /*::[*/
    2095: {
      /* n:"BrtTimelineStyleElement" */
    },
    /*::[*/
    2096: {
      /* n:"BrtBeginTimelineStylesheetExt15", */
      T: 1
    },
    /*::[*/
    2097: {
      /* n:"BrtEndTimelineStylesheetExt15", */
      T: -1
    },
    /*::[*/
    2098: {
      /* n:"BrtBeginTimelineStyles", */
      T: 1
    },
    /*::[*/
    2099: {
      /* n:"BrtEndTimelineStyles", */
      T: -1
    },
    /*::[*/
    2100: {
      /* n:"BrtBeginTimelineStyleElements", */
      T: 1
    },
    /*::[*/
    2101: {
      /* n:"BrtEndTimelineStyleElements", */
      T: -1
    },
    /*::[*/
    2102: {
      /* n:"BrtDxf15" */
    },
    /*::[*/
    2103: {
      /* n:"BrtBeginDxfs15", */
      T: 1
    },
    /*::[*/
    2104: {
      /* n:"BrtEndDxfs15", */
      T: -1
    },
    /*::[*/
    2105: {
      /* n:"BrtSlicerCacheHideItemsWithNoData" */
    },
    /*::[*/
    2106: {
      /* n:"BrtBeginItemUniqueNames", */
      T: 1
    },
    /*::[*/
    2107: {
      /* n:"BrtEndItemUniqueNames", */
      T: -1
    },
    /*::[*/
    2108: {
      /* n:"BrtItemUniqueName" */
    },
    /*::[*/
    2109: {
      /* n:"BrtBeginExtConn15", */
      T: 1
    },
    /*::[*/
    2110: {
      /* n:"BrtEndExtConn15", */
      T: -1
    },
    /*::[*/
    2111: {
      /* n:"BrtBeginOledbPr15", */
      T: 1
    },
    /*::[*/
    2112: {
      /* n:"BrtEndOledbPr15", */
      T: -1
    },
    /*::[*/
    2113: {
      /* n:"BrtBeginDataFeedPr15", */
      T: 1
    },
    /*::[*/
    2114: {
      /* n:"BrtEndDataFeedPr15", */
      T: -1
    },
    /*::[*/
    2115: {
      /* n:"BrtTextPr15" */
    },
    /*::[*/
    2116: {
      /* n:"BrtRangePr15" */
    },
    /*::[*/
    2117: {
      /* n:"BrtDbCommand15" */
    },
    /*::[*/
    2118: {
      /* n:"BrtBeginDbTables15", */
      T: 1
    },
    /*::[*/
    2119: {
      /* n:"BrtEndDbTables15", */
      T: -1
    },
    /*::[*/
    2120: {
      /* n:"BrtDbTable15" */
    },
    /*::[*/
    2121: {
      /* n:"BrtBeginDataModel", */
      T: 1
    },
    /*::[*/
    2122: {
      /* n:"BrtEndDataModel", */
      T: -1
    },
    /*::[*/
    2123: {
      /* n:"BrtBeginModelTables", */
      T: 1
    },
    /*::[*/
    2124: {
      /* n:"BrtEndModelTables", */
      T: -1
    },
    /*::[*/
    2125: {
      /* n:"BrtModelTable" */
    },
    /*::[*/
    2126: {
      /* n:"BrtBeginModelRelationships", */
      T: 1
    },
    /*::[*/
    2127: {
      /* n:"BrtEndModelRelationships", */
      T: -1
    },
    /*::[*/
    2128: {
      /* n:"BrtModelRelationship" */
    },
    /*::[*/
    2129: {
      /* n:"BrtBeginECTxtWiz15", */
      T: 1
    },
    /*::[*/
    2130: {
      /* n:"BrtEndECTxtWiz15", */
      T: -1
    },
    /*::[*/
    2131: {
      /* n:"BrtBeginECTWFldInfoLst15", */
      T: 1
    },
    /*::[*/
    2132: {
      /* n:"BrtEndECTWFldInfoLst15", */
      T: -1
    },
    /*::[*/
    2133: {
      /* n:"BrtBeginECTWFldInfo15", */
      T: 1
    },
    /*::[*/
    2134: {
      /* n:"BrtFieldListActiveItem" */
    },
    /*::[*/
    2135: {
      /* n:"BrtPivotCacheIdVersion" */
    },
    /*::[*/
    2136: {
      /* n:"BrtSXDI15" */
    },
    /*::[*/
    2137: {
      /* n:"BrtBeginModelTimeGroupings", */
      T: 1
    },
    /*::[*/
    2138: {
      /* n:"BrtEndModelTimeGroupings", */
      T: -1
    },
    /*::[*/
    2139: {
      /* n:"BrtBeginModelTimeGrouping", */
      T: 1
    },
    /*::[*/
    2140: {
      /* n:"BrtEndModelTimeGrouping", */
      T: -1
    },
    /*::[*/
    2141: {
      /* n:"BrtModelTimeGroupingCalcCol" */
    },
    /*::[*/
    3072: {
      /* n:"BrtUid" */
    },
    /*::[*/
    3073: {
      /* n:"BrtRevisionPtr" */
    },
    /*::[*/
    4096: {
      /* n:"BrtBeginDynamicArrayPr", */
      T: 1
    },
    /*::[*/
    4097: {
      /* n:"BrtEndDynamicArrayPr", */
      T: -1
    },
    /*::[*/
    5002: {
      /* n:"BrtBeginRichValueBlock", */
      T: 1
    },
    /*::[*/
    5003: {
      /* n:"BrtEndRichValueBlock", */
      T: -1
    },
    /*::[*/
    5081: {
      /* n:"BrtBeginRichFilters", */
      T: 1
    },
    /*::[*/
    5082: {
      /* n:"BrtEndRichFilters", */
      T: -1
    },
    /*::[*/
    5083: {
      /* n:"BrtRichFilter" */
    },
    /*::[*/
    5084: {
      /* n:"BrtBeginRichFilterColumn", */
      T: 1
    },
    /*::[*/
    5085: {
      /* n:"BrtEndRichFilterColumn", */
      T: -1
    },
    /*::[*/
    5086: {
      /* n:"BrtBeginCustomRichFilters", */
      T: 1
    },
    /*::[*/
    5087: {
      /* n:"BrtEndCustomRichFilters", */
      T: -1
    },
    /*::[*/
    5088: {
      /* n:"BrtCustomRichFilter" */
    },
    /*::[*/
    5089: {
      /* n:"BrtTop10RichFilter" */
    },
    /*::[*/
    5090: {
      /* n:"BrtDynamicRichFilter" */
    },
    /*::[*/
    5092: {
      /* n:"BrtBeginRichSortCondition", */
      T: 1
    },
    /*::[*/
    5093: {
      /* n:"BrtEndRichSortCondition", */
      T: -1
    },
    /*::[*/
    5094: {
      /* n:"BrtRichFilterDateGroupItem" */
    },
    /*::[*/
    5095: {
      /* n:"BrtBeginCalcFeatures", */
      T: 1
    },
    /*::[*/
    5096: {
      /* n:"BrtEndCalcFeatures", */
      T: -1
    },
    /*::[*/
    5097: {
      /* n:"BrtCalcFeature" */
    },
    /*::[*/
    5099: {
      /* n:"BrtExternalLinksPr" */
    },
    /*::[*/
    65535: { n: "" }
  };
  var XLSRecordEnum = {
    /* [MS-XLS] 2.3 Record Enumeration 2021-08-17 */
    /*::[*/
    6: {
      /* n:"Formula", */
      f: parse_Formula
    },
    /*::[*/
    10: {
      /* n:"EOF", */
      f: parsenoop2
    },
    /*::[*/
    12: {
      /* n:"CalcCount", */
      f: parseuint16
    },
    //
    /*::[*/
    13: {
      /* n:"CalcMode", */
      f: parseuint16
    },
    //
    /*::[*/
    14: {
      /* n:"CalcPrecision", */
      f: parsebool
    },
    //
    /*::[*/
    15: {
      /* n:"CalcRefMode", */
      f: parsebool
    },
    //
    /*::[*/
    16: {
      /* n:"CalcDelta", */
      f: parse_Xnum
    },
    //
    /*::[*/
    17: {
      /* n:"CalcIter", */
      f: parsebool
    },
    //
    /*::[*/
    18: {
      /* n:"Protect", */
      f: parsebool
    },
    /*::[*/
    19: {
      /* n:"Password", */
      f: parseuint16
    },
    /*::[*/
    20: {
      /* n:"Header", */
      f: parse_XLHeaderFooter
    },
    /*::[*/
    21: {
      /* n:"Footer", */
      f: parse_XLHeaderFooter
    },
    /*::[*/
    23: {
      /* n:"ExternSheet", */
      f: parse_ExternSheet
    },
    /*::[*/
    24: {
      /* n:"Lbl", */
      f: parse_Lbl
    },
    /*::[*/
    25: {
      /* n:"WinProtect", */
      f: parsebool
    },
    /*::[*/
    26: {
      /* n:"VerticalPageBreaks", */
    },
    /*::[*/
    27: {
      /* n:"HorizontalPageBreaks", */
    },
    /*::[*/
    28: {
      /* n:"Note", */
      f: parse_Note
    },
    /*::[*/
    29: {
      /* n:"Selection", */
    },
    /*::[*/
    34: {
      /* n:"Date1904", */
      f: parsebool
    },
    /*::[*/
    35: {
      /* n:"ExternName", */
      f: parse_ExternName
    },
    /*::[*/
    38: {
      /* n:"LeftMargin", */
      f: parse_Xnum
    },
    // *
    /*::[*/
    39: {
      /* n:"RightMargin", */
      f: parse_Xnum
    },
    // *
    /*::[*/
    40: {
      /* n:"TopMargin", */
      f: parse_Xnum
    },
    // *
    /*::[*/
    41: {
      /* n:"BottomMargin", */
      f: parse_Xnum
    },
    // *
    /*::[*/
    42: {
      /* n:"PrintRowCol", */
      f: parsebool
    },
    /*::[*/
    43: {
      /* n:"PrintGrid", */
      f: parsebool
    },
    /*::[*/
    47: {
      /* n:"FilePass", */
      f: parse_FilePass
    },
    /*::[*/
    49: {
      /* n:"Font", */
      f: parse_Font
    },
    /*::[*/
    51: {
      /* n:"PrintSize", */
      f: parseuint16
    },
    /*::[*/
    60: {
      /* n:"Continue", */
    },
    /*::[*/
    61: {
      /* n:"Window1", */
      f: parse_Window1
    },
    /*::[*/
    64: {
      /* n:"Backup", */
      f: parsebool
    },
    /*::[*/
    65: {
      /* n:"Pane", */
      f: parse_Pane
    },
    /*::[*/
    66: {
      /* n:"CodePage", */
      f: parseuint16
    },
    /*::[*/
    77: {
      /* n:"Pls", */
    },
    /*::[*/
    80: {
      /* n:"DCon", */
    },
    /*::[*/
    81: {
      /* n:"DConRef", */
    },
    /*::[*/
    82: {
      /* n:"DConName", */
    },
    /*::[*/
    85: {
      /* n:"DefColWidth", */
      f: parseuint16
    },
    /*::[*/
    89: {
      /* n:"XCT", */
    },
    /*::[*/
    90: {
      /* n:"CRN", */
    },
    /*::[*/
    91: {
      /* n:"FileSharing", */
    },
    /*::[*/
    92: {
      /* n:"WriteAccess", */
      f: parse_WriteAccess
    },
    /*::[*/
    93: {
      /* n:"Obj", */
      f: parse_Obj
    },
    /*::[*/
    94: {
      /* n:"Uncalced", */
    },
    /*::[*/
    95: {
      /* n:"CalcSaveRecalc", */
      f: parsebool
    },
    //
    /*::[*/
    96: {
      /* n:"Template", */
    },
    /*::[*/
    97: {
      /* n:"Intl", */
    },
    /*::[*/
    99: {
      /* n:"ObjProtect", */
      f: parsebool
    },
    /*::[*/
    125: {
      /* n:"ColInfo", */
      f: parse_ColInfo
    },
    /*::[*/
    128: {
      /* n:"Guts", */
      f: parse_Guts
    },
    /*::[*/
    129: {
      /* n:"WsBool", */
      f: parse_WsBool
    },
    /*::[*/
    130: {
      /* n:"GridSet", */
      f: parseuint16
    },
    /*::[*/
    131: {
      /* n:"HCenter", */
      f: parsebool
    },
    /*::[*/
    132: {
      /* n:"VCenter", */
      f: parsebool
    },
    /*::[*/
    133: {
      /* n:"BoundSheet8", */
      f: parse_BoundSheet8
    },
    /*::[*/
    134: {
      /* n:"WriteProtect", */
    },
    /*::[*/
    140: {
      /* n:"Country", */
      f: parse_Country
    },
    /*::[*/
    141: {
      /* n:"HideObj", */
      f: parseuint16
    },
    /*::[*/
    144: {
      /* n:"Sort", */
    },
    /*::[*/
    146: {
      /* n:"Palette", */
      f: parse_Palette
    },
    /*::[*/
    151: {
      /* n:"Sync", */
    },
    /*::[*/
    152: {
      /* n:"LPr", */
    },
    /*::[*/
    153: {
      /* n:"DxGCol", */
    },
    /*::[*/
    154: {
      /* n:"FnGroupName", */
    },
    /*::[*/
    155: {
      /* n:"FilterMode", */
    },
    /*::[*/
    156: {
      /* n:"BuiltInFnGroupCount", */
      f: parseuint16
    },
    /*::[*/
    157: {
      /* n:"AutoFilterInfo", */
    },
    /*::[*/
    158: {
      /* n:"AutoFilter", */
    },
    /*::[*/
    160: {
      /* n:"Scl", */
      f: parse_Scl
    },
    /*::[*/
    161: {
      /* n:"Setup", */
      f: parse_Setup
    },
    /*::[*/
    174: {
      /* n:"ScenMan", */
    },
    /*::[*/
    175: {
      /* n:"SCENARIO", */
    },
    /*::[*/
    176: {
      /* n:"SxView", */
    },
    /*::[*/
    177: {
      /* n:"Sxvd", */
    },
    /*::[*/
    178: {
      /* n:"SXVI", */
    },
    /*::[*/
    180: {
      /* n:"SxIvd", */
    },
    /*::[*/
    181: {
      /* n:"SXLI", */
    },
    /*::[*/
    182: {
      /* n:"SXPI", */
    },
    /*::[*/
    184: {
      /* n:"DocRoute", */
    },
    /*::[*/
    185: {
      /* n:"RecipName", */
    },
    /*::[*/
    189: {
      /* n:"MulRk", */
      f: parse_MulRk
    },
    /*::[*/
    190: {
      /* n:"MulBlank", */
      f: parse_MulBlank
    },
    /*::[*/
    193: {
      /* n:"Mms", */
      f: parsenoop2
    },
    /*::[*/
    197: {
      /* n:"SXDI", */
    },
    /*::[*/
    198: {
      /* n:"SXDB", */
    },
    /*::[*/
    199: {
      /* n:"SXFDB", */
    },
    /*::[*/
    200: {
      /* n:"SXDBB", */
    },
    /*::[*/
    201: {
      /* n:"SXNum", */
    },
    /*::[*/
    202: {
      /* n:"SxBool", */
      f: parsebool
    },
    /*::[*/
    203: {
      /* n:"SxErr", */
    },
    /*::[*/
    204: {
      /* n:"SXInt", */
    },
    /*::[*/
    205: {
      /* n:"SXString", */
    },
    /*::[*/
    206: {
      /* n:"SXDtr", */
    },
    /*::[*/
    207: {
      /* n:"SxNil", */
    },
    /*::[*/
    208: {
      /* n:"SXTbl", */
    },
    /*::[*/
    209: {
      /* n:"SXTBRGIITM", */
    },
    /*::[*/
    210: {
      /* n:"SxTbpg", */
    },
    /*::[*/
    211: {
      /* n:"ObProj", */
    },
    /*::[*/
    213: {
      /* n:"SXStreamID", */
    },
    /*::[*/
    215: {
      /* n:"DBCell", */
    },
    /*::[*/
    216: {
      /* n:"SXRng", */
    },
    /*::[*/
    217: {
      /* n:"SxIsxoper", */
    },
    /*::[*/
    218: {
      /* n:"BookBool", */
      f: parseuint16
    },
    /*::[*/
    220: {
      /* n:"DbOrParamQry", */
    },
    /*::[*/
    221: {
      /* n:"ScenarioProtect", */
      f: parsebool
    },
    /*::[*/
    222: {
      /* n:"OleObjectSize", */
    },
    /*::[*/
    224: {
      /* n:"XF", */
      f: parse_XF
    },
    /*::[*/
    225: {
      /* n:"InterfaceHdr", */
      f: parse_InterfaceHdr
    },
    /*::[*/
    226: {
      /* n:"InterfaceEnd", */
      f: parsenoop2
    },
    /*::[*/
    227: {
      /* n:"SXVS", */
    },
    /*::[*/
    229: {
      /* n:"MergeCells", */
      f: parse_MergeCells
    },
    /*::[*/
    233: {
      /* n:"BkHim", */
    },
    /*::[*/
    235: {
      /* n:"MsoDrawingGroup", */
    },
    /*::[*/
    236: {
      /* n:"MsoDrawing", */
    },
    /*::[*/
    237: {
      /* n:"MsoDrawingSelection", */
    },
    /*::[*/
    239: {
      /* n:"PhoneticInfo", */
    },
    /*::[*/
    240: {
      /* n:"SxRule", */
    },
    /*::[*/
    241: {
      /* n:"SXEx", */
    },
    /*::[*/
    242: {
      /* n:"SxFilt", */
    },
    /*::[*/
    244: {
      /* n:"SxDXF", */
    },
    /*::[*/
    245: {
      /* n:"SxItm", */
    },
    /*::[*/
    246: {
      /* n:"SxName", */
    },
    /*::[*/
    247: {
      /* n:"SxSelect", */
    },
    /*::[*/
    248: {
      /* n:"SXPair", */
    },
    /*::[*/
    249: {
      /* n:"SxFmla", */
    },
    /*::[*/
    251: {
      /* n:"SxFormat", */
    },
    /*::[*/
    252: {
      /* n:"SST", */
      f: parse_SST
    },
    /*::[*/
    253: {
      /* n:"LabelSst", */
      f: parse_LabelSst
    },
    /*::[*/
    255: {
      /* n:"ExtSST", */
      f: parse_ExtSST
    },
    /*::[*/
    256: {
      /* n:"SXVDEx", */
    },
    /*::[*/
    259: {
      /* n:"SXFormula", */
    },
    /*::[*/
    290: {
      /* n:"SXDBEx", */
    },
    /*::[*/
    311: {
      /* n:"RRDInsDel", */
    },
    /*::[*/
    312: {
      /* n:"RRDHead", */
    },
    /*::[*/
    315: {
      /* n:"RRDChgCell", */
    },
    /*::[*/
    317: {
      /* n:"RRTabId", */
      f: parseuint16a
    },
    /*::[*/
    318: {
      /* n:"RRDRenSheet", */
    },
    /*::[*/
    319: {
      /* n:"RRSort", */
    },
    /*::[*/
    320: {
      /* n:"RRDMove", */
    },
    /*::[*/
    330: {
      /* n:"RRFormat", */
    },
    /*::[*/
    331: {
      /* n:"RRAutoFmt", */
    },
    /*::[*/
    333: {
      /* n:"RRInsertSh", */
    },
    /*::[*/
    334: {
      /* n:"RRDMoveBegin", */
    },
    /*::[*/
    335: {
      /* n:"RRDMoveEnd", */
    },
    /*::[*/
    336: {
      /* n:"RRDInsDelBegin", */
    },
    /*::[*/
    337: {
      /* n:"RRDInsDelEnd", */
    },
    /*::[*/
    338: {
      /* n:"RRDConflict", */
    },
    /*::[*/
    339: {
      /* n:"RRDDefName", */
    },
    /*::[*/
    340: {
      /* n:"RRDRstEtxp", */
    },
    /*::[*/
    351: {
      /* n:"LRng", */
    },
    /*::[*/
    352: {
      /* n:"UsesELFs", */
      f: parsebool
    },
    /*::[*/
    353: {
      /* n:"DSF", */
      f: parsenoop2
    },
    /*::[*/
    401: {
      /* n:"CUsr", */
    },
    /*::[*/
    402: {
      /* n:"CbUsr", */
    },
    /*::[*/
    403: {
      /* n:"UsrInfo", */
    },
    /*::[*/
    404: {
      /* n:"UsrExcl", */
    },
    /*::[*/
    405: {
      /* n:"FileLock", */
    },
    /*::[*/
    406: {
      /* n:"RRDInfo", */
    },
    /*::[*/
    407: {
      /* n:"BCUsrs", */
    },
    /*::[*/
    408: {
      /* n:"UsrChk", */
    },
    /*::[*/
    425: {
      /* n:"UserBView", */
    },
    /*::[*/
    426: {
      /* n:"UserSViewBegin", */
    },
    /*::[*/
    427: {
      /* n:"UserSViewEnd", */
    },
    /*::[*/
    428: {
      /* n:"RRDUserView", */
    },
    /*::[*/
    429: {
      /* n:"Qsi", */
    },
    /*::[*/
    430: {
      /* n:"SupBook", */
      f: parse_SupBook
    },
    /*::[*/
    431: {
      /* n:"Prot4Rev", */
      f: parsebool
    },
    /*::[*/
    432: {
      /* n:"CondFmt", */
    },
    /*::[*/
    433: {
      /* n:"CF", */
    },
    /*::[*/
    434: {
      /* n:"DVal", */
    },
    /*::[*/
    437: {
      /* n:"DConBin", */
    },
    /*::[*/
    438: {
      /* n:"TxO", */
      f: parse_TxO
    },
    /*::[*/
    439: {
      /* n:"RefreshAll", */
      f: parsebool
    },
    //
    /*::[*/
    440: {
      /* n:"HLink", */
      f: parse_HLink
    },
    /*::[*/
    441: {
      /* n:"Lel", */
    },
    /*::[*/
    442: {
      /* n:"CodeName", */
      f: parse_XLUnicodeString
    },
    /*::[*/
    443: {
      /* n:"SXFDBType", */
    },
    /*::[*/
    444: {
      /* n:"Prot4RevPass", */
      f: parseuint16
    },
    /*::[*/
    445: {
      /* n:"ObNoMacros", */
    },
    /*::[*/
    446: {
      /* n:"Dv", */
    },
    /*::[*/
    448: {
      /* n:"Excel9File", */
      f: parsenoop2
    },
    /*::[*/
    449: {
      /* n:"RecalcId", */
      f: parse_RecalcId,
      r: 2
    },
    /*::[*/
    450: {
      /* n:"EntExU2", */
      f: parsenoop2
    },
    /*::[*/
    512: {
      /* n:"Dimensions", */
      f: parse_Dimensions
    },
    /*::[*/
    513: {
      /* n:"Blank", */
      f: parse_Blank
    },
    /*::[*/
    515: {
      /* n:"Number", */
      f: parse_Number
    },
    /*::[*/
    516: {
      /* n:"Label", */
      f: parse_Label
    },
    /*::[*/
    517: {
      /* n:"BoolErr", */
      f: parse_BoolErr
    },
    /*::[*/
    519: {
      /* n:"String", */
      f: parse_String
    },
    /*::[*/
    520: {
      /* n:"Row", */
      f: parse_Row
    },
    /*::[*/
    523: {
      /* n:"Index", */
    },
    /*::[*/
    545: {
      /* n:"Array", */
      f: parse_Array
    },
    /*::[*/
    549: {
      /* n:"DefaultRowHeight", */
      f: parse_DefaultRowHeight
    },
    /*::[*/
    566: {
      /* n:"Table", */
    },
    /*::[*/
    574: {
      /* n:"Window2", */
      f: parse_Window2
    },
    /*::[*/
    638: {
      /* n:"RK", */
      f: parse_RK
    },
    /*::[*/
    659: {
      /* n:"Style", */
    },
    /*::[*/
    1048: {
      /* n:"BigName", */
    },
    /*::[*/
    1054: {
      /* n:"Format", */
      f: parse_Format
    },
    /*::[*/
    1084: {
      /* n:"ContinueBigName", */
    },
    /*::[*/
    1212: {
      /* n:"ShrFmla", */
      f: parse_ShrFmla
    },
    /*::[*/
    2048: {
      /* n:"HLinkTooltip", */
      f: parse_HLinkTooltip
    },
    /*::[*/
    2049: {
      /* n:"WebPub", */
    },
    /*::[*/
    2050: {
      /* n:"QsiSXTag", */
    },
    /*::[*/
    2051: {
      /* n:"DBQueryExt", */
    },
    /*::[*/
    2052: {
      /* n:"ExtString", */
    },
    /*::[*/
    2053: {
      /* n:"TxtQry", */
    },
    /*::[*/
    2054: {
      /* n:"Qsir", */
    },
    /*::[*/
    2055: {
      /* n:"Qsif", */
    },
    /*::[*/
    2056: {
      /* n:"RRDTQSIF", */
    },
    /*::[*/
    2057: {
      /* n:"BOF", */
      f: parse_BOF
    },
    /*::[*/
    2058: {
      /* n:"OleDbConn", */
    },
    /*::[*/
    2059: {
      /* n:"WOpt", */
    },
    /*::[*/
    2060: {
      /* n:"SXViewEx", */
    },
    /*::[*/
    2061: {
      /* n:"SXTH", */
    },
    /*::[*/
    2062: {
      /* n:"SXPIEx", */
    },
    /*::[*/
    2063: {
      /* n:"SXVDTEx", */
    },
    /*::[*/
    2064: {
      /* n:"SXViewEx9", */
    },
    /*::[*/
    2066: {
      /* n:"ContinueFrt", */
    },
    /*::[*/
    2067: {
      /* n:"RealTimeData", */
    },
    /*::[*/
    2128: {
      /* n:"ChartFrtInfo", */
    },
    /*::[*/
    2129: {
      /* n:"FrtWrapper", */
    },
    /*::[*/
    2130: {
      /* n:"StartBlock", */
    },
    /*::[*/
    2131: {
      /* n:"EndBlock", */
    },
    /*::[*/
    2132: {
      /* n:"StartObject", */
    },
    /*::[*/
    2133: {
      /* n:"EndObject", */
    },
    /*::[*/
    2134: {
      /* n:"CatLab", */
    },
    /*::[*/
    2135: {
      /* n:"YMult", */
    },
    /*::[*/
    2136: {
      /* n:"SXViewLink", */
    },
    /*::[*/
    2137: {
      /* n:"PivotChartBits", */
    },
    /*::[*/
    2138: {
      /* n:"FrtFontList", */
    },
    /*::[*/
    2146: {
      /* n:"SheetExt", */
    },
    /*::[*/
    2147: {
      /* n:"BookExt", */
      r: 12
    },
    /*::[*/
    2148: {
      /* n:"SXAddl", */
    },
    /*::[*/
    2149: {
      /* n:"CrErr", */
    },
    /*::[*/
    2150: {
      /* n:"HFPicture", */
    },
    /*::[*/
    2151: {
      /* n:"FeatHdr", */
      f: parsenoop2
    },
    /*::[*/
    2152: {
      /* n:"Feat", */
    },
    /*::[*/
    2154: {
      /* n:"DataLabExt", */
    },
    /*::[*/
    2155: {
      /* n:"DataLabExtContents", */
    },
    /*::[*/
    2156: {
      /* n:"CellWatch", */
    },
    /*::[*/
    2161: {
      /* n:"FeatHdr11", */
    },
    /*::[*/
    2162: {
      /* n:"Feature11", */
    },
    /*::[*/
    2164: {
      /* n:"DropDownObjIds", */
    },
    /*::[*/
    2165: {
      /* n:"ContinueFrt11", */
    },
    /*::[*/
    2166: {
      /* n:"DConn", */
    },
    /*::[*/
    2167: {
      /* n:"List12", */
    },
    /*::[*/
    2168: {
      /* n:"Feature12", */
    },
    /*::[*/
    2169: {
      /* n:"CondFmt12", */
    },
    /*::[*/
    2170: {
      /* n:"CF12", */
    },
    /*::[*/
    2171: {
      /* n:"CFEx", */
    },
    /*::[*/
    2172: {
      /* n:"XFCRC", */
      f: parse_XFCRC,
      r: 12
    },
    /*::[*/
    2173: {
      /* n:"XFExt", */
      f: parse_XFExt,
      r: 12
    },
    /*::[*/
    2174: {
      /* n:"AutoFilter12", */
    },
    /*::[*/
    2175: {
      /* n:"ContinueFrt12", */
    },
    /*::[*/
    2180: {
      /* n:"MDTInfo", */
    },
    /*::[*/
    2181: {
      /* n:"MDXStr", */
    },
    /*::[*/
    2182: {
      /* n:"MDXTuple", */
    },
    /*::[*/
    2183: {
      /* n:"MDXSet", */
    },
    /*::[*/
    2184: {
      /* n:"MDXProp", */
    },
    /*::[*/
    2185: {
      /* n:"MDXKPI", */
    },
    /*::[*/
    2186: {
      /* n:"MDB", */
    },
    /*::[*/
    2187: {
      /* n:"PLV", */
    },
    /*::[*/
    2188: {
      /* n:"Compat12", */
      f: parsebool,
      r: 12
    },
    /*::[*/
    2189: {
      /* n:"DXF", */
    },
    /*::[*/
    2190: {
      /* n:"TableStyles", */
      r: 12
    },
    /*::[*/
    2191: {
      /* n:"TableStyle", */
    },
    /*::[*/
    2192: {
      /* n:"TableStyleElement", */
    },
    /*::[*/
    2194: {
      /* n:"StyleExt", */
    },
    /*::[*/
    2195: {
      /* n:"NamePublish", */
    },
    /*::[*/
    2196: {
      /* n:"NameCmt", */
      f: parse_NameCmt,
      r: 12
    },
    /*::[*/
    2197: {
      /* n:"SortData", */
    },
    /*::[*/
    2198: {
      /* n:"Theme", */
      f: parse_Theme,
      r: 12
    },
    /*::[*/
    2199: {
      /* n:"GUIDTypeLib", */
    },
    /*::[*/
    2200: {
      /* n:"FnGrp12", */
    },
    /*::[*/
    2201: {
      /* n:"NameFnGrp12", */
    },
    /*::[*/
    2202: {
      /* n:"MTRSettings", */
      f: parse_MTRSettings,
      r: 12
    },
    /*::[*/
    2203: {
      /* n:"CompressPictures", */
      f: parsenoop2
    },
    /*::[*/
    2204: {
      /* n:"HeaderFooter", */
    },
    /*::[*/
    2205: {
      /* n:"CrtLayout12", */
    },
    /*::[*/
    2206: {
      /* n:"CrtMlFrt", */
    },
    /*::[*/
    2207: {
      /* n:"CrtMlFrtContinue", */
    },
    /*::[*/
    2211: {
      /* n:"ForceFullCalculation", */
      f: parse_ForceFullCalculation
    },
    /*::[*/
    2212: {
      /* n:"ShapePropsStream", */
    },
    /*::[*/
    2213: {
      /* n:"TextPropsStream", */
    },
    /*::[*/
    2214: {
      /* n:"RichTextStream", */
    },
    /*::[*/
    2215: {
      /* n:"CrtLayout12A", */
    },
    /*::[*/
    4097: {
      /* n:"Units", */
    },
    /*::[*/
    4098: {
      /* n:"Chart", */
    },
    /*::[*/
    4099: {
      /* n:"Series", */
    },
    /*::[*/
    4102: {
      /* n:"DataFormat", */
    },
    /*::[*/
    4103: {
      /* n:"LineFormat", */
    },
    /*::[*/
    4105: {
      /* n:"MarkerFormat", */
    },
    /*::[*/
    4106: {
      /* n:"AreaFormat", */
    },
    /*::[*/
    4107: {
      /* n:"PieFormat", */
    },
    /*::[*/
    4108: {
      /* n:"AttachedLabel", */
    },
    /*::[*/
    4109: {
      /* n:"SeriesText", */
    },
    /*::[*/
    4116: {
      /* n:"ChartFormat", */
    },
    /*::[*/
    4117: {
      /* n:"Legend", */
    },
    /*::[*/
    4118: {
      /* n:"SeriesList", */
    },
    /*::[*/
    4119: {
      /* n:"Bar", */
    },
    /*::[*/
    4120: {
      /* n:"Line", */
    },
    /*::[*/
    4121: {
      /* n:"Pie", */
    },
    /*::[*/
    4122: {
      /* n:"Area", */
    },
    /*::[*/
    4123: {
      /* n:"Scatter", */
    },
    /*::[*/
    4124: {
      /* n:"CrtLine", */
    },
    /*::[*/
    4125: {
      /* n:"Axis", */
    },
    /*::[*/
    4126: {
      /* n:"Tick", */
    },
    /*::[*/
    4127: {
      /* n:"ValueRange", */
    },
    /*::[*/
    4128: {
      /* n:"CatSerRange", */
    },
    /*::[*/
    4129: {
      /* n:"AxisLine", */
    },
    /*::[*/
    4130: {
      /* n:"CrtLink", */
    },
    /*::[*/
    4132: {
      /* n:"DefaultText", */
    },
    /*::[*/
    4133: {
      /* n:"Text", */
    },
    /*::[*/
    4134: {
      /* n:"FontX", */
      f: parseuint16
    },
    /*::[*/
    4135: {
      /* n:"ObjectLink", */
    },
    /*::[*/
    4146: {
      /* n:"Frame", */
    },
    /*::[*/
    4147: {
      /* n:"Begin", */
    },
    /*::[*/
    4148: {
      /* n:"End", */
    },
    /*::[*/
    4149: {
      /* n:"PlotArea", */
    },
    /*::[*/
    4154: {
      /* n:"Chart3d", */
    },
    /*::[*/
    4156: {
      /* n:"PicF", */
    },
    /*::[*/
    4157: {
      /* n:"DropBar", */
    },
    /*::[*/
    4158: {
      /* n:"Radar", */
    },
    /*::[*/
    4159: {
      /* n:"Surf", */
    },
    /*::[*/
    4160: {
      /* n:"RadarArea", */
    },
    /*::[*/
    4161: {
      /* n:"AxisParent", */
    },
    /*::[*/
    4163: {
      /* n:"LegendException", */
    },
    /*::[*/
    4164: {
      /* n:"ShtProps", */
      f: parse_ShtProps
    },
    /*::[*/
    4165: {
      /* n:"SerToCrt", */
    },
    /*::[*/
    4166: {
      /* n:"AxesUsed", */
    },
    /*::[*/
    4168: {
      /* n:"SBaseRef", */
    },
    /*::[*/
    4170: {
      /* n:"SerParent", */
    },
    /*::[*/
    4171: {
      /* n:"SerAuxTrend", */
    },
    /*::[*/
    4174: {
      /* n:"IFmtRecord", */
    },
    /*::[*/
    4175: {
      /* n:"Pos", */
    },
    /*::[*/
    4176: {
      /* n:"AlRuns", */
    },
    /*::[*/
    4177: {
      /* n:"BRAI", */
    },
    /*::[*/
    4187: {
      /* n:"SerAuxErrBar", */
    },
    /*::[*/
    4188: {
      /* n:"ClrtClient", */
      f: parse_ClrtClient
    },
    /*::[*/
    4189: {
      /* n:"SerFmt", */
    },
    /*::[*/
    4191: {
      /* n:"Chart3DBarShape", */
    },
    /*::[*/
    4192: {
      /* n:"Fbi", */
    },
    /*::[*/
    4193: {
      /* n:"BopPop", */
    },
    /*::[*/
    4194: {
      /* n:"AxcExt", */
    },
    /*::[*/
    4195: {
      /* n:"Dat", */
    },
    /*::[*/
    4196: {
      /* n:"PlotGrowth", */
    },
    /*::[*/
    4197: {
      /* n:"SIIndex", */
    },
    /*::[*/
    4198: {
      /* n:"GelFrame", */
    },
    /*::[*/
    4199: {
      /* n:"BopPopCustom", */
    },
    /*::[*/
    4200: {
      /* n:"Fbi2", */
    },
    /*::[*/
    0: {
      /* n:"Dimensions", */
      f: parse_Dimensions
    },
    /*::[*/
    1: {
      /* n:"BIFF2BLANK", */
    },
    /*::[*/
    2: {
      /* n:"BIFF2INT", */
      f: parse_BIFF2INT
    },
    /*::[*/
    3: {
      /* n:"BIFF2NUM", */
      f: parse_BIFF2NUM
    },
    /*::[*/
    4: {
      /* n:"BIFF2STR", */
      f: parse_BIFF2STR
    },
    /*::[*/
    5: {
      /* n:"BoolErr", */
      f: parse_BoolErr
    },
    /*::[*/
    7: {
      /* n:"String", */
      f: parse_BIFF2STRING
    },
    /*::[*/
    8: {
      /* n:"BIFF2ROW", */
    },
    /*::[*/
    9: {
      /* n:"BOF", */
      f: parse_BOF
    },
    /*::[*/
    11: {
      /* n:"Index", */
    },
    /*::[*/
    22: {
      /* n:"ExternCount", */
      f: parseuint16
    },
    /*::[*/
    30: {
      /* n:"BIFF2FORMAT", */
      f: parse_BIFF2Format
    },
    /*::[*/
    31: {
      /* n:"BIFF2FMTCNT", */
    },
    /* 16-bit cnt of BIFF2FORMAT records */
    /*::[*/
    32: {
      /* n:"BIFF2COLINFO", */
    },
    /*::[*/
    33: {
      /* n:"Array", */
      f: parse_Array
    },
    /*::[*/
    36: {
      /* n:"COLWIDTH", */
    },
    /*::[*/
    37: {
      /* n:"DefaultRowHeight", */
      f: parse_DefaultRowHeight
    },
    // 0x2c ??
    // 0x2d ??
    // 0x2e ??
    // 0x30 FONTCOUNT: number of fonts
    /*::[*/
    50: {
      /* n:"BIFF2FONTXTRA", */
      f: parse_BIFF2FONTXTRA
    },
    // 0x35: INFOOPTS
    // 0x36: TABLE (BIFF2 only)
    // 0x37: TABLE2 (BIFF2 only)
    // 0x38: WNDESK
    // 0x39 ??
    // 0x3a: BEGINPREF
    // 0x3b: ENDPREF
    /*::[*/
    62: {
      /* n:"BIFF2WINDOW2", */
    },
    // 0x3f ??
    // 0x46: SHOWSCROLL
    // 0x47: SHOWFORMULA
    // 0x48: STATUSBAR
    // 0x49: SHORTMENUS
    // 0x4A:
    // 0x4B:
    // 0x4C:
    // 0x4E:
    // 0x4F:
    // 0x58: TOOLBAR (BIFF3)
    /* - - - */
    /*::[*/
    52: {
      /* n:"DDEObjName", */
    },
    /*::[*/
    67: {
      /* n:"BIFF2XF", */
    },
    /*::[*/
    68: {
      /* n:"BIFF2XFINDEX", */
      f: parseuint16
    },
    /*::[*/
    69: {
      /* n:"BIFF2FONTCLR", */
    },
    /*::[*/
    86: {
      /* n:"BIFF4FMTCNT", */
    },
    /* 16-bit cnt, similar to BIFF2 */
    /*::[*/
    126: {
      /* n:"RK", */
    },
    /* Not necessarily same as 0x027e */
    /*::[*/
    127: {
      /* n:"ImData", */
      f: parse_ImData
    },
    /*::[*/
    135: {
      /* n:"Addin", */
    },
    /*::[*/
    136: {
      /* n:"Edg", */
    },
    /*::[*/
    137: {
      /* n:"Pub", */
    },
    // 0x8A
    // 0x8B LH: alternate menu key flag (BIFF3/4)
    // 0x8E
    // 0x8F
    /*::[*/
    145: {
      /* n:"Sub", */
    },
    // 0x93 STYLE
    /*::[*/
    148: {
      /* n:"LHRecord", */
    },
    /*::[*/
    149: {
      /* n:"LHNGraph", */
    },
    /*::[*/
    150: {
      /* n:"Sound", */
    },
    // 0xA2 FNPROTO: function prototypes (BIFF4)
    // 0xA3
    // 0xA8
    /*::[*/
    169: {
      /* n:"CoordList", */
    },
    /*::[*/
    171: {
      /* n:"GCW", */
    },
    /*::[*/
    188: {
      /* n:"ShrFmla", */
    },
    /* Not necessarily same as 0x04bc */
    /*::[*/
    191: {
      /* n:"ToolbarHdr", */
    },
    /*::[*/
    192: {
      /* n:"ToolbarEnd", */
    },
    /*::[*/
    194: {
      /* n:"AddMenu", */
    },
    /*::[*/
    195: {
      /* n:"DelMenu", */
    },
    /*::[*/
    214: {
      /* n:"RString", */
      f: parse_RString
    },
    /*::[*/
    223: {
      /* n:"UDDesc", */
    },
    /*::[*/
    234: {
      /* n:"TabIdConf", */
    },
    /*::[*/
    354: {
      /* n:"XL5Modify", */
    },
    /*::[*/
    421: {
      /* n:"FileSharing2", */
    },
    /*::[*/
    518: {
      /* n:"Formula", */
      f: parse_Formula
    },
    /*::[*/
    521: {
      /* n:"BOF", */
      f: parse_BOF
    },
    /*::[*/
    536: {
      /* n:"Lbl", */
      f: parse_Lbl
    },
    /*::[*/
    547: {
      /* n:"ExternName", */
      f: parse_ExternName
    },
    /*::[*/
    561: {
      /* n:"Font", */
    },
    /*::[*/
    579: {
      /* n:"BIFF3XF", */
    },
    /*::[*/
    1030: {
      /* n:"Formula", */
      f: parse_Formula
    },
    /*::[*/
    1033: {
      /* n:"BOF", */
      f: parse_BOF
    },
    /*::[*/
    1091: {
      /* n:"BIFF4XF", */
    },
    /*::[*/
    2157: {
      /* n:"FeatInfo", */
    },
    /*::[*/
    2163: {
      /* n:"FeatInfo11", */
    },
    /*::[*/
    2177: {
      /* n:"SXAddl12", */
    },
    /*::[*/
    2240: {
      /* n:"AutoWebPub", */
    },
    /*::[*/
    2241: {
      /* n:"ListObj", */
    },
    /*::[*/
    2242: {
      /* n:"ListField", */
    },
    /*::[*/
    2243: {
      /* n:"ListDV", */
    },
    /*::[*/
    2244: {
      /* n:"ListCondFmt", */
    },
    /*::[*/
    2245: {
      /* n:"ListCF", */
    },
    /*::[*/
    2246: {
      /* n:"FMQry", */
    },
    /*::[*/
    2247: {
      /* n:"FMSQry", */
    },
    /*::[*/
    2248: {
      /* n:"PLV", */
    },
    /*::[*/
    2249: {
      /* n:"LnExt", */
    },
    /*::[*/
    2250: {
      /* n:"MkrExt", */
    },
    /*::[*/
    2251: {
      /* n:"CrtCoopt", */
    },
    /*::[*/
    2262: {
      /* n:"FRTArchId$", */
      r: 12
    },
    /*::[*/
    29282: {}
  };
  function write_biff_rec(ba, type, payload, length) {
    var t = type;
    if (isNaN(t)) return;
    var len = length || (payload || []).length || 0;
    var o = ba.next(4);
    o.write_shift(2, t);
    o.write_shift(2, len);
    if (
      /*:: len != null &&*/
      len > 0 && is_buf(payload)
    ) ba.push(payload);
  }
  function html_to_sheet(str, _opts) {
    var opts = _opts || {};
    if (DENSE != null && opts.dense == null) opts.dense = DENSE;
    var ws = opts.dense ? [] : {};
    str = str.replace(/<!--.*?-->/g, "");
    var mtch = str.match(/<table/i);
    if (!mtch) throw new Error("Invalid HTML: could not find <table>");
    var mtch2 = str.match(/<\/table/i);
    var i = mtch.index, j = mtch2 && mtch2.index || str.length;
    var rows = split_regex(str.slice(i, j), /(:?<tr[^>]*>)/i, "<tr>");
    var R = -1, C = 0, RS = 0, CS = 0;
    var range2 = { s: { r: 1e7, c: 1e7 }, e: { r: 0, c: 0 } };
    var merges = [];
    for (i = 0; i < rows.length; ++i) {
      var row = rows[i].trim();
      var hd = row.slice(0, 3).toLowerCase();
      if (hd == "<tr") {
        ++R;
        if (opts.sheetRows && opts.sheetRows <= R) {
          --R;
          break;
        }
        C = 0;
        continue;
      }
      if (hd != "<td" && hd != "<th") continue;
      var cells = row.split(/<\/t[dh]>/i);
      for (j = 0; j < cells.length; ++j) {
        var cell = cells[j].trim();
        if (!cell.match(/<t[dh]/i)) continue;
        var m = cell, cc = 0;
        while (m.charAt(0) == "<" && (cc = m.indexOf(">")) > -1) m = m.slice(cc + 1);
        for (var midx = 0; midx < merges.length; ++midx) {
          var _merge = merges[midx];
          if (_merge.s.c == C && _merge.s.r < R && R <= _merge.e.r) {
            C = _merge.e.c + 1;
            midx = -1;
          }
        }
        var tag = parsexmltag(cell.slice(0, cell.indexOf(">")));
        CS = tag.colspan ? +tag.colspan : 1;
        if ((RS = +tag.rowspan) > 1 || CS > 1) merges.push({ s: { r: R, c: C }, e: { r: R + (RS || 1) - 1, c: C + CS - 1 } });
        var _t = tag.t || tag["data-t"] || "";
        if (!m.length) {
          C += CS;
          continue;
        }
        m = htmldecode(m);
        if (range2.s.r > R) range2.s.r = R;
        if (range2.e.r < R) range2.e.r = R;
        if (range2.s.c > C) range2.s.c = C;
        if (range2.e.c < C) range2.e.c = C;
        if (!m.length) {
          C += CS;
          continue;
        }
        var o = { t: "s", v: m };
        if (opts.raw || !m.trim().length || _t == "s") {
        } else if (m === "TRUE") o = { t: "b", v: true };
        else if (m === "FALSE") o = { t: "b", v: false };
        else if (!isNaN(fuzzynum(m))) o = { t: "n", v: fuzzynum(m) };
        else if (!isNaN(fuzzydate(m).getDate())) {
          o = { t: "d", v: parseDate(m) };
          if (!opts.cellDates) o = { t: "n", v: datenum(o.v) };
          o.z = opts.dateNF || table_fmt[14];
        }
        if (opts.dense) {
          if (!ws[R]) ws[R] = [];
          ws[R][C] = o;
        } else ws[encode_cell({ r: R, c: C })] = o;
        C += CS;
      }
    }
    ws["!ref"] = encode_range(range2);
    if (merges.length) ws["!merges"] = merges;
    return ws;
  }
  function make_html_row(ws, r, R, o) {
    var M = ws["!merges"] || [];
    var oo = [];
    for (var C = r.s.c; C <= r.e.c; ++C) {
      var RS = 0, CS = 0;
      for (var j = 0; j < M.length; ++j) {
        if (M[j].s.r > R || M[j].s.c > C) continue;
        if (M[j].e.r < R || M[j].e.c < C) continue;
        if (M[j].s.r < R || M[j].s.c < C) {
          RS = -1;
          break;
        }
        RS = M[j].e.r - M[j].s.r + 1;
        CS = M[j].e.c - M[j].s.c + 1;
        break;
      }
      if (RS < 0) continue;
      var coord = encode_cell({ r: R, c: C });
      var cell = o.dense ? (ws[R] || [])[C] : ws[coord];
      var w = cell && cell.v != null && (cell.h || escapehtml(cell.w || (format_cell(cell), cell.w) || "")) || "";
      var sp = {};
      if (RS > 1) sp.rowspan = RS;
      if (CS > 1) sp.colspan = CS;
      if (o.editable) w = '<span contenteditable="true">' + w + "</span>";
      else if (cell) {
        sp["data-t"] = cell && cell.t || "z";
        if (cell.v != null) sp["data-v"] = cell.v;
        if (cell.z != null) sp["data-z"] = cell.z;
        if (cell.l && (cell.l.Target || "#").charAt(0) != "#") w = '<a href="' + cell.l.Target + '">' + w + "</a>";
      }
      sp.id = (o.id || "sjs") + "-" + coord;
      oo.push(writextag("td", w, sp));
    }
    var preamble = "<tr>";
    return preamble + oo.join("") + "</tr>";
  }
  var HTML_BEGIN = '<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>';
  var HTML_END = "</body></html>";
  function html_to_workbook(str, opts) {
    var mtch = str.match(/<table[\s\S]*?>[\s\S]*?<\/table>/gi);
    if (!mtch || mtch.length == 0) throw new Error("Invalid HTML: could not find <table>");
    if (mtch.length == 1) return sheet_to_workbook(html_to_sheet(mtch[0], opts), opts);
    var wb = book_new();
    mtch.forEach(function(s, idx) {
      book_append_sheet(wb, html_to_sheet(s, opts), "Sheet" + (idx + 1));
    });
    return wb;
  }
  function make_html_preamble(ws, R, o) {
    var out = [];
    return out.join("") + "<table" + (o && o.id ? ' id="' + o.id + '"' : "") + ">";
  }
  function sheet_to_html(ws, opts) {
    var o = opts || {};
    var header = o.header != null ? o.header : HTML_BEGIN;
    var footer = o.footer != null ? o.footer : HTML_END;
    var out = [header];
    var r = decode_range(ws["!ref"]);
    o.dense = Array.isArray(ws);
    out.push(make_html_preamble(ws, r, o));
    for (var R = r.s.r; R <= r.e.r; ++R) out.push(make_html_row(ws, r, R, o));
    out.push("</table>" + footer);
    return out.join("");
  }
  function sheet_add_dom(ws, table, _opts) {
    var opts = _opts || {};
    if (DENSE != null) opts.dense = DENSE;
    var or_R = 0, or_C = 0;
    if (opts.origin != null) {
      if (typeof opts.origin == "number") or_R = opts.origin;
      else {
        var _origin = typeof opts.origin == "string" ? decode_cell(opts.origin) : opts.origin;
        or_R = _origin.r;
        or_C = _origin.c;
      }
    }
    var rows = table.getElementsByTagName("tr");
    var sheetRows = Math.min(opts.sheetRows || 1e7, rows.length);
    var range2 = { s: { r: 0, c: 0 }, e: { r: or_R, c: or_C } };
    if (ws["!ref"]) {
      var _range = decode_range(ws["!ref"]);
      range2.s.r = Math.min(range2.s.r, _range.s.r);
      range2.s.c = Math.min(range2.s.c, _range.s.c);
      range2.e.r = Math.max(range2.e.r, _range.e.r);
      range2.e.c = Math.max(range2.e.c, _range.e.c);
      if (or_R == -1) range2.e.r = or_R = _range.e.r + 1;
    }
    var merges = [], midx = 0;
    var rowinfo = ws["!rows"] || (ws["!rows"] = []);
    var _R = 0, R = 0, _C = 0, C = 0, RS = 0, CS = 0;
    if (!ws["!cols"]) ws["!cols"] = [];
    for (; _R < rows.length && R < sheetRows; ++_R) {
      var row = rows[_R];
      if (is_dom_element_hidden(row)) {
        if (opts.display) continue;
        rowinfo[R] = { hidden: true };
      }
      var elts = row.children;
      for (_C = C = 0; _C < elts.length; ++_C) {
        var elt = elts[_C];
        if (opts.display && is_dom_element_hidden(elt)) continue;
        var v = elt.hasAttribute("data-v") ? elt.getAttribute("data-v") : elt.hasAttribute("v") ? elt.getAttribute("v") : htmldecode(elt.innerHTML);
        var z = elt.getAttribute("data-z") || elt.getAttribute("z");
        for (midx = 0; midx < merges.length; ++midx) {
          var m = merges[midx];
          if (m.s.c == C + or_C && m.s.r < R + or_R && R + or_R <= m.e.r) {
            C = m.e.c + 1 - or_C;
            midx = -1;
          }
        }
        CS = +elt.getAttribute("colspan") || 1;
        if ((RS = +elt.getAttribute("rowspan") || 1) > 1 || CS > 1) merges.push({ s: { r: R + or_R, c: C + or_C }, e: { r: R + or_R + (RS || 1) - 1, c: C + or_C + (CS || 1) - 1 } });
        var o = { t: "s", v };
        var _t = elt.getAttribute("data-t") || elt.getAttribute("t") || "";
        if (v != null) {
          if (v.length == 0) o.t = _t || "z";
          else if (opts.raw || v.trim().length == 0 || _t == "s") {
          } else if (v === "TRUE") o = { t: "b", v: true };
          else if (v === "FALSE") o = { t: "b", v: false };
          else if (!isNaN(fuzzynum(v))) o = { t: "n", v: fuzzynum(v) };
          else if (!isNaN(fuzzydate(v).getDate())) {
            o = { t: "d", v: parseDate(v) };
            if (!opts.cellDates) o = { t: "n", v: datenum(o.v) };
            o.z = opts.dateNF || table_fmt[14];
          }
        }
        if (o.z === void 0 && z != null) o.z = z;
        var l2 = "", Aelts = elt.getElementsByTagName("A");
        if (Aelts && Aelts.length) {
          for (var Aelti = 0; Aelti < Aelts.length; ++Aelti) if (Aelts[Aelti].hasAttribute("href")) {
            l2 = Aelts[Aelti].getAttribute("href");
            if (l2.charAt(0) != "#") break;
          }
        }
        if (l2 && l2.charAt(0) != "#") o.l = { Target: l2 };
        if (opts.dense) {
          if (!ws[R + or_R]) ws[R + or_R] = [];
          ws[R + or_R][C + or_C] = o;
        } else ws[encode_cell({ c: C + or_C, r: R + or_R })] = o;
        if (range2.e.c < C + or_C) range2.e.c = C + or_C;
        C += CS;
      }
      ++R;
    }
    if (merges.length) ws["!merges"] = (ws["!merges"] || []).concat(merges);
    range2.e.r = Math.max(range2.e.r, R - 1 + or_R);
    ws["!ref"] = encode_range(range2);
    if (R >= sheetRows) ws["!fullref"] = encode_range((range2.e.r = rows.length - _R + R - 1 + or_R, range2));
    return ws;
  }
  function parse_dom_table(table, _opts) {
    var opts = _opts || {};
    var ws = opts.dense ? [] : {};
    return sheet_add_dom(ws, table, _opts);
  }
  function table_to_book(table, opts) {
    return sheet_to_workbook(parse_dom_table(table, opts), opts);
  }
  function is_dom_element_hidden(element) {
    var display = "";
    var get_computed_style = get_get_computed_style_function(element);
    if (get_computed_style) display = get_computed_style(element).getPropertyValue("display");
    if (!display) display = element.style && element.style.display;
    return display === "none";
  }
  function get_get_computed_style_function(element) {
    if (element.ownerDocument.defaultView && typeof element.ownerDocument.defaultView.getComputedStyle === "function") return element.ownerDocument.defaultView.getComputedStyle;
    if (typeof getComputedStyle === "function") return getComputedStyle;
    return null;
  }
  function parse_text_p(text) {
    var fixed = text.replace(/[\t\r\n]/g, " ").trim().replace(/ +/g, " ").replace(/<text:s\/>/g, " ").replace(/<text:s text:c="(\d+)"\/>/g, function($$, $1) {
      return Array(parseInt($1, 10) + 1).join(" ");
    }).replace(/<text:tab[^>]*\/>/g, "	").replace(/<text:line-break\/>/g, "\n");
    var v = unescapexml(fixed.replace(/<[^>]*>/g, ""));
    return [v];
  }
  var number_formats_ods = {
    /* ods name: [short ssf fmt, long ssf fmt] */
    day: ["d", "dd"],
    month: ["m", "mm"],
    year: ["y", "yy"],
    hours: ["h", "hh"],
    minutes: ["m", "mm"],
    seconds: ["s", "ss"],
    "am-pm": ["A/P", "AM/PM"],
    "day-of-week": ["ddd", "dddd"],
    era: ["e", "ee"],
    /* there is no native representation of LO "Q" format */
    quarter: ["\\Qm", 'm\\"th quarter"']
  };
  function parse_content_xml(d, _opts) {
    var opts = _opts || {};
    if (DENSE != null && opts.dense == null) opts.dense = DENSE;
    var str = xlml_normalize(d);
    var state = [], tmp;
    var tag;
    var NFtag = { name: "" }, NF = "", pidx = 0;
    var sheetag;
    var rowtag;
    var Sheets = {}, SheetNames = [];
    var ws = opts.dense ? [] : {};
    var Rn, q;
    var ctag = { value: "" };
    var textp = "", textpidx = 0, textptag;
    var textR = [];
    var R = -1, C = -1, range2 = { s: { r: 1e6, c: 1e7 }, e: { r: 0, c: 0 } };
    var row_ol = 0;
    var number_format_map = {};
    var merges = [], mrange = {}, mR = 0, mC = 0;
    var rowinfo = [], rowpeat = 1, colpeat = 1;
    var arrayf = [];
    var WB = { Names: [] };
    var atag = {};
    var _Ref = ["", ""];
    var comments = [], comment = {};
    var creator = "", creatoridx = 0;
    var isstub = false, intable = false;
    var i = 0;
    xlmlregex.lastIndex = 0;
    str = str.replace(/<!--([\s\S]*?)-->/mg, "").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm, "");
    while (Rn = xlmlregex.exec(str)) switch (Rn[3] = Rn[3].replace(/_.*$/, "")) {
      case "table":
      case "\u5DE5\u4F5C\u8868":
        if (Rn[1] === "/") {
          if (range2.e.c >= range2.s.c && range2.e.r >= range2.s.r) ws["!ref"] = encode_range(range2);
          else ws["!ref"] = "A1:A1";
          if (opts.sheetRows > 0 && opts.sheetRows <= range2.e.r) {
            ws["!fullref"] = ws["!ref"];
            range2.e.r = opts.sheetRows - 1;
            ws["!ref"] = encode_range(range2);
          }
          if (merges.length) ws["!merges"] = merges;
          if (rowinfo.length) ws["!rows"] = rowinfo;
          sheetag.name = sheetag["\u540D\u79F0"] || sheetag.name;
          if (typeof JSON !== "undefined") JSON.stringify(sheetag);
          SheetNames.push(sheetag.name);
          Sheets[sheetag.name] = ws;
          intable = false;
        } else if (Rn[0].charAt(Rn[0].length - 2) !== "/") {
          sheetag = parsexmltag(Rn[0], false);
          R = C = -1;
          range2.s.r = range2.s.c = 1e7;
          range2.e.r = range2.e.c = 0;
          ws = opts.dense ? [] : {};
          merges = [];
          rowinfo = [];
          intable = true;
        }
        break;
      case "table-row-group":
        if (Rn[1] === "/") --row_ol;
        else ++row_ol;
        break;
      case "table-row":
      case "\u884C":
        if (Rn[1] === "/") {
          R += rowpeat;
          rowpeat = 1;
          break;
        }
        rowtag = parsexmltag(Rn[0], false);
        if (rowtag["\u884C\u53F7"]) R = rowtag["\u884C\u53F7"] - 1;
        else if (R == -1) R = 0;
        rowpeat = +rowtag["number-rows-repeated"] || 1;
        if (rowpeat < 10) {
          for (i = 0; i < rowpeat; ++i) if (row_ol > 0) rowinfo[R + i] = { level: row_ol };
        }
        C = -1;
        break;
      case "covered-table-cell":
        if (Rn[1] !== "/") ++C;
        if (opts.sheetStubs) {
          if (opts.dense) {
            if (!ws[R]) ws[R] = [];
            ws[R][C] = { t: "z" };
          } else ws[encode_cell({ r: R, c: C })] = { t: "z" };
        }
        textp = "";
        textR = [];
        break;
      /* stub */
      case "table-cell":
      case "\u6570\u636E":
        if (Rn[0].charAt(Rn[0].length - 2) === "/") {
          ++C;
          ctag = parsexmltag(Rn[0], false);
          colpeat = parseInt(ctag["number-columns-repeated"] || "1", 10);
          q = {
            t: "z",
            v: null
            /*:: , z:null, w:"",c:[]*/
          };
          if (ctag.formula && opts.cellFormula != false) q.f = ods_to_csf_formula(unescapexml(ctag.formula));
          if ((ctag["\u6570\u636E\u7C7B\u578B"] || ctag["value-type"]) == "string") {
            q.t = "s";
            q.v = unescapexml(ctag["string-value"] || "");
            if (opts.dense) {
              if (!ws[R]) ws[R] = [];
              ws[R][C] = q;
            } else {
              ws[encode_cell({ r: R, c: C })] = q;
            }
          }
          C += colpeat - 1;
        } else if (Rn[1] !== "/") {
          ++C;
          textp = "";
          textpidx = 0;
          textR = [];
          colpeat = 1;
          var rptR = rowpeat ? R + rowpeat - 1 : R;
          if (C > range2.e.c) range2.e.c = C;
          if (C < range2.s.c) range2.s.c = C;
          if (R < range2.s.r) range2.s.r = R;
          if (rptR > range2.e.r) range2.e.r = rptR;
          ctag = parsexmltag(Rn[0], false);
          comments = [];
          comment = {};
          q = {
            t: ctag["\u6570\u636E\u7C7B\u578B"] || ctag["value-type"],
            v: null
            /*:: , z:null, w:"",c:[]*/
          };
          if (opts.cellFormula) {
            if (ctag.formula) ctag.formula = unescapexml(ctag.formula);
            if (ctag["number-matrix-columns-spanned"] && ctag["number-matrix-rows-spanned"]) {
              mR = parseInt(ctag["number-matrix-rows-spanned"], 10) || 0;
              mC = parseInt(ctag["number-matrix-columns-spanned"], 10) || 0;
              mrange = { s: { r: R, c: C }, e: { r: R + mR - 1, c: C + mC - 1 } };
              q.F = encode_range(mrange);
              arrayf.push([mrange, q.F]);
            }
            if (ctag.formula) q.f = ods_to_csf_formula(ctag.formula);
            else for (i = 0; i < arrayf.length; ++i)
              if (R >= arrayf[i][0].s.r && R <= arrayf[i][0].e.r) {
                if (C >= arrayf[i][0].s.c && C <= arrayf[i][0].e.c)
                  q.F = arrayf[i][1];
              }
          }
          if (ctag["number-columns-spanned"] || ctag["number-rows-spanned"]) {
            mR = parseInt(ctag["number-rows-spanned"], 10) || 0;
            mC = parseInt(ctag["number-columns-spanned"], 10) || 0;
            mrange = { s: { r: R, c: C }, e: { r: R + mR - 1, c: C + mC - 1 } };
            merges.push(mrange);
          }
          if (ctag["number-columns-repeated"]) colpeat = parseInt(ctag["number-columns-repeated"], 10);
          switch (q.t) {
            case "boolean":
              q.t = "b";
              q.v = parsexmlbool(ctag["boolean-value"]);
              break;
            case "float":
              q.t = "n";
              q.v = parseFloat(ctag.value);
              break;
            case "percentage":
              q.t = "n";
              q.v = parseFloat(ctag.value);
              break;
            case "currency":
              q.t = "n";
              q.v = parseFloat(ctag.value);
              break;
            case "date":
              q.t = "d";
              q.v = parseDate(ctag["date-value"]);
              if (!opts.cellDates) {
                q.t = "n";
                q.v = datenum(q.v);
              }
              q.z = "m/d/yy";
              break;
            case "time":
              q.t = "n";
              q.v = parse_isodur(ctag["time-value"]) / 86400;
              if (opts.cellDates) {
                q.t = "d";
                q.v = numdate(q.v);
              }
              q.z = "HH:MM:SS";
              break;
            case "number":
              q.t = "n";
              q.v = parseFloat(ctag["\u6570\u636E\u6570\u503C"]);
              break;
            default:
              if (q.t === "string" || q.t === "text" || !q.t) {
                q.t = "s";
                if (ctag["string-value"] != null) {
                  textp = unescapexml(ctag["string-value"]);
                  textR = [];
                }
              } else throw new Error("Unsupported value type " + q.t);
          }
        } else {
          isstub = false;
          if (q.t === "s") {
            q.v = textp || "";
            if (textR.length) q.R = textR;
            isstub = textpidx == 0;
          }
          if (atag.Target) q.l = atag;
          if (comments.length > 0) {
            q.c = comments;
            comments = [];
          }
          if (textp && opts.cellText !== false) q.w = textp;
          if (isstub) {
            q.t = "z";
            delete q.v;
          }
          if (!isstub || opts.sheetStubs) {
            if (!(opts.sheetRows && opts.sheetRows <= R)) {
              for (var rpt = 0; rpt < rowpeat; ++rpt) {
                colpeat = parseInt(ctag["number-columns-repeated"] || "1", 10);
                if (opts.dense) {
                  if (!ws[R + rpt]) ws[R + rpt] = [];
                  ws[R + rpt][C] = rpt == 0 ? q : dup(q);
                  while (--colpeat > 0) ws[R + rpt][C + colpeat] = dup(q);
                } else {
                  ws[encode_cell({ r: R + rpt, c: C })] = q;
                  while (--colpeat > 0) ws[encode_cell({ r: R + rpt, c: C + colpeat })] = dup(q);
                }
                if (range2.e.c <= C) range2.e.c = C;
              }
            }
          }
          colpeat = parseInt(ctag["number-columns-repeated"] || "1", 10);
          C += colpeat - 1;
          colpeat = 0;
          q = {
            /*:: t:"", v:null, z:null, w:"",c:[]*/
          };
          textp = "";
          textR = [];
        }
        atag = {};
        break;
      // 9.1.4 <table:table-cell>
      /* pure state */
      case "document":
      // TODO: <office:document> is the root for FODS
      case "document-content":
      case "\u7535\u5B50\u8868\u683C\u6587\u6863":
      // 3.1.3.2 <office:document-content>
      case "spreadsheet":
      case "\u4E3B\u4F53":
      // 3.7 <office:spreadsheet>
      case "scripts":
      // 3.12 <office:scripts>
      case "styles":
      // TODO <office:styles>
      case "font-face-decls":
      // 3.14 <office:font-face-decls>
      case "master-styles":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw "Bad state: " + tmp;
        } else if (Rn[0].charAt(Rn[0].length - 2) !== "/") state.push([Rn[3], true]);
        break;
      case "annotation":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw "Bad state: " + tmp;
          comment.t = textp;
          if (textR.length) comment.R = textR;
          comment.a = creator;
          comments.push(comment);
        } else if (Rn[0].charAt(Rn[0].length - 2) !== "/") {
          state.push([Rn[3], false]);
        }
        creator = "";
        creatoridx = 0;
        textp = "";
        textpidx = 0;
        textR = [];
        break;
      case "creator":
        if (Rn[1] === "/") {
          creator = str.slice(creatoridx, Rn.index);
        } else creatoridx = Rn.index + Rn[0].length;
        break;
      /* ignore state */
      case "meta":
      case "\u5143\u6570\u636E":
      // TODO: <office:meta> <uof:元数据> FODS/UOF
      case "settings":
      // TODO: <office:settings>
      case "config-item-set":
      // TODO: <office:config-item-set>
      case "config-item-map-indexed":
      // TODO: <office:config-item-map-indexed>
      case "config-item-map-entry":
      // TODO: <office:config-item-map-entry>
      case "config-item-map-named":
      // TODO: <office:config-item-map-entry>
      case "shapes":
      // 9.2.8 <table:shapes>
      case "frame":
      // 10.4.2 <draw:frame>
      case "text-box":
      // 10.4.3 <draw:text-box>
      case "image":
      // 10.4.4 <draw:image>
      case "data-pilot-tables":
      // 9.6.2 <table:data-pilot-tables>
      case "list-style":
      // 16.30 <text:list-style>
      case "form":
      // 13.13 <form:form>
      case "dde-links":
      // 9.8 <table:dde-links>
      case "event-listeners":
      // TODO
      case "chart":
        if (Rn[1] === "/") {
          if ((tmp = state.pop())[0] !== Rn[3]) throw "Bad state: " + tmp;
        } else if (Rn[0].charAt(Rn[0].length - 2) !== "/") state.push([Rn[3], false]);
        textp = "";
        textpidx = 0;
        textR = [];
        break;
      case "scientific-number":
        break;
      case "currency-symbol":
        break;
      case "currency-style":
        break;
      case "number-style":
      // 16.27.2 <number:number-style>
      case "percentage-style":
      // 16.27.9 <number:percentage-style>
      case "date-style":
      // 16.27.10 <number:date-style>
      case "time-style":
        if (Rn[1] === "/") {
          number_format_map[NFtag.name] = NF;
          if ((tmp = state.pop())[0] !== Rn[3]) throw "Bad state: " + tmp;
        } else if (Rn[0].charAt(Rn[0].length - 2) !== "/") {
          NF = "";
          NFtag = parsexmltag(Rn[0], false);
          state.push([Rn[3], true]);
        }
        break;
      case "script":
        break;
      // 3.13 <office:script>
      case "libraries":
        break;
      // TODO: <ooo:libraries>
      case "automatic-styles":
        break;
      // 3.15.3 <office:automatic-styles>
      case "default-style":
      // TODO: <style:default-style>
      case "page-layout":
        break;
      // TODO: <style:page-layout>
      case "style":
        break;
      case "map":
        break;
      // 16.3 <style:map>
      case "font-face":
        break;
      // 16.21 <style:font-face>
      case "paragraph-properties":
        break;
      // 17.6 <style:paragraph-properties>
      case "table-properties":
        break;
      // 17.15 <style:table-properties>
      case "table-column-properties":
        break;
      // 17.16 <style:table-column-properties>
      case "table-row-properties":
        break;
      // 17.17 <style:table-row-properties>
      case "table-cell-properties":
        break;
      // 17.18 <style:table-cell-properties>
      case "number":
        switch (state[state.length - 1][0]) {
          case "time-style":
          case "date-style":
            tag = parsexmltag(Rn[0], false);
            NF += number_formats_ods[Rn[3]][tag.style === "long" ? 1 : 0];
            break;
        }
        break;
      case "fraction":
        break;
      // TODO 16.27.6 <number:fraction>
      case "day":
      // 16.27.11 <number:day>
      case "month":
      // 16.27.12 <number:month>
      case "year":
      // 16.27.13 <number:year>
      case "era":
      // 16.27.14 <number:era>
      case "day-of-week":
      // 16.27.15 <number:day-of-week>
      case "week-of-year":
      // 16.27.16 <number:week-of-year>
      case "quarter":
      // 16.27.17 <number:quarter>
      case "hours":
      // 16.27.19 <number:hours>
      case "minutes":
      // 16.27.20 <number:minutes>
      case "seconds":
      // 16.27.21 <number:seconds>
      case "am-pm":
        switch (state[state.length - 1][0]) {
          case "time-style":
          case "date-style":
            tag = parsexmltag(Rn[0], false);
            NF += number_formats_ods[Rn[3]][tag.style === "long" ? 1 : 0];
            break;
        }
        break;
      case "boolean-style":
        break;
      // 16.27.23 <number:boolean-style>
      case "boolean":
        break;
      // 16.27.24 <number:boolean>
      case "text-style":
        break;
      // 16.27.25 <number:text-style>
      case "text":
        if (Rn[0].slice(-2) === "/>") break;
        else if (Rn[1] === "/") switch (state[state.length - 1][0]) {
          case "number-style":
          case "date-style":
          case "time-style":
            NF += str.slice(pidx, Rn.index);
            break;
        }
        else pidx = Rn.index + Rn[0].length;
        break;
      case "named-range":
        tag = parsexmltag(Rn[0], false);
        _Ref = ods_to_csf_3D(tag["cell-range-address"]);
        var nrange = { Name: tag.name, Ref: _Ref[0] + "!" + _Ref[1] };
        if (intable) nrange.Sheet = SheetNames.length;
        WB.Names.push(nrange);
        break;
      case "text-content":
        break;
      // 16.27.27 <number:text-content>
      case "text-properties":
        break;
      // 16.27.27 <style:text-properties>
      case "embedded-text":
        break;
      // 16.27.4 <number:embedded-text>
      case "body":
      case "\u7535\u5B50\u8868\u683C":
        break;
      // 3.3 16.9.6 19.726.3
      case "forms":
        break;
      // 12.25.2 13.2
      case "table-column":
        break;
      // 9.1.6 <table:table-column>
      case "table-header-rows":
        break;
      // 9.1.7 <table:table-header-rows>
      case "table-rows":
        break;
      // 9.1.12 <table:table-rows>
      /* TODO: outline levels */
      case "table-column-group":
        break;
      // 9.1.10 <table:table-column-group>
      case "table-header-columns":
        break;
      // 9.1.11 <table:table-header-columns>
      case "table-columns":
        break;
      // 9.1.12 <table:table-columns>
      case "null-date":
        break;
      // 9.4.2 <table:null-date> TODO: date1904
      case "graphic-properties":
        break;
      // 17.21 <style:graphic-properties>
      case "calculation-settings":
        break;
      // 9.4.1 <table:calculation-settings>
      case "named-expressions":
        break;
      // 9.4.11 <table:named-expressions>
      case "label-range":
        break;
      // 9.4.9 <table:label-range>
      case "label-ranges":
        break;
      // 9.4.10 <table:label-ranges>
      case "named-expression":
        break;
      // 9.4.13 <table:named-expression>
      case "sort":
        break;
      // 9.4.19 <table:sort>
      case "sort-by":
        break;
      // 9.4.20 <table:sort-by>
      case "sort-groups":
        break;
      // 9.4.22 <table:sort-groups>
      case "tab":
        break;
      // 6.1.4 <text:tab>
      case "line-break":
        break;
      // 6.1.5 <text:line-break>
      case "span":
        break;
      // 6.1.7 <text:span>
      case "p":
      case "\u6587\u672C\u4E32":
        if (["master-styles"].indexOf(state[state.length - 1][0]) > -1) break;
        if (Rn[1] === "/" && (!ctag || !ctag["string-value"])) {
          var ptp = parse_text_p(str.slice(textpidx, Rn.index), textptag);
          textp = (textp.length > 0 ? textp + "\n" : "") + ptp[0];
        } else {
          textptag = parsexmltag(Rn[0], false);
          textpidx = Rn.index + Rn[0].length;
        }
        break;
      // <text:p>
      case "s":
        break;
      // <text:s>
      case "database-range":
        if (Rn[1] === "/") break;
        try {
          _Ref = ods_to_csf_3D(parsexmltag(Rn[0])["target-range-address"]);
          Sheets[_Ref[0]]["!autofilter"] = { ref: _Ref[1] };
        } catch (e) {
        }
        break;
      case "date":
        break;
      // <*:date>
      case "object":
        break;
      // 10.4.6.2 <draw:object>
      case "title":
      case "\u6807\u9898":
        break;
      // <*:title> OR <uof:标题>
      case "desc":
        break;
      // <*:desc>
      case "binary-data":
        break;
      // 10.4.5 TODO: b64 blob
      /* 9.2 Advanced Tables */
      case "table-source":
        break;
      // 9.2.6
      case "scenario":
        break;
      // 9.2.6
      case "iteration":
        break;
      // 9.4.3 <table:iteration>
      case "content-validations":
        break;
      // 9.4.4 <table:
      case "content-validation":
        break;
      // 9.4.5 <table:
      case "help-message":
        break;
      // 9.4.6 <table:
      case "error-message":
        break;
      // 9.4.7 <table:
      case "database-ranges":
        break;
      // 9.4.14 <table:database-ranges>
      case "filter":
        break;
      // 9.5.2 <table:filter>
      case "filter-and":
        break;
      // 9.5.3 <table:filter-and>
      case "filter-or":
        break;
      // 9.5.4 <table:filter-or>
      case "filter-condition":
        break;
      // 9.5.5 <table:filter-condition>
      case "list-level-style-bullet":
        break;
      // 16.31 <text:
      case "list-level-style-number":
        break;
      // 16.32 <text:
      case "list-level-properties":
        break;
      // 17.19 <style:
      /* 7.3 Document Fields */
      case "sender-firstname":
      // 7.3.6.2
      case "sender-lastname":
      // 7.3.6.3
      case "sender-initials":
      // 7.3.6.4
      case "sender-title":
      // 7.3.6.5
      case "sender-position":
      // 7.3.6.6
      case "sender-email":
      // 7.3.6.7
      case "sender-phone-private":
      // 7.3.6.8
      case "sender-fax":
      // 7.3.6.9
      case "sender-company":
      // 7.3.6.10
      case "sender-phone-work":
      // 7.3.6.11
      case "sender-street":
      // 7.3.6.12
      case "sender-city":
      // 7.3.6.13
      case "sender-postal-code":
      // 7.3.6.14
      case "sender-country":
      // 7.3.6.15
      case "sender-state-or-province":
      // 7.3.6.16
      case "author-name":
      // 7.3.7.1
      case "author-initials":
      // 7.3.7.2
      case "chapter":
      // 7.3.8
      case "file-name":
      // 7.3.9
      case "template-name":
      // 7.3.9
      case "sheet-name":
        break;
      case "event-listener":
        break;
      /* TODO: FODS Properties */
      case "initial-creator":
      case "creation-date":
      case "print-date":
      case "generator":
      case "document-statistic":
      case "user-defined":
      case "editing-duration":
      case "editing-cycles":
        break;
      /* TODO: FODS Config */
      case "config-item":
        break;
      /* TODO: style tokens */
      case "page-number":
        break;
      // TODO <text:page-number>
      case "page-count":
        break;
      // TODO <text:page-count>
      case "time":
        break;
      // TODO <text:time>
      /* 9.3 Advanced Table Cells */
      case "cell-range-source":
        break;
      // 9.3.1 <table:
      case "detective":
        break;
      // 9.3.2 <table:
      case "operation":
        break;
      // 9.3.3 <table:
      case "highlighted-range":
        break;
      // 9.3.4 <table:
      /* 9.6 Data Pilot Tables <table: */
      case "data-pilot-table":
      // 9.6.3
      case "source-cell-range":
      // 9.6.5
      case "source-service":
      // 9.6.6
      case "data-pilot-field":
      // 9.6.7
      case "data-pilot-level":
      // 9.6.8
      case "data-pilot-subtotals":
      // 9.6.9
      case "data-pilot-subtotal":
      // 9.6.10
      case "data-pilot-members":
      // 9.6.11
      case "data-pilot-member":
      // 9.6.12
      case "data-pilot-display-info":
      // 9.6.13
      case "data-pilot-sort-info":
      // 9.6.14
      case "data-pilot-layout-info":
      // 9.6.15
      case "data-pilot-field-reference":
      // 9.6.16
      case "data-pilot-groups":
      // 9.6.17
      case "data-pilot-group":
      // 9.6.18
      case "data-pilot-group-member":
        break;
      /* 10.3 Drawing Shapes */
      case "rect":
        break;
      /* 14.6 DDE Connections */
      case "dde-connection-decls":
      // 14.6.2 <text:
      case "dde-connection-decl":
      // 14.6.3 <text:
      case "dde-link":
      // 14.6.4 <table:
      case "dde-source":
        break;
      case "properties":
        break;
      // 13.7 <form:properties>
      case "property":
        break;
      // 13.8 <form:property>
      case "a":
        if (Rn[1] !== "/") {
          atag = parsexmltag(Rn[0], false);
          if (!atag.href) break;
          atag.Target = unescapexml(atag.href);
          delete atag.href;
          if (atag.Target.charAt(0) == "#" && atag.Target.indexOf(".") > -1) {
            _Ref = ods_to_csf_3D(atag.Target.slice(1));
            atag.Target = "#" + _Ref[0] + "!" + _Ref[1];
          } else if (atag.Target.match(/^\.\.[\\\/]/)) atag.Target = atag.Target.slice(3);
        }
        break;
      /* non-standard */
      case "table-protection":
        break;
      case "data-pilot-grand-total":
        break;
      // <table:
      case "office-document-common-attrs":
        break;
      // bare
      default:
        switch (Rn[2]) {
          case "dc:":
          // TODO: properties
          case "calcext:":
          // ignore undocumented extensions
          case "loext:":
          // ignore undocumented extensions
          case "ooo:":
          // ignore undocumented extensions
          case "chartooo:":
          // ignore undocumented extensions
          case "draw:":
          // TODO: drawing
          case "style:":
          // TODO: styles
          case "chart:":
          // TODO: charts
          case "form:":
          // TODO: forms
          case "uof:":
          // TODO: uof
          case "\u8868:":
          // TODO: uof
          case "\u5B57:":
            break;
          default:
            if (opts.WTF) throw new Error(Rn);
        }
    }
    var out = {
      Sheets,
      SheetNames,
      Workbook: WB
    };
    if (opts.bookSheets) delete /*::(*/
    out.Sheets;
    return out;
  }
  function parse_ods(zip, opts) {
    opts = opts || {};
    if (safegetzipfile(zip, "META-INF/manifest.xml")) parse_manifest(getzipdata(zip, "META-INF/manifest.xml"), opts);
    var content = getzipstr(zip, "content.xml");
    if (!content) throw new Error("Missing content.xml in ODS / UOF file");
    var wb = parse_content_xml(utf8read(content), opts);
    if (safegetzipfile(zip, "meta.xml")) wb.Props = parse_core_props(getzipdata(zip, "meta.xml"));
    return wb;
  }
  function parse_fods(data, opts) {
    return parse_content_xml(data, opts);
  }
  function u8_to_dataview(array) {
    return new DataView(array.buffer, array.byteOffset, array.byteLength);
  }
  function u8str(u8) {
    return typeof TextDecoder != "undefined" ? new TextDecoder().decode(u8) : utf8read(a2s(u8));
  }
  function u8concat(u8a) {
    var len = u8a.reduce(function(acc, x) {
      return acc + x.length;
    }, 0);
    var out = new Uint8Array(len);
    var off = 0;
    u8a.forEach(function(u8) {
      out.set(u8, off);
      off += u8.length;
    });
    return out;
  }
  function popcnt(x) {
    x -= x >> 1 & 1431655765;
    x = (x & 858993459) + (x >> 2 & 858993459);
    return (x + (x >> 4) & 252645135) * 16843009 >>> 24;
  }
  function readDecimal128LE(buf, offset) {
    var exp = (buf[offset + 15] & 127) << 7 | buf[offset + 14] >> 1;
    var mantissa = buf[offset + 14] & 1;
    for (var j = offset + 13; j >= offset; --j)
      mantissa = mantissa * 256 + buf[j];
    return (buf[offset + 15] & 128 ? -mantissa : mantissa) * Math.pow(10, exp - 6176);
  }
  function parse_varint49(buf, ptr) {
    var l2 = ptr ? ptr[0] : 0;
    var usz = buf[l2] & 127;
    varint:
      if (buf[l2++] >= 128) {
        usz |= (buf[l2] & 127) << 7;
        if (buf[l2++] < 128)
          break varint;
        usz |= (buf[l2] & 127) << 14;
        if (buf[l2++] < 128)
          break varint;
        usz |= (buf[l2] & 127) << 21;
        if (buf[l2++] < 128)
          break varint;
        usz += (buf[l2] & 127) * Math.pow(2, 28);
        ++l2;
        if (buf[l2++] < 128)
          break varint;
        usz += (buf[l2] & 127) * Math.pow(2, 35);
        ++l2;
        if (buf[l2++] < 128)
          break varint;
        usz += (buf[l2] & 127) * Math.pow(2, 42);
        ++l2;
        if (buf[l2++] < 128)
          break varint;
      }
    if (ptr)
      ptr[0] = l2;
    return usz;
  }
  function varint_to_i32(buf) {
    var l2 = 0, i32 = buf[l2] & 127;
    varint:
      if (buf[l2++] >= 128) {
        i32 |= (buf[l2] & 127) << 7;
        if (buf[l2++] < 128)
          break varint;
        i32 |= (buf[l2] & 127) << 14;
        if (buf[l2++] < 128)
          break varint;
        i32 |= (buf[l2] & 127) << 21;
        if (buf[l2++] < 128)
          break varint;
        i32 |= (buf[l2] & 127) << 28;
      }
    return i32;
  }
  function parse_shallow(buf) {
    var out = [], ptr = [0];
    while (ptr[0] < buf.length) {
      var off = ptr[0];
      var num = parse_varint49(buf, ptr);
      var type = num & 7;
      num = Math.floor(num / 8);
      var len = 0;
      var res;
      if (num == 0)
        break;
      switch (type) {
        case 0:
          {
            var l2 = ptr[0];
            while (buf[ptr[0]++] >= 128)
              ;
            res = buf.slice(l2, ptr[0]);
          }
          break;
        case 5:
          len = 4;
          res = buf.slice(ptr[0], ptr[0] + len);
          ptr[0] += len;
          break;
        case 1:
          len = 8;
          res = buf.slice(ptr[0], ptr[0] + len);
          ptr[0] += len;
          break;
        case 2:
          len = parse_varint49(buf, ptr);
          res = buf.slice(ptr[0], ptr[0] + len);
          ptr[0] += len;
          break;
        case 3:
        case 4:
        default:
          throw new Error("PB Type ".concat(type, " for Field ").concat(num, " at offset ").concat(off));
      }
      var v = { data: res, type };
      if (out[num] == null)
        out[num] = [v];
      else
        out[num].push(v);
    }
    return out;
  }
  function mappa(data, cb2) {
    return (data == null ? void 0 : data.map(function(d) {
      return cb2(d.data);
    })) || [];
  }
  function parse_iwa_file(buf) {
    var _a;
    var out = [], ptr = [0];
    while (ptr[0] < buf.length) {
      var len = parse_varint49(buf, ptr);
      var ai = parse_shallow(buf.slice(ptr[0], ptr[0] + len));
      ptr[0] += len;
      var res = {
        id: varint_to_i32(ai[1][0].data),
        messages: []
      };
      ai[2].forEach(function(b) {
        var mi = parse_shallow(b.data);
        var fl = varint_to_i32(mi[3][0].data);
        res.messages.push({
          meta: mi,
          data: buf.slice(ptr[0], ptr[0] + fl)
        });
        ptr[0] += fl;
      });
      if ((_a = ai[3]) == null ? void 0 : _a[0])
        res.merge = varint_to_i32(ai[3][0].data) >>> 0 > 0;
      out.push(res);
    }
    return out;
  }
  function parse_snappy_chunk(type, buf) {
    if (type != 0)
      throw new Error("Unexpected Snappy chunk type ".concat(type));
    var ptr = [0];
    var usz = parse_varint49(buf, ptr);
    var chunks = [];
    while (ptr[0] < buf.length) {
      var tag = buf[ptr[0]] & 3;
      if (tag == 0) {
        var len = buf[ptr[0]++] >> 2;
        if (len < 60)
          ++len;
        else {
          var c = len - 59;
          len = buf[ptr[0]];
          if (c > 1)
            len |= buf[ptr[0] + 1] << 8;
          if (c > 2)
            len |= buf[ptr[0] + 2] << 16;
          if (c > 3)
            len |= buf[ptr[0] + 3] << 24;
          len >>>= 0;
          len++;
          ptr[0] += c;
        }
        chunks.push(buf.slice(ptr[0], ptr[0] + len));
        ptr[0] += len;
        continue;
      } else {
        var offset = 0, length = 0;
        if (tag == 1) {
          length = (buf[ptr[0]] >> 2 & 7) + 4;
          offset = (buf[ptr[0]++] & 224) << 3;
          offset |= buf[ptr[0]++];
        } else {
          length = (buf[ptr[0]++] >> 2) + 1;
          if (tag == 2) {
            offset = buf[ptr[0]] | buf[ptr[0] + 1] << 8;
            ptr[0] += 2;
          } else {
            offset = (buf[ptr[0]] | buf[ptr[0] + 1] << 8 | buf[ptr[0] + 2] << 16 | buf[ptr[0] + 3] << 24) >>> 0;
            ptr[0] += 4;
          }
        }
        chunks = [u8concat(chunks)];
        if (offset == 0)
          throw new Error("Invalid offset 0");
        if (offset > chunks[0].length)
          throw new Error("Invalid offset beyond length");
        if (length >= offset) {
          chunks.push(chunks[0].slice(-offset));
          length -= offset;
          while (length >= chunks[chunks.length - 1].length) {
            chunks.push(chunks[chunks.length - 1]);
            length -= chunks[chunks.length - 1].length;
          }
        }
        chunks.push(chunks[0].slice(-offset, -offset + length));
      }
    }
    var o = u8concat(chunks);
    if (o.length != usz)
      throw new Error("Unexpected length: ".concat(o.length, " != ").concat(usz));
    return o;
  }
  function decompress_iwa_file(buf) {
    var out = [];
    var l2 = 0;
    while (l2 < buf.length) {
      var t = buf[l2++];
      var len = buf[l2] | buf[l2 + 1] << 8 | buf[l2 + 2] << 16;
      l2 += 3;
      out.push(parse_snappy_chunk(t, buf.slice(l2, l2 + len)));
      l2 += len;
    }
    if (l2 !== buf.length)
      throw new Error("data is not a valid framed stream!");
    return u8concat(out);
  }
  function parse_old_storage(buf, sst, rsst, v) {
    var dv = u8_to_dataview(buf);
    var flags = dv.getUint32(4, true);
    var data_offset = (v > 1 ? 12 : 8) + popcnt(flags & (v > 1 ? 3470 : 398)) * 4;
    var ridx = -1, sidx = -1, ieee = NaN, dt = new Date(2001, 0, 1);
    if (flags & 512) {
      ridx = dv.getUint32(data_offset, true);
      data_offset += 4;
    }
    data_offset += popcnt(flags & (v > 1 ? 12288 : 4096)) * 4;
    if (flags & 16) {
      sidx = dv.getUint32(data_offset, true);
      data_offset += 4;
    }
    if (flags & 32) {
      ieee = dv.getFloat64(data_offset, true);
      data_offset += 8;
    }
    if (flags & 64) {
      dt.setTime(dt.getTime() + dv.getFloat64(data_offset, true) * 1e3);
      data_offset += 8;
    }
    var ret2;
    switch (buf[2]) {
      case 0:
        break;
      case 2:
        ret2 = { t: "n", v: ieee };
        break;
      case 3:
        ret2 = { t: "s", v: sst[sidx] };
        break;
      case 5:
        ret2 = { t: "d", v: dt };
        break;
      case 6:
        ret2 = { t: "b", v: ieee > 0 };
        break;
      case 7:
        ret2 = { t: "n", v: ieee / 86400 };
        break;
      case 8:
        ret2 = { t: "e", v: 0 };
        break;
      case 9:
        {
          if (ridx > -1)
            ret2 = { t: "s", v: rsst[ridx] };
          else if (sidx > -1)
            ret2 = { t: "s", v: sst[sidx] };
          else if (!isNaN(ieee))
            ret2 = { t: "n", v: ieee };
          else
            throw new Error("Unsupported cell type ".concat(buf.slice(0, 4)));
        }
        break;
      default:
        throw new Error("Unsupported cell type ".concat(buf.slice(0, 4)));
    }
    return ret2;
  }
  function parse_new_storage(buf, sst, rsst) {
    var dv = u8_to_dataview(buf);
    var flags = dv.getUint32(8, true);
    var data_offset = 12;
    var ridx = -1, sidx = -1, d128 = NaN, ieee = NaN, dt = new Date(2001, 0, 1);
    if (flags & 1) {
      d128 = readDecimal128LE(buf, data_offset);
      data_offset += 16;
    }
    if (flags & 2) {
      ieee = dv.getFloat64(data_offset, true);
      data_offset += 8;
    }
    if (flags & 4) {
      dt.setTime(dt.getTime() + dv.getFloat64(data_offset, true) * 1e3);
      data_offset += 8;
    }
    if (flags & 8) {
      sidx = dv.getUint32(data_offset, true);
      data_offset += 4;
    }
    if (flags & 16) {
      ridx = dv.getUint32(data_offset, true);
      data_offset += 4;
    }
    var ret2;
    switch (buf[1]) {
      case 0:
        break;
      case 2:
        ret2 = { t: "n", v: d128 };
        break;
      case 3:
        ret2 = { t: "s", v: sst[sidx] };
        break;
      case 5:
        ret2 = { t: "d", v: dt };
        break;
      case 6:
        ret2 = { t: "b", v: ieee > 0 };
        break;
      case 7:
        ret2 = { t: "n", v: ieee / 86400 };
        break;
      case 8:
        ret2 = { t: "e", v: 0 };
        break;
      case 9:
        {
          if (ridx > -1)
            ret2 = { t: "s", v: rsst[ridx] };
          else
            throw new Error("Unsupported cell type ".concat(buf[1], " : ").concat(flags & 31, " : ").concat(buf.slice(0, 4)));
        }
        break;
      case 10:
        ret2 = { t: "n", v: d128 };
        break;
      default:
        throw new Error("Unsupported cell type ".concat(buf[1], " : ").concat(flags & 31, " : ").concat(buf.slice(0, 4)));
    }
    return ret2;
  }
  function parse_cell_storage(buf, sst, rsst) {
    switch (buf[0]) {
      case 0:
      case 1:
      case 2:
      case 3:
        return parse_old_storage(buf, sst, rsst, buf[0]);
      case 5:
        return parse_new_storage(buf, sst, rsst);
      default:
        throw new Error("Unsupported payload version ".concat(buf[0]));
    }
  }
  function parse_TSP_Reference(buf) {
    var pb = parse_shallow(buf);
    return parse_varint49(pb[1][0].data);
  }
  function parse_TST_TableDataList(M, root3) {
    var pb = parse_shallow(root3.data);
    var type = varint_to_i32(pb[1][0].data);
    var entries = pb[3];
    var data = [];
    (entries || []).forEach(function(entry) {
      var le = parse_shallow(entry.data);
      var key = varint_to_i32(le[1][0].data) >>> 0;
      switch (type) {
        case 1:
          data[key] = u8str(le[3][0].data);
          break;
        case 8:
          {
            var rt = M[parse_TSP_Reference(le[9][0].data)][0];
            var rtp = parse_shallow(rt.data);
            var rtpref = M[parse_TSP_Reference(rtp[1][0].data)][0];
            var mtype = varint_to_i32(rtpref.meta[1][0].data);
            if (mtype != 2001)
              throw new Error("2000 unexpected reference to ".concat(mtype));
            var tswpsa = parse_shallow(rtpref.data);
            data[key] = tswpsa[3].map(function(x) {
              return u8str(x.data);
            }).join("");
          }
          break;
      }
    });
    return data;
  }
  function parse_TST_TileRowInfo(u8, type) {
    var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
    var pb = parse_shallow(u8);
    var R = varint_to_i32(pb[1][0].data) >>> 0;
    var cnt = varint_to_i32(pb[2][0].data) >>> 0;
    var wide_offsets = ((_b = (_a = pb[8]) == null ? void 0 : _a[0]) == null ? void 0 : _b.data) && varint_to_i32(pb[8][0].data) > 0 || false;
    var used_storage_u8, used_storage;
    if (((_d = (_c = pb[7]) == null ? void 0 : _c[0]) == null ? void 0 : _d.data) && type != 0) {
      used_storage_u8 = (_f = (_e = pb[7]) == null ? void 0 : _e[0]) == null ? void 0 : _f.data;
      used_storage = (_h = (_g = pb[6]) == null ? void 0 : _g[0]) == null ? void 0 : _h.data;
    } else if (((_j = (_i = pb[4]) == null ? void 0 : _i[0]) == null ? void 0 : _j.data) && type != 1) {
      used_storage_u8 = (_l = (_k = pb[4]) == null ? void 0 : _k[0]) == null ? void 0 : _l.data;
      used_storage = (_n = (_m = pb[3]) == null ? void 0 : _m[0]) == null ? void 0 : _n.data;
    } else
      throw "NUMBERS Tile missing ".concat(type, " cell storage");
    var width = wide_offsets ? 4 : 1;
    var used_storage_offsets = u8_to_dataview(used_storage_u8);
    var offsets = [];
    for (var C = 0; C < used_storage_u8.length / 2; ++C) {
      var off = used_storage_offsets.getUint16(C * 2, true);
      if (off < 65535)
        offsets.push([C, off]);
    }
    if (offsets.length != cnt)
      throw "Expected ".concat(cnt, " cells, found ").concat(offsets.length);
    var cells = [];
    for (C = 0; C < offsets.length - 1; ++C)
      cells[offsets[C][0]] = used_storage.subarray(offsets[C][1] * width, offsets[C + 1][1] * width);
    if (offsets.length >= 1)
      cells[offsets[offsets.length - 1][0]] = used_storage.subarray(offsets[offsets.length - 1][1] * width);
    return { R, cells };
  }
  function parse_TST_Tile(M, root3) {
    var _a;
    var pb = parse_shallow(root3.data);
    var storage = ((_a = pb == null ? void 0 : pb[7]) == null ? void 0 : _a[0]) ? varint_to_i32(pb[7][0].data) >>> 0 > 0 ? 1 : 0 : -1;
    var ri = mappa(pb[5], function(u8) {
      return parse_TST_TileRowInfo(u8, storage);
    });
    return {
      nrows: varint_to_i32(pb[4][0].data) >>> 0,
      data: ri.reduce(function(acc, x) {
        if (!acc[x.R])
          acc[x.R] = [];
        x.cells.forEach(function(cell, C) {
          if (acc[x.R][C])
            throw new Error("Duplicate cell r=".concat(x.R, " c=").concat(C));
          acc[x.R][C] = cell;
        });
        return acc;
      }, [])
    };
  }
  function parse_TST_TableModelArchive(M, root3, ws) {
    var _a;
    var pb = parse_shallow(root3.data);
    var range2 = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } };
    range2.e.r = (varint_to_i32(pb[6][0].data) >>> 0) - 1;
    if (range2.e.r < 0)
      throw new Error("Invalid row varint ".concat(pb[6][0].data));
    range2.e.c = (varint_to_i32(pb[7][0].data) >>> 0) - 1;
    if (range2.e.c < 0)
      throw new Error("Invalid col varint ".concat(pb[7][0].data));
    ws["!ref"] = encode_range(range2);
    var store = parse_shallow(pb[4][0].data);
    var sst = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[4][0].data)][0]);
    var rsst = ((_a = store[17]) == null ? void 0 : _a[0]) ? parse_TST_TableDataList(M, M[parse_TSP_Reference(store[17][0].data)][0]) : [];
    var tile = parse_shallow(store[3][0].data);
    var _R = 0;
    tile[1].forEach(function(t) {
      var tl = parse_shallow(t.data);
      var ref = M[parse_TSP_Reference(tl[2][0].data)][0];
      var mtype = varint_to_i32(ref.meta[1][0].data);
      if (mtype != 6002)
        throw new Error("6001 unexpected reference to ".concat(mtype));
      var _tile = parse_TST_Tile(M, ref);
      _tile.data.forEach(function(row, R) {
        row.forEach(function(buf, C) {
          var addr = encode_cell({ r: _R + R, c: C });
          var res = parse_cell_storage(buf, sst, rsst);
          if (res)
            ws[addr] = res;
        });
      });
      _R += _tile.nrows;
    });
  }
  function parse_TST_TableInfoArchive(M, root3) {
    var pb = parse_shallow(root3.data);
    var out = { "!ref": "A1" };
    var tableref = M[parse_TSP_Reference(pb[2][0].data)];
    var mtype = varint_to_i32(tableref[0].meta[1][0].data);
    if (mtype != 6001)
      throw new Error("6000 unexpected reference to ".concat(mtype));
    parse_TST_TableModelArchive(M, tableref[0], out);
    return out;
  }
  function parse_TN_SheetArchive(M, root3) {
    var _a;
    var pb = parse_shallow(root3.data);
    var out = {
      name: ((_a = pb[1]) == null ? void 0 : _a[0]) ? u8str(pb[1][0].data) : "",
      sheets: []
    };
    var shapeoffs = mappa(pb[2], parse_TSP_Reference);
    shapeoffs.forEach(function(off) {
      M[off].forEach(function(m) {
        var mtype = varint_to_i32(m.meta[1][0].data);
        if (mtype == 6e3)
          out.sheets.push(parse_TST_TableInfoArchive(M, m));
      });
    });
    return out;
  }
  function parse_TN_DocumentArchive(M, root3) {
    var out = book_new();
    var pb = parse_shallow(root3.data);
    var sheetoffs = mappa(pb[1], parse_TSP_Reference);
    sheetoffs.forEach(function(off) {
      M[off].forEach(function(m) {
        var mtype = varint_to_i32(m.meta[1][0].data);
        if (mtype == 2) {
          var root22 = parse_TN_SheetArchive(M, m);
          root22.sheets.forEach(function(sheet, idx) {
            book_append_sheet(out, sheet, idx == 0 ? root22.name : root22.name + "_" + idx, true);
          });
        }
      });
    });
    if (out.SheetNames.length == 0)
      throw new Error("Empty NUMBERS file");
    return out;
  }
  function parse_numbers_iwa(cfb) {
    var _a, _b, _c, _d;
    var M = {}, indices = [];
    cfb.FullPaths.forEach(function(p) {
      if (p.match(/\.iwpv2/))
        throw new Error("Unsupported password protection");
    });
    cfb.FileIndex.forEach(function(s) {
      if (!s.name.match(/\.iwa$/))
        return;
      var o;
      try {
        o = decompress_iwa_file(s.content);
      } catch (e) {
        return console.log("?? " + s.content.length + " " + (e.message || e));
      }
      var packets;
      try {
        packets = parse_iwa_file(o);
      } catch (e) {
        return console.log("## " + (e.message || e));
      }
      packets.forEach(function(packet) {
        M[packet.id] = packet.messages;
        indices.push(packet.id);
      });
    });
    if (!indices.length)
      throw new Error("File has no messages");
    var docroot = ((_d = (_c = (_b = (_a = M == null ? void 0 : M[1]) == null ? void 0 : _a[0]) == null ? void 0 : _b.meta) == null ? void 0 : _c[1]) == null ? void 0 : _d[0].data) && varint_to_i32(M[1][0].meta[1][0].data) == 1 && M[1][0];
    if (!docroot)
      indices.forEach(function(idx) {
        M[idx].forEach(function(iwam) {
          var mtype = varint_to_i32(iwam.meta[1][0].data) >>> 0;
          if (mtype == 1) {
            if (!docroot)
              docroot = iwam;
            else
              throw new Error("Document has multiple roots");
          }
        });
      });
    if (!docroot)
      throw new Error("Cannot find Document root");
    return parse_TN_DocumentArchive(M, docroot);
  }
  function fix_opts_func(defaults) {
    return function fix_opts(opts) {
      for (var i = 0; i != defaults.length; ++i) {
        var d = defaults[i];
        if (opts[d[0]] === void 0) opts[d[0]] = d[1];
        if (d[2] === "n") opts[d[0]] = Number(opts[d[0]]);
      }
    };
  }
  function fix_read_opts(opts) {
    fix_opts_func([
      ["cellNF", false],
      /* emit cell number format string as .z */
      ["cellHTML", true],
      /* emit html string as .h */
      ["cellFormula", true],
      /* emit formulae as .f */
      ["cellStyles", false],
      /* emits style/theme as .s */
      ["cellText", true],
      /* emit formatted text as .w */
      ["cellDates", false],
      /* emit date cells with type `d` */
      ["sheetStubs", false],
      /* emit empty cells */
      ["sheetRows", 0, "n"],
      /* read n rows (0 = read all rows) */
      ["bookDeps", false],
      /* parse calculation chains */
      ["bookSheets", false],
      /* only try to get sheet names (no Sheets) */
      ["bookProps", false],
      /* only try to get properties (no Sheets) */
      ["bookFiles", false],
      /* include raw file structure (keys, files, cfb) */
      ["bookVBA", false],
      /* include vba raw data (vbaraw) */
      ["password", ""],
      /* password */
      ["WTF", false]
      /* WTF mode (throws errors) */
    ])(opts);
  }
  function get_sheet_type(n) {
    if (RELS.WS.indexOf(n) > -1) return "sheet";
    if (RELS.CS && n == RELS.CS) return "chart";
    if (RELS.DS && n == RELS.DS) return "dialog";
    if (RELS.MS && n == RELS.MS) return "macro";
    return n && n.length ? n : "sheet";
  }
  function safe_parse_wbrels(wbrels, sheets) {
    if (!wbrels) return 0;
    try {
      wbrels = sheets.map(function pwbr(w) {
        if (!w.id) w.id = w.strRelID;
        return [w.name, wbrels["!id"][w.id].Target, get_sheet_type(wbrels["!id"][w.id].Type)];
      });
    } catch (e) {
      return null;
    }
    return !wbrels || wbrels.length === 0 ? null : wbrels;
  }
  function safe_parse_sheet(zip, path, relsPath, sheet, idx, sheetRels, sheets, stype, opts, wb, themes, styles) {
    try {
      sheetRels[sheet] = parse_rels(getzipstr(zip, relsPath, true), path);
      var data = getzipdata(zip, path);
      var _ws;
      switch (stype) {
        case "sheet":
          _ws = parse_ws(data, path, idx, opts, sheetRels[sheet], wb, themes, styles);
          break;
        case "chart":
          _ws = parse_cs(data, path, idx, opts, sheetRels[sheet], wb, themes, styles);
          if (!_ws || !_ws["!drawel"]) break;
          var dfile = resolve_path(_ws["!drawel"].Target, path);
          var drelsp = get_rels_path(dfile);
          var draw = parse_drawing(getzipstr(zip, dfile, true), parse_rels(getzipstr(zip, drelsp, true), dfile));
          var chartp = resolve_path(draw, dfile);
          var crelsp = get_rels_path(chartp);
          _ws = parse_chart(getzipstr(zip, chartp, true), chartp, opts, parse_rels(getzipstr(zip, crelsp, true), chartp), wb, _ws);
          break;
        case "macro":
          _ws = parse_ms(data, path, idx, opts, sheetRels[sheet], wb, themes, styles);
          break;
        case "dialog":
          _ws = parse_ds(data, path, idx, opts, sheetRels[sheet], wb, themes, styles);
          break;
        default:
          throw new Error("Unrecognized sheet type " + stype);
      }
      sheets[sheet] = _ws;
      var tcomments = [];
      if (sheetRels && sheetRels[sheet]) keys(sheetRels[sheet]).forEach(function(n) {
        var dfile2 = "";
        if (sheetRels[sheet][n].Type == RELS.CMNT) {
          dfile2 = resolve_path(sheetRels[sheet][n].Target, path);
          var comments = parse_cmnt(getzipdata(zip, dfile2, true), dfile2, opts);
          if (!comments || !comments.length) return;
          sheet_insert_comments(_ws, comments, false);
        }
        if (sheetRels[sheet][n].Type == RELS.TCMNT) {
          dfile2 = resolve_path(sheetRels[sheet][n].Target, path);
          tcomments = tcomments.concat(parse_tcmnt_xml(getzipdata(zip, dfile2, true), opts));
        }
      });
      if (tcomments && tcomments.length) sheet_insert_comments(_ws, tcomments, true, opts.people || []);
    } catch (e) {
      if (opts.WTF) throw e;
    }
  }
  function strip_front_slash(x) {
    return x.charAt(0) == "/" ? x.slice(1) : x;
  }
  function parse_zip(zip, opts) {
    make_ssf();
    opts = opts || {};
    fix_read_opts(opts);
    if (safegetzipfile(zip, "META-INF/manifest.xml")) return parse_ods(zip, opts);
    if (safegetzipfile(zip, "objectdata.xml")) return parse_ods(zip, opts);
    if (safegetzipfile(zip, "Index/Document.iwa")) {
      if (typeof Uint8Array == "undefined") throw new Error("NUMBERS file parsing requires Uint8Array support");
      if (typeof parse_numbers_iwa != "undefined") {
        if (zip.FileIndex) return parse_numbers_iwa(zip);
        var _zip = CFB.utils.cfb_new();
        zipentries(zip).forEach(function(e) {
          zip_add_file(_zip, e, getzipbin(zip, e));
        });
        return parse_numbers_iwa(_zip);
      }
      throw new Error("Unsupported NUMBERS file");
    }
    if (!safegetzipfile(zip, "[Content_Types].xml")) {
      if (safegetzipfile(zip, "index.xml.gz")) throw new Error("Unsupported NUMBERS 08 file");
      if (safegetzipfile(zip, "index.xml")) throw new Error("Unsupported NUMBERS 09 file");
      throw new Error("Unsupported ZIP file");
    }
    var entries = zipentries(zip);
    var dir = parse_ct(getzipstr(zip, "[Content_Types].xml"));
    var xlsb = false;
    var sheets, binname;
    if (dir.workbooks.length === 0) {
      binname = "xl/workbook.xml";
      if (getzipdata(zip, binname, true)) dir.workbooks.push(binname);
    }
    if (dir.workbooks.length === 0) {
      binname = "xl/workbook.bin";
      if (!getzipdata(zip, binname, true)) throw new Error("Could not find workbook");
      dir.workbooks.push(binname);
      xlsb = true;
    }
    if (dir.workbooks[0].slice(-3) == "bin") xlsb = true;
    var themes = {};
    var styles = {};
    if (!opts.bookSheets && !opts.bookProps) {
      strs = [];
      if (dir.sst) try {
        strs = parse_sst(getzipdata(zip, strip_front_slash(dir.sst)), dir.sst, opts);
      } catch (e) {
        if (opts.WTF) throw e;
      }
      if (opts.cellStyles && dir.themes.length) themes = parse_theme(getzipstr(zip, dir.themes[0].replace(/^\//, ""), true) || "", dir.themes[0], opts);
      if (dir.style) styles = parse_sty(getzipdata(zip, strip_front_slash(dir.style)), dir.style, themes, opts);
    }
    dir.links.map(function(link) {
      try {
        var rels = parse_rels(getzipstr(zip, get_rels_path(strip_front_slash(link))), link);
        return parse_xlink(getzipdata(zip, strip_front_slash(link)), rels, link, opts);
      } catch (e) {
      }
    });
    var wb = parse_wb(getzipdata(zip, strip_front_slash(dir.workbooks[0])), dir.workbooks[0], opts);
    var props = {}, propdata = "";
    if (dir.coreprops.length) {
      propdata = getzipdata(zip, strip_front_slash(dir.coreprops[0]), true);
      if (propdata) props = parse_core_props(propdata);
      if (dir.extprops.length !== 0) {
        propdata = getzipdata(zip, strip_front_slash(dir.extprops[0]), true);
        if (propdata) parse_ext_props(propdata, props, opts);
      }
    }
    var custprops = {};
    if (!opts.bookSheets || opts.bookProps) {
      if (dir.custprops.length !== 0) {
        propdata = getzipstr(zip, strip_front_slash(dir.custprops[0]), true);
        if (propdata) custprops = parse_cust_props(propdata, opts);
      }
    }
    var out = {};
    if (opts.bookSheets || opts.bookProps) {
      if (wb.Sheets) sheets = wb.Sheets.map(function pluck2(x) {
        return x.name;
      });
      else if (props.Worksheets && props.SheetNames.length > 0) sheets = props.SheetNames;
      if (opts.bookProps) {
        out.Props = props;
        out.Custprops = custprops;
      }
      if (opts.bookSheets && typeof sheets !== "undefined") out.SheetNames = sheets;
      if (opts.bookSheets ? out.SheetNames : opts.bookProps) return out;
    }
    sheets = {};
    var deps = {};
    if (opts.bookDeps && dir.calcchain) deps = parse_cc(getzipdata(zip, strip_front_slash(dir.calcchain)), dir.calcchain, opts);
    var i = 0;
    var sheetRels = {};
    var path, relsPath;
    {
      var wbsheets = wb.Sheets;
      props.Worksheets = wbsheets.length;
      props.SheetNames = [];
      for (var j = 0; j != wbsheets.length; ++j) {
        props.SheetNames[j] = wbsheets[j].name;
      }
    }
    var wbext = xlsb ? "bin" : "xml";
    var wbrelsi = dir.workbooks[0].lastIndexOf("/");
    var wbrelsfile = (dir.workbooks[0].slice(0, wbrelsi + 1) + "_rels/" + dir.workbooks[0].slice(wbrelsi + 1) + ".rels").replace(/^\//, "");
    if (!safegetzipfile(zip, wbrelsfile)) wbrelsfile = "xl/_rels/workbook." + wbext + ".rels";
    var wbrels = parse_rels(getzipstr(zip, wbrelsfile, true), wbrelsfile.replace(/_rels.*/, "s5s"));
    if ((dir.metadata || []).length >= 1) {
      opts.xlmeta = parse_xlmeta(getzipdata(zip, strip_front_slash(dir.metadata[0])), dir.metadata[0], opts);
    }
    if ((dir.people || []).length >= 1) {
      opts.people = parse_people_xml(getzipdata(zip, strip_front_slash(dir.people[0])), opts);
    }
    if (wbrels) wbrels = safe_parse_wbrels(wbrels, wb.Sheets);
    var nmode = getzipdata(zip, "xl/worksheets/sheet.xml", true) ? 1 : 0;
    wsloop: for (i = 0; i != props.Worksheets; ++i) {
      var stype = "sheet";
      if (wbrels && wbrels[i]) {
        path = "xl/" + wbrels[i][1].replace(/[\/]?xl\//, "");
        if (!safegetzipfile(zip, path)) path = wbrels[i][1];
        if (!safegetzipfile(zip, path)) path = wbrelsfile.replace(/_rels\/.*$/, "") + wbrels[i][1];
        stype = wbrels[i][2];
      } else {
        path = "xl/worksheets/sheet" + (i + 1 - nmode) + "." + wbext;
        path = path.replace(/sheet0\./, "sheet.");
      }
      relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels");
      if (opts && opts.sheets != null) switch (typeof opts.sheets) {
        case "number":
          if (i != opts.sheets) continue wsloop;
          break;
        case "string":
          if (props.SheetNames[i].toLowerCase() != opts.sheets.toLowerCase()) continue wsloop;
          break;
        default:
          if (Array.isArray && Array.isArray(opts.sheets)) {
            var snjseen = false;
            for (var snj = 0; snj != opts.sheets.length; ++snj) {
              if (typeof opts.sheets[snj] == "number" && opts.sheets[snj] == i) snjseen = 1;
              if (typeof opts.sheets[snj] == "string" && opts.sheets[snj].toLowerCase() == props.SheetNames[i].toLowerCase()) snjseen = 1;
            }
            if (!snjseen) continue wsloop;
          }
      }
      safe_parse_sheet(zip, path, relsPath, props.SheetNames[i], i, sheetRels, sheets, stype, opts, wb, themes, styles);
    }
    out = {
      Directory: dir,
      Workbook: wb,
      Props: props,
      Custprops: custprops,
      Deps: deps,
      Sheets: sheets,
      SheetNames: props.SheetNames,
      Strings: strs,
      Styles: styles,
      Themes: themes,
      SSF: dup(table_fmt)
    };
    if (opts && opts.bookFiles) {
      if (zip.files) {
        out.keys = entries;
        out.files = zip.files;
      } else {
        out.keys = [];
        out.files = {};
        zip.FullPaths.forEach(function(p, idx) {
          p = p.replace(/^Root Entry[\/]/, "");
          out.keys.push(p);
          out.files[p] = zip.FileIndex[idx];
        });
      }
    }
    if (opts && opts.bookVBA) {
      if (dir.vba.length > 0) out.vbaraw = getzipdata(zip, strip_front_slash(dir.vba[0]), true);
      else if (dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, "xl/vbaProject.bin", true);
    }
    return out;
  }
  function parse_xlsxcfb(cfb, _opts) {
    var opts = _opts || {};
    var f = "Workbook", data = CFB.find(cfb, f);
    try {
      f = "/!DataSpaces/Version";
      data = CFB.find(cfb, f);
      if (!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
      parse_DataSpaceVersionInfo(data.content);
      f = "/!DataSpaces/DataSpaceMap";
      data = CFB.find(cfb, f);
      if (!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
      var dsm = parse_DataSpaceMap(data.content);
      if (dsm.length !== 1 || dsm[0].comps.length !== 1 || dsm[0].comps[0].t !== 0 || dsm[0].name !== "StrongEncryptionDataSpace" || dsm[0].comps[0].v !== "EncryptedPackage")
        throw new Error("ECMA-376 Encrypted file bad " + f);
      f = "/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace";
      data = CFB.find(cfb, f);
      if (!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
      var seds = parse_DataSpaceDefinition(data.content);
      if (seds.length != 1 || seds[0] != "StrongEncryptionTransform")
        throw new Error("ECMA-376 Encrypted file bad " + f);
      f = "/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary";
      data = CFB.find(cfb, f);
      if (!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
      parse_Primary(data.content);
    } catch (e) {
    }
    f = "/EncryptionInfo";
    data = CFB.find(cfb, f);
    if (!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
    var einfo = parse_EncryptionInfo(data.content);
    f = "/EncryptedPackage";
    data = CFB.find(cfb, f);
    if (!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f);
    if (einfo[0] == 4 && typeof decrypt_agile !== "undefined") return decrypt_agile(einfo[1], data.content, opts.password || "", opts);
    if (einfo[0] == 2 && typeof decrypt_std76 !== "undefined") return decrypt_std76(einfo[1], data.content, opts.password || "", opts);
    throw new Error("File is password-protected");
  }
  function firstbyte(f, o) {
    var x = "";
    switch ((o || {}).type || "base64") {
      case "buffer":
        return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]];
      case "base64":
        x = Base64_decode(f.slice(0, 12));
        break;
      case "binary":
        x = f;
        break;
      case "array":
        return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]];
      default:
        throw new Error("Unrecognized type " + (o && o.type || "undefined"));
    }
    return [x.charCodeAt(0), x.charCodeAt(1), x.charCodeAt(2), x.charCodeAt(3), x.charCodeAt(4), x.charCodeAt(5), x.charCodeAt(6), x.charCodeAt(7)];
  }
  function read_cfb(cfb, opts) {
    if (CFB.find(cfb, "EncryptedPackage")) return parse_xlsxcfb(cfb, opts);
    return parse_xlscfb(cfb, opts);
  }
  function read_zip(data, opts) {
    var zip, d = data;
    var o = opts || {};
    if (!o.type) o.type = has_buf && Buffer.isBuffer(data) ? "buffer" : "base64";
    zip = zip_read(d, o);
    return parse_zip(zip, o);
  }
  function read_plaintext(data, o) {
    var i = 0;
    main: while (i < data.length) switch (data.charCodeAt(i)) {
      case 10:
      case 13:
      case 32:
        ++i;
        break;
      case 60:
        return parse_xlml(data.slice(i), o);
      default:
        break main;
    }
    return PRN.to_workbook(data, o);
  }
  function read_plaintext_raw(data, o) {
    var str = "", bytes = firstbyte(data, o);
    switch (o.type) {
      case "base64":
        str = Base64_decode(data);
        break;
      case "binary":
        str = data;
        break;
      case "buffer":
        str = data.toString("binary");
        break;
      case "array":
        str = cc2str(data);
        break;
      default:
        throw new Error("Unrecognized type " + o.type);
    }
    if (bytes[0] == 239 && bytes[1] == 187 && bytes[2] == 191) str = utf8read(str);
    o.type = "binary";
    return read_plaintext(str, o);
  }
  function read_utf16(data, o) {
    var d = data;
    if (o.type == "base64") d = Base64_decode(d);
    d = $cptable.utils.decode(1200, d.slice(2), "str");
    o.type = "binary";
    return read_plaintext(d, o);
  }
  function bstrify(data) {
    return !data.match(/[^\x00-\x7F]/) ? data : utf8write(data);
  }
  function read_prn(data, d, o, str) {
    if (str) {
      o.type = "string";
      return PRN.to_workbook(data, o);
    }
    return PRN.to_workbook(d, o);
  }
  function readSync(data, opts) {
    reset_cp();
    var o = opts || {};
    if (typeof ArrayBuffer !== "undefined" && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), (o = dup(o), o.type = "array", o));
    if (typeof Uint8Array !== "undefined" && data instanceof Uint8Array && !o.type) o.type = typeof Deno !== "undefined" ? "buffer" : "array";
    var d = data, n = [0, 0, 0, 0], str = false;
    if (o.cellStyles) {
      o.cellNF = true;
      o.sheetStubs = true;
    }
    _ssfopts = {};
    if (o.dateNF) _ssfopts.dateNF = o.dateNF;
    if (!o.type) o.type = has_buf && Buffer.isBuffer(data) ? "buffer" : "base64";
    if (o.type == "file") {
      o.type = has_buf ? "buffer" : "binary";
      d = read_binary(data);
      if (typeof Uint8Array !== "undefined" && !has_buf) o.type = "array";
    }
    if (o.type == "string") {
      str = true;
      o.type = "binary";
      o.codepage = 65001;
      d = bstrify(data);
    }
    if (o.type == "array" && typeof Uint8Array !== "undefined" && data instanceof Uint8Array && typeof ArrayBuffer !== "undefined") {
      var ab = new ArrayBuffer(3), vu = new Uint8Array(ab);
      vu.foo = "bar";
      if (!vu.foo) {
        o = dup(o);
        o.type = "array";
        return readSync(ab2a(d), o);
      }
    }
    switch ((n = firstbyte(d, o))[0]) {
      case 208:
        if (n[1] === 207 && n[2] === 17 && n[3] === 224 && n[4] === 161 && n[5] === 177 && n[6] === 26 && n[7] === 225) return read_cfb(CFB.read(d, o), o);
        break;
      case 9:
        if (n[1] <= 8) return parse_xlscfb(d, o);
        break;
      case 60:
        return parse_xlml(d, o);
      case 73:
        if (n[1] === 73 && n[2] === 42 && n[3] === 0) throw new Error("TIFF Image File is not a spreadsheet");
        if (n[1] === 68) return read_wb_ID(d, o);
        break;
      case 84:
        if (n[1] === 65 && n[2] === 66 && n[3] === 76) return DIF.to_workbook(d, o);
        break;
      case 80:
        return n[1] === 75 && n[2] < 9 && n[3] < 9 ? read_zip(d, o) : read_prn(data, d, o, str);
      case 239:
        return n[3] === 60 ? parse_xlml(d, o) : read_prn(data, d, o, str);
      case 255:
        if (n[1] === 254) {
          return read_utf16(d, o);
        } else if (n[1] === 0 && n[2] === 2 && n[3] === 0) return WK_.to_workbook(d, o);
        break;
      case 0:
        if (n[1] === 0) {
          if (n[2] >= 2 && n[3] === 0) return WK_.to_workbook(d, o);
          if (n[2] === 0 && (n[3] === 8 || n[3] === 9)) return WK_.to_workbook(d, o);
        }
        break;
      case 3:
      case 131:
      case 139:
      case 140:
        return DBF.to_workbook(d, o);
      case 123:
        if (n[1] === 92 && n[2] === 114 && n[3] === 116) return RTF.to_workbook(d, o);
        break;
      case 10:
      case 13:
      case 32:
        return read_plaintext_raw(d, o);
      case 137:
        if (n[1] === 80 && n[2] === 78 && n[3] === 71) throw new Error("PNG Image File is not a spreadsheet");
        break;
    }
    if (DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
    return read_prn(data, d, o, str);
  }
  function make_json_row(sheet, r, R, cols, header, hdr, dense, o) {
    var rr = encode_row(R);
    var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw");
    var isempty = true;
    var row = header === 1 ? [] : {};
    if (header !== 1) {
      if (Object.defineProperty) try {
        Object.defineProperty(row, "__rowNum__", { value: R, enumerable: false });
      } catch (e) {
        row.__rowNum__ = R;
      }
      else row.__rowNum__ = R;
    }
    if (!dense || sheet[R]) for (var C = r.s.c; C <= r.e.c; ++C) {
      var val = dense ? sheet[R][C] : sheet[cols[C] + rr];
      if (val === void 0 || val.t === void 0) {
        if (defval === void 0) continue;
        if (hdr[C] != null) {
          row[hdr[C]] = defval;
        }
        continue;
      }
      var v = val.v;
      switch (val.t) {
        case "z":
          if (v == null) break;
          continue;
        case "e":
          v = v == 0 ? null : void 0;
          break;
        case "s":
        case "d":
        case "b":
        case "n":
          break;
        default:
          throw new Error("unrecognized type " + val.t);
      }
      if (hdr[C] != null) {
        if (v == null) {
          if (val.t == "e" && v === null) row[hdr[C]] = null;
          else if (defval !== void 0) row[hdr[C]] = defval;
          else if (raw && v === null) row[hdr[C]] = null;
          else continue;
        } else {
          row[hdr[C]] = raw && (val.t !== "n" || val.t === "n" && o.rawNumbers !== false) ? v : format_cell(val, v, o);
        }
        if (v != null) isempty = false;
      }
    }
    return { row, isempty };
  }
  function sheet_to_json(sheet, opts) {
    if (sheet == null || sheet["!ref"] == null) return [];
    var val = { t: "n", v: 0 }, header = 0, offset = 1, hdr = [], v = 0, vv = "";
    var r = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } };
    var o = opts || {};
    var range2 = o.range != null ? o.range : sheet["!ref"];
    if (o.header === 1) header = 1;
    else if (o.header === "A") header = 2;
    else if (Array.isArray(o.header)) header = 3;
    else if (o.header == null) header = 0;
    switch (typeof range2) {
      case "string":
        r = safe_decode_range(range2);
        break;
      case "number":
        r = safe_decode_range(sheet["!ref"]);
        r.s.r = range2;
        break;
      default:
        r = range2;
    }
    if (header > 0) offset = 0;
    var rr = encode_row(r.s.r);
    var cols = [];
    var out = [];
    var outi = 0, counter = 0;
    var dense = Array.isArray(sheet);
    var R = r.s.r, C = 0;
    var header_cnt = {};
    if (dense && !sheet[R]) sheet[R] = [];
    var colinfo = o.skipHidden && sheet["!cols"] || [];
    var rowinfo = o.skipHidden && sheet["!rows"] || [];
    for (C = r.s.c; C <= r.e.c; ++C) {
      if ((colinfo[C] || {}).hidden) continue;
      cols[C] = encode_col(C);
      val = dense ? sheet[R][C] : sheet[cols[C] + rr];
      switch (header) {
        case 1:
          hdr[C] = C - r.s.c;
          break;
        case 2:
          hdr[C] = cols[C];
          break;
        case 3:
          hdr[C] = o.header[C - r.s.c];
          break;
        default:
          if (val == null) val = { w: "__EMPTY", t: "s" };
          vv = v = format_cell(val, null, o);
          counter = header_cnt[v] || 0;
          if (!counter) header_cnt[v] = 1;
          else {
            do {
              vv = v + "_" + counter++;
            } while (header_cnt[vv]);
            header_cnt[v] = counter;
            header_cnt[vv] = 1;
          }
          hdr[C] = vv;
      }
    }
    for (R = r.s.r + offset; R <= r.e.r; ++R) {
      if ((rowinfo[R] || {}).hidden) continue;
      var row = make_json_row(sheet, r, R, cols, header, hdr, dense, o);
      if (row.isempty === false || (header === 1 ? o.blankrows !== false : !!o.blankrows)) out[outi++] = row.row;
    }
    out.length = outi;
    return out;
  }
  var qreg = /"/g;
  function make_csv_row(sheet, r, R, cols, fs, rs, FS, o) {
    var isempty = true;
    var row = [], txt = "", rr = encode_row(R);
    for (var C = r.s.c; C <= r.e.c; ++C) {
      if (!cols[C]) continue;
      var val = o.dense ? (sheet[R] || [])[C] : sheet[cols[C] + rr];
      if (val == null) txt = "";
      else if (val.v != null) {
        isempty = false;
        txt = "" + (o.rawNumbers && val.t == "n" ? val.v : format_cell(val, null, o));
        for (var i = 0, cc = 0; i !== txt.length; ++i) if ((cc = txt.charCodeAt(i)) === fs || cc === rs || cc === 34 || o.forceQuotes) {
          txt = '"' + txt.replace(qreg, '""') + '"';
          break;
        }
        if (txt == "ID") txt = '"ID"';
      } else if (val.f != null && !val.F) {
        isempty = false;
        txt = "=" + val.f;
        if (txt.indexOf(",") >= 0) txt = '"' + txt.replace(qreg, '""') + '"';
      } else txt = "";
      row.push(txt);
    }
    if (o.blankrows === false && isempty) return null;
    return row.join(FS);
  }
  function sheet_to_csv(sheet, opts) {
    var out = [];
    var o = opts == null ? {} : opts;
    if (sheet == null || sheet["!ref"] == null) return "";
    var r = safe_decode_range(sheet["!ref"]);
    var FS = o.FS !== void 0 ? o.FS : ",", fs = FS.charCodeAt(0);
    var RS = o.RS !== void 0 ? o.RS : "\n", rs = RS.charCodeAt(0);
    var endregex = new RegExp((FS == "|" ? "\\|" : FS) + "+$");
    var row = "", cols = [];
    o.dense = Array.isArray(sheet);
    var colinfo = o.skipHidden && sheet["!cols"] || [];
    var rowinfo = o.skipHidden && sheet["!rows"] || [];
    for (var C = r.s.c; C <= r.e.c; ++C) if (!(colinfo[C] || {}).hidden) cols[C] = encode_col(C);
    var w = 0;
    for (var R = r.s.r; R <= r.e.r; ++R) {
      if ((rowinfo[R] || {}).hidden) continue;
      row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o);
      if (row == null) {
        continue;
      }
      if (o.strip) row = row.replace(endregex, "");
      if (row || o.blankrows !== false) out.push((w++ ? RS : "") + row);
    }
    delete o.dense;
    return out.join("");
  }
  function sheet_to_txt(sheet, opts) {
    if (!opts) opts = {};
    opts.FS = "	";
    opts.RS = "\n";
    var s = sheet_to_csv(sheet, opts);
    if (typeof $cptable == "undefined" || opts.type == "string") return s;
    var o = $cptable.utils.encode(1200, s, "str");
    return String.fromCharCode(255) + String.fromCharCode(254) + o;
  }
  function sheet_to_formulae(sheet) {
    var y = "", x, val = "";
    if (sheet == null || sheet["!ref"] == null) return [];
    var r = safe_decode_range(sheet["!ref"]), rr = "", cols = [], C;
    var cmds = [];
    var dense = Array.isArray(sheet);
    for (C = r.s.c; C <= r.e.c; ++C) cols[C] = encode_col(C);
    for (var R = r.s.r; R <= r.e.r; ++R) {
      rr = encode_row(R);
      for (C = r.s.c; C <= r.e.c; ++C) {
        y = cols[C] + rr;
        x = dense ? (sheet[R] || [])[C] : sheet[y];
        val = "";
        if (x === void 0) continue;
        else if (x.F != null) {
          y = x.F;
          if (!x.f) continue;
          val = x.f;
          if (y.indexOf(":") == -1) y = y + ":" + y;
        }
        if (x.f != null) val = x.f;
        else if (x.t == "z") continue;
        else if (x.t == "n" && x.v != null) val = "" + x.v;
        else if (x.t == "b") val = x.v ? "TRUE" : "FALSE";
        else if (x.w !== void 0) val = "'" + x.w;
        else if (x.v === void 0) continue;
        else if (x.t == "s") val = "'" + x.v;
        else val = "" + x.v;
        cmds[cmds.length] = y + "=" + val;
      }
    }
    return cmds;
  }
  function sheet_add_json(_ws, js, opts) {
    var o = opts || {};
    var offset = +!o.skipHeader;
    var ws = _ws || {};
    var _R = 0, _C = 0;
    if (ws && o.origin != null) {
      if (typeof o.origin == "number") _R = o.origin;
      else {
        var _origin = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin;
        _R = _origin.r;
        _C = _origin.c;
      }
    }
    var cell;
    var range2 = { s: { c: 0, r: 0 }, e: { c: _C, r: _R + js.length - 1 + offset } };
    if (ws["!ref"]) {
      var _range = safe_decode_range(ws["!ref"]);
      range2.e.c = Math.max(range2.e.c, _range.e.c);
      range2.e.r = Math.max(range2.e.r, _range.e.r);
      if (_R == -1) {
        _R = _range.e.r + 1;
        range2.e.r = _R + js.length - 1 + offset;
      }
    } else {
      if (_R == -1) {
        _R = 0;
        range2.e.r = js.length - 1 + offset;
      }
    }
    var hdr = o.header || [], C = 0;
    js.forEach(function(JS, R) {
      keys(JS).forEach(function(k) {
        if ((C = hdr.indexOf(k)) == -1) hdr[C = hdr.length] = k;
        var v = JS[k];
        var t = "z";
        var z = "";
        var ref = encode_cell({ c: _C + C, r: _R + R + offset });
        cell = ws_get_cell_stub(ws, ref);
        if (v && typeof v === "object" && !(v instanceof Date)) {
          ws[ref] = v;
        } else {
          if (typeof v == "number") t = "n";
          else if (typeof v == "boolean") t = "b";
          else if (typeof v == "string") t = "s";
          else if (v instanceof Date) {
            t = "d";
            if (!o.cellDates) {
              t = "n";
              v = datenum(v);
            }
            z = o.dateNF || table_fmt[14];
          } else if (v === null && o.nullError) {
            t = "e";
            v = 0;
          }
          if (!cell) ws[ref] = cell = { t, v };
          else {
            cell.t = t;
            cell.v = v;
            delete cell.w;
            delete cell.R;
            if (z) cell.z = z;
          }
          if (z) cell.z = z;
        }
      });
    });
    range2.e.c = Math.max(range2.e.c, _C + hdr.length - 1);
    var __R = encode_row(_R);
    if (offset) for (C = 0; C < hdr.length; ++C) ws[encode_col(C + _C) + __R] = { t: "s", v: hdr[C] };
    ws["!ref"] = encode_range(range2);
    return ws;
  }
  function json_to_sheet(js, opts) {
    return sheet_add_json(null, js, opts);
  }
  function ws_get_cell_stub(ws, R, C) {
    if (typeof R == "string") {
      if (Array.isArray(ws)) {
        var RC = decode_cell(R);
        if (!ws[RC.r]) ws[RC.r] = [];
        return ws[RC.r][RC.c] || (ws[RC.r][RC.c] = { t: "z" });
      }
      return ws[R] || (ws[R] = { t: "z" });
    }
    if (typeof R != "number") return ws_get_cell_stub(ws, encode_cell(R));
    return ws_get_cell_stub(ws, encode_cell({ r: R, c: C || 0 }));
  }
  function wb_sheet_idx(wb, sh) {
    if (typeof sh == "number") {
      if (sh >= 0 && wb.SheetNames.length > sh) return sh;
      throw new Error("Cannot find sheet # " + sh);
    } else if (typeof sh == "string") {
      var idx = wb.SheetNames.indexOf(sh);
      if (idx > -1) return idx;
      throw new Error("Cannot find sheet name |" + sh + "|");
    } else throw new Error("Cannot find sheet |" + sh + "|");
  }
  function book_new() {
    return { SheetNames: [], Sheets: {} };
  }
  function book_append_sheet(wb, ws, name, roll) {
    var i = 1;
    if (!name) {
      for (; i <= 65535; ++i, name = void 0) if (wb.SheetNames.indexOf(name = "Sheet" + i) == -1) break;
    }
    if (!name || wb.SheetNames.length >= 65535) throw new Error("Too many worksheets");
    if (roll && wb.SheetNames.indexOf(name) >= 0) {
      var m = name.match(/(^.*?)(\d+)$/);
      i = m && +m[2] || 0;
      var root3 = m && m[1] || name;
      for (++i; i <= 65535; ++i) if (wb.SheetNames.indexOf(name = root3 + i) == -1) break;
    }
    check_ws_name(name);
    if (wb.SheetNames.indexOf(name) >= 0) throw new Error("Worksheet with name |" + name + "| already exists!");
    wb.SheetNames.push(name);
    wb.Sheets[name] = ws;
    return name;
  }
  function book_set_sheet_visibility(wb, sh, vis) {
    if (!wb.Workbook) wb.Workbook = {};
    if (!wb.Workbook.Sheets) wb.Workbook.Sheets = [];
    var idx = wb_sheet_idx(wb, sh);
    if (!wb.Workbook.Sheets[idx]) wb.Workbook.Sheets[idx] = {};
    switch (vis) {
      case 0:
      case 1:
      case 2:
        break;
      default:
        throw new Error("Bad sheet visibility setting " + vis);
    }
    wb.Workbook.Sheets[idx].Hidden = vis;
  }
  function cell_set_number_format(cell, fmt) {
    cell.z = fmt;
    return cell;
  }
  function cell_set_hyperlink(cell, target, tooltip) {
    if (!target) {
      delete cell.l;
    } else {
      cell.l = { Target: target };
      if (tooltip) cell.l.Tooltip = tooltip;
    }
    return cell;
  }
  function cell_set_internal_link(cell, range2, tooltip) {
    return cell_set_hyperlink(cell, "#" + range2, tooltip);
  }
  function cell_add_comment(cell, text, author) {
    if (!cell.c) cell.c = [];
    cell.c.push({ t: text, a: author || "SheetJS" });
  }
  function sheet_set_array_formula(ws, range2, formula, dynamic) {
    var rng = typeof range2 != "string" ? range2 : safe_decode_range(range2);
    var rngstr = typeof range2 == "string" ? range2 : encode_range(range2);
    for (var R = rng.s.r; R <= rng.e.r; ++R) for (var C = rng.s.c; C <= rng.e.c; ++C) {
      var cell = ws_get_cell_stub(ws, R, C);
      cell.t = "n";
      cell.F = rngstr;
      delete cell.v;
      if (R == rng.s.r && C == rng.s.c) {
        cell.f = formula;
        if (dynamic) cell.D = true;
      }
    }
    return ws;
  }
  var utils = {
    encode_col,
    encode_row,
    encode_cell,
    encode_range,
    decode_col,
    decode_row,
    split_cell,
    decode_cell,
    decode_range,
    format_cell,
    sheet_add_aoa,
    sheet_add_json,
    sheet_add_dom,
    aoa_to_sheet,
    json_to_sheet,
    table_to_sheet: parse_dom_table,
    table_to_book,
    sheet_to_csv,
    sheet_to_txt,
    sheet_to_json,
    sheet_to_html,
    sheet_to_formulae,
    sheet_to_row_object_array: sheet_to_json,
    sheet_get_cell: ws_get_cell_stub,
    book_new,
    book_append_sheet,
    book_set_sheet_visibility,
    cell_set_number_format,
    cell_set_hyperlink,
    cell_set_internal_link,
    cell_add_comment,
    sheet_set_array_formula,
    consts: {
      SHEET_VISIBLE: 0,
      SHEET_HIDDEN: 1,
      SHEET_VERY_HIDDEN: 2
    }
  };
  var version = XLSX.version;

  // lib/converters/toMarkdown.ts
  var import_papaparse = __toESM(require_papaparse_min());
  var import_mammoth = __toESM(require_lib3());
  function createTurndownService() {
    const turndown = new TurndownService({
      headingStyle: "atx",
      codeBlockStyle: "fenced",
      bulletListMarker: "-",
      emDelimiter: "_",
      strongDelimiter: "**"
    });
    turndown.addRule("table", {
      filter: "table",
      replacement: function(content, node) {
        const table = node;
        const rows = Array.from(table.querySelectorAll("tr"));
        if (rows.length === 0) return "\n\n";
        let md = "\n\n";
        rows.forEach((row, rowIndex) => {
          const cells = Array.from(row.querySelectorAll("th, td"));
          const cellTexts = cells.map(
            (c) => (c.textContent || "").replace(/[\r\n]+/g, " ").replace(/\|/g, "\\|").trim()
          );
          if (cellTexts.length === 0) return;
          md += `| ${cellTexts.join(" | ")} |
`;
          if (rowIndex === 0) {
            md += `| ${cellTexts.map(() => "---").join(" | ")} |
`;
          }
        });
        return md + "\n";
      }
    });
    turndown.addRule("stripUnwanted", {
      filter: function(node) {
        return ["SCRIPT", "STYLE", "NOSCRIPT", "IFRAME", "SVG"].includes(node.nodeName);
      },
      replacement: function() {
        return "";
      }
    });
    return turndown;
  }
  async function convertPdfToMarkdown(file) {
    let pdfjsLib;
    try {
      pdfjsLib = await Promise.resolve().then(() => (init_pdf(), pdf_exports));
      if (typeof window !== "undefined") {
        try {
          const globalChrome = globalThis.chrome;
          if (typeof globalChrome !== "undefined" && globalChrome.runtime && globalChrome.runtime.getURL) {
            pdfjsLib.GlobalWorkerOptions.workerSrc = globalChrome.runtime.getURL("lib/pdf.worker.min.mjs");
          } else {
            const version3 = pdfjsLib.version || "4.0.379";
            pdfjsLib.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${version3}/build/pdf.worker.min.mjs`;
          }
        } catch (e) {
          pdfjsLib.GlobalWorkerOptions.workerSrc = "";
        }
      }
    } catch (err) {
      console.warn("Could not load pdfjs-dist module", err);
    }
    if (pdfjsLib) {
      try {
        const arrayBuffer = await file.arrayBuffer();
        const loadingTask = pdfjsLib.getDocument({
          data: new Uint8Array(arrayBuffer),
          cMapUrl: "https://cdn.jsdelivr.net/npm/pdfjs-dist@3.11.174/cmaps/",
          cMapPacked: true,
          disableWorker: true,
          isEvalSupported: false,
          useSystemFonts: true
        });
        const pdf = await loadingTask.promise;
        let fullMarkdown = `# ${file.name.replace(/\.[^/.]+$/, "")}

`;
        for (let pageNum = 1; pageNum <= pdf.numPages; pageNum++) {
          const page = await pdf.getPage(pageNum);
          const textContent = await page.getTextContent();
          const viewport = page.getViewport({ scale: 1 });
          const items = [];
          textContent.items.forEach((item) => {
            if (!item.str || !item.str.trim()) return;
            const transform = item.transform;
            const x = transform ? transform[4] : 0;
            const y = transform ? transform[5] : 0;
            const fontSize = item.height || (transform ? Math.abs(transform[0] || transform[3] || 12) : 12);
            items.push({
              str: item.str,
              x: Math.round(x * 10) / 10,
              y: Math.round(y * 10) / 10,
              fontSize: Math.round(fontSize * 10) / 10,
              width: item.width || 0
            });
          });
          if (items.length === 0) {
            fullMarkdown += `## Page ${pageNum}

*[Scanned PDF Page \u2014 Image asset detected]*

---

`;
            continue;
          }
          const fontSizes = items.map((i) => i.fontSize).sort((a, b) => a - b);
          const medianFontSize = fontSizes[Math.floor(fontSizes.length / 2)] || 12;
          items.sort((a, b) => {
            const yDiff = b.y - a.y;
            if (Math.abs(yDiff) > 3.5) return yDiff;
            return a.x - b.x;
          });
          const lines = [];
          let currentLineItems = [];
          let currentY = null;
          items.forEach((item) => {
            if (currentY === null) {
              currentY = item.y;
              currentLineItems.push(item);
            } else if (Math.abs(item.y - currentY) <= 3.5) {
              currentLineItems.push(item);
            } else {
              if (currentLineItems.length > 0) {
                currentLineItems.sort((a, b) => a.x - b.x);
                const maxFontSize = Math.max(...currentLineItems.map((i) => i.fontSize));
                const isTable = currentLineItems.length >= 3 && hasDistinctXGaps(currentLineItems);
                lines.push({ y: currentY, fontSize: maxFontSize, items: [...currentLineItems], isTable });
              }
              currentY = item.y;
              currentLineItems = [item];
            }
          });
          if (currentLineItems.length > 0) {
            currentLineItems.sort((a, b) => a.x - b.x);
            const maxFontSize = Math.max(...currentLineItems.map((i) => i.fontSize));
            const isTable = currentLineItems.length >= 3 && hasDistinctXGaps(currentLineItems);
            lines.push({ y: currentY, fontSize: maxFontSize, items: [...currentLineItems], isTable });
          }
          let pageMarkdown = "";
          let prevY = null;
          lines.forEach((line) => {
            const lineText = line.items.map((i) => i.str).join(" ").replace(/\s+/g, " ").trim();
            if (!lineText) return;
            const isLargeHeading = line.fontSize >= medianFontSize * 1.35;
            const isMediumHeading = line.fontSize >= medianFontSize * 1.15 && line.fontSize < medianFontSize * 1.35;
            if (prevY !== null && Math.abs(prevY - line.y) > 16) {
              pageMarkdown += "\n\n";
            }
            if (line.isTable) {
              const cells = line.items.map((i) => i.str.replace(/\|/g, "\\|").trim());
              pageMarkdown += `
| ${cells.join(" | ")} |`;
            } else if (isLargeHeading) {
              pageMarkdown += `

# ${lineText.replace(/^#+\s*/, "")}

`;
            } else if (isMediumHeading) {
              pageMarkdown += `

## ${lineText.replace(/^#+\s*/, "")}

`;
            } else if (/^[\u2022\u25cf\u25cb\u25aa\-*]\s+/.test(lineText)) {
              pageMarkdown += `
- ${lineText.replace(/^[\u2022\u25cf\u25cb\u25aa\-*]\s+/, "")}`;
            } else if (/^\d+[\.\)]\s+/.test(lineText)) {
              pageMarkdown += `
${lineText}`;
            } else {
              if (pageMarkdown.endsWith("\n") || pageMarkdown.length === 0) {
                pageMarkdown += lineText;
              } else {
                pageMarkdown += " " + lineText;
              }
            }
            prevY = line.y;
          });
          if (pageMarkdown.trim()) {
            fullMarkdown += `## Page ${pageNum}

` + pageMarkdown.trim() + "\n\n---\n\n";
          }
        }
        const cleaned = cleanExtractedMarkdown(fullMarkdown);
        if (cleaned.length > 50) {
          return cleaned;
        }
      } catch (err) {
        console.error("PDF.js spatial parsing error", err);
      }
    }
    return await extractTextFromPdfStreamFallback(file);
  }
  function hasDistinctXGaps(items) {
    for (let i = 1; i < items.length; i++) {
      if (items[i].x - items[i - 1].x > 45) return true;
    }
    return false;
  }
  async function extractTextFromPdfStreamFallback(file) {
    const text = await file.text();
    const textMatches = [];
    const tjRegex = /\(([^)]+)\)\s*Tj/g;
    let match;
    while ((match = tjRegex.exec(text)) !== null) {
      const extracted = match[1].replace(/\\([()\\])/g, "$1").trim();
      if (extracted && !/^\/[A-Z0-9]+$/i.test(extracted)) {
        textMatches.push(extracted);
      }
    }
    if (textMatches.length === 0) {
      const arrayTjRegex = /\[\s*((?:\([^)]+\)\s*[-0-9\s]*)+)\]\s*TJ/gi;
      let arrayMatch;
      while ((arrayMatch = arrayTjRegex.exec(text)) !== null) {
        const inner = arrayMatch[1];
        const strRegex = /\(([^)]+)\)/g;
        let strMatch;
        let combined = "";
        while ((strMatch = strRegex.exec(inner)) !== null) {
          combined += strMatch[1].replace(/\\([()\\])/g, "$1");
        }
        if (combined.trim()) {
          textMatches.push(combined.trim());
        }
      }
    }
    if (textMatches.length === 0) {
      const btEtRegex = /BT\s+([\s\S]*?)\s+ET/g;
      let btMatch;
      while ((btMatch = btEtRegex.exec(text)) !== null) {
        const blockContent = btMatch[1];
        const strRegex = /\(([^)]+)\)/g;
        let strMatch;
        while ((strMatch = strRegex.exec(blockContent)) !== null) {
          const val = strMatch[1].replace(/\\([()\\])/g, "$1").trim();
          if (val && val.length > 1 && !/^[0-9\.\s]+$/.test(val) && !/^\/[A-Z0-9]+$/i.test(val)) {
            textMatches.push(val);
          }
        }
      }
    }
    if (textMatches.length === 0) {
      const ascii = text.match(/[\x20-\x7E\t\r\n]{4,}/g) || [];
      ascii.forEach((s) => {
        const clean = s.trim();
        if (clean && !/^(%PDF|obj|endobj|stream|endstream|xref|trailer|startxref|Font|Type|Catalog|Pages|Encoding|MediaBox)/.test(clean) && !/^\/[A-Z0-9]+/.test(clean) && !/^[0-9]+\s+[0-9]+\s+R$/.test(clean)) {
          textMatches.push(clean);
        }
      });
    }
    const cleanMatches = textMatches.map((m) => m.replace(/[\uFFFD\u2022\u25CF\u25CB\u25AA]/g, "").trim()).filter((m) => m.length > 0 && !/^\/[A-Z0-9]+$/i.test(m));
    let md = `# ${file.name.replace(/\.[^/.]+$/, "")}

`;
    let i = 0;
    while (i < cleanMatches.length) {
      const item = cleanMatches[i];
      if (i + 2 < cleanMatches.length && (item.toLowerCase() === "parameter" || item.toLowerCase() === "header" || item.toLowerCase() === "name" || item.toLowerCase() === "id" || item.length < 20) && cleanMatches[i + 1].length < 25 && cleanMatches[i + 2].length < 25 && !item.includes("\n") && !cleanMatches[i + 1].includes("\n") && !cleanMatches[i + 2].includes("\n") && !item.endsWith(".") && !cleanMatches[i + 1].endsWith(".") && !cleanMatches[i + 2].endsWith(".")) {
        const col1 = item;
        const col2 = cleanMatches[i + 1];
        const col3 = cleanMatches[i + 2];
        const tableRows = [[col1, col2, col3]];
        let j = i + 3;
        while (j + 2 < cleanMatches.length) {
          const r1 = cleanMatches[j];
          const r2 = cleanMatches[j + 1];
          const r3 = cleanMatches[j + 2];
          if (r1.length < 30 && r2.length < 30 && r3.length < 30 && !r1.endsWith(".") && !r2.endsWith(".")) {
            tableRows.push([r1, r2, r3]);
            j += 3;
          } else {
            break;
          }
        }
        if (tableRows.length >= 2) {
          md += `
| ${tableRows[0].join(" | ")} |
`;
          md += `| ${tableRows[0].map(() => "---").join(" | ")} |
`;
          tableRows.slice(1).forEach((row) => {
            md += `| ${row.join(" | ")} |
`;
          });
          md += "\n";
          i = j;
          continue;
        }
      }
      if (i === 0 && !item.toLowerCase().includes("page")) {
        md += `# ${item}

`;
      } else if (item.startsWith("**") || /^[\u2022\u25cf\u25cb\u25aa\-*]\s+/.test(item) || item.includes(" Workspace") || item.includes(" Metrics") || item.includes(" Execution")) {
        md += `- ${item.replace(/^[-*]\s*/, "")}

`;
      } else if (item.length < 35 && !item.endsWith(".") && !item.startsWith("-") && !item.startsWith("|")) {
        md += `## ${item}

`;
      } else {
        md += `${item}

`;
      }
      i++;
    }
    return cleanExtractedMarkdown(md);
  }
  async function convertDocxToMarkdown(file) {
    const arrayBuffer = await file.arrayBuffer();
    const result2 = await import_mammoth.default.convertToHtml({ arrayBuffer });
    const html = result2.value;
    const turndown = createTurndownService();
    const rawMd = turndown.turndown(html);
    let md = `# ${file.name.replace(/\.[^/.]+$/, "")}

` + rawMd;
    return cleanExtractedMarkdown(md);
  }
  async function convertCsvToMarkdown(file) {
    const text = typeof file === "string" ? file : await file.text();
    const parsed = import_papaparse.default.parse(text, { skipEmptyLines: "greedy" });
    if (!parsed.data || parsed.data.length === 0) {
      return "<!-- Empty CSV File -->";
    }
    const rows = parsed.data.filter((r) => r.some((cell) => cell && cell.trim().length > 0));
    if (rows.length === 0) return "<!-- Empty CSV Data -->";
    const header = rows[0].map((h) => h.replace(/\|/g, "\\|").trim() || "Column");
    const body = rows.slice(1);
    let mdTable = `| ${header.join(" | ")} |
`;
    mdTable += `| ${header.map(() => "---").join(" | ")} |
`;
    body.forEach((row) => {
      const padded = header.map((_3, i) => row[i] ? row[i].replace(/[\r\n]+/g, " ").replace(/\|/g, "\\|").trim() : "");
      mdTable += `| ${padded.join(" | ")} |
`;
    });
    return mdTable;
  }
  async function convertExcelToMarkdown(file) {
    const arrayBuffer = await file.arrayBuffer();
    const workbook = readSync(arrayBuffer, { type: "array" });
    let fullMarkdown = `# Sheet Data: ${file.name}

`;
    workbook.SheetNames.forEach((sheetName) => {
      const sheet = workbook.Sheets[sheetName];
      const csvText = utils.sheet_to_csv(sheet);
      if (csvText.trim()) {
        fullMarkdown += `## Sheet: ${sheetName}

`;
        const parsed = import_papaparse.default.parse(csvText, { skipEmptyLines: "greedy" });
        if (parsed.data && parsed.data.length > 0) {
          const rows = parsed.data.filter((r) => r.some((c) => c && c.trim().length > 0));
          if (rows.length > 0) {
            const header = rows[0].map((h) => h.replace(/\|/g, "\\|").trim() || "Header");
            const body = rows.slice(1);
            fullMarkdown += `| ${header.join(" | ")} |
`;
            fullMarkdown += `| ${header.map(() => "---").join(" | ")} |
`;
            body.forEach((row) => {
              const padded = header.map((_3, i) => row[i] ? row[i].replace(/[\r\n]+/g, " ").replace(/\|/g, "\\|").trim() : "");
              fullMarkdown += `| ${padded.join(" | ")} |
`;
            });
            fullMarkdown += "\n\n";
          }
        }
      }
    });
    return cleanExtractedMarkdown(fullMarkdown);
  }
  async function convertJsonToMarkdown(file) {
    const text = typeof file === "string" ? file : await file.text();
    let obj2;
    try {
      obj2 = JSON.parse(text);
    } catch {
      return `<!-- Invalid JSON Format -->
\`\`\`json
${text}
\`\`\``;
    }
    if (Array.isArray(obj2) && obj2.length > 0 && typeof obj2[0] === "object" && obj2[0] !== null) {
      const keys3 = Array.from(new Set(obj2.flatMap((item) => typeof item === "object" && item !== null ? Object.keys(item) : [])));
      if (keys3.length > 0) {
        let mdTable = `| ${keys3.join(" | ")} |
`;
        mdTable += `| ${keys3.map(() => "---").join(" | ")} |
`;
        obj2.forEach((item) => {
          const row = keys3.map((k) => item && item[k] !== void 0 ? String(item[k]).replace(/[\r\n]+/g, " ").replace(/\|/g, "\\|") : "");
          mdTable += `| ${row.join(" | ")} |
`;
        });
        return mdTable;
      }
    }
    const prettyJson = JSON.stringify(obj2, null, 2);
    const keysCount = typeof obj2 === "object" && obj2 !== null ? Object.keys(obj2).length : 0;
    return `### JSON Document (${keysCount} key-value nodes)

\`\`\`json
${prettyJson}
\`\`\``;
  }
  async function convertXmlToMarkdown(file) {
    const text = typeof file === "string" ? file : await file.text();
    return `### XML Document

\`\`\`xml
${text.trim()}
\`\`\``;
  }
  async function convertHtmlToMarkdown(file) {
    let htmlContent = typeof file === "string" ? file : await file.text();
    htmlContent = htmlContent.replace(/<script[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?<\/style>/gi, "").replace(/<svg[\s\S]*?<\/svg>/gi, "");
    const turndown = createTurndownService();
    const md = turndown.turndown(htmlContent);
    return cleanExtractedMarkdown(md);
  }
  async function convertImageToMarkdown(file) {
    const sizeKb = (file.size / 1024).toFixed(1);
    const fileType = file.type || "image/png";
    const dataUrl = await new Promise((resolve) => {
      const reader = new FileReader();
      reader.onload = (e) => resolve(e.target?.result);
      reader.readAsDataURL(file);
    });
    return `# Image Asset: ${file.name}

- **Type**: ${fileType}
- **Size**: ${sizeKb} KB
- **Timestamp**: ${(/* @__PURE__ */ new Date()).toLocaleString()}

![${file.name}](${dataUrl})

*Prompt Alt Description*: "High resolution image file ${file.name} ready for vision LLM inference."
`;
  }
  async function convertFileToMarkdown(file) {
    const extension = file.name.split(".").pop()?.toLowerCase() || "";
    switch (extension) {
      case "pdf":
        return await convertPdfToMarkdown(file);
      case "docx":
      case "doc":
        return await convertDocxToMarkdown(file);
      case "csv":
        return await convertCsvToMarkdown(file);
      case "xlsx":
      case "xls":
        return await convertExcelToMarkdown(file);
      case "json":
        return await convertJsonToMarkdown(file);
      case "xml":
        return await convertXmlToMarkdown(file);
      case "html":
      case "htm":
        return await convertHtmlToMarkdown(file);
      case "png":
      case "jpg":
      case "jpeg":
      case "webp":
      case "gif":
      case "svg":
        return await convertImageToMarkdown(file);
      default:
        return await file.text();
    }
  }
  function cleanExtractedMarkdown(md) {
    return md.replace(/[\u200B-\u200D\uFEFF]/g, "").replace(/\n{3,}/g, "\n\n").replace(/[ \t]+$/gm, "").trim();
  }
  return __toCommonJS(toMarkdown_exports);
})();
/*! Bundled license information:

papaparse/papaparse.min.js:
  (* @license
  Papa Parse
  v5.5.4
  https://github.com/mholt/PapaParse
  License: MIT
  *)

jszip/dist/jszip.min.js:
  (*!
  
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
  <http://stuartk.com/jszip>
  
  (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
  Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
  
  JSZip uses the library pako released under the MIT license :
  https://github.com/nodeca/pako/blob/main/LICENSE
  *)

xlsx/xlsx.mjs:
  (*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com *)

xlsx/xlsx.mjs:
  (*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com *)
*/
