filens-preview 0.1.4 → 0.3.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/README.md +152 -30
- package/dist/all-in-one/THIRD-PARTY-NOTICES.txt +969 -0
- package/dist/all-in-one/archive/7zz.wasm +0 -0
- package/dist/all-in-one/assets/archive-worker-Cy3bEdVg.js +2 -0
- package/dist/all-in-one/filens.js +71714 -63448
- package/dist/all-in-one/index.html +12 -3
- package/dist/index.d.ts +9 -0
- package/dist/split/THIRD-PARTY-NOTICES.txt +969 -0
- package/dist/split/archive/7zz.wasm +0 -0
- package/dist/split/assets/archive-worker-Cy3bEdVg.js +2 -0
- package/dist/split/assets/iwork-worker-B9KPoDW3.js +27 -0
- package/dist/split/chunks/archive-B4jVwD9o.js +921 -0
- package/dist/split/chunks/{cad-CsU3TiHK.js → cad-DMg-lGJX.js} +1 -1
- package/dist/split/chunks/{core-BvtuMqS1.js → core--zVW212C.js} +4692 -4213
- package/dist/split/chunks/{diagram-BxRNHzmO.js → diagram-CDwCA6LZ.js} +2 -2
- package/dist/split/chunks/{docx-Ch1AvEUX.js → docx-CuQfFJqr.js} +2 -2
- package/dist/split/chunks/{ebook-P42eILp5.js → ebook-CLlJ8KX3.js} +2 -2
- package/dist/split/chunks/{iwork-HnghW_EB.js → iwork-dNVC0X8j.js} +57 -57
- package/dist/split/chunks/media-runtime-gcsBQMuo.js +48 -0
- package/dist/split/chunks/{mindmap-vFlOJSIq.js → mindmap-g0-VoK-K.js} +2 -2
- package/dist/split/chunks/{model3d-DoNu7iyY.js → model3d-1G1CC52V.js} +3 -3
- package/dist/split/chunks/{panorama-Bw_8HQsv.js → panorama-D7GVivtM.js} +1005 -989
- package/dist/split/chunks/{vendor-Cv2Fxtsf.js → vendor-DPFNKNkh.js} +27630 -22859
- package/dist/split/chunks/{xlsx-ypLtJxeq.js → xlsx-Co26yo-R.js} +2 -2
- package/dist/split/converter-core.wasm +0 -0
- package/dist/split/converter-office.wasm +0 -0
- package/dist/split/filens.js +4133 -1301
- package/dist/split/index.html +12 -3
- package/package.json +2 -2
- package/dist/split/assets/iwork-worker-D64s_rsm.js +0 -34
- package/dist/split/chunks/archive-Drem4a-o.js +0 -731
- package/dist/split/chunks/media-runtime-kbzoW8bd.js +0 -48
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var A = (t, e, i) =>
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
var ko = Object.defineProperty;
|
|
2
|
+
var Ro = (t, e, i) => e in t ? ko(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
|
+
var A = (t, e, i) => Ro(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { w as kn, c as Po, x as Ao } from "./core--zVW212C.js";
|
|
5
|
+
import { ac as Lo, S as Ji, ad as Ft, ae as Ta, af as ka, ag as Ra, ah as Ki, j as Zi, ai as _o, aj as Pa, ak as Rn, m as Uo, o as Eo, a9 as Co, al as Yr, w as Io } from "./vendor-DPFNKNkh.js";
|
|
6
6
|
function Se(t) {
|
|
7
|
-
if (t != null && t.aborted) throw
|
|
7
|
+
if (t != null && t.aborted) throw Pn();
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function Pn() {
|
|
10
10
|
return Object.assign(new Error("The conversion was aborted."), { name: "AbortError" });
|
|
11
11
|
}
|
|
12
12
|
function wt(t, e) {
|
|
13
13
|
return e ? new Promise((i, n) => {
|
|
14
|
-
const r = () => n(
|
|
14
|
+
const r = () => n(Pn());
|
|
15
15
|
t.then(
|
|
16
16
|
(o) => {
|
|
17
17
|
e.removeEventListener("abort", r), i(o);
|
|
@@ -22,7 +22,7 @@ function wt(t, e) {
|
|
|
22
22
|
), e.aborted ? r() : e.addEventListener("abort", r, { once: !0 });
|
|
23
23
|
}) : t;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function Aa(t) {
|
|
26
26
|
let e;
|
|
27
27
|
return () => {
|
|
28
28
|
if (!e) {
|
|
@@ -34,28 +34,28 @@ function Pa(t) {
|
|
|
34
34
|
return e;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function zo(t) {
|
|
38
38
|
return /^(?:https?:|blob:|\/|\.{1,2}\/)/i.test(t);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Bo(t) {
|
|
41
41
|
return t.trimStart().toLowerCase().startsWith("data:");
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function jo(t) {
|
|
44
44
|
const e = atob(t), i = new Uint8Array(e.length);
|
|
45
45
|
for (let n = 0; n < i.length; n++) i[n] = e.charCodeAt(n);
|
|
46
46
|
return i;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function No(t) {
|
|
49
49
|
var c;
|
|
50
50
|
const e = t.trimStart(), i = e.indexOf(",");
|
|
51
51
|
if (i < 0) throw new Error("Conversion data URL is missing its payload separator.");
|
|
52
52
|
const n = e.slice(0, i), r = e.slice(i + 1), o = (c = n.match(/^data:([^;,]+)/i)) == null ? void 0 : c[1];
|
|
53
|
-
if (/;base64$/i.test(n)) return { bytes:
|
|
53
|
+
if (/;base64$/i.test(n)) return { bytes: jo(r), contentType: o };
|
|
54
54
|
const s = new TextEncoder().encode(r);
|
|
55
55
|
let a = 0;
|
|
56
56
|
for (let l = 0; l < s.length; l++) {
|
|
57
57
|
if (s[l] === 37) {
|
|
58
|
-
const u =
|
|
58
|
+
const u = Qr(s[l + 1]), f = Qr(s[l + 2]);
|
|
59
59
|
if (u >= 0 && f >= 0) {
|
|
60
60
|
s[a++] = u << 4 | f, l += 2;
|
|
61
61
|
continue;
|
|
@@ -65,22 +65,22 @@ function Bo(t) {
|
|
|
65
65
|
}
|
|
66
66
|
return { bytes: s.subarray(0, a), contentType: o };
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Qr(t) {
|
|
69
69
|
if (t >= 48 && t <= 57) return t - 48;
|
|
70
70
|
const e = t | 32;
|
|
71
71
|
return e >= 97 && e <= 102 ? e - 87 : -1;
|
|
72
72
|
}
|
|
73
|
-
async function
|
|
74
|
-
if (
|
|
73
|
+
async function An(t, e = globalThis.fetch, i) {
|
|
74
|
+
if (Oo(t))
|
|
75
75
|
return new Uint8Array(await wt(t.arrayBuffer(), i));
|
|
76
76
|
if (t instanceof ArrayBuffer)
|
|
77
77
|
return new Uint8Array(t);
|
|
78
78
|
if (ArrayBuffer.isView(t))
|
|
79
79
|
return new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
80
80
|
if (typeof t == "string") {
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
83
|
-
if (
|
|
81
|
+
if (Bo(t))
|
|
82
|
+
return No(t).bytes;
|
|
83
|
+
if (zo(t)) {
|
|
84
84
|
if (!e) throw new Error("A fetch implementation is required to load a conversion source URL.");
|
|
85
85
|
const n = await wt(e(t, { signal: i }), i);
|
|
86
86
|
if (Se(i), !n.ok)
|
|
@@ -91,15 +91,25 @@ async function Rn(t, e = globalThis.fetch, i) {
|
|
|
91
91
|
}
|
|
92
92
|
throw new Error("Unsupported conversion source type.");
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Oo(t) {
|
|
95
95
|
return typeof t == "object" && t !== null && "arrayBuffer" in t && typeof t.arrayBuffer == "function";
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
97
|
+
async function Vo(t) {
|
|
98
|
+
var i;
|
|
99
|
+
if (((i = t.headers.get("content-type")) == null ? void 0 : i.split(";", 1)[0]) !== "application/wasm+gzip") return t;
|
|
100
|
+
if (typeof DecompressionStream < "u" && t.body)
|
|
101
|
+
return new Response(t.body.pipeThrough(new DecompressionStream("gzip")), {
|
|
102
|
+
headers: { "content-type": "application/wasm" }
|
|
103
|
+
});
|
|
104
|
+
const e = Lo(new Uint8Array(await t.arrayBuffer()));
|
|
105
|
+
return new Response(e, { headers: { "content-type": "application/wasm" } });
|
|
106
|
+
}
|
|
107
|
+
function wi(t) {
|
|
108
|
+
const e = Aa(() => Ln(t.wasm, t.fetch));
|
|
99
109
|
return async (i) => {
|
|
100
110
|
const n = i.signal;
|
|
101
111
|
Se(n);
|
|
102
|
-
const r = new
|
|
112
|
+
const r = new En({
|
|
103
113
|
args: i.args,
|
|
104
114
|
files: i.files,
|
|
105
115
|
captureStdio: i.captureStdio
|
|
@@ -113,7 +123,7 @@ function $i(t) {
|
|
|
113
123
|
try {
|
|
114
124
|
s.exports._start();
|
|
115
125
|
} catch (c) {
|
|
116
|
-
if (c instanceof
|
|
126
|
+
if (c instanceof _n)
|
|
117
127
|
a = c.code;
|
|
118
128
|
else
|
|
119
129
|
throw c;
|
|
@@ -128,32 +138,34 @@ function $i(t) {
|
|
|
128
138
|
};
|
|
129
139
|
};
|
|
130
140
|
}
|
|
131
|
-
async function
|
|
141
|
+
async function Ln(t, e = globalThis.fetch) {
|
|
132
142
|
const i = typeof t == "function" ? await t() : await t;
|
|
133
143
|
if (i instanceof WebAssembly.Module)
|
|
134
144
|
return i;
|
|
135
|
-
if (typeof i == "string" ||
|
|
145
|
+
if (typeof i == "string" || Wo(i)) {
|
|
136
146
|
if (!e)
|
|
137
147
|
throw new Error("A fetch implementation is required to load converter WASM from a URL.");
|
|
138
|
-
return
|
|
148
|
+
return Hr(await e(String(i)));
|
|
139
149
|
}
|
|
140
|
-
return typeof Response < "u" && i instanceof Response ?
|
|
150
|
+
return typeof Response < "u" && i instanceof Response ? Hr(i) : WebAssembly.compile(i);
|
|
141
151
|
}
|
|
142
|
-
function
|
|
152
|
+
function Wo(t) {
|
|
143
153
|
return typeof URL < "u" && t instanceof URL;
|
|
144
154
|
}
|
|
145
|
-
async function
|
|
155
|
+
async function Hr(t) {
|
|
156
|
+
var i;
|
|
146
157
|
if (!t.ok)
|
|
147
158
|
throw new Error(`Failed to fetch converter WASM: ${t.status} ${t.statusText}`.trim());
|
|
148
|
-
|
|
159
|
+
const e = await Vo(t);
|
|
160
|
+
return typeof WebAssembly.compileStreaming == "function" && ((i = e.headers.get("content-type")) == null ? void 0 : i.split(";", 1)[0]) === "application/wasm" ? WebAssembly.compileStreaming(e) : WebAssembly.compile(await e.arrayBuffer());
|
|
149
161
|
}
|
|
150
|
-
class
|
|
162
|
+
class _n extends Error {
|
|
151
163
|
constructor(e) {
|
|
152
164
|
super(`WASI exited with code ${e}`), this.code = e;
|
|
153
165
|
}
|
|
154
166
|
}
|
|
155
|
-
const Q = 0, ge = 8,
|
|
156
|
-
class
|
|
167
|
+
const Q = 0, ge = 8, qo = 20, Jr = 28, hi = 31, mi = 44, Kr = 54, pa = 55, Un = 2, ba = 3, wa = 4, Zr = 1, Go = 2, Xo = 4, $o = 8, en = 1;
|
|
168
|
+
class En {
|
|
157
169
|
constructor(e) {
|
|
158
170
|
A(this, "imports", {
|
|
159
171
|
args_get: (e, i) => this.argsGet(e, i),
|
|
@@ -179,7 +191,7 @@ class _n {
|
|
|
179
191
|
path_unlink_file: (e, i, n) => this.pathUnlinkFile(e, i, n),
|
|
180
192
|
poll_oneoff: (e, i, n, r) => this.pollOneoff(r),
|
|
181
193
|
proc_exit: (e) => {
|
|
182
|
-
throw new
|
|
194
|
+
throw new _n(e);
|
|
183
195
|
},
|
|
184
196
|
random_get: (e, i) => this.randomGet(e, i),
|
|
185
197
|
sched_yield: () => Q
|
|
@@ -208,14 +220,14 @@ class _n {
|
|
|
208
220
|
return new TextDecoder().decode(new Uint8Array(this.stdio[e]));
|
|
209
221
|
}
|
|
210
222
|
readFile(e) {
|
|
211
|
-
const i = this.files.get(
|
|
223
|
+
const i = this.files.get(qt(e));
|
|
212
224
|
if (!i)
|
|
213
225
|
throw new Error(`WASM file was not written: ${e}`);
|
|
214
226
|
const n = new Uint8Array(i.byteLength);
|
|
215
227
|
return n.set(i), n;
|
|
216
228
|
}
|
|
217
229
|
readFileIfPresent(e) {
|
|
218
|
-
return this.files.has(
|
|
230
|
+
return this.files.has(qt(e)) ? this.readFile(e) : void 0;
|
|
219
231
|
}
|
|
220
232
|
get memory() {
|
|
221
233
|
var i;
|
|
@@ -231,7 +243,7 @@ class _n {
|
|
|
231
243
|
return new DataView(this.memory.buffer);
|
|
232
244
|
}
|
|
233
245
|
argsSizesGet(e, i) {
|
|
234
|
-
return this.view.setUint32(e, this.args.length, !0), this.view.setUint32(i,
|
|
246
|
+
return this.view.setUint32(e, this.args.length, !0), this.view.setUint32(i, Yo(this.args), !0), Q;
|
|
235
247
|
}
|
|
236
248
|
argsGet(e, i) {
|
|
237
249
|
return this.writeStringList(this.args, e, i);
|
|
@@ -247,12 +259,12 @@ class _n {
|
|
|
247
259
|
}
|
|
248
260
|
fdFdstatGet(e, i) {
|
|
249
261
|
const n = this.fds.get(e);
|
|
250
|
-
return n ? (this.bytes.fill(0, i, i + 24), this.bytes[i] =
|
|
262
|
+
return n ? (this.bytes.fill(0, i, i + 24), this.bytes[i] = Qo(n), this.view.setBigUint64(i + 8, 0xffffffffffffffffn, !0), this.view.setBigUint64(i + 16, 0xffffffffffffffffn, !0), Q) : ge;
|
|
251
263
|
}
|
|
252
264
|
fdFilestatGet(e, i) {
|
|
253
265
|
var r;
|
|
254
266
|
const n = this.fds.get(e);
|
|
255
|
-
return n ? n.kind === "file" ? (this.writeFilestat(i,
|
|
267
|
+
return n ? n.kind === "file" ? (this.writeFilestat(i, wa, ((r = this.files.get(n.path)) == null ? void 0 : r.byteLength) ?? 0), Q) : n.kind === "dir" ? (this.writeFilestat(i, ba, 0), Q) : (this.writeFilestat(i, Un, 0), Q) : ge;
|
|
256
268
|
}
|
|
257
269
|
fdPrestatGet(e, i) {
|
|
258
270
|
const n = this.fds.get(e);
|
|
@@ -285,9 +297,9 @@ class _n {
|
|
|
285
297
|
const o = this.fds.get(e);
|
|
286
298
|
if (!o || o.kind !== "file")
|
|
287
299
|
return (o == null ? void 0 : o.kind) === "dir" ? hi : ge;
|
|
288
|
-
if (n !== 0 && n !== 1 && n !== 2) return
|
|
300
|
+
if (n !== 0 && n !== 1 && n !== 2) return Jr;
|
|
289
301
|
const a = (n === 0 ? 0 : n === 1 ? o.position : n === 2 ? ((c = this.files.get(o.path)) == null ? void 0 : c.byteLength) ?? 0 : -1) + Number(i);
|
|
290
|
-
return !Number.isSafeInteger(a) || a < 0 ?
|
|
302
|
+
return !Number.isSafeInteger(a) || a < 0 ? Jr : (o.position = a, this.view.setBigUint64(r, BigInt(a), !0), Q);
|
|
291
303
|
}
|
|
292
304
|
fdTell(e, i) {
|
|
293
305
|
const n = this.fds.get(e);
|
|
@@ -319,26 +331,26 @@ class _n {
|
|
|
319
331
|
}
|
|
320
332
|
pathCreateDirectory(e, i, n) {
|
|
321
333
|
const r = this.readPath(e, i, n);
|
|
322
|
-
return r ? (this.ensureParentDir(r), this.files.has(r) ?
|
|
334
|
+
return r ? (this.ensureParentDir(r), this.files.has(r) ? Kr : (this.dirs.add(r), Q)) : ge;
|
|
323
335
|
}
|
|
324
336
|
pathFilestatGet(e, i, n, r) {
|
|
325
337
|
var s;
|
|
326
338
|
const o = this.readPath(e, i, n);
|
|
327
|
-
return o ? this.files.has(o) ? (this.writeFilestat(r,
|
|
339
|
+
return o ? this.files.has(o) ? (this.writeFilestat(r, wa, ((s = this.files.get(o)) == null ? void 0 : s.byteLength) ?? 0), Q) : this.dirs.has(o) ? (this.writeFilestat(r, ba, 0), Q) : mi : ge;
|
|
328
340
|
}
|
|
329
341
|
pathOpen(e, i, n, r, o, s) {
|
|
330
342
|
var l;
|
|
331
343
|
const a = this.readPath(e, i, n);
|
|
332
344
|
if (!a)
|
|
333
345
|
return ge;
|
|
334
|
-
if (r &
|
|
335
|
-
return
|
|
336
|
-
if (!!(r &
|
|
337
|
-
return this.dirs.has(a) ? this.openDescriptor({ kind: "dir", path: a, position: 0 }, s) : this.files.has(a) ?
|
|
346
|
+
if (r & Zr && r & Xo && (this.files.has(a) || this.dirs.has(a)))
|
|
347
|
+
return qo;
|
|
348
|
+
if (!!(r & Go))
|
|
349
|
+
return this.dirs.has(a) ? this.openDescriptor({ kind: "dir", path: a, position: 0 }, s) : this.files.has(a) ? Kr : mi;
|
|
338
350
|
if (this.files.has(a))
|
|
339
|
-
r &
|
|
351
|
+
r & $o && this.files.set(a, new Uint8Array());
|
|
340
352
|
else {
|
|
341
|
-
if (!(r &
|
|
353
|
+
if (!(r & Zr))
|
|
342
354
|
return this.dirs.has(a) ? hi : mi;
|
|
343
355
|
this.ensureParentDir(a), this.files.set(a, new Uint8Array());
|
|
344
356
|
}
|
|
@@ -346,8 +358,8 @@ class _n {
|
|
|
346
358
|
{
|
|
347
359
|
kind: "file",
|
|
348
360
|
path: a,
|
|
349
|
-
position: o &
|
|
350
|
-
append: !!(o &
|
|
361
|
+
position: o & en ? ((l = this.files.get(a)) == null ? void 0 : l.byteLength) ?? 0 : 0,
|
|
362
|
+
append: !!(o & en)
|
|
351
363
|
},
|
|
352
364
|
s
|
|
353
365
|
);
|
|
@@ -357,13 +369,13 @@ class _n {
|
|
|
357
369
|
if (!r)
|
|
358
370
|
return ge;
|
|
359
371
|
if (r === "/" || r === "/work")
|
|
360
|
-
return
|
|
372
|
+
return pa;
|
|
361
373
|
for (const o of this.dirs)
|
|
362
|
-
if (o !== r &&
|
|
363
|
-
return
|
|
374
|
+
if (o !== r && ya(o) === r)
|
|
375
|
+
return pa;
|
|
364
376
|
for (const o of this.files.keys())
|
|
365
|
-
if (
|
|
366
|
-
return
|
|
377
|
+
if (ya(o) === r)
|
|
378
|
+
return pa;
|
|
367
379
|
return this.dirs.delete(r) ? Q : mi;
|
|
368
380
|
}
|
|
369
381
|
pathUnlinkFile(e, i, n) {
|
|
@@ -403,7 +415,7 @@ class _n {
|
|
|
403
415
|
if (!r || r.kind !== "dir")
|
|
404
416
|
return null;
|
|
405
417
|
const o = new TextDecoder().decode(this.bytes.subarray(i, i + n));
|
|
406
|
-
return
|
|
418
|
+
return Ho(r.path, o);
|
|
407
419
|
}
|
|
408
420
|
openDescriptor(e, i) {
|
|
409
421
|
const n = this.nextFd++;
|
|
@@ -413,13 +425,13 @@ class _n {
|
|
|
413
425
|
this.bytes.fill(0, e, e + 64), this.bytes[e + 16] = i, this.view.setBigUint64(e + 24, 1n, !0), this.view.setBigUint64(e + 32, BigInt(n), !0);
|
|
414
426
|
}
|
|
415
427
|
writeInitialFile(e, i) {
|
|
416
|
-
const n =
|
|
428
|
+
const n = qt(e);
|
|
417
429
|
this.ensureParentDir(n);
|
|
418
430
|
const r = new Uint8Array(i.byteLength);
|
|
419
431
|
r.set(i), this.files.set(n, r);
|
|
420
432
|
}
|
|
421
433
|
ensureParentDir(e) {
|
|
422
|
-
const i =
|
|
434
|
+
const i = ya(e);
|
|
423
435
|
i === e || this.dirs.has(i) || (this.ensureParentDir(i), this.dirs.add(i));
|
|
424
436
|
}
|
|
425
437
|
writeFileChunk(e, i) {
|
|
@@ -435,23 +447,23 @@ class _n {
|
|
|
435
447
|
s.set(i, r), this.files.set(e.path, s), e.position = r + i.byteLength;
|
|
436
448
|
}
|
|
437
449
|
}
|
|
438
|
-
function
|
|
450
|
+
function Yo(t) {
|
|
439
451
|
return t.reduce((e, i) => e + new TextEncoder().encode(i).byteLength + 1, 0);
|
|
440
452
|
}
|
|
441
|
-
function
|
|
453
|
+
function Qo(t) {
|
|
442
454
|
switch (t.kind) {
|
|
443
455
|
case "dir":
|
|
444
|
-
return xa;
|
|
445
|
-
case "file":
|
|
446
456
|
return ba;
|
|
457
|
+
case "file":
|
|
458
|
+
return wa;
|
|
447
459
|
default:
|
|
448
|
-
return
|
|
460
|
+
return Un;
|
|
449
461
|
}
|
|
450
462
|
}
|
|
451
|
-
function
|
|
452
|
-
return e.startsWith("/") ?
|
|
463
|
+
function Ho(t, e) {
|
|
464
|
+
return e.startsWith("/") ? qt(e) : qt(`${t}/${e}`);
|
|
453
465
|
}
|
|
454
|
-
function
|
|
466
|
+
function qt(t) {
|
|
455
467
|
const e = [];
|
|
456
468
|
for (const i of t.replace(/\\/g, "/").split("/"))
|
|
457
469
|
if (!(!i || i === ".")) {
|
|
@@ -463,14 +475,14 @@ function Gt(t) {
|
|
|
463
475
|
}
|
|
464
476
|
return `/${e.join("/")}`;
|
|
465
477
|
}
|
|
466
|
-
function
|
|
467
|
-
const e =
|
|
478
|
+
function ya(t) {
|
|
479
|
+
const e = qt(t);
|
|
468
480
|
if (e === "/")
|
|
469
481
|
return "/";
|
|
470
482
|
const i = e.lastIndexOf("/");
|
|
471
483
|
return i <= 0 ? "/" : e.slice(0, i);
|
|
472
484
|
}
|
|
473
|
-
const
|
|
485
|
+
const Jo = [
|
|
474
486
|
{
|
|
475
487
|
sourceFormat: "dng",
|
|
476
488
|
targetFormat: "jpg"
|
|
@@ -563,85 +575,89 @@ const Yo = [
|
|
|
563
575
|
sourceFormat: "icns",
|
|
564
576
|
targetFormat: "png"
|
|
565
577
|
}
|
|
566
|
-
],
|
|
567
|
-
|
|
568
|
-
),
|
|
569
|
-
|
|
578
|
+
], Ko = new Set(
|
|
579
|
+
kn.map((t) => ut(t.sourceFormat))
|
|
580
|
+
), Zo = new Set(
|
|
581
|
+
kn.map(
|
|
570
582
|
(t) => `${ut(t.sourceFormat)}->${ut(t.targetFormat)}`
|
|
571
583
|
)
|
|
572
|
-
),
|
|
573
|
-
|
|
584
|
+
), es = new Set(
|
|
585
|
+
Jo.map(
|
|
574
586
|
(t) => `${ut(t.sourceFormat)}->${ut(t.targetFormat)}`
|
|
575
587
|
)
|
|
576
588
|
);
|
|
577
|
-
class
|
|
589
|
+
class Qi extends Error {
|
|
578
590
|
constructor(e) {
|
|
579
591
|
super(e.errorMessage || e.errorCode || "WASM conversion failed."), this.result = e, this.name = "WasmConversionError";
|
|
580
592
|
}
|
|
581
593
|
}
|
|
582
|
-
function
|
|
583
|
-
const e =
|
|
594
|
+
function Yc(t) {
|
|
595
|
+
const e = wi(t), i = t.officeWasm ? wi({ wasm: t.officeWasm, fetch: t.fetch }) : void 0, n = t.imageWasm ? Aa(() => Ln(t.imageWasm, t.fetch)) : void 0, r = t.imageWasm ? wi({ wasm: n, fetch: t.fetch }) : void 0, o = n ? ts(n) : void 0;
|
|
584
596
|
return {
|
|
585
|
-
async convert(
|
|
586
|
-
Se(
|
|
587
|
-
const
|
|
588
|
-
Se(
|
|
589
|
-
const
|
|
590
|
-
...
|
|
591
|
-
...
|
|
592
|
-
}),
|
|
593
|
-
if (
|
|
594
|
-
const
|
|
595
|
-
if (Se(
|
|
597
|
+
async convert(s, a) {
|
|
598
|
+
Se(a.signal);
|
|
599
|
+
const c = ut(s.sourceFormat), l = ut(s.targetFormat), u = is(c, l), f = `/work/input.${c}`, y = `/work/output.${l}`, p = "/work/options.json", h = "/work/result.json", d = await An(s.source, t.fetch, a.signal);
|
|
600
|
+
Se(a.signal);
|
|
601
|
+
const m = JSON.stringify({
|
|
602
|
+
...s.password ? { password: s.password } : {},
|
|
603
|
+
...s.locale ? { locale: s.locale } : {}
|
|
604
|
+
}), g = !!(r && es.has(u));
|
|
605
|
+
if (g && l === "jpg" && o) {
|
|
606
|
+
const D = await o(d, a.signal);
|
|
607
|
+
if (Se(a.signal), D) return D;
|
|
596
608
|
}
|
|
597
|
-
const b =
|
|
609
|
+
const b = g ? r : e, x = (D, F) => D({
|
|
598
610
|
args: [
|
|
599
|
-
|
|
611
|
+
g ? "converter-image" : "converter-core",
|
|
600
612
|
"--input",
|
|
601
|
-
u,
|
|
602
|
-
"--output",
|
|
603
613
|
f,
|
|
614
|
+
"--output",
|
|
615
|
+
y,
|
|
604
616
|
"--source",
|
|
605
|
-
a,
|
|
606
|
-
"--target",
|
|
607
617
|
c,
|
|
618
|
+
"--target",
|
|
619
|
+
l,
|
|
608
620
|
"--options",
|
|
609
|
-
|
|
621
|
+
p,
|
|
610
622
|
"--result",
|
|
611
|
-
|
|
623
|
+
h
|
|
612
624
|
],
|
|
613
625
|
files: {
|
|
614
|
-
[
|
|
615
|
-
[
|
|
626
|
+
[f]: F,
|
|
627
|
+
[p]: new TextEncoder().encode(m)
|
|
616
628
|
},
|
|
617
|
-
readFiles: [
|
|
618
|
-
signal:
|
|
629
|
+
readFiles: [h, y],
|
|
630
|
+
signal: a.signal
|
|
619
631
|
});
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
});
|
|
631
|
-
return {
|
|
632
|
-
source: b.files[f],
|
|
633
|
-
format: ut(x.targetFormat || c),
|
|
634
|
-
contentType: x.contentType,
|
|
635
|
-
warnings: x.warnings
|
|
632
|
+
let v = await x(b, d), w = $i(v.files[h]);
|
|
633
|
+
if (!w.ok && w.errorCode === "engine_unavailable" && w.requiredModule === "office" && i) {
|
|
634
|
+
const D = await x(i, d);
|
|
635
|
+
tn($i(D.files[h]), D.exitCode), v = await x(e, D.files[y]), w = $i(v.files[h]);
|
|
636
|
+
}
|
|
637
|
+
return Se(a.signal), tn(w, v.exitCode), {
|
|
638
|
+
source: v.files[y],
|
|
639
|
+
format: ut(w.targetFormat || l),
|
|
640
|
+
contentType: w.contentType,
|
|
641
|
+
warnings: w.warnings
|
|
636
642
|
};
|
|
637
643
|
}
|
|
638
644
|
};
|
|
639
645
|
}
|
|
640
|
-
function
|
|
641
|
-
|
|
646
|
+
function tn(t, e) {
|
|
647
|
+
if (!t.ok) throw new Qi(t);
|
|
648
|
+
if (e !== 0)
|
|
649
|
+
throw new Qi({
|
|
650
|
+
...t,
|
|
651
|
+
ok: !1,
|
|
652
|
+
errorCode: t.errorCode || "conversion_failed",
|
|
653
|
+
errorMessage: t.errorMessage || `converter WASM exited with code ${e}`
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
function ts(t) {
|
|
657
|
+
const e = Aa(async () => {
|
|
642
658
|
const i = await t(), n = new Set(WebAssembly.Module.exports(i).map((s) => s.name));
|
|
643
659
|
if (!["filens_image_alloc", "filens_image_free", "filens_image_preview", "memory"].every((s) => n.has(s))) return null;
|
|
644
|
-
const r = new
|
|
660
|
+
const r = new En({ args: ["converter-image"], files: {} }), o = await WebAssembly.instantiate(i, { wasi_snapshot_preview1: r.imports });
|
|
645
661
|
return r.setInstance(o), o.exports;
|
|
646
662
|
});
|
|
647
663
|
return async (i, n) => {
|
|
@@ -655,20 +671,20 @@ function Ko(t) {
|
|
|
655
671
|
if (s = Number(c & 0xffffffffn), a = Number(c >> 32n), !s || a < 4 || s + a > r.memory.buffer.byteLength) throw new Error("Image core returned an invalid preview buffer.");
|
|
656
672
|
const l = new Uint8Array(r.memory.buffer, s, a), u = new DataView(l.buffer, l.byteOffset, 4).getUint32(0, !0);
|
|
657
673
|
if (u > l.length - 4) throw new Error("Image core returned invalid preview metadata.");
|
|
658
|
-
const f =
|
|
659
|
-
if (!f.ok) throw new
|
|
674
|
+
const f = $i(l.subarray(4, 4 + u));
|
|
675
|
+
if (!f.ok) throw new Qi(f);
|
|
660
676
|
return { source: l.slice(4 + u), format: "jpg", contentType: f.contentType, warnings: f.warnings };
|
|
661
677
|
} finally {
|
|
662
678
|
s && a && r.filens_image_free(s, a), o && r.filens_image_free(o, i.length);
|
|
663
679
|
}
|
|
664
680
|
};
|
|
665
681
|
}
|
|
666
|
-
function
|
|
682
|
+
function is(t, e) {
|
|
667
683
|
const i = `${t}->${e}`;
|
|
668
|
-
if (
|
|
684
|
+
if (Zo.has(i))
|
|
669
685
|
return i;
|
|
670
|
-
const n =
|
|
671
|
-
throw new
|
|
686
|
+
const n = Ko.has(t) ? `unsupported conversion pair: ${t} -> ${e}` : `unsupported source format: ${t}`;
|
|
687
|
+
throw new Qi({
|
|
672
688
|
ok: !1,
|
|
673
689
|
sourceFormat: t,
|
|
674
690
|
targetFormat: e,
|
|
@@ -678,7 +694,7 @@ function Zo(t, e) {
|
|
|
678
694
|
metrics: {}
|
|
679
695
|
});
|
|
680
696
|
}
|
|
681
|
-
function
|
|
697
|
+
function $i(t) {
|
|
682
698
|
const e = new TextDecoder().decode(t), i = JSON.parse(e);
|
|
683
699
|
return {
|
|
684
700
|
...i,
|
|
@@ -688,16 +704,16 @@ function Un(t) {
|
|
|
688
704
|
function ut(t) {
|
|
689
705
|
return t.trim().replace(/^\./, "").toLowerCase();
|
|
690
706
|
}
|
|
691
|
-
function
|
|
707
|
+
function Qc() {
|
|
692
708
|
return {
|
|
693
709
|
async convert(t, e) {
|
|
694
710
|
const i = t.sourceFormat.replace(/^\./, "").toLowerCase(), n = t.targetFormat.replace(/^\./, "").toLowerCase();
|
|
695
711
|
if (!(["heic", "heif"].includes(i) && n === "png"))
|
|
696
712
|
throw new Error(`Unsupported media conversion: ${i} -> ${n}.`);
|
|
697
713
|
Se(e.signal);
|
|
698
|
-
const r = ArrayBuffer.isView(t.source) ? t.source.slice() : t.source instanceof ArrayBuffer ? t.source.slice(0) : t.source, o = await
|
|
714
|
+
const r = ArrayBuffer.isView(t.source) ? t.source.slice() : t.source instanceof ArrayBuffer ? t.source.slice(0) : t.source, o = await An(r, globalThis.fetch, e.signal);
|
|
699
715
|
Se(e.signal);
|
|
700
|
-
const s = await wt(import("./media-runtime-
|
|
716
|
+
const s = await wt(import("./media-runtime-gcsBQMuo.js"), e.signal);
|
|
701
717
|
return Se(e.signal), s.convertMedia(o, i, e.signal);
|
|
702
718
|
}
|
|
703
719
|
};
|
|
@@ -715,7 +731,7 @@ function le(t, e, i) {
|
|
|
715
731
|
});
|
|
716
732
|
});
|
|
717
733
|
}
|
|
718
|
-
function
|
|
734
|
+
function as(t, e) {
|
|
719
735
|
const i = (n) => (H(e), le(n(), e));
|
|
720
736
|
return {
|
|
721
737
|
open: (n, r) => i(() => t.open(n, { ...r, signal: e })),
|
|
@@ -733,14 +749,14 @@ function es(t, e) {
|
|
|
733
749
|
}
|
|
734
750
|
};
|
|
735
751
|
}
|
|
736
|
-
const
|
|
752
|
+
const an = 8, Mi = 64 << 20, rs = 128 << 20, rn = 120, ns = 8 << 20;
|
|
737
753
|
class B extends Error {
|
|
738
754
|
constructor(e, i) {
|
|
739
755
|
super(i), this.code = e, this.name = "PanoramaProcessorError";
|
|
740
756
|
}
|
|
741
757
|
}
|
|
742
|
-
function
|
|
743
|
-
const e = t.fetch ?? globalThis.fetch, i =
|
|
758
|
+
function os(t) {
|
|
759
|
+
const e = t.fetch ?? globalThis.fetch, i = wi({ wasm: t.wasm, fetch: e }), n = t.imageWasm ? wi({ wasm: t.imageWasm, fetch: e }) : void 0, r = (l) => {
|
|
744
760
|
const u = new AbortController(), f = pi(u.signal, l);
|
|
745
761
|
return { controller: u, ...f, companionTrackIds: /* @__PURE__ */ new Map() };
|
|
746
762
|
};
|
|
@@ -759,16 +775,16 @@ function as(t) {
|
|
|
759
775
|
const v = await l.companionProcessor.readSample(p, f, y);
|
|
760
776
|
return ie(y), { ...v, trackId: u };
|
|
761
777
|
}
|
|
762
|
-
const { reader:
|
|
763
|
-
if (!
|
|
764
|
-
const
|
|
765
|
-
if (!
|
|
766
|
-
const b = await
|
|
767
|
-
return { ...g, trackId: u, timescale:
|
|
778
|
+
const { reader: h, manifest: d } = l;
|
|
779
|
+
if (!h || !d) throw new B("invalid_manifest", "Open a panorama source before reading samples.");
|
|
780
|
+
const m = d.tracks.find((v) => v.id === u) ?? (((x = d.metadataTrack) == null ? void 0 : x.id) === u ? d.metadataTrack : void 0), g = m == null ? void 0 : m.samples[f];
|
|
781
|
+
if (!m || !g) throw new RangeError(`Unknown panorama sample ${u}:${f}.`);
|
|
782
|
+
const b = await h.read(g.offset, g.size, y);
|
|
783
|
+
return { ...g, trackId: u, timescale: m.timescale, data: b };
|
|
768
784
|
};
|
|
769
785
|
return {
|
|
770
786
|
async open(l, u) {
|
|
771
|
-
var
|
|
787
|
+
var h;
|
|
772
788
|
const f = r(u.signal), y = o;
|
|
773
789
|
o = f, s(y);
|
|
774
790
|
const p = f.signal;
|
|
@@ -776,12 +792,12 @@ function as(t) {
|
|
|
776
792
|
ie(p);
|
|
777
793
|
const d = await le(bt.open(l, e, p), p, (S) => S.close());
|
|
778
794
|
ie(p), f.reader = d;
|
|
779
|
-
let
|
|
795
|
+
let m;
|
|
780
796
|
const g = /* @__PURE__ */ new Map(), b = u.format === "insp" ? 1 << 20 : 65536, x = u.format === "insp" ? 65536 : 1 << 20, v = [
|
|
781
797
|
{ offset: 0, length: Math.min(b, d.size) },
|
|
782
798
|
{ offset: Math.max(0, d.size - x), length: Math.min(x, d.size) }
|
|
783
799
|
];
|
|
784
|
-
await
|
|
800
|
+
await on(d, g, v, p);
|
|
785
801
|
let w;
|
|
786
802
|
if (u.sidecar) {
|
|
787
803
|
const S = await bt.open(u.sidecar, e, p);
|
|
@@ -792,7 +808,7 @@ function as(t) {
|
|
|
792
808
|
S.close();
|
|
793
809
|
}
|
|
794
810
|
}
|
|
795
|
-
for (let S = 0; S <
|
|
811
|
+
for (let S = 0; S < an; S += 1) {
|
|
796
812
|
ie(p);
|
|
797
813
|
const D = [...g.values()].map((P, E) => ({
|
|
798
814
|
offset: P.offset,
|
|
@@ -818,42 +834,42 @@ function as(t) {
|
|
|
818
834
|
if (!_) throw new B("invalid_manifest", "Panorama inspector did not return a result.");
|
|
819
835
|
const k = JSON.parse(new TextDecoder().decode(_));
|
|
820
836
|
if (k.ok && k.payload) {
|
|
821
|
-
if (
|
|
822
|
-
f.companionProcessor =
|
|
837
|
+
if (m = cs(k.payload), u.companion) {
|
|
838
|
+
f.companionProcessor = os(t);
|
|
823
839
|
const P = await f.companionProcessor.open(u.companion, {
|
|
824
840
|
format: u.format,
|
|
825
841
|
sidecar: u.sidecar,
|
|
826
842
|
signal: p
|
|
827
843
|
});
|
|
828
844
|
ie(p);
|
|
829
|
-
const E = new Set(
|
|
845
|
+
const E = new Set(m.tracks.map((J) => J.id)), j = /* @__PURE__ */ new Map(), q = P.tracks.map((J) => {
|
|
830
846
|
let Z = J.id;
|
|
831
847
|
for (; E.has(Z); ) Z += 1e6;
|
|
832
848
|
return E.add(Z), f.companionTrackIds.set(Z, J.id), j.set(J.id, Z), { ...J, id: Z };
|
|
833
|
-
}),
|
|
849
|
+
}), G = P.lenses.map((J) => ({
|
|
834
850
|
...J,
|
|
835
851
|
sourceTrackId: J.sourceTrackId === void 0 ? void 0 : j.get(J.sourceTrackId)
|
|
836
|
-
})), te = [...
|
|
837
|
-
|
|
838
|
-
...
|
|
839
|
-
cameraModel:
|
|
840
|
-
firmware:
|
|
841
|
-
textureOrigin:
|
|
842
|
-
projection:
|
|
843
|
-
calibrationSource:
|
|
844
|
-
confidence:
|
|
852
|
+
})), te = [...m.tracks, ...q], ne = ds(us(m.lenses, G), te), ue = [...m.warnings, ...P.warnings];
|
|
853
|
+
m = {
|
|
854
|
+
...m,
|
|
855
|
+
cameraModel: m.cameraModel || P.cameraModel,
|
|
856
|
+
firmware: m.firmware || P.firmware,
|
|
857
|
+
textureOrigin: m.textureOrigin || P.textureOrigin,
|
|
858
|
+
projection: m.projection.kind === "unknown" ? P.projection : m.projection,
|
|
859
|
+
calibrationSource: m.calibrationSource === "unavailable" ? P.calibrationSource : m.calibrationSource,
|
|
860
|
+
confidence: m.confidence === "low" ? P.confidence : m.confidence,
|
|
845
861
|
tracks: te,
|
|
846
862
|
lenses: ne,
|
|
847
863
|
warnings: ne.length >= 2 ? ue.filter((J) => !J.includes("matching companion file") && !J.startsWith("INSV calibration was not found")) : ue
|
|
848
864
|
};
|
|
849
865
|
}
|
|
850
|
-
return f.manifest =
|
|
866
|
+
return f.manifest = m, m;
|
|
851
867
|
}
|
|
852
|
-
if (k.errorCode !== "need_ranges" || !((
|
|
853
|
-
throw
|
|
854
|
-
await
|
|
868
|
+
if (k.errorCode !== "need_ranges" || !((h = k.requiredRanges) != null && h.length))
|
|
869
|
+
throw ga(k.errorCode, k.errorMessage);
|
|
870
|
+
await on(d, g, k.requiredRanges, p);
|
|
855
871
|
}
|
|
856
|
-
throw new B("resource_limit", `Panorama inspection exceeded ${
|
|
872
|
+
throw new B("resource_limit", `Panorama inspection exceeded ${an} range iterations.`);
|
|
857
873
|
} catch (d) {
|
|
858
874
|
throw o === f && (o = r()), s(f), d;
|
|
859
875
|
}
|
|
@@ -863,19 +879,19 @@ function as(t) {
|
|
|
863
879
|
const u = o, f = pi(u.signal, l), y = f.signal;
|
|
864
880
|
try {
|
|
865
881
|
ie(y);
|
|
866
|
-
const
|
|
867
|
-
if (!
|
|
882
|
+
const h = u.reader, d = u.manifest;
|
|
883
|
+
if (!h || (d == null ? void 0 : d.format) !== "dng") throw new B("invalid_manifest", "Open a DNG before developing its RAW preview.");
|
|
868
884
|
if (!n) throw new B("codec_unsupported", "Calibrated DNG preview requires converter-image.wasm (imageWasm).");
|
|
869
|
-
if (
|
|
870
|
-
const
|
|
871
|
-
for (let w = 0; w <
|
|
872
|
-
const S = Math.min(
|
|
885
|
+
if (h.size > 256 * 1024 * 1024) throw new B("resource_limit", "RAW preview input exceeds 256 MiB.");
|
|
886
|
+
const m = new Uint8Array(h.size);
|
|
887
|
+
for (let w = 0; w < m.length; w += Mi) {
|
|
888
|
+
const S = Math.min(Mi, m.length - w), D = await h.read(w, S, y);
|
|
873
889
|
if (ie(y), D.length !== S) throw new B("range_unavailable", "DNG source returned an incomplete byte range.");
|
|
874
|
-
|
|
890
|
+
m.set(D, w);
|
|
875
891
|
}
|
|
876
892
|
const g = "/work/result.json", b = "/work/preview.jpg", x = await n({
|
|
877
893
|
args: ["converter-image", "--source", "dng", "--target", "jpg", "--input", "/work/input.dng", "--output", b, "--options", "/work/options.json", "--result", g],
|
|
878
|
-
files: { "/work/input.dng":
|
|
894
|
+
files: { "/work/input.dng": m, "/work/options.json": new TextEncoder().encode(JSON.stringify({ preserveSensorGeometry: !0 })) },
|
|
879
895
|
readFiles: [g, b],
|
|
880
896
|
signal: y
|
|
881
897
|
});
|
|
@@ -897,19 +913,19 @@ function as(t) {
|
|
|
897
913
|
}
|
|
898
914
|
},
|
|
899
915
|
async readImuWindow(l, u, f) {
|
|
900
|
-
var
|
|
916
|
+
var h;
|
|
901
917
|
const y = o, p = pi(y.signal, f);
|
|
902
918
|
try {
|
|
903
919
|
ie(p.signal);
|
|
904
920
|
const d = y.manifest;
|
|
905
921
|
if (!(d != null && d.metadataTrack)) return [];
|
|
906
|
-
if (!Number.isSafeInteger(l) || !Number.isSafeInteger(u) || l < 0 || u < 0 || u >
|
|
907
|
-
throw new B("resource_limit", `Panorama metadata windows are limited to ${
|
|
908
|
-
const
|
|
909
|
-
if (g.reduce((T, L) => T + L.size, 0) >
|
|
922
|
+
if (!Number.isSafeInteger(l) || !Number.isSafeInteger(u) || l < 0 || u < 0 || u > rn)
|
|
923
|
+
throw new B("resource_limit", `Panorama metadata windows are limited to ${rn} samples.`);
|
|
924
|
+
const m = d.metadataTrack, g = m.samples.slice(l, l + u);
|
|
925
|
+
if (g.reduce((T, L) => T + L.size, 0) > ns) throw new B("resource_limit", "Panorama metadata window exceeds 8 MiB.");
|
|
910
926
|
const x = {}, v = [];
|
|
911
927
|
for (let T = 0; T < g.length; T += 1) {
|
|
912
|
-
const L = await c(y,
|
|
928
|
+
const L = await c(y, m.id, l + T, p.signal), _ = `/work/metadata-${T}.bin`;
|
|
913
929
|
x[_] = L.data, v.push({ path: _, pts: L.pts, timescale: L.timescale });
|
|
914
930
|
}
|
|
915
931
|
const w = "/work/result.json";
|
|
@@ -924,7 +940,7 @@ function as(t) {
|
|
|
924
940
|
const D = S.files[w];
|
|
925
941
|
if (!D) throw new B("invalid_manifest", "Panorama metadata decoder did not return a result.");
|
|
926
942
|
const F = JSON.parse(new TextDecoder().decode(D));
|
|
927
|
-
if (!F.ok || !Array.isArray((
|
|
943
|
+
if (!F.ok || !Array.isArray((h = F.payload) == null ? void 0 : h.samples)) throw ga(F.errorCode, F.errorMessage);
|
|
928
944
|
return F.payload.samples;
|
|
929
945
|
} finally {
|
|
930
946
|
p.release();
|
|
@@ -932,7 +948,7 @@ function as(t) {
|
|
|
932
948
|
},
|
|
933
949
|
seek(l) {
|
|
934
950
|
const u = o.manifest;
|
|
935
|
-
return u ? Object.fromEntries(u.tracks.map((f) => [f.id,
|
|
951
|
+
return u ? Object.fromEntries(u.tracks.map((f) => [f.id, ls(f, l)])) : {};
|
|
936
952
|
},
|
|
937
953
|
async computeSeam(l, u) {
|
|
938
954
|
const f = pi(o.signal, u);
|
|
@@ -954,13 +970,13 @@ function as(t) {
|
|
|
954
970
|
signal: f.signal
|
|
955
971
|
});
|
|
956
972
|
ie(f.signal);
|
|
957
|
-
const
|
|
958
|
-
if (!
|
|
959
|
-
const d = JSON.parse(new TextDecoder().decode(
|
|
960
|
-
if (!d.ok || !d.payload) throw
|
|
961
|
-
const
|
|
962
|
-
if (!Array.isArray(
|
|
963
|
-
return
|
|
973
|
+
const h = p.files[y];
|
|
974
|
+
if (!h) throw new B("invalid_manifest", "Panorama seam solver did not return a result.");
|
|
975
|
+
const d = JSON.parse(new TextDecoder().decode(h));
|
|
976
|
+
if (!d.ok || !d.payload) throw ga(d.errorCode, d.errorMessage);
|
|
977
|
+
const m = d.payload;
|
|
978
|
+
if (!Array.isArray(m.seam) || !Number.isFinite(m.cost)) throw new B("invalid_manifest", "Panorama seam solver returned an invalid path.");
|
|
979
|
+
return m;
|
|
964
980
|
} finally {
|
|
965
981
|
f.release();
|
|
966
982
|
}
|
|
@@ -970,16 +986,16 @@ function as(t) {
|
|
|
970
986
|
getManifest: () => o.manifest
|
|
971
987
|
};
|
|
972
988
|
}
|
|
973
|
-
function
|
|
989
|
+
function Cn(t) {
|
|
974
990
|
return {
|
|
975
|
-
codec:
|
|
991
|
+
codec: fs(t),
|
|
976
992
|
codedWidth: t.width,
|
|
977
993
|
codedHeight: t.height,
|
|
978
|
-
description:
|
|
994
|
+
description: In(t.decoderConfig),
|
|
979
995
|
optimizeForLatency: !0
|
|
980
996
|
};
|
|
981
997
|
}
|
|
982
|
-
function
|
|
998
|
+
function ss(t) {
|
|
983
999
|
return new EncodedVideoChunk({
|
|
984
1000
|
type: t.key ? "key" : "delta",
|
|
985
1001
|
timestamp: Math.round(t.pts * 1e6 / t.timescale),
|
|
@@ -987,7 +1003,7 @@ function rs(t) {
|
|
|
987
1003
|
data: t.data
|
|
988
1004
|
});
|
|
989
1005
|
}
|
|
990
|
-
function
|
|
1006
|
+
function cs(t) {
|
|
991
1007
|
var r;
|
|
992
1008
|
if (!t || !Array.isArray(t.tracks) || !Array.isArray(t.lenses))
|
|
993
1009
|
throw new B("invalid_manifest", "Panorama inspector returned an invalid manifest.");
|
|
@@ -997,7 +1013,7 @@ function ns(t) {
|
|
|
997
1013
|
}));
|
|
998
1014
|
return { ...t, projection: i, lenses: n };
|
|
999
1015
|
}
|
|
1000
|
-
function
|
|
1016
|
+
function ls(t, e) {
|
|
1001
1017
|
const i = Math.max(0, e) * t.timescale;
|
|
1002
1018
|
let n = 0;
|
|
1003
1019
|
for (let r = 0; r < t.samples.length; r += 1) {
|
|
@@ -1007,24 +1023,24 @@ function os(t, e) {
|
|
|
1007
1023
|
}
|
|
1008
1024
|
return n;
|
|
1009
1025
|
}
|
|
1010
|
-
function
|
|
1011
|
-
const i = t.slice(0, 2), n = new Set(i.map(
|
|
1026
|
+
function us(t, e) {
|
|
1027
|
+
const i = t.slice(0, 2), n = new Set(i.map(nn));
|
|
1012
1028
|
for (const r of e) {
|
|
1013
1029
|
if (i.length === 2) break;
|
|
1014
|
-
const o =
|
|
1030
|
+
const o = nn(r);
|
|
1015
1031
|
n.has(o) || (i.push(r), n.add(o));
|
|
1016
1032
|
}
|
|
1017
1033
|
return i;
|
|
1018
1034
|
}
|
|
1019
|
-
function
|
|
1035
|
+
function ds(t, e) {
|
|
1020
1036
|
return e.length < t.length ? t : t.map((i, n) => i.sourceTrackId === void 0 ? { ...i, sourceTrackId: e[n].id } : i);
|
|
1021
1037
|
}
|
|
1022
|
-
function
|
|
1038
|
+
function nn(t) {
|
|
1023
1039
|
const e = { ...t };
|
|
1024
1040
|
return delete e.sourceTrackId, delete e.sourceRect, JSON.stringify(e);
|
|
1025
1041
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const e =
|
|
1042
|
+
function fs(t) {
|
|
1043
|
+
const e = In(t.decoderConfig);
|
|
1028
1044
|
if ((t.codec === "avc1" || t.codec === "avc3") && e.length >= 4)
|
|
1029
1045
|
return `${t.codec}.${[...e.slice(1, 4)].map((i) => i.toString(16).padStart(2, "0")).join("")}`;
|
|
1030
1046
|
if ((t.codec === "hvc1" || t.codec === "hev1") && e.length >= 13) {
|
|
@@ -1039,19 +1055,19 @@ function ls(t) {
|
|
|
1039
1055
|
}
|
|
1040
1056
|
return t.codec;
|
|
1041
1057
|
}
|
|
1042
|
-
function
|
|
1058
|
+
function In(t) {
|
|
1043
1059
|
return t ? Uint8Array.from(t.match(/.{1,2}/g) ?? [], (e) => Number.parseInt(e, 16)) : new Uint8Array();
|
|
1044
1060
|
}
|
|
1045
|
-
async function
|
|
1061
|
+
async function on(t, e, i, n) {
|
|
1046
1062
|
for (const r of i) {
|
|
1047
1063
|
const o = r.offset + r.length;
|
|
1048
|
-
if (!Number.isSafeInteger(r.offset) || !Number.isSafeInteger(r.length) || !Number.isSafeInteger(o) || r.offset < 0 || r.length <= 0 || r.length >
|
|
1064
|
+
if (!Number.isSafeInteger(r.offset) || !Number.isSafeInteger(r.length) || !Number.isSafeInteger(o) || r.offset < 0 || r.length <= 0 || r.length > Mi || o > t.size)
|
|
1049
1065
|
throw new B("resource_limit", "Panorama inspector requested an invalid source range.");
|
|
1050
1066
|
const s = [...e.values()].sort((u, f) => u.offset - f.offset), a = [];
|
|
1051
1067
|
let c = r.offset;
|
|
1052
1068
|
for (const u of s)
|
|
1053
1069
|
if (u.offset > c && a.push({ offset: c, length: Math.min(u.offset, o) - c }), c = Math.max(c, u.offset + u.bytes.length), c >= o) break;
|
|
1054
|
-
if (c < o && a.push({ offset: c, length: o - c }), s.reduce((u, f) => u + f.bytes.length, 0) + a.reduce((u, f) => u + f.length, 0) >
|
|
1070
|
+
if (c < o && a.push({ offset: c, length: o - c }), s.reduce((u, f) => u + f.bytes.length, 0) + a.reduce((u, f) => u + f.length, 0) > rs)
|
|
1055
1071
|
throw new B("resource_limit", "Panorama inspection exceeded its 128 MiB range budget.");
|
|
1056
1072
|
for (const u of a) {
|
|
1057
1073
|
const f = await t.read(u.offset, u.length, n);
|
|
@@ -1076,21 +1092,21 @@ class bt {
|
|
|
1076
1092
|
if (o.status === 206) {
|
|
1077
1093
|
const u = s == null ? void 0 : s.match(/^bytes 0-0\/(\d+)$/i), f = Number(u == null ? void 0 : u[1]);
|
|
1078
1094
|
if (gi(o), !Number.isSafeInteger(f) || f <= 0) throw new B("range_unavailable", "Remote panorama size is unavailable.");
|
|
1079
|
-
return new bt(f, async (y, p,
|
|
1080
|
-
var
|
|
1081
|
-
const d = await yi(i(r, { headers: { Range: `bytes=${y}-${y + p - 1}` }, signal:
|
|
1082
|
-
if (ie(
|
|
1095
|
+
return new bt(f, async (y, p, h) => {
|
|
1096
|
+
var m;
|
|
1097
|
+
const d = await yi(i(r, { headers: { Range: `bytes=${y}-${y + p - 1}` }, signal: h }), h, gi);
|
|
1098
|
+
if (ie(h), d.status !== 206 || ((m = d.headers.get("content-range")) == null ? void 0 : m.toLowerCase()) !== `bytes ${y}-${y + p - 1}/${f}`)
|
|
1083
1099
|
throw gi(d), new B("range_unavailable", "Remote server returned an inconsistent panorama byte range.");
|
|
1084
|
-
return new Uint8Array(await yi(d.arrayBuffer(),
|
|
1100
|
+
return new Uint8Array(await yi(d.arrayBuffer(), h));
|
|
1085
1101
|
});
|
|
1086
1102
|
}
|
|
1087
1103
|
const a = Number(o.headers.get("content-length"));
|
|
1088
|
-
if (!o.ok || !Number.isSafeInteger(a) || a <= 0 || a >
|
|
1104
|
+
if (!o.ok || !Number.isSafeInteger(a) || a <= 0 || a > Mi)
|
|
1089
1105
|
throw gi(o), new B("range_unavailable", "Remote server must support HTTP byte ranges for large panorama files.");
|
|
1090
1106
|
const c = new Uint8Array(await yi(o.arrayBuffer(), n));
|
|
1091
1107
|
ie(n);
|
|
1092
1108
|
const l = o.headers.get("content-encoding");
|
|
1093
|
-
if (!c.length || c.length >
|
|
1109
|
+
if (!c.length || c.length > Mi || (!l || l.toLowerCase() === "identity") && c.length !== a)
|
|
1094
1110
|
throw new B("range_unavailable", "Remote panorama body does not match its declared length or size limit.");
|
|
1095
1111
|
return new bt(c.byteLength, async (u, f) => c.slice(u, u + f));
|
|
1096
1112
|
}
|
|
@@ -1107,7 +1123,7 @@ class bt {
|
|
|
1107
1123
|
(e = this.cleanup) == null || e.call(this);
|
|
1108
1124
|
}
|
|
1109
1125
|
}
|
|
1110
|
-
function
|
|
1126
|
+
function ga(t, e) {
|
|
1111
1127
|
const i = {
|
|
1112
1128
|
range_unavailable: "range_unavailable",
|
|
1113
1129
|
resource_limit: "resource_limit",
|
|
@@ -1154,26 +1170,26 @@ function ie(t) {
|
|
|
1154
1170
|
if (t != null && t.aborted)
|
|
1155
1171
|
throw t.reason instanceof Error ? t.reason : new DOMException("The panorama operation was aborted.", "AbortError");
|
|
1156
1172
|
}
|
|
1157
|
-
async function
|
|
1158
|
-
var y, p,
|
|
1159
|
-
if (e.projection.kind !== "mei-extended" || !
|
|
1173
|
+
async function hs(t, e, i) {
|
|
1174
|
+
var y, p, h, d;
|
|
1175
|
+
if (e.projection.kind !== "mei-extended" || !ea(e))
|
|
1160
1176
|
throw new B("calibration_missing", "This INSP does not contain two supported calibrated panorama lenses.");
|
|
1161
|
-
const n = e.width ?? Number(((y = i.image) == null ? void 0 : y.naturalWidth) ?? ((p = i.image) == null ? void 0 : p.width)), r = e.height ?? Number(((
|
|
1177
|
+
const n = e.width ?? Number(((y = i.image) == null ? void 0 : y.naturalWidth) ?? ((p = i.image) == null ? void 0 : p.width)), r = e.height ?? Number(((h = i.image) == null ? void 0 : h.naturalHeight) ?? ((d = i.image) == null ? void 0 : d.height));
|
|
1162
1178
|
if (!(n > 0) || !(r > 0)) throw new B("invalid_manifest", "The calibrated INSP image dimensions are unavailable.");
|
|
1163
|
-
const o = { id: 0, codec: "jpeg", decoderConfig: "", width: n, height: r, timescale: 1, samples: [] }, s = e.lenses.slice(0, 2).map((
|
|
1179
|
+
const o = { id: 0, codec: "jpeg", decoderConfig: "", width: n, height: r, timescale: 1, samples: [] }, s = e.lenses.slice(0, 2).map((m) => ({
|
|
1164
1180
|
track: o,
|
|
1165
|
-
rect:
|
|
1181
|
+
rect: m.sourceRect ?? { x: 0, y: 0, width: 1, height: 1 }
|
|
1166
1182
|
}));
|
|
1167
|
-
if (!s.every((
|
|
1183
|
+
if (!s.every((m) => zn(m.rect)))
|
|
1168
1184
|
throw new B("invalid_manifest", "The calibrated INSP lenses are not bound to valid image regions.");
|
|
1169
|
-
i.flipY =
|
|
1170
|
-
const a = new
|
|
1185
|
+
i.flipY = _a(e.textureOrigin), i.colorSpace = Ji, i.minFilter = Ft, i.generateMipmaps = !1, i.needsUpdate = !0;
|
|
1186
|
+
const a = new Ta(new Uint8Array(128 * 64).fill(128), 128, 64, ka, Ra);
|
|
1171
1187
|
a.needsUpdate = !0, a.minFilter = Ft;
|
|
1172
|
-
const c =
|
|
1173
|
-
|
|
1174
|
-
const l = new
|
|
1188
|
+
const c = ms(e, s, i, a);
|
|
1189
|
+
Ua(c, e.lenses);
|
|
1190
|
+
const l = new Ki(500, 96, 64);
|
|
1175
1191
|
l.scale(-1, 1, 1);
|
|
1176
|
-
const u = new
|
|
1192
|
+
const u = new Zi(l, c), f = new jn(t, e, s, c, a);
|
|
1177
1193
|
return await f.acceptImage(i.image), {
|
|
1178
1194
|
mesh: u,
|
|
1179
1195
|
update: () => {
|
|
@@ -1200,9 +1216,9 @@ async function us(t, e, i) {
|
|
|
1200
1216
|
setStabilization: () => "off"
|
|
1201
1217
|
};
|
|
1202
1218
|
}
|
|
1203
|
-
function
|
|
1219
|
+
function ms(t, e, i, n) {
|
|
1204
1220
|
const r = t.lenses.slice(0, 2);
|
|
1205
|
-
return new
|
|
1221
|
+
return new Pa({
|
|
1206
1222
|
uniforms: {
|
|
1207
1223
|
lens0: { value: i },
|
|
1208
1224
|
lens1: { value: i },
|
|
@@ -1343,29 +1359,29 @@ function ds(t, e, i, n) {
|
|
|
1343
1359
|
`
|
|
1344
1360
|
});
|
|
1345
1361
|
}
|
|
1346
|
-
async function
|
|
1362
|
+
async function ps(t, e) {
|
|
1347
1363
|
if (!["dji-fisheye-lut", "mei-extended"].includes(e.projection.kind) || e.lenses.length < 2)
|
|
1348
1364
|
throw new B("calibration_missing", "This source does not contain two supported calibrated panorama lenses.");
|
|
1349
|
-
if (!
|
|
1365
|
+
if (!ea(e))
|
|
1350
1366
|
throw new B("calibration_missing", "The two panorama lenses do not contain complete, distinct calibration.");
|
|
1351
1367
|
if (typeof VideoDecoder > "u" || typeof EncodedVideoChunk > "u")
|
|
1352
1368
|
throw new B("codec_unsupported", "This browser does not expose WebCodecs video decoding.");
|
|
1353
|
-
const i =
|
|
1369
|
+
const i = ta(e);
|
|
1354
1370
|
if (!i)
|
|
1355
1371
|
throw new B("invalid_manifest", "The panorama lenses are not bound to valid source tracks and frame regions.");
|
|
1356
|
-
const n = [...new Map(i.map((
|
|
1357
|
-
if (n.some((
|
|
1372
|
+
const n = [...new Map(i.map((m) => [m.track.id, m.track])).values()];
|
|
1373
|
+
if (n.some((m) => m.timescale <= 0 || !m.samples.length))
|
|
1358
1374
|
throw new B("invalid_manifest", "The calibrated panorama tracks do not contain a playable sample timeline.");
|
|
1359
|
-
const r = n.map(
|
|
1360
|
-
if ((await Promise.all(r.map((
|
|
1361
|
-
throw new B("codec_unsupported", `This browser cannot decode the ${[...new Set(n.map((
|
|
1362
|
-
const s = n.map(() => new
|
|
1363
|
-
s.forEach((
|
|
1364
|
-
|
|
1375
|
+
const r = n.map(Cn);
|
|
1376
|
+
if ((await Promise.all(r.map((m) => VideoDecoder.isConfigSupported(m)))).some((m) => !m.supported))
|
|
1377
|
+
throw new B("codec_unsupported", `This browser cannot decode the ${[...new Set(n.map((m) => m.codec.toUpperCase()))].join("/")} panorama tracks.`);
|
|
1378
|
+
const s = n.map(() => new _o());
|
|
1379
|
+
s.forEach((m) => {
|
|
1380
|
+
m.flipY = _a(e.textureOrigin), m.colorSpace = Ji, m.minFilter = Ft;
|
|
1365
1381
|
});
|
|
1366
|
-
const a = new
|
|
1382
|
+
const a = new Ta(new Uint8Array(128 * 64).fill(128), 128, 64, ka, Ra);
|
|
1367
1383
|
a.needsUpdate = !0, a.minFilter = Ft;
|
|
1368
|
-
const c = e.lenses.slice(0, 2), l = i.map((
|
|
1384
|
+
const c = e.lenses.slice(0, 2), l = i.map((m) => s[n.indexOf(m.track)]), u = new Pa({
|
|
1369
1385
|
uniforms: {
|
|
1370
1386
|
lens0: { value: l[0] },
|
|
1371
1387
|
lens1: { value: l[1] },
|
|
@@ -1539,22 +1555,22 @@ async function fs(t, e) {
|
|
|
1539
1555
|
}
|
|
1540
1556
|
`
|
|
1541
1557
|
});
|
|
1542
|
-
|
|
1543
|
-
const f = new
|
|
1558
|
+
Ua(u, e.lenses);
|
|
1559
|
+
const f = new Ki(500, 96, 64);
|
|
1544
1560
|
f.scale(-1, 1, 1);
|
|
1545
|
-
const y = new
|
|
1546
|
-
|
|
1547
|
-
}, (
|
|
1548
|
-
p.reset(),
|
|
1561
|
+
const y = new Zi(f, u), p = new jn(t, e, i, u, a), h = new Ds(t, e, u), d = new Bn(t, n, s, r, (m, g) => {
|
|
1562
|
+
h.apply(m.timestamp / 1e6), p.accept(m, g);
|
|
1563
|
+
}, (m) => h.prepare(m), () => {
|
|
1564
|
+
p.reset(), h.reset();
|
|
1549
1565
|
});
|
|
1550
1566
|
return d.start(), {
|
|
1551
1567
|
mesh: y,
|
|
1552
1568
|
update: () => d.update(),
|
|
1553
1569
|
play: () => d.play(),
|
|
1554
1570
|
pause: () => d.pause(),
|
|
1555
|
-
seek: (
|
|
1571
|
+
seek: (m) => d.seek(m),
|
|
1556
1572
|
close: () => {
|
|
1557
|
-
d.close(), p.close(), s.forEach((
|
|
1573
|
+
d.close(), p.close(), s.forEach((m) => m.dispose()), a.dispose(), f.dispose(), u.dispose();
|
|
1558
1574
|
},
|
|
1559
1575
|
get streamSyncMs() {
|
|
1560
1576
|
return d.streamSyncMs;
|
|
@@ -1572,23 +1588,23 @@ async function fs(t, e) {
|
|
|
1572
1588
|
return d.paused;
|
|
1573
1589
|
},
|
|
1574
1590
|
get stabilizationAvailable() {
|
|
1575
|
-
return
|
|
1591
|
+
return h.available;
|
|
1576
1592
|
},
|
|
1577
1593
|
get stabilizationMode() {
|
|
1578
|
-
return
|
|
1594
|
+
return h.mode;
|
|
1579
1595
|
},
|
|
1580
1596
|
get error() {
|
|
1581
1597
|
return d.error;
|
|
1582
1598
|
},
|
|
1583
|
-
setStabilization: (
|
|
1599
|
+
setStabilization: (m) => h.setMode(m)
|
|
1584
1600
|
};
|
|
1585
1601
|
}
|
|
1586
|
-
async function
|
|
1602
|
+
async function ys(t, e, i) {
|
|
1587
1603
|
if (!["dji-fisheye-lut", "mei-extended"].includes(t.projection.kind) || t.lenses.length < 2)
|
|
1588
1604
|
throw new B("calibration_missing", "This source does not contain two supported calibrated panorama lenses.");
|
|
1589
|
-
if (!
|
|
1605
|
+
if (!ea(t))
|
|
1590
1606
|
throw new B("calibration_missing", "The two panorama lenses do not contain complete, distinct calibration.");
|
|
1591
|
-
const n =
|
|
1607
|
+
const n = ta(t);
|
|
1592
1608
|
if (!n)
|
|
1593
1609
|
throw new B("invalid_manifest", "The panorama lenses are not bound to valid source tracks and frame regions.");
|
|
1594
1610
|
const r = [...new Map(n.map((d) => [d.track.id, d.track])).values()];
|
|
@@ -1597,41 +1613,41 @@ async function hs(t, e, i) {
|
|
|
1597
1613
|
const o = /* @__PURE__ */ new Map();
|
|
1598
1614
|
for (const d of n)
|
|
1599
1615
|
o.has(d.track.id) || o.set(d.track.id, o.size === 0 || !i ? e : i);
|
|
1600
|
-
const s = r.map((d) =>
|
|
1616
|
+
const s = r.map((d) => gs(o.get(d.id) ?? e));
|
|
1601
1617
|
try {
|
|
1602
|
-
await Promise.all(s.map((d) =>
|
|
1618
|
+
await Promise.all(s.map((d) => xs(d)));
|
|
1603
1619
|
} catch (d) {
|
|
1604
|
-
throw s.forEach((
|
|
1620
|
+
throw s.forEach((m) => m.remove()), s.forEach((m) => sn(m)), new B("codec_unsupported", d instanceof Error ? d.message : String(d));
|
|
1605
1621
|
}
|
|
1606
1622
|
const a = s.map((d) => {
|
|
1607
|
-
const
|
|
1608
|
-
return
|
|
1609
|
-
}), c = new
|
|
1623
|
+
const m = new Rn(d);
|
|
1624
|
+
return m.flipY = _a(t.textureOrigin), m.colorSpace = Ji, m.minFilter = Ft, m;
|
|
1625
|
+
}), c = new Ta(new Uint8Array(128 * 64).fill(128), 128, 64, ka, Ra);
|
|
1610
1626
|
c.needsUpdate = !0, c.minFilter = Ft;
|
|
1611
|
-
const l = t.lenses.slice(0, 2), u = n.map((d) => a[r.indexOf(d.track)]), f =
|
|
1612
|
-
|
|
1613
|
-
const y = new
|
|
1627
|
+
const l = t.lenses.slice(0, 2), u = n.map((d) => a[r.indexOf(d.track)]), f = bs(t, l, n, u, c);
|
|
1628
|
+
Ua(f, t.lenses);
|
|
1629
|
+
const y = new Ki(500, 96, 64);
|
|
1614
1630
|
y.scale(-1, 1, 1);
|
|
1615
|
-
const p = new
|
|
1616
|
-
return
|
|
1631
|
+
const p = new Zi(y, f), h = new ws(s, a);
|
|
1632
|
+
return h.play(), {
|
|
1617
1633
|
mesh: p,
|
|
1618
|
-
update: () =>
|
|
1619
|
-
play: () =>
|
|
1620
|
-
pause: () =>
|
|
1621
|
-
seek: (d) =>
|
|
1634
|
+
update: () => h.update(),
|
|
1635
|
+
play: () => h.play(),
|
|
1636
|
+
pause: () => h.pause(),
|
|
1637
|
+
seek: (d) => h.seek(d),
|
|
1622
1638
|
close: () => {
|
|
1623
|
-
|
|
1624
|
-
d.remove(),
|
|
1639
|
+
h.close(), c.dispose(), a.forEach((d) => d.dispose()), y.dispose(), f.dispose(), s.forEach((d) => {
|
|
1640
|
+
d.remove(), sn(d);
|
|
1625
1641
|
});
|
|
1626
1642
|
},
|
|
1627
1643
|
get duration() {
|
|
1628
|
-
return
|
|
1644
|
+
return h.duration;
|
|
1629
1645
|
},
|
|
1630
1646
|
get currentTime() {
|
|
1631
|
-
return
|
|
1647
|
+
return h.currentTime;
|
|
1632
1648
|
},
|
|
1633
1649
|
get paused() {
|
|
1634
|
-
return
|
|
1650
|
+
return h.paused;
|
|
1635
1651
|
},
|
|
1636
1652
|
streamSyncMs: 0,
|
|
1637
1653
|
dynamicSeam: !1,
|
|
@@ -1641,34 +1657,34 @@ async function hs(t, e, i) {
|
|
|
1641
1657
|
setStabilization: () => "off"
|
|
1642
1658
|
};
|
|
1643
1659
|
}
|
|
1644
|
-
function
|
|
1660
|
+
function gs(t) {
|
|
1645
1661
|
var i;
|
|
1646
1662
|
const e = document.createElement("video");
|
|
1647
1663
|
if (e.preload = "auto", e.muted = !0, e.loop = !0, e.playsInline = !0, e.crossOrigin = "anonymous", e.setAttribute("aria-hidden", "true"), e.style.display = "none", typeof t == "string" || t instanceof URL)
|
|
1648
1664
|
e.src = String(t);
|
|
1649
1665
|
else {
|
|
1650
|
-
const n = t instanceof Blob ? t : new Blob([
|
|
1651
|
-
|
|
1666
|
+
const n = t instanceof Blob ? t : new Blob([vs(t)], { type: "video/mp4" }), r = URL.createObjectURL(n);
|
|
1667
|
+
Fa.set(e, r), e.src = r;
|
|
1652
1668
|
}
|
|
1653
1669
|
return (i = document.body) == null || i.append(e), e.load(), e;
|
|
1654
1670
|
}
|
|
1655
|
-
function
|
|
1671
|
+
function vs(t) {
|
|
1656
1672
|
if (t instanceof ArrayBuffer) return t;
|
|
1657
1673
|
const e = new Uint8Array(t.buffer, t.byteOffset, t.byteLength), i = new Uint8Array(e.byteLength);
|
|
1658
1674
|
return i.set(e), i.buffer;
|
|
1659
1675
|
}
|
|
1660
|
-
const
|
|
1661
|
-
function
|
|
1676
|
+
const Fa = /* @__PURE__ */ new WeakMap();
|
|
1677
|
+
function xs(t) {
|
|
1662
1678
|
return t.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA ? Promise.resolve() : new Promise((e, i) => {
|
|
1663
1679
|
t.addEventListener("loadeddata", () => e(), { once: !0 }), t.addEventListener("error", () => i(new Error("The browser could not decode the calibrated INSV video track.")), { once: !0 });
|
|
1664
1680
|
});
|
|
1665
1681
|
}
|
|
1666
|
-
function
|
|
1667
|
-
const e =
|
|
1668
|
-
e && (URL.revokeObjectURL(e),
|
|
1682
|
+
function sn(t) {
|
|
1683
|
+
const e = Fa.get(t);
|
|
1684
|
+
e && (URL.revokeObjectURL(e), Fa.delete(t));
|
|
1669
1685
|
}
|
|
1670
|
-
function
|
|
1671
|
-
return new
|
|
1686
|
+
function bs(t, e, i, n, r) {
|
|
1687
|
+
return new Pa({
|
|
1672
1688
|
uniforms: {
|
|
1673
1689
|
lens0: { value: n[0] },
|
|
1674
1690
|
lens1: { value: n[1] },
|
|
@@ -1835,7 +1851,7 @@ function gs(t, e, i, n, r) {
|
|
|
1835
1851
|
`
|
|
1836
1852
|
});
|
|
1837
1853
|
}
|
|
1838
|
-
class
|
|
1854
|
+
class ws {
|
|
1839
1855
|
constructor(e, i) {
|
|
1840
1856
|
A(this, "isClosed", !1);
|
|
1841
1857
|
this.videos = e, this.textures = i;
|
|
@@ -1882,52 +1898,52 @@ class vs {
|
|
|
1882
1898
|
this.isClosed || (this.isClosed = !0, this.pause());
|
|
1883
1899
|
}
|
|
1884
1900
|
}
|
|
1885
|
-
function
|
|
1901
|
+
function ea(t) {
|
|
1886
1902
|
const e = t.lenses.slice(0, 2);
|
|
1887
|
-
if (e.length < 2 || !e.every((a) =>
|
|
1888
|
-
const n =
|
|
1903
|
+
if (e.length < 2 || !e.every((a) => Ms(a, t.projection.kind)) || (t.cameraModel || "").replace(/^Insta360\s+/i, "").trim().toUpperCase() === "X5" && (!["embedded", "sidecar"].includes(t.calibrationSource) || !e.every((a) => a.distortionModel === "radtan_pro" ? Ke(a.distortionCoeffs, 13) : Ke(a.thinPrism, 4) && Ke(a.sensorTilt, 2)))) return !1;
|
|
1904
|
+
const n = Fi(e[0].extrinsicQuaternion), r = Fi(e[1].extrinsicQuaternion);
|
|
1889
1905
|
if (Math.abs(n.reduce((a, c, l) => a + c * r[l], 0)) >= 0.999) return !1;
|
|
1890
|
-
const o =
|
|
1906
|
+
const o = cn(e[0], t.projection.kind), s = cn(e[1], t.projection.kind);
|
|
1891
1907
|
return o.reduce((a, c, l) => a + c * s[l], 0) < -0.8;
|
|
1892
1908
|
}
|
|
1893
|
-
function
|
|
1909
|
+
function ta(t) {
|
|
1894
1910
|
const e = t.lenses.slice(0, 2);
|
|
1895
1911
|
if (e.length < 2) return;
|
|
1896
1912
|
const i = e.map((n, r) => {
|
|
1897
1913
|
const o = n.sourceTrackId === void 0 ? t.tracks.length >= 2 ? t.tracks[r] : void 0 : t.tracks.find((a) => a.id === n.sourceTrackId), s = n.sourceRect ?? { x: 0, y: 0, width: 1, height: 1 };
|
|
1898
|
-
return o &&
|
|
1914
|
+
return o && zn(s) ? { track: o, rect: s } : void 0;
|
|
1899
1915
|
});
|
|
1900
1916
|
if (!(!i[0] || !i[1]) && !(i[0].track.id === i[1].track.id && !e.every((n) => n.sourceRect)))
|
|
1901
1917
|
return i;
|
|
1902
1918
|
}
|
|
1903
|
-
function
|
|
1919
|
+
function Fs(t, e, i, n) {
|
|
1904
1920
|
return [
|
|
1905
1921
|
i.rect.x + t * i.rect.width,
|
|
1906
|
-
i.rect.y +
|
|
1922
|
+
i.rect.y + Es(e, n) * i.rect.height
|
|
1907
1923
|
];
|
|
1908
1924
|
}
|
|
1909
1925
|
function Xt(t, e) {
|
|
1910
1926
|
const { x: i, y: n, width: r, height: o } = t.rect;
|
|
1911
1927
|
return [i, e === "top-left" ? n : 1 - n - o, r, o];
|
|
1912
1928
|
}
|
|
1913
|
-
function
|
|
1929
|
+
function zn(t) {
|
|
1914
1930
|
return [t.x, t.y, t.width, t.height].every(Number.isFinite) && t.x >= 0 && t.y >= 0 && t.width > 0 && t.height > 0 && t.x + t.width <= 1 && t.y + t.height <= 1;
|
|
1915
1931
|
}
|
|
1916
1932
|
function $t(t, e) {
|
|
1917
1933
|
return [t.width || e.track.width * e.rect.width, t.height || e.track.height * e.rect.height];
|
|
1918
1934
|
}
|
|
1919
|
-
function
|
|
1935
|
+
function cn(t, e) {
|
|
1920
1936
|
const i = dt(t);
|
|
1921
|
-
return
|
|
1937
|
+
return Nn(e === "mei-extended" ? i : La(i), [0, 0, 1]);
|
|
1922
1938
|
}
|
|
1923
|
-
function
|
|
1939
|
+
function Ms(t, e) {
|
|
1924
1940
|
const i = [t.width, t.height, t.fx, t.fy, t.cx, t.cy], n = t.extrinsicQuaternion;
|
|
1925
1941
|
return !i.every((r) => typeof r == "number" && Number.isFinite(r)) || ![t.width, t.height, t.fx, t.fy].every((r) => Number(r) > 0) || Number(t.cx) < 0 || Number(t.cx) >= Number(t.width) || Number(t.cy) < 0 || Number(t.cy) >= Number(t.height) || (n == null ? void 0 : n.length) !== 4 || !n.every(Number.isFinite) || Math.hypot(...n) < 0.5 ? !1 : e === "dji-fisheye-lut" ? Ke(t.distortion, 4) && Ke(t.radialLut1, 14) && Ke(t.radialLut2, 14) : t.distortionModel === "radtan_pro" && !Ke(t.distortionCoeffs, 13) ? !1 : e === "mei-extended" && Number.isFinite(t.xi) && Number(t.xi) > 0 && Ke(t.radial, 4) && Ke(t.tangential, 2);
|
|
1926
1942
|
}
|
|
1927
1943
|
function Ke(t, e) {
|
|
1928
1944
|
return !!(t && t.length >= e && t.slice(0, e).every((i) => typeof i == "number" && Number.isFinite(i)));
|
|
1929
1945
|
}
|
|
1930
|
-
class
|
|
1946
|
+
class Bn {
|
|
1931
1947
|
constructor(e, i, n, r, o, s, a) {
|
|
1932
1948
|
A(this, "decoders");
|
|
1933
1949
|
A(this, "queues");
|
|
@@ -1947,7 +1963,7 @@ class zn {
|
|
|
1947
1963
|
A(this, "seekEnd");
|
|
1948
1964
|
A(this, "streamSyncMs", 0);
|
|
1949
1965
|
this.processor = e, this.tracks = i, this.textures = n, this.configs = r, this.onPair = o, this.prepareImu = s, this.onSeek = a, this.queues = i.map(() => []), this.indexes = i.map(() => 0), this.currentFrames = i.map(() => {
|
|
1950
|
-
}), this.duration = Math.min(...i.map(
|
|
1966
|
+
}), this.duration = Math.min(...i.map(Xs)), this.seekEnd = Math.min(...i.map((c) => c.samples.at(-1).pts / c.timescale)), this.decoders = [];
|
|
1951
1967
|
try {
|
|
1952
1968
|
r.forEach((c, l) => {
|
|
1953
1969
|
const u = new VideoDecoder({
|
|
@@ -2032,7 +2048,7 @@ class zn {
|
|
|
2032
2048
|
if (!n && c.pts / o.timescale > e || n && s > 0) break;
|
|
2033
2049
|
const l = await this.processor.readSample(o.id, a);
|
|
2034
2050
|
if (this.closed || i !== this.generation) return;
|
|
2035
|
-
this.decoders[r].decode(
|
|
2051
|
+
this.decoders[r].decode(ss(l)), this.indexes[r] += 1, s += 1;
|
|
2036
2052
|
}
|
|
2037
2053
|
}
|
|
2038
2054
|
}
|
|
@@ -2080,7 +2096,7 @@ class zn {
|
|
|
2080
2096
|
(n = this.currentFrames[e]) == null || n.close(), this.currentFrames[e] = i, (r = this.textures[e]) == null || r.setFrame(i);
|
|
2081
2097
|
}
|
|
2082
2098
|
}
|
|
2083
|
-
class
|
|
2099
|
+
class Ds {
|
|
2084
2100
|
constructor(e, i, n) {
|
|
2085
2101
|
A(this, "available");
|
|
2086
2102
|
A(this, "mode");
|
|
@@ -2119,34 +2135,34 @@ class ws {
|
|
|
2119
2135
|
}
|
|
2120
2136
|
apply(e) {
|
|
2121
2137
|
if (!this.available || this.mode !== "horizon-lock") return;
|
|
2122
|
-
const i = this.samples.filter((f) =>
|
|
2138
|
+
const i = this.samples.filter((f) => Ts(f.cameraRotation));
|
|
2123
2139
|
if (!i.length) return;
|
|
2124
2140
|
let n = i.findIndex((f) => f.pts / f.timescale >= e);
|
|
2125
2141
|
n < 0 && (n = i.length - 1);
|
|
2126
|
-
const r = Math.max(0, n - 1), o = i[r], s = i[n], a = o.pts / o.timescale, c = s.pts / s.timescale - a, l =
|
|
2127
|
-
this.material.uniforms.stabilizationQuaternion.value =
|
|
2142
|
+
const r = Math.max(0, n - 1), o = i[r], s = i[n], a = o.pts / o.timescale, c = s.pts / s.timescale - a, l = Ss(o.cameraRotation, s.cameraRotation, c > 0 ? (e - a) / c : 0), u = Math.atan2(2 * (l[0] * l[3] + l[1] * l[2]), 1 - 2 * (l[2] ** 2 + l[3] ** 2));
|
|
2143
|
+
this.material.uniforms.stabilizationQuaternion.value = ks(La(l), [Math.cos(u / 2), 0, 0, Math.sin(u / 2)]);
|
|
2128
2144
|
}
|
|
2129
2145
|
}
|
|
2130
|
-
function
|
|
2131
|
-
const n =
|
|
2132
|
-
let r =
|
|
2146
|
+
function Ss(t, e, i) {
|
|
2147
|
+
const n = Fi(t);
|
|
2148
|
+
let r = Fi(e), o = n.reduce((l, u, f) => l + u * r[f], 0);
|
|
2133
2149
|
o < 0 && (r = r.map((l) => -l), o = -o);
|
|
2134
2150
|
const s = Math.max(0, Math.min(1, i));
|
|
2135
|
-
if (o > 0.9995) return
|
|
2151
|
+
if (o > 0.9995) return Fi(n.map((l, u) => l + s * (r[u] - l)));
|
|
2136
2152
|
const a = Math.acos(Math.max(-1, Math.min(1, o))), c = Math.sin(a);
|
|
2137
2153
|
return n.map((l, u) => (l * Math.sin((1 - s) * a) + r[u] * Math.sin(s * a)) / c);
|
|
2138
2154
|
}
|
|
2139
|
-
function
|
|
2155
|
+
function Ts(t) {
|
|
2140
2156
|
return (t == null ? void 0 : t.length) === 4 && t.every((e) => typeof e == "number" && Number.isFinite(e));
|
|
2141
2157
|
}
|
|
2142
|
-
function
|
|
2158
|
+
function Fi(t) {
|
|
2143
2159
|
const e = Math.hypot(...t) || 1;
|
|
2144
2160
|
return [0, 1, 2, 3].map((i) => Number(t[i] ?? (i === 0 ? 1 : 0)) / e);
|
|
2145
2161
|
}
|
|
2146
|
-
function
|
|
2162
|
+
function La(t) {
|
|
2147
2163
|
return [t[0], -t[1], -t[2], -t[3]];
|
|
2148
2164
|
}
|
|
2149
|
-
function
|
|
2165
|
+
function ks(t, e) {
|
|
2150
2166
|
return [
|
|
2151
2167
|
t[0] * e[0] - t[1] * e[1] - t[2] * e[2] - t[3] * e[3],
|
|
2152
2168
|
t[0] * e[1] + t[1] * e[0] + t[2] * e[3] - t[3] * e[2],
|
|
@@ -2155,7 +2171,7 @@ function Ds(t, e) {
|
|
|
2155
2171
|
];
|
|
2156
2172
|
}
|
|
2157
2173
|
const N = 128, ae = 64, Je = 256;
|
|
2158
|
-
class
|
|
2174
|
+
class jn {
|
|
2159
2175
|
constructor(e, i, n, r, o) {
|
|
2160
2176
|
A(this, "lastAnalysis", -1 / 0);
|
|
2161
2177
|
A(this, "busy", !1);
|
|
@@ -2192,17 +2208,17 @@ class Bn {
|
|
|
2192
2208
|
this.generation += 1, this.previousLeft = void 0, this.previousRight = void 0, this.lastAnalysis = -1 / 0, this.material.uniforms.useDynamicSeam.value = 0, this.material.uniforms.exposureGain0.value = [1, 1, 1], this.material.uniforms.exposureGain1.value = [1, 1, 1], this.active = !1;
|
|
2193
2209
|
}
|
|
2194
2210
|
async analyze(e, i) {
|
|
2195
|
-
const n = e.map((x) =>
|
|
2211
|
+
const n = e.map((x) => _s(x)), r = [new Uint8Array(N * ae * 3), new Uint8Array(N * ae * 3)], o = [new Float32Array(N * ae), new Float32Array(N * ae)], s = this.manifest.lenses.slice(0, 2);
|
|
2196
2212
|
let a = 0;
|
|
2197
2213
|
const c = [new Float64Array(3), new Float64Array(3)];
|
|
2198
2214
|
for (let x = 0; x < ae; x += 1)
|
|
2199
2215
|
for (let v = 0; v < N; v += 1) {
|
|
2200
|
-
const w =
|
|
2216
|
+
const w = Bs((v + 0.5) / N, (x + 0.5) / ae, this.manifest.projection.kind), S = x * N + v;
|
|
2201
2217
|
for (let D = 0; D < 2; D += 1) {
|
|
2202
|
-
const F =
|
|
2218
|
+
const F = Cs(w, s[D], this.manifest.projection.kind);
|
|
2203
2219
|
if (!F) continue;
|
|
2204
|
-
const T = S * 3, L = n[D], _ =
|
|
2205
|
-
|
|
2220
|
+
const T = S * 3, L = n[D], _ = Fs(F[0], F[1], this.lensSources[D], this.manifest.textureOrigin);
|
|
2221
|
+
Us(L, Je, _[0], _[1], r[D], T), o[D][S] = F[2] * (this.manifest.projection.kind === "mei-extended" ? js((v + 0.5) / N, D) : 1);
|
|
2206
2222
|
}
|
|
2207
2223
|
if (o[0][S] > 0 && o[1][S] > 0) {
|
|
2208
2224
|
a += 1;
|
|
@@ -2216,7 +2232,7 @@ class Bn {
|
|
|
2216
2232
|
this.material.uniforms.exposureGain1.value
|
|
2217
2233
|
];
|
|
2218
2234
|
if (a > 64) {
|
|
2219
|
-
const x =
|
|
2235
|
+
const x = As(c[0], c[1]);
|
|
2220
2236
|
l = this.active ? x.map((v, w) => v.map((S, D) => l[w][D] * 0.8 + S * 0.2)) : x, this.material.uniforms.exposureGain0.value = l[0], this.material.uniforms.exposureGain1.value = l[1];
|
|
2221
2237
|
}
|
|
2222
2238
|
if (a <= 64) return;
|
|
@@ -2226,115 +2242,115 @@ class Bn {
|
|
|
2226
2242
|
for (let v = 0; v < N; v += 1) {
|
|
2227
2243
|
const w = x * N + v;
|
|
2228
2244
|
if (o[0][w] <= 0 || o[1][w] <= 0) continue;
|
|
2229
|
-
const S = w * 3, D = Math.abs(r[0][S] * l[0][0] - r[1][S] * l[1][0]) + Math.abs(r[0][S + 1] * l[0][1] - r[1][S + 1] * l[1][1]) + Math.abs(r[0][S + 2] * l[0][2] - r[1][S + 2] * l[1][2]), F = v > 0 ? w - 1 : w, T = x > 0 ? w - N : w, L =
|
|
2230
|
-
u[w] = Math.min(65534, D + Math.abs(L - _) * 2 +
|
|
2245
|
+
const S = w * 3, D = Math.abs(r[0][S] * l[0][0] - r[1][S] * l[1][0]) + Math.abs(r[0][S + 1] * l[0][1] - r[1][S + 1] * l[1][1]) + Math.abs(r[0][S + 2] * l[0][2] - r[1][S + 2] * l[1][2]), F = v > 0 ? w - 1 : w, T = x > 0 ? w - N : w, L = fn(r[0], l[0], w, F, T), _ = fn(r[1], l[1], w, F, T);
|
|
2246
|
+
u[w] = Math.min(65534, D + Math.abs(L - _) * 2 + Ls(o[0][w], o[1][w]));
|
|
2231
2247
|
}
|
|
2232
|
-
const f = this.manifest.projection.kind === "dji-fisheye-lut", y = f ?
|
|
2233
|
-
this.processor.computeSeam({ width: p, height: ae, costs:
|
|
2234
|
-
this.processor.computeSeam({ width: p, height: ae, costs:
|
|
2248
|
+
const f = this.manifest.projection.kind === "dji-fisheye-lut", y = f ? Gs(u, N, ae, N / 4) : u, p = N / 2, [h, d] = await Promise.all([
|
|
2249
|
+
this.processor.computeSeam({ width: p, height: ae, costs: hn(y, 0), previous: this.previousLeft, temporalWeight: 3, maxStep: 2 }),
|
|
2250
|
+
this.processor.computeSeam({ width: p, height: ae, costs: hn(y, p), previous: this.previousRight, temporalWeight: 3, maxStep: 2 })
|
|
2235
2251
|
]);
|
|
2236
2252
|
if (this.closed || i !== this.generation) return;
|
|
2237
|
-
if (!
|
|
2253
|
+
if (!Ps([h, d], ae)) {
|
|
2238
2254
|
this.material.uniforms.useDynamicSeam.value = 0, this.active = !1;
|
|
2239
2255
|
return;
|
|
2240
2256
|
}
|
|
2241
|
-
const
|
|
2242
|
-
if (!
|
|
2257
|
+
const m = un(ln(h.seam), this.previousLeft), g = un(ln(d.seam), this.previousRight);
|
|
2258
|
+
if (!dn(y, m, 0) || !dn(y, g, p)) {
|
|
2243
2259
|
this.material.uniforms.useDynamicSeam.value = 0, this.active = !1;
|
|
2244
2260
|
return;
|
|
2245
2261
|
}
|
|
2246
|
-
this.previousLeft =
|
|
2247
|
-
const b = f ?
|
|
2262
|
+
this.previousLeft = m, this.previousRight = g;
|
|
2263
|
+
const b = f ? qs(
|
|
2248
2264
|
o,
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
) :
|
|
2265
|
+
mn(m, N, N / 4),
|
|
2266
|
+
mn(g.map((x) => x + p), N, N / 4)
|
|
2267
|
+
) : Ws(o, m, g.map((x) => x + p));
|
|
2252
2268
|
this.seamTexture.image.data.set(b), this.seamTexture.needsUpdate = !0, this.material.uniforms.useDynamicSeam.value = 1, this.active = !0;
|
|
2253
2269
|
}
|
|
2254
2270
|
}
|
|
2255
|
-
function
|
|
2271
|
+
function Rs(t, e) {
|
|
2256
2272
|
if (!(t > 0) || !(e > 0)) return [1, 1];
|
|
2257
2273
|
const i = Math.sqrt(Math.max(0.64, Math.min(1.5625, e / t)));
|
|
2258
2274
|
return [i, 1 / i];
|
|
2259
2275
|
}
|
|
2260
|
-
function
|
|
2276
|
+
function Ps(t, e, i = 120) {
|
|
2261
2277
|
return t.length > 0 && t.every((n) => Number.isFinite(n.cost) && n.cost / e <= i);
|
|
2262
2278
|
}
|
|
2263
|
-
function
|
|
2264
|
-
const i = [0, 1, 2].map((n) =>
|
|
2279
|
+
function As(t, e) {
|
|
2280
|
+
const i = [0, 1, 2].map((n) => Rs(Number(t[n]), Number(e[n])));
|
|
2265
2281
|
return [i.map((n) => n[0]), i.map((n) => n[1])];
|
|
2266
2282
|
}
|
|
2267
|
-
function
|
|
2283
|
+
function Ls(t, e) {
|
|
2268
2284
|
const i = t + e;
|
|
2269
2285
|
return !(t > 0) || !(e > 0) || !(i > 0) ? 128 : Math.round((1 - 2 * Math.min(t, e) / i) * 128);
|
|
2270
2286
|
}
|
|
2271
|
-
function
|
|
2287
|
+
function ln(t, e = 2) {
|
|
2272
2288
|
if (e <= 0 || t.length <= e * 2) return t.slice();
|
|
2273
2289
|
const i = t.slice();
|
|
2274
2290
|
return i.fill(t[e], 0, e), i.fill(t[t.length - e - 1], t.length - e), i;
|
|
2275
2291
|
}
|
|
2276
|
-
function
|
|
2292
|
+
function un(t, e, i = 4) {
|
|
2277
2293
|
return !e || e.length !== t.length || i < 0 ? t.slice() : t.map((n, r) => Math.max(e[r] - i, Math.min(e[r] + i, n)));
|
|
2278
2294
|
}
|
|
2279
|
-
function
|
|
2295
|
+
function dn(t, e, i = 0, n = N) {
|
|
2280
2296
|
return e.length > 0 && e.every((r, o) => r >= 0 && i + r < n && t[o * n + i + r] < 65535);
|
|
2281
2297
|
}
|
|
2282
|
-
function
|
|
2283
|
-
const o =
|
|
2284
|
-
return Math.abs(o -
|
|
2298
|
+
function fn(t, e, i, n, r) {
|
|
2299
|
+
const o = va(t, e, i);
|
|
2300
|
+
return Math.abs(o - va(t, e, n)) + Math.abs(o - va(t, e, r));
|
|
2285
2301
|
}
|
|
2286
|
-
function
|
|
2302
|
+
function va(t, e, i) {
|
|
2287
2303
|
const n = i * 3;
|
|
2288
2304
|
return (t[n] * e[0] * 77 + t[n + 1] * e[1] * 150 + t[n + 2] * e[2] * 29) / 256;
|
|
2289
2305
|
}
|
|
2290
|
-
function
|
|
2306
|
+
function _s(t) {
|
|
2291
2307
|
const i = (typeof OffscreenCanvas < "u" ? new OffscreenCanvas(Je, Je) : Object.assign(document.createElement("canvas"), { width: Je, height: Je })).getContext("2d", { willReadFrequently: !0 });
|
|
2292
2308
|
if (!i) throw new Error("A 2D canvas is required for panorama seam analysis.");
|
|
2293
2309
|
return i.drawImage(t, 0, 0, Je, Je), i.getImageData(0, 0, Je, Je).data;
|
|
2294
2310
|
}
|
|
2295
|
-
function
|
|
2311
|
+
function Us(t, e, i, n, r = new Uint8Array(3), o = 0) {
|
|
2296
2312
|
const s = Math.max(0, Math.min(e - 1, i * e - 0.5)), a = Math.max(0, Math.min(e - 1, n * e - 0.5)), c = Math.floor(s), l = Math.floor(a), u = Math.min(e - 1, c + 1), f = Math.min(e - 1, l + 1), y = s - c, p = a - l;
|
|
2297
|
-
for (let
|
|
2298
|
-
const d = t[(l * e + c) * 4 +
|
|
2299
|
-
r[o +
|
|
2313
|
+
for (let h = 0; h < 3; h += 1) {
|
|
2314
|
+
const d = t[(l * e + c) * 4 + h] * (1 - y) + t[(l * e + u) * 4 + h] * y, m = t[(f * e + c) * 4 + h] * (1 - y) + t[(f * e + u) * 4 + h] * y;
|
|
2315
|
+
r[o + h] = Math.round(d * (1 - p) + m * p);
|
|
2300
2316
|
}
|
|
2301
2317
|
return r;
|
|
2302
2318
|
}
|
|
2303
|
-
function
|
|
2319
|
+
function _a(t) {
|
|
2304
2320
|
return t !== "top-left";
|
|
2305
2321
|
}
|
|
2306
|
-
function
|
|
2322
|
+
function Es(t, e) {
|
|
2307
2323
|
return e === "top-left" ? t : 1 - t;
|
|
2308
2324
|
}
|
|
2309
|
-
function
|
|
2310
|
-
const n = dt(e), r =
|
|
2325
|
+
function Cs(t, e, i) {
|
|
2326
|
+
const n = dt(e), r = Nn(i === "mei-extended" ? La(n) : n, t), o = Math.acos(Math.max(-1, Math.min(1, r[2])));
|
|
2311
2327
|
let s, a;
|
|
2312
2328
|
if (i === "mei-extended") {
|
|
2313
2329
|
const p = r[2] + (e.xi || 0);
|
|
2314
2330
|
if (p <= 1e-6) return;
|
|
2315
|
-
const
|
|
2316
|
-
if (!Number.isFinite(
|
|
2317
|
-
const g =
|
|
2331
|
+
const h = r[0] / p, d = r[1] / p, m = h * h + d * d;
|
|
2332
|
+
if (!Number.isFinite(m) || m > 16) return;
|
|
2333
|
+
const g = m * m, b = Ze(e), x = ve(e.tangential), v = Mt(e.thinPrism), w = 1 + b[0] * m + b[1] * g + b[2] * m * g + b[3] * g * g, S = h * w + 2 * x[0] * h * d + x[1] * (m + 2 * h * h) + v[0] * m + v[1] * g, D = d * w + x[0] * (m + 2 * d * d) + 2 * x[1] * h * d + v[2] * m + v[3] * g, F = e.distortionModel === "radtan_pro" ? Is([h, d], e.distortionCoeffs) : Os([S, D], ve(e.sensorTilt));
|
|
2318
2334
|
s = (e.cx || 0) + (e.fx || 1) * F[0], a = (e.cy || 0) + (e.fy || e.fx || 1) * F[1];
|
|
2319
2335
|
} else {
|
|
2320
2336
|
if (o >= 96 * Math.PI / 180) return;
|
|
2321
|
-
const p = Math.max(1e-6, Math.hypot(r[0], r[1])),
|
|
2322
|
-
s = (e.cx || 0) +
|
|
2337
|
+
const p = Math.max(1e-6, Math.hypot(r[0], r[1])), h = Vs(o, e);
|
|
2338
|
+
s = (e.cx || 0) + h * r[0] / p, a = (e.cy || 0) + h * r[1] / p;
|
|
2323
2339
|
}
|
|
2324
2340
|
const c = e.width || 1, l = e.height || 1;
|
|
2325
2341
|
if (!Number.isFinite(s) || !Number.isFinite(a) || s < 0 || s > c - 1 || a < 0 || a > l - 1) return;
|
|
2326
2342
|
const u = (s + 0.5) / c, f = (a + 0.5) / l, y = 0.475 * Math.min(c, l) - Math.hypot(s - (e.cx || 0), a - (e.cy || 0));
|
|
2327
2343
|
if (!(i === "mei-extended" && y <= 0))
|
|
2328
|
-
return [u, f, i === "mei-extended" ? y :
|
|
2344
|
+
return [u, f, i === "mei-extended" ? y : zs(o)];
|
|
2329
2345
|
}
|
|
2330
|
-
function
|
|
2346
|
+
function Is([t, e], i) {
|
|
2331
2347
|
const n = t * t + e * e, r = n * n, o = 1 + i[0] * n + i[1] * r + i[2] * n * r + i[3] * r * r + i[4] * r * r * n, s = i[5] + i[7] * n, a = i[6] + i[8] * n;
|
|
2332
2348
|
return [
|
|
2333
2349
|
t * o + (n + 2 * t * t) * s + 2 * t * e * a + i[9] * n + i[11] * r,
|
|
2334
2350
|
e * o + (n + 2 * e * e) * a + 2 * t * e * s + i[10] * n + i[12] * r
|
|
2335
2351
|
];
|
|
2336
2352
|
}
|
|
2337
|
-
function
|
|
2353
|
+
function Ua(t, e) {
|
|
2338
2354
|
if (!e.some((r) => r.distortionModel === "radtan_pro")) return;
|
|
2339
2355
|
const n = `${e.slice(0, 2).map((r, o) => {
|
|
2340
2356
|
const s = Array.from({ length: 13 }, (a, c) => {
|
|
@@ -2363,26 +2379,26 @@ function _a(t, e) {
|
|
|
2363
2379
|
t.fragmentShader = t.fragmentShader.replace("precision highp float;", `precision highp float;
|
|
2364
2380
|
${n}`).replace("sampler2D image) {", "sampler2D image, int lensIndex) {").replace("intrinsics.xy * applySensorTilt(distorted, sensorTilt)", "intrinsics.xy * calibratedDistortion(normalized, applySensorTilt(distorted, sensorTilt), lensIndex)").replace("sensorTilt0, lens0);", "sensorTilt0, lens0, 0);").replace("sensorTilt1, lens1);", "sensorTilt1, lens1, 1);");
|
|
2365
2381
|
}
|
|
2366
|
-
function
|
|
2382
|
+
function zs(t) {
|
|
2367
2383
|
return Math.max(0, Math.min(1, (95 * Math.PI / 180 - t) / (10 * Math.PI / 180)));
|
|
2368
2384
|
}
|
|
2369
|
-
function
|
|
2385
|
+
function Bs(t, e, i) {
|
|
2370
2386
|
const n = t * Math.PI * 2 - Math.PI, r = (e - 0.5) * Math.PI, o = Math.cos(r);
|
|
2371
2387
|
return i === "mei-extended" ? [o * Math.sin(n), -Math.sin(r), o * Math.cos(n)] : [o * Math.sin(n + Math.PI / 2), o * Math.cos(n + Math.PI / 2), Math.sin(r)];
|
|
2372
2388
|
}
|
|
2373
|
-
function
|
|
2374
|
-
const i = t * 360 - 180, n = 1 -
|
|
2389
|
+
function js(t, e) {
|
|
2390
|
+
const i = t * 360 - 180, n = 1 - Ns(75, 105, Math.abs(i));
|
|
2375
2391
|
return e === 0 ? n : 1 - n;
|
|
2376
2392
|
}
|
|
2377
|
-
function
|
|
2393
|
+
function Ns(t, e, i) {
|
|
2378
2394
|
const n = Math.max(0, Math.min(1, (i - t) / (e - t)));
|
|
2379
2395
|
return n * n * (3 - 2 * n);
|
|
2380
2396
|
}
|
|
2381
|
-
function
|
|
2382
|
-
const [i, n] = t, [r, o] = e, s = Math.cos(r), a = Math.sin(r), c = Math.cos(o), l = Math.sin(o), u = c * i + l * a * n - l * s, f = s * n + a, y = l * i - c * a * n + c * s,
|
|
2383
|
-
return [s * (c * u + l * y) *
|
|
2397
|
+
function Os(t, e) {
|
|
2398
|
+
const [i, n] = t, [r, o] = e, s = Math.cos(r), a = Math.sin(r), c = Math.cos(o), l = Math.sin(o), u = c * i + l * a * n - l * s, f = s * n + a, y = l * i - c * a * n + c * s, h = 1 / (Math.abs(y) > 1e-6 ? y : y < 0 ? -1e-6 : 1e-6);
|
|
2399
|
+
return [s * (c * u + l * y) * h, (c * s * f - a * y) * h];
|
|
2384
2400
|
}
|
|
2385
|
-
function
|
|
2401
|
+
function Nn(t, e) {
|
|
2386
2402
|
const i = Math.hypot(...t) || 1, [n, r, o, s] = t.map((u) => u / i), a = r * e[0] + o * e[1] + s * e[2], c = [o * e[2] - s * e[1], s * e[0] - r * e[2], r * e[1] - o * e[0]], l = n * n - r * r - o * o - s * s;
|
|
2387
2403
|
return [
|
|
2388
2404
|
2 * a * r + l * e[0] + 2 * n * c[0],
|
|
@@ -2390,25 +2406,25 @@ function jn(t, e) {
|
|
|
2390
2406
|
2 * a * s + l * e[2] + 2 * n * c[2]
|
|
2391
2407
|
];
|
|
2392
2408
|
}
|
|
2393
|
-
function
|
|
2409
|
+
function Vs(t, e) {
|
|
2394
2410
|
const i = 85 * Math.PI / 180, n = Math.min(t, i), r = Ze(e), o = n + r[0] * n ** 3 + r[1] * n ** 5 + r[2] * n ** 7 + r[3] * n ** 9, s = 1 + 3 * r[0] * n ** 2 + 5 * r[1] * n ** 4 + 7 * r[2] * n ** 6 + 9 * r[3] * n ** 8;
|
|
2395
2411
|
return Dt(e) * (e.fx || 1) * (t > i ? o + s * (t - i) : o);
|
|
2396
2412
|
}
|
|
2397
|
-
function
|
|
2413
|
+
function hn(t, e) {
|
|
2398
2414
|
const i = N / 2, n = new Uint16Array(i * ae);
|
|
2399
2415
|
for (let r = 0; r < ae; r += 1) n.set(t.subarray(r * N + e, r * N + e + i), r * i);
|
|
2400
2416
|
return n;
|
|
2401
2417
|
}
|
|
2402
|
-
function
|
|
2418
|
+
function Ws(t, e, i) {
|
|
2403
2419
|
const n = new Uint8Array(N * ae);
|
|
2404
2420
|
for (let r = 0; r < ae; r += 1) {
|
|
2405
2421
|
let o = t[1][r * N] > t[0][r * N];
|
|
2406
2422
|
for (let s = 0; s < N; s += 1)
|
|
2407
2423
|
(s === e[r] || s === i[r]) && (o = !o), n[r * N + s] = o ? 255 : 0;
|
|
2408
2424
|
}
|
|
2409
|
-
return
|
|
2425
|
+
return On(n, !1);
|
|
2410
2426
|
}
|
|
2411
|
-
function
|
|
2427
|
+
function qs(t, e, i) {
|
|
2412
2428
|
const n = new Uint8Array(N * ae), r = N / 4, o = ae / 8;
|
|
2413
2429
|
for (let s = 0; s < ae; s += 1) {
|
|
2414
2430
|
if (s < o || s >= ae - o) {
|
|
@@ -2424,9 +2440,9 @@ function Os(t, e, i) {
|
|
|
2424
2440
|
n[s * N + f] = (y ? u : !u) ? 255 : 0;
|
|
2425
2441
|
}
|
|
2426
2442
|
}
|
|
2427
|
-
return
|
|
2443
|
+
return On(n, !0);
|
|
2428
2444
|
}
|
|
2429
|
-
function
|
|
2445
|
+
function On(t, e) {
|
|
2430
2446
|
const i = t.slice();
|
|
2431
2447
|
for (let n = 0; n < ae; n += 1)
|
|
2432
2448
|
for (let r = 0; r < N; r += 1) {
|
|
@@ -2437,13 +2453,13 @@ function Nn(t, e) {
|
|
|
2437
2453
|
}
|
|
2438
2454
|
return i;
|
|
2439
2455
|
}
|
|
2440
|
-
function
|
|
2456
|
+
function Gs(t, e, i, n) {
|
|
2441
2457
|
const r = new Uint16Array(t.length);
|
|
2442
2458
|
for (let o = 0; o < i; o += 1)
|
|
2443
2459
|
for (let s = 0; s < e; s += 1) r[o * e + (s + n) % e] = t[o * e + s];
|
|
2444
2460
|
return r;
|
|
2445
2461
|
}
|
|
2446
|
-
function
|
|
2462
|
+
function mn(t, e, i) {
|
|
2447
2463
|
return t.map((n) => (n - i + e) % e);
|
|
2448
2464
|
}
|
|
2449
2465
|
function Yt(t) {
|
|
@@ -2463,7 +2479,7 @@ function dt(t) {
|
|
|
2463
2479
|
const e = t.extrinsicQuaternion;
|
|
2464
2480
|
return (e == null ? void 0 : e.length) === 4 && e.every(Number.isFinite) ? e : [1, 0, 0, 0];
|
|
2465
2481
|
}
|
|
2466
|
-
function
|
|
2482
|
+
function Xs(t) {
|
|
2467
2483
|
const e = t.samples.at(-1);
|
|
2468
2484
|
return e && t.timescale > 0 ? (e.pts + e.duration) / t.timescale : 0;
|
|
2469
2485
|
}
|
|
@@ -2529,7 +2545,7 @@ const ee = Object.freeze({
|
|
|
2529
2545
|
// 0 = auto
|
|
2530
2546
|
preferredImageWidth: 0,
|
|
2531
2547
|
videoMetadataTimeoutMS: 15e3
|
|
2532
|
-
}),
|
|
2548
|
+
}), pn = [16384, 8192, 4096, 2048];
|
|
2533
2549
|
function O(t, e, i) {
|
|
2534
2550
|
return Math.min(i, Math.max(e, t));
|
|
2535
2551
|
}
|
|
@@ -2543,18 +2559,18 @@ function de(t, e, i = 0) {
|
|
|
2543
2559
|
o.push(me(n && n[s], e[s] ?? 0));
|
|
2544
2560
|
return o;
|
|
2545
2561
|
}
|
|
2546
|
-
function
|
|
2562
|
+
function Ma(t, e) {
|
|
2547
2563
|
const i = de(t, e, 2);
|
|
2548
2564
|
return [Math.max(1, Math.round(i[0])), Math.max(1, Math.round(i[1]))];
|
|
2549
2565
|
}
|
|
2550
|
-
function
|
|
2566
|
+
function Da(t) {
|
|
2551
2567
|
return (me(t, 0) % 360 + 360) % 360;
|
|
2552
2568
|
}
|
|
2553
|
-
function
|
|
2554
|
-
const i = Array.isArray(t) && t.length >= 2 ? t : e, n =
|
|
2569
|
+
function ia(t, e = ee.dualFisheyeSeamLongitudesDeg) {
|
|
2570
|
+
const i = Array.isArray(t) && t.length >= 2 ? t : e, n = Da(i[0]), r = Da(i[1]);
|
|
2555
2571
|
return Math.abs(n - r) < 1e-3 ? e.slice() : [n, r];
|
|
2556
2572
|
}
|
|
2557
|
-
function
|
|
2573
|
+
function yn(t, e) {
|
|
2558
2574
|
if (t instanceof Uint8Array)
|
|
2559
2575
|
return !e || t.length === e ? t : t.length > e ? t.slice(0, e) : null;
|
|
2560
2576
|
if (Array.isArray(t)) {
|
|
@@ -2563,7 +2579,7 @@ function mn(t, e) {
|
|
|
2563
2579
|
}
|
|
2564
2580
|
return null;
|
|
2565
2581
|
}
|
|
2566
|
-
function
|
|
2582
|
+
function Vn(t) {
|
|
2567
2583
|
const e = { ...ee, ...t || {} };
|
|
2568
2584
|
if (e.fovDeg = O(Number(e.fovDeg) || ee.fovDeg, 1, 179), e.maxFovDeg = O(Number(e.maxFovDeg) || ee.maxFovDeg, 1, 179), e.minFovDeg = O(Number(e.minFovDeg) || ee.minFovDeg, 1, 179), e.minFovDeg > e.maxFovDeg) {
|
|
2569
2585
|
const r = e.minFovDeg;
|
|
@@ -2573,7 +2589,7 @@ function On(t) {
|
|
|
2573
2589
|
Number(e.dualFisheyeSeamBlendDeg) || ee.dualFisheyeSeamBlendDeg,
|
|
2574
2590
|
0,
|
|
2575
2591
|
45
|
|
2576
|
-
), e.dualFisheyeSeamLongitudesDeg =
|
|
2592
|
+
), e.dualFisheyeSeamLongitudesDeg = ia(e.dualFisheyeSeamLongitudesDeg), e.dualFisheyeGainFront = Math.max(0.2, Number(e.dualFisheyeGainFront) || ee.dualFisheyeGainFront), e.dualFisheyeGainBack = Math.max(0.2, Number(e.dualFisheyeGainBack) || ee.dualFisheyeGainBack), e.dualFisheyeAutoGain = e.dualFisheyeAutoGain !== !1, e.dualFisheyeRefineFocal = e.dualFisheyeRefineFocal === !0, e.dualFisheyeVideoRegistration = e.dualFisheyeVideoRegistration === !0, e.dualFisheyeCalibration = e.dualFisheyeCalibration && typeof e.dualFisheyeCalibration == "object" ? e.dualFisheyeCalibration : null;
|
|
2577
2593
|
const i = Number(e.dragYawSign);
|
|
2578
2594
|
e.dragYawSign = i === -1 ? -1 : 1;
|
|
2579
2595
|
const n = Number(e.dragPitchSign);
|
|
@@ -2589,14 +2605,14 @@ function fe(t, e) {
|
|
|
2589
2605
|
me(i && i[1], e[1])
|
|
2590
2606
|
];
|
|
2591
2607
|
}
|
|
2592
|
-
function
|
|
2608
|
+
function Sa(t, e) {
|
|
2593
2609
|
const i = Math.max(1e-4, Number(e) || 0);
|
|
2594
2610
|
return [
|
|
2595
2611
|
me(t && t[0], 0) / i,
|
|
2596
2612
|
me(t && t[1], 0) / i
|
|
2597
2613
|
];
|
|
2598
2614
|
}
|
|
2599
|
-
function
|
|
2615
|
+
function Wn(t, e) {
|
|
2600
2616
|
const i = Math.abs(t[0] - e[0]), n = Math.abs(t[1] - e[1]);
|
|
2601
2617
|
return n > i ? [0.475, Math.max(1e-4, n * 0.475)] : [Math.max(1e-4, i * 0.475), 0.475];
|
|
2602
2618
|
}
|
|
@@ -2604,11 +2620,11 @@ function Nt(t, e) {
|
|
|
2604
2620
|
const i = Array.isArray(t) ? t : e, n = me(i && i[0], e[0]), r = me(i && i[1], e[1]), o = me(i && i[2], e[2]), s = Math.hypot(n, r, o);
|
|
2605
2621
|
return s <= 1e-6 ? e.slice() : [n / s, r / s, o / s];
|
|
2606
2622
|
}
|
|
2607
|
-
function
|
|
2623
|
+
function gn(t, e = [1, 0, 0, 0]) {
|
|
2608
2624
|
const i = Array.isArray(t) ? t : e, n = de(i, e, 4), r = Math.hypot(...n) || 1;
|
|
2609
2625
|
return n.map((o) => o / r);
|
|
2610
2626
|
}
|
|
2611
|
-
function
|
|
2627
|
+
function $s(t, e) {
|
|
2612
2628
|
if (!t || typeof t != "object") return null;
|
|
2613
2629
|
const i = e === "left" ? [0.25, 0.5] : [0.75, 0.5], n = e === "left" ? [0.75, 0.5] : [0.25, 0.5], r = {
|
|
2614
2630
|
center: i,
|
|
@@ -2646,7 +2662,7 @@ function Gs(t, e) {
|
|
|
2646
2662
|
axis: [0, 0, 1],
|
|
2647
2663
|
right: [-1, 0, 0],
|
|
2648
2664
|
up: [0, 1, 0]
|
|
2649
|
-
}, s = t.front && typeof t.front == "object" ? t.front : {}, a = t.back && typeof t.back == "object" ? t.back : {}, c = t.pipeline && typeof t.pipeline == "object" ? t.pipeline : {}, l =
|
|
2665
|
+
}, s = t.front && typeof t.front == "object" ? t.front : {}, a = t.back && typeof t.back == "object" ? t.back : {}, c = t.pipeline && typeof t.pipeline == "object" ? t.pipeline : {}, l = Ys(t.remap), u = String(t.textureOrigin ?? t.texture_origin ?? "").trim().toLowerCase(), f = Ma(t.imageSize ?? t.image_size, [0, 0]), y = fe(s.center, r.center), p = fe(a.center, o.center), h = Wn(y, p);
|
|
2650
2666
|
return {
|
|
2651
2667
|
textureOrigin: u === "top-left" || u === "bottom-left" ? u : "",
|
|
2652
2668
|
imageSize: f,
|
|
@@ -2654,9 +2670,9 @@ function Gs(t, e) {
|
|
|
2654
2670
|
center: y,
|
|
2655
2671
|
focal: fe(s.focal, r.focal),
|
|
2656
2672
|
principalOffset: fe(s.principalOffset, r.principalOffset),
|
|
2657
|
-
rotationQuat:
|
|
2673
|
+
rotationQuat: gn(s.rotationQuat || s.rotation_quat),
|
|
2658
2674
|
scale: fe(s.scale, r.scale),
|
|
2659
|
-
validRadius: fe(s.validRadius || s.valid_radius,
|
|
2675
|
+
validRadius: fe(s.validRadius || s.valid_radius, h),
|
|
2660
2676
|
radial: de(s.radial, r.radial, 4),
|
|
2661
2677
|
radialLUT1: de(s.radialLUT1 || s.radial_lut_1, r.radialLUT1, 14),
|
|
2662
2678
|
radialLUT2: de(s.radialLUT2 || s.radial_lut_2, r.radialLUT2, 14),
|
|
@@ -2678,9 +2694,9 @@ function Gs(t, e) {
|
|
|
2678
2694
|
center: p,
|
|
2679
2695
|
focal: fe(a.focal, o.focal),
|
|
2680
2696
|
principalOffset: fe(a.principalOffset, o.principalOffset),
|
|
2681
|
-
rotationQuat:
|
|
2697
|
+
rotationQuat: gn(a.rotationQuat || a.rotation_quat),
|
|
2682
2698
|
scale: fe(a.scale, o.scale),
|
|
2683
|
-
validRadius: fe(a.validRadius || a.valid_radius,
|
|
2699
|
+
validRadius: fe(a.validRadius || a.valid_radius, h),
|
|
2684
2700
|
radial: de(a.radial, o.radial, 4),
|
|
2685
2701
|
radialLUT1: de(a.radialLUT1 || a.radial_lut_1, o.radialLUT1, 14),
|
|
2686
2702
|
radialLUT2: de(a.radialLUT2 || a.radial_lut_2, o.radialLUT2, 14),
|
|
@@ -2700,28 +2716,28 @@ function Gs(t, e) {
|
|
|
2700
2716
|
},
|
|
2701
2717
|
pipeline: {
|
|
2702
2718
|
featherWidthPx: Math.max(0, Number(c.featherWidthPx) || 0),
|
|
2703
|
-
seamLongitudesDeg:
|
|
2719
|
+
seamLongitudesDeg: ia(c.seamLongitudesDeg)
|
|
2704
2720
|
},
|
|
2705
2721
|
remap: l
|
|
2706
2722
|
};
|
|
2707
2723
|
}
|
|
2708
|
-
function
|
|
2724
|
+
function Ys(t) {
|
|
2709
2725
|
if (!t || typeof t != "object") return null;
|
|
2710
|
-
const e =
|
|
2726
|
+
const e = Ma([t.width, t.height], [1, 1]), i = e[0], n = e[1], r = i * n * 4, o = yn(t.front, r), s = yn(t.back, r);
|
|
2711
2727
|
return !o || !s ? null : {
|
|
2712
2728
|
strategy: "lut_rgba8",
|
|
2713
2729
|
width: i,
|
|
2714
2730
|
height: n,
|
|
2715
2731
|
front: o,
|
|
2716
2732
|
back: s,
|
|
2717
|
-
meshResolution:
|
|
2733
|
+
meshResolution: Ma(t.meshResolution, [32, 16])
|
|
2718
2734
|
};
|
|
2719
2735
|
}
|
|
2720
|
-
function
|
|
2736
|
+
function Qs(t, e) {
|
|
2721
2737
|
const i = Number(t) || 0, n = Number(e) || 0;
|
|
2722
2738
|
return i > 0 && n > i * 1.6 && Math.abs(n / i - 2) <= 0.15;
|
|
2723
2739
|
}
|
|
2724
|
-
function
|
|
2740
|
+
function Hs(t) {
|
|
2725
2741
|
const e = String(t || "").trim();
|
|
2726
2742
|
if (!e) return { r: 0, g: 0, b: 0, a: 1 };
|
|
2727
2743
|
if (e.startsWith("#")) {
|
|
@@ -2751,7 +2767,7 @@ function $s(t) {
|
|
|
2751
2767
|
a: r[4] == null ? 1 : O(Number(r[4]) || 1, 0, 1)
|
|
2752
2768
|
} : { r: 0, g: 0, b: 0, a: 1 };
|
|
2753
2769
|
}
|
|
2754
|
-
function
|
|
2770
|
+
function vn(t, e, i) {
|
|
2755
2771
|
const n = t.createShader(e);
|
|
2756
2772
|
if (!n) throw new Error("createShader failed");
|
|
2757
2773
|
if (t.shaderSource(n, i), t.compileShader(n), !t.getShaderParameter(n, t.COMPILE_STATUS)) {
|
|
@@ -2760,8 +2776,8 @@ function yn(t, e, i) {
|
|
|
2760
2776
|
}
|
|
2761
2777
|
return n;
|
|
2762
2778
|
}
|
|
2763
|
-
function
|
|
2764
|
-
const n =
|
|
2779
|
+
function Js(t, e, i) {
|
|
2780
|
+
const n = vn(t, t.VERTEX_SHADER, e), r = vn(t, t.FRAGMENT_SHADER, i), o = t.createProgram();
|
|
2765
2781
|
if (!o) throw new Error("createProgram failed");
|
|
2766
2782
|
if (t.attachShader(o, n), t.attachShader(o, r), t.linkProgram(o), t.deleteShader(n), t.deleteShader(r), !t.getProgramParameter(o, t.LINK_STATUS)) {
|
|
2767
2783
|
const s = t.getProgramInfoLog(o) || "";
|
|
@@ -2769,7 +2785,7 @@ function Ys(t, e, i) {
|
|
|
2769
2785
|
}
|
|
2770
2786
|
return o;
|
|
2771
2787
|
}
|
|
2772
|
-
function
|
|
2788
|
+
function Yi(t) {
|
|
2773
2789
|
return t ? t instanceof HTMLVideoElement ? {
|
|
2774
2790
|
width: Math.max(1, t.videoWidth || t.clientWidth || 1),
|
|
2775
2791
|
height: Math.max(1, t.videoHeight || t.clientHeight || 1)
|
|
@@ -2781,14 +2797,14 @@ function Xi(t) {
|
|
|
2781
2797
|
height: Math.max(1, t.height || t.clientHeight || 1)
|
|
2782
2798
|
} : { width: 1, height: 1 };
|
|
2783
2799
|
}
|
|
2784
|
-
const z = 128, X = 64,
|
|
2800
|
+
const z = 128, X = 64, Ea = 256, Be = new Int32Array(new Uint8Array([0, 0, 0, 255]).buffer)[0], qn = /* @__PURE__ */ new WeakSet();
|
|
2785
2801
|
function vi(t, e) {
|
|
2786
2802
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
|
|
2787
2803
|
}
|
|
2788
|
-
function
|
|
2804
|
+
function Ks(t, e, i = 1) {
|
|
2789
2805
|
return [t[0] - e[0] * i, t[1] - e[1] * i, t[2] - e[2] * i];
|
|
2790
2806
|
}
|
|
2791
|
-
function
|
|
2807
|
+
function xn(t) {
|
|
2792
2808
|
return Math.hypot(t[0], t[1], t[2]);
|
|
2793
2809
|
}
|
|
2794
2810
|
function Gn(t, e, i = !1) {
|
|
@@ -2799,27 +2815,27 @@ function Gn(t, e, i = !1) {
|
|
|
2799
2815
|
(i ? 1 : -1) * o * Math.cos(n)
|
|
2800
2816
|
];
|
|
2801
2817
|
}
|
|
2802
|
-
function
|
|
2818
|
+
function Zs(t, e = !1) {
|
|
2803
2819
|
const i = Math.atan2(t[0], e ? t[2] : -t[2]), n = Math.asin(O(e ? -t[1] : t[1], -1, 1));
|
|
2804
2820
|
return [
|
|
2805
2821
|
i / (Math.PI * 2) + 0.5,
|
|
2806
2822
|
e ? n / Math.PI + 0.5 : 0.5 - n / Math.PI
|
|
2807
2823
|
];
|
|
2808
2824
|
}
|
|
2809
|
-
function
|
|
2810
|
-
const a = O(n * e - 0.5, 0, e - 1), c = O(r * i - 0.5, 0, i - 1), l = Math.floor(a), u = Math.floor(c), f = Math.min(e - 1, l + 1), y = Math.min(i - 1, u + 1), p = a - l,
|
|
2825
|
+
function Di(t, e, i, n, r, o, s = 0) {
|
|
2826
|
+
const a = O(n * e - 0.5, 0, e - 1), c = O(r * i - 0.5, 0, i - 1), l = Math.floor(a), u = Math.floor(c), f = Math.min(e - 1, l + 1), y = Math.min(i - 1, u + 1), p = a - l, h = c - u;
|
|
2811
2827
|
for (let d = 0; d < 3; d += 1) {
|
|
2812
|
-
const
|
|
2813
|
-
o[s + d] =
|
|
2828
|
+
const m = t[(u * e + l) * 4 + d] * (1 - p) + t[(u * e + f) * 4 + d] * p, g = t[(y * e + l) * 4 + d] * (1 - p) + t[(y * e + f) * 4 + d] * p;
|
|
2829
|
+
o[s + d] = m * (1 - h) + g * h;
|
|
2814
2830
|
}
|
|
2815
2831
|
return o;
|
|
2816
2832
|
}
|
|
2817
|
-
function
|
|
2833
|
+
function ec(t, e, i, n = !1) {
|
|
2818
2834
|
var l;
|
|
2819
2835
|
const { pixels: r, width: o, height: s } = t, { uv: a, weights: c } = e;
|
|
2820
2836
|
if (!n) {
|
|
2821
2837
|
for (let u = 0; u < 2; u++) for (let f = 0; f < c[u].length; f++)
|
|
2822
|
-
c[u][f] > 0 &&
|
|
2838
|
+
c[u][f] > 0 && Di(
|
|
2823
2839
|
r,
|
|
2824
2840
|
o,
|
|
2825
2841
|
s,
|
|
@@ -2834,29 +2850,29 @@ function Js(t, e, i, n = !1) {
|
|
|
2834
2850
|
const u = c.map((f, y) => {
|
|
2835
2851
|
let p = 0;
|
|
2836
2852
|
for (let g = 0; g < f.length; g++) f[g] > 0 && p++;
|
|
2837
|
-
const
|
|
2853
|
+
const h = new Uint32Array(p), d = new Uint32Array(p * 4), m = new Float64Array(p * 2);
|
|
2838
2854
|
for (let g = 0, b = 0; g < f.length; g++) {
|
|
2839
2855
|
if (!(f[g] > 0)) continue;
|
|
2840
2856
|
const x = O(a[y][g * 2] * o - 0.5, 0, o - 1), v = O(a[y][g * 2 + 1] * s - 0.5, 0, s - 1), w = Math.floor(x), S = Math.floor(v), D = Math.min(o - 1, w + 1), F = Math.min(s - 1, S + 1);
|
|
2841
|
-
|
|
2857
|
+
h[b] = g * 3, d[b * 4] = (S * o + w) * 4, d[b * 4 + 1] = (S * o + D) * 4, d[b * 4 + 2] = (F * o + w) * 4, d[b * 4 + 3] = (F * o + D) * 4, m[b * 2] = x - w, m[b * 2 + 1] = v - S, b++;
|
|
2842
2858
|
}
|
|
2843
|
-
return { indices:
|
|
2859
|
+
return { indices: h, taps: d, fractions: m };
|
|
2844
2860
|
});
|
|
2845
2861
|
e.sampling = { width: o, height: s, lenses: u };
|
|
2846
2862
|
}
|
|
2847
2863
|
for (let u = 0; u < 2; u++) {
|
|
2848
|
-
const { indices: f, taps: y, fractions: p } = e.sampling.lenses[u],
|
|
2864
|
+
const { indices: f, taps: y, fractions: p } = e.sampling.lenses[u], h = i[u];
|
|
2849
2865
|
for (let d = 0; d < f.length; d++) {
|
|
2850
|
-
const
|
|
2851
|
-
|
|
2852
|
-
const _ = r[
|
|
2853
|
-
|
|
2854
|
-
const P = r[
|
|
2855
|
-
|
|
2866
|
+
const m = y[d * 4], g = y[d * 4 + 1], b = y[d * 4 + 2], x = y[d * 4 + 3], v = f[d], w = p[d * 2], S = p[d * 2 + 1], D = 1 - w, F = 1 - S, T = r[m] * D + r[g] * w, L = r[b] * D + r[x] * w;
|
|
2867
|
+
h[v] = T * F + L * S;
|
|
2868
|
+
const _ = r[m + 1] * D + r[g + 1] * w, k = r[b + 1] * D + r[x + 1] * w;
|
|
2869
|
+
h[v + 1] = _ * F + k * S;
|
|
2870
|
+
const P = r[m + 2] * D + r[g + 2] * w, E = r[b + 2] * D + r[x + 2] * w;
|
|
2871
|
+
h[v + 2] = P * F + E * S;
|
|
2856
2872
|
}
|
|
2857
2873
|
}
|
|
2858
2874
|
}
|
|
2859
|
-
function
|
|
2875
|
+
function tc(t, e, i) {
|
|
2860
2876
|
if (!t || !(t.front instanceof Uint8Array) || !(t.back instanceof Uint8Array)) return null;
|
|
2861
2877
|
const n = (r) => {
|
|
2862
2878
|
const o = O(Math.round(e * (t.width - 1)), 0, t.width - 1), a = (O(Math.round((1 - i) * (t.height - 1)), 0, t.height - 1) * t.width + o) * 4;
|
|
@@ -2868,62 +2884,62 @@ function Ks(t, e, i) {
|
|
|
2868
2884
|
};
|
|
2869
2885
|
return [n(t.front), n(t.back)];
|
|
2870
2886
|
}
|
|
2871
|
-
function
|
|
2887
|
+
function ic(t, e) {
|
|
2872
2888
|
const i = Math.cos(e[0]), n = Math.sin(e[0]), r = Math.cos(e[1]), o = Math.sin(e[1]), s = r * t[0] + o * n * t[1] - o * i, a = i * t[1] + n, c = o * t[0] - r * n * t[1] + r * i, l = Math.abs(c) > 1e-6 ? c : c < 0 ? -1e-6 : 1e-6;
|
|
2873
2889
|
return [i * (r * s + o * c) / l, (r * i * a - n * c) / l];
|
|
2874
2890
|
}
|
|
2875
2891
|
function St(t, e, i, n, r, o, s = 0) {
|
|
2876
2892
|
var p;
|
|
2877
2893
|
const a = n && Array.isArray(e.rotationQuat) ? (() => {
|
|
2878
|
-
const
|
|
2894
|
+
const h = Ba(
|
|
2879
2895
|
{ w: e.rotationQuat[0], x: -e.rotationQuat[1], y: -e.rotationQuat[2], z: -e.rotationQuat[3] },
|
|
2880
2896
|
t[0],
|
|
2881
2897
|
t[1],
|
|
2882
2898
|
t[2]
|
|
2883
2899
|
);
|
|
2884
|
-
return [
|
|
2900
|
+
return [h.x, h.y, h.z];
|
|
2885
2901
|
})() : [vi(t, e.right), -vi(t, e.up), vi(t, e.axis)];
|
|
2886
2902
|
if (n && s > 0) {
|
|
2887
2903
|
for (let d = 0; d < 3; d += 1) a[d] = a[d] * s + (((p = e.translationM) == null ? void 0 : p[d]) || 0);
|
|
2888
|
-
const
|
|
2889
|
-
if (
|
|
2890
|
-
for (let d = 0; d < 3; d += 1) a[d] /=
|
|
2904
|
+
const h = xn(a);
|
|
2905
|
+
if (h <= 1e-9) return null;
|
|
2906
|
+
for (let d = 0; d < 3; d += 1) a[d] /= h;
|
|
2891
2907
|
}
|
|
2892
2908
|
const c = a[2], l = r ? Math.atan2(Math.hypot(a[0], a[1]), c) : Math.acos(O(c, -1, 1));
|
|
2893
2909
|
if (!n && l > i || r && l >= 96 * Math.PI / 180) return null;
|
|
2894
2910
|
let u;
|
|
2895
2911
|
if (n) {
|
|
2896
|
-
const
|
|
2897
|
-
if (
|
|
2898
|
-
const d = a[0] /
|
|
2912
|
+
const h = a[2] + e.xi;
|
|
2913
|
+
if (h <= 1e-6) return null;
|
|
2914
|
+
const d = a[0] / h, m = a[1] / h, g = d * d + m * m;
|
|
2899
2915
|
if (g > 16) return null;
|
|
2900
|
-
const b = g * g, x = 1 + e.radial[0] * g + e.radial[1] * b + e.radial[2] * g * b + e.radial[3] * b * b, v = e.distortionModel === "radtan_pro" ?
|
|
2901
|
-
d * x + 2 * e.tangential[0] * d *
|
|
2902
|
-
|
|
2916
|
+
const b = g * g, x = 1 + e.radial[0] * g + e.radial[1] * b + e.radial[2] * g * b + e.radial[3] * b * b, v = e.distortionModel === "radtan_pro" ? ac(d, m, e.distortionCoeffs) : ic([
|
|
2917
|
+
d * x + 2 * e.tangential[0] * d * m + e.tangential[1] * (g + 2 * d * d) + e.thinPrism[0] * g + e.thinPrism[1] * b,
|
|
2918
|
+
m * x + e.tangential[0] * (g + 2 * m * m) + 2 * e.tangential[1] * d * m + e.thinPrism[2] * g + e.thinPrism[3] * b
|
|
2903
2919
|
], e.sensorTilt || [0, 0]);
|
|
2904
2920
|
u = [
|
|
2905
2921
|
e.center[0] + e.principalOffset[0] + e.focal[0] * v[0],
|
|
2906
2922
|
e.center[1] + e.principalOffset[1] + e.focal[1] * v[1]
|
|
2907
2923
|
];
|
|
2908
2924
|
} else if (r) {
|
|
2909
|
-
const
|
|
2910
|
-
if (
|
|
2925
|
+
const h = Math.hypot(a[0], a[1]);
|
|
2926
|
+
if (h <= 1e-6)
|
|
2911
2927
|
u = [e.center[0] + e.principalOffset[0], e.center[1] + e.principalOffset[1]];
|
|
2912
2928
|
else if (e.distortionModel === "dji_fisheye_5") {
|
|
2913
|
-
const d = l * l,
|
|
2929
|
+
const d = l * l, m = e.distortionCoeffs, g = l * (1 + d * (m[0] + d * (m[1] + d * (m[2] + d * (m[3] + d * m[4]))))), b = g * a[0] / h, x = g * a[1] / h, v = b * b + x * x, [w, S] = e.tangential;
|
|
2914
2930
|
u = [
|
|
2915
2931
|
e.center[0] + e.principalOffset[0] + e.focal[0] * (b + 2 * w * b * x + S * (v + 2 * b * b)),
|
|
2916
2932
|
e.center[1] + e.principalOffset[1] + e.focal[1] * (x + w * (v + 2 * x * x) + 2 * S * b * x)
|
|
2917
2933
|
];
|
|
2918
2934
|
} else {
|
|
2919
|
-
const d = 85 * Math.PI / 180,
|
|
2935
|
+
const d = 85 * Math.PI / 180, m = Math.min(l, d), g = m * m, b = m * (1 + e.radial[0] * g + e.radial[1] * g * g + e.radial[2] * g * g * g + e.radial[3] * g * g * g * g), x = 1 + 3 * e.radial[0] * g + 5 * e.radial[1] * g * g + 7 * e.radial[2] * g * g * g + 9 * e.radial[3] * g * g * g * g, v = o * (l > d ? b + x * (l - d) : b);
|
|
2920
2936
|
u = [
|
|
2921
|
-
e.center[0] + e.principalOffset[0] + e.focal[0] * v * a[0] /
|
|
2922
|
-
e.center[1] + e.principalOffset[1] + e.focal[1] * v * a[1] /
|
|
2937
|
+
e.center[0] + e.principalOffset[0] + e.focal[0] * v * a[0] / h,
|
|
2938
|
+
e.center[1] + e.principalOffset[1] + e.focal[1] * v * a[1] / h
|
|
2923
2939
|
];
|
|
2924
2940
|
}
|
|
2925
2941
|
} else {
|
|
2926
|
-
const
|
|
2942
|
+
const h = Ks(t, e.axis, c), d = xn(h), m = d > 1e-5 ? [vi(h, e.right) / d, -vi(h, e.up) / d] : [0, 0], g = l * l, b = e.radial || [0, 0, 0, 0], x = l * (1 + b[0] * g + b[1] * g ** 2 + b[2] * g ** 3 + b[3] * g ** 4), v = x * m[0], w = x * m[1], S = v * v + w * w, D = e.tangential || [0, 0], F = e.asymmetric || [0, 0, 0, 0], T = 2 * D[0] * v * w + D[1] * (S + 2 * v * v), L = D[0] * (S + 2 * w * w) + 2 * D[1] * v * w, _ = F[0] * v + F[1] * w, k = F[2] * v + F[3] * w, P = e.focal || Sa(e.scale, i), E = e.principalOffset || [0, 0];
|
|
2927
2943
|
u = [
|
|
2928
2944
|
e.center[0] + E[0] + P[0] * (v + T + _),
|
|
2929
2945
|
e.center[1] + E[1] + P[1] * (w + L + k)
|
|
@@ -2933,23 +2949,23 @@ function St(t, e, i, n, r, o, s = 0) {
|
|
|
2933
2949
|
const f = e.validRadius || [0.475, 0.475], y = Math.max(1 - Math.hypot((u[0] - e.center[0]) / Math.max(1e-4, f[0]), (u[1] - e.center[1]) / Math.max(1e-4, f[1])), 0);
|
|
2934
2950
|
return y <= 0 || u[0] < 0 || u[1] < 0 || u[0] > 1 || u[1] > 1 ? null : { uv: u, confidence: y };
|
|
2935
2951
|
}
|
|
2936
|
-
function
|
|
2952
|
+
function ac(t, e, i) {
|
|
2937
2953
|
const n = t * t + e * e, r = n * n, o = 1 + i[0] * n + i[1] * r + i[2] * n * r + i[3] * r * r + i[4] * r * r * n, s = i[5] + i[7] * n, a = i[6] + i[8] * n;
|
|
2938
2954
|
return [
|
|
2939
2955
|
t * o + (n + 2 * t * t) * s + 2 * t * e * a + i[9] * n + i[11] * r,
|
|
2940
2956
|
e * o + (n + 2 * e * e) * a + 2 * t * e * s + i[10] * n + i[12] * r
|
|
2941
2957
|
];
|
|
2942
2958
|
}
|
|
2943
|
-
function
|
|
2944
|
-
var p,
|
|
2945
|
-
const o = e * i, s = ((p = r == null ? void 0 : r.dp) == null ? void 0 : p.length) === e * 2 ? r.dp : new Float64Array(e * 2), a = ((
|
|
2959
|
+
function Xn(t, e, i, n = 2, r = null) {
|
|
2960
|
+
var p, h;
|
|
2961
|
+
const o = e * i, s = ((p = r == null ? void 0 : r.dp) == null ? void 0 : p.length) === e * 2 ? r.dp : new Float64Array(e * 2), a = ((h = r == null ? void 0 : r.parents) == null ? void 0 : h.length) === o ? r.parents : new Int16Array(o);
|
|
2946
2962
|
r && (r.dp = s, r.parents = a);
|
|
2947
2963
|
let c = 0, l = e;
|
|
2948
2964
|
for (let d = 0; d < e; d += 1) s[d] = t[d] < 65535 ? t[d] : Number.POSITIVE_INFINITY;
|
|
2949
2965
|
for (let d = 1; d < i; d += 1) {
|
|
2950
|
-
const
|
|
2966
|
+
const m = d * e;
|
|
2951
2967
|
for (let b = 0; b < e; b += 1) {
|
|
2952
|
-
const x = t[
|
|
2968
|
+
const x = t[m + b];
|
|
2953
2969
|
if (!Number.isFinite(x) || x >= 65535) {
|
|
2954
2970
|
s[l + b] = Number.POSITIVE_INFINITY;
|
|
2955
2971
|
continue;
|
|
@@ -2960,7 +2976,7 @@ function qn(t, e, i, n = 2, r = null) {
|
|
|
2960
2976
|
const T = s[c + F];
|
|
2961
2977
|
T < v && (v = T, w = F);
|
|
2962
2978
|
}
|
|
2963
|
-
s[l + b] = v + x, w >= 0 && (a[
|
|
2979
|
+
s[l + b] = v + x, w >= 0 && (a[m + b] = w);
|
|
2964
2980
|
}
|
|
2965
2981
|
const g = c;
|
|
2966
2982
|
c = l, l = g;
|
|
@@ -2972,13 +2988,13 @@ function qn(t, e, i, n = 2, r = null) {
|
|
|
2972
2988
|
const y = new Array(i);
|
|
2973
2989
|
y[i - 1] = u;
|
|
2974
2990
|
for (let d = i - 1; d > 0; d -= 1) {
|
|
2975
|
-
const
|
|
2976
|
-
if (
|
|
2977
|
-
y[d - 1] =
|
|
2991
|
+
const m = a[d * e + y[d]];
|
|
2992
|
+
if (m < 0) return null;
|
|
2993
|
+
y[d - 1] = m;
|
|
2978
2994
|
}
|
|
2979
2995
|
return { seam: y, cost: f };
|
|
2980
2996
|
}
|
|
2981
|
-
function
|
|
2997
|
+
function rc(t) {
|
|
2982
2998
|
const e = t.slice();
|
|
2983
2999
|
for (let i = 0; i < X; i += 1)
|
|
2984
3000
|
for (let n = 0; n < z; n += 1) {
|
|
@@ -2989,16 +3005,16 @@ function tc(t) {
|
|
|
2989
3005
|
}
|
|
2990
3006
|
return e;
|
|
2991
3007
|
}
|
|
2992
|
-
function
|
|
3008
|
+
function nc(t, e, i) {
|
|
2993
3009
|
const n = new Uint8Array(z * X);
|
|
2994
3010
|
for (let r = 0; r < X; r += 1) {
|
|
2995
3011
|
let o = t[1][r * z] > t[0][r * z];
|
|
2996
3012
|
for (let s = 0; s < z; s += 1)
|
|
2997
3013
|
(s === e[r] || s === i[r]) && (o = !o), n[r * z + s] = o ? 255 : 0;
|
|
2998
3014
|
}
|
|
2999
|
-
return
|
|
3015
|
+
return rc(n);
|
|
3000
3016
|
}
|
|
3001
|
-
function
|
|
3017
|
+
function oc(t, e, i, n) {
|
|
3002
3018
|
if (!t) return null;
|
|
3003
3019
|
const r = [new Float32Array(t.length), new Float32Array(t.length)];
|
|
3004
3020
|
for (let s = 0; s < X; s += 1) for (let a = 0; a < z; a += 1) {
|
|
@@ -3006,8 +3022,8 @@ function ac(t, e, i, n) {
|
|
|
3006
3022
|
if (i[0][c] <= 0 || i[1][c] <= 0) continue;
|
|
3007
3023
|
const l = i[0][c] > i[1][c] ? 0 : 1, u = 1 - l;
|
|
3008
3024
|
if (i[l][c] < i[u][c] * 1.5) continue;
|
|
3009
|
-
const f = c * 3, y = e[l], p = e[u],
|
|
3010
|
-
if (x < 32 ||
|
|
3025
|
+
const f = c * 3, y = e[l], p = e[u], h = n[l], d = n[u], m = y[f] * h, g = y[f + 1] * h, b = y[f + 2] * h, x = Math.abs(m - p[f] * d) / 3 + Math.abs(g - p[f + 1] * d) / 3 + Math.abs(b - p[f + 2] * d) / 3;
|
|
3026
|
+
if (x < 32 || m * 0.2126 + g * 0.7152 + b * 0.0722 < 24) continue;
|
|
3011
3027
|
const v = (i[l][c] - i[u][c]) * Math.min(1, x / 64);
|
|
3012
3028
|
for (let w = -2; w <= 2; w += 1) {
|
|
3013
3029
|
const S = s + w;
|
|
@@ -3025,8 +3041,8 @@ function ac(t, e, i, n) {
|
|
|
3025
3041
|
if (i[1 - a][s] > 0) {
|
|
3026
3042
|
const c = s * 3, l = e[a], u = n[a], f = l[c] * u * 0.2126 + l[c + 1] * u * 0.7152 + l[c + 2] * u * 0.0722;
|
|
3027
3043
|
if (f < 12) {
|
|
3028
|
-
const y = e[1 - a], p = n[1 - a],
|
|
3029
|
-
if (
|
|
3044
|
+
const y = e[1 - a], p = n[1 - a], h = y[c] * p * 0.2126 + y[c + 1] * p * 0.7152 + y[c + 2] * p * 0.0722;
|
|
3045
|
+
if (h > 24 && f < h * 0.25) continue;
|
|
3030
3046
|
}
|
|
3031
3047
|
}
|
|
3032
3048
|
o[s] = a === 0 ? 0 : 255;
|
|
@@ -3034,7 +3050,7 @@ function ac(t, e, i, n) {
|
|
|
3034
3050
|
}
|
|
3035
3051
|
return o;
|
|
3036
3052
|
}
|
|
3037
|
-
function
|
|
3053
|
+
function sc(t, e, i) {
|
|
3038
3054
|
const n = new Uint8Array(z * X);
|
|
3039
3055
|
for (let r = 0; r < X; r++) for (let o = 0; o < z; o++) {
|
|
3040
3056
|
const s = r * z + o;
|
|
@@ -3057,7 +3073,7 @@ function rc(t, e, i) {
|
|
|
3057
3073
|
}
|
|
3058
3074
|
return n;
|
|
3059
3075
|
}
|
|
3060
|
-
function
|
|
3076
|
+
function cc(t) {
|
|
3061
3077
|
const e = z, i = X, n = new Uint8Array(e * i);
|
|
3062
3078
|
for (let r = 0; r < i; r++) for (let o = 0; o < e; o++) {
|
|
3063
3079
|
const s = r * e + o;
|
|
@@ -3069,23 +3085,23 @@ function nc(t) {
|
|
|
3069
3085
|
}
|
|
3070
3086
|
return n;
|
|
3071
3087
|
}
|
|
3072
|
-
function
|
|
3088
|
+
function lc(t, e, i) {
|
|
3073
3089
|
const n = z, r = X, o = new Float64Array(n * 5), s = new Float64Array(n), a = new Float32Array(n * r);
|
|
3074
3090
|
for (let c = 0; c < r; c++) {
|
|
3075
3091
|
const l = c * n, u = c % 5 * n, f = (c - 2) * n;
|
|
3076
3092
|
let y = 0;
|
|
3077
3093
|
for (let p = -2; p <= 2; p++) {
|
|
3078
|
-
const
|
|
3079
|
-
e[
|
|
3094
|
+
const h = l + (p + n) % n;
|
|
3095
|
+
e[h] > 0 && (y += t[h]);
|
|
3080
3096
|
}
|
|
3081
3097
|
for (let p = 0; p < n; p++) {
|
|
3082
|
-
let
|
|
3083
|
-
if (c >= 5 && (
|
|
3098
|
+
let h = s[p];
|
|
3099
|
+
if (c >= 5 && (h -= o[u + p]), o[u + p] = y, h += y, s[p] = h, c >= 2) {
|
|
3084
3100
|
const g = f + p;
|
|
3085
|
-
e[g] > 0 && (a[g] = Math.abs(t[g] -
|
|
3101
|
+
e[g] > 0 && (a[g] = Math.abs(t[g] - h / Math.max(i[g], 1)));
|
|
3086
3102
|
}
|
|
3087
|
-
const d = l + (p + n - 2) % n,
|
|
3088
|
-
e[d] > 0 && (y -= t[d]), e[
|
|
3103
|
+
const d = l + (p + n - 2) % n, m = l + (p + 3) % n;
|
|
3104
|
+
e[d] > 0 && (y -= t[d]), e[m] > 0 && (y += t[m]);
|
|
3089
3105
|
}
|
|
3090
3106
|
}
|
|
3091
3107
|
for (let c = r - 2; c < r; c++) {
|
|
@@ -3099,68 +3115,68 @@ function oc(t, e, i) {
|
|
|
3099
3115
|
}
|
|
3100
3116
|
return a;
|
|
3101
3117
|
}
|
|
3102
|
-
function
|
|
3103
|
-
if (i) return
|
|
3118
|
+
function uc(t, e, i = null) {
|
|
3119
|
+
if (i) return lc(t, e, i);
|
|
3104
3120
|
const n = z, r = X, o = n * r, s = new Float64Array(n * 5), a = new Uint8Array(n * 5), c = new Float64Array(n), l = new Uint8Array(n), u = new Float32Array(o);
|
|
3105
3121
|
for (let f = 0; f < r; f++) {
|
|
3106
|
-
const y = f * n, p = f % 5 * n,
|
|
3107
|
-
let d = 0,
|
|
3122
|
+
const y = f * n, p = f % 5 * n, h = (f - 2) * n;
|
|
3123
|
+
let d = 0, m = 0;
|
|
3108
3124
|
for (let g = -2; g <= 2; g++) {
|
|
3109
3125
|
const b = y + (g + n) % n;
|
|
3110
|
-
e[b] > 0 && (d += t[b],
|
|
3126
|
+
e[b] > 0 && (d += t[b], m++);
|
|
3111
3127
|
}
|
|
3112
3128
|
for (let g = 0; g < n; g++) {
|
|
3113
3129
|
let b = c[g], x = l[g];
|
|
3114
|
-
if (f >= 5 && (b -= s[p + g], x -= a[p + g]), s[p + g] = d, a[p + g] =
|
|
3115
|
-
const S =
|
|
3130
|
+
if (f >= 5 && (b -= s[p + g], x -= a[p + g]), s[p + g] = d, a[p + g] = m, b += d, x += m, c[g] = b, l[g] = x, f >= 2) {
|
|
3131
|
+
const S = h + g;
|
|
3116
3132
|
e[S] > 0 && (u[S] = Math.abs(t[S] - b / Math.max(x, 1)));
|
|
3117
3133
|
}
|
|
3118
3134
|
const v = y + (g + n - 2) % n, w = y + (g + 3) % n;
|
|
3119
|
-
e[v] > 0 && (d -= t[v],
|
|
3135
|
+
e[v] > 0 && (d -= t[v], m--), e[w] > 0 && (d += t[w], m++);
|
|
3120
3136
|
}
|
|
3121
3137
|
}
|
|
3122
3138
|
for (let f = r - 2; f < r; f++) {
|
|
3123
3139
|
const y = f * n, p = (f - 3) % 5 * n;
|
|
3124
|
-
for (let
|
|
3125
|
-
const d = c[
|
|
3126
|
-
c[
|
|
3127
|
-
const g = y +
|
|
3128
|
-
e[g] > 0 && (u[g] = Math.abs(t[g] - d / Math.max(
|
|
3140
|
+
for (let h = 0; h < n; h++) {
|
|
3141
|
+
const d = c[h] - s[p + h], m = l[h] - a[p + h];
|
|
3142
|
+
c[h] = d, l[h] = m;
|
|
3143
|
+
const g = y + h;
|
|
3144
|
+
e[g] > 0 && (u[g] = Math.abs(t[g] - d / Math.max(m, 1)));
|
|
3129
3145
|
}
|
|
3130
3146
|
}
|
|
3131
3147
|
return u;
|
|
3132
3148
|
}
|
|
3133
|
-
function
|
|
3149
|
+
function dc(t) {
|
|
3134
3150
|
const e = z, i = X, n = e >>> 5, r = new Uint8Array(e * i);
|
|
3135
3151
|
for (let o = 2; o < i - 2; o++) for (let s = 0; s < n; s++) {
|
|
3136
3152
|
const a = (o - 1) * n, c = a + s, l = a + (s + n - 1) % n, u = a + (s + 1) % n, f = t[c] | t[c + n] | t[c + n * 2], y = t[l] | t[l + n] | t[l + n * 2], p = t[u] | t[u + n] | t[u + n * 2];
|
|
3137
|
-
let
|
|
3138
|
-
for (;
|
|
3139
|
-
const d = 31 - Math.clz32(
|
|
3140
|
-
r[o * e + s * 32 + d] = 1,
|
|
3153
|
+
let h = f | f << 1 | f >>> 1 | y >>> 31 | p << 31;
|
|
3154
|
+
for (; h; ) {
|
|
3155
|
+
const d = 31 - Math.clz32(h & -h);
|
|
3156
|
+
r[o * e + s * 32 + d] = 1, h &= h - 1;
|
|
3141
3157
|
}
|
|
3142
3158
|
}
|
|
3143
3159
|
return r;
|
|
3144
3160
|
}
|
|
3145
|
-
function
|
|
3146
|
-
const o = z, s = X, a = o * s, c = e.map((d,
|
|
3147
|
-
const g = new Float32Array(a), b = n[
|
|
3161
|
+
function fc(t, e, i, n, r = null) {
|
|
3162
|
+
const o = z, s = X, a = o * s, c = e.map((d, m) => {
|
|
3163
|
+
const g = new Float32Array(a), b = n[m];
|
|
3148
3164
|
for (let x = 0; x < a; x++) {
|
|
3149
3165
|
const v = x * 3;
|
|
3150
3166
|
g[x] = (d[v] * 0.2126 + d[v + 1] * 0.7152 + d[v + 2] * 0.0722) * b;
|
|
3151
3167
|
}
|
|
3152
3168
|
return g;
|
|
3153
|
-
}), l = r ? r.contrastSampleCounts || (r.contrastSampleCounts = i.map(
|
|
3169
|
+
}), l = r ? r.contrastSampleCounts || (r.contrastSampleCounts = i.map(cc)) : null, u = c.map((d, m) => uc(d, i[m], l == null ? void 0 : l[m])), f = new Uint32Array(a >>> 5);
|
|
3154
3170
|
for (let d = 0; d < a; d++)
|
|
3155
3171
|
i[0][d] <= 0 || i[1][d] <= 0 || Math.abs(c[0][d] - c[1][d]) < 12 || Math.max(u[0][d], u[1][d]) < 12 || (f[d >>> 5] |= 1 << (d & 31));
|
|
3156
|
-
const y =
|
|
3172
|
+
const y = dc(f), p = t.slice(), h = new Int32Array(a);
|
|
3157
3173
|
for (let d = 0; d < a; d++) {
|
|
3158
3174
|
if (y[d] !== 1) continue;
|
|
3159
|
-
let
|
|
3160
|
-
|
|
3175
|
+
let m = 1;
|
|
3176
|
+
h[0] = d, y[d] = 2;
|
|
3161
3177
|
const g = [0, 0];
|
|
3162
|
-
for (let v = 0; v <
|
|
3163
|
-
const w =
|
|
3178
|
+
for (let v = 0; v < m; v++) {
|
|
3179
|
+
const w = h[v], S = w % o, D = Math.floor(w / o);
|
|
3164
3180
|
if (i[0][w] > 0 && i[1][w] > 0 && Math.abs(c[0][w] - c[1][w]) >= 12)
|
|
3165
3181
|
for (let F = 0; F < 2; F++) g[F] += u[F][w] * i[F][w] ** 2;
|
|
3166
3182
|
for (const F of [
|
|
@@ -3169,18 +3185,18 @@ function lc(t, e, i, n, r = null) {
|
|
|
3169
3185
|
D * o + (S + o - 1) % o,
|
|
3170
3186
|
D * o + (S + 1) % o
|
|
3171
3187
|
])
|
|
3172
|
-
F < 0 || y[F] !== 1 || (y[F] = 2, m
|
|
3188
|
+
F < 0 || y[F] !== 1 || (y[F] = 2, h[m++] = F);
|
|
3173
3189
|
}
|
|
3174
3190
|
const b = g[0] > g[1] ? 0 : 1, x = 1 - b;
|
|
3175
3191
|
if (!(g[b] <= 0 || g[b] < g[x] * 1.15))
|
|
3176
|
-
for (let v = 0; v <
|
|
3177
|
-
const w =
|
|
3192
|
+
for (let v = 0; v < m; v++) {
|
|
3193
|
+
const w = h[v];
|
|
3178
3194
|
i[b][w] <= 0 || c[b][w] < 4 && c[x][w] > 24 || (p[w] = b === 0 ? 0 : 255);
|
|
3179
3195
|
}
|
|
3180
3196
|
}
|
|
3181
3197
|
return p;
|
|
3182
3198
|
}
|
|
3183
|
-
function
|
|
3199
|
+
function hc() {
|
|
3184
3200
|
const t = (n, r) => typeof OffscreenCanvas < "u" ? new OffscreenCanvas(n, r) : Object.assign(document.createElement("canvas"), { width: n, height: r }), e = t(32, 2), i = t(16, 1);
|
|
3185
3201
|
try {
|
|
3186
3202
|
const n = e.getContext("2d", { willReadFrequently: !0 }), r = i.getContext("2d", { willReadFrequently: !0 });
|
|
@@ -3206,7 +3222,7 @@ function uc() {
|
|
|
3206
3222
|
e.width = e.height = i.width = i.height = 0;
|
|
3207
3223
|
}
|
|
3208
3224
|
}
|
|
3209
|
-
function
|
|
3225
|
+
function bn(t, e = 0) {
|
|
3210
3226
|
const i = new Uint8Array(524288);
|
|
3211
3227
|
if (!t) i.fill(1);
|
|
3212
3228
|
else {
|
|
@@ -3232,28 +3248,28 @@ function vn(t, e = 0) {
|
|
|
3232
3248
|
}
|
|
3233
3249
|
return r;
|
|
3234
3250
|
}
|
|
3235
|
-
function
|
|
3236
|
-
if ((t == null ? void 0 : t.length) !== 2 || t.some((p) => !p || p.width < 1024 || p.width !== p.height || !ArrayBuffer.isView(p.data) || p.data.length !== p.width * p.height * 4 || p.colorSpace && p.colorSpace !== "srgb") || (e.bias === void 0 && (e.bias =
|
|
3251
|
+
function mc(t, e, i = null, n = null) {
|
|
3252
|
+
if ((t == null ? void 0 : t.length) !== 2 || t.some((p) => !p || p.width < 1024 || p.width !== p.height || !ArrayBuffer.isView(p.data) || p.data.length !== p.width * p.height * 4 || p.colorSpace && p.colorSpace !== "srgb") || (e.bias === void 0 && (e.bias = hc()), e.bias === null)) return null;
|
|
3237
3253
|
const r = e.bias, o = +(t[0].width === 1024) | +(t[1].width === 1024) << 1;
|
|
3238
|
-
!e.selection || e.selection.map !== n ? (e.selection = { map: n, nativeMask: o, targets:
|
|
3254
|
+
!e.selection || e.selection.map !== n ? (e.selection = { map: n, nativeMask: o, targets: bn(n, o) }, e.buffers = [], e.plans = []) : e.selection.nativeMask !== o && (e.selection = { map: n, nativeMask: o, targets: bn(n, o) });
|
|
3239
3255
|
const s = e.buffers || (e.buffers = []), a = (i == null ? void 0 : i.pixels) === s[0] ? 1 : 0, c = s[a] || (s[a] = new Uint8ClampedArray(1024 * 512 * 4)), l = new Uint32Array(c.buffer, c.byteOffset, c.byteLength / 4), u = r * 65537, f = r * 16843009, y = e.plans || (e.plans = []);
|
|
3240
3256
|
for (let p = 0; p < 2; p++) {
|
|
3241
|
-
const
|
|
3257
|
+
const h = t[p], d = h.data, m = h.width, g = e.selection.targets[p], b = m === 1024;
|
|
3242
3258
|
let x = y[p];
|
|
3243
|
-
if ((x == null ? void 0 : x.width) !==
|
|
3259
|
+
if ((x == null ? void 0 : x.width) !== m)
|
|
3244
3260
|
if (b)
|
|
3245
|
-
x = y[p] = { width:
|
|
3261
|
+
x = y[p] = { width: m };
|
|
3246
3262
|
else {
|
|
3247
|
-
const F = Uint32Array.from({ length: 1024 }, (k, P) => Math.floor(P *
|
|
3263
|
+
const F = Uint32Array.from({ length: 1024 }, (k, P) => Math.floor(P * m / 1024)), T = new Uint32Array(g.length), L = new Uint32Array(512), _ = new Uint32Array(512);
|
|
3248
3264
|
for (let k = 0; k < 512; k++) {
|
|
3249
3265
|
const P = F[k * 2 + 1] - F[k * 2];
|
|
3250
|
-
L[k] = P, _[k] = P *
|
|
3266
|
+
L[k] = P, _[k] = P * m;
|
|
3251
3267
|
}
|
|
3252
3268
|
for (let k = 0; k < g.length; k++) {
|
|
3253
3269
|
const P = g[k] >>> 2, E = P & 511, j = P >>> 10;
|
|
3254
|
-
T[k] = F[j * 2] *
|
|
3270
|
+
T[k] = F[j * 2] * m + F[E * 2];
|
|
3255
3271
|
}
|
|
3256
|
-
x = y[p] = { width:
|
|
3272
|
+
x = y[p] = { width: m, origins: T, columns: L, rows: _ };
|
|
3257
3273
|
}
|
|
3258
3274
|
const { origins: v, columns: w, rows: S } = x, D = (d instanceof Uint8Array || d instanceof Uint8ClampedArray) && d.byteOffset % 4 === 0 ? new Uint32Array(d.buffer, d.byteOffset, d.byteLength / 4) : null;
|
|
3259
3275
|
if (D) {
|
|
@@ -3263,8 +3279,8 @@ function dc(t, e, i = null, n = null) {
|
|
|
3263
3279
|
for (let L = F * 2048, _ = F * 1024 + p * 512; L < T; L += 8, _ += 4) {
|
|
3264
3280
|
const k = D[L], P = D[L + 1], E = D[L + 1024], j = D[L + 1025];
|
|
3265
3281
|
if ((k & P & E & j & Be) !== Be) return null;
|
|
3266
|
-
const
|
|
3267
|
-
l[_] =
|
|
3282
|
+
const q = ((k & 4244438268) >>> 2) + ((P & 4244438268) >>> 2) + ((E & 4244438268) >>> 2) + ((j & 4244438268) >>> 2), G = (k & 50529027) + (P & 50529027) + (E & 50529027) + (j & 50529027) + f >>> 2 & 50529027;
|
|
3283
|
+
l[_] = q + G;
|
|
3268
3284
|
const te = D[L + 4], ne = D[L + 5], ue = D[L + 1028], J = D[L + 1029];
|
|
3269
3285
|
if ((te & ne & ue & J & Be) !== Be) return null;
|
|
3270
3286
|
const Z = ((te & 4244438268) >>> 2) + ((ne & 4244438268) >>> 2) + ((ue & 4244438268) >>> 2) + ((J & 4244438268) >>> 2), Tt = (te & 50529027) + (ne & 50529027) + (ue & 50529027) + (J & 50529027) + f >>> 2 & 50529027;
|
|
@@ -3274,50 +3290,50 @@ function dc(t, e, i = null, n = null) {
|
|
|
3274
3290
|
for (let F = n ? 65536 : 0; F < g.length; F++) {
|
|
3275
3291
|
const T = g[F] >>> 2, L = (T & -513) * 2, _ = L + 1, k = D[L], P = D[_], E = D[L + 1024], j = D[_ + 1024];
|
|
3276
3292
|
if ((k & P & E & j & Be) !== Be) return null;
|
|
3277
|
-
const
|
|
3278
|
-
l[T] =
|
|
3293
|
+
const q = ((k & 4244438268) >>> 2) + ((P & 4244438268) >>> 2) + ((E & 4244438268) >>> 2) + ((j & 4244438268) >>> 2), G = (k & 50529027) + (P & 50529027) + (E & 50529027) + (j & 50529027) + f >>> 2 & 50529027;
|
|
3294
|
+
l[T] = q + G;
|
|
3279
3295
|
}
|
|
3280
3296
|
continue;
|
|
3281
3297
|
}
|
|
3282
|
-
if (
|
|
3283
|
-
const F = Math.floor(
|
|
3298
|
+
if (m % 512 === 0) {
|
|
3299
|
+
const F = Math.floor(m / 1024), T = F * m;
|
|
3284
3300
|
for (let L = 0; L < g.length; L++) {
|
|
3285
|
-
const _ = g[L] >>> 2, k = v[L], P = k + F, E = D[k], j = D[P],
|
|
3286
|
-
if ((E & j &
|
|
3287
|
-
const te = (E & 16711935) + (j & 16711935) + (
|
|
3301
|
+
const _ = g[L] >>> 2, k = v[L], P = k + F, E = D[k], j = D[P], q = D[k + T], G = D[P + T];
|
|
3302
|
+
if ((E & j & q & G & Be) !== Be) return null;
|
|
3303
|
+
const te = (E & 16711935) + (j & 16711935) + (q & 16711935) + (G & 16711935) + u, ne = (E >>> 8 & 16711935) + (j >>> 8 & 16711935) + (q >>> 8 & 16711935) + (G >>> 8 & 16711935) + u;
|
|
3288
3304
|
l[_] = te >>> 2 & 16711935 | (ne >>> 2 & 16711935) << 8;
|
|
3289
3305
|
}
|
|
3290
3306
|
continue;
|
|
3291
3307
|
}
|
|
3292
3308
|
for (let F = 0; F < g.length; F++) {
|
|
3293
|
-
const T = g[F] >>> 2, L = v[F], _ = L + w[T & 511], k = S[T >>> 10], P = D[L], E = D[_], j = D[L + k],
|
|
3294
|
-
if ((P & E & j &
|
|
3295
|
-
const
|
|
3296
|
-
l[T] =
|
|
3309
|
+
const T = g[F] >>> 2, L = v[F], _ = L + w[T & 511], k = S[T >>> 10], P = D[L], E = D[_], j = D[L + k], q = D[_ + k];
|
|
3310
|
+
if ((P & E & j & q & Be) !== Be) return null;
|
|
3311
|
+
const G = (P & 16711935) + (E & 16711935) + (j & 16711935) + (q & 16711935) + u, te = (P >>> 8 & 16711935) + (E >>> 8 & 16711935) + (j >>> 8 & 16711935) + (q >>> 8 & 16711935) + u;
|
|
3312
|
+
l[T] = G >>> 2 & 16711935 | (te >>> 2 & 16711935) << 8;
|
|
3297
3313
|
}
|
|
3298
3314
|
continue;
|
|
3299
3315
|
}
|
|
3300
3316
|
for (let F = 0; F < g.length; F++) {
|
|
3301
3317
|
const T = g[F], L = T >>> 2, _ = (b ? (L & -513) * 2 : v[F]) * 4, k = _ + (b ? 1 : w[L & 511]) * 4, P = (b ? 1024 : S[L >>> 10]) * 4, E = _ + P, j = k + P;
|
|
3302
3318
|
if ((d[_ + 3] & d[k + 3] & d[E + 3] & d[j + 3]) !== 255) return null;
|
|
3303
|
-
for (let
|
|
3304
|
-
c[T +
|
|
3319
|
+
for (let q = 0; q < 3; q++)
|
|
3320
|
+
c[T + q] = d[_ + q] + d[k + q] + d[E + q] + d[j + q] + r >> 2;
|
|
3305
3321
|
c[T + 3] = 255;
|
|
3306
3322
|
}
|
|
3307
3323
|
}
|
|
3308
3324
|
return { pixels: c, width: 1024, height: 512 };
|
|
3309
3325
|
}
|
|
3310
|
-
function
|
|
3326
|
+
function Gt(t, e = Ea, i = null) {
|
|
3311
3327
|
var u, f, y;
|
|
3312
|
-
const n =
|
|
3328
|
+
const n = Yi(t), r = Math.min(1, e / Math.max(n.width, n.height)), o = Math.max(1, Math.round(n.width * r)), s = Math.max(1, Math.round(n.height * r)), a = ((u = i == null ? void 0 : i.readback) == null ? void 0 : u.surface) || (typeof OffscreenCanvas < "u" ? new OffscreenCanvas(o, s) : Object.assign(document.createElement("canvas"), { width: o, height: s }));
|
|
3313
3329
|
a.width !== o && (a.width = o), a.height !== s && (a.height = s);
|
|
3314
3330
|
const c = ((f = i == null ? void 0 : i.readback) == null ? void 0 : f.context) || a.getContext("2d", { willReadFrequently: !0 });
|
|
3315
3331
|
if (!c) return null;
|
|
3316
3332
|
i && (i.readback = { surface: a, context: c }), (y = c.clearRect) == null || y.call(c, 0, 0, o, s);
|
|
3317
|
-
const l =
|
|
3333
|
+
const l = qn.has(t);
|
|
3318
3334
|
return l && (c.save(), c.translate(0, s), c.scale(1, -1)), c.drawImage(t, 0, 0, o, s), l && c.restore(), { pixels: c.getImageData(0, 0, o, s).data, width: o, height: s };
|
|
3319
3335
|
}
|
|
3320
|
-
function
|
|
3336
|
+
function $n(t, e) {
|
|
3321
3337
|
const { width: i, height: n } = t;
|
|
3322
3338
|
if (e.width !== i || e.height !== n) return null;
|
|
3323
3339
|
const r = 3, o = 49, s = 64, a = 6, c = (g) => {
|
|
@@ -3357,7 +3373,7 @@ function Xn(t, e) {
|
|
|
3357
3373
|
for (const g of f)
|
|
3358
3374
|
if (!y.some((b) => Math.abs(b.x - g.x) < 7 && Math.abs(b.y - g.y) < 7) && (y.push(g), y.length === 48))
|
|
3359
3375
|
break;
|
|
3360
|
-
const p = [],
|
|
3376
|
+
const p = [], h = s * 2 + 1;
|
|
3361
3377
|
for (const { x: g, y: b } of y) {
|
|
3362
3378
|
const x = b * i + g, v = [];
|
|
3363
3379
|
for (let k = -r; k <= r; k += 1)
|
|
@@ -3366,23 +3382,23 @@ function Xn(t, e) {
|
|
|
3366
3382
|
const w = (k, P) => {
|
|
3367
3383
|
const E = (b + P) * i + g + k;
|
|
3368
3384
|
if (u.energies[E] < o * 9) return -1;
|
|
3369
|
-
let j = 0,
|
|
3370
|
-
for (let
|
|
3385
|
+
let j = 0, q = 0;
|
|
3386
|
+
for (let G = -r; G <= r; G += 1)
|
|
3371
3387
|
for (let te = -r; te <= r; te += 1)
|
|
3372
|
-
j += v[
|
|
3388
|
+
j += v[q++] * e.gray[E + G * i + te];
|
|
3373
3389
|
return j / Math.sqrt(l.energies[x] * u.energies[E]);
|
|
3374
|
-
}, S = new Float32Array(
|
|
3390
|
+
}, S = new Float32Array(h * (a * 2 + 1));
|
|
3375
3391
|
let D = -1, F = 0, T = 0;
|
|
3376
3392
|
for (let k = -a; k <= a; k += 1)
|
|
3377
3393
|
for (let P = -s; P <= s; P += 1) {
|
|
3378
3394
|
const E = w(P, k);
|
|
3379
|
-
S[(k + a) *
|
|
3395
|
+
S[(k + a) * h + P + s] = E, E > D && (D = E, F = P, T = k);
|
|
3380
3396
|
}
|
|
3381
3397
|
if (D < 0.85 || Math.abs(F) === s || Math.abs(T) === a) continue;
|
|
3382
3398
|
let L = -1;
|
|
3383
3399
|
for (let k = -a; k <= a; k += 1)
|
|
3384
3400
|
for (let P = -s; P <= s; P += 1)
|
|
3385
|
-
Math.abs(P - F) <= 3 && Math.abs(k - T) <= 2 || (L = Math.max(L, S[(k + a) *
|
|
3401
|
+
Math.abs(P - F) <= 3 && Math.abs(k - T) <= 2 || (L = Math.max(L, S[(k + a) * h + P + s]));
|
|
3386
3402
|
if (D - L < 0.015) continue;
|
|
3387
3403
|
const _ = (k, P, E) => Math.abs(k - 2 * P + E) > 1e-6 ? O(0.5 * (k - E) / (k - 2 * P + E), -0.5, 0.5) : 0;
|
|
3388
3404
|
p.push({
|
|
@@ -3398,11 +3414,11 @@ function Xn(t, e) {
|
|
|
3398
3414
|
b.length > d.length && (d = b);
|
|
3399
3415
|
}
|
|
3400
3416
|
if (d.length < Math.max(6, p.length * 0.35) || Math.max(...d.map((g) => g.y)) - Math.min(...d.map((g) => g.y)) < 24) return null;
|
|
3401
|
-
const
|
|
3417
|
+
const m = (g) => (g.sort((b, x) => b - x), (g[Math.floor((g.length - 1) / 2)] + g[Math.floor(g.length / 2)]) / 2);
|
|
3402
3418
|
return {
|
|
3403
|
-
dx:
|
|
3404
|
-
dy:
|
|
3405
|
-
gainRatio:
|
|
3419
|
+
dx: m(d.map((g) => g.dx)),
|
|
3420
|
+
dy: m(d.map((g) => g.dy)),
|
|
3421
|
+
gainRatio: m(d.map((g) => g.gainRatio)),
|
|
3406
3422
|
inliers: d.length
|
|
3407
3423
|
};
|
|
3408
3424
|
}
|
|
@@ -3410,16 +3426,16 @@ function Vt(t) {
|
|
|
3410
3426
|
const [e, i] = t.center, n = e < 0.5 ? 0 : 0.5;
|
|
3411
3427
|
return [Math.min(0.25, e - n, n + 0.5 - e), Math.min(0.5, i, 1 - i)];
|
|
3412
3428
|
}
|
|
3413
|
-
function
|
|
3429
|
+
function Ca(t, e, i, n) {
|
|
3414
3430
|
const s = [], a = [];
|
|
3415
3431
|
for (const c of [-90, 90]) {
|
|
3416
3432
|
const l = i.map(() => ({ width: 193, height: 241, gray: new Float32Array(46513), valid: new Uint8Array(46513) }));
|
|
3417
3433
|
for (let f = 0; f < 241; f += 1) {
|
|
3418
3434
|
const y = (-60 + f * 0.5) * Math.PI / 180;
|
|
3419
3435
|
for (let p = 0; p < 193; p += 1) {
|
|
3420
|
-
const
|
|
3421
|
-
for (let
|
|
3422
|
-
const g = i[
|
|
3436
|
+
const h = (c - 12 + p * 0.125) * Math.PI / 180, d = [Math.cos(y) * Math.sin(h), Math.sin(y), Math.cos(y) * Math.cos(h)];
|
|
3437
|
+
for (let m = 0; m < 2; m += 1) {
|
|
3438
|
+
const g = i[m], b = St(
|
|
3423
3439
|
d,
|
|
3424
3440
|
g,
|
|
3425
3441
|
Math.PI,
|
|
@@ -3429,42 +3445,42 @@ function Ea(t, e, i, n) {
|
|
|
3429
3445
|
);
|
|
3430
3446
|
if (!b) continue;
|
|
3431
3447
|
const x = b.uv.slice();
|
|
3432
|
-
e.dualFisheyeFlipX && (x[0] = 2 * i[
|
|
3448
|
+
e.dualFisheyeFlipX && (x[0] = 2 * i[m].center[0] - x[0]), e.dualFisheyeFlipY && (x[1] = 2 * i[m].center[1] - x[1]);
|
|
3433
3449
|
const v = [0, 0, 0];
|
|
3434
|
-
|
|
3450
|
+
Di(t.pixels, t.width, t.height, x[0], n === "bottom-left" ? 1 - x[1] : x[1], v);
|
|
3435
3451
|
const w = f * 193 + p;
|
|
3436
|
-
l[
|
|
3452
|
+
l[m].gray[w] = v[0] * 0.2126 + v[1] * 0.7152 + v[2] * 0.0722, l[m].valid[w] = 1;
|
|
3437
3453
|
}
|
|
3438
3454
|
}
|
|
3439
3455
|
}
|
|
3440
|
-
const u =
|
|
3456
|
+
const u = $n(...l);
|
|
3441
3457
|
if (!u) return null;
|
|
3442
3458
|
s.push(u.dx * 0.125 * Math.PI / 180, u.dy * 0.5 * Math.PI / 180), a.push(u.gainRatio);
|
|
3443
3459
|
}
|
|
3444
3460
|
return { offsets: s, ratios: a };
|
|
3445
3461
|
}
|
|
3446
|
-
function
|
|
3447
|
-
const r =
|
|
3462
|
+
function pc(t, e, i, n) {
|
|
3463
|
+
const r = Gt(t, 2048);
|
|
3448
3464
|
if (!r) return null;
|
|
3449
3465
|
if (r.pixels[3] === 0) return;
|
|
3450
|
-
const o = n.map((f) => ({ ...f, validRadius: Vt(f) })), s =
|
|
3466
|
+
const o = n.map((f) => ({ ...f, validRadius: Vt(f) })), s = Ca(r, e, o, i.textureOrigin);
|
|
3451
3467
|
if (!s) return null;
|
|
3452
3468
|
const { offsets: a, ratios: c } = s, l = Math.sqrt(O(Math.sqrt(c[0] * c[1]), 0.64, 1.5625)), u = [-1, 1].map((f) => {
|
|
3453
|
-
const y =
|
|
3469
|
+
const y = Yn(r, o, i.textureOrigin, f, e, a);
|
|
3454
3470
|
return y > 0 ? 1 / y : 0;
|
|
3455
3471
|
});
|
|
3456
3472
|
return { offsets: a, polarInverseDepth: u, gain: e.dualFisheyeAutoGain ? [l, 1 / l] : [e.dualFisheyeGainFront, e.dualFisheyeGainBack] };
|
|
3457
3473
|
}
|
|
3458
|
-
function
|
|
3459
|
-
const r =
|
|
3474
|
+
function yc(t, e, i, n) {
|
|
3475
|
+
const r = Gt(t, 2048);
|
|
3460
3476
|
if (!r) return null;
|
|
3461
3477
|
if (r.pixels[3] !== 0)
|
|
3462
|
-
return
|
|
3478
|
+
return gc(r, e, i, n);
|
|
3463
3479
|
}
|
|
3464
|
-
function
|
|
3465
|
-
const r = n.map((l) => ({ ...l, validRadius: Vt(l) })), o =
|
|
3480
|
+
function gc(t, e, i, n) {
|
|
3481
|
+
const r = n.map((l) => ({ ...l, validRadius: Vt(l) })), o = Qn(t, r, e, i.textureOrigin, Math.PI), s = r.map((l) => ({ ...l, focal: l.focal.map((u) => u * o) })), a = Ca(t, e, s, i.textureOrigin);
|
|
3466
3482
|
if (!a) return null;
|
|
3467
|
-
const c = e.dualFisheyeAutoGain ?
|
|
3483
|
+
const c = e.dualFisheyeAutoGain ? za(
|
|
3468
3484
|
t,
|
|
3469
3485
|
e,
|
|
3470
3486
|
i,
|
|
@@ -3480,24 +3496,24 @@ function mc(t, e, i, n) {
|
|
|
3480
3496
|
gain: (c == null ? void 0 : c.gain) || [e.dualFisheyeGainFront, e.dualFisheyeGainBack]
|
|
3481
3497
|
};
|
|
3482
3498
|
}
|
|
3483
|
-
function
|
|
3484
|
-
if (e.reduce((
|
|
3485
|
-
const a = (
|
|
3486
|
-
const
|
|
3499
|
+
function Yn(t, e, i, n = 0, r = {}, o = null) {
|
|
3500
|
+
if (e.reduce((h, d) => h + (d.translationM || []).reduce((m, g) => m + g * g, 0), 0) < 1e-8) return 0;
|
|
3501
|
+
const a = (h, d) => {
|
|
3502
|
+
const m = [];
|
|
3487
3503
|
for (let g = 0; g < e.length; g += 1) {
|
|
3488
|
-
const b = e[g], x = g === 1 && o ?
|
|
3504
|
+
const b = e[g], x = g === 1 && o ? Hi(h, o) : h, v = St(x, b, Math.PI, !0, !1, 1, d > 0 ? 1 / d : 0);
|
|
3489
3505
|
if (!v) return null;
|
|
3490
3506
|
r.dualFisheyeFlipX && (v.uv[0] = 2 * b.center[0] - v.uv[0]), r.dualFisheyeFlipY && (v.uv[1] = 2 * b.center[1] - v.uv[1]);
|
|
3491
3507
|
const w = [0, 0, 0];
|
|
3492
|
-
|
|
3508
|
+
Di(t.pixels, t.width, t.height, v.uv[0], i === "bottom-left" ? 1 - v.uv[1] : v.uv[1], w), m.push(w);
|
|
3493
3509
|
}
|
|
3494
|
-
return
|
|
3510
|
+
return m;
|
|
3495
3511
|
}, c = [];
|
|
3496
3512
|
if (n)
|
|
3497
|
-
for (let
|
|
3498
|
-
const d = n * (60 + 30 *
|
|
3499
|
-
for (let
|
|
3500
|
-
const g = (
|
|
3513
|
+
for (let h = 0; h < 9; h += 1) {
|
|
3514
|
+
const d = n * (60 + 30 * h / 8) * Math.PI / 180;
|
|
3515
|
+
for (let m = 0; m < 128; m += 1) {
|
|
3516
|
+
const g = (m / 128 - 0.5) * 2 * Math.PI, b = [Math.cos(d) * Math.sin(g), Math.sin(d), Math.cos(d) * Math.cos(g)];
|
|
3501
3517
|
let x = !0;
|
|
3502
3518
|
for (let v = 0; v <= 16; v += 1)
|
|
3503
3519
|
if (!a(b, v / 4)) {
|
|
@@ -3508,11 +3524,11 @@ function $n(t, e, i, n = 0, r = {}, o = null) {
|
|
|
3508
3524
|
}
|
|
3509
3525
|
}
|
|
3510
3526
|
else
|
|
3511
|
-
for (let
|
|
3512
|
-
const d = (-55 + 110 *
|
|
3513
|
-
for (const
|
|
3527
|
+
for (let h = 0; h < 64; h += 1) {
|
|
3528
|
+
const d = (-55 + 110 * h / 63) * Math.PI / 180;
|
|
3529
|
+
for (const m of [-90, 90])
|
|
3514
3530
|
for (let g = 0; g < 9; g += 1) {
|
|
3515
|
-
const b = (
|
|
3531
|
+
const b = (m - 4 + g) * Math.PI / 180, x = [Math.cos(d) * Math.sin(b), Math.sin(d), Math.cos(d) * Math.cos(b)];
|
|
3516
3532
|
let v = !0;
|
|
3517
3533
|
for (let w = 0; w <= 16; w += 1)
|
|
3518
3534
|
if (!a(x, w / 4)) {
|
|
@@ -3523,70 +3539,70 @@ function $n(t, e, i, n = 0, r = {}, o = null) {
|
|
|
3523
3539
|
}
|
|
3524
3540
|
}
|
|
3525
3541
|
if (c.length < 64) return 0;
|
|
3526
|
-
const l = (
|
|
3527
|
-
const d = [],
|
|
3542
|
+
const l = (h) => {
|
|
3543
|
+
const d = [], m = [0, 0];
|
|
3528
3544
|
for (const v of c) {
|
|
3529
|
-
const w = a(v,
|
|
3545
|
+
const w = a(v, h);
|
|
3530
3546
|
if (!w) return 1 / 0;
|
|
3531
3547
|
d.push(w);
|
|
3532
|
-
for (let S = 0; S < 2; S += 1) for (const D of w[S])
|
|
3548
|
+
for (let S = 0; S < 2; S += 1) for (const D of w[S]) m[S] += D;
|
|
3533
3549
|
}
|
|
3534
|
-
if (
|
|
3535
|
-
const g = Math.sqrt(O(
|
|
3550
|
+
if (m[0] <= c.length * 3 || m[1] <= c.length * 3) return 1 / 0;
|
|
3551
|
+
const g = Math.sqrt(O(m[1] / m[0], 0.64, 1.5625)), b = d.map((v) => v[0].reduce((w, S, D) => w + Math.abs(S * g - v[1][D] / g) / 3, 0)).sort((v, w) => v - w), x = Math.floor(b.length * 0.8);
|
|
3536
3552
|
return b.slice(0, x).reduce((v, w) => v + w, 0) / x;
|
|
3537
3553
|
}, u = l(0);
|
|
3538
3554
|
let f = u, y = 0;
|
|
3539
|
-
for (let
|
|
3540
|
-
const d =
|
|
3541
|
-
|
|
3555
|
+
for (let h = 1; h <= 16; h += 1) {
|
|
3556
|
+
const d = h / 4, m = l(d);
|
|
3557
|
+
m < f && (f = m, y = d);
|
|
3542
3558
|
}
|
|
3543
3559
|
const p = y;
|
|
3544
|
-
for (let
|
|
3545
|
-
const d = p +
|
|
3560
|
+
for (let h = -4; h <= 4; h += 1) {
|
|
3561
|
+
const d = p + h * 0.05;
|
|
3546
3562
|
if (d <= 0 || d > 4) continue;
|
|
3547
|
-
const
|
|
3548
|
-
|
|
3563
|
+
const m = l(d);
|
|
3564
|
+
m < f && (f = m, y = d);
|
|
3549
3565
|
}
|
|
3550
3566
|
return y === 0 || !Number.isFinite(u) || u - f < 0.5 || f > u * 0.9 ? 0 : 1 / y;
|
|
3551
3567
|
}
|
|
3552
|
-
function
|
|
3568
|
+
function vc(t, e, i, n = !1) {
|
|
3553
3569
|
const r = i[t[1] > 0 ? 1 : 0];
|
|
3554
3570
|
if (!(r > 0)) return e;
|
|
3555
3571
|
const o = Math.sin((n ? 50 : 30) * Math.PI / 180), s = Math.sin((n ? 65 : 50) * Math.PI / 180), a = O((Math.abs(t[1]) - o) / (s - o), 0, 1), c = (e > 0 ? 1 / e : 0) * (1 - a * a * (3 - 2 * a)) + r * a * a * (3 - 2 * a);
|
|
3556
3572
|
return c > 0 ? 1 / c : 0;
|
|
3557
3573
|
}
|
|
3558
|
-
function
|
|
3574
|
+
function xc(t, e, i, n) {
|
|
3559
3575
|
const r = e.map((f) => {
|
|
3560
|
-
const y = f.rotationQuat, p =
|
|
3576
|
+
const y = f.rotationQuat, p = Ba({ w: y[0], x: y[1], y: y[2], z: y[3] }, ...f.translationM || [0, 0, 0]);
|
|
3561
3577
|
return [p.x, p.y, p.z];
|
|
3562
3578
|
}), o = r[1].map((f, y) => f - r[0][y]), s = Math.hypot(o[0], o[2]);
|
|
3563
3579
|
if (s < 1e-3 || Math.abs(o[1]) > s * 0.1) return [0, 0];
|
|
3564
3580
|
const a = [o[0] / s, o[2] / s], c = 193, l = 193, u = Math.tan(25 * Math.PI / 180);
|
|
3565
3581
|
return [-1, 1].map((f) => {
|
|
3566
3582
|
const y = e.map(() => ({ width: c, height: l, gray: new Float32Array(c * l), valid: new Uint8Array(c * l) }));
|
|
3567
|
-
for (let d = 0; d < l; d += 1) for (let
|
|
3568
|
-
const g = (2 *
|
|
3583
|
+
for (let d = 0; d < l; d += 1) for (let m = 0; m < c; m += 1) {
|
|
3584
|
+
const g = (2 * m / (c - 1) - 1) * u, b = (2 * d / (l - 1) - 1) * u, x = [a[0] * g + a[1] * b, f, a[1] * g - a[0] * b], v = Math.hypot(...x);
|
|
3569
3585
|
for (let w = 0; w < 3; w += 1) x[w] /= v;
|
|
3570
3586
|
for (let w = 0; w < 2; w += 1) {
|
|
3571
3587
|
const S = e[w], D = St(x, S, Math.PI, !0, !1, 1);
|
|
3572
3588
|
if (!D) continue;
|
|
3573
3589
|
i.dualFisheyeFlipX && (D.uv[0] = 2 * S.center[0] - D.uv[0]), i.dualFisheyeFlipY && (D.uv[1] = 2 * S.center[1] - D.uv[1]);
|
|
3574
3590
|
const F = [0, 0, 0];
|
|
3575
|
-
|
|
3576
|
-
const T = d * c +
|
|
3591
|
+
Di(t.pixels, t.width, t.height, D.uv[0], n === "bottom-left" ? 1 - D.uv[1] : D.uv[1], F);
|
|
3592
|
+
const T = d * c + m;
|
|
3577
3593
|
y[w].gray[T] = F[0] * 0.2126 + F[1] * 0.7152 + F[2] * 0.0722, y[w].valid[T] = 1;
|
|
3578
3594
|
}
|
|
3579
3595
|
}
|
|
3580
|
-
const p =
|
|
3596
|
+
const p = $n(...y);
|
|
3581
3597
|
if (!p || Math.abs(p.dy) > 1.5) return 0;
|
|
3582
|
-
const
|
|
3583
|
-
return
|
|
3598
|
+
const h = p.dx * 2 * u / (c - 1) / s;
|
|
3599
|
+
return h >= 0.05 && h <= 4 ? h : 0;
|
|
3584
3600
|
});
|
|
3585
3601
|
}
|
|
3586
|
-
function
|
|
3587
|
-
const o = Array.from({ length: 13 }, (p,
|
|
3588
|
-
const
|
|
3589
|
-
for (const g of
|
|
3602
|
+
function Qn(t, e, i, n, r) {
|
|
3603
|
+
const o = Array.from({ length: 13 }, (p, h) => 0.97 + h * 5e-3), s = o.map((p) => e.map((h) => ({ ...h, focal: h.focal.map((d) => d * p) }))), a = (p, h, d) => {
|
|
3604
|
+
const m = [];
|
|
3605
|
+
for (const g of h) {
|
|
3590
3606
|
const b = St(
|
|
3591
3607
|
p,
|
|
3592
3608
|
g,
|
|
@@ -3599,38 +3615,38 @@ function Yn(t, e, i, n, r) {
|
|
|
3599
3615
|
if (!d) continue;
|
|
3600
3616
|
i.dualFisheyeFlipX && (b.uv[0] = 2 * g.center[0] - b.uv[0]), i.dualFisheyeFlipY && (b.uv[1] = 2 * g.center[1] - b.uv[1]);
|
|
3601
3617
|
const x = [0, 0, 0];
|
|
3602
|
-
|
|
3618
|
+
Di(t.pixels, t.width, t.height, b.uv[0], n === "bottom-left" ? 1 - b.uv[1] : b.uv[1], x), m.push(x);
|
|
3603
3619
|
}
|
|
3604
|
-
return
|
|
3620
|
+
return m;
|
|
3605
3621
|
}, c = [];
|
|
3606
|
-
for (const p of
|
|
3607
|
-
const
|
|
3622
|
+
for (const p of ia(i.dualFisheyeSeamLongitudesDeg)) {
|
|
3623
|
+
const h = [];
|
|
3608
3624
|
for (let d = -60; d <= 60; d += 4)
|
|
3609
|
-
for (let
|
|
3625
|
+
for (let m = -2; m <= 2; m += 0.5) {
|
|
3610
3626
|
const g = Gn(
|
|
3611
|
-
(p +
|
|
3627
|
+
(p + m) / 360 + 0.5,
|
|
3612
3628
|
0.5 - d / 180,
|
|
3613
3629
|
e.some((b) => b.projectionModel === "dji_fisheye_lut")
|
|
3614
3630
|
);
|
|
3615
|
-
i.equirectFlipX && (g[0] *= -1), i.equirectFlipY && (g[1] *= -1), s.every((b) => a(g, b, !1)) &&
|
|
3631
|
+
i.equirectFlipX && (g[0] *= -1), i.equirectFlipY && (g[1] *= -1), s.every((b) => a(g, b, !1)) && h.push(g);
|
|
3616
3632
|
}
|
|
3617
|
-
if (
|
|
3618
|
-
c.push(...
|
|
3633
|
+
if (h.length < 16) return 1;
|
|
3634
|
+
c.push(...h);
|
|
3619
3635
|
}
|
|
3620
3636
|
const l = (p) => {
|
|
3621
|
-
const
|
|
3622
|
-
if (Math.min(...d) <
|
|
3623
|
-
const
|
|
3637
|
+
const h = c.map((x) => a(x, p, !0)), d = h.reduce((x, v) => x.map((w, S) => w + v[S].reduce((D, F) => D + F, 0)), [0, 0]);
|
|
3638
|
+
if (Math.min(...d) < h.length * 15) return Number.POSITIVE_INFINITY;
|
|
3639
|
+
const m = Math.sqrt(O(d[1] / d[0], 0.64, 1.5625)), g = h.map((x) => x[0].reduce((v, w, S) => v + Math.abs(w * m - x[1][S] / m) / 3, 0)).sort((x, v) => x - v), b = Math.floor(g.length * 0.8);
|
|
3624
3640
|
return g.slice(0, b).reduce((x, v) => x + v, 0) / b;
|
|
3625
3641
|
}, u = l(e);
|
|
3626
3642
|
if (!Number.isFinite(u) || u < 0.75) return 1;
|
|
3627
3643
|
let f = 6, y = u;
|
|
3628
|
-
return s.forEach((p,
|
|
3644
|
+
return s.forEach((p, h) => {
|
|
3629
3645
|
const d = l(p);
|
|
3630
|
-
d < y && (f =
|
|
3646
|
+
d < y && (f = h, y = d);
|
|
3631
3647
|
}), f === 0 || f === o.length - 1 || u - y < 0.75 || y > u * 0.85 ? 1 : o[f];
|
|
3632
3648
|
}
|
|
3633
|
-
function
|
|
3649
|
+
function bc(t, e, i, n, r, o, s) {
|
|
3634
3650
|
var x, v, w;
|
|
3635
3651
|
const a = !n && [r, o].every((S) => {
|
|
3636
3652
|
var D;
|
|
@@ -3638,17 +3654,17 @@ function gc(t, e, i, n, r, o, s) {
|
|
|
3638
3654
|
}), c = !!(e.dualFisheyeRefineFocal && i && !n && [r, o].every((S) => {
|
|
3639
3655
|
var D;
|
|
3640
3656
|
return (S.projectionModel || "equidistant") === "equidistant" && ((D = S.focal) == null ? void 0 : D.every((F) => F > 0));
|
|
3641
|
-
})), l =
|
|
3657
|
+
})), l = Gt(t, a || c ? 1024 : Ea);
|
|
3642
3658
|
if (!l) return null;
|
|
3643
|
-
let u = c ?
|
|
3659
|
+
let u = c ? Qn(l, [r, o], e, i.textureOrigin, s) : 1;
|
|
3644
3660
|
if (u !== 1) {
|
|
3645
3661
|
const S = { ...r, focal: r.focal.map((F) => F * u) }, D = { ...o, focal: o.focal.map((F) => F * u) };
|
|
3646
|
-
|
|
3662
|
+
wc(e, i, S, D, s) ? (r = S, o = D) : u = 1;
|
|
3647
3663
|
}
|
|
3648
|
-
const f = a ?
|
|
3664
|
+
const f = a ? Yn(l, [r, o], i == null ? void 0 : i.textureOrigin) : 0, p = i && !n && [r, o].every((S) => S.projectionModel === "mei_extended" && S.distortionModel !== "radtan_pro" && Array.isArray(S.rotationQuat)) && [r, o].some((S) => {
|
|
3649
3665
|
var D;
|
|
3650
3666
|
return (D = S.translationM) == null ? void 0 : D.some((F) => Math.abs(F) > 1e-3);
|
|
3651
|
-
}) ?
|
|
3667
|
+
}) ? Gt(t, 1024) : null, h = p ? xc(p, [r, o], e, i.textureOrigin) : [0, 0], d = i && !n && ((x = i.imageSize) == null ? void 0 : x[0]) === 2 * ((v = i.imageSize) == null ? void 0 : v[1]) && [r, o].every((S) => S.projectionModel === "mei_extended" && S.distortionModel !== "radtan_pro" && Array.isArray(S.rotationQuat)), m = d ? Gt(t, 2048) : null, g = m ? ((w = Ca(m, e, [r, o], i.textureOrigin)) == null ? void 0 : w.offsets) || [0, 0, 0, 0] : [0, 0, 0, 0], b = za(
|
|
3652
3668
|
l,
|
|
3653
3669
|
e,
|
|
3654
3670
|
i,
|
|
@@ -3656,12 +3672,12 @@ function gc(t, e, i, n, r, o, s) {
|
|
|
3656
3672
|
r,
|
|
3657
3673
|
o,
|
|
3658
3674
|
s,
|
|
3659
|
-
{ convergenceM: f, polarInverseDepth:
|
|
3675
|
+
{ convergenceM: f, polarInverseDepth: h, imageOffsets: d ? g : null }
|
|
3660
3676
|
);
|
|
3661
|
-
return b ? { ...b, convergenceM: f, polarInverseDepth:
|
|
3677
|
+
return b ? { ...b, convergenceM: f, polarInverseDepth: h, focalScale: u, imageOffsets: g } : null;
|
|
3662
3678
|
}
|
|
3663
|
-
function
|
|
3664
|
-
const { weights: o } =
|
|
3679
|
+
function wc(t, e, i, n, r) {
|
|
3680
|
+
const { weights: o } = Ia(
|
|
3665
3681
|
t,
|
|
3666
3682
|
e,
|
|
3667
3683
|
null,
|
|
@@ -3676,11 +3692,11 @@ function vc(t, e, i, n, r) {
|
|
|
3676
3692
|
const y = u * z + l + f;
|
|
3677
3693
|
a[u * s + f] = o[0][y] > 0 && o[1][y] > 0 ? 1 : 65535;
|
|
3678
3694
|
}
|
|
3679
|
-
if (!
|
|
3695
|
+
if (!Xn(a, s, X, 2, c)) return !1;
|
|
3680
3696
|
}
|
|
3681
3697
|
return !0;
|
|
3682
3698
|
}
|
|
3683
|
-
function
|
|
3699
|
+
function Hn(t) {
|
|
3684
3700
|
const e = z * X, i = new Uint8Array(e);
|
|
3685
3701
|
for (let o = 0; o < e; o++)
|
|
3686
3702
|
t[0][o] <= 0 || t[1][o] <= 0 || (i[o] = 1, o % z && (i[o - 1] = 1), o >= z && (i[o - z] = 1));
|
|
@@ -3690,7 +3706,7 @@ function Qn(t) {
|
|
|
3690
3706
|
for (let o = 0, s = 0; o < e; o++) i[o] && (r[s++] = o);
|
|
3691
3707
|
return r;
|
|
3692
3708
|
}
|
|
3693
|
-
function
|
|
3709
|
+
function Ia(t, e, i, n, r, o, { convergenceM: s, polarInverseDepth: a, registrationOffsets: c, videoOffsets: l }, u) {
|
|
3694
3710
|
var w, S, D, F;
|
|
3695
3711
|
const f = u && !i ? JSON.stringify([
|
|
3696
3712
|
n,
|
|
@@ -3709,34 +3725,34 @@ function Ca(t, e, i, n, r, o, { convergenceM: s, polarInverseDepth: a, registrat
|
|
|
3709
3725
|
t.dualFisheyeFlipY
|
|
3710
3726
|
]) : null;
|
|
3711
3727
|
if (f && u.key === f) return u.map;
|
|
3712
|
-
const y = z * X, p = [new Float64Array(y * 2), new Float64Array(y * 2)],
|
|
3728
|
+
const y = z * X, p = [new Float64Array(y * 2), new Float64Array(y * 2)], h = [new Float32Array(y), new Float32Array(y)], d = [n, r], m = d.map((T) => T.projectionModel === "mei_extended"), g = d.map((T) => T.projectionModel === "dji_fisheye_lut"), b = m.some(Boolean) || g.some(Boolean);
|
|
3713
3729
|
for (let T = 0; T < X; T++) for (let L = 0; L < z; L++) {
|
|
3714
3730
|
const _ = Gn((L + 0.5) / z, (T + 0.5) / X, b);
|
|
3715
3731
|
t.equirectFlipX && (_[0] = -_[0]), t.equirectFlipY && (_[1] = -_[1]);
|
|
3716
|
-
const k =
|
|
3717
|
-
for (let
|
|
3718
|
-
const te =
|
|
3732
|
+
const k = Zs(_, b), P = O(Math.floor(k[0] * z), 0, z - 1), j = O(Math.floor(k[1] * X), 0, X - 1) * z + P, q = tc(i, k[0], k[1]);
|
|
3733
|
+
for (let G = 0; G < 2; G++) {
|
|
3734
|
+
const te = G === 1 && c ? Hi(_, c) : _, ne = d[G], ue = q ? q[G].valid ? { uv: q[G].uv, confidence: q[G].confidence } : null : St(
|
|
3719
3735
|
te,
|
|
3720
3736
|
ne,
|
|
3721
3737
|
o,
|
|
3722
|
-
|
|
3723
|
-
g[
|
|
3724
|
-
|
|
3725
|
-
|
|
3738
|
+
m[G],
|
|
3739
|
+
g[G],
|
|
3740
|
+
G === 0 ? ((D = e == null ? void 0 : e.front) == null ? void 0 : D.radialScale) || 1 : ((F = e == null ? void 0 : e.back) == null ? void 0 : F.radialScale) || 1,
|
|
3741
|
+
vc(te, s, a, !!l)
|
|
3726
3742
|
);
|
|
3727
3743
|
if (!ue) continue;
|
|
3728
3744
|
let [J, Z] = ue.uv;
|
|
3729
|
-
t.dualFisheyeFlipX && (J = 2 * ne.center[0] - J), t.dualFisheyeFlipY && (Z = 2 * ne.center[1] - Z), p[
|
|
3745
|
+
t.dualFisheyeFlipX && (J = 2 * ne.center[0] - J), t.dualFisheyeFlipY && (Z = 2 * ne.center[1] - Z), p[G][j * 2] = J, p[G][j * 2 + 1] = (e == null ? void 0 : e.textureOrigin) === "bottom-left" ? 1 - Z : Z, h[G][j] = ue.confidence;
|
|
3730
3746
|
}
|
|
3731
3747
|
}
|
|
3732
3748
|
let x = 0;
|
|
3733
3749
|
for (let T = 0; T < y; T++)
|
|
3734
|
-
|
|
3735
|
-
const v = { uv: p, weights:
|
|
3750
|
+
h[0][T] > 0 && h[1][T] > 0 && x++;
|
|
3751
|
+
const v = { uv: p, weights: h, overlapCount: x, gradientIndices: Hn(h) };
|
|
3736
3752
|
return f && (u.key = f, u.map = v), v;
|
|
3737
3753
|
}
|
|
3738
|
-
function
|
|
3739
|
-
const p = u || l,
|
|
3754
|
+
function za(t, e, i, n, r, o, s, { convergenceM: a = 0, polarInverseDepth: c = [0, 0], imageOffsets: l = null, videoOffsets: u = null, previousMask: f = null, mapCache: y = null } = {}) {
|
|
3755
|
+
const p = u || l, h = [new Float32Array(z * X * 3), new Float32Array(z * X * 3)], d = Ia(
|
|
3740
3756
|
e,
|
|
3741
3757
|
i,
|
|
3742
3758
|
n,
|
|
@@ -3745,8 +3761,8 @@ function Ia(t, e, i, n, r, o, s, { convergenceM: a = 0, polarInverseDepth: c = [
|
|
|
3745
3761
|
s,
|
|
3746
3762
|
{ convergenceM: a, polarInverseDepth: c, registrationOffsets: p, videoOffsets: u },
|
|
3747
3763
|
y
|
|
3748
|
-
), { weights:
|
|
3749
|
-
|
|
3764
|
+
), { weights: m } = d;
|
|
3765
|
+
ec(t, d, h, !!(y && !n));
|
|
3750
3766
|
const g = new Float64Array(z * X);
|
|
3751
3767
|
g.fill(65535);
|
|
3752
3768
|
const b = !!(i && e.dualFisheyeAutoGain);
|
|
@@ -3755,45 +3771,45 @@ function Ia(t, e, i, n, r, o, s, { convergenceM: a = 0, polarInverseDepth: c = [
|
|
|
3755
3771
|
if (b || d.overlapCount === void 0) {
|
|
3756
3772
|
x = 0;
|
|
3757
3773
|
for (let ce = 0; ce < z * X; ce++)
|
|
3758
|
-
if (
|
|
3774
|
+
if (m[0][ce] > 0 && m[1][ce] > 0) {
|
|
3759
3775
|
if (x += 1, !b) continue;
|
|
3760
|
-
const $ = ce * 3, xe =
|
|
3776
|
+
const $ = ce * 3, xe = h[0][$] * 0.2126 + h[0][$ + 1] * 0.7152 + h[0][$ + 2] * 0.0722, pe = h[1][$] * 0.2126 + h[1][$ + 1] * 0.7152 + h[1][$ + 2] * 0.0722;
|
|
3761
3777
|
v += xe, w += pe;
|
|
3762
3778
|
}
|
|
3763
3779
|
}
|
|
3764
3780
|
if (x < 64) return null;
|
|
3765
3781
|
let D = e.dualFisheyeGainFront, F = e.dualFisheyeGainBack;
|
|
3766
3782
|
b && v > x && w > x && (D = Math.sqrt(O(w / v, 0.64, 1.5625)), F = 1 / D);
|
|
3767
|
-
const T = [new Float32Array(g.length), new Float32Array(g.length)], L = d.gradientIndices ||
|
|
3783
|
+
const T = [new Float32Array(g.length), new Float32Array(g.length)], L = d.gradientIndices || Hn(m), _ = new Float64Array(z);
|
|
3768
3784
|
let k = 0;
|
|
3769
3785
|
for (let ce = 0; ce < L.length; ce++) {
|
|
3770
|
-
const $ = L[ce], xe = $ % z, pe = $ * 3, re =
|
|
3771
|
-
if (k = it, _[xe] = it,
|
|
3772
|
-
const
|
|
3786
|
+
const $ = L[ce], xe = $ % z, pe = $ * 3, re = h[0][pe] * D, Te = h[0][pe + 1] * D, et = h[0][pe + 2] * D, tt = h[1][pe] * F, Qt = h[1][pe + 1] * F, Ht = h[1][pe + 2] * F, Le = re * 0.2126 + Te * 0.7152 + et * 0.0722, _e = tt * 0.2126 + Qt * 0.7152 + Ht * 0.0722, it = Le - _e, Ti = xe > 0 ? k : it, ki = $ >= z ? _[xe] : it;
|
|
3787
|
+
if (k = it, _[xe] = it, m[0][$] <= 0 || m[1][$] <= 0) continue;
|
|
3788
|
+
const Ri = (Math.abs(re - tt) + Math.abs(Te - Qt) + Math.abs(et - Ht)) / 3;
|
|
3773
3789
|
T[0][$] = Le < 12 && _e > 24 && Le < _e * 0.25 ? 128 * Math.min(1, (_e - Le) / 64) : 0, T[1][$] = _e < 12 && Le > 24 && _e < Le * 0.25 ? 128 * Math.min(1, (Le - _e) / 64) : 0, f && (T[0][$] += f[$] / 255 * 12, T[1][$] += (1 - f[$] / 255) * 12);
|
|
3774
|
-
const at = Math.abs(it) + Math.abs(
|
|
3775
|
-
g[$] = Math.min(65534,
|
|
3790
|
+
const at = Math.abs(it) + Math.abs(Ti) + Math.abs(ki), Pi = 128 * (1 - 2 * Math.min(m[0][$], m[1][$]) / Math.max(1e-4, m[0][$] + m[1][$]));
|
|
3791
|
+
g[$] = Math.min(65534, Ri + at * 0.35 + Pi);
|
|
3776
3792
|
}
|
|
3777
|
-
const P = z / 2, E = new Float64Array(P * X), j = new Float64Array(P + 1),
|
|
3793
|
+
const P = z / 2, E = new Float64Array(P * X), j = new Float64Array(P + 1), q = new Float64Array(P + 1), G = {}, te = (ce) => {
|
|
3778
3794
|
for (let $ = 0; $ < X; $ += 1) {
|
|
3779
|
-
const xe = $ * z, pe =
|
|
3795
|
+
const xe = $ * z, pe = m[1][xe] > m[0][xe] != ce > 0;
|
|
3780
3796
|
for (let re = 0; re < P; re += 1) {
|
|
3781
3797
|
const Te = xe + ce + re, et = T[0][Te], tt = T[1][Te];
|
|
3782
|
-
j[re + 1] = j[re] + (pe ? tt : et),
|
|
3798
|
+
j[re + 1] = j[re] + (pe ? tt : et), q[re + 1] = q[re] + (pe ? et : tt);
|
|
3783
3799
|
}
|
|
3784
3800
|
for (let re = 0; re < P; re += 1) {
|
|
3785
3801
|
const Te = g[xe + ce + re];
|
|
3786
|
-
E[$ * P + re] = Te >= 65535 ? 65535 : Math.min(65534, Te + j[re] +
|
|
3802
|
+
E[$ * P + re] = Te >= 65535 ? 65535 : Math.min(65534, Te + j[re] + q[P] - q[re]);
|
|
3787
3803
|
}
|
|
3788
3804
|
}
|
|
3789
|
-
return
|
|
3790
|
-
}, ne = te(0), ue = te(P), J = ne && ue && ne.cost / X <= 180 && ue.cost / X <= 180 ?
|
|
3791
|
-
let Z =
|
|
3792
|
-
Z && u && S.every(Boolean) && (Z =
|
|
3793
|
-
const Tt = Z && u && S.every(Boolean) ?
|
|
3805
|
+
return Xn(E, P, X, 2, G);
|
|
3806
|
+
}, ne = te(0), ue = te(P), J = ne && ue && ne.cost / X <= 180 && ue.cost / X <= 180 ? nc(m, ne.seam, ue.seam.map((ce) => ce + P)) : null;
|
|
3807
|
+
let Z = oc(J, h, m, [D, F]);
|
|
3808
|
+
Z && u && S.every(Boolean) && (Z = fc(Z, h, m, [D, F], y && !n ? d : null)), Z && p && (Z = Fc(Z, h, m, [D, F], f));
|
|
3809
|
+
const Tt = Z && u && S.every(Boolean) ? sc(h, m, [D, F]) : null;
|
|
3794
3810
|
return { mask: Z, strength: Tt, gain: [D, F] };
|
|
3795
3811
|
}
|
|
3796
|
-
function
|
|
3812
|
+
function Hi(t, e) {
|
|
3797
3813
|
const i = Math.asin(O(t[1], -1, 1));
|
|
3798
3814
|
let n = Math.atan2(t[0], t[2]);
|
|
3799
3815
|
const r = O((Math.abs(t[1]) - Math.sin(50 * Math.PI / 180)) / (Math.sin(70 * Math.PI / 180) - Math.sin(50 * Math.PI / 180)), 0, 1), o = 1 - r * r * (3 - 2 * r);
|
|
@@ -3803,15 +3819,15 @@ function Qi(t, e) {
|
|
|
3803
3819
|
const a = O(i + (e[1] * (1 - s) + e[3] * s) * o, -Math.PI / 2, Math.PI / 2);
|
|
3804
3820
|
return [Math.cos(a) * Math.sin(n), Math.sin(a), Math.cos(a) * Math.cos(n)];
|
|
3805
3821
|
}
|
|
3806
|
-
function
|
|
3822
|
+
function Fc(t, e, i, n, r) {
|
|
3807
3823
|
const o = t.slice();
|
|
3808
3824
|
for (const s of [0, X - 2]) {
|
|
3809
3825
|
const a = [0, 0];
|
|
3810
3826
|
for (let l = s; l < s + 2; l += 1) for (let u = 0; u < z; u += 1) {
|
|
3811
3827
|
const f = l * z + u, y = f * 3;
|
|
3812
3828
|
for (let p = 0; p < 2; p += 1) {
|
|
3813
|
-
const
|
|
3814
|
-
|
|
3829
|
+
const h = (e[p][y] * 0.2126 + e[p][y + 1] * 0.7152 + e[p][y + 2] * 0.0722) * n[p];
|
|
3830
|
+
h >= 12 && (a[p] += Math.sqrt(i[p][f]) * Math.min(h, 128));
|
|
3815
3831
|
}
|
|
3816
3832
|
}
|
|
3817
3833
|
let c = a[1] > a[0];
|
|
@@ -3819,7 +3835,7 @@ function xc(t, e, i, n, r) {
|
|
|
3819
3835
|
}
|
|
3820
3836
|
return o;
|
|
3821
3837
|
}
|
|
3822
|
-
function
|
|
3838
|
+
function Mc(t, e, i = null) {
|
|
3823
3839
|
if (!e) return t;
|
|
3824
3840
|
const n = new Uint8Array(t.length);
|
|
3825
3841
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -3828,15 +3844,15 @@ function bc(t, e, i = null) {
|
|
|
3828
3844
|
}
|
|
3829
3845
|
return n;
|
|
3830
3846
|
}
|
|
3831
|
-
function
|
|
3847
|
+
function Dc(t, e) {
|
|
3832
3848
|
if ((e == null ? void 0 : e.width) !== t.width || (e == null ? void 0 : e.height) !== t.height) return !0;
|
|
3833
3849
|
const { width: i, height: n, pixels: r } = t, o = e.pixels, s = (r instanceof Uint8Array || r instanceof Uint8ClampedArray) && (o instanceof Uint8Array || o instanceof Uint8ClampedArray) && r.byteOffset % 4 === 0 && o.byteOffset % 4 === 0 && r.length === i * n * 4 && o.length === r.length, a = s ? new Uint32Array(r.buffer, r.byteOffset, r.byteLength / 4) : null, c = s ? new Uint32Array(o.buffer, o.byteOffset, o.byteLength / 4) : null;
|
|
3834
3850
|
for (let l = 0; l < n; l += 8) for (let u = 0; u < i; u += 8) {
|
|
3835
3851
|
let f = 0, y = 0;
|
|
3836
|
-
const p = Math.min(l + 8, n),
|
|
3852
|
+
const p = Math.min(l + 8, n), h = Math.min(u + 8, i), d = l * i + u;
|
|
3837
3853
|
if (a && a[d] === c[d])
|
|
3838
|
-
for (let
|
|
3839
|
-
const b =
|
|
3854
|
+
for (let m = l; m < p; m += 2) for (let g = u; g < h; g += 2) {
|
|
3855
|
+
const b = m * i + g;
|
|
3840
3856
|
if (a[b] !== c[b]) {
|
|
3841
3857
|
const x = b * 4;
|
|
3842
3858
|
f += Math.abs(r[x] - o[x]), f += Math.abs(r[x + 1] - o[x + 1]), f += Math.abs(r[x + 2] - o[x + 2]);
|
|
@@ -3844,17 +3860,17 @@ function wc(t, e) {
|
|
|
3844
3860
|
y += 3;
|
|
3845
3861
|
}
|
|
3846
3862
|
else
|
|
3847
|
-
for (let
|
|
3848
|
-
const b = (
|
|
3863
|
+
for (let m = l; m < p; m += 2) for (let g = u; g < h; g += 2) {
|
|
3864
|
+
const b = (m * i + g) * 4;
|
|
3849
3865
|
f += Math.abs(r[b] - o[b]), f += Math.abs(r[b + 1] - o[b + 1]), f += Math.abs(r[b + 2] - o[b + 2]), y += 3;
|
|
3850
3866
|
}
|
|
3851
3867
|
if (f / y > 12) return !0;
|
|
3852
3868
|
}
|
|
3853
3869
|
return !1;
|
|
3854
3870
|
}
|
|
3855
|
-
function
|
|
3871
|
+
function Sc(t, e, i, n, r, o, s) {
|
|
3856
3872
|
var y;
|
|
3857
|
-
const a = n.every((p) => p.projectionModel === "dji_fisheye_lut"), c = a && (s != null && s.softwareFrames) ?
|
|
3873
|
+
const a = n.every((p) => p.projectionModel === "dji_fisheye_lut"), c = a && (s != null && s.softwareFrames) ? Ia(
|
|
3858
3874
|
e,
|
|
3859
3875
|
i,
|
|
3860
3876
|
null,
|
|
@@ -3863,12 +3879,12 @@ function Fc(t, e, i, n, r, o, s) {
|
|
|
3863
3879
|
{ convergenceM: 0, polarInverseDepth: r.polarInverseDepth || [0, 0], registrationOffsets: r.offsets, videoOffsets: r.offsets },
|
|
3864
3880
|
s.projections || (s.projections = {})
|
|
3865
3881
|
) : null;
|
|
3866
|
-
let l = a && (s != null && s.softwareFrames) ?
|
|
3867
|
-
if (l || (s != null && s.softwareFrames && ((y = s.prepareSoftwareFallback) == null || y.call(s)), l =
|
|
3882
|
+
let l = a && (s != null && s.softwareFrames) ? mc(s.softwareFrames, s.softwareReadback || (s.softwareReadback = {}), s.surface, c) : null;
|
|
3883
|
+
if (l || (s != null && s.softwareFrames && ((y = s.prepareSoftwareFallback) == null || y.call(s)), l = Gt(t, a ? 1024 : Ea, s)), !l) return null;
|
|
3868
3884
|
if (l.pixels[3] === 0) return;
|
|
3869
3885
|
const u = s == null ? void 0 : s.surface;
|
|
3870
|
-
if (u && !
|
|
3871
|
-
const f =
|
|
3886
|
+
if (u && !Dc(l, u)) return { reused: !0 };
|
|
3887
|
+
const f = za(
|
|
3872
3888
|
l,
|
|
3873
3889
|
{
|
|
3874
3890
|
...e,
|
|
@@ -3889,8 +3905,8 @@ function Fc(t, e, i, n, r, o, s) {
|
|
|
3889
3905
|
);
|
|
3890
3906
|
return f != null && f.mask ? (s && (s.surface = l), { mask: f.mask, strength: f.strength }) : null;
|
|
3891
3907
|
}
|
|
3892
|
-
function
|
|
3893
|
-
var
|
|
3908
|
+
function Jn(t, e, i, n) {
|
|
3909
|
+
var qr, Gr, Xr;
|
|
3894
3910
|
const r = i.externalFrames === !0, o = e instanceof HTMLVideoElement, s = o || r, a = t.getContext("webgl", {
|
|
3895
3911
|
alpha: !1,
|
|
3896
3912
|
antialias: !s,
|
|
@@ -3900,15 +3916,15 @@ function Hn(t, e, i, n) {
|
|
|
3900
3916
|
});
|
|
3901
3917
|
if (!a)
|
|
3902
3918
|
throw new Error("WebGL unavailable");
|
|
3903
|
-
const c = n === "dual_fisheye" ?
|
|
3904
|
-
t.dataset.insta360MEIConvention = u ? "true" : "false", t.dataset.insta360ProjectionKind = n, t.dataset.insta360CalibrationFrontModel = ((
|
|
3919
|
+
const c = n === "dual_fisheye" ? $s(i.dualFisheyeCalibration, i.dualFisheyeFrontLens) : null, l = (c == null ? void 0 : c.textureOrigin) !== "top-left", u = !!(n === "equirect" && i.equirectCameraConvention === "mei" || n === "dual_fisheye" && c && [c.front, c.back].some((M) => ["mei_extended", "dji_fisheye_lut"].includes(M.projectionModel)));
|
|
3920
|
+
t.dataset.insta360MEIConvention = u ? "true" : "false", t.dataset.insta360ProjectionKind = n, t.dataset.insta360CalibrationFrontModel = ((qr = c == null ? void 0 : c.front) == null ? void 0 : qr.projectionModel) || "";
|
|
3905
3921
|
const f = `
|
|
3906
3922
|
attribute vec2 aClipPosition;
|
|
3907
3923
|
void main() {
|
|
3908
3924
|
gl_Position = vec4(aClipPosition, 0.0, 1.0);
|
|
3909
3925
|
}
|
|
3910
|
-
`, y = i.equirectFlipX ? "1.0 - baseUV.x" : "baseUV.x", p = i.equirectFlipY ? "1.0 - baseUV.y" : "baseUV.y",
|
|
3911
|
-
gl_FragColor = sampleDualFisheye(vec3(${
|
|
3926
|
+
`, y = i.equirectFlipX ? "1.0 - baseUV.x" : "baseUV.x", p = i.equirectFlipY ? "1.0 - baseUV.y" : "baseUV.y", h = i.equirectFlipX ? "-dir.x" : "dir.x", d = i.equirectFlipY ? "-dir.y" : "dir.y", m = n === "dual_fisheye" ? "projectDualFisheye(dir)" : n === "eac" || n === "cubemap" ? "projectCube(dir)" : "projectEquirect(dir)", g = n === "dual_fisheye" ? `
|
|
3927
|
+
gl_FragColor = sampleDualFisheye(vec3(${h}, ${d}, dir.z));
|
|
3912
3928
|
` : `
|
|
3913
3929
|
vec4 base = ${n === "eac" || n === "cubemap" ? "sampleCubeTexture(uv)" : "texture2D(uTex, clampTexelUV(uv))"};
|
|
3914
3930
|
float seamDist = min(uv.x, 1.0 - uv.x);
|
|
@@ -3920,11 +3936,11 @@ function Hn(t, e, i, n) {
|
|
|
3920
3936
|
}
|
|
3921
3937
|
gl_FragColor = base;
|
|
3922
3938
|
`, b = n === "dual_fisheye" ? `
|
|
3923
|
-
vec2 baseUV = ${
|
|
3939
|
+
vec2 baseUV = ${m};
|
|
3924
3940
|
vec2 uv = vec2(${y}, ${p});
|
|
3925
3941
|
${g}
|
|
3926
3942
|
` : `
|
|
3927
|
-
vec2 baseUV = ${
|
|
3943
|
+
vec2 baseUV = ${m};
|
|
3928
3944
|
if (baseUV.x < 0.0 || baseUV.y < 0.0 || baseUV.x > 1.0 || baseUV.y > 1.0) {
|
|
3929
3945
|
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
3930
3946
|
return;
|
|
@@ -4475,15 +4491,15 @@ function Hn(t, e, i, n) {
|
|
|
4475
4491
|
`}
|
|
4476
4492
|
${b}
|
|
4477
4493
|
}
|
|
4478
|
-
`, v =
|
|
4494
|
+
`, v = Js(a, f, x);
|
|
4479
4495
|
a.useProgram(v);
|
|
4480
|
-
const w = a.getAttribLocation(v, "aClipPosition"), S = a.getUniformLocation(v, "uTex"), D = a.getUniformLocation(v, "uViewport"), F = a.getUniformLocation(v, "uTexel"), T = a.getUniformLocation(v, "uAspect"), L = a.getUniformLocation(v, "uTanHalfFov"), _ = a.getUniformLocation(v, "uViewQuat"), k = a.getUniformLocation(v, "uVisibleLens"), P = a.getUniformLocation(v, "uSeamWidth"), E = a.getUniformLocation(v, "uDualFisheyeFrontCenter"), j = a.getUniformLocation(v, "uDualFisheyeBackCenter"),
|
|
4481
|
-
if (!
|
|
4496
|
+
const w = a.getAttribLocation(v, "aClipPosition"), S = a.getUniformLocation(v, "uTex"), D = a.getUniformLocation(v, "uViewport"), F = a.getUniformLocation(v, "uTexel"), T = a.getUniformLocation(v, "uAspect"), L = a.getUniformLocation(v, "uTanHalfFov"), _ = a.getUniformLocation(v, "uViewQuat"), k = a.getUniformLocation(v, "uVisibleLens"), P = a.getUniformLocation(v, "uSeamWidth"), E = a.getUniformLocation(v, "uDualFisheyeFrontCenter"), j = a.getUniformLocation(v, "uDualFisheyeBackCenter"), q = a.getUniformLocation(v, "uDualFisheyeFrontValidRadius"), G = a.getUniformLocation(v, "uDualFisheyeBackValidRadius"), te = a.getUniformLocation(v, "uDualFisheyeFrontFocal"), ne = a.getUniformLocation(v, "uDualFisheyeBackFocal"), ue = a.getUniformLocation(v, "uDualFisheyeFrontPrincipalOffset"), J = a.getUniformLocation(v, "uDualFisheyeBackPrincipalOffset"), Z = a.getUniformLocation(v, "uDualFisheyeFrontScale"), Tt = a.getUniformLocation(v, "uDualFisheyeBackScale"), ce = a.getUniformLocation(v, "uDualFisheyeFrontRadial"), $ = a.getUniformLocation(v, "uDualFisheyeBackRadial"), xe = a.getUniformLocation(v, "uDualFisheyeFrontRadialScale"), pe = a.getUniformLocation(v, "uDualFisheyeBackRadialScale"), re = a.getUniformLocation(v, "uDualFisheyeDJIRadial5"), Te = a.getUniformLocation(v, "uDualFisheyeFrontTangential"), et = a.getUniformLocation(v, "uDualFisheyeBackTangential"), tt = a.getUniformLocation(v, "uDualFisheyeFrontXi"), Qt = a.getUniformLocation(v, "uDualFisheyeBackXi"), Ht = a.getUniformLocation(v, "uDualFisheyeFrontThinPrism"), Le = a.getUniformLocation(v, "uDualFisheyeBackThinPrism"), _e = a.getUniformLocation(v, "uDualFisheyeFrontSensorTilt"), it = a.getUniformLocation(v, "uDualFisheyeBackSensorTilt"), Ti = a.getUniformLocation(v, "uDualFisheyeConvergenceM"), ki = a.getUniformLocation(v, "uDualFisheyePolarInverseDepth"), Ri = ["Front", "Back"].map((M) => a.getUniformLocation(v, `uDualFisheye${M}TranslationM`)), at = ["Front", "Back"].map((M) => ["Pro0", "Pro1", "Pro2", "Pro12", "UsePro"].map((R) => a.getUniformLocation(v, `uDualFisheye${M}${R}`))), Pi = a.getUniformLocation(v, "uDualFisheyeFrontRotationQuat"), ja = a.getUniformLocation(v, "uDualFisheyeBackRotationQuat"), Na = a.getUniformLocation(v, "uDualFisheyeFrontUseMEI"), Oa = a.getUniformLocation(v, "uDualFisheyeBackUseMEI"), Va = a.getUniformLocation(v, "uDualFisheyeFrontUseDJI"), Wa = a.getUniformLocation(v, "uDualFisheyeBackUseDJI"), qa = a.getUniformLocation(v, "uDualFisheyeFrontAsymmetric"), Ga = a.getUniformLocation(v, "uDualFisheyeBackAsymmetric"), Xa = a.getUniformLocation(v, "uDualFisheyeFrontAxis"), $a = a.getUniformLocation(v, "uDualFisheyeBackAxis"), Ya = a.getUniformLocation(v, "uDualFisheyeFrontRight"), Qa = a.getUniformLocation(v, "uDualFisheyeBackRight"), Ha = a.getUniformLocation(v, "uDualFisheyeFrontUp"), Ja = a.getUniformLocation(v, "uDualFisheyeBackUp"), Ka = a.getUniformLocation(v, "uDualFisheyeMaxTheta"), Za = a.getUniformLocation(v, "uDualFisheyeBlendBand"), er = a.getUniformLocation(v, "uDualFisheyeSeamX"), tr = a.getUniformLocation(v, "uDualFisheyeSeamBlendX"), ir = a.getUniformLocation(v, "uDualFisheyeSeamFrontWrap"), ar = a.getUniformLocation(v, "uDualFisheyeUseSeamLongitudes"), rr = a.getUniformLocation(v, "uDualFisheyeGain"), io = a.getUniformLocation(v, "uDualFisheyeFrontRemap"), ao = a.getUniformLocation(v, "uDualFisheyeBackRemap"), nr = a.getUniformLocation(v, "uDualFisheyeUseRemap"), or = a.getUniformLocation(v, "uDualFisheyeSeamMask"), sr = a.getUniformLocation(v, "uDualFisheyeUseSeamMask"), cr = a.getUniformLocation(v, "uDualFisheyeVideoOffsets"), lr = a.getUniformLocation(v, "uDualFisheyeVideoSeam"), aa = a.createBuffer();
|
|
4497
|
+
if (!aa)
|
|
4482
4498
|
throw new Error("buffer create failed");
|
|
4483
|
-
a.bindBuffer(a.ARRAY_BUFFER,
|
|
4499
|
+
a.bindBuffer(a.ARRAY_BUFFER, aa), a.bufferData(a.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), a.STATIC_DRAW), a.enableVertexAttribArray(w), a.vertexAttribPointer(w, 2, a.FLOAT, !1, 0, 0);
|
|
4484
4500
|
const ft = a.createTexture();
|
|
4485
4501
|
if (!ft) throw new Error("texture create failed");
|
|
4486
|
-
const Jt = r ? a.createTexture() : null,
|
|
4502
|
+
const Jt = r ? a.createTexture() : null, ro = a.getUniformLocation(v, "uSeparateLenses"), no = a.getUniformLocation(v, "uVerticalLenses");
|
|
4487
4503
|
Jt && (a.activeTexture(a.TEXTURE4), a.bindTexture(a.TEXTURE_2D, Jt), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, a.LINEAR), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER, a.LINEAR), a.uniform1i(a.getUniformLocation(v, "uBackTex"), 4));
|
|
4488
4504
|
let Kt = { width: 1, height: 1 };
|
|
4489
4505
|
a.activeTexture(a.TEXTURE0), a.bindTexture(a.TEXTURE_2D, ft), a.uniform1i(S, 0), a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, l ? 1 : 0), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, a.LINEAR), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER, a.LINEAR), a.texImage2D(
|
|
@@ -4497,15 +4513,15 @@ function Hn(t, e, i, n) {
|
|
|
4497
4513
|
a.UNSIGNED_BYTE,
|
|
4498
4514
|
new Uint8Array([0, 0, 0, 255])
|
|
4499
4515
|
);
|
|
4500
|
-
function
|
|
4516
|
+
function ur(M, R, C, I, V) {
|
|
4501
4517
|
if (!R || !(C instanceof Uint8Array) || I <= 0 || V <= 0)
|
|
4502
4518
|
return null;
|
|
4503
4519
|
const U = a.createTexture();
|
|
4504
4520
|
return U ? (a.activeTexture(a.TEXTURE0 + M), a.bindTexture(a.TEXTURE_2D, U), a.uniform1i(R, M), a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, 0), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, a.LINEAR), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER, a.LINEAR), a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, I, V, 0, a.RGBA, a.UNSIGNED_BYTE, C), a.activeTexture(a.TEXTURE0), a.bindTexture(a.TEXTURE_2D, ft), a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, 1), U) : null;
|
|
4505
4521
|
}
|
|
4506
4522
|
a.disable(a.CULL_FACE), a.disable(a.DEPTH_TEST);
|
|
4507
|
-
function
|
|
4508
|
-
const R =
|
|
4523
|
+
function oo() {
|
|
4524
|
+
const R = ia(i.dualFisheyeSeamLongitudesDeg).map((V) => Da(V) / 360).sort((V, U) => V - U), C = Fr ? Math.atan2(Et[0], Et[2]) / (2 * Math.PI) + 0.5 : 0.5, I = !(C >= R[0] && C <= R[1]);
|
|
4509
4525
|
return {
|
|
4510
4526
|
seamX: R,
|
|
4511
4527
|
frontWrap: I,
|
|
@@ -4514,85 +4530,85 @@ function Hn(t, e, i, n) {
|
|
|
4514
4530
|
};
|
|
4515
4531
|
}
|
|
4516
4532
|
const Zt = s && typeof e.requestVideoFrameCallback == "function" && typeof e.cancelVideoFrameCallback == "function";
|
|
4517
|
-
let kt = 0, Rt = 0, Pt = 0, ht = i.fovDeg, ei = !0, ti = !0, rt = 0, At = 0, ii = !0,
|
|
4518
|
-
const
|
|
4519
|
-
let je = null, Lt = null, Ne = 0,
|
|
4520
|
-
const
|
|
4521
|
-
let Oe = c ? ye(c.front.validRadius) :
|
|
4522
|
-
const
|
|
4523
|
-
let ke = c ? ye(c.front.focal) :
|
|
4524
|
-
const
|
|
4533
|
+
let kt = 0, Rt = 0, Pt = 0, ht = i.fovDeg, ei = !0, ti = !0, rt = 0, At = 0, ii = !0, ra = { width: 1, height: 1 };
|
|
4534
|
+
const Ai = [];
|
|
4535
|
+
let je = null, Lt = null, Ne = 0, dr = 0, fr = 0, na = "initial";
|
|
4536
|
+
const hr = s && !Zt, Li = Hs(i.background), mr = Yi(e), Me = n === "dual_fisheye" && Qs(mr.width, mr.height), be = c && !Me ? c.remap : null, _t = i.dualFisheyeFovDeg * Math.PI / 360, so = c ? c.front.center : i.dualFisheyeFrontCenter || (i.dualFisheyeFrontLens === "left" ? [0.25, 0.5] : [0.75, 0.5]), co = c ? c.back.center : i.dualFisheyeBackCenter || (i.dualFisheyeFrontLens === "left" ? [0.75, 0.5] : [0.25, 0.5]), lo = !!(c && ((Gr = c.imageSize) == null ? void 0 : Gr[1]) > ((Xr = c.imageSize) == null ? void 0 : Xr[0])), ye = (M) => Me && !lo ? [M[1], M[0]] : M, Ut = ye(so), ai = ye(co), pr = Wn(Ut, ai);
|
|
4537
|
+
let Oe = c ? ye(c.front.validRadius) : pr, Ve = c ? ye(c.back.validRadius) : pr;
|
|
4538
|
+
const _i = ye(c ? c.front.scale : fe(i.dualFisheyeScale, [0.247, 0.494])), Ui = ye(c ? c.back.scale : fe(i.dualFisheyeScale, [0.247, 0.494]));
|
|
4539
|
+
let ke = c ? ye(c.front.focal) : Sa(_i, _t), Re = c ? ye(c.back.focal) : Sa(Ui, _t);
|
|
4540
|
+
const oa = c ? ye(c.front.principalOffset) : [0, 0], sa = c ? ye(c.back.principalOffset) : [0, 0], ri = c ? c.front.radial : [0, 0, 0, 0], ni = c ? c.back.radial : [0, 0, 0, 0], yr = c ? c.front.radialScale : 1, gr = c ? c.back.radialScale : 1, ca = c ? c.front.tangential : [0, 0], la = c ? c.back.tangential : [0, 0], vr = c ? c.front.xi : 0, xr = c ? c.back.xi : 0, oi = c ? c.front.thinPrism : [0, 0, 0, 0], si = c ? c.back.thinPrism : [0, 0, 0, 0], br = c ? ye(c.front.sensorTilt) : [0, 0], wr = c ? ye(c.back.sensorTilt) : [0, 0], uo = !!(c && c.front.projectionModel === "mei_extended"), fo = !!(c && c.back.projectionModel === "mei_extended"), Fr = !!(c && c.front.projectionModel === "dji_fisheye_lut"), ho = !!(c && c.back.projectionModel === "dji_fisheye_lut"), Ei = c ? c.front.asymmetric : [0, 0, 0, 0], Ci = c ? c.back.asymmetric : [0, 0, 0, 0], Et = c ? c.front.axis : [0, 0, -1], Ii = c ? c.back.axis : [0, 0, 1], zi = c ? c.front.right : [1, 0, 0], Bi = c ? c.back.right : [-1, 0, 0], ji = c ? c.front.up : [0, 1, 0], Ni = c ? c.back.up : [0, 1, 0], We = {
|
|
4525
4541
|
...c ? c.front : {},
|
|
4526
4542
|
center: Ut,
|
|
4527
4543
|
focal: ke,
|
|
4528
|
-
principalOffset:
|
|
4529
|
-
scale:
|
|
4544
|
+
principalOffset: oa,
|
|
4545
|
+
scale: _i,
|
|
4530
4546
|
validRadius: Oe,
|
|
4531
4547
|
radial: ri,
|
|
4532
|
-
radialScale:
|
|
4533
|
-
tangential:
|
|
4548
|
+
radialScale: yr,
|
|
4549
|
+
tangential: ca,
|
|
4534
4550
|
projectionModel: c ? c.front.projectionModel : "equidistant",
|
|
4535
|
-
xi:
|
|
4551
|
+
xi: vr,
|
|
4536
4552
|
thinPrism: oi,
|
|
4537
4553
|
axis: Et,
|
|
4538
|
-
right:
|
|
4539
|
-
up:
|
|
4540
|
-
},
|
|
4554
|
+
right: zi,
|
|
4555
|
+
up: ji
|
|
4556
|
+
}, qe = {
|
|
4541
4557
|
...c ? c.back : {},
|
|
4542
4558
|
center: ai,
|
|
4543
4559
|
focal: Re,
|
|
4544
|
-
principalOffset:
|
|
4545
|
-
scale:
|
|
4560
|
+
principalOffset: sa,
|
|
4561
|
+
scale: Ui,
|
|
4546
4562
|
validRadius: Ve,
|
|
4547
4563
|
radial: ni,
|
|
4548
|
-
radialScale:
|
|
4549
|
-
tangential:
|
|
4564
|
+
radialScale: gr,
|
|
4565
|
+
tangential: la,
|
|
4550
4566
|
projectionModel: c ? c.back.projectionModel : "equidistant",
|
|
4551
|
-
xi:
|
|
4567
|
+
xi: xr,
|
|
4552
4568
|
thinPrism: si,
|
|
4553
|
-
axis:
|
|
4554
|
-
right:
|
|
4555
|
-
up:
|
|
4556
|
-
},
|
|
4557
|
-
let mt = null, Ue = 0,
|
|
4558
|
-
const
|
|
4559
|
-
nt && (Oe = We.validRadius = Vt(We), Ve =
|
|
4560
|
-
const pt =
|
|
4561
|
-
let ot = [0, 0, 0, 0], st = pt && !zt, Bt = 0,
|
|
4569
|
+
axis: Ii,
|
|
4570
|
+
right: Bi,
|
|
4571
|
+
up: Ni
|
|
4572
|
+
}, Mr = be ? ur(1, io, be.front, be.width, be.height) : null, Dr = be ? ur(2, ao, be.back, be.width, be.height) : null, Ge = oo();
|
|
4573
|
+
let mt = null, Ue = 0, ua = !1, Ct = [i.dualFisheyeGainFront, i.dualFisheyeGainBack], Oi = 0, It = [0, 0];
|
|
4574
|
+
const mo = [c == null ? void 0 : c.front, c == null ? void 0 : c.back].map((M) => (M == null ? void 0 : M.distortionCoeffs) || Array(13).fill(0)), po = !!(s && n === "dual_fisheye" && c && !be && !Me && c.imageSize[0] === 2 * c.imageSize[1] && [We, qe].every((M) => M.projectionModel === "mei_extended" && (M.distortionModel === "radtan_pro" || i.dualFisheyeVideoProtection === !0))), nt = !!(s && n === "dual_fisheye" && c && !be && !Me && c.imageSize[0] === 2 * c.imageSize[1] && [We, qe].every((M) => M.projectionModel === "dji_fisheye_lut"));
|
|
4575
|
+
nt && (Oe = We.validRadius = Vt(We), Ve = qe.validRadius = Vt(qe));
|
|
4576
|
+
const pt = po || nt, zt = pt && i.dualFisheyeVideoRegistration === !0;
|
|
4577
|
+
let ot = [0, 0, 0, 0], st = pt && !zt, Bt = 0, da = 0;
|
|
4562
4578
|
t.dataset.insta360VideoRegistration = zt ? "pending" : pt ? "calibrated" : "unsupported";
|
|
4563
|
-
function
|
|
4564
|
-
if (!zt || st || Bt >= 3 || e.currentTime <
|
|
4579
|
+
function Sr() {
|
|
4580
|
+
if (!zt || st || Bt >= 3 || e.currentTime < da) return;
|
|
4565
4581
|
const M = Date.now();
|
|
4566
4582
|
try {
|
|
4567
|
-
const R = (nt ?
|
|
4583
|
+
const R = (nt ? yc : pc)(e, i, c, [We, qe]);
|
|
4568
4584
|
if (R === void 0) return;
|
|
4569
|
-
R && (ot = R.offsets, It = R.polarInverseDepth || [0, 0], Ct = R.gain, nt ? (ke = ke.map((C) => C * R.focalScale), Re = Re.map((C) => C * R.focalScale), t.dataset.insta360VideoFocalScale = String(R.focalScale)) : (Oe = Vt(We), Ve = Vt(
|
|
4585
|
+
R && (ot = R.offsets, It = R.polarInverseDepth || [0, 0], Ct = R.gain, nt ? (ke = ke.map((C) => C * R.focalScale), Re = Re.map((C) => C * R.focalScale), t.dataset.insta360VideoFocalScale = String(R.focalScale)) : (Oe = Vt(We), Ve = Vt(qe)), st = !0);
|
|
4570
4586
|
} catch {
|
|
4571
4587
|
}
|
|
4572
|
-
Bt += 1,
|
|
4588
|
+
Bt += 1, da = e.currentTime + 1, t.dataset.insta360VideoRegistration = st ? "ready" : Bt < 3 ? "pending" : "fallback", t.dataset.insta360VideoRegistrationAttempts = String(Bt), t.dataset.insta360VideoRegistrationMS = String(Date.now() - M);
|
|
4573
4589
|
}
|
|
4574
4590
|
if (!s && n === "dual_fisheye") {
|
|
4575
|
-
|
|
4591
|
+
ua = !0;
|
|
4576
4592
|
try {
|
|
4577
|
-
const M =
|
|
4593
|
+
const M = bc(
|
|
4578
4594
|
e,
|
|
4579
4595
|
i,
|
|
4580
4596
|
c,
|
|
4581
4597
|
be,
|
|
4582
4598
|
We,
|
|
4583
|
-
|
|
4599
|
+
qe,
|
|
4584
4600
|
_t
|
|
4585
4601
|
);
|
|
4586
|
-
M && (Ct = M.gain,
|
|
4602
|
+
M && (Ct = M.gain, Oi = M.convergenceM, It = M.polarInverseDepth || [0, 0], ot = M.imageOffsets || [0, 0, 0, 0], ke = ke.map((R) => R * M.focalScale), Re = Re.map((R) => R * M.focalScale)), Tr(M == null ? void 0 : M.mask);
|
|
4587
4603
|
} catch (M) {
|
|
4588
4604
|
t.dataset.insta360StaticSeamError = String((M == null ? void 0 : M.message) || M), mt = null, Ue = 0;
|
|
4589
4605
|
}
|
|
4590
4606
|
}
|
|
4591
|
-
t.dataset.insta360StaticSeamAnalyzed =
|
|
4592
|
-
function
|
|
4593
|
-
if (!(M instanceof Uint8Array) || !
|
|
4607
|
+
t.dataset.insta360StaticSeamAnalyzed = ua ? "true" : "false", t.dataset.insta360StaticSeamStatus = ua ? Ue ? "ready" : "fallback" : "not-applicable";
|
|
4608
|
+
function Tr(M, R = null) {
|
|
4609
|
+
if (!(M instanceof Uint8Array) || !or || (mt || (mt = a.createTexture()), !mt)) return !1;
|
|
4594
4610
|
try {
|
|
4595
|
-
a.activeTexture(a.TEXTURE3), a.bindTexture(a.TEXTURE_2D, mt), a.uniform1i(
|
|
4611
|
+
a.activeTexture(a.TEXTURE3), a.bindTexture(a.TEXTURE_2D, mt), a.uniform1i(or, 3), a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, 0), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, a.LINEAR), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER, a.LINEAR);
|
|
4596
4612
|
const C = R ? a.LUMINANCE_ALPHA : a.LUMINANCE, I = R ? Uint8Array.from({ length: M.length * 2 }, (V, U) => U % 2 ? R[U >> 1] : M[U >> 1]) : M;
|
|
4597
4613
|
return a.texImage2D(a.TEXTURE_2D, 0, C, z, X, 0, C, a.UNSIGNED_BYTE, I), Ue = 1, !0;
|
|
4598
4614
|
} finally {
|
|
@@ -4601,63 +4617,63 @@ function Hn(t, e, i, n) {
|
|
|
4601
4617
|
}
|
|
4602
4618
|
let yt = null;
|
|
4603
4619
|
const he = {};
|
|
4604
|
-
let
|
|
4605
|
-
function
|
|
4620
|
+
let Vi = 1, ci = null, gt = -1 / 0, Pe = 0, kr = 0;
|
|
4621
|
+
function Rr() {
|
|
4606
4622
|
if (!pt || !st || Pe >= 3 || e.seeking || e.currentTime + 1e-6 < gt) return;
|
|
4607
4623
|
const M = Date.now();
|
|
4608
4624
|
try {
|
|
4609
|
-
const C =
|
|
4625
|
+
const C = Sc(
|
|
4610
4626
|
e,
|
|
4611
4627
|
i,
|
|
4612
4628
|
c,
|
|
4613
|
-
[{ ...We, focal: ke, validRadius: Oe }, { ...
|
|
4629
|
+
[{ ...We, focal: ke, validRadius: Oe }, { ...qe, focal: Re, validRadius: Ve }],
|
|
4614
4630
|
{ offsets: ot, gain: Ct, polarInverseDepth: It },
|
|
4615
4631
|
yt,
|
|
4616
4632
|
he
|
|
4617
4633
|
);
|
|
4618
4634
|
if (C === void 0) return;
|
|
4619
4635
|
if (C != null && C.reused) {
|
|
4620
|
-
gt = e.currentTime +
|
|
4636
|
+
gt = e.currentTime + Vi, t.dataset.insta360VideoSeam = "cached";
|
|
4621
4637
|
return;
|
|
4622
4638
|
}
|
|
4623
4639
|
const I = C == null ? void 0 : C.mask;
|
|
4624
4640
|
if (I instanceof Uint8Array) {
|
|
4625
|
-
const V =
|
|
4626
|
-
|
|
4641
|
+
const V = Mc(I, yt, C.strength);
|
|
4642
|
+
Tr(V, C.strength) ? (yt = V, Pe = 0, kr += 1) : Pe += 1;
|
|
4627
4643
|
} else Pe += 1;
|
|
4628
4644
|
} catch {
|
|
4629
4645
|
Pe += 1;
|
|
4630
4646
|
}
|
|
4631
4647
|
Pe >= 3 && (Ue = 0, yt = null);
|
|
4632
4648
|
const R = Date.now() - M;
|
|
4633
|
-
|
|
4649
|
+
Vi = R > 100 ? 5 : R > 33 ? 3 : 1, gt = e.currentTime + Vi, t.dataset.insta360VideoSeamUpdates = String(kr), t.dataset.insta360VideoSeamMS = String(R), t.dataset.insta360VideoSeamInterval = String(Vi), t.dataset.insta360VideoSeam = Ue ? "ready" : Pe >= 3 ? "fallback" : "pending";
|
|
4634
4650
|
}
|
|
4635
|
-
function
|
|
4651
|
+
function fa() {
|
|
4636
4652
|
!Zt || !ti || !s || e.paused || e.ended || At || (At = e.requestVideoFrameCallback(() => {
|
|
4637
|
-
At = 0, (jt ||
|
|
4653
|
+
At = 0, (jt || ma(performance.now(), ui)) && (ii = !0, vt()), fa();
|
|
4638
4654
|
}));
|
|
4639
4655
|
}
|
|
4640
|
-
function
|
|
4656
|
+
function yo() {
|
|
4641
4657
|
!Zt || !At || !s || (e.cancelVideoFrameCallback(At), At = 0);
|
|
4642
4658
|
}
|
|
4643
|
-
function
|
|
4659
|
+
function go(M) {
|
|
4644
4660
|
let R = Number(M) || 0;
|
|
4645
4661
|
return R = (R % 360 + 360) % 360, R > 180 && (R -= 360), R;
|
|
4646
4662
|
}
|
|
4647
|
-
function
|
|
4648
|
-
kt =
|
|
4663
|
+
function vo(M, R, C, I) {
|
|
4664
|
+
kt = go(M), Rt = O(Number(R) || 0, -85, 85), typeof I == "number" ? (Pt = O(Number(C) || 0, -180, 180), ht = O(Number(I) || ee.fovDeg, i.minFovDeg, i.maxFovDeg)) : ht = O(Number(C) || ee.fovDeg, i.minFovDeg, i.maxFovDeg), ei = !0;
|
|
4649
4665
|
}
|
|
4650
|
-
function
|
|
4666
|
+
function xo() {
|
|
4651
4667
|
const M = s ? 1.5 : 2, R = i.maxRenderPixelRatio > 0 ? i.maxRenderPixelRatio : M, C = Math.max(1, Math.min(R, window.devicePixelRatio || 1)), I = i.captureEquirectangular ? 1024 : Math.max(1, t.clientWidth | 0), V = i.captureEquirectangular ? 512 : Math.max(1, t.clientHeight | 0), U = Ce.maxRenderPixels > 0 ? Math.min(1, Math.sqrt(Ce.maxRenderPixels / (I * V * C * C))) : 1, W = Math.max(1, Math.floor(I * C * U)), oe = Math.max(1, Math.floor(V * C * U));
|
|
4652
|
-
(t.width !== W || t.height !== oe) && (t.width = W, t.height = oe, a.viewport(0, 0, W, oe), ei = !0,
|
|
4668
|
+
(t.width !== W || t.height !== oe) && (t.width = W, t.height = oe, a.viewport(0, 0, W, oe), ei = !0, fr += 1, na = "resize", t.dataset.insta360ResizeCount = String(fr), t.dataset.insta360CanvasWidth = String(W), t.dataset.insta360CanvasHeight = String(oe));
|
|
4653
4669
|
}
|
|
4654
|
-
function
|
|
4670
|
+
function Pr() {
|
|
4655
4671
|
for (let M = 0; M < 16 && a.getError() !== a.NO_ERROR; M += 1)
|
|
4656
4672
|
;
|
|
4657
4673
|
}
|
|
4658
|
-
function
|
|
4659
|
-
const I = typeof performance < "u" ? performance.now() : Date.now(), V = Kt.width !== R || Kt.height !== C || I >=
|
|
4660
|
-
V &&
|
|
4674
|
+
function Ar(M, R, C) {
|
|
4675
|
+
const I = typeof performance < "u" ? performance.now() : Date.now(), V = Kt.width !== R || Kt.height !== C || I >= Ir;
|
|
4676
|
+
V && Pr(), a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, l ? 1 : 0);
|
|
4661
4677
|
const U = Kt.width === R && Kt.height === C;
|
|
4662
4678
|
try {
|
|
4663
4679
|
U ? a.texSubImage2D(a.TEXTURE_2D, 0, 0, 0, a.RGBA, a.UNSIGNED_BYTE, M) : a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, a.RGBA, a.UNSIGNED_BYTE, M);
|
|
@@ -4665,10 +4681,10 @@ function Hn(t, e, i, n) {
|
|
|
4665
4681
|
return t.dataset.insta360TextureStatus = "exception", !1;
|
|
4666
4682
|
}
|
|
4667
4683
|
const W = V ? a.getError() : a.NO_ERROR;
|
|
4668
|
-
return V && (
|
|
4684
|
+
return V && (Ir = I + 1e3), W !== a.NO_ERROR ? (t.dataset.insta360TextureStatus = `error-${W}`, !1) : (Kt = { width: R, height: C }, ra = { width: R, height: C }, t.dataset.insta360TextureStatus = "ready", t.dataset.insta360TextureWidth = String(R), t.dataset.insta360TextureHeight = String(C), !0);
|
|
4669
4685
|
}
|
|
4670
|
-
function
|
|
4671
|
-
const R =
|
|
4686
|
+
function bo(M) {
|
|
4687
|
+
const R = Yi(e);
|
|
4672
4688
|
if (M >= R.width && M >= R.height)
|
|
4673
4689
|
return {
|
|
4674
4690
|
source: e,
|
|
@@ -4687,7 +4703,7 @@ function Hn(t, e, i, n) {
|
|
|
4687
4703
|
const W = U.getContext("2d", { alpha: !1 });
|
|
4688
4704
|
if (!W) return null;
|
|
4689
4705
|
try {
|
|
4690
|
-
|
|
4706
|
+
qn.has(e) && (W.translate(0, V), W.scale(1, -1)), W.drawImage(e, 0, 0, I, V);
|
|
4691
4707
|
} catch {
|
|
4692
4708
|
return U.width = 0, U.height = 0, null;
|
|
4693
4709
|
}
|
|
@@ -4700,40 +4716,40 @@ function Hn(t, e, i, n) {
|
|
|
4700
4716
|
}
|
|
4701
4717
|
};
|
|
4702
4718
|
}
|
|
4703
|
-
function
|
|
4719
|
+
function wo() {
|
|
4704
4720
|
if (r || s && e.readyState < 2) return !1;
|
|
4705
4721
|
a.activeTexture(a.TEXTURE0), a.bindTexture(a.TEXTURE_2D, ft);
|
|
4706
|
-
const M =
|
|
4722
|
+
const M = Yi(e);
|
|
4707
4723
|
if (s) {
|
|
4708
|
-
const U =
|
|
4709
|
-
return
|
|
4724
|
+
const U = Br(M.width, M.height);
|
|
4725
|
+
return Ar(jr(e, M.width, M.height, U, 0), U.width, U.height);
|
|
4710
4726
|
}
|
|
4711
|
-
const R = Math.max(1, Number(a.getParameter(a.MAX_TEXTURE_SIZE)) || 1), C = Math.max(M.width, M.height), V = [Math.min(C, R,
|
|
4727
|
+
const R = Math.max(1, Number(a.getParameter(a.MAX_TEXTURE_SIZE)) || 1), C = Math.max(M.width, M.height), V = [Math.min(C, R, pn[0]), ...pn].filter((U, W, oe) => U <= R && U <= C && oe.indexOf(U) === W).sort((U, W) => W - U);
|
|
4712
4728
|
for (const U of V) {
|
|
4713
|
-
const W =
|
|
4729
|
+
const W = bo(U);
|
|
4714
4730
|
if (!W) continue;
|
|
4715
|
-
if (
|
|
4731
|
+
if (Ar(W.source, W.width, W.height))
|
|
4716
4732
|
return Ne && (cancelAnimationFrame(Ne), Ne = 0), W.retainUntilDestroy ? (Lt && Lt(), Lt = W.release, t.dataset.insta360TextureSource = "retained") : (je && je(), je = W.release, typeof ImageBitmap < "u" && e instanceof ImageBitmap && (Lt = () => e.close())), !0;
|
|
4717
4733
|
W.retainUntilDestroy || W.release();
|
|
4718
4734
|
}
|
|
4719
4735
|
return !1;
|
|
4720
4736
|
}
|
|
4721
|
-
function
|
|
4737
|
+
function Fo() {
|
|
4722
4738
|
s || !je || Ne || (Ne = requestAnimationFrame(() => {
|
|
4723
4739
|
Ne = requestAnimationFrame(() => {
|
|
4724
4740
|
Ne = 0, je && (je(), je = null, t.dataset.insta360TextureSource = "released");
|
|
4725
4741
|
});
|
|
4726
4742
|
}));
|
|
4727
4743
|
}
|
|
4728
|
-
let
|
|
4729
|
-
function
|
|
4744
|
+
let Lr = "";
|
|
4745
|
+
function ha() {
|
|
4730
4746
|
var U;
|
|
4731
4747
|
if (!ti) return;
|
|
4732
4748
|
const M = typeof performance < "u" ? performance.now() : Date.now();
|
|
4733
|
-
rt = 0,
|
|
4734
|
-
const R = o && !e.paused && !e.ended, C = !R || jt ||
|
|
4735
|
-
if (V && (ii = !1, s && (
|
|
4736
|
-
const W =
|
|
4749
|
+
rt = 0, xo();
|
|
4750
|
+
const R = o && !e.paused && !e.ended, C = !R || jt || ma(M, ui), V = (ii || hr && R) && (!o || C) ? wo() : !1;
|
|
4751
|
+
if (V && (ii = !1, s && (Sr(), Rr())), ei || V) {
|
|
4752
|
+
const W = ra, oe = Er(), Ie = Ut[Me ? 1 : 0] < 0.5 ? 0 : 1, $e = oe.every(Boolean) ? 0 : oe[Ie] ? 1 : 2, De = [
|
|
4737
4753
|
W.width,
|
|
4738
4754
|
W.height,
|
|
4739
4755
|
t.width,
|
|
@@ -4746,63 +4762,63 @@ function Hn(t, e, i, n) {
|
|
|
4746
4762
|
Ve,
|
|
4747
4763
|
ke,
|
|
4748
4764
|
Re,
|
|
4749
|
-
|
|
4765
|
+
Oi,
|
|
4750
4766
|
It,
|
|
4751
4767
|
ot,
|
|
4752
4768
|
Ct,
|
|
4753
4769
|
Ue,
|
|
4754
4770
|
$e
|
|
4755
4771
|
].join(":");
|
|
4756
|
-
if (De !==
|
|
4757
|
-
const Ye = 1 / Math.max(1, W.width), we = 1 / Math.max(1, W.height), Qe = Math.max(Ye * 6, 35e-4), ct = Ot(0, 1, 0, -kt * Math.PI / 180), xt = Ot(1, 0, 0, -Rt * Math.PI / 180), lt = Ot(0, 0, 1, -Pt * Math.PI / 180), ze =
|
|
4758
|
-
F && a.uniform2f(F, Ye, we), D && a.uniform2f(D, t.width, t.height), T && a.uniform1f(T, Y), L && a.uniform1f(L, Math.tan(ht * Math.PI / 360)), _ && a.uniform4f(_, ze.x, ze.y, ze.z, ze.w), P && a.uniform1f(P, Qe), E && a.uniform2f(E, Ut[0], Ut[1]), j && a.uniform2f(j, ai[0], ai[1]),
|
|
4772
|
+
if (De !== Lr) {
|
|
4773
|
+
const Ye = 1 / Math.max(1, W.width), we = 1 / Math.max(1, W.height), Qe = Math.max(Ye * 6, 35e-4), ct = Ot(0, 1, 0, -kt * Math.PI / 180), xt = Ot(1, 0, 0, -Rt * Math.PI / 180), lt = Ot(0, 0, 1, -Pt * Math.PI / 180), ze = wn(Wt(Wt(ct, xt), lt)), Y = t.width / t.height;
|
|
4774
|
+
F && a.uniform2f(F, Ye, we), D && a.uniform2f(D, t.width, t.height), T && a.uniform1f(T, Y), L && a.uniform1f(L, Math.tan(ht * Math.PI / 360)), _ && a.uniform4f(_, ze.x, ze.y, ze.z, ze.w), P && a.uniform1f(P, Qe), E && a.uniform2f(E, Ut[0], Ut[1]), j && a.uniform2f(j, ai[0], ai[1]), q && a.uniform2f(q, Oe[0], Oe[1]), G && a.uniform2f(G, Ve[0], Ve[1]), te && a.uniform2f(te, ke[0], ke[1]), ne && a.uniform2f(ne, Re[0], Re[1]), ue && a.uniform2f(ue, oa[0], oa[1]), J && a.uniform2f(J, sa[0], sa[1]), Z && a.uniform2f(Z, _i[0], _i[1]), Tt && a.uniform2f(Tt, Ui[0], Ui[1]), ce && a.uniform4f(ce, ri[0], ri[1], ri[2], ri[3]), $ && a.uniform4f($, ni[0], ni[1], ni[2], ni[3]), xe && a.uniform1f(xe, yr), pe && a.uniform1f(pe, gr), re && a.uniform2f(
|
|
4759
4775
|
re,
|
|
4760
4776
|
(c == null ? void 0 : c.front.distortionCoeffs[4]) || 0,
|
|
4761
4777
|
(c == null ? void 0 : c.back.distortionCoeffs[4]) || 0
|
|
4762
|
-
), Te && a.uniform2f(Te,
|
|
4778
|
+
), Te && a.uniform2f(Te, ca[0], ca[1]), et && a.uniform2f(et, la[0], la[1]), tt && a.uniform1f(tt, vr), Qt && a.uniform1f(Qt, xr), Ht && a.uniform4f(Ht, oi[0], oi[1], oi[2], oi[3]), Le && a.uniform4f(Le, si[0], si[1], si[2], si[3]), _e && a.uniform2f(_e, br[0], br[1]), it && a.uniform2f(it, wr[0], wr[1]), Ti && a.uniform1f(Ti, Oi), ki && a.uniform2f(ki, ...It), cr && a.uniform4f(cr, ...ot), lr && a.uniform1f(lr, pt ? 1 : 0);
|
|
4763
4779
|
for (let K = 0; K < 2; K += 1) {
|
|
4764
4780
|
const se = K === 0 ? c == null ? void 0 : c.front : c == null ? void 0 : c.back;
|
|
4765
|
-
|
|
4766
|
-
const Fe =
|
|
4781
|
+
Ri[K] && a.uniform3f(Ri[K], ...(se == null ? void 0 : se.translationM) || [0, 0, 0]);
|
|
4782
|
+
const Fe = mo[K];
|
|
4767
4783
|
for (let Ae = 0; Ae < 3; Ae += 1)
|
|
4768
4784
|
at[K][Ae] && a.uniform4fv(at[K][Ae], Fe.slice(Ae * 4, Ae * 4 + 4));
|
|
4769
4785
|
at[K][3] && a.uniform1f(at[K][3], Fe[12]), at[K][4] && a.uniform1f(at[K][4], (se == null ? void 0 : se.distortionModel) === "radtan_pro" ? 1 : 0);
|
|
4770
4786
|
}
|
|
4771
|
-
|
|
4787
|
+
Pi && a.uniform4f(Pi, ...(c == null ? void 0 : c.front.rotationQuat) || [1, 0, 0, 0]), ja && a.uniform4f(ja, ...(c == null ? void 0 : c.back.rotationQuat) || [1, 0, 0, 0]), Na && a.uniform1f(Na, uo ? 1 : 0), Oa && a.uniform1f(Oa, fo ? 1 : 0), Va && a.uniform1f(Va, Fr ? c.front.distortionModel === "dji_fisheye_5" ? 2 : 1 : 0), Wa && a.uniform1f(Wa, ho ? c.back.distortionModel === "dji_fisheye_5" ? 2 : 1 : 0), qa && a.uniform4f(qa, Ei[0], Ei[1], Ei[2], Ei[3]), Ga && a.uniform4f(Ga, Ci[0], Ci[1], Ci[2], Ci[3]), Xa && a.uniform3f(Xa, Et[0], Et[1], Et[2]), $a && a.uniform3f($a, Ii[0], Ii[1], Ii[2]), Ya && a.uniform3f(Ya, zi[0], zi[1], zi[2]), Qa && a.uniform3f(Qa, Bi[0], Bi[1], Bi[2]), Ha && a.uniform3f(Ha, ji[0], ji[1], ji[2]), Ja && a.uniform3f(Ja, Ni[0], Ni[1], Ni[2]), Ka && a.uniform1f(Ka, _t), Za && a.uniform1f(Za, Math.sin(i.dualFisheyeSeamBlendDeg * Math.PI / 180)), er && a.uniform2f(er, Ge.seamX[0], Ge.seamX[1]), tr && a.uniform1f(tr, Ge.blendX), ir && a.uniform1f(ir, Ge.frontWrap ? 1 : 0), ar && a.uniform1f(ar, Ge.enabled ? 1 : 0), rr && a.uniform2f(rr, Ct[0], Ct[1]), nr && a.uniform1f(nr, be ? 1 : 0), sr && a.uniform1f(sr, Ue), k && a.uniform1f(k, $e), Lr = De;
|
|
4772
4788
|
}
|
|
4773
|
-
a.clearColor(
|
|
4789
|
+
a.clearColor(Li.r / 255, Li.g / 255, Li.b / 255, Li.a), a.clear(a.COLOR_BUFFER_BIT), a.drawArrays(a.TRIANGLES, 0, 3), dr += 1, t.dataset.insta360DrawCount = String(dr), t.dataset.insta360LastDrawReason = na, t.dataset.insta360ContextStatus = "ready", V && Fo(), ei = !1;
|
|
4774
4790
|
}
|
|
4775
|
-
o && V && (ui =
|
|
4791
|
+
o && V && (ui = zr(M, ui, jt), jt = !1, R && ((U = i.onPlaybackWork) == null || U.call(i, Math.max(0, performance.now() - M)))), hr && R && (rt = requestAnimationFrame(ha));
|
|
4776
4792
|
}
|
|
4777
|
-
function
|
|
4778
|
-
ti && (s && Zt &&
|
|
4793
|
+
function Mo() {
|
|
4794
|
+
ti && (s && Zt && fa(), vt());
|
|
4779
4795
|
}
|
|
4780
4796
|
function vt(M = "request") {
|
|
4781
|
-
ei = !0,
|
|
4797
|
+
ei = !0, na = M, rt || (rt = requestAnimationFrame(ha));
|
|
4782
4798
|
}
|
|
4783
|
-
function
|
|
4799
|
+
function _r(M) {
|
|
4784
4800
|
t.dataset.insta360ContextStatus = "lost", t.dispatchEvent(new CustomEvent("insta360previewerror", {
|
|
4785
4801
|
bubbles: !0,
|
|
4786
4802
|
detail: { reason: "webgl-context-lost" }
|
|
4787
4803
|
})), M.cancelable && M.preventDefault();
|
|
4788
4804
|
}
|
|
4789
|
-
t.addEventListener("webglcontextlost",
|
|
4805
|
+
t.addEventListener("webglcontextlost", _r);
|
|
4790
4806
|
function Ee(M) {
|
|
4791
|
-
jt = !0, pt && (M == null ? void 0 : M.type) === "seeked" && (he.surface = null, yt = null, gt = -1 / 0, Pe = 0, Ue = 0), zt && !st && (M == null ? void 0 : M.type) === "seeked" && (Bt = 0,
|
|
4807
|
+
jt = !0, pt && (M == null ? void 0 : M.type) === "seeked" && (he.surface = null, yt = null, gt = -1 / 0, Pe = 0, Ue = 0), zt && !st && (M == null ? void 0 : M.type) === "seeked" && (Bt = 0, da = e.currentTime), ii = !0, Zt && fa(), vt();
|
|
4792
4808
|
}
|
|
4793
4809
|
o && (e.addEventListener("play", Ee), e.addEventListener("pause", Ee), e.addEventListener("seeking", Ee), e.addEventListener("seeked", Ee), e.addEventListener("loadeddata", Ee));
|
|
4794
|
-
function
|
|
4795
|
-
ti = !1, rt && cancelAnimationFrame(rt), Ne && cancelAnimationFrame(Ne),
|
|
4810
|
+
function Do() {
|
|
4811
|
+
ti = !1, rt && cancelAnimationFrame(rt), Ne && cancelAnimationFrame(Ne), yo(), t.removeEventListener("webglcontextlost", _r), o && (e.removeEventListener("play", Ee), e.removeEventListener("pause", Ee), e.removeEventListener("seeking", Ee), e.removeEventListener("seeked", Ee), e.removeEventListener("loadeddata", Ee)), je && je(), Lt && Lt(), he.readback && (he.readback.surface.width = 0, he.readback.surface.height = 0);
|
|
4796
4812
|
for (const M of fi) M != null && M.canvas && (M.canvas.width = 0, M.canvas.height = 0);
|
|
4797
4813
|
fi.length = 0, he.surface = null, he.projections = null, he.readback = null, he.softwareReadback = null;
|
|
4798
|
-
for (const M of
|
|
4799
|
-
|
|
4814
|
+
for (const M of Wi) M && (M.width = 0, M.height = 0);
|
|
4815
|
+
Wi.length = 0;
|
|
4800
4816
|
for (const M of li) M != null && M.canvas && (M.canvas.width = 0, M.canvas.height = 0);
|
|
4801
|
-
li.length = 0, a.deleteTexture(ft), Jt && a.deleteTexture(Jt),
|
|
4817
|
+
li.length = 0, a.deleteTexture(ft), Jt && a.deleteTexture(Jt), Mr && a.deleteTexture(Mr), Dr && a.deleteTexture(Dr), mt && a.deleteTexture(mt), a.deleteBuffer(aa), a.deleteProgram(v);
|
|
4802
4818
|
}
|
|
4803
|
-
let
|
|
4804
|
-
function
|
|
4805
|
-
if (i.captureEquirectangular || !r || n !== "dual_fisheye" || be || zt && (!st || !nt) ||
|
|
4819
|
+
let Ur = "", Xe = [!0, !0];
|
|
4820
|
+
function Er() {
|
|
4821
|
+
if (i.captureEquirectangular || !r || n !== "dual_fisheye" || be || zt && (!st || !nt) || Oi > 0 || It.some((Ie) => Ie > 0) || !Ge.enabled) return [!0, !0];
|
|
4806
4822
|
const M = Math.max(1, t.clientWidth) / Math.max(1, t.clientHeight), R = [
|
|
4807
4823
|
kt,
|
|
4808
4824
|
Rt,
|
|
@@ -4815,9 +4831,9 @@ function Hn(t, e, i, n) {
|
|
|
4815
4831
|
Re,
|
|
4816
4832
|
ot
|
|
4817
4833
|
].join(":");
|
|
4818
|
-
if (R ===
|
|
4819
|
-
|
|
4820
|
-
const C =
|
|
4834
|
+
if (R === Ur) return Xe;
|
|
4835
|
+
Ur = R, Xe = [!0, !0];
|
|
4836
|
+
const C = wn(Wt(
|
|
4821
4837
|
Wt(
|
|
4822
4838
|
Ot(0, 1, 0, -kt * Math.PI / 180),
|
|
4823
4839
|
Ot(1, 0, 0, -Rt * Math.PI / 180)
|
|
@@ -4825,22 +4841,22 @@ function Hn(t, e, i, n) {
|
|
|
4825
4841
|
Ot(0, 0, 1, -Pt * Math.PI / 180)
|
|
4826
4842
|
)), I = Math.tan(Math.min(160, ht + 12) * Math.PI / 360), V = [
|
|
4827
4843
|
{ ...We, focal: ke, validRadius: Oe },
|
|
4828
|
-
{ ...
|
|
4844
|
+
{ ...qe, focal: Re, validRadius: Ve }
|
|
4829
4845
|
];
|
|
4830
4846
|
let U = -1;
|
|
4831
4847
|
for (let Ie = -4; Ie <= 4; Ie += 1) for (let $e = -4; $e <= 4; $e += 1) {
|
|
4832
|
-
const De =
|
|
4848
|
+
const De = Ba(C, $e / 4 * M * I, Ie / 4 * I, u ? 1 : -1), Ye = Math.hypot(De.x, De.y, De.z), we = [
|
|
4833
4849
|
De.x / Ye * (i.equirectFlipX ? -1 : 1),
|
|
4834
4850
|
De.y / Ye * (i.equirectFlipY ? -1 : 1),
|
|
4835
4851
|
De.z / Ye
|
|
4836
4852
|
];
|
|
4837
4853
|
if (Math.abs(we[1]) >= Math.sin(45 * Math.PI / 180)) return Xe;
|
|
4838
|
-
const Qe = Math.atan2(we[0], u ? we[2] : -we[2]) / (2 * Math.PI) + 0.5, [ct, xt] =
|
|
4854
|
+
const Qe = Math.atan2(we[0], u ? we[2] : -we[2]) / (2 * Math.PI) + 0.5, [ct, xt] = Ge.seamX, lt = Ge.blendX + 0.01, ze = Qe > ct + lt && Qe < xt - lt, Y = Qe < ct - lt || Qe > xt + lt;
|
|
4839
4855
|
if (!ze && !Y) return Xe;
|
|
4840
|
-
const se = (
|
|
4856
|
+
const se = (Ge.frontWrap ? Y : ze) ? 0 : 1;
|
|
4841
4857
|
if (U >= 0 && U !== se) return Xe;
|
|
4842
4858
|
U = se;
|
|
4843
|
-
const Fe = V[se], Ae = se === 1 ?
|
|
4859
|
+
const Fe = V[se], Ae = se === 1 ? Hi(we, ot) : we, He = St(
|
|
4844
4860
|
Ae,
|
|
4845
4861
|
Fe,
|
|
4846
4862
|
_t,
|
|
@@ -4850,95 +4866,95 @@ function Hn(t, e, i, n) {
|
|
|
4850
4866
|
);
|
|
4851
4867
|
if (!He || He.confidence < 0.1) return Xe;
|
|
4852
4868
|
if (nt) {
|
|
4853
|
-
const
|
|
4854
|
-
|
|
4855
|
-
|
|
4869
|
+
const Xi = V[1 - se], To = se === 0 ? Hi(we, ot) : we, $r = St(
|
|
4870
|
+
To,
|
|
4871
|
+
Xi,
|
|
4856
4872
|
_t,
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4873
|
+
Xi.projectionModel === "mei_extended",
|
|
4874
|
+
Xi.projectionModel === "dji_fisheye_lut",
|
|
4875
|
+
Xi.radialScale || 1
|
|
4860
4876
|
);
|
|
4861
|
-
if (
|
|
4877
|
+
if ($r && $r.confidence > 0) return Xe;
|
|
4862
4878
|
}
|
|
4863
4879
|
}
|
|
4864
4880
|
const oe = (U === 0 ? Ut : ai)[Me ? 1 : 0] < 0.5 ? 0 : 1;
|
|
4865
4881
|
return Xe = [oe === 0, oe === 1], Xe;
|
|
4866
4882
|
}
|
|
4867
|
-
let
|
|
4868
|
-
const
|
|
4869
|
-
let ui = 0,
|
|
4870
|
-
function
|
|
4883
|
+
let Cr = 0, Ce = { level: 0, maxFps: 0, maxRenderPixels: 0, maxTextureSize: 0 };
|
|
4884
|
+
const Wi = [], li = [];
|
|
4885
|
+
let ui = 0, Ir = 0, jt = !0;
|
|
4886
|
+
function ma(M, R) {
|
|
4871
4887
|
const C = Ce.maxFps ? 1e3 / Ce.maxFps : 0;
|
|
4872
4888
|
return !C || M + Math.min(20, C / 2) >= R;
|
|
4873
4889
|
}
|
|
4874
|
-
function
|
|
4890
|
+
function zr(M, R, C = !1) {
|
|
4875
4891
|
const I = Ce.maxFps ? 1e3 / Ce.maxFps : 0;
|
|
4876
4892
|
return I ? C || !R || M - R > I ? M + I : Math.max(R + I, M + I / 2 + Math.min(20, I / 2)) : 0;
|
|
4877
4893
|
}
|
|
4878
|
-
function
|
|
4894
|
+
function Br(M, R) {
|
|
4879
4895
|
const C = Ce.maxTextureSize > 0 ? Math.min(1, Ce.maxTextureSize / Math.max(M, R)) : 1;
|
|
4880
4896
|
return { width: Math.max(1, Math.floor(M * C)), height: Math.max(1, Math.floor(R * C)) };
|
|
4881
4897
|
}
|
|
4882
|
-
function
|
|
4898
|
+
function jr(M, R, C, I, V) {
|
|
4883
4899
|
if (I.width === R && I.height === C) return M;
|
|
4884
|
-
if (M instanceof ImageData) return
|
|
4900
|
+
if (M instanceof ImageData) return Fn(
|
|
4885
4901
|
M,
|
|
4886
4902
|
I.width,
|
|
4887
4903
|
li[V] || (li[V] = {}),
|
|
4888
4904
|
I.height
|
|
4889
4905
|
);
|
|
4890
|
-
let U =
|
|
4891
|
-
return U || (U =
|
|
4906
|
+
let U = Wi[V];
|
|
4907
|
+
return U || (U = Wi[V] = document.createElement("canvas")), (U.width !== I.width || U.height !== I.height) && (U.width = I.width, U.height = I.height), U.getContext("2d").drawImage(M, 0, 0, I.width, I.height), U;
|
|
4892
4908
|
}
|
|
4893
|
-
function
|
|
4894
|
-
!s || !M || M.level === Ce.level || (Ce = M, ui = 0, di = 0,
|
|
4909
|
+
function So(M) {
|
|
4910
|
+
!s || !M || M.level === Ce.level || (Ce = M, ui = 0, di = 0, qi = 0, jt = !0, t.dataset.insta360QualityLevel = String(M.level), t.dataset.insta360MaxFps = String(M.maxFps), vt("quality"));
|
|
4895
4911
|
}
|
|
4896
|
-
let
|
|
4912
|
+
let Nr = -1 / 0, di = 0, qi = 0, Gi = 0, Or = "";
|
|
4897
4913
|
const fi = [];
|
|
4898
|
-
function
|
|
4914
|
+
function Vr(M) {
|
|
4899
4915
|
const R = e.getContext("2d", { willReadFrequently: !0 });
|
|
4900
4916
|
M.forEach((C, I) => {
|
|
4901
|
-
const V = C instanceof ImageData ?
|
|
4917
|
+
const V = C instanceof ImageData ? Fn(C, nt ? 1024 : 512, fi[I] || (fi[I] = {})) : C, U = M.length === 2 && !Me ? e.width / 2 : e.width, W = M.length === 2 && Me ? e.height / 2 : e.height;
|
|
4902
4918
|
R.drawImage(V, Me ? 0 : I * U, Me ? I * W : 0, U, W);
|
|
4903
4919
|
});
|
|
4904
4920
|
}
|
|
4905
|
-
function
|
|
4921
|
+
function Wr(M, R, C = !1) {
|
|
4906
4922
|
if (!ti || !r) return;
|
|
4907
4923
|
const I = ci !== null && (R < ci || R - ci > 0.5);
|
|
4908
4924
|
if (I && (he.surface = null, yt = null, gt = -1 / 0, Ue = 0, Pe = 0), !M.find(Boolean)) return;
|
|
4909
|
-
const U = typeof performance < "u" ? performance.now() : Date.now(), W = M.map(Boolean).join(":"), oe = M.map((Y) => Y ?
|
|
4925
|
+
const U = typeof performance < "u" ? performance.now() : Date.now(), W = M.map(Boolean).join(":"), oe = M.map((Y) => Y ? Br(
|
|
4910
4926
|
Y.displayWidth || Y.videoWidth || Y.width,
|
|
4911
4927
|
Y.displayHeight || Y.videoHeight || Y.height
|
|
4912
4928
|
) : null), Ie = oe.some((Y, K) => {
|
|
4913
4929
|
var se, Fe;
|
|
4914
|
-
return Y && (((se =
|
|
4915
|
-
}), $e = C || I || Ie || W !==
|
|
4916
|
-
if (!$e && (U <
|
|
4930
|
+
return Y && (((se = Ai[K]) == null ? void 0 : se.width) !== Y.width || ((Fe = Ai[K]) == null ? void 0 : Fe.height) !== Y.height);
|
|
4931
|
+
}), $e = C || I || Ie || W !== Or;
|
|
4932
|
+
if (!$e && (U < qi || !ma(U, di))) return;
|
|
4917
4933
|
ci = R;
|
|
4918
|
-
const { width: De, height: Ye } = oe.find(Boolean), we =
|
|
4934
|
+
const { width: De, height: Ye } = oe.find(Boolean), we = Cr || (Cr = a.getParameter(a.MAX_TEXTURE_SIZE));
|
|
4919
4935
|
if (oe.filter(Boolean).some((Y) => Y.width > we || Y.height > we))
|
|
4920
4936
|
throw new Error("Panorama frame exceeds GPU texture limits; select a companion source");
|
|
4921
|
-
a.uniform1f(
|
|
4922
|
-
const Qe = Ie || U >=
|
|
4923
|
-
if (Qe &&
|
|
4937
|
+
a.uniform1f(ro, M.length === 2 ? 1 : 0), a.uniform1f(no, Me ? 1 : 0);
|
|
4938
|
+
const Qe = Ie || U >= Nr;
|
|
4939
|
+
if (Qe && Pr(), M.forEach((Y, K) => {
|
|
4924
4940
|
if (!Y) return;
|
|
4925
4941
|
a.activeTexture(K === 0 ? a.TEXTURE0 : a.TEXTURE4), a.bindTexture(a.TEXTURE_2D, K === 0 ? ft : Jt), a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, l ? 1 : 0);
|
|
4926
|
-
const { width: se, height: Fe } = oe[K], Ae =
|
|
4942
|
+
const { width: se, height: Fe } = oe[K], Ae = jr(
|
|
4927
4943
|
Y,
|
|
4928
4944
|
Y.displayWidth || Y.videoWidth || Y.width,
|
|
4929
4945
|
Y.displayHeight || Y.videoHeight || Y.height,
|
|
4930
4946
|
oe[K],
|
|
4931
4947
|
K
|
|
4932
|
-
), He =
|
|
4933
|
-
(He == null ? void 0 : He.width) === se && (He == null ? void 0 : He.height) === Fe ? a.texSubImage2D(a.TEXTURE_2D, 0, 0, 0, a.RGBA, a.UNSIGNED_BYTE, Ae) : (a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, a.RGBA, a.UNSIGNED_BYTE, Ae),
|
|
4948
|
+
), He = Ai[K];
|
|
4949
|
+
(He == null ? void 0 : He.width) === se && (He == null ? void 0 : He.height) === Fe ? a.texSubImage2D(a.TEXTURE_2D, 0, 0, 0, a.RGBA, a.UNSIGNED_BYTE, Ae) : (a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, a.RGBA, a.UNSIGNED_BYTE, Ae), Ai[K] = { width: se, height: Fe });
|
|
4934
4950
|
}), Qe) {
|
|
4935
4951
|
if (a.getError() !== a.NO_ERROR) throw new Error("Panorama frame upload failed");
|
|
4936
|
-
|
|
4952
|
+
Nr = U + 1e3;
|
|
4937
4953
|
}
|
|
4938
4954
|
const ct = Math.max(0, (typeof performance < "u" ? performance.now() : Date.now()) - U);
|
|
4939
|
-
Gi = Gi ? Gi * 0.8 + ct * 0.2 : ct, di =
|
|
4955
|
+
Gi = Gi ? Gi * 0.8 + ct * 0.2 : ct, di = zr(U, di, $e), qi = U + Math.min(100, Gi * 1.5), Or = W;
|
|
4940
4956
|
const xt = Me || n === "eac" || n === "cubemap";
|
|
4941
|
-
|
|
4957
|
+
ra = {
|
|
4942
4958
|
width: M.length === 2 && !xt ? De * 2 : De,
|
|
4943
4959
|
height: M.length === 2 && xt ? Ye * 2 : Ye
|
|
4944
4960
|
}, ii = !1;
|
|
@@ -4947,7 +4963,7 @@ function Hn(t, e, i, n) {
|
|
|
4947
4963
|
e.currentTime = R;
|
|
4948
4964
|
const Y = nt && ze && e.width === 2048 && e.height === 1024 && M.length === 2 && M.every((K) => K instanceof ImageData);
|
|
4949
4965
|
try {
|
|
4950
|
-
Y ? (he.softwareFrames = M, he.prepareSoftwareFallback = () =>
|
|
4966
|
+
Y ? (he.softwareFrames = M, he.prepareSoftwareFallback = () => Vr(M)) : Vr(M), Sr(), Rr();
|
|
4951
4967
|
} finally {
|
|
4952
4968
|
he.softwareFrames = null, he.prepareSoftwareFallback = null;
|
|
4953
4969
|
}
|
|
@@ -4956,18 +4972,18 @@ function Hn(t, e, i, n) {
|
|
|
4956
4972
|
}
|
|
4957
4973
|
return {
|
|
4958
4974
|
reset: () => {
|
|
4959
|
-
he.surface = null, yt = null, ci = null, gt = -1 / 0, di = 0,
|
|
4975
|
+
he.surface = null, yt = null, ci = null, gt = -1 / 0, di = 0, qi = 0, Ue = 0, Pe = 0, t.dataset.insta360VideoSeam = "pending", vt("seek");
|
|
4960
4976
|
},
|
|
4961
|
-
presentFrames:
|
|
4977
|
+
presentFrames: Wr,
|
|
4962
4978
|
captureFrames: (M, R) => {
|
|
4963
|
-
|
|
4979
|
+
Wr(M, R, !0), rt && cancelAnimationFrame(rt), ha();
|
|
4964
4980
|
},
|
|
4965
|
-
setPlaybackQuality:
|
|
4966
|
-
getRequiredTracks:
|
|
4967
|
-
start:
|
|
4981
|
+
setPlaybackQuality: So,
|
|
4982
|
+
getRequiredTracks: Er,
|
|
4983
|
+
start: Mo,
|
|
4968
4984
|
requestFrame: vt,
|
|
4969
|
-
destroy:
|
|
4970
|
-
setView:
|
|
4985
|
+
destroy: Do,
|
|
4986
|
+
setView: vo,
|
|
4971
4987
|
getView: () => ({ yawDeg: kt, pitchDeg: Rt, rollDeg: Pt, fovDeg: ht }),
|
|
4972
4988
|
// +Z MEI cameras reverse both screen axes relative to the -Z panorama camera.
|
|
4973
4989
|
dragDirectionSign: u ? -1 : 1
|
|
@@ -4981,7 +4997,7 @@ function Wt(t, e) {
|
|
|
4981
4997
|
w: t.w * e.w - t.x * e.x - t.y * e.y - t.z * e.z
|
|
4982
4998
|
};
|
|
4983
4999
|
}
|
|
4984
|
-
function
|
|
5000
|
+
function wn(t) {
|
|
4985
5001
|
const e = Math.hypot(t.x, t.y, t.z, t.w) || 1;
|
|
4986
5002
|
return {
|
|
4987
5003
|
x: t.x / e,
|
|
@@ -4994,11 +5010,11 @@ function Ot(t, e, i, n) {
|
|
|
4994
5010
|
const r = n / 2, o = Math.sin(r);
|
|
4995
5011
|
return { x: t * o, y: e * o, z: i * o, w: Math.cos(r) };
|
|
4996
5012
|
}
|
|
4997
|
-
function
|
|
5013
|
+
function Ba(t, e, i, n) {
|
|
4998
5014
|
const r = { x: e, y: i, z: n, w: 0 }, o = { x: -t.x, y: -t.y, z: -t.z, w: t.w }, s = Wt(t, r), a = Wt(s, o);
|
|
4999
5015
|
return { x: a.x, y: a.y, z: a.z };
|
|
5000
5016
|
}
|
|
5001
|
-
function
|
|
5017
|
+
function Fn(t, e = 512, i = null, n = null) {
|
|
5002
5018
|
const r = (i == null ? void 0 : i.canvas) || document.createElement("canvas"), o = Math.min(e, t.width), s = n ?? Math.max(1, Math.round(t.height * o / t.width));
|
|
5003
5019
|
(r.width !== o || r.height !== s) && (r.width = o, r.height = s, i && (i.reduced = null)), i && (i.canvas = r);
|
|
5004
5020
|
const a = r.getContext("2d");
|
|
@@ -5010,32 +5026,32 @@ function bn(t, e = 512, i = null, n = null) {
|
|
|
5010
5026
|
let f = i == null ? void 0 : i.columns;
|
|
5011
5027
|
if ((!f || f.length !== o || i.sourceWidth !== t.width) && (f = Uint32Array.from({ length: o }, (y, p) => Math.floor(p * t.width / o)), i && (i.columns = f, i.sourceWidth = t.width)), l)
|
|
5012
5028
|
for (let y = 0; y < s; y++) {
|
|
5013
|
-
const p = Math.floor(y * t.height / s) * t.width,
|
|
5014
|
-
for (let d = 0; d < o; d++) u[
|
|
5029
|
+
const p = Math.floor(y * t.height / s) * t.width, h = y * o;
|
|
5030
|
+
for (let d = 0; d < o; d++) u[h + d] = l[p + f[d]];
|
|
5015
5031
|
}
|
|
5016
5032
|
else
|
|
5017
5033
|
for (let y = 0; y < s; y++) {
|
|
5018
|
-
const p = Math.floor(y * t.height / s) * t.width,
|
|
5019
|
-
for (let d = 0; d < o; d++) for (let
|
|
5020
|
-
c.data[(
|
|
5034
|
+
const p = Math.floor(y * t.height / s) * t.width, h = y * o;
|
|
5035
|
+
for (let d = 0; d < o; d++) for (let m = 0; m < 4; m++)
|
|
5036
|
+
c.data[(h + d) * 4 + m] = t.data[(p + f[d]) * 4 + m];
|
|
5021
5037
|
}
|
|
5022
5038
|
return a.putImageData(c, 0, 0), r;
|
|
5023
5039
|
}
|
|
5024
|
-
function
|
|
5040
|
+
function Tc(t, e, i = null) {
|
|
5025
5041
|
var o;
|
|
5026
5042
|
const n = i || document.createElement("canvas");
|
|
5027
5043
|
i || (n.width = ((o = e.dualFisheyeCalibration) == null ? void 0 : o.front.projectionModel) === "dji_fisheye_lut" ? 2048 : 1024, n.height = n.width / 2);
|
|
5028
|
-
const r =
|
|
5044
|
+
const r = Jn(t, n, Vn({ ...e, externalFrames: !i }), e.projection || "equirect");
|
|
5029
5045
|
return { ...r, destroy() {
|
|
5030
5046
|
r.destroy(), i || (n.width = n.height = 0);
|
|
5031
5047
|
} };
|
|
5032
5048
|
}
|
|
5033
|
-
function
|
|
5034
|
-
return
|
|
5049
|
+
function kc(t, e, i) {
|
|
5050
|
+
return Jn(t, e, Vn({ ...i, externalFrames: !1 }), i.projection || "dual_fisheye");
|
|
5035
5051
|
}
|
|
5036
|
-
function
|
|
5037
|
-
if (!
|
|
5038
|
-
const e =
|
|
5052
|
+
function Kn(t) {
|
|
5053
|
+
if (!ea(t)) return;
|
|
5054
|
+
const e = ta(t);
|
|
5039
5055
|
if (!e) return;
|
|
5040
5056
|
const i = e[0].track.id !== e[1].track.id;
|
|
5041
5057
|
let n, r, o;
|
|
@@ -5045,7 +5061,7 @@ function Jn(t) {
|
|
|
5045
5061
|
n = a.track.width * 2, r = a.track.height, o = [{ x: 0, y: 0, width: 0.5, height: 1 }, { x: 0.5, y: 0, width: 0.5, height: 1 }];
|
|
5046
5062
|
} else if (n = e[0].track.width, r = e[0].track.height, o = e.map(({ rect: a }) => a), o.some((a) => a.y !== 0 || a.width !== 0.5 || a.height !== 1) || ![0, 0.5].every((a) => o.some((c) => c.x === a))) return;
|
|
5047
5063
|
if (n !== r * 2) return;
|
|
5048
|
-
const s = t.lenses.slice(0, 2).map((a, c) =>
|
|
5064
|
+
const s = t.lenses.slice(0, 2).map((a, c) => Pc(a, e[c], o[c], t));
|
|
5049
5065
|
return {
|
|
5050
5066
|
imageSize: [n, r],
|
|
5051
5067
|
textureOrigin: t.textureOrigin === "top-left" ? "top-left" : "bottom-left",
|
|
@@ -5054,20 +5070,20 @@ function Jn(t) {
|
|
|
5054
5070
|
pipeline: { seamLongitudesDeg: [90, 270], featherWidthPx: Math.round(r * 16 / 360) }
|
|
5055
5071
|
};
|
|
5056
5072
|
}
|
|
5057
|
-
async function
|
|
5058
|
-
const i =
|
|
5073
|
+
async function Rc(t, e) {
|
|
5074
|
+
const i = Kn(e), n = ta(e);
|
|
5059
5075
|
if (!i || !n) throw new B("calibration_missing", "Real-time stitching requires two calibrated side-by-side lenses.");
|
|
5060
5076
|
if (typeof VideoDecoder > "u" || typeof EncodedVideoChunk > "u")
|
|
5061
5077
|
throw new B("codec_unsupported", "This browser does not expose WebCodecs video decoding.");
|
|
5062
|
-
const r = [...new Map(n.map(({ track:
|
|
5063
|
-
if (r.some((
|
|
5078
|
+
const r = [...new Map(n.map(({ track: h }) => [h.id, h])).values()];
|
|
5079
|
+
if (r.some((h) => h.timescale <= 0 || !h.samples.length))
|
|
5064
5080
|
throw new B("invalid_manifest", "The calibrated panorama tracks do not contain a playable sample timeline.");
|
|
5065
|
-
const o = r.map(
|
|
5066
|
-
if ((await Promise.all(o.map((
|
|
5081
|
+
const o = r.map(Cn);
|
|
5082
|
+
if ((await Promise.all(o.map((h) => VideoDecoder.isConfigSupported(h)))).some((h) => !h.supported))
|
|
5067
5083
|
throw new B("codec_unsupported", "This browser cannot decode the calibrated panorama tracks.");
|
|
5068
5084
|
const a = document.createElement("canvas");
|
|
5069
5085
|
a.className = "panoramav-canvas";
|
|
5070
|
-
const c =
|
|
5086
|
+
const c = Tc(a, {
|
|
5071
5087
|
projection: "dual_fisheye",
|
|
5072
5088
|
dualFisheyeCalibration: i,
|
|
5073
5089
|
dualFisheyeFrontLens: i.front.center[0] < 0.5 ? "left" : "right",
|
|
@@ -5081,12 +5097,12 @@ async function Sc(t, e) {
|
|
|
5081
5097
|
});
|
|
5082
5098
|
let l, u;
|
|
5083
5099
|
try {
|
|
5084
|
-
l = new
|
|
5085
|
-
c.presentFrames(r.length === 1 ? [
|
|
5100
|
+
l = new Bn(t, r, [], o, (h, d) => {
|
|
5101
|
+
c.presentFrames(r.length === 1 ? [h] : [h, d], h.timestamp / 1e6);
|
|
5086
5102
|
}, async () => {
|
|
5087
5103
|
}, () => c.reset());
|
|
5088
|
-
} catch (
|
|
5089
|
-
throw c.destroy(),
|
|
5104
|
+
} catch (h) {
|
|
5105
|
+
throw c.destroy(), h;
|
|
5090
5106
|
}
|
|
5091
5107
|
c.start(), l.start();
|
|
5092
5108
|
const f = () => {
|
|
@@ -5096,9 +5112,9 @@ async function Sc(t, e) {
|
|
|
5096
5112
|
let y = "", p = !1;
|
|
5097
5113
|
return {
|
|
5098
5114
|
canvas: a,
|
|
5099
|
-
setView(
|
|
5100
|
-
const b = `${
|
|
5101
|
-
p || b === y || (y = b, c.setView(
|
|
5115
|
+
setView(h, d, m, g) {
|
|
5116
|
+
const b = `${h}:${d}:${m}:${g}`;
|
|
5117
|
+
p || b === y || (y = b, c.setView(h, d, m, g), c.requestFrame("view"));
|
|
5102
5118
|
},
|
|
5103
5119
|
requestRender: () => {
|
|
5104
5120
|
p || c.requestFrame("resize");
|
|
@@ -5106,7 +5122,7 @@ async function Sc(t, e) {
|
|
|
5106
5122
|
update: () => l.update(),
|
|
5107
5123
|
play: () => l.play(),
|
|
5108
5124
|
pause: () => l.pause(),
|
|
5109
|
-
seek: (
|
|
5125
|
+
seek: (h) => l.seek(h),
|
|
5110
5126
|
close() {
|
|
5111
5127
|
p || (p = !0, l.close(), a.removeEventListener("insta360previewerror", f), c.destroy(), a.width = a.height = 0);
|
|
5112
5128
|
},
|
|
@@ -5133,9 +5149,9 @@ async function Sc(t, e) {
|
|
|
5133
5149
|
setStabilization: () => "off"
|
|
5134
5150
|
};
|
|
5135
5151
|
}
|
|
5136
|
-
function
|
|
5137
|
-
const r = t.width ?? e.track.width * e.rect.width, o = t.height ?? e.track.height * e.rect.height, s = t.extrinsicQuaternion, a = n.projection.kind === "mei-extended", c = a ? s : [s[0], -s[1], -s[2], -s[3]], l = (
|
|
5138
|
-
const d =
|
|
5152
|
+
function Pc(t, e, i, n) {
|
|
5153
|
+
const r = t.width ?? e.track.width * e.rect.width, o = t.height ?? e.track.height * e.rect.height, s = t.extrinsicQuaternion, a = n.projection.kind === "mei-extended", c = a ? s : [s[0], -s[1], -s[2], -s[3]], l = (h) => {
|
|
5154
|
+
const d = Ac(c, h);
|
|
5139
5155
|
return a ? d : [d[0], -d[2], d[1]];
|
|
5140
5156
|
}, u = l([1, 0, 0]), f = l([0, a ? 1 : -1, 0]), y = [t.fx / r * i.width, (t.fy ?? t.fx) / o * i.height], p = Math.min(r, o) * 0.475;
|
|
5141
5157
|
return {
|
|
@@ -5150,7 +5166,7 @@ function Tc(t, e, i, n) {
|
|
|
5150
5166
|
thinPrism: bi(t.thinPrism, 4),
|
|
5151
5167
|
sensorTilt: bi(t.sensorTilt, 2),
|
|
5152
5168
|
xi: t.xi ?? 0,
|
|
5153
|
-
radialScale: a ? 1 :
|
|
5169
|
+
radialScale: a ? 1 : Lc(t),
|
|
5154
5170
|
distortionModel: t.distortionModel,
|
|
5155
5171
|
distortionCoeffs: t.distortionCoeffs,
|
|
5156
5172
|
translationM: t.translation,
|
|
@@ -5163,11 +5179,11 @@ function Tc(t, e, i, n) {
|
|
|
5163
5179
|
function bi(t, e) {
|
|
5164
5180
|
return Array.from({ length: e }, (i, n) => Number((t == null ? void 0 : t[n]) ?? 0));
|
|
5165
5181
|
}
|
|
5166
|
-
function
|
|
5182
|
+
function Ac(t, [e, i, n]) {
|
|
5167
5183
|
const r = Math.hypot(...t), [o, s, a, c] = t.map((f) => f / r), l = s * e + a * i + c * n, u = o * o - s * s - a * a - c * c;
|
|
5168
5184
|
return [2 * l * s + u * e + 2 * o * (a * n - c * i), 2 * l * a + u * i + 2 * o * (c * e - s * n), 2 * l * c + u * n + 2 * o * (s * i - a * e)];
|
|
5169
5185
|
}
|
|
5170
|
-
function
|
|
5186
|
+
function Lc(t) {
|
|
5171
5187
|
const e = t.radialLut1, i = t.radialLut2;
|
|
5172
5188
|
if (!e || !i || e.length < 14 || i.length < 14 || !t.fx) return 1;
|
|
5173
5189
|
let n = 0;
|
|
@@ -5176,7 +5192,7 @@ function Rc(t) {
|
|
|
5176
5192
|
const r = 85 * Math.PI / 180, [o, s, a, c] = bi(t.radial ?? t.distortion, 4), l = r + o * r ** 3 + s * r ** 5 + a * r ** 7 + c * r ** 9, u = 1 + 3 * o * r ** 2 + 5 * s * r ** 4 + 7 * a * r ** 6 + 9 * c * r ** 8, f = t.fx * (l + u * (Math.PI / 2 - r));
|
|
5177
5193
|
return f > 0 ? n / f : 1;
|
|
5178
5194
|
}
|
|
5179
|
-
function
|
|
5195
|
+
function Zn(t) {
|
|
5180
5196
|
var r;
|
|
5181
5197
|
const { width: e, height: i } = t;
|
|
5182
5198
|
if (!e || !i || t.lenses.length !== 2 || !["mei-extended", "equidistant"].includes(t.projection.kind)) return;
|
|
@@ -5185,12 +5201,12 @@ function Kn(t) {
|
|
|
5185
5201
|
const a = s.sourceRect, c = s.extrinsicQuaternion, l = s.width, u = s.height;
|
|
5186
5202
|
if (!a || !l || !u || !c || c.length !== 4 || !c.every(Number.isFinite) || Math.hypot(...c) < 1e-6 || ![s.fx, s.fy, s.cx, s.cy].every((x) => typeof x == "number" && Number.isFinite(x)) || !Object.values(a).every(Number.isFinite) || s.fx <= 0 || s.fy <= 0 || a.width <= 0 || a.height <= 0 || a.x < 0 || a.y < 0 || a.x + a.width > 1 || a.y + a.height > 1) return;
|
|
5187
5203
|
const f = ((r = s.projection) == null ? void 0 : r.kind) === "mei-extended", y = c.map((x) => x / Math.hypot(...c)), p = f ? [y[0], -y[1], -y[2], -y[3]] : y;
|
|
5188
|
-
let
|
|
5204
|
+
let h = xi(p, [0, 0, f ? 1 : -1]), d = xi(p, [0, 1, 0]);
|
|
5189
5205
|
if (!f && o === 1) {
|
|
5190
5206
|
const x = xi(p, [0, 0, 1]);
|
|
5191
|
-
x[2] >
|
|
5207
|
+
x[2] > h[2] && (h = x, d = xi(p, [0, -1, 0]));
|
|
5192
5208
|
}
|
|
5193
|
-
const
|
|
5209
|
+
const m = (x) => f ? x : [x[0], -x[1], x[2]], g = Math.min(l, u) * 0.475, b = [s.fx / l * a.width, s.fy / u * a.height];
|
|
5194
5210
|
n.push({
|
|
5195
5211
|
center: [a.x + s.cx / l * a.width, a.y + s.cy / u * a.height],
|
|
5196
5212
|
focal: b,
|
|
@@ -5207,9 +5223,9 @@ function Kn(t) {
|
|
|
5207
5223
|
translationM: s.translation,
|
|
5208
5224
|
distortionModel: s.distortionModel,
|
|
5209
5225
|
distortionCoeffs: s.distortionCoeffs,
|
|
5210
|
-
axis: h
|
|
5211
|
-
right:
|
|
5212
|
-
up:
|
|
5226
|
+
axis: m(h),
|
|
5227
|
+
right: m(xi(p, [1, 0, 0])),
|
|
5228
|
+
up: m(d),
|
|
5213
5229
|
projectionModel: f ? "mei_extended" : "equidistant"
|
|
5214
5230
|
});
|
|
5215
5231
|
}
|
|
@@ -5221,14 +5237,14 @@ function Kn(t) {
|
|
|
5221
5237
|
pipeline: { seamLongitudesDeg: [90, 270], featherWidthPx: Math.round(Math.min(e, i) * 16 / 360) }
|
|
5222
5238
|
};
|
|
5223
5239
|
}
|
|
5224
|
-
function
|
|
5225
|
-
const i =
|
|
5240
|
+
function _c(t, e) {
|
|
5241
|
+
const i = Zn(e);
|
|
5226
5242
|
if (!i) throw new B("calibration_missing", "This DNG does not contain supported dual-fisheye calibration.");
|
|
5227
5243
|
if (Math.abs(t.naturalWidth / t.naturalHeight - i.imageSize[0] / i.imageSize[1]) > 5e-3)
|
|
5228
5244
|
throw new B("invalid_manifest", "The developed DNG preview does not preserve the calibrated sensor geometry.");
|
|
5229
5245
|
const n = document.createElement("canvas");
|
|
5230
5246
|
n.className = "panoramav-canvas";
|
|
5231
|
-
const r =
|
|
5247
|
+
const r = kc(n, t, {
|
|
5232
5248
|
projection: "dual_fisheye",
|
|
5233
5249
|
dualFisheyeCalibration: i,
|
|
5234
5250
|
dualFisheyeFovDeg: 196,
|
|
@@ -5282,7 +5298,7 @@ function xi([t, e, i, n], [r, o, s]) {
|
|
|
5282
5298
|
const a = e * r + i * o + n * s, c = t * t - e * e - i * i - n * n;
|
|
5283
5299
|
return [2 * a * e + c * r + 2 * t * (i * s - n * o), 2 * a * i + c * o + 2 * t * (n * r - e * s), 2 * a * n + c * s + 2 * t * (e * o - i * r)];
|
|
5284
5300
|
}
|
|
5285
|
-
const
|
|
5301
|
+
const Uc = "Panorama is not close to a 2:1 equirectangular projection; raw dual-fisheye media requires vendor stitching, while stereoscopic media needs a compatible projection mode.", Ec = /* @__PURE__ */ new Set(["insp", "insv", "osv"]), Mn = /* @__PURE__ */ new Set(["insv", "osv"]), Dn = [
|
|
5286
5302
|
{
|
|
5287
5303
|
extensions: ["pano", "panorama", "360", "insp"],
|
|
5288
5304
|
family: "panorama",
|
|
@@ -5298,7 +5314,7 @@ const Ac = "Panorama is not close to a 2:1 equirectangular projection; raw dual-
|
|
|
5298
5314
|
contentTypes: ["video/panorama", "video/x-panorama", "video/x-insta360", "video/x-osmo360", "application/vnd.filens.panorama+video"]
|
|
5299
5315
|
}
|
|
5300
5316
|
];
|
|
5301
|
-
class
|
|
5317
|
+
class eo {
|
|
5302
5318
|
constructor(e, i = {}, n) {
|
|
5303
5319
|
A(this, "listeners", {
|
|
5304
5320
|
loading: /* @__PURE__ */ new Set(),
|
|
@@ -5365,7 +5381,7 @@ class Zn {
|
|
|
5365
5381
|
}
|
|
5366
5382
|
async load(e, i) {
|
|
5367
5383
|
var s, a, c, l, u, f, y;
|
|
5368
|
-
const n = this.beginLoad(i), r = n.signal, o = this.processor ?
|
|
5384
|
+
const n = this.beginLoad(i), r = n.signal, o = this.processor ? as(this.processor, r) : void 0;
|
|
5369
5385
|
this.state = {
|
|
5370
5386
|
...this.state,
|
|
5371
5387
|
loading: !0,
|
|
@@ -5391,60 +5407,60 @@ class Zn {
|
|
|
5391
5407
|
}, this.emit("loading", this.state), this.emit("statechange", this.state);
|
|
5392
5408
|
try {
|
|
5393
5409
|
(s = i.signal) != null && s.aborted && n.abort(), H(r), this.osmoFallbackReason = "";
|
|
5394
|
-
const p = new
|
|
5410
|
+
const p = new Uo(), h = new Eo(this.scaleToFov(this.state.scale), 1, 1, 1100), d = ((a = i.route) == null ? void 0 : a.family) === "panorama-video", m = Si(i.descriptor.extension ?? ((c = i.route) == null ? void 0 : c.sourceFormat)), g = Vc(m, i.descriptor.contentType);
|
|
5395
5411
|
this.state.family = d ? "panorama-video" : "panorama", this.state.capabilities = {
|
|
5396
5412
|
...this.state.capabilities,
|
|
5397
5413
|
playback: d,
|
|
5398
5414
|
timeline: d,
|
|
5399
5415
|
volume: d
|
|
5400
5416
|
};
|
|
5401
|
-
const b =
|
|
5417
|
+
const b = Mn.has(m) && o && await this.tryCalibratedVendor(e, m, i.descriptor.name, r, p, o);
|
|
5402
5418
|
if (H(r), b && ((l = this.calibratedRenderer) != null && l.canvas)) {
|
|
5403
5419
|
this.finishRealtimeScene(this.calibratedRenderer.canvas);
|
|
5404
5420
|
return;
|
|
5405
5421
|
}
|
|
5406
|
-
if (
|
|
5407
|
-
const x = new
|
|
5422
|
+
if (m === "insv" && this.osmoFallbackReason) throw new Error(`INSV ${this.osmoFallbackReason}`);
|
|
5423
|
+
const x = new Co({
|
|
5408
5424
|
antialias: !0,
|
|
5409
5425
|
alpha: !1,
|
|
5410
5426
|
preserveDrawingBuffer: !0
|
|
5411
5427
|
});
|
|
5412
5428
|
if (this.renderer = x, x.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), x.setClearColor(1120295, 1), x.domElement.className = "panoramav-canvas", this.stage.replaceChildren(x.domElement), b) {
|
|
5413
|
-
this.finishScene(x, p,
|
|
5429
|
+
this.finishScene(x, p, h);
|
|
5414
5430
|
return;
|
|
5415
5431
|
}
|
|
5416
|
-
const v =
|
|
5417
|
-
if (H(r),
|
|
5432
|
+
const v = m === "osv" ? await this.resolveOsmoProxy(i.descriptor.name, r) : await le(Wc(e, m, r), r);
|
|
5433
|
+
if (H(r), m === "insp" && o) {
|
|
5418
5434
|
const T = await o.open(v, { format: "insp", signal: r });
|
|
5419
5435
|
if (H(r), T.projection.kind === "mei-extended") {
|
|
5420
|
-
const L = await le(new
|
|
5436
|
+
const L = await le(new Yr().loadAsync(this.sourceToUrl(v, g)), r, (k) => k.dispose());
|
|
5421
5437
|
H(r), this.texture = L, L.anisotropy = x.capabilities.getMaxAnisotropy();
|
|
5422
|
-
const _ = await le(
|
|
5423
|
-
H(r), _.mesh && p.add(_.mesh), this.texture = L, this.calibratedRenderer = _, this.state.vendor = T.vendor, this.state.cameraModel = T.cameraModel, this.state.calibrationSource = T.calibrationSource, this.state.projection = T.projection.kind, this.state.decodeMode = "browser-media", this.state.stitchMode = "calibrated-blend", this.state.naturalWidth = T.width, this.state.naturalHeight = T.height, this.state.warnings = T.confidence === "experimental" ? ["Experimental calibrated INSP preview uses the image's embedded lens calibration, exposure matching, and a content-aware feathered seam."] : T.warnings, this.state.warnings.length && this.emit("warnings", this.state.warnings), H(r), this.finishScene(x, p,
|
|
5438
|
+
const _ = await le(hs(o, T, L), r, (k) => k.close());
|
|
5439
|
+
H(r), _.mesh && p.add(_.mesh), this.texture = L, this.calibratedRenderer = _, this.state.vendor = T.vendor, this.state.cameraModel = T.cameraModel, this.state.calibrationSource = T.calibrationSource, this.state.projection = T.projection.kind, this.state.decodeMode = "browser-media", this.state.stitchMode = "calibrated-blend", this.state.naturalWidth = T.width, this.state.naturalHeight = T.height, this.state.warnings = T.confidence === "experimental" ? ["Experimental calibrated INSP preview uses the image's embedded lens calibration, exposure matching, and a content-aware feathered seam."] : T.warnings, this.state.warnings.length && this.emit("warnings", this.state.warnings), H(r), this.finishScene(x, p, h);
|
|
5424
5440
|
return;
|
|
5425
5441
|
}
|
|
5426
5442
|
if (o.close(), T.projection.kind === "unknown")
|
|
5427
5443
|
throw new Error(T.warnings[0] || "INSP contains an unsupported raw dual-fisheye image.");
|
|
5428
5444
|
}
|
|
5429
|
-
const w = d ? await le(this.createVideoTexture(v, g, r), r, (T) => T.dispose()) : await le(new
|
|
5430
|
-
H(r), this.texture = w, w.colorSpace =
|
|
5431
|
-
const S = new
|
|
5445
|
+
const w = d ? await le(this.createVideoTexture(v, g, r), r, (T) => T.dispose()) : await le(new Yr().loadAsync(this.sourceToUrl(v, g)), r, (T) => T.dispose());
|
|
5446
|
+
H(r), this.texture = w, w.colorSpace = Ji, w.anisotropy = x.capabilities.getMaxAnisotropy(), w.minFilter = Ft, w.generateMipmaps = !1;
|
|
5447
|
+
const S = new Ki(500, 64, 40);
|
|
5432
5448
|
S.scale(-1, 1, 1);
|
|
5433
|
-
const D = new
|
|
5449
|
+
const D = new Io({
|
|
5434
5450
|
map: w
|
|
5435
5451
|
});
|
|
5436
|
-
p.add(new
|
|
5437
|
-
const F =
|
|
5452
|
+
p.add(new Zi(S, D)), this.renderer = x, this.scene = p, this.camera = h, this.texture = w, this.geometry = S, this.material = D, this.state.proxyPreview = this.state.proxyPreview || m === "osv", this.state.decodeMode = this.state.proxyPreview ? "proxy" : "browser-media", this.state.stitchMode = this.state.proxyPreview ? "proxy" : "equirectangular", this.state.naturalWidth = ((u = this.video) == null ? void 0 : u.videoWidth) || zc(w), this.state.naturalHeight = ((f = this.video) == null ? void 0 : f.videoHeight) || Bc(w);
|
|
5453
|
+
const F = jc(this.state.naturalWidth, this.state.naturalHeight);
|
|
5438
5454
|
if (F) {
|
|
5439
|
-
if (
|
|
5440
|
-
throw new Error(`${
|
|
5455
|
+
if (Mn.has(m))
|
|
5456
|
+
throw new Error(`${m.toUpperCase()} contains an unstitched or unsupported projection. Export a stitched 2:1 video with the camera vendor app before spherical preview.`);
|
|
5441
5457
|
this.state.warnings = [F], this.notice.textContent = F, this.root.append(this.notice), this.emit("warnings", this.state.warnings);
|
|
5442
5458
|
}
|
|
5443
|
-
H(r), this.finishScene(x, p,
|
|
5459
|
+
H(r), this.finishScene(x, p, h);
|
|
5444
5460
|
} catch (p) {
|
|
5445
5461
|
if (r.aborted) throw new DOMException("Panorama preview was aborted.", "AbortError");
|
|
5446
|
-
const
|
|
5447
|
-
throw this.disposeScene(), this.state.loading = !1, this.state.error =
|
|
5462
|
+
const h = Nc(p, i.descriptor.extension ?? ((y = i.route) == null ? void 0 : y.sourceFormat));
|
|
5463
|
+
throw this.disposeScene(), this.state.loading = !1, this.state.error = h.message, this.emit("error", h), this.emit("statechange", this.state), h;
|
|
5448
5464
|
}
|
|
5449
5465
|
}
|
|
5450
5466
|
/** Display a WASM-developed RAW raster with the original sensor calibration. */
|
|
@@ -5493,7 +5509,7 @@ class Zn {
|
|
|
5493
5509
|
return;
|
|
5494
5510
|
}
|
|
5495
5511
|
o.addEventListener("abort", f, { once: !0 }), a.src = this.sourceToUrl(e, "image/jpeg");
|
|
5496
|
-
}), H(o), this.calibratedRenderer =
|
|
5512
|
+
}), H(o), this.calibratedRenderer = _c(a, i), this.state.stitchMode = this.calibratedRenderer.dynamicSeam ? "static-seam" : "calibrated-blend", this.state.warnings.length && this.emit("warnings", this.state.warnings), H(o), this.finishRealtimeScene(this.calibratedRenderer.canvas);
|
|
5497
5513
|
} catch (a) {
|
|
5498
5514
|
throw o.aborted ? new DOMException("Panorama preview was aborted.", "AbortError") : (this.disposeScene(), this.state.loading = !1, this.state.error = a instanceof Error ? a.message : String(a), this.emit("statechange", this.state), a);
|
|
5499
5515
|
}
|
|
@@ -5588,7 +5604,7 @@ class Zn {
|
|
|
5588
5604
|
var n, r, o, s, a;
|
|
5589
5605
|
if (!((n = this.calibratedRenderer) != null && n.canvas) && (!this.renderer || !this.scene || !this.camera))
|
|
5590
5606
|
return;
|
|
5591
|
-
const e =
|
|
5607
|
+
const e = Sn(90 - this.lat), i = Sn(this.lon);
|
|
5592
5608
|
if ((r = this.camera) == null || r.lookAt(
|
|
5593
5609
|
500 * Math.sin(e) * Math.cos(i),
|
|
5594
5610
|
500 * Math.cos(e),
|
|
@@ -5604,18 +5620,18 @@ class Zn {
|
|
|
5604
5620
|
let a, c;
|
|
5605
5621
|
try {
|
|
5606
5622
|
const y = i === "insv" ? await le(this.resolveInstaCompanion(n), r) : void 0;
|
|
5607
|
-
H(r), c =
|
|
5623
|
+
H(r), c = Cc(e, y, n);
|
|
5608
5624
|
const p = i === "insv" ? await le(this.resolveInstaSidecar(c.primaryName), r) : void 0;
|
|
5609
5625
|
H(r), a = await s.open(c.source, { format: i, sidecar: p, companion: c.companion, signal: r }), H(r);
|
|
5610
|
-
const
|
|
5611
|
-
if (a.projection.kind === "equirectangular" ||
|
|
5612
|
-
return this.state.vendor = a.vendor, this.state.cameraModel = a.cameraModel, this.state.calibrationSource = a.calibrationSource, this.state.projection =
|
|
5613
|
-
const d = await le(
|
|
5626
|
+
const h = a.projection.kind === "unknown" && a.tracks.length === 1 && to(a.tracks[0].width, a.tracks[0].height);
|
|
5627
|
+
if (a.projection.kind === "equirectangular" || h)
|
|
5628
|
+
return this.state.vendor = a.vendor, this.state.cameraModel = a.cameraModel, this.state.calibrationSource = a.calibrationSource, this.state.projection = h ? "equirectangular" : a.projection.kind, this.state.proxyPreview = !!a.proxyPreview || h, this.state.warnings = h ? [...a.warnings, "INSV calibration metadata was unavailable; using its browser-decodable 2:1 stitched track as a proxy."] : a.warnings, this.state.warnings.length && this.emit("warnings", this.state.warnings), s.close(), !1;
|
|
5629
|
+
const d = await le(Kn(a) && !((l = a.imu) != null && l.imuToCameraConfirmed) ? Rc(s, a) : ps(s, a), r, (m) => m.close());
|
|
5614
5630
|
return H(r), d.mesh && o.add(d.mesh), this.calibratedRenderer = d, this.state.vendor = a.vendor, this.state.cameraModel = a.cameraModel, this.state.calibrationSource = a.calibrationSource, this.state.projection = a.projection.kind, this.state.decodeMode = "webcodecs", this.state.stitchMode = "calibrated-blend", this.state.proxyPreview = !1, this.state.stabilizationAvailable = d.stabilizationAvailable, this.state.stabilizationMode = d.stabilizationMode, this.state.naturalWidth = 2048, this.state.naturalHeight = 1024, this.state.duration = d.duration, this.state.currentTime = d.currentTime, this.state.paused = d.paused, this.state.muted = !0, this.createCalibratedControls(d), this.state.warnings = a.confidence === "experimental" ? [`Experimental calibrated ${i.toUpperCase()} preview uses source-specific lens calibration. Dynamic seams and symmetric overlap exposure matching activate after paired frames; IMU stabilization ${d.stabilizationAvailable ? "is available" : "remains disabled until the IMU-to-camera rotation is confirmed"}.`] : a.warnings, this.state.warnings.length && this.emit("warnings", this.state.warnings), !0;
|
|
5615
5631
|
} catch (y) {
|
|
5616
5632
|
if (H(r), s.close(), i === "insv" && a && c && y instanceof B && y.code === "codec_unsupported")
|
|
5617
5633
|
try {
|
|
5618
|
-
const p = await le(
|
|
5634
|
+
const p = await le(ys(a, c.source, c.companion), r, (h) => h.close());
|
|
5619
5635
|
return H(r), p.mesh && o.add(p.mesh), this.calibratedRenderer = p, this.state.vendor = a.vendor, this.state.cameraModel = a.cameraModel, this.state.calibrationSource = a.calibrationSource, this.state.projection = a.projection.kind, this.state.decodeMode = "browser-media", this.state.stitchMode = "calibrated-blend", this.state.proxyPreview = !1, this.state.stabilizationAvailable = !1, this.state.stabilizationMode = "off", this.state.naturalWidth = (u = a.tracks[0]) == null ? void 0 : u.width, this.state.naturalHeight = (f = a.tracks[0]) == null ? void 0 : f.height, this.state.duration = p.duration, this.state.currentTime = p.currentTime, this.state.paused = p.paused, this.state.muted = !0, this.createCalibratedControls(p), this.state.warnings = [
|
|
5620
5636
|
"WebCodecs is unavailable; using browser media decoding. Dynamic seams and IMU stabilization are disabled.",
|
|
5621
5637
|
...a.warnings
|
|
@@ -5623,7 +5639,7 @@ class Zn {
|
|
|
5623
5639
|
} catch (p) {
|
|
5624
5640
|
H(r), y = p;
|
|
5625
5641
|
}
|
|
5626
|
-
return this.osmoFallbackReason = i === "insv" ?
|
|
5642
|
+
return this.osmoFallbackReason = i === "insv" ? Oc(y) : y instanceof Error ? y.message : String(y), this.state.warnings = [i === "osv" ? `${this.osmoFallbackReason} Falling back to the camera-generated LRF proxy.` : this.osmoFallbackReason], !1;
|
|
5627
5643
|
}
|
|
5628
5644
|
}
|
|
5629
5645
|
async resolveInstaSidecar(e) {
|
|
@@ -5635,7 +5651,7 @@ class Zn {
|
|
|
5635
5651
|
name: i.split(/[\\/]/).pop(),
|
|
5636
5652
|
relation: "sidecar"
|
|
5637
5653
|
});
|
|
5638
|
-
return
|
|
5654
|
+
return xa(n);
|
|
5639
5655
|
}
|
|
5640
5656
|
createCalibratedControls(e) {
|
|
5641
5657
|
const i = (this.interactionController ?? (this.interactionController = new AbortController())).signal, n = document.createElement("div");
|
|
@@ -5653,7 +5669,7 @@ class Zn {
|
|
|
5653
5669
|
const i = this.calibratedRenderer;
|
|
5654
5670
|
if (!i) return;
|
|
5655
5671
|
const n = i.currentTime;
|
|
5656
|
-
this.state.duration = i.duration, this.state.currentTime = n, this.state.paused = i.paused, this.calibratedPlayButton && (this.calibratedPlayButton.textContent = i.paused ? "Play" : "Pause", this.calibratedPlayButton.setAttribute("aria-label", `${i.paused ? "Play" : "Pause"} panorama video`)), this.calibratedTimeline && (this.calibratedTimeline.max = String(i.duration || 0), this.calibratedTimeline.value = String(n)), this.calibratedTime && (this.calibratedTime.value = `${
|
|
5672
|
+
this.state.duration = i.duration, this.state.currentTime = n, this.state.paused = i.paused, this.calibratedPlayButton && (this.calibratedPlayButton.textContent = i.paused ? "Play" : "Pause", this.calibratedPlayButton.setAttribute("aria-label", `${i.paused ? "Play" : "Pause"} panorama video`)), this.calibratedTimeline && (this.calibratedTimeline.max = String(i.duration || 0), this.calibratedTimeline.value = String(n)), this.calibratedTime && (this.calibratedTime.value = `${Tn(n)} / ${Tn(i.duration)}`);
|
|
5657
5673
|
const r = performance.now();
|
|
5658
5674
|
(e || r - this.lastPlaybackStateEmit >= 250) && (this.lastPlaybackStateEmit = r, this.emit("statechange", this.state));
|
|
5659
5675
|
}
|
|
@@ -5668,7 +5684,7 @@ class Zn {
|
|
|
5668
5684
|
name: i.split(/[\\/]/).pop(),
|
|
5669
5685
|
relation: "companion"
|
|
5670
5686
|
});
|
|
5671
|
-
return
|
|
5687
|
+
return xa(n);
|
|
5672
5688
|
}
|
|
5673
5689
|
finishScene(e, i, n) {
|
|
5674
5690
|
this.renderer = e, this.scene = i, this.camera = n, this.state.loading = !1, this.state.error = null, this.bindInteractions(e.domElement), this.observeResize(), this.resize(), this.startAnimation(), this.emit("rendered", this.state), this.emit("statechange", this.state);
|
|
@@ -5682,7 +5698,7 @@ class Zn {
|
|
|
5682
5698
|
sourceToUrl(e, i) {
|
|
5683
5699
|
if (this.revokeCreatedUrl(), typeof e == "string")
|
|
5684
5700
|
return e;
|
|
5685
|
-
const n = e instanceof Blob && (!i || e.type === i) ? e : new Blob([e instanceof Blob ? e :
|
|
5701
|
+
const n = e instanceof Blob && (!i || e.type === i) ? e : new Blob([e instanceof Blob ? e : Ic(e)], i ? { type: i } : void 0);
|
|
5686
5702
|
return this.createdUrl = URL.createObjectURL(n), this.createdUrl;
|
|
5687
5703
|
}
|
|
5688
5704
|
async createVideoTexture(e, i, n) {
|
|
@@ -5708,7 +5724,7 @@ class Zn {
|
|
|
5708
5724
|
};
|
|
5709
5725
|
for (const a of ["durationchange", "timeupdate", "play", "pause", "volumechange"])
|
|
5710
5726
|
r.addEventListener(a, s, { signal: o });
|
|
5711
|
-
return this.video = r, this.root.append(r), s(), new
|
|
5727
|
+
return this.video = r, this.root.append(r), s(), new Rn(r);
|
|
5712
5728
|
}
|
|
5713
5729
|
async resolveOsmoProxy(e, i) {
|
|
5714
5730
|
const n = String(e ?? "").replace(/\.osv$/i, ".LRF");
|
|
@@ -5722,7 +5738,7 @@ class Zn {
|
|
|
5722
5738
|
relation: "proxy"
|
|
5723
5739
|
})), o = i ? await le(r, i) : await r;
|
|
5724
5740
|
H(i);
|
|
5725
|
-
const s =
|
|
5741
|
+
const s = xa(o);
|
|
5726
5742
|
if (!s)
|
|
5727
5743
|
throw new Error(`OSV spherical preview requires the matching ${n} proxy file. Upload both files together.`);
|
|
5728
5744
|
return this.state.warnings = [
|
|
@@ -5730,8 +5746,8 @@ class Zn {
|
|
|
5730
5746
|
], this.emit("warnings", this.state.warnings), s;
|
|
5731
5747
|
}
|
|
5732
5748
|
disposeScene() {
|
|
5733
|
-
var e, i, n, r, o, s, a, c, l, u, f, y, p,
|
|
5734
|
-
(e = this.interactionController) == null || e.abort(), this.interactionController = void 0, this.pointerDown = !1, this.animationFrame && (cancelAnimationFrame(this.animationFrame), this.animationFrame = 0), (i = this.resizeObserver) == null || i.disconnect(), this.resizeObserver = null, window.removeEventListener("resize", this.resize), (n = this.texture) == null || n.dispose(), (r = this.video) == null || r.pause(), (o = this.video) == null || o.removeAttribute("src"), (s = this.video) == null || s.load(), (a = this.video) == null || a.remove(), (c = this.geometry) == null || c.dispose(), (l = this.material) == null || l.dispose(), (u = this.renderer) == null || u.dispose(), (y = (f = this.renderer) == null ? void 0 : f.forceContextLoss) == null || y.call(f), (p = this.calibratedRenderer) == null || p.close(), (
|
|
5749
|
+
var e, i, n, r, o, s, a, c, l, u, f, y, p, h;
|
|
5750
|
+
(e = this.interactionController) == null || e.abort(), this.interactionController = void 0, this.pointerDown = !1, this.animationFrame && (cancelAnimationFrame(this.animationFrame), this.animationFrame = 0), (i = this.resizeObserver) == null || i.disconnect(), this.resizeObserver = null, window.removeEventListener("resize", this.resize), (n = this.texture) == null || n.dispose(), (r = this.video) == null || r.pause(), (o = this.video) == null || o.removeAttribute("src"), (s = this.video) == null || s.load(), (a = this.video) == null || a.remove(), (c = this.geometry) == null || c.dispose(), (l = this.material) == null || l.dispose(), (u = this.renderer) == null || u.dispose(), (y = (f = this.renderer) == null ? void 0 : f.forceContextLoss) == null || y.call(f), (p = this.calibratedRenderer) == null || p.close(), (h = this.processor) == null || h.close(), this.texture = null, this.video = null, this.geometry = null, this.material = null, this.renderer = null, this.calibratedRenderer = null, this.calibratedPlayButton = null, this.calibratedTimeline = null, this.calibratedTime = null, this.lastPlaybackStateEmit = 0, this.hint.style.bottom = "", this.osmoFallbackReason = "", this.scene = null, this.camera = null, this.revokeCreatedUrl(), this.stage.replaceChildren(), this.root.querySelectorAll(".panoramav-calibrated-controls, .panoramav-notice").forEach((d) => d.remove());
|
|
5735
5751
|
}
|
|
5736
5752
|
revokeCreatedUrl() {
|
|
5737
5753
|
this.createdUrl && (URL.revokeObjectURL(this.createdUrl), this.createdUrl = null);
|
|
@@ -5741,22 +5757,22 @@ class Zn {
|
|
|
5741
5757
|
n(i);
|
|
5742
5758
|
}
|
|
5743
5759
|
}
|
|
5744
|
-
function
|
|
5760
|
+
function Hc(t = {}) {
|
|
5745
5761
|
return {
|
|
5746
5762
|
id: "panorama",
|
|
5747
5763
|
family: "panorama",
|
|
5748
|
-
supports: (e) => ["pano", "panorama", "360", "insp", "360v", "vr360", "insv", "osv"].includes(
|
|
5749
|
-
createSession: (e, i) => new
|
|
5764
|
+
supports: (e) => ["pano", "panorama", "360", "insp", "360v", "vr360", "insv", "osv"].includes(Si(e)),
|
|
5765
|
+
createSession: (e, i) => new eo(e, i, t.processor)
|
|
5750
5766
|
};
|
|
5751
5767
|
}
|
|
5752
|
-
function
|
|
5753
|
-
const e = new Set(
|
|
5754
|
-
return [...
|
|
5768
|
+
function Jc(t = Po()) {
|
|
5769
|
+
const e = new Set(Dn.flatMap((i) => i.extensions));
|
|
5770
|
+
return [...Dn, ...t.filter((i) => !i.extensions.some((n) => e.has(n)))];
|
|
5755
5771
|
}
|
|
5756
|
-
function
|
|
5772
|
+
function Cc(t, e, i) {
|
|
5757
5773
|
return e && i && /_10_/i.test(i) ? { source: e, companion: t, primaryName: i.replace(/_10_/i, "_00_") } : { source: t, companion: e, primaryName: i };
|
|
5758
5774
|
}
|
|
5759
|
-
function
|
|
5775
|
+
function Ic(t) {
|
|
5760
5776
|
if (ArrayBuffer.isView(t)) {
|
|
5761
5777
|
const e = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
5762
5778
|
if (e.buffer instanceof ArrayBuffer) return e;
|
|
@@ -5765,38 +5781,38 @@ function Uc(t) {
|
|
|
5765
5781
|
}
|
|
5766
5782
|
return t;
|
|
5767
5783
|
}
|
|
5768
|
-
function
|
|
5784
|
+
function zc(t) {
|
|
5769
5785
|
const e = t.image;
|
|
5770
5786
|
return (e == null ? void 0 : e.naturalWidth) ?? (e == null ? void 0 : e.width);
|
|
5771
5787
|
}
|
|
5772
|
-
function
|
|
5788
|
+
function Bc(t) {
|
|
5773
5789
|
const e = t.image;
|
|
5774
5790
|
return (e == null ? void 0 : e.naturalHeight) ?? (e == null ? void 0 : e.height);
|
|
5775
5791
|
}
|
|
5776
|
-
function
|
|
5792
|
+
function to(t, e) {
|
|
5777
5793
|
if (!t || !e)
|
|
5778
5794
|
return !1;
|
|
5779
5795
|
const i = t / e;
|
|
5780
5796
|
return i >= 1.8 && i <= 2.2;
|
|
5781
5797
|
}
|
|
5782
|
-
function
|
|
5783
|
-
return t && e && !
|
|
5798
|
+
function jc(t, e) {
|
|
5799
|
+
return t && e && !to(t, e) ? Uc : void 0;
|
|
5784
5800
|
}
|
|
5785
|
-
function
|
|
5786
|
-
const i =
|
|
5787
|
-
return t instanceof Error && t.message.startsWith(i.toUpperCase()) ? t :
|
|
5801
|
+
function Nc(t, e) {
|
|
5802
|
+
const i = Si(e);
|
|
5803
|
+
return t instanceof Error && t.message.startsWith(i.toUpperCase()) ? t : Ec.has(i) ? new Error(`${i.toUpperCase()} source could not be decoded by this browser. Stitch or export it with the camera vendor app as a 2:1 JPEG, MP4, or WebM file.`) : t instanceof Error ? t : new Error(String(t));
|
|
5788
5804
|
}
|
|
5789
|
-
function
|
|
5805
|
+
function Oc(t) {
|
|
5790
5806
|
return t instanceof B ? t.code === "sidecar_missing" ? "This INSV needs its matching .insv.pb calibration sidecar. Upload the sidecar with the video, or export a stitched 2:1 MP4/WebM file." : t.code === "calibration_missing" || t.code === "invalid_manifest" ? "This INSV needs both matching _00_/_10_ lens files and valid calibration metadata. Upload the pair, or export a stitched 2:1 MP4/WebM file." : t.message : t instanceof Error ? t.message : String(t);
|
|
5791
5807
|
}
|
|
5792
|
-
function
|
|
5808
|
+
function xa(t) {
|
|
5793
5809
|
if (t)
|
|
5794
5810
|
return typeof t == "object" && "source" in t ? t.source : t;
|
|
5795
5811
|
}
|
|
5796
|
-
function
|
|
5812
|
+
function Vc(t, e) {
|
|
5797
5813
|
if (e && e !== "application/octet-stream")
|
|
5798
5814
|
return e;
|
|
5799
|
-
switch (
|
|
5815
|
+
switch (Si(t)) {
|
|
5800
5816
|
case "insp":
|
|
5801
5817
|
return "image/jpeg";
|
|
5802
5818
|
case "insv":
|
|
@@ -5806,40 +5822,40 @@ function jc(t, e) {
|
|
|
5806
5822
|
return e;
|
|
5807
5823
|
}
|
|
5808
5824
|
}
|
|
5809
|
-
async function
|
|
5810
|
-
if (
|
|
5825
|
+
async function Wc(t, e, i) {
|
|
5826
|
+
if (Si(e) !== "insp" || typeof t != "string")
|
|
5811
5827
|
return t;
|
|
5812
5828
|
const n = await fetch(t, { signal: i });
|
|
5813
5829
|
if (!n.ok)
|
|
5814
5830
|
throw new Error(`INSP source request failed: ${n.status} ${n.statusText}`.trim());
|
|
5815
5831
|
return n.blob();
|
|
5816
5832
|
}
|
|
5817
|
-
function
|
|
5833
|
+
function Sn(t) {
|
|
5818
5834
|
return t * Math.PI / 180;
|
|
5819
5835
|
}
|
|
5820
|
-
function
|
|
5836
|
+
function Tn(t) {
|
|
5821
5837
|
const e = Math.max(0, Number.isFinite(t) ? t : 0);
|
|
5822
5838
|
return `${Math.floor(e / 60)}:${Math.floor(e % 60).toString().padStart(2, "0")}`;
|
|
5823
5839
|
}
|
|
5824
|
-
function
|
|
5840
|
+
function Si(t) {
|
|
5825
5841
|
return String(t ?? "").trim().replace(/^\./, "").toLowerCase();
|
|
5826
5842
|
}
|
|
5827
|
-
const
|
|
5843
|
+
const Kc = [{
|
|
5828
5844
|
extensions: ["dng"],
|
|
5829
5845
|
family: "image",
|
|
5830
5846
|
driverId: "raw-image",
|
|
5831
5847
|
targetFormat: "jpg",
|
|
5832
5848
|
contentTypes: ["image/dng", "image/x-adobe-dng"]
|
|
5833
5849
|
}];
|
|
5834
|
-
function
|
|
5850
|
+
function Zc(t) {
|
|
5835
5851
|
return {
|
|
5836
5852
|
id: "raw-image",
|
|
5837
5853
|
family: "image",
|
|
5838
5854
|
supports: (e) => e.replace(/^\./, "").toLowerCase() === "dng",
|
|
5839
|
-
createSession: (e, i) => new
|
|
5855
|
+
createSession: (e, i) => new qc(e, i ?? {}, t)
|
|
5840
5856
|
};
|
|
5841
5857
|
}
|
|
5842
|
-
class
|
|
5858
|
+
class qc {
|
|
5843
5859
|
constructor(e, i, n) {
|
|
5844
5860
|
A(this, "child");
|
|
5845
5861
|
A(this, "controller");
|
|
@@ -5864,11 +5880,11 @@ class Oc {
|
|
|
5864
5880
|
try {
|
|
5865
5881
|
(a = i.signal) != null && a.aborted && n.abort(), H(r);
|
|
5866
5882
|
const c = s ? await le(s.open(e, { format: "dng", signal: r }), r) : void 0;
|
|
5867
|
-
if (H(r), c &&
|
|
5883
|
+
if (H(r), c && Zn(c)) {
|
|
5868
5884
|
if (!(s != null && s.decodeImage)) throw new Error("Calibrated DNG preview requires a panorama processor with WASM image decoding.");
|
|
5869
5885
|
const l = await le(s.decodeImage(r), r);
|
|
5870
5886
|
H(r), s.close();
|
|
5871
|
-
const u = new
|
|
5887
|
+
const u = new eo(this.host, this.options);
|
|
5872
5888
|
this.attach(u), await le(u.loadCalibratedImage(l, c, o), r);
|
|
5873
5889
|
} else {
|
|
5874
5890
|
s == null || s.close();
|
|
@@ -5881,7 +5897,7 @@ class Oc {
|
|
|
5881
5897
|
H(r);
|
|
5882
5898
|
const u = [...(c == null ? void 0 : c.warnings) ?? [], ...l.warnings ?? []];
|
|
5883
5899
|
this.state.warnings = u, u.length && this.emit("warnings", u), H(r);
|
|
5884
|
-
const f =
|
|
5900
|
+
const f = Ao().createSession(this.host, this.options);
|
|
5885
5901
|
this.attach(f, u), await le(f.load(l.source, {
|
|
5886
5902
|
...o,
|
|
5887
5903
|
descriptor: { ...i.descriptor, source: l.source, extension: l.format, contentType: l.contentType },
|
|
@@ -5944,13 +5960,13 @@ class Oc {
|
|
|
5944
5960
|
}
|
|
5945
5961
|
}
|
|
5946
5962
|
export {
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5963
|
+
Kc as R,
|
|
5964
|
+
Qc as a,
|
|
5965
|
+
Hc as b,
|
|
5966
|
+
wi as c,
|
|
5967
|
+
Zc as d,
|
|
5968
|
+
Jc as e,
|
|
5969
|
+
os as f,
|
|
5970
|
+
Yc as g,
|
|
5955
5971
|
Se as t
|
|
5956
5972
|
};
|