maplibre-gl-components 0.16.2 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/README.md +4 -3
  2. package/dist/{ControlGrid-DQ4w_Nf9.js → ControlGrid-C6zp03Vq.js} +125375 -115454
  3. package/dist/ControlGrid-DIAcXRBe.cjs +17278 -0
  4. package/dist/DuckDBConverter-5a2FWwmf.js +354 -0
  5. package/dist/DuckDBConverter-pfXSUi_l.cjs +23 -0
  6. package/dist/ShapefileConverter-DGCXPY_S.cjs +1 -0
  7. package/dist/ShapefileConverter-DN3fVOuo.js +102 -0
  8. package/dist/basedecoder-BliCKuUS.js +62 -0
  9. package/dist/basedecoder-Zw0CbD9L.cjs +1 -0
  10. package/dist/deflate-DBL0msKQ.js +10 -0
  11. package/dist/deflate-DNeBKDsy.cjs +1 -0
  12. package/dist/esm-Bp6m44bk.js +811 -0
  13. package/dist/esm-oEp_aN1n.cjs +1 -0
  14. package/dist/geojson-Bnoe76Pm.js +2002 -0
  15. package/dist/geojson-CxMdRvJX.cjs +1 -0
  16. package/dist/geotiff-Bzy-Zyc2.js +1882 -0
  17. package/dist/geotiff-DYylEFA9.cjs +8 -0
  18. package/dist/globals-B4iCNAg9.cjs +1 -0
  19. package/dist/globals-BKIWameS.js +572 -0
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.mjs +150 -147
  22. package/dist/jpeg-B6Sg6W8k.cjs +1 -0
  23. package/dist/jpeg-CJcNvScS.js +545 -0
  24. package/dist/lerc-2QwcA_K7.js +840 -0
  25. package/dist/lerc-DQRITnja.cjs +1 -0
  26. package/dist/lib-B4jvG7hB.cjs +4 -0
  27. package/dist/lib-CNQtqzfc.js +4060 -0
  28. package/dist/lzw-1HaU0PJK.cjs +1 -0
  29. package/dist/lzw-DF5VHuii.js +76 -0
  30. package/dist/main-dist-CbHNdsir.js +18314 -0
  31. package/dist/main-dist-DOx_Axbx.cjs +2 -0
  32. package/dist/maplibre-geoman.es-C0F1ydoG.cjs +213 -0
  33. package/dist/maplibre-geoman.es-D1CztSQd.js +27213 -0
  34. package/dist/maplibre-gl-components.css +2 -1
  35. package/dist/packbits-CK8RPU_B.js +22 -0
  36. package/dist/packbits-D5Zovac7.cjs +1 -0
  37. package/dist/pako.esm-DFyPB7cO.cjs +1 -0
  38. package/dist/pako.esm-hTfpTBhd.js +1536 -0
  39. package/dist/raw-Brljg6vy.js +9 -0
  40. package/dist/raw-C-CSxCoU.cjs +1 -0
  41. package/dist/react.cjs +1 -1
  42. package/dist/react.mjs +1357 -1004
  43. package/dist/{types → src}/lib/core/CogLayer.d.ts.map +1 -1
  44. package/dist/{types → src}/lib/core/PMTilesLayer.d.ts.map +1 -1
  45. package/dist/{types → src}/lib/core/SpinGlobeControl.d.ts +6 -7
  46. package/dist/src/lib/core/SpinGlobeControl.d.ts.map +1 -0
  47. package/dist/{types → src}/lib/core/StacLayer.d.ts.map +1 -1
  48. package/dist/{types → src}/lib/core/types.d.ts +3 -1
  49. package/dist/{types → src}/lib/core/types.d.ts.map +1 -1
  50. package/dist/{types → src}/lib/utils/color.d.ts +8 -0
  51. package/dist/src/lib/utils/color.d.ts.map +1 -0
  52. package/dist/{types → src}/lib/utils/index.d.ts +1 -1
  53. package/dist/{types → src}/lib/utils/index.d.ts.map +1 -1
  54. package/dist/webimage-Bh2pNwjN.cjs +1 -0
  55. package/dist/webimage-rg-Z9Sbn.js +25 -0
  56. package/dist/zstd-B3Xa90HD.cjs +1 -0
  57. package/dist/zstd-BwwN0X3K.js +51 -0
  58. package/package.json +66 -53
  59. package/dist/ControlGrid-Bukna_at.cjs +0 -17062
  60. package/dist/DuckDBConverter-B98M0DFs.cjs +0 -23
  61. package/dist/DuckDBConverter-RPq48-t0.js +0 -434
  62. package/dist/ShapefileConverter-AjbEjEyq.cjs +0 -1
  63. package/dist/ShapefileConverter-trvt8J3z.js +0 -125
  64. package/dist/decoder-CLokFc0V.js +0 -8
  65. package/dist/decoder-D9LU4bUo.cjs +0 -1
  66. package/dist/deflate-Bay-vzHJ.cjs +0 -1
  67. package/dist/deflate-yeu3ogBn.js +0 -10
  68. package/dist/geojson-BQSVgKFt.cjs +0 -1
  69. package/dist/geojson-BSUuDj5k.js +0 -2551
  70. package/dist/geotiff-BNxc90fm.cjs +0 -8
  71. package/dist/geotiff-BUZniE5g.js +0 -3105
  72. package/dist/index-8ZZtuDTp.js +0 -705
  73. package/dist/index-DQXdX5y1.js +0 -4666
  74. package/dist/index-Dh1kpCb6.cjs +0 -1
  75. package/dist/index-IrsIiQNM.cjs +0 -4
  76. package/dist/jpeg-B7yImnpY.js +0 -533
  77. package/dist/jpeg-BiN8bMT5.cjs +0 -1
  78. package/dist/lerc-BvSjGMM2.cjs +0 -1
  79. package/dist/lerc-CqgA9njy.js +0 -1031
  80. package/dist/lzw-C-_B7Jis.cjs +0 -1
  81. package/dist/lzw-DL9RcHOz.js +0 -84
  82. package/dist/main-dist-Bymiy5aM.cjs +0 -2
  83. package/dist/main-dist-Cv8AKwrY.js +0 -629
  84. package/dist/maplibre-geoman.es-Bxdg-2EU.cjs +0 -129
  85. package/dist/maplibre-geoman.es-CFgM2ajb.js +0 -22827
  86. package/dist/packbits-DRGSjtn-.cjs +0 -1
  87. package/dist/packbits-YEJGULcy.js +0 -24
  88. package/dist/pako.esm-Bx5X36Wo.js +0 -1074
  89. package/dist/pako.esm-DZC2QrbJ.cjs +0 -1
  90. package/dist/raw-CoQHiEnn.js +0 -9
  91. package/dist/raw-D6OidBKc.cjs +0 -1
  92. package/dist/types/lib/core/SpinGlobeControl.d.ts.map +0 -1
  93. package/dist/types/lib/utils/color.d.ts.map +0 -1
  94. package/dist/webimage-BXLN-zu8.js +0 -19
  95. package/dist/webimage-mWTez3Wv.cjs +0 -1
  96. /package/dist/{types → src}/index.d.ts +0 -0
  97. /package/dist/{types → src}/index.d.ts.map +0 -0
  98. /package/dist/{types → src}/lib/adapters/AddVectorAdapter.d.ts +0 -0
  99. /package/dist/{types → src}/lib/adapters/AddVectorAdapter.d.ts.map +0 -0
  100. /package/dist/{types → src}/lib/adapters/CogLayerAdapter.d.ts +0 -0
  101. /package/dist/{types → src}/lib/adapters/CogLayerAdapter.d.ts.map +0 -0
  102. /package/dist/{types → src}/lib/adapters/PMTilesLayerAdapter.d.ts +0 -0
  103. /package/dist/{types → src}/lib/adapters/PMTilesLayerAdapter.d.ts.map +0 -0
  104. /package/dist/{types → src}/lib/adapters/StacLayerAdapter.d.ts +0 -0
  105. /package/dist/{types → src}/lib/adapters/StacLayerAdapter.d.ts.map +0 -0
  106. /package/dist/{types → src}/lib/adapters/ZarrLayerAdapter.d.ts +0 -0
  107. /package/dist/{types → src}/lib/adapters/ZarrLayerAdapter.d.ts.map +0 -0
  108. /package/dist/{types → src}/lib/adapters/index.d.ts +0 -0
  109. /package/dist/{types → src}/lib/adapters/index.d.ts.map +0 -0
  110. /package/dist/{types → src}/lib/addControlGrid.d.ts +0 -0
  111. /package/dist/{types → src}/lib/addControlGrid.d.ts.map +0 -0
  112. /package/dist/{types → src}/lib/colormaps/diverging.d.ts +0 -0
  113. /package/dist/{types → src}/lib/colormaps/diverging.d.ts.map +0 -0
  114. /package/dist/{types → src}/lib/colormaps/index.d.ts +0 -0
  115. /package/dist/{types → src}/lib/colormaps/index.d.ts.map +0 -0
  116. /package/dist/{types → src}/lib/colormaps/misc.d.ts +0 -0
  117. /package/dist/{types → src}/lib/colormaps/misc.d.ts.map +0 -0
  118. /package/dist/{types → src}/lib/colormaps/sequential.d.ts +0 -0
  119. /package/dist/{types → src}/lib/colormaps/sequential.d.ts.map +0 -0
  120. /package/dist/{types → src}/lib/converters/DuckDBConverter.d.ts +0 -0
  121. /package/dist/{types → src}/lib/converters/DuckDBConverter.d.ts.map +0 -0
  122. /package/dist/{types → src}/lib/converters/ShapefileConverter.d.ts +0 -0
  123. /package/dist/{types → src}/lib/converters/ShapefileConverter.d.ts.map +0 -0
  124. /package/dist/{types → src}/lib/converters/index.d.ts +0 -0
  125. /package/dist/{types → src}/lib/converters/index.d.ts.map +0 -0
  126. /package/dist/{types → src}/lib/converters/types.d.ts +0 -0
  127. /package/dist/{types → src}/lib/converters/types.d.ts.map +0 -0
  128. /package/dist/{types → src}/lib/core/AddVector.d.ts +0 -0
  129. /package/dist/{types → src}/lib/core/AddVector.d.ts.map +0 -0
  130. /package/dist/{types → src}/lib/core/Basemap.d.ts +0 -0
  131. /package/dist/{types → src}/lib/core/Basemap.d.ts.map +0 -0
  132. /package/dist/{types → src}/lib/core/BasemapReact.d.ts +0 -0
  133. /package/dist/{types → src}/lib/core/BasemapReact.d.ts.map +0 -0
  134. /package/dist/{types → src}/lib/core/BookmarkControl.d.ts +0 -0
  135. /package/dist/{types → src}/lib/core/BookmarkControl.d.ts.map +0 -0
  136. /package/dist/{types → src}/lib/core/ChoroplethControl.d.ts +0 -0
  137. /package/dist/{types → src}/lib/core/ChoroplethControl.d.ts.map +0 -0
  138. /package/dist/{types → src}/lib/core/CogLayer.d.ts +0 -0
  139. /package/dist/{types → src}/lib/core/CogLayerReact.d.ts +0 -0
  140. /package/dist/{types → src}/lib/core/CogLayerReact.d.ts.map +0 -0
  141. /package/dist/{types → src}/lib/core/Colorbar.d.ts +0 -0
  142. /package/dist/{types → src}/lib/core/Colorbar.d.ts.map +0 -0
  143. /package/dist/{types → src}/lib/core/ColorbarGuiControl.d.ts +0 -0
  144. /package/dist/{types → src}/lib/core/ColorbarGuiControl.d.ts.map +0 -0
  145. /package/dist/{types → src}/lib/core/ColorbarReact.d.ts +0 -0
  146. /package/dist/{types → src}/lib/core/ColorbarReact.d.ts.map +0 -0
  147. /package/dist/{types → src}/lib/core/ControlGrid.d.ts +0 -0
  148. /package/dist/{types → src}/lib/core/ControlGrid.d.ts.map +0 -0
  149. /package/dist/{types → src}/lib/core/ControlGridReact.d.ts +0 -0
  150. /package/dist/{types → src}/lib/core/ControlGridReact.d.ts.map +0 -0
  151. /package/dist/{types → src}/lib/core/HtmlControl.d.ts +0 -0
  152. /package/dist/{types → src}/lib/core/HtmlControl.d.ts.map +0 -0
  153. /package/dist/{types → src}/lib/core/HtmlControlReact.d.ts +0 -0
  154. /package/dist/{types → src}/lib/core/HtmlControlReact.d.ts.map +0 -0
  155. /package/dist/{types → src}/lib/core/HtmlGuiControl.d.ts +0 -0
  156. /package/dist/{types → src}/lib/core/HtmlGuiControl.d.ts.map +0 -0
  157. /package/dist/{types → src}/lib/core/InspectControl.d.ts +0 -0
  158. /package/dist/{types → src}/lib/core/InspectControl.d.ts.map +0 -0
  159. /package/dist/{types → src}/lib/core/InspectControlReact.d.ts +0 -0
  160. /package/dist/{types → src}/lib/core/InspectControlReact.d.ts.map +0 -0
  161. /package/dist/{types → src}/lib/core/Legend.d.ts +0 -0
  162. /package/dist/{types → src}/lib/core/Legend.d.ts.map +0 -0
  163. /package/dist/{types → src}/lib/core/LegendGuiControl.d.ts +0 -0
  164. /package/dist/{types → src}/lib/core/LegendGuiControl.d.ts.map +0 -0
  165. /package/dist/{types → src}/lib/core/LegendReact.d.ts +0 -0
  166. /package/dist/{types → src}/lib/core/LegendReact.d.ts.map +0 -0
  167. /package/dist/{types → src}/lib/core/MeasureControl.d.ts +0 -0
  168. /package/dist/{types → src}/lib/core/MeasureControl.d.ts.map +0 -0
  169. /package/dist/{types → src}/lib/core/MinimapControl.d.ts +0 -0
  170. /package/dist/{types → src}/lib/core/MinimapControl.d.ts.map +0 -0
  171. /package/dist/{types → src}/lib/core/MinimapControlReact.d.ts +0 -0
  172. /package/dist/{types → src}/lib/core/MinimapControlReact.d.ts.map +0 -0
  173. /package/dist/{types → src}/lib/core/PMTilesLayer.d.ts +0 -0
  174. /package/dist/{types → src}/lib/core/PrintControl.d.ts +0 -0
  175. /package/dist/{types → src}/lib/core/PrintControl.d.ts.map +0 -0
  176. /package/dist/{types → src}/lib/core/SearchControl.d.ts +0 -0
  177. /package/dist/{types → src}/lib/core/SearchControl.d.ts.map +0 -0
  178. /package/dist/{types → src}/lib/core/SearchControlReact.d.ts +0 -0
  179. /package/dist/{types → src}/lib/core/SearchControlReact.d.ts.map +0 -0
  180. /package/dist/{types → src}/lib/core/StacLayer.d.ts +0 -0
  181. /package/dist/{types → src}/lib/core/StacSearch.d.ts +0 -0
  182. /package/dist/{types → src}/lib/core/StacSearch.d.ts.map +0 -0
  183. /package/dist/{types → src}/lib/core/Terrain.d.ts +0 -0
  184. /package/dist/{types → src}/lib/core/Terrain.d.ts.map +0 -0
  185. /package/dist/{types → src}/lib/core/TerrainReact.d.ts +0 -0
  186. /package/dist/{types → src}/lib/core/TerrainReact.d.ts.map +0 -0
  187. /package/dist/{types → src}/lib/core/TileLayerControl.d.ts +0 -0
  188. /package/dist/{types → src}/lib/core/TileLayerControl.d.ts.map +0 -0
  189. /package/dist/{types → src}/lib/core/VectorDataset.d.ts +0 -0
  190. /package/dist/{types → src}/lib/core/VectorDataset.d.ts.map +0 -0
  191. /package/dist/{types → src}/lib/core/VectorDatasetReact.d.ts +0 -0
  192. /package/dist/{types → src}/lib/core/VectorDatasetReact.d.ts.map +0 -0
  193. /package/dist/{types → src}/lib/core/ViewStateControl.d.ts +0 -0
  194. /package/dist/{types → src}/lib/core/ViewStateControl.d.ts.map +0 -0
  195. /package/dist/{types → src}/lib/core/ViewStateControlReact.d.ts +0 -0
  196. /package/dist/{types → src}/lib/core/ViewStateControlReact.d.ts.map +0 -0
  197. /package/dist/{types → src}/lib/core/ZarrLayer.d.ts +0 -0
  198. /package/dist/{types → src}/lib/core/ZarrLayer.d.ts.map +0 -0
  199. /package/dist/{types → src}/lib/hooks/index.d.ts +0 -0
  200. /package/dist/{types → src}/lib/hooks/index.d.ts.map +0 -0
  201. /package/dist/{types → src}/lib/hooks/useBasemap.d.ts +0 -0
  202. /package/dist/{types → src}/lib/hooks/useBasemap.d.ts.map +0 -0
  203. /package/dist/{types → src}/lib/hooks/useCogLayer.d.ts +0 -0
  204. /package/dist/{types → src}/lib/hooks/useCogLayer.d.ts.map +0 -0
  205. /package/dist/{types → src}/lib/hooks/useColorbar.d.ts +0 -0
  206. /package/dist/{types → src}/lib/hooks/useColorbar.d.ts.map +0 -0
  207. /package/dist/{types → src}/lib/hooks/useControlGrid.d.ts +0 -0
  208. /package/dist/{types → src}/lib/hooks/useControlGrid.d.ts.map +0 -0
  209. /package/dist/{types → src}/lib/hooks/useHtmlControl.d.ts +0 -0
  210. /package/dist/{types → src}/lib/hooks/useHtmlControl.d.ts.map +0 -0
  211. /package/dist/{types → src}/lib/hooks/useInspectControl.d.ts +0 -0
  212. /package/dist/{types → src}/lib/hooks/useInspectControl.d.ts.map +0 -0
  213. /package/dist/{types → src}/lib/hooks/useLegend.d.ts +0 -0
  214. /package/dist/{types → src}/lib/hooks/useLegend.d.ts.map +0 -0
  215. /package/dist/{types → src}/lib/hooks/useMinimapControl.d.ts +0 -0
  216. /package/dist/{types → src}/lib/hooks/useMinimapControl.d.ts.map +0 -0
  217. /package/dist/{types → src}/lib/hooks/useSearchControl.d.ts +0 -0
  218. /package/dist/{types → src}/lib/hooks/useSearchControl.d.ts.map +0 -0
  219. /package/dist/{types → src}/lib/hooks/useTerrain.d.ts +0 -0
  220. /package/dist/{types → src}/lib/hooks/useTerrain.d.ts.map +0 -0
  221. /package/dist/{types → src}/lib/hooks/useVectorDataset.d.ts +0 -0
  222. /package/dist/{types → src}/lib/hooks/useVectorDataset.d.ts.map +0 -0
  223. /package/dist/{types → src}/lib/hooks/useViewState.d.ts +0 -0
  224. /package/dist/{types → src}/lib/hooks/useViewState.d.ts.map +0 -0
  225. /package/dist/{types → src}/lib/utils/fileHelpers.d.ts +0 -0
  226. /package/dist/{types → src}/lib/utils/fileHelpers.d.ts.map +0 -0
  227. /package/dist/{types → src}/lib/utils/helpers.d.ts +0 -0
  228. /package/dist/{types → src}/lib/utils/helpers.d.ts.map +0 -0
  229. /package/dist/{types → src}/lib/utils/providers.d.ts +0 -0
  230. /package/dist/{types → src}/lib/utils/providers.d.ts.map +0 -0
  231. /package/dist/{types → src}/react.d.ts +0 -0
  232. /package/dist/{types → src}/react.d.ts.map +0 -0
