omezarr-tilesource 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1950 @@
1
+ import { n as e, t } from "./dist-DIvEDGnZ.js";
2
+ import { _ as n } from "./__vite-browser-external-YbutIfMq-Cv1_GH0S.js";
3
+ //#region node_modules/.pnpm/vite-plugin-node-polyfills@0.28.0_vite@8.0.14_yaml@2.9.0_/node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.js
4
+ var r = {}, i = {};
5
+ i.byteLength = f, i.toByteArray = m, i.fromByteArray = _;
6
+ for (var a = [], o = [], s = typeof Uint8Array < "u" ? Uint8Array : Array, c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", l = 0, u = c.length; l < u; ++l) a[l] = c[l], o[c.charCodeAt(l)] = l;
7
+ o[45] = 62, o[95] = 63;
8
+ function d(e) {
9
+ var t = e.length;
10
+ if (t % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4");
11
+ var n = e.indexOf("=");
12
+ n === -1 && (n = t);
13
+ var r = n === t ? 0 : 4 - n % 4;
14
+ return [n, r];
15
+ }
16
+ function f(e) {
17
+ var t = d(e), n = t[0], r = t[1];
18
+ return (n + r) * 3 / 4 - r;
19
+ }
20
+ function p(e, t, n) {
21
+ return (t + n) * 3 / 4 - n;
22
+ }
23
+ function m(e) {
24
+ var t, n = d(e), r = n[0], i = n[1], a = new s(p(e, r, i)), c = 0, l = i > 0 ? r - 4 : r, u;
25
+ for (u = 0; u < l; u += 4) t = o[e.charCodeAt(u)] << 18 | o[e.charCodeAt(u + 1)] << 12 | o[e.charCodeAt(u + 2)] << 6 | o[e.charCodeAt(u + 3)], a[c++] = t >> 16 & 255, a[c++] = t >> 8 & 255, a[c++] = t & 255;
26
+ return i === 2 && (t = o[e.charCodeAt(u)] << 2 | o[e.charCodeAt(u + 1)] >> 4, a[c++] = t & 255), i === 1 && (t = o[e.charCodeAt(u)] << 10 | o[e.charCodeAt(u + 1)] << 4 | o[e.charCodeAt(u + 2)] >> 2, a[c++] = t >> 8 & 255, a[c++] = t & 255), a;
27
+ }
28
+ function h(e) {
29
+ return a[e >> 18 & 63] + a[e >> 12 & 63] + a[e >> 6 & 63] + a[e & 63];
30
+ }
31
+ function g(e, t, n) {
32
+ for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(h(r));
33
+ return i.join("");
34
+ }
35
+ function _(e) {
36
+ for (var t, n = e.length, r = n % 3, i = [], o = 16383, s = 0, c = n - r; s < c; s += o) i.push(g(e, s, s + o > c ? c : s + o));
37
+ return r === 1 ? (t = e[n - 1], i.push(a[t >> 2] + a[t << 4 & 63] + "==")) : r === 2 && (t = (e[n - 2] << 8) + e[n - 1], i.push(a[t >> 10] + a[t >> 4 & 63] + a[t << 2 & 63] + "=")), i.join("");
38
+ }
39
+ var v = {};
40
+ v.read = function(e, t, n, r, i) {
41
+ var a, o, s = i * 8 - r - 1, c = (1 << s) - 1, l = c >> 1, u = -7, d = n ? i - 1 : 0, f = n ? -1 : 1, p = e[t + d];
42
+ for (d += f, a = p & (1 << -u) - 1, p >>= -u, u += s; u > 0; a = a * 256 + e[t + d], d += f, u -= 8);
43
+ for (o = a & (1 << -u) - 1, a >>= -u, u += r; u > 0; o = o * 256 + e[t + d], d += f, u -= 8);
44
+ if (a === 0) a = 1 - l;
45
+ else if (a === c) return o ? NaN : (p ? -1 : 1) * Infinity;
46
+ else o += 2 ** r, a -= l;
47
+ return (p ? -1 : 1) * o * 2 ** (a - r);
48
+ }, v.write = function(e, t, n, r, i, a) {
49
+ var o, s, c, l = a * 8 - i - 1, u = (1 << l) - 1, d = u >> 1, f = i === 23 ? 2 ** -24 - 2 ** -77 : 0, p = r ? 0 : a - 1, m = r ? 1 : -1, h = +(t < 0 || t === 0 && 1 / t < 0);
50
+ for (t = Math.abs(t), isNaN(t) || t === Infinity ? (s = +!!isNaN(t), o = u) : (o = Math.floor(Math.log(t) / Math.LN2), t * (c = 2 ** -o) < 1 && (o--, c *= 2), o + d >= 1 ? t += f / c : t += f * 2 ** (1 - d), t * c >= 2 && (o++, c /= 2), o + d >= u ? (s = 0, o = u) : o + d >= 1 ? (s = (t * c - 1) * 2 ** i, o += d) : (s = t * 2 ** (d - 1) * 2 ** i, o = 0)); i >= 8; e[n + p] = s & 255, p += m, s /= 256, i -= 8);
51
+ for (o = o << i | s, l += i; l > 0; e[n + p] = o & 255, p += m, o /= 256, l -= 8);
52
+ e[n + p - m] |= h * 128;
53
+ }, (function(e) {
54
+ let t = i, n = v, r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
55
+ e.Buffer = d, e.SlowBuffer = S, e.INSPECT_MAX_BYTES = 50;
56
+ let a = 2147483647;
57
+ e.kMaxLength = a;
58
+ let { Uint8Array: o, ArrayBuffer: s, SharedArrayBuffer: c } = globalThis;
59
+ d.TYPED_ARRAY_SUPPORT = l(), !d.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
60
+ function l() {
61
+ try {
62
+ let e = new o(1), t = { foo: function() {
63
+ return 42;
64
+ } };
65
+ return Object.setPrototypeOf(t, o.prototype), Object.setPrototypeOf(e, t), e.foo() === 42;
66
+ } catch {
67
+ return !1;
68
+ }
69
+ }
70
+ Object.defineProperty(d.prototype, "parent", {
71
+ enumerable: !0,
72
+ get: function() {
73
+ if (d.isBuffer(this)) return this.buffer;
74
+ }
75
+ }), Object.defineProperty(d.prototype, "offset", {
76
+ enumerable: !0,
77
+ get: function() {
78
+ if (d.isBuffer(this)) return this.byteOffset;
79
+ }
80
+ });
81
+ function u(e) {
82
+ if (e > a) throw RangeError("The value \"" + e + "\" is invalid for option \"size\"");
83
+ let t = new o(e);
84
+ return Object.setPrototypeOf(t, d.prototype), t;
85
+ }
86
+ function d(e, t, n) {
87
+ if (typeof e == "number") {
88
+ if (typeof t == "string") throw TypeError("The \"string\" argument must be of type string. Received type number");
89
+ return h(e);
90
+ }
91
+ return f(e, t, n);
92
+ }
93
+ d.poolSize = 8192;
94
+ function f(e, t, n) {
95
+ if (typeof e == "string") return g(e, t);
96
+ if (s.isView(e)) return y(e);
97
+ if (e == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
98
+ if (X(e, s) || e && X(e.buffer, s) || c !== void 0 && (X(e, c) || e && X(e.buffer, c))) return b(e, t, n);
99
+ if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type number");
100
+ let r = e.valueOf && e.valueOf();
101
+ if (r != null && r !== e) return d.from(r, t, n);
102
+ let i = ee(e);
103
+ if (i) return i;
104
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof e[Symbol.toPrimitive] == "function") return d.from(e[Symbol.toPrimitive]("string"), t, n);
105
+ throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
106
+ }
107
+ d.from = function(e, t, n) {
108
+ return f(e, t, n);
109
+ }, Object.setPrototypeOf(d.prototype, o.prototype), Object.setPrototypeOf(d, o);
110
+ function p(e) {
111
+ if (typeof e != "number") throw TypeError("\"size\" argument must be of type number");
112
+ if (e < 0) throw RangeError("The value \"" + e + "\" is invalid for option \"size\"");
113
+ }
114
+ function m(e, t, n) {
115
+ return p(e), e <= 0 || t === void 0 ? u(e) : typeof n == "string" ? u(e).fill(t, n) : u(e).fill(t);
116
+ }
117
+ d.alloc = function(e, t, n) {
118
+ return m(e, t, n);
119
+ };
120
+ function h(e) {
121
+ return p(e), u(e < 0 ? 0 : x(e) | 0);
122
+ }
123
+ d.allocUnsafe = function(e) {
124
+ return h(e);
125
+ }, d.allocUnsafeSlow = function(e) {
126
+ return h(e);
127
+ };
128
+ function g(e, t) {
129
+ if ((typeof t != "string" || t === "") && (t = "utf8"), !d.isEncoding(t)) throw TypeError("Unknown encoding: " + t);
130
+ let n = C(e, t) | 0, r = u(n), i = r.write(e, t);
131
+ return i !== n && (r = r.slice(0, i)), r;
132
+ }
133
+ function _(e) {
134
+ let t = e.length < 0 ? 0 : x(e.length) | 0, n = u(t);
135
+ for (let r = 0; r < t; r += 1) n[r] = e[r] & 255;
136
+ return n;
137
+ }
138
+ function y(e) {
139
+ if (X(e, o)) {
140
+ let t = new o(e);
141
+ return b(t.buffer, t.byteOffset, t.byteLength);
142
+ }
143
+ return _(e);
144
+ }
145
+ function b(e, t, n) {
146
+ if (t < 0 || e.byteLength < t) throw RangeError("\"offset\" is outside of buffer bounds");
147
+ if (e.byteLength < t + (n || 0)) throw RangeError("\"length\" is outside of buffer bounds");
148
+ let r;
149
+ return r = t === void 0 && n === void 0 ? new o(e) : n === void 0 ? new o(e, t) : new o(e, t, n), Object.setPrototypeOf(r, d.prototype), r;
150
+ }
151
+ function ee(e) {
152
+ if (d.isBuffer(e)) {
153
+ let t = x(e.length) | 0, n = u(t);
154
+ return n.length === 0 || e.copy(n, 0, 0, t), n;
155
+ }
156
+ if (e.length !== void 0) return typeof e.length != "number" || Z(e.length) ? u(0) : _(e);
157
+ if (e.type === "Buffer" && Array.isArray(e.data)) return _(e.data);
158
+ }
159
+ function x(e) {
160
+ if (e >= a) throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + a.toString(16) + " bytes");
161
+ return e | 0;
162
+ }
163
+ function S(e) {
164
+ return +e != e && (e = 0), d.alloc(+e);
165
+ }
166
+ d.isBuffer = function(e) {
167
+ return e != null && e._isBuffer === !0 && e !== d.prototype;
168
+ }, d.compare = function(e, t) {
169
+ if (X(e, o) && (e = d.from(e, e.offset, e.byteLength)), X(t, o) && (t = d.from(t, t.offset, t.byteLength)), !d.isBuffer(e) || !d.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
170
+ if (e === t) return 0;
171
+ let n = e.length, r = t.length;
172
+ for (let i = 0, a = Math.min(n, r); i < a; ++i) if (e[i] !== t[i]) {
173
+ n = e[i], r = t[i];
174
+ break;
175
+ }
176
+ return n < r ? -1 : +(r < n);
177
+ }, d.isEncoding = function(e) {
178
+ switch (String(e).toLowerCase()) {
179
+ case "hex":
180
+ case "utf8":
181
+ case "utf-8":
182
+ case "ascii":
183
+ case "latin1":
184
+ case "binary":
185
+ case "base64":
186
+ case "ucs2":
187
+ case "ucs-2":
188
+ case "utf16le":
189
+ case "utf-16le": return !0;
190
+ default: return !1;
191
+ }
192
+ }, d.concat = function(e, t) {
193
+ if (!Array.isArray(e)) throw TypeError("\"list\" argument must be an Array of Buffers");
194
+ if (e.length === 0) return d.alloc(0);
195
+ let n;
196
+ if (t === void 0) for (t = 0, n = 0; n < e.length; ++n) t += e[n].length;
197
+ let r = d.allocUnsafe(t), i = 0;
198
+ for (n = 0; n < e.length; ++n) {
199
+ let t = e[n];
200
+ if (X(t, o)) i + t.length > r.length ? (d.isBuffer(t) || (t = d.from(t)), t.copy(r, i)) : o.prototype.set.call(r, t, i);
201
+ else if (d.isBuffer(t)) t.copy(r, i);
202
+ else throw TypeError("\"list\" argument must be an Array of Buffers");
203
+ i += t.length;
204
+ }
205
+ return r;
206
+ };
207
+ function C(e, t) {
208
+ if (d.isBuffer(e)) return e.length;
209
+ if (s.isView(e) || X(e, s)) return e.byteLength;
210
+ if (typeof e != "string") throw TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof e);
211
+ let n = e.length, r = arguments.length > 2 && arguments[2] === !0;
212
+ if (!r && n === 0) return 0;
213
+ let i = !1;
214
+ for (;;) switch (t) {
215
+ case "ascii":
216
+ case "latin1":
217
+ case "binary": return n;
218
+ case "utf8":
219
+ case "utf-8": return q(e).length;
220
+ case "ucs2":
221
+ case "ucs-2":
222
+ case "utf16le":
223
+ case "utf-16le": return n * 2;
224
+ case "hex": return n >>> 1;
225
+ case "base64": return fe(e).length;
226
+ default:
227
+ if (i) return r ? -1 : q(e).length;
228
+ t = ("" + t).toLowerCase(), i = !0;
229
+ }
230
+ }
231
+ d.byteLength = C;
232
+ function w(e, t, n) {
233
+ let r = !1;
234
+ if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((n === void 0 || n > this.length) && (n = this.length), n <= 0) || (n >>>= 0, t >>>= 0, n <= t)) return "";
235
+ for (e ||= "utf8";;) switch (e) {
236
+ case "hex": return ce(this, t, n);
237
+ case "utf8":
238
+ case "utf-8": return A(this, t, n);
239
+ case "ascii": return oe(this, t, n);
240
+ case "latin1":
241
+ case "binary": return se(this, t, n);
242
+ case "base64": return ie(this, t, n);
243
+ case "ucs2":
244
+ case "ucs-2":
245
+ case "utf16le":
246
+ case "utf-16le": return le(this, t, n);
247
+ default:
248
+ if (r) throw TypeError("Unknown encoding: " + e);
249
+ e = (e + "").toLowerCase(), r = !0;
250
+ }
251
+ }
252
+ d.prototype._isBuffer = !0;
253
+ function T(e, t, n) {
254
+ let r = e[t];
255
+ e[t] = e[n], e[n] = r;
256
+ }
257
+ d.prototype.swap16 = function() {
258
+ let e = this.length;
259
+ if (e % 2 != 0) throw RangeError("Buffer size must be a multiple of 16-bits");
260
+ for (let t = 0; t < e; t += 2) T(this, t, t + 1);
261
+ return this;
262
+ }, d.prototype.swap32 = function() {
263
+ let e = this.length;
264
+ if (e % 4 != 0) throw RangeError("Buffer size must be a multiple of 32-bits");
265
+ for (let t = 0; t < e; t += 4) T(this, t, t + 3), T(this, t + 1, t + 2);
266
+ return this;
267
+ }, d.prototype.swap64 = function() {
268
+ let e = this.length;
269
+ if (e % 8 != 0) throw RangeError("Buffer size must be a multiple of 64-bits");
270
+ for (let t = 0; t < e; t += 8) T(this, t, t + 7), T(this, t + 1, t + 6), T(this, t + 2, t + 5), T(this, t + 3, t + 4);
271
+ return this;
272
+ }, d.prototype.toString = function() {
273
+ let e = this.length;
274
+ return e === 0 ? "" : arguments.length === 0 ? A(this, 0, e) : w.apply(this, arguments);
275
+ }, d.prototype.toLocaleString = d.prototype.toString, d.prototype.equals = function(e) {
276
+ if (!d.isBuffer(e)) throw TypeError("Argument must be a Buffer");
277
+ return this === e ? !0 : d.compare(this, e) === 0;
278
+ }, d.prototype.inspect = function() {
279
+ let t = "", n = e.INSPECT_MAX_BYTES;
280
+ return t = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (t += " ... "), "<Buffer " + t + ">";
281
+ }, r && (d.prototype[r] = d.prototype.inspect), d.prototype.compare = function(e, t, n, r, i) {
282
+ if (X(e, o) && (e = d.from(e, e.offset, e.byteLength)), !d.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
283
+ if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), r === void 0 && (r = 0), i === void 0 && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw RangeError("out of range index");
284
+ if (r >= i && t >= n) return 0;
285
+ if (r >= i) return -1;
286
+ if (t >= n) return 1;
287
+ if (t >>>= 0, n >>>= 0, r >>>= 0, i >>>= 0, this === e) return 0;
288
+ let a = i - r, s = n - t, c = Math.min(a, s), l = this.slice(r, i), u = e.slice(t, n);
289
+ for (let e = 0; e < c; ++e) if (l[e] !== u[e]) {
290
+ a = l[e], s = u[e];
291
+ break;
292
+ }
293
+ return a < s ? -1 : +(s < a);
294
+ };
295
+ function E(e, t, n, r, i) {
296
+ if (e.length === 0) return -1;
297
+ if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, Z(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
298
+ if (i) return -1;
299
+ n = e.length - 1;
300
+ } else if (n < 0) if (i) n = 0;
301
+ else return -1;
302
+ if (typeof t == "string" && (t = d.from(t, r)), d.isBuffer(t)) return t.length === 0 ? -1 : D(e, t, n, r, i);
303
+ if (typeof t == "number") return t &= 255, typeof o.prototype.indexOf == "function" ? i ? o.prototype.indexOf.call(e, t, n) : o.prototype.lastIndexOf.call(e, t, n) : D(e, [t], n, r, i);
304
+ throw TypeError("val must be string, number or Buffer");
305
+ }
306
+ function D(e, t, n, r, i) {
307
+ let a = 1, o = e.length, s = t.length;
308
+ if (r !== void 0 && (r = String(r).toLowerCase(), r === "ucs2" || r === "ucs-2" || r === "utf16le" || r === "utf-16le")) {
309
+ if (e.length < 2 || t.length < 2) return -1;
310
+ a = 2, o /= 2, s /= 2, n /= 2;
311
+ }
312
+ function c(e, t) {
313
+ return a === 1 ? e[t] : e.readUInt16BE(t * a);
314
+ }
315
+ let l;
316
+ if (i) {
317
+ let r = -1;
318
+ for (l = n; l < o; l++) if (c(e, l) === c(t, r === -1 ? 0 : l - r)) {
319
+ if (r === -1 && (r = l), l - r + 1 === s) return r * a;
320
+ } else r !== -1 && (l -= l - r), r = -1;
321
+ } else for (n + s > o && (n = o - s), l = n; l >= 0; l--) {
322
+ let n = !0;
323
+ for (let r = 0; r < s; r++) if (c(e, l + r) !== c(t, r)) {
324
+ n = !1;
325
+ break;
326
+ }
327
+ if (n) return l;
328
+ }
329
+ return -1;
330
+ }
331
+ d.prototype.includes = function(e, t, n) {
332
+ return this.indexOf(e, t, n) !== -1;
333
+ }, d.prototype.indexOf = function(e, t, n) {
334
+ return E(this, e, t, n, !0);
335
+ }, d.prototype.lastIndexOf = function(e, t, n) {
336
+ return E(this, e, t, n, !1);
337
+ };
338
+ function O(e, t, n, r) {
339
+ n = Number(n) || 0;
340
+ let i = e.length - n;
341
+ r ? (r = Number(r), r > i && (r = i)) : r = i;
342
+ let a = t.length;
343
+ r > a / 2 && (r = a / 2);
344
+ let o;
345
+ for (o = 0; o < r; ++o) {
346
+ let r = parseInt(t.substr(o * 2, 2), 16);
347
+ if (Z(r)) return o;
348
+ e[n + o] = r;
349
+ }
350
+ return o;
351
+ }
352
+ function k(e, t, n, r) {
353
+ return Y(q(t, e.length - n), e, n, r);
354
+ }
355
+ function te(e, t, n, r) {
356
+ return Y(J(t), e, n, r);
357
+ }
358
+ function ne(e, t, n, r) {
359
+ return Y(fe(t), e, n, r);
360
+ }
361
+ function re(e, t, n, r) {
362
+ return Y(de(t, e.length - n), e, n, r);
363
+ }
364
+ d.prototype.write = function(e, t, n, r) {
365
+ if (t === void 0) r = "utf8", n = this.length, t = 0;
366
+ else if (n === void 0 && typeof t == "string") r = t, n = this.length, t = 0;
367
+ else if (isFinite(t)) t >>>= 0, isFinite(n) ? (n >>>= 0, r === void 0 && (r = "utf8")) : (r = n, n = void 0);
368
+ else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
369
+ let i = this.length - t;
370
+ if ((n === void 0 || n > i) && (n = i), e.length > 0 && (n < 0 || t < 0) || t > this.length) throw RangeError("Attempt to write outside buffer bounds");
371
+ r ||= "utf8";
372
+ let a = !1;
373
+ for (;;) switch (r) {
374
+ case "hex": return O(this, e, t, n);
375
+ case "utf8":
376
+ case "utf-8": return k(this, e, t, n);
377
+ case "ascii":
378
+ case "latin1":
379
+ case "binary": return te(this, e, t, n);
380
+ case "base64": return ne(this, e, t, n);
381
+ case "ucs2":
382
+ case "ucs-2":
383
+ case "utf16le":
384
+ case "utf-16le": return re(this, e, t, n);
385
+ default:
386
+ if (a) throw TypeError("Unknown encoding: " + r);
387
+ r = ("" + r).toLowerCase(), a = !0;
388
+ }
389
+ }, d.prototype.toJSON = function() {
390
+ return {
391
+ type: "Buffer",
392
+ data: Array.prototype.slice.call(this._arr || this, 0)
393
+ };
394
+ };
395
+ function ie(e, n, r) {
396
+ return n === 0 && r === e.length ? t.fromByteArray(e) : t.fromByteArray(e.slice(n, r));
397
+ }
398
+ function A(e, t, n) {
399
+ n = Math.min(e.length, n);
400
+ let r = [], i = t;
401
+ for (; i < n;) {
402
+ let t = e[i], a = null, o = t > 239 ? 4 : t > 223 ? 3 : t > 191 ? 2 : 1;
403
+ if (i + o <= n) {
404
+ let n, r, s, c;
405
+ switch (o) {
406
+ case 1:
407
+ t < 128 && (a = t);
408
+ break;
409
+ case 2:
410
+ n = e[i + 1], (n & 192) == 128 && (c = (t & 31) << 6 | n & 63, c > 127 && (a = c));
411
+ break;
412
+ case 3:
413
+ n = e[i + 1], r = e[i + 2], (n & 192) == 128 && (r & 192) == 128 && (c = (t & 15) << 12 | (n & 63) << 6 | r & 63, c > 2047 && (c < 55296 || c > 57343) && (a = c));
414
+ break;
415
+ case 4: n = e[i + 1], r = e[i + 2], s = e[i + 3], (n & 192) == 128 && (r & 192) == 128 && (s & 192) == 128 && (c = (t & 15) << 18 | (n & 63) << 12 | (r & 63) << 6 | s & 63, c > 65535 && c < 1114112 && (a = c));
416
+ }
417
+ }
418
+ a === null ? (a = 65533, o = 1) : a > 65535 && (a -= 65536, r.push(a >>> 10 & 1023 | 55296), a = 56320 | a & 1023), r.push(a), i += o;
419
+ }
420
+ return ae(r);
421
+ }
422
+ let j = 4096;
423
+ function ae(e) {
424
+ let t = e.length;
425
+ if (t <= j) return String.fromCharCode.apply(String, e);
426
+ let n = "", r = 0;
427
+ for (; r < t;) n += String.fromCharCode.apply(String, e.slice(r, r += j));
428
+ return n;
429
+ }
430
+ function oe(e, t, n) {
431
+ let r = "";
432
+ n = Math.min(e.length, n);
433
+ for (let i = t; i < n; ++i) r += String.fromCharCode(e[i] & 127);
434
+ return r;
435
+ }
436
+ function se(e, t, n) {
437
+ let r = "";
438
+ n = Math.min(e.length, n);
439
+ for (let i = t; i < n; ++i) r += String.fromCharCode(e[i]);
440
+ return r;
441
+ }
442
+ function ce(e, t, n) {
443
+ let r = e.length;
444
+ (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
445
+ let i = "";
446
+ for (let r = t; r < n; ++r) i += pe[e[r]];
447
+ return i;
448
+ }
449
+ function le(e, t, n) {
450
+ let r = e.slice(t, n), i = "";
451
+ for (let e = 0; e < r.length - 1; e += 2) i += String.fromCharCode(r[e] + r[e + 1] * 256);
452
+ return i;
453
+ }
454
+ d.prototype.slice = function(e, t) {
455
+ let n = this.length;
456
+ e = ~~e, t = t === void 0 ? n : ~~t, e < 0 ? (e += n, e < 0 && (e = 0)) : e > n && (e = n), t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), t < e && (t = e);
457
+ let r = this.subarray(e, t);
458
+ return Object.setPrototypeOf(r, d.prototype), r;
459
+ };
460
+ function M(e, t, n) {
461
+ if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint");
462
+ if (e + t > n) throw RangeError("Trying to access beyond buffer length");
463
+ }
464
+ d.prototype.readUintLE = d.prototype.readUIntLE = function(e, t, n) {
465
+ e >>>= 0, t >>>= 0, n || M(e, t, this.length);
466
+ let r = this[e], i = 1, a = 0;
467
+ for (; ++a < t && (i *= 256);) r += this[e + a] * i;
468
+ return r;
469
+ }, d.prototype.readUintBE = d.prototype.readUIntBE = function(e, t, n) {
470
+ e >>>= 0, t >>>= 0, n || M(e, t, this.length);
471
+ let r = this[e + --t], i = 1;
472
+ for (; t > 0 && (i *= 256);) r += this[e + --t] * i;
473
+ return r;
474
+ }, d.prototype.readUint8 = d.prototype.readUInt8 = function(e, t) {
475
+ return e >>>= 0, t || M(e, 1, this.length), this[e];
476
+ }, d.prototype.readUint16LE = d.prototype.readUInt16LE = function(e, t) {
477
+ return e >>>= 0, t || M(e, 2, this.length), this[e] | this[e + 1] << 8;
478
+ }, d.prototype.readUint16BE = d.prototype.readUInt16BE = function(e, t) {
479
+ return e >>>= 0, t || M(e, 2, this.length), this[e] << 8 | this[e + 1];
480
+ }, d.prototype.readUint32LE = d.prototype.readUInt32LE = function(e, t) {
481
+ return e >>>= 0, t || M(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
482
+ }, d.prototype.readUint32BE = d.prototype.readUInt32BE = function(e, t) {
483
+ return e >>>= 0, t || M(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
484
+ }, d.prototype.readBigUInt64LE = Q(function(e) {
485
+ e >>>= 0, W(e, "offset");
486
+ let t = this[e], n = this[e + 7];
487
+ (t === void 0 || n === void 0) && G(e, this.length - 8);
488
+ let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
489
+ return BigInt(r) + (BigInt(i) << BigInt(32));
490
+ }), d.prototype.readBigUInt64BE = Q(function(e) {
491
+ e >>>= 0, W(e, "offset");
492
+ let t = this[e], n = this[e + 7];
493
+ (t === void 0 || n === void 0) && G(e, this.length - 8);
494
+ let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
495
+ return (BigInt(r) << BigInt(32)) + BigInt(i);
496
+ }), d.prototype.readIntLE = function(e, t, n) {
497
+ e >>>= 0, t >>>= 0, n || M(e, t, this.length);
498
+ let r = this[e], i = 1, a = 0;
499
+ for (; ++a < t && (i *= 256);) r += this[e + a] * i;
500
+ return i *= 128, r >= i && (r -= 2 ** (8 * t)), r;
501
+ }, d.prototype.readIntBE = function(e, t, n) {
502
+ e >>>= 0, t >>>= 0, n || M(e, t, this.length);
503
+ let r = t, i = 1, a = this[e + --r];
504
+ for (; r > 0 && (i *= 256);) a += this[e + --r] * i;
505
+ return i *= 128, a >= i && (a -= 2 ** (8 * t)), a;
506
+ }, d.prototype.readInt8 = function(e, t) {
507
+ return e >>>= 0, t || M(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
508
+ }, d.prototype.readInt16LE = function(e, t) {
509
+ e >>>= 0, t || M(e, 2, this.length);
510
+ let n = this[e] | this[e + 1] << 8;
511
+ return n & 32768 ? n | 4294901760 : n;
512
+ }, d.prototype.readInt16BE = function(e, t) {
513
+ e >>>= 0, t || M(e, 2, this.length);
514
+ let n = this[e + 1] | this[e] << 8;
515
+ return n & 32768 ? n | 4294901760 : n;
516
+ }, d.prototype.readInt32LE = function(e, t) {
517
+ return e >>>= 0, t || M(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
518
+ }, d.prototype.readInt32BE = function(e, t) {
519
+ return e >>>= 0, t || M(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
520
+ }, d.prototype.readBigInt64LE = Q(function(e) {
521
+ e >>>= 0, W(e, "offset");
522
+ let t = this[e], n = this[e + 7];
523
+ (t === void 0 || n === void 0) && G(e, this.length - 8);
524
+ let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
525
+ return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
526
+ }), d.prototype.readBigInt64BE = Q(function(e) {
527
+ e >>>= 0, W(e, "offset");
528
+ let t = this[e], n = this[e + 7];
529
+ (t === void 0 || n === void 0) && G(e, this.length - 8);
530
+ let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
531
+ return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
532
+ }), d.prototype.readFloatLE = function(e, t) {
533
+ return e >>>= 0, t || M(e, 4, this.length), n.read(this, e, !0, 23, 4);
534
+ }, d.prototype.readFloatBE = function(e, t) {
535
+ return e >>>= 0, t || M(e, 4, this.length), n.read(this, e, !1, 23, 4);
536
+ }, d.prototype.readDoubleLE = function(e, t) {
537
+ return e >>>= 0, t || M(e, 8, this.length), n.read(this, e, !0, 52, 8);
538
+ }, d.prototype.readDoubleBE = function(e, t) {
539
+ return e >>>= 0, t || M(e, 8, this.length), n.read(this, e, !1, 52, 8);
540
+ };
541
+ function N(e, t, n, r, i, a) {
542
+ if (!d.isBuffer(e)) throw TypeError("\"buffer\" argument must be a Buffer instance");
543
+ if (t > i || t < a) throw RangeError("\"value\" argument is out of bounds");
544
+ if (n + r > e.length) throw RangeError("Index out of range");
545
+ }
546
+ d.prototype.writeUintLE = d.prototype.writeUIntLE = function(e, t, n, r) {
547
+ if (e = +e, t >>>= 0, n >>>= 0, !r) {
548
+ let r = 2 ** (8 * n) - 1;
549
+ N(this, e, t, n, r, 0);
550
+ }
551
+ let i = 1, a = 0;
552
+ for (this[t] = e & 255; ++a < n && (i *= 256);) this[t + a] = e / i & 255;
553
+ return t + n;
554
+ }, d.prototype.writeUintBE = d.prototype.writeUIntBE = function(e, t, n, r) {
555
+ if (e = +e, t >>>= 0, n >>>= 0, !r) {
556
+ let r = 2 ** (8 * n) - 1;
557
+ N(this, e, t, n, r, 0);
558
+ }
559
+ let i = n - 1, a = 1;
560
+ for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) this[t + i] = e / a & 255;
561
+ return t + n;
562
+ }, d.prototype.writeUint8 = d.prototype.writeUInt8 = function(e, t, n) {
563
+ return e = +e, t >>>= 0, n || N(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
564
+ }, d.prototype.writeUint16LE = d.prototype.writeUInt16LE = function(e, t, n) {
565
+ return e = +e, t >>>= 0, n || N(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
566
+ }, d.prototype.writeUint16BE = d.prototype.writeUInt16BE = function(e, t, n) {
567
+ return e = +e, t >>>= 0, n || N(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
568
+ }, d.prototype.writeUint32LE = d.prototype.writeUInt32LE = function(e, t, n) {
569
+ return e = +e, t >>>= 0, n || N(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
570
+ }, d.prototype.writeUint32BE = d.prototype.writeUInt32BE = function(e, t, n) {
571
+ return e = +e, t >>>= 0, n || N(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
572
+ };
573
+ function P(e, t, n, r, i) {
574
+ U(t, r, i, e, n, 7);
575
+ let a = Number(t & BigInt(4294967295));
576
+ e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
577
+ let o = Number(t >> BigInt(32) & BigInt(4294967295));
578
+ return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
579
+ }
580
+ function F(e, t, n, r, i) {
581
+ U(t, r, i, e, n, 7);
582
+ let a = Number(t & BigInt(4294967295));
583
+ e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
584
+ let o = Number(t >> BigInt(32) & BigInt(4294967295));
585
+ return e[n + 3] = o, o >>= 8, e[n + 2] = o, o >>= 8, e[n + 1] = o, o >>= 8, e[n] = o, n + 8;
586
+ }
587
+ d.prototype.writeBigUInt64LE = Q(function(e, t = 0) {
588
+ return P(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
589
+ }), d.prototype.writeBigUInt64BE = Q(function(e, t = 0) {
590
+ return F(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
591
+ }), d.prototype.writeIntLE = function(e, t, n, r) {
592
+ if (e = +e, t >>>= 0, !r) {
593
+ let r = 2 ** (8 * n - 1);
594
+ N(this, e, t, n, r - 1, -r);
595
+ }
596
+ let i = 0, a = 1, o = 0;
597
+ for (this[t] = e & 255; ++i < n && (a *= 256);) e < 0 && o === 0 && this[t + i - 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
598
+ return t + n;
599
+ }, d.prototype.writeIntBE = function(e, t, n, r) {
600
+ if (e = +e, t >>>= 0, !r) {
601
+ let r = 2 ** (8 * n - 1);
602
+ N(this, e, t, n, r - 1, -r);
603
+ }
604
+ let i = n - 1, a = 1, o = 0;
605
+ for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) e < 0 && o === 0 && this[t + i + 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
606
+ return t + n;
607
+ }, d.prototype.writeInt8 = function(e, t, n) {
608
+ return e = +e, t >>>= 0, n || N(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
609
+ }, d.prototype.writeInt16LE = function(e, t, n) {
610
+ return e = +e, t >>>= 0, n || N(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
611
+ }, d.prototype.writeInt16BE = function(e, t, n) {
612
+ return e = +e, t >>>= 0, n || N(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
613
+ }, d.prototype.writeInt32LE = function(e, t, n) {
614
+ return e = +e, t >>>= 0, n || N(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
615
+ }, d.prototype.writeInt32BE = function(e, t, n) {
616
+ return e = +e, t >>>= 0, n || N(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
617
+ }, d.prototype.writeBigInt64LE = Q(function(e, t = 0) {
618
+ return P(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
619
+ }), d.prototype.writeBigInt64BE = Q(function(e, t = 0) {
620
+ return F(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
621
+ });
622
+ function I(e, t, n, r, i, a) {
623
+ if (n + r > e.length || n < 0) throw RangeError("Index out of range");
624
+ }
625
+ function L(e, t, r, i, a) {
626
+ return t = +t, r >>>= 0, a || I(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
627
+ }
628
+ d.prototype.writeFloatLE = function(e, t, n) {
629
+ return L(this, e, t, !0, n);
630
+ }, d.prototype.writeFloatBE = function(e, t, n) {
631
+ return L(this, e, t, !1, n);
632
+ };
633
+ function R(e, t, r, i, a) {
634
+ return t = +t, r >>>= 0, a || I(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
635
+ }
636
+ d.prototype.writeDoubleLE = function(e, t, n) {
637
+ return R(this, e, t, !0, n);
638
+ }, d.prototype.writeDoubleBE = function(e, t, n) {
639
+ return R(this, e, t, !1, n);
640
+ }, d.prototype.copy = function(e, t, n, r) {
641
+ if (!d.isBuffer(e)) throw TypeError("argument should be a Buffer");
642
+ if (n ||= 0, !r && r !== 0 && (r = this.length), t >= e.length && (t = e.length), t ||= 0, r > 0 && r < n && (r = n), r === n || e.length === 0 || this.length === 0) return 0;
643
+ if (t < 0) throw RangeError("targetStart out of bounds");
644
+ if (n < 0 || n >= this.length) throw RangeError("Index out of range");
645
+ if (r < 0) throw RangeError("sourceEnd out of bounds");
646
+ r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n);
647
+ let i = r - n;
648
+ return this === e && typeof o.prototype.copyWithin == "function" ? this.copyWithin(t, n, r) : o.prototype.set.call(e, this.subarray(n, r), t), i;
649
+ }, d.prototype.fill = function(e, t, n, r) {
650
+ if (typeof e == "string") {
651
+ if (typeof t == "string" ? (r = t, t = 0, n = this.length) : typeof n == "string" && (r = n, n = this.length), r !== void 0 && typeof r != "string") throw TypeError("encoding must be a string");
652
+ if (typeof r == "string" && !d.isEncoding(r)) throw TypeError("Unknown encoding: " + r);
653
+ if (e.length === 1) {
654
+ let t = e.charCodeAt(0);
655
+ (r === "utf8" && t < 128 || r === "latin1") && (e = t);
656
+ }
657
+ } else typeof e == "number" ? e &= 255 : typeof e == "boolean" && (e = Number(e));
658
+ if (t < 0 || this.length < t || this.length < n) throw RangeError("Out of range index");
659
+ if (n <= t) return this;
660
+ t >>>= 0, n = n === void 0 ? this.length : n >>> 0, e ||= 0;
661
+ let i;
662
+ if (typeof e == "number") for (i = t; i < n; ++i) this[i] = e;
663
+ else {
664
+ let a = d.isBuffer(e) ? e : d.from(e, r), o = a.length;
665
+ if (o === 0) throw TypeError("The value \"" + e + "\" is invalid for argument \"value\"");
666
+ for (i = 0; i < n - t; ++i) this[i + t] = a[i % o];
667
+ }
668
+ return this;
669
+ };
670
+ let z = {};
671
+ function B(e, t, n) {
672
+ z[e] = class extends n {
673
+ constructor() {
674
+ super(), Object.defineProperty(this, "message", {
675
+ value: t.apply(this, arguments),
676
+ writable: !0,
677
+ configurable: !0
678
+ }), this.name = `${this.name} [${e}]`, this.stack, delete this.name;
679
+ }
680
+ get code() {
681
+ return e;
682
+ }
683
+ set code(e) {
684
+ Object.defineProperty(this, "code", {
685
+ configurable: !0,
686
+ enumerable: !0,
687
+ value: e,
688
+ writable: !0
689
+ });
690
+ }
691
+ toString() {
692
+ return `${this.name} [${e}]: ${this.message}`;
693
+ }
694
+ };
695
+ }
696
+ B("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
697
+ return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
698
+ }, RangeError), B("ERR_INVALID_ARG_TYPE", function(e, t) {
699
+ return `The "${e}" argument must be of type number. Received type ${typeof t}`;
700
+ }, TypeError), B("ERR_OUT_OF_RANGE", function(e, t, n) {
701
+ let r = `The value of "${e}" is out of range.`, i = n;
702
+ return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = V(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = V(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
703
+ }, RangeError);
704
+ function V(e) {
705
+ let t = "", n = e.length, r = +(e[0] === "-");
706
+ for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
707
+ return `${e.slice(0, n)}${t}`;
708
+ }
709
+ function H(e, t, n) {
710
+ W(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && G(t, e.length - (n + 1));
711
+ }
712
+ function U(e, t, n, r, i, a) {
713
+ if (e > n || e < t) {
714
+ let r = typeof t == "bigint" ? "n" : "", i;
715
+ throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new z.ERR_OUT_OF_RANGE("value", i, e);
716
+ }
717
+ H(r, i, a);
718
+ }
719
+ function W(e, t) {
720
+ if (typeof e != "number") throw new z.ERR_INVALID_ARG_TYPE(t, "number", e);
721
+ }
722
+ function G(e, t, n) {
723
+ throw Math.floor(e) === e ? t < 0 ? new z.ERR_BUFFER_OUT_OF_BOUNDS() : new z.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (W(e, n), new z.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
724
+ }
725
+ let ue = /[^+/0-9A-Za-z-_]/g;
726
+ function K(e) {
727
+ if (e = e.split("=")[0], e = e.trim().replace(ue, ""), e.length < 2) return "";
728
+ for (; e.length % 4 != 0;) e += "=";
729
+ return e;
730
+ }
731
+ function q(e, t) {
732
+ t ||= Infinity;
733
+ let n, r = e.length, i = null, a = [];
734
+ for (let o = 0; o < r; ++o) {
735
+ if (n = e.charCodeAt(o), n > 55295 && n < 57344) {
736
+ if (!i) {
737
+ if (n > 56319) {
738
+ (t -= 3) > -1 && a.push(239, 191, 189);
739
+ continue;
740
+ } else if (o + 1 === r) {
741
+ (t -= 3) > -1 && a.push(239, 191, 189);
742
+ continue;
743
+ }
744
+ i = n;
745
+ continue;
746
+ }
747
+ if (n < 56320) {
748
+ (t -= 3) > -1 && a.push(239, 191, 189), i = n;
749
+ continue;
750
+ }
751
+ n = (i - 55296 << 10 | n - 56320) + 65536;
752
+ } else i && (t -= 3) > -1 && a.push(239, 191, 189);
753
+ if (i = null, n < 128) {
754
+ if (--t < 0) break;
755
+ a.push(n);
756
+ } else if (n < 2048) {
757
+ if ((t -= 2) < 0) break;
758
+ a.push(n >> 6 | 192, n & 63 | 128);
759
+ } else if (n < 65536) {
760
+ if ((t -= 3) < 0) break;
761
+ a.push(n >> 12 | 224, n >> 6 & 63 | 128, n & 63 | 128);
762
+ } else if (n < 1114112) {
763
+ if ((t -= 4) < 0) break;
764
+ a.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, n & 63 | 128);
765
+ } else throw Error("Invalid code point");
766
+ }
767
+ return a;
768
+ }
769
+ function J(e) {
770
+ let t = [];
771
+ for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
772
+ return t;
773
+ }
774
+ function de(e, t) {
775
+ let n, r, i, a = [];
776
+ for (let o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
777
+ return a;
778
+ }
779
+ function fe(e) {
780
+ return t.toByteArray(K(e));
781
+ }
782
+ function Y(e, t, n, r) {
783
+ let i;
784
+ for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
785
+ return i;
786
+ }
787
+ function X(e, t) {
788
+ return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
789
+ }
790
+ function Z(e) {
791
+ return e !== e;
792
+ }
793
+ let pe = (function() {
794
+ let e = "0123456789abcdef", t = Array(256);
795
+ for (let n = 0; n < 16; ++n) {
796
+ let r = n * 16;
797
+ for (let i = 0; i < 16; ++i) t[r + i] = e[n] + e[i];
798
+ }
799
+ return t;
800
+ })();
801
+ function Q(e) {
802
+ return typeof BigInt > "u" ? me : e;
803
+ }
804
+ function me() {
805
+ throw Error("BigInt not supported");
806
+ }
807
+ })(r);
808
+ var y = r.Buffer;
809
+ //#endregion
810
+ //#region node_modules/.pnpm/ome-zarr.js@0.0.19/node_modules/ome-zarr.js/dist/png-K1gqQ34g.js
811
+ r.Blob, r.BlobOptions, r.Buffer, r.File, r.FileOptions, r.INSPECT_MAX_BYTES, r.SlowBuffer, r.TranscodeEncoding, r.atob, r.btoa, r.constants, r.isAscii, r.isUtf8, r.kMaxLength, r.kStringMaxLength, r.resolveObjectURL, r.transcode, t();
812
+ function b(e, t) {
813
+ for (var n = 0; n < t.length; n++) {
814
+ let r = t[n];
815
+ if (typeof r != "string" && !Array.isArray(r)) {
816
+ for (let t in r) if (t !== "default" && !(t in e)) {
817
+ let n = Object.getOwnPropertyDescriptor(r, t);
818
+ n && Object.defineProperty(e, t, n.get ? n : {
819
+ enumerable: !0,
820
+ get: () => r[t]
821
+ });
822
+ }
823
+ }
824
+ }
825
+ return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
826
+ }
827
+ function ee(e) {
828
+ if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
829
+ var t = e.default;
830
+ if (typeof t == "function") {
831
+ var n = function e() {
832
+ return this instanceof e ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
833
+ };
834
+ n.prototype = t.prototype;
835
+ } else n = {};
836
+ return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(t) {
837
+ var r = Object.getOwnPropertyDescriptor(e, t);
838
+ Object.defineProperty(n, t, r.get ? r : {
839
+ enumerable: !0,
840
+ get: function() {
841
+ return e[t];
842
+ }
843
+ });
844
+ }), n;
845
+ }
846
+ var x = {}, S = /* @__PURE__ */ ee(n), C = { exports: {} }, w = { exports: {} }, T;
847
+ function E() {
848
+ if (T) return w.exports;
849
+ T = 1;
850
+ let t = S, n = S, r = w.exports = function() {
851
+ n.call(this), this._buffers = [], this._buffered = 0, this._reads = [], this._paused = !1, this._encoding = "utf8", this.writable = !0;
852
+ };
853
+ return t.inherits(r, n), r.prototype.read = function(t, n) {
854
+ this._reads.push({
855
+ length: Math.abs(t),
856
+ allowLess: t < 0,
857
+ func: n
858
+ }), e.nextTick((function() {
859
+ this._process(), this._paused && this._reads && this._reads.length > 0 && (this._paused = !1, this.emit("drain"));
860
+ }).bind(this));
861
+ }, r.prototype.write = function(e, t) {
862
+ if (!this.writable) return this.emit("error", /* @__PURE__ */ Error("Stream not writable")), !1;
863
+ let n;
864
+ return n = y.isBuffer(e) ? e : y.from(e, t || this._encoding), this._buffers.push(n), this._buffered += n.length, this._process(), this._reads && this._reads.length === 0 && (this._paused = !0), this.writable && !this._paused;
865
+ }, r.prototype.end = function(e, t) {
866
+ e && this.write(e, t), this.writable = !1, this._buffers && (this._buffers.length === 0 ? this._end() : (this._buffers.push(null), this._process()));
867
+ }, r.prototype.destroySoon = r.prototype.end, r.prototype._end = function() {
868
+ this._reads.length > 0 && this.emit("error", /* @__PURE__ */ Error("Unexpected end of input")), this.destroy();
869
+ }, r.prototype.destroy = function() {
870
+ this._buffers && (this.writable = !1, this._reads = null, this._buffers = null, this.emit("close"));
871
+ }, r.prototype._processReadAllowingLess = function(e) {
872
+ this._reads.shift();
873
+ let t = this._buffers[0];
874
+ t.length > e.length ? (this._buffered -= e.length, this._buffers[0] = t.slice(e.length), e.func.call(this, t.slice(0, e.length))) : (this._buffered -= t.length, this._buffers.shift(), e.func.call(this, t));
875
+ }, r.prototype._processRead = function(e) {
876
+ this._reads.shift();
877
+ let t = 0, n = 0, r = y.alloc(e.length);
878
+ for (; t < e.length;) {
879
+ let i = this._buffers[n++], a = Math.min(i.length, e.length - t);
880
+ i.copy(r, t, 0, a), t += a, a !== i.length && (this._buffers[--n] = i.slice(a));
881
+ }
882
+ n > 0 && this._buffers.splice(0, n), this._buffered -= e.length, e.func.call(this, r);
883
+ }, r.prototype._process = function() {
884
+ try {
885
+ for (; this._buffered > 0 && this._reads && this._reads.length > 0;) {
886
+ let e = this._reads[0];
887
+ if (e.allowLess) this._processReadAllowingLess(e);
888
+ else if (this._buffered >= e.length) this._processRead(e);
889
+ else break;
890
+ }
891
+ this._buffers && !this.writable && this._end();
892
+ } catch (e) {
893
+ this.emit("error", e);
894
+ }
895
+ }, w.exports;
896
+ }
897
+ var D = { exports: {} }, O = { exports: {} }, k = {}, te;
898
+ function ne() {
899
+ if (te) return k;
900
+ te = 1;
901
+ let e = [
902
+ {
903
+ x: [0],
904
+ y: [0]
905
+ },
906
+ {
907
+ x: [4],
908
+ y: [0]
909
+ },
910
+ {
911
+ x: [0, 4],
912
+ y: [4]
913
+ },
914
+ {
915
+ x: [2, 6],
916
+ y: [0, 4]
917
+ },
918
+ {
919
+ x: [
920
+ 0,
921
+ 2,
922
+ 4,
923
+ 6
924
+ ],
925
+ y: [2, 6]
926
+ },
927
+ {
928
+ x: [
929
+ 1,
930
+ 3,
931
+ 5,
932
+ 7
933
+ ],
934
+ y: [
935
+ 0,
936
+ 2,
937
+ 4,
938
+ 6
939
+ ]
940
+ },
941
+ {
942
+ x: [
943
+ 0,
944
+ 1,
945
+ 2,
946
+ 3,
947
+ 4,
948
+ 5,
949
+ 6,
950
+ 7
951
+ ],
952
+ y: [
953
+ 1,
954
+ 3,
955
+ 5,
956
+ 7
957
+ ]
958
+ }
959
+ ];
960
+ return k.getImagePasses = function(t, n) {
961
+ let r = [], i = t % 8, a = n % 8, o = (t - i) / 8, s = (n - a) / 8;
962
+ for (let t = 0; t < e.length; t++) {
963
+ let n = e[t], c = o * n.x.length, l = s * n.y.length;
964
+ for (let e = 0; e < n.x.length && n.x[e] < i; e++) c++;
965
+ for (let e = 0; e < n.y.length && n.y[e] < a; e++) l++;
966
+ c > 0 && l > 0 && r.push({
967
+ width: c,
968
+ height: l,
969
+ index: t
970
+ });
971
+ }
972
+ return r;
973
+ }, k.getInterlaceIterator = function(t) {
974
+ return function(n, r, i) {
975
+ let a = n % e[i].x.length, o = (n - a) / e[i].x.length * 8 + e[i].x[a], s = r % e[i].y.length, c = (r - s) / e[i].y.length * 8 + e[i].y[s];
976
+ return o * 4 + c * t * 4;
977
+ };
978
+ }, k;
979
+ }
980
+ var re, ie;
981
+ function A() {
982
+ return ie || (ie = 1, re = function(e, t, n) {
983
+ let r = e + t - n, i = Math.abs(r - e), a = Math.abs(r - t), o = Math.abs(r - n);
984
+ return i <= a && i <= o ? e : a <= o ? t : n;
985
+ }), re;
986
+ }
987
+ var j;
988
+ function ae() {
989
+ if (j) return O.exports;
990
+ j = 1;
991
+ let e = ne(), t = A();
992
+ function n(e, t, n) {
993
+ let r = e * t;
994
+ return n !== 8 && (r = Math.ceil(r / (8 / n))), r;
995
+ }
996
+ let r = O.exports = function(t, r) {
997
+ let i = t.width, a = t.height, o = t.interlace, s = t.bpp, c = t.depth;
998
+ if (this.read = r.read, this.write = r.write, this.complete = r.complete, this._imageIndex = 0, this._images = [], o) {
999
+ let t = e.getImagePasses(i, a);
1000
+ for (let e = 0; e < t.length; e++) this._images.push({
1001
+ byteWidth: n(t[e].width, s, c),
1002
+ height: t[e].height,
1003
+ lineIndex: 0
1004
+ });
1005
+ } else this._images.push({
1006
+ byteWidth: n(i, s, c),
1007
+ height: a,
1008
+ lineIndex: 0
1009
+ });
1010
+ c === 8 ? this._xComparison = s : c === 16 ? this._xComparison = s * 2 : this._xComparison = 1;
1011
+ };
1012
+ return r.prototype.start = function() {
1013
+ this.read(this._images[this._imageIndex].byteWidth + 1, this._reverseFilterLine.bind(this));
1014
+ }, r.prototype._unFilterType1 = function(e, t, n) {
1015
+ let r = this._xComparison, i = r - 1;
1016
+ for (let a = 0; a < n; a++) t[a] = e[1 + a] + (a > i ? t[a - r] : 0);
1017
+ }, r.prototype._unFilterType2 = function(e, t, n) {
1018
+ let r = this._lastLine;
1019
+ for (let i = 0; i < n; i++) t[i] = e[1 + i] + (r ? r[i] : 0);
1020
+ }, r.prototype._unFilterType3 = function(e, t, n) {
1021
+ let r = this._xComparison, i = r - 1, a = this._lastLine;
1022
+ for (let o = 0; o < n; o++) {
1023
+ let n = e[1 + o], s = a ? a[o] : 0, c = o > i ? t[o - r] : 0;
1024
+ t[o] = n + Math.floor((c + s) / 2);
1025
+ }
1026
+ }, r.prototype._unFilterType4 = function(e, n, r) {
1027
+ let i = this._xComparison, a = i - 1, o = this._lastLine;
1028
+ for (let s = 0; s < r; s++) {
1029
+ let r = e[1 + s], c = o ? o[s] : 0;
1030
+ n[s] = r + t(s > a ? n[s - i] : 0, c, s > a && o ? o[s - i] : 0);
1031
+ }
1032
+ }, r.prototype._reverseFilterLine = function(e) {
1033
+ let t = e[0], n, r = this._images[this._imageIndex], i = r.byteWidth;
1034
+ if (t === 0) n = e.slice(1, i + 1);
1035
+ else switch (n = y.alloc(i), t) {
1036
+ case 1:
1037
+ this._unFilterType1(e, n, i);
1038
+ break;
1039
+ case 2:
1040
+ this._unFilterType2(e, n, i);
1041
+ break;
1042
+ case 3:
1043
+ this._unFilterType3(e, n, i);
1044
+ break;
1045
+ case 4:
1046
+ this._unFilterType4(e, n, i);
1047
+ break;
1048
+ default: throw Error("Unrecognised filter type - " + t);
1049
+ }
1050
+ this.write(n), r.lineIndex++, r.lineIndex >= r.height ? (this._lastLine = null, this._imageIndex++, r = this._images[this._imageIndex]) : this._lastLine = n, r ? this.read(r.byteWidth + 1, this._reverseFilterLine.bind(this)) : (this._lastLine = null, this.complete());
1051
+ }, O.exports;
1052
+ }
1053
+ var oe;
1054
+ function se() {
1055
+ if (oe) return D.exports;
1056
+ oe = 1;
1057
+ let e = S, t = E(), n = ae(), r = D.exports = function(e) {
1058
+ t.call(this);
1059
+ let r = [], i = this;
1060
+ this._filter = new n(e, {
1061
+ read: this.read.bind(this),
1062
+ write: function(e) {
1063
+ r.push(e);
1064
+ },
1065
+ complete: function() {
1066
+ i.emit("complete", y.concat(r));
1067
+ }
1068
+ }), this._filter.start();
1069
+ };
1070
+ return e.inherits(r, t), D.exports;
1071
+ }
1072
+ var ce = { exports: {} }, le, M;
1073
+ function N() {
1074
+ return M || (M = 1, le = {
1075
+ PNG_SIGNATURE: [
1076
+ 137,
1077
+ 80,
1078
+ 78,
1079
+ 71,
1080
+ 13,
1081
+ 10,
1082
+ 26,
1083
+ 10
1084
+ ],
1085
+ TYPE_IHDR: 1229472850,
1086
+ TYPE_IEND: 1229278788,
1087
+ TYPE_IDAT: 1229209940,
1088
+ TYPE_PLTE: 1347179589,
1089
+ TYPE_tRNS: 1951551059,
1090
+ TYPE_gAMA: 1732332865,
1091
+ COLORTYPE_GRAYSCALE: 0,
1092
+ COLORTYPE_PALETTE: 1,
1093
+ COLORTYPE_COLOR: 2,
1094
+ COLORTYPE_ALPHA: 4,
1095
+ COLORTYPE_PALETTE_COLOR: 3,
1096
+ COLORTYPE_COLOR_ALPHA: 6,
1097
+ COLORTYPE_TO_BPP_MAP: {
1098
+ 0: 1,
1099
+ 2: 3,
1100
+ 3: 1,
1101
+ 4: 2,
1102
+ 6: 4
1103
+ },
1104
+ GAMMA_DIVISION: 1e5
1105
+ }), le;
1106
+ }
1107
+ var P = { exports: {} }, F;
1108
+ function I() {
1109
+ if (F) return P.exports;
1110
+ F = 1;
1111
+ let e = [];
1112
+ (function() {
1113
+ for (let t = 0; t < 256; t++) {
1114
+ let n = t;
1115
+ for (let e = 0; e < 8; e++) n & 1 ? n = 3988292384 ^ n >>> 1 : n >>>= 1;
1116
+ e[t] = n;
1117
+ }
1118
+ })();
1119
+ let t = P.exports = function() {
1120
+ this._crc = -1;
1121
+ };
1122
+ return t.prototype.write = function(t) {
1123
+ for (let n = 0; n < t.length; n++) this._crc = e[(this._crc ^ t[n]) & 255] ^ this._crc >>> 8;
1124
+ return !0;
1125
+ }, t.prototype.crc32 = function() {
1126
+ return this._crc ^ -1;
1127
+ }, t.crc32 = function(t) {
1128
+ let n = -1;
1129
+ for (let r = 0; r < t.length; r++) n = e[(n ^ t[r]) & 255] ^ n >>> 8;
1130
+ return n ^ -1;
1131
+ }, P.exports;
1132
+ }
1133
+ var L;
1134
+ function R() {
1135
+ if (L) return ce.exports;
1136
+ L = 1;
1137
+ let e = N(), t = I(), n = ce.exports = function(t, n) {
1138
+ this._options = t, t.checkCRC = t.checkCRC !== !1, this._hasIHDR = !1, this._hasIEND = !1, this._emittedHeadersFinished = !1, this._palette = [], this._colorType = 0, this._chunks = {}, this._chunks[e.TYPE_IHDR] = this._handleIHDR.bind(this), this._chunks[e.TYPE_IEND] = this._handleIEND.bind(this), this._chunks[e.TYPE_IDAT] = this._handleIDAT.bind(this), this._chunks[e.TYPE_PLTE] = this._handlePLTE.bind(this), this._chunks[e.TYPE_tRNS] = this._handleTRNS.bind(this), this._chunks[e.TYPE_gAMA] = this._handleGAMA.bind(this), this.read = n.read, this.error = n.error, this.metadata = n.metadata, this.gamma = n.gamma, this.transColor = n.transColor, this.palette = n.palette, this.parsed = n.parsed, this.inflateData = n.inflateData, this.finished = n.finished, this.simpleTransparency = n.simpleTransparency, this.headersFinished = n.headersFinished || function() {};
1139
+ };
1140
+ return n.prototype.start = function() {
1141
+ this.read(e.PNG_SIGNATURE.length, this._parseSignature.bind(this));
1142
+ }, n.prototype._parseSignature = function(t) {
1143
+ let n = e.PNG_SIGNATURE;
1144
+ for (let e = 0; e < n.length; e++) if (t[e] !== n[e]) {
1145
+ this.error(/* @__PURE__ */ Error("Invalid file signature"));
1146
+ return;
1147
+ }
1148
+ this.read(8, this._parseChunkBegin.bind(this));
1149
+ }, n.prototype._parseChunkBegin = function(n) {
1150
+ let r = n.readUInt32BE(0), i = n.readUInt32BE(4), a = "";
1151
+ for (let e = 4; e < 8; e++) a += String.fromCharCode(n[e]);
1152
+ let o = !!(n[4] & 32);
1153
+ if (!this._hasIHDR && i !== e.TYPE_IHDR) {
1154
+ this.error(/* @__PURE__ */ Error("Expected IHDR on beggining"));
1155
+ return;
1156
+ }
1157
+ if (this._crc = new t(), this._crc.write(y.from(a)), this._chunks[i]) return this._chunks[i](r);
1158
+ if (!o) {
1159
+ this.error(/* @__PURE__ */ Error("Unsupported critical chunk type " + a));
1160
+ return;
1161
+ }
1162
+ this.read(r + 4, this._skipChunk.bind(this));
1163
+ }, n.prototype._skipChunk = function() {
1164
+ this.read(8, this._parseChunkBegin.bind(this));
1165
+ }, n.prototype._handleChunkEnd = function() {
1166
+ this.read(4, this._parseChunkEnd.bind(this));
1167
+ }, n.prototype._parseChunkEnd = function(e) {
1168
+ let t = e.readInt32BE(0), n = this._crc.crc32();
1169
+ if (this._options.checkCRC && n !== t) {
1170
+ this.error(/* @__PURE__ */ Error("Crc error - " + t + " - " + n));
1171
+ return;
1172
+ }
1173
+ this._hasIEND || this.read(8, this._parseChunkBegin.bind(this));
1174
+ }, n.prototype._handleIHDR = function(e) {
1175
+ this.read(e, this._parseIHDR.bind(this));
1176
+ }, n.prototype._parseIHDR = function(t) {
1177
+ this._crc.write(t);
1178
+ let n = t.readUInt32BE(0), r = t.readUInt32BE(4), i = t[8], a = t[9], o = t[10], s = t[11], c = t[12];
1179
+ if (i !== 8 && i !== 4 && i !== 2 && i !== 1 && i !== 16) {
1180
+ this.error(/* @__PURE__ */ Error("Unsupported bit depth " + i));
1181
+ return;
1182
+ }
1183
+ if (!(a in e.COLORTYPE_TO_BPP_MAP)) {
1184
+ this.error(/* @__PURE__ */ Error("Unsupported color type"));
1185
+ return;
1186
+ }
1187
+ if (o !== 0) {
1188
+ this.error(/* @__PURE__ */ Error("Unsupported compression method"));
1189
+ return;
1190
+ }
1191
+ if (s !== 0) {
1192
+ this.error(/* @__PURE__ */ Error("Unsupported filter method"));
1193
+ return;
1194
+ }
1195
+ if (c !== 0 && c !== 1) {
1196
+ this.error(/* @__PURE__ */ Error("Unsupported interlace method"));
1197
+ return;
1198
+ }
1199
+ this._colorType = a;
1200
+ let l = e.COLORTYPE_TO_BPP_MAP[this._colorType];
1201
+ this._hasIHDR = !0, this.metadata({
1202
+ width: n,
1203
+ height: r,
1204
+ depth: i,
1205
+ interlace: !!c,
1206
+ palette: !!(a & e.COLORTYPE_PALETTE),
1207
+ color: !!(a & e.COLORTYPE_COLOR),
1208
+ alpha: !!(a & e.COLORTYPE_ALPHA),
1209
+ bpp: l,
1210
+ colorType: a
1211
+ }), this._handleChunkEnd();
1212
+ }, n.prototype._handlePLTE = function(e) {
1213
+ this.read(e, this._parsePLTE.bind(this));
1214
+ }, n.prototype._parsePLTE = function(e) {
1215
+ this._crc.write(e);
1216
+ let t = Math.floor(e.length / 3);
1217
+ for (let n = 0; n < t; n++) this._palette.push([
1218
+ e[n * 3],
1219
+ e[n * 3 + 1],
1220
+ e[n * 3 + 2],
1221
+ 255
1222
+ ]);
1223
+ this.palette(this._palette), this._handleChunkEnd();
1224
+ }, n.prototype._handleTRNS = function(e) {
1225
+ this.simpleTransparency(), this.read(e, this._parseTRNS.bind(this));
1226
+ }, n.prototype._parseTRNS = function(t) {
1227
+ if (this._crc.write(t), this._colorType === e.COLORTYPE_PALETTE_COLOR) {
1228
+ if (this._palette.length === 0) {
1229
+ this.error(/* @__PURE__ */ Error("Transparency chunk must be after palette"));
1230
+ return;
1231
+ }
1232
+ if (t.length > this._palette.length) {
1233
+ this.error(/* @__PURE__ */ Error("More transparent colors than palette size"));
1234
+ return;
1235
+ }
1236
+ for (let e = 0; e < t.length; e++) this._palette[e][3] = t[e];
1237
+ this.palette(this._palette);
1238
+ }
1239
+ this._colorType === e.COLORTYPE_GRAYSCALE && this.transColor([t.readUInt16BE(0)]), this._colorType === e.COLORTYPE_COLOR && this.transColor([
1240
+ t.readUInt16BE(0),
1241
+ t.readUInt16BE(2),
1242
+ t.readUInt16BE(4)
1243
+ ]), this._handleChunkEnd();
1244
+ }, n.prototype._handleGAMA = function(e) {
1245
+ this.read(e, this._parseGAMA.bind(this));
1246
+ }, n.prototype._parseGAMA = function(t) {
1247
+ this._crc.write(t), this.gamma(t.readUInt32BE(0) / e.GAMMA_DIVISION), this._handleChunkEnd();
1248
+ }, n.prototype._handleIDAT = function(e) {
1249
+ this._emittedHeadersFinished || (this._emittedHeadersFinished = !0, this.headersFinished()), this.read(-e, this._parseIDAT.bind(this, e));
1250
+ }, n.prototype._parseIDAT = function(t, n) {
1251
+ if (this._crc.write(n), this._colorType === e.COLORTYPE_PALETTE_COLOR && this._palette.length === 0) throw Error("Expected palette not found");
1252
+ this.inflateData(n);
1253
+ let r = t - n.length;
1254
+ r > 0 ? this._handleIDAT(r) : this._handleChunkEnd();
1255
+ }, n.prototype._handleIEND = function(e) {
1256
+ this.read(e, this._parseIEND.bind(this));
1257
+ }, n.prototype._parseIEND = function(e) {
1258
+ this._crc.write(e), this._hasIEND = !0, this._handleChunkEnd(), this.finished && this.finished();
1259
+ }, ce.exports;
1260
+ }
1261
+ var z = {}, B;
1262
+ function V() {
1263
+ if (B) return z;
1264
+ B = 1;
1265
+ let e = ne(), t = [
1266
+ function() {},
1267
+ function(e, t, n, r) {
1268
+ if (r === t.length) throw Error("Ran out of data");
1269
+ let i = t[r];
1270
+ e[n] = i, e[n + 1] = i, e[n + 2] = i, e[n + 3] = 255;
1271
+ },
1272
+ function(e, t, n, r) {
1273
+ if (r + 1 >= t.length) throw Error("Ran out of data");
1274
+ let i = t[r];
1275
+ e[n] = i, e[n + 1] = i, e[n + 2] = i, e[n + 3] = t[r + 1];
1276
+ },
1277
+ function(e, t, n, r) {
1278
+ if (r + 2 >= t.length) throw Error("Ran out of data");
1279
+ e[n] = t[r], e[n + 1] = t[r + 1], e[n + 2] = t[r + 2], e[n + 3] = 255;
1280
+ },
1281
+ function(e, t, n, r) {
1282
+ if (r + 3 >= t.length) throw Error("Ran out of data");
1283
+ e[n] = t[r], e[n + 1] = t[r + 1], e[n + 2] = t[r + 2], e[n + 3] = t[r + 3];
1284
+ }
1285
+ ], n = [
1286
+ function() {},
1287
+ function(e, t, n, r) {
1288
+ let i = t[0];
1289
+ e[n] = i, e[n + 1] = i, e[n + 2] = i, e[n + 3] = r;
1290
+ },
1291
+ function(e, t, n) {
1292
+ let r = t[0];
1293
+ e[n] = r, e[n + 1] = r, e[n + 2] = r, e[n + 3] = t[1];
1294
+ },
1295
+ function(e, t, n, r) {
1296
+ e[n] = t[0], e[n + 1] = t[1], e[n + 2] = t[2], e[n + 3] = r;
1297
+ },
1298
+ function(e, t, n) {
1299
+ e[n] = t[0], e[n + 1] = t[1], e[n + 2] = t[2], e[n + 3] = t[3];
1300
+ }
1301
+ ];
1302
+ function r(e, t) {
1303
+ let n = [], r = 0;
1304
+ function i() {
1305
+ if (r === e.length) throw Error("Ran out of data");
1306
+ let i = e[r];
1307
+ r++;
1308
+ let a, o, s, c, l, u, d, f;
1309
+ switch (t) {
1310
+ default: throw Error("unrecognised depth");
1311
+ case 16:
1312
+ d = e[r], r++, n.push((i << 8) + d);
1313
+ break;
1314
+ case 4:
1315
+ d = i & 15, f = i >> 4, n.push(f, d);
1316
+ break;
1317
+ case 2:
1318
+ l = i & 3, u = i >> 2 & 3, d = i >> 4 & 3, f = i >> 6 & 3, n.push(f, d, u, l);
1319
+ break;
1320
+ case 1:
1321
+ a = i & 1, o = i >> 1 & 1, s = i >> 2 & 1, c = i >> 3 & 1, l = i >> 4 & 1, u = i >> 5 & 1, d = i >> 6 & 1, f = i >> 7 & 1, n.push(f, d, u, l, c, s, o, a);
1322
+ break;
1323
+ }
1324
+ }
1325
+ return {
1326
+ get: function(e) {
1327
+ for (; n.length < e;) i();
1328
+ let t = n.slice(0, e);
1329
+ return n = n.slice(e), t;
1330
+ },
1331
+ resetAfterLine: function() {
1332
+ n.length = 0;
1333
+ },
1334
+ end: function() {
1335
+ if (r !== e.length) throw Error("extra data found");
1336
+ }
1337
+ };
1338
+ }
1339
+ function i(e, n, r, i, a, o) {
1340
+ let s = e.width, c = e.height, l = e.index;
1341
+ for (let e = 0; e < c; e++) for (let c = 0; c < s; c++) {
1342
+ let s = r(c, e, l);
1343
+ t[i](n, a, s, o), o += i;
1344
+ }
1345
+ return o;
1346
+ }
1347
+ function a(e, t, r, i, a, o) {
1348
+ let s = e.width, c = e.height, l = e.index;
1349
+ for (let e = 0; e < c; e++) {
1350
+ for (let c = 0; c < s; c++) {
1351
+ let s = a.get(i), u = r(c, e, l);
1352
+ n[i](t, s, u, o);
1353
+ }
1354
+ a.resetAfterLine();
1355
+ }
1356
+ }
1357
+ return z.dataToBitMap = function(t, n) {
1358
+ let o = n.width, s = n.height, c = n.depth, l = n.bpp, u = n.interlace, d;
1359
+ c !== 8 && (d = r(t, c));
1360
+ let f;
1361
+ f = c <= 8 ? y.alloc(o * s * 4) : new Uint16Array(o * s * 4);
1362
+ let p = 2 ** c - 1, m = 0, h, g;
1363
+ if (u) h = e.getImagePasses(o, s), g = e.getInterlaceIterator(o, s);
1364
+ else {
1365
+ let e = 0;
1366
+ g = function() {
1367
+ let t = e;
1368
+ return e += 4, t;
1369
+ }, h = [{
1370
+ width: o,
1371
+ height: s
1372
+ }];
1373
+ }
1374
+ for (let e = 0; e < h.length; e++) c === 8 ? m = i(h[e], f, g, l, t, m) : a(h[e], f, g, l, d, p);
1375
+ if (c === 8) {
1376
+ if (m !== t.length) throw Error("extra data found");
1377
+ } else d.end();
1378
+ return f;
1379
+ }, z;
1380
+ }
1381
+ var H, U;
1382
+ function W() {
1383
+ if (U) return H;
1384
+ U = 1;
1385
+ function e(e, t, n, r, i) {
1386
+ let a = 0;
1387
+ for (let o = 0; o < r; o++) for (let r = 0; r < n; r++) {
1388
+ let n = i[e[a]];
1389
+ if (!n) throw Error("index " + e[a] + " not in palette");
1390
+ for (let e = 0; e < 4; e++) t[a + e] = n[e];
1391
+ a += 4;
1392
+ }
1393
+ }
1394
+ function t(e, t, n, r, i) {
1395
+ let a = 0;
1396
+ for (let o = 0; o < r; o++) for (let r = 0; r < n; r++) {
1397
+ let n = !1;
1398
+ if (i.length === 1 ? i[0] === e[a] && (n = !0) : i[0] === e[a] && i[1] === e[a + 1] && i[2] === e[a + 2] && (n = !0), n) for (let e = 0; e < 4; e++) t[a + e] = 0;
1399
+ a += 4;
1400
+ }
1401
+ }
1402
+ function n(e, t, n, r, i) {
1403
+ let a = 2 ** i - 1, o = 0;
1404
+ for (let i = 0; i < r; i++) for (let r = 0; r < n; r++) {
1405
+ for (let n = 0; n < 4; n++) t[o + n] = Math.floor(e[o + n] * 255 / a + .5);
1406
+ o += 4;
1407
+ }
1408
+ }
1409
+ return H = function(r, i, a = !1) {
1410
+ let o = i.depth, s = i.width, c = i.height, l = i.colorType, u = i.transColor, d = i.palette, f = r;
1411
+ return l === 3 ? e(r, f, s, c, d) : (u && t(r, f, s, c, u), o !== 8 && !a && (o === 16 && (f = y.alloc(s * c * 4)), n(r, f, s, c, o))), f;
1412
+ }, H;
1413
+ }
1414
+ var G;
1415
+ function ue() {
1416
+ if (G) return C.exports;
1417
+ G = 1;
1418
+ let e = S, t = S, n = E(), r = se(), i = R(), a = V(), o = W(), s = C.exports = function(e) {
1419
+ n.call(this), this._parser = new i(e, {
1420
+ read: this.read.bind(this),
1421
+ error: this._handleError.bind(this),
1422
+ metadata: this._handleMetaData.bind(this),
1423
+ gamma: this.emit.bind(this, "gamma"),
1424
+ palette: this._handlePalette.bind(this),
1425
+ transColor: this._handleTransColor.bind(this),
1426
+ finished: this._finished.bind(this),
1427
+ inflateData: this._inflateData.bind(this),
1428
+ simpleTransparency: this._simpleTransparency.bind(this),
1429
+ headersFinished: this._headersFinished.bind(this)
1430
+ }), this._options = e, this.writable = !0, this._parser.start();
1431
+ };
1432
+ return e.inherits(s, n), s.prototype._handleError = function(e) {
1433
+ this.emit("error", e), this.writable = !1, this.destroy(), this._inflate && this._inflate.destroy && this._inflate.destroy(), this._filter && (this._filter.destroy(), this._filter.on("error", function() {})), this.errord = !0;
1434
+ }, s.prototype._inflateData = function(e) {
1435
+ if (!this._inflate) if (this._bitmapInfo.interlace) this._inflate = t.createInflate(), this._inflate.on("error", this.emit.bind(this, "error")), this._filter.on("complete", this._complete.bind(this)), this._inflate.pipe(this._filter);
1436
+ else {
1437
+ let e = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7 >> 3) + 1) * this._bitmapInfo.height, n = Math.max(e, t.Z_MIN_CHUNK);
1438
+ this._inflate = t.createInflate({ chunkSize: n });
1439
+ let r = e, i = this.emit.bind(this, "error");
1440
+ this._inflate.on("error", function(e) {
1441
+ r && i(e);
1442
+ }), this._filter.on("complete", this._complete.bind(this));
1443
+ let a = this._filter.write.bind(this._filter);
1444
+ this._inflate.on("data", function(e) {
1445
+ r && (e.length > r && (e = e.slice(0, r)), r -= e.length, a(e));
1446
+ }), this._inflate.on("end", this._filter.end.bind(this._filter));
1447
+ }
1448
+ this._inflate.write(e);
1449
+ }, s.prototype._handleMetaData = function(e) {
1450
+ this._metaData = e, this._bitmapInfo = Object.create(e), this._filter = new r(this._bitmapInfo);
1451
+ }, s.prototype._handleTransColor = function(e) {
1452
+ this._bitmapInfo.transColor = e;
1453
+ }, s.prototype._handlePalette = function(e) {
1454
+ this._bitmapInfo.palette = e;
1455
+ }, s.prototype._simpleTransparency = function() {
1456
+ this._metaData.alpha = !0;
1457
+ }, s.prototype._headersFinished = function() {
1458
+ this.emit("metadata", this._metaData);
1459
+ }, s.prototype._finished = function() {
1460
+ this.errord || (this._inflate ? this._inflate.end() : this.emit("error", "No Inflate block"));
1461
+ }, s.prototype._complete = function(e) {
1462
+ if (this.errord) return;
1463
+ let t;
1464
+ try {
1465
+ let n = a.dataToBitMap(e, this._bitmapInfo);
1466
+ t = o(n, this._bitmapInfo, this._options.skipRescale), n = null;
1467
+ } catch (e) {
1468
+ this._handleError(e);
1469
+ return;
1470
+ }
1471
+ this.emit("parsed", t);
1472
+ }, C.exports;
1473
+ }
1474
+ var K = { exports: {} }, q = { exports: {} }, J, de;
1475
+ function fe() {
1476
+ if (de) return J;
1477
+ de = 1;
1478
+ let e = N();
1479
+ return J = function(t, n, r, i) {
1480
+ let a = [e.COLORTYPE_COLOR_ALPHA, e.COLORTYPE_ALPHA].indexOf(i.colorType) !== -1;
1481
+ if (i.colorType === i.inputColorType) {
1482
+ let e = (function() {
1483
+ let e = /* @__PURE__ */ new ArrayBuffer(2);
1484
+ return new DataView(e).setInt16(0, 256, !0), new Int16Array(e)[0] !== 256;
1485
+ })();
1486
+ if (i.bitDepth === 8 || i.bitDepth === 16 && e) return t;
1487
+ }
1488
+ let o = i.bitDepth === 16 ? new Uint16Array(t.buffer) : t, s = 255, c = e.COLORTYPE_TO_BPP_MAP[i.inputColorType];
1489
+ c === 4 && !i.inputHasAlpha && (c = 3);
1490
+ let l = e.COLORTYPE_TO_BPP_MAP[i.colorType];
1491
+ i.bitDepth === 16 && (s = 65535, l *= 2);
1492
+ let u = y.alloc(n * r * l), d = 0, f = 0, p = i.bgColor || {};
1493
+ p.red === void 0 && (p.red = s), p.green === void 0 && (p.green = s), p.blue === void 0 && (p.blue = s);
1494
+ function m() {
1495
+ let t, n, r, c = s;
1496
+ switch (i.inputColorType) {
1497
+ case e.COLORTYPE_COLOR_ALPHA:
1498
+ c = o[d + 3], t = o[d], n = o[d + 1], r = o[d + 2];
1499
+ break;
1500
+ case e.COLORTYPE_COLOR:
1501
+ t = o[d], n = o[d + 1], r = o[d + 2];
1502
+ break;
1503
+ case e.COLORTYPE_ALPHA:
1504
+ c = o[d + 1], t = o[d], n = t, r = t;
1505
+ break;
1506
+ case e.COLORTYPE_GRAYSCALE:
1507
+ t = o[d], n = t, r = t;
1508
+ break;
1509
+ default: throw Error("input color type:" + i.inputColorType + " is not supported at present");
1510
+ }
1511
+ return i.inputHasAlpha && (a || (c /= s, t = Math.min(Math.max(Math.round((1 - c) * p.red + c * t), 0), s), n = Math.min(Math.max(Math.round((1 - c) * p.green + c * n), 0), s), r = Math.min(Math.max(Math.round((1 - c) * p.blue + c * r), 0), s))), {
1512
+ red: t,
1513
+ green: n,
1514
+ blue: r,
1515
+ alpha: c
1516
+ };
1517
+ }
1518
+ for (let t = 0; t < r; t++) for (let t = 0; t < n; t++) {
1519
+ let t = m();
1520
+ switch (i.colorType) {
1521
+ case e.COLORTYPE_COLOR_ALPHA:
1522
+ case e.COLORTYPE_COLOR:
1523
+ i.bitDepth === 8 ? (u[f] = t.red, u[f + 1] = t.green, u[f + 2] = t.blue, a && (u[f + 3] = t.alpha)) : (u.writeUInt16BE(t.red, f), u.writeUInt16BE(t.green, f + 2), u.writeUInt16BE(t.blue, f + 4), a && u.writeUInt16BE(t.alpha, f + 6));
1524
+ break;
1525
+ case e.COLORTYPE_ALPHA:
1526
+ case e.COLORTYPE_GRAYSCALE: {
1527
+ let e = (t.red + t.green + t.blue) / 3;
1528
+ i.bitDepth === 8 ? (u[f] = e, a && (u[f + 1] = t.alpha)) : (u.writeUInt16BE(e, f), a && u.writeUInt16BE(t.alpha, f + 2));
1529
+ break;
1530
+ }
1531
+ default: throw Error("unrecognised color Type " + i.colorType);
1532
+ }
1533
+ d += c, f += l;
1534
+ }
1535
+ return u;
1536
+ }, J;
1537
+ }
1538
+ var Y, X;
1539
+ function Z() {
1540
+ if (X) return Y;
1541
+ X = 1;
1542
+ let e = A();
1543
+ function t(e, t, n, r, i) {
1544
+ for (let a = 0; a < n; a++) r[i + a] = e[t + a];
1545
+ }
1546
+ function n(e, t, n) {
1547
+ let r = 0, i = t + n;
1548
+ for (let n = t; n < i; n++) r += Math.abs(e[n]);
1549
+ return r;
1550
+ }
1551
+ function r(e, t, n, r, i, a) {
1552
+ for (let o = 0; o < n; o++) {
1553
+ let n = o >= a ? e[t + o - a] : 0, s = e[t + o] - n;
1554
+ r[i + o] = s;
1555
+ }
1556
+ }
1557
+ function i(e, t, n, r) {
1558
+ let i = 0;
1559
+ for (let a = 0; a < n; a++) {
1560
+ let n = a >= r ? e[t + a - r] : 0, o = e[t + a] - n;
1561
+ i += Math.abs(o);
1562
+ }
1563
+ return i;
1564
+ }
1565
+ function a(e, t, n, r, i) {
1566
+ for (let a = 0; a < n; a++) {
1567
+ let o = t > 0 ? e[t + a - n] : 0, s = e[t + a] - o;
1568
+ r[i + a] = s;
1569
+ }
1570
+ }
1571
+ function o(e, t, n) {
1572
+ let r = 0, i = t + n;
1573
+ for (let a = t; a < i; a++) {
1574
+ let i = t > 0 ? e[a - n] : 0, o = e[a] - i;
1575
+ r += Math.abs(o);
1576
+ }
1577
+ return r;
1578
+ }
1579
+ function s(e, t, n, r, i, a) {
1580
+ for (let o = 0; o < n; o++) {
1581
+ let s = o >= a ? e[t + o - a] : 0, c = t > 0 ? e[t + o - n] : 0, l = e[t + o] - (s + c >> 1);
1582
+ r[i + o] = l;
1583
+ }
1584
+ }
1585
+ function c(e, t, n, r) {
1586
+ let i = 0;
1587
+ for (let a = 0; a < n; a++) {
1588
+ let o = a >= r ? e[t + a - r] : 0, s = t > 0 ? e[t + a - n] : 0, c = e[t + a] - (o + s >> 1);
1589
+ i += Math.abs(c);
1590
+ }
1591
+ return i;
1592
+ }
1593
+ function l(t, n, r, i, a, o) {
1594
+ for (let s = 0; s < r; s++) {
1595
+ let c = s >= o ? t[n + s - o] : 0, l = n > 0 ? t[n + s - r] : 0, u = n > 0 && s >= o ? t[n + s - (r + o)] : 0, d = t[n + s] - e(c, l, u);
1596
+ i[a + s] = d;
1597
+ }
1598
+ }
1599
+ function u(t, n, r, i) {
1600
+ let a = 0;
1601
+ for (let o = 0; o < r; o++) {
1602
+ let s = o >= i ? t[n + o - i] : 0, c = n > 0 ? t[n + o - r] : 0, l = n > 0 && o >= i ? t[n + o - (r + i)] : 0, u = t[n + o] - e(s, c, l);
1603
+ a += Math.abs(u);
1604
+ }
1605
+ return a;
1606
+ }
1607
+ let d = {
1608
+ 0: t,
1609
+ 1: r,
1610
+ 2: a,
1611
+ 3: s,
1612
+ 4: l
1613
+ }, f = {
1614
+ 0: n,
1615
+ 1: i,
1616
+ 2: o,
1617
+ 3: c,
1618
+ 4: u
1619
+ };
1620
+ return Y = function(e, t, n, r, i) {
1621
+ let a;
1622
+ if (!("filterType" in r) || r.filterType === -1) a = [
1623
+ 0,
1624
+ 1,
1625
+ 2,
1626
+ 3,
1627
+ 4
1628
+ ];
1629
+ else if (typeof r.filterType == "number") a = [r.filterType];
1630
+ else throw Error("unrecognised filter types");
1631
+ r.bitDepth === 16 && (i *= 2);
1632
+ let o = t * i, s = 0, c = 0, l = y.alloc((o + 1) * n), u = a[0];
1633
+ for (let t = 0; t < n; t++) {
1634
+ if (a.length > 1) {
1635
+ let t = Infinity;
1636
+ for (let n = 0; n < a.length; n++) {
1637
+ let r = f[a[n]](e, c, o, i);
1638
+ r < t && (u = a[n], t = r);
1639
+ }
1640
+ }
1641
+ l[s] = u, s++, d[u](e, c, o, l, s, i), s += o, c += o;
1642
+ }
1643
+ return l;
1644
+ }, Y;
1645
+ }
1646
+ var pe;
1647
+ function Q() {
1648
+ if (pe) return q.exports;
1649
+ pe = 1;
1650
+ let e = N(), t = I(), n = fe(), r = Z(), i = S, a = q.exports = function(t) {
1651
+ if (this._options = t, t.deflateChunkSize = t.deflateChunkSize || 32 * 1024, t.deflateLevel = t.deflateLevel == null ? 9 : t.deflateLevel, t.deflateStrategy = t.deflateStrategy == null ? 3 : t.deflateStrategy, t.inputHasAlpha = t.inputHasAlpha == null ? !0 : t.inputHasAlpha, t.deflateFactory = t.deflateFactory || i.createDeflate, t.bitDepth = t.bitDepth || 8, t.colorType = typeof t.colorType == "number" ? t.colorType : e.COLORTYPE_COLOR_ALPHA, t.inputColorType = typeof t.inputColorType == "number" ? t.inputColorType : e.COLORTYPE_COLOR_ALPHA, [
1652
+ e.COLORTYPE_GRAYSCALE,
1653
+ e.COLORTYPE_COLOR,
1654
+ e.COLORTYPE_COLOR_ALPHA,
1655
+ e.COLORTYPE_ALPHA
1656
+ ].indexOf(t.colorType) === -1) throw Error("option color type:" + t.colorType + " is not supported at present");
1657
+ if ([
1658
+ e.COLORTYPE_GRAYSCALE,
1659
+ e.COLORTYPE_COLOR,
1660
+ e.COLORTYPE_COLOR_ALPHA,
1661
+ e.COLORTYPE_ALPHA
1662
+ ].indexOf(t.inputColorType) === -1) throw Error("option input color type:" + t.inputColorType + " is not supported at present");
1663
+ if (t.bitDepth !== 8 && t.bitDepth !== 16) throw Error("option bit depth:" + t.bitDepth + " is not supported at present");
1664
+ };
1665
+ return a.prototype.getDeflateOptions = function() {
1666
+ return {
1667
+ chunkSize: this._options.deflateChunkSize,
1668
+ level: this._options.deflateLevel,
1669
+ strategy: this._options.deflateStrategy
1670
+ };
1671
+ }, a.prototype.createDeflate = function() {
1672
+ return this._options.deflateFactory(this.getDeflateOptions());
1673
+ }, a.prototype.filterData = function(t, i, a) {
1674
+ let o = n(t, i, a, this._options), s = e.COLORTYPE_TO_BPP_MAP[this._options.colorType];
1675
+ return r(o, i, a, this._options, s);
1676
+ }, a.prototype._packChunk = function(e, n) {
1677
+ let r = n ? n.length : 0, i = y.alloc(r + 12);
1678
+ return i.writeUInt32BE(r, 0), i.writeUInt32BE(e, 4), n && n.copy(i, 8), i.writeInt32BE(t.crc32(i.slice(4, i.length - 4)), i.length - 4), i;
1679
+ }, a.prototype.packGAMA = function(t) {
1680
+ let n = y.alloc(4);
1681
+ return n.writeUInt32BE(Math.floor(t * e.GAMMA_DIVISION), 0), this._packChunk(e.TYPE_gAMA, n);
1682
+ }, a.prototype.packIHDR = function(t, n) {
1683
+ let r = y.alloc(13);
1684
+ return r.writeUInt32BE(t, 0), r.writeUInt32BE(n, 4), r[8] = this._options.bitDepth, r[9] = this._options.colorType, r[10] = 0, r[11] = 0, r[12] = 0, this._packChunk(e.TYPE_IHDR, r);
1685
+ }, a.prototype.packIDAT = function(t) {
1686
+ return this._packChunk(e.TYPE_IDAT, t);
1687
+ }, a.prototype.packIEND = function() {
1688
+ return this._packChunk(e.TYPE_IEND, null);
1689
+ }, q.exports;
1690
+ }
1691
+ var me;
1692
+ function he() {
1693
+ if (me) return K.exports;
1694
+ me = 1;
1695
+ let e = S, t = S, n = N(), r = Q(), i = K.exports = function(e) {
1696
+ t.call(this);
1697
+ let n = e || {};
1698
+ this._packer = new r(n), this._deflate = this._packer.createDeflate(), this.readable = !0;
1699
+ };
1700
+ return e.inherits(i, t), i.prototype.pack = function(e, t, r, i) {
1701
+ this.emit("data", y.from(n.PNG_SIGNATURE)), this.emit("data", this._packer.packIHDR(t, r)), i && this.emit("data", this._packer.packGAMA(i));
1702
+ let a = this._packer.filterData(e, t, r);
1703
+ this._deflate.on("error", this.emit.bind(this, "error")), this._deflate.on("data", (function(e) {
1704
+ this.emit("data", this._packer.packIDAT(e));
1705
+ }).bind(this)), this._deflate.on("end", (function() {
1706
+ this.emit("data", this._packer.packIEND()), this.emit("end");
1707
+ }).bind(this)), this._deflate.end(a);
1708
+ }, K.exports;
1709
+ }
1710
+ var $ = {}, ge = { exports: {} }, _e;
1711
+ function ve() {
1712
+ return _e || (_e = 1, (function(e, t) {
1713
+ let n = S.ok, r = S, i = S, a = S.kMaxLength;
1714
+ function o(e) {
1715
+ if (!(this instanceof o)) return new o(e);
1716
+ e && e.chunkSize < r.Z_MIN_CHUNK && (e.chunkSize = r.Z_MIN_CHUNK), r.Inflate.call(this, e), this._offset = this._offset === void 0 ? this._outOffset : this._offset, this._buffer = this._buffer || this._outBuffer, e && e.maxLength != null && (this._maxLength = e.maxLength);
1717
+ }
1718
+ function s(e) {
1719
+ return new o(e);
1720
+ }
1721
+ function c(e, t) {
1722
+ e._handle &&= (e._handle.close(), null);
1723
+ }
1724
+ o.prototype._processChunk = function(e, t, i) {
1725
+ if (typeof i == "function") return r.Inflate._processChunk.call(this, e, t, i);
1726
+ let o = this, s = e && e.length, l = this._chunkSize - this._offset, u = this._maxLength, d = 0, f = [], p = 0, m;
1727
+ this.on("error", function(e) {
1728
+ m = e;
1729
+ });
1730
+ function h(e, t) {
1731
+ if (o._hadError) return;
1732
+ let r = l - t;
1733
+ if (n(r >= 0, "have should not go down"), r > 0) {
1734
+ let e = o._buffer.slice(o._offset, o._offset + r);
1735
+ if (o._offset += r, e.length > u && (e = e.slice(0, u)), f.push(e), p += e.length, u -= e.length, u === 0) return !1;
1736
+ }
1737
+ return (t === 0 || o._offset >= o._chunkSize) && (l = o._chunkSize, o._offset = 0, o._buffer = y.allocUnsafe(o._chunkSize)), t === 0 ? (d += s - e, s = e, !0) : !1;
1738
+ }
1739
+ n(this._handle, "zlib binding closed");
1740
+ let g;
1741
+ do
1742
+ g = this._handle.writeSync(t, e, d, s, this._buffer, this._offset, l), g ||= this._writeState;
1743
+ while (!this._hadError && h(g[0], g[1]));
1744
+ if (this._hadError) throw m;
1745
+ if (p >= a) throw c(this), /* @__PURE__ */ RangeError("Cannot create final Buffer. It would be larger than 0x" + a.toString(16) + " bytes");
1746
+ let _ = y.concat(f, p);
1747
+ return c(this), _;
1748
+ }, i.inherits(o, r.Inflate);
1749
+ function l(e, t) {
1750
+ if (typeof t == "string" && (t = y.from(t)), !(t instanceof y)) throw TypeError("Not a string or buffer");
1751
+ let n = e._finishFlushFlag;
1752
+ return n ??= r.Z_FINISH, e._processChunk(t, n);
1753
+ }
1754
+ function u(e, t) {
1755
+ return l(new o(t), e);
1756
+ }
1757
+ e.exports = t = u, t.Inflate = o, t.createInflate = s, t.inflateSync = u;
1758
+ })(ge, ge.exports)), ge.exports;
1759
+ }
1760
+ var ye = { exports: {} }, be;
1761
+ function xe() {
1762
+ if (be) return ye.exports;
1763
+ be = 1;
1764
+ let e = ye.exports = function(e) {
1765
+ this._buffer = e, this._reads = [];
1766
+ };
1767
+ return e.prototype.read = function(e, t) {
1768
+ this._reads.push({
1769
+ length: Math.abs(e),
1770
+ allowLess: e < 0,
1771
+ func: t
1772
+ });
1773
+ }, e.prototype.process = function() {
1774
+ for (; this._reads.length > 0 && this._buffer.length;) {
1775
+ let e = this._reads[0];
1776
+ if (this._buffer.length && (this._buffer.length >= e.length || e.allowLess)) {
1777
+ this._reads.shift();
1778
+ let t = this._buffer;
1779
+ this._buffer = t.slice(e.length), e.func.call(this, t.slice(0, e.length));
1780
+ } else break;
1781
+ }
1782
+ if (this._reads.length > 0) throw Error("There are some read requests waitng on finished stream");
1783
+ if (this._buffer.length > 0) throw Error("unrecognised content at end of stream");
1784
+ }, ye.exports;
1785
+ }
1786
+ var Se = {}, Ce;
1787
+ function we() {
1788
+ if (Ce) return Se;
1789
+ Ce = 1;
1790
+ let e = xe(), t = ae();
1791
+ return Se.process = function(n, r) {
1792
+ let i = [], a = new e(n);
1793
+ return new t(r, {
1794
+ read: a.read.bind(a),
1795
+ write: function(e) {
1796
+ i.push(e);
1797
+ },
1798
+ complete: function() {}
1799
+ }).start(), a.process(), y.concat(i);
1800
+ }, Se;
1801
+ }
1802
+ var Te, Ee;
1803
+ function De() {
1804
+ if (Ee) return Te;
1805
+ Ee = 1;
1806
+ let e = !0, t = S, n = ve();
1807
+ t.deflateSync || (e = !1);
1808
+ let r = xe(), i = we(), a = R(), o = V(), s = W();
1809
+ return Te = function(c, l) {
1810
+ if (!e) throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");
1811
+ let u;
1812
+ function d(e) {
1813
+ u = e;
1814
+ }
1815
+ let f;
1816
+ function p(e) {
1817
+ f = e;
1818
+ }
1819
+ function m(e) {
1820
+ f.transColor = e;
1821
+ }
1822
+ function h(e) {
1823
+ f.palette = e;
1824
+ }
1825
+ function g() {
1826
+ f.alpha = !0;
1827
+ }
1828
+ let _;
1829
+ function v(e) {
1830
+ _ = e;
1831
+ }
1832
+ let b = [];
1833
+ function ee(e) {
1834
+ b.push(e);
1835
+ }
1836
+ let x = new r(c);
1837
+ if (new a(l, {
1838
+ read: x.read.bind(x),
1839
+ error: d,
1840
+ metadata: p,
1841
+ gamma: v,
1842
+ palette: h,
1843
+ transColor: m,
1844
+ inflateData: ee,
1845
+ simpleTransparency: g
1846
+ }).start(), x.process(), u) throw u;
1847
+ let S = y.concat(b);
1848
+ b.length = 0;
1849
+ let C;
1850
+ if (f.interlace) C = t.inflateSync(S);
1851
+ else {
1852
+ let e = ((f.width * f.bpp * f.depth + 7 >> 3) + 1) * f.height;
1853
+ C = n(S, {
1854
+ chunkSize: e,
1855
+ maxLength: e
1856
+ });
1857
+ }
1858
+ if (S = null, !C || !C.length) throw Error("bad png - invalid inflate data response");
1859
+ let w = i.process(C, f);
1860
+ S = null;
1861
+ let T = o.dataToBitMap(w, f);
1862
+ w = null;
1863
+ let E = s(T, f, l.skipRescale);
1864
+ return f.data = E, f.gamma = _ || 0, f;
1865
+ }, Te;
1866
+ }
1867
+ var Oe, ke;
1868
+ function Ae() {
1869
+ if (ke) return Oe;
1870
+ ke = 1;
1871
+ let e = !0, t = S;
1872
+ t.deflateSync || (e = !1);
1873
+ let n = N(), r = Q();
1874
+ return Oe = function(i, a) {
1875
+ if (!e) throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");
1876
+ let o = new r(a || {}), s = [];
1877
+ s.push(y.from(n.PNG_SIGNATURE)), s.push(o.packIHDR(i.width, i.height)), i.gamma && s.push(o.packGAMA(i.gamma));
1878
+ let c = o.filterData(i.data, i.width, i.height), l = t.deflateSync(c, o.getDeflateOptions());
1879
+ if (c = null, !l || !l.length) throw Error("bad png - invalid compressed data response");
1880
+ return s.push(o.packIDAT(l)), s.push(o.packIEND()), y.concat(s);
1881
+ }, Oe;
1882
+ }
1883
+ var je;
1884
+ function Me() {
1885
+ if (je) return $;
1886
+ je = 1;
1887
+ let e = De(), t = Ae();
1888
+ return $.read = function(t, n) {
1889
+ return e(t, n || {});
1890
+ }, $.write = function(e, n) {
1891
+ return t(e, n);
1892
+ }, $;
1893
+ }
1894
+ var Ne;
1895
+ function Pe() {
1896
+ if (Ne) return x;
1897
+ Ne = 1;
1898
+ let t = S, n = S, r = ue(), i = he(), a = Me(), o = x.PNG = function(e) {
1899
+ n.call(this), e ||= {}, this.width = e.width | 0, this.height = e.height | 0, this.data = this.width > 0 && this.height > 0 ? y.alloc(4 * this.width * this.height) : null, e.fill && this.data && this.data.fill(0), this.gamma = 0, this.readable = this.writable = !0, this._parser = new r(e), this._parser.on("error", this.emit.bind(this, "error")), this._parser.on("close", this._handleClose.bind(this)), this._parser.on("metadata", this._metadata.bind(this)), this._parser.on("gamma", this._gamma.bind(this)), this._parser.on("parsed", (function(e) {
1900
+ this.data = e, this.emit("parsed", e);
1901
+ }).bind(this)), this._packer = new i(e), this._packer.on("data", this.emit.bind(this, "data")), this._packer.on("end", this.emit.bind(this, "end")), this._parser.on("close", this._handleClose.bind(this)), this._packer.on("error", this.emit.bind(this, "error"));
1902
+ };
1903
+ return t.inherits(o, n), o.sync = a, o.prototype.pack = function() {
1904
+ return !this.data || !this.data.length ? (this.emit("error", "No data provided"), this) : (e.nextTick((function() {
1905
+ this._packer.pack(this.data, this.width, this.height, this.gamma);
1906
+ }).bind(this)), this);
1907
+ }, o.prototype.parse = function(e, t) {
1908
+ if (t) {
1909
+ let e, n;
1910
+ e = (function(e) {
1911
+ this.removeListener("error", n), this.data = e, t(null, this);
1912
+ }).bind(this), n = (function(n) {
1913
+ this.removeListener("parsed", e), t(n, null);
1914
+ }).bind(this), this.once("parsed", e), this.once("error", n);
1915
+ }
1916
+ return this.end(e), this;
1917
+ }, o.prototype.write = function(e) {
1918
+ return this._parser.write(e), !0;
1919
+ }, o.prototype.end = function(e) {
1920
+ this._parser.end(e);
1921
+ }, o.prototype._metadata = function(e) {
1922
+ this.width = e.width, this.height = e.height, this.emit("metadata", e);
1923
+ }, o.prototype._gamma = function(e) {
1924
+ this.gamma = e;
1925
+ }, o.prototype._handleClose = function() {
1926
+ !this._parser.writable && !this._packer.readable && this.emit("close");
1927
+ }, o.bitblt = function(e, t, n, r, i, a, o, s) {
1928
+ if (n |= 0, r |= 0, i |= 0, a |= 0, o |= 0, s |= 0, n > e.width || r > e.height || n + i > e.width || r + a > e.height) throw Error("bitblt reading outside image");
1929
+ if (o > t.width || s > t.height || o + i > t.width || s + a > t.height) throw Error("bitblt writing outside image");
1930
+ for (let c = 0; c < a; c++) e.data.copy(t.data, (s + c) * t.width + o << 2, (r + c) * e.width + n << 2, (r + c) * e.width + n + i << 2);
1931
+ }, o.prototype.bitblt = function(e, t, n, r, i, a, s) {
1932
+ return o.bitblt(this, e, t, n, r, i, a, s), this;
1933
+ }, o.adjustGamma = function(e) {
1934
+ if (e.gamma) {
1935
+ for (let t = 0; t < e.height; t++) for (let n = 0; n < e.width; n++) {
1936
+ let r = e.width * t + n << 2;
1937
+ for (let t = 0; t < 3; t++) {
1938
+ let n = e.data[r + t] / 255;
1939
+ n **= 1 / 2.2 / e.gamma, e.data[r + t] = Math.round(n * 255);
1940
+ }
1941
+ }
1942
+ e.gamma = 0;
1943
+ }
1944
+ }, o.prototype.adjustGamma = function() {
1945
+ o.adjustGamma(this);
1946
+ }, x;
1947
+ }
1948
+ var Fe = /* @__PURE__ */ b({ __proto__: null }, [Pe()]);
1949
+ //#endregion
1950
+ export { Fe as p };