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