brainsmatics 1.0.52 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts +4 -0
- package/dist/basedecoder-0503cc54.js +1 -0
- package/dist/basedecoder-11034ec6.mjs +89 -0
- package/dist/component/2d/config.d.ts +40 -0
- package/dist/component/2d/contextmenu/ContextMenuX.d.ts +3 -0
- package/dist/component/2d/distribution/index.d.ts +4 -0
- package/dist/component/2d/gridviewer/index.d.ts +9 -0
- package/dist/component/2d/gridviewer/index1.d.ts +8 -0
- package/dist/component/2d/index.d.ts +9 -0
- package/dist/component/2d/infodiv/index.d.ts +7 -0
- package/dist/component/2d/modelloder.d.ts +3 -0
- package/dist/component/2d/mulifiveiewer/index.d.ts +4 -0
- package/dist/component/2d/navigation/index.d.ts +12 -0
- package/dist/component/2d/navtree/index.d.ts +13 -0
- package/dist/component/2d/tast1/config.d.ts +20 -0
- package/dist/component/2d/tast1/index.d.ts +4 -0
- package/dist/component/2d/thumbnail/VirtualList.d.ts +14 -0
- package/dist/component/2d/thumbnail/index.d.ts +12 -0
- package/dist/component/2d/twoviewer/index.d.ts +19 -0
- package/dist/component/3d/ai/index.d.ts +7 -0
- package/dist/component/3d/aichat/index.d.ts +6 -0
- package/dist/component/3d/atlas.d.ts +31 -0
- package/dist/component/3d/atlasBottomTabs/index.d.ts +19 -0
- package/dist/component/3d/atlasSiderBar/index.d.ts +79 -0
- package/dist/component/3d/auxiliary/index.d.ts +110 -0
- package/dist/component/3d/bottomTabs/index.d.ts +16 -0
- package/dist/component/3d/cardData/index.d.ts +3 -0
- package/dist/component/3d/chartViewer/index.d.ts +12 -0
- package/dist/component/3d/dataset/index.d.ts +3 -0
- package/dist/component/3d/index.d.ts +14 -0
- package/dist/component/3d/inputgrey/index.d.ts +3 -0
- package/dist/component/3d/lengthViewer/index.d.ts +10 -0
- package/dist/component/3d/markdown/index.d.ts +6 -0
- package/dist/component/3d/modal2DLoader/index.d.ts +11 -0
- package/dist/component/3d/modalLoader/index.d.ts +13 -0
- package/dist/component/3d/pipeline/index.d.ts +83 -0
- package/dist/component/3d/registration/index.d.ts +4 -0
- package/dist/component/3d/sangjiViewer/index.d.ts +6 -0
- package/dist/component/3d/section/index.d.ts +53 -0
- package/dist/component/3d/showreglions/index.d.ts +7 -0
- package/dist/component/3d/sideBar/index.d.ts +73 -0
- package/dist/component/3d/stlLoader/index.d.ts +9 -0
- package/dist/component/3d/swctree/index.d.ts +3 -0
- package/dist/component/3d/tabViewer/index.d.ts +13 -0
- package/dist/component/STAM.d.ts +4 -0
- package/dist/component/common/Button/index.d.ts +45 -0
- package/dist/component/common/Header/index.d.ts +19 -0
- package/dist/component/common/index.d.ts +2 -0
- package/dist/component/index.d.ts +2 -0
- package/dist/component/types/header.d.ts +9 -0
- package/dist/component/types/index.d.ts +1 -0
- package/dist/component/util/CommonFunctions.d.ts +23 -0
- package/dist/component/util/global.d.ts +17 -0
- package/dist/component/util/i18n.d.ts +3 -0
- package/dist/component/util/index.d.ts +2 -0
- package/dist/deflate-3e10bfac.mjs +12 -0
- package/dist/deflate-e0de6721.js +1 -0
- package/dist/index-0490899a.mjs +206752 -0
- package/dist/index-a2f68ec8.js +5108 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +52 -0
- package/dist/jpeg-335c778f.mjs +515 -0
- package/dist/jpeg-f3c7cefc.js +1 -0
- package/dist/lerc-2983f4d6.mjs +1035 -0
- package/dist/lerc-5de929d5.js +1 -0
- package/dist/lzw-82d7fc69.mjs +84 -0
- package/dist/lzw-f00e8c8c.js +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/packbits-58fd9c05.js +1 -0
- package/dist/packbits-8b95f4d7.mjs +24 -0
- package/dist/raw-9c0f4034.js +1 -0
- package/dist/raw-c0fe1c20.mjs +9 -0
- package/dist/stories/3Ddata.stories.d.ts +12 -0
- package/dist/stories/3Dlabel.d.ts +4 -0
- package/dist/stories/3Dlabelreglions.d.ts +4 -0
- package/dist/stories/3Dlable.stories.d.ts +12 -0
- package/dist/stories/3Dlablereglions.stories.d.ts +12 -0
- package/dist/stories/3Dneurons.d.ts +4 -0
- package/dist/stories/3Dneurons.stories.d.ts +12 -0
- package/dist/stories/3Dswc.stories.d.ts +12 -0
- package/dist/stories/ArlasViewer.stories.d.ts +12 -0
- package/dist/stories/AtlasViewer.d.ts +3 -0
- package/dist/stories/Button.stories.d.ts +25 -0
- package/dist/stories/Distribution.stories.d.ts +11 -0
- package/dist/stories/Header.stories.d.ts +32 -0
- package/dist/stories/Iputgrey.stories.d.ts +12 -0
- package/dist/stories/MulfiViewer.stories.d.ts +11 -0
- package/dist/stories/Page.d.ts +3 -0
- package/dist/stories/Page.stories.d.ts +15 -0
- package/dist/stories/Sangjiviewer.stories.d.ts +14 -0
- package/dist/stories/Soma.d.ts +4 -0
- package/dist/stories/Soma.stories.d.ts +12 -0
- package/dist/stories/Task3D.stories.d.ts +12 -0
- package/dist/stories/Thumbnail.stories.d.ts +25 -0
- package/dist/stories/Vessel.d.ts +4 -0
- package/dist/stories/Vessel.stories.d.ts +12 -0
- package/dist/stories/chartviewer.stories.d.ts +20 -0
- package/dist/stories/lengthviewer.stories.d.ts +17 -0
- package/dist/stories/navtree.stories.d.ts +25 -0
- package/dist/stories/registration.stories.d.ts +12 -0
- package/dist/stories/task3D.d.ts +4 -0
- package/dist/stories/tast1.stories.d.ts +11 -0
- package/dist/stories/twoview.stories.d.ts +31 -0
- package/dist/style.css +1 -0
- package/dist/webimage-affb95d1.mjs +19 -0
- package/dist/webimage-bc81928d.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./component";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-a2f68ec8.js");require("react");require("react-dom");exports.Atlas=e.Atlas;exports.AtlasBottomTabs=e.AtlasBottomTabs;exports.AtlasSideBar=e.AtlasSideBar;exports.Auxiliary=e.Auxiliary;exports.BottomTabs=e.BottomTabs;exports.Button=e.Button;exports.Carddata=e.Carddata;exports.Distribution=e.Distribution;exports.GridViewer=e.GridViewer;exports.Header=e.Header;exports.InfoDiv=e.InfoDiv;exports.LoadFBX=e.LoadFBX;exports.LoadsceneFBX=e.LoadsceneFBX;exports.Modal2DLoader=e.Modal2DLoader;exports.ModalLoader=e.modalLoader;exports.MulfiViewer=e.MulfiViewer;exports.NavTree=e.NavTree;exports.NaviGation=e.NaviGation;exports.PipeLine=e.PipeLine;exports.Sections=e.Sections;exports.ShowReglions=e.ShowReglions;exports.SideBar=e.SideBar;exports.StlLoader=e.StlLoader;exports.Swctree=e.Swctree;exports.Thumbnail=e.Thumbnail;exports.TwoViewer=e.TwoViewer;exports.Z=e.Z;exports.bbox=e.bbox;exports.camera=e.camera;exports.cameralight=e.cameralight;exports.fbxmeshs=e.fbxmeshs;exports.fbxmeshs_jing=e.fbxmeshs_jing;exports.fetchData=e.fetchData;exports.findChildrenByKey=e.findChildrenByKey;exports.findNodeByName=e.findNodeByName;exports.findNodeListByfather=e.findNodeListByfather;exports.findfatherlist=e.findfatherlist;exports.formatDate=e.formatDate;exports.getParentKey=e.getParentKey;exports.logMessage=e.logMessage;exports.mirrorDisplayTag=e.mirrorDisplayTag;exports.node_data=e.node_data;exports.scale=e.scale;exports.scene=e.scene;exports.tranX=e.tranX;exports.tranY=e.tranY;exports.tranZ=e.tranZ;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { l as i, k as r, j as o, A as d, B as n, n as l, C as f, D as m, G as B, H as h, I as b, s as c, r as g, f as y, m as w, M as D, N as L, b as S, P as T, d as p, h as u, S as x, e as N, g as A, c as M, T as v, Z as V, W as C, E as F, z as G, Q as K, R as P, o as X, u as j, v as H, t as I, x as R, q as Z, w as _, p as k, U as q, V as z, F as E, y as J, J as O, K as Q, O as U } from "./index-0490899a.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
export {
|
|
5
|
+
i as Atlas,
|
|
6
|
+
r as AtlasBottomTabs,
|
|
7
|
+
o as AtlasSideBar,
|
|
8
|
+
d as Auxiliary,
|
|
9
|
+
n as BottomTabs,
|
|
10
|
+
l as Button,
|
|
11
|
+
f as Carddata,
|
|
12
|
+
m as Distribution,
|
|
13
|
+
B as GridViewer,
|
|
14
|
+
h as Header,
|
|
15
|
+
b as InfoDiv,
|
|
16
|
+
c as LoadFBX,
|
|
17
|
+
g as LoadsceneFBX,
|
|
18
|
+
y as Modal2DLoader,
|
|
19
|
+
w as ModalLoader,
|
|
20
|
+
D as MulfiViewer,
|
|
21
|
+
L as NavTree,
|
|
22
|
+
S as NaviGation,
|
|
23
|
+
T as PipeLine,
|
|
24
|
+
p as Sections,
|
|
25
|
+
u as ShowReglions,
|
|
26
|
+
x as SideBar,
|
|
27
|
+
N as StlLoader,
|
|
28
|
+
A as Swctree,
|
|
29
|
+
M as Thumbnail,
|
|
30
|
+
v as TwoViewer,
|
|
31
|
+
V as Z,
|
|
32
|
+
C as bbox,
|
|
33
|
+
F as camera,
|
|
34
|
+
G as cameralight,
|
|
35
|
+
K as fbxmeshs,
|
|
36
|
+
P as fbxmeshs_jing,
|
|
37
|
+
X as fetchData,
|
|
38
|
+
j as findChildrenByKey,
|
|
39
|
+
H as findNodeByName,
|
|
40
|
+
I as findNodeListByfather,
|
|
41
|
+
R as findfatherlist,
|
|
42
|
+
Z as formatDate,
|
|
43
|
+
_ as getParentKey,
|
|
44
|
+
k as logMessage,
|
|
45
|
+
q as mirrorDisplayTag,
|
|
46
|
+
z as node_data,
|
|
47
|
+
E as scale,
|
|
48
|
+
J as scene,
|
|
49
|
+
O as tranX,
|
|
50
|
+
Q as tranY,
|
|
51
|
+
U as tranZ
|
|
52
|
+
};
|
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { B as re } from "./basedecoder-11034ec6.mjs";
|
|
2
|
+
const O = new Int32Array([
|
|
3
|
+
0,
|
|
4
|
+
1,
|
|
5
|
+
8,
|
|
6
|
+
16,
|
|
7
|
+
9,
|
|
8
|
+
2,
|
|
9
|
+
3,
|
|
10
|
+
10,
|
|
11
|
+
17,
|
|
12
|
+
24,
|
|
13
|
+
32,
|
|
14
|
+
25,
|
|
15
|
+
18,
|
|
16
|
+
11,
|
|
17
|
+
4,
|
|
18
|
+
5,
|
|
19
|
+
12,
|
|
20
|
+
19,
|
|
21
|
+
26,
|
|
22
|
+
33,
|
|
23
|
+
40,
|
|
24
|
+
48,
|
|
25
|
+
41,
|
|
26
|
+
34,
|
|
27
|
+
27,
|
|
28
|
+
20,
|
|
29
|
+
13,
|
|
30
|
+
6,
|
|
31
|
+
7,
|
|
32
|
+
14,
|
|
33
|
+
21,
|
|
34
|
+
28,
|
|
35
|
+
35,
|
|
36
|
+
42,
|
|
37
|
+
49,
|
|
38
|
+
56,
|
|
39
|
+
57,
|
|
40
|
+
50,
|
|
41
|
+
43,
|
|
42
|
+
36,
|
|
43
|
+
29,
|
|
44
|
+
22,
|
|
45
|
+
15,
|
|
46
|
+
23,
|
|
47
|
+
30,
|
|
48
|
+
37,
|
|
49
|
+
44,
|
|
50
|
+
51,
|
|
51
|
+
58,
|
|
52
|
+
59,
|
|
53
|
+
52,
|
|
54
|
+
45,
|
|
55
|
+
38,
|
|
56
|
+
31,
|
|
57
|
+
39,
|
|
58
|
+
46,
|
|
59
|
+
53,
|
|
60
|
+
60,
|
|
61
|
+
61,
|
|
62
|
+
54,
|
|
63
|
+
47,
|
|
64
|
+
55,
|
|
65
|
+
62,
|
|
66
|
+
63
|
|
67
|
+
]), Y = 4017, Z = 799, $ = 3406, N = 2276, Q = 1567, W = 3784, R = 5793, K = 2896;
|
|
68
|
+
function ne(q, l) {
|
|
69
|
+
let o = 0;
|
|
70
|
+
const u = [];
|
|
71
|
+
let T = 16;
|
|
72
|
+
for (; T > 0 && !q[T - 1]; )
|
|
73
|
+
--T;
|
|
74
|
+
u.push({ children: [], index: 0 });
|
|
75
|
+
let w = u[0], C;
|
|
76
|
+
for (let t = 0; t < T; t++) {
|
|
77
|
+
for (let h = 0; h < q[t]; h++) {
|
|
78
|
+
for (w = u.pop(), w.children[w.index] = l[o]; w.index > 0; )
|
|
79
|
+
w = u.pop();
|
|
80
|
+
for (w.index++, u.push(w); u.length <= t; )
|
|
81
|
+
u.push(C = { children: [], index: 0 }), w.children[w.index] = C.children, w = C;
|
|
82
|
+
o++;
|
|
83
|
+
}
|
|
84
|
+
t + 1 < T && (u.push(C = { children: [], index: 0 }), w.children[w.index] = C.children, w = C);
|
|
85
|
+
}
|
|
86
|
+
return u[0].children;
|
|
87
|
+
}
|
|
88
|
+
function ce(q, l, o, u, T, w, C, t, h) {
|
|
89
|
+
const { mcusPerLine: F, progressive: c } = o, r = l;
|
|
90
|
+
let b = l, i = 0, d = 0;
|
|
91
|
+
function m() {
|
|
92
|
+
if (d > 0)
|
|
93
|
+
return d--, i >> d & 1;
|
|
94
|
+
if (i = q[b++], i === 255) {
|
|
95
|
+
const a = q[b++];
|
|
96
|
+
if (a)
|
|
97
|
+
throw new Error(`unexpected marker: ${(i << 8 | a).toString(16)}`);
|
|
98
|
+
}
|
|
99
|
+
return d = 7, i >>> 7;
|
|
100
|
+
}
|
|
101
|
+
function x(a) {
|
|
102
|
+
let f = a, p;
|
|
103
|
+
for (; (p = m()) !== null; ) {
|
|
104
|
+
if (f = f[p], typeof f == "number")
|
|
105
|
+
return f;
|
|
106
|
+
if (typeof f != "object")
|
|
107
|
+
throw new Error("invalid huffman sequence");
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
function E(a) {
|
|
112
|
+
let f = a, p = 0;
|
|
113
|
+
for (; f > 0; ) {
|
|
114
|
+
const L = m();
|
|
115
|
+
if (L === null)
|
|
116
|
+
return;
|
|
117
|
+
p = p << 1 | L, --f;
|
|
118
|
+
}
|
|
119
|
+
return p;
|
|
120
|
+
}
|
|
121
|
+
function k(a) {
|
|
122
|
+
const f = E(a);
|
|
123
|
+
return f >= 1 << a - 1 ? f : f + (-1 << a) + 1;
|
|
124
|
+
}
|
|
125
|
+
function A(a, f) {
|
|
126
|
+
const p = x(a.huffmanTableDC), L = p === 0 ? 0 : k(p);
|
|
127
|
+
a.pred += L, f[0] = a.pred;
|
|
128
|
+
let D = 1;
|
|
129
|
+
for (; D < 64; ) {
|
|
130
|
+
const P = x(a.huffmanTableAC), y = P & 15, S = P >> 4;
|
|
131
|
+
if (y === 0) {
|
|
132
|
+
if (S < 15)
|
|
133
|
+
break;
|
|
134
|
+
D += 16;
|
|
135
|
+
} else {
|
|
136
|
+
D += S;
|
|
137
|
+
const I = O[D];
|
|
138
|
+
f[I] = k(y), D++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function v(a, f) {
|
|
143
|
+
const p = x(a.huffmanTableDC), L = p === 0 ? 0 : k(p) << h;
|
|
144
|
+
a.pred += L, f[0] = a.pred;
|
|
145
|
+
}
|
|
146
|
+
function s(a, f) {
|
|
147
|
+
f[0] |= m() << h;
|
|
148
|
+
}
|
|
149
|
+
let n = 0;
|
|
150
|
+
function g(a, f) {
|
|
151
|
+
if (n > 0) {
|
|
152
|
+
n--;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
let p = w;
|
|
156
|
+
const L = C;
|
|
157
|
+
for (; p <= L; ) {
|
|
158
|
+
const D = x(a.huffmanTableAC), P = D & 15, y = D >> 4;
|
|
159
|
+
if (P === 0) {
|
|
160
|
+
if (y < 15) {
|
|
161
|
+
n = E(y) + (1 << y) - 1;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
p += 16;
|
|
165
|
+
} else {
|
|
166
|
+
p += y;
|
|
167
|
+
const S = O[p];
|
|
168
|
+
f[S] = k(P) * (1 << h), p++;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
let e = 0, _;
|
|
173
|
+
function te(a, f) {
|
|
174
|
+
let p = w;
|
|
175
|
+
const L = C;
|
|
176
|
+
let D = 0;
|
|
177
|
+
for (; p <= L; ) {
|
|
178
|
+
const P = O[p], y = f[P] < 0 ? -1 : 1;
|
|
179
|
+
switch (e) {
|
|
180
|
+
case 0: {
|
|
181
|
+
const S = x(a.huffmanTableAC), I = S & 15;
|
|
182
|
+
if (D = S >> 4, I === 0)
|
|
183
|
+
D < 15 ? (n = E(D) + (1 << D), e = 4) : (D = 16, e = 1);
|
|
184
|
+
else {
|
|
185
|
+
if (I !== 1)
|
|
186
|
+
throw new Error("invalid ACn encoding");
|
|
187
|
+
_ = k(I), e = D ? 2 : 3;
|
|
188
|
+
}
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
case 1:
|
|
192
|
+
case 2:
|
|
193
|
+
f[P] ? f[P] += (m() << h) * y : (D--, D === 0 && (e = e === 2 ? 3 : 0));
|
|
194
|
+
break;
|
|
195
|
+
case 3:
|
|
196
|
+
f[P] ? f[P] += (m() << h) * y : (f[P] = _ << h, e = 0);
|
|
197
|
+
break;
|
|
198
|
+
case 4:
|
|
199
|
+
f[P] && (f[P] += (m() << h) * y);
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
p++;
|
|
203
|
+
}
|
|
204
|
+
e === 4 && (n--, n === 0 && (e = 0));
|
|
205
|
+
}
|
|
206
|
+
function se(a, f, p, L, D) {
|
|
207
|
+
const P = p / F | 0, y = p % F, S = P * a.v + L, I = y * a.h + D;
|
|
208
|
+
f(a, a.blocks[S][I]);
|
|
209
|
+
}
|
|
210
|
+
function oe(a, f, p) {
|
|
211
|
+
const L = p / a.blocksPerLine | 0, D = p % a.blocksPerLine;
|
|
212
|
+
f(a, a.blocks[L][D]);
|
|
213
|
+
}
|
|
214
|
+
const V = u.length;
|
|
215
|
+
let U, j, G, X, B, H;
|
|
216
|
+
c ? w === 0 ? H = t === 0 ? v : s : H = t === 0 ? g : te : H = A;
|
|
217
|
+
let M = 0, z, J;
|
|
218
|
+
V === 1 ? J = u[0].blocksPerLine * u[0].blocksPerColumn : J = F * o.mcusPerColumn;
|
|
219
|
+
const ee = T || J;
|
|
220
|
+
for (; M < J; ) {
|
|
221
|
+
for (j = 0; j < V; j++)
|
|
222
|
+
u[j].pred = 0;
|
|
223
|
+
if (n = 0, V === 1)
|
|
224
|
+
for (U = u[0], B = 0; B < ee; B++)
|
|
225
|
+
oe(U, H, M), M++;
|
|
226
|
+
else
|
|
227
|
+
for (B = 0; B < ee; B++) {
|
|
228
|
+
for (j = 0; j < V; j++) {
|
|
229
|
+
U = u[j];
|
|
230
|
+
const { h: a, v: f } = U;
|
|
231
|
+
for (G = 0; G < f; G++)
|
|
232
|
+
for (X = 0; X < a; X++)
|
|
233
|
+
se(U, H, M, G, X);
|
|
234
|
+
}
|
|
235
|
+
if (M++, M === J)
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
if (d = 0, z = q[b] << 8 | q[b + 1], z < 65280)
|
|
239
|
+
throw new Error("marker was not found");
|
|
240
|
+
if (z >= 65488 && z <= 65495)
|
|
241
|
+
b += 2;
|
|
242
|
+
else
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
return b - r;
|
|
246
|
+
}
|
|
247
|
+
function ie(q, l) {
|
|
248
|
+
const o = [], { blocksPerLine: u, blocksPerColumn: T } = l, w = u << 3, C = new Int32Array(64), t = new Uint8Array(64);
|
|
249
|
+
function h(F, c, r) {
|
|
250
|
+
const b = l.quantizationTable;
|
|
251
|
+
let i, d, m, x, E, k, A, v, s;
|
|
252
|
+
const n = r;
|
|
253
|
+
let g;
|
|
254
|
+
for (g = 0; g < 64; g++)
|
|
255
|
+
n[g] = F[g] * b[g];
|
|
256
|
+
for (g = 0; g < 8; ++g) {
|
|
257
|
+
const e = 8 * g;
|
|
258
|
+
if (n[1 + e] === 0 && n[2 + e] === 0 && n[3 + e] === 0 && n[4 + e] === 0 && n[5 + e] === 0 && n[6 + e] === 0 && n[7 + e] === 0) {
|
|
259
|
+
s = R * n[0 + e] + 512 >> 10, n[0 + e] = s, n[1 + e] = s, n[2 + e] = s, n[3 + e] = s, n[4 + e] = s, n[5 + e] = s, n[6 + e] = s, n[7 + e] = s;
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
i = R * n[0 + e] + 128 >> 8, d = R * n[4 + e] + 128 >> 8, m = n[2 + e], x = n[6 + e], E = K * (n[1 + e] - n[7 + e]) + 128 >> 8, v = K * (n[1 + e] + n[7 + e]) + 128 >> 8, k = n[3 + e] << 4, A = n[5 + e] << 4, s = i - d + 1 >> 1, i = i + d + 1 >> 1, d = s, s = m * W + x * Q + 128 >> 8, m = m * Q - x * W + 128 >> 8, x = s, s = E - A + 1 >> 1, E = E + A + 1 >> 1, A = s, s = v + k + 1 >> 1, k = v - k + 1 >> 1, v = s, s = i - x + 1 >> 1, i = i + x + 1 >> 1, x = s, s = d - m + 1 >> 1, d = d + m + 1 >> 1, m = s, s = E * N + v * $ + 2048 >> 12, E = E * $ - v * N + 2048 >> 12, v = s, s = k * Z + A * Y + 2048 >> 12, k = k * Y - A * Z + 2048 >> 12, A = s, n[0 + e] = i + v, n[7 + e] = i - v, n[1 + e] = d + A, n[6 + e] = d - A, n[2 + e] = m + k, n[5 + e] = m - k, n[3 + e] = x + E, n[4 + e] = x - E;
|
|
263
|
+
}
|
|
264
|
+
for (g = 0; g < 8; ++g) {
|
|
265
|
+
const e = g;
|
|
266
|
+
if (n[1 * 8 + e] === 0 && n[2 * 8 + e] === 0 && n[3 * 8 + e] === 0 && n[4 * 8 + e] === 0 && n[5 * 8 + e] === 0 && n[6 * 8 + e] === 0 && n[7 * 8 + e] === 0) {
|
|
267
|
+
s = R * r[g + 0] + 8192 >> 14, n[0 * 8 + e] = s, n[1 * 8 + e] = s, n[2 * 8 + e] = s, n[3 * 8 + e] = s, n[4 * 8 + e] = s, n[5 * 8 + e] = s, n[6 * 8 + e] = s, n[7 * 8 + e] = s;
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
i = R * n[0 * 8 + e] + 2048 >> 12, d = R * n[4 * 8 + e] + 2048 >> 12, m = n[2 * 8 + e], x = n[6 * 8 + e], E = K * (n[1 * 8 + e] - n[7 * 8 + e]) + 2048 >> 12, v = K * (n[1 * 8 + e] + n[7 * 8 + e]) + 2048 >> 12, k = n[3 * 8 + e], A = n[5 * 8 + e], s = i - d + 1 >> 1, i = i + d + 1 >> 1, d = s, s = m * W + x * Q + 2048 >> 12, m = m * Q - x * W + 2048 >> 12, x = s, s = E - A + 1 >> 1, E = E + A + 1 >> 1, A = s, s = v + k + 1 >> 1, k = v - k + 1 >> 1, v = s, s = i - x + 1 >> 1, i = i + x + 1 >> 1, x = s, s = d - m + 1 >> 1, d = d + m + 1 >> 1, m = s, s = E * N + v * $ + 2048 >> 12, E = E * $ - v * N + 2048 >> 12, v = s, s = k * Z + A * Y + 2048 >> 12, k = k * Y - A * Z + 2048 >> 12, A = s, n[0 * 8 + e] = i + v, n[7 * 8 + e] = i - v, n[1 * 8 + e] = d + A, n[6 * 8 + e] = d - A, n[2 * 8 + e] = m + k, n[5 * 8 + e] = m - k, n[3 * 8 + e] = x + E, n[4 * 8 + e] = x - E;
|
|
271
|
+
}
|
|
272
|
+
for (g = 0; g < 64; ++g) {
|
|
273
|
+
const e = 128 + (n[g] + 8 >> 4);
|
|
274
|
+
e < 0 ? c[g] = 0 : e > 255 ? c[g] = 255 : c[g] = e;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
for (let F = 0; F < T; F++) {
|
|
278
|
+
const c = F << 3;
|
|
279
|
+
for (let r = 0; r < 8; r++)
|
|
280
|
+
o.push(new Uint8Array(w));
|
|
281
|
+
for (let r = 0; r < u; r++) {
|
|
282
|
+
h(l.blocks[F][r], t, C);
|
|
283
|
+
let b = 0;
|
|
284
|
+
const i = r << 3;
|
|
285
|
+
for (let d = 0; d < 8; d++) {
|
|
286
|
+
const m = o[c + d];
|
|
287
|
+
for (let x = 0; x < 8; x++)
|
|
288
|
+
m[i + x] = t[b++];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return o;
|
|
293
|
+
}
|
|
294
|
+
class le {
|
|
295
|
+
constructor() {
|
|
296
|
+
this.jfif = null, this.adobe = null, this.quantizationTables = [], this.huffmanTablesAC = [], this.huffmanTablesDC = [], this.resetFrames();
|
|
297
|
+
}
|
|
298
|
+
resetFrames() {
|
|
299
|
+
this.frames = [];
|
|
300
|
+
}
|
|
301
|
+
parse(l) {
|
|
302
|
+
let o = 0;
|
|
303
|
+
function u() {
|
|
304
|
+
const t = l[o] << 8 | l[o + 1];
|
|
305
|
+
return o += 2, t;
|
|
306
|
+
}
|
|
307
|
+
function T() {
|
|
308
|
+
const t = u(), h = l.subarray(o, o + t - 2);
|
|
309
|
+
return o += h.length, h;
|
|
310
|
+
}
|
|
311
|
+
function w(t) {
|
|
312
|
+
let h = 0, F = 0, c, r;
|
|
313
|
+
for (r in t.components)
|
|
314
|
+
t.components.hasOwnProperty(r) && (c = t.components[r], h < c.h && (h = c.h), F < c.v && (F = c.v));
|
|
315
|
+
const b = Math.ceil(t.samplesPerLine / 8 / h), i = Math.ceil(t.scanLines / 8 / F);
|
|
316
|
+
for (r in t.components)
|
|
317
|
+
if (t.components.hasOwnProperty(r)) {
|
|
318
|
+
c = t.components[r];
|
|
319
|
+
const d = Math.ceil(Math.ceil(t.samplesPerLine / 8) * c.h / h), m = Math.ceil(Math.ceil(t.scanLines / 8) * c.v / F), x = b * c.h, E = i * c.v, k = [];
|
|
320
|
+
for (let A = 0; A < E; A++) {
|
|
321
|
+
const v = [];
|
|
322
|
+
for (let s = 0; s < x; s++)
|
|
323
|
+
v.push(new Int32Array(64));
|
|
324
|
+
k.push(v);
|
|
325
|
+
}
|
|
326
|
+
c.blocksPerLine = d, c.blocksPerColumn = m, c.blocks = k;
|
|
327
|
+
}
|
|
328
|
+
t.maxH = h, t.maxV = F, t.mcusPerLine = b, t.mcusPerColumn = i;
|
|
329
|
+
}
|
|
330
|
+
let C = u();
|
|
331
|
+
if (C !== 65496)
|
|
332
|
+
throw new Error("SOI not found");
|
|
333
|
+
for (C = u(); C !== 65497; ) {
|
|
334
|
+
switch (C) {
|
|
335
|
+
case 65280:
|
|
336
|
+
break;
|
|
337
|
+
case 65504:
|
|
338
|
+
case 65505:
|
|
339
|
+
case 65506:
|
|
340
|
+
case 65507:
|
|
341
|
+
case 65508:
|
|
342
|
+
case 65509:
|
|
343
|
+
case 65510:
|
|
344
|
+
case 65511:
|
|
345
|
+
case 65512:
|
|
346
|
+
case 65513:
|
|
347
|
+
case 65514:
|
|
348
|
+
case 65515:
|
|
349
|
+
case 65516:
|
|
350
|
+
case 65517:
|
|
351
|
+
case 65518:
|
|
352
|
+
case 65519:
|
|
353
|
+
case 65534: {
|
|
354
|
+
const t = T();
|
|
355
|
+
C === 65504 && t[0] === 74 && t[1] === 70 && t[2] === 73 && t[3] === 70 && t[4] === 0 && (this.jfif = {
|
|
356
|
+
version: { major: t[5], minor: t[6] },
|
|
357
|
+
densityUnits: t[7],
|
|
358
|
+
xDensity: t[8] << 8 | t[9],
|
|
359
|
+
yDensity: t[10] << 8 | t[11],
|
|
360
|
+
thumbWidth: t[12],
|
|
361
|
+
thumbHeight: t[13],
|
|
362
|
+
thumbData: t.subarray(14, 14 + 3 * t[12] * t[13])
|
|
363
|
+
}), C === 65518 && t[0] === 65 && t[1] === 100 && t[2] === 111 && t[3] === 98 && t[4] === 101 && t[5] === 0 && (this.adobe = {
|
|
364
|
+
version: t[6],
|
|
365
|
+
flags0: t[7] << 8 | t[8],
|
|
366
|
+
flags1: t[9] << 8 | t[10],
|
|
367
|
+
transformCode: t[11]
|
|
368
|
+
});
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
case 65499: {
|
|
372
|
+
const h = u() + o - 2;
|
|
373
|
+
for (; o < h; ) {
|
|
374
|
+
const F = l[o++], c = new Int32Array(64);
|
|
375
|
+
if (F >> 4)
|
|
376
|
+
if (F >> 4 === 1)
|
|
377
|
+
for (let r = 0; r < 64; r++) {
|
|
378
|
+
const b = O[r];
|
|
379
|
+
c[b] = u();
|
|
380
|
+
}
|
|
381
|
+
else
|
|
382
|
+
throw new Error("DQT: invalid table spec");
|
|
383
|
+
else
|
|
384
|
+
for (let r = 0; r < 64; r++) {
|
|
385
|
+
const b = O[r];
|
|
386
|
+
c[b] = l[o++];
|
|
387
|
+
}
|
|
388
|
+
this.quantizationTables[F & 15] = c;
|
|
389
|
+
}
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
case 65472:
|
|
393
|
+
case 65473:
|
|
394
|
+
case 65474: {
|
|
395
|
+
u();
|
|
396
|
+
const t = {
|
|
397
|
+
extended: C === 65473,
|
|
398
|
+
progressive: C === 65474,
|
|
399
|
+
precision: l[o++],
|
|
400
|
+
scanLines: u(),
|
|
401
|
+
samplesPerLine: u(),
|
|
402
|
+
components: {},
|
|
403
|
+
componentsOrder: []
|
|
404
|
+
}, h = l[o++];
|
|
405
|
+
let F;
|
|
406
|
+
for (let c = 0; c < h; c++) {
|
|
407
|
+
F = l[o];
|
|
408
|
+
const r = l[o + 1] >> 4, b = l[o + 1] & 15, i = l[o + 2];
|
|
409
|
+
t.componentsOrder.push(F), t.components[F] = {
|
|
410
|
+
h: r,
|
|
411
|
+
v: b,
|
|
412
|
+
quantizationIdx: i
|
|
413
|
+
}, o += 3;
|
|
414
|
+
}
|
|
415
|
+
w(t), this.frames.push(t);
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
case 65476: {
|
|
419
|
+
const t = u();
|
|
420
|
+
for (let h = 2; h < t; ) {
|
|
421
|
+
const F = l[o++], c = new Uint8Array(16);
|
|
422
|
+
let r = 0;
|
|
423
|
+
for (let i = 0; i < 16; i++, o++)
|
|
424
|
+
c[i] = l[o], r += c[i];
|
|
425
|
+
const b = new Uint8Array(r);
|
|
426
|
+
for (let i = 0; i < r; i++, o++)
|
|
427
|
+
b[i] = l[o];
|
|
428
|
+
h += 17 + r, F >> 4 ? this.huffmanTablesAC[F & 15] = ne(
|
|
429
|
+
c,
|
|
430
|
+
b
|
|
431
|
+
) : this.huffmanTablesDC[F & 15] = ne(
|
|
432
|
+
c,
|
|
433
|
+
b
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
case 65501:
|
|
439
|
+
u(), this.resetInterval = u();
|
|
440
|
+
break;
|
|
441
|
+
case 65498: {
|
|
442
|
+
u();
|
|
443
|
+
const t = l[o++], h = [], F = this.frames[0];
|
|
444
|
+
for (let d = 0; d < t; d++) {
|
|
445
|
+
const m = F.components[l[o++]], x = l[o++];
|
|
446
|
+
m.huffmanTableDC = this.huffmanTablesDC[x >> 4], m.huffmanTableAC = this.huffmanTablesAC[x & 15], h.push(m);
|
|
447
|
+
}
|
|
448
|
+
const c = l[o++], r = l[o++], b = l[o++], i = ce(
|
|
449
|
+
l,
|
|
450
|
+
o,
|
|
451
|
+
F,
|
|
452
|
+
h,
|
|
453
|
+
this.resetInterval,
|
|
454
|
+
c,
|
|
455
|
+
r,
|
|
456
|
+
b >> 4,
|
|
457
|
+
b & 15
|
|
458
|
+
);
|
|
459
|
+
o += i;
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
case 65535:
|
|
463
|
+
l[o] !== 255 && o--;
|
|
464
|
+
break;
|
|
465
|
+
default:
|
|
466
|
+
if (l[o - 3] === 255 && l[o - 2] >= 192 && l[o - 2] <= 254) {
|
|
467
|
+
o -= 3;
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
throw new Error(`unknown JPEG marker ${C.toString(16)}`);
|
|
471
|
+
}
|
|
472
|
+
C = u();
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
getResult() {
|
|
476
|
+
const { frames: l } = this;
|
|
477
|
+
if (this.frames.length === 0)
|
|
478
|
+
throw new Error("no frames were decoded");
|
|
479
|
+
this.frames.length > 1 && console.warn("more than one frame is not supported");
|
|
480
|
+
for (let c = 0; c < this.frames.length; c++) {
|
|
481
|
+
const r = this.frames[c].components;
|
|
482
|
+
for (const b of Object.keys(r))
|
|
483
|
+
r[b].quantizationTable = this.quantizationTables[r[b].quantizationIdx], delete r[b].quantizationIdx;
|
|
484
|
+
}
|
|
485
|
+
const o = l[0], { components: u, componentsOrder: T } = o, w = [], C = o.samplesPerLine, t = o.scanLines;
|
|
486
|
+
for (let c = 0; c < T.length; c++) {
|
|
487
|
+
const r = u[T[c]];
|
|
488
|
+
w.push({
|
|
489
|
+
lines: ie(o, r),
|
|
490
|
+
scaleX: r.h / o.maxH,
|
|
491
|
+
scaleY: r.v / o.maxV
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
const h = new Uint8Array(C * t * w.length);
|
|
495
|
+
let F = 0;
|
|
496
|
+
for (let c = 0; c < t; ++c)
|
|
497
|
+
for (let r = 0; r < C; ++r)
|
|
498
|
+
for (let b = 0; b < w.length; ++b) {
|
|
499
|
+
const i = w[b];
|
|
500
|
+
h[F] = i.lines[0 | c * i.scaleY][0 | r * i.scaleX], ++F;
|
|
501
|
+
}
|
|
502
|
+
return h;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
class fe extends re {
|
|
506
|
+
constructor(l) {
|
|
507
|
+
super(), this.reader = new le(), l.JPEGTables && this.reader.parse(l.JPEGTables);
|
|
508
|
+
}
|
|
509
|
+
decodeBlock(l) {
|
|
510
|
+
return this.reader.resetFrames(), this.reader.parse(new Uint8Array(l)), this.reader.getResult().buffer;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
export {
|
|
514
|
+
fe as default
|
|
515
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("./basedecoder-0503cc54.js"),J=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),Y=4017,Z=799,$=3406,N=2276,Q=1567,W=3784,R=5793,K=2896;function ne(q,l){let o=0;const u=[];let D=16;for(;D>0&&!q[D-1];)--D;u.push({children:[],index:0});let w=u[0],C;for(let t=0;t<D;t++){for(let h=0;h<q[t];h++){for(w=u.pop(),w.children[w.index]=l[o];w.index>0;)w=u.pop();for(w.index++,u.push(w);u.length<=t;)u.push(C={children:[],index:0}),w.children[w.index]=C.children,w=C;o++}t+1<D&&(u.push(C={children:[],index:0}),w.children[w.index]=C.children,w=C)}return u[0].children}function ce(q,l,o,u,D,w,C,t,h){const{mcusPerLine:F,progressive:c}=o,r=l;let b=l,i=0,d=0;function m(){if(d>0)return d--,i>>d&1;if(i=q[b++],i===255){const a=q[b++];if(a)throw new Error(`unexpected marker: ${(i<<8|a).toString(16)}`)}return d=7,i>>>7}function x(a){let f=a,p;for(;(p=m())!==null;){if(f=f[p],typeof f=="number")return f;if(typeof f!="object")throw new Error("invalid huffman sequence")}return null}function E(a){let f=a,p=0;for(;f>0;){const y=m();if(y===null)return;p=p<<1|y,--f}return p}function k(a){const f=E(a);return f>=1<<a-1?f:f+(-1<<a)+1}function v(a,f){const p=x(a.huffmanTableDC),y=p===0?0:k(p);a.pred+=y,f[0]=a.pred;let P=1;for(;P<64;){const T=x(a.huffmanTableAC),L=T&15,S=T>>4;if(L===0){if(S<15)break;P+=16}else{P+=S;const I=J[P];f[I]=k(L),P++}}}function A(a,f){const p=x(a.huffmanTableDC),y=p===0?0:k(p)<<h;a.pred+=y,f[0]=a.pred}function s(a,f){f[0]|=m()<<h}let n=0;function g(a,f){if(n>0){n--;return}let p=w;const y=C;for(;p<=y;){const P=x(a.huffmanTableAC),T=P&15,L=P>>4;if(T===0){if(L<15){n=E(L)+(1<<L)-1;break}p+=16}else{p+=L;const S=J[p];f[S]=k(T)*(1<<h),p++}}}let e=0,_;function te(a,f){let p=w;const y=C;let P=0;for(;p<=y;){const T=J[p],L=f[T]<0?-1:1;switch(e){case 0:{const S=x(a.huffmanTableAC),I=S&15;if(P=S>>4,I===0)P<15?(n=E(P)+(1<<P),e=4):(P=16,e=1);else{if(I!==1)throw new Error("invalid ACn encoding");_=k(I),e=P?2:3}continue}case 1:case 2:f[T]?f[T]+=(m()<<h)*L:(P--,P===0&&(e=e===2?3:0));break;case 3:f[T]?f[T]+=(m()<<h)*L:(f[T]=_<<h,e=0);break;case 4:f[T]&&(f[T]+=(m()<<h)*L);break}p++}e===4&&(n--,n===0&&(e=0))}function se(a,f,p,y,P){const T=p/F|0,L=p%F,S=T*a.v+y,I=L*a.h+P;f(a,a.blocks[S][I])}function oe(a,f,p){const y=p/a.blocksPerLine|0,P=p%a.blocksPerLine;f(a,a.blocks[y][P])}const V=u.length;let U,j,G,X,M,H;c?w===0?H=t===0?A:s:H=t===0?g:te:H=v;let B=0,z,O;V===1?O=u[0].blocksPerLine*u[0].blocksPerColumn:O=F*o.mcusPerColumn;const ee=D||O;for(;B<O;){for(j=0;j<V;j++)u[j].pred=0;if(n=0,V===1)for(U=u[0],M=0;M<ee;M++)oe(U,H,B),B++;else for(M=0;M<ee;M++){for(j=0;j<V;j++){U=u[j];const{h:a,v:f}=U;for(G=0;G<f;G++)for(X=0;X<a;X++)se(U,H,B,G,X)}if(B++,B===O)break}if(d=0,z=q[b]<<8|q[b+1],z<65280)throw new Error("marker was not found");if(z>=65488&&z<=65495)b+=2;else break}return b-r}function ie(q,l){const o=[],{blocksPerLine:u,blocksPerColumn:D}=l,w=u<<3,C=new Int32Array(64),t=new Uint8Array(64);function h(F,c,r){const b=l.quantizationTable;let i,d,m,x,E,k,v,A,s;const n=r;let g;for(g=0;g<64;g++)n[g]=F[g]*b[g];for(g=0;g<8;++g){const e=8*g;if(n[1+e]===0&&n[2+e]===0&&n[3+e]===0&&n[4+e]===0&&n[5+e]===0&&n[6+e]===0&&n[7+e]===0){s=R*n[0+e]+512>>10,n[0+e]=s,n[1+e]=s,n[2+e]=s,n[3+e]=s,n[4+e]=s,n[5+e]=s,n[6+e]=s,n[7+e]=s;continue}i=R*n[0+e]+128>>8,d=R*n[4+e]+128>>8,m=n[2+e],x=n[6+e],E=K*(n[1+e]-n[7+e])+128>>8,A=K*(n[1+e]+n[7+e])+128>>8,k=n[3+e]<<4,v=n[5+e]<<4,s=i-d+1>>1,i=i+d+1>>1,d=s,s=m*W+x*Q+128>>8,m=m*Q-x*W+128>>8,x=s,s=E-v+1>>1,E=E+v+1>>1,v=s,s=A+k+1>>1,k=A-k+1>>1,A=s,s=i-x+1>>1,i=i+x+1>>1,x=s,s=d-m+1>>1,d=d+m+1>>1,m=s,s=E*N+A*$+2048>>12,E=E*$-A*N+2048>>12,A=s,s=k*Z+v*Y+2048>>12,k=k*Y-v*Z+2048>>12,v=s,n[0+e]=i+A,n[7+e]=i-A,n[1+e]=d+v,n[6+e]=d-v,n[2+e]=m+k,n[5+e]=m-k,n[3+e]=x+E,n[4+e]=x-E}for(g=0;g<8;++g){const e=g;if(n[1*8+e]===0&&n[2*8+e]===0&&n[3*8+e]===0&&n[4*8+e]===0&&n[5*8+e]===0&&n[6*8+e]===0&&n[7*8+e]===0){s=R*r[g+0]+8192>>14,n[0*8+e]=s,n[1*8+e]=s,n[2*8+e]=s,n[3*8+e]=s,n[4*8+e]=s,n[5*8+e]=s,n[6*8+e]=s,n[7*8+e]=s;continue}i=R*n[0*8+e]+2048>>12,d=R*n[4*8+e]+2048>>12,m=n[2*8+e],x=n[6*8+e],E=K*(n[1*8+e]-n[7*8+e])+2048>>12,A=K*(n[1*8+e]+n[7*8+e])+2048>>12,k=n[3*8+e],v=n[5*8+e],s=i-d+1>>1,i=i+d+1>>1,d=s,s=m*W+x*Q+2048>>12,m=m*Q-x*W+2048>>12,x=s,s=E-v+1>>1,E=E+v+1>>1,v=s,s=A+k+1>>1,k=A-k+1>>1,A=s,s=i-x+1>>1,i=i+x+1>>1,x=s,s=d-m+1>>1,d=d+m+1>>1,m=s,s=E*N+A*$+2048>>12,E=E*$-A*N+2048>>12,A=s,s=k*Z+v*Y+2048>>12,k=k*Y-v*Z+2048>>12,v=s,n[0*8+e]=i+A,n[7*8+e]=i-A,n[1*8+e]=d+v,n[6*8+e]=d-v,n[2*8+e]=m+k,n[5*8+e]=m-k,n[3*8+e]=x+E,n[4*8+e]=x-E}for(g=0;g<64;++g){const e=128+(n[g]+8>>4);e<0?c[g]=0:e>255?c[g]=255:c[g]=e}}for(let F=0;F<D;F++){const c=F<<3;for(let r=0;r<8;r++)o.push(new Uint8Array(w));for(let r=0;r<u;r++){h(l.blocks[F][r],t,C);let b=0;const i=r<<3;for(let d=0;d<8;d++){const m=o[c+d];for(let x=0;x<8;x++)m[i+x]=t[b++]}}}return o}class le{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(l){let o=0;function u(){const t=l[o]<<8|l[o+1];return o+=2,t}function D(){const t=u(),h=l.subarray(o,o+t-2);return o+=h.length,h}function w(t){let h=0,F=0,c,r;for(r in t.components)t.components.hasOwnProperty(r)&&(c=t.components[r],h<c.h&&(h=c.h),F<c.v&&(F=c.v));const b=Math.ceil(t.samplesPerLine/8/h),i=Math.ceil(t.scanLines/8/F);for(r in t.components)if(t.components.hasOwnProperty(r)){c=t.components[r];const d=Math.ceil(Math.ceil(t.samplesPerLine/8)*c.h/h),m=Math.ceil(Math.ceil(t.scanLines/8)*c.v/F),x=b*c.h,E=i*c.v,k=[];for(let v=0;v<E;v++){const A=[];for(let s=0;s<x;s++)A.push(new Int32Array(64));k.push(A)}c.blocksPerLine=d,c.blocksPerColumn=m,c.blocks=k}t.maxH=h,t.maxV=F,t.mcusPerLine=b,t.mcusPerColumn=i}let C=u();if(C!==65496)throw new Error("SOI not found");for(C=u();C!==65497;){switch(C){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const t=D();C===65504&&t[0]===74&&t[1]===70&&t[2]===73&&t[3]===70&&t[4]===0&&(this.jfif={version:{major:t[5],minor:t[6]},densityUnits:t[7],xDensity:t[8]<<8|t[9],yDensity:t[10]<<8|t[11],thumbWidth:t[12],thumbHeight:t[13],thumbData:t.subarray(14,14+3*t[12]*t[13])}),C===65518&&t[0]===65&&t[1]===100&&t[2]===111&&t[3]===98&&t[4]===101&&t[5]===0&&(this.adobe={version:t[6],flags0:t[7]<<8|t[8],flags1:t[9]<<8|t[10],transformCode:t[11]});break}case 65499:{const h=u()+o-2;for(;o<h;){const F=l[o++],c=new Int32Array(64);if(F>>4)if(F>>4===1)for(let r=0;r<64;r++){const b=J[r];c[b]=u()}else throw new Error("DQT: invalid table spec");else for(let r=0;r<64;r++){const b=J[r];c[b]=l[o++]}this.quantizationTables[F&15]=c}break}case 65472:case 65473:case 65474:{u();const t={extended:C===65473,progressive:C===65474,precision:l[o++],scanLines:u(),samplesPerLine:u(),components:{},componentsOrder:[]},h=l[o++];let F;for(let c=0;c<h;c++){F=l[o];const r=l[o+1]>>4,b=l[o+1]&15,i=l[o+2];t.componentsOrder.push(F),t.components[F]={h:r,v:b,quantizationIdx:i},o+=3}w(t),this.frames.push(t);break}case 65476:{const t=u();for(let h=2;h<t;){const F=l[o++],c=new Uint8Array(16);let r=0;for(let i=0;i<16;i++,o++)c[i]=l[o],r+=c[i];const b=new Uint8Array(r);for(let i=0;i<r;i++,o++)b[i]=l[o];h+=17+r,F>>4?this.huffmanTablesAC[F&15]=ne(c,b):this.huffmanTablesDC[F&15]=ne(c,b)}break}case 65501:u(),this.resetInterval=u();break;case 65498:{u();const t=l[o++],h=[],F=this.frames[0];for(let d=0;d<t;d++){const m=F.components[l[o++]],x=l[o++];m.huffmanTableDC=this.huffmanTablesDC[x>>4],m.huffmanTableAC=this.huffmanTablesAC[x&15],h.push(m)}const c=l[o++],r=l[o++],b=l[o++],i=ce(l,o,F,h,this.resetInterval,c,r,b>>4,b&15);o+=i;break}case 65535:l[o]!==255&&o--;break;default:if(l[o-3]===255&&l[o-2]>=192&&l[o-2]<=254){o-=3;break}throw new Error(`unknown JPEG marker ${C.toString(16)}`)}C=u()}}getResult(){const{frames:l}=this;if(this.frames.length===0)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let c=0;c<this.frames.length;c++){const r=this.frames[c].components;for(const b of Object.keys(r))r[b].quantizationTable=this.quantizationTables[r[b].quantizationIdx],delete r[b].quantizationIdx}const o=l[0],{components:u,componentsOrder:D}=o,w=[],C=o.samplesPerLine,t=o.scanLines;for(let c=0;c<D.length;c++){const r=u[D[c]];w.push({lines:ie(o,r),scaleX:r.h/o.maxH,scaleY:r.v/o.maxV})}const h=new Uint8Array(C*t*w.length);let F=0;for(let c=0;c<t;++c)for(let r=0;r<C;++r)for(let b=0;b<w.length;++b){const i=w[b];h[F]=i.lines[0|c*i.scaleY][0|r*i.scaleX],++F}return h}}class ae extends re.BaseDecoder{constructor(l){super(),this.reader=new le,l.JPEGTables&&this.reader.parse(l.JPEGTables)}decodeBlock(l){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(l)),this.reader.getResult().buffer}}exports.default=ae;
|