filens-preview 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -13
- package/dist/all-in-one/THIRD-PARTY-NOTICES.txt +969 -0
- package/dist/all-in-one/archive/7zz.wasm +0 -0
- package/dist/all-in-one/assets/archive-worker-Cy3bEdVg.js +2 -0
- package/dist/all-in-one/filens.js +70557 -64591
- package/dist/all-in-one/index.html +12 -3
- package/dist/index.d.ts +5 -0
- package/dist/split/THIRD-PARTY-NOTICES.txt +969 -0
- package/dist/split/archive/7zz.wasm +0 -0
- package/dist/split/assets/archive-worker-Cy3bEdVg.js +2 -0
- package/dist/split/assets/{iwork-worker-DiTOJG8f.js → iwork-worker-B9KPoDW3.js} +17 -17
- package/dist/split/chunks/archive-B4jVwD9o.js +921 -0
- package/dist/split/chunks/{cad-Cyh8aipO.js → cad-DMg-lGJX.js} +1 -1
- package/dist/split/chunks/{core-gp02JQ3r.js → core--zVW212C.js} +4205 -3760
- package/dist/split/chunks/{diagram-rxvArV-1.js → diagram-CDwCA6LZ.js} +2 -2
- package/dist/split/chunks/{docx-ecvZsSWm.js → docx-CuQfFJqr.js} +2 -2
- package/dist/split/chunks/{ebook-5FyKWZ8s.js → ebook-CLlJ8KX3.js} +2 -2
- package/dist/split/chunks/{iwork-DlaehzuR.js → iwork-dNVC0X8j.js} +39 -39
- package/dist/split/chunks/media-runtime-gcsBQMuo.js +48 -0
- package/dist/split/chunks/{mindmap-D9lNNDoa.js → mindmap-g0-VoK-K.js} +2 -2
- package/dist/split/chunks/{model3d-BtFT01ZH.js → model3d-1G1CC52V.js} +3 -3
- package/dist/split/chunks/{panorama-Ci6DK6sa.js → panorama-D7GVivtM.js} +246 -234
- package/dist/split/chunks/{vendor-DvWhw-zP.js → vendor-DPFNKNkh.js} +28487 -23383
- package/dist/split/chunks/{xlsx-VJTu9XNS.js → xlsx-Co26yo-R.js} +2 -2
- package/dist/split/filens.js +2714 -2483
- package/dist/split/index.html +12 -3
- package/package.json +2 -2
- package/dist/split/chunks/archive-_cUUL2-3.js +0 -731
- package/dist/split/chunks/media-runtime-DwW7eq4g.js +0 -48
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var ko = Object.defineProperty;
|
|
2
2
|
var Ro = (t, e, i) => e in t ? ko(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
3
|
var A = (t, e, i) => Ro(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import {
|
|
5
|
-
import { S as Ji,
|
|
4
|
+
import { w as kn, c as Po, x as Ao } from "./core--zVW212C.js";
|
|
5
|
+
import { ac as Lo, S as Ji, ad as Ft, ae as Ta, af as ka, ag as Ra, ah as Ki, j as Zi, ai as _o, aj as Pa, ak as Rn, m as Uo, o as Eo, a9 as Co, al as Yr, w as Io } from "./vendor-DPFNKNkh.js";
|
|
6
6
|
function Se(t) {
|
|
7
7
|
if (t != null && t.aborted) throw Pn();
|
|
8
8
|
}
|
|
@@ -34,23 +34,23 @@ function Aa(t) {
|
|
|
34
34
|
return e;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function zo(t) {
|
|
38
38
|
return /^(?:https?:|blob:|\/|\.{1,2}\/)/i.test(t);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Bo(t) {
|
|
41
41
|
return t.trimStart().toLowerCase().startsWith("data:");
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function jo(t) {
|
|
44
44
|
const e = atob(t), i = new Uint8Array(e.length);
|
|
45
45
|
for (let n = 0; n < i.length; n++) i[n] = e.charCodeAt(n);
|
|
46
46
|
return i;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function No(t) {
|
|
49
49
|
var c;
|
|
50
50
|
const e = t.trimStart(), i = e.indexOf(",");
|
|
51
51
|
if (i < 0) throw new Error("Conversion data URL is missing its payload separator.");
|
|
52
52
|
const n = e.slice(0, i), r = e.slice(i + 1), o = (c = n.match(/^data:([^;,]+)/i)) == null ? void 0 : c[1];
|
|
53
|
-
if (/;base64$/i.test(n)) return { bytes:
|
|
53
|
+
if (/;base64$/i.test(n)) return { bytes: jo(r), contentType: o };
|
|
54
54
|
const s = new TextEncoder().encode(r);
|
|
55
55
|
let a = 0;
|
|
56
56
|
for (let l = 0; l < s.length; l++) {
|
|
@@ -71,16 +71,16 @@ function Qr(t) {
|
|
|
71
71
|
return e >= 97 && e <= 102 ? e - 87 : -1;
|
|
72
72
|
}
|
|
73
73
|
async function An(t, e = globalThis.fetch, i) {
|
|
74
|
-
if (
|
|
74
|
+
if (Oo(t))
|
|
75
75
|
return new Uint8Array(await wt(t.arrayBuffer(), i));
|
|
76
76
|
if (t instanceof ArrayBuffer)
|
|
77
77
|
return new Uint8Array(t);
|
|
78
78
|
if (ArrayBuffer.isView(t))
|
|
79
79
|
return new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
80
80
|
if (typeof t == "string") {
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
83
|
-
if (
|
|
81
|
+
if (Bo(t))
|
|
82
|
+
return No(t).bytes;
|
|
83
|
+
if (zo(t)) {
|
|
84
84
|
if (!e) throw new Error("A fetch implementation is required to load a conversion source URL.");
|
|
85
85
|
const n = await wt(e(t, { signal: i }), i);
|
|
86
86
|
if (Se(i), !n.ok)
|
|
@@ -91,9 +91,19 @@ async function An(t, e = globalThis.fetch, i) {
|
|
|
91
91
|
}
|
|
92
92
|
throw new Error("Unsupported conversion source type.");
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Oo(t) {
|
|
95
95
|
return typeof t == "object" && t !== null && "arrayBuffer" in t && typeof t.arrayBuffer == "function";
|
|
96
96
|
}
|
|
97
|
+
async function Vo(t) {
|
|
98
|
+
var i;
|
|
99
|
+
if (((i = t.headers.get("content-type")) == null ? void 0 : i.split(";", 1)[0]) !== "application/wasm+gzip") return t;
|
|
100
|
+
if (typeof DecompressionStream < "u" && t.body)
|
|
101
|
+
return new Response(t.body.pipeThrough(new DecompressionStream("gzip")), {
|
|
102
|
+
headers: { "content-type": "application/wasm" }
|
|
103
|
+
});
|
|
104
|
+
const e = Lo(new Uint8Array(await t.arrayBuffer()));
|
|
105
|
+
return new Response(e, { headers: { "content-type": "application/wasm" } });
|
|
106
|
+
}
|
|
97
107
|
function wi(t) {
|
|
98
108
|
const e = Aa(() => Ln(t.wasm, t.fetch));
|
|
99
109
|
return async (i) => {
|
|
@@ -132,27 +142,29 @@ async function Ln(t, e = globalThis.fetch) {
|
|
|
132
142
|
const i = typeof t == "function" ? await t() : await t;
|
|
133
143
|
if (i instanceof WebAssembly.Module)
|
|
134
144
|
return i;
|
|
135
|
-
if (typeof i == "string" ||
|
|
145
|
+
if (typeof i == "string" || Wo(i)) {
|
|
136
146
|
if (!e)
|
|
137
147
|
throw new Error("A fetch implementation is required to load converter WASM from a URL.");
|
|
138
148
|
return Hr(await e(String(i)));
|
|
139
149
|
}
|
|
140
150
|
return typeof Response < "u" && i instanceof Response ? Hr(i) : WebAssembly.compile(i);
|
|
141
151
|
}
|
|
142
|
-
function
|
|
152
|
+
function Wo(t) {
|
|
143
153
|
return typeof URL < "u" && t instanceof URL;
|
|
144
154
|
}
|
|
145
155
|
async function Hr(t) {
|
|
156
|
+
var i;
|
|
146
157
|
if (!t.ok)
|
|
147
158
|
throw new Error(`Failed to fetch converter WASM: ${t.status} ${t.statusText}`.trim());
|
|
148
|
-
|
|
159
|
+
const e = await Vo(t);
|
|
160
|
+
return typeof WebAssembly.compileStreaming == "function" && ((i = e.headers.get("content-type")) == null ? void 0 : i.split(";", 1)[0]) === "application/wasm" ? WebAssembly.compileStreaming(e) : WebAssembly.compile(await e.arrayBuffer());
|
|
149
161
|
}
|
|
150
162
|
class _n extends Error {
|
|
151
163
|
constructor(e) {
|
|
152
164
|
super(`WASI exited with code ${e}`), this.code = e;
|
|
153
165
|
}
|
|
154
166
|
}
|
|
155
|
-
const Q = 0, ge = 8,
|
|
167
|
+
const Q = 0, ge = 8, qo = 20, Jr = 28, hi = 31, mi = 44, Kr = 54, pa = 55, Un = 2, ba = 3, wa = 4, Zr = 1, Go = 2, Xo = 4, $o = 8, en = 1;
|
|
156
168
|
class En {
|
|
157
169
|
constructor(e) {
|
|
158
170
|
A(this, "imports", {
|
|
@@ -231,7 +243,7 @@ class En {
|
|
|
231
243
|
return new DataView(this.memory.buffer);
|
|
232
244
|
}
|
|
233
245
|
argsSizesGet(e, i) {
|
|
234
|
-
return this.view.setUint32(e, this.args.length, !0), this.view.setUint32(i,
|
|
246
|
+
return this.view.setUint32(e, this.args.length, !0), this.view.setUint32(i, Yo(this.args), !0), Q;
|
|
235
247
|
}
|
|
236
248
|
argsGet(e, i) {
|
|
237
249
|
return this.writeStringList(this.args, e, i);
|
|
@@ -247,7 +259,7 @@ class En {
|
|
|
247
259
|
}
|
|
248
260
|
fdFdstatGet(e, i) {
|
|
249
261
|
const n = this.fds.get(e);
|
|
250
|
-
return n ? (this.bytes.fill(0, i, i + 24), this.bytes[i] =
|
|
262
|
+
return n ? (this.bytes.fill(0, i, i + 24), this.bytes[i] = Qo(n), this.view.setBigUint64(i + 8, 0xffffffffffffffffn, !0), this.view.setBigUint64(i + 16, 0xffffffffffffffffn, !0), Q) : ge;
|
|
251
263
|
}
|
|
252
264
|
fdFilestatGet(e, i) {
|
|
253
265
|
var r;
|
|
@@ -331,12 +343,12 @@ class En {
|
|
|
331
343
|
const a = this.readPath(e, i, n);
|
|
332
344
|
if (!a)
|
|
333
345
|
return ge;
|
|
334
|
-
if (r & Zr && r &
|
|
335
|
-
return
|
|
336
|
-
if (!!(r &
|
|
346
|
+
if (r & Zr && r & Xo && (this.files.has(a) || this.dirs.has(a)))
|
|
347
|
+
return qo;
|
|
348
|
+
if (!!(r & Go))
|
|
337
349
|
return this.dirs.has(a) ? this.openDescriptor({ kind: "dir", path: a, position: 0 }, s) : this.files.has(a) ? Kr : mi;
|
|
338
350
|
if (this.files.has(a))
|
|
339
|
-
r &
|
|
351
|
+
r & $o && this.files.set(a, new Uint8Array());
|
|
340
352
|
else {
|
|
341
353
|
if (!(r & Zr))
|
|
342
354
|
return this.dirs.has(a) ? hi : mi;
|
|
@@ -403,7 +415,7 @@ class En {
|
|
|
403
415
|
if (!r || r.kind !== "dir")
|
|
404
416
|
return null;
|
|
405
417
|
const o = new TextDecoder().decode(this.bytes.subarray(i, i + n));
|
|
406
|
-
return
|
|
418
|
+
return Ho(r.path, o);
|
|
407
419
|
}
|
|
408
420
|
openDescriptor(e, i) {
|
|
409
421
|
const n = this.nextFd++;
|
|
@@ -435,10 +447,10 @@ class En {
|
|
|
435
447
|
s.set(i, r), this.files.set(e.path, s), e.position = r + i.byteLength;
|
|
436
448
|
}
|
|
437
449
|
}
|
|
438
|
-
function
|
|
450
|
+
function Yo(t) {
|
|
439
451
|
return t.reduce((e, i) => e + new TextEncoder().encode(i).byteLength + 1, 0);
|
|
440
452
|
}
|
|
441
|
-
function
|
|
453
|
+
function Qo(t) {
|
|
442
454
|
switch (t.kind) {
|
|
443
455
|
case "dir":
|
|
444
456
|
return ba;
|
|
@@ -448,7 +460,7 @@ function $o(t) {
|
|
|
448
460
|
return Un;
|
|
449
461
|
}
|
|
450
462
|
}
|
|
451
|
-
function
|
|
463
|
+
function Ho(t, e) {
|
|
452
464
|
return e.startsWith("/") ? qt(e) : qt(`${t}/${e}`);
|
|
453
465
|
}
|
|
454
466
|
function qt(t) {
|
|
@@ -470,7 +482,7 @@ function ya(t) {
|
|
|
470
482
|
const i = e.lastIndexOf("/");
|
|
471
483
|
return i <= 0 ? "/" : e.slice(0, i);
|
|
472
484
|
}
|
|
473
|
-
const
|
|
485
|
+
const Jo = [
|
|
474
486
|
{
|
|
475
487
|
sourceFormat: "dng",
|
|
476
488
|
targetFormat: "jpg"
|
|
@@ -563,14 +575,14 @@ const Qo = [
|
|
|
563
575
|
sourceFormat: "icns",
|
|
564
576
|
targetFormat: "png"
|
|
565
577
|
}
|
|
566
|
-
],
|
|
578
|
+
], Ko = new Set(
|
|
567
579
|
kn.map((t) => ut(t.sourceFormat))
|
|
568
|
-
),
|
|
580
|
+
), Zo = new Set(
|
|
569
581
|
kn.map(
|
|
570
582
|
(t) => `${ut(t.sourceFormat)}->${ut(t.targetFormat)}`
|
|
571
583
|
)
|
|
572
|
-
),
|
|
573
|
-
|
|
584
|
+
), es = new Set(
|
|
585
|
+
Jo.map(
|
|
574
586
|
(t) => `${ut(t.sourceFormat)}->${ut(t.targetFormat)}`
|
|
575
587
|
)
|
|
576
588
|
);
|
|
@@ -579,17 +591,17 @@ class Qi extends Error {
|
|
|
579
591
|
super(e.errorMessage || e.errorCode || "WASM conversion failed."), this.result = e, this.name = "WasmConversionError";
|
|
580
592
|
}
|
|
581
593
|
}
|
|
582
|
-
function
|
|
583
|
-
const e = wi(t), i = t.officeWasm ? wi({ wasm: t.officeWasm, fetch: t.fetch }) : void 0, n = t.imageWasm ? Aa(() => Ln(t.imageWasm, t.fetch)) : void 0, r = t.imageWasm ? wi({ wasm: n, fetch: t.fetch }) : void 0, o = n ?
|
|
594
|
+
function Yc(t) {
|
|
595
|
+
const e = wi(t), i = t.officeWasm ? wi({ wasm: t.officeWasm, fetch: t.fetch }) : void 0, n = t.imageWasm ? Aa(() => Ln(t.imageWasm, t.fetch)) : void 0, r = t.imageWasm ? wi({ wasm: n, fetch: t.fetch }) : void 0, o = n ? ts(n) : void 0;
|
|
584
596
|
return {
|
|
585
597
|
async convert(s, a) {
|
|
586
598
|
Se(a.signal);
|
|
587
|
-
const c = ut(s.sourceFormat), l = ut(s.targetFormat), u =
|
|
599
|
+
const c = ut(s.sourceFormat), l = ut(s.targetFormat), u = is(c, l), f = `/work/input.${c}`, y = `/work/output.${l}`, p = "/work/options.json", h = "/work/result.json", d = await An(s.source, t.fetch, a.signal);
|
|
588
600
|
Se(a.signal);
|
|
589
601
|
const m = JSON.stringify({
|
|
590
602
|
...s.password ? { password: s.password } : {},
|
|
591
603
|
...s.locale ? { locale: s.locale } : {}
|
|
592
|
-
}), g = !!(r &&
|
|
604
|
+
}), g = !!(r && es.has(u));
|
|
593
605
|
if (g && l === "jpg" && o) {
|
|
594
606
|
const D = await o(d, a.signal);
|
|
595
607
|
if (Se(a.signal), D) return D;
|
|
@@ -641,7 +653,7 @@ function tn(t, e) {
|
|
|
641
653
|
errorMessage: t.errorMessage || `converter WASM exited with code ${e}`
|
|
642
654
|
});
|
|
643
655
|
}
|
|
644
|
-
function
|
|
656
|
+
function ts(t) {
|
|
645
657
|
const e = Aa(async () => {
|
|
646
658
|
const i = await t(), n = new Set(WebAssembly.Module.exports(i).map((s) => s.name));
|
|
647
659
|
if (!["filens_image_alloc", "filens_image_free", "filens_image_preview", "memory"].every((s) => n.has(s))) return null;
|
|
@@ -667,11 +679,11 @@ function Zo(t) {
|
|
|
667
679
|
}
|
|
668
680
|
};
|
|
669
681
|
}
|
|
670
|
-
function
|
|
682
|
+
function is(t, e) {
|
|
671
683
|
const i = `${t}->${e}`;
|
|
672
|
-
if (
|
|
684
|
+
if (Zo.has(i))
|
|
673
685
|
return i;
|
|
674
|
-
const n =
|
|
686
|
+
const n = Ko.has(t) ? `unsupported conversion pair: ${t} -> ${e}` : `unsupported source format: ${t}`;
|
|
675
687
|
throw new Qi({
|
|
676
688
|
ok: !1,
|
|
677
689
|
sourceFormat: t,
|
|
@@ -692,7 +704,7 @@ function $i(t) {
|
|
|
692
704
|
function ut(t) {
|
|
693
705
|
return t.trim().replace(/^\./, "").toLowerCase();
|
|
694
706
|
}
|
|
695
|
-
function
|
|
707
|
+
function Qc() {
|
|
696
708
|
return {
|
|
697
709
|
async convert(t, e) {
|
|
698
710
|
const i = t.sourceFormat.replace(/^\./, "").toLowerCase(), n = t.targetFormat.replace(/^\./, "").toLowerCase();
|
|
@@ -701,7 +713,7 @@ function $c() {
|
|
|
701
713
|
Se(e.signal);
|
|
702
714
|
const r = ArrayBuffer.isView(t.source) ? t.source.slice() : t.source instanceof ArrayBuffer ? t.source.slice(0) : t.source, o = await An(r, globalThis.fetch, e.signal);
|
|
703
715
|
Se(e.signal);
|
|
704
|
-
const s = await wt(import("./media-runtime-
|
|
716
|
+
const s = await wt(import("./media-runtime-gcsBQMuo.js"), e.signal);
|
|
705
717
|
return Se(e.signal), s.convertMedia(o, i, e.signal);
|
|
706
718
|
}
|
|
707
719
|
};
|
|
@@ -719,7 +731,7 @@ function le(t, e, i) {
|
|
|
719
731
|
});
|
|
720
732
|
});
|
|
721
733
|
}
|
|
722
|
-
function
|
|
734
|
+
function as(t, e) {
|
|
723
735
|
const i = (n) => (H(e), le(n(), e));
|
|
724
736
|
return {
|
|
725
737
|
open: (n, r) => i(() => t.open(n, { ...r, signal: e })),
|
|
@@ -737,13 +749,13 @@ function ts(t, e) {
|
|
|
737
749
|
}
|
|
738
750
|
};
|
|
739
751
|
}
|
|
740
|
-
const an = 8, Mi = 64 << 20,
|
|
752
|
+
const an = 8, Mi = 64 << 20, rs = 128 << 20, rn = 120, ns = 8 << 20;
|
|
741
753
|
class B extends Error {
|
|
742
754
|
constructor(e, i) {
|
|
743
755
|
super(i), this.code = e, this.name = "PanoramaProcessorError";
|
|
744
756
|
}
|
|
745
757
|
}
|
|
746
|
-
function
|
|
758
|
+
function os(t) {
|
|
747
759
|
const e = t.fetch ?? globalThis.fetch, i = wi({ wasm: t.wasm, fetch: e }), n = t.imageWasm ? wi({ wasm: t.imageWasm, fetch: e }) : void 0, r = (l) => {
|
|
748
760
|
const u = new AbortController(), f = pi(u.signal, l);
|
|
749
761
|
return { controller: u, ...f, companionTrackIds: /* @__PURE__ */ new Map() };
|
|
@@ -822,8 +834,8 @@ function rs(t) {
|
|
|
822
834
|
if (!_) throw new B("invalid_manifest", "Panorama inspector did not return a result.");
|
|
823
835
|
const k = JSON.parse(new TextDecoder().decode(_));
|
|
824
836
|
if (k.ok && k.payload) {
|
|
825
|
-
if (m =
|
|
826
|
-
f.companionProcessor =
|
|
837
|
+
if (m = cs(k.payload), u.companion) {
|
|
838
|
+
f.companionProcessor = os(t);
|
|
827
839
|
const P = await f.companionProcessor.open(u.companion, {
|
|
828
840
|
format: u.format,
|
|
829
841
|
sidecar: u.sidecar,
|
|
@@ -837,7 +849,7 @@ function rs(t) {
|
|
|
837
849
|
}), G = P.lenses.map((J) => ({
|
|
838
850
|
...J,
|
|
839
851
|
sourceTrackId: J.sourceTrackId === void 0 ? void 0 : j.get(J.sourceTrackId)
|
|
840
|
-
})), te = [...m.tracks, ...q], ne =
|
|
852
|
+
})), te = [...m.tracks, ...q], ne = ds(us(m.lenses, G), te), ue = [...m.warnings, ...P.warnings];
|
|
841
853
|
m = {
|
|
842
854
|
...m,
|
|
843
855
|
cameraModel: m.cameraModel || P.cameraModel,
|
|
@@ -910,7 +922,7 @@ function rs(t) {
|
|
|
910
922
|
if (!Number.isSafeInteger(l) || !Number.isSafeInteger(u) || l < 0 || u < 0 || u > rn)
|
|
911
923
|
throw new B("resource_limit", `Panorama metadata windows are limited to ${rn} samples.`);
|
|
912
924
|
const m = d.metadataTrack, g = m.samples.slice(l, l + u);
|
|
913
|
-
if (g.reduce((T, L) => T + L.size, 0) >
|
|
925
|
+
if (g.reduce((T, L) => T + L.size, 0) > ns) throw new B("resource_limit", "Panorama metadata window exceeds 8 MiB.");
|
|
914
926
|
const x = {}, v = [];
|
|
915
927
|
for (let T = 0; T < g.length; T += 1) {
|
|
916
928
|
const L = await c(y, m.id, l + T, p.signal), _ = `/work/metadata-${T}.bin`;
|
|
@@ -936,7 +948,7 @@ function rs(t) {
|
|
|
936
948
|
},
|
|
937
949
|
seek(l) {
|
|
938
950
|
const u = o.manifest;
|
|
939
|
-
return u ? Object.fromEntries(u.tracks.map((f) => [f.id,
|
|
951
|
+
return u ? Object.fromEntries(u.tracks.map((f) => [f.id, ls(f, l)])) : {};
|
|
940
952
|
},
|
|
941
953
|
async computeSeam(l, u) {
|
|
942
954
|
const f = pi(o.signal, u);
|
|
@@ -976,14 +988,14 @@ function rs(t) {
|
|
|
976
988
|
}
|
|
977
989
|
function Cn(t) {
|
|
978
990
|
return {
|
|
979
|
-
codec:
|
|
991
|
+
codec: fs(t),
|
|
980
992
|
codedWidth: t.width,
|
|
981
993
|
codedHeight: t.height,
|
|
982
994
|
description: In(t.decoderConfig),
|
|
983
995
|
optimizeForLatency: !0
|
|
984
996
|
};
|
|
985
997
|
}
|
|
986
|
-
function
|
|
998
|
+
function ss(t) {
|
|
987
999
|
return new EncodedVideoChunk({
|
|
988
1000
|
type: t.key ? "key" : "delta",
|
|
989
1001
|
timestamp: Math.round(t.pts * 1e6 / t.timescale),
|
|
@@ -991,7 +1003,7 @@ function ns(t) {
|
|
|
991
1003
|
data: t.data
|
|
992
1004
|
});
|
|
993
1005
|
}
|
|
994
|
-
function
|
|
1006
|
+
function cs(t) {
|
|
995
1007
|
var r;
|
|
996
1008
|
if (!t || !Array.isArray(t.tracks) || !Array.isArray(t.lenses))
|
|
997
1009
|
throw new B("invalid_manifest", "Panorama inspector returned an invalid manifest.");
|
|
@@ -1001,7 +1013,7 @@ function os(t) {
|
|
|
1001
1013
|
}));
|
|
1002
1014
|
return { ...t, projection: i, lenses: n };
|
|
1003
1015
|
}
|
|
1004
|
-
function
|
|
1016
|
+
function ls(t, e) {
|
|
1005
1017
|
const i = Math.max(0, e) * t.timescale;
|
|
1006
1018
|
let n = 0;
|
|
1007
1019
|
for (let r = 0; r < t.samples.length; r += 1) {
|
|
@@ -1011,7 +1023,7 @@ function ss(t, e) {
|
|
|
1011
1023
|
}
|
|
1012
1024
|
return n;
|
|
1013
1025
|
}
|
|
1014
|
-
function
|
|
1026
|
+
function us(t, e) {
|
|
1015
1027
|
const i = t.slice(0, 2), n = new Set(i.map(nn));
|
|
1016
1028
|
for (const r of e) {
|
|
1017
1029
|
if (i.length === 2) break;
|
|
@@ -1020,14 +1032,14 @@ function cs(t, e) {
|
|
|
1020
1032
|
}
|
|
1021
1033
|
return i;
|
|
1022
1034
|
}
|
|
1023
|
-
function
|
|
1035
|
+
function ds(t, e) {
|
|
1024
1036
|
return e.length < t.length ? t : t.map((i, n) => i.sourceTrackId === void 0 ? { ...i, sourceTrackId: e[n].id } : i);
|
|
1025
1037
|
}
|
|
1026
1038
|
function nn(t) {
|
|
1027
1039
|
const e = { ...t };
|
|
1028
1040
|
return delete e.sourceTrackId, delete e.sourceRect, JSON.stringify(e);
|
|
1029
1041
|
}
|
|
1030
|
-
function
|
|
1042
|
+
function fs(t) {
|
|
1031
1043
|
const e = In(t.decoderConfig);
|
|
1032
1044
|
if ((t.codec === "avc1" || t.codec === "avc3") && e.length >= 4)
|
|
1033
1045
|
return `${t.codec}.${[...e.slice(1, 4)].map((i) => i.toString(16).padStart(2, "0")).join("")}`;
|
|
@@ -1055,7 +1067,7 @@ async function on(t, e, i, n) {
|
|
|
1055
1067
|
let c = r.offset;
|
|
1056
1068
|
for (const u of s)
|
|
1057
1069
|
if (u.offset > c && a.push({ offset: c, length: Math.min(u.offset, o) - c }), c = Math.max(c, u.offset + u.bytes.length), c >= o) break;
|
|
1058
|
-
if (c < o && a.push({ offset: c, length: o - c }), s.reduce((u, f) => u + f.bytes.length, 0) + a.reduce((u, f) => u + f.length, 0) >
|
|
1070
|
+
if (c < o && a.push({ offset: c, length: o - c }), s.reduce((u, f) => u + f.bytes.length, 0) + a.reduce((u, f) => u + f.length, 0) > rs)
|
|
1059
1071
|
throw new B("resource_limit", "Panorama inspection exceeded its 128 MiB range budget.");
|
|
1060
1072
|
for (const u of a) {
|
|
1061
1073
|
const f = await t.read(u.offset, u.length, n);
|
|
@@ -1158,7 +1170,7 @@ function ie(t) {
|
|
|
1158
1170
|
if (t != null && t.aborted)
|
|
1159
1171
|
throw t.reason instanceof Error ? t.reason : new DOMException("The panorama operation was aborted.", "AbortError");
|
|
1160
1172
|
}
|
|
1161
|
-
async function
|
|
1173
|
+
async function hs(t, e, i) {
|
|
1162
1174
|
var y, p, h, d;
|
|
1163
1175
|
if (e.projection.kind !== "mei-extended" || !ea(e))
|
|
1164
1176
|
throw new B("calibration_missing", "This INSP does not contain two supported calibrated panorama lenses.");
|
|
@@ -1173,7 +1185,7 @@ async function ds(t, e, i) {
|
|
|
1173
1185
|
i.flipY = _a(e.textureOrigin), i.colorSpace = Ji, i.minFilter = Ft, i.generateMipmaps = !1, i.needsUpdate = !0;
|
|
1174
1186
|
const a = new Ta(new Uint8Array(128 * 64).fill(128), 128, 64, ka, Ra);
|
|
1175
1187
|
a.needsUpdate = !0, a.minFilter = Ft;
|
|
1176
|
-
const c =
|
|
1188
|
+
const c = ms(e, s, i, a);
|
|
1177
1189
|
Ua(c, e.lenses);
|
|
1178
1190
|
const l = new Ki(500, 96, 64);
|
|
1179
1191
|
l.scale(-1, 1, 1);
|
|
@@ -1204,7 +1216,7 @@ async function ds(t, e, i) {
|
|
|
1204
1216
|
setStabilization: () => "off"
|
|
1205
1217
|
};
|
|
1206
1218
|
}
|
|
1207
|
-
function
|
|
1219
|
+
function ms(t, e, i, n) {
|
|
1208
1220
|
const r = t.lenses.slice(0, 2);
|
|
1209
1221
|
return new Pa({
|
|
1210
1222
|
uniforms: {
|
|
@@ -1347,7 +1359,7 @@ function fs(t, e, i, n) {
|
|
|
1347
1359
|
`
|
|
1348
1360
|
});
|
|
1349
1361
|
}
|
|
1350
|
-
async function
|
|
1362
|
+
async function ps(t, e) {
|
|
1351
1363
|
if (!["dji-fisheye-lut", "mei-extended"].includes(e.projection.kind) || e.lenses.length < 2)
|
|
1352
1364
|
throw new B("calibration_missing", "This source does not contain two supported calibrated panorama lenses.");
|
|
1353
1365
|
if (!ea(e))
|
|
@@ -1363,7 +1375,7 @@ async function hs(t, e) {
|
|
|
1363
1375
|
const r = n.map(Cn);
|
|
1364
1376
|
if ((await Promise.all(r.map((m) => VideoDecoder.isConfigSupported(m)))).some((m) => !m.supported))
|
|
1365
1377
|
throw new B("codec_unsupported", `This browser cannot decode the ${[...new Set(n.map((m) => m.codec.toUpperCase()))].join("/")} panorama tracks.`);
|
|
1366
|
-
const s = n.map(() => new
|
|
1378
|
+
const s = n.map(() => new _o());
|
|
1367
1379
|
s.forEach((m) => {
|
|
1368
1380
|
m.flipY = _a(e.textureOrigin), m.colorSpace = Ji, m.minFilter = Ft;
|
|
1369
1381
|
});
|
|
@@ -1546,7 +1558,7 @@ async function hs(t, e) {
|
|
|
1546
1558
|
Ua(u, e.lenses);
|
|
1547
1559
|
const f = new Ki(500, 96, 64);
|
|
1548
1560
|
f.scale(-1, 1, 1);
|
|
1549
|
-
const y = new Zi(f, u), p = new jn(t, e, i, u, a), h = new
|
|
1561
|
+
const y = new Zi(f, u), p = new jn(t, e, i, u, a), h = new Ds(t, e, u), d = new Bn(t, n, s, r, (m, g) => {
|
|
1550
1562
|
h.apply(m.timestamp / 1e6), p.accept(m, g);
|
|
1551
1563
|
}, (m) => h.prepare(m), () => {
|
|
1552
1564
|
p.reset(), h.reset();
|
|
@@ -1587,7 +1599,7 @@ async function hs(t, e) {
|
|
|
1587
1599
|
setStabilization: (m) => h.setMode(m)
|
|
1588
1600
|
};
|
|
1589
1601
|
}
|
|
1590
|
-
async function
|
|
1602
|
+
async function ys(t, e, i) {
|
|
1591
1603
|
if (!["dji-fisheye-lut", "mei-extended"].includes(t.projection.kind) || t.lenses.length < 2)
|
|
1592
1604
|
throw new B("calibration_missing", "This source does not contain two supported calibrated panorama lenses.");
|
|
1593
1605
|
if (!ea(t))
|
|
@@ -1601,9 +1613,9 @@ async function ms(t, e, i) {
|
|
|
1601
1613
|
const o = /* @__PURE__ */ new Map();
|
|
1602
1614
|
for (const d of n)
|
|
1603
1615
|
o.has(d.track.id) || o.set(d.track.id, o.size === 0 || !i ? e : i);
|
|
1604
|
-
const s = r.map((d) =>
|
|
1616
|
+
const s = r.map((d) => gs(o.get(d.id) ?? e));
|
|
1605
1617
|
try {
|
|
1606
|
-
await Promise.all(s.map((d) =>
|
|
1618
|
+
await Promise.all(s.map((d) => xs(d)));
|
|
1607
1619
|
} catch (d) {
|
|
1608
1620
|
throw s.forEach((m) => m.remove()), s.forEach((m) => sn(m)), new B("codec_unsupported", d instanceof Error ? d.message : String(d));
|
|
1609
1621
|
}
|
|
@@ -1612,11 +1624,11 @@ async function ms(t, e, i) {
|
|
|
1612
1624
|
return m.flipY = _a(t.textureOrigin), m.colorSpace = Ji, m.minFilter = Ft, m;
|
|
1613
1625
|
}), c = new Ta(new Uint8Array(128 * 64).fill(128), 128, 64, ka, Ra);
|
|
1614
1626
|
c.needsUpdate = !0, c.minFilter = Ft;
|
|
1615
|
-
const l = t.lenses.slice(0, 2), u = n.map((d) => a[r.indexOf(d.track)]), f =
|
|
1627
|
+
const l = t.lenses.slice(0, 2), u = n.map((d) => a[r.indexOf(d.track)]), f = bs(t, l, n, u, c);
|
|
1616
1628
|
Ua(f, t.lenses);
|
|
1617
1629
|
const y = new Ki(500, 96, 64);
|
|
1618
1630
|
y.scale(-1, 1, 1);
|
|
1619
|
-
const p = new Zi(y, f), h = new
|
|
1631
|
+
const p = new Zi(y, f), h = new ws(s, a);
|
|
1620
1632
|
return h.play(), {
|
|
1621
1633
|
mesh: p,
|
|
1622
1634
|
update: () => h.update(),
|
|
@@ -1645,24 +1657,24 @@ async function ms(t, e, i) {
|
|
|
1645
1657
|
setStabilization: () => "off"
|
|
1646
1658
|
};
|
|
1647
1659
|
}
|
|
1648
|
-
function
|
|
1660
|
+
function gs(t) {
|
|
1649
1661
|
var i;
|
|
1650
1662
|
const e = document.createElement("video");
|
|
1651
1663
|
if (e.preload = "auto", e.muted = !0, e.loop = !0, e.playsInline = !0, e.crossOrigin = "anonymous", e.setAttribute("aria-hidden", "true"), e.style.display = "none", typeof t == "string" || t instanceof URL)
|
|
1652
1664
|
e.src = String(t);
|
|
1653
1665
|
else {
|
|
1654
|
-
const n = t instanceof Blob ? t : new Blob([
|
|
1666
|
+
const n = t instanceof Blob ? t : new Blob([vs(t)], { type: "video/mp4" }), r = URL.createObjectURL(n);
|
|
1655
1667
|
Fa.set(e, r), e.src = r;
|
|
1656
1668
|
}
|
|
1657
1669
|
return (i = document.body) == null || i.append(e), e.load(), e;
|
|
1658
1670
|
}
|
|
1659
|
-
function
|
|
1671
|
+
function vs(t) {
|
|
1660
1672
|
if (t instanceof ArrayBuffer) return t;
|
|
1661
1673
|
const e = new Uint8Array(t.buffer, t.byteOffset, t.byteLength), i = new Uint8Array(e.byteLength);
|
|
1662
1674
|
return i.set(e), i.buffer;
|
|
1663
1675
|
}
|
|
1664
1676
|
const Fa = /* @__PURE__ */ new WeakMap();
|
|
1665
|
-
function
|
|
1677
|
+
function xs(t) {
|
|
1666
1678
|
return t.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA ? Promise.resolve() : new Promise((e, i) => {
|
|
1667
1679
|
t.addEventListener("loadeddata", () => e(), { once: !0 }), t.addEventListener("error", () => i(new Error("The browser could not decode the calibrated INSV video track.")), { once: !0 });
|
|
1668
1680
|
});
|
|
@@ -1671,7 +1683,7 @@ function sn(t) {
|
|
|
1671
1683
|
const e = Fa.get(t);
|
|
1672
1684
|
e && (URL.revokeObjectURL(e), Fa.delete(t));
|
|
1673
1685
|
}
|
|
1674
|
-
function
|
|
1686
|
+
function bs(t, e, i, n, r) {
|
|
1675
1687
|
return new Pa({
|
|
1676
1688
|
uniforms: {
|
|
1677
1689
|
lens0: { value: n[0] },
|
|
@@ -1839,7 +1851,7 @@ function vs(t, e, i, n, r) {
|
|
|
1839
1851
|
`
|
|
1840
1852
|
});
|
|
1841
1853
|
}
|
|
1842
|
-
class
|
|
1854
|
+
class ws {
|
|
1843
1855
|
constructor(e, i) {
|
|
1844
1856
|
A(this, "isClosed", !1);
|
|
1845
1857
|
this.videos = e, this.textures = i;
|
|
@@ -1888,7 +1900,7 @@ class xs {
|
|
|
1888
1900
|
}
|
|
1889
1901
|
function ea(t) {
|
|
1890
1902
|
const e = t.lenses.slice(0, 2);
|
|
1891
|
-
if (e.length < 2 || !e.every((a) =>
|
|
1903
|
+
if (e.length < 2 || !e.every((a) => Ms(a, t.projection.kind)) || (t.cameraModel || "").replace(/^Insta360\s+/i, "").trim().toUpperCase() === "X5" && (!["embedded", "sidecar"].includes(t.calibrationSource) || !e.every((a) => a.distortionModel === "radtan_pro" ? Ke(a.distortionCoeffs, 13) : Ke(a.thinPrism, 4) && Ke(a.sensorTilt, 2)))) return !1;
|
|
1892
1904
|
const n = Fi(e[0].extrinsicQuaternion), r = Fi(e[1].extrinsicQuaternion);
|
|
1893
1905
|
if (Math.abs(n.reduce((a, c, l) => a + c * r[l], 0)) >= 0.999) return !1;
|
|
1894
1906
|
const o = cn(e[0], t.projection.kind), s = cn(e[1], t.projection.kind);
|
|
@@ -1904,10 +1916,10 @@ function ta(t) {
|
|
|
1904
1916
|
if (!(!i[0] || !i[1]) && !(i[0].track.id === i[1].track.id && !e.every((n) => n.sourceRect)))
|
|
1905
1917
|
return i;
|
|
1906
1918
|
}
|
|
1907
|
-
function
|
|
1919
|
+
function Fs(t, e, i, n) {
|
|
1908
1920
|
return [
|
|
1909
1921
|
i.rect.x + t * i.rect.width,
|
|
1910
|
-
i.rect.y +
|
|
1922
|
+
i.rect.y + Es(e, n) * i.rect.height
|
|
1911
1923
|
];
|
|
1912
1924
|
}
|
|
1913
1925
|
function Xt(t, e) {
|
|
@@ -1924,7 +1936,7 @@ function cn(t, e) {
|
|
|
1924
1936
|
const i = dt(t);
|
|
1925
1937
|
return Nn(e === "mei-extended" ? i : La(i), [0, 0, 1]);
|
|
1926
1938
|
}
|
|
1927
|
-
function
|
|
1939
|
+
function Ms(t, e) {
|
|
1928
1940
|
const i = [t.width, t.height, t.fx, t.fy, t.cx, t.cy], n = t.extrinsicQuaternion;
|
|
1929
1941
|
return !i.every((r) => typeof r == "number" && Number.isFinite(r)) || ![t.width, t.height, t.fx, t.fy].every((r) => Number(r) > 0) || Number(t.cx) < 0 || Number(t.cx) >= Number(t.width) || Number(t.cy) < 0 || Number(t.cy) >= Number(t.height) || (n == null ? void 0 : n.length) !== 4 || !n.every(Number.isFinite) || Math.hypot(...n) < 0.5 ? !1 : e === "dji-fisheye-lut" ? Ke(t.distortion, 4) && Ke(t.radialLut1, 14) && Ke(t.radialLut2, 14) : t.distortionModel === "radtan_pro" && !Ke(t.distortionCoeffs, 13) ? !1 : e === "mei-extended" && Number.isFinite(t.xi) && Number(t.xi) > 0 && Ke(t.radial, 4) && Ke(t.tangential, 2);
|
|
1930
1942
|
}
|
|
@@ -1951,7 +1963,7 @@ class Bn {
|
|
|
1951
1963
|
A(this, "seekEnd");
|
|
1952
1964
|
A(this, "streamSyncMs", 0);
|
|
1953
1965
|
this.processor = e, this.tracks = i, this.textures = n, this.configs = r, this.onPair = o, this.prepareImu = s, this.onSeek = a, this.queues = i.map(() => []), this.indexes = i.map(() => 0), this.currentFrames = i.map(() => {
|
|
1954
|
-
}), this.duration = Math.min(...i.map(
|
|
1966
|
+
}), this.duration = Math.min(...i.map(Xs)), this.seekEnd = Math.min(...i.map((c) => c.samples.at(-1).pts / c.timescale)), this.decoders = [];
|
|
1955
1967
|
try {
|
|
1956
1968
|
r.forEach((c, l) => {
|
|
1957
1969
|
const u = new VideoDecoder({
|
|
@@ -2036,7 +2048,7 @@ class Bn {
|
|
|
2036
2048
|
if (!n && c.pts / o.timescale > e || n && s > 0) break;
|
|
2037
2049
|
const l = await this.processor.readSample(o.id, a);
|
|
2038
2050
|
if (this.closed || i !== this.generation) return;
|
|
2039
|
-
this.decoders[r].decode(
|
|
2051
|
+
this.decoders[r].decode(ss(l)), this.indexes[r] += 1, s += 1;
|
|
2040
2052
|
}
|
|
2041
2053
|
}
|
|
2042
2054
|
}
|
|
@@ -2084,7 +2096,7 @@ class Bn {
|
|
|
2084
2096
|
(n = this.currentFrames[e]) == null || n.close(), this.currentFrames[e] = i, (r = this.textures[e]) == null || r.setFrame(i);
|
|
2085
2097
|
}
|
|
2086
2098
|
}
|
|
2087
|
-
class
|
|
2099
|
+
class Ds {
|
|
2088
2100
|
constructor(e, i, n) {
|
|
2089
2101
|
A(this, "available");
|
|
2090
2102
|
A(this, "mode");
|
|
@@ -2123,15 +2135,15 @@ class Fs {
|
|
|
2123
2135
|
}
|
|
2124
2136
|
apply(e) {
|
|
2125
2137
|
if (!this.available || this.mode !== "horizon-lock") return;
|
|
2126
|
-
const i = this.samples.filter((f) =>
|
|
2138
|
+
const i = this.samples.filter((f) => Ts(f.cameraRotation));
|
|
2127
2139
|
if (!i.length) return;
|
|
2128
2140
|
let n = i.findIndex((f) => f.pts / f.timescale >= e);
|
|
2129
2141
|
n < 0 && (n = i.length - 1);
|
|
2130
|
-
const r = Math.max(0, n - 1), o = i[r], s = i[n], a = o.pts / o.timescale, c = s.pts / s.timescale - a, l =
|
|
2131
|
-
this.material.uniforms.stabilizationQuaternion.value =
|
|
2142
|
+
const r = Math.max(0, n - 1), o = i[r], s = i[n], a = o.pts / o.timescale, c = s.pts / s.timescale - a, l = Ss(o.cameraRotation, s.cameraRotation, c > 0 ? (e - a) / c : 0), u = Math.atan2(2 * (l[0] * l[3] + l[1] * l[2]), 1 - 2 * (l[2] ** 2 + l[3] ** 2));
|
|
2143
|
+
this.material.uniforms.stabilizationQuaternion.value = ks(La(l), [Math.cos(u / 2), 0, 0, Math.sin(u / 2)]);
|
|
2132
2144
|
}
|
|
2133
2145
|
}
|
|
2134
|
-
function
|
|
2146
|
+
function Ss(t, e, i) {
|
|
2135
2147
|
const n = Fi(t);
|
|
2136
2148
|
let r = Fi(e), o = n.reduce((l, u, f) => l + u * r[f], 0);
|
|
2137
2149
|
o < 0 && (r = r.map((l) => -l), o = -o);
|
|
@@ -2140,7 +2152,7 @@ function Ms(t, e, i) {
|
|
|
2140
2152
|
const a = Math.acos(Math.max(-1, Math.min(1, o))), c = Math.sin(a);
|
|
2141
2153
|
return n.map((l, u) => (l * Math.sin((1 - s) * a) + r[u] * Math.sin(s * a)) / c);
|
|
2142
2154
|
}
|
|
2143
|
-
function
|
|
2155
|
+
function Ts(t) {
|
|
2144
2156
|
return (t == null ? void 0 : t.length) === 4 && t.every((e) => typeof e == "number" && Number.isFinite(e));
|
|
2145
2157
|
}
|
|
2146
2158
|
function Fi(t) {
|
|
@@ -2150,7 +2162,7 @@ function Fi(t) {
|
|
|
2150
2162
|
function La(t) {
|
|
2151
2163
|
return [t[0], -t[1], -t[2], -t[3]];
|
|
2152
2164
|
}
|
|
2153
|
-
function
|
|
2165
|
+
function ks(t, e) {
|
|
2154
2166
|
return [
|
|
2155
2167
|
t[0] * e[0] - t[1] * e[1] - t[2] * e[2] - t[3] * e[3],
|
|
2156
2168
|
t[0] * e[1] + t[1] * e[0] + t[2] * e[3] - t[3] * e[2],
|
|
@@ -2196,17 +2208,17 @@ class jn {
|
|
|
2196
2208
|
this.generation += 1, this.previousLeft = void 0, this.previousRight = void 0, this.lastAnalysis = -1 / 0, this.material.uniforms.useDynamicSeam.value = 0, this.material.uniforms.exposureGain0.value = [1, 1, 1], this.material.uniforms.exposureGain1.value = [1, 1, 1], this.active = !1;
|
|
2197
2209
|
}
|
|
2198
2210
|
async analyze(e, i) {
|
|
2199
|
-
const n = e.map((x) =>
|
|
2211
|
+
const n = e.map((x) => _s(x)), r = [new Uint8Array(N * ae * 3), new Uint8Array(N * ae * 3)], o = [new Float32Array(N * ae), new Float32Array(N * ae)], s = this.manifest.lenses.slice(0, 2);
|
|
2200
2212
|
let a = 0;
|
|
2201
2213
|
const c = [new Float64Array(3), new Float64Array(3)];
|
|
2202
2214
|
for (let x = 0; x < ae; x += 1)
|
|
2203
2215
|
for (let v = 0; v < N; v += 1) {
|
|
2204
|
-
const w =
|
|
2216
|
+
const w = Bs((v + 0.5) / N, (x + 0.5) / ae, this.manifest.projection.kind), S = x * N + v;
|
|
2205
2217
|
for (let D = 0; D < 2; D += 1) {
|
|
2206
|
-
const F =
|
|
2218
|
+
const F = Cs(w, s[D], this.manifest.projection.kind);
|
|
2207
2219
|
if (!F) continue;
|
|
2208
|
-
const T = S * 3, L = n[D], _ =
|
|
2209
|
-
|
|
2220
|
+
const T = S * 3, L = n[D], _ = Fs(F[0], F[1], this.lensSources[D], this.manifest.textureOrigin);
|
|
2221
|
+
Us(L, Je, _[0], _[1], r[D], T), o[D][S] = F[2] * (this.manifest.projection.kind === "mei-extended" ? js((v + 0.5) / N, D) : 1);
|
|
2210
2222
|
}
|
|
2211
2223
|
if (o[0][S] > 0 && o[1][S] > 0) {
|
|
2212
2224
|
a += 1;
|
|
@@ -2220,7 +2232,7 @@ class jn {
|
|
|
2220
2232
|
this.material.uniforms.exposureGain1.value
|
|
2221
2233
|
];
|
|
2222
2234
|
if (a > 64) {
|
|
2223
|
-
const x =
|
|
2235
|
+
const x = As(c[0], c[1]);
|
|
2224
2236
|
l = this.active ? x.map((v, w) => v.map((S, D) => l[w][D] * 0.8 + S * 0.2)) : x, this.material.uniforms.exposureGain0.value = l[0], this.material.uniforms.exposureGain1.value = l[1];
|
|
2225
2237
|
}
|
|
2226
2238
|
if (a <= 64) return;
|
|
@@ -2231,14 +2243,14 @@ class jn {
|
|
|
2231
2243
|
const w = x * N + v;
|
|
2232
2244
|
if (o[0][w] <= 0 || o[1][w] <= 0) continue;
|
|
2233
2245
|
const S = w * 3, D = Math.abs(r[0][S] * l[0][0] - r[1][S] * l[1][0]) + Math.abs(r[0][S + 1] * l[0][1] - r[1][S + 1] * l[1][1]) + Math.abs(r[0][S + 2] * l[0][2] - r[1][S + 2] * l[1][2]), F = v > 0 ? w - 1 : w, T = x > 0 ? w - N : w, L = fn(r[0], l[0], w, F, T), _ = fn(r[1], l[1], w, F, T);
|
|
2234
|
-
u[w] = Math.min(65534, D + Math.abs(L - _) * 2 +
|
|
2246
|
+
u[w] = Math.min(65534, D + Math.abs(L - _) * 2 + Ls(o[0][w], o[1][w]));
|
|
2235
2247
|
}
|
|
2236
|
-
const f = this.manifest.projection.kind === "dji-fisheye-lut", y = f ?
|
|
2248
|
+
const f = this.manifest.projection.kind === "dji-fisheye-lut", y = f ? Gs(u, N, ae, N / 4) : u, p = N / 2, [h, d] = await Promise.all([
|
|
2237
2249
|
this.processor.computeSeam({ width: p, height: ae, costs: hn(y, 0), previous: this.previousLeft, temporalWeight: 3, maxStep: 2 }),
|
|
2238
2250
|
this.processor.computeSeam({ width: p, height: ae, costs: hn(y, p), previous: this.previousRight, temporalWeight: 3, maxStep: 2 })
|
|
2239
2251
|
]);
|
|
2240
2252
|
if (this.closed || i !== this.generation) return;
|
|
2241
|
-
if (!
|
|
2253
|
+
if (!Ps([h, d], ae)) {
|
|
2242
2254
|
this.material.uniforms.useDynamicSeam.value = 0, this.active = !1;
|
|
2243
2255
|
return;
|
|
2244
2256
|
}
|
|
@@ -2248,27 +2260,27 @@ class jn {
|
|
|
2248
2260
|
return;
|
|
2249
2261
|
}
|
|
2250
2262
|
this.previousLeft = m, this.previousRight = g;
|
|
2251
|
-
const b = f ?
|
|
2263
|
+
const b = f ? qs(
|
|
2252
2264
|
o,
|
|
2253
2265
|
mn(m, N, N / 4),
|
|
2254
2266
|
mn(g.map((x) => x + p), N, N / 4)
|
|
2255
|
-
) :
|
|
2267
|
+
) : Ws(o, m, g.map((x) => x + p));
|
|
2256
2268
|
this.seamTexture.image.data.set(b), this.seamTexture.needsUpdate = !0, this.material.uniforms.useDynamicSeam.value = 1, this.active = !0;
|
|
2257
2269
|
}
|
|
2258
2270
|
}
|
|
2259
|
-
function
|
|
2271
|
+
function Rs(t, e) {
|
|
2260
2272
|
if (!(t > 0) || !(e > 0)) return [1, 1];
|
|
2261
2273
|
const i = Math.sqrt(Math.max(0.64, Math.min(1.5625, e / t)));
|
|
2262
2274
|
return [i, 1 / i];
|
|
2263
2275
|
}
|
|
2264
|
-
function
|
|
2276
|
+
function Ps(t, e, i = 120) {
|
|
2265
2277
|
return t.length > 0 && t.every((n) => Number.isFinite(n.cost) && n.cost / e <= i);
|
|
2266
2278
|
}
|
|
2267
|
-
function
|
|
2268
|
-
const i = [0, 1, 2].map((n) =>
|
|
2279
|
+
function As(t, e) {
|
|
2280
|
+
const i = [0, 1, 2].map((n) => Rs(Number(t[n]), Number(e[n])));
|
|
2269
2281
|
return [i.map((n) => n[0]), i.map((n) => n[1])];
|
|
2270
2282
|
}
|
|
2271
|
-
function
|
|
2283
|
+
function Ls(t, e) {
|
|
2272
2284
|
const i = t + e;
|
|
2273
2285
|
return !(t > 0) || !(e > 0) || !(i > 0) ? 128 : Math.round((1 - 2 * Math.min(t, e) / i) * 128);
|
|
2274
2286
|
}
|
|
@@ -2291,12 +2303,12 @@ function va(t, e, i) {
|
|
|
2291
2303
|
const n = i * 3;
|
|
2292
2304
|
return (t[n] * e[0] * 77 + t[n + 1] * e[1] * 150 + t[n + 2] * e[2] * 29) / 256;
|
|
2293
2305
|
}
|
|
2294
|
-
function
|
|
2306
|
+
function _s(t) {
|
|
2295
2307
|
const i = (typeof OffscreenCanvas < "u" ? new OffscreenCanvas(Je, Je) : Object.assign(document.createElement("canvas"), { width: Je, height: Je })).getContext("2d", { willReadFrequently: !0 });
|
|
2296
2308
|
if (!i) throw new Error("A 2D canvas is required for panorama seam analysis.");
|
|
2297
2309
|
return i.drawImage(t, 0, 0, Je, Je), i.getImageData(0, 0, Je, Je).data;
|
|
2298
2310
|
}
|
|
2299
|
-
function
|
|
2311
|
+
function Us(t, e, i, n, r = new Uint8Array(3), o = 0) {
|
|
2300
2312
|
const s = Math.max(0, Math.min(e - 1, i * e - 0.5)), a = Math.max(0, Math.min(e - 1, n * e - 0.5)), c = Math.floor(s), l = Math.floor(a), u = Math.min(e - 1, c + 1), f = Math.min(e - 1, l + 1), y = s - c, p = a - l;
|
|
2301
2313
|
for (let h = 0; h < 3; h += 1) {
|
|
2302
2314
|
const d = t[(l * e + c) * 4 + h] * (1 - y) + t[(l * e + u) * 4 + h] * y, m = t[(f * e + c) * 4 + h] * (1 - y) + t[(f * e + u) * 4 + h] * y;
|
|
@@ -2307,10 +2319,10 @@ function Ls(t, e, i, n, r = new Uint8Array(3), o = 0) {
|
|
|
2307
2319
|
function _a(t) {
|
|
2308
2320
|
return t !== "top-left";
|
|
2309
2321
|
}
|
|
2310
|
-
function
|
|
2322
|
+
function Es(t, e) {
|
|
2311
2323
|
return e === "top-left" ? t : 1 - t;
|
|
2312
2324
|
}
|
|
2313
|
-
function
|
|
2325
|
+
function Cs(t, e, i) {
|
|
2314
2326
|
const n = dt(e), r = Nn(i === "mei-extended" ? La(n) : n, t), o = Math.acos(Math.max(-1, Math.min(1, r[2])));
|
|
2315
2327
|
let s, a;
|
|
2316
2328
|
if (i === "mei-extended") {
|
|
@@ -2318,20 +2330,20 @@ function Us(t, e, i) {
|
|
|
2318
2330
|
if (p <= 1e-6) return;
|
|
2319
2331
|
const h = r[0] / p, d = r[1] / p, m = h * h + d * d;
|
|
2320
2332
|
if (!Number.isFinite(m) || m > 16) return;
|
|
2321
|
-
const g = m * m, b = Ze(e), x = ve(e.tangential), v = Mt(e.thinPrism), w = 1 + b[0] * m + b[1] * g + b[2] * m * g + b[3] * g * g, S = h * w + 2 * x[0] * h * d + x[1] * (m + 2 * h * h) + v[0] * m + v[1] * g, D = d * w + x[0] * (m + 2 * d * d) + 2 * x[1] * h * d + v[2] * m + v[3] * g, F = e.distortionModel === "radtan_pro" ?
|
|
2333
|
+
const g = m * m, b = Ze(e), x = ve(e.tangential), v = Mt(e.thinPrism), w = 1 + b[0] * m + b[1] * g + b[2] * m * g + b[3] * g * g, S = h * w + 2 * x[0] * h * d + x[1] * (m + 2 * h * h) + v[0] * m + v[1] * g, D = d * w + x[0] * (m + 2 * d * d) + 2 * x[1] * h * d + v[2] * m + v[3] * g, F = e.distortionModel === "radtan_pro" ? Is([h, d], e.distortionCoeffs) : Os([S, D], ve(e.sensorTilt));
|
|
2322
2334
|
s = (e.cx || 0) + (e.fx || 1) * F[0], a = (e.cy || 0) + (e.fy || e.fx || 1) * F[1];
|
|
2323
2335
|
} else {
|
|
2324
2336
|
if (o >= 96 * Math.PI / 180) return;
|
|
2325
|
-
const p = Math.max(1e-6, Math.hypot(r[0], r[1])), h =
|
|
2337
|
+
const p = Math.max(1e-6, Math.hypot(r[0], r[1])), h = Vs(o, e);
|
|
2326
2338
|
s = (e.cx || 0) + h * r[0] / p, a = (e.cy || 0) + h * r[1] / p;
|
|
2327
2339
|
}
|
|
2328
2340
|
const c = e.width || 1, l = e.height || 1;
|
|
2329
2341
|
if (!Number.isFinite(s) || !Number.isFinite(a) || s < 0 || s > c - 1 || a < 0 || a > l - 1) return;
|
|
2330
2342
|
const u = (s + 0.5) / c, f = (a + 0.5) / l, y = 0.475 * Math.min(c, l) - Math.hypot(s - (e.cx || 0), a - (e.cy || 0));
|
|
2331
2343
|
if (!(i === "mei-extended" && y <= 0))
|
|
2332
|
-
return [u, f, i === "mei-extended" ? y :
|
|
2344
|
+
return [u, f, i === "mei-extended" ? y : zs(o)];
|
|
2333
2345
|
}
|
|
2334
|
-
function
|
|
2346
|
+
function Is([t, e], i) {
|
|
2335
2347
|
const n = t * t + e * e, r = n * n, o = 1 + i[0] * n + i[1] * r + i[2] * n * r + i[3] * r * r + i[4] * r * r * n, s = i[5] + i[7] * n, a = i[6] + i[8] * n;
|
|
2336
2348
|
return [
|
|
2337
2349
|
t * o + (n + 2 * t * t) * s + 2 * t * e * a + i[9] * n + i[11] * r,
|
|
@@ -2367,22 +2379,22 @@ function Ua(t, e) {
|
|
|
2367
2379
|
t.fragmentShader = t.fragmentShader.replace("precision highp float;", `precision highp float;
|
|
2368
2380
|
${n}`).replace("sampler2D image) {", "sampler2D image, int lensIndex) {").replace("intrinsics.xy * applySensorTilt(distorted, sensorTilt)", "intrinsics.xy * calibratedDistortion(normalized, applySensorTilt(distorted, sensorTilt), lensIndex)").replace("sensorTilt0, lens0);", "sensorTilt0, lens0, 0);").replace("sensorTilt1, lens1);", "sensorTilt1, lens1, 1);");
|
|
2369
2381
|
}
|
|
2370
|
-
function
|
|
2382
|
+
function zs(t) {
|
|
2371
2383
|
return Math.max(0, Math.min(1, (95 * Math.PI / 180 - t) / (10 * Math.PI / 180)));
|
|
2372
2384
|
}
|
|
2373
|
-
function
|
|
2385
|
+
function Bs(t, e, i) {
|
|
2374
2386
|
const n = t * Math.PI * 2 - Math.PI, r = (e - 0.5) * Math.PI, o = Math.cos(r);
|
|
2375
2387
|
return i === "mei-extended" ? [o * Math.sin(n), -Math.sin(r), o * Math.cos(n)] : [o * Math.sin(n + Math.PI / 2), o * Math.cos(n + Math.PI / 2), Math.sin(r)];
|
|
2376
2388
|
}
|
|
2377
|
-
function
|
|
2378
|
-
const i = t * 360 - 180, n = 1 -
|
|
2389
|
+
function js(t, e) {
|
|
2390
|
+
const i = t * 360 - 180, n = 1 - Ns(75, 105, Math.abs(i));
|
|
2379
2391
|
return e === 0 ? n : 1 - n;
|
|
2380
2392
|
}
|
|
2381
|
-
function
|
|
2393
|
+
function Ns(t, e, i) {
|
|
2382
2394
|
const n = Math.max(0, Math.min(1, (i - t) / (e - t)));
|
|
2383
2395
|
return n * n * (3 - 2 * n);
|
|
2384
2396
|
}
|
|
2385
|
-
function
|
|
2397
|
+
function Os(t, e) {
|
|
2386
2398
|
const [i, n] = t, [r, o] = e, s = Math.cos(r), a = Math.sin(r), c = Math.cos(o), l = Math.sin(o), u = c * i + l * a * n - l * s, f = s * n + a, y = l * i - c * a * n + c * s, h = 1 / (Math.abs(y) > 1e-6 ? y : y < 0 ? -1e-6 : 1e-6);
|
|
2387
2399
|
return [s * (c * u + l * y) * h, (c * s * f - a * y) * h];
|
|
2388
2400
|
}
|
|
@@ -2394,7 +2406,7 @@ function Nn(t, e) {
|
|
|
2394
2406
|
2 * a * s + l * e[2] + 2 * n * c[2]
|
|
2395
2407
|
];
|
|
2396
2408
|
}
|
|
2397
|
-
function
|
|
2409
|
+
function Vs(t, e) {
|
|
2398
2410
|
const i = 85 * Math.PI / 180, n = Math.min(t, i), r = Ze(e), o = n + r[0] * n ** 3 + r[1] * n ** 5 + r[2] * n ** 7 + r[3] * n ** 9, s = 1 + 3 * r[0] * n ** 2 + 5 * r[1] * n ** 4 + 7 * r[2] * n ** 6 + 9 * r[3] * n ** 8;
|
|
2399
2411
|
return Dt(e) * (e.fx || 1) * (t > i ? o + s * (t - i) : o);
|
|
2400
2412
|
}
|
|
@@ -2403,7 +2415,7 @@ function hn(t, e) {
|
|
|
2403
2415
|
for (let r = 0; r < ae; r += 1) n.set(t.subarray(r * N + e, r * N + e + i), r * i);
|
|
2404
2416
|
return n;
|
|
2405
2417
|
}
|
|
2406
|
-
function
|
|
2418
|
+
function Ws(t, e, i) {
|
|
2407
2419
|
const n = new Uint8Array(N * ae);
|
|
2408
2420
|
for (let r = 0; r < ae; r += 1) {
|
|
2409
2421
|
let o = t[1][r * N] > t[0][r * N];
|
|
@@ -2412,7 +2424,7 @@ function Os(t, e, i) {
|
|
|
2412
2424
|
}
|
|
2413
2425
|
return On(n, !1);
|
|
2414
2426
|
}
|
|
2415
|
-
function
|
|
2427
|
+
function qs(t, e, i) {
|
|
2416
2428
|
const n = new Uint8Array(N * ae), r = N / 4, o = ae / 8;
|
|
2417
2429
|
for (let s = 0; s < ae; s += 1) {
|
|
2418
2430
|
if (s < o || s >= ae - o) {
|
|
@@ -2441,7 +2453,7 @@ function On(t, e) {
|
|
|
2441
2453
|
}
|
|
2442
2454
|
return i;
|
|
2443
2455
|
}
|
|
2444
|
-
function
|
|
2456
|
+
function Gs(t, e, i, n) {
|
|
2445
2457
|
const r = new Uint16Array(t.length);
|
|
2446
2458
|
for (let o = 0; o < i; o += 1)
|
|
2447
2459
|
for (let s = 0; s < e; s += 1) r[o * e + (s + n) % e] = t[o * e + s];
|
|
@@ -2467,7 +2479,7 @@ function dt(t) {
|
|
|
2467
2479
|
const e = t.extrinsicQuaternion;
|
|
2468
2480
|
return (e == null ? void 0 : e.length) === 4 && e.every(Number.isFinite) ? e : [1, 0, 0, 0];
|
|
2469
2481
|
}
|
|
2470
|
-
function
|
|
2482
|
+
function Xs(t) {
|
|
2471
2483
|
const e = t.samples.at(-1);
|
|
2472
2484
|
return e && t.timescale > 0 ? (e.pts + e.duration) / t.timescale : 0;
|
|
2473
2485
|
}
|
|
@@ -2612,7 +2624,7 @@ function gn(t, e = [1, 0, 0, 0]) {
|
|
|
2612
2624
|
const i = Array.isArray(t) ? t : e, n = de(i, e, 4), r = Math.hypot(...n) || 1;
|
|
2613
2625
|
return n.map((o) => o / r);
|
|
2614
2626
|
}
|
|
2615
|
-
function
|
|
2627
|
+
function $s(t, e) {
|
|
2616
2628
|
if (!t || typeof t != "object") return null;
|
|
2617
2629
|
const i = e === "left" ? [0.25, 0.5] : [0.75, 0.5], n = e === "left" ? [0.75, 0.5] : [0.25, 0.5], r = {
|
|
2618
2630
|
center: i,
|
|
@@ -2650,7 +2662,7 @@ function Gs(t, e) {
|
|
|
2650
2662
|
axis: [0, 0, 1],
|
|
2651
2663
|
right: [-1, 0, 0],
|
|
2652
2664
|
up: [0, 1, 0]
|
|
2653
|
-
}, s = t.front && typeof t.front == "object" ? t.front : {}, a = t.back && typeof t.back == "object" ? t.back : {}, c = t.pipeline && typeof t.pipeline == "object" ? t.pipeline : {}, l =
|
|
2665
|
+
}, s = t.front && typeof t.front == "object" ? t.front : {}, a = t.back && typeof t.back == "object" ? t.back : {}, c = t.pipeline && typeof t.pipeline == "object" ? t.pipeline : {}, l = Ys(t.remap), u = String(t.textureOrigin ?? t.texture_origin ?? "").trim().toLowerCase(), f = Ma(t.imageSize ?? t.image_size, [0, 0]), y = fe(s.center, r.center), p = fe(a.center, o.center), h = Wn(y, p);
|
|
2654
2666
|
return {
|
|
2655
2667
|
textureOrigin: u === "top-left" || u === "bottom-left" ? u : "",
|
|
2656
2668
|
imageSize: f,
|
|
@@ -2709,7 +2721,7 @@ function Gs(t, e) {
|
|
|
2709
2721
|
remap: l
|
|
2710
2722
|
};
|
|
2711
2723
|
}
|
|
2712
|
-
function
|
|
2724
|
+
function Ys(t) {
|
|
2713
2725
|
if (!t || typeof t != "object") return null;
|
|
2714
2726
|
const e = Ma([t.width, t.height], [1, 1]), i = e[0], n = e[1], r = i * n * 4, o = yn(t.front, r), s = yn(t.back, r);
|
|
2715
2727
|
return !o || !s ? null : {
|
|
@@ -2721,11 +2733,11 @@ function Xs(t) {
|
|
|
2721
2733
|
meshResolution: Ma(t.meshResolution, [32, 16])
|
|
2722
2734
|
};
|
|
2723
2735
|
}
|
|
2724
|
-
function
|
|
2736
|
+
function Qs(t, e) {
|
|
2725
2737
|
const i = Number(t) || 0, n = Number(e) || 0;
|
|
2726
2738
|
return i > 0 && n > i * 1.6 && Math.abs(n / i - 2) <= 0.15;
|
|
2727
2739
|
}
|
|
2728
|
-
function
|
|
2740
|
+
function Hs(t) {
|
|
2729
2741
|
const e = String(t || "").trim();
|
|
2730
2742
|
if (!e) return { r: 0, g: 0, b: 0, a: 1 };
|
|
2731
2743
|
if (e.startsWith("#")) {
|
|
@@ -2764,7 +2776,7 @@ function vn(t, e, i) {
|
|
|
2764
2776
|
}
|
|
2765
2777
|
return n;
|
|
2766
2778
|
}
|
|
2767
|
-
function
|
|
2779
|
+
function Js(t, e, i) {
|
|
2768
2780
|
const n = vn(t, t.VERTEX_SHADER, e), r = vn(t, t.FRAGMENT_SHADER, i), o = t.createProgram();
|
|
2769
2781
|
if (!o) throw new Error("createProgram failed");
|
|
2770
2782
|
if (t.attachShader(o, n), t.attachShader(o, r), t.linkProgram(o), t.deleteShader(n), t.deleteShader(r), !t.getProgramParameter(o, t.LINK_STATUS)) {
|
|
@@ -2789,7 +2801,7 @@ const z = 128, X = 64, Ea = 256, Be = new Int32Array(new Uint8Array([0, 0, 0, 25
|
|
|
2789
2801
|
function vi(t, e) {
|
|
2790
2802
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
|
|
2791
2803
|
}
|
|
2792
|
-
function
|
|
2804
|
+
function Ks(t, e, i = 1) {
|
|
2793
2805
|
return [t[0] - e[0] * i, t[1] - e[1] * i, t[2] - e[2] * i];
|
|
2794
2806
|
}
|
|
2795
2807
|
function xn(t) {
|
|
@@ -2803,7 +2815,7 @@ function Gn(t, e, i = !1) {
|
|
|
2803
2815
|
(i ? 1 : -1) * o * Math.cos(n)
|
|
2804
2816
|
];
|
|
2805
2817
|
}
|
|
2806
|
-
function
|
|
2818
|
+
function Zs(t, e = !1) {
|
|
2807
2819
|
const i = Math.atan2(t[0], e ? t[2] : -t[2]), n = Math.asin(O(e ? -t[1] : t[1], -1, 1));
|
|
2808
2820
|
return [
|
|
2809
2821
|
i / (Math.PI * 2) + 0.5,
|
|
@@ -2818,7 +2830,7 @@ function Di(t, e, i, n, r, o, s = 0) {
|
|
|
2818
2830
|
}
|
|
2819
2831
|
return o;
|
|
2820
2832
|
}
|
|
2821
|
-
function
|
|
2833
|
+
function ec(t, e, i, n = !1) {
|
|
2822
2834
|
var l;
|
|
2823
2835
|
const { pixels: r, width: o, height: s } = t, { uv: a, weights: c } = e;
|
|
2824
2836
|
if (!n) {
|
|
@@ -2860,7 +2872,7 @@ function Ks(t, e, i, n = !1) {
|
|
|
2860
2872
|
}
|
|
2861
2873
|
}
|
|
2862
2874
|
}
|
|
2863
|
-
function
|
|
2875
|
+
function tc(t, e, i) {
|
|
2864
2876
|
if (!t || !(t.front instanceof Uint8Array) || !(t.back instanceof Uint8Array)) return null;
|
|
2865
2877
|
const n = (r) => {
|
|
2866
2878
|
const o = O(Math.round(e * (t.width - 1)), 0, t.width - 1), a = (O(Math.round((1 - i) * (t.height - 1)), 0, t.height - 1) * t.width + o) * 4;
|
|
@@ -2872,7 +2884,7 @@ function Zs(t, e, i) {
|
|
|
2872
2884
|
};
|
|
2873
2885
|
return [n(t.front), n(t.back)];
|
|
2874
2886
|
}
|
|
2875
|
-
function
|
|
2887
|
+
function ic(t, e) {
|
|
2876
2888
|
const i = Math.cos(e[0]), n = Math.sin(e[0]), r = Math.cos(e[1]), o = Math.sin(e[1]), s = r * t[0] + o * n * t[1] - o * i, a = i * t[1] + n, c = o * t[0] - r * n * t[1] + r * i, l = Math.abs(c) > 1e-6 ? c : c < 0 ? -1e-6 : 1e-6;
|
|
2877
2889
|
return [i * (r * s + o * c) / l, (r * i * a - n * c) / l];
|
|
2878
2890
|
}
|
|
@@ -2901,7 +2913,7 @@ function St(t, e, i, n, r, o, s = 0) {
|
|
|
2901
2913
|
if (h <= 1e-6) return null;
|
|
2902
2914
|
const d = a[0] / h, m = a[1] / h, g = d * d + m * m;
|
|
2903
2915
|
if (g > 16) return null;
|
|
2904
|
-
const b = g * g, x = 1 + e.radial[0] * g + e.radial[1] * b + e.radial[2] * g * b + e.radial[3] * b * b, v = e.distortionModel === "radtan_pro" ?
|
|
2916
|
+
const b = g * g, x = 1 + e.radial[0] * g + e.radial[1] * b + e.radial[2] * g * b + e.radial[3] * b * b, v = e.distortionModel === "radtan_pro" ? ac(d, m, e.distortionCoeffs) : ic([
|
|
2905
2917
|
d * x + 2 * e.tangential[0] * d * m + e.tangential[1] * (g + 2 * d * d) + e.thinPrism[0] * g + e.thinPrism[1] * b,
|
|
2906
2918
|
m * x + e.tangential[0] * (g + 2 * m * m) + 2 * e.tangential[1] * d * m + e.thinPrism[2] * g + e.thinPrism[3] * b
|
|
2907
2919
|
], e.sensorTilt || [0, 0]);
|
|
@@ -2927,7 +2939,7 @@ function St(t, e, i, n, r, o, s = 0) {
|
|
|
2927
2939
|
];
|
|
2928
2940
|
}
|
|
2929
2941
|
} else {
|
|
2930
|
-
const h =
|
|
2942
|
+
const h = Ks(t, e.axis, c), d = xn(h), m = d > 1e-5 ? [vi(h, e.right) / d, -vi(h, e.up) / d] : [0, 0], g = l * l, b = e.radial || [0, 0, 0, 0], x = l * (1 + b[0] * g + b[1] * g ** 2 + b[2] * g ** 3 + b[3] * g ** 4), v = x * m[0], w = x * m[1], S = v * v + w * w, D = e.tangential || [0, 0], F = e.asymmetric || [0, 0, 0, 0], T = 2 * D[0] * v * w + D[1] * (S + 2 * v * v), L = D[0] * (S + 2 * w * w) + 2 * D[1] * v * w, _ = F[0] * v + F[1] * w, k = F[2] * v + F[3] * w, P = e.focal || Sa(e.scale, i), E = e.principalOffset || [0, 0];
|
|
2931
2943
|
u = [
|
|
2932
2944
|
e.center[0] + E[0] + P[0] * (v + T + _),
|
|
2933
2945
|
e.center[1] + E[1] + P[1] * (w + L + k)
|
|
@@ -2937,7 +2949,7 @@ function St(t, e, i, n, r, o, s = 0) {
|
|
|
2937
2949
|
const f = e.validRadius || [0.475, 0.475], y = Math.max(1 - Math.hypot((u[0] - e.center[0]) / Math.max(1e-4, f[0]), (u[1] - e.center[1]) / Math.max(1e-4, f[1])), 0);
|
|
2938
2950
|
return y <= 0 || u[0] < 0 || u[1] < 0 || u[0] > 1 || u[1] > 1 ? null : { uv: u, confidence: y };
|
|
2939
2951
|
}
|
|
2940
|
-
function
|
|
2952
|
+
function ac(t, e, i) {
|
|
2941
2953
|
const n = t * t + e * e, r = n * n, o = 1 + i[0] * n + i[1] * r + i[2] * n * r + i[3] * r * r + i[4] * r * r * n, s = i[5] + i[7] * n, a = i[6] + i[8] * n;
|
|
2942
2954
|
return [
|
|
2943
2955
|
t * o + (n + 2 * t * t) * s + 2 * t * e * a + i[9] * n + i[11] * r,
|
|
@@ -2982,7 +2994,7 @@ function Xn(t, e, i, n = 2, r = null) {
|
|
|
2982
2994
|
}
|
|
2983
2995
|
return { seam: y, cost: f };
|
|
2984
2996
|
}
|
|
2985
|
-
function
|
|
2997
|
+
function rc(t) {
|
|
2986
2998
|
const e = t.slice();
|
|
2987
2999
|
for (let i = 0; i < X; i += 1)
|
|
2988
3000
|
for (let n = 0; n < z; n += 1) {
|
|
@@ -2993,16 +3005,16 @@ function ic(t) {
|
|
|
2993
3005
|
}
|
|
2994
3006
|
return e;
|
|
2995
3007
|
}
|
|
2996
|
-
function
|
|
3008
|
+
function nc(t, e, i) {
|
|
2997
3009
|
const n = new Uint8Array(z * X);
|
|
2998
3010
|
for (let r = 0; r < X; r += 1) {
|
|
2999
3011
|
let o = t[1][r * z] > t[0][r * z];
|
|
3000
3012
|
for (let s = 0; s < z; s += 1)
|
|
3001
3013
|
(s === e[r] || s === i[r]) && (o = !o), n[r * z + s] = o ? 255 : 0;
|
|
3002
3014
|
}
|
|
3003
|
-
return
|
|
3015
|
+
return rc(n);
|
|
3004
3016
|
}
|
|
3005
|
-
function
|
|
3017
|
+
function oc(t, e, i, n) {
|
|
3006
3018
|
if (!t) return null;
|
|
3007
3019
|
const r = [new Float32Array(t.length), new Float32Array(t.length)];
|
|
3008
3020
|
for (let s = 0; s < X; s += 1) for (let a = 0; a < z; a += 1) {
|
|
@@ -3038,7 +3050,7 @@ function rc(t, e, i, n) {
|
|
|
3038
3050
|
}
|
|
3039
3051
|
return o;
|
|
3040
3052
|
}
|
|
3041
|
-
function
|
|
3053
|
+
function sc(t, e, i) {
|
|
3042
3054
|
const n = new Uint8Array(z * X);
|
|
3043
3055
|
for (let r = 0; r < X; r++) for (let o = 0; o < z; o++) {
|
|
3044
3056
|
const s = r * z + o;
|
|
@@ -3061,7 +3073,7 @@ function nc(t, e, i) {
|
|
|
3061
3073
|
}
|
|
3062
3074
|
return n;
|
|
3063
3075
|
}
|
|
3064
|
-
function
|
|
3076
|
+
function cc(t) {
|
|
3065
3077
|
const e = z, i = X, n = new Uint8Array(e * i);
|
|
3066
3078
|
for (let r = 0; r < i; r++) for (let o = 0; o < e; o++) {
|
|
3067
3079
|
const s = r * e + o;
|
|
@@ -3073,7 +3085,7 @@ function oc(t) {
|
|
|
3073
3085
|
}
|
|
3074
3086
|
return n;
|
|
3075
3087
|
}
|
|
3076
|
-
function
|
|
3088
|
+
function lc(t, e, i) {
|
|
3077
3089
|
const n = z, r = X, o = new Float64Array(n * 5), s = new Float64Array(n), a = new Float32Array(n * r);
|
|
3078
3090
|
for (let c = 0; c < r; c++) {
|
|
3079
3091
|
const l = c * n, u = c % 5 * n, f = (c - 2) * n;
|
|
@@ -3103,8 +3115,8 @@ function sc(t, e, i) {
|
|
|
3103
3115
|
}
|
|
3104
3116
|
return a;
|
|
3105
3117
|
}
|
|
3106
|
-
function
|
|
3107
|
-
if (i) return
|
|
3118
|
+
function uc(t, e, i = null) {
|
|
3119
|
+
if (i) return lc(t, e, i);
|
|
3108
3120
|
const n = z, r = X, o = n * r, s = new Float64Array(n * 5), a = new Uint8Array(n * 5), c = new Float64Array(n), l = new Uint8Array(n), u = new Float32Array(o);
|
|
3109
3121
|
for (let f = 0; f < r; f++) {
|
|
3110
3122
|
const y = f * n, p = f % 5 * n, h = (f - 2) * n;
|
|
@@ -3134,7 +3146,7 @@ function cc(t, e, i = null) {
|
|
|
3134
3146
|
}
|
|
3135
3147
|
return u;
|
|
3136
3148
|
}
|
|
3137
|
-
function
|
|
3149
|
+
function dc(t) {
|
|
3138
3150
|
const e = z, i = X, n = e >>> 5, r = new Uint8Array(e * i);
|
|
3139
3151
|
for (let o = 2; o < i - 2; o++) for (let s = 0; s < n; s++) {
|
|
3140
3152
|
const a = (o - 1) * n, c = a + s, l = a + (s + n - 1) % n, u = a + (s + 1) % n, f = t[c] | t[c + n] | t[c + n * 2], y = t[l] | t[l + n] | t[l + n * 2], p = t[u] | t[u + n] | t[u + n * 2];
|
|
@@ -3146,7 +3158,7 @@ function lc(t) {
|
|
|
3146
3158
|
}
|
|
3147
3159
|
return r;
|
|
3148
3160
|
}
|
|
3149
|
-
function
|
|
3161
|
+
function fc(t, e, i, n, r = null) {
|
|
3150
3162
|
const o = z, s = X, a = o * s, c = e.map((d, m) => {
|
|
3151
3163
|
const g = new Float32Array(a), b = n[m];
|
|
3152
3164
|
for (let x = 0; x < a; x++) {
|
|
@@ -3154,10 +3166,10 @@ function uc(t, e, i, n, r = null) {
|
|
|
3154
3166
|
g[x] = (d[v] * 0.2126 + d[v + 1] * 0.7152 + d[v + 2] * 0.0722) * b;
|
|
3155
3167
|
}
|
|
3156
3168
|
return g;
|
|
3157
|
-
}), l = r ? r.contrastSampleCounts || (r.contrastSampleCounts = i.map(
|
|
3169
|
+
}), l = r ? r.contrastSampleCounts || (r.contrastSampleCounts = i.map(cc)) : null, u = c.map((d, m) => uc(d, i[m], l == null ? void 0 : l[m])), f = new Uint32Array(a >>> 5);
|
|
3158
3170
|
for (let d = 0; d < a; d++)
|
|
3159
3171
|
i[0][d] <= 0 || i[1][d] <= 0 || Math.abs(c[0][d] - c[1][d]) < 12 || Math.max(u[0][d], u[1][d]) < 12 || (f[d >>> 5] |= 1 << (d & 31));
|
|
3160
|
-
const y =
|
|
3172
|
+
const y = dc(f), p = t.slice(), h = new Int32Array(a);
|
|
3161
3173
|
for (let d = 0; d < a; d++) {
|
|
3162
3174
|
if (y[d] !== 1) continue;
|
|
3163
3175
|
let m = 1;
|
|
@@ -3184,7 +3196,7 @@ function uc(t, e, i, n, r = null) {
|
|
|
3184
3196
|
}
|
|
3185
3197
|
return p;
|
|
3186
3198
|
}
|
|
3187
|
-
function
|
|
3199
|
+
function hc() {
|
|
3188
3200
|
const t = (n, r) => typeof OffscreenCanvas < "u" ? new OffscreenCanvas(n, r) : Object.assign(document.createElement("canvas"), { width: n, height: r }), e = t(32, 2), i = t(16, 1);
|
|
3189
3201
|
try {
|
|
3190
3202
|
const n = e.getContext("2d", { willReadFrequently: !0 }), r = i.getContext("2d", { willReadFrequently: !0 });
|
|
@@ -3236,8 +3248,8 @@ function bn(t, e = 0) {
|
|
|
3236
3248
|
}
|
|
3237
3249
|
return r;
|
|
3238
3250
|
}
|
|
3239
|
-
function
|
|
3240
|
-
if ((t == null ? void 0 : t.length) !== 2 || t.some((p) => !p || p.width < 1024 || p.width !== p.height || !ArrayBuffer.isView(p.data) || p.data.length !== p.width * p.height * 4 || p.colorSpace && p.colorSpace !== "srgb") || (e.bias === void 0 && (e.bias =
|
|
3251
|
+
function mc(t, e, i = null, n = null) {
|
|
3252
|
+
if ((t == null ? void 0 : t.length) !== 2 || t.some((p) => !p || p.width < 1024 || p.width !== p.height || !ArrayBuffer.isView(p.data) || p.data.length !== p.width * p.height * 4 || p.colorSpace && p.colorSpace !== "srgb") || (e.bias === void 0 && (e.bias = hc()), e.bias === null)) return null;
|
|
3241
3253
|
const r = e.bias, o = +(t[0].width === 1024) | +(t[1].width === 1024) << 1;
|
|
3242
3254
|
!e.selection || e.selection.map !== n ? (e.selection = { map: n, nativeMask: o, targets: bn(n, o) }, e.buffers = [], e.plans = []) : e.selection.nativeMask !== o && (e.selection = { map: n, nativeMask: o, targets: bn(n, o) });
|
|
3243
3255
|
const s = e.buffers || (e.buffers = []), a = (i == null ? void 0 : i.pixels) === s[0] ? 1 : 0, c = s[a] || (s[a] = new Uint8ClampedArray(1024 * 512 * 4)), l = new Uint32Array(c.buffer, c.byteOffset, c.byteLength / 4), u = r * 65537, f = r * 16843009, y = e.plans || (e.plans = []);
|
|
@@ -3447,7 +3459,7 @@ function Ca(t, e, i, n) {
|
|
|
3447
3459
|
}
|
|
3448
3460
|
return { offsets: s, ratios: a };
|
|
3449
3461
|
}
|
|
3450
|
-
function
|
|
3462
|
+
function pc(t, e, i, n) {
|
|
3451
3463
|
const r = Gt(t, 2048);
|
|
3452
3464
|
if (!r) return null;
|
|
3453
3465
|
if (r.pixels[3] === 0) return;
|
|
@@ -3459,13 +3471,13 @@ function hc(t, e, i, n) {
|
|
|
3459
3471
|
});
|
|
3460
3472
|
return { offsets: a, polarInverseDepth: u, gain: e.dualFisheyeAutoGain ? [l, 1 / l] : [e.dualFisheyeGainFront, e.dualFisheyeGainBack] };
|
|
3461
3473
|
}
|
|
3462
|
-
function
|
|
3474
|
+
function yc(t, e, i, n) {
|
|
3463
3475
|
const r = Gt(t, 2048);
|
|
3464
3476
|
if (!r) return null;
|
|
3465
3477
|
if (r.pixels[3] !== 0)
|
|
3466
|
-
return
|
|
3478
|
+
return gc(r, e, i, n);
|
|
3467
3479
|
}
|
|
3468
|
-
function
|
|
3480
|
+
function gc(t, e, i, n) {
|
|
3469
3481
|
const r = n.map((l) => ({ ...l, validRadius: Vt(l) })), o = Qn(t, r, e, i.textureOrigin, Math.PI), s = r.map((l) => ({ ...l, focal: l.focal.map((u) => u * o) })), a = Ca(t, e, s, i.textureOrigin);
|
|
3470
3482
|
if (!a) return null;
|
|
3471
3483
|
const c = e.dualFisheyeAutoGain ? za(
|
|
@@ -3553,13 +3565,13 @@ function Yn(t, e, i, n = 0, r = {}, o = null) {
|
|
|
3553
3565
|
}
|
|
3554
3566
|
return y === 0 || !Number.isFinite(u) || u - f < 0.5 || f > u * 0.9 ? 0 : 1 / y;
|
|
3555
3567
|
}
|
|
3556
|
-
function
|
|
3568
|
+
function vc(t, e, i, n = !1) {
|
|
3557
3569
|
const r = i[t[1] > 0 ? 1 : 0];
|
|
3558
3570
|
if (!(r > 0)) return e;
|
|
3559
3571
|
const o = Math.sin((n ? 50 : 30) * Math.PI / 180), s = Math.sin((n ? 65 : 50) * Math.PI / 180), a = O((Math.abs(t[1]) - o) / (s - o), 0, 1), c = (e > 0 ? 1 / e : 0) * (1 - a * a * (3 - 2 * a)) + r * a * a * (3 - 2 * a);
|
|
3560
3572
|
return c > 0 ? 1 / c : 0;
|
|
3561
3573
|
}
|
|
3562
|
-
function
|
|
3574
|
+
function xc(t, e, i, n) {
|
|
3563
3575
|
const r = e.map((f) => {
|
|
3564
3576
|
const y = f.rotationQuat, p = Ba({ w: y[0], x: y[1], y: y[2], z: y[3] }, ...f.translationM || [0, 0, 0]);
|
|
3565
3577
|
return [p.x, p.y, p.z];
|
|
@@ -3634,7 +3646,7 @@ function Qn(t, e, i, n, r) {
|
|
|
3634
3646
|
d < y && (f = h, y = d);
|
|
3635
3647
|
}), f === 0 || f === o.length - 1 || u - y < 0.75 || y > u * 0.85 ? 1 : o[f];
|
|
3636
3648
|
}
|
|
3637
|
-
function
|
|
3649
|
+
function bc(t, e, i, n, r, o, s) {
|
|
3638
3650
|
var x, v, w;
|
|
3639
3651
|
const a = !n && [r, o].every((S) => {
|
|
3640
3652
|
var D;
|
|
@@ -3647,12 +3659,12 @@ function vc(t, e, i, n, r, o, s) {
|
|
|
3647
3659
|
let u = c ? Qn(l, [r, o], e, i.textureOrigin, s) : 1;
|
|
3648
3660
|
if (u !== 1) {
|
|
3649
3661
|
const S = { ...r, focal: r.focal.map((F) => F * u) }, D = { ...o, focal: o.focal.map((F) => F * u) };
|
|
3650
|
-
|
|
3662
|
+
wc(e, i, S, D, s) ? (r = S, o = D) : u = 1;
|
|
3651
3663
|
}
|
|
3652
3664
|
const f = a ? Yn(l, [r, o], i == null ? void 0 : i.textureOrigin) : 0, p = i && !n && [r, o].every((S) => S.projectionModel === "mei_extended" && S.distortionModel !== "radtan_pro" && Array.isArray(S.rotationQuat)) && [r, o].some((S) => {
|
|
3653
3665
|
var D;
|
|
3654
3666
|
return (D = S.translationM) == null ? void 0 : D.some((F) => Math.abs(F) > 1e-3);
|
|
3655
|
-
}) ? Gt(t, 1024) : null, h = p ?
|
|
3667
|
+
}) ? Gt(t, 1024) : null, h = p ? xc(p, [r, o], e, i.textureOrigin) : [0, 0], d = i && !n && ((x = i.imageSize) == null ? void 0 : x[0]) === 2 * ((v = i.imageSize) == null ? void 0 : v[1]) && [r, o].every((S) => S.projectionModel === "mei_extended" && S.distortionModel !== "radtan_pro" && Array.isArray(S.rotationQuat)), m = d ? Gt(t, 2048) : null, g = m ? ((w = Ca(m, e, [r, o], i.textureOrigin)) == null ? void 0 : w.offsets) || [0, 0, 0, 0] : [0, 0, 0, 0], b = za(
|
|
3656
3668
|
l,
|
|
3657
3669
|
e,
|
|
3658
3670
|
i,
|
|
@@ -3664,7 +3676,7 @@ function vc(t, e, i, n, r, o, s) {
|
|
|
3664
3676
|
);
|
|
3665
3677
|
return b ? { ...b, convergenceM: f, polarInverseDepth: h, focalScale: u, imageOffsets: g } : null;
|
|
3666
3678
|
}
|
|
3667
|
-
function
|
|
3679
|
+
function wc(t, e, i, n, r) {
|
|
3668
3680
|
const { weights: o } = Ia(
|
|
3669
3681
|
t,
|
|
3670
3682
|
e,
|
|
@@ -3717,7 +3729,7 @@ function Ia(t, e, i, n, r, o, { convergenceM: s, polarInverseDepth: a, registrat
|
|
|
3717
3729
|
for (let T = 0; T < X; T++) for (let L = 0; L < z; L++) {
|
|
3718
3730
|
const _ = Gn((L + 0.5) / z, (T + 0.5) / X, b);
|
|
3719
3731
|
t.equirectFlipX && (_[0] = -_[0]), t.equirectFlipY && (_[1] = -_[1]);
|
|
3720
|
-
const k =
|
|
3732
|
+
const k = Zs(_, b), P = O(Math.floor(k[0] * z), 0, z - 1), j = O(Math.floor(k[1] * X), 0, X - 1) * z + P, q = tc(i, k[0], k[1]);
|
|
3721
3733
|
for (let G = 0; G < 2; G++) {
|
|
3722
3734
|
const te = G === 1 && c ? Hi(_, c) : _, ne = d[G], ue = q ? q[G].valid ? { uv: q[G].uv, confidence: q[G].confidence } : null : St(
|
|
3723
3735
|
te,
|
|
@@ -3726,7 +3738,7 @@ function Ia(t, e, i, n, r, o, { convergenceM: s, polarInverseDepth: a, registrat
|
|
|
3726
3738
|
m[G],
|
|
3727
3739
|
g[G],
|
|
3728
3740
|
G === 0 ? ((D = e == null ? void 0 : e.front) == null ? void 0 : D.radialScale) || 1 : ((F = e == null ? void 0 : e.back) == null ? void 0 : F.radialScale) || 1,
|
|
3729
|
-
|
|
3741
|
+
vc(te, s, a, !!l)
|
|
3730
3742
|
);
|
|
3731
3743
|
if (!ue) continue;
|
|
3732
3744
|
let [J, Z] = ue.uv;
|
|
@@ -3750,7 +3762,7 @@ function za(t, e, i, n, r, o, s, { convergenceM: a = 0, polarInverseDepth: c = [
|
|
|
3750
3762
|
{ convergenceM: a, polarInverseDepth: c, registrationOffsets: p, videoOffsets: u },
|
|
3751
3763
|
y
|
|
3752
3764
|
), { weights: m } = d;
|
|
3753
|
-
|
|
3765
|
+
ec(t, d, h, !!(y && !n));
|
|
3754
3766
|
const g = new Float64Array(z * X);
|
|
3755
3767
|
g.fill(65535);
|
|
3756
3768
|
const b = !!(i && e.dualFisheyeAutoGain);
|
|
@@ -3791,10 +3803,10 @@ function za(t, e, i, n, r, o, s, { convergenceM: a = 0, polarInverseDepth: c = [
|
|
|
3791
3803
|
}
|
|
3792
3804
|
}
|
|
3793
3805
|
return Xn(E, P, X, 2, G);
|
|
3794
|
-
}, ne = te(0), ue = te(P), J = ne && ue && ne.cost / X <= 180 && ue.cost / X <= 180 ?
|
|
3795
|
-
let Z =
|
|
3796
|
-
Z && u && S.every(Boolean) && (Z =
|
|
3797
|
-
const Tt = Z && u && S.every(Boolean) ?
|
|
3806
|
+
}, ne = te(0), ue = te(P), J = ne && ue && ne.cost / X <= 180 && ue.cost / X <= 180 ? nc(m, ne.seam, ue.seam.map((ce) => ce + P)) : null;
|
|
3807
|
+
let Z = oc(J, h, m, [D, F]);
|
|
3808
|
+
Z && u && S.every(Boolean) && (Z = fc(Z, h, m, [D, F], y && !n ? d : null)), Z && p && (Z = Fc(Z, h, m, [D, F], f));
|
|
3809
|
+
const Tt = Z && u && S.every(Boolean) ? sc(h, m, [D, F]) : null;
|
|
3798
3810
|
return { mask: Z, strength: Tt, gain: [D, F] };
|
|
3799
3811
|
}
|
|
3800
3812
|
function Hi(t, e) {
|
|
@@ -3807,7 +3819,7 @@ function Hi(t, e) {
|
|
|
3807
3819
|
const a = O(i + (e[1] * (1 - s) + e[3] * s) * o, -Math.PI / 2, Math.PI / 2);
|
|
3808
3820
|
return [Math.cos(a) * Math.sin(n), Math.sin(a), Math.cos(a) * Math.cos(n)];
|
|
3809
3821
|
}
|
|
3810
|
-
function
|
|
3822
|
+
function Fc(t, e, i, n, r) {
|
|
3811
3823
|
const o = t.slice();
|
|
3812
3824
|
for (const s of [0, X - 2]) {
|
|
3813
3825
|
const a = [0, 0];
|
|
@@ -3823,7 +3835,7 @@ function bc(t, e, i, n, r) {
|
|
|
3823
3835
|
}
|
|
3824
3836
|
return o;
|
|
3825
3837
|
}
|
|
3826
|
-
function
|
|
3838
|
+
function Mc(t, e, i = null) {
|
|
3827
3839
|
if (!e) return t;
|
|
3828
3840
|
const n = new Uint8Array(t.length);
|
|
3829
3841
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -3832,7 +3844,7 @@ function wc(t, e, i = null) {
|
|
|
3832
3844
|
}
|
|
3833
3845
|
return n;
|
|
3834
3846
|
}
|
|
3835
|
-
function
|
|
3847
|
+
function Dc(t, e) {
|
|
3836
3848
|
if ((e == null ? void 0 : e.width) !== t.width || (e == null ? void 0 : e.height) !== t.height) return !0;
|
|
3837
3849
|
const { width: i, height: n, pixels: r } = t, o = e.pixels, s = (r instanceof Uint8Array || r instanceof Uint8ClampedArray) && (o instanceof Uint8Array || o instanceof Uint8ClampedArray) && r.byteOffset % 4 === 0 && o.byteOffset % 4 === 0 && r.length === i * n * 4 && o.length === r.length, a = s ? new Uint32Array(r.buffer, r.byteOffset, r.byteLength / 4) : null, c = s ? new Uint32Array(o.buffer, o.byteOffset, o.byteLength / 4) : null;
|
|
3838
3850
|
for (let l = 0; l < n; l += 8) for (let u = 0; u < i; u += 8) {
|
|
@@ -3856,7 +3868,7 @@ function Fc(t, e) {
|
|
|
3856
3868
|
}
|
|
3857
3869
|
return !1;
|
|
3858
3870
|
}
|
|
3859
|
-
function
|
|
3871
|
+
function Sc(t, e, i, n, r, o, s) {
|
|
3860
3872
|
var y;
|
|
3861
3873
|
const a = n.every((p) => p.projectionModel === "dji_fisheye_lut"), c = a && (s != null && s.softwareFrames) ? Ia(
|
|
3862
3874
|
e,
|
|
@@ -3867,11 +3879,11 @@ function Mc(t, e, i, n, r, o, s) {
|
|
|
3867
3879
|
{ convergenceM: 0, polarInverseDepth: r.polarInverseDepth || [0, 0], registrationOffsets: r.offsets, videoOffsets: r.offsets },
|
|
3868
3880
|
s.projections || (s.projections = {})
|
|
3869
3881
|
) : null;
|
|
3870
|
-
let l = a && (s != null && s.softwareFrames) ?
|
|
3882
|
+
let l = a && (s != null && s.softwareFrames) ? mc(s.softwareFrames, s.softwareReadback || (s.softwareReadback = {}), s.surface, c) : null;
|
|
3871
3883
|
if (l || (s != null && s.softwareFrames && ((y = s.prepareSoftwareFallback) == null || y.call(s)), l = Gt(t, a ? 1024 : Ea, s)), !l) return null;
|
|
3872
3884
|
if (l.pixels[3] === 0) return;
|
|
3873
3885
|
const u = s == null ? void 0 : s.surface;
|
|
3874
|
-
if (u && !
|
|
3886
|
+
if (u && !Dc(l, u)) return { reused: !0 };
|
|
3875
3887
|
const f = za(
|
|
3876
3888
|
l,
|
|
3877
3889
|
{
|
|
@@ -3904,7 +3916,7 @@ function Jn(t, e, i, n) {
|
|
|
3904
3916
|
});
|
|
3905
3917
|
if (!a)
|
|
3906
3918
|
throw new Error("WebGL unavailable");
|
|
3907
|
-
const c = n === "dual_fisheye" ?
|
|
3919
|
+
const c = n === "dual_fisheye" ? $s(i.dualFisheyeCalibration, i.dualFisheyeFrontLens) : null, l = (c == null ? void 0 : c.textureOrigin) !== "top-left", u = !!(n === "equirect" && i.equirectCameraConvention === "mei" || n === "dual_fisheye" && c && [c.front, c.back].some((M) => ["mei_extended", "dji_fisheye_lut"].includes(M.projectionModel)));
|
|
3908
3920
|
t.dataset.insta360MEIConvention = u ? "true" : "false", t.dataset.insta360ProjectionKind = n, t.dataset.insta360CalibrationFrontModel = ((qr = c == null ? void 0 : c.front) == null ? void 0 : qr.projectionModel) || "";
|
|
3909
3921
|
const f = `
|
|
3910
3922
|
attribute vec2 aClipPosition;
|
|
@@ -4479,7 +4491,7 @@ function Jn(t, e, i, n) {
|
|
|
4479
4491
|
`}
|
|
4480
4492
|
${b}
|
|
4481
4493
|
}
|
|
4482
|
-
`, v =
|
|
4494
|
+
`, v = Js(a, f, x);
|
|
4483
4495
|
a.useProgram(v);
|
|
4484
4496
|
const w = a.getAttribLocation(v, "aClipPosition"), S = a.getUniformLocation(v, "uTex"), D = a.getUniformLocation(v, "uViewport"), F = a.getUniformLocation(v, "uTexel"), T = a.getUniformLocation(v, "uAspect"), L = a.getUniformLocation(v, "uTanHalfFov"), _ = a.getUniformLocation(v, "uViewQuat"), k = a.getUniformLocation(v, "uVisibleLens"), P = a.getUniformLocation(v, "uSeamWidth"), E = a.getUniformLocation(v, "uDualFisheyeFrontCenter"), j = a.getUniformLocation(v, "uDualFisheyeBackCenter"), q = a.getUniformLocation(v, "uDualFisheyeFrontValidRadius"), G = a.getUniformLocation(v, "uDualFisheyeBackValidRadius"), te = a.getUniformLocation(v, "uDualFisheyeFrontFocal"), ne = a.getUniformLocation(v, "uDualFisheyeBackFocal"), ue = a.getUniformLocation(v, "uDualFisheyeFrontPrincipalOffset"), J = a.getUniformLocation(v, "uDualFisheyeBackPrincipalOffset"), Z = a.getUniformLocation(v, "uDualFisheyeFrontScale"), Tt = a.getUniformLocation(v, "uDualFisheyeBackScale"), ce = a.getUniformLocation(v, "uDualFisheyeFrontRadial"), $ = a.getUniformLocation(v, "uDualFisheyeBackRadial"), xe = a.getUniformLocation(v, "uDualFisheyeFrontRadialScale"), pe = a.getUniformLocation(v, "uDualFisheyeBackRadialScale"), re = a.getUniformLocation(v, "uDualFisheyeDJIRadial5"), Te = a.getUniformLocation(v, "uDualFisheyeFrontTangential"), et = a.getUniformLocation(v, "uDualFisheyeBackTangential"), tt = a.getUniformLocation(v, "uDualFisheyeFrontXi"), Qt = a.getUniformLocation(v, "uDualFisheyeBackXi"), Ht = a.getUniformLocation(v, "uDualFisheyeFrontThinPrism"), Le = a.getUniformLocation(v, "uDualFisheyeBackThinPrism"), _e = a.getUniformLocation(v, "uDualFisheyeFrontSensorTilt"), it = a.getUniformLocation(v, "uDualFisheyeBackSensorTilt"), Ti = a.getUniformLocation(v, "uDualFisheyeConvergenceM"), ki = a.getUniformLocation(v, "uDualFisheyePolarInverseDepth"), Ri = ["Front", "Back"].map((M) => a.getUniformLocation(v, `uDualFisheye${M}TranslationM`)), at = ["Front", "Back"].map((M) => ["Pro0", "Pro1", "Pro2", "Pro12", "UsePro"].map((R) => a.getUniformLocation(v, `uDualFisheye${M}${R}`))), Pi = a.getUniformLocation(v, "uDualFisheyeFrontRotationQuat"), ja = a.getUniformLocation(v, "uDualFisheyeBackRotationQuat"), Na = a.getUniformLocation(v, "uDualFisheyeFrontUseMEI"), Oa = a.getUniformLocation(v, "uDualFisheyeBackUseMEI"), Va = a.getUniformLocation(v, "uDualFisheyeFrontUseDJI"), Wa = a.getUniformLocation(v, "uDualFisheyeBackUseDJI"), qa = a.getUniformLocation(v, "uDualFisheyeFrontAsymmetric"), Ga = a.getUniformLocation(v, "uDualFisheyeBackAsymmetric"), Xa = a.getUniformLocation(v, "uDualFisheyeFrontAxis"), $a = a.getUniformLocation(v, "uDualFisheyeBackAxis"), Ya = a.getUniformLocation(v, "uDualFisheyeFrontRight"), Qa = a.getUniformLocation(v, "uDualFisheyeBackRight"), Ha = a.getUniformLocation(v, "uDualFisheyeFrontUp"), Ja = a.getUniformLocation(v, "uDualFisheyeBackUp"), Ka = a.getUniformLocation(v, "uDualFisheyeMaxTheta"), Za = a.getUniformLocation(v, "uDualFisheyeBlendBand"), er = a.getUniformLocation(v, "uDualFisheyeSeamX"), tr = a.getUniformLocation(v, "uDualFisheyeSeamBlendX"), ir = a.getUniformLocation(v, "uDualFisheyeSeamFrontWrap"), ar = a.getUniformLocation(v, "uDualFisheyeUseSeamLongitudes"), rr = a.getUniformLocation(v, "uDualFisheyeGain"), io = a.getUniformLocation(v, "uDualFisheyeFrontRemap"), ao = a.getUniformLocation(v, "uDualFisheyeBackRemap"), nr = a.getUniformLocation(v, "uDualFisheyeUseRemap"), or = a.getUniformLocation(v, "uDualFisheyeSeamMask"), sr = a.getUniformLocation(v, "uDualFisheyeUseSeamMask"), cr = a.getUniformLocation(v, "uDualFisheyeVideoOffsets"), lr = a.getUniformLocation(v, "uDualFisheyeVideoSeam"), aa = a.createBuffer();
|
|
4485
4497
|
if (!aa)
|
|
@@ -4521,7 +4533,7 @@ function Jn(t, e, i, n) {
|
|
|
4521
4533
|
let kt = 0, Rt = 0, Pt = 0, ht = i.fovDeg, ei = !0, ti = !0, rt = 0, At = 0, ii = !0, ra = { width: 1, height: 1 };
|
|
4522
4534
|
const Ai = [];
|
|
4523
4535
|
let je = null, Lt = null, Ne = 0, dr = 0, fr = 0, na = "initial";
|
|
4524
|
-
const hr = s && !Zt, Li =
|
|
4536
|
+
const hr = s && !Zt, Li = Hs(i.background), mr = Yi(e), Me = n === "dual_fisheye" && Qs(mr.width, mr.height), be = c && !Me ? c.remap : null, _t = i.dualFisheyeFovDeg * Math.PI / 360, so = c ? c.front.center : i.dualFisheyeFrontCenter || (i.dualFisheyeFrontLens === "left" ? [0.25, 0.5] : [0.75, 0.5]), co = c ? c.back.center : i.dualFisheyeBackCenter || (i.dualFisheyeFrontLens === "left" ? [0.75, 0.5] : [0.25, 0.5]), lo = !!(c && ((Gr = c.imageSize) == null ? void 0 : Gr[1]) > ((Xr = c.imageSize) == null ? void 0 : Xr[0])), ye = (M) => Me && !lo ? [M[1], M[0]] : M, Ut = ye(so), ai = ye(co), pr = Wn(Ut, ai);
|
|
4525
4537
|
let Oe = c ? ye(c.front.validRadius) : pr, Ve = c ? ye(c.back.validRadius) : pr;
|
|
4526
4538
|
const _i = ye(c ? c.front.scale : fe(i.dualFisheyeScale, [0.247, 0.494])), Ui = ye(c ? c.back.scale : fe(i.dualFisheyeScale, [0.247, 0.494]));
|
|
4527
4539
|
let ke = c ? ye(c.front.focal) : Sa(_i, _t), Re = c ? ye(c.back.focal) : Sa(Ui, _t);
|
|
@@ -4568,7 +4580,7 @@ function Jn(t, e, i, n) {
|
|
|
4568
4580
|
if (!zt || st || Bt >= 3 || e.currentTime < da) return;
|
|
4569
4581
|
const M = Date.now();
|
|
4570
4582
|
try {
|
|
4571
|
-
const R = (nt ?
|
|
4583
|
+
const R = (nt ? yc : pc)(e, i, c, [We, qe]);
|
|
4572
4584
|
if (R === void 0) return;
|
|
4573
4585
|
R && (ot = R.offsets, It = R.polarInverseDepth || [0, 0], Ct = R.gain, nt ? (ke = ke.map((C) => C * R.focalScale), Re = Re.map((C) => C * R.focalScale), t.dataset.insta360VideoFocalScale = String(R.focalScale)) : (Oe = Vt(We), Ve = Vt(qe)), st = !0);
|
|
4574
4586
|
} catch {
|
|
@@ -4578,7 +4590,7 @@ function Jn(t, e, i, n) {
|
|
|
4578
4590
|
if (!s && n === "dual_fisheye") {
|
|
4579
4591
|
ua = !0;
|
|
4580
4592
|
try {
|
|
4581
|
-
const M =
|
|
4593
|
+
const M = bc(
|
|
4582
4594
|
e,
|
|
4583
4595
|
i,
|
|
4584
4596
|
c,
|
|
@@ -4610,7 +4622,7 @@ function Jn(t, e, i, n) {
|
|
|
4610
4622
|
if (!pt || !st || Pe >= 3 || e.seeking || e.currentTime + 1e-6 < gt) return;
|
|
4611
4623
|
const M = Date.now();
|
|
4612
4624
|
try {
|
|
4613
|
-
const C =
|
|
4625
|
+
const C = Sc(
|
|
4614
4626
|
e,
|
|
4615
4627
|
i,
|
|
4616
4628
|
c,
|
|
@@ -4626,7 +4638,7 @@ function Jn(t, e, i, n) {
|
|
|
4626
4638
|
}
|
|
4627
4639
|
const I = C == null ? void 0 : C.mask;
|
|
4628
4640
|
if (I instanceof Uint8Array) {
|
|
4629
|
-
const V =
|
|
4641
|
+
const V = Mc(I, yt, C.strength);
|
|
4630
4642
|
Tr(V, C.strength) ? (yt = V, Pe = 0, kr += 1) : Pe += 1;
|
|
4631
4643
|
} else Pe += 1;
|
|
4632
4644
|
} catch {
|
|
@@ -5025,7 +5037,7 @@ function Fn(t, e = 512, i = null, n = null) {
|
|
|
5025
5037
|
}
|
|
5026
5038
|
return a.putImageData(c, 0, 0), r;
|
|
5027
5039
|
}
|
|
5028
|
-
function
|
|
5040
|
+
function Tc(t, e, i = null) {
|
|
5029
5041
|
var o;
|
|
5030
5042
|
const n = i || document.createElement("canvas");
|
|
5031
5043
|
i || (n.width = ((o = e.dualFisheyeCalibration) == null ? void 0 : o.front.projectionModel) === "dji_fisheye_lut" ? 2048 : 1024, n.height = n.width / 2);
|
|
@@ -5034,7 +5046,7 @@ function Dc(t, e, i = null) {
|
|
|
5034
5046
|
r.destroy(), i || (n.width = n.height = 0);
|
|
5035
5047
|
} };
|
|
5036
5048
|
}
|
|
5037
|
-
function
|
|
5049
|
+
function kc(t, e, i) {
|
|
5038
5050
|
return Jn(t, e, Vn({ ...i, externalFrames: !1 }), i.projection || "dual_fisheye");
|
|
5039
5051
|
}
|
|
5040
5052
|
function Kn(t) {
|
|
@@ -5049,7 +5061,7 @@ function Kn(t) {
|
|
|
5049
5061
|
n = a.track.width * 2, r = a.track.height, o = [{ x: 0, y: 0, width: 0.5, height: 1 }, { x: 0.5, y: 0, width: 0.5, height: 1 }];
|
|
5050
5062
|
} else if (n = e[0].track.width, r = e[0].track.height, o = e.map(({ rect: a }) => a), o.some((a) => a.y !== 0 || a.width !== 0.5 || a.height !== 1) || ![0, 0.5].every((a) => o.some((c) => c.x === a))) return;
|
|
5051
5063
|
if (n !== r * 2) return;
|
|
5052
|
-
const s = t.lenses.slice(0, 2).map((a, c) =>
|
|
5064
|
+
const s = t.lenses.slice(0, 2).map((a, c) => Pc(a, e[c], o[c], t));
|
|
5053
5065
|
return {
|
|
5054
5066
|
imageSize: [n, r],
|
|
5055
5067
|
textureOrigin: t.textureOrigin === "top-left" ? "top-left" : "bottom-left",
|
|
@@ -5058,7 +5070,7 @@ function Kn(t) {
|
|
|
5058
5070
|
pipeline: { seamLongitudesDeg: [90, 270], featherWidthPx: Math.round(r * 16 / 360) }
|
|
5059
5071
|
};
|
|
5060
5072
|
}
|
|
5061
|
-
async function
|
|
5073
|
+
async function Rc(t, e) {
|
|
5062
5074
|
const i = Kn(e), n = ta(e);
|
|
5063
5075
|
if (!i || !n) throw new B("calibration_missing", "Real-time stitching requires two calibrated side-by-side lenses.");
|
|
5064
5076
|
if (typeof VideoDecoder > "u" || typeof EncodedVideoChunk > "u")
|
|
@@ -5071,7 +5083,7 @@ async function Tc(t, e) {
|
|
|
5071
5083
|
throw new B("codec_unsupported", "This browser cannot decode the calibrated panorama tracks.");
|
|
5072
5084
|
const a = document.createElement("canvas");
|
|
5073
5085
|
a.className = "panoramav-canvas";
|
|
5074
|
-
const c =
|
|
5086
|
+
const c = Tc(a, {
|
|
5075
5087
|
projection: "dual_fisheye",
|
|
5076
5088
|
dualFisheyeCalibration: i,
|
|
5077
5089
|
dualFisheyeFrontLens: i.front.center[0] < 0.5 ? "left" : "right",
|
|
@@ -5137,9 +5149,9 @@ async function Tc(t, e) {
|
|
|
5137
5149
|
setStabilization: () => "off"
|
|
5138
5150
|
};
|
|
5139
5151
|
}
|
|
5140
|
-
function
|
|
5152
|
+
function Pc(t, e, i, n) {
|
|
5141
5153
|
const r = t.width ?? e.track.width * e.rect.width, o = t.height ?? e.track.height * e.rect.height, s = t.extrinsicQuaternion, a = n.projection.kind === "mei-extended", c = a ? s : [s[0], -s[1], -s[2], -s[3]], l = (h) => {
|
|
5142
|
-
const d =
|
|
5154
|
+
const d = Ac(c, h);
|
|
5143
5155
|
return a ? d : [d[0], -d[2], d[1]];
|
|
5144
5156
|
}, u = l([1, 0, 0]), f = l([0, a ? 1 : -1, 0]), y = [t.fx / r * i.width, (t.fy ?? t.fx) / o * i.height], p = Math.min(r, o) * 0.475;
|
|
5145
5157
|
return {
|
|
@@ -5154,7 +5166,7 @@ function kc(t, e, i, n) {
|
|
|
5154
5166
|
thinPrism: bi(t.thinPrism, 4),
|
|
5155
5167
|
sensorTilt: bi(t.sensorTilt, 2),
|
|
5156
5168
|
xi: t.xi ?? 0,
|
|
5157
|
-
radialScale: a ? 1 :
|
|
5169
|
+
radialScale: a ? 1 : Lc(t),
|
|
5158
5170
|
distortionModel: t.distortionModel,
|
|
5159
5171
|
distortionCoeffs: t.distortionCoeffs,
|
|
5160
5172
|
translationM: t.translation,
|
|
@@ -5167,11 +5179,11 @@ function kc(t, e, i, n) {
|
|
|
5167
5179
|
function bi(t, e) {
|
|
5168
5180
|
return Array.from({ length: e }, (i, n) => Number((t == null ? void 0 : t[n]) ?? 0));
|
|
5169
5181
|
}
|
|
5170
|
-
function
|
|
5182
|
+
function Ac(t, [e, i, n]) {
|
|
5171
5183
|
const r = Math.hypot(...t), [o, s, a, c] = t.map((f) => f / r), l = s * e + a * i + c * n, u = o * o - s * s - a * a - c * c;
|
|
5172
5184
|
return [2 * l * s + u * e + 2 * o * (a * n - c * i), 2 * l * a + u * i + 2 * o * (c * e - s * n), 2 * l * c + u * n + 2 * o * (s * i - a * e)];
|
|
5173
5185
|
}
|
|
5174
|
-
function
|
|
5186
|
+
function Lc(t) {
|
|
5175
5187
|
const e = t.radialLut1, i = t.radialLut2;
|
|
5176
5188
|
if (!e || !i || e.length < 14 || i.length < 14 || !t.fx) return 1;
|
|
5177
5189
|
let n = 0;
|
|
@@ -5225,14 +5237,14 @@ function Zn(t) {
|
|
|
5225
5237
|
pipeline: { seamLongitudesDeg: [90, 270], featherWidthPx: Math.round(Math.min(e, i) * 16 / 360) }
|
|
5226
5238
|
};
|
|
5227
5239
|
}
|
|
5228
|
-
function
|
|
5240
|
+
function _c(t, e) {
|
|
5229
5241
|
const i = Zn(e);
|
|
5230
5242
|
if (!i) throw new B("calibration_missing", "This DNG does not contain supported dual-fisheye calibration.");
|
|
5231
5243
|
if (Math.abs(t.naturalWidth / t.naturalHeight - i.imageSize[0] / i.imageSize[1]) > 5e-3)
|
|
5232
5244
|
throw new B("invalid_manifest", "The developed DNG preview does not preserve the calibrated sensor geometry.");
|
|
5233
5245
|
const n = document.createElement("canvas");
|
|
5234
5246
|
n.className = "panoramav-canvas";
|
|
5235
|
-
const r =
|
|
5247
|
+
const r = kc(n, t, {
|
|
5236
5248
|
projection: "dual_fisheye",
|
|
5237
5249
|
dualFisheyeCalibration: i,
|
|
5238
5250
|
dualFisheyeFovDeg: 196,
|
|
@@ -5286,7 +5298,7 @@ function xi([t, e, i, n], [r, o, s]) {
|
|
|
5286
5298
|
const a = e * r + i * o + n * s, c = t * t - e * e - i * i - n * n;
|
|
5287
5299
|
return [2 * a * e + c * r + 2 * t * (i * s - n * o), 2 * a * i + c * o + 2 * t * (n * r - e * s), 2 * a * n + c * s + 2 * t * (e * o - i * r)];
|
|
5288
5300
|
}
|
|
5289
|
-
const
|
|
5301
|
+
const Uc = "Panorama is not close to a 2:1 equirectangular projection; raw dual-fisheye media requires vendor stitching, while stereoscopic media needs a compatible projection mode.", Ec = /* @__PURE__ */ new Set(["insp", "insv", "osv"]), Mn = /* @__PURE__ */ new Set(["insv", "osv"]), Dn = [
|
|
5290
5302
|
{
|
|
5291
5303
|
extensions: ["pano", "panorama", "360", "insp"],
|
|
5292
5304
|
family: "panorama",
|
|
@@ -5369,7 +5381,7 @@ class eo {
|
|
|
5369
5381
|
}
|
|
5370
5382
|
async load(e, i) {
|
|
5371
5383
|
var s, a, c, l, u, f, y;
|
|
5372
|
-
const n = this.beginLoad(i), r = n.signal, o = this.processor ?
|
|
5384
|
+
const n = this.beginLoad(i), r = n.signal, o = this.processor ? as(this.processor, r) : void 0;
|
|
5373
5385
|
this.state = {
|
|
5374
5386
|
...this.state,
|
|
5375
5387
|
loading: !0,
|
|
@@ -5395,7 +5407,7 @@ class eo {
|
|
|
5395
5407
|
}, this.emit("loading", this.state), this.emit("statechange", this.state);
|
|
5396
5408
|
try {
|
|
5397
5409
|
(s = i.signal) != null && s.aborted && n.abort(), H(r), this.osmoFallbackReason = "";
|
|
5398
|
-
const p = new
|
|
5410
|
+
const p = new Uo(), h = new Eo(this.scaleToFov(this.state.scale), 1, 1, 1100), d = ((a = i.route) == null ? void 0 : a.family) === "panorama-video", m = Si(i.descriptor.extension ?? ((c = i.route) == null ? void 0 : c.sourceFormat)), g = Vc(m, i.descriptor.contentType);
|
|
5399
5411
|
this.state.family = d ? "panorama-video" : "panorama", this.state.capabilities = {
|
|
5400
5412
|
...this.state.capabilities,
|
|
5401
5413
|
playback: d,
|
|
@@ -5408,7 +5420,7 @@ class eo {
|
|
|
5408
5420
|
return;
|
|
5409
5421
|
}
|
|
5410
5422
|
if (m === "insv" && this.osmoFallbackReason) throw new Error(`INSV ${this.osmoFallbackReason}`);
|
|
5411
|
-
const x = new
|
|
5423
|
+
const x = new Co({
|
|
5412
5424
|
antialias: !0,
|
|
5413
5425
|
alpha: !1,
|
|
5414
5426
|
preserveDrawingBuffer: !0
|
|
@@ -5417,13 +5429,13 @@ class eo {
|
|
|
5417
5429
|
this.finishScene(x, p, h);
|
|
5418
5430
|
return;
|
|
5419
5431
|
}
|
|
5420
|
-
const v = m === "osv" ? await this.resolveOsmoProxy(i.descriptor.name, r) : await le(
|
|
5432
|
+
const v = m === "osv" ? await this.resolveOsmoProxy(i.descriptor.name, r) : await le(Wc(e, m, r), r);
|
|
5421
5433
|
if (H(r), m === "insp" && o) {
|
|
5422
5434
|
const T = await o.open(v, { format: "insp", signal: r });
|
|
5423
5435
|
if (H(r), T.projection.kind === "mei-extended") {
|
|
5424
5436
|
const L = await le(new Yr().loadAsync(this.sourceToUrl(v, g)), r, (k) => k.dispose());
|
|
5425
5437
|
H(r), this.texture = L, L.anisotropy = x.capabilities.getMaxAnisotropy();
|
|
5426
|
-
const _ = await le(
|
|
5438
|
+
const _ = await le(hs(o, T, L), r, (k) => k.close());
|
|
5427
5439
|
H(r), _.mesh && p.add(_.mesh), this.texture = L, this.calibratedRenderer = _, this.state.vendor = T.vendor, this.state.cameraModel = T.cameraModel, this.state.calibrationSource = T.calibrationSource, this.state.projection = T.projection.kind, this.state.decodeMode = "browser-media", this.state.stitchMode = "calibrated-blend", this.state.naturalWidth = T.width, this.state.naturalHeight = T.height, this.state.warnings = T.confidence === "experimental" ? ["Experimental calibrated INSP preview uses the image's embedded lens calibration, exposure matching, and a content-aware feathered seam."] : T.warnings, this.state.warnings.length && this.emit("warnings", this.state.warnings), H(r), this.finishScene(x, p, h);
|
|
5428
5440
|
return;
|
|
5429
5441
|
}
|
|
@@ -5434,11 +5446,11 @@ class eo {
|
|
|
5434
5446
|
H(r), this.texture = w, w.colorSpace = Ji, w.anisotropy = x.capabilities.getMaxAnisotropy(), w.minFilter = Ft, w.generateMipmaps = !1;
|
|
5435
5447
|
const S = new Ki(500, 64, 40);
|
|
5436
5448
|
S.scale(-1, 1, 1);
|
|
5437
|
-
const D = new
|
|
5449
|
+
const D = new Io({
|
|
5438
5450
|
map: w
|
|
5439
5451
|
});
|
|
5440
|
-
p.add(new Zi(S, D)), this.renderer = x, this.scene = p, this.camera = h, this.texture = w, this.geometry = S, this.material = D, this.state.proxyPreview = this.state.proxyPreview || m === "osv", this.state.decodeMode = this.state.proxyPreview ? "proxy" : "browser-media", this.state.stitchMode = this.state.proxyPreview ? "proxy" : "equirectangular", this.state.naturalWidth = ((u = this.video) == null ? void 0 : u.videoWidth) ||
|
|
5441
|
-
const F =
|
|
5452
|
+
p.add(new Zi(S, D)), this.renderer = x, this.scene = p, this.camera = h, this.texture = w, this.geometry = S, this.material = D, this.state.proxyPreview = this.state.proxyPreview || m === "osv", this.state.decodeMode = this.state.proxyPreview ? "proxy" : "browser-media", this.state.stitchMode = this.state.proxyPreview ? "proxy" : "equirectangular", this.state.naturalWidth = ((u = this.video) == null ? void 0 : u.videoWidth) || zc(w), this.state.naturalHeight = ((f = this.video) == null ? void 0 : f.videoHeight) || Bc(w);
|
|
5453
|
+
const F = jc(this.state.naturalWidth, this.state.naturalHeight);
|
|
5442
5454
|
if (F) {
|
|
5443
5455
|
if (Mn.has(m))
|
|
5444
5456
|
throw new Error(`${m.toUpperCase()} contains an unstitched or unsupported projection. Export a stitched 2:1 video with the camera vendor app before spherical preview.`);
|
|
@@ -5447,7 +5459,7 @@ class eo {
|
|
|
5447
5459
|
H(r), this.finishScene(x, p, h);
|
|
5448
5460
|
} catch (p) {
|
|
5449
5461
|
if (r.aborted) throw new DOMException("Panorama preview was aborted.", "AbortError");
|
|
5450
|
-
const h =
|
|
5462
|
+
const h = Nc(p, i.descriptor.extension ?? ((y = i.route) == null ? void 0 : y.sourceFormat));
|
|
5451
5463
|
throw this.disposeScene(), this.state.loading = !1, this.state.error = h.message, this.emit("error", h), this.emit("statechange", this.state), h;
|
|
5452
5464
|
}
|
|
5453
5465
|
}
|
|
@@ -5497,7 +5509,7 @@ class eo {
|
|
|
5497
5509
|
return;
|
|
5498
5510
|
}
|
|
5499
5511
|
o.addEventListener("abort", f, { once: !0 }), a.src = this.sourceToUrl(e, "image/jpeg");
|
|
5500
|
-
}), H(o), this.calibratedRenderer =
|
|
5512
|
+
}), H(o), this.calibratedRenderer = _c(a, i), this.state.stitchMode = this.calibratedRenderer.dynamicSeam ? "static-seam" : "calibrated-blend", this.state.warnings.length && this.emit("warnings", this.state.warnings), H(o), this.finishRealtimeScene(this.calibratedRenderer.canvas);
|
|
5501
5513
|
} catch (a) {
|
|
5502
5514
|
throw o.aborted ? new DOMException("Panorama preview was aborted.", "AbortError") : (this.disposeScene(), this.state.loading = !1, this.state.error = a instanceof Error ? a.message : String(a), this.emit("statechange", this.state), a);
|
|
5503
5515
|
}
|
|
@@ -5608,18 +5620,18 @@ class eo {
|
|
|
5608
5620
|
let a, c;
|
|
5609
5621
|
try {
|
|
5610
5622
|
const y = i === "insv" ? await le(this.resolveInstaCompanion(n), r) : void 0;
|
|
5611
|
-
H(r), c =
|
|
5623
|
+
H(r), c = Cc(e, y, n);
|
|
5612
5624
|
const p = i === "insv" ? await le(this.resolveInstaSidecar(c.primaryName), r) : void 0;
|
|
5613
5625
|
H(r), a = await s.open(c.source, { format: i, sidecar: p, companion: c.companion, signal: r }), H(r);
|
|
5614
5626
|
const h = a.projection.kind === "unknown" && a.tracks.length === 1 && to(a.tracks[0].width, a.tracks[0].height);
|
|
5615
5627
|
if (a.projection.kind === "equirectangular" || h)
|
|
5616
5628
|
return this.state.vendor = a.vendor, this.state.cameraModel = a.cameraModel, this.state.calibrationSource = a.calibrationSource, this.state.projection = h ? "equirectangular" : a.projection.kind, this.state.proxyPreview = !!a.proxyPreview || h, this.state.warnings = h ? [...a.warnings, "INSV calibration metadata was unavailable; using its browser-decodable 2:1 stitched track as a proxy."] : a.warnings, this.state.warnings.length && this.emit("warnings", this.state.warnings), s.close(), !1;
|
|
5617
|
-
const d = await le(Kn(a) && !((l = a.imu) != null && l.imuToCameraConfirmed) ?
|
|
5629
|
+
const d = await le(Kn(a) && !((l = a.imu) != null && l.imuToCameraConfirmed) ? Rc(s, a) : ps(s, a), r, (m) => m.close());
|
|
5618
5630
|
return H(r), d.mesh && o.add(d.mesh), this.calibratedRenderer = d, this.state.vendor = a.vendor, this.state.cameraModel = a.cameraModel, this.state.calibrationSource = a.calibrationSource, this.state.projection = a.projection.kind, this.state.decodeMode = "webcodecs", this.state.stitchMode = "calibrated-blend", this.state.proxyPreview = !1, this.state.stabilizationAvailable = d.stabilizationAvailable, this.state.stabilizationMode = d.stabilizationMode, this.state.naturalWidth = 2048, this.state.naturalHeight = 1024, this.state.duration = d.duration, this.state.currentTime = d.currentTime, this.state.paused = d.paused, this.state.muted = !0, this.createCalibratedControls(d), this.state.warnings = a.confidence === "experimental" ? [`Experimental calibrated ${i.toUpperCase()} preview uses source-specific lens calibration. Dynamic seams and symmetric overlap exposure matching activate after paired frames; IMU stabilization ${d.stabilizationAvailable ? "is available" : "remains disabled until the IMU-to-camera rotation is confirmed"}.`] : a.warnings, this.state.warnings.length && this.emit("warnings", this.state.warnings), !0;
|
|
5619
5631
|
} catch (y) {
|
|
5620
5632
|
if (H(r), s.close(), i === "insv" && a && c && y instanceof B && y.code === "codec_unsupported")
|
|
5621
5633
|
try {
|
|
5622
|
-
const p = await le(
|
|
5634
|
+
const p = await le(ys(a, c.source, c.companion), r, (h) => h.close());
|
|
5623
5635
|
return H(r), p.mesh && o.add(p.mesh), this.calibratedRenderer = p, this.state.vendor = a.vendor, this.state.cameraModel = a.cameraModel, this.state.calibrationSource = a.calibrationSource, this.state.projection = a.projection.kind, this.state.decodeMode = "browser-media", this.state.stitchMode = "calibrated-blend", this.state.proxyPreview = !1, this.state.stabilizationAvailable = !1, this.state.stabilizationMode = "off", this.state.naturalWidth = (u = a.tracks[0]) == null ? void 0 : u.width, this.state.naturalHeight = (f = a.tracks[0]) == null ? void 0 : f.height, this.state.duration = p.duration, this.state.currentTime = p.currentTime, this.state.paused = p.paused, this.state.muted = !0, this.createCalibratedControls(p), this.state.warnings = [
|
|
5624
5636
|
"WebCodecs is unavailable; using browser media decoding. Dynamic seams and IMU stabilization are disabled.",
|
|
5625
5637
|
...a.warnings
|
|
@@ -5627,7 +5639,7 @@ class eo {
|
|
|
5627
5639
|
} catch (p) {
|
|
5628
5640
|
H(r), y = p;
|
|
5629
5641
|
}
|
|
5630
|
-
return this.osmoFallbackReason = i === "insv" ?
|
|
5642
|
+
return this.osmoFallbackReason = i === "insv" ? Oc(y) : y instanceof Error ? y.message : String(y), this.state.warnings = [i === "osv" ? `${this.osmoFallbackReason} Falling back to the camera-generated LRF proxy.` : this.osmoFallbackReason], !1;
|
|
5631
5643
|
}
|
|
5632
5644
|
}
|
|
5633
5645
|
async resolveInstaSidecar(e) {
|
|
@@ -5686,7 +5698,7 @@ class eo {
|
|
|
5686
5698
|
sourceToUrl(e, i) {
|
|
5687
5699
|
if (this.revokeCreatedUrl(), typeof e == "string")
|
|
5688
5700
|
return e;
|
|
5689
|
-
const n = e instanceof Blob && (!i || e.type === i) ? e : new Blob([e instanceof Blob ? e :
|
|
5701
|
+
const n = e instanceof Blob && (!i || e.type === i) ? e : new Blob([e instanceof Blob ? e : Ic(e)], i ? { type: i } : void 0);
|
|
5690
5702
|
return this.createdUrl = URL.createObjectURL(n), this.createdUrl;
|
|
5691
5703
|
}
|
|
5692
5704
|
async createVideoTexture(e, i, n) {
|
|
@@ -5745,7 +5757,7 @@ class eo {
|
|
|
5745
5757
|
n(i);
|
|
5746
5758
|
}
|
|
5747
5759
|
}
|
|
5748
|
-
function
|
|
5760
|
+
function Hc(t = {}) {
|
|
5749
5761
|
return {
|
|
5750
5762
|
id: "panorama",
|
|
5751
5763
|
family: "panorama",
|
|
@@ -5753,14 +5765,14 @@ function Yc(t = {}) {
|
|
|
5753
5765
|
createSession: (e, i) => new eo(e, i, t.processor)
|
|
5754
5766
|
};
|
|
5755
5767
|
}
|
|
5756
|
-
function
|
|
5768
|
+
function Jc(t = Po()) {
|
|
5757
5769
|
const e = new Set(Dn.flatMap((i) => i.extensions));
|
|
5758
5770
|
return [...Dn, ...t.filter((i) => !i.extensions.some((n) => e.has(n)))];
|
|
5759
5771
|
}
|
|
5760
|
-
function
|
|
5772
|
+
function Cc(t, e, i) {
|
|
5761
5773
|
return e && i && /_10_/i.test(i) ? { source: e, companion: t, primaryName: i.replace(/_10_/i, "_00_") } : { source: t, companion: e, primaryName: i };
|
|
5762
5774
|
}
|
|
5763
|
-
function
|
|
5775
|
+
function Ic(t) {
|
|
5764
5776
|
if (ArrayBuffer.isView(t)) {
|
|
5765
5777
|
const e = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
5766
5778
|
if (e.buffer instanceof ArrayBuffer) return e;
|
|
@@ -5769,11 +5781,11 @@ function Ec(t) {
|
|
|
5769
5781
|
}
|
|
5770
5782
|
return t;
|
|
5771
5783
|
}
|
|
5772
|
-
function
|
|
5784
|
+
function zc(t) {
|
|
5773
5785
|
const e = t.image;
|
|
5774
5786
|
return (e == null ? void 0 : e.naturalWidth) ?? (e == null ? void 0 : e.width);
|
|
5775
5787
|
}
|
|
5776
|
-
function
|
|
5788
|
+
function Bc(t) {
|
|
5777
5789
|
const e = t.image;
|
|
5778
5790
|
return (e == null ? void 0 : e.naturalHeight) ?? (e == null ? void 0 : e.height);
|
|
5779
5791
|
}
|
|
@@ -5783,21 +5795,21 @@ function to(t, e) {
|
|
|
5783
5795
|
const i = t / e;
|
|
5784
5796
|
return i >= 1.8 && i <= 2.2;
|
|
5785
5797
|
}
|
|
5786
|
-
function
|
|
5787
|
-
return t && e && !to(t, e) ?
|
|
5798
|
+
function jc(t, e) {
|
|
5799
|
+
return t && e && !to(t, e) ? Uc : void 0;
|
|
5788
5800
|
}
|
|
5789
|
-
function
|
|
5801
|
+
function Nc(t, e) {
|
|
5790
5802
|
const i = Si(e);
|
|
5791
|
-
return t instanceof Error && t.message.startsWith(i.toUpperCase()) ? t :
|
|
5803
|
+
return t instanceof Error && t.message.startsWith(i.toUpperCase()) ? t : Ec.has(i) ? new Error(`${i.toUpperCase()} source could not be decoded by this browser. Stitch or export it with the camera vendor app as a 2:1 JPEG, MP4, or WebM file.`) : t instanceof Error ? t : new Error(String(t));
|
|
5792
5804
|
}
|
|
5793
|
-
function
|
|
5805
|
+
function Oc(t) {
|
|
5794
5806
|
return t instanceof B ? t.code === "sidecar_missing" ? "This INSV needs its matching .insv.pb calibration sidecar. Upload the sidecar with the video, or export a stitched 2:1 MP4/WebM file." : t.code === "calibration_missing" || t.code === "invalid_manifest" ? "This INSV needs both matching _00_/_10_ lens files and valid calibration metadata. Upload the pair, or export a stitched 2:1 MP4/WebM file." : t.message : t instanceof Error ? t.message : String(t);
|
|
5795
5807
|
}
|
|
5796
5808
|
function xa(t) {
|
|
5797
5809
|
if (t)
|
|
5798
5810
|
return typeof t == "object" && "source" in t ? t.source : t;
|
|
5799
5811
|
}
|
|
5800
|
-
function
|
|
5812
|
+
function Vc(t, e) {
|
|
5801
5813
|
if (e && e !== "application/octet-stream")
|
|
5802
5814
|
return e;
|
|
5803
5815
|
switch (Si(t)) {
|
|
@@ -5810,7 +5822,7 @@ function Nc(t, e) {
|
|
|
5810
5822
|
return e;
|
|
5811
5823
|
}
|
|
5812
5824
|
}
|
|
5813
|
-
async function
|
|
5825
|
+
async function Wc(t, e, i) {
|
|
5814
5826
|
if (Si(e) !== "insp" || typeof t != "string")
|
|
5815
5827
|
return t;
|
|
5816
5828
|
const n = await fetch(t, { signal: i });
|
|
@@ -5828,22 +5840,22 @@ function Tn(t) {
|
|
|
5828
5840
|
function Si(t) {
|
|
5829
5841
|
return String(t ?? "").trim().replace(/^\./, "").toLowerCase();
|
|
5830
5842
|
}
|
|
5831
|
-
const
|
|
5843
|
+
const Kc = [{
|
|
5832
5844
|
extensions: ["dng"],
|
|
5833
5845
|
family: "image",
|
|
5834
5846
|
driverId: "raw-image",
|
|
5835
5847
|
targetFormat: "jpg",
|
|
5836
5848
|
contentTypes: ["image/dng", "image/x-adobe-dng"]
|
|
5837
5849
|
}];
|
|
5838
|
-
function
|
|
5850
|
+
function Zc(t) {
|
|
5839
5851
|
return {
|
|
5840
5852
|
id: "raw-image",
|
|
5841
5853
|
family: "image",
|
|
5842
5854
|
supports: (e) => e.replace(/^\./, "").toLowerCase() === "dng",
|
|
5843
|
-
createSession: (e, i) => new
|
|
5855
|
+
createSession: (e, i) => new qc(e, i ?? {}, t)
|
|
5844
5856
|
};
|
|
5845
5857
|
}
|
|
5846
|
-
class
|
|
5858
|
+
class qc {
|
|
5847
5859
|
constructor(e, i, n) {
|
|
5848
5860
|
A(this, "child");
|
|
5849
5861
|
A(this, "controller");
|
|
@@ -5948,13 +5960,13 @@ class Vc {
|
|
|
5948
5960
|
}
|
|
5949
5961
|
}
|
|
5950
5962
|
export {
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5963
|
+
Kc as R,
|
|
5964
|
+
Qc as a,
|
|
5965
|
+
Hc as b,
|
|
5954
5966
|
wi as c,
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5967
|
+
Zc as d,
|
|
5968
|
+
Jc as e,
|
|
5969
|
+
os as f,
|
|
5970
|
+
Yc as g,
|
|
5959
5971
|
Se as t
|
|
5960
5972
|
};
|