@mettlelabs/mettle 0.0.0-beta.1 → 0.0.0-beta.1-linux-x64
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/THIRD_PARTY_NOTICES.md +11479 -0
- package/bin/mettle +4 -0
- package/harness/audit-investigation.mjs +203 -0
- package/harness/chunk-13tgmdey.mjs +33761 -0
- package/harness/chunk-1sygmp11.mjs +18142 -0
- package/harness/chunk-1ykxpmaz.mjs +7887 -0
- package/harness/chunk-2gt4cy7x.mjs +2290 -0
- package/harness/chunk-2pm2sayw.mjs +248 -0
- package/harness/chunk-32y07kkp.mjs +3747 -0
- package/harness/chunk-3m7jn5ac.mjs +16242 -0
- package/harness/chunk-3wvjs93w.mjs +538 -0
- package/harness/chunk-4bepyxmq.mjs +113 -0
- package/harness/chunk-4jtnt9k5.mjs +95 -0
- package/harness/chunk-50sbrf09.mjs +18972 -0
- package/harness/chunk-56csr8sw.mjs +322 -0
- package/harness/chunk-5cvb1jnb.mjs +41 -0
- package/harness/chunk-5wgmv4np.mjs +585 -0
- package/harness/chunk-65eyq32y.mjs +225 -0
- package/harness/chunk-6fnh6qhk.mjs +195 -0
- package/harness/chunk-6kgqw9ny.mjs +32303 -0
- package/harness/chunk-7b242j0n.mjs +14 -0
- package/harness/chunk-7bg2gnv2.mjs +7540 -0
- package/harness/chunk-ageqxj9v.mjs +63008 -0
- package/harness/chunk-b0qbt5jd.mjs +14 -0
- package/harness/chunk-b5g1r3fz.mjs +4785 -0
- package/harness/chunk-b71gpkxg.mjs +1514 -0
- package/harness/chunk-bdv1rx4a.mjs +20364 -0
- package/harness/chunk-c1631s2x.mjs +12241 -0
- package/harness/chunk-d5xgxsnp.mjs +74 -0
- package/harness/chunk-erg1fbh0.mjs +0 -0
- package/harness/chunk-fh78v9vn.mjs +19366 -0
- package/harness/chunk-fjx29qvp.mjs +50 -0
- package/harness/chunk-gryka6kg.mjs +39 -0
- package/harness/chunk-jb0r19et.mjs +180 -0
- package/harness/chunk-mfn574ss.mjs +179 -0
- package/harness/chunk-msg872ea.mjs +334 -0
- package/harness/chunk-nz5sv9as.mjs +1642 -0
- package/harness/chunk-p9d3cgvq.mjs +452 -0
- package/harness/chunk-pq6wvwxr.mjs +12 -0
- package/harness/chunk-qcm9arf8.mjs +7736 -0
- package/harness/chunk-qr8zfqjd.mjs +24 -0
- package/harness/chunk-rz2tz6jp.mjs +26 -0
- package/harness/chunk-sbkgc3kn.mjs +8 -0
- package/harness/chunk-v66qvpnb.mjs +169 -0
- package/harness/chunk-vjaxzab3.mjs +136 -0
- package/harness/chunk-vr1n5nza.mjs +1045 -0
- package/harness/chunk-vsf2zajv.mjs +3867 -0
- package/harness/chunk-wq253fj4.mjs +19041 -0
- package/harness/chunk-wyv7ceq4.mjs +0 -0
- package/harness/chunk-xnqknk2r.mjs +198 -0
- package/harness/chunk-xqyc4ca2.mjs +1890 -0
- package/harness/chunk-z6n9thea.mjs +45146 -0
- package/harness/chunk-zty0d3bw.mjs +0 -0
- package/harness/chunk-zvkxtj82.mjs +42 -0
- package/harness/issue-api-token.mjs +35 -0
- package/harness/launcher.mjs +159 -0
- package/harness/sandbox.mjs +132 -0
- package/harness/server.mjs +66322 -0
- package/package.json +13 -15
- package/bin/mettle.js +0 -51
|
@@ -0,0 +1,1642 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__require
|
|
4
|
+
} from "./chunk-fjx29qvp.mjs";
|
|
5
|
+
|
|
6
|
+
// node_modules/.bun/ms@2.0.0/node_modules/ms/index.js
|
|
7
|
+
var require_ms = __commonJS(function(exports, module) {
|
|
8
|
+
var s = 1000;
|
|
9
|
+
var m = s * 60;
|
|
10
|
+
var h = m * 60;
|
|
11
|
+
var d = h * 24;
|
|
12
|
+
var y = d * 365.25;
|
|
13
|
+
module.exports = function(val, options) {
|
|
14
|
+
options = options || {};
|
|
15
|
+
var type = typeof val;
|
|
16
|
+
if (type === "string" && val.length > 0) {
|
|
17
|
+
return parse(val);
|
|
18
|
+
} else if (type === "number" && isNaN(val) === false) {
|
|
19
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
20
|
+
}
|
|
21
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
22
|
+
};
|
|
23
|
+
function parse(str) {
|
|
24
|
+
str = String(str);
|
|
25
|
+
if (str.length > 100) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
|
|
29
|
+
if (!match) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var n = parseFloat(match[1]);
|
|
33
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
34
|
+
switch (type) {
|
|
35
|
+
case "years":
|
|
36
|
+
case "year":
|
|
37
|
+
case "yrs":
|
|
38
|
+
case "yr":
|
|
39
|
+
case "y":
|
|
40
|
+
return n * y;
|
|
41
|
+
case "days":
|
|
42
|
+
case "day":
|
|
43
|
+
case "d":
|
|
44
|
+
return n * d;
|
|
45
|
+
case "hours":
|
|
46
|
+
case "hour":
|
|
47
|
+
case "hrs":
|
|
48
|
+
case "hr":
|
|
49
|
+
case "h":
|
|
50
|
+
return n * h;
|
|
51
|
+
case "minutes":
|
|
52
|
+
case "minute":
|
|
53
|
+
case "mins":
|
|
54
|
+
case "min":
|
|
55
|
+
case "m":
|
|
56
|
+
return n * m;
|
|
57
|
+
case "seconds":
|
|
58
|
+
case "second":
|
|
59
|
+
case "secs":
|
|
60
|
+
case "sec":
|
|
61
|
+
case "s":
|
|
62
|
+
return n * s;
|
|
63
|
+
case "milliseconds":
|
|
64
|
+
case "millisecond":
|
|
65
|
+
case "msecs":
|
|
66
|
+
case "msec":
|
|
67
|
+
case "ms":
|
|
68
|
+
return n;
|
|
69
|
+
default:
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function fmtShort(ms) {
|
|
74
|
+
if (ms >= d) {
|
|
75
|
+
return Math.round(ms / d) + "d";
|
|
76
|
+
}
|
|
77
|
+
if (ms >= h) {
|
|
78
|
+
return Math.round(ms / h) + "h";
|
|
79
|
+
}
|
|
80
|
+
if (ms >= m) {
|
|
81
|
+
return Math.round(ms / m) + "m";
|
|
82
|
+
}
|
|
83
|
+
if (ms >= s) {
|
|
84
|
+
return Math.round(ms / s) + "s";
|
|
85
|
+
}
|
|
86
|
+
return ms + "ms";
|
|
87
|
+
}
|
|
88
|
+
function fmtLong(ms) {
|
|
89
|
+
return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms";
|
|
90
|
+
}
|
|
91
|
+
function plural(ms, n, name) {
|
|
92
|
+
if (ms < n) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (ms < n * 1.5) {
|
|
96
|
+
return Math.floor(ms / n) + " " + name;
|
|
97
|
+
}
|
|
98
|
+
return Math.ceil(ms / n) + " " + name + "s";
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// node_modules/.bun/debug@2.6.9/node_modules/debug/src/debug.js
|
|
103
|
+
var require_debug = __commonJS(function(exports, module) {
|
|
104
|
+
exports = module.exports = createDebug.debug = createDebug["default"] = createDebug;
|
|
105
|
+
exports.coerce = coerce;
|
|
106
|
+
exports.disable = disable;
|
|
107
|
+
exports.enable = enable;
|
|
108
|
+
exports.enabled = enabled;
|
|
109
|
+
exports.humanize = require_ms();
|
|
110
|
+
exports.names = [];
|
|
111
|
+
exports.skips = [];
|
|
112
|
+
exports.formatters = {};
|
|
113
|
+
var prevTime;
|
|
114
|
+
function selectColor(namespace) {
|
|
115
|
+
var hash = 0, i;
|
|
116
|
+
for (i in namespace) {
|
|
117
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
118
|
+
hash |= 0;
|
|
119
|
+
}
|
|
120
|
+
return exports.colors[Math.abs(hash) % exports.colors.length];
|
|
121
|
+
}
|
|
122
|
+
function createDebug(namespace) {
|
|
123
|
+
function debug() {
|
|
124
|
+
if (!debug.enabled)
|
|
125
|
+
return;
|
|
126
|
+
var self = debug;
|
|
127
|
+
var curr = +new Date;
|
|
128
|
+
var ms = curr - (prevTime || curr);
|
|
129
|
+
self.diff = ms;
|
|
130
|
+
self.prev = prevTime;
|
|
131
|
+
self.curr = curr;
|
|
132
|
+
prevTime = curr;
|
|
133
|
+
var args = new Array(arguments.length);
|
|
134
|
+
for (var i = 0;i < args.length; i++) {
|
|
135
|
+
args[i] = arguments[i];
|
|
136
|
+
}
|
|
137
|
+
args[0] = exports.coerce(args[0]);
|
|
138
|
+
if (typeof args[0] !== "string") {
|
|
139
|
+
args.unshift("%O");
|
|
140
|
+
}
|
|
141
|
+
var index = 0;
|
|
142
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
|
143
|
+
if (match === "%%")
|
|
144
|
+
return match;
|
|
145
|
+
index++;
|
|
146
|
+
var formatter = exports.formatters[format];
|
|
147
|
+
if (typeof formatter === "function") {
|
|
148
|
+
var val = args[index];
|
|
149
|
+
match = formatter.call(self, val);
|
|
150
|
+
args.splice(index, 1);
|
|
151
|
+
index--;
|
|
152
|
+
}
|
|
153
|
+
return match;
|
|
154
|
+
});
|
|
155
|
+
exports.formatArgs.call(self, args);
|
|
156
|
+
var logFn = debug.log || exports.log || console.log.bind(console);
|
|
157
|
+
logFn.apply(self, args);
|
|
158
|
+
}
|
|
159
|
+
debug.namespace = namespace;
|
|
160
|
+
debug.enabled = exports.enabled(namespace);
|
|
161
|
+
debug.useColors = exports.useColors();
|
|
162
|
+
debug.color = selectColor(namespace);
|
|
163
|
+
if (typeof exports.init === "function") {
|
|
164
|
+
exports.init(debug);
|
|
165
|
+
}
|
|
166
|
+
return debug;
|
|
167
|
+
}
|
|
168
|
+
function enable(namespaces) {
|
|
169
|
+
exports.save(namespaces);
|
|
170
|
+
exports.names = [];
|
|
171
|
+
exports.skips = [];
|
|
172
|
+
var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
|
|
173
|
+
var len = split.length;
|
|
174
|
+
for (var i = 0;i < len; i++) {
|
|
175
|
+
if (!split[i])
|
|
176
|
+
continue;
|
|
177
|
+
namespaces = split[i].replace(/\*/g, ".*?");
|
|
178
|
+
if (namespaces[0] === "-") {
|
|
179
|
+
exports.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
|
|
180
|
+
} else {
|
|
181
|
+
exports.names.push(new RegExp("^" + namespaces + "$"));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function disable() {
|
|
186
|
+
exports.enable("");
|
|
187
|
+
}
|
|
188
|
+
function enabled(name) {
|
|
189
|
+
var i, len;
|
|
190
|
+
for (i = 0, len = exports.skips.length;i < len; i++) {
|
|
191
|
+
if (exports.skips[i].test(name)) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
for (i = 0, len = exports.names.length;i < len; i++) {
|
|
196
|
+
if (exports.names[i].test(name)) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
function coerce(val) {
|
|
203
|
+
if (val instanceof Error)
|
|
204
|
+
return val.stack || val.message;
|
|
205
|
+
return val;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// node_modules/.bun/debug@2.6.9/node_modules/debug/src/browser.js
|
|
210
|
+
var require_browser = __commonJS(function(exports, module) {
|
|
211
|
+
exports = module.exports = require_debug();
|
|
212
|
+
exports.log = log;
|
|
213
|
+
exports.formatArgs = formatArgs;
|
|
214
|
+
exports.save = save;
|
|
215
|
+
exports.load = load;
|
|
216
|
+
exports.useColors = useColors;
|
|
217
|
+
exports.storage = typeof chrome != "undefined" && typeof chrome.storage != "undefined" ? chrome.storage.local : localstorage();
|
|
218
|
+
exports.colors = [
|
|
219
|
+
"lightseagreen",
|
|
220
|
+
"forestgreen",
|
|
221
|
+
"goldenrod",
|
|
222
|
+
"dodgerblue",
|
|
223
|
+
"darkorchid",
|
|
224
|
+
"crimson"
|
|
225
|
+
];
|
|
226
|
+
function useColors() {
|
|
227
|
+
if (typeof window !== "undefined" && window.process && window.process.type === "renderer") {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
231
|
+
}
|
|
232
|
+
exports.formatters.j = function(v) {
|
|
233
|
+
try {
|
|
234
|
+
return JSON.stringify(v);
|
|
235
|
+
} catch (err) {
|
|
236
|
+
return "[UnexpectedJSONParseError]: " + err.message;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
function formatArgs(args) {
|
|
240
|
+
var useColors = this.useColors;
|
|
241
|
+
args[0] = (useColors ? "%c" : "") + this.namespace + (useColors ? " %c" : " ") + args[0] + (useColors ? "%c " : " ") + "+" + exports.humanize(this.diff);
|
|
242
|
+
if (!useColors)
|
|
243
|
+
return;
|
|
244
|
+
var c = "color: " + this.color;
|
|
245
|
+
args.splice(1, 0, c, "color: inherit");
|
|
246
|
+
var index = 0;
|
|
247
|
+
var lastC = 0;
|
|
248
|
+
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
|
249
|
+
if (match === "%%")
|
|
250
|
+
return;
|
|
251
|
+
index++;
|
|
252
|
+
if (match === "%c") {
|
|
253
|
+
lastC = index;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
args.splice(lastC, 0, c);
|
|
257
|
+
}
|
|
258
|
+
function log() {
|
|
259
|
+
return typeof console === "object" && console.log && Function.prototype.apply.call(console.log, console, arguments);
|
|
260
|
+
}
|
|
261
|
+
function save(namespaces) {
|
|
262
|
+
try {
|
|
263
|
+
if (namespaces == null) {
|
|
264
|
+
exports.storage.removeItem("debug");
|
|
265
|
+
} else {
|
|
266
|
+
exports.storage.debug = namespaces;
|
|
267
|
+
}
|
|
268
|
+
} catch (e) {}
|
|
269
|
+
}
|
|
270
|
+
function load() {
|
|
271
|
+
var r;
|
|
272
|
+
try {
|
|
273
|
+
r = exports.storage.debug;
|
|
274
|
+
} catch (e) {}
|
|
275
|
+
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
276
|
+
r = process.env.DEBUG;
|
|
277
|
+
}
|
|
278
|
+
return r;
|
|
279
|
+
}
|
|
280
|
+
exports.enable(load());
|
|
281
|
+
function localstorage() {
|
|
282
|
+
try {
|
|
283
|
+
return window.localStorage;
|
|
284
|
+
} catch (e) {}
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// node_modules/.bun/debug@2.6.9/node_modules/debug/src/node.js
|
|
289
|
+
var require_node = __commonJS(function(exports, module) {
|
|
290
|
+
var tty = __require("tty");
|
|
291
|
+
var util = __require("util");
|
|
292
|
+
exports = module.exports = require_debug();
|
|
293
|
+
exports.init = init;
|
|
294
|
+
exports.log = log;
|
|
295
|
+
exports.formatArgs = formatArgs;
|
|
296
|
+
exports.save = save;
|
|
297
|
+
exports.load = load;
|
|
298
|
+
exports.useColors = useColors;
|
|
299
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
300
|
+
exports.inspectOpts = Object.keys(process.env).filter(function(key) {
|
|
301
|
+
return /^debug_/i.test(key);
|
|
302
|
+
}).reduce(function(obj, key) {
|
|
303
|
+
var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) {
|
|
304
|
+
return k.toUpperCase();
|
|
305
|
+
});
|
|
306
|
+
var val = process.env[key];
|
|
307
|
+
if (/^(yes|on|true|enabled)$/i.test(val))
|
|
308
|
+
val = true;
|
|
309
|
+
else if (/^(no|off|false|disabled)$/i.test(val))
|
|
310
|
+
val = false;
|
|
311
|
+
else if (val === "null")
|
|
312
|
+
val = null;
|
|
313
|
+
else
|
|
314
|
+
val = Number(val);
|
|
315
|
+
obj[prop] = val;
|
|
316
|
+
return obj;
|
|
317
|
+
}, {});
|
|
318
|
+
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
|
319
|
+
if (fd !== 1 && fd !== 2) {
|
|
320
|
+
util.deprecate(function() {}, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();
|
|
321
|
+
}
|
|
322
|
+
var stream = fd === 1 ? process.stdout : fd === 2 ? process.stderr : createWritableStdioStream(fd);
|
|
323
|
+
function useColors() {
|
|
324
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(fd);
|
|
325
|
+
}
|
|
326
|
+
exports.formatters.o = function(v) {
|
|
327
|
+
this.inspectOpts.colors = this.useColors;
|
|
328
|
+
return util.inspect(v, this.inspectOpts).split(`
|
|
329
|
+
`).map(function(str) {
|
|
330
|
+
return str.trim();
|
|
331
|
+
}).join(" ");
|
|
332
|
+
};
|
|
333
|
+
exports.formatters.O = function(v) {
|
|
334
|
+
this.inspectOpts.colors = this.useColors;
|
|
335
|
+
return util.inspect(v, this.inspectOpts);
|
|
336
|
+
};
|
|
337
|
+
function formatArgs(args) {
|
|
338
|
+
var name = this.namespace;
|
|
339
|
+
var useColors = this.useColors;
|
|
340
|
+
if (useColors) {
|
|
341
|
+
var c = this.color;
|
|
342
|
+
var prefix = " \x1B[3" + c + ";1m" + name + " " + "\x1B[0m";
|
|
343
|
+
args[0] = prefix + args[0].split(`
|
|
344
|
+
`).join(`
|
|
345
|
+
` + prefix);
|
|
346
|
+
args.push("\x1B[3" + c + "m+" + exports.humanize(this.diff) + "\x1B[0m");
|
|
347
|
+
} else {
|
|
348
|
+
args[0] = new Date().toUTCString() + " " + name + " " + args[0];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function log() {
|
|
352
|
+
return stream.write(util.format.apply(util, arguments) + `
|
|
353
|
+
`);
|
|
354
|
+
}
|
|
355
|
+
function save(namespaces) {
|
|
356
|
+
if (namespaces == null) {
|
|
357
|
+
delete process.env.DEBUG;
|
|
358
|
+
} else {
|
|
359
|
+
process.env.DEBUG = namespaces;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function load() {
|
|
363
|
+
return process.env.DEBUG;
|
|
364
|
+
}
|
|
365
|
+
function createWritableStdioStream(fd) {
|
|
366
|
+
var stream;
|
|
367
|
+
var tty_wrap = process.binding("tty_wrap");
|
|
368
|
+
switch (tty_wrap.guessHandleType(fd)) {
|
|
369
|
+
case "TTY":
|
|
370
|
+
stream = new tty.WriteStream(fd);
|
|
371
|
+
stream._type = "tty";
|
|
372
|
+
if (stream._handle && stream._handle.unref) {
|
|
373
|
+
stream._handle.unref();
|
|
374
|
+
}
|
|
375
|
+
break;
|
|
376
|
+
case "FILE":
|
|
377
|
+
var fs = __require("fs");
|
|
378
|
+
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
|
379
|
+
stream._type = "fs";
|
|
380
|
+
break;
|
|
381
|
+
case "PIPE":
|
|
382
|
+
case "TCP":
|
|
383
|
+
var net = __require("net");
|
|
384
|
+
stream = new net.Socket({
|
|
385
|
+
fd,
|
|
386
|
+
readable: false,
|
|
387
|
+
writable: true
|
|
388
|
+
});
|
|
389
|
+
stream.readable = false;
|
|
390
|
+
stream.read = null;
|
|
391
|
+
stream._type = "pipe";
|
|
392
|
+
if (stream._handle && stream._handle.unref) {
|
|
393
|
+
stream._handle.unref();
|
|
394
|
+
}
|
|
395
|
+
break;
|
|
396
|
+
default:
|
|
397
|
+
throw new Error("Implement me. Unknown stream file type!");
|
|
398
|
+
}
|
|
399
|
+
stream.fd = fd;
|
|
400
|
+
stream._isStdio = true;
|
|
401
|
+
return stream;
|
|
402
|
+
}
|
|
403
|
+
function init(debug) {
|
|
404
|
+
debug.inspectOpts = {};
|
|
405
|
+
var keys = Object.keys(exports.inspectOpts);
|
|
406
|
+
for (var i = 0;i < keys.length; i++) {
|
|
407
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
exports.enable(load());
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
// node_modules/.bun/debug@2.6.9/node_modules/debug/src/index.js
|
|
414
|
+
var require_src = __commonJS(function(exports, module) {
|
|
415
|
+
if (typeof process !== "undefined" && process.type === "renderer") {
|
|
416
|
+
module.exports = require_browser();
|
|
417
|
+
} else {
|
|
418
|
+
module.exports = require_node();
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// node_modules/.bun/stream-parser@0.3.1/node_modules/stream-parser/index.js
|
|
423
|
+
var require_stream_parser = __commonJS(function(exports, module) {
|
|
424
|
+
var assert = __require("assert");
|
|
425
|
+
var debug = require_src()("stream-parser");
|
|
426
|
+
module.exports = Parser;
|
|
427
|
+
var INIT = -1;
|
|
428
|
+
var BUFFERING = 0;
|
|
429
|
+
var SKIPPING = 1;
|
|
430
|
+
var PASSTHROUGH = 2;
|
|
431
|
+
function Parser(stream) {
|
|
432
|
+
var isTransform = stream && typeof stream._transform == "function";
|
|
433
|
+
var isWritable = stream && typeof stream._write == "function";
|
|
434
|
+
if (!isTransform && !isWritable)
|
|
435
|
+
throw new Error("must pass a Writable or Transform stream in");
|
|
436
|
+
debug("extending Parser into stream");
|
|
437
|
+
stream._bytes = _bytes;
|
|
438
|
+
stream._skipBytes = _skipBytes;
|
|
439
|
+
if (isTransform)
|
|
440
|
+
stream._passthrough = _passthrough;
|
|
441
|
+
if (isTransform) {
|
|
442
|
+
stream._transform = transform;
|
|
443
|
+
} else {
|
|
444
|
+
stream._write = write;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function init(stream) {
|
|
448
|
+
debug("initializing parser stream");
|
|
449
|
+
stream._parserBytesLeft = 0;
|
|
450
|
+
stream._parserBuffers = [];
|
|
451
|
+
stream._parserBuffered = 0;
|
|
452
|
+
stream._parserState = INIT;
|
|
453
|
+
stream._parserCallback = null;
|
|
454
|
+
if (typeof stream.push == "function") {
|
|
455
|
+
stream._parserOutput = stream.push.bind(stream);
|
|
456
|
+
}
|
|
457
|
+
stream._parserInit = true;
|
|
458
|
+
}
|
|
459
|
+
function _bytes(n, fn) {
|
|
460
|
+
assert(!this._parserCallback, 'there is already a "callback" set!');
|
|
461
|
+
assert(isFinite(n) && n > 0, 'can only buffer a finite number of bytes > 0, got "' + n + '"');
|
|
462
|
+
if (!this._parserInit)
|
|
463
|
+
init(this);
|
|
464
|
+
debug("buffering %o bytes", n);
|
|
465
|
+
this._parserBytesLeft = n;
|
|
466
|
+
this._parserCallback = fn;
|
|
467
|
+
this._parserState = BUFFERING;
|
|
468
|
+
}
|
|
469
|
+
function _skipBytes(n, fn) {
|
|
470
|
+
assert(!this._parserCallback, 'there is already a "callback" set!');
|
|
471
|
+
assert(n > 0, 'can only skip > 0 bytes, got "' + n + '"');
|
|
472
|
+
if (!this._parserInit)
|
|
473
|
+
init(this);
|
|
474
|
+
debug("skipping %o bytes", n);
|
|
475
|
+
this._parserBytesLeft = n;
|
|
476
|
+
this._parserCallback = fn;
|
|
477
|
+
this._parserState = SKIPPING;
|
|
478
|
+
}
|
|
479
|
+
function _passthrough(n, fn) {
|
|
480
|
+
assert(!this._parserCallback, 'There is already a "callback" set!');
|
|
481
|
+
assert(n > 0, 'can only pass through > 0 bytes, got "' + n + '"');
|
|
482
|
+
if (!this._parserInit)
|
|
483
|
+
init(this);
|
|
484
|
+
debug("passing through %o bytes", n);
|
|
485
|
+
this._parserBytesLeft = n;
|
|
486
|
+
this._parserCallback = fn;
|
|
487
|
+
this._parserState = PASSTHROUGH;
|
|
488
|
+
}
|
|
489
|
+
function write(chunk, encoding, fn) {
|
|
490
|
+
if (!this._parserInit)
|
|
491
|
+
init(this);
|
|
492
|
+
debug("write(%o bytes)", chunk.length);
|
|
493
|
+
if (typeof encoding == "function")
|
|
494
|
+
fn = encoding;
|
|
495
|
+
data(this, chunk, null, fn);
|
|
496
|
+
}
|
|
497
|
+
function transform(chunk, output, fn) {
|
|
498
|
+
if (!this._parserInit)
|
|
499
|
+
init(this);
|
|
500
|
+
debug("transform(%o bytes)", chunk.length);
|
|
501
|
+
if (typeof output != "function") {
|
|
502
|
+
output = this._parserOutput;
|
|
503
|
+
}
|
|
504
|
+
data(this, chunk, output, fn);
|
|
505
|
+
}
|
|
506
|
+
function _data(stream, chunk, output, fn) {
|
|
507
|
+
if (stream._parserBytesLeft <= 0) {
|
|
508
|
+
return fn(new Error("got data but not currently parsing anything"));
|
|
509
|
+
}
|
|
510
|
+
if (chunk.length <= stream._parserBytesLeft) {
|
|
511
|
+
return function() {
|
|
512
|
+
return process2(stream, chunk, output, fn);
|
|
513
|
+
};
|
|
514
|
+
} else {
|
|
515
|
+
return function() {
|
|
516
|
+
var b = chunk.slice(0, stream._parserBytesLeft);
|
|
517
|
+
return process2(stream, b, output, function(err) {
|
|
518
|
+
if (err)
|
|
519
|
+
return fn(err);
|
|
520
|
+
if (chunk.length > b.length) {
|
|
521
|
+
return function() {
|
|
522
|
+
return _data(stream, chunk.slice(b.length), output, fn);
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function process2(stream, chunk, output, fn) {
|
|
530
|
+
stream._parserBytesLeft -= chunk.length;
|
|
531
|
+
debug("%o bytes left for stream piece", stream._parserBytesLeft);
|
|
532
|
+
if (stream._parserState === BUFFERING) {
|
|
533
|
+
stream._parserBuffers.push(chunk);
|
|
534
|
+
stream._parserBuffered += chunk.length;
|
|
535
|
+
} else if (stream._parserState === PASSTHROUGH) {
|
|
536
|
+
output(chunk);
|
|
537
|
+
}
|
|
538
|
+
if (stream._parserBytesLeft === 0) {
|
|
539
|
+
var cb = stream._parserCallback;
|
|
540
|
+
if (cb && stream._parserState === BUFFERING && stream._parserBuffers.length > 1) {
|
|
541
|
+
chunk = Buffer.concat(stream._parserBuffers, stream._parserBuffered);
|
|
542
|
+
}
|
|
543
|
+
if (stream._parserState !== BUFFERING) {
|
|
544
|
+
chunk = null;
|
|
545
|
+
}
|
|
546
|
+
stream._parserCallback = null;
|
|
547
|
+
stream._parserBuffered = 0;
|
|
548
|
+
stream._parserState = INIT;
|
|
549
|
+
stream._parserBuffers.splice(0);
|
|
550
|
+
if (cb) {
|
|
551
|
+
var args = [];
|
|
552
|
+
if (chunk) {
|
|
553
|
+
args.push(chunk);
|
|
554
|
+
}
|
|
555
|
+
if (output) {
|
|
556
|
+
args.push(output);
|
|
557
|
+
}
|
|
558
|
+
var async = cb.length > args.length;
|
|
559
|
+
if (async) {
|
|
560
|
+
args.push(trampoline(fn));
|
|
561
|
+
}
|
|
562
|
+
var rtn = cb.apply(stream, args);
|
|
563
|
+
if (!async || fn === rtn)
|
|
564
|
+
return fn;
|
|
565
|
+
}
|
|
566
|
+
} else {
|
|
567
|
+
return fn;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
var data = trampoline(_data);
|
|
571
|
+
function trampoline(fn) {
|
|
572
|
+
return function() {
|
|
573
|
+
var result = fn.apply(this, arguments);
|
|
574
|
+
while (typeof result == "function") {
|
|
575
|
+
result = result();
|
|
576
|
+
}
|
|
577
|
+
return result;
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/common/read_le_be.js
|
|
583
|
+
var require_read_le_be = __commonJS(function(exports) {
|
|
584
|
+
exports.readUInt16LE = function(data, offset) {
|
|
585
|
+
return data[offset] | data[offset + 1] << 8;
|
|
586
|
+
};
|
|
587
|
+
exports.readUInt16BE = function(data, offset) {
|
|
588
|
+
return data[offset] << 8 | data[offset + 1];
|
|
589
|
+
};
|
|
590
|
+
exports.readInt16LE = function(data, offset) {
|
|
591
|
+
return exports.readUInt16LE(data, offset) << 16 >> 16;
|
|
592
|
+
};
|
|
593
|
+
exports.readInt16BE = function(data, offset) {
|
|
594
|
+
return exports.readUInt16BE(data, offset) << 16 >> 16;
|
|
595
|
+
};
|
|
596
|
+
exports.readUInt32LE = function(data, offset) {
|
|
597
|
+
return (data[offset] | data[offset + 1] << 8 | data[offset + 2] << 16) + data[offset + 3] * 16777216;
|
|
598
|
+
};
|
|
599
|
+
exports.readUInt32BE = function(data, offset) {
|
|
600
|
+
return data[offset] * 16777216 + (data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]);
|
|
601
|
+
};
|
|
602
|
+
exports.readInt32LE = function(data, offset) {
|
|
603
|
+
return exports.readUInt32LE(data, offset) | 0;
|
|
604
|
+
};
|
|
605
|
+
exports.readInt32BE = function(data, offset) {
|
|
606
|
+
return exports.readUInt32BE(data, offset) | 0;
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/common/index.js
|
|
611
|
+
var require_common = __commonJS(function(exports) {
|
|
612
|
+
var Transform = __require("stream").Transform;
|
|
613
|
+
var streamParser = require_stream_parser();
|
|
614
|
+
var readLeBe = require_read_le_be();
|
|
615
|
+
function ParserStream() {
|
|
616
|
+
Transform.call(this, { readableObjectMode: true });
|
|
617
|
+
}
|
|
618
|
+
ParserStream.prototype = Object.create(Transform.prototype);
|
|
619
|
+
ParserStream.prototype.constructor = ParserStream;
|
|
620
|
+
streamParser(ParserStream.prototype);
|
|
621
|
+
exports.ParserStream = ParserStream;
|
|
622
|
+
exports.sliceEq = function(src, start, dest) {
|
|
623
|
+
for (var i = start, j = 0;j < dest.length; ) {
|
|
624
|
+
if (src[i++] !== dest[j++])
|
|
625
|
+
return false;
|
|
626
|
+
}
|
|
627
|
+
return true;
|
|
628
|
+
};
|
|
629
|
+
exports.str2arr = function(str, format) {
|
|
630
|
+
var arr = [];
|
|
631
|
+
var i = 0;
|
|
632
|
+
if (format && format === "hex") {
|
|
633
|
+
while (i < str.length) {
|
|
634
|
+
arr.push(parseInt(str.slice(i, i + 2), 16));
|
|
635
|
+
i += 2;
|
|
636
|
+
}
|
|
637
|
+
} else {
|
|
638
|
+
for (;i < str.length; i++) {
|
|
639
|
+
arr.push(str.charCodeAt(i) & 255);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return arr;
|
|
643
|
+
};
|
|
644
|
+
function ProbeError(message, code, statusCode) {
|
|
645
|
+
Error.call(this);
|
|
646
|
+
if (Error.captureStackTrace) {
|
|
647
|
+
Error.captureStackTrace(this, this.constructor);
|
|
648
|
+
} else {
|
|
649
|
+
this.stack = new Error().stack || "";
|
|
650
|
+
}
|
|
651
|
+
this.name = this.constructor.name;
|
|
652
|
+
this.message = message;
|
|
653
|
+
if (code)
|
|
654
|
+
this.code = code;
|
|
655
|
+
if (statusCode)
|
|
656
|
+
this.statusCode = statusCode;
|
|
657
|
+
}
|
|
658
|
+
ProbeError.prototype = Object.create(Error.prototype);
|
|
659
|
+
ProbeError.prototype.constructor = ProbeError;
|
|
660
|
+
exports.ProbeError = ProbeError;
|
|
661
|
+
exports.readUInt16LE = readLeBe.readUInt16LE;
|
|
662
|
+
exports.readUInt16BE = readLeBe.readUInt16BE;
|
|
663
|
+
exports.readInt16LE = readLeBe.readInt16LE;
|
|
664
|
+
exports.readInt16BE = readLeBe.readInt16BE;
|
|
665
|
+
exports.readUInt32LE = readLeBe.readUInt32LE;
|
|
666
|
+
exports.readUInt32BE = readLeBe.readUInt32BE;
|
|
667
|
+
exports.readInt32LE = readLeBe.readInt32LE;
|
|
668
|
+
exports.readInt32BE = readLeBe.readInt32BE;
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/miaf_utils.js
|
|
672
|
+
var require_miaf_utils = __commonJS(function(exports, module) {
|
|
673
|
+
var readUInt16BE = require_common().readUInt16BE;
|
|
674
|
+
var readUInt32BE = require_common().readUInt32BE;
|
|
675
|
+
function unbox(data, offset) {
|
|
676
|
+
if (data.length < 4 + offset)
|
|
677
|
+
return null;
|
|
678
|
+
var size = readUInt32BE(data, offset);
|
|
679
|
+
if (data.length < size + offset || size < 8)
|
|
680
|
+
return null;
|
|
681
|
+
return {
|
|
682
|
+
boxtype: String.fromCharCode.apply(null, data.slice(offset + 4, offset + 8)),
|
|
683
|
+
data: data.slice(offset + 8, offset + size),
|
|
684
|
+
end: offset + size
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
exports.unbox = unbox;
|
|
688
|
+
function scan_ipco(data, sandbox) {
|
|
689
|
+
var offset = 0;
|
|
690
|
+
for (;; ) {
|
|
691
|
+
var box = unbox(data, offset);
|
|
692
|
+
if (!box)
|
|
693
|
+
break;
|
|
694
|
+
switch (box.boxtype) {
|
|
695
|
+
case "ispe":
|
|
696
|
+
sandbox.sizes.push({
|
|
697
|
+
width: readUInt32BE(box.data, 4),
|
|
698
|
+
height: readUInt32BE(box.data, 8)
|
|
699
|
+
});
|
|
700
|
+
break;
|
|
701
|
+
case "irot":
|
|
702
|
+
sandbox.transforms.push({
|
|
703
|
+
type: "irot",
|
|
704
|
+
value: box.data[0] & 3
|
|
705
|
+
});
|
|
706
|
+
break;
|
|
707
|
+
case "imir":
|
|
708
|
+
sandbox.transforms.push({
|
|
709
|
+
type: "imir",
|
|
710
|
+
value: box.data[0] & 1
|
|
711
|
+
});
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
offset = box.end;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
function readUIntBE(data, offset, size) {
|
|
718
|
+
var result = 0;
|
|
719
|
+
for (var i = 0;i < size; i++) {
|
|
720
|
+
result = result * 256 + (data[offset + i] || 0);
|
|
721
|
+
}
|
|
722
|
+
return result;
|
|
723
|
+
}
|
|
724
|
+
function scan_iloc(data, sandbox) {
|
|
725
|
+
var offset_size = data[4] >> 4 & 15;
|
|
726
|
+
var length_size = data[4] & 15;
|
|
727
|
+
var base_offset_size = data[5] >> 4 & 15;
|
|
728
|
+
var item_count = readUInt16BE(data, 6);
|
|
729
|
+
var offset = 8;
|
|
730
|
+
for (var i = 0;i < item_count; i++) {
|
|
731
|
+
var item_ID = readUInt16BE(data, offset);
|
|
732
|
+
offset += 2;
|
|
733
|
+
var data_reference_index = readUInt16BE(data, offset);
|
|
734
|
+
offset += 2;
|
|
735
|
+
var base_offset = readUIntBE(data, offset, base_offset_size);
|
|
736
|
+
offset += base_offset_size;
|
|
737
|
+
var extent_count = readUInt16BE(data, offset);
|
|
738
|
+
offset += 2;
|
|
739
|
+
if (data_reference_index === 0 && extent_count === 1) {
|
|
740
|
+
var first_extent_offset = readUIntBE(data, offset, offset_size);
|
|
741
|
+
var first_extent_length = readUIntBE(data, offset + offset_size, length_size);
|
|
742
|
+
sandbox.item_loc[item_ID] = { length: first_extent_length, offset: first_extent_offset + base_offset };
|
|
743
|
+
}
|
|
744
|
+
offset += extent_count * (offset_size + length_size);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
function scan_iinf(data, sandbox) {
|
|
748
|
+
var item_count = readUInt16BE(data, 4);
|
|
749
|
+
var offset = 6;
|
|
750
|
+
for (var i = 0;i < item_count; i++) {
|
|
751
|
+
var box = unbox(data, offset);
|
|
752
|
+
if (!box)
|
|
753
|
+
break;
|
|
754
|
+
if (box.boxtype === "infe") {
|
|
755
|
+
var item_id = readUInt16BE(box.data, 4);
|
|
756
|
+
var item_name = "";
|
|
757
|
+
for (var pos = 8;pos < box.data.length && box.data[pos]; pos++) {
|
|
758
|
+
item_name += String.fromCharCode(box.data[pos]);
|
|
759
|
+
}
|
|
760
|
+
sandbox.item_inf[item_name] = item_id;
|
|
761
|
+
}
|
|
762
|
+
offset = box.end;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
function scan_iprp(data, sandbox) {
|
|
766
|
+
var offset = 0;
|
|
767
|
+
for (;; ) {
|
|
768
|
+
var box = unbox(data, offset);
|
|
769
|
+
if (!box)
|
|
770
|
+
break;
|
|
771
|
+
if (box.boxtype === "ipco")
|
|
772
|
+
scan_ipco(box.data, sandbox);
|
|
773
|
+
offset = box.end;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function scan_meta(data, sandbox) {
|
|
777
|
+
var offset = 4;
|
|
778
|
+
for (;; ) {
|
|
779
|
+
var box = unbox(data, offset);
|
|
780
|
+
if (!box)
|
|
781
|
+
break;
|
|
782
|
+
if (box.boxtype === "iprp")
|
|
783
|
+
scan_iprp(box.data, sandbox);
|
|
784
|
+
if (box.boxtype === "iloc")
|
|
785
|
+
scan_iloc(box.data, sandbox);
|
|
786
|
+
if (box.boxtype === "iinf")
|
|
787
|
+
scan_iinf(box.data, sandbox);
|
|
788
|
+
offset = box.end;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
function getMaxSize(sizes) {
|
|
792
|
+
var maxWidthSize = sizes.reduce(function(a, b) {
|
|
793
|
+
return a.width > b.width || a.width === b.width && a.height > b.height ? a : b;
|
|
794
|
+
});
|
|
795
|
+
var maxHeightSize = sizes.reduce(function(a, b) {
|
|
796
|
+
return a.height > b.height || a.height === b.height && a.width > b.width ? a : b;
|
|
797
|
+
});
|
|
798
|
+
var maxSize;
|
|
799
|
+
if (maxWidthSize.width > maxHeightSize.height || maxWidthSize.width === maxHeightSize.height && maxWidthSize.height > maxHeightSize.width) {
|
|
800
|
+
maxSize = maxWidthSize;
|
|
801
|
+
} else {
|
|
802
|
+
maxSize = maxHeightSize;
|
|
803
|
+
}
|
|
804
|
+
return maxSize;
|
|
805
|
+
}
|
|
806
|
+
exports.readSizeFromMeta = function(data) {
|
|
807
|
+
var sandbox = {
|
|
808
|
+
sizes: [],
|
|
809
|
+
transforms: [],
|
|
810
|
+
item_inf: {},
|
|
811
|
+
item_loc: {}
|
|
812
|
+
};
|
|
813
|
+
scan_meta(data, sandbox);
|
|
814
|
+
if (!sandbox.sizes.length)
|
|
815
|
+
return;
|
|
816
|
+
var maxSize = getMaxSize(sandbox.sizes);
|
|
817
|
+
var orientation = 1;
|
|
818
|
+
sandbox.transforms.forEach(function(transform) {
|
|
819
|
+
var rotate_ccw = { 1: 6, 2: 5, 3: 8, 4: 7, 5: 4, 6: 3, 7: 2, 8: 1 };
|
|
820
|
+
var mirror_vert = { 1: 4, 2: 3, 3: 2, 4: 1, 5: 6, 6: 5, 7: 8, 8: 7 };
|
|
821
|
+
if (transform.type === "imir") {
|
|
822
|
+
if (transform.value === 0) {
|
|
823
|
+
orientation = mirror_vert[orientation];
|
|
824
|
+
} else {
|
|
825
|
+
orientation = mirror_vert[orientation];
|
|
826
|
+
orientation = rotate_ccw[orientation];
|
|
827
|
+
orientation = rotate_ccw[orientation];
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
if (transform.type === "irot") {
|
|
831
|
+
for (var i = 0;i < transform.value; i++) {
|
|
832
|
+
orientation = rotate_ccw[orientation];
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
var exif_location = null;
|
|
837
|
+
if (sandbox.item_inf.Exif) {
|
|
838
|
+
exif_location = sandbox.item_loc[sandbox.item_inf.Exif];
|
|
839
|
+
}
|
|
840
|
+
return {
|
|
841
|
+
width: maxSize.width,
|
|
842
|
+
height: maxSize.height,
|
|
843
|
+
orientation: sandbox.transforms.length ? orientation : null,
|
|
844
|
+
variants: sandbox.sizes,
|
|
845
|
+
exif_location
|
|
846
|
+
};
|
|
847
|
+
};
|
|
848
|
+
exports.getMimeType = function(data) {
|
|
849
|
+
var brand = String.fromCharCode.apply(null, data.slice(0, 4));
|
|
850
|
+
var compat = {};
|
|
851
|
+
compat[brand] = true;
|
|
852
|
+
for (var i = 8;i < data.length; i += 4) {
|
|
853
|
+
compat[String.fromCharCode.apply(null, data.slice(i, i + 4))] = true;
|
|
854
|
+
}
|
|
855
|
+
if (!compat.mif1 && !compat.msf1 && !compat.miaf)
|
|
856
|
+
return;
|
|
857
|
+
if (brand === "avif" || brand === "avis" || brand === "avio") {
|
|
858
|
+
return { type: "avif", mime: "image/avif" };
|
|
859
|
+
}
|
|
860
|
+
if (brand === "heic" || brand === "heix") {
|
|
861
|
+
return { type: "heic", mime: "image/heic" };
|
|
862
|
+
}
|
|
863
|
+
if (brand === "hevc" || brand === "hevx") {
|
|
864
|
+
return { type: "heic", mime: "image/heic-sequence" };
|
|
865
|
+
}
|
|
866
|
+
if (compat.avif || compat.avis) {
|
|
867
|
+
return { type: "avif", mime: "image/avif" };
|
|
868
|
+
}
|
|
869
|
+
if (compat.heic || compat.heix || compat.hevc || compat.hevx || compat.heis) {
|
|
870
|
+
if (compat.msf1) {
|
|
871
|
+
return { type: "heif", mime: "image/heif-sequence" };
|
|
872
|
+
}
|
|
873
|
+
return { type: "heif", mime: "image/heif" };
|
|
874
|
+
}
|
|
875
|
+
return { type: "avif", mime: "image/avif" };
|
|
876
|
+
};
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/exif_utils.js
|
|
880
|
+
var require_exif_utils = __commonJS(function(exports, module) {
|
|
881
|
+
function error(message, code) {
|
|
882
|
+
var err = new Error(message);
|
|
883
|
+
err.code = code;
|
|
884
|
+
return err;
|
|
885
|
+
}
|
|
886
|
+
function utf8_decode(str) {
|
|
887
|
+
try {
|
|
888
|
+
return decodeURIComponent(escape(str));
|
|
889
|
+
} catch (_) {
|
|
890
|
+
return str;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
function ExifParser(jpeg_bin, exif_start, exif_end) {
|
|
894
|
+
this.input = jpeg_bin.subarray(exif_start, exif_end);
|
|
895
|
+
this.start = exif_start;
|
|
896
|
+
var sig = String.fromCharCode.apply(null, this.input.subarray(0, 4));
|
|
897
|
+
if (sig !== "II*\x00" && sig !== "MM\x00*") {
|
|
898
|
+
throw error("invalid TIFF signature", "EBADDATA");
|
|
899
|
+
}
|
|
900
|
+
this.big_endian = sig[0] === "M";
|
|
901
|
+
}
|
|
902
|
+
ExifParser.prototype.each = function(on_entry) {
|
|
903
|
+
this.aborted = false;
|
|
904
|
+
var offset = this.read_uint32(4);
|
|
905
|
+
this.ifds_to_read = [{
|
|
906
|
+
id: 0,
|
|
907
|
+
offset
|
|
908
|
+
}];
|
|
909
|
+
while (this.ifds_to_read.length > 0 && !this.aborted) {
|
|
910
|
+
var i = this.ifds_to_read.shift();
|
|
911
|
+
if (!i.offset)
|
|
912
|
+
continue;
|
|
913
|
+
this.scan_ifd(i.id, i.offset, on_entry);
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
ExifParser.prototype.read_uint16 = function(offset) {
|
|
917
|
+
var d = this.input;
|
|
918
|
+
if (offset + 2 > d.length)
|
|
919
|
+
throw error("unexpected EOF", "EBADDATA");
|
|
920
|
+
return this.big_endian ? d[offset] * 256 + d[offset + 1] : d[offset] + d[offset + 1] * 256;
|
|
921
|
+
};
|
|
922
|
+
ExifParser.prototype.read_uint32 = function(offset) {
|
|
923
|
+
var d = this.input;
|
|
924
|
+
if (offset + 4 > d.length)
|
|
925
|
+
throw error("unexpected EOF", "EBADDATA");
|
|
926
|
+
return this.big_endian ? d[offset] * 16777216 + d[offset + 1] * 65536 + d[offset + 2] * 256 + d[offset + 3] : d[offset] + d[offset + 1] * 256 + d[offset + 2] * 65536 + d[offset + 3] * 16777216;
|
|
927
|
+
};
|
|
928
|
+
ExifParser.prototype.is_subifd_link = function(ifd, tag) {
|
|
929
|
+
return ifd === 0 && tag === 34665 || ifd === 0 && tag === 34853 || ifd === 34665 && tag === 40965;
|
|
930
|
+
};
|
|
931
|
+
ExifParser.prototype.exif_format_length = function(format) {
|
|
932
|
+
switch (format) {
|
|
933
|
+
case 1:
|
|
934
|
+
case 2:
|
|
935
|
+
case 6:
|
|
936
|
+
case 7:
|
|
937
|
+
return 1;
|
|
938
|
+
case 3:
|
|
939
|
+
case 8:
|
|
940
|
+
return 2;
|
|
941
|
+
case 4:
|
|
942
|
+
case 9:
|
|
943
|
+
case 11:
|
|
944
|
+
return 4;
|
|
945
|
+
case 5:
|
|
946
|
+
case 10:
|
|
947
|
+
case 12:
|
|
948
|
+
return 8;
|
|
949
|
+
default:
|
|
950
|
+
return 0;
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
ExifParser.prototype.exif_format_read = function(format, offset) {
|
|
954
|
+
var v;
|
|
955
|
+
switch (format) {
|
|
956
|
+
case 1:
|
|
957
|
+
case 2:
|
|
958
|
+
v = this.input[offset];
|
|
959
|
+
return v;
|
|
960
|
+
case 6:
|
|
961
|
+
v = this.input[offset];
|
|
962
|
+
return v | (v & 128) * 33554430;
|
|
963
|
+
case 3:
|
|
964
|
+
v = this.read_uint16(offset);
|
|
965
|
+
return v;
|
|
966
|
+
case 8:
|
|
967
|
+
v = this.read_uint16(offset);
|
|
968
|
+
return v | (v & 32768) * 131070;
|
|
969
|
+
case 4:
|
|
970
|
+
v = this.read_uint32(offset);
|
|
971
|
+
return v;
|
|
972
|
+
case 9:
|
|
973
|
+
v = this.read_uint32(offset);
|
|
974
|
+
return v | 0;
|
|
975
|
+
case 5:
|
|
976
|
+
case 10:
|
|
977
|
+
case 11:
|
|
978
|
+
case 12:
|
|
979
|
+
return null;
|
|
980
|
+
case 7:
|
|
981
|
+
return null;
|
|
982
|
+
default:
|
|
983
|
+
return null;
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
ExifParser.prototype.scan_ifd = function(ifd_no, offset, on_entry) {
|
|
987
|
+
var entry_count = this.read_uint16(offset);
|
|
988
|
+
offset += 2;
|
|
989
|
+
for (var i = 0;i < entry_count; i++) {
|
|
990
|
+
var tag = this.read_uint16(offset);
|
|
991
|
+
var format = this.read_uint16(offset + 2);
|
|
992
|
+
var count = this.read_uint32(offset + 4);
|
|
993
|
+
var comp_length = this.exif_format_length(format);
|
|
994
|
+
var data_length = count * comp_length;
|
|
995
|
+
var data_offset = data_length <= 4 ? offset + 8 : this.read_uint32(offset + 8);
|
|
996
|
+
var is_subifd_link = false;
|
|
997
|
+
if (data_offset + data_length > this.input.length) {
|
|
998
|
+
throw error("unexpected EOF", "EBADDATA");
|
|
999
|
+
}
|
|
1000
|
+
var value = [];
|
|
1001
|
+
var comp_offset = data_offset;
|
|
1002
|
+
for (var j = 0;j < count; j++, comp_offset += comp_length) {
|
|
1003
|
+
var item = this.exif_format_read(format, comp_offset);
|
|
1004
|
+
if (item === null) {
|
|
1005
|
+
value = null;
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
value.push(item);
|
|
1009
|
+
}
|
|
1010
|
+
if (Array.isArray(value) && format === 2) {
|
|
1011
|
+
value = utf8_decode(String.fromCharCode.apply(null, value));
|
|
1012
|
+
if (value && value[value.length - 1] === "\x00")
|
|
1013
|
+
value = value.slice(0, -1);
|
|
1014
|
+
}
|
|
1015
|
+
if (this.is_subifd_link(ifd_no, tag)) {
|
|
1016
|
+
if (Array.isArray(value) && Number.isInteger(value[0]) && value[0] > 0) {
|
|
1017
|
+
this.ifds_to_read.push({
|
|
1018
|
+
id: tag,
|
|
1019
|
+
offset: value[0]
|
|
1020
|
+
});
|
|
1021
|
+
is_subifd_link = true;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
var entry = {
|
|
1025
|
+
is_big_endian: this.big_endian,
|
|
1026
|
+
ifd: ifd_no,
|
|
1027
|
+
tag,
|
|
1028
|
+
format,
|
|
1029
|
+
count,
|
|
1030
|
+
entry_offset: offset + this.start,
|
|
1031
|
+
data_length,
|
|
1032
|
+
data_offset: data_offset + this.start,
|
|
1033
|
+
value,
|
|
1034
|
+
is_subifd_link
|
|
1035
|
+
};
|
|
1036
|
+
if (on_entry(entry) === false) {
|
|
1037
|
+
this.aborted = true;
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
offset += 12;
|
|
1041
|
+
}
|
|
1042
|
+
if (ifd_no === 0) {
|
|
1043
|
+
this.ifds_to_read.push({
|
|
1044
|
+
id: 1,
|
|
1045
|
+
offset: this.read_uint32(offset)
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
exports.ExifParser = ExifParser;
|
|
1050
|
+
exports.get_orientation = function(data) {
|
|
1051
|
+
var orientation = 0;
|
|
1052
|
+
try {
|
|
1053
|
+
new ExifParser(data, 0, data.length).each(function(entry) {
|
|
1054
|
+
if (entry.ifd === 0 && entry.tag === 274 && Array.isArray(entry.value)) {
|
|
1055
|
+
orientation = entry.value[0];
|
|
1056
|
+
return false;
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
return orientation;
|
|
1060
|
+
} catch (err) {
|
|
1061
|
+
return -1;
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
});
|
|
1065
|
+
|
|
1066
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/avif.js
|
|
1067
|
+
var require_avif = __commonJS(function(exports, module) {
|
|
1068
|
+
var str2arr = require_common().str2arr;
|
|
1069
|
+
var sliceEq = require_common().sliceEq;
|
|
1070
|
+
var readUInt32BE = require_common().readUInt32BE;
|
|
1071
|
+
var miaf = require_miaf_utils();
|
|
1072
|
+
var exif = require_exif_utils();
|
|
1073
|
+
var SIG_FTYP = str2arr("ftyp");
|
|
1074
|
+
module.exports = function(data) {
|
|
1075
|
+
if (!sliceEq(data, 4, SIG_FTYP))
|
|
1076
|
+
return;
|
|
1077
|
+
var firstBox = miaf.unbox(data, 0);
|
|
1078
|
+
if (!firstBox)
|
|
1079
|
+
return;
|
|
1080
|
+
var fileType = miaf.getMimeType(firstBox.data);
|
|
1081
|
+
if (!fileType)
|
|
1082
|
+
return;
|
|
1083
|
+
var meta;
|
|
1084
|
+
var offset = firstBox.end;
|
|
1085
|
+
for (;; ) {
|
|
1086
|
+
var box = miaf.unbox(data, offset);
|
|
1087
|
+
if (!box)
|
|
1088
|
+
break;
|
|
1089
|
+
offset = box.end;
|
|
1090
|
+
if (box.boxtype === "mdat")
|
|
1091
|
+
return;
|
|
1092
|
+
if (box.boxtype === "meta") {
|
|
1093
|
+
meta = box.data;
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
if (!meta)
|
|
1098
|
+
return;
|
|
1099
|
+
var imgSize = miaf.readSizeFromMeta(meta);
|
|
1100
|
+
if (!imgSize)
|
|
1101
|
+
return;
|
|
1102
|
+
var result = {
|
|
1103
|
+
width: imgSize.width,
|
|
1104
|
+
height: imgSize.height,
|
|
1105
|
+
type: fileType.type,
|
|
1106
|
+
mime: fileType.mime,
|
|
1107
|
+
wUnits: "px",
|
|
1108
|
+
hUnits: "px"
|
|
1109
|
+
};
|
|
1110
|
+
if (imgSize.variants.length > 1) {
|
|
1111
|
+
result.variants = imgSize.variants;
|
|
1112
|
+
}
|
|
1113
|
+
if (imgSize.orientation) {
|
|
1114
|
+
result.orientation = imgSize.orientation;
|
|
1115
|
+
}
|
|
1116
|
+
if (imgSize.exif_location && imgSize.exif_location.offset + imgSize.exif_location.length <= data.length) {
|
|
1117
|
+
var sig_offset = readUInt32BE(data, imgSize.exif_location.offset);
|
|
1118
|
+
var exif_data = data.slice(imgSize.exif_location.offset + sig_offset + 4, imgSize.exif_location.offset + imgSize.exif_location.length);
|
|
1119
|
+
var orientation = exif.get_orientation(exif_data);
|
|
1120
|
+
if (orientation > 0)
|
|
1121
|
+
result.orientation = orientation;
|
|
1122
|
+
}
|
|
1123
|
+
return result;
|
|
1124
|
+
};
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/bmp.js
|
|
1128
|
+
var require_bmp = __commonJS(function(exports, module) {
|
|
1129
|
+
var str2arr = require_common().str2arr;
|
|
1130
|
+
var sliceEq = require_common().sliceEq;
|
|
1131
|
+
var readInt16LE = require_common().readInt16LE;
|
|
1132
|
+
var readInt32LE = require_common().readInt32LE;
|
|
1133
|
+
var readUInt32LE = require_common().readUInt32LE;
|
|
1134
|
+
var SIG_BM = str2arr("BM");
|
|
1135
|
+
module.exports = function(data) {
|
|
1136
|
+
if (data.length < 26)
|
|
1137
|
+
return;
|
|
1138
|
+
if (!sliceEq(data, 0, SIG_BM))
|
|
1139
|
+
return;
|
|
1140
|
+
var h;
|
|
1141
|
+
var w;
|
|
1142
|
+
var headerSize = readUInt32LE(data, 14);
|
|
1143
|
+
if (headerSize === 12) {
|
|
1144
|
+
w = readInt16LE(data, 18);
|
|
1145
|
+
h = readInt16LE(data, 20);
|
|
1146
|
+
} else if (headerSize > 12) {
|
|
1147
|
+
w = readInt32LE(data, 18);
|
|
1148
|
+
h = readInt32LE(data, 22);
|
|
1149
|
+
} else {
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
return {
|
|
1153
|
+
width: w,
|
|
1154
|
+
height: Math.abs(h),
|
|
1155
|
+
type: "bmp",
|
|
1156
|
+
mime: "image/bmp",
|
|
1157
|
+
wUnits: "px",
|
|
1158
|
+
hUnits: "px"
|
|
1159
|
+
};
|
|
1160
|
+
};
|
|
1161
|
+
});
|
|
1162
|
+
|
|
1163
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/gif.js
|
|
1164
|
+
var require_gif = __commonJS(function(exports, module) {
|
|
1165
|
+
var str2arr = require_common().str2arr;
|
|
1166
|
+
var sliceEq = require_common().sliceEq;
|
|
1167
|
+
var readUInt16LE = require_common().readUInt16LE;
|
|
1168
|
+
var SIG_GIF87a = str2arr("GIF87a");
|
|
1169
|
+
var SIG_GIF89a = str2arr("GIF89a");
|
|
1170
|
+
module.exports = function(data) {
|
|
1171
|
+
if (data.length < 10)
|
|
1172
|
+
return;
|
|
1173
|
+
if (!sliceEq(data, 0, SIG_GIF87a) && !sliceEq(data, 0, SIG_GIF89a))
|
|
1174
|
+
return;
|
|
1175
|
+
return {
|
|
1176
|
+
width: readUInt16LE(data, 6),
|
|
1177
|
+
height: readUInt16LE(data, 8),
|
|
1178
|
+
type: "gif",
|
|
1179
|
+
mime: "image/gif",
|
|
1180
|
+
wUnits: "px",
|
|
1181
|
+
hUnits: "px"
|
|
1182
|
+
};
|
|
1183
|
+
};
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/ico.js
|
|
1187
|
+
var require_ico = __commonJS(function(exports, module) {
|
|
1188
|
+
var readUInt16LE = require_common().readUInt16LE;
|
|
1189
|
+
var HEADER = 0;
|
|
1190
|
+
var TYPE_ICO = 1;
|
|
1191
|
+
var INDEX_SIZE = 16;
|
|
1192
|
+
module.exports = function(data) {
|
|
1193
|
+
var header = readUInt16LE(data, 0);
|
|
1194
|
+
var type = readUInt16LE(data, 2);
|
|
1195
|
+
var numImages = readUInt16LE(data, 4);
|
|
1196
|
+
if (header !== HEADER || type !== TYPE_ICO || !numImages) {
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
if (data.length < 6 + numImages * INDEX_SIZE)
|
|
1200
|
+
return;
|
|
1201
|
+
var variants = [];
|
|
1202
|
+
var maxSize = { width: 0, height: 0 };
|
|
1203
|
+
for (var i = 0;i < numImages; i++) {
|
|
1204
|
+
var width = data[6 + INDEX_SIZE * i] || 256;
|
|
1205
|
+
var height = data[6 + INDEX_SIZE * i + 1] || 256;
|
|
1206
|
+
var size = { width, height };
|
|
1207
|
+
variants.push(size);
|
|
1208
|
+
if (width > maxSize.width || height > maxSize.height) {
|
|
1209
|
+
maxSize = size;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
return {
|
|
1213
|
+
width: maxSize.width,
|
|
1214
|
+
height: maxSize.height,
|
|
1215
|
+
variants,
|
|
1216
|
+
type: "ico",
|
|
1217
|
+
mime: "image/x-icon",
|
|
1218
|
+
wUnits: "px",
|
|
1219
|
+
hUnits: "px"
|
|
1220
|
+
};
|
|
1221
|
+
};
|
|
1222
|
+
});
|
|
1223
|
+
|
|
1224
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/jpeg.js
|
|
1225
|
+
var require_jpeg = __commonJS(function(exports, module) {
|
|
1226
|
+
var readUInt16BE = require_common().readUInt16BE;
|
|
1227
|
+
var str2arr = require_common().str2arr;
|
|
1228
|
+
var sliceEq = require_common().sliceEq;
|
|
1229
|
+
var exif = require_exif_utils();
|
|
1230
|
+
var SIG_EXIF = str2arr("Exif\x00\x00");
|
|
1231
|
+
module.exports = function(data) {
|
|
1232
|
+
if (data.length < 2)
|
|
1233
|
+
return;
|
|
1234
|
+
if (data[0] !== 255 || data[1] !== 216 || data[2] !== 255)
|
|
1235
|
+
return;
|
|
1236
|
+
var offset = 2;
|
|
1237
|
+
for (;; ) {
|
|
1238
|
+
for (;; ) {
|
|
1239
|
+
if (data.length - offset < 2)
|
|
1240
|
+
return;
|
|
1241
|
+
if (data[offset++] === 255)
|
|
1242
|
+
break;
|
|
1243
|
+
}
|
|
1244
|
+
var code = data[offset++];
|
|
1245
|
+
var length;
|
|
1246
|
+
while (code === 255)
|
|
1247
|
+
code = data[offset++];
|
|
1248
|
+
if (code >= 208 && code <= 217 || code === 1) {
|
|
1249
|
+
length = 0;
|
|
1250
|
+
} else if (code >= 192 && code <= 254) {
|
|
1251
|
+
if (data.length - offset < 2)
|
|
1252
|
+
return;
|
|
1253
|
+
length = readUInt16BE(data, offset) - 2;
|
|
1254
|
+
offset += 2;
|
|
1255
|
+
} else {
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
if (code === 217 || code === 218) {
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
var orientation;
|
|
1262
|
+
if (code === 225 && length >= 10 && sliceEq(data, offset, SIG_EXIF)) {
|
|
1263
|
+
orientation = exif.get_orientation(data.slice(offset + 6, offset + length));
|
|
1264
|
+
}
|
|
1265
|
+
if (length >= 5 && (code >= 192 && code <= 207) && code !== 196 && code !== 200 && code !== 204) {
|
|
1266
|
+
if (data.length - offset < length)
|
|
1267
|
+
return;
|
|
1268
|
+
var result = {
|
|
1269
|
+
width: readUInt16BE(data, offset + 3),
|
|
1270
|
+
height: readUInt16BE(data, offset + 1),
|
|
1271
|
+
type: "jpg",
|
|
1272
|
+
mime: "image/jpeg",
|
|
1273
|
+
wUnits: "px",
|
|
1274
|
+
hUnits: "px"
|
|
1275
|
+
};
|
|
1276
|
+
if (orientation > 0) {
|
|
1277
|
+
result.orientation = orientation;
|
|
1278
|
+
}
|
|
1279
|
+
return result;
|
|
1280
|
+
}
|
|
1281
|
+
offset += length;
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
});
|
|
1285
|
+
|
|
1286
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/png.js
|
|
1287
|
+
var require_png = __commonJS(function(exports, module) {
|
|
1288
|
+
var str2arr = require_common().str2arr;
|
|
1289
|
+
var sliceEq = require_common().sliceEq;
|
|
1290
|
+
var readUInt32BE = require_common().readUInt32BE;
|
|
1291
|
+
var SIG_PNG = str2arr(`PNG\r
|
|
1292
|
+
\x1A
|
|
1293
|
+
`);
|
|
1294
|
+
var SIG_IHDR = str2arr("IHDR");
|
|
1295
|
+
module.exports = function(data) {
|
|
1296
|
+
if (data.length < 24)
|
|
1297
|
+
return;
|
|
1298
|
+
if (!sliceEq(data, 0, SIG_PNG))
|
|
1299
|
+
return;
|
|
1300
|
+
if (!sliceEq(data, 12, SIG_IHDR))
|
|
1301
|
+
return;
|
|
1302
|
+
return {
|
|
1303
|
+
width: readUInt32BE(data, 16),
|
|
1304
|
+
height: readUInt32BE(data, 20),
|
|
1305
|
+
type: "png",
|
|
1306
|
+
mime: "image/png",
|
|
1307
|
+
wUnits: "px",
|
|
1308
|
+
hUnits: "px"
|
|
1309
|
+
};
|
|
1310
|
+
};
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1313
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/psd.js
|
|
1314
|
+
var require_psd = __commonJS(function(exports, module) {
|
|
1315
|
+
var str2arr = require_common().str2arr;
|
|
1316
|
+
var sliceEq = require_common().sliceEq;
|
|
1317
|
+
var readUInt32BE = require_common().readUInt32BE;
|
|
1318
|
+
var SIG_8BPS = str2arr("8BPS\x00\x01");
|
|
1319
|
+
module.exports = function(data) {
|
|
1320
|
+
if (data.length < 6 + 16)
|
|
1321
|
+
return;
|
|
1322
|
+
if (!sliceEq(data, 0, SIG_8BPS))
|
|
1323
|
+
return;
|
|
1324
|
+
return {
|
|
1325
|
+
width: readUInt32BE(data, 6 + 12),
|
|
1326
|
+
height: readUInt32BE(data, 6 + 8),
|
|
1327
|
+
type: "psd",
|
|
1328
|
+
mime: "image/vnd.adobe.photoshop",
|
|
1329
|
+
wUnits: "px",
|
|
1330
|
+
hUnits: "px"
|
|
1331
|
+
};
|
|
1332
|
+
};
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/common/svg_header.js
|
|
1336
|
+
var require_svg_header = __commonJS(function(exports) {
|
|
1337
|
+
exports.MAX_DATA_LENGTH = 1024 * 10;
|
|
1338
|
+
var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
|
|
1339
|
+
var unquoted = "[^\"'=<>`\\x00-\\x20]+";
|
|
1340
|
+
var single_quoted = "'[^']*'";
|
|
1341
|
+
var double_quoted = '"[^"]*"';
|
|
1342
|
+
var attr_value = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")";
|
|
1343
|
+
var attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)";
|
|
1344
|
+
var pi = "<[?][\\s\\S]*?[?]>";
|
|
1345
|
+
var comment = "<!--(?:[^-]|-[^-]|--[^>])*-->";
|
|
1346
|
+
var cdata = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>";
|
|
1347
|
+
var doctype = "<![A-Za-z][^[>]*(?:\\[[\\s\\S]*?\\][^>]*)?>";
|
|
1348
|
+
var PROLOG_RE = new RegExp("^(?:\\s+|" + pi + "|" + comment + "|" + cdata + "|" + doctype + ")*");
|
|
1349
|
+
var ROOT_RE = new RegExp("^<(" + attr_name + ")(" + attribute + "*)\\s*/?>");
|
|
1350
|
+
var ATTR_RE = new RegExp("\\s+(" + attr_name + ")(?:\\s*=\\s*(?:(" + unquoted + `)|'([^']*)'|"([^"]*)"))?`, "g");
|
|
1351
|
+
var SVG_UNITS_RE = /in$|mm$|cm$|pt$|pc$|px$|em$|ex$/;
|
|
1352
|
+
function isFinitePositive(val) {
|
|
1353
|
+
return typeof val === "number" && isFinite(val) && val > 0;
|
|
1354
|
+
}
|
|
1355
|
+
function units(str) {
|
|
1356
|
+
var suffix = str.slice(-2);
|
|
1357
|
+
var m = suffix.match(SVG_UNITS_RE);
|
|
1358
|
+
return m === null ? "px" : m[0];
|
|
1359
|
+
}
|
|
1360
|
+
exports.parse = function(str) {
|
|
1361
|
+
var prolog = str.match(PROLOG_RE)[0];
|
|
1362
|
+
var root = ROOT_RE.exec(prolog.length ? str.slice(prolog.length) : str);
|
|
1363
|
+
if (!root)
|
|
1364
|
+
return;
|
|
1365
|
+
var tag = root[1];
|
|
1366
|
+
if (tag !== "svg" && tag.slice(-4) !== ":svg")
|
|
1367
|
+
return;
|
|
1368
|
+
var attrs = {};
|
|
1369
|
+
var m;
|
|
1370
|
+
ATTR_RE.lastIndex = 0;
|
|
1371
|
+
while ((m = ATTR_RE.exec(root[2])) !== null) {
|
|
1372
|
+
attrs[m[1]] = m[2] !== undefined ? m[2] : m[3] !== undefined ? m[3] : m[4];
|
|
1373
|
+
}
|
|
1374
|
+
var wAttr = attrs.width;
|
|
1375
|
+
var hAttr = attrs.height;
|
|
1376
|
+
var vbAttr = attrs.viewBox || attrs.viewbox;
|
|
1377
|
+
if (wAttr && wAttr.indexOf("%") !== -1)
|
|
1378
|
+
wAttr = undefined;
|
|
1379
|
+
if (hAttr && hAttr.indexOf("%") !== -1)
|
|
1380
|
+
hAttr = undefined;
|
|
1381
|
+
var width = parseFloat(wAttr);
|
|
1382
|
+
var height = parseFloat(hAttr);
|
|
1383
|
+
if (wAttr && hAttr) {
|
|
1384
|
+
if (!isFinitePositive(width) || !isFinitePositive(height))
|
|
1385
|
+
return;
|
|
1386
|
+
return {
|
|
1387
|
+
width,
|
|
1388
|
+
height,
|
|
1389
|
+
type: "svg",
|
|
1390
|
+
mime: "image/svg+xml",
|
|
1391
|
+
wUnits: units(wAttr),
|
|
1392
|
+
hUnits: units(hAttr)
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
var parts = (vbAttr || "").trim().split(/[\s,]+/);
|
|
1396
|
+
var vbWidth = parseFloat(parts[2]);
|
|
1397
|
+
var vbHeight = parseFloat(parts[3]);
|
|
1398
|
+
if (!isFinitePositive(vbWidth) || !isFinitePositive(vbHeight))
|
|
1399
|
+
return;
|
|
1400
|
+
if (units(parts[2]) !== units(parts[3]))
|
|
1401
|
+
return;
|
|
1402
|
+
var ratio = vbWidth / vbHeight;
|
|
1403
|
+
if (wAttr) {
|
|
1404
|
+
if (!isFinitePositive(width))
|
|
1405
|
+
return;
|
|
1406
|
+
return {
|
|
1407
|
+
width,
|
|
1408
|
+
height: width / ratio,
|
|
1409
|
+
type: "svg",
|
|
1410
|
+
mime: "image/svg+xml",
|
|
1411
|
+
wUnits: units(wAttr),
|
|
1412
|
+
hUnits: units(wAttr)
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
if (hAttr) {
|
|
1416
|
+
if (!isFinitePositive(height))
|
|
1417
|
+
return;
|
|
1418
|
+
return {
|
|
1419
|
+
width: height * ratio,
|
|
1420
|
+
height,
|
|
1421
|
+
type: "svg",
|
|
1422
|
+
mime: "image/svg+xml",
|
|
1423
|
+
wUnits: units(hAttr),
|
|
1424
|
+
hUnits: units(hAttr)
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
return {
|
|
1428
|
+
width: vbWidth,
|
|
1429
|
+
height: vbHeight,
|
|
1430
|
+
type: "svg",
|
|
1431
|
+
mime: "image/svg+xml",
|
|
1432
|
+
wUnits: units(parts[2]),
|
|
1433
|
+
hUnits: units(parts[3])
|
|
1434
|
+
};
|
|
1435
|
+
};
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1438
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/svg.js
|
|
1439
|
+
var require_svg = __commonJS(function(exports, module) {
|
|
1440
|
+
var parseSvgHeader = require_svg_header().parse;
|
|
1441
|
+
var MAX_DATA_LENGTH = require_svg_header().MAX_DATA_LENGTH;
|
|
1442
|
+
module.exports = function(data) {
|
|
1443
|
+
var start = 0;
|
|
1444
|
+
if (data[0] === 239 && data[1] === 187 && data[2] === 191)
|
|
1445
|
+
start = 3;
|
|
1446
|
+
var str = "";
|
|
1447
|
+
var max = Math.min(data.length, start + MAX_DATA_LENGTH);
|
|
1448
|
+
for (var i = start;i < max; i++) {
|
|
1449
|
+
str += String.fromCharCode(data[i]);
|
|
1450
|
+
}
|
|
1451
|
+
return parseSvgHeader(str);
|
|
1452
|
+
};
|
|
1453
|
+
});
|
|
1454
|
+
|
|
1455
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/tiff.js
|
|
1456
|
+
var require_tiff = __commonJS(function(exports, module) {
|
|
1457
|
+
var str2arr = require_common().str2arr;
|
|
1458
|
+
var sliceEq = require_common().sliceEq;
|
|
1459
|
+
var readUInt16LE = require_common().readUInt16LE;
|
|
1460
|
+
var readUInt16BE = require_common().readUInt16BE;
|
|
1461
|
+
var readUInt32LE = require_common().readUInt32LE;
|
|
1462
|
+
var readUInt32BE = require_common().readUInt32BE;
|
|
1463
|
+
var SIG_1 = str2arr("II*\x00");
|
|
1464
|
+
var SIG_2 = str2arr("MM\x00*");
|
|
1465
|
+
function readUInt16(buffer, offset, is_big_endian) {
|
|
1466
|
+
return is_big_endian ? readUInt16BE(buffer, offset) : readUInt16LE(buffer, offset);
|
|
1467
|
+
}
|
|
1468
|
+
function readUInt32(buffer, offset, is_big_endian) {
|
|
1469
|
+
return is_big_endian ? readUInt32BE(buffer, offset) : readUInt32LE(buffer, offset);
|
|
1470
|
+
}
|
|
1471
|
+
function readIFDValue(data, data_offset, is_big_endian) {
|
|
1472
|
+
var type = readUInt16(data, data_offset + 2, is_big_endian);
|
|
1473
|
+
var values = readUInt32(data, data_offset + 4, is_big_endian);
|
|
1474
|
+
if (values !== 1 || type !== 3 && type !== 4)
|
|
1475
|
+
return null;
|
|
1476
|
+
if (type === 3) {
|
|
1477
|
+
return readUInt16(data, data_offset + 8, is_big_endian);
|
|
1478
|
+
}
|
|
1479
|
+
return readUInt32(data, data_offset + 8, is_big_endian);
|
|
1480
|
+
}
|
|
1481
|
+
module.exports = function(data) {
|
|
1482
|
+
if (data.length < 8)
|
|
1483
|
+
return;
|
|
1484
|
+
if (!sliceEq(data, 0, SIG_1) && !sliceEq(data, 0, SIG_2))
|
|
1485
|
+
return;
|
|
1486
|
+
var is_big_endian = data[0] === 77;
|
|
1487
|
+
var count = readUInt32(data, 4, is_big_endian) - 8;
|
|
1488
|
+
if (count < 0)
|
|
1489
|
+
return;
|
|
1490
|
+
var offset = count + 8;
|
|
1491
|
+
if (data.length - offset < 2)
|
|
1492
|
+
return;
|
|
1493
|
+
var ifd_size = readUInt16(data, offset + 0, is_big_endian) * 12;
|
|
1494
|
+
if (ifd_size <= 0)
|
|
1495
|
+
return;
|
|
1496
|
+
offset += 2;
|
|
1497
|
+
if (data.length - offset < ifd_size)
|
|
1498
|
+
return;
|
|
1499
|
+
var i, width, height, tag;
|
|
1500
|
+
for (i = 0;i < ifd_size; i += 12) {
|
|
1501
|
+
tag = readUInt16(data, offset + i, is_big_endian);
|
|
1502
|
+
if (tag === 256) {
|
|
1503
|
+
width = readIFDValue(data, offset + i, is_big_endian);
|
|
1504
|
+
} else if (tag === 257) {
|
|
1505
|
+
height = readIFDValue(data, offset + i, is_big_endian);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
if (width && height) {
|
|
1509
|
+
return {
|
|
1510
|
+
width,
|
|
1511
|
+
height,
|
|
1512
|
+
type: "tiff",
|
|
1513
|
+
mime: "image/tiff",
|
|
1514
|
+
wUnits: "px",
|
|
1515
|
+
hUnits: "px"
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
});
|
|
1520
|
+
|
|
1521
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parse_sync/webp.js
|
|
1522
|
+
var require_webp = __commonJS(function(exports, module) {
|
|
1523
|
+
var str2arr = require_common().str2arr;
|
|
1524
|
+
var sliceEq = require_common().sliceEq;
|
|
1525
|
+
var readUInt16LE = require_common().readUInt16LE;
|
|
1526
|
+
var readUInt32LE = require_common().readUInt32LE;
|
|
1527
|
+
var exif = require_exif_utils();
|
|
1528
|
+
var SIG_RIFF = str2arr("RIFF");
|
|
1529
|
+
var SIG_WEBP = str2arr("WEBP");
|
|
1530
|
+
function parseVP8(data, offset) {
|
|
1531
|
+
if (data[offset + 3] !== 157 || data[offset + 4] !== 1 || data[offset + 5] !== 42) {
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1534
|
+
return {
|
|
1535
|
+
width: readUInt16LE(data, offset + 6) & 16383,
|
|
1536
|
+
height: readUInt16LE(data, offset + 8) & 16383,
|
|
1537
|
+
type: "webp",
|
|
1538
|
+
mime: "image/webp",
|
|
1539
|
+
wUnits: "px",
|
|
1540
|
+
hUnits: "px"
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
function parseVP8L(data, offset) {
|
|
1544
|
+
if (data[offset] !== 47)
|
|
1545
|
+
return;
|
|
1546
|
+
var bits = readUInt32LE(data, offset + 1);
|
|
1547
|
+
return {
|
|
1548
|
+
width: (bits & 16383) + 1,
|
|
1549
|
+
height: (bits >> 14 & 16383) + 1,
|
|
1550
|
+
type: "webp",
|
|
1551
|
+
mime: "image/webp",
|
|
1552
|
+
wUnits: "px",
|
|
1553
|
+
hUnits: "px"
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
function parseVP8X(data, offset) {
|
|
1557
|
+
return {
|
|
1558
|
+
width: (data[offset + 6] << 16 | data[offset + 5] << 8 | data[offset + 4]) + 1,
|
|
1559
|
+
height: (data[offset + 9] << 16 | data[offset + 8] << 8 | data[offset + 7]) + 1,
|
|
1560
|
+
type: "webp",
|
|
1561
|
+
mime: "image/webp",
|
|
1562
|
+
wUnits: "px",
|
|
1563
|
+
hUnits: "px"
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
module.exports = function(data) {
|
|
1567
|
+
if (data.length < 16)
|
|
1568
|
+
return;
|
|
1569
|
+
if (!sliceEq(data, 0, SIG_RIFF) || !sliceEq(data, 8, SIG_WEBP))
|
|
1570
|
+
return;
|
|
1571
|
+
var offset = 12;
|
|
1572
|
+
var result = null;
|
|
1573
|
+
var exif_orientation = 0;
|
|
1574
|
+
var fileLength = readUInt32LE(data, 4) + 8;
|
|
1575
|
+
if (fileLength > data.length)
|
|
1576
|
+
return;
|
|
1577
|
+
while (offset + 8 < fileLength) {
|
|
1578
|
+
if (data[offset] === 0) {
|
|
1579
|
+
offset++;
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
var header = String.fromCharCode.apply(null, data.slice(offset, offset + 4));
|
|
1583
|
+
var length = readUInt32LE(data, offset + 4);
|
|
1584
|
+
if (header === "VP8 " && length >= 10) {
|
|
1585
|
+
result = result || parseVP8(data, offset + 8);
|
|
1586
|
+
} else if (header === "VP8L" && length >= 5) {
|
|
1587
|
+
result = result || parseVP8L(data, offset + 8);
|
|
1588
|
+
} else if (header === "VP8X" && length >= 10) {
|
|
1589
|
+
result = result || parseVP8X(data, offset + 8);
|
|
1590
|
+
} else if (header === "EXIF") {
|
|
1591
|
+
exif_orientation = exif.get_orientation(data.slice(offset + 8, offset + 8 + length));
|
|
1592
|
+
offset = Infinity;
|
|
1593
|
+
}
|
|
1594
|
+
offset += 8 + length;
|
|
1595
|
+
}
|
|
1596
|
+
if (!result)
|
|
1597
|
+
return;
|
|
1598
|
+
if (exif_orientation > 0) {
|
|
1599
|
+
result.orientation = exif_orientation;
|
|
1600
|
+
}
|
|
1601
|
+
return result;
|
|
1602
|
+
};
|
|
1603
|
+
});
|
|
1604
|
+
|
|
1605
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/lib/parsers_sync.js
|
|
1606
|
+
var require_parsers_sync = __commonJS(function(exports, module) {
|
|
1607
|
+
module.exports = {
|
|
1608
|
+
avif: require_avif(),
|
|
1609
|
+
bmp: require_bmp(),
|
|
1610
|
+
gif: require_gif(),
|
|
1611
|
+
ico: require_ico(),
|
|
1612
|
+
jpeg: require_jpeg(),
|
|
1613
|
+
png: require_png(),
|
|
1614
|
+
psd: require_psd(),
|
|
1615
|
+
svg: require_svg(),
|
|
1616
|
+
tiff: require_tiff(),
|
|
1617
|
+
webp: require_webp()
|
|
1618
|
+
};
|
|
1619
|
+
});
|
|
1620
|
+
|
|
1621
|
+
// node_modules/.bun/probe-image-size@7.4.0/node_modules/probe-image-size/sync.js
|
|
1622
|
+
var require_sync = __commonJS(function(exports, module) {
|
|
1623
|
+
var parsers = require_parsers_sync();
|
|
1624
|
+
function probeBuffer(buffer) {
|
|
1625
|
+
var parser_names = Object.keys(parsers);
|
|
1626
|
+
for (var i = 0;i < parser_names.length; i++) {
|
|
1627
|
+
var result = parsers[parser_names[i]](buffer);
|
|
1628
|
+
if (result) {
|
|
1629
|
+
if (result.width > 0 && result.height > 0)
|
|
1630
|
+
return result;
|
|
1631
|
+
return null;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
return null;
|
|
1635
|
+
}
|
|
1636
|
+
module.exports = function get_image_size(src) {
|
|
1637
|
+
return probeBuffer(src);
|
|
1638
|
+
};
|
|
1639
|
+
module.exports.parsers = parsers;
|
|
1640
|
+
});
|
|
1641
|
+
|
|
1642
|
+
export { require_common, require_miaf_utils, require_exif_utils, require_svg_header, require_sync };
|