@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.
- package/LICENSE +21 -0
- package/README.md +1960 -0
- package/dist/ControlGrid-DN5md8hp.cjs +19636 -0
- package/dist/ControlGrid-rVNG7B9O.js +170422 -0
- package/dist/DuckDBConverter-B98M0DFs.cjs +23 -0
- package/dist/DuckDBConverter-RPq48-t0.js +434 -0
- package/dist/ShapefileConverter-AjbEjEyq.cjs +1 -0
- package/dist/ShapefileConverter-trvt8J3z.js +125 -0
- package/dist/decoder-CLokFc0V.js +8 -0
- package/dist/decoder-D9LU4bUo.cjs +1 -0
- package/dist/deflate-BA1jZeSX.js +10 -0
- package/dist/deflate-DEdCz12a.cjs +1 -0
- package/dist/geojson-BQSVgKFt.cjs +1 -0
- package/dist/geojson-BSUuDj5k.js +2551 -0
- package/dist/geotiff-De1w1lBy.cjs +8 -0
- package/dist/geotiff-o_Fq1Na4.js +3108 -0
- package/dist/index-8ZZtuDTp.js +705 -0
- package/dist/index-B-Nr9y7J.cjs +84 -0
- package/dist/index-B5NoFrpY.js +8892 -0
- package/dist/index-Bi1MMPUx.js +4163 -0
- package/dist/index-C9fk_HKR.js +167 -0
- package/dist/index-CBBRBJvR.cjs +274 -0
- package/dist/index-CZxPF1qt.js +4 -0
- package/dist/index-CiDPSJ9T.cjs +1 -0
- package/dist/index-CjM_nbxd.cjs +107 -0
- package/dist/index-DQXdX5y1.js +4666 -0
- package/dist/index-Dh1kpCb6.cjs +1 -0
- package/dist/index-IrsIiQNM.cjs +4 -0
- package/dist/index.cjs +3819 -0
- package/dist/index.mjs +19580 -0
- package/dist/jpeg-CF9OGQg_.js +533 -0
- package/dist/jpeg-JSQOxGHy.cjs +1 -0
- package/dist/lerc-7LlQoT6u.js +1032 -0
- package/dist/lerc-BIsodce9.cjs +1 -0
- package/dist/lzw-BZniWIYG.js +84 -0
- package/dist/lzw-BhML-BvT.cjs +1 -0
- package/dist/main-dist-Bymiy5aM.cjs +2 -0
- package/dist/main-dist-Cv8AKwrY.js +629 -0
- package/dist/maplibre-geoman.es-Bxdg-2EU.cjs +129 -0
- package/dist/maplibre-geoman.es-CFgM2ajb.js +22827 -0
- package/dist/maplibre-gl-components.css +1 -0
- package/dist/packbits-B9b7gX2c.cjs +1 -0
- package/dist/packbits-DWY5O-FG.js +24 -0
- package/dist/pako.esm-Bx5X36Wo.js +1074 -0
- package/dist/pako.esm-DZC2QrbJ.cjs +1 -0
- package/dist/raw-C3ARbSFo.cjs +1 -0
- package/dist/raw-DUslI1gr.js +9 -0
- package/dist/react.cjs +1 -0
- package/dist/react.mjs +1306 -0
- package/dist/types/index.d.ts +44 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/adapters/AddVectorAdapter.d.ts +66 -0
- package/dist/types/lib/adapters/AddVectorAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/CogLayerAdapter.d.ts +126 -0
- package/dist/types/lib/adapters/CogLayerAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/PMTilesLayerAdapter.d.ts +78 -0
- package/dist/types/lib/adapters/PMTilesLayerAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/StacLayerAdapter.d.ts +71 -0
- package/dist/types/lib/adapters/StacLayerAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/ZarrLayerAdapter.d.ts +72 -0
- package/dist/types/lib/adapters/ZarrLayerAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/index.d.ts +7 -0
- package/dist/types/lib/adapters/index.d.ts.map +1 -0
- package/dist/types/lib/addControlGrid.d.ts +80 -0
- package/dist/types/lib/addControlGrid.d.ts.map +1 -0
- package/dist/types/lib/colormaps/diverging.d.ts +30 -0
- package/dist/types/lib/colormaps/diverging.d.ts.map +1 -0
- package/dist/types/lib/colormaps/index.d.ts +32 -0
- package/dist/types/lib/colormaps/index.d.ts.map +1 -0
- package/dist/types/lib/colormaps/misc.d.ts +38 -0
- package/dist/types/lib/colormaps/misc.d.ts.map +1 -0
- package/dist/types/lib/colormaps/sequential.d.ts +22 -0
- package/dist/types/lib/colormaps/sequential.d.ts.map +1 -0
- package/dist/types/lib/converters/DuckDBConverter.d.ts +112 -0
- package/dist/types/lib/converters/DuckDBConverter.d.ts.map +1 -0
- package/dist/types/lib/converters/ShapefileConverter.d.ts +56 -0
- package/dist/types/lib/converters/ShapefileConverter.d.ts.map +1 -0
- package/dist/types/lib/converters/index.d.ts +8 -0
- package/dist/types/lib/converters/index.d.ts.map +1 -0
- package/dist/types/lib/converters/types.d.ts +75 -0
- package/dist/types/lib/converters/types.d.ts.map +1 -0
- package/dist/types/lib/core/AddVector.d.ts +116 -0
- package/dist/types/lib/core/AddVector.d.ts.map +1 -0
- package/dist/types/lib/core/Basemap.d.ts +206 -0
- package/dist/types/lib/core/Basemap.d.ts.map +1 -0
- package/dist/types/lib/core/BasemapReact.d.ts +32 -0
- package/dist/types/lib/core/BasemapReact.d.ts.map +1 -0
- package/dist/types/lib/core/BookmarkControl.d.ts +180 -0
- package/dist/types/lib/core/BookmarkControl.d.ts.map +1 -0
- package/dist/types/lib/core/ChoroplethControl.d.ts +105 -0
- package/dist/types/lib/core/ChoroplethControl.d.ts.map +1 -0
- package/dist/types/lib/core/CogLayer.d.ts +139 -0
- package/dist/types/lib/core/CogLayer.d.ts.map +1 -0
- package/dist/types/lib/core/CogLayerReact.d.ts +32 -0
- package/dist/types/lib/core/CogLayerReact.d.ts.map +1 -0
- package/dist/types/lib/core/Colorbar.d.ts +133 -0
- package/dist/types/lib/core/Colorbar.d.ts.map +1 -0
- package/dist/types/lib/core/ColorbarGuiControl.d.ts +79 -0
- package/dist/types/lib/core/ColorbarGuiControl.d.ts.map +1 -0
- package/dist/types/lib/core/ColorbarReact.d.ts +34 -0
- package/dist/types/lib/core/ColorbarReact.d.ts.map +1 -0
- package/dist/types/lib/core/ControlGrid.d.ts +125 -0
- package/dist/types/lib/core/ControlGrid.d.ts.map +1 -0
- package/dist/types/lib/core/ControlGridReact.d.ts +32 -0
- package/dist/types/lib/core/ControlGridReact.d.ts.map +1 -0
- package/dist/types/lib/core/HtmlControl.d.ts +140 -0
- package/dist/types/lib/core/HtmlControl.d.ts.map +1 -0
- package/dist/types/lib/core/HtmlControlReact.d.ts +32 -0
- package/dist/types/lib/core/HtmlControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/HtmlGuiControl.d.ts +68 -0
- package/dist/types/lib/core/HtmlGuiControl.d.ts.map +1 -0
- package/dist/types/lib/core/InspectControl.d.ts +202 -0
- package/dist/types/lib/core/InspectControl.d.ts.map +1 -0
- package/dist/types/lib/core/InspectControlReact.d.ts +32 -0
- package/dist/types/lib/core/InspectControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/Legend.d.ts +142 -0
- package/dist/types/lib/core/Legend.d.ts.map +1 -0
- package/dist/types/lib/core/LegendGuiControl.d.ts +69 -0
- package/dist/types/lib/core/LegendGuiControl.d.ts.map +1 -0
- package/dist/types/lib/core/LegendReact.d.ts +34 -0
- package/dist/types/lib/core/LegendReact.d.ts.map +1 -0
- package/dist/types/lib/core/MeasureControl.d.ts +211 -0
- package/dist/types/lib/core/MeasureControl.d.ts.map +1 -0
- package/dist/types/lib/core/MinimapControl.d.ts +77 -0
- package/dist/types/lib/core/MinimapControl.d.ts.map +1 -0
- package/dist/types/lib/core/MinimapControlReact.d.ts +32 -0
- package/dist/types/lib/core/MinimapControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/PMTilesLayer.d.ts +119 -0
- package/dist/types/lib/core/PMTilesLayer.d.ts.map +1 -0
- package/dist/types/lib/core/PrintControl.d.ts +226 -0
- package/dist/types/lib/core/PrintControl.d.ts.map +1 -0
- package/dist/types/lib/core/SearchControl.d.ts +172 -0
- package/dist/types/lib/core/SearchControl.d.ts.map +1 -0
- package/dist/types/lib/core/SearchControlReact.d.ts +32 -0
- package/dist/types/lib/core/SearchControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/StacLayer.d.ts +107 -0
- package/dist/types/lib/core/StacLayer.d.ts.map +1 -0
- package/dist/types/lib/core/StacSearch.d.ts +109 -0
- package/dist/types/lib/core/StacSearch.d.ts.map +1 -0
- package/dist/types/lib/core/Terrain.d.ts +165 -0
- package/dist/types/lib/core/Terrain.d.ts.map +1 -0
- package/dist/types/lib/core/TerrainReact.d.ts +32 -0
- package/dist/types/lib/core/TerrainReact.d.ts.map +1 -0
- package/dist/types/lib/core/VectorDataset.d.ts +228 -0
- package/dist/types/lib/core/VectorDataset.d.ts.map +1 -0
- package/dist/types/lib/core/VectorDatasetReact.d.ts +31 -0
- package/dist/types/lib/core/VectorDatasetReact.d.ts.map +1 -0
- package/dist/types/lib/core/ViewStateControl.d.ts +205 -0
- package/dist/types/lib/core/ViewStateControl.d.ts.map +1 -0
- package/dist/types/lib/core/ViewStateControlReact.d.ts +32 -0
- package/dist/types/lib/core/ViewStateControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/ZarrLayer.d.ts +110 -0
- package/dist/types/lib/core/ZarrLayer.d.ts.map +1 -0
- package/dist/types/lib/core/types.d.ts +2793 -0
- package/dist/types/lib/core/types.d.ts.map +1 -0
- package/dist/types/lib/hooks/index.d.ts +13 -0
- package/dist/types/lib/hooks/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/useBasemap.d.ts +43 -0
- package/dist/types/lib/hooks/useBasemap.d.ts.map +1 -0
- package/dist/types/lib/hooks/useCogLayer.d.ts +44 -0
- package/dist/types/lib/hooks/useCogLayer.d.ts.map +1 -0
- package/dist/types/lib/hooks/useColorbar.d.ts +36 -0
- package/dist/types/lib/hooks/useColorbar.d.ts.map +1 -0
- package/dist/types/lib/hooks/useControlGrid.d.ts +41 -0
- package/dist/types/lib/hooks/useControlGrid.d.ts.map +1 -0
- package/dist/types/lib/hooks/useHtmlControl.d.ts +39 -0
- package/dist/types/lib/hooks/useHtmlControl.d.ts.map +1 -0
- package/dist/types/lib/hooks/useInspectControl.d.ts +49 -0
- package/dist/types/lib/hooks/useInspectControl.d.ts.map +1 -0
- package/dist/types/lib/hooks/useLegend.d.ts +41 -0
- package/dist/types/lib/hooks/useLegend.d.ts.map +1 -0
- package/dist/types/lib/hooks/useMinimapControl.d.ts +35 -0
- package/dist/types/lib/hooks/useMinimapControl.d.ts.map +1 -0
- package/dist/types/lib/hooks/useSearchControl.d.ts +43 -0
- package/dist/types/lib/hooks/useSearchControl.d.ts.map +1 -0
- package/dist/types/lib/hooks/useTerrain.d.ts +43 -0
- package/dist/types/lib/hooks/useTerrain.d.ts.map +1 -0
- package/dist/types/lib/hooks/useVectorDataset.d.ts +35 -0
- package/dist/types/lib/hooks/useVectorDataset.d.ts.map +1 -0
- package/dist/types/lib/hooks/useViewState.d.ts +43 -0
- package/dist/types/lib/hooks/useViewState.d.ts.map +1 -0
- package/dist/types/lib/utils/color.d.ts +47 -0
- package/dist/types/lib/utils/color.d.ts.map +1 -0
- package/dist/types/lib/utils/fileHelpers.d.ts +207 -0
- package/dist/types/lib/utils/fileHelpers.d.ts.map +1 -0
- package/dist/types/lib/utils/helpers.d.ts +48 -0
- package/dist/types/lib/utils/helpers.d.ts.map +1 -0
- package/dist/types/lib/utils/index.d.ts +4 -0
- package/dist/types/lib/utils/index.d.ts.map +1 -0
- package/dist/types/lib/utils/providers.d.ts +46 -0
- package/dist/types/lib/utils/providers.d.ts.map +1 -0
- package/dist/types/react.d.ts +15 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/webimage-CBRffWZD.cjs +1 -0
- package/dist/webimage-ibSPOLHJ.js +19 -0
- package/package.json +137 -0
|
@@ -0,0 +1,2551 @@
|
|
|
1
|
+
const F = new Uint8Array([102, 103, 98, 3, 102, 103, 98, 0]), V = 4, ot = 2, T = 4, N = 4, q = 4, A = new Int32Array(2), xt = new Float32Array(A.buffer), Ft = new Float64Array(A.buffer), X = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
|
|
2
|
+
var ht;
|
|
3
|
+
(function(n) {
|
|
4
|
+
n[n.UTF8_BYTES = 1] = "UTF8_BYTES", n[n.UTF16_STRING = 2] = "UTF16_STRING";
|
|
5
|
+
})(ht || (ht = {}));
|
|
6
|
+
class B {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new ByteBuffer with a given array of bytes (`Uint8Array`)
|
|
9
|
+
*/
|
|
10
|
+
constructor(t) {
|
|
11
|
+
this.bytes_ = t, this.position_ = 0, this.text_decoder_ = new TextDecoder();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create and allocate a new ByteBuffer with a given size.
|
|
15
|
+
*/
|
|
16
|
+
static allocate(t) {
|
|
17
|
+
return new B(new Uint8Array(t));
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
this.position_ = 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the underlying `Uint8Array`.
|
|
24
|
+
*/
|
|
25
|
+
bytes() {
|
|
26
|
+
return this.bytes_;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the buffer's position.
|
|
30
|
+
*/
|
|
31
|
+
position() {
|
|
32
|
+
return this.position_;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Set the buffer's position.
|
|
36
|
+
*/
|
|
37
|
+
setPosition(t) {
|
|
38
|
+
this.position_ = t;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the buffer's capacity.
|
|
42
|
+
*/
|
|
43
|
+
capacity() {
|
|
44
|
+
return this.bytes_.length;
|
|
45
|
+
}
|
|
46
|
+
readInt8(t) {
|
|
47
|
+
return this.readUint8(t) << 24 >> 24;
|
|
48
|
+
}
|
|
49
|
+
readUint8(t) {
|
|
50
|
+
return this.bytes_[t];
|
|
51
|
+
}
|
|
52
|
+
readInt16(t) {
|
|
53
|
+
return this.readUint16(t) << 16 >> 16;
|
|
54
|
+
}
|
|
55
|
+
readUint16(t) {
|
|
56
|
+
return this.bytes_[t] | this.bytes_[t + 1] << 8;
|
|
57
|
+
}
|
|
58
|
+
readInt32(t) {
|
|
59
|
+
return this.bytes_[t] | this.bytes_[t + 1] << 8 | this.bytes_[t + 2] << 16 | this.bytes_[t + 3] << 24;
|
|
60
|
+
}
|
|
61
|
+
readUint32(t) {
|
|
62
|
+
return this.readInt32(t) >>> 0;
|
|
63
|
+
}
|
|
64
|
+
readInt64(t) {
|
|
65
|
+
return BigInt.asIntN(64, BigInt(this.readUint32(t)) + (BigInt(this.readUint32(t + 4)) << BigInt(32)));
|
|
66
|
+
}
|
|
67
|
+
readUint64(t) {
|
|
68
|
+
return BigInt.asUintN(64, BigInt(this.readUint32(t)) + (BigInt(this.readUint32(t + 4)) << BigInt(32)));
|
|
69
|
+
}
|
|
70
|
+
readFloat32(t) {
|
|
71
|
+
return A[0] = this.readInt32(t), xt[0];
|
|
72
|
+
}
|
|
73
|
+
readFloat64(t) {
|
|
74
|
+
return A[X ? 0 : 1] = this.readInt32(t), A[X ? 1 : 0] = this.readInt32(t + 4), Ft[0];
|
|
75
|
+
}
|
|
76
|
+
writeInt8(t, e) {
|
|
77
|
+
this.bytes_[t] = e;
|
|
78
|
+
}
|
|
79
|
+
writeUint8(t, e) {
|
|
80
|
+
this.bytes_[t] = e;
|
|
81
|
+
}
|
|
82
|
+
writeInt16(t, e) {
|
|
83
|
+
this.bytes_[t] = e, this.bytes_[t + 1] = e >> 8;
|
|
84
|
+
}
|
|
85
|
+
writeUint16(t, e) {
|
|
86
|
+
this.bytes_[t] = e, this.bytes_[t + 1] = e >> 8;
|
|
87
|
+
}
|
|
88
|
+
writeInt32(t, e) {
|
|
89
|
+
this.bytes_[t] = e, this.bytes_[t + 1] = e >> 8, this.bytes_[t + 2] = e >> 16, this.bytes_[t + 3] = e >> 24;
|
|
90
|
+
}
|
|
91
|
+
writeUint32(t, e) {
|
|
92
|
+
this.bytes_[t] = e, this.bytes_[t + 1] = e >> 8, this.bytes_[t + 2] = e >> 16, this.bytes_[t + 3] = e >> 24;
|
|
93
|
+
}
|
|
94
|
+
writeInt64(t, e) {
|
|
95
|
+
this.writeInt32(t, Number(BigInt.asIntN(32, e))), this.writeInt32(t + 4, Number(BigInt.asIntN(32, e >> BigInt(32))));
|
|
96
|
+
}
|
|
97
|
+
writeUint64(t, e) {
|
|
98
|
+
this.writeUint32(t, Number(BigInt.asUintN(32, e))), this.writeUint32(t + 4, Number(BigInt.asUintN(32, e >> BigInt(32))));
|
|
99
|
+
}
|
|
100
|
+
writeFloat32(t, e) {
|
|
101
|
+
xt[0] = e, this.writeInt32(t, A[0]);
|
|
102
|
+
}
|
|
103
|
+
writeFloat64(t, e) {
|
|
104
|
+
Ft[0] = e, this.writeInt32(t, A[X ? 0 : 1]), this.writeInt32(t + 4, A[X ? 1 : 0]);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Return the file identifier. Behavior is undefined for FlatBuffers whose
|
|
108
|
+
* schema does not include a file_identifier (likely points at padding or the
|
|
109
|
+
* start of a the root vtable).
|
|
110
|
+
*/
|
|
111
|
+
getBufferIdentifier() {
|
|
112
|
+
if (this.bytes_.length < this.position_ + T + N)
|
|
113
|
+
throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");
|
|
114
|
+
let t = "";
|
|
115
|
+
for (let e = 0; e < N; e++)
|
|
116
|
+
t += String.fromCharCode(this.readInt8(this.position_ + T + e));
|
|
117
|
+
return t;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Look up a field in the vtable, return an offset into the object, or 0 if the
|
|
121
|
+
* field is not present.
|
|
122
|
+
*/
|
|
123
|
+
__offset(t, e) {
|
|
124
|
+
const r = t - this.readInt32(t);
|
|
125
|
+
return e < this.readInt16(r) ? this.readInt16(r + e) : 0;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Initialize any Table-derived type to point to the union at the given offset.
|
|
129
|
+
*/
|
|
130
|
+
__union(t, e) {
|
|
131
|
+
return t.bb_pos = e + this.readInt32(e), t.bb = this, t;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
|
|
135
|
+
* This allocates a new string and converts to wide chars upon each access.
|
|
136
|
+
*
|
|
137
|
+
* To avoid the conversion to string, pass Encoding.UTF8_BYTES as the
|
|
138
|
+
* "optionalEncoding" argument. This is useful for avoiding conversion when
|
|
139
|
+
* the data will just be packaged back up in another FlatBuffer later on.
|
|
140
|
+
*
|
|
141
|
+
* @param offset
|
|
142
|
+
* @param opt_encoding Defaults to UTF16_STRING
|
|
143
|
+
*/
|
|
144
|
+
__string(t, e) {
|
|
145
|
+
t += this.readInt32(t);
|
|
146
|
+
const r = this.readInt32(t);
|
|
147
|
+
t += T;
|
|
148
|
+
const i = this.bytes_.subarray(t, t + r);
|
|
149
|
+
return e === ht.UTF8_BYTES ? i : this.text_decoder_.decode(i);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Handle unions that can contain string as its member, if a Table-derived type then initialize it,
|
|
153
|
+
* if a string then return a new one
|
|
154
|
+
*
|
|
155
|
+
* WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
|
|
156
|
+
* makes the behaviour of __union_with_string different compared to __union
|
|
157
|
+
*/
|
|
158
|
+
__union_with_string(t, e) {
|
|
159
|
+
return typeof t == "string" ? this.__string(e) : this.__union(t, e);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Retrieve the relative offset stored at "offset"
|
|
163
|
+
*/
|
|
164
|
+
__indirect(t) {
|
|
165
|
+
return t + this.readInt32(t);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get the start of data of a vector whose offset is stored at "offset" in this object.
|
|
169
|
+
*/
|
|
170
|
+
__vector(t) {
|
|
171
|
+
return t + this.readInt32(t) + T;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get the length of a vector whose offset is stored at "offset" in this object.
|
|
175
|
+
*/
|
|
176
|
+
__vector_len(t) {
|
|
177
|
+
return this.readInt32(t + this.readInt32(t));
|
|
178
|
+
}
|
|
179
|
+
__has_identifier(t) {
|
|
180
|
+
if (t.length != N)
|
|
181
|
+
throw new Error("FlatBuffers: file identifier must be length " + N);
|
|
182
|
+
for (let e = 0; e < N; e++)
|
|
183
|
+
if (t.charCodeAt(e) != this.readInt8(this.position() + T + e))
|
|
184
|
+
return !1;
|
|
185
|
+
return !0;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* A helper function for generating list for obj api
|
|
189
|
+
*/
|
|
190
|
+
createScalarList(t, e) {
|
|
191
|
+
const r = [];
|
|
192
|
+
for (let i = 0; i < e; ++i) {
|
|
193
|
+
const s = t(i);
|
|
194
|
+
s !== null && r.push(s);
|
|
195
|
+
}
|
|
196
|
+
return r;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* A helper function for generating list for obj api
|
|
200
|
+
* @param listAccessor function that accepts an index and return data at that index
|
|
201
|
+
* @param listLength listLength
|
|
202
|
+
* @param res result list
|
|
203
|
+
*/
|
|
204
|
+
createObjList(t, e) {
|
|
205
|
+
const r = [];
|
|
206
|
+
for (let i = 0; i < e; ++i) {
|
|
207
|
+
const s = t(i);
|
|
208
|
+
s !== null && r.push(s.unpack());
|
|
209
|
+
}
|
|
210
|
+
return r;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
class tt {
|
|
214
|
+
/**
|
|
215
|
+
* Create a FlatBufferBuilder.
|
|
216
|
+
*/
|
|
217
|
+
constructor(t) {
|
|
218
|
+
this.minalign = 1, this.vtable = null, this.vtable_in_use = 0, this.isNested = !1, this.object_start = 0, this.vtables = [], this.vector_num_elems = 0, this.force_defaults = !1, this.string_maps = null, this.text_encoder = new TextEncoder();
|
|
219
|
+
let e;
|
|
220
|
+
t ? e = t : e = 1024, this.bb = B.allocate(e), this.space = e;
|
|
221
|
+
}
|
|
222
|
+
clear() {
|
|
223
|
+
this.bb.clear(), this.space = this.bb.capacity(), this.minalign = 1, this.vtable = null, this.vtable_in_use = 0, this.isNested = !1, this.object_start = 0, this.vtables = [], this.vector_num_elems = 0, this.force_defaults = !1, this.string_maps = null;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* In order to save space, fields that are set to their default value
|
|
227
|
+
* don't get serialized into the buffer. Forcing defaults provides a
|
|
228
|
+
* way to manually disable this optimization.
|
|
229
|
+
*
|
|
230
|
+
* @param forceDefaults true always serializes default values
|
|
231
|
+
*/
|
|
232
|
+
forceDefaults(t) {
|
|
233
|
+
this.force_defaults = t;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Get the ByteBuffer representing the FlatBuffer. Only call this after you've
|
|
237
|
+
* called finish(). The actual data starts at the ByteBuffer's current position,
|
|
238
|
+
* not necessarily at 0.
|
|
239
|
+
*/
|
|
240
|
+
dataBuffer() {
|
|
241
|
+
return this.bb;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get the bytes representing the FlatBuffer. Only call this after you've
|
|
245
|
+
* called finish().
|
|
246
|
+
*/
|
|
247
|
+
asUint8Array() {
|
|
248
|
+
return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Prepare to write an element of `size` after `additional_bytes` have been
|
|
252
|
+
* written, e.g. if you write a string, you need to align such the int length
|
|
253
|
+
* field is aligned to 4 bytes, and the string data follows it directly. If all
|
|
254
|
+
* you need to do is alignment, `additional_bytes` will be 0.
|
|
255
|
+
*
|
|
256
|
+
* @param size This is the of the new element to write
|
|
257
|
+
* @param additional_bytes The padding size
|
|
258
|
+
*/
|
|
259
|
+
prep(t, e) {
|
|
260
|
+
t > this.minalign && (this.minalign = t);
|
|
261
|
+
const r = ~(this.bb.capacity() - this.space + e) + 1 & t - 1;
|
|
262
|
+
for (; this.space < r + t + e; ) {
|
|
263
|
+
const i = this.bb.capacity();
|
|
264
|
+
this.bb = tt.growByteBuffer(this.bb), this.space += this.bb.capacity() - i;
|
|
265
|
+
}
|
|
266
|
+
this.pad(r);
|
|
267
|
+
}
|
|
268
|
+
pad(t) {
|
|
269
|
+
for (let e = 0; e < t; e++)
|
|
270
|
+
this.bb.writeInt8(--this.space, 0);
|
|
271
|
+
}
|
|
272
|
+
writeInt8(t) {
|
|
273
|
+
this.bb.writeInt8(this.space -= 1, t);
|
|
274
|
+
}
|
|
275
|
+
writeInt16(t) {
|
|
276
|
+
this.bb.writeInt16(this.space -= 2, t);
|
|
277
|
+
}
|
|
278
|
+
writeInt32(t) {
|
|
279
|
+
this.bb.writeInt32(this.space -= 4, t);
|
|
280
|
+
}
|
|
281
|
+
writeInt64(t) {
|
|
282
|
+
this.bb.writeInt64(this.space -= 8, t);
|
|
283
|
+
}
|
|
284
|
+
writeFloat32(t) {
|
|
285
|
+
this.bb.writeFloat32(this.space -= 4, t);
|
|
286
|
+
}
|
|
287
|
+
writeFloat64(t) {
|
|
288
|
+
this.bb.writeFloat64(this.space -= 8, t);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
292
|
+
* @param value The `int8` to add the buffer.
|
|
293
|
+
*/
|
|
294
|
+
addInt8(t) {
|
|
295
|
+
this.prep(1, 0), this.writeInt8(t);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
299
|
+
* @param value The `int16` to add the buffer.
|
|
300
|
+
*/
|
|
301
|
+
addInt16(t) {
|
|
302
|
+
this.prep(2, 0), this.writeInt16(t);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
306
|
+
* @param value The `int32` to add the buffer.
|
|
307
|
+
*/
|
|
308
|
+
addInt32(t) {
|
|
309
|
+
this.prep(4, 0), this.writeInt32(t);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
313
|
+
* @param value The `int64` to add the buffer.
|
|
314
|
+
*/
|
|
315
|
+
addInt64(t) {
|
|
316
|
+
this.prep(8, 0), this.writeInt64(t);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
320
|
+
* @param value The `float32` to add the buffer.
|
|
321
|
+
*/
|
|
322
|
+
addFloat32(t) {
|
|
323
|
+
this.prep(4, 0), this.writeFloat32(t);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
327
|
+
* @param value The `float64` to add the buffer.
|
|
328
|
+
*/
|
|
329
|
+
addFloat64(t) {
|
|
330
|
+
this.prep(8, 0), this.writeFloat64(t);
|
|
331
|
+
}
|
|
332
|
+
addFieldInt8(t, e, r) {
|
|
333
|
+
(this.force_defaults || e != r) && (this.addInt8(e), this.slot(t));
|
|
334
|
+
}
|
|
335
|
+
addFieldInt16(t, e, r) {
|
|
336
|
+
(this.force_defaults || e != r) && (this.addInt16(e), this.slot(t));
|
|
337
|
+
}
|
|
338
|
+
addFieldInt32(t, e, r) {
|
|
339
|
+
(this.force_defaults || e != r) && (this.addInt32(e), this.slot(t));
|
|
340
|
+
}
|
|
341
|
+
addFieldInt64(t, e, r) {
|
|
342
|
+
(this.force_defaults || e !== r) && (this.addInt64(e), this.slot(t));
|
|
343
|
+
}
|
|
344
|
+
addFieldFloat32(t, e, r) {
|
|
345
|
+
(this.force_defaults || e != r) && (this.addFloat32(e), this.slot(t));
|
|
346
|
+
}
|
|
347
|
+
addFieldFloat64(t, e, r) {
|
|
348
|
+
(this.force_defaults || e != r) && (this.addFloat64(e), this.slot(t));
|
|
349
|
+
}
|
|
350
|
+
addFieldOffset(t, e, r) {
|
|
351
|
+
(this.force_defaults || e != r) && (this.addOffset(e), this.slot(t));
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Structs are stored inline, so nothing additional is being added. `d` is always 0.
|
|
355
|
+
*/
|
|
356
|
+
addFieldStruct(t, e, r) {
|
|
357
|
+
e != r && (this.nested(e), this.slot(t));
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Structures are always stored inline, they need to be created right
|
|
361
|
+
* where they're used. You'll get this assertion failure if you
|
|
362
|
+
* created it elsewhere.
|
|
363
|
+
*/
|
|
364
|
+
nested(t) {
|
|
365
|
+
if (t != this.offset())
|
|
366
|
+
throw new TypeError("FlatBuffers: struct must be serialized inline.");
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Should not be creating any other object, string or vector
|
|
370
|
+
* while an object is being constructed
|
|
371
|
+
*/
|
|
372
|
+
notNested() {
|
|
373
|
+
if (this.isNested)
|
|
374
|
+
throw new TypeError("FlatBuffers: object serialization must not be nested.");
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Set the current vtable at `voffset` to the current location in the buffer.
|
|
378
|
+
*/
|
|
379
|
+
slot(t) {
|
|
380
|
+
this.vtable !== null && (this.vtable[t] = this.offset());
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* @returns Offset relative to the end of the buffer.
|
|
384
|
+
*/
|
|
385
|
+
offset() {
|
|
386
|
+
return this.bb.capacity() - this.space;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Doubles the size of the backing ByteBuffer and copies the old data towards
|
|
390
|
+
* the end of the new buffer (since we build the buffer backwards).
|
|
391
|
+
*
|
|
392
|
+
* @param bb The current buffer with the existing data
|
|
393
|
+
* @returns A new byte buffer with the old data copied
|
|
394
|
+
* to it. The data is located at the end of the buffer.
|
|
395
|
+
*
|
|
396
|
+
* uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
|
|
397
|
+
* it a uint8Array we need to suppress the type check:
|
|
398
|
+
* @suppress {checkTypes}
|
|
399
|
+
*/
|
|
400
|
+
static growByteBuffer(t) {
|
|
401
|
+
const e = t.capacity();
|
|
402
|
+
if (e & 3221225472)
|
|
403
|
+
throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");
|
|
404
|
+
const r = e << 1, i = B.allocate(r);
|
|
405
|
+
return i.setPosition(r - e), i.bytes().set(t.bytes(), r - e), i;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Adds on offset, relative to where it will be written.
|
|
409
|
+
*
|
|
410
|
+
* @param offset The offset to add.
|
|
411
|
+
*/
|
|
412
|
+
addOffset(t) {
|
|
413
|
+
this.prep(T, 0), this.writeInt32(this.offset() - t + T);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Start encoding a new object in the buffer. Users will not usually need to
|
|
417
|
+
* call this directly. The FlatBuffers compiler will generate helper methods
|
|
418
|
+
* that call this method internally.
|
|
419
|
+
*/
|
|
420
|
+
startObject(t) {
|
|
421
|
+
this.notNested(), this.vtable == null && (this.vtable = []), this.vtable_in_use = t;
|
|
422
|
+
for (let e = 0; e < t; e++)
|
|
423
|
+
this.vtable[e] = 0;
|
|
424
|
+
this.isNested = !0, this.object_start = this.offset();
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Finish off writing the object that is under construction.
|
|
428
|
+
*
|
|
429
|
+
* @returns The offset to the object inside `dataBuffer`
|
|
430
|
+
*/
|
|
431
|
+
endObject() {
|
|
432
|
+
if (this.vtable == null || !this.isNested)
|
|
433
|
+
throw new Error("FlatBuffers: endObject called without startObject");
|
|
434
|
+
this.addInt32(0);
|
|
435
|
+
const t = this.offset();
|
|
436
|
+
let e = this.vtable_in_use - 1;
|
|
437
|
+
for (; e >= 0 && this.vtable[e] == 0; e--)
|
|
438
|
+
;
|
|
439
|
+
const r = e + 1;
|
|
440
|
+
for (; e >= 0; e--)
|
|
441
|
+
this.addInt16(this.vtable[e] != 0 ? t - this.vtable[e] : 0);
|
|
442
|
+
const i = 2;
|
|
443
|
+
this.addInt16(t - this.object_start);
|
|
444
|
+
const s = (r + i) * ot;
|
|
445
|
+
this.addInt16(s);
|
|
446
|
+
let a = 0;
|
|
447
|
+
const l = this.space;
|
|
448
|
+
t: for (e = 0; e < this.vtables.length; e++) {
|
|
449
|
+
const u = this.bb.capacity() - this.vtables[e];
|
|
450
|
+
if (s == this.bb.readInt16(u)) {
|
|
451
|
+
for (let o = ot; o < s; o += ot)
|
|
452
|
+
if (this.bb.readInt16(l + o) != this.bb.readInt16(u + o))
|
|
453
|
+
continue t;
|
|
454
|
+
a = this.vtables[e];
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return a ? (this.space = this.bb.capacity() - t, this.bb.writeInt32(this.space, a - t)) : (this.vtables.push(this.offset()), this.bb.writeInt32(this.bb.capacity() - t, this.offset() - t)), this.isNested = !1, t;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Finalize a buffer, poiting to the given `root_table`.
|
|
462
|
+
*/
|
|
463
|
+
finish(t, e, r) {
|
|
464
|
+
const i = r ? q : 0;
|
|
465
|
+
if (e) {
|
|
466
|
+
const s = e;
|
|
467
|
+
if (this.prep(this.minalign, T + N + i), s.length != N)
|
|
468
|
+
throw new TypeError("FlatBuffers: file identifier must be length " + N);
|
|
469
|
+
for (let a = N - 1; a >= 0; a--)
|
|
470
|
+
this.writeInt8(s.charCodeAt(a));
|
|
471
|
+
}
|
|
472
|
+
this.prep(this.minalign, T + i), this.addOffset(t), i && this.addInt32(this.bb.capacity() - this.space), this.bb.setPosition(this.space);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Finalize a size prefixed buffer, pointing to the given `root_table`.
|
|
476
|
+
*/
|
|
477
|
+
finishSizePrefixed(t, e) {
|
|
478
|
+
this.finish(t, e, !0);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* This checks a required field has been set in a given table that has
|
|
482
|
+
* just been constructed.
|
|
483
|
+
*/
|
|
484
|
+
requiredField(t, e) {
|
|
485
|
+
const r = this.bb.capacity() - t, i = r - this.bb.readInt32(r);
|
|
486
|
+
if (!(e < this.bb.readInt16(i) && this.bb.readInt16(i + e) != 0))
|
|
487
|
+
throw new TypeError("FlatBuffers: field " + e + " must be set");
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Start a new array/vector of objects. Users usually will not call
|
|
491
|
+
* this directly. The FlatBuffers compiler will create a start/end
|
|
492
|
+
* method for vector types in generated code.
|
|
493
|
+
*
|
|
494
|
+
* @param elem_size The size of each element in the array
|
|
495
|
+
* @param num_elems The number of elements in the array
|
|
496
|
+
* @param alignment The alignment of the array
|
|
497
|
+
*/
|
|
498
|
+
startVector(t, e, r) {
|
|
499
|
+
this.notNested(), this.vector_num_elems = e, this.prep(T, t * e), this.prep(r, t * e);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Finish off the creation of an array and all its elements. The array must be
|
|
503
|
+
* created with `startVector`.
|
|
504
|
+
*
|
|
505
|
+
* @returns The offset at which the newly created array
|
|
506
|
+
* starts.
|
|
507
|
+
*/
|
|
508
|
+
endVector() {
|
|
509
|
+
return this.writeInt32(this.vector_num_elems), this.offset();
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Encode the string `s` in the buffer using UTF-8. If the string passed has
|
|
513
|
+
* already been seen, we return the offset of the already written string
|
|
514
|
+
*
|
|
515
|
+
* @param s The string to encode
|
|
516
|
+
* @return The offset in the buffer where the encoded string starts
|
|
517
|
+
*/
|
|
518
|
+
createSharedString(t) {
|
|
519
|
+
if (!t)
|
|
520
|
+
return 0;
|
|
521
|
+
if (this.string_maps || (this.string_maps = /* @__PURE__ */ new Map()), this.string_maps.has(t))
|
|
522
|
+
return this.string_maps.get(t);
|
|
523
|
+
const e = this.createString(t);
|
|
524
|
+
return this.string_maps.set(t, e), e;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
|
|
528
|
+
* instead of a string, it is assumed to contain valid UTF-8 encoded data.
|
|
529
|
+
*
|
|
530
|
+
* @param s The string to encode
|
|
531
|
+
* @return The offset in the buffer where the encoded string starts
|
|
532
|
+
*/
|
|
533
|
+
createString(t) {
|
|
534
|
+
if (t == null)
|
|
535
|
+
return 0;
|
|
536
|
+
let e;
|
|
537
|
+
return t instanceof Uint8Array ? e = t : e = this.text_encoder.encode(t), this.addInt8(0), this.startVector(1, e.length, 1), this.bb.setPosition(this.space -= e.length), this.bb.bytes().set(e, this.space), this.endVector();
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Create a byte vector.
|
|
541
|
+
*
|
|
542
|
+
* @param v The bytes to add
|
|
543
|
+
* @returns The offset in the buffer where the byte vector starts
|
|
544
|
+
*/
|
|
545
|
+
createByteVector(t) {
|
|
546
|
+
return t == null ? 0 : (this.startVector(1, t.length, 1), this.bb.setPosition(this.space -= t.length), this.bb.bytes().set(t, this.space), this.endVector());
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* A helper function to pack an object
|
|
550
|
+
*
|
|
551
|
+
* @returns offset of obj
|
|
552
|
+
*/
|
|
553
|
+
createObjectOffset(t) {
|
|
554
|
+
return t === null ? 0 : typeof t == "string" ? this.createString(t) : t.pack(this);
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* A helper function to pack a list of object
|
|
558
|
+
*
|
|
559
|
+
* @returns list of offsets of each non null object
|
|
560
|
+
*/
|
|
561
|
+
createObjectOffsetList(t) {
|
|
562
|
+
const e = [];
|
|
563
|
+
for (let r = 0; r < t.length; ++r) {
|
|
564
|
+
const i = t[r];
|
|
565
|
+
if (i !== null)
|
|
566
|
+
e.push(this.createObjectOffset(i));
|
|
567
|
+
else
|
|
568
|
+
throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");
|
|
569
|
+
}
|
|
570
|
+
return e;
|
|
571
|
+
}
|
|
572
|
+
createStructOffsetList(t, e) {
|
|
573
|
+
return e(this, t.length), this.createObjectOffsetList(t.slice().reverse()), this.endVector();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
var g, y = ((g = {})[g.Byte = 0] = "Byte", g[g.UByte = 1] = "UByte", g[g.Bool = 2] = "Bool", g[g.Short = 3] = "Short", g[g.UShort = 4] = "UShort", g[g.Int = 5] = "Int", g[g.UInt = 6] = "UInt", g[g.Long = 7] = "Long", g[g.ULong = 8] = "ULong", g[g.Float = 9] = "Float", g[g.Double = 10] = "Double", g[g.String = 11] = "String", g[g.Json = 12] = "Json", g[g.DateTime = 13] = "DateTime", g[g.Binary = 14] = "Binary", g);
|
|
577
|
+
class v {
|
|
578
|
+
bb = null;
|
|
579
|
+
bb_pos = 0;
|
|
580
|
+
__init(t, e) {
|
|
581
|
+
return this.bb_pos = t, this.bb = e, this;
|
|
582
|
+
}
|
|
583
|
+
static getRootAsColumn(t, e) {
|
|
584
|
+
return (e || new v()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
585
|
+
}
|
|
586
|
+
static getSizePrefixedRootAsColumn(t, e) {
|
|
587
|
+
return t.setPosition(t.position() + q), (e || new v()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
588
|
+
}
|
|
589
|
+
name(t) {
|
|
590
|
+
let e = this.bb.__offset(this.bb_pos, 4);
|
|
591
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
592
|
+
}
|
|
593
|
+
type() {
|
|
594
|
+
let t = this.bb.__offset(this.bb_pos, 6);
|
|
595
|
+
return t ? this.bb.readUint8(this.bb_pos + t) : y.Byte;
|
|
596
|
+
}
|
|
597
|
+
title(t) {
|
|
598
|
+
let e = this.bb.__offset(this.bb_pos, 8);
|
|
599
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
600
|
+
}
|
|
601
|
+
description(t) {
|
|
602
|
+
let e = this.bb.__offset(this.bb_pos, 10);
|
|
603
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
604
|
+
}
|
|
605
|
+
width() {
|
|
606
|
+
let t = this.bb.__offset(this.bb_pos, 12);
|
|
607
|
+
return t ? this.bb.readInt32(this.bb_pos + t) : -1;
|
|
608
|
+
}
|
|
609
|
+
precision() {
|
|
610
|
+
let t = this.bb.__offset(this.bb_pos, 14);
|
|
611
|
+
return t ? this.bb.readInt32(this.bb_pos + t) : -1;
|
|
612
|
+
}
|
|
613
|
+
scale() {
|
|
614
|
+
let t = this.bb.__offset(this.bb_pos, 16);
|
|
615
|
+
return t ? this.bb.readInt32(this.bb_pos + t) : -1;
|
|
616
|
+
}
|
|
617
|
+
nullable() {
|
|
618
|
+
let t = this.bb.__offset(this.bb_pos, 18);
|
|
619
|
+
return !t || !!this.bb.readInt8(this.bb_pos + t);
|
|
620
|
+
}
|
|
621
|
+
unique() {
|
|
622
|
+
let t = this.bb.__offset(this.bb_pos, 20);
|
|
623
|
+
return !!t && !!this.bb.readInt8(this.bb_pos + t);
|
|
624
|
+
}
|
|
625
|
+
primaryKey() {
|
|
626
|
+
let t = this.bb.__offset(this.bb_pos, 22);
|
|
627
|
+
return !!t && !!this.bb.readInt8(this.bb_pos + t);
|
|
628
|
+
}
|
|
629
|
+
metadata(t) {
|
|
630
|
+
let e = this.bb.__offset(this.bb_pos, 24);
|
|
631
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
632
|
+
}
|
|
633
|
+
static startColumn(t) {
|
|
634
|
+
t.startObject(11);
|
|
635
|
+
}
|
|
636
|
+
static addName(t, e) {
|
|
637
|
+
t.addFieldOffset(0, e, 0);
|
|
638
|
+
}
|
|
639
|
+
static addType(t, e) {
|
|
640
|
+
t.addFieldInt8(1, e, y.Byte);
|
|
641
|
+
}
|
|
642
|
+
static addTitle(t, e) {
|
|
643
|
+
t.addFieldOffset(2, e, 0);
|
|
644
|
+
}
|
|
645
|
+
static addDescription(t, e) {
|
|
646
|
+
t.addFieldOffset(3, e, 0);
|
|
647
|
+
}
|
|
648
|
+
static addWidth(t, e) {
|
|
649
|
+
t.addFieldInt32(4, e, -1);
|
|
650
|
+
}
|
|
651
|
+
static addPrecision(t, e) {
|
|
652
|
+
t.addFieldInt32(5, e, -1);
|
|
653
|
+
}
|
|
654
|
+
static addScale(t, e) {
|
|
655
|
+
t.addFieldInt32(6, e, -1);
|
|
656
|
+
}
|
|
657
|
+
static addNullable(t, e) {
|
|
658
|
+
t.addFieldInt8(7, +e, 1);
|
|
659
|
+
}
|
|
660
|
+
static addUnique(t, e) {
|
|
661
|
+
t.addFieldInt8(8, +e, 0);
|
|
662
|
+
}
|
|
663
|
+
static addPrimaryKey(t, e) {
|
|
664
|
+
t.addFieldInt8(9, +e, 0);
|
|
665
|
+
}
|
|
666
|
+
static addMetadata(t, e) {
|
|
667
|
+
t.addFieldOffset(10, e, 0);
|
|
668
|
+
}
|
|
669
|
+
static endColumn(t) {
|
|
670
|
+
let e = t.endObject();
|
|
671
|
+
return t.requiredField(e, 4), e;
|
|
672
|
+
}
|
|
673
|
+
static createColumn(t, e, r, i, s, a, l, u, o, f, c, h) {
|
|
674
|
+
return v.startColumn(t), v.addName(t, e), v.addType(t, r), v.addTitle(t, i), v.addDescription(t, s), v.addWidth(t, a), v.addPrecision(t, l), v.addScale(t, u), v.addNullable(t, o), v.addUnique(t, f), v.addPrimaryKey(t, c), v.addMetadata(t, h), v.endColumn(t);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
var _, I = ((_ = {})[_.Unknown = 0] = "Unknown", _[_.Point = 1] = "Point", _[_.LineString = 2] = "LineString", _[_.Polygon = 3] = "Polygon", _[_.MultiPoint = 4] = "MultiPoint", _[_.MultiLineString = 5] = "MultiLineString", _[_.MultiPolygon = 6] = "MultiPolygon", _[_.GeometryCollection = 7] = "GeometryCollection", _[_.CircularString = 8] = "CircularString", _[_.CompoundCurve = 9] = "CompoundCurve", _[_.CurvePolygon = 10] = "CurvePolygon", _[_.MultiCurve = 11] = "MultiCurve", _[_.MultiSurface = 12] = "MultiSurface", _[_.Curve = 13] = "Curve", _[_.Surface = 14] = "Surface", _[_.PolyhedralSurface = 15] = "PolyhedralSurface", _[_.TIN = 16] = "TIN", _[_.Triangle = 17] = "Triangle", _);
|
|
678
|
+
class w {
|
|
679
|
+
bb = null;
|
|
680
|
+
bb_pos = 0;
|
|
681
|
+
__init(t, e) {
|
|
682
|
+
return this.bb_pos = t, this.bb = e, this;
|
|
683
|
+
}
|
|
684
|
+
static getRootAsGeometry(t, e) {
|
|
685
|
+
return (e || new w()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
686
|
+
}
|
|
687
|
+
static getSizePrefixedRootAsGeometry(t, e) {
|
|
688
|
+
return t.setPosition(t.position() + q), (e || new w()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
689
|
+
}
|
|
690
|
+
ends(t) {
|
|
691
|
+
let e = this.bb.__offset(this.bb_pos, 4);
|
|
692
|
+
return e ? this.bb.readUint32(this.bb.__vector(this.bb_pos + e) + 4 * t) : 0;
|
|
693
|
+
}
|
|
694
|
+
endsLength() {
|
|
695
|
+
let t = this.bb.__offset(this.bb_pos, 4);
|
|
696
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
697
|
+
}
|
|
698
|
+
endsArray() {
|
|
699
|
+
let t = this.bb.__offset(this.bb_pos, 4);
|
|
700
|
+
return t ? new Uint32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t), this.bb.__vector_len(this.bb_pos + t)) : null;
|
|
701
|
+
}
|
|
702
|
+
xy(t) {
|
|
703
|
+
let e = this.bb.__offset(this.bb_pos, 6);
|
|
704
|
+
return e ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e) + 8 * t) : 0;
|
|
705
|
+
}
|
|
706
|
+
xyLength() {
|
|
707
|
+
let t = this.bb.__offset(this.bb_pos, 6);
|
|
708
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
709
|
+
}
|
|
710
|
+
xyArray() {
|
|
711
|
+
let t = this.bb.__offset(this.bb_pos, 6);
|
|
712
|
+
return t ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t), this.bb.__vector_len(this.bb_pos + t)) : null;
|
|
713
|
+
}
|
|
714
|
+
z(t) {
|
|
715
|
+
let e = this.bb.__offset(this.bb_pos, 8);
|
|
716
|
+
return e ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e) + 8 * t) : 0;
|
|
717
|
+
}
|
|
718
|
+
zLength() {
|
|
719
|
+
let t = this.bb.__offset(this.bb_pos, 8);
|
|
720
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
721
|
+
}
|
|
722
|
+
zArray() {
|
|
723
|
+
let t = this.bb.__offset(this.bb_pos, 8);
|
|
724
|
+
return t ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t), this.bb.__vector_len(this.bb_pos + t)) : null;
|
|
725
|
+
}
|
|
726
|
+
m(t) {
|
|
727
|
+
let e = this.bb.__offset(this.bb_pos, 10);
|
|
728
|
+
return e ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e) + 8 * t) : 0;
|
|
729
|
+
}
|
|
730
|
+
mLength() {
|
|
731
|
+
let t = this.bb.__offset(this.bb_pos, 10);
|
|
732
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
733
|
+
}
|
|
734
|
+
mArray() {
|
|
735
|
+
let t = this.bb.__offset(this.bb_pos, 10);
|
|
736
|
+
return t ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t), this.bb.__vector_len(this.bb_pos + t)) : null;
|
|
737
|
+
}
|
|
738
|
+
t(t) {
|
|
739
|
+
let e = this.bb.__offset(this.bb_pos, 12);
|
|
740
|
+
return e ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e) + 8 * t) : 0;
|
|
741
|
+
}
|
|
742
|
+
tLength() {
|
|
743
|
+
let t = this.bb.__offset(this.bb_pos, 12);
|
|
744
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
745
|
+
}
|
|
746
|
+
tArray() {
|
|
747
|
+
let t = this.bb.__offset(this.bb_pos, 12);
|
|
748
|
+
return t ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t), this.bb.__vector_len(this.bb_pos + t)) : null;
|
|
749
|
+
}
|
|
750
|
+
tm(t) {
|
|
751
|
+
let e = this.bb.__offset(this.bb_pos, 14);
|
|
752
|
+
return e ? this.bb.readUint64(this.bb.__vector(this.bb_pos + e) + 8 * t) : BigInt(0);
|
|
753
|
+
}
|
|
754
|
+
tmLength() {
|
|
755
|
+
let t = this.bb.__offset(this.bb_pos, 14);
|
|
756
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
757
|
+
}
|
|
758
|
+
type() {
|
|
759
|
+
let t = this.bb.__offset(this.bb_pos, 16);
|
|
760
|
+
return t ? this.bb.readUint8(this.bb_pos + t) : I.Unknown;
|
|
761
|
+
}
|
|
762
|
+
parts(t, e) {
|
|
763
|
+
let r = this.bb.__offset(this.bb_pos, 18);
|
|
764
|
+
return r ? (e || new w()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + r) + 4 * t), this.bb) : null;
|
|
765
|
+
}
|
|
766
|
+
partsLength() {
|
|
767
|
+
let t = this.bb.__offset(this.bb_pos, 18);
|
|
768
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
769
|
+
}
|
|
770
|
+
static startGeometry(t) {
|
|
771
|
+
t.startObject(8);
|
|
772
|
+
}
|
|
773
|
+
static addEnds(t, e) {
|
|
774
|
+
t.addFieldOffset(0, e, 0);
|
|
775
|
+
}
|
|
776
|
+
static createEndsVector(t, e) {
|
|
777
|
+
t.startVector(4, e.length, 4);
|
|
778
|
+
for (let r = e.length - 1; r >= 0; r--) t.addInt32(e[r]);
|
|
779
|
+
return t.endVector();
|
|
780
|
+
}
|
|
781
|
+
static startEndsVector(t, e) {
|
|
782
|
+
t.startVector(4, e, 4);
|
|
783
|
+
}
|
|
784
|
+
static addXy(t, e) {
|
|
785
|
+
t.addFieldOffset(1, e, 0);
|
|
786
|
+
}
|
|
787
|
+
static createXyVector(t, e) {
|
|
788
|
+
t.startVector(8, e.length, 8);
|
|
789
|
+
for (let r = e.length - 1; r >= 0; r--) t.addFloat64(e[r]);
|
|
790
|
+
return t.endVector();
|
|
791
|
+
}
|
|
792
|
+
static startXyVector(t, e) {
|
|
793
|
+
t.startVector(8, e, 8);
|
|
794
|
+
}
|
|
795
|
+
static addZ(t, e) {
|
|
796
|
+
t.addFieldOffset(2, e, 0);
|
|
797
|
+
}
|
|
798
|
+
static createZVector(t, e) {
|
|
799
|
+
t.startVector(8, e.length, 8);
|
|
800
|
+
for (let r = e.length - 1; r >= 0; r--) t.addFloat64(e[r]);
|
|
801
|
+
return t.endVector();
|
|
802
|
+
}
|
|
803
|
+
static startZVector(t, e) {
|
|
804
|
+
t.startVector(8, e, 8);
|
|
805
|
+
}
|
|
806
|
+
static addM(t, e) {
|
|
807
|
+
t.addFieldOffset(3, e, 0);
|
|
808
|
+
}
|
|
809
|
+
static createMVector(t, e) {
|
|
810
|
+
t.startVector(8, e.length, 8);
|
|
811
|
+
for (let r = e.length - 1; r >= 0; r--) t.addFloat64(e[r]);
|
|
812
|
+
return t.endVector();
|
|
813
|
+
}
|
|
814
|
+
static startMVector(t, e) {
|
|
815
|
+
t.startVector(8, e, 8);
|
|
816
|
+
}
|
|
817
|
+
static addT(t, e) {
|
|
818
|
+
t.addFieldOffset(4, e, 0);
|
|
819
|
+
}
|
|
820
|
+
static createTVector(t, e) {
|
|
821
|
+
t.startVector(8, e.length, 8);
|
|
822
|
+
for (let r = e.length - 1; r >= 0; r--) t.addFloat64(e[r]);
|
|
823
|
+
return t.endVector();
|
|
824
|
+
}
|
|
825
|
+
static startTVector(t, e) {
|
|
826
|
+
t.startVector(8, e, 8);
|
|
827
|
+
}
|
|
828
|
+
static addTm(t, e) {
|
|
829
|
+
t.addFieldOffset(5, e, 0);
|
|
830
|
+
}
|
|
831
|
+
static createTmVector(t, e) {
|
|
832
|
+
t.startVector(8, e.length, 8);
|
|
833
|
+
for (let r = e.length - 1; r >= 0; r--) t.addInt64(e[r]);
|
|
834
|
+
return t.endVector();
|
|
835
|
+
}
|
|
836
|
+
static startTmVector(t, e) {
|
|
837
|
+
t.startVector(8, e, 8);
|
|
838
|
+
}
|
|
839
|
+
static addType(t, e) {
|
|
840
|
+
t.addFieldInt8(6, e, I.Unknown);
|
|
841
|
+
}
|
|
842
|
+
static addParts(t, e) {
|
|
843
|
+
t.addFieldOffset(7, e, 0);
|
|
844
|
+
}
|
|
845
|
+
static createPartsVector(t, e) {
|
|
846
|
+
t.startVector(4, e.length, 4);
|
|
847
|
+
for (let r = e.length - 1; r >= 0; r--) t.addOffset(e[r]);
|
|
848
|
+
return t.endVector();
|
|
849
|
+
}
|
|
850
|
+
static startPartsVector(t, e) {
|
|
851
|
+
t.startVector(4, e, 4);
|
|
852
|
+
}
|
|
853
|
+
static endGeometry(t) {
|
|
854
|
+
return t.endObject();
|
|
855
|
+
}
|
|
856
|
+
static createGeometry(t, e, r, i, s, a, l, u, o) {
|
|
857
|
+
return w.startGeometry(t), w.addEnds(t, e), w.addXy(t, r), w.addZ(t, i), w.addM(t, s), w.addT(t, a), w.addTm(t, l), w.addType(t, u), w.addParts(t, o), w.endGeometry(t);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
class x {
|
|
861
|
+
bb = null;
|
|
862
|
+
bb_pos = 0;
|
|
863
|
+
__init(t, e) {
|
|
864
|
+
return this.bb_pos = t, this.bb = e, this;
|
|
865
|
+
}
|
|
866
|
+
static getRootAsFeature(t, e) {
|
|
867
|
+
return (e || new x()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
868
|
+
}
|
|
869
|
+
static getSizePrefixedRootAsFeature(t, e) {
|
|
870
|
+
return t.setPosition(t.position() + q), (e || new x()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
871
|
+
}
|
|
872
|
+
geometry(t) {
|
|
873
|
+
let e = this.bb.__offset(this.bb_pos, 4);
|
|
874
|
+
return e ? (t || new w()).__init(this.bb.__indirect(this.bb_pos + e), this.bb) : null;
|
|
875
|
+
}
|
|
876
|
+
properties(t) {
|
|
877
|
+
let e = this.bb.__offset(this.bb_pos, 6);
|
|
878
|
+
return e ? this.bb.readUint8(this.bb.__vector(this.bb_pos + e) + t) : 0;
|
|
879
|
+
}
|
|
880
|
+
propertiesLength() {
|
|
881
|
+
let t = this.bb.__offset(this.bb_pos, 6);
|
|
882
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
883
|
+
}
|
|
884
|
+
propertiesArray() {
|
|
885
|
+
let t = this.bb.__offset(this.bb_pos, 6);
|
|
886
|
+
return t ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t), this.bb.__vector_len(this.bb_pos + t)) : null;
|
|
887
|
+
}
|
|
888
|
+
columns(t, e) {
|
|
889
|
+
let r = this.bb.__offset(this.bb_pos, 8);
|
|
890
|
+
return r ? (e || new v()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + r) + 4 * t), this.bb) : null;
|
|
891
|
+
}
|
|
892
|
+
columnsLength() {
|
|
893
|
+
let t = this.bb.__offset(this.bb_pos, 8);
|
|
894
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
895
|
+
}
|
|
896
|
+
static startFeature(t) {
|
|
897
|
+
t.startObject(3);
|
|
898
|
+
}
|
|
899
|
+
static addGeometry(t, e) {
|
|
900
|
+
t.addFieldOffset(0, e, 0);
|
|
901
|
+
}
|
|
902
|
+
static addProperties(t, e) {
|
|
903
|
+
t.addFieldOffset(1, e, 0);
|
|
904
|
+
}
|
|
905
|
+
static createPropertiesVector(t, e) {
|
|
906
|
+
t.startVector(1, e.length, 1);
|
|
907
|
+
for (let r = e.length - 1; r >= 0; r--) t.addInt8(e[r]);
|
|
908
|
+
return t.endVector();
|
|
909
|
+
}
|
|
910
|
+
static startPropertiesVector(t, e) {
|
|
911
|
+
t.startVector(1, e, 1);
|
|
912
|
+
}
|
|
913
|
+
static addColumns(t, e) {
|
|
914
|
+
t.addFieldOffset(2, e, 0);
|
|
915
|
+
}
|
|
916
|
+
static createColumnsVector(t, e) {
|
|
917
|
+
t.startVector(4, e.length, 4);
|
|
918
|
+
for (let r = e.length - 1; r >= 0; r--) t.addOffset(e[r]);
|
|
919
|
+
return t.endVector();
|
|
920
|
+
}
|
|
921
|
+
static startColumnsVector(t, e) {
|
|
922
|
+
t.startVector(4, e, 4);
|
|
923
|
+
}
|
|
924
|
+
static endFeature(t) {
|
|
925
|
+
return t.endObject();
|
|
926
|
+
}
|
|
927
|
+
static finishFeatureBuffer(t, e) {
|
|
928
|
+
t.finish(e);
|
|
929
|
+
}
|
|
930
|
+
static finishSizePrefixedFeatureBuffer(t, e) {
|
|
931
|
+
t.finish(e, void 0, !0);
|
|
932
|
+
}
|
|
933
|
+
static createFeature(t, e, r, i) {
|
|
934
|
+
return x.startFeature(t), x.addGeometry(t, e), x.addProperties(t, r), x.addColumns(t, i), x.endFeature(t);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
function Tt(n, t) {
|
|
938
|
+
let e, r, i, { xy: s, z: a, m: l, ends: u, parts: o, type: f } = t;
|
|
939
|
+
if (o) {
|
|
940
|
+
let h = o.map((b) => Tt(n, b)), d = w.createPartsVector(n, h);
|
|
941
|
+
return w.startGeometry(n), w.addParts(n, d), w.addType(n, f), w.endGeometry(n);
|
|
942
|
+
}
|
|
943
|
+
let c = w.createXyVector(n, s);
|
|
944
|
+
return a && (e = w.createZVector(n, a)), l && (r = w.createMVector(n, l)), u && (i = w.createEndsVector(n, u)), w.startGeometry(n), i && w.addEnds(n, i), w.addXy(n, c), e && w.addZ(n, e), r && w.addM(n, r), w.addType(n, f), w.endGeometry(n);
|
|
945
|
+
}
|
|
946
|
+
function ft(n, t, e) {
|
|
947
|
+
if (n.length !== 0) if (Array.isArray(n[0])) for (let r of n) ft(r, t, e);
|
|
948
|
+
else n.length === 2 ? t.push(...n) : (t.push(n[0], n[1]), e.push(n[2]));
|
|
949
|
+
}
|
|
950
|
+
function lt(n, t) {
|
|
951
|
+
let e = [];
|
|
952
|
+
for (let r = 0; r < n.length; r += 2) {
|
|
953
|
+
let i = [n[r], n[r + 1]];
|
|
954
|
+
t && i.push(t[r >> 1]), e.push(i);
|
|
955
|
+
}
|
|
956
|
+
return e;
|
|
957
|
+
}
|
|
958
|
+
function J(n) {
|
|
959
|
+
return n ? I[n] : I.Unknown;
|
|
960
|
+
}
|
|
961
|
+
let Ut = new TextEncoder(), Pt = new TextDecoder();
|
|
962
|
+
function Rt(n, t, e) {
|
|
963
|
+
let r = e.columns, i = new tt(), s = 0, a = 1024, l = new Uint8Array(1024), u = new DataView(l.buffer), o = (d) => {
|
|
964
|
+
if (s + d < a) return;
|
|
965
|
+
let b = new Uint8Array(a = Math.max(a + d, 2 * a));
|
|
966
|
+
b.set(l), u = new DataView((l = b).buffer);
|
|
967
|
+
};
|
|
968
|
+
if (r) for (let d = 0; d < r.length; d++) {
|
|
969
|
+
let b = r[d], p = t[b.name];
|
|
970
|
+
if (p !== null) switch (o(2), u.setUint16(s, d, !0), s += 2, b.type) {
|
|
971
|
+
case y.Bool:
|
|
972
|
+
o(1), u.setUint8(s, p), s += 1;
|
|
973
|
+
break;
|
|
974
|
+
case y.Short:
|
|
975
|
+
o(2), u.setInt16(s, p, !0), s += 2;
|
|
976
|
+
break;
|
|
977
|
+
case y.UShort:
|
|
978
|
+
o(2), u.setUint16(s, p, !0), s += 2;
|
|
979
|
+
break;
|
|
980
|
+
case y.Int:
|
|
981
|
+
o(4), u.setInt32(s, p, !0), s += 4;
|
|
982
|
+
break;
|
|
983
|
+
case y.UInt:
|
|
984
|
+
o(4), u.setUint32(s, p, !0), s += 4;
|
|
985
|
+
break;
|
|
986
|
+
case y.Long:
|
|
987
|
+
o(8), u.setBigInt64(s, BigInt(p), !0), s += 8;
|
|
988
|
+
break;
|
|
989
|
+
case y.Float:
|
|
990
|
+
o(4), u.setFloat32(s, p, !0), s += 4;
|
|
991
|
+
break;
|
|
992
|
+
case y.Double:
|
|
993
|
+
o(8), u.setFloat64(s, p, !0), s += 8;
|
|
994
|
+
break;
|
|
995
|
+
case y.DateTime:
|
|
996
|
+
case y.String: {
|
|
997
|
+
let m = Ut.encode(p);
|
|
998
|
+
o(4), u.setUint32(s, m.length, !0), s += 4, o(m.length), l.set(m, s), s += m.length;
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
case y.Json: {
|
|
1002
|
+
let m = Ut.encode(JSON.stringify(p));
|
|
1003
|
+
o(4), u.setUint32(s, m.length, !0), s += 4, o(m.length), l.set(m, s), s += m.length;
|
|
1004
|
+
break;
|
|
1005
|
+
}
|
|
1006
|
+
case y.Binary:
|
|
1007
|
+
o(4), u.setUint32(s, p.length, !0), s += 4, o(p.length), l.set(p, s), s += p.length;
|
|
1008
|
+
break;
|
|
1009
|
+
default:
|
|
1010
|
+
throw Error(`Unknown type ${b.type}`);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
let f = 0;
|
|
1014
|
+
s > 0 && (f = x.createPropertiesVector(i, l.slice(0, s)));
|
|
1015
|
+
let c = Tt(i, n);
|
|
1016
|
+
x.startFeature(i), x.addGeometry(i, c), f && x.addProperties(i, f);
|
|
1017
|
+
let h = x.endFeature(i);
|
|
1018
|
+
return i.finishSizePrefixed(h), i.asUint8Array();
|
|
1019
|
+
}
|
|
1020
|
+
function zt(n, t) {
|
|
1021
|
+
let e = {};
|
|
1022
|
+
if (!t || t.length === 0) return e;
|
|
1023
|
+
let r = n.propertiesArray();
|
|
1024
|
+
if (!r) return e;
|
|
1025
|
+
let i = new DataView(r.buffer, r.byteOffset), s = n.propertiesLength(), a = 0;
|
|
1026
|
+
for (; a < s; ) {
|
|
1027
|
+
let l = i.getUint16(a, !0);
|
|
1028
|
+
a += 2;
|
|
1029
|
+
let u = t[l], o = u.name;
|
|
1030
|
+
switch (u.type) {
|
|
1031
|
+
case y.Bool:
|
|
1032
|
+
e[o] = !!i.getUint8(a), a += 1;
|
|
1033
|
+
break;
|
|
1034
|
+
case y.Byte:
|
|
1035
|
+
e[o] = i.getInt8(a), a += 1;
|
|
1036
|
+
break;
|
|
1037
|
+
case y.UByte:
|
|
1038
|
+
e[o] = i.getUint8(a), a += 1;
|
|
1039
|
+
break;
|
|
1040
|
+
case y.Short:
|
|
1041
|
+
e[o] = i.getInt16(a, !0), a += 2;
|
|
1042
|
+
break;
|
|
1043
|
+
case y.UShort:
|
|
1044
|
+
e[o] = i.getUint16(a, !0), a += 2;
|
|
1045
|
+
break;
|
|
1046
|
+
case y.Int:
|
|
1047
|
+
e[o] = i.getInt32(a, !0), a += 4;
|
|
1048
|
+
break;
|
|
1049
|
+
case y.UInt:
|
|
1050
|
+
e[o] = i.getUint32(a, !0), a += 4;
|
|
1051
|
+
break;
|
|
1052
|
+
case y.Long:
|
|
1053
|
+
e[o] = Number(i.getBigInt64(a, !0)), a += 8;
|
|
1054
|
+
break;
|
|
1055
|
+
case y.ULong:
|
|
1056
|
+
e[o] = Number(i.getBigUint64(a, !0)), a += 8;
|
|
1057
|
+
break;
|
|
1058
|
+
case y.Float:
|
|
1059
|
+
e[o] = i.getFloat32(a, !0), a += 4;
|
|
1060
|
+
break;
|
|
1061
|
+
case y.Double:
|
|
1062
|
+
e[o] = i.getFloat64(a, !0), a += 8;
|
|
1063
|
+
break;
|
|
1064
|
+
case y.DateTime:
|
|
1065
|
+
case y.String: {
|
|
1066
|
+
let f = i.getUint32(a, !0);
|
|
1067
|
+
a += 4, e[o] = Pt.decode(r.subarray(a, a + f)), a += f;
|
|
1068
|
+
break;
|
|
1069
|
+
}
|
|
1070
|
+
case y.Json: {
|
|
1071
|
+
let f = i.getUint32(a, !0);
|
|
1072
|
+
a += 4;
|
|
1073
|
+
let c = Pt.decode(r.subarray(a, a + f));
|
|
1074
|
+
e[o] = JSON.parse(c), a += f;
|
|
1075
|
+
break;
|
|
1076
|
+
}
|
|
1077
|
+
case y.Binary: {
|
|
1078
|
+
let f = i.getUint32(a, !0);
|
|
1079
|
+
a += 4, e[o] = r.subarray(a, a + f), a += f;
|
|
1080
|
+
break;
|
|
1081
|
+
}
|
|
1082
|
+
default:
|
|
1083
|
+
throw Error(`Unknown type ${u.type}`);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
return e;
|
|
1087
|
+
}
|
|
1088
|
+
const _t = new Uint8Array(0);
|
|
1089
|
+
function Mt() {
|
|
1090
|
+
return this._source.cancel();
|
|
1091
|
+
}
|
|
1092
|
+
function jt(n, t) {
|
|
1093
|
+
if (!n.length) return t;
|
|
1094
|
+
if (!t.length) return n;
|
|
1095
|
+
var e = new Uint8Array(n.length + t.length);
|
|
1096
|
+
return e.set(n), e.set(t, n.length), e;
|
|
1097
|
+
}
|
|
1098
|
+
function qt() {
|
|
1099
|
+
var n = this, t = n._array.subarray(n._index);
|
|
1100
|
+
return n._source.read().then(function(e) {
|
|
1101
|
+
return n._array = _t, n._index = 0, e.done ? t.length > 0 ? { done: !1, value: t } : { done: !0, value: void 0 } : { done: !1, value: jt(t, e.value) };
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
function Dt(n) {
|
|
1105
|
+
if ((n |= 0) < 0) throw new Error("invalid length");
|
|
1106
|
+
var t = this, e = this._array.length - this._index;
|
|
1107
|
+
if (this._index + n <= this._array.length)
|
|
1108
|
+
return Promise.resolve(this._array.subarray(this._index, this._index += n));
|
|
1109
|
+
var r = new Uint8Array(n);
|
|
1110
|
+
return r.set(this._array.subarray(this._index)), (function i() {
|
|
1111
|
+
return t._source.read().then(function(s) {
|
|
1112
|
+
return s.done ? (t._array = _t, t._index = 0, e > 0 ? r.subarray(0, e) : null) : e + s.value.length >= n ? (t._array = s.value, t._index = n - e, r.set(s.value.subarray(0, n - e), e), r) : (r.set(s.value, e), e += s.value.length, i());
|
|
1113
|
+
});
|
|
1114
|
+
})();
|
|
1115
|
+
}
|
|
1116
|
+
function Gt(n) {
|
|
1117
|
+
return typeof n.slice == "function" ? n : new et(typeof n.read == "function" ? n : n.getReader());
|
|
1118
|
+
}
|
|
1119
|
+
function et(n) {
|
|
1120
|
+
this._source = n, this._array = _t, this._index = 0;
|
|
1121
|
+
}
|
|
1122
|
+
et.prototype.read = qt;
|
|
1123
|
+
et.prototype.slice = Dt;
|
|
1124
|
+
et.prototype.cancel = Mt;
|
|
1125
|
+
class P {
|
|
1126
|
+
bb = null;
|
|
1127
|
+
bb_pos = 0;
|
|
1128
|
+
__init(t, e) {
|
|
1129
|
+
return this.bb_pos = t, this.bb = e, this;
|
|
1130
|
+
}
|
|
1131
|
+
static getRootAsCrs(t, e) {
|
|
1132
|
+
return (e || new P()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
1133
|
+
}
|
|
1134
|
+
static getSizePrefixedRootAsCrs(t, e) {
|
|
1135
|
+
return t.setPosition(t.position() + q), (e || new P()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
1136
|
+
}
|
|
1137
|
+
org(t) {
|
|
1138
|
+
let e = this.bb.__offset(this.bb_pos, 4);
|
|
1139
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1140
|
+
}
|
|
1141
|
+
code() {
|
|
1142
|
+
let t = this.bb.__offset(this.bb_pos, 6);
|
|
1143
|
+
return t ? this.bb.readInt32(this.bb_pos + t) : 0;
|
|
1144
|
+
}
|
|
1145
|
+
name(t) {
|
|
1146
|
+
let e = this.bb.__offset(this.bb_pos, 8);
|
|
1147
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1148
|
+
}
|
|
1149
|
+
description(t) {
|
|
1150
|
+
let e = this.bb.__offset(this.bb_pos, 10);
|
|
1151
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1152
|
+
}
|
|
1153
|
+
wkt(t) {
|
|
1154
|
+
let e = this.bb.__offset(this.bb_pos, 12);
|
|
1155
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1156
|
+
}
|
|
1157
|
+
codeString(t) {
|
|
1158
|
+
let e = this.bb.__offset(this.bb_pos, 14);
|
|
1159
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1160
|
+
}
|
|
1161
|
+
static startCrs(t) {
|
|
1162
|
+
t.startObject(6);
|
|
1163
|
+
}
|
|
1164
|
+
static addOrg(t, e) {
|
|
1165
|
+
t.addFieldOffset(0, e, 0);
|
|
1166
|
+
}
|
|
1167
|
+
static addCode(t, e) {
|
|
1168
|
+
t.addFieldInt32(1, e, 0);
|
|
1169
|
+
}
|
|
1170
|
+
static addName(t, e) {
|
|
1171
|
+
t.addFieldOffset(2, e, 0);
|
|
1172
|
+
}
|
|
1173
|
+
static addDescription(t, e) {
|
|
1174
|
+
t.addFieldOffset(3, e, 0);
|
|
1175
|
+
}
|
|
1176
|
+
static addWkt(t, e) {
|
|
1177
|
+
t.addFieldOffset(4, e, 0);
|
|
1178
|
+
}
|
|
1179
|
+
static addCodeString(t, e) {
|
|
1180
|
+
t.addFieldOffset(5, e, 0);
|
|
1181
|
+
}
|
|
1182
|
+
static endCrs(t) {
|
|
1183
|
+
return t.endObject();
|
|
1184
|
+
}
|
|
1185
|
+
static createCrs(t, e, r, i, s, a, l) {
|
|
1186
|
+
return P.startCrs(t), P.addOrg(t, e), P.addCode(t, r), P.addName(t, i), P.addDescription(t, s), P.addWkt(t, a), P.addCodeString(t, l), P.endCrs(t);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
class O {
|
|
1190
|
+
bb = null;
|
|
1191
|
+
bb_pos = 0;
|
|
1192
|
+
__init(t, e) {
|
|
1193
|
+
return this.bb_pos = t, this.bb = e, this;
|
|
1194
|
+
}
|
|
1195
|
+
static getRootAsHeader(t, e) {
|
|
1196
|
+
return (e || new O()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
1197
|
+
}
|
|
1198
|
+
static getSizePrefixedRootAsHeader(t, e) {
|
|
1199
|
+
return t.setPosition(t.position() + q), (e || new O()).__init(t.readInt32(t.position()) + t.position(), t);
|
|
1200
|
+
}
|
|
1201
|
+
name(t) {
|
|
1202
|
+
let e = this.bb.__offset(this.bb_pos, 4);
|
|
1203
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1204
|
+
}
|
|
1205
|
+
envelope(t) {
|
|
1206
|
+
let e = this.bb.__offset(this.bb_pos, 6);
|
|
1207
|
+
return e ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + e) + 8 * t) : 0;
|
|
1208
|
+
}
|
|
1209
|
+
envelopeLength() {
|
|
1210
|
+
let t = this.bb.__offset(this.bb_pos, 6);
|
|
1211
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
1212
|
+
}
|
|
1213
|
+
envelopeArray() {
|
|
1214
|
+
let t = this.bb.__offset(this.bb_pos, 6);
|
|
1215
|
+
return t ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + t), this.bb.__vector_len(this.bb_pos + t)) : null;
|
|
1216
|
+
}
|
|
1217
|
+
geometryType() {
|
|
1218
|
+
let t = this.bb.__offset(this.bb_pos, 8);
|
|
1219
|
+
return t ? this.bb.readUint8(this.bb_pos + t) : I.Unknown;
|
|
1220
|
+
}
|
|
1221
|
+
hasZ() {
|
|
1222
|
+
let t = this.bb.__offset(this.bb_pos, 10);
|
|
1223
|
+
return !!t && !!this.bb.readInt8(this.bb_pos + t);
|
|
1224
|
+
}
|
|
1225
|
+
hasM() {
|
|
1226
|
+
let t = this.bb.__offset(this.bb_pos, 12);
|
|
1227
|
+
return !!t && !!this.bb.readInt8(this.bb_pos + t);
|
|
1228
|
+
}
|
|
1229
|
+
hasT() {
|
|
1230
|
+
let t = this.bb.__offset(this.bb_pos, 14);
|
|
1231
|
+
return !!t && !!this.bb.readInt8(this.bb_pos + t);
|
|
1232
|
+
}
|
|
1233
|
+
hasTm() {
|
|
1234
|
+
let t = this.bb.__offset(this.bb_pos, 16);
|
|
1235
|
+
return !!t && !!this.bb.readInt8(this.bb_pos + t);
|
|
1236
|
+
}
|
|
1237
|
+
columns(t, e) {
|
|
1238
|
+
let r = this.bb.__offset(this.bb_pos, 18);
|
|
1239
|
+
return r ? (e || new v()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + r) + 4 * t), this.bb) : null;
|
|
1240
|
+
}
|
|
1241
|
+
columnsLength() {
|
|
1242
|
+
let t = this.bb.__offset(this.bb_pos, 18);
|
|
1243
|
+
return t ? this.bb.__vector_len(this.bb_pos + t) : 0;
|
|
1244
|
+
}
|
|
1245
|
+
featuresCount() {
|
|
1246
|
+
let t = this.bb.__offset(this.bb_pos, 20);
|
|
1247
|
+
return t ? this.bb.readUint64(this.bb_pos + t) : BigInt("0");
|
|
1248
|
+
}
|
|
1249
|
+
indexNodeSize() {
|
|
1250
|
+
let t = this.bb.__offset(this.bb_pos, 22);
|
|
1251
|
+
return t ? this.bb.readUint16(this.bb_pos + t) : 16;
|
|
1252
|
+
}
|
|
1253
|
+
crs(t) {
|
|
1254
|
+
let e = this.bb.__offset(this.bb_pos, 24);
|
|
1255
|
+
return e ? (t || new P()).__init(this.bb.__indirect(this.bb_pos + e), this.bb) : null;
|
|
1256
|
+
}
|
|
1257
|
+
title(t) {
|
|
1258
|
+
let e = this.bb.__offset(this.bb_pos, 26);
|
|
1259
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1260
|
+
}
|
|
1261
|
+
description(t) {
|
|
1262
|
+
let e = this.bb.__offset(this.bb_pos, 28);
|
|
1263
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1264
|
+
}
|
|
1265
|
+
metadata(t) {
|
|
1266
|
+
let e = this.bb.__offset(this.bb_pos, 30);
|
|
1267
|
+
return e ? this.bb.__string(this.bb_pos + e, t) : null;
|
|
1268
|
+
}
|
|
1269
|
+
static startHeader(t) {
|
|
1270
|
+
t.startObject(14);
|
|
1271
|
+
}
|
|
1272
|
+
static addName(t, e) {
|
|
1273
|
+
t.addFieldOffset(0, e, 0);
|
|
1274
|
+
}
|
|
1275
|
+
static addEnvelope(t, e) {
|
|
1276
|
+
t.addFieldOffset(1, e, 0);
|
|
1277
|
+
}
|
|
1278
|
+
static createEnvelopeVector(t, e) {
|
|
1279
|
+
t.startVector(8, e.length, 8);
|
|
1280
|
+
for (let r = e.length - 1; r >= 0; r--) t.addFloat64(e[r]);
|
|
1281
|
+
return t.endVector();
|
|
1282
|
+
}
|
|
1283
|
+
static startEnvelopeVector(t, e) {
|
|
1284
|
+
t.startVector(8, e, 8);
|
|
1285
|
+
}
|
|
1286
|
+
static addGeometryType(t, e) {
|
|
1287
|
+
t.addFieldInt8(2, e, I.Unknown);
|
|
1288
|
+
}
|
|
1289
|
+
static addHasZ(t, e) {
|
|
1290
|
+
t.addFieldInt8(3, +e, 0);
|
|
1291
|
+
}
|
|
1292
|
+
static addHasM(t, e) {
|
|
1293
|
+
t.addFieldInt8(4, +e, 0);
|
|
1294
|
+
}
|
|
1295
|
+
static addHasT(t, e) {
|
|
1296
|
+
t.addFieldInt8(5, +e, 0);
|
|
1297
|
+
}
|
|
1298
|
+
static addHasTm(t, e) {
|
|
1299
|
+
t.addFieldInt8(6, +e, 0);
|
|
1300
|
+
}
|
|
1301
|
+
static addColumns(t, e) {
|
|
1302
|
+
t.addFieldOffset(7, e, 0);
|
|
1303
|
+
}
|
|
1304
|
+
static createColumnsVector(t, e) {
|
|
1305
|
+
t.startVector(4, e.length, 4);
|
|
1306
|
+
for (let r = e.length - 1; r >= 0; r--) t.addOffset(e[r]);
|
|
1307
|
+
return t.endVector();
|
|
1308
|
+
}
|
|
1309
|
+
static startColumnsVector(t, e) {
|
|
1310
|
+
t.startVector(4, e, 4);
|
|
1311
|
+
}
|
|
1312
|
+
static addFeaturesCount(t, e) {
|
|
1313
|
+
t.addFieldInt64(8, e, BigInt("0"));
|
|
1314
|
+
}
|
|
1315
|
+
static addIndexNodeSize(t, e) {
|
|
1316
|
+
t.addFieldInt16(9, e, 16);
|
|
1317
|
+
}
|
|
1318
|
+
static addCrs(t, e) {
|
|
1319
|
+
t.addFieldOffset(10, e, 0);
|
|
1320
|
+
}
|
|
1321
|
+
static addTitle(t, e) {
|
|
1322
|
+
t.addFieldOffset(11, e, 0);
|
|
1323
|
+
}
|
|
1324
|
+
static addDescription(t, e) {
|
|
1325
|
+
t.addFieldOffset(12, e, 0);
|
|
1326
|
+
}
|
|
1327
|
+
static addMetadata(t, e) {
|
|
1328
|
+
t.addFieldOffset(13, e, 0);
|
|
1329
|
+
}
|
|
1330
|
+
static endHeader(t) {
|
|
1331
|
+
return t.endObject();
|
|
1332
|
+
}
|
|
1333
|
+
static finishHeaderBuffer(t, e) {
|
|
1334
|
+
t.finish(e);
|
|
1335
|
+
}
|
|
1336
|
+
static finishSizePrefixedHeaderBuffer(t, e) {
|
|
1337
|
+
t.finish(e, void 0, !0);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
function rt(n) {
|
|
1341
|
+
let t = O.getSizePrefixedRootAsHeader(n), e = t.featuresCount(), r = t.indexNodeSize(), i = [];
|
|
1342
|
+
for (let l = 0; l < t.columnsLength(); l++) {
|
|
1343
|
+
let u = t.columns(l);
|
|
1344
|
+
if (!u) throw Error("Column unexpectedly missing");
|
|
1345
|
+
if (!u.name()) throw Error("Column name unexpectedly missing");
|
|
1346
|
+
i.push({ name: u.name(), type: u.type(), title: u.title(), description: u.description(), width: u.width(), precision: u.precision(), scale: u.scale(), nullable: u.nullable(), unique: u.unique(), primary_key: u.primaryKey() });
|
|
1347
|
+
}
|
|
1348
|
+
let s = t.crs(), a = s ? { org: s.org(), code: s.code(), name: s.name(), description: s.description(), wkt: s.wkt(), code_string: s.codeString() } : null;
|
|
1349
|
+
return { geometryType: t.geometryType(), columns: i, envelope: t.envelopeLength() > 0 ? t.envelopeArray() : null, featuresCount: Number(e), indexNodeSize: r, crs: a, title: t.title(), description: t.description(), metadata: t.metadata() };
|
|
1350
|
+
}
|
|
1351
|
+
class nt {
|
|
1352
|
+
static global = new nt();
|
|
1353
|
+
_extraRequestThreshold = 262144;
|
|
1354
|
+
extraRequestThreshold() {
|
|
1355
|
+
return this._extraRequestThreshold;
|
|
1356
|
+
}
|
|
1357
|
+
setExtraRequestThreshold(t) {
|
|
1358
|
+
if (t < 0) throw Error("extraRequestThreshold cannot be negative");
|
|
1359
|
+
this._extraRequestThreshold = t;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
const Ht = 40, $t = 16;
|
|
1363
|
+
function it(n, t) {
|
|
1364
|
+
t = Math.min(Math.max(+t, 2), 65535);
|
|
1365
|
+
let e = n, r = e;
|
|
1366
|
+
do
|
|
1367
|
+
r += e = Math.ceil(e / t);
|
|
1368
|
+
while (e !== 1);
|
|
1369
|
+
return 40 * r;
|
|
1370
|
+
}
|
|
1371
|
+
function Zt(n, t) {
|
|
1372
|
+
if (t < 2) throw Error("Node size must be at least 2");
|
|
1373
|
+
if (n === 0) throw Error("Number of items must be greater than 0");
|
|
1374
|
+
let e = n, r = e, i = [e];
|
|
1375
|
+
do
|
|
1376
|
+
r += e = Math.ceil(e / t), i.push(e);
|
|
1377
|
+
while (e !== 1);
|
|
1378
|
+
let s = [];
|
|
1379
|
+
for (let l of (e = r, i)) s.push(e - l), e -= l;
|
|
1380
|
+
let a = [];
|
|
1381
|
+
for (let l = 0; l < i.length; l++) a.push([s[l], s[l] + i[l]]);
|
|
1382
|
+
return a;
|
|
1383
|
+
}
|
|
1384
|
+
async function* Vt(n, t, e, r) {
|
|
1385
|
+
class i {
|
|
1386
|
+
_level;
|
|
1387
|
+
nodes;
|
|
1388
|
+
constructor(d, b) {
|
|
1389
|
+
this._level = b, this.nodes = d;
|
|
1390
|
+
}
|
|
1391
|
+
level() {
|
|
1392
|
+
return this._level;
|
|
1393
|
+
}
|
|
1394
|
+
startNodeIdx() {
|
|
1395
|
+
return this.nodes[0];
|
|
1396
|
+
}
|
|
1397
|
+
endNodeIdx() {
|
|
1398
|
+
return this.nodes[1];
|
|
1399
|
+
}
|
|
1400
|
+
extendEndNodeIdx(d) {
|
|
1401
|
+
this.nodes[1] = d;
|
|
1402
|
+
}
|
|
1403
|
+
toString() {
|
|
1404
|
+
return `[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
let { minX: s, minY: a, maxX: l, maxY: u } = e, o = Zt(n, t), f = o[0][0], c = [new i([0, 1], o.length - 1)];
|
|
1408
|
+
for (; c.length !== 0; ) {
|
|
1409
|
+
let h = c.shift(), d = h.startNodeIdx(), b = d >= f, p = (() => {
|
|
1410
|
+
let [, S] = o[h.level()], U = Math.min(h.endNodeIdx() + t, S);
|
|
1411
|
+
return b && U < S ? U + 1 : U;
|
|
1412
|
+
})(), m = p - d, E = new DataView(await r(40 * d, 40 * m));
|
|
1413
|
+
for (let S = d; S < p; S++) {
|
|
1414
|
+
let U = S - d, G = 40 * U;
|
|
1415
|
+
if (l < E.getFloat64(G + 0, !0) || u < E.getFloat64(G + 8, !0) || s > E.getFloat64(G + 16, !0) || a > E.getFloat64(G + 24, !0)) continue;
|
|
1416
|
+
let R = E.getBigUint64(G + 32, !0);
|
|
1417
|
+
if (b) {
|
|
1418
|
+
let at = (() => {
|
|
1419
|
+
if (S < n - 1) {
|
|
1420
|
+
let Lt = (U + 1) * 40;
|
|
1421
|
+
return E.getBigUint64(Lt + 32, !0) - R;
|
|
1422
|
+
}
|
|
1423
|
+
return null;
|
|
1424
|
+
})(), kt = S - f;
|
|
1425
|
+
yield [Number(R), kt, Number(at)];
|
|
1426
|
+
continue;
|
|
1427
|
+
}
|
|
1428
|
+
let Ct = nt.global.extraRequestThreshold() / 40, z = c[c.length - 1];
|
|
1429
|
+
if (z !== void 0 && z.level() === h.level() - 1 && R < z.endNodeIdx() + Ct) {
|
|
1430
|
+
z.extendEndNodeIdx(Number(R));
|
|
1431
|
+
continue;
|
|
1432
|
+
}
|
|
1433
|
+
let It = (() => {
|
|
1434
|
+
let at = h.level() - 1;
|
|
1435
|
+
return new i([Number(R), Number(R) + 1], at);
|
|
1436
|
+
})();
|
|
1437
|
+
z !== void 0 && (z.level(), It.level()), c.push(It);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
class yt {
|
|
1442
|
+
bytes;
|
|
1443
|
+
header;
|
|
1444
|
+
headerLength;
|
|
1445
|
+
indexLength;
|
|
1446
|
+
constructor(t, e, r, i) {
|
|
1447
|
+
this.bytes = t, this.header = e, this.headerLength = r, this.indexLength = i;
|
|
1448
|
+
}
|
|
1449
|
+
static open(t) {
|
|
1450
|
+
if (!t.subarray(0, 3).every((a, l) => F[l] === a)) throw Error("Not a FlatGeobuf file");
|
|
1451
|
+
let e = new DataView(t.buffer).getUint32(F.length, !0);
|
|
1452
|
+
if (e > 10485760 || e < 8) throw Error("Invalid header size");
|
|
1453
|
+
let r = t.subarray(F.length, F.length + V + e), i = rt(new B(r)), s = it(i.featuresCount, i.indexNodeSize);
|
|
1454
|
+
return new yt(t, i, e, s);
|
|
1455
|
+
}
|
|
1456
|
+
async *selectBbox(t) {
|
|
1457
|
+
let e = this.lengthBeforeTree(), r = async (i, s) => {
|
|
1458
|
+
let a = e + i;
|
|
1459
|
+
return this.bytes.slice(a, a + s).buffer;
|
|
1460
|
+
};
|
|
1461
|
+
for await (let i of Vt(this.header.featuresCount, this.header.indexNodeSize, t, r)) {
|
|
1462
|
+
let [s, a] = i, l = this.readFeature(s);
|
|
1463
|
+
yield { id: a, feature: l };
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
lengthBeforeTree() {
|
|
1467
|
+
return F.length + V + this.headerLength;
|
|
1468
|
+
}
|
|
1469
|
+
lengthBeforeFeatures() {
|
|
1470
|
+
return this.lengthBeforeTree() + this.indexLength;
|
|
1471
|
+
}
|
|
1472
|
+
readFeature(t) {
|
|
1473
|
+
let e = t + this.lengthBeforeFeatures(), r = new DataView(this.bytes.buffer).getUint32(e, !0), i = this.bytes.subarray(e + 4, e + 4 + r), s = new Uint8Array(r + V);
|
|
1474
|
+
s.set(i, V);
|
|
1475
|
+
let a = new B(s);
|
|
1476
|
+
return x.getSizePrefixedRootAsFeature(a);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
var ct = function(n, t) {
|
|
1480
|
+
return ct = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
1481
|
+
e.__proto__ = r;
|
|
1482
|
+
} || function(e, r) {
|
|
1483
|
+
for (var i in r) r.hasOwnProperty(i) && (e[i] = r[i]);
|
|
1484
|
+
}, ct(n, t);
|
|
1485
|
+
};
|
|
1486
|
+
function Xt(n, t) {
|
|
1487
|
+
ct(n, t);
|
|
1488
|
+
function e() {
|
|
1489
|
+
this.constructor = n;
|
|
1490
|
+
}
|
|
1491
|
+
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
1492
|
+
}
|
|
1493
|
+
function j(n, t, e, r) {
|
|
1494
|
+
function i(s) {
|
|
1495
|
+
return s instanceof e ? s : new e(function(a) {
|
|
1496
|
+
a(s);
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
return new (e || (e = Promise))(function(s, a) {
|
|
1500
|
+
function l(f) {
|
|
1501
|
+
try {
|
|
1502
|
+
o(r.next(f));
|
|
1503
|
+
} catch (c) {
|
|
1504
|
+
a(c);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
function u(f) {
|
|
1508
|
+
try {
|
|
1509
|
+
o(r.throw(f));
|
|
1510
|
+
} catch (c) {
|
|
1511
|
+
a(c);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
function o(f) {
|
|
1515
|
+
f.done ? s(f.value) : i(f.value).then(l, u);
|
|
1516
|
+
}
|
|
1517
|
+
o((r = r.apply(n, [])).next());
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
function C(n, t) {
|
|
1521
|
+
var e = { label: 0, sent: function() {
|
|
1522
|
+
if (s[0] & 1) throw s[1];
|
|
1523
|
+
return s[1];
|
|
1524
|
+
}, trys: [], ops: [] }, r, i, s, a;
|
|
1525
|
+
return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
1526
|
+
return this;
|
|
1527
|
+
}), a;
|
|
1528
|
+
function l(o) {
|
|
1529
|
+
return function(f) {
|
|
1530
|
+
return u([o, f]);
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
function u(o) {
|
|
1534
|
+
if (r) throw new TypeError("Generator is already executing.");
|
|
1535
|
+
for (; e; ) try {
|
|
1536
|
+
if (r = 1, i && (s = o[0] & 2 ? i.return : o[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, o[1])).done) return s;
|
|
1537
|
+
switch (i = 0, s && (o = [o[0] & 2, s.value]), o[0]) {
|
|
1538
|
+
case 0:
|
|
1539
|
+
case 1:
|
|
1540
|
+
s = o;
|
|
1541
|
+
break;
|
|
1542
|
+
case 4:
|
|
1543
|
+
return e.label++, { value: o[1], done: !1 };
|
|
1544
|
+
case 5:
|
|
1545
|
+
e.label++, i = o[1], o = [0];
|
|
1546
|
+
continue;
|
|
1547
|
+
case 7:
|
|
1548
|
+
o = e.ops.pop(), e.trys.pop();
|
|
1549
|
+
continue;
|
|
1550
|
+
default:
|
|
1551
|
+
if (s = e.trys, !(s = s.length > 0 && s[s.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
1552
|
+
e = 0;
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
if (o[0] === 3 && (!s || o[1] > s[0] && o[1] < s[3])) {
|
|
1556
|
+
e.label = o[1];
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
if (o[0] === 6 && e.label < s[1]) {
|
|
1560
|
+
e.label = s[1], s = o;
|
|
1561
|
+
break;
|
|
1562
|
+
}
|
|
1563
|
+
if (s && e.label < s[2]) {
|
|
1564
|
+
e.label = s[2], e.ops.push(o);
|
|
1565
|
+
break;
|
|
1566
|
+
}
|
|
1567
|
+
s[2] && e.ops.pop(), e.trys.pop();
|
|
1568
|
+
continue;
|
|
1569
|
+
}
|
|
1570
|
+
o = t.call(n, e);
|
|
1571
|
+
} catch (f) {
|
|
1572
|
+
o = [6, f], i = 0;
|
|
1573
|
+
} finally {
|
|
1574
|
+
r = s = 0;
|
|
1575
|
+
}
|
|
1576
|
+
if (o[0] & 5) throw o[1];
|
|
1577
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
function D(n) {
|
|
1581
|
+
var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
|
|
1582
|
+
if (e) return e.call(n);
|
|
1583
|
+
if (n && typeof n.length == "number") return {
|
|
1584
|
+
next: function() {
|
|
1585
|
+
return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
|
|
1586
|
+
}
|
|
1587
|
+
};
|
|
1588
|
+
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1589
|
+
}
|
|
1590
|
+
function $(n) {
|
|
1591
|
+
return this instanceof $ ? (this.v = n, this) : new $(n);
|
|
1592
|
+
}
|
|
1593
|
+
function Wt(n, t, e) {
|
|
1594
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1595
|
+
var r = e.apply(n, t || []), i, s = [];
|
|
1596
|
+
return i = {}, a("next"), a("throw"), a("return"), i[Symbol.asyncIterator] = function() {
|
|
1597
|
+
return this;
|
|
1598
|
+
}, i;
|
|
1599
|
+
function a(h) {
|
|
1600
|
+
r[h] && (i[h] = function(d) {
|
|
1601
|
+
return new Promise(function(b, p) {
|
|
1602
|
+
s.push([h, d, b, p]) > 1 || l(h, d);
|
|
1603
|
+
});
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
function l(h, d) {
|
|
1607
|
+
try {
|
|
1608
|
+
u(r[h](d));
|
|
1609
|
+
} catch (b) {
|
|
1610
|
+
c(s[0][3], b);
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
function u(h) {
|
|
1614
|
+
h.value instanceof $ ? Promise.resolve(h.value.v).then(o, f) : c(s[0][2], h);
|
|
1615
|
+
}
|
|
1616
|
+
function o(h) {
|
|
1617
|
+
l("next", h);
|
|
1618
|
+
}
|
|
1619
|
+
function f(h) {
|
|
1620
|
+
l("throw", h);
|
|
1621
|
+
}
|
|
1622
|
+
function c(h, d) {
|
|
1623
|
+
h(d), s.shift(), s.length && l(s[0][0], s[0][1]);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
var Nt = (
|
|
1627
|
+
/** @class */
|
|
1628
|
+
(function(n) {
|
|
1629
|
+
Xt(t, n);
|
|
1630
|
+
function t(e) {
|
|
1631
|
+
var r = n.call(this, e) || this;
|
|
1632
|
+
return Object.defineProperty(r, "name", {
|
|
1633
|
+
value: "RepeaterOverflowError",
|
|
1634
|
+
enumerable: !1
|
|
1635
|
+
}), typeof Object.setPrototypeOf == "function" ? Object.setPrototypeOf(r, r.constructor.prototype) : r.__proto__ = r.constructor.prototype, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(r, r.constructor), r;
|
|
1636
|
+
}
|
|
1637
|
+
return t;
|
|
1638
|
+
})(Error)
|
|
1639
|
+
);
|
|
1640
|
+
(function() {
|
|
1641
|
+
function n(t) {
|
|
1642
|
+
if (t < 0)
|
|
1643
|
+
throw new RangeError("Capacity may not be less than 0");
|
|
1644
|
+
this._c = t, this._q = [];
|
|
1645
|
+
}
|
|
1646
|
+
return Object.defineProperty(n.prototype, "empty", {
|
|
1647
|
+
get: function() {
|
|
1648
|
+
return this._q.length === 0;
|
|
1649
|
+
},
|
|
1650
|
+
enumerable: !1,
|
|
1651
|
+
configurable: !0
|
|
1652
|
+
}), Object.defineProperty(n.prototype, "full", {
|
|
1653
|
+
get: function() {
|
|
1654
|
+
return this._q.length >= this._c;
|
|
1655
|
+
},
|
|
1656
|
+
enumerable: !1,
|
|
1657
|
+
configurable: !0
|
|
1658
|
+
}), n.prototype.add = function(t) {
|
|
1659
|
+
if (this.full)
|
|
1660
|
+
throw new Error("Buffer full");
|
|
1661
|
+
this._q.push(t);
|
|
1662
|
+
}, n.prototype.remove = function() {
|
|
1663
|
+
if (this.empty)
|
|
1664
|
+
throw new Error("Buffer empty");
|
|
1665
|
+
return this._q.shift();
|
|
1666
|
+
}, n;
|
|
1667
|
+
})();
|
|
1668
|
+
(function() {
|
|
1669
|
+
function n(t) {
|
|
1670
|
+
if (t < 1)
|
|
1671
|
+
throw new RangeError("Capacity may not be less than 1");
|
|
1672
|
+
this._c = t, this._q = [];
|
|
1673
|
+
}
|
|
1674
|
+
return Object.defineProperty(n.prototype, "empty", {
|
|
1675
|
+
get: function() {
|
|
1676
|
+
return this._q.length === 0;
|
|
1677
|
+
},
|
|
1678
|
+
enumerable: !1,
|
|
1679
|
+
configurable: !0
|
|
1680
|
+
}), Object.defineProperty(n.prototype, "full", {
|
|
1681
|
+
get: function() {
|
|
1682
|
+
return !1;
|
|
1683
|
+
},
|
|
1684
|
+
enumerable: !1,
|
|
1685
|
+
configurable: !0
|
|
1686
|
+
}), n.prototype.add = function(t) {
|
|
1687
|
+
for (; this._q.length >= this._c; )
|
|
1688
|
+
this._q.shift();
|
|
1689
|
+
this._q.push(t);
|
|
1690
|
+
}, n.prototype.remove = function() {
|
|
1691
|
+
if (this.empty)
|
|
1692
|
+
throw new Error("Buffer empty");
|
|
1693
|
+
return this._q.shift();
|
|
1694
|
+
}, n;
|
|
1695
|
+
})();
|
|
1696
|
+
(function() {
|
|
1697
|
+
function n(t) {
|
|
1698
|
+
if (t < 1)
|
|
1699
|
+
throw new RangeError("Capacity may not be less than 1");
|
|
1700
|
+
this._c = t, this._q = [];
|
|
1701
|
+
}
|
|
1702
|
+
return Object.defineProperty(n.prototype, "empty", {
|
|
1703
|
+
get: function() {
|
|
1704
|
+
return this._q.length === 0;
|
|
1705
|
+
},
|
|
1706
|
+
enumerable: !1,
|
|
1707
|
+
configurable: !0
|
|
1708
|
+
}), Object.defineProperty(n.prototype, "full", {
|
|
1709
|
+
get: function() {
|
|
1710
|
+
return !1;
|
|
1711
|
+
},
|
|
1712
|
+
enumerable: !1,
|
|
1713
|
+
configurable: !0
|
|
1714
|
+
}), n.prototype.add = function(t) {
|
|
1715
|
+
this._q.length < this._c && this._q.push(t);
|
|
1716
|
+
}, n.prototype.remove = function() {
|
|
1717
|
+
if (this.empty)
|
|
1718
|
+
throw new Error("Buffer empty");
|
|
1719
|
+
return this._q.shift();
|
|
1720
|
+
}, n;
|
|
1721
|
+
})();
|
|
1722
|
+
function dt(n) {
|
|
1723
|
+
n != null && typeof n.then == "function" && n.then(Q, Q);
|
|
1724
|
+
}
|
|
1725
|
+
var ut = 0, St = 1, L = 2, Y = 3, bt = 4, K = 1024, Q = function() {
|
|
1726
|
+
};
|
|
1727
|
+
function M(n) {
|
|
1728
|
+
var t = n.err, e = Promise.resolve(n.execution).then(function(r) {
|
|
1729
|
+
if (t != null)
|
|
1730
|
+
throw t;
|
|
1731
|
+
return r;
|
|
1732
|
+
});
|
|
1733
|
+
return n.err = void 0, n.execution = e.then(function() {
|
|
1734
|
+
}, function() {
|
|
1735
|
+
}), n.pending === void 0 ? e : n.pending.then(function() {
|
|
1736
|
+
return e;
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
function k(n, t) {
|
|
1740
|
+
var e = n.state >= Y;
|
|
1741
|
+
return Promise.resolve(t).then(function(r) {
|
|
1742
|
+
return !e && n.state >= bt ? M(n).then(function(i) {
|
|
1743
|
+
return {
|
|
1744
|
+
value: i,
|
|
1745
|
+
done: !0
|
|
1746
|
+
};
|
|
1747
|
+
}) : { value: r, done: e };
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
function gt(n, t) {
|
|
1751
|
+
var e, r;
|
|
1752
|
+
if (!(n.state >= L))
|
|
1753
|
+
if (n.state = L, n.onnext(), n.onstop(), n.err == null && (n.err = t), n.pushes.length === 0 && (typeof n.buffer > "u" || n.buffer.empty))
|
|
1754
|
+
H(n);
|
|
1755
|
+
else
|
|
1756
|
+
try {
|
|
1757
|
+
for (var i = D(n.pushes), s = i.next(); !s.done; s = i.next()) {
|
|
1758
|
+
var a = s.value;
|
|
1759
|
+
a.resolve();
|
|
1760
|
+
}
|
|
1761
|
+
} catch (l) {
|
|
1762
|
+
e = { error: l };
|
|
1763
|
+
} finally {
|
|
1764
|
+
try {
|
|
1765
|
+
s && !s.done && (r = i.return) && r.call(i);
|
|
1766
|
+
} finally {
|
|
1767
|
+
if (e) throw e.error;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
function H(n) {
|
|
1772
|
+
var t, e;
|
|
1773
|
+
if (!(n.state >= Y)) {
|
|
1774
|
+
n.state < L && gt(n), n.state = Y, n.buffer = void 0;
|
|
1775
|
+
try {
|
|
1776
|
+
for (var r = D(n.nexts), i = r.next(); !i.done; i = r.next()) {
|
|
1777
|
+
var s = i.value, a = n.pending === void 0 ? M(n) : n.pending.then(function() {
|
|
1778
|
+
return M(n);
|
|
1779
|
+
});
|
|
1780
|
+
s.resolve(k(n, a));
|
|
1781
|
+
}
|
|
1782
|
+
} catch (l) {
|
|
1783
|
+
t = { error: l };
|
|
1784
|
+
} finally {
|
|
1785
|
+
try {
|
|
1786
|
+
i && !i.done && (e = r.return) && e.call(r);
|
|
1787
|
+
} finally {
|
|
1788
|
+
if (t) throw t.error;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
n.pushes = [], n.nexts = [];
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
function Ot(n) {
|
|
1795
|
+
n.state >= bt || (n.state < Y && H(n), n.state = bt);
|
|
1796
|
+
}
|
|
1797
|
+
function Jt(n, t) {
|
|
1798
|
+
if (dt(t), n.pushes.length >= K)
|
|
1799
|
+
throw new Nt("No more than " + K + " pending calls to push are allowed on a single repeater.");
|
|
1800
|
+
if (n.state >= L)
|
|
1801
|
+
return Promise.resolve(void 0);
|
|
1802
|
+
var e = n.pending === void 0 ? Promise.resolve(t) : n.pending.then(function() {
|
|
1803
|
+
return t;
|
|
1804
|
+
});
|
|
1805
|
+
e = e.catch(function(u) {
|
|
1806
|
+
n.state < L && (n.err = u), Ot(n);
|
|
1807
|
+
});
|
|
1808
|
+
var r;
|
|
1809
|
+
if (n.nexts.length) {
|
|
1810
|
+
var i = n.nexts.shift();
|
|
1811
|
+
i.resolve(k(n, e)), n.nexts.length ? r = Promise.resolve(n.nexts[0].value) : typeof n.buffer < "u" && !n.buffer.full ? r = Promise.resolve(void 0) : r = new Promise(function(u) {
|
|
1812
|
+
return n.onnext = u;
|
|
1813
|
+
});
|
|
1814
|
+
} else typeof n.buffer < "u" && !n.buffer.full ? (n.buffer.add(e), r = Promise.resolve(void 0)) : r = new Promise(function(u) {
|
|
1815
|
+
return n.pushes.push({ resolve: u, value: e });
|
|
1816
|
+
});
|
|
1817
|
+
var s = !0, a = {}, l = r.catch(function(u) {
|
|
1818
|
+
if (s)
|
|
1819
|
+
throw u;
|
|
1820
|
+
});
|
|
1821
|
+
return a.then = function(u, o) {
|
|
1822
|
+
return s = !1, Promise.prototype.then.call(r, u, o);
|
|
1823
|
+
}, a.catch = function(u) {
|
|
1824
|
+
return s = !1, Promise.prototype.catch.call(r, u);
|
|
1825
|
+
}, a.finally = r.finally.bind(r), n.pending = e.then(function() {
|
|
1826
|
+
return l;
|
|
1827
|
+
}).catch(function(u) {
|
|
1828
|
+
n.err = u, Ot(n);
|
|
1829
|
+
}), a;
|
|
1830
|
+
}
|
|
1831
|
+
function Yt(n) {
|
|
1832
|
+
var t = gt.bind(null, n), e = new Promise(function(r) {
|
|
1833
|
+
return n.onstop = r;
|
|
1834
|
+
});
|
|
1835
|
+
return t.then = e.then.bind(e), t.catch = e.catch.bind(e), t.finally = e.finally.bind(e), t;
|
|
1836
|
+
}
|
|
1837
|
+
function Kt(n) {
|
|
1838
|
+
if (!(n.state >= St)) {
|
|
1839
|
+
n.state = St;
|
|
1840
|
+
var t = Jt.bind(null, n), e = Yt(n);
|
|
1841
|
+
n.execution = new Promise(function(r) {
|
|
1842
|
+
return r(n.executor(t, e));
|
|
1843
|
+
}), n.execution.catch(function() {
|
|
1844
|
+
return gt(n);
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
var W = /* @__PURE__ */ new WeakMap(), Z = (
|
|
1849
|
+
/** @class */
|
|
1850
|
+
(function() {
|
|
1851
|
+
function n(t, e) {
|
|
1852
|
+
W.set(this, {
|
|
1853
|
+
executor: t,
|
|
1854
|
+
buffer: e,
|
|
1855
|
+
err: void 0,
|
|
1856
|
+
state: ut,
|
|
1857
|
+
pushes: [],
|
|
1858
|
+
nexts: [],
|
|
1859
|
+
pending: void 0,
|
|
1860
|
+
execution: void 0,
|
|
1861
|
+
onnext: Q,
|
|
1862
|
+
onstop: Q
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
return n.prototype.next = function(t) {
|
|
1866
|
+
dt(t);
|
|
1867
|
+
var e = W.get(this);
|
|
1868
|
+
if (e === void 0)
|
|
1869
|
+
throw new Error("WeakMap error");
|
|
1870
|
+
if (e.nexts.length >= K)
|
|
1871
|
+
throw new Nt("No more than " + K + " pending calls to next are allowed on a single repeater.");
|
|
1872
|
+
if (e.state <= ut && Kt(e), e.onnext(t), typeof e.buffer < "u" && !e.buffer.empty) {
|
|
1873
|
+
var r = k(e, e.buffer.remove());
|
|
1874
|
+
if (e.pushes.length) {
|
|
1875
|
+
var i = e.pushes.shift();
|
|
1876
|
+
e.buffer.add(i.value), e.onnext = i.resolve;
|
|
1877
|
+
}
|
|
1878
|
+
return r;
|
|
1879
|
+
} else if (e.pushes.length) {
|
|
1880
|
+
var s = e.pushes.shift();
|
|
1881
|
+
return e.onnext = s.resolve, k(e, s.value);
|
|
1882
|
+
} else if (e.state >= L)
|
|
1883
|
+
return H(e), k(e, M(e));
|
|
1884
|
+
return new Promise(function(a) {
|
|
1885
|
+
return e.nexts.push({ resolve: a, value: t });
|
|
1886
|
+
});
|
|
1887
|
+
}, n.prototype.return = function(t) {
|
|
1888
|
+
dt(t);
|
|
1889
|
+
var e = W.get(this);
|
|
1890
|
+
if (e === void 0)
|
|
1891
|
+
throw new Error("WeakMap error");
|
|
1892
|
+
return H(e), e.execution = Promise.resolve(e.execution).then(function() {
|
|
1893
|
+
return t;
|
|
1894
|
+
}), k(e, M(e));
|
|
1895
|
+
}, n.prototype.throw = function(t) {
|
|
1896
|
+
var e = W.get(this);
|
|
1897
|
+
if (e === void 0)
|
|
1898
|
+
throw new Error("WeakMap error");
|
|
1899
|
+
return e.state <= ut || e.state >= L || typeof e.buffer < "u" && !e.buffer.empty ? (H(e), e.err == null && (e.err = t), k(e, M(e))) : this.next(Promise.reject(t));
|
|
1900
|
+
}, n.prototype[Symbol.asyncIterator] = function() {
|
|
1901
|
+
return this;
|
|
1902
|
+
}, n.race = Qt, n.merge = te, n.zip = ee, n.latest = re, n;
|
|
1903
|
+
})()
|
|
1904
|
+
);
|
|
1905
|
+
function st(n, t) {
|
|
1906
|
+
var e, r, i = [], s = function(o) {
|
|
1907
|
+
o != null && typeof o[Symbol.asyncIterator] == "function" ? i.push(o[Symbol.asyncIterator]()) : o != null && typeof o[Symbol.iterator] == "function" ? i.push(o[Symbol.iterator]()) : i.push((function() {
|
|
1908
|
+
return Wt(this, arguments, function() {
|
|
1909
|
+
return C(this, function(h) {
|
|
1910
|
+
switch (h.label) {
|
|
1911
|
+
case 0:
|
|
1912
|
+
return t.yieldValues ? [4, $(o)] : [3, 3];
|
|
1913
|
+
case 1:
|
|
1914
|
+
return [4, h.sent()];
|
|
1915
|
+
case 2:
|
|
1916
|
+
h.sent(), h.label = 3;
|
|
1917
|
+
case 3:
|
|
1918
|
+
return t.returnValues ? [4, $(o)] : [3, 5];
|
|
1919
|
+
case 4:
|
|
1920
|
+
return [2, h.sent()];
|
|
1921
|
+
case 5:
|
|
1922
|
+
return [
|
|
1923
|
+
2
|
|
1924
|
+
/*return*/
|
|
1925
|
+
];
|
|
1926
|
+
}
|
|
1927
|
+
});
|
|
1928
|
+
});
|
|
1929
|
+
})());
|
|
1930
|
+
};
|
|
1931
|
+
try {
|
|
1932
|
+
for (var a = D(n), l = a.next(); !l.done; l = a.next()) {
|
|
1933
|
+
var u = l.value;
|
|
1934
|
+
s(u);
|
|
1935
|
+
}
|
|
1936
|
+
} catch (o) {
|
|
1937
|
+
e = { error: o };
|
|
1938
|
+
} finally {
|
|
1939
|
+
try {
|
|
1940
|
+
l && !l.done && (r = a.return) && r.call(a);
|
|
1941
|
+
} finally {
|
|
1942
|
+
if (e) throw e.error;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
return i;
|
|
1946
|
+
}
|
|
1947
|
+
function Qt(n) {
|
|
1948
|
+
var t = this, e = st(n, { returnValues: !0 });
|
|
1949
|
+
return new Z(function(r, i) {
|
|
1950
|
+
return j(t, void 0, void 0, function() {
|
|
1951
|
+
var s, a, l, u, o, f;
|
|
1952
|
+
return C(this, function(c) {
|
|
1953
|
+
switch (c.label) {
|
|
1954
|
+
case 0:
|
|
1955
|
+
if (!e.length)
|
|
1956
|
+
return i(), [
|
|
1957
|
+
2
|
|
1958
|
+
/*return*/
|
|
1959
|
+
];
|
|
1960
|
+
a = !1, i.then(function() {
|
|
1961
|
+
s(), a = !0;
|
|
1962
|
+
}), c.label = 1;
|
|
1963
|
+
case 1:
|
|
1964
|
+
c.trys.push([1, , 5, 7]), u = void 0, o = 0, f = function() {
|
|
1965
|
+
var h, d, b, p, m, E;
|
|
1966
|
+
return C(this, function(S) {
|
|
1967
|
+
switch (S.label) {
|
|
1968
|
+
case 0:
|
|
1969
|
+
h = o;
|
|
1970
|
+
try {
|
|
1971
|
+
for (d = (m = void 0, D(e)), b = d.next(); !b.done; b = d.next())
|
|
1972
|
+
p = b.value, Promise.resolve(p.next()).then(function(U) {
|
|
1973
|
+
U.done ? (i(), l === void 0 && (l = U)) : o === h && (o++, s(U));
|
|
1974
|
+
}, function(U) {
|
|
1975
|
+
return i(U);
|
|
1976
|
+
});
|
|
1977
|
+
} catch (U) {
|
|
1978
|
+
m = { error: U };
|
|
1979
|
+
} finally {
|
|
1980
|
+
try {
|
|
1981
|
+
b && !b.done && (E = d.return) && E.call(d);
|
|
1982
|
+
} finally {
|
|
1983
|
+
if (m) throw m.error;
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
return [4, new Promise(function(U) {
|
|
1987
|
+
return s = U;
|
|
1988
|
+
})];
|
|
1989
|
+
case 1:
|
|
1990
|
+
return u = S.sent(), u === void 0 ? [3, 3] : [4, r(u.value)];
|
|
1991
|
+
case 2:
|
|
1992
|
+
S.sent(), S.label = 3;
|
|
1993
|
+
case 3:
|
|
1994
|
+
return [
|
|
1995
|
+
2
|
|
1996
|
+
/*return*/
|
|
1997
|
+
];
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
}, c.label = 2;
|
|
2001
|
+
case 2:
|
|
2002
|
+
return a ? [3, 4] : [5, f()];
|
|
2003
|
+
case 3:
|
|
2004
|
+
return c.sent(), [3, 2];
|
|
2005
|
+
case 4:
|
|
2006
|
+
return [2, l && l.value];
|
|
2007
|
+
case 5:
|
|
2008
|
+
return i(), [4, Promise.race(e.map(function(h) {
|
|
2009
|
+
return h.return && h.return();
|
|
2010
|
+
}))];
|
|
2011
|
+
case 6:
|
|
2012
|
+
return c.sent(), [
|
|
2013
|
+
7
|
|
2014
|
+
/*endfinally*/
|
|
2015
|
+
];
|
|
2016
|
+
case 7:
|
|
2017
|
+
return [
|
|
2018
|
+
2
|
|
2019
|
+
/*return*/
|
|
2020
|
+
];
|
|
2021
|
+
}
|
|
2022
|
+
});
|
|
2023
|
+
});
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
function te(n) {
|
|
2027
|
+
var t = this, e = st(n, { yieldValues: !0 });
|
|
2028
|
+
return new Z(function(r, i) {
|
|
2029
|
+
return j(t, void 0, void 0, function() {
|
|
2030
|
+
var s, a, l, u = this;
|
|
2031
|
+
return C(this, function(o) {
|
|
2032
|
+
switch (o.label) {
|
|
2033
|
+
case 0:
|
|
2034
|
+
if (!e.length)
|
|
2035
|
+
return i(), [
|
|
2036
|
+
2
|
|
2037
|
+
/*return*/
|
|
2038
|
+
];
|
|
2039
|
+
s = [], a = !1, i.then(function() {
|
|
2040
|
+
var f, c;
|
|
2041
|
+
a = !0;
|
|
2042
|
+
try {
|
|
2043
|
+
for (var h = D(s), d = h.next(); !d.done; d = h.next()) {
|
|
2044
|
+
var b = d.value;
|
|
2045
|
+
b();
|
|
2046
|
+
}
|
|
2047
|
+
} catch (p) {
|
|
2048
|
+
f = { error: p };
|
|
2049
|
+
} finally {
|
|
2050
|
+
try {
|
|
2051
|
+
d && !d.done && (c = h.return) && c.call(h);
|
|
2052
|
+
} finally {
|
|
2053
|
+
if (f) throw f.error;
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
}), o.label = 1;
|
|
2057
|
+
case 1:
|
|
2058
|
+
return o.trys.push([1, , 3, 4]), [4, Promise.all(e.map(function(f, c) {
|
|
2059
|
+
return j(u, void 0, void 0, function() {
|
|
2060
|
+
var h, d;
|
|
2061
|
+
return C(this, function(b) {
|
|
2062
|
+
switch (b.label) {
|
|
2063
|
+
case 0:
|
|
2064
|
+
b.trys.push([0, , 6, 9]), b.label = 1;
|
|
2065
|
+
case 1:
|
|
2066
|
+
return a ? [3, 5] : (Promise.resolve(f.next()).then(function(p) {
|
|
2067
|
+
return s[c](p);
|
|
2068
|
+
}, function(p) {
|
|
2069
|
+
return i(p);
|
|
2070
|
+
}), [4, new Promise(function(p) {
|
|
2071
|
+
s[c] = p;
|
|
2072
|
+
})]);
|
|
2073
|
+
case 2:
|
|
2074
|
+
return h = b.sent(), h === void 0 ? [3, 4] : h.done ? (l = h, [
|
|
2075
|
+
2
|
|
2076
|
+
/*return*/
|
|
2077
|
+
]) : [4, r(h.value)];
|
|
2078
|
+
case 3:
|
|
2079
|
+
b.sent(), b.label = 4;
|
|
2080
|
+
case 4:
|
|
2081
|
+
return [3, 1];
|
|
2082
|
+
case 5:
|
|
2083
|
+
return [3, 9];
|
|
2084
|
+
case 6:
|
|
2085
|
+
return d = f.return, d ? [4, f.return()] : [3, 8];
|
|
2086
|
+
case 7:
|
|
2087
|
+
d = b.sent(), b.label = 8;
|
|
2088
|
+
case 8:
|
|
2089
|
+
return [
|
|
2090
|
+
7
|
|
2091
|
+
/*endfinally*/
|
|
2092
|
+
];
|
|
2093
|
+
case 9:
|
|
2094
|
+
return [
|
|
2095
|
+
2
|
|
2096
|
+
/*return*/
|
|
2097
|
+
];
|
|
2098
|
+
}
|
|
2099
|
+
});
|
|
2100
|
+
});
|
|
2101
|
+
}))];
|
|
2102
|
+
case 2:
|
|
2103
|
+
return o.sent(), [2, l && l.value];
|
|
2104
|
+
case 3:
|
|
2105
|
+
return i(), [
|
|
2106
|
+
7
|
|
2107
|
+
/*endfinally*/
|
|
2108
|
+
];
|
|
2109
|
+
case 4:
|
|
2110
|
+
return [
|
|
2111
|
+
2
|
|
2112
|
+
/*return*/
|
|
2113
|
+
];
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
2116
|
+
});
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
function ee(n) {
|
|
2120
|
+
var t = this, e = st(n, { returnValues: !0 });
|
|
2121
|
+
return new Z(function(r, i) {
|
|
2122
|
+
return j(t, void 0, void 0, function() {
|
|
2123
|
+
var s, a, l, u;
|
|
2124
|
+
return C(this, function(o) {
|
|
2125
|
+
switch (o.label) {
|
|
2126
|
+
case 0:
|
|
2127
|
+
if (!e.length)
|
|
2128
|
+
return i(), [2, []];
|
|
2129
|
+
a = !1, i.then(function() {
|
|
2130
|
+
s(), a = !0;
|
|
2131
|
+
}), o.label = 1;
|
|
2132
|
+
case 1:
|
|
2133
|
+
o.trys.push([1, , 6, 8]), o.label = 2;
|
|
2134
|
+
case 2:
|
|
2135
|
+
return a ? [3, 5] : (Promise.all(e.map(function(f) {
|
|
2136
|
+
return f.next();
|
|
2137
|
+
})).then(function(f) {
|
|
2138
|
+
return s(f);
|
|
2139
|
+
}, function(f) {
|
|
2140
|
+
return i(f);
|
|
2141
|
+
}), [4, new Promise(function(f) {
|
|
2142
|
+
return s = f;
|
|
2143
|
+
})]);
|
|
2144
|
+
case 3:
|
|
2145
|
+
return l = o.sent(), l === void 0 ? [
|
|
2146
|
+
2
|
|
2147
|
+
/*return*/
|
|
2148
|
+
] : (u = l.map(function(f) {
|
|
2149
|
+
return f.value;
|
|
2150
|
+
}), l.some(function(f) {
|
|
2151
|
+
return f.done;
|
|
2152
|
+
}) ? [2, u] : [4, r(u)]);
|
|
2153
|
+
case 4:
|
|
2154
|
+
return o.sent(), [3, 2];
|
|
2155
|
+
case 5:
|
|
2156
|
+
return [3, 8];
|
|
2157
|
+
case 6:
|
|
2158
|
+
return i(), [4, Promise.all(e.map(function(f) {
|
|
2159
|
+
return f.return && f.return();
|
|
2160
|
+
}))];
|
|
2161
|
+
case 7:
|
|
2162
|
+
return o.sent(), [
|
|
2163
|
+
7
|
|
2164
|
+
/*endfinally*/
|
|
2165
|
+
];
|
|
2166
|
+
case 8:
|
|
2167
|
+
return [
|
|
2168
|
+
2
|
|
2169
|
+
/*return*/
|
|
2170
|
+
];
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
});
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
function re(n) {
|
|
2177
|
+
var t = this, e = st(n, {
|
|
2178
|
+
yieldValues: !0,
|
|
2179
|
+
returnValues: !0
|
|
2180
|
+
});
|
|
2181
|
+
return new Z(function(r, i) {
|
|
2182
|
+
return j(t, void 0, void 0, function() {
|
|
2183
|
+
var s, a, l, u, o, f = this;
|
|
2184
|
+
return C(this, function(c) {
|
|
2185
|
+
switch (c.label) {
|
|
2186
|
+
case 0:
|
|
2187
|
+
if (!e.length)
|
|
2188
|
+
return i(), [2, []];
|
|
2189
|
+
a = [], l = !1, i.then(function() {
|
|
2190
|
+
var h, d;
|
|
2191
|
+
s();
|
|
2192
|
+
try {
|
|
2193
|
+
for (var b = D(a), p = b.next(); !p.done; p = b.next()) {
|
|
2194
|
+
var m = p.value;
|
|
2195
|
+
m();
|
|
2196
|
+
}
|
|
2197
|
+
} catch (E) {
|
|
2198
|
+
h = { error: E };
|
|
2199
|
+
} finally {
|
|
2200
|
+
try {
|
|
2201
|
+
p && !p.done && (d = b.return) && d.call(b);
|
|
2202
|
+
} finally {
|
|
2203
|
+
if (h) throw h.error;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
l = !0;
|
|
2207
|
+
}), c.label = 1;
|
|
2208
|
+
case 1:
|
|
2209
|
+
return c.trys.push([1, , 5, 7]), Promise.all(e.map(function(h) {
|
|
2210
|
+
return h.next();
|
|
2211
|
+
})).then(function(h) {
|
|
2212
|
+
return s(h);
|
|
2213
|
+
}, function(h) {
|
|
2214
|
+
return i(h);
|
|
2215
|
+
}), [4, new Promise(function(h) {
|
|
2216
|
+
return s = h;
|
|
2217
|
+
})];
|
|
2218
|
+
case 2:
|
|
2219
|
+
return u = c.sent(), u === void 0 ? [
|
|
2220
|
+
2
|
|
2221
|
+
/*return*/
|
|
2222
|
+
] : (o = u.map(function(h) {
|
|
2223
|
+
return h.value;
|
|
2224
|
+
}), u.every(function(h) {
|
|
2225
|
+
return h.done;
|
|
2226
|
+
}) ? [2, o] : [4, r(o.slice())]);
|
|
2227
|
+
case 3:
|
|
2228
|
+
return c.sent(), [4, Promise.all(e.map(function(h, d) {
|
|
2229
|
+
return j(f, void 0, void 0, function() {
|
|
2230
|
+
var b;
|
|
2231
|
+
return C(this, function(p) {
|
|
2232
|
+
switch (p.label) {
|
|
2233
|
+
case 0:
|
|
2234
|
+
if (u[d].done)
|
|
2235
|
+
return [2, u[d].value];
|
|
2236
|
+
p.label = 1;
|
|
2237
|
+
case 1:
|
|
2238
|
+
return l ? [3, 4] : (Promise.resolve(h.next()).then(function(m) {
|
|
2239
|
+
return a[d](m);
|
|
2240
|
+
}, function(m) {
|
|
2241
|
+
return i(m);
|
|
2242
|
+
}), [4, new Promise(function(m) {
|
|
2243
|
+
return a[d] = m;
|
|
2244
|
+
})]);
|
|
2245
|
+
case 2:
|
|
2246
|
+
return b = p.sent(), b === void 0 ? [2, u[d].value] : b.done ? [2, b.value] : (o[d] = b.value, [4, r(o.slice())]);
|
|
2247
|
+
case 3:
|
|
2248
|
+
return p.sent(), [3, 1];
|
|
2249
|
+
case 4:
|
|
2250
|
+
return [
|
|
2251
|
+
2
|
|
2252
|
+
/*return*/
|
|
2253
|
+
];
|
|
2254
|
+
}
|
|
2255
|
+
});
|
|
2256
|
+
});
|
|
2257
|
+
}))];
|
|
2258
|
+
case 4:
|
|
2259
|
+
return [2, c.sent()];
|
|
2260
|
+
case 5:
|
|
2261
|
+
return i(), [4, Promise.all(e.map(function(h) {
|
|
2262
|
+
return h.return && h.return();
|
|
2263
|
+
}))];
|
|
2264
|
+
case 6:
|
|
2265
|
+
return c.sent(), [
|
|
2266
|
+
7
|
|
2267
|
+
/*endfinally*/
|
|
2268
|
+
];
|
|
2269
|
+
case 7:
|
|
2270
|
+
return [
|
|
2271
|
+
2
|
|
2272
|
+
/*return*/
|
|
2273
|
+
];
|
|
2274
|
+
}
|
|
2275
|
+
});
|
|
2276
|
+
});
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
class wt {
|
|
2280
|
+
headerClient;
|
|
2281
|
+
header;
|
|
2282
|
+
headerLength;
|
|
2283
|
+
indexLength;
|
|
2284
|
+
nocache;
|
|
2285
|
+
headers;
|
|
2286
|
+
constructor(t, e, r, i, s, a = {}) {
|
|
2287
|
+
this.headerClient = t, this.header = e, this.headerLength = r, this.indexLength = i, this.nocache = s, this.headers = a;
|
|
2288
|
+
}
|
|
2289
|
+
static async open(t, e, r = {}) {
|
|
2290
|
+
let i, s = new Bt(t, e, r), a = 2024 + (() => {
|
|
2291
|
+
let f, c = 0;
|
|
2292
|
+
for (f = 0; f < 3; f++) c += $t ** f * Ht;
|
|
2293
|
+
return c;
|
|
2294
|
+
})();
|
|
2295
|
+
if (!new Uint8Array(await s.getRange(0, 8, a, "header")).subarray(0, 3).every((f, c) => F[c] === f)) throw Error("Not a FlatGeobuf file");
|
|
2296
|
+
if ((i = new DataView(await s.getRange(8, 4, a, "header")).getUint32(0, !0)) > 10485760 || i < 8) throw Error("Invalid header size");
|
|
2297
|
+
let l = await s.getRange(F.length, V + i, a, "header"), u = rt(new B(new Uint8Array(l)));
|
|
2298
|
+
if (u.indexNodeSize === 0) throw Error("No index found, cannot read features filtered by bbox");
|
|
2299
|
+
let o = it(u.featuresCount, u.indexNodeSize);
|
|
2300
|
+
return new wt(s, u, i, o, e, r);
|
|
2301
|
+
}
|
|
2302
|
+
async *selectBbox(t) {
|
|
2303
|
+
let e = this.lengthBeforeTree(), r = this.headerClient, i = async (u, o) => r.getRange(e + u, o, 0, "index"), s = [], a = [];
|
|
2304
|
+
for await (let u of Vt(this.header.featuresCount, this.header.indexNodeSize, t, i)) {
|
|
2305
|
+
let [o, f] = u, [, , c] = u;
|
|
2306
|
+
if (c || (c = 4), a.length === 0) {
|
|
2307
|
+
a.push([o, c, f]);
|
|
2308
|
+
continue;
|
|
2309
|
+
}
|
|
2310
|
+
let h = a[a.length - 1];
|
|
2311
|
+
o - (h[0] + h[1]) > nt.global.extraRequestThreshold() && (s.push(a), a = []), a.push([o, c, f]);
|
|
2312
|
+
}
|
|
2313
|
+
this.headerClient.logUsage("header+index"), a.length > 0 && s.push(a);
|
|
2314
|
+
let l = s.flatMap((u) => this.readFeatureBatch(u, this.nocache));
|
|
2315
|
+
yield* Z.merge(l);
|
|
2316
|
+
}
|
|
2317
|
+
lengthBeforeTree() {
|
|
2318
|
+
return F.length + V + this.headerLength;
|
|
2319
|
+
}
|
|
2320
|
+
lengthBeforeFeatures() {
|
|
2321
|
+
return this.lengthBeforeTree() + this.indexLength;
|
|
2322
|
+
}
|
|
2323
|
+
buildFeatureClient(t) {
|
|
2324
|
+
return new Bt(this.headerClient.httpClient, t, this.headers);
|
|
2325
|
+
}
|
|
2326
|
+
async *readFeatureBatch(t, e) {
|
|
2327
|
+
let [r] = t[0], [i, s] = t[t.length - 1], a = this.buildFeatureClient(e), l = i + s - r;
|
|
2328
|
+
for (let [u, , o] of t) {
|
|
2329
|
+
let f = await this.readFeature(a, u, l);
|
|
2330
|
+
yield { id: o, feature: f }, l = 0;
|
|
2331
|
+
}
|
|
2332
|
+
a.logUsage("feature");
|
|
2333
|
+
}
|
|
2334
|
+
async readFeature(t, e, r) {
|
|
2335
|
+
let i, s = e + this.lengthBeforeFeatures();
|
|
2336
|
+
i = new DataView(await t.getRange(s, 4, r, "feature length")).getUint32(0, !0);
|
|
2337
|
+
let a = new Uint8Array(await t.getRange(s + 4, i, r, "feature data")), l = new Uint8Array(i + V);
|
|
2338
|
+
l.set(a, V);
|
|
2339
|
+
let u = new B(l);
|
|
2340
|
+
return x.getSizePrefixedRootAsFeature(u);
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
class Bt {
|
|
2344
|
+
httpClient;
|
|
2345
|
+
bytesEverUsed = 0;
|
|
2346
|
+
bytesEverFetched = 0;
|
|
2347
|
+
buffer = new ArrayBuffer(0);
|
|
2348
|
+
head = 0;
|
|
2349
|
+
constructor(t, e, r = {}) {
|
|
2350
|
+
if (typeof t == "string") this.httpClient = new Et(t, e, r);
|
|
2351
|
+
else if (t instanceof Et) this.httpClient = t;
|
|
2352
|
+
else throw Error("Unknown source");
|
|
2353
|
+
}
|
|
2354
|
+
async getRange(t, e, r, i) {
|
|
2355
|
+
this.bytesEverUsed += e;
|
|
2356
|
+
let s = t - this.head, a = s + e;
|
|
2357
|
+
if (s >= 0 && a <= this.buffer.byteLength) return this.buffer.slice(s, a);
|
|
2358
|
+
let l = Math.max(e, r);
|
|
2359
|
+
return this.bytesEverFetched += l, this.buffer = await this.httpClient.getRange(t, l, i), this.head = t, this.buffer.slice(0, e);
|
|
2360
|
+
}
|
|
2361
|
+
logUsage(t) {
|
|
2362
|
+
t.split(" ")[0], (100 * this.bytesEverUsed / this.bytesEverFetched).toFixed(2);
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
class Et {
|
|
2366
|
+
url;
|
|
2367
|
+
nocache;
|
|
2368
|
+
headers;
|
|
2369
|
+
requestsEverMade = 0;
|
|
2370
|
+
bytesEverRequested = 0;
|
|
2371
|
+
constructor(t, e, r = {}) {
|
|
2372
|
+
this.url = t, this.nocache = e, this.headers = r;
|
|
2373
|
+
}
|
|
2374
|
+
async getRange(t, e, r) {
|
|
2375
|
+
this.requestsEverMade += 1, this.bytesEverRequested += e;
|
|
2376
|
+
let i = `bytes=${t}-${t + e - 1}`, s = new Headers(this.headers);
|
|
2377
|
+
return s.set("Range", i), this.nocache && s.set("Cache-Control", "no-cache, no-store"), await (await fetch(this.url, { headers: s })).arrayBuffer();
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
function ne(n) {
|
|
2381
|
+
let t;
|
|
2382
|
+
for (let e of n) {
|
|
2383
|
+
if (t === I.Unknown) break;
|
|
2384
|
+
let r = e.getGeometry ? J(e.getGeometry().getType()) : J(e.geometry.type);
|
|
2385
|
+
t === void 0 ? t = r : t !== r && (t = I.Unknown);
|
|
2386
|
+
}
|
|
2387
|
+
if (t === void 0) throw Error("Could not infer geometry type for collection of features.");
|
|
2388
|
+
return t;
|
|
2389
|
+
}
|
|
2390
|
+
async function* ie(n, t, e, r) {
|
|
2391
|
+
if (!n.subarray(0, 3).every((c, h) => F[h] === c)) throw Error("Not a FlatGeobuf file");
|
|
2392
|
+
if (e) {
|
|
2393
|
+
let c = yt.open(n);
|
|
2394
|
+
for await (let h of c.selectBbox(e)) yield t(h.id, h.feature, c.header);
|
|
2395
|
+
return;
|
|
2396
|
+
}
|
|
2397
|
+
let i = new B(n), s = i.readUint32(F.length);
|
|
2398
|
+
i.setPosition(F.length);
|
|
2399
|
+
let a = rt(i);
|
|
2400
|
+
r && r(a);
|
|
2401
|
+
let l = F.length + V + s, { indexNodeSize: u, featuresCount: o } = a;
|
|
2402
|
+
u > 0 && (l += it(o, u));
|
|
2403
|
+
let f = 0;
|
|
2404
|
+
for (; l < i.capacity(); ) {
|
|
2405
|
+
let c = i.readUint32(l);
|
|
2406
|
+
i.setPosition(l);
|
|
2407
|
+
let h = x.getSizePrefixedRootAsFeature(i);
|
|
2408
|
+
yield t(f++, h, a), l += V + c;
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
async function* se(n, t, e) {
|
|
2412
|
+
let r, i = Gt(n), s = async (p) => await i.slice(p), a = new Uint8Array(await s(8));
|
|
2413
|
+
if (!a.subarray(0, 3).every((p, m) => F[m] === p)) throw Error("Not a FlatGeobuf file");
|
|
2414
|
+
let l = new Uint8Array(await s(4)), u = new B(l), o = u.readUint32(0), f = new Uint8Array(await s(o));
|
|
2415
|
+
(a = new Uint8Array(l.length + f.length)).set(l), a.set(f, l.length);
|
|
2416
|
+
let c = rt(u = new B(a));
|
|
2417
|
+
e && e(c);
|
|
2418
|
+
let { indexNodeSize: h, featuresCount: d } = c;
|
|
2419
|
+
if (h > 0) {
|
|
2420
|
+
let p = it(d, h);
|
|
2421
|
+
await s(p);
|
|
2422
|
+
}
|
|
2423
|
+
let b = 0;
|
|
2424
|
+
for (; r = await oe(s, c, t, b++); ) yield r;
|
|
2425
|
+
}
|
|
2426
|
+
async function* ae(n, t, e, r, i = !1, s = {}) {
|
|
2427
|
+
let a = await wt.open(n, i, s);
|
|
2428
|
+
for await (let l of (r && r(a.header), a.selectBbox(t))) yield e(l.id, l.feature, a.header);
|
|
2429
|
+
}
|
|
2430
|
+
async function oe(n, t, e, r) {
|
|
2431
|
+
let i = new Uint8Array(await n(4, "feature length"));
|
|
2432
|
+
if (i.byteLength === 0) return;
|
|
2433
|
+
let s = new B(i), a = s.readUint32(0);
|
|
2434
|
+
i = new Uint8Array(await n(a, "feature data"));
|
|
2435
|
+
let l = new Uint8Array(a + 4);
|
|
2436
|
+
return l.set(i, 4), s = new B(l), e(r, x.getSizePrefixedRootAsFeature(s), t);
|
|
2437
|
+
}
|
|
2438
|
+
function le(n, t = 0) {
|
|
2439
|
+
let e, r = new tt(), i = 0;
|
|
2440
|
+
n.columns && (i = O.createColumnsVector(r, n.columns.map((l) => {
|
|
2441
|
+
let u;
|
|
2442
|
+
return u = r.createString(l.name), v.startColumn(r), v.addName(r, u), v.addType(r, l.type), v.endColumn(r);
|
|
2443
|
+
})));
|
|
2444
|
+
let s = r.createString("L1");
|
|
2445
|
+
t && (P.startCrs(r), P.addCode(r, t), e = P.endCrs(r)), O.startHeader(r), e && O.addCrs(r, e), O.addFeaturesCount(r, BigInt(n.featuresCount)), O.addGeometryType(r, n.geometryType), O.addIndexNodeSize(r, 0), i && O.addColumns(r, i), O.addName(r, s);
|
|
2446
|
+
let a = O.endHeader(r);
|
|
2447
|
+
return r.finishSizePrefixed(a), r.asUint8Array();
|
|
2448
|
+
}
|
|
2449
|
+
function ue(n, t) {
|
|
2450
|
+
return { name: t, type: (function(e) {
|
|
2451
|
+
if (typeof e == "boolean") return y.Bool;
|
|
2452
|
+
if (typeof e == "number") return y.Double;
|
|
2453
|
+
if (typeof e == "string" || e === null) return y.String;
|
|
2454
|
+
if (e instanceof Uint8Array) return y.Binary;
|
|
2455
|
+
if (typeof e == "object") return y.Json;
|
|
2456
|
+
throw Error(`Unknown type (value '${e}')`);
|
|
2457
|
+
})(n[t]), title: null, description: null, width: -1, precision: -1, scale: -1, nullable: !0, unique: !1, primary_key: !1 };
|
|
2458
|
+
}
|
|
2459
|
+
function mt(n) {
|
|
2460
|
+
let t, e, r = n.coordinates, i = [], s = [], a = J(n.type), l = 0;
|
|
2461
|
+
switch (n.type) {
|
|
2462
|
+
case "Point":
|
|
2463
|
+
case "MultiPoint":
|
|
2464
|
+
case "LineString":
|
|
2465
|
+
ft(r, i, s);
|
|
2466
|
+
break;
|
|
2467
|
+
case "MultiLineString":
|
|
2468
|
+
case "Polygon":
|
|
2469
|
+
ft(r, i, s), r.length > 1 && (t = r.map((u) => l += u.length));
|
|
2470
|
+
break;
|
|
2471
|
+
case "MultiPolygon":
|
|
2472
|
+
e = r.map((u) => ({ type: "Polygon", coordinates: u })).map(mt);
|
|
2473
|
+
}
|
|
2474
|
+
return { xy: i, z: s.length > 0 ? s : void 0, ends: t, type: a, parts: e };
|
|
2475
|
+
}
|
|
2476
|
+
function At(n) {
|
|
2477
|
+
let t = J(n.type), e = [];
|
|
2478
|
+
for (let r = 0; r < n.geometries.length; r++) {
|
|
2479
|
+
let i = n.geometries[r];
|
|
2480
|
+
i.type === "GeometryCollection" ? e.push(At(i)) : e.push(mt(i));
|
|
2481
|
+
}
|
|
2482
|
+
return { type: t, parts: e };
|
|
2483
|
+
}
|
|
2484
|
+
function pt(n, t) {
|
|
2485
|
+
let e = t;
|
|
2486
|
+
if (e === I.Unknown && (e = n.type()), e === I.GeometryCollection) {
|
|
2487
|
+
let i = [];
|
|
2488
|
+
for (let s = 0; s < n.partsLength(); s++) {
|
|
2489
|
+
let a = n.parts(s), l = a.type();
|
|
2490
|
+
i.push(pt(a, l));
|
|
2491
|
+
}
|
|
2492
|
+
return { type: I[e], geometries: i };
|
|
2493
|
+
}
|
|
2494
|
+
if (e === I.MultiPolygon) {
|
|
2495
|
+
let i = [];
|
|
2496
|
+
for (let s = 0; s < n.partsLength(); s++) i.push(pt(n.parts(s), I.Polygon));
|
|
2497
|
+
return { type: I[e], coordinates: i.map((s) => s.coordinates) };
|
|
2498
|
+
}
|
|
2499
|
+
let r = (function(i, s) {
|
|
2500
|
+
let a = i.xyArray(), l = i.zArray();
|
|
2501
|
+
switch (s) {
|
|
2502
|
+
case I.Point: {
|
|
2503
|
+
let u = Array.from(a);
|
|
2504
|
+
return l && u.push(l[0]), u;
|
|
2505
|
+
}
|
|
2506
|
+
case I.MultiPoint:
|
|
2507
|
+
case I.LineString:
|
|
2508
|
+
return lt(a, l);
|
|
2509
|
+
case I.MultiLineString:
|
|
2510
|
+
case I.Polygon:
|
|
2511
|
+
return (function(u, o, f) {
|
|
2512
|
+
let c;
|
|
2513
|
+
if (!f || f.length === 0) return [lt(u, o)];
|
|
2514
|
+
let h = 0, d = Array.from(f).map((b) => u.slice(h, h = b << 1));
|
|
2515
|
+
return o && (h = 0, c = Array.from(f).map((b) => o.slice(h, h = b))), d.map((b, p) => lt(b, c ? c[p] : void 0));
|
|
2516
|
+
})(a, l, i.endsArray());
|
|
2517
|
+
}
|
|
2518
|
+
})(n, e);
|
|
2519
|
+
return { type: I[e], coordinates: r };
|
|
2520
|
+
}
|
|
2521
|
+
function vt(n, t, e) {
|
|
2522
|
+
let r = e.columns;
|
|
2523
|
+
return { type: "Feature", id: n, geometry: pt(t.geometry(), e.geometryType), properties: zt(t, r) };
|
|
2524
|
+
}
|
|
2525
|
+
function he(n, t = 0) {
|
|
2526
|
+
var e;
|
|
2527
|
+
let r, i, s = (r = (e = n).features[0].properties, i = null, r && (i = Object.keys(r).map((c) => ue(r, c))), { geometryType: ne(e.features), columns: i, featuresCount: e.features.length }), a = le(s, t), l = n.features.map((c) => Rt(c.geometry.type === "GeometryCollection" ? At(c.geometry) : mt(c.geometry), c.properties, s)), u = l.map((c) => c.length).reduce((c, h) => c + h), o = new Uint8Array(F.length + a.length + u);
|
|
2528
|
+
o.set(a, F.length);
|
|
2529
|
+
let f = F.length + a.length;
|
|
2530
|
+
for (let c of l) o.set(c, f), f += c.length;
|
|
2531
|
+
return o.set(F), o;
|
|
2532
|
+
}
|
|
2533
|
+
async function* fe(n, t, e) {
|
|
2534
|
+
yield* ie(n, vt, t, e);
|
|
2535
|
+
}
|
|
2536
|
+
function ce(n, t) {
|
|
2537
|
+
return se(n, vt, t);
|
|
2538
|
+
}
|
|
2539
|
+
function de(n, t, e, r = !1, i = {}) {
|
|
2540
|
+
return ae(n, t, vt, e, r, i);
|
|
2541
|
+
}
|
|
2542
|
+
function be(n, t = 0) {
|
|
2543
|
+
return he(n, t);
|
|
2544
|
+
}
|
|
2545
|
+
function pe(n, t, e, r = !1, i = {}) {
|
|
2546
|
+
return n instanceof Uint8Array ? fe(n, t, e) : n instanceof ReadableStream ? ce(n, e) : de(n, t, e, r, i);
|
|
2547
|
+
}
|
|
2548
|
+
export {
|
|
2549
|
+
pe as deserialize,
|
|
2550
|
+
be as serialize
|
|
2551
|
+
};
|