@vctrl/hooks 0.16.2 → 0.18.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.
- package/CHANGELOG.md +28 -0
- package/GLTFLoader-CygFefRr.cjs +1 -0
- package/GLTFLoader-NiJ7qzh1.js +1381 -0
- package/README.md +0 -20
- package/__vite-browser-external-Bn_csQuM.js +7 -0
- package/__vite-browser-external-CVmj8TrW.cjs +1 -0
- package/chunk-foFoljWS.js +23 -0
- package/chunk-gGpyby2o.cjs +1 -0
- package/index.cjs.js +1 -0
- package/index.d.ts +5 -0
- package/index.es.js +4 -0
- package/lib-DKn2MJ9X.js +4111 -0
- package/lib-DZ-MihdJ.cjs +2 -0
- package/model-exporter-SMSAY90N.cjs +1 -0
- package/model-exporter-cvguDGnn.js +6512 -0
- package/package.json +1 -1
- package/server-communication-Bj6ZxFw2.js +4659 -0
- package/server-communication-yXZR8eso.cjs +18 -0
- package/use-export-model/use-export-model.d.ts +14 -0
- package/use-export-model-CaijtW1c.cjs +1 -0
- package/use-export-model-DzVKdqnY.js +49 -0
- package/use-export-model.cjs.js +1 -0
- package/use-export-model.es.js +2 -0
- package/use-load-model/event-system.d.ts +7 -0
- package/use-load-model/index.d.ts +4 -0
- package/use-load-model/state.d.ts +19 -0
- package/use-load-model/types.d.ts +231 -0
- package/use-load-model/use-load-model.d.ts +30 -0
- package/use-load-model/utils/calculate-referenced-bytes.d.ts +8 -0
- package/use-load-model/utils/index.d.ts +4 -0
- package/use-load-model/utils/read-directory.d.ts +8 -0
- package/use-load-model/utils/reconstruct-files.d.ts +29 -0
- package/use-load-model/utils/resolve-scene-payload.d.ts +6 -0
- package/use-load-model-B6UXiFWh.js +517 -0
- package/use-load-model-CH-WPQ_s.cjs +1 -0
- package/use-load-model.cjs.js +1 -0
- package/use-load-model.es.js +18 -0
- package/{src/use-optimize-model/index.ts → use-optimize-model/index.d.ts} +2 -2
- package/use-optimize-model/state.d.ts +13 -0
- package/use-optimize-model/types.d.ts +39 -0
- package/use-optimize-model/use-calc-optimization-info.d.ts +6 -0
- package/use-optimize-model/use-optimize-model.d.ts +119 -0
- package/use-optimize-model/utils/index.d.ts +2 -0
- package/use-optimize-model/utils/texture-optimization.d.ts +17 -0
- package/use-optimize-model/utils/validation.d.ts +8 -0
- package/use-optimize-model-C-fzzKh6.cjs +1 -0
- package/use-optimize-model-Cb3WMvDZ.js +299 -0
- package/use-optimize-model.cjs.js +1 -0
- package/use-optimize-model.es.js +2 -0
- package/utils/server-communication.d.ts +122 -0
- package/project.json +0 -55
- package/src/index.ts +0 -38
- package/src/use-export-model/use-export-model.ts +0 -113
- package/src/use-load-model/event-system.ts +0 -46
- package/src/use-load-model/index.ts +0 -15
- package/src/use-load-model/model-context.tsx +0 -174
- package/src/use-load-model/state.ts +0 -75
- package/src/use-load-model/types.ts +0 -284
- package/src/use-load-model/use-load-model.ts +0 -682
- package/src/use-load-model/utils/calculate-referenced-bytes.ts +0 -123
- package/src/use-load-model/utils/index.ts +0 -7
- package/src/use-load-model/utils/read-directory.ts +0 -35
- package/src/use-load-model/utils/reconstruct-files.ts +0 -85
- package/src/use-load-model/utils/resolve-scene-payload.ts +0 -151
- package/src/use-optimize-model/state.ts +0 -40
- package/src/use-optimize-model/types.ts +0 -37
- package/src/use-optimize-model/use-calc-optimization-info.ts +0 -101
- package/src/use-optimize-model/use-optimize-model.ts +0 -467
- package/src/use-optimize-model/utils/index.ts +0 -29
- package/src/use-optimize-model/utils/texture-optimization.ts +0 -292
- package/src/use-optimize-model/utils/validation.ts +0 -62
- package/src/utils/server-communication.ts +0 -351
- package/tsconfig.json +0 -21
- package/tsconfig.lib.json +0 -16
- package/vite.config.ts +0 -77
- /package/{src/use-export-model/index.ts → use-export-model/index.d.ts} +0 -0
package/lib-DKn2MJ9X.js
ADDED
|
@@ -0,0 +1,4111 @@
|
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./chunk-foFoljWS.js";
|
|
2
|
+
import { t as a } from "./__vite-browser-external-Bn_csQuM.js";
|
|
3
|
+
//#region node_modules/.pnpm/sharp@0.34.5/node_modules/sharp/lib/is.js
|
|
4
|
+
var o = /* @__PURE__ */ i(((e, t) => {
|
|
5
|
+
var n = (e) => e != null;
|
|
6
|
+
t.exports = {
|
|
7
|
+
defined: n,
|
|
8
|
+
object: (e) => typeof e == "object",
|
|
9
|
+
plainObject: (e) => Object.prototype.toString.call(e) === "[object Object]",
|
|
10
|
+
fn: (e) => typeof e == "function",
|
|
11
|
+
bool: (e) => typeof e == "boolean",
|
|
12
|
+
buffer: (e) => e instanceof Buffer,
|
|
13
|
+
typedArray: (e) => {
|
|
14
|
+
if (n(e)) switch (e.constructor) {
|
|
15
|
+
case Uint8Array:
|
|
16
|
+
case Uint8ClampedArray:
|
|
17
|
+
case Int8Array:
|
|
18
|
+
case Uint16Array:
|
|
19
|
+
case Int16Array:
|
|
20
|
+
case Uint32Array:
|
|
21
|
+
case Int32Array:
|
|
22
|
+
case Float32Array:
|
|
23
|
+
case Float64Array: return !0;
|
|
24
|
+
}
|
|
25
|
+
return !1;
|
|
26
|
+
},
|
|
27
|
+
arrayBuffer: (e) => e instanceof ArrayBuffer,
|
|
28
|
+
string: (e) => typeof e == "string" && e.length > 0,
|
|
29
|
+
number: (e) => typeof e == "number" && !Number.isNaN(e),
|
|
30
|
+
integer: (e) => Number.isInteger(e),
|
|
31
|
+
inRange: (e, t, n) => e >= t && e <= n,
|
|
32
|
+
inArray: (e, t) => t.includes(e),
|
|
33
|
+
invalidParameterError: (e, t, n) => /* @__PURE__ */ Error(`Expected ${t} for ${e} but received ${n} of type ${typeof n}`),
|
|
34
|
+
nativeError: (e, t) => (t.message = e.message, t)
|
|
35
|
+
};
|
|
36
|
+
})), s = /* @__PURE__ */ i(((e, t) => {
|
|
37
|
+
var n = () => process.platform === "linux", r = null;
|
|
38
|
+
t.exports = {
|
|
39
|
+
isLinux: n,
|
|
40
|
+
getReport: () => {
|
|
41
|
+
if (!r)
|
|
42
|
+
/* istanbul ignore next */
|
|
43
|
+
if (n() && process.report) {
|
|
44
|
+
let e = process.report.excludeNetwork;
|
|
45
|
+
process.report.excludeNetwork = !0, r = process.report.getReport(), process.report.excludeNetwork = e;
|
|
46
|
+
} else r = {};
|
|
47
|
+
return r;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
})), c = /* @__PURE__ */ i(((e, t) => {
|
|
51
|
+
var n = a(), r = "/usr/bin/ldd", i = "/proc/self/exe", o = 2048;
|
|
52
|
+
t.exports = {
|
|
53
|
+
LDD_PATH: r,
|
|
54
|
+
SELF_PATH: i,
|
|
55
|
+
readFileSync: (e) => {
|
|
56
|
+
let t = n.openSync(e, "r"), r = Buffer.alloc(o), i = n.readSync(t, r, 0, o, 0);
|
|
57
|
+
return n.close(t, () => {}), r.subarray(0, i);
|
|
58
|
+
},
|
|
59
|
+
readFile: (e) => new Promise((t, r) => {
|
|
60
|
+
n.open(e, "r", (e, i) => {
|
|
61
|
+
if (e) r(e);
|
|
62
|
+
else {
|
|
63
|
+
let e = Buffer.alloc(o);
|
|
64
|
+
n.read(i, e, 0, o, 0, (r, a) => {
|
|
65
|
+
t(e.subarray(0, a)), n.close(i, () => {});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
})), l = /* @__PURE__ */ i(((e, t) => {
|
|
72
|
+
t.exports = { interpreterPath: (e) => {
|
|
73
|
+
if (e.length < 64 || e.readUInt32BE(0) !== 2135247942 || e.readUInt8(4) !== 2 || e.readUInt8(5) !== 1) return null;
|
|
74
|
+
let t = e.readUInt32LE(32), n = e.readUInt16LE(54), r = e.readUInt16LE(56);
|
|
75
|
+
for (let i = 0; i < r; i++) {
|
|
76
|
+
let r = t + i * n;
|
|
77
|
+
if (e.readUInt32LE(r) === 3) {
|
|
78
|
+
let t = e.readUInt32LE(r + 8), n = e.readUInt32LE(r + 32);
|
|
79
|
+
return e.subarray(t, t + n).toString().replace(/\0.*$/g, "");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
} };
|
|
84
|
+
})), u = /* @__PURE__ */ i(((e, t) => {
|
|
85
|
+
var n = a(), { isLinux: r, getReport: i } = s(), { LDD_PATH: o, SELF_PATH: u, readFile: d, readFileSync: f } = c(), { interpreterPath: p } = l(), m, h, g, _ = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true", v = "", y = () => v || new Promise((e) => {
|
|
86
|
+
n.exec(_, (t, n) => {
|
|
87
|
+
v = t ? " " : n, e(v);
|
|
88
|
+
});
|
|
89
|
+
}), b = () => {
|
|
90
|
+
if (!v) try {
|
|
91
|
+
v = n.execSync(_, { encoding: "utf8" });
|
|
92
|
+
} catch {
|
|
93
|
+
v = " ";
|
|
94
|
+
}
|
|
95
|
+
return v;
|
|
96
|
+
}, x = "glibc", S = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i, C = "musl", w = (e) => e.includes("libc.musl-") || e.includes("ld-musl-"), T = () => {
|
|
97
|
+
let e = i();
|
|
98
|
+
return e.header && e.header.glibcVersionRuntime ? x : Array.isArray(e.sharedObjects) && e.sharedObjects.some(w) ? C : null;
|
|
99
|
+
}, E = (e) => {
|
|
100
|
+
let [t, n] = e.split(/[\r\n]+/);
|
|
101
|
+
return t && t.includes(x) ? x : n && n.includes(C) ? C : null;
|
|
102
|
+
}, D = (e) => {
|
|
103
|
+
if (e) {
|
|
104
|
+
if (e.includes("/ld-musl-")) return C;
|
|
105
|
+
if (e.includes("/ld-linux-")) return x;
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}, O = (e) => (e = e.toString(), e.includes("musl") ? C : e.includes("GNU C Library") ? x : null), k = async () => {
|
|
109
|
+
if (h !== void 0) return h;
|
|
110
|
+
h = null;
|
|
111
|
+
try {
|
|
112
|
+
h = O(await d(o));
|
|
113
|
+
} catch {}
|
|
114
|
+
return h;
|
|
115
|
+
}, A = () => {
|
|
116
|
+
if (h !== void 0) return h;
|
|
117
|
+
h = null;
|
|
118
|
+
try {
|
|
119
|
+
h = O(f(o));
|
|
120
|
+
} catch {}
|
|
121
|
+
return h;
|
|
122
|
+
}, j = async () => {
|
|
123
|
+
if (m !== void 0) return m;
|
|
124
|
+
m = null;
|
|
125
|
+
try {
|
|
126
|
+
m = D(p(await d(u)));
|
|
127
|
+
} catch {}
|
|
128
|
+
return m;
|
|
129
|
+
}, M = () => {
|
|
130
|
+
if (m !== void 0) return m;
|
|
131
|
+
m = null;
|
|
132
|
+
try {
|
|
133
|
+
m = D(p(f(u)));
|
|
134
|
+
} catch {}
|
|
135
|
+
return m;
|
|
136
|
+
}, N = async () => {
|
|
137
|
+
let e = null;
|
|
138
|
+
return r() && (e = await j(), e || (e = await k(), e ||= T(), e ||= E(await y()))), e;
|
|
139
|
+
}, P = () => {
|
|
140
|
+
let e = null;
|
|
141
|
+
return r() && (e = M(), e || (e = A(), e ||= T(), e ||= E(b()))), e;
|
|
142
|
+
}, F = async () => r() && await N() !== x, I = () => r() && P() !== x, L = async () => {
|
|
143
|
+
if (g !== void 0) return g;
|
|
144
|
+
g = null;
|
|
145
|
+
try {
|
|
146
|
+
let e = (await d(o)).match(S);
|
|
147
|
+
e && (g = e[1]);
|
|
148
|
+
} catch {}
|
|
149
|
+
return g;
|
|
150
|
+
}, R = () => {
|
|
151
|
+
if (g !== void 0) return g;
|
|
152
|
+
g = null;
|
|
153
|
+
try {
|
|
154
|
+
let e = f(o).match(S);
|
|
155
|
+
e && (g = e[1]);
|
|
156
|
+
} catch {}
|
|
157
|
+
return g;
|
|
158
|
+
}, z = () => {
|
|
159
|
+
let e = i();
|
|
160
|
+
return e.header && e.header.glibcVersionRuntime ? e.header.glibcVersionRuntime : null;
|
|
161
|
+
}, B = (e) => e.trim().split(/\s+/)[1], V = (e) => {
|
|
162
|
+
let [t, n, r] = e.split(/[\r\n]+/);
|
|
163
|
+
return t && t.includes(x) ? B(t) : n && r && n.includes(C) ? B(r) : null;
|
|
164
|
+
};
|
|
165
|
+
t.exports = {
|
|
166
|
+
GLIBC: x,
|
|
167
|
+
MUSL: C,
|
|
168
|
+
family: N,
|
|
169
|
+
familySync: P,
|
|
170
|
+
isNonGlibcLinux: F,
|
|
171
|
+
isNonGlibcLinuxSync: I,
|
|
172
|
+
version: async () => {
|
|
173
|
+
let e = null;
|
|
174
|
+
return r() && (e = await L(), e ||= z(), e ||= V(await y())), e;
|
|
175
|
+
},
|
|
176
|
+
versionSync: () => {
|
|
177
|
+
let e = null;
|
|
178
|
+
return r() && (e = R(), e ||= z(), e ||= V(b())), e;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
})), d = /* @__PURE__ */ i(((e, t) => {
|
|
182
|
+
t.exports = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...e) => console.error("SEMVER", ...e) : () => {};
|
|
183
|
+
})), f = /* @__PURE__ */ i(((e, t) => {
|
|
184
|
+
var n = "2.0.0", r = 256;
|
|
185
|
+
t.exports = {
|
|
186
|
+
MAX_LENGTH: r,
|
|
187
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
188
|
+
MAX_SAFE_BUILD_LENGTH: r - 6,
|
|
189
|
+
MAX_SAFE_INTEGER: 2 ** 53 - 1 || 9007199254740991,
|
|
190
|
+
RELEASE_TYPES: [
|
|
191
|
+
"major",
|
|
192
|
+
"premajor",
|
|
193
|
+
"minor",
|
|
194
|
+
"preminor",
|
|
195
|
+
"patch",
|
|
196
|
+
"prepatch",
|
|
197
|
+
"prerelease"
|
|
198
|
+
],
|
|
199
|
+
SEMVER_SPEC_VERSION: n,
|
|
200
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
201
|
+
FLAG_LOOSE: 2
|
|
202
|
+
};
|
|
203
|
+
})), p = /* @__PURE__ */ i(((e, t) => {
|
|
204
|
+
var { MAX_SAFE_COMPONENT_LENGTH: n, MAX_SAFE_BUILD_LENGTH: r, MAX_LENGTH: i } = f(), a = d();
|
|
205
|
+
e = t.exports = {};
|
|
206
|
+
var o = e.re = [], s = e.safeRe = [], c = e.src = [], l = e.safeSrc = [], u = e.t = {}, p = 0, m = "[a-zA-Z0-9-]", h = [
|
|
207
|
+
["\\s", 1],
|
|
208
|
+
["\\d", i],
|
|
209
|
+
[m, r]
|
|
210
|
+
], g = (e) => {
|
|
211
|
+
for (let [t, n] of h) e = e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);
|
|
212
|
+
return e;
|
|
213
|
+
}, _ = (e, t, n) => {
|
|
214
|
+
let r = g(t), i = p++;
|
|
215
|
+
a(e, i, t), u[e] = i, c[i] = t, l[i] = r, o[i] = new RegExp(t, n ? "g" : void 0), s[i] = new RegExp(r, n ? "g" : void 0);
|
|
216
|
+
};
|
|
217
|
+
_("NUMERICIDENTIFIER", "0|[1-9]\\d*"), _("NUMERICIDENTIFIERLOOSE", "\\d+"), _("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${m}*`), _("MAINVERSION", `(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`), _("MAINVERSIONLOOSE", `(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`), _("PRERELEASEIDENTIFIER", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`), _("PRERELEASEIDENTIFIERLOOSE", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`), _("PRERELEASE", `(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`), _("PRERELEASELOOSE", `(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`), _("BUILDIDENTIFIER", `${m}+`), _("BUILD", `(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`), _("FULLPLAIN", `v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`), _("FULL", `^${c[u.FULLPLAIN]}$`), _("LOOSEPLAIN", `[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`), _("LOOSE", `^${c[u.LOOSEPLAIN]}$`), _("GTLT", "((?:<|>)?=?)"), _("XRANGEIDENTIFIERLOOSE", `${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), _("XRANGEIDENTIFIER", `${c[u.NUMERICIDENTIFIER]}|x|X|\\*`), _("XRANGEPLAIN", `[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`), _("XRANGEPLAINLOOSE", `[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`), _("XRANGE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`), _("XRANGELOOSE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`), _("COERCEPLAIN", `(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`), _("COERCE", `${c[u.COERCEPLAIN]}(?:$|[^\\d])`), _("COERCEFULL", c[u.COERCEPLAIN] + `(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`), _("COERCERTL", c[u.COERCE], !0), _("COERCERTLFULL", c[u.COERCEFULL], !0), _("LONETILDE", "(?:~>?)"), _("TILDETRIM", `(\\s*)${c[u.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", _("TILDE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`), _("TILDELOOSE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`), _("LONECARET", "(?:\\^)"), _("CARETTRIM", `(\\s*)${c[u.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", _("CARET", `^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`), _("CARETLOOSE", `^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`), _("COMPARATORLOOSE", `^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`), _("COMPARATOR", `^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`), _("COMPARATORTRIM", `(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", _("HYPHENRANGE", `^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`), _("HYPHENRANGELOOSE", `^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`), _("STAR", "(<|>)?=?\\s*\\*"), _("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), _("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
218
|
+
})), m = /* @__PURE__ */ i(((e, t) => {
|
|
219
|
+
var n = Object.freeze({ loose: !0 }), r = Object.freeze({});
|
|
220
|
+
t.exports = (e) => e ? typeof e == "object" ? e : n : r;
|
|
221
|
+
})), h = /* @__PURE__ */ i(((e, t) => {
|
|
222
|
+
var n = /^[0-9]+$/, r = (e, t) => {
|
|
223
|
+
if (typeof e == "number" && typeof t == "number") return e === t ? 0 : e < t ? -1 : 1;
|
|
224
|
+
let r = n.test(e), i = n.test(t);
|
|
225
|
+
return r && i && (e = +e, t = +t), e === t ? 0 : r && !i ? -1 : i && !r ? 1 : e < t ? -1 : 1;
|
|
226
|
+
};
|
|
227
|
+
t.exports = {
|
|
228
|
+
compareIdentifiers: r,
|
|
229
|
+
rcompareIdentifiers: (e, t) => r(t, e)
|
|
230
|
+
};
|
|
231
|
+
})), g = /* @__PURE__ */ i(((e, t) => {
|
|
232
|
+
var n = d(), { MAX_LENGTH: r, MAX_SAFE_INTEGER: i } = f(), { safeRe: a, t: o } = p(), s = m(), { compareIdentifiers: c } = h();
|
|
233
|
+
t.exports = class e {
|
|
234
|
+
constructor(t, c) {
|
|
235
|
+
if (c = s(c), t instanceof e) {
|
|
236
|
+
if (t.loose === !!c.loose && t.includePrerelease === !!c.includePrerelease) return t;
|
|
237
|
+
t = t.version;
|
|
238
|
+
} else if (typeof t != "string") throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);
|
|
239
|
+
if (t.length > r) throw TypeError(`version is longer than ${r} characters`);
|
|
240
|
+
n("SemVer", t, c), this.options = c, this.loose = !!c.loose, this.includePrerelease = !!c.includePrerelease;
|
|
241
|
+
let l = t.trim().match(c.loose ? a[o.LOOSE] : a[o.FULL]);
|
|
242
|
+
if (!l) throw TypeError(`Invalid Version: ${t}`);
|
|
243
|
+
if (this.raw = t, this.major = +l[1], this.minor = +l[2], this.patch = +l[3], this.major > i || this.major < 0) throw TypeError("Invalid major version");
|
|
244
|
+
if (this.minor > i || this.minor < 0) throw TypeError("Invalid minor version");
|
|
245
|
+
if (this.patch > i || this.patch < 0) throw TypeError("Invalid patch version");
|
|
246
|
+
l[4] ? this.prerelease = l[4].split(".").map((e) => {
|
|
247
|
+
if (/^[0-9]+$/.test(e)) {
|
|
248
|
+
let t = +e;
|
|
249
|
+
if (t >= 0 && t < i) return t;
|
|
250
|
+
}
|
|
251
|
+
return e;
|
|
252
|
+
}) : this.prerelease = [], this.build = l[5] ? l[5].split(".") : [], this.format();
|
|
253
|
+
}
|
|
254
|
+
format() {
|
|
255
|
+
return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
|
|
256
|
+
}
|
|
257
|
+
toString() {
|
|
258
|
+
return this.version;
|
|
259
|
+
}
|
|
260
|
+
compare(t) {
|
|
261
|
+
if (n("SemVer.compare", this.version, this.options, t), !(t instanceof e)) {
|
|
262
|
+
if (typeof t == "string" && t === this.version) return 0;
|
|
263
|
+
t = new e(t, this.options);
|
|
264
|
+
}
|
|
265
|
+
return t.version === this.version ? 0 : this.compareMain(t) || this.comparePre(t);
|
|
266
|
+
}
|
|
267
|
+
compareMain(t) {
|
|
268
|
+
return t instanceof e || (t = new e(t, this.options)), this.major < t.major ? -1 : this.major > t.major ? 1 : this.minor < t.minor ? -1 : this.minor > t.minor ? 1 : this.patch < t.patch ? -1 : +(this.patch > t.patch);
|
|
269
|
+
}
|
|
270
|
+
comparePre(t) {
|
|
271
|
+
if (t instanceof e || (t = new e(t, this.options)), this.prerelease.length && !t.prerelease.length) return -1;
|
|
272
|
+
if (!this.prerelease.length && t.prerelease.length) return 1;
|
|
273
|
+
if (!this.prerelease.length && !t.prerelease.length) return 0;
|
|
274
|
+
let r = 0;
|
|
275
|
+
do {
|
|
276
|
+
let e = this.prerelease[r], i = t.prerelease[r];
|
|
277
|
+
if (n("prerelease compare", r, e, i), e === void 0 && i === void 0) return 0;
|
|
278
|
+
if (i === void 0) return 1;
|
|
279
|
+
if (e === void 0) return -1;
|
|
280
|
+
if (e === i) continue;
|
|
281
|
+
return c(e, i);
|
|
282
|
+
} while (++r);
|
|
283
|
+
}
|
|
284
|
+
compareBuild(t) {
|
|
285
|
+
t instanceof e || (t = new e(t, this.options));
|
|
286
|
+
let r = 0;
|
|
287
|
+
do {
|
|
288
|
+
let e = this.build[r], i = t.build[r];
|
|
289
|
+
if (n("build compare", r, e, i), e === void 0 && i === void 0) return 0;
|
|
290
|
+
if (i === void 0) return 1;
|
|
291
|
+
if (e === void 0) return -1;
|
|
292
|
+
if (e === i) continue;
|
|
293
|
+
return c(e, i);
|
|
294
|
+
} while (++r);
|
|
295
|
+
}
|
|
296
|
+
inc(e, t, n) {
|
|
297
|
+
if (e.startsWith("pre")) {
|
|
298
|
+
if (!t && n === !1) throw Error("invalid increment argument: identifier is empty");
|
|
299
|
+
if (t) {
|
|
300
|
+
let e = `-${t}`.match(this.options.loose ? a[o.PRERELEASELOOSE] : a[o.PRERELEASE]);
|
|
301
|
+
if (!e || e[1] !== t) throw Error(`invalid identifier: ${t}`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
switch (e) {
|
|
305
|
+
case "premajor":
|
|
306
|
+
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", t, n);
|
|
307
|
+
break;
|
|
308
|
+
case "preminor":
|
|
309
|
+
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", t, n);
|
|
310
|
+
break;
|
|
311
|
+
case "prepatch":
|
|
312
|
+
this.prerelease.length = 0, this.inc("patch", t, n), this.inc("pre", t, n);
|
|
313
|
+
break;
|
|
314
|
+
case "prerelease":
|
|
315
|
+
this.prerelease.length === 0 && this.inc("patch", t, n), this.inc("pre", t, n);
|
|
316
|
+
break;
|
|
317
|
+
case "release":
|
|
318
|
+
if (this.prerelease.length === 0) throw Error(`version ${this.raw} is not a prerelease`);
|
|
319
|
+
this.prerelease.length = 0;
|
|
320
|
+
break;
|
|
321
|
+
case "major":
|
|
322
|
+
(this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
|
|
323
|
+
break;
|
|
324
|
+
case "minor":
|
|
325
|
+
(this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
|
|
326
|
+
break;
|
|
327
|
+
case "patch":
|
|
328
|
+
this.prerelease.length === 0 && this.patch++, this.prerelease = [];
|
|
329
|
+
break;
|
|
330
|
+
case "pre": {
|
|
331
|
+
let e = +!!Number(n);
|
|
332
|
+
if (this.prerelease.length === 0) this.prerelease = [e];
|
|
333
|
+
else {
|
|
334
|
+
let r = this.prerelease.length;
|
|
335
|
+
for (; --r >= 0;) typeof this.prerelease[r] == "number" && (this.prerelease[r]++, r = -2);
|
|
336
|
+
if (r === -1) {
|
|
337
|
+
if (t === this.prerelease.join(".") && n === !1) throw Error("invalid increment argument: identifier already exists");
|
|
338
|
+
this.prerelease.push(e);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (t) {
|
|
342
|
+
let r = [t, e];
|
|
343
|
+
n === !1 && (r = [t]), c(this.prerelease[0], t) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = r) : this.prerelease = r;
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
default: throw Error(`invalid increment argument: ${e}`);
|
|
348
|
+
}
|
|
349
|
+
return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
})), _ = /* @__PURE__ */ i(((e, t) => {
|
|
353
|
+
var n = g();
|
|
354
|
+
t.exports = (e, t, r = !1) => {
|
|
355
|
+
if (e instanceof n) return e;
|
|
356
|
+
try {
|
|
357
|
+
return new n(e, t);
|
|
358
|
+
} catch (e) {
|
|
359
|
+
if (!r) return null;
|
|
360
|
+
throw e;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
})), v = /* @__PURE__ */ i(((e, t) => {
|
|
364
|
+
var n = g(), r = _(), { safeRe: i, t: a } = p();
|
|
365
|
+
t.exports = (e, t) => {
|
|
366
|
+
if (e instanceof n) return e;
|
|
367
|
+
if (typeof e == "number" && (e = String(e)), typeof e != "string") return null;
|
|
368
|
+
t ||= {};
|
|
369
|
+
let o = null;
|
|
370
|
+
if (!t.rtl) o = e.match(t.includePrerelease ? i[a.COERCEFULL] : i[a.COERCE]);
|
|
371
|
+
else {
|
|
372
|
+
let n = t.includePrerelease ? i[a.COERCERTLFULL] : i[a.COERCERTL], r;
|
|
373
|
+
for (; (r = n.exec(e)) && (!o || o.index + o[0].length !== e.length);) (!o || r.index + r[0].length !== o.index + o[0].length) && (o = r), n.lastIndex = r.index + r[1].length + r[2].length;
|
|
374
|
+
n.lastIndex = -1;
|
|
375
|
+
}
|
|
376
|
+
if (o === null) return null;
|
|
377
|
+
let s = o[2];
|
|
378
|
+
return r(`${s}.${o[3] || "0"}.${o[4] || "0"}${t.includePrerelease && o[5] ? `-${o[5]}` : ""}${t.includePrerelease && o[6] ? `+${o[6]}` : ""}`, t);
|
|
379
|
+
};
|
|
380
|
+
})), y = /* @__PURE__ */ i(((e, t) => {
|
|
381
|
+
var n = g();
|
|
382
|
+
t.exports = (e, t, r) => new n(e, r).compare(new n(t, r));
|
|
383
|
+
})), b = /* @__PURE__ */ i(((e, t) => {
|
|
384
|
+
var n = y();
|
|
385
|
+
t.exports = (e, t, r) => n(e, t, r) >= 0;
|
|
386
|
+
})), x = /* @__PURE__ */ i(((e, t) => {
|
|
387
|
+
t.exports = class {
|
|
388
|
+
constructor() {
|
|
389
|
+
this.max = 1e3, this.map = /* @__PURE__ */ new Map();
|
|
390
|
+
}
|
|
391
|
+
get(e) {
|
|
392
|
+
let t = this.map.get(e);
|
|
393
|
+
if (t !== void 0) return this.map.delete(e), this.map.set(e, t), t;
|
|
394
|
+
}
|
|
395
|
+
delete(e) {
|
|
396
|
+
return this.map.delete(e);
|
|
397
|
+
}
|
|
398
|
+
set(e, t) {
|
|
399
|
+
if (!this.delete(e) && t !== void 0) {
|
|
400
|
+
if (this.map.size >= this.max) {
|
|
401
|
+
let e = this.map.keys().next().value;
|
|
402
|
+
this.delete(e);
|
|
403
|
+
}
|
|
404
|
+
this.map.set(e, t);
|
|
405
|
+
}
|
|
406
|
+
return this;
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
})), S = /* @__PURE__ */ i(((e, t) => {
|
|
410
|
+
var n = y();
|
|
411
|
+
t.exports = (e, t, r) => n(e, t, r) === 0;
|
|
412
|
+
})), C = /* @__PURE__ */ i(((e, t) => {
|
|
413
|
+
var n = y();
|
|
414
|
+
t.exports = (e, t, r) => n(e, t, r) !== 0;
|
|
415
|
+
})), w = /* @__PURE__ */ i(((e, t) => {
|
|
416
|
+
var n = y();
|
|
417
|
+
t.exports = (e, t, r) => n(e, t, r) > 0;
|
|
418
|
+
})), T = /* @__PURE__ */ i(((e, t) => {
|
|
419
|
+
var n = y();
|
|
420
|
+
t.exports = (e, t, r) => n(e, t, r) < 0;
|
|
421
|
+
})), E = /* @__PURE__ */ i(((e, t) => {
|
|
422
|
+
var n = y();
|
|
423
|
+
t.exports = (e, t, r) => n(e, t, r) <= 0;
|
|
424
|
+
})), D = /* @__PURE__ */ i(((e, t) => {
|
|
425
|
+
var n = S(), r = C(), i = w(), a = b(), o = T(), s = E();
|
|
426
|
+
t.exports = (e, t, c, l) => {
|
|
427
|
+
switch (t) {
|
|
428
|
+
case "===": return typeof e == "object" && (e = e.version), typeof c == "object" && (c = c.version), e === c;
|
|
429
|
+
case "!==": return typeof e == "object" && (e = e.version), typeof c == "object" && (c = c.version), e !== c;
|
|
430
|
+
case "":
|
|
431
|
+
case "=":
|
|
432
|
+
case "==": return n(e, c, l);
|
|
433
|
+
case "!=": return r(e, c, l);
|
|
434
|
+
case ">": return i(e, c, l);
|
|
435
|
+
case ">=": return a(e, c, l);
|
|
436
|
+
case "<": return o(e, c, l);
|
|
437
|
+
case "<=": return s(e, c, l);
|
|
438
|
+
default: throw TypeError(`Invalid operator: ${t}`);
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
})), O = /* @__PURE__ */ i(((e, t) => {
|
|
442
|
+
var n = Symbol("SemVer ANY");
|
|
443
|
+
t.exports = class e {
|
|
444
|
+
static get ANY() {
|
|
445
|
+
return n;
|
|
446
|
+
}
|
|
447
|
+
constructor(t, i) {
|
|
448
|
+
if (i = r(i), t instanceof e) {
|
|
449
|
+
if (t.loose === !!i.loose) return t;
|
|
450
|
+
t = t.value;
|
|
451
|
+
}
|
|
452
|
+
t = t.trim().split(/\s+/).join(" "), s("comparator", t, i), this.options = i, this.loose = !!i.loose, this.parse(t), this.semver === n ? this.value = "" : this.value = this.operator + this.semver.version, s("comp", this);
|
|
453
|
+
}
|
|
454
|
+
parse(e) {
|
|
455
|
+
let t = this.options.loose ? i[a.COMPARATORLOOSE] : i[a.COMPARATOR], r = e.match(t);
|
|
456
|
+
if (!r) throw TypeError(`Invalid comparator: ${e}`);
|
|
457
|
+
this.operator = r[1] === void 0 ? "" : r[1], this.operator === "=" && (this.operator = ""), r[2] ? this.semver = new c(r[2], this.options.loose) : this.semver = n;
|
|
458
|
+
}
|
|
459
|
+
toString() {
|
|
460
|
+
return this.value;
|
|
461
|
+
}
|
|
462
|
+
test(e) {
|
|
463
|
+
if (s("Comparator.test", e, this.options.loose), this.semver === n || e === n) return !0;
|
|
464
|
+
if (typeof e == "string") try {
|
|
465
|
+
e = new c(e, this.options);
|
|
466
|
+
} catch {
|
|
467
|
+
return !1;
|
|
468
|
+
}
|
|
469
|
+
return o(e, this.operator, this.semver, this.options);
|
|
470
|
+
}
|
|
471
|
+
intersects(t, n) {
|
|
472
|
+
if (!(t instanceof e)) throw TypeError("a Comparator is required");
|
|
473
|
+
return this.operator === "" ? this.value === "" ? !0 : new l(t.value, n).test(this.value) : t.operator === "" ? t.value === "" ? !0 : new l(this.value, n).test(t.semver) : (n = r(n), n.includePrerelease && (this.value === "<0.0.0-0" || t.value === "<0.0.0-0") || !n.includePrerelease && (this.value.startsWith("<0.0.0") || t.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && t.operator.startsWith(">") || this.operator.startsWith("<") && t.operator.startsWith("<") || this.semver.version === t.semver.version && this.operator.includes("=") && t.operator.includes("=") || o(this.semver, "<", t.semver, n) && this.operator.startsWith(">") && t.operator.startsWith("<") || o(this.semver, ">", t.semver, n) && this.operator.startsWith("<") && t.operator.startsWith(">")));
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
var r = m(), { safeRe: i, t: a } = p(), o = D(), s = d(), c = g(), l = k();
|
|
477
|
+
})), k = /* @__PURE__ */ i(((e, t) => {
|
|
478
|
+
var n = /\s+/g;
|
|
479
|
+
t.exports = class e {
|
|
480
|
+
constructor(t, r) {
|
|
481
|
+
if (r = i(r), t instanceof e) return t.loose === !!r.loose && t.includePrerelease === !!r.includePrerelease ? t : new e(t.raw, r);
|
|
482
|
+
if (t instanceof a) return this.raw = t.value, this.set = [[t]], this.formatted = void 0, this;
|
|
483
|
+
if (this.options = r, this.loose = !!r.loose, this.includePrerelease = !!r.includePrerelease, this.raw = t.trim().replace(n, " "), this.set = this.raw.split("||").map((e) => this.parseRange(e.trim())).filter((e) => e.length), !this.set.length) throw TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
484
|
+
if (this.set.length > 1) {
|
|
485
|
+
let e = this.set[0];
|
|
486
|
+
if (this.set = this.set.filter((e) => !b(e[0])), this.set.length === 0) this.set = [e];
|
|
487
|
+
else if (this.set.length > 1) {
|
|
488
|
+
for (let e of this.set) if (e.length === 1 && S(e[0])) {
|
|
489
|
+
this.set = [e];
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
this.formatted = void 0;
|
|
495
|
+
}
|
|
496
|
+
get range() {
|
|
497
|
+
if (this.formatted === void 0) {
|
|
498
|
+
this.formatted = "";
|
|
499
|
+
for (let e = 0; e < this.set.length; e++) {
|
|
500
|
+
e > 0 && (this.formatted += "||");
|
|
501
|
+
let t = this.set[e];
|
|
502
|
+
for (let e = 0; e < t.length; e++) e > 0 && (this.formatted += " "), this.formatted += t[e].toString().trim();
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return this.formatted;
|
|
506
|
+
}
|
|
507
|
+
format() {
|
|
508
|
+
return this.range;
|
|
509
|
+
}
|
|
510
|
+
toString() {
|
|
511
|
+
return this.range;
|
|
512
|
+
}
|
|
513
|
+
parseRange(e) {
|
|
514
|
+
let t = ((this.options.includePrerelease && v) | (this.options.loose && y)) + ":" + e, n = r.get(t);
|
|
515
|
+
if (n) return n;
|
|
516
|
+
let i = this.options.loose, s = i ? c[l.HYPHENRANGELOOSE] : c[l.HYPHENRANGE];
|
|
517
|
+
e = e.replace(s, F(this.options.includePrerelease)), o("hyphen replace", e), e = e.replace(c[l.COMPARATORTRIM], u), o("comparator trim", e), e = e.replace(c[l.TILDETRIM], h), o("tilde trim", e), e = e.replace(c[l.CARETTRIM], _), o("caret trim", e);
|
|
518
|
+
let d = e.split(" ").map((e) => w(e, this.options)).join(" ").split(/\s+/).map((e) => P(e, this.options));
|
|
519
|
+
i && (d = d.filter((e) => (o("loose invalid filter", e, this.options), !!e.match(c[l.COMPARATORLOOSE])))), o("range list", d);
|
|
520
|
+
let f = /* @__PURE__ */ new Map(), p = d.map((e) => new a(e, this.options));
|
|
521
|
+
for (let e of p) {
|
|
522
|
+
if (b(e)) return [e];
|
|
523
|
+
f.set(e.value, e);
|
|
524
|
+
}
|
|
525
|
+
f.size > 1 && f.has("") && f.delete("");
|
|
526
|
+
let m = [...f.values()];
|
|
527
|
+
return r.set(t, m), m;
|
|
528
|
+
}
|
|
529
|
+
intersects(t, n) {
|
|
530
|
+
if (!(t instanceof e)) throw TypeError("a Range is required");
|
|
531
|
+
return this.set.some((e) => C(e, n) && t.set.some((t) => C(t, n) && e.every((e) => t.every((t) => e.intersects(t, n)))));
|
|
532
|
+
}
|
|
533
|
+
test(e) {
|
|
534
|
+
if (!e) return !1;
|
|
535
|
+
if (typeof e == "string") try {
|
|
536
|
+
e = new s(e, this.options);
|
|
537
|
+
} catch {
|
|
538
|
+
return !1;
|
|
539
|
+
}
|
|
540
|
+
for (let t = 0; t < this.set.length; t++) if (I(this.set[t], e, this.options)) return !0;
|
|
541
|
+
return !1;
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
var r = new (x())(), i = m(), a = O(), o = d(), s = g(), { safeRe: c, t: l, comparatorTrimReplace: u, tildeTrimReplace: h, caretTrimReplace: _ } = p(), { FLAG_INCLUDE_PRERELEASE: v, FLAG_LOOSE: y } = f(), b = (e) => e.value === "<0.0.0-0", S = (e) => e.value === "", C = (e, t) => {
|
|
545
|
+
let n = !0, r = e.slice(), i = r.pop();
|
|
546
|
+
for (; n && r.length;) n = r.every((e) => i.intersects(e, t)), i = r.pop();
|
|
547
|
+
return n;
|
|
548
|
+
}, w = (e, t) => (e = e.replace(c[l.BUILD], ""), o("comp", e, t), e = k(e, t), o("caret", e), e = E(e, t), o("tildes", e), e = j(e, t), o("xrange", e), e = N(e, t), o("stars", e), e), T = (e) => !e || e.toLowerCase() === "x" || e === "*", E = (e, t) => e.trim().split(/\s+/).map((e) => D(e, t)).join(" "), D = (e, t) => {
|
|
549
|
+
let n = t.loose ? c[l.TILDELOOSE] : c[l.TILDE];
|
|
550
|
+
return e.replace(n, (t, n, r, i, a) => {
|
|
551
|
+
o("tilde", e, t, n, r, i, a);
|
|
552
|
+
let s;
|
|
553
|
+
return T(n) ? s = "" : T(r) ? s = `>=${n}.0.0 <${+n + 1}.0.0-0` : T(i) ? s = `>=${n}.${r}.0 <${n}.${+r + 1}.0-0` : a ? (o("replaceTilde pr", a), s = `>=${n}.${r}.${i}-${a} <${n}.${+r + 1}.0-0`) : s = `>=${n}.${r}.${i} <${n}.${+r + 1}.0-0`, o("tilde return", s), s;
|
|
554
|
+
});
|
|
555
|
+
}, k = (e, t) => e.trim().split(/\s+/).map((e) => A(e, t)).join(" "), A = (e, t) => {
|
|
556
|
+
o("caret", e, t);
|
|
557
|
+
let n = t.loose ? c[l.CARETLOOSE] : c[l.CARET], r = t.includePrerelease ? "-0" : "";
|
|
558
|
+
return e.replace(n, (t, n, i, a, s) => {
|
|
559
|
+
o("caret", e, t, n, i, a, s);
|
|
560
|
+
let c;
|
|
561
|
+
return T(n) ? c = "" : T(i) ? c = `>=${n}.0.0${r} <${+n + 1}.0.0-0` : T(a) ? c = n === "0" ? `>=${n}.${i}.0${r} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.0${r} <${+n + 1}.0.0-0` : s ? (o("replaceCaret pr", s), c = n === "0" ? i === "0" ? `>=${n}.${i}.${a}-${s} <${n}.${i}.${+a + 1}-0` : `>=${n}.${i}.${a}-${s} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.${a}-${s} <${+n + 1}.0.0-0`) : (o("no pr"), c = n === "0" ? i === "0" ? `>=${n}.${i}.${a}${r} <${n}.${i}.${+a + 1}-0` : `>=${n}.${i}.${a}${r} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.${a} <${+n + 1}.0.0-0`), o("caret return", c), c;
|
|
562
|
+
});
|
|
563
|
+
}, j = (e, t) => (o("replaceXRanges", e, t), e.split(/\s+/).map((e) => M(e, t)).join(" ")), M = (e, t) => {
|
|
564
|
+
e = e.trim();
|
|
565
|
+
let n = t.loose ? c[l.XRANGELOOSE] : c[l.XRANGE];
|
|
566
|
+
return e.replace(n, (n, r, i, a, s, c) => {
|
|
567
|
+
o("xRange", e, n, r, i, a, s, c);
|
|
568
|
+
let l = T(i), u = l || T(a), d = u || T(s), f = d;
|
|
569
|
+
return r === "=" && f && (r = ""), c = t.includePrerelease ? "-0" : "", l ? n = r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && f ? (u && (a = 0), s = 0, r === ">" ? (r = ">=", u ? (i = +i + 1, a = 0, s = 0) : (a = +a + 1, s = 0)) : r === "<=" && (r = "<", u ? i = +i + 1 : a = +a + 1), r === "<" && (c = "-0"), n = `${r + i}.${a}.${s}${c}`) : u ? n = `>=${i}.0.0${c} <${+i + 1}.0.0-0` : d && (n = `>=${i}.${a}.0${c} <${i}.${+a + 1}.0-0`), o("xRange return", n), n;
|
|
570
|
+
});
|
|
571
|
+
}, N = (e, t) => (o("replaceStars", e, t), e.trim().replace(c[l.STAR], "")), P = (e, t) => (o("replaceGTE0", e, t), e.trim().replace(c[t.includePrerelease ? l.GTE0PRE : l.GTE0], "")), F = (e) => (t, n, r, i, a, o, s, c, l, u, d, f) => (n = T(r) ? "" : T(i) ? `>=${r}.0.0${e ? "-0" : ""}` : T(a) ? `>=${r}.${i}.0${e ? "-0" : ""}` : o ? `>=${n}` : `>=${n}${e ? "-0" : ""}`, c = T(l) ? "" : T(u) ? `<${+l + 1}.0.0-0` : T(d) ? `<${l}.${+u + 1}.0-0` : f ? `<=${l}.${u}.${d}-${f}` : e ? `<${l}.${u}.${+d + 1}-0` : `<=${c}`, `${n} ${c}`.trim()), I = (e, t, n) => {
|
|
572
|
+
for (let n = 0; n < e.length; n++) if (!e[n].test(t)) return !1;
|
|
573
|
+
if (t.prerelease.length && !n.includePrerelease) {
|
|
574
|
+
for (let n = 0; n < e.length; n++) if (o(e[n].semver), e[n].semver !== a.ANY && e[n].semver.prerelease.length > 0) {
|
|
575
|
+
let r = e[n].semver;
|
|
576
|
+
if (r.major === t.major && r.minor === t.minor && r.patch === t.patch) return !0;
|
|
577
|
+
}
|
|
578
|
+
return !1;
|
|
579
|
+
}
|
|
580
|
+
return !0;
|
|
581
|
+
};
|
|
582
|
+
})), A = /* @__PURE__ */ i(((e, t) => {
|
|
583
|
+
var n = k();
|
|
584
|
+
t.exports = (e, t, r) => {
|
|
585
|
+
try {
|
|
586
|
+
t = new n(t, r);
|
|
587
|
+
} catch {
|
|
588
|
+
return !1;
|
|
589
|
+
}
|
|
590
|
+
return t.test(e);
|
|
591
|
+
};
|
|
592
|
+
})), j = /* @__PURE__ */ r({
|
|
593
|
+
author: () => F,
|
|
594
|
+
config: () => X,
|
|
595
|
+
contributors: () => L,
|
|
596
|
+
default: () => Q,
|
|
597
|
+
dependencies: () => G,
|
|
598
|
+
description: () => N,
|
|
599
|
+
devDependencies: () => q,
|
|
600
|
+
engines: () => Y,
|
|
601
|
+
files: () => H,
|
|
602
|
+
funding: () => Z,
|
|
603
|
+
homepage: () => I,
|
|
604
|
+
keywords: () => W,
|
|
605
|
+
license: () => J,
|
|
606
|
+
main: () => B,
|
|
607
|
+
name: () => M,
|
|
608
|
+
optionalDependencies: () => K,
|
|
609
|
+
repository: () => U,
|
|
610
|
+
scripts: () => R,
|
|
611
|
+
type: () => z,
|
|
612
|
+
types: () => V,
|
|
613
|
+
version: () => P
|
|
614
|
+
}), M, N, P, F, I, L, R, z, B, V, H, U, W, G, K, q, J, Y, X, Z, Q, ee = n((() => {
|
|
615
|
+
M = "sharp", N = "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images", P = "0.34.5", F = "Lovell Fuller <npm@lovell.info>", I = "https://sharp.pixelplumbing.com", L = /* @__PURE__ */ "Pierre Inglebert <pierre.inglebert@gmail.com>,Jonathan Ong <jonathanrichardong@gmail.com>,Chanon Sajjamanochai <chanon.s@gmail.com>,Juliano Julio <julianojulio@gmail.com>,Daniel Gasienica <daniel@gasienica.ch>,Julian Walker <julian@fiftythree.com>,Amit Pitaru <pitaru.amit@gmail.com>,Brandon Aaron <hello.brandon@aaron.sh>,Andreas Lind <andreas@one.com>,Maurus Cuelenaere <mcuelenaere@gmail.com>,Linus Unnebäck <linus@folkdatorn.se>,Victor Mateevitsi <mvictoras@gmail.com>,Alaric Holloway <alaric.holloway@gmail.com>,Bernhard K. Weisshuhn <bkw@codingforce.com>,Chris Riley <criley@primedia.com>,David Carley <dacarley@gmail.com>,John Tobin <john@limelightmobileinc.com>,Kenton Gray <kentongray@gmail.com>,Felix Bünemann <Felix.Buenemann@gmail.com>,Samy Al Zahrani <samyalzahrany@gmail.com>,Chintan Thakkar <lemnisk8@gmail.com>,F. Orlando Galashan <frulo@gmx.de>,Kleis Auke Wolthuizen <info@kleisauke.nl>,Matt Hirsch <mhirsch@media.mit.edu>,Matthias Thoemmes <thoemmes@gmail.com>,Patrick Paskaris <patrick@paskaris.gr>,Jérémy Lal <kapouer@melix.org>,Rahul Nanwani <r.nanwani@gmail.com>,Alice Monday <alice0meta@gmail.com>,Kristo Jorgenson <kristo.jorgenson@gmail.com>,YvesBos <yves_bos@outlook.com>,Guy Maliar <guy@tailorbrands.com>,Nicolas Coden <nicolas@ncoden.fr>,Matt Parrish <matt.r.parrish@gmail.com>,Marcel Bretschneider <marcel.bretschneider@gmail.com>,Matthew McEachen <matthew+github@mceachen.org>,Jarda Kotěšovec <jarda.kotesovec@gmail.com>,Kenric D'Souza <kenric.dsouza@gmail.com>,Oleh Aleinyk <oleg.aleynik@gmail.com>,Marcel Bretschneider <marcel.bretschneider@gmail.com>,Andrea Bianco <andrea.bianco@unibas.ch>,Rik Heywood <rik@rik.org>,Thomas Parisot <hi@oncletom.io>,Nathan Graves <nathanrgraves+github@gmail.com>,Tom Lokhorst <tom@lokhorst.eu>,Espen Hovlandsdal <espen@hovlandsdal.com>,Sylvain Dumont <sylvain.dumont35@gmail.com>,Alun Davies <alun.owain.davies@googlemail.com>,Aidan Hoolachan <ajhoolachan21@gmail.com>,Axel Eirola <axel.eirola@iki.fi>,Freezy <freezy@xbmc.org>,Daiz <taneli.vatanen@gmail.com>,Julian Aubourg <j@ubourg.net>,Keith Belovay <keith@picthrive.com>,Michael B. Klein <mbklein@gmail.com>,Jordan Prudhomme <jordan@raboland.fr>,Ilya Ovdin <iovdin@gmail.com>,Andargor <andargor@yahoo.com>,Paul Neave <paul.neave@gmail.com>,Brendan Kennedy <brenwken@gmail.com>,Brychan Bennett-Odlum <git@brychan.io>,Edward Silverton <e.silverton@gmail.com>,Roman Malieiev <aromaleev@gmail.com>,Tomas Szabo <tomas.szabo@deftomat.com>,Robert O'Rourke <robert@o-rourke.org>,Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>,Christian Flintrup <chr@gigahost.dk>,Manan Jadhav <manan@motionden.com>,Leon Radley <leon@radley.se>,alza54 <alza54@thiocod.in>,Jacob Smith <jacob@frende.me>,Michael Nutt <michael@nutt.im>,Brad Parham <baparham@gmail.com>,Taneli Vatanen <taneli.vatanen@gmail.com>,Joris Dugué <zaruike10@gmail.com>,Chris Banks <christopher.bradley.banks@gmail.com>,Ompal Singh <ompal.hitm09@gmail.com>,Brodan <christopher.hranj@gmail.com>,Ankur Parihar <ankur.github@gmail.com>,Brahim Ait elhaj <brahima@gmail.com>,Mart Jansink <m.jansink@gmail.com>,Lachlan Newman <lachnewman007@gmail.com>,Dennis Beatty <dennis@dcbeatty.com>,Ingvar Stepanyan <me@rreverser.com>,Don Denton <don@happycollision.com>".split(","), R = {
|
|
616
|
+
build: "node install/build.js",
|
|
617
|
+
install: "node install/check.js || npm run build",
|
|
618
|
+
clean: "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
|
|
619
|
+
test: "npm run lint && npm run test-unit",
|
|
620
|
+
lint: "npm run lint-cpp && npm run lint-js && npm run lint-types",
|
|
621
|
+
"lint-cpp": "cpplint --quiet src/*.h src/*.cc",
|
|
622
|
+
"lint-js": "biome lint",
|
|
623
|
+
"lint-types": "tsd --files ./test/types/sharp.test-d.ts",
|
|
624
|
+
"test-leak": "./test/leak/leak.sh",
|
|
625
|
+
"test-unit": "node --experimental-test-coverage test/unit.mjs",
|
|
626
|
+
"package-from-local-build": "node npm/from-local-build.js",
|
|
627
|
+
"package-release-notes": "node npm/release-notes.js",
|
|
628
|
+
"docs-build": "node docs/build.mjs",
|
|
629
|
+
"docs-serve": "cd docs && npm start",
|
|
630
|
+
"docs-publish": "cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"
|
|
631
|
+
}, z = "commonjs", B = "lib/index.js", V = "lib/index.d.ts", H = [
|
|
632
|
+
"install",
|
|
633
|
+
"lib",
|
|
634
|
+
"src/*.{cc,h,gyp}"
|
|
635
|
+
], U = {
|
|
636
|
+
type: "git",
|
|
637
|
+
url: "git://github.com/lovell/sharp.git"
|
|
638
|
+
}, W = [
|
|
639
|
+
"jpeg",
|
|
640
|
+
"png",
|
|
641
|
+
"webp",
|
|
642
|
+
"avif",
|
|
643
|
+
"tiff",
|
|
644
|
+
"gif",
|
|
645
|
+
"svg",
|
|
646
|
+
"jp2",
|
|
647
|
+
"dzi",
|
|
648
|
+
"image",
|
|
649
|
+
"resize",
|
|
650
|
+
"thumbnail",
|
|
651
|
+
"crop",
|
|
652
|
+
"embed",
|
|
653
|
+
"libvips",
|
|
654
|
+
"vips"
|
|
655
|
+
], G = {
|
|
656
|
+
"@img/colour": "^1.0.0",
|
|
657
|
+
"detect-libc": "^2.1.2",
|
|
658
|
+
semver: "^7.7.3"
|
|
659
|
+
}, K = {
|
|
660
|
+
"@img/sharp-darwin-arm64": "0.34.5",
|
|
661
|
+
"@img/sharp-darwin-x64": "0.34.5",
|
|
662
|
+
"@img/sharp-libvips-darwin-arm64": "1.2.4",
|
|
663
|
+
"@img/sharp-libvips-darwin-x64": "1.2.4",
|
|
664
|
+
"@img/sharp-libvips-linux-arm": "1.2.4",
|
|
665
|
+
"@img/sharp-libvips-linux-arm64": "1.2.4",
|
|
666
|
+
"@img/sharp-libvips-linux-ppc64": "1.2.4",
|
|
667
|
+
"@img/sharp-libvips-linux-riscv64": "1.2.4",
|
|
668
|
+
"@img/sharp-libvips-linux-s390x": "1.2.4",
|
|
669
|
+
"@img/sharp-libvips-linux-x64": "1.2.4",
|
|
670
|
+
"@img/sharp-libvips-linuxmusl-arm64": "1.2.4",
|
|
671
|
+
"@img/sharp-libvips-linuxmusl-x64": "1.2.4",
|
|
672
|
+
"@img/sharp-linux-arm": "0.34.5",
|
|
673
|
+
"@img/sharp-linux-arm64": "0.34.5",
|
|
674
|
+
"@img/sharp-linux-ppc64": "0.34.5",
|
|
675
|
+
"@img/sharp-linux-riscv64": "0.34.5",
|
|
676
|
+
"@img/sharp-linux-s390x": "0.34.5",
|
|
677
|
+
"@img/sharp-linux-x64": "0.34.5",
|
|
678
|
+
"@img/sharp-linuxmusl-arm64": "0.34.5",
|
|
679
|
+
"@img/sharp-linuxmusl-x64": "0.34.5",
|
|
680
|
+
"@img/sharp-wasm32": "0.34.5",
|
|
681
|
+
"@img/sharp-win32-arm64": "0.34.5",
|
|
682
|
+
"@img/sharp-win32-ia32": "0.34.5",
|
|
683
|
+
"@img/sharp-win32-x64": "0.34.5"
|
|
684
|
+
}, q = {
|
|
685
|
+
"@biomejs/biome": "^2.3.4",
|
|
686
|
+
"@cpplint/cli": "^0.1.0",
|
|
687
|
+
"@emnapi/runtime": "^1.7.0",
|
|
688
|
+
"@img/sharp-libvips-dev": "1.2.4",
|
|
689
|
+
"@img/sharp-libvips-dev-wasm32": "1.2.4",
|
|
690
|
+
"@img/sharp-libvips-win32-arm64": "1.2.4",
|
|
691
|
+
"@img/sharp-libvips-win32-ia32": "1.2.4",
|
|
692
|
+
"@img/sharp-libvips-win32-x64": "1.2.4",
|
|
693
|
+
"@types/node": "*",
|
|
694
|
+
emnapi: "^1.7.0",
|
|
695
|
+
"exif-reader": "^2.0.2",
|
|
696
|
+
"extract-zip": "^2.0.1",
|
|
697
|
+
icc: "^3.0.0",
|
|
698
|
+
"jsdoc-to-markdown": "^9.1.3",
|
|
699
|
+
"node-addon-api": "^8.5.0",
|
|
700
|
+
"node-gyp": "^11.5.0",
|
|
701
|
+
"tar-fs": "^3.1.1",
|
|
702
|
+
tsd: "^0.33.0"
|
|
703
|
+
}, J = "Apache-2.0", Y = { node: "^18.17.0 || ^20.3.0 || >=21.0.0" }, X = { libvips: ">=8.17.3" }, Z = { url: "https://opencollective.com/libvips" }, Q = {
|
|
704
|
+
name: M,
|
|
705
|
+
description: N,
|
|
706
|
+
version: P,
|
|
707
|
+
author: F,
|
|
708
|
+
homepage: I,
|
|
709
|
+
contributors: L,
|
|
710
|
+
scripts: R,
|
|
711
|
+
type: z,
|
|
712
|
+
main: B,
|
|
713
|
+
types: V,
|
|
714
|
+
files: H,
|
|
715
|
+
repository: U,
|
|
716
|
+
keywords: W,
|
|
717
|
+
dependencies: G,
|
|
718
|
+
optionalDependencies: K,
|
|
719
|
+
devDependencies: q,
|
|
720
|
+
license: J,
|
|
721
|
+
engines: Y,
|
|
722
|
+
config: X,
|
|
723
|
+
funding: Z
|
|
724
|
+
};
|
|
725
|
+
})), te = /* @__PURE__ */ i(((n, r) => {
|
|
726
|
+
var { spawnSync: i } = a(), { createHash: o } = a(), s = v(), c = b(), l = A(), d = u(), { config: f, engines: p, optionalDependencies: m } = (ee(), e(j).default), h = s(process.env.npm_package_config_libvips || f.libvips).version, g = [
|
|
727
|
+
"darwin-arm64",
|
|
728
|
+
"darwin-x64",
|
|
729
|
+
"linux-arm",
|
|
730
|
+
"linux-arm64",
|
|
731
|
+
"linux-ppc64",
|
|
732
|
+
"linux-riscv64",
|
|
733
|
+
"linux-s390x",
|
|
734
|
+
"linux-x64",
|
|
735
|
+
"linuxmusl-arm64",
|
|
736
|
+
"linuxmusl-x64",
|
|
737
|
+
"win32-arm64",
|
|
738
|
+
"win32-ia32",
|
|
739
|
+
"win32-x64"
|
|
740
|
+
], _ = {
|
|
741
|
+
encoding: "utf8",
|
|
742
|
+
shell: !0
|
|
743
|
+
}, y = (e) => {
|
|
744
|
+
e instanceof Error ? console.error(`sharp: Installation error: ${e.message}`) : console.log(`sharp: ${e}`);
|
|
745
|
+
}, x = () => d.isNonGlibcLinuxSync() ? d.familySync() : "", S = () => `${process.platform}${x()}-${process.arch}`, C = () => {
|
|
746
|
+
/* node:coverage ignore next 3 */
|
|
747
|
+
if (O()) return "wasm32";
|
|
748
|
+
let { npm_config_arch: e, npm_config_platform: t, npm_config_libc: n } = process.env, r = typeof n == "string" ? n : x();
|
|
749
|
+
return `${t || process.platform}${r}-${e || process.arch}`;
|
|
750
|
+
}, w = () => {
|
|
751
|
+
try {
|
|
752
|
+
return t(`@img/sharp-libvips-dev-${C()}/include`);
|
|
753
|
+
} catch {
|
|
754
|
+
/* node:coverage ignore next 5 */
|
|
755
|
+
try {
|
|
756
|
+
return t("@img/sharp-libvips-dev/include");
|
|
757
|
+
} catch {}
|
|
758
|
+
}
|
|
759
|
+
return "";
|
|
760
|
+
}, T = () => {
|
|
761
|
+
/* node:coverage ignore next 4 */
|
|
762
|
+
try {
|
|
763
|
+
return t("@img/sharp-libvips-dev/cplusplus");
|
|
764
|
+
} catch {}
|
|
765
|
+
return "";
|
|
766
|
+
}, E = () => {
|
|
767
|
+
try {
|
|
768
|
+
return t(`@img/sharp-libvips-dev-${C()}/lib`);
|
|
769
|
+
} catch {
|
|
770
|
+
/* node:coverage ignore next 5 */
|
|
771
|
+
try {
|
|
772
|
+
return t(`@img/sharp-libvips-${C()}/lib`);
|
|
773
|
+
} catch {}
|
|
774
|
+
}
|
|
775
|
+
return "";
|
|
776
|
+
}, D = () => {
|
|
777
|
+
if (process.release?.name === "node" && process.versions && !l(process.versions.node, p.node)) return {
|
|
778
|
+
found: process.versions.node,
|
|
779
|
+
expected: p.node
|
|
780
|
+
};
|
|
781
|
+
}, O = () => {
|
|
782
|
+
let { CC: e } = process.env;
|
|
783
|
+
return !!e?.endsWith("/emcc");
|
|
784
|
+
}, k = () => process.platform === "darwin" && process.arch === "x64" ? (i("sysctl sysctl.proc_translated", _).stdout || "").trim() === "sysctl.proc_translated: 1" : !1, M = (e) => o("sha512").update(e).digest("hex"), N = () => {
|
|
785
|
+
try {
|
|
786
|
+
let e = M(`imgsharp-libvips-${C()}`), t = s(m[`@img/sharp-libvips-${C()}`], { includePrerelease: !0 }).version;
|
|
787
|
+
return M(`${e}npm:${t}`).slice(0, 10);
|
|
788
|
+
} catch {}
|
|
789
|
+
return "";
|
|
790
|
+
}, P = () => i(`node-gyp rebuild --directory=src ${O() ? "--nodedir=emscripten" : ""}`, {
|
|
791
|
+
..._,
|
|
792
|
+
stdio: "inherit"
|
|
793
|
+
}).status, F = () => process.platform === "win32" ? "" : (i("pkg-config --modversion vips-cpp", {
|
|
794
|
+
..._,
|
|
795
|
+
env: {
|
|
796
|
+
...process.env,
|
|
797
|
+
PKG_CONFIG_PATH: I()
|
|
798
|
+
}
|
|
799
|
+
}).stdout || "").trim(), I = () => process.platform === "win32" ? "" : [
|
|
800
|
+
(i("which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d\" \" -f2", _).stdout || "").trim(),
|
|
801
|
+
process.env.PKG_CONFIG_PATH,
|
|
802
|
+
"/usr/local/lib/pkgconfig",
|
|
803
|
+
"/usr/lib/pkgconfig",
|
|
804
|
+
"/usr/local/libdata/pkgconfig",
|
|
805
|
+
"/usr/libdata/pkgconfig"
|
|
806
|
+
].filter(Boolean).join(":"), L = (e, t, n) => (n && n(`Detected ${t}, skipping search for globally-installed libvips`), e);
|
|
807
|
+
r.exports = {
|
|
808
|
+
minimumLibvipsVersion: h,
|
|
809
|
+
prebuiltPlatforms: g,
|
|
810
|
+
buildPlatformArch: C,
|
|
811
|
+
buildSharpLibvipsIncludeDir: w,
|
|
812
|
+
buildSharpLibvipsCPlusPlusDir: T,
|
|
813
|
+
buildSharpLibvipsLibDir: E,
|
|
814
|
+
isUnsupportedNodeRuntime: D,
|
|
815
|
+
runtimePlatformArch: S,
|
|
816
|
+
log: y,
|
|
817
|
+
yarnLocator: N,
|
|
818
|
+
spawnRebuild: P,
|
|
819
|
+
globalLibvipsVersion: F,
|
|
820
|
+
pkgConfigPath: I,
|
|
821
|
+
useGlobalLibvips: (e) => {
|
|
822
|
+
if (process.env.SHARP_IGNORE_GLOBAL_LIBVIPS) return L(!1, "SHARP_IGNORE_GLOBAL_LIBVIPS", e);
|
|
823
|
+
if (process.env.SHARP_FORCE_GLOBAL_LIBVIPS) return L(!0, "SHARP_FORCE_GLOBAL_LIBVIPS", e);
|
|
824
|
+
/* node:coverage ignore next 3 */
|
|
825
|
+
if (k()) return L(!1, "Rosetta", e);
|
|
826
|
+
let t = F();
|
|
827
|
+
/* node:coverage ignore next */
|
|
828
|
+
return !!t && c(t, h);
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
})), $ = /* @__PURE__ */ i(((e, n) => {
|
|
832
|
+
var { familySync: r, versionSync: i } = u(), { runtimePlatformArch: a, isUnsupportedNodeRuntime: o, prebuiltPlatforms: s, minimumLibvipsVersion: c } = te(), l = a(), d = [
|
|
833
|
+
`../src/build/Release/sharp-${l}.node`,
|
|
834
|
+
"../src/build/Release/sharp-wasm32.node",
|
|
835
|
+
`@img/sharp-${l}/sharp.node`,
|
|
836
|
+
"@img/sharp-wasm32/sharp.node"
|
|
837
|
+
], f, p, m = [];
|
|
838
|
+
for (f of d) try {
|
|
839
|
+
p = t(f);
|
|
840
|
+
break;
|
|
841
|
+
} catch (e) {
|
|
842
|
+
m.push(e);
|
|
843
|
+
}
|
|
844
|
+
if (p && f.startsWith("@img/sharp-linux-x64") && !p._isUsingX64V2()) {
|
|
845
|
+
let e = /* @__PURE__ */ Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
846
|
+
e.code = "Unsupported CPU", m.push(e), p = null;
|
|
847
|
+
}
|
|
848
|
+
if (p) n.exports = p;
|
|
849
|
+
else {
|
|
850
|
+
let [e, n, a] = [
|
|
851
|
+
"linux",
|
|
852
|
+
"darwin",
|
|
853
|
+
"win32"
|
|
854
|
+
].map((e) => l.startsWith(e)), u = [`Could not load the "sharp" module using the ${l} runtime`];
|
|
855
|
+
m.forEach((e) => {
|
|
856
|
+
e.code !== "MODULE_NOT_FOUND" && u.push(`${e.code}: ${e.message}`);
|
|
857
|
+
});
|
|
858
|
+
let d = m.map((e) => e.message).join(" ");
|
|
859
|
+
if (u.push("Possible solutions:"), o()) {
|
|
860
|
+
let { found: e, expected: t } = o();
|
|
861
|
+
u.push("- Please upgrade Node.js:", ` Found ${e}`, ` Requires ${t}`);
|
|
862
|
+
} else if (s.includes(l)) {
|
|
863
|
+
let [e, t] = l.split("-"), n = e.endsWith("musl") ? " --libc=musl" : "";
|
|
864
|
+
u.push("- Ensure optional dependencies can be installed:", " npm install --include=optional sharp", "- Ensure your package manager supports multi-platform installation:", " See https://sharp.pixelplumbing.com/install#cross-platform", "- Add platform-specific dependencies:", ` npm install --os=${e.replace("musl", "")}${n} --cpu=${t} sharp`);
|
|
865
|
+
} else u.push(`- Manually install libvips >= ${c}`, "- Add experimental WebAssembly-based dependencies:", " npm install --cpu=wasm32 sharp", " npm install @img/sharp-wasm32");
|
|
866
|
+
if (e && /(symbol not found|CXXABI_)/i.test(d)) try {
|
|
867
|
+
let { config: e } = t(`@img/sharp-libvips-${l}/package`), n = `${r()} ${i()}`, a = `${e.musl ? "musl" : "glibc"} ${e.musl || e.glibc}`;
|
|
868
|
+
u.push("- Update your OS:", ` Found ${n}`, ` Requires ${a}`);
|
|
869
|
+
} catch {}
|
|
870
|
+
throw e && /\/snap\/core[0-9]{2}/.test(d) && u.push("- Remove the Node.js Snap, which does not support native modules", " snap remove node"), n && /Incompatible library version/.test(d) && u.push("- Update Homebrew:", " brew update && brew upgrade vips"), m.some((e) => e.code === "ERR_DLOPEN_DISABLED") && u.push("- Run Node.js without using the --no-addons flag"), a && /The specified procedure could not be found/.test(d) && u.push("- Using the canvas package on Windows?", " See https://sharp.pixelplumbing.com/install#canvas-and-windows", "- Check for outdated versions of sharp in the dependency tree:", " npm ls sharp"), u.push("- Consult the installation documentation:", " See https://sharp.pixelplumbing.com/install"), Error(u.join("\n"));
|
|
871
|
+
}
|
|
872
|
+
})), ne = /* @__PURE__ */ i(((e, t) => {
|
|
873
|
+
var n = a(), r = a(), i = o();
|
|
874
|
+
$();
|
|
875
|
+
var s = n.debuglog("sharp"), c = (e) => {
|
|
876
|
+
l.queue.emit("change", e);
|
|
877
|
+
}, l = function(e, t) {
|
|
878
|
+
if (arguments.length === 1 && !i.defined(e)) throw Error("Invalid input");
|
|
879
|
+
return this instanceof l ? (r.Duplex.call(this), this.options = {
|
|
880
|
+
topOffsetPre: -1,
|
|
881
|
+
leftOffsetPre: -1,
|
|
882
|
+
widthPre: -1,
|
|
883
|
+
heightPre: -1,
|
|
884
|
+
topOffsetPost: -1,
|
|
885
|
+
leftOffsetPost: -1,
|
|
886
|
+
widthPost: -1,
|
|
887
|
+
heightPost: -1,
|
|
888
|
+
width: -1,
|
|
889
|
+
height: -1,
|
|
890
|
+
canvas: "crop",
|
|
891
|
+
position: 0,
|
|
892
|
+
resizeBackground: [
|
|
893
|
+
0,
|
|
894
|
+
0,
|
|
895
|
+
0,
|
|
896
|
+
255
|
|
897
|
+
],
|
|
898
|
+
angle: 0,
|
|
899
|
+
rotationAngle: 0,
|
|
900
|
+
rotationBackground: [
|
|
901
|
+
0,
|
|
902
|
+
0,
|
|
903
|
+
0,
|
|
904
|
+
255
|
|
905
|
+
],
|
|
906
|
+
rotateBefore: !1,
|
|
907
|
+
orientBefore: !1,
|
|
908
|
+
flip: !1,
|
|
909
|
+
flop: !1,
|
|
910
|
+
extendTop: 0,
|
|
911
|
+
extendBottom: 0,
|
|
912
|
+
extendLeft: 0,
|
|
913
|
+
extendRight: 0,
|
|
914
|
+
extendBackground: [
|
|
915
|
+
0,
|
|
916
|
+
0,
|
|
917
|
+
0,
|
|
918
|
+
255
|
|
919
|
+
],
|
|
920
|
+
extendWith: "background",
|
|
921
|
+
withoutEnlargement: !1,
|
|
922
|
+
withoutReduction: !1,
|
|
923
|
+
affineMatrix: [],
|
|
924
|
+
affineBackground: [
|
|
925
|
+
0,
|
|
926
|
+
0,
|
|
927
|
+
0,
|
|
928
|
+
255
|
|
929
|
+
],
|
|
930
|
+
affineIdx: 0,
|
|
931
|
+
affineIdy: 0,
|
|
932
|
+
affineOdx: 0,
|
|
933
|
+
affineOdy: 0,
|
|
934
|
+
affineInterpolator: this.constructor.interpolators.bilinear,
|
|
935
|
+
kernel: "lanczos3",
|
|
936
|
+
fastShrinkOnLoad: !0,
|
|
937
|
+
tint: [
|
|
938
|
+
-1,
|
|
939
|
+
0,
|
|
940
|
+
0,
|
|
941
|
+
0
|
|
942
|
+
],
|
|
943
|
+
flatten: !1,
|
|
944
|
+
flattenBackground: [
|
|
945
|
+
0,
|
|
946
|
+
0,
|
|
947
|
+
0
|
|
948
|
+
],
|
|
949
|
+
unflatten: !1,
|
|
950
|
+
negate: !1,
|
|
951
|
+
negateAlpha: !0,
|
|
952
|
+
medianSize: 0,
|
|
953
|
+
blurSigma: 0,
|
|
954
|
+
precision: "integer",
|
|
955
|
+
minAmpl: .2,
|
|
956
|
+
sharpenSigma: 0,
|
|
957
|
+
sharpenM1: 1,
|
|
958
|
+
sharpenM2: 2,
|
|
959
|
+
sharpenX1: 2,
|
|
960
|
+
sharpenY2: 10,
|
|
961
|
+
sharpenY3: 20,
|
|
962
|
+
threshold: 0,
|
|
963
|
+
thresholdGrayscale: !0,
|
|
964
|
+
trimBackground: [],
|
|
965
|
+
trimThreshold: -1,
|
|
966
|
+
trimLineArt: !1,
|
|
967
|
+
dilateWidth: 0,
|
|
968
|
+
erodeWidth: 0,
|
|
969
|
+
gamma: 0,
|
|
970
|
+
gammaOut: 0,
|
|
971
|
+
greyscale: !1,
|
|
972
|
+
normalise: !1,
|
|
973
|
+
normaliseLower: 1,
|
|
974
|
+
normaliseUpper: 99,
|
|
975
|
+
claheWidth: 0,
|
|
976
|
+
claheHeight: 0,
|
|
977
|
+
claheMaxSlope: 3,
|
|
978
|
+
brightness: 1,
|
|
979
|
+
saturation: 1,
|
|
980
|
+
hue: 0,
|
|
981
|
+
lightness: 0,
|
|
982
|
+
booleanBufferIn: null,
|
|
983
|
+
booleanFileIn: "",
|
|
984
|
+
joinChannelIn: [],
|
|
985
|
+
extractChannel: -1,
|
|
986
|
+
removeAlpha: !1,
|
|
987
|
+
ensureAlpha: -1,
|
|
988
|
+
colourspace: "srgb",
|
|
989
|
+
colourspacePipeline: "last",
|
|
990
|
+
composite: [],
|
|
991
|
+
fileOut: "",
|
|
992
|
+
formatOut: "input",
|
|
993
|
+
streamOut: !1,
|
|
994
|
+
keepMetadata: 0,
|
|
995
|
+
withMetadataOrientation: -1,
|
|
996
|
+
withMetadataDensity: 0,
|
|
997
|
+
withIccProfile: "",
|
|
998
|
+
withExif: {},
|
|
999
|
+
withExifMerge: !0,
|
|
1000
|
+
withXmp: "",
|
|
1001
|
+
resolveWithObject: !1,
|
|
1002
|
+
loop: -1,
|
|
1003
|
+
delay: [],
|
|
1004
|
+
jpegQuality: 80,
|
|
1005
|
+
jpegProgressive: !1,
|
|
1006
|
+
jpegChromaSubsampling: "4:2:0",
|
|
1007
|
+
jpegTrellisQuantisation: !1,
|
|
1008
|
+
jpegOvershootDeringing: !1,
|
|
1009
|
+
jpegOptimiseScans: !1,
|
|
1010
|
+
jpegOptimiseCoding: !0,
|
|
1011
|
+
jpegQuantisationTable: 0,
|
|
1012
|
+
pngProgressive: !1,
|
|
1013
|
+
pngCompressionLevel: 6,
|
|
1014
|
+
pngAdaptiveFiltering: !1,
|
|
1015
|
+
pngPalette: !1,
|
|
1016
|
+
pngQuality: 100,
|
|
1017
|
+
pngEffort: 7,
|
|
1018
|
+
pngBitdepth: 8,
|
|
1019
|
+
pngDither: 1,
|
|
1020
|
+
jp2Quality: 80,
|
|
1021
|
+
jp2TileHeight: 512,
|
|
1022
|
+
jp2TileWidth: 512,
|
|
1023
|
+
jp2Lossless: !1,
|
|
1024
|
+
jp2ChromaSubsampling: "4:4:4",
|
|
1025
|
+
webpQuality: 80,
|
|
1026
|
+
webpAlphaQuality: 100,
|
|
1027
|
+
webpLossless: !1,
|
|
1028
|
+
webpNearLossless: !1,
|
|
1029
|
+
webpSmartSubsample: !1,
|
|
1030
|
+
webpSmartDeblock: !1,
|
|
1031
|
+
webpPreset: "default",
|
|
1032
|
+
webpEffort: 4,
|
|
1033
|
+
webpMinSize: !1,
|
|
1034
|
+
webpMixed: !1,
|
|
1035
|
+
gifBitdepth: 8,
|
|
1036
|
+
gifEffort: 7,
|
|
1037
|
+
gifDither: 1,
|
|
1038
|
+
gifInterFrameMaxError: 0,
|
|
1039
|
+
gifInterPaletteMaxError: 3,
|
|
1040
|
+
gifKeepDuplicateFrames: !1,
|
|
1041
|
+
gifReuse: !0,
|
|
1042
|
+
gifProgressive: !1,
|
|
1043
|
+
tiffQuality: 80,
|
|
1044
|
+
tiffCompression: "jpeg",
|
|
1045
|
+
tiffBigtiff: !1,
|
|
1046
|
+
tiffPredictor: "horizontal",
|
|
1047
|
+
tiffPyramid: !1,
|
|
1048
|
+
tiffMiniswhite: !1,
|
|
1049
|
+
tiffBitdepth: 8,
|
|
1050
|
+
tiffTile: !1,
|
|
1051
|
+
tiffTileHeight: 256,
|
|
1052
|
+
tiffTileWidth: 256,
|
|
1053
|
+
tiffXres: 1,
|
|
1054
|
+
tiffYres: 1,
|
|
1055
|
+
tiffResolutionUnit: "inch",
|
|
1056
|
+
heifQuality: 50,
|
|
1057
|
+
heifLossless: !1,
|
|
1058
|
+
heifCompression: "av1",
|
|
1059
|
+
heifEffort: 4,
|
|
1060
|
+
heifChromaSubsampling: "4:4:4",
|
|
1061
|
+
heifBitdepth: 8,
|
|
1062
|
+
jxlDistance: 1,
|
|
1063
|
+
jxlDecodingTier: 0,
|
|
1064
|
+
jxlEffort: 7,
|
|
1065
|
+
jxlLossless: !1,
|
|
1066
|
+
rawDepth: "uchar",
|
|
1067
|
+
tileSize: 256,
|
|
1068
|
+
tileOverlap: 0,
|
|
1069
|
+
tileContainer: "fs",
|
|
1070
|
+
tileLayout: "dz",
|
|
1071
|
+
tileFormat: "last",
|
|
1072
|
+
tileDepth: "last",
|
|
1073
|
+
tileAngle: 0,
|
|
1074
|
+
tileSkipBlanks: -1,
|
|
1075
|
+
tileBackground: [
|
|
1076
|
+
255,
|
|
1077
|
+
255,
|
|
1078
|
+
255,
|
|
1079
|
+
255
|
|
1080
|
+
],
|
|
1081
|
+
tileCentre: !1,
|
|
1082
|
+
tileId: "https://example.com/iiif",
|
|
1083
|
+
tileBasename: "",
|
|
1084
|
+
timeoutSeconds: 0,
|
|
1085
|
+
linearA: [],
|
|
1086
|
+
linearB: [],
|
|
1087
|
+
pdfBackground: [
|
|
1088
|
+
255,
|
|
1089
|
+
255,
|
|
1090
|
+
255,
|
|
1091
|
+
255
|
|
1092
|
+
],
|
|
1093
|
+
debuglog: (e) => {
|
|
1094
|
+
this.emit("warning", e), s(e);
|
|
1095
|
+
},
|
|
1096
|
+
queueListener: c
|
|
1097
|
+
}, this.options.input = this._createInputDescriptor(e, t, { allowStream: !0 }), this) : new l(e, t);
|
|
1098
|
+
};
|
|
1099
|
+
Object.setPrototypeOf(l.prototype, r.Duplex.prototype), Object.setPrototypeOf(l, r.Duplex);
|
|
1100
|
+
function u() {
|
|
1101
|
+
let e = this.constructor.call(), { debuglog: t, queueListener: n, ...r } = this.options;
|
|
1102
|
+
return e.options = structuredClone(r), e.options.debuglog = t, e.options.queueListener = n, this._isStreamInput() && this.on("finish", () => {
|
|
1103
|
+
this._flattenBufferIn(), e.options.input.buffer = this.options.input.buffer, e.emit("finish");
|
|
1104
|
+
}), e;
|
|
1105
|
+
}
|
|
1106
|
+
Object.assign(l.prototype, { clone: u }), t.exports = l;
|
|
1107
|
+
})), re = /* @__PURE__ */ i(((e, t) => {
|
|
1108
|
+
var n = o(), r = $(), i = {
|
|
1109
|
+
left: "low",
|
|
1110
|
+
top: "low",
|
|
1111
|
+
low: "low",
|
|
1112
|
+
center: "centre",
|
|
1113
|
+
centre: "centre",
|
|
1114
|
+
right: "high",
|
|
1115
|
+
bottom: "high",
|
|
1116
|
+
high: "high"
|
|
1117
|
+
}, a = [
|
|
1118
|
+
"failOn",
|
|
1119
|
+
"limitInputPixels",
|
|
1120
|
+
"unlimited",
|
|
1121
|
+
"animated",
|
|
1122
|
+
"autoOrient",
|
|
1123
|
+
"density",
|
|
1124
|
+
"ignoreIcc",
|
|
1125
|
+
"page",
|
|
1126
|
+
"pages",
|
|
1127
|
+
"sequentialRead",
|
|
1128
|
+
"jp2",
|
|
1129
|
+
"openSlide",
|
|
1130
|
+
"pdf",
|
|
1131
|
+
"raw",
|
|
1132
|
+
"svg",
|
|
1133
|
+
"tiff",
|
|
1134
|
+
"failOnError",
|
|
1135
|
+
"openSlideLevel",
|
|
1136
|
+
"pdfBackground",
|
|
1137
|
+
"tiffSubifd"
|
|
1138
|
+
];
|
|
1139
|
+
function s(e) {
|
|
1140
|
+
let t = a.filter((t) => n.defined(e[t])).map((t) => [t, e[t]]);
|
|
1141
|
+
return t.length ? Object.fromEntries(t) : void 0;
|
|
1142
|
+
}
|
|
1143
|
+
function c(e, t, r) {
|
|
1144
|
+
let i = {
|
|
1145
|
+
autoOrient: !1,
|
|
1146
|
+
failOn: "warning",
|
|
1147
|
+
limitInputPixels: 16383 ** 2,
|
|
1148
|
+
ignoreIcc: !1,
|
|
1149
|
+
unlimited: !1,
|
|
1150
|
+
sequentialRead: !0
|
|
1151
|
+
};
|
|
1152
|
+
if (n.string(e)) i.file = e;
|
|
1153
|
+
else if (n.buffer(e)) {
|
|
1154
|
+
if (e.length === 0) throw Error("Input Buffer is empty");
|
|
1155
|
+
i.buffer = e;
|
|
1156
|
+
} else if (n.arrayBuffer(e)) {
|
|
1157
|
+
if (e.byteLength === 0) throw Error("Input bit Array is empty");
|
|
1158
|
+
i.buffer = Buffer.from(e, 0, e.byteLength);
|
|
1159
|
+
} else if (n.typedArray(e)) {
|
|
1160
|
+
if (e.length === 0) throw Error("Input Bit Array is empty");
|
|
1161
|
+
i.buffer = Buffer.from(e.buffer, e.byteOffset, e.byteLength);
|
|
1162
|
+
} else if (n.plainObject(e) && !n.defined(t)) t = e, s(t) && (i.buffer = []);
|
|
1163
|
+
else if (!n.defined(e) && !n.defined(t) && n.object(r) && r.allowStream) i.buffer = [];
|
|
1164
|
+
else if (Array.isArray(e)) if (e.length > 1) if (!this.options.joining) this.options.joining = !0, this.options.join = e.map((e) => this._createInputDescriptor(e));
|
|
1165
|
+
else throw Error("Recursive join is unsupported");
|
|
1166
|
+
else throw Error("Expected at least two images to join");
|
|
1167
|
+
else throw Error(`Unsupported input '${e}' of type ${typeof e}${n.defined(t) ? ` when also providing options of type ${typeof t}` : ""}`);
|
|
1168
|
+
if (n.object(t)) {
|
|
1169
|
+
if (n.defined(t.failOnError)) if (n.bool(t.failOnError)) i.failOn = t.failOnError ? "warning" : "none";
|
|
1170
|
+
else throw n.invalidParameterError("failOnError", "boolean", t.failOnError);
|
|
1171
|
+
if (n.defined(t.failOn)) if (n.string(t.failOn) && n.inArray(t.failOn, [
|
|
1172
|
+
"none",
|
|
1173
|
+
"truncated",
|
|
1174
|
+
"error",
|
|
1175
|
+
"warning"
|
|
1176
|
+
])) i.failOn = t.failOn;
|
|
1177
|
+
else throw n.invalidParameterError("failOn", "one of: none, truncated, error, warning", t.failOn);
|
|
1178
|
+
if (n.defined(t.autoOrient)) if (n.bool(t.autoOrient)) i.autoOrient = t.autoOrient;
|
|
1179
|
+
else throw n.invalidParameterError("autoOrient", "boolean", t.autoOrient);
|
|
1180
|
+
if (n.defined(t.density)) if (n.inRange(t.density, 1, 1e5)) i.density = t.density;
|
|
1181
|
+
else throw n.invalidParameterError("density", "number between 1 and 100000", t.density);
|
|
1182
|
+
if (n.defined(t.ignoreIcc)) if (n.bool(t.ignoreIcc)) i.ignoreIcc = t.ignoreIcc;
|
|
1183
|
+
else throw n.invalidParameterError("ignoreIcc", "boolean", t.ignoreIcc);
|
|
1184
|
+
if (n.defined(t.limitInputPixels)) if (n.bool(t.limitInputPixels)) i.limitInputPixels = t.limitInputPixels ? 16383 ** 2 : 0;
|
|
1185
|
+
else if (n.integer(t.limitInputPixels) && n.inRange(t.limitInputPixels, 0, 2 ** 53 - 1)) i.limitInputPixels = t.limitInputPixels;
|
|
1186
|
+
else throw n.invalidParameterError("limitInputPixels", "positive integer", t.limitInputPixels);
|
|
1187
|
+
if (n.defined(t.unlimited)) if (n.bool(t.unlimited)) i.unlimited = t.unlimited;
|
|
1188
|
+
else throw n.invalidParameterError("unlimited", "boolean", t.unlimited);
|
|
1189
|
+
if (n.defined(t.sequentialRead)) if (n.bool(t.sequentialRead)) i.sequentialRead = t.sequentialRead;
|
|
1190
|
+
else throw n.invalidParameterError("sequentialRead", "boolean", t.sequentialRead);
|
|
1191
|
+
if (n.defined(t.raw)) {
|
|
1192
|
+
if (n.object(t.raw) && n.integer(t.raw.width) && t.raw.width > 0 && n.integer(t.raw.height) && t.raw.height > 0 && n.integer(t.raw.channels) && n.inRange(t.raw.channels, 1, 4)) switch (i.rawWidth = t.raw.width, i.rawHeight = t.raw.height, i.rawChannels = t.raw.channels, e.constructor) {
|
|
1193
|
+
case Uint8Array:
|
|
1194
|
+
case Uint8ClampedArray:
|
|
1195
|
+
i.rawDepth = "uchar";
|
|
1196
|
+
break;
|
|
1197
|
+
case Int8Array:
|
|
1198
|
+
i.rawDepth = "char";
|
|
1199
|
+
break;
|
|
1200
|
+
case Uint16Array:
|
|
1201
|
+
i.rawDepth = "ushort";
|
|
1202
|
+
break;
|
|
1203
|
+
case Int16Array:
|
|
1204
|
+
i.rawDepth = "short";
|
|
1205
|
+
break;
|
|
1206
|
+
case Uint32Array:
|
|
1207
|
+
i.rawDepth = "uint";
|
|
1208
|
+
break;
|
|
1209
|
+
case Int32Array:
|
|
1210
|
+
i.rawDepth = "int";
|
|
1211
|
+
break;
|
|
1212
|
+
case Float32Array:
|
|
1213
|
+
i.rawDepth = "float";
|
|
1214
|
+
break;
|
|
1215
|
+
case Float64Array:
|
|
1216
|
+
i.rawDepth = "double";
|
|
1217
|
+
break;
|
|
1218
|
+
default:
|
|
1219
|
+
i.rawDepth = "uchar";
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
else throw Error("Expected width, height and channels for raw pixel input");
|
|
1223
|
+
if (i.rawPremultiplied = !1, n.defined(t.raw.premultiplied)) if (n.bool(t.raw.premultiplied)) i.rawPremultiplied = t.raw.premultiplied;
|
|
1224
|
+
else throw n.invalidParameterError("raw.premultiplied", "boolean", t.raw.premultiplied);
|
|
1225
|
+
if (i.rawPageHeight = 0, n.defined(t.raw.pageHeight)) if (n.integer(t.raw.pageHeight) && t.raw.pageHeight > 0 && t.raw.pageHeight <= t.raw.height) {
|
|
1226
|
+
if (t.raw.height % t.raw.pageHeight !== 0) throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);
|
|
1227
|
+
i.rawPageHeight = t.raw.pageHeight;
|
|
1228
|
+
} else throw n.invalidParameterError("raw.pageHeight", "positive integer", t.raw.pageHeight);
|
|
1229
|
+
}
|
|
1230
|
+
if (n.defined(t.animated)) if (n.bool(t.animated)) i.pages = t.animated ? -1 : 1;
|
|
1231
|
+
else throw n.invalidParameterError("animated", "boolean", t.animated);
|
|
1232
|
+
if (n.defined(t.pages)) if (n.integer(t.pages) && n.inRange(t.pages, -1, 1e5)) i.pages = t.pages;
|
|
1233
|
+
else throw n.invalidParameterError("pages", "integer between -1 and 100000", t.pages);
|
|
1234
|
+
if (n.defined(t.page)) if (n.integer(t.page) && n.inRange(t.page, 0, 1e5)) i.page = t.page;
|
|
1235
|
+
else throw n.invalidParameterError("page", "integer between 0 and 100000", t.page);
|
|
1236
|
+
if (n.object(t.openSlide) && n.defined(t.openSlide.level)) if (n.integer(t.openSlide.level) && n.inRange(t.openSlide.level, 0, 256)) i.openSlideLevel = t.openSlide.level;
|
|
1237
|
+
else throw n.invalidParameterError("openSlide.level", "integer between 0 and 256", t.openSlide.level);
|
|
1238
|
+
else if (n.defined(t.level)) if (n.integer(t.level) && n.inRange(t.level, 0, 256)) i.openSlideLevel = t.level;
|
|
1239
|
+
else throw n.invalidParameterError("level", "integer between 0 and 256", t.level);
|
|
1240
|
+
if (n.object(t.tiff) && n.defined(t.tiff.subifd)) if (n.integer(t.tiff.subifd) && n.inRange(t.tiff.subifd, -1, 1e5)) i.tiffSubifd = t.tiff.subifd;
|
|
1241
|
+
else throw n.invalidParameterError("tiff.subifd", "integer between -1 and 100000", t.tiff.subifd);
|
|
1242
|
+
else if (n.defined(t.subifd)) if (n.integer(t.subifd) && n.inRange(t.subifd, -1, 1e5)) i.tiffSubifd = t.subifd;
|
|
1243
|
+
else throw n.invalidParameterError("subifd", "integer between -1 and 100000", t.subifd);
|
|
1244
|
+
if (n.object(t.svg)) {
|
|
1245
|
+
if (n.defined(t.svg.stylesheet)) if (n.string(t.svg.stylesheet)) i.svgStylesheet = t.svg.stylesheet;
|
|
1246
|
+
else throw n.invalidParameterError("svg.stylesheet", "string", t.svg.stylesheet);
|
|
1247
|
+
if (n.defined(t.svg.highBitdepth)) if (n.bool(t.svg.highBitdepth)) i.svgHighBitdepth = t.svg.highBitdepth;
|
|
1248
|
+
else throw n.invalidParameterError("svg.highBitdepth", "boolean", t.svg.highBitdepth);
|
|
1249
|
+
}
|
|
1250
|
+
if (n.object(t.pdf) && n.defined(t.pdf.background) ? i.pdfBackground = this._getBackgroundColourOption(t.pdf.background) : n.defined(t.pdfBackground) && (i.pdfBackground = this._getBackgroundColourOption(t.pdfBackground)), n.object(t.jp2) && n.defined(t.jp2.oneshot)) if (n.bool(t.jp2.oneshot)) i.jp2Oneshot = t.jp2.oneshot;
|
|
1251
|
+
else throw n.invalidParameterError("jp2.oneshot", "boolean", t.jp2.oneshot);
|
|
1252
|
+
if (n.defined(t.create)) if (n.object(t.create) && n.integer(t.create.width) && t.create.width > 0 && n.integer(t.create.height) && t.create.height > 0 && n.integer(t.create.channels)) {
|
|
1253
|
+
if (i.createWidth = t.create.width, i.createHeight = t.create.height, i.createChannels = t.create.channels, i.createPageHeight = 0, n.defined(t.create.pageHeight)) if (n.integer(t.create.pageHeight) && t.create.pageHeight > 0 && t.create.pageHeight <= t.create.height) {
|
|
1254
|
+
if (t.create.height % t.create.pageHeight !== 0) throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);
|
|
1255
|
+
i.createPageHeight = t.create.pageHeight;
|
|
1256
|
+
} else throw n.invalidParameterError("create.pageHeight", "positive integer", t.create.pageHeight);
|
|
1257
|
+
if (n.defined(t.create.noise)) {
|
|
1258
|
+
if (!n.object(t.create.noise)) throw Error("Expected noise to be an object");
|
|
1259
|
+
if (t.create.noise.type !== "gaussian") throw Error("Only gaussian noise is supported at the moment");
|
|
1260
|
+
if (i.createNoiseType = t.create.noise.type, !n.inRange(t.create.channels, 1, 4)) throw n.invalidParameterError("create.channels", "number between 1 and 4", t.create.channels);
|
|
1261
|
+
if (i.createNoiseMean = 128, n.defined(t.create.noise.mean)) if (n.number(t.create.noise.mean) && n.inRange(t.create.noise.mean, 0, 1e4)) i.createNoiseMean = t.create.noise.mean;
|
|
1262
|
+
else throw n.invalidParameterError("create.noise.mean", "number between 0 and 10000", t.create.noise.mean);
|
|
1263
|
+
if (i.createNoiseSigma = 30, n.defined(t.create.noise.sigma)) if (n.number(t.create.noise.sigma) && n.inRange(t.create.noise.sigma, 0, 1e4)) i.createNoiseSigma = t.create.noise.sigma;
|
|
1264
|
+
else throw n.invalidParameterError("create.noise.sigma", "number between 0 and 10000", t.create.noise.sigma);
|
|
1265
|
+
} else if (n.defined(t.create.background)) {
|
|
1266
|
+
if (!n.inRange(t.create.channels, 3, 4)) throw n.invalidParameterError("create.channels", "number between 3 and 4", t.create.channels);
|
|
1267
|
+
i.createBackground = this._getBackgroundColourOption(t.create.background);
|
|
1268
|
+
} else throw Error("Expected valid noise or background to create a new input image");
|
|
1269
|
+
delete i.buffer;
|
|
1270
|
+
} else throw Error("Expected valid width, height and channels to create a new input image");
|
|
1271
|
+
if (n.defined(t.text)) if (n.object(t.text) && n.string(t.text.text)) {
|
|
1272
|
+
if (i.textValue = t.text.text, n.defined(t.text.height) && n.defined(t.text.dpi)) throw Error("Expected only one of dpi or height");
|
|
1273
|
+
if (n.defined(t.text.font)) if (n.string(t.text.font)) i.textFont = t.text.font;
|
|
1274
|
+
else throw n.invalidParameterError("text.font", "string", t.text.font);
|
|
1275
|
+
if (n.defined(t.text.fontfile)) if (n.string(t.text.fontfile)) i.textFontfile = t.text.fontfile;
|
|
1276
|
+
else throw n.invalidParameterError("text.fontfile", "string", t.text.fontfile);
|
|
1277
|
+
if (n.defined(t.text.width)) if (n.integer(t.text.width) && t.text.width > 0) i.textWidth = t.text.width;
|
|
1278
|
+
else throw n.invalidParameterError("text.width", "positive integer", t.text.width);
|
|
1279
|
+
if (n.defined(t.text.height)) if (n.integer(t.text.height) && t.text.height > 0) i.textHeight = t.text.height;
|
|
1280
|
+
else throw n.invalidParameterError("text.height", "positive integer", t.text.height);
|
|
1281
|
+
if (n.defined(t.text.align)) if (n.string(t.text.align) && n.string(this.constructor.align[t.text.align])) i.textAlign = this.constructor.align[t.text.align];
|
|
1282
|
+
else throw n.invalidParameterError("text.align", "valid alignment", t.text.align);
|
|
1283
|
+
if (n.defined(t.text.justify)) if (n.bool(t.text.justify)) i.textJustify = t.text.justify;
|
|
1284
|
+
else throw n.invalidParameterError("text.justify", "boolean", t.text.justify);
|
|
1285
|
+
if (n.defined(t.text.dpi)) if (n.integer(t.text.dpi) && n.inRange(t.text.dpi, 1, 1e6)) i.textDpi = t.text.dpi;
|
|
1286
|
+
else throw n.invalidParameterError("text.dpi", "integer between 1 and 1000000", t.text.dpi);
|
|
1287
|
+
if (n.defined(t.text.rgba)) if (n.bool(t.text.rgba)) i.textRgba = t.text.rgba;
|
|
1288
|
+
else throw n.invalidParameterError("text.rgba", "bool", t.text.rgba);
|
|
1289
|
+
if (n.defined(t.text.spacing)) if (n.integer(t.text.spacing) && n.inRange(t.text.spacing, -1e6, 1e6)) i.textSpacing = t.text.spacing;
|
|
1290
|
+
else throw n.invalidParameterError("text.spacing", "integer between -1000000 and 1000000", t.text.spacing);
|
|
1291
|
+
if (n.defined(t.text.wrap)) if (n.string(t.text.wrap) && n.inArray(t.text.wrap, [
|
|
1292
|
+
"word",
|
|
1293
|
+
"char",
|
|
1294
|
+
"word-char",
|
|
1295
|
+
"none"
|
|
1296
|
+
])) i.textWrap = t.text.wrap;
|
|
1297
|
+
else throw n.invalidParameterError("text.wrap", "one of: word, char, word-char, none", t.text.wrap);
|
|
1298
|
+
delete i.buffer;
|
|
1299
|
+
} else throw Error("Expected a valid string to create an image with text.");
|
|
1300
|
+
if (n.defined(t.join)) if (n.defined(this.options.join)) {
|
|
1301
|
+
if (n.defined(t.join.animated)) if (n.bool(t.join.animated)) i.joinAnimated = t.join.animated;
|
|
1302
|
+
else throw n.invalidParameterError("join.animated", "boolean", t.join.animated);
|
|
1303
|
+
if (n.defined(t.join.across)) if (n.integer(t.join.across) && n.inRange(t.join.across, 1, 1e6)) i.joinAcross = t.join.across;
|
|
1304
|
+
else throw n.invalidParameterError("join.across", "integer between 1 and 100000", t.join.across);
|
|
1305
|
+
if (n.defined(t.join.shim)) if (n.integer(t.join.shim) && n.inRange(t.join.shim, 0, 1e6)) i.joinShim = t.join.shim;
|
|
1306
|
+
else throw n.invalidParameterError("join.shim", "integer between 0 and 100000", t.join.shim);
|
|
1307
|
+
if (n.defined(t.join.background) && (i.joinBackground = this._getBackgroundColourOption(t.join.background)), n.defined(t.join.halign)) if (n.string(t.join.halign) && n.string(this.constructor.align[t.join.halign])) i.joinHalign = this.constructor.align[t.join.halign];
|
|
1308
|
+
else throw n.invalidParameterError("join.halign", "valid alignment", t.join.halign);
|
|
1309
|
+
if (n.defined(t.join.valign)) if (n.string(t.join.valign) && n.string(this.constructor.align[t.join.valign])) i.joinValign = this.constructor.align[t.join.valign];
|
|
1310
|
+
else throw n.invalidParameterError("join.valign", "valid alignment", t.join.valign);
|
|
1311
|
+
} else throw Error("Expected input to be an array of images to join");
|
|
1312
|
+
} else if (n.defined(t)) throw Error(`Invalid input options ${t}`);
|
|
1313
|
+
return i;
|
|
1314
|
+
}
|
|
1315
|
+
function l(e, t, r) {
|
|
1316
|
+
Array.isArray(this.options.input.buffer) ? n.buffer(e) ? (this.options.input.buffer.length === 0 && this.on("finish", () => {
|
|
1317
|
+
this.streamInFinished = !0;
|
|
1318
|
+
}), this.options.input.buffer.push(e), r()) : r(/* @__PURE__ */ Error("Non-Buffer data on Writable Stream")) : r(/* @__PURE__ */ Error("Unexpected data on Writable Stream"));
|
|
1319
|
+
}
|
|
1320
|
+
function u() {
|
|
1321
|
+
this._isStreamInput() && (this.options.input.buffer = Buffer.concat(this.options.input.buffer));
|
|
1322
|
+
}
|
|
1323
|
+
function d() {
|
|
1324
|
+
return Array.isArray(this.options.input.buffer);
|
|
1325
|
+
}
|
|
1326
|
+
function f(e) {
|
|
1327
|
+
let t = Error();
|
|
1328
|
+
return n.fn(e) ? (this._isStreamInput() ? this.on("finish", () => {
|
|
1329
|
+
this._flattenBufferIn(), r.metadata(this.options, (r, i) => {
|
|
1330
|
+
r ? e(n.nativeError(r, t)) : e(null, i);
|
|
1331
|
+
});
|
|
1332
|
+
}) : r.metadata(this.options, (r, i) => {
|
|
1333
|
+
r ? e(n.nativeError(r, t)) : e(null, i);
|
|
1334
|
+
}), this) : this._isStreamInput() ? new Promise((e, i) => {
|
|
1335
|
+
let a = () => {
|
|
1336
|
+
this._flattenBufferIn(), r.metadata(this.options, (r, a) => {
|
|
1337
|
+
r ? i(n.nativeError(r, t)) : e(a);
|
|
1338
|
+
});
|
|
1339
|
+
};
|
|
1340
|
+
this.writableFinished ? a() : this.once("finish", a);
|
|
1341
|
+
}) : new Promise((e, i) => {
|
|
1342
|
+
r.metadata(this.options, (r, a) => {
|
|
1343
|
+
r ? i(n.nativeError(r, t)) : e(a);
|
|
1344
|
+
});
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
function p(e) {
|
|
1348
|
+
let t = Error();
|
|
1349
|
+
return n.fn(e) ? (this._isStreamInput() ? this.on("finish", () => {
|
|
1350
|
+
this._flattenBufferIn(), r.stats(this.options, (r, i) => {
|
|
1351
|
+
r ? e(n.nativeError(r, t)) : e(null, i);
|
|
1352
|
+
});
|
|
1353
|
+
}) : r.stats(this.options, (r, i) => {
|
|
1354
|
+
r ? e(n.nativeError(r, t)) : e(null, i);
|
|
1355
|
+
}), this) : this._isStreamInput() ? new Promise((e, i) => {
|
|
1356
|
+
this.on("finish", function() {
|
|
1357
|
+
this._flattenBufferIn(), r.stats(this.options, (r, a) => {
|
|
1358
|
+
r ? i(n.nativeError(r, t)) : e(a);
|
|
1359
|
+
});
|
|
1360
|
+
});
|
|
1361
|
+
}) : new Promise((e, i) => {
|
|
1362
|
+
r.stats(this.options, (r, a) => {
|
|
1363
|
+
r ? i(n.nativeError(r, t)) : e(a);
|
|
1364
|
+
});
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
t.exports = (e) => {
|
|
1368
|
+
Object.assign(e.prototype, {
|
|
1369
|
+
_inputOptionsFromObject: s,
|
|
1370
|
+
_createInputDescriptor: c,
|
|
1371
|
+
_write: l,
|
|
1372
|
+
_flattenBufferIn: u,
|
|
1373
|
+
_isStreamInput: d,
|
|
1374
|
+
metadata: f,
|
|
1375
|
+
stats: p
|
|
1376
|
+
}), e.align = i;
|
|
1377
|
+
};
|
|
1378
|
+
})), ie = /* @__PURE__ */ i(((e, t) => {
|
|
1379
|
+
var n = o(), r = {
|
|
1380
|
+
center: 0,
|
|
1381
|
+
centre: 0,
|
|
1382
|
+
north: 1,
|
|
1383
|
+
east: 2,
|
|
1384
|
+
south: 3,
|
|
1385
|
+
west: 4,
|
|
1386
|
+
northeast: 5,
|
|
1387
|
+
southeast: 6,
|
|
1388
|
+
southwest: 7,
|
|
1389
|
+
northwest: 8
|
|
1390
|
+
}, i = {
|
|
1391
|
+
top: 1,
|
|
1392
|
+
right: 2,
|
|
1393
|
+
bottom: 3,
|
|
1394
|
+
left: 4,
|
|
1395
|
+
"right top": 5,
|
|
1396
|
+
"right bottom": 6,
|
|
1397
|
+
"left bottom": 7,
|
|
1398
|
+
"left top": 8
|
|
1399
|
+
}, a = {
|
|
1400
|
+
background: "background",
|
|
1401
|
+
copy: "copy",
|
|
1402
|
+
repeat: "repeat",
|
|
1403
|
+
mirror: "mirror"
|
|
1404
|
+
}, s = {
|
|
1405
|
+
entropy: 16,
|
|
1406
|
+
attention: 17
|
|
1407
|
+
}, c = {
|
|
1408
|
+
nearest: "nearest",
|
|
1409
|
+
linear: "linear",
|
|
1410
|
+
cubic: "cubic",
|
|
1411
|
+
mitchell: "mitchell",
|
|
1412
|
+
lanczos2: "lanczos2",
|
|
1413
|
+
lanczos3: "lanczos3",
|
|
1414
|
+
mks2013: "mks2013",
|
|
1415
|
+
mks2021: "mks2021"
|
|
1416
|
+
}, l = {
|
|
1417
|
+
contain: "contain",
|
|
1418
|
+
cover: "cover",
|
|
1419
|
+
fill: "fill",
|
|
1420
|
+
inside: "inside",
|
|
1421
|
+
outside: "outside"
|
|
1422
|
+
}, u = {
|
|
1423
|
+
contain: "embed",
|
|
1424
|
+
cover: "crop",
|
|
1425
|
+
fill: "ignore_aspect",
|
|
1426
|
+
inside: "max",
|
|
1427
|
+
outside: "min"
|
|
1428
|
+
};
|
|
1429
|
+
function d(e) {
|
|
1430
|
+
return e.angle % 360 != 0 || e.rotationAngle !== 0;
|
|
1431
|
+
}
|
|
1432
|
+
function f(e) {
|
|
1433
|
+
return e.width !== -1 || e.height !== -1;
|
|
1434
|
+
}
|
|
1435
|
+
function p(e, t, a) {
|
|
1436
|
+
if (f(this.options) && this.options.debuglog("ignoring previous resize options"), this.options.widthPost !== -1 && this.options.debuglog("operation order will be: extract, resize, extract"), n.defined(e)) if (n.object(e) && !n.defined(a)) a = e;
|
|
1437
|
+
else if (n.integer(e) && e > 0) this.options.width = e;
|
|
1438
|
+
else throw n.invalidParameterError("width", "positive integer", e);
|
|
1439
|
+
else this.options.width = -1;
|
|
1440
|
+
if (n.defined(t)) if (n.integer(t) && t > 0) this.options.height = t;
|
|
1441
|
+
else throw n.invalidParameterError("height", "positive integer", t);
|
|
1442
|
+
else this.options.height = -1;
|
|
1443
|
+
if (n.object(a)) {
|
|
1444
|
+
if (n.defined(a.width)) if (n.integer(a.width) && a.width > 0) this.options.width = a.width;
|
|
1445
|
+
else throw n.invalidParameterError("width", "positive integer", a.width);
|
|
1446
|
+
if (n.defined(a.height)) if (n.integer(a.height) && a.height > 0) this.options.height = a.height;
|
|
1447
|
+
else throw n.invalidParameterError("height", "positive integer", a.height);
|
|
1448
|
+
if (n.defined(a.fit)) {
|
|
1449
|
+
let e = u[a.fit];
|
|
1450
|
+
if (n.string(e)) this.options.canvas = e;
|
|
1451
|
+
else throw n.invalidParameterError("fit", "valid fit", a.fit);
|
|
1452
|
+
}
|
|
1453
|
+
if (n.defined(a.position)) {
|
|
1454
|
+
let e = n.integer(a.position) ? a.position : s[a.position] || i[a.position] || r[a.position];
|
|
1455
|
+
if (n.integer(e) && (n.inRange(e, 0, 8) || n.inRange(e, 16, 17))) this.options.position = e;
|
|
1456
|
+
else throw n.invalidParameterError("position", "valid position/gravity/strategy", a.position);
|
|
1457
|
+
}
|
|
1458
|
+
if (this._setBackgroundColourOption("resizeBackground", a.background), n.defined(a.kernel)) if (n.string(c[a.kernel])) this.options.kernel = c[a.kernel];
|
|
1459
|
+
else throw n.invalidParameterError("kernel", "valid kernel name", a.kernel);
|
|
1460
|
+
n.defined(a.withoutEnlargement) && this._setBooleanOption("withoutEnlargement", a.withoutEnlargement), n.defined(a.withoutReduction) && this._setBooleanOption("withoutReduction", a.withoutReduction), n.defined(a.fastShrinkOnLoad) && this._setBooleanOption("fastShrinkOnLoad", a.fastShrinkOnLoad);
|
|
1461
|
+
}
|
|
1462
|
+
return d(this.options) && f(this.options) && (this.options.rotateBefore = !0), this;
|
|
1463
|
+
}
|
|
1464
|
+
function m(e) {
|
|
1465
|
+
if (n.integer(e) && e > 0) this.options.extendTop = e, this.options.extendBottom = e, this.options.extendLeft = e, this.options.extendRight = e;
|
|
1466
|
+
else if (n.object(e)) {
|
|
1467
|
+
if (n.defined(e.top)) if (n.integer(e.top) && e.top >= 0) this.options.extendTop = e.top;
|
|
1468
|
+
else throw n.invalidParameterError("top", "positive integer", e.top);
|
|
1469
|
+
if (n.defined(e.bottom)) if (n.integer(e.bottom) && e.bottom >= 0) this.options.extendBottom = e.bottom;
|
|
1470
|
+
else throw n.invalidParameterError("bottom", "positive integer", e.bottom);
|
|
1471
|
+
if (n.defined(e.left)) if (n.integer(e.left) && e.left >= 0) this.options.extendLeft = e.left;
|
|
1472
|
+
else throw n.invalidParameterError("left", "positive integer", e.left);
|
|
1473
|
+
if (n.defined(e.right)) if (n.integer(e.right) && e.right >= 0) this.options.extendRight = e.right;
|
|
1474
|
+
else throw n.invalidParameterError("right", "positive integer", e.right);
|
|
1475
|
+
if (this._setBackgroundColourOption("extendBackground", e.background), n.defined(e.extendWith)) if (n.string(a[e.extendWith])) this.options.extendWith = a[e.extendWith];
|
|
1476
|
+
else throw n.invalidParameterError("extendWith", "one of: background, copy, repeat, mirror", e.extendWith);
|
|
1477
|
+
} else throw n.invalidParameterError("extend", "integer or object", e);
|
|
1478
|
+
return this;
|
|
1479
|
+
}
|
|
1480
|
+
function h(e) {
|
|
1481
|
+
let t = f(this.options) || this.options.widthPre !== -1 ? "Post" : "Pre";
|
|
1482
|
+
return this.options[`width${t}`] !== -1 && this.options.debuglog("ignoring previous extract options"), [
|
|
1483
|
+
"left",
|
|
1484
|
+
"top",
|
|
1485
|
+
"width",
|
|
1486
|
+
"height"
|
|
1487
|
+
].forEach(function(r) {
|
|
1488
|
+
let i = e[r];
|
|
1489
|
+
if (n.integer(i) && i >= 0) this.options[r + (r === "left" || r === "top" ? "Offset" : "") + t] = i;
|
|
1490
|
+
else throw n.invalidParameterError(r, "integer", i);
|
|
1491
|
+
}, this), d(this.options) && !f(this.options) && (this.options.widthPre === -1 || this.options.widthPost === -1) && (this.options.rotateBefore = !0), this.options.input.autoOrient && (this.options.orientBefore = !0), this;
|
|
1492
|
+
}
|
|
1493
|
+
function g(e) {
|
|
1494
|
+
if (this.options.trimThreshold = 10, n.defined(e)) if (n.object(e)) {
|
|
1495
|
+
if (n.defined(e.background) && this._setBackgroundColourOption("trimBackground", e.background), n.defined(e.threshold)) if (n.number(e.threshold) && e.threshold >= 0) this.options.trimThreshold = e.threshold;
|
|
1496
|
+
else throw n.invalidParameterError("threshold", "positive number", e.threshold);
|
|
1497
|
+
n.defined(e.lineArt) && this._setBooleanOption("trimLineArt", e.lineArt);
|
|
1498
|
+
} else throw n.invalidParameterError("trim", "object", e);
|
|
1499
|
+
return d(this.options) && (this.options.rotateBefore = !0), this;
|
|
1500
|
+
}
|
|
1501
|
+
t.exports = (e) => {
|
|
1502
|
+
Object.assign(e.prototype, {
|
|
1503
|
+
resize: p,
|
|
1504
|
+
extend: m,
|
|
1505
|
+
extract: h,
|
|
1506
|
+
trim: g
|
|
1507
|
+
}), e.gravity = r, e.strategy = s, e.kernel = c, e.fit = l, e.position = i;
|
|
1508
|
+
};
|
|
1509
|
+
})), ae = /* @__PURE__ */ i(((e, t) => {
|
|
1510
|
+
var n = o(), r = {
|
|
1511
|
+
clear: "clear",
|
|
1512
|
+
source: "source",
|
|
1513
|
+
over: "over",
|
|
1514
|
+
in: "in",
|
|
1515
|
+
out: "out",
|
|
1516
|
+
atop: "atop",
|
|
1517
|
+
dest: "dest",
|
|
1518
|
+
"dest-over": "dest-over",
|
|
1519
|
+
"dest-in": "dest-in",
|
|
1520
|
+
"dest-out": "dest-out",
|
|
1521
|
+
"dest-atop": "dest-atop",
|
|
1522
|
+
xor: "xor",
|
|
1523
|
+
add: "add",
|
|
1524
|
+
saturate: "saturate",
|
|
1525
|
+
multiply: "multiply",
|
|
1526
|
+
screen: "screen",
|
|
1527
|
+
overlay: "overlay",
|
|
1528
|
+
darken: "darken",
|
|
1529
|
+
lighten: "lighten",
|
|
1530
|
+
"colour-dodge": "colour-dodge",
|
|
1531
|
+
"color-dodge": "colour-dodge",
|
|
1532
|
+
"colour-burn": "colour-burn",
|
|
1533
|
+
"color-burn": "colour-burn",
|
|
1534
|
+
"hard-light": "hard-light",
|
|
1535
|
+
"soft-light": "soft-light",
|
|
1536
|
+
difference: "difference",
|
|
1537
|
+
exclusion: "exclusion"
|
|
1538
|
+
};
|
|
1539
|
+
function i(e) {
|
|
1540
|
+
if (!Array.isArray(e)) throw n.invalidParameterError("images to composite", "array", e);
|
|
1541
|
+
return this.options.composite = e.map((e) => {
|
|
1542
|
+
if (!n.object(e)) throw n.invalidParameterError("image to composite", "object", e);
|
|
1543
|
+
let t = this._inputOptionsFromObject(e), i = {
|
|
1544
|
+
input: this._createInputDescriptor(e.input, t, { allowStream: !1 }),
|
|
1545
|
+
blend: "over",
|
|
1546
|
+
tile: !1,
|
|
1547
|
+
left: 0,
|
|
1548
|
+
top: 0,
|
|
1549
|
+
hasOffset: !1,
|
|
1550
|
+
gravity: 0,
|
|
1551
|
+
premultiplied: !1
|
|
1552
|
+
};
|
|
1553
|
+
if (n.defined(e.blend)) if (n.string(r[e.blend])) i.blend = r[e.blend];
|
|
1554
|
+
else throw n.invalidParameterError("blend", "valid blend name", e.blend);
|
|
1555
|
+
if (n.defined(e.tile)) if (n.bool(e.tile)) i.tile = e.tile;
|
|
1556
|
+
else throw n.invalidParameterError("tile", "boolean", e.tile);
|
|
1557
|
+
if (n.defined(e.left)) if (n.integer(e.left)) i.left = e.left;
|
|
1558
|
+
else throw n.invalidParameterError("left", "integer", e.left);
|
|
1559
|
+
if (n.defined(e.top)) if (n.integer(e.top)) i.top = e.top;
|
|
1560
|
+
else throw n.invalidParameterError("top", "integer", e.top);
|
|
1561
|
+
if (n.defined(e.top) !== n.defined(e.left)) throw Error("Expected both left and top to be set");
|
|
1562
|
+
if (i.hasOffset = n.integer(e.top) && n.integer(e.left), n.defined(e.gravity)) if (n.integer(e.gravity) && n.inRange(e.gravity, 0, 8)) i.gravity = e.gravity;
|
|
1563
|
+
else if (n.string(e.gravity) && n.integer(this.constructor.gravity[e.gravity])) i.gravity = this.constructor.gravity[e.gravity];
|
|
1564
|
+
else throw n.invalidParameterError("gravity", "valid gravity", e.gravity);
|
|
1565
|
+
if (n.defined(e.premultiplied)) if (n.bool(e.premultiplied)) i.premultiplied = e.premultiplied;
|
|
1566
|
+
else throw n.invalidParameterError("premultiplied", "boolean", e.premultiplied);
|
|
1567
|
+
return i;
|
|
1568
|
+
}), this;
|
|
1569
|
+
}
|
|
1570
|
+
t.exports = (e) => {
|
|
1571
|
+
e.prototype.composite = i, e.blend = r;
|
|
1572
|
+
};
|
|
1573
|
+
})), oe = /* @__PURE__ */ i(((e, t) => {
|
|
1574
|
+
var n = o(), r = {
|
|
1575
|
+
integer: "integer",
|
|
1576
|
+
float: "float",
|
|
1577
|
+
approximate: "approximate"
|
|
1578
|
+
};
|
|
1579
|
+
function i(e, t) {
|
|
1580
|
+
if (!n.defined(e)) return this.autoOrient();
|
|
1581
|
+
if ((this.options.angle || this.options.rotationAngle) && (this.options.debuglog("ignoring previous rotate options"), this.options.angle = 0, this.options.rotationAngle = 0), n.integer(e) && !(e % 90)) this.options.angle = e;
|
|
1582
|
+
else if (n.number(e)) this.options.rotationAngle = e, n.object(t) && t.background && this._setBackgroundColourOption("rotationBackground", t.background);
|
|
1583
|
+
else throw n.invalidParameterError("angle", "numeric", e);
|
|
1584
|
+
return this;
|
|
1585
|
+
}
|
|
1586
|
+
function a() {
|
|
1587
|
+
return this.options.input.autoOrient = !0, this;
|
|
1588
|
+
}
|
|
1589
|
+
function s(e) {
|
|
1590
|
+
return this.options.flip = n.bool(e) ? e : !0, this;
|
|
1591
|
+
}
|
|
1592
|
+
function c(e) {
|
|
1593
|
+
return this.options.flop = n.bool(e) ? e : !0, this;
|
|
1594
|
+
}
|
|
1595
|
+
function l(e, t) {
|
|
1596
|
+
let r = [].concat(...e);
|
|
1597
|
+
if (r.length === 4 && r.every(n.number)) this.options.affineMatrix = r;
|
|
1598
|
+
else throw n.invalidParameterError("matrix", "1x4 or 2x2 array", e);
|
|
1599
|
+
if (n.defined(t)) if (n.object(t)) {
|
|
1600
|
+
if (this._setBackgroundColourOption("affineBackground", t.background), n.defined(t.idx)) if (n.number(t.idx)) this.options.affineIdx = t.idx;
|
|
1601
|
+
else throw n.invalidParameterError("options.idx", "number", t.idx);
|
|
1602
|
+
if (n.defined(t.idy)) if (n.number(t.idy)) this.options.affineIdy = t.idy;
|
|
1603
|
+
else throw n.invalidParameterError("options.idy", "number", t.idy);
|
|
1604
|
+
if (n.defined(t.odx)) if (n.number(t.odx)) this.options.affineOdx = t.odx;
|
|
1605
|
+
else throw n.invalidParameterError("options.odx", "number", t.odx);
|
|
1606
|
+
if (n.defined(t.ody)) if (n.number(t.ody)) this.options.affineOdy = t.ody;
|
|
1607
|
+
else throw n.invalidParameterError("options.ody", "number", t.ody);
|
|
1608
|
+
if (n.defined(t.interpolator)) if (n.inArray(t.interpolator, Object.values(this.constructor.interpolators))) this.options.affineInterpolator = t.interpolator;
|
|
1609
|
+
else throw n.invalidParameterError("options.interpolator", "valid interpolator name", t.interpolator);
|
|
1610
|
+
} else throw n.invalidParameterError("options", "object", t);
|
|
1611
|
+
return this;
|
|
1612
|
+
}
|
|
1613
|
+
function u(e, t, r) {
|
|
1614
|
+
if (!n.defined(e)) this.options.sharpenSigma = -1;
|
|
1615
|
+
else if (n.bool(e)) this.options.sharpenSigma = e ? -1 : 0;
|
|
1616
|
+
else if (n.number(e) && n.inRange(e, .01, 1e4)) {
|
|
1617
|
+
if (this.options.sharpenSigma = e, n.defined(t)) if (n.number(t) && n.inRange(t, 0, 1e4)) this.options.sharpenM1 = t;
|
|
1618
|
+
else throw n.invalidParameterError("flat", "number between 0 and 10000", t);
|
|
1619
|
+
if (n.defined(r)) if (n.number(r) && n.inRange(r, 0, 1e4)) this.options.sharpenM2 = r;
|
|
1620
|
+
else throw n.invalidParameterError("jagged", "number between 0 and 10000", r);
|
|
1621
|
+
} else if (n.plainObject(e)) {
|
|
1622
|
+
if (n.number(e.sigma) && n.inRange(e.sigma, 1e-6, 10)) this.options.sharpenSigma = e.sigma;
|
|
1623
|
+
else throw n.invalidParameterError("options.sigma", "number between 0.000001 and 10", e.sigma);
|
|
1624
|
+
if (n.defined(e.m1)) if (n.number(e.m1) && n.inRange(e.m1, 0, 1e6)) this.options.sharpenM1 = e.m1;
|
|
1625
|
+
else throw n.invalidParameterError("options.m1", "number between 0 and 1000000", e.m1);
|
|
1626
|
+
if (n.defined(e.m2)) if (n.number(e.m2) && n.inRange(e.m2, 0, 1e6)) this.options.sharpenM2 = e.m2;
|
|
1627
|
+
else throw n.invalidParameterError("options.m2", "number between 0 and 1000000", e.m2);
|
|
1628
|
+
if (n.defined(e.x1)) if (n.number(e.x1) && n.inRange(e.x1, 0, 1e6)) this.options.sharpenX1 = e.x1;
|
|
1629
|
+
else throw n.invalidParameterError("options.x1", "number between 0 and 1000000", e.x1);
|
|
1630
|
+
if (n.defined(e.y2)) if (n.number(e.y2) && n.inRange(e.y2, 0, 1e6)) this.options.sharpenY2 = e.y2;
|
|
1631
|
+
else throw n.invalidParameterError("options.y2", "number between 0 and 1000000", e.y2);
|
|
1632
|
+
if (n.defined(e.y3)) if (n.number(e.y3) && n.inRange(e.y3, 0, 1e6)) this.options.sharpenY3 = e.y3;
|
|
1633
|
+
else throw n.invalidParameterError("options.y3", "number between 0 and 1000000", e.y3);
|
|
1634
|
+
} else throw n.invalidParameterError("sigma", "number between 0.01 and 10000", e);
|
|
1635
|
+
return this;
|
|
1636
|
+
}
|
|
1637
|
+
function d(e) {
|
|
1638
|
+
if (!n.defined(e)) this.options.medianSize = 3;
|
|
1639
|
+
else if (n.integer(e) && n.inRange(e, 1, 1e3)) this.options.medianSize = e;
|
|
1640
|
+
else throw n.invalidParameterError("size", "integer between 1 and 1000", e);
|
|
1641
|
+
return this;
|
|
1642
|
+
}
|
|
1643
|
+
function f(e) {
|
|
1644
|
+
let t;
|
|
1645
|
+
if (n.number(e)) t = e;
|
|
1646
|
+
else if (n.plainObject(e)) {
|
|
1647
|
+
if (!n.number(e.sigma)) throw n.invalidParameterError("options.sigma", "number between 0.3 and 1000", t);
|
|
1648
|
+
if (t = e.sigma, "precision" in e) if (n.string(r[e.precision])) this.options.precision = r[e.precision];
|
|
1649
|
+
else throw n.invalidParameterError("precision", "one of: integer, float, approximate", e.precision);
|
|
1650
|
+
if ("minAmplitude" in e) if (n.number(e.minAmplitude) && n.inRange(e.minAmplitude, .001, 1)) this.options.minAmpl = e.minAmplitude;
|
|
1651
|
+
else throw n.invalidParameterError("minAmplitude", "number between 0.001 and 1", e.minAmplitude);
|
|
1652
|
+
}
|
|
1653
|
+
if (!n.defined(e)) this.options.blurSigma = -1;
|
|
1654
|
+
else if (n.bool(e)) this.options.blurSigma = e ? -1 : 0;
|
|
1655
|
+
else if (n.number(t) && n.inRange(t, .3, 1e3)) this.options.blurSigma = t;
|
|
1656
|
+
else throw n.invalidParameterError("sigma", "number between 0.3 and 1000", t);
|
|
1657
|
+
return this;
|
|
1658
|
+
}
|
|
1659
|
+
function p(e) {
|
|
1660
|
+
if (!n.defined(e)) this.options.dilateWidth = 1;
|
|
1661
|
+
else if (n.integer(e) && e > 0) this.options.dilateWidth = e;
|
|
1662
|
+
else throw n.invalidParameterError("dilate", "positive integer", p);
|
|
1663
|
+
return this;
|
|
1664
|
+
}
|
|
1665
|
+
function m(e) {
|
|
1666
|
+
if (!n.defined(e)) this.options.erodeWidth = 1;
|
|
1667
|
+
else if (n.integer(e) && e > 0) this.options.erodeWidth = e;
|
|
1668
|
+
else throw n.invalidParameterError("erode", "positive integer", m);
|
|
1669
|
+
return this;
|
|
1670
|
+
}
|
|
1671
|
+
function h(e) {
|
|
1672
|
+
return this.options.flatten = n.bool(e) ? e : !0, n.object(e) && this._setBackgroundColourOption("flattenBackground", e.background), this;
|
|
1673
|
+
}
|
|
1674
|
+
function g() {
|
|
1675
|
+
return this.options.unflatten = !0, this;
|
|
1676
|
+
}
|
|
1677
|
+
function _(e, t) {
|
|
1678
|
+
if (!n.defined(e)) this.options.gamma = 2.2;
|
|
1679
|
+
else if (n.number(e) && n.inRange(e, 1, 3)) this.options.gamma = e;
|
|
1680
|
+
else throw n.invalidParameterError("gamma", "number between 1.0 and 3.0", e);
|
|
1681
|
+
if (!n.defined(t)) this.options.gammaOut = this.options.gamma;
|
|
1682
|
+
else if (n.number(t) && n.inRange(t, 1, 3)) this.options.gammaOut = t;
|
|
1683
|
+
else throw n.invalidParameterError("gammaOut", "number between 1.0 and 3.0", t);
|
|
1684
|
+
return this;
|
|
1685
|
+
}
|
|
1686
|
+
function v(e) {
|
|
1687
|
+
if (this.options.negate = n.bool(e) ? e : !0, n.plainObject(e) && "alpha" in e) if (n.bool(e.alpha)) this.options.negateAlpha = e.alpha;
|
|
1688
|
+
else throw n.invalidParameterError("alpha", "should be boolean value", e.alpha);
|
|
1689
|
+
return this;
|
|
1690
|
+
}
|
|
1691
|
+
function y(e) {
|
|
1692
|
+
if (n.plainObject(e)) {
|
|
1693
|
+
if (n.defined(e.lower)) if (n.number(e.lower) && n.inRange(e.lower, 0, 99)) this.options.normaliseLower = e.lower;
|
|
1694
|
+
else throw n.invalidParameterError("lower", "number between 0 and 99", e.lower);
|
|
1695
|
+
if (n.defined(e.upper)) if (n.number(e.upper) && n.inRange(e.upper, 1, 100)) this.options.normaliseUpper = e.upper;
|
|
1696
|
+
else throw n.invalidParameterError("upper", "number between 1 and 100", e.upper);
|
|
1697
|
+
}
|
|
1698
|
+
if (this.options.normaliseLower >= this.options.normaliseUpper) throw n.invalidParameterError("range", "lower to be less than upper", `${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);
|
|
1699
|
+
return this.options.normalise = !0, this;
|
|
1700
|
+
}
|
|
1701
|
+
function b(e) {
|
|
1702
|
+
return this.normalise(e);
|
|
1703
|
+
}
|
|
1704
|
+
function x(e) {
|
|
1705
|
+
if (n.plainObject(e)) {
|
|
1706
|
+
if (n.integer(e.width) && e.width > 0) this.options.claheWidth = e.width;
|
|
1707
|
+
else throw n.invalidParameterError("width", "integer greater than zero", e.width);
|
|
1708
|
+
if (n.integer(e.height) && e.height > 0) this.options.claheHeight = e.height;
|
|
1709
|
+
else throw n.invalidParameterError("height", "integer greater than zero", e.height);
|
|
1710
|
+
if (n.defined(e.maxSlope)) if (n.integer(e.maxSlope) && n.inRange(e.maxSlope, 0, 100)) this.options.claheMaxSlope = e.maxSlope;
|
|
1711
|
+
else throw n.invalidParameterError("maxSlope", "integer between 0 and 100", e.maxSlope);
|
|
1712
|
+
} else throw n.invalidParameterError("options", "plain object", e);
|
|
1713
|
+
return this;
|
|
1714
|
+
}
|
|
1715
|
+
function S(e) {
|
|
1716
|
+
if (!n.object(e) || !Array.isArray(e.kernel) || !n.integer(e.width) || !n.integer(e.height) || !n.inRange(e.width, 3, 1001) || !n.inRange(e.height, 3, 1001) || e.height * e.width !== e.kernel.length) throw Error("Invalid convolution kernel");
|
|
1717
|
+
return n.integer(e.scale) || (e.scale = e.kernel.reduce((e, t) => e + t, 0)), e.scale < 1 && (e.scale = 1), n.integer(e.offset) || (e.offset = 0), this.options.convKernel = e, this;
|
|
1718
|
+
}
|
|
1719
|
+
function C(e, t) {
|
|
1720
|
+
if (!n.defined(e)) this.options.threshold = 128;
|
|
1721
|
+
else if (n.bool(e)) this.options.threshold = e ? 128 : 0;
|
|
1722
|
+
else if (n.integer(e) && n.inRange(e, 0, 255)) this.options.threshold = e;
|
|
1723
|
+
else throw n.invalidParameterError("threshold", "integer between 0 and 255", e);
|
|
1724
|
+
return !n.object(t) || t.greyscale === !0 || t.grayscale === !0 ? this.options.thresholdGrayscale = !0 : this.options.thresholdGrayscale = !1, this;
|
|
1725
|
+
}
|
|
1726
|
+
function w(e, t, r) {
|
|
1727
|
+
if (this.options.boolean = this._createInputDescriptor(e, r), n.string(t) && n.inArray(t, [
|
|
1728
|
+
"and",
|
|
1729
|
+
"or",
|
|
1730
|
+
"eor"
|
|
1731
|
+
])) this.options.booleanOp = t;
|
|
1732
|
+
else throw n.invalidParameterError("operator", "one of: and, or, eor", t);
|
|
1733
|
+
return this;
|
|
1734
|
+
}
|
|
1735
|
+
function T(e, t) {
|
|
1736
|
+
if (!n.defined(e) && n.number(t) ? e = 1 : n.number(e) && !n.defined(t) && (t = 0), !n.defined(e)) this.options.linearA = [];
|
|
1737
|
+
else if (n.number(e)) this.options.linearA = [e];
|
|
1738
|
+
else if (Array.isArray(e) && e.length && e.every(n.number)) this.options.linearA = e;
|
|
1739
|
+
else throw n.invalidParameterError("a", "number or array of numbers", e);
|
|
1740
|
+
if (!n.defined(t)) this.options.linearB = [];
|
|
1741
|
+
else if (n.number(t)) this.options.linearB = [t];
|
|
1742
|
+
else if (Array.isArray(t) && t.length && t.every(n.number)) this.options.linearB = t;
|
|
1743
|
+
else throw n.invalidParameterError("b", "number or array of numbers", t);
|
|
1744
|
+
if (this.options.linearA.length !== this.options.linearB.length) throw Error("Expected a and b to be arrays of the same length");
|
|
1745
|
+
return this;
|
|
1746
|
+
}
|
|
1747
|
+
function E(e) {
|
|
1748
|
+
if (!Array.isArray(e)) throw n.invalidParameterError("inputMatrix", "array", e);
|
|
1749
|
+
if (e.length !== 3 && e.length !== 4) throw n.invalidParameterError("inputMatrix", "3x3 or 4x4 array", e.length);
|
|
1750
|
+
let t = e.flat().map(Number);
|
|
1751
|
+
if (t.length !== 9 && t.length !== 16) throw n.invalidParameterError("inputMatrix", "cardinality of 9 or 16", t.length);
|
|
1752
|
+
return this.options.recombMatrix = t, this;
|
|
1753
|
+
}
|
|
1754
|
+
function D(e) {
|
|
1755
|
+
if (!n.plainObject(e)) throw n.invalidParameterError("options", "plain object", e);
|
|
1756
|
+
if ("brightness" in e) if (n.number(e.brightness) && e.brightness >= 0) this.options.brightness = e.brightness;
|
|
1757
|
+
else throw n.invalidParameterError("brightness", "number above zero", e.brightness);
|
|
1758
|
+
if ("saturation" in e) if (n.number(e.saturation) && e.saturation >= 0) this.options.saturation = e.saturation;
|
|
1759
|
+
else throw n.invalidParameterError("saturation", "number above zero", e.saturation);
|
|
1760
|
+
if ("hue" in e) if (n.integer(e.hue)) this.options.hue = e.hue % 360;
|
|
1761
|
+
else throw n.invalidParameterError("hue", "number", e.hue);
|
|
1762
|
+
if ("lightness" in e) if (n.number(e.lightness)) this.options.lightness = e.lightness;
|
|
1763
|
+
else throw n.invalidParameterError("lightness", "number", e.lightness);
|
|
1764
|
+
return this;
|
|
1765
|
+
}
|
|
1766
|
+
t.exports = (e) => {
|
|
1767
|
+
Object.assign(e.prototype, {
|
|
1768
|
+
autoOrient: a,
|
|
1769
|
+
rotate: i,
|
|
1770
|
+
flip: s,
|
|
1771
|
+
flop: c,
|
|
1772
|
+
affine: l,
|
|
1773
|
+
sharpen: u,
|
|
1774
|
+
erode: m,
|
|
1775
|
+
dilate: p,
|
|
1776
|
+
median: d,
|
|
1777
|
+
blur: f,
|
|
1778
|
+
flatten: h,
|
|
1779
|
+
unflatten: g,
|
|
1780
|
+
gamma: _,
|
|
1781
|
+
negate: v,
|
|
1782
|
+
normalise: y,
|
|
1783
|
+
normalize: b,
|
|
1784
|
+
clahe: x,
|
|
1785
|
+
convolve: S,
|
|
1786
|
+
threshold: C,
|
|
1787
|
+
boolean: w,
|
|
1788
|
+
linear: T,
|
|
1789
|
+
recomb: E,
|
|
1790
|
+
modulate: D
|
|
1791
|
+
});
|
|
1792
|
+
};
|
|
1793
|
+
})), se = /* @__PURE__ */ i(((e, t) => {
|
|
1794
|
+
var n = Object.defineProperty, r = Object.getOwnPropertyDescriptor, i = Object.getOwnPropertyNames, a = Object.prototype.hasOwnProperty, o = (e, t) => {
|
|
1795
|
+
for (var r in t) n(e, r, {
|
|
1796
|
+
get: t[r],
|
|
1797
|
+
enumerable: !0
|
|
1798
|
+
});
|
|
1799
|
+
}, s = (e, t, o, s) => {
|
|
1800
|
+
if (t && typeof t == "object" || typeof t == "function") for (let c of i(t)) !a.call(e, c) && c !== o && n(e, c, {
|
|
1801
|
+
get: () => t[c],
|
|
1802
|
+
enumerable: !(s = r(t, c)) || s.enumerable
|
|
1803
|
+
});
|
|
1804
|
+
return e;
|
|
1805
|
+
}, c = (e) => s(n({}, "__esModule", { value: !0 }), e), l = {};
|
|
1806
|
+
o(l, { default: () => G }), t.exports = c(l);
|
|
1807
|
+
var u = {
|
|
1808
|
+
aliceblue: [
|
|
1809
|
+
240,
|
|
1810
|
+
248,
|
|
1811
|
+
255
|
|
1812
|
+
],
|
|
1813
|
+
antiquewhite: [
|
|
1814
|
+
250,
|
|
1815
|
+
235,
|
|
1816
|
+
215
|
|
1817
|
+
],
|
|
1818
|
+
aqua: [
|
|
1819
|
+
0,
|
|
1820
|
+
255,
|
|
1821
|
+
255
|
|
1822
|
+
],
|
|
1823
|
+
aquamarine: [
|
|
1824
|
+
127,
|
|
1825
|
+
255,
|
|
1826
|
+
212
|
|
1827
|
+
],
|
|
1828
|
+
azure: [
|
|
1829
|
+
240,
|
|
1830
|
+
255,
|
|
1831
|
+
255
|
|
1832
|
+
],
|
|
1833
|
+
beige: [
|
|
1834
|
+
245,
|
|
1835
|
+
245,
|
|
1836
|
+
220
|
|
1837
|
+
],
|
|
1838
|
+
bisque: [
|
|
1839
|
+
255,
|
|
1840
|
+
228,
|
|
1841
|
+
196
|
|
1842
|
+
],
|
|
1843
|
+
black: [
|
|
1844
|
+
0,
|
|
1845
|
+
0,
|
|
1846
|
+
0
|
|
1847
|
+
],
|
|
1848
|
+
blanchedalmond: [
|
|
1849
|
+
255,
|
|
1850
|
+
235,
|
|
1851
|
+
205
|
|
1852
|
+
],
|
|
1853
|
+
blue: [
|
|
1854
|
+
0,
|
|
1855
|
+
0,
|
|
1856
|
+
255
|
|
1857
|
+
],
|
|
1858
|
+
blueviolet: [
|
|
1859
|
+
138,
|
|
1860
|
+
43,
|
|
1861
|
+
226
|
|
1862
|
+
],
|
|
1863
|
+
brown: [
|
|
1864
|
+
165,
|
|
1865
|
+
42,
|
|
1866
|
+
42
|
|
1867
|
+
],
|
|
1868
|
+
burlywood: [
|
|
1869
|
+
222,
|
|
1870
|
+
184,
|
|
1871
|
+
135
|
|
1872
|
+
],
|
|
1873
|
+
cadetblue: [
|
|
1874
|
+
95,
|
|
1875
|
+
158,
|
|
1876
|
+
160
|
|
1877
|
+
],
|
|
1878
|
+
chartreuse: [
|
|
1879
|
+
127,
|
|
1880
|
+
255,
|
|
1881
|
+
0
|
|
1882
|
+
],
|
|
1883
|
+
chocolate: [
|
|
1884
|
+
210,
|
|
1885
|
+
105,
|
|
1886
|
+
30
|
|
1887
|
+
],
|
|
1888
|
+
coral: [
|
|
1889
|
+
255,
|
|
1890
|
+
127,
|
|
1891
|
+
80
|
|
1892
|
+
],
|
|
1893
|
+
cornflowerblue: [
|
|
1894
|
+
100,
|
|
1895
|
+
149,
|
|
1896
|
+
237
|
|
1897
|
+
],
|
|
1898
|
+
cornsilk: [
|
|
1899
|
+
255,
|
|
1900
|
+
248,
|
|
1901
|
+
220
|
|
1902
|
+
],
|
|
1903
|
+
crimson: [
|
|
1904
|
+
220,
|
|
1905
|
+
20,
|
|
1906
|
+
60
|
|
1907
|
+
],
|
|
1908
|
+
cyan: [
|
|
1909
|
+
0,
|
|
1910
|
+
255,
|
|
1911
|
+
255
|
|
1912
|
+
],
|
|
1913
|
+
darkblue: [
|
|
1914
|
+
0,
|
|
1915
|
+
0,
|
|
1916
|
+
139
|
|
1917
|
+
],
|
|
1918
|
+
darkcyan: [
|
|
1919
|
+
0,
|
|
1920
|
+
139,
|
|
1921
|
+
139
|
|
1922
|
+
],
|
|
1923
|
+
darkgoldenrod: [
|
|
1924
|
+
184,
|
|
1925
|
+
134,
|
|
1926
|
+
11
|
|
1927
|
+
],
|
|
1928
|
+
darkgray: [
|
|
1929
|
+
169,
|
|
1930
|
+
169,
|
|
1931
|
+
169
|
|
1932
|
+
],
|
|
1933
|
+
darkgreen: [
|
|
1934
|
+
0,
|
|
1935
|
+
100,
|
|
1936
|
+
0
|
|
1937
|
+
],
|
|
1938
|
+
darkgrey: [
|
|
1939
|
+
169,
|
|
1940
|
+
169,
|
|
1941
|
+
169
|
|
1942
|
+
],
|
|
1943
|
+
darkkhaki: [
|
|
1944
|
+
189,
|
|
1945
|
+
183,
|
|
1946
|
+
107
|
|
1947
|
+
],
|
|
1948
|
+
darkmagenta: [
|
|
1949
|
+
139,
|
|
1950
|
+
0,
|
|
1951
|
+
139
|
|
1952
|
+
],
|
|
1953
|
+
darkolivegreen: [
|
|
1954
|
+
85,
|
|
1955
|
+
107,
|
|
1956
|
+
47
|
|
1957
|
+
],
|
|
1958
|
+
darkorange: [
|
|
1959
|
+
255,
|
|
1960
|
+
140,
|
|
1961
|
+
0
|
|
1962
|
+
],
|
|
1963
|
+
darkorchid: [
|
|
1964
|
+
153,
|
|
1965
|
+
50,
|
|
1966
|
+
204
|
|
1967
|
+
],
|
|
1968
|
+
darkred: [
|
|
1969
|
+
139,
|
|
1970
|
+
0,
|
|
1971
|
+
0
|
|
1972
|
+
],
|
|
1973
|
+
darksalmon: [
|
|
1974
|
+
233,
|
|
1975
|
+
150,
|
|
1976
|
+
122
|
|
1977
|
+
],
|
|
1978
|
+
darkseagreen: [
|
|
1979
|
+
143,
|
|
1980
|
+
188,
|
|
1981
|
+
143
|
|
1982
|
+
],
|
|
1983
|
+
darkslateblue: [
|
|
1984
|
+
72,
|
|
1985
|
+
61,
|
|
1986
|
+
139
|
|
1987
|
+
],
|
|
1988
|
+
darkslategray: [
|
|
1989
|
+
47,
|
|
1990
|
+
79,
|
|
1991
|
+
79
|
|
1992
|
+
],
|
|
1993
|
+
darkslategrey: [
|
|
1994
|
+
47,
|
|
1995
|
+
79,
|
|
1996
|
+
79
|
|
1997
|
+
],
|
|
1998
|
+
darkturquoise: [
|
|
1999
|
+
0,
|
|
2000
|
+
206,
|
|
2001
|
+
209
|
|
2002
|
+
],
|
|
2003
|
+
darkviolet: [
|
|
2004
|
+
148,
|
|
2005
|
+
0,
|
|
2006
|
+
211
|
|
2007
|
+
],
|
|
2008
|
+
deeppink: [
|
|
2009
|
+
255,
|
|
2010
|
+
20,
|
|
2011
|
+
147
|
|
2012
|
+
],
|
|
2013
|
+
deepskyblue: [
|
|
2014
|
+
0,
|
|
2015
|
+
191,
|
|
2016
|
+
255
|
|
2017
|
+
],
|
|
2018
|
+
dimgray: [
|
|
2019
|
+
105,
|
|
2020
|
+
105,
|
|
2021
|
+
105
|
|
2022
|
+
],
|
|
2023
|
+
dimgrey: [
|
|
2024
|
+
105,
|
|
2025
|
+
105,
|
|
2026
|
+
105
|
|
2027
|
+
],
|
|
2028
|
+
dodgerblue: [
|
|
2029
|
+
30,
|
|
2030
|
+
144,
|
|
2031
|
+
255
|
|
2032
|
+
],
|
|
2033
|
+
firebrick: [
|
|
2034
|
+
178,
|
|
2035
|
+
34,
|
|
2036
|
+
34
|
|
2037
|
+
],
|
|
2038
|
+
floralwhite: [
|
|
2039
|
+
255,
|
|
2040
|
+
250,
|
|
2041
|
+
240
|
|
2042
|
+
],
|
|
2043
|
+
forestgreen: [
|
|
2044
|
+
34,
|
|
2045
|
+
139,
|
|
2046
|
+
34
|
|
2047
|
+
],
|
|
2048
|
+
fuchsia: [
|
|
2049
|
+
255,
|
|
2050
|
+
0,
|
|
2051
|
+
255
|
|
2052
|
+
],
|
|
2053
|
+
gainsboro: [
|
|
2054
|
+
220,
|
|
2055
|
+
220,
|
|
2056
|
+
220
|
|
2057
|
+
],
|
|
2058
|
+
ghostwhite: [
|
|
2059
|
+
248,
|
|
2060
|
+
248,
|
|
2061
|
+
255
|
|
2062
|
+
],
|
|
2063
|
+
gold: [
|
|
2064
|
+
255,
|
|
2065
|
+
215,
|
|
2066
|
+
0
|
|
2067
|
+
],
|
|
2068
|
+
goldenrod: [
|
|
2069
|
+
218,
|
|
2070
|
+
165,
|
|
2071
|
+
32
|
|
2072
|
+
],
|
|
2073
|
+
gray: [
|
|
2074
|
+
128,
|
|
2075
|
+
128,
|
|
2076
|
+
128
|
|
2077
|
+
],
|
|
2078
|
+
green: [
|
|
2079
|
+
0,
|
|
2080
|
+
128,
|
|
2081
|
+
0
|
|
2082
|
+
],
|
|
2083
|
+
greenyellow: [
|
|
2084
|
+
173,
|
|
2085
|
+
255,
|
|
2086
|
+
47
|
|
2087
|
+
],
|
|
2088
|
+
grey: [
|
|
2089
|
+
128,
|
|
2090
|
+
128,
|
|
2091
|
+
128
|
|
2092
|
+
],
|
|
2093
|
+
honeydew: [
|
|
2094
|
+
240,
|
|
2095
|
+
255,
|
|
2096
|
+
240
|
|
2097
|
+
],
|
|
2098
|
+
hotpink: [
|
|
2099
|
+
255,
|
|
2100
|
+
105,
|
|
2101
|
+
180
|
|
2102
|
+
],
|
|
2103
|
+
indianred: [
|
|
2104
|
+
205,
|
|
2105
|
+
92,
|
|
2106
|
+
92
|
|
2107
|
+
],
|
|
2108
|
+
indigo: [
|
|
2109
|
+
75,
|
|
2110
|
+
0,
|
|
2111
|
+
130
|
|
2112
|
+
],
|
|
2113
|
+
ivory: [
|
|
2114
|
+
255,
|
|
2115
|
+
255,
|
|
2116
|
+
240
|
|
2117
|
+
],
|
|
2118
|
+
khaki: [
|
|
2119
|
+
240,
|
|
2120
|
+
230,
|
|
2121
|
+
140
|
|
2122
|
+
],
|
|
2123
|
+
lavender: [
|
|
2124
|
+
230,
|
|
2125
|
+
230,
|
|
2126
|
+
250
|
|
2127
|
+
],
|
|
2128
|
+
lavenderblush: [
|
|
2129
|
+
255,
|
|
2130
|
+
240,
|
|
2131
|
+
245
|
|
2132
|
+
],
|
|
2133
|
+
lawngreen: [
|
|
2134
|
+
124,
|
|
2135
|
+
252,
|
|
2136
|
+
0
|
|
2137
|
+
],
|
|
2138
|
+
lemonchiffon: [
|
|
2139
|
+
255,
|
|
2140
|
+
250,
|
|
2141
|
+
205
|
|
2142
|
+
],
|
|
2143
|
+
lightblue: [
|
|
2144
|
+
173,
|
|
2145
|
+
216,
|
|
2146
|
+
230
|
|
2147
|
+
],
|
|
2148
|
+
lightcoral: [
|
|
2149
|
+
240,
|
|
2150
|
+
128,
|
|
2151
|
+
128
|
|
2152
|
+
],
|
|
2153
|
+
lightcyan: [
|
|
2154
|
+
224,
|
|
2155
|
+
255,
|
|
2156
|
+
255
|
|
2157
|
+
],
|
|
2158
|
+
lightgoldenrodyellow: [
|
|
2159
|
+
250,
|
|
2160
|
+
250,
|
|
2161
|
+
210
|
|
2162
|
+
],
|
|
2163
|
+
lightgray: [
|
|
2164
|
+
211,
|
|
2165
|
+
211,
|
|
2166
|
+
211
|
|
2167
|
+
],
|
|
2168
|
+
lightgreen: [
|
|
2169
|
+
144,
|
|
2170
|
+
238,
|
|
2171
|
+
144
|
|
2172
|
+
],
|
|
2173
|
+
lightgrey: [
|
|
2174
|
+
211,
|
|
2175
|
+
211,
|
|
2176
|
+
211
|
|
2177
|
+
],
|
|
2178
|
+
lightpink: [
|
|
2179
|
+
255,
|
|
2180
|
+
182,
|
|
2181
|
+
193
|
|
2182
|
+
],
|
|
2183
|
+
lightsalmon: [
|
|
2184
|
+
255,
|
|
2185
|
+
160,
|
|
2186
|
+
122
|
|
2187
|
+
],
|
|
2188
|
+
lightseagreen: [
|
|
2189
|
+
32,
|
|
2190
|
+
178,
|
|
2191
|
+
170
|
|
2192
|
+
],
|
|
2193
|
+
lightskyblue: [
|
|
2194
|
+
135,
|
|
2195
|
+
206,
|
|
2196
|
+
250
|
|
2197
|
+
],
|
|
2198
|
+
lightslategray: [
|
|
2199
|
+
119,
|
|
2200
|
+
136,
|
|
2201
|
+
153
|
|
2202
|
+
],
|
|
2203
|
+
lightslategrey: [
|
|
2204
|
+
119,
|
|
2205
|
+
136,
|
|
2206
|
+
153
|
|
2207
|
+
],
|
|
2208
|
+
lightsteelblue: [
|
|
2209
|
+
176,
|
|
2210
|
+
196,
|
|
2211
|
+
222
|
|
2212
|
+
],
|
|
2213
|
+
lightyellow: [
|
|
2214
|
+
255,
|
|
2215
|
+
255,
|
|
2216
|
+
224
|
|
2217
|
+
],
|
|
2218
|
+
lime: [
|
|
2219
|
+
0,
|
|
2220
|
+
255,
|
|
2221
|
+
0
|
|
2222
|
+
],
|
|
2223
|
+
limegreen: [
|
|
2224
|
+
50,
|
|
2225
|
+
205,
|
|
2226
|
+
50
|
|
2227
|
+
],
|
|
2228
|
+
linen: [
|
|
2229
|
+
250,
|
|
2230
|
+
240,
|
|
2231
|
+
230
|
|
2232
|
+
],
|
|
2233
|
+
magenta: [
|
|
2234
|
+
255,
|
|
2235
|
+
0,
|
|
2236
|
+
255
|
|
2237
|
+
],
|
|
2238
|
+
maroon: [
|
|
2239
|
+
128,
|
|
2240
|
+
0,
|
|
2241
|
+
0
|
|
2242
|
+
],
|
|
2243
|
+
mediumaquamarine: [
|
|
2244
|
+
102,
|
|
2245
|
+
205,
|
|
2246
|
+
170
|
|
2247
|
+
],
|
|
2248
|
+
mediumblue: [
|
|
2249
|
+
0,
|
|
2250
|
+
0,
|
|
2251
|
+
205
|
|
2252
|
+
],
|
|
2253
|
+
mediumorchid: [
|
|
2254
|
+
186,
|
|
2255
|
+
85,
|
|
2256
|
+
211
|
|
2257
|
+
],
|
|
2258
|
+
mediumpurple: [
|
|
2259
|
+
147,
|
|
2260
|
+
112,
|
|
2261
|
+
219
|
|
2262
|
+
],
|
|
2263
|
+
mediumseagreen: [
|
|
2264
|
+
60,
|
|
2265
|
+
179,
|
|
2266
|
+
113
|
|
2267
|
+
],
|
|
2268
|
+
mediumslateblue: [
|
|
2269
|
+
123,
|
|
2270
|
+
104,
|
|
2271
|
+
238
|
|
2272
|
+
],
|
|
2273
|
+
mediumspringgreen: [
|
|
2274
|
+
0,
|
|
2275
|
+
250,
|
|
2276
|
+
154
|
|
2277
|
+
],
|
|
2278
|
+
mediumturquoise: [
|
|
2279
|
+
72,
|
|
2280
|
+
209,
|
|
2281
|
+
204
|
|
2282
|
+
],
|
|
2283
|
+
mediumvioletred: [
|
|
2284
|
+
199,
|
|
2285
|
+
21,
|
|
2286
|
+
133
|
|
2287
|
+
],
|
|
2288
|
+
midnightblue: [
|
|
2289
|
+
25,
|
|
2290
|
+
25,
|
|
2291
|
+
112
|
|
2292
|
+
],
|
|
2293
|
+
mintcream: [
|
|
2294
|
+
245,
|
|
2295
|
+
255,
|
|
2296
|
+
250
|
|
2297
|
+
],
|
|
2298
|
+
mistyrose: [
|
|
2299
|
+
255,
|
|
2300
|
+
228,
|
|
2301
|
+
225
|
|
2302
|
+
],
|
|
2303
|
+
moccasin: [
|
|
2304
|
+
255,
|
|
2305
|
+
228,
|
|
2306
|
+
181
|
|
2307
|
+
],
|
|
2308
|
+
navajowhite: [
|
|
2309
|
+
255,
|
|
2310
|
+
222,
|
|
2311
|
+
173
|
|
2312
|
+
],
|
|
2313
|
+
navy: [
|
|
2314
|
+
0,
|
|
2315
|
+
0,
|
|
2316
|
+
128
|
|
2317
|
+
],
|
|
2318
|
+
oldlace: [
|
|
2319
|
+
253,
|
|
2320
|
+
245,
|
|
2321
|
+
230
|
|
2322
|
+
],
|
|
2323
|
+
olive: [
|
|
2324
|
+
128,
|
|
2325
|
+
128,
|
|
2326
|
+
0
|
|
2327
|
+
],
|
|
2328
|
+
olivedrab: [
|
|
2329
|
+
107,
|
|
2330
|
+
142,
|
|
2331
|
+
35
|
|
2332
|
+
],
|
|
2333
|
+
orange: [
|
|
2334
|
+
255,
|
|
2335
|
+
165,
|
|
2336
|
+
0
|
|
2337
|
+
],
|
|
2338
|
+
orangered: [
|
|
2339
|
+
255,
|
|
2340
|
+
69,
|
|
2341
|
+
0
|
|
2342
|
+
],
|
|
2343
|
+
orchid: [
|
|
2344
|
+
218,
|
|
2345
|
+
112,
|
|
2346
|
+
214
|
|
2347
|
+
],
|
|
2348
|
+
palegoldenrod: [
|
|
2349
|
+
238,
|
|
2350
|
+
232,
|
|
2351
|
+
170
|
|
2352
|
+
],
|
|
2353
|
+
palegreen: [
|
|
2354
|
+
152,
|
|
2355
|
+
251,
|
|
2356
|
+
152
|
|
2357
|
+
],
|
|
2358
|
+
paleturquoise: [
|
|
2359
|
+
175,
|
|
2360
|
+
238,
|
|
2361
|
+
238
|
|
2362
|
+
],
|
|
2363
|
+
palevioletred: [
|
|
2364
|
+
219,
|
|
2365
|
+
112,
|
|
2366
|
+
147
|
|
2367
|
+
],
|
|
2368
|
+
papayawhip: [
|
|
2369
|
+
255,
|
|
2370
|
+
239,
|
|
2371
|
+
213
|
|
2372
|
+
],
|
|
2373
|
+
peachpuff: [
|
|
2374
|
+
255,
|
|
2375
|
+
218,
|
|
2376
|
+
185
|
|
2377
|
+
],
|
|
2378
|
+
peru: [
|
|
2379
|
+
205,
|
|
2380
|
+
133,
|
|
2381
|
+
63
|
|
2382
|
+
],
|
|
2383
|
+
pink: [
|
|
2384
|
+
255,
|
|
2385
|
+
192,
|
|
2386
|
+
203
|
|
2387
|
+
],
|
|
2388
|
+
plum: [
|
|
2389
|
+
221,
|
|
2390
|
+
160,
|
|
2391
|
+
221
|
|
2392
|
+
],
|
|
2393
|
+
powderblue: [
|
|
2394
|
+
176,
|
|
2395
|
+
224,
|
|
2396
|
+
230
|
|
2397
|
+
],
|
|
2398
|
+
purple: [
|
|
2399
|
+
128,
|
|
2400
|
+
0,
|
|
2401
|
+
128
|
|
2402
|
+
],
|
|
2403
|
+
rebeccapurple: [
|
|
2404
|
+
102,
|
|
2405
|
+
51,
|
|
2406
|
+
153
|
|
2407
|
+
],
|
|
2408
|
+
red: [
|
|
2409
|
+
255,
|
|
2410
|
+
0,
|
|
2411
|
+
0
|
|
2412
|
+
],
|
|
2413
|
+
rosybrown: [
|
|
2414
|
+
188,
|
|
2415
|
+
143,
|
|
2416
|
+
143
|
|
2417
|
+
],
|
|
2418
|
+
royalblue: [
|
|
2419
|
+
65,
|
|
2420
|
+
105,
|
|
2421
|
+
225
|
|
2422
|
+
],
|
|
2423
|
+
saddlebrown: [
|
|
2424
|
+
139,
|
|
2425
|
+
69,
|
|
2426
|
+
19
|
|
2427
|
+
],
|
|
2428
|
+
salmon: [
|
|
2429
|
+
250,
|
|
2430
|
+
128,
|
|
2431
|
+
114
|
|
2432
|
+
],
|
|
2433
|
+
sandybrown: [
|
|
2434
|
+
244,
|
|
2435
|
+
164,
|
|
2436
|
+
96
|
|
2437
|
+
],
|
|
2438
|
+
seagreen: [
|
|
2439
|
+
46,
|
|
2440
|
+
139,
|
|
2441
|
+
87
|
|
2442
|
+
],
|
|
2443
|
+
seashell: [
|
|
2444
|
+
255,
|
|
2445
|
+
245,
|
|
2446
|
+
238
|
|
2447
|
+
],
|
|
2448
|
+
sienna: [
|
|
2449
|
+
160,
|
|
2450
|
+
82,
|
|
2451
|
+
45
|
|
2452
|
+
],
|
|
2453
|
+
silver: [
|
|
2454
|
+
192,
|
|
2455
|
+
192,
|
|
2456
|
+
192
|
|
2457
|
+
],
|
|
2458
|
+
skyblue: [
|
|
2459
|
+
135,
|
|
2460
|
+
206,
|
|
2461
|
+
235
|
|
2462
|
+
],
|
|
2463
|
+
slateblue: [
|
|
2464
|
+
106,
|
|
2465
|
+
90,
|
|
2466
|
+
205
|
|
2467
|
+
],
|
|
2468
|
+
slategray: [
|
|
2469
|
+
112,
|
|
2470
|
+
128,
|
|
2471
|
+
144
|
|
2472
|
+
],
|
|
2473
|
+
slategrey: [
|
|
2474
|
+
112,
|
|
2475
|
+
128,
|
|
2476
|
+
144
|
|
2477
|
+
],
|
|
2478
|
+
snow: [
|
|
2479
|
+
255,
|
|
2480
|
+
250,
|
|
2481
|
+
250
|
|
2482
|
+
],
|
|
2483
|
+
springgreen: [
|
|
2484
|
+
0,
|
|
2485
|
+
255,
|
|
2486
|
+
127
|
|
2487
|
+
],
|
|
2488
|
+
steelblue: [
|
|
2489
|
+
70,
|
|
2490
|
+
130,
|
|
2491
|
+
180
|
|
2492
|
+
],
|
|
2493
|
+
tan: [
|
|
2494
|
+
210,
|
|
2495
|
+
180,
|
|
2496
|
+
140
|
|
2497
|
+
],
|
|
2498
|
+
teal: [
|
|
2499
|
+
0,
|
|
2500
|
+
128,
|
|
2501
|
+
128
|
|
2502
|
+
],
|
|
2503
|
+
thistle: [
|
|
2504
|
+
216,
|
|
2505
|
+
191,
|
|
2506
|
+
216
|
|
2507
|
+
],
|
|
2508
|
+
tomato: [
|
|
2509
|
+
255,
|
|
2510
|
+
99,
|
|
2511
|
+
71
|
|
2512
|
+
],
|
|
2513
|
+
turquoise: [
|
|
2514
|
+
64,
|
|
2515
|
+
224,
|
|
2516
|
+
208
|
|
2517
|
+
],
|
|
2518
|
+
violet: [
|
|
2519
|
+
238,
|
|
2520
|
+
130,
|
|
2521
|
+
238
|
|
2522
|
+
],
|
|
2523
|
+
wheat: [
|
|
2524
|
+
245,
|
|
2525
|
+
222,
|
|
2526
|
+
179
|
|
2527
|
+
],
|
|
2528
|
+
white: [
|
|
2529
|
+
255,
|
|
2530
|
+
255,
|
|
2531
|
+
255
|
|
2532
|
+
],
|
|
2533
|
+
whitesmoke: [
|
|
2534
|
+
245,
|
|
2535
|
+
245,
|
|
2536
|
+
245
|
|
2537
|
+
],
|
|
2538
|
+
yellow: [
|
|
2539
|
+
255,
|
|
2540
|
+
255,
|
|
2541
|
+
0
|
|
2542
|
+
],
|
|
2543
|
+
yellowgreen: [
|
|
2544
|
+
154,
|
|
2545
|
+
205,
|
|
2546
|
+
50
|
|
2547
|
+
]
|
|
2548
|
+
};
|
|
2549
|
+
for (let e in u) Object.freeze(u[e]);
|
|
2550
|
+
var d = Object.freeze(u), f = /* @__PURE__ */ Object.create(null);
|
|
2551
|
+
for (let e in d) Object.hasOwn(d, e) && (f[d[e]] = e);
|
|
2552
|
+
var p = {
|
|
2553
|
+
to: {},
|
|
2554
|
+
get: {}
|
|
2555
|
+
};
|
|
2556
|
+
p.get = function(e) {
|
|
2557
|
+
let t = e.slice(0, 3).toLowerCase(), n, r;
|
|
2558
|
+
switch (t) {
|
|
2559
|
+
case "hsl":
|
|
2560
|
+
n = p.get.hsl(e), r = "hsl";
|
|
2561
|
+
break;
|
|
2562
|
+
case "hwb":
|
|
2563
|
+
n = p.get.hwb(e), r = "hwb";
|
|
2564
|
+
break;
|
|
2565
|
+
default:
|
|
2566
|
+
n = p.get.rgb(e), r = "rgb";
|
|
2567
|
+
break;
|
|
2568
|
+
}
|
|
2569
|
+
return n ? {
|
|
2570
|
+
model: r,
|
|
2571
|
+
value: n
|
|
2572
|
+
} : null;
|
|
2573
|
+
}, p.get.rgb = function(e) {
|
|
2574
|
+
if (!e) return null;
|
|
2575
|
+
let t = /^#([a-f\d]{3,4})$/i, n = /^#([a-f\d]{6})([a-f\d]{2})?$/i, r = /^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i, i = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i, a = /^(\w+)$/, o = [
|
|
2576
|
+
0,
|
|
2577
|
+
0,
|
|
2578
|
+
0,
|
|
2579
|
+
1
|
|
2580
|
+
], s, c, l;
|
|
2581
|
+
if (s = e.match(n)) {
|
|
2582
|
+
for (l = s[2], s = s[1], c = 0; c < 3; c++) {
|
|
2583
|
+
let e = c * 2;
|
|
2584
|
+
o[c] = Number.parseInt(s.slice(e, e + 2), 16);
|
|
2585
|
+
}
|
|
2586
|
+
l && (o[3] = Number.parseInt(l, 16) / 255);
|
|
2587
|
+
} else if (s = e.match(t)) {
|
|
2588
|
+
for (s = s[1], l = s[3], c = 0; c < 3; c++) o[c] = Number.parseInt(s[c] + s[c], 16);
|
|
2589
|
+
l && (o[3] = Number.parseInt(l + l, 16) / 255);
|
|
2590
|
+
} else if (s = e.match(r)) {
|
|
2591
|
+
for (c = 0; c < 3; c++) o[c] = Number.parseFloat(s[c + 1]);
|
|
2592
|
+
s[4] && (o[3] = s[5] ? Number.parseFloat(s[4]) * .01 : Number.parseFloat(s[4]));
|
|
2593
|
+
} else if (s = e.match(i)) {
|
|
2594
|
+
for (c = 0; c < 3; c++) o[c] = Math.round(Number.parseFloat(s[c + 1]) * 2.55);
|
|
2595
|
+
s[4] && (o[3] = s[5] ? Number.parseFloat(s[4]) * .01 : Number.parseFloat(s[4]));
|
|
2596
|
+
} else if (s = e.toLowerCase().match(a)) return s[1] === "transparent" ? [
|
|
2597
|
+
0,
|
|
2598
|
+
0,
|
|
2599
|
+
0,
|
|
2600
|
+
0
|
|
2601
|
+
] : Object.hasOwn(d, s[1]) ? (o = d[s[1]].slice(), o[3] = 1, o) : null;
|
|
2602
|
+
else return null;
|
|
2603
|
+
for (c = 0; c < 3; c++) o[c] = m(o[c], 0, 255);
|
|
2604
|
+
return o[3] = m(o[3], 0, 1), o;
|
|
2605
|
+
}, p.get.hsl = function(e) {
|
|
2606
|
+
if (!e) return null;
|
|
2607
|
+
let t = e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);
|
|
2608
|
+
if (t) {
|
|
2609
|
+
let e = Number.parseFloat(t[4]);
|
|
2610
|
+
return [
|
|
2611
|
+
(Number.parseFloat(t[1]) % 360 + 360) % 360,
|
|
2612
|
+
m(Number.parseFloat(t[2]), 0, 100),
|
|
2613
|
+
m(Number.parseFloat(t[3]), 0, 100),
|
|
2614
|
+
m(Number.isNaN(e) ? 1 : e, 0, 1)
|
|
2615
|
+
];
|
|
2616
|
+
}
|
|
2617
|
+
return null;
|
|
2618
|
+
}, p.get.hwb = function(e) {
|
|
2619
|
+
if (!e) return null;
|
|
2620
|
+
let t = e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);
|
|
2621
|
+
if (t) {
|
|
2622
|
+
let e = Number.parseFloat(t[4]);
|
|
2623
|
+
return [
|
|
2624
|
+
(Number.parseFloat(t[1]) % 360 + 360) % 360,
|
|
2625
|
+
m(Number.parseFloat(t[2]), 0, 100),
|
|
2626
|
+
m(Number.parseFloat(t[3]), 0, 100),
|
|
2627
|
+
m(Number.isNaN(e) ? 1 : e, 0, 1)
|
|
2628
|
+
];
|
|
2629
|
+
}
|
|
2630
|
+
return null;
|
|
2631
|
+
}, p.to.hex = function(...e) {
|
|
2632
|
+
return "#" + h(e[0]) + h(e[1]) + h(e[2]) + (e[3] < 1 ? h(Math.round(e[3] * 255)) : "");
|
|
2633
|
+
}, p.to.rgb = function(...e) {
|
|
2634
|
+
return e.length < 4 || e[3] === 1 ? "rgb(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ")" : "rgba(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ", " + e[3] + ")";
|
|
2635
|
+
}, p.to.rgb.percent = function(...e) {
|
|
2636
|
+
let t = Math.round(e[0] / 255 * 100), n = Math.round(e[1] / 255 * 100), r = Math.round(e[2] / 255 * 100);
|
|
2637
|
+
return e.length < 4 || e[3] === 1 ? "rgb(" + t + "%, " + n + "%, " + r + "%)" : "rgba(" + t + "%, " + n + "%, " + r + "%, " + e[3] + ")";
|
|
2638
|
+
}, p.to.hsl = function(...e) {
|
|
2639
|
+
return e.length < 4 || e[3] === 1 ? "hsl(" + e[0] + ", " + e[1] + "%, " + e[2] + "%)" : "hsla(" + e[0] + ", " + e[1] + "%, " + e[2] + "%, " + e[3] + ")";
|
|
2640
|
+
}, p.to.hwb = function(...e) {
|
|
2641
|
+
let t = "";
|
|
2642
|
+
return e.length >= 4 && e[3] !== 1 && (t = ", " + e[3]), "hwb(" + e[0] + ", " + e[1] + "%, " + e[2] + "%" + t + ")";
|
|
2643
|
+
}, p.to.keyword = function(...e) {
|
|
2644
|
+
return f[e.slice(0, 3)];
|
|
2645
|
+
};
|
|
2646
|
+
function m(e, t, n) {
|
|
2647
|
+
return Math.min(Math.max(t, e), n);
|
|
2648
|
+
}
|
|
2649
|
+
function h(e) {
|
|
2650
|
+
let t = Math.round(e).toString(16).toUpperCase();
|
|
2651
|
+
return t.length < 2 ? "0" + t : t;
|
|
2652
|
+
}
|
|
2653
|
+
var g = p, _ = {};
|
|
2654
|
+
for (let e of Object.keys(d)) _[d[e]] = e;
|
|
2655
|
+
var v = {
|
|
2656
|
+
rgb: {
|
|
2657
|
+
channels: 3,
|
|
2658
|
+
labels: "rgb"
|
|
2659
|
+
},
|
|
2660
|
+
hsl: {
|
|
2661
|
+
channels: 3,
|
|
2662
|
+
labels: "hsl"
|
|
2663
|
+
},
|
|
2664
|
+
hsv: {
|
|
2665
|
+
channels: 3,
|
|
2666
|
+
labels: "hsv"
|
|
2667
|
+
},
|
|
2668
|
+
hwb: {
|
|
2669
|
+
channels: 3,
|
|
2670
|
+
labels: "hwb"
|
|
2671
|
+
},
|
|
2672
|
+
cmyk: {
|
|
2673
|
+
channels: 4,
|
|
2674
|
+
labels: "cmyk"
|
|
2675
|
+
},
|
|
2676
|
+
xyz: {
|
|
2677
|
+
channels: 3,
|
|
2678
|
+
labels: "xyz"
|
|
2679
|
+
},
|
|
2680
|
+
lab: {
|
|
2681
|
+
channels: 3,
|
|
2682
|
+
labels: "lab"
|
|
2683
|
+
},
|
|
2684
|
+
oklab: {
|
|
2685
|
+
channels: 3,
|
|
2686
|
+
labels: [
|
|
2687
|
+
"okl",
|
|
2688
|
+
"oka",
|
|
2689
|
+
"okb"
|
|
2690
|
+
]
|
|
2691
|
+
},
|
|
2692
|
+
lch: {
|
|
2693
|
+
channels: 3,
|
|
2694
|
+
labels: "lch"
|
|
2695
|
+
},
|
|
2696
|
+
oklch: {
|
|
2697
|
+
channels: 3,
|
|
2698
|
+
labels: [
|
|
2699
|
+
"okl",
|
|
2700
|
+
"okc",
|
|
2701
|
+
"okh"
|
|
2702
|
+
]
|
|
2703
|
+
},
|
|
2704
|
+
hex: {
|
|
2705
|
+
channels: 1,
|
|
2706
|
+
labels: ["hex"]
|
|
2707
|
+
},
|
|
2708
|
+
keyword: {
|
|
2709
|
+
channels: 1,
|
|
2710
|
+
labels: ["keyword"]
|
|
2711
|
+
},
|
|
2712
|
+
ansi16: {
|
|
2713
|
+
channels: 1,
|
|
2714
|
+
labels: ["ansi16"]
|
|
2715
|
+
},
|
|
2716
|
+
ansi256: {
|
|
2717
|
+
channels: 1,
|
|
2718
|
+
labels: ["ansi256"]
|
|
2719
|
+
},
|
|
2720
|
+
hcg: {
|
|
2721
|
+
channels: 3,
|
|
2722
|
+
labels: [
|
|
2723
|
+
"h",
|
|
2724
|
+
"c",
|
|
2725
|
+
"g"
|
|
2726
|
+
]
|
|
2727
|
+
},
|
|
2728
|
+
apple: {
|
|
2729
|
+
channels: 3,
|
|
2730
|
+
labels: [
|
|
2731
|
+
"r16",
|
|
2732
|
+
"g16",
|
|
2733
|
+
"b16"
|
|
2734
|
+
]
|
|
2735
|
+
},
|
|
2736
|
+
gray: {
|
|
2737
|
+
channels: 1,
|
|
2738
|
+
labels: ["gray"]
|
|
2739
|
+
}
|
|
2740
|
+
}, y = v, b = (6 / 29) ** 3;
|
|
2741
|
+
function x(e) {
|
|
2742
|
+
let t = e > .0031308 ? 1.055 * e ** (1 / 2.4) - .055 : e * 12.92;
|
|
2743
|
+
return Math.min(Math.max(0, t), 1);
|
|
2744
|
+
}
|
|
2745
|
+
function S(e) {
|
|
2746
|
+
return e > .04045 ? ((e + .055) / 1.055) ** 2.4 : e / 12.92;
|
|
2747
|
+
}
|
|
2748
|
+
for (let e of Object.keys(v)) {
|
|
2749
|
+
if (!("channels" in v[e])) throw Error("missing channels property: " + e);
|
|
2750
|
+
if (!("labels" in v[e])) throw Error("missing channel labels property: " + e);
|
|
2751
|
+
if (v[e].labels.length !== v[e].channels) throw Error("channel and label counts mismatch: " + e);
|
|
2752
|
+
let { channels: t, labels: n } = v[e];
|
|
2753
|
+
delete v[e].channels, delete v[e].labels, Object.defineProperty(v[e], "channels", { value: t }), Object.defineProperty(v[e], "labels", { value: n });
|
|
2754
|
+
}
|
|
2755
|
+
v.rgb.hsl = function(e) {
|
|
2756
|
+
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.min(t, n, r), a = Math.max(t, n, r), o = a - i, s, c;
|
|
2757
|
+
switch (a) {
|
|
2758
|
+
case i:
|
|
2759
|
+
s = 0;
|
|
2760
|
+
break;
|
|
2761
|
+
case t:
|
|
2762
|
+
s = (n - r) / o;
|
|
2763
|
+
break;
|
|
2764
|
+
case n:
|
|
2765
|
+
s = 2 + (r - t) / o;
|
|
2766
|
+
break;
|
|
2767
|
+
case r:
|
|
2768
|
+
s = 4 + (t - n) / o;
|
|
2769
|
+
break;
|
|
2770
|
+
}
|
|
2771
|
+
s = Math.min(s * 60, 360), s < 0 && (s += 360);
|
|
2772
|
+
let l = (i + a) / 2;
|
|
2773
|
+
return c = a === i ? 0 : l <= .5 ? o / (a + i) : o / (2 - a - i), [
|
|
2774
|
+
s,
|
|
2775
|
+
c * 100,
|
|
2776
|
+
l * 100
|
|
2777
|
+
];
|
|
2778
|
+
}, v.rgb.hsv = function(e) {
|
|
2779
|
+
let t, n, r, i, a, o = e[0] / 255, s = e[1] / 255, c = e[2] / 255, l = Math.max(o, s, c), u = l - Math.min(o, s, c), d = function(e) {
|
|
2780
|
+
return (l - e) / 6 / u + 1 / 2;
|
|
2781
|
+
};
|
|
2782
|
+
if (u === 0) i = 0, a = 0;
|
|
2783
|
+
else {
|
|
2784
|
+
switch (a = u / l, t = d(o), n = d(s), r = d(c), l) {
|
|
2785
|
+
case o:
|
|
2786
|
+
i = r - n;
|
|
2787
|
+
break;
|
|
2788
|
+
case s:
|
|
2789
|
+
i = 1 / 3 + t - r;
|
|
2790
|
+
break;
|
|
2791
|
+
case c:
|
|
2792
|
+
i = 2 / 3 + n - t;
|
|
2793
|
+
break;
|
|
2794
|
+
}
|
|
2795
|
+
i < 0 ? i += 1 : i > 1 && --i;
|
|
2796
|
+
}
|
|
2797
|
+
return [
|
|
2798
|
+
i * 360,
|
|
2799
|
+
a * 100,
|
|
2800
|
+
l * 100
|
|
2801
|
+
];
|
|
2802
|
+
}, v.rgb.hwb = function(e) {
|
|
2803
|
+
let t = e[0], n = e[1], r = e[2], i = v.rgb.hsl(e)[0], a = 1 / 255 * Math.min(t, Math.min(n, r));
|
|
2804
|
+
return r = 1 - 1 / 255 * Math.max(t, Math.max(n, r)), [
|
|
2805
|
+
i,
|
|
2806
|
+
a * 100,
|
|
2807
|
+
r * 100
|
|
2808
|
+
];
|
|
2809
|
+
}, v.rgb.oklab = function(e) {
|
|
2810
|
+
let t = S(e[0] / 255), n = S(e[1] / 255), r = S(e[2] / 255), i = Math.cbrt(.4122214708 * t + .5363325363 * n + .0514459929 * r), a = Math.cbrt(.2119034982 * t + .6806995451 * n + .1073969566 * r), o = Math.cbrt(.0883024619 * t + .2817188376 * n + .6299787005 * r), s = .2104542553 * i + .793617785 * a - .0040720468 * o, c = 1.9779984951 * i - 2.428592205 * a + .4505937099 * o, l = .0259040371 * i + .7827717662 * a - .808675766 * o;
|
|
2811
|
+
return [
|
|
2812
|
+
s * 100,
|
|
2813
|
+
c * 100,
|
|
2814
|
+
l * 100
|
|
2815
|
+
];
|
|
2816
|
+
}, v.rgb.cmyk = function(e) {
|
|
2817
|
+
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.min(1 - t, 1 - n, 1 - r), a = (1 - t - i) / (1 - i) || 0, o = (1 - n - i) / (1 - i) || 0, s = (1 - r - i) / (1 - i) || 0;
|
|
2818
|
+
return [
|
|
2819
|
+
a * 100,
|
|
2820
|
+
o * 100,
|
|
2821
|
+
s * 100,
|
|
2822
|
+
i * 100
|
|
2823
|
+
];
|
|
2824
|
+
};
|
|
2825
|
+
function C(e, t) {
|
|
2826
|
+
return (e[0] - t[0]) ** 2 + (e[1] - t[1]) ** 2 + (e[2] - t[2]) ** 2;
|
|
2827
|
+
}
|
|
2828
|
+
v.rgb.keyword = function(e) {
|
|
2829
|
+
let t = _[e];
|
|
2830
|
+
if (t) return t;
|
|
2831
|
+
let n = Infinity, r;
|
|
2832
|
+
for (let t of Object.keys(d)) {
|
|
2833
|
+
let i = d[t], a = C(e, i);
|
|
2834
|
+
a < n && (n = a, r = t);
|
|
2835
|
+
}
|
|
2836
|
+
return r;
|
|
2837
|
+
}, v.keyword.rgb = function(e) {
|
|
2838
|
+
return [...d[e]];
|
|
2839
|
+
}, v.rgb.xyz = function(e) {
|
|
2840
|
+
let t = S(e[0] / 255), n = S(e[1] / 255), r = S(e[2] / 255), i = t * .4124564 + n * .3575761 + r * .1804375, a = t * .2126729 + n * .7151522 + r * .072175, o = t * .0193339 + n * .119192 + r * .9503041;
|
|
2841
|
+
return [
|
|
2842
|
+
i * 100,
|
|
2843
|
+
a * 100,
|
|
2844
|
+
o * 100
|
|
2845
|
+
];
|
|
2846
|
+
}, v.rgb.lab = function(e) {
|
|
2847
|
+
let t = v.rgb.xyz(e), n = t[0], r = t[1], i = t[2];
|
|
2848
|
+
return n /= 95.047, r /= 100, i /= 108.883, n = n > b ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > b ? r ** (1 / 3) : 7.787 * r + 16 / 116, i = i > b ? i ** (1 / 3) : 7.787 * i + 16 / 116, [
|
|
2849
|
+
116 * r - 16,
|
|
2850
|
+
500 * (n - r),
|
|
2851
|
+
200 * (r - i)
|
|
2852
|
+
];
|
|
2853
|
+
}, v.hsl.rgb = function(e) {
|
|
2854
|
+
let t = e[0] / 360, n = e[1] / 100, r = e[2] / 100, i, a;
|
|
2855
|
+
if (n === 0) return a = r * 255, [
|
|
2856
|
+
a,
|
|
2857
|
+
a,
|
|
2858
|
+
a
|
|
2859
|
+
];
|
|
2860
|
+
let o = r < .5 ? r * (1 + n) : r + n - r * n, s = 2 * r - o, c = [
|
|
2861
|
+
0,
|
|
2862
|
+
0,
|
|
2863
|
+
0
|
|
2864
|
+
];
|
|
2865
|
+
for (let e = 0; e < 3; e++) i = t + 1 / 3 * -(e - 1), i < 0 && i++, i > 1 && i--, a = 6 * i < 1 ? s + (o - s) * 6 * i : 2 * i < 1 ? o : 3 * i < 2 ? s + (o - s) * (2 / 3 - i) * 6 : s, c[e] = a * 255;
|
|
2866
|
+
return c;
|
|
2867
|
+
}, v.hsl.hsv = function(e) {
|
|
2868
|
+
let t = e[0], n = e[1] / 100, r = e[2] / 100, i = n, a = Math.max(r, .01);
|
|
2869
|
+
r *= 2, n *= r <= 1 ? r : 2 - r, i *= a <= 1 ? a : 2 - a;
|
|
2870
|
+
let o = (r + n) / 2;
|
|
2871
|
+
return [
|
|
2872
|
+
t,
|
|
2873
|
+
(r === 0 ? 2 * i / (a + i) : 2 * n / (r + n)) * 100,
|
|
2874
|
+
o * 100
|
|
2875
|
+
];
|
|
2876
|
+
}, v.hsv.rgb = function(e) {
|
|
2877
|
+
let t = e[0] / 60, n = e[1] / 100, r = e[2] / 100, i = Math.floor(t) % 6, a = t - Math.floor(t), o = 255 * r * (1 - n), s = 255 * r * (1 - n * a), c = 255 * r * (1 - n * (1 - a));
|
|
2878
|
+
switch (r *= 255, i) {
|
|
2879
|
+
case 0: return [
|
|
2880
|
+
r,
|
|
2881
|
+
c,
|
|
2882
|
+
o
|
|
2883
|
+
];
|
|
2884
|
+
case 1: return [
|
|
2885
|
+
s,
|
|
2886
|
+
r,
|
|
2887
|
+
o
|
|
2888
|
+
];
|
|
2889
|
+
case 2: return [
|
|
2890
|
+
o,
|
|
2891
|
+
r,
|
|
2892
|
+
c
|
|
2893
|
+
];
|
|
2894
|
+
case 3: return [
|
|
2895
|
+
o,
|
|
2896
|
+
s,
|
|
2897
|
+
r
|
|
2898
|
+
];
|
|
2899
|
+
case 4: return [
|
|
2900
|
+
c,
|
|
2901
|
+
o,
|
|
2902
|
+
r
|
|
2903
|
+
];
|
|
2904
|
+
case 5: return [
|
|
2905
|
+
r,
|
|
2906
|
+
o,
|
|
2907
|
+
s
|
|
2908
|
+
];
|
|
2909
|
+
}
|
|
2910
|
+
}, v.hsv.hsl = function(e) {
|
|
2911
|
+
let t = e[0], n = e[1] / 100, r = e[2] / 100, i = Math.max(r, .01), a, o;
|
|
2912
|
+
o = (2 - n) * r;
|
|
2913
|
+
let s = (2 - n) * i;
|
|
2914
|
+
return a = n * i, a /= s <= 1 ? s : 2 - s, a ||= 0, o /= 2, [
|
|
2915
|
+
t,
|
|
2916
|
+
a * 100,
|
|
2917
|
+
o * 100
|
|
2918
|
+
];
|
|
2919
|
+
}, v.hwb.rgb = function(e) {
|
|
2920
|
+
let t = e[0] / 360, n = e[1] / 100, r = e[2] / 100, i = n + r, a;
|
|
2921
|
+
i > 1 && (n /= i, r /= i);
|
|
2922
|
+
let o = Math.floor(6 * t), s = 1 - r;
|
|
2923
|
+
a = 6 * t - o, o & 1 && (a = 1 - a);
|
|
2924
|
+
let c = n + a * (s - n), l, u, d;
|
|
2925
|
+
switch (o) {
|
|
2926
|
+
default:
|
|
2927
|
+
case 6:
|
|
2928
|
+
case 0:
|
|
2929
|
+
l = s, u = c, d = n;
|
|
2930
|
+
break;
|
|
2931
|
+
case 1:
|
|
2932
|
+
l = c, u = s, d = n;
|
|
2933
|
+
break;
|
|
2934
|
+
case 2:
|
|
2935
|
+
l = n, u = s, d = c;
|
|
2936
|
+
break;
|
|
2937
|
+
case 3:
|
|
2938
|
+
l = n, u = c, d = s;
|
|
2939
|
+
break;
|
|
2940
|
+
case 4:
|
|
2941
|
+
l = c, u = n, d = s;
|
|
2942
|
+
break;
|
|
2943
|
+
case 5:
|
|
2944
|
+
l = s, u = n, d = c;
|
|
2945
|
+
break;
|
|
2946
|
+
}
|
|
2947
|
+
return [
|
|
2948
|
+
l * 255,
|
|
2949
|
+
u * 255,
|
|
2950
|
+
d * 255
|
|
2951
|
+
];
|
|
2952
|
+
}, v.cmyk.rgb = function(e) {
|
|
2953
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = e[3] / 100, a = 1 - Math.min(1, t * (1 - i) + i), o = 1 - Math.min(1, n * (1 - i) + i), s = 1 - Math.min(1, r * (1 - i) + i);
|
|
2954
|
+
return [
|
|
2955
|
+
a * 255,
|
|
2956
|
+
o * 255,
|
|
2957
|
+
s * 255
|
|
2958
|
+
];
|
|
2959
|
+
}, v.xyz.rgb = function(e) {
|
|
2960
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i, a, o;
|
|
2961
|
+
return i = t * 3.2404542 + n * -1.5371385 + r * -.4985314, a = t * -.969266 + n * 1.8760108 + r * .041556, o = t * .0556434 + n * -.2040259 + r * 1.0572252, i = x(i), a = x(a), o = x(o), [
|
|
2962
|
+
i * 255,
|
|
2963
|
+
a * 255,
|
|
2964
|
+
o * 255
|
|
2965
|
+
];
|
|
2966
|
+
}, v.xyz.lab = function(e) {
|
|
2967
|
+
let t = e[0], n = e[1], r = e[2];
|
|
2968
|
+
return t /= 95.047, n /= 100, r /= 108.883, t = t > b ? t ** (1 / 3) : 7.787 * t + 16 / 116, n = n > b ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > b ? r ** (1 / 3) : 7.787 * r + 16 / 116, [
|
|
2969
|
+
116 * n - 16,
|
|
2970
|
+
500 * (t - n),
|
|
2971
|
+
200 * (n - r)
|
|
2972
|
+
];
|
|
2973
|
+
}, v.xyz.oklab = function(e) {
|
|
2974
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = Math.cbrt(.8189330101 * t + .3618667424 * n - .1288597137 * r), a = Math.cbrt(.0329845436 * t + .9293118715 * n + .0361456387 * r), o = Math.cbrt(.0482003018 * t + .2643662691 * n + .633851707 * r), s = .2104542553 * i + .793617785 * a - .0040720468 * o, c = 1.9779984951 * i - 2.428592205 * a + .4505937099 * o, l = .0259040371 * i + .7827717662 * a - .808675766 * o;
|
|
2975
|
+
return [
|
|
2976
|
+
s * 100,
|
|
2977
|
+
c * 100,
|
|
2978
|
+
l * 100
|
|
2979
|
+
];
|
|
2980
|
+
}, v.oklab.oklch = function(e) {
|
|
2981
|
+
return v.lab.lch(e);
|
|
2982
|
+
}, v.oklab.xyz = function(e) {
|
|
2983
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = (.999999998 * t + .396337792 * n + .215803758 * r) ** 3, a = (1.000000008 * t - .105561342 * n - .063854175 * r) ** 3, o = (1.000000055 * t - .089484182 * n - 1.291485538 * r) ** 3, s = 1.227013851 * i - .55779998 * a + .281256149 * o, c = -.040580178 * i + 1.11225687 * a - .071676679 * o, l = -.076381285 * i - .421481978 * a + 1.58616322 * o;
|
|
2984
|
+
return [
|
|
2985
|
+
s * 100,
|
|
2986
|
+
c * 100,
|
|
2987
|
+
l * 100
|
|
2988
|
+
];
|
|
2989
|
+
}, v.oklab.rgb = function(e) {
|
|
2990
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = (t + .3963377774 * n + .2158037573 * r) ** 3, a = (t - .1055613458 * n - .0638541728 * r) ** 3, o = (t - .0894841775 * n - 1.291485548 * r) ** 3, s = x(4.0767416621 * i - 3.3077115913 * a + .2309699292 * o), c = x(-1.2684380046 * i + 2.6097574011 * a - .3413193965 * o), l = x(-.0041960863 * i - .7034186147 * a + 1.707614701 * o);
|
|
2991
|
+
return [
|
|
2992
|
+
s * 255,
|
|
2993
|
+
c * 255,
|
|
2994
|
+
l * 255
|
|
2995
|
+
];
|
|
2996
|
+
}, v.oklch.oklab = function(e) {
|
|
2997
|
+
return v.lch.lab(e);
|
|
2998
|
+
}, v.lab.xyz = function(e) {
|
|
2999
|
+
let t = e[0], n = e[1], r = e[2], i, a, o;
|
|
3000
|
+
a = (t + 16) / 116, i = n / 500 + a, o = a - r / 200;
|
|
3001
|
+
let s = a ** 3, c = i ** 3, l = o ** 3;
|
|
3002
|
+
return a = s > b ? s : (a - 16 / 116) / 7.787, i = c > b ? c : (i - 16 / 116) / 7.787, o = l > b ? l : (o - 16 / 116) / 7.787, i *= 95.047, a *= 100, o *= 108.883, [
|
|
3003
|
+
i,
|
|
3004
|
+
a,
|
|
3005
|
+
o
|
|
3006
|
+
];
|
|
3007
|
+
}, v.lab.lch = function(e) {
|
|
3008
|
+
let t = e[0], n = e[1], r = e[2], i;
|
|
3009
|
+
return i = Math.atan2(r, n) * 360 / 2 / Math.PI, i < 0 && (i += 360), [
|
|
3010
|
+
t,
|
|
3011
|
+
Math.sqrt(n * n + r * r),
|
|
3012
|
+
i
|
|
3013
|
+
];
|
|
3014
|
+
}, v.lch.lab = function(e) {
|
|
3015
|
+
let t = e[0], n = e[1], r = e[2] / 360 * 2 * Math.PI;
|
|
3016
|
+
return [
|
|
3017
|
+
t,
|
|
3018
|
+
n * Math.cos(r),
|
|
3019
|
+
n * Math.sin(r)
|
|
3020
|
+
];
|
|
3021
|
+
}, v.rgb.ansi16 = function(e, t = null) {
|
|
3022
|
+
let [n, r, i] = e, a = t === null ? v.rgb.hsv(e)[2] : t;
|
|
3023
|
+
if (a = Math.round(a / 50), a === 0) return 30;
|
|
3024
|
+
let o = 30 + (Math.round(i / 255) << 2 | Math.round(r / 255) << 1 | Math.round(n / 255));
|
|
3025
|
+
return a === 2 && (o += 60), o;
|
|
3026
|
+
}, v.hsv.ansi16 = function(e) {
|
|
3027
|
+
return v.rgb.ansi16(v.hsv.rgb(e), e[2]);
|
|
3028
|
+
}, v.rgb.ansi256 = function(e) {
|
|
3029
|
+
let t = e[0], n = e[1], r = e[2];
|
|
3030
|
+
return t >> 4 == n >> 4 && n >> 4 == r >> 4 ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(r / 255 * 5);
|
|
3031
|
+
}, v.ansi16.rgb = function(e) {
|
|
3032
|
+
e = e[0];
|
|
3033
|
+
let t = e % 10;
|
|
3034
|
+
if (t === 0 || t === 7) return e > 50 && (t += 3.5), t = t / 10.5 * 255, [
|
|
3035
|
+
t,
|
|
3036
|
+
t,
|
|
3037
|
+
t
|
|
3038
|
+
];
|
|
3039
|
+
let n = (Math.trunc(e > 50) + 1) * .5;
|
|
3040
|
+
return [
|
|
3041
|
+
(t & 1) * n * 255,
|
|
3042
|
+
(t >> 1 & 1) * n * 255,
|
|
3043
|
+
(t >> 2 & 1) * n * 255
|
|
3044
|
+
];
|
|
3045
|
+
}, v.ansi256.rgb = function(e) {
|
|
3046
|
+
if (e = e[0], e >= 232) {
|
|
3047
|
+
let t = (e - 232) * 10 + 8;
|
|
3048
|
+
return [
|
|
3049
|
+
t,
|
|
3050
|
+
t,
|
|
3051
|
+
t
|
|
3052
|
+
];
|
|
3053
|
+
}
|
|
3054
|
+
e -= 16;
|
|
3055
|
+
let t;
|
|
3056
|
+
return [
|
|
3057
|
+
Math.floor(e / 36) / 5 * 255,
|
|
3058
|
+
Math.floor((t = e % 36) / 6) / 5 * 255,
|
|
3059
|
+
t % 6 / 5 * 255
|
|
3060
|
+
];
|
|
3061
|
+
}, v.rgb.hex = function(e) {
|
|
3062
|
+
let t = (((Math.round(e[0]) & 255) << 16) + ((Math.round(e[1]) & 255) << 8) + (Math.round(e[2]) & 255)).toString(16).toUpperCase();
|
|
3063
|
+
return "000000".slice(t.length) + t;
|
|
3064
|
+
}, v.hex.rgb = function(e) {
|
|
3065
|
+
let t = e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
|
|
3066
|
+
if (!t) return [
|
|
3067
|
+
0,
|
|
3068
|
+
0,
|
|
3069
|
+
0
|
|
3070
|
+
];
|
|
3071
|
+
let n = t[0];
|
|
3072
|
+
t[0].length === 3 && (n = [...n].map((e) => e + e).join(""));
|
|
3073
|
+
let r = Number.parseInt(n, 16);
|
|
3074
|
+
return [
|
|
3075
|
+
r >> 16 & 255,
|
|
3076
|
+
r >> 8 & 255,
|
|
3077
|
+
r & 255
|
|
3078
|
+
];
|
|
3079
|
+
}, v.rgb.hcg = function(e) {
|
|
3080
|
+
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.max(Math.max(t, n), r), a = Math.min(Math.min(t, n), r), o = i - a, s, c = o < 1 ? a / (1 - o) : 0;
|
|
3081
|
+
return s = o <= 0 ? 0 : i === t ? (n - r) / o % 6 : i === n ? 2 + (r - t) / o : 4 + (t - n) / o, s /= 6, s %= 1, [
|
|
3082
|
+
s * 360,
|
|
3083
|
+
o * 100,
|
|
3084
|
+
c * 100
|
|
3085
|
+
];
|
|
3086
|
+
}, v.hsl.hcg = function(e) {
|
|
3087
|
+
let t = e[1] / 100, n = e[2] / 100, r = n < .5 ? 2 * t * n : 2 * t * (1 - n), i = 0;
|
|
3088
|
+
return r < 1 && (i = (n - .5 * r) / (1 - r)), [
|
|
3089
|
+
e[0],
|
|
3090
|
+
r * 100,
|
|
3091
|
+
i * 100
|
|
3092
|
+
];
|
|
3093
|
+
}, v.hsv.hcg = function(e) {
|
|
3094
|
+
let t = e[1] / 100, n = e[2] / 100, r = t * n, i = 0;
|
|
3095
|
+
return r < 1 && (i = (n - r) / (1 - r)), [
|
|
3096
|
+
e[0],
|
|
3097
|
+
r * 100,
|
|
3098
|
+
i * 100
|
|
3099
|
+
];
|
|
3100
|
+
}, v.hcg.rgb = function(e) {
|
|
3101
|
+
let t = e[0] / 360, n = e[1] / 100, r = e[2] / 100;
|
|
3102
|
+
if (n === 0) return [
|
|
3103
|
+
r * 255,
|
|
3104
|
+
r * 255,
|
|
3105
|
+
r * 255
|
|
3106
|
+
];
|
|
3107
|
+
let i = [
|
|
3108
|
+
0,
|
|
3109
|
+
0,
|
|
3110
|
+
0
|
|
3111
|
+
], a = t % 1 * 6, o = a % 1, s = 1 - o, c = 0;
|
|
3112
|
+
switch (Math.floor(a)) {
|
|
3113
|
+
case 0:
|
|
3114
|
+
i[0] = 1, i[1] = o, i[2] = 0;
|
|
3115
|
+
break;
|
|
3116
|
+
case 1:
|
|
3117
|
+
i[0] = s, i[1] = 1, i[2] = 0;
|
|
3118
|
+
break;
|
|
3119
|
+
case 2:
|
|
3120
|
+
i[0] = 0, i[1] = 1, i[2] = o;
|
|
3121
|
+
break;
|
|
3122
|
+
case 3:
|
|
3123
|
+
i[0] = 0, i[1] = s, i[2] = 1;
|
|
3124
|
+
break;
|
|
3125
|
+
case 4:
|
|
3126
|
+
i[0] = o, i[1] = 0, i[2] = 1;
|
|
3127
|
+
break;
|
|
3128
|
+
default: i[0] = 1, i[1] = 0, i[2] = s;
|
|
3129
|
+
}
|
|
3130
|
+
return c = (1 - n) * r, [
|
|
3131
|
+
(n * i[0] + c) * 255,
|
|
3132
|
+
(n * i[1] + c) * 255,
|
|
3133
|
+
(n * i[2] + c) * 255
|
|
3134
|
+
];
|
|
3135
|
+
}, v.hcg.hsv = function(e) {
|
|
3136
|
+
let t = e[1] / 100, n = t + e[2] / 100 * (1 - t), r = 0;
|
|
3137
|
+
return n > 0 && (r = t / n), [
|
|
3138
|
+
e[0],
|
|
3139
|
+
r * 100,
|
|
3140
|
+
n * 100
|
|
3141
|
+
];
|
|
3142
|
+
}, v.hcg.hsl = function(e) {
|
|
3143
|
+
let t = e[1] / 100, n = e[2] / 100 * (1 - t) + .5 * t, r = 0;
|
|
3144
|
+
return n > 0 && n < .5 ? r = t / (2 * n) : n >= .5 && n < 1 && (r = t / (2 * (1 - n))), [
|
|
3145
|
+
e[0],
|
|
3146
|
+
r * 100,
|
|
3147
|
+
n * 100
|
|
3148
|
+
];
|
|
3149
|
+
}, v.hcg.hwb = function(e) {
|
|
3150
|
+
let t = e[1] / 100, n = t + e[2] / 100 * (1 - t);
|
|
3151
|
+
return [
|
|
3152
|
+
e[0],
|
|
3153
|
+
(n - t) * 100,
|
|
3154
|
+
(1 - n) * 100
|
|
3155
|
+
];
|
|
3156
|
+
}, v.hwb.hcg = function(e) {
|
|
3157
|
+
let t = e[1] / 100, n = 1 - e[2] / 100, r = n - t, i = 0;
|
|
3158
|
+
return r < 1 && (i = (n - r) / (1 - r)), [
|
|
3159
|
+
e[0],
|
|
3160
|
+
r * 100,
|
|
3161
|
+
i * 100
|
|
3162
|
+
];
|
|
3163
|
+
}, v.apple.rgb = function(e) {
|
|
3164
|
+
return [
|
|
3165
|
+
e[0] / 65535 * 255,
|
|
3166
|
+
e[1] / 65535 * 255,
|
|
3167
|
+
e[2] / 65535 * 255
|
|
3168
|
+
];
|
|
3169
|
+
}, v.rgb.apple = function(e) {
|
|
3170
|
+
return [
|
|
3171
|
+
e[0] / 255 * 65535,
|
|
3172
|
+
e[1] / 255 * 65535,
|
|
3173
|
+
e[2] / 255 * 65535
|
|
3174
|
+
];
|
|
3175
|
+
}, v.gray.rgb = function(e) {
|
|
3176
|
+
return [
|
|
3177
|
+
e[0] / 100 * 255,
|
|
3178
|
+
e[0] / 100 * 255,
|
|
3179
|
+
e[0] / 100 * 255
|
|
3180
|
+
];
|
|
3181
|
+
}, v.gray.hsl = function(e) {
|
|
3182
|
+
return [
|
|
3183
|
+
0,
|
|
3184
|
+
0,
|
|
3185
|
+
e[0]
|
|
3186
|
+
];
|
|
3187
|
+
}, v.gray.hsv = v.gray.hsl, v.gray.hwb = function(e) {
|
|
3188
|
+
return [
|
|
3189
|
+
0,
|
|
3190
|
+
100,
|
|
3191
|
+
e[0]
|
|
3192
|
+
];
|
|
3193
|
+
}, v.gray.cmyk = function(e) {
|
|
3194
|
+
return [
|
|
3195
|
+
0,
|
|
3196
|
+
0,
|
|
3197
|
+
0,
|
|
3198
|
+
e[0]
|
|
3199
|
+
];
|
|
3200
|
+
}, v.gray.lab = function(e) {
|
|
3201
|
+
return [
|
|
3202
|
+
e[0],
|
|
3203
|
+
0,
|
|
3204
|
+
0
|
|
3205
|
+
];
|
|
3206
|
+
}, v.gray.hex = function(e) {
|
|
3207
|
+
let t = Math.round(e[0] / 100 * 255) & 255, n = ((t << 16) + (t << 8) + t).toString(16).toUpperCase();
|
|
3208
|
+
return "000000".slice(n.length) + n;
|
|
3209
|
+
}, v.rgb.gray = function(e) {
|
|
3210
|
+
return [(e[0] + e[1] + e[2]) / 3 / 255 * 100];
|
|
3211
|
+
};
|
|
3212
|
+
function w() {
|
|
3213
|
+
let e = {}, t = Object.keys(y);
|
|
3214
|
+
for (let { length: n } = t, r = 0; r < n; r++) e[t[r]] = {
|
|
3215
|
+
distance: -1,
|
|
3216
|
+
parent: null
|
|
3217
|
+
};
|
|
3218
|
+
return e;
|
|
3219
|
+
}
|
|
3220
|
+
function T(e) {
|
|
3221
|
+
let t = w(), n = [e];
|
|
3222
|
+
for (t[e].distance = 0; n.length > 0;) {
|
|
3223
|
+
let e = n.pop(), r = Object.keys(y[e]);
|
|
3224
|
+
for (let { length: i } = r, a = 0; a < i; a++) {
|
|
3225
|
+
let i = r[a], o = t[i];
|
|
3226
|
+
o.distance === -1 && (o.distance = t[e].distance + 1, o.parent = e, n.unshift(i));
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
return t;
|
|
3230
|
+
}
|
|
3231
|
+
function E(e, t) {
|
|
3232
|
+
return function(n) {
|
|
3233
|
+
return t(e(n));
|
|
3234
|
+
};
|
|
3235
|
+
}
|
|
3236
|
+
function D(e, t) {
|
|
3237
|
+
let n = [t[e].parent, e], r = y[t[e].parent][e], i = t[e].parent;
|
|
3238
|
+
for (; t[i].parent;) n.unshift(t[i].parent), r = E(y[t[i].parent][i], r), i = t[i].parent;
|
|
3239
|
+
return r.conversion = n, r;
|
|
3240
|
+
}
|
|
3241
|
+
function O(e) {
|
|
3242
|
+
let t = T(e), n = {}, r = Object.keys(t);
|
|
3243
|
+
for (let { length: e } = r, i = 0; i < e; i++) {
|
|
3244
|
+
let e = r[i];
|
|
3245
|
+
t[e].parent !== null && (n[e] = D(e, t));
|
|
3246
|
+
}
|
|
3247
|
+
return n;
|
|
3248
|
+
}
|
|
3249
|
+
var k = O, A = {}, j = Object.keys(y);
|
|
3250
|
+
function M(e) {
|
|
3251
|
+
let t = function(...t) {
|
|
3252
|
+
let n = t[0];
|
|
3253
|
+
return n == null ? n : (n.length > 1 && (t = n), e(t));
|
|
3254
|
+
};
|
|
3255
|
+
return "conversion" in e && (t.conversion = e.conversion), t;
|
|
3256
|
+
}
|
|
3257
|
+
function N(e) {
|
|
3258
|
+
let t = function(...t) {
|
|
3259
|
+
let n = t[0];
|
|
3260
|
+
if (n == null) return n;
|
|
3261
|
+
n.length > 1 && (t = n);
|
|
3262
|
+
let r = e(t);
|
|
3263
|
+
if (typeof r == "object") for (let { length: e } = r, t = 0; t < e; t++) r[t] = Math.round(r[t]);
|
|
3264
|
+
return r;
|
|
3265
|
+
};
|
|
3266
|
+
return "conversion" in e && (t.conversion = e.conversion), t;
|
|
3267
|
+
}
|
|
3268
|
+
for (let e of j) {
|
|
3269
|
+
A[e] = {}, Object.defineProperty(A[e], "channels", { value: y[e].channels }), Object.defineProperty(A[e], "labels", { value: y[e].labels });
|
|
3270
|
+
let t = k(e), n = Object.keys(t);
|
|
3271
|
+
for (let r of n) {
|
|
3272
|
+
let n = t[r];
|
|
3273
|
+
A[e][r] = N(n), A[e][r].raw = M(n);
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
var P = A, F = [
|
|
3277
|
+
"keyword",
|
|
3278
|
+
"gray",
|
|
3279
|
+
"hex"
|
|
3280
|
+
], I = {};
|
|
3281
|
+
for (let e of Object.keys(P)) I[[...P[e].labels].sort().join("")] = e;
|
|
3282
|
+
var L = {};
|
|
3283
|
+
function R(e, t) {
|
|
3284
|
+
if (!(this instanceof R)) return new R(e, t);
|
|
3285
|
+
if (t && t in F && (t = null), t && !(t in P)) throw Error("Unknown model: " + t);
|
|
3286
|
+
let n, r;
|
|
3287
|
+
if (e == null) this.model = "rgb", this.color = [
|
|
3288
|
+
0,
|
|
3289
|
+
0,
|
|
3290
|
+
0
|
|
3291
|
+
], this.valpha = 1;
|
|
3292
|
+
else if (e instanceof R) this.model = e.model, this.color = [...e.color], this.valpha = e.valpha;
|
|
3293
|
+
else if (typeof e == "string") {
|
|
3294
|
+
let t = g.get(e);
|
|
3295
|
+
if (t === null) throw Error("Unable to parse color from string: " + e);
|
|
3296
|
+
this.model = t.model, r = P[this.model].channels, this.color = t.value.slice(0, r), this.valpha = typeof t.value[r] == "number" ? t.value[r] : 1;
|
|
3297
|
+
} else if (e.length > 0) {
|
|
3298
|
+
this.model = t || "rgb", r = P[this.model].channels;
|
|
3299
|
+
let n = Array.prototype.slice.call(e, 0, r);
|
|
3300
|
+
this.color = W(n, r), this.valpha = typeof e[r] == "number" ? e[r] : 1;
|
|
3301
|
+
} else if (typeof e == "number") this.model = "rgb", this.color = [
|
|
3302
|
+
e >> 16 & 255,
|
|
3303
|
+
e >> 8 & 255,
|
|
3304
|
+
e & 255
|
|
3305
|
+
], this.valpha = 1;
|
|
3306
|
+
else {
|
|
3307
|
+
this.valpha = 1;
|
|
3308
|
+
let t = Object.keys(e);
|
|
3309
|
+
"alpha" in e && (t.splice(t.indexOf("alpha"), 1), this.valpha = typeof e.alpha == "number" ? e.alpha : 0);
|
|
3310
|
+
let r = t.sort().join("");
|
|
3311
|
+
if (!(r in I)) throw Error("Unable to parse color from object: " + JSON.stringify(e));
|
|
3312
|
+
this.model = I[r];
|
|
3313
|
+
let { labels: i } = P[this.model], a = [];
|
|
3314
|
+
for (n = 0; n < i.length; n++) a.push(e[i[n]]);
|
|
3315
|
+
this.color = W(a);
|
|
3316
|
+
}
|
|
3317
|
+
if (L[this.model]) for (r = P[this.model].channels, n = 0; n < r; n++) {
|
|
3318
|
+
let e = L[this.model][n];
|
|
3319
|
+
e && (this.color[n] = e(this.color[n]));
|
|
3320
|
+
}
|
|
3321
|
+
this.valpha = Math.max(0, Math.min(1, this.valpha)), Object.freeze && Object.freeze(this);
|
|
3322
|
+
}
|
|
3323
|
+
R.prototype = {
|
|
3324
|
+
toString() {
|
|
3325
|
+
return this.string();
|
|
3326
|
+
},
|
|
3327
|
+
toJSON() {
|
|
3328
|
+
return this[this.model]();
|
|
3329
|
+
},
|
|
3330
|
+
string(e) {
|
|
3331
|
+
let t = this.model in g.to ? this : this.rgb();
|
|
3332
|
+
t = t.round(typeof e == "number" ? e : 1);
|
|
3333
|
+
let n = t.valpha === 1 ? t.color : [...t.color, this.valpha];
|
|
3334
|
+
return g.to[t.model](...n);
|
|
3335
|
+
},
|
|
3336
|
+
percentString(e) {
|
|
3337
|
+
let t = this.rgb().round(typeof e == "number" ? e : 1), n = t.valpha === 1 ? t.color : [...t.color, this.valpha];
|
|
3338
|
+
return g.to.rgb.percent(...n);
|
|
3339
|
+
},
|
|
3340
|
+
array() {
|
|
3341
|
+
return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
|
|
3342
|
+
},
|
|
3343
|
+
object() {
|
|
3344
|
+
let e = {}, { channels: t } = P[this.model], { labels: n } = P[this.model];
|
|
3345
|
+
for (let r = 0; r < t; r++) e[n[r]] = this.color[r];
|
|
3346
|
+
return this.valpha !== 1 && (e.alpha = this.valpha), e;
|
|
3347
|
+
},
|
|
3348
|
+
unitArray() {
|
|
3349
|
+
let e = this.rgb().color;
|
|
3350
|
+
return e[0] /= 255, e[1] /= 255, e[2] /= 255, this.valpha !== 1 && e.push(this.valpha), e;
|
|
3351
|
+
},
|
|
3352
|
+
unitObject() {
|
|
3353
|
+
let e = this.rgb().object();
|
|
3354
|
+
return e.r /= 255, e.g /= 255, e.b /= 255, this.valpha !== 1 && (e.alpha = this.valpha), e;
|
|
3355
|
+
},
|
|
3356
|
+
round(e) {
|
|
3357
|
+
return e = Math.max(e || 0, 0), new R([...this.color.map(B(e)), this.valpha], this.model);
|
|
3358
|
+
},
|
|
3359
|
+
alpha(e) {
|
|
3360
|
+
return e === void 0 ? this.valpha : new R([...this.color, Math.max(0, Math.min(1, e))], this.model);
|
|
3361
|
+
},
|
|
3362
|
+
red: V("rgb", 0, H(255)),
|
|
3363
|
+
green: V("rgb", 1, H(255)),
|
|
3364
|
+
blue: V("rgb", 2, H(255)),
|
|
3365
|
+
hue: V([
|
|
3366
|
+
"hsl",
|
|
3367
|
+
"hsv",
|
|
3368
|
+
"hsl",
|
|
3369
|
+
"hwb",
|
|
3370
|
+
"hcg"
|
|
3371
|
+
], 0, (e) => (e % 360 + 360) % 360),
|
|
3372
|
+
saturationl: V("hsl", 1, H(100)),
|
|
3373
|
+
lightness: V("hsl", 2, H(100)),
|
|
3374
|
+
saturationv: V("hsv", 1, H(100)),
|
|
3375
|
+
value: V("hsv", 2, H(100)),
|
|
3376
|
+
chroma: V("hcg", 1, H(100)),
|
|
3377
|
+
gray: V("hcg", 2, H(100)),
|
|
3378
|
+
white: V("hwb", 1, H(100)),
|
|
3379
|
+
wblack: V("hwb", 2, H(100)),
|
|
3380
|
+
cyan: V("cmyk", 0, H(100)),
|
|
3381
|
+
magenta: V("cmyk", 1, H(100)),
|
|
3382
|
+
yellow: V("cmyk", 2, H(100)),
|
|
3383
|
+
black: V("cmyk", 3, H(100)),
|
|
3384
|
+
x: V("xyz", 0, H(95.047)),
|
|
3385
|
+
y: V("xyz", 1, H(100)),
|
|
3386
|
+
z: V("xyz", 2, H(108.833)),
|
|
3387
|
+
l: V("lab", 0, H(100)),
|
|
3388
|
+
a: V("lab", 1),
|
|
3389
|
+
b: V("lab", 2),
|
|
3390
|
+
keyword(e) {
|
|
3391
|
+
return e === void 0 ? P[this.model].keyword(this.color) : new R(e);
|
|
3392
|
+
},
|
|
3393
|
+
hex(e) {
|
|
3394
|
+
return e === void 0 ? g.to.hex(...this.rgb().round().color) : new R(e);
|
|
3395
|
+
},
|
|
3396
|
+
hexa(e) {
|
|
3397
|
+
if (e !== void 0) return new R(e);
|
|
3398
|
+
let t = this.rgb().round().color, n = Math.round(this.valpha * 255).toString(16).toUpperCase();
|
|
3399
|
+
return n.length === 1 && (n = "0" + n), g.to.hex(...t) + n;
|
|
3400
|
+
},
|
|
3401
|
+
rgbNumber() {
|
|
3402
|
+
let e = this.rgb().color;
|
|
3403
|
+
return (e[0] & 255) << 16 | (e[1] & 255) << 8 | e[2] & 255;
|
|
3404
|
+
},
|
|
3405
|
+
luminosity() {
|
|
3406
|
+
let e = this.rgb().color, t = [];
|
|
3407
|
+
for (let [n, r] of e.entries()) {
|
|
3408
|
+
let e = r / 255;
|
|
3409
|
+
t[n] = e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
3410
|
+
}
|
|
3411
|
+
return .2126 * t[0] + .7152 * t[1] + .0722 * t[2];
|
|
3412
|
+
},
|
|
3413
|
+
contrast(e) {
|
|
3414
|
+
let t = this.luminosity(), n = e.luminosity();
|
|
3415
|
+
return t > n ? (t + .05) / (n + .05) : (n + .05) / (t + .05);
|
|
3416
|
+
},
|
|
3417
|
+
level(e) {
|
|
3418
|
+
let t = this.contrast(e);
|
|
3419
|
+
return t >= 7 ? "AAA" : t >= 4.5 ? "AA" : "";
|
|
3420
|
+
},
|
|
3421
|
+
isDark() {
|
|
3422
|
+
let e = this.rgb().color;
|
|
3423
|
+
return (e[0] * 2126 + e[1] * 7152 + e[2] * 722) / 1e4 < 128;
|
|
3424
|
+
},
|
|
3425
|
+
isLight() {
|
|
3426
|
+
return !this.isDark();
|
|
3427
|
+
},
|
|
3428
|
+
negate() {
|
|
3429
|
+
let e = this.rgb();
|
|
3430
|
+
for (let t = 0; t < 3; t++) e.color[t] = 255 - e.color[t];
|
|
3431
|
+
return e;
|
|
3432
|
+
},
|
|
3433
|
+
lighten(e) {
|
|
3434
|
+
let t = this.hsl();
|
|
3435
|
+
return t.color[2] += t.color[2] * e, t;
|
|
3436
|
+
},
|
|
3437
|
+
darken(e) {
|
|
3438
|
+
let t = this.hsl();
|
|
3439
|
+
return t.color[2] -= t.color[2] * e, t;
|
|
3440
|
+
},
|
|
3441
|
+
saturate(e) {
|
|
3442
|
+
let t = this.hsl();
|
|
3443
|
+
return t.color[1] += t.color[1] * e, t;
|
|
3444
|
+
},
|
|
3445
|
+
desaturate(e) {
|
|
3446
|
+
let t = this.hsl();
|
|
3447
|
+
return t.color[1] -= t.color[1] * e, t;
|
|
3448
|
+
},
|
|
3449
|
+
whiten(e) {
|
|
3450
|
+
let t = this.hwb();
|
|
3451
|
+
return t.color[1] += t.color[1] * e, t;
|
|
3452
|
+
},
|
|
3453
|
+
blacken(e) {
|
|
3454
|
+
let t = this.hwb();
|
|
3455
|
+
return t.color[2] += t.color[2] * e, t;
|
|
3456
|
+
},
|
|
3457
|
+
grayscale() {
|
|
3458
|
+
let e = this.rgb().color, t = e[0] * .3 + e[1] * .59 + e[2] * .11;
|
|
3459
|
+
return R.rgb(t, t, t);
|
|
3460
|
+
},
|
|
3461
|
+
fade(e) {
|
|
3462
|
+
return this.alpha(this.valpha - this.valpha * e);
|
|
3463
|
+
},
|
|
3464
|
+
opaquer(e) {
|
|
3465
|
+
return this.alpha(this.valpha + this.valpha * e);
|
|
3466
|
+
},
|
|
3467
|
+
rotate(e) {
|
|
3468
|
+
let t = this.hsl(), n = t.color[0];
|
|
3469
|
+
return n = (n + e) % 360, n = n < 0 ? 360 + n : n, t.color[0] = n, t;
|
|
3470
|
+
},
|
|
3471
|
+
mix(e, t) {
|
|
3472
|
+
if (!e || !e.rgb) throw Error("Argument to \"mix\" was not a Color instance, but rather an instance of " + typeof e);
|
|
3473
|
+
let n = e.rgb(), r = this.rgb(), i = t === void 0 ? .5 : t, a = 2 * i - 1, o = n.alpha() - r.alpha(), s = ((a * o === -1 ? a : (a + o) / (1 + a * o)) + 1) / 2, c = 1 - s;
|
|
3474
|
+
return R.rgb(s * n.red() + c * r.red(), s * n.green() + c * r.green(), s * n.blue() + c * r.blue(), n.alpha() * i + r.alpha() * (1 - i));
|
|
3475
|
+
}
|
|
3476
|
+
};
|
|
3477
|
+
for (let e of Object.keys(P)) {
|
|
3478
|
+
if (F.includes(e)) continue;
|
|
3479
|
+
let { channels: t } = P[e];
|
|
3480
|
+
R.prototype[e] = function(...t) {
|
|
3481
|
+
return this.model === e ? new R(this) : t.length > 0 ? new R(t, e) : new R([...U(P[this.model][e].raw(this.color)), this.valpha], e);
|
|
3482
|
+
}, R[e] = function(...n) {
|
|
3483
|
+
let r = n[0];
|
|
3484
|
+
return typeof r == "number" && (r = W(n, t)), new R(r, e);
|
|
3485
|
+
};
|
|
3486
|
+
}
|
|
3487
|
+
function z(e, t) {
|
|
3488
|
+
return Number(e.toFixed(t));
|
|
3489
|
+
}
|
|
3490
|
+
function B(e) {
|
|
3491
|
+
return function(t) {
|
|
3492
|
+
return z(t, e);
|
|
3493
|
+
};
|
|
3494
|
+
}
|
|
3495
|
+
function V(e, t, n) {
|
|
3496
|
+
e = Array.isArray(e) ? e : [e];
|
|
3497
|
+
for (let r of e) (L[r] ||= [])[t] = n;
|
|
3498
|
+
return e = e[0], function(r) {
|
|
3499
|
+
let i;
|
|
3500
|
+
return r === void 0 ? (i = this[e]().color[t], n && (i = n(i)), i) : (n && (r = n(r)), i = this[e](), i.color[t] = r, i);
|
|
3501
|
+
};
|
|
3502
|
+
}
|
|
3503
|
+
function H(e) {
|
|
3504
|
+
return function(t) {
|
|
3505
|
+
return Math.max(0, Math.min(e, t));
|
|
3506
|
+
};
|
|
3507
|
+
}
|
|
3508
|
+
function U(e) {
|
|
3509
|
+
return Array.isArray(e) ? e : [e];
|
|
3510
|
+
}
|
|
3511
|
+
function W(e, t) {
|
|
3512
|
+
for (let n = 0; n < t; n++) typeof e[n] != "number" && (e[n] = 0);
|
|
3513
|
+
return e;
|
|
3514
|
+
}
|
|
3515
|
+
var G = R;
|
|
3516
|
+
})), ce = /* @__PURE__ */ i(((e, t) => {
|
|
3517
|
+
t.exports = se().default;
|
|
3518
|
+
})), le = /* @__PURE__ */ i(((e, t) => {
|
|
3519
|
+
var n = ce(), r = o(), i = {
|
|
3520
|
+
multiband: "multiband",
|
|
3521
|
+
"b-w": "b-w",
|
|
3522
|
+
bw: "b-w",
|
|
3523
|
+
cmyk: "cmyk",
|
|
3524
|
+
srgb: "srgb"
|
|
3525
|
+
};
|
|
3526
|
+
function a(e) {
|
|
3527
|
+
return this._setBackgroundColourOption("tint", e), this;
|
|
3528
|
+
}
|
|
3529
|
+
function s(e) {
|
|
3530
|
+
return this.options.greyscale = r.bool(e) ? e : !0, this;
|
|
3531
|
+
}
|
|
3532
|
+
function c(e) {
|
|
3533
|
+
return this.greyscale(e);
|
|
3534
|
+
}
|
|
3535
|
+
function l(e) {
|
|
3536
|
+
if (!r.string(e)) throw r.invalidParameterError("colourspace", "string", e);
|
|
3537
|
+
return this.options.colourspacePipeline = e, this;
|
|
3538
|
+
}
|
|
3539
|
+
function u(e) {
|
|
3540
|
+
return this.pipelineColourspace(e);
|
|
3541
|
+
}
|
|
3542
|
+
function d(e) {
|
|
3543
|
+
if (!r.string(e)) throw r.invalidParameterError("colourspace", "string", e);
|
|
3544
|
+
return this.options.colourspace = e, this;
|
|
3545
|
+
}
|
|
3546
|
+
function f(e) {
|
|
3547
|
+
return this.toColourspace(e);
|
|
3548
|
+
}
|
|
3549
|
+
function p(e) {
|
|
3550
|
+
if (r.object(e) || r.string(e) && e.length >= 3 && e.length <= 200) {
|
|
3551
|
+
let t = n(e);
|
|
3552
|
+
return [
|
|
3553
|
+
t.red(),
|
|
3554
|
+
t.green(),
|
|
3555
|
+
t.blue(),
|
|
3556
|
+
Math.round(t.alpha() * 255)
|
|
3557
|
+
];
|
|
3558
|
+
} else throw r.invalidParameterError("background", "object or string", e);
|
|
3559
|
+
}
|
|
3560
|
+
function m(e, t) {
|
|
3561
|
+
r.defined(t) && (this.options[e] = p(t));
|
|
3562
|
+
}
|
|
3563
|
+
t.exports = (e) => {
|
|
3564
|
+
Object.assign(e.prototype, {
|
|
3565
|
+
tint: a,
|
|
3566
|
+
greyscale: s,
|
|
3567
|
+
grayscale: c,
|
|
3568
|
+
pipelineColourspace: l,
|
|
3569
|
+
pipelineColorspace: u,
|
|
3570
|
+
toColourspace: d,
|
|
3571
|
+
toColorspace: f,
|
|
3572
|
+
_getBackgroundColourOption: p,
|
|
3573
|
+
_setBackgroundColourOption: m
|
|
3574
|
+
}), e.colourspace = i, e.colorspace = i;
|
|
3575
|
+
};
|
|
3576
|
+
})), ue = /* @__PURE__ */ i(((e, t) => {
|
|
3577
|
+
var n = o(), r = {
|
|
3578
|
+
and: "and",
|
|
3579
|
+
or: "or",
|
|
3580
|
+
eor: "eor"
|
|
3581
|
+
};
|
|
3582
|
+
function i() {
|
|
3583
|
+
return this.options.removeAlpha = !0, this;
|
|
3584
|
+
}
|
|
3585
|
+
function a(e) {
|
|
3586
|
+
if (n.defined(e)) if (n.number(e) && n.inRange(e, 0, 1)) this.options.ensureAlpha = e;
|
|
3587
|
+
else throw n.invalidParameterError("alpha", "number between 0 and 1", e);
|
|
3588
|
+
else this.options.ensureAlpha = 1;
|
|
3589
|
+
return this;
|
|
3590
|
+
}
|
|
3591
|
+
function s(e) {
|
|
3592
|
+
let t = {
|
|
3593
|
+
red: 0,
|
|
3594
|
+
green: 1,
|
|
3595
|
+
blue: 2,
|
|
3596
|
+
alpha: 3
|
|
3597
|
+
};
|
|
3598
|
+
if (Object.keys(t).includes(e) && (e = t[e]), n.integer(e) && n.inRange(e, 0, 4)) this.options.extractChannel = e;
|
|
3599
|
+
else throw n.invalidParameterError("channel", "integer or one of: red, green, blue, alpha", e);
|
|
3600
|
+
return this;
|
|
3601
|
+
}
|
|
3602
|
+
function c(e, t) {
|
|
3603
|
+
return Array.isArray(e) ? e.forEach(function(e) {
|
|
3604
|
+
this.options.joinChannelIn.push(this._createInputDescriptor(e, t));
|
|
3605
|
+
}, this) : this.options.joinChannelIn.push(this._createInputDescriptor(e, t)), this;
|
|
3606
|
+
}
|
|
3607
|
+
function l(e) {
|
|
3608
|
+
if (n.string(e) && n.inArray(e, [
|
|
3609
|
+
"and",
|
|
3610
|
+
"or",
|
|
3611
|
+
"eor"
|
|
3612
|
+
])) this.options.bandBoolOp = e;
|
|
3613
|
+
else throw n.invalidParameterError("boolOp", "one of: and, or, eor", e);
|
|
3614
|
+
return this;
|
|
3615
|
+
}
|
|
3616
|
+
t.exports = (e) => {
|
|
3617
|
+
Object.assign(e.prototype, {
|
|
3618
|
+
removeAlpha: i,
|
|
3619
|
+
ensureAlpha: a,
|
|
3620
|
+
extractChannel: s,
|
|
3621
|
+
joinChannel: c,
|
|
3622
|
+
bandbool: l
|
|
3623
|
+
}), e.bool = r;
|
|
3624
|
+
};
|
|
3625
|
+
})), de = /* @__PURE__ */ i(((e, t) => {
|
|
3626
|
+
var n = a(), r = o(), i = $(), s = new Map([
|
|
3627
|
+
["heic", "heif"],
|
|
3628
|
+
["heif", "heif"],
|
|
3629
|
+
["avif", "avif"],
|
|
3630
|
+
["jpeg", "jpeg"],
|
|
3631
|
+
["jpg", "jpeg"],
|
|
3632
|
+
["jpe", "jpeg"],
|
|
3633
|
+
["tile", "tile"],
|
|
3634
|
+
["dz", "tile"],
|
|
3635
|
+
["png", "png"],
|
|
3636
|
+
["raw", "raw"],
|
|
3637
|
+
["tiff", "tiff"],
|
|
3638
|
+
["tif", "tiff"],
|
|
3639
|
+
["webp", "webp"],
|
|
3640
|
+
["gif", "gif"],
|
|
3641
|
+
["jp2", "jp2"],
|
|
3642
|
+
["jpx", "jp2"],
|
|
3643
|
+
["j2k", "jp2"],
|
|
3644
|
+
["j2c", "jp2"],
|
|
3645
|
+
["jxl", "jxl"]
|
|
3646
|
+
]), c = /\.(jp[2x]|j2[kc])$/i, l = () => /* @__PURE__ */ Error("JP2 output requires libvips with support for OpenJPEG"), u = (e) => 1 << 31 - Math.clz32(Math.ceil(Math.log2(e)));
|
|
3647
|
+
function d(e, t) {
|
|
3648
|
+
let i;
|
|
3649
|
+
if (r.string(e) ? r.string(this.options.input.file) && n.resolve(this.options.input.file) === n.resolve(e) ? i = /* @__PURE__ */ Error("Cannot use same file for input and output") : c.test(n.extname(e)) && !this.constructor.format.jp2k.output.file && (i = l()) : i = /* @__PURE__ */ Error("Missing output file path"), i) if (r.fn(t)) t(i);
|
|
3650
|
+
else return Promise.reject(i);
|
|
3651
|
+
else {
|
|
3652
|
+
this.options.fileOut = e;
|
|
3653
|
+
let n = Error();
|
|
3654
|
+
return this._pipeline(t, n);
|
|
3655
|
+
}
|
|
3656
|
+
return this;
|
|
3657
|
+
}
|
|
3658
|
+
function f(e, t) {
|
|
3659
|
+
r.object(e) ? this._setBooleanOption("resolveWithObject", e.resolveWithObject) : this.options.resolveWithObject && (this.options.resolveWithObject = !1), this.options.fileOut = "";
|
|
3660
|
+
let n = Error();
|
|
3661
|
+
return this._pipeline(r.fn(e) ? e : t, n);
|
|
3662
|
+
}
|
|
3663
|
+
function p() {
|
|
3664
|
+
return this.options.keepMetadata |= 1, this;
|
|
3665
|
+
}
|
|
3666
|
+
function m(e) {
|
|
3667
|
+
if (r.object(e)) for (let [t, n] of Object.entries(e)) if (r.object(n)) for (let [e, i] of Object.entries(n)) if (r.string(i)) this.options.withExif[`exif-${t.toLowerCase()}-${e}`] = i;
|
|
3668
|
+
else throw r.invalidParameterError(`${t}.${e}`, "string", i);
|
|
3669
|
+
else throw r.invalidParameterError(t, "object", n);
|
|
3670
|
+
else throw r.invalidParameterError("exif", "object", e);
|
|
3671
|
+
return this.options.withExifMerge = !1, this.keepExif();
|
|
3672
|
+
}
|
|
3673
|
+
function h(e) {
|
|
3674
|
+
return this.withExif(e), this.options.withExifMerge = !0, this;
|
|
3675
|
+
}
|
|
3676
|
+
function g() {
|
|
3677
|
+
return this.options.keepMetadata |= 8, this;
|
|
3678
|
+
}
|
|
3679
|
+
function _(e, t) {
|
|
3680
|
+
if (r.string(e)) this.options.withIccProfile = e;
|
|
3681
|
+
else throw r.invalidParameterError("icc", "string", e);
|
|
3682
|
+
if (this.keepIccProfile(), r.object(t) && r.defined(t.attach)) if (r.bool(t.attach)) t.attach || (this.options.keepMetadata &= -9);
|
|
3683
|
+
else throw r.invalidParameterError("attach", "boolean", t.attach);
|
|
3684
|
+
return this;
|
|
3685
|
+
}
|
|
3686
|
+
function v() {
|
|
3687
|
+
return this.options.keepMetadata |= 2, this;
|
|
3688
|
+
}
|
|
3689
|
+
function y(e) {
|
|
3690
|
+
if (r.string(e) && e.length > 0) this.options.withXmp = e, this.options.keepMetadata |= 2;
|
|
3691
|
+
else throw r.invalidParameterError("xmp", "non-empty string", e);
|
|
3692
|
+
return this;
|
|
3693
|
+
}
|
|
3694
|
+
function b() {
|
|
3695
|
+
return this.options.keepMetadata = 31, this;
|
|
3696
|
+
}
|
|
3697
|
+
function x(e) {
|
|
3698
|
+
if (this.keepMetadata(), this.withIccProfile("srgb"), r.object(e)) {
|
|
3699
|
+
if (r.defined(e.orientation)) if (r.integer(e.orientation) && r.inRange(e.orientation, 1, 8)) this.options.withMetadataOrientation = e.orientation;
|
|
3700
|
+
else throw r.invalidParameterError("orientation", "integer between 1 and 8", e.orientation);
|
|
3701
|
+
if (r.defined(e.density)) if (r.number(e.density) && e.density > 0) this.options.withMetadataDensity = e.density;
|
|
3702
|
+
else throw r.invalidParameterError("density", "positive number", e.density);
|
|
3703
|
+
r.defined(e.icc) && this.withIccProfile(e.icc), r.defined(e.exif) && this.withExifMerge(e.exif);
|
|
3704
|
+
}
|
|
3705
|
+
return this;
|
|
3706
|
+
}
|
|
3707
|
+
function S(e, t) {
|
|
3708
|
+
let n = s.get((r.object(e) && r.string(e.id) ? e.id : e).toLowerCase());
|
|
3709
|
+
if (!n) throw r.invalidParameterError("format", `one of: ${[...s.keys()].join(", ")}`, e);
|
|
3710
|
+
return this[n](t);
|
|
3711
|
+
}
|
|
3712
|
+
function C(e) {
|
|
3713
|
+
if (r.object(e)) {
|
|
3714
|
+
if (r.defined(e.quality)) if (r.integer(e.quality) && r.inRange(e.quality, 1, 100)) this.options.jpegQuality = e.quality;
|
|
3715
|
+
else throw r.invalidParameterError("quality", "integer between 1 and 100", e.quality);
|
|
3716
|
+
if (r.defined(e.progressive) && this._setBooleanOption("jpegProgressive", e.progressive), r.defined(e.chromaSubsampling)) if (r.string(e.chromaSubsampling) && r.inArray(e.chromaSubsampling, ["4:2:0", "4:4:4"])) this.options.jpegChromaSubsampling = e.chromaSubsampling;
|
|
3717
|
+
else throw r.invalidParameterError("chromaSubsampling", "one of: 4:2:0, 4:4:4", e.chromaSubsampling);
|
|
3718
|
+
let t = r.bool(e.optimizeCoding) ? e.optimizeCoding : e.optimiseCoding;
|
|
3719
|
+
if (r.defined(t) && this._setBooleanOption("jpegOptimiseCoding", t), r.defined(e.mozjpeg)) if (r.bool(e.mozjpeg)) e.mozjpeg && (this.options.jpegTrellisQuantisation = !0, this.options.jpegOvershootDeringing = !0, this.options.jpegOptimiseScans = !0, this.options.jpegProgressive = !0, this.options.jpegQuantisationTable = 3);
|
|
3720
|
+
else throw r.invalidParameterError("mozjpeg", "boolean", e.mozjpeg);
|
|
3721
|
+
let n = r.bool(e.trellisQuantization) ? e.trellisQuantization : e.trellisQuantisation;
|
|
3722
|
+
r.defined(n) && this._setBooleanOption("jpegTrellisQuantisation", n), r.defined(e.overshootDeringing) && this._setBooleanOption("jpegOvershootDeringing", e.overshootDeringing);
|
|
3723
|
+
let i = r.bool(e.optimizeScans) ? e.optimizeScans : e.optimiseScans;
|
|
3724
|
+
r.defined(i) && (this._setBooleanOption("jpegOptimiseScans", i), i && (this.options.jpegProgressive = !0));
|
|
3725
|
+
let a = r.number(e.quantizationTable) ? e.quantizationTable : e.quantisationTable;
|
|
3726
|
+
if (r.defined(a)) if (r.integer(a) && r.inRange(a, 0, 8)) this.options.jpegQuantisationTable = a;
|
|
3727
|
+
else throw r.invalidParameterError("quantisationTable", "integer between 0 and 8", a);
|
|
3728
|
+
}
|
|
3729
|
+
return this._updateFormatOut("jpeg", e);
|
|
3730
|
+
}
|
|
3731
|
+
function w(e) {
|
|
3732
|
+
if (r.object(e)) {
|
|
3733
|
+
if (r.defined(e.progressive) && this._setBooleanOption("pngProgressive", e.progressive), r.defined(e.compressionLevel)) if (r.integer(e.compressionLevel) && r.inRange(e.compressionLevel, 0, 9)) this.options.pngCompressionLevel = e.compressionLevel;
|
|
3734
|
+
else throw r.invalidParameterError("compressionLevel", "integer between 0 and 9", e.compressionLevel);
|
|
3735
|
+
r.defined(e.adaptiveFiltering) && this._setBooleanOption("pngAdaptiveFiltering", e.adaptiveFiltering);
|
|
3736
|
+
let t = e.colours || e.colors;
|
|
3737
|
+
if (r.defined(t)) if (r.integer(t) && r.inRange(t, 2, 256)) this.options.pngBitdepth = u(t);
|
|
3738
|
+
else throw r.invalidParameterError("colours", "integer between 2 and 256", t);
|
|
3739
|
+
if (r.defined(e.palette) ? this._setBooleanOption("pngPalette", e.palette) : [
|
|
3740
|
+
e.quality,
|
|
3741
|
+
e.effort,
|
|
3742
|
+
e.colours,
|
|
3743
|
+
e.colors,
|
|
3744
|
+
e.dither
|
|
3745
|
+
].some(r.defined) && this._setBooleanOption("pngPalette", !0), this.options.pngPalette) {
|
|
3746
|
+
if (r.defined(e.quality)) if (r.integer(e.quality) && r.inRange(e.quality, 0, 100)) this.options.pngQuality = e.quality;
|
|
3747
|
+
else throw r.invalidParameterError("quality", "integer between 0 and 100", e.quality);
|
|
3748
|
+
if (r.defined(e.effort)) if (r.integer(e.effort) && r.inRange(e.effort, 1, 10)) this.options.pngEffort = e.effort;
|
|
3749
|
+
else throw r.invalidParameterError("effort", "integer between 1 and 10", e.effort);
|
|
3750
|
+
if (r.defined(e.dither)) if (r.number(e.dither) && r.inRange(e.dither, 0, 1)) this.options.pngDither = e.dither;
|
|
3751
|
+
else throw r.invalidParameterError("dither", "number between 0.0 and 1.0", e.dither);
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
return this._updateFormatOut("png", e);
|
|
3755
|
+
}
|
|
3756
|
+
function T(e) {
|
|
3757
|
+
if (r.object(e)) {
|
|
3758
|
+
if (r.defined(e.quality)) if (r.integer(e.quality) && r.inRange(e.quality, 1, 100)) this.options.webpQuality = e.quality;
|
|
3759
|
+
else throw r.invalidParameterError("quality", "integer between 1 and 100", e.quality);
|
|
3760
|
+
if (r.defined(e.alphaQuality)) if (r.integer(e.alphaQuality) && r.inRange(e.alphaQuality, 0, 100)) this.options.webpAlphaQuality = e.alphaQuality;
|
|
3761
|
+
else throw r.invalidParameterError("alphaQuality", "integer between 0 and 100", e.alphaQuality);
|
|
3762
|
+
if (r.defined(e.lossless) && this._setBooleanOption("webpLossless", e.lossless), r.defined(e.nearLossless) && this._setBooleanOption("webpNearLossless", e.nearLossless), r.defined(e.smartSubsample) && this._setBooleanOption("webpSmartSubsample", e.smartSubsample), r.defined(e.smartDeblock) && this._setBooleanOption("webpSmartDeblock", e.smartDeblock), r.defined(e.preset)) if (r.string(e.preset) && r.inArray(e.preset, [
|
|
3763
|
+
"default",
|
|
3764
|
+
"photo",
|
|
3765
|
+
"picture",
|
|
3766
|
+
"drawing",
|
|
3767
|
+
"icon",
|
|
3768
|
+
"text"
|
|
3769
|
+
])) this.options.webpPreset = e.preset;
|
|
3770
|
+
else throw r.invalidParameterError("preset", "one of: default, photo, picture, drawing, icon, text", e.preset);
|
|
3771
|
+
if (r.defined(e.effort)) if (r.integer(e.effort) && r.inRange(e.effort, 0, 6)) this.options.webpEffort = e.effort;
|
|
3772
|
+
else throw r.invalidParameterError("effort", "integer between 0 and 6", e.effort);
|
|
3773
|
+
r.defined(e.minSize) && this._setBooleanOption("webpMinSize", e.minSize), r.defined(e.mixed) && this._setBooleanOption("webpMixed", e.mixed);
|
|
3774
|
+
}
|
|
3775
|
+
return O(e, this.options), this._updateFormatOut("webp", e);
|
|
3776
|
+
}
|
|
3777
|
+
function E(e) {
|
|
3778
|
+
if (r.object(e)) {
|
|
3779
|
+
r.defined(e.reuse) && this._setBooleanOption("gifReuse", e.reuse), r.defined(e.progressive) && this._setBooleanOption("gifProgressive", e.progressive);
|
|
3780
|
+
let t = e.colours || e.colors;
|
|
3781
|
+
if (r.defined(t)) if (r.integer(t) && r.inRange(t, 2, 256)) this.options.gifBitdepth = u(t);
|
|
3782
|
+
else throw r.invalidParameterError("colours", "integer between 2 and 256", t);
|
|
3783
|
+
if (r.defined(e.effort)) if (r.number(e.effort) && r.inRange(e.effort, 1, 10)) this.options.gifEffort = e.effort;
|
|
3784
|
+
else throw r.invalidParameterError("effort", "integer between 1 and 10", e.effort);
|
|
3785
|
+
if (r.defined(e.dither)) if (r.number(e.dither) && r.inRange(e.dither, 0, 1)) this.options.gifDither = e.dither;
|
|
3786
|
+
else throw r.invalidParameterError("dither", "number between 0.0 and 1.0", e.dither);
|
|
3787
|
+
if (r.defined(e.interFrameMaxError)) if (r.number(e.interFrameMaxError) && r.inRange(e.interFrameMaxError, 0, 32)) this.options.gifInterFrameMaxError = e.interFrameMaxError;
|
|
3788
|
+
else throw r.invalidParameterError("interFrameMaxError", "number between 0.0 and 32.0", e.interFrameMaxError);
|
|
3789
|
+
if (r.defined(e.interPaletteMaxError)) if (r.number(e.interPaletteMaxError) && r.inRange(e.interPaletteMaxError, 0, 256)) this.options.gifInterPaletteMaxError = e.interPaletteMaxError;
|
|
3790
|
+
else throw r.invalidParameterError("interPaletteMaxError", "number between 0.0 and 256.0", e.interPaletteMaxError);
|
|
3791
|
+
if (r.defined(e.keepDuplicateFrames)) if (r.bool(e.keepDuplicateFrames)) this._setBooleanOption("gifKeepDuplicateFrames", e.keepDuplicateFrames);
|
|
3792
|
+
else throw r.invalidParameterError("keepDuplicateFrames", "boolean", e.keepDuplicateFrames);
|
|
3793
|
+
}
|
|
3794
|
+
return O(e, this.options), this._updateFormatOut("gif", e);
|
|
3795
|
+
}
|
|
3796
|
+
function D(e) {
|
|
3797
|
+
/* node:coverage ignore next 41 */
|
|
3798
|
+
if (!this.constructor.format.jp2k.output.buffer) throw l();
|
|
3799
|
+
if (r.object(e)) {
|
|
3800
|
+
if (r.defined(e.quality)) if (r.integer(e.quality) && r.inRange(e.quality, 1, 100)) this.options.jp2Quality = e.quality;
|
|
3801
|
+
else throw r.invalidParameterError("quality", "integer between 1 and 100", e.quality);
|
|
3802
|
+
if (r.defined(e.lossless)) if (r.bool(e.lossless)) this.options.jp2Lossless = e.lossless;
|
|
3803
|
+
else throw r.invalidParameterError("lossless", "boolean", e.lossless);
|
|
3804
|
+
if (r.defined(e.tileWidth)) if (r.integer(e.tileWidth) && r.inRange(e.tileWidth, 1, 32768)) this.options.jp2TileWidth = e.tileWidth;
|
|
3805
|
+
else throw r.invalidParameterError("tileWidth", "integer between 1 and 32768", e.tileWidth);
|
|
3806
|
+
if (r.defined(e.tileHeight)) if (r.integer(e.tileHeight) && r.inRange(e.tileHeight, 1, 32768)) this.options.jp2TileHeight = e.tileHeight;
|
|
3807
|
+
else throw r.invalidParameterError("tileHeight", "integer between 1 and 32768", e.tileHeight);
|
|
3808
|
+
if (r.defined(e.chromaSubsampling)) if (r.string(e.chromaSubsampling) && r.inArray(e.chromaSubsampling, ["4:2:0", "4:4:4"])) this.options.jp2ChromaSubsampling = e.chromaSubsampling;
|
|
3809
|
+
else throw r.invalidParameterError("chromaSubsampling", "one of: 4:2:0, 4:4:4", e.chromaSubsampling);
|
|
3810
|
+
}
|
|
3811
|
+
return this._updateFormatOut("jp2", e);
|
|
3812
|
+
}
|
|
3813
|
+
function O(e, t) {
|
|
3814
|
+
if (r.object(e) && r.defined(e.loop)) if (r.integer(e.loop) && r.inRange(e.loop, 0, 65535)) t.loop = e.loop;
|
|
3815
|
+
else throw r.invalidParameterError("loop", "integer between 0 and 65535", e.loop);
|
|
3816
|
+
if (r.object(e) && r.defined(e.delay)) if (r.integer(e.delay) && r.inRange(e.delay, 0, 65535)) t.delay = [e.delay];
|
|
3817
|
+
else if (Array.isArray(e.delay) && e.delay.every(r.integer) && e.delay.every((e) => r.inRange(e, 0, 65535))) t.delay = e.delay;
|
|
3818
|
+
else throw r.invalidParameterError("delay", "integer or an array of integers between 0 and 65535", e.delay);
|
|
3819
|
+
}
|
|
3820
|
+
function k(e) {
|
|
3821
|
+
if (r.object(e)) {
|
|
3822
|
+
if (r.defined(e.quality)) if (r.integer(e.quality) && r.inRange(e.quality, 1, 100)) this.options.tiffQuality = e.quality;
|
|
3823
|
+
else throw r.invalidParameterError("quality", "integer between 1 and 100", e.quality);
|
|
3824
|
+
if (r.defined(e.bitdepth)) if (r.integer(e.bitdepth) && r.inArray(e.bitdepth, [
|
|
3825
|
+
1,
|
|
3826
|
+
2,
|
|
3827
|
+
4,
|
|
3828
|
+
8
|
|
3829
|
+
])) this.options.tiffBitdepth = e.bitdepth;
|
|
3830
|
+
else throw r.invalidParameterError("bitdepth", "1, 2, 4 or 8", e.bitdepth);
|
|
3831
|
+
if (r.defined(e.tile) && this._setBooleanOption("tiffTile", e.tile), r.defined(e.tileWidth)) if (r.integer(e.tileWidth) && e.tileWidth > 0) this.options.tiffTileWidth = e.tileWidth;
|
|
3832
|
+
else throw r.invalidParameterError("tileWidth", "integer greater than zero", e.tileWidth);
|
|
3833
|
+
if (r.defined(e.tileHeight)) if (r.integer(e.tileHeight) && e.tileHeight > 0) this.options.tiffTileHeight = e.tileHeight;
|
|
3834
|
+
else throw r.invalidParameterError("tileHeight", "integer greater than zero", e.tileHeight);
|
|
3835
|
+
if (r.defined(e.miniswhite) && this._setBooleanOption("tiffMiniswhite", e.miniswhite), r.defined(e.pyramid) && this._setBooleanOption("tiffPyramid", e.pyramid), r.defined(e.xres)) if (r.number(e.xres) && e.xres > 0) this.options.tiffXres = e.xres;
|
|
3836
|
+
else throw r.invalidParameterError("xres", "number greater than zero", e.xres);
|
|
3837
|
+
if (r.defined(e.yres)) if (r.number(e.yres) && e.yres > 0) this.options.tiffYres = e.yres;
|
|
3838
|
+
else throw r.invalidParameterError("yres", "number greater than zero", e.yres);
|
|
3839
|
+
if (r.defined(e.compression)) if (r.string(e.compression) && r.inArray(e.compression, [
|
|
3840
|
+
"none",
|
|
3841
|
+
"jpeg",
|
|
3842
|
+
"deflate",
|
|
3843
|
+
"packbits",
|
|
3844
|
+
"ccittfax4",
|
|
3845
|
+
"lzw",
|
|
3846
|
+
"webp",
|
|
3847
|
+
"zstd",
|
|
3848
|
+
"jp2k"
|
|
3849
|
+
])) this.options.tiffCompression = e.compression;
|
|
3850
|
+
else throw r.invalidParameterError("compression", "one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k", e.compression);
|
|
3851
|
+
if (r.defined(e.bigtiff) && this._setBooleanOption("tiffBigtiff", e.bigtiff), r.defined(e.predictor)) if (r.string(e.predictor) && r.inArray(e.predictor, [
|
|
3852
|
+
"none",
|
|
3853
|
+
"horizontal",
|
|
3854
|
+
"float"
|
|
3855
|
+
])) this.options.tiffPredictor = e.predictor;
|
|
3856
|
+
else throw r.invalidParameterError("predictor", "one of: none, horizontal, float", e.predictor);
|
|
3857
|
+
if (r.defined(e.resolutionUnit)) if (r.string(e.resolutionUnit) && r.inArray(e.resolutionUnit, ["inch", "cm"])) this.options.tiffResolutionUnit = e.resolutionUnit;
|
|
3858
|
+
else throw r.invalidParameterError("resolutionUnit", "one of: inch, cm", e.resolutionUnit);
|
|
3859
|
+
}
|
|
3860
|
+
return this._updateFormatOut("tiff", e);
|
|
3861
|
+
}
|
|
3862
|
+
function A(e) {
|
|
3863
|
+
return this.heif({
|
|
3864
|
+
...e,
|
|
3865
|
+
compression: "av1"
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3868
|
+
function j(e) {
|
|
3869
|
+
if (r.object(e)) {
|
|
3870
|
+
if (r.string(e.compression) && r.inArray(e.compression, ["av1", "hevc"])) this.options.heifCompression = e.compression;
|
|
3871
|
+
else throw r.invalidParameterError("compression", "one of: av1, hevc", e.compression);
|
|
3872
|
+
if (r.defined(e.quality)) if (r.integer(e.quality) && r.inRange(e.quality, 1, 100)) this.options.heifQuality = e.quality;
|
|
3873
|
+
else throw r.invalidParameterError("quality", "integer between 1 and 100", e.quality);
|
|
3874
|
+
if (r.defined(e.lossless)) if (r.bool(e.lossless)) this.options.heifLossless = e.lossless;
|
|
3875
|
+
else throw r.invalidParameterError("lossless", "boolean", e.lossless);
|
|
3876
|
+
if (r.defined(e.effort)) if (r.integer(e.effort) && r.inRange(e.effort, 0, 9)) this.options.heifEffort = e.effort;
|
|
3877
|
+
else throw r.invalidParameterError("effort", "integer between 0 and 9", e.effort);
|
|
3878
|
+
if (r.defined(e.chromaSubsampling)) if (r.string(e.chromaSubsampling) && r.inArray(e.chromaSubsampling, ["4:2:0", "4:4:4"])) this.options.heifChromaSubsampling = e.chromaSubsampling;
|
|
3879
|
+
else throw r.invalidParameterError("chromaSubsampling", "one of: 4:2:0, 4:4:4", e.chromaSubsampling);
|
|
3880
|
+
if (r.defined(e.bitdepth)) if (r.integer(e.bitdepth) && r.inArray(e.bitdepth, [
|
|
3881
|
+
8,
|
|
3882
|
+
10,
|
|
3883
|
+
12
|
|
3884
|
+
])) {
|
|
3885
|
+
if (e.bitdepth !== 8 && this.constructor.versions.heif) throw r.invalidParameterError("bitdepth when using prebuilt binaries", 8, e.bitdepth);
|
|
3886
|
+
this.options.heifBitdepth = e.bitdepth;
|
|
3887
|
+
} else throw r.invalidParameterError("bitdepth", "8, 10 or 12", e.bitdepth);
|
|
3888
|
+
} else throw r.invalidParameterError("options", "Object", e);
|
|
3889
|
+
return this._updateFormatOut("heif", e);
|
|
3890
|
+
}
|
|
3891
|
+
function M(e) {
|
|
3892
|
+
if (r.object(e)) {
|
|
3893
|
+
if (r.defined(e.quality)) if (r.integer(e.quality) && r.inRange(e.quality, 1, 100)) this.options.jxlDistance = e.quality >= 30 ? .1 + (100 - e.quality) * .09 : 53 / 3e3 * e.quality * e.quality - 23 / 20 * e.quality + 25;
|
|
3894
|
+
else throw r.invalidParameterError("quality", "integer between 1 and 100", e.quality);
|
|
3895
|
+
else if (r.defined(e.distance)) if (r.number(e.distance) && r.inRange(e.distance, 0, 15)) this.options.jxlDistance = e.distance;
|
|
3896
|
+
else throw r.invalidParameterError("distance", "number between 0.0 and 15.0", e.distance);
|
|
3897
|
+
if (r.defined(e.decodingTier)) if (r.integer(e.decodingTier) && r.inRange(e.decodingTier, 0, 4)) this.options.jxlDecodingTier = e.decodingTier;
|
|
3898
|
+
else throw r.invalidParameterError("decodingTier", "integer between 0 and 4", e.decodingTier);
|
|
3899
|
+
if (r.defined(e.lossless)) if (r.bool(e.lossless)) this.options.jxlLossless = e.lossless;
|
|
3900
|
+
else throw r.invalidParameterError("lossless", "boolean", e.lossless);
|
|
3901
|
+
if (r.defined(e.effort)) if (r.integer(e.effort) && r.inRange(e.effort, 1, 9)) this.options.jxlEffort = e.effort;
|
|
3902
|
+
else throw r.invalidParameterError("effort", "integer between 1 and 9", e.effort);
|
|
3903
|
+
}
|
|
3904
|
+
return O(e, this.options), this._updateFormatOut("jxl", e);
|
|
3905
|
+
}
|
|
3906
|
+
function N(e) {
|
|
3907
|
+
if (r.object(e) && r.defined(e.depth)) if (r.string(e.depth) && r.inArray(e.depth, [
|
|
3908
|
+
"char",
|
|
3909
|
+
"uchar",
|
|
3910
|
+
"short",
|
|
3911
|
+
"ushort",
|
|
3912
|
+
"int",
|
|
3913
|
+
"uint",
|
|
3914
|
+
"float",
|
|
3915
|
+
"complex",
|
|
3916
|
+
"double",
|
|
3917
|
+
"dpcomplex"
|
|
3918
|
+
])) this.options.rawDepth = e.depth;
|
|
3919
|
+
else throw r.invalidParameterError("depth", "one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex", e.depth);
|
|
3920
|
+
return this._updateFormatOut("raw");
|
|
3921
|
+
}
|
|
3922
|
+
function P(e) {
|
|
3923
|
+
if (r.object(e)) {
|
|
3924
|
+
if (r.defined(e.size)) if (r.integer(e.size) && r.inRange(e.size, 1, 8192)) this.options.tileSize = e.size;
|
|
3925
|
+
else throw r.invalidParameterError("size", "integer between 1 and 8192", e.size);
|
|
3926
|
+
if (r.defined(e.overlap)) if (r.integer(e.overlap) && r.inRange(e.overlap, 0, 8192)) {
|
|
3927
|
+
if (e.overlap > this.options.tileSize) throw r.invalidParameterError("overlap", `<= size (${this.options.tileSize})`, e.overlap);
|
|
3928
|
+
this.options.tileOverlap = e.overlap;
|
|
3929
|
+
} else throw r.invalidParameterError("overlap", "integer between 0 and 8192", e.overlap);
|
|
3930
|
+
if (r.defined(e.container)) if (r.string(e.container) && r.inArray(e.container, ["fs", "zip"])) this.options.tileContainer = e.container;
|
|
3931
|
+
else throw r.invalidParameterError("container", "one of: fs, zip", e.container);
|
|
3932
|
+
if (r.defined(e.layout)) if (r.string(e.layout) && r.inArray(e.layout, [
|
|
3933
|
+
"dz",
|
|
3934
|
+
"google",
|
|
3935
|
+
"iiif",
|
|
3936
|
+
"iiif3",
|
|
3937
|
+
"zoomify"
|
|
3938
|
+
])) this.options.tileLayout = e.layout;
|
|
3939
|
+
else throw r.invalidParameterError("layout", "one of: dz, google, iiif, iiif3, zoomify", e.layout);
|
|
3940
|
+
if (r.defined(e.angle)) if (r.integer(e.angle) && !(e.angle % 90)) this.options.tileAngle = e.angle;
|
|
3941
|
+
else throw r.invalidParameterError("angle", "positive/negative multiple of 90", e.angle);
|
|
3942
|
+
if (this._setBackgroundColourOption("tileBackground", e.background), r.defined(e.depth)) if (r.string(e.depth) && r.inArray(e.depth, [
|
|
3943
|
+
"onepixel",
|
|
3944
|
+
"onetile",
|
|
3945
|
+
"one"
|
|
3946
|
+
])) this.options.tileDepth = e.depth;
|
|
3947
|
+
else throw r.invalidParameterError("depth", "one of: onepixel, onetile, one", e.depth);
|
|
3948
|
+
if (r.defined(e.skipBlanks)) if (r.integer(e.skipBlanks) && r.inRange(e.skipBlanks, -1, 65535)) this.options.tileSkipBlanks = e.skipBlanks;
|
|
3949
|
+
else throw r.invalidParameterError("skipBlanks", "integer between -1 and 255/65535", e.skipBlanks);
|
|
3950
|
+
else r.defined(e.layout) && e.layout === "google" && (this.options.tileSkipBlanks = 5);
|
|
3951
|
+
let t = r.bool(e.center) ? e.center : e.centre;
|
|
3952
|
+
if (r.defined(t) && this._setBooleanOption("tileCentre", t), r.defined(e.id)) if (r.string(e.id)) this.options.tileId = e.id;
|
|
3953
|
+
else throw r.invalidParameterError("id", "string", e.id);
|
|
3954
|
+
if (r.defined(e.basename)) if (r.string(e.basename)) this.options.tileBasename = e.basename;
|
|
3955
|
+
else throw r.invalidParameterError("basename", "string", e.basename);
|
|
3956
|
+
}
|
|
3957
|
+
if (r.inArray(this.options.formatOut, [
|
|
3958
|
+
"jpeg",
|
|
3959
|
+
"png",
|
|
3960
|
+
"webp"
|
|
3961
|
+
])) this.options.tileFormat = this.options.formatOut;
|
|
3962
|
+
else if (this.options.formatOut !== "input") throw r.invalidParameterError("format", "one of: jpeg, png, webp", this.options.formatOut);
|
|
3963
|
+
return this._updateFormatOut("dz");
|
|
3964
|
+
}
|
|
3965
|
+
function F(e) {
|
|
3966
|
+
if (!r.plainObject(e)) throw r.invalidParameterError("options", "object", e);
|
|
3967
|
+
if (r.integer(e.seconds) && r.inRange(e.seconds, 0, 3600)) this.options.timeoutSeconds = e.seconds;
|
|
3968
|
+
else throw r.invalidParameterError("seconds", "integer between 0 and 3600", e.seconds);
|
|
3969
|
+
return this;
|
|
3970
|
+
}
|
|
3971
|
+
function I(e, t) {
|
|
3972
|
+
return r.object(t) && t.force === !1 || (this.options.formatOut = e), this;
|
|
3973
|
+
}
|
|
3974
|
+
function L(e, t) {
|
|
3975
|
+
if (r.bool(t)) this.options[e] = t;
|
|
3976
|
+
else throw r.invalidParameterError(e, "boolean", t);
|
|
3977
|
+
}
|
|
3978
|
+
function R() {
|
|
3979
|
+
if (!this.options.streamOut) {
|
|
3980
|
+
this.options.streamOut = !0;
|
|
3981
|
+
let e = Error();
|
|
3982
|
+
this._pipeline(void 0, e);
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
function z(e, t) {
|
|
3986
|
+
return typeof e == "function" ? (this._isStreamInput() ? this.on("finish", () => {
|
|
3987
|
+
this._flattenBufferIn(), i.pipeline(this.options, (n, i, a) => {
|
|
3988
|
+
n ? e(r.nativeError(n, t)) : e(null, i, a);
|
|
3989
|
+
});
|
|
3990
|
+
}) : i.pipeline(this.options, (n, i, a) => {
|
|
3991
|
+
n ? e(r.nativeError(n, t)) : e(null, i, a);
|
|
3992
|
+
}), this) : this.options.streamOut ? (this._isStreamInput() ? (this.once("finish", () => {
|
|
3993
|
+
this._flattenBufferIn(), i.pipeline(this.options, (e, n, i) => {
|
|
3994
|
+
e ? this.emit("error", r.nativeError(e, t)) : (this.emit("info", i), this.push(n)), this.push(null), this.on("end", () => this.emit("close"));
|
|
3995
|
+
});
|
|
3996
|
+
}), this.streamInFinished && this.emit("finish")) : i.pipeline(this.options, (e, n, i) => {
|
|
3997
|
+
e ? this.emit("error", r.nativeError(e, t)) : (this.emit("info", i), this.push(n)), this.push(null), this.on("end", () => this.emit("close"));
|
|
3998
|
+
}), this) : this._isStreamInput() ? new Promise((e, n) => {
|
|
3999
|
+
this.once("finish", () => {
|
|
4000
|
+
this._flattenBufferIn(), i.pipeline(this.options, (i, a, o) => {
|
|
4001
|
+
i ? n(r.nativeError(i, t)) : this.options.resolveWithObject ? e({
|
|
4002
|
+
data: a,
|
|
4003
|
+
info: o
|
|
4004
|
+
}) : e(a);
|
|
4005
|
+
});
|
|
4006
|
+
});
|
|
4007
|
+
}) : new Promise((e, n) => {
|
|
4008
|
+
i.pipeline(this.options, (i, a, o) => {
|
|
4009
|
+
i ? n(r.nativeError(i, t)) : this.options.resolveWithObject ? e({
|
|
4010
|
+
data: a,
|
|
4011
|
+
info: o
|
|
4012
|
+
}) : e(a);
|
|
4013
|
+
});
|
|
4014
|
+
});
|
|
4015
|
+
}
|
|
4016
|
+
t.exports = (e) => {
|
|
4017
|
+
Object.assign(e.prototype, {
|
|
4018
|
+
toFile: d,
|
|
4019
|
+
toBuffer: f,
|
|
4020
|
+
keepExif: p,
|
|
4021
|
+
withExif: m,
|
|
4022
|
+
withExifMerge: h,
|
|
4023
|
+
keepIccProfile: g,
|
|
4024
|
+
withIccProfile: _,
|
|
4025
|
+
keepXmp: v,
|
|
4026
|
+
withXmp: y,
|
|
4027
|
+
keepMetadata: b,
|
|
4028
|
+
withMetadata: x,
|
|
4029
|
+
toFormat: S,
|
|
4030
|
+
jpeg: C,
|
|
4031
|
+
jp2: D,
|
|
4032
|
+
png: w,
|
|
4033
|
+
webp: T,
|
|
4034
|
+
tiff: k,
|
|
4035
|
+
avif: A,
|
|
4036
|
+
heif: j,
|
|
4037
|
+
jxl: M,
|
|
4038
|
+
gif: E,
|
|
4039
|
+
raw: N,
|
|
4040
|
+
tile: P,
|
|
4041
|
+
timeout: F,
|
|
4042
|
+
_updateFormatOut: I,
|
|
4043
|
+
_setBooleanOption: L,
|
|
4044
|
+
_read: R,
|
|
4045
|
+
_pipeline: z
|
|
4046
|
+
});
|
|
4047
|
+
};
|
|
4048
|
+
})), fe = /* @__PURE__ */ i(((n, r) => {
|
|
4049
|
+
var i = a(), s = u(), c = o(), { runtimePlatformArch: l } = te(), d = $(), f = l(), p = d.libvipsVersion(), m = d.format();
|
|
4050
|
+
m.heif.output.alias = ["avif", "heic"], m.jpeg.output.alias = ["jpe", "jpg"], m.tiff.output.alias = ["tif"], m.jp2k.output.alias = [
|
|
4051
|
+
"j2c",
|
|
4052
|
+
"j2k",
|
|
4053
|
+
"jp2",
|
|
4054
|
+
"jpx"
|
|
4055
|
+
];
|
|
4056
|
+
var h = {
|
|
4057
|
+
nearest: "nearest",
|
|
4058
|
+
bilinear: "bilinear",
|
|
4059
|
+
bicubic: "bicubic",
|
|
4060
|
+
locallyBoundedBicubic: "lbb",
|
|
4061
|
+
nohalo: "nohalo",
|
|
4062
|
+
vertexSplitQuadraticBasisSpline: "vsqbs"
|
|
4063
|
+
}, g = { vips: p.semver };
|
|
4064
|
+
/* node:coverage ignore next 15 */
|
|
4065
|
+
if (!p.isGlobal) if (p.isWasm) try {
|
|
4066
|
+
g = t("@img/sharp-wasm32/versions");
|
|
4067
|
+
} catch {}
|
|
4068
|
+
else try {
|
|
4069
|
+
g = t(`@img/sharp-${f}/versions`);
|
|
4070
|
+
} catch {
|
|
4071
|
+
try {
|
|
4072
|
+
g = t(`@img/sharp-libvips-${f}/versions`);
|
|
4073
|
+
} catch {}
|
|
4074
|
+
}
|
|
4075
|
+
/* node:coverage ignore next 5 */
|
|
4076
|
+
g.sharp = (ee(), e(j).default).version, g.heif && m.heif && (m.heif.input.fileSuffix = [".avif"], m.heif.output.alias = ["avif"]);
|
|
4077
|
+
function _(e) {
|
|
4078
|
+
return c.bool(e) ? e ? d.cache(50, 20, 100) : d.cache(0, 0, 0) : c.object(e) ? d.cache(e.memory, e.files, e.items) : d.cache();
|
|
4079
|
+
}
|
|
4080
|
+
_(!0);
|
|
4081
|
+
function v(e) {
|
|
4082
|
+
return d.concurrency(c.integer(e) ? e : null);
|
|
4083
|
+
}
|
|
4084
|
+
/* node:coverage ignore next 7 */
|
|
4085
|
+
s.familySync() === s.GLIBC && !d._isUsingJemalloc() ? d.concurrency(1) : s.familySync() === s.MUSL && d.concurrency() === 1024 && d.concurrency(a().availableParallelism());
|
|
4086
|
+
var y = new i.EventEmitter();
|
|
4087
|
+
function b() {
|
|
4088
|
+
return d.counters();
|
|
4089
|
+
}
|
|
4090
|
+
function x(e) {
|
|
4091
|
+
return d.simd(c.bool(e) ? e : null);
|
|
4092
|
+
}
|
|
4093
|
+
function S(e) {
|
|
4094
|
+
if (c.object(e)) if (Array.isArray(e.operation) && e.operation.every(c.string)) d.block(e.operation, !0);
|
|
4095
|
+
else throw c.invalidParameterError("operation", "Array<string>", e.operation);
|
|
4096
|
+
else throw c.invalidParameterError("options", "object", e);
|
|
4097
|
+
}
|
|
4098
|
+
function C(e) {
|
|
4099
|
+
if (c.object(e)) if (Array.isArray(e.operation) && e.operation.every(c.string)) d.block(e.operation, !1);
|
|
4100
|
+
else throw c.invalidParameterError("operation", "Array<string>", e.operation);
|
|
4101
|
+
else throw c.invalidParameterError("options", "object", e);
|
|
4102
|
+
}
|
|
4103
|
+
r.exports = (e) => {
|
|
4104
|
+
e.cache = _, e.concurrency = v, e.counters = b, e.simd = x, e.format = m, e.interpolators = h, e.versions = g, e.queue = y, e.block = S, e.unblock = C;
|
|
4105
|
+
};
|
|
4106
|
+
})), pe = /* @__PURE__ */ i(((e, t) => {
|
|
4107
|
+
var n = ne();
|
|
4108
|
+
re()(n), ie()(n), ae()(n), oe()(n), le()(n), ue()(n), de()(n), fe()(n), t.exports = n;
|
|
4109
|
+
}));
|
|
4110
|
+
//#endregion
|
|
4111
|
+
export default pe();
|