filens-preview 0.1.0 → 0.1.2
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 +11 -6
- package/dist/all-in-one/THIRD-PARTY-NOTICES.txt +169 -0
- package/dist/all-in-one/filens.js +30490 -30284
- package/dist/split/THIRD-PARTY-NOTICES.txt +169 -0
- package/dist/split/chunks/{archive-6Qub9mNw.js → archive-Drem4a-o.js} +2 -2
- package/dist/split/chunks/{cad-EFq1g8br.js → cad-CsU3TiHK.js} +1 -1
- package/dist/split/chunks/{core-Btd5PUTt.js → core-BvtuMqS1.js} +2 -2
- package/dist/split/chunks/{diagram-DF4cLJ7x.js → diagram-BxRNHzmO.js} +2 -2
- package/dist/split/chunks/{docx-_znXEdDw.js → docx-Ch1AvEUX.js} +2 -2
- package/dist/split/chunks/{ebook-DieqKVSP.js → ebook-P42eILp5.js} +2 -2
- package/dist/split/chunks/{iwork-Dfnhl8e6.js → iwork-HnghW_EB.js} +2 -2
- package/dist/split/chunks/media-runtime-kbzoW8bd.js +48 -0
- package/dist/split/chunks/{mindmap-DHsLhGt7.js → mindmap-vFlOJSIq.js} +2 -2
- package/dist/split/chunks/{model3d-wQkZPAgr.js → model3d-BBFXmxkf.js} +3 -3
- package/dist/split/chunks/{panorama-D_kQX6f4.js → panorama-Bw_8HQsv.js} +511 -495
- package/dist/split/chunks/{vendor-DRiz60Cl.js → vendor-Cv2Fxtsf.js} +2 -0
- package/dist/split/chunks/{xlsx-BzBqnY9p.js → xlsx-ypLtJxeq.js} +2 -2
- package/dist/split/converter-core.wasm +0 -0
- package/dist/split/filens.js +968 -823
- package/dist/split/libheif.wasm +0 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var A = (t, e, i) =>
|
|
4
|
-
import { m as Sn, c as
|
|
5
|
-
import { S as Hi, ab as
|
|
6
|
-
function
|
|
1
|
+
var To = Object.defineProperty;
|
|
2
|
+
var ko = (t, e, i) => e in t ? To(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
|
+
var A = (t, e, i) => ko(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { m as Sn, c as Ro, n as Po } from "./core-BvtuMqS1.js";
|
|
5
|
+
import { S as Hi, ab as Ft, ac as Sa, ad as Ta, ae as ka, af as Ji, h as Ki, ag as Ao, ah as Ra, ai as Tn, l as Lo, n as _o, a8 as Uo, aj as $r, v as Eo } from "./vendor-Cv2Fxtsf.js";
|
|
6
|
+
function Se(t) {
|
|
7
7
|
if (t != null && t.aborted) throw kn();
|
|
8
8
|
}
|
|
9
9
|
function kn() {
|
|
10
10
|
return Object.assign(new Error("The conversion was aborted."), { name: "AbortError" });
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function wt(t, e) {
|
|
13
13
|
return e ? new Promise((i, n) => {
|
|
14
14
|
const r = () => n(kn());
|
|
15
15
|
t.then(
|
|
@@ -34,23 +34,23 @@ function Pa(t) {
|
|
|
34
34
|
return e;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function Co(t) {
|
|
38
38
|
return /^(?:https?:|blob:|\/|\.{1,2}\/)/i.test(t);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Io(t) {
|
|
41
41
|
return t.trimStart().toLowerCase().startsWith("data:");
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function zo(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 Bo(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: zo(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++) {
|
|
@@ -70,26 +70,50 @@ function Yr(t) {
|
|
|
70
70
|
const e = t | 32;
|
|
71
71
|
return e >= 97 && e <= 102 ? e - 87 : -1;
|
|
72
72
|
}
|
|
73
|
+
async function Rn(t, e = globalThis.fetch, i) {
|
|
74
|
+
if (jo(t))
|
|
75
|
+
return new Uint8Array(await wt(t.arrayBuffer(), i));
|
|
76
|
+
if (t instanceof ArrayBuffer)
|
|
77
|
+
return new Uint8Array(t);
|
|
78
|
+
if (ArrayBuffer.isView(t))
|
|
79
|
+
return new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
80
|
+
if (typeof t == "string") {
|
|
81
|
+
if (Io(t))
|
|
82
|
+
return Bo(t).bytes;
|
|
83
|
+
if (Co(t)) {
|
|
84
|
+
if (!e) throw new Error("A fetch implementation is required to load a conversion source URL.");
|
|
85
|
+
const n = await wt(e(t, { signal: i }), i);
|
|
86
|
+
if (Se(i), !n.ok)
|
|
87
|
+
throw new Error(`Failed to fetch conversion source: ${n.status} ${n.statusText}`.trim());
|
|
88
|
+
return new Uint8Array(await wt(n.arrayBuffer(), i));
|
|
89
|
+
}
|
|
90
|
+
return new TextEncoder().encode(t);
|
|
91
|
+
}
|
|
92
|
+
throw new Error("Unsupported conversion source type.");
|
|
93
|
+
}
|
|
94
|
+
function jo(t) {
|
|
95
|
+
return typeof t == "object" && t !== null && "arrayBuffer" in t && typeof t.arrayBuffer == "function";
|
|
96
|
+
}
|
|
73
97
|
function $i(t) {
|
|
74
|
-
const e = Pa(() =>
|
|
98
|
+
const e = Pa(() => Pn(t.wasm, t.fetch));
|
|
75
99
|
return async (i) => {
|
|
76
100
|
const n = i.signal;
|
|
77
|
-
|
|
101
|
+
Se(n);
|
|
78
102
|
const r = new _n({
|
|
79
103
|
args: i.args,
|
|
80
104
|
files: i.files,
|
|
81
105
|
captureStdio: i.captureStdio
|
|
82
|
-
}), o = await
|
|
83
|
-
|
|
84
|
-
const s = await
|
|
106
|
+
}), o = await wt(e(), n);
|
|
107
|
+
Se(n);
|
|
108
|
+
const s = await wt(WebAssembly.instantiate(o, {
|
|
85
109
|
wasi_snapshot_preview1: r.imports
|
|
86
110
|
}), n);
|
|
87
|
-
|
|
111
|
+
Se(n), r.setInstance(s);
|
|
88
112
|
let a = 0;
|
|
89
113
|
try {
|
|
90
114
|
s.exports._start();
|
|
91
115
|
} catch (c) {
|
|
92
|
-
if (c instanceof
|
|
116
|
+
if (c instanceof An)
|
|
93
117
|
a = c.code;
|
|
94
118
|
else
|
|
95
119
|
throw c;
|
|
@@ -104,18 +128,18 @@ function $i(t) {
|
|
|
104
128
|
};
|
|
105
129
|
};
|
|
106
130
|
}
|
|
107
|
-
async function
|
|
131
|
+
async function Pn(t, e = globalThis.fetch) {
|
|
108
132
|
const i = typeof t == "function" ? await t() : await t;
|
|
109
133
|
if (i instanceof WebAssembly.Module)
|
|
110
134
|
return i;
|
|
111
|
-
if (typeof i == "string" ||
|
|
135
|
+
if (typeof i == "string" || No(i)) {
|
|
112
136
|
if (!e)
|
|
113
137
|
throw new Error("A fetch implementation is required to load converter WASM from a URL.");
|
|
114
138
|
return Qr(await e(String(i)));
|
|
115
139
|
}
|
|
116
140
|
return typeof Response < "u" && i instanceof Response ? Qr(i) : WebAssembly.compile(i);
|
|
117
141
|
}
|
|
118
|
-
function
|
|
142
|
+
function No(t) {
|
|
119
143
|
return typeof URL < "u" && t instanceof URL;
|
|
120
144
|
}
|
|
121
145
|
async function Qr(t) {
|
|
@@ -123,12 +147,12 @@ async function Qr(t) {
|
|
|
123
147
|
throw new Error(`Failed to fetch converter WASM: ${t.status} ${t.statusText}`.trim());
|
|
124
148
|
return WebAssembly.compile(await t.arrayBuffer());
|
|
125
149
|
}
|
|
126
|
-
class
|
|
150
|
+
class An extends Error {
|
|
127
151
|
constructor(e) {
|
|
128
152
|
super(`WASI exited with code ${e}`), this.code = e;
|
|
129
153
|
}
|
|
130
154
|
}
|
|
131
|
-
const Q = 0, ge = 8,
|
|
155
|
+
const Q = 0, ge = 8, Oo = 20, Hr = 28, hi = 31, mi = 44, Jr = 54, ma = 55, Ln = 2, xa = 3, ba = 4, Kr = 1, Vo = 2, Wo = 4, Go = 8, Zr = 1;
|
|
132
156
|
class _n {
|
|
133
157
|
constructor(e) {
|
|
134
158
|
A(this, "imports", {
|
|
@@ -155,7 +179,7 @@ class _n {
|
|
|
155
179
|
path_unlink_file: (e, i, n) => this.pathUnlinkFile(e, i, n),
|
|
156
180
|
poll_oneoff: (e, i, n, r) => this.pollOneoff(r),
|
|
157
181
|
proc_exit: (e) => {
|
|
158
|
-
throw new
|
|
182
|
+
throw new An(e);
|
|
159
183
|
},
|
|
160
184
|
random_get: (e, i) => this.randomGet(e, i),
|
|
161
185
|
sched_yield: () => Q
|
|
@@ -184,14 +208,14 @@ class _n {
|
|
|
184
208
|
return new TextDecoder().decode(new Uint8Array(this.stdio[e]));
|
|
185
209
|
}
|
|
186
210
|
readFile(e) {
|
|
187
|
-
const i = this.files.get(
|
|
211
|
+
const i = this.files.get(Gt(e));
|
|
188
212
|
if (!i)
|
|
189
213
|
throw new Error(`WASM file was not written: ${e}`);
|
|
190
214
|
const n = new Uint8Array(i.byteLength);
|
|
191
215
|
return n.set(i), n;
|
|
192
216
|
}
|
|
193
217
|
readFileIfPresent(e) {
|
|
194
|
-
return this.files.has(
|
|
218
|
+
return this.files.has(Gt(e)) ? this.readFile(e) : void 0;
|
|
195
219
|
}
|
|
196
220
|
get memory() {
|
|
197
221
|
var i;
|
|
@@ -223,12 +247,12 @@ class _n {
|
|
|
223
247
|
}
|
|
224
248
|
fdFdstatGet(e, i) {
|
|
225
249
|
const n = this.fds.get(e);
|
|
226
|
-
return n ? (this.bytes.fill(0, i, i + 24), this.bytes[i] =
|
|
250
|
+
return n ? (this.bytes.fill(0, i, i + 24), this.bytes[i] = Xo(n), this.view.setBigUint64(i + 8, 0xffffffffffffffffn, !0), this.view.setBigUint64(i + 16, 0xffffffffffffffffn, !0), Q) : ge;
|
|
227
251
|
}
|
|
228
252
|
fdFilestatGet(e, i) {
|
|
229
253
|
var r;
|
|
230
254
|
const n = this.fds.get(e);
|
|
231
|
-
return n ? n.kind === "file" ? (this.writeFilestat(i, ba, ((r = this.files.get(n.path)) == null ? void 0 : r.byteLength) ?? 0), Q) : n.kind === "dir" ? (this.writeFilestat(i, xa, 0), Q) : (this.writeFilestat(i,
|
|
255
|
+
return n ? n.kind === "file" ? (this.writeFilestat(i, ba, ((r = this.files.get(n.path)) == null ? void 0 : r.byteLength) ?? 0), Q) : n.kind === "dir" ? (this.writeFilestat(i, xa, 0), Q) : (this.writeFilestat(i, Ln, 0), Q) : ge;
|
|
232
256
|
}
|
|
233
257
|
fdPrestatGet(e, i) {
|
|
234
258
|
const n = this.fds.get(e);
|
|
@@ -307,12 +331,12 @@ class _n {
|
|
|
307
331
|
const a = this.readPath(e, i, n);
|
|
308
332
|
if (!a)
|
|
309
333
|
return ge;
|
|
310
|
-
if (r & Kr && r &
|
|
311
|
-
return
|
|
312
|
-
if (!!(r &
|
|
334
|
+
if (r & Kr && r & Wo && (this.files.has(a) || this.dirs.has(a)))
|
|
335
|
+
return Oo;
|
|
336
|
+
if (!!(r & Vo))
|
|
313
337
|
return this.dirs.has(a) ? this.openDescriptor({ kind: "dir", path: a, position: 0 }, s) : this.files.has(a) ? Jr : mi;
|
|
314
338
|
if (this.files.has(a))
|
|
315
|
-
r &
|
|
339
|
+
r & Go && this.files.set(a, new Uint8Array());
|
|
316
340
|
else {
|
|
317
341
|
if (!(r & Kr))
|
|
318
342
|
return this.dirs.has(a) ? hi : mi;
|
|
@@ -379,7 +403,7 @@ class _n {
|
|
|
379
403
|
if (!r || r.kind !== "dir")
|
|
380
404
|
return null;
|
|
381
405
|
const o = new TextDecoder().decode(this.bytes.subarray(i, i + n));
|
|
382
|
-
return
|
|
406
|
+
return $o(r.path, o);
|
|
383
407
|
}
|
|
384
408
|
openDescriptor(e, i) {
|
|
385
409
|
const n = this.nextFd++;
|
|
@@ -389,7 +413,7 @@ class _n {
|
|
|
389
413
|
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);
|
|
390
414
|
}
|
|
391
415
|
writeInitialFile(e, i) {
|
|
392
|
-
const n =
|
|
416
|
+
const n = Gt(e);
|
|
393
417
|
this.ensureParentDir(n);
|
|
394
418
|
const r = new Uint8Array(i.byteLength);
|
|
395
419
|
r.set(i), this.files.set(n, r);
|
|
@@ -414,20 +438,20 @@ class _n {
|
|
|
414
438
|
function qo(t) {
|
|
415
439
|
return t.reduce((e, i) => e + new TextEncoder().encode(i).byteLength + 1, 0);
|
|
416
440
|
}
|
|
417
|
-
function
|
|
441
|
+
function Xo(t) {
|
|
418
442
|
switch (t.kind) {
|
|
419
443
|
case "dir":
|
|
420
444
|
return xa;
|
|
421
445
|
case "file":
|
|
422
446
|
return ba;
|
|
423
447
|
default:
|
|
424
|
-
return
|
|
448
|
+
return Ln;
|
|
425
449
|
}
|
|
426
450
|
}
|
|
427
|
-
function
|
|
428
|
-
return e.startsWith("/") ?
|
|
451
|
+
function $o(t, e) {
|
|
452
|
+
return e.startsWith("/") ? Gt(e) : Gt(`${t}/${e}`);
|
|
429
453
|
}
|
|
430
|
-
function
|
|
454
|
+
function Gt(t) {
|
|
431
455
|
const e = [];
|
|
432
456
|
for (const i of t.replace(/\\/g, "/").split("/"))
|
|
433
457
|
if (!(!i || i === ".")) {
|
|
@@ -440,13 +464,13 @@ function Wt(t) {
|
|
|
440
464
|
return `/${e.join("/")}`;
|
|
441
465
|
}
|
|
442
466
|
function pa(t) {
|
|
443
|
-
const e =
|
|
467
|
+
const e = Gt(t);
|
|
444
468
|
if (e === "/")
|
|
445
469
|
return "/";
|
|
446
470
|
const i = e.lastIndexOf("/");
|
|
447
471
|
return i <= 0 ? "/" : e.slice(0, i);
|
|
448
472
|
}
|
|
449
|
-
const
|
|
473
|
+
const Yo = [
|
|
450
474
|
{
|
|
451
475
|
sourceFormat: "dng",
|
|
452
476
|
targetFormat: "jpg"
|
|
@@ -539,14 +563,14 @@ const Xo = [
|
|
|
539
563
|
sourceFormat: "icns",
|
|
540
564
|
targetFormat: "png"
|
|
541
565
|
}
|
|
542
|
-
],
|
|
566
|
+
], Qo = new Set(
|
|
543
567
|
Sn.map((t) => ut(t.sourceFormat))
|
|
544
|
-
),
|
|
568
|
+
), Ho = new Set(
|
|
545
569
|
Sn.map(
|
|
546
570
|
(t) => `${ut(t.sourceFormat)}->${ut(t.targetFormat)}`
|
|
547
571
|
)
|
|
548
|
-
),
|
|
549
|
-
|
|
572
|
+
), Jo = new Set(
|
|
573
|
+
Yo.map(
|
|
550
574
|
(t) => `${ut(t.sourceFormat)}->${ut(t.targetFormat)}`
|
|
551
575
|
)
|
|
552
576
|
);
|
|
@@ -555,20 +579,20 @@ class Yi extends Error {
|
|
|
555
579
|
super(e.errorMessage || e.errorCode || "WASM conversion failed."), this.result = e, this.name = "WasmConversionError";
|
|
556
580
|
}
|
|
557
581
|
}
|
|
558
|
-
function
|
|
559
|
-
const e = $i(t), i = t.imageWasm ? Pa(() =>
|
|
582
|
+
function qc(t) {
|
|
583
|
+
const e = $i(t), i = t.imageWasm ? Pa(() => Pn(t.imageWasm, t.fetch)) : void 0, n = t.imageWasm ? $i({ wasm: i, fetch: t.fetch }) : void 0, r = i ? Ko(i) : void 0;
|
|
560
584
|
return {
|
|
561
585
|
async convert(o, s) {
|
|
562
|
-
|
|
563
|
-
const a = ut(o.sourceFormat), c = ut(o.targetFormat), l =
|
|
564
|
-
|
|
586
|
+
Se(s.signal);
|
|
587
|
+
const a = ut(o.sourceFormat), c = ut(o.targetFormat), l = Zo(a, c), u = `/work/input.${a}`, f = `/work/output.${c}`, y = "/work/options.json", p = "/work/result.json", m = await Rn(o.source, t.fetch, s.signal);
|
|
588
|
+
Se(s.signal);
|
|
565
589
|
const d = JSON.stringify({
|
|
566
590
|
...o.password ? { password: o.password } : {},
|
|
567
591
|
...o.locale ? { locale: o.locale } : {}
|
|
568
|
-
}), h = !!(n &&
|
|
592
|
+
}), h = !!(n && Jo.has(l));
|
|
569
593
|
if (h && c === "jpg" && r) {
|
|
570
594
|
const w = await r(m, s.signal);
|
|
571
|
-
if (
|
|
595
|
+
if (Se(s.signal), w) return w;
|
|
572
596
|
}
|
|
573
597
|
const b = await (h ? n : e)({
|
|
574
598
|
args: [
|
|
@@ -593,8 +617,8 @@ function Gc(t) {
|
|
|
593
617
|
readFiles: [p, f],
|
|
594
618
|
signal: s.signal
|
|
595
619
|
});
|
|
596
|
-
|
|
597
|
-
const x =
|
|
620
|
+
Se(s.signal);
|
|
621
|
+
const x = Un(b.files[p]);
|
|
598
622
|
if (!x.ok)
|
|
599
623
|
throw new Yi(x);
|
|
600
624
|
if (b.exitCode !== 0)
|
|
@@ -613,7 +637,7 @@ function Gc(t) {
|
|
|
613
637
|
}
|
|
614
638
|
};
|
|
615
639
|
}
|
|
616
|
-
function
|
|
640
|
+
function Ko(t) {
|
|
617
641
|
const e = Pa(async () => {
|
|
618
642
|
const i = await t(), n = new Set(WebAssembly.Module.exports(i).map((s) => s.name));
|
|
619
643
|
if (!["filens_image_alloc", "filens_image_free", "filens_image_preview", "memory"].every((s) => n.has(s))) return null;
|
|
@@ -621,8 +645,8 @@ function Ho(t) {
|
|
|
621
645
|
return r.setInstance(o), o.exports;
|
|
622
646
|
});
|
|
623
647
|
return async (i, n) => {
|
|
624
|
-
const r = await
|
|
625
|
-
if (
|
|
648
|
+
const r = await wt(e(), n);
|
|
649
|
+
if (Se(n), !r || i.length === 0) return null;
|
|
626
650
|
let o = 0, s = 0, a = 0;
|
|
627
651
|
try {
|
|
628
652
|
if (o = r.filens_image_alloc(i.length) >>> 0, !o) throw new Error("Image core could not allocate its input buffer.");
|
|
@@ -631,7 +655,7 @@ function Ho(t) {
|
|
|
631
655
|
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.");
|
|
632
656
|
const l = new Uint8Array(r.memory.buffer, s, a), u = new DataView(l.buffer, l.byteOffset, 4).getUint32(0, !0);
|
|
633
657
|
if (u > l.length - 4) throw new Error("Image core returned invalid preview metadata.");
|
|
634
|
-
const f =
|
|
658
|
+
const f = Un(l.subarray(4, 4 + u));
|
|
635
659
|
if (!f.ok) throw new Yi(f);
|
|
636
660
|
return { source: l.slice(4 + u), format: "jpg", contentType: f.contentType, warnings: f.warnings };
|
|
637
661
|
} finally {
|
|
@@ -639,11 +663,11 @@ function Ho(t) {
|
|
|
639
663
|
}
|
|
640
664
|
};
|
|
641
665
|
}
|
|
642
|
-
function
|
|
666
|
+
function Zo(t, e) {
|
|
643
667
|
const i = `${t}->${e}`;
|
|
644
|
-
if (
|
|
668
|
+
if (Ho.has(i))
|
|
645
669
|
return i;
|
|
646
|
-
const n =
|
|
670
|
+
const n = Qo.has(t) ? `unsupported conversion pair: ${t} -> ${e}` : `unsupported source format: ${t}`;
|
|
647
671
|
throw new Yi({
|
|
648
672
|
ok: !1,
|
|
649
673
|
sourceFormat: t,
|
|
@@ -654,31 +678,7 @@ function Jo(t, e) {
|
|
|
654
678
|
metrics: {}
|
|
655
679
|
});
|
|
656
680
|
}
|
|
657
|
-
|
|
658
|
-
if (Zo(t))
|
|
659
|
-
return new Uint8Array(await qt(t.arrayBuffer(), i));
|
|
660
|
-
if (t instanceof ArrayBuffer)
|
|
661
|
-
return new Uint8Array(t);
|
|
662
|
-
if (ArrayBuffer.isView(t))
|
|
663
|
-
return new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
664
|
-
if (typeof t == "string") {
|
|
665
|
-
if (Co(t))
|
|
666
|
-
return zo(t).bytes;
|
|
667
|
-
if (Eo(t)) {
|
|
668
|
-
if (!e) throw new Error("A fetch implementation is required to load a conversion source URL.");
|
|
669
|
-
const n = await qt(e(t, { signal: i }), i);
|
|
670
|
-
if (Ke(i), !n.ok)
|
|
671
|
-
throw new Error(`Failed to fetch conversion source: ${n.status} ${n.statusText}`.trim());
|
|
672
|
-
return new Uint8Array(await qt(n.arrayBuffer(), i));
|
|
673
|
-
}
|
|
674
|
-
return new TextEncoder().encode(t);
|
|
675
|
-
}
|
|
676
|
-
throw new Error("Unsupported conversion source type.");
|
|
677
|
-
}
|
|
678
|
-
function Zo(t) {
|
|
679
|
-
return typeof t == "object" && t !== null && "arrayBuffer" in t && typeof t.arrayBuffer == "function";
|
|
680
|
-
}
|
|
681
|
-
function Ln(t) {
|
|
681
|
+
function Un(t) {
|
|
682
682
|
const e = new TextDecoder().decode(t), i = JSON.parse(e);
|
|
683
683
|
return {
|
|
684
684
|
...i,
|
|
@@ -688,6 +688,20 @@ function Ln(t) {
|
|
|
688
688
|
function ut(t) {
|
|
689
689
|
return t.trim().replace(/^\./, "").toLowerCase();
|
|
690
690
|
}
|
|
691
|
+
function Xc() {
|
|
692
|
+
return {
|
|
693
|
+
async convert(t, e) {
|
|
694
|
+
const i = t.sourceFormat.replace(/^\./, "").toLowerCase(), n = t.targetFormat.replace(/^\./, "").toLowerCase();
|
|
695
|
+
if (!(["heic", "heif"].includes(i) && n === "png"))
|
|
696
|
+
throw new Error(`Unsupported media conversion: ${i} -> ${n}.`);
|
|
697
|
+
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 Rn(r, globalThis.fetch, e.signal);
|
|
699
|
+
Se(e.signal);
|
|
700
|
+
const s = await wt(import("./media-runtime-kbzoW8bd.js"), e.signal);
|
|
701
|
+
return Se(e.signal), s.convertMedia(o, i, e.signal);
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
691
705
|
function H(t) {
|
|
692
706
|
if (t != null && t.aborted) throw new DOMException("Panorama preview was aborted.", "AbortError");
|
|
693
707
|
}
|
|
@@ -793,16 +807,16 @@ function as(t) {
|
|
|
793
807
|
w && (F["/work/sidecar.pb"] = w), [...g.values()].forEach((P, E) => {
|
|
794
808
|
F[`/work/range-${E}.bin`] = P.bytes;
|
|
795
809
|
});
|
|
796
|
-
const T = "/work/result.json",
|
|
810
|
+
const T = "/work/result.json", L = await i({
|
|
797
811
|
args: ["converter-core", "--operation", "inspect-panorama", "--source", u.format, "--options", "/work/options.json", "--result", T],
|
|
798
812
|
files: F,
|
|
799
813
|
readFiles: [T],
|
|
800
814
|
signal: p
|
|
801
815
|
});
|
|
802
816
|
ie(p);
|
|
803
|
-
const
|
|
804
|
-
if (!
|
|
805
|
-
const k = JSON.parse(new TextDecoder().decode(
|
|
817
|
+
const _ = L.files[T];
|
|
818
|
+
if (!_) throw new B("invalid_manifest", "Panorama inspector did not return a result.");
|
|
819
|
+
const k = JSON.parse(new TextDecoder().decode(_));
|
|
806
820
|
if (k.ok && k.payload) {
|
|
807
821
|
if (h = ns(k.payload), u.companion) {
|
|
808
822
|
f.companionProcessor = as(t);
|
|
@@ -812,14 +826,14 @@ function as(t) {
|
|
|
812
826
|
signal: p
|
|
813
827
|
});
|
|
814
828
|
ie(p);
|
|
815
|
-
const E = new Set(h.tracks.map((J) => J.id)), j = /* @__PURE__ */ new Map(),
|
|
829
|
+
const E = new Set(h.tracks.map((J) => J.id)), j = /* @__PURE__ */ new Map(), G = P.tracks.map((J) => {
|
|
816
830
|
let Z = J.id;
|
|
817
831
|
for (; E.has(Z); ) Z += 1e6;
|
|
818
832
|
return E.add(Z), f.companionTrackIds.set(Z, J.id), j.set(J.id, Z), { ...J, id: Z };
|
|
819
|
-
}),
|
|
833
|
+
}), q = P.lenses.map((J) => ({
|
|
820
834
|
...J,
|
|
821
835
|
sourceTrackId: J.sourceTrackId === void 0 ? void 0 : j.get(J.sourceTrackId)
|
|
822
|
-
})), te = [...h.tracks, ...
|
|
836
|
+
})), te = [...h.tracks, ...G], ne = cs(ss(h.lenses, q), te), ue = [...h.warnings, ...P.warnings];
|
|
823
837
|
h = {
|
|
824
838
|
...h,
|
|
825
839
|
cameraModel: h.cameraModel || P.cameraModel,
|
|
@@ -892,11 +906,11 @@ function as(t) {
|
|
|
892
906
|
if (!Number.isSafeInteger(l) || !Number.isSafeInteger(u) || l < 0 || u < 0 || u > tn)
|
|
893
907
|
throw new B("resource_limit", `Panorama metadata windows are limited to ${tn} samples.`);
|
|
894
908
|
const h = d.metadataTrack, g = h.samples.slice(l, l + u);
|
|
895
|
-
if (g.reduce((T,
|
|
909
|
+
if (g.reduce((T, L) => T + L.size, 0) > is) throw new B("resource_limit", "Panorama metadata window exceeds 8 MiB.");
|
|
896
910
|
const x = {}, v = [];
|
|
897
911
|
for (let T = 0; T < g.length; T += 1) {
|
|
898
|
-
const
|
|
899
|
-
x[
|
|
912
|
+
const L = await c(y, h.id, l + T, p.signal), _ = `/work/metadata-${T}.bin`;
|
|
913
|
+
x[_] = L.data, v.push({ path: _, pts: L.pts, timescale: L.timescale });
|
|
900
914
|
}
|
|
901
915
|
const w = "/work/result.json";
|
|
902
916
|
ie(p.signal), x["/work/options.json"] = new TextEncoder().encode(JSON.stringify({ vendor: d.vendor, samples: v }));
|
|
@@ -956,12 +970,12 @@ function as(t) {
|
|
|
956
970
|
getManifest: () => o.manifest
|
|
957
971
|
};
|
|
958
972
|
}
|
|
959
|
-
function
|
|
973
|
+
function En(t) {
|
|
960
974
|
return {
|
|
961
975
|
codec: ls(t),
|
|
962
976
|
codedWidth: t.width,
|
|
963
977
|
codedHeight: t.height,
|
|
964
|
-
description:
|
|
978
|
+
description: Cn(t.decoderConfig),
|
|
965
979
|
optimizeForLatency: !0
|
|
966
980
|
};
|
|
967
981
|
}
|
|
@@ -1010,7 +1024,7 @@ function an(t) {
|
|
|
1010
1024
|
return delete e.sourceTrackId, delete e.sourceRect, JSON.stringify(e);
|
|
1011
1025
|
}
|
|
1012
1026
|
function ls(t) {
|
|
1013
|
-
const e =
|
|
1027
|
+
const e = Cn(t.decoderConfig);
|
|
1014
1028
|
if ((t.codec === "avc1" || t.codec === "avc3") && e.length >= 4)
|
|
1015
1029
|
return `${t.codec}.${[...e.slice(1, 4)].map((i) => i.toString(16).padStart(2, "0")).join("")}`;
|
|
1016
1030
|
if ((t.codec === "hvc1" || t.codec === "hev1") && e.length >= 13) {
|
|
@@ -1025,7 +1039,7 @@ function ls(t) {
|
|
|
1025
1039
|
}
|
|
1026
1040
|
return t.codec;
|
|
1027
1041
|
}
|
|
1028
|
-
function
|
|
1042
|
+
function Cn(t) {
|
|
1029
1043
|
return t ? Uint8Array.from(t.match(/.{1,2}/g) ?? [], (e) => Number.parseInt(e, 16)) : new Uint8Array();
|
|
1030
1044
|
}
|
|
1031
1045
|
async function rn(t, e, i, n) {
|
|
@@ -1150,16 +1164,16 @@ async function us(t, e, i) {
|
|
|
1150
1164
|
track: o,
|
|
1151
1165
|
rect: h.sourceRect ?? { x: 0, y: 0, width: 1, height: 1 }
|
|
1152
1166
|
}));
|
|
1153
|
-
if (!s.every((h) =>
|
|
1167
|
+
if (!s.every((h) => In(h.rect)))
|
|
1154
1168
|
throw new B("invalid_manifest", "The calibrated INSP lenses are not bound to valid image regions.");
|
|
1155
|
-
i.flipY =
|
|
1169
|
+
i.flipY = La(e.textureOrigin), i.colorSpace = Hi, i.minFilter = Ft, i.generateMipmaps = !1, i.needsUpdate = !0;
|
|
1156
1170
|
const a = new Sa(new Uint8Array(128 * 64).fill(128), 128, 64, Ta, ka);
|
|
1157
|
-
a.needsUpdate = !0, a.minFilter =
|
|
1171
|
+
a.needsUpdate = !0, a.minFilter = Ft;
|
|
1158
1172
|
const c = ds(e, s, i, a);
|
|
1159
|
-
|
|
1173
|
+
_a(c, e.lenses);
|
|
1160
1174
|
const l = new Ji(500, 96, 64);
|
|
1161
1175
|
l.scale(-1, 1, 1);
|
|
1162
|
-
const u = new Ki(l, c), f = new
|
|
1176
|
+
const u = new Ki(l, c), f = new Bn(t, e, s, c, a);
|
|
1163
1177
|
return await f.acceptImage(i.image), {
|
|
1164
1178
|
mesh: u,
|
|
1165
1179
|
update: () => {
|
|
@@ -1202,15 +1216,15 @@ function ds(t, e, i, n) {
|
|
|
1202
1216
|
distortion1: { value: Ze(r[1]) },
|
|
1203
1217
|
quaternion0: { value: dt(r[0]) },
|
|
1204
1218
|
quaternion1: { value: dt(r[1]) },
|
|
1205
|
-
radialScale0: { value:
|
|
1206
|
-
radialScale1: { value:
|
|
1219
|
+
radialScale0: { value: Dt(r[0]) },
|
|
1220
|
+
radialScale1: { value: Dt(r[1]) },
|
|
1207
1221
|
projectionKind: { value: 1 },
|
|
1208
1222
|
xi0: { value: r[0].xi || 0 },
|
|
1209
1223
|
xi1: { value: r[1].xi || 0 },
|
|
1210
1224
|
tangential0: { value: ve(r[0].tangential) },
|
|
1211
1225
|
tangential1: { value: ve(r[1].tangential) },
|
|
1212
|
-
thinPrism0: { value:
|
|
1213
|
-
thinPrism1: { value:
|
|
1226
|
+
thinPrism0: { value: Mt(r[0].thinPrism) },
|
|
1227
|
+
thinPrism1: { value: Mt(r[1].thinPrism) },
|
|
1214
1228
|
sensorTilt0: { value: ve(r[0].sensorTilt) },
|
|
1215
1229
|
sensorTilt1: { value: ve(r[1].sensorTilt) },
|
|
1216
1230
|
seamMask: { value: n },
|
|
@@ -1342,15 +1356,15 @@ async function fs(t, e) {
|
|
|
1342
1356
|
const n = [...new Map(i.map((h) => [h.track.id, h.track])).values()];
|
|
1343
1357
|
if (n.some((h) => h.timescale <= 0 || !h.samples.length))
|
|
1344
1358
|
throw new B("invalid_manifest", "The calibrated panorama tracks do not contain a playable sample timeline.");
|
|
1345
|
-
const r = n.map(
|
|
1359
|
+
const r = n.map(En);
|
|
1346
1360
|
if ((await Promise.all(r.map((h) => VideoDecoder.isConfigSupported(h)))).some((h) => !h.supported))
|
|
1347
1361
|
throw new B("codec_unsupported", `This browser cannot decode the ${[...new Set(n.map((h) => h.codec.toUpperCase()))].join("/")} panorama tracks.`);
|
|
1348
|
-
const s = n.map(() => new
|
|
1362
|
+
const s = n.map(() => new Ao());
|
|
1349
1363
|
s.forEach((h) => {
|
|
1350
|
-
h.flipY =
|
|
1364
|
+
h.flipY = La(e.textureOrigin), h.colorSpace = Hi, h.minFilter = Ft;
|
|
1351
1365
|
});
|
|
1352
1366
|
const a = new Sa(new Uint8Array(128 * 64).fill(128), 128, 64, Ta, ka);
|
|
1353
|
-
a.needsUpdate = !0, a.minFilter =
|
|
1367
|
+
a.needsUpdate = !0, a.minFilter = Ft;
|
|
1354
1368
|
const c = e.lenses.slice(0, 2), l = i.map((h) => s[n.indexOf(h.track)]), u = new Ra({
|
|
1355
1369
|
uniforms: {
|
|
1356
1370
|
lens0: { value: l[0] },
|
|
@@ -1365,15 +1379,15 @@ async function fs(t, e) {
|
|
|
1365
1379
|
distortion1: { value: Ze(c[1]) },
|
|
1366
1380
|
quaternion0: { value: dt(c[0]) },
|
|
1367
1381
|
quaternion1: { value: dt(c[1]) },
|
|
1368
|
-
radialScale0: { value:
|
|
1369
|
-
radialScale1: { value:
|
|
1382
|
+
radialScale0: { value: Dt(c[0]) },
|
|
1383
|
+
radialScale1: { value: Dt(c[1]) },
|
|
1370
1384
|
projectionKind: { value: e.projection.kind === "mei-extended" ? 1 : 0 },
|
|
1371
1385
|
xi0: { value: c[0].xi || 0 },
|
|
1372
1386
|
xi1: { value: c[1].xi || 0 },
|
|
1373
1387
|
tangential0: { value: ve(c[0].tangential) },
|
|
1374
1388
|
tangential1: { value: ve(c[1].tangential) },
|
|
1375
|
-
thinPrism0: { value:
|
|
1376
|
-
thinPrism1: { value:
|
|
1389
|
+
thinPrism0: { value: Mt(c[0].thinPrism) },
|
|
1390
|
+
thinPrism1: { value: Mt(c[1].thinPrism) },
|
|
1377
1391
|
sensorTilt0: { value: ve(c[0].sensorTilt) },
|
|
1378
1392
|
sensorTilt1: { value: ve(c[1].sensorTilt) },
|
|
1379
1393
|
seamMask: { value: a },
|
|
@@ -1525,10 +1539,10 @@ async function fs(t, e) {
|
|
|
1525
1539
|
}
|
|
1526
1540
|
`
|
|
1527
1541
|
});
|
|
1528
|
-
|
|
1542
|
+
_a(u, e.lenses);
|
|
1529
1543
|
const f = new Ji(500, 96, 64);
|
|
1530
1544
|
f.scale(-1, 1, 1);
|
|
1531
|
-
const y = new Ki(f, u), p = new
|
|
1545
|
+
const y = new Ki(f, u), p = new Bn(t, e, i, u, a), m = new ws(t, e, u), d = new zn(t, n, s, r, (h, g) => {
|
|
1532
1546
|
m.apply(h.timestamp / 1e6), p.accept(h, g);
|
|
1533
1547
|
}, (h) => m.prepare(h), () => {
|
|
1534
1548
|
p.reset(), m.reset();
|
|
@@ -1591,11 +1605,11 @@ async function hs(t, e, i) {
|
|
|
1591
1605
|
}
|
|
1592
1606
|
const a = s.map((d) => {
|
|
1593
1607
|
const h = new Tn(d);
|
|
1594
|
-
return h.flipY =
|
|
1608
|
+
return h.flipY = La(t.textureOrigin), h.colorSpace = Hi, h.minFilter = Ft, h;
|
|
1595
1609
|
}), c = new Sa(new Uint8Array(128 * 64).fill(128), 128, 64, Ta, ka);
|
|
1596
|
-
c.needsUpdate = !0, c.minFilter =
|
|
1610
|
+
c.needsUpdate = !0, c.minFilter = Ft;
|
|
1597
1611
|
const l = t.lenses.slice(0, 2), u = n.map((d) => a[r.indexOf(d.track)]), f = gs(t, l, n, u, c);
|
|
1598
|
-
|
|
1612
|
+
_a(f, t.lenses);
|
|
1599
1613
|
const y = new Ji(500, 96, 64);
|
|
1600
1614
|
y.scale(-1, 1, 1);
|
|
1601
1615
|
const p = new Ki(y, f), m = new vs(s, a);
|
|
@@ -1668,15 +1682,15 @@ function gs(t, e, i, n, r) {
|
|
|
1668
1682
|
distortion1: { value: Ze(e[1]) },
|
|
1669
1683
|
quaternion0: { value: dt(e[0]) },
|
|
1670
1684
|
quaternion1: { value: dt(e[1]) },
|
|
1671
|
-
radialScale0: { value:
|
|
1672
|
-
radialScale1: { value:
|
|
1685
|
+
radialScale0: { value: Dt(e[0]) },
|
|
1686
|
+
radialScale1: { value: Dt(e[1]) },
|
|
1673
1687
|
projectionKind: { value: t.projection.kind === "mei-extended" ? 1 : 0 },
|
|
1674
1688
|
xi0: { value: e[0].xi || 0 },
|
|
1675
1689
|
xi1: { value: e[1].xi || 0 },
|
|
1676
1690
|
tangential0: { value: ve(e[0].tangential) },
|
|
1677
1691
|
tangential1: { value: ve(e[1].tangential) },
|
|
1678
|
-
thinPrism0: { value:
|
|
1679
|
-
thinPrism1: { value:
|
|
1692
|
+
thinPrism0: { value: Mt(e[0].thinPrism) },
|
|
1693
|
+
thinPrism1: { value: Mt(e[1].thinPrism) },
|
|
1680
1694
|
sensorTilt0: { value: ve(e[0].sensorTilt) },
|
|
1681
1695
|
sensorTilt1: { value: ve(e[1].sensorTilt) },
|
|
1682
1696
|
seamMask: { value: r },
|
|
@@ -1870,7 +1884,7 @@ class vs {
|
|
|
1870
1884
|
}
|
|
1871
1885
|
function Zi(t) {
|
|
1872
1886
|
const e = t.lenses.slice(0, 2);
|
|
1873
|
-
if (e.length < 2 || !e.every((a) => bs(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" ?
|
|
1887
|
+
if (e.length < 2 || !e.every((a) => bs(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;
|
|
1874
1888
|
const n = wi(e[0].extrinsicQuaternion), r = wi(e[1].extrinsicQuaternion);
|
|
1875
1889
|
if (Math.abs(n.reduce((a, c, l) => a + c * r[l], 0)) >= 0.999) return !1;
|
|
1876
1890
|
const o = on(e[0], t.projection.kind), s = on(e[1], t.projection.kind);
|
|
@@ -1881,7 +1895,7 @@ function ea(t) {
|
|
|
1881
1895
|
if (e.length < 2) return;
|
|
1882
1896
|
const i = e.map((n, r) => {
|
|
1883
1897
|
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 };
|
|
1884
|
-
return o &&
|
|
1898
|
+
return o && In(s) ? { track: o, rect: s } : void 0;
|
|
1885
1899
|
});
|
|
1886
1900
|
if (!(!i[0] || !i[1]) && !(i[0].track.id === i[1].track.id && !e.every((n) => n.sourceRect)))
|
|
1887
1901
|
return i;
|
|
@@ -1889,14 +1903,14 @@ function ea(t) {
|
|
|
1889
1903
|
function xs(t, e, i, n) {
|
|
1890
1904
|
return [
|
|
1891
1905
|
i.rect.x + t * i.rect.width,
|
|
1892
|
-
i.rect.y +
|
|
1906
|
+
i.rect.y + Ls(e, n) * i.rect.height
|
|
1893
1907
|
];
|
|
1894
1908
|
}
|
|
1895
1909
|
function Xt(t, e) {
|
|
1896
1910
|
const { x: i, y: n, width: r, height: o } = t.rect;
|
|
1897
1911
|
return [i, e === "top-left" ? n : 1 - n - o, r, o];
|
|
1898
1912
|
}
|
|
1899
|
-
function
|
|
1913
|
+
function In(t) {
|
|
1900
1914
|
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;
|
|
1901
1915
|
}
|
|
1902
1916
|
function $t(t, e) {
|
|
@@ -1904,16 +1918,16 @@ function $t(t, e) {
|
|
|
1904
1918
|
}
|
|
1905
1919
|
function on(t, e) {
|
|
1906
1920
|
const i = dt(t);
|
|
1907
|
-
return
|
|
1921
|
+
return jn(e === "mei-extended" ? i : Aa(i), [0, 0, 1]);
|
|
1908
1922
|
}
|
|
1909
1923
|
function bs(t, e) {
|
|
1910
1924
|
const i = [t.width, t.height, t.fx, t.fy, t.cx, t.cy], n = t.extrinsicQuaternion;
|
|
1911
|
-
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" ?
|
|
1925
|
+
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);
|
|
1912
1926
|
}
|
|
1913
|
-
function
|
|
1927
|
+
function Ke(t, e) {
|
|
1914
1928
|
return !!(t && t.length >= e && t.slice(0, e).every((i) => typeof i == "number" && Number.isFinite(i)));
|
|
1915
1929
|
}
|
|
1916
|
-
class
|
|
1930
|
+
class zn {
|
|
1917
1931
|
constructor(e, i, n, r, o, s, a) {
|
|
1918
1932
|
A(this, "decoders");
|
|
1919
1933
|
A(this, "queues");
|
|
@@ -1933,7 +1947,7 @@ class In {
|
|
|
1933
1947
|
A(this, "seekEnd");
|
|
1934
1948
|
A(this, "streamSyncMs", 0);
|
|
1935
1949
|
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(() => {
|
|
1936
|
-
}), this.duration = Math.min(...i.map(
|
|
1950
|
+
}), this.duration = Math.min(...i.map(Ws)), this.seekEnd = Math.min(...i.map((c) => c.samples.at(-1).pts / c.timescale)), this.decoders = [];
|
|
1937
1951
|
try {
|
|
1938
1952
|
r.forEach((c, l) => {
|
|
1939
1953
|
const u = new VideoDecoder({
|
|
@@ -2140,8 +2154,8 @@ function Ds(t, e) {
|
|
|
2140
2154
|
t[0] * e[3] + t[1] * e[2] - t[2] * e[1] + t[3] * e[0]
|
|
2141
2155
|
];
|
|
2142
2156
|
}
|
|
2143
|
-
const N = 128, ae = 64,
|
|
2144
|
-
class
|
|
2157
|
+
const N = 128, ae = 64, Je = 256;
|
|
2158
|
+
class Bn {
|
|
2145
2159
|
constructor(e, i, n, r, o) {
|
|
2146
2160
|
A(this, "lastAnalysis", -1 / 0);
|
|
2147
2161
|
A(this, "busy", !1);
|
|
@@ -2185,10 +2199,10 @@ class zn {
|
|
|
2185
2199
|
for (let v = 0; v < N; v += 1) {
|
|
2186
2200
|
const w = Cs((v + 0.5) / N, (x + 0.5) / ae, this.manifest.projection.kind), S = x * N + v;
|
|
2187
2201
|
for (let D = 0; D < 2; D += 1) {
|
|
2188
|
-
const F =
|
|
2202
|
+
const F = _s(w, s[D], this.manifest.projection.kind);
|
|
2189
2203
|
if (!F) continue;
|
|
2190
|
-
const T = S * 3,
|
|
2191
|
-
As(
|
|
2204
|
+
const T = S * 3, L = n[D], _ = xs(F[0], F[1], this.lensSources[D], this.manifest.textureOrigin);
|
|
2205
|
+
As(L, Je, _[0], _[1], r[D], T), o[D][S] = F[2] * (this.manifest.projection.kind === "mei-extended" ? Is((v + 0.5) / N, D) : 1);
|
|
2192
2206
|
}
|
|
2193
2207
|
if (o[0][S] > 0 && o[1][S] > 0) {
|
|
2194
2208
|
a += 1;
|
|
@@ -2212,8 +2226,8 @@ class zn {
|
|
|
2212
2226
|
for (let v = 0; v < N; v += 1) {
|
|
2213
2227
|
const w = x * N + v;
|
|
2214
2228
|
if (o[0][w] <= 0 || o[1][w] <= 0) continue;
|
|
2215
|
-
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,
|
|
2216
|
-
u[w] = Math.min(65534, D + Math.abs(
|
|
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 = un(r[0], l[0], w, F, T), _ = un(r[1], l[1], w, F, T);
|
|
2230
|
+
u[w] = Math.min(65534, D + Math.abs(L - _) * 2 + Rs(o[0][w], o[1][w]));
|
|
2217
2231
|
}
|
|
2218
2232
|
const f = this.manifest.projection.kind === "dji-fisheye-lut", y = f ? Vs(u, N, ae, N / 4) : u, p = N / 2, [m, d] = await Promise.all([
|
|
2219
2233
|
this.processor.computeSeam({ width: p, height: ae, costs: dn(y, 0), previous: this.previousLeft, temporalWeight: 3, maxStep: 2 }),
|
|
@@ -2274,9 +2288,9 @@ function ga(t, e, i) {
|
|
|
2274
2288
|
return (t[n] * e[0] * 77 + t[n + 1] * e[1] * 150 + t[n + 2] * e[2] * 29) / 256;
|
|
2275
2289
|
}
|
|
2276
2290
|
function Ps(t) {
|
|
2277
|
-
const i = (typeof OffscreenCanvas < "u" ? new OffscreenCanvas(
|
|
2291
|
+
const i = (typeof OffscreenCanvas < "u" ? new OffscreenCanvas(Je, Je) : Object.assign(document.createElement("canvas"), { width: Je, height: Je })).getContext("2d", { willReadFrequently: !0 });
|
|
2278
2292
|
if (!i) throw new Error("A 2D canvas is required for panorama seam analysis.");
|
|
2279
|
-
return i.drawImage(t, 0, 0,
|
|
2293
|
+
return i.drawImage(t, 0, 0, Je, Je), i.getImageData(0, 0, Je, Je).data;
|
|
2280
2294
|
}
|
|
2281
2295
|
function As(t, e, i, n, r = new Uint8Array(3), o = 0) {
|
|
2282
2296
|
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;
|
|
@@ -2286,21 +2300,21 @@ function As(t, e, i, n, r = new Uint8Array(3), o = 0) {
|
|
|
2286
2300
|
}
|
|
2287
2301
|
return r;
|
|
2288
2302
|
}
|
|
2289
|
-
function
|
|
2303
|
+
function La(t) {
|
|
2290
2304
|
return t !== "top-left";
|
|
2291
2305
|
}
|
|
2292
|
-
function
|
|
2306
|
+
function Ls(t, e) {
|
|
2293
2307
|
return e === "top-left" ? t : 1 - t;
|
|
2294
2308
|
}
|
|
2295
|
-
function
|
|
2296
|
-
const n = dt(e), r =
|
|
2309
|
+
function _s(t, e, i) {
|
|
2310
|
+
const n = dt(e), r = jn(i === "mei-extended" ? Aa(n) : n, t), o = Math.acos(Math.max(-1, Math.min(1, r[2])));
|
|
2297
2311
|
let s, a;
|
|
2298
2312
|
if (i === "mei-extended") {
|
|
2299
2313
|
const p = r[2] + (e.xi || 0);
|
|
2300
2314
|
if (p <= 1e-6) return;
|
|
2301
2315
|
const m = r[0] / p, d = r[1] / p, h = m * m + d * d;
|
|
2302
2316
|
if (!Number.isFinite(h) || h > 16) return;
|
|
2303
|
-
const g = h * h, b = Ze(e), x = ve(e.tangential), v =
|
|
2317
|
+
const g = h * h, b = Ze(e), x = ve(e.tangential), v = Mt(e.thinPrism), w = 1 + b[0] * h + b[1] * g + b[2] * h * g + b[3] * g * g, S = m * w + 2 * x[0] * m * d + x[1] * (h + 2 * m * m) + v[0] * h + v[1] * g, D = d * w + x[0] * (h + 2 * d * d) + 2 * x[1] * m * d + v[2] * h + v[3] * g, F = e.distortionModel === "radtan_pro" ? Us([m, d], e.distortionCoeffs) : Bs([S, D], ve(e.sensorTilt));
|
|
2304
2318
|
s = (e.cx || 0) + (e.fx || 1) * F[0], a = (e.cy || 0) + (e.fy || e.fx || 1) * F[1];
|
|
2305
2319
|
} else {
|
|
2306
2320
|
if (o >= 96 * Math.PI / 180) return;
|
|
@@ -2320,7 +2334,7 @@ function Us([t, e], i) {
|
|
|
2320
2334
|
e * o + (n + 2 * e * e) * a + 2 * t * e * s + i[10] * n + i[12] * r
|
|
2321
2335
|
];
|
|
2322
2336
|
}
|
|
2323
|
-
function
|
|
2337
|
+
function _a(t, e) {
|
|
2324
2338
|
if (!e.some((r) => r.distortionModel === "radtan_pro")) return;
|
|
2325
2339
|
const n = `${e.slice(0, 2).map((r, o) => {
|
|
2326
2340
|
const s = Array.from({ length: 13 }, (a, c) => {
|
|
@@ -2368,7 +2382,7 @@ function Bs(t, e) {
|
|
|
2368
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, m = 1 / (Math.abs(y) > 1e-6 ? y : y < 0 ? -1e-6 : 1e-6);
|
|
2369
2383
|
return [s * (c * u + l * y) * m, (c * s * f - a * y) * m];
|
|
2370
2384
|
}
|
|
2371
|
-
function
|
|
2385
|
+
function jn(t, e) {
|
|
2372
2386
|
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;
|
|
2373
2387
|
return [
|
|
2374
2388
|
2 * a * r + l * e[0] + 2 * n * c[0],
|
|
@@ -2378,7 +2392,7 @@ function Bn(t, e) {
|
|
|
2378
2392
|
}
|
|
2379
2393
|
function js(t, e) {
|
|
2380
2394
|
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;
|
|
2381
|
-
return
|
|
2395
|
+
return Dt(e) * (e.fx || 1) * (t > i ? o + s * (t - i) : o);
|
|
2382
2396
|
}
|
|
2383
2397
|
function dn(t, e) {
|
|
2384
2398
|
const i = N / 2, n = new Uint16Array(i * ae);
|
|
@@ -2392,7 +2406,7 @@ function Ns(t, e, i) {
|
|
|
2392
2406
|
for (let s = 0; s < N; s += 1)
|
|
2393
2407
|
(s === e[r] || s === i[r]) && (o = !o), n[r * N + s] = o ? 255 : 0;
|
|
2394
2408
|
}
|
|
2395
|
-
return
|
|
2409
|
+
return Nn(n, !1);
|
|
2396
2410
|
}
|
|
2397
2411
|
function Os(t, e, i) {
|
|
2398
2412
|
const n = new Uint8Array(N * ae), r = N / 4, o = ae / 8;
|
|
@@ -2410,9 +2424,9 @@ function Os(t, e, i) {
|
|
|
2410
2424
|
n[s * N + f] = (y ? u : !u) ? 255 : 0;
|
|
2411
2425
|
}
|
|
2412
2426
|
}
|
|
2413
|
-
return
|
|
2427
|
+
return Nn(n, !0);
|
|
2414
2428
|
}
|
|
2415
|
-
function
|
|
2429
|
+
function Nn(t, e) {
|
|
2416
2430
|
const i = t.slice();
|
|
2417
2431
|
for (let n = 0; n < ae; n += 1)
|
|
2418
2432
|
for (let r = 0; r < N; r += 1) {
|
|
@@ -2442,18 +2456,18 @@ function Ze(t) {
|
|
|
2442
2456
|
function ve(t) {
|
|
2443
2457
|
return [Number((t == null ? void 0 : t[0]) ?? 0), Number((t == null ? void 0 : t[1]) ?? 0)];
|
|
2444
2458
|
}
|
|
2445
|
-
function
|
|
2459
|
+
function Mt(t) {
|
|
2446
2460
|
return [0, 1, 2, 3].map((e) => Number((t == null ? void 0 : t[e]) ?? 0));
|
|
2447
2461
|
}
|
|
2448
2462
|
function dt(t) {
|
|
2449
2463
|
const e = t.extrinsicQuaternion;
|
|
2450
2464
|
return (e == null ? void 0 : e.length) === 4 && e.every(Number.isFinite) ? e : [1, 0, 0, 0];
|
|
2451
2465
|
}
|
|
2452
|
-
function
|
|
2466
|
+
function Ws(t) {
|
|
2453
2467
|
const e = t.samples.at(-1);
|
|
2454
2468
|
return e && t.timescale > 0 ? (e.pts + e.duration) / t.timescale : 0;
|
|
2455
2469
|
}
|
|
2456
|
-
function
|
|
2470
|
+
function Dt(t) {
|
|
2457
2471
|
const e = t.radialLut1, i = t.radialLut2;
|
|
2458
2472
|
if (!e || !i || e.length < 14 || i.length < 14 || !t.fx) return 1;
|
|
2459
2473
|
let n = 0;
|
|
@@ -2549,7 +2563,7 @@ function mn(t, e) {
|
|
|
2549
2563
|
}
|
|
2550
2564
|
return null;
|
|
2551
2565
|
}
|
|
2552
|
-
function
|
|
2566
|
+
function On(t) {
|
|
2553
2567
|
const e = { ...ee, ...t || {} };
|
|
2554
2568
|
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) {
|
|
2555
2569
|
const r = e.minFovDeg;
|
|
@@ -2582,11 +2596,11 @@ function Da(t, e) {
|
|
|
2582
2596
|
me(t && t[1], 0) / i
|
|
2583
2597
|
];
|
|
2584
2598
|
}
|
|
2585
|
-
function
|
|
2599
|
+
function Vn(t, e) {
|
|
2586
2600
|
const i = Math.abs(t[0] - e[0]), n = Math.abs(t[1] - e[1]);
|
|
2587
2601
|
return n > i ? [0.475, Math.max(1e-4, n * 0.475)] : [Math.max(1e-4, i * 0.475), 0.475];
|
|
2588
2602
|
}
|
|
2589
|
-
function
|
|
2603
|
+
function Nt(t, e) {
|
|
2590
2604
|
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);
|
|
2591
2605
|
return s <= 1e-6 ? e.slice() : [n / s, r / s, o / s];
|
|
2592
2606
|
}
|
|
@@ -2594,7 +2608,7 @@ function pn(t, e = [1, 0, 0, 0]) {
|
|
|
2594
2608
|
const i = Array.isArray(t) ? t : e, n = de(i, e, 4), r = Math.hypot(...n) || 1;
|
|
2595
2609
|
return n.map((o) => o / r);
|
|
2596
2610
|
}
|
|
2597
|
-
function
|
|
2611
|
+
function Gs(t, e) {
|
|
2598
2612
|
if (!t || typeof t != "object") return null;
|
|
2599
2613
|
const i = e === "left" ? [0.25, 0.5] : [0.75, 0.5], n = e === "left" ? [0.75, 0.5] : [0.25, 0.5], r = {
|
|
2600
2614
|
center: i,
|
|
@@ -2632,7 +2646,7 @@ function Ws(t, e) {
|
|
|
2632
2646
|
axis: [0, 0, 1],
|
|
2633
2647
|
right: [-1, 0, 0],
|
|
2634
2648
|
up: [0, 1, 0]
|
|
2635
|
-
}, 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 =
|
|
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 = qs(t.remap), u = String(t.textureOrigin ?? t.texture_origin ?? "").trim().toLowerCase(), f = Fa(t.imageSize ?? t.image_size, [0, 0]), y = fe(s.center, r.center), p = fe(a.center, o.center), m = Vn(y, p);
|
|
2636
2650
|
return {
|
|
2637
2651
|
textureOrigin: u === "top-left" || u === "bottom-left" ? u : "",
|
|
2638
2652
|
imageSize: f,
|
|
@@ -2656,9 +2670,9 @@ function Ws(t, e) {
|
|
|
2656
2670
|
distortionCoeffs: de(s.distortionCoeffs || s.distortion_coeffs, [], 13),
|
|
2657
2671
|
translationM: de(s.translationM, [0, 0, 0], 3),
|
|
2658
2672
|
asymmetric: de(s.asymmetric, r.asymmetric, 4),
|
|
2659
|
-
axis:
|
|
2660
|
-
right:
|
|
2661
|
-
up:
|
|
2673
|
+
axis: Nt(s.axis, r.axis),
|
|
2674
|
+
right: Nt(s.right, r.right),
|
|
2675
|
+
up: Nt(s.up, r.up)
|
|
2662
2676
|
},
|
|
2663
2677
|
back: {
|
|
2664
2678
|
center: p,
|
|
@@ -2680,9 +2694,9 @@ function Ws(t, e) {
|
|
|
2680
2694
|
distortionCoeffs: de(a.distortionCoeffs || a.distortion_coeffs, [], 13),
|
|
2681
2695
|
translationM: de(a.translationM, [0, 0, 0], 3),
|
|
2682
2696
|
asymmetric: de(a.asymmetric, o.asymmetric, 4),
|
|
2683
|
-
axis:
|
|
2684
|
-
right:
|
|
2685
|
-
up:
|
|
2697
|
+
axis: Nt(a.axis, o.axis),
|
|
2698
|
+
right: Nt(a.right, o.right),
|
|
2699
|
+
up: Nt(a.up, o.up)
|
|
2686
2700
|
},
|
|
2687
2701
|
pipeline: {
|
|
2688
2702
|
featherWidthPx: Math.max(0, Number(c.featherWidthPx) || 0),
|
|
@@ -2691,7 +2705,7 @@ function Ws(t, e) {
|
|
|
2691
2705
|
remap: l
|
|
2692
2706
|
};
|
|
2693
2707
|
}
|
|
2694
|
-
function
|
|
2708
|
+
function qs(t) {
|
|
2695
2709
|
if (!t || typeof t != "object") return null;
|
|
2696
2710
|
const e = Fa([t.width, t.height], [1, 1]), i = e[0], n = e[1], r = i * n * 4, o = mn(t.front, r), s = mn(t.back, r);
|
|
2697
2711
|
return !o || !s ? null : {
|
|
@@ -2767,7 +2781,7 @@ function Xi(t) {
|
|
|
2767
2781
|
height: Math.max(1, t.height || t.clientHeight || 1)
|
|
2768
2782
|
} : { width: 1, height: 1 };
|
|
2769
2783
|
}
|
|
2770
|
-
const z = 128, X = 64, Ua = 256,
|
|
2784
|
+
const z = 128, X = 64, Ua = 256, Be = new Int32Array(new Uint8Array([0, 0, 0, 255]).buffer)[0], Wn = /* @__PURE__ */ new WeakSet();
|
|
2771
2785
|
function vi(t, e) {
|
|
2772
2786
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
|
|
2773
2787
|
}
|
|
@@ -2777,7 +2791,7 @@ function Qs(t, e, i = 1) {
|
|
|
2777
2791
|
function gn(t) {
|
|
2778
2792
|
return Math.hypot(t[0], t[1], t[2]);
|
|
2779
2793
|
}
|
|
2780
|
-
function
|
|
2794
|
+
function Gn(t, e, i = !1) {
|
|
2781
2795
|
const n = (t - 0.5) * Math.PI * 2, r = (0.5 - e) * Math.PI, o = Math.cos(r);
|
|
2782
2796
|
return [
|
|
2783
2797
|
o * Math.sin(n),
|
|
@@ -2833,10 +2847,10 @@ function Js(t, e, i, n = !1) {
|
|
|
2833
2847
|
for (let u = 0; u < 2; u++) {
|
|
2834
2848
|
const { indices: f, taps: y, fractions: p } = e.sampling.lenses[u], m = i[u];
|
|
2835
2849
|
for (let d = 0; d < f.length; d++) {
|
|
2836
|
-
const h = 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[h] * D + r[g] * w,
|
|
2837
|
-
m[v] = T * F +
|
|
2838
|
-
const
|
|
2839
|
-
m[v + 1] =
|
|
2850
|
+
const h = 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[h] * D + r[g] * w, L = r[b] * D + r[x] * w;
|
|
2851
|
+
m[v] = T * F + L * S;
|
|
2852
|
+
const _ = r[h + 1] * D + r[g + 1] * w, k = r[b + 1] * D + r[x + 1] * w;
|
|
2853
|
+
m[v + 1] = _ * F + k * S;
|
|
2840
2854
|
const P = r[h + 2] * D + r[g + 2] * w, E = r[b + 2] * D + r[x + 2] * w;
|
|
2841
2855
|
m[v + 2] = P * F + E * S;
|
|
2842
2856
|
}
|
|
@@ -2858,7 +2872,7 @@ function Zs(t, e) {
|
|
|
2858
2872
|
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;
|
|
2859
2873
|
return [i * (r * s + o * c) / l, (r * i * a - n * c) / l];
|
|
2860
2874
|
}
|
|
2861
|
-
function
|
|
2875
|
+
function St(t, e, i, n, r, o, s = 0) {
|
|
2862
2876
|
var p;
|
|
2863
2877
|
const a = n && Array.isArray(e.rotationQuat) ? (() => {
|
|
2864
2878
|
const m = za(
|
|
@@ -2909,10 +2923,10 @@ function Dt(t, e, i, n, r, o, s = 0) {
|
|
|
2909
2923
|
];
|
|
2910
2924
|
}
|
|
2911
2925
|
} else {
|
|
2912
|
-
const m = Qs(t, e.axis, c), d = gn(m), h = d > 1e-5 ? [vi(m, e.right) / d, -vi(m, 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 * h[0], w = x * h[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),
|
|
2926
|
+
const m = Qs(t, e.axis, c), d = gn(m), h = d > 1e-5 ? [vi(m, e.right) / d, -vi(m, 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 * h[0], w = x * h[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 || Da(e.scale, i), E = e.principalOffset || [0, 0];
|
|
2913
2927
|
u = [
|
|
2914
|
-
e.center[0] + E[0] + P[0] * (v + T +
|
|
2915
|
-
e.center[1] + E[1] + P[1] * (w +
|
|
2928
|
+
e.center[0] + E[0] + P[0] * (v + T + _),
|
|
2929
|
+
e.center[1] + E[1] + P[1] * (w + L + k)
|
|
2916
2930
|
];
|
|
2917
2931
|
}
|
|
2918
2932
|
if (!Number.isFinite(u[0]) || !Number.isFinite(u[1])) return null;
|
|
@@ -2926,7 +2940,7 @@ function ec(t, e, i) {
|
|
|
2926
2940
|
e * o + (n + 2 * e * e) * a + 2 * t * e * s + i[10] * n + i[12] * r
|
|
2927
2941
|
];
|
|
2928
2942
|
}
|
|
2929
|
-
function
|
|
2943
|
+
function qn(t, e, i, n = 2, r = null) {
|
|
2930
2944
|
var p, m;
|
|
2931
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 = ((m = r == null ? void 0 : r.parents) == null ? void 0 : m.length) === o ? r.parents : new Int16Array(o);
|
|
2932
2946
|
r && (r.dp = s, r.parents = a);
|
|
@@ -3230,98 +3244,98 @@ function dc(t, e, i = null, n = null) {
|
|
|
3230
3244
|
if (b)
|
|
3231
3245
|
x = y[p] = { width: h };
|
|
3232
3246
|
else {
|
|
3233
|
-
const F = Uint32Array.from({ length: 1024 }, (k, P) => Math.floor(P * h / 1024)), T = new Uint32Array(g.length),
|
|
3247
|
+
const F = Uint32Array.from({ length: 1024 }, (k, P) => Math.floor(P * h / 1024)), T = new Uint32Array(g.length), L = new Uint32Array(512), _ = new Uint32Array(512);
|
|
3234
3248
|
for (let k = 0; k < 512; k++) {
|
|
3235
3249
|
const P = F[k * 2 + 1] - F[k * 2];
|
|
3236
|
-
|
|
3250
|
+
L[k] = P, _[k] = P * h;
|
|
3237
3251
|
}
|
|
3238
3252
|
for (let k = 0; k < g.length; k++) {
|
|
3239
3253
|
const P = g[k] >>> 2, E = P & 511, j = P >>> 10;
|
|
3240
3254
|
T[k] = F[j * 2] * h + F[E * 2];
|
|
3241
3255
|
}
|
|
3242
|
-
x = y[p] = { width: h, origins: T, columns:
|
|
3256
|
+
x = y[p] = { width: h, origins: T, columns: L, rows: _ };
|
|
3243
3257
|
}
|
|
3244
3258
|
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;
|
|
3245
3259
|
if (D) {
|
|
3246
3260
|
if (b) {
|
|
3247
3261
|
if (n) for (let F = 0; F < 512; F += 2) {
|
|
3248
3262
|
const T = F * 2048 + 1024;
|
|
3249
|
-
for (let
|
|
3250
|
-
const k = D[
|
|
3251
|
-
if ((k & P & E & j &
|
|
3252
|
-
const
|
|
3253
|
-
l[
|
|
3254
|
-
const te = D[
|
|
3255
|
-
if ((te & ne & ue & J &
|
|
3256
|
-
const Z = ((te & 4244438268) >>> 2) + ((ne & 4244438268) >>> 2) + ((ue & 4244438268) >>> 2) + ((J & 4244438268) >>> 2),
|
|
3257
|
-
l[
|
|
3263
|
+
for (let L = F * 2048, _ = F * 1024 + p * 512; L < T; L += 8, _ += 4) {
|
|
3264
|
+
const k = D[L], P = D[L + 1], E = D[L + 1024], j = D[L + 1025];
|
|
3265
|
+
if ((k & P & E & j & Be) !== Be) return null;
|
|
3266
|
+
const G = ((k & 4244438268) >>> 2) + ((P & 4244438268) >>> 2) + ((E & 4244438268) >>> 2) + ((j & 4244438268) >>> 2), q = (k & 50529027) + (P & 50529027) + (E & 50529027) + (j & 50529027) + f >>> 2 & 50529027;
|
|
3267
|
+
l[_] = G + q;
|
|
3268
|
+
const te = D[L + 4], ne = D[L + 5], ue = D[L + 1028], J = D[L + 1029];
|
|
3269
|
+
if ((te & ne & ue & J & Be) !== Be) return null;
|
|
3270
|
+
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;
|
|
3271
|
+
l[_ + 2] = Z + Tt;
|
|
3258
3272
|
}
|
|
3259
3273
|
}
|
|
3260
3274
|
for (let F = n ? 65536 : 0; F < g.length; F++) {
|
|
3261
|
-
const T = g[F] >>> 2,
|
|
3262
|
-
if ((k & P & E & j &
|
|
3263
|
-
const
|
|
3264
|
-
l[T] =
|
|
3275
|
+
const T = g[F] >>> 2, L = (T & -513) * 2, _ = L + 1, k = D[L], P = D[_], E = D[L + 1024], j = D[_ + 1024];
|
|
3276
|
+
if ((k & P & E & j & Be) !== Be) return null;
|
|
3277
|
+
const G = ((k & 4244438268) >>> 2) + ((P & 4244438268) >>> 2) + ((E & 4244438268) >>> 2) + ((j & 4244438268) >>> 2), q = (k & 50529027) + (P & 50529027) + (E & 50529027) + (j & 50529027) + f >>> 2 & 50529027;
|
|
3278
|
+
l[T] = G + q;
|
|
3265
3279
|
}
|
|
3266
3280
|
continue;
|
|
3267
3281
|
}
|
|
3268
3282
|
if (h % 512 === 0) {
|
|
3269
3283
|
const F = Math.floor(h / 1024), T = F * h;
|
|
3270
|
-
for (let
|
|
3271
|
-
const
|
|
3272
|
-
if ((E & j &
|
|
3273
|
-
const te = (E & 16711935) + (j & 16711935) + (
|
|
3274
|
-
l[
|
|
3284
|
+
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], G = D[k + T], q = D[P + T];
|
|
3286
|
+
if ((E & j & G & q & Be) !== Be) return null;
|
|
3287
|
+
const te = (E & 16711935) + (j & 16711935) + (G & 16711935) + (q & 16711935) + u, ne = (E >>> 8 & 16711935) + (j >>> 8 & 16711935) + (G >>> 8 & 16711935) + (q >>> 8 & 16711935) + u;
|
|
3288
|
+
l[_] = te >>> 2 & 16711935 | (ne >>> 2 & 16711935) << 8;
|
|
3275
3289
|
}
|
|
3276
3290
|
continue;
|
|
3277
3291
|
}
|
|
3278
3292
|
for (let F = 0; F < g.length; F++) {
|
|
3279
|
-
const T = g[F] >>> 2,
|
|
3280
|
-
if ((P & E & j &
|
|
3281
|
-
const
|
|
3282
|
-
l[T] =
|
|
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], G = D[_ + k];
|
|
3294
|
+
if ((P & E & j & G & Be) !== Be) return null;
|
|
3295
|
+
const q = (P & 16711935) + (E & 16711935) + (j & 16711935) + (G & 16711935) + u, te = (P >>> 8 & 16711935) + (E >>> 8 & 16711935) + (j >>> 8 & 16711935) + (G >>> 8 & 16711935) + u;
|
|
3296
|
+
l[T] = q >>> 2 & 16711935 | (te >>> 2 & 16711935) << 8;
|
|
3283
3297
|
}
|
|
3284
3298
|
continue;
|
|
3285
3299
|
}
|
|
3286
3300
|
for (let F = 0; F < g.length; F++) {
|
|
3287
|
-
const T = g[F],
|
|
3288
|
-
if ((d[
|
|
3289
|
-
for (let
|
|
3290
|
-
c[T +
|
|
3301
|
+
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
|
+
if ((d[_ + 3] & d[k + 3] & d[E + 3] & d[j + 3]) !== 255) return null;
|
|
3303
|
+
for (let G = 0; G < 3; G++)
|
|
3304
|
+
c[T + G] = d[_ + G] + d[k + G] + d[E + G] + d[j + G] + r >> 2;
|
|
3291
3305
|
c[T + 3] = 255;
|
|
3292
3306
|
}
|
|
3293
3307
|
}
|
|
3294
3308
|
return { pixels: c, width: 1024, height: 512 };
|
|
3295
3309
|
}
|
|
3296
|
-
function
|
|
3310
|
+
function qt(t, e = Ua, i = null) {
|
|
3297
3311
|
var u, f, y;
|
|
3298
3312
|
const n = Xi(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 }));
|
|
3299
3313
|
a.width !== o && (a.width = o), a.height !== s && (a.height = s);
|
|
3300
3314
|
const c = ((f = i == null ? void 0 : i.readback) == null ? void 0 : f.context) || a.getContext("2d", { willReadFrequently: !0 });
|
|
3301
3315
|
if (!c) return null;
|
|
3302
3316
|
i && (i.readback = { surface: a, context: c }), (y = c.clearRect) == null || y.call(c, 0, 0, o, s);
|
|
3303
|
-
const l =
|
|
3317
|
+
const l = Wn.has(t);
|
|
3304
3318
|
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 };
|
|
3305
3319
|
}
|
|
3306
|
-
function
|
|
3320
|
+
function Xn(t, e) {
|
|
3307
3321
|
const { width: i, height: n } = t;
|
|
3308
3322
|
if (e.width !== i || e.height !== n) return null;
|
|
3309
3323
|
const r = 3, o = 49, s = 64, a = 6, c = (g) => {
|
|
3310
3324
|
const b = i + 1, x = new Float64Array(b * (n + 1)), v = new Float64Array(x.length), w = new Uint32Array(x.length);
|
|
3311
3325
|
for (let F = 0; F < n; F += 1) {
|
|
3312
|
-
let T = 0,
|
|
3326
|
+
let T = 0, L = 0, _ = 0;
|
|
3313
3327
|
for (let k = 0; k < i; k += 1) {
|
|
3314
3328
|
const P = F * i + k, E = (F + 1) * b + k + 1, j = g.gray[P];
|
|
3315
|
-
T += j,
|
|
3329
|
+
T += j, L += j * j, _ += g.valid[P], x[E] = x[E - b] + T, v[E] = v[E - b] + L, w[E] = w[E - b] + _;
|
|
3316
3330
|
}
|
|
3317
3331
|
}
|
|
3318
3332
|
const S = new Float32Array(i * n), D = new Float32Array(S.length);
|
|
3319
3333
|
for (let F = r; F < n - r; F += 1)
|
|
3320
3334
|
for (let T = r; T < i - r; T += 1) {
|
|
3321
|
-
const
|
|
3322
|
-
if (w[E] - w[k] - w[P] + w[
|
|
3323
|
-
const j = x[E] - x[k] - x[P] + x[
|
|
3324
|
-
S[
|
|
3335
|
+
const L = F * i + T, _ = (F - r) * b + T - r, k = (F - r) * b + T + r + 1, P = (F + r + 1) * b + T - r, E = (F + r + 1) * b + T + r + 1;
|
|
3336
|
+
if (w[E] - w[k] - w[P] + w[_] !== o) continue;
|
|
3337
|
+
const j = x[E] - x[k] - x[P] + x[_];
|
|
3338
|
+
S[L] = j / o, D[L] = Math.max(0, v[E] - v[k] - v[P] + v[_] - j * j / o);
|
|
3325
3339
|
}
|
|
3326
3340
|
return { means: S, energies: D };
|
|
3327
3341
|
}, l = c(t), u = c(e), f = [];
|
|
@@ -3332,8 +3346,8 @@ function Gn(t, e) {
|
|
|
3332
3346
|
let v = 0, w = 0, S = 0;
|
|
3333
3347
|
for (let F = -1; F <= 1; F += 1)
|
|
3334
3348
|
for (let T = -1; T <= 1; T += 1) {
|
|
3335
|
-
const
|
|
3336
|
-
v +=
|
|
3349
|
+
const L = x + F * i + T, _ = t.gray[L + 1] - t.gray[L - 1], k = t.gray[L + i] - t.gray[L - i];
|
|
3350
|
+
v += _ * _, w += _ * k, S += k * k;
|
|
3337
3351
|
}
|
|
3338
3352
|
const D = (v + S - Math.hypot(v - S, 2 * w)) / 2;
|
|
3339
3353
|
D > 1 && f.push({ x: b, y: g, score: D });
|
|
@@ -3352,10 +3366,10 @@ function Gn(t, e) {
|
|
|
3352
3366
|
const w = (k, P) => {
|
|
3353
3367
|
const E = (b + P) * i + g + k;
|
|
3354
3368
|
if (u.energies[E] < o * 9) return -1;
|
|
3355
|
-
let j = 0,
|
|
3356
|
-
for (let
|
|
3369
|
+
let j = 0, G = 0;
|
|
3370
|
+
for (let q = -r; q <= r; q += 1)
|
|
3357
3371
|
for (let te = -r; te <= r; te += 1)
|
|
3358
|
-
j += v[
|
|
3372
|
+
j += v[G++] * e.gray[E + q * i + te];
|
|
3359
3373
|
return j / Math.sqrt(l.energies[x] * u.energies[E]);
|
|
3360
3374
|
}, S = new Float32Array(m * (a * 2 + 1));
|
|
3361
3375
|
let D = -1, F = 0, T = 0;
|
|
@@ -3365,15 +3379,15 @@ function Gn(t, e) {
|
|
|
3365
3379
|
S[(k + a) * m + P + s] = E, E > D && (D = E, F = P, T = k);
|
|
3366
3380
|
}
|
|
3367
3381
|
if (D < 0.85 || Math.abs(F) === s || Math.abs(T) === a) continue;
|
|
3368
|
-
let
|
|
3382
|
+
let L = -1;
|
|
3369
3383
|
for (let k = -a; k <= a; k += 1)
|
|
3370
3384
|
for (let P = -s; P <= s; P += 1)
|
|
3371
|
-
Math.abs(P - F) <= 3 && Math.abs(k - T) <= 2 || (
|
|
3372
|
-
if (D -
|
|
3373
|
-
const
|
|
3385
|
+
Math.abs(P - F) <= 3 && Math.abs(k - T) <= 2 || (L = Math.max(L, S[(k + a) * m + P + s]));
|
|
3386
|
+
if (D - L < 0.015) continue;
|
|
3387
|
+
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;
|
|
3374
3388
|
p.push({
|
|
3375
|
-
dx: F +
|
|
3376
|
-
dy: T +
|
|
3389
|
+
dx: F + _(w(F - 1, T), D, w(F + 1, T)),
|
|
3390
|
+
dy: T + _(w(F, T - 1), D, w(F, T + 1)),
|
|
3377
3391
|
y: b,
|
|
3378
3392
|
gainRatio: u.means[(b + T) * i + g + F] / Math.max(1, l.means[x])
|
|
3379
3393
|
});
|
|
@@ -3392,7 +3406,7 @@ function Gn(t, e) {
|
|
|
3392
3406
|
inliers: d.length
|
|
3393
3407
|
};
|
|
3394
3408
|
}
|
|
3395
|
-
function
|
|
3409
|
+
function Vt(t) {
|
|
3396
3410
|
const [e, i] = t.center, n = e < 0.5 ? 0 : 0.5;
|
|
3397
3411
|
return [Math.min(0.25, e - n, n + 0.5 - e), Math.min(0.5, i, 1 - i)];
|
|
3398
3412
|
}
|
|
@@ -3405,7 +3419,7 @@ function Ea(t, e, i, n) {
|
|
|
3405
3419
|
for (let p = 0; p < 193; p += 1) {
|
|
3406
3420
|
const m = (c - 12 + p * 0.125) * Math.PI / 180, d = [Math.cos(y) * Math.sin(m), Math.sin(y), Math.cos(y) * Math.cos(m)];
|
|
3407
3421
|
for (let h = 0; h < 2; h += 1) {
|
|
3408
|
-
const g = i[h], b =
|
|
3422
|
+
const g = i[h], b = St(
|
|
3409
3423
|
d,
|
|
3410
3424
|
g,
|
|
3411
3425
|
Math.PI,
|
|
@@ -3423,32 +3437,32 @@ function Ea(t, e, i, n) {
|
|
|
3423
3437
|
}
|
|
3424
3438
|
}
|
|
3425
3439
|
}
|
|
3426
|
-
const u =
|
|
3440
|
+
const u = Xn(...l);
|
|
3427
3441
|
if (!u) return null;
|
|
3428
3442
|
s.push(u.dx * 0.125 * Math.PI / 180, u.dy * 0.5 * Math.PI / 180), a.push(u.gainRatio);
|
|
3429
3443
|
}
|
|
3430
3444
|
return { offsets: s, ratios: a };
|
|
3431
3445
|
}
|
|
3432
3446
|
function fc(t, e, i, n) {
|
|
3433
|
-
const r =
|
|
3447
|
+
const r = qt(t, 2048);
|
|
3434
3448
|
if (!r) return null;
|
|
3435
3449
|
if (r.pixels[3] === 0) return;
|
|
3436
|
-
const o = n.map((f) => ({ ...f, validRadius:
|
|
3450
|
+
const o = n.map((f) => ({ ...f, validRadius: Vt(f) })), s = Ea(r, e, o, i.textureOrigin);
|
|
3437
3451
|
if (!s) return null;
|
|
3438
3452
|
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) => {
|
|
3439
|
-
const y =
|
|
3453
|
+
const y = $n(r, o, i.textureOrigin, f, e, a);
|
|
3440
3454
|
return y > 0 ? 1 / y : 0;
|
|
3441
3455
|
});
|
|
3442
3456
|
return { offsets: a, polarInverseDepth: u, gain: e.dualFisheyeAutoGain ? [l, 1 / l] : [e.dualFisheyeGainFront, e.dualFisheyeGainBack] };
|
|
3443
3457
|
}
|
|
3444
3458
|
function hc(t, e, i, n) {
|
|
3445
|
-
const r =
|
|
3459
|
+
const r = qt(t, 2048);
|
|
3446
3460
|
if (!r) return null;
|
|
3447
3461
|
if (r.pixels[3] !== 0)
|
|
3448
3462
|
return mc(r, e, i, n);
|
|
3449
3463
|
}
|
|
3450
3464
|
function mc(t, e, i, n) {
|
|
3451
|
-
const r = n.map((l) => ({ ...l, validRadius:
|
|
3465
|
+
const r = n.map((l) => ({ ...l, validRadius: Vt(l) })), o = Yn(t, r, e, i.textureOrigin, Math.PI), s = r.map((l) => ({ ...l, focal: l.focal.map((u) => u * o) })), a = Ea(t, e, s, i.textureOrigin);
|
|
3452
3466
|
if (!a) return null;
|
|
3453
3467
|
const c = e.dualFisheyeAutoGain ? Ia(
|
|
3454
3468
|
t,
|
|
@@ -3466,12 +3480,12 @@ function mc(t, e, i, n) {
|
|
|
3466
3480
|
gain: (c == null ? void 0 : c.gain) || [e.dualFisheyeGainFront, e.dualFisheyeGainBack]
|
|
3467
3481
|
};
|
|
3468
3482
|
}
|
|
3469
|
-
function
|
|
3483
|
+
function $n(t, e, i, n = 0, r = {}, o = null) {
|
|
3470
3484
|
if (e.reduce((m, d) => m + (d.translationM || []).reduce((h, g) => h + g * g, 0), 0) < 1e-8) return 0;
|
|
3471
3485
|
const a = (m, d) => {
|
|
3472
3486
|
const h = [];
|
|
3473
3487
|
for (let g = 0; g < e.length; g += 1) {
|
|
3474
|
-
const b = e[g], x = g === 1 && o ? Qi(m, o) : m, v =
|
|
3488
|
+
const b = e[g], x = g === 1 && o ? Qi(m, o) : m, v = St(x, b, Math.PI, !0, !1, 1, d > 0 ? 1 / d : 0);
|
|
3475
3489
|
if (!v) return null;
|
|
3476
3490
|
r.dualFisheyeFlipX && (v.uv[0] = 2 * b.center[0] - v.uv[0]), r.dualFisheyeFlipY && (v.uv[1] = 2 * b.center[1] - v.uv[1]);
|
|
3477
3491
|
const w = [0, 0, 0];
|
|
@@ -3554,7 +3568,7 @@ function yc(t, e, i, n) {
|
|
|
3554
3568
|
const g = (2 * h / (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);
|
|
3555
3569
|
for (let w = 0; w < 3; w += 1) x[w] /= v;
|
|
3556
3570
|
for (let w = 0; w < 2; w += 1) {
|
|
3557
|
-
const S = e[w], D =
|
|
3571
|
+
const S = e[w], D = St(x, S, Math.PI, !0, !1, 1);
|
|
3558
3572
|
if (!D) continue;
|
|
3559
3573
|
i.dualFisheyeFlipX && (D.uv[0] = 2 * S.center[0] - D.uv[0]), i.dualFisheyeFlipY && (D.uv[1] = 2 * S.center[1] - D.uv[1]);
|
|
3560
3574
|
const F = [0, 0, 0];
|
|
@@ -3563,17 +3577,17 @@ function yc(t, e, i, n) {
|
|
|
3563
3577
|
y[w].gray[T] = F[0] * 0.2126 + F[1] * 0.7152 + F[2] * 0.0722, y[w].valid[T] = 1;
|
|
3564
3578
|
}
|
|
3565
3579
|
}
|
|
3566
|
-
const p =
|
|
3580
|
+
const p = Xn(...y);
|
|
3567
3581
|
if (!p || Math.abs(p.dy) > 1.5) return 0;
|
|
3568
3582
|
const m = p.dx * 2 * u / (c - 1) / s;
|
|
3569
3583
|
return m >= 0.05 && m <= 4 ? m : 0;
|
|
3570
3584
|
});
|
|
3571
3585
|
}
|
|
3572
|
-
function
|
|
3586
|
+
function Yn(t, e, i, n, r) {
|
|
3573
3587
|
const o = Array.from({ length: 13 }, (p, m) => 0.97 + m * 5e-3), s = o.map((p) => e.map((m) => ({ ...m, focal: m.focal.map((d) => d * p) }))), a = (p, m, d) => {
|
|
3574
3588
|
const h = [];
|
|
3575
3589
|
for (const g of m) {
|
|
3576
|
-
const b =
|
|
3590
|
+
const b = St(
|
|
3577
3591
|
p,
|
|
3578
3592
|
g,
|
|
3579
3593
|
r,
|
|
@@ -3593,7 +3607,7 @@ function $n(t, e, i, n, r) {
|
|
|
3593
3607
|
const m = [];
|
|
3594
3608
|
for (let d = -60; d <= 60; d += 4)
|
|
3595
3609
|
for (let h = -2; h <= 2; h += 0.5) {
|
|
3596
|
-
const g =
|
|
3610
|
+
const g = Gn(
|
|
3597
3611
|
(p + h) / 360 + 0.5,
|
|
3598
3612
|
0.5 - d / 180,
|
|
3599
3613
|
e.some((b) => b.projectionModel === "dji_fisheye_lut")
|
|
@@ -3624,17 +3638,17 @@ function gc(t, e, i, n, r, o, s) {
|
|
|
3624
3638
|
}), c = !!(e.dualFisheyeRefineFocal && i && !n && [r, o].every((S) => {
|
|
3625
3639
|
var D;
|
|
3626
3640
|
return (S.projectionModel || "equidistant") === "equidistant" && ((D = S.focal) == null ? void 0 : D.every((F) => F > 0));
|
|
3627
|
-
})), l =
|
|
3641
|
+
})), l = qt(t, a || c ? 1024 : Ua);
|
|
3628
3642
|
if (!l) return null;
|
|
3629
|
-
let u = c ?
|
|
3643
|
+
let u = c ? Yn(l, [r, o], e, i.textureOrigin, s) : 1;
|
|
3630
3644
|
if (u !== 1) {
|
|
3631
3645
|
const S = { ...r, focal: r.focal.map((F) => F * u) }, D = { ...o, focal: o.focal.map((F) => F * u) };
|
|
3632
3646
|
vc(e, i, S, D, s) ? (r = S, o = D) : u = 1;
|
|
3633
3647
|
}
|
|
3634
|
-
const f = a ?
|
|
3648
|
+
const f = a ? $n(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) => {
|
|
3635
3649
|
var D;
|
|
3636
3650
|
return (D = S.translationM) == null ? void 0 : D.some((F) => Math.abs(F) > 1e-3);
|
|
3637
|
-
}) ?
|
|
3651
|
+
}) ? qt(t, 1024) : null, m = p ? yc(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)), h = d ? qt(t, 2048) : null, g = h ? ((w = Ea(h, e, [r, o], i.textureOrigin)) == null ? void 0 : w.offsets) || [0, 0, 0, 0] : [0, 0, 0, 0], b = Ia(
|
|
3638
3652
|
l,
|
|
3639
3653
|
e,
|
|
3640
3654
|
i,
|
|
@@ -3662,11 +3676,11 @@ function vc(t, e, i, n, r) {
|
|
|
3662
3676
|
const y = u * z + l + f;
|
|
3663
3677
|
a[u * s + f] = o[0][y] > 0 && o[1][y] > 0 ? 1 : 65535;
|
|
3664
3678
|
}
|
|
3665
|
-
if (!
|
|
3679
|
+
if (!qn(a, s, X, 2, c)) return !1;
|
|
3666
3680
|
}
|
|
3667
3681
|
return !0;
|
|
3668
3682
|
}
|
|
3669
|
-
function
|
|
3683
|
+
function Qn(t) {
|
|
3670
3684
|
const e = z * X, i = new Uint8Array(e);
|
|
3671
3685
|
for (let o = 0; o < e; o++)
|
|
3672
3686
|
t[0][o] <= 0 || t[1][o] <= 0 || (i[o] = 1, o % z && (i[o - 1] = 1), o >= z && (i[o - z] = 1));
|
|
@@ -3696,29 +3710,29 @@ function Ca(t, e, i, n, r, o, { convergenceM: s, polarInverseDepth: a, registrat
|
|
|
3696
3710
|
]) : null;
|
|
3697
3711
|
if (f && u.key === f) return u.map;
|
|
3698
3712
|
const y = z * X, p = [new Float64Array(y * 2), new Float64Array(y * 2)], m = [new Float32Array(y), new Float32Array(y)], d = [n, r], h = d.map((T) => T.projectionModel === "mei_extended"), g = d.map((T) => T.projectionModel === "dji_fisheye_lut"), b = h.some(Boolean) || g.some(Boolean);
|
|
3699
|
-
for (let T = 0; T < X; T++) for (let
|
|
3700
|
-
const
|
|
3701
|
-
t.equirectFlipX && (
|
|
3702
|
-
const k = Hs(
|
|
3703
|
-
for (let
|
|
3704
|
-
const te =
|
|
3713
|
+
for (let T = 0; T < X; T++) for (let L = 0; L < z; L++) {
|
|
3714
|
+
const _ = Gn((L + 0.5) / z, (T + 0.5) / X, b);
|
|
3715
|
+
t.equirectFlipX && (_[0] = -_[0]), t.equirectFlipY && (_[1] = -_[1]);
|
|
3716
|
+
const k = Hs(_, b), P = O(Math.floor(k[0] * z), 0, z - 1), j = O(Math.floor(k[1] * X), 0, X - 1) * z + P, G = Ks(i, k[0], k[1]);
|
|
3717
|
+
for (let q = 0; q < 2; q++) {
|
|
3718
|
+
const te = q === 1 && c ? Qi(_, c) : _, ne = d[q], ue = G ? G[q].valid ? { uv: G[q].uv, confidence: G[q].confidence } : null : St(
|
|
3705
3719
|
te,
|
|
3706
3720
|
ne,
|
|
3707
3721
|
o,
|
|
3708
|
-
h[
|
|
3709
|
-
g[
|
|
3710
|
-
|
|
3722
|
+
h[q],
|
|
3723
|
+
g[q],
|
|
3724
|
+
q === 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,
|
|
3711
3725
|
pc(te, s, a, !!l)
|
|
3712
3726
|
);
|
|
3713
3727
|
if (!ue) continue;
|
|
3714
3728
|
let [J, Z] = ue.uv;
|
|
3715
|
-
t.dualFisheyeFlipX && (J = 2 * ne.center[0] - J), t.dualFisheyeFlipY && (Z = 2 * ne.center[1] - Z), p[
|
|
3729
|
+
t.dualFisheyeFlipX && (J = 2 * ne.center[0] - J), t.dualFisheyeFlipY && (Z = 2 * ne.center[1] - Z), p[q][j * 2] = J, p[q][j * 2 + 1] = (e == null ? void 0 : e.textureOrigin) === "bottom-left" ? 1 - Z : Z, m[q][j] = ue.confidence;
|
|
3716
3730
|
}
|
|
3717
3731
|
}
|
|
3718
3732
|
let x = 0;
|
|
3719
3733
|
for (let T = 0; T < y; T++)
|
|
3720
3734
|
m[0][T] > 0 && m[1][T] > 0 && x++;
|
|
3721
|
-
const v = { uv: p, weights: m, overlapCount: x, gradientIndices:
|
|
3735
|
+
const v = { uv: p, weights: m, overlapCount: x, gradientIndices: Qn(m) };
|
|
3722
3736
|
return f && (u.key = f, u.map = v), v;
|
|
3723
3737
|
}
|
|
3724
3738
|
function Ia(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 } = {}) {
|
|
@@ -3750,34 +3764,34 @@ function Ia(t, e, i, n, r, o, s, { convergenceM: a = 0, polarInverseDepth: c = [
|
|
|
3750
3764
|
if (x < 64) return null;
|
|
3751
3765
|
let D = e.dualFisheyeGainFront, F = e.dualFisheyeGainBack;
|
|
3752
3766
|
b && v > x && w > x && (D = Math.sqrt(O(w / v, 0.64, 1.5625)), F = 1 / D);
|
|
3753
|
-
const T = [new Float32Array(g.length), new Float32Array(g.length)],
|
|
3767
|
+
const T = [new Float32Array(g.length), new Float32Array(g.length)], L = d.gradientIndices || Qn(h), _ = new Float64Array(z);
|
|
3754
3768
|
let k = 0;
|
|
3755
|
-
for (let ce = 0; ce <
|
|
3756
|
-
const $ =
|
|
3757
|
-
if (k = it,
|
|
3758
|
-
const ki = (Math.abs(re - tt) + Math.abs(
|
|
3759
|
-
T[0][$] =
|
|
3769
|
+
for (let ce = 0; ce < L.length; ce++) {
|
|
3770
|
+
const $ = L[ce], xe = $ % z, pe = $ * 3, re = m[0][pe] * D, Te = m[0][pe + 1] * D, et = m[0][pe + 2] * D, tt = m[1][pe] * F, Qt = m[1][pe + 1] * F, Ht = m[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, Si = xe > 0 ? k : it, Ti = $ >= z ? _[xe] : it;
|
|
3771
|
+
if (k = it, _[xe] = it, h[0][$] <= 0 || h[1][$] <= 0) continue;
|
|
3772
|
+
const ki = (Math.abs(re - tt) + Math.abs(Te - Qt) + Math.abs(et - Ht)) / 3;
|
|
3773
|
+
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);
|
|
3760
3774
|
const at = Math.abs(it) + Math.abs(Si) + Math.abs(Ti), Ri = 128 * (1 - 2 * Math.min(h[0][$], h[1][$]) / Math.max(1e-4, h[0][$] + h[1][$]));
|
|
3761
3775
|
g[$] = Math.min(65534, ki + at * 0.35 + Ri);
|
|
3762
3776
|
}
|
|
3763
|
-
const P = z / 2, E = new Float64Array(P * X), j = new Float64Array(P + 1),
|
|
3777
|
+
const P = z / 2, E = new Float64Array(P * X), j = new Float64Array(P + 1), G = new Float64Array(P + 1), q = {}, te = (ce) => {
|
|
3764
3778
|
for (let $ = 0; $ < X; $ += 1) {
|
|
3765
3779
|
const xe = $ * z, pe = h[1][xe] > h[0][xe] != ce > 0;
|
|
3766
3780
|
for (let re = 0; re < P; re += 1) {
|
|
3767
|
-
const
|
|
3768
|
-
j[re + 1] = j[re] + (pe ? tt : et),
|
|
3781
|
+
const Te = xe + ce + re, et = T[0][Te], tt = T[1][Te];
|
|
3782
|
+
j[re + 1] = j[re] + (pe ? tt : et), G[re + 1] = G[re] + (pe ? et : tt);
|
|
3769
3783
|
}
|
|
3770
3784
|
for (let re = 0; re < P; re += 1) {
|
|
3771
|
-
const
|
|
3772
|
-
E[$ * P + re] =
|
|
3785
|
+
const Te = g[xe + ce + re];
|
|
3786
|
+
E[$ * P + re] = Te >= 65535 ? 65535 : Math.min(65534, Te + j[re] + G[P] - G[re]);
|
|
3773
3787
|
}
|
|
3774
3788
|
}
|
|
3775
|
-
return
|
|
3789
|
+
return qn(E, P, X, 2, q);
|
|
3776
3790
|
}, ne = te(0), ue = te(P), J = ne && ue && ne.cost / X <= 180 && ue.cost / X <= 180 ? ic(h, ne.seam, ue.seam.map((ce) => ce + P)) : null;
|
|
3777
3791
|
let Z = ac(J, m, h, [D, F]);
|
|
3778
3792
|
Z && u && S.every(Boolean) && (Z = lc(Z, m, h, [D, F], y && !n ? d : null)), Z && p && (Z = xc(Z, m, h, [D, F], f));
|
|
3779
|
-
const
|
|
3780
|
-
return { mask: Z, strength:
|
|
3793
|
+
const Tt = Z && u && S.every(Boolean) ? rc(m, h, [D, F]) : null;
|
|
3794
|
+
return { mask: Z, strength: Tt, gain: [D, F] };
|
|
3781
3795
|
}
|
|
3782
3796
|
function Qi(t, e) {
|
|
3783
3797
|
const i = Math.asin(O(t[1], -1, 1));
|
|
@@ -3850,7 +3864,7 @@ function Fc(t, e, i, n, r, o, s) {
|
|
|
3850
3864
|
s.projections || (s.projections = {})
|
|
3851
3865
|
) : null;
|
|
3852
3866
|
let l = a && (s != null && s.softwareFrames) ? dc(s.softwareFrames, s.softwareReadback || (s.softwareReadback = {}), s.surface, c) : null;
|
|
3853
|
-
if (l || (s != null && s.softwareFrames && ((y = s.prepareSoftwareFallback) == null || y.call(s)), l =
|
|
3867
|
+
if (l || (s != null && s.softwareFrames && ((y = s.prepareSoftwareFallback) == null || y.call(s)), l = qt(t, a ? 1024 : Ua, s)), !l) return null;
|
|
3854
3868
|
if (l.pixels[3] === 0) return;
|
|
3855
3869
|
const u = s == null ? void 0 : s.surface;
|
|
3856
3870
|
if (u && !wc(l, u)) return { reused: !0 };
|
|
@@ -3875,8 +3889,8 @@ function Fc(t, e, i, n, r, o, s) {
|
|
|
3875
3889
|
);
|
|
3876
3890
|
return f != null && f.mask ? (s && (s.surface = l), { mask: f.mask, strength: f.strength }) : null;
|
|
3877
3891
|
}
|
|
3878
|
-
function
|
|
3879
|
-
var
|
|
3892
|
+
function Hn(t, e, i, n) {
|
|
3893
|
+
var Wr, Gr, qr;
|
|
3880
3894
|
const r = i.externalFrames === !0, o = e instanceof HTMLVideoElement, s = o || r, a = t.getContext("webgl", {
|
|
3881
3895
|
alpha: !1,
|
|
3882
3896
|
antialias: !s,
|
|
@@ -3886,8 +3900,8 @@ function Qn(t, e, i, n) {
|
|
|
3886
3900
|
});
|
|
3887
3901
|
if (!a)
|
|
3888
3902
|
throw new Error("WebGL unavailable");
|
|
3889
|
-
const c = n === "dual_fisheye" ?
|
|
3890
|
-
t.dataset.insta360MEIConvention = u ? "true" : "false", t.dataset.insta360ProjectionKind = n, t.dataset.insta360CalibrationFrontModel = ((
|
|
3903
|
+
const c = n === "dual_fisheye" ? Gs(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)));
|
|
3904
|
+
t.dataset.insta360MEIConvention = u ? "true" : "false", t.dataset.insta360ProjectionKind = n, t.dataset.insta360CalibrationFrontModel = ((Wr = c == null ? void 0 : c.front) == null ? void 0 : Wr.projectionModel) || "";
|
|
3891
3905
|
const f = `
|
|
3892
3906
|
attribute vec2 aClipPosition;
|
|
3893
3907
|
void main() {
|
|
@@ -4463,13 +4477,13 @@ function Qn(t, e, i, n) {
|
|
|
4463
4477
|
}
|
|
4464
4478
|
`, v = Ys(a, f, x);
|
|
4465
4479
|
a.useProgram(v);
|
|
4466
|
-
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"),
|
|
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"), G = a.getUniformLocation(v, "uDualFisheyeFrontValidRadius"), q = 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"), Si = a.getUniformLocation(v, "uDualFisheyeConvergenceM"), Ti = a.getUniformLocation(v, "uDualFisheyePolarInverseDepth"), ki = ["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}`))), Ri = a.getUniformLocation(v, "uDualFisheyeFrontRotationQuat"), Ba = a.getUniformLocation(v, "uDualFisheyeBackRotationQuat"), ja = a.getUniformLocation(v, "uDualFisheyeFrontUseMEI"), Na = a.getUniformLocation(v, "uDualFisheyeBackUseMEI"), Oa = a.getUniformLocation(v, "uDualFisheyeFrontUseDJI"), Va = a.getUniformLocation(v, "uDualFisheyeBackUseDJI"), Wa = a.getUniformLocation(v, "uDualFisheyeFrontAsymmetric"), Ga = a.getUniformLocation(v, "uDualFisheyeBackAsymmetric"), qa = a.getUniformLocation(v, "uDualFisheyeFrontAxis"), Xa = a.getUniformLocation(v, "uDualFisheyeBackAxis"), $a = a.getUniformLocation(v, "uDualFisheyeFrontRight"), Ya = a.getUniformLocation(v, "uDualFisheyeBackRight"), Qa = a.getUniformLocation(v, "uDualFisheyeFrontUp"), Ha = a.getUniformLocation(v, "uDualFisheyeBackUp"), Ja = a.getUniformLocation(v, "uDualFisheyeMaxTheta"), Ka = a.getUniformLocation(v, "uDualFisheyeBlendBand"), Za = a.getUniformLocation(v, "uDualFisheyeSeamX"), er = a.getUniformLocation(v, "uDualFisheyeSeamBlendX"), tr = a.getUniformLocation(v, "uDualFisheyeSeamFrontWrap"), ir = a.getUniformLocation(v, "uDualFisheyeUseSeamLongitudes"), ar = a.getUniformLocation(v, "uDualFisheyeGain"), to = a.getUniformLocation(v, "uDualFisheyeFrontRemap"), io = a.getUniformLocation(v, "uDualFisheyeBackRemap"), rr = a.getUniformLocation(v, "uDualFisheyeUseRemap"), nr = a.getUniformLocation(v, "uDualFisheyeSeamMask"), or = a.getUniformLocation(v, "uDualFisheyeUseSeamMask"), sr = a.getUniformLocation(v, "uDualFisheyeVideoOffsets"), cr = a.getUniformLocation(v, "uDualFisheyeVideoSeam"), ia = a.createBuffer();
|
|
4467
4481
|
if (!ia)
|
|
4468
4482
|
throw new Error("buffer create failed");
|
|
4469
4483
|
a.bindBuffer(a.ARRAY_BUFFER, ia), 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);
|
|
4470
4484
|
const ft = a.createTexture();
|
|
4471
4485
|
if (!ft) throw new Error("texture create failed");
|
|
4472
|
-
const Jt = r ? a.createTexture() : null,
|
|
4486
|
+
const Jt = r ? a.createTexture() : null, ao = a.getUniformLocation(v, "uSeparateLenses"), ro = a.getUniformLocation(v, "uVerticalLenses");
|
|
4473
4487
|
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));
|
|
4474
4488
|
let Kt = { width: 1, height: 1 };
|
|
4475
4489
|
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(
|
|
@@ -4490,8 +4504,8 @@ function Qn(t, e, i, n) {
|
|
|
4490
4504
|
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;
|
|
4491
4505
|
}
|
|
4492
4506
|
a.disable(a.CULL_FACE), a.disable(a.DEPTH_TEST);
|
|
4493
|
-
function
|
|
4494
|
-
const R = ta(i.dualFisheyeSeamLongitudesDeg).map((V) => Ma(V) / 360).sort((V, U) => V - U), C = wr ? Math.atan2(
|
|
4507
|
+
function no() {
|
|
4508
|
+
const R = ta(i.dualFisheyeSeamLongitudesDeg).map((V) => Ma(V) / 360).sort((V, U) => V - U), C = wr ? Math.atan2(Et[0], Et[2]) / (2 * Math.PI) + 0.5 : 0.5, I = !(C >= R[0] && C <= R[1]);
|
|
4495
4509
|
return {
|
|
4496
4510
|
seamX: R,
|
|
4497
4511
|
frontWrap: I,
|
|
@@ -4500,36 +4514,36 @@ function Qn(t, e, i, n) {
|
|
|
4500
4514
|
};
|
|
4501
4515
|
}
|
|
4502
4516
|
const Zt = s && typeof e.requestVideoFrameCallback == "function" && typeof e.cancelVideoFrameCallback == "function";
|
|
4503
|
-
let
|
|
4517
|
+
let kt = 0, Rt = 0, Pt = 0, ht = i.fovDeg, ei = !0, ti = !0, rt = 0, At = 0, ii = !0, aa = { width: 1, height: 1 };
|
|
4504
4518
|
const Pi = [];
|
|
4505
|
-
let
|
|
4506
|
-
const fr = s && !Zt, Ai = $s(i.background), hr = Xi(e), Me = n === "dual_fisheye" && Xs(hr.width, hr.height), be = c && !Me ? c.remap : null, _t = i.dualFisheyeFovDeg * Math.PI / 360,
|
|
4507
|
-
let
|
|
4508
|
-
const
|
|
4509
|
-
let
|
|
4510
|
-
const na = c ? ye(c.front.principalOffset) : [0, 0], oa = 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], pr = c ? c.front.radialScale : 1, yr = c ? c.back.radialScale : 1, sa = c ? c.front.tangential : [0, 0], ca = c ? c.back.tangential : [0, 0], gr = c ? c.front.xi : 0, vr = c ? c.back.xi : 0, oi = c ? c.front.thinPrism : [0, 0, 0, 0], si = c ? c.back.thinPrism : [0, 0, 0, 0], xr = c ? ye(c.front.sensorTilt) : [0, 0], br = c ? ye(c.back.sensorTilt) : [0, 0],
|
|
4519
|
+
let je = null, Lt = null, Ne = 0, ur = 0, dr = 0, ra = "initial";
|
|
4520
|
+
const fr = s && !Zt, Ai = $s(i.background), hr = Xi(e), Me = n === "dual_fisheye" && Xs(hr.width, hr.height), be = c && !Me ? c.remap : null, _t = i.dualFisheyeFovDeg * Math.PI / 360, oo = c ? c.front.center : i.dualFisheyeFrontCenter || (i.dualFisheyeFrontLens === "left" ? [0.25, 0.5] : [0.75, 0.5]), so = c ? c.back.center : i.dualFisheyeBackCenter || (i.dualFisheyeFrontLens === "left" ? [0.75, 0.5] : [0.25, 0.5]), co = !!(c && ((Gr = c.imageSize) == null ? void 0 : Gr[1]) > ((qr = c.imageSize) == null ? void 0 : qr[0])), ye = (M) => Me && !co ? [M[1], M[0]] : M, Ut = ye(oo), ai = ye(so), mr = Vn(Ut, ai);
|
|
4521
|
+
let Oe = c ? ye(c.front.validRadius) : mr, Ve = c ? ye(c.back.validRadius) : mr;
|
|
4522
|
+
const Li = ye(c ? c.front.scale : fe(i.dualFisheyeScale, [0.247, 0.494])), _i = ye(c ? c.back.scale : fe(i.dualFisheyeScale, [0.247, 0.494]));
|
|
4523
|
+
let ke = c ? ye(c.front.focal) : Da(Li, _t), Re = c ? ye(c.back.focal) : Da(_i, _t);
|
|
4524
|
+
const na = c ? ye(c.front.principalOffset) : [0, 0], oa = 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], pr = c ? c.front.radialScale : 1, yr = c ? c.back.radialScale : 1, sa = c ? c.front.tangential : [0, 0], ca = c ? c.back.tangential : [0, 0], gr = c ? c.front.xi : 0, vr = c ? c.back.xi : 0, oi = c ? c.front.thinPrism : [0, 0, 0, 0], si = c ? c.back.thinPrism : [0, 0, 0, 0], xr = c ? ye(c.front.sensorTilt) : [0, 0], br = c ? ye(c.back.sensorTilt) : [0, 0], lo = !!(c && c.front.projectionModel === "mei_extended"), uo = !!(c && c.back.projectionModel === "mei_extended"), wr = !!(c && c.front.projectionModel === "dji_fisheye_lut"), fo = !!(c && c.back.projectionModel === "dji_fisheye_lut"), Ui = c ? c.front.asymmetric : [0, 0, 0, 0], Ei = c ? c.back.asymmetric : [0, 0, 0, 0], Et = c ? c.front.axis : [0, 0, -1], Ci = c ? c.back.axis : [0, 0, 1], Ii = c ? c.front.right : [1, 0, 0], zi = c ? c.back.right : [-1, 0, 0], Bi = c ? c.front.up : [0, 1, 0], ji = c ? c.back.up : [0, 1, 0], We = {
|
|
4511
4525
|
...c ? c.front : {},
|
|
4512
|
-
center:
|
|
4513
|
-
focal:
|
|
4526
|
+
center: Ut,
|
|
4527
|
+
focal: ke,
|
|
4514
4528
|
principalOffset: na,
|
|
4515
|
-
scale:
|
|
4516
|
-
validRadius:
|
|
4529
|
+
scale: Li,
|
|
4530
|
+
validRadius: Oe,
|
|
4517
4531
|
radial: ri,
|
|
4518
4532
|
radialScale: pr,
|
|
4519
4533
|
tangential: sa,
|
|
4520
4534
|
projectionModel: c ? c.front.projectionModel : "equidistant",
|
|
4521
4535
|
xi: gr,
|
|
4522
4536
|
thinPrism: oi,
|
|
4523
|
-
axis:
|
|
4537
|
+
axis: Et,
|
|
4524
4538
|
right: Ii,
|
|
4525
4539
|
up: Bi
|
|
4526
|
-
},
|
|
4540
|
+
}, Ge = {
|
|
4527
4541
|
...c ? c.back : {},
|
|
4528
4542
|
center: ai,
|
|
4529
|
-
focal:
|
|
4543
|
+
focal: Re,
|
|
4530
4544
|
principalOffset: oa,
|
|
4531
|
-
scale:
|
|
4532
|
-
validRadius:
|
|
4545
|
+
scale: _i,
|
|
4546
|
+
validRadius: Ve,
|
|
4533
4547
|
radial: ni,
|
|
4534
4548
|
radialScale: yr,
|
|
4535
4549
|
tangential: ca,
|
|
@@ -4539,23 +4553,23 @@ function Qn(t, e, i, n) {
|
|
|
4539
4553
|
axis: Ci,
|
|
4540
4554
|
right: zi,
|
|
4541
4555
|
up: ji
|
|
4542
|
-
}, Fr = be ? lr(1,
|
|
4543
|
-
let mt = null,
|
|
4544
|
-
const
|
|
4545
|
-
nt && (
|
|
4546
|
-
const pt =
|
|
4547
|
-
let ot = [0, 0, 0, 0], st = pt && !
|
|
4548
|
-
t.dataset.insta360VideoRegistration =
|
|
4556
|
+
}, Fr = be ? lr(1, to, be.front, be.width, be.height) : null, Mr = be ? lr(2, io, be.back, be.width, be.height) : null, qe = no();
|
|
4557
|
+
let mt = null, Ue = 0, la = !1, Ct = [i.dualFisheyeGainFront, i.dualFisheyeGainBack], Ni = 0, It = [0, 0];
|
|
4558
|
+
const ho = [c == null ? void 0 : c.front, c == null ? void 0 : c.back].map((M) => (M == null ? void 0 : M.distortionCoeffs) || Array(13).fill(0)), mo = !!(s && n === "dual_fisheye" && c && !be && !Me && c.imageSize[0] === 2 * c.imageSize[1] && [We, Ge].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, Ge].every((M) => M.projectionModel === "dji_fisheye_lut"));
|
|
4559
|
+
nt && (Oe = We.validRadius = Vt(We), Ve = Ge.validRadius = Vt(Ge));
|
|
4560
|
+
const pt = mo || nt, zt = pt && i.dualFisheyeVideoRegistration === !0;
|
|
4561
|
+
let ot = [0, 0, 0, 0], st = pt && !zt, Bt = 0, ua = 0;
|
|
4562
|
+
t.dataset.insta360VideoRegistration = zt ? "pending" : pt ? "calibrated" : "unsupported";
|
|
4549
4563
|
function Dr() {
|
|
4550
|
-
if (!
|
|
4564
|
+
if (!zt || st || Bt >= 3 || e.currentTime < ua) return;
|
|
4551
4565
|
const M = Date.now();
|
|
4552
4566
|
try {
|
|
4553
|
-
const R = (nt ? hc : fc)(e, i, c, [
|
|
4567
|
+
const R = (nt ? hc : fc)(e, i, c, [We, Ge]);
|
|
4554
4568
|
if (R === void 0) return;
|
|
4555
|
-
R && (ot = R.offsets,
|
|
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(Ge)), st = !0);
|
|
4556
4570
|
} catch {
|
|
4557
4571
|
}
|
|
4558
|
-
|
|
4572
|
+
Bt += 1, ua = e.currentTime + 1, t.dataset.insta360VideoRegistration = st ? "ready" : Bt < 3 ? "pending" : "fallback", t.dataset.insta360VideoRegistrationAttempts = String(Bt), t.dataset.insta360VideoRegistrationMS = String(Date.now() - M);
|
|
4559
4573
|
}
|
|
4560
4574
|
if (!s && n === "dual_fisheye") {
|
|
4561
4575
|
la = !0;
|
|
@@ -4565,39 +4579,39 @@ function Qn(t, e, i, n) {
|
|
|
4565
4579
|
i,
|
|
4566
4580
|
c,
|
|
4567
4581
|
be,
|
|
4568
|
-
|
|
4569
|
-
|
|
4582
|
+
We,
|
|
4583
|
+
Ge,
|
|
4570
4584
|
_t
|
|
4571
4585
|
);
|
|
4572
|
-
M && (
|
|
4586
|
+
M && (Ct = M.gain, Ni = 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)), Sr(M == null ? void 0 : M.mask);
|
|
4573
4587
|
} catch (M) {
|
|
4574
|
-
t.dataset.insta360StaticSeamError = String((M == null ? void 0 : M.message) || M), mt = null,
|
|
4588
|
+
t.dataset.insta360StaticSeamError = String((M == null ? void 0 : M.message) || M), mt = null, Ue = 0;
|
|
4575
4589
|
}
|
|
4576
4590
|
}
|
|
4577
|
-
t.dataset.insta360StaticSeamAnalyzed = la ? "true" : "false", t.dataset.insta360StaticSeamStatus = la ?
|
|
4591
|
+
t.dataset.insta360StaticSeamAnalyzed = la ? "true" : "false", t.dataset.insta360StaticSeamStatus = la ? Ue ? "ready" : "fallback" : "not-applicable";
|
|
4578
4592
|
function Sr(M, R = null) {
|
|
4579
4593
|
if (!(M instanceof Uint8Array) || !nr || (mt || (mt = a.createTexture()), !mt)) return !1;
|
|
4580
4594
|
try {
|
|
4581
4595
|
a.activeTexture(a.TEXTURE3), a.bindTexture(a.TEXTURE_2D, mt), a.uniform1i(nr, 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);
|
|
4582
4596
|
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;
|
|
4583
|
-
return a.texImage2D(a.TEXTURE_2D, 0, C, z, X, 0, C, a.UNSIGNED_BYTE, I),
|
|
4597
|
+
return a.texImage2D(a.TEXTURE_2D, 0, C, z, X, 0, C, a.UNSIGNED_BYTE, I), Ue = 1, !0;
|
|
4584
4598
|
} finally {
|
|
4585
4599
|
a.activeTexture(a.TEXTURE0), a.bindTexture(a.TEXTURE_2D, ft), a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, l ? 1 : 0);
|
|
4586
4600
|
}
|
|
4587
4601
|
}
|
|
4588
4602
|
let yt = null;
|
|
4589
4603
|
const he = {};
|
|
4590
|
-
let Oi = 1, ci = null, gt = -1 / 0,
|
|
4604
|
+
let Oi = 1, ci = null, gt = -1 / 0, Pe = 0, Tr = 0;
|
|
4591
4605
|
function kr() {
|
|
4592
|
-
if (!pt || !st ||
|
|
4606
|
+
if (!pt || !st || Pe >= 3 || e.seeking || e.currentTime + 1e-6 < gt) return;
|
|
4593
4607
|
const M = Date.now();
|
|
4594
4608
|
try {
|
|
4595
4609
|
const C = Fc(
|
|
4596
4610
|
e,
|
|
4597
4611
|
i,
|
|
4598
4612
|
c,
|
|
4599
|
-
[{ ...
|
|
4600
|
-
{ offsets: ot, gain:
|
|
4613
|
+
[{ ...We, focal: ke, validRadius: Oe }, { ...Ge, focal: Re, validRadius: Ve }],
|
|
4614
|
+
{ offsets: ot, gain: Ct, polarInverseDepth: It },
|
|
4601
4615
|
yt,
|
|
4602
4616
|
he
|
|
4603
4617
|
);
|
|
@@ -4609,33 +4623,33 @@ function Qn(t, e, i, n) {
|
|
|
4609
4623
|
const I = C == null ? void 0 : C.mask;
|
|
4610
4624
|
if (I instanceof Uint8Array) {
|
|
4611
4625
|
const V = bc(I, yt, C.strength);
|
|
4612
|
-
Sr(V, C.strength) ? (yt = V,
|
|
4613
|
-
} else
|
|
4626
|
+
Sr(V, C.strength) ? (yt = V, Pe = 0, Tr += 1) : Pe += 1;
|
|
4627
|
+
} else Pe += 1;
|
|
4614
4628
|
} catch {
|
|
4615
|
-
|
|
4629
|
+
Pe += 1;
|
|
4616
4630
|
}
|
|
4617
|
-
|
|
4631
|
+
Pe >= 3 && (Ue = 0, yt = null);
|
|
4618
4632
|
const R = Date.now() - M;
|
|
4619
|
-
Oi = R > 100 ? 5 : R > 33 ? 3 : 1, gt = e.currentTime + Oi, t.dataset.insta360VideoSeamUpdates = String(Tr), t.dataset.insta360VideoSeamMS = String(R), t.dataset.insta360VideoSeamInterval = String(Oi), t.dataset.insta360VideoSeam =
|
|
4633
|
+
Oi = R > 100 ? 5 : R > 33 ? 3 : 1, gt = e.currentTime + Oi, t.dataset.insta360VideoSeamUpdates = String(Tr), t.dataset.insta360VideoSeamMS = String(R), t.dataset.insta360VideoSeamInterval = String(Oi), t.dataset.insta360VideoSeam = Ue ? "ready" : Pe >= 3 ? "fallback" : "pending";
|
|
4620
4634
|
}
|
|
4621
4635
|
function da() {
|
|
4622
|
-
!Zt || !ti || !s || e.paused || e.ended ||
|
|
4623
|
-
|
|
4636
|
+
!Zt || !ti || !s || e.paused || e.ended || At || (At = e.requestVideoFrameCallback(() => {
|
|
4637
|
+
At = 0, (jt || ha(performance.now(), ui)) && (ii = !0, vt()), da();
|
|
4624
4638
|
}));
|
|
4625
4639
|
}
|
|
4626
|
-
function
|
|
4627
|
-
!Zt || !
|
|
4640
|
+
function po() {
|
|
4641
|
+
!Zt || !At || !s || (e.cancelVideoFrameCallback(At), At = 0);
|
|
4628
4642
|
}
|
|
4629
|
-
function
|
|
4643
|
+
function yo(M) {
|
|
4630
4644
|
let R = Number(M) || 0;
|
|
4631
4645
|
return R = (R % 360 + 360) % 360, R > 180 && (R -= 360), R;
|
|
4632
4646
|
}
|
|
4633
|
-
function
|
|
4634
|
-
|
|
4647
|
+
function go(M, R, C, I) {
|
|
4648
|
+
kt = yo(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;
|
|
4635
4649
|
}
|
|
4636
|
-
function
|
|
4637
|
-
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 =
|
|
4638
|
-
(t.width !==
|
|
4650
|
+
function vo() {
|
|
4651
|
+
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, dr += 1, ra = "resize", t.dataset.insta360ResizeCount = String(dr), t.dataset.insta360CanvasWidth = String(W), t.dataset.insta360CanvasHeight = String(oe));
|
|
4639
4653
|
}
|
|
4640
4654
|
function Rr() {
|
|
4641
4655
|
for (let M = 0; M < 16 && a.getError() !== a.NO_ERROR; M += 1)
|
|
@@ -4650,10 +4664,10 @@ function Qn(t, e, i, n) {
|
|
|
4650
4664
|
} catch {
|
|
4651
4665
|
return t.dataset.insta360TextureStatus = "exception", !1;
|
|
4652
4666
|
}
|
|
4653
|
-
const
|
|
4654
|
-
return V && (Cr = I + 1e3),
|
|
4667
|
+
const W = V ? a.getError() : a.NO_ERROR;
|
|
4668
|
+
return V && (Cr = I + 1e3), W !== a.NO_ERROR ? (t.dataset.insta360TextureStatus = `error-${W}`, !1) : (Kt = { width: R, height: C }, aa = { width: R, height: C }, t.dataset.insta360TextureStatus = "ready", t.dataset.insta360TextureWidth = String(R), t.dataset.insta360TextureHeight = String(C), !0);
|
|
4655
4669
|
}
|
|
4656
|
-
function
|
|
4670
|
+
function xo(M) {
|
|
4657
4671
|
const R = Xi(e);
|
|
4658
4672
|
if (M >= R.width && M >= R.height)
|
|
4659
4673
|
return {
|
|
@@ -4670,10 +4684,10 @@ function Qn(t, e, i, n) {
|
|
|
4670
4684
|
M / Math.max(1, R.height)
|
|
4671
4685
|
), I = Math.max(1, Math.floor(R.width * C)), V = Math.max(1, Math.floor(R.height * C)), U = document.createElement("canvas");
|
|
4672
4686
|
U.width = I, U.height = V;
|
|
4673
|
-
const
|
|
4674
|
-
if (!
|
|
4687
|
+
const W = U.getContext("2d", { alpha: !1 });
|
|
4688
|
+
if (!W) return null;
|
|
4675
4689
|
try {
|
|
4676
|
-
|
|
4690
|
+
Wn.has(e) && (W.translate(0, V), W.scale(1, -1)), W.drawImage(e, 0, 0, I, V);
|
|
4677
4691
|
} catch {
|
|
4678
4692
|
return U.width = 0, U.height = 0, null;
|
|
4679
4693
|
}
|
|
@@ -4686,7 +4700,7 @@ function Qn(t, e, i, n) {
|
|
|
4686
4700
|
}
|
|
4687
4701
|
};
|
|
4688
4702
|
}
|
|
4689
|
-
function
|
|
4703
|
+
function bo() {
|
|
4690
4704
|
if (r || s && e.readyState < 2) return !1;
|
|
4691
4705
|
a.activeTexture(a.TEXTURE0), a.bindTexture(a.TEXTURE_2D, ft);
|
|
4692
4706
|
const M = Xi(e);
|
|
@@ -4694,20 +4708,20 @@ function Qn(t, e, i, n) {
|
|
|
4694
4708
|
const U = zr(M.width, M.height);
|
|
4695
4709
|
return Pr(Br(e, M.width, M.height, U, 0), U.width, U.height);
|
|
4696
4710
|
}
|
|
4697
|
-
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, hn[0]), ...hn].filter((U,
|
|
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, hn[0]), ...hn].filter((U, W, oe) => U <= R && U <= C && oe.indexOf(U) === W).sort((U, W) => W - U);
|
|
4698
4712
|
for (const U of V) {
|
|
4699
|
-
const
|
|
4700
|
-
if (!
|
|
4701
|
-
if (Pr(
|
|
4702
|
-
return
|
|
4703
|
-
|
|
4713
|
+
const W = xo(U);
|
|
4714
|
+
if (!W) continue;
|
|
4715
|
+
if (Pr(W.source, W.width, W.height))
|
|
4716
|
+
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
|
+
W.retainUntilDestroy || W.release();
|
|
4704
4718
|
}
|
|
4705
4719
|
return !1;
|
|
4706
4720
|
}
|
|
4707
|
-
function
|
|
4708
|
-
s || !
|
|
4709
|
-
|
|
4710
|
-
|
|
4721
|
+
function wo() {
|
|
4722
|
+
s || !je || Ne || (Ne = requestAnimationFrame(() => {
|
|
4723
|
+
Ne = requestAnimationFrame(() => {
|
|
4724
|
+
Ne = 0, je && (je(), je = null, t.dataset.insta360TextureSource = "released");
|
|
4711
4725
|
});
|
|
4712
4726
|
}));
|
|
4713
4727
|
}
|
|
@@ -4716,69 +4730,69 @@ function Qn(t, e, i, n) {
|
|
|
4716
4730
|
var U;
|
|
4717
4731
|
if (!ti) return;
|
|
4718
4732
|
const M = typeof performance < "u" ? performance.now() : Date.now();
|
|
4719
|
-
rt = 0,
|
|
4720
|
-
const R = o && !e.paused && !e.ended, C = !R ||
|
|
4733
|
+
rt = 0, vo();
|
|
4734
|
+
const R = o && !e.paused && !e.ended, C = !R || jt || ha(M, ui), V = (ii || fr && R) && (!o || C) ? bo() : !1;
|
|
4721
4735
|
if (V && (ii = !1, s && (Dr(), kr())), ei || V) {
|
|
4722
|
-
const
|
|
4723
|
-
|
|
4724
|
-
|
|
4736
|
+
const W = aa, oe = Ur(), Ie = Ut[Me ? 1 : 0] < 0.5 ? 0 : 1, $e = oe.every(Boolean) ? 0 : oe[Ie] ? 1 : 2, De = [
|
|
4737
|
+
W.width,
|
|
4738
|
+
W.height,
|
|
4725
4739
|
t.width,
|
|
4726
4740
|
t.height,
|
|
4727
|
-
Tt,
|
|
4728
4741
|
kt,
|
|
4729
4742
|
Rt,
|
|
4743
|
+
Pt,
|
|
4730
4744
|
ht,
|
|
4731
|
-
Ne,
|
|
4732
4745
|
Oe,
|
|
4733
|
-
|
|
4746
|
+
Ve,
|
|
4734
4747
|
ke,
|
|
4748
|
+
Re,
|
|
4735
4749
|
Ni,
|
|
4736
|
-
|
|
4750
|
+
It,
|
|
4737
4751
|
ot,
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4752
|
+
Ct,
|
|
4753
|
+
Ue,
|
|
4754
|
+
$e
|
|
4741
4755
|
].join(":");
|
|
4742
4756
|
if (De !== Ar) {
|
|
4743
|
-
const
|
|
4744
|
-
F && a.uniform2f(F,
|
|
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 = xn(Wt(Wt(ct, xt), lt)), Y = t.width / t.height;
|
|
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]), G && a.uniform2f(G, Oe[0], Oe[1]), q && a.uniform2f(q, Ve[0], Ve[1]), te && a.uniform2f(te, ke[0], ke[1]), ne && a.uniform2f(ne, Re[0], Re[1]), ue && a.uniform2f(ue, na[0], na[1]), J && a.uniform2f(J, oa[0], oa[1]), Z && a.uniform2f(Z, Li[0], Li[1]), Tt && a.uniform2f(Tt, _i[0], _i[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, pr), pe && a.uniform1f(pe, yr), re && a.uniform2f(
|
|
4745
4759
|
re,
|
|
4746
4760
|
(c == null ? void 0 : c.front.distortionCoeffs[4]) || 0,
|
|
4747
4761
|
(c == null ? void 0 : c.back.distortionCoeffs[4]) || 0
|
|
4748
|
-
),
|
|
4762
|
+
), Te && a.uniform2f(Te, sa[0], sa[1]), et && a.uniform2f(et, ca[0], ca[1]), tt && a.uniform1f(tt, gr), Qt && a.uniform1f(Qt, vr), 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, xr[0], xr[1]), it && a.uniform2f(it, br[0], br[1]), Si && a.uniform1f(Si, Ni), Ti && a.uniform2f(Ti, ...It), sr && a.uniform4f(sr, ...ot), cr && a.uniform1f(cr, pt ? 1 : 0);
|
|
4749
4763
|
for (let K = 0; K < 2; K += 1) {
|
|
4750
4764
|
const se = K === 0 ? c == null ? void 0 : c.front : c == null ? void 0 : c.back;
|
|
4751
4765
|
ki[K] && a.uniform3f(ki[K], ...(se == null ? void 0 : se.translationM) || [0, 0, 0]);
|
|
4752
|
-
const Fe =
|
|
4753
|
-
for (let
|
|
4754
|
-
at[K][
|
|
4766
|
+
const Fe = ho[K];
|
|
4767
|
+
for (let Ae = 0; Ae < 3; Ae += 1)
|
|
4768
|
+
at[K][Ae] && a.uniform4fv(at[K][Ae], Fe.slice(Ae * 4, Ae * 4 + 4));
|
|
4755
4769
|
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);
|
|
4756
4770
|
}
|
|
4757
|
-
Ri && a.uniform4f(Ri, ...(c == null ? void 0 : c.front.rotationQuat) || [1, 0, 0, 0]), Ba && a.uniform4f(Ba, ...(c == null ? void 0 : c.back.rotationQuat) || [1, 0, 0, 0]), ja && a.uniform1f(ja,
|
|
4771
|
+
Ri && a.uniform4f(Ri, ...(c == null ? void 0 : c.front.rotationQuat) || [1, 0, 0, 0]), Ba && a.uniform4f(Ba, ...(c == null ? void 0 : c.back.rotationQuat) || [1, 0, 0, 0]), ja && a.uniform1f(ja, lo ? 1 : 0), Na && a.uniform1f(Na, uo ? 1 : 0), Oa && a.uniform1f(Oa, wr ? c.front.distortionModel === "dji_fisheye_5" ? 2 : 1 : 0), Va && a.uniform1f(Va, fo ? c.back.distortionModel === "dji_fisheye_5" ? 2 : 1 : 0), Wa && a.uniform4f(Wa, Ui[0], Ui[1], Ui[2], Ui[3]), Ga && a.uniform4f(Ga, Ei[0], Ei[1], Ei[2], Ei[3]), qa && a.uniform3f(qa, Et[0], Et[1], Et[2]), Xa && a.uniform3f(Xa, Ci[0], Ci[1], Ci[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.uniform1f(Ja, _t), Ka && a.uniform1f(Ka, Math.sin(i.dualFisheyeSeamBlendDeg * Math.PI / 180)), Za && a.uniform2f(Za, qe.seamX[0], qe.seamX[1]), er && a.uniform1f(er, qe.blendX), tr && a.uniform1f(tr, qe.frontWrap ? 1 : 0), ir && a.uniform1f(ir, qe.enabled ? 1 : 0), ar && a.uniform2f(ar, Ct[0], Ct[1]), rr && a.uniform1f(rr, be ? 1 : 0), or && a.uniform1f(or, Ue), k && a.uniform1f(k, $e), Ar = De;
|
|
4758
4772
|
}
|
|
4759
|
-
a.clearColor(Ai.r / 255, Ai.g / 255, Ai.b / 255, Ai.a), a.clear(a.COLOR_BUFFER_BIT), a.drawArrays(a.TRIANGLES, 0, 3), ur += 1, t.dataset.insta360DrawCount = String(ur), t.dataset.insta360LastDrawReason = ra, t.dataset.insta360ContextStatus = "ready", V &&
|
|
4773
|
+
a.clearColor(Ai.r / 255, Ai.g / 255, Ai.b / 255, Ai.a), a.clear(a.COLOR_BUFFER_BIT), a.drawArrays(a.TRIANGLES, 0, 3), ur += 1, t.dataset.insta360DrawCount = String(ur), t.dataset.insta360LastDrawReason = ra, t.dataset.insta360ContextStatus = "ready", V && wo(), ei = !1;
|
|
4760
4774
|
}
|
|
4761
|
-
o && V && (ui = Ir(M, ui,
|
|
4775
|
+
o && V && (ui = Ir(M, ui, jt), jt = !1, R && ((U = i.onPlaybackWork) == null || U.call(i, Math.max(0, performance.now() - M)))), fr && R && (rt = requestAnimationFrame(fa));
|
|
4762
4776
|
}
|
|
4763
|
-
function
|
|
4777
|
+
function Fo() {
|
|
4764
4778
|
ti && (s && Zt && da(), vt());
|
|
4765
4779
|
}
|
|
4766
4780
|
function vt(M = "request") {
|
|
4767
4781
|
ei = !0, ra = M, rt || (rt = requestAnimationFrame(fa));
|
|
4768
4782
|
}
|
|
4769
|
-
function
|
|
4783
|
+
function Lr(M) {
|
|
4770
4784
|
t.dataset.insta360ContextStatus = "lost", t.dispatchEvent(new CustomEvent("insta360previewerror", {
|
|
4771
4785
|
bubbles: !0,
|
|
4772
4786
|
detail: { reason: "webgl-context-lost" }
|
|
4773
4787
|
})), M.cancelable && M.preventDefault();
|
|
4774
4788
|
}
|
|
4775
|
-
t.addEventListener("webglcontextlost",
|
|
4776
|
-
function
|
|
4777
|
-
|
|
4789
|
+
t.addEventListener("webglcontextlost", Lr);
|
|
4790
|
+
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, ua = e.currentTime), ii = !0, Zt && da(), vt();
|
|
4778
4792
|
}
|
|
4779
|
-
o && (e.addEventListener("play",
|
|
4780
|
-
function
|
|
4781
|
-
ti = !1, rt && cancelAnimationFrame(rt),
|
|
4793
|
+
o && (e.addEventListener("play", Ee), e.addEventListener("pause", Ee), e.addEventListener("seeking", Ee), e.addEventListener("seeked", Ee), e.addEventListener("loadeddata", Ee));
|
|
4794
|
+
function Mo() {
|
|
4795
|
+
ti = !1, rt && cancelAnimationFrame(rt), Ne && cancelAnimationFrame(Ne), po(), t.removeEventListener("webglcontextlost", Lr), 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);
|
|
4782
4796
|
for (const M of fi) M != null && M.canvas && (M.canvas.width = 0, M.canvas.height = 0);
|
|
4783
4797
|
fi.length = 0, he.surface = null, he.projections = null, he.readback = null, he.softwareReadback = null;
|
|
4784
4798
|
for (const M of Vi) M && (M.width = 0, M.height = 0);
|
|
@@ -4786,83 +4800,83 @@ function Qn(t, e, i, n) {
|
|
|
4786
4800
|
for (const M of li) M != null && M.canvas && (M.canvas.width = 0, M.canvas.height = 0);
|
|
4787
4801
|
li.length = 0, a.deleteTexture(ft), Jt && a.deleteTexture(Jt), Fr && a.deleteTexture(Fr), Mr && a.deleteTexture(Mr), mt && a.deleteTexture(mt), a.deleteBuffer(ia), a.deleteProgram(v);
|
|
4788
4802
|
}
|
|
4789
|
-
let
|
|
4803
|
+
let _r = "", Xe = [!0, !0];
|
|
4790
4804
|
function Ur() {
|
|
4791
|
-
if (i.captureEquirectangular || !r || n !== "dual_fisheye" || be ||
|
|
4805
|
+
if (i.captureEquirectangular || !r || n !== "dual_fisheye" || be || zt && (!st || !nt) || Ni > 0 || It.some((Ie) => Ie > 0) || !qe.enabled) return [!0, !0];
|
|
4792
4806
|
const M = Math.max(1, t.clientWidth) / Math.max(1, t.clientHeight), R = [
|
|
4793
|
-
Tt,
|
|
4794
4807
|
kt,
|
|
4795
4808
|
Rt,
|
|
4809
|
+
Pt,
|
|
4796
4810
|
ht,
|
|
4797
4811
|
M,
|
|
4798
|
-
Ne,
|
|
4799
4812
|
Oe,
|
|
4800
|
-
|
|
4813
|
+
Ve,
|
|
4801
4814
|
ke,
|
|
4815
|
+
Re,
|
|
4802
4816
|
ot
|
|
4803
4817
|
].join(":");
|
|
4804
|
-
if (R ===
|
|
4805
|
-
|
|
4806
|
-
const C = xn(
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4818
|
+
if (R === _r) return Xe;
|
|
4819
|
+
_r = R, Xe = [!0, !0];
|
|
4820
|
+
const C = xn(Wt(
|
|
4821
|
+
Wt(
|
|
4822
|
+
Ot(0, 1, 0, -kt * Math.PI / 180),
|
|
4823
|
+
Ot(1, 0, 0, -Rt * Math.PI / 180)
|
|
4810
4824
|
),
|
|
4811
|
-
|
|
4825
|
+
Ot(0, 0, 1, -Pt * Math.PI / 180)
|
|
4812
4826
|
)), I = Math.tan(Math.min(160, ht + 12) * Math.PI / 360), V = [
|
|
4813
|
-
{ ...
|
|
4814
|
-
{ ...
|
|
4827
|
+
{ ...We, focal: ke, validRadius: Oe },
|
|
4828
|
+
{ ...Ge, focal: Re, validRadius: Ve }
|
|
4815
4829
|
];
|
|
4816
4830
|
let U = -1;
|
|
4817
|
-
for (let
|
|
4818
|
-
const De = za(C,
|
|
4819
|
-
De.x /
|
|
4820
|
-
De.y /
|
|
4821
|
-
De.z /
|
|
4831
|
+
for (let Ie = -4; Ie <= 4; Ie += 1) for (let $e = -4; $e <= 4; $e += 1) {
|
|
4832
|
+
const De = za(C, $e / 4 * M * I, Ie / 4 * I, u ? 1 : -1), Ye = Math.hypot(De.x, De.y, De.z), we = [
|
|
4833
|
+
De.x / Ye * (i.equirectFlipX ? -1 : 1),
|
|
4834
|
+
De.y / Ye * (i.equirectFlipY ? -1 : 1),
|
|
4835
|
+
De.z / Ye
|
|
4822
4836
|
];
|
|
4823
|
-
if (Math.abs(we[1]) >= Math.sin(45 * Math.PI / 180)) return
|
|
4824
|
-
const
|
|
4825
|
-
if (!
|
|
4826
|
-
const se = (
|
|
4827
|
-
if (U >= 0 && U !== se) return
|
|
4837
|
+
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] = qe.seamX, lt = qe.blendX + 0.01, ze = Qe > ct + lt && Qe < xt - lt, Y = Qe < ct - lt || Qe > xt + lt;
|
|
4839
|
+
if (!ze && !Y) return Xe;
|
|
4840
|
+
const se = (qe.frontWrap ? Y : ze) ? 0 : 1;
|
|
4841
|
+
if (U >= 0 && U !== se) return Xe;
|
|
4828
4842
|
U = se;
|
|
4829
|
-
const Fe = V[se],
|
|
4830
|
-
|
|
4843
|
+
const Fe = V[se], Ae = se === 1 ? Qi(we, ot) : we, He = St(
|
|
4844
|
+
Ae,
|
|
4831
4845
|
Fe,
|
|
4832
4846
|
_t,
|
|
4833
4847
|
Fe.projectionModel === "mei_extended",
|
|
4834
4848
|
Fe.projectionModel === "dji_fisheye_lut",
|
|
4835
4849
|
Fe.radialScale || 1
|
|
4836
4850
|
);
|
|
4837
|
-
if (!
|
|
4851
|
+
if (!He || He.confidence < 0.1) return Xe;
|
|
4838
4852
|
if (nt) {
|
|
4839
|
-
const
|
|
4840
|
-
|
|
4841
|
-
|
|
4853
|
+
const qi = V[1 - se], So = se === 0 ? Qi(we, ot) : we, Xr = St(
|
|
4854
|
+
So,
|
|
4855
|
+
qi,
|
|
4842
4856
|
_t,
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4857
|
+
qi.projectionModel === "mei_extended",
|
|
4858
|
+
qi.projectionModel === "dji_fisheye_lut",
|
|
4859
|
+
qi.radialScale || 1
|
|
4846
4860
|
);
|
|
4847
|
-
if (Xr && Xr.confidence > 0) return
|
|
4861
|
+
if (Xr && Xr.confidence > 0) return Xe;
|
|
4848
4862
|
}
|
|
4849
4863
|
}
|
|
4850
|
-
const oe = (U === 0 ?
|
|
4851
|
-
return
|
|
4864
|
+
const oe = (U === 0 ? Ut : ai)[Me ? 1 : 0] < 0.5 ? 0 : 1;
|
|
4865
|
+
return Xe = [oe === 0, oe === 1], Xe;
|
|
4852
4866
|
}
|
|
4853
|
-
let Er = 0,
|
|
4867
|
+
let Er = 0, Ce = { level: 0, maxFps: 0, maxRenderPixels: 0, maxTextureSize: 0 };
|
|
4854
4868
|
const Vi = [], li = [];
|
|
4855
|
-
let ui = 0, Cr = 0,
|
|
4869
|
+
let ui = 0, Cr = 0, jt = !0;
|
|
4856
4870
|
function ha(M, R) {
|
|
4857
|
-
const C =
|
|
4871
|
+
const C = Ce.maxFps ? 1e3 / Ce.maxFps : 0;
|
|
4858
4872
|
return !C || M + Math.min(20, C / 2) >= R;
|
|
4859
4873
|
}
|
|
4860
4874
|
function Ir(M, R, C = !1) {
|
|
4861
|
-
const I =
|
|
4875
|
+
const I = Ce.maxFps ? 1e3 / Ce.maxFps : 0;
|
|
4862
4876
|
return I ? C || !R || M - R > I ? M + I : Math.max(R + I, M + I / 2 + Math.min(20, I / 2)) : 0;
|
|
4863
4877
|
}
|
|
4864
4878
|
function zr(M, R) {
|
|
4865
|
-
const C =
|
|
4879
|
+
const C = Ce.maxTextureSize > 0 ? Math.min(1, Ce.maxTextureSize / Math.max(M, R)) : 1;
|
|
4866
4880
|
return { width: Math.max(1, Math.floor(M * C)), height: Math.max(1, Math.floor(R * C)) };
|
|
4867
4881
|
}
|
|
4868
4882
|
function Br(M, R, C, I, V) {
|
|
@@ -4876,62 +4890,62 @@ function Qn(t, e, i, n) {
|
|
|
4876
4890
|
let U = Vi[V];
|
|
4877
4891
|
return U || (U = Vi[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;
|
|
4878
4892
|
}
|
|
4879
|
-
function
|
|
4880
|
-
!s || !M || M.level ===
|
|
4893
|
+
function Do(M) {
|
|
4894
|
+
!s || !M || M.level === Ce.level || (Ce = M, ui = 0, di = 0, Wi = 0, jt = !0, t.dataset.insta360QualityLevel = String(M.level), t.dataset.insta360MaxFps = String(M.maxFps), vt("quality"));
|
|
4881
4895
|
}
|
|
4882
|
-
let jr = -1 / 0, di = 0,
|
|
4896
|
+
let jr = -1 / 0, di = 0, Wi = 0, Gi = 0, Nr = "";
|
|
4883
4897
|
const fi = [];
|
|
4884
4898
|
function Or(M) {
|
|
4885
4899
|
const R = e.getContext("2d", { willReadFrequently: !0 });
|
|
4886
4900
|
M.forEach((C, I) => {
|
|
4887
|
-
const V = C instanceof ImageData ? bn(C, nt ? 1024 : 512, fi[I] || (fi[I] = {})) : C, U = M.length === 2 && !Me ? e.width / 2 : e.width,
|
|
4888
|
-
R.drawImage(V, Me ? 0 : I * U, Me ? I *
|
|
4901
|
+
const V = C instanceof ImageData ? bn(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
|
+
R.drawImage(V, Me ? 0 : I * U, Me ? I * W : 0, U, W);
|
|
4889
4903
|
});
|
|
4890
4904
|
}
|
|
4891
4905
|
function Vr(M, R, C = !1) {
|
|
4892
4906
|
if (!ti || !r) return;
|
|
4893
4907
|
const I = ci !== null && (R < ci || R - ci > 0.5);
|
|
4894
|
-
if (I && (he.surface = null, yt = null, gt = -1 / 0,
|
|
4895
|
-
const U = typeof performance < "u" ? performance.now() : Date.now(),
|
|
4908
|
+
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 ? zr(
|
|
4896
4910
|
Y.displayWidth || Y.videoWidth || Y.width,
|
|
4897
4911
|
Y.displayHeight || Y.videoHeight || Y.height
|
|
4898
|
-
) : null),
|
|
4912
|
+
) : null), Ie = oe.some((Y, K) => {
|
|
4899
4913
|
var se, Fe;
|
|
4900
4914
|
return Y && (((se = Pi[K]) == null ? void 0 : se.width) !== Y.width || ((Fe = Pi[K]) == null ? void 0 : Fe.height) !== Y.height);
|
|
4901
|
-
}),
|
|
4902
|
-
if (
|
|
4915
|
+
}), $e = C || I || Ie || W !== Nr;
|
|
4916
|
+
if (!$e && (U < Wi || !ha(U, di))) return;
|
|
4903
4917
|
ci = R;
|
|
4904
|
-
const { width: De, height:
|
|
4918
|
+
const { width: De, height: Ye } = oe.find(Boolean), we = Er || (Er = a.getParameter(a.MAX_TEXTURE_SIZE));
|
|
4905
4919
|
if (oe.filter(Boolean).some((Y) => Y.width > we || Y.height > we))
|
|
4906
4920
|
throw new Error("Panorama frame exceeds GPU texture limits; select a companion source");
|
|
4907
|
-
a.uniform1f(
|
|
4908
|
-
const
|
|
4909
|
-
if (
|
|
4921
|
+
a.uniform1f(ao, M.length === 2 ? 1 : 0), a.uniform1f(ro, Me ? 1 : 0);
|
|
4922
|
+
const Qe = Ie || U >= jr;
|
|
4923
|
+
if (Qe && Rr(), M.forEach((Y, K) => {
|
|
4910
4924
|
if (!Y) return;
|
|
4911
4925
|
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);
|
|
4912
|
-
const { width: se, height: Fe } = oe[K],
|
|
4926
|
+
const { width: se, height: Fe } = oe[K], Ae = Br(
|
|
4913
4927
|
Y,
|
|
4914
4928
|
Y.displayWidth || Y.videoWidth || Y.width,
|
|
4915
4929
|
Y.displayHeight || Y.videoHeight || Y.height,
|
|
4916
4930
|
oe[K],
|
|
4917
4931
|
K
|
|
4918
|
-
),
|
|
4919
|
-
(
|
|
4920
|
-
}),
|
|
4932
|
+
), He = Pi[K];
|
|
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), Pi[K] = { width: se, height: Fe });
|
|
4934
|
+
}), Qe) {
|
|
4921
4935
|
if (a.getError() !== a.NO_ERROR) throw new Error("Panorama frame upload failed");
|
|
4922
4936
|
jr = U + 1e3;
|
|
4923
4937
|
}
|
|
4924
4938
|
const ct = Math.max(0, (typeof performance < "u" ? performance.now() : Date.now()) - U);
|
|
4925
|
-
|
|
4939
|
+
Gi = Gi ? Gi * 0.8 + ct * 0.2 : ct, di = Ir(U, di, $e), Wi = U + Math.min(100, Gi * 1.5), Nr = W;
|
|
4926
4940
|
const xt = Me || n === "eac" || n === "cubemap";
|
|
4927
4941
|
aa = {
|
|
4928
4942
|
width: M.length === 2 && !xt ? De * 2 : De,
|
|
4929
|
-
height: M.length === 2 && xt ?
|
|
4943
|
+
height: M.length === 2 && xt ? Ye * 2 : Ye
|
|
4930
4944
|
}, ii = !1;
|
|
4931
|
-
const lt =
|
|
4932
|
-
if ((
|
|
4945
|
+
const lt = zt && !st && Bt < 3, ze = pt && st && Pe < 3;
|
|
4946
|
+
if ((ze || lt) && M.every(Boolean) && R >= gt) {
|
|
4933
4947
|
e.currentTime = R;
|
|
4934
|
-
const Y = nt &&
|
|
4948
|
+
const Y = nt && ze && e.width === 2048 && e.height === 1024 && M.length === 2 && M.every((K) => K instanceof ImageData);
|
|
4935
4949
|
try {
|
|
4936
4950
|
Y ? (he.softwareFrames = M, he.prepareSoftwareFallback = () => Or(M)) : Or(M), Dr(), kr();
|
|
4937
4951
|
} finally {
|
|
@@ -4942,24 +4956,24 @@ function Qn(t, e, i, n) {
|
|
|
4942
4956
|
}
|
|
4943
4957
|
return {
|
|
4944
4958
|
reset: () => {
|
|
4945
|
-
he.surface = null, yt = null, ci = null, gt = -1 / 0, di = 0,
|
|
4959
|
+
he.surface = null, yt = null, ci = null, gt = -1 / 0, di = 0, Wi = 0, Ue = 0, Pe = 0, t.dataset.insta360VideoSeam = "pending", vt("seek");
|
|
4946
4960
|
},
|
|
4947
4961
|
presentFrames: Vr,
|
|
4948
4962
|
captureFrames: (M, R) => {
|
|
4949
4963
|
Vr(M, R, !0), rt && cancelAnimationFrame(rt), fa();
|
|
4950
4964
|
},
|
|
4951
|
-
setPlaybackQuality:
|
|
4965
|
+
setPlaybackQuality: Do,
|
|
4952
4966
|
getRequiredTracks: Ur,
|
|
4953
|
-
start:
|
|
4967
|
+
start: Fo,
|
|
4954
4968
|
requestFrame: vt,
|
|
4955
|
-
destroy:
|
|
4956
|
-
setView:
|
|
4957
|
-
getView: () => ({ yawDeg:
|
|
4969
|
+
destroy: Mo,
|
|
4970
|
+
setView: go,
|
|
4971
|
+
getView: () => ({ yawDeg: kt, pitchDeg: Rt, rollDeg: Pt, fovDeg: ht }),
|
|
4958
4972
|
// +Z MEI cameras reverse both screen axes relative to the -Z panorama camera.
|
|
4959
4973
|
dragDirectionSign: u ? -1 : 1
|
|
4960
4974
|
};
|
|
4961
4975
|
}
|
|
4962
|
-
function
|
|
4976
|
+
function Wt(t, e) {
|
|
4963
4977
|
return {
|
|
4964
4978
|
x: t.w * e.x + t.x * e.w + t.y * e.z - t.z * e.y,
|
|
4965
4979
|
y: t.w * e.y - t.x * e.z + t.y * e.w + t.z * e.x,
|
|
@@ -4976,12 +4990,12 @@ function xn(t) {
|
|
|
4976
4990
|
w: t.w / e
|
|
4977
4991
|
};
|
|
4978
4992
|
}
|
|
4979
|
-
function
|
|
4993
|
+
function Ot(t, e, i, n) {
|
|
4980
4994
|
const r = n / 2, o = Math.sin(r);
|
|
4981
4995
|
return { x: t * o, y: e * o, z: i * o, w: Math.cos(r) };
|
|
4982
4996
|
}
|
|
4983
4997
|
function za(t, e, i, n) {
|
|
4984
|
-
const r = { x: e, y: i, z: n, w: 0 }, o = { x: -t.x, y: -t.y, z: -t.z, w: t.w }, s =
|
|
4998
|
+
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);
|
|
4985
4999
|
return { x: a.x, y: a.y, z: a.z };
|
|
4986
5000
|
}
|
|
4987
5001
|
function bn(t, e = 512, i = null, n = null) {
|
|
@@ -5011,15 +5025,15 @@ function Mc(t, e, i = null) {
|
|
|
5011
5025
|
var o;
|
|
5012
5026
|
const n = i || document.createElement("canvas");
|
|
5013
5027
|
i || (n.width = ((o = e.dualFisheyeCalibration) == null ? void 0 : o.front.projectionModel) === "dji_fisheye_lut" ? 2048 : 1024, n.height = n.width / 2);
|
|
5014
|
-
const r =
|
|
5028
|
+
const r = Hn(t, n, On({ ...e, externalFrames: !i }), e.projection || "equirect");
|
|
5015
5029
|
return { ...r, destroy() {
|
|
5016
5030
|
r.destroy(), i || (n.width = n.height = 0);
|
|
5017
5031
|
} };
|
|
5018
5032
|
}
|
|
5019
5033
|
function Dc(t, e, i) {
|
|
5020
|
-
return
|
|
5034
|
+
return Hn(t, e, On({ ...i, externalFrames: !1 }), i.projection || "dual_fisheye");
|
|
5021
5035
|
}
|
|
5022
|
-
function
|
|
5036
|
+
function Jn(t) {
|
|
5023
5037
|
if (!Zi(t)) return;
|
|
5024
5038
|
const e = ea(t);
|
|
5025
5039
|
if (!e) return;
|
|
@@ -5041,14 +5055,14 @@ function Hn(t) {
|
|
|
5041
5055
|
};
|
|
5042
5056
|
}
|
|
5043
5057
|
async function Sc(t, e) {
|
|
5044
|
-
const i =
|
|
5058
|
+
const i = Jn(e), n = ea(e);
|
|
5045
5059
|
if (!i || !n) throw new B("calibration_missing", "Real-time stitching requires two calibrated side-by-side lenses.");
|
|
5046
5060
|
if (typeof VideoDecoder > "u" || typeof EncodedVideoChunk > "u")
|
|
5047
5061
|
throw new B("codec_unsupported", "This browser does not expose WebCodecs video decoding.");
|
|
5048
5062
|
const r = [...new Map(n.map(({ track: m }) => [m.id, m])).values()];
|
|
5049
5063
|
if (r.some((m) => m.timescale <= 0 || !m.samples.length))
|
|
5050
5064
|
throw new B("invalid_manifest", "The calibrated panorama tracks do not contain a playable sample timeline.");
|
|
5051
|
-
const o = r.map(
|
|
5065
|
+
const o = r.map(En);
|
|
5052
5066
|
if ((await Promise.all(o.map((m) => VideoDecoder.isConfigSupported(m)))).some((m) => !m.supported))
|
|
5053
5067
|
throw new B("codec_unsupported", "This browser cannot decode the calibrated panorama tracks.");
|
|
5054
5068
|
const a = document.createElement("canvas");
|
|
@@ -5067,7 +5081,7 @@ async function Sc(t, e) {
|
|
|
5067
5081
|
});
|
|
5068
5082
|
let l, u;
|
|
5069
5083
|
try {
|
|
5070
|
-
l = new
|
|
5084
|
+
l = new zn(t, r, [], o, (m, d) => {
|
|
5071
5085
|
c.presentFrames(r.length === 1 ? [m] : [m, d], m.timestamp / 1e6);
|
|
5072
5086
|
}, async () => {
|
|
5073
5087
|
}, () => c.reset());
|
|
@@ -5162,7 +5176,7 @@ function Rc(t) {
|
|
|
5162
5176
|
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));
|
|
5163
5177
|
return f > 0 ? n / f : 1;
|
|
5164
5178
|
}
|
|
5165
|
-
function
|
|
5179
|
+
function Kn(t) {
|
|
5166
5180
|
var r;
|
|
5167
5181
|
const { width: e, height: i } = t;
|
|
5168
5182
|
if (!e || !i || t.lenses.length !== 2 || !["mei-extended", "equidistant"].includes(t.projection.kind)) return;
|
|
@@ -5208,7 +5222,7 @@ function Jn(t) {
|
|
|
5208
5222
|
};
|
|
5209
5223
|
}
|
|
5210
5224
|
function Pc(t, e) {
|
|
5211
|
-
const i =
|
|
5225
|
+
const i = Kn(e);
|
|
5212
5226
|
if (!i) throw new B("calibration_missing", "This DNG does not contain supported dual-fisheye calibration.");
|
|
5213
5227
|
if (Math.abs(t.naturalWidth / t.naturalHeight - i.imageSize[0] / i.imageSize[1]) > 5e-3)
|
|
5214
5228
|
throw new B("invalid_manifest", "The developed DNG preview does not preserve the calibrated sensor geometry.");
|
|
@@ -5268,7 +5282,7 @@ function xi([t, e, i, n], [r, o, s]) {
|
|
|
5268
5282
|
const a = e * r + i * o + n * s, c = t * t - e * e - i * i - n * n;
|
|
5269
5283
|
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)];
|
|
5270
5284
|
}
|
|
5271
|
-
const Ac = "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.",
|
|
5285
|
+
const Ac = "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.", Lc = /* @__PURE__ */ new Set(["insp", "insv", "osv"]), wn = /* @__PURE__ */ new Set(["insv", "osv"]), Fn = [
|
|
5272
5286
|
{
|
|
5273
5287
|
extensions: ["pano", "panorama", "360", "insp"],
|
|
5274
5288
|
family: "panorama",
|
|
@@ -5284,7 +5298,7 @@ const Ac = "Panorama is not close to a 2:1 equirectangular projection; raw dual-
|
|
|
5284
5298
|
contentTypes: ["video/panorama", "video/x-panorama", "video/x-insta360", "video/x-osmo360", "application/vnd.filens.panorama+video"]
|
|
5285
5299
|
}
|
|
5286
5300
|
];
|
|
5287
|
-
class
|
|
5301
|
+
class Zn {
|
|
5288
5302
|
constructor(e, i = {}, n) {
|
|
5289
5303
|
A(this, "listeners", {
|
|
5290
5304
|
loading: /* @__PURE__ */ new Set(),
|
|
@@ -5377,7 +5391,7 @@ class Kn {
|
|
|
5377
5391
|
}, this.emit("loading", this.state), this.emit("statechange", this.state);
|
|
5378
5392
|
try {
|
|
5379
5393
|
(s = i.signal) != null && s.aborted && n.abort(), H(r), this.osmoFallbackReason = "";
|
|
5380
|
-
const p = new
|
|
5394
|
+
const p = new Lo(), m = new _o(this.scaleToFov(this.state.scale), 1, 1, 1100), d = ((a = i.route) == null ? void 0 : a.family) === "panorama-video", h = Di(i.descriptor.extension ?? ((c = i.route) == null ? void 0 : c.sourceFormat)), g = jc(h, i.descriptor.contentType);
|
|
5381
5395
|
this.state.family = d ? "panorama-video" : "panorama", this.state.capabilities = {
|
|
5382
5396
|
...this.state.capabilities,
|
|
5383
5397
|
playback: d,
|
|
@@ -5390,7 +5404,7 @@ class Kn {
|
|
|
5390
5404
|
return;
|
|
5391
5405
|
}
|
|
5392
5406
|
if (h === "insv" && this.osmoFallbackReason) throw new Error(`INSV ${this.osmoFallbackReason}`);
|
|
5393
|
-
const x = new
|
|
5407
|
+
const x = new Uo({
|
|
5394
5408
|
antialias: !0,
|
|
5395
5409
|
alpha: !1,
|
|
5396
5410
|
preserveDrawingBuffer: !0
|
|
@@ -5403,20 +5417,20 @@ class Kn {
|
|
|
5403
5417
|
if (H(r), h === "insp" && o) {
|
|
5404
5418
|
const T = await o.open(v, { format: "insp", signal: r });
|
|
5405
5419
|
if (H(r), T.projection.kind === "mei-extended") {
|
|
5406
|
-
const
|
|
5407
|
-
H(r), this.texture =
|
|
5408
|
-
const
|
|
5409
|
-
H(r),
|
|
5420
|
+
const L = await le(new $r().loadAsync(this.sourceToUrl(v, g)), r, (k) => k.dispose());
|
|
5421
|
+
H(r), this.texture = L, L.anisotropy = x.capabilities.getMaxAnisotropy();
|
|
5422
|
+
const _ = await le(us(o, T, L), r, (k) => k.close());
|
|
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, m);
|
|
5410
5424
|
return;
|
|
5411
5425
|
}
|
|
5412
5426
|
if (o.close(), T.projection.kind === "unknown")
|
|
5413
5427
|
throw new Error(T.warnings[0] || "INSP contains an unsupported raw dual-fisheye image.");
|
|
5414
5428
|
}
|
|
5415
5429
|
const w = d ? await le(this.createVideoTexture(v, g, r), r, (T) => T.dispose()) : await le(new $r().loadAsync(this.sourceToUrl(v, g)), r, (T) => T.dispose());
|
|
5416
|
-
H(r), this.texture = w, w.colorSpace = Hi, w.anisotropy = x.capabilities.getMaxAnisotropy(), w.minFilter =
|
|
5430
|
+
H(r), this.texture = w, w.colorSpace = Hi, w.anisotropy = x.capabilities.getMaxAnisotropy(), w.minFilter = Ft, w.generateMipmaps = !1;
|
|
5417
5431
|
const S = new Ji(500, 64, 40);
|
|
5418
5432
|
S.scale(-1, 1, 1);
|
|
5419
|
-
const D = new
|
|
5433
|
+
const D = new Eo({
|
|
5420
5434
|
map: w
|
|
5421
5435
|
});
|
|
5422
5436
|
p.add(new Ki(S, D)), this.renderer = x, this.scene = p, this.camera = m, this.texture = w, this.geometry = S, this.material = D, this.state.proxyPreview = this.state.proxyPreview || h === "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) || Ec(w), this.state.naturalHeight = ((f = this.video) == null ? void 0 : f.videoHeight) || Cc(w);
|
|
@@ -5590,13 +5604,13 @@ class Kn {
|
|
|
5590
5604
|
let a, c;
|
|
5591
5605
|
try {
|
|
5592
5606
|
const y = i === "insv" ? await le(this.resolveInstaCompanion(n), r) : void 0;
|
|
5593
|
-
H(r), c =
|
|
5607
|
+
H(r), c = _c(e, y, n);
|
|
5594
5608
|
const p = i === "insv" ? await le(this.resolveInstaSidecar(c.primaryName), r) : void 0;
|
|
5595
5609
|
H(r), a = await s.open(c.source, { format: i, sidecar: p, companion: c.companion, signal: r }), H(r);
|
|
5596
|
-
const m = a.projection.kind === "unknown" && a.tracks.length === 1 &&
|
|
5610
|
+
const m = a.projection.kind === "unknown" && a.tracks.length === 1 && eo(a.tracks[0].width, a.tracks[0].height);
|
|
5597
5611
|
if (a.projection.kind === "equirectangular" || m)
|
|
5598
5612
|
return this.state.vendor = a.vendor, this.state.cameraModel = a.cameraModel, this.state.calibrationSource = a.calibrationSource, this.state.projection = m ? "equirectangular" : a.projection.kind, this.state.proxyPreview = !!a.proxyPreview || m, this.state.warnings = m ? [...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;
|
|
5599
|
-
const d = await le(
|
|
5613
|
+
const d = await le(Jn(a) && !((l = a.imu) != null && l.imuToCameraConfirmed) ? Sc(s, a) : fs(s, a), r, (h) => h.close());
|
|
5600
5614
|
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;
|
|
5601
5615
|
} catch (y) {
|
|
5602
5616
|
if (H(r), s.close(), i === "insv" && a && c && y instanceof B && y.code === "codec_unsupported")
|
|
@@ -5727,19 +5741,19 @@ class Kn {
|
|
|
5727
5741
|
n(i);
|
|
5728
5742
|
}
|
|
5729
5743
|
}
|
|
5730
|
-
function
|
|
5744
|
+
function $c(t = {}) {
|
|
5731
5745
|
return {
|
|
5732
5746
|
id: "panorama",
|
|
5733
5747
|
family: "panorama",
|
|
5734
5748
|
supports: (e) => ["pano", "panorama", "360", "insp", "360v", "vr360", "insv", "osv"].includes(Di(e)),
|
|
5735
|
-
createSession: (e, i) => new
|
|
5749
|
+
createSession: (e, i) => new Zn(e, i, t.processor)
|
|
5736
5750
|
};
|
|
5737
5751
|
}
|
|
5738
|
-
function
|
|
5752
|
+
function Yc(t = Ro()) {
|
|
5739
5753
|
const e = new Set(Fn.flatMap((i) => i.extensions));
|
|
5740
5754
|
return [...Fn, ...t.filter((i) => !i.extensions.some((n) => e.has(n)))];
|
|
5741
5755
|
}
|
|
5742
|
-
function
|
|
5756
|
+
function _c(t, e, i) {
|
|
5743
5757
|
return e && i && /_10_/i.test(i) ? { source: e, companion: t, primaryName: i.replace(/_10_/i, "_00_") } : { source: t, companion: e, primaryName: i };
|
|
5744
5758
|
}
|
|
5745
5759
|
function Uc(t) {
|
|
@@ -5759,18 +5773,18 @@ function Cc(t) {
|
|
|
5759
5773
|
const e = t.image;
|
|
5760
5774
|
return (e == null ? void 0 : e.naturalHeight) ?? (e == null ? void 0 : e.height);
|
|
5761
5775
|
}
|
|
5762
|
-
function
|
|
5776
|
+
function eo(t, e) {
|
|
5763
5777
|
if (!t || !e)
|
|
5764
5778
|
return !1;
|
|
5765
5779
|
const i = t / e;
|
|
5766
5780
|
return i >= 1.8 && i <= 2.2;
|
|
5767
5781
|
}
|
|
5768
5782
|
function Ic(t, e) {
|
|
5769
|
-
return t && e && !
|
|
5783
|
+
return t && e && !eo(t, e) ? Ac : void 0;
|
|
5770
5784
|
}
|
|
5771
5785
|
function zc(t, e) {
|
|
5772
5786
|
const i = Di(e);
|
|
5773
|
-
return t instanceof Error && t.message.startsWith(i.toUpperCase()) ? t :
|
|
5787
|
+
return t instanceof Error && t.message.startsWith(i.toUpperCase()) ? t : Lc.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));
|
|
5774
5788
|
}
|
|
5775
5789
|
function Bc(t) {
|
|
5776
5790
|
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);
|
|
@@ -5810,14 +5824,14 @@ function Dn(t) {
|
|
|
5810
5824
|
function Di(t) {
|
|
5811
5825
|
return String(t ?? "").trim().replace(/^\./, "").toLowerCase();
|
|
5812
5826
|
}
|
|
5813
|
-
const
|
|
5827
|
+
const Qc = [{
|
|
5814
5828
|
extensions: ["dng"],
|
|
5815
5829
|
family: "image",
|
|
5816
5830
|
driverId: "raw-image",
|
|
5817
5831
|
targetFormat: "jpg",
|
|
5818
5832
|
contentTypes: ["image/dng", "image/x-adobe-dng"]
|
|
5819
5833
|
}];
|
|
5820
|
-
function
|
|
5834
|
+
function Hc(t) {
|
|
5821
5835
|
return {
|
|
5822
5836
|
id: "raw-image",
|
|
5823
5837
|
family: "image",
|
|
@@ -5850,11 +5864,11 @@ class Oc {
|
|
|
5850
5864
|
try {
|
|
5851
5865
|
(a = i.signal) != null && a.aborted && n.abort(), H(r);
|
|
5852
5866
|
const c = s ? await le(s.open(e, { format: "dng", signal: r }), r) : void 0;
|
|
5853
|
-
if (H(r), c &&
|
|
5867
|
+
if (H(r), c && Kn(c)) {
|
|
5854
5868
|
if (!(s != null && s.decodeImage)) throw new Error("Calibrated DNG preview requires a panorama processor with WASM image decoding.");
|
|
5855
5869
|
const l = await le(s.decodeImage(r), r);
|
|
5856
5870
|
H(r), s.close();
|
|
5857
|
-
const u = new
|
|
5871
|
+
const u = new Zn(this.host, this.options);
|
|
5858
5872
|
this.attach(u), await le(u.loadCalibratedImage(l, c, o), r);
|
|
5859
5873
|
} else {
|
|
5860
5874
|
s == null || s.close();
|
|
@@ -5867,7 +5881,7 @@ class Oc {
|
|
|
5867
5881
|
H(r);
|
|
5868
5882
|
const u = [...(c == null ? void 0 : c.warnings) ?? [], ...l.warnings ?? []];
|
|
5869
5883
|
this.state.warnings = u, u.length && this.emit("warnings", u), H(r);
|
|
5870
|
-
const f =
|
|
5884
|
+
const f = Po().createSession(this.host, this.options);
|
|
5871
5885
|
this.attach(f, u), await le(f.load(l.source, {
|
|
5872
5886
|
...o,
|
|
5873
5887
|
descriptor: { ...i.descriptor, source: l.source, extension: l.format, contentType: l.contentType },
|
|
@@ -5930,11 +5944,13 @@ class Oc {
|
|
|
5930
5944
|
}
|
|
5931
5945
|
}
|
|
5932
5946
|
export {
|
|
5933
|
-
|
|
5947
|
+
Qc as R,
|
|
5934
5948
|
Xc as a,
|
|
5935
|
-
|
|
5949
|
+
$c as b,
|
|
5936
5950
|
$i as c,
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5951
|
+
Hc as d,
|
|
5952
|
+
Yc as e,
|
|
5953
|
+
as as f,
|
|
5954
|
+
qc as g,
|
|
5955
|
+
Se as t
|
|
5940
5956
|
};
|