pdf-parse-test
Version:
Pure TypeScript, cross-platform module for extracting text, images, and tabular data from PDFs. Run directly in your browser or in Node!
1,497 lines • 1.01 MB
JavaScript
var __typeError = (msg) => {
throw TypeError(msg);
};
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
var __privateWrapper = (obj, member, setter, getter) => ({
set _(value) {
__privateSet(obj, member, value, setter);
},
get _() {
return __privateGet(obj, member, getter);
}
});
var _capability, _messageHandler, _port, _webWorker, _fakeWorkerId, _isWorkerDisabled, _workerPorts, _PDFWorker_instances, resolve_fn, initializeFromPort_fn, initialize_fn, setupFakeWorker_fn, _PDFWorker_static, mainThreadWorkerMessageHandler_get;
class Shape {
static tolerance = 2;
static applyTransform(p, m) {
const xt = p[0] * m[0] + p[1] * m[2] + m[4];
const yt = p[0] * m[1] + p[1] * m[3] + m[5];
return [xt, yt];
}
}
class Point extends Shape {
x;
y;
constructor(x, y) {
super();
this.x = x;
this.y = y;
}
equal(point) {
return point.x === this.x && point.y === this.y;
}
transform(matrix) {
const p = Shape.applyTransform([this.x, this.y], matrix);
this.x = p[0];
this.y = p[1];
return this;
}
}
var LineDirection = /* @__PURE__ */ ((LineDirection2) => {
LineDirection2[LineDirection2["None"] = 0] = "None";
LineDirection2[LineDirection2["Horizontal"] = 1] = "Horizontal";
LineDirection2[LineDirection2["Vertical"] = 2] = "Vertical";
return LineDirection2;
})(LineDirection || {});
class Line extends Shape {
from;
to;
direction = 0;
length = 0;
intersections = [];
gaps = [];
constructor(from, to) {
super();
this.from = from;
this.to = to;
this.init();
}
init() {
let from = this.from;
let to = this.to;
if (Math.abs(from.y - to.y) < Shape.tolerance) {
this.direction = 1;
to.y = from.y;
if (from.x > to.x) {
const temp = from;
from = to;
to = temp;
}
this.length = to.x - from.x;
} else if (Math.abs(from.x - to.x) < Shape.tolerance) {
this.direction = 2;
to.x = from.x;
if (from.y > to.y) {
const temp = from;
from = to;
to = temp;
}
this.length = to.y - from.y;
}
this.from = from;
this.to = to;
}
_valid = void 0;
get valid() {
if (this._valid === void 0) {
this._valid = this.direction !== 0 && this.length > Shape.tolerance;
}
return this._valid;
}
get normalized() {
if (this.direction === 1) {
return new Line(new Point(this.from.x - Shape.tolerance, this.from.y), new Point(this.to.x + Shape.tolerance, this.from.y));
} else if (this.direction === 2) {
return new Line(new Point(this.from.x, this.from.y - Shape.tolerance), new Point(this.from.x, this.to.y + Shape.tolerance));
}
return this;
}
addGap(line) {
this.gaps.push(line);
}
containsPoint(p) {
if (this.direction === 2) {
return this.from.x === p.x && p.y >= this.from.y && p.y <= this.to.y;
} else if (this.direction === 1) {
return this.from.y === p.y && p.x >= this.from.x && p.x <= this.to.x;
}
return false;
}
// // todo implement
// public containsLine(l:Line):boolean{
// if(this.direction === LineDirection.Vertical && l.direction === LineDirection.Vertical){
// return this.from.x === l.from.x
// }
// else if(this.direction === LineDirection.Horizontal && l.direction === LineDirection.Horizontal){
// return this.from.y === l.from.y
// }
// return false
// }
addIntersectionPoint(point) {
for (const intPoint of this.intersections) {
if (intPoint.equal(point)) return;
}
this.intersections.push(point);
}
intersection(line) {
let result;
if (!this.valid || !line.valid) {
return result;
}
const thisNormalized = this.normalized;
const lineNormalized = line.normalized;
if (this.direction === 1 && line.direction === 2) {
const x = lineNormalized.from.x;
const y = thisNormalized.from.y;
const isOk = x > thisNormalized.from.x && x < thisNormalized.to.x && y > lineNormalized.from.y && y < lineNormalized.to.y;
if (isOk) {
const intPoint = new Point(x, y);
this.addIntersectionPoint(intPoint);
line.addIntersectionPoint(intPoint);
result = intPoint;
}
} else if (this.direction === 2 && line.direction === 1) {
const x = thisNormalized.from.x;
const y = lineNormalized.from.y;
const isOk = x > lineNormalized.from.x && x < lineNormalized.to.x && y > thisNormalized.from.y && y < thisNormalized.to.y;
if (isOk) {
const intPoint = new Point(x, y);
this.addIntersectionPoint(intPoint);
line.addIntersectionPoint(intPoint);
result = intPoint;
}
}
return result;
}
transform(matrix) {
const p1 = this.from.transform(matrix);
const p2 = this.to.transform(matrix);
const x = Math.min(p1.x, p2.x);
const y = Math.min(p1.y, p2.y);
const width = Math.abs(p1.x - p2.x);
const height = Math.abs(p1.y - p2.y);
this.from = new Point(x, y);
this.to = new Point(x + width, y + height);
this.init();
return this;
}
}
class TableData {
minXY;
maxXY;
rows;
rowPivots;
colPivots;
constructor(minXY, maxXY, rowPivots, colPivots) {
this.minXY = minXY;
this.maxXY = maxXY;
this.rows = [];
this.rowPivots = rowPivots;
this.colPivots = colPivots;
}
findCell(x, y) {
if (x >= this.minXY.x && y >= this.minXY.y && x <= this.maxXY.x && y <= this.maxXY.y) {
for (const row of this.rows) {
for (const cell of row) {
if (cell.minXY.x <= x && cell.minXY.y <= y && cell.maxXY.x >= x && cell.maxXY.y >= y) {
return cell;
}
}
}
}
return void 0;
}
get cellCount() {
return this.rows.reduce((acc, row) => acc + row.length, 0);
}
get rowCount() {
return this.rows.length;
}
check() {
const virtualCellCount = (this.colPivots.length - 1) * (this.rowPivots.length - 1);
let allCellCount = 0;
for (const row of this.rows) {
for (const cell of row) {
const count = (cell.colspan || 1) * (cell.rowspan || 1);
allCellCount += count;
}
}
if (virtualCellCount !== allCellCount) {
return false;
}
return true;
}
toArray() {
const tableArr = [];
for (const row of this.rows) {
const rowArr = [];
for (const cell of row) {
let text = cell.text.join("");
text = text.replace(/^[\s]+|[\s]+$/g, "");
text = text.trim();
rowArr.push(text);
}
tableArr.push(rowArr);
}
return tableArr;
}
}
class Table {
hLines = [];
vLines = [];
constructor(line) {
if (line.direction === LineDirection.Horizontal) {
this.hLines.push(line);
} else if (line.direction === LineDirection.Vertical) {
this.vLines.push(line);
}
}
get isValid() {
return this.hLines.length + this.vLines.length > 4;
}
get rowPivots() {
const rowSet = /* @__PURE__ */ new Set();
for (const line of this.hLines) {
rowSet.add(line.from.y);
}
return [...rowSet].sort((a, b) => a - b);
}
get colPivots() {
const colSet = /* @__PURE__ */ new Set();
for (const line of this.vLines) {
colSet.add(line.from.x);
}
return [...colSet].sort((a, b) => a - b);
}
add(line) {
const hasIntersection = this.intersection(line);
if (hasIntersection) {
if (line.direction === LineDirection.Horizontal) {
this.hLines.push(line);
return true;
} else if (line.direction === LineDirection.Vertical) {
this.vLines.push(line);
return true;
}
}
return false;
}
intersection(line) {
let flag = false;
if (!line.valid) return flag;
if (line.direction === LineDirection.Horizontal) {
for (const vLine of this.vLines) {
const p = line.intersection(vLine);
if (p) {
flag = true;
}
}
} else if (line.direction === LineDirection.Vertical) {
for (const hLine of this.hLines) {
const p = line.intersection(hLine);
if (p) {
flag = true;
}
}
}
return flag;
}
getSameHorizontal(line) {
const same = [line];
const other = [];
while (this.hLines.length > 0) {
const hLine = this.hLines.shift();
if (!hLine) continue;
if (hLine.from.y === line.from.y) {
same.push(hLine);
} else {
other.push(hLine);
}
}
this.hLines = other;
return same;
}
getSameVertical(line) {
const same = [line];
const other = [];
while (this.vLines.length > 0) {
const vLine = this.vLines.shift();
if (!vLine) continue;
if (vLine.from.x === line.from.x) {
same.push(vLine);
} else {
other.push(vLine);
}
}
this.vLines = other;
return same;
}
mergeHorizontalLines(lines) {
lines.sort((l1, l2) => l1.from.x - l2.from.x);
const minX = lines[0].from.x;
const maxX = lines[lines.length - 1].to.x;
const resultLine = new Line(new Point(minX, lines[0].from.y), new Point(maxX, lines[0].from.y));
for (let i = 1; i < lines.length; i++) {
const prevLine = lines[i - 1];
const currLine = lines[i];
if (Math.abs(prevLine.to.x - currLine.from.x) > Shape.tolerance) {
const gapLine = new Line(new Point(prevLine.to.x, prevLine.from.y), new Point(currLine.from.x, currLine.from.y));
resultLine.addGap(gapLine);
}
}
return resultLine;
}
mergeVerticalLines(lines) {
lines.sort((l1, l2) => l1.from.y - l2.from.y);
const minY = lines[0].from.y;
const maxY = lines[lines.length - 1].to.y;
const resultLine = new Line(new Point(lines[0].from.x, minY), new Point(lines[0].from.x, maxY));
for (let i = 1; i < lines.length; i++) {
const prevLine = lines[i - 1];
const currLine = lines[i];
if (Math.abs(prevLine.to.y - currLine.from.y) > Shape.tolerance) {
const gapLine = new Line(new Point(prevLine.to.x, prevLine.to.y), new Point(prevLine.to.x, currLine.from.y));
resultLine.addGap(gapLine);
}
}
return resultLine;
}
normalize() {
this.hLines = this.hLines.filter((l) => l.intersections.length > 1);
this.vLines = this.vLines.filter((l) => l.intersections.length > 1);
this.hLines.sort((l1, l2) => l1.from.y - l2.from.y);
this.vLines.sort((l1, l2) => l1.from.x - l2.from.x);
const newHLines = [];
while (this.hLines.length > 0) {
const line = this.hLines.shift();
if (!line) continue;
const lines = this.getSameHorizontal(line);
const merged = this.mergeHorizontalLines(lines);
newHLines.push(merged);
}
this.hLines = newHLines;
const newVLines = [];
while (this.vLines.length > 0) {
const line = this.vLines.shift();
if (!line) continue;
const lines = this.getSameVertical(line);
const merged = this.mergeVerticalLines(lines);
newVLines.push(merged);
}
this.vLines = newVLines;
}
verticalExists(line, y1, y2) {
if (line.direction !== LineDirection.Vertical) {
throw new Error("Line is not vertical");
}
if (y1 >= y2) {
throw new Error("y1 must be less than y2");
}
if (line.from.y <= y1 && line.to.y >= y2) {
for (const gap of line.gaps) {
if (gap.from.y <= y1 && gap.to.y >= y2) {
return false;
}
}
return true;
}
return false;
}
horizontalExists(line, x1, x2) {
if (line.direction !== LineDirection.Horizontal) {
throw new Error("Line is not horizontal");
}
if (x1 >= x2) {
throw new Error("x1 must be less than x2");
}
if (line.from.x <= x1 && line.to.x >= x2) {
for (const gap of line.gaps) {
if (gap.from.x <= x1 && gap.to.x >= x2) {
return false;
}
}
return true;
}
return false;
}
findBottomLineIndex(h2Index, xMiddle) {
for (let i = h2Index; i < this.hLines.length; i++) {
const hLine = this.hLines[i];
if (hLine.from.x <= xMiddle && hLine.to.x >= xMiddle) {
return i;
}
}
return -1;
}
findVerticalLineIndexs(topHLine, yMiddle) {
const result = [];
for (let i = 0; i < this.vLines.length; i++) {
const vLine = this.vLines[i];
if (vLine.from.y <= yMiddle && vLine.to.y >= yMiddle && topHLine.intersection(vLine)) {
result.push(i);
}
}
return result;
}
getRow(h1Index, h2Index, yMiddle) {
const tableRow = [];
const topHLine = this.hLines[h1Index];
const vLineIndexes = this.findVerticalLineIndexs(topHLine, yMiddle);
for (let i = 1; i < vLineIndexes.length; i++) {
const leftVLine = this.vLines[vLineIndexes[i - 1]];
const rightVLine = this.vLines[vLineIndexes[i]];
const xMiddle = (leftVLine.from.x + rightVLine.from.x) / 2;
const bottomHLineIndex = this.findBottomLineIndex(h2Index, xMiddle);
const bottomHLine = this.hLines[bottomHLineIndex];
const tableCell = {
minXY: new Point(leftVLine.from.x, topHLine.from.y),
maxXY: new Point(rightVLine.from.x, bottomHLine.from.y),
width: rightVLine.from.x - leftVLine.from.x,
height: bottomHLine.from.y - topHLine.from.y,
text: []
};
const colSpan = vLineIndexes[i] - vLineIndexes[i - 1];
const rowSpan = bottomHLineIndex - h1Index;
if (colSpan > 1) {
tableCell.colspan = colSpan;
}
if (rowSpan > 1) {
tableCell.rowspan = rowSpan;
}
tableRow.push(tableCell);
}
return tableRow;
}
toData() {
const rowPivots = this.rowPivots;
const colPivots = this.colPivots;
const minXY = new Point(colPivots[0], rowPivots[0]);
const maxXY = new Point(colPivots[colPivots.length - 1], rowPivots[rowPivots.length - 1]);
const result = new TableData(minXY, maxXY, rowPivots, colPivots);
for (let h1 = 1; h1 < this.hLines.length; h1++) {
const prevHLine = this.hLines[h1 - 1];
const currHLine = this.hLines[h1];
const YMiddle = (prevHLine.from.y + currHLine.from.y) / 2;
const rowData = this.getRow(h1 - 1, h1, YMiddle);
result.rows.push(rowData);
}
return result;
}
}
class LineStore {
hLines = [];
vLines = [];
add(line) {
if (line.valid) {
if (line.direction === LineDirection.Horizontal) {
this.hLines.push(line);
} else if (line.direction === LineDirection.Vertical) {
this.vLines.push(line);
}
}
}
addRectangle(rect) {
for (const line of rect.getLines()) {
this.add(line);
}
}
getTableData() {
const result = [];
const tables = this.getTables();
for (const table of tables) {
const data = table.toData();
if (data) {
result.push(data);
}
}
return result;
}
getTables() {
const result = [];
while (this.hLines.length !== 0) {
const hLine = this.hLines.shift();
if (!hLine) continue;
const filled = this.tryFill(result, hLine);
if (filled) continue;
const table = new Table(hLine);
this.fillTable(table);
result.push(table);
}
while (this.vLines.length !== 0) {
const vLine = this.vLines.shift();
if (!vLine) continue;
const filled = this.tryFill(result, vLine);
if (filled) continue;
const table = new Table(vLine);
this.fillTable(table);
result.push(table);
}
const validTables = result.filter((t) => t.isValid);
for (const table of validTables) {
table.normalize();
}
return validTables;
}
normalize() {
this.normalizeHorizontal();
this.normalizeVertical();
}
normalizeHorizontal() {
this.hLines.sort((l1, l2) => l1.from.y - l2.from.y);
const newLines = [];
let sameY = [];
for (const line of this.hLines) {
if (sameY.length === 0) {
sameY.push(line);
} else if (Math.abs(sameY[0]?.from.y - line.from.y) < Shape.tolerance) {
sameY.push(line);
} else {
const merged = this.margeHorizontalLines(sameY);
newLines.push(...merged);
sameY = [line];
}
}
if (sameY.length > 0) {
const merged = this.margeHorizontalLines(sameY);
newLines.push(...merged);
}
this.hLines = newLines;
}
normalizeVertical() {
this.vLines.sort((l1, l2) => l1.from.x - l2.from.x);
const newLines = [];
let sameX = [];
for (const line of this.vLines) {
if (sameX.length === 0) {
sameX.push(line);
} else if (Math.abs(sameX[0]?.from.x - line.from.x) < Shape.tolerance) {
sameX.push(line);
} else {
const merged = this.margeVerticalLines(sameX);
newLines.push(...merged);
sameX = [line];
}
}
if (sameX.length > 0) {
const merged = this.margeVerticalLines(sameX);
newLines.push(...merged);
}
this.vLines = newLines;
}
fillTable(table) {
const newVLines = [];
const newHLines = [];
for (const vLine of this.vLines) {
if (!table.add(vLine)) {
newVLines.push(vLine);
}
}
for (const hLine of this.hLines) {
if (!table.add(hLine)) {
newHLines.push(hLine);
}
}
this.hLines = newHLines;
this.vLines = newVLines;
}
tryFill(tables, line) {
for (const table of tables) {
if (table.add(line)) {
this.fillTable(table);
return true;
}
}
return false;
}
margeHorizontalLines(sameYLines) {
const result = [];
sameYLines.sort((l1, l2) => l1.from.x - l2.from.x);
const sameY = sameYLines[0]?.from.y;
if (sameY === void 0) return result;
let minX = Number.MAX_SAFE_INTEGER;
let maxX = Number.MIN_SAFE_INTEGER;
for (const line of sameYLines) {
if (line.from.x - maxX < Shape.tolerance) {
if (line.from.x < minX) {
minX = line.from.x;
}
if (line.to.x > maxX) {
maxX = line.to.x;
}
} else {
if (maxX > minX) {
result.push(new Line(new Point(minX, sameY), new Point(maxX, sameY)));
}
minX = line.from.x;
maxX = line.to.x;
}
}
const last = result[result.length - 1];
if (last) {
if (last.from.x !== minX && last.to.x !== maxX) {
result.push(new Line(new Point(minX, sameY), new Point(maxX, sameY)));
}
} else {
result.push(new Line(new Point(minX, sameY), new Point(maxX, sameY)));
}
return result;
}
margeVerticalLines(sameXLines) {
const result = [];
sameXLines.sort((l1, l2) => l1.from.y - l2.from.y);
const sameX = sameXLines[0]?.from.x;
if (sameX === void 0) return result;
let minY = Number.MAX_SAFE_INTEGER;
let maxY = Number.MIN_SAFE_INTEGER;
for (const line of sameXLines) {
if (line.from.y - maxY < Shape.tolerance) {
if (line.from.y < minY) {
minY = line.from.y;
}
if (line.to.y > maxY) {
maxY = line.to.y;
}
} else {
if (maxY > minY) {
result.push(new Line(new Point(sameX, minY), new Point(sameX, maxY)));
}
minY = line.from.y;
maxY = line.to.y;
}
}
const last = result[result.length - 1];
if (last) {
if (last.from.y !== minY && last.to.y !== maxY) {
result.push(new Line(new Point(sameX, minY), new Point(sameX, maxY)));
}
} else {
result.push(new Line(new Point(sameX, minY), new Point(sameX, maxY)));
}
return result;
}
}
class Rectangle extends Shape {
from;
width;
height;
constructor(from, width, height) {
super();
this.from = from;
this.width = width;
this.height = height;
}
get to() {
return new Point(this.from.x + this.width, this.from.y + this.height);
}
getLines() {
const to = this.to;
const lines = [
new Line(this.from, new Point(to.x, this.from.y)),
new Line(this.from, new Point(this.from.x, to.y)),
new Line(new Point(to.x, this.from.y), to),
new Line(new Point(this.from.x, to.y), to)
];
return lines.filter((l) => l.valid);
}
transform(matrix) {
const p1 = Shape.applyTransform([this.from.x, this.from.y], matrix);
const p2 = Shape.applyTransform([this.from.x + this.width, this.from.y + this.height], matrix);
const x = Math.min(p1[0], p2[0]);
const y = Math.min(p1[1], p2[1]);
const width = Math.abs(p1[0] - p2[0]);
const height = Math.abs(p1[1] - p2[1]);
this.from = new Point(x, y);
this.width = width;
this.height = height;
return this;
}
}
async function getHeader(url, check = false) {
try {
const fetch2 = globalThis.fetch;
if (typeof fetch2 === "function") {
const headResp = await fetch2(url, { method: "HEAD" });
const headersObj = {};
headResp.headers.forEach((v, k) => {
headersObj[k] = v;
});
const size = headResp.headers.get("content-length") ? parseInt(headResp.headers.get("content-length"), 10) : void 0;
let isPdf;
if (check) {
const rangeResp = await fetch2(url, { method: "GET", headers: { Range: "bytes=0-4" } });
if (rangeResp.ok) {
const buf = new Uint8Array(await rangeResp.arrayBuffer());
const headerStr = Array.from(buf).map((b) => String.fromCharCode(b)).join("");
isPdf = headerStr.startsWith("%PDF");
} else {
isPdf = false;
}
}
return { ok: headResp.ok, status: headResp.status, size, isPdf, headers: headersObj };
}
throw new Error("Fetch API not available");
} catch (error) {
return { ok: false, status: void 0, size: void 0, isPdf: false, headers: {}, error: new Error(String(error)) };
}
}
class ImageResult {
pages = [];
total = 0;
getPageImage(num, name) {
for (const pageData of this.pages) {
if (pageData.pageNumber === num) {
for (const img of pageData.images) {
if (img.name === name) {
return img;
}
}
}
}
return null;
}
constructor(total) {
this.total = total;
}
}
var __webpack_modules__ = {
/***/
34: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var isCallable = __webpack_require__2(4901);
module.exports = function(it) {
return typeof it == "object" ? it !== null : isCallable(it);
};
})
),
/***/
81: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var call = __webpack_require__2(9565);
var aCallable = __webpack_require__2(9306);
var anObject = __webpack_require__2(8551);
var tryToString = __webpack_require__2(6823);
var getIteratorMethod = __webpack_require__2(851);
var $TypeError = TypeError;
module.exports = function(argument, usingIterator) {
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
throw new $TypeError(tryToString(argument) + " is not iterable");
};
})
),
/***/
116: (
/***/
((__unused_webpack_module, __unused_webpack_exports, __webpack_require__2) => {
var $ = __webpack_require__2(6518);
var call = __webpack_require__2(9565);
var iterate = __webpack_require__2(2652);
var aCallable = __webpack_require__2(9306);
var anObject = __webpack_require__2(8551);
var getIteratorDirect = __webpack_require__2(1767);
var iteratorClose = __webpack_require__2(9539);
var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__2(4549);
var findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError("find", TypeError);
$({ target: "Iterator", proto: true, real: true, forced: findWithoutClosingOnEarlyError }, {
find: function find(predicate) {
anObject(this);
try {
aCallable(predicate);
} catch (error) {
iteratorClose(this, "throw", error);
}
if (findWithoutClosingOnEarlyError) return call(findWithoutClosingOnEarlyError, this, predicate);
var record = getIteratorDirect(this);
var counter = 0;
return iterate(record, function(value, stop) {
if (predicate(value, counter++)) return stop(value);
}, { IS_RECORD: true, INTERRUPTED: true }).result;
}
});
})
),
/***/
283: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var uncurryThis = __webpack_require__2(9504);
var fails = __webpack_require__2(9039);
var isCallable = __webpack_require__2(4901);
var hasOwn = __webpack_require__2(9297);
var DESCRIPTORS = __webpack_require__2(3724);
var CONFIGURABLE_FUNCTION_NAME = __webpack_require__2(350).CONFIGURABLE;
var inspectSource = __webpack_require__2(3706);
var InternalStateModule = __webpack_require__2(1181);
var enforceInternalState = InternalStateModule.enforce;
var getInternalState = InternalStateModule.get;
var $String = String;
var defineProperty = Object.defineProperty;
var stringSlice = uncurryThis("".slice);
var replace = uncurryThis("".replace);
var join = uncurryThis([].join);
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
return defineProperty(function() {
}, "length", { value: 8 }).length !== 8;
});
var TEMPLATE = String(String).split("String");
var makeBuiltIn = module.exports = function(value, name, options) {
if (stringSlice($String(name), 0, 7) === "Symbol(") {
name = "[" + replace($String(name), /^Symbol\(([^)]*)\).*$/, "$1") + "]";
}
if (options && options.getter) name = "get " + name;
if (options && options.setter) name = "set " + name;
if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
if (DESCRIPTORS) defineProperty(value, "name", { value: name, configurable: true });
else value.name = name;
}
if (CONFIGURABLE_LENGTH && options && hasOwn(options, "arity") && value.length !== options.arity) {
defineProperty(value, "length", { value: options.arity });
}
try {
if (options && hasOwn(options, "constructor") && options.constructor) {
if (DESCRIPTORS) defineProperty(value, "prototype", { writable: false });
} else if (value.prototype) value.prototype = void 0;
} catch (error) {
}
var state = enforceInternalState(value);
if (!hasOwn(state, "source")) {
state.source = join(TEMPLATE, typeof name == "string" ? name : "");
}
return value;
};
Function.prototype.toString = makeBuiltIn(function toString() {
return isCallable(this) && getInternalState(this).source || inspectSource(this);
}, "toString");
})
),
/***/
350: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var DESCRIPTORS = __webpack_require__2(3724);
var hasOwn = __webpack_require__2(9297);
var FunctionPrototype = Function.prototype;
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
var EXISTS = hasOwn(FunctionPrototype, "name");
var PROPER = EXISTS && (function something() {
}).name === "something";
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
module.exports = {
EXISTS,
PROPER,
CONFIGURABLE
};
})
),
/***/
397: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var getBuiltIn = __webpack_require__2(7751);
module.exports = getBuiltIn("document", "documentElement");
})
),
/***/
421: (
/***/
((module) => {
module.exports = {};
})
),
/***/
456: (
/***/
((__unused_webpack_module, __unused_webpack_exports, __webpack_require__2) => {
var $ = __webpack_require__2(6518);
var globalThis2 = __webpack_require__2(4576);
var uncurryThis = __webpack_require__2(9504);
var anUint8Array = __webpack_require__2(4154);
var notDetached = __webpack_require__2(5169);
var numberToString = uncurryThis(1.1.toString);
var Uint8Array2 = globalThis2.Uint8Array;
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
try {
var target = new Uint8Array2([255, 255, 255, 255, 255, 255, 255, 255]);
return target.toHex() === "ffffffffffffffff";
} catch (error) {
return false;
}
})();
if (Uint8Array2) $({ target: "Uint8Array", proto: true, forced: INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS }, {
toHex: function toHex() {
anUint8Array(this);
notDetached(this.buffer);
var result = "";
for (var i = 0, length = this.length; i < length; i++) {
var hex = numberToString(this[i], 16);
result += hex.length === 1 ? "0" + hex : hex;
}
return result;
}
});
})
),
/***/
507: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var call = __webpack_require__2(9565);
module.exports = function(record, fn, ITERATOR_INSTEAD_OF_RECORD) {
var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;
var next = record.next;
var step, result;
while (!(step = call(next, iterator)).done) {
result = fn(step.value);
if (result !== void 0) return result;
}
};
})
),
/***/
531: (
/***/
((__unused_webpack_module, __unused_webpack_exports, __webpack_require__2) => {
var $ = __webpack_require__2(6518);
var call = __webpack_require__2(9565);
var aCallable = __webpack_require__2(9306);
var anObject = __webpack_require__2(8551);
var getIteratorDirect = __webpack_require__2(1767);
var getIteratorFlattenable = __webpack_require__2(8646);
var createIteratorProxy = __webpack_require__2(9462);
var iteratorClose = __webpack_require__2(9539);
var IS_PURE = __webpack_require__2(6395);
var iteratorHelperThrowsOnInvalidIterator = __webpack_require__2(684);
var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__2(4549);
var FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator("flatMap", function() {
});
var flatMapWithoutClosingOnEarlyError = !IS_PURE && !FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR && iteratorHelperWithoutClosingOnEarlyError("flatMap", TypeError);
var FORCED = IS_PURE || FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || flatMapWithoutClosingOnEarlyError;
var IteratorProxy = createIteratorProxy(function() {
var iterator = this.iterator;
var mapper = this.mapper;
var result, inner;
while (true) {
if (inner = this.inner) try {
result = anObject(call(inner.next, inner.iterator));
if (!result.done) return result.value;
this.inner = null;
} catch (error) {
iteratorClose(iterator, "throw", error);
}
result = anObject(call(this.next, iterator));
if (this.done = !!result.done) return;
try {
this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false);
} catch (error) {
iteratorClose(iterator, "throw", error);
}
}
});
$({ target: "Iterator", proto: true, real: true, forced: FORCED }, {
flatMap: function flatMap(mapper) {
anObject(this);
try {
aCallable(mapper);
} catch (error) {
iteratorClose(this, "throw", error);
}
if (flatMapWithoutClosingOnEarlyError) return call(flatMapWithoutClosingOnEarlyError, this, mapper);
return new IteratorProxy(getIteratorDirect(this), {
mapper,
inner: null
});
}
});
})
),
/***/
616: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var fails = __webpack_require__2(9039);
module.exports = !fails(function() {
var test = (function() {
}).bind();
return typeof test != "function" || test.hasOwnProperty("prototype");
});
})
),
/***/
655: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var classof = __webpack_require__2(6955);
var $String = String;
module.exports = function(argument) {
if (classof(argument) === "Symbol") throw new TypeError("Cannot convert a Symbol value to a string");
return $String(argument);
};
})
),
/***/
679: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var isPrototypeOf = __webpack_require__2(1625);
var $TypeError = TypeError;
module.exports = function(it, Prototype) {
if (isPrototypeOf(Prototype, it)) return it;
throw new $TypeError("Incorrect invocation");
};
})
),
/***/
684: (
/***/
((module) => {
module.exports = function(methodName, argument) {
var method = typeof Iterator == "function" && Iterator.prototype[methodName];
if (method) try {
method.call({ next: null }, argument).next();
} catch (error) {
return true;
}
};
})
),
/***/
741: (
/***/
((module) => {
var ceil2 = Math.ceil;
var floor2 = Math.floor;
module.exports = Math.trunc || function trunc(x) {
var n = +x;
return (n > 0 ? floor2 : ceil2)(n);
};
})
),
/***/
757: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var getBuiltIn = __webpack_require__2(7751);
var isCallable = __webpack_require__2(4901);
var isPrototypeOf = __webpack_require__2(1625);
var USE_SYMBOL_AS_UID = __webpack_require__2(7040);
var $Object = Object;
module.exports = USE_SYMBOL_AS_UID ? function(it) {
return typeof it == "symbol";
} : function(it) {
var $Symbol = getBuiltIn("Symbol");
return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
};
})
),
/***/
851: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var classof = __webpack_require__2(6955);
var getMethod = __webpack_require__2(5966);
var isNullOrUndefined = __webpack_require__2(4117);
var Iterators = __webpack_require__2(6269);
var wellKnownSymbol = __webpack_require__2(8227);
var ITERATOR = wellKnownSymbol("iterator");
module.exports = function(it) {
if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
};
})
),
/***/
944: (
/***/
((module) => {
var $TypeError = TypeError;
module.exports = function(options) {
var alphabet = options && options.alphabet;
if (alphabet === void 0 || alphabet === "base64" || alphabet === "base64url") return alphabet || "base64";
throw new $TypeError("Incorrect `alphabet` option");
};
})
),
/***/
1072: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var internalObjectKeys = __webpack_require__2(1828);
var enumBugKeys = __webpack_require__2(8727);
module.exports = Object.keys || function keys(O) {
return internalObjectKeys(O, enumBugKeys);
};
})
),
/***/
1103: (
/***/
((module) => {
module.exports = function(exec) {
try {
return { error: false, value: exec() };
} catch (error) {
return { error: true, value: error };
}
};
})
),
/***/
1108: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var classof = __webpack_require__2(6955);
module.exports = function(it) {
var klass = classof(it);
return klass === "BigInt64Array" || klass === "BigUint64Array";
};
})
),
/***/
1148: (
/***/
((__unused_webpack_module, __unused_webpack_exports, __webpack_require__2) => {
var $ = __webpack_require__2(6518);
var call = __webpack_require__2(9565);
var iterate = __webpack_require__2(2652);
var aCallable = __webpack_require__2(9306);
var anObject = __webpack_require__2(8551);
var getIteratorDirect = __webpack_require__2(1767);
var iteratorClose = __webpack_require__2(9539);
var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__2(4549);
var everyWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError("every", TypeError);
$({ target: "Iterator", proto: true, real: true, forced: everyWithoutClosingOnEarlyError }, {
every: function every(predicate) {
anObject(this);
try {
aCallable(predicate);
} catch (error) {
iteratorClose(this, "throw", error);
}
if (everyWithoutClosingOnEarlyError) return call(everyWithoutClosingOnEarlyError, this, predicate);
var record = getIteratorDirect(this);
var counter = 0;
return !iterate(record, function(value, stop) {
if (!predicate(value, counter++)) return stop();
}, { IS_RECORD: true, INTERRUPTED: true }).stopped;
}
});
})
),
/***/
1181: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var NATIVE_WEAK_MAP = __webpack_require__2(8622);
var globalThis2 = __webpack_require__2(4576);
var isObject = __webpack_require__2(34);
var createNonEnumerableProperty = __webpack_require__2(6699);
var hasOwn = __webpack_require__2(9297);
var shared = __webpack_require__2(7629);
var sharedKey = __webpack_require__2(6119);
var hiddenKeys = __webpack_require__2(421);
var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
var TypeError2 = globalThis2.TypeError;
var WeakMap2 = globalThis2.WeakMap;
var set, get, has;
var enforce = function(it) {
return has(it) ? get(it) : set(it, {});
};
var getterFor = function(TYPE) {
return function(it) {
var state;
if (!isObject(it) || (state = get(it)).type !== TYPE) {
throw new TypeError2("Incompatible receiver, " + TYPE + " required");
}
return state;
};
};
if (NATIVE_WEAK_MAP || shared.state) {
var store = shared.state || (shared.state = new WeakMap2());
store.get = store.get;
store.has = store.has;
store.set = store.set;
set = function(it, metadata) {
if (store.has(it)) throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
store.set(it, metadata);
return metadata;
};
get = function(it) {
return store.get(it) || {};
};
has = function(it) {
return store.has(it);
};
} else {
var STATE = sharedKey("state");
hiddenKeys[STATE] = true;
set = function(it, metadata) {
if (hasOwn(it, STATE)) throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
createNonEnumerableProperty(it, STATE, metadata);
return metadata;
};
get = function(it) {
return hasOwn(it, STATE) ? it[STATE] : {};
};
has = function(it) {
return hasOwn(it, STATE);
};
}
module.exports = {
set,
get,
has,
enforce,
getterFor
};
})
),
/***/
1291: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var trunc = __webpack_require__2(741);
module.exports = function(argument) {
var number = +argument;
return number !== number || number === 0 ? 0 : trunc(number);
};
})
),
/***/
1385: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var iteratorClose = __webpack_require__2(9539);
module.exports = function(iters, kind, value) {
for (var i = iters.length - 1; i >= 0; i--) {
if (iters[i] === void 0) continue;
try {
value = iteratorClose(iters[i].iterator, kind, value);
} catch (error) {
kind = "throw";
value = error;
}
}
if (kind === "throw") throw value;
return value;
};
})
),
/***/
1548: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var globalThis2 = __webpack_require__2(4576);
var fails = __webpack_require__2(9039);
var V8 = __webpack_require__2(9519);
var ENVIRONMENT = __webpack_require__2(4215);
var structuredClone2 = globalThis2.structuredClone;
module.exports = !!structuredClone2 && !fails(function() {
if (ENVIRONMENT === "DENO" && V8 > 92 || ENVIRONMENT === "NODE" && V8 > 94 || ENVIRONMENT === "BROWSER" && V8 > 97) return false;
var buffer = new ArrayBuffer(8);
var clone = structuredClone2(buffer, { transfer: [buffer] });
return buffer.byteLength !== 0 || clone.byteLength !== 8;
});
})
),
/***/
1549: (
/***/
((__unused_webpack_module, __unused_webpack_exports, __webpack_require__2) => {
__webpack_require__2(6632);
})
),
/***/
1625: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var uncurryThis = __webpack_require__2(9504);
module.exports = uncurryThis({}.isPrototypeOf);
})
),
/***/
1689: (
/***/
((__unused_webpack_module, __unused_webpack_exports, __webpack_require__2) => {
var $ = __webpack_require__2(6518);
var globalThis2 = __webpack_require__2(4576);
var apply = __webpack_require__2(8745);
var slice = __webpack_require__2(7680);
var newPromiseCapabilityModule = __webpack_require__2(6043);
var aCallable = __webpack_require__2(9306);
var perform = __webpack_require__2(1103);
var Promise2 = globalThis2.Promise;
var ACCEPT_ARGUMENTS = false;
var FORCED = !Promise2 || !Promise2["try"] || perform(function() {
Promise2["try"](function(argument) {
ACCEPT_ARGUMENTS = argument === 8;
}, 8);
}).error || !ACCEPT_ARGUMENTS;
$({ target: "Promise", stat: true, forced: FORCED }, {
"try": function(callbackfn) {
var args = arguments.length > 1 ? slice(arguments, 1) : [];
var promiseCapability = newPromiseCapabilityModule.f(this);
var result = perform(function() {
return apply(aCallable(callbackfn), void 0, args);
});
(result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value);
return promiseCapability.promise;
}
});
})
),
/***/
1698: (
/***/
((__unused_webpack_module, __unused_webpack_exports, __webpack_require__2) => {
var $ = __webpack_require__2(6518);
var union = __webpack_require__2(4204);
var setMethodGetKeysBeforeCloning = __webpack_require__2(9835);
var setMethodAcceptSetLike = __webpack_require__2(4916);
var FORCED = !setMethodAcceptSetLike("union") || !setMethodGetKeysBeforeCloning("union");
$({ target: "Set", proto: true, real: true, forced: FORCED }, {
union
});
})
),
/***/
1701: (
/***/
((__unused_webpack_module, __unused_webpack_exports, __webpack_require__2) => {
var $ = __webpack_require__2(6518);
var call = __webpack_require__2(9565);
var aCallable = __webpack_require__2(9306);
var anObject = __webpack_require__2(8551);
var getIteratorDirect = __webpack_require__2(1767);
var createIteratorProxy = __webpack_require__2(9462);
var callWithSafeIterationClosing = __webpack_require__2(6319);
var iteratorClose = __webpack_require__2(9539);
var iteratorHelperThrowsOnInvalidIterator = __webpack_require__2(684);
var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__2(4549);
var IS_PURE = __webpack_require__2(6395);
var MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator("map", function() {
});
var mapWithoutClosingOnEarlyError = !IS_PURE && !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR && iteratorHelperWithoutClosingOnEarlyError("map", TypeError);
var FORCED = IS_PURE || MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError;
var IteratorProxy = createIteratorProxy(function() {
var iterator = this.iterator;
var result = anObject(call(this.next, iterator));
var done = this.done = !!result.done;
if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
});
$({ target: "Iterator", proto: true, real: true, forced: FORCED }, {
map: function map(mapper) {
anObject(this);
try {
aCallable(mapper);
} catch (error) {
iteratorClose(this, "throw", error);
}
if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper);
return new IteratorProxy(getIteratorDirect(this), {
mapper
});
}
});
})
),
/***/
1767: (
/***/
((module) => {
module.exports = function(obj) {
return {
iterator: obj,
next: obj.next,
done: false
};
};
})
),
/***/
1828: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var uncurryThis = __webpack_require__2(9504);
var hasOwn = __webpack_require__2(9297);
var toIndexedObject = __webpack_require__2(5397);
var indexOf = __webpack_require__2(9617).indexOf;
var hiddenKeys = __webpack_require__2(421);
var push = uncurryThis([].push);
module.exports = function(object, names) {
var O = toIndexedObject(object);
var i = 0;
var result = [];
var key;
for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
while (names.length > i) if (hasOwn(O, key = names[i++])) {
~indexOf(result, key) || push(result, key);
}
return result;
};
})
),
/***/
2106: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var makeBuiltIn = __webpack_require__2(283);
var defineProperty = __webpack_require__2(4913);
module.exports = function(target, name, descriptor) {
if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
return defineProperty.f(target, name, descriptor);
};
})
),
/***/
2140: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var wellKnownSymbol = __webpack_require__2(8227);
var TO_STRING_TAG = wellKnownSymbol("toStringTag");
var test = {};
test[TO_STRING_TAG] = "z";
module.exports = String(test) === "[object z]";
})
),
/***/
2195: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var uncurryThis = __webpack_require__2(9504);
var toString = uncurryThis({}.toString);
var stringSlice = uncurryThis("".slice);
module.exports = function(it) {
return stringSlice(toString(it), 8, -1);
};
})
),
/***/
2211: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var fails = __webpack_require__2(9039);
module.exports = !fails(function() {
function F() {
}
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
})
),
/***/
2303: (
/***/
((module, __unused_webpack_exports, __webpack_require__2) => {
var globalThis2 = __webpack_require__2(4576);
var uncurryThis = __webpack_require__2(9504);
var Uint8Array2 = globalThis2.Uint8Array;
var SyntaxError2 = globalThis2.SyntaxError;
var parseInt2 = globalThis2.parseInt;
var min = Math.min;
var NOT_HEX = /[^\da-f]/i;
var exec = uncurryThis(NOT_HEX.exec);
var stringSlice = uncurryThis("".slice);
module.exports = function(string, into) {
var stringLength = string.length;
if (stringLength % 2 !== 0) throw new SyntaxError2("String should be an even number of characters");
var maxLength = into ? min(into.length, stringLength / 2) : stringLength / 2;
var bytes = into || new Uint8Array2(maxLength);
var