@gisfun/maplibre-gl-components 0.15.0-alpha.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.
Files changed (196) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1960 -0
  3. package/dist/ControlGrid-DN5md8hp.cjs +19636 -0
  4. package/dist/ControlGrid-rVNG7B9O.js +170422 -0
  5. package/dist/DuckDBConverter-B98M0DFs.cjs +23 -0
  6. package/dist/DuckDBConverter-RPq48-t0.js +434 -0
  7. package/dist/ShapefileConverter-AjbEjEyq.cjs +1 -0
  8. package/dist/ShapefileConverter-trvt8J3z.js +125 -0
  9. package/dist/decoder-CLokFc0V.js +8 -0
  10. package/dist/decoder-D9LU4bUo.cjs +1 -0
  11. package/dist/deflate-BA1jZeSX.js +10 -0
  12. package/dist/deflate-DEdCz12a.cjs +1 -0
  13. package/dist/geojson-BQSVgKFt.cjs +1 -0
  14. package/dist/geojson-BSUuDj5k.js +2551 -0
  15. package/dist/geotiff-De1w1lBy.cjs +8 -0
  16. package/dist/geotiff-o_Fq1Na4.js +3108 -0
  17. package/dist/index-8ZZtuDTp.js +705 -0
  18. package/dist/index-B-Nr9y7J.cjs +84 -0
  19. package/dist/index-B5NoFrpY.js +8892 -0
  20. package/dist/index-Bi1MMPUx.js +4163 -0
  21. package/dist/index-C9fk_HKR.js +167 -0
  22. package/dist/index-CBBRBJvR.cjs +274 -0
  23. package/dist/index-CZxPF1qt.js +4 -0
  24. package/dist/index-CiDPSJ9T.cjs +1 -0
  25. package/dist/index-CjM_nbxd.cjs +107 -0
  26. package/dist/index-DQXdX5y1.js +4666 -0
  27. package/dist/index-Dh1kpCb6.cjs +1 -0
  28. package/dist/index-IrsIiQNM.cjs +4 -0
  29. package/dist/index.cjs +3819 -0
  30. package/dist/index.mjs +19580 -0
  31. package/dist/jpeg-CF9OGQg_.js +533 -0
  32. package/dist/jpeg-JSQOxGHy.cjs +1 -0
  33. package/dist/lerc-7LlQoT6u.js +1032 -0
  34. package/dist/lerc-BIsodce9.cjs +1 -0
  35. package/dist/lzw-BZniWIYG.js +84 -0
  36. package/dist/lzw-BhML-BvT.cjs +1 -0
  37. package/dist/main-dist-Bymiy5aM.cjs +2 -0
  38. package/dist/main-dist-Cv8AKwrY.js +629 -0
  39. package/dist/maplibre-geoman.es-Bxdg-2EU.cjs +129 -0
  40. package/dist/maplibre-geoman.es-CFgM2ajb.js +22827 -0
  41. package/dist/maplibre-gl-components.css +1 -0
  42. package/dist/packbits-B9b7gX2c.cjs +1 -0
  43. package/dist/packbits-DWY5O-FG.js +24 -0
  44. package/dist/pako.esm-Bx5X36Wo.js +1074 -0
  45. package/dist/pako.esm-DZC2QrbJ.cjs +1 -0
  46. package/dist/raw-C3ARbSFo.cjs +1 -0
  47. package/dist/raw-DUslI1gr.js +9 -0
  48. package/dist/react.cjs +1 -0
  49. package/dist/react.mjs +1306 -0
  50. package/dist/types/index.d.ts +44 -0
  51. package/dist/types/index.d.ts.map +1 -0
  52. package/dist/types/lib/adapters/AddVectorAdapter.d.ts +66 -0
  53. package/dist/types/lib/adapters/AddVectorAdapter.d.ts.map +1 -0
  54. package/dist/types/lib/adapters/CogLayerAdapter.d.ts +126 -0
  55. package/dist/types/lib/adapters/CogLayerAdapter.d.ts.map +1 -0
  56. package/dist/types/lib/adapters/PMTilesLayerAdapter.d.ts +78 -0
  57. package/dist/types/lib/adapters/PMTilesLayerAdapter.d.ts.map +1 -0
  58. package/dist/types/lib/adapters/StacLayerAdapter.d.ts +71 -0
  59. package/dist/types/lib/adapters/StacLayerAdapter.d.ts.map +1 -0
  60. package/dist/types/lib/adapters/ZarrLayerAdapter.d.ts +72 -0
  61. package/dist/types/lib/adapters/ZarrLayerAdapter.d.ts.map +1 -0
  62. package/dist/types/lib/adapters/index.d.ts +7 -0
  63. package/dist/types/lib/adapters/index.d.ts.map +1 -0
  64. package/dist/types/lib/addControlGrid.d.ts +80 -0
  65. package/dist/types/lib/addControlGrid.d.ts.map +1 -0
  66. package/dist/types/lib/colormaps/diverging.d.ts +30 -0
  67. package/dist/types/lib/colormaps/diverging.d.ts.map +1 -0
  68. package/dist/types/lib/colormaps/index.d.ts +32 -0
  69. package/dist/types/lib/colormaps/index.d.ts.map +1 -0
  70. package/dist/types/lib/colormaps/misc.d.ts +38 -0
  71. package/dist/types/lib/colormaps/misc.d.ts.map +1 -0
  72. package/dist/types/lib/colormaps/sequential.d.ts +22 -0
  73. package/dist/types/lib/colormaps/sequential.d.ts.map +1 -0
  74. package/dist/types/lib/converters/DuckDBConverter.d.ts +112 -0
  75. package/dist/types/lib/converters/DuckDBConverter.d.ts.map +1 -0
  76. package/dist/types/lib/converters/ShapefileConverter.d.ts +56 -0
  77. package/dist/types/lib/converters/ShapefileConverter.d.ts.map +1 -0
  78. package/dist/types/lib/converters/index.d.ts +8 -0
  79. package/dist/types/lib/converters/index.d.ts.map +1 -0
  80. package/dist/types/lib/converters/types.d.ts +75 -0
  81. package/dist/types/lib/converters/types.d.ts.map +1 -0
  82. package/dist/types/lib/core/AddVector.d.ts +116 -0
  83. package/dist/types/lib/core/AddVector.d.ts.map +1 -0
  84. package/dist/types/lib/core/Basemap.d.ts +206 -0
  85. package/dist/types/lib/core/Basemap.d.ts.map +1 -0
  86. package/dist/types/lib/core/BasemapReact.d.ts +32 -0
  87. package/dist/types/lib/core/BasemapReact.d.ts.map +1 -0
  88. package/dist/types/lib/core/BookmarkControl.d.ts +180 -0
  89. package/dist/types/lib/core/BookmarkControl.d.ts.map +1 -0
  90. package/dist/types/lib/core/ChoroplethControl.d.ts +105 -0
  91. package/dist/types/lib/core/ChoroplethControl.d.ts.map +1 -0
  92. package/dist/types/lib/core/CogLayer.d.ts +139 -0
  93. package/dist/types/lib/core/CogLayer.d.ts.map +1 -0
  94. package/dist/types/lib/core/CogLayerReact.d.ts +32 -0
  95. package/dist/types/lib/core/CogLayerReact.d.ts.map +1 -0
  96. package/dist/types/lib/core/Colorbar.d.ts +133 -0
  97. package/dist/types/lib/core/Colorbar.d.ts.map +1 -0
  98. package/dist/types/lib/core/ColorbarGuiControl.d.ts +79 -0
  99. package/dist/types/lib/core/ColorbarGuiControl.d.ts.map +1 -0
  100. package/dist/types/lib/core/ColorbarReact.d.ts +34 -0
  101. package/dist/types/lib/core/ColorbarReact.d.ts.map +1 -0
  102. package/dist/types/lib/core/ControlGrid.d.ts +125 -0
  103. package/dist/types/lib/core/ControlGrid.d.ts.map +1 -0
  104. package/dist/types/lib/core/ControlGridReact.d.ts +32 -0
  105. package/dist/types/lib/core/ControlGridReact.d.ts.map +1 -0
  106. package/dist/types/lib/core/HtmlControl.d.ts +140 -0
  107. package/dist/types/lib/core/HtmlControl.d.ts.map +1 -0
  108. package/dist/types/lib/core/HtmlControlReact.d.ts +32 -0
  109. package/dist/types/lib/core/HtmlControlReact.d.ts.map +1 -0
  110. package/dist/types/lib/core/HtmlGuiControl.d.ts +68 -0
  111. package/dist/types/lib/core/HtmlGuiControl.d.ts.map +1 -0
  112. package/dist/types/lib/core/InspectControl.d.ts +202 -0
  113. package/dist/types/lib/core/InspectControl.d.ts.map +1 -0
  114. package/dist/types/lib/core/InspectControlReact.d.ts +32 -0
  115. package/dist/types/lib/core/InspectControlReact.d.ts.map +1 -0
  116. package/dist/types/lib/core/Legend.d.ts +142 -0
  117. package/dist/types/lib/core/Legend.d.ts.map +1 -0
  118. package/dist/types/lib/core/LegendGuiControl.d.ts +69 -0
  119. package/dist/types/lib/core/LegendGuiControl.d.ts.map +1 -0
  120. package/dist/types/lib/core/LegendReact.d.ts +34 -0
  121. package/dist/types/lib/core/LegendReact.d.ts.map +1 -0
  122. package/dist/types/lib/core/MeasureControl.d.ts +211 -0
  123. package/dist/types/lib/core/MeasureControl.d.ts.map +1 -0
  124. package/dist/types/lib/core/MinimapControl.d.ts +77 -0
  125. package/dist/types/lib/core/MinimapControl.d.ts.map +1 -0
  126. package/dist/types/lib/core/MinimapControlReact.d.ts +32 -0
  127. package/dist/types/lib/core/MinimapControlReact.d.ts.map +1 -0
  128. package/dist/types/lib/core/PMTilesLayer.d.ts +119 -0
  129. package/dist/types/lib/core/PMTilesLayer.d.ts.map +1 -0
  130. package/dist/types/lib/core/PrintControl.d.ts +226 -0
  131. package/dist/types/lib/core/PrintControl.d.ts.map +1 -0
  132. package/dist/types/lib/core/SearchControl.d.ts +172 -0
  133. package/dist/types/lib/core/SearchControl.d.ts.map +1 -0
  134. package/dist/types/lib/core/SearchControlReact.d.ts +32 -0
  135. package/dist/types/lib/core/SearchControlReact.d.ts.map +1 -0
  136. package/dist/types/lib/core/StacLayer.d.ts +107 -0
  137. package/dist/types/lib/core/StacLayer.d.ts.map +1 -0
  138. package/dist/types/lib/core/StacSearch.d.ts +109 -0
  139. package/dist/types/lib/core/StacSearch.d.ts.map +1 -0
  140. package/dist/types/lib/core/Terrain.d.ts +165 -0
  141. package/dist/types/lib/core/Terrain.d.ts.map +1 -0
  142. package/dist/types/lib/core/TerrainReact.d.ts +32 -0
  143. package/dist/types/lib/core/TerrainReact.d.ts.map +1 -0
  144. package/dist/types/lib/core/VectorDataset.d.ts +228 -0
  145. package/dist/types/lib/core/VectorDataset.d.ts.map +1 -0
  146. package/dist/types/lib/core/VectorDatasetReact.d.ts +31 -0
  147. package/dist/types/lib/core/VectorDatasetReact.d.ts.map +1 -0
  148. package/dist/types/lib/core/ViewStateControl.d.ts +205 -0
  149. package/dist/types/lib/core/ViewStateControl.d.ts.map +1 -0
  150. package/dist/types/lib/core/ViewStateControlReact.d.ts +32 -0
  151. package/dist/types/lib/core/ViewStateControlReact.d.ts.map +1 -0
  152. package/dist/types/lib/core/ZarrLayer.d.ts +110 -0
  153. package/dist/types/lib/core/ZarrLayer.d.ts.map +1 -0
  154. package/dist/types/lib/core/types.d.ts +2793 -0
  155. package/dist/types/lib/core/types.d.ts.map +1 -0
  156. package/dist/types/lib/hooks/index.d.ts +13 -0
  157. package/dist/types/lib/hooks/index.d.ts.map +1 -0
  158. package/dist/types/lib/hooks/useBasemap.d.ts +43 -0
  159. package/dist/types/lib/hooks/useBasemap.d.ts.map +1 -0
  160. package/dist/types/lib/hooks/useCogLayer.d.ts +44 -0
  161. package/dist/types/lib/hooks/useCogLayer.d.ts.map +1 -0
  162. package/dist/types/lib/hooks/useColorbar.d.ts +36 -0
  163. package/dist/types/lib/hooks/useColorbar.d.ts.map +1 -0
  164. package/dist/types/lib/hooks/useControlGrid.d.ts +41 -0
  165. package/dist/types/lib/hooks/useControlGrid.d.ts.map +1 -0
  166. package/dist/types/lib/hooks/useHtmlControl.d.ts +39 -0
  167. package/dist/types/lib/hooks/useHtmlControl.d.ts.map +1 -0
  168. package/dist/types/lib/hooks/useInspectControl.d.ts +49 -0
  169. package/dist/types/lib/hooks/useInspectControl.d.ts.map +1 -0
  170. package/dist/types/lib/hooks/useLegend.d.ts +41 -0
  171. package/dist/types/lib/hooks/useLegend.d.ts.map +1 -0
  172. package/dist/types/lib/hooks/useMinimapControl.d.ts +35 -0
  173. package/dist/types/lib/hooks/useMinimapControl.d.ts.map +1 -0
  174. package/dist/types/lib/hooks/useSearchControl.d.ts +43 -0
  175. package/dist/types/lib/hooks/useSearchControl.d.ts.map +1 -0
  176. package/dist/types/lib/hooks/useTerrain.d.ts +43 -0
  177. package/dist/types/lib/hooks/useTerrain.d.ts.map +1 -0
  178. package/dist/types/lib/hooks/useVectorDataset.d.ts +35 -0
  179. package/dist/types/lib/hooks/useVectorDataset.d.ts.map +1 -0
  180. package/dist/types/lib/hooks/useViewState.d.ts +43 -0
  181. package/dist/types/lib/hooks/useViewState.d.ts.map +1 -0
  182. package/dist/types/lib/utils/color.d.ts +47 -0
  183. package/dist/types/lib/utils/color.d.ts.map +1 -0
  184. package/dist/types/lib/utils/fileHelpers.d.ts +207 -0
  185. package/dist/types/lib/utils/fileHelpers.d.ts.map +1 -0
  186. package/dist/types/lib/utils/helpers.d.ts +48 -0
  187. package/dist/types/lib/utils/helpers.d.ts.map +1 -0
  188. package/dist/types/lib/utils/index.d.ts +4 -0
  189. package/dist/types/lib/utils/index.d.ts.map +1 -0
  190. package/dist/types/lib/utils/providers.d.ts +46 -0
  191. package/dist/types/lib/utils/providers.d.ts.map +1 -0
  192. package/dist/types/react.d.ts +15 -0
  193. package/dist/types/react.d.ts.map +1 -0
  194. package/dist/webimage-CBRffWZD.cjs +1 -0
  195. package/dist/webimage-ibSPOLHJ.js +19 -0
  196. package/package.json +137 -0
