oda-framework
Version:
1,257 lines • 651 kB
JavaScript
import { ElementType as Qe } from "../canvas-editor.es.js";
function Jr(r, t) {
var e = Object.setPrototypeOf;
e ? e(r, t) : r.__proto__ = t;
}
function tn(r, t) {
t === void 0 && (t = r.constructor);
var e = Error.captureStackTrace;
e && e(r, t);
}
var en = function() {
var r = function(e, n) {
return r = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(i, a) {
i.__proto__ = a;
} || function(i, a) {
for (var o in a)
Object.prototype.hasOwnProperty.call(a, o) && (i[o] = a[o]);
}, r(e, n);
};
return function(t, e) {
if (typeof e != "function" && e !== null)
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), rn = function(r) {
en(t, r);
function t(e, n) {
var i = this.constructor, a = r.call(this, e, n) || this;
return Object.defineProperty(a, "name", {
value: i.name,
enumerable: !1,
configurable: !0
}), Jr(a, i.prototype), tn(a), a;
}
return t;
}(Error), nn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), At = (
/** @class */
function(r) {
nn(t, r);
function t(e) {
e === void 0 && (e = void 0);
var n = r.call(this, e) || this;
return n.message = e, n;
}
return t.prototype.getKind = function() {
var e = this.constructor;
return e.kind;
}, t.kind = "Exception", t;
}(rn)
), an = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), tt = (
/** @class */
function(r) {
an(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.kind = "ArgumentException", t;
}(At)
), on = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), D = (
/** @class */
function(r) {
on(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.kind = "IllegalArgumentException", t;
}(At)
), Br = (
/** @class */
function() {
function r(t) {
if (this.binarizer = t, t === null)
throw new D("Binarizer must be non-null.");
}
return r.prototype.getWidth = function() {
return this.binarizer.getWidth();
}, r.prototype.getHeight = function() {
return this.binarizer.getHeight();
}, r.prototype.getBlackRow = function(t, e) {
return this.binarizer.getBlackRow(t, e);
}, r.prototype.getBlackMatrix = function() {
return (this.matrix === null || this.matrix === void 0) && (this.matrix = this.binarizer.getBlackMatrix()), this.matrix;
}, r.prototype.isCropSupported = function() {
return this.binarizer.getLuminanceSource().isCropSupported();
}, r.prototype.crop = function(t, e, n, i) {
var a = this.binarizer.getLuminanceSource().crop(t, e, n, i);
return new r(this.binarizer.createBinarizer(a));
}, r.prototype.isRotateSupported = function() {
return this.binarizer.getLuminanceSource().isRotateSupported();
}, r.prototype.rotateCounterClockwise = function() {
var t = this.binarizer.getLuminanceSource().rotateCounterClockwise();
return new r(this.binarizer.createBinarizer(t));
}, r.prototype.rotateCounterClockwise45 = function() {
var t = this.binarizer.getLuminanceSource().rotateCounterClockwise45();
return new r(this.binarizer.createBinarizer(t));
}, r.prototype.toString = function() {
try {
return this.getBlackMatrix().toString();
} catch {
return "";
}
}, r;
}()
), fn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), et = (
/** @class */
function(r) {
fn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.getChecksumInstance = function() {
return new t();
}, t.kind = "ChecksumException", t;
}(At)
), sn = (
/** @class */
function() {
function r(t) {
this.source = t;
}
return r.prototype.getLuminanceSource = function() {
return this.source;
}, r.prototype.getWidth = function() {
return this.source.getWidth();
}, r.prototype.getHeight = function() {
return this.source.getHeight();
}, r;
}()
), j = (
/** @class */
function() {
function r() {
}
return r.arraycopy = function(t, e, n, i, a) {
for (; a--; )
n[i++] = t[e++];
}, r.currentTimeMillis = function() {
return Date.now();
}, r;
}()
), un = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), ze = (
/** @class */
function(r) {
un(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.kind = "IndexOutOfBoundsException", t;
}(At)
), cn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), Je = (
/** @class */
function(r) {
cn(t, r);
function t(e, n) {
e === void 0 && (e = void 0), n === void 0 && (n = void 0);
var i = r.call(this, n) || this;
return i.index = e, i.message = n, i;
}
return t.kind = "ArrayIndexOutOfBoundsException", t;
}(ze)
), ln = globalThis && globalThis.__values || function(r) {
var t = typeof Symbol == "function" && Symbol.iterator, e = t && r[t], n = 0;
if (e)
return e.call(r);
if (r && typeof r.length == "number")
return {
next: function() {
return r && n >= r.length && (r = void 0), { value: r && r[n++], done: !r };
}
};
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}, ot = (
/** @class */
function() {
function r() {
}
return r.fill = function(t, e) {
for (var n = 0, i = t.length; n < i; n++)
t[n] = e;
}, r.fillWithin = function(t, e, n, i) {
r.rangeCheck(t.length, e, n);
for (var a = e; a < n; a++)
t[a] = i;
}, r.rangeCheck = function(t, e, n) {
if (e > n)
throw new D("fromIndex(" + e + ") > toIndex(" + n + ")");
if (e < 0)
throw new Je(e);
if (n > t)
throw new Je(n);
}, r.asList = function() {
for (var t = [], e = 0; e < arguments.length; e++)
t[e] = arguments[e];
return t;
}, r.create = function(t, e, n) {
var i = Array.from({ length: t });
return i.map(function(a) {
return Array.from({ length: e }).fill(n);
});
}, r.createInt32Array = function(t, e, n) {
var i = Array.from({ length: t });
return i.map(function(a) {
return Int32Array.from({ length: e }).fill(n);
});
}, r.equals = function(t, e) {
if (!t || !e || !t.length || !e.length || t.length !== e.length)
return !1;
for (var n = 0, i = t.length; n < i; n++)
if (t[n] !== e[n])
return !1;
return !0;
}, r.hashCode = function(t) {
var e, n;
if (t === null)
return 0;
var i = 1;
try {
for (var a = ln(t), o = a.next(); !o.done; o = a.next()) {
var f = o.value;
i = 31 * i + f;
}
} catch (s) {
e = { error: s };
} finally {
try {
o && !o.done && (n = a.return) && n.call(a);
} finally {
if (e)
throw e.error;
}
}
return i;
}, r.fillUint8Array = function(t, e) {
for (var n = 0; n !== t.length; n++)
t[n] = e;
}, r.copyOf = function(t, e) {
return t.slice(0, e);
}, r.copyOfUint8Array = function(t, e) {
if (t.length <= e) {
var n = new Uint8Array(e);
return n.set(t), n;
}
return t.slice(0, e);
}, r.copyOfRange = function(t, e, n) {
var i = n - e, a = new Int32Array(i);
return j.arraycopy(t, e, a, 0, i), a;
}, r.binarySearch = function(t, e, n) {
n === void 0 && (n = r.numberComparator);
for (var i = 0, a = t.length - 1; i <= a; ) {
var o = a + i >> 1, f = n(e, t[o]);
if (f > 0)
i = o + 1;
else if (f < 0)
a = o - 1;
else
return o;
}
return -i - 1;
}, r.numberComparator = function(t, e) {
return t - e;
}, r;
}()
), B = (
/** @class */
function() {
function r() {
}
return r.numberOfTrailingZeros = function(t) {
var e;
if (t === 0)
return 32;
var n = 31;
return e = t << 16, e !== 0 && (n -= 16, t = e), e = t << 8, e !== 0 && (n -= 8, t = e), e = t << 4, e !== 0 && (n -= 4, t = e), e = t << 2, e !== 0 && (n -= 2, t = e), n - (t << 1 >>> 31);
}, r.numberOfLeadingZeros = function(t) {
if (t === 0)
return 32;
var e = 1;
return t >>> 16 || (e += 16, t <<= 16), t >>> 24 || (e += 8, t <<= 8), t >>> 28 || (e += 4, t <<= 4), t >>> 30 || (e += 2, t <<= 2), e -= t >>> 31, e;
}, r.toHexString = function(t) {
return t.toString(16);
}, r.toBinaryString = function(t) {
return String(parseInt(String(t), 2));
}, r.bitCount = function(t) {
return t = t - (t >>> 1 & 1431655765), t = (t & 858993459) + (t >>> 2 & 858993459), t = t + (t >>> 4) & 252645135, t = t + (t >>> 8), t = t + (t >>> 16), t & 63;
}, r.truncDivision = function(t, e) {
return Math.trunc(t / e);
}, r.parseInt = function(t, e) {
return e === void 0 && (e = void 0), parseInt(t, e);
}, r.MIN_VALUE_32_BITS = -2147483648, r.MAX_VALUE = Number.MAX_SAFE_INTEGER, r;
}()
), ct = (
/** @class */
function() {
function r(t, e) {
t === void 0 ? (this.size = 0, this.bits = new Int32Array(1)) : (this.size = t, e == null ? this.bits = r.makeArray(t) : this.bits = e);
}
return r.prototype.getSize = function() {
return this.size;
}, r.prototype.getSizeInBytes = function() {
return Math.floor((this.size + 7) / 8);
}, r.prototype.ensureCapacity = function(t) {
if (t > this.bits.length * 32) {
var e = r.makeArray(t);
j.arraycopy(this.bits, 0, e, 0, this.bits.length), this.bits = e;
}
}, r.prototype.get = function(t) {
return (this.bits[Math.floor(t / 32)] & 1 << (t & 31)) !== 0;
}, r.prototype.set = function(t) {
this.bits[Math.floor(t / 32)] |= 1 << (t & 31);
}, r.prototype.flip = function(t) {
this.bits[Math.floor(t / 32)] ^= 1 << (t & 31);
}, r.prototype.getNextSet = function(t) {
var e = this.size;
if (t >= e)
return e;
var n = this.bits, i = Math.floor(t / 32), a = n[i];
a &= ~((1 << (t & 31)) - 1);
for (var o = n.length; a === 0; ) {
if (++i === o)
return e;
a = n[i];
}
var f = i * 32 + B.numberOfTrailingZeros(a);
return f > e ? e : f;
}, r.prototype.getNextUnset = function(t) {
var e = this.size;
if (t >= e)
return e;
var n = this.bits, i = Math.floor(t / 32), a = ~n[i];
a &= ~((1 << (t & 31)) - 1);
for (var o = n.length; a === 0; ) {
if (++i === o)
return e;
a = ~n[i];
}
var f = i * 32 + B.numberOfTrailingZeros(a);
return f > e ? e : f;
}, r.prototype.setBulk = function(t, e) {
this.bits[Math.floor(t / 32)] = e;
}, r.prototype.setRange = function(t, e) {
if (e < t || t < 0 || e > this.size)
throw new D();
if (e !== t) {
e--;
for (var n = Math.floor(t / 32), i = Math.floor(e / 32), a = this.bits, o = n; o <= i; o++) {
var f = o > n ? 0 : t & 31, s = o < i ? 31 : e & 31, u = (2 << s) - (1 << f);
a[o] |= u;
}
}
}, r.prototype.clear = function() {
for (var t = this.bits.length, e = this.bits, n = 0; n < t; n++)
e[n] = 0;
}, r.prototype.isRange = function(t, e, n) {
if (e < t || t < 0 || e > this.size)
throw new D();
if (e === t)
return !0;
e--;
for (var i = Math.floor(t / 32), a = Math.floor(e / 32), o = this.bits, f = i; f <= a; f++) {
var s = f > i ? 0 : t & 31, u = f < a ? 31 : e & 31, c = (2 << u) - (1 << s) & 4294967295;
if ((o[f] & c) !== (n ? c : 0))
return !1;
}
return !0;
}, r.prototype.appendBit = function(t) {
this.ensureCapacity(this.size + 1), t && (this.bits[Math.floor(this.size / 32)] |= 1 << (this.size & 31)), this.size++;
}, r.prototype.appendBits = function(t, e) {
if (e < 0 || e > 32)
throw new D("Num bits must be between 0 and 32");
this.ensureCapacity(this.size + e);
for (var n = e; n > 0; n--)
this.appendBit((t >> n - 1 & 1) === 1);
}, r.prototype.appendBitArray = function(t) {
var e = t.size;
this.ensureCapacity(this.size + e);
for (var n = 0; n < e; n++)
this.appendBit(t.get(n));
}, r.prototype.xor = function(t) {
if (this.size !== t.size)
throw new D("Sizes don't match");
for (var e = this.bits, n = 0, i = e.length; n < i; n++)
e[n] ^= t.bits[n];
}, r.prototype.toBytes = function(t, e, n, i) {
for (var a = 0; a < i; a++) {
for (var o = 0, f = 0; f < 8; f++)
this.get(t) && (o |= 1 << 7 - f), t++;
e[n + a] = /*(byte)*/
o;
}
}, r.prototype.getBitArray = function() {
return this.bits;
}, r.prototype.reverse = function() {
for (var t = new Int32Array(this.bits.length), e = Math.floor((this.size - 1) / 32), n = e + 1, i = this.bits, a = 0; a < n; a++) {
var o = i[a];
o = o >> 1 & 1431655765 | (o & 1431655765) << 1, o = o >> 2 & 858993459 | (o & 858993459) << 2, o = o >> 4 & 252645135 | (o & 252645135) << 4, o = o >> 8 & 16711935 | (o & 16711935) << 8, o = o >> 16 & 65535 | (o & 65535) << 16, t[e - a] = /*(int)*/
o;
}
if (this.size !== n * 32) {
for (var f = n * 32 - this.size, s = t[0] >>> f, a = 1; a < n; a++) {
var u = t[a];
s |= u << 32 - f, t[a - 1] = s, s = u >>> f;
}
t[n - 1] = s;
}
this.bits = t;
}, r.makeArray = function(t) {
return new Int32Array(Math.floor((t + 31) / 32));
}, r.prototype.equals = function(t) {
if (!(t instanceof r))
return !1;
var e = t;
return this.size === e.size && ot.equals(this.bits, e.bits);
}, r.prototype.hashCode = function() {
return 31 * this.size + ot.hashCode(this.bits);
}, r.prototype.toString = function() {
for (var t = "", e = 0, n = this.size; e < n; e++)
e & 7 || (t += " "), t += this.get(e) ? "X" : ".";
return t;
}, r.prototype.clone = function() {
return new r(this.size, this.bits.slice());
}, r.prototype.toArray = function() {
for (var t = [], e = 0, n = this.size; e < n; e++)
t.push(this.get(e));
return t;
}, r;
}()
), Me;
(function(r) {
r[r.OTHER = 0] = "OTHER", r[r.PURE_BARCODE = 1] = "PURE_BARCODE", r[r.POSSIBLE_FORMATS = 2] = "POSSIBLE_FORMATS", r[r.TRY_HARDER = 3] = "TRY_HARDER", r[r.CHARACTER_SET = 4] = "CHARACTER_SET", r[r.ALLOWED_LENGTHS = 5] = "ALLOWED_LENGTHS", r[r.ASSUME_CODE_39_CHECK_DIGIT = 6] = "ASSUME_CODE_39_CHECK_DIGIT", r[r.ASSUME_GS1 = 7] = "ASSUME_GS1", r[r.RETURN_CODABAR_START_END = 8] = "RETURN_CODABAR_START_END", r[r.NEED_RESULT_POINT_CALLBACK = 9] = "NEED_RESULT_POINT_CALLBACK", r[r.ALLOWED_EAN_EXTENSIONS = 10] = "ALLOWED_EAN_EXTENSIONS";
})(Me || (Me = {}));
const $ = Me;
var hn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), T = (
/** @class */
function(r) {
hn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.getFormatInstance = function() {
return new t();
}, t.kind = "FormatException", t;
}(At)
), dn = globalThis && globalThis.__values || function(r) {
var t = typeof Symbol == "function" && Symbol.iterator, e = t && r[t], n = 0;
if (e)
return e.call(r);
if (r && typeof r.length == "number")
return {
next: function() {
return r && n >= r.length && (r = void 0), { value: r && r[n++], done: !r };
}
};
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}, X;
(function(r) {
r[r.Cp437 = 0] = "Cp437", r[r.ISO8859_1 = 1] = "ISO8859_1", r[r.ISO8859_2 = 2] = "ISO8859_2", r[r.ISO8859_3 = 3] = "ISO8859_3", r[r.ISO8859_4 = 4] = "ISO8859_4", r[r.ISO8859_5 = 5] = "ISO8859_5", r[r.ISO8859_6 = 6] = "ISO8859_6", r[r.ISO8859_7 = 7] = "ISO8859_7", r[r.ISO8859_8 = 8] = "ISO8859_8", r[r.ISO8859_9 = 9] = "ISO8859_9", r[r.ISO8859_10 = 10] = "ISO8859_10", r[r.ISO8859_11 = 11] = "ISO8859_11", r[r.ISO8859_13 = 12] = "ISO8859_13", r[r.ISO8859_14 = 13] = "ISO8859_14", r[r.ISO8859_15 = 14] = "ISO8859_15", r[r.ISO8859_16 = 15] = "ISO8859_16", r[r.SJIS = 16] = "SJIS", r[r.Cp1250 = 17] = "Cp1250", r[r.Cp1251 = 18] = "Cp1251", r[r.Cp1252 = 19] = "Cp1252", r[r.Cp1256 = 20] = "Cp1256", r[r.UnicodeBigUnmarked = 21] = "UnicodeBigUnmarked", r[r.UTF8 = 22] = "UTF8", r[r.ASCII = 23] = "ASCII", r[r.Big5 = 24] = "Big5", r[r.GB18030 = 25] = "GB18030", r[r.EUC_KR = 26] = "EUC_KR";
})(X || (X = {}));
var at = (
/** @class */
function() {
function r(t, e, n) {
for (var i, a, o = [], f = 3; f < arguments.length; f++)
o[f - 3] = arguments[f];
this.valueIdentifier = t, this.name = n, typeof e == "number" ? this.values = Int32Array.from([e]) : this.values = e, this.otherEncodingNames = o, r.VALUE_IDENTIFIER_TO_ECI.set(t, this), r.NAME_TO_ECI.set(n, this);
for (var s = this.values, u = 0, c = s.length; u !== c; u++) {
var l = s[u];
r.VALUES_TO_ECI.set(l, this);
}
try {
for (var h = dn(o), d = h.next(); !d.done; d = h.next()) {
var v = d.value;
r.NAME_TO_ECI.set(v, this);
}
} catch (g) {
i = { error: g };
} finally {
try {
d && !d.done && (a = h.return) && a.call(h);
} finally {
if (i)
throw i.error;
}
}
}
return r.prototype.getValueIdentifier = function() {
return this.valueIdentifier;
}, r.prototype.getName = function() {
return this.name;
}, r.prototype.getValue = function() {
return this.values[0];
}, r.getCharacterSetECIByValue = function(t) {
if (t < 0 || t >= 900)
throw new T("incorect value");
var e = r.VALUES_TO_ECI.get(t);
if (e === void 0)
throw new T("incorect value");
return e;
}, r.getCharacterSetECIByName = function(t) {
var e = r.NAME_TO_ECI.get(t);
if (e === void 0)
throw new T("incorect value");
return e;
}, r.prototype.equals = function(t) {
if (!(t instanceof r))
return !1;
var e = t;
return this.getName() === e.getName();
}, r.VALUE_IDENTIFIER_TO_ECI = /* @__PURE__ */ new Map(), r.VALUES_TO_ECI = /* @__PURE__ */ new Map(), r.NAME_TO_ECI = /* @__PURE__ */ new Map(), r.Cp437 = new r(X.Cp437, Int32Array.from([0, 2]), "Cp437"), r.ISO8859_1 = new r(X.ISO8859_1, Int32Array.from([1, 3]), "ISO-8859-1", "ISO88591", "ISO8859_1"), r.ISO8859_2 = new r(X.ISO8859_2, 4, "ISO-8859-2", "ISO88592", "ISO8859_2"), r.ISO8859_3 = new r(X.ISO8859_3, 5, "ISO-8859-3", "ISO88593", "ISO8859_3"), r.ISO8859_4 = new r(X.ISO8859_4, 6, "ISO-8859-4", "ISO88594", "ISO8859_4"), r.ISO8859_5 = new r(X.ISO8859_5, 7, "ISO-8859-5", "ISO88595", "ISO8859_5"), r.ISO8859_6 = new r(X.ISO8859_6, 8, "ISO-8859-6", "ISO88596", "ISO8859_6"), r.ISO8859_7 = new r(X.ISO8859_7, 9, "ISO-8859-7", "ISO88597", "ISO8859_7"), r.ISO8859_8 = new r(X.ISO8859_8, 10, "ISO-8859-8", "ISO88598", "ISO8859_8"), r.ISO8859_9 = new r(X.ISO8859_9, 11, "ISO-8859-9", "ISO88599", "ISO8859_9"), r.ISO8859_10 = new r(X.ISO8859_10, 12, "ISO-8859-10", "ISO885910", "ISO8859_10"), r.ISO8859_11 = new r(X.ISO8859_11, 13, "ISO-8859-11", "ISO885911", "ISO8859_11"), r.ISO8859_13 = new r(X.ISO8859_13, 15, "ISO-8859-13", "ISO885913", "ISO8859_13"), r.ISO8859_14 = new r(X.ISO8859_14, 16, "ISO-8859-14", "ISO885914", "ISO8859_14"), r.ISO8859_15 = new r(X.ISO8859_15, 17, "ISO-8859-15", "ISO885915", "ISO8859_15"), r.ISO8859_16 = new r(X.ISO8859_16, 18, "ISO-8859-16", "ISO885916", "ISO8859_16"), r.SJIS = new r(X.SJIS, 20, "SJIS", "Shift_JIS"), r.Cp1250 = new r(X.Cp1250, 21, "Cp1250", "windows-1250"), r.Cp1251 = new r(X.Cp1251, 22, "Cp1251", "windows-1251"), r.Cp1252 = new r(X.Cp1252, 23, "Cp1252", "windows-1252"), r.Cp1256 = new r(X.Cp1256, 24, "Cp1256", "windows-1256"), r.UnicodeBigUnmarked = new r(X.UnicodeBigUnmarked, 25, "UnicodeBigUnmarked", "UTF-16BE", "UnicodeBig"), r.UTF8 = new r(X.UTF8, 26, "UTF8", "UTF-8"), r.ASCII = new r(X.ASCII, Int32Array.from([27, 170]), "ASCII", "US-ASCII"), r.Big5 = new r(X.Big5, 28, "Big5"), r.GB18030 = new r(X.GB18030, 29, "GB18030", "GB2312", "EUC_CN", "GBK"), r.EUC_KR = new r(X.EUC_KR, 30, "EUC_KR", "EUC-KR"), r;
}()
), vn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), ue = (
/** @class */
function(r) {
vn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.kind = "UnsupportedOperationException", t;
}(At)
), It = (
/** @class */
function() {
function r() {
}
return r.decode = function(t, e) {
var n = this.encodingName(e);
return this.customDecoder ? this.customDecoder(t, n) : typeof TextDecoder > "u" || this.shouldDecodeOnFallback(n) ? this.decodeFallback(t, n) : new TextDecoder(n).decode(t);
}, r.shouldDecodeOnFallback = function(t) {
return !r.isBrowser() && t === "ISO-8859-1";
}, r.encode = function(t, e) {
var n = this.encodingName(e);
return this.customEncoder ? this.customEncoder(t, n) : typeof TextEncoder > "u" ? this.encodeFallback(t) : new TextEncoder().encode(t);
}, r.isBrowser = function() {
return typeof window < "u" && {}.toString.call(window) === "[object Window]";
}, r.encodingName = function(t) {
return typeof t == "string" ? t : t.getName();
}, r.encodingCharacterSet = function(t) {
return t instanceof at ? t : at.getCharacterSetECIByName(t);
}, r.decodeFallback = function(t, e) {
var n = this.encodingCharacterSet(e);
if (r.isDecodeFallbackSupported(n)) {
for (var i = "", a = 0, o = t.length; a < o; a++) {
var f = t[a].toString(16);
f.length < 2 && (f = "0" + f), i += "%" + f;
}
return decodeURIComponent(i);
}
if (n.equals(at.UnicodeBigUnmarked))
return String.fromCharCode.apply(null, new Uint16Array(t.buffer));
throw new ue("Encoding " + this.encodingName(e) + " not supported by fallback.");
}, r.isDecodeFallbackSupported = function(t) {
return t.equals(at.UTF8) || t.equals(at.ISO8859_1) || t.equals(at.ASCII);
}, r.encodeFallback = function(t) {
for (var e = btoa(unescape(encodeURIComponent(t))), n = e.split(""), i = [], a = 0; a < n.length; a++)
i.push(n[a].charCodeAt(0));
return new Uint8Array(i);
}, r;
}()
), F = (
/** @class */
function() {
function r() {
}
return r.castAsNonUtf8Char = function(t, e) {
e === void 0 && (e = null);
var n = e ? e.getName() : this.ISO88591;
return It.decode(new Uint8Array([t]), n);
}, r.guessEncoding = function(t, e) {
if (e != null && e.get($.CHARACTER_SET) !== void 0)
return e.get($.CHARACTER_SET).toString();
for (var n = t.length, i = !0, a = !0, o = !0, f = 0, s = 0, u = 0, c = 0, l = 0, h = 0, d = 0, v = 0, g = 0, x = 0, w = 0, y = t.length > 3 && t[0] === /*(byte) */
239 && t[1] === /*(byte) */
187 && t[2] === /*(byte) */
191, _ = 0; _ < n && (i || a || o); _++) {
var E = t[_] & 255;
o && (f > 0 ? E & 128 ? f-- : o = !1 : E & 128 && (E & 64 ? (f++, E & 32 ? (f++, E & 16 ? (f++, E & 8 ? o = !1 : c++) : u++) : s++) : o = !1)), i && (E > 127 && E < 160 ? i = !1 : E > 159 && (E < 192 || E === 215 || E === 247) && w++), a && (l > 0 ? E < 64 || E === 127 || E > 252 ? a = !1 : l-- : E === 128 || E === 160 || E > 239 ? a = !1 : E > 160 && E < 224 ? (h++, v = 0, d++, d > g && (g = d)) : E > 127 ? (l++, d = 0, v++, v > x && (x = v)) : (d = 0, v = 0));
}
return o && f > 0 && (o = !1), a && l > 0 && (a = !1), o && (y || s + u + c > 0) ? r.UTF8 : a && (r.ASSUME_SHIFT_JIS || g >= 3 || x >= 3) ? r.SHIFT_JIS : i && a ? g === 2 && h === 2 || w * 10 >= n ? r.SHIFT_JIS : r.ISO88591 : i ? r.ISO88591 : a ? r.SHIFT_JIS : o ? r.UTF8 : r.PLATFORM_DEFAULT_ENCODING;
}, r.format = function(t) {
for (var e = [], n = 1; n < arguments.length; n++)
e[n - 1] = arguments[n];
var i = -1;
function a(f, s, u, c, l, h) {
if (f === "%%")
return "%";
if (e[++i] !== void 0) {
f = c ? parseInt(c.substr(1)) : void 0;
var d = l ? parseInt(l.substr(1)) : void 0, v;
switch (h) {
case "s":
v = e[i];
break;
case "c":
v = e[i][0];
break;
case "f":
v = parseFloat(e[i]).toFixed(f);
break;
case "p":
v = parseFloat(e[i]).toPrecision(f);
break;
case "e":
v = parseFloat(e[i]).toExponential(f);
break;
case "x":
v = parseInt(e[i]).toString(d || 16);
break;
case "d":
v = parseFloat(parseInt(e[i], d || 10).toPrecision(f)).toFixed(0);
break;
}
v = typeof v == "object" ? JSON.stringify(v) : (+v).toString(d);
for (var g = parseInt(u), x = u && u[0] + "" == "0" ? "0" : " "; v.length < g; )
v = s !== void 0 ? v + x : x + v;
return v;
}
}
var o = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;
return t.replace(o, a);
}, r.getBytes = function(t, e) {
return It.encode(t, e);
}, r.getCharCode = function(t, e) {
return e === void 0 && (e = 0), t.charCodeAt(e);
}, r.getCharAt = function(t) {
return String.fromCharCode(t);
}, r.SHIFT_JIS = at.SJIS.getName(), r.GB2312 = "GB2312", r.ISO88591 = at.ISO8859_1.getName(), r.EUC_JP = "EUC_JP", r.UTF8 = at.UTF8.getName(), r.PLATFORM_DEFAULT_ENCODING = r.UTF8, r.ASSUME_SHIFT_JIS = !1, r;
}()
), M = (
/** @class */
function() {
function r(t) {
t === void 0 && (t = ""), this.value = t;
}
return r.prototype.enableDecoding = function(t) {
return this.encoding = t, this;
}, r.prototype.append = function(t) {
return typeof t == "string" ? this.value += t.toString() : this.encoding ? this.value += F.castAsNonUtf8Char(t, this.encoding) : this.value += String.fromCharCode(t), this;
}, r.prototype.appendChars = function(t, e, n) {
for (var i = e; e < e + n; i++)
this.append(t[i]);
return this;
}, r.prototype.length = function() {
return this.value.length;
}, r.prototype.charAt = function(t) {
return this.value.charAt(t);
}, r.prototype.deleteCharAt = function(t) {
this.value = this.value.substr(0, t) + this.value.substring(t + 1);
}, r.prototype.setCharAt = function(t, e) {
this.value = this.value.substr(0, t) + e + this.value.substr(t + 1);
}, r.prototype.substring = function(t, e) {
return this.value.substring(t, e);
}, r.prototype.setLengthToZero = function() {
this.value = "";
}, r.prototype.toString = function() {
return this.value;
}, r.prototype.insert = function(t, e) {
this.value = this.value.substring(0, t) + e + this.value.substring(t);
}, r;
}()
), Nt = (
/** @class */
function() {
function r(t, e, n, i) {
if (this.width = t, this.height = e, this.rowSize = n, this.bits = i, e == null && (e = t), this.height = e, t < 1 || e < 1)
throw new D("Both dimensions must be greater than 0");
n == null && (n = Math.floor((t + 31) / 32)), this.rowSize = n, i == null && (this.bits = new Int32Array(this.rowSize * this.height));
}
return r.parseFromBooleanArray = function(t) {
for (var e = t.length, n = t[0].length, i = new r(n, e), a = 0; a < e; a++)
for (var o = t[a], f = 0; f < n; f++)
o[f] && i.set(f, a);
return i;
}, r.parseFromString = function(t, e, n) {
if (t === null)
throw new D("stringRepresentation cannot be null");
for (var i = new Array(t.length), a = 0, o = 0, f = -1, s = 0, u = 0; u < t.length; )
if (t.charAt(u) === `
` || t.charAt(u) === "\r") {
if (a > o) {
if (f === -1)
f = a - o;
else if (a - o !== f)
throw new D("row lengths do not match");
o = a, s++;
}
u++;
} else if (t.substring(u, u + e.length) === e)
u += e.length, i[a] = !0, a++;
else if (t.substring(u, u + n.length) === n)
u += n.length, i[a] = !1, a++;
else
throw new D("illegal character encountered: " + t.substring(u));
if (a > o) {
if (f === -1)
f = a - o;
else if (a - o !== f)
throw new D("row lengths do not match");
s++;
}
for (var c = new r(f, s), l = 0; l < a; l++)
i[l] && c.set(Math.floor(l % f), Math.floor(l / f));
return c;
}, r.prototype.get = function(t, e) {
var n = e * this.rowSize + Math.floor(t / 32);
return (this.bits[n] >>> (t & 31) & 1) !== 0;
}, r.prototype.set = function(t, e) {
var n = e * this.rowSize + Math.floor(t / 32);
this.bits[n] |= 1 << (t & 31) & 4294967295;
}, r.prototype.unset = function(t, e) {
var n = e * this.rowSize + Math.floor(t / 32);
this.bits[n] &= ~(1 << (t & 31) & 4294967295);
}, r.prototype.flip = function(t, e) {
var n = e * this.rowSize + Math.floor(t / 32);
this.bits[n] ^= 1 << (t & 31) & 4294967295;
}, r.prototype.xor = function(t) {
if (this.width !== t.getWidth() || this.height !== t.getHeight() || this.rowSize !== t.getRowSize())
throw new D("input matrix dimensions do not match");
for (var e = new ct(Math.floor(this.width / 32) + 1), n = this.rowSize, i = this.bits, a = 0, o = this.height; a < o; a++)
for (var f = a * n, s = t.getRow(a, e).getBitArray(), u = 0; u < n; u++)
i[f + u] ^= s[u];
}, r.prototype.clear = function() {
for (var t = this.bits, e = t.length, n = 0; n < e; n++)
t[n] = 0;
}, r.prototype.setRegion = function(t, e, n, i) {
if (e < 0 || t < 0)
throw new D("Left and top must be nonnegative");
if (i < 1 || n < 1)
throw new D("Height and width must be at least 1");
var a = t + n, o = e + i;
if (o > this.height || a > this.width)
throw new D("The region must fit inside the matrix");
for (var f = this.rowSize, s = this.bits, u = e; u < o; u++)
for (var c = u * f, l = t; l < a; l++)
s[c + Math.floor(l / 32)] |= 1 << (l & 31) & 4294967295;
}, r.prototype.getRow = function(t, e) {
e == null || e.getSize() < this.width ? e = new ct(this.width) : e.clear();
for (var n = this.rowSize, i = this.bits, a = t * n, o = 0; o < n; o++)
e.setBulk(o * 32, i[a + o]);
return e;
}, r.prototype.setRow = function(t, e) {
j.arraycopy(e.getBitArray(), 0, this.bits, t * this.rowSize, this.rowSize);
}, r.prototype.rotate180 = function() {
for (var t = this.getWidth(), e = this.getHeight(), n = new ct(t), i = new ct(t), a = 0, o = Math.floor((e + 1) / 2); a < o; a++)
n = this.getRow(a, n), i = this.getRow(e - 1 - a, i), n.reverse(), i.reverse(), this.setRow(a, i), this.setRow(e - 1 - a, n);
}, r.prototype.getEnclosingRectangle = function() {
for (var t = this.width, e = this.height, n = this.rowSize, i = this.bits, a = t, o = e, f = -1, s = -1, u = 0; u < e; u++)
for (var c = 0; c < n; c++) {
var l = i[u * n + c];
if (l !== 0) {
if (u < o && (o = u), u > s && (s = u), c * 32 < a) {
for (var h = 0; !(l << 31 - h & 4294967295); )
h++;
c * 32 + h < a && (a = c * 32 + h);
}
if (c * 32 + 31 > f) {
for (var h = 31; !(l >>> h); )
h--;
c * 32 + h > f && (f = c * 32 + h);
}
}
}
return f < a || s < o ? null : Int32Array.from([a, o, f - a + 1, s - o + 1]);
}, r.prototype.getTopLeftOnBit = function() {
for (var t = this.rowSize, e = this.bits, n = 0; n < e.length && e[n] === 0; )
n++;
if (n === e.length)
return null;
for (var i = n / t, a = n % t * 32, o = e[n], f = 0; !(o << 31 - f & 4294967295); )
f++;
return a += f, Int32Array.from([a, i]);
}, r.prototype.getBottomRightOnBit = function() {
for (var t = this.rowSize, e = this.bits, n = e.length - 1; n >= 0 && e[n] === 0; )
n--;
if (n < 0)
return null;
for (var i = Math.floor(n / t), a = Math.floor(n % t) * 32, o = e[n], f = 31; !(o >>> f); )
f--;
return a += f, Int32Array.from([a, i]);
}, r.prototype.getWidth = function() {
return this.width;
}, r.prototype.getHeight = function() {
return this.height;
}, r.prototype.getRowSize = function() {
return this.rowSize;
}, r.prototype.equals = function(t) {
if (!(t instanceof r))
return !1;
var e = t;
return this.width === e.width && this.height === e.height && this.rowSize === e.rowSize && ot.equals(this.bits, e.bits);
}, r.prototype.hashCode = function() {
var t = this.width;
return t = 31 * t + this.width, t = 31 * t + this.height, t = 31 * t + this.rowSize, t = 31 * t + ot.hashCode(this.bits), t;
}, r.prototype.toString = function(t, e, n) {
return t === void 0 && (t = "X "), e === void 0 && (e = " "), n === void 0 && (n = `
`), this.buildToString(t, e, n);
}, r.prototype.buildToString = function(t, e, n) {
for (var i = new M(), a = 0, o = this.height; a < o; a++) {
for (var f = 0, s = this.width; f < s; f++)
i.append(this.get(f, a) ? t : e);
i.append(n);
}
return i.toString();
}, r.prototype.clone = function() {
return new r(this.width, this.height, this.rowSize, this.bits.slice());
}, r;
}()
), pn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), C = (
/** @class */
function(r) {
pn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.getNotFoundInstance = function() {
return new t();
}, t.kind = "NotFoundException", t;
}(At)
), gn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), xn = (
/** @class */
function(r) {
gn(t, r);
function t(e) {
var n = r.call(this, e) || this;
return n.luminances = t.EMPTY, n.buckets = new Int32Array(t.LUMINANCE_BUCKETS), n;
}
return t.prototype.getBlackRow = function(e, n) {
var i = this.getLuminanceSource(), a = i.getWidth();
n == null || n.getSize() < a ? n = new ct(a) : n.clear(), this.initArrays(a);
for (var o = i.getRow(e, this.luminances), f = this.buckets, s = 0; s < a; s++)
f[(o[s] & 255) >> t.LUMINANCE_SHIFT]++;
var u = t.estimateBlackPoint(f);
if (a < 3)
for (var s = 0; s < a; s++)
(o[s] & 255) < u && n.set(s);
else
for (var c = o[0] & 255, l = o[1] & 255, s = 1; s < a - 1; s++) {
var h = o[s + 1] & 255;
(l * 4 - c - h) / 2 < u && n.set(s), c = l, l = h;
}
return n;
}, t.prototype.getBlackMatrix = function() {
var e = this.getLuminanceSource(), n = e.getWidth(), i = e.getHeight(), a = new Nt(n, i);
this.initArrays(n);
for (var o = this.buckets, f = 1; f < 5; f++)
for (var s = Math.floor(i * f / 5), u = e.getRow(s, this.luminances), c = Math.floor(n * 4 / 5), l = Math.floor(n / 5); l < c; l++) {
var h = u[l] & 255;
o[h >> t.LUMINANCE_SHIFT]++;
}
for (var d = t.estimateBlackPoint(o), v = e.getMatrix(), f = 0; f < i; f++)
for (var g = f * n, l = 0; l < n; l++) {
var h = v[g + l] & 255;
h < d && a.set(l, f);
}
return a;
}, t.prototype.createBinarizer = function(e) {
return new t(e);
}, t.prototype.initArrays = function(e) {
this.luminances.length < e && (this.luminances = new Uint8ClampedArray(e));
for (var n = this.buckets, i = 0; i < t.LUMINANCE_BUCKETS; i++)
n[i] = 0;
}, t.estimateBlackPoint = function(e) {
for (var n = e.length, i = 0, a = 0, o = 0, f = 0; f < n; f++)
e[f] > o && (a = f, o = e[f]), e[f] > i && (i = e[f]);
for (var s = 0, u = 0, f = 0; f < n; f++) {
var c = f - a, l = e[f] * c * c;
l > u && (s = f, u = l);
}
if (a > s) {
var h = a;
a = s, s = h;
}
if (s - a <= n / 16)
throw new C();
for (var d = s - 1, v = -1, f = s - 1; f > a; f--) {
var g = f - a, l = g * g * (s - f) * (i - e[f]);
l > v && (d = f, v = l);
}
return d << t.LUMINANCE_SHIFT;
}, t.LUMINANCE_BITS = 5, t.LUMINANCE_SHIFT = 8 - t.LUMINANCE_BITS, t.LUMINANCE_BUCKETS = 1 << t.LUMINANCE_BITS, t.EMPTY = Uint8ClampedArray.from([0]), t;
}(sn)
), yn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), Fr = (
/** @class */
function(r) {
yn(t, r);
function t(e) {
var n = r.call(this, e) || this;
return n.matrix = null, n;
}
return t.prototype.getBlackMatrix = function() {
if (this.matrix !== null)
return this.matrix;
var e = this.getLuminanceSource(), n = e.getWidth(), i = e.getHeight();
if (n >= t.MINIMUM_DIMENSION && i >= t.MINIMUM_DIMENSION) {
var a = e.getMatrix(), o = n >> t.BLOCK_SIZE_POWER;
n & t.BLOCK_SIZE_MASK && o++;
var f = i >> t.BLOCK_SIZE_POWER;
i & t.BLOCK_SIZE_MASK && f++;
var s = t.calculateBlackPoints(a, o, f, n, i), u = new Nt(n, i);
t.calculateThresholdForBlock(a, o, f, n, i, s, u), this.matrix = u;
} else
this.matrix = r.prototype.getBlackMatrix.call(this);
return this.matrix;
}, t.prototype.createBinarizer = function(e) {
return new t(e);
}, t.calculateThresholdForBlock = function(e, n, i, a, o, f, s) {
for (var u = o - t.BLOCK_SIZE, c = a - t.BLOCK_SIZE, l = 0; l < i; l++) {
var h = l << t.BLOCK_SIZE_POWER;
h > u && (h = u);
for (var d = t.cap(l, 2, i - 3), v = 0; v < n; v++) {
var g = v << t.BLOCK_SIZE_POWER;
g > c && (g = c);
for (var x = t.cap(v, 2, n - 3), w = 0, y = -2; y <= 2; y++) {
var _ = f[d + y];
w += _[x - 2] + _[x - 1] + _[x] + _[x + 1] + _[x + 2];
}
var E = w / 25;
t.thresholdBlock(e, g, h, E, a, s);
}
}
}, t.cap = function(e, n, i) {
return e < n ? n : e > i ? i : e;
}, t.thresholdBlock = function(e, n, i, a, o, f) {
for (var s = 0, u = i * o + n; s < t.BLOCK_SIZE; s++, u += o)
for (var c = 0; c < t.BLOCK_SIZE; c++)
(e[u + c] & 255) <= a && f.set(n + c, i + s);
}, t.calculateBlackPoints = function(e, n, i, a, o) {
for (var f = o - t.BLOCK_SIZE, s = a - t.BLOCK_SIZE, u = new Array(i), c = 0; c < i; c++) {
u[c] = new Int32Array(n);
var l = c << t.BLOCK_SIZE_POWER;
l > f && (l = f);
for (var h = 0; h < n; h++) {
var d = h << t.BLOCK_SIZE_POWER;
d > s && (d = s);
for (var v = 0, g = 255, x = 0, w = 0, y = l * a + d; w < t.BLOCK_SIZE; w++, y += a) {
for (var _ = 0; _ < t.BLOCK_SIZE; _++) {
var E = e[y + _] & 255;
v += E, E < g && (g = E), E > x && (x = E);
}
if (x - g > t.MIN_DYNAMIC_RANGE)
for (w++, y += a; w < t.BLOCK_SIZE; w++, y += a)
for (var _ = 0; _ < t.BLOCK_SIZE; _++)
v += e[y + _] & 255;
}
var m = v >> t.BLOCK_SIZE_POWER * 2;
if (x - g <= t.MIN_DYNAMIC_RANGE && (m = g / 2, c > 0 && h > 0)) {
var I = (u[c - 1][h] + 2 * u[c][h - 1] + u[c - 1][h - 1]) / 4;
g < I && (m = I);
}
u[c][h] = m;
}
}
return u;
}, t.BLOCK_SIZE_POWER = 3, t.BLOCK_SIZE = 1 << t.BLOCK_SIZE_POWER, t.BLOCK_SIZE_MASK = t.BLOCK_SIZE - 1, t.MINIMUM_DIMENSION = t.BLOCK_SIZE * 5, t.MIN_DYNAMIC_RANGE = 24, t;
}(xn)
), ie = (
/** @class */
function() {
function r(t, e) {
this.width = t, this.height = e;
}
return r.prototype.getWidth = function() {
return this.width;
}, r.prototype.getHeight = function() {
return this.height;
}, r.prototype.isCropSupported = function() {
return !1;
}, r.prototype.crop = function(t, e, n, i) {
throw new ue("This luminance source does not support cropping.");
}, r.prototype.isRotateSupported = function() {
return !1;
}, r.prototype.rotateCounterClockwise = function() {
throw new ue("This luminance source does not support rotation by 90 degrees.");
}, r.prototype.rotateCounterClockwise45 = function() {
throw new ue("This luminance source does not support rotation by 45 degrees.");
}, r.prototype.toString = function() {
for (var t = new Uint8ClampedArray(this.width), e = new M(), n = 0; n < this.height; n++) {
for (var i = this.getRow(n, t), a = 0; a < this.width; a++) {
var o = i[a] & 255, f = void 0;
o < 64 ? f = "#" : o < 128 ? f = "+" : o < 192 ? f = "." : f = " ", e.append(f);
}
e.append(`
`);
}
return e.toString();
}, r;
}()
), wn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), ye = (
/** @class */
function(r) {
wn(t, r);
function t(e) {
var n = r.call(this, e.getWidth(), e.getHeight()) || this;
return n.delegate = e, n;
}
return t.prototype.getRow = function(e, n) {
for (var i = this.delegate.getRow(e, n), a = this.getWidth(), o = 0; o < a; o++)
i[o] = /*(byte)*/
255 - (i[o] & 255);
return i;
}, t.prototype.getMatrix = function() {
for (var e = this.delegate.getMatrix(), n = this.getWidth() * this.getHeight(), i = new Uint8ClampedArray(n), a = 0; a < n; a++)
i[a] = /*(byte)*/
255 - (e[a] & 255);
return i;
}, t.prototype.isCropSupported = function() {
return this.delegate.isCropSupported();
}, t.prototype.crop = function(e, n, i, a) {
return new t(this.delegate.crop(e, n, i, a));
}, t.prototype.isRotateSupported = function() {
return this.delegate.isRotateSupported();
}, t.prototype.invert = function() {
return this.delegate;
}, t.prototype.rotateCounterClockwise = function() {
return new t(this.delegate.rotateCounterClockwise());
}, t.prototype.rotateCounterClockwise45 = function() {
return new t(this.delegate.rotateCounterClockwise45());
}, t;
}(ie)
), _n = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), An = (
/** @class */
function(r) {
_n(t, r);
function t(e) {
var n = r.call(this, e.width, e.height) || this;
return n.canvas = e, n.tempCanvasElement = null, n.buffer = t.makeBufferFromCanvasImageData(e), n;
}
return t.makeBufferFromCanvasImageData = function(e) {
var n = e.getContext("2d").getImageData(0, 0, e.width, e.height);
return t.toGrayscaleBuffer(n.data, e.width, e.height);
}, t.toGrayscaleBuffer = function(e, n, i) {
var a = new Uint8ClampedArray(n * i);
if (t.FRAME_INDEX = !t.FRAME_INDEX, t.FRAME_INDEX)
for (var o = 0, f = 0, s = e.length; o < s; o += 4, f++) {
var u = void 0, c = e[o + 3];
if (c === 0)
u = 255;
else {
var l = e[o], h = e[o + 1], d = e[o + 2];
u = 306 * l + 601 * h + 117 * d + 512 >> 10;
}
a[f] = u;
}
else
for