@sheetxl/studio-vanilla
Version:
SheetXL Studio - Vanilla entry point for integrating SheetXL UI.
426 lines (425 loc) • 26.1 kB
JavaScript
import { C as yt } from "./Dm24M4tfHrPDHOCg.js";
/**
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.6.4
*
* (C) 2025-present SheetXL Inc. & Michael T. Ford
* License: The license can be found at https://www.sheetxl.com/license.
*/
var ct, pt = { exports: {} }, gt = (ct || (ct = 1, pt.exports = function Y() {
var Q, k = typeof self < "u" ? self : typeof window < "u" ? window : k !== void 0 ? k : {}, P = !k.document && !!k.postMessage, B = k.IS_PAPA_WORKER || !1, J = {}, mt = 0, a = {};
function K(t) {
this._handle = null, this._finished = !1, this._completed = !1, this._halted = !1, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = !0, this._completeResults = { data: [], errors: [], meta: {} }, function(e) {
var i = at(e);
i.chunkSize = parseInt(i.chunkSize), e.step || e.chunk || (i.chunkSize = null), this._handle = new ht(i), (this._handle.streamer = this)._config = i;
}.call(this, t), this.parseChunk = function(e, i) {
var n = parseInt(this._config.skipFirstNLines) || 0;
if (this.isFirstChunk && 0 < n) {
let l = this._config.newline;
l || (r = this._config.quoteChar || '"', l = this._handle.guessLineEndings(e, r)), e = [...e.split(l).slice(n)].join(l);
}
this.isFirstChunk && _(this._config.beforeFirstChunk) && (r = this._config.beforeFirstChunk(e)) !== void 0 && (e = r), this.isFirstChunk = !1, this._halted = !1, n = this._partialLine + e;
var r = (this._partialLine = "", this._handle.parse(n, this._baseIndex, !this._finished));
if (!this._handle.paused() && !this._handle.aborted()) {
if (e = r.meta.cursor, this._finished || (this._partialLine = n.substring(e - this._baseIndex), this._baseIndex = e), r && r.data && (this._rowCount += r.data.length), n = this._finished || this._config.preview && this._rowCount >= this._config.preview, B) k.postMessage({ results: r, workerId: a.WORKER_ID, finished: n });
else if (_(this._config.chunk) && !i) {
if (this._config.chunk(r, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = !0);
this._completeResults = r = void 0;
}
return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(r.data), this._completeResults.errors = this._completeResults.errors.concat(r.errors), this._completeResults.meta = r.meta), this._completed || !n || !_(this._config.complete) || r && r.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = !0), n || r && r.meta.paused || this._nextChunk(), r;
}
this._halted = !0;
}, this._sendError = function(e) {
_(this._config.error) ? this._config.error(e) : B && this._config.error && k.postMessage({ workerId: a.WORKER_ID, error: e, finished: !1 });
};
}
function it(t) {
var e;
(t = t || {}).chunkSize || (t.chunkSize = a.RemoteChunkSize), K.call(this, t), this._nextChunk = P ? function() {
this._readChunk(), this._chunkLoaded();
} : function() {
this._readChunk();
}, this.stream = function(i) {
this._input = i, this._nextChunk();
}, this._readChunk = function() {
if (this._finished) this._chunkLoaded();
else {
if (e = new XMLHttpRequest(), this._config.withCredentials && (e.withCredentials = this._config.withCredentials), P || (e.onload = $(this._chunkLoaded, this), e.onerror = $(this._chunkError, this)), e.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !P), this._config.downloadRequestHeaders) {
var i, n = this._config.downloadRequestHeaders;
for (i in n) e.setRequestHeader(i, n[i]);
}
var r;
this._config.chunkSize && (r = this._start + this._config.chunkSize - 1, e.setRequestHeader("Range", "bytes=" + this._start + "-" + r));
try {
e.send(this._config.downloadRequestBody);
} catch (l) {
this._chunkError(l.message);
}
P && e.status === 0 && this._chunkError();
}
}, this._chunkLoaded = function() {
var i;
e.readyState === 4 && (e.status < 200 || 400 <= e.status ? this._chunkError() : (this._start += this._config.chunkSize || e.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((i = (i = e).getResponseHeader("Content-Range")) !== null ? parseInt(i.substring(i.lastIndexOf("/") + 1)) : -1), this.parseChunk(e.responseText)));
}, this._chunkError = function(i) {
i = e.statusText || i, this._sendError(new Error(i));
};
}
function rt(t) {
(t = t || {}).chunkSize || (t.chunkSize = a.LocalChunkSize), K.call(this, t);
var e, i, n = typeof FileReader < "u";
this.stream = function(r) {
this._input = r, i = r.slice || r.webkitSlice || r.mozSlice, n ? ((e = new FileReader()).onload = $(this._chunkLoaded, this), e.onerror = $(this._chunkError, this)) : e = new FileReaderSync(), this._nextChunk();
}, this._nextChunk = function() {
this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
}, this._readChunk = function() {
var r = this._input, l = (this._config.chunkSize && (l = Math.min(this._start + this._config.chunkSize, this._input.size), r = i.call(r, this._start, l)), e.readAsText(r, this._config.encoding));
n || this._chunkLoaded({ target: { result: l } });
}, this._chunkLoaded = function(r) {
this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(r.target.result);
}, this._chunkError = function() {
this._sendError(e.error);
};
}
function X(t) {
var e;
K.call(this, t = t || {}), this.stream = function(i) {
return e = i, this._nextChunk();
}, this._nextChunk = function() {
var i, n;
if (!this._finished) return i = this._config.chunkSize, e = i ? (n = e.substring(0, i), e.substring(i)) : (n = e, ""), this._finished = !e, this.parseChunk(n);
};
}
function nt(t) {
K.call(this, t = t || {});
var e = [], i = !0, n = !1;
this.pause = function() {
K.prototype.pause.apply(this, arguments), this._input.pause();
}, this.resume = function() {
K.prototype.resume.apply(this, arguments), this._input.resume();
}, this.stream = function(r) {
this._input = r, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
}, this._checkIsFinished = function() {
n && e.length === 1 && (this._finished = !0);
}, this._nextChunk = function() {
this._checkIsFinished(), e.length ? this.parseChunk(e.shift()) : i = !0;
}, this._streamData = $(function(r) {
try {
e.push(typeof r == "string" ? r : r.toString(this._config.encoding)), i && (i = !1, this._checkIsFinished(), this.parseChunk(e.shift()));
} catch (l) {
this._streamError(l);
}
}, this), this._streamError = $(function(r) {
this._streamCleanUp(), this._sendError(r);
}, this), this._streamEnd = $(function() {
this._streamCleanUp(), n = !0, this._streamData("");
}, this), this._streamCleanUp = $(function() {
this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
}, this);
}
function ht(t) {
var e, i, n, r, l = Math.pow(2, 53), v = -l, z = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, w = /^((\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)))$/, m = this, T = 0, o = 0, I = !1, u = !1, p = [], s = { data: [], errors: [], meta: {} };
function C(h) {
return t.skipEmptyLines === "greedy" ? h.join("").trim() === "" : h.length === 1 && h[0].length === 0;
}
function R() {
if (s && n && (M("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + a.DefaultDelimiter + "'"), n = !1), t.skipEmptyLines && (s.data = s.data.filter(function(f) {
return !C(f);
})), L()) {
let f = function(O, A) {
_(t.transformHeader) && (O = t.transformHeader(O, A)), p.push(O);
};
if (s) if (Array.isArray(s.data[0])) {
for (var h = 0; L() && h < s.data.length; h++) s.data[h].forEach(f);
s.data.splice(0, 1);
} else s.data.forEach(f);
}
function c(f, O) {
for (var A = t.header ? {} : [], b = 0; b < f.length; b++) {
var y = b, g = f[b];
g = ((U, d) => {
return S = U, t.dynamicTypingFunction && t.dynamicTyping[S] === void 0 && (t.dynamicTyping[S] = t.dynamicTypingFunction(S)), (t.dynamicTyping[S] || t.dynamicTyping) === !0 ? d === "true" || d === "TRUE" || d !== "false" && d !== "FALSE" && (((j) => {
if (z.test(j) && (j = parseFloat(j), v < j && j < l)) return 1;
})(d) ? parseFloat(d) : w.test(d) ? new Date(d) : d === "" ? null : d) : d;
var S;
})(y = t.header ? b >= p.length ? "__parsed_extra" : p[b] : y, g = t.transform ? t.transform(g, y) : g), y === "__parsed_extra" ? (A[y] = A[y] || [], A[y].push(g)) : A[y] = g;
}
return t.header && (b > p.length ? M("FieldMismatch", "TooManyFields", "Too many fields: expected " + p.length + " fields but parsed " + b, o + O) : b < p.length && M("FieldMismatch", "TooFewFields", "Too few fields: expected " + p.length + " fields but parsed " + b, o + O)), A;
}
var E;
s && (t.header || t.dynamicTyping || t.transform) && (E = 1, !s.data.length || Array.isArray(s.data[0]) ? (s.data = s.data.map(c), E = s.data.length) : s.data = c(s.data, 0), t.header && s.meta && (s.meta.fields = p), o += E);
}
function L() {
return t.header && p.length === 0;
}
function M(h, c, E, f) {
h = { type: h, code: c, message: E }, f !== void 0 && (h.row = f), s.errors.push(h);
}
_(t.step) && (r = t.step, t.step = function(h) {
s = h, L() ? R() : (R(), s.data.length !== 0 && (T += h.data.length, t.preview && T > t.preview ? i.abort() : (s.data = s.data[0], r(s, m))));
}), this.parse = function(h, c, E) {
var f = t.quoteChar || '"';
return t.newline || (t.newline = this.guessLineEndings(h, f)), n = !1, t.delimiter ? _(t.delimiter) && (t.delimiter = t.delimiter(h), s.meta.delimiter = t.delimiter) : ((f = ((O, A, b, y, g) => {
var U, d, S, j;
g = g || [",", " ", "|", ";", a.RECORD_SEP, a.UNIT_SEP];
for (var Z = 0; Z < g.length; Z++) {
for (var W, tt = g[Z], F = 0, q = 0, x = 0, D = (S = void 0, new st({ comments: y, delimiter: tt, newline: A, preview: 10 }).parse(O)), H = 0; H < D.data.length; H++) b && C(D.data[H]) ? x++ : (q += W = D.data[H].length, S === void 0 ? S = W : 0 < W && (F += Math.abs(W - S), S = W));
0 < D.data.length && (q /= D.data.length - x), (d === void 0 || F <= d) && (j === void 0 || j < q) && 1.99 < q && (d = F, U = tt, j = q);
}
return { successful: !!(t.delimiter = U), bestDelimiter: U };
})(h, t.newline, t.skipEmptyLines, t.comments, t.delimitersToGuess)).successful ? t.delimiter = f.bestDelimiter : (n = !0, t.delimiter = a.DefaultDelimiter), s.meta.delimiter = t.delimiter), f = at(t), t.preview && t.header && f.preview++, e = h, i = new st(f), s = i.parse(e, c, E), R(), I ? { meta: { paused: !0 } } : s || { meta: { paused: !1 } };
}, this.paused = function() {
return I;
}, this.pause = function() {
I = !0, i.abort(), e = _(t.chunk) ? "" : e.substring(i.getCharIndex());
}, this.resume = function() {
m.streamer._halted ? (I = !1, m.streamer.parseChunk(e, !0)) : setTimeout(m.resume, 3);
}, this.aborted = function() {
return u;
}, this.abort = function() {
u = !0, i.abort(), s.meta.aborted = !0, _(t.complete) && t.complete(s), e = "";
}, this.guessLineEndings = function(h, c) {
h = h.substring(0, 1048576), c = new RegExp(V(c) + "([^]*?)" + V(c), "gm");
var E = (h = h.replace(c, "")).split("\r");
if (h = 1 < (c = h.split(`
`)).length && c[0].length < E[0].length, E.length === 1 || h) return `
`;
for (var f = 0, O = 0; O < E.length; O++) E[O][0] === `
` && f++;
return f >= E.length / 2 ? `\r
` : "\r";
};
}
function V(t) {
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function st(t) {
var e = (t = t || {}).delimiter, i = t.newline, n = t.comments, r = t.step, l = t.preview, v = t.fastMode, z = null, w = !1, m = t.quoteChar == null ? '"' : t.quoteChar, T = m;
if (t.escapeChar !== void 0 && (T = t.escapeChar), (typeof e != "string" || -1 < a.BAD_DELIMITERS.indexOf(e)) && (e = ","), n === e) throw new Error("Comment character same as delimiter");
n === !0 ? n = "#" : (typeof n != "string" || -1 < a.BAD_DELIMITERS.indexOf(n)) && (n = !1), i !== `
` && i !== "\r" && i !== `\r
` && (i = `
`);
var o = 0, I = !1;
this.parse = function(u, p, s) {
if (typeof u != "string") throw new Error("Input must be a string");
var C = u.length, R = e.length, L = i.length, M = n.length, h = _(r), c = [], E = [], f = [], O = o = 0;
if (!u) return F();
if (v || v !== !1 && u.indexOf(m) === -1) {
for (var A = u.split(i), b = 0; b < A.length; b++) {
if (f = A[b], o += f.length, b !== A.length - 1) o += i.length;
else if (s) return F();
if (!n || f.substring(0, M) !== n) {
if (h) {
if (c = [], j(f.split(e)), q(), I) return F();
} else j(f.split(e));
if (l && l <= b) return c = c.slice(0, l), F(!0);
}
}
return F();
}
for (var y = u.indexOf(e, o), g = u.indexOf(i, o), U = new RegExp(V(T) + V(m), "g"), d = u.indexOf(m, o); ; ) if (u[o] === m) for (d = o, o++; ; ) {
if ((d = u.indexOf(m, d + 1)) === -1) return s || E.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: c.length, index: o }), W();
if (d === C - 1) return W(u.substring(o, d).replace(U, m));
if (m === T && u[d + 1] === T) d++;
else if (m === T || d === 0 || u[d - 1] !== T) {
y !== -1 && y < d + 1 && (y = u.indexOf(e, d + 1));
var S = Z((g = g !== -1 && g < d + 1 ? u.indexOf(i, d + 1) : g) === -1 ? y : Math.min(y, g));
if (u.substr(d + 1 + S, R) === e) {
f.push(u.substring(o, d).replace(U, m)), u[o = d + 1 + S + R] !== m && (d = u.indexOf(m, o)), y = u.indexOf(e, o), g = u.indexOf(i, o);
break;
}
if (S = Z(g), u.substring(d + 1 + S, d + 1 + S + L) === i) {
if (f.push(u.substring(o, d).replace(U, m)), tt(d + 1 + S + L), y = u.indexOf(e, o), d = u.indexOf(m, o), h && (q(), I)) return F();
if (l && c.length >= l) return F(!0);
break;
}
E.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: c.length, index: o }), d++;
}
}
else if (n && f.length === 0 && u.substring(o, o + M) === n) {
if (g === -1) return F();
o = g + L, g = u.indexOf(i, o), y = u.indexOf(e, o);
} else if (y !== -1 && (y < g || g === -1)) f.push(u.substring(o, y)), o = y + R, y = u.indexOf(e, o);
else {
if (g === -1) break;
if (f.push(u.substring(o, g)), tt(g + L), h && (q(), I)) return F();
if (l && c.length >= l) return F(!0);
}
return W();
function j(x) {
c.push(x), O = o;
}
function Z(x) {
return x !== -1 && (x = u.substring(d + 1, x)) && x.trim() === "" ? x.length : 0;
}
function W(x) {
return s || (x === void 0 && (x = u.substring(o)), f.push(x), o = C, j(f), h && q()), F();
}
function tt(x) {
o = x, j(f), f = [], g = u.indexOf(i, o);
}
function F(x) {
if (t.header && !p && c.length && !w) {
var D = c[0], H = /* @__PURE__ */ Object.create(null), ot = new Set(D);
let ft = !1;
for (let G = 0; G < D.length; G++) {
let N = D[G];
if (H[N = _(t.transformHeader) ? t.transformHeader(N, G) : N]) {
let et, lt = H[N];
for (; et = N + "_" + lt, lt++, ot.has(et); ) ;
ot.add(et), D[G] = et, H[N]++, ft = !0, (z = z === null ? {} : z)[et] = N;
} else H[N] = 1, D[G] = N;
ot.add(N);
}
ft && console.warn("Duplicate headers found and renamed."), w = !0;
}
return { data: c, errors: E, meta: { delimiter: e, linebreak: i, aborted: I, truncated: !!x, cursor: O + (p || 0), renamedHeaders: z } };
}
function q() {
r(F()), c = [], E = [];
}
}, this.abort = function() {
I = !0;
}, this.getCharIndex = function() {
return o;
};
}
function _t(t) {
var e = t.data, i = J[e.workerId], n = !1;
if (e.error) i.userError(e.error, e.file);
else if (e.results && e.results.data) {
var r = { abort: function() {
n = !0, ut(e.workerId, { data: [], errors: [], meta: { aborted: !0 } });
}, pause: dt, resume: dt };
if (_(i.userStep)) {
for (var l = 0; l < e.results.data.length && (i.userStep({ data: e.results.data[l], errors: e.results.errors, meta: e.results.meta }, r), !n); l++) ;
delete e.results;
} else _(i.userChunk) && (i.userChunk(e.results, r, e.file), delete e.results);
}
e.finished && !n && ut(e.workerId, e.results);
}
function ut(t, e) {
var i = J[t];
_(i.userComplete) && i.userComplete(e), i.terminate(), delete J[t];
}
function dt() {
throw new Error("Not implemented.");
}
function at(t) {
if (typeof t != "object" || t === null) return t;
var e, i = Array.isArray(t) ? [] : {};
for (e in t) i[e] = at(t[e]);
return i;
}
function $(t, e) {
return function() {
t.apply(e, arguments);
};
}
function _(t) {
return typeof t == "function";
}
return a.parse = function(t, e) {
var i, n = (e = e || {}).dynamicTyping || !1;
if (_(n) && (e.dynamicTypingFunction = n, n = {}), e.dynamicTyping = n, e.transform = !!_(e.transform) && e.transform, !e.worker || !a.WORKERS_SUPPORTED) return n = null, a.NODE_STREAM_INPUT, typeof t == "string" ? (t = (i = t).charCodeAt(0) !== 65279 ? i : i.slice(1), n = new (e.download ? it : X)(e)) : t.readable === !0 && _(t.read) && _(t.on) ? n = new nt(e) : (k.File && t instanceof File || t instanceof Object) && (n = new rt(e)), n.stream(t);
(n = (() => {
var r, l, v;
return !!a.WORKERS_SUPPORTED && (l = k.URL || k.webkitURL || null, v = Y.toString(), r = a.BLOB_URL || (a.BLOB_URL = l.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; ", "(", v, ")();"], { type: "text/javascript" }))), (r = new k.Worker(r)).onmessage = _t, r.id = mt++, J[r.id] = r);
})()).userStep = e.step, n.userChunk = e.chunk, n.userComplete = e.complete, n.userError = e.error, e.step = _(e.step), e.chunk = _(e.chunk), e.complete = _(e.complete), e.error = _(e.error), delete e.worker, n.postMessage({ input: t, config: e, workerId: n.id });
}, a.unparse = function(t, e) {
var i = !1, n = !0, r = ",", l = `\r
`, v = '"', z = v + v, w = !1, m = null, T = !1, o = ((() => {
if (typeof e == "object") {
if (typeof e.delimiter != "string" || a.BAD_DELIMITERS.filter(function(p) {
return e.delimiter.indexOf(p) !== -1;
}).length || (r = e.delimiter), typeof e.quotes != "boolean" && typeof e.quotes != "function" && !Array.isArray(e.quotes) || (i = e.quotes), typeof e.skipEmptyLines != "boolean" && typeof e.skipEmptyLines != "string" || (w = e.skipEmptyLines), typeof e.newline == "string" && (l = e.newline), typeof e.quoteChar == "string" && (v = e.quoteChar), typeof e.header == "boolean" && (n = e.header), Array.isArray(e.columns)) {
if (e.columns.length === 0) throw new Error("Option columns is empty");
m = e.columns;
}
e.escapeChar !== void 0 && (z = e.escapeChar + v), e.escapeFormulae instanceof RegExp ? T = e.escapeFormulae : typeof e.escapeFormulae == "boolean" && e.escapeFormulae && (T = /^[=+\-@\t\r].*$/);
}
})(), new RegExp(V(v), "g"));
if (typeof t == "string" && (t = JSON.parse(t)), Array.isArray(t)) {
if (!t.length || Array.isArray(t[0])) return I(null, t, w);
if (typeof t[0] == "object") return I(m || Object.keys(t[0]), t, w);
} else if (typeof t == "object") return typeof t.data == "string" && (t.data = JSON.parse(t.data)), Array.isArray(t.data) && (t.fields || (t.fields = t.meta && t.meta.fields || m), t.fields || (t.fields = Array.isArray(t.data[0]) ? t.fields : typeof t.data[0] == "object" ? Object.keys(t.data[0]) : []), Array.isArray(t.data[0]) || typeof t.data[0] == "object" || (t.data = [t.data])), I(t.fields || [], t.data || [], w);
throw new Error("Unable to serialize unrecognized input");
function I(p, s, C) {
var R = "", L = (typeof p == "string" && (p = JSON.parse(p)), typeof s == "string" && (s = JSON.parse(s)), Array.isArray(p) && 0 < p.length), M = !Array.isArray(s[0]);
if (L && n) {
for (var h = 0; h < p.length; h++) 0 < h && (R += r), R += u(p[h], h);
0 < s.length && (R += l);
}
for (var c = 0; c < s.length; c++) {
var E = (L ? p : s[c]).length, f = !1, O = L ? Object.keys(s[c]).length === 0 : s[c].length === 0;
if (C && !L && (f = C === "greedy" ? s[c].join("").trim() === "" : s[c].length === 1 && s[c][0].length === 0), C === "greedy" && L) {
for (var A = [], b = 0; b < E; b++) {
var y = M ? p[b] : b;
A.push(s[c][y]);
}
f = A.join("").trim() === "";
}
if (!f) {
for (var g = 0; g < E; g++) {
0 < g && !O && (R += r);
var U = L && M ? p[g] : g;
R += u(s[c][U], g);
}
c < s.length - 1 && (!C || 0 < E && !O) && (R += l);
}
}
return R;
}
function u(p, s) {
var C, R;
return p == null ? "" : p.constructor === Date ? JSON.stringify(p).slice(1, 25) : (R = !1, T && typeof p == "string" && T.test(p) && (p = "'" + p, R = !0), C = p.toString().replace(o, z), (R = R || i === !0 || typeof i == "function" && i(p, s) || Array.isArray(i) && i[s] || ((L, M) => {
for (var h = 0; h < M.length; h++) if (-1 < L.indexOf(M[h])) return !0;
return !1;
})(C, a.BAD_DELIMITERS) || -1 < C.indexOf(r) || C.charAt(0) === " " || C.charAt(C.length - 1) === " ") ? v + C + v : C);
}
}, a.RECORD_SEP = "", a.UNIT_SEP = "", a.BYTE_ORDER_MARK = "\uFEFF", a.BAD_DELIMITERS = ["\r", `
`, '"', a.BYTE_ORDER_MARK], a.WORKERS_SUPPORTED = !P && !!k.Worker, a.NODE_STREAM_INPUT = 1, a.LocalChunkSize = 10485760, a.RemoteChunkSize = 5242880, a.DefaultDelimiter = ",", a.Parser = st, a.ParserHandle = ht, a.NetworkStreamer = it, a.FileStreamer = rt, a.StringStreamer = X, a.ReadableStreamStreamer = nt, k.jQuery && ((Q = k.jQuery).fn.parse = function(t) {
var e = t.config || {}, i = [];
return this.each(function(l) {
if (Q(this).prop("tagName").toUpperCase() !== "INPUT" || Q(this).attr("type").toLowerCase() !== "file" || !k.FileReader || !this.files || this.files.length === 0) return !0;
for (var v = 0; v < this.files.length; v++) i.push({ file: this.files[v], inputElem: this, instanceConfig: Q.extend({}, e) });
}), n(), this;
function n() {
if (i.length === 0) _(t.complete) && t.complete();
else {
var l, v, z, w = i[0];
if (_(t.before)) {
var m = t.before(w.file, w.inputElem);
if (typeof m == "object") {
if (m.action === "abort") return l = w.file, v = w.inputElem, z = m.reason, void (_(t.error) && t.error({ name: "AbortError" }, l, v, z));
if (m.action === "skip") return void r();
typeof m.config == "object" && (w.instanceConfig = Q.extend(w.instanceConfig, m.config));
} else if (m === "skip") return void r();
}
var T = w.instanceConfig.complete;
w.instanceConfig.complete = function(o) {
_(T) && T(o, w.file, w.inputElem), r();
}, a.parse(w.file, w.instanceConfig);
}
}
function r() {
i.splice(0, 1), n();
}
}), B && (k.onmessage = function(t) {
t = t.data, a.WORKER_ID === void 0 && t && (a.WORKER_ID = t.workerId), typeof t.input == "string" ? k.postMessage({ workerId: a.WORKER_ID, results: a.parse(t.input, t.config), finished: !0 }) : (k.File && t.input instanceof File || t.input instanceof Object) && (t = a.parse(t.input, t.config)) && k.postMessage({ workerId: a.WORKER_ID, results: t, finished: !0 });
}), (it.prototype = Object.create(K.prototype)).constructor = it, (rt.prototype = Object.create(K.prototype)).constructor = rt, (X.prototype = Object.create(X.prototype)).constructor = X, (nt.prototype = Object.create(K.prototype)).constructor = nt, a;
}()), pt.exports);
const bt = function(Y, Q) {
for (var k = 0; k < Q.length; k++) {
const P = Q[k];
if (typeof P != "string" && !Array.isArray(P)) {
for (const B in P) if (B !== "default" && !(B in Y)) {
const J = Object.getOwnPropertyDescriptor(P, B);
J && Object.defineProperty(Y, B, J.get ? J : { enumerable: !0, get: () => P[B] });
}
}
}
return Object.freeze(Object.defineProperty(Y, Symbol.toStringTag, { value: "Module" }));
}({ __proto__: null, default: yt(gt) }, [gt]);
export {
bt as p
};