@@ -0,0 +1,533 @@
1
+ import { B as re } from "./geotiff-o_Fq1Na4.js";
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
+ // skipping r zero items
193
+ case 2:
194
+ f[P] ? f[P] += (m() << h) * y : (D--, D === 0 && (e = e === 2 ? 3 : 0));
195
+ break;
196
+ case 3:
197
+ f[P] ? f[P] += (m() << h) * y : (f[P] = _ << h, e = 0);
198
+ break;
199
+ case 4:
200
+ f[P] && (f[P] += (m() << h) * y);
201
+ break;
202
+ }
203
+ p++;
204
+ }
205
+ e === 4 && (n--, n === 0 && (e = 0));
206
+ }
207
+ function se(a, f, p, L, D) {
208
+ const P = p / F | 0, y = p % F, S = P * a.v + L, I = y * a.h + D;
209
+ f(a, a.blocks[S][I]);
210
+ }
211
+ function oe(a, f, p) {
212
+ const L = p / a.blocksPerLine | 0, D = p % a.blocksPerLine;
213
+ f(a, a.blocks[L][D]);
214
+ }
215
+ const V = u.length;
216
+ let U, j, G, X, B, H;
217
+ c ? w === 0 ? H = t === 0 ? v : s : H = t === 0 ? g : te : H = A;
218
+ let M = 0, z, J;
219
+ V === 1 ? J = u[0].blocksPerLine * u[0].blocksPerColumn : J = F * o.mcusPerColumn;
220
+ const ee = T || J;
221
+ for (; M < J; ) {
222
+ for (j = 0; j < V; j++)
223
+ u[j].pred = 0;
224
+ if (n = 0, V === 1)
225
+ for (U = u[0], B = 0; B < ee; B++)
226
+ oe(U, H, M), M++;
227
+ else
228
+ for (B = 0; B < ee; B++) {
229
+ for (j = 0; j < V; j++) {
230
+ U = u[j];
231
+ const { h: a, v: f } = U;
232
+ for (G = 0; G < f; G++)
233
+ for (X = 0; X < a; X++)
234
+ se(U, H, M, G, X);
235
+ }
236
+ if (M++, M === J)
237
+ break;
238
+ }
239
+ if (d = 0, z = q[b] << 8 | q[b + 1], z < 65280)
240
+ throw new Error("marker was not found");
241
+ if (z >= 65488 && z <= 65495)
242
+ b += 2;
243
+ else
244
+ break;
245
+ }
246
+ return b - r;
247
+ }
248
+ function ie(q, l) {
249
+ const o = [], { blocksPerLine: u, blocksPerColumn: T } = l, w = u << 3, C = new Int32Array(64), t = new Uint8Array(64);
250
+ function h(F, c, r) {
251
+ const b = l.quantizationTable;
252
+ let i, d, m, x, E, k, A, v, s;
253
+ const n = r;
254
+ let g;
255
+ for (g = 0; g < 64; g++)
256
+ n[g] = F[g] * b[g];
257
+ for (g = 0; g < 8; ++g) {
258
+ const e = 8 * g;
259
+ 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) {
260
+ 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;
261
+ continue;
262
+ }
263
+ 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;
264
+ }
265
+ for (g = 0; g < 8; ++g) {
266
+ const e = g;
267
+ if (n[8 + e] === 0 && n[16 + e] === 0 && n[24 + e] === 0 && n[32 + e] === 0 && n[40 + e] === 0 && n[48 + e] === 0 && n[56 + e] === 0) {
268
+ s = R * r[g + 0] + 8192 >> 14, n[0 + e] = s, n[8 + e] = s, n[16 + e] = s, n[24 + e] = s, n[32 + e] = s, n[40 + e] = s, n[48 + e] = s, n[56 + e] = s;
269
+ continue;
270
+ }
271
+ i = R * n[0 + e] + 2048 >> 12, d = R * n[32 + e] + 2048 >> 12, m = n[16 + e], x = n[48 + e], E = K * (n[8 + e] - n[56 + e]) + 2048 >> 12, v = K * (n[8 + e] + n[56 + e]) + 2048 >> 12, k = n[24 + e], A = n[40 + 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 + e] = i + v, n[56 + e] = i - v, n[8 + e] = d + A, n[48 + e] = d - A, n[16 + e] = m + k, n[40 + e] = m - k, n[24 + e] = x + E, n[32 + e] = x - E;
272
+ }
273
+ for (g = 0; g < 64; ++g) {
274
+ const e = 128 + (n[g] + 8 >> 4);
275
+ e < 0 ? c[g] = 0 : e > 255 ? c[g] = 255 : c[g] = e;
276
+ }
277
+ }
278
+ for (let F = 0; F < T; F++) {
279
+ const c = F << 3;
280
+ for (let r = 0; r < 8; r++)
281
+ o.push(new Uint8Array(w));
282
+ for (let r = 0; r < u; r++) {
283
+ h(l.blocks[F][r], t, C);
284
+ let b = 0;
285
+ const i = r << 3;
286
+ for (let d = 0; d < 8; d++) {
287
+ const m = o[c + d];
288
+ for (let x = 0; x < 8; x++)
289
+ m[i + x] = t[b++];
290
+ }
291
+ }
292
+ }
293
+ return o;
294
+ }
295
+ class le {
296
+ constructor() {
297
+ this.jfif = null, this.adobe = null, this.quantizationTables = [], this.huffmanTablesAC = [], this.huffmanTablesDC = [], this.resetFrames();
298
+ }
299
+ resetFrames() {
300
+ this.frames = [];
301
+ }
302
+ parse(l) {
303
+ let o = 0;
304
+ function u() {
305
+ const t = l[o] << 8 | l[o + 1];
306
+ return o += 2, t;
307
+ }
308
+ function T() {
309
+ const t = u(), h = l.subarray(o, o + t - 2);
310
+ return o += h.length, h;
311
+ }
312
+ function w(t) {
313
+ let h = 0, F = 0, c, r;
314
+ for (r in t.components)
315
+ t.components.hasOwnProperty(r) && (c = t.components[r], h < c.h && (h = c.h), F < c.v && (F = c.v));
316
+ const b = Math.ceil(t.samplesPerLine / 8 / h), i = Math.ceil(t.scanLines / 8 / F);
317
+ for (r in t.components)
318
+ if (t.components.hasOwnProperty(r)) {
319
+ c = t.components[r];
320
+ 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 = [];
321
+ for (let A = 0; A < E; A++) {
322
+ const v = [];
323
+ for (let s = 0; s < x; s++)
324
+ v.push(new Int32Array(64));
325
+ k.push(v);
326
+ }
327
+ c.blocksPerLine = d, c.blocksPerColumn = m, c.blocks = k;
328
+ }
329
+ t.maxH = h, t.maxV = F, t.mcusPerLine = b, t.mcusPerColumn = i;
330
+ }
331
+ let C = u();
332
+ if (C !== 65496)
333
+ throw new Error("SOI not found");
334
+ for (C = u(); C !== 65497; ) {
335
+ switch (C) {
336
+ case 65280:
337
+ break;
338
+ case 65504:
339
+ // APP0 (Application Specific)
340
+ case 65505:
341
+ // APP1
342
+ case 65506:
343
+ // APP2
344
+ case 65507:
345
+ // APP3
346
+ case 65508:
347
+ // APP4
348
+ case 65509:
349
+ // APP5
350
+ case 65510:
351
+ // APP6
352
+ case 65511:
353
+ // APP7
354
+ case 65512:
355
+ // APP8
356
+ case 65513:
357
+ // APP9
358
+ case 65514:
359
+ // APP10
360
+ case 65515:
361
+ // APP11
362
+ case 65516:
363
+ // APP12
364
+ case 65517:
365
+ // APP13
366
+ case 65518:
367
+ // APP14
368
+ case 65519:
369
+ // APP15
370
+ case 65534: {
371
+ const t = T();
372
+ C === 65504 && t[0] === 74 && t[1] === 70 && t[2] === 73 && t[3] === 70 && t[4] === 0 && (this.jfif = {
373
+ version: { major: t[5], minor: t[6] },
374
+ densityUnits: t[7],
375
+ xDensity: t[8] << 8 | t[9],
376
+ yDensity: t[10] << 8 | t[11],
377
+ thumbWidth: t[12],
378
+ thumbHeight: t[13],
379
+ thumbData: t.subarray(14, 14 + 3 * t[12] * t[13])
380
+ }), C === 65518 && t[0] === 65 && t[1] === 100 && t[2] === 111 && t[3] === 98 && t[4] === 101 && t[5] === 0 && (this.adobe = {
381
+ version: t[6],
382
+ flags0: t[7] << 8 | t[8],
383
+ flags1: t[9] << 8 | t[10],
384
+ transformCode: t[11]
385
+ });
386
+ break;
387
+ }
388
+ case 65499: {
389
+ const h = u() + o - 2;
390
+ for (; o < h; ) {
391
+ const F = l[o++], c = new Int32Array(64);
392
+ if (F >> 4 === 0)
393
+ for (let r = 0; r < 64; r++) {
394
+ const b = O[r];
395
+ c[b] = l[o++];
396
+ }
397
+ else if (F >> 4 === 1)
398
+ for (let r = 0; r < 64; r++) {
399
+ const b = O[r];
400
+ c[b] = u();
401
+ }
402
+ else
403
+ throw new Error("DQT: invalid table spec");
404
+ this.quantizationTables[F & 15] = c;
405
+ }
406
+ break;
407
+ }
408
+ case 65472:
409
+ // SOF0 (Start of Frame, Baseline DCT)
410
+ case 65473:
411
+ // SOF1 (Start of Frame, Extended DCT)
412
+ case 65474: {
413
+ u();
414
+ const t = {
415
+ extended: C === 65473,
416
+ progressive: C === 65474,
417
+ precision: l[o++],
418
+ scanLines: u(),
419
+ samplesPerLine: u(),
420
+ components: {},
421
+ componentsOrder: []
422
+ }, h = l[o++];
423
+ let F;
424
+ for (let c = 0; c < h; c++) {
425
+ F = l[o];
426
+ const r = l[o + 1] >> 4, b = l[o + 1] & 15, i = l[o + 2];
427
+ t.componentsOrder.push(F), t.components[F] = {
428
+ h: r,
429
+ v: b,
430
+ quantizationIdx: i
431
+ }, o += 3;
432
+ }
433
+ w(t), this.frames.push(t);
434
+ break;
435
+ }
436
+ case 65476: {
437
+ const t = u();
438
+ for (let h = 2; h < t; ) {
439
+ const F = l[o++], c = new Uint8Array(16);
440
+ let r = 0;
441
+ for (let i = 0; i < 16; i++, o++)
442
+ c[i] = l[o], r += c[i];
443
+ const b = new Uint8Array(r);
444
+ for (let i = 0; i < r; i++, o++)
445
+ b[i] = l[o];
446
+ h += 17 + r, F >> 4 === 0 ? this.huffmanTablesDC[F & 15] = ne(
447
+ c,
448
+ b
449
+ ) : this.huffmanTablesAC[F & 15] = ne(
450
+ c,
451
+ b
452
+ );
453
+ }
454
+ break;
455
+ }
456
+ case 65501:
457
+ u(), this.resetInterval = u();
458
+ break;
459
+ case 65498: {
460
+ u();
461
+ const t = l[o++], h = [], F = this.frames[0];
462
+ for (let d = 0; d < t; d++) {
463
+ const m = F.components[l[o++]], x = l[o++];
464
+ m.huffmanTableDC = this.huffmanTablesDC[x >> 4], m.huffmanTableAC = this.huffmanTablesAC[x & 15], h.push(m);
465
+ }
466
+ const c = l[o++], r = l[o++], b = l[o++], i = ce(
467
+ l,
468
+ o,
469
+ F,
470
+ h,
471
+ this.resetInterval,
472
+ c,
473
+ r,
474
+ b >> 4,
475
+ b & 15
476
+ );
477
+ o += i;
478
+ break;
479
+ }
480
+ case 65535:
481
+ l[o] !== 255 && o--;
482
+ break;
483
+ default:
484
+ if (l[o - 3] === 255 && l[o - 2] >= 192 && l[o - 2] <= 254) {
485
+ o -= 3;
486
+ break;
487
+ }
488
+ throw new Error(`unknown JPEG marker ${C.toString(16)}`);
489
+ }
490
+ C = u();
491
+ }
492
+ }
493
+ getResult() {
494
+ const { frames: l } = this;
495
+ if (this.frames.length === 0)
496
+ throw new Error("no frames were decoded");
497
+ this.frames.length > 1 && console.warn("more than one frame is not supported");
498
+ for (let c = 0; c < this.frames.length; c++) {
499
+ const r = this.frames[c].components;
500
+ for (const b of Object.keys(r))
501
+ r[b].quantizationTable = this.quantizationTables[r[b].quantizationIdx], delete r[b].quantizationIdx;
502
+ }
503
+ const o = l[0], { components: u, componentsOrder: T } = o, w = [], C = o.samplesPerLine, t = o.scanLines;
504
+ for (let c = 0; c < T.length; c++) {
505
+ const r = u[T[c]];
506
+ w.push({
507
+ lines: ie(o, r),
508
+ scaleX: r.h / o.maxH,
509
+ scaleY: r.v / o.maxV
510
+ });
511
+ }
512
+ const h = new Uint8Array(C * t * w.length);
513
+ let F = 0;
514
+ for (let c = 0; c < t; ++c)
515
+ for (let r = 0; r < C; ++r)
516
+ for (let b = 0; b < w.length; ++b) {
517
+ const i = w[b];
518
+ h[F] = i.lines[0 | c * i.scaleY][0 | r * i.scaleX], ++F;
519
+ }
520
+ return h;
521
+ }
522
+ }
523
+ class fe extends re {
524
+ constructor(l) {
525
+ super(), this.reader = new le(), l.JPEGTables && this.reader.parse(l.JPEGTables);
526
+ }
527
+ decodeBlock(l) {
528
+ return this.reader.resetFrames(), this.reader.parse(new Uint8Array(l)), this.reader.getResult().buffer;
529
+ }
530
+ }
531
+ export {
532
+ fe as default
533
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("./geotiff-De1w1lBy.cjs"),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 f=q[b++];if(f)throw new Error(`unexpected marker: ${(i<<8|f).toString(16)}`)}return d=7,i>>>7}function x(f){let a=f,p;for(;(p=m())!==null;){if(a=a[p],typeof a=="number")return a;if(typeof a!="object")throw new Error("invalid huffman sequence")}return null}function E(f){let a=f,p=0;for(;a>0;){const y=m();if(y===null)return;p=p<<1|y,--a}return p}function k(f){const a=E(f);return a>=1<<f-1?a:a+(-1<<f)+1}function v(f,a){const p=x(f.huffmanTableDC),y=p===0?0:k(p);f.pred+=y,a[0]=f.pred;let P=1;for(;P<64;){const T=x(f.huffmanTableAC),L=T&15,S=T>>4;if(L===0){if(S<15)break;P+=16}else{P+=S;const I=J[P];a[I]=k(L),P++}}}function A(f,a){const p=x(f.huffmanTableDC),y=p===0?0:k(p)<<h;f.pred+=y,a[0]=f.pred}function s(f,a){a[0]|=m()<<h}let n=0;function g(f,a){if(n>0){n--;return}let p=w;const y=C;for(;p<=y;){const P=x(f.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];a[S]=k(T)*(1<<h),p++}}}let e=0,_;function te(f,a){let p=w;const y=C;let P=0;for(;p<=y;){const T=J[p],L=a[T]<0?-1:1;switch(e){case 0:{const S=x(f.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:a[T]?a[T]+=(m()<<h)*L:(P--,P===0&&(e=e===2?3:0));break;case 3:a[T]?a[T]+=(m()<<h)*L:(a[T]=_<<h,e=0);break;case 4:a[T]&&(a[T]+=(m()<<h)*L);break}p++}e===4&&(n--,n===0&&(e=0))}function se(f,a,p,y,P){const T=p/F|0,L=p%F,S=T*f.v+y,I=L*f.h+P;a(f,f.blocks[S][I])}function oe(f,a,p){const y=p/f.blocksPerLine|0,P=p%f.blocksPerLine;a(f,f.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:f,v:a}=U;for(G=0;G<a;G++)for(X=0;X<f;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[8+e]===0&&n[16+e]===0&&n[24+e]===0&&n[32+e]===0&&n[40+e]===0&&n[48+e]===0&&n[56+e]===0){s=R*r[g+0]+8192>>14,n[0+e]=s,n[8+e]=s,n[16+e]=s,n[24+e]=s,n[32+e]=s,n[40+e]=s,n[48+e]=s,n[56+e]=s;continue}i=R*n[0+e]+2048>>12,d=R*n[32+e]+2048>>12,m=n[16+e],x=n[48+e],E=K*(n[8+e]-n[56+e])+2048>>12,A=K*(n[8+e]+n[56+e])+2048>>12,k=n[24+e],v=n[40+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+e]=i+A,n[56+e]=i-A,n[8+e]=d+v,n[48+e]=d-v,n[16+e]=m+k,n[40+e]=m-k,n[24+e]=x+E,n[32+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===0)for(let r=0;r<64;r++){const b=J[r];c[b]=l[o++]}else 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");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===0?this.huffmanTablesDC[F&15]=ne(c,b):this.huffmanTablesAC[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 fe 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=fe;