@d0paminedriven/fs 7.4.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XCA34DKZ.js → chunk-3RC3WC7A.js} +2 -2
- package/dist/{chunk-IU4MDHYM.js → chunk-4LZQHSBL.js} +15 -13
- package/dist/chunk-6R36YN3W.js +386 -0
- package/dist/{chunk-KDWGS5GC.js → chunk-CTSJFQMC.js} +2 -2
- package/dist/{chunk-7FHBNIB7.js → chunk-I4ITMOIV.js} +2 -2
- package/dist/{chunk-Q2VF3BVH.js → chunk-MUFEXR25.js} +2 -2
- package/dist/{chunk-KNLXF622.js → chunk-PHTZ7NRL.js} +26 -6
- package/dist/{chunk-R63XI7FS.js → chunk-Q6QZ5XEP.js} +1 -1
- package/dist/{chunk-TDMPLELZ.js → chunk-QKZIGBLD.js} +2 -2
- package/dist/chunk-TUY7Y4DL.js +1335 -0
- package/dist/{chunk-FPB77OGJ.js → chunk-ZQRB46YA.js} +3 -3
- package/dist/fs/index.d.ts +133 -1
- package/dist/fs/index.js +11 -10
- package/dist/fs-atomic/index.d.ts +1 -0
- package/dist/fs-atomic/index.js +5 -4
- package/dist/fs-base/index.d.ts +1 -0
- package/dist/fs-base/index.js +4 -3
- package/dist/fs-core/index.d.ts +2 -1
- package/dist/fs-core/index.js +8 -7
- package/dist/fs-fetch/index.d.ts +4 -3
- package/dist/fs-fetch/index.js +10 -9
- package/dist/fs-size/index.d.ts +1 -0
- package/dist/fs-size/index.js +7 -6
- package/dist/fs-tmp/index.d.ts +1 -0
- package/dist/fs-tmp/index.js +9 -8
- package/dist/image/index.d.ts +340 -21
- package/dist/image/index.js +3 -2
- package/dist/image/workup.d.ts +39 -0
- package/dist/image/workup.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -10
- package/dist/mime/index.d.ts +45 -15
- package/dist/mime/index.js +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.js +1 -1
- package/package.json +13 -8
- package/dist/chunk-C2ANVZLG.js +0 -918
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FsBase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I4ITMOIV.js";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -104,4 +104,4 @@ var FsAtomic = class extends FsBase {
|
|
|
104
104
|
export {
|
|
105
105
|
FsAtomic
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-3RC3WC7A.js.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FsFetch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MUFEXR25.js";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-7QVYU63E.js";
|
|
7
7
|
|
|
8
8
|
// src/fs/index.ts
|
|
9
|
-
import {
|
|
10
|
-
import { relative, resolve } from "path";
|
|
9
|
+
import { resolve } from "path";
|
|
11
10
|
import sharp from "sharp";
|
|
12
11
|
var Fs = class extends FsFetch {
|
|
13
12
|
constructor(cwd) {
|
|
@@ -19,17 +18,20 @@ var Fs = class extends FsFetch {
|
|
|
19
18
|
__name(this, "Fs");
|
|
20
19
|
}
|
|
21
20
|
async getImageSpecs(filePath, size = 4096 * 6) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
return this.
|
|
21
|
+
if (filePath.startsWith("https")) {
|
|
22
|
+
return await this.extractRemote(filePath, size);
|
|
23
|
+
}
|
|
24
|
+
return await this.extractViaPath(filePath, size);
|
|
25
|
+
}
|
|
26
|
+
async getImageSpecsFlexi(target, size = 4096 * 6) {
|
|
27
|
+
if (Buffer.isBuffer(target)) {
|
|
28
|
+
return this.getImageSpecsWorkup(target, size);
|
|
29
|
+
} else {
|
|
30
|
+
return await this.getImageSpecs(target, size);
|
|
31
|
+
}
|
|
26
32
|
}
|
|
27
33
|
async getImageSpecsTmp(filepath, size = 4096 * 6) {
|
|
28
|
-
|
|
29
|
-
relative(this.cwd, resolve(this.tmpDir, filepath)),
|
|
30
|
-
{ highWaterMark: size }
|
|
31
|
-
);
|
|
32
|
-
return this.extractFromStream(stream);
|
|
34
|
+
return this.extractViaPath(resolve(this.tmpDir, filepath), size);
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* Extract image metadata using streaming (only reads ~4KB)
|
|
@@ -72,4 +74,4 @@ var Fs = class extends FsFetch {
|
|
|
72
74
|
export {
|
|
73
75
|
Fs
|
|
74
76
|
};
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-4LZQHSBL.js.map
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MimeService
|
|
3
|
+
} from "./chunk-PHTZ7NRL.js";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-7QVYU63E.js";
|
|
7
|
+
|
|
8
|
+
// src/image/workup.ts
|
|
9
|
+
var ImageServiceWorkup = class extends MimeService {
|
|
10
|
+
constructor(cwd) {
|
|
11
|
+
super();
|
|
12
|
+
this.cwd = cwd;
|
|
13
|
+
}
|
|
14
|
+
static {
|
|
15
|
+
__name(this, "ImageServiceWorkup");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read exactly N bytes from a stream, returning a Buffer
|
|
19
|
+
* Closes stream after reading or on error
|
|
20
|
+
*/
|
|
21
|
+
async readBytes(stream, bytes) {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
const chunks = Array.of();
|
|
24
|
+
let totalBytes = 0;
|
|
25
|
+
const cleanup = /* @__PURE__ */ __name(() => {
|
|
26
|
+
stream.removeAllListeners();
|
|
27
|
+
stream.destroy();
|
|
28
|
+
}, "cleanup");
|
|
29
|
+
stream.on("error", (err) => {
|
|
30
|
+
cleanup();
|
|
31
|
+
reject(err);
|
|
32
|
+
});
|
|
33
|
+
stream.on("data", (chunk) => {
|
|
34
|
+
const remaining = bytes - totalBytes;
|
|
35
|
+
if (chunk.length <= remaining) {
|
|
36
|
+
chunks.push(chunk);
|
|
37
|
+
totalBytes += chunk.length;
|
|
38
|
+
} else {
|
|
39
|
+
chunks.push(chunk.subarray(0, remaining));
|
|
40
|
+
totalBytes = bytes;
|
|
41
|
+
}
|
|
42
|
+
if (totalBytes >= bytes) {
|
|
43
|
+
cleanup();
|
|
44
|
+
resolve(Buffer.concat(chunks));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
stream.on("end", () => {
|
|
48
|
+
cleanup();
|
|
49
|
+
resolve(Buffer.concat(chunks));
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
parseExif(buffer, app1Pos, app1Size) {
|
|
54
|
+
const segmentStart = app1Pos + 4;
|
|
55
|
+
const segmentEnd = app1Pos + 2 + app1Size;
|
|
56
|
+
if (segmentEnd - segmentStart < 16 || segmentEnd > buffer.length) {
|
|
57
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
58
|
+
}
|
|
59
|
+
const headerEnd = Math.min(segmentStart + 6, segmentEnd, buffer.length);
|
|
60
|
+
if (headerEnd - segmentStart < 6) {
|
|
61
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
62
|
+
}
|
|
63
|
+
const exifHeader = buffer.toString("ascii", segmentStart, headerEnd);
|
|
64
|
+
if (exifHeader !== "Exif\0\0") {
|
|
65
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
66
|
+
}
|
|
67
|
+
const tiffStart = segmentStart + 6;
|
|
68
|
+
const tiffEnd = segmentEnd;
|
|
69
|
+
if (tiffEnd - tiffStart < 8) {
|
|
70
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
71
|
+
}
|
|
72
|
+
const byteOrder = buffer.toString("ascii", tiffStart, tiffStart + 2);
|
|
73
|
+
const littleEndian = byteOrder === "II";
|
|
74
|
+
const bigEndian = byteOrder === "MM";
|
|
75
|
+
if (!littleEndian && !bigEndian) {
|
|
76
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
77
|
+
}
|
|
78
|
+
const readUInt16 = /* @__PURE__ */ __name((pos) => {
|
|
79
|
+
if (pos < 0 || pos + 2 > tiffEnd || pos + 2 > buffer.length) return null;
|
|
80
|
+
return littleEndian ? buffer.readUInt16LE(pos) : buffer.readUInt16BE(pos);
|
|
81
|
+
}, "readUInt16");
|
|
82
|
+
const readUInt32 = /* @__PURE__ */ __name((pos) => {
|
|
83
|
+
if (pos < 0 || pos + 4 > tiffEnd || pos + 4 > buffer.length) return null;
|
|
84
|
+
return littleEndian ? buffer.readUInt32LE(pos) : buffer.readUInt32BE(pos);
|
|
85
|
+
}, "readUInt32");
|
|
86
|
+
const magic = readUInt16(tiffStart + 2);
|
|
87
|
+
if (magic !== 42) {
|
|
88
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
89
|
+
}
|
|
90
|
+
const ifd0Offset = readUInt32(tiffStart + 4);
|
|
91
|
+
if (ifd0Offset === null || ifd0Offset < 8) {
|
|
92
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
93
|
+
}
|
|
94
|
+
const ifd0Pos = tiffStart + ifd0Offset;
|
|
95
|
+
if (ifd0Pos + 2 > tiffEnd) {
|
|
96
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
97
|
+
}
|
|
98
|
+
const numEntries = readUInt16(ifd0Pos);
|
|
99
|
+
if (numEntries === null || numEntries === 0 || numEntries > 500) {
|
|
100
|
+
return { orientation: null, dateTimeOriginal: null };
|
|
101
|
+
}
|
|
102
|
+
let orientation = null;
|
|
103
|
+
let dateTimeOriginal = null;
|
|
104
|
+
const ifdDataStart = ifd0Pos + 2;
|
|
105
|
+
const ifdDataEnd = ifdDataStart + numEntries * 12;
|
|
106
|
+
if (ifdDataEnd > tiffEnd) {
|
|
107
|
+
const maxEntries = Math.floor((tiffEnd - ifdDataStart) / 12);
|
|
108
|
+
if (maxEntries <= 0) {
|
|
109
|
+
return { orientation, dateTimeOriginal };
|
|
110
|
+
}
|
|
111
|
+
for (let i = 0; i < maxEntries; i++) {
|
|
112
|
+
const entryPos = ifdDataStart + i * 12;
|
|
113
|
+
const tag = readUInt16(entryPos);
|
|
114
|
+
const type = readUInt16(entryPos + 2);
|
|
115
|
+
const count = readUInt32(entryPos + 4);
|
|
116
|
+
if (tag === null || type === null || count === null) continue;
|
|
117
|
+
if (tag === 274 && type === 3 && count === 1) {
|
|
118
|
+
orientation = readUInt16(entryPos + 8);
|
|
119
|
+
if (orientation && (orientation < 1 || orientation > 8)) {
|
|
120
|
+
orientation = null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (tag === 36867 && type === 2 && count === 20) {
|
|
124
|
+
const offset = readUInt32(entryPos + 8);
|
|
125
|
+
if (offset !== null) {
|
|
126
|
+
const stringPos = tiffStart + offset;
|
|
127
|
+
const stringEnd = stringPos + 19;
|
|
128
|
+
if (stringEnd <= tiffEnd && stringEnd <= buffer.length) {
|
|
129
|
+
try {
|
|
130
|
+
dateTimeOriginal = buffer.toString(
|
|
131
|
+
"ascii",
|
|
132
|
+
stringPos,
|
|
133
|
+
stringEnd
|
|
134
|
+
);
|
|
135
|
+
if (!/^\d{4}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}/.test(dateTimeOriginal)) {
|
|
136
|
+
dateTimeOriginal = null;
|
|
137
|
+
}
|
|
138
|
+
} catch {
|
|
139
|
+
dateTimeOriginal = null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
for (let i = 0; i < numEntries; i++) {
|
|
147
|
+
const entryPos = ifdDataStart + i * 12;
|
|
148
|
+
const tag = readUInt16(entryPos);
|
|
149
|
+
const type = readUInt16(entryPos + 2);
|
|
150
|
+
const count = readUInt32(entryPos + 4);
|
|
151
|
+
if (tag === null || type === null || count === null) continue;
|
|
152
|
+
if (tag === 274 && type === 3 && count === 1) {
|
|
153
|
+
orientation = readUInt16(entryPos + 8);
|
|
154
|
+
if (orientation && (orientation < 1 || orientation > 8)) {
|
|
155
|
+
orientation = null;
|
|
156
|
+
}
|
|
157
|
+
} else if (tag === 36867 && type === 2 && count === 20) {
|
|
158
|
+
const offset = readUInt32(entryPos + 8);
|
|
159
|
+
if (offset !== null) {
|
|
160
|
+
const stringPos = tiffStart + offset;
|
|
161
|
+
const stringEnd = stringPos + 19;
|
|
162
|
+
if (stringEnd <= tiffEnd && stringEnd <= buffer.length) {
|
|
163
|
+
try {
|
|
164
|
+
const extracted = buffer.toString(
|
|
165
|
+
"ascii",
|
|
166
|
+
stringPos,
|
|
167
|
+
stringEnd
|
|
168
|
+
);
|
|
169
|
+
if (/^\d{4}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}/.test(extracted)) {
|
|
170
|
+
dateTimeOriginal = extracted;
|
|
171
|
+
}
|
|
172
|
+
} catch {
|
|
173
|
+
console.warn("invalid ascii data");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return { orientation, dateTimeOriginal };
|
|
181
|
+
}
|
|
182
|
+
parseXmpFromAvif(buffer, meta, _ipco) {
|
|
183
|
+
const iinf = this.findBox(
|
|
184
|
+
buffer,
|
|
185
|
+
"iinf",
|
|
186
|
+
meta.pos + 4,
|
|
187
|
+
meta.pos + meta.size
|
|
188
|
+
);
|
|
189
|
+
if (!iinf) return null;
|
|
190
|
+
let pos = iinf.pos;
|
|
191
|
+
const version = buffer[pos++];
|
|
192
|
+
const itemCount = version === 0 ? buffer.readUInt16BE(pos) : buffer.readUInt32BE(pos);
|
|
193
|
+
pos += version === 0 ? 2 : 4;
|
|
194
|
+
let xmpItemId;
|
|
195
|
+
for (let i = 0; i < itemCount; i++) {
|
|
196
|
+
const infeStart = pos;
|
|
197
|
+
const infeSize = buffer.readUInt32BE(pos);
|
|
198
|
+
if (buffer.toString("ascii", pos + 4, pos + 8) !== "infe") break;
|
|
199
|
+
pos += 8;
|
|
200
|
+
const infeVersion = buffer?.[pos++];
|
|
201
|
+
if (!infeVersion) return null;
|
|
202
|
+
const itemId = infeVersion < 2 ? buffer.readUInt16BE(pos) : buffer.readUInt32BE(pos);
|
|
203
|
+
pos += infeVersion < 2 ? 2 : 4;
|
|
204
|
+
pos += 2;
|
|
205
|
+
const itemType = buffer.toString("ascii", pos, pos + 4);
|
|
206
|
+
pos += 4;
|
|
207
|
+
let nameEnd = pos;
|
|
208
|
+
while (buffer[nameEnd] !== 0 && nameEnd < infeStart + infeSize) nameEnd++;
|
|
209
|
+
pos = nameEnd + 1;
|
|
210
|
+
if (itemType === "mime") {
|
|
211
|
+
let ctEnd = pos;
|
|
212
|
+
while (buffer[ctEnd] !== 0 && ctEnd < infeStart + infeSize) ctEnd++;
|
|
213
|
+
const contentType = buffer.toString("ascii", pos, ctEnd);
|
|
214
|
+
if (contentType === "application/rdf+xml") {
|
|
215
|
+
xmpItemId = itemId;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
pos = ctEnd + 1;
|
|
219
|
+
}
|
|
220
|
+
pos = infeStart + infeSize;
|
|
221
|
+
}
|
|
222
|
+
if (!xmpItemId) return null;
|
|
223
|
+
const iloc = this.findBox(
|
|
224
|
+
buffer,
|
|
225
|
+
"iloc",
|
|
226
|
+
meta.pos + 4,
|
|
227
|
+
meta.pos + meta.size
|
|
228
|
+
);
|
|
229
|
+
if (!iloc) return null;
|
|
230
|
+
pos = iloc.pos;
|
|
231
|
+
const ilocVersion = buffer[pos++];
|
|
232
|
+
const sizes = buffer?.[pos++];
|
|
233
|
+
if (!sizes) return null;
|
|
234
|
+
const offsetSize = sizes >> 4 & 15;
|
|
235
|
+
const lengthSize = sizes & 15;
|
|
236
|
+
let indexSize = 0;
|
|
237
|
+
if (ilocVersion === 1 || ilocVersion === 2) {
|
|
238
|
+
const indexSizes = buffer?.[pos++];
|
|
239
|
+
if (!indexSizes) return null;
|
|
240
|
+
indexSize = indexSizes >> 4 & 15;
|
|
241
|
+
}
|
|
242
|
+
if (!ilocVersion) return null;
|
|
243
|
+
const buffpos = buffer?.[pos++];
|
|
244
|
+
if (!buffpos) return null;
|
|
245
|
+
const baseOffsetSize = ilocVersion < 2 ? 0 : buffpos >> 4 & 15;
|
|
246
|
+
const itemCountIloc = ilocVersion < 2 ? buffer.readUInt16BE(pos) : buffer.readUInt32BE(pos);
|
|
247
|
+
pos += ilocVersion < 2 ? 2 : 4;
|
|
248
|
+
let xmpOffset = 0;
|
|
249
|
+
let xmpLength = 0;
|
|
250
|
+
for (let i = 0; i < itemCountIloc; i++) {
|
|
251
|
+
const curItemId = ilocVersion < 2 ? buffer.readUInt16BE(pos) : buffer.readUInt32BE(pos);
|
|
252
|
+
pos += ilocVersion < 2 ? 2 : 4;
|
|
253
|
+
if (curItemId !== xmpItemId) {
|
|
254
|
+
if (ilocVersion === 1 || ilocVersion === 2) pos += 2;
|
|
255
|
+
pos += 2;
|
|
256
|
+
pos += baseOffsetSize;
|
|
257
|
+
const extentCount2 = buffer.readUInt16BE(pos);
|
|
258
|
+
pos += 2;
|
|
259
|
+
for (let e = 0; e < extentCount2; e++) {
|
|
260
|
+
if (indexSize > 0) pos += indexSize;
|
|
261
|
+
pos += offsetSize + lengthSize;
|
|
262
|
+
}
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (ilocVersion === 1 || ilocVersion === 2) {
|
|
266
|
+
const constructionMethod = buffer.readUInt16BE(pos);
|
|
267
|
+
pos += 2;
|
|
268
|
+
if (constructionMethod !== 0) return null;
|
|
269
|
+
}
|
|
270
|
+
pos += 2;
|
|
271
|
+
const baseOffset = this.readVarSize(buffer, pos, baseOffsetSize);
|
|
272
|
+
pos += baseOffsetSize;
|
|
273
|
+
const extentCount = buffer.readUInt16BE(pos);
|
|
274
|
+
pos += 2;
|
|
275
|
+
if (extentCount !== 1) return null;
|
|
276
|
+
if (indexSize > 0) pos += indexSize;
|
|
277
|
+
const extentOffset = this.readVarSize(buffer, pos, offsetSize);
|
|
278
|
+
pos += offsetSize;
|
|
279
|
+
const extentLength = this.readVarSize(buffer, pos, lengthSize);
|
|
280
|
+
xmpOffset = baseOffset + extentOffset;
|
|
281
|
+
xmpLength = extentLength;
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
if (xmpOffset === 0 || xmpLength === 0 || xmpOffset + xmpLength > buffer.length)
|
|
285
|
+
return null;
|
|
286
|
+
return buffer.toString("utf8", xmpOffset, xmpOffset + xmpLength);
|
|
287
|
+
}
|
|
288
|
+
readVarSize(buffer, pos, size) {
|
|
289
|
+
if (size === 0) return 0;
|
|
290
|
+
if (size === 1 && buffer?.[pos]) return buffer?.[pos];
|
|
291
|
+
if (size === 2) return buffer.readUInt16BE(pos);
|
|
292
|
+
if (size === 3) {
|
|
293
|
+
const pos1 = buffer?.[pos + 1], pos2 = buffer?.[pos + 2];
|
|
294
|
+
if (buffer?.[pos] && pos1 && pos2) {
|
|
295
|
+
return buffer[pos] << 16 | pos1 << 8 | pos2;
|
|
296
|
+
}
|
|
297
|
+
throw new Error("Invalid var size");
|
|
298
|
+
}
|
|
299
|
+
if (size === 4) return buffer.readUInt32BE(pos);
|
|
300
|
+
if (size === 8) return Number(buffer.readBigUInt64BE(pos));
|
|
301
|
+
throw new Error("Invalid var size");
|
|
302
|
+
}
|
|
303
|
+
findBox(buffer, type, start = 0, end = buffer.length) {
|
|
304
|
+
let pos = start;
|
|
305
|
+
while (pos < end) {
|
|
306
|
+
let boxSize = buffer.readUInt32BE(pos);
|
|
307
|
+
const boxType = buffer.toString("ascii", pos + 4, pos + 8);
|
|
308
|
+
let hdrSize = 8;
|
|
309
|
+
if (boxSize === 1) {
|
|
310
|
+
boxSize = Number(buffer.readBigUInt64BE(pos + 8));
|
|
311
|
+
hdrSize = 16;
|
|
312
|
+
} else if (boxSize === 0) {
|
|
313
|
+
boxSize = end - pos;
|
|
314
|
+
}
|
|
315
|
+
if (boxType === type) {
|
|
316
|
+
return { pos: pos + hdrSize, size: boxSize - hdrSize };
|
|
317
|
+
}
|
|
318
|
+
pos += boxSize;
|
|
319
|
+
}
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
mapChrmToColorSpace(chrm, fallback) {
|
|
323
|
+
const tol = 100;
|
|
324
|
+
if (Math.abs(chrm.white_x - 31270) < tol && Math.abs(chrm.white_y - 32900) < tol && Math.abs(chrm.red_x - 64e3) < tol && Math.abs(chrm.red_y - 33e3) < tol && Math.abs(chrm.green_x - 3e4) < tol && Math.abs(chrm.green_y - 6e4) < tol && Math.abs(chrm.blue_x - 15e3) < tol && Math.abs(chrm.blue_y - 6e3) < tol)
|
|
325
|
+
return "srgb";
|
|
326
|
+
if (Math.abs(chrm.white_x - 31270) < tol && Math.abs(chrm.white_y - 32900) < tol && Math.abs(chrm.red_x - 64e3) < tol && Math.abs(chrm.red_y - 33e3) < tol && Math.abs(chrm.green_x - 21e3) < tol && Math.abs(chrm.green_y - 71e3) < tol && Math.abs(chrm.blue_x - 15e3) < tol && Math.abs(chrm.blue_y - 6e3) < tol)
|
|
327
|
+
return "adobe_rgb";
|
|
328
|
+
if (Math.abs(chrm.white_x - 31270) < tol && Math.abs(chrm.white_y - 32900) < tol && Math.abs(chrm.red_x - 68e3) < tol && Math.abs(chrm.red_y - 32e3) < tol && Math.abs(chrm.green_x - 26500) < tol && Math.abs(chrm.green_y - 69e3) < tol && Math.abs(chrm.blue_x - 15e3) < tol && Math.abs(chrm.blue_y - 6e3) < tol)
|
|
329
|
+
return "display_p3";
|
|
330
|
+
if (Math.abs(chrm.white_x - 34590) < tol && Math.abs(chrm.white_y - 35850) < tol && // D50 white point
|
|
331
|
+
Math.abs(chrm.red_x - 73470) < tol && Math.abs(chrm.red_y - 26530) < tol && Math.abs(chrm.green_x - 15960) < tol && Math.abs(chrm.green_y - 85040) < tol && Math.abs(chrm.blue_x - 3600) < tol && Math.abs(chrm.blue_y - 1e3) < tol)
|
|
332
|
+
return "prophoto_rgb";
|
|
333
|
+
if (Math.abs(chrm.white_x - 31270) < tol && Math.abs(chrm.white_y - 32900) < tol && Math.abs(chrm.red_x - 70800) < tol && Math.abs(chrm.red_y - 29200) < tol && Math.abs(chrm.green_x - 17e3) < tol && Math.abs(chrm.green_y - 79700) < tol && Math.abs(chrm.blue_x - 13100) < tol && Math.abs(chrm.blue_y - 4600) < tol)
|
|
334
|
+
return "rec2020";
|
|
335
|
+
return fallback;
|
|
336
|
+
}
|
|
337
|
+
xmpToColorSpaceWorkup(space, target) {
|
|
338
|
+
return `<photoshop:${target}>${space}</photoshop:${target}>`;
|
|
339
|
+
}
|
|
340
|
+
mapXmpToColorSpace(xmpText, fallback) {
|
|
341
|
+
const lower = xmpText.toLowerCase();
|
|
342
|
+
if (lower.includes(this.xmpToColorSpaceWorkup("srgb", "iccprofile")))
|
|
343
|
+
return "srgb";
|
|
344
|
+
if (lower.includes(
|
|
345
|
+
this.xmpToColorSpaceWorkup("adobe rgb (1998)", "iccprofile")
|
|
346
|
+
))
|
|
347
|
+
return "adobe_rgb";
|
|
348
|
+
if (lower.includes(this.xmpToColorSpaceWorkup("display p3", "iccprofile")))
|
|
349
|
+
return "display_p3";
|
|
350
|
+
if (lower.includes(this.xmpToColorSpaceWorkup("prophoto rgb", "iccprofile")))
|
|
351
|
+
return "prophoto_rgb";
|
|
352
|
+
if (lower.includes(this.xmpToColorSpaceWorkup("rgb", "colormode")) && lower.includes("adobe rgb"))
|
|
353
|
+
return "adobe_rgb";
|
|
354
|
+
if (lower.includes(this.xmpToColorSpaceWorkup("grayscale", "colormode")))
|
|
355
|
+
return "gray";
|
|
356
|
+
return fallback;
|
|
357
|
+
}
|
|
358
|
+
mapProfileToColorSpace(profileName, fallback) {
|
|
359
|
+
if (!profileName || profileName === "embedded" || profileName.toLowerCase().includes("icc profile"))
|
|
360
|
+
return fallback;
|
|
361
|
+
const lower = profileName.toLowerCase();
|
|
362
|
+
if (lower.includes("srgb") || lower.includes("iec61966") || lower.includes("srgb2014"))
|
|
363
|
+
return "srgb";
|
|
364
|
+
if (lower.includes("display p3") || lower.includes("display-p3") || lower.includes("dci-p3") || lower.includes("p3"))
|
|
365
|
+
return "display_p3";
|
|
366
|
+
if (lower.includes("adobe rgb") || lower.includes("adobergb") || lower.includes("adobe rgb (1998)"))
|
|
367
|
+
return "adobe_rgb";
|
|
368
|
+
if (lower.includes("prophoto rgb") || lower.includes("prophoto") || lower.includes("romm rgb") || lower.includes("romm") || lower.includes("iso 22028"))
|
|
369
|
+
return "prophoto_rgb";
|
|
370
|
+
if (lower.includes("rec2020") || lower.includes("bt.2020") || lower.includes("bt2020") || lower.includes("bt.2100") || lower.includes("itur_2100"))
|
|
371
|
+
return "rec2020";
|
|
372
|
+
if (lower.includes("rec709") || lower.includes("bt.709") || lower.includes("bt709"))
|
|
373
|
+
return "rec709";
|
|
374
|
+
if (lower.includes("cmyk")) return "cmyk";
|
|
375
|
+
if (lower.includes("lab")) return "lab";
|
|
376
|
+
if (lower.includes("xyz")) return "xyz";
|
|
377
|
+
if (lower.includes("gray") || lower.includes("grey") || lower.includes("monochrome") || lower.includes("gamma") || lower.includes("gamma 2.2") || lower.includes("dot gain"))
|
|
378
|
+
return "gray";
|
|
379
|
+
return fallback;
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
export {
|
|
384
|
+
ImageServiceWorkup
|
|
385
|
+
};
|
|
386
|
+
//# sourceMappingURL=chunk-6R36YN3W.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FsSize
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZQRB46YA.js";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -66,4 +66,4 @@ var FsCore = class extends FsSize {
|
|
|
66
66
|
export {
|
|
67
67
|
FsCore
|
|
68
68
|
};
|
|
69
|
-
//# sourceMappingURL=chunk-
|
|
69
|
+
//# sourceMappingURL=chunk-CTSJFQMC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImageService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TUY7Y4DL.js";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -237,4 +237,4 @@ var FsBase = class extends ImageService {
|
|
|
237
237
|
export {
|
|
238
238
|
FsBase
|
|
239
239
|
};
|
|
240
|
-
//# sourceMappingURL=chunk-
|
|
240
|
+
//# sourceMappingURL=chunk-I4ITMOIV.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FsTmp
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QKZIGBLD.js";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -162,4 +162,4 @@ var FsFetch = class extends FsTmp {
|
|
|
162
162
|
export {
|
|
163
163
|
FsFetch
|
|
164
164
|
};
|
|
165
|
-
//# sourceMappingURL=chunk-
|
|
165
|
+
//# sourceMappingURL=chunk-MUFEXR25.js.map
|
|
@@ -20,8 +20,11 @@ var extMimeMap = {
|
|
|
20
20
|
bmp: ["image/bmp"],
|
|
21
21
|
bz: ["application/x-bzip"],
|
|
22
22
|
bz2: ["application/x-bzip2"],
|
|
23
|
+
c: ["text/x-c"],
|
|
23
24
|
cda: ["application/x-cdf"],
|
|
24
|
-
cjs: ["
|
|
25
|
+
cjs: ["text/javascript", "application/node"],
|
|
26
|
+
cpp: ["text/x-c++"],
|
|
27
|
+
cs: ["text/x-csharp"],
|
|
25
28
|
csh: ["application/x-csh"],
|
|
26
29
|
css: ["text/css"],
|
|
27
30
|
csv: ["text/csv"],
|
|
@@ -47,12 +50,13 @@ var extMimeMap = {
|
|
|
47
50
|
ivs: ["haptics/ivs"],
|
|
48
51
|
ivt: ["haptics/ivs"],
|
|
49
52
|
jar: ["application/java-archive"],
|
|
53
|
+
java: ["text/x-java"],
|
|
50
54
|
jfif: ["image/jpeg"],
|
|
51
55
|
jif: ["image/jpeg"],
|
|
52
56
|
jpe: ["image/jpeg"],
|
|
53
57
|
jpeg: ["image/jpeg"],
|
|
54
58
|
jpg: ["image/jpeg"],
|
|
55
|
-
js: ["
|
|
59
|
+
js: ["text/javascript", "application/node"],
|
|
56
60
|
json: ["application/json"],
|
|
57
61
|
jsonld: ["application/ld+json"],
|
|
58
62
|
ktx: ["image/ktx"],
|
|
@@ -83,9 +87,10 @@ var extMimeMap = {
|
|
|
83
87
|
ogx: ["application/ogg"],
|
|
84
88
|
opus: ["audio/ogg"],
|
|
85
89
|
otf: ["font/otf"],
|
|
90
|
+
pk1: ["application/octet-stream"],
|
|
86
91
|
png: ["image/png"],
|
|
87
92
|
pdf: ["application/pdf"],
|
|
88
|
-
php: ["application/x-httpd-php"],
|
|
93
|
+
php: ["text/x-php", "application/x-httpd-php"],
|
|
89
94
|
pjp: ["image/jpeg"],
|
|
90
95
|
pjpeg: ["image/jpeg"],
|
|
91
96
|
pkpass: ["application/vnd.apple.pkpass"],
|
|
@@ -93,9 +98,10 @@ var extMimeMap = {
|
|
|
93
98
|
pptx: [
|
|
94
99
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
95
100
|
],
|
|
96
|
-
py: ["text/x-python"],
|
|
101
|
+
py: ["text/x-python", "text/x-script.python"],
|
|
97
102
|
pyc: ["application/x-python-code"],
|
|
98
103
|
rar: ["application/vnd.rar"],
|
|
104
|
+
rb: ["text/x-ruby"],
|
|
99
105
|
rs: ["text/rust"],
|
|
100
106
|
rtf: ["application/rtf"],
|
|
101
107
|
sh: ["application/x-sh"],
|
|
@@ -103,10 +109,16 @@ var extMimeMap = {
|
|
|
103
109
|
sse: ["text/event-stream"],
|
|
104
110
|
svg: ["image/svg+xml"],
|
|
105
111
|
tar: ["application/x-tar"],
|
|
112
|
+
tex: ["text/x-tex"],
|
|
106
113
|
tif: ["image/tiff"],
|
|
107
114
|
tiff: ["image/tiff"],
|
|
108
115
|
toml: ["application/toml"],
|
|
109
|
-
ts: [
|
|
116
|
+
ts: [
|
|
117
|
+
"text/typescript",
|
|
118
|
+
"application/typescript",
|
|
119
|
+
"video/mp2t",
|
|
120
|
+
"video/vnd.dlna.mpeg-tts"
|
|
121
|
+
],
|
|
110
122
|
ttf: ["application/font-sfnt", "font/ttf"],
|
|
111
123
|
txt: ["text/plain"],
|
|
112
124
|
usdz: ["model/vnd.usdz+zip"],
|
|
@@ -238,7 +250,15 @@ var mimeToExt = {
|
|
|
238
250
|
"text/typescript": ["ts"],
|
|
239
251
|
"text/vtt": ["vtt"],
|
|
240
252
|
"text/xml": ["xml"],
|
|
253
|
+
"text/x-c": ["c"],
|
|
254
|
+
"text/x-csharp": ["cs"],
|
|
255
|
+
"text/x-c++": ["cpp"],
|
|
256
|
+
"text/x-java": ["java"],
|
|
257
|
+
"text/x-php": ["php"],
|
|
241
258
|
"text/x-python": ["py"],
|
|
259
|
+
"text/x-ruby": ["rb"],
|
|
260
|
+
"text/x-script.python": ["py"],
|
|
261
|
+
"text/x-tex": ["tex"],
|
|
242
262
|
"video/3gpp": ["3gp"],
|
|
243
263
|
"video/3gpp2": ["3g2"],
|
|
244
264
|
"video/mp2t": ["ts"],
|
|
@@ -334,4 +354,4 @@ export {
|
|
|
334
354
|
mimeToExt,
|
|
335
355
|
MimeService
|
|
336
356
|
};
|
|
337
|
-
//# sourceMappingURL=chunk-
|
|
357
|
+
//# sourceMappingURL=chunk-PHTZ7NRL.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FsCore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CTSJFQMC.js";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -364,4 +364,4 @@ var FsTmp = class extends FsCore {
|
|
|
364
364
|
export {
|
|
365
365
|
FsTmp
|
|
366
366
|
};
|
|
367
|
-
//# sourceMappingURL=chunk-
|
|
367
|
+
//# sourceMappingURL=chunk-QKZIGBLD.js.map
|