@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 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./pako.esm-DZC2QrbJ.cjs"),t=require("./geotiff-De1w1lBy.cjs");class o extends t.BaseDecoder{decodeBlock(e){return r.inflate_1(new Uint8Array(e)).buffer}}exports.default=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});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;var ht;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(ht||(ht={}));class B{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new B(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return A[0]=this.readInt32(t),xt[0]}readFloat64(t){return A[X?0:1]=this.readInt32(t),A[X?1:0]=this.readInt32(t+4),Ft[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){xt[0]=e,this.writeInt32(t,A[0])}writeFloat64(t,e){Ft[0]=e,this.writeInt32(t,A[X?0:1]),this.writeInt32(t+4,A[X?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+T+N)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<N;e++)t+=String.fromCharCode(this.readInt8(this.position_+T+e));return t}__offset(t,e){const r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);const r=this.readInt32(t);t+=T;const i=this.bytes_.subarray(t,t+r);return e===ht.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+T}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=N)throw new Error("FlatBuffers: file identifier must be length "+N);for(let e=0;e<N;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+T+e))return!1;return!0}createScalarList(t,e){const r=[];for(let i=0;i<e;++i){const s=t(i);s!==null&&r.push(s)}return r}createObjList(t,e){const r=[];for(let i=0;i<e;++i){const s=t(i);s!==null&&r.push(s.unpack())}return r}}class tt{constructor(t){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;let e;t?e=t:e=1024,this.bb=B.allocate(e),this.space=e}clear(){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}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);const r=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<r+t+e;){const i=this.bb.capacity();this.bb=tt.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,r){(this.force_defaults||e!==r)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,r){e!=r&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const r=e<<1,i=B.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i}addOffset(t){this.prep(T,0),this.writeInt32(this.offset()-t+T)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);const r=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const i=2;this.addInt16(t-this.object_start);const s=(r+i)*ot;this.addInt16(s);let a=0;const l=this.space;t:for(e=0;e<this.vtables.length;e++){const u=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(u)){for(let o=ot;o<s;o+=ot)if(this.bb.readInt16(l+o)!=this.bb.readInt16(u+o))continue t;a=this.vtables[e];break}}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}finish(t,e,r){const i=r?q:0;if(e){const s=e;if(this.prep(this.minalign,T+N+i),s.length!=N)throw new TypeError("FlatBuffers: file identifier must be length "+N);for(let a=N-1;a>=0;a--)this.writeInt8(s.charCodeAt(a))}this.prep(this.minalign,T+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(T,t*e),this.prep(r,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;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()}createByteVector(t){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())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let r=0;r<t.length;++r){const i=t[r];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}}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);class v{bb=null;bb_pos=0;__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsColumn(t,e){return(e||new v).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsColumn(t,e){return t.setPosition(t.position()+q),(e||new v).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):y.Byte}title(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){let t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){let t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){let t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){let e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static startColumn(t){t.startObject(11)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,y.Byte)}static addTitle(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWidth(t,e){t.addFieldInt32(4,e,-1)}static addPrecision(t,e){t.addFieldInt32(5,e,-1)}static addScale(t,e){t.addFieldInt32(6,e,-1)}static addNullable(t,e){t.addFieldInt8(7,+e,1)}static addUnique(t,e){t.addFieldInt8(8,+e,0)}static addPrimaryKey(t,e){t.addFieldInt8(9,+e,0)}static addMetadata(t,e){t.addFieldOffset(10,e,0)}static endColumn(t){let e=t.endObject();return t.requiredField(e,4),e}static createColumn(t,e,r,i,s,a,l,u,o,f,c,h){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)}}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",_);class w{bb=null;bb_pos=0;__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsGeometry(t,e){return(e||new w).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGeometry(t,e){return t.setPosition(t.position()+q),(e||new w).__init(t.readInt32(t.position())+t.position(),t)}ends(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}endsLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){let t=this.bb.__offset(this.bb_pos,4);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}xy(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}xyLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){let t=this.bb.__offset(this.bb_pos,6);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}z(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}zLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){let t=this.bb.__offset(this.bb_pos,8);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}m(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}mLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){let t=this.bb.__offset(this.bb_pos,10);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}t(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}tLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){let t=this.bb.__offset(this.bb_pos,12);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}tm(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):BigInt(0)}tmLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):I.Unknown}parts(t,e){let r=this.bb.__offset(this.bb_pos,18);return r?(e||new w).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}partsLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGeometry(t){t.startObject(8)}static addEnds(t,e){t.addFieldOffset(0,e,0)}static createEndsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startEndsVector(t,e){t.startVector(4,e,4)}static addXy(t,e){t.addFieldOffset(1,e,0)}static createXyVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startXyVector(t,e){t.startVector(8,e,8)}static addZ(t,e){t.addFieldOffset(2,e,0)}static createZVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startZVector(t,e){t.startVector(8,e,8)}static addM(t,e){t.addFieldOffset(3,e,0)}static createMVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startMVector(t,e){t.startVector(8,e,8)}static addT(t,e){t.addFieldOffset(4,e,0)}static createTVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startTVector(t,e){t.startVector(8,e,8)}static addTm(t,e){t.addFieldOffset(5,e,0)}static createTmVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startTmVector(t,e){t.startVector(8,e,8)}static addType(t,e){t.addFieldInt8(6,e,I.Unknown)}static addParts(t,e){t.addFieldOffset(7,e,0)}static createPartsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startPartsVector(t,e){t.startVector(4,e,4)}static endGeometry(t){return t.endObject()}static createGeometry(t,e,r,i,s,a,l,u,o){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)}}class x{bb=null;bb_pos=0;__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFeature(t,e){return(e||new x).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFeature(t,e){return t.setPosition(t.position()+q),(e||new x).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new w).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}properties(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}propertiesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){let t=this.bb.__offset(this.bb_pos,6);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}columns(t,e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new v).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}columnsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFeature(t){t.startObject(3)}static addGeometry(t,e){t.addFieldOffset(0,e,0)}static addProperties(t,e){t.addFieldOffset(1,e,0)}static createPropertiesVector(t,e){t.startVector(1,e.length,1);for(let r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()}static startPropertiesVector(t,e){t.startVector(1,e,1)}static addColumns(t,e){t.addFieldOffset(2,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static endFeature(t){return t.endObject()}static finishFeatureBuffer(t,e){t.finish(e)}static finishSizePrefixedFeatureBuffer(t,e){t.finish(e,void 0,!0)}static createFeature(t,e,r,i){return x.startFeature(t),x.addGeometry(t,e),x.addProperties(t,r),x.addColumns(t,i),x.endFeature(t)}}function Tt(n,t){let e,r,i,{xy:s,z:a,m:l,ends:u,parts:o,type:f}=t;if(o){let h=o.map(b=>Tt(n,b)),d=w.createPartsVector(n,h);return w.startGeometry(n),w.addParts(n,d),w.addType(n,f),w.endGeometry(n)}let c=w.createXyVector(n,s);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)}function ft(n,t,e){if(n.length!==0)if(Array.isArray(n[0]))for(let r of n)ft(r,t,e);else n.length===2?t.push(...n):(t.push(n[0],n[1]),e.push(n[2]))}function lt(n,t){let e=[];for(let r=0;r<n.length;r+=2){let i=[n[r],n[r+1]];t&&i.push(t[r>>1]),e.push(i)}return e}function J(n){return n?I[n]:I.Unknown}let Ut=new TextEncoder,Pt=new TextDecoder;function zt(n,t,e){let r=e.columns,i=new tt,s=0,a=1024,l=new Uint8Array(1024),u=new DataView(l.buffer),o=d=>{if(s+d<a)return;let b=new Uint8Array(a=Math.max(a+d,2*a));b.set(l),u=new DataView((l=b).buffer)};if(r)for(let d=0;d<r.length;d++){let b=r[d],p=t[b.name];if(p!==null)switch(o(2),u.setUint16(s,d,!0),s+=2,b.type){case y.Bool:o(1),u.setUint8(s,p),s+=1;break;case y.Short:o(2),u.setInt16(s,p,!0),s+=2;break;case y.UShort:o(2),u.setUint16(s,p,!0),s+=2;break;case y.Int:o(4),u.setInt32(s,p,!0),s+=4;break;case y.UInt:o(4),u.setUint32(s,p,!0),s+=4;break;case y.Long:o(8),u.setBigInt64(s,BigInt(p),!0),s+=8;break;case y.Float:o(4),u.setFloat32(s,p,!0),s+=4;break;case y.Double:o(8),u.setFloat64(s,p,!0),s+=8;break;case y.DateTime:case y.String:{let m=Ut.encode(p);o(4),u.setUint32(s,m.length,!0),s+=4,o(m.length),l.set(m,s),s+=m.length;break}case y.Json:{let m=Ut.encode(JSON.stringify(p));o(4),u.setUint32(s,m.length,!0),s+=4,o(m.length),l.set(m,s),s+=m.length;break}case y.Binary:o(4),u.setUint32(s,p.length,!0),s+=4,o(p.length),l.set(p,s),s+=p.length;break;default:throw Error(`Unknown type ${b.type}`)}}let f=0;s>0&&(f=x.createPropertiesVector(i,l.slice(0,s)));let c=Tt(i,n);x.startFeature(i),x.addGeometry(i,c),f&&x.addProperties(i,f);let h=x.endFeature(i);return i.finishSizePrefixed(h),i.asUint8Array()}function Rt(n,t){let e={};if(!t||t.length===0)return e;let r=n.propertiesArray();if(!r)return e;let i=new DataView(r.buffer,r.byteOffset),s=n.propertiesLength(),a=0;for(;a<s;){let l=i.getUint16(a,!0);a+=2;let u=t[l],o=u.name;switch(u.type){case y.Bool:e[o]=!!i.getUint8(a),a+=1;break;case y.Byte:e[o]=i.getInt8(a),a+=1;break;case y.UByte:e[o]=i.getUint8(a),a+=1;break;case y.Short:e[o]=i.getInt16(a,!0),a+=2;break;case y.UShort:e[o]=i.getUint16(a,!0),a+=2;break;case y.Int:e[o]=i.getInt32(a,!0),a+=4;break;case y.UInt:e[o]=i.getUint32(a,!0),a+=4;break;case y.Long:e[o]=Number(i.getBigInt64(a,!0)),a+=8;break;case y.ULong:e[o]=Number(i.getBigUint64(a,!0)),a+=8;break;case y.Float:e[o]=i.getFloat32(a,!0),a+=4;break;case y.Double:e[o]=i.getFloat64(a,!0),a+=8;break;case y.DateTime:case y.String:{let f=i.getUint32(a,!0);a+=4,e[o]=Pt.decode(r.subarray(a,a+f)),a+=f;break}case y.Json:{let f=i.getUint32(a,!0);a+=4;let c=Pt.decode(r.subarray(a,a+f));e[o]=JSON.parse(c),a+=f;break}case y.Binary:{let f=i.getUint32(a,!0);a+=4,e[o]=r.subarray(a,a+f),a+=f;break}default:throw Error(`Unknown type ${u.type}`)}}return e}const _t=new Uint8Array(0);function Mt(){return this._source.cancel()}function jt(n,t){if(!n.length)return t;if(!t.length)return n;var e=new Uint8Array(n.length+t.length);return e.set(n),e.set(t,n.length),e}function qt(){var n=this,t=n._array.subarray(n._index);return n._source.read().then(function(e){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)}})}function Dt(n){if((n|=0)<0)throw new Error("invalid length");var t=this,e=this._array.length-this._index;if(this._index+n<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=n));var r=new Uint8Array(n);return r.set(this._array.subarray(this._index)),(function i(){return t._source.read().then(function(s){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())})})()}function Gt(n){return typeof n.slice=="function"?n:new et(typeof n.read=="function"?n:n.getReader())}function et(n){this._source=n,this._array=_t,this._index=0}et.prototype.read=qt;et.prototype.slice=Dt;et.prototype.cancel=Mt;class P{bb=null;bb_pos=0;__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsCrs(t,e){return(e||new P).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsCrs(t,e){return t.setPosition(t.position()+q),(e||new P).__init(t.readInt32(t.position())+t.position(),t)}org(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}code(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}wkt(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}codeString(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}static startCrs(t){t.startObject(6)}static addOrg(t,e){t.addFieldOffset(0,e,0)}static addCode(t,e){t.addFieldInt32(1,e,0)}static addName(t,e){t.addFieldOffset(2,e,0)}static addDescription(t,e){t.addFieldOffset(3,e,0)}static addWkt(t,e){t.addFieldOffset(4,e,0)}static addCodeString(t,e){t.addFieldOffset(5,e,0)}static endCrs(t){return t.endObject()}static createCrs(t,e,r,i,s,a,l){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)}}class O{bb=null;bb_pos=0;__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsHeader(t,e){return(e||new O).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsHeader(t,e){return t.setPosition(t.position()+q),(e||new O).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}envelope(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}envelopeLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){let t=this.bb.__offset(this.bb_pos,6);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}geometryType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):I.Unknown}hasZ(){let t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasM(){let t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasT(){let t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasTm(){let t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}columns(t,e){let r=this.bb.__offset(this.bb_pos,18);return r?(e||new v).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}columnsLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):BigInt("0")}indexNodeSize(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){let e=this.bb.__offset(this.bb_pos,24);return e?(t||new P).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}title(t){let e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){let e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}metadata(t){let e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}static startHeader(t){t.startObject(14)}static addName(t,e){t.addFieldOffset(0,e,0)}static addEnvelope(t,e){t.addFieldOffset(1,e,0)}static createEnvelopeVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}static startEnvelopeVector(t,e){t.startVector(8,e,8)}static addGeometryType(t,e){t.addFieldInt8(2,e,I.Unknown)}static addHasZ(t,e){t.addFieldInt8(3,+e,0)}static addHasM(t,e){t.addFieldInt8(4,+e,0)}static addHasT(t,e){t.addFieldInt8(5,+e,0)}static addHasTm(t,e){t.addFieldInt8(6,+e,0)}static addColumns(t,e){t.addFieldOffset(7,e,0)}static createColumnsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static addFeaturesCount(t,e){t.addFieldInt64(8,e,BigInt("0"))}static addIndexNodeSize(t,e){t.addFieldInt16(9,e,16)}static addCrs(t,e){t.addFieldOffset(10,e,0)}static addTitle(t,e){t.addFieldOffset(11,e,0)}static addDescription(t,e){t.addFieldOffset(12,e,0)}static addMetadata(t,e){t.addFieldOffset(13,e,0)}static endHeader(t){return t.endObject()}static finishHeaderBuffer(t,e){t.finish(e)}static finishSizePrefixedHeaderBuffer(t,e){t.finish(e,void 0,!0)}}function rt(n){let t=O.getSizePrefixedRootAsHeader(n),e=t.featuresCount(),r=t.indexNodeSize(),i=[];for(let l=0;l<t.columnsLength();l++){let u=t.columns(l);if(!u)throw Error("Column unexpectedly missing");if(!u.name())throw Error("Column name unexpectedly missing");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()})}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;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()}}class nt{static global=new nt;_extraRequestThreshold=262144;extraRequestThreshold(){return this._extraRequestThreshold}setExtraRequestThreshold(t){if(t<0)throw Error("extraRequestThreshold cannot be negative");this._extraRequestThreshold=t}}const Ht=40,$t=16;function it(n,t){t=Math.min(Math.max(+t,2),65535);let e=n,r=e;do r+=e=Math.ceil(e/t);while(e!==1);return 40*r}function Zt(n,t){if(t<2)throw Error("Node size must be at least 2");if(n===0)throw Error("Number of items must be greater than 0");let e=n,r=e,i=[e];do r+=e=Math.ceil(e/t),i.push(e);while(e!==1);let s=[];for(let l of(e=r,i))s.push(e-l),e-=l;let a=[];for(let l=0;l<i.length;l++)a.push([s[l],s[l]+i[l]]);return a}async function*Vt(n,t,e,r){class i{_level;nodes;constructor(d,b){this._level=b,this.nodes=d}level(){return this._level}startNodeIdx(){return this.nodes[0]}endNodeIdx(){return this.nodes[1]}extendEndNodeIdx(d){this.nodes[1]=d}toString(){return`[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`}}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)];for(;c.length!==0;){let h=c.shift(),d=h.startNodeIdx(),b=d>=f,p=(()=>{let[,S]=o[h.level()],U=Math.min(h.endNodeIdx()+t,S);return b&&U<S?U+1:U})(),m=p-d,E=new DataView(await r(40*d,40*m));for(let S=d;S<p;S++){let U=S-d,G=40*U;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;let z=E.getBigUint64(G+32,!0);if(b){let at=(()=>{if(S<n-1){let Lt=(U+1)*40;return E.getBigUint64(Lt+32,!0)-z}return null})(),kt=S-f;yield[Number(z),kt,Number(at)];continue}let Ct=nt.global.extraRequestThreshold()/40,R=c[c.length-1];if(R!==void 0&&R.level()===h.level()-1&&z<R.endNodeIdx()+Ct){R.extendEndNodeIdx(Number(z));continue}let It=(()=>{let at=h.level()-1;return new i([Number(z),Number(z)+1],at)})();R!==void 0&&(R.level(),It.level()),c.push(It)}}}class yt{bytes;header;headerLength;indexLength;constructor(t,e,r,i){this.bytes=t,this.header=e,this.headerLength=r,this.indexLength=i}static open(t){if(!t.subarray(0,3).every((a,l)=>F[l]===a))throw Error("Not a FlatGeobuf file");let e=new DataView(t.buffer).getUint32(F.length,!0);if(e>10485760||e<8)throw Error("Invalid header size");let r=t.subarray(F.length,F.length+V+e),i=rt(new B(r)),s=it(i.featuresCount,i.indexNodeSize);return new yt(t,i,e,s)}async*selectBbox(t){let e=this.lengthBeforeTree(),r=async(i,s)=>{let a=e+i;return this.bytes.slice(a,a+s).buffer};for await(let i of Vt(this.header.featuresCount,this.header.indexNodeSize,t,r)){let[s,a]=i,l=this.readFeature(s);yield{id:a,feature:l}}}lengthBeforeTree(){return F.length+V+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}readFeature(t){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);s.set(i,V);let a=new B(s);return x.getSizePrefixedRootAsFeature(a)}}var ct=function(n,t){return ct=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])},ct(n,t)};function Xt(n,t){ct(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function j(n,t,e,r){function i(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function l(f){try{o(r.next(f))}catch(c){a(c)}}function u(f){try{o(r.throw(f))}catch(c){a(c)}}function o(f){f.done?s(f.value):i(f.value).then(l,u)}o((r=r.apply(n,[])).next())})}function C(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(o){return function(f){return u([o,f])}}function u(o){if(r)throw new TypeError("Generator is already executing.");for(;e;)try{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;switch(i=0,s&&(o=[o[0]&2,s.value]),o[0]){case 0:case 1:s=o;break;case 4:return e.label++,{value:o[1],done:!1};case 5:e.label++,i=o[1],o=[0];continue;case 7:o=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){e.label=o[1];break}if(o[0]===6&&e.label<s[1]){e.label=s[1],s=o;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(o);break}s[2]&&e.ops.pop(),e.trys.pop();continue}o=t.call(n,e)}catch(f){o=[6,f],i=0}finally{r=s=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function D(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],r=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(n){return this instanceof $?(this.v=n,this):new $(n)}function Wt(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(n,t||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){r[h]&&(i[h]=function(d){return new Promise(function(b,p){s.push([h,d,b,p])>1||l(h,d)})})}function l(h,d){try{u(r[h](d))}catch(b){c(s[0][3],b)}}function u(h){h.value instanceof $?Promise.resolve(h.value.v).then(o,f):c(s[0][2],h)}function o(h){l("next",h)}function f(h){l("throw",h)}function c(h,d){h(d),s.shift(),s.length&&l(s[0][0],s[0][1])}}var Nt=(function(n){Xt(t,n);function t(e){var r=n.call(this,e)||this;return Object.defineProperty(r,"name",{value:"RepeaterOverflowError",enumerable:!1}),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}return t})(Error);(function(){function n(t){if(t<0)throw new RangeError("Capacity may not be less than 0");this._c=t,this._q=[]}return Object.defineProperty(n.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),n.prototype.add=function(t){if(this.full)throw new Error("Buffer full");this._q.push(t)},n.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},n})();(function(){function n(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(n.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),n.prototype.add=function(t){for(;this._q.length>=this._c;)this._q.shift();this._q.push(t)},n.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},n})();(function(){function n(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(n.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),n.prototype.add=function(t){this._q.length<this._c&&this._q.push(t)},n.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},n})();function dt(n){n!=null&&typeof n.then=="function"&&n.then(Q,Q)}var ut=0,St=1,L=2,Y=3,bt=4,K=1024,Q=function(){};function M(n){var t=n.err,e=Promise.resolve(n.execution).then(function(r){if(t!=null)throw t;return r});return n.err=void 0,n.execution=e.then(function(){},function(){}),n.pending===void 0?e:n.pending.then(function(){return e})}function k(n,t){var e=n.state>=Y;return Promise.resolve(t).then(function(r){return!e&&n.state>=bt?M(n).then(function(i){return{value:i,done:!0}}):{value:r,done:e}})}function gt(n,t){var e,r;if(!(n.state>=L))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))H(n);else try{for(var i=D(n.pushes),s=i.next();!s.done;s=i.next()){var a=s.value;a.resolve()}}catch(l){e={error:l}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}function H(n){var t,e;if(!(n.state>=Y)){n.state<L&>(n),n.state=Y,n.buffer=void 0;try{for(var r=D(n.nexts),i=r.next();!i.done;i=r.next()){var s=i.value,a=n.pending===void 0?M(n):n.pending.then(function(){return M(n)});s.resolve(k(n,a))}}catch(l){t={error:l}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}n.pushes=[],n.nexts=[]}}function Ot(n){n.state>=bt||(n.state<Y&&H(n),n.state=bt)}function Jt(n,t){if(dt(t),n.pushes.length>=K)throw new Nt("No more than "+K+" pending calls to push are allowed on a single repeater.");if(n.state>=L)return Promise.resolve(void 0);var e=n.pending===void 0?Promise.resolve(t):n.pending.then(function(){return t});e=e.catch(function(u){n.state<L&&(n.err=u),Ot(n)});var r;if(n.nexts.length){var i=n.nexts.shift();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){return n.onnext=u})}else typeof n.buffer<"u"&&!n.buffer.full?(n.buffer.add(e),r=Promise.resolve(void 0)):r=new Promise(function(u){return n.pushes.push({resolve:u,value:e})});var s=!0,a={},l=r.catch(function(u){if(s)throw u});return a.then=function(u,o){return s=!1,Promise.prototype.then.call(r,u,o)},a.catch=function(u){return s=!1,Promise.prototype.catch.call(r,u)},a.finally=r.finally.bind(r),n.pending=e.then(function(){return l}).catch(function(u){n.err=u,Ot(n)}),a}function Yt(n){var t=gt.bind(null,n),e=new Promise(function(r){return n.onstop=r});return t.then=e.then.bind(e),t.catch=e.catch.bind(e),t.finally=e.finally.bind(e),t}function Kt(n){if(!(n.state>=St)){n.state=St;var t=Jt.bind(null,n),e=Yt(n);n.execution=new Promise(function(r){return r(n.executor(t,e))}),n.execution.catch(function(){return gt(n)})}}var W=new WeakMap,Z=(function(){function n(t,e){W.set(this,{executor:t,buffer:e,err:void 0,state:ut,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:Q,onstop:Q})}return n.prototype.next=function(t){dt(t);var e=W.get(this);if(e===void 0)throw new Error("WeakMap error");if(e.nexts.length>=K)throw new Nt("No more than "+K+" pending calls to next are allowed on a single repeater.");if(e.state<=ut&&Kt(e),e.onnext(t),typeof e.buffer<"u"&&!e.buffer.empty){var r=k(e,e.buffer.remove());if(e.pushes.length){var i=e.pushes.shift();e.buffer.add(i.value),e.onnext=i.resolve}return r}else if(e.pushes.length){var s=e.pushes.shift();return e.onnext=s.resolve,k(e,s.value)}else if(e.state>=L)return H(e),k(e,M(e));return new Promise(function(a){return e.nexts.push({resolve:a,value:t})})},n.prototype.return=function(t){dt(t);var e=W.get(this);if(e===void 0)throw new Error("WeakMap error");return H(e),e.execution=Promise.resolve(e.execution).then(function(){return t}),k(e,M(e))},n.prototype.throw=function(t){var e=W.get(this);if(e===void 0)throw new Error("WeakMap error");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))},n.prototype[Symbol.asyncIterator]=function(){return this},n.race=Qt,n.merge=te,n.zip=ee,n.latest=re,n})();function st(n,t){var e,r,i=[],s=function(o){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(){return Wt(this,arguments,function(){return C(this,function(h){switch(h.label){case 0:return t.yieldValues?[4,$(o)]:[3,3];case 1:return[4,h.sent()];case 2:h.sent(),h.label=3;case 3:return t.returnValues?[4,$(o)]:[3,5];case 4:return[2,h.sent()];case 5:return[2]}})})})())};try{for(var a=D(n),l=a.next();!l.done;l=a.next()){var u=l.value;s(u)}}catch(o){e={error:o}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i}function Qt(n){var t=this,e=st(n,{returnValues:!0});return new Z(function(r,i){return j(t,void 0,void 0,function(){var s,a,l,u,o,f;return C(this,function(c){switch(c.label){case 0:if(!e.length)return i(),[2];a=!1,i.then(function(){s(),a=!0}),c.label=1;case 1:c.trys.push([1,,5,7]),u=void 0,o=0,f=function(){var h,d,b,p,m,E;return C(this,function(S){switch(S.label){case 0:h=o;try{for(d=(m=void 0,D(e)),b=d.next();!b.done;b=d.next())p=b.value,Promise.resolve(p.next()).then(function(U){U.done?(i(),l===void 0&&(l=U)):o===h&&(o++,s(U))},function(U){return i(U)})}catch(U){m={error:U}}finally{try{b&&!b.done&&(E=d.return)&&E.call(d)}finally{if(m)throw m.error}}return[4,new Promise(function(U){return s=U})];case 1:return u=S.sent(),u===void 0?[3,3]:[4,r(u.value)];case 2:S.sent(),S.label=3;case 3:return[2]}})},c.label=2;case 2:return a?[3,4]:[5,f()];case 3:return c.sent(),[3,2];case 4:return[2,l&&l.value];case 5:return i(),[4,Promise.race(e.map(function(h){return h.return&&h.return()}))];case 6:return c.sent(),[7];case 7:return[2]}})})})}function te(n){var t=this,e=st(n,{yieldValues:!0});return new Z(function(r,i){return j(t,void 0,void 0,function(){var s,a,l,u=this;return C(this,function(o){switch(o.label){case 0:if(!e.length)return i(),[2];s=[],a=!1,i.then(function(){var f,c;a=!0;try{for(var h=D(s),d=h.next();!d.done;d=h.next()){var b=d.value;b()}}catch(p){f={error:p}}finally{try{d&&!d.done&&(c=h.return)&&c.call(h)}finally{if(f)throw f.error}}}),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,Promise.all(e.map(function(f,c){return j(u,void 0,void 0,function(){var h,d;return C(this,function(b){switch(b.label){case 0:b.trys.push([0,,6,9]),b.label=1;case 1:return a?[3,5]:(Promise.resolve(f.next()).then(function(p){return s[c](p)},function(p){return i(p)}),[4,new Promise(function(p){s[c]=p})]);case 2:return h=b.sent(),h===void 0?[3,4]:h.done?(l=h,[2]):[4,r(h.value)];case 3:b.sent(),b.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return d=f.return,d?[4,f.return()]:[3,8];case 7:d=b.sent(),b.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return o.sent(),[2,l&&l.value];case 3:return i(),[7];case 4:return[2]}})})})}function ee(n){var t=this,e=st(n,{returnValues:!0});return new Z(function(r,i){return j(t,void 0,void 0,function(){var s,a,l,u;return C(this,function(o){switch(o.label){case 0:if(!e.length)return i(),[2,[]];a=!1,i.then(function(){s(),a=!0}),o.label=1;case 1:o.trys.push([1,,6,8]),o.label=2;case 2:return a?[3,5]:(Promise.all(e.map(function(f){return f.next()})).then(function(f){return s(f)},function(f){return i(f)}),[4,new Promise(function(f){return s=f})]);case 3:return l=o.sent(),l===void 0?[2]:(u=l.map(function(f){return f.value}),l.some(function(f){return f.done})?[2,u]:[4,r(u)]);case 4:return o.sent(),[3,2];case 5:return[3,8];case 6:return i(),[4,Promise.all(e.map(function(f){return f.return&&f.return()}))];case 7:return o.sent(),[7];case 8:return[2]}})})})}function re(n){var t=this,e=st(n,{yieldValues:!0,returnValues:!0});return new Z(function(r,i){return j(t,void 0,void 0,function(){var s,a,l,u,o,f=this;return C(this,function(c){switch(c.label){case 0:if(!e.length)return i(),[2,[]];a=[],l=!1,i.then(function(){var h,d;s();try{for(var b=D(a),p=b.next();!p.done;p=b.next()){var m=p.value;m()}}catch(E){h={error:E}}finally{try{p&&!p.done&&(d=b.return)&&d.call(b)}finally{if(h)throw h.error}}l=!0}),c.label=1;case 1:return c.trys.push([1,,5,7]),Promise.all(e.map(function(h){return h.next()})).then(function(h){return s(h)},function(h){return i(h)}),[4,new Promise(function(h){return s=h})];case 2:return u=c.sent(),u===void 0?[2]:(o=u.map(function(h){return h.value}),u.every(function(h){return h.done})?[2,o]:[4,r(o.slice())]);case 3:return c.sent(),[4,Promise.all(e.map(function(h,d){return j(f,void 0,void 0,function(){var b;return C(this,function(p){switch(p.label){case 0:if(u[d].done)return[2,u[d].value];p.label=1;case 1:return l?[3,4]:(Promise.resolve(h.next()).then(function(m){return a[d](m)},function(m){return i(m)}),[4,new Promise(function(m){return a[d]=m})]);case 2:return b=p.sent(),b===void 0?[2,u[d].value]:b.done?[2,b.value]:(o[d]=b.value,[4,r(o.slice())]);case 3:return p.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,c.sent()];case 5:return i(),[4,Promise.all(e.map(function(h){return h.return&&h.return()}))];case 6:return c.sent(),[7];case 7:return[2]}})})})}class wt{headerClient;header;headerLength;indexLength;nocache;headers;constructor(t,e,r,i,s,a={}){this.headerClient=t,this.header=e,this.headerLength=r,this.indexLength=i,this.nocache=s,this.headers=a}static async open(t,e,r={}){let i,s=new Bt(t,e,r),a=2024+(()=>{let f,c=0;for(f=0;f<3;f++)c+=$t**f*Ht;return c})();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");if((i=new DataView(await s.getRange(8,4,a,"header")).getUint32(0,!0))>10485760||i<8)throw Error("Invalid header size");let l=await s.getRange(F.length,V+i,a,"header"),u=rt(new B(new Uint8Array(l)));if(u.indexNodeSize===0)throw Error("No index found, cannot read features filtered by bbox");let o=it(u.featuresCount,u.indexNodeSize);return new wt(s,u,i,o,e,r)}async*selectBbox(t){let e=this.lengthBeforeTree(),r=this.headerClient,i=async(u,o)=>r.getRange(e+u,o,0,"index"),s=[],a=[];for await(let u of Vt(this.header.featuresCount,this.header.indexNodeSize,t,i)){let[o,f]=u,[,,c]=u;if(c||(c=4),a.length===0){a.push([o,c,f]);continue}let h=a[a.length-1];o-(h[0]+h[1])>nt.global.extraRequestThreshold()&&(s.push(a),a=[]),a.push([o,c,f])}this.headerClient.logUsage("header+index"),a.length>0&&s.push(a);let l=s.flatMap(u=>this.readFeatureBatch(u,this.nocache));yield*Z.merge(l)}lengthBeforeTree(){return F.length+V+this.headerLength}lengthBeforeFeatures(){return this.lengthBeforeTree()+this.indexLength}buildFeatureClient(t){return new Bt(this.headerClient.httpClient,t,this.headers)}async*readFeatureBatch(t,e){let[r]=t[0],[i,s]=t[t.length-1],a=this.buildFeatureClient(e),l=i+s-r;for(let[u,,o]of t){let f=await this.readFeature(a,u,l);yield{id:o,feature:f},l=0}a.logUsage("feature")}async readFeature(t,e,r){let i,s=e+this.lengthBeforeFeatures();i=new DataView(await t.getRange(s,4,r,"feature length")).getUint32(0,!0);let a=new Uint8Array(await t.getRange(s+4,i,r,"feature data")),l=new Uint8Array(i+V);l.set(a,V);let u=new B(l);return x.getSizePrefixedRootAsFeature(u)}}class Bt{httpClient;bytesEverUsed=0;bytesEverFetched=0;buffer=new ArrayBuffer(0);head=0;constructor(t,e,r={}){if(typeof t=="string")this.httpClient=new Et(t,e,r);else if(t instanceof Et)this.httpClient=t;else throw Error("Unknown source")}async getRange(t,e,r,i){this.bytesEverUsed+=e;let s=t-this.head,a=s+e;if(s>=0&&a<=this.buffer.byteLength)return this.buffer.slice(s,a);let l=Math.max(e,r);return this.bytesEverFetched+=l,this.buffer=await this.httpClient.getRange(t,l,i),this.head=t,this.buffer.slice(0,e)}logUsage(t){t.split(" ")[0],(100*this.bytesEverUsed/this.bytesEverFetched).toFixed(2)}}class Et{url;nocache;headers;requestsEverMade=0;bytesEverRequested=0;constructor(t,e,r={}){this.url=t,this.nocache=e,this.headers=r}async getRange(t,e,r){this.requestsEverMade+=1,this.bytesEverRequested+=e;let i=`bytes=${t}-${t+e-1}`,s=new Headers(this.headers);return s.set("Range",i),this.nocache&&s.set("Cache-Control","no-cache, no-store"),await(await fetch(this.url,{headers:s})).arrayBuffer()}}function ne(n){let t;for(let e of n){if(t===I.Unknown)break;let r=e.getGeometry?J(e.getGeometry().getType()):J(e.geometry.type);t===void 0?t=r:t!==r&&(t=I.Unknown)}if(t===void 0)throw Error("Could not infer geometry type for collection of features.");return t}async function*ie(n,t,e,r){if(!n.subarray(0,3).every((c,h)=>F[h]===c))throw Error("Not a FlatGeobuf file");if(e){let c=yt.open(n);for await(let h of c.selectBbox(e))yield t(h.id,h.feature,c.header);return}let i=new B(n),s=i.readUint32(F.length);i.setPosition(F.length);let a=rt(i);r&&r(a);let l=F.length+V+s,{indexNodeSize:u,featuresCount:o}=a;u>0&&(l+=it(o,u));let f=0;for(;l<i.capacity();){let c=i.readUint32(l);i.setPosition(l);let h=x.getSizePrefixedRootAsFeature(i);yield t(f++,h,a),l+=V+c}}async function*se(n,t,e){let r,i=Gt(n),s=async p=>await i.slice(p),a=new Uint8Array(await s(8));if(!a.subarray(0,3).every((p,m)=>F[m]===p))throw Error("Not a FlatGeobuf file");let l=new Uint8Array(await s(4)),u=new B(l),o=u.readUint32(0),f=new Uint8Array(await s(o));(a=new Uint8Array(l.length+f.length)).set(l),a.set(f,l.length);let c=rt(u=new B(a));e&&e(c);let{indexNodeSize:h,featuresCount:d}=c;if(h>0){let p=it(d,h);await s(p)}let b=0;for(;r=await oe(s,c,t,b++);)yield r}async function*ae(n,t,e,r,i=!1,s={}){let a=await wt.open(n,i,s);for await(let l of(r&&r(a.header),a.selectBbox(t)))yield e(l.id,l.feature,a.header)}async function oe(n,t,e,r){let i=new Uint8Array(await n(4,"feature length"));if(i.byteLength===0)return;let s=new B(i),a=s.readUint32(0);i=new Uint8Array(await n(a,"feature data"));let l=new Uint8Array(a+4);return l.set(i,4),s=new B(l),e(r,x.getSizePrefixedRootAsFeature(s),t)}function le(n,t=0){let e,r=new tt,i=0;n.columns&&(i=O.createColumnsVector(r,n.columns.map(l=>{let u;return u=r.createString(l.name),v.startColumn(r),v.addName(r,u),v.addType(r,l.type),v.endColumn(r)})));let s=r.createString("L1");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);let a=O.endHeader(r);return r.finishSizePrefixed(a),r.asUint8Array()}function ue(n,t){return{name:t,type:(function(e){if(typeof e=="boolean")return y.Bool;if(typeof e=="number")return y.Double;if(typeof e=="string"||e===null)return y.String;if(e instanceof Uint8Array)return y.Binary;if(typeof e=="object")return y.Json;throw Error(`Unknown type (value '${e}')`)})(n[t]),title:null,description:null,width:-1,precision:-1,scale:-1,nullable:!0,unique:!1,primary_key:!1}}function mt(n){let t,e,r=n.coordinates,i=[],s=[],a=J(n.type),l=0;switch(n.type){case"Point":case"MultiPoint":case"LineString":ft(r,i,s);break;case"MultiLineString":case"Polygon":ft(r,i,s),r.length>1&&(t=r.map(u=>l+=u.length));break;case"MultiPolygon":e=r.map(u=>({type:"Polygon",coordinates:u})).map(mt)}return{xy:i,z:s.length>0?s:void 0,ends:t,type:a,parts:e}}function At(n){let t=J(n.type),e=[];for(let r=0;r<n.geometries.length;r++){let i=n.geometries[r];i.type==="GeometryCollection"?e.push(At(i)):e.push(mt(i))}return{type:t,parts:e}}function pt(n,t){let e=t;if(e===I.Unknown&&(e=n.type()),e===I.GeometryCollection){let i=[];for(let s=0;s<n.partsLength();s++){let a=n.parts(s),l=a.type();i.push(pt(a,l))}return{type:I[e],geometries:i}}if(e===I.MultiPolygon){let i=[];for(let s=0;s<n.partsLength();s++)i.push(pt(n.parts(s),I.Polygon));return{type:I[e],coordinates:i.map(s=>s.coordinates)}}let r=(function(i,s){let a=i.xyArray(),l=i.zArray();switch(s){case I.Point:{let u=Array.from(a);return l&&u.push(l[0]),u}case I.MultiPoint:case I.LineString:return lt(a,l);case I.MultiLineString:case I.Polygon:return(function(u,o,f){let c;if(!f||f.length===0)return[lt(u,o)];let h=0,d=Array.from(f).map(b=>u.slice(h,h=b<<1));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))})(a,l,i.endsArray())}})(n,e);return{type:I[e],coordinates:r}}function vt(n,t,e){let r=e.columns;return{type:"Feature",id:n,geometry:pt(t.geometry(),e.geometryType),properties:Rt(t,r)}}function he(n,t=0){var e;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=>zt(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);o.set(a,F.length);let f=F.length+a.length;for(let c of l)o.set(c,f),f+=c.length;return o.set(F),o}async function*fe(n,t,e){yield*ie(n,vt,t,e)}function ce(n,t){return se(n,vt,t)}function de(n,t,e,r=!1,i={}){return ae(n,t,vt,e,r,i)}function be(n,t=0){return he(n,t)}function pe(n,t,e,r=!1,i={}){return n instanceof Uint8Array?fe(n,t,e):n instanceof ReadableStream?ce(n,e):de(n,t,e,r,i)}exports.deserialize=pe;exports.serialize=be;
|