@@ -1,8 +0,0 @@
1
- "use strict";function T(r){return(e,...t)=>Ft(r,e,t)}function q(r,e){return T(je(r,e).get)}const{apply:Ft,getOwnPropertyDescriptor:je,getPrototypeOf:De,ownKeys:kt}=Reflect,{iterator:J,toStringTag:Rt}=Symbol,Bt=Object,{create:Ee,defineProperty:Mt}=Bt,Gt=Array,Ut=Gt.prototype,He=Ut[J],_t=T(He),Ye=ArrayBuffer,vt=Ye.prototype;q(vt,"byteLength");const Ue=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;Ue&&q(Ue.prototype,"byteLength");const $e=De(Uint8Array);$e.from;const E=$e.prototype;E[J];T(E.keys);T(E.values);T(E.entries);T(E.set);T(E.reverse);T(E.fill);T(E.copyWithin);T(E.sort);T(E.slice);T(E.subarray);q(E,"buffer");q(E,"byteOffset");q(E,"length");q(E,Rt);const Lt=Uint8Array,Xe=Uint16Array,Oe=Uint32Array,Nt=Float32Array,Z=De([][J]()),Ze=T(Z.next),Kt=T((function*(){})().next),qt=De(Z),zt=DataView.prototype,Vt=T(zt.getUint16),Pe=WeakMap,Je=Pe.prototype,Qe=T(Je.get),jt=T(Je.set),We=new Pe,Ht=Ee(null,{next:{value:function(){const e=Qe(We,this);return Ze(e)}},[J]:{value:function(){return this}}});function Yt(r){if(r[J]===He&&Z.next===Ze)return r;const e=Ee(Ht);return jt(We,e,_t(r)),e}const $t=new Pe,Xt=Ee(qt,{next:{value:function(){const e=Qe($t,this);return Kt(e)},writable:!0,configurable:!0}});for(const r of kt(Z))r!=="next"&&Mt(Xt,r,je(Z,r));const et=new Ye(4),Zt=new Nt(et),Jt=new Oe(et),R=new Xe(512),B=new Lt(512);for(let r=0;r<256;++r){const e=r-127;e<-24?(R[r]=0,R[r|256]=32768,B[r]=24,B[r|256]=24):e<-14?(R[r]=1024>>-e-14,R[r|256]=1024>>-e-14|32768,B[r]=-e-1,B[r|256]=-e-1):e<=15?(R[r]=e+15<<10,R[r|256]=e+15<<10|32768,B[r]=13,B[r|256]=13):e<128?(R[r]=31744,R[r|256]=64512,B[r]=24,B[r|256]=24):(R[r]=31744,R[r|256]=64512,B[r]=13,B[r|256]=13)}const Ce=new Oe(2048);for(let r=1;r<1024;++r){let e=r<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Ce[r]=e|t}for(let r=1024;r<2048;++r)Ce[r]=939524096+(r-1024<<13);const z=new Oe(64);for(let r=1;r<31;++r)z[r]=r<<23;z[31]=1199570944;z[32]=2147483648;for(let r=33;r<63;++r)z[r]=2147483648+(r-32<<23);z[63]=3347054592;const tt=new Xe(64);for(let r=1;r<64;++r)r!==32&&(tt[r]=1024);function Qt(r){const e=r>>10;return Jt[0]=Ce[tt[e]+(r&1023)]+z[e],Zt[0]}function rt(r,e,...t){return Qt(Vt(r,e,...Yt(t)))}function Fe(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ne={exports:{}},_e;function Wt(){if(_e)return ne.exports;_e=1;function r(e,t,s){const n=s&&s.debug||!1;n&&console.log("[xml-utils] getting "+t+" in "+e);const i=typeof e=="object"?e.outer:e,a=i.slice(0,i.indexOf(">")+1),o=['"',"'"];for(let l=0;l<o.length;l++){const c=o[l],f=t+"\\="+c+"([^"+c+"]*)"+c;n&&console.log("[xml-utils] pattern:",f);const u=new RegExp(f).exec(a);if(n&&console.log("[xml-utils] match:",u),u)return u[1]}}return ne.exports=r,ne.exports.default=r,ne.exports}var er=Wt();const Se=Fe(er);var ie={exports:{}},oe={exports:{}},ae={exports:{}},ve;function tr(){if(ve)return ae.exports;ve=1;function r(e,t,s){const i=new RegExp(t).exec(e.slice(s));return i?s+i.index:-1}return ae.exports=r,ae.exports.default=r,ae.exports}var le={exports:{}},Le;function rr(){if(Le)return le.exports;Le=1;function r(e,t,s){const i=new RegExp(t).exec(e.slice(s));return i?s+i.index+i[0].length-1:-1}return le.exports=r,le.exports.default=r,le.exports}var ce={exports:{}},Ne;function sr(){if(Ne)return ce.exports;Ne=1;function r(e,t){const s=new RegExp(t,"g"),n=e.match(s);return n?n.length:0}return ce.exports=r,ce.exports.default=r,ce.exports}var Ke;function nr(){if(Ke)return oe.exports;Ke=1;const r=tr(),e=rr(),t=sr();function s(n,i,a){const o=a&&a.debug||!1,l=!(a&&typeof a.nested===!1),c=a&&a.startIndex||0;o&&console.log("[xml-utils] starting findTagByName with",i," and ",a);const f=r(n,`<${i}[
2
- >/]`,c);if(o&&console.log("[xml-utils] start:",f),f===-1)return;const h=n.slice(f+i.length);let u=e(h,"^[^<]*[ /]>",0);const d=u!==-1&&h[u-1]==="/";if(o&&console.log("[xml-utils] selfClosing:",d),d===!1)if(l){let x=0,w=1,S=0;for(;(u=e(h,"[ /]"+i+">",x))!==-1;){const I=h.substring(x,u+1);if(w+=t(I,"<"+i+`[
3
- >]`),S+=t(I,"</"+i+">"),S>=w)break;x=u}}else u=e(h,"[ /]"+i+">",0);const g=f+i.length+u+1;if(o&&console.log("[xml-utils] end:",g),g===-1)return;const y=n.slice(f,g);let p;return d?p=null:p=y.slice(y.indexOf(">")+1,y.lastIndexOf("<")),{inner:p,outer:y,start:f,end:g}}return oe.exports=s,oe.exports.default=s,oe.exports}var qe;function ir(){if(qe)return ie.exports;qe=1;const r=nr();function e(t,s,n){const i=[],a=n&&n.debug||!1,o=n&&typeof n.nested=="boolean"?n.nested:!0;let l=n&&n.startIndex||0,c;for(;c=r(t,s,{debug:a,startIndex:l});)o?l=c.start+1+s.length:l=c.end,i.push(c);return a&&console.log("findTagsByName found",i.length,"tags"),i}return ie.exports=e,ie.exports.default=e,ie.exports}var or=ir();const ar=Fe(or),U={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},F={};for(const r in U)U.hasOwnProperty(r)&&(F[U[r]]=parseInt(r,10));const ue={256:"SHORT",257:"SHORT",258:"SHORT",259:"SHORT",262:"SHORT",273:"LONG",274:"SHORT",277:"SHORT",278:"LONG",279:"LONG",282:"RATIONAL",283:"RATIONAL",284:"SHORT",286:"SHORT",287:"RATIONAL",296:"SHORT",297:"SHORT",305:"ASCII",306:"ASCII",338:"SHORT",339:"SHORT",513:"LONG",514:"LONG",1024:"SHORT",1025:"SHORT",2048:"SHORT",2049:"ASCII",3072:"SHORT",3073:"ASCII",33550:"DOUBLE",33922:"DOUBLE",34264:"DOUBLE",34665:"LONG",34735:"SHORT",34736:"DOUBLE",34737:"ASCII",42113:"ASCII"},st=[F.BitsPerSample,F.ExtraSamples,F.SampleFormat,F.StripByteCounts,F.StripOffsets,F.StripRowCounts,F.TileByteCounts,F.TileOffsets,F.SubIFDs],X={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},m={};for(const r in X)X.hasOwnProperty(r)&&(m[X[r]]=parseInt(r,10));const P={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},nt={Unspecified:0,Assocalpha:1,Unassalpha:2},it={Version:0,AddCompression:1},ot={None:0,Deflate:1,Zstandard:2},L={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},at={};for(const r in L)L.hasOwnProperty(r)&&(at[L[r]]=parseInt(r,10));const lr=Object.freeze(Object.defineProperty({__proto__:null,ExtraSamplesValues:nt,LercAddCompression:ot,LercParameters:it,arrayFields:st,fieldTagNames:U,fieldTagTypes:ue,fieldTags:F,fieldTypeNames:X,fieldTypes:m,geoKeyNames:L,geoKeys:at,photometricInterpretations:P},Symbol.toStringTag,{value:"Module"}));function lt(r,e){const{width:t,height:s}=r,n=new Uint8Array(t*s*3);let i;for(let a=0,o=0;a<r.length;++a,o+=3)i=256-r[a]/e*256,n[o]=i,n[o+1]=i,n[o+2]=i;return n}function ct(r,e){const{width:t,height:s}=r,n=new Uint8Array(t*s*3);let i;for(let a=0,o=0;a<r.length;++a,o+=3)i=r[a]/e*256,n[o]=i,n[o+1]=i,n[o+2]=i;return n}function ft(r,e){const{width:t,height:s}=r,n=new Uint8Array(t*s*3),i=e.length/3,a=e.length/3*2;for(let o=0,l=0;o<r.length;++o,l+=3){const c=r[o];n[l]=e[c]/65536*256,n[l+1]=e[c+i]/65536*256,n[l+2]=e[c+a]/65536*256}return n}function ht(r){const{width:e,height:t}=r,s=new Uint8Array(e*t*3);for(let n=0,i=0;n<r.length;n+=4,i+=3){const a=r[n],o=r[n+1],l=r[n+2],c=r[n+3];s[i]=255*((255-a)/256)*((255-c)/256),s[i+1]=255*((255-o)/256)*((255-c)/256),s[i+2]=255*((255-l)/256)*((255-c)/256)}return s}function ut(r){const{width:e,height:t}=r,s=new Uint8ClampedArray(e*t*3);for(let n=0,i=0;n<r.length;n+=3,i+=3){const a=r[n],o=r[n+1],l=r[n+2];s[i]=a+1.402*(l-128),s[i+1]=a-.34414*(o-128)-.71414*(l-128),s[i+2]=a+1.772*(o-128)}return s}const cr=.95047,fr=1,hr=1.08883;function gt(r){const{width:e,height:t}=r,s=new Uint8Array(e*t*3);for(let n=0,i=0;n<r.length;n+=3,i+=3){const a=r[n+0],o=r[n+1]<<24>>24,l=r[n+2]<<24>>24;let c=(a+16)/116,f=o/500+c,h=c-l/200,u,d,g;f=cr*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),c=fr*(c*c*c>.008856?c*c*c:(c-16/116)/7.787),h=hr*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),u=f*3.2406+c*-1.5372+h*-.4986,d=f*-.9689+c*1.8758+h*.0415,g=f*.0557+c*-.204+h*1.057,u=u>.0031308?1.055*u**(1/2.4)-.055:12.92*u,d=d>.0031308?1.055*d**(1/2.4)-.055:12.92*d,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,s[i]=Math.max(0,Math.min(1,u))*255,s[i+1]=Math.max(0,Math.min(1,d))*255,s[i+2]=Math.max(0,Math.min(1,g))*255}return s}const ur=Object.freeze(Object.defineProperty({__proto__:null,fromBlackIsZero:ct,fromCIELab:gt,fromCMYK:ht,fromPalette:ft,fromWhiteIsZero:lt,fromYCbCr:ut},Symbol.toStringTag,{value:"Module"})),dt=new Map;function G(r,e){Array.isArray(r)||(r=[r]),r.forEach(t=>dt.set(t,e))}async function ke(r){const e=dt.get(r.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${r.Compression}`);const t=await e();return new t(r)}G([void 0,1],()=>Promise.resolve().then(()=>require("./raw-D6OidBKc.cjs")).then(r=>r.default));G(5,()=>Promise.resolve().then(()=>require("./lzw-C-_B7Jis.cjs")).then(r=>r.default));G(6,()=>{throw new Error("old style JPEG compression is not supported.")});G(7,()=>Promise.resolve().then(()=>require("./jpeg-BiN8bMT5.cjs")).then(r=>r.default));G([8,32946],()=>Promise.resolve().then(()=>require("./deflate-Bay-vzHJ.cjs")).then(r=>r.default));G(32773,()=>Promise.resolve().then(()=>require("./packbits-DRGSjtn-.cjs")).then(r=>r.default));G(34887,()=>Promise.resolve().then(()=>require("./lerc-BvSjGMM2.cjs")).then(async r=>(await r.zstd.init(),r)).then(r=>r.default));G(50001,()=>Promise.resolve().then(()=>require("./webimage-mWTez3Wv.cjs")).then(r=>r.default));function ge(r,e,t,s=1){return new(Object.getPrototypeOf(r)).constructor(e*t*s)}function gr(r,e,t,s,n){const i=e/s,a=t/n;return r.map(o=>{const l=ge(o,s,n);for(let c=0;c<n;++c){const f=Math.min(Math.round(a*c),t-1);for(let h=0;h<s;++h){const u=Math.min(Math.round(i*h),e-1),d=o[f*e+u];l[c*s+h]=d}}return l})}function N(r,e,t){return(1-t)*r+t*e}function dr(r,e,t,s,n){const i=e/s,a=t/n;return r.map(o=>{const l=ge(o,s,n);for(let c=0;c<n;++c){const f=a*c,h=Math.floor(f),u=Math.min(Math.ceil(f),t-1);for(let d=0;d<s;++d){const g=i*d,y=g%1,p=Math.floor(g),x=Math.min(Math.ceil(g),e-1),w=o[h*e+p],S=o[h*e+x],I=o[u*e+p],b=o[u*e+x],O=N(N(w,S,y),N(I,b,y),f%1);l[c*s+d]=O}}return l})}function yr(r,e,t,s,n,i="nearest"){switch(i.toLowerCase()){case"nearest":return gr(r,e,t,s,n);case"bilinear":case"linear":return dr(r,e,t,s,n);default:throw new Error(`Unsupported resampling method: '${i}'`)}}function pr(r,e,t,s,n,i){const a=e/s,o=t/n,l=ge(r,s,n,i);for(let c=0;c<n;++c){const f=Math.min(Math.round(o*c),t-1);for(let h=0;h<s;++h){const u=Math.min(Math.round(a*h),e-1);for(let d=0;d<i;++d){const g=r[f*e*i+u*i+d];l[c*s*i+h*i+d]=g}}}return l}function wr(r,e,t,s,n,i){const a=e/s,o=t/n,l=ge(r,s,n,i);for(let c=0;c<n;++c){const f=o*c,h=Math.floor(f),u=Math.min(Math.ceil(f),t-1);for(let d=0;d<s;++d){const g=a*d,y=g%1,p=Math.floor(g),x=Math.min(Math.ceil(g),e-1);for(let w=0;w<i;++w){const S=r[h*e*i+p*i+w],I=r[h*e*i+x*i+w],b=r[u*e*i+p*i+w],O=r[u*e*i+x*i+w],V=N(N(S,I,y),N(b,O,y),f%1);l[c*s*i+d*i+w]=V}}}return l}function mr(r,e,t,s,n,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return pr(r,e,t,s,n,i);case"bilinear":case"linear":return wr(r,e,t,s,n,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function xr(r,e,t){let s=0;for(let n=e;n<t;++n)s+=r[n];return s}function Ie(r,e,t){switch(r){case 1:if(e<=8)return new Uint8Array(t);if(e<=16)return new Uint16Array(t);if(e<=32)return new Uint32Array(t);break;case 2:if(e===8)return new Int8Array(t);if(e===16)return new Int16Array(t);if(e===32)return new Int32Array(t);break;case 3:switch(e){case 16:case 32:return new Float32Array(t);case 64:return new Float64Array(t)}break}throw Error("Unsupported data format/bitsPerSample")}function Sr(r,e){return(r===1||r===2)&&e<=32&&e%8===0?!1:!(r===3&&(e===16||e===32||e===64))}function Ir(r,e,t,s,n,i,a){const o=new DataView(r),l=t===2?a*i:a*i*s,c=t===2?1:s,f=Ie(e,n,l),h=parseInt("1".repeat(n),2);if(e===1){let u;t===1?u=s*n:u=n;let d=i*u;(d&7)!==0&&(d=d+7&-8);for(let g=0;g<a;++g){const y=g*d;for(let p=0;p<i;++p){const x=y+p*c*n;for(let w=0;w<c;++w){const S=x+w*n,I=(g*i+p)*c+w,b=Math.floor(S/8),O=S%8;if(O+n<=8)f[I]=o.getUint8(b)>>8-n-O&h;else if(O+n<=16)f[I]=o.getUint16(b)>>16-n-O&h;else if(O+n<=24){const V=o.getUint16(b)<<8|o.getUint8(b+2);f[I]=V>>24-n-O&h}else f[I]=o.getUint32(b)>>32-n-O&h}}}}return f.buffer}class Re{constructor(e,t,s,n,i,a){this.fileDirectory=e,this.geoKeys=t,this.dataView=s,this.littleEndian=n,this.tiles=i?{}:null,this.isTiled=!e.StripOffsets;const o=e.PlanarConfiguration;if(this.planarConfiguration=typeof o>"u"?1:o,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=a}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,s=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(s<=8)return DataView.prototype.getUint8;if(s<=16)return DataView.prototype.getUint16;if(s<=32)return DataView.prototype.getUint32;break;case 2:if(s<=8)return DataView.prototype.getInt8;if(s<=16)return DataView.prototype.getInt16;if(s<=32)return DataView.prototype.getInt32;break;case 3:switch(s){case 16:return function(n,i){return rt(this,n,i)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){const s=this.getSampleFormat(e),n=this.getBitsPerSample(e);return Ie(s,n,t)}async getTileOrStrip(e,t,s,n,i){const a=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let l;const{tiles:c}=this;this.planarConfiguration===1?l=t*a+e:this.planarConfiguration===2&&(l=s*a*o+t*a+e);let f,h;this.isTiled?(f=this.fileDirectory.TileOffsets[l],h=this.fileDirectory.TileByteCounts[l]):(f=this.fileDirectory.StripOffsets[l],h=this.fileDirectory.StripByteCounts[l]);const u=(await this.source.fetch([{offset:f,length:h}],i))[0];let d;return c===null||!c[l]?(d=(async()=>{let g=await n.decode(this.fileDirectory,u);const y=this.getSampleFormat(),p=this.getBitsPerSample();return Sr(y,p)&&(g=Ir(g,y,this.planarConfiguration,this.getSamplesPerPixel(),p,this.getTileWidth(),this.getBlockHeight(t))),g})(),c!==null&&(c[l]=d)):d=c[l],{x:e,y:t,sample:s,data:await d}}async _readRaster(e,t,s,n,i,a,o,l,c){const f=this.getTileWidth(),h=this.getTileHeight(),u=this.getWidth(),d=this.getHeight(),g=Math.max(Math.floor(e[0]/f),0),y=Math.min(Math.ceil(e[2]/f),Math.ceil(u/f)),p=Math.max(Math.floor(e[1]/h),0),x=Math.min(Math.ceil(e[3]/h),Math.ceil(d/h)),w=e[2]-e[0];let S=this.getBytesPerPixel();const I=[],b=[];for(let D=0;D<t.length;++D)this.planarConfiguration===1?I.push(xr(this.fileDirectory.BitsPerSample,0,t[D])/8):I.push(0),b.push(this.getReaderForSample(t[D]));const O=[],{littleEndian:V}=this;for(let D=p;D<x;++D)for(let W=g;W<y;++W){let me;this.planarConfiguration===1&&(me=this.getTileOrStrip(W,D,0,i,c));for(let ee=0;ee<t.length;++ee){const te=ee,Me=t[ee];this.planarConfiguration===2&&(S=this.getSampleByteSize(Me),me=this.getTileOrStrip(W,D,Me,i,c));const It=me.then(j=>{const bt=j.data,Tt=new DataView(bt),xe=this.getBlockHeight(j.y),H=j.y*h,re=j.x*f,At=H+xe,Dt=(j.x+1)*f,Et=b[te],Ot=Math.min(xe,xe-(At-e[3]),d-H),Pt=Math.min(f,f-(Dt-e[2]),u-re);for(let Y=Math.max(0,e[1]-H);Y<Ot;++Y)for(let $=Math.max(0,e[0]-re);$<Pt;++$){const Ct=(Y*f+$)*S,Ge=Et.call(Tt,Ct+I[te],V);let se;n?(se=(Y+H-e[1])*w*t.length+($+re-e[0])*t.length+te,s[se]=Ge):(se=(Y+H-e[1])*w+$+re-e[0],s[te][se]=Ge)}});O.push(It)}}if(await Promise.all(O),a&&e[2]-e[0]!==a||o&&e[3]-e[1]!==o){let D;return n?D=mr(s,e[2]-e[0],e[3]-e[1],a,o,t.length,l):D=yr(s,e[2]-e[0],e[3]-e[1],a,o,l),D.width=a,D.height=o,D}return s.width=a||e[2]-e[0],s.height=o||e[3]-e[1],s}async readRasters({window:e,samples:t=[],interleave:s,pool:n=null,width:i,height:a,resampleMethod:o,fillValue:l,signal:c}={}){const f=e||[0,0,this.getWidth(),this.getHeight()];if(f[0]>f[2]||f[1]>f[3])throw new Error("Invalid subsets");const h=f[2]-f[0],u=f[3]-f[1],d=h*u,g=this.getSamplesPerPixel();if(!t||!t.length)for(let w=0;w<g;++w)t.push(w);else for(let w=0;w<t.length;++w)if(t[w]>=g)return Promise.reject(new RangeError(`Invalid sample index '${t[w]}'.`));let y;if(s){const w=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,S=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=Ie(w,S,d*t.length),l&&y.fill(l)}else{y=[];for(let w=0;w<t.length;++w){const S=this.getArrayForSample(t[w],d);Array.isArray(l)&&w<l.length?S.fill(l[w]):l&&!Array.isArray(l)&&S.fill(l),y.push(S)}}const p=n||await ke(this.fileDirectory);return await this._readRaster(f,t,y,s,p,i,a,o,c)}async readRGB({window:e,interleave:t=!0,pool:s=null,width:n,height:i,resampleMethod:a,enableAlpha:o=!1,signal:l}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const f=this.fileDirectory.PhotometricInterpretation;if(f===P.RGB){let x=[0,1,2];if(this.fileDirectory.ExtraSamples!==nt.Unspecified&&o){x=[];for(let w=0;w<this.fileDirectory.BitsPerSample.length;w+=1)x.push(w)}return this.readRasters({window:e,interleave:t,samples:x,pool:s,width:n,height:i,resampleMethod:a,signal:l})}let h;switch(f){case P.WhiteIsZero:case P.BlackIsZero:case P.Palette:h=[0];break;case P.CMYK:h=[0,1,2,3];break;case P.YCbCr:case P.CIELab:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const u={window:c,interleave:!0,samples:h,pool:s,width:n,height:i,resampleMethod:a,signal:l},{fileDirectory:d}=this,g=await this.readRasters(u),y=2**this.fileDirectory.BitsPerSample[0];let p;switch(f){case P.WhiteIsZero:p=lt(g,y);break;case P.BlackIsZero:p=ct(g,y);break;case P.Palette:p=ft(g,d.ColorMap);break;case P.CMYK:p=ht(g);break;case P.YCbCr:p=ut(g);break;case P.CIELab:p=gt(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const x=new Uint8Array(p.length/3),w=new Uint8Array(p.length/3),S=new Uint8Array(p.length/3);for(let I=0,b=0;I<p.length;I+=3,++b)x[b]=p[I],w[b]=p[I+1],S[b]=p[I+2];p=[x,w,S]}return p.width=g.width,p.height=g.height,p}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const s=this.fileDirectory.GDAL_METADATA;let n=ar(s,"Item");e===null?n=n.filter(i=>Se(i,"sample")===void 0):n=n.filter(i=>Number(Se(i,"sample"))===e);for(let i=0;i<n.length;++i){const a=n[i];t[Se(a,"name")]=a.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,s=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(s)return s[1]===0&&s[4]===0?[s[0],-s[5],s[10]]:[Math.sqrt(s[0]*s[0]+s[4]*s[4]),-Math.sqrt(s[1]*s[1]+s[5]*s[5]),s[10]];if(e){const[n,i,a]=e.getResolution();return[n*e.getWidth()/this.getWidth(),i*e.getHeight()/this.getHeight(),a*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const t=this.getHeight(),s=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[n,i,a,o,l,c,f,h]=this.fileDirectory.ModelTransformation,d=[[0,0],[0,t],[s,0],[s,t]].map(([p,x])=>[o+n*p+i*x,h+l*p+c*x]),g=d.map(p=>p[0]),y=d.map(p=>p[1]);return[Math.min(...g),Math.min(...y),Math.max(...g),Math.max(...y)]}else{const n=this.getOrigin(),i=this.getResolution(),a=n[0],o=n[1],l=a+i[0]*s,c=o+i[1]*t;return[Math.min(a,l),Math.min(o,c),Math.max(a,l),Math.max(o,c)]}}}class br{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const s=this.getUint32(e,t),n=this.getUint32(e+4,t);let i;if(t){if(i=s+2**32*n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*s+n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}getInt64(e,t){let s=0;const n=(this._dataView.getUint8(e+(t?7:0))&128)>0;let i=!0;for(let a=0;a<8;a++){let o=this._dataView.getUint8(e+(t?a:7-a));n&&(i?o!==0&&(o=~(o-1)&255,i=!1):o=~o&255),s+=o*256**a}return n&&(s=-s),s}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return rt(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Tr{constructor(e,t,s,n){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=s,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),s=this.readUint32(e+4);let n;if(this._littleEndian){if(n=t+2**32*s,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*t+s,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(e){let t=0;const s=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let n=!0;for(let i=0;i<8;i++){let a=this._dataView.getUint8(e+(this._littleEndian?i:7-i));s&&(n?a!==0&&(a=~(a-1)&255,n=!1):a=~a&255),t+=a*256**i}return s&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}const Ar=typeof navigator<"u"&&navigator.hardwareConcurrency||2;class Dr{constructor(e=Ar,t){this.workers=null,this._awaitingDecoder=null,this.size=e,this.messageId=0,e&&(this._awaitingDecoder=t?Promise.resolve(t):new Promise(s=>{Promise.resolve().then(()=>require("./decoder-D9LU4bUo.cjs")).then(n=>{s(n.create)})}),this._awaitingDecoder.then(s=>{this._awaitingDecoder=null,this.workers=[];for(let n=0;n<e;n++)this.workers.push({worker:s(),idle:!0})}))}async decode(e,t){return this._awaitingDecoder&&await this._awaitingDecoder,this.size===0?ke(e).then(s=>s.decode(e,t)):new Promise(s=>{const n=this.workers.find(o=>o.idle)||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const i=this.messageId++,a=o=>{o.data.id===i&&(n.idle=!0,s(o.data.decoded),n.worker.removeEventListener("message",a))};n.worker.addEventListener("message",a),n.worker.postMessage({fileDirectory:e,buffer:t,id:i},[t])})}destroy(){this.workers&&(this.workers.forEach(e=>{e.worker.terminate()}),this.workers=null)}}const ze=`\r
4
- \r
5
- `;function yt(r){if(typeof Object.fromEntries<"u")return Object.fromEntries(r);const e={};for(const[t,s]of r)e[t.toLowerCase()]=s;return e}function Er(r){const e=r.split(`\r
6
- `).map(t=>{const s=t.split(":").map(n=>n.trim());return s[0]=s[0].toLowerCase(),s});return yt(e)}function Or(r){const[e,...t]=r.split(";").map(n=>n.trim()),s=t.map(n=>n.split("="));return{type:e,params:yt(s)}}function be(r){let e,t,s;return r&&([,e,t,s]=r.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),t=parseInt(t,10),s=parseInt(s,10)),{start:e,end:t,total:s}}function Pr(r,e){let t=null;const s=new TextDecoder("ascii"),n=[],i=`--${e}`,a=`${i}--`;for(let o=0;o<10;++o)s.decode(new Uint8Array(r,o,i.length))===i&&(t=o);if(t===null)throw new Error("Could not find initial boundary");for(;t<r.byteLength;){const o=s.decode(new Uint8Array(r,t,Math.min(i.length+1024,r.byteLength-t)));if(o.length===0||o.startsWith(a))break;if(!o.startsWith(i))throw new Error("Part does not start with boundary");const l=o.substr(i.length+2);if(l.length===0)break;const c=l.indexOf(ze),f=Er(l.substr(0,c)),{start:h,end:u,total:d}=be(f["content-range"]),g=t+i.length+c+ze.length,y=parseInt(u,10)+1-parseInt(h,10);n.push({headers:f,data:r.slice(g,g+y),offset:h,length:y,fileSize:d}),t=g+y+4}return n}class Q{async fetch(e,t=void 0){return Promise.all(e.map(s=>this.fetchSlice(s,t)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class Cr extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge=="number"&&e.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if(typeof this.onEviction=="function")for(const[t,s]of e)this.onEviction(t,s.value)}_deleteIfExpired(e,t){return typeof t.expiry=="number"&&t.expiry<=Date.now()?(typeof this.onEviction=="function"&&this.onEviction(e,t.value),this.delete(e)):!1}_getOrDeleteIfExpired(e,t){if(this._deleteIfExpired(e,t)===!1)return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const s=t.get(e);return this._getItemValue(e,s)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,s]=e;this.cache.has(t)||this._deleteIfExpired(t,s)===!1&&(yield e)}for(const e of this.cache){const[t,s]=e;this._deleteIfExpired(t,s)===!1&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(this._deleteIfExpired(e,t)===!1)return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:s=this.maxAge}={}){const n=typeof s=="number"&&s!==Number.POSITIVE_INFINITY?Date.now()+s:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:n}):this._set(e,{value:t,expiry:n}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):this.oldCache.has(e)?!this._deleteIfExpired(e,this.oldCache.get(e)):!1}peek(e){if(this.cache.has(e))return this._peek(e,this.cache);if(this.oldCache.has(e))return this._peek(e,this.oldCache)}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],s=t.length-e;s<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(s>0&&this._emitEvictions(t.slice(0,s)),this.oldCache=new Map(t.slice(s)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,s]=e;this._deleteIfExpired(t,s)===!1&&(yield[t,s.value])}for(const e of this.oldCache){const[t,s]=e;this.cache.has(t)||this._deleteIfExpired(t,s)===!1&&(yield[t,s.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const s=e[t],[n,i]=s;this._deleteIfExpired(n,i)===!1&&(yield[n,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const s=e[t],[n,i]=s;this.cache.has(n)||this._deleteIfExpired(n,i)===!1&&(yield[n,i.value])}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[s,n]of this.entriesAscending())e.call(t,n,s,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}function pt(r,e){for(const t in e)e.hasOwnProperty(t)&&(r[t]=e[t])}function wt(r,e){return r.length<e.length?!1:r.substr(r.length-e.length)===e}function Fr(r,e){const{length:t}=r;for(let s=0;s<t;s++)e(r[s],s)}function Be(r){const e={};for(const t in r)if(r.hasOwnProperty(t)){const s=r[t];e[s]=t}return e}function C(r,e){const t=[];for(let s=0;s<r;s++)t.push(e(s));return t}async function kr(r){return new Promise(e=>setTimeout(e,r))}function Rr(r,e){const t=Array.isArray(r)?r:Array.from(r),s=Array.isArray(e)?e:Array.from(e);return t.map((n,i)=>[n,s[i]])}class _ extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,_),this.name="AbortError"}}class Br extends Error{constructor(e,t){super(t),this.errors=e,this.message=t,this.name="AggregateError"}}const Mr=Br;class Gr{constructor(e,t,s=null){this.offset=e,this.length=t,this.data=s}get top(){return this.offset+this.length}}class Ve{constructor(e,t,s){this.offset=e,this.length=t,this.blockIds=s}}class Ur extends Q{constructor(e,{blockSize:t=65536,cacheSize:s=100}={}){super(),this.source=e,this.blockSize=t,this.blockCache=new Cr({maxSize:s,onEviction:(n,i)=>{this.evictedBlocks.set(n,i)}}),this.evictedBlocks=new Map,this.blockRequests=new Map,this.blockIdsToFetch=new Set,this.abortedBlockIds=new Set}get fileSize(){return this.source.fileSize}async fetch(e,t){const s=[],n=[],i=[];this.evictedBlocks.clear();for(const{offset:u,length:d}of e){let g=u+d;const{fileSize:y}=this;y!==null&&(g=Math.min(g,y));const p=Math.floor(u/this.blockSize)*this.blockSize;for(let x=p;x<g;x+=this.blockSize){const w=Math.floor(x/this.blockSize);!this.blockCache.has(w)&&!this.blockRequests.has(w)&&(this.blockIdsToFetch.add(w),n.push(w)),this.blockRequests.has(w)&&s.push(this.blockRequests.get(w)),i.push(w)}}await kr(),this.fetchBlocks(t);const a=[];for(const u of n)this.blockRequests.has(u)&&a.push(this.blockRequests.get(u));await Promise.allSettled(s),await Promise.allSettled(a);const o=[],l=i.filter(u=>this.abortedBlockIds.has(u)||!this.blockCache.has(u));if(l.forEach(u=>this.blockIdsToFetch.add(u)),l.length>0&&t&&!t.aborted){this.fetchBlocks(null);for(const u of l){const d=this.blockRequests.get(u);if(!d)throw new Error(`Block ${u} is not in the block requests`);o.push(d)}await Promise.allSettled(o)}if(t&&t.aborted)throw new _("Request was aborted");const c=i.map(u=>this.blockCache.get(u)||this.evictedBlocks.get(u)),f=c.filter(u=>!u);if(f.length)throw new Mr(f,"Request failed");const h=new Map(Rr(i,c));return this.readSliceData(e,h)}fetchBlocks(e){if(this.blockIdsToFetch.size>0){const t=this.groupBlocks(this.blockIdsToFetch),s=this.source.fetch(t,e);for(let n=0;n<t.length;++n){const i=t[n];for(const a of i.blockIds)this.blockRequests.set(a,(async()=>{try{const o=(await s)[n],l=a*this.blockSize,c=l-o.offset,f=Math.min(c+this.blockSize,o.data.byteLength),h=o.data.slice(c,f),u=new Gr(l,h.byteLength,h,a);this.blockCache.set(a,u),this.abortedBlockIds.delete(a)}catch(o){if(o.name==="AbortError")o.signal=e,this.blockCache.delete(a),this.abortedBlockIds.add(a);else throw o}finally{this.blockRequests.delete(a)}})())}this.blockIdsToFetch.clear()}}groupBlocks(e){const t=Array.from(e).sort((a,o)=>a-o);if(t.length===0)return[];let s=[],n=null;const i=[];for(const a of t)n===null||n+1===a?(s.push(a),n=a):(i.push(new Ve(s[0]*this.blockSize,s.length*this.blockSize,s)),s=[a],n=a);return i.push(new Ve(s[0]*this.blockSize,s.length*this.blockSize,s)),i}readSliceData(e,t){return e.map(s=>{let n=s.offset+s.length;this.fileSize!==null&&(n=Math.min(this.fileSize,n));const i=Math.floor(s.offset/this.blockSize),a=Math.floor(n/this.blockSize),o=new ArrayBuffer(s.length),l=new Uint8Array(o);for(let c=i;c<=a;++c){const f=t.get(c),h=f.offset-s.offset,u=f.top-n;let d=0,g=0,y;h<0?d=-h:h>0&&(g=h),u<0?y=f.length-d:y=n-f.offset-d;const p=new Uint8Array(f.data,d,y);l.set(p,g)}return o})}}class de{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(e){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class ye{constructor(e){this.url=e}async request({headers:e,signal:t}={}){throw new Error("request is not implemented")}}class _r extends de{constructor(e){super(),this.response=e}get status(){return this.response.status}getHeader(e){return this.response.headers.get(e)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class vr extends ye{constructor(e,t){super(e),this.credentials=t}async request({headers:e,signal:t}={}){const s=await fetch(this.url,{headers:e,credentials:this.credentials,signal:t});return new _r(s)}}class Lr extends de{constructor(e,t){super(),this.xhr=e,this.data=t}get status(){return this.xhr.status}getHeader(e){return this.xhr.getResponseHeader(e)}async getData(){return this.data}}class Nr extends ye{constructRequest(e,t){return new Promise((s,n)=>{const i=new XMLHttpRequest;i.open("GET",this.url),i.responseType="arraybuffer";for(const[a,o]of Object.entries(e))i.setRequestHeader(a,o);i.onload=()=>{const a=i.response;s(new Lr(i,a))},i.onerror=n,i.onabort=()=>n(new _("Request aborted")),i.send(),t&&(t.aborted&&i.abort(),t.addEventListener("abort",()=>i.abort()))})}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}const K={};class Kr extends de{constructor(e,t){super(),this.response=e,this.dataPromise=t}get status(){return this.response.statusCode}getHeader(e){return this.response.headers[e]}async getData(){return await this.dataPromise}}class qr extends ye{constructor(e){super(e),this.parsedUrl=K.parse(this.url),this.httpApi=(this.parsedUrl.protocol==="http:",K)}constructRequest(e,t){return new Promise((s,n)=>{const i=this.httpApi.get({...this.parsedUrl,headers:e},a=>{const o=new Promise(l=>{const c=[];a.on("data",f=>{c.push(f)}),a.on("end",()=>{const f=Buffer.concat(c).buffer;l(f)}),a.on("error",n)});s(new Kr(a,o))});i.on("error",n),t&&(t.aborted&&i.destroy(new _("Request aborted")),t.addEventListener("abort",()=>i.destroy(new _("Request aborted"))))})}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}class pe extends Q{constructor(e,t,s,n){super(),this.client=e,this.headers=t,this.maxRanges=s,this.allowFullFile=n,this._fileSize=null}async fetch(e,t){return this.maxRanges>=e.length?this.fetchSlices(e,t):(this.maxRanges>0&&e.length>1,Promise.all(e.map(s=>this.fetchSlice(s,t))))}async fetchSlices(e,t){const s=await this.client.request({headers:{...this.headers,Range:`bytes=${e.map(({offset:n,length:i})=>`${n}-${n+i}`).join(",")}`},signal:t});if(s.ok)if(s.status===206){const{type:n,params:i}=Or(s.getHeader("content-type"));if(n==="multipart/byteranges"){const h=Pr(await s.getData(),i.boundary);return this._fileSize=h[0].fileSize||null,h}const a=await s.getData(),{start:o,end:l,total:c}=be(s.getHeader("content-range"));this._fileSize=c||null;const f=[{data:a,offset:o,length:l-o}];if(e.length>1){const h=await Promise.all(e.slice(1).map(u=>this.fetchSlice(u,t)));return f.concat(h)}return f}else{if(!this.allowFullFile)throw new Error("Server responded with full file");const n=await s.getData();return this._fileSize=n.byteLength,[{data:n,offset:0,length:n.byteLength}]}else throw new Error("Error fetching data.")}async fetchSlice(e,t){const{offset:s,length:n}=e,i=await this.client.request({headers:{...this.headers,Range:`bytes=${s}-${s+n}`},signal:t});if(i.ok)if(i.status===206){const a=await i.getData(),{total:o}=be(i.getHeader("content-range"));return this._fileSize=o||null,{data:a,offset:s,length:n}}else{if(!this.allowFullFile)throw new Error("Server responded with full file");const a=await i.getData();return this._fileSize=a.byteLength,{data:a,offset:0,length:a.byteLength}}else throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function we(r,{blockSize:e,cacheSize:t}){return e===null?r:new Ur(r,{blockSize:e,cacheSize:t})}function zr(r,{headers:e={},credentials:t,maxRanges:s=0,allowFullFile:n=!1,...i}={}){const a=new vr(r,t),o=new pe(a,e,s,n);return we(o,i)}function Vr(r,{headers:e={},maxRanges:t=0,allowFullFile:s=!1,...n}={}){const i=new Nr(r),a=new pe(i,e,t,s);return we(a,n)}function jr(r,{headers:e={},maxRanges:t=0,allowFullFile:s=!1,...n}={}){const i=new qr(r),a=new pe(i,e,t,s);return we(a,n)}function Hr(r,{headers:e={},maxRanges:t=0,allowFullFile:s=!1,...n}={}){const i=new pe(r,e,t,s);return we(i,n)}function Te(r,{forceXHR:e=!1,...t}={}){return typeof fetch=="function"&&!e?zr(r,t):typeof XMLHttpRequest<"u"?Vr(r,t):jr(r,t)}class Yr extends Q{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new _("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function $r(r){return new Yr(r)}class Xr extends Q{constructor(e){super(),this.file=e}async fetchSlice(e,t){return new Promise((s,n)=>{const i=this.file.slice(e.offset,e.offset+e.length),a=new FileReader;a.onload=o=>s(o.target.result),a.onerror=n,a.onabort=n,a.readAsArrayBuffer(i),t&&t.addEventListener("abort",()=>a.abort())})}}function Zr(r){return new Xr(r)}function Jr(r){return new Promise((e,t)=>{K.close(r,s=>{s?t(s):e()})})}function Qr(r,e,t=void 0){return new Promise((s,n)=>{K.open(r,e,t,(i,a)=>{i?n(i):s(a)})})}function Wr(...r){return new Promise((e,t)=>{K.read(...r,(s,n,i)=>{s?t(s):e({bytesRead:n,buffer:i})})})}class es extends Q{constructor(e){super(),this.path=e,this.openRequest=Qr(e,"r")}async fetchSlice(e){const t=await this.openRequest,{buffer:s}=await Wr(t,Buffer.alloc(e.length),0,e.length,e.offset);return s.buffer}async close(){const e=await this.openRequest;await Jr(e)}}function ts(r){return new es(r)}const rs=Be(U),ss=Be(L),M={};pt(M,rs);pt(M,ss);const ns=Be(X),he=1e3,A={nextZero:(r,e)=>{let t=e;for(;r[t]!==0;)t++;return t},readUshort:(r,e)=>r[e]<<8|r[e+1],readShort:(r,e)=>{const t=A.ui8;return t[0]=r[e+1],t[1]=r[e+0],A.i16[0]},readInt:(r,e)=>{const t=A.ui8;return t[0]=r[e+3],t[1]=r[e+2],t[2]=r[e+1],t[3]=r[e+0],A.i32[0]},readUint:(r,e)=>{const t=A.ui8;return t[0]=r[e+3],t[1]=r[e+2],t[2]=r[e+1],t[3]=r[e+0],A.ui32[0]},readASCII:(r,e,t)=>t.map(s=>String.fromCharCode(r[e+s])).join(""),readFloat:(r,e)=>{const t=A.ui8;return C(4,s=>{t[s]=r[e+3-s]}),A.fl32[0]},readDouble:(r,e)=>{const t=A.ui8;return C(8,s=>{t[s]=r[e+7-s]}),A.fl64[0]},writeUshort:(r,e,t)=>{r[e]=t>>8&255,r[e+1]=t&255},writeUint:(r,e,t)=>{r[e]=t>>24&255,r[e+1]=t>>16&255,r[e+2]=t>>8&255,r[e+3]=t>>0&255},writeASCII:(r,e,t)=>{C(t.length,s=>{r[e+s]=t.charCodeAt(s)})},ui8:new Uint8Array(8)};A.fl64=new Float64Array(A.ui8.buffer);A.writeDouble=(r,e,t)=>{A.fl64[0]=t,C(8,s=>{r[e+s]=A.ui8[7-s]})};const is=(r,e,t,s)=>{let n=t;const i=Object.keys(s).filter(o=>o!=null&&o!=="undefined");r.writeUshort(e,n,i.length),n+=2;let a=n+12*i.length+4;for(const o of i){let l=null;typeof o=="number"?l=o:typeof o=="string"&&(l=parseInt(o,10));const c=ue[l],f=ns[c];if(c==null||c===void 0||typeof c>"u")throw new Error(`unknown type of tag: ${l}`);let h=s[o];if(h===void 0)throw new Error(`failed to get value for key ${o}`);c==="ASCII"&&typeof h=="string"&&wt(h,"\0")===!1&&(h+="\0");const u=h.length;r.writeUshort(e,n,l),n+=2,r.writeUshort(e,n,f),n+=2,r.writeUint(e,n,u),n+=4;let d=[-1,1,1,2,4,8,0,0,0,0,0,0,8][f]*u,g=n;d>4&&(r.writeUint(e,n,a),g=a),c==="ASCII"?r.writeASCII(e,g,h):c==="SHORT"?C(u,y=>{r.writeUshort(e,g+2*y,h[y])}):c==="LONG"?C(u,y=>{r.writeUint(e,g+4*y,h[y])}):c==="RATIONAL"?C(u,y=>{r.writeUint(e,g+8*y,Math.round(h[y]*1e4)),r.writeUint(e,g+8*y+4,1e4)}):c==="DOUBLE"&&C(u,y=>{r.writeDouble(e,g+8*y,h[y])}),d>4&&(d+=d&1,a+=d),n+=4}return[n,a]},os=r=>{const e=new Uint8Array(he);let t=4;const s=A;e[0]=77,e[1]=77,e[3]=42;let n=8;if(s.writeUint(e,t,n),t+=4,r.forEach((a,o)=>{const l=is(s,e,n,a);n=l[1],o<r.length-1&&s.writeUint(e,l[0],n)}),e.slice)return e.slice(0,n).buffer;const i=new Uint8Array(n);for(let a=0;a<n;a++)i[a]=e[a];return i.buffer},as=(r,e,t,s)=>{if(t==null)throw new Error(`you passed into encodeImage a width of type ${t}`);if(e==null)throw new Error(`you passed into encodeImage a width of type ${e}`);const n={256:[e],257:[t],273:[he],278:[t],305:"geotiff.js"};if(s)for(const c in s)s.hasOwnProperty(c)&&(n[c]=s[c]);const i=new Uint8Array(os([n])),a=new Uint8Array(r),o=n[277],l=new Uint8Array(he+e*t*o);return C(i.length,c=>{l[c]=i[c]}),Fr(a,(c,f)=>{l[he+f]=c}),l.buffer},ls=r=>{const e={};for(const t in r)t!=="StripOffsets"&&(M[t]||console.error(t,"not in name2code:",Object.keys(M)),e[M[t]]=r[t]);return e},cs=r=>Array.isArray(r)?r:[r],fs=[["Compression",1],["PlanarConfiguration",1],["ExtraSamples",0]];function hs(r,e){const t=typeof r[0]=="number";let s,n,i,a;t?(s=e.height||e.ImageLength,i=e.width||e.ImageWidth,n=r.length/(s*i),a=r):(n=r.length,s=r[0].length,i=r[0][0].length,a=[],C(s,f=>{C(i,h=>{C(n,u=>{a.push(r[u][f][h])})})})),e.ImageLength=s,delete e.height,e.ImageWidth=i,delete e.width,e.BitsPerSample||(e.BitsPerSample=C(n,()=>8)),fs.forEach(f=>{const h=f[0];if(!e[h]){const u=f[1];e[h]=u}}),e.PhotometricInterpretation||(e.PhotometricInterpretation=e.BitsPerSample.length===3?2:1),e.SamplesPerPixel||(e.SamplesPerPixel=[n]),e.StripByteCounts||(e.StripByteCounts=[n*s*i]),e.ModelPixelScale||(e.ModelPixelScale=[360/i,180/s,0]),e.SampleFormat||(e.SampleFormat=C(n,()=>1)),!e.hasOwnProperty("GeographicTypeGeoKey")&&!e.hasOwnProperty("ProjectedCSTypeGeoKey")&&(e.GeographicTypeGeoKey=4326,e.ModelTiepoint=[0,0,0,-180,90,0],e.GeogCitationGeoKey="WGS 84",e.GTModelTypeGeoKey=2);const o=Object.keys(e).filter(f=>wt(f,"GeoKey")).sort((f,h)=>M[f]-M[h]);if(!e.GeoAsciiParams){let f="";o.forEach(h=>{const u=Number(M[h]);ue[u]==="ASCII"&&(f+=`${e[h].toString()}\0`)}),f.length>0&&(e.GeoAsciiParams=f)}if(!e.GeoKeyDirectory){const h=[1,1,0,o.length];o.forEach(u=>{const d=Number(M[u]);h.push(d);let g,y,p;ue[d]==="SHORT"?(g=1,y=0,p=e[u]):u==="GeogCitationGeoKey"?(g=e.GeoAsciiParams.length,y=Number(M.GeoAsciiParams),p=0):console.log(`[geotiff.js] couldn't get TIFFTagLocation for ${u}`),h.push(y),h.push(g),h.push(p)}),e.GeoKeyDirectory=h}for(const f of o)e.hasOwnProperty(f)&&delete e[f];["Compression","ExtraSamples","GeographicTypeGeoKey","GTModelTypeGeoKey","GTRasterTypeGeoKey","ImageLength","ImageWidth","Orientation","PhotometricInterpretation","ProjectedCSTypeGeoKey","PlanarConfiguration","ResolutionUnit","SamplesPerPixel","XPosition","YPosition","RowsPerStrip"].forEach(f=>{e[f]&&(e[f]=cs(e[f]))});const l=ls(e);return as(a,i,s,l)}class us{log(){}debug(){}info(){}warn(){}error(){}time(){}timeEnd(){}}function gs(r=new us){}function ds(r,e){let t=r.length-e,s=0;do{for(let n=e;n>0;n--)r[s+e]+=r[s],s++;t-=e}while(t>0)}function ys(r,e,t){let s=0,n=r.length;const i=n/t;for(;n>e;){for(let o=e;o>0;--o)r[s+e]+=r[s],++s;n-=e}const a=r.slice();for(let o=0;o<i;++o)for(let l=0;l<t;++l)r[t*o+l]=a[(t-l-1)*i+o]}function ps(r,e,t,s,n,i){if(e===1)return r;for(let l=0;l<n.length;++l){if(n[l]%8!==0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(n[l]!==n[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const a=n[0]/8,o=i===2?1:n.length;for(let l=0;l<s&&!(l*o*t*a>=r.byteLength);++l){let c;if(e===2){switch(n[0]){case 8:c=new Uint8Array(r,l*o*t*a,o*t*a);break;case 16:c=new Uint16Array(r,l*o*t*a,o*t*a/2);break;case 32:c=new Uint32Array(r,l*o*t*a,o*t*a/4);break;default:throw new Error(`Predictor 2 not allowed with ${n[0]} bits per sample.`)}ds(c,o)}else e===3&&(c=new Uint8Array(r,l*o*t*a,o*t*a),ys(c,o,a))}return r}class mt{async decode(e,t){const s=await this.decodeBlock(t),n=e.Predictor||1;if(n!==1){const i=!e.StripOffsets,a=i?e.TileWidth:e.ImageWidth,o=i?e.TileLength:e.RowsPerStrip||e.ImageLength;return ps(s,n,a,o,e.BitsPerSample,e.PlanarConfiguration)}return s}}function Ae(r){switch(r){case m.BYTE:case m.ASCII:case m.SBYTE:case m.UNDEFINED:return 1;case m.SHORT:case m.SSHORT:return 2;case m.LONG:case m.SLONG:case m.FLOAT:case m.IFD:return 4;case m.RATIONAL:case m.SRATIONAL:case m.DOUBLE:case m.LONG8:case m.SLONG8:case m.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${r}`)}}function ws(r){const e=r.GeoKeyDirectory;if(!e)return null;const t={};for(let s=4;s<=e[3]*4;s+=4){const n=L[e[s]],i=e[s+1]?U[e[s+1]]:null,a=e[s+2],o=e[s+3];let l=null;if(!i)l=o;else{if(l=r[i],typeof l>"u"||l===null)throw new Error(`Could not get value of geoKey '${n}'.`);typeof l=="string"?l=l.substring(o,o+a-1):l.subarray&&(l=l.subarray(o,o+a),a===1&&(l=l[0]))}t[n]=l}return t}function v(r,e,t,s){let n=null,i=null;const a=Ae(e);switch(e){case m.BYTE:case m.ASCII:case m.UNDEFINED:n=new Uint8Array(t),i=r.readUint8;break;case m.SBYTE:n=new Int8Array(t),i=r.readInt8;break;case m.SHORT:n=new Uint16Array(t),i=r.readUint16;break;case m.SSHORT:n=new Int16Array(t),i=r.readInt16;break;case m.LONG:case m.IFD:n=new Uint32Array(t),i=r.readUint32;break;case m.SLONG:n=new Int32Array(t),i=r.readInt32;break;case m.LONG8:case m.IFD8:n=new Array(t),i=r.readUint64;break;case m.SLONG8:n=new Array(t),i=r.readInt64;break;case m.RATIONAL:n=new Uint32Array(t*2),i=r.readUint32;break;case m.SRATIONAL:n=new Int32Array(t*2),i=r.readInt32;break;case m.FLOAT:n=new Float32Array(t),i=r.readFloat32;break;case m.DOUBLE:n=new Float64Array(t),i=r.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===m.RATIONAL||e===m.SRATIONAL)for(let o=0;o<t;o+=2)n[o]=i.call(r,s+o*a),n[o+1]=i.call(r,s+(o*a+4));else for(let o=0;o<t;++o)n[o]=i.call(r,s+o*a);return e===m.ASCII?new TextDecoder("utf-8").decode(n):n}class ms{constructor(e,t,s){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=s}}class fe extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class xt{async readRasters(e={}){const{window:t,width:s,height:n}=e;let{resX:i,resY:a,bbox:o}=e;const l=await this.getImage();let c=l;const f=await this.getImageCount(),h=l.getBoundingBox();if(t&&o)throw new Error('Both "bbox" and "window" passed.');if(s||n){if(t){const[g,y]=l.getOrigin(),[p,x]=l.getResolution();o=[g+t[0]*p,y+t[1]*x,g+t[2]*p,y+t[3]*x]}const d=o||h;if(s){if(i)throw new Error("Both width and resX passed");i=(d[2]-d[0])/s}if(n){if(a)throw new Error("Both width and resY passed");a=(d[3]-d[1])/n}}if(i||a){const d=[];for(let g=0;g<f;++g){const y=await this.getImage(g),{SubfileType:p,NewSubfileType:x}=y.fileDirectory;(g===0||p===2||x&1)&&d.push(y)}d.sort((g,y)=>g.getWidth()-y.getWidth());for(let g=0;g<d.length;++g){const y=d[g],p=(h[2]-h[0])/y.getWidth(),x=(h[3]-h[1])/y.getHeight();if(c=y,i&&i>p||a&&a>x)break}}let u=t;if(o){const[d,g]=l.getOrigin(),[y,p]=c.getResolution(l);u=[Math.round((o[0]-d)/y),Math.round((o[1]-g)/p),Math.round((o[2]-d)/y),Math.round((o[3]-g)/p)],u=[Math.min(u[0],u[2]),Math.min(u[1],u[3]),Math.max(u[0],u[2]),Math.max(u[1],u[3])]}return c.readRasters({...e,window:u})}}class k extends xt{constructor(e,t,s,n,i={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=s,this.firstIFDOffset=n,this.cache=i.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const s=this.bigTiff?4048:1024;return new Tr((await this.source.fetch([{offset:e,length:typeof t<"u"?t:s}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,s=this.bigTiff?8:2;let n=await this.getSlice(e);const i=this.bigTiff?n.readUint64(e):n.readUint16(e),a=i*t+(this.bigTiff?16:6);n.covers(e,a)||(n=await this.getSlice(e,a));const o={};let l=e+(this.bigTiff?8:2);for(let h=0;h<i;l+=t,++h){const u=n.readUint16(l),d=n.readUint16(l+2),g=this.bigTiff?n.readUint64(l+4):n.readUint32(l+4);let y,p;const x=Ae(d),w=l+(this.bigTiff?12:8);if(x*g<=(this.bigTiff?8:4))y=v(n,d,g,w);else{const S=n.readOffset(w),I=Ae(d)*g;if(n.covers(S,I))y=v(n,d,g,S);else{const b=await this.getSlice(S,I);y=v(b,d,g,S)}}g===1&&st.indexOf(u)===-1&&!(d===m.RATIONAL||d===m.SRATIONAL)?p=y[0]:p=y,o[U[u]]=p}const c=ws(o),f=n.readOffset(e+s+t*i);return new ms(o,c,f)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){throw t instanceof fe?new fe(e):t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(t.nextIFDByteOffset===0)throw new fe(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new Re(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(s){if(s instanceof fe)t=!1;else throw s}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",s=t.length+100;let n=await this.getSlice(e,s);if(t===v(n,m.ASCII,t.length,e)){const a=v(n,m.ASCII,s,e).split(`
7
- `)[0],o=Number(a.split("=")[1].split(" ")[0])+a.length;o>s&&(n=await this.getSlice(e,o));const l=v(n,m.ASCII,o,e);this.ghostValues={},l.split(`
8
- `).filter(c=>c.length>0).map(c=>c.split("=")).forEach(([c,f])=>{this.ghostValues[c]=f})}return this.ghostValues}static async fromSource(e,t,s){const n=(await e.fetch([{offset:0,length:1024}],s))[0],i=new br(n),a=i.getUint16(0,0);let o;if(a===18761)o=!0;else if(a===19789)o=!1;else throw new TypeError("Invalid byte order value.");const l=i.getUint16(2,o);let c;if(l===42)c=!1;else if(l===43){if(c=!0,i.getUint16(4,o)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const f=c?i.getUint64(8,o):i.getUint32(4,o);return new k(e,o,c,f,t)}close(){return typeof this.source.close=="function"?this.source.close():!1}}class St extends xt{constructor(e,t){super(),this.mainFile=e,this.overviewFiles=t,this.imageFiles=[e].concat(t),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const e=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map(t=>t.parseFileDirectoryAt(t.firstIFDOffset)));return this.fileDirectoriesPerFile=await Promise.all(e),this.fileDirectoriesPerFile}async getImage(e=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let t=0,s=0;for(let n=0;n<this.imageFiles.length;n++){const i=this.imageFiles[n];for(let a=0;a<this.imageCounts[n];a++){if(e===t){const o=await i.requestIFD(s);return new Re(o.fileDirectory,o.geoKeyDirectory,i.dataView,i.littleEndian,i.cache,i.source)}t++,s++}s=0}throw new RangeError("Invalid image index")}async getImageCount(){if(this.imageCount!==null)return this.imageCount;const e=[this.mainFile.getImageCount()].concat(this.overviewFiles.map(t=>t.getImageCount()));return this.imageCounts=await Promise.all(e),this.imageCount=this.imageCounts.reduce((t,s)=>t+s,0),this.imageCount}}async function xs(r,e={},t){return k.fromSource(Te(r,e),t)}async function Ss(r,e={},t){return k.fromSource(Hr(r,e),t)}async function Is(r,e){return k.fromSource($r(r),e)}async function bs(r,e){return k.fromSource(ts(r),e)}async function Ts(r,e){return k.fromSource(Zr(r),e)}async function As(r,e=[],t={},s){const n=await k.fromSource(Te(r,t),s),i=await Promise.all(e.map(a=>k.fromSource(Te(a,t))));return new St(n,i)}function Ds(r,e){return hs(r,e)}const Es=Object.freeze(Object.defineProperty({__proto__:null,BaseClient:ye,BaseDecoder:mt,BaseResponse:de,GeoTIFF:k,GeoTIFFImage:Re,MultiGeoTIFF:St,Pool:Dr,addDecoder:G,default:k,fromArrayBuffer:Is,fromBlob:Ts,fromCustomClient:Ss,fromFile:bs,fromUrl:xs,fromUrls:As,getDecoder:ke,globals:lr,rgb:ur,setLogger:gs,writeArrayBuffer:Ds},Symbol.toStringTag,{value:"Module"}));exports.BaseDecoder=mt;exports.LercAddCompression=ot;exports.LercParameters=it;exports.geotiff=Es;exports.getDefaultExportFromCjs=Fe;