@vxrn/mdx 1.2.55 → 1.2.57

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/dist/index.js CHANGED
@@ -5821,4138 +5821,6 @@ var require_extend = __commonJS({
5821
5821
  }
5822
5822
  });
5823
5823
 
5824
- // ../../node_modules/sharp/lib/is.js
5825
- var require_is = __commonJS({
5826
- "../../node_modules/sharp/lib/is.js"(exports2, module2) {
5827
- "use strict";
5828
- var defined = function(val) {
5829
- return typeof val < "u" && val !== null;
5830
- }, object = function(val) {
5831
- return typeof val == "object";
5832
- }, plainObject = function(val) {
5833
- return Object.prototype.toString.call(val) === "[object Object]";
5834
- }, fn = function(val) {
5835
- return typeof val == "function";
5836
- }, bool = function(val) {
5837
- return typeof val == "boolean";
5838
- }, buffer2 = function(val) {
5839
- return val instanceof Buffer;
5840
- }, typedArray = function(val) {
5841
- if (defined(val))
5842
- switch (val.constructor) {
5843
- case Uint8Array:
5844
- case Uint8ClampedArray:
5845
- case Int8Array:
5846
- case Uint16Array:
5847
- case Int16Array:
5848
- case Uint32Array:
5849
- case Int32Array:
5850
- case Float32Array:
5851
- case Float64Array:
5852
- return !0;
5853
- }
5854
- return !1;
5855
- }, arrayBuffer = function(val) {
5856
- return val instanceof ArrayBuffer;
5857
- }, string = function(val) {
5858
- return typeof val == "string" && val.length > 0;
5859
- }, number2 = function(val) {
5860
- return typeof val == "number" && !Number.isNaN(val);
5861
- }, integer = function(val) {
5862
- return Number.isInteger(val);
5863
- }, inRange = function(val, min, max) {
5864
- return val >= min && val <= max;
5865
- }, inArray = function(val, list2) {
5866
- return list2.includes(val);
5867
- }, invalidParameterError = function(name, expected, actual) {
5868
- return new Error(
5869
- `Expected ${expected} for ${name} but received ${actual} of type ${typeof actual}`
5870
- );
5871
- }, nativeError = function(native, context) {
5872
- return context.message = native.message, context;
5873
- };
5874
- module2.exports = {
5875
- defined,
5876
- object,
5877
- plainObject,
5878
- fn,
5879
- bool,
5880
- buffer: buffer2,
5881
- typedArray,
5882
- arrayBuffer,
5883
- string,
5884
- number: number2,
5885
- integer,
5886
- inRange,
5887
- inArray,
5888
- invalidParameterError,
5889
- nativeError
5890
- };
5891
- }
5892
- });
5893
-
5894
- // ../../node_modules/detect-libc/lib/process.js
5895
- var require_process = __commonJS({
5896
- "../../node_modules/detect-libc/lib/process.js"(exports2, module2) {
5897
- "use strict";
5898
- var isLinux = () => process.platform === "linux", report = null, getReport = () => {
5899
- if (!report)
5900
- if (isLinux() && process.report) {
5901
- let orig = process.report.excludeNetwork;
5902
- process.report.excludeNetwork = !0, report = process.report.getReport(), process.report.excludeNetwork = orig;
5903
- } else
5904
- report = {};
5905
- return report;
5906
- };
5907
- module2.exports = { isLinux, getReport };
5908
- }
5909
- });
5910
-
5911
- // ../../node_modules/detect-libc/lib/filesystem.js
5912
- var require_filesystem = __commonJS({
5913
- "../../node_modules/detect-libc/lib/filesystem.js"(exports2, module2) {
5914
- "use strict";
5915
- var fs4 = require("fs"), LDD_PATH = "/usr/bin/ldd", readFileSync = (path5) => fs4.readFileSync(path5, "utf-8"), readFile = (path5) => new Promise((resolve2, reject) => {
5916
- fs4.readFile(path5, "utf-8", (err, data) => {
5917
- err ? reject(err) : resolve2(data);
5918
- });
5919
- });
5920
- module2.exports = {
5921
- LDD_PATH,
5922
- readFileSync,
5923
- readFile
5924
- };
5925
- }
5926
- });
5927
-
5928
- // ../../node_modules/detect-libc/lib/detect-libc.js
5929
- var require_detect_libc = __commonJS({
5930
- "../../node_modules/detect-libc/lib/detect-libc.js"(exports2, module2) {
5931
- "use strict";
5932
- var childProcess = require("child_process"), { isLinux, getReport } = require_process(), { LDD_PATH, readFile, readFileSync } = require_filesystem(), cachedFamilyFilesystem, cachedVersionFilesystem, command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true", commandOut = "", safeCommand = () => commandOut || new Promise((resolve2) => {
5933
- childProcess.exec(command, (err, out) => {
5934
- commandOut = err ? " " : out, resolve2(commandOut);
5935
- });
5936
- }), safeCommandSync = () => {
5937
- if (!commandOut)
5938
- try {
5939
- commandOut = childProcess.execSync(command, { encoding: "utf8" });
5940
- } catch {
5941
- commandOut = " ";
5942
- }
5943
- return commandOut;
5944
- }, GLIBC = "glibc", RE_GLIBC_VERSION = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i, MUSL = "musl", isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-"), familyFromReport = () => {
5945
- let report = getReport();
5946
- return report.header && report.header.glibcVersionRuntime ? GLIBC : Array.isArray(report.sharedObjects) && report.sharedObjects.some(isFileMusl) ? MUSL : null;
5947
- }, familyFromCommand = (out) => {
5948
- let [getconf, ldd1] = out.split(/[\r\n]+/);
5949
- return getconf && getconf.includes(GLIBC) ? GLIBC : ldd1 && ldd1.includes(MUSL) ? MUSL : null;
5950
- }, getFamilyFromLddContent = (content) => content.includes("musl") ? MUSL : content.includes("GNU C Library") ? GLIBC : null, familyFromFilesystem = async () => {
5951
- if (cachedFamilyFilesystem !== void 0)
5952
- return cachedFamilyFilesystem;
5953
- cachedFamilyFilesystem = null;
5954
- try {
5955
- let lddContent = await readFile(LDD_PATH);
5956
- cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
5957
- } catch {
5958
- }
5959
- return cachedFamilyFilesystem;
5960
- }, familyFromFilesystemSync = () => {
5961
- if (cachedFamilyFilesystem !== void 0)
5962
- return cachedFamilyFilesystem;
5963
- cachedFamilyFilesystem = null;
5964
- try {
5965
- let lddContent = readFileSync(LDD_PATH);
5966
- cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
5967
- } catch {
5968
- }
5969
- return cachedFamilyFilesystem;
5970
- }, family = async () => {
5971
- let family2 = null;
5972
- if (isLinux() && (family2 = await familyFromFilesystem(), family2 || (family2 = familyFromReport()), !family2)) {
5973
- let out = await safeCommand();
5974
- family2 = familyFromCommand(out);
5975
- }
5976
- return family2;
5977
- }, familySync = () => {
5978
- let family2 = null;
5979
- if (isLinux() && (family2 = familyFromFilesystemSync(), family2 || (family2 = familyFromReport()), !family2)) {
5980
- let out = safeCommandSync();
5981
- family2 = familyFromCommand(out);
5982
- }
5983
- return family2;
5984
- }, isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC, isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC, versionFromFilesystem = async () => {
5985
- if (cachedVersionFilesystem !== void 0)
5986
- return cachedVersionFilesystem;
5987
- cachedVersionFilesystem = null;
5988
- try {
5989
- let versionMatch = (await readFile(LDD_PATH)).match(RE_GLIBC_VERSION);
5990
- versionMatch && (cachedVersionFilesystem = versionMatch[1]);
5991
- } catch {
5992
- }
5993
- return cachedVersionFilesystem;
5994
- }, versionFromFilesystemSync = () => {
5995
- if (cachedVersionFilesystem !== void 0)
5996
- return cachedVersionFilesystem;
5997
- cachedVersionFilesystem = null;
5998
- try {
5999
- let versionMatch = readFileSync(LDD_PATH).match(RE_GLIBC_VERSION);
6000
- versionMatch && (cachedVersionFilesystem = versionMatch[1]);
6001
- } catch {
6002
- }
6003
- return cachedVersionFilesystem;
6004
- }, versionFromReport = () => {
6005
- let report = getReport();
6006
- return report.header && report.header.glibcVersionRuntime ? report.header.glibcVersionRuntime : null;
6007
- }, versionSuffix = (s2) => s2.trim().split(/\s+/)[1], versionFromCommand = (out) => {
6008
- let [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
6009
- return getconf && getconf.includes(GLIBC) ? versionSuffix(getconf) : ldd1 && ldd2 && ldd1.includes(MUSL) ? versionSuffix(ldd2) : null;
6010
- }, version = async () => {
6011
- let version2 = null;
6012
- if (isLinux() && (version2 = await versionFromFilesystem(), version2 || (version2 = versionFromReport()), !version2)) {
6013
- let out = await safeCommand();
6014
- version2 = versionFromCommand(out);
6015
- }
6016
- return version2;
6017
- }, versionSync = () => {
6018
- let version2 = null;
6019
- if (isLinux() && (version2 = versionFromFilesystemSync(), version2 || (version2 = versionFromReport()), !version2)) {
6020
- let out = safeCommandSync();
6021
- version2 = versionFromCommand(out);
6022
- }
6023
- return version2;
6024
- };
6025
- module2.exports = {
6026
- GLIBC,
6027
- MUSL,
6028
- family,
6029
- familySync,
6030
- isNonGlibcLinux,
6031
- isNonGlibcLinuxSync,
6032
- version,
6033
- versionSync
6034
- };
6035
- }
6036
- });
6037
-
6038
- // ../../node_modules/semver/internal/debug.js
6039
- var require_debug = __commonJS({
6040
- "../../node_modules/semver/internal/debug.js"(exports2, module2) {
6041
- "use strict";
6042
- var debug = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
6043
- };
6044
- module2.exports = debug;
6045
- }
6046
- });
6047
-
6048
- // ../../node_modules/semver/internal/constants.js
6049
- var require_constants4 = __commonJS({
6050
- "../../node_modules/semver/internal/constants.js"(exports2, module2) {
6051
- "use strict";
6052
- var SEMVER_SPEC_VERSION = "2.0.0", MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
6053
- 9007199254740991, MAX_SAFE_COMPONENT_LENGTH = 16, MAX_SAFE_BUILD_LENGTH = 250, RELEASE_TYPES = [
6054
- "major",
6055
- "premajor",
6056
- "minor",
6057
- "preminor",
6058
- "patch",
6059
- "prepatch",
6060
- "prerelease"
6061
- ];
6062
- module2.exports = {
6063
- MAX_LENGTH: 256,
6064
- MAX_SAFE_COMPONENT_LENGTH,
6065
- MAX_SAFE_BUILD_LENGTH,
6066
- MAX_SAFE_INTEGER,
6067
- RELEASE_TYPES,
6068
- SEMVER_SPEC_VERSION,
6069
- FLAG_INCLUDE_PRERELEASE: 1,
6070
- FLAG_LOOSE: 2
6071
- };
6072
- }
6073
- });
6074
-
6075
- // ../../node_modules/semver/internal/re.js
6076
- var require_re = __commonJS({
6077
- "../../node_modules/semver/internal/re.js"(exports2, module2) {
6078
- "use strict";
6079
- var {
6080
- MAX_SAFE_COMPONENT_LENGTH,
6081
- MAX_SAFE_BUILD_LENGTH,
6082
- MAX_LENGTH
6083
- } = require_constants4(), debug = require_debug();
6084
- exports2 = module2.exports = {};
6085
- var re2 = exports2.re = [], safeRe = exports2.safeRe = [], src = exports2.src = [], safeSrc = exports2.safeSrc = [], t = exports2.t = {}, R = 0, LETTERDASHNUMBER = "[a-zA-Z0-9-]", safeRegexReplacements = [
6086
- ["\\s", 1],
6087
- ["\\d", MAX_LENGTH],
6088
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
6089
- ], makeSafeRegex = (value) => {
6090
- for (let [token, max] of safeRegexReplacements)
6091
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
6092
- return value;
6093
- }, createToken = (name, value, isGlobal) => {
6094
- let safe = makeSafeRegex(value), index2 = R++;
6095
- debug(name, index2, value), t[name] = index2, src[index2] = value, safeSrc[index2] = safe, re2[index2] = new RegExp(value, isGlobal ? "g" : void 0), safeRe[index2] = new RegExp(safe, isGlobal ? "g" : void 0);
6096
- };
6097
- createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
6098
- createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
6099
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
6100
- createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
6101
- createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
6102
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
6103
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
6104
- createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
6105
- createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
6106
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
6107
- createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
6108
- createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
6109
- createToken("FULL", `^${src[t.FULLPLAIN]}$`);
6110
- createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
6111
- createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
6112
- createToken("GTLT", "((?:<|>)?=?)");
6113
- createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
6114
- createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
6115
- createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
6116
- createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
6117
- createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
6118
- createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
6119
- createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
6120
- createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
6121
- createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
6122
- createToken("COERCERTL", src[t.COERCE], !0);
6123
- createToken("COERCERTLFULL", src[t.COERCEFULL], !0);
6124
- createToken("LONETILDE", "(?:~>?)");
6125
- createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, !0);
6126
- exports2.tildeTrimReplace = "$1~";
6127
- createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
6128
- createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
6129
- createToken("LONECARET", "(?:\\^)");
6130
- createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, !0);
6131
- exports2.caretTrimReplace = "$1^";
6132
- createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
6133
- createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
6134
- createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
6135
- createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
6136
- createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, !0);
6137
- exports2.comparatorTrimReplace = "$1$2$3";
6138
- createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
6139
- createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
6140
- createToken("STAR", "(<|>)?=?\\s*\\*");
6141
- createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
6142
- createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
6143
- }
6144
- });
6145
-
6146
- // ../../node_modules/semver/internal/parse-options.js
6147
- var require_parse_options = __commonJS({
6148
- "../../node_modules/semver/internal/parse-options.js"(exports2, module2) {
6149
- "use strict";
6150
- var looseOption = Object.freeze({ loose: !0 }), emptyOpts = Object.freeze({}), parseOptions = (options2) => options2 ? typeof options2 != "object" ? looseOption : options2 : emptyOpts;
6151
- module2.exports = parseOptions;
6152
- }
6153
- });
6154
-
6155
- // ../../node_modules/semver/internal/identifiers.js
6156
- var require_identifiers = __commonJS({
6157
- "../../node_modules/semver/internal/identifiers.js"(exports2, module2) {
6158
- "use strict";
6159
- var numeric = /^[0-9]+$/, compareIdentifiers = (a, b) => {
6160
- let anum = numeric.test(a), bnum = numeric.test(b);
6161
- return anum && bnum && (a = +a, b = +b), a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
6162
- }, rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
6163
- module2.exports = {
6164
- compareIdentifiers,
6165
- rcompareIdentifiers
6166
- };
6167
- }
6168
- });
6169
-
6170
- // ../../node_modules/semver/classes/semver.js
6171
- var require_semver = __commonJS({
6172
- "../../node_modules/semver/classes/semver.js"(exports2, module2) {
6173
- "use strict";
6174
- var debug = require_debug(), { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants4(), { safeRe: re2, t } = require_re(), parseOptions = require_parse_options(), { compareIdentifiers } = require_identifiers(), SemVer = class _SemVer {
6175
- constructor(version, options2) {
6176
- if (options2 = parseOptions(options2), version instanceof _SemVer) {
6177
- if (version.loose === !!options2.loose && version.includePrerelease === !!options2.includePrerelease)
6178
- return version;
6179
- version = version.version;
6180
- } else if (typeof version != "string")
6181
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
6182
- if (version.length > MAX_LENGTH)
6183
- throw new TypeError(
6184
- `version is longer than ${MAX_LENGTH} characters`
6185
- );
6186
- debug("SemVer", version, options2), this.options = options2, this.loose = !!options2.loose, this.includePrerelease = !!options2.includePrerelease;
6187
- let m = version.trim().match(options2.loose ? re2[t.LOOSE] : re2[t.FULL]);
6188
- if (!m)
6189
- throw new TypeError(`Invalid Version: ${version}`);
6190
- if (this.raw = version, this.major = +m[1], this.minor = +m[2], this.patch = +m[3], this.major > MAX_SAFE_INTEGER || this.major < 0)
6191
- throw new TypeError("Invalid major version");
6192
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
6193
- throw new TypeError("Invalid minor version");
6194
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
6195
- throw new TypeError("Invalid patch version");
6196
- m[4] ? this.prerelease = m[4].split(".").map((id) => {
6197
- if (/^[0-9]+$/.test(id)) {
6198
- let num = +id;
6199
- if (num >= 0 && num < MAX_SAFE_INTEGER)
6200
- return num;
6201
- }
6202
- return id;
6203
- }) : this.prerelease = [], this.build = m[5] ? m[5].split(".") : [], this.format();
6204
- }
6205
- format() {
6206
- return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
6207
- }
6208
- toString() {
6209
- return this.version;
6210
- }
6211
- compare(other) {
6212
- if (debug("SemVer.compare", this.version, this.options, other), !(other instanceof _SemVer)) {
6213
- if (typeof other == "string" && other === this.version)
6214
- return 0;
6215
- other = new _SemVer(other, this.options);
6216
- }
6217
- return other.version === this.version ? 0 : this.compareMain(other) || this.comparePre(other);
6218
- }
6219
- compareMain(other) {
6220
- return other instanceof _SemVer || (other = new _SemVer(other, this.options)), compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
6221
- }
6222
- comparePre(other) {
6223
- if (other instanceof _SemVer || (other = new _SemVer(other, this.options)), this.prerelease.length && !other.prerelease.length)
6224
- return -1;
6225
- if (!this.prerelease.length && other.prerelease.length)
6226
- return 1;
6227
- if (!this.prerelease.length && !other.prerelease.length)
6228
- return 0;
6229
- let i = 0;
6230
- do {
6231
- let a = this.prerelease[i], b = other.prerelease[i];
6232
- if (debug("prerelease compare", i, a, b), a === void 0 && b === void 0)
6233
- return 0;
6234
- if (b === void 0)
6235
- return 1;
6236
- if (a === void 0)
6237
- return -1;
6238
- if (a === b)
6239
- continue;
6240
- return compareIdentifiers(a, b);
6241
- } while (++i);
6242
- }
6243
- compareBuild(other) {
6244
- other instanceof _SemVer || (other = new _SemVer(other, this.options));
6245
- let i = 0;
6246
- do {
6247
- let a = this.build[i], b = other.build[i];
6248
- if (debug("build compare", i, a, b), a === void 0 && b === void 0)
6249
- return 0;
6250
- if (b === void 0)
6251
- return 1;
6252
- if (a === void 0)
6253
- return -1;
6254
- if (a === b)
6255
- continue;
6256
- return compareIdentifiers(a, b);
6257
- } while (++i);
6258
- }
6259
- // preminor will bump the version up to the next minor release, and immediately
6260
- // down to pre-release. premajor and prepatch work the same way.
6261
- inc(release, identifier, identifierBase) {
6262
- if (release.startsWith("pre")) {
6263
- if (!identifier && identifierBase === !1)
6264
- throw new Error("invalid increment argument: identifier is empty");
6265
- if (identifier) {
6266
- let match = `-${identifier}`.match(this.options.loose ? re2[t.PRERELEASELOOSE] : re2[t.PRERELEASE]);
6267
- if (!match || match[1] !== identifier)
6268
- throw new Error(`invalid identifier: ${identifier}`);
6269
- }
6270
- }
6271
- switch (release) {
6272
- case "premajor":
6273
- this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", identifier, identifierBase);
6274
- break;
6275
- case "preminor":
6276
- this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", identifier, identifierBase);
6277
- break;
6278
- case "prepatch":
6279
- this.prerelease.length = 0, this.inc("patch", identifier, identifierBase), this.inc("pre", identifier, identifierBase);
6280
- break;
6281
- // If the input is a non-prerelease version, this acts the same as
6282
- // prepatch.
6283
- case "prerelease":
6284
- this.prerelease.length === 0 && this.inc("patch", identifier, identifierBase), this.inc("pre", identifier, identifierBase);
6285
- break;
6286
- case "release":
6287
- if (this.prerelease.length === 0)
6288
- throw new Error(`version ${this.raw} is not a prerelease`);
6289
- this.prerelease.length = 0;
6290
- break;
6291
- case "major":
6292
- (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
6293
- break;
6294
- case "minor":
6295
- (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
6296
- break;
6297
- case "patch":
6298
- this.prerelease.length === 0 && this.patch++, this.prerelease = [];
6299
- break;
6300
- // This probably shouldn't be used publicly.
6301
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
6302
- case "pre": {
6303
- let base3 = Number(identifierBase) ? 1 : 0;
6304
- if (this.prerelease.length === 0)
6305
- this.prerelease = [base3];
6306
- else {
6307
- let i = this.prerelease.length;
6308
- for (; --i >= 0; )
6309
- typeof this.prerelease[i] == "number" && (this.prerelease[i]++, i = -2);
6310
- if (i === -1) {
6311
- if (identifier === this.prerelease.join(".") && identifierBase === !1)
6312
- throw new Error("invalid increment argument: identifier already exists");
6313
- this.prerelease.push(base3);
6314
- }
6315
- }
6316
- if (identifier) {
6317
- let prerelease = [identifier, base3];
6318
- identifierBase === !1 && (prerelease = [identifier]), compareIdentifiers(this.prerelease[0], identifier) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = prerelease) : this.prerelease = prerelease;
6319
- }
6320
- break;
6321
- }
6322
- default:
6323
- throw new Error(`invalid increment argument: ${release}`);
6324
- }
6325
- return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
6326
- }
6327
- };
6328
- module2.exports = SemVer;
6329
- }
6330
- });
6331
-
6332
- // ../../node_modules/semver/functions/parse.js
6333
- var require_parse4 = __commonJS({
6334
- "../../node_modules/semver/functions/parse.js"(exports2, module2) {
6335
- "use strict";
6336
- var SemVer = require_semver(), parse4 = (version, options2, throwErrors = !1) => {
6337
- if (version instanceof SemVer)
6338
- return version;
6339
- try {
6340
- return new SemVer(version, options2);
6341
- } catch (er) {
6342
- if (!throwErrors)
6343
- return null;
6344
- throw er;
6345
- }
6346
- };
6347
- module2.exports = parse4;
6348
- }
6349
- });
6350
-
6351
- // ../../node_modules/semver/functions/coerce.js
6352
- var require_coerce = __commonJS({
6353
- "../../node_modules/semver/functions/coerce.js"(exports2, module2) {
6354
- "use strict";
6355
- var SemVer = require_semver(), parse4 = require_parse4(), { safeRe: re2, t } = require_re(), coerce = (version, options2) => {
6356
- if (version instanceof SemVer)
6357
- return version;
6358
- if (typeof version == "number" && (version = String(version)), typeof version != "string")
6359
- return null;
6360
- options2 = options2 || {};
6361
- let match = null;
6362
- if (!options2.rtl)
6363
- match = version.match(options2.includePrerelease ? re2[t.COERCEFULL] : re2[t.COERCE]);
6364
- else {
6365
- let coerceRtlRegex = options2.includePrerelease ? re2[t.COERCERTLFULL] : re2[t.COERCERTL], next;
6366
- for (; (next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length); )
6367
- (!match || next.index + next[0].length !== match.index + match[0].length) && (match = next), coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
6368
- coerceRtlRegex.lastIndex = -1;
6369
- }
6370
- if (match === null)
6371
- return null;
6372
- let major = match[2], minor = match[3] || "0", patch2 = match[4] || "0", prerelease = options2.includePrerelease && match[5] ? `-${match[5]}` : "", build = options2.includePrerelease && match[6] ? `+${match[6]}` : "";
6373
- return parse4(`${major}.${minor}.${patch2}${prerelease}${build}`, options2);
6374
- };
6375
- module2.exports = coerce;
6376
- }
6377
- });
6378
-
6379
- // ../../node_modules/semver/functions/compare.js
6380
- var require_compare = __commonJS({
6381
- "../../node_modules/semver/functions/compare.js"(exports2, module2) {
6382
- "use strict";
6383
- var SemVer = require_semver(), compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
6384
- module2.exports = compare;
6385
- }
6386
- });
6387
-
6388
- // ../../node_modules/semver/functions/gte.js
6389
- var require_gte = __commonJS({
6390
- "../../node_modules/semver/functions/gte.js"(exports2, module2) {
6391
- "use strict";
6392
- var compare = require_compare(), gte = (a, b, loose) => compare(a, b, loose) >= 0;
6393
- module2.exports = gte;
6394
- }
6395
- });
6396
-
6397
- // ../../node_modules/semver/internal/lrucache.js
6398
- var require_lrucache = __commonJS({
6399
- "../../node_modules/semver/internal/lrucache.js"(exports2, module2) {
6400
- "use strict";
6401
- var LRUCache = class {
6402
- constructor() {
6403
- this.max = 1e3, this.map = /* @__PURE__ */ new Map();
6404
- }
6405
- get(key2) {
6406
- let value = this.map.get(key2);
6407
- if (value !== void 0)
6408
- return this.map.delete(key2), this.map.set(key2, value), value;
6409
- }
6410
- delete(key2) {
6411
- return this.map.delete(key2);
6412
- }
6413
- set(key2, value) {
6414
- if (!this.delete(key2) && value !== void 0) {
6415
- if (this.map.size >= this.max) {
6416
- let firstKey = this.map.keys().next().value;
6417
- this.delete(firstKey);
6418
- }
6419
- this.map.set(key2, value);
6420
- }
6421
- return this;
6422
- }
6423
- };
6424
- module2.exports = LRUCache;
6425
- }
6426
- });
6427
-
6428
- // ../../node_modules/semver/functions/eq.js
6429
- var require_eq = __commonJS({
6430
- "../../node_modules/semver/functions/eq.js"(exports2, module2) {
6431
- "use strict";
6432
- var compare = require_compare(), eq = (a, b, loose) => compare(a, b, loose) === 0;
6433
- module2.exports = eq;
6434
- }
6435
- });
6436
-
6437
- // ../../node_modules/semver/functions/neq.js
6438
- var require_neq = __commonJS({
6439
- "../../node_modules/semver/functions/neq.js"(exports2, module2) {
6440
- "use strict";
6441
- var compare = require_compare(), neq = (a, b, loose) => compare(a, b, loose) !== 0;
6442
- module2.exports = neq;
6443
- }
6444
- });
6445
-
6446
- // ../../node_modules/semver/functions/gt.js
6447
- var require_gt = __commonJS({
6448
- "../../node_modules/semver/functions/gt.js"(exports2, module2) {
6449
- "use strict";
6450
- var compare = require_compare(), gt = (a, b, loose) => compare(a, b, loose) > 0;
6451
- module2.exports = gt;
6452
- }
6453
- });
6454
-
6455
- // ../../node_modules/semver/functions/lt.js
6456
- var require_lt = __commonJS({
6457
- "../../node_modules/semver/functions/lt.js"(exports2, module2) {
6458
- "use strict";
6459
- var compare = require_compare(), lt = (a, b, loose) => compare(a, b, loose) < 0;
6460
- module2.exports = lt;
6461
- }
6462
- });
6463
-
6464
- // ../../node_modules/semver/functions/lte.js
6465
- var require_lte = __commonJS({
6466
- "../../node_modules/semver/functions/lte.js"(exports2, module2) {
6467
- "use strict";
6468
- var compare = require_compare(), lte = (a, b, loose) => compare(a, b, loose) <= 0;
6469
- module2.exports = lte;
6470
- }
6471
- });
6472
-
6473
- // ../../node_modules/semver/functions/cmp.js
6474
- var require_cmp = __commonJS({
6475
- "../../node_modules/semver/functions/cmp.js"(exports2, module2) {
6476
- "use strict";
6477
- var eq = require_eq(), neq = require_neq(), gt = require_gt(), gte = require_gte(), lt = require_lt(), lte = require_lte(), cmp = (a, op, b, loose) => {
6478
- switch (op) {
6479
- case "===":
6480
- return typeof a == "object" && (a = a.version), typeof b == "object" && (b = b.version), a === b;
6481
- case "!==":
6482
- return typeof a == "object" && (a = a.version), typeof b == "object" && (b = b.version), a !== b;
6483
- case "":
6484
- case "=":
6485
- case "==":
6486
- return eq(a, b, loose);
6487
- case "!=":
6488
- return neq(a, b, loose);
6489
- case ">":
6490
- return gt(a, b, loose);
6491
- case ">=":
6492
- return gte(a, b, loose);
6493
- case "<":
6494
- return lt(a, b, loose);
6495
- case "<=":
6496
- return lte(a, b, loose);
6497
- default:
6498
- throw new TypeError(`Invalid operator: ${op}`);
6499
- }
6500
- };
6501
- module2.exports = cmp;
6502
- }
6503
- });
6504
-
6505
- // ../../node_modules/semver/classes/comparator.js
6506
- var require_comparator = __commonJS({
6507
- "../../node_modules/semver/classes/comparator.js"(exports2, module2) {
6508
- "use strict";
6509
- var ANY = Symbol("SemVer ANY"), Comparator = class _Comparator {
6510
- static get ANY() {
6511
- return ANY;
6512
- }
6513
- constructor(comp, options2) {
6514
- if (options2 = parseOptions(options2), comp instanceof _Comparator) {
6515
- if (comp.loose === !!options2.loose)
6516
- return comp;
6517
- comp = comp.value;
6518
- }
6519
- comp = comp.trim().split(/\s+/).join(" "), debug("comparator", comp, options2), this.options = options2, this.loose = !!options2.loose, this.parse(comp), this.semver === ANY ? this.value = "" : this.value = this.operator + this.semver.version, debug("comp", this);
6520
- }
6521
- parse(comp) {
6522
- let r2 = this.options.loose ? re2[t.COMPARATORLOOSE] : re2[t.COMPARATOR], m = comp.match(r2);
6523
- if (!m)
6524
- throw new TypeError(`Invalid comparator: ${comp}`);
6525
- this.operator = m[1] !== void 0 ? m[1] : "", this.operator === "=" && (this.operator = ""), m[2] ? this.semver = new SemVer(m[2], this.options.loose) : this.semver = ANY;
6526
- }
6527
- toString() {
6528
- return this.value;
6529
- }
6530
- test(version) {
6531
- if (debug("Comparator.test", version, this.options.loose), this.semver === ANY || version === ANY)
6532
- return !0;
6533
- if (typeof version == "string")
6534
- try {
6535
- version = new SemVer(version, this.options);
6536
- } catch {
6537
- return !1;
6538
- }
6539
- return cmp(version, this.operator, this.semver, this.options);
6540
- }
6541
- intersects(comp, options2) {
6542
- if (!(comp instanceof _Comparator))
6543
- throw new TypeError("a Comparator is required");
6544
- return this.operator === "" ? this.value === "" ? !0 : new Range(comp.value, options2).test(this.value) : comp.operator === "" ? comp.value === "" ? !0 : new Range(this.value, options2).test(comp.semver) : (options2 = parseOptions(options2), options2.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0") || !options2.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && comp.operator.startsWith(">") || this.operator.startsWith("<") && comp.operator.startsWith("<") || this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=") || cmp(this.semver, "<", comp.semver, options2) && this.operator.startsWith(">") && comp.operator.startsWith("<") || cmp(this.semver, ">", comp.semver, options2) && this.operator.startsWith("<") && comp.operator.startsWith(">")));
6545
- }
6546
- };
6547
- module2.exports = Comparator;
6548
- var parseOptions = require_parse_options(), { safeRe: re2, t } = require_re(), cmp = require_cmp(), debug = require_debug(), SemVer = require_semver(), Range = require_range();
6549
- }
6550
- });
6551
-
6552
- // ../../node_modules/semver/classes/range.js
6553
- var require_range = __commonJS({
6554
- "../../node_modules/semver/classes/range.js"(exports2, module2) {
6555
- "use strict";
6556
- var SPACE_CHARACTERS = /\s+/g, Range = class _Range {
6557
- constructor(range, options2) {
6558
- if (options2 = parseOptions(options2), range instanceof _Range)
6559
- return range.loose === !!options2.loose && range.includePrerelease === !!options2.includePrerelease ? range : new _Range(range.raw, options2);
6560
- if (range instanceof Comparator)
6561
- return this.raw = range.value, this.set = [[range]], this.formatted = void 0, this;
6562
- if (this.options = options2, this.loose = !!options2.loose, this.includePrerelease = !!options2.includePrerelease, this.raw = range.trim().replace(SPACE_CHARACTERS, " "), this.set = this.raw.split("||").map((r2) => this.parseRange(r2.trim())).filter((c2) => c2.length), !this.set.length)
6563
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
6564
- if (this.set.length > 1) {
6565
- let first = this.set[0];
6566
- if (this.set = this.set.filter((c2) => !isNullSet(c2[0])), this.set.length === 0)
6567
- this.set = [first];
6568
- else if (this.set.length > 1) {
6569
- for (let c2 of this.set)
6570
- if (c2.length === 1 && isAny(c2[0])) {
6571
- this.set = [c2];
6572
- break;
6573
- }
6574
- }
6575
- }
6576
- this.formatted = void 0;
6577
- }
6578
- get range() {
6579
- if (this.formatted === void 0) {
6580
- this.formatted = "";
6581
- for (let i = 0; i < this.set.length; i++) {
6582
- i > 0 && (this.formatted += "||");
6583
- let comps = this.set[i];
6584
- for (let k = 0; k < comps.length; k++)
6585
- k > 0 && (this.formatted += " "), this.formatted += comps[k].toString().trim();
6586
- }
6587
- }
6588
- return this.formatted;
6589
- }
6590
- format() {
6591
- return this.range;
6592
- }
6593
- toString() {
6594
- return this.range;
6595
- }
6596
- parseRange(range) {
6597
- let memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range, cached = cache.get(memoKey);
6598
- if (cached)
6599
- return cached;
6600
- let loose = this.options.loose, hr = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
6601
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease)), debug("hyphen replace", range), range = range.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace), debug("comparator trim", range), range = range.replace(re2[t.TILDETRIM], tildeTrimReplace), debug("tilde trim", range), range = range.replace(re2[t.CARETTRIM], caretTrimReplace), debug("caret trim", range);
6602
- let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
6603
- loose && (rangeList = rangeList.filter((comp) => (debug("loose invalid filter", comp, this.options), !!comp.match(re2[t.COMPARATORLOOSE])))), debug("range list", rangeList);
6604
- let rangeMap = /* @__PURE__ */ new Map(), comparators = rangeList.map((comp) => new Comparator(comp, this.options));
6605
- for (let comp of comparators) {
6606
- if (isNullSet(comp))
6607
- return [comp];
6608
- rangeMap.set(comp.value, comp);
6609
- }
6610
- rangeMap.size > 1 && rangeMap.has("") && rangeMap.delete("");
6611
- let result = [...rangeMap.values()];
6612
- return cache.set(memoKey, result), result;
6613
- }
6614
- intersects(range, options2) {
6615
- if (!(range instanceof _Range))
6616
- throw new TypeError("a Range is required");
6617
- return this.set.some((thisComparators) => isSatisfiable(thisComparators, options2) && range.set.some((rangeComparators) => isSatisfiable(rangeComparators, options2) && thisComparators.every((thisComparator) => rangeComparators.every((rangeComparator) => thisComparator.intersects(rangeComparator, options2)))));
6618
- }
6619
- // if ANY of the sets match ALL of its comparators, then pass
6620
- test(version) {
6621
- if (!version)
6622
- return !1;
6623
- if (typeof version == "string")
6624
- try {
6625
- version = new SemVer(version, this.options);
6626
- } catch {
6627
- return !1;
6628
- }
6629
- for (let i = 0; i < this.set.length; i++)
6630
- if (testSet(this.set[i], version, this.options))
6631
- return !0;
6632
- return !1;
6633
- }
6634
- };
6635
- module2.exports = Range;
6636
- var LRU = require_lrucache(), cache = new LRU(), parseOptions = require_parse_options(), Comparator = require_comparator(), debug = require_debug(), SemVer = require_semver(), {
6637
- safeRe: re2,
6638
- t,
6639
- comparatorTrimReplace,
6640
- tildeTrimReplace,
6641
- caretTrimReplace
6642
- } = require_re(), { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants4(), isNullSet = (c2) => c2.value === "<0.0.0-0", isAny = (c2) => c2.value === "", isSatisfiable = (comparators, options2) => {
6643
- let result = !0, remainingComparators = comparators.slice(), testComparator = remainingComparators.pop();
6644
- for (; result && remainingComparators.length; )
6645
- result = remainingComparators.every((otherComparator) => testComparator.intersects(otherComparator, options2)), testComparator = remainingComparators.pop();
6646
- return result;
6647
- }, parseComparator = (comp, options2) => (debug("comp", comp, options2), comp = replaceCarets(comp, options2), debug("caret", comp), comp = replaceTildes(comp, options2), debug("tildes", comp), comp = replaceXRanges(comp, options2), debug("xrange", comp), comp = replaceStars(comp, options2), debug("stars", comp), comp), isX = (id) => !id || id.toLowerCase() === "x" || id === "*", replaceTildes = (comp, options2) => comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options2)).join(" "), replaceTilde = (comp, options2) => {
6648
- let r2 = options2.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
6649
- return comp.replace(r2, (_2, M, m, p2, pr) => {
6650
- debug("tilde", comp, _2, M, m, p2, pr);
6651
- let ret;
6652
- return isX(M) ? ret = "" : isX(m) ? ret = `>=${M}.0.0 <${+M + 1}.0.0-0` : isX(p2) ? ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` : pr ? (debug("replaceTilde pr", pr), ret = `>=${M}.${m}.${p2}-${pr} <${M}.${+m + 1}.0-0`) : ret = `>=${M}.${m}.${p2} <${M}.${+m + 1}.0-0`, debug("tilde return", ret), ret;
6653
- });
6654
- }, replaceCarets = (comp, options2) => comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options2)).join(" "), replaceCaret = (comp, options2) => {
6655
- debug("caret", comp, options2);
6656
- let r2 = options2.loose ? re2[t.CARETLOOSE] : re2[t.CARET], z = options2.includePrerelease ? "-0" : "";
6657
- return comp.replace(r2, (_2, M, m, p2, pr) => {
6658
- debug("caret", comp, _2, M, m, p2, pr);
6659
- let ret;
6660
- return isX(M) ? ret = "" : isX(m) ? ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` : isX(p2) ? M === "0" ? ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` : pr ? (debug("replaceCaret pr", pr), M === "0" ? m === "0" ? ret = `>=${M}.${m}.${p2}-${pr} <${M}.${m}.${+p2 + 1}-0` : ret = `>=${M}.${m}.${p2}-${pr} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.${p2}-${pr} <${+M + 1}.0.0-0`) : (debug("no pr"), M === "0" ? m === "0" ? ret = `>=${M}.${m}.${p2}${z} <${M}.${m}.${+p2 + 1}-0` : ret = `>=${M}.${m}.${p2}${z} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.${p2} <${+M + 1}.0.0-0`), debug("caret return", ret), ret;
6661
- });
6662
- }, replaceXRanges = (comp, options2) => (debug("replaceXRanges", comp, options2), comp.split(/\s+/).map((c2) => replaceXRange(c2, options2)).join(" ")), replaceXRange = (comp, options2) => {
6663
- comp = comp.trim();
6664
- let r2 = options2.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
6665
- return comp.replace(r2, (ret, gtlt, M, m, p2, pr) => {
6666
- debug("xRange", comp, ret, gtlt, M, m, p2, pr);
6667
- let xM = isX(M), xm = xM || isX(m), xp = xm || isX(p2), anyX = xp;
6668
- return gtlt === "=" && anyX && (gtlt = ""), pr = options2.includePrerelease ? "-0" : "", xM ? gtlt === ">" || gtlt === "<" ? ret = "<0.0.0-0" : ret = "*" : gtlt && anyX ? (xm && (m = 0), p2 = 0, gtlt === ">" ? (gtlt = ">=", xm ? (M = +M + 1, m = 0, p2 = 0) : (m = +m + 1, p2 = 0)) : gtlt === "<=" && (gtlt = "<", xm ? M = +M + 1 : m = +m + 1), gtlt === "<" && (pr = "-0"), ret = `${gtlt + M}.${m}.${p2}${pr}`) : xm ? ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` : xp && (ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`), debug("xRange return", ret), ret;
6669
- });
6670
- }, replaceStars = (comp, options2) => (debug("replaceStars", comp, options2), comp.trim().replace(re2[t.STAR], "")), replaceGTE0 = (comp, options2) => (debug("replaceGTE0", comp, options2), comp.trim().replace(re2[options2.includePrerelease ? t.GTE0PRE : t.GTE0], "")), hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => (isX(fM) ? from = "" : isX(fm) ? from = `>=${fM}.0.0${incPr ? "-0" : ""}` : isX(fp) ? from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}` : fpr ? from = `>=${from}` : from = `>=${from}${incPr ? "-0" : ""}`, isX(tM) ? to = "" : isX(tm) ? to = `<${+tM + 1}.0.0-0` : isX(tp) ? to = `<${tM}.${+tm + 1}.0-0` : tpr ? to = `<=${tM}.${tm}.${tp}-${tpr}` : incPr ? to = `<${tM}.${tm}.${+tp + 1}-0` : to = `<=${to}`, `${from} ${to}`.trim()), testSet = (set, version, options2) => {
6671
- for (let i = 0; i < set.length; i++)
6672
- if (!set[i].test(version))
6673
- return !1;
6674
- if (version.prerelease.length && !options2.includePrerelease) {
6675
- for (let i = 0; i < set.length; i++)
6676
- if (debug(set[i].semver), set[i].semver !== Comparator.ANY && set[i].semver.prerelease.length > 0) {
6677
- let allowed = set[i].semver;
6678
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch)
6679
- return !0;
6680
- }
6681
- return !1;
6682
- }
6683
- return !0;
6684
- };
6685
- }
6686
- });
6687
-
6688
- // ../../node_modules/semver/functions/satisfies.js
6689
- var require_satisfies = __commonJS({
6690
- "../../node_modules/semver/functions/satisfies.js"(exports2, module2) {
6691
- "use strict";
6692
- var Range = require_range(), satisfies = (version, range, options2) => {
6693
- try {
6694
- range = new Range(range, options2);
6695
- } catch {
6696
- return !1;
6697
- }
6698
- return range.test(version);
6699
- };
6700
- module2.exports = satisfies;
6701
- }
6702
- });
6703
-
6704
- // ../../node_modules/sharp/package.json
6705
- var require_package = __commonJS({
6706
- "../../node_modules/sharp/package.json"(exports2, module2) {
6707
- module2.exports = {
6708
- name: "sharp",
6709
- description: "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
6710
- version: "0.33.5",
6711
- author: "Lovell Fuller <npm@lovell.info>",
6712
- homepage: "https://sharp.pixelplumbing.com",
6713
- contributors: [
6714
- "Pierre Inglebert <pierre.inglebert@gmail.com>",
6715
- "Jonathan Ong <jonathanrichardong@gmail.com>",
6716
- "Chanon Sajjamanochai <chanon.s@gmail.com>",
6717
- "Juliano Julio <julianojulio@gmail.com>",
6718
- "Daniel Gasienica <daniel@gasienica.ch>",
6719
- "Julian Walker <julian@fiftythree.com>",
6720
- "Amit Pitaru <pitaru.amit@gmail.com>",
6721
- "Brandon Aaron <hello.brandon@aaron.sh>",
6722
- "Andreas Lind <andreas@one.com>",
6723
- "Maurus Cuelenaere <mcuelenaere@gmail.com>",
6724
- "Linus Unneb\xE4ck <linus@folkdatorn.se>",
6725
- "Victor Mateevitsi <mvictoras@gmail.com>",
6726
- "Alaric Holloway <alaric.holloway@gmail.com>",
6727
- "Bernhard K. Weisshuhn <bkw@codingforce.com>",
6728
- "Chris Riley <criley@primedia.com>",
6729
- "David Carley <dacarley@gmail.com>",
6730
- "John Tobin <john@limelightmobileinc.com>",
6731
- "Kenton Gray <kentongray@gmail.com>",
6732
- "Felix B\xFCnemann <Felix.Buenemann@gmail.com>",
6733
- "Samy Al Zahrani <samyalzahrany@gmail.com>",
6734
- "Chintan Thakkar <lemnisk8@gmail.com>",
6735
- "F. Orlando Galashan <frulo@gmx.de>",
6736
- "Kleis Auke Wolthuizen <info@kleisauke.nl>",
6737
- "Matt Hirsch <mhirsch@media.mit.edu>",
6738
- "Matthias Thoemmes <thoemmes@gmail.com>",
6739
- "Patrick Paskaris <patrick@paskaris.gr>",
6740
- "J\xE9r\xE9my Lal <kapouer@melix.org>",
6741
- "Rahul Nanwani <r.nanwani@gmail.com>",
6742
- "Alice Monday <alice0meta@gmail.com>",
6743
- "Kristo Jorgenson <kristo.jorgenson@gmail.com>",
6744
- "YvesBos <yves_bos@outlook.com>",
6745
- "Guy Maliar <guy@tailorbrands.com>",
6746
- "Nicolas Coden <nicolas@ncoden.fr>",
6747
- "Matt Parrish <matt.r.parrish@gmail.com>",
6748
- "Marcel Bretschneider <marcel.bretschneider@gmail.com>",
6749
- "Matthew McEachen <matthew+github@mceachen.org>",
6750
- "Jarda Kot\u011B\u0161ovec <jarda.kotesovec@gmail.com>",
6751
- "Kenric D'Souza <kenric.dsouza@gmail.com>",
6752
- "Oleh Aleinyk <oleg.aleynik@gmail.com>",
6753
- "Marcel Bretschneider <marcel.bretschneider@gmail.com>",
6754
- "Andrea Bianco <andrea.bianco@unibas.ch>",
6755
- "Rik Heywood <rik@rik.org>",
6756
- "Thomas Parisot <hi@oncletom.io>",
6757
- "Nathan Graves <nathanrgraves+github@gmail.com>",
6758
- "Tom Lokhorst <tom@lokhorst.eu>",
6759
- "Espen Hovlandsdal <espen@hovlandsdal.com>",
6760
- "Sylvain Dumont <sylvain.dumont35@gmail.com>",
6761
- "Alun Davies <alun.owain.davies@googlemail.com>",
6762
- "Aidan Hoolachan <ajhoolachan21@gmail.com>",
6763
- "Axel Eirola <axel.eirola@iki.fi>",
6764
- "Freezy <freezy@xbmc.org>",
6765
- "Daiz <taneli.vatanen@gmail.com>",
6766
- "Julian Aubourg <j@ubourg.net>",
6767
- "Keith Belovay <keith@picthrive.com>",
6768
- "Michael B. Klein <mbklein@gmail.com>",
6769
- "Jordan Prudhomme <jordan@raboland.fr>",
6770
- "Ilya Ovdin <iovdin@gmail.com>",
6771
- "Andargor <andargor@yahoo.com>",
6772
- "Paul Neave <paul.neave@gmail.com>",
6773
- "Brendan Kennedy <brenwken@gmail.com>",
6774
- "Brychan Bennett-Odlum <git@brychan.io>",
6775
- "Edward Silverton <e.silverton@gmail.com>",
6776
- "Roman Malieiev <aromaleev@gmail.com>",
6777
- "Tomas Szabo <tomas.szabo@deftomat.com>",
6778
- "Robert O'Rourke <robert@o-rourke.org>",
6779
- "Guillermo Alfonso Varela Chouci\xF1o <guillevch@gmail.com>",
6780
- "Christian Flintrup <chr@gigahost.dk>",
6781
- "Manan Jadhav <manan@motionden.com>",
6782
- "Leon Radley <leon@radley.se>",
6783
- "alza54 <alza54@thiocod.in>",
6784
- "Jacob Smith <jacob@frende.me>",
6785
- "Michael Nutt <michael@nutt.im>",
6786
- "Brad Parham <baparham@gmail.com>",
6787
- "Taneli Vatanen <taneli.vatanen@gmail.com>",
6788
- "Joris Dugu\xE9 <zaruike10@gmail.com>",
6789
- "Chris Banks <christopher.bradley.banks@gmail.com>",
6790
- "Ompal Singh <ompal.hitm09@gmail.com>",
6791
- "Brodan <christopher.hranj@gmail.com>",
6792
- "Ankur Parihar <ankur.github@gmail.com>",
6793
- "Brahim Ait elhaj <brahima@gmail.com>",
6794
- "Mart Jansink <m.jansink@gmail.com>",
6795
- "Lachlan Newman <lachnewman007@gmail.com>",
6796
- "Dennis Beatty <dennis@dcbeatty.com>",
6797
- "Ingvar Stepanyan <me@rreverser.com>",
6798
- "Don Denton <don@happycollision.com>"
6799
- ],
6800
- scripts: {
6801
- install: "node install/check",
6802
- clean: "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
6803
- test: "npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types",
6804
- "test-lint": "semistandard && cpplint",
6805
- "test-unit": "nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha",
6806
- "test-licensing": 'license-checker --production --summary --onlyAllow="Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT"',
6807
- "test-leak": "./test/leak/leak.sh",
6808
- "test-types": "tsd",
6809
- "package-from-local-build": "node npm/from-local-build",
6810
- "package-from-github-release": "node npm/from-github-release",
6811
- "docs-build": "node docs/build && node docs/search-index/build",
6812
- "docs-serve": "cd docs && npx serve",
6813
- "docs-publish": "cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"
6814
- },
6815
- type: "commonjs",
6816
- main: "lib/index.js",
6817
- types: "lib/index.d.ts",
6818
- files: [
6819
- "install",
6820
- "lib",
6821
- "src/*.{cc,h,gyp}"
6822
- ],
6823
- repository: {
6824
- type: "git",
6825
- url: "git://github.com/lovell/sharp.git"
6826
- },
6827
- keywords: [
6828
- "jpeg",
6829
- "png",
6830
- "webp",
6831
- "avif",
6832
- "tiff",
6833
- "gif",
6834
- "svg",
6835
- "jp2",
6836
- "dzi",
6837
- "image",
6838
- "resize",
6839
- "thumbnail",
6840
- "crop",
6841
- "embed",
6842
- "libvips",
6843
- "vips"
6844
- ],
6845
- dependencies: {
6846
- color: "^4.2.3",
6847
- "detect-libc": "^2.0.3",
6848
- semver: "^7.6.3"
6849
- },
6850
- optionalDependencies: {
6851
- "@img/sharp-darwin-arm64": "0.33.5",
6852
- "@img/sharp-darwin-x64": "0.33.5",
6853
- "@img/sharp-libvips-darwin-arm64": "1.0.4",
6854
- "@img/sharp-libvips-darwin-x64": "1.0.4",
6855
- "@img/sharp-libvips-linux-arm": "1.0.5",
6856
- "@img/sharp-libvips-linux-arm64": "1.0.4",
6857
- "@img/sharp-libvips-linux-s390x": "1.0.4",
6858
- "@img/sharp-libvips-linux-x64": "1.0.4",
6859
- "@img/sharp-libvips-linuxmusl-arm64": "1.0.4",
6860
- "@img/sharp-libvips-linuxmusl-x64": "1.0.4",
6861
- "@img/sharp-linux-arm": "0.33.5",
6862
- "@img/sharp-linux-arm64": "0.33.5",
6863
- "@img/sharp-linux-s390x": "0.33.5",
6864
- "@img/sharp-linux-x64": "0.33.5",
6865
- "@img/sharp-linuxmusl-arm64": "0.33.5",
6866
- "@img/sharp-linuxmusl-x64": "0.33.5",
6867
- "@img/sharp-wasm32": "0.33.5",
6868
- "@img/sharp-win32-ia32": "0.33.5",
6869
- "@img/sharp-win32-x64": "0.33.5"
6870
- },
6871
- devDependencies: {
6872
- "@emnapi/runtime": "^1.2.0",
6873
- "@img/sharp-libvips-dev": "1.0.4",
6874
- "@img/sharp-libvips-dev-wasm32": "1.0.5",
6875
- "@img/sharp-libvips-win32-ia32": "1.0.4",
6876
- "@img/sharp-libvips-win32-x64": "1.0.4",
6877
- "@types/node": "*",
6878
- async: "^3.2.5",
6879
- cc: "^3.0.1",
6880
- emnapi: "^1.2.0",
6881
- "exif-reader": "^2.0.1",
6882
- "extract-zip": "^2.0.1",
6883
- icc: "^3.0.0",
6884
- "jsdoc-to-markdown": "^8.0.3",
6885
- "license-checker": "^25.0.1",
6886
- mocha: "^10.7.3",
6887
- "node-addon-api": "^8.1.0",
6888
- nyc: "^17.0.0",
6889
- prebuild: "^13.0.1",
6890
- semistandard: "^17.0.0",
6891
- "tar-fs": "^3.0.6",
6892
- tsd: "^0.31.1"
6893
- },
6894
- license: "Apache-2.0",
6895
- engines: {
6896
- node: "^18.17.0 || ^20.3.0 || >=21.0.0"
6897
- },
6898
- config: {
6899
- libvips: ">=8.15.3"
6900
- },
6901
- funding: {
6902
- url: "https://opencollective.com/libvips"
6903
- },
6904
- binary: {
6905
- napi_versions: [
6906
- 9
6907
- ]
6908
- },
6909
- semistandard: {
6910
- env: [
6911
- "mocha"
6912
- ]
6913
- },
6914
- cc: {
6915
- linelength: "120",
6916
- filter: [
6917
- "build/include"
6918
- ]
6919
- },
6920
- nyc: {
6921
- include: [
6922
- "lib"
6923
- ]
6924
- },
6925
- tsd: {
6926
- directory: "test/types/"
6927
- }
6928
- };
6929
- }
6930
- });
6931
-
6932
- // ../../node_modules/sharp/lib/libvips.js
6933
- var require_libvips = __commonJS({
6934
- "../../node_modules/sharp/lib/libvips.js"(exports2, module2) {
6935
- "use strict";
6936
- var { spawnSync } = require("node:child_process"), { createHash } = require("node:crypto"), semverCoerce = require_coerce(), semverGreaterThanOrEqualTo = require_gte(), semverSatisfies = require_satisfies(), detectLibc = require_detect_libc(), { config, engines: engines2, optionalDependencies } = require_package(), minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || /* istanbul ignore next */
6937
- config.libvips, minimumLibvipsVersion = semverCoerce(minimumLibvipsVersionLabelled).version, prebuiltPlatforms = [
6938
- "darwin-arm64",
6939
- "darwin-x64",
6940
- "linux-arm",
6941
- "linux-arm64",
6942
- "linux-s390x",
6943
- "linux-x64",
6944
- "linuxmusl-arm64",
6945
- "linuxmusl-x64",
6946
- "win32-ia32",
6947
- "win32-x64"
6948
- ], spawnSyncOptions = {
6949
- encoding: "utf8",
6950
- shell: !0
6951
- }, log = (item) => {
6952
- item instanceof Error ? console.error(`sharp: Installation error: ${item.message}`) : console.log(`sharp: ${item}`);
6953
- }, runtimeLibc = () => detectLibc.isNonGlibcLinuxSync() ? detectLibc.familySync() : "", runtimePlatformArch = () => `${process.platform}${runtimeLibc()}-${process.arch}`, buildPlatformArch = () => {
6954
- if (isEmscripten())
6955
- return "wasm32";
6956
- let { npm_config_arch, npm_config_platform, npm_config_libc } = process.env, libc = typeof npm_config_libc == "string" ? npm_config_libc : runtimeLibc();
6957
- return `${npm_config_platform || process.platform}${libc}-${npm_config_arch || process.arch}`;
6958
- }, buildSharpLibvipsIncludeDir = () => {
6959
- try {
6960
- return require(`@img/sharp-libvips-dev-${buildPlatformArch()}/include`);
6961
- } catch {
6962
- try {
6963
- return require("@img/sharp-libvips-dev/include");
6964
- } catch {
6965
- }
6966
- }
6967
- return "";
6968
- }, buildSharpLibvipsCPlusPlusDir = () => {
6969
- try {
6970
- return require("@img/sharp-libvips-dev/cplusplus");
6971
- } catch {
6972
- }
6973
- return "";
6974
- }, buildSharpLibvipsLibDir = () => {
6975
- try {
6976
- return require(`@img/sharp-libvips-dev-${buildPlatformArch()}/lib`);
6977
- } catch {
6978
- try {
6979
- return require(`@img/sharp-libvips-${buildPlatformArch()}/lib`);
6980
- } catch {
6981
- }
6982
- }
6983
- return "";
6984
- }, isUnsupportedNodeRuntime = () => {
6985
- if (process.release?.name === "node" && process.versions && !semverSatisfies(process.versions.node, engines2.node))
6986
- return { found: process.versions.node, expected: engines2.node };
6987
- }, isEmscripten = () => {
6988
- let { CC } = process.env;
6989
- return !!(CC && CC.endsWith("/emcc"));
6990
- }, isRosetta = () => process.platform === "darwin" && process.arch === "x64" ? (spawnSync("sysctl sysctl.proc_translated", spawnSyncOptions).stdout || "").trim() === "sysctl.proc_translated: 1" : !1, sha512 = (s2) => createHash("sha512").update(s2).digest("hex"), yarnLocator = () => {
6991
- try {
6992
- let identHash = sha512(`imgsharp-libvips-${buildPlatformArch()}`), npmVersion = semverCoerce(optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`]).version;
6993
- return sha512(`${identHash}npm:${npmVersion}`).slice(0, 10);
6994
- } catch {
6995
- }
6996
- return "";
6997
- }, spawnRebuild = () => spawnSync(`node-gyp rebuild --directory=src ${isEmscripten() ? "--nodedir=emscripten" : ""}`, {
6998
- ...spawnSyncOptions,
6999
- stdio: "inherit"
7000
- }).status, globalLibvipsVersion = () => process.platform !== "win32" ? (spawnSync("pkg-config --modversion vips-cpp", {
7001
- ...spawnSyncOptions,
7002
- env: {
7003
- ...process.env,
7004
- PKG_CONFIG_PATH: pkgConfigPath()
7005
- }
7006
- }).stdout || "").trim() : "", pkgConfigPath = () => process.platform !== "win32" ? [
7007
- (spawnSync(
7008
- 'which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',
7009
- spawnSyncOptions
7010
- ).stdout || "").trim(),
7011
- process.env.PKG_CONFIG_PATH,
7012
- "/usr/local/lib/pkgconfig",
7013
- "/usr/lib/pkgconfig",
7014
- "/usr/local/libdata/pkgconfig",
7015
- "/usr/libdata/pkgconfig"
7016
- ].filter(Boolean).join(":") : "", skipSearch = (status, reason, logger) => (logger && logger(`Detected ${reason}, skipping search for globally-installed libvips`), status), useGlobalLibvips = (logger) => {
7017
- if (process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)
7018
- return skipSearch(!1, "SHARP_IGNORE_GLOBAL_LIBVIPS", logger);
7019
- if (process.env.SHARP_FORCE_GLOBAL_LIBVIPS)
7020
- return skipSearch(!0, "SHARP_FORCE_GLOBAL_LIBVIPS", logger);
7021
- if (isRosetta())
7022
- return skipSearch(!1, "Rosetta", logger);
7023
- let globalVipsVersion = globalLibvipsVersion();
7024
- return !!globalVipsVersion && /* istanbul ignore next */
7025
- semverGreaterThanOrEqualTo(globalVipsVersion, minimumLibvipsVersion);
7026
- };
7027
- module2.exports = {
7028
- minimumLibvipsVersion,
7029
- prebuiltPlatforms,
7030
- buildPlatformArch,
7031
- buildSharpLibvipsIncludeDir,
7032
- buildSharpLibvipsCPlusPlusDir,
7033
- buildSharpLibvipsLibDir,
7034
- isUnsupportedNodeRuntime,
7035
- runtimePlatformArch,
7036
- log,
7037
- yarnLocator,
7038
- spawnRebuild,
7039
- globalLibvipsVersion,
7040
- pkgConfigPath,
7041
- useGlobalLibvips
7042
- };
7043
- }
7044
- });
7045
-
7046
- // ../../node_modules/sharp/lib/sharp.js
7047
- var require_sharp = __commonJS({
7048
- "../../node_modules/sharp/lib/sharp.js"(exports2, module2) {
7049
- "use strict";
7050
- var { familySync, versionSync } = require_detect_libc(), { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } = require_libvips(), runtimePlatform = runtimePlatformArch(), paths = [
7051
- `../src/build/Release/sharp-${runtimePlatform}.node`,
7052
- "../src/build/Release/sharp-wasm32.node",
7053
- `@img/sharp-${runtimePlatform}/sharp.node`,
7054
- "@img/sharp-wasm32/sharp.node"
7055
- ], sharp, errors2 = [];
7056
- for (let path5 of paths)
7057
- try {
7058
- sharp = require(path5);
7059
- break;
7060
- } catch (err) {
7061
- errors2.push(err);
7062
- }
7063
- if (sharp)
7064
- module2.exports = sharp;
7065
- else {
7066
- let [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os) => runtimePlatform.startsWith(os)), help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
7067
- errors2.forEach((err) => {
7068
- err.code !== "MODULE_NOT_FOUND" && help.push(`${err.code}: ${err.message}`);
7069
- });
7070
- let messages2 = errors2.map((err) => err.message).join(" ");
7071
- if (help.push("Possible solutions:"), isUnsupportedNodeRuntime()) {
7072
- let { found, expected } = isUnsupportedNodeRuntime();
7073
- help.push(
7074
- "- Please upgrade Node.js:",
7075
- ` Found ${found}`,
7076
- ` Requires ${expected}`
7077
- );
7078
- } else if (prebuiltPlatforms.includes(runtimePlatform)) {
7079
- let [os, cpu] = runtimePlatform.split("-"), libc = os.endsWith("musl") ? " --libc=musl" : "";
7080
- help.push(
7081
- "- Ensure optional dependencies can be installed:",
7082
- " npm install --include=optional sharp",
7083
- "- Ensure your package manager supports multi-platform installation:",
7084
- " See https://sharp.pixelplumbing.com/install#cross-platform",
7085
- "- Add platform-specific dependencies:",
7086
- ` npm install --os=${os.replace("musl", "")}${libc} --cpu=${cpu} sharp`
7087
- );
7088
- } else
7089
- help.push(
7090
- `- Manually install libvips >= ${minimumLibvipsVersion}`,
7091
- "- Add experimental WebAssembly-based dependencies:",
7092
- " npm install --cpu=wasm32 sharp",
7093
- " npm install @img/sharp-wasm32"
7094
- );
7095
- if (isLinux && /(symbol not found|CXXABI_)/i.test(messages2))
7096
- try {
7097
- let { config } = require(`@img/sharp-libvips-${runtimePlatform}/package`), libcFound = `${familySync()} ${versionSync()}`, libcRequires = `${config.musl ? "musl" : "glibc"} ${config.musl || config.glibc}`;
7098
- help.push(
7099
- "- Update your OS:",
7100
- ` Found ${libcFound}`,
7101
- ` Requires ${libcRequires}`
7102
- );
7103
- } catch {
7104
- }
7105
- throw isLinux && /\/snap\/core[0-9]{2}/.test(messages2) && help.push(
7106
- "- Remove the Node.js Snap, which does not support native modules",
7107
- " snap remove node"
7108
- ), isMacOs && /Incompatible library version/.test(messages2) && help.push(
7109
- "- Update Homebrew:",
7110
- " brew update && brew upgrade vips"
7111
- ), errors2.some((err) => err.code === "ERR_DLOPEN_DISABLED") && help.push("- Run Node.js without using the --no-addons flag"), isWindows && /The specified procedure could not be found/.test(messages2) && help.push(
7112
- "- Using the canvas package on Windows?",
7113
- " See https://sharp.pixelplumbing.com/install#canvas-and-windows",
7114
- "- Check for outdated versions of sharp in the dependency tree:",
7115
- " npm ls sharp"
7116
- ), help.push(
7117
- "- Consult the installation documentation:",
7118
- " See https://sharp.pixelplumbing.com/install"
7119
- ), new Error(help.join(`
7120
- `));
7121
- }
7122
- }
7123
- });
7124
-
7125
- // ../../node_modules/sharp/lib/constructor.js
7126
- var require_constructor = __commonJS({
7127
- "../../node_modules/sharp/lib/constructor.js"(exports2, module2) {
7128
- "use strict";
7129
- var util = require("node:util"), stream = require("node:stream"), is4 = require_is();
7130
- require_sharp();
7131
- var debuglog = util.debuglog("sharp"), Sharp = function(input, options2) {
7132
- if (arguments.length === 1 && !is4.defined(input))
7133
- throw new Error("Invalid input");
7134
- return this instanceof Sharp ? (stream.Duplex.call(this), this.options = {
7135
- // resize options
7136
- topOffsetPre: -1,
7137
- leftOffsetPre: -1,
7138
- widthPre: -1,
7139
- heightPre: -1,
7140
- topOffsetPost: -1,
7141
- leftOffsetPost: -1,
7142
- widthPost: -1,
7143
- heightPost: -1,
7144
- width: -1,
7145
- height: -1,
7146
- canvas: "crop",
7147
- position: 0,
7148
- resizeBackground: [0, 0, 0, 255],
7149
- useExifOrientation: !1,
7150
- angle: 0,
7151
- rotationAngle: 0,
7152
- rotationBackground: [0, 0, 0, 255],
7153
- rotateBeforePreExtract: !1,
7154
- flip: !1,
7155
- flop: !1,
7156
- extendTop: 0,
7157
- extendBottom: 0,
7158
- extendLeft: 0,
7159
- extendRight: 0,
7160
- extendBackground: [0, 0, 0, 255],
7161
- extendWith: "background",
7162
- withoutEnlargement: !1,
7163
- withoutReduction: !1,
7164
- affineMatrix: [],
7165
- affineBackground: [0, 0, 0, 255],
7166
- affineIdx: 0,
7167
- affineIdy: 0,
7168
- affineOdx: 0,
7169
- affineOdy: 0,
7170
- affineInterpolator: this.constructor.interpolators.bilinear,
7171
- kernel: "lanczos3",
7172
- fastShrinkOnLoad: !0,
7173
- // operations
7174
- tint: [-1, 0, 0, 0],
7175
- flatten: !1,
7176
- flattenBackground: [0, 0, 0],
7177
- unflatten: !1,
7178
- negate: !1,
7179
- negateAlpha: !0,
7180
- medianSize: 0,
7181
- blurSigma: 0,
7182
- precision: "integer",
7183
- minAmpl: 0.2,
7184
- sharpenSigma: 0,
7185
- sharpenM1: 1,
7186
- sharpenM2: 2,
7187
- sharpenX1: 2,
7188
- sharpenY2: 10,
7189
- sharpenY3: 20,
7190
- threshold: 0,
7191
- thresholdGrayscale: !0,
7192
- trimBackground: [],
7193
- trimThreshold: -1,
7194
- trimLineArt: !1,
7195
- gamma: 0,
7196
- gammaOut: 0,
7197
- greyscale: !1,
7198
- normalise: !1,
7199
- normaliseLower: 1,
7200
- normaliseUpper: 99,
7201
- claheWidth: 0,
7202
- claheHeight: 0,
7203
- claheMaxSlope: 3,
7204
- brightness: 1,
7205
- saturation: 1,
7206
- hue: 0,
7207
- lightness: 0,
7208
- booleanBufferIn: null,
7209
- booleanFileIn: "",
7210
- joinChannelIn: [],
7211
- extractChannel: -1,
7212
- removeAlpha: !1,
7213
- ensureAlpha: -1,
7214
- colourspace: "srgb",
7215
- colourspacePipeline: "last",
7216
- composite: [],
7217
- // output
7218
- fileOut: "",
7219
- formatOut: "input",
7220
- streamOut: !1,
7221
- keepMetadata: 0,
7222
- withMetadataOrientation: -1,
7223
- withMetadataDensity: 0,
7224
- withIccProfile: "",
7225
- withExif: {},
7226
- withExifMerge: !0,
7227
- resolveWithObject: !1,
7228
- // output format
7229
- jpegQuality: 80,
7230
- jpegProgressive: !1,
7231
- jpegChromaSubsampling: "4:2:0",
7232
- jpegTrellisQuantisation: !1,
7233
- jpegOvershootDeringing: !1,
7234
- jpegOptimiseScans: !1,
7235
- jpegOptimiseCoding: !0,
7236
- jpegQuantisationTable: 0,
7237
- pngProgressive: !1,
7238
- pngCompressionLevel: 6,
7239
- pngAdaptiveFiltering: !1,
7240
- pngPalette: !1,
7241
- pngQuality: 100,
7242
- pngEffort: 7,
7243
- pngBitdepth: 8,
7244
- pngDither: 1,
7245
- jp2Quality: 80,
7246
- jp2TileHeight: 512,
7247
- jp2TileWidth: 512,
7248
- jp2Lossless: !1,
7249
- jp2ChromaSubsampling: "4:4:4",
7250
- webpQuality: 80,
7251
- webpAlphaQuality: 100,
7252
- webpLossless: !1,
7253
- webpNearLossless: !1,
7254
- webpSmartSubsample: !1,
7255
- webpPreset: "default",
7256
- webpEffort: 4,
7257
- webpMinSize: !1,
7258
- webpMixed: !1,
7259
- gifBitdepth: 8,
7260
- gifEffort: 7,
7261
- gifDither: 1,
7262
- gifInterFrameMaxError: 0,
7263
- gifInterPaletteMaxError: 3,
7264
- gifReuse: !0,
7265
- gifProgressive: !1,
7266
- tiffQuality: 80,
7267
- tiffCompression: "jpeg",
7268
- tiffPredictor: "horizontal",
7269
- tiffPyramid: !1,
7270
- tiffMiniswhite: !1,
7271
- tiffBitdepth: 8,
7272
- tiffTile: !1,
7273
- tiffTileHeight: 256,
7274
- tiffTileWidth: 256,
7275
- tiffXres: 1,
7276
- tiffYres: 1,
7277
- tiffResolutionUnit: "inch",
7278
- heifQuality: 50,
7279
- heifLossless: !1,
7280
- heifCompression: "av1",
7281
- heifEffort: 4,
7282
- heifChromaSubsampling: "4:4:4",
7283
- heifBitdepth: 8,
7284
- jxlDistance: 1,
7285
- jxlDecodingTier: 0,
7286
- jxlEffort: 7,
7287
- jxlLossless: !1,
7288
- rawDepth: "uchar",
7289
- tileSize: 256,
7290
- tileOverlap: 0,
7291
- tileContainer: "fs",
7292
- tileLayout: "dz",
7293
- tileFormat: "last",
7294
- tileDepth: "last",
7295
- tileAngle: 0,
7296
- tileSkipBlanks: -1,
7297
- tileBackground: [255, 255, 255, 255],
7298
- tileCentre: !1,
7299
- tileId: "https://example.com/iiif",
7300
- tileBasename: "",
7301
- timeoutSeconds: 0,
7302
- linearA: [],
7303
- linearB: [],
7304
- // Function to notify of libvips warnings
7305
- debuglog: (warning) => {
7306
- this.emit("warning", warning), debuglog(warning);
7307
- },
7308
- // Function to notify of queue length changes
7309
- queueListener: function(queueLength) {
7310
- Sharp.queue.emit("change", queueLength);
7311
- }
7312
- }, this.options.input = this._createInputDescriptor(input, options2, { allowStream: !0 }), this) : new Sharp(input, options2);
7313
- };
7314
- Object.setPrototypeOf(Sharp.prototype, stream.Duplex.prototype);
7315
- Object.setPrototypeOf(Sharp, stream.Duplex);
7316
- function clone() {
7317
- let clone2 = this.constructor.call(), { debuglog: debuglog2, queueListener, ...options2 } = this.options;
7318
- return clone2.options = structuredClone(options2), clone2.options.debuglog = debuglog2, clone2.options.queueListener = queueListener, this._isStreamInput() && this.on("finish", () => {
7319
- this._flattenBufferIn(), clone2.options.input.buffer = this.options.input.buffer, clone2.emit("finish");
7320
- }), clone2;
7321
- }
7322
- Object.assign(Sharp.prototype, { clone });
7323
- module2.exports = Sharp;
7324
- }
7325
- });
7326
-
7327
- // ../../node_modules/color-name/index.js
7328
- var require_color_name = __commonJS({
7329
- "../../node_modules/color-name/index.js"(exports2, module2) {
7330
- "use strict";
7331
- module2.exports = {
7332
- aliceblue: [240, 248, 255],
7333
- antiquewhite: [250, 235, 215],
7334
- aqua: [0, 255, 255],
7335
- aquamarine: [127, 255, 212],
7336
- azure: [240, 255, 255],
7337
- beige: [245, 245, 220],
7338
- bisque: [255, 228, 196],
7339
- black: [0, 0, 0],
7340
- blanchedalmond: [255, 235, 205],
7341
- blue: [0, 0, 255],
7342
- blueviolet: [138, 43, 226],
7343
- brown: [165, 42, 42],
7344
- burlywood: [222, 184, 135],
7345
- cadetblue: [95, 158, 160],
7346
- chartreuse: [127, 255, 0],
7347
- chocolate: [210, 105, 30],
7348
- coral: [255, 127, 80],
7349
- cornflowerblue: [100, 149, 237],
7350
- cornsilk: [255, 248, 220],
7351
- crimson: [220, 20, 60],
7352
- cyan: [0, 255, 255],
7353
- darkblue: [0, 0, 139],
7354
- darkcyan: [0, 139, 139],
7355
- darkgoldenrod: [184, 134, 11],
7356
- darkgray: [169, 169, 169],
7357
- darkgreen: [0, 100, 0],
7358
- darkgrey: [169, 169, 169],
7359
- darkkhaki: [189, 183, 107],
7360
- darkmagenta: [139, 0, 139],
7361
- darkolivegreen: [85, 107, 47],
7362
- darkorange: [255, 140, 0],
7363
- darkorchid: [153, 50, 204],
7364
- darkred: [139, 0, 0],
7365
- darksalmon: [233, 150, 122],
7366
- darkseagreen: [143, 188, 143],
7367
- darkslateblue: [72, 61, 139],
7368
- darkslategray: [47, 79, 79],
7369
- darkslategrey: [47, 79, 79],
7370
- darkturquoise: [0, 206, 209],
7371
- darkviolet: [148, 0, 211],
7372
- deeppink: [255, 20, 147],
7373
- deepskyblue: [0, 191, 255],
7374
- dimgray: [105, 105, 105],
7375
- dimgrey: [105, 105, 105],
7376
- dodgerblue: [30, 144, 255],
7377
- firebrick: [178, 34, 34],
7378
- floralwhite: [255, 250, 240],
7379
- forestgreen: [34, 139, 34],
7380
- fuchsia: [255, 0, 255],
7381
- gainsboro: [220, 220, 220],
7382
- ghostwhite: [248, 248, 255],
7383
- gold: [255, 215, 0],
7384
- goldenrod: [218, 165, 32],
7385
- gray: [128, 128, 128],
7386
- green: [0, 128, 0],
7387
- greenyellow: [173, 255, 47],
7388
- grey: [128, 128, 128],
7389
- honeydew: [240, 255, 240],
7390
- hotpink: [255, 105, 180],
7391
- indianred: [205, 92, 92],
7392
- indigo: [75, 0, 130],
7393
- ivory: [255, 255, 240],
7394
- khaki: [240, 230, 140],
7395
- lavender: [230, 230, 250],
7396
- lavenderblush: [255, 240, 245],
7397
- lawngreen: [124, 252, 0],
7398
- lemonchiffon: [255, 250, 205],
7399
- lightblue: [173, 216, 230],
7400
- lightcoral: [240, 128, 128],
7401
- lightcyan: [224, 255, 255],
7402
- lightgoldenrodyellow: [250, 250, 210],
7403
- lightgray: [211, 211, 211],
7404
- lightgreen: [144, 238, 144],
7405
- lightgrey: [211, 211, 211],
7406
- lightpink: [255, 182, 193],
7407
- lightsalmon: [255, 160, 122],
7408
- lightseagreen: [32, 178, 170],
7409
- lightskyblue: [135, 206, 250],
7410
- lightslategray: [119, 136, 153],
7411
- lightslategrey: [119, 136, 153],
7412
- lightsteelblue: [176, 196, 222],
7413
- lightyellow: [255, 255, 224],
7414
- lime: [0, 255, 0],
7415
- limegreen: [50, 205, 50],
7416
- linen: [250, 240, 230],
7417
- magenta: [255, 0, 255],
7418
- maroon: [128, 0, 0],
7419
- mediumaquamarine: [102, 205, 170],
7420
- mediumblue: [0, 0, 205],
7421
- mediumorchid: [186, 85, 211],
7422
- mediumpurple: [147, 112, 219],
7423
- mediumseagreen: [60, 179, 113],
7424
- mediumslateblue: [123, 104, 238],
7425
- mediumspringgreen: [0, 250, 154],
7426
- mediumturquoise: [72, 209, 204],
7427
- mediumvioletred: [199, 21, 133],
7428
- midnightblue: [25, 25, 112],
7429
- mintcream: [245, 255, 250],
7430
- mistyrose: [255, 228, 225],
7431
- moccasin: [255, 228, 181],
7432
- navajowhite: [255, 222, 173],
7433
- navy: [0, 0, 128],
7434
- oldlace: [253, 245, 230],
7435
- olive: [128, 128, 0],
7436
- olivedrab: [107, 142, 35],
7437
- orange: [255, 165, 0],
7438
- orangered: [255, 69, 0],
7439
- orchid: [218, 112, 214],
7440
- palegoldenrod: [238, 232, 170],
7441
- palegreen: [152, 251, 152],
7442
- paleturquoise: [175, 238, 238],
7443
- palevioletred: [219, 112, 147],
7444
- papayawhip: [255, 239, 213],
7445
- peachpuff: [255, 218, 185],
7446
- peru: [205, 133, 63],
7447
- pink: [255, 192, 203],
7448
- plum: [221, 160, 221],
7449
- powderblue: [176, 224, 230],
7450
- purple: [128, 0, 128],
7451
- rebeccapurple: [102, 51, 153],
7452
- red: [255, 0, 0],
7453
- rosybrown: [188, 143, 143],
7454
- royalblue: [65, 105, 225],
7455
- saddlebrown: [139, 69, 19],
7456
- salmon: [250, 128, 114],
7457
- sandybrown: [244, 164, 96],
7458
- seagreen: [46, 139, 87],
7459
- seashell: [255, 245, 238],
7460
- sienna: [160, 82, 45],
7461
- silver: [192, 192, 192],
7462
- skyblue: [135, 206, 235],
7463
- slateblue: [106, 90, 205],
7464
- slategray: [112, 128, 144],
7465
- slategrey: [112, 128, 144],
7466
- snow: [255, 250, 250],
7467
- springgreen: [0, 255, 127],
7468
- steelblue: [70, 130, 180],
7469
- tan: [210, 180, 140],
7470
- teal: [0, 128, 128],
7471
- thistle: [216, 191, 216],
7472
- tomato: [255, 99, 71],
7473
- turquoise: [64, 224, 208],
7474
- violet: [238, 130, 238],
7475
- wheat: [245, 222, 179],
7476
- white: [255, 255, 255],
7477
- whitesmoke: [245, 245, 245],
7478
- yellow: [255, 255, 0],
7479
- yellowgreen: [154, 205, 50]
7480
- };
7481
- }
7482
- });
7483
-
7484
- // ../../node_modules/simple-swizzle/node_modules/is-arrayish/index.js
7485
- var require_is_arrayish = __commonJS({
7486
- "../../node_modules/simple-swizzle/node_modules/is-arrayish/index.js"(exports2, module2) {
7487
- module2.exports = function(obj) {
7488
- return !obj || typeof obj == "string" ? !1 : obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && (obj.splice instanceof Function || Object.getOwnPropertyDescriptor(obj, obj.length - 1) && obj.constructor.name !== "String");
7489
- };
7490
- }
7491
- });
7492
-
7493
- // ../../node_modules/simple-swizzle/index.js
7494
- var require_simple_swizzle = __commonJS({
7495
- "../../node_modules/simple-swizzle/index.js"(exports2, module2) {
7496
- "use strict";
7497
- var isArrayish = require_is_arrayish(), concat = Array.prototype.concat, slice = Array.prototype.slice, swizzle = module2.exports = function(args) {
7498
- for (var results = [], i = 0, len = args.length; i < len; i++) {
7499
- var arg = args[i];
7500
- isArrayish(arg) ? results = concat.call(results, slice.call(arg)) : results.push(arg);
7501
- }
7502
- return results;
7503
- };
7504
- swizzle.wrap = function(fn) {
7505
- return function() {
7506
- return fn(swizzle(arguments));
7507
- };
7508
- };
7509
- }
7510
- });
7511
-
7512
- // ../../node_modules/color-string/index.js
7513
- var require_color_string = __commonJS({
7514
- "../../node_modules/color-string/index.js"(exports2, module2) {
7515
- var colorNames = require_color_name(), swizzle = require_simple_swizzle(), hasOwnProperty2 = Object.hasOwnProperty, reverseNames = /* @__PURE__ */ Object.create(null);
7516
- for (name in colorNames)
7517
- hasOwnProperty2.call(colorNames, name) && (reverseNames[colorNames[name]] = name);
7518
- var name, cs = module2.exports = {
7519
- to: {},
7520
- get: {}
7521
- };
7522
- cs.get = function(string) {
7523
- var prefix = string.substring(0, 3).toLowerCase(), val, model;
7524
- switch (prefix) {
7525
- case "hsl":
7526
- val = cs.get.hsl(string), model = "hsl";
7527
- break;
7528
- case "hwb":
7529
- val = cs.get.hwb(string), model = "hwb";
7530
- break;
7531
- default:
7532
- val = cs.get.rgb(string), model = "rgb";
7533
- break;
7534
- }
7535
- return val ? { model, value: val } : null;
7536
- };
7537
- cs.get.rgb = function(string) {
7538
- if (!string)
7539
- return null;
7540
- var abbr = /^#([a-f0-9]{3,4})$/i, hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i, rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, keyword = /^(\w+)$/, rgb = [0, 0, 0, 1], match, i, hexAlpha;
7541
- if (match = string.match(hex)) {
7542
- for (hexAlpha = match[2], match = match[1], i = 0; i < 3; i++) {
7543
- var i2 = i * 2;
7544
- rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
7545
- }
7546
- hexAlpha && (rgb[3] = parseInt(hexAlpha, 16) / 255);
7547
- } else if (match = string.match(abbr)) {
7548
- for (match = match[1], hexAlpha = match[3], i = 0; i < 3; i++)
7549
- rgb[i] = parseInt(match[i] + match[i], 16);
7550
- hexAlpha && (rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255);
7551
- } else if (match = string.match(rgba)) {
7552
- for (i = 0; i < 3; i++)
7553
- rgb[i] = parseInt(match[i + 1], 0);
7554
- match[4] && (match[5] ? rgb[3] = parseFloat(match[4]) * 0.01 : rgb[3] = parseFloat(match[4]));
7555
- } else if (match = string.match(per)) {
7556
- for (i = 0; i < 3; i++)
7557
- rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
7558
- match[4] && (match[5] ? rgb[3] = parseFloat(match[4]) * 0.01 : rgb[3] = parseFloat(match[4]));
7559
- } else return (match = string.match(keyword)) ? match[1] === "transparent" ? [0, 0, 0, 0] : hasOwnProperty2.call(colorNames, match[1]) ? (rgb = colorNames[match[1]], rgb[3] = 1, rgb) : null : null;
7560
- for (i = 0; i < 3; i++)
7561
- rgb[i] = clamp(rgb[i], 0, 255);
7562
- return rgb[3] = clamp(rgb[3], 0, 1), rgb;
7563
- };
7564
- cs.get.hsl = function(string) {
7565
- if (!string)
7566
- return null;
7567
- var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, match = string.match(hsl);
7568
- if (match) {
7569
- var alpha = parseFloat(match[4]), h2 = (parseFloat(match[1]) % 360 + 360) % 360, s2 = clamp(parseFloat(match[2]), 0, 100), l = clamp(parseFloat(match[3]), 0, 100), a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
7570
- return [h2, s2, l, a];
7571
- }
7572
- return null;
7573
- };
7574
- cs.get.hwb = function(string) {
7575
- if (!string)
7576
- return null;
7577
- var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, match = string.match(hwb);
7578
- if (match) {
7579
- var alpha = parseFloat(match[4]), h2 = (parseFloat(match[1]) % 360 + 360) % 360, w = clamp(parseFloat(match[2]), 0, 100), b = clamp(parseFloat(match[3]), 0, 100), a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
7580
- return [h2, w, b, a];
7581
- }
7582
- return null;
7583
- };
7584
- cs.to.hex = function() {
7585
- var rgba = swizzle(arguments);
7586
- return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
7587
- };
7588
- cs.to.rgb = function() {
7589
- var rgba = swizzle(arguments);
7590
- return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ")" : "rgba(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ", " + rgba[3] + ")";
7591
- };
7592
- cs.to.rgb.percent = function() {
7593
- var rgba = swizzle(arguments), r2 = Math.round(rgba[0] / 255 * 100), g = Math.round(rgba[1] / 255 * 100), b = Math.round(rgba[2] / 255 * 100);
7594
- return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r2 + "%, " + g + "%, " + b + "%)" : "rgba(" + r2 + "%, " + g + "%, " + b + "%, " + rgba[3] + ")";
7595
- };
7596
- cs.to.hsl = function() {
7597
- var hsla = swizzle(arguments);
7598
- return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
7599
- };
7600
- cs.to.hwb = function() {
7601
- var hwba = swizzle(arguments), a = "";
7602
- return hwba.length >= 4 && hwba[3] !== 1 && (a = ", " + hwba[3]), "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a + ")";
7603
- };
7604
- cs.to.keyword = function(rgb) {
7605
- return reverseNames[rgb.slice(0, 3)];
7606
- };
7607
- function clamp(num, min, max) {
7608
- return Math.min(Math.max(min, num), max);
7609
- }
7610
- function hexDouble(num) {
7611
- var str2 = Math.round(num).toString(16).toUpperCase();
7612
- return str2.length < 2 ? "0" + str2 : str2;
7613
- }
7614
- }
7615
- });
7616
-
7617
- // ../../node_modules/color-convert/conversions.js
7618
- var require_conversions = __commonJS({
7619
- "../../node_modules/color-convert/conversions.js"(exports2, module2) {
7620
- var cssKeywords = require_color_name(), reverseKeywords = {};
7621
- for (let key2 of Object.keys(cssKeywords))
7622
- reverseKeywords[cssKeywords[key2]] = key2;
7623
- var convert4 = {
7624
- rgb: { channels: 3, labels: "rgb" },
7625
- hsl: { channels: 3, labels: "hsl" },
7626
- hsv: { channels: 3, labels: "hsv" },
7627
- hwb: { channels: 3, labels: "hwb" },
7628
- cmyk: { channels: 4, labels: "cmyk" },
7629
- xyz: { channels: 3, labels: "xyz" },
7630
- lab: { channels: 3, labels: "lab" },
7631
- lch: { channels: 3, labels: "lch" },
7632
- hex: { channels: 1, labels: ["hex"] },
7633
- keyword: { channels: 1, labels: ["keyword"] },
7634
- ansi16: { channels: 1, labels: ["ansi16"] },
7635
- ansi256: { channels: 1, labels: ["ansi256"] },
7636
- hcg: { channels: 3, labels: ["h", "c", "g"] },
7637
- apple: { channels: 3, labels: ["r16", "g16", "b16"] },
7638
- gray: { channels: 1, labels: ["gray"] }
7639
- };
7640
- module2.exports = convert4;
7641
- for (let model of Object.keys(convert4)) {
7642
- if (!("channels" in convert4[model]))
7643
- throw new Error("missing channels property: " + model);
7644
- if (!("labels" in convert4[model]))
7645
- throw new Error("missing channel labels property: " + model);
7646
- if (convert4[model].labels.length !== convert4[model].channels)
7647
- throw new Error("channel and label counts mismatch: " + model);
7648
- let { channels, labels } = convert4[model];
7649
- delete convert4[model].channels, delete convert4[model].labels, Object.defineProperty(convert4[model], "channels", { value: channels }), Object.defineProperty(convert4[model], "labels", { value: labels });
7650
- }
7651
- convert4.rgb.hsl = function(rgb) {
7652
- let r2 = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255, min = Math.min(r2, g, b), max = Math.max(r2, g, b), delta = max - min, h2, s2;
7653
- max === min ? h2 = 0 : r2 === max ? h2 = (g - b) / delta : g === max ? h2 = 2 + (b - r2) / delta : b === max && (h2 = 4 + (r2 - g) / delta), h2 = Math.min(h2 * 60, 360), h2 < 0 && (h2 += 360);
7654
- let l = (min + max) / 2;
7655
- return max === min ? s2 = 0 : l <= 0.5 ? s2 = delta / (max + min) : s2 = delta / (2 - max - min), [h2, s2 * 100, l * 100];
7656
- };
7657
- convert4.rgb.hsv = function(rgb) {
7658
- let rdif, gdif, bdif, h2, s2, r2 = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255, v = Math.max(r2, g, b), diff2 = v - Math.min(r2, g, b), diffc = function(c2) {
7659
- return (v - c2) / 6 / diff2 + 1 / 2;
7660
- };
7661
- return diff2 === 0 ? (h2 = 0, s2 = 0) : (s2 = diff2 / v, rdif = diffc(r2), gdif = diffc(g), bdif = diffc(b), r2 === v ? h2 = bdif - gdif : g === v ? h2 = 1 / 3 + rdif - bdif : b === v && (h2 = 2 / 3 + gdif - rdif), h2 < 0 ? h2 += 1 : h2 > 1 && (h2 -= 1)), [
7662
- h2 * 360,
7663
- s2 * 100,
7664
- v * 100
7665
- ];
7666
- };
7667
- convert4.rgb.hwb = function(rgb) {
7668
- let r2 = rgb[0], g = rgb[1], b = rgb[2], h2 = convert4.rgb.hsl(rgb)[0], w = 1 / 255 * Math.min(r2, Math.min(g, b));
7669
- return b = 1 - 1 / 255 * Math.max(r2, Math.max(g, b)), [h2, w * 100, b * 100];
7670
- };
7671
- convert4.rgb.cmyk = function(rgb) {
7672
- let r2 = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255, k = Math.min(1 - r2, 1 - g, 1 - b), c2 = (1 - r2 - k) / (1 - k) || 0, m = (1 - g - k) / (1 - k) || 0, y = (1 - b - k) / (1 - k) || 0;
7673
- return [c2 * 100, m * 100, y * 100, k * 100];
7674
- };
7675
- function comparativeDistance(x, y) {
7676
- return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
7677
- }
7678
- convert4.rgb.keyword = function(rgb) {
7679
- let reversed = reverseKeywords[rgb];
7680
- if (reversed)
7681
- return reversed;
7682
- let currentClosestDistance = 1 / 0, currentClosestKeyword;
7683
- for (let keyword of Object.keys(cssKeywords)) {
7684
- let value = cssKeywords[keyword], distance = comparativeDistance(rgb, value);
7685
- distance < currentClosestDistance && (currentClosestDistance = distance, currentClosestKeyword = keyword);
7686
- }
7687
- return currentClosestKeyword;
7688
- };
7689
- convert4.keyword.rgb = function(keyword) {
7690
- return cssKeywords[keyword];
7691
- };
7692
- convert4.rgb.xyz = function(rgb) {
7693
- let r2 = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255;
7694
- r2 = r2 > 0.04045 ? ((r2 + 0.055) / 1.055) ** 2.4 : r2 / 12.92, g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92, b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
7695
- let x = r2 * 0.4124 + g * 0.3576 + b * 0.1805, y = r2 * 0.2126 + g * 0.7152 + b * 0.0722, z = r2 * 0.0193 + g * 0.1192 + b * 0.9505;
7696
- return [x * 100, y * 100, z * 100];
7697
- };
7698
- convert4.rgb.lab = function(rgb) {
7699
- let xyz = convert4.rgb.xyz(rgb), x = xyz[0], y = xyz[1], z = xyz[2];
7700
- x /= 95.047, y /= 100, z /= 108.883, x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116, y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116, z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
7701
- let l = 116 * y - 16, a = 500 * (x - y), b = 200 * (y - z);
7702
- return [l, a, b];
7703
- };
7704
- convert4.hsl.rgb = function(hsl) {
7705
- let h2 = hsl[0] / 360, s2 = hsl[1] / 100, l = hsl[2] / 100, t2, t3, val;
7706
- if (s2 === 0)
7707
- return val = l * 255, [val, val, val];
7708
- l < 0.5 ? t2 = l * (1 + s2) : t2 = l + s2 - l * s2;
7709
- let t1 = 2 * l - t2, rgb = [0, 0, 0];
7710
- for (let i = 0; i < 3; i++)
7711
- t3 = h2 + 1 / 3 * -(i - 1), t3 < 0 && t3++, t3 > 1 && t3--, 6 * t3 < 1 ? val = t1 + (t2 - t1) * 6 * t3 : 2 * t3 < 1 ? val = t2 : 3 * t3 < 2 ? val = t1 + (t2 - t1) * (2 / 3 - t3) * 6 : val = t1, rgb[i] = val * 255;
7712
- return rgb;
7713
- };
7714
- convert4.hsl.hsv = function(hsl) {
7715
- let h2 = hsl[0], s2 = hsl[1] / 100, l = hsl[2] / 100, smin = s2, lmin = Math.max(l, 0.01);
7716
- l *= 2, s2 *= l <= 1 ? l : 2 - l, smin *= lmin <= 1 ? lmin : 2 - lmin;
7717
- let v = (l + s2) / 2, sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s2 / (l + s2);
7718
- return [h2, sv * 100, v * 100];
7719
- };
7720
- convert4.hsv.rgb = function(hsv) {
7721
- let h2 = hsv[0] / 60, s2 = hsv[1] / 100, v = hsv[2] / 100, hi = Math.floor(h2) % 6, f = h2 - Math.floor(h2), p2 = 255 * v * (1 - s2), q = 255 * v * (1 - s2 * f), t = 255 * v * (1 - s2 * (1 - f));
7722
- switch (v *= 255, hi) {
7723
- case 0:
7724
- return [v, t, p2];
7725
- case 1:
7726
- return [q, v, p2];
7727
- case 2:
7728
- return [p2, v, t];
7729
- case 3:
7730
- return [p2, q, v];
7731
- case 4:
7732
- return [t, p2, v];
7733
- case 5:
7734
- return [v, p2, q];
7735
- }
7736
- };
7737
- convert4.hsv.hsl = function(hsv) {
7738
- let h2 = hsv[0], s2 = hsv[1] / 100, v = hsv[2] / 100, vmin = Math.max(v, 0.01), sl, l;
7739
- l = (2 - s2) * v;
7740
- let lmin = (2 - s2) * vmin;
7741
- return sl = s2 * vmin, sl /= lmin <= 1 ? lmin : 2 - lmin, sl = sl || 0, l /= 2, [h2, sl * 100, l * 100];
7742
- };
7743
- convert4.hwb.rgb = function(hwb) {
7744
- let h2 = hwb[0] / 360, wh = hwb[1] / 100, bl = hwb[2] / 100, ratio = wh + bl, f;
7745
- ratio > 1 && (wh /= ratio, bl /= ratio);
7746
- let i = Math.floor(6 * h2), v = 1 - bl;
7747
- f = 6 * h2 - i, (i & 1) !== 0 && (f = 1 - f);
7748
- let n = wh + f * (v - wh), r2, g, b;
7749
- switch (i) {
7750
- default:
7751
- case 6:
7752
- case 0:
7753
- r2 = v, g = n, b = wh;
7754
- break;
7755
- case 1:
7756
- r2 = n, g = v, b = wh;
7757
- break;
7758
- case 2:
7759
- r2 = wh, g = v, b = n;
7760
- break;
7761
- case 3:
7762
- r2 = wh, g = n, b = v;
7763
- break;
7764
- case 4:
7765
- r2 = n, g = wh, b = v;
7766
- break;
7767
- case 5:
7768
- r2 = v, g = wh, b = n;
7769
- break;
7770
- }
7771
- return [r2 * 255, g * 255, b * 255];
7772
- };
7773
- convert4.cmyk.rgb = function(cmyk) {
7774
- let c2 = cmyk[0] / 100, m = cmyk[1] / 100, y = cmyk[2] / 100, k = cmyk[3] / 100, r2 = 1 - Math.min(1, c2 * (1 - k) + k), g = 1 - Math.min(1, m * (1 - k) + k), b = 1 - Math.min(1, y * (1 - k) + k);
7775
- return [r2 * 255, g * 255, b * 255];
7776
- };
7777
- convert4.xyz.rgb = function(xyz) {
7778
- let x = xyz[0] / 100, y = xyz[1] / 100, z = xyz[2] / 100, r2, g, b;
7779
- return r2 = x * 3.2406 + y * -1.5372 + z * -0.4986, g = x * -0.9689 + y * 1.8758 + z * 0.0415, b = x * 0.0557 + y * -0.204 + z * 1.057, r2 = r2 > 31308e-7 ? 1.055 * r2 ** (1 / 2.4) - 0.055 : r2 * 12.92, g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92, b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92, r2 = Math.min(Math.max(0, r2), 1), g = Math.min(Math.max(0, g), 1), b = Math.min(Math.max(0, b), 1), [r2 * 255, g * 255, b * 255];
7780
- };
7781
- convert4.xyz.lab = function(xyz) {
7782
- let x = xyz[0], y = xyz[1], z = xyz[2];
7783
- x /= 95.047, y /= 100, z /= 108.883, x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116, y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116, z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
7784
- let l = 116 * y - 16, a = 500 * (x - y), b = 200 * (y - z);
7785
- return [l, a, b];
7786
- };
7787
- convert4.lab.xyz = function(lab) {
7788
- let l = lab[0], a = lab[1], b = lab[2], x, y, z;
7789
- y = (l + 16) / 116, x = a / 500 + y, z = y - b / 200;
7790
- let y2 = y ** 3, x2 = x ** 3, z2 = z ** 3;
7791
- return y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787, x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787, z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787, x *= 95.047, y *= 100, z *= 108.883, [x, y, z];
7792
- };
7793
- convert4.lab.lch = function(lab) {
7794
- let l = lab[0], a = lab[1], b = lab[2], h2;
7795
- h2 = Math.atan2(b, a) * 360 / 2 / Math.PI, h2 < 0 && (h2 += 360);
7796
- let c2 = Math.sqrt(a * a + b * b);
7797
- return [l, c2, h2];
7798
- };
7799
- convert4.lch.lab = function(lch) {
7800
- let l = lch[0], c2 = lch[1], hr = lch[2] / 360 * 2 * Math.PI, a = c2 * Math.cos(hr), b = c2 * Math.sin(hr);
7801
- return [l, a, b];
7802
- };
7803
- convert4.rgb.ansi16 = function(args, saturation = null) {
7804
- let [r2, g, b] = args, value = saturation === null ? convert4.rgb.hsv(args)[2] : saturation;
7805
- if (value = Math.round(value / 50), value === 0)
7806
- return 30;
7807
- let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r2 / 255));
7808
- return value === 2 && (ansi += 60), ansi;
7809
- };
7810
- convert4.hsv.ansi16 = function(args) {
7811
- return convert4.rgb.ansi16(convert4.hsv.rgb(args), args[2]);
7812
- };
7813
- convert4.rgb.ansi256 = function(args) {
7814
- let r2 = args[0], g = args[1], b = args[2];
7815
- return r2 === g && g === b ? r2 < 8 ? 16 : r2 > 248 ? 231 : Math.round((r2 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(r2 / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
7816
- };
7817
- convert4.ansi16.rgb = function(args) {
7818
- let color4 = args % 10;
7819
- if (color4 === 0 || color4 === 7)
7820
- return args > 50 && (color4 += 3.5), color4 = color4 / 10.5 * 255, [color4, color4, color4];
7821
- let mult = (~~(args > 50) + 1) * 0.5, r2 = (color4 & 1) * mult * 255, g = (color4 >> 1 & 1) * mult * 255, b = (color4 >> 2 & 1) * mult * 255;
7822
- return [r2, g, b];
7823
- };
7824
- convert4.ansi256.rgb = function(args) {
7825
- if (args >= 232) {
7826
- let c2 = (args - 232) * 10 + 8;
7827
- return [c2, c2, c2];
7828
- }
7829
- args -= 16;
7830
- let rem, r2 = Math.floor(args / 36) / 5 * 255, g = Math.floor((rem = args % 36) / 6) / 5 * 255, b = rem % 6 / 5 * 255;
7831
- return [r2, g, b];
7832
- };
7833
- convert4.rgb.hex = function(args) {
7834
- let string = (((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255)).toString(16).toUpperCase();
7835
- return "000000".substring(string.length) + string;
7836
- };
7837
- convert4.hex.rgb = function(args) {
7838
- let match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
7839
- if (!match)
7840
- return [0, 0, 0];
7841
- let colorString = match[0];
7842
- match[0].length === 3 && (colorString = colorString.split("").map((char) => char + char).join(""));
7843
- let integer = parseInt(colorString, 16), r2 = integer >> 16 & 255, g = integer >> 8 & 255, b = integer & 255;
7844
- return [r2, g, b];
7845
- };
7846
- convert4.rgb.hcg = function(rgb) {
7847
- let r2 = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255, max = Math.max(Math.max(r2, g), b), min = Math.min(Math.min(r2, g), b), chroma = max - min, grayscale, hue;
7848
- return chroma < 1 ? grayscale = min / (1 - chroma) : grayscale = 0, chroma <= 0 ? hue = 0 : max === r2 ? hue = (g - b) / chroma % 6 : max === g ? hue = 2 + (b - r2) / chroma : hue = 4 + (r2 - g) / chroma, hue /= 6, hue %= 1, [hue * 360, chroma * 100, grayscale * 100];
7849
- };
7850
- convert4.hsl.hcg = function(hsl) {
7851
- let s2 = hsl[1] / 100, l = hsl[2] / 100, c2 = l < 0.5 ? 2 * s2 * l : 2 * s2 * (1 - l), f = 0;
7852
- return c2 < 1 && (f = (l - 0.5 * c2) / (1 - c2)), [hsl[0], c2 * 100, f * 100];
7853
- };
7854
- convert4.hsv.hcg = function(hsv) {
7855
- let s2 = hsv[1] / 100, v = hsv[2] / 100, c2 = s2 * v, f = 0;
7856
- return c2 < 1 && (f = (v - c2) / (1 - c2)), [hsv[0], c2 * 100, f * 100];
7857
- };
7858
- convert4.hcg.rgb = function(hcg) {
7859
- let h2 = hcg[0] / 360, c2 = hcg[1] / 100, g = hcg[2] / 100;
7860
- if (c2 === 0)
7861
- return [g * 255, g * 255, g * 255];
7862
- let pure = [0, 0, 0], hi = h2 % 1 * 6, v = hi % 1, w = 1 - v, mg = 0;
7863
- switch (Math.floor(hi)) {
7864
- case 0:
7865
- pure[0] = 1, pure[1] = v, pure[2] = 0;
7866
- break;
7867
- case 1:
7868
- pure[0] = w, pure[1] = 1, pure[2] = 0;
7869
- break;
7870
- case 2:
7871
- pure[0] = 0, pure[1] = 1, pure[2] = v;
7872
- break;
7873
- case 3:
7874
- pure[0] = 0, pure[1] = w, pure[2] = 1;
7875
- break;
7876
- case 4:
7877
- pure[0] = v, pure[1] = 0, pure[2] = 1;
7878
- break;
7879
- default:
7880
- pure[0] = 1, pure[1] = 0, pure[2] = w;
7881
- }
7882
- return mg = (1 - c2) * g, [
7883
- (c2 * pure[0] + mg) * 255,
7884
- (c2 * pure[1] + mg) * 255,
7885
- (c2 * pure[2] + mg) * 255
7886
- ];
7887
- };
7888
- convert4.hcg.hsv = function(hcg) {
7889
- let c2 = hcg[1] / 100, g = hcg[2] / 100, v = c2 + g * (1 - c2), f = 0;
7890
- return v > 0 && (f = c2 / v), [hcg[0], f * 100, v * 100];
7891
- };
7892
- convert4.hcg.hsl = function(hcg) {
7893
- let c2 = hcg[1] / 100, l = hcg[2] / 100 * (1 - c2) + 0.5 * c2, s2 = 0;
7894
- return l > 0 && l < 0.5 ? s2 = c2 / (2 * l) : l >= 0.5 && l < 1 && (s2 = c2 / (2 * (1 - l))), [hcg[0], s2 * 100, l * 100];
7895
- };
7896
- convert4.hcg.hwb = function(hcg) {
7897
- let c2 = hcg[1] / 100, g = hcg[2] / 100, v = c2 + g * (1 - c2);
7898
- return [hcg[0], (v - c2) * 100, (1 - v) * 100];
7899
- };
7900
- convert4.hwb.hcg = function(hwb) {
7901
- let w = hwb[1] / 100, v = 1 - hwb[2] / 100, c2 = v - w, g = 0;
7902
- return c2 < 1 && (g = (v - c2) / (1 - c2)), [hwb[0], c2 * 100, g * 100];
7903
- };
7904
- convert4.apple.rgb = function(apple) {
7905
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
7906
- };
7907
- convert4.rgb.apple = function(rgb) {
7908
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
7909
- };
7910
- convert4.gray.rgb = function(args) {
7911
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
7912
- };
7913
- convert4.gray.hsl = function(args) {
7914
- return [0, 0, args[0]];
7915
- };
7916
- convert4.gray.hsv = convert4.gray.hsl;
7917
- convert4.gray.hwb = function(gray) {
7918
- return [0, 100, gray[0]];
7919
- };
7920
- convert4.gray.cmyk = function(gray) {
7921
- return [0, 0, 0, gray[0]];
7922
- };
7923
- convert4.gray.lab = function(gray) {
7924
- return [gray[0], 0, 0];
7925
- };
7926
- convert4.gray.hex = function(gray) {
7927
- let val = Math.round(gray[0] / 100 * 255) & 255, string = ((val << 16) + (val << 8) + val).toString(16).toUpperCase();
7928
- return "000000".substring(string.length) + string;
7929
- };
7930
- convert4.rgb.gray = function(rgb) {
7931
- return [(rgb[0] + rgb[1] + rgb[2]) / 3 / 255 * 100];
7932
- };
7933
- }
7934
- });
7935
-
7936
- // ../../node_modules/color-convert/route.js
7937
- var require_route = __commonJS({
7938
- "../../node_modules/color-convert/route.js"(exports2, module2) {
7939
- var conversions = require_conversions();
7940
- function buildGraph() {
7941
- let graph = {}, models = Object.keys(conversions);
7942
- for (let len = models.length, i = 0; i < len; i++)
7943
- graph[models[i]] = {
7944
- // http://jsperf.com/1-vs-infinity
7945
- // micro-opt, but this is simple.
7946
- distance: -1,
7947
- parent: null
7948
- };
7949
- return graph;
7950
- }
7951
- function deriveBFS(fromModel) {
7952
- let graph = buildGraph(), queue = [fromModel];
7953
- for (graph[fromModel].distance = 0; queue.length; ) {
7954
- let current = queue.pop(), adjacents = Object.keys(conversions[current]);
7955
- for (let len = adjacents.length, i = 0; i < len; i++) {
7956
- let adjacent = adjacents[i], node2 = graph[adjacent];
7957
- node2.distance === -1 && (node2.distance = graph[current].distance + 1, node2.parent = current, queue.unshift(adjacent));
7958
- }
7959
- }
7960
- return graph;
7961
- }
7962
- function link2(from, to) {
7963
- return function(args) {
7964
- return to(from(args));
7965
- };
7966
- }
7967
- function wrapConversion(toModel, graph) {
7968
- let path5 = [graph[toModel].parent, toModel], fn = conversions[graph[toModel].parent][toModel], cur = graph[toModel].parent;
7969
- for (; graph[cur].parent; )
7970
- path5.unshift(graph[cur].parent), fn = link2(conversions[graph[cur].parent][cur], fn), cur = graph[cur].parent;
7971
- return fn.conversion = path5, fn;
7972
- }
7973
- module2.exports = function(fromModel) {
7974
- let graph = deriveBFS(fromModel), conversion = {}, models = Object.keys(graph);
7975
- for (let len = models.length, i = 0; i < len; i++) {
7976
- let toModel = models[i];
7977
- graph[toModel].parent !== null && (conversion[toModel] = wrapConversion(toModel, graph));
7978
- }
7979
- return conversion;
7980
- };
7981
- }
7982
- });
7983
-
7984
- // ../../node_modules/color-convert/index.js
7985
- var require_color_convert = __commonJS({
7986
- "../../node_modules/color-convert/index.js"(exports2, module2) {
7987
- var conversions = require_conversions(), route = require_route(), convert4 = {}, models = Object.keys(conversions);
7988
- function wrapRaw(fn) {
7989
- let wrappedFn = function(...args) {
7990
- let arg0 = args[0];
7991
- return arg0 == null ? arg0 : (arg0.length > 1 && (args = arg0), fn(args));
7992
- };
7993
- return "conversion" in fn && (wrappedFn.conversion = fn.conversion), wrappedFn;
7994
- }
7995
- function wrapRounded(fn) {
7996
- let wrappedFn = function(...args) {
7997
- let arg0 = args[0];
7998
- if (arg0 == null)
7999
- return arg0;
8000
- arg0.length > 1 && (args = arg0);
8001
- let result = fn(args);
8002
- if (typeof result == "object")
8003
- for (let len = result.length, i = 0; i < len; i++)
8004
- result[i] = Math.round(result[i]);
8005
- return result;
8006
- };
8007
- return "conversion" in fn && (wrappedFn.conversion = fn.conversion), wrappedFn;
8008
- }
8009
- models.forEach((fromModel) => {
8010
- convert4[fromModel] = {}, Object.defineProperty(convert4[fromModel], "channels", { value: conversions[fromModel].channels }), Object.defineProperty(convert4[fromModel], "labels", { value: conversions[fromModel].labels });
8011
- let routes = route(fromModel);
8012
- Object.keys(routes).forEach((toModel) => {
8013
- let fn = routes[toModel];
8014
- convert4[fromModel][toModel] = wrapRounded(fn), convert4[fromModel][toModel].raw = wrapRaw(fn);
8015
- });
8016
- });
8017
- module2.exports = convert4;
8018
- }
8019
- });
8020
-
8021
- // ../../node_modules/color/index.js
8022
- var require_color = __commonJS({
8023
- "../../node_modules/color/index.js"(exports2, module2) {
8024
- var colorString = require_color_string(), convert4 = require_color_convert(), skippedModels = [
8025
- // To be honest, I don't really feel like keyword belongs in color convert, but eh.
8026
- "keyword",
8027
- // Gray conflicts with some method names, and has its own method defined.
8028
- "gray",
8029
- // Shouldn't really be in color-convert either...
8030
- "hex"
8031
- ], hashedModelKeys = {};
8032
- for (let model of Object.keys(convert4))
8033
- hashedModelKeys[[...convert4[model].labels].sort().join("")] = model;
8034
- var limiters = {};
8035
- function Color(object, model) {
8036
- if (!(this instanceof Color))
8037
- return new Color(object, model);
8038
- if (model && model in skippedModels && (model = null), model && !(model in convert4))
8039
- throw new Error("Unknown model: " + model);
8040
- let i, channels;
8041
- if (object == null)
8042
- this.model = "rgb", this.color = [0, 0, 0], this.valpha = 1;
8043
- else if (object instanceof Color)
8044
- this.model = object.model, this.color = [...object.color], this.valpha = object.valpha;
8045
- else if (typeof object == "string") {
8046
- let result = colorString.get(object);
8047
- if (result === null)
8048
- throw new Error("Unable to parse color from string: " + object);
8049
- this.model = result.model, channels = convert4[this.model].channels, this.color = result.value.slice(0, channels), this.valpha = typeof result.value[channels] == "number" ? result.value[channels] : 1;
8050
- } else if (object.length > 0) {
8051
- this.model = model || "rgb", channels = convert4[this.model].channels;
8052
- let newArray = Array.prototype.slice.call(object, 0, channels);
8053
- this.color = zeroArray(newArray, channels), this.valpha = typeof object[channels] == "number" ? object[channels] : 1;
8054
- } else if (typeof object == "number")
8055
- this.model = "rgb", this.color = [
8056
- object >> 16 & 255,
8057
- object >> 8 & 255,
8058
- object & 255
8059
- ], this.valpha = 1;
8060
- else {
8061
- this.valpha = 1;
8062
- let keys2 = Object.keys(object);
8063
- "alpha" in object && (keys2.splice(keys2.indexOf("alpha"), 1), this.valpha = typeof object.alpha == "number" ? object.alpha : 0);
8064
- let hashedKeys = keys2.sort().join("");
8065
- if (!(hashedKeys in hashedModelKeys))
8066
- throw new Error("Unable to parse color from object: " + JSON.stringify(object));
8067
- this.model = hashedModelKeys[hashedKeys];
8068
- let { labels } = convert4[this.model], color4 = [];
8069
- for (i = 0; i < labels.length; i++)
8070
- color4.push(object[labels[i]]);
8071
- this.color = zeroArray(color4);
8072
- }
8073
- if (limiters[this.model])
8074
- for (channels = convert4[this.model].channels, i = 0; i < channels; i++) {
8075
- let limit = limiters[this.model][i];
8076
- limit && (this.color[i] = limit(this.color[i]));
8077
- }
8078
- this.valpha = Math.max(0, Math.min(1, this.valpha)), Object.freeze && Object.freeze(this);
8079
- }
8080
- Color.prototype = {
8081
- toString() {
8082
- return this.string();
8083
- },
8084
- toJSON() {
8085
- return this[this.model]();
8086
- },
8087
- string(places) {
8088
- let self = this.model in colorString.to ? this : this.rgb();
8089
- self = self.round(typeof places == "number" ? places : 1);
8090
- let args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
8091
- return colorString.to[self.model](args);
8092
- },
8093
- percentString(places) {
8094
- let self = this.rgb().round(typeof places == "number" ? places : 1), args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
8095
- return colorString.to.rgb.percent(args);
8096
- },
8097
- array() {
8098
- return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
8099
- },
8100
- object() {
8101
- let result = {}, { channels } = convert4[this.model], { labels } = convert4[this.model];
8102
- for (let i = 0; i < channels; i++)
8103
- result[labels[i]] = this.color[i];
8104
- return this.valpha !== 1 && (result.alpha = this.valpha), result;
8105
- },
8106
- unitArray() {
8107
- let rgb = this.rgb().color;
8108
- return rgb[0] /= 255, rgb[1] /= 255, rgb[2] /= 255, this.valpha !== 1 && rgb.push(this.valpha), rgb;
8109
- },
8110
- unitObject() {
8111
- let rgb = this.rgb().object();
8112
- return rgb.r /= 255, rgb.g /= 255, rgb.b /= 255, this.valpha !== 1 && (rgb.alpha = this.valpha), rgb;
8113
- },
8114
- round(places) {
8115
- return places = Math.max(places || 0, 0), new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
8116
- },
8117
- alpha(value) {
8118
- return value !== void 0 ? new Color([...this.color, Math.max(0, Math.min(1, value))], this.model) : this.valpha;
8119
- },
8120
- // Rgb
8121
- red: getset("rgb", 0, maxfn(255)),
8122
- green: getset("rgb", 1, maxfn(255)),
8123
- blue: getset("rgb", 2, maxfn(255)),
8124
- hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (value) => (value % 360 + 360) % 360),
8125
- saturationl: getset("hsl", 1, maxfn(100)),
8126
- lightness: getset("hsl", 2, maxfn(100)),
8127
- saturationv: getset("hsv", 1, maxfn(100)),
8128
- value: getset("hsv", 2, maxfn(100)),
8129
- chroma: getset("hcg", 1, maxfn(100)),
8130
- gray: getset("hcg", 2, maxfn(100)),
8131
- white: getset("hwb", 1, maxfn(100)),
8132
- wblack: getset("hwb", 2, maxfn(100)),
8133
- cyan: getset("cmyk", 0, maxfn(100)),
8134
- magenta: getset("cmyk", 1, maxfn(100)),
8135
- yellow: getset("cmyk", 2, maxfn(100)),
8136
- black: getset("cmyk", 3, maxfn(100)),
8137
- x: getset("xyz", 0, maxfn(95.047)),
8138
- y: getset("xyz", 1, maxfn(100)),
8139
- z: getset("xyz", 2, maxfn(108.833)),
8140
- l: getset("lab", 0, maxfn(100)),
8141
- a: getset("lab", 1),
8142
- b: getset("lab", 2),
8143
- keyword(value) {
8144
- return value !== void 0 ? new Color(value) : convert4[this.model].keyword(this.color);
8145
- },
8146
- hex(value) {
8147
- return value !== void 0 ? new Color(value) : colorString.to.hex(this.rgb().round().color);
8148
- },
8149
- hexa(value) {
8150
- if (value !== void 0)
8151
- return new Color(value);
8152
- let rgbArray = this.rgb().round().color, alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
8153
- return alphaHex.length === 1 && (alphaHex = "0" + alphaHex), colorString.to.hex(rgbArray) + alphaHex;
8154
- },
8155
- rgbNumber() {
8156
- let rgb = this.rgb().color;
8157
- return (rgb[0] & 255) << 16 | (rgb[1] & 255) << 8 | rgb[2] & 255;
8158
- },
8159
- luminosity() {
8160
- let rgb = this.rgb().color, lum = [];
8161
- for (let [i, element4] of rgb.entries()) {
8162
- let chan = element4 / 255;
8163
- lum[i] = chan <= 0.04045 ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
8164
- }
8165
- return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
8166
- },
8167
- contrast(color22) {
8168
- let lum1 = this.luminosity(), lum2 = color22.luminosity();
8169
- return lum1 > lum2 ? (lum1 + 0.05) / (lum2 + 0.05) : (lum2 + 0.05) / (lum1 + 0.05);
8170
- },
8171
- level(color22) {
8172
- let contrastRatio = this.contrast(color22);
8173
- return contrastRatio >= 7 ? "AAA" : contrastRatio >= 4.5 ? "AA" : "";
8174
- },
8175
- isDark() {
8176
- let rgb = this.rgb().color;
8177
- return (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 1e4 < 128;
8178
- },
8179
- isLight() {
8180
- return !this.isDark();
8181
- },
8182
- negate() {
8183
- let rgb = this.rgb();
8184
- for (let i = 0; i < 3; i++)
8185
- rgb.color[i] = 255 - rgb.color[i];
8186
- return rgb;
8187
- },
8188
- lighten(ratio) {
8189
- let hsl = this.hsl();
8190
- return hsl.color[2] += hsl.color[2] * ratio, hsl;
8191
- },
8192
- darken(ratio) {
8193
- let hsl = this.hsl();
8194
- return hsl.color[2] -= hsl.color[2] * ratio, hsl;
8195
- },
8196
- saturate(ratio) {
8197
- let hsl = this.hsl();
8198
- return hsl.color[1] += hsl.color[1] * ratio, hsl;
8199
- },
8200
- desaturate(ratio) {
8201
- let hsl = this.hsl();
8202
- return hsl.color[1] -= hsl.color[1] * ratio, hsl;
8203
- },
8204
- whiten(ratio) {
8205
- let hwb = this.hwb();
8206
- return hwb.color[1] += hwb.color[1] * ratio, hwb;
8207
- },
8208
- blacken(ratio) {
8209
- let hwb = this.hwb();
8210
- return hwb.color[2] += hwb.color[2] * ratio, hwb;
8211
- },
8212
- grayscale() {
8213
- let rgb = this.rgb().color, value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
8214
- return Color.rgb(value, value, value);
8215
- },
8216
- fade(ratio) {
8217
- return this.alpha(this.valpha - this.valpha * ratio);
8218
- },
8219
- opaquer(ratio) {
8220
- return this.alpha(this.valpha + this.valpha * ratio);
8221
- },
8222
- rotate(degrees) {
8223
- let hsl = this.hsl(), hue = hsl.color[0];
8224
- return hue = (hue + degrees) % 360, hue = hue < 0 ? 360 + hue : hue, hsl.color[0] = hue, hsl;
8225
- },
8226
- mix(mixinColor, weight) {
8227
- if (!mixinColor || !mixinColor.rgb)
8228
- throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
8229
- let color1 = mixinColor.rgb(), color22 = this.rgb(), p2 = weight === void 0 ? 0.5 : weight, w = 2 * p2 - 1, a = color1.alpha() - color22.alpha(), w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2, w2 = 1 - w1;
8230
- return Color.rgb(
8231
- w1 * color1.red() + w2 * color22.red(),
8232
- w1 * color1.green() + w2 * color22.green(),
8233
- w1 * color1.blue() + w2 * color22.blue(),
8234
- color1.alpha() * p2 + color22.alpha() * (1 - p2)
8235
- );
8236
- }
8237
- };
8238
- for (let model of Object.keys(convert4)) {
8239
- if (skippedModels.includes(model))
8240
- continue;
8241
- let { channels } = convert4[model];
8242
- Color.prototype[model] = function(...args) {
8243
- return this.model === model ? new Color(this) : args.length > 0 ? new Color(args, model) : new Color([...assertArray(convert4[this.model][model].raw(this.color)), this.valpha], model);
8244
- }, Color[model] = function(...args) {
8245
- let color4 = args[0];
8246
- return typeof color4 == "number" && (color4 = zeroArray(args, channels)), new Color(color4, model);
8247
- };
8248
- }
8249
- function roundTo(number2, places) {
8250
- return Number(number2.toFixed(places));
8251
- }
8252
- function roundToPlace(places) {
8253
- return function(number2) {
8254
- return roundTo(number2, places);
8255
- };
8256
- }
8257
- function getset(model, channel, modifier) {
8258
- model = Array.isArray(model) ? model : [model];
8259
- for (let m of model)
8260
- (limiters[m] || (limiters[m] = []))[channel] = modifier;
8261
- return model = model[0], function(value) {
8262
- let result;
8263
- return value !== void 0 ? (modifier && (value = modifier(value)), result = this[model](), result.color[channel] = value, result) : (result = this[model]().color[channel], modifier && (result = modifier(result)), result);
8264
- };
8265
- }
8266
- function maxfn(max) {
8267
- return function(v) {
8268
- return Math.max(0, Math.min(max, v));
8269
- };
8270
- }
8271
- function assertArray(value) {
8272
- return Array.isArray(value) ? value : [value];
8273
- }
8274
- function zeroArray(array, length) {
8275
- for (let i = 0; i < length; i++)
8276
- typeof array[i] != "number" && (array[i] = 0);
8277
- return array;
8278
- }
8279
- module2.exports = Color;
8280
- }
8281
- });
8282
-
8283
- // ../../node_modules/sharp/lib/input.js
8284
- var require_input = __commonJS({
8285
- "../../node_modules/sharp/lib/input.js"(exports2, module2) {
8286
- "use strict";
8287
- var color4 = require_color(), is4 = require_is(), sharp = require_sharp(), align = {
8288
- left: "low",
8289
- center: "centre",
8290
- centre: "centre",
8291
- right: "high"
8292
- };
8293
- function _inputOptionsFromObject(obj) {
8294
- let { raw: raw2, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd } = obj;
8295
- return [raw2, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd].some(is4.defined) ? { raw: raw2, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd } : void 0;
8296
- }
8297
- function _createInputDescriptor(input, inputOptions, containerOptions) {
8298
- let inputDescriptor = {
8299
- failOn: "warning",
8300
- limitInputPixels: Math.pow(16383, 2),
8301
- ignoreIcc: !1,
8302
- unlimited: !1,
8303
- sequentialRead: !0
8304
- };
8305
- if (is4.string(input))
8306
- inputDescriptor.file = input;
8307
- else if (is4.buffer(input)) {
8308
- if (input.length === 0)
8309
- throw Error("Input Buffer is empty");
8310
- inputDescriptor.buffer = input;
8311
- } else if (is4.arrayBuffer(input)) {
8312
- if (input.byteLength === 0)
8313
- throw Error("Input bit Array is empty");
8314
- inputDescriptor.buffer = Buffer.from(input, 0, input.byteLength);
8315
- } else if (is4.typedArray(input)) {
8316
- if (input.length === 0)
8317
- throw Error("Input Bit Array is empty");
8318
- inputDescriptor.buffer = Buffer.from(input.buffer, input.byteOffset, input.byteLength);
8319
- } else if (is4.plainObject(input) && !is4.defined(inputOptions))
8320
- inputOptions = input, _inputOptionsFromObject(inputOptions) && (inputDescriptor.buffer = []);
8321
- else if (!is4.defined(input) && !is4.defined(inputOptions) && is4.object(containerOptions) && containerOptions.allowStream)
8322
- inputDescriptor.buffer = [];
8323
- else
8324
- throw new Error(`Unsupported input '${input}' of type ${typeof input}${is4.defined(inputOptions) ? ` when also providing options of type ${typeof inputOptions}` : ""}`);
8325
- if (is4.object(inputOptions)) {
8326
- if (is4.defined(inputOptions.failOnError))
8327
- if (is4.bool(inputOptions.failOnError))
8328
- inputDescriptor.failOn = inputOptions.failOnError ? "warning" : "none";
8329
- else
8330
- throw is4.invalidParameterError("failOnError", "boolean", inputOptions.failOnError);
8331
- if (is4.defined(inputOptions.failOn))
8332
- if (is4.string(inputOptions.failOn) && is4.inArray(inputOptions.failOn, ["none", "truncated", "error", "warning"]))
8333
- inputDescriptor.failOn = inputOptions.failOn;
8334
- else
8335
- throw is4.invalidParameterError("failOn", "one of: none, truncated, error, warning", inputOptions.failOn);
8336
- if (is4.defined(inputOptions.density))
8337
- if (is4.inRange(inputOptions.density, 1, 1e5))
8338
- inputDescriptor.density = inputOptions.density;
8339
- else
8340
- throw is4.invalidParameterError("density", "number between 1 and 100000", inputOptions.density);
8341
- if (is4.defined(inputOptions.ignoreIcc))
8342
- if (is4.bool(inputOptions.ignoreIcc))
8343
- inputDescriptor.ignoreIcc = inputOptions.ignoreIcc;
8344
- else
8345
- throw is4.invalidParameterError("ignoreIcc", "boolean", inputOptions.ignoreIcc);
8346
- if (is4.defined(inputOptions.limitInputPixels))
8347
- if (is4.bool(inputOptions.limitInputPixels))
8348
- inputDescriptor.limitInputPixels = inputOptions.limitInputPixels ? Math.pow(16383, 2) : 0;
8349
- else if (is4.integer(inputOptions.limitInputPixels) && is4.inRange(inputOptions.limitInputPixels, 0, Number.MAX_SAFE_INTEGER))
8350
- inputDescriptor.limitInputPixels = inputOptions.limitInputPixels;
8351
- else
8352
- throw is4.invalidParameterError("limitInputPixels", "positive integer", inputOptions.limitInputPixels);
8353
- if (is4.defined(inputOptions.unlimited))
8354
- if (is4.bool(inputOptions.unlimited))
8355
- inputDescriptor.unlimited = inputOptions.unlimited;
8356
- else
8357
- throw is4.invalidParameterError("unlimited", "boolean", inputOptions.unlimited);
8358
- if (is4.defined(inputOptions.sequentialRead))
8359
- if (is4.bool(inputOptions.sequentialRead))
8360
- inputDescriptor.sequentialRead = inputOptions.sequentialRead;
8361
- else
8362
- throw is4.invalidParameterError("sequentialRead", "boolean", inputOptions.sequentialRead);
8363
- if (is4.defined(inputOptions.raw))
8364
- if (is4.object(inputOptions.raw) && is4.integer(inputOptions.raw.width) && inputOptions.raw.width > 0 && is4.integer(inputOptions.raw.height) && inputOptions.raw.height > 0 && is4.integer(inputOptions.raw.channels) && is4.inRange(inputOptions.raw.channels, 1, 4))
8365
- switch (inputDescriptor.rawWidth = inputOptions.raw.width, inputDescriptor.rawHeight = inputOptions.raw.height, inputDescriptor.rawChannels = inputOptions.raw.channels, inputDescriptor.rawPremultiplied = !!inputOptions.raw.premultiplied, input.constructor) {
8366
- case Uint8Array:
8367
- case Uint8ClampedArray:
8368
- inputDescriptor.rawDepth = "uchar";
8369
- break;
8370
- case Int8Array:
8371
- inputDescriptor.rawDepth = "char";
8372
- break;
8373
- case Uint16Array:
8374
- inputDescriptor.rawDepth = "ushort";
8375
- break;
8376
- case Int16Array:
8377
- inputDescriptor.rawDepth = "short";
8378
- break;
8379
- case Uint32Array:
8380
- inputDescriptor.rawDepth = "uint";
8381
- break;
8382
- case Int32Array:
8383
- inputDescriptor.rawDepth = "int";
8384
- break;
8385
- case Float32Array:
8386
- inputDescriptor.rawDepth = "float";
8387
- break;
8388
- case Float64Array:
8389
- inputDescriptor.rawDepth = "double";
8390
- break;
8391
- default:
8392
- inputDescriptor.rawDepth = "uchar";
8393
- break;
8394
- }
8395
- else
8396
- throw new Error("Expected width, height and channels for raw pixel input");
8397
- if (is4.defined(inputOptions.animated))
8398
- if (is4.bool(inputOptions.animated))
8399
- inputDescriptor.pages = inputOptions.animated ? -1 : 1;
8400
- else
8401
- throw is4.invalidParameterError("animated", "boolean", inputOptions.animated);
8402
- if (is4.defined(inputOptions.pages))
8403
- if (is4.integer(inputOptions.pages) && is4.inRange(inputOptions.pages, -1, 1e5))
8404
- inputDescriptor.pages = inputOptions.pages;
8405
- else
8406
- throw is4.invalidParameterError("pages", "integer between -1 and 100000", inputOptions.pages);
8407
- if (is4.defined(inputOptions.page))
8408
- if (is4.integer(inputOptions.page) && is4.inRange(inputOptions.page, 0, 1e5))
8409
- inputDescriptor.page = inputOptions.page;
8410
- else
8411
- throw is4.invalidParameterError("page", "integer between 0 and 100000", inputOptions.page);
8412
- if (is4.defined(inputOptions.level))
8413
- if (is4.integer(inputOptions.level) && is4.inRange(inputOptions.level, 0, 256))
8414
- inputDescriptor.level = inputOptions.level;
8415
- else
8416
- throw is4.invalidParameterError("level", "integer between 0 and 256", inputOptions.level);
8417
- if (is4.defined(inputOptions.subifd))
8418
- if (is4.integer(inputOptions.subifd) && is4.inRange(inputOptions.subifd, -1, 1e5))
8419
- inputDescriptor.subifd = inputOptions.subifd;
8420
- else
8421
- throw is4.invalidParameterError("subifd", "integer between -1 and 100000", inputOptions.subifd);
8422
- if (is4.defined(inputOptions.create))
8423
- if (is4.object(inputOptions.create) && is4.integer(inputOptions.create.width) && inputOptions.create.width > 0 && is4.integer(inputOptions.create.height) && inputOptions.create.height > 0 && is4.integer(inputOptions.create.channels)) {
8424
- if (inputDescriptor.createWidth = inputOptions.create.width, inputDescriptor.createHeight = inputOptions.create.height, inputDescriptor.createChannels = inputOptions.create.channels, is4.defined(inputOptions.create.noise)) {
8425
- if (!is4.object(inputOptions.create.noise))
8426
- throw new Error("Expected noise to be an object");
8427
- if (!is4.inArray(inputOptions.create.noise.type, ["gaussian"]))
8428
- throw new Error("Only gaussian noise is supported at the moment");
8429
- if (!is4.inRange(inputOptions.create.channels, 1, 4))
8430
- throw is4.invalidParameterError("create.channels", "number between 1 and 4", inputOptions.create.channels);
8431
- if (inputDescriptor.createNoiseType = inputOptions.create.noise.type, is4.number(inputOptions.create.noise.mean) && is4.inRange(inputOptions.create.noise.mean, 0, 1e4))
8432
- inputDescriptor.createNoiseMean = inputOptions.create.noise.mean;
8433
- else
8434
- throw is4.invalidParameterError("create.noise.mean", "number between 0 and 10000", inputOptions.create.noise.mean);
8435
- if (is4.number(inputOptions.create.noise.sigma) && is4.inRange(inputOptions.create.noise.sigma, 0, 1e4))
8436
- inputDescriptor.createNoiseSigma = inputOptions.create.noise.sigma;
8437
- else
8438
- throw is4.invalidParameterError("create.noise.sigma", "number between 0 and 10000", inputOptions.create.noise.sigma);
8439
- } else if (is4.defined(inputOptions.create.background)) {
8440
- if (!is4.inRange(inputOptions.create.channels, 3, 4))
8441
- throw is4.invalidParameterError("create.channels", "number between 3 and 4", inputOptions.create.channels);
8442
- let background = color4(inputOptions.create.background);
8443
- inputDescriptor.createBackground = [
8444
- background.red(),
8445
- background.green(),
8446
- background.blue(),
8447
- Math.round(background.alpha() * 255)
8448
- ];
8449
- } else
8450
- throw new Error("Expected valid noise or background to create a new input image");
8451
- delete inputDescriptor.buffer;
8452
- } else
8453
- throw new Error("Expected valid width, height and channels to create a new input image");
8454
- if (is4.defined(inputOptions.text))
8455
- if (is4.object(inputOptions.text) && is4.string(inputOptions.text.text)) {
8456
- if (inputDescriptor.textValue = inputOptions.text.text, is4.defined(inputOptions.text.height) && is4.defined(inputOptions.text.dpi))
8457
- throw new Error("Expected only one of dpi or height");
8458
- if (is4.defined(inputOptions.text.font))
8459
- if (is4.string(inputOptions.text.font))
8460
- inputDescriptor.textFont = inputOptions.text.font;
8461
- else
8462
- throw is4.invalidParameterError("text.font", "string", inputOptions.text.font);
8463
- if (is4.defined(inputOptions.text.fontfile))
8464
- if (is4.string(inputOptions.text.fontfile))
8465
- inputDescriptor.textFontfile = inputOptions.text.fontfile;
8466
- else
8467
- throw is4.invalidParameterError("text.fontfile", "string", inputOptions.text.fontfile);
8468
- if (is4.defined(inputOptions.text.width))
8469
- if (is4.integer(inputOptions.text.width) && inputOptions.text.width > 0)
8470
- inputDescriptor.textWidth = inputOptions.text.width;
8471
- else
8472
- throw is4.invalidParameterError("text.width", "positive integer", inputOptions.text.width);
8473
- if (is4.defined(inputOptions.text.height))
8474
- if (is4.integer(inputOptions.text.height) && inputOptions.text.height > 0)
8475
- inputDescriptor.textHeight = inputOptions.text.height;
8476
- else
8477
- throw is4.invalidParameterError("text.height", "positive integer", inputOptions.text.height);
8478
- if (is4.defined(inputOptions.text.align))
8479
- if (is4.string(inputOptions.text.align) && is4.string(this.constructor.align[inputOptions.text.align]))
8480
- inputDescriptor.textAlign = this.constructor.align[inputOptions.text.align];
8481
- else
8482
- throw is4.invalidParameterError("text.align", "valid alignment", inputOptions.text.align);
8483
- if (is4.defined(inputOptions.text.justify))
8484
- if (is4.bool(inputOptions.text.justify))
8485
- inputDescriptor.textJustify = inputOptions.text.justify;
8486
- else
8487
- throw is4.invalidParameterError("text.justify", "boolean", inputOptions.text.justify);
8488
- if (is4.defined(inputOptions.text.dpi))
8489
- if (is4.integer(inputOptions.text.dpi) && is4.inRange(inputOptions.text.dpi, 1, 1e6))
8490
- inputDescriptor.textDpi = inputOptions.text.dpi;
8491
- else
8492
- throw is4.invalidParameterError("text.dpi", "integer between 1 and 1000000", inputOptions.text.dpi);
8493
- if (is4.defined(inputOptions.text.rgba))
8494
- if (is4.bool(inputOptions.text.rgba))
8495
- inputDescriptor.textRgba = inputOptions.text.rgba;
8496
- else
8497
- throw is4.invalidParameterError("text.rgba", "bool", inputOptions.text.rgba);
8498
- if (is4.defined(inputOptions.text.spacing))
8499
- if (is4.integer(inputOptions.text.spacing) && is4.inRange(inputOptions.text.spacing, -1e6, 1e6))
8500
- inputDescriptor.textSpacing = inputOptions.text.spacing;
8501
- else
8502
- throw is4.invalidParameterError("text.spacing", "integer between -1000000 and 1000000", inputOptions.text.spacing);
8503
- if (is4.defined(inputOptions.text.wrap))
8504
- if (is4.string(inputOptions.text.wrap) && is4.inArray(inputOptions.text.wrap, ["word", "char", "word-char", "none"]))
8505
- inputDescriptor.textWrap = inputOptions.text.wrap;
8506
- else
8507
- throw is4.invalidParameterError("text.wrap", "one of: word, char, word-char, none", inputOptions.text.wrap);
8508
- delete inputDescriptor.buffer;
8509
- } else
8510
- throw new Error("Expected a valid string to create an image with text.");
8511
- } else if (is4.defined(inputOptions))
8512
- throw new Error("Invalid input options " + inputOptions);
8513
- return inputDescriptor;
8514
- }
8515
- function _write(chunk, encoding, callback) {
8516
- Array.isArray(this.options.input.buffer) ? is4.buffer(chunk) ? (this.options.input.buffer.length === 0 && this.on("finish", () => {
8517
- this.streamInFinished = !0;
8518
- }), this.options.input.buffer.push(chunk), callback()) : callback(new Error("Non-Buffer data on Writable Stream")) : callback(new Error("Unexpected data on Writable Stream"));
8519
- }
8520
- function _flattenBufferIn() {
8521
- this._isStreamInput() && (this.options.input.buffer = Buffer.concat(this.options.input.buffer));
8522
- }
8523
- function _isStreamInput() {
8524
- return Array.isArray(this.options.input.buffer);
8525
- }
8526
- function metadata(callback) {
8527
- let stack = Error();
8528
- return is4.fn(callback) ? (this._isStreamInput() ? this.on("finish", () => {
8529
- this._flattenBufferIn(), sharp.metadata(this.options, (err, metadata2) => {
8530
- err ? callback(is4.nativeError(err, stack)) : callback(null, metadata2);
8531
- });
8532
- }) : sharp.metadata(this.options, (err, metadata2) => {
8533
- err ? callback(is4.nativeError(err, stack)) : callback(null, metadata2);
8534
- }), this) : this._isStreamInput() ? new Promise((resolve2, reject) => {
8535
- let finished = () => {
8536
- this._flattenBufferIn(), sharp.metadata(this.options, (err, metadata2) => {
8537
- err ? reject(is4.nativeError(err, stack)) : resolve2(metadata2);
8538
- });
8539
- };
8540
- this.writableFinished ? finished() : this.once("finish", finished);
8541
- }) : new Promise((resolve2, reject) => {
8542
- sharp.metadata(this.options, (err, metadata2) => {
8543
- err ? reject(is4.nativeError(err, stack)) : resolve2(metadata2);
8544
- });
8545
- });
8546
- }
8547
- function stats(callback) {
8548
- let stack = Error();
8549
- return is4.fn(callback) ? (this._isStreamInput() ? this.on("finish", () => {
8550
- this._flattenBufferIn(), sharp.stats(this.options, (err, stats2) => {
8551
- err ? callback(is4.nativeError(err, stack)) : callback(null, stats2);
8552
- });
8553
- }) : sharp.stats(this.options, (err, stats2) => {
8554
- err ? callback(is4.nativeError(err, stack)) : callback(null, stats2);
8555
- }), this) : this._isStreamInput() ? new Promise((resolve2, reject) => {
8556
- this.on("finish", function() {
8557
- this._flattenBufferIn(), sharp.stats(this.options, (err, stats2) => {
8558
- err ? reject(is4.nativeError(err, stack)) : resolve2(stats2);
8559
- });
8560
- });
8561
- }) : new Promise((resolve2, reject) => {
8562
- sharp.stats(this.options, (err, stats2) => {
8563
- err ? reject(is4.nativeError(err, stack)) : resolve2(stats2);
8564
- });
8565
- });
8566
- }
8567
- module2.exports = function(Sharp) {
8568
- Object.assign(Sharp.prototype, {
8569
- // Private
8570
- _inputOptionsFromObject,
8571
- _createInputDescriptor,
8572
- _write,
8573
- _flattenBufferIn,
8574
- _isStreamInput,
8575
- // Public
8576
- metadata,
8577
- stats
8578
- }), Sharp.align = align;
8579
- };
8580
- }
8581
- });
8582
-
8583
- // ../../node_modules/sharp/lib/resize.js
8584
- var require_resize = __commonJS({
8585
- "../../node_modules/sharp/lib/resize.js"(exports2, module2) {
8586
- "use strict";
8587
- var is4 = require_is(), gravity = {
8588
- center: 0,
8589
- centre: 0,
8590
- north: 1,
8591
- east: 2,
8592
- south: 3,
8593
- west: 4,
8594
- northeast: 5,
8595
- southeast: 6,
8596
- southwest: 7,
8597
- northwest: 8
8598
- }, position3 = {
8599
- top: 1,
8600
- right: 2,
8601
- bottom: 3,
8602
- left: 4,
8603
- "right top": 5,
8604
- "right bottom": 6,
8605
- "left bottom": 7,
8606
- "left top": 8
8607
- }, extendWith = {
8608
- background: "background",
8609
- copy: "copy",
8610
- repeat: "repeat",
8611
- mirror: "mirror"
8612
- }, strategy = {
8613
- entropy: 16,
8614
- attention: 17
8615
- }, kernel = {
8616
- nearest: "nearest",
8617
- linear: "linear",
8618
- cubic: "cubic",
8619
- mitchell: "mitchell",
8620
- lanczos2: "lanczos2",
8621
- lanczos3: "lanczos3"
8622
- }, fit = {
8623
- contain: "contain",
8624
- cover: "cover",
8625
- fill: "fill",
8626
- inside: "inside",
8627
- outside: "outside"
8628
- }, mapFitToCanvas = {
8629
- contain: "embed",
8630
- cover: "crop",
8631
- fill: "ignore_aspect",
8632
- inside: "max",
8633
- outside: "min"
8634
- };
8635
- function isRotationExpected(options2) {
8636
- return options2.angle % 360 !== 0 || options2.useExifOrientation === !0 || options2.rotationAngle !== 0;
8637
- }
8638
- function isResizeExpected(options2) {
8639
- return options2.width !== -1 || options2.height !== -1;
8640
- }
8641
- function resize(widthOrOptions, height, options2) {
8642
- if (isResizeExpected(this.options) && this.options.debuglog("ignoring previous resize options"), this.options.widthPost !== -1 && this.options.debuglog("operation order will be: extract, resize, extract"), is4.defined(widthOrOptions))
8643
- if (is4.object(widthOrOptions) && !is4.defined(options2))
8644
- options2 = widthOrOptions;
8645
- else if (is4.integer(widthOrOptions) && widthOrOptions > 0)
8646
- this.options.width = widthOrOptions;
8647
- else
8648
- throw is4.invalidParameterError("width", "positive integer", widthOrOptions);
8649
- else
8650
- this.options.width = -1;
8651
- if (is4.defined(height))
8652
- if (is4.integer(height) && height > 0)
8653
- this.options.height = height;
8654
- else
8655
- throw is4.invalidParameterError("height", "positive integer", height);
8656
- else
8657
- this.options.height = -1;
8658
- if (is4.object(options2)) {
8659
- if (is4.defined(options2.width))
8660
- if (is4.integer(options2.width) && options2.width > 0)
8661
- this.options.width = options2.width;
8662
- else
8663
- throw is4.invalidParameterError("width", "positive integer", options2.width);
8664
- if (is4.defined(options2.height))
8665
- if (is4.integer(options2.height) && options2.height > 0)
8666
- this.options.height = options2.height;
8667
- else
8668
- throw is4.invalidParameterError("height", "positive integer", options2.height);
8669
- if (is4.defined(options2.fit)) {
8670
- let canvas = mapFitToCanvas[options2.fit];
8671
- if (is4.string(canvas))
8672
- this.options.canvas = canvas;
8673
- else
8674
- throw is4.invalidParameterError("fit", "valid fit", options2.fit);
8675
- }
8676
- if (is4.defined(options2.position)) {
8677
- let pos = is4.integer(options2.position) ? options2.position : strategy[options2.position] || position3[options2.position] || gravity[options2.position];
8678
- if (is4.integer(pos) && (is4.inRange(pos, 0, 8) || is4.inRange(pos, 16, 17)))
8679
- this.options.position = pos;
8680
- else
8681
- throw is4.invalidParameterError("position", "valid position/gravity/strategy", options2.position);
8682
- }
8683
- if (this._setBackgroundColourOption("resizeBackground", options2.background), is4.defined(options2.kernel))
8684
- if (is4.string(kernel[options2.kernel]))
8685
- this.options.kernel = kernel[options2.kernel];
8686
- else
8687
- throw is4.invalidParameterError("kernel", "valid kernel name", options2.kernel);
8688
- is4.defined(options2.withoutEnlargement) && this._setBooleanOption("withoutEnlargement", options2.withoutEnlargement), is4.defined(options2.withoutReduction) && this._setBooleanOption("withoutReduction", options2.withoutReduction), is4.defined(options2.fastShrinkOnLoad) && this._setBooleanOption("fastShrinkOnLoad", options2.fastShrinkOnLoad);
8689
- }
8690
- return isRotationExpected(this.options) && isResizeExpected(this.options) && (this.options.rotateBeforePreExtract = !0), this;
8691
- }
8692
- function extend3(extend4) {
8693
- if (is4.integer(extend4) && extend4 > 0)
8694
- this.options.extendTop = extend4, this.options.extendBottom = extend4, this.options.extendLeft = extend4, this.options.extendRight = extend4;
8695
- else if (is4.object(extend4)) {
8696
- if (is4.defined(extend4.top))
8697
- if (is4.integer(extend4.top) && extend4.top >= 0)
8698
- this.options.extendTop = extend4.top;
8699
- else
8700
- throw is4.invalidParameterError("top", "positive integer", extend4.top);
8701
- if (is4.defined(extend4.bottom))
8702
- if (is4.integer(extend4.bottom) && extend4.bottom >= 0)
8703
- this.options.extendBottom = extend4.bottom;
8704
- else
8705
- throw is4.invalidParameterError("bottom", "positive integer", extend4.bottom);
8706
- if (is4.defined(extend4.left))
8707
- if (is4.integer(extend4.left) && extend4.left >= 0)
8708
- this.options.extendLeft = extend4.left;
8709
- else
8710
- throw is4.invalidParameterError("left", "positive integer", extend4.left);
8711
- if (is4.defined(extend4.right))
8712
- if (is4.integer(extend4.right) && extend4.right >= 0)
8713
- this.options.extendRight = extend4.right;
8714
- else
8715
- throw is4.invalidParameterError("right", "positive integer", extend4.right);
8716
- if (this._setBackgroundColourOption("extendBackground", extend4.background), is4.defined(extend4.extendWith))
8717
- if (is4.string(extendWith[extend4.extendWith]))
8718
- this.options.extendWith = extendWith[extend4.extendWith];
8719
- else
8720
- throw is4.invalidParameterError("extendWith", "one of: background, copy, repeat, mirror", extend4.extendWith);
8721
- } else
8722
- throw is4.invalidParameterError("extend", "integer or object", extend4);
8723
- return this;
8724
- }
8725
- function extract(options2) {
8726
- let suffix = isResizeExpected(this.options) || this.options.widthPre !== -1 ? "Post" : "Pre";
8727
- return this.options[`width${suffix}`] !== -1 && this.options.debuglog("ignoring previous extract options"), ["left", "top", "width", "height"].forEach(function(name) {
8728
- let value = options2[name];
8729
- if (is4.integer(value) && value >= 0)
8730
- this.options[name + (name === "left" || name === "top" ? "Offset" : "") + suffix] = value;
8731
- else
8732
- throw is4.invalidParameterError(name, "integer", value);
8733
- }, this), isRotationExpected(this.options) && !isResizeExpected(this.options) && (this.options.widthPre === -1 || this.options.widthPost === -1) && (this.options.rotateBeforePreExtract = !0), this;
8734
- }
8735
- function trim(options2) {
8736
- if (this.options.trimThreshold = 10, is4.defined(options2))
8737
- if (is4.object(options2)) {
8738
- if (is4.defined(options2.background) && this._setBackgroundColourOption("trimBackground", options2.background), is4.defined(options2.threshold))
8739
- if (is4.number(options2.threshold) && options2.threshold >= 0)
8740
- this.options.trimThreshold = options2.threshold;
8741
- else
8742
- throw is4.invalidParameterError("threshold", "positive number", options2.threshold);
8743
- is4.defined(options2.lineArt) && this._setBooleanOption("trimLineArt", options2.lineArt);
8744
- } else
8745
- throw is4.invalidParameterError("trim", "object", options2);
8746
- return isRotationExpected(this.options) && (this.options.rotateBeforePreExtract = !0), this;
8747
- }
8748
- module2.exports = function(Sharp) {
8749
- Object.assign(Sharp.prototype, {
8750
- resize,
8751
- extend: extend3,
8752
- extract,
8753
- trim
8754
- }), Sharp.gravity = gravity, Sharp.strategy = strategy, Sharp.kernel = kernel, Sharp.fit = fit, Sharp.position = position3;
8755
- };
8756
- }
8757
- });
8758
-
8759
- // ../../node_modules/sharp/lib/composite.js
8760
- var require_composite = __commonJS({
8761
- "../../node_modules/sharp/lib/composite.js"(exports2, module2) {
8762
- "use strict";
8763
- var is4 = require_is(), blend = {
8764
- clear: "clear",
8765
- source: "source",
8766
- over: "over",
8767
- in: "in",
8768
- out: "out",
8769
- atop: "atop",
8770
- dest: "dest",
8771
- "dest-over": "dest-over",
8772
- "dest-in": "dest-in",
8773
- "dest-out": "dest-out",
8774
- "dest-atop": "dest-atop",
8775
- xor: "xor",
8776
- add: "add",
8777
- saturate: "saturate",
8778
- multiply: "multiply",
8779
- screen: "screen",
8780
- overlay: "overlay",
8781
- darken: "darken",
8782
- lighten: "lighten",
8783
- "colour-dodge": "colour-dodge",
8784
- "color-dodge": "colour-dodge",
8785
- "colour-burn": "colour-burn",
8786
- "color-burn": "colour-burn",
8787
- "hard-light": "hard-light",
8788
- "soft-light": "soft-light",
8789
- difference: "difference",
8790
- exclusion: "exclusion"
8791
- };
8792
- function composite(images) {
8793
- if (!Array.isArray(images))
8794
- throw is4.invalidParameterError("images to composite", "array", images);
8795
- return this.options.composite = images.map((image2) => {
8796
- if (!is4.object(image2))
8797
- throw is4.invalidParameterError("image to composite", "object", image2);
8798
- let inputOptions = this._inputOptionsFromObject(image2), composite2 = {
8799
- input: this._createInputDescriptor(image2.input, inputOptions, { allowStream: !1 }),
8800
- blend: "over",
8801
- tile: !1,
8802
- left: 0,
8803
- top: 0,
8804
- hasOffset: !1,
8805
- gravity: 0,
8806
- premultiplied: !1
8807
- };
8808
- if (is4.defined(image2.blend))
8809
- if (is4.string(blend[image2.blend]))
8810
- composite2.blend = blend[image2.blend];
8811
- else
8812
- throw is4.invalidParameterError("blend", "valid blend name", image2.blend);
8813
- if (is4.defined(image2.tile))
8814
- if (is4.bool(image2.tile))
8815
- composite2.tile = image2.tile;
8816
- else
8817
- throw is4.invalidParameterError("tile", "boolean", image2.tile);
8818
- if (is4.defined(image2.left))
8819
- if (is4.integer(image2.left))
8820
- composite2.left = image2.left;
8821
- else
8822
- throw is4.invalidParameterError("left", "integer", image2.left);
8823
- if (is4.defined(image2.top))
8824
- if (is4.integer(image2.top))
8825
- composite2.top = image2.top;
8826
- else
8827
- throw is4.invalidParameterError("top", "integer", image2.top);
8828
- if (is4.defined(image2.top) !== is4.defined(image2.left))
8829
- throw new Error("Expected both left and top to be set");
8830
- if (composite2.hasOffset = is4.integer(image2.top) && is4.integer(image2.left), is4.defined(image2.gravity))
8831
- if (is4.integer(image2.gravity) && is4.inRange(image2.gravity, 0, 8))
8832
- composite2.gravity = image2.gravity;
8833
- else if (is4.string(image2.gravity) && is4.integer(this.constructor.gravity[image2.gravity]))
8834
- composite2.gravity = this.constructor.gravity[image2.gravity];
8835
- else
8836
- throw is4.invalidParameterError("gravity", "valid gravity", image2.gravity);
8837
- if (is4.defined(image2.premultiplied))
8838
- if (is4.bool(image2.premultiplied))
8839
- composite2.premultiplied = image2.premultiplied;
8840
- else
8841
- throw is4.invalidParameterError("premultiplied", "boolean", image2.premultiplied);
8842
- return composite2;
8843
- }), this;
8844
- }
8845
- module2.exports = function(Sharp) {
8846
- Sharp.prototype.composite = composite, Sharp.blend = blend;
8847
- };
8848
- }
8849
- });
8850
-
8851
- // ../../node_modules/sharp/lib/operation.js
8852
- var require_operation = __commonJS({
8853
- "../../node_modules/sharp/lib/operation.js"(exports2, module2) {
8854
- "use strict";
8855
- var color4 = require_color(), is4 = require_is(), vipsPrecision = {
8856
- integer: "integer",
8857
- float: "float",
8858
- approximate: "approximate"
8859
- };
8860
- function rotate(angle, options2) {
8861
- if ((this.options.useExifOrientation || this.options.angle || this.options.rotationAngle) && this.options.debuglog("ignoring previous rotate options"), !is4.defined(angle))
8862
- this.options.useExifOrientation = !0;
8863
- else if (is4.integer(angle) && !(angle % 90))
8864
- this.options.angle = angle;
8865
- else if (is4.number(angle)) {
8866
- if (this.options.rotationAngle = angle, is4.object(options2) && options2.background) {
8867
- let backgroundColour = color4(options2.background);
8868
- this.options.rotationBackground = [
8869
- backgroundColour.red(),
8870
- backgroundColour.green(),
8871
- backgroundColour.blue(),
8872
- Math.round(backgroundColour.alpha() * 255)
8873
- ];
8874
- }
8875
- } else
8876
- throw is4.invalidParameterError("angle", "numeric", angle);
8877
- return this;
8878
- }
8879
- function flip(flip2) {
8880
- return this.options.flip = is4.bool(flip2) ? flip2 : !0, this;
8881
- }
8882
- function flop(flop2) {
8883
- return this.options.flop = is4.bool(flop2) ? flop2 : !0, this;
8884
- }
8885
- function affine(matrix, options2) {
8886
- let flatMatrix = [].concat(...matrix);
8887
- if (flatMatrix.length === 4 && flatMatrix.every(is4.number))
8888
- this.options.affineMatrix = flatMatrix;
8889
- else
8890
- throw is4.invalidParameterError("matrix", "1x4 or 2x2 array", matrix);
8891
- if (is4.defined(options2))
8892
- if (is4.object(options2)) {
8893
- if (this._setBackgroundColourOption("affineBackground", options2.background), is4.defined(options2.idx))
8894
- if (is4.number(options2.idx))
8895
- this.options.affineIdx = options2.idx;
8896
- else
8897
- throw is4.invalidParameterError("options.idx", "number", options2.idx);
8898
- if (is4.defined(options2.idy))
8899
- if (is4.number(options2.idy))
8900
- this.options.affineIdy = options2.idy;
8901
- else
8902
- throw is4.invalidParameterError("options.idy", "number", options2.idy);
8903
- if (is4.defined(options2.odx))
8904
- if (is4.number(options2.odx))
8905
- this.options.affineOdx = options2.odx;
8906
- else
8907
- throw is4.invalidParameterError("options.odx", "number", options2.odx);
8908
- if (is4.defined(options2.ody))
8909
- if (is4.number(options2.ody))
8910
- this.options.affineOdy = options2.ody;
8911
- else
8912
- throw is4.invalidParameterError("options.ody", "number", options2.ody);
8913
- if (is4.defined(options2.interpolator))
8914
- if (is4.inArray(options2.interpolator, Object.values(this.constructor.interpolators)))
8915
- this.options.affineInterpolator = options2.interpolator;
8916
- else
8917
- throw is4.invalidParameterError("options.interpolator", "valid interpolator name", options2.interpolator);
8918
- } else
8919
- throw is4.invalidParameterError("options", "object", options2);
8920
- return this;
8921
- }
8922
- function sharpen(options2, flat, jagged) {
8923
- if (!is4.defined(options2))
8924
- this.options.sharpenSigma = -1;
8925
- else if (is4.bool(options2))
8926
- this.options.sharpenSigma = options2 ? -1 : 0;
8927
- else if (is4.number(options2) && is4.inRange(options2, 0.01, 1e4)) {
8928
- if (this.options.sharpenSigma = options2, is4.defined(flat))
8929
- if (is4.number(flat) && is4.inRange(flat, 0, 1e4))
8930
- this.options.sharpenM1 = flat;
8931
- else
8932
- throw is4.invalidParameterError("flat", "number between 0 and 10000", flat);
8933
- if (is4.defined(jagged))
8934
- if (is4.number(jagged) && is4.inRange(jagged, 0, 1e4))
8935
- this.options.sharpenM2 = jagged;
8936
- else
8937
- throw is4.invalidParameterError("jagged", "number between 0 and 10000", jagged);
8938
- } else if (is4.plainObject(options2)) {
8939
- if (is4.number(options2.sigma) && is4.inRange(options2.sigma, 1e-6, 10))
8940
- this.options.sharpenSigma = options2.sigma;
8941
- else
8942
- throw is4.invalidParameterError("options.sigma", "number between 0.000001 and 10", options2.sigma);
8943
- if (is4.defined(options2.m1))
8944
- if (is4.number(options2.m1) && is4.inRange(options2.m1, 0, 1e6))
8945
- this.options.sharpenM1 = options2.m1;
8946
- else
8947
- throw is4.invalidParameterError("options.m1", "number between 0 and 1000000", options2.m1);
8948
- if (is4.defined(options2.m2))
8949
- if (is4.number(options2.m2) && is4.inRange(options2.m2, 0, 1e6))
8950
- this.options.sharpenM2 = options2.m2;
8951
- else
8952
- throw is4.invalidParameterError("options.m2", "number between 0 and 1000000", options2.m2);
8953
- if (is4.defined(options2.x1))
8954
- if (is4.number(options2.x1) && is4.inRange(options2.x1, 0, 1e6))
8955
- this.options.sharpenX1 = options2.x1;
8956
- else
8957
- throw is4.invalidParameterError("options.x1", "number between 0 and 1000000", options2.x1);
8958
- if (is4.defined(options2.y2))
8959
- if (is4.number(options2.y2) && is4.inRange(options2.y2, 0, 1e6))
8960
- this.options.sharpenY2 = options2.y2;
8961
- else
8962
- throw is4.invalidParameterError("options.y2", "number between 0 and 1000000", options2.y2);
8963
- if (is4.defined(options2.y3))
8964
- if (is4.number(options2.y3) && is4.inRange(options2.y3, 0, 1e6))
8965
- this.options.sharpenY3 = options2.y3;
8966
- else
8967
- throw is4.invalidParameterError("options.y3", "number between 0 and 1000000", options2.y3);
8968
- } else
8969
- throw is4.invalidParameterError("sigma", "number between 0.01 and 10000", options2);
8970
- return this;
8971
- }
8972
- function median(size) {
8973
- if (!is4.defined(size))
8974
- this.options.medianSize = 3;
8975
- else if (is4.integer(size) && is4.inRange(size, 1, 1e3))
8976
- this.options.medianSize = size;
8977
- else
8978
- throw is4.invalidParameterError("size", "integer between 1 and 1000", size);
8979
- return this;
8980
- }
8981
- function blur(options2) {
8982
- let sigma;
8983
- if (is4.number(options2))
8984
- sigma = options2;
8985
- else if (is4.plainObject(options2)) {
8986
- if (!is4.number(options2.sigma))
8987
- throw is4.invalidParameterError("options.sigma", "number between 0.3 and 1000", sigma);
8988
- if (sigma = options2.sigma, "precision" in options2)
8989
- if (is4.string(vipsPrecision[options2.precision]))
8990
- this.options.precision = vipsPrecision[options2.precision];
8991
- else
8992
- throw is4.invalidParameterError("precision", "one of: integer, float, approximate", options2.precision);
8993
- if ("minAmplitude" in options2)
8994
- if (is4.number(options2.minAmplitude) && is4.inRange(options2.minAmplitude, 1e-3, 1))
8995
- this.options.minAmpl = options2.minAmplitude;
8996
- else
8997
- throw is4.invalidParameterError("minAmplitude", "number between 0.001 and 1", options2.minAmplitude);
8998
- }
8999
- if (!is4.defined(options2))
9000
- this.options.blurSigma = -1;
9001
- else if (is4.bool(options2))
9002
- this.options.blurSigma = options2 ? -1 : 0;
9003
- else if (is4.number(sigma) && is4.inRange(sigma, 0.3, 1e3))
9004
- this.options.blurSigma = sigma;
9005
- else
9006
- throw is4.invalidParameterError("sigma", "number between 0.3 and 1000", sigma);
9007
- return this;
9008
- }
9009
- function flatten(options2) {
9010
- return this.options.flatten = is4.bool(options2) ? options2 : !0, is4.object(options2) && this._setBackgroundColourOption("flattenBackground", options2.background), this;
9011
- }
9012
- function unflatten() {
9013
- return this.options.unflatten = !0, this;
9014
- }
9015
- function gamma(gamma2, gammaOut) {
9016
- if (!is4.defined(gamma2))
9017
- this.options.gamma = 2.2;
9018
- else if (is4.number(gamma2) && is4.inRange(gamma2, 1, 3))
9019
- this.options.gamma = gamma2;
9020
- else
9021
- throw is4.invalidParameterError("gamma", "number between 1.0 and 3.0", gamma2);
9022
- if (!is4.defined(gammaOut))
9023
- this.options.gammaOut = this.options.gamma;
9024
- else if (is4.number(gammaOut) && is4.inRange(gammaOut, 1, 3))
9025
- this.options.gammaOut = gammaOut;
9026
- else
9027
- throw is4.invalidParameterError("gammaOut", "number between 1.0 and 3.0", gammaOut);
9028
- return this;
9029
- }
9030
- function negate(options2) {
9031
- if (this.options.negate = is4.bool(options2) ? options2 : !0, is4.plainObject(options2) && "alpha" in options2)
9032
- if (is4.bool(options2.alpha))
9033
- this.options.negateAlpha = options2.alpha;
9034
- else
9035
- throw is4.invalidParameterError("alpha", "should be boolean value", options2.alpha);
9036
- return this;
9037
- }
9038
- function normalise(options2) {
9039
- if (is4.plainObject(options2)) {
9040
- if (is4.defined(options2.lower))
9041
- if (is4.number(options2.lower) && is4.inRange(options2.lower, 0, 99))
9042
- this.options.normaliseLower = options2.lower;
9043
- else
9044
- throw is4.invalidParameterError("lower", "number between 0 and 99", options2.lower);
9045
- if (is4.defined(options2.upper))
9046
- if (is4.number(options2.upper) && is4.inRange(options2.upper, 1, 100))
9047
- this.options.normaliseUpper = options2.upper;
9048
- else
9049
- throw is4.invalidParameterError("upper", "number between 1 and 100", options2.upper);
9050
- }
9051
- if (this.options.normaliseLower >= this.options.normaliseUpper)
9052
- throw is4.invalidParameterError(
9053
- "range",
9054
- "lower to be less than upper",
9055
- `${this.options.normaliseLower} >= ${this.options.normaliseUpper}`
9056
- );
9057
- return this.options.normalise = !0, this;
9058
- }
9059
- function normalize2(options2) {
9060
- return this.normalise(options2);
9061
- }
9062
- function clahe(options2) {
9063
- if (is4.plainObject(options2)) {
9064
- if (is4.integer(options2.width) && options2.width > 0)
9065
- this.options.claheWidth = options2.width;
9066
- else
9067
- throw is4.invalidParameterError("width", "integer greater than zero", options2.width);
9068
- if (is4.integer(options2.height) && options2.height > 0)
9069
- this.options.claheHeight = options2.height;
9070
- else
9071
- throw is4.invalidParameterError("height", "integer greater than zero", options2.height);
9072
- if (is4.defined(options2.maxSlope))
9073
- if (is4.integer(options2.maxSlope) && is4.inRange(options2.maxSlope, 0, 100))
9074
- this.options.claheMaxSlope = options2.maxSlope;
9075
- else
9076
- throw is4.invalidParameterError("maxSlope", "integer between 0 and 100", options2.maxSlope);
9077
- } else
9078
- throw is4.invalidParameterError("options", "plain object", options2);
9079
- return this;
9080
- }
9081
- function convolve(kernel) {
9082
- if (!is4.object(kernel) || !Array.isArray(kernel.kernel) || !is4.integer(kernel.width) || !is4.integer(kernel.height) || !is4.inRange(kernel.width, 3, 1001) || !is4.inRange(kernel.height, 3, 1001) || kernel.height * kernel.width !== kernel.kernel.length)
9083
- throw new Error("Invalid convolution kernel");
9084
- return is4.integer(kernel.scale) || (kernel.scale = kernel.kernel.reduce(function(a, b) {
9085
- return a + b;
9086
- }, 0)), kernel.scale < 1 && (kernel.scale = 1), is4.integer(kernel.offset) || (kernel.offset = 0), this.options.convKernel = kernel, this;
9087
- }
9088
- function threshold(threshold2, options2) {
9089
- if (!is4.defined(threshold2))
9090
- this.options.threshold = 128;
9091
- else if (is4.bool(threshold2))
9092
- this.options.threshold = threshold2 ? 128 : 0;
9093
- else if (is4.integer(threshold2) && is4.inRange(threshold2, 0, 255))
9094
- this.options.threshold = threshold2;
9095
- else
9096
- throw is4.invalidParameterError("threshold", "integer between 0 and 255", threshold2);
9097
- return !is4.object(options2) || options2.greyscale === !0 || options2.grayscale === !0 ? this.options.thresholdGrayscale = !0 : this.options.thresholdGrayscale = !1, this;
9098
- }
9099
- function boolean2(operand, operator, options2) {
9100
- if (this.options.boolean = this._createInputDescriptor(operand, options2), is4.string(operator) && is4.inArray(operator, ["and", "or", "eor"]))
9101
- this.options.booleanOp = operator;
9102
- else
9103
- throw is4.invalidParameterError("operator", "one of: and, or, eor", operator);
9104
- return this;
9105
- }
9106
- function linear(a, b) {
9107
- if (!is4.defined(a) && is4.number(b) ? a = 1 : is4.number(a) && !is4.defined(b) && (b = 0), !is4.defined(a))
9108
- this.options.linearA = [];
9109
- else if (is4.number(a))
9110
- this.options.linearA = [a];
9111
- else if (Array.isArray(a) && a.length && a.every(is4.number))
9112
- this.options.linearA = a;
9113
- else
9114
- throw is4.invalidParameterError("a", "number or array of numbers", a);
9115
- if (!is4.defined(b))
9116
- this.options.linearB = [];
9117
- else if (is4.number(b))
9118
- this.options.linearB = [b];
9119
- else if (Array.isArray(b) && b.length && b.every(is4.number))
9120
- this.options.linearB = b;
9121
- else
9122
- throw is4.invalidParameterError("b", "number or array of numbers", b);
9123
- if (this.options.linearA.length !== this.options.linearB.length)
9124
- throw new Error("Expected a and b to be arrays of the same length");
9125
- return this;
9126
- }
9127
- function recomb(inputMatrix) {
9128
- if (!Array.isArray(inputMatrix))
9129
- throw is4.invalidParameterError("inputMatrix", "array", inputMatrix);
9130
- if (inputMatrix.length !== 3 && inputMatrix.length !== 4)
9131
- throw is4.invalidParameterError("inputMatrix", "3x3 or 4x4 array", inputMatrix.length);
9132
- let recombMatrix = inputMatrix.flat().map(Number);
9133
- if (recombMatrix.length !== 9 && recombMatrix.length !== 16)
9134
- throw is4.invalidParameterError("inputMatrix", "cardinality of 9 or 16", recombMatrix.length);
9135
- return this.options.recombMatrix = recombMatrix, this;
9136
- }
9137
- function modulate(options2) {
9138
- if (!is4.plainObject(options2))
9139
- throw is4.invalidParameterError("options", "plain object", options2);
9140
- if ("brightness" in options2)
9141
- if (is4.number(options2.brightness) && options2.brightness >= 0)
9142
- this.options.brightness = options2.brightness;
9143
- else
9144
- throw is4.invalidParameterError("brightness", "number above zero", options2.brightness);
9145
- if ("saturation" in options2)
9146
- if (is4.number(options2.saturation) && options2.saturation >= 0)
9147
- this.options.saturation = options2.saturation;
9148
- else
9149
- throw is4.invalidParameterError("saturation", "number above zero", options2.saturation);
9150
- if ("hue" in options2)
9151
- if (is4.integer(options2.hue))
9152
- this.options.hue = options2.hue % 360;
9153
- else
9154
- throw is4.invalidParameterError("hue", "number", options2.hue);
9155
- if ("lightness" in options2)
9156
- if (is4.number(options2.lightness))
9157
- this.options.lightness = options2.lightness;
9158
- else
9159
- throw is4.invalidParameterError("lightness", "number", options2.lightness);
9160
- return this;
9161
- }
9162
- module2.exports = function(Sharp) {
9163
- Object.assign(Sharp.prototype, {
9164
- rotate,
9165
- flip,
9166
- flop,
9167
- affine,
9168
- sharpen,
9169
- median,
9170
- blur,
9171
- flatten,
9172
- unflatten,
9173
- gamma,
9174
- negate,
9175
- normalise,
9176
- normalize: normalize2,
9177
- clahe,
9178
- convolve,
9179
- threshold,
9180
- boolean: boolean2,
9181
- linear,
9182
- recomb,
9183
- modulate
9184
- });
9185
- };
9186
- }
9187
- });
9188
-
9189
- // ../../node_modules/sharp/lib/colour.js
9190
- var require_colour = __commonJS({
9191
- "../../node_modules/sharp/lib/colour.js"(exports2, module2) {
9192
- "use strict";
9193
- var color4 = require_color(), is4 = require_is(), colourspace = {
9194
- multiband: "multiband",
9195
- "b-w": "b-w",
9196
- bw: "b-w",
9197
- cmyk: "cmyk",
9198
- srgb: "srgb"
9199
- };
9200
- function tint(tint2) {
9201
- return this._setBackgroundColourOption("tint", tint2), this;
9202
- }
9203
- function greyscale(greyscale2) {
9204
- return this.options.greyscale = is4.bool(greyscale2) ? greyscale2 : !0, this;
9205
- }
9206
- function grayscale(grayscale2) {
9207
- return this.greyscale(grayscale2);
9208
- }
9209
- function pipelineColourspace(colourspace2) {
9210
- if (!is4.string(colourspace2))
9211
- throw is4.invalidParameterError("colourspace", "string", colourspace2);
9212
- return this.options.colourspacePipeline = colourspace2, this;
9213
- }
9214
- function pipelineColorspace(colorspace) {
9215
- return this.pipelineColourspace(colorspace);
9216
- }
9217
- function toColourspace(colourspace2) {
9218
- if (!is4.string(colourspace2))
9219
- throw is4.invalidParameterError("colourspace", "string", colourspace2);
9220
- return this.options.colourspace = colourspace2, this;
9221
- }
9222
- function toColorspace(colorspace) {
9223
- return this.toColourspace(colorspace);
9224
- }
9225
- function _setBackgroundColourOption(key2, value) {
9226
- if (is4.defined(value))
9227
- if (is4.object(value) || is4.string(value)) {
9228
- let colour = color4(value);
9229
- this.options[key2] = [
9230
- colour.red(),
9231
- colour.green(),
9232
- colour.blue(),
9233
- Math.round(colour.alpha() * 255)
9234
- ];
9235
- } else
9236
- throw is4.invalidParameterError("background", "object or string", value);
9237
- }
9238
- module2.exports = function(Sharp) {
9239
- Object.assign(Sharp.prototype, {
9240
- // Public
9241
- tint,
9242
- greyscale,
9243
- grayscale,
9244
- pipelineColourspace,
9245
- pipelineColorspace,
9246
- toColourspace,
9247
- toColorspace,
9248
- // Private
9249
- _setBackgroundColourOption
9250
- }), Sharp.colourspace = colourspace, Sharp.colorspace = colourspace;
9251
- };
9252
- }
9253
- });
9254
-
9255
- // ../../node_modules/sharp/lib/channel.js
9256
- var require_channel = __commonJS({
9257
- "../../node_modules/sharp/lib/channel.js"(exports2, module2) {
9258
- "use strict";
9259
- var is4 = require_is(), bool = {
9260
- and: "and",
9261
- or: "or",
9262
- eor: "eor"
9263
- };
9264
- function removeAlpha() {
9265
- return this.options.removeAlpha = !0, this;
9266
- }
9267
- function ensureAlpha(alpha) {
9268
- if (is4.defined(alpha))
9269
- if (is4.number(alpha) && is4.inRange(alpha, 0, 1))
9270
- this.options.ensureAlpha = alpha;
9271
- else
9272
- throw is4.invalidParameterError("alpha", "number between 0 and 1", alpha);
9273
- else
9274
- this.options.ensureAlpha = 1;
9275
- return this;
9276
- }
9277
- function extractChannel(channel) {
9278
- let channelMap = { red: 0, green: 1, blue: 2, alpha: 3 };
9279
- if (Object.keys(channelMap).includes(channel) && (channel = channelMap[channel]), is4.integer(channel) && is4.inRange(channel, 0, 4))
9280
- this.options.extractChannel = channel;
9281
- else
9282
- throw is4.invalidParameterError("channel", "integer or one of: red, green, blue, alpha", channel);
9283
- return this;
9284
- }
9285
- function joinChannel(images, options2) {
9286
- return Array.isArray(images) ? images.forEach(function(image2) {
9287
- this.options.joinChannelIn.push(this._createInputDescriptor(image2, options2));
9288
- }, this) : this.options.joinChannelIn.push(this._createInputDescriptor(images, options2)), this;
9289
- }
9290
- function bandbool(boolOp) {
9291
- if (is4.string(boolOp) && is4.inArray(boolOp, ["and", "or", "eor"]))
9292
- this.options.bandBoolOp = boolOp;
9293
- else
9294
- throw is4.invalidParameterError("boolOp", "one of: and, or, eor", boolOp);
9295
- return this;
9296
- }
9297
- module2.exports = function(Sharp) {
9298
- Object.assign(Sharp.prototype, {
9299
- // Public instance functions
9300
- removeAlpha,
9301
- ensureAlpha,
9302
- extractChannel,
9303
- joinChannel,
9304
- bandbool
9305
- }), Sharp.bool = bool;
9306
- };
9307
- }
9308
- });
9309
-
9310
- // ../../node_modules/sharp/lib/output.js
9311
- var require_output = __commonJS({
9312
- "../../node_modules/sharp/lib/output.js"(exports2, module2) {
9313
- "use strict";
9314
- var path5 = require("node:path"), is4 = require_is(), sharp = require_sharp(), formats = /* @__PURE__ */ new Map([
9315
- ["heic", "heif"],
9316
- ["heif", "heif"],
9317
- ["avif", "avif"],
9318
- ["jpeg", "jpeg"],
9319
- ["jpg", "jpeg"],
9320
- ["jpe", "jpeg"],
9321
- ["tile", "tile"],
9322
- ["dz", "tile"],
9323
- ["png", "png"],
9324
- ["raw", "raw"],
9325
- ["tiff", "tiff"],
9326
- ["tif", "tiff"],
9327
- ["webp", "webp"],
9328
- ["gif", "gif"],
9329
- ["jp2", "jp2"],
9330
- ["jpx", "jp2"],
9331
- ["j2k", "jp2"],
9332
- ["j2c", "jp2"],
9333
- ["jxl", "jxl"]
9334
- ]), jp2Regex = /\.(jp[2x]|j2[kc])$/i, errJp2Save = () => new Error("JP2 output requires libvips with support for OpenJPEG"), bitdepthFromColourCount = (colours) => 1 << 31 - Math.clz32(Math.ceil(Math.log2(colours)));
9335
- function toFile(fileOut, callback) {
9336
- let err;
9337
- if (is4.string(fileOut) ? is4.string(this.options.input.file) && path5.resolve(this.options.input.file) === path5.resolve(fileOut) ? err = new Error("Cannot use same file for input and output") : jp2Regex.test(path5.extname(fileOut)) && !this.constructor.format.jp2k.output.file && (err = errJp2Save()) : err = new Error("Missing output file path"), err)
9338
- if (is4.fn(callback))
9339
- callback(err);
9340
- else
9341
- return Promise.reject(err);
9342
- else {
9343
- this.options.fileOut = fileOut;
9344
- let stack = Error();
9345
- return this._pipeline(callback, stack);
9346
- }
9347
- return this;
9348
- }
9349
- function toBuffer(options2, callback) {
9350
- is4.object(options2) ? this._setBooleanOption("resolveWithObject", options2.resolveWithObject) : this.options.resolveWithObject && (this.options.resolveWithObject = !1), this.options.fileOut = "";
9351
- let stack = Error();
9352
- return this._pipeline(is4.fn(options2) ? options2 : callback, stack);
9353
- }
9354
- function keepExif() {
9355
- return this.options.keepMetadata |= 1, this;
9356
- }
9357
- function withExif(exif) {
9358
- if (is4.object(exif))
9359
- for (let [ifd, entries] of Object.entries(exif))
9360
- if (is4.object(entries))
9361
- for (let [k, v] of Object.entries(entries))
9362
- if (is4.string(v))
9363
- this.options.withExif[`exif-${ifd.toLowerCase()}-${k}`] = v;
9364
- else
9365
- throw is4.invalidParameterError(`${ifd}.${k}`, "string", v);
9366
- else
9367
- throw is4.invalidParameterError(ifd, "object", entries);
9368
- else
9369
- throw is4.invalidParameterError("exif", "object", exif);
9370
- return this.options.withExifMerge = !1, this.keepExif();
9371
- }
9372
- function withExifMerge(exif) {
9373
- return this.withExif(exif), this.options.withExifMerge = !0, this;
9374
- }
9375
- function keepIccProfile() {
9376
- return this.options.keepMetadata |= 8, this;
9377
- }
9378
- function withIccProfile(icc, options2) {
9379
- if (is4.string(icc))
9380
- this.options.withIccProfile = icc;
9381
- else
9382
- throw is4.invalidParameterError("icc", "string", icc);
9383
- if (this.keepIccProfile(), is4.object(options2) && is4.defined(options2.attach))
9384
- if (is4.bool(options2.attach))
9385
- options2.attach || (this.options.keepMetadata &= -9);
9386
- else
9387
- throw is4.invalidParameterError("attach", "boolean", options2.attach);
9388
- return this;
9389
- }
9390
- function keepMetadata() {
9391
- return this.options.keepMetadata = 31, this;
9392
- }
9393
- function withMetadata(options2) {
9394
- if (this.keepMetadata(), this.withIccProfile("srgb"), is4.object(options2)) {
9395
- if (is4.defined(options2.orientation))
9396
- if (is4.integer(options2.orientation) && is4.inRange(options2.orientation, 1, 8))
9397
- this.options.withMetadataOrientation = options2.orientation;
9398
- else
9399
- throw is4.invalidParameterError("orientation", "integer between 1 and 8", options2.orientation);
9400
- if (is4.defined(options2.density))
9401
- if (is4.number(options2.density) && options2.density > 0)
9402
- this.options.withMetadataDensity = options2.density;
9403
- else
9404
- throw is4.invalidParameterError("density", "positive number", options2.density);
9405
- is4.defined(options2.icc) && this.withIccProfile(options2.icc), is4.defined(options2.exif) && this.withExifMerge(options2.exif);
9406
- }
9407
- return this;
9408
- }
9409
- function toFormat(format, options2) {
9410
- let actualFormat = formats.get((is4.object(format) && is4.string(format.id) ? format.id : format).toLowerCase());
9411
- if (!actualFormat)
9412
- throw is4.invalidParameterError("format", `one of: ${[...formats.keys()].join(", ")}`, format);
9413
- return this[actualFormat](options2);
9414
- }
9415
- function jpeg(options2) {
9416
- if (is4.object(options2)) {
9417
- if (is4.defined(options2.quality))
9418
- if (is4.integer(options2.quality) && is4.inRange(options2.quality, 1, 100))
9419
- this.options.jpegQuality = options2.quality;
9420
- else
9421
- throw is4.invalidParameterError("quality", "integer between 1 and 100", options2.quality);
9422
- if (is4.defined(options2.progressive) && this._setBooleanOption("jpegProgressive", options2.progressive), is4.defined(options2.chromaSubsampling))
9423
- if (is4.string(options2.chromaSubsampling) && is4.inArray(options2.chromaSubsampling, ["4:2:0", "4:4:4"]))
9424
- this.options.jpegChromaSubsampling = options2.chromaSubsampling;
9425
- else
9426
- throw is4.invalidParameterError("chromaSubsampling", "one of: 4:2:0, 4:4:4", options2.chromaSubsampling);
9427
- let optimiseCoding = is4.bool(options2.optimizeCoding) ? options2.optimizeCoding : options2.optimiseCoding;
9428
- if (is4.defined(optimiseCoding) && this._setBooleanOption("jpegOptimiseCoding", optimiseCoding), is4.defined(options2.mozjpeg))
9429
- if (is4.bool(options2.mozjpeg))
9430
- options2.mozjpeg && (this.options.jpegTrellisQuantisation = !0, this.options.jpegOvershootDeringing = !0, this.options.jpegOptimiseScans = !0, this.options.jpegProgressive = !0, this.options.jpegQuantisationTable = 3);
9431
- else
9432
- throw is4.invalidParameterError("mozjpeg", "boolean", options2.mozjpeg);
9433
- let trellisQuantisation = is4.bool(options2.trellisQuantization) ? options2.trellisQuantization : options2.trellisQuantisation;
9434
- is4.defined(trellisQuantisation) && this._setBooleanOption("jpegTrellisQuantisation", trellisQuantisation), is4.defined(options2.overshootDeringing) && this._setBooleanOption("jpegOvershootDeringing", options2.overshootDeringing);
9435
- let optimiseScans = is4.bool(options2.optimizeScans) ? options2.optimizeScans : options2.optimiseScans;
9436
- is4.defined(optimiseScans) && (this._setBooleanOption("jpegOptimiseScans", optimiseScans), optimiseScans && (this.options.jpegProgressive = !0));
9437
- let quantisationTable = is4.number(options2.quantizationTable) ? options2.quantizationTable : options2.quantisationTable;
9438
- if (is4.defined(quantisationTable))
9439
- if (is4.integer(quantisationTable) && is4.inRange(quantisationTable, 0, 8))
9440
- this.options.jpegQuantisationTable = quantisationTable;
9441
- else
9442
- throw is4.invalidParameterError("quantisationTable", "integer between 0 and 8", quantisationTable);
9443
- }
9444
- return this._updateFormatOut("jpeg", options2);
9445
- }
9446
- function png(options2) {
9447
- if (is4.object(options2)) {
9448
- if (is4.defined(options2.progressive) && this._setBooleanOption("pngProgressive", options2.progressive), is4.defined(options2.compressionLevel))
9449
- if (is4.integer(options2.compressionLevel) && is4.inRange(options2.compressionLevel, 0, 9))
9450
- this.options.pngCompressionLevel = options2.compressionLevel;
9451
- else
9452
- throw is4.invalidParameterError("compressionLevel", "integer between 0 and 9", options2.compressionLevel);
9453
- is4.defined(options2.adaptiveFiltering) && this._setBooleanOption("pngAdaptiveFiltering", options2.adaptiveFiltering);
9454
- let colours = options2.colours || options2.colors;
9455
- if (is4.defined(colours))
9456
- if (is4.integer(colours) && is4.inRange(colours, 2, 256))
9457
- this.options.pngBitdepth = bitdepthFromColourCount(colours);
9458
- else
9459
- throw is4.invalidParameterError("colours", "integer between 2 and 256", colours);
9460
- if (is4.defined(options2.palette) ? this._setBooleanOption("pngPalette", options2.palette) : [options2.quality, options2.effort, options2.colours, options2.colors, options2.dither].some(is4.defined) && this._setBooleanOption("pngPalette", !0), this.options.pngPalette) {
9461
- if (is4.defined(options2.quality))
9462
- if (is4.integer(options2.quality) && is4.inRange(options2.quality, 0, 100))
9463
- this.options.pngQuality = options2.quality;
9464
- else
9465
- throw is4.invalidParameterError("quality", "integer between 0 and 100", options2.quality);
9466
- if (is4.defined(options2.effort))
9467
- if (is4.integer(options2.effort) && is4.inRange(options2.effort, 1, 10))
9468
- this.options.pngEffort = options2.effort;
9469
- else
9470
- throw is4.invalidParameterError("effort", "integer between 1 and 10", options2.effort);
9471
- if (is4.defined(options2.dither))
9472
- if (is4.number(options2.dither) && is4.inRange(options2.dither, 0, 1))
9473
- this.options.pngDither = options2.dither;
9474
- else
9475
- throw is4.invalidParameterError("dither", "number between 0.0 and 1.0", options2.dither);
9476
- }
9477
- }
9478
- return this._updateFormatOut("png", options2);
9479
- }
9480
- function webp(options2) {
9481
- if (is4.object(options2)) {
9482
- if (is4.defined(options2.quality))
9483
- if (is4.integer(options2.quality) && is4.inRange(options2.quality, 1, 100))
9484
- this.options.webpQuality = options2.quality;
9485
- else
9486
- throw is4.invalidParameterError("quality", "integer between 1 and 100", options2.quality);
9487
- if (is4.defined(options2.alphaQuality))
9488
- if (is4.integer(options2.alphaQuality) && is4.inRange(options2.alphaQuality, 0, 100))
9489
- this.options.webpAlphaQuality = options2.alphaQuality;
9490
- else
9491
- throw is4.invalidParameterError("alphaQuality", "integer between 0 and 100", options2.alphaQuality);
9492
- if (is4.defined(options2.lossless) && this._setBooleanOption("webpLossless", options2.lossless), is4.defined(options2.nearLossless) && this._setBooleanOption("webpNearLossless", options2.nearLossless), is4.defined(options2.smartSubsample) && this._setBooleanOption("webpSmartSubsample", options2.smartSubsample), is4.defined(options2.preset))
9493
- if (is4.string(options2.preset) && is4.inArray(options2.preset, ["default", "photo", "picture", "drawing", "icon", "text"]))
9494
- this.options.webpPreset = options2.preset;
9495
- else
9496
- throw is4.invalidParameterError("preset", "one of: default, photo, picture, drawing, icon, text", options2.preset);
9497
- if (is4.defined(options2.effort))
9498
- if (is4.integer(options2.effort) && is4.inRange(options2.effort, 0, 6))
9499
- this.options.webpEffort = options2.effort;
9500
- else
9501
- throw is4.invalidParameterError("effort", "integer between 0 and 6", options2.effort);
9502
- is4.defined(options2.minSize) && this._setBooleanOption("webpMinSize", options2.minSize), is4.defined(options2.mixed) && this._setBooleanOption("webpMixed", options2.mixed);
9503
- }
9504
- return trySetAnimationOptions(options2, this.options), this._updateFormatOut("webp", options2);
9505
- }
9506
- function gif(options2) {
9507
- if (is4.object(options2)) {
9508
- is4.defined(options2.reuse) && this._setBooleanOption("gifReuse", options2.reuse), is4.defined(options2.progressive) && this._setBooleanOption("gifProgressive", options2.progressive);
9509
- let colours = options2.colours || options2.colors;
9510
- if (is4.defined(colours))
9511
- if (is4.integer(colours) && is4.inRange(colours, 2, 256))
9512
- this.options.gifBitdepth = bitdepthFromColourCount(colours);
9513
- else
9514
- throw is4.invalidParameterError("colours", "integer between 2 and 256", colours);
9515
- if (is4.defined(options2.effort))
9516
- if (is4.number(options2.effort) && is4.inRange(options2.effort, 1, 10))
9517
- this.options.gifEffort = options2.effort;
9518
- else
9519
- throw is4.invalidParameterError("effort", "integer between 1 and 10", options2.effort);
9520
- if (is4.defined(options2.dither))
9521
- if (is4.number(options2.dither) && is4.inRange(options2.dither, 0, 1))
9522
- this.options.gifDither = options2.dither;
9523
- else
9524
- throw is4.invalidParameterError("dither", "number between 0.0 and 1.0", options2.dither);
9525
- if (is4.defined(options2.interFrameMaxError))
9526
- if (is4.number(options2.interFrameMaxError) && is4.inRange(options2.interFrameMaxError, 0, 32))
9527
- this.options.gifInterFrameMaxError = options2.interFrameMaxError;
9528
- else
9529
- throw is4.invalidParameterError("interFrameMaxError", "number between 0.0 and 32.0", options2.interFrameMaxError);
9530
- if (is4.defined(options2.interPaletteMaxError))
9531
- if (is4.number(options2.interPaletteMaxError) && is4.inRange(options2.interPaletteMaxError, 0, 256))
9532
- this.options.gifInterPaletteMaxError = options2.interPaletteMaxError;
9533
- else
9534
- throw is4.invalidParameterError("interPaletteMaxError", "number between 0.0 and 256.0", options2.interPaletteMaxError);
9535
- }
9536
- return trySetAnimationOptions(options2, this.options), this._updateFormatOut("gif", options2);
9537
- }
9538
- function jp2(options2) {
9539
- if (!this.constructor.format.jp2k.output.buffer)
9540
- throw errJp2Save();
9541
- if (is4.object(options2)) {
9542
- if (is4.defined(options2.quality))
9543
- if (is4.integer(options2.quality) && is4.inRange(options2.quality, 1, 100))
9544
- this.options.jp2Quality = options2.quality;
9545
- else
9546
- throw is4.invalidParameterError("quality", "integer between 1 and 100", options2.quality);
9547
- if (is4.defined(options2.lossless))
9548
- if (is4.bool(options2.lossless))
9549
- this.options.jp2Lossless = options2.lossless;
9550
- else
9551
- throw is4.invalidParameterError("lossless", "boolean", options2.lossless);
9552
- if (is4.defined(options2.tileWidth))
9553
- if (is4.integer(options2.tileWidth) && is4.inRange(options2.tileWidth, 1, 32768))
9554
- this.options.jp2TileWidth = options2.tileWidth;
9555
- else
9556
- throw is4.invalidParameterError("tileWidth", "integer between 1 and 32768", options2.tileWidth);
9557
- if (is4.defined(options2.tileHeight))
9558
- if (is4.integer(options2.tileHeight) && is4.inRange(options2.tileHeight, 1, 32768))
9559
- this.options.jp2TileHeight = options2.tileHeight;
9560
- else
9561
- throw is4.invalidParameterError("tileHeight", "integer between 1 and 32768", options2.tileHeight);
9562
- if (is4.defined(options2.chromaSubsampling))
9563
- if (is4.string(options2.chromaSubsampling) && is4.inArray(options2.chromaSubsampling, ["4:2:0", "4:4:4"]))
9564
- this.options.jp2ChromaSubsampling = options2.chromaSubsampling;
9565
- else
9566
- throw is4.invalidParameterError("chromaSubsampling", "one of: 4:2:0, 4:4:4", options2.chromaSubsampling);
9567
- }
9568
- return this._updateFormatOut("jp2", options2);
9569
- }
9570
- function trySetAnimationOptions(source, target) {
9571
- if (is4.object(source) && is4.defined(source.loop))
9572
- if (is4.integer(source.loop) && is4.inRange(source.loop, 0, 65535))
9573
- target.loop = source.loop;
9574
- else
9575
- throw is4.invalidParameterError("loop", "integer between 0 and 65535", source.loop);
9576
- if (is4.object(source) && is4.defined(source.delay))
9577
- if (is4.integer(source.delay) && is4.inRange(source.delay, 0, 65535))
9578
- target.delay = [source.delay];
9579
- else if (Array.isArray(source.delay) && source.delay.every(is4.integer) && source.delay.every((v) => is4.inRange(v, 0, 65535)))
9580
- target.delay = source.delay;
9581
- else
9582
- throw is4.invalidParameterError("delay", "integer or an array of integers between 0 and 65535", source.delay);
9583
- }
9584
- function tiff(options2) {
9585
- if (is4.object(options2)) {
9586
- if (is4.defined(options2.quality))
9587
- if (is4.integer(options2.quality) && is4.inRange(options2.quality, 1, 100))
9588
- this.options.tiffQuality = options2.quality;
9589
- else
9590
- throw is4.invalidParameterError("quality", "integer between 1 and 100", options2.quality);
9591
- if (is4.defined(options2.bitdepth))
9592
- if (is4.integer(options2.bitdepth) && is4.inArray(options2.bitdepth, [1, 2, 4, 8]))
9593
- this.options.tiffBitdepth = options2.bitdepth;
9594
- else
9595
- throw is4.invalidParameterError("bitdepth", "1, 2, 4 or 8", options2.bitdepth);
9596
- if (is4.defined(options2.tile) && this._setBooleanOption("tiffTile", options2.tile), is4.defined(options2.tileWidth))
9597
- if (is4.integer(options2.tileWidth) && options2.tileWidth > 0)
9598
- this.options.tiffTileWidth = options2.tileWidth;
9599
- else
9600
- throw is4.invalidParameterError("tileWidth", "integer greater than zero", options2.tileWidth);
9601
- if (is4.defined(options2.tileHeight))
9602
- if (is4.integer(options2.tileHeight) && options2.tileHeight > 0)
9603
- this.options.tiffTileHeight = options2.tileHeight;
9604
- else
9605
- throw is4.invalidParameterError("tileHeight", "integer greater than zero", options2.tileHeight);
9606
- if (is4.defined(options2.miniswhite) && this._setBooleanOption("tiffMiniswhite", options2.miniswhite), is4.defined(options2.pyramid) && this._setBooleanOption("tiffPyramid", options2.pyramid), is4.defined(options2.xres))
9607
- if (is4.number(options2.xres) && options2.xres > 0)
9608
- this.options.tiffXres = options2.xres;
9609
- else
9610
- throw is4.invalidParameterError("xres", "number greater than zero", options2.xres);
9611
- if (is4.defined(options2.yres))
9612
- if (is4.number(options2.yres) && options2.yres > 0)
9613
- this.options.tiffYres = options2.yres;
9614
- else
9615
- throw is4.invalidParameterError("yres", "number greater than zero", options2.yres);
9616
- if (is4.defined(options2.compression))
9617
- if (is4.string(options2.compression) && is4.inArray(options2.compression, ["none", "jpeg", "deflate", "packbits", "ccittfax4", "lzw", "webp", "zstd", "jp2k"]))
9618
- this.options.tiffCompression = options2.compression;
9619
- else
9620
- throw is4.invalidParameterError("compression", "one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k", options2.compression);
9621
- if (is4.defined(options2.predictor))
9622
- if (is4.string(options2.predictor) && is4.inArray(options2.predictor, ["none", "horizontal", "float"]))
9623
- this.options.tiffPredictor = options2.predictor;
9624
- else
9625
- throw is4.invalidParameterError("predictor", "one of: none, horizontal, float", options2.predictor);
9626
- if (is4.defined(options2.resolutionUnit))
9627
- if (is4.string(options2.resolutionUnit) && is4.inArray(options2.resolutionUnit, ["inch", "cm"]))
9628
- this.options.tiffResolutionUnit = options2.resolutionUnit;
9629
- else
9630
- throw is4.invalidParameterError("resolutionUnit", "one of: inch, cm", options2.resolutionUnit);
9631
- }
9632
- return this._updateFormatOut("tiff", options2);
9633
- }
9634
- function avif(options2) {
9635
- return this.heif({ ...options2, compression: "av1" });
9636
- }
9637
- function heif(options2) {
9638
- if (is4.object(options2)) {
9639
- if (is4.string(options2.compression) && is4.inArray(options2.compression, ["av1", "hevc"]))
9640
- this.options.heifCompression = options2.compression;
9641
- else
9642
- throw is4.invalidParameterError("compression", "one of: av1, hevc", options2.compression);
9643
- if (is4.defined(options2.quality))
9644
- if (is4.integer(options2.quality) && is4.inRange(options2.quality, 1, 100))
9645
- this.options.heifQuality = options2.quality;
9646
- else
9647
- throw is4.invalidParameterError("quality", "integer between 1 and 100", options2.quality);
9648
- if (is4.defined(options2.lossless))
9649
- if (is4.bool(options2.lossless))
9650
- this.options.heifLossless = options2.lossless;
9651
- else
9652
- throw is4.invalidParameterError("lossless", "boolean", options2.lossless);
9653
- if (is4.defined(options2.effort))
9654
- if (is4.integer(options2.effort) && is4.inRange(options2.effort, 0, 9))
9655
- this.options.heifEffort = options2.effort;
9656
- else
9657
- throw is4.invalidParameterError("effort", "integer between 0 and 9", options2.effort);
9658
- if (is4.defined(options2.chromaSubsampling))
9659
- if (is4.string(options2.chromaSubsampling) && is4.inArray(options2.chromaSubsampling, ["4:2:0", "4:4:4"]))
9660
- this.options.heifChromaSubsampling = options2.chromaSubsampling;
9661
- else
9662
- throw is4.invalidParameterError("chromaSubsampling", "one of: 4:2:0, 4:4:4", options2.chromaSubsampling);
9663
- if (is4.defined(options2.bitdepth))
9664
- if (is4.integer(options2.bitdepth) && is4.inArray(options2.bitdepth, [8, 10, 12])) {
9665
- if (options2.bitdepth !== 8 && this.constructor.versions.heif)
9666
- throw is4.invalidParameterError("bitdepth when using prebuilt binaries", 8, options2.bitdepth);
9667
- this.options.heifBitdepth = options2.bitdepth;
9668
- } else
9669
- throw is4.invalidParameterError("bitdepth", "8, 10 or 12", options2.bitdepth);
9670
- } else
9671
- throw is4.invalidParameterError("options", "Object", options2);
9672
- return this._updateFormatOut("heif", options2);
9673
- }
9674
- function jxl(options2) {
9675
- if (is4.object(options2)) {
9676
- if (is4.defined(options2.quality))
9677
- if (is4.integer(options2.quality) && is4.inRange(options2.quality, 1, 100))
9678
- this.options.jxlDistance = options2.quality >= 30 ? 0.1 + (100 - options2.quality) * 0.09 : 53 / 3e3 * options2.quality * options2.quality - 23 / 20 * options2.quality + 25;
9679
- else
9680
- throw is4.invalidParameterError("quality", "integer between 1 and 100", options2.quality);
9681
- else if (is4.defined(options2.distance))
9682
- if (is4.number(options2.distance) && is4.inRange(options2.distance, 0, 15))
9683
- this.options.jxlDistance = options2.distance;
9684
- else
9685
- throw is4.invalidParameterError("distance", "number between 0.0 and 15.0", options2.distance);
9686
- if (is4.defined(options2.decodingTier))
9687
- if (is4.integer(options2.decodingTier) && is4.inRange(options2.decodingTier, 0, 4))
9688
- this.options.jxlDecodingTier = options2.decodingTier;
9689
- else
9690
- throw is4.invalidParameterError("decodingTier", "integer between 0 and 4", options2.decodingTier);
9691
- if (is4.defined(options2.lossless))
9692
- if (is4.bool(options2.lossless))
9693
- this.options.jxlLossless = options2.lossless;
9694
- else
9695
- throw is4.invalidParameterError("lossless", "boolean", options2.lossless);
9696
- if (is4.defined(options2.effort))
9697
- if (is4.integer(options2.effort) && is4.inRange(options2.effort, 3, 9))
9698
- this.options.jxlEffort = options2.effort;
9699
- else
9700
- throw is4.invalidParameterError("effort", "integer between 3 and 9", options2.effort);
9701
- }
9702
- return this._updateFormatOut("jxl", options2);
9703
- }
9704
- function raw2(options2) {
9705
- if (is4.object(options2) && is4.defined(options2.depth))
9706
- if (is4.string(options2.depth) && is4.inArray(
9707
- options2.depth,
9708
- ["char", "uchar", "short", "ushort", "int", "uint", "float", "complex", "double", "dpcomplex"]
9709
- ))
9710
- this.options.rawDepth = options2.depth;
9711
- else
9712
- throw is4.invalidParameterError("depth", "one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex", options2.depth);
9713
- return this._updateFormatOut("raw");
9714
- }
9715
- function tile(options2) {
9716
- if (is4.object(options2)) {
9717
- if (is4.defined(options2.size))
9718
- if (is4.integer(options2.size) && is4.inRange(options2.size, 1, 8192))
9719
- this.options.tileSize = options2.size;
9720
- else
9721
- throw is4.invalidParameterError("size", "integer between 1 and 8192", options2.size);
9722
- if (is4.defined(options2.overlap))
9723
- if (is4.integer(options2.overlap) && is4.inRange(options2.overlap, 0, 8192)) {
9724
- if (options2.overlap > this.options.tileSize)
9725
- throw is4.invalidParameterError("overlap", `<= size (${this.options.tileSize})`, options2.overlap);
9726
- this.options.tileOverlap = options2.overlap;
9727
- } else
9728
- throw is4.invalidParameterError("overlap", "integer between 0 and 8192", options2.overlap);
9729
- if (is4.defined(options2.container))
9730
- if (is4.string(options2.container) && is4.inArray(options2.container, ["fs", "zip"]))
9731
- this.options.tileContainer = options2.container;
9732
- else
9733
- throw is4.invalidParameterError("container", "one of: fs, zip", options2.container);
9734
- if (is4.defined(options2.layout))
9735
- if (is4.string(options2.layout) && is4.inArray(options2.layout, ["dz", "google", "iiif", "iiif3", "zoomify"]))
9736
- this.options.tileLayout = options2.layout;
9737
- else
9738
- throw is4.invalidParameterError("layout", "one of: dz, google, iiif, iiif3, zoomify", options2.layout);
9739
- if (is4.defined(options2.angle))
9740
- if (is4.integer(options2.angle) && !(options2.angle % 90))
9741
- this.options.tileAngle = options2.angle;
9742
- else
9743
- throw is4.invalidParameterError("angle", "positive/negative multiple of 90", options2.angle);
9744
- if (this._setBackgroundColourOption("tileBackground", options2.background), is4.defined(options2.depth))
9745
- if (is4.string(options2.depth) && is4.inArray(options2.depth, ["onepixel", "onetile", "one"]))
9746
- this.options.tileDepth = options2.depth;
9747
- else
9748
- throw is4.invalidParameterError("depth", "one of: onepixel, onetile, one", options2.depth);
9749
- if (is4.defined(options2.skipBlanks))
9750
- if (is4.integer(options2.skipBlanks) && is4.inRange(options2.skipBlanks, -1, 65535))
9751
- this.options.tileSkipBlanks = options2.skipBlanks;
9752
- else
9753
- throw is4.invalidParameterError("skipBlanks", "integer between -1 and 255/65535", options2.skipBlanks);
9754
- else is4.defined(options2.layout) && options2.layout === "google" && (this.options.tileSkipBlanks = 5);
9755
- let centre = is4.bool(options2.center) ? options2.center : options2.centre;
9756
- if (is4.defined(centre) && this._setBooleanOption("tileCentre", centre), is4.defined(options2.id))
9757
- if (is4.string(options2.id))
9758
- this.options.tileId = options2.id;
9759
- else
9760
- throw is4.invalidParameterError("id", "string", options2.id);
9761
- if (is4.defined(options2.basename))
9762
- if (is4.string(options2.basename))
9763
- this.options.tileBasename = options2.basename;
9764
- else
9765
- throw is4.invalidParameterError("basename", "string", options2.basename);
9766
- }
9767
- if (is4.inArray(this.options.formatOut, ["jpeg", "png", "webp"]))
9768
- this.options.tileFormat = this.options.formatOut;
9769
- else if (this.options.formatOut !== "input")
9770
- throw is4.invalidParameterError("format", "one of: jpeg, png, webp", this.options.formatOut);
9771
- return this._updateFormatOut("dz");
9772
- }
9773
- function timeout(options2) {
9774
- if (!is4.plainObject(options2))
9775
- throw is4.invalidParameterError("options", "object", options2);
9776
- if (is4.integer(options2.seconds) && is4.inRange(options2.seconds, 0, 3600))
9777
- this.options.timeoutSeconds = options2.seconds;
9778
- else
9779
- throw is4.invalidParameterError("seconds", "integer between 0 and 3600", options2.seconds);
9780
- return this;
9781
- }
9782
- function _updateFormatOut(formatOut, options2) {
9783
- return is4.object(options2) && options2.force === !1 || (this.options.formatOut = formatOut), this;
9784
- }
9785
- function _setBooleanOption(key2, val) {
9786
- if (is4.bool(val))
9787
- this.options[key2] = val;
9788
- else
9789
- throw is4.invalidParameterError(key2, "boolean", val);
9790
- }
9791
- function _read() {
9792
- if (!this.options.streamOut) {
9793
- this.options.streamOut = !0;
9794
- let stack = Error();
9795
- this._pipeline(void 0, stack);
9796
- }
9797
- }
9798
- function _pipeline(callback, stack) {
9799
- return typeof callback == "function" ? (this._isStreamInput() ? this.on("finish", () => {
9800
- this._flattenBufferIn(), sharp.pipeline(this.options, (err, data, info) => {
9801
- err ? callback(is4.nativeError(err, stack)) : callback(null, data, info);
9802
- });
9803
- }) : sharp.pipeline(this.options, (err, data, info) => {
9804
- err ? callback(is4.nativeError(err, stack)) : callback(null, data, info);
9805
- }), this) : this.options.streamOut ? (this._isStreamInput() ? (this.once("finish", () => {
9806
- this._flattenBufferIn(), sharp.pipeline(this.options, (err, data, info) => {
9807
- err ? this.emit("error", is4.nativeError(err, stack)) : (this.emit("info", info), this.push(data)), this.push(null), this.on("end", () => this.emit("close"));
9808
- });
9809
- }), this.streamInFinished && this.emit("finish")) : sharp.pipeline(this.options, (err, data, info) => {
9810
- err ? this.emit("error", is4.nativeError(err, stack)) : (this.emit("info", info), this.push(data)), this.push(null), this.on("end", () => this.emit("close"));
9811
- }), this) : this._isStreamInput() ? new Promise((resolve2, reject) => {
9812
- this.once("finish", () => {
9813
- this._flattenBufferIn(), sharp.pipeline(this.options, (err, data, info) => {
9814
- err ? reject(is4.nativeError(err, stack)) : this.options.resolveWithObject ? resolve2({ data, info }) : resolve2(data);
9815
- });
9816
- });
9817
- }) : new Promise((resolve2, reject) => {
9818
- sharp.pipeline(this.options, (err, data, info) => {
9819
- err ? reject(is4.nativeError(err, stack)) : this.options.resolveWithObject ? resolve2({ data, info }) : resolve2(data);
9820
- });
9821
- });
9822
- }
9823
- module2.exports = function(Sharp) {
9824
- Object.assign(Sharp.prototype, {
9825
- // Public
9826
- toFile,
9827
- toBuffer,
9828
- keepExif,
9829
- withExif,
9830
- withExifMerge,
9831
- keepIccProfile,
9832
- withIccProfile,
9833
- keepMetadata,
9834
- withMetadata,
9835
- toFormat,
9836
- jpeg,
9837
- jp2,
9838
- png,
9839
- webp,
9840
- tiff,
9841
- avif,
9842
- heif,
9843
- jxl,
9844
- gif,
9845
- raw: raw2,
9846
- tile,
9847
- timeout,
9848
- // Private
9849
- _updateFormatOut,
9850
- _setBooleanOption,
9851
- _read,
9852
- _pipeline
9853
- });
9854
- };
9855
- }
9856
- });
9857
-
9858
- // ../../node_modules/sharp/lib/utility.js
9859
- var require_utility = __commonJS({
9860
- "../../node_modules/sharp/lib/utility.js"(exports2, module2) {
9861
- "use strict";
9862
- var events = require("node:events"), detectLibc = require_detect_libc(), is4 = require_is(), { runtimePlatformArch } = require_libvips(), sharp = require_sharp(), runtimePlatform = runtimePlatformArch(), libvipsVersion = sharp.libvipsVersion(), format = sharp.format();
9863
- format.heif.output.alias = ["avif", "heic"];
9864
- format.jpeg.output.alias = ["jpe", "jpg"];
9865
- format.tiff.output.alias = ["tif"];
9866
- format.jp2k.output.alias = ["j2c", "j2k", "jp2", "jpx"];
9867
- var interpolators = {
9868
- /** [Nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation). Suitable for image enlargement only. */
9869
- nearest: "nearest",
9870
- /** [Bilinear interpolation](http://en.wikipedia.org/wiki/Bilinear_interpolation). Faster than bicubic but with less smooth results. */
9871
- bilinear: "bilinear",
9872
- /** [Bicubic interpolation](http://en.wikipedia.org/wiki/Bicubic_interpolation) (the default). */
9873
- bicubic: "bicubic",
9874
- /** [LBB interpolation](https://github.com/libvips/libvips/blob/master/libvips/resample/lbb.cpp#L100). Prevents some "[acutance](http://en.wikipedia.org/wiki/Acutance)" but typically reduces performance by a factor of 2. */
9875
- locallyBoundedBicubic: "lbb",
9876
- /** [Nohalo interpolation](http://eprints.soton.ac.uk/268086/). Prevents acutance but typically reduces performance by a factor of 3. */
9877
- nohalo: "nohalo",
9878
- /** [VSQBS interpolation](https://github.com/libvips/libvips/blob/master/libvips/resample/vsqbs.cpp#L48). Prevents "staircasing" when enlarging. */
9879
- vertexSplitQuadraticBasisSpline: "vsqbs"
9880
- }, versions = {
9881
- vips: libvipsVersion.semver
9882
- };
9883
- if (!libvipsVersion.isGlobal)
9884
- if (libvipsVersion.isWasm)
9885
- try {
9886
- versions = require("@img/sharp-wasm32/versions");
9887
- } catch {
9888
- }
9889
- else
9890
- try {
9891
- versions = require(`@img/sharp-${runtimePlatform}/versions`);
9892
- } catch {
9893
- try {
9894
- versions = require(`@img/sharp-libvips-${runtimePlatform}/versions`);
9895
- } catch {
9896
- }
9897
- }
9898
- versions.sharp = require_package().version;
9899
- versions.heif && format.heif && (format.heif.input.fileSuffix = [".avif"], format.heif.output.alias = ["avif"]);
9900
- function cache(options2) {
9901
- return is4.bool(options2) ? options2 ? sharp.cache(50, 20, 100) : sharp.cache(0, 0, 0) : is4.object(options2) ? sharp.cache(options2.memory, options2.files, options2.items) : sharp.cache();
9902
- }
9903
- cache(!0);
9904
- function concurrency(concurrency2) {
9905
- return sharp.concurrency(is4.integer(concurrency2) ? concurrency2 : null);
9906
- }
9907
- detectLibc.familySync() === detectLibc.GLIBC && !sharp._isUsingJemalloc() ? sharp.concurrency(1) : detectLibc.familySync() === detectLibc.MUSL && sharp.concurrency() === 1024 && sharp.concurrency(require("node:os").availableParallelism());
9908
- var queue = new events.EventEmitter();
9909
- function counters() {
9910
- return sharp.counters();
9911
- }
9912
- function simd(simd2) {
9913
- return sharp.simd(is4.bool(simd2) ? simd2 : null);
9914
- }
9915
- function block(options2) {
9916
- if (is4.object(options2))
9917
- if (Array.isArray(options2.operation) && options2.operation.every(is4.string))
9918
- sharp.block(options2.operation, !0);
9919
- else
9920
- throw is4.invalidParameterError("operation", "Array<string>", options2.operation);
9921
- else
9922
- throw is4.invalidParameterError("options", "object", options2);
9923
- }
9924
- function unblock(options2) {
9925
- if (is4.object(options2))
9926
- if (Array.isArray(options2.operation) && options2.operation.every(is4.string))
9927
- sharp.block(options2.operation, !1);
9928
- else
9929
- throw is4.invalidParameterError("operation", "Array<string>", options2.operation);
9930
- else
9931
- throw is4.invalidParameterError("options", "object", options2);
9932
- }
9933
- module2.exports = function(Sharp) {
9934
- Sharp.cache = cache, Sharp.concurrency = concurrency, Sharp.counters = counters, Sharp.simd = simd, Sharp.format = format, Sharp.interpolators = interpolators, Sharp.versions = versions, Sharp.queue = queue, Sharp.block = block, Sharp.unblock = unblock;
9935
- };
9936
- }
9937
- });
9938
-
9939
- // ../../node_modules/sharp/lib/index.js
9940
- var require_lib = __commonJS({
9941
- "../../node_modules/sharp/lib/index.js"(exports2, module2) {
9942
- "use strict";
9943
- var Sharp = require_constructor();
9944
- require_input()(Sharp);
9945
- require_resize()(Sharp);
9946
- require_composite()(Sharp);
9947
- require_operation()(Sharp);
9948
- require_colour()(Sharp);
9949
- require_channel()(Sharp);
9950
- require_output()(Sharp);
9951
- require_utility()(Sharp);
9952
- module2.exports = Sharp;
9953
- }
9954
- });
9955
-
9956
5824
  // ../../node_modules/parse-numeric-range/index.js
9957
5825
  var require_parse_numeric_range = __commonJS({
9958
5826
  "../../node_modules/parse-numeric-range/index.js"(exports2, module2) {
@@ -10026,7 +5894,7 @@ var require_convert = __commonJS({
10026
5894
  });
10027
5895
 
10028
5896
  // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.js
10029
- var require_color2 = __commonJS({
5897
+ var require_color = __commonJS({
10030
5898
  "../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.js"(exports2, module2) {
10031
5899
  module2.exports = color4;
10032
5900
  function color4(d) {
@@ -10040,7 +5908,7 @@ var require_unist_util_visit_parents = __commonJS({
10040
5908
  "../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js"(exports2, module2) {
10041
5909
  "use strict";
10042
5910
  module2.exports = visitParents4;
10043
- var convert4 = require_convert(), color4 = require_color2(), CONTINUE4 = !0, SKIP4 = "skip", EXIT4 = !1;
5911
+ var convert4 = require_convert(), color4 = require_color(), CONTINUE4 = !0, SKIP4 = "skip", EXIT4 = !1;
10044
5912
  visitParents4.CONTINUE = CONTINUE4;
10045
5913
  visitParents4.SKIP = SKIP4;
10046
5914
  visitParents4.EXIT = EXIT4;
@@ -18787,7 +14655,7 @@ function remarkGfm(options2) {
18787
14655
  var import_node_fs2 = require("node:fs"), import_node_path2 = require("node:path");
18788
14656
  async function getSharp() {
18789
14657
  try {
18790
- let sharpModule = await Promise.resolve().then(() => __toESM(require_lib()));
14658
+ let sharpModule = await import("sharp");
18791
14659
  return sharpModule.default || sharpModule;
18792
14660
  } catch {
18793
14661
  return null;
@@ -18801,7 +14669,7 @@ async function processImageMeta(imagePath, opts) {
18801
14669
  if (!sharp)
18802
14670
  return null;
18803
14671
  try {
18804
- let image2 = sharp(filePath), metadata = await image2.metadata(), { width = 0, height = 0 } = metadata, blurDataURL = `data:image/jpeg;base64,${(await image2.resize(10).blur(1).jpeg({ quality: 40 }).toBuffer()).toString("base64")}`;
14672
+ let image2 = sharp(filePath), metadata = await image2.metadata(), { width = 0, height = 0 } = metadata, blurDataURL = `data:image/jpeg;base64,${(await image2.resize(10).blur().jpeg({ quality: 40 }).toBuffer()).toString("base64")}`;
18805
14673
  return { width, height, blurDataURL };
18806
14674
  } catch {
18807
14675
  return null;