@loaders.gl/tiles 5.0.0-alpha.12 → 5.0.0-alpha.13

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 (716) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -72
  3. package/dist/dist.dev.js +6979 -42928
  4. package/dist/dist.min.js +3 -22
  5. package/dist/image-set.d.ts +1 -1
  6. package/dist/image-set.d.ts.map +1 -1
  7. package/dist/index.cjs +2847 -8781
  8. package/dist/index.cjs.map +3 -4
  9. package/dist/index.d.ts +4 -45
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +3 -27
  12. package/dist/index.js.map +1 -1
  13. package/dist/mlt/bundled.d.ts +3 -0
  14. package/dist/mlt/bundled.d.ts.map +1 -0
  15. package/dist/mlt/bundled.js +5 -0
  16. package/dist/mlt/bundled.js.map +1 -0
  17. package/dist/mlt/index.cjs +3701 -0
  18. package/dist/mlt/index.cjs.map +6 -0
  19. package/dist/mlt/index.d.ts +10 -0
  20. package/dist/mlt/index.d.ts.map +1 -0
  21. package/dist/mlt/index.js +12 -0
  22. package/dist/mlt/index.js.map +1 -0
  23. package/dist/mlt/lib/encode-mlt-geometry.d.ts +6 -0
  24. package/dist/mlt/lib/encode-mlt-geometry.d.ts.map +1 -0
  25. package/dist/mlt/lib/encode-mlt-geometry.js +150 -0
  26. package/dist/mlt/lib/encode-mlt-geometry.js.map +1 -0
  27. package/dist/mlt/lib/encode-mlt-streams.d.ts +13 -0
  28. package/dist/mlt/lib/encode-mlt-streams.d.ts.map +1 -0
  29. package/dist/mlt/lib/encode-mlt-streams.js +57 -0
  30. package/dist/mlt/lib/encode-mlt-streams.js.map +1 -0
  31. package/dist/mlt/lib/encode-mlt.d.ts +6 -0
  32. package/dist/mlt/lib/encode-mlt.d.ts.map +1 -0
  33. package/dist/mlt/lib/encode-mlt.js +174 -0
  34. package/dist/mlt/lib/encode-mlt.js.map +1 -0
  35. package/dist/mlt/lib/parse-mlt.d.ts +11 -0
  36. package/dist/mlt/lib/parse-mlt.d.ts.map +1 -0
  37. package/dist/mlt/lib/parse-mlt.js +675 -0
  38. package/dist/mlt/lib/parse-mlt.js.map +1 -0
  39. package/dist/mlt/mlt-format.d.ts +14 -0
  40. package/dist/mlt/mlt-format.d.ts.map +1 -0
  41. package/dist/mlt/mlt-format.js +17 -0
  42. package/dist/mlt/mlt-format.js.map +1 -0
  43. package/dist/mlt/mlt-loader-with-parser.d.ts +91 -0
  44. package/dist/mlt/mlt-loader-with-parser.d.ts.map +1 -0
  45. package/dist/mlt/mlt-loader-with-parser.js +29 -0
  46. package/dist/mlt/mlt-loader-with-parser.js.map +1 -0
  47. package/dist/mlt/mlt-loader.d.ts +115 -0
  48. package/dist/mlt/mlt-loader.d.ts.map +1 -0
  49. package/dist/mlt/mlt-loader.js +38 -0
  50. package/dist/mlt/mlt-loader.js.map +1 -0
  51. package/dist/mlt/mlt-source-loader.d.ts +82 -0
  52. package/dist/mlt/mlt-source-loader.d.ts.map +1 -0
  53. package/dist/mlt/mlt-source-loader.js +179 -0
  54. package/dist/mlt/mlt-source-loader.js.map +1 -0
  55. package/dist/mlt/mlt-writer.d.ts +45 -0
  56. package/dist/mlt/mlt-writer.d.ts.map +1 -0
  57. package/dist/mlt/mlt-writer.js +21 -0
  58. package/dist/mlt/mlt-writer.js.map +1 -0
  59. package/dist/mlt/unbundled.d.ts +3 -0
  60. package/dist/mlt/unbundled.d.ts.map +1 -0
  61. package/dist/mlt/unbundled.js +5 -0
  62. package/dist/mlt/unbundled.js.map +1 -0
  63. package/dist/mvt/arrow-table-tile-source-loader-types.d.ts +36 -0
  64. package/dist/mvt/arrow-table-tile-source-loader-types.d.ts.map +1 -0
  65. package/dist/mvt/arrow-table-tile-source-loader-types.js +36 -0
  66. package/dist/mvt/arrow-table-tile-source-loader-types.js.map +1 -0
  67. package/dist/mvt/arrow-table-tile-source-loader.cjs +6343 -0
  68. package/dist/mvt/arrow-table-tile-source-loader.cjs.map +6 -0
  69. package/dist/mvt/arrow-table-tile-source-loader.d.ts +69 -0
  70. package/dist/mvt/arrow-table-tile-source-loader.d.ts.map +1 -0
  71. package/dist/mvt/arrow-table-tile-source-loader.js +216 -0
  72. package/dist/mvt/arrow-table-tile-source-loader.js.map +1 -0
  73. package/dist/mvt/arrow-table-tile-source-types.d.ts +21 -0
  74. package/dist/mvt/arrow-table-tile-source-types.d.ts.map +1 -0
  75. package/dist/mvt/arrow-table-tile-source-types.js +6 -0
  76. package/dist/mvt/arrow-table-tile-source-types.js.map +1 -0
  77. package/dist/mvt/bundled.d.ts +6 -0
  78. package/dist/mvt/bundled.d.ts.map +1 -0
  79. package/dist/mvt/bundled.js +7 -0
  80. package/dist/mvt/bundled.js.map +1 -0
  81. package/dist/mvt/dist.dev.js +46689 -0
  82. package/dist/mvt/dist.min.js +94 -0
  83. package/dist/mvt/index.cjs +10095 -0
  84. package/dist/mvt/index.cjs.map +6 -0
  85. package/dist/mvt/index.d.ts +28 -0
  86. package/dist/mvt/index.d.ts.map +1 -0
  87. package/dist/mvt/index.js +27 -0
  88. package/dist/mvt/index.js.map +1 -0
  89. package/dist/mvt/lib/encode-mvt-arrow.d.ts +6 -0
  90. package/dist/mvt/lib/encode-mvt-arrow.d.ts.map +1 -0
  91. package/dist/mvt/lib/encode-mvt-arrow.js +225 -0
  92. package/dist/mvt/lib/encode-mvt-arrow.js.map +1 -0
  93. package/dist/mvt/lib/encode-mvt.d.ts +30 -0
  94. package/dist/mvt/lib/encode-mvt.d.ts.map +1 -0
  95. package/dist/mvt/lib/encode-mvt.js +20 -0
  96. package/dist/mvt/lib/encode-mvt.js.map +1 -0
  97. package/dist/mvt/lib/get-schemas-from-tilejson.d.ts +4 -0
  98. package/dist/mvt/lib/get-schemas-from-tilejson.d.ts.map +1 -0
  99. package/dist/mvt/lib/get-schemas-from-tilejson.js +56 -0
  100. package/dist/mvt/lib/get-schemas-from-tilejson.js.map +1 -0
  101. package/dist/mvt/lib/is-longitude-latitude-crs.d.ts +3 -0
  102. package/dist/mvt/lib/is-longitude-latitude-crs.d.ts.map +1 -0
  103. package/dist/mvt/lib/is-longitude-latitude-crs.js +13 -0
  104. package/dist/mvt/lib/is-longitude-latitude-crs.js.map +1 -0
  105. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.d.ts +25 -0
  106. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.d.ts.map +1 -0
  107. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.js +73 -0
  108. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.js.map +1 -0
  109. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.d.ts +52 -0
  110. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.d.ts.map +1 -0
  111. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.js +165 -0
  112. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.js.map +1 -0
  113. package/dist/mvt/lib/mvt-pbf/mvt-constants.d.ts +116 -0
  114. package/dist/mvt/lib/mvt-pbf/mvt-constants.d.ts.map +1 -0
  115. package/dist/mvt/lib/mvt-pbf/mvt-constants.js +127 -0
  116. package/dist/mvt/lib/mvt-pbf/mvt-constants.js.map +1 -0
  117. package/dist/mvt/lib/mvt-pbf/mvt-types.d.ts +17 -0
  118. package/dist/mvt/lib/mvt-pbf/mvt-types.d.ts.map +1 -0
  119. package/dist/mvt/lib/mvt-pbf/mvt-types.js +5 -0
  120. package/dist/mvt/lib/mvt-pbf/mvt-types.js.map +1 -0
  121. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.d.ts +77 -0
  122. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.d.ts.map +1 -0
  123. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.js +235 -0
  124. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.js.map +1 -0
  125. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.d.ts +25 -0
  126. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.d.ts.map +1 -0
  127. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.js +263 -0
  128. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.js.map +1 -0
  129. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.d.ts +4 -0
  130. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.d.ts.map +1 -0
  131. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.js +134 -0
  132. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.js.map +1 -0
  133. package/dist/mvt/lib/mvt-worker-transport.d.ts +15 -0
  134. package/dist/mvt/lib/mvt-worker-transport.d.ts.map +1 -0
  135. package/dist/mvt/lib/mvt-worker-transport.js +54 -0
  136. package/dist/mvt/lib/mvt-worker-transport.js.map +1 -0
  137. package/dist/mvt/lib/parse-mvt-geojson.d.ts +6 -0
  138. package/dist/mvt/lib/parse-mvt-geojson.d.ts.map +1 -0
  139. package/dist/mvt/lib/parse-mvt-geojson.js +48 -0
  140. package/dist/mvt/lib/parse-mvt-geojson.js.map +1 -0
  141. package/dist/mvt/lib/parse-mvt.d.ts +14 -0
  142. package/dist/mvt/lib/parse-mvt.d.ts.map +1 -0
  143. package/dist/mvt/lib/parse-mvt.js +105 -0
  144. package/dist/mvt/lib/parse-mvt.js.map +1 -0
  145. package/dist/mvt/lib/parse-tilejson.d.ts +74 -0
  146. package/dist/mvt/lib/parse-tilejson.d.ts.map +1 -0
  147. package/dist/mvt/lib/parse-tilejson.js +267 -0
  148. package/dist/mvt/lib/parse-tilejson.js.map +1 -0
  149. package/dist/mvt/lib/resolve-table-tile-parameters.d.ts +4 -0
  150. package/dist/mvt/lib/resolve-table-tile-parameters.d.ts.map +1 -0
  151. package/dist/mvt/lib/resolve-table-tile-parameters.js +16 -0
  152. package/dist/mvt/lib/resolve-table-tile-parameters.js.map +1 -0
  153. package/dist/mvt/lib/types.d.ts +88 -0
  154. package/dist/mvt/lib/types.d.ts.map +1 -0
  155. package/dist/mvt/lib/types.js.map +1 -0
  156. package/dist/mvt/lib/utils/geometry-utils.d.ts +83 -0
  157. package/dist/mvt/lib/utils/geometry-utils.d.ts.map +1 -0
  158. package/dist/mvt/lib/utils/geometry-utils.js +211 -0
  159. package/dist/mvt/lib/utils/geometry-utils.js.map +1 -0
  160. package/dist/mvt/lib/vector-tile/vector-tile-feature.d.ts +72 -0
  161. package/dist/mvt/lib/vector-tile/vector-tile-feature.d.ts.map +1 -0
  162. package/dist/mvt/lib/vector-tile/vector-tile-feature.js +350 -0
  163. package/dist/mvt/lib/vector-tile/vector-tile-feature.js.map +1 -0
  164. package/dist/mvt/lib/vector-tile/vector-tile-layer.d.ts +29 -0
  165. package/dist/mvt/lib/vector-tile/vector-tile-layer.d.ts.map +1 -0
  166. package/dist/mvt/lib/vector-tile/vector-tile-layer.js +108 -0
  167. package/dist/mvt/lib/vector-tile/vector-tile-layer.js.map +1 -0
  168. package/dist/mvt/lib/vector-tile/vector-tile.d.ts +9 -0
  169. package/dist/mvt/lib/vector-tile/vector-tile.d.ts.map +1 -0
  170. package/dist/mvt/lib/vector-tile/vector-tile.js +28 -0
  171. package/dist/mvt/lib/vector-tile/vector-tile.js.map +1 -0
  172. package/dist/mvt/lib/vector-tiler/arrow-tile.d.ts +6 -0
  173. package/dist/mvt/lib/vector-tiler/arrow-tile.d.ts.map +1 -0
  174. package/dist/mvt/lib/vector-tiler/arrow-tile.js +84 -0
  175. package/dist/mvt/lib/vector-tiler/arrow-tile.js.map +1 -0
  176. package/dist/mvt/lib/vector-tiler/features/clip-features.d.ts +16 -0
  177. package/dist/mvt/lib/vector-tiler/features/clip-features.d.ts.map +1 -0
  178. package/dist/mvt/lib/vector-tiler/features/clip-features.js +211 -0
  179. package/dist/mvt/lib/vector-tiler/features/clip-features.js.map +1 -0
  180. package/dist/mvt/lib/vector-tiler/features/convert-feature.d.ts +18 -0
  181. package/dist/mvt/lib/vector-tiler/features/convert-feature.d.ts.map +1 -0
  182. package/dist/mvt/lib/vector-tiler/features/convert-feature.js +161 -0
  183. package/dist/mvt/lib/vector-tiler/features/convert-feature.js.map +1 -0
  184. package/dist/mvt/lib/vector-tiler/features/proto-feature.d.ts +30 -0
  185. package/dist/mvt/lib/vector-tiler/features/proto-feature.d.ts.map +1 -0
  186. package/dist/mvt/lib/vector-tiler/features/proto-feature.js +53 -0
  187. package/dist/mvt/lib/vector-tiler/features/proto-feature.js.map +1 -0
  188. package/dist/mvt/lib/vector-tiler/features/simplify-path.d.ts +10 -0
  189. package/dist/mvt/lib/vector-tiler/features/simplify-path.d.ts.map +1 -0
  190. package/dist/mvt/lib/vector-tiler/features/simplify-path.js +67 -0
  191. package/dist/mvt/lib/vector-tiler/features/simplify-path.js.map +1 -0
  192. package/dist/mvt/lib/vector-tiler/features/wrap-features.d.ts +17 -0
  193. package/dist/mvt/lib/vector-tiler/features/wrap-features.d.ts.map +1 -0
  194. package/dist/mvt/lib/vector-tiler/features/wrap-features.js +95 -0
  195. package/dist/mvt/lib/vector-tiler/features/wrap-features.js.map +1 -0
  196. package/dist/mvt/lib/vector-tiler/proto-tile.d.ts +40 -0
  197. package/dist/mvt/lib/vector-tiler/proto-tile.d.ts.map +1 -0
  198. package/dist/mvt/lib/vector-tiler/proto-tile.js +139 -0
  199. package/dist/mvt/lib/vector-tiler/proto-tile.js.map +1 -0
  200. package/dist/mvt/lib/vector-tiler/tile-to-geojson.d.ts +12 -0
  201. package/dist/mvt/lib/vector-tiler/tile-to-geojson.d.ts.map +1 -0
  202. package/dist/mvt/lib/vector-tiler/tile-to-geojson.js +81 -0
  203. package/dist/mvt/lib/vector-tiler/tile-to-geojson.js.map +1 -0
  204. package/dist/mvt/lib/vector-tiler/transform-tile.d.ts +7 -0
  205. package/dist/mvt/lib/vector-tiler/transform-tile.d.ts.map +1 -0
  206. package/dist/mvt/lib/vector-tiler/transform-tile.js +42 -0
  207. package/dist/mvt/lib/vector-tiler/transform-tile.js.map +1 -0
  208. package/dist/mvt/map-style-format.d.ts +13 -0
  209. package/dist/mvt/map-style-format.d.ts.map +1 -0
  210. package/dist/mvt/map-style-format.js +16 -0
  211. package/dist/mvt/map-style-format.js.map +1 -0
  212. package/dist/mvt/map-style-loader-with-parser.d.ts +26 -0
  213. package/dist/mvt/map-style-loader-with-parser.d.ts.map +1 -0
  214. package/dist/mvt/map-style-loader-with-parser.js +38 -0
  215. package/dist/mvt/map-style-loader-with-parser.js.map +1 -0
  216. package/dist/mvt/map-style-loader.d.ts +44 -0
  217. package/dist/mvt/map-style-loader.d.ts.map +1 -0
  218. package/dist/mvt/map-style-loader.js +25 -0
  219. package/dist/mvt/map-style-loader.js.map +1 -0
  220. package/dist/mvt/map-style-schema.d.ts +58 -0
  221. package/dist/mvt/map-style-schema.d.ts.map +1 -0
  222. package/dist/mvt/map-style-schema.js +47 -0
  223. package/dist/mvt/map-style-schema.js.map +1 -0
  224. package/dist/mvt/map-style.d.ts +110 -0
  225. package/dist/mvt/map-style.d.ts.map +1 -0
  226. package/dist/mvt/map-style.js +90 -0
  227. package/dist/mvt/map-style.js.map +1 -0
  228. package/dist/mvt/mvt-format.d.ts +14 -0
  229. package/dist/mvt/mvt-format.d.ts.map +1 -0
  230. package/dist/mvt/mvt-format.js +23 -0
  231. package/dist/mvt/mvt-format.js.map +1 -0
  232. package/dist/mvt/mvt-geojson-loader-types.d.ts +82 -0
  233. package/dist/mvt/mvt-geojson-loader-types.d.ts.map +1 -0
  234. package/dist/mvt/mvt-geojson-loader-types.js +34 -0
  235. package/dist/mvt/mvt-geojson-loader-types.js.map +1 -0
  236. package/dist/mvt/mvt-geojson-loader.cjs +1366 -0
  237. package/dist/mvt/mvt-geojson-loader.cjs.map +6 -0
  238. package/dist/mvt/mvt-geojson-loader.d.ts +32 -0
  239. package/dist/mvt/mvt-geojson-loader.d.ts.map +1 -0
  240. package/dist/mvt/mvt-geojson-loader.js +13 -0
  241. package/dist/mvt/mvt-geojson-loader.js.map +1 -0
  242. package/dist/mvt/mvt-loader-with-parser.d.ts +105 -0
  243. package/dist/mvt/mvt-loader-with-parser.d.ts.map +1 -0
  244. package/dist/mvt/mvt-loader-with-parser.js +21 -0
  245. package/dist/mvt/mvt-loader-with-parser.js.map +1 -0
  246. package/dist/mvt/mvt-loader.d.ts +129 -0
  247. package/dist/mvt/mvt-loader.d.ts.map +1 -0
  248. package/dist/mvt/mvt-loader.js +40 -0
  249. package/dist/mvt/mvt-loader.js.map +1 -0
  250. package/dist/mvt/mvt-source-loader.d.ts +102 -0
  251. package/dist/mvt/mvt-source-loader.d.ts.map +1 -0
  252. package/dist/mvt/mvt-source-loader.js +275 -0
  253. package/dist/mvt/mvt-source-loader.js.map +1 -0
  254. package/dist/mvt/mvt-writer.d.ts +28 -0
  255. package/dist/mvt/mvt-writer.d.ts.map +1 -0
  256. package/dist/mvt/mvt-writer.js +32 -0
  257. package/dist/mvt/mvt-writer.js.map +1 -0
  258. package/dist/mvt/table-tile-source-loader.d.ts +169 -0
  259. package/dist/mvt/table-tile-source-loader.d.ts.map +1 -0
  260. package/dist/mvt/table-tile-source-loader.js +478 -0
  261. package/dist/mvt/table-tile-source-loader.js.map +1 -0
  262. package/dist/mvt/tilejson-format.d.ts +13 -0
  263. package/dist/mvt/tilejson-format.d.ts.map +1 -0
  264. package/dist/mvt/tilejson-format.js +16 -0
  265. package/dist/mvt/tilejson-format.js.map +1 -0
  266. package/dist/mvt/tilejson-loader-with-parser.d.ts +13 -0
  267. package/dist/mvt/tilejson-loader-with-parser.d.ts.map +1 -0
  268. package/dist/mvt/tilejson-loader-with-parser.js +25 -0
  269. package/dist/mvt/tilejson-loader-with-parser.js.map +1 -0
  270. package/dist/mvt/tilejson-loader.d.ts +56 -0
  271. package/dist/mvt/tilejson-loader.d.ts.map +1 -0
  272. package/dist/mvt/tilejson-loader.js +28 -0
  273. package/dist/mvt/tilejson-loader.js.map +1 -0
  274. package/dist/mvt/tilejson-zod-schema.cjs +79 -0
  275. package/dist/mvt/tilejson-zod-schema.cjs.map +6 -0
  276. package/dist/mvt/tilejson-zod-schema.d.ts +218 -0
  277. package/dist/mvt/tilejson-zod-schema.d.ts.map +1 -0
  278. package/dist/mvt/tilejson-zod-schema.js +68 -0
  279. package/dist/mvt/tilejson-zod-schema.js.map +1 -0
  280. package/dist/mvt/tilejson.schema.json +197 -0
  281. package/dist/mvt/unbundled.d.ts +8 -0
  282. package/dist/mvt/unbundled.d.ts.map +1 -0
  283. package/dist/mvt/unbundled.js +8 -0
  284. package/dist/mvt/unbundled.js.map +1 -0
  285. package/dist/mvt/workers/mvt-worker-node.d.ts +2 -0
  286. package/dist/mvt/workers/mvt-worker-node.d.ts.map +1 -0
  287. package/dist/mvt/workers/mvt-worker-node.js +8 -0
  288. package/dist/mvt/workers/mvt-worker-node.js.map +1 -0
  289. package/dist/mvt/workers/mvt-worker.d.ts +2 -0
  290. package/dist/mvt/workers/mvt-worker.d.ts.map +1 -0
  291. package/dist/mvt/workers/mvt-worker.js +7 -0
  292. package/dist/mvt/workers/mvt-worker.js.map +1 -0
  293. package/dist/mvt-worker-node.js +72460 -0
  294. package/dist/mvt-worker-node.js.map +7 -0
  295. package/dist/mvt-worker.js +21239 -0
  296. package/dist/pmtiles/bundled.d.ts +3 -0
  297. package/dist/pmtiles/bundled.d.ts.map +1 -0
  298. package/dist/pmtiles/bundled.js +5 -0
  299. package/dist/pmtiles/bundled.js.map +1 -0
  300. package/dist/pmtiles/dist.dev.js +50530 -0
  301. package/dist/pmtiles/dist.min.js +94 -0
  302. package/dist/pmtiles/geoarrow.cjs +6718 -0
  303. package/dist/pmtiles/geoarrow.cjs.map +6 -0
  304. package/dist/pmtiles/geoarrow.d.ts +30 -0
  305. package/dist/pmtiles/geoarrow.d.ts.map +1 -0
  306. package/dist/pmtiles/geoarrow.js +143 -0
  307. package/dist/pmtiles/geoarrow.js.map +1 -0
  308. package/dist/pmtiles/index.cjs +8011 -0
  309. package/dist/pmtiles/index.cjs.map +6 -0
  310. package/dist/pmtiles/index.d.ts +14 -0
  311. package/dist/pmtiles/index.d.ts.map +1 -0
  312. package/dist/pmtiles/index.js +10 -0
  313. package/dist/pmtiles/index.js.map +1 -0
  314. package/dist/pmtiles/lib/blob-source.d.ts +14 -0
  315. package/dist/pmtiles/lib/blob-source.d.ts.map +1 -0
  316. package/dist/pmtiles/lib/blob-source.js +32 -0
  317. package/dist/pmtiles/lib/blob-source.js.map +1 -0
  318. package/dist/pmtiles/lib/encode-pmtiles.d.ts +8 -0
  319. package/dist/pmtiles/lib/encode-pmtiles.d.ts.map +1 -0
  320. package/dist/pmtiles/lib/encode-pmtiles.js +268 -0
  321. package/dist/pmtiles/lib/encode-pmtiles.js.map +1 -0
  322. package/dist/pmtiles/lib/parse-pmtiles.d.ts +52 -0
  323. package/dist/pmtiles/lib/parse-pmtiles.d.ts.map +1 -0
  324. package/dist/pmtiles/lib/parse-pmtiles.js +95 -0
  325. package/dist/pmtiles/lib/parse-pmtiles.js.map +1 -0
  326. package/dist/pmtiles/lib/range-request-source.d.ts +24 -0
  327. package/dist/pmtiles/lib/range-request-source.d.ts.map +1 -0
  328. package/dist/pmtiles/lib/range-request-source.js +45 -0
  329. package/dist/pmtiles/lib/range-request-source.js.map +1 -0
  330. package/dist/pmtiles/lib/version.d.ts +2 -0
  331. package/dist/pmtiles/lib/version.d.ts.map +1 -0
  332. package/dist/pmtiles/lib/version.js +8 -0
  333. package/dist/pmtiles/lib/version.js.map +1 -0
  334. package/dist/pmtiles/pmtiles-format.d.ts +14 -0
  335. package/dist/pmtiles/pmtiles-format.d.ts.map +1 -0
  336. package/dist/pmtiles/pmtiles-format.js +17 -0
  337. package/dist/pmtiles/pmtiles-format.js.map +1 -0
  338. package/dist/pmtiles/pmtiles-loader-with-parser.d.ts +30 -0
  339. package/dist/pmtiles/pmtiles-loader-with-parser.d.ts.map +1 -0
  340. package/dist/pmtiles/pmtiles-loader-with-parser.js +41 -0
  341. package/dist/pmtiles/pmtiles-loader-with-parser.js.map +1 -0
  342. package/dist/pmtiles/pmtiles-loader.d.ts +41 -0
  343. package/dist/pmtiles/pmtiles-loader.d.ts.map +1 -0
  344. package/dist/pmtiles/pmtiles-loader.js +20 -0
  345. package/dist/pmtiles/pmtiles-loader.js.map +1 -0
  346. package/dist/pmtiles/pmtiles-source-loader.d.ts +85 -0
  347. package/dist/pmtiles/pmtiles-source-loader.d.ts.map +1 -0
  348. package/dist/pmtiles/pmtiles-source-loader.js +239 -0
  349. package/dist/pmtiles/pmtiles-source-loader.js.map +1 -0
  350. package/dist/pmtiles/pmtiles-writer-types.d.ts +39 -0
  351. package/dist/pmtiles/pmtiles-writer-types.d.ts.map +1 -0
  352. package/dist/{point-cloud-tile-source-types.js → pmtiles/pmtiles-writer-types.js} +1 -1
  353. package/dist/pmtiles/pmtiles-writer-types.js.map +1 -0
  354. package/dist/pmtiles/pmtiles-writer.d.ts +22 -0
  355. package/dist/pmtiles/pmtiles-writer.d.ts.map +1 -0
  356. package/dist/pmtiles/pmtiles-writer.js +15 -0
  357. package/dist/pmtiles/pmtiles-writer.js.map +1 -0
  358. package/dist/pmtiles/raster.cjs +1183 -0
  359. package/dist/pmtiles/raster.cjs.map +6 -0
  360. package/dist/pmtiles/raster.d.ts +30 -0
  361. package/dist/pmtiles/raster.d.ts.map +1 -0
  362. package/dist/pmtiles/raster.js +212 -0
  363. package/dist/pmtiles/raster.js.map +1 -0
  364. package/dist/pmtiles/source-info.d.ts +25 -0
  365. package/dist/pmtiles/source-info.d.ts.map +1 -0
  366. package/dist/{types.js → pmtiles/source-info.js} +1 -1
  367. package/dist/pmtiles/source-info.js.map +1 -0
  368. package/dist/pmtiles/unbundled.d.ts +3 -0
  369. package/dist/pmtiles/unbundled.d.ts.map +1 -0
  370. package/dist/pmtiles/unbundled.js +5 -0
  371. package/dist/pmtiles/unbundled.js.map +1 -0
  372. package/dist/raster-set.d.ts +1 -1
  373. package/dist/raster-set.d.ts.map +1 -1
  374. package/dist/raster-set.js +1 -1
  375. package/dist/raster-set.js.map +1 -1
  376. package/dist/tile-matrix.cjs +81 -0
  377. package/dist/tile-matrix.cjs.map +6 -0
  378. package/dist/tile-matrix.d.ts +52 -0
  379. package/dist/tile-matrix.d.ts.map +1 -0
  380. package/dist/tile-matrix.js +75 -0
  381. package/dist/tile-matrix.js.map +1 -0
  382. package/dist/tileset-2d/tile-2d-header.d.ts +2 -2
  383. package/dist/tileset-2d/tile-2d-header.d.ts.map +1 -1
  384. package/dist/tileset-2d/tile-2d-header.js +11 -11
  385. package/dist/tileset-2d/tile-2d-header.js.map +1 -1
  386. package/dist/tileset-2d/tileset-2d.d.ts +19 -10
  387. package/dist/tileset-2d/tileset-2d.d.ts.map +1 -1
  388. package/dist/tileset-2d/tileset-2d.js +69 -15
  389. package/dist/tileset-2d/tileset-2d.js.map +1 -1
  390. package/package.json +101 -25
  391. package/src/image-set.ts +1 -1
  392. package/src/index.ts +8 -128
  393. package/src/mlt/bundled.ts +9 -0
  394. package/src/mlt/index.ts +18 -0
  395. package/src/mlt/lib/encode-mlt-geometry.ts +162 -0
  396. package/src/mlt/lib/encode-mlt-streams.ts +66 -0
  397. package/src/mlt/lib/encode-mlt.ts +215 -0
  398. package/src/mlt/lib/parse-mlt.ts +906 -0
  399. package/src/mlt/libs/mlt-decoder.cjs +4552 -0
  400. package/src/mlt/mlt-format.ts +19 -0
  401. package/src/mlt/mlt-loader-with-parser.ts +57 -0
  402. package/src/mlt/mlt-loader.ts +64 -0
  403. package/src/mlt/mlt-source-loader.ts +266 -0
  404. package/src/mlt/mlt-writer.ts +47 -0
  405. package/src/mlt/unbundled.ts +6 -0
  406. package/src/mvt/arrow-table-tile-source-loader-types.ts +55 -0
  407. package/src/mvt/arrow-table-tile-source-loader.ts +307 -0
  408. package/src/mvt/arrow-table-tile-source-types.ts +32 -0
  409. package/src/mvt/bundled.ts +14 -0
  410. package/src/mvt/index.ts +67 -0
  411. package/src/mvt/lib/encode-mvt-arrow.ts +273 -0
  412. package/src/mvt/lib/encode-mvt.ts +46 -0
  413. package/src/mvt/lib/get-schemas-from-tilejson.ts +64 -0
  414. package/src/mvt/lib/is-longitude-latitude-crs.ts +15 -0
  415. package/src/mvt/lib/mapbox-vt-pbf/geojson-to-vt.ts.disabled +76 -0
  416. package/src/mvt/lib/mapbox-vt-pbf/geojson-wrapper.ts +89 -0
  417. package/src/mvt/lib/mapbox-vt-pbf/to-vector-tile.ts +230 -0
  418. package/src/mvt/lib/mvt-pbf/mvt-constants.ts +135 -0
  419. package/src/mvt/lib/mvt-pbf/mvt-types.ts +22 -0
  420. package/src/mvt/lib/mvt-pbf/parse-geometry-from-pbf.ts +285 -0
  421. package/src/mvt/lib/mvt-pbf/parse-mvt-from-pbf.ts +310 -0
  422. package/src/mvt/lib/mvt-pbf/write-mvt-to-pbf.ts +162 -0
  423. package/src/mvt/lib/mvt-worker-transport.ts +74 -0
  424. package/src/mvt/lib/parse-mvt-geojson.ts +65 -0
  425. package/src/mvt/lib/parse-mvt.ts +145 -0
  426. package/src/mvt/lib/parse-tilejson.ts +397 -0
  427. package/src/mvt/lib/resolve-table-tile-parameters.ts +23 -0
  428. package/src/mvt/lib/types.ts +90 -0
  429. package/src/mvt/lib/utils/geometry-utils.ts +238 -0
  430. package/src/mvt/lib/vector-tile/LICENSE.txt +31 -0
  431. package/src/mvt/lib/vector-tile/vector-tile-feature.ts +430 -0
  432. package/src/mvt/lib/vector-tile/vector-tile-layer.ts +130 -0
  433. package/src/mvt/lib/vector-tile/vector-tile.ts +32 -0
  434. package/src/mvt/lib/vector-tiler/LICENSE +19 -0
  435. package/src/mvt/lib/vector-tiler/arrow-tile.ts +93 -0
  436. package/src/mvt/lib/vector-tiler/features/clip-features.ts +250 -0
  437. package/src/mvt/lib/vector-tiler/features/convert-feature.ts +213 -0
  438. package/src/mvt/lib/vector-tiler/features/proto-feature.ts +104 -0
  439. package/src/mvt/lib/vector-tiler/features/simplify-path.ts +84 -0
  440. package/src/mvt/lib/vector-tiler/features/wrap-features.ts +125 -0
  441. package/src/mvt/lib/vector-tiler/proto-tile.ts +217 -0
  442. package/src/mvt/lib/vector-tiler/tile-to-geojson.ts +104 -0
  443. package/src/mvt/lib/vector-tiler/transform-tile.ts +57 -0
  444. package/src/mvt/map-style-format.ts +18 -0
  445. package/src/mvt/map-style-loader-with-parser.ts +62 -0
  446. package/src/mvt/map-style-loader.ts +31 -0
  447. package/src/mvt/map-style-schema.ts +53 -0
  448. package/src/mvt/map-style.ts +218 -0
  449. package/src/mvt/mvt-format.ts +25 -0
  450. package/src/mvt/mvt-geojson-loader-types.ts +60 -0
  451. package/src/mvt/mvt-geojson-loader.ts +20 -0
  452. package/src/mvt/mvt-loader-with-parser.ts +53 -0
  453. package/src/mvt/mvt-loader.ts +73 -0
  454. package/src/mvt/mvt-source-loader.ts +410 -0
  455. package/src/mvt/mvt-writer.ts +35 -0
  456. package/src/mvt/table-tile-source-loader.ts +672 -0
  457. package/src/mvt/tilejson-format.ts +18 -0
  458. package/src/mvt/tilejson-loader-with-parser.ts +38 -0
  459. package/src/mvt/tilejson-loader.ts +42 -0
  460. package/src/mvt/tilejson-zod-schema.ts +199 -0
  461. package/src/mvt/unbundled.ts +13 -0
  462. package/src/mvt/workers/mvt-worker-node.ts +9 -0
  463. package/src/mvt/workers/mvt-worker.ts +8 -0
  464. package/src/pmtiles/bundled.ts +6 -0
  465. package/src/pmtiles/geoarrow.ts +188 -0
  466. package/src/pmtiles/index.ts +27 -0
  467. package/src/pmtiles/lib/blob-source.ts +41 -0
  468. package/src/pmtiles/lib/encode-pmtiles.ts +322 -0
  469. package/src/pmtiles/lib/parse-pmtiles.ts +180 -0
  470. package/src/pmtiles/lib/range-request-source.ts +60 -0
  471. package/src/pmtiles/lib/version.ts +8 -0
  472. package/src/pmtiles/pmtiles-format.ts +19 -0
  473. package/src/pmtiles/pmtiles-loader-with-parser.ts +60 -0
  474. package/src/pmtiles/pmtiles-loader.ts +30 -0
  475. package/src/pmtiles/pmtiles-source-loader.ts +346 -0
  476. package/src/pmtiles/pmtiles-writer-types.ts +45 -0
  477. package/src/pmtiles/pmtiles-writer.ts +26 -0
  478. package/src/pmtiles/raster.ts +289 -0
  479. package/src/pmtiles/source-info.ts +25 -0
  480. package/src/pmtiles/unbundled.ts +6 -0
  481. package/src/raster-set.ts +2 -2
  482. package/src/tile-matrix.ts +138 -0
  483. package/src/tileset-2d/tile-2d-header.ts +14 -13
  484. package/src/tileset-2d/tileset-2d.ts +81 -19
  485. package/dist/constants.d.ts +0 -38
  486. package/dist/constants.d.ts.map +0 -1
  487. package/dist/constants.js +0 -39
  488. package/dist/constants.js.map +0 -1
  489. package/dist/point-cloud/point-cloud-tile.d.ts +0 -47
  490. package/dist/point-cloud/point-cloud-tile.d.ts.map +0 -1
  491. package/dist/point-cloud/point-cloud-tile.js +0 -70
  492. package/dist/point-cloud/point-cloud-tile.js.map +0 -1
  493. package/dist/point-cloud/point-cloud-tileset.d.ts +0 -135
  494. package/dist/point-cloud/point-cloud-tileset.d.ts.map +0 -1
  495. package/dist/point-cloud/point-cloud-tileset.js +0 -549
  496. package/dist/point-cloud/point-cloud-tileset.js.map +0 -1
  497. package/dist/point-cloud/types.d.ts +0 -81
  498. package/dist/point-cloud/types.d.ts.map +0 -1
  499. package/dist/point-cloud/types.js.map +0 -1
  500. package/dist/point-cloud-tile-source-loader-types.d.ts +0 -31
  501. package/dist/point-cloud-tile-source-loader-types.d.ts.map +0 -1
  502. package/dist/point-cloud-tile-source-loader-types.js +0 -34
  503. package/dist/point-cloud-tile-source-loader-types.js.map +0 -1
  504. package/dist/point-cloud-tile-source-loader.cjs +0 -81
  505. package/dist/point-cloud-tile-source-loader.cjs.map +0 -7
  506. package/dist/point-cloud-tile-source-loader.d.ts +0 -27
  507. package/dist/point-cloud-tile-source-loader.d.ts.map +0 -1
  508. package/dist/point-cloud-tile-source-loader.js +0 -17
  509. package/dist/point-cloud-tile-source-loader.js.map +0 -1
  510. package/dist/point-cloud-tile-source-types.d.ts +0 -15
  511. package/dist/point-cloud-tile-source-types.d.ts.map +0 -1
  512. package/dist/point-cloud-tile-source-types.js.map +0 -1
  513. package/dist/point-cloud-tile-source.cjs +0 -105
  514. package/dist/point-cloud-tile-source.cjs.map +0 -7
  515. package/dist/point-cloud-tile-source.d.ts +0 -36
  516. package/dist/point-cloud-tile-source.d.ts.map +0 -1
  517. package/dist/point-cloud-tile-source.js +0 -84
  518. package/dist/point-cloud-tile-source.js.map +0 -1
  519. package/dist/spatial/format-spatial-reference.d.ts +0 -68
  520. package/dist/spatial/format-spatial-reference.d.ts.map +0 -1
  521. package/dist/spatial/format-spatial-reference.js +0 -291
  522. package/dist/spatial/format-spatial-reference.js.map +0 -1
  523. package/dist/spatial/get-spatial-coordinate-frame.d.ts +0 -20
  524. package/dist/spatial/get-spatial-coordinate-frame.d.ts.map +0 -1
  525. package/dist/spatial/get-spatial-coordinate-frame.js +0 -139
  526. package/dist/spatial/get-spatial-coordinate-frame.js.map +0 -1
  527. package/dist/spatial/i3s-elevation.d.ts +0 -20
  528. package/dist/spatial/i3s-elevation.d.ts.map +0 -1
  529. package/dist/spatial/i3s-elevation.js +0 -90
  530. package/dist/spatial/i3s-elevation.js.map +0 -1
  531. package/dist/spatial/i3s-spatial-transformer.d.ts +0 -205
  532. package/dist/spatial/i3s-spatial-transformer.d.ts.map +0 -1
  533. package/dist/spatial/i3s-spatial-transformer.js +0 -731
  534. package/dist/spatial/i3s-spatial-transformer.js.map +0 -1
  535. package/dist/spatial/normalize-crs-identifier.d.ts +0 -15
  536. package/dist/spatial/normalize-crs-identifier.d.ts.map +0 -1
  537. package/dist/spatial/normalize-crs-identifier.js +0 -22
  538. package/dist/spatial/normalize-crs-identifier.js.map +0 -1
  539. package/dist/spatial/spatial-coordinate-transformer.d.ts +0 -54
  540. package/dist/spatial/spatial-coordinate-transformer.d.ts.map +0 -1
  541. package/dist/spatial/spatial-coordinate-transformer.js +0 -311
  542. package/dist/spatial/spatial-coordinate-transformer.js.map +0 -1
  543. package/dist/spatial/spatial-resource-registry.d.ts +0 -47
  544. package/dist/spatial/spatial-resource-registry.d.ts.map +0 -1
  545. package/dist/spatial/spatial-resource-registry.js +0 -76
  546. package/dist/spatial/spatial-resource-registry.js.map +0 -1
  547. package/dist/spatial/spatial-types.d.ts +0 -190
  548. package/dist/spatial/spatial-types.d.ts.map +0 -1
  549. package/dist/spatial/spatial-types.js +0 -192
  550. package/dist/spatial/spatial-types.js.map +0 -1
  551. package/dist/spatial/tiles-3d-spatial-transformer.d.ts +0 -32
  552. package/dist/spatial/tiles-3d-spatial-transformer.d.ts.map +0 -1
  553. package/dist/spatial/tiles-3d-spatial-transformer.js +0 -163
  554. package/dist/spatial/tiles-3d-spatial-transformer.js.map +0 -1
  555. package/dist/tileset-3d/common/indexed-archive-tileset-source.d.ts +0 -60
  556. package/dist/tileset-3d/common/indexed-archive-tileset-source.d.ts.map +0 -1
  557. package/dist/tileset-3d/common/indexed-archive-tileset-source.js +0 -130
  558. package/dist/tileset-3d/common/indexed-archive-tileset-source.js.map +0 -1
  559. package/dist/tileset-3d/common/tile-3d-contracts.d.ts +0 -63
  560. package/dist/tileset-3d/common/tile-3d-contracts.d.ts.map +0 -1
  561. package/dist/tileset-3d/common/tile-3d-contracts.js +0 -51
  562. package/dist/tileset-3d/common/tile-3d-contracts.js.map +0 -1
  563. package/dist/tileset-3d/common/tile-3d.d.ts +0 -410
  564. package/dist/tileset-3d/common/tile-3d.d.ts.map +0 -1
  565. package/dist/tileset-3d/common/tile-3d.js +0 -1056
  566. package/dist/tileset-3d/common/tile-3d.js.map +0 -1
  567. package/dist/tileset-3d/common/tileset-3d.d.ts +0 -369
  568. package/dist/tileset-3d/common/tileset-3d.d.ts.map +0 -1
  569. package/dist/tileset-3d/common/tileset-3d.js +0 -879
  570. package/dist/tileset-3d/common/tileset-3d.js.map +0 -1
  571. package/dist/tileset-3d/common/tileset-cache.d.ts +0 -29
  572. package/dist/tileset-3d/common/tileset-cache.d.ts.map +0 -1
  573. package/dist/tileset-3d/common/tileset-cache.js +0 -82
  574. package/dist/tileset-3d/common/tileset-cache.js.map +0 -1
  575. package/dist/tileset-3d/common/tileset-content-traversal.d.ts +0 -37
  576. package/dist/tileset-3d/common/tileset-content-traversal.d.ts.map +0 -1
  577. package/dist/tileset-3d/common/tileset-content-traversal.js +0 -80
  578. package/dist/tileset-3d/common/tileset-content-traversal.js.map +0 -1
  579. package/dist/tileset-3d/common/tileset-observability.d.ts +0 -60
  580. package/dist/tileset-3d/common/tileset-observability.d.ts.map +0 -1
  581. package/dist/tileset-3d/common/tileset-observability.js +0 -39
  582. package/dist/tileset-3d/common/tileset-observability.js.map +0 -1
  583. package/dist/tileset-3d/common/tileset-source.d.ts +0 -228
  584. package/dist/tileset-3d/common/tileset-source.d.ts.map +0 -1
  585. package/dist/tileset-3d/common/tileset-source.js +0 -17
  586. package/dist/tileset-3d/common/tileset-source.js.map +0 -1
  587. package/dist/tileset-3d/common/tileset-traverser.d.ts +0 -88
  588. package/dist/tileset-3d/common/tileset-traverser.d.ts.map +0 -1
  589. package/dist/tileset-3d/common/tileset-traverser.js +0 -341
  590. package/dist/tileset-3d/common/tileset-traverser.js.map +0 -1
  591. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts +0 -182
  592. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts.map +0 -1
  593. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js +0 -678
  594. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js.map +0 -1
  595. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts +0 -221
  596. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts.map +0 -1
  597. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js +0 -770
  598. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js.map +0 -1
  599. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts +0 -111
  600. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts.map +0 -1
  601. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js +0 -339
  602. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js.map +0 -1
  603. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts +0 -27
  604. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts.map +0 -1
  605. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js +0 -45
  606. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js.map +0 -1
  607. package/dist/tileset-3d/format-i3s/i3s-source.d.ts +0 -116
  608. package/dist/tileset-3d/format-i3s/i3s-source.d.ts.map +0 -1
  609. package/dist/tileset-3d/format-i3s/i3s-source.js +0 -450
  610. package/dist/tileset-3d/format-i3s/i3s-source.js.map +0 -1
  611. package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts +0 -34
  612. package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts.map +0 -1
  613. package/dist/tileset-3d/format-i3s/i3s-tile-manager.js +0 -81
  614. package/dist/tileset-3d/format-i3s/i3s-tile-manager.js.map +0 -1
  615. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts +0 -25
  616. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts.map +0 -1
  617. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js +0 -84
  618. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js.map +0 -1
  619. package/dist/tileset-3d/helpers/3d-tiles-options.d.ts +0 -5
  620. package/dist/tileset-3d/helpers/3d-tiles-options.d.ts.map +0 -1
  621. package/dist/tileset-3d/helpers/3d-tiles-options.js +0 -9
  622. package/dist/tileset-3d/helpers/3d-tiles-options.js.map +0 -1
  623. package/dist/tileset-3d/helpers/bounding-volume.d.ts +0 -23
  624. package/dist/tileset-3d/helpers/bounding-volume.d.ts.map +0 -1
  625. package/dist/tileset-3d/helpers/bounding-volume.js +0 -236
  626. package/dist/tileset-3d/helpers/bounding-volume.js.map +0 -1
  627. package/dist/tileset-3d/helpers/frame-state.d.ts +0 -93
  628. package/dist/tileset-3d/helpers/frame-state.d.ts.map +0 -1
  629. package/dist/tileset-3d/helpers/frame-state.js +0 -211
  630. package/dist/tileset-3d/helpers/frame-state.js.map +0 -1
  631. package/dist/tileset-3d/helpers/i3s-lod.d.ts +0 -20
  632. package/dist/tileset-3d/helpers/i3s-lod.d.ts.map +0 -1
  633. package/dist/tileset-3d/helpers/i3s-lod.js +0 -95
  634. package/dist/tileset-3d/helpers/i3s-lod.js.map +0 -1
  635. package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts +0 -17
  636. package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts.map +0 -1
  637. package/dist/tileset-3d/helpers/s2-bounding-volume.js +0 -17
  638. package/dist/tileset-3d/helpers/s2-bounding-volume.js.map +0 -1
  639. package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts +0 -72
  640. package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts.map +0 -1
  641. package/dist/tileset-3d/helpers/tiles-3d-lod.js +0 -257
  642. package/dist/tileset-3d/helpers/tiles-3d-lod.js.map +0 -1
  643. package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts +0 -134
  644. package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts.map +0 -1
  645. package/dist/tileset-3d/helpers/tiles-3d-request-priority.js +0 -179
  646. package/dist/tileset-3d/helpers/tiles-3d-request-priority.js.map +0 -1
  647. package/dist/tileset-3d/helpers/transform-utils.d.ts +0 -3
  648. package/dist/tileset-3d/helpers/transform-utils.d.ts.map +0 -1
  649. package/dist/tileset-3d/helpers/transform-utils.js +0 -86
  650. package/dist/tileset-3d/helpers/transform-utils.js.map +0 -1
  651. package/dist/tileset-3d/helpers/zoom.d.ts +0 -46
  652. package/dist/tileset-3d/helpers/zoom.d.ts.map +0 -1
  653. package/dist/tileset-3d/helpers/zoom.js +0 -86
  654. package/dist/tileset-3d/helpers/zoom.js.map +0 -1
  655. package/dist/types.d.ts +0 -48
  656. package/dist/types.d.ts.map +0 -1
  657. package/dist/types.js.map +0 -1
  658. package/dist/utils/doubly-linked-list-node.d.ts +0 -11
  659. package/dist/utils/doubly-linked-list-node.d.ts.map +0 -1
  660. package/dist/utils/doubly-linked-list-node.js +0 -20
  661. package/dist/utils/doubly-linked-list-node.js.map +0 -1
  662. package/dist/utils/doubly-linked-list.d.ts +0 -30
  663. package/dist/utils/doubly-linked-list.d.ts.map +0 -1
  664. package/dist/utils/doubly-linked-list.js +0 -93
  665. package/dist/utils/doubly-linked-list.js.map +0 -1
  666. package/dist/utils/managed-array.d.ts +0 -85
  667. package/dist/utils/managed-array.d.ts.map +0 -1
  668. package/dist/utils/managed-array.js +0 -152
  669. package/dist/utils/managed-array.js.map +0 -1
  670. package/src/constants.ts +0 -59
  671. package/src/point-cloud/point-cloud-tile.ts +0 -80
  672. package/src/point-cloud/point-cloud-tileset.ts +0 -767
  673. package/src/point-cloud/types.ts +0 -99
  674. package/src/point-cloud-tile-source-loader-types.ts +0 -53
  675. package/src/point-cloud-tile-source-loader.ts +0 -32
  676. package/src/point-cloud-tile-source-types.ts +0 -20
  677. package/src/point-cloud-tile-source.ts +0 -112
  678. package/src/spatial/format-spatial-reference.ts +0 -385
  679. package/src/spatial/get-spatial-coordinate-frame.ts +0 -169
  680. package/src/spatial/i3s-elevation.ts +0 -96
  681. package/src/spatial/i3s-spatial-transformer.ts +0 -1021
  682. package/src/spatial/normalize-crs-identifier.ts +0 -26
  683. package/src/spatial/spatial-coordinate-transformer.ts +0 -397
  684. package/src/spatial/spatial-resource-registry.ts +0 -90
  685. package/src/spatial/spatial-types.ts +0 -422
  686. package/src/spatial/tiles-3d-spatial-transformer.ts +0 -194
  687. package/src/tileset-3d/common/indexed-archive-tileset-source.ts +0 -205
  688. package/src/tileset-3d/common/tile-3d-contracts.ts +0 -115
  689. package/src/tileset-3d/common/tile-3d.ts +0 -1310
  690. package/src/tileset-3d/common/tileset-3d.ts +0 -1210
  691. package/src/tileset-3d/common/tileset-cache.ts +0 -111
  692. package/src/tileset-3d/common/tileset-content-traversal.ts +0 -114
  693. package/src/tileset-3d/common/tileset-observability.ts +0 -100
  694. package/src/tileset-3d/common/tileset-source.ts +0 -284
  695. package/src/tileset-3d/common/tileset-traverser.ts +0 -416
  696. package/src/tileset-3d/format-3d-tiles/implicit-tiling.ts +0 -1056
  697. package/src/tileset-3d/format-3d-tiles/tiles-3d-source.ts +0 -1025
  698. package/src/tileset-3d/format-3d-tiles/tileset-3d-traverser.ts +0 -391
  699. package/src/tileset-3d/format-i3s/i3s-pending-tiles-register.ts +0 -48
  700. package/src/tileset-3d/format-i3s/i3s-source.ts +0 -557
  701. package/src/tileset-3d/format-i3s/i3s-tile-manager.ts +0 -105
  702. package/src/tileset-3d/format-i3s/i3s-tileset-traverser.ts +0 -102
  703. package/src/tileset-3d/helpers/3d-tiles-options.ts +0 -11
  704. package/src/tileset-3d/helpers/bounding-volume.ts +0 -281
  705. package/src/tileset-3d/helpers/frame-state.ts +0 -322
  706. package/src/tileset-3d/helpers/i3s-lod.ts +0 -109
  707. package/src/tileset-3d/helpers/s2-bounding-volume.ts +0 -32
  708. package/src/tileset-3d/helpers/tiles-3d-lod.ts +0 -370
  709. package/src/tileset-3d/helpers/tiles-3d-request-priority.ts +0 -301
  710. package/src/tileset-3d/helpers/transform-utils.ts +0 -109
  711. package/src/tileset-3d/helpers/zoom.ts +0 -120
  712. package/src/types.ts +0 -54
  713. package/src/utils/doubly-linked-list-node.ts +0 -22
  714. package/src/utils/doubly-linked-list.ts +0 -105
  715. package/src/utils/managed-array.ts +0 -174
  716. /package/dist/{point-cloud → mvt/lib}/types.js +0 -0
package/dist/dist.min.js CHANGED
@@ -4,27 +4,8 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var nI=Object.create;var xh=Object.defineProperty;var iI=Object.getOwnPropertyDescriptor;var oI=Object.getOwnPropertyNames;var sI=Object.getPrototypeOf,aI=Object.prototype.hasOwnProperty;var S=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var cI=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},tr=(e,t)=>{for(var r in t)xh(e,r,{get:t[r],enumerable:!0})},o1=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oI(t))!aI.call(e,i)&&i!==r&&xh(e,i,{get:()=>t[i],enumerable:!(n=iI(t,i))||n.enumerable});return e};var lI=(e,t,r)=>(r=e!=null?nI(sI(e)):{},o1(t||!e||!e.__esModule?xh(r,"default",{value:e,enumerable:!0}):r,e)),hI=e=>o1(xh({},"__esModule",{value:!0}),e);var a1=cI((PB,s1)=>{s1.exports=globalThis.loaders});function bc(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var ym=S(()=>{});var Xo,_m=S(()=>{ym();Xo=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=bc(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(bc()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}});var Yr,U_=S(()=>{_m();Yr=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof Xo?i=t:i=new Xo(r,n),this.stats[r]=i),i}}});var Sc=S(()=>{U_();_m();ym()});function un(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var z_=S(()=>{"use strict"});var Wh,t4,Hh,e4,dD,V_=S(()=>{Wh=globalThis,t4=globalThis.document||{},Hh=globalThis.process||{},e4=globalThis.console,dD=globalThis.navigator||{}});function G_(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}var k_=S(()=>{});function Zo(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||G_()}var q_=S(()=>{k_()});var wm,$h=S(()=>{V_();q_();wm="4.1.1"});function da(e,t){if(!e)throw new Error(t||"Assertion failed")}var bm=S(()=>{});function Sm(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return da(Number.isFinite(t)&&t>=0),t}function j_(e){let{logLevel:t,message:r}=e;e.logLevel=Sm(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return da(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}var W_=S(()=>{bm()});var Jo,Yh,H_=S(()=>{W_();Jo=()=>{},Yh=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,i,o={}){let s=j_({logLevel:r,message:n,args:this._buildArgs(r,n,i),opts:o});return this._createLogFunction(t,s,o)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return Jo;let i=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&i!==void 0){if(this._onceCache.has(i))return Jo;this._onceCache.add(i)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=Sm(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}}});function n4(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Kh,$_=S(()=>{Kh=class{constructor(t,r,n="sessionStorage"){this.storage=n4(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}}});function Y_(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function K_(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var X_=S(()=>{});function Z_(e){return typeof e!="string"?e:(e=e.toUpperCase(),Xh[e]||Xh.WHITE)}function J_(e,t,r){return!Zo&&typeof e=="string"&&(t&&(e=`\x1B[${Z_(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Z_(r)+i4}m${e}\x1B[49m`)),e}var Xh,i4,Q_=S(()=>{$h();(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Xh||(Xh={}));i4=10});function tw(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}var ew=S(()=>{});function ma(){let e;if(Zo()&&Wh.performance)e=Wh?.performance?.now?.();else if("hrtime"in Hh){let t=Hh?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var rw=S(()=>{$h()});function o4(e,t,r){if(typeof t=="string"){let n=r.time?K_(Y_(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=J_(t,r.color,r.background)}return t}function s4(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var pa,xm,oi,Mm=S(()=>{$h();H_();$_();X_();Q_();ew();bm();rw();pa={debug:Zo()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},xm={enabled:!0,level:0},oi=class extends Yh{constructor({id:t}={id:""}){super({level:0}),this.VERSION=wm,this._startTs=ma(),this._deltaTs=ma(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Kh(`__probe-${this.id}__`,{[this.id]:xm}),this.timeStamp(`${this.id} started`),tw(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((ma()-this._startTs).toPrecision(10))}getDelta(){return Number((ma()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t,...r){return this._log("warn",0,t,r,{method:pa.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:pa.error})}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r,...n){return this._log("log",t,r,n,{method:pa.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:pa.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:pa.debug||pa.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||Jo,tag:s4(r)}):Jo}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||Jo})}group(t,r,n={collapsed:!1}){let i=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:i})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||Jo})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;da(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=ma();let i=o4(this.id,r.message,r);return n.bind(console,i,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(xm),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...xm};this._storage.setConfiguration({[this.id]:{...r,...t}})}};oi.VERSION=wm});var nw=S(()=>{globalThis.probe={}});var qD,iw=S(()=>{Mm();Mm();nw();qD=new oi({id:"@probe.gl/log"})});function c4(){let e=new oi({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=a4,globalThis.probe||={},globalThis.probe.loaders=e,e}var vm,a4,ow,sw=S(()=>{"use strict";iw();vm="5.0.0-alpha.12",a4=vm[0]>="0"&&vm[0]<="9"?`v${vm}`:"";ow=c4()});var l4,aw,cw=S(()=>{"use strict";l4=e=>e!==null&&typeof e=="object",aw=e=>l4(e)&&e.constructor==={}.constructor});function Zh(e,t){return lw(e||{},t)}function lw(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,o]of Object.entries(t))aw(o)?n[i]=lw(n[i]||{},t[i],r+1):n[i]=t[i];return n}var hw=S(()=>{"use strict";cw()});function Jh(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}var uw=S(()=>{"use strict"});var h4,u4,f4,d4,m4,p4,si,fw=S(()=>{"use strict";Sc();h4="Queued Requests",u4="Active Requests",f4="Cancelled Requests",d4="Queued Requests Ever",m4="Active Requests Ever",p4={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},si=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...p4,...t},this.stats=new Yr({id:this.props.id}),this.stats.get(h4),this.stats.get(u4),this.stats.get(f4),this.stats.get(d4),this.stats.get(m4)}setProps(t){t.throttleRequests!==void 0&&(this.props.throttleRequests=t.throttleRequests),t.maxRequests!==void 0&&(this.props.maxRequests=t.maxRequests),t.debounceTime!==void 0&&(this.props.debounceTime=t.debounceTime)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},i=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){let{handle:r,resolve:n}=t,i=!1,o=()=>{i||(i=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}}});function Em(e,t=[]){return e.every(Tm)?e:e.map((r,n)=>{if(Tm(r))return r;let i=t.find(s=>s.type===r?.type);if(!i)throw new Error(`No authentication class registered for credential at index ${n}.`);let o;try{o=new i(r)}catch{throw new Error(`Invalid authentication configuration at index ${n}.`)}if(!Tm(o))throw new Error(`Authentication class returned an invalid credential at index ${n}.`);return o})}function Im(e){if(!e.core?.credentials?.length)return e;let t=Em(e.core.credentials,e.core.authentications);return t===e.core.credentials?e:{...e,core:{...e.core,credentials:t}}}function Tm(e){return!e||typeof e!="object"||typeof e.id!="string"||!Array.isArray(e.origins)?!1:e.type==="request"?typeof e.authenticate=="function":(e.type==="header"||e.type==="query-parameter")&&typeof e.name=="string"&&(typeof e.token=="string"||typeof e.token=="function")&&Array.isArray(e.refreshStatusCodes)}var Am=S(()=>{"use strict"});function Rm(){let e=new Error("Request aborted");return e.name="AbortError",e}function dw(e,t,r){let n=e??t;if(n<0||Number.isNaN(n))throw new Error(`${r} must be a non-negative number`);return n}function mw(e){if(!Number.isFinite(e)||e<0)throw new Error("Request cache entry byte length must be a non-negative finite number");return e}var g4,y4,xc,pw=S(()=>{"use strict";g4=Number.POSITIVE_INFINITY,y4=Number.POSITIVE_INFINITY,xc=class{maxEntries;maxBytes;getByteLength;onRemove;entries=new Map;retainedByteLength=0;constructor(t={}){this.maxEntries=dw(t.maxEntries,g4,"maxEntries"),this.maxBytes=dw(t.maxBytes,y4,"maxBytes"),this.getByteLength=t.getByteLength||(()=>0),this.onRemove=t.onRemove}get size(){return this.entries.size}get pendingSize(){let t=0;for(let r of this.entries.values())t+=r.pending?1:0;return t}get byteLength(){return this.retainedByteLength}get(t,r){let n=this.entries.get(t);if(n)return this.touch(t,n),this.waitForEntry(t,n,r)}has(t){return this.entries.has(t)}set(t,r){this.removeEntry(t,"replace");let n=mw(this.getByteLength(r)),i={promise:Promise.resolve(r),pending:!1,waiterCount:0,byteLength:n};return this.entries.set(t,i),this.retainedByteLength+=n,this.trim(),r}getOrLoad(t,r,n){let i=this.get(t,n);if(i)return i;if(n?.aborted)return Promise.reject(Rm());let o=new AbortController,s,a,l={promise:new Promise((h,u)=>{s=h,a=u}),controller:o,pending:!0,waiterCount:0,byteLength:0};this.entries.set(t,l),l.promise.then(h=>this.handleLoadedValue(t,l,h),()=>this.handleLoadError(t,l));try{Promise.resolve(r(o.signal)).then(s,a)}catch(h){a(h)}return this.waitForEntry(t,l,n)}delete(t){return this.removeEntry(t,"delete")}clear(){for(let t of Array.from(this.entries.keys()))this.removeEntry(t,"clear")}handleLoadedValue(t,r,n){if(this.entries.get(t)===r){r.pending=!1,r.controller=void 0;try{r.byteLength=mw(this.getByteLength(n))}catch{this.removeEntry(t,"error");return}this.retainedByteLength+=r.byteLength,this.trim()}}handleLoadError(t,r){this.entries.get(t)===r&&this.removeEntry(t,r.controller?.signal.aborted?"abort":"error")}waitForEntry(t,r,n){return n?.aborted?Promise.reject(Rm()):r.pending?(r.waiterCount++,new Promise((i,o)=>{let s=!0,a=()=>{s&&(s=!1,n?.removeEventListener("abort",c),r.waiterCount--)},c=()=>{s&&(a(),o(Rm()),r.pending&&r.waiterCount===0&&this.entries.get(t)===r&&this.removeEntry(t,"abort"))};n?.addEventListener("abort",c,{once:!0}),r.promise.then(l=>{s&&(a(),i(l))},l=>{s&&(a(),o(l))})})):r.promise}touch(t,r){this.entries.delete(t),this.entries.set(t,r)}trim(){let t=this.entries.size-this.pendingSize;if(!(t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)){for(let[r,n]of this.entries)if(n.pending||(this.removeEntry(r,"evict"),t--),t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)break}}removeEntry(t,r){let n=this.entries.get(t);return n?(this.entries.delete(t),this.retainedByteLength-=n.byteLength,n.pending&&n.controller?.abort(),this.onRemove?.(t,r),!0):!1}}});function _4(e){let t=e.fetch||((u,f)=>fetch(u,f)),r=t[gw],n=new Map(r?.credentialResolutions),i=Em(e.credentials.map(u=>n.get(u)||u),e.authentications);if(e.credentials.forEach((u,f)=>{n.set(u,i[f])}),!e.fetchOptions&&(!i.length||r?.credentials.length===i.length&&i.every((u,f)=>u===r.credentials[f])))return t;let o=r?.fetch||t,s=r?[...new Set([...i,...r.credentials])]:i,a=yw(r?.fetchOptions||{},e.fetchOptions),c=s.filter(u=>u.type!=="request"),l=s.filter(u=>u.type==="request");for(let u of l)xw(u.origins);let h=async(u,f={})=>{if(f=yw(a,f),f.signal?.aborted)throw Mc();if(!s.length)return o(u,f);let d=S4(u),m=d?await ww(d,f,c):{url:u,options:f,credentials:[]},p=await _w(m,l,"request"),g=await o(p.url,p.options),y=[];for(let T of m.credentials){let{credential:I}=T;typeof I.token=="function"&&(Qh(f)||I.canReplayRequest?.(u,f))&&(Qh(p.options)||I.canReplayRequest?.(p.url,p.options))&&(I.refreshStatusCodes.includes(g.status)||await I.shouldRefresh?.(g))&&y.push(T)}let w=Qh(f)&&Qh(p.options)&&p.credentials.some(T=>T.refreshStatusCodes?.includes(g.status));if(!y.length&&!w)return g;if(f.signal?.aborted)throw Mc();let M=new Map;if(await Promise.all(y.map(async({credential:T})=>{let I=await w4(T,u,g);I&&M.set(T,I)})),!M.size&&!w)return g;if(await g.body?.cancel().catch(()=>{}),f.signal?.aborted)throw Mc();let x=d?await ww(d,f,c,M,m.credentials):{url:u,options:f},v=await _w(x,l,"retry",g);return o(v.url,v.options)};return Object.defineProperty(h,gw,{value:{fetch:o,credentials:s,credentialResolutions:n,fetchOptions:a}}),h}function bw(e={}){let t=e.fetch??e.core?.fetch,r;return typeof t=="function"?r=t:r=(n,i)=>fetch(n,i),_4({fetch:r,fetchOptions:typeof t=="object"&&t?t:void 0,credentials:e.core?.credentials||[],authentications:e.core?.authentications})}function yw(e,t){let r={...e,...t};if(e.headers||t?.headers){let n=new Headers(e.headers);new Headers(t?.headers).forEach((i,o)=>n.set(o,i)),r.headers=n}return r}async function _w(e,t,r,n){let i=[],o=e.options.signal;for(let s of t){let a=Sw(e.url);if(!a||!xw(s.origins).includes(a))continue;if(o?.aborted)throw Mc();let c=await s.authenticate({url:e.url,options:{...e.options,headers:new Headers(e.options.headers)},reason:r,response:n?{status:n.status,headers:new Headers(n.headers)}:void 0});if(!c||typeof c.url!="string"||!c.options||typeof c.options!="object")throw new Error("Authentication callback returned an invalid request.");e={url:c.url,options:{...c.options,...o?{signal:o}:{}}},i.push(s)}if(o?.aborted)throw Mc();return{...e,credentials:i}}function Sw(e){try{let t=new URL(e);return!t.host||t.username||t.password?null:t.origin!=="null"?t.origin:`${t.protocol}//${t.host}`}catch{return null}}function xw(e){if(!e.length)throw new Error("Request authentication requires at least one exact origin.");return e.map(t=>{let r=Sw(t),n;try{n=new URL(t)}catch{throw new Error("Invalid request authentication origin.")}if(!r||n.pathname&&n.pathname!=="/"||n.search||n.hash)throw new Error("Invalid request authentication origin.");return r})}async function ww(e,t,r,n=new Map,i=[]){let o=new URL(e),s=new Headers(t.headers),a=[],c=new Map(i.map(({credential:l,token:h})=>[l,h]));for(let l of r){if(!l.origins.includes(o.origin))continue;let h=n.get(l),u=c.get(l),f=l.type==="query-parameter"&&u!==void 0,d=l.type==="header"&&u!==void 0;if(l.type==="query-parameter"&&o.searchParams.has(l.name)&&!f||l.type==="header"&&s.has(l.name)&&!d)continue;let m=h??u??await b4(l.token,{url:e.toString(),reason:"request"});m&&(l.type==="query-parameter"?o.searchParams.set(l.name,m):s.set(l.name,`${l.prefix||""}${m}`),a.push({credential:l,token:m}))}return{url:o.toString(),options:{...t,headers:s},credentials:a}}async function w4(e,t,r){let n=Cm.get(e);if(n)return n;let i=e.token,o=Promise.resolve(i({url:t,reason:"refresh",response:{status:r.status,headers:r.headers}})).finally(()=>Cm.delete(e));return Cm.set(e,o),o}async function b4(e,t){return typeof e=="function"?e(t):e}function S4(e){try{let t=new URL(e);return["http:","https:"].includes(t.protocol)?t:null}catch{return null}}function Qh(e){let t=(e.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(t)?!(e.body&&typeof ReadableStream<"u"&&e.body instanceof ReadableStream):!1}function Mc(){return new DOMException("The operation was aborted.","AbortError")}var gw,Cm,Mw=S(()=>{"use strict";Am();gw=Symbol("loaders.gl.authenticated-fetch"),Cm=new WeakMap});function x4(e,t){switch((t.type==="response"||t.type==="error")&&t.networkTimeMs!==void 0&&e.get(Lt.networkTimeMs,"time").addTime(t.networkTimeMs),t.type){case"queued":e.get(Lt.logicalRanges,"count").incrementCount(),e.get(Lt.requestedBytes,"count").addCount(t.logicalBytes||0);break;case"batch":e.get(Lt.rangeBatches,"count").incrementCount(),e.get("Logical Ranges Batched","count").addCount(t.logicalRequestCount||0),e.get(Lt.transportRanges,"count").addCount(t.transportRequestCount||0),e.get(Lt.coalescedRanges,"count").addCount(Math.max((t.logicalRequestCount||0)-(t.transportRequestCount||0),0)),e.get(Lt.transportBytes,"count").addCount(t.transportBytes||0),e.get(Lt.overfetchBytes,"count").addCount(t.overfetchBytes||0);break;case"response":e.get(Lt.completedTransportRanges,"count").incrementCount(),e.get(Lt.responseBytes,"count").addCount(t.responseBytes||0),t.fullResponse&&e.get(Lt.fullResponseFallbacks,"count").incrementCount();break;case"error":e.get(Lt.failedTransportRanges,"count").incrementCount();break;case"abort":e.get(Lt.abortedLogicalRanges,"count").incrementCount();break;default:}}function Ew(e="range-request-scheduler"){let t=new Yr({id:e});return Iw(t),t}async function M4(e){let t=R4(e.signal),r=vc();try{let n=!1,i=await e.fetch(e.url,vw(e.fetchOptions,e.offset,e.length,t.signal));if(i.status===416&&e.offset===0){let c=I4(i.headers.get("Content-Range"));if(!c)throw new Error("Missing content-length on 416 response");i=await e.fetch(e.url,vw(e.fetchOptions,0,c,t.signal)),n=!0}if(i.status===200)throw t.abort(),await C4(i),new Error("Byte-range request failed: server returned 200 instead of 206");if(i.status!==206&&!i.ok)throw new Error(`Bad response code: ${i.status}`);let o=await i.arrayBuffer(),s=i.headers.get("Content-Range"),a=A4(s);if(s&&!a)throw new Error(`Invalid Content-Range header: ${s}`);if(a){let c=a.endOffset-a.offset+1,l=e.offset+e.length-1;if(a.offset!==e.offset||a.endOffset>l||c!==o.byteLength||a.sourceByteLength!==void 0&&a.endOffset>=a.sourceByteLength)throw new Error(`Content-Range does not match requested range: ${s}`)}return{arrayBuffer:o,status:i.status,sourceByteLength:a?.sourceByteLength,transportBytes:o.byteLength,networkTimeMs:vc()-r,fullResponse:n}}finally{t.removeAbortListener()}}function v4(e,t,r){if(e.sourceId!==t.sourceId||e.isolationKey!==(t.isolationKey??t.sourceId))return!1;let n=t.offset+t.length,i=t.offset-e.endOffset,o=Math.max(e.endOffset,n)-e.offset;return i<=r.rangeExpansionBytes&&o<=r.maxMergedBytes}function Iw(e){e.get(Lt.logicalRanges,"count"),e.get(Lt.requestedBytes,"count"),e.get(Lt.rangeBatches,"count"),e.get("Logical Ranges Batched","count"),e.get(Lt.transportRanges,"count"),e.get(Lt.coalescedRanges,"count"),e.get(Lt.transportBytes,"count"),e.get(Lt.completedTransportRanges,"count"),e.get(Lt.responseBytes,"count"),e.get(Lt.networkTimeMs,"time"),e.get(Lt.overfetchBytes,"count"),e.get(Lt.fullResponseFallbacks,"count"),e.get(Lt.failedTransportRanges,"count"),e.get(Lt.abortedLogicalRanges,"count")}function Om(e){return e.reduce((t,r)=>t+r.length,0)}function T4(e){return e instanceof ArrayBuffer?{arrayBuffer:e}:e}function vw(e,t,r,n){return{...e,signal:n,headers:{...E4(e?.headers),Range:`bytes=${t}-${t+r-1}`}}}function E4(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e:{}}function I4(e){let t=e?.match(/^bytes \*\/(\d+)$/);return t?Number(t[1]):null}function A4(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+|\*)$/);if(!t)return null;let r=Number(t[1]),n=Number(t[2]),i=t[3]==="*"?void 0:Number(t[3]);return!Number.isSafeInteger(r)||!Number.isSafeInteger(n)||r>n||i!==void 0&&!Number.isSafeInteger(i)?null:{offset:r,endOffset:n,sourceByteLength:i}}function R4(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.aborted?t.abort(e?.reason):e?.addEventListener("abort",r,{once:!0}),{signal:t.signal,abort:()=>t.abort(),removeAbortListener:()=>e?.removeEventListener("abort",r)}}async function C4(e){await e.body?.cancel().catch(()=>{})}function vc(){return globalThis.performance?.now()??Date.now()}function Tw(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var Lt,Pm,tu,Aw=S(()=>{"use strict";Sc();Lt={logicalRanges:"Logical Range Requests",rangeBatches:"Range Request Batches",transportRanges:"Transport Ranges Created",completedTransportRanges:"Range Transport Requests Completed",coalescedRanges:"Coalesced Logical Ranges",requestedBytes:"Logical Range Request Bytes",transportBytes:"Range Transport Bytes Requested",responseBytes:"Range Response Bytes",networkTimeMs:"Range Network Time",overfetchBytes:"Range Overfetch Bytes",failedTransportRanges:"Range Transport Requests Failed",abortedLogicalRanges:"Aborted Logical Range Requests",fullResponseFallbacks:"Full Response Fallbacks"},Pm={batchDelayMs:50,maxGapBytes:65536,rangeExpansionBytes:65536,maxMergedBytes:8388608,maxConcurrency:6,maxQueueSize:4096,maxRangeBytes:64*1024*1024,stats:Ew("range-request-scheduler-default"),onEvent:()=>{}},tu=class{props;stats;onEvent;pendingRequests=[];transportQueue=[];activeTransports=0;queuedRequests=0;logicalRequests=new Set;transportControllers=new Set;finalized=!1;flushTimer=null;constructor(t={}){let r=t.rangeExpansionBytes??t.maxGapBytes??Pm.rangeExpansionBytes;this.props={batchDelayMs:t.batchDelayMs??Pm.batchDelayMs,maxGapBytes:t.maxGapBytes??r,rangeExpansionBytes:r,maxMergedBytes:t.maxMergedBytes??Pm.maxMergedBytes,maxConcurrency:t.maxConcurrency??6,maxQueueSize:t.maxQueueSize??4096,maxRangeBytes:t.maxRangeBytes??64*1024*1024};for(let n of[this.props.maxConcurrency,this.props.maxQueueSize,this.props.maxRangeBytes])if(!Number.isSafeInteger(n)||n<=0)throw new Error("Range scheduler limits must be positive integers");this.stats=t.stats||Ew("range-request-scheduler"),this.onEvent=t.onEvent,Iw(this.stats)}scheduleRequest(t){if(this.finalized)return Promise.reject(new Error("Range scheduler is finalized"));if(!Number.isSafeInteger(t.offset)||t.offset<0||!Number.isSafeInteger(t.length)||t.length>this.props.maxRangeBytes||!Number.isSafeInteger(t.offset+t.length))return Promise.reject(new Error("Invalid or oversized byte range"));if(this.queuedRequests>=this.props.maxQueueSize)return Promise.reject(new Error("Range scheduler queue limit exceeded"));if(t.length<0)return Promise.reject(new Error("Byte range length cannot be negative"));if(t.signal?.aborted)return Promise.reject(t.signal.reason??Tw());if(t.length===0)return Promise.resolve(new ArrayBuffer(0));this.queuedRequests++;let r,n=new Promise((i,o)=>{r={...t,resolve:i,reject:o,settled:!1},this.logicalRequests.add(r),t.signal&&(r.abortListener=()=>{this.abortRequest(r),r.onAbort?.()},t.signal.addEventListener("abort",r.abortListener,{once:!0})),this.pendingRequests.push(r)});return this.trackEvent({type:"queued",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length}),this.scheduleFlush(),n.finally(()=>{r.abortListener&&t.signal?.removeEventListener("abort",r.abortListener),this.queuedRequests--,this.logicalRequests.delete(r)})}fetch(t){let r=t.fetch||globalThis.fetch;return this.scheduleRequest({sourceId:t.sourceId||t.url,offset:t.offset,length:t.length,signal:t.signal,isolationKey:t.isolationKey??{},fetchRange:(n,i,o)=>M4({url:t.url,offset:n,length:i,signal:o,fetch:r,fetchOptions:t.fetchOptions})})}flush(){this.flushTimer!==null&&(clearTimeout(this.flushTimer),this.flushTimer=null);let t=this.pendingRequests;this.pendingRequests=[];let r=t.filter(i=>i.settled||i.signal?.aborted?(this.abortRequest(i),!1):!0),n=this.mergeRequests(r);r.length>0&&this.trackBatch(r,n),this.transportQueue.push(...n),this.startQueuedTransports()}finalize(){this.finalized=!0,this.flushTimer!==null&&clearTimeout(this.flushTimer),this.flushTimer=null;for(let t of this.logicalRequests)this.abortRequest(t),t.abortListener&&t.signal?.removeEventListener("abort",t.abortListener);for(let t of this.transportControllers)t.abort();this.transportQueue=[],this.pendingRequests=[],this.logicalRequests.clear()}startQueuedTransports(){for(;this.activeTransports<this.props.maxConcurrency&&this.transportQueue.length;){let t=this.transportQueue.shift();this.activeTransports++,this.fetchMergedRequest(t).finally(()=>{this.activeTransports--,this.startQueuedTransports()})}}scheduleFlush(){this.flushTimer===null&&(this.flushTimer=setTimeout(()=>this.flush(),this.props.batchDelayMs))}mergeRequests(t){t.sort((n,i)=>n.sourceId!==i.sourceId?n.sourceId<i.sourceId?-1:1:n.offset-i.offset);let r=[];for(let n of t){let i=n.offset+n.length,o=r[r.length-1];o&&v4(o,n,this.props)?(o.endOffset=Math.max(o.endOffset,i),o.requests.push(n)):r.push({sourceId:n.sourceId,isolationKey:n.isolationKey??n.sourceId,offset:n.offset,endOffset:i,fetchRange:n.fetchRange,requests:[n]})}return r}async fetchMergedRequest(t){let{offset:r,endOffset:n,fetchRange:i,requests:o}=t,s=new AbortController;this.transportControllers.add(s);let a=vc(),c=()=>{o.every(l=>l.settled||l.signal?.aborted)&&s.abort()};try{for(let g of o)g.onAbort=c;if(c(),o.every(g=>g.settled))return;let l=Om(o),h=n-r;this.trackEvent({type:"request",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,overfetchBytes:Math.max(h-l,0)});let u=T4(await i(r,h,s.signal)),{arrayBuffer:f}=u,d=u.fullResponse&&r===0&&f.byteLength<h,m=f.byteLength<h&&Number.isSafeInteger(u.sourceByteLength)&&r+f.byteLength===u.sourceByteLength;if(f.byteLength!==h&&!d&&!m)throw new Error(`Byte-range transport returned ${f.byteLength} bytes; expected ${h}`);let p=u.networkTimeMs??vc()-a;this.trackEvent({type:"response",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,responseBytes:u.transportBytes??f.byteLength,networkTimeMs:p,overfetchBytes:Math.max(h-l,0),status:u.status,fullResponse:u.fullResponse});for(let g of o){if(g.settled)continue;let y=g.offset-r;g.settled=!0,g.resolve(f.slice(y,y+g.length))}}catch(l){s.signal.aborted||this.trackEvent({type:"error",sourceId:t.sourceId,offset:r,length:n-r,logicalRequestCount:o.length,logicalBytes:Om(o),networkTimeMs:vc()-a,error:l});for(let h of o)h.settled||(h.signal?.aborted?this.abortRequest(h):(h.settled=!0,h.reject(l)))}finally{this.transportControllers.delete(s);for(let l of o)l.abortListener&&l.signal?.removeEventListener("abort",l.abortListener),l.onAbort=void 0}}abortRequest(t){if(!t.settled){t.settled=!0,this.pendingRequests=this.pendingRequests.filter(r=>r!==t);for(let r of this.transportQueue)r.requests=r.requests.filter(n=>!n.settled),r.requests.length&&(r.offset=Math.min(...r.requests.map(n=>n.offset)),r.endOffset=Math.max(...r.requests.map(n=>n.offset+n.length)));this.transportQueue=this.transportQueue.filter(r=>r.requests.length>0),t.reject(t.signal?.reason??Tw()),this.trackEvent({type:"abort",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length})}}trackEvent(t){x4(this.stats,t);try{this.onEvent?.(t)}catch{}}trackBatch(t,r){let n=Om(t),i=r.reduce((o,s)=>o+s.endOffset-s.offset,0);this.trackEvent({type:"batch",logicalRequestCount:t.length,transportRequestCount:r.length,logicalBytes:n,transportBytes:i,overfetchBytes:Math.max(i-n,0)})}}});function Cw(e){for(let t in Rw)if(e.startsWith(t)){let r=Rw[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${P4}${e}`),e}var P4,Rw,Pw=S(()=>{"use strict";P4="",Rw={}});function Ow(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=globalThis.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}var Bw=S(()=>{"use strict"});var xr={};tr(xr,{dirname:()=>B4,filename:()=>O4,join:()=>N4,resolve:()=>L4});function O4(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function B4(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function N4(...e){return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp("^/"),"")),n!==e.length-1&&(r=r.replace(new RegExp("/$"),"")),r)),e.join("/")}function L4(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,i;for(let o=t.length-1;o>=-1&&!n;o--){let s;o>=0?s=t[o]:(i===void 0&&(i=Ow()),s=i),s.length!==0&&(r=`${s}/${r}`,n=s.charCodeAt(0)===Tc)}return r=F4(r,!n),n?`/${r}`:r.length>0?r:"."}function F4(e,t){let r="",n=-1,i=0,o,s=!1;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(o===Tc)break;o=Tc}if(o===Tc){if(!(n===a-1||i===1))if(n!==a-1&&i===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==Bm||r.charCodeAt(r.length-2)!==Bm){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Tc;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,i=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,i=0,s=!1;continue}}t&&(r.length>0?r+="/..":r="..",s=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,s=!1}n=a,i=0}else o===Bm&&i!==-1?++i:i=-1}return r}var Tc,Bm,Nw=S(()=>{"use strict";Bw();Tc=47,Bm=46});var ga,Lw=S(()=>{"use strict";ga=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r,n){if(n?.aborted)throw new Error("Request aborted");let i=await this.handle.slice(Number(t),Number(t)+Number(r)).arrayBuffer();if(n?.aborted)throw new Error("Request aborted");return i}}});function eu(e,t){return t?t.aborted?(e.catch(()=>{}),Promise.reject(t.reason)):new Promise((r,n)=>{let i=()=>{t.removeEventListener("abort",i),n(t.reason)};t.addEventListener("abort",i,{once:!0}),e.then(o=>{t.removeEventListener("abort",i),r(o)},o=>{t.removeEventListener("abort",i),n(o)})}):e}function ru(e,t){let r=new AbortController,n=[],i=()=>{for(let[o,s]of n)o.removeEventListener("abort",s)};for(let o of t){if(!o)continue;let s=()=>r.abort(o.reason);n.push([o,s]),o.addEventListener("abort",s,{once:!0}),o.aborted&&s()}try{return r.signal.throwIfAborted(),eu(e(r.signal),r.signal).catch(o=>{throw r.abort(o),o}).finally(i)}catch(o){return r.abort(o),i(),Promise.reject(o)}}var Nm=S(()=>{"use strict"});function D4(e,t,r,n){let i=new Headers(e?.headers);return i.set("Range",`bytes=${t}-${t+r-1}`),{...e,method:"GET",body:void 0,headers:i,signal:n}}function U4(e,t,r,n){return e.status===416&&n===null&&t===0&&r===1&&/^bytes \*\/0$/i.test(e.headers.get("Content-Range")||"")}async function z4(e){try{return V4(e.headers.get("Content-Range"))}catch(t){throw await iu(e),t}}function V4(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(!t)throw new Error("HTTP byte-range response has an invalid Content-Range header");return{offset:Number(t[1]),endOffset:Number(t[2]),byteLength:Number(t[3])}}function Fw(e,t){return su(t,au(e.headers.get("ETag")),au(e.headers.get("Last-Modified")))}function Dw(e,t,r){return e||su(t.byteLength,t.etag??r.etag,t.lastModified??r.lastModified)}function G4(e,t,r){return!Number.isSafeInteger(e.offset)||!Number.isSafeInteger(e.endOffset)||!Number.isSafeInteger(e.byteLength)||e.offset<0||e.endOffset<e.offset||e.endOffset>=e.byteLength?"HTTP byte-range response has invalid range bounds":e.offset!==t||e.endOffset!==t+r-1?"HTTP byte-range response does not match the requested range":null}function Uw(e,t,r,n){let i=e?.byteLength??r.byteLength;if(i!==void 0&&t.byteLength!==i)return"HTTP file length changed while the file was open";let o=e?.etag??r.etag,s=e?.lastModified??r.lastModified;return o?t.etag?o===t.etag?null:"HTTP file ETag changed while the file was open":n==="strict"?"HTTP byte-range response is missing the pinned ETag":s&&t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":null:s?t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":n==="strict"&&!t.lastModified?"HTTP byte-range response is missing the pinned Last-Modified value":null:n==="strict"&&!t.etag&&!t.lastModified?"HTTP byte-range response does not provide an ETag or Last-Modified validator":null}function su(e,t,r){return Object.freeze({byteLength:e,etag:t,lastModified:r})}function k4(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<0))throw new Error("HttpFile byteLength must be a non-negative safe integer")}async function iu(e){await e.body?.cancel().catch(()=>{})}function au(e){return e||void 0}function nu(){return globalThis.performance?.now()??Date.now()}function zw(e){return e instanceof Error&&e.name==="AbortError"||e instanceof Error&&/aborted/i.test(e.message)}function q4(...e){let t=new AbortController,r=[...new Set(e.filter(i=>!!i))],n=()=>t.abort();for(let i of r)i.aborted?t.abort():i.addEventListener("abort",n,{once:!0});return{signal:t.signal,removeAbortListeners:()=>{for(let i of r)i.removeEventListener("abort",n)}}}var ou,Vw=S(()=>{"use strict";ou=class{url;fetchFunction;fetchOptions;consistency;identityHints;countedFailures=new WeakSet;telemetry={requestedBytes:0,downloadedBytes:0,requestCount:0,networkTimeMs:0,abortCount:0,errorCount:0};constructor(t,r){k4(r.byteLength),this.url=t,this.fetchFunction=r.fetch||((n,i)=>globalThis.fetch(n,i)),this.fetchOptions=r.fetchOptions?{...r.fetchOptions,headers:new Headers(r.fetchOptions.headers)}:void 0,this.consistency=r.consistency||"best-effort",this.identityHints={byteLength:r.byteLength,etag:au(r.etag),lastModified:au(r.lastModified)}}getInitialIdentity(){let{byteLength:t,etag:r,lastModified:n}=this.identityHints;return t!==void 0&&(r!==void 0||n!==void 0)?su(t,r,n):t===0&&this.consistency==="best-effort"?su(0):null}getTelemetry(){return Object.freeze({...this.telemetry})}trackFailure(t){if(typeof t=="object"&&t!==null){if(this.countedFailures.has(t))return;this.countedFailures.add(t)}zw(t)?this.telemetry.abortCount++:this.telemetry.errorCount++}async requestRange(t,r,n,i){let o=nu(),s=q4(n,this.fetchOptions?.signal);this.telemetry.requestCount++,this.telemetry.requestedBytes+=r;try{let a=await this.fetchFunction(this.url,D4(this.fetchOptions,t,r,s.signal));if(U4(a,t,r,i))return await this.readEmptyIdentityProbe(a,o);if(a.status!==206)throw await iu(a),new Error(`HTTP byte-range request expected 206, received ${a.status}`);let c=await z4(a),l=Fw(a,c.byteLength),h=Uw(i,l,this.identityHints,this.consistency)||G4(c,t,r);if(h)throw await iu(a),new Error(h);let u=await a.arrayBuffer();if(this.telemetry.downloadedBytes+=u.byteLength,u.byteLength!==r)throw new Error(`HTTP byte-range response contained ${u.byteLength} bytes; expected ${r}`);return{arrayBuffer:u,identity:Dw(i,l,this.identityHints),status:a.status,transportBytes:u.byteLength,networkTimeMs:nu()-o}}catch(a){throw(i===null||!zw(a))&&this.trackFailure(a),a}finally{s.removeAbortListeners(),this.telemetry.networkTimeMs+=nu()-o}}async readEmptyIdentityProbe(t,r){let n=Fw(t,0),i=Uw(null,n,this.identityHints,this.consistency);if(await iu(t),i)throw new Error(i);return{arrayBuffer:new ArrayBuffer(0),identity:Dw(null,n,this.identityHints),status:t.status,transportBytes:0,networkTimeMs:nu()-r}}}});function j4(e,t,r){let n=new Headers;return r>0&&e&&n.set("Content-Range",`bytes ${t}-${t+r-1}/${e.byteLength}`),e?.etag&&n.set("ETag",e.etag),e?.lastModified&&n.set("Last-Modified",e.lastModified),n}function Gw(e){let t=Number(e);if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range offset must be a non-negative safe integer");return t}function W4(e,t,r){if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range length must be a non-negative safe integer");if(e+t>r)throw new Error("HTTP byte range extends beyond the end of the file")}function kw(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var Ec,qw=S(()=>{"use strict";Nm();Aw();Vw();Ec=class e{handle;url;transport;rangeScheduler;schedulerIsolationKey={};suppliedByteLength;identity;openPromise=null;closed=!1;constructor(t,r={}){this.handle=t,this.url=t,this.transport=new ou(t,r),this.rangeScheduler=r.rangeScheduler||new tu({batchDelayMs:0,...r.rangeSchedulerProps}),this.suppliedByteLength=r.byteLength,this.identity=this.transport.getInitialIdentity()}static async open(t,r={},n){let i=new e(t,r);return await i.open(n),i}async open(t){if(this.assertOpen(),t?.aborted){let r=kw();throw this.transport.trackFailure(r),r}return await this.getIdentity(t),this}get size(){return this.identity?.byteLength??this.suppliedByteLength??0}get bigsize(){return BigInt(this.size)}getIdentitySnapshot(){return this.identity}getTelemetry(){return this.transport.getTelemetry()}async close(){this.closed=!0}async stat(){this.assertOpen();let t=await this.getIdentity();return{size:t.byteLength,bigsize:BigInt(t.byteLength),isDirectory:!1}}async read(t=0,r=0,n){if(this.assertOpen(),n?.aborted){let s=kw();throw this.transport.trackFailure(s),s}let i=await this.getIdentity(n),o=Gw(t);if(W4(o,r,i.byteLength),r===0)return new ArrayBuffer(0);try{return await this.rangeScheduler.scheduleRequest({sourceId:this.url,isolationKey:this.schedulerIsolationKey,offset:o,length:r,signal:n,fetchRange:this.fetchScheduledRange})}catch(s){throw this.transport.trackFailure(s),s}}async fetchRange(t,r,n){let i=Gw(t),o=await this.read(i,r,n),s=j4(this.identity,i,r);return new Response(o,{status:206,headers:s})}fetchScheduledRange=async(t,r,n)=>{let i=await this.getIdentity(n),o=await this.transport.requestRange(t,r,n,i);return{arrayBuffer:o.arrayBuffer,status:o.status,transportBytes:o.transportBytes,networkTimeMs:o.networkTimeMs}};getIdentity(t){if(this.identity)return Promise.resolve(this.identity);if(!this.openPromise){let n=this.probeIdentity().catch(i=>{throw this.openPromise===n&&(this.openPromise=null),i});this.openPromise=n}return eu(this.openPromise,t).catch(r=>{throw this.transport.trackFailure(r),r})}async probeIdentity(){try{let t=await this.transport.requestRange(0,1,void 0,null);return this.identity=t.identity,t.identity}catch(t){throw this.transport.trackFailure(t),t}}assertOpen(){if(this.closed)throw new Error("HttpFile is closed")}}});function jw(e){return bw(e)}function Ww(e){if(e.loadOptions!==void 0||e.core?.loadOptions!==void 0)throw new Error("Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly.");let t={...e};if(e?.core){t.core={...e.core};let i=t.core;for(let o of["type","attributions","loaders","onError","loadOptions"])delete i[o];Object.keys(i).length===0&&delete t.core}let r=typeof t.baseUri=="string"?t.baseUri:void 0,n=typeof t.baseUrl=="string"?t.baseUrl:void 0;return(r!==void 0||n!==void 0)&&(t.core||={},t.core.baseUrl===void 0&&(t.core.baseUrl=n??r),delete t.baseUri,delete t.baseUrl),t}function $4(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}function Qo(e){return()=>{throw new Error(`CoreAPI.${e} is unavailable. Use @loaders.gl/core.createDataSource().`)}}var H4,Ic,Hw=S(()=>{"use strict";hw();Pw();sw();Mw();Am();H4={fetchFile:Qo("fetchFile"),parse:Qo("parse"),parseFile:Qo("parseFile"),parseSync:Qo("parseSync"),parseInBatches:Qo("parseInBatches"),load:Qo("load"),loadInBatches:Qo("loadInBatches")},Ic=class e{static defaultOptions={core:{type:"auto",attributions:[],loaders:[],onError:void 0}};optionsType;options;data;url;loadOptions;fetch;coreApi;hasCoreApi;_needsRefresh=!0;constructor(t,r,n,i){this.options=Zh(Zh(e.defaultOptions,n||{}),r),this.data=t,this.url=typeof t=="string"?Cw(t):"";let o=Im(Ww(this.options));this.loadOptions=o;let s=jw(o);this.coreApi=i||H4,this.hasCoreApi=!!i,this.fetch=s}setProps(t){let r=Zh(this.options,t),n=Im(Ww(r));this.options=r,this.loadOptions=n,this.fetch=jw(n),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}reportError(t,r){let n=$4(t,r),i=this.options.core?.onError;return i?i(n,this):ow.warn(`${this.constructor.name}: ${n.message}`)(),n}}});function cu(e={}){if(e.coordinateEpoch!==void 0&&!Number.isFinite(e.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:$w(e.crs||{state:"absent",provenance:"unknown"}),vertical:e.vertical?$w(e.vertical):void 0,coordinateEpoch:e.coordinateEpoch,coordinateFrame:e.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...e.coordinateOrder||[]]),units:e.units?Object.freeze([...e.units]):void 0})}function rr(e){if(typeof e=="object")return"projjson";let t=e.trim();return/^[A-Z][A-Z0-9_]*\s*[\[(]/i.test(t)?"wkt":/(?:^|\s)\+?proj=/i.test(t)?"proj-string":/^[A-Z][A-Z0-9._-]*(?::[A-Z0-9._-]+)+$/i.test(t)||/^urn:ogc:def:crs:/i.test(t)||/^https?:\/\//i.test(t)||/^[A-Z][A-Z0-9._-]*$/i.test(t)?"identifier":"opaque"}function $w(e){return e.state==="explicit"||e.state==="default"?Object.freeze({...e,definition:Yw(e.definition),alternatives:e.alternatives?Object.freeze(e.alternatives.map(t=>Object.freeze({...t,definition:Yw(t.definition)}))):void 0}):Object.freeze({...e})}function Yw(e){return typeof e=="string"?e:Lm(e)}function Lm(e){return Array.isArray(e)?Object.freeze(e.map(t=>Lm(t))):e&&typeof e=="object"?Object.freeze(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Lm(r)]))):e}var Ac=S(()=>{});function Cc(e,t){let n={type:"wkt-crs",root:new Fm(e).parse()};if(t?.strict){let i=Jw(n,{profile:t.profile,allowExtensions:!1});if(i.length>0)throw new hu(i)}return n}function Jw(e,t){if(!e||e.type!=="wkt-crs"||e.root?.type!=="node")throw new TypeError("validateWKTCRS expects a WKTCRSAst");let r=iA(e.root.keyword,t?.profile||"auto"),n=rA[r],i=nA[r],o=[],s=e.root.keyword.toUpperCase();return n.has(s)||o.push({code:"invalid-root",message:`${e.root.keyword} is not a ${r} root keyword`,path:[],keyword:e.root.keyword}),Qw(e.root,[],a=>{let c=a.node.keyword.toUpperCase();!t?.allowExtensions&&!i.has(c)&&o.push({code:"unknown-keyword",message:`${a.node.keyword} is not defined by the ${r} profile`,path:a.path,keyword:a.node.keyword}),a.node.values.length===0&&o.push({code:"empty-node",message:`${a.node.keyword} must contain at least one value`,path:a.path,keyword:a.node.keyword});let l=oA(a.node);l&&o.push({code:"invalid-value",message:l,path:a.path,keyword:a.node.keyword})}),o}function iA(e,t){return t!=="auto"?t:Rc.has(e.toUpperCase())?"wkt1":"wkt2:2019"}function oA(e){let t=e.keyword.toUpperCase(),r=e.values,n=(o,...s)=>!!(r[o]&&s.includes(r[o].type)),i=(o,...s)=>r.length===o&&s.every((a,c)=>n(c,a));if(["ANGLEUNIT","LENGTHUNIT","PARAMETRICUNIT","SCALEUNIT","TIMEUNIT","TEMPORALQUANTITY","UNIT"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric conversion factor`;if(t==="CS"&&!i(2,"enumeration","number"))return`${e.keyword} must contain a coordinate-system type and dimension`;if(t==="BBOX"&&!i(4,"number","number","number","number"))return`${e.keyword} must contain four numeric bounds`;if(["ENSEMBLEACCURACY","EPOCH","COORDEPOCH","FRAMEEPOCH","OPERATIONACCURACY","ORDER"].includes(t)&&!i(1,"number"))return`${e.keyword} must contain one number`;if(["ANCHOR","AREA","CALENDAR","CITATION","REMARK","SCOPE","URI","VERSION"].includes(t)&&!i(1,"string"))return`${e.keyword} must contain one quoted string`;if(["ELLIPSOID","SPHEROID","TRIAXIAL"].includes(t)&&!(r.length>=3&&n(0,"string")&&n(1,"number")&&n(2,"number")))return`${e.keyword} must start with a quoted name and numeric ellipsoid axes`;if(["PARAMETER"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric value`;if(t==="PARAMETERFILE"&&!i(2,"string","string"))return`${e.keyword} must contain a quoted name and file name`;if(["AUTHORITY","ID"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"string","number")))return`${e.keyword} must start with a quoted authority and identifier`;if(["AXIS"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"enumeration")))return`${e.keyword} must start with a quoted name and axis direction`;if(["METHOD","PROJECTION"].includes(t)&&!(r.length>=1&&n(0,"string")))return`${e.keyword} must start with a quoted name`;if(t==="TIMEEXTENT"){let o=s=>n(s,"enumeration","string");if(r.length!==2||!o(0)||!o(1))return`${e.keyword} must contain two date-time or quoted values`}if(t==="VERTICALEXTENT"&&(r.length<2||r.length>3||!n(0,"number")||!n(1,"number")||r.length===3&&!n(2,"node")))return`${e.keyword} must contain two numeric bounds and an optional unit`;if(t==="COORDINATEMETADATA"&&(r.length<1||r.length>2||!n(0,"node")||r.length===2&&(!n(1,"node")||!["EPOCH","COORDEPOCH"].includes(r[1].keyword.toUpperCase()))))return`${e.keyword} must contain a CRS and an optional coordinate epoch`;if(t==="BOUNDCRS"){let o=r.slice(0,3).map(s=>s.type==="node"?s.keyword.toUpperCase():"");if(o[0]!=="SOURCECRS"||o[1]!=="TARGETCRS"||o[2]!=="ABRIDGEDTRANSFORMATION")return`${e.keyword} must start with SOURCECRS, TARGETCRS, and ABRIDGEDTRANSFORMATION`}return["COMPOUNDCRS","CONCATENATEDOPERATION","COORDINATEOPERATION","DERIVEDPROJCRS","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","GEOGCRS","GEOGRAPHICCRS","PARAMETRICCRS","POINTMOTIONOPERATION","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"].includes(t)&&!n(0,"string")?`${e.keyword} must start with a quoted name`:null}function Qw(e,t,r){r({node:e,path:t});for(let n=0;n<e.values.length;n++){let i=e.values[n];i.type==="node"&&Qw(i,[...t,n],r)}}function sA(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
8
- `?(r++,n=1):n++;return{line:r,column:n}}var lu,hu,Y4,K4,Rc,Dm,X4,Z4,J4,Q4,Kw,Xw,Zw,tA,eA,rA,nA,Fm,Um=S(()=>{lu=class extends SyntaxError{constructor(t,r,n){let i=sA(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="WKTCRSSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}},hu=class extends Error{constructor(t){super(t[0]?.message||"WKT validation failed"),this.name="WKTCRSValidationError",this.issues=t}},Y4=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?$/,K4=/^[A-Za-z][A-Za-z0-9_]*/,Rc=new Set(["COMPD_CS","CONCAT_MT","FITTED_CS","GEOCCS","GEOGCS","INVERSE_MT","LOCAL_CS","PARAM_MT","PASSTHROUGH_MT","PROJCS","VERT_CS"]),Dm=new Set([...Rc,"AUTHORITY","AXIS","CONCAT_MT","DATUM","INVERSE_MT","LOCAL_DATUM","PARAMETER","PARAM_MT","PASSTHROUGH_MT","PRIMEM","PROJECTION","SPHEROID","TOWGS84","UNIT","VERT_DATUM"]),X4=new Set(Rc),Z4=new Set([...Dm,"EXTENSION"]),J4=new Set([...Rc,"COMPDCS","LOCALCS","VERTCS"]),Q4=new Set([...Dm,"COMPDCS","LOCALCS","VDATUM","VERTCS"]),Kw=new Set(["BOUNDCRS","COMPOUNDCRS","COORDINATEOPERATION","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","PARAMETRICCRS","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"]),Xw=new Set([...Kw,"CONCATENATEDOPERATION","COORDINATEMETADATA","DERIVEDPROJCRS","GEOGCRS","GEOGRAPHICCRS","POINTMOTIONOPERATION"]),Zw=new Set([...Xw,"ABRIDGEDTRANSFORMATION","ANCHOR","ANGLEUNIT","AREA","AXIS","BASEENGCRS","BASEGEODCRS","BASEGEOGCRS","BASEPARAMCRS","BASEPROJCRS","BASETIMECRS","BASEVERTCRS","BBOX","BEARING","CALENDAR","CITATION","CONVERSION","COORDEPOCH","CS","DATUM","DERIVINGCONVERSION","DYNAMIC","EDATUM","ELLIPSOID","ENGINEERINGDATUM","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEODETICDATUM","GEOIDMODEL","ID","INTERPOLATIONCRS","LENGTHUNIT","MEMBER","MERIDIAN","METHOD","MODEL","OPERATIONACCURACY","ORDER","PARAMETER","PARAMETERFILE","PARAMETRICDATUM","PARAMETRICUNIT","PDATUM","PRIMEM","PRIMEMERIDIAN","REMARK","SCALEUNIT","SCOPE","SOURCECRS","STEP","TARGETCRS","TDATUM","TEMPORALQUANTITY","TIMEEXTENT","TIMEORIGIN","TIMEUNIT","TIMEDATUM","TRIAXIAL","TRF","URI","USAGE","VDATUM","VERSION","VERTICALDATUM","VERTICALEXTENT","VELOCITYGRID","VRF"]),tA=new Set(["BASEGEOGCRS","CALENDAR","CONCATENATEDOPERATION","COORDEPOCH","COORDINATEMETADATA","DERIVEDPROJCRS","DYNAMIC","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEOGCRS","GEOGRAPHICCRS","GEOIDMODEL","MEMBER","MODEL","POINTMOTIONOPERATION","STEP","TEMPORALQUANTITY","TRF","TRIAXIAL","VELOCITYGRID","VRF"]),eA=new Set([...Zw].filter(e=>!tA.has(e))),rA={wkt1:Rc,gdal:X4,esri:J4,"wkt2:2015":Kw,"wkt2:2019":Xw},nA={wkt1:Dm,gdal:Z4,esri:Q4,"wkt2:2015":eA,"wkt2:2019":Zw};Fm=class{constructor(t){this.offset=0,this.source=t}parse(){this.skipWhitespace();let t=this.parseNode();return this.skipWhitespace(),this.offset!==this.source.length&&this.fail("Unexpected content after WKT root"),t}parseNode(){let t=this.parseKeyword();return this.parseNodeAfterKeyword(t)}parseNodeAfterKeyword(t){this.skipWhitespace();let r=this.source[this.offset];r!=="["&&r!=="("&&this.fail(`Expected '[' or '(' after ${t}`),this.offset++;let n=r==="["?"bracket":"parenthesis",i=r==="["?"]":")",o=[];if(this.skipWhitespace(),this.source[this.offset]===i)return this.offset++,{type:"node",keyword:t,delimiter:n,values:o};for(;this.offset<this.source.length;){o.push(this.parseValue()),this.skipWhitespace();let s=this.source[this.offset];if(s===","){this.offset++,this.skipWhitespace(),this.source[this.offset]===i&&this.fail("Expected a WKT value after comma");continue}if(s===i)return this.offset++,{type:"node",keyword:t,delimiter:n,values:o};(s==="]"||s===")")&&this.fail(`Expected '${i}' to close ${t}`),this.fail(`Expected ',' or '${i}' in ${t}`)}this.fail(`Unterminated ${t} node`)}parseValue(){if(this.skipWhitespace(),this.source[this.offset]==='"')return this.parseString();let r=this.offset;for(;this.offset<this.source.length&&!/[\s,\[\]()"]/.test(this.source[this.offset]);)this.offset++;r===this.offset&&this.fail("Expected a WKT value");let n=this.source.slice(r,this.offset);return this.source[this.offset]==='"'&&this.fail("Unexpected quote in unquoted WKT value"),this.skipWhitespace(),this.source[this.offset]==="["||this.source[this.offset]==="("?(/^[A-Za-z][A-Za-z0-9_]*$/.test(n)||this.fail(`Invalid WKT keyword '${n}'`),this.parseNodeAfterKeyword(n)):Y4.test(n)?{type:"number",value:Number(n),raw:n}:{type:"enumeration",value:n}}parseKeyword(){let t=this.source.slice(this.offset).match(K4);return t||this.fail("Expected a WKT keyword"),this.offset+=t[0].length,t[0]}parseString(){this.offset++;let t="";for(;this.offset<this.source.length;){let r=this.source[this.offset++];if(r==='"'){if(this.source[this.offset]==='"'){t+='"',this.offset++;continue}return{type:"string",value:t}}t+=r}this.fail("Unterminated WKT string")}skipWhitespace(){for(;this.offset<this.source.length&&/\s/.test(this.source[this.offset]);)this.offset++}fail(t){throw new lu(t,this.source,this.offset)}}});function Pc(e){let t=lA(e);if(t.length===0)throw new ai("PROJ string is empty",e,0);return{type:"proj-string",parameters:t.map(n=>cA(n.raw,n.offset,e))}}function cA(e,t,r){let n=e.startsWith("+")?e.slice(1):e;if(!n)throw new ai("Expected a parameter after '+'",r,t);let i=n.indexOf("="),o=i<0?n:n.slice(0,i);if(!o||/[\s+=]/.test(o))throw new ai(`Invalid PROJ parameter name '${o}'`,r,t);if(i<0)return{type:"parameter",name:o};let s=n.slice(i+1),a=hA(s,r,t+i+1);return{type:"parameter",name:o,value:a,rawValue:s}}function lA(e){let t=[],r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;let n=r,i=null,o=!1;for(;r<e.length;){let s=e[r];if(o){o=!1,r++;continue}if(s==="\\"&&i){o=!0,r++;continue}if(i){s===i&&(i=null),r++;continue}if((s==='"'||s==="'")&&e[r-1]==="="){i=s,r++;continue}if(/\s/.test(s))break;r++}if(i)throw new ai("Unterminated quoted PROJ value",e,n);t.push({raw:e.slice(n,r),offset:n})}return t}function hA(e,t,r){if(!e)return"";let n=e[0];if(n!=='"'&&n!=="'"){if((e.includes('"')||e.includes("'"))&&!aA.test(e))throw new ai("Quote must begin a PROJ parameter value",t,r);return e}if(e[e.length-1]!==n)throw new ai("Unterminated quoted PROJ value",t,r);let i="";for(let o=1;o<e.length-1;o++){let s=e[o];s==="\\"&&o+1<e.length-1?i+=e[++o]:i+=s}return i}function uA(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
9
- `?(r++,n=1):n++;return{line:r,column:n}}var ai,aA,zm=S(()=>{ai=class extends SyntaxError{constructor(t,r,n){let i=uA(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="PROJStringSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}};aA=/^[+-]?\d+(?:\.\d*)?d(?:\d+(?:\.\d*)?'(?:\d+(?:\.\d*)?")?)?[NSEW]?$/i});var Vm=S(()=>{Ac();Um();zm()});var fn=S(()=>{"use strict";z_();uw();fw();pw();Nw();Lw();qw();Hw();Nm()});function Kb(e){return ArrayBuffer.isView(e)?rR.call(e):void 0}var rR,Xb=S(()=>{rR=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get});function cp(e){return Kb(e)==="Uint16Array"}var Zb=S(()=>{Xb()});function lp(){return Hc??Uint16Array}var Hc,Jb=S(()=>{Hc=globalThis.Float16Array});var hp=S(()=>{Zb();Jb()});function R8(e,t="float32"){return e instanceof Date?"date-millisecond":typeof e=="number"?t:typeof e=="boolean"?"bool":typeof e=="string"?"utf8":"null"}function EM(e){let t=C8(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=R8(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function C8(e){if(typeof Float16Array<"u"&&e instanceof Float16Array)return"float16";switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case BigInt64Array:return"int64";case BigUint64Array:return"uint64";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var IM=S(()=>{"use strict"});function RM(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function V(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{l(n.next(h))}catch(u){s(u)}}function c(h){try{l(n.throw(h))}catch(u){s(u)}}function l(h){h.done?o(h.value):i(h.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function AM(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function st(e){return this instanceof st?(this.v=e,this):new st(e)}function qe(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(d){return function(m){return Promise.resolve(m).then(d,u)}}function a(d,m){n[d]&&(i[d]=function(p){return new Promise(function(g,y){o.push([d,p,g,y])>1||c(d,p)})},m&&(i[d]=m(i[d])))}function c(d,m){try{l(n[d](m))}catch(p){f(o[0][3],p)}}function l(d){d.value instanceof st?Promise.resolve(d.value.v).then(h,u):f(o[0][2],d)}function h(d){c("next",d)}function u(d){c("throw",d)}function f(d,m){d(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function La(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:st(e[i](s)),done:!1}:o?o(s):s}:o}}function Ar(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof AM=="function"?AM(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var ur=S(()=>{});var CM,Fa,P8,Rr,di=S(()=>{CM=new TextDecoder("utf-8"),Fa=CM.decode.bind(CM),P8=new TextEncoder,Rr=e=>P8.encode(e)});var O8,PM,de,je,Cr,wn,Jr,sf,af,cf,lf,hf,OM,Tl,BM,uf,NM,Zi=S(()=>{O8=e=>typeof e=="number",PM=e=>typeof e=="boolean",de=e=>typeof e=="function",je=e=>e!=null&&Object(e)===e,Cr=e=>je(e)&&de(e.then),wn=e=>je(e)&&de(e[Symbol.iterator]),Jr=e=>je(e)&&de(e[Symbol.asyncIterator]),sf=e=>je(e)&&je(e.schema),af=e=>je(e)&&"done"in e&&"value"in e,cf=e=>je(e)&&de(e.stat)&&O8(e.fd),lf=e=>je(e)&&Tl(e.body),hf=e=>"_getDOMStream"in e&&"_getNodeStream"in e,OM=e=>je(e)&&de(e.abort)&&de(e.getWriter)&&!hf(e),Tl=e=>je(e)&&de(e.cancel)&&de(e.getReader)&&!hf(e),BM=e=>je(e)&&de(e.end)&&de(e.write)&&PM(e.writable)&&!hf(e),uf=e=>je(e)&&de(e.read)&&de(e.pipe)&&PM(e.readable)&&!hf(e),NM=e=>je(e)&&de(e.clear)&&de(e.bytes)&&de(e.position)&&de(e.setPosition)&&de(e.capacity)&&de(e.getBufferIdentifier)&&de(e.createLong)});var U0={};tr(U0,{compareArrayLike:()=>D0,joinUint8Arrays:()=>Pr,memcpy:()=>El,rebaseValueOffsets:()=>ff,toArrayBufferView:()=>ft,toArrayBufferViewAsyncIterator:()=>bn,toArrayBufferViewIterator:()=>qn,toBigInt64Array:()=>Il,toBigUint64Array:()=>U8,toFloat32Array:()=>z8,toFloat32ArrayAsyncIterator:()=>eP,toFloat32ArrayIterator:()=>$8,toFloat64Array:()=>V8,toFloat64ArrayAsyncIterator:()=>rP,toFloat64ArrayIterator:()=>Y8,toInt16Array:()=>L8,toInt16ArrayAsyncIterator:()=>Z8,toInt16ArrayIterator:()=>q8,toInt32Array:()=>ys,toInt32ArrayAsyncIterator:()=>J8,toInt32ArrayIterator:()=>j8,toInt8Array:()=>N8,toInt8ArrayAsyncIterator:()=>X8,toInt8ArrayIterator:()=>k8,toUint16Array:()=>F8,toUint16ArrayAsyncIterator:()=>Q8,toUint16ArrayIterator:()=>W8,toUint32Array:()=>D8,toUint32ArrayAsyncIterator:()=>tP,toUint32ArrayIterator:()=>H8,toUint8Array:()=>W,toUint8ArrayAsyncIterator:()=>F0,toUint8ArrayIterator:()=>L0,toUint8ClampedArray:()=>G8,toUint8ClampedArrayAsyncIterator:()=>nP,toUint8ClampedArrayIterator:()=>K8});function B8(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,h=e.length;++c<h;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function El(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function Pr(e,t){let r=B8(e),n=r.reduce((h,u)=>h+u.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let h=r.length;++c<h;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?El(s,o,a):s=o;break}El(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function ft(e,t){let r=af(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Rr(r)),r instanceof ArrayBuffer?new e(r):r instanceof N0?new e(r):NM(r)?ft(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}function*qn(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof N0?r(t):wn(t)?t:r(t);return yield*B0((function*(i){let o=null;do o=i.next(yield ft(e,o));while(!o.done)})(n[Symbol.iterator]())),new e}function bn(e,t){return qe(this,arguments,function*(){if(Cr(t))return yield st(yield st(yield*La(Ar(bn(e,yield st(t))))));let n=function(s){return qe(this,arguments,function*(){yield yield st(yield st(s))})},i=function(s){return qe(this,arguments,function*(){yield st(yield*La(Ar(B0((function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)})(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof N0?n(t):wn(t)?i(t):Jr(t)?t:n(t);return yield st(yield*La(Ar(B0((function(s){return qe(this,arguments,function*(){let a=null;do a=yield st(s.next(yield yield st(ft(e,a))));while(!a.done)})})(o[Symbol.asyncIterator]()))))),yield st(new e)})}function ff(e,t,r){if(e!==0){r=r.slice(0,t);let n=typeof r[0]=="bigint"?BigInt(e):e;for(let i=-1,o=r.length;++i<o;)r[i]+=n}return r.subarray(0,t)}function D0(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var N0,N8,L8,ys,Il,W,F8,D8,U8,z8,V8,G8,B0,k8,q8,j8,L0,W8,H8,$8,Y8,K8,X8,Z8,J8,F0,Q8,tP,eP,rP,nP,me=S(()=>{ur();di();Zi();N0=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;N8=e=>ft(Int8Array,e),L8=e=>ft(Int16Array,e),ys=e=>ft(Int32Array,e),Il=e=>ft(BigInt64Array,e),W=e=>ft(Uint8Array,e),F8=e=>ft(Uint16Array,e),D8=e=>ft(Uint32Array,e),U8=e=>ft(BigUint64Array,e),z8=e=>ft(Float32Array,e),V8=e=>ft(Float64Array,e),G8=e=>ft(Uint8ClampedArray,e),B0=e=>(e.next(),e);k8=e=>qn(Int8Array,e),q8=e=>qn(Int16Array,e),j8=e=>qn(Int32Array,e),L0=e=>qn(Uint8Array,e),W8=e=>qn(Uint16Array,e),H8=e=>qn(Uint32Array,e),$8=e=>qn(Float32Array,e),Y8=e=>qn(Float64Array,e),K8=e=>qn(Uint8ClampedArray,e);X8=e=>bn(Int8Array,e),Z8=e=>bn(Int16Array,e),J8=e=>bn(Int32Array,e),F0=e=>bn(Uint8Array,e),Q8=e=>bn(Uint16Array,e),tP=e=>bn(Uint32Array,e),eP=e=>bn(Float32Array,e),rP=e=>bn(Float64Array,e),nP=e=>bn(Uint8ClampedArray,e)});function*iP(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?Pr(n,s)[0]:([i,n,a]=Pr(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=L0(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(h){r=!0,typeof l.throw=="function"&&l.throw(h)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function oP(e){return qe(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Pr(i,a)[0]:([o,i,c]=Pr(i,a),o)}({cmd:s,size:a}=(yield yield st(null))||{cmd:"read",size:0});let h=F0(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield st(h.next()):yield st(h.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield st(l()));while(a<c);while(!r)}catch(u){n=!0,typeof h.throw=="function"&&(yield st(h.throw(u)))}finally{n===!1&&typeof h.return=="function"&&(yield st(h.return(new Uint8Array(0))))}return yield st(null)})}function sP(e){return qe(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Pr(i,a)[0]:([o,i,c]=Pr(i,a),o)}({cmd:s,size:a}=(yield yield st(null))||{cmd:"read",size:0});let h=new V0(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield st(h.read()):yield st(h.read(a-c)),!r&&o.byteLength>0&&(i.push(W(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield st(l()));while(a<c);while(!r)}catch(u){n=!0,yield st(h.cancel(u))}finally{n===!1?yield st(h.cancel()):e.locked&&h.releaseLock()}return yield st(null)})}function aP(e){return qe(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],h;function u(){return s==="peek"?Pr(l,a)[0]:([h,l,c]=Pr(l,a),h)}if({cmd:s,size:a}=(yield yield st(null))||{cmd:"read",size:0},e.isTTY)return yield yield st(new Uint8Array(0)),yield st(null);try{r[0]=z0(e,"end"),r[1]=z0(e,"error");do{if(r[2]=z0(e,"readable"),[n,o]=yield st(Promise.race(r.map(d=>d[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(h=W(e.read(a-c)),h.byteLength<a-c&&(h=W(e.read()))):h=W(e.read()),h.byteLength>0&&(l.push(h),c+=h.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield st(u()));while(a<c)}while(!i)}finally{yield st(f(r,n==="error"?o:null))}return yield st(null);function f(d,m){return h=l=null,new Promise((p,g)=>{for(let[y,w]of d)e.off(y,w);try{let y=e.destroy;y&&y.call(e,m),m=void 0}catch(y){m=y||m}finally{m!=null?g(m):p()}})}})}var be,df,V0,z0,Al=S(()=>{ur();me();be={fromIterable(e){return df(iP(e))},fromAsyncIterable(e){return df(oP(e))},fromDOMStream(e){return df(sP(e))},fromNodeStream(e){return df(aP(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},df=e=>(e.next(),e);V0=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return V(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return V(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=W(r)),r})}},z0=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]}});var Tt,mf=S(()=>{(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Tt||(Tt={}))});var xt,G0=S(()=>{(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(xt||(xt={}))});var wt,k0=S(()=>{(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(wt||(wt={}))});var It,q0=S(()=>{(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(It||(It={}))});var L,Rl=S(()=>{(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(L||(L={}))});var gt,j0=S(()=>{(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(gt||(gt={}))});var pf=S(()=>{});var jn,gf,yf,Da,W0=S(()=>{jn=new Int32Array(2),gf=new Float32Array(jn.buffer),yf=new Float64Array(jn.buffer),Da=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var Cl,H0=S(()=>{(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Cl||(Cl={}))});var Se,$0=S(()=>{pf();H0();W0();Se=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(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 jn[0]=this.readInt32(t),gf[0]}readFloat64(t){return jn[Da?0:1]=this.readInt32(t),jn[Da?1:0]=this.readInt32(t+4),yf[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){gf[0]=r,this.writeInt32(t,jn[0])}writeFloat64(t,r){yf[0]=r,this.writeInt32(t,jn[Da?0:1]),this.writeInt32(t+4,jn[Da?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===Cl.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}}});var _s,LM=S(()=>{$0();pf();_s=class e{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 r;t?r=t:r=1024,this.bb=Se.allocate(r),this.space=r}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,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)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,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),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){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=Se.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=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);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}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);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,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){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}}});var _t=S(()=>{pf();W0();LM();$0();H0()});var ws,Y0=S(()=>{(function(e){e[e.BUFFER=0]="BUFFER"})(ws||(ws={}))});var xe,Ua=S(()=>{(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(xe||(xe={}))});var mi,K0=S(()=>{_t();Y0();Ua();mi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):xe.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ws.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,xe.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,ws.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}}});var za,X0=S(()=>{za=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var Va,Z0=S(()=>{Va=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var Ce,J0=S(()=>{_t();K0();X0();Z0();Ce=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Va).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new za).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new mi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}variadicBufferCounts(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}variadicBufferCountsLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startRecordBatch(t){t.startObject(5)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static addVariadicBufferCounts(t,r){t.addFieldOffset(4,r,0)}static createVariadicBufferCountsVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startVariadicBufferCountsVector(t,r){t.startVector(8,r,8)}static endRecordBatch(t){return t.endObject()}}});var pi,FM=S(()=>{_t();J0();pi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Ce).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}}});var Ji,Q0=S(()=>{(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Ji||(Ji={}))});var Pl,DM=S(()=>{(function(e){e[e.DenseArray=0]="DenseArray"})(Pl||(Pl={}))});var xn,wf=S(()=>{_t();xn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}}});var Wn,tg=S(()=>{_t();DM();wf();Wn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new xn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Pl.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,Pl.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}});var Yt,Ga=S(()=>{_t();Yt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}}});var Ol,UM=S(()=>{_t();Ol=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}}});var Bl,zM=S(()=>{_t();Bl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinaryView(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(t){t.startObject(0)}static endBinaryView(t){return t.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}}});var Nl,VM=S(()=>{_t();Nl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}}});var Qi,eg=S(()=>{_t();q0();Qi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):It.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,It.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}}});var Hn,rg=S(()=>{_t();Hn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}}});var to,ng=S(()=>{_t();Rl();to=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):L.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,L.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}}});var eo,ig=S(()=>{_t();eo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}}});var ro,og=S(()=>{_t();ro=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}}});var no,sg=S(()=>{_t();k0();no=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):wt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,wt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}}});var io,ag=S(()=>{_t();j0();io=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):gt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,gt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}}});var Ll,GM=S(()=>{_t();Ll=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}}});var Fl,kM=S(()=>{_t();Fl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(t){t.startObject(0)}static endLargeList(t){return t.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}}});var Dl,qM=S(()=>{_t();Dl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}}});var Ul,jM=S(()=>{_t();Ul=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}}});var oo,cg=S(()=>{_t();oo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}}});var zl,WM=S(()=>{_t();zl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}}});var Vl,HM=S(()=>{_t();Vl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}}});var gi,lg=S(()=>{_t();Rl();gi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):L.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,L.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}}});var yi,hg=S(()=>{_t();Rl();yi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):L.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,L.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}}});var Mn,ug=S(()=>{_t();G0();Mn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):xt.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,xt.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}}});var Gl,$M=S(()=>{_t();Gl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}}});var kl,YM=S(()=>{_t();kl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8View(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(t){t.startObject(0)}static endUtf8View(t){return t.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}}});var Z,bf=S(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.ListView=25]="ListView",e[e.LargeListView=26]="LargeListView"})(Z||(Z={}))});var Pe,fg=S(()=>{_t();tg();Ga();bf();Pe=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Z.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Wn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new Yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,Z.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}}});var fr,dg=S(()=>{_t();Q0();fg();Ga();fr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ji.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Pe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,Ji.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}}});var mt,Sf=S(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(mt||(mt={}))});var b,kt,Kt=S(()=>{mf();G0();k0();q0();Rl();j0();Sf();(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond",e[e.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(b||(b={}));(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(kt||(kt={}))});var mg={};tr(mg,{valueToString:()=>vn});function vn(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>vn(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var ql=S(()=>{});function dt(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function pg(e,t){return dt(e/t)+dt(e%t)/dt(t)}var $n=S(()=>{});var _g={};tr(_g,{BN:()=>bs,bigNumToBigInt:()=>XM,bigNumToNumber:()=>yg,bigNumToString:()=>ja,isArrowBigNumSymbol:()=>KM});function Tn(e,...t){return t.length===0?Object.setPrototypeOf(ft(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}function ka(...e){return Tn.apply(this,e)}function qa(...e){return Tn.apply(this,e)}function jl(...e){return Tn.apply(this,e)}function yg(e,t){let{buffer:r,byteOffset:n,byteLength:i,signed:o}=e,s=new BigUint64Array(r,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let h of s)c|=(h^lP)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let h of s)c|=h*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"&&t>0){let h=BigInt("1".padEnd(t+1,"0")),u=c/h,f=a?-(c%h):c%h,d=dt(u),m=`${f}`.padStart(t,"0");return+`${a&&d===0?"-":""}${d}.${m}`}return dt(c)}function ja(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return gg(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return gg(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${gg(t)}`}function XM(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:ja(e)}function gg(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var KM,cP,lP,bs,xf=S(()=>{me();$n();KM=Symbol.for("isArrowBigNum");Tn.prototype[KM]=!0;Tn.prototype.toJSON=function(){return`"${ja(this)}"`};Tn.prototype.valueOf=function(e){return yg(this,e)};Tn.prototype.toString=function(){return ja(this)};Tn.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return yg(this);case"string":return ja(this);case"default":return XM(this)}return ja(this)};Object.setPrototypeOf(ka.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(qa.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(jl.prototype,Object.create(Uint32Array.prototype));Object.assign(ka.prototype,Tn.prototype,{constructor:ka,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(qa.prototype,Tn.prototype,{constructor:qa,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(jl.prototype,Tn.prototype,{constructor:jl,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});cP=BigInt(4294967296)*BigInt(4294967296),lP=cP-BigInt(1);bs=class e{static new(t,r){switch(r){case!0:return new ka(t);case!1:return new qa(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new ka(t)}return t.byteLength===16?new jl(t):new qa(t)}static signed(t){return new ka(t)}static unsigned(t){return new qa(t)}static decimal(t){return new jl(t)}constructor(t,r){return e.new(t,r)}}});function zr(e){let t=e;switch(e.typeId){case b.Decimal:return e.bitWidth/32;case b.Interval:return t.unit===gt.MONTH_DAY_NANO?4:1+t.unit;case b.BinaryView:case b.Utf8View:return 16;case b.FixedSizeList:return t.listSize;case b.FixedSizeBinary:return t.byteWidth;default:return 1}}var ZM,JM,QM,tv,ev,rv,nv,iv,ov,sv,av,cv,lv,hv,uv,fv,dv,mv,pv,gv,yv,_v,wv,bv,Sv,xv,B,Qt,qt,Or,Br,re,Nr,Lr,Fr,We,En,Oe,In,He,Dr,dr,lt,An,Be,$e,Rn,Ne,mr,Ye,so,ao,Me,co,lo,ho,uo,ve,fo,Yn,mo,po,Le,go,yo,Wl,Ke,Hl,$l,Yl,Kl,oe,Ur,vt,Xe,_i,_o,pr,zt,Fe,hP,se,At=S(()=>{$n();Kt();xv=Symbol.for("apache-arrow/DataType"),B=class e{static isDataType(t){return t?.[xv]===!0}static isNull(t){return t?.typeId===b.Null}static isInt(t){return t?.typeId===b.Int}static isFloat(t){return t?.typeId===b.Float}static isBinary(t){return t?.typeId===b.Binary}static isBinaryView(t){return t?.typeId===b.BinaryView}static isLargeBinary(t){return t?.typeId===b.LargeBinary}static isUtf8(t){return t?.typeId===b.Utf8}static isUtf8View(t){return t?.typeId===b.Utf8View}static isLargeUtf8(t){return t?.typeId===b.LargeUtf8}static isBool(t){return t?.typeId===b.Bool}static isDecimal(t){return t?.typeId===b.Decimal}static isDate(t){return t?.typeId===b.Date}static isTime(t){return t?.typeId===b.Time}static isTimestamp(t){return t?.typeId===b.Timestamp}static isInterval(t){return t?.typeId===b.Interval}static isDuration(t){return t?.typeId===b.Duration}static isList(t){return t?.typeId===b.List}static isLargeList(t){return t?.typeId===b.LargeList}static isStruct(t){return t?.typeId===b.Struct}static isUnion(t){return t?.typeId===b.Union}static isFixedSizeBinary(t){return t?.typeId===b.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===b.FixedSizeList}static isMap(t){return t?.typeId===b.Map}static isDictionary(t){return t?.typeId===b.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===xt.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===xt.Sparse}constructor(t){this.typeId=t}};ZM=Symbol.toStringTag;B[ZM]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[xv]=!0,e[Symbol.toStringTag]="DataType"))(B.prototype);Qt=class extends B{constructor(){super(b.Null)}toString(){return"Null"}};JM=Symbol.toStringTag;Qt[JM]=(e=>e[Symbol.toStringTag]="Null")(Qt.prototype);qt=class extends B{constructor(t,r){super(b.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};QM=Symbol.toStringTag;qt[QM]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(qt.prototype);Or=class extends qt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Br=class extends qt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},re=class extends qt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Nr=class extends qt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Lr=class extends qt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Fr=class extends qt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},We=class extends qt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},En=class extends qt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Or.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Br.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(re.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Nr.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Lr.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Fr.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(We.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(En.prototype,"ArrayType",{value:BigUint64Array});Oe=class extends B{constructor(t){super(b.Float),this.precision=t}get ArrayType(){switch(this.precision){case wt.HALF:return Uint16Array;case wt.SINGLE:return Float32Array;case wt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};tv=Symbol.toStringTag;Oe[tv]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Oe.prototype);In=class extends Oe{constructor(){super(wt.HALF)}},He=class extends Oe{constructor(){super(wt.SINGLE)}},Dr=class extends Oe{constructor(){super(wt.DOUBLE)}};Object.defineProperty(In.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(He.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Dr.prototype,"ArrayType",{value:Float64Array});dr=class extends B{constructor(){super(b.Binary)}toString(){return"Binary"}};ev=Symbol.toStringTag;dr[ev]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(dr.prototype);lt=class extends B{constructor(){super(b.BinaryView)}toString(){return"BinaryView"}};rv=Symbol.toStringTag;lt.ELEMENT_WIDTH=16;lt.INLINE_CAPACITY=12;lt.LENGTH_OFFSET=0;lt.INLINE_OFFSET=4;lt.BUFFER_INDEX_OFFSET=8;lt.BUFFER_OFFSET_OFFSET=12;lt[rv]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="BinaryView"))(lt.prototype);An=class extends B{constructor(){super(b.LargeBinary)}toString(){return"LargeBinary"}};nv=Symbol.toStringTag;An[nv]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(An.prototype);Be=class extends B{constructor(){super(b.Utf8)}toString(){return"Utf8"}};iv=Symbol.toStringTag;Be[iv]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Be.prototype);$e=class extends B{constructor(){super(b.Utf8View)}toString(){return"Utf8View"}};ov=Symbol.toStringTag;$e.ELEMENT_WIDTH=lt.ELEMENT_WIDTH;$e.INLINE_CAPACITY=lt.INLINE_CAPACITY;$e[ov]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8View"))($e.prototype);Rn=class extends B{constructor(){super(b.LargeUtf8)}toString(){return"LargeUtf8"}};sv=Symbol.toStringTag;Rn[sv]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(Rn.prototype);Ne=class extends B{constructor(){super(b.Bool)}toString(){return"Bool"}};av=Symbol.toStringTag;Ne[av]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Ne.prototype);mr=class extends B{constructor(t,r,n=128){super(b.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};cv=Symbol.toStringTag;mr[cv]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(mr.prototype);Ye=class extends B{constructor(t){super(b.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${It[this.unit]}>`}get ArrayType(){return this.unit===It.DAY?Int32Array:BigInt64Array}};lv=Symbol.toStringTag;Ye[lv]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(Ye.prototype);so=class extends Ye{constructor(){super(It.DAY)}},ao=class extends Ye{constructor(){super(It.MILLISECOND)}},Me=class extends B{constructor(t,r){super(b.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${L[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};hv=Symbol.toStringTag;Me[hv]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Me.prototype);co=class extends Me{constructor(){super(L.SECOND,32)}},lo=class extends Me{constructor(){super(L.MILLISECOND,32)}},ho=class extends Me{constructor(){super(L.MICROSECOND,64)}},uo=class extends Me{constructor(){super(L.NANOSECOND,64)}},ve=class extends B{constructor(t,r){super(b.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${L[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};uv=Symbol.toStringTag;ve[uv]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(ve.prototype);fo=class extends ve{constructor(t){super(L.SECOND,t)}},Yn=class extends ve{constructor(t){super(L.MILLISECOND,t)}},mo=class extends ve{constructor(t){super(L.MICROSECOND,t)}},po=class extends ve{constructor(t){super(L.NANOSECOND,t)}},Le=class extends B{constructor(t){super(b.Interval),this.unit=t}toString(){return`Interval<${gt[this.unit]}>`}};fv=Symbol.toStringTag;Le[fv]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Le.prototype);go=class extends Le{constructor(){super(gt.DAY_TIME)}},yo=class extends Le{constructor(){super(gt.YEAR_MONTH)}},Wl=class extends Le{constructor(){super(gt.MONTH_DAY_NANO)}},Ke=class extends B{constructor(t){super(b.Duration),this.unit=t}toString(){return`Duration<${L[this.unit]}>`}};dv=Symbol.toStringTag;Ke[dv]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Ke.prototype);Hl=class extends Ke{constructor(){super(L.SECOND)}},$l=class extends Ke{constructor(){super(L.MILLISECOND)}},Yl=class extends Ke{constructor(){super(L.MICROSECOND)}},Kl=class extends Ke{constructor(){super(L.NANOSECOND)}},oe=class extends B{constructor(t){super(b.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};mv=Symbol.toStringTag;oe[mv]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(oe.prototype);Ur=class extends B{constructor(t){super(b.LargeList),this.children=[t]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};pv=Symbol.toStringTag;Ur[pv]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeList"))(Ur.prototype);vt=class extends B{constructor(t){super(b.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};gv=Symbol.toStringTag;vt[gv]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(vt.prototype);Xe=class extends B{constructor(t,r,n){super(b.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};yv=Symbol.toStringTag;Xe[yv]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Xe.prototype);_i=class extends Xe{constructor(t,r){super(xt.Dense,t,r)}},_o=class extends Xe{constructor(t,r){super(xt.Sparse,t,r)}},pr=class extends B{constructor(t){super(b.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};_v=Symbol.toStringTag;pr[_v]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(pr.prototype);zt=class extends B{constructor(t,r){super(b.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};wv=Symbol.toStringTag;zt[wv]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(zt.prototype);Fe=class extends B{constructor(t,r=!1){var n,i,o;if(super(b.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};bv=Symbol.toStringTag;Fe[bv]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Fe.prototype);hP=(e=>()=>++e)(-1),se=class extends B{constructor(t,r,n,i){super(b.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?hP():dt(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Sv=Symbol.toStringTag;se[Sv]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(se.prototype)});function uP(e,t,r=!0){return typeof t=="number"?Wa(e,t,r):typeof t=="string"&&t in b?Wa(e,b[t],r):t&&t instanceof B?Wa(e,vv(t),r):t?.type&&t.type instanceof B?Wa(e,vv(t.type),r):Wa(e,b.NONE,r)}function Wa(e,t,r=!0){let n=null;switch(t){case b.Null:n=e.visitNull;break;case b.Bool:n=e.visitBool;break;case b.Int:n=e.visitInt;break;case b.Int8:n=e.visitInt8||e.visitInt;break;case b.Int16:n=e.visitInt16||e.visitInt;break;case b.Int32:n=e.visitInt32||e.visitInt;break;case b.Int64:n=e.visitInt64||e.visitInt;break;case b.Uint8:n=e.visitUint8||e.visitInt;break;case b.Uint16:n=e.visitUint16||e.visitInt;break;case b.Uint32:n=e.visitUint32||e.visitInt;break;case b.Uint64:n=e.visitUint64||e.visitInt;break;case b.Float:n=e.visitFloat;break;case b.Float16:n=e.visitFloat16||e.visitFloat;break;case b.Float32:n=e.visitFloat32||e.visitFloat;break;case b.Float64:n=e.visitFloat64||e.visitFloat;break;case b.Utf8:n=e.visitUtf8;break;case b.LargeUtf8:n=e.visitLargeUtf8;break;case b.Utf8View:n=e.visitUtf8View||e.visitUtf8;break;case b.Binary:n=e.visitBinary;break;case b.LargeBinary:n=e.visitLargeBinary;break;case b.BinaryView:n=e.visitBinaryView||e.visitBinary;break;case b.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case b.Date:n=e.visitDate;break;case b.DateDay:n=e.visitDateDay||e.visitDate;break;case b.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case b.Timestamp:n=e.visitTimestamp;break;case b.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case b.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case b.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case b.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case b.Time:n=e.visitTime;break;case b.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case b.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case b.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case b.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case b.Decimal:n=e.visitDecimal;break;case b.List:n=e.visitList;break;case b.LargeList:n=e.visitLargeList;break;case b.Struct:n=e.visitStruct;break;case b.Union:n=e.visitUnion;break;case b.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case b.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case b.Dictionary:n=e.visitDictionary;break;case b.Interval:n=e.visitInterval;break;case b.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case b.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case b.IntervalMonthDayNano:n=e.visitIntervalMonthDayNano||e.visitInterval;break;case b.Duration:n=e.visitDuration;break;case b.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case b.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case b.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case b.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case b.FixedSizeList:n=e.visitFixedSizeList;break;case b.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${b[t]}'`)}function vv(e){switch(e.typeId){case b.Null:return b.Null;case b.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?b.Int8:b.Uint8;case 16:return r?b.Int16:b.Uint16;case 32:return r?b.Int32:b.Uint32;case 64:return r?b.Int64:b.Uint64}return b.Int}case b.Float:switch(e.precision){case wt.HALF:return b.Float16;case wt.SINGLE:return b.Float32;case wt.DOUBLE:return b.Float64}return b.Float;case b.Binary:return b.Binary;case b.LargeBinary:return b.LargeBinary;case b.BinaryView:return b.BinaryView;case b.Utf8:return b.Utf8;case b.LargeUtf8:return b.LargeUtf8;case b.Utf8View:return b.Utf8View;case b.Bool:return b.Bool;case b.Decimal:return b.Decimal;case b.Time:switch(e.unit){case L.SECOND:return b.TimeSecond;case L.MILLISECOND:return b.TimeMillisecond;case L.MICROSECOND:return b.TimeMicrosecond;case L.NANOSECOND:return b.TimeNanosecond}return b.Time;case b.Timestamp:switch(e.unit){case L.SECOND:return b.TimestampSecond;case L.MILLISECOND:return b.TimestampMillisecond;case L.MICROSECOND:return b.TimestampMicrosecond;case L.NANOSECOND:return b.TimestampNanosecond}return b.Timestamp;case b.Date:switch(e.unit){case It.DAY:return b.DateDay;case It.MILLISECOND:return b.DateMillisecond}return b.Date;case b.Interval:switch(e.unit){case gt.DAY_TIME:return b.IntervalDayTime;case gt.YEAR_MONTH:return b.IntervalYearMonth;case gt.MONTH_DAY_NANO:return b.IntervalMonthDayNano}return b.Interval;case b.Duration:switch(e.unit){case L.SECOND:return b.DurationSecond;case L.MILLISECOND:return b.DurationMillisecond;case L.MICROSECOND:return b.DurationMicrosecond;case L.NANOSECOND:return b.DurationNanosecond}return b.Duration;case b.Map:return b.Map;case b.List:return b.List;case b.LargeList:return b.LargeList;case b.Struct:return b.Struct;case b.Union:switch(e.mode){case xt.Dense:return b.DenseUnion;case xt.Sparse:return b.SparseUnion}return b.Union;case b.FixedSizeBinary:return b.FixedSizeBinary;case b.FixedSizeList:return b.FixedSizeList;case b.Dictionary:return b.Dictionary}throw new Error(`Unrecognized type '${b[e.typeId]}'`)}var j,gr=S(()=>{Kt();At();j=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return uP(this,t,r)}getVisitFnByTypeId(t,r=!0){return Wa(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitUtf8View(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitBinaryView(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitLargeList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};j.prototype.visitInt8=null;j.prototype.visitInt16=null;j.prototype.visitInt32=null;j.prototype.visitInt64=null;j.prototype.visitUint8=null;j.prototype.visitUint16=null;j.prototype.visitUint32=null;j.prototype.visitUint64=null;j.prototype.visitFloat16=null;j.prototype.visitFloat32=null;j.prototype.visitFloat64=null;j.prototype.visitDateDay=null;j.prototype.visitDateMillisecond=null;j.prototype.visitTimestampSecond=null;j.prototype.visitTimestampMillisecond=null;j.prototype.visitTimestampMicrosecond=null;j.prototype.visitTimestampNanosecond=null;j.prototype.visitTimeSecond=null;j.prototype.visitTimeMillisecond=null;j.prototype.visitTimeMicrosecond=null;j.prototype.visitTimeNanosecond=null;j.prototype.visitDenseUnion=null;j.prototype.visitSparseUnion=null;j.prototype.visitIntervalDayTime=null;j.prototype.visitIntervalYearMonth=null;j.prototype.visitIntervalMonthDayNano=null;j.prototype.visitDuration=null;j.prototype.visitDurationSecond=null;j.prototype.visitDurationMillisecond=null;j.prototype.visitDurationMicrosecond=null;j.prototype.visitDurationNanosecond=null});var wg={};tr(wg,{float64ToUint16:()=>Xl,uint16ToFloat64:()=>Mf});function Mf(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function Xl(e){if(e!==e)return 32256;Tv[0]=e;let t=(Ha[1]&2147483648)>>16&65535,r=Ha[1]&2146435072,n=0;return r>=1089470464?Ha[0]>0?r=31744:(r=(r&2080374784)>>16,n=(Ha[1]&1048575)>>10):r<=1056964608?(n=1048576+(Ha[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(Ha[1]&1048575)+512>>10),t|r|n&65535}var Tv,Ha,Zl=S(()=>{Tv=new Float64Array(1),Ha=new Uint32Array(Tv.buffer)});function et(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var X,fP,Ev,dP,wi,bg,Iv,mP,vf,Tf,Sg,Av,pP,Rv,gP,Cv,yP,xg,Ef,If,Af,Rf,Mg,Cf,Pf,Of,Bf,vg,Tg,Pv,_P,wP,bP,SP,xP,MP,vP,Ov,Bv,TP,Eg,Nf,Lf,Ff,Df,Uf,zf,Vf,Ig,EP,Te,Vr=S(()=>{De();gr();$n();di();Zl();Kt();At();X=class extends j{};fP=(e,t,r)=>{e[t]=Math.floor(r/864e5)},Ev=(e,t,r,n)=>{if(r+1<t.length){let i=dt(t[r]),o=dt(t[r+1]);e.set(n.subarray(0,o-i),i)}},dP=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},wi=({values:e},t,r)=>{e[t]=r},bg=({values:e},t,r)=>{e[t]=r},Iv=({values:e},t,r)=>{e[t]=Xl(r)},mP=(e,t,r)=>{switch(e.type.precision){case wt.HALF:return Iv(e,t,r);case wt.SINGLE:case wt.DOUBLE:return bg(e,t,r)}},vf=({values:e},t,r)=>{fP(e,t,r.valueOf())},Tf=({values:e},t,r)=>{e[t]=BigInt(r)},Sg=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},Av=({values:e,valueOffsets:t},r,n)=>Ev(e,t,r,n),pP=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},Rv=(e,t,r)=>{var n,i,o,s;let a=e.values;if(!a)throw new Error("BinaryView data is missing view buffer");let c=lt.ELEMENT_WIDTH,l=t*c,h=l+c;if(l<0||h>a.length)throw new RangeError(`BinaryView index ${t} out of bounds`);a.fill(0,l,h);let u=new DataView(a.buffer,a.byteOffset+l,c),f=r.length;if(u.setInt32(lt.LENGTH_OFFSET,f,!0),f<=lt.INLINE_CAPACITY){a.set(r,l+lt.INLINE_OFFSET);return}let d=((n=r[0])!==null&&n!==void 0?n:0)|((i=r[1])!==null&&i!==void 0?i:0)<<8|((o=r[2])!==null&&o!==void 0?o:0)<<16|((s=r[3])!==null&&s!==void 0?s:0)<<24;u.setUint32(lt.INLINE_OFFSET,d>>>0,!0);let m=pP(e),p=r.slice(),g=m.push(p)-1;u.setInt32(lt.BUFFER_INDEX_OFFSET,g,!0),u.setInt32(lt.BUFFER_OFFSET_OFFSET,0,!0)},gP=(e,t,r)=>{let n=r instanceof Uint8Array?r:new Uint8Array(r);Rv(e,t,n)},Cv=({values:e,valueOffsets:t},r,n)=>Ev(e,t,r,Rr(n)),yP=(e,t,r)=>{let n=Rr(r);Rv(e,t,n)},xg=(e,t,r)=>{e.type.unit===It.DAY?vf(e,t,r):Tf(e,t,r)},Ef=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},If=({values:e},t,r)=>{e[t]=BigInt(r)},Af=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},Rf=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},Mg=(e,t,r)=>{switch(e.type.unit){case L.SECOND:return Ef(e,t,r);case L.MILLISECOND:return If(e,t,r);case L.MICROSECOND:return Af(e,t,r);case L.NANOSECOND:return Rf(e,t,r)}},Cf=({values:e},t,r)=>{e[t]=r},Pf=({values:e},t,r)=>{e[t]=r},Of=({values:e},t,r)=>{e[t]=r},Bf=({values:e},t,r)=>{e[t]=r},vg=(e,t,r)=>{switch(e.type.unit){case L.SECOND:return Cf(e,t,r);case L.MILLISECOND:return Pf(e,t,r);case L.MICROSECOND:return Of(e,t,r);case L.NANOSECOND:return Bf(e,t,r)}},Tg=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},Pv=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=Te.getVisitFn(n),s=dt(i[t]),a=dt(i[t+1]);if(Array.isArray(r))for(let c=-1,l=s;l<a;)o(n,l++,r[++c]);else for(let c=-1,l=s;l<a;)o(n,l++,r.get(++c))},_P=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=Te.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},wP=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),bP=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),SP=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),xP=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),MP=(e,t,r)=>{let n=e.type.children.map(o=>Te.getVisitFn(o.type)),i=r instanceof Map?SP(t,r):r instanceof U?bP(t,r):Array.isArray(r)?wP(t,r):xP(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},vP=(e,t,r)=>{e.type.mode===xt.Dense?Ov(e,t,r):Bv(e,t,r)},Ov=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Te.visit(i,e.valueOffsets[t],r)},Bv=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Te.visit(i,t,r)},TP=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},Eg=(e,t,r)=>{switch(e.type.unit){case gt.YEAR_MONTH:return Lf(e,t,r);case gt.DAY_TIME:return Nf(e,t,r);case gt.MONTH_DAY_NANO:return Ff(e,t,r)}},Nf=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},Lf=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},Ff=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},Df=({values:e},t,r)=>{e[t]=r},Uf=({values:e},t,r)=>{e[t]=r},zf=({values:e},t,r)=>{e[t]=r},Vf=({values:e},t,r)=>{e[t]=r},Ig=(e,t,r)=>{switch(e.type.unit){case L.SECOND:return Df(e,t,r);case L.MILLISECOND:return Uf(e,t,r);case L.MICROSECOND:return zf(e,t,r);case L.NANOSECOND:return Vf(e,t,r)}},EP=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=Te.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};X.prototype.visitBool=et(dP);X.prototype.visitInt=et(wi);X.prototype.visitInt8=et(wi);X.prototype.visitInt16=et(wi);X.prototype.visitInt32=et(wi);X.prototype.visitInt64=et(wi);X.prototype.visitUint8=et(wi);X.prototype.visitUint16=et(wi);X.prototype.visitUint32=et(wi);X.prototype.visitUint64=et(wi);X.prototype.visitFloat=et(mP);X.prototype.visitFloat16=et(Iv);X.prototype.visitFloat32=et(bg);X.prototype.visitFloat64=et(bg);X.prototype.visitUtf8=et(Cv);X.prototype.visitLargeUtf8=et(Cv);X.prototype.visitUtf8View=et(yP);X.prototype.visitBinary=et(Av);X.prototype.visitLargeBinary=et(Av);X.prototype.visitBinaryView=et(gP);X.prototype.visitFixedSizeBinary=et(Sg);X.prototype.visitDate=et(xg);X.prototype.visitDateDay=et(vf);X.prototype.visitDateMillisecond=et(Tf);X.prototype.visitTimestamp=et(Mg);X.prototype.visitTimestampSecond=et(Ef);X.prototype.visitTimestampMillisecond=et(If);X.prototype.visitTimestampMicrosecond=et(Af);X.prototype.visitTimestampNanosecond=et(Rf);X.prototype.visitTime=et(vg);X.prototype.visitTimeSecond=et(Cf);X.prototype.visitTimeMillisecond=et(Pf);X.prototype.visitTimeMicrosecond=et(Of);X.prototype.visitTimeNanosecond=et(Bf);X.prototype.visitDecimal=et(Tg);X.prototype.visitList=et(Pv);X.prototype.visitLargeList=et(Pv);X.prototype.visitStruct=et(MP);X.prototype.visitUnion=et(vP);X.prototype.visitDenseUnion=et(Ov);X.prototype.visitSparseUnion=et(Bv);X.prototype.visitDictionary=et(TP);X.prototype.visitInterval=et(Eg);X.prototype.visitIntervalDayTime=et(Nf);X.prototype.visitIntervalYearMonth=et(Lf);X.prototype.visitIntervalMonthDayNano=et(Ff);X.prototype.visitDuration=et(Ig);X.prototype.visitDurationSecond=et(Df);X.prototype.visitDurationMillisecond=et(Uf);X.prototype.visitDurationMicrosecond=et(zf);X.prototype.visitDurationNanosecond=et(Vf);X.prototype.visitFixedSizeList=et(EP);X.prototype.visitMap=et(_P);Te=new X});var Cn,$a,Kn,Ag,Rg,IP,Gf=S(()=>{ql();Ss();Vr();Cn=Symbol.for("parent"),$a=Symbol.for("rowIndex"),Kn=class{constructor(t,r){return this[Cn]=t,this[$a]=r,new Proxy(this,IP)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[$a],r=this[Cn],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=ae.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${vn(t)}: ${vn(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Ag(this[Cn],this[$a])}},Ag=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ae.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Kn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Cn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[$a]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});Rg=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Cn].type.children.map(r=>r.name)}has(t,r){return t[Cn].type.children.some(n=>n.name===r)}getOwnPropertyDescriptor(t,r){if(t[Cn].type.children.some(n=>n.name===r))return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[Cn].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=ae.visit(t[Cn].children[n],t[$a]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[Cn].type.children.findIndex(o=>o.name===r);return i!==-1?(Te.visit(t[Cn].children[i],t[$a],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}},IP=new Rg});function J(e){return(t,r)=>t.getValid(r)?e(t,r):null}var H,AP,Ya,RP,CP,Nv,PP,Lv,Fv,wo,OP,Dv,BP,Uv,zv,NP,Vv,LP,FP,DP,UP,Gv,kv,qv,jv,zP,Wv,Hv,$v,Yv,VP,GP,Kv,kP,qP,jP,Xv,Zv,WP,HP,Jv,Qv,tT,eT,rT,nT,iT,$P,YP,ae,Ss=S(()=>{xf();De();gr();Jl();Gf();$n();di();Zl();Kt();H=class extends j{};AP=(e,t)=>864e5*e[t],Ya=16,RP=12,CP=(e,t)=>null,Nv=(e,t,r)=>{if(r+1>=t.length)return null;let n=dt(t[r]),i=dt(t[r+1]);return e.subarray(n,i)},PP=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},Lv=({values:e},t)=>AP(e,t),Fv=({values:e},t)=>dt(e[t]),wo=({stride:e,values:t},r)=>t[e*r],OP=({stride:e,values:t},r)=>Mf(t[e*r]),Dv=({values:e},t)=>e[t],BP=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),Uv=({values:e,valueOffsets:t},r)=>Nv(e,t,r),zv=(e,t)=>{var r;let n=e.values;if(!n)throw new Error("BinaryView data is missing view buffer");let i=t*Ya,o=i+Ya;if(i<0||o>n.length)throw new Error(`BinaryView data buffer is too short: expected ${Ya} bytes, got ${Math.max(0,n.length-i)}`);let s=n.subarray(i,o);if(s.length<Ya)throw new Error(`BinaryView data buffer is too short: expected ${Ya} bytes, got ${s.length}`);let a=new DataView(n.buffer,s.byteOffset,Ya),c=a.getInt32(0,!0);if(c<=0)return new Uint8Array(0);if(c<=RP)return s.subarray(4,4+c);let l=a.getInt32(8,!0),h=a.getInt32(12,!0),u=(r=e.variadicBuffers)===null||r===void 0?void 0:r[l];if(!u)throw new Error(`BinaryView variadic buffer ${l} is missing`);return u.subarray(h,h+c)},NP=(e,t)=>zv(e,t),Vv=({values:e,valueOffsets:t},r)=>{let n=Nv(e,t,r);return n!==null?Fa(n):null},LP=(e,t)=>{let r=zv(e,t);return Fa(r)},FP=({values:e},t)=>e[t],DP=({type:e,values:t},r)=>e.precision!==wt.HALF?t[r]:Mf(t[r]),UP=(e,t)=>e.type.unit===It.DAY?Lv(e,t):Fv(e,t),Gv=({values:e},t)=>1e3*dt(e[t]),kv=({values:e},t)=>dt(e[t]),qv=({values:e},t)=>pg(e[t],BigInt(1e3)),jv=({values:e},t)=>pg(e[t],BigInt(1e6)),zP=(e,t)=>{switch(e.type.unit){case L.SECOND:return Gv(e,t);case L.MILLISECOND:return kv(e,t);case L.MICROSECOND:return qv(e,t);case L.NANOSECOND:return jv(e,t)}},Wv=({values:e},t)=>e[t],Hv=({values:e},t)=>e[t],$v=({values:e},t)=>e[t],Yv=({values:e},t)=>e[t],VP=(e,t)=>{switch(e.type.unit){case L.SECOND:return Wv(e,t);case L.MILLISECOND:return Hv(e,t);case L.MICROSECOND:return $v(e,t);case L.NANOSECOND:return Yv(e,t)}},GP=({values:e,stride:t},r)=>bs.decimal(e.subarray(t*r,t*(r+1))),Kv=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,o=dt(r[t*n]),s=dt(r[t*n+1]),c=i[0].slice(o,s-o);return new U([c])},kP=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new tn(s.slice(i,o-i))},qP=(e,t)=>new Kn(e,t),jP=(e,t)=>e.type.mode===xt.Dense?Xv(e,t):Zv(e,t),Xv=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return ae.visit(n,e.valueOffsets[t])},Zv=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return ae.visit(n,t)},WP=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},HP=(e,t)=>e.type.unit===gt.MONTH_DAY_NANO?tT(e,t):e.type.unit===gt.DAY_TIME?Jv(e,t):Qv(e,t),Jv=({values:e},t)=>e.subarray(2*t,2*(t+1)),Qv=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},tT=({values:e},t)=>e.subarray(4*t,4*(t+1)),eT=({values:e},t)=>e[t],rT=({values:e},t)=>e[t],nT=({values:e},t)=>e[t],iT=({values:e},t)=>e[t],$P=(e,t)=>{switch(e.type.unit){case L.SECOND:return eT(e,t);case L.MILLISECOND:return rT(e,t);case L.MICROSECOND:return nT(e,t);case L.NANOSECOND:return iT(e,t)}},YP=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new U([o])};H.prototype.visitNull=J(CP);H.prototype.visitBool=J(PP);H.prototype.visitInt=J(FP);H.prototype.visitInt8=J(wo);H.prototype.visitInt16=J(wo);H.prototype.visitInt32=J(wo);H.prototype.visitInt64=J(Dv);H.prototype.visitUint8=J(wo);H.prototype.visitUint16=J(wo);H.prototype.visitUint32=J(wo);H.prototype.visitUint64=J(Dv);H.prototype.visitFloat=J(DP);H.prototype.visitFloat16=J(OP);H.prototype.visitFloat32=J(wo);H.prototype.visitFloat64=J(wo);H.prototype.visitUtf8=J(Vv);H.prototype.visitLargeUtf8=J(Vv);H.prototype.visitUtf8View=J(LP);H.prototype.visitBinary=J(Uv);H.prototype.visitLargeBinary=J(Uv);H.prototype.visitBinaryView=J(NP);H.prototype.visitFixedSizeBinary=J(BP);H.prototype.visitDate=J(UP);H.prototype.visitDateDay=J(Lv);H.prototype.visitDateMillisecond=J(Fv);H.prototype.visitTimestamp=J(zP);H.prototype.visitTimestampSecond=J(Gv);H.prototype.visitTimestampMillisecond=J(kv);H.prototype.visitTimestampMicrosecond=J(qv);H.prototype.visitTimestampNanosecond=J(jv);H.prototype.visitTime=J(VP);H.prototype.visitTimeSecond=J(Wv);H.prototype.visitTimeMillisecond=J(Hv);H.prototype.visitTimeMicrosecond=J($v);H.prototype.visitTimeNanosecond=J(Yv);H.prototype.visitDecimal=J(GP);H.prototype.visitList=J(Kv);H.prototype.visitLargeList=J(Kv);H.prototype.visitStruct=J(qP);H.prototype.visitUnion=J(jP);H.prototype.visitDenseUnion=J(Xv);H.prototype.visitSparseUnion=J(Zv);H.prototype.visitDictionary=J(WP);H.prototype.visitInterval=J(HP);H.prototype.visitIntervalDayTime=J(Jv);H.prototype.visitIntervalYearMonth=J(Qv);H.prototype.visitIntervalMonthDayNano=J(tT);H.prototype.visitDuration=J($P);H.prototype.visitDurationSecond=J(eT);H.prototype.visitDurationMillisecond=J(rT);H.prototype.visitDurationMicrosecond=J(nT);H.prototype.visitDurationNanosecond=J(iT);H.prototype.visitFixedSizeList=J(YP);H.prototype.visitMap=J(kP);ae=new H});var bo,Xa,Ka,Cg,tn,Pg,Og,Jl=S(()=>{De();ql();Ss();Vr();bo=Symbol.for("keys"),Xa=Symbol.for("vals"),Ka=Symbol.for("kKeysAsStrings"),Cg=Symbol.for("_kKeysAsStrings"),tn=class{constructor(t){return this[bo]=new U([t.children[0]]).memoize(),this[Xa]=t.children[1],new Proxy(this,new Og)}get[Ka](){return this[Cg]||(this[Cg]=Array.from(this[bo].toArray(),String))}[Symbol.iterator](){return new Pg(this[bo],this[Xa])}get size(){return this[bo].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[bo],r=this[Xa],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=ae.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${vn(t)}: ${vn(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Pg=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ae.visit(this.vals,t)]})}},Og=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ka]}has(t,r){return t[Ka].includes(r)}getOwnPropertyDescriptor(t,r){if(t[Ka].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[Ka].indexOf(r);if(n!==-1){let i=ae.visit(Reflect.get(t,Xa),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[Ka].indexOf(r);return i!==-1?(Te.visit(Reflect.get(t,Xa),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(tn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[bo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xa]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cg]:{writable:!0,enumerable:!1,configurable:!1,value:null}})});var Bg={};tr(Bg,{clampRange:()=>Ql,createElementComparator:()=>So,wrapIndex:()=>xs});function Ql(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(oT=o,o=s,s=oT),s>i&&(s=i),n?n(e,o,s):[o,s]}function So(e){if(typeof e!=="object"||e===null)return sT(e)?sT:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?D0(e,r):!1:e instanceof Map?XP(e):Array.isArray(e)?KP(e):e instanceof U?ZP(e):JP(e,!0)}function KP(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=So(e[r]);return kf(t)}function XP(e){let t=-1,r=[];for(let n of e.values())r[++t]=So(n);return kf(r)}function ZP(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=So(e.get(r));return kf(t)}function JP(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=So(e[r[i]]);return kf(n,r)}function kf(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return QP(e,r);case Map:return aT(e,r,r.keys());case tn:case Kn:case Object:case void 0:return aT(e,r,t||Object.keys(r))}return r instanceof U?tO(e,r):!1}}function QP(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function tO(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function aT(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),h=i.next();for(;s<a&&!l.done&&!h.done&&!c.done&&!(l.value!==h.value||!e[s](c.value));++s,l=n.next(),h=i.next(),c=o.next());return s===a&&l.done&&h.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var oT,xs,sT,Za=S(()=>{De();Jl();Gf();me();xs=(e,t)=>e<0?t+e:e,sT=e=>e!==e});var Ng={};tr(Ng,{BitIterator:()=>Xn,getBit:()=>jf,getBool:()=>Ja,packBools:()=>vs,popcnt_array:()=>cT,popcnt_bit_range:()=>th,popcnt_uint32:()=>qf,setBool:()=>eO,truncateBitmap:()=>Ms});function Ja(e,t,r,n){return(r&1<<n)!==0}function jf(e,t,r,n){return(r&1<<n)>>n}function eO(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Ms(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):vs(new Xn(r,e,t,null,Ja)).subarray(0,n)),i}return r}function vs(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}function th(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new Xn(e,t,r-t,e,jf))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return th(e,t,i)+th(e,n,r)+cT(e,i>>3,n-i>>3)}function cT(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=qf(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=qf(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=qf(o.getUint8(i)),i+=1;return n}function qf(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Xn,Ts=S(()=>{Xn=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}});function q(e){return nO.visit(e)}var rO,lT,Q,Lg,nO,en=S(()=>{De();Kt();At();Ts();At();gr();me();rO=-1,lT=Symbol.for("apache-arrow/Data"),Q=class e{static isData(t){return t?.[lT]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return B.isSparseUnion(t)?this.children.some(r=>r.nullable):B.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),t+=this.variadicBuffers.reduce((s,a)=>{var c;return s+((c=a?.byteLength)!==null&&c!==void 0?c:0)},0),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(B.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=rO&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-th(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a,c=[]){var l;this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let h;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets,this.variadicBuffers=o.variadicBuffers):(this.stride=zr(t),o&&((h=o[0])&&(this.valueOffsets=h),(h=o[1])&&(this.values=h),(h=o[2])&&(this.nullBitmap=h),(h=o[3])&&(this.typeIds=h)),this.variadicBuffers=c),(l=this.variadicBuffers)!==null&&l!==void 0||(this.variadicBuffers=[])}getValid(t){let{type:r}=this;if(B.isUnion(r)){let n=r,i=this.typeIds[t],o=n.typeIdToChildIndex[i],s=this.children[o],a=this.valueOffsets,c=n.mode===xt.Dense&&a?Number(a[t]):t;return s.getValid(c)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(B.isUnion(i)){let o=i,s=this.typeIds[t],a=o.typeIdToChildIndex[s],c=this.children[a],l=this.valueOffsets,h=o.mode===xt.Dense&&l?Number(l[t]):t;n=c.getValid(h),c.setValid(h,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,h=c>>3;(!o||o.byteLength<=h)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(Ms(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let u=o[h];n=(u&l)!==0,o[h]=r?u|l:u&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children,a=this.variadicBuffers){return new e(t,r,n,i,o,s,this.dictionary,a)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===b.Null)return this.clone(this.type,0,t,0,this.buffers,this.children,this.variadicBuffers);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(Ms(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[kt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o,this.children,this.variadicBuffers)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;if((o=s[kt.TYPE])&&(s[kt.TYPE]=o.subarray(t,t+r)),B.isBinaryView(this.type)||B.isUtf8View(this.type)){let a=lt.ELEMENT_WIDTH;(o=s[kt.DATA])&&(s[kt.DATA]=o.subarray(t*a,(t+r)*a))}else(o=s[kt.OFFSET])&&(s[kt.OFFSET]=o.subarray(t,t+r+1))||(o=s[kt.DATA])&&(s[kt.DATA]=i===6?o:o.subarray(n*t,n*(t+r)));return s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};Q.prototype.children=Object.freeze([]);Q.prototype[lT]=!0;Object.defineProperty(Q,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Q&&Q.isData(t)}});Lg=class e extends j{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new Q(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.data),o=W(t.nullBitmap),s=ys(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Q(r,n,a,c,[s,i,o])}visitUtf8View(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=ft(n.ArrayType,t.views),s=W(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>W(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/$e.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new Q(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.data),o=W(t.nullBitmap),s=Il(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Q(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.data),o=W(t.nullBitmap),s=ys(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Q(r,n,a,c,[s,i,o])}visitBinaryView(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=ft(n.ArrayType,t.views),s=W(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>W(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/lt.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new Q(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.data),o=W(t.nullBitmap),s=Il(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Q(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length/zr(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length/zr(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length/zr(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length/zr(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length/zr(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=W(t.nullBitmap),s=ys(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Q(r,n,a,c,[s,void 0,o],[i])}visitLargeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=W(t.nullBitmap),s=Il(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Q(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=W(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=ft(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(B.isSparseUnion(r))return new Q(r,n,s,a,[void 0,void 0,void 0,o],i);let c=ys(t.valueOffsets);return new Q(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.indices.ArrayType,t.data),{["dictionary"]:s=new U([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Q(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length/zr(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=W(t.nullBitmap),o=ft(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=W(t.nullBitmap),{["length"]:s=i.length/zr(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Q(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=W(t.nullBitmap),s=ys(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Q(r,n,a,c,[s,void 0,o],[i])}},nO=new Lg});function hT(e){return e.some(t=>t.nullable)}function Wf(e){return e.reduce((t,r)=>t+r.nullCount,0)}function Hf(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function $f(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let h=Math.max(0,r-c),u=Math.min(n-c,l);i.push(a.slice(h,u-h))}return i.length===0&&i.push(e[0].slice(0,0)),i}function Fg(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function rh(e,t){return e.getValid(t)}function Qa(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return Fg(n,this._offsets,r,t)}}function Yf(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=Fg(o,this._offsets,n,r);return t=void 0,s}}function Kf(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,h=n.length;++l<h;){let u=n[l];if(~(a=e(u,t,s)))return c+a;s=0,c+=u.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):Fg(o,this._offsets,i,r);return t=void 0,s}}var eh,Xf=S(()=>{eh=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}});function iO(e,t){return t===null&&e.length>0?0:-1}function oO(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new Xn(r,e.offset+(t||0),e.length,r,Ja)){if(!i)return n;++n}return-1}function it(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case b.Union:break;case b.Dictionary:break;default:return oO(e,r)}let n=ae.getVisitFn(e),i=So(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function uT(e,t,r){let n=ae.getVisitFn(e),i=So(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}var $,Es,Zf=S(()=>{Kt();gr();Ss();Ts();Za();$=class extends j{};$.prototype.visitNull=iO;$.prototype.visitBool=it;$.prototype.visitInt=it;$.prototype.visitInt8=it;$.prototype.visitInt16=it;$.prototype.visitInt32=it;$.prototype.visitInt64=it;$.prototype.visitUint8=it;$.prototype.visitUint16=it;$.prototype.visitUint32=it;$.prototype.visitUint64=it;$.prototype.visitFloat=it;$.prototype.visitFloat16=it;$.prototype.visitFloat32=it;$.prototype.visitFloat64=it;$.prototype.visitUtf8=it;$.prototype.visitLargeUtf8=it;$.prototype.visitUtf8View=it;$.prototype.visitBinary=it;$.prototype.visitLargeBinary=it;$.prototype.visitBinaryView=it;$.prototype.visitFixedSizeBinary=it;$.prototype.visitDate=it;$.prototype.visitDateDay=it;$.prototype.visitDateMillisecond=it;$.prototype.visitTimestamp=it;$.prototype.visitTimestampSecond=it;$.prototype.visitTimestampMillisecond=it;$.prototype.visitTimestampMicrosecond=it;$.prototype.visitTimestampNanosecond=it;$.prototype.visitTime=it;$.prototype.visitTimeSecond=it;$.prototype.visitTimeMillisecond=it;$.prototype.visitTimeMicrosecond=it;$.prototype.visitTimeNanosecond=it;$.prototype.visitDecimal=it;$.prototype.visitList=it;$.prototype.visitLargeList=it;$.prototype.visitStruct=it;$.prototype.visitUnion=it;$.prototype.visitDenseUnion=uT;$.prototype.visitSparseUnion=uT;$.prototype.visitDictionary=it;$.prototype.visitInterval=it;$.prototype.visitIntervalDayTime=it;$.prototype.visitIntervalYearMonth=it;$.prototype.visitIntervalMonthDayNano=it;$.prototype.visitDuration=it;$.prototype.visitDurationSecond=it;$.prototype.visitDurationMillisecond=it;$.prototype.visitDurationMicrosecond=it;$.prototype.visitDurationNanosecond=it;$.prototype.visitFixedSizeList=it;$.prototype.visitMap=it;Es=new $});function tt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(B.isInt(t)&&t.bitWidth!==64||B.isTime(t)&&t.bitWidth!==64||B.isFloat(t)&&t.precision!==wt.HALF))return new eh(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new eh(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new Dg(s)})}var Y,Dg,tc,Jf=S(()=>{gr();Kt();At();Xf();Y=class extends j{};Dg=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};Y.prototype.visitNull=tt;Y.prototype.visitBool=tt;Y.prototype.visitInt=tt;Y.prototype.visitInt8=tt;Y.prototype.visitInt16=tt;Y.prototype.visitInt32=tt;Y.prototype.visitInt64=tt;Y.prototype.visitUint8=tt;Y.prototype.visitUint16=tt;Y.prototype.visitUint32=tt;Y.prototype.visitUint64=tt;Y.prototype.visitFloat=tt;Y.prototype.visitFloat16=tt;Y.prototype.visitFloat32=tt;Y.prototype.visitFloat64=tt;Y.prototype.visitUtf8=tt;Y.prototype.visitLargeUtf8=tt;Y.prototype.visitUtf8View=tt;Y.prototype.visitBinary=tt;Y.prototype.visitLargeBinary=tt;Y.prototype.visitBinaryView=tt;Y.prototype.visitFixedSizeBinary=tt;Y.prototype.visitDate=tt;Y.prototype.visitDateDay=tt;Y.prototype.visitDateMillisecond=tt;Y.prototype.visitTimestamp=tt;Y.prototype.visitTimestampSecond=tt;Y.prototype.visitTimestampMillisecond=tt;Y.prototype.visitTimestampMicrosecond=tt;Y.prototype.visitTimestampNanosecond=tt;Y.prototype.visitTime=tt;Y.prototype.visitTimeSecond=tt;Y.prototype.visitTimeMillisecond=tt;Y.prototype.visitTimeMicrosecond=tt;Y.prototype.visitTimeNanosecond=tt;Y.prototype.visitDecimal=tt;Y.prototype.visitList=tt;Y.prototype.visitLargeList=tt;Y.prototype.visitStruct=tt;Y.prototype.visitUnion=tt;Y.prototype.visitDenseUnion=tt;Y.prototype.visitSparseUnion=tt;Y.prototype.visitDictionary=tt;Y.prototype.visitInterval=tt;Y.prototype.visitIntervalDayTime=tt;Y.prototype.visitIntervalYearMonth=tt;Y.prototype.visitIntervalMonthDayNano=tt;Y.prototype.visitDuration=tt;Y.prototype.visitDurationSecond=tt;Y.prototype.visitDurationMillisecond=tt;Y.prototype.visitDurationMicrosecond=tt;Y.prototype.visitDurationNanosecond=tt;Y.prototype.visitFixedSizeList=tt;Y.prototype.visitMap=tt;tc=new Y});function Zn(e){if(e){if(e instanceof Q)return new U([e]);if(e instanceof U)return new U(e.data);if(e.type instanceof B)return new U([q(e)]);if(Array.isArray(e))return new U(e.flatMap(t=>sO(t)));if(ArrayBuffer.isView(e)){e instanceof DataView&&(e=new Uint8Array(e.buffer));let t={offset:0,length:e.length,nullCount:-1,data:e};if(e instanceof Int8Array)return new U([q(Object.assign(Object.assign({},t),{type:new Or}))]);if(e instanceof Int16Array)return new U([q(Object.assign(Object.assign({},t),{type:new Br}))]);if(e instanceof Int32Array)return new U([q(Object.assign(Object.assign({},t),{type:new re}))]);if(e instanceof BigInt64Array)return new U([q(Object.assign(Object.assign({},t),{type:new Nr}))]);if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new U([q(Object.assign(Object.assign({},t),{type:new Lr}))]);if(e instanceof Uint16Array)return new U([q(Object.assign(Object.assign({},t),{type:new Fr}))]);if(e instanceof Uint32Array)return new U([q(Object.assign(Object.assign({},t),{type:new We}))]);if(e instanceof BigUint64Array)return new U([q(Object.assign(Object.assign({},t),{type:new En}))]);if(e instanceof Float32Array)return new U([q(Object.assign(Object.assign({},t),{type:new He}))]);if(e instanceof Float64Array)return new U([q(Object.assign(Object.assign({},t),{type:new Dr}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function sO(e){return e instanceof Q?[e]:e instanceof U?e.data:Zn(e).data}var fT,dT,mT,pT,U,Qf,De=S(()=>{Kt();Za();At();en();Xf();Ss();Vr();Zf();Jf();At();dT=Symbol.for("apache-arrow/Vector"),mT={},pT={},U=class e{static isVector(t){return t?.[dT]===!0}constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof Q)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=mT[s.typeId],h=o[0];this.isValid=u=>rh(h,u),this.get=u=>a(h,u),this.set=(u,f)=>c(h,u,f),this.indexOf=u=>l(h,u),this._offsets=[0,h.length];break}default:Object.setPrototypeOf(this,pT[s.typeId]),this._offsets=Hf(o);break}this.data=o,this.type=s,this.stride=zr(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return hT(this.data)}get nullCount(){return Wf(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${b[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(xs(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return tc.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Ql(this,t,r,({data:n,_offsets:i},o,s)=>$f(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case b.Int:case b.Float:case b.Decimal:case b.Time:case b.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return B.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(B.isDictionary(this.type)){let t=new Qf(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new Qf(this)}unmemoize(){if(B.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};fT=Symbol.toStringTag;U[fT]=(e=>{e.type=B.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[dT]=!0;let t=Object.keys(b).map(r=>b[r]).filter(r=>typeof r=="number"&&r!==b.NONE);for(let r of t){let n=ae.getVisitFnByTypeId(r),i=Te.getVisitFnByTypeId(r),o=Es.getVisitFnByTypeId(r);mT[r]={get:n,set:i,indexOf:o},pT[r]=Object.create(e,{isValid:{value:Qa(rh)},get:{value:Qa(ae.getVisitFnByTypeId(r))},set:{value:Yf(Te.getVisitFnByTypeId(r))},indexOf:{value:Kf(Es.getVisitFnByTypeId(r))}})}return"Vector"})(U.prototype);Object.defineProperty(U,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===U&&U.isVector(t)}});Qf=class e extends U{constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new U(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}});function gT(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
10
- switch (x) {${r.map(n=>`
11
- case ${aO(n)}:`).join("")}
12
- return false;
13
- }`),e.length!==r.length&&(t=`if (x !== x) return false;
14
- ${t}`),new Function("x",`${t}
15
- return true;`)}function aO(e){return typeof e!="bigint"?vn(e):`${vn(e)}n`}var yT=S(()=>{ql()});function Ug(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function _T(e,t=0){return e.length>=t?e.subarray(0,t):El(new e.constructor(t),e,0)}var yr,bi,ec,xo,Pn=S(()=>{me();yr=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?Ug(n*1,this.BYTES_PER_ELEMENT):Ug(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ug(t*this.stride,this.BYTES_PER_ELEMENT);let r=_T(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=_T(this.buffer,t)}},bi=class extends yr{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},ec=class extends bi{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},xo=class extends bi{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}}});var Ct,ce,Ue,Ft=S(()=>{De();en();Jl();At();yT();Pn();Ct=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=zr(t),this._nulls=new ec,r&&r.length>0&&(this._isValid=gT(r))}toVector(){return new U([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:h,_nulls:u}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=h?.flush(l.last()):t=h?.flush(s),a>0&&(n=u?.flush(s));let f=this.children.map(d=>d.flush());return this.clear(),q({type:o,length:s,nullCount:a,children:f,child:f[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Ct.prototype.length=1;Ct.prototype.stride=1;Ct.prototype.children=null;Ct.prototype.finished=!1;Ct.prototype.nullValues=null;Ct.prototype._isValid=()=>!0;ce=class extends Ct{constructor(t){super(t),this._values=new bi(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Ue=class extends Ct{constructor(t){super(t),this._pendingLength=0,this._offsets=new xo(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof tn?r[bo].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}}});var Is,zg=S(()=>{Is=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}}});var Gr,wT=S(()=>{_t();zg();Ga();mf();dg();Gr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Tt.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new fr).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Is).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new Is).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Tt.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}}});function td(e,t){return new Map([...e||new Map,...t||new Map])}function Vg(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(B.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&Vg(o.children,t)}return t}var bT,ST,ct,G,ze=S(()=>{Kt();At();bT=Symbol.for("apache-arrow/Schema"),ST=Symbol.for("apache-arrow/Field"),ct=class e{static isSchema(t){return t?.[bT]===!0}constructor(t=[],r,n,i=Tt.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=Vg(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=td(td(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:td(td(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=Vg(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};ct.prototype.fields=null;ct.prototype.metadata=null;ct.prototype.dictionaries=null;ct.prototype[bT]=!0;Object.defineProperty(ct,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ct&&ct.isSchema(t)}});G=class e{static isField(t){return t?.[ST]===!0}static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};G.prototype.type=null;G.prototype.name=null;G.prototype.nullable=null;G.prototype.metadata=null;G.prototype[ST]=!0;Object.defineProperty(G,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===G&&G.isField(t)}})});var cO,lO,Si,Gg,On,kg=S(()=>{zg();wT();_t();ze();Kt();me();$n();cO=_s,lO=Se,Si=class{static decode(t){t=new lO(W(t));let r=Gr.getRootAsFooter(t),n=ct.decode(r.schema(),new Map,r.version());return new Gg(n,r)}static encode(t){let r=new cO,n=ct.encode(r,t.schema);Gr.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())On.encode(r,s);let i=r.endVector();Gr.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())On.encode(r,s);let o=r.endVector();return Gr.startFooter(r),Gr.addSchema(r,n),Gr.addVersion(r,Tt.V5),Gr.addRecordBatches(r,i),Gr.addDictionaries(r,o),Gr.finishFooterBuffer(r,Gr.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=Tt.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}},Gg=class extends Si{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return On.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return On.decode(r)}return null}},On=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return Is.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=dt(n),this.bodyLength=dt(r)}}});var kr,xT=S(()=>{_t();Ga();Sf();mf();kr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Tt.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):mt.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Tt.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,mt.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}}});var qg,ed,MT=S(()=>{gr();WM();wf();sg();UM();zM();GM();VM();$M();YM();qM();rg();eg();lg();hg();ag();ng();jM();kM();HM();ug();tg();ig();og();cg();qg=class extends j{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return zl.startNull(r),zl.endNull(r)}visitInt(t,r){return xn.startInt(r),xn.addBitWidth(r,t.bitWidth),xn.addIsSigned(r,t.isSigned),xn.endInt(r)}visitFloat(t,r){return no.startFloatingPoint(r),no.addPrecision(r,t.precision),no.endFloatingPoint(r)}visitBinary(t,r){return Ol.startBinary(r),Ol.endBinary(r)}visitBinaryView(t,r){return Bl.startBinaryView(r),Bl.endBinaryView(r)}visitLargeBinary(t,r){return Ll.startLargeBinary(r),Ll.endLargeBinary(r)}visitBool(t,r){return Nl.startBool(r),Nl.endBool(r)}visitUtf8(t,r){return Gl.startUtf8(r),Gl.endUtf8(r)}visitUtf8View(t,r){return kl.startUtf8View(r),kl.endUtf8View(r)}visitLargeUtf8(t,r){return Dl.startLargeUtf8(r),Dl.endLargeUtf8(r)}visitDecimal(t,r){return Hn.startDecimal(r),Hn.addScale(r,t.scale),Hn.addPrecision(r,t.precision),Hn.addBitWidth(r,t.bitWidth),Hn.endDecimal(r)}visitDate(t,r){return Qi.startDate(r),Qi.addUnit(r,t.unit),Qi.endDate(r)}visitTime(t,r){return gi.startTime(r),gi.addUnit(r,t.unit),gi.addBitWidth(r,t.bitWidth),gi.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return yi.startTimestamp(r),yi.addUnit(r,t.unit),n!==void 0&&yi.addTimezone(r,n),yi.endTimestamp(r)}visitInterval(t,r){return io.startInterval(r),io.addUnit(r,t.unit),io.endInterval(r)}visitDuration(t,r){return to.startDuration(r),to.addUnit(r,t.unit),to.endDuration(r)}visitList(t,r){return Ul.startList(r),Ul.endList(r)}visitLargeList(t,r){return Fl.startLargeList(r),Fl.endLargeList(r)}visitStruct(t,r){return Vl.startStruct_(r),Vl.endStruct_(r)}visitUnion(t,r){Mn.startTypeIdsVector(r,t.typeIds.length);let n=Mn.createTypeIdsVector(r,t.typeIds);return Mn.startUnion(r),Mn.addMode(r,t.mode),Mn.addTypeIds(r,n),Mn.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Wn.startDictionaryEncoding(r),Wn.addId(r,BigInt(t.id)),Wn.addIsOrdered(r,t.isOrdered),n!==void 0&&Wn.addIndexType(r,n),Wn.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return eo.startFixedSizeBinary(r),eo.addByteWidth(r,t.byteWidth),eo.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return ro.startFixedSizeList(r),ro.addListSize(r,t.listSize),ro.endFixedSizeList(r)}visitMap(t,r){return oo.startMap(r),oo.addKeysSorted(r,t.keysSorted),oo.endMap(r)}},ed=new qg});function IT(e,t=new Map){return new ct(hO(e,t),rd(e.metadata),t)}function jg(e){return new le(e.count,RT(e.columns),CT(e.columns),null,PT(e.columns))}function AT(e){return new Ve(jg(e.data),e.id,e.isDelta)}function hO(e,t){return(e.fields||[]).filter(Boolean).map(r=>G.fromJSON(r,t))}function vT(e,t){return(e.children||[]).filter(Boolean).map(r=>G.fromJSON(r,t))}function RT(e){return(e||[]).reduce((t,r)=>[...t,new rn(r.count,uO(r.VALIDITY)),...RT(r.children)],[])}function CT(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];if(i.VALIDITY&&t.push(new te(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new te(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new te(t.length,i.OFFSET.length)),i.DATA&&t.push(new te(t.length,i.DATA.length)),i.VIEWS&&t.push(new te(t.length,i.VIEWS.length)),i.VARIADIC_DATA_BUFFERS)for(let o of i.VARIADIC_DATA_BUFFERS)t.push(new te(t.length,o.length));t=CT(i.children,t)}return t}function uO(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function PT(e){return(e||[]).reduce((t,r)=>[...t,...r.VARIADIC_DATA_BUFFERS?[r.VARIADIC_DATA_BUFFERS.length]:[],...PT(r.children)],[])}function OT(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=ET(e,vT(e,t)),i=new G(e.name,s,e.nullable,rd(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?TT(n):new re,a=new se(t.get(r),n,r,o.isOrdered),i=new G(e.name,a,e.nullable,rd(e.metadata))):(n=(n=o.indexType)?TT(n):new re,t.set(r,s=ET(e,vT(e,t))),a=new se(s,n,r,o.isOrdered),i=new G(e.name,a,e.nullable,rd(e.metadata))),i||null}function rd(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function TT(e){return new qt(e.isSigned,e.bitWidth)}function ET(e,t){let r=e.type.name;switch(r){case"NONE":return new Qt;case"null":return new Qt;case"binary":return new dr;case"largebinary":return new An;case"binaryview":return new lt;case"utf8":return new Be;case"largeutf8":return new Rn;case"utf8view":return new $e;case"bool":return new Ne;case"list":return new oe((t||[])[0]);case"largelist":return new Ur((t||[])[0]);case"struct":return new vt(t||[]);case"struct_":return new vt(t||[])}switch(r){case"int":{let n=e.type;return new qt(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new Oe(wt[n.precision])}case"decimal":{let n=e.type;return new mr(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new Ye(It[n.unit])}case"time":{let n=e.type;return new Me(L[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new ve(L[n.unit],n.timezone)}case"interval":{let n=e.type;return new Le(gt[n.unit])}case"duration":{let n=e.type;return new Ke(L[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Xe(xt[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new pr(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new zt(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new Fe((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var BT=S(()=>{ze();At();Mo();Kt()});function mO(e,t){return(()=>{switch(t){case mt.Schema:return ct.fromJSON(e);case mt.RecordBatch:return le.fromJSON(e);case mt.DictionaryBatch:return Ve.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${mt[t]}, type: ${t} }`)})}function pO(e,t){return(()=>{switch(t){case mt.Schema:return ct.decode(e.header(new fr),new Map,e.version());case mt.RecordBatch:return le.decode(e.header(new Ce),e.version());case mt.DictionaryBatch:return Ve.decode(e.header(new pi),e.version())}throw new Error(`Unrecognized Message type: { name: ${mt[t]}, type: ${t} }`)})}function gO(e,t=new Map,r=Tt.V5){let n=vO(e,t);return new ct(n,nd(e),t,r)}function yO(e,t=Tt.V5){return new le(e.length(),SO(e),xO(e,t),DT(e.compression()),MO(e))}function _O(e,t=Tt.V5){return new Ve(le.decode(e.data(),t),e.id(),e.isDelta())}function wO(e){return new te(e.offset(),e.length())}function bO(e){return new rn(e.length(),e.nullCount())}function SO(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=rn.decode(r));return t}function xO(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<Tt.V4&&(n.bb_pos+=8*(i+1)),r[++o]=te.decode(n));return r}function MO(e){let t=[],r=Math.trunc(e.variadicBufferCountsLength());for(let n=0;n<r;++n)t.push(dt(e.variadicBufferCounts(n)));return t}function vO(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=G.decode(n,t));return r}function NT(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=G.decode(n,t));return r}function TO(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=FT(e,NT(e,t)),n=new G(e.name(),i,e.nullable(),nd(e))):t.has(r=dt(a.id()))?(o=(o=a.indexType())?LT(o):new re,s=new se(t.get(r),o,r,a.isOrdered()),n=new G(e.name(),s,e.nullable(),nd(e))):(o=(o=a.indexType())?LT(o):new re,t.set(r,i=FT(e,NT(e,t))),s=new se(i,o,r,a.isOrdered()),n=new G(e.name(),s,e.nullable(),nd(e))),n||null}function nd(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function EO(e){let t=new Map;for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function LT(e){return new qt(e.isSigned(),e.bitWidth())}function FT(e,t){let r=e.typeType();switch(r){case Z.NONE:return new Qt;case Z.Null:return new Qt;case Z.Binary:return new dr;case Z.LargeBinary:return new An;case Z.BinaryView:return new lt;case Z.Utf8:return new Be;case Z.LargeUtf8:return new Rn;case Z.Utf8View:return new $e;case Z.Bool:return new Ne;case Z.List:return new oe((t||[])[0]);case Z.LargeList:return new Ur((t||[])[0]);case Z.Struct_:return new vt(t||[])}switch(r){case Z.Int:{let n=e.type(new xn);return new qt(n.isSigned(),n.bitWidth())}case Z.FloatingPoint:{let n=e.type(new no);return new Oe(n.precision())}case Z.Decimal:{let n=e.type(new Hn);return new mr(n.scale(),n.precision(),n.bitWidth())}case Z.Date:{let n=e.type(new Qi);return new Ye(n.unit())}case Z.Time:{let n=e.type(new gi);return new Me(n.unit(),n.bitWidth())}case Z.Timestamp:{let n=e.type(new yi);return new ve(n.unit(),n.timezone())}case Z.Interval:{let n=e.type(new io);return new Le(n.unit())}case Z.Duration:{let n=e.type(new to);return new Ke(n.unit())}case Z.Union:{let n=e.type(new Mn);return new Xe(n.mode(),n.typeIdsArray()||[],t||[])}case Z.FixedSizeBinary:{let n=e.type(new eo);return new pr(n.byteWidth())}case Z.FixedSizeList:{let n=e.type(new ro);return new zt(n.listSize(),(t||[])[0])}case Z.Map:{let n=e.type(new oo);return new Fe((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Z[r]}" (${r})`)}function DT(e){return e?new As(e.codec(),e.method()):null}function IO(e,t){let r=t.fields.map(o=>G.encode(e,o));fr.startFieldsVector(e,r.length);let n=fr.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?fr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return Yt.startKeyValue(e),Yt.addKey(e,a),Yt.addValue(e,c),Yt.endKeyValue(e)})):-1;return fr.startSchema(e),fr.addFields(e,n),fr.addEndianness(e,BO?Ji.Little:Ji.Big),i!==-1&&fr.addCustomMetadata(e,i),fr.endSchema(e)}function AO(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;B.isDictionary(o)?(s=o.dictionary.typeId,i=ed.visit(o,e),n=ed.visit(o.dictionary,e)):n=ed.visit(o,e);let a=(o.children||[]).map(h=>G.encode(e,h)),c=Pe.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Pe.createCustomMetadataVector(e,[...t.metadata].map(([h,u])=>{let f=e.createString(`${h}`),d=e.createString(`${u}`);return Yt.startKeyValue(e),Yt.addKey(e,f),Yt.addValue(e,d),Yt.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),Pe.startField(e),Pe.addType(e,n),Pe.addTypeType(e,s),Pe.addChildren(e,c),Pe.addNullable(e,!!t.nullable),r!==-1&&Pe.addName(e,r),i!==-1&&Pe.addDictionary(e,i),l!==-1&&Pe.addCustomMetadata(e,l),Pe.endField(e)}function RO(e,t){let r=t.nodes||[],n=t.buffers||[],i=t.variadicBufferCounts||[];Ce.startNodesVector(e,r.length);for(let l of r.slice().reverse())rn.encode(e,l);let o=e.endVector();Ce.startBuffersVector(e,n.length);for(let l of n.slice().reverse())te.encode(e,l);let s=e.endVector(),a=null;t.compression!==null&&(a=UT(e,t.compression));let c=-1;return i.length>0&&(c=Ce.createVariadicBufferCountsVector(e,i.map(BigInt))),Ce.startRecordBatch(e),Ce.addLength(e,BigInt(t.length)),Ce.addNodes(e,o),Ce.addBuffers(e,s),t.compression!==null&&a&&Ce.addCompression(e,a),c!==-1&&Ce.addVariadicBufferCounts(e,c),Ce.endRecordBatch(e)}function UT(e,t){return mi.startBodyCompression(e),mi.addCodec(e,t.type),mi.addMethod(e,t.method),mi.endBodyCompression(e)}function CO(e,t){let r=le.encode(e,t.data);return pi.startDictionaryBatch(e),pi.addId(e,BigInt(t.id)),pi.addIsDelta(e,t.isDelta),pi.addData(e,r),pi.endDictionaryBatch(e)}function PO(e,t){return Va.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function OO(e,t){return za.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var fO,dO,Ge,le,Ve,te,rn,As,BO,Mo=S(()=>{_t();dg();wf();J0();FM();X0();fg();Z0();bf();Ga();Q0();sg();rg();eg();lg();hg();ag();ng();ug();ig();og();cg();xT();K0();Y0();ze();me();$n();Kt();MT();BT();At();fO=_s,dO=Se,Ge=class e{static fromJSON(t,r){let n=new e(0,Tt.V5,r);return n._createHeader=mO(t,r),n}static decode(t){t=new dO(W(t));let r=kr.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=EO(r),a=new e(n,i,o,void 0,s);return a._createHeader=pO(r,o),a}static encode(t){let r=new fO,n=-1;t.isSchema()?n=ct.encode(r,t.header()):t.isRecordBatch()?n=le.encode(r,t.header()):t.isDictionaryBatch()&&(n=Ve.encode(r,t.header()));let i=t.metadata&&t.metadata.size>0?kr.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return Yt.startKeyValue(r),Yt.addKey(r,a),Yt.addValue(r,c),Yt.endKeyValue(r)})):-1;return kr.startMessage(r),kr.addVersion(r,Tt.V5),kr.addHeader(r,n),kr.addHeaderType(r,t.headerType),kr.addBodyLength(r,BigInt(t.bodyLength)),i!==-1&&kr.addCustomMetadata(r,i),kr.finishMessageBuffer(r,kr.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof ct)return new e(0,Tt.V5,mt.Schema,t);if(t instanceof le)return new e(r,Tt.V5,mt.RecordBatch,t,t.metadata);if(t instanceof Ve)return new e(r,Tt.V5,mt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===mt.Schema}isRecordBatch(){return this.headerType===mt.RecordBatch}isDictionaryBatch(){return this.headerType===mt.DictionaryBatch}constructor(t,r,n,i,o){this._version=r,this._headerType=n,this.body=new Uint8Array(0),this._compression=i?.compression,i&&(this._createHeader=()=>i),this._bodyLength=dt(t),this._metadata=o||new Map}},le=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(t,r,n,i,o=[],s){this._nodes=r,this._buffers=n,this._length=dt(t),this._compression=i,this._variadicBufferCounts=o,this._metadata=s||new Map}},Ve=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=dt(r)}},te=class{constructor(t,r){this.offset=dt(t),this.length=dt(r)}},rn=class{constructor(t,r){this.length=dt(t),this.nullCount=dt(r)}},As=class{constructor(t,r=ws.BUFFER){this.type=t,this.method=r}};G.encode=AO;G.decode=TO;G.fromJSON=OT;ct.encode=IO;ct.decode=gO;ct.fromJSON=IT;le.encode=RO;le.decode=yO;le.fromJSON=jg;Ve.encode=CO;Ve.decode=_O;Ve.fromJSON=AT;rn.encode=PO;rn.decode=bO;te.encode=OO;te.decode=wO;As.encode=UT;As.decode=DT;BO=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})()});var Dt,nh,Rs,id,ih=S(()=>{ur();Al();Dt=Object.freeze({done:!0,value:void 0}),nh=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Rs=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},id=class extends Rs{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return V(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Dt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return be.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return be.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return V(this,void 0,void 0,function*(){return yield this.abort(t),Dt})}return(t){return V(this,void 0,void 0,function*(){return yield this.close(),Dt})}read(t){return V(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return V(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(Dt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}});var nn,on,_r,Wg,xi,vo=S(()=>{ur();Al();di();ih();me();Zi();nn=class extends id{write(t){if((t=W(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Fa(this.toUint8Array(!0)):this.toUint8Array(!1).then(Fa)}toUint8Array(t=!1){return t?Pr(this._values)[0]:V(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=Ar(this),h;h=yield l.next(),r=h.done,!r;c=!0){o=h.value,c=!1;let u=o;s.push(u),a+=u.byteLength}}catch(u){n={error:u}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return Pr(s,a)[0]})}},on=class{constructor(t){t&&(this.source=new Wg(be.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},_r=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof nn?this.source=new xi(be.fromAsyncIterable(t)):uf(t)?this.source=new xi(be.fromNodeStream(t)):Tl(t)?this.source=new xi(be.fromDOMStream(t)):lf(t)?this.source=new xi(be.fromDOMStream(t.body)):wn(t)?this.source=new xi(be.fromIterable(t)):Cr(t)?this.source=new xi(be.fromAsyncIterable(t)):Jr(t)&&(this.source=new xi(be.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Wg=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Dt)}return(t){return Object.create(this.source.return&&this.source.return(t)||Dt)}},xi=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return V(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return V(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return V(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return V(this,arguments,void 0,function*(r,n="read"){return yield this.source.next({cmd:n,size:r})})}throw(t){return V(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||Dt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return V(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||Dt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}}});var oh,To,Hg=S(()=>{ur();vo();me();oh=class extends on{constructor(t,r){super(),this.position=0,this.buffer=W(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},To=class extends _r{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=V(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return V(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return V(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return V(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return V(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return V(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return V(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return V(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}});var Yg={};tr(Yg,{BaseInt64:()=>sh,Int128:()=>ah,Int64:()=>Mi,Uint64:()=>Xt});function rc(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var nc,$g,sh,Xt,Mi,ah,Kg=S(()=>{nc=8,$g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],sh=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${rc(this.buffer[1])} ${rc(this.buffer[0])}`}},Xt=class e extends sh{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=nc<n-o?nc:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([$g[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Mi=class e extends sh{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=nc<i-s?nc:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([$g[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},ah=class e{constructor(t){this.buffer=t}high(){return new Mi(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Mi(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new Xt(new Uint32Array([this.buffer[3],0])),n=new Xt(new Uint32Array([this.buffer[2],0])),i=new Xt(new Uint32Array([this.buffer[1],0])),o=new Xt(new Uint32Array([this.buffer[0],0])),s=new Xt(new Uint32Array([t.buffer[3],0])),a=new Xt(new Uint32Array([t.buffer[2],0])),c=new Xt(new Uint32Array([t.buffer[1],0])),l=new Xt(new Uint32Array([t.buffer[0],0])),h=Xt.multiply(o,l);this.buffer[0]=h.low();let u=new Xt(new Uint32Array([h.high(),0]));return h=Xt.multiply(i,l),u.plus(h),h=Xt.multiply(o,c),u.plus(h),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(h)?1:0,this.buffer[2]=u.high(),new Xt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Xt.multiply(n,l)).plus(Xt.multiply(i,c)).plus(Xt.multiply(o,a)),this.buffer[3]+=Xt.multiply(r,l).plus(Xt.multiply(n,c)).plus(Xt.multiply(i,a)).plus(Xt.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${rc(this.buffer[3])} ${rc(this.buffer[2])} ${rc(this.buffer[1])} ${rc(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=nc<i-s?nc:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([$g[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+16*n,4));return r}}});var ty={};tr(ty,{toIntervalDayTimeInt32Array:()=>Xg,toIntervalDayTimeObjects:()=>Jg,toIntervalMonthDayNanoInt32Array:()=>Zg,toIntervalMonthDayNanoObjects:()=>Qg});function Xg(e){var t,r;let n=e.length,i=new Int32Array(n*2);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.days)!==null&&t!==void 0?t:0,i[s++]=(r=a.milliseconds)!==null&&r!==void 0?r:0}return i}function Zg(e){var t,r;let n=e.length,i=new Int32Array(n*4);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.months)!==null&&t!==void 0?t:0,i[s++]=(r=a.days)!==null&&r!==void 0?r:0;let c=a.nanoseconds;if(c){let l=BigInt(c);i[s++]=Number(l&BigInt(4294967295))>>>0,i[s++]=Number(l>>BigInt(32))>>>0}else s+=2}return i}function Jg(e){let t=e.length,r=new Array(t/2);for(let n=0,i=0;n<t;n+=2)r[i++]={days:e[n],milliseconds:e[n+1]};return r}function Qg(e,t){let r=e.length,n=new Array(r/4);for(let i=0,o=0;i<r;i+=4){let s=BigInt(e[i+3])<<BigInt(32)|BigInt(e[i+2]>>>0);n[o++]={months:e[i],days:e[i+1],nanoseconds:t?`${s}`:s}}return n}var od=S(()=>{});function VT(e){let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r>>1]=Number.parseInt(e.slice(r,r+2),16);return t}function NO(e){return VT(e.join(""))}function GT(e,t){let r=new Uint8Array(e.length*16),n=new DataView(r.buffer);for(let[i,o]of e.entries()){let s=i*16,a=o.SIZE;if(n.setInt32(s,a,!0),o.INLINED!==void 0){let c=t(o.INLINED);for(let l=0;l<c.length&&l<12;l++)r[s+4+l]=c[l]}else{let c=o.PREFIX_HEX;for(let l=0;l<8&&l<c.length;l+=2)r[s+4+(l>>1)]=Number.parseInt(c.slice(l,l+2),16);n.setInt32(s+8,o.BUFFER_INDEX,!0),n.setInt32(s+12,o.OFFSET,!0)}}return r}function LO(e){return GT(e,t=>{let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r})}function FO(e){return GT(e,t=>new TextEncoder().encode(t))}var ic,sd,ad,kT=S(()=>{en();ze();At();gr();Ts();di();Kg();Kt();me();od();ic=class extends j{constructor(t,r,n,i,o=Tt.V5,s=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o,this.variadicBufferCounts=s}visit(t){return super.visit(t instanceof G?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return q({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitUtf8View(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinaryView(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitLargeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<Tt.V5&&this.readNullBitmap(t,n),t.mode===xt.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readVariadicBuffers(t){return Array.from({length:t},()=>this.readData(null))}nextVariadicBufferCount(){var t;return(t=this.variadicBufferCounts[++this.variadicBufferIndex])!==null&&t!==void 0?t:0}readDictionary(t){return this.dictionaries.get(t.id)}},sd=class extends ic{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):vs(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return ft(Uint8Array,ft(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return ft(Uint8Array,ft(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;if(B.isTimestamp(t))return ft(Uint8Array,Mi.convertArray(n[r]));if((B.isInt(t)||B.isTime(t))&&t.bitWidth===64||B.isDuration(t))return ft(Uint8Array,Mi.convertArray(n[r]));if(B.isDate(t)&&t.unit===It.MILLISECOND)return ft(Uint8Array,Mi.convertArray(n[r]));if(B.isDecimal(t))return ft(Uint8Array,ah.convertArray(n[r]));if(B.isBinary(t)||B.isLargeBinary(t)||B.isFixedSizeBinary(t))return NO(n[r]);if(B.isBinaryView(t))return LO(n[r]);if(B.isUtf8View(t))return FO(n[r]);if(B.isBool(t))return vs(n[r]);if(B.isUtf8(t)||B.isLargeUtf8(t))return Rr(n[r].join(""));if(B.isInterval(t))switch(t.unit){case gt.DAY_TIME:return Xg(n[r]);case gt.MONTH_DAY_NANO:return Zg(n[r]);default:break}return ft(Uint8Array,ft(t.ArrayType,n[r].map(i=>+i)))}readVariadicBuffers(t){let r=[];for(let n=0;n<t;n++){let{offset:i}=this.nextBufferRange(),o=this.sources[i];r.push(VT(o))}return r}};ad=class extends ic{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.bodyChunks=t}readData(t,r=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}}});var vi,cd=S(()=>{Pn();Ft();me();vi=class extends Ue{constructor(t){super(t),this._values=new yr(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,W(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}}});var Ti,ld=S(()=>{me();Pn();Ft();Ti=class extends Ue{constructor(t){super(t),this._values=new yr(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,W(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}}});var Cs,ey=S(()=>{Pn();Ft();Cs=class extends Ct{constructor(t){super(t),this._values=new ec}setValue(t,r){this._values.set(t,+r)}}});var Jn,Eo,Io,ry=S(()=>{Ft();Vr();Jn=class extends ce{};Jn.prototype._setValue=xg;Eo=class extends Jn{};Eo.prototype._setValue=vf;Io=class extends Jn{};Io.prototype._setValue=Tf});var Ao,ny=S(()=>{Ft();Vr();Ao=class extends ce{};Ao.prototype._setValue=Tg});var Ps,iy=S(()=>{At();Ft();ch();Ps=class extends Ct{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new se(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Bn({type:this.type.indices,nullValues:r}),this.dictionary=Bn({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}}});var Ro,oy=S(()=>{Ft();Vr();Ro=class extends ce{};Ro.prototype._setValue=Sg});var Os,sy=S(()=>{ze();Ft();At();Os=class extends Ct{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=this.stride;++o<s;)n.set(i+o,r[o])}setValid(t,r){return super.setValid(t,r)||this.children[0].setValid((t+1)*this.stride-1,!1),r}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new zt(this.type.listSize,new G(r,t.type,!0)),n}}});var Qn,Bs,Ns,Ls,ay=S(()=>{Zl();Ft();Qn=class extends ce{setValue(t,r){this._values.set(t,r)}},Bs=class extends Qn{setValue(t,r){super.setValue(t,Xl(r))}},Ns=class extends Qn{},Ls=class extends Qn{}});var Nn,Co,Po,Oo,cy=S(()=>{Ft();Vr();Nn=class extends ce{};Nn.prototype._setValue=Eg;Co=class extends Nn{};Co.prototype._setValue=Nf;Po=class extends Nn{};Po.prototype._setValue=Lf;Oo=class extends Nn{};Oo.prototype._setValue=Ff});var sn,Bo,No,Lo,Fo,ly=S(()=>{Ft();Vr();sn=class extends ce{};sn.prototype._setValue=Ig;Bo=class extends sn{};Bo.prototype._setValue=Df;No=class extends sn{};No.prototype._setValue=Uf;Lo=class extends sn{};Lo.prototype._setValue=zf;Fo=class extends sn{};Fo.prototype._setValue=Vf});var Ze,Fs,Ds,Us,zs,Vs,Gs,ks,qs,hy=S(()=>{Ft();Ze=class extends ce{setValue(t,r){this._values.set(t,r)}},Fs=class extends Ze{},Ds=class extends Ze{},Us=class extends Ze{},zs=class extends Ze{},Vs=class extends Ze{},Gs=class extends Ze{},ks=class extends Ze{},qs=class extends Ze{}});var js,uy=S(()=>{ze();At();Pn();Ft();js=class extends Ue{constructor(t){super(t),this._offsets=new xo(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new oe(new G(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var Ws,fy=S(()=>{ze();At();Pn();$n();Ft();Ws=class extends Ue{constructor(t){super(t),this._offsets=new xo(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("LargeListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ur(new G(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,BigInt(0));else{let s=o,a=s.length,c=dt(r.set(i,BigInt(a)).buffer[i]);for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var Hs,dy=S(()=>{ze();At();Ft();Hs=class extends Ue{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Fe(new G(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}}});var $s,my=S(()=>{Ft();$s=class extends Ct{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}}});var Ys,py=S(()=>{ze();Ft();At();Ys=class extends Ct{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new vt([...this.type.children,new G(r,t.type,!0)]),n}}});var an,Do,Uo,zo,Vo,gy=S(()=>{Ft();Vr();an=class extends ce{};an.prototype._setValue=Mg;Do=class extends an{};Do.prototype._setValue=Ef;Uo=class extends an{};Uo.prototype._setValue=If;zo=class extends an{};zo.prototype._setValue=Af;Vo=class extends an{};Vo.prototype._setValue=Rf});var cn,Go,ko,qo,jo,yy=S(()=>{Ft();Vr();cn=class extends ce{};cn.prototype._setValue=vg;Go=class extends cn{};Go.prototype._setValue=Cf;ko=class extends cn{};ko.prototype._setValue=Pf;qo=class extends cn{};qo.prototype._setValue=Of;jo=class extends cn{};jo.prototype._setValue=Bf});var Ei,Ks,Xs,_y=S(()=>{ze();Pn();Ft();At();Ei=class extends Ct{constructor(t){super(t),this._typeIds=new bi(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r),this.length=Math.max(t+1,this.length)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new G(r,t.type)];return this.type=new Xe(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Ks=class extends Ei{},Xs=class extends Ei{constructor(t){super(t),this._offsets=new bi(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r),this.length=Math.max(t+1,this.length)}}});var Wo,wy=S(()=>{di();cd();Pn();Ft();Wo=class extends Ue{constructor(t){super(t),this._values=new yr(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Rr(r))}_flushPending(t,r){}};Wo.prototype._flushPending=vi.prototype._flushPending});var Ho,by=S(()=>{di();Pn();Ft();ld();Ho=class extends Ue{constructor(t){super(t),this._values=new yr(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Rr(r))}_flushPending(t,r){}};Ho.prototype._flushPending=Ti.prototype._flushPending});var Ii,hd=S(()=>{At();Ft();Pn();me();en();Ii=class extends Ct{constructor(t){super(t),this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._bufferSize=32*1024*1024,this._views=new yr(Uint8Array)}get byteLength(){let t=0;this._views&&(t+=this._views.byteLength),this._nulls&&(t+=this._nulls.byteLength);for(let r of this._variadicBuffers)t+=r.byteLength;return this._currentBuffer&&(t+=this._currentBuffer.byteLength),t}setValue(t,r){return this.writeBinaryValue(t,this.encodeValue(r))}writeBinaryValue(t,r){let n=r.length,i=(t+1)*lt.ELEMENT_WIDTH,o=this._views.length;i>o&&this._views.reserve(i-o);let s=this._views.buffer,a=t*lt.ELEMENT_WIDTH,c=new DataView(s.buffer,s.byteOffset+a,lt.ELEMENT_WIDTH);if(c.setInt32(lt.LENGTH_OFFSET,n,!0),n<=lt.INLINE_CAPACITY){s.set(r,a+lt.INLINE_OFFSET);for(let l=n;l<lt.INLINE_CAPACITY;l++)s[a+lt.INLINE_OFFSET+l]=0}else{let l=new DataView(r.buffer,r.byteOffset,Math.min(4,n));c.setUint32(lt.INLINE_OFFSET,l.getUint32(0,!0),!0),(!this._currentBuffer||this._currentBufferOffset+n>this._bufferSize)&&(this._currentBuffer&&this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=new yr(Uint8Array),this._currentBufferIndex=this._variadicBuffers.length,this._currentBufferOffset=0),this._currentBuffer.reserve(n).buffer.set(r,this._currentBufferOffset),c.setInt32(lt.BUFFER_INDEX_OFFSET,this._currentBufferIndex,!0),c.setInt32(lt.BUFFER_OFFSET_OFFSET,this._currentBufferOffset,!0),this._currentBufferOffset+=n}return this}encodeValue(t){return W(t)}setValid(t,r){let n=(t+1)*lt.ELEMENT_WIDTH,i=this._views.length;n>i&&this._views.reserve(n-i);let o=super.setValid(t,r);if(!o){let s=this._views.buffer,a=t*lt.ELEMENT_WIDTH;for(let c=0;c<lt.ELEMENT_WIDTH;c++)s[a+c]=0}return o}clear(){return this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._views.clear(),super.clear()}flush(){let{type:t,length:r,nullCount:n,_views:i,_nulls:o}=this;this._currentBuffer&&this._currentBufferOffset>0&&(this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=null,this._currentBufferOffset=0);let s=i.flush(r*lt.ELEMENT_WIDTH),a=n>0?o.flush(r):void 0,c=this._variadicBuffers.slice();return this._variadicBuffers=[],this._currentBufferIndex=0,this.clear(),q({type:t,length:r,nullCount:n,nullBitmap:a,views:s,variadicBuffers:c})}finish(){return this.finished=!0,this}}});var Zs,Sy=S(()=>{hd();di();Zs=class extends Ii{constructor(t){super(t)}setValue(t,r){return this.writeBinaryValue(t,Rr(r))}}});var xy,qT,jT=S(()=>{gr();cd();ld();ey();ry();ny();iy();oy();sy();ay();cy();ly();hy();uy();fy();dy();my();py();gy();yy();_y();wy();by();hd();Sy();xy=class extends j{visitNull(){return $s}visitBool(){return Cs}visitInt(){return Ze}visitInt8(){return Fs}visitInt16(){return Ds}visitInt32(){return Us}visitInt64(){return zs}visitUint8(){return Vs}visitUint16(){return Gs}visitUint32(){return ks}visitUint64(){return qs}visitFloat(){return Qn}visitFloat16(){return Bs}visitFloat32(){return Ns}visitFloat64(){return Ls}visitUtf8(){return Wo}visitLargeUtf8(){return Ho}visitBinary(){return vi}visitLargeBinary(){return Ti}visitFixedSizeBinary(){return Ro}visitDate(){return Jn}visitDateDay(){return Eo}visitDateMillisecond(){return Io}visitTimestamp(){return an}visitTimestampSecond(){return Do}visitTimestampMillisecond(){return Uo}visitTimestampMicrosecond(){return zo}visitTimestampNanosecond(){return Vo}visitTime(){return cn}visitTimeSecond(){return Go}visitTimeMillisecond(){return ko}visitTimeMicrosecond(){return qo}visitTimeNanosecond(){return jo}visitDecimal(){return Ao}visitList(){return js}visitLargeList(){return Ws}visitStruct(){return Ys}visitUnion(){return Ei}visitDenseUnion(){return Xs}visitSparseUnion(){return Ks}visitDictionary(){return Ps}visitInterval(){return Nn}visitIntervalDayTime(){return Co}visitIntervalYearMonth(){return Po}visitIntervalMonthDayNano(){return Oo}visitDuration(){return sn}visitDurationSecond(){return Bo}visitDurationMillisecond(){return No}visitDurationMicrosecond(){return Lo}visitDurationNanosecond(){return Fo}visitFixedSizeList(){return Os}visitMap(){return Hs}visitBinaryView(){return Ii}visitUtf8View(){return Zs}},qT=new xy});function Je(e,t){return t instanceof e.constructor}function Ai(e,t){return e===t||Je(e,t)}function Ri(e,t){return e===t||Je(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function ud(e,t){return e===t||Je(e,t)&&e.precision===t.precision}function DO(e,t){return e===t||Je(e,t)&&e.byteWidth===t.byteWidth}function My(e,t){return e===t||Je(e,t)&&e.unit===t.unit}function lh(e,t){return e===t||Je(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function hh(e,t){return e===t||Je(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function WT(e,t){return e===t||Je(e,t)&&e.children.length===t.children.length&&ti.compareManyFields(e.children,t.children)}function UO(e,t){return e===t||Je(e,t)&&e.children.length===t.children.length&&ti.compareManyFields(e.children,t.children)}function vy(e,t){return e===t||Je(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&ti.compareManyFields(e.children,t.children)}function zO(e,t){return e===t||Je(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&ti.visit(e.indices,t.indices)&&ti.visit(e.dictionary,t.dictionary)}function fd(e,t){return e===t||Je(e,t)&&e.unit===t.unit}function uh(e,t){return e===t||Je(e,t)&&e.unit===t.unit}function VO(e,t){return e===t||Je(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&ti.compareManyFields(e.children,t.children)}function GO(e,t){return e===t||Je(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&ti.compareManyFields(e.children,t.children)}function Js(e,t){return ti.compareSchemas(e,t)}function HT(e,t){return ti.compareFields(e,t)}function dd(e,t){return ti.visit(e,t)}var K,ti,fh=S(()=>{gr();K=class extends j{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};K.prototype.visitNull=Ai;K.prototype.visitBool=Ai;K.prototype.visitInt=Ri;K.prototype.visitInt8=Ri;K.prototype.visitInt16=Ri;K.prototype.visitInt32=Ri;K.prototype.visitInt64=Ri;K.prototype.visitUint8=Ri;K.prototype.visitUint16=Ri;K.prototype.visitUint32=Ri;K.prototype.visitUint64=Ri;K.prototype.visitFloat=ud;K.prototype.visitFloat16=ud;K.prototype.visitFloat32=ud;K.prototype.visitFloat64=ud;K.prototype.visitUtf8=Ai;K.prototype.visitLargeUtf8=Ai;K.prototype.visitUtf8View=Ai;K.prototype.visitBinary=Ai;K.prototype.visitLargeBinary=Ai;K.prototype.visitBinaryView=Ai;K.prototype.visitFixedSizeBinary=DO;K.prototype.visitDate=My;K.prototype.visitDateDay=My;K.prototype.visitDateMillisecond=My;K.prototype.visitTimestamp=lh;K.prototype.visitTimestampSecond=lh;K.prototype.visitTimestampMillisecond=lh;K.prototype.visitTimestampMicrosecond=lh;K.prototype.visitTimestampNanosecond=lh;K.prototype.visitTime=hh;K.prototype.visitTimeSecond=hh;K.prototype.visitTimeMillisecond=hh;K.prototype.visitTimeMicrosecond=hh;K.prototype.visitTimeNanosecond=hh;K.prototype.visitDecimal=Ai;K.prototype.visitList=WT;K.prototype.visitLargeList=WT;K.prototype.visitStruct=UO;K.prototype.visitUnion=vy;K.prototype.visitDenseUnion=vy;K.prototype.visitSparseUnion=vy;K.prototype.visitDictionary=zO;K.prototype.visitInterval=fd;K.prototype.visitIntervalDayTime=fd;K.prototype.visitIntervalYearMonth=fd;K.prototype.visitIntervalMonthDayNano=fd;K.prototype.visitDuration=uh;K.prototype.visitDurationSecond=uh;K.prototype.visitDurationMillisecond=uh;K.prototype.visitDurationMicrosecond=uh;K.prototype.visitDurationNanosecond=uh;K.prototype.visitFixedSizeList=VO;K.prototype.visitMap=GO;ti=new K});function Bn(e){let t=e.type,r=new(qT.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?((s,a)=>n[a]||i):(({name:s})=>n[s]||i);for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(Bn(Object.assign(Object.assign({},l),{type:c})))}}return r}function oc(e,t){if(e instanceof Q||e instanceof U||e.type instanceof B||ArrayBuffer.isView(e))return Zn(e);let r={type:t??md(e),nullValues:[null]},n=[...pd(r)(e)],i=n.length===1?n[0]:n.reduce((o,s)=>o.concat(s));return B.isDictionary(i.type)?i.memoize():i}function Ty(e){let t=oc(e),r=new Et(new ct(t.type.children),t.data[0]);return new Ot(r)}function md(e){if(e.length===0)return new Qt;let t=0,r=0,n=0,i=0,o=0,s=0,a=0,c=0;for(let l of e){if(l==null){++t;continue}switch(typeof l){case"bigint":++s;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++o;continue;case"object":Array.isArray(l)?++r:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(i+t===e.length)return new Dr;if(o+t===e.length)return new se(new Be,new re);if(s+t===e.length)return new Nr;if(a+t===e.length)return new Ne;if(c+t===e.length)return new Yn;if(r+t===e.length){let l=e,h=md(l[l.findIndex(u=>u!=null)]);if(l.every(u=>u==null||dd(h,md(u))))return new oe(new G("",h,!0))}else if(n+t===e.length){let l=new Map;for(let h of e)for(let u of Object.keys(h))!l.has(u)&&h[u]!=null&&l.set(u,new G(u,md([h[u]]),!0));return new vt([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function pd(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function*(i){let o=0,s=Bn(e);for(let a of i)s.append(a)[n]>=r&&++o&&(yield s.toVector());(s.finish().length>0||o===0)&&(yield s.toVector())}}function Ey(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function(i){return qe(this,arguments,function*(){var o,s,a,c;let l=0,h=Bn(e);try{for(var u=!0,f=Ar(i),d;d=yield st(f.next()),o=d.done,!o;u=!0){c=d.value,u=!1;let m=c;h.append(m)[n]>=r&&++l&&(yield yield st(h.toVector()))}}catch(m){s={error:m}}finally{try{!u&&!o&&(a=f.return)&&(yield st(a.call(f)))}finally{if(s)throw s.error}}(h.finish().length>0||l===0)&&(yield yield st(h.toVector()))})}}var ch=S(()=>{ur();ze();At();en();De();jT();Qs();Ci();fh()});function gd(e,t){return kO(e,t.map(r=>r.data.concat()))}function kO(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((u,f)=>Math.max(u,f.length),0)},o=0,s=0,a=-1,c=t.length,l,h=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)h[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(h=qO(r,s,h,t,i),s>0&&(n[o++]=q({type:new vt(r),length:s,nullCount:0,children:h.slice()})))}return[e=e.assign(r),n.map(u=>new Et(e,u))]}function qO(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],h=l?.length;if(h>=t)h===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,h-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:q({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var $T=S(()=>{en();At();Ci()});function Iy(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=Zn(i);return new Ot(t)}function Ay(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=oc(i);return new Ot(t)}var YT,KT,Ot,Qs=S(()=>{Kt();en();ch();De();ze();At();fh();$T();Xf();Ss();Vr();Zf();Jf();Za();Ci();KT=Symbol.for("apache-arrow/Table"),Ot=class e{static isTable(t){return t?.[KT]===!0}constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new ct([]),this._offsets=[0],this;let i,o;t[0]instanceof ct&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Et)return[c];if(c instanceof e)return c.batches;if(c instanceof Q){if(c.type instanceof vt)return[new Et(new ct(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),h=l.map(d=>new U([c[d]])),u=i??new ct(l.map((d,m)=>new G(String(d),h[m].type,h[m].nullable))),[,f]=gd(u,h);return f.length===0?[new Et(c)]:f}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new ct([]),!(i instanceof ct))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Et))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Js(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Hf(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Wf(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(xs(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?tc.visit(new U(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
16
- ${this.toArray().join(`,
17
- `)}
18
- ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new Et(r,i)))}slice(t,r){let n=this.schema;[t,r]=Ql({length:this.numRows},t,r);let i=$f(this.data,this._offsets,t,r);return new e(n,i.map(o=>new Et(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=q({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new U(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new U([q({type:new Qt,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=gd(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[h,u]=a,f=r.findIndex(d=>d.name===c.name);return~f?u[f]=l:h.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...gd(o,s))}};YT=Symbol.toStringTag;Ot[YT]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[KT]=!0,e.isValid=Qa(rh),e.get=Qa(ae.getVisitFn(b.Struct)),e.set=Yf(Te.getVisitFn(b.Struct)),e.indexOf=Kf(Es.getVisitFn(b.Struct)),"Table"))(Ot.prototype);Object.defineProperty(Ot,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Ot&&Ot.isTable(t)}})});function XT(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:q({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),q({type:new vt(i),length:r,children:o})]}function QT(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])QT(a.children,l?.children,r);if(B.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var ZT,JT,Et,ta,Ci=S(()=>{en();Qs();De();ze();At();Za();Ss();Vr();Zf();Jf();JT=Symbol.for("apache-arrow/RecordBatch"),Et=class e{static isRecordBatch(t){return t?.[JT]===!0}constructor(...t){switch(t.length){case 3:case 2:{if([this.schema]=t,!(this.schema instanceof ct))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=q({nullCount:0,type:new vt(this.schema.fields),children:this.schema.fields.map(r=>q({type:r.type,nullCount:0}))}),this._metadata=new Map]=t,!(this.data instanceof Q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=XT(this.schema,this.data.children,this.data.length);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,h)=>(c.children[h]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[h]=G.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new ct(n),a=q({type:new vt(n),length:o,children:i,nullCount:0});[this.schema,this.data]=XT(s,a.children,o),this._metadata=new Map;break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||(this._dictionaries=QT(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return ae.visit(this.data,t)}at(t){return this.get(xs(t,this.numRows))}set(t,r){return Te.visit(this.data,t,r)}indexOf(t,r){return Es.visit(this.data,t,r)}[Symbol.iterator](){return tc.visit(new U([this.data]))}toArray(){return[...this]}concat(...t){return new Ot(this.schema,[this,...t])}slice(t,r){let[n]=new U([this.data]).slice(t,r).data;return new e(this.schema,n,this._metadata)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new U([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new U([q({type:new Qt,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new ct(o,new Map(this.schema.metadata)),i=q({type:new vt(o),length:i.length,children:s})}return new e(n,i,this._metadata)}select(t){let r=this.schema.select(t),n=new vt(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,q({type:n,length:this.numRows,children:i}),this._metadata)}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=q({type:new vt(r.fields),length:this.numRows,children:n});return new e(r,i,this._metadata)}};ZT=Symbol.toStringTag;Et[ZT]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[JT]=!0,"RecordBatch"))(Et.prototype);Object.defineProperty(Et,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Et&&Et.isRecordBatch(t)}});ta=class extends Et{constructor(t,r){let n=t.fields.map(o=>q({type:o.type})),i=q({type:new vt(t.fields),length:0,nullCount:0,children:n});super(t,i,r||new Map)}}});function _d(e,t=0){for(let r=-1,n=sc.length;++r<n;)if(sc[r]!==e[t+r])return!1;return!0}var Cy,Py,tE,eE,$o,ea,ra,yd,Ry,sc,ac,Oy,rE,wd=S(()=>{ur();Kt();_t();Mo();Zi();Hg();me();vo();ih();Cy=e=>`Expected ${mt[e]} Message in stream, but was null or length 0.`,Py=e=>`Header pointer of flatbuffer-encoded ${mt[e]} Message is null or length 0.`,tE=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,eE=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,$o=class{constructor(t){this.source=t instanceof on?t:new on(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Dt:t.value===-1&&(t=this.readMetadataLength()).done?Dt:(t=this.readMetadata(t.value)).done?Dt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Cy(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=W(this.source.read(t));if(r.byteLength<t)throw new Error(eE(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=mt.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(Py(r));return i}readMetadataLength(){let t=this.source.read(yd),r=t&&new Se(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return Dt;if(r.byteLength<t)throw new Error(tE(t,r.byteLength));return{done:!1,value:Ge.decode(r)}}},ea=class{constructor(t,r){this.source=t instanceof _r?t:cf(t)?new To(t,r):new _r(t)}[Symbol.asyncIterator](){return this}next(){return V(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Dt:t.value===-1&&(t=yield this.readMetadataLength()).done?Dt:(t=yield this.readMetadata(t.value)).done?Dt:t})}throw(t){return V(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return V(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return V(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Cy(t));return r.value})}readMessageBody(t){return V(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=W(yield this.source.read(t));if(r.byteLength<t)throw new Error(eE(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return V(this,arguments,void 0,function*(t=!1){let r=mt.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(Py(r));return i})}readMetadataLength(){return V(this,void 0,void 0,function*(){let t=yield this.source.read(yd),r=t&&new Se(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return V(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return Dt;if(r.byteLength<t)throw new Error(tE(t,r.byteLength));return{done:!1,value:Ge.decode(r)}})}},ra=class extends $o{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof nh?t:new nh(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Ge.fromJSON(t.schema,mt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Ge.fromJSON(r,mt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Ge.fromJSON(r,mt.RecordBatch)}}return this._body=[],Dt}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...o.VIEWS&&[o.VIEWS]||[],...o.VARIADIC_DATA_BUFFERS||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Cy(t));return r.value}readSchema(){let t=mt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(Py(t));return n}},yd=4,Ry="ARROW1",sc=new Uint8Array(Ry.length);for(let e=0;e<Ry.length;e+=1)sc[e]=Ry.codePointAt(e);ac=sc.length,Oy=ac+yd,rE=ac*2+yd});var By,Ny,nE,iE=S(()=>{Ua();By=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)&&this._hasValidVersion(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.LZ4_FRAME_MAGIC.every((r,n)=>t[n]===r)}_hasValidVersion(t){return(t[4]&192)>>6===1}},Ny=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.ZSTD_MAGIC.every((r,n)=>t[n]===r)}},nE={[xe.LZ4_FRAME]:new By,[xe.ZSTD]:new Ny}});var Ly,Yo,bd=S(()=>{Ua();iE();Ly=class{constructor(){this.registry={}}set(t,r){if(r?.encode&&typeof r.encode=="function"&&!nE[t].isValidCodecEncode(r))throw new Error(`Encoder for ${xe[t]} is not valid.`);this.registry[t]=r}get(t){var r;return((r=this.registry)===null||r===void 0?void 0:r[t])||null}},Yo=new Ly});function cE(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*oE(e){let t=Qe.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function sE(e){return qe(this,arguments,function*(){let r=yield st(Qe.from(e));try{if(!(yield st(r.open({autoDestroy:!1}))).closed)do yield yield st(r);while(!(yield st(r.reset().open())).closed)}finally{yield st(r.cancel())}})}function WO(e){return new Ln(new Dy(e))}function HO(e){let t=e.peek(ac+7&-8);return t&&t.byteLength>=4?_d(t)?new Oi(new xd(e.read())):new Ln(new lc(e)):new Ln(new lc((function*(){})()))}function $O(e){return V(this,void 0,void 0,function*(){let t=yield e.peek(ac+7&-8);return t&&t.byteLength>=4?_d(t)?new Oi(new xd(yield e.read())):new Pi(new hc(e)):new Pi(new hc((function(){return qe(this,arguments,function*(){})})()))})}function YO(e){return V(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new To(e,t);return t>=rE&&_d(yield r.readAt(0,ac+7&-8))?new cc(new Fy(r)):new Pi(new hc(r))})}var Qe,Ln,Pi,Oi,cc,Sd,lc,hc,xd,Fy,Dy,dh=S(()=>{ur();en();De();At();Kt();kg();Al();Mo();vo();Hg();kT();Ci();ih();wd();Zi();bd();$n();_t();Qe=class e extends Rs{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Cr(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return be.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return be.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:sf(t)?WO(t):cf(t)?YO(t):Cr(t)?V(this,void 0,void 0,function*(){return yield e.from(yield t)}):lf(t)||Tl(t)||uf(t)||Jr(t)?$O(new _r(t)):HO(new on(t))}static readAll(t){return t instanceof e?t.isSync()?oE(t):sE(t):sf(t)||ArrayBuffer.isView(t)||wn(t)||af(t)?oE(t):sE(t)}},Ln=class extends Qe{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return qe(this,arguments,function*(){yield st(yield*La(Ar(this[Symbol.iterator]())))})}},Pi=class extends Qe{constructor(t){super(t),this._impl=t}readAll(){return V(this,void 0,void 0,function*(){var t,r,n,i;let o=new Array;try{for(var s=!0,a=Ar(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Oi=class extends Ln{constructor(t){super(t),this._impl=t}},cc=class extends Pi{constructor(t){super(t),this._impl=t}},Sd=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r,n){let i;if(t.compression!=null){let s=Yo.get(t.compression.type);if(s?.decode&&typeof s.decode=="function"){let{decommpressedBody:a,buffers:c}=this._decompressBuffers(t,r,s);i=this._loadCompressedVectors(t,a,this.schema.fields),t=new le(t.length,t.nodes,c,null)}else throw new Error("Record batch is compressed but codec not found")}else i=this._loadVectors(t,r,this.schema.fields);let o=q({type:new vt(this.schema.fields),length:t.length,children:i});return new Et(this.schema,o,n)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l;if(t.data.compression!=null){let h=Yo.get(t.data.compression.type);if(h?.decode&&typeof h.decode=="function"){let{decommpressedBody:u,buffers:f}=this._decompressBuffers(t.data,r,h);l=this._loadCompressedVectors(t.data,u,[c]),t=new Ve(new le(t.data.length,t.data.nodes,f,null,t.data.variadicBufferCounts),n,i)}else throw new Error("Dictionary batch is compressed but codec not found")}else l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new U(l)):new U(l)).memoize()}_loadVectors(t,r,n){return new ic(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(t,r,n){return new ad(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_decompressBuffers(t,r,n){let i=[],o=[],s=0;for(let{offset:a,length:c}of t.buffers){if(c===0){i.push(new Uint8Array(0)),o.push(new te(s,0));continue}let l=new Se(r.subarray(a,a+c)),h=dt(l.readInt64(0)),u=l.bytes().subarray(8),f=h===-1?u:n.decode(u);i.push(f);let d=(s+7&-8)-s;s+=d,o.push(new te(s,f.length)),s+=f.length}return{decommpressedBody:i,buffers:o}}},lc=class extends Sd{constructor(t,r){super(r),this._reader=sf(t)?new ra(this._handle=t):new $o(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=cE(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Dt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Dt}next(){if(this.closed)return Dt;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new ta(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},hc=class extends Sd{constructor(t,r){super(r),this._reader=new ea(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return V(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return V(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=cE(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return V(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Dt})}return(t){return V(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Dt})}next(){return V(this,void 0,void 0,function*(){if(this.closed)return Dt;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new ta(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return V(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},xd=class extends lc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof oh?t:new oh(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(mt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(mt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-Oy,n=t.readInt32(r),i=t.readAt(r-n,n);return Si.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},Fy=class extends hc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof To?t:new To(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return V(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return V(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(mt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null})}_readDictionaryBatch(t){return V(this,void 0,void 0,function*(){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(mt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return V(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-Oy,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return Si.decode(i)})}_readNextMessageAndValidate(t){return V(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},Dy=class extends lc{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new sd(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}}});function qr(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new te(this._byteLength,t)),this._byteLength+=t,this}function KO(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(qr.call(this,i),r.mode===xt.Sparse)return Uy.call(this,e);if(r.mode===xt.Dense){if(e.offset<=0)return qr.call(this,o),Uy.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,h,u=-1;++u<n;)(l=i[u])!==void 0&&((h=a[l])===void 0&&(h=a[l]=o[u]),s[u]=o[u]-h,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);qr.call(this,s),this.visitMany(e.children.map((l,h)=>{let u=r.typeIds[h],f=a[u],d=c[u];return l.slice(f,Math.min(n,d))}))}}return this}function XO(e){let t;return e.nullCount>=e.length?qr.call(this,new Uint8Array(e.length+7>>3)):(t=e.values)instanceof Uint8Array?qr.call(this,Ms(e.offset,e.length,t)):qr.call(this,vs(e.values))}function Bi(e){return qr.call(this,e.values.subarray(0,e.length*e.stride))}function Md(e){let{length:t,values:r,valueOffsets:n}=e,i=dt(n[0]),o=dt(n[t]),s=Math.min(o-i,r.byteLength-i);return qr.call(this,ff(-i,t+1,n)),qr.call(this,r.subarray(i,i+s)),this}function lE(e){let{offset:t,length:r,stride:n,values:i,variadicBuffers:o=[]}=e;if(!i)throw new Error("BinaryView data is missing view buffer");let s=t*n,a=s+r*n;qr.call(this,i.subarray(s,a));for(let c of o)qr.call(this,c);return this._variadicBufferCounts.push(o.length),this}function vd(e){let{length:t,valueOffsets:r}=e;if(r){let n=dt(r[0]),i=dt(r[t]);return qr.call(this,ff(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function Uy(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}var Ut,hE=S(()=>{De();gr();Kt();Ci();me();Ts();Mo();At();$n();Ut=class e extends j{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof Et?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[],this._variadicBufferCounts=[]}visit(t){if(t instanceof U)return this.visitMany(t.data),this;let{type:r}=t;if(!B.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(B.isUnion(r))this.nodes.push(new rn(n,0));else{let{nullCount:i}=t;B.isNull(r)||qr.call(this,i<=0?new Uint8Array(0):Ms(t.offset,n,t.nullBitmap)),this.nodes.push(new rn(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}get variadicBufferCounts(){return this._variadicBufferCounts}};Ut.prototype.visitBool=XO;Ut.prototype.visitInt=Bi;Ut.prototype.visitFloat=Bi;Ut.prototype.visitUtf8=Md;Ut.prototype.visitLargeUtf8=Md;Ut.prototype.visitUtf8View=lE;Ut.prototype.visitBinary=Md;Ut.prototype.visitLargeBinary=Md;Ut.prototype.visitBinaryView=lE;Ut.prototype.visitFixedSizeBinary=Bi;Ut.prototype.visitDate=Bi;Ut.prototype.visitTimestamp=Bi;Ut.prototype.visitTime=Bi;Ut.prototype.visitDecimal=Bi;Ut.prototype.visitList=vd;Ut.prototype.visitLargeList=vd;Ut.prototype.visitStruct=Uy;Ut.prototype.visitUnion=KO;Ut.prototype.visitInterval=Bi;Ut.prototype.visitDuration=Bi;Ut.prototype.visitFixedSizeList=vd;Ut.prototype.visitMap=vd});var Td,uE=S(()=>{gr();bf();Kt();Td=class extends j{visit(t){return t==null?void 0:super.visit(t)}visitNull({typeId:t}){return{name:Z[t].toLowerCase()}}visitInt({typeId:t,bitWidth:r,isSigned:n}){return{name:Z[t].toLowerCase(),bitWidth:r,isSigned:n}}visitFloat({typeId:t,precision:r}){return{name:Z[t].toLowerCase(),precision:wt[r]}}visitBinary({typeId:t}){return{name:Z[t].toLowerCase()}}visitLargeBinary({typeId:t}){return{name:Z[t].toLowerCase()}}visitBinaryView({typeId:t}){return{name:Z[t].toLowerCase()}}visitBool({typeId:t}){return{name:Z[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:Z[t].toLowerCase()}}visitLargeUtf8({typeId:t}){return{name:Z[t].toLowerCase()}}visitUtf8View({typeId:t}){return{name:Z[t].toLowerCase()}}visitDecimal({typeId:t,scale:r,precision:n,bitWidth:i}){return{name:Z[t].toLowerCase(),scale:r,precision:n,bitWidth:i}}visitDate({typeId:t,unit:r}){return{name:Z[t].toLowerCase(),unit:It[r]}}visitTime({typeId:t,unit:r,bitWidth:n}){return{name:Z[t].toLowerCase(),unit:L[r],bitWidth:n}}visitTimestamp({typeId:t,timezone:r,unit:n}){return{name:Z[t].toLowerCase(),unit:L[n],timezone:r}}visitInterval({typeId:t,unit:r}){return{name:Z[t].toLowerCase(),unit:gt[r]}}visitDuration({typeId:t,unit:r}){return{name:Z[t].toLocaleLowerCase(),unit:L[r]}}visitList({typeId:t}){return{name:Z[t].toLowerCase()}}visitLargeList({typeId:t}){return{name:Z[t].toLowerCase()}}visitStruct({typeId:t}){return{name:Z[t].toLowerCase()}}visitUnion({typeId:t,mode:r,typeIds:n}){return{name:Z[t].toLowerCase(),mode:xt[r].toUpperCase(),typeIds:[...n]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:r}){return{name:Z[t].toLowerCase(),byteWidth:r}}visitFixedSizeList({typeId:t,listSize:r}){return{name:Z[t].toLowerCase(),listSize:r}}visitMap({typeId:t,keysSorted:r}){return{name:Z[t].toLowerCase(),keysSorted:r}}}});function*zy(e){for(let t of e)yield t.reduce((r,n)=>`${r}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Ni(e,t){let r=new Uint32Array(e.buffer,e.byteOffset,e.byteLength/Uint32Array.BYTES_PER_ELEMENT);for(let n=-1,i=r.length/t;++n<i;)yield`${bs.new(r.subarray((n+0)*t,(n+1)*t),!1)}`}function fE(e,t){let n=e.values,i=new DataView(n.buffer,n.byteOffset,n.byteLength),o=n.byteLength/16,s=f=>Array.from(f).map(d=>("0"+(d&255).toString(16)).slice(-2)).join("").toUpperCase(),a=Array.from({length:o},(f,d)=>{let m=d*16,p=i.getInt32(m,!0);return[m,p]}).map(([f,d])=>d>12?{SIZE:d,PREFIX_HEX:s(n.subarray(f+4,f+8)),BUFFER_INDEX:i.getInt32(f+8,!0),OFFSET:i.getInt32(f+12,!0)}:{SIZE:d,INLINED:t(n.subarray(f+4,f+4+d))}),c=[...new Set(a.map(f=>f.BUFFER_INDEX).filter(f=>f!==void 0))],l=c.map(f=>s(e.variadicBuffers[f])),h=new Map(c.map((f,d)=>[f,d]));return{VIEWS:a.map(f=>f.BUFFER_INDEX!==void 0?Object.assign(Object.assign({},f),{BUFFER_INDEX:h.get(f.BUFFER_INDEX)}):f),VARIADIC_DATA_BUFFERS:l}}var mh,dE=S(()=>{xf();De();gr();Kt();Kt();Ts();od();At();mh=class e extends j{static assemble(...t){let r=new e;return t.map(({schema:n,data:i})=>r.visitMany(n.fields,i.children))}visit({name:t},r){let{length:n}=r,{offset:i,nullCount:o,nullBitmap:s}=r,a=B.isDictionary(r.type)?r.type.indices:r.type,c=Object.assign([],r.buffers,{[kt.VALIDITY]:void 0});return Object.assign({name:t,count:n,VALIDITY:B.isNull(a)||B.isUnion(a)?void 0:o<=0?Array.from({length:n},()=>1):[...new Xn(s,i,n,null,jf)]},super.visit(r.clone(a,i,n,0,c)))}visitNull(){return{}}visitBool({values:t,offset:r,length:n}){return{DATA:[...new Xn(t,r,n,null,Ja)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...Ni(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new U([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new U([t])],OFFSET:[...Ni(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...zy(new U([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...zy(new U([t]))],OFFSET:[...Ni(t.valueOffsets,2)]}}visitBinaryView(t){return fE(t,r=>Array.from(r).map(n=>("0"+(n&255).toString(16)).slice(-2)).join("").toUpperCase())}visitUtf8View(t){return fE(t,r=>Array.from(r).map(n=>String.fromCodePoint(n)).join(""))}visitFixedSizeBinary(t){return{DATA:[...zy(new U([t]))]}}visitDate(t){return{DATA:t.type.unit===It.DAY?[...t.values]:[...Ni(t.values,2)]}}visitTimestamp(t){return{DATA:[...Ni(t.values,2)]}}visitTime(t){return{DATA:t.type.unit<L.MICROSECOND?[...t.values]:[...Ni(t.values,2)]}}visitDecimal(t){return{DATA:[...Ni(t.values,4)]}}visitList(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}visitLargeList(t){return{OFFSET:[...Ni(t.valueOffsets,2)],children:this.visitMany(t.type.children,t.children)}}visitStruct(t){return{children:this.visitMany(t.type.children,t.children)}}visitUnion(t){return{TYPE_ID:[...t.typeIds],OFFSET:t.type.mode===xt.Dense?[...t.valueOffsets]:void 0,children:this.visitMany(t.type.children,t.children)}}visitInterval(t){switch(t.type.unit){case gt.YEAR_MONTH:return{DATA:[...t.values]};case gt.DAY_TIME:return{DATA:Jg(t.values)};case gt.MONTH_DAY_NANO:return{DATA:Qg(t.values,!0)}}}visitDuration(t){return{DATA:[...Ni(t.values,2)]}}visitFixedSizeList(t){return{children:this.visitMany(t.type.children,t.children)}}visitMap(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}}});function Vy(e,t){let r=t;t instanceof Ot&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function Gy(e,t){return V(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=Ar(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function mE({name:e,type:t,nullable:r}){let n=new Td;return{name:e,nullable:r,type:n.visit(t),children:(t.children||[]).map(i=>mE(i)),dictionary:B.isDictionary(t)?{id:t.id,isOrdered:t.isOrdered,indexType:n.visit(t.indices)}:void 0}}function ZO(e,t,r=!1){let[n]=mh.assemble(new Et({[t]:e}));return JSON.stringify({id:t,isDelta:r,data:{count:e.length,columns:n}},null,2)}function JO(e){let[t]=mh.assemble(e);return JSON.stringify({count:e.numRows,columns:t},null,2)}var ei,Li,Fi,ph,Ed=S(()=>{ur();Qs();wd();De();At();Mo();Mo();kg();Kt();fh();vo();hE();uE();dE();me();Ci();ih();Zi();Ua();bd();_t();ei=class extends Rs{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new nn,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,je(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1,t.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(xe).includes(t.compressionType))this._compression=new As(t.compressionType);else{let r=Object.values(xe).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${t.compressionType} Available types: ${r.join(", ")}`)}}else this._compression=null}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Cr(t)?t.then(r=>this.writeAll(r)):Jr(t)?Gy(this,t):Vy(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof nn?this._sink=t:(this._sink=new nn,t&&OM(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&BM(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!Js(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Ot&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Et&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Js(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Et?t instanceof ta||this._writeRecordBatch(t):t instanceof Ot?this.writeAll(t.batches):wn(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Ge.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===mt.RecordBatch?this._recordBatchBlocks.push(new On(a,t.bodyLength,this._position)):t.headerType===mt.DictionaryBatch&&this._dictionaryBlocks.push(new On(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=W(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Ge.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(sc)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=this._assembleRecordBatch(t),a=new le(t.numRows,n,i,this._compression,s,t.metadata),c=Ge.from(a,r);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(o)}_assembleRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=Ut.assemble(t);return this._compression!=null&&({byteLength:r,bufferRegions:i,buffers:o}=this._compressBodyBuffers(o)),{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}}_compressBodyBuffers(t){let r=Yo.get(this._compression.type);if(!r?.encode||typeof r.encode!="function")throw new Error(`Codec for compression type "${xe[this._compression.type]}" has invalid encode method`);let n=0,i=[],o=[];for(let a of t){let c=W(a);if(c.length===0){i.push(new Uint8Array(0),new Uint8Array(0)),o.push(new te(n,0));continue}let l=r.encode(c),h=l.length<c.length,u=h?l:c,f=h?u.length:-1,d=new Se(new Uint8Array(8));d.writeInt64(0,BigInt(f)),i.push(d.bytes(),new Uint8Array(u));let m=(n+7&-8)-n;n+=m;let p=8+u.length;o.push(new te(n,p)),n+=p}let s=(n+7&-8)-n;return n+=s,{byteLength:n,bufferRegions:o,buffers:i}}_writeDictionaryBatch(t,r,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a,variadicBufferCounts:c}=this._assembleRecordBatch(new U([t])),l=new le(t.length,o,s,this._compression,c),h=new Ve(l,r,n),u=Ge.from(h,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r=this._compression!=null?2:1,n=new Array(r);for(let i=0;i<t.length;i+=r){let o=0;for(let a=-1;++a<r;)n[a]=t[i+a],o+=n[a].byteLength;if(o===0)continue;for(let a of n)this._write(a);let s=(o+7&-8)-o;s>0&&this._writePadding(s)}return this}_writeDictionaries(t){var r,n;for(let[i,o]of t.dictionaries){let s=(r=o?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,h]of s.entries())this._writeDictionaryBatch(h,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},Li=class e extends ei{static writeAll(t,r){let n=new e(r);return Cr(t)?t.then(i=>n.writeAll(i)):Jr(t)?Gy(n,t):Vy(n,t)}},Fi=class e extends ei{static writeAll(t,r){let n=new e(r);return Cr(t)?t.then(i=>n.writeAll(i)):Jr(t)?Gy(n,t):Vy(n,t)}constructor(t){super(t),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,n=!1){if(!n&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,n)}_writeFooter(t){let r=Si.encode(new Si(t,Tt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}},ph=class e extends ei{static writeAll(t){return new e().writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._recordBatchesWithDictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{
19
- "schema": ${JSON.stringify({fields:t.fields.map(r=>mE(r))},null,2)}`)}_writeDictionaries(t){return t.dictionaries.size>0&&this._recordBatchesWithDictionaries.push(t),this}_writeDictionaryBatch(t,r,n=!1){return this._write(this._dictionaryBlocks.length===0?" ":`,
20
- `),this._write(ZO(t,r,n)),this._dictionaryBlocks.push(new On(0,0,0)),this}_writeRecordBatch(t){return this._writeDictionaries(t),this._recordBatches.push(t),this}close(){if(this._recordBatchesWithDictionaries.length>0){this._write(`,
21
- "dictionaries": [
22
- `);for(let t of this._recordBatchesWithDictionaries)super._writeDictionaries(t);this._write(`
23
- ]`)}if(this._recordBatches.length>0){for(let t=-1,r=this._recordBatches.length;++t<r;)this._write(t===0?`,
24
- "batches": [
25
- `:`,
26
- `),this._write(JO(this._recordBatches[t])),this._recordBatchBlocks.push(new On(0,0,0));this._write(`
27
- ]`)}return this._schema&&this._write(`
28
- }`),this._recordBatchesWithDictionaries=[],this._recordBatches=[],super.close()}}});function pE(e,t){if(Jr(e))return tB(e,t);if(wn(e))return QO(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function QO(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){r?.return&&r.return(),r=null}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,h=s.desiredSize||null;for(;!(l=a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=W(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()}}function tB(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return V(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return V(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return V(this,void 0,void 0,function*(){r?.return&&(yield r.return()),r=null})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return V(this,void 0,void 0,function*(){let c,l=null,h=s.desiredSize||null;for(;!(l=yield a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=W(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()})}}var gE=S(()=>{ur();me();Zi()});function wE(e){return new ky(e)}var ky,yE,_E,bE=S(()=>{ur();ch();ky=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=RM(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Bn(o),this._getSize=i!=="bytes"?yE:_E;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?yE:_E}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},yE=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},_E=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0}});function Id(e,t){let r=new nn,n=null,i=new ReadableStream({cancel(){return V(this,void 0,void 0,function*(){yield r.close()})},start(a){return V(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return V(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return V(this,void 0,void 0,function*(){return yield(yield Qe.from(r)).open(t)})}function s(a,c){return V(this,void 0,void 0,function*(){let l=a.desiredSize,h=null;for(;!(h=yield c.next()).done;)if(a.enqueue(h.value),l!=null&&--l<=0)return;a.close()})}}var SE=S(()=>{ur();vo();dh()});function Ad(e,t){let r=new this(e),n=new _r(r),i=new ReadableStream({cancel(){return V(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return V(this,void 0,void 0,function*(){yield o(s)})},start(s){return V(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return V(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}var xE=S(()=>{ur();vo()});function Rd(e){let t=Qe.from(e);return Cr(t)?t.then(r=>Rd(r)):t.isAsync()?t.readAll().then(r=>new Ot(r)):new Ot(t.readAll())}function qy(e,t="stream",r=null){let n={compressionType:r};return(t==="stream"?Li:Fi).writeAll(e,n).toUint8Array(!0)}var ME=S(()=>{Qs();Zi();dh();Ed()});var jy={};tr(jy,{isArrowData:()=>Bd,isArrowDataType:()=>Od,isArrowField:()=>Pd,isArrowRecordBatch:()=>Ld,isArrowSchema:()=>Cd,isArrowTable:()=>Fd,isArrowVector:()=>Nd});function Cd(e){return ct.isSchema(e)}function Pd(e){return G.isField(e)}function Od(e){return B.isDataType(e)}function Bd(e){return Q.isData(e)}function Nd(e){return U.isVector(e)}function Ld(e){return Et.isRecordBatch(e)}function Fd(e){return Ot.isTable(e)}var Wy=S(()=>{ze();At();en();De();Ci();Qs()});var vE,Hy=S(()=>{Sf();Ua();Kt();en();At();Qs();De();gr();ze();Jl();Gf();Ft();ch();ey();my();ry();ny();iy();oy();ay();hy();yy();gy();cy();ly();wy();Sy();by();cd();hd();ld();uy();fy();sy();dy();py();_y();vo();dh();Ed();ME();bd();wd();Mo();Ci();Wy();xf();Kg();Ts();Zl();me();Za();ql();od();Wy();fh();vE=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},_g),Yg),Ng),wg),U0),Bg),mg),ty),jy),{compareSchemas:Js,compareFields:HT,compareTypes:dd})});var na={};tr(na,{AsyncByteQueue:()=>nn,AsyncByteStream:()=>_r,AsyncMessageReader:()=>ea,AsyncRecordBatchFileReader:()=>cc,AsyncRecordBatchStreamReader:()=>Pi,Binary:()=>dr,BinaryBuilder:()=>vi,BinaryView:()=>lt,BinaryViewBuilder:()=>Ii,Bool:()=>Ne,BoolBuilder:()=>Cs,BufferType:()=>kt,Builder:()=>Ct,ByteStream:()=>on,CompressionType:()=>xe,Data:()=>Q,DataType:()=>B,DateBuilder:()=>Jn,DateDay:()=>so,DateDayBuilder:()=>Eo,DateMillisecond:()=>ao,DateMillisecondBuilder:()=>Io,DateUnit:()=>It,Date_:()=>Ye,Decimal:()=>mr,DecimalBuilder:()=>Ao,DenseUnion:()=>_i,DenseUnionBuilder:()=>Xs,Dictionary:()=>se,DictionaryBuilder:()=>Ps,Duration:()=>Ke,DurationBuilder:()=>sn,DurationMicrosecond:()=>Yl,DurationMicrosecondBuilder:()=>Lo,DurationMillisecond:()=>$l,DurationMillisecondBuilder:()=>No,DurationNanosecond:()=>Kl,DurationNanosecondBuilder:()=>Fo,DurationSecond:()=>Hl,DurationSecondBuilder:()=>Bo,Field:()=>G,FixedSizeBinary:()=>pr,FixedSizeBinaryBuilder:()=>Ro,FixedSizeList:()=>zt,FixedSizeListBuilder:()=>Os,Float:()=>Oe,Float16:()=>In,Float16Builder:()=>Bs,Float32:()=>He,Float32Builder:()=>Ns,Float64:()=>Dr,Float64Builder:()=>Ls,FloatBuilder:()=>Qn,Int:()=>qt,Int16:()=>Br,Int16Builder:()=>Ds,Int32:()=>re,Int32Builder:()=>Us,Int64:()=>Nr,Int64Builder:()=>zs,Int8:()=>Or,Int8Builder:()=>Fs,IntBuilder:()=>Ze,Interval:()=>Le,IntervalBuilder:()=>Nn,IntervalDayTime:()=>go,IntervalDayTimeBuilder:()=>Co,IntervalMonthDayNano:()=>Wl,IntervalMonthDayNanoBuilder:()=>Oo,IntervalUnit:()=>gt,IntervalYearMonth:()=>yo,IntervalYearMonthBuilder:()=>Po,JSONMessageReader:()=>ra,LargeBinary:()=>An,LargeBinaryBuilder:()=>Ti,LargeList:()=>Ur,LargeListBuilder:()=>Ws,LargeUtf8:()=>Rn,LargeUtf8Builder:()=>Ho,List:()=>oe,ListBuilder:()=>js,MapBuilder:()=>Hs,MapRow:()=>tn,Map_:()=>Fe,Message:()=>Ge,MessageHeader:()=>mt,MessageReader:()=>$o,MetadataVersion:()=>Tt,Null:()=>Qt,NullBuilder:()=>$s,Precision:()=>wt,RecordBatch:()=>Et,RecordBatchFileReader:()=>Oi,RecordBatchFileWriter:()=>Fi,RecordBatchJSONWriter:()=>ph,RecordBatchReader:()=>Qe,RecordBatchStreamReader:()=>Ln,RecordBatchStreamWriter:()=>Li,RecordBatchWriter:()=>ei,Schema:()=>ct,SparseUnion:()=>_o,SparseUnionBuilder:()=>Ks,Struct:()=>vt,StructBuilder:()=>Ys,StructRow:()=>Kn,Table:()=>Ot,Time:()=>Me,TimeBuilder:()=>cn,TimeMicrosecond:()=>ho,TimeMicrosecondBuilder:()=>qo,TimeMillisecond:()=>lo,TimeMillisecondBuilder:()=>ko,TimeNanosecond:()=>uo,TimeNanosecondBuilder:()=>jo,TimeSecond:()=>co,TimeSecondBuilder:()=>Go,TimeUnit:()=>L,Timestamp:()=>ve,TimestampBuilder:()=>an,TimestampMicrosecond:()=>mo,TimestampMicrosecondBuilder:()=>zo,TimestampMillisecond:()=>Yn,TimestampMillisecondBuilder:()=>Uo,TimestampNanosecond:()=>po,TimestampNanosecondBuilder:()=>Vo,TimestampSecond:()=>fo,TimestampSecondBuilder:()=>Do,Type:()=>b,Uint16:()=>Fr,Uint16Builder:()=>Gs,Uint32:()=>We,Uint32Builder:()=>ks,Uint64:()=>En,Uint64Builder:()=>qs,Uint8:()=>Lr,Uint8Builder:()=>Vs,Union:()=>Xe,UnionBuilder:()=>Ei,UnionMode:()=>xt,Utf8:()=>Be,Utf8Builder:()=>Wo,Utf8View:()=>$e,Utf8ViewBuilder:()=>Zs,Vector:()=>U,Visitor:()=>j,builderThroughAsyncIterable:()=>Ey,builderThroughIterable:()=>pd,compressionRegistry:()=>Yo,isArrowData:()=>Bd,isArrowDataType:()=>Od,isArrowField:()=>Pd,isArrowRecordBatch:()=>Ld,isArrowSchema:()=>Cd,isArrowTable:()=>Fd,isArrowVector:()=>Nd,makeBuilder:()=>Bn,makeData:()=>q,makeTable:()=>Iy,makeVector:()=>Zn,tableFromArrays:()=>Ay,tableFromIPC:()=>Rd,tableFromJSON:()=>Ty,tableToIPC:()=>qy,util:()=>vE,vectorFromArray:()=>oc});var uc=S(()=>{Al();Ft();dh();Ed();gE();bE();SE();xE();Hy();Hy();be.toDOMStream=pE;Ct.throughDOM=wE;Qe.throughDOM=Id;Oi.throughDOM=Id;Ln.throughDOM=Id;ei.throughDOM=Ad;Fi.throughDOM=Ad;Li.throughDOM=Ad});function Dd(e){return{fields:e.fields.map(t=>ia(t)),metadata:AE(e.metadata)}}function AE(e){return Object.fromEntries(e)}function $y(e){return e?new Map(Object.entries(e)):new Map}function ia(e){return{name:e.name,type:RE(e.type),nullable:e.nullable,metadata:AE(e.metadata)}}function Di(e,t){return new G(e.name,Ud(e.type,t),e.nullable,$y(e.metadata))}function RE(e){if(TE(e,"BinaryView"))return"binary-view";if(TE(e,"Utf8View"))return"utf8-view";if(eB(e,"LargeList"))return{type:"large-list",children:[ia(e.valueField)]};switch(e.constructor){case Qt:return"null";case dr:return"binary";case pr:return{type:"fixed-size-binary",byteWidth:e.byteWidth};case Ne:return"bool";case qt:let t=e;return`${t.isSigned?"":"u"}int${t.bitWidth}`;case Or:return"int8";case Br:return"int16";case re:return"int32";case Nr:return"int64";case Lr:return"uint8";case Fr:return"uint16";case We:return"uint32";case En:return"uint64";case Oe:switch(e.precision){case wt.HALF:return"float16";case wt.SINGLE:return"float32";case wt.DOUBLE:return"float64";default:return"float16"}case In:return"float16";case He:return"float32";case Dr:return"float64";case Be:return"utf8";case mr:let n=e;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case Ye:return e.unit===It.DAY?"date-day":"date-millisecond";case so:return"date-day";case ao:return"date-millisecond";case Me:switch(e.unit){case L.SECOND:return"time-second";case L.MILLISECOND:return"time-millisecond";case L.MICROSECOND:return"time-microsecond";case L.NANOSECOND:return"time-nanosecond";default:return"time-second"}case lo:return"time-millisecond";case co:return"time-second";case ho:return"time-microsecond";case uo:return"time-nanosecond";case ve:switch(e.unit){case L.SECOND:return"timestamp-second";case L.MILLISECOND:return"timestamp-millisecond";case L.MICROSECOND:return"timestamp-microsecond";case L.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case fo:return"timestamp-second";case Yn:return"timestamp-millisecond";case mo:return"timestamp-microsecond";case po:return"timestamp-nanosecond";case Le:switch(e.unit){case gt.DAY_TIME:return"interval-daytime";case gt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case go:return"interval-daytime";case yo:return"interval-yearmonth";case Fe:let c=e;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(p=>ia(p))};case oe:let h=e.valueField;return{type:"list",children:[ia(h)]};case zt:let u=e;return{type:"fixed-size-list",listSize:u.listSize,children:[ia(u.children[0])]};case vt:return{type:"struct",children:e.children.map(p=>ia(p))};case _o:case _i:let d=e;return{type:d instanceof _i?"dense-union":"sparse-union",typeIds:d.typeIds,children:d.children.map(p=>ia(p)),typeIdToChildIndex:{...d.typeIdToChildIndex}};case se:let m=e;return{type:"dictionary",id:m.id,indices:rB(m.indices),dictionary:RE(m.dictionary),isOrdered:m.isOrdered};default:throw new Error(`arrow type not supported: ${e.constructor.name}`)}}function Ud(e,t){if(typeof e=="object")switch(e.type){case"decimal":return new mr(e.scale,e.precision,e.bitWidth);case"map":{let r=e.children.map(n=>Di(n,t));return new Fe(r[0],e.keysSorted)}case"list":{let r=Di(e.children[0],t);return new oe(r)}case"large-list":{let r=Di(e.children[0],t),n=gh("LargeList");if(!n)throw new Error("LargeList requires an Apache Arrow runtime that exports the LargeList constructor");return new n(r)}case"fixed-size-list":{let r=Di(e.children[0],t);return new zt(e.listSize,r)}case"fixed-size-binary":return new pr(e.byteWidth);case"struct":{let r=e.children.map(n=>Di(n,t));return new vt(r)}case"sparse-union":case"dense-union":{let r=e.children.map(n=>Di(n,t));return e.type==="dense-union"?new _i(e.typeIds,r):new _o(e.typeIds,r)}case"dictionary":return new se(Ud(e.dictionary,t),iB(e.indices),e.id,e.isOrdered);default:throw new Error("array type not supported")}switch(e){case"null":return new Qt;case"binary":return EE("BinaryView",new dr,t);case"binary-view":return IE("BinaryView");case"bool":return new Ne;case"int8":return new Or;case"int16":return new Br;case"int32":return new re;case"int64":return new Nr;case"uint8":return new Lr;case"uint16":return new Fr;case"uint32":return new We;case"uint64":return new En;case"float16":return new In;case"float32":return new He;case"float64":return new Dr;case"utf8":return EE("Utf8View",new Be,t);case"utf8-view":return IE("Utf8View");case"date-day":return new so;case"date-millisecond":return new ao;case"time-second":return new co;case"time-millisecond":return new lo;case"time-microsecond":return new ho;case"time-nanosecond":return new uo;case"timestamp-second":return new fo;case"timestamp-millisecond":return new Yn;case"timestamp-microsecond":return new mo;case"timestamp-nanosecond":return new po;case"interval-daytime":return new go;case"interval-yearmonth":return new yo;default:throw new Error("array type not supported")}}function gh(e){return na[e]}function TE(e,t){let r=gh(t);if(r&&e instanceof r)return!0;let n=B;return!!(t==="BinaryView"?n.isBinaryView:n.isUtf8View)?.(e)}function eB(e,t){let r=gh(t);return!!(r&&e instanceof r)}function EE(e,t,r){let n=r?.viewTypes||"never";if(n==="never")return t;let i=gh(e);if(i)return new i;if(n==="require")throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return t}function IE(e){let t=gh(e);if(!t)throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return new t}function rB(e){if(e instanceof qt){let r=`${e.isSigned?"int":"uint"}${e.bitWidth}`;if(nB(r))return r}switch(e.constructor){case Or:return"int8";case Br:return"int16";case re:return"int32";case Lr:return"uint8";case Fr:return"uint16";case We:return"uint32";default:throw new Error(`arrow dictionary index type not supported: ${e.constructor.name}`)}}function nB(e){return["int8","int16","int32","uint8","uint16","uint32"].includes(e)}function iB(e){switch(e){case"int8":return new Or;case"int16":return new Br;case"int32":return new re;case"uint8":return new Lr;case"uint16":return new Fr;case"uint32":return new We;default:throw new Error(`schema dictionary index type not supported: ${e}`)}}var zd=S(()=>{"use strict";uc()});function Yy(e){let t=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let h=a[l],u=a[l+1],f=a[l+2];t=h<t?h:t,r=u<r?u:r,n=f<n?f:n,i=h>i?h:i,o=u>o?u:o,s=f>s?f:s}return[[t,r,n],[i,o,s]]}var CE=S(()=>{"use strict"});function Ky(e){let t=lp();return new t(e)}function Ko(e){return!!(Hc&&e instanceof Hc)}function Xy(e,t,r){Ko(e)?e[t]=r:e[t]=PE(r)}function Zy(e,t){return Ko(e)?e[t]:oB(e[t])}function yh(e){return Ko(e)?new Uint16Array(e.buffer,e.byteOffset,e.length):e}function PE(e){if(!Number.isFinite(e))return e===1/0?31744:e===-1/0?64512:32256;let t=e<0||Object.is(e,-0)?32768:0,r=Math.abs(e);if(r===0)return t;if(r>=65520)return t|31744;if(r>=65504)return t|31743;let n=Math.floor(Math.log2(r));if(n<-14)return t|Math.round(r/2**-24);let i=n+15,o=Math.round((r/2**n-1)*1024);return o===1024?t|i+1<<10:t|i<<10|o}function oB(e){let t=e&32768?-1:1,r=e>>10&31,n=e&1023;return r===0?t*n*2**-24:r===31?n?NaN:t*(1/0):t*(1+n/1024)*2**(r-15)}var OE=S(()=>{"use strict";hp()});var Vd,Jy,BE=S(()=>{"use strict";uc();Vd=new ct([new G("POSITION",new zt(3,new G("value",new He,!1)),!1)]),Jy=new ct([...Vd.fields,new G("indices",new oe(new G("item",new We,!1)),!0)])});var _h=S(()=>{"use strict";OE();BE()});function NE(e){return e.type instanceof zt?e.type.listSize:1}function Qy(e,t,r){let n=sB(e,t,r);return new U([n])}function sB(e,t,r){let n=aB(e,t,r),i=n.children[0].type,o=r==="float16"&&Ko(e)?yh(e):e,s={[kt.DATA]:o},a=new Q(i,0,o.length,0,s);return new Q(n,0,o.length/t,0,void 0,[a])}function aB(e,t,r){let n=r||EM(e).type,i=Ud(n);return new zt(t,new G("value",i,!1))}var t1=S(()=>{"use strict";_h();uc();IM();zd()});function e1(e,t){switch(t){case"columnar-table":return cB(e);case"arrow-table":return lB(e);default:throw new Error(t)}}function cB(e){let t={},r=DE(e);for(let[n,i]of Object.entries(e.attributes))t[n]=i.value;return{shape:"columnar-table",schema:e.schema,data:t,topology:e.topology,indices:r?e.indices:void 0}}function lB(e,t){return FE(e.attributes,{schema:e.schema,topology:e.topology,mode:e.mode,boundingBox:e.header?.boundingBox,indices:DE(e)?e.indices:void 0})}function FE(e,t={}){let r=[],n={},i=uB(e);for(let c of i){let l=e[c],{value:h,size:u=1}=l,f=hB(h,u,l.componentType);if(n[c]=f,r.push(fB(t.schema,c,f,l.componentType)),c==="POSITION"&&t.indices?.value?.length){let d=Jy.fields.find(m=>m.name==="indices");n.indices=mB(t.indices.value,f.length,d.type),r.push(d)}}let o=new ct(r,pB(t)),s=n[i[0]]?.length===0?new Ot(o):new Ot(o,n);return{shape:"arrow-table",schema:Dd(s.schema),data:s,topology:t.topology||"point-list",indices:t.indices}}function hB(e,t,r){if(r==="float16"){let n=Ko(e)?yh(e):e;if(t===1){let i=new Q(new In,0,n.length,0,{[kt.DATA]:n});return new U([i])}return Qy(e,t,r)}return t===1?Zn(e):Qy(e,t)}function uB(e){let t=Object.keys(e),r=LE.filter(i=>i in e),n=t.filter(i=>!LE.includes(i));return[...r,...n]}function DE(e){return!!e.indices?.value?.length}function fB(e,t,r,n){if(t==="POSITION"&&dB(r)){let o=Vd.fields[0],s=e?.fields.find(c=>c.name===t);if(!s?.metadata)return o;let a=new Map(o.metadata);for(let[c,l]of Object.entries(s.metadata))a.set(c,l);return new G(o.name,o.type,o.nullable,a)}let i=e?.fields.find(o=>o.name===t);if(n==="float16"){let o=new Map(Object.entries(i?.metadata||{}));return o.set("componentType","float16"),new G(t,r.type,!1,o)}if(i&&i.type.toString()!==r.type.toString()){let o=Di(i);return new G(t,r.type,o.nullable,o.metadata)}return i?Di(i):new G(t,r.type,!1)}function dB(e){return e.type instanceof zt&&e.type.listSize===3&&e.type.children[0].type instanceof He}function mB(e,t,r){let n=r,i=e instanceof Uint32Array?e:Uint32Array.from(e),o=new Int32Array(t+1);t>0&&o.fill(i.length,1);let s=new Uint8Array(Math.ceil(t/8));t>0&&(s[0]=1);let a=new Q(n.children[0].type,0,i.length,0,{[kt.DATA]:i}),c=new Q(n,0,t,Math.max(0,t-1),{[kt.OFFSET]:o,[kt.VALIDITY]:s},[a]);return new U([c])}function pB(e){let t={...e.schema?.metadata};return e.topology&&(t.topology||=e.topology),Number.isFinite(e.mode)&&(t.mode||=String(e.mode)),e.boundingBox&&(t.boundingBox||=JSON.stringify(e.boundingBox)),$y(t)}var LE,UE=S(()=>{"use strict";_h();_h();uc();t1();zd();LE=["POSITION"]});function zE(e){if(e.shape==="arrow-table")return gB(e);throw new Error(e.shape)}function gB(e){let t=e.data,r=Dd(t.schema),n=r.fields,i={},o=[];for(let h of n){let{name:u}=h;if(u==="indices")continue;let f=t.getChild(u),d=NE(f),m=SB(f,d),p=_B(h.metadata),g=p.componentType==="float16"?xB(m):m,y=o.find(w=>w.data.length===f.data.length&&i[w.name].value.constructor===g.constructor&&w.data.every((M,x)=>VE(M,f.data[x])));i[u]={value:y?i[y.name].value:g,size:d,...p},y||o.push({name:u,data:f.data})}bB(r);let s=r.metadata.topology,a=MB(r),c=vB(t),l=i.POSITION?.transform?.type==="quantization"?yB(r)||Yy(i):Yy(i);return{schema:r,attributes:i,topology:s,mode:a,indices:c,header:{vertexCount:t.numRows,boundingBox:l}}}function yB(e){let t=e.metadata?.boundingBox;if(!t)return null;try{let r=JSON.parse(t);if(Array.isArray(r)&&r.length===2&&r.every(n=>Array.isArray(n)&&n.length===3&&n.every(i=>typeof i=="number")))return r}catch{}return null}function _B(e={}){let t={};if(e.byteOffset!==void 0&&(t.byteOffset=Number(e.byteOffset)),e.byteStride!==void 0&&(t.byteStride=Number(e.byteStride)),e.normalized!==void 0&&(t.normalized=e.normalized==="true"),e.componentType==="float16"&&(t.componentType="float16"),e["loaders.gl.transform"])try{let r=JSON.parse(e["loaders.gl.transform"]);wB(r)&&(t.transform=r)}catch{}return t}function wB(e){if(!e||typeof e!="object"||!("type"in e))return!1;let t=e;return t.type==="octahedron"?Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30:t.type==="quantization"&&Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30&&Array.isArray(t.origin)&&t.origin.every(r=>typeof r=="number")&&typeof t.range=="number"}function bB(e){e.metadata||={},e.metadata.topology||="point-list",e.metadata.mode||="0"}function SB(e,t){if(!(e.type instanceof zt))return e.toArray();let n=e.data[0].children[0].values.constructor,i=new n(e.length*t),o=0;for(let s of e.data){let a=s.children[0],c=s.length*t,l=a.offset||s.offset*t,h=l+c<=a.values.length?l:0,u=a.values.subarray(h,h+c);i.set(u,o),o+=c}return i}function xB(e){let t=Ky(e.length);for(let r=0;r<e.length;r++)Xy(t,r,Zy(e,r));return t}function MB(e){let t=Number(e.metadata?.mode);return Number.isFinite(t)?t:0}function vB(e){let t=e.getChild("indices");if(!t?.isValid(0))return;let r=t.data[0],n=r.valueOffsets,i=n[r.offset],o=n[r.offset+1];return{value:r.children[0].values.subarray(i,o),size:1}}function VE(e,t){let r=Object.values(t.buffers);return e.type.toString()===t.type.toString()&&e.offset===t.offset&&e.length===t.length&&e.nullCount===t.nullCount&&e.dictionary===t.dictionary&&Object.values(e.buffers).every((n,i)=>{let o=r[i];return n===o||!!(n&&o&&n.buffer===o.buffer&&n.byteOffset===o.byteOffset&&n.byteLength===o.byteLength)})&&e.children.length===t.children.length&&e.children.every((n,i)=>VE(n,t.children[i]))}var GE=S(()=>{"use strict";_h();uc();t1();zd();CE()});function kE(e){return[e.value.constructor.name,e.value.byteOffset,e.value.byteLength,e.size,e.byteOffset??0,e.byteStride||e.size*e.value.BYTES_PER_ELEMENT].join(":")}var wh,qE=S(()=>{"use strict";GE();wh=class{ready;sourcePointCount=0;get pointCount(){return this.sourcePointCount}controller=new AbortController;options;signal;mesh=null;nodes=new Map;indexBytes=0;pointByteLength=0;constructor(t,r={}){this.options={nodePointLimit:r.nodePointLimit??5e4,maximumDepth:r.maximumDepth??16,maxInputBytes:r.maxInputBytes??512*1024*1024,maxIndexBytes:r.maxIndexBytes??128*1024*1024,maxTileBytes:r.maxTileBytes??64*1024*1024,maxNodes:r.maxNodes??1e5};for(let[n,i]of Object.entries(this.options))if(!Number.isSafeInteger(i)||i<(n==="maximumDepth"?0:1))throw new Error(`PointCloudTiler: invalid ${n}`);if(this.options.maximumDepth>24||this.options.nodePointLimit>1e6)throw new Error("PointCloudTiler: maximumDepth must be <= 24 and nodePointLimit <= 1000000");this.signal=r.signal?AbortSignal.any([r.signal,this.controller.signal]):this.controller.signal,this.ready=this.initialize(t).catch(n=>{throw this.close(),n})}async getRootNode(){return await this.ready,this.getNode("r").node}async getNodeMetadata(t){return await this.ready,this.getNode(t).node}async getChildNodes(t){await this.ready;let r=this.getNode(t);return r.childrenPromise||(r.childrenPromise=this.splitNode(r)),r.childrenPromise}async splitNode(t){let r=t.node.id;if(t.children)return t.children;let n=Array.from({length:8},()=>0),i=t.node.bounds[0].map((a,c)=>a+(t.node.bounds[1][c]-a)/2);for(let a=0;a<t.remaining.length;a++)a%65536===0&&await this.checkpoint(),n[this.getOctant(t.remaining[a],i)]++;if(this.nodes.size+n.filter(a=>a>0).length>this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");let o=[],s=[];try{for(let c of n)s.push(this.allocateRows(c));let a=new Uint32Array(8);for(let c=0;c<t.remaining.length;c++){c%65536===0&&await this.checkpoint();let l=t.remaining[c],h=this.getOctant(l,i);s[h][a[h]++]=l}for(let c=0;c<8;c++){if(!s[c].length)continue;let l=t.node.bounds.map(u=>[...u]);for(let u=0;u<3;u++)l[c&4>>u?0:1][u]=i[u];let h=await this.createNode(`${r}${c}`,l,s[c]);s[c]=new Uint32Array(0),o.push(h.node)}return this.releaseRows(t.remaining),t.remaining=new Uint32Array(0),t.children=Object.freeze(o),t.children}catch(a){throw this.close(),a}}async getTileMesh(t){await this.ready;let r=this.getNode(t);if(r.rows.length*this.pointByteLength>this.options.maxTileBytes)throw new Error("PointCloudTiler: tile byte budget exceeded");let i={},o=new Map;for(let[s,a]of Object.entries(this.mesh.attributes)){let c=kE(a),l=o.get(a.value.buffer)?.get(c);if(l){i[s]={...a,value:l,byteOffset:0,byteStride:0};continue}let h=a.value.constructor,u=new h(r.rows.length*a.size),f=new Uint8Array(a.value.buffer,a.value.byteOffset,a.value.byteLength),d=new Uint8Array(u.buffer,u.byteOffset,u.byteLength),m=a.value.BYTES_PER_ELEMENT,p=a.size*m,g=a.byteStride||p;for(let w=0;w<r.rows.length;w++){w%65536===0&&await this.checkpoint();let M=(a.byteOffset||0)+r.rows[w]*g;d.set(f.subarray(M,M+p),w*p)}let y=o.get(a.value.buffer)??new Map;y.set(c,u),o.set(a.value.buffer,y),i[s]={...a,value:u,byteOffset:0,byteStride:0}}return{...this.mesh,attributes:i,topology:"point-list",mode:0,indices:void 0,header:{vertexCount:r.rows.length,boundingBox:r.node.bounds.map(s=>[...s])},loaderData:{...this.mesh.loaderData,pointCloudTileId:t}}}close(){this.controller.abort(new Error("PointCloudTiler: closed")),this.mesh=null,this.nodes.clear(),this.indexBytes=0}async initialize(t){if(this.signal.throwIfAborted(),"shape"in t){let f=new Set,d=0,m=p=>{if(p.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping");for(let g of Object.values(p.buffers))g&&!f.has(g.buffer)&&(f.add(g.buffer),d+=g.buffer.byteLength);for(let g of p.children)m(g);if(p.dictionary)for(let g of p.dictionary.data)m(g)};for(let p of t.data.batches)m(p.data);if(d>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");for(let p of t.data.schema.fields)if(t.data.getChild(p.name)?.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping")}let r="shape"in t?zE(t):t;if(r.topology!=="point-list"||r.indices)throw new Error("PointCloudTiler: unindexed point-list input required");let n=r.attributes.POSITION;if(!n||n.size!==3||!(n.value instanceof Float32Array||n.value instanceof Float64Array)||n.transform||n.normalized||n.componentType==="float16")throw new Error("PointCloudTiler: POSITION requires decoded floating-point XYZ");if(!r.header&&(n.byteOffset||n.byteStride))throw new Error("PointCloudTiler: strided POSITION requires vertexCount");let i=r.header?.vertexCount??n.value.length/3;if(!Number.isSafeInteger(i)||i<0||i>4294967295)throw new Error("PointCloudTiler: invalid point count");let o=0,s=new Map,a=new Set;for(let f of Object.values(r.attributes)){this.validateAttribute(f,i),a.has(f.value.buffer)||(a.add(f.value.buffer),o+=f.value.buffer.byteLength);let d=s.get(f.value.buffer)??new Set,m=kE(f);d.has(m)||(this.pointByteLength+=f.size*f.value.BYTES_PER_ELEMENT,d.add(m),s.set(f.value.buffer,d))}if(o>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");this.mesh=r,this.sourcePointCount=i;let c=this.allocateRows(i),l=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let f=0;f<i;f++){f%65536===0&&await this.checkpoint(),c[f]=f;for(let d=0;d<3;d++){let m=this.getCoordinate(f,d);if(!Number.isFinite(m))throw new Error("PointCloudTiler: nonfinite position");l[d]=Math.min(l[d],m),h[d]=Math.max(h[d],m)}}i||(l.fill(0),h.fill(0));let u=Math.max(...l.map((f,d)=>h[d]-f));if(!Number.isFinite(u))throw new Error("PointCloudTiler: coordinate extent overflow");for(let f=0;f<3;f++)h[f]=l[f]+u;if(!h.every(Number.isFinite)||!Number.isFinite(Math.hypot(u,u,u)))throw new Error("PointCloudTiler: coordinate extent overflow");await this.createNode("r",[l,h],c),this.signal.throwIfAborted()}async createNode(t,r,n){let i=t.length-1>=this.options.maximumDepth||r[0].every((c,l)=>c===r[1][l])||n.length<=this.options.nodePointLimit,o=n,s=new Uint32Array(0);if(!i){let c=Math.ceil(Math.cbrt(this.options.nodePointLimit)),l=new Set,h=this.allocateRows(Math.min(n.length,this.options.nodePointLimit)),u=this.allocateRows(n.length),f=0,d=0;for(let m=0;m<n.length;m++){m%65536===0&&await this.checkpoint();let p=n[m],g=0;for(let y=0;y<3;y++){let w=Math.min(c-1,Math.floor((this.getCoordinate(p,y)-r[0][y])/(r[1][y]-r[0][y])*c));g=g*c+w}f<h.length&&!l.has(g)?(l.add(g),h[f++]=p):u[d++]=p}o=h.subarray(0,f),s=u.subarray(0,d),this.releaseRows(n)}let a={node:{id:t,level:t.length-1,pointCount:o.length,bounds:r,geometricError:s.length?Math.hypot(...r[0].map((c,l)=>r[1][l]-c)):0},rows:o,remaining:s};if(Object.freeze(r[0]),Object.freeze(r[1]),Object.freeze(r),Object.freeze(a.node),this.signal.throwIfAborted(),this.nodes.size>=this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");return this.nodes.set(t,a),a}getCoordinate(t,r){let n=this.mesh.attributes.POSITION;return Number(n.value[(n.byteOffset||0)/n.value.BYTES_PER_ELEMENT+t*(n.byteStride||3*n.value.BYTES_PER_ELEMENT)/n.value.BYTES_PER_ELEMENT+r])}validateAttribute(t,r){let n=t.value?.BYTES_PER_ELEMENT,i=t.byteOffset??0,o=t.byteStride||t.size*n;if(!n||!Number.isSafeInteger(t.size)||t.size<1||!Number.isSafeInteger(i)||i<0||i%n||!Number.isSafeInteger(o)||o<t.size*n||o%n||r&&i+(r-1)*o+t.size*n>t.value.byteLength)throw new Error("PointCloudTiler: invalid attribute layout")}allocateRows(t){if(t*4>this.options.maxIndexBytes-this.indexBytes)throw new Error("PointCloudTiler: index byte budget exceeded");let r=new Uint32Array(t);return this.indexBytes+=r.byteLength,r}releaseRows(t){this.indexBytes-=t.buffer.byteLength}getNode(t){this.signal.throwIfAborted();let r=this.nodes.get(t);if(!r)throw new Error(`PointCloudTiler: unknown tile ${t}`);return r}getOctant(t,r){let n=0;for(let i=0;i<3;i++)this.getCoordinate(t,i)>=r[i]&&(n|=4>>i);return n}async checkpoint(){this.signal.throwIfAborted(),await new Promise(t=>setTimeout(t,0)),this.signal.throwIfAborted()}}});var jE=S(()=>{"use strict";UE();qE()});var Gd,WE=S(()=>{"use strict";fn();jE();Gd=class extends Ic{ready;isReady=!1;tiler;constructor(t,r={},n){super(null,r,{pointCloudTiler:{}},n),this.tiler=new wh(t,r.pointCloudTiler),this.ready=this.tiler.getRootNode().then(()=>{this.isReady=!0}),this.ready.catch(()=>{})}async initialize(){await this.ready,await this.tiler.getRootNode()}async getMetadata(){return await this.initialize(),{pointCount:this.tiler.pointCount,refinement:"ADD"}}async getRootTile(){return this.createHeader(await this.tiler.getRootNode())}async getChildren(t){return(await this.tiler.getChildNodes(t.id)).map(r=>this.createHeader(r))}async loadTileContent(t){let r=await this.tiler.getTileMesh(t.id);return r.header.vertexCount?{data:e1(r,"arrow-table"),pointCount:r.header.vertexCount,cartographicOrigin:[0,0,0],coordinateSystem:"cartesian",spatialReference:this.options.pointCloudTiler.spatialReference,spatialBoundingVolume:this.createHeader(await this.tiler.getNodeMetadata(t.id)).boundingVolume}:null}close(){this.tiler.close(),this.isReady=!1}createHeader(t){let r=t.bounds[0].map((i,o)=>i+(t.bounds[1][o]-i)/2),n={cartographicBounds:t.bounds.map(i=>[...i]),center:r,radius:Math.hypot(...r.map((i,o)=>t.bounds[1][o]-i)),coordinateFrame:"cartesian"};return{id:t.id,level:t.level,pointCount:t.pointCount,geometricError:t.geometricError,boundingVolume:n,spatialBoundingVolume:n}}}});var HE={};tr(HE,{PointCloudTileSourceLoaderWithParser:()=>EB});var _ot,wot,TB,EB,$E=S(()=>{"use strict";WE();r1();({preload:_ot,createDataSource:wot,...TB}=bh),EB={...TB,createDataSource(e,t={},r){if(typeof e=="string"||e instanceof Blob)throw new Error("PointCloudTileSourceLoader requires decoded Mesh/Arrow input");return new Gd(e,t,r)}}});async function AB(){let{PointCloudTileSourceLoaderWithParser:e}=await Promise.resolve().then(()=>($E(),HE));return e}var IB,bh,r1=S(()=>{"use strict";IB="5.0.0-alpha.12";bh={dataType:null,batchType:null,name:"PointCloudTiler",id:"point-cloud-tiler",module:"tiles",version:IB,extensions:[],mimeTypes:[],type:"point-cloud",fromUrl:!1,fromBlob:!1,testURL:()=>!1,options:{pointCloudTiler:{}},defaultOptions:{pointCloudTiler:{}},preload:AB,createDataSource(e,t={},r){throw new Error("PointCloudTileSourceLoader requires preload() or @loaders.gl/tiles/point-cloud-tile-source-loader")}}});var RB={};tr(RB,{FetchError:()=>E.FetchError,I3SSource:()=>_l,I3SSpatialTransformer:()=>ds,ImageSet:()=>Sl,IndexedArchiveTilesetSource:()=>zc,JSONLoader:()=>E.JSONLoader,LOD_METRIC_TYPE:()=>rs,NullLoader:()=>E.NullLoader,NullWorkerLoader:()=>E.NullWorkerLoader,PointCloudTile:()=>gs,PointCloudTileSourceLoader:()=>bh,PointCloudTileset:()=>vl,RasterSet:()=>Ml,RequestScheduler:()=>E.RequestScheduler,STRATEGY_DEFAULT:()=>ps,STRATEGY_NEVER:()=>wl,STRATEGY_REPLACE:()=>bl,SharedTile2DHeader:()=>fi,SpatialCoordinateTransformer:()=>Ir,TILESET_TYPE:()=>he,TILE_CONTENT_STATE:()=>ue,TILE_REFINEMENT:()=>Zt,TILE_TYPE:()=>dn,Tile3D:()=>or,Tiles3DSource:()=>yl,Tiles3DSpatialTransformer:()=>ui,Tileset2D:()=>ms,Tileset3D:()=>Uc,TilesetCache:()=>ts,TilesetTraverser:()=>mn,_BrowserFileSystem:()=>E._BrowserFileSystem,_fetchProgress:()=>E._fetchProgress,_selectSource:()=>E._selectSource,_unregisterLoaders:()=>E._unregisterLoaders,applyTilesetSpatialOptions:()=>Gi,assert:()=>E.assert,calculateTransformProps:()=>Oc,concatenateArrayBuffersAsync:()=>E.concatenateArrayBuffersAsync,convertS2BoundingVolumeToOBB:()=>ml,coreApi:()=>E.coreApi,createBoundingVolume:()=>is,createDataSource:()=>E.createDataSource,createImplicitSubtreeReference:()=>Qu,createTilesetSpatialReference:()=>ir,document:()=>E.document,encode:()=>E.encode,encodeInBatches:()=>E.encodeInBatches,encodeSync:()=>E.encodeSync,encodeTable:()=>E.encodeTable,encodeTableAsText:()=>E.encodeTableAsText,encodeTableInBatches:()=>E.encodeTableInBatches,encodeText:()=>E.encodeText,encodeTextSync:()=>E.encodeTextSync,encodeURLtoURL:()=>E.encodeURLtoURL,fetchFile:()=>E.fetchFile,forEach:()=>E.forEach,get3DTilesSpatialReference:()=>jc,getFrameState:()=>Nc,getGeoidModel:()=>al,getI3SSpatialReference:()=>qc,getLoaderOptions:()=>E.getLoaderOptions,getLodStatus:()=>Vc,getPathPrefix:()=>E.getPathPrefix,getSpatialCoordinateFrame:()=>nr,getTileset3DTraversalSnapshot:()=>Qm,global:()=>E.global,isAsyncIterable:()=>E.isAsyncIterable,isBrowser:()=>E.isBrowser,isIterable:()=>E.isIterable,isIterator:()=>E.isIterator,isPromise:()=>E.isPromise,isPureObject:()=>E.isPureObject,isReadableStream:()=>E.isReadableStream,isResponse:()=>E.isResponse,isTileset3DSource:()=>Dc,isWorker:()=>E.isWorker,isWritableStream:()=>E.isWritableStream,load:()=>E.load,loadInBatches:()=>E.loadInBatches,makeIterator:()=>E.makeIterator,makeLineIterator:()=>E.makeLineIterator,makeNumberedLineIterator:()=>E.makeNumberedLineIterator,makeStream:()=>E.makeStream,makeTextDecoderIterator:()=>E.makeTextDecoderIterator,makeTextEncoderIterator:()=>E.makeTextEncoderIterator,markTilesetSpatialReferenceTransformed:()=>ns,materializeImplicitSubtree:()=>gl,parse:()=>E.parse,parseFile:()=>E.parseFile,parseInBatches:()=>E.parseInBatches,parseSync:()=>E.parseSync,preload:()=>E.preload,preloadSync:()=>E.preloadSync,readArrayBuffer:()=>E.readArrayBuffer,registerGeoidModel:()=>Xu,registerGeoidModelFromPgm:()=>x0,registerLoaders:()=>E.registerLoaders,registerSpatialCrs:()=>b0,registerSpatialDatumGrid:()=>S0,replaceImplicitUrlTemplate:()=>Oa,resolvePath:()=>E.resolvePath,selectLoader:()=>E.selectLoader,selectLoaderSync:()=>E.selectLoaderSync,self:()=>E.self,setLoaderOptions:()=>E.setLoaderOptions,setPathPrefix:()=>E.setPathPrefix,traverseTilesetContents:()=>tp,window:()=>E.window});var E=lI(a1(),1);var Rt={};tr(Rt,{EPSILON1:()=>uI,EPSILON10:()=>bI,EPSILON11:()=>SI,EPSILON12:()=>xI,EPSILON13:()=>MI,EPSILON14:()=>Mh,EPSILON15:()=>vI,EPSILON16:()=>TI,EPSILON17:()=>EI,EPSILON18:()=>II,EPSILON19:()=>AI,EPSILON2:()=>fI,EPSILON20:()=>RI,EPSILON3:()=>dI,EPSILON4:()=>mI,EPSILON5:()=>pI,EPSILON6:()=>gI,EPSILON7:()=>yI,EPSILON8:()=>_I,EPSILON9:()=>wI,PI:()=>sa,PI_OVER_FOUR:()=>PI,PI_OVER_SIX:()=>OI,PI_OVER_TWO:()=>CI,TWO_PI:()=>fc});var uI=.1,fI=.01,dI=.001,mI=1e-4,pI=1e-5,gI=1e-6,yI=1e-7,_I=1e-8,wI=1e-9,bI=1e-10,SI=1e-11,xI=1e-12,MI=1e-13,Mh=1e-14,vI=1e-15,TI=1e-16,EI=1e-17,II=1e-18,AI=1e-19,RI=1e-20,CI=Math.PI/2,PI=Math.PI/4,OI=Math.PI/6,sa=Math.PI,fc=Math.PI*2;var BI=1/Math.PI*180,NI=1/180*Math.PI,LI={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...LI}};var Vt=globalThis.mathgl.config;function Hd(e,{precision:t=Vt.precision}={}){return e=DI(e),`${parseFloat(e.toPrecision(t))}`}function Wr(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $d(e){return vh(e)}function Yd(e){return ke(e)}function vh(e,t){return Xd(e,r=>r*NI,t)}function ke(e,t){return Xd(e,r=>r*BI,t)}function c1(e,t){return Math.sign(e)===Math.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t}function Kd(e,t){switch(t){case"negative-pi-to-pi":return FI(e);case"zero-to-two-pi":return l1(e);default:return e}}function l1(e){if(e>=0&&e<=fc)return e;let t=c1(e,fc);return Math.abs(t)<1e-14&&Math.abs(e)>1e-14?fc:t}function FI(e){return e>=-sa&&e<=sa?e:l1(e+sa)-sa}function dc(e,t,r){return Xd(e,n=>Math.max(t,Math.min(r,n)))}function Sr(e,t,r){let n=Vt.EPSILON;r&&(Vt.EPSILON=r);try{if(e===t)return!0;if(Wr(e)&&Wr(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!Sr(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=Vt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Vt.EPSILON=n}}function DI(e){return Math.round(e/Vt.EPSILON)*Vt.EPSILON}function UI(e){return e.clone?e.clone():new Array(e.length)}function Xd(e,t,r){if(Wr(e)){let n=e;r=r||UI(n);for(let i=0;i<r.length&&i<n.length;++i){let o=typeof e=="number"?e:e[i];r[i]=t(o,i,r)}return r}return t(e)}var Ui=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Wr(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toString(){return this.formatString(Vt)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Hd(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Sr(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let i=0;i<this.ELEMENTS;++i){let o=t[i],s=typeof r=="number"?r:r[i];this[i]=o+n*(s-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(Vt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}};function zI(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function Bt(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function aa(e,t,r=""){if(Vt.debug&&!zI(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}var ca=class extends Ui{toString(){let t="[";if(Vt.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=Bt(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function pe(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var la=class extends Ui{get x(){return this[0]}set x(t){this[0]=Bt(t)}get y(){return this[1]}set y(t){this[1]=Bt(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-t[n];r+=i*i}return Bt(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return Bt(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return pe(t>=0&&t<this.ELEMENTS,"index is out of range"),Bt(this[t])}setComponent(t,r){return pe(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n]*r;return this.check()}};var Th=typeof Float32Array<"u"?Float32Array:Array;var $B=Math.PI/180;function h1(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e}function u1(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function Eh(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function Ih(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}function Ah(e,t,r){let n=t[0],i=t[1],o=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/o,e[1]=(r[1]*n+r[5]*i)/o,e}function Rh(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o||1;return e[0]=(r[0]*n+r[4]*i+r[8]*o)/s,e[1]=(r[1]*n+r[5]*i+r[9]*o)/s,e[2]=(r[2]*n+r[6]*i+r[10]*o)/s,e}function f1(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function d1(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*o,e[1]=r[1]*n+r[4]*i+r[7]*o,e[2]=r[2]*n+r[5]*i+r[8]*o,e[3]=t[3],e}var Hr=class extends la{constructor(t=0,r=0){super(2),Wr(t)&&arguments.length===1?this.copy(t):(Vt.debug&&(Bt(t),Bt(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return Vt.debug&&(Bt(t.x),Bt(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ih(this,this,t),this.check()}transformAsVector(t){return Ah(this,this,t),this.check()}transformByMatrix3(t){return Eh(this,this,t),this.check()}transformByMatrix2x3(t){return u1(this,this,t),this.check()}transformByMatrix2(t){return h1(this,this,t),this.check()}};function m1(){let e=new Th(3);return Th!==Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Zd(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function Jd(e,t,r){let n=new Th(3);return n[0]=e,n[1]=t,n[2]=r,n}function p1(e,t){let r=t[0],n=t[1],i=t[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function pc(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ha(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[0],a=r[1],c=r[2];return e[0]=i*c-o*a,e[1]=o*s-n*c,e[2]=n*a-i*s,e}function Ch(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,e}function Ph(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=n*r[0]+i*r[3]+o*r[6],e[1]=n*r[1]+i*r[4]+o*r[7],e[2]=n*r[2]+i*r[5]+o*r[8],e}function g1(e,t,r){let n=r[0],i=r[1],o=r[2],s=r[3],a=t[0],c=t[1],l=t[2],h=i*l-o*c,u=o*a-n*l,f=n*c-i*a,d=i*f-o*u,m=o*h-n*f,p=n*u-i*h,g=s*2;return h*=g,u*=g,f*=g,d*=2,m*=2,p*=2,e[0]=a+h+d,e[1]=c+u+m,e[2]=l+f+p,e}function y1(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function _1(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function w1(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function b1(e,t){let r=e[0],n=e[1],i=e[2],o=t[0],s=t[1],a=t[2],c=Math.sqrt((r*r+n*n+i*i)*(o*o+s*s+a*a)),l=c&&pc(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}var S1=Zd;var Qd=[0,0,0],Oh,_=class e extends la{static get ZERO(){return Oh||(Oh=new e(0,0,0),Object.freeze(Oh)),Oh}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Wr(t)?this.copy(t):(Vt.debug&&(Bt(t),Bt(r),Bt(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Vt.debug&&(Bt(t.x),Bt(t.y),Bt(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Bt(t)}angle(t){return b1(this,t)}cross(t){return ha(this,this,t),this.check()}rotateX({radians:t,origin:r=Qd}){return y1(this,this,r,t),this.check()}rotateY({radians:t,origin:r=Qd}){return _1(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=Qd}){return w1(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ch(this,this,t),this.check()}transformAsVector(t){return Rh(this,this,t),this.check()}transformByMatrix3(t){return Ph(this,this,t),this.check()}transformByMatrix2(t){return f1(this,this,t),this.check()}transformByQuaternion(t){return g1(this,this,t),this.check()}};function x1(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function M1(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=h*s-a*l,f=-h*o+a*c,d=l*o-s*c,m=r*u+n*f+i*d;return m?(m=1/m,e[0]=u*m,e[1]=(-h*n+i*l)*m,e[2]=(a*n-i*s)*m,e[3]=f*m,e[4]=(h*r-i*c)*m,e[5]=(-a*r+i*o)*m,e[6]=d*m,e[7]=(-l*r+n*c)*m,e[8]=(s*r-n*o)*m,e):null}function v1(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8];return t*(l*o-s*c)+r*(-l*i+s*a)+n*(c*i-o*a)}function tm(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1],m=r[2],p=r[3],g=r[4],y=r[5],w=r[6],M=r[7],x=r[8];return e[0]=f*n+d*s+m*l,e[1]=f*i+d*a+m*h,e[2]=f*o+d*c+m*u,e[3]=p*n+g*s+y*l,e[4]=p*i+g*a+y*h,e[5]=p*o+g*c+y*u,e[6]=w*n+M*s+x*l,e[7]=w*i+M*a+x*h,e[8]=w*o+M*c+x*u,e}function T1(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1];return e[0]=n,e[1]=i,e[2]=o,e[3]=s,e[4]=a,e[5]=c,e[6]=f*n+d*s+l,e[7]=f*i+d*a+h,e[8]=f*o+d*c+u,e}function E1(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=Math.sin(r),d=Math.cos(r);return e[0]=d*n+f*s,e[1]=d*i+f*a,e[2]=d*o+f*c,e[3]=d*s-f*n,e[4]=d*a-f*i,e[5]=d*c-f*o,e[6]=l,e[7]=h,e[8]=u,e}function em(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function I1(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[3]=h-y,e[6]=f+g,e[1]=h+y,e[4]=1-l-m,e[7]=d-p,e[2]=f-g,e[5]=d+p,e[8]=1-l-u,e}var rm;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(rm||(rm={}));var kI=Object.freeze([1,0,0,0,1,0,0,0,1]),Nt=class extends ca{static get IDENTITY(){return jI()}static get ZERO(){return qI()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return rm}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(kI)}fromObject(t){return this.check()}fromQuaternion(t){return I1(this,t),this.check()}fromMatrix4(t){return this.set(t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10])}set(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=i,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=s,this[8]=l,this.check()}determinant(){return v1(this)}transpose(){return x1(this,this),this.check()}invert(){return M1(this,this),this.check()}multiplyLeft(t){return tm(this,t,this),this.check()}multiplyRight(t){return tm(this,this,t),this.check()}rotate(t){return E1(this,this,t),this.check()}scale(t){return Array.isArray(t)?em(this,this,t):em(this,this,[t,t]),this.check()}translate(t){return T1(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=Eh(r||[-0,-0],t,this);break;case 3:n=Ph(r||[-0,-0,-0],t,this);break;case 4:n=d1(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return aa(n,t.length),n}},Bh,Nh=null;function qI(){return Bh||(Bh=new Nt([0,0,0,0,0,0,0,0,0]),Object.freeze(Bh)),Bh}function jI(){return Nh||(Nh=new Nt,Object.freeze(Nh)),Nh}function WI(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function A1(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function R1(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=t[9],f=t[10],d=t[11],m=t[12],p=t[13],g=t[14],y=t[15],w=r*a-n*s,M=r*c-i*s,x=r*l-o*s,v=n*c-i*a,T=n*l-o*a,I=i*l-o*c,A=h*p-u*m,F=h*g-f*m,C=h*y-d*m,P=u*g-f*p,D=u*y-d*p,at=f*y-d*g,z=w*at-M*D+x*P+v*C-T*F+I*A;return z?(z=1/z,e[0]=(a*at-c*D+l*P)*z,e[1]=(i*D-n*at-o*P)*z,e[2]=(p*I-g*T+y*v)*z,e[3]=(f*T-u*I-d*v)*z,e[4]=(c*C-s*at-l*F)*z,e[5]=(r*at-i*C+o*F)*z,e[6]=(g*x-m*I-y*M)*z,e[7]=(h*I-f*x+d*M)*z,e[8]=(s*D-a*C+l*A)*z,e[9]=(n*C-r*D-o*A)*z,e[10]=(m*T-p*x+y*w)*z,e[11]=(u*x-h*T-d*w)*z,e[12]=(a*F-s*P-c*A)*z,e[13]=(r*P-n*F+i*A)*z,e[14]=(p*M-m*v-g*w)*z,e[15]=(h*v-u*M+f*w)*z,e):null}function C1(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],h=e[9],u=e[10],f=e[11],d=e[12],m=e[13],p=e[14],g=e[15],y=t*s-r*o,w=t*a-n*o,M=r*a-n*s,x=l*m-h*d,v=l*p-u*d,T=h*p-u*m,I=t*T-r*v+n*x,A=o*T-s*v+a*x,F=l*M-h*w+u*y,C=d*M-m*w+p*y;return c*I-i*A+g*F-f*C}function nm(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=t[9],d=t[10],m=t[11],p=t[12],g=t[13],y=t[14],w=t[15],M=r[0],x=r[1],v=r[2],T=r[3];return e[0]=M*n+x*a+v*u+T*p,e[1]=M*i+x*c+v*f+T*g,e[2]=M*o+x*l+v*d+T*y,e[3]=M*s+x*h+v*m+T*w,M=r[4],x=r[5],v=r[6],T=r[7],e[4]=M*n+x*a+v*u+T*p,e[5]=M*i+x*c+v*f+T*g,e[6]=M*o+x*l+v*d+T*y,e[7]=M*s+x*h+v*m+T*w,M=r[8],x=r[9],v=r[10],T=r[11],e[8]=M*n+x*a+v*u+T*p,e[9]=M*i+x*c+v*f+T*g,e[10]=M*o+x*l+v*d+T*y,e[11]=M*s+x*h+v*m+T*w,M=r[12],x=r[13],v=r[14],T=r[15],e[12]=M*n+x*a+v*u+T*p,e[13]=M*i+x*c+v*f+T*g,e[14]=M*o+x*l+v*d+T*y,e[15]=M*s+x*h+v*m+T*w,e}function P1(e,t,r){let n=r[0],i=r[1],o=r[2],s,a,c,l,h,u,f,d,m,p,g,y;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(s=t[0],a=t[1],c=t[2],l=t[3],h=t[4],u=t[5],f=t[6],d=t[7],m=t[8],p=t[9],g=t[10],y=t[11],e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=h,e[5]=u,e[6]=f,e[7]=d,e[8]=m,e[9]=p,e[10]=g,e[11]=y,e[12]=s*n+h*i+m*o+t[12],e[13]=a*n+u*i+p*o+t[13],e[14]=c*n+f*i+g*o+t[14],e[15]=l*n+d*i+y*o+t[15]),e}function O1(e,t,r){let n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function B1(e,t,r,n){let i=n[0],o=n[1],s=n[2],a=Math.sqrt(i*i+o*o+s*s),c,l,h,u,f,d,m,p,g,y,w,M,x,v,T,I,A,F,C,P,D,at,z,yt;return a<1e-6?null:(a=1/a,i*=a,o*=a,s*=a,l=Math.sin(r),c=Math.cos(r),h=1-c,u=t[0],f=t[1],d=t[2],m=t[3],p=t[4],g=t[5],y=t[6],w=t[7],M=t[8],x=t[9],v=t[10],T=t[11],I=i*i*h+c,A=o*i*h+s*l,F=s*i*h-o*l,C=i*o*h-s*l,P=o*o*h+c,D=s*o*h+i*l,at=i*s*h+o*l,z=o*s*h-i*l,yt=s*s*h+c,e[0]=u*I+p*A+M*F,e[1]=f*I+g*A+x*F,e[2]=d*I+y*A+v*F,e[3]=m*I+w*A+T*F,e[4]=u*C+p*P+M*D,e[5]=f*C+g*P+x*D,e[6]=d*C+y*P+v*D,e[7]=m*C+w*P+T*D,e[8]=u*at+p*z+M*yt,e[9]=f*at+g*z+x*yt,e[10]=d*at+y*z+v*yt,e[11]=m*at+w*z+T*yt,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function N1(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+l*n,e[5]=s*i+h*n,e[6]=a*i+u*n,e[7]=c*i+f*n,e[8]=l*i-o*n,e[9]=h*i-s*n,e[10]=u*i-a*n,e[11]=f*i-c*n,e}function L1(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-l*n,e[1]=s*i-h*n,e[2]=a*i-u*n,e[3]=c*i-f*n,e[8]=o*n+l*i,e[9]=s*n+h*i,e[10]=a*n+u*i,e[11]=c*n+f*i,e}function F1(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[4],h=t[5],u=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+l*n,e[1]=s*i+h*n,e[2]=a*i+u*n,e[3]=c*i+f*n,e[4]=l*i-o*n,e[5]=h*i-s*n,e[6]=u*i-a*n,e[7]=f*i-c*n,e}function D1(e,t){let r=t[0],n=t[1],i=t[2],o=t[4],s=t[5],a=t[6],c=t[8],l=t[9],h=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(o*o+s*s+a*a),e[2]=Math.sqrt(c*c+l*l+h*h),e}function U1(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[1]=h+y,e[2]=f-g,e[3]=0,e[4]=h-y,e[5]=1-l-m,e[6]=d+p,e[7]=0,e[8]=f+g,e[9]=d-p,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function z1(e,t,r,n,i,o,s){let a=1/(r-t),c=1/(i-n),l=1/(o-s);return e[0]=o*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(i+n)*c,e[10]=(s+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*l,e[15]=0,e}function HI(e,t,r,n,i){let o=1/Math.tan(t/2);if(e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let s=1/(n-i);e[10]=(i+n)*s,e[14]=2*i*n*s}else e[10]=-1,e[14]=-2*n;return e}var V1=HI;function $I(e,t,r,n,i,o,s){let a=1/(t-r),c=1/(n-i),l=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(i+n)*c,e[14]=(s+o)*l,e[15]=1,e}var G1=$I;function k1(e,t,r,n){let i,o,s,a,c,l,h,u,f,d,m=t[0],p=t[1],g=t[2],y=n[0],w=n[1],M=n[2],x=r[0],v=r[1],T=r[2];return Math.abs(m-x)<1e-6&&Math.abs(p-v)<1e-6&&Math.abs(g-T)<1e-6?WI(e):(u=m-x,f=p-v,d=g-T,i=1/Math.sqrt(u*u+f*f+d*d),u*=i,f*=i,d*=i,o=w*d-M*f,s=M*u-y*d,a=y*f-w*u,i=Math.sqrt(o*o+s*s+a*a),i?(i=1/i,o*=i,s*=i,a*=i):(o=0,s=0,a=0),c=f*a-d*s,l=d*o-u*a,h=u*s-f*o,i=Math.sqrt(c*c+l*l+h*h),i?(i=1/i,c*=i,l*=i,h*=i):(c=0,l=0,h=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=s,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=h,e[10]=d,e[11]=0,e[12]=-(o*m+s*p+a*g),e[13]=-(c*m+l*p+h*g),e[14]=-(u*m+f*p+d*g),e[15]=1,e)}function q1(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function j1(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function W1(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function H1(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function $1(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=n*s,e[2]=i*s,e[3]=o*s,e}function Y1(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function K1(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=s+n*(r[2]-s),e[3]=a+n*(r[3]-a),e}function X1(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,e}var sm;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(sm||(sm={}));var KI=45*Math.PI/180,XI=1,im=.1,om=500,ZI=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),ot=class extends ca{static get IDENTITY(){return QI()}static get ZERO(){return JI()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return sm}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this[9]=h,this[10]=u,this[11]=f,this[12]=d,this[13]=m,this[14]=p,this[15]=g,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=s,this[6]=h,this[7]=m,this[8]=n,this[9]=a,this[10]=u,this[11]=p,this[12]=i,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(ZI)}fromObject(t){return this.check()}fromQuaternion(t){return U1(this,t),this.check()}fromMatrix3(t){return this.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1)}frustum(t){let{left:r,right:n,bottom:i,top:o,near:s=im,far:a=om}=t;return a===1/0?t3(this,r,n,i,o,s):z1(this,r,n,i,o,s,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return k1(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:o,near:s=im,far:a=om}=t;return G1(this,r,n,i,o,s,a),this.check()}orthographic(t){let{fovy:r=KI,aspect:n=XI,focalDistance:i=1,near:o=im,far:s=om}=t;Z1(r);let a=r/2,c=i*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:s})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=t;return Z1(r),V1(this,r,n,i,o),this.check()}determinant(){return C1(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*o,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*o,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*o,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*o,t[2]=this[2]*s,t[3]=this[4]*i,t[4]=this[5]*o,t[5]=this[6]*s,t[6]=this[8]*i,t[7]=this[9]*o,t[8]=this[10]*s,t}transpose(){return A1(this,this),this.check()}invert(){return R1(this,this),this.check()}multiplyLeft(t){return nm(this,t,this),this.check()}multiplyRight(t){return nm(this,this,t),this.check()}rotateX(t){return N1(this,this,t),this.check()}rotateY(t){return L1(this,this,t),this.check()}rotateZ(t){return F1(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return B1(this,this,t,r),this.check()}scale(t){return O1(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return P1(this,this,t),this.check()}transform(t,r){return t.length===4?(r=X1(r||[-0,-0,-0,-0],t,this),aa(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=Ih(r||[-0,-0],t,this);break;case 3:i=Ch(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return aa(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=Ah(r||[-0,-0],t,this);break;case 3:n=Rh(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return aa(n,t.length),n}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},Lh,Fh;function JI(){return Lh||(Lh=new ot([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Lh)),Lh}function QI(){return Fh||(Fh=new ot,Object.freeze(Fh)),Fh}function Z1(e){if(e>Math.PI*2)throw Error("expected radians")}function t3(e,t,r,n,i,o){let s=2*o/(r-t),a=2*o/(i-n),c=(r+t)/(r-t),l=(i+n)/(i-n),h=-1,u=-1,f=-2*o;return e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=h,e[11]=u,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}function J1(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function am(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function cm(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=r[0],c=r[1],l=r[2],h=r[3];return e[0]=n*h+s*a+i*l-o*c,e[1]=i*h+s*c+o*a-n*l,e[2]=o*h+s*l+n*c-i*a,e[3]=s*h-n*a-i*c-o*l,e}function Q1(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=i*c+o*a,e[2]=o*c-i*a,e[3]=s*c-n*a,e}function t_(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=i*c+s*a,e[2]=o*c+n*a,e[3]=s*c-i*a,e}function e_(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=i*c-n*a,e[2]=o*c+s*a,e[3]=s*c-o*a,e}function r_(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function n_(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3],c=r[0],l=r[1],h=r[2],u=r[3],f,d,m,p,g;return f=i*c+o*l+s*h+a*u,f<0&&(f=-f,c=-c,l=-l,h=-h,u=-u),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),m=Math.sin((1-n)*d)/g,p=Math.sin(n*d)/g):(m=1-n,p=n),e[0]=m*i+p*c,e[1]=m*o+p*l,e[2]=m*s+p*h,e[3]=m*a+p*u,e}function i_(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o,a=s?1/s:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-i*a,e[3]=o*a,e}function o_(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function s_(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let o=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[o*3+o]-t[s*3+s]+1),e[i]=.5*n,n=.5/n,e[3]=(t[o*3+s]-t[s*3+o])*n,e[o]=(t[o*3+i]+t[i*3+o])*n,e[s]=(t[s*3+i]+t[i*3+s])*n}return e}var a_=q1;var c_=j1,l_=Y1,h_=K1,u_=W1;var f_=H1;var e3=$1;var d_=(function(){let e=m1(),t=Jd(1,0,0),r=Jd(0,1,0);return function(n,i,o){let s=pc(i,o);return s<-.999999?(ha(e,t,i),S1(e)<1e-6&&ha(e,r,i),p1(e,e),am(n,e,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(ha(e,i,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+s,e3(n,n))}})();var $r=class extends Ui{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return s_(this,t),this.check()}fromEuler(t){switch(this.identity(),t.order){case"xyz":return this.rotateX(t.x).rotateY(t.y).rotateZ(t.z);case"yxz":return this.rotateY(t.y).rotateX(t.x).rotateZ(t.z);case"zxy":return this.rotateZ(t.z).rotateX(t.x).rotateY(t.y);case"zyx":return this.rotateZ(t.z).rotateY(t.y).rotateX(t.x);case"yzx":return this.rotateY(t.y).rotateZ(t.z).rotateX(t.x);case"xzy":return this.rotateX(t.x).rotateZ(t.z).rotateY(t.y);default:throw new Error("Unknown Euler angle order")}}fromAxisRotation(t,r){return am(this,t,r),this.check()}identity(){return J1(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Bt(t)}get y(){return this[1]}set y(t){this[1]=Bt(t)}get z(){return this[2]}set z(t){this[2]=Bt(t)}get w(){return this[3]}set w(t){this[3]=Bt(t)}len(){return u_(this)}lengthSquared(){return f_(this)}dot(t){return l_(this,t)}rotationTo(t,r){return d_(this,t,r),this.check()}add(t){return a_(this,this,t),this.check()}calculateW(){return r_(this,this),this.check()}conjugate(){return o_(this,this),this.check()}invert(){return i_(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(h_(this,t,r,n),this.check())}multiplyRight(t){return cm(this,this,t),this.check()}multiplyLeft(t){return cm(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return Q1(this,this,t),this.check()}rotateY(t){return t_(this,this,t),this.check()}rotateZ(t){return e_(this,this,t),this.check()}scale(t){return c_(this,this,t),this.check()}slerp(t,r,n){let i,o,s;return arguments.length===2?(i=this,o=t,s=r):(i=t,o=r,s=n),n_(this,i,o,s),this.check()}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};function Dh(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.sin(i),h=Math.cos(i),u=a/s,f=c<.9?s/Math.sqrt(1-c*l*l):s/Math.hypot(h,u*l),d=(f+o)*h*Math.cos(n),m=(f+o)*h*Math.sin(n),p=(f*(c<.9?1-c:u*u)+o)*l;return Vi(r,d,m,p)}function Uh(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.hypot(n,i),h=Math.hypot(n,i,o);if(!(h>0)||!Number.isFinite(h))return!1;if(c===0)return Vi(r,l===0?0:Math.atan2(i,n),Math.atan2(o,l),h-s);if(l===0)return Vi(r,0,Math.sign(o)*Math.PI/2,Math.abs(o)-a);let u=l/s,f=o/a;if(u*u+f*f<1-16*Number.EPSILON)return r3(n,i,o,l,s,a,r);if(c>=.9)return m_(n,i,o,l,s,a,r);let d=o/h,m=l/h,p=1/Math.sqrt(1-c*(2-c)*m*m),g=m*(1-c)*p,y=d*p;for(let w=0;w<30;w++){let M=s/Math.sqrt(1-c*y*y),x=l*g+o*y-M*(1-c*y*y),v=c*M/(M+x);p=1/Math.sqrt(1-v*(2-v)*m*m);let T=m*(1-v)*p,I=d*p;if(Math.abs(I*g-T*y)<=1e-12){if(!Number.isFinite(x)||!Number.isFinite(I)||!Number.isFinite(T))break;return Vi(r,Math.atan2(i,n),Math.atan2(I,Math.abs(T)),x)}g=T,y=I}return m_(n,i,o,l,s,a,r)}function r3(e,t,r,n,i,o,s){let a=o/i,c=a*a,l=n/i,h=r/i,u=1-c;if(!(c>0)||a>1)return!1;if(r===0)return l<u?!1:Vi(s,Math.atan2(t,e),0,n-i);let f=i*i,d=o*o,m=Number.isFinite(f)&&f>0?(d-c*f+zi(o,o,d)-c*zi(i,i,f)-zi(c,f,c*f))/f:0,p=n*n,g=e*e,y=t*t,w=g+y,M=Number.isFinite(p)&&p>0?(w-p+lm(g,y,w)+zi(e,e,g)+zi(t,t,y)-zi(n,n,p))/(2*n):0,x=i*c,v=n-i+x,T=M+lm(n-i,x,v)+zi(i,c,x)+i*m,I=Math.abs(h)*a;if(!(I>0))return!1;let A=0,F=c,C=Math.max(I,l-u);C>A&&C<F||(C=F/2);for(let P=0;P<128;P++){let D=u+C,at=l/D,z=I/C,yt=i*C,St=v-yt,jr=(St+(lm(v,-yt,St)+T-zi(i,C,yt)))/(i*D)*(at+1),ee=jr+z*z;if(Math.abs(ee)<=4*Number.EPSILON*(Math.abs(jr)+z*z)||F-A<=4*Number.EPSILON*C){let ln=Math.atan2(h/C,l/D),br=Math.sin(ln),Sh=Math.cos(ln);return Vi(s,Math.atan2(t,e),ln,n*Sh+r*br-i*Math.hypot(Sh,a*br))}ee>0?A=C:F=C;let ri=-2*(at*at/D+z*z/C),Fn=C-ee/ri,oa=Number.isFinite(Fn)&&Fn>A&&Fn<F?Fn:A+(F-A)/2;if(oa===C){let ln=Math.atan2(h/C,l/D);return Vi(s,Math.atan2(t,e),ln,n*Math.cos(ln)+r*Math.sin(ln)-i*Math.hypot(Math.cos(ln),a*Math.sin(ln)))}C=oa}return!1}function lm(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function zi(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}function m_(e,t,r,n,i,o,s){let a=o/i,c=a*a,l=n/i,h=r/i,u=Math.hypot(l,r/o);if(!Number.isFinite(u)||u<1-8*Number.EPSILON||!(c>0))return!1;let f=0,d=Math.hypot(l,h*a);if(!Number.isFinite(d))return!1;let m=u<=1+8*Number.EPSILON?0:d/2;for(let p=0;p<96;p++){let g=1+m,y=c+m,w=l/g,M=h*a/y,x=Math.hypot(w,M),v=x-1;if(Math.abs(v)<=4*Number.EPSILON){let A=Math.atan2(h/y,l/g),F=Math.sin(A),C=Math.cos(A),P=n*C+r*F-i*Math.hypot(C,a*F);return Vi(s,Math.atan2(t,e),A,P)}v>0?f=m:d=m;let T=-(w*w/g+M*M/y)/x,I=m-v/T;m=Number.isFinite(I)&&I>f&&I<d?I:(f+d)/2}return!1}function Vi(e,t,r,n){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)?!1:(e.x=t,e.y=r,e.z=n,!0)}var ni=6356752314245179e-9,n3={radii:[6378137,6378137,ni],radiiSquared:[6378137*6378137,6378137*6378137,ni*ni],oneOverRadii:[1/6378137,1/6378137,1/ni],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ni*ni)],maximumRadius:Math.max(6378137,6378137,ni),centerToleranceSquared:.1};function hm(e){return e}var t6=new _;function i3(e,t=[],r=hm){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function um(e,t=[]){return i3(e,t,Vt._cartographicRadians?hm:$d)}function fm(e,t,r,n){let i=Vt._cartographicRadians?hm:Yd,o=i(e),s=i(t);return"longitude"in n?(n.longitude=o,n.latitude=s,n.height=r):"x"in n?(n.x=o,n.y=s,n.z=r):(n[0]=o,n[1]=s,n[2]=r),n}function p_(){return{eastX:0,eastY:1,northZ:1,upX:1,upY:0,upZ:0}}function g_(e,t,r){let n=e.x,i=e.y,o=e.z,s=t.x,a=t.y,c=t.z;return o!==0?!1:o3(r,n,i,s*i-a*n,s,a,c)}function y_(e,t,r,n,i,o){let s=dm(r),a=dm(n),c=dm(i),l=Math.abs(s),h=Math.abs(a),u=Math.abs(c);if(!l||!h||!u||l===h||l===u||h===u||(l%3+1===h?1:-1)*Math.sign(s*a*c)!==1||!Array.isArray(o)&&o.length<16)return!1;let d=e.eastX,m=e.eastY,p=e.northZ,g=e.upX,y=e.upY,w=e.upZ,M=-w*m,x=w*d,v=t.x,T=t.y,I=t.z,A=(l===1?d:l===2?M:g)*Math.sign(s),F=(l===1?m:l===2?x:y)*Math.sign(s),C=(l===1?0:l===2?p:w)*Math.sign(s),P=(h===1?d:h===2?M:g)*Math.sign(a),D=(h===1?m:h===2?x:y)*Math.sign(a),at=(h===1?0:h===2?p:w)*Math.sign(a),z=(u===1?d:u===2?M:g)*Math.sign(c),yt=(u===1?m:u===2?x:y)*Math.sign(c),St=(u===1?0:u===2?p:w)*Math.sign(c);return!Number.isFinite(A)||!Number.isFinite(F)||!Number.isFinite(C)||!Number.isFinite(P)||!Number.isFinite(D)||!Number.isFinite(at)||!Number.isFinite(z)||!Number.isFinite(yt)||!Number.isFinite(St)||!Number.isFinite(v)||!Number.isFinite(T)||!Number.isFinite(I)||o instanceof Float32Array&&(!Number.isFinite(Math.fround(A))||!Number.isFinite(Math.fround(F))||!Number.isFinite(Math.fround(C))||!Number.isFinite(Math.fround(P))||!Number.isFinite(Math.fround(D))||!Number.isFinite(Math.fround(at))||!Number.isFinite(Math.fround(z))||!Number.isFinite(Math.fround(yt))||!Number.isFinite(Math.fround(St))||!Number.isFinite(Math.fround(v))||!Number.isFinite(Math.fround(T))||!Number.isFinite(Math.fround(I)))?!1:(o[0]=A,o[1]=F,o[2]=C,o[3]=0,o[4]=P,o[5]=D,o[6]=at,o[7]=0,o[8]=z,o[9]=yt,o[10]=St,o[11]=0,o[12]=v,o[13]=T,o[14]=I,o[15]=1,!0)}function dm(e){switch(e){case"east":return 1;case"west":return-1;case"north":return 2;case"south":return-2;case"up":return 3;case"down":return-3;default:return 0}}function o3(e,t,r,n,i,o,s){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)?!1:(e.eastX=t,e.eastY=r,e.northZ=n,e.upX=i,e.upY=o,e.upZ=s,!0)}var __=1e-14,s3=new _,w_=p_(),b_={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},mm={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},ua={east:new _,north:new _,up:new _,west:new _,south:new _,down:new _},a3=new _,c3=new _,l3=new _;function pm(e,t,r,n,i,o){let s=b_[t]&&b_[t][r];pe(s&&(!n||n===s));let a,c,l,h=s3.copy(i),u=Sr(h.x,0,__)&&Sr(h.y,0,__),f=e.radii;if(f.x===f.y&&f.x>0&&f.z>0&&f.z<=f.x&&(!u||h.z!==0)){let{east:F,up:C}=ua;if(u?(F.set(0,1,0),C.set(0,0,Math.sign(h.z))):(F.set(-h.y,h.x,0).normalize(),e.geodeticSurfaceNormal(h,C)),!g_(F,C,w_)||!y_(w_,h,t,r,n,o))throw new Error("Unsupported local frame");return o}if(u){let F=Math.sign(h.z);a=a3.fromArray(mm[t]),t!=="east"&&t!=="west"&&a.scale(F),c=c3.fromArray(mm[r]),r!=="east"&&r!=="west"&&c.scale(F),l=l3.fromArray(mm[n]),n!=="east"&&n!=="west"&&l.scale(F)}else{let{up:F,east:C,north:P}=ua;C.set(-h.y,h.x,0).normalize(),e.geodeticSurfaceNormal(h,F),P.copy(F).cross(C);let{down:D,west:at,south:z}=ua;D.copy(F).scale(-1),at.copy(C).scale(-1),z.copy(P).scale(-1),a=ua[t],c=ua[r],l=ua[n]}let d=a.x,m=a.y,p=a.z,g=c.x,y=c.y,w=c.z,M=l.x,x=l.y,v=l.z,T=h.x,I=h.y,A=h.z;return o[0]=d,o[1]=m,o[2]=p,o[3]=0,o[4]=g,o[5]=y,o[6]=w,o[7]=0,o[8]=M,o[9]=x,o[10]=v,o[11]=0,o[12]=T,o[13]=I,o[14]=A,o[15]=1,o}var S_=new _,h3=new _,u3=new _;function x_(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=t,s=e,a="x"in e?s.x:e[0],c="x"in e?s.y:e[1],l="x"in e?s.z:e[2];if(!Number.isFinite(a)||!Number.isFinite(c)||!Number.isFinite(l))return;S_.set(a,c,l);let h=n.x,u=n.y,f=n.z,d=a*a*h*h,m=c*c*u*u,p=l*l*f*f,g=d+m+p,y=Math.sqrt(1/g);if(!Number.isFinite(y)||!Number.isFinite(g))return;let w=h3;if(w.set(a,c,l).scale(y),g<o)return zh(r,w.x,w.y,w.z);let M=i.x,x=i.y,v=i.z,T=u3;T.set(w.x*M*2,w.y*x*2,w.z*v*2);let I=(1-y)*S_.len()/(.5*T.len()),A=0,F,C,P,D;for(let at=0;at<64;at++){I-=A,F=1/(1+I*M),C=1/(1+I*x),P=1/(1+I*v);let z=F*F,yt=C*C,St=P*P,wr=z*F,jr=yt*C,ee=St*P;if(D=d*z+m*yt+p*St-1,!Number.isFinite(D))return;if(Math.abs(D)<=Rt.EPSILON12)return zh(r,a*F,c*C,l*P);let Fn=-2*(d*wr*M+m*jr*x+p*ee*v);if(!Number.isFinite(Fn)||Fn===0||(A=D/Fn,!Number.isFinite(A)))return}}function zh(e,t,r,n){if(Wr(e))e[0]=t,e[1]=r,e[2]=n;else{let i=e;i.x=t,i.y=r,i.z=n}return e}var er={x:0,y:0,z:0},Vh=new _,M_=new _,m3=new _,hn=new _,p3=new _,gc=new _,rt=class e{static fromSpheroid(t){let{semiMajorAxis:r,semiMinorAxis:n}=t;return v_(r,n),new e(r,r,n)}constructor(t=0,r=0,n=0){this.centerToleranceSquared=Rt.EPSILON1,pe(t>=0),pe(r>=0),pe(n>=0),this.radii=new _(t,r,n),this.radiiSquared=new _(t*t,r*r,n*n),this.radiiToTheFourth=new _(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new _(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new _(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),t===r&&n>0&&n<=t&&Number.isFinite(this.radiiSquared.x)&&this.radiiSquared.z>0&&(this.spheroidGeometry=Object.freeze({semiMajorAxis:t,semiMinorAxis:n,eccentricitySquared:1-this.radiiSquared.z/this.radiiSquared.x})),Object.freeze(this)}toSpheroid(){let{x:t,y:r,z:n}=this.radii;if(t!==r)throw new Error("Spheroid requires equal X/Y radii");return v_(t,n),Object.freeze({semiMajorAxis:t,semiMinorAxis:n})}equals(t){return this===t||!!(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){if(this.spheroidGeometry){let a=um(t,gc);return er.x=a[0],er.y=a[1],er.z=a[2],Dh(er,this.spheroidGeometry)?zh(r,er.x,er.y,er.z):void 0}let n=M_,i=m3,[,,o]=t;this.geodeticSurfaceNormalCartographic(t,n),i.copy(this.radiiSquared).scale(n);let s=Math.sqrt(n.dot(i));return i.scale(1/s),n.scale(o),i.add(n),i.to(r)}cartesianToCartographic(t,r=[0,0,0]){let n=t,i="x"in t?n.x:t[0],o="x"in t?n.y:t[1],s="x"in t?n.z:t[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s))return;if(this.spheroidGeometry&&Number.isFinite(i*i+o*o+s*s)&&Number.isFinite(this.oneOverRadiiSquared.x)&&Number.isFinite(this.oneOverRadiiSquared.z)){if(er.x=i,er.y=o,er.z=s,!Uh(er,this.spheroidGeometry))return;let d=i===0&&o===0?Math.atan2(o,i):er.x;return fm(d,er.y,er.z,r)}gc.set(i,o,s);let a=this.scaleToGeodeticSurface(gc,hn);if(!a)return;let c=this.geodeticSurfaceNormal(a,M_),l=p3;l.copy(gc).subtract(a);let h=Math.atan2(c.y,c.x),u=Math.atan2(c.z,Math.hypot(c.x,c.y)),f=Math.sign(pc(l,gc))*Zd(l);return fm(h,u,f,r)}eastNorthUpToFixedFrame(t,r=new ot){return pm(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,i,o=new ot){return pm(this,t,r,n,i,o)}geocentricSurfaceNormal(t,r=[0,0,0]){return Vh.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=um(t),i=n[0],o=n[1],s=Math.cos(o);return Vh.set(s*Math.cos(i),s*Math.sin(i),Math.sin(o)).normalize(),Vh.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return Vh.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return x_(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){hn.from(t);let n=hn.x,i=hn.y,o=hn.z,s=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*s.x+i*i*s.y+o*o*s.z);return hn.multiplyByScalar(a).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return hn.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return hn.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){pe(Sr(this.radii.x,this.radii.y,Rt.EPSILON15)),pe(this.radii.z>0),hn.from(t);let i=hn.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-r))return hn.set(0,0,i).to(n)}};rt.WGS84=new rt(6378137,6378137,ni);function v_(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0||t>e)throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis")}var y6=new _,_6=new _;var yc=new _,T_=new _,Ee=class e{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new _,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=yc.from(r),this.center=new _().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,o=t.radius,s=yc.copy(i).subtract(r),a=s.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return t.clone();let c=(n+a+o)*.5;return T_.copy(s).scale((-n+c)/a).add(r),this.center.copy(T_),this.radius=c,this}expand(t){let n=yc.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=D1(yc,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=yc.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,o=t.normal.dot(r)+t.distance;return o<-n?"outside":o<n?"intersecting":"inside"}};var g3=new _,y3=new _,Gh=new _,kh=new _,qh=new _,_3=new _,w3=new _,ii={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Dn=class e{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new _().from(t),this.halfAxes=new Nt(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new _(t).len(),new _(r).len(),new _(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new _(t).normalize(),o=new _(r).normalize(),s=new _(n).normalize();return new $r().fromMatrix3(new Nt([...i,...o,...s]))}fromCenterHalfSizeQuaternion(t,r,n){let i=new $r(n),o=new Nt().fromQuaternion(i);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new _().from(t),this.halfAxes=o,this}clone(){return new e(this.center,this.halfAxes)}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Ee){let r=this.halfAxes,n=r.getColumn(0,Gh),i=r.getColumn(1,kh),o=r.getColumn(2,qh),s=g3.copy(n).add(i).add(o);return t.center.copy(this.center),t.radius=s.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,o=n.x,s=n.y,a=n.z,c=Math.abs(o*i[ii.COLUMN0ROW0]+s*i[ii.COLUMN0ROW1]+a*i[ii.COLUMN0ROW2])+Math.abs(o*i[ii.COLUMN1ROW0]+s*i[ii.COLUMN1ROW1]+a*i[ii.COLUMN1ROW2])+Math.abs(o*i[ii.COLUMN2ROW0]+s*i[ii.COLUMN2ROW1]+a*i[ii.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?"outside":l>=c?"inside":"intersecting"}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=y3.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,Gh),o=n.getColumn(1,kh),s=n.getColumn(2,qh),a=i.magnitude(),c=o.magnitude(),l=s.magnitude();i.normalize(),o.normalize(),s.normalize();let h=0,u;return u=Math.abs(r.dot(i))-a,u>0&&(h+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(h+=u*u),u=Math.abs(r.dot(s))-l,u>0&&(h+=u*u),h}computePlaneDistances(t,r,n=[-0,-0]){let i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,a=this.halfAxes,c=a.getColumn(0,Gh),l=a.getColumn(1,kh),h=a.getColumn(2,qh),u=_3.copy(c).add(l).add(h).add(s),f=w3.copy(u).subtract(t),d=r.dot(f);return i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),n[0]=i,n[1]=o,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,Gh);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,kh);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,qh);return i.transformAsPoint(t),this.halfAxes=new Nt([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}};var E_=new _,I_=new _,ne=class e{constructor(t=[0,0,1],r=0){this.normal=new _,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return pe(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=E_.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),pe(Sr(this.normal.len(),1)),this.distance=i,this}clone(){return new e(this.normal,this.distance)}equals(t){return Sr(this.distance,t.distance)&&Sr(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=I_.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=E_.from(t),i=this.getPointDistance(n),o=I_.copy(this.normal).scale(i);return n.subtract(o).to(r)}intersectWithRay(t,r=new _){let n=t.origin,i=t.direction,o=this.normal,s=o.dot(i);if(Math.abs(s)<Rt.EPSILON15)return;let a=(-this.distance-o.dot(n))/s;if(!(a<0))return r.copy(i).multiplyByScalar(a).add(n)}};var A_=[new _([1,0,0]),new _([0,1,0]),new _([0,0,1])],R_=new _,b3=new _,ge=class e{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*A_.length;let r=t.center,n=t.radius,i=0;for(let o of A_){let s=this.planes[i],a=this.planes[i+1];s||(s=this.planes[i]=new ne),a||(a=this.planes[i+1]=new ne);let c=R_.copy(o).scale(-n).add(r);s.fromPointNormal(c,o);let l=R_.copy(o).scale(n).add(r),h=b3.copy(o).negate();a.fromPointNormal(l,h),i+=2}return this}computeVisibility(t){let r="inside";for(let n of this.planes)switch(t.intersectPlane(n)){case"outside":return"outside";case"intersecting":r="intersecting";break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(pe(Number.isFinite(r),"parentPlaneMask is required."),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let n=e.MASK_INSIDE,i=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&(r&s)===0)continue;let a=i[o],c=t.intersectPlane(a);if(c==="outside")return e.MASK_OUTSIDE;c==="intersecting"&&(n|=s)}return n}};ge.MASK_OUTSIDE=4294967295;ge.MASK_INSIDE=0;ge.MASK_INDETERMINATE=2147483647;var K6=new _,X6=new _,Z6=new _,J6=new _,Q6=new _;var oL=new _,sL=new _,aL=new _,cL=new _,lL=new _,hL=new _,uL=new _,fL=new _,dL=new _,mL=new _,pL=new _,gL=new _;var wL=new Nt,bL=new Nt,SL=new Nt,xL=new Nt,ML=new Nt;var RL=new _,CL=new _,PL=new _,OL=new _,BL=new _,NL=new Nt,LL={diagonal:new Nt,unitary:new Nt};var v3=new _,gm=new _,T3=new ot,E3=new _,_c=class{constructor(t,r=rt.WGS84){let n=r.scaleToGeodeticSurface(t,v3),i=r.eastNorthUpToFixedFrame(n,T3);this._origin=new _(n),this._xAxis=new _(gm.from(i.getColumn(0))),this._yAxis=new _(gm.from(i.getColumn(1)));let o=new _(gm.from(i.getColumn(2)));this._plane=new ne().fromPointNormal(this._origin,o)}projectPointToNearestOnPlane(t,r){r||(r=new Hr);let i=this._plane.projectPointOntoPlane(t,E3).subtract(this._origin),o=this._xAxis.dot(i),s=this._yAxis.dot(i);return r.x=o,r.y=s,r}get plane(){return this._plane}get origin(){return this._origin}get xAxis(){return this._xAxis}get yAxis(){return this._yAxis}get zAxis(){return this._plane.normal}};var fa=class{constructor(t,r,n,i){this.west=t,this.south=r,this.east=n,this.north=i}static center(t,r){r||(r=new _);let n=t.east,i=t.west;n<i&&(n+=Rt.TWO_PI);let o=Kd((i+n)*.5,"negative-pi-to-pi"),s=(t.south+t.north)*.5;return r.x=o,r.y=s,r.z=0,r}get width(){let t=this.east,r=this.west;return t<r&&(t+=Rt.TWO_PI),t-r}};var I3=new _,A3=new _,R3=new _,C3=new _,P3=new _,O3=new _,B3=new _,N3=new _,O_=new _,L3=new _,B_=new _,F3=new _,D3=new Hr,U3=new Hr,z3=new Hr,V3=new Hr,G3=new Hr,k3=new ne,q3=new _,j3=new _,W3=new _,H3=new _,$3=new Hr,Y3=new _,K3=new _,X3=new _(1,0,0),Z3=new _(0,0,1);function wc(e,t=rt.WGS84,r={}){if(!e||e.length!==6||e.some(w=>!Number.isFinite(w)))throw new Error("makeOBBFromRegion: region must contain exactly six finite numbers");let n=r.units==="degrees"?vh(1):1,[i,o,s,a,c,l]=e;if(c>l)throw new Error("makeOBBFromRegion: minimumHeight must not exceed maximumHeight");let h=o*n,u=a*n,f=N_(i*n),d=N_(s*n);s*n-i*n>=Rt.TWO_PI-1e-12&&(d=f+Rt.TWO_PI);let p=1e-12;if(h>u||h<-Rt.PI_OVER_TWO-p||u>Rt.PI_OVER_TWO+p)throw new Error("makeOBBFromRegion: latitude must be within [-\u03C0/2, \u03C0/2] and south \u2264 north");let g=Math.max(-Rt.PI_OVER_TWO,Math.min(Rt.PI_OVER_TWO,h)),y=Math.max(-Rt.PI_OVER_TWO,Math.min(Rt.PI_OVER_TWO,u));return J3([f,g,d,y,c,l],t,r.transform)}function N_(e){let t=((e+Math.PI)%Rt.TWO_PI+Rt.TWO_PI)%Rt.TWO_PI-Math.PI;return t===-Math.PI&&e>0?Math.PI:t}function J3(e,t,r){let n=new Dn,[i,o,s,a,c,l]=e,h=ke(a),u=ke(o),f,d,m,p,g,y,w,M=new fa(i,o,s,a),x=fa.center(M,A3),v=new _([ke(x.x),ke(x.y),0]),T=x.x,I=v.x;if(M.width<=Rt.PI){let oa=ke(i),ln=t.cartographicToCartesian(v),br=new _c(ln,t),Sh=u<0&&h>0?0:v.y,YE=R3.copy([I,h,l]),kd=C3.copy([oa,h,l]),KE=P3.copy([oa,Sh,l]),qd=O3.copy([oa,u,l]),XE=B3.copy([I,u,l]),ZE=t.cartographicToCartesian(YE,N3),jd=t.cartographicToCartesian(kd,O_),JE=t.cartographicToCartesian(KE,L3),Wd=t.cartographicToCartesian(qd,B_),QE=t.cartographicToCartesian(XE,F3),tI=br.projectPointToNearestOnPlane(ZE,D3),n1=br.projectPointToNearestOnPlane(jd,U3),eI=br.projectPointToNearestOnPlane(JE,z3),i1=br.projectPointToNearestOnPlane(Wd,V3),rI=br.projectPointToNearestOnPlane(QE,G3);return p=Math.min(n1.x,eI.x,i1.x),f=-p,d=Math.max(n1.y,tI.y),g=Math.min(i1.y,rI.y),kd.z=qd.z=c,jd=t.cartographicToCartesian(kd,O_),Wd=t.cartographicToCartesian(qd,B_),w=br.plane,y=Math.min(w.getPointDistance(jd),w.getPointDistance(Wd)),m=l,L_(D_(br.origin,br.xAxis,br.yAxis,br.zAxis,p,f,g,d,y,m,n),r)}let A=ke(s),F=o>0,C=a<0,P=F?u:C?h:0,D=t.cartographicToCartesian([I,P,l],q3);D.z=0;let z=Math.abs(D.x)<Rt.EPSILON10&&Math.abs(D.y)<Rt.EPSILON10?X3:j3.copy(D).normalize(),yt=Z3,St=W3.copy(z).cross(yt);w=k3.fromPointNormal(D,z);let wr=t.cartographicToCartesian([ke(T+Rt.PI_OVER_TWO),P,l],H3);f=w.projectPointOntoPlane(wr,$3).dot(St),p=-f;let ee=C?c:l,ri=F?c:l;d=F_(t,h,ee,!0),g=F_(t,u,ri,!1);let Fn=t.cartographicToCartesian([A,P,l],K3);return y=w.getPointDistance(Fn),m=0,L_(D_(D,St,yt,z,p,f,g,d,y,m,n),r)}function L_(e,t){if(!t)return e;let r=[0,1,2].map(a=>e.halfAxes.getColumn(a,new _)),n=t.transformAsPoint(e.center),i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let a=0;a<8;a++){let c=new _(n);for(let l=0;l<3;l++){let h=t.transformAsVector(r[l]);c.add(new _(h).scale((a&1<<l)===0?-1:1))}for(let l=0;l<3;l++)i[l]=Math.min(i[l],c[l]),o[l]=Math.max(o[l],c[l])}e.center.copy(i).add(o).scale(.5);let s=new _(o).subtract(i).scale(.5);return e.halfAxes=new Nt().set(s.x,0,0,0,s.y,0,0,0,s.z),e}function F_(e,t,r,n){let i=n?-1/0:1/0;for(let o of[0,90,180,270]){let s=e.cartographicToCartesian([o,t,r],Y3).z;i=n?Math.max(i,s):Math.min(i,s)}return i}function D_(e,t,r,n,i,o,s,a,c,l,h){let u=h.center,f=h.halfAxes;f.setColumn(0,t),f.setColumn(1,r),f.setColumn(2,n);let d=I3.set((i+o)/2,(s+a)/2,(c+l)/2).transformByMatrix3(f),m=(o-i)/2,p=(a-s)/2,g=(l-c)/2;return f[0]*=m,f[1]*=m,f[2]*=m,f[3]*=p,f[4]*=p,f[5]*=p,f[6]*=g,f[7]*=g,f[8]*=g,u.copy(e).add(d),h}Sc();fn();var uu=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var fu=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new uu(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var ts=class{_list;_sentinel;_trimTiles;constructor(){this._list=new fu,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let i=r._cacheNode;i&&(this._list.remove(i),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let i=this._list,o=this._sentinel,s=i.head;for(;s!==o&&(t.gpuMemoryUsageInBytes>t.cacheBytes||n);){let a=s.item;s=s.next,this.unloadTile(t,a,r)}}trim(){this._trimTiles=!0}};fn();function Oc(e,t){un(e),un(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:o}}=e,s=new ot(i);switch(r&&s.translate(r),n){case"Z":break;case"Y":let f=new ot().rotateX(Math.PI/2);s=s.multiplyRight(f);break;case"X":let d=new ot().rotateY(-Math.PI/2);s=s.multiplyRight(d);break;default:break}t.isQuantized&&s.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new _(o);t.cartesianModelMatrix=s,t.cartesianOrigin=a;let c=rt.WGS84.cartesianToCartographic(a,new _),h=rt.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=h.multiplyRight(s),t.cartographicOrigin=c;let u=dA(t);u&&(t.cartesianModelMatrix=new ot(s).multiplyRight(u.matrix),t.cartographicModelMatrix.multiplyRight(u.matrix),u.matrix=ot.IDENTITY),t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var fA=1e6**2;function dA(e){let t=e.gltf;if(!t)return null;let r=typeof t.scene=="number"?t.scene:0,i=t.scenes?.[r]?.nodes?.[0];if(!i?.matrix)return null;let o=i.matrix;return o[12]*o[12]+o[13]*o[13]+o[14]*o[14]<=fA?null:i}var tb=new _,Gm=new _,mA=1e-5,pA=1e-7,km=new ge([new ne,new ne,new ne,new ne,new ne,new ne]);function Nc(e,t,r={}){let{cameraUp:n,height:i}=e,o=e.cameraDirection,{metersPerUnit:s}=e.distanceScales,a=Bc(e,e.center),c=rt.WGS84.eastNorthUpToFixedFrame(a),l=e.unprojectPosition(e.cameraPosition),h=rt.WGS84.cartographicToCartesian(l,new _),u;if(o)u=new _(c.transformAsVector(new _(o).scale(s))).normalize();else{let T=e.getFrustumPlanes().near,I=qm(T,e.cameraPosition),A=Bc(e,I);u=new _(A).subtract(h).normalize()}let f=new _(c.transformAsVector(new _(n).scale(s))).normalize();gA(e);let d=e.constructor,{longitude:m,latitude:p,width:g,bearing:y,zoom:w,position:M}=e,x=new d({longitude:m,latitude:p,height:i,width:g,bearing:y,zoom:w,position:M,pitch:0}),v=Number.isFinite(e.fovy)&&Number(e.fovy)>0&&Number(e.fovy)<180?Number(e.fovy)*Math.PI/180:Math.PI/3;return{camera:{position:h,direction:u,up:f,cartographicPosition:l,verticalFieldOfView:v,timeSinceMovement:r.timeSinceCameraMovement??Number.POSITIVE_INFINITY},viewport:e,topDownViewport:x,height:i,cullingVolume:km,clippingPlanes:e.clippingPlanes,frameNumber:t,sseDenominator:2*Math.tan(v/2),dynamicScreenSpaceErrorDensity:0}}function eb(e,t,r,n){let i=Array.from(t),o=Array.from(r),s=e?i.length!==e.position.length||i.some((l,h)=>Math.abs(l-e.position[h])>mA):!1,a=e?o.length!==e.direction.length||o.some((l,h)=>Math.abs(l-e.direction[h])>pA):!1,c=s||a?n:e?.lastMovementTime??Number.NEGATIVE_INFINITY;return{state:{position:i,direction:o,lastMovementTime:c},timeSinceMovement:Math.max((n-c)/1e3,0)}}function rb(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:i,latitude:o}=t.viewport;for(let[l,h]of e.entries()){let[u,f]=h.header.mbs,d=Math.abs(i-u),m=Math.abs(o-f),p=Math.sqrt(m*m+d*d);n.push([l,p])}let s=n.sort((l,h)=>l[1]-h[1]),a=[];for(let l=0;l<r;l++)a.push(e[s[l][0]]);let c=[];for(let l=r;l<s.length;l++)c.push(e[s[l][0]]);return[a,c]}function gA(e){let t=e.getFrustumPlanes(),r=qm(t.near,e.cameraPosition),n=Bc(e,r),i=Bc(e,e.cameraPosition,Gm),o=0;km.planes[o++].fromPointNormal(n,tb.copy(n).subtract(i));for(let s in t){if(s==="near")continue;let a=t[s],c=qm(a,r,Gm),l=Bc(e,c,Gm);km.planes[o++].fromPointNormal(l,tb.copy(n).subtract(l))}}function qm(e,t,r=new _){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Bc(e,t,r=new _){let n=e.unprojectPosition(t);return rt.WGS84.cartographicToCartesian(n,r)}var ab=new _,yA=new _,es=new _,nb=new _,Lc=new _,ib=new _,ob=new _,sb=new _,du=new $r,_A=new _(0,0,1);function cb(e,t){e._updateTransform(t)}function lb(e,t,r){if(!Number.isFinite(r.dynamicScreenSpaceErrorDensity)||r.dynamicScreenSpaceErrorDensity<=0)return 0;let n=xA(e),i=n.region?MA(n.region,t):vA(e,n,t);if(!i)return 0;let o=dc(r.dynamicScreenSpaceErrorHeightFalloff,0,1),s=i.minimumHeight+(i.maximumHeight-i.minimumHeight)*o,a=i.maximumHeight-s,c=a>0?dc((i.cameraHeight-s)/a,0,1):i.cameraHeight>=i.maximumHeight?1:0,h=(1-dc(Math.abs(i.cameraDirection.dot(i.upDirection)),0,1))*(1-c);return r.dynamicScreenSpaceErrorDensity*h}function wA(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function bA(e,t,r){return t<=0||r<=0||!Number.isFinite(t)||!Number.isFinite(r)?0:wA(e,t)*r}function hb(e,t,r,n=1){let i=e.tileset,o=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,s=r?o:e.lodMetricValue;if(s===0)return 0;let{viewDistanceScale:a}=i.options,c=a||1,l=Number.isFinite(n)?Math.max(n,0):1,h=SA(s,t,c,l);if(h!==null)return h;let u=Math.max(e._distanceToCamera,1e-7),{height:f,sseDenominator:d}=t,m=s*f*l*c/(u*d);return i.options.dynamicScreenSpaceError&&!t.viewport.orthographic&&(m-=bA(u,t.dynamicScreenSpaceErrorDensity,i.options.dynamicScreenSpaceErrorFactor)),m}function SA(e,t,r,n){let i=t.viewport;if(!i?.orthographic)return null;let o=i.metersPerPixel;return!Number.isFinite(o)||!o||o<=0?null:e*r*n/o}function xA(e){return e.header.content?.boundingVolume||e.header.boundingVolume}function MA(e,t){let r=ab.copy(t.camera.position).normalize(),n=Lc.copy(t.camera.direction).normalize();return{cameraHeight:t.camera.cartographicPosition[2],minimumHeight:e[4],maximumHeight:e[5],cameraDirection:n,upDirection:r}}function vA(e,t,r){let n=TA(t,es);if(n===null)return null;let i=new ot(e.computedTransform).invert(),o=e.tileset.ellipsoid;if(Math.hypot(es[0],es[1],es[2])>o.minimumRadius){let a=o.cartesianToCartographic(es,yA),c=ab.copy(r.camera.position).normalize(),l=Lc.copy(r.camera.direction).normalize();return{cameraHeight:r.camera.cartographicPosition[2],minimumHeight:0,maximumHeight:a[2]*2,cameraDirection:l,upDirection:c}}return i.transformAsPoint(r.camera.position,nb),i.transformAsVector(r.camera.direction,Lc),Lc.normalize(),{cameraHeight:nb[2],minimumHeight:es[2]-n,maximumHeight:es[2]+n,cameraDirection:Lc,upDirection:_A}}function TA(e,t){if(e.box){let r=e.box;return t.set(r[0],r[1],r[2]),EA(r)}if(e.sphere){let r=e.sphere;return t.set(r[0],r[1],r[2]),r[3]}return null}function EA(e){return e.length===10?(du.fromArray(e,6),ib.set(e[3],0,0).transformByQuaternion(du),ob.set(0,e[4],0).transformByQuaternion(du),sb.set(0,0,e[5]).transformByQuaternion(du),Math.abs(ib[2])+Math.abs(ob[2])+Math.abs(sb[2])):Math.abs(e[5])+Math.abs(e[8])+Math.abs(e[11])}var ue={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Zt;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(Zt||(Zt={}));var dn;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(dn||(dn={}));var he;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(he||(he={}));var rs;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(rs||(rs={}));var ub={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var fb=1e4,IA=1e4,AA=1e8,RA=new Ee,db=new _,mb=new _,jm=new _,mu=new _;function Wm(e,t,r){return e+(t-e)*r}function pb(e,t){let r=e instanceof Ee?e:e.getBoundingSphere(RA),{center:n,radius:i}=r;db.copy(n).subtract(t.position);let o=Math.max(db.dot(t.direction),0);return mb.copy(t.direction).scale(o).add(t.position),jm.copy(mb).subtract(n),jm.magnitude()<=i||(mu.copy(jm).normalize().scale(i).add(n).subtract(t.position),mu.magnitude()===0)?0:(mu.normalize(),Math.min(Math.max(1-mu.dot(t.direction),0),1))}function gb(e,t,r,n){return!Number.isFinite(n)||n<=0||n>.5?!1:e>r?!0:t!==void 0&&t>r}function yb(e){let t=Number.isFinite(e.foveatedConeSize)?Math.min(Math.max(e.foveatedConeSize,0),1):1,r=e.refinement===Zt.REPLACE;if(r&&!e.skipLevelOfDetail||!e.foveatedScreenSpaceError||t>=1||r&&e.skipLevelOfDetail&&e.priorityProgressiveResolution)return!1;let n=Number.isFinite(e.verticalFieldOfView)&&e.verticalFieldOfView>0?e.verticalFieldOfView:Math.PI/3,i=1-Math.cos(n*.5),o=t*i;if(e.foveatedFactor<=o||i<=o)return!1;let s=Math.min(Math.max((e.foveatedFactor-o)/(i-o),0),1),c=(typeof e.interpolationCallback=="function"?e.interpolationCallback:Wm)(e.minimumScreenSpaceErrorRelaxation,e.maximumScreenSpaceError,s),l=Number.isFinite(c)?Math.min(Math.max(c,0),e.maximumScreenSpaceError):0,h=e.screenSpaceError===0&&e.parentScreenSpaceError!==void 0?e.parentScreenSpaceError*.5:e.screenSpaceError;return e.maximumScreenSpaceError-l<=h}function _b(e,t,r){return e&&Number.isFinite(t)&&Number.isFinite(r)&&r>0&&t<r}function wb(e){let t=e.rootScreenSpaceError>0?Math.min(Math.max(e.reverseScreenSpaceError/e.rootScreenSpaceError,0),1):0,r=Math.floor(t*(fb-1)),n=Number.isFinite(e.foveatedFactor)?Math.min(Math.max(e.foveatedFactor,0),1):0,i=Math.floor(n*(fb-1))*IA;return(e.priorityProgressiveResolution?0:AA)+i+r}Vm();Vm();var ya="EPSG:4326",pu="EPSG:4978";function Fc(e){let t=e.trim().toUpperCase(),r=t.match(/(?:\/DEF\/CRS\/|URN:OGC:DEF:CRS:)([A-Z0-9_-]+)(?:\/|::)(?:[^/:]*[/:])?([A-Z0-9_.-]+)$/);return r?`${r[1]}:${r[2]}`:t}function nr(e){if(typeof e=="string"){let r=rr(e);return r==="wkt"?CA(e):r==="proj-string"?PA(e):Hm(e)||"projected"}let t=e;return t.type==="BoundCRS"&&t.source_crs?nr(t.source_crs):t.type==="CompoundCRS"&&t.components?.[0]?nr(t.components[0]):String(t.type).includes("Projected")?"projected":String(t.type).includes("Geographic")?"geographic":String(t.type).includes("Geodetic")?t.coordinate_system?.subtype==="Cartesian"?"geocentric":"geographic":"unknown"}function Hm(e){if(typeof e!="string")return;let t=Fc(e);if(t===pu)return"geocentric";if(t===ya||t==="OGC:CRS84")return"geographic";let r=/^EPSG:(\d+)$/.exec(t);if(!r)return;let n=Number(r[1]);if(n===7789)return"geocentric";if(n===4490||n===4979)return"geographic";if(n===3857||n>=32601&&n<=32660||n>=32701&&n<=32760)return"projected"}function CA(e){let t;try{t=Cc(e).root}catch{return"unknown"}switch(t.keyword.toUpperCase()){case"GEOCCS":return"geocentric";case"GEOGCS":case"GEOGCRS":case"GEOGRAPHICCRS":case"GEOGRAPHIC2DCRS":case"GEOGRAPHIC3DCRS":return"geographic";case"PROJCS":case"PROJCRS":case"PROJECTEDCRS":return"projected";case"GEODCRS":case"GEODETICCRS":{let n=t.values.find(i=>i.type==="node"&&i.keyword.toUpperCase()==="CS")?.values[0];return n?.type!=="enumeration"&&n?.type!=="string"?"unknown":n.value.toUpperCase()==="CARTESIAN"?"geocentric":n.value.toUpperCase()==="ELLIPSOIDAL"?"geographic":"unknown"}default:return"unknown"}}function PA(e){try{let t=Pc(e).parameters.find(r=>r.name.toLowerCase()==="proj")?.value;switch(t?.toLowerCase()){case"longlat":case"latlong":return"geographic";case"geocent":return"geocentric";default:return t?"projected":"unknown"}}catch{return"unknown"}}function ir(e,t={}){let r=t.sourceCrs!==void 0,n=t.sourceCrs||e.sourceCrs,i=t.outputCoordinates||"auto",o=t.targetCrs||(i==="ecef"?"EPSG:4978":void 0),s=t.targetHeightReference||"native",a=e.verticalUnitScale??1,c=e.elevationUnitScale??1,l=e.elevationOffset||0,h=e.elevationMode==="onTheGround"||e.elevationMode==="relativeToGround"||e.elevationMode==="relativeToScene",u=e.elevationMode==="relativeToScene"?!!t.sceneElevationProvider:!h||!!t.terrainElevationProvider,f=a!==1||c!==1||e.elevationMode!==void 0&&(h||e.elevationMode==="absoluteHeight"&&l!==0),d=s!=="native"&&s!==e.heightReference,m=!!o||s!=="native"||i!=="auto"||f,p=i!=="target-crs"||!!o,g=!d||(e.heightReference||"unknown")!=="unknown",y=Number.isFinite(a)&&a>0&&Number.isFinite(c)&&c>0,w=!!n&&m&&p&&g&&y&&u&&i!=="local-enu",M=r?"caller-override":e.provenance||"unknown",x=r&&n?nr(n):e.coordinateFrame,v=r?"explicit":e.sourceCrsState||(n?M==="format-default"?"default":"explicit":"absent"),T=cu({crs:n?{state:v==="default"?"default":"explicit",definition:n,representation:!r&&e.sourceCrsRepresentation||rr(n),provenance:M,alternatives:r?void 0:e.sourceCrsAlternatives}:{state:v==="unknown"?"unknown":"absent",provenance:M},vertical:e.verticalCrs?{state:"explicit",definition:e.verticalCrs,representation:rr(e.verticalCrs),provenance:e.provenance||"metadata"}:void 0,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,coordinateFrame:x,coordinateOrder:BA(e.axisOrder),units:r?void 0:e.units}),I=$m(T.crs),A=T.vertical?$m(T.vertical):void 0,F=o?OA(o):void 0;return Object.freeze({...T,sourceCrs:I,verticalCrs:A,verticalUnitScale:a,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,heightReference:e.heightReference||"unknown",elevationMode:e.elevationMode,elevationOffset:e.elevationOffset,elevationUnit:e.elevationUnit,elevationUnitScale:c,coordinateFrame:x||"unknown",axisOrder:e.axisOrder||"unknown",provenance:M,targetCrs:F,targetHeightReference:s,outputCoordinates:i,status:m?w?"transformable":"unresolved":"native",warnings:Object.freeze([...e.warnings||[]])})}function Gi(e,t={}){return ir({sourceCrs:e?.sourceCrs,sourceCrsState:e?.crs.state,sourceCrsRepresentation:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.representation:void 0,sourceCrsAlternatives:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.alternatives:void 0,verticalCrs:e?.verticalCrs,units:e?.units,verticalUnitScale:e?.verticalUnitScale,coordinateEpoch:e?.coordinateEpoch,heightReference:e?.heightReference,elevationMode:e?.elevationMode,elevationOffset:e?.elevationOffset,elevationUnit:e?.elevationUnit,elevationUnitScale:e?.elevationUnitScale,coordinateFrame:e?.coordinateFrame,axisOrder:e?.axisOrder,provenance:e?.provenance,warnings:e?.warnings},t)}function $m(e){return e.state==="explicit"||e.state==="default"?e.definition:void 0}function OA(e){let t=cu({crs:{state:"explicit",definition:e,representation:rr(e),provenance:"caller-override"}}),r=$m(t.crs);if(!r)throw new Error("Failed to normalize a known target CRS definition");return r}function BA(e){switch(e){case"xy":return["x","y"];case"yx":return["y","x"];case"xyz":return["x","y","z"];default:return[]}}function ns(e){if(e.status!=="transformable"&&e.status!=="transformed")throw new Error("Only a transformable spatial reference can be marked as transformed");return Object.freeze({...e,status:"transformed"})}function Dc(e){return!!(e&&typeof e=="object"&&"initialize"in e&&"getRootTileset"in e&&"initializeTileHeaders"in e&&"loadTileContent"in e)}var yu=1024*1024,Rb=512*yu,Cb=512*yu,NA=32*yu,LA=yu;function gu(e,t){if(!Number.isFinite(e)||e<0)throw new Error(`${t} must be a finite number greater than or equal to 0`);return e}function bb(e,t){let r=e.cacheBytes??t;return gu(r,"cacheBytes")}function Sb(e,t){let r=e.maximumCacheOverflowBytes??t;return gu(r,"maximumCacheOverflowBytes")}var Ym={description:"",ellipsoid:rt.WGS84,modelMatrix:new ot,throttleRequests:!0,maxRequests:64,cacheBytes:Rb,maximumCacheOverflowBytes:Cb,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onSourceError:()=>{},onTilesetError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{},contentLoader:void 0,viewDistanceScale:1,progressiveResolutionHeightFraction:.3,foveatedScreenSpaceError:!0,foveatedConeSize:.1,foveatedMinimumScreenSpaceErrorRelaxation:0,foveatedInterpolationCallback:Wm,foveatedTimeDelay:.2,maximumScreenSpaceError:8,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:2e-4,dynamicScreenSpaceErrorFactor:24,dynamicScreenSpaceErrorHeightFalloff:.25,memoryAdjustedScreenSpaceError:!0,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{},spatial:{}},Km="Tiles In Tileset(s)",Xm="Tiles In Memory",xb="Tiles In View",Mb="Tiles To Render",vb="Tiles Loaded",Zm="Tiles Loading",Tb="Tiles Unloaded",Eb="Failed Tile Loads",Ib="Points/Vertices",Jm="Tile Memory Use",Ab="Maximum Screen Space Error",Uc=class{options;loadOptions;source;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};schema=null;schemaUri=null;groups=[];metadata=null;statistics=null;spatialReference=ir({});description="";properties;extras=null;attributions={};credits={};stats;contentFormats;cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=Rb;_maximumCacheOverflowBytes=Cb;_frameNumber=0;_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_cameraMotionStates={};_deferredTraversalTimeout=null;_traverser;_cache=new ts;_requestScheduler;_heldTiles=new Set;updatePromise=null;tilesetInitializationPromise;constructor(t,r){if(!Dc(t))throw new Error("Tileset3D requires a Tileset3DSource instance");let n=r||{},i=t.type===he.TILES3D,o=i?Ym.cacheBytes:NA,s=i?Ym.maximumCacheOverflowBytes:LA,a=bb(n,o),c=Sb(n,s);this.options={...Ym,...n,cacheBytes:a,maximumCacheOverflowBytes:c,skipLevelOfDetail:n.skipLevelOfDetail??t.type===he.TILES3D,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError??i},this.loadOptions=this.options.loadOptions||{},this.source=t,this.tileset=null,this.loader=this.source.loader,this.type=this.source.type,this.url=this.source.url,this.basePath=this.source.basePath,this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType="",this.lodMetricValue=0,this.refine="",this.contentFormats=this.source.contentFormats,this._traverser=this._initializeTraverser(),this._requestScheduler=new si({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=a,this._maximumCacheOverflowBytes=c;let l=this._getSourceMetadata();l&&(this.spatialReference=Gi(l.spatialReference,this.options.spatial)),this.stats=new Yr({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet()}destroy(){this._clearDeferredTraversal(),this.source.destroy?.(),this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get requestedTiles(){return this._requestedTiles.slice()}get emptyTiles(){return this._emptyTiles.slice()}get cacheBytes(){return this._cacheBytes}set cacheBytes(t){this._cacheBytes=gu(t,"cacheBytes"),this.options.cacheBytes=this._cacheBytes}get maximumCacheOverflowBytes(){return this._maximumCacheOverflowBytes}set maximumCacheOverflowBytes(t){this._maximumCacheOverflowBytes=gu(t,"maximumCacheOverflowBytes"),this.options.maximumCacheOverflowBytes=this._maximumCacheOverflowBytes}get queryParams(){let t=this.source.getTileUrl(this.url),r=t.indexOf("?");return r>=0?t.slice(r+1):""}setProps(t){let r=bb(t,this.cacheBytes),n=Sb(t,this.maximumCacheOverflowBytes);this.options={...this.options,...t,cacheBytes:r,maximumCacheOverflowBytes:n},this._cacheBytes=r,this._maximumCacheOverflowBytes=n}getTileUrl(t){return this.source.getTileUrl(t)}hasExtension(t){return!!this.source.hasExtension?.(t)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this.cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this.cacheBytes+this.maximumCacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t],n=new Set(r.map(a=>a.id));for(let a of Object.keys(this.frameStateData))n.has(a)||delete this.frameStateData[a];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let i=Date.now(),o=Number.POSITIVE_INFINITY,s=[];for(let a of r){let c=a.id;this._needTraverse(c)?s.push(c):this.traverseCounter--}for(let a of r){let c=a.id;if(this.roots[c]||(this.roots[c]=this._initializeTileHeaders(this.tileset,null)),!s.includes(c))continue;let l=Nc(a,this._frameNumber),h=this.roots[c],u=eb(this._cameraMotionStates[c],l.camera.position,l.camera.direction,i);this._cameraMotionStates[c]=u.state,l.camera.timeSinceMovement=u.timeSinceMovement,cb(h,this.modelMatrix),l.dynamicScreenSpaceErrorDensity=this.type===he.TILES3D&&this.options.dynamicScreenSpaceError&&!l.viewport.orthographic?lb(h,l,this.options):0,this.dynamicScreenSpaceErrorComputedDensity=l.dynamicScreenSpaceErrorDensity,this._traverser.traverse(h,l,this.options),Object.keys(this._traverser.deferredTiles).length>0&&(o=Math.min(o,Math.max(this.options.foveatedTimeDelay-u.timeSinceMovement,0)))}Number.isFinite(o)?this._scheduleDeferredTraversal(o):this._clearDeferredTraversal()}_scheduleDeferredTraversal(t){this._clearDeferredTraversal(),this._deferredTraversalTimeout=setTimeout(()=>{this._deferredTraversalTimeout=null,this.selectTiles().catch(r=>{let n=r instanceof Error?r:new Error(String(r));this._onTilesetError(n)})},Math.max(t*1e3,0))}_clearDeferredTraversal(){this._deferredTraversalTimeout!==null&&(clearTimeout(this._deferredTraversalTimeout),this._deferredTraversalTimeout=null)}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],i=Object.values(this._traverser.selectedTiles),[o,s]=rb(i,t,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of s)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){let t=this.selectedTiles;this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let o in this.frameStateData){let s=this.frameStateData[o];this.selectedTiles=this.selectedTiles.concat(s.selectedTiles),this._requestedTiles=this._requestedTiles.concat(s._requestedTiles),this._emptyTiles=this._emptyTiles.concat(s._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);let r=new Set(this.selectedTiles),n=this.selectedTiles.some(o=>!o.tileDrawn),i=0;if(n){let o=new Set(Object.keys(this.frameStateData).map(a=>this.roots[a])),s=new Map;for(let a of this.selectedTiles)for(let c=a.parent;c;c=c.parent)s.set(c,(s.get(c)??!0)&&a.tileDrawn);for(let a of t)a.tileDrawn&&this._heldTiles.add(a);for(let a of this._heldTiles){let c=a;for(;c.parent;)c=c.parent;if(!o.has(c)){this._heldTiles.delete(a);continue}r.has(a)||(a.contentAvailable&&!this._hasDrawnReplacement(a,r,s)?(a._selectedFrame=this._frameNumber,this.selectedTiles.push(a),i++):this._heldTiles.delete(a))}}else this._heldTiles=r;i>0&&setTimeout(()=>{this.selectTiles()},0);for(let o of this.selectedTiles)this._tiles[o.id]=o;this._loadTiles(),this._unloadTiles(),this._updateStats(),this._tilesChanged(t,this.selectedTiles)&&this.options.onUpdate()}_hasDrawnReplacement(t,r,n){for(let i=t.parent;i;i=i.parent)if(r.has(i))return i.tileDrawn;return n.get(t)===!0}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(s=>s.id)),i=new Set(r.map(s=>s.id)),o=t.some(s=>!i.has(s.id));return o=o||r.some(s=>!n.has(s.id)),o}_loadTiles(){this._requestedTiles.sort((t,r)=>t._priority-r._priority);for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r)),this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)if(n.contentAvailable&&n.content){t++;let i=n.contents.length?n.contents:[n.content];for(let o of i)o.pointCount?r+=o.pointCount:r+=o.vertexCount||0}this.stats.get(xb).count=this.selectedTiles.length,this.stats.get(Mb).count=t,this.stats.get(Ib).count=r,this.stats.get(Ab).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(){try{let t=this.source.initialize(),r=this._getSourceMetadata();r&&this._syncSourceState(r),r?.tileset?.root&&typeof r.tileset.root.then!="function"&&(!this.source.prepareTileset||this.spatialReference?.status==="native")&&(this.root=this._initializeTileHeaders(r.tileset,null),this._applyViewState()),await t;let n=this.source.getMetadata();this._syncSourceState(n),await this.source.prepareTileset?.(this),this.root||(this.root=this._initializeTileHeaders(n.tileset,null)),this._applyViewState()}catch(t){let r=t instanceof Error?t:new Error(String(t));throw this._onSourceError(r,this.root),this._onTilesetError(r),r}}_initializeStats(){this.stats.get(Km),this.stats.get(Zm),this.stats.get(Xm),this.stats.get(xb),this.stats.get(Mb),this.stats.get(vb),this.stats.get(Tb),this.stats.get(Eb),this.stats.get(Ib),this.stats.get(Jm,"memory"),this.stats.get(Ab)}_initializeTileHeaders(t,r){return this.source.initializeTileHeaders(this,t,r)}_initializeTraverser(){return this.source.createTraverser({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r=null;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){let i=n instanceof Error?n:new Error("load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}async _loadTileChildren(t,r){try{this._onStartTileLoading(),await t.loadChildren(r)}catch(n){let i=n instanceof Error?n:new Error("subtree load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading()}}_onTileLoadError(t,r){this.stats.get(Eb).incrementCount();let n=r.message||r.toString(),i=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,i)}_onSourceError(t,r=null){this.options.onSourceError(t,this.source,r)}_onTilesetError(t){this.options.onTilesetError(t,this)}_onTileLoad(t,r){if(!r?.loaded)return;t.content&&Oc(t,t.content),this.source.onTileLoaded?.(this,t,r),this._syncSourceState(this.source.getMetadata());let n=this.source.getTilesTotalCount?.();n&&(this.stats.get(Km).reset(),this.stats.get(Km).addCount(n)),this._addTileToCache(t),this.options.onTileLoad(t)}_onStartTileLoading(){this._pendingCount++,this.stats.get(Zm).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Zm).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(vb).incrementCount(),this.stats.get(Xm).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Jm).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Xm).decrementCount(),this.stats.get(Tb).incrementCount(),this.stats.get(Jm).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[r];for(;n.length>0;){t=n.pop();for(let i of t.children)n.push(i);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_syncSourceState(t){this.tileset=t.tileset,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.refine,this.contentFormats=this.source.contentFormats,this.asset=this.source.asset||this.asset;let r=t.tileset;this.schema=r.schema||null,this.schemaUri=r.schemaUri||null,this.groups=r.groups||[],this.metadata=r.metadata||null,this.statistics=r.statistics??null;let n=Gi(t.spatialReference,this.options.spatial);this.spatialReference=FA(this.spatialReference,n),this.properties=this.source.properties??this.properties,this.extras=this.source.extras??this.extras,this.options.attributions?.length?this.credits={attributions:this.options.attributions}:this.credits=this.source.credits||this.credits}_applyViewState(){let t=this.source.getViewState(this.root);this.asset=t.asset||this.source.asset||{},this.properties=t.properties??this.source.properties,this.extras=t.extras??this.source.extras??null,this.credits=t.credits||this.source.credits||this.credits||{attributions:this.options.attributions||[]},this.description=t.description||this.options.description||"",this.boundingVolume=t.boundingVolume||this.root?.boundingVolume||null,this.cartographicCenter=t.cartographicCenter||new _,this.cartesianCenter=t.cartesianCenter||null,this.zoom=t.zoom||1,this.geometricError=this.tileset?.geometricError||0}_getSourceMetadata(){try{return this.source.getMetadata()}catch{return null}}};function FA(e,t){return e?.status==="transformed"&&e.sourceCrs===t.sourceCrs&&e.targetCrs===t.targetCrs&&e.targetHeightReference===t.targetHeightReference&&e.outputCoordinates===t.outputCoordinates?e:t}function Qm(e){let t=e.selectedTiles.slice(),r=e.requestedTiles.slice(),n=e.emptyTiles.slice(),i=c=>c.map(l=>String(l.id)).sort(),o=c=>{let l=e.stats.get(c).count;return typeof l=="number"&&Number.isFinite(l)?l:0},a=e.source.getImplicitTilingStats?.();return{frameNumber:e.frameNumber,selectedTileIds:i(t),requestedTileIds:i(r),emptyTileIds:i(n),visibleTileCount:t.length,renderableTileCount:t.filter(c=>c.contentAvailable&&!!c.content).length,loadingTileCount:o("Tiles Loading"),loadedTileCount:o("Tiles Loaded"),failedTileCount:o("Failed Tile Loads"),cachedTileCount:o("Tiles In Memory"),cacheBytes:e.gpuMemoryUsageInBytes,maximumScreenSpaceError:e.memoryAdjustedScreenSpaceError,...a?{implicitTiling:a}:{}}}async function*tp(e,t={}){if(await e.tilesetInitializationPromise,_u(t.signal),!e.root)throw new Error("Tileset initialization completed without a root tile");let r=[e.root],n=new Set;for(;r.length>0;){_u(t.signal);let i=r.pop();if(n.has(i))continue;if(n.add(i),i.header.implicitSubtree&&i.childrenState!=="ready"){let s=e.source.loadTileChildrenForTraversal;if(!s)throw new Error("Tileset source does not support camera-independent subtree loading");if(!(await s.call(e.source,i,t.signal)).loaded)throw new Error(`Unable to load implicit subtree for tile ${i.id}`);i.childrenState="ready"}if(e.type===he.I3S&&e.source.loadTileChildrenForTraversal&&!(await e.source.loadTileChildrenForTraversal(i,t.signal)).loaded)throw new Error(`Unable to load I3S child nodes for tile ${i.id}`);_u(t.signal);let o=i.contentUrls.length>0&&!i.content;try{if(o){let s=await i.loadContentForTraversal();if(_u(t.signal),!s.loaded)throw new Error(`Unable to load tile content for tile ${i.id}`);e.source.onTileLoaded?.(e,i,s)}yield{tile:i,contents:i.contentEntries}}finally{t.unloadContent&&o&&i.unloadContent()}for(let s=i.children.length-1;s>=0;s--)r.push(i.children[s])}}function _u(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}fn();var zc=class{sourceUrl;options;archivePromise;constructor(t){this.options=t,this.sourceUrl=DA(t.data,t.fallbackFilename)}async loadRoot(t,r,n){let i=this.options.rootPath?`${wu(this.sourceUrl)}/${this.options.rootPath}`:t;return await this.parseArchiveResource(i,this.options.rootPath,r,n,this.options.rootMode)}async loadResource(t,r,n){let i=this.resolveArchivePath(t,t);return await this.parseArchiveResource(t,i,r,n)}async parseArchiveResource(t,r,n,i,o){let s=this.options.getCoreApi();if(!s)throw new Error(this.options.missingCoreApiMessage);let a=await this.loadFile(r,o),c=this.createArchiveFetch(t);return await s.parse(a,n,{...i,fetch:c},{url:t,fetch:c,_parse:s.parse,loaders:[n],coreApi:s})}createArchiveFetch(t){return async r=>{let n=typeof r=="string"?r:r instanceof URL?r.toString():r.url,i=this.resolveArchivePath(n,t),o=await this.loadFile(i);return new Response(o,{status:200})}}async loadFile(t,r){this.archivePromise||=this.openArchiveReadableFile().then(i=>this.options.parseArchive(i));let n=await this.archivePromise;return await this.options.getFile(n,t,r)}async openArchiveReadableFile(){let{data:t}=this.options;if(typeof t!="string")return new ga(t);if(/^https?:\/\//i.test(t))return new Ec(t);let r=this.options.getCoreApi();if(!r)throw new Error(this.options.missingCoreApiMessage);let n=await r.fetchFile(t);return new ga(await n.arrayBuffer())}resolveArchivePath(t,r){let n=wu(t),i=wu(this.sourceUrl),o=wu(r),s=o===i?i:xr.dirname(o),a=new RegExp(`\\.${this.options.archiveExtension}/(.*)$`,"i"),c=n.match(a);if(c?.[1])return c[1];let l=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("/"),h=n.startsWith(i)?n:o===i&&!l?`${i}/${n}`:/^[a-z][a-z0-9+.-]*:\/\//i.test(o)?new URL(n,o).href:xr.resolve(s,n);return h===i?"":h.startsWith(`${i}/`)?h.slice(i.length+1):h.replace(/^\/+/,"")}};function DA(e,t){return typeof e=="string"?e:`memory://${"name"in e&&typeof e.name=="string"&&e.name?e.name:t}`}function wu(e){return e.split(/[?#]/,1)[0]}function bu(e){let t=[],r=new Set,n=i=>{if(!i||typeof i!="object"||r.has(i))return;r.add(i);let o=i,s=o.extensions?.EXT_mesh_features?.featureIds;if(Array.isArray(s))for(let a of s){if(!a||typeof a!="object")continue;let c=a.texture?"texture":a.implicit?"implicit":a.attribute!==void 0?"attribute":a.propertyTable!==void 0?"property-table":"constant";t.push({source:c,attribute:a.attribute,propertyTable:a.propertyTable,constant:a.constant,texture:a.texture,implicit:a.implicit,values:a.values,details:a})}for(let a of Object.values(o))n(a)};return n(e),t}fn();function Bb(e){return e!=null}var Ie=new _,Su=new _,Pb=new ot;function is(e,t,r,n=t){if(un(e,"3D Tile: boundingVolume must be defined"),e.box){let i=e.s2VolumeInfo?Pb:t;return Ob(e.box,i,r)}if(e.region){let i=wc(e.region),o=t.equals(n)?Pb:t.clone().multiplyRight(n.clone().invert());return Ob([...i.center,...i.halfAxes],o,r)}if(e.sphere)return UA(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Nb(e,t,r=!1){if(e.box||e.region&&r)return zA(t);if(e.region){let[n,i,o,s,a,c]=e.region;return[[ke(n),ke(i),a],[ke(o),ke(s),c]]}if(e.sphere)return VA(t);throw new Error("Unkown boundingVolume type")}function Ob(e,t,r){let n=new _(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(e.length===10){let l=e.slice(3,6),h=new $r;h.fromArray(e,6);let u=new _([1,0,0]),f=new _([0,1,0]),d=new _([0,0,1]);u.transformByQuaternion(h),u.scale(l[0]),f.transformByQuaternion(h),f.scale(l[1]),d.transformByQuaternion(h),d.scale(l[2]),i=[...u.toArray(),...f.toArray(),...d.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let o=t.transformAsVector(i.slice(0,3)),s=t.transformAsVector(i.slice(3,6)),a=t.transformAsVector(i.slice(6,9)),c=new Nt([o[0],o[1],o[2],s[0],s[1],s[2],a[0],a[1],a[2]]);return Bb(r)?(r.center=n,r.halfAxes=c,r):new Dn(n,c)}function UA(e,t,r){let n=new _(e[0],e[1],e[2]);t.transform(n,n);let i=t.getScale(Su),o=Math.max(Math.max(i[0],i[1]),i[2]),s=e[3]*o;return Bb(r)?(r.center=n,r.radius=s,r):new Ee(n,s)}function zA(e){let t=Lb(),{halfAxes:r}=e,n=new _(r.getColumn(0)),i=new _(r.getColumn(1)),o=new _(r.getColumn(2));for(let s=0;s<2;s++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)Ie.copy(e.center),Ie.add(n),Ie.add(i),Ie.add(o),Fb(t,Ie),o.negate();i.negate()}n.negate()}return t}function VA(e){let t=Lb(),{center:r,radius:n}=e,i=rt.WGS84.scaleToGeodeticSurface(r,Ie),o;i?o=rt.WGS84.geodeticSurfaceNormal(i):o=new _(0,0,1);let s=new _(o[2],-o[1],0);s.len()>0?s.normalize():s=new _(0,1,0);let a=s.clone().cross(o);for(let c of[s,a,o]){Su.copy(c).scale(n);for(let l=0;l<2;l++)Ie.copy(r),Ie.add(Su),Fb(t,Ie),Su.negate()}return t}function Lb(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Fb(e,t){rt.WGS84.cartesianToCartographic(t,Ie),e[0][0]=Math.min(e[0][0],Ie[0]),e[0][1]=Math.min(e[0][1],Ie[1]),e[0][2]=Math.min(e[0][2],Ie[2]),e[1][0]=Math.max(e[1][0],Ie[0]),e[1][1]=Math.max(e[1][1],Ie[1]),e[1][2]=Math.max(e[1][2],Ie[2])}var ep=new _,Db=new _,ki=new _,Ub=new _,GA=new _,rp=new ot,zb=new ot;function Vc(e,t){if(e.lodMetricValue===0||Number.isNaN(e.lodMetricValue))return"DIG";let r=2*np(e,t);if(r<2)return"OUT";if(!e.header.children)return"DRAW";switch(e.lodMetricType){case"screenSpaceRelative":{let n=t.topDownViewport.height||1;return r/n<=e.lodMetricValue?"DRAW":"DIG"}case"distanceRangeFromDefaultCamera":return e.distanceToTile(t)>=e.lodMetricValue?"DRAW":"DIG";case"maxScreenThresholdSQ":{let n=Math.sqrt(e.lodMetricValue/(Math.PI*.25));return r<=n?"DRAW":"DIG"}default:return r<=e.lodMetricValue?"DRAW":"DIG"}}function np(e,t){let{topDownViewport:r}=t,n=e.header.i3sLodMbs||e.header.mbs,i=n[1],o=n[0],s=n[2],a=n[3],c=[...e.boundingVolume.center],l=r.unprojectPosition(r.cameraPosition);rt.WGS84.cartographicToCartesian(l,ep),Db.copy(ep).subtract(c).normalize(),rt.WGS84.eastNorthUpToFixedFrame(c,rp),zb.copy(rp).invert(),ki.copy(ep).transform(zb);let h=Math.sqrt(ki[0]*ki[0]+ki[1]*ki[1]),u=h*h/ki[2];Ub.copy([ki[0],ki[1],u]);let d=Ub.transform(rp).subtract(c).normalize(),p=Db.cross(d).normalize().scale(a).add(c),g=rt.WGS84.cartesianToCartographic(p),y=r.project([o,i,s]),w=r.project(g);return GA.copy(y).subtract(w).magnitude()}fn();var Gc=class{_map=new Map;_array;_length;constructor(t=0){this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return un(t<this._array.length),this._array[t]}set(t,r){un(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){un(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){un(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var kA={loadSiblings:!1,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},mn=class{options;disableSkipLevelOfDetail=!1;root=null;selectedTiles={};requestedTiles={};deferredTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Gc;_emptyTraversalStack=new Gc;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...kA,...t}}isSkipLevelOfDetailEnabled(){return this.options.skipLevelOfDetail&&!this.disableSkipLevelOfDetail}traverse(t,r,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.deferredTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){let i=n.pop(),o=!1;this.canTraverse(i,r)&&(this.updateChildTiles(i,r),o=this.updateAndPushChildren(i,r,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let s=i.parent,a=!!(!s||s._shouldRefine),c=!o;i.hasRenderContent?i.refine===Zt.ADD?(this.loadTile(i,r),this.selectTile(i,r)):i.refine===Zt.REPLACE&&(this.loadTile(i,r),(c||this.isSkipLevelOfDetailEnabled())&&this.selectTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),c&&this.selectTile(i,r)),this.touchTile(i,r),i._shouldRefine=o&&a}this.completeTraversal(r)}completeTraversal(t){let r=new Date().getTime();(this.traversalFinished(t)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(t))}updateChildTiles(t,r){let n=t.children;for(let i of n)this.updateTile(i,r)}updateAndPushChildren(t,r,n,i){let{loadSiblings:o}=this.options,s=this.isSkipLevelOfDetailEnabled(),a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===Zt.REPLACE&&t.hasRenderContent&&!s,l=!1,h=!0;for(let u of a)if(u._selectionDepth=i,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&u._inRequestVolume&&(this.loadTile(u,r),this.touchTile(u,r)),c){let f;u._inRequestVolume?u.hasRenderContent?f=u.contentAvailable:f=this.executeEmptyTraversal(u,r):f=!1,h=h&&f}return l||(h=!1),h}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t,r)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){if(this.shouldLoadTile(t)){if(this.shouldDeferTileRequest(t)){this.deferredTiles[t.id]=t;return}t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t}}shouldDeferTileRequest(t){return t.priorityDeferred}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t,r){return t.contentAvailable&&t.contentVisibility(r)!=="outside"}shouldRefine(t,r,n=!1){let i=t._screenSpaceError;return n&&(i=t.getScreenSpaceError(r,!0)),i>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,r){let n=[];if(this.options.viewportTraversersMap)for(let i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===r.viewport.id&&n.push(i);else n.push(r.viewport.id);t.updateVisibility(r,n)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let n=!1;for(let i of t.children)i.updateVisibility(r),n=n||i.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,r){let n=!0,i=!1,o=this._emptyTraversalStack;for(o.push(t);o.length>0;){let s=o.pop(),a=!s.hasRenderContent&&this.canTraverse(s,r),c=!s.hasRenderContent&&s.children.length===0;if(s.header.implicitSubtree&&(i=!0,n=!1),!a&&!s.contentAvailable&&!c&&(n=!1),this.updateTile(s,r),s.isVisibleAndInRequestVolume||(this.loadTile(s,r),this.touchTile(s,r)),a){let l=s.children;for(let h of l)o.push(h)}}return t.hasEmptyContent&&!i||n}};var ip=new _;function qA(e,t,r,n,i=[]){let o=e.length?e:[t],s=!1,a=!1;for(let c of o){let l="inside";if(n!==ge.MASK_INSIDE&&(l=r.computeVisibility(c),l==="outside"))continue;let h=!1;for(let u of i)if(c.intersectPlane(u)==="outside"){h=!0;break}h||(s=!0,a=a||l==="intersecting")}return s?a?"intersecting":"inside":"outside"}function Vb(e){if(!e||typeof e!="object")return!1;let t=e;return t.shape==="tileset3d"||t.type==="tileset3d"||!!t.tileset}function jA(e){return e!=null}var or=class{tileset;header;id;url;parent;refine;type;contentUrl;contentUrls=[];lodMetricType="geometricError";lodMetricValue=0;_unscaledLodMetricValue=0;_scaleGeometricError=!0;boundingVolume=null;content=null;contents=[];contentEntries=[];metadataContext={};featureIdSets=[];vectorContent=null;metadata=null;contentMetadata=[];contentState=ue.UNLOADED;gpuMemoryUsageInBytes=0;children=[];childrenState="ready";depth=0;viewportIds=[];transform=new ot;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new mn({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_childrenPromise=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_screenSpaceErrorProgressiveResolution=0;_priorityProgressiveResolution=!1;_foveatedFactor=0;priorityDeferred=!1;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_contentBoundingVolumes=[];_contentBoundingVolumeHeaders=[];_viewerRequestVolume;get contentBoundingVolume(){return this._contentBoundingVolume}get contentBoundingVolumes(){return this._contentBoundingVolumes}get viewerRequestVolume(){return this._viewerRequestVolume}_initialTransform=new ot;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;tileDrawn=!0;constructor(t,r,n,i=""){this.header=r,this.tileset=t,this.id=i||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this.contentUrls=r.contentUrls||(r.contentUrl?[r.contentUrl]:[]),this._initializeMetadata(r),this.childrenState=r.implicitSubtree?"unloaded":"ready",this._initializeLodMetric(r),this._initializeTransforms(r),this._updateLodMetricScale(),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeContentEntries(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0||!!(this.header.implicitSubtree&&this.childrenState!=="ready")}get hasUnloadedChildren(){return!!(this.header.implicitSubtree&&(this.childrenState==="unloaded"||this.childrenState==="failed"))}get childrenLoading(){return this.childrenState==="loading"}get contentReady(){return this.contentState===ue.READY||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===ue.UNLOADED}get contentExpired(){return this.contentState===ue.EXPIRED}get contentFailed(){return this.contentState===ue.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=Nb(this.header.boundingVolume,this.boundingVolume,!this.computedTransform.equals(this._initialTransform))),this._boundingBox}getScreenSpaceError(t,r,n=1){switch(this.tileset.type){case he.I3S:return np(this,t);case he.TILES3D:return hb(this,t,r,n);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return(this.contents.length?this.contents:[this.content]).reduce((r,n)=>r+(n?.gpuMemoryUsageInBytes||n?.byteLength||0),0)}_getPriority(){return this._calculateRequestPriority(!1)}_getChildrenPriority(){return this._calculateRequestPriority(!0)}_calculateRequestPriority(t){let r=this.tileset._traverser,n=r.options.skipLevelOfDetail&&!r.disableSkipLevelOfDetail,i=this.refine===Zt.ADD||n;if(i&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.priorityDeferred||!t&&this.contentState===ue.UNLOADED)return-1;let o=this.parent,a=o&&(!i||this._screenSpaceError===0||o.hasTilesetContent)?o._screenSpaceError:this._screenSpaceError,c=r.root?r.root._screenSpaceError:0,l=Math.max(c-a,0);return wb({priorityProgressiveResolution:this._priorityProgressiveResolution,foveatedFactor:this._foveatedFactor,reverseScreenSpaceError:l,rootScreenSpaceError:c})}async loadContent(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0};this.contentExpired&&(this._expireDate=null),this.contentState=ue.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=ue.UNLOADED,{loaded:!1};try{return await this._loadContentFromSource()}catch(n){throw this.contentState=ue.FAILED,n}finally{r.done()}}async loadContentForTraversal(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0,contents:this.contents};this.contentState=ue.LOADING;try{return await this._loadContentFromSource()}catch(t){throw this.contentState=ue.FAILED,t}}async _loadContentFromSource(){let t=await this.tileset.source.loadTileContent(this);return t.contents&&(this.contents=t.contents,this.content=this.contents[0]||null),this.vectorContent=this.contents.find(r=>!!r?.vectorContent)?.vectorContent||null,this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this.contentState=ue.READY,this._onContentLoaded(),this._updateContentEntriesAfterLoad(t),t}async loadChildren(t){if(!this.header.implicitSubtree||this.childrenState==="ready")return{loaded:!1,tileCount:0,childSubtreeCount:0};if(this._childrenPromise)return await this._childrenPromise;if(!this.tileset.source.loadTileChildren)throw new Error("Tileset source does not support lazy tile children");this.childrenState="loading",this._childrenPromise=this._loadChildrenWithScheduler(t);try{return await this._childrenPromise}finally{this._childrenPromise=null}}async _loadChildrenWithScheduler(t){let r=await this.tileset._requestScheduler.scheduleRequest(`${this.id}:implicit-subtree`,this._getChildrenPriority.bind(this));if(!r)return this.childrenState="unloaded",{loaded:!1,tileCount:0,childSubtreeCount:0};try{let n=await this.tileset.source.loadTileChildren(this,t);return this.childrenState=n.loaded?"ready":"unloaded",n}catch(n){throw this.childrenState="failed",n}finally{r.done()}}applyImplicitSubtreeHeader(t){let r=this.header.transform,n=this.header.transformMatrix,i=t.transform!==void 0;this.header={...this.header,...t,transform:i?t.transform:r,transformMatrix:i?t.transformMatrix:n,implicitSubtree:void 0},i&&this._initializeTransforms(this.header),this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.contentUrls=t.contentUrls||(t.contentUrl?[t.contentUrl]:[]),this._initializeMetadata(this.header),this._initializeLodMetric(t),this._updateLodMetricScale(),this._initializeBoundingVolumes(this.header),this._boundingBox=void 0,this._initializeContent(this.header),this._initializeContentEntries(this.header)}_initializeMetadata(t){this.metadata=t.metadata||null;let r=Array.isArray(t.content)?t.content:[t.content];this.contentMetadata=r.filter(Boolean).map(a=>a.metadata||null);let i=(r.find(Boolean)||{}).group,o=typeof i=="number"?this.tileset.groups?.[i]||null:i||null,s={tileset:this.tileset.metadata||null,group:o,tile:this.metadata,content:this.contentMetadata[0]||null,subtree:t.implicitMetadata||null};this.tileset.groups&&(s.groups=this.tileset.groups),this.metadataContext=s}_updateContentEntriesAfterLoad(t){if(t.contentEntries){this.contentEntries=t.contentEntries.map((r,n)=>({...r,index:n,boundingVolume:r.boundingVolume||this._contentBoundingVolumes[n]||this.boundingVolume,payload:r.payload??this.contents[n]??null,featureIds:r.featureIds?.length?r.featureIds:bu(r.payload??this.contents[n]),renderable:!!(r.renderable!==!1&&(r.payload??this.contents[n])&&!Vb(r.payload??this.contents[n]))})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds);return}this.contentEntries=this.contentEntries.map((r,n)=>({...r,payload:this.contents[n]??null,featureIds:bu(this.contents[n]),renderable:!!this.contents[n]&&!Vb(this.contents[n])})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds)}getContentEntry(t){return this.contentEntries[t]||null}isContentRenderable(t){return!!this.contentEntries[t]?.renderable}_initializeContentEntries(t){let r=Array.isArray(t.content)?t.content:t.content?[t.content]:[];this.contentEntries=r.map((n,i)=>{let o=n||{};return{index:i,uri:this.contentUrls[i]||o.uri||o.url,group:o.group,type:o.type,payload:null,metadata:o.metadata||null,boundingVolume:this._contentBoundingVolumes[i]||this.boundingVolume,featureIds:this._getFeatureIdSets(o),renderable:!1}})}_getFeatureIdSets(t){return bu(t)}unloadContent(){for(let t of this.contents.length?this.contents:[this.content])t&&t.destroy&&t.destroy();return this.contents=[],this.content=null,this.vectorContent=null,this.contentEntries=this.contentEntries.map(t=>({...t,payload:null,renderable:!1})),this.featureIdSets=this.contentEntries.flatMap(t=>t.featureIds),this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=ue.UNLOADED,this.tileDrawn=!0,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,i=n?n._visibilityPlaneMask:ge.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._updateRequestPriorityMetrics(t),this._visibilityPlaneMask=this.visibility(t,i),this._visible=this._visibilityPlaneMask!==ge.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}_updateRequestPriorityMetrics(t){if(this.tileset.type!==he.TILES3D){this._screenSpaceErrorProgressiveResolution=this._screenSpaceError,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1;return}let r=this.tileset.options,n=r.progressiveResolutionHeightFraction;if(this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(t,!1,n),this._priorityProgressiveResolution=gb(this._screenSpaceErrorProgressiveResolution,this.parent?._screenSpaceErrorProgressiveResolution,this.tileset.memoryAdjustedScreenSpaceError,n),!r.foveatedScreenSpaceError||t.viewport?.orthographic||!t.camera?.position||!t.camera?.direction){this._foveatedFactor=0,this.priorityDeferred=!1;return}this._foveatedFactor=pb(this.boundingVolume,t.camera);let i=this.tileset._traverser,o=i.options.skipLevelOfDetail&&!i.disableSkipLevelOfDetail,s=yb({refinement:this.refine,skipLevelOfDetail:o,foveatedScreenSpaceError:r.foveatedScreenSpaceError,foveatedConeSize:r.foveatedConeSize,minimumScreenSpaceErrorRelaxation:r.foveatedMinimumScreenSpaceErrorRelaxation,interpolationCallback:r.foveatedInterpolationCallback,foveatedFactor:this._foveatedFactor,verticalFieldOfView:t.camera.verticalFieldOfView,screenSpaceError:this._screenSpaceError,parentScreenSpaceError:this.parent?._screenSpaceError,maximumScreenSpaceError:this.tileset.memoryAdjustedScreenSpaceError,priorityProgressiveResolution:this._priorityProgressiveResolution});this.priorityDeferred=_b(s,t.camera.timeSinceMovement,r.foveatedTimeDelay)}visibility(t,r){let{cullingVolume:n}=t,{boundingVolume:i}=this;return n.computeVisibilityWithPlaneMask(i,r)}contentVisibility(t,r){let n=r===void 0?this._contentBoundingVolumes:this._contentBoundingVolumes[r]?[this._contentBoundingVolumes[r]]:[];return qA(n,this.boundingVolume,t.cullingVolume,this._visibilityPlaneMask,t.clippingPlanes)}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return ip.subVectors(r.center,t.position),t.direction.dot(ip)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(jA(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=ue.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){this._scaleGeometricError=typeof t._scaleGeometricError=="boolean"?t._scaleGeometricError:this.parent?._scaleGeometricError??!0,"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this._unscaledLodMetricValue=t.lodMetricValue:(this._unscaledLodMetricValue=this.parent?this.parent._unscaledLodMetricValue:this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue")),this.lodMetricValue=this._unscaledLodMetricValue}_initializeTransforms(t){this.transform=t.transform?new ot(t.transform):new ot;let r=this.parent,n=this.tileset,i=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new ot(i).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new ot;this._initialTransform=new ot(o).multiplyRight(this.transform)}_updateLodMetricScale(){if(this.lodMetricType!==rs.GEOMETRIC_ERROR||!this._scaleGeometricError){this.lodMetricValue=this._unscaledLodMetricValue;return}let t=this.computedTransform.getScale(ip),r=Math.max(t[0],t[1],t[2]);this.lodMetricValue=this._unscaledLodMetricValue*r}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._contentBoundingVolumeHeaders=[],this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.contents=[],this.hasEmptyContent=!0,this.contentState=ue.UNLOADED,this.hasTilesetContent=!1,(t.contentUrl||t.contentUrls?.length)&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1,this._visibilityPlaneMask=ge.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||Zt.REPLACE}_isTileset(){return(this.contents.length?this.contents:[this.content]).some(t=>t?.shape==="tileset3d")}_onContentLoaded(){let t=this.contents.length?this.contents:[this.content];for(let r of t)switch(r&&r.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this._boundingBox=void 0,this.boundingVolume=is(t.boundingVolume,this.computedTransform,this.boundingVolume,this._initialTransform),t.viewerRequestVolume&&(this._viewerRequestVolume=is(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume,this._initialTransform));let r=t.content;r&&(this._contentBoundingVolumeHeaders=Array.isArray(r)?r:[r]);let n=r?Array.isArray(r)?r:[r]:this._contentBoundingVolumeHeaders;this._contentBoundingVolumes=n.length?n.map(i=>i?.boundingVolume?is(i.boundingVolume,this.computedTransform,void 0,this._initialTransform):this.boundingVolume):[this.boundingVolume],this._contentBoundingVolume=this._contentBoundingVolumes[0]||null}_updateTransform(t=new ot){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateLodMetricScale(),this._updateBoundingVolume(this.header))}};fn();var xu=class extends mn{pendingImplicitSubtrees=new Map;traversalFinished(t){let r=`${t.viewport.id}:`;for(let[n,i]of this.pendingImplicitSubtrees)if(n.startsWith(r)&&i===t.frameNumber)return!1;return!0}executeTraversal(t,r){if(!this.isSkipLevelOfDetailEnabled()){super.executeTraversal(t,r);return}this.executeSkipTraversal(t,r)}executeSkipTraversal(t,r){let n=[t];for(t._selectionDepth=t.parent?t.parent._selectionDepth:1;n.length>0;){let i=n.pop(),o=!i.parent||i.parent._shouldRefine,s=this.canTraverse(i,r)&&this.updateAndPushSkipChildren(i,r,n)&&o,a=!s&&o;i.hasRenderContent?i.refine===Zt.ADD?(this.loadTile(i,r),this.selectDesiredTile(i,r)):i.refine===Zt.REPLACE&&(this.isInBaseTraversal(i,r)?(this.loadTile(i,r),a&&this.selectDesiredTile(i,r)):a?(this.loadTile(i,r),this.selectDesiredTile(i,r)):this.hasReachedSkippingThreshold(i,r)&&this.loadTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),a&&(!i.hasEmptyContent||i.hasChildren)&&this.selectDesiredTile(i,r)),this.touchTile(i,r),i._shouldRefine=s}this.completeTraversal(r)}updateAndPushSkipChildren(t,r,n){this.updateChildTiles(t,r),t.children.sort(this.compareDistanceToCamera.bind(this));let i=!1;for(let o of t.children)o._selectionDepth=t.hasRenderContent?t._selectionDepth+1:t._selectionDepth,o.isVisibleAndInRequestVolume?(n.push(o),i=!0):this.options.loadSiblings&&o._inRequestVolume&&(this.loadTile(o,r),this.touchTile(o,r));return i}isInBaseTraversal(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(!this.findNearestRequestedOrLoadedAncestor(t,r))return!0;let n=Number.isFinite(this.options.baseScreenSpaceError)?Math.max(this.options.baseScreenSpaceError,0):1024,i=Math.max(n,t.tileset.memoryAdjustedScreenSpaceError);return t._screenSpaceError===0&&t.parent?t.parent._screenSpaceError>i:t._screenSpaceError>i}hasReachedSkippingThreshold(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(t._priorityProgressiveResolution&&t._screenSpaceErrorProgressiveResolution<=t.tileset.memoryAdjustedScreenSpaceError&&!!(t.parent&&t.parent._screenSpaceErrorProgressiveResolution>t.tileset.memoryAdjustedScreenSpaceError))return!0;let i=this.findNearestRequestedOrLoadedAncestor(t,r);if(!i)return!1;let o=Number.isFinite(this.options.skipScreenSpaceErrorFactor)&&this.options.skipScreenSpaceErrorFactor>0?this.options.skipScreenSpaceErrorFactor:16,s=Number.isFinite(this.options.skipLevels)?Math.max(Math.floor(this.options.skipLevels),0):1;return t._screenSpaceError<i._screenSpaceError/o&&t.depth>i.depth+s}findNearestRequestedOrLoadedAncestor(t,r){let n=t.parent;for(;n;){if(n.hasRenderContent&&!n.contentFailed&&(!n.hasUnloadedContent||n._requestedFrame===r.frameNumber))return n;n=n.parent}return null}selectDesiredTile(t,r){let n=t;for(;n;){if(this.shouldSelectTile(n,r)){this.selectTile(n,r),n!==t&&this.selectLoadedDescendants(t,r,!0);return}n=n.parent}this.selectLoadedDescendants(t,r)}selectLoadedDescendants(t,r,n=!1){let i=[{tile:t,depth:0}];for(;i.length>0;){let{tile:o,depth:s}=i.pop();for(let a of o.children)this.updateTile(a,r),a.isVisibleAndInRequestVolume&&(this.shouldSelectTile(a,r)&&(!n||a.tileDrawn)?(this.selectTile(a,r),this.touchTile(a,r)):s<1&&i.push({tile:a,depth:s+1}))}}compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateChildTiles(t,r){let n=t.header.implicitSubtree?.coordinates.level===0;if(t.hasUnloadedChildren&&t.isVisibleAndInRequestVolume&&(n||this.shouldRefine(t,r))){let i=`${r.viewport.id}:${t.id}`;this.pendingImplicitSubtrees.has(i)||(this.pendingImplicitSubtrees.set(i,r.frameNumber),t.tileset._loadTileChildren(t,r).finally(()=>{this.handleImplicitSubtreeLoad(t,r,i)}))}super.updateChildTiles(t,r)}handleImplicitSubtreeLoad(t,r,n){this.pendingImplicitSubtrees.delete(n),this._frameNumber===r.frameNumber&&(t.childrenState==="ready"?this.executeTraversal(t,r):this.traversalFinished(r)&&this.options.onTraversalEnd(r))}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let n=t.children.length>0;if(t.hasTilesetContent&&n){let s=t.children[0];this.updateTileVisibility(s,r),t._visible=s._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let i=t.refine===Zt.REPLACE,o=t._optimChildrenWithinParent===ub.USE_OPTIMIZATION;if(i&&o&&n&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:n}=t;return!n||n.hasTilesetContent||n.refine!==Zt.ADD?!1:!this.shouldRefine(t,r,!0)}};var WA=6378137,HA=6378137,op=6356752314245179e-9,_a=new _;function Gb(e,t){if(e instanceof Dn){let{halfAxes:r}=e,n=$A(r);return Math.log2(op/(n+t[2]))}else if(e instanceof Ee){let{radius:r}=e;return Math.log2(op/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,i=Math.log2(WA/r),o=Math.log2(HA/n);return(i+o)/2}return 1}function sp(e,t,r){rt.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],_a);let n=Math.sqrt(Math.pow(_a[0]-r[0],2)+Math.pow(_a[1]-r[1],2)+Math.pow(_a[2]-r[2],2));return Math.log2(op/(n+t[2]))}function kb(e,t,r){let[n,i,o,s]=e;return sp({xmin:n,xmax:o,ymin:i,ymax:s,zmin:0,zmax:0},t,r)}function $A(e){e.getColumn(0,_a);let t=e.getColumn(1),r=e.getColumn(2);return _a.add(t).add(r).len()}var YA=Object.freeze({meter:1,millimeter:.001,centimeter:.01,decimeter:.1,kilometer:1e3,foot:.3048,yard:.9144,mile:1609.344,"us-foot":.3048006096012192,"us-inch":.0254000508001016,"us-yard":.9144018288036576,"us-mile":1609.3472186944373,"clarke-foot":.3047972654,"clarke-yard":.9143917962,"clarke-link":.201166195164,"sears-yard":.914398414616,"sears-foot":.304799471539,"sears-chain":20.1167651216,"sears-1922-truncated-chain":20.116756,"benoit-1895-b-chain":20.1167824944,"indian-yard":.914398530744,"indian-1937-yard":.91439523,"gold-coast-foot":.304799710181}),KA=Object.freeze({m:"meter",metre:"meter",meters:"meter",metres:"meter",mm:"millimeter",millimetre:"millimeter",millimeters:"millimeter",millimetres:"millimeter",cm:"centimeter",centimetre:"centimeter",centimeters:"centimeter",centimetres:"centimeter",dm:"decimeter",decimetre:"decimeter",decimeters:"decimeter",decimetres:"decimeter",km:"kilometer",kilometre:"kilometer",kilometers:"kilometer",kilometres:"kilometer",ft:"foot",feet:"foot","us-survey-foot":"us-foot","us-survey-feet":"us-foot",yd:"yard",yards:"yard",mi:"mile",miles:"mile"});function kc(e){if(!e)return;let t=e.trim().toLowerCase().replaceAll("_","-"),r=KA[t]||t;return YA[r]}function qb(e,t){return t!==void 0?Number.isFinite(t)&&t>0?t:void 0:e?kc(e):1}function qc(e){let t=e.spatialReference||e.fullExtent?.spatialReference,r=tR(t),n=e.heightModelInfo?.vertCRS||eR(t),i=e.heightModelInfo?.heightModel,o=e.heightModelInfo?.heightUnit,s=qb(o,e.ZFactor),a=i==="ellipsoidal"?"ellipsoidal":i==="gravity_related_height"?"orthometric":"unknown",c=Hb(t),l=c===void 0?r?nr(r):"unknown":nr(`EPSG:${c}`),h=XA(l,o,e.ZFactor),u=[],f=ZA(e.elevationInfo?.mode),d=e.elevationInfo?e.elevationInfo.unit||"meter":void 0,m=kc(d);return s===void 0&&u.push(e.ZFactor!==void 0?`I3S ZFactor ${e.ZFactor} is not a positive finite conversion factor`:`Unsupported I3S vertical unit ${o}`),e.elevationInfo&&m===void 0&&u.push(`Unsupported I3S elevation unit ${d}`),e.elevationInfo?.mode&&!f&&u.push(`Unsupported I3S elevation mode ${e.elevationInfo.mode}`),f&&f!=="absoluteHeight"&&u.push(`I3S elevation mode ${f} requires a terrain or scene elevation provider`),ir({sourceCrs:r,sourceCrsRepresentation:c!==void 0?"identifier":r?"wkt":void 0,sourceCrsAlternatives:c!==void 0&&t?.wkt?[{definition:t.wkt,representation:"wkt"}]:void 0,verticalCrs:n,units:h,verticalUnitScale:s??Number.NaN,heightReference:a,elevationMode:f,elevationOffset:e.elevationInfo?.offset,elevationUnit:d,elevationUnitScale:e.elevationInfo?.mode&&!f?Number.NaN:m??(e.elevationInfo?Number.NaN:1),coordinateFrame:l,axisOrder:r?"xyz":"unknown",provenance:r?"metadata":"unknown",warnings:u})}function XA(e,t,r){if(e==="geocentric")return["meter","meter","meter"];if(e==="geographic"&&(t||r===void 0))return["degree","degree",t||"meter"]}function ZA(e){switch(e){case"absoluteHeight":case"onTheGround":case"relativeToGround":case"relativeToScene":return e;default:return}}function jc(e){let t=JA(e);if(t)return t;let r=jb(e,"TILESET_CRS_GEOCENTRIC"),n=jb(e,"TILESET_CRS_COORDINATE_EPOCH"),i=[],o,s="unknown",a;typeof r=="string"&&r.toUpperCase()!=="UNKNOWN"?(o=r,s="metadata",a="explicit"):r!==void 0?(i.push("3D Tiles geocentric CRS is explicitly unknown"),s="metadata",a="unknown"):e.root?.boundingVolume?.region?(o="EPSG:4978",s="format-default",a="default"):e.schemaUri&&!e.schema&&i.push("External 3D Tiles metadata schema must be loaded before CRS semantics can resolve");let c=Wb(n);return n!==void 0&&c===void 0&&i.push("3D Tiles coordinate epoch is not a finite decimal year"),ir({sourceCrs:o,sourceCrsState:a,sourceCrsRepresentation:o?"identifier":void 0,coordinateEpoch:c,heightReference:o?"ellipsoidal":"unknown",coordinateFrame:o?"geocentric":"unknown",axisOrder:o?"xyz":"unknown",provenance:s,warnings:i})}function JA(e){let t=e.extensions?.EXT_geospatial_crs;if(!t)return;let r=[],n,i,o,s;if(t.format==="wkid"){let h=t.extensions?.EXT_geospatial_crs_wkid;typeof h?.authority=="string"&&Number.isInteger(h.wkid)?(n=`${h.authority}:${h.wkid}`,s="identifier",Number.isInteger(h.vcsWkid)&&(i=`${h.authority}:${h.vcsWkid}`),o=Wb(h.epoch),h.epoch!==void 0&&o===void 0&&r.push("EXT_geospatial_crs_wkid epoch is not a finite decimal year")):r.push("EXT_geospatial_crs_wkid requires string authority and integer wkid")}else if(t.format==="wkt2"){let h=t.extensions?.EXT_geospatial_crs_wkt2;typeof h?.wkt2=="string"&&h.wkt2.trim()?(n=h.wkt2,s="wkt"):r.push("EXT_geospatial_crs_wkt2 requires a nonempty wkt2 string")}else r.push(`Unsupported EXT_geospatial_crs format ${String(t.format)}`);let a=s==="wkt"?nr(n):Hm(n)||"unknown",c=QA(i);i&&!c&&r.push(`Unsupported vertical CRS ${String(i)}; vertical unit and height reference are unknown`);let l=i?c?.unit:"meter";return ir({sourceCrs:n,sourceCrsState:n?"explicit":"unknown",sourceCrsRepresentation:s,verticalCrs:i,coordinateEpoch:o,units:a==="geocentric"?["meter","meter","meter"]:a==="geographic"&&l?["degree","degree",l]:void 0,verticalUnitScale:i?c?.verticalUnitScale??Number.NaN:1,heightReference:i?c?.heightReference??"unknown":n?"ellipsoidal":"unknown",coordinateFrame:a,axisOrder:n?"xyz":"unknown",provenance:"metadata",warnings:r})}function QA(e){if(typeof e!="string")return;let t=/^EPSG:(\d+)$/i.exec(e);if(t)switch(Number(t[1])){case 5702:case 6360:return{unit:"us-foot",verticalUnitScale:1200/3937,heightReference:"orthometric"};case 5703:return{unit:"meter",verticalUnitScale:1,heightReference:"orthometric"};default:return}}function Wb(e){if(typeof e!="string"&&typeof e!="number"||typeof e=="string"&&!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function tR(e){let t=Hb(e);return t!==void 0?`EPSG:${t}`:e?.wkt}function eR(e){let t=e?.latestVcsWkid??e?.vcsWkid;return t===void 0?void 0:`EPSG:${t}`}function Hb(e){return e?.latestWkid??e?.wkid}function jb(e,t){let r=e.metadata?.class;if(!r)return;let i=e.schema?.classes?.[r]?.properties,o=e.metadata?.properties;for(let[s,a]of Object.entries(i||{}))if(a.semantic===t)return o?.[s]}function $b(e){return{input:new Float64Array(e),output:new Float64Array(e)}}function Wc(e){return e instanceof Float32Array||e instanceof Float64Array}function Yb(e){return typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function ap(e,t,r,n,i,o){return(e.buffer===n.buffer||Yb(e.buffer)&&Yb(n.buffer))&&t<o&&i<r}function Mu(e,t,r,n){return e<t+n?0:Math.floor((e-t-n)/r)+1}var vu=class{constructor(t){this.depth=0;let r=t.dimension??2,n=t.inputOffset??0,i=t.outputOffset??0;if(!Number.isSafeInteger(r)||r<2||!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||t.inputStride!==void 0&&(!Number.isSafeInteger(t.inputStride)||t.inputStride<1)||t.outputStride!==void 0&&(!Number.isSafeInteger(t.outputStride)||t.outputStride<1)||typeof t.projection?.projectToSync!="function"||typeof t.projection?.unprojectToSync!="function")throw new Error("Invalid projection buffer transform or layout");this.dimension=r,this.projection=t.projection,this.inputOffset=n,this.outputOffset=i,this.inputStride=t.inputStride,this.outputStride=t.outputStride,this.scratch=[$b(r)]}projectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!1,o)}unprojectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!0,o)}projectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!1,o)}unprojectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!0,o)}range(t,r,n){let i=r??Math.max(0,t-n);if(!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(n+i)||n+i>t)throw new Error("Invalid projection buffer record range");return i}epochStorage(t,r,n){if(t!==void 0){if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Coordinate epoch must be finite")}else if(!Wc(t)||t.length<r+n)throw new Error("Epoch buffer requires one value per addressed record")}}aliases(t,r,n,i,o,s,a){if(!i)return;let c=t.byteOffset+(this.inputOffset+n*o)*t.BYTES_PER_ELEMENT,l=c+((i-1)*o+a)*t.BYTES_PER_ELEMENT,h=r.byteOffset+(this.outputOffset+n*s)*r.BYTES_PER_ELEMENT,u=h+((i-1)*s+a)*r.BYTES_PER_ELEMENT,f=t.buffer===r.buffer&&t.constructor===r.constructor&&c===h&&o===s;if(ap(t,c,l,r,h,u)&&!f)throw new Error("Projection input/output ranges overlap without an exact in-place mapping")}epochAlias(t,r,n,i,o,s){if(typeof t!="object"||!t||!i)return;let a=t.byteOffset+n*t.BYTES_PER_ELEMENT,c=a+i*t.BYTES_PER_ELEMENT,l=r.byteOffset+(this.outputOffset+n*o)*r.BYTES_PER_ELEMENT,h=l+((i-1)*o+s)*r.BYTES_PER_ELEMENT;if(ap(t,a,c,r,l,h))throw new Error("Epoch and output buffers must not overlap")}acquire(){var t;let r=this.depth++;return(t=this.scratch)[r]||(t[r]=$b(this.dimension)),this.scratch[r]}transform(t,r,n){if(n!==void 0&&!Number.isFinite(n))throw new Error("Coordinate epoch must be finite");r?this.projection.unprojectToSync(t.input,t.output,n):this.projection.projectToSync(t.input,t.output,n)}floatRange(t,r){for(let n=0;n<this.dimension;n++){let i=t[n];if(n<3&&!Number.isFinite(i)||r&&Number.isFinite(i)&&Math.abs(i)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}}flat(t,r,n,i,o,s){if(!Wc(t)||!Wc(r))throw new Error("Projection buffers require Float32Array or Float64Array");let a=this.inputStride??this.dimension,c=this.outputStride??this.dimension;if(a<this.dimension||c<this.dimension)throw new Error("Interleaved stride must contain every ordinate");let l=this.range(Mu(t.length,this.inputOffset,a,this.dimension),n,i);if(i+l>Mu(r.length,this.outputOffset,c,this.dimension))throw new Error("Projection output buffer is too short");this.epochStorage(s,i,l),this.aliases(t,r,i,l,a,c,this.dimension),this.epochAlias(s,r,i,l,c,this.dimension);let h=this.acquire();try{let u=typeof s=="number"?void 0:s,f=r instanceof Float32Array;for(let d=i;d<i+l;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)h.input[g]=t[m+g];this.transform(h,o,u?u[d]:s),this.floatRange(h.output,f);for(let g=0;g<this.dimension;g++)r[p+g]=h.output[g]}return r}finally{this.depth--}}columns(t,r,n,i,o,s){if(t.length!==this.dimension||r.length!==this.dimension)throw new Error("Projection columns must match dimension");let a=this.inputStride??1,c=this.outputStride??1,l=Number.MAX_SAFE_INTEGER;for(let f=0;f<this.dimension;f++){if(!Wc(t[f])||!Wc(r[f]))throw new Error("Projection columns require floating typed arrays");l=Math.min(l,Mu(t[f].length,this.inputOffset,a,1))}let h=this.range(l,n,i);this.epochStorage(s,i,h);for(let f=0;f<this.dimension;f++){if(i+h>Mu(r[f].length,this.outputOffset,c,1))throw new Error("Projection output column is too short");this.epochAlias(s,r[f],i,h,c,1);for(let d=0;d<this.dimension;d++)this.aliases(t[f],r[d],i,h,a,c,1);for(let d=0;d<f&&h;d++){let m=r[f].byteOffset+(this.outputOffset+i*c)*r[f].BYTES_PER_ELEMENT,p=r[d].byteOffset+(this.outputOffset+i*c)*r[d].BYTES_PER_ELEMENT;if(ap(r[f],m,m+((h-1)*c+1)*r[f].BYTES_PER_ELEMENT,r[d],p,p+((h-1)*c+1)*r[d].BYTES_PER_ELEMENT))throw new Error("Projection output columns overlap")}}let u=this.acquire();try{let f=typeof s=="number"?void 0:s;for(let d=i;d<i+h;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)u.input[g]=t[g][m];this.transform(u,o,f?f[d]:s);for(let g=0;g<this.dimension;g++){let y=u.output[g];if(g<3&&!Number.isFinite(y)||r[g]instanceof Float32Array&&Number.isFinite(y)&&Math.abs(y)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}for(let g=0;g<this.dimension;g++)r[g][p]=u.output[g]}return r}finally{this.depth--}}};hp();var nR=240,iR=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],oR=372,sR=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],aR=372,cR=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31],lR=12,up=20/2,hR=2,wa=class{constructor(t){this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this.options=t,this._ix=this.options._width,this._iy=this.options._height,this._hasUint16Data=cp(t.data)}getHeight(t,r){if(t=Math.abs(t)>90?NaN:t,Number.isNaN(t)||Number.isNaN(r))return NaN;let n=uR(r,360);r=n!==-180?n:180;let i=r*this.options._rlonres,o=-t*this.options._rlatres,s=Math.floor(i),a=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(o));i-=s,o-=a,a+=(this.options._height-1)/2,s+=s<0?this.options._width:s>=this.options._width?-this.options._width:0;let c=0,l=0,h=0,u=0,f=new Array(up);if(s===this._ix&&a===this._iy)this.options.cubic?f=this._t:(c=this._v00,l=this._v01,h=this._v10,u=this._v11);else if(!this.options.cubic)c=this._rawval(s,a),l=this._rawval(s+1,a),h=this._rawval(s,a+1),u=this._rawval(s+1,a+1);else{let m=[this._rawval(s,a-1),this._rawval(s+1,a-1),this._rawval(s-1,a),this._rawval(s,a),this._rawval(s+1,a),this._rawval(s+2,a),this._rawval(s-1,a+1),this._rawval(s,a+1),this._rawval(s+1,a+1),this._rawval(s+2,a+1),this._rawval(s,a+2),this._rawval(s+1,a+2)],p=sR;a!==0&&(p=a===this.options._height-2?cR:iR);let g=oR;a!==0&&(g=a===this.options._height-2?aR:nR);for(let y=0;y<up;++y){f[y]=0;for(let w=0;w<lR;++w)f[y]+=m[w]*p[up*w+y];f[y]/=g}}if(!this.options.cubic){let m=(1-i)*c+i*l,p=(1-i)*h+i*u,g=(1-o)*m+o*p,y=this.options._offset+this.options._scale*g;return this._ix=s,this._iy=a,this._v00=c,this._v01=l,this._v10=h,this._v11=u,y}let d=f[0]+i*(f[1]+i*(f[3]+i*f[6]))+o*(f[2]+i*(f[4]+i*f[7])+o*(f[5]+i*f[8]+o*f[9]));return d=this.options._offset+this.options._scale*d,this._ix=s,this._iy=a,this._t=f,d}_rawval(t,r){t<0?t+=this.options._width:t>=this.options._width&&(t-=this.options._width),(r<0||r>=this.options._height)&&(r=r<0?-r:2*(this.options._height-1)-r,t+=(t<this.options._width/2?1:-1)*this.options._width/2);let n=r*this.options._swidth+t;if(this._hasUint16Data)return this.options.data[this.options._datastart+n];let i=this.options._datastart+hR*n,o=this.options.data[i],s=this.options.data[i+1];return o<<8|s}};function uR(e,t){t=Math.abs(t);let r=Qb(e,t);return 2*Math.abs(r)===t?r-=Qb(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function Qb(e,t){return e-Math.floor(e/t)*t}var fR=10,dR=65535;function fp(e,t){let r=mR(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,o=0,s=-1,a=-1,c="NONE",l="UNKNOWN",h=0,u=0,f=null,d=null;do{n=r.next();let y=n.value.line;if(y.length)if(y[0]==="#"){let w=y.split(" "),M=w[0],x=w[1];if(M!=="#"||!x)continue;let v=w.length>2?w.slice(2):[];if(x==="Description")c=v.join(" ");else if(x==="DateTime")l=v.join(" ");else if(x==="Offset"){if(!w[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(w[2],10)}else if(x==="Scale"){if(!w[2])throw new Error("Geoid model file: Error reading scale");o=parseFloat(w[2])}else x===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(w[2]))&&(s=parseFloat(w[2])):x===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(w[2]))&&(a=parseFloat(w[2]))}else{let w=y.split(" ");if(w=w.filter(M=>M!==""),h=parseInt(w[0],10),u=parseInt(w[1],10),!(h&&u))throw new Error("Geoid model file: Error reading raster size");break}}while(!n.done);n=r.next();let m=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(m!==dR)throw new Error("Geoid model file: Incorrect value of maxval");if(f=n.value.offset,d=h,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(o===0)throw new Error("Geoid model file: Scale not set");if(o<0)throw new Error("Geoid model file: Scale must be positive");if(u<2||h<2)throw new Error("Geoid model file: Raster size too small");if(h&1)throw new Error("Geoid model file: Raster width is odd");if(!(u&1))throw new Error("Geoid model file: Raster height is even");let p=h/360,g=(u-1)/180;return new wa({cubic:t.cubic,_width:h,_height:u,_rlonres:p,_rlatres:g,_offset:i,_scale:o,_swidth:d,_datastart:f,_maxerror:s,_rmserror:a,_description:c,_datetime:l,data:e})}function*mR(e){let t=0;do{let r=e.indexOf(fR,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:tS(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:tS(n)}}}while(t<e.length);return{offset:t,line:""}}function tS(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}var dp=Symbol.for("@math.gl/projection/projection-implementations");function mp(){let e=globalThis;return e[dp]||(e[dp]=new WeakMap),e[dp]}function eS(e){return"create"in e?e:mp().get(e)?.implementation}function rS(e){if("create"in e)return Promise.resolve(e);let t=mp().get(e);if(t||(t={load:()=>e.preload()},mp().set(e,t)),t.implementation)return Promise.resolve(t.implementation);let r=t;return r.pending||(r.pending=Promise.resolve().then(r.load).then(n=>{let i=s=>s.toLowerCase().replace(/[\s_-]/g,""),o=new Set([n.name,...n.aliases||[]].map(i));if(typeof n.create!="function"||![e.name,...e.aliases||[]].every(s=>o.has(i(s))))throw new Error("Loaded projection does not match descriptor: "+e.name);return r.implementation=n,n}).catch(n=>{throw r.pending=void 0,n})),r.pending}function nS(){return{x:0,y:0,z:0}}var qi=class{constructor(){this.point=nS(),this.points=[this.point],this.active=0}get depth(){return this.active}acquire(){var t;let r=this.active++;return(t=this.points)[r]||(t[r]=nS()),this.points[r]}release(t){this.active>0&&this.points[this.active-1]===t&&this.active--}};function Kr(e,t){let r=new qi,n=(i,o,s)=>{let a=r.acquire();try{return a.x=i,a.y=o,a.z=0,s(a),[a.x,a.y]}finally{r.release(a)}};return{forward(i,o){return n(i,o,e)},inverse(i,o){return n(i,o,t)},forwardInPlace:e,inverseInPlace:t}}function ci(e,t,r=!1){let n=t?e.inverseInPlace:e.forwardInPlace;if(n)return n.bind(e);if(r){let o=t?e.inverse3D:e.forward3D;return s=>{let a=o.call(e,[s.x,s.y,s.z]);s.x=a[0],s.y=a[1],s.z=a[2]}}let i=t?e.inverse:e.forward;return o=>{let s=i.call(e,o.x,o.y);o.x=s[0],o.y=s[1]}}var Tu=34028234663852886e22;function Eu(e,t,r){if(!(Array.isArray(e)||e instanceof Float32Array||e instanceof Float64Array))throw new Error("Scalar input requires a number array, Float32Array or Float64Array");if(!(Array.isArray(t)||t instanceof Float32Array||t instanceof Float64Array)||t.length<r)throw new Error("Scalar output requires a preallocated number array, Float32Array or Float64Array with sufficient capacity");if(e===t||Array.isArray(e)||Array.isArray(t))return;let n=e,i=t,o=typeof SharedArrayBuffer<"u"&&n.buffer instanceof SharedArrayBuffer&&i.buffer instanceof SharedArrayBuffer;if((n.buffer===i.buffer||o)&&n.byteOffset<i.byteOffset+r*i.BYTES_PER_ELEMENT&&i.byteOffset<n.byteOffset+n.byteLength)throw new Error("Scalar input/output views overlap; use the same view for in-place projection")}function iS(e,t,r,n){if(t instanceof Float32Array){if(Math.abs(r.x)>Tu||Math.abs(r.y)>Tu||n>=3&&Math.abs(r.z)>Tu)throw new Error("Projected coordinate exceeds Float32 range");for(let i=3;i<e.length;i++){let o=e[i];if(Number.isFinite(o)&&Math.abs(o)>Tu)throw new Error("Trailing ordinate exceeds Float32 range")}}for(let i=3;i<e.length;i++)t[i]=e[i];return t[0]=r.x,t[1]=r.y,n>=3&&(t[2]=r.z),t}Ac();zm();var oS,sS=Symbol.for("@math.gl/projection/TypeScriptCRSError"),Mr=class e extends Error{static[(oS=sS,Symbol.hasInstance)](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):t instanceof Error&&t[sS]===!0}constructor(t,r){super(r),this.reason=t,this[oS]=!0,this.name="TypeScriptCRSError"}};function pt(e){throw new Mr("missing-transform-stage",e)}function aS(e,t){if(typeof e=="string"||"type"in e)return{definition:e,lossy:!1};let r=e,n="crs"in r?r:void 0,i="crs"in r?r.crs:r;if(i.state!=="explicit"&&i.state!=="default")throw new Mr("unknown-syntax","Cannot transform an "+i.state+" CRS reference");let o=!1;return n?.coordinateEpoch!==void 0&&pt("Coordinate epochs require a time-dependent transformation"),n?.vertical&&n.vertical.state!=="absent"&&(t.mode!=="horizontal"&&pt("A separately declared vertical CRS requires explicit horizontal extraction"),o=!0),{definition:i.definition,spatialReference:n,lossy:o}}function cS(e,t){if(!t)return e;if(t.coordinateFrame!=="unknown"&&t.coordinateFrame!==e.kind)throw new Error("SpatialReference coordinate frame disagrees with its CRS");let r=t.coordinateOrder,n=e.kind==="geocentric"?{x:"e",y:"n",z:"u"}:{longitude:"e",lon:"e",latitude:"n",lat:"n",easting:"e",northing:"n",height:"u",altitude:"u",x:"e",y:"n",z:"u"},i;if(r.length&&(i=r.slice(0,3).map(o=>n[o.toLowerCase()]||"?").join(""),i.length===2&&(i+="u"),(i.length!==3||!i.includes("e")||!i.includes("n")||!i.includes("u"))&&pt("Unsupported SpatialReference coordinate order"),(r.length>4||r.length>3&&!["m","measure"].includes(r[3]))&&pt("Unsupported fourth coordinate component")),t.units?.length){let o={m:1,meter:1,metre:1,meters:1,metres:1,km:1e3,ft:.3048,"us-ft":.3048006096012192,degree:Math.PI/180,degrees:Math.PI/180,radian:1,radians:1,grad:Math.PI/200};for(let s=0;s<Math.min(t.units.length,3);s++){let a=(i||"enu")[s]==="u",c=e.kind==="geocentric"?e.toMeter:a?e.verticalUnit:e.kind==="geographic"?e.angularUnit:e.toMeter;(Math.abs((o[t.units[s]]??NaN)-c)>1e-12||o[t.units[s]]===void 0)&&pt("SpatialReference units disagree with its CRS")}}return Object.freeze({...e,storedAxis:i})}var Jt=Math.PI/180;function nt(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))return r;let n=e[t];if(typeof n!="string"||!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(n))throw new Error(`Invalid numeric PROJ parameter: +${t}`);let i=Number(n);if(!Number.isFinite(i))throw new Error(`Invalid numeric PROJ parameter: +${t}`);return i}function $c(e,t){let r=nt(e,t,0);if(Math.abs(r)>=90)throw new Error(`+${t} must be between -90 and 90 degrees`);return r*Jt}function Xr(e){if(Math.abs(e)<=Math.PI)return e;let t=2*Math.PI;return((e+Math.PI)%t+t)%t-Math.PI}var lS={towgs84:"0,0,0",ellipse:"WGS84"},hS={towgs84:"0,0,0",ellipse:"GRS80"},pp={wgs84:lS,WGS84:lS,nad83:hS,North_American_Datum_1983:hS},uS=new WeakMap,os=e=>e.toLowerCase().replace(/[\s_-]/g,"");function ba(e){if(!e.datumCatalogs?.length)return pp;let t=uS.get(e);if(t?.catalogs===e.datumCatalogs)return t.definitions;let r=Object.assign(Object.create(null),pp),n=new Map(Object.entries(pp).map(([i,o])=>[os(i),{definition:o,owner:-1}]));return e.datumCatalogs.forEach((i,o)=>{if(!i.name||!i.datums)throw new Error("Invalid datum catalogue plugin");for(let[s,a]of Object.entries(i.datums)){let c=os(s);if(!c||c==="none"||!a||["ellipse","towgs84","nadgrids"].some(h=>a[h]!==void 0&&typeof a[h]!="string"))throw new Error("Invalid datum definition: "+s);let l=n.get(c);if(l&&(l.owner!==o||l.definition.ellipse!==a.ellipse||l.definition.towgs84!==a.towgs84||l.definition.nadgrids!==a.nadgrids))throw new Error("Conflicting datum registration: "+s);n.set(c,{definition:a,owner:o}),r[s]=a}}),uS.set(e,{catalogs:e.datumCatalogs,definitions:r}),r}var pR={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},fS=pR;var sr={};sr.greenwich=0;sr.lisbon=-9.131906111111;sr.paris=2.337229166667;sr.bogota=-74.080916666667;sr.madrid=-3.687938888889;sr.rome=12.452333333333;sr.bern=7.439583333333;sr.jakarta=106.807719444444;sr.ferro=-17.666666666667;sr.brussels=4.367975;sr.stockholm=18.058277777778;sr.athens=23.7163375;sr.oslo=10.722916666667;var dS=sr;var mS={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var pS={WGS84:"+proj=longlat +datum=WGS84","EPSG:4326":"+proj=longlat +datum=WGS84","EPSG:4269":"+proj=longlat +datum=NAD83","EPSG:4978":"+proj=geocent +datum=WGS84","EPSG:4979":"+proj=longlat +datum=WGS84","EPSG:3857":"+proj=merc +a=6378137 +b=6378137 +nadgrids=@null +units=m","EPSG:3785":"EPSG:3857",GOOGLE:"EPSG:3857","EPSG:900913":"EPSG:3857","EPSG:102113":"EPSG:3857"},Iu=["proj","datum","ellps","a","b","rf","f","R","units","to_meter","vunits","vto_meter","no_defs","type","title","towgs84","nadgrids","geoidgrids","axis","pm","over","lon_wrap"],bS=["no_defs","over"],Un=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),gS=e=>e.toLowerCase().replace(/[\s_-]/g,"");function gp(e,t){let r=Object.keys(e).find(n=>gS(n)===gS(t));return r===void 0?void 0:e[r]}function yS(e){if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(e)){let r=Number(e);if(Number.isFinite(r))return r}if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?r$/i.test(e)){let r=Number(e.slice(0,-1))/Jt;if(Number.isFinite(r))return r}let t=/^([+-]?)(\d+(?:\.\d*)?)(?:d(?:(\d+(?:\.\d*)?)'(?:(\d+(?:\.\d*)?)")?)?)?([NSEW])?$/i.exec(e);if(t&&(/d/i.test(e)||t[5])){let r=Number(t[3]||0),n=Number(t[4]||0);if(r<60&&n<60){let i=t[1]==="-"?-1:1,o=/[SW]/i.test(t[5]||"")?-1:1,s=i*o*(Number(t[2])+r/60+n/3600);if(Number.isFinite(s))return s}}throw new Error("Invalid angular parameter: "+e)}function Yc(e,t={}){let r=ba(t),n=aS(e,t),i=n.definition,o=t.aliases||{},s=new Set;for(;typeof i=="string"&&(Un(o,i)||Un(pS,i));){if(s.has(i))throw new Error("Circular CRS alias: "+i);s.add(i),i=Un(o,i)?o[i]:pS[i]}if(typeof i=="string"){let P=/^EPSG:(326|327)(\d{2})$/.exec(i);P&&Number(P[2])>=1&&Number(P[2])<=60&&(i="+proj=utm +datum=WGS84 +zone="+Number(P[2])+(P[1]==="327"?" +south":"")),(i==="EPSG:5041"||i==="EPSG:5042")&&(i="+proj=stere +datum=WGS84 +lat_0="+(i==="EPSG:5041"?90:-90)+" +k_0=0.994 +x_0=2000000 +y_0=2000000")}let a;if(rr(i)==="proj-string"&&typeof i=="string"){let P=Object.create(null);for(let D of Pc(i).parameters){if(Un(P,D.name))throw new Error("Duplicate PROJ parameter: +"+D.name);P[D.name]=D.value}a={parameters:P}}else{let P=t.parsers?.find(D=>D.canParse(i));if(!P){let D=["wkt","projjson"].includes(rr(i));throw new Mr(D?"missing-parser":"unknown-syntax","Unsupported CRS definition; register a WKT or PROJJSON parser for structured definitions")}a=P.parse(i,t)}let c={...a.parameters};for(let P of["lon_0","lat_0","lat_1","lat_2","lat_ts","lon_wrap","lon_1","lon_2","lonc","alpha","gamma","tilt","azi","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"])c[P]!==void 0&&(c[P]=String(yS(c[P])));let l=c.proj,h=l?.toLowerCase(),u=h==="geocentric"?"geocent":["longlat","latlong","latlon","lonlat","identity","geocent"].includes(h)?h:l;if(!u)throw new Error("CRS requires +proj");let f=["longlat","latlong","latlon","lonlat"].includes(u)?"geographic":u==="geocent"?"geocentric":u==="identity"?"identity":"projected",d=c.datum,m=d&&d!=="none"?gp(r,d):void 0;d&&d!=="none"&&!m&&pt("Unknown datum: "+d+"; register a datumCatalogs plugin");let p=wS(c,m?.ellipse),g=c.nadgrids??m?.nadgrids,y=g===void 0?void 0:g.split(",").map(P=>{let D=P.startsWith("@"),at=D?P.slice(1):P;if(!at||/\s/.test(at))throw new Error("Invalid datum grid name");return Object.freeze({name:at,optional:D})}),w=c.towgs84??m?.towgs84,M;if(w!==void 0&&(M=w.split(",").map(P=>nt({value:P},"value",NaN)),![3,7].includes(M.length)||M.some(P=>!Number.isFinite(P))||M.length===7&&M[6]<=-1e6))throw new Error("+towgs84 requires three or seven finite values and positive scale");d==="none"&&(M=void 0),y&&d!=="none"&&(M=[0,0,0]);let x=g==="@null"||g==="null"?wS({ellps:"WGS84"}):p,v=c.axis||"enu";if(v.length!==3||!/[ew]/.test(v)||!/[ns]/.test(v)||!/[ud]/.test(v))throw new Error("Invalid axis: "+v);let T=a.angularUnit??Jt;if(f==="geographic"&&(c.units&&c.units!=="degrees"||Un(c,"to_meter")))throw new Error("Geographic coordinates must use angular units");if(f!=="geographic"&&c.units==="degrees")throw new Error("Linear coordinates require linear units");let I=_S(c,"units","to_meter"),A=a.verticalUnit??_S(c,"vunits","vto_meter");if(!(A>0)||!Number.isFinite(A))throw new Error("Invalid vertical unit");if(!(T>0)||!Number.isFinite(T))throw new Error("Invalid angular unit");let F=c.pm,C=F===void 0?0:(gp(dS,F)??yS(F))*Jt;return cS(Object.freeze({kind:f,projection:u,parameters:Object.freeze(c),ellipsoid:p,datum:Object.freeze({ellipsoid:x,towgs84:M&&Object.freeze(M),grids:d==="none"||g==="@null"||g==="null"?void 0:y&&Object.freeze(y)}),angularUnit:T,toMeter:I,verticalUnit:A,primeMeridian:C,axis:v,longitudeWrap:c.lon_wrap===void 0?void 0:Number(c.lon_wrap)*Jt,lossy:!!(a.lossy||n.lossy)}),n.spatialReference)}function _S(e,t,r){let n=e[t],i=mS;if(t==="vunits"&&n==="degrees")throw new Error("Height requires linear units");if(n&&!["m","degrees"].includes(n)&&!Un(i,n))throw new Error("Unsupported units: "+n);let o=nt(e,r,n&&i[n]?i[n].to_meter:1);if(!(o>0))throw new Error("+"+r+" must be positive");return o}function wS(e,t){let r=t||e.ellps||"WGS84",n=gp(fS,r);if(!n)throw new Error("Unsupported ellipsoid: "+r);let i=nt(e,"a",n.a),o=nt(e,"f",NaN),s=nt(e,"rf",Number.isNaN(o)?n.rf||0:o===0?0:1/o),a=nt(e,"b",s?i*(1-1/s):Un(e,"f")||Un(e,"rf")||Un(e,"a")?i:n.b||i),c=nt(e,"R",0);if(i<=0||a<=0||a>i||s<0||s>0&&s<=1||Un(e,"R")&&c<=0||!Number.isNaN(o)&&(o<0||o>=1))throw new Error("Invalid ellipsoid dimensions");return Object.freeze({semiMajorAxis:c||i,semiMinorAxis:c||a,eccentricitySquared:c?0:1-(a/i)**2})}var yp=Math.PI/(180*3600),Au={ellipsoid:{semiMajorAxis:6378137,semiMinorAxis:6356752314245179e-9,eccentricitySquared:.0066943799901413165},towgs84:[0,0,0]};function Cu(e,t){if(Math.abs(e.y)>Math.PI/2)throw new Error("Latitude outside geocentric domain");if(!Dh(e,t))throw new Error("Geocentric coordinate must be finite")}function Pu(e,t){let r=e.x,n=e.y,i=e.z,{semiMajorAxis:o,semiMinorAxis:s,eccentricitySquared:a}=t;if(r===0&&n===0&&i===0)throw new Error("Geodetic coordinates are undefined at the Earth center");if(a!==0&&Math.abs(r)<1e-12*o&&Math.abs(n)<1e-12*o&&Math.hypot(r,n)<1e-12*o){if(!Number.isFinite(Math.hypot(r,n,i)))throw new Error("Geocentric radius must be finite");e.x=0,e.y=Math.sign(i)*Math.PI/2,e.z=Math.abs(i)-s;return}if(!Uh(e,t))throw Number.isFinite(Math.hypot(r,n,i))?new Error("Geocentric inverse did not converge"):new Error("Geocentric radius must be finite")}function SS(e,t){let r=e[0],n=e[1],i=e[2],o=(e[3]||0)*yp,s=(e[4]||0)*yp,a=(e[5]||0)*yp,c=1+(e[6]||0)/1e6;return t?l=>{let h=(l.x-r)/c,u=(l.y-n)/c,f=(l.z-i)/c;l.x=h+a*u-s*f,l.y=-a*h+u+o*f,l.z=s*h-o*u+f}:l=>{let h=l.x,u=l.y,f=l.z;l.x=c*(h-a*u+s*f)+r,l.y=c*(a*h+u-o*f)+n,l.z=c*(-s*h+o*u+f)+i}}function Ru(e){return!!e.towgs84?.some(t=>t!==0)}function wp(e,t){if(!(!e.towgs84||!t.towgs84)){if(e.grids||t.grids){if(e.grids&&t.grids&&e.ellipsoid.semiMajorAxis===t.ellipsoid.semiMajorAxis&&e.ellipsoid.eccentricitySquared===t.ellipsoid.eccentricitySquared&&e.grids.length===t.grids.length&&e.grids.every((n,i)=>n.name===t.grids[i].name&&n.optional===t.grids[i].optional&&n.grid===t.grids[i].grid))return;let r=wp(e.grids?Au:e,t.grids?Au:t);return n=>{e.grids&&xS(n,e,!1),r?.(n),t.grids&&xS(n,t,!0)}}if(Ru(e)||Ru(t)){let r=_p(e,Au),n=_p(Au,t);return i=>{r?.(i),n?.(i)}}return _p(e,t)}}function _p(e,t){if(!e.towgs84||!t.towgs84)return;let r=e.ellipsoid,n=t.ellipsoid,i=!0;for(let a=0;a<7;a++)(e.towgs84[a]||0)!==(t.towgs84[a]||0)&&(i=!1);if(r.semiMajorAxis===n.semiMajorAxis&&Math.abs(r.eccentricitySquared-n.eccentricitySquared)<=5e-11&&i)return;let o=Ru(e)?SS(e.towgs84,!1):void 0,s=Ru(t)?SS(t.towgs84,!0):void 0;return a=>{Cu(a,r),o?.(a),s?.(a),Pu(a,n)}}function xS(e,t,r){for(let n of t.grids){if(n.name==="null")return;if(!n.grid){if(n.optional)continue;throw new Error("Required datum grid is not registered: "+n.name)}let i=!1;if(n.grid.shiftInPlace)i=n.grid.shiftInPlace(e,r);else{let o=n.grid.shift(e.x,e.y,r);o&&(e.x=o[0],e.y=o[1],i=!0)}if(i){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||Math.abs(e.y)>Math.PI/2)throw new Error("Datum grid produced a coordinate outside the geographic domain");return}}throw new Error("No datum grid covers coordinate: "+t.grids.map(n=>n.name).join(","))}function MS(e,t){let r={x:e[0],y:e[1],z:e[2]};return Cu(r,t),[r.x,r.y,r.z]}function vS(e,t){let r={x:e[0],y:e[1],z:e[2]};return Pu(r,t),[r.x,r.y,r.z]}function TS(e,t={}){if(e===void 0)return;let r=[];for(let n of e.split(",")){let i=n.startsWith("@"),o=i?n.slice(1):n;if(!o||/\s/.test(o))throw new Error("Invalid vertical grid name");if(o==="null"){r.push(null);break}let s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){if(typeof s.getOffset!="function")throw new Error("Invalid vertical grid: "+o);r.push(s.getOffset.bind(s))}else i||pt("Required vertical grid is not registered: "+o)}return(n,i)=>{for(let o of r){if(!o)return 0;let s=o(n,i);if(s!==void 0){if(!Number.isFinite(s))throw new Error("Vertical grid returned a non-finite offset");return s}}throw new Error("No vertical grid covers this coordinate")}}var Kc=class e{static async create(t={}){let r=await Promise.all(ES(t).map(rS));return new e({...t,projections:r})}constructor(t={}){this.coordinateScratch=new qi;let r=t.projections||[],n=CS(r);if(r.some(i=>!("create"in i))){let i=Yc(t.from??"WGS84",t),o=Yc(t.to??"WGS84",t);this.lossy=i.lossy||o.lossy,this.deferred={options:{...t,projections:[...r]}}}else{let i=t,o=n,s=IS(i.from??"WGS84",o,i),a=IS(i.to??"WGS84",o,i);this.lossy=s.lossy||a.lossy,this.lossy&&(s.kind==="geocentric"||a.kind==="geocentric")&&pt("Horizontal extraction cannot supply ellipsoidal height for geocentric coordinates"),this.lossy&&(s.verticalGrid||a.verticalGrid)&&pt("Horizontal extraction cannot be combined with vertical grids"),this.forwardTransform=RS(s,a,!!t.enforceAxis),this.inverseTransform=RS(a,s,!!t.enforceAxis)}this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectTo=this.projectTo.bind(this),this.unprojectTo=this.unprojectTo.bind(this),this.projectToSync=this.projectToSync.bind(this),this.unprojectToSync=this.unprojectToSync.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this),this.projectSync=this.projectSync.bind(this),this.unprojectSync=this.unprojectSync.bind(this),this.projectFlatSync=this.projectFlatSync.bind(this),this.unprojectFlatSync=this.unprojectFlatSync.bind(this)}load(){let t=this.deferred;return t?t.implementation?Promise.resolve(t.implementation):(t.pending||(t.pending=e.create(t.options).then(r=>(t.implementation=r,r)).catch(r=>{throw t.pending=void 0,r})),t.pending):Promise.resolve(this)}loadSync(){let t=this.deferred;if(!t)return this;if(!t.implementation){let r=ES(t.options).map(n=>{let i=eS(n);if(!i)throw new Error("Projection is not preloaded: "+n.name+". Call preload() first.");return i});t.implementation=new e({...t.options,projections:r})}return t.implementation}projectSync(t){return this.deferred?this.loadSync().project(t):Sa(t,this.forwardTransform,this.coordinateScratch)}unprojectSync(t){return this.deferred?this.loadSync().unproject(t):Sa(t,this.inverseTransform,this.coordinateScratch)}projectFlatSync(t,r=2){return this.deferred?this.loadSync().projectFlat(t,r):Ou(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlatSync(t,r=2){return this.deferred?this.loadSync().unprojectFlat(t,r):Ou(t,r,this.inverseTransform,this.coordinateScratch)}async preload(){await this.load()}project(t){return this.deferred?this.projectLoaded(t,!1):Sa(t,this.forwardTransform,this.coordinateScratch)}unproject(t){return this.deferred?this.projectLoaded(t,!0):Sa(t,this.inverseTransform,this.coordinateScratch)}projectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!1):this.projectToSync(t,r)}unprojectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!0):this.unprojectToSync(t,r)}projectToSync(t,r){return this.deferred?this.loadSync().projectTo(t,r):(Eu(t,r,Math.max(t.length,this.forwardTransform.geocentricOutput?3:2)),Sa(t,this.forwardTransform,this.coordinateScratch,r))}unprojectToSync(t,r){return this.deferred?this.loadSync().unprojectTo(t,r):(Eu(t,r,Math.max(t.length,this.inverseTransform.geocentricOutput?3:2)),Sa(t,this.inverseTransform,this.coordinateScratch,r))}projectToLoaded(t,r,n){Eu(t,r,t.length);let i=t.slice();return this.load().then(o=>n?o.unprojectTo(i,r):o.projectTo(i,r))}projectLoaded(t,r){let n=t.slice();return this.load().then(i=>r?i.unproject(n):i.project(n))}projectFlat(t,r=2){return this.deferred?this.load().then(i=>i.projectFlat(t,r)):Ou(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlat(t,r=2){return this.deferred?this.load().then(i=>i.unprojectFlat(t,r)):Ou(t,r,this.inverseTransform,this.coordinateScratch)}};function ES(e){let t=CS(e.projections||[]),r=new Set;for(let n of[e.from??"WGS84",e.to??"WGS84"]){let i=Yc(n,e);if(["geographic","identity"].includes(i.kind))continue;let o=t.get(Bu(i.projection));if(!o)throw new Mr("missing-plugin","Projection plugin is not registered: "+i.projection);r.add(o)}return[...r]}var Bu=e=>e.toLowerCase().replace(/[\s_-]/g,"");function CS(e){let t=new Map;for(let r of e)for(let n of new Set([r.name,...r.aliases||[]].map(Bu))){if(!n||["longlat","latlong","latlon","lonlat","identity"].includes(n)||t.has(n))throw new Error("Duplicate or reserved projection plugin: "+n);t.set(n,r)}return t}function IS(e,t,r){let n=Yc(e,r),i=t.get(Bu(n.projection));if(!["geographic","identity"].includes(n.kind)&&!i)throw new Mr("missing-plugin","Projection plugin is not registered: "+n.projection);let o=new Set([...Iu,...i?.parameters||[]]);for(let d of Object.keys(n.parameters)){if(!o.has(d))throw new Mr("missing-transform-stage","Unsupported PROJ parameter: +"+d);let m=bS.includes(d)||i?.flags?.includes(d);if(m&&n.parameters[d]!==void 0)throw new Error("Expected a flag without a value: +"+d);if(!m&&!n.parameters[d])throw new Error("PROJ parameter requires a value: +"+d)}if(n.parameters.type&&n.parameters.type!=="crs")throw new Error("Only +type=crs is supported");let s=Bu(n.projection)==="fasttransversemercator"?Object.freeze({...n.parameters,approx:void 0}):n.parameters,a=i?.create({...n.ellipsoid,parameters:s});if(n.kind==="geocentric"&&(!a?.forward3D||!a?.inverse3D))throw new Error("Geocentric plugin must implement 3D operations");let c=n.datum.grids,l=c?.findIndex(d=>d.name==="null")??-1,h=c?.slice(0,l<0?void 0:l+1).map(d=>{let m=Object.prototype.hasOwnProperty.call(r.datumGrids||{},d.name)?r.datumGrids[d.name]:void 0;if(m&&typeof m.shift!="function")throw new Error("Invalid prepared datum grid: "+d.name);return Object.freeze({...d,grid:m})});for(let d of h||[]){if(d.name==="null")break;!d.optional&&!d.grid&&pt("Required datum grid is not registered: "+d.name)}let u=h?Object.freeze({...n.datum,grids:Object.freeze(h)}):n.datum,f=TS(n.parameters.geoidgrids,r.verticalGrids);return f&&(n.kind==="geocentric"||n.kind==="identity"||n.lossy)&&pt("Vertical grids require a non-lossy geographic or projected CRS"),{...n,datum:u,implementation:a,verticalGrid:f}}function bp(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function AS(e,t){if(e==="enu")return;let r=[0,0,0],n=[0,0,0];for(let i=0;i<3;i++){let o=e[i],s="ew".includes(o)?0:"ns".includes(o)?1:2;r[t?i:s]=t?s:i,n[t?i:s]="wsd".includes(o)?-1:1}return i=>{let o=i.x,s=i.y,a=i.z;i.x=n[0]*(r[0]===0?o:r[0]===1?s:a),i.y=n[1]*(r[1]===0?o:r[1]===1?s:a),i.z=n[2]*(r[2]===0?o:r[2]===1?s:a)}}function RS(e,t,r){let n=e.storedAxis||(r?e.axis:"enu"),i=t.storedAxis||(r?t.axis:"enu"),o=AS(n,!1),s=AS(i,!0),a=e.implementation&&ci(e.implementation,!0,e.kind==="geocentric"),c=t.implementation&&ci(t.implementation,!1,t.kind==="geocentric"),l=wp(e.datum,t.datum),h=e.lossy||t.lossy,u=e.kind==="geocentric",f=e.kind==="geographic"?e.angularUnit:e.toMeter,d=t.kind==="geographic"?t.angularUnit:t.toMeter,m=u?1:e.verticalUnit,p=t.kind==="geocentric"?d:t.verticalUnit,g=e.primeMeridian,y=t.primeMeridian,w=t.kind==="geographic"?t.longitudeWrap:void 0,M;if(!l&&!e.verticalGrid&&!t.verticalGrid&&!h&&!o&&!s&&!g&&!y&&e.verticalUnit===1&&t.verticalUnit===1&&w===void 0){let x=Object.freeze({inputScale:f,outputScale:d});e.kind==="geographic"&&t.kind==="projected"&&(M=t.implementation?.createForwardFlat?.(x)),e.kind==="projected"&&t.kind==="geographic"&&(M=e.implementation?.createInverseFlat?.(x))}return{flat:M,requiresInputZ:!!(e.verticalGrid||t.verticalGrid)||e.kind==="geocentric"||/[ud]/.test(n.slice(0,2))||/[ud]/.test(i.slice(0,2)),geocentricOutput:t.kind==="geocentric",run(x){if(!bp(x))throw new Error("Coordinates must contain finite x, y and optional z values");o?.(x);let v=x.z;if(h&&(x.z=0),f!==1&&(x.x*=f,x.y*=f,u&&(x.z*=f)),a?.(x),m!==1&&(x.z*=m),Math.abs(x.y)>Math.PI/2||!bp(x))throw new Error("Coordinate is outside the geographic domain");if(x.x+=g,e.verticalGrid&&(x.z+=e.verticalGrid(x.x,x.y)),l?.(x),t.verticalGrid&&(x.z-=t.verticalGrid(x.x,x.y)),x.x-=y,w!==void 0&&(x.x=w+Xr(x.x-w)),c?.(x),d!==1&&(x.x/=d,x.y/=d),p!==1&&(x.z/=p),h&&(x.z=v),s?.(x),!bp(x))throw new Error("Projection produced non-finite coordinates")}}}function Sa(e,t,r,n){if(e.length<2)throw new Error("Coordinates must contain finite x, y and optional z values");if(e.length<3&&t.requiresInputZ)throw new Error("This transform requires three ordinates");let i=Math.max(e.length,t.geocentricOutput?3:2),o=r.acquire();try{if(o.x=e[0],o.y=e[1],o.z=e.length>=3?e[2]:0,t.run(o),n)return iS(e,n,o,i);let s=e.slice();return s[0]=o.x,s[1]=o.y,(e.length>=3||t.geocentricOutput)&&(s[2]=o.z),s}finally{r.release(o)}}function Ou(e,t,r,n){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error("In-place projection requires a Float32Array or Float64Array");if(!Number.isSafeInteger(t)||t<2||e.length%t!==0)throw new Error("Dimension must be an integer >= 2 and divide the typed array length");if(t<3&&(r.requiresInputZ||r.geocentricOutput))throw new Error("This transform requires a dimension of at least 3");if(r.flat)return r.flat(e,t),e;let i=n.acquire();try{let o=e instanceof Float32Array;for(let s=0;s<e.length;s+=t){if(i.x=e[s],i.y=e[s+1],i.z=t>=3?e[s+2]:0,r.run(i),o&&(Math.abs(i.x)>34028234663852886e22||Math.abs(i.y)>34028234663852886e22||t>=3&&Math.abs(i.z)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");e[s]=i.x,e[s+1]=i.y,t>=3&&(e[s+2]=i.z)}return e}finally{n.release(i)}}var Nu=class{constructor(t={}){this.options=gR(t)}createProjection(t={}){return new Kc({...this.options,...t})}async createProjectionAsync(t={}){return Kc.create({...this.options,...t})}};function gR(e){return{...e,projections:e.projections&&[...e.projections],parsers:e.parsers&&[...e.parsers],datumCatalogs:e.datumCatalogs&&[...e.datumCatalogs],aliases:e.aliases&&JSON.parse(JSON.stringify(e.aliases)),datumGrids:e.datumGrids&&{...e.datumGrids},verticalGrids:e.verticalGrids&&{...e.verticalGrids}}}function pn(e,t){return{...Kr(e,t),createForwardFlat(r){return this.forwardInPlace===e?PS(e,!1,r):void 0},createInverseFlat(r){return this.inverseInPlace===t?PS(t,!0,r):void 0}}}function PS(e,t,{inputScale:r,outputScale:n}){let i=new qi;return(o,s)=>{let a=i.acquire();try{let c=o instanceof Float32Array;for(let l=0;l<o.length;l+=s){if(a.x=o[l],a.y=o[l+1],a.z=s>=3?o[l+2]:0,!Number.isFinite(a.x)||!Number.isFinite(a.y)||!Number.isFinite(a.z))throw new Error("Coordinates must contain finite x, y and optional z values");if(r!==1&&(a.x*=r,a.y*=r),t&&e(a),Math.abs(a.y)>Math.PI/2||!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Coordinate is outside the geographic domain");if(a.x+=0,a.x-=0,t||e(a),n!==1&&(a.x/=n,a.y/=n),!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Projection produced non-finite coordinates");if(c&&(Math.abs(a.x)>34028234663852886e22||Math.abs(a.y)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");o[l]=a.x,o[l+1]=a.y}}finally{i.release(a)}}}var Sp={name:"merc",aliases:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A"],parameters:["lon_0","lat_ts","k","k_0","x_0","y_0"],create({semiMajorAxis:e,eccentricitySquared:t,parameters:r}){let n=Math.sqrt(t),i=Object.prototype.hasOwnProperty.call(r,"over")?h=>h:Xr,o=nt(r,"lon_0",0)*Jt,s=nt(r,"x_0",0),a=nt(r,"y_0",0),c=nt(r,"k_0",nt(r,"k",1));if(Object.prototype.hasOwnProperty.call(r,"lat_ts")){let h=$c(r,"lat_ts");c=Math.cos(h)/Math.sqrt(1-t*Math.sin(h)**2)}if(c<=0)throw new Error("Mercator scale must be positive");let l=e*c;return pn(h=>{let u=h.x,f=h.y;if(Math.abs(f)>=Math.PI/2)throw new Error("Mercator is undefined at the poles");let d=Math.asinh(Math.tan(f));h.x=s+l*i(u-o),h.y=a+l*(n===0?d+0:d-n*Math.atanh(n*Math.sin(f)))},h=>{let u=h.x,d=(h.y-a)/l,m=Math.atan(Math.sinh(d));if(n===0){h.x=i(o+(u-s)/l),h.y=m+0;return}for(let p=0;p<30;p++){let g=Math.atan(Math.sinh(d+n*Math.atanh(n*Math.sin(m))));if(Math.abs(g-m)<1e-13){h.x=i(o+(u-s)/l),h.y=g;return}m=g}throw new Error("Mercator inverse did not converge")})}};var xp={name:"eqc",aliases:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical"],parameters:["lon_0","lat_0","lat_ts","x_0","y_0"],create({semiMajorAxis:e,parameters:t}){let r=Object.prototype.hasOwnProperty.call(t,"over")?c=>c:Xr,n=nt(t,"lon_0",0)*Jt,i=$c(t,"lat_0"),o=Math.cos($c(t,"lat_ts")),s=nt(t,"x_0",0),a=nt(t,"y_0",0);return Kr(c=>{c.x=s+e*o*r(c.x-n),c.y=a+e*(c.y-i)},c=>{c.x=r(n+(c.x-s)/(e*o)),c.y=i+(c.y-a)/e})}};var we=["lon_0","lat_0","x_0","y_0"],li=["k","k_0"];function ji(e,t,r=0){let n=nt(e,t,r);if(t!=="lon_0"&&Math.abs(n)>90)throw new Error("Latitude parameter must be between -90 and 90 degrees: +"+t);return n*Jt}function gn(e,t){let r=Object.prototype.hasOwnProperty.call(e,t);if(r&&e[t]!==void 0)throw new Error("Expected a flag without a value: +"+t);return r}function ye({semiMajorAxis:e,eccentricitySquared:t,parameters:r}){let n=nt(r,"k_0",nt(r,"k",1));if(n<=0)throw new Error("Projection scale must be positive");return{a:e,b:e*Math.sqrt(1-t),es:t,e:Math.sqrt(t),ep2:t/(1-t),sphere:t===0,over:gn(r,"over"),long0:ji(r,"lon_0"),lat0:ji(r,"lat_0"),lat1:ji(r,"lat_1"),lat2:ji(r,"lat_2",nt(r,"lat_1",0)),lat_ts:ji(r,"lat_ts",NaN),x0:nt(r,"x_0",0),y0:nt(r,"y_0",0),k0:n}}function xa(e,t){if(!Object.prototype.hasOwnProperty.call(t,"lat_1"))throw new Error("Conic projections require +lat_1");if(Math.abs(e.lat1+e.lat2)<1e-10||Math.abs(e.lat1)>=Math.PI/2||Math.abs(e.lat2)>=Math.PI/2)throw new Error("Conic standard parallels must not be opposite or at a pole")}function fe(e,t,r,n,i=Kr){let o=(s,a)=>{let c=s(t,a);if(!c||typeof c!="object"||!Number.isFinite(c.x)||!Number.isFinite(c.y))throw new Error(e+": coordinate outside projection domain or inverse did not converge");a.x=c.x,a.y=c.y};return i(s=>o(r,s),s=>o(n,s))}function Wi(e,t){let r=ci(t,!1);return Kr(n=>{let i=n.x,o=n.y,s=Math.atan2(Math.sin(i-e.long0),Math.cos(i-e.long0)),a=Math.abs(Math.abs(e.lat0)-Math.PI/2)<1e-10;if(Math.abs(o+e.lat0)<1e-10&&(a||Math.abs(Math.abs(s)-Math.PI)<1e-10))throw new Error("Azimuthal projection is undefined at the antipode");r(n)},ci(t,!0))}function ar(e,t,r){var n=e*t;return r/Math.sqrt(1-n*n)}var R=Math.PI/2,Mt=Math.PI/4,Hi=Math.PI*2,jt=3.14159265359,Mp=Math.PI/180,vp=180/Math.PI,Tp=Math.PI/(180*3600);function vr(e,t,r){var n=e*r,i=.5*e;return n=Math.pow((1-n)/(1+n),i),Math.tan(.5*(R-t))/n}function zn(e){return e<0?-1:1}function O(e,t){return t||Math.abs(e)<=jt?e:e-zn(e)*Hi}function ss(e,t){for(var r=.5*e,n,i,o=R-2*Math.atan(t),s=0;s<=15;s++)if(n=e*Math.sin(o),i=R-2*Math.atan(t*Math.pow((1-n)/(1+n),r))-o,o+=i,Math.abs(i)<=1e-10)return o;return-9999}function yR(e){if(e.k0||(e.k0=1),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,!(Math.abs(e.lat1+e.lat2)<1e-10)){var t=e.b/e.a;e.e=Math.sqrt(1-t*t);var r=Math.sin(e.lat1),n=Math.cos(e.lat1),i=ar(e.e,r,n),o=vr(e.e,e.lat1,r),s=Math.sin(e.lat2),a=Math.cos(e.lat2),c=ar(e.e,s,a),l=vr(e.e,e.lat2,s),h=vr(e.e,e.lat0,Math.sin(e.lat0));Math.abs(e.lat1-e.lat2)>1e-10?e.ns=Math.log(i/c)/Math.log(o/l):e.ns=r,Number.isNaN(e.ns)&&(e.ns=r),e.f0=i/(e.ns*Math.pow(o,e.ns)),e.rh=Math.abs(Math.abs(e.lat0)-R)<1e-10?0:e.a*e.f0*Math.pow(h,e.ns)}}function OS(e,t){var r=t.x,n=t.y;Math.abs(2*Math.abs(n)-Math.PI)<=1e-10&&(n=zn(n)*(R-2*1e-10));var i=Math.abs(Math.abs(n)-R),o,s;if(i>1e-10)o=vr(e.e,n,Math.sin(n)),s=e.a*e.f0*Math.pow(o,e.ns);else{if(i=n*e.ns,i<=0)return null;s=0}var a=e.ns*O(r-e.long0,e.over);return t.x=e.k0*(s*Math.sin(a))+e.x0,t.y=e.k0*(e.rh-s*Math.cos(a))+e.y0,t}function BS(e,t){var r,n,i,o,s,a=(t.x-e.x0)/e.k0,c=e.rh-(t.y-e.y0)/e.k0;e.ns>0?(r=Math.sqrt(a*a+c*c),n=1):(r=-Math.sqrt(a*a+c*c),n=-1);var l=0;if(r!==0&&(l=Math.atan2(n*a,n*c)),r!==0||e.ns>0){if(n=1/e.ns,i=Math.pow(r/(e.a*e.f0),n),o=ss(e.e,i),o===-9999)return null}else o=-R;return s=O(l/e.ns+e.long0,e.over),t.x=s,t.y=o,t}function NS(e){let t={...e,ns:0,f0:0,rh:0};return yR(t),t}var Ep={name:"lcc",aliases:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],parameters:[...we,...li,"lat_1","lat_2"],create(e){let t=ye(e);xa(t,e.parameters);let r=NS(t),n=fe("lcc",r,OS,BS);return pn(i=>{let o=i.y;if(Math.abs(o)===Math.PI/2&&o*r.ns<0)throw new Error("Lambert conformal conic is undefined at the opposite pole");n.forwardInPlace(i)},n.inverseInPlace)}};function cr(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}function lr(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function _R(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e3=Math.sqrt(e.es),e.sin_po=Math.sin(e.lat1),e.cos_po=Math.cos(e.lat1),e.t1=e.sin_po,e.con=e.sin_po,e.ms1=ar(e.e3,e.sin_po,e.cos_po),e.qs1=cr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat2),e.cos_po=Math.cos(e.lat2),e.t2=e.sin_po,e.ms2=ar(e.e3,e.sin_po,e.cos_po),e.qs2=cr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat0),e.cos_po=Math.cos(e.lat0),e.t3=e.sin_po,e.qs0=cr(e.e3,e.sin_po),Math.abs(e.lat1-e.lat2)>1e-10?e.ns0=(e.ms1*e.ms1-e.ms2*e.ms2)/(e.qs2-e.qs1):e.ns0=e.con,e.c=e.ms1*e.ms1+e.ns0*e.qs1,e.rh=e.a*Math.sqrt(e.c-e.ns0*e.qs0)/e.ns0)}function LS(e,t){var r=t.x,n=t.y;e.sin_phi=Math.sin(n),e.cos_phi=Math.cos(n);var i=cr(e.e3,e.sin_phi),o=e.a*Math.sqrt(e.c-e.ns0*i)/e.ns0,s=e.ns0*O(r-e.long0,e.over),a=o*Math.sin(s)+e.x0,c=e.rh-o*Math.cos(s)+e.y0;return t.x=a,t.y=c,t}function FS(e,t){var r,n,i,o,s,a;return t.x-=e.x0,t.y=e.rh-t.y+e.y0,e.ns0>=0?(r=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(r=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),o=0,r!==0&&(o=Math.atan2(i*t.x,i*t.y)),i=r*e.ns0/e.a,e.sphere?a=Math.asin((e.c-i*i)/(2*e.ns0)):(n=(e.c-i*i)/e.ns0,a=wR(e.e3,n)),s=O(o/e.ns0+e.long0,e.over),t.x=s,t.y=a,t}function wR(e,t){var r,n,i,o,s,a=lr(.5*t);if(e<1e-10)return a;for(var c=e*e,l=1;l<=25;l++)if(r=Math.sin(a),n=Math.cos(a),i=e*r,o=1-i*i,s=.5*o*o/n*(t/(1-c)-r/o+.5/e*Math.log((1-i)/(1+i))),a=a+s,Math.abs(s)<=1e-7)return a;return null}function DS(e){let t={...e,temp:0,e3:0,sin_po:0,cos_po:0,t1:0,con:0,ms1:0,qs1:0,t2:0,ms2:0,qs2:0,t3:0,qs0:0,ns0:0,c:0,rh:0,sin_phi:0,cos_phi:0};return _R(t),t}var Ip={name:"aea",aliases:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers"],parameters:[...we,"lat_1","lat_2"],create(e){let t=ye(e);return xa(t,e.parameters),fe("aea",DS(t),LS,FS,pn)}};var bR=1,SR=.25,US=.046875,zS=.01953125,VS=.01068115234375,xR=.75,MR=.46875,vR=.013020833333333334,TR=.007120768229166667,ER=.3645833333333333,IR=.005696614583333333,AR=.3076171875;function Vn(e){var t=[];t[0]=bR-e*(SR+e*(US+e*(zS+e*VS))),t[1]=e*(xR-e*(US+e*(zS+e*VS)));var r=e*e;return t[2]=r*(MR-e*(vR+e*TR)),r*=e,t[3]=r*(ER-e*IR),t[4]=r*e*AR,t}function _e(e,t,r,n){return r*=t,t*=t,n[0]*e-r*(n[1]+t*(n[2]+t*(n[3]+t*n[4])))}var RR=20;function Gn(e,t,r){for(var n=1/(1-t),i=e,o=RR;o;--o){var s=Math.sin(i),a=1-t*s*s;if(a=(_e(i,s,Math.cos(i),r)-e)*(a*Math.sqrt(a))*n,i-=a,Math.abs(a)<1e-10)return i}return i}function yn(e){return Math.abs(e)<R?e:e-zn(e)*Math.PI}function CR(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e=Math.sqrt(e.es),e.en=Vn(e.es),e.sin_phi=Math.sin(e.lat1),e.cos_phi=Math.cos(e.lat1),e.ms1=ar(e.e,e.sin_phi,e.cos_phi),e.ml1=_e(e.lat1,Math.sin(e.lat1),Math.cos(e.lat1),e.en),Math.abs(e.lat1-e.lat2)<1e-10?e.ns=e.sin_phi:(e.sin_phi=Math.sin(e.lat2),e.cos_phi=Math.cos(e.lat2),e.ms2=ar(e.e,e.sin_phi,e.cos_phi),e.ml2=_e(e.lat2,Math.sin(e.lat2),Math.cos(e.lat2),e.en),e.ns=(e.ms1-e.ms2)/(e.ml2-e.ml1)),e.g=e.ml1+e.ms1/e.ns,e.ml0=_e(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en),e.rh=e.a*(e.g-e.ml0))}function GS(e,t){var r=t.x,n=t.y,i;if(e.sphere)i=e.a*(e.g-n);else{var o=_e(n,Math.sin(n),Math.cos(n),e.en);i=e.a*(e.g-o)}var s=e.ns*O(r-e.long0,e.over),a=e.x0+i*Math.sin(s),c=e.y0+e.rh-i*Math.cos(s);return t.x=a,t.y=c,t}function kS(e,t){t.x-=e.x0,t.y=e.rh-t.y+e.y0;var r,n,i,o;e.ns>=0?(n=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(n=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1);var s=0;if(n!==0&&(s=Math.atan2(r*t.x,r*t.y)),e.sphere)return o=O(e.long0+s/e.ns,e.over),i=yn(e.g-n/e.a),t.x=o,t.y=i,t;var a=e.g-n/e.a;return i=Gn(a,e.es,e.en),o=O(e.long0+s/e.ns,e.over),t.x=o,t.y=i,t}function qS(e){let t={...e,temp:0,en:[],sin_phi:0,cos_phi:0,ms1:0,ml1:0,ns:0,ms2:0,ml2:0,g:0,ml0:0,rh:0};return CR(t),t}var Ap={name:"eqdc",aliases:["Equidistant_Conic"],parameters:[...we,"lat_1","lat_2"],create(e){let t=ye(e);return xa(t,e.parameters),fe("eqdc",qS(t),GS,kS,pn)}};var PR=.3333333333333333,OR=.17222222222222222,BR=.10257936507936508,NR=.06388888888888888,LR=.0664021164021164,FR=.016415012942191543;function Xc(e){var t,r=[];return r[0]=e*PR,t=e*e,r[0]+=t*OR,r[1]=t*NR,t*=e,r[0]+=t*BR,r[1]+=t*LR,r[2]=t*FR,r}function Zc(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var kn=1,hi=2,Zr=3,Tr=4;function DR(e){var t=Math.abs(e.lat0);if(Math.abs(t-R)<1e-10?e.mode=e.lat0<0?kn:hi:Math.abs(t)<1e-10?e.mode=Zr:e.mode=Tr,e.es>0){var r;switch(e.qp=cr(e.e,1),e.mmf=.5/(1-e.es),e.apa=Xc(e.es),e.mode){case hi:e.dd=1;break;case kn:e.dd=1;break;case Zr:e.rq=Math.sqrt(.5*e.qp),e.dd=1/e.rq,e.xmf=1,e.ymf=.5*e.qp;break;case Tr:e.rq=Math.sqrt(.5*e.qp),r=Math.sin(e.lat0),e.sinb1=cr(e.e,r)/e.qp,e.cosb1=Math.sqrt(1-e.sinb1*e.sinb1),e.dd=Math.cos(e.lat0)/(Math.sqrt(1-e.es*r*r)*e.rq*e.cosb1),e.xmf=e.rq,e.ymf=e.xmf/e.dd,e.xmf*=e.dd;break}}else e.mode===Tr&&(e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0))}function jS(e,t){var r,n,i,o,s,a,c,l,h,u,f=t.x,d=t.y;if(f=O(f-e.long0,e.over),e.sphere){if(s=Math.sin(d),u=Math.cos(d),i=Math.cos(f),e.mode===Tr||e.mode===Zr){if(n=e.mode===Zr?1+u*i:1+e.sinph0*s+e.cosph0*u*i,n<=1e-10)return null;n=Math.sqrt(2/n),r=n*u*Math.sin(f),n*=e.mode===Zr?s:e.cosph0*s-e.sinph0*u*i}else if(e.mode===hi||e.mode===kn){if(e.mode===hi&&(i=-i),Math.abs(d+e.lat0)<1e-10)return null;n=Mt-d*.5,n=2*(e.mode===kn?Math.cos(n):Math.sin(n)),r=n*Math.sin(f),n*=i}}else{switch(c=0,l=0,h=0,i=Math.cos(f),o=Math.sin(f),s=Math.sin(d),a=cr(e.e,s),(e.mode===Tr||e.mode===Zr)&&(c=a/e.qp,l=Math.sqrt(1-c*c)),e.mode){case Tr:h=1+e.sinb1*c+e.cosb1*l*i;break;case Zr:h=1+l*i;break;case hi:h=R+d,a=e.qp-a;break;case kn:h=d-R,a=e.qp+a;break}if(Math.abs(h)<1e-10)return null;switch(e.mode){case Tr:case Zr:h=Math.sqrt(2/h),e.mode===Tr?n=e.ymf*h*(e.cosb1*c-e.sinb1*l*i):(h=Math.sqrt(2/(1+l*i)),n=h*c*e.ymf),r=e.xmf*h*l*o;break;case hi:case kn:a>=0?(h=Math.sqrt(a),r=h*o,n=i*(e.mode===kn?h:-h)):r=n=0;break}}return t.x=e.a*r+e.x0,t.y=e.a*n+e.y0,t}function WS(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o,s,a,c,l,h;if(e.sphere){var u=0,f,d=0;if(f=Math.sqrt(r*r+n*n),o=f*.5,o>1)return null;switch(o=2*Math.asin(o),(e.mode===Tr||e.mode===Zr)&&(d=Math.sin(o),u=Math.cos(o)),e.mode){case Zr:o=Math.abs(f)<=1e-10?0:Math.asin(n*d/f),r*=d,n=u*f;break;case Tr:o=Math.abs(f)<=1e-10?e.lat0:Math.asin(u*e.sinph0+n*d*e.cosph0/f),r*=d*e.cosph0,n=(u-Math.sin(o)*e.sinph0)*f;break;case hi:n=-n,o=R-o;break;case kn:o-=R;break}i=n===0&&(e.mode===Zr||e.mode===Tr)?0:Math.atan2(r,n)}else{if(h=0,e.mode===Tr||e.mode===Zr){if(r/=e.dd,n*=e.dd,l=Math.sqrt(r*r+n*n),l<1e-10)return t.x=e.long0,t.y=e.lat0,t;a=2*Math.asin(.5*l/e.rq),s=Math.cos(a),r*=a=Math.sin(a),e.mode===Tr?(h=s*e.sinb1+n*a*e.cosb1/l,c=e.qp*h,n=l*e.cosb1*s-n*e.sinb1*a):(h=n*a/l,c=e.qp*h,n=l*s)}else if(e.mode===hi||e.mode===kn){if(e.mode===hi&&(n=-n),c=r*r+n*n,!c)return t.x=e.long0,t.y=e.lat0,t;h=1-c/e.qp,e.mode===kn&&(h=-h)}i=Math.atan2(r,n),o=Zc(Math.asin(h),e.apa)}return t.x=O(e.long0+i,e.over),t.y=o,t}function HS(e){let t={...e,mode:0,qp:0,mmf:0,apa:[],dd:0,rq:0,xmf:0,ymf:0,sinb1:0,cosb1:0,sinph0:0,cosph0:0};return DR(t),t}var Rp={name:"laea",aliases:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area"],parameters:we,create(e){let t=ye(e);return Wi(t,fe("laea",HS(t),jS,WS))}};function $S(e,t,r){return t*=r,Math.tan(.5*(R+e))*Math.pow((1-t)/(1+t),.5*r)}function UR(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.coslat0=Math.cos(e.lat0),e.sinlat0=Math.sin(e.lat0),e.sphere?!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&(e.k0=.5*(1+zn(e.lat0)*Math.sin(e.lat_ts))):(Math.abs(e.coslat0)<=1e-10&&(e.lat0>0?e.con=1:e.con=-1),e.cons=Math.sqrt(Math.pow(1+e.e,1+e.e)*Math.pow(1-e.e,1-e.e)),!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&Math.abs(Math.cos(e.lat_ts))>1e-10&&(e.k0=.5*e.cons*ar(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts))/vr(e.e,e.con*e.lat_ts,e.con*Math.sin(e.lat_ts))),e.ms1=ar(e.e,e.sinlat0,e.coslat0),e.X0=2*Math.atan($S(e.lat0,e.sinlat0,e.e))-R,e.cosX0=Math.cos(e.X0),e.sinX0=Math.sin(e.X0))}function YS(e,t){var r=t.x,n=t.y,i=Math.sin(n),o=Math.cos(n),s,a,c,l,h,u,f=O(r-e.long0,e.over);return Math.abs(Math.abs(r-e.long0)-Math.PI)<=1e-10&&Math.abs(n+e.lat0)<=1e-10?(t.x=NaN,t.y=NaN,t):e.sphere?(s=2*e.k0/(1+e.sinlat0*i+e.coslat0*o*Math.cos(f)),t.x=e.a*s*o*Math.sin(f)+e.x0,t.y=e.a*s*(e.coslat0*i-e.sinlat0*o*Math.cos(f))+e.y0,t):(a=2*Math.atan($S(n,i,e.e))-R,l=Math.cos(a),c=Math.sin(a),Math.abs(e.coslat0)<=1e-10?(h=vr(e.e,n*e.con,e.con*i),u=2*e.a*e.k0*h/e.cons,t.x=e.x0+u*Math.sin(r-e.long0),t.y=e.y0-e.con*u*Math.cos(r-e.long0),t):(Math.abs(e.sinlat0)<1e-10?(s=2*e.a*e.k0/(1+l*Math.cos(f)),t.y=s*c+e.y0):(s=2*e.a*e.k0*e.ms1/(e.cosX0*(1+e.sinX0*c+e.cosX0*l*Math.cos(f))),t.y=s*(e.cosX0*c-e.sinX0*l*Math.cos(f))+e.y0),t.x=s*l*Math.sin(f)+e.x0,t))}function KS(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a=Math.sqrt(t.x*t.x+t.y*t.y);if(e.sphere){var c=2*Math.atan(a/(2*e.a*e.k0));return r=e.long0,n=e.lat0,a<=1e-10?(t.x=r,t.y=n,t):(n=Math.asin(Math.cos(c)*e.sinlat0+t.y*Math.sin(c)*e.coslat0/a),Math.abs(e.coslat0)<1e-10?e.lat0>0?r=O(e.long0+Math.atan2(t.x,-1*t.y),e.over):r=O(e.long0+Math.atan2(t.x,t.y),e.over):r=O(e.long0+Math.atan2(t.x*Math.sin(c),a*e.coslat0*Math.cos(c)-t.y*e.sinlat0*Math.sin(c)),e.over),t.x=r,t.y=n,t)}else if(Math.abs(e.coslat0)<=1e-10){if(a<=1e-10)return n=e.lat0,r=e.long0,t.x=r,t.y=n,t;t.x*=e.con,t.y*=e.con,i=a*e.cons/(2*e.a*e.k0),n=e.con*ss(e.e,i),r=e.con*O(e.con*e.long0+Math.atan2(t.x,-1*t.y),e.over)}else o=2*Math.atan(a*e.cosX0/(2*e.a*e.k0*e.ms1)),r=e.long0,a<=1e-10?s=e.X0:(s=Math.asin(Math.cos(o)*e.sinX0+t.y*Math.sin(o)*e.cosX0/a),r=O(e.long0+Math.atan2(t.x*Math.sin(o),a*e.cosX0*Math.cos(o)-t.y*e.sinX0*Math.sin(o)),e.over)),n=-1*ss(e.e,Math.tan(.5*(R+s)));return t.x=r,t.y=n,t}function XS(e){let t={...e,coslat0:0,sinlat0:0,con:0,cons:0,ms1:0,X0:0,cosX0:0,sinX0:0};return UR(t),t}var Cp={name:"stere",aliases:["Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],parameters:[...we,...li,"lat_ts"],create(e){let t=ye(e);return Wi(t,fe("stere",XS(t),YS,KS))}};function Lu(e,t){return Math.pow((1-e)/(1+e),t)}var zR=20;function VR(e){var t=Math.sin(e.lat0),r=Math.cos(e.lat0);r*=r,e.rc=Math.sqrt(1-e.es)/(1-e.es*t*t),e.C=Math.sqrt(1+e.es*r*r/(1-e.es)),e.phic0=Math.asin(t/e.C),e.ratexp=.5*e.C*e.e,e.K=Math.tan(.5*e.phic0+Mt)/(Math.pow(Math.tan(.5*e.lat0+Mt),e.C)*Lu(e.e*t,e.ratexp))}function ZS(e,t){var r=t.x,n=t.y;return t.y=2*Math.atan(e.K*Math.pow(Math.tan(.5*n+Mt),e.C)*Lu(e.e*Math.sin(n),e.ratexp))-R,t.x=e.C*r,t}function JS(e,t){for(var r=1e-14,n=t.x/e.C,i=t.y,o=Math.pow(Math.tan(.5*i+Mt)/e.K,1/e.C),s=zR;s>0&&(i=2*Math.atan(o*Lu(e.e*Math.sin(t.y),-.5*e.e))-R,!(Math.abs(i-t.y)<r));--s)t.y=i;return s?(t.x=n,t.y=i,t):null}function QS(e){let t={...e,rc:0,C:0,phic0:0,ratexp:0,K:0};return VR(t),t}function ie(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),n=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(n,2))}function GR(e){e.rc&&(e.sinc0=Math.sin(e.phic0),e.cosc0=Math.cos(e.phic0),e.R2=2*e.rc)}function tx(e,t){var r,n,i,o;return t.x=O(t.x-e.long0,e.over),ZS(e,t),r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o=e.k0*e.R2/(1+e.sinc0*r+e.cosc0*n*i),t.x=o*n*Math.sin(t.x),t.y=o*(e.cosc0*r-e.sinc0*n*i),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function ex(e,t){var r,n,i,o,s;if(t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,s=ie(t.x,t.y),s){var a=2*Math.atan2(s,e.R2);r=Math.sin(a),n=Math.cos(a),o=Math.asin(n*e.sinc0+t.y*r*e.cosc0/s),i=Math.atan2(t.x*r,s*e.cosc0*n-t.y*e.sinc0*r)}else o=e.phic0,i=0;if(t.x=i,t.y=o,!JS(e,t))throw new Error("Oblique stereographic inverse did not converge");return t.x=O(t.x+e.long0,e.over),t}function rx(e){let t={...QS(e),sinc0:0,cosc0:0,R2:0};return GR(t),t}var Pp={name:"sterea",aliases:["Stereographic_North_Pole","Oblique_Stereographic","Oblique Stereographic Alternative","Double_Stereographic"],parameters:[...we,...li],create(e){let t=ye(e);if(Math.abs(t.lat0)===Math.PI/2)throw new Error("sterea requires a non-polar origin; use stere at the poles");return Wi(t,fe("sterea",rx(t),tx,ex))}};function Op(e,t){let r=1-e*Math.sin(t)**2;return(1-e)/(r*Math.sqrt(r))}function Fu(e,t,r,n){return Op(e,t-r*n)+Op(e,t+r*n)}function as(e,t,r,n){let i=(n-r)/8,o=0;for(let s=0;s<4;s++){let a=r+(2*s+1)*i;o+=i*(.362683783378362*Fu(t,a,i,.1834346424956498)+.3137066458778873*Fu(t,a,i,.525532409916329)+.2223810344533745*Fu(t,a,i,.7966664774136267)+.1012285362903763*Fu(t,a,i,.9602898564975363))}return e*o}function Bp(e,t,r){let n=Math.PI/2,i=as(e,t,0,n);if(!Number.isFinite(r)||Math.abs(r)>i)return NaN;let o=-n,s=n,a=r/i*n;for(let c=0;c<48;c++){let l=as(e,t,0,a)-r;if(Math.abs(l)<=8*Number.EPSILON*e)return a;l>0?s=a:o=a;let h=a-l/(e*Op(t,a));a=h>o&&h<s?h:(o+s)/2}return NaN}function nx(e,t,r,n,i,o,s){let a=n-t,c=Math.atan((1-o)*Math.tan(e)),l=Math.atan((1-o)*Math.tan(r)),h=Math.sin(c),u=Math.cos(c),f=Math.sin(l),d=Math.cos(l),m=a,p,g=100,y,w,M,x,v,T,I,A,F,C,P,D,at,z;do{if(y=Math.sin(m),w=Math.cos(m),M=Math.sqrt(d*y*(d*y)+(u*f-h*d*w)*(u*f-h*d*w)),M===0){s.x=0,s.y=0;return}x=h*f+u*d*w,v=Math.atan2(M,x),T=u*d*y/M,I=1-T*T,A=I!==0?x-2*h*f/I:0,F=o/16*I*(4+o*(4-3*I)),p=m,m=a+(1-F)*o*T*(v+F*M*(A+F*x*(-1+2*A*A)))}while(Math.abs(m-p)>1e-12&&--g>0);if(g===0){s.x=NaN,s.y=NaN;return}C=I*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),P=1+C/16384*(4096+C*(-768+C*(320-175*C))),D=C/1024*(256+C*(-128+C*(74-47*C))),at=D*M*(A+D/4*(x*(-1+2*A*A)-D/6*A*(-3+4*M*M)*(-3+4*A*A))),z=i*(1-o)*P*(v-at);let yt=Math.atan2(d*y,u*f-h*d*w);s.x=yt,s.y=z}function ix(e,t,r,n,i,o,s){let a=Math.atan((1-o)*Math.tan(e)),c=Math.sin(a),l=Math.cos(a),h=Math.sin(r),u=Math.cos(r),f=Math.atan2(c,l*u),d=l*h,m=1-d*d,p=m*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),g=1+p/16384*(4096+p*(-768+p*(320-175*p))),y=p/1024*(256+p*(-128+p*(74-47*p))),w=n/(i*(1-o)*g),M,x=100,v,T,I,A;do v=Math.cos(2*f+w),T=Math.sin(w),I=Math.cos(w),A=y*T*(v+y/4*(I*(-1+2*v*v)-y/6*v*(-3+4*T*T)*(-3+4*v*v))),M=w,w=n/(i*(1-o)*g)+A;while(Math.abs(w-M)>1e-12&&--x>0);if(x===0){s.x=NaN,s.y=NaN;return}let F=c*T-l*I*u,C=Math.atan2(c*I+l*T*u,(1-o)*Math.sqrt(d*d+F*F)),P=Math.atan2(T*h,l*I-c*T*u),D=o/16*m*(4+o*(4-3*m)),at=P-(1-D)*o*d*(w+D*T*(v+D*I*(-1+2*v*v))),z=t+at;s.x=z,s.y=C}function kR(e){e.sin_p12=Math.sin(e.lat0),e.cos_p12=Math.cos(e.lat0),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.f=e.es/(1+Math.sqrt(1-e.es))}function ox(e,t){var r=t.x,n=t.y,i=Math.sin(t.y),o=Math.cos(t.y),s=O(r-e.long0,e.over),a,c,l,h,u;if(e.sphere)return Math.abs(e.sin_p12-1)<=1e-10?(t.x=e.x0+e.a*(R-n)*Math.sin(s),t.y=e.y0-e.a*(R-n)*Math.cos(s),t):Math.abs(e.sin_p12+1)<=1e-10?(t.x=e.x0+e.a*(R+n)*Math.sin(s),t.y=e.y0+e.a*(R+n)*Math.cos(s),t):(h=e.sin_p12*i+e.cos_p12*o*Math.cos(s),c=Math.acos(h),l=c?c/Math.sin(c):1,t.x=e.x0+e.a*l*o*Math.sin(s),t.y=e.y0+e.a*l*(e.cos_p12*i-e.sin_p12*o*Math.cos(s)),t);if(Math.abs(e.sin_p12-1)<=1e-10)return a=as(e.a,e.es,n,R),t.x=e.x0+a*Math.sin(s),t.y=e.y0-a*Math.cos(s),t;if(Math.abs(e.sin_p12+1)<=1e-10)return a=as(e.a,e.es,-R,n),t.x=e.x0+a*Math.sin(s),t.y=e.y0+a*Math.cos(s),t;{if(Math.abs(s)<1e-10&&Math.abs(n-e.lat0)<1e-10)return t.x=e.x0,t.y=e.y0,t;nx(e.lat0,e.long0,n,r,e.a,e.f,t),u=t.x;let f=t.y;return t.x=e.x0+f*Math.sin(u),t.y=e.y0+f*Math.cos(u),t}}function sx(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a,c,l,h,u,f;if(e.sphere){if(r=Math.sqrt(t.x*t.x+t.y*t.y),r>2*R*e.a)return null;if(n=r/e.a,i=Math.sin(n),o=Math.cos(n),s=e.long0,Math.abs(r)<=1e-10)a=e.lat0;else if(a=lr(o*e.sin_p12+t.y*i*e.cos_p12/r),c=Math.abs(e.lat0)-R,Math.abs(c)<=1e-10)if(e.lat0>=0){if(!Number.isFinite(a))return null;s=O(e.long0+Math.atan2(t.x,-t.y),e.over)}else s=O(e.long0-Math.atan2(-t.x,t.y),e.over);else s=O(e.long0+Math.atan2(t.x*i,r*e.cos_p12*o-t.y*e.sin_p12*i),e.over);return t.x=s,t.y=a,t}else return Math.abs(e.sin_p12-1)<=1e-10?(l=as(e.a,e.es,0,R),r=Math.sqrt(t.x*t.x+t.y*t.y),h=l-r,a=Bp(e.a,e.es,h),Number.isFinite(a)?(s=O(e.long0+Math.atan2(t.x,-1*t.y),e.over),t.x=s,t.y=a,t):null):Math.abs(e.sin_p12+1)<=1e-10?(l=as(e.a,e.es,0,R),r=Math.sqrt(t.x*t.x+t.y*t.y),h=r-l,a=Bp(e.a,e.es,h),Number.isFinite(a)?(s=O(e.long0+Math.atan2(t.x,t.y),e.over),t.x=s,t.y=a,t):null):(u=Math.atan2(t.x,t.y),f=Math.sqrt(t.x*t.x+t.y*t.y),ix(e.lat0,e.long0,u,f,e.a,e.f,t),t)}function ax(e){let t={...e,sin_p12:0,cos_p12:0,f:0};return kR(t),t}var Np={name:"aeqd",aliases:["Azimuthal_Equidistant"],parameters:we,create(e){let t=ye(e);return Wi(t,fe("aeqd",ax(t),ox,sx))}};function cs(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function cx(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function lx(e){var t=Math.abs(e);return t=cx(t*(1+t/(ie(1,t)+1))),e<0?-t:t}function Du(e,t){for(var r=2*Math.cos(2*t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return t+s*Math.sin(2*t)}function hx(e,t){for(var r=2*Math.cos(t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return Math.sin(t)*s}function Jc(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function Lp(e,t,r,n){for(var i=Math.sin(t),o=Math.cos(t),s=cs(r),a=Jc(r),c=2*o*a,l=-2*i*s,h=e.length-1,u=e[h],f=0,d=0,m=0,p,g;--h>=0;)p=d,g=f,d=u,f=m,u=-p+c*d-l*f+e[h],m=-g+l*d+c*f;c=i*a,l=o*s,n.x=c*u-l*m,n.y=c*m+l*u}function qR(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.k0=e.k0!==void 0?e.k0:1,e.cgb=[],e.cbg=[],e.utg=[],e.gtu=[];var t=e.es/(1+Math.sqrt(1-e.es)),r=t/(2-t),n=r;e.cgb[0]=r*(2+r*(-2/3+r*(-2+r*(116/45+r*(26/45+r*(-2854/675)))))),e.cbg[0]=r*(-2+r*(2/3+r*(4/3+r*(-82/45+r*(32/45+r*(4642/4725)))))),n=n*r,e.cgb[1]=n*(7/3+r*(-8/5+r*(-227/45+r*(2704/315+r*(2323/945))))),e.cbg[1]=n*(5/3+r*(-16/15+r*(-13/9+r*(904/315+r*(-1522/945))))),n=n*r,e.cgb[2]=n*(56/15+r*(-136/35+r*(-1262/105+r*(73814/2835)))),e.cbg[2]=n*(-26/15+r*(34/21+r*(8/5+r*(-12686/2835)))),n=n*r,e.cgb[3]=n*(4279/630+r*(-332/35+r*(-399572/14175))),e.cbg[3]=n*(1237/630+r*(-12/5+r*(-24832/14175))),n=n*r,e.cgb[4]=n*(4174/315+r*(-144838/6237)),e.cbg[4]=n*(-734/315+r*(109598/31185)),n=n*r,e.cgb[5]=n*(601676/22275),e.cbg[5]=n*(444337/155925),n=Math.pow(r,2),e.Qn=e.k0/(1+r)*(1+n*(1/4+n*(1/64+n/256))),e.utg[0]=r*(-.5+r*(2/3+r*(-37/96+r*(1/360+r*(81/512+r*(-96199/604800)))))),e.gtu[0]=r*(.5+r*(-2/3+r*(5/16+r*(41/180+r*(-127/288+r*(7891/37800)))))),e.utg[1]=n*(-1/48+r*(-1/15+r*(437/1440+r*(-46/105+r*(1118711/3870720))))),e.gtu[1]=n*(13/48+r*(-3/5+r*(557/1440+r*(281/630+r*(-1983433/1935360))))),n=n*r,e.utg[2]=n*(-17/480+r*(37/840+r*(209/4480+r*(-5569/90720)))),e.gtu[2]=n*(61/240+r*(-103/140+r*(15061/26880+r*(167603/181440)))),n=n*r,e.utg[3]=n*(-4397/161280+r*(11/504+r*(830251/7257600))),e.gtu[3]=n*(49561/161280+r*(-179/168+r*(6601661/7257600))),n=n*r,e.utg[4]=n*(-4583/161280+r*(108847/3991680)),e.gtu[4]=n*(34729/80640+r*(-3418889/1995840)),n=n*r,e.utg[5]=n*(-20648693/638668800),e.gtu[5]=n*(212378941/319334400);var i=Du(e.cbg,e.lat0);e.Zb=-e.Qn*(i+hx(e.gtu,2*i))}function ux(e,t){var r=O(t.x-e.long0,e.over),n=t.y;n=Du(e.cbg,n);var i=Math.sin(n),o=Math.cos(n),s=Math.sin(r),a=Math.cos(r);n=Math.atan2(i,a*o),r=Math.atan2(s*o,ie(i,o*a)),r=lx(Math.tan(r)),Lp(e.gtu,2*n,2*r,t),n=n+t.x,r=r+t.y;var c,l;return Math.abs(r)<=2.623395162778?(c=e.a*(e.Qn*r)+e.x0,l=e.a*(e.Qn*n+e.Zb)+e.y0):(c=1/0,l=1/0),t.x=c,t.y=l,t}function fx(e,t){var r=(t.x-e.x0)*(1/e.a),n=(t.y-e.y0)*(1/e.a);n=(n-e.Zb)/e.Qn,r=r/e.Qn;var i,o;if(Math.abs(r)<=2.623395162778){Lp(e.utg,2*n,2*r,t),n=n+t.x,r=r+t.y,r=Math.atan(cs(r));var s=Math.sin(n),a=Math.cos(n),c=Math.sin(r),l=Math.cos(r);n=Math.atan2(s*l,ie(c,l*a)),r=Math.atan2(c,l*a),i=O(r+e.long0,e.over),o=Du(e.cgb,n)}else i=1/0,o=1/0;return t.x=i,t.y=o,t}function dx(e){let t={...e,cgb:[],cbg:[],utg:[],gtu:[],Qn:0,Zb:0};return qR(t),t}function jR(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.es&&(e.en=Vn(e.es),e.ml0=_e(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function mx(e,t){var r=t.x,n=t.y,i=O(r-e.long0,e.over),o,s,a,c=Math.sin(n),l=Math.cos(n);if(e.es){var u=l*i,f=Math.pow(u,2),d=e.ep2*Math.pow(l,2),m=Math.pow(d,2),p=Math.abs(l)>1e-10?Math.tan(n):0,g=Math.pow(p,2),y=Math.pow(g,2);o=1-e.es*Math.pow(c,2),u=u/Math.sqrt(o);var w=_e(n,c,l,e.en);s=e.a*(e.k0*u*(1+f/6*(1-g+d+f/20*(5-18*g+y+14*d-58*g*d+f/42*(61+179*y-y*g-479*g)))))+e.x0,a=e.a*(e.k0*(w-e.ml0+c*i*u/2*(1+f/12*(5-g+9*d+4*m+f/30*(61+y-58*g+270*d-330*g*d+f/56*(1385+543*y-y*g-3111*g))))))+e.y0}else{var h=l*Math.sin(i);if(Math.abs(Math.abs(h)-1)<1e-10)return 93;if(s=.5*e.a*e.k0*Math.log((1+h)/(1-h))+e.x0,a=l*Math.cos(i)/Math.sqrt(1-Math.pow(h,2)),h=Math.abs(a),h>=1){if(h-1>1e-10)return 93;a=0}else a=Math.acos(a);n<0&&(a=-a),a=e.a*e.k0*(a-e.lat0)+e.y0}return t.x=s,t.y=a,t}function px(e,t){var r,n,i,o,s=(t.x-e.x0)*(1/e.a),a=(t.y-e.y0)*(1/e.a);if(e.es)if(r=e.ml0+a/e.k0,n=Gn(r,e.es,e.en),Math.abs(n)<R){var f=Math.sin(n),d=Math.cos(n),m=Math.abs(d)>1e-10?Math.tan(n):0,p=e.ep2*Math.pow(d,2),g=Math.pow(p,2),y=Math.pow(m,2),w=Math.pow(y,2);r=1-e.es*Math.pow(f,2);var M=s*Math.sqrt(r)/e.k0,x=Math.pow(M,2);r=r*m,i=n-r*x/(1-e.es)*.5*(1-x/12*(5+3*y-9*p*y+p-4*g-x/30*(61+90*y-252*p*y+45*w+46*p-x/56*(1385+3633*y+4095*w+1574*w*y)))),o=O(e.long0+M*(1-x/6*(1+2*y+p-x/20*(5+28*y+24*w+8*p*y+6*p-x/42*(61+662*y+1320*w+720*w*y))))/d,e.over)}else i=R*zn(a),o=0;else{var c=Math.exp(s/e.k0),l=.5*(c-1/c),h=e.lat0+a/e.k0,u=Math.cos(h);r=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(l,2))),i=Math.asin(r),Math.sin(h)<0&&(i=-i),l===0&&u===0?o=0:o=O(Math.atan2(l,u)+e.long0,e.over)}return t.x=o,t.y=i,t}function gx(e){let t={...e,en:[],ml0:0};return jR(t),t}function Uu(e){let t=ye(e);if(gn(e.parameters,"approx"))return fe("tmerc +approx",gx(t),mx,px,pn);if(t.sphere)throw new Error("Spherical transverse Mercator requires +approx");return fe("etmerc",dx(t),ux,fx,pn)}var Fp={name:"tmerc",aliases:["Fast_Transverse_Mercator","Fast Transverse Mercator","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger"],parameters:[...we,...li,"approx"],flags:["approx"],create:Uu},Dp={name:"etmerc",aliases:["Extended_Transverse_Mercator","Extended Transverse Mercator"],parameters:[...we,...li,"approx"],flags:["approx"],create:Uu};var Up={name:"utm",aliases:["Universal Transverse Mercator System"],parameters:["zone","south","approx"],flags:["south","approx"],create(e){let t=nt(e.parameters,"zone",NaN);if(!Number.isInteger(t)||t<1||t>60)throw new Error("UTM requires an integer +zone from 1 to 60");let r=gn(e.parameters,"south");return Uu({...e,parameters:{...e.parameters,lat_0:"0",lon_0:String(6*t-183),x_0:"500000",y_0:r?"10000000":"0",k_0:"0.9996"}})}};var zp={name:"geocent",aliases:["Geocentric","geocentric","Geocent"],parameters:[],create({semiMajorAxis:e,semiMinorAxis:t,eccentricitySquared:r}){let n={semiMajorAxis:e,eccentricitySquared:r,semiMinorAxis:t??e*Math.sqrt(1-r)};return{forward(){throw new Error("Geocentric projection requires the 3D pipeline")},inverse(){throw new Error("Geocentric projection requires the 3D pipeline")},forwardInPlace:i=>Cu(i,n),inverseInPlace:i=>Pu(i,n),forward3D:i=>MS(i,n),inverse3D:i=>vS(i,n)}}};function ht(e){let t=ye(e);return{...t,x0:0,y0:0,lat_ts:Number.isNaN(t.lat_ts)?0:t.lat_ts}}function ut(e,t,r,n,i,o){let s=fe(e,r,n,i),a=nt(t.parameters,"x_0",0),c=nt(t.parameters,"y_0",0);return Kr(l=>{o?.(l.x,l.y),s.forwardInPlace(l),l.x+=a,l.y+=c},l=>{l.x-=a,l.y-=c,s.inverseInPlace(l)})}function $i(e,t=0,r=!1){return(n,i)=>{let o=Math.sin(e.lat0)*Math.sin(i)+Math.cos(e.lat0)*Math.cos(i)*Math.cos(n-e.long0);if(r?o<t-1e-14:o<=t+1e-14)throw new Error("Coordinate is outside the visible projection horizon")}}var Qc=1e-10;function WR(e){var t;if(e.phi1=e.lat1,Math.abs(e.phi1)<Qc)throw new Error;e.es?(e.en=Vn(e.es),e.am1=Math.sin(e.phi1),t=Math.cos(e.phi1),e.m1=_e(e.phi1,e.am1,t,e.en),e.am1=t/(Math.sqrt(1-e.es*e.am1*e.am1)*e.am1)):Math.abs(e.phi1)+Qc>=R?e.cphi1=0:e.cphi1=1/Math.tan(e.phi1)}function HR(e,t){var r=O(t.x-(e.long0||0),e.over),n=t.y,i,o,s;return o=Math.sin(n),s=Math.cos(n),i=e.am1+e.m1-_e(n,o,s,e.en),o=s*r/(i*Math.sqrt(1-e.es*o*o)),t.x=i*Math.sin(o),t.y=e.am1-i*Math.cos(o),t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function $R(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n,i,o;if(t.y=e.am1-t.y,n=ie(t.x,t.y),e.phi1<0&&(n=-n),o=Gn(e.am1+e.m1-n,e.es,e.en),r=Math.abs(o),r<R)r=Math.sin(o),i=n*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)*Math.sqrt(1-e.es*r*r)/Math.cos(o);else if(Math.abs(r-R)<=Qc)i=0;else throw new Error;return t.x=O(i+(e.long0||0),e.over),t.y=yn(o),t}function YR(e,t){var r=O(t.x-(e.long0||0),e.over),n=t.y,i,o;return o=e.cphi1+e.phi1-n,Math.abs(o)>Qc?(i=r*Math.cos(n)/o,t.x=o*Math.sin(i),t.y=e.cphi1-o*Math.cos(i)):t.x=t.y=0,t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function KR(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n;t.y=e.cphi1-t.y;var i=ie(t.x,t.y);if(e.phi1<0&&(i=-i),n=e.cphi1+e.phi1-i,Math.abs(n)>R)throw new Error;return Math.abs(Math.abs(n)-R)<=Qc?r=0:r=i*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)/Math.cos(n),t.x=O(r+(e.long0||0),e.over),t.y=yn(n),t}function yx(e,t){return e.es?HR(e,t):YR(e,t)}function _x(e,t){return e.es?$R(e,t):KR(e,t)}function wx(e,t={}){let r={...e,phi1:0,en:[],m1:0,am1:0,cphi1:0,...t};return WR(r),r}var Vp={name:"bonne",aliases:["Bonne (Werner lat_1=90)"],parameters:["lon_0","x_0","y_0","lat_1"],create(e){let t=ht(e);if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_1")||Math.abs(t.lat1)<1e-10)throw new Error("Bonne requires a nonzero lat_1");let r=wx(t);return ut("bonne",e,r,yx,_x)}};function tl(e,t,r){var n=t*r;return e/Math.sqrt(1-n*n)}function XR(e){e.sphere||(e.en=Vn(e.es),e.ml0=e.a*_e(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function kp(e,t){var r,n,i=t.x,o=t.y;if(i=O(i-e.long0,e.over),e.sphere)r=e.a*Math.asin(Math.cos(o)*Math.sin(i)),n=e.a*(Math.atan2(Math.tan(o),Math.cos(i))-e.lat0);else{var s=Math.sin(o),a=Math.cos(o),c=tl(e.a,e.e,s),l=Math.tan(o)*Math.tan(o),h=i*Math.cos(o),u=h*h,f=e.es*a*a/(1-e.es),d=e.a*_e(o,s,a,e.en);r=c*h*(1-u*l*(1/6+(8-l+8*f)*u/120)),n=d-e.ml0+c*s/a*u*(.5+(5-l+6*f)*u/24)}return t.x=r+e.x0,t.y=n+e.y0,t}function bx(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o;if(e.sphere){var s=n+e.lat0;i=Math.asin(Math.sin(s)*Math.cos(r)),o=Math.atan2(Math.tan(r),Math.cos(s))}else{var a=e.ml0/e.a+n,c=Gn(a,e.es,e.en);if(Math.abs(Math.abs(c)-R)<=1e-10)return t.x=e.long0,t.y=Math.sign(c)*R,t;var l=tl(e.a,e.e,Math.sin(c)),h=l*l*l/e.a/e.a*(1-e.es),u=Math.pow(Math.tan(c),2),f=r*e.a/l,d=f*f;i=c-l*Math.tan(c)/h*f*f*(.5-(1+3*u)*f*f/24),o=f*(1-d*(u/3-(1+3*u)*u*d/15))/Math.cos(c)}if(!e.sphere){let m=t.x+e.x0,p=t.y+e.y0,g=e.scratch,y=!1;for(let w=0;w<12;w++){Gp(e,o,i);let M=g.x-m,x=g.y-p;if(Math.max(Math.abs(M),Math.abs(x))<1e-7){y=!0;break}let v=1e-7,T=i>R-v?-v:v,I=g.x,A=g.y;Gp(e,o+v,i);let F=(g.x-I)/v,C=(g.y-A)/v;Gp(e,o,i+T);let P=(g.x-I)/T,D=(g.y-A)/T,at=F*D-P*C;if(!Number.isFinite(at)||Math.abs(at)<1e-12||(o-=(D*M-P*x)/at,i-=(F*x-C*M)/at,!Number.isFinite(o)||Math.abs(i)>R))break}if(!y)throw new Error("Cassini inverse did not converge")}return t.x=O(o+e.long0,e.over),t.y=yn(i),t}function Gp(e,t,r){e.scratch.x=t+e.long0,e.scratch.y=r,kp(e,e.scratch)}function Sx(e,t={}){let r={...e,en:[],scratch:{x:0,y:0},ml0:0,...t};return XR(r),r}var qp={name:"cass",aliases:["Cassini","Cassini_Soldner"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=ht(e),r=Sx(t);return ut("cass",e,r,kp,bx)}};function xx(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));let n=4*Number.EPSILON*r;if(Math.abs(t)>r+n)return NaN;if(Math.abs(Math.abs(t)-r)<=n)return t<0?-1*R:R;for(var i=Math.asin(.5*t),o,s,a,c,l=0;l<30;l++)if(s=Math.sin(i),a=Math.cos(i),c=e*s,o=Math.pow(1-c*c,2)/(2*a)*(t/(1-e*e)-s/(1-c*c)+.5/e*Math.log((1-c)/(1+c))),i+=o,Math.abs(o)<=1e-10)return i;return NaN}function ZR(e){e.sphere||(e.k0=ar(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts)))}function Mx(e,t){var r=t.x,n=t.y,i,o,s=O(r-e.long0,e.over);if(e.sphere)i=e.x0+e.a*s*Math.cos(e.lat_ts),o=e.y0+e.a*Math.sin(n)/Math.cos(e.lat_ts);else{var a=cr(e.e,Math.sin(n));i=e.x0+e.a*e.k0*s,o=e.y0+e.a*a*.5/e.k0}return t.x=i,t.y=o,t}function vx(e,t){t.x-=e.x0,t.y-=e.y0;var r,n;return e.sphere?(r=O(e.long0+t.x/e.a/Math.cos(e.lat_ts),e.over),n=Math.asin(t.y/e.a*Math.cos(e.lat_ts))):(n=xx(e.e,2*t.y*e.k0/e.a),r=O(e.long0+t.x/(e.a*e.k0),e.over)),t.x=r,t.y=n,t}function Tx(e,t={}){let r={...e,...t};return ZR(r),r}var jp={name:"cea",aliases:[],parameters:["lon_0","x_0","y_0","lat_ts"],create(e){let t=ht(e);if(Math.abs(t.lat_ts)>=Math.PI/2)throw new Error("CEA standard parallel must be away from the poles");let r=Tx(t);return ut("cea",e,r,Mx,vx)}};var JR=20;function QR(e){e.long0=e.long0||0,e.sphere?(e.n=1,e.m=0,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)):e.en=Vn(e.es)}function zu(e,t){var r,n,i=t.x,o=t.y;if(i=O(i-e.long0,e.over),e.sphere){if(!e.m)o=e.n!==1?Math.asin(e.n*Math.sin(o)):o;else for(var s=e.n*Math.sin(o),a=JR;a;--a){var c=(e.m*o+Math.sin(o)-s)/(e.m+Math.cos(o));if(o-=c,Math.abs(c)<1e-10)break}r=e.a*e.C_x*i*(e.m+Math.cos(o)),n=e.a*e.C_y*o}else{var l=Math.sin(o),h=Math.cos(o);n=e.a*_e(o,l,h,e.en),r=e.a*i*h/Math.sqrt(1-e.es*l*l)}return t.x=r,t.y=n,t}function Vu(e,t){var r,n,i,o;return t.x-=e.x0,i=t.x/e.a,t.y-=e.y0,r=t.y/e.a,e.sphere?(r/=e.C_y,i=i/(e.C_x*(e.m+Math.cos(r))),e.m?r=lr((e.m*r+Math.sin(r))/e.n):e.n!==1&&(r=lr(Math.sin(r)/e.n)),i=O(i+e.long0,e.over),r=yn(r)):(r=Gn(t.y/e.a,e.es,e.en),o=Math.abs(r),o<R?(o=Math.sin(r),n=e.long0+t.x*Math.sqrt(1-e.es*o*o)/(e.a*Math.cos(r)),i=O(n,e.over)):o-1e-10<R&&(i=e.long0)),t.x=i,t.y=r,t}function Ex(e,t={}){let r={...e,en:[],n:0,m:0,C_y:0,C_x:0,...t};return QR(r),r}function tC(e){e.sphere=!0,e.b=e.a,e.m=1,e.n=2.5707963267948966,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)}var Ix=zu,Ax=Vu;function Rx(e,t={}){let r={...e,m:0,n:0,C_y:0,C_x:0,en:[],...t};return tC(r),r}var Wp={name:"eck6",aliases:["Eckert_VI"],parameters:["lon_0","x_0","y_0"],create(e){let t=ht(e),r=Rx(t);return ut("eck6",e,r,Ix,Ax)}};var el=1.340264,rl=-.081106,nl=893e-6,il=.003796,Gu=Math.sqrt(3)/2;function eC(e){e.long0=e.long0!==void 0?e.long0:0,e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.es!==0&&(e.apa=Xc(e.es),e.qp=cr(e.e,1),e.rqda=Math.sqrt(.5*e.qp))}function Cx(e,t){var r=O(t.x-e.long0,e.over),n=t.y,i=Math.sin(n);e.es!==0&&(i=cr(e.e,i)/e.qp);var o=Math.asin(Gu*i),s=o*o,a=s*s*s;return t.x=r*Math.cos(o)/(Gu*(el+3*rl*s+a*(7*nl+9*il*s))),t.y=o*(el+rl*s+a*(nl+il*s)),e.es!==0&&(t.x*=e.rqda,t.y*=e.rqda),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function Px(e,t){t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,e.es!==0&&(t.x/=e.rqda,t.y/=e.rqda);var r=1e-9,n=12,i=t.y,o,s,a,c,l,h;for(h=0;h<n&&(o=i*i,s=o*o*o,a=i*(el+rl*o+s*(nl+il*o))-t.y,c=el+3*rl*o+s*(7*nl+9*il*o),i-=l=a/c,!(Math.abs(l)<r));++h);return o=i*i,s=o*o*o,t.x=Gu*t.x*(el+3*rl*o+s*(7*nl+9*il*o))/Math.cos(i),t.y=Math.asin(Math.sin(i)/Gu),e.es!==0&&(t.y=Zc(t.y,e.apa)),t.x=O(t.x+e.long0,e.over),t}function Ox(e,t={}){let r={...e,apa:[],qp:0,rqda:0,...t};return eC(r),r}var Hp={name:"eqearth",aliases:["Equal Earth","Equal_Earth"],parameters:["lon_0","x_0","y_0"],create(e){let t=ht(e),r=Ox(t);return ut("eqearth",e,r,Cx,Px)}};function rC(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0}function Bx(e,t){var r=t.x,n=t.y,i=O(r-e.long0,e.over),o=e.x0+e.a*i*Math.cos(e.lat0),s=e.y0+e.a*n;return e.t1=o,e.t2=Math.cos(e.lat0),t.x=o,t.y=s,t}function Nx(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.y/e.a,n=O(e.long0+t.x/(e.a*Math.cos(e.lat0)),e.over);return t.x=n,t.y=r,t}function Lx(e,t={}){let r={...e,t2:0,t1:0,...t};return rC(r),r}var $p={name:"equi",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=ht(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Equirectangular standard parallel must be away from the poles");let r=Lx(t);return ut("equi",e,r,Bx,Nx)}};function nC(e){if(e.flip_axis=e.sweep==="x"?1:0,e.h=Number(e.h),e.radius_g_1=e.h/e.a,e.radius_g_1<=0||e.radius_g_1>1e10)throw new Error;if(e.radius_g=1+e.radius_g_1,e.C=e.radius_g*e.radius_g-1,e.es!==0){var t=1-e.es,r=1/t;e.radius_p=Math.sqrt(t),e.radius_p2=t,e.radius_p_inv2=r,e.shape="ellipse"}else e.radius_p=1,e.radius_p2=1,e.radius_p_inv2=1,e.shape="sphere"}function Fx(e,t){var r=t.x,n=t.y,i,o,s,a;if(r=r-e.long0,e.shape==="ellipse"){n=Math.atan(e.radius_p2*Math.tan(n));var c=e.radius_p/ie(e.radius_p*Math.cos(n),Math.sin(n));if(o=c*Math.cos(r)*Math.cos(n),s=c*Math.sin(r)*Math.cos(n),a=c*Math.sin(n),(e.radius_g-o)*o-s*s-a*a*e.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/ie(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/ie(s,i)))}else e.shape==="sphere"&&(i=Math.cos(n),o=Math.cos(r)*i,s=Math.sin(r)*i,a=Math.sin(n),i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/ie(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/ie(s,i))));return t.x=t.x*e.a,t.y=t.y*e.a,t}function Dx(e,t){var r=-1,n=0,i=0,o,s,a,c;if(t.x=t.x/e.a,t.y=t.y/e.a,e.shape==="ellipse"){e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*ie(1,i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*ie(1,n));var l=i/e.radius_p;if(o=n*n+l*l+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r),t.y=Math.atan(e.radius_p_inv2*Math.tan(t.y))}else if(e.shape==="sphere"){if(e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*Math.sqrt(1+i*i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*Math.sqrt(1+n*n)),o=n*n+i*i+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r)}return t.x=t.x+e.long0,t}function Ux(e,t={}){let r={...e,flip_axis:0,sweep:"",h:0,radius_g_1:0,radius_g:0,C:0,radius_p:0,radius_p2:0,radius_p_inv2:0,shape:"",...t};return nC(r),r}var Yp={name:"geos",aliases:["Geostationary Satellite View","Geostationary_Satellite"],parameters:["lon_0","x_0","y_0","h","sweep"],create(e){let t=ht(e),r=nt(e.parameters,"h",NaN);if(!Number.isFinite(r)||r<=0)throw new Error("Geostationary projection requires positive h");let n=e.parameters.sweep||"y";if(!["x","y"].includes(n))throw new Error("Geostationary sweep must be x or y");let i=Ux(t,{h:r,sweep:n});return ut("geos",e,i,Fx,Dx,t.sphere?$i({...t,lat0:0},1/(1+r/t.a),!0):void 0)}};function iC(e){e.sin_p14=Math.sin(e.lat0),e.cos_p14=Math.cos(e.lat0),e.infinity_dist=1e3*e.a,e.rc=1}function zx(e,t){var r,n,i,o,s,a,c,l,h=t.x,u=t.y;return i=O(h-e.long0,e.over),r=Math.sin(u),n=Math.cos(u),o=Math.cos(i),a=e.sin_p14*r+e.cos_p14*n*o,s=1,a>0||Math.abs(a)<=1e-10?(c=e.x0+e.a*s*n*Math.sin(i)/a,l=e.y0+e.a*s*(e.cos_p14*r-e.sin_p14*n*o)/a):(c=e.x0+e.infinity_dist*n*Math.sin(i),l=e.y0+e.infinity_dist*(e.cos_p14*r-e.sin_p14*n*o)),t.x=c,t.y=l,t}function Vx(e,t){var r,n,i,o,s,a;return t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,r=Math.sqrt(t.x*t.x+t.y*t.y),r?(o=Math.atan2(r,e.rc),n=Math.sin(o),i=Math.cos(o),a=lr(i*e.sin_p14+t.y*n*e.cos_p14/r),s=Math.atan2(t.x*n,r*e.cos_p14*i-t.y*e.sin_p14*n),s=O(e.long0+s,e.over)):(a=e.lat0,s=e.long0),t.x=s,t.y=a,t}function Gx(e,t={}){let r={...e,sin_p14:0,cos_p14:0,infinity_dist:0,rc:0,phic0:0,...t};return iC(r),r}var Kp={name:"gnom",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=ht(e),r=Gx(t);return ut("gnom",e,r,zx,Vx,$i(t))}};function Ma(e,t,r){if(Math.abs(t)>R)return Number.NaN;if(t===R)return Number.POSITIVE_INFINITY;if(t===-1*R)return Number.NEGATIVE_INFINITY;var n=e*r;return Math.log(Math.tan((R+t)/2))+e*Math.log((1-n)/(1+n))/2}function Xp(e,t){return 2*Math.atan(e*Math.exp(t))-R}function kx(e,t){var r=Xp(1,t),n=0,i=0;let o=0;do{if(++o>50)throw new Error("Isometric latitude inverse did not converge");n=r,i=e*Math.sin(n),r=Xp(Math.exp(e*Math.log((1+i)/(1-i))/2),t)}while(Math.abs(r-n)>1e-12);return r}function oC(e){e.k0||(e.k0=1);var t=e.b/e.a;e.e=Math.sqrt(1-t*t),e.lc=e.long0,e.rs=Math.sqrt(1+e.e*e.e*Math.pow(Math.cos(e.lat0),4)/(1-e.e*e.e));var r=Math.sin(e.lat0),n=Math.asin(r/e.rs),i=Math.sin(n);e.cp=Ma(0,n,i)-e.rs*Ma(e.e,e.lat0,r),e.n2=e.k0*e.a*Math.sqrt(1-e.e*e.e)/(1-e.e*e.e*r*r),e.xs=e.x0,e.ys=e.y0-e.n2*n}function qx(e,t){var r=t.x,n=t.y,i=e.rs*(r-e.lc),o=e.cp+e.rs*Ma(e.e,n,Math.sin(n)),s=Math.asin(Math.sin(i)/Jc(o)),a=Ma(0,s,Math.sin(s));return t.x=e.xs+e.n2*a,t.y=e.ys+e.n2*Math.atan(cs(o)/Math.cos(i)),t}function jx(e,t){var r=t.x,n=t.y,i=Math.atan(cs((r-e.xs)/e.n2)/Math.cos((n-e.ys)/e.n2)),o=Math.asin(Math.sin((n-e.ys)/e.n2)/Jc((r-e.xs)/e.n2)),s=Ma(0,o,Math.sin(o));return t.x=e.lc+i/e.rs,t.y=kx(e.e,(s-e.cp)/e.rs),t}function Wx(e,t={}){let r={...e,lc:0,rs:0,cp:0,n2:0,xs:0,ys:0,...t};return oC(r),r}var Zp={name:"gstmerc",aliases:["gstmerg"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=ht(e),r=Wx(t);return ut("gstmerc",e,r,qx,jx)}};function sC(e){e.a=6377397155e-3,e.es=.006674372230614,e.e=Math.sqrt(e.es),e.s45=.785398163397448,e.s90=2*e.s45,e.fi0=e.lat0,e.e2=e.es,e.e=Math.sqrt(e.e2),e.alfa=Math.sqrt(1+e.e2*Math.pow(Math.cos(e.fi0),4)/(1-e.e2)),e.uq=1.04216856380474,e.u0=Math.asin(Math.sin(e.fi0)/e.alfa),e.g=Math.pow((1+e.e*Math.sin(e.fi0))/(1-e.e*Math.sin(e.fi0)),e.alfa*e.e/2),e.k=Math.tan(e.u0/2+e.s45)/Math.pow(Math.tan(e.fi0/2+e.s45),e.alfa)*e.g,e.k1=e.k0,e.n0=e.a*Math.sqrt(1-e.e2)/(1-e.e2*Math.pow(Math.sin(e.fi0),2)),e.s0=1.37008346281555,e.n=Math.sin(e.s0),e.ro0=e.k1*e.n0/Math.tan(e.s0),e.ad=e.s90-e.uq}function Hx(e,t){var r,n,i,o,s,a,c,l=t.x,h=t.y,u=O(l-e.long0,e.over);return r=Math.pow((1+e.e*Math.sin(h))/(1-e.e*Math.sin(h)),e.alfa*e.e/2),n=2*(Math.atan(e.k*Math.pow(Math.tan(h/2+e.s45),e.alfa)/r)-e.s45),i=-u*e.alfa,o=Math.asin(Math.cos(e.ad)*Math.sin(n)+Math.sin(e.ad)*Math.cos(n)*Math.cos(i)),s=Math.asin(Math.cos(n)*Math.sin(i)/Math.cos(o)),a=e.n*s,c=e.ro0*Math.pow(Math.tan(e.s0/2+e.s45),e.n)/Math.pow(Math.tan(o/2+e.s45),e.n),t.y=c*Math.cos(a)/1,t.x=c*Math.sin(a)/1,e.czech||(t.y*=-1,t.x*=-1),t}function $x(e,t){var r,n,i,o,s,a,c,l,h=t.x;t.x=t.y,t.y=h,e.czech||(t.y*=-1,t.x*=-1),a=Math.sqrt(t.x*t.x+t.y*t.y),s=Math.atan2(t.y,t.x),o=s/Math.sin(e.s0),i=2*(Math.atan(Math.pow(e.ro0/a,1/e.n)*Math.tan(e.s0/2+e.s45))-e.s45),r=Math.asin(Math.cos(e.ad)*Math.sin(i)-Math.sin(e.ad)*Math.cos(i)*Math.cos(o)),n=Math.asin(Math.cos(i)*Math.sin(o)/Math.cos(r)),t.x=e.long0-n/e.alfa,c=r,l=0;var u=0;do t.y=2*(Math.atan(Math.pow(e.k,-1/e.alfa)*Math.pow(Math.tan(r/2+e.s45),1/e.alfa)*Math.pow((1+e.e*Math.sin(c))/(1-e.e*Math.sin(c)),e.e/2))-e.s45),Math.abs(c-t.y)<1e-10&&(l=1),c=t.y,u+=1;while(l===0&&u<15);return u>=15?null:t}function Yx(e,t={}){let r={...e,s45:0,s90:0,fi0:0,e2:0,alfa:0,uq:0,u0:0,g:0,k:0,k1:0,n0:0,s0:0,n:0,ro0:0,ad:0,czech:!1,...t};return sC(r),r}var Jp={name:"krovak",aliases:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","czech","alpha","lat_ts"],flags:["czech"],create(e){let t=nt(e.parameters,"alpha",30.28813972222222),r=nt(e.parameters,"lat_ts",78.5);if(![30.28813972222222,30.28813975277778].some(o=>Math.abs(t-o)<=1e-10))throw new Error("Krovak requires its fixed cone-axis co-latitude");if(Math.abs(r-78.5)>1e-10)throw new Error("Krovak requires its fixed 78.5 degree pseudo standard parallel");let n=ht(e);n.lat0=ji(e.parameters,"lat_0",49.5),n.long0=ji(e.parameters,"lon_0",24.83333333333333),n.k0=nt(e.parameters,"k_0",nt(e.parameters,"k",.9999));let i=Yx(n,{czech:gn(e.parameters,"czech")});return ut("krovak",e,i,Hx,$x)}};function Kx(e,t){var r=t.x,n=t.y,i=O(r-e.long0,e.over),o=e.x0+e.a*i,s=e.y0+e.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return t.x=o,t.y=s,t}function Xx(e,t){t.x-=e.x0,t.y-=e.y0;var r=O(e.long0+t.x/e.a,e.over),n=2.5*(Math.atan(Math.exp(.8*t.y/e.a))-Math.PI/4);return t.x=r,t.y=n,t}function Zx(e,t={}){let r={...e,...t};return r}var Qp={name:"mill",aliases:["Miller_Cylindrical"],parameters:["lon_0","x_0","y_0"],create(e){let t=ht(e),r=Zx(t);return ut("mill",e,r,Kx,Xx)}};function aC(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0}function Jx(e,t){var r=t.x,n=t.y,i=O(r-e.long0,e.over),o=n,s=Math.PI*Math.sin(n);for(let h=0;h<50;h++){if(Math.abs(Math.abs(n)-Math.PI/2)<1e-10){o=Math.sign(n)*Math.PI;break}var a=-(o+Math.sin(o)-s)/(1+Math.cos(o));if(o+=a,h===49)throw new Error("Mollweide forward did not converge");if(Math.abs(a)<1e-10)break}o/=2,Math.PI/2-Math.abs(n)<1e-10&&(i=0);var c=.900316316158*e.a*i*Math.cos(o)+e.x0,l=1.4142135623731*e.a*Math.sin(o)+e.y0;return t.x=c,t.y=l,t}function Qx(e,t){var r,n;t.x-=e.x0,t.y-=e.y0,n=t.y/(1.4142135623731*e.a),Math.abs(n)>.999999999999&&(n=Math.sign(n)*.999999999999),r=Math.asin(n);var i=O(e.long0+t.x/(.900316316158*e.a*Math.cos(r)),e.over);!e.over&&i<-Math.PI&&(i=-Math.PI),!e.over&&i>Math.PI&&(i=Math.PI),n=(2*r+Math.sin(2*r))/Math.PI,Math.abs(n)>1&&(n=Math.sign(n));var o=Math.asin(n);return t.x=i,t.y=o,t}function t2(e,t={}){let r={...e,...t};return aC(r),r}var t0={name:"moll",aliases:["Mollweide"],parameters:["lon_0","x_0","y_0"],create(e){let t=ht(e),r=t2(t);return ut("moll",e,r,Jx,Qx)}};function cC(e){e.A=[],e.A[1]=.6399175073,e.A[2]=-.1358797613,e.A[3]=.063294409,e.A[4]=-.02526853,e.A[5]=.0117879,e.A[6]=-.0055161,e.A[7]=.0026906,e.A[8]=-.001333,e.A[9]=67e-5,e.A[10]=-34e-5,e.B_re=[],e.B_im=[],e.B_re[1]=.7557853228,e.B_im[1]=0,e.B_re[2]=.249204646,e.B_im[2]=.003371507,e.B_re[3]=-.001541739,e.B_im[3]=.04105856,e.B_re[4]=-.10162907,e.B_im[4]=.01727609,e.B_re[5]=-.26623489,e.B_im[5]=-.36249218,e.B_re[6]=-.6870983,e.B_im[6]=-1.1651967,e.C_re=[],e.C_im=[],e.C_re[1]=1.3231270439,e.C_im[1]=0,e.C_re[2]=-.577245789,e.C_im[2]=-.007809598,e.C_re[3]=.508307513,e.C_im[3]=-.112208952,e.C_re[4]=-.15094762,e.C_im[4]=.18200602,e.C_re[5]=1.01418179,e.C_im[5]=1.64497696,e.C_re[6]=1.9660549,e.C_im[6]=2.5127645,e.D=[],e.D[1]=1.5627014243,e.D[2]=.5185406398,e.D[3]=-.03333098,e.D[4]=-.1052906,e.D[5]=-.0368594,e.D[6]=.007317,e.D[7]=.0122,e.D[8]=.00394,e.D[9]=-.0013}function e2(e,t){var r,n=t.x,i=t.y,o=i-e.lat0,s=n-e.long0,a=o/Tp*1e-5,c=s,l=1,h=0;for(r=1;r<=10;r++)l=l*a,h=h+e.A[r]*l;var u=h,f=c,d=1,m=0,p,g,y=0,w=0;for(r=1;r<=6;r++)p=d*u-m*f,g=m*u+d*f,d=p,m=g,y=y+e.B_re[r]*d-e.B_im[r]*m,w=w+e.B_im[r]*d+e.B_re[r]*m;return t.x=w*e.a+e.x0,t.y=y*e.a+e.y0,t}function r2(e,t){var r,n=t.x,i=t.y,o=n-e.x0,s=i-e.y0,a=s/e.a,c=o/e.a,l=1,h=0,u,f,d=0,m=0;for(r=1;r<=6;r++)u=l*a-h*c,f=h*a+l*c,l=u,h=f,d=d+e.C_re[r]*l-e.C_im[r]*h,m=m+e.C_im[r]*l+e.C_re[r]*h;for(var p=0;p<e.iterations;p++){var g=d,y=m,w,M,x=a,v=c;for(r=2;r<=6;r++)w=g*d-y*m,M=y*d+g*m,g=w,y=M,x=x+(r-1)*(e.B_re[r]*g-e.B_im[r]*y),v=v+(r-1)*(e.B_im[r]*g+e.B_re[r]*y);g=1,y=0;var T=e.B_re[1],I=e.B_im[1];for(r=2;r<=6;r++)w=g*d-y*m,M=y*d+g*m,g=w,y=M,T=T+r*(e.B_re[r]*g-e.B_im[r]*y),I=I+r*(e.B_im[r]*g+e.B_re[r]*y);var A=T*T+I*I;d=(x*T+v*I)/A,m=(v*T-x*I)/A}var F=d,C=m,P=1,D=0;for(r=1;r<=9;r++)P=P*F,D=D+e.D[r]*P;var at=e.lat0+D*Tp*1e5,z=e.long0+C;return t.x=z,t.y=at,t}function n2(e,t={}){let r={...e,A:[],B_re:[],B_im:[],C_re:[],C_im:[],D:[],iterations:1,...t};return cC(r),r}var e0={name:"nzmg",aliases:["New_Zealand_Map_Grid"],parameters:["lon_0","x_0","y_0","lat_0","iterations"],create(e){let t=ht(e),r=nt(e.parameters,"iterations",1);if(!Number.isInteger(r)||r<0||r>10)throw new Error("NZMG iterations must be an integer from 0 to 10");if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_0")||!Object.prototype.hasOwnProperty.call(e.parameters,"lon_0"))throw new Error("NZMG requires lat_0 and lon_0");let n=n2(t,{iterations:r});return ut("nzmg",e,n,e2,r2)}};var va=1e-7;function lC(e){return e.no_uoff||e.no_off||["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(e.projName.toLowerCase().replace(/[ _-]/g,""))}function hC(e){var t,r,n,i,o,s,a,c,l,h,u=0,f,d=0,m=0,p=0,g=0,y=0,w=0;e.k0||(e.k0=1),e.no_off=lC(e),e.no_rot=e.no_rot;var M=!1;Number.isFinite(e.alpha)&&(M=!0);var x=!1;if(Number.isFinite(e.rectified_grid_angle)&&(x=!0),M&&(w=e.alpha),x&&(u=e.rectified_grid_angle,M||(w=0,M=!0)),M||x)d=e.longc;else if(m=e.long1,g=e.lat1,p=e.long2,y=e.lat2,Math.abs(g-y)<=va||Math.abs(g)<=va||Math.abs(Math.abs(g)-R)<=va||Math.abs(Math.abs(e.lat0)-R)<=va||Math.abs(Math.abs(y)-R)<=va)throw new Error;var v=1-e.es;if(r=Math.sqrt(v),Math.abs(e.lat0)>1e-10?(c=Math.sin(e.lat0),n=Math.cos(e.lat0),t=1-e.es*c*c,e.B=n*n,e.B=Math.sqrt(1+e.es*e.B*e.B/v),e.A=e.B*e.k0*r/t,i=e.B*r/(n*Math.sqrt(t)),o=i*i-1,o<=0?o=0:(o=Math.sqrt(o),e.lat0<0&&(o=-o)),e.E=o+=i,e.E*=Math.pow(vr(e.e,e.lat0,c),e.B)):(e.B=1/r,e.A=e.k0,e.E=i=o=1),M||x){M?(f=Math.asin(Math.sin(w)/i),x||(u=w)):(f=u,w=Math.asin(i*Math.sin(f)));let T=.5*(o-1/o)*Math.tan(f);i>1&&Math.abs(Math.cos(w))<=8*Number.EPSILON?T=Math.sign(e.lat0)*Math.sign(Math.sin(w)):Math.abs(T)>1&&Math.abs(T)<=1+8*Number.EPSILON&&(T=Math.sign(T)),e.lam0=d-Math.asin(T)/e.B}else s=Math.pow(vr(e.e,g,Math.sin(g)),e.B),a=Math.pow(vr(e.e,y,Math.sin(y)),e.B),o=e.E/s,l=(a-s)/(a+s),h=e.E*e.E,h=(h-a*s)/(h+a*s),t=m-p,t<-Math.PI?p-=Hi:t>Math.PI&&(p+=Hi),e.lam0=O(.5*(m+p)-Math.atan(h*Math.tan(.5*e.B*(m-p))/l)/e.B,e.over),f=Math.atan(2*Math.sin(e.B*O(m-e.lam0,e.over))/(o-1/o)),u=w=Math.asin(i*Math.sin(f));e.singam=Math.sin(f),e.cosgam=Math.cos(f),e.sinrot=Math.sin(u),e.cosrot=Math.cos(u),e.rB=1/e.B,e.ArB=e.A*e.rB,e.BrA=1/e.ArB,e.no_off?e.u_0=0:(e.u_0=Math.abs(e.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(w))),e.lat0<0&&(e.u_0=-e.u_0)),o=.5*f,e.v_pole_n=e.ArB*Math.log(Math.tan(Mt-o)),e.v_pole_s=e.ArB*Math.log(Math.tan(Mt+o))}function i2(e,t){var r=t,n,i,o,s,a,c,l,h;if(t.x=t.x-e.lam0,Math.abs(Math.abs(t.y)-R)>1e-10){if(a=e.E/Math.pow(vr(e.e,t.y,Math.sin(t.y)),e.B),c=1/a,n=.5*(a-c),i=.5*(a+c),s=Math.sin(e.B*t.x),o=(n*e.singam-s*e.cosgam)/i,Math.abs(Math.abs(o)-1)<1e-10)throw new Error;h=.5*e.ArB*Math.log((1-o)/(1+o)),c=Math.cos(e.B*t.x),Math.abs(c)<va?l=e.A*t.x:l=e.ArB*Math.atan2(n*e.cosgam+s*e.singam,c)}else h=t.y>0?e.v_pole_n:e.v_pole_s,l=e.ArB*t.y;return e.no_rot?(r.x=l,r.y=h):(l-=e.u_0,r.x=h*e.cosrot+l*e.sinrot,r.y=l*e.cosrot-h*e.sinrot),r.x=e.a*r.x+e.x0,r.y=e.a*r.y+e.y0,r}function o2(e,t){var r,n,i,o,s,a,c,l=t;if(t.x=(t.x-e.x0)*(1/e.a),t.y=(t.y-e.y0)*(1/e.a),e.no_rot?(n=t.y,r=t.x):(n=t.x*e.cosrot-t.y*e.sinrot,r=t.y*e.cosrot+t.x*e.sinrot+e.u_0),i=Math.exp(-e.BrA*n),o=.5*(i-1/i),s=.5*(i+1/i),a=Math.sin(e.BrA*r),c=(a*e.cosgam+o*e.singam)/s,Math.abs(Math.abs(c)-1)<1e-10)l.x=0,l.y=c<0?-R:R;else{if(l.y=e.E/Math.sqrt((1+c)/(1-c)),l.y=ss(e.e,Math.pow(l.y,1/e.B)),l.y===1/0)throw new Error;l.x=-e.rB*Math.atan2(o*e.cosgam-a*e.singam,Math.cos(e.BrA*r))}return l.x+=e.lam0,l}function s2(e,t={}){let r={...e,no_off:!1,no_rot:!1,alpha:NaN,rectified_grid_angle:NaN,longc:0,long1:0,long2:0,B:0,A:0,E:0,lam0:0,singam:0,cosgam:0,sinrot:0,cosrot:0,rB:0,ArB:0,BrA:0,u_0:0,v_pole_n:0,v_pole_s:0,no_uoff:!1,projName:"",...t};return hC(r),r}var r0={name:"omerc",aliases:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","alpha","gamma","lonc","lon_1","lon_2","lat_1","lat_2","no_off","no_uoff","no_rot"],flags:["no_off","no_uoff","no_rot"],create(e){let t=ht(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Oblique Mercator origin must be away from the poles");let n=Object.prototype.hasOwnProperty.call(e.parameters,"alpha")||Object.prototype.hasOwnProperty.call(e.parameters,"gamma")?["lonc"]:["lon_1","lat_1","lon_2","lat_2"];for(let o of n)if(!Object.prototype.hasOwnProperty.call(e.parameters,o))throw new Error("Oblique Mercator requires "+o);let i=s2(t,{projName:e.parameters.proj||"omerc",alpha:nt(e.parameters,"alpha",NaN)*Math.PI/180,rectified_grid_angle:nt(e.parameters,"gamma",NaN)*Math.PI/180,longc:nt(e.parameters,"lonc",0)*Math.PI/180,long1:nt(e.parameters,"lon_1",0)*Math.PI/180,long2:nt(e.parameters,"lon_2",0)*Math.PI/180,no_off:gn(e.parameters,"no_off"),no_uoff:gn(e.parameters,"no_uoff"),no_rot:gn(e.parameters,"no_rot")});return ut("omerc",e,i,i2,o2)}};function uC(e){e.sin_p14=Math.sin(e.lat0||0),e.cos_p14=Math.cos(e.lat0||0)}function a2(e,t){var r,n,i,o,s,a,c,l,h=t.x,u=t.y;return i=O(h-(e.long0||0),e.over),r=Math.sin(u),n=Math.cos(u),o=Math.cos(i),a=e.sin_p14*r+e.cos_p14*n*o,s=1,(a>0||Math.abs(a)<=1e-10)&&(c=(e.x0||0)+e.a*s*n*Math.sin(i),l=(e.y0||0)+e.a*s*(e.cos_p14*r-e.sin_p14*n*o)),t.x=c,t.y=l,t}function c2(e,t){var r,n,i,o,s,a,c,l,h;if(t.x-=e.x0||0,t.y-=e.y0||0,r=Math.sqrt(t.x*t.x+t.y*t.y),r>e.a*(1+1e-14))throw new Error("Coordinate is outside the orthographic disk");return n=lr(r/e.a),i=Math.sin(n),o=Math.cos(n),l=e.long0||0,h=e.lat0||0,a=l,Math.abs(r)<=1e-10?(c=h,t.x=a,t.y=c,t):(c=lr(o*e.sin_p14+t.y*i*e.cos_p14/r),s=Math.abs(h)-R,Math.abs(s)<=1e-10?(h>=0?a=O(l+Math.atan2(t.x,-t.y),e.over):a=O(l-Math.atan2(-t.x,t.y),e.over),t.x=a,t.y=c,t):(a=O(l+Math.atan2(t.x*i,r*e.cos_p14*o-t.y*e.sin_p14*i),e.over),t.x=a,t.y=c,t))}function l2(e,t={}){let r={...e,sin_p14:0,cos_p14:0,...t};return uC(r),r}var n0={name:"ortho",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=ht(e),r=l2(t);return ut("ortho",e,r,a2,c2,$i(t,0,!0))}};function h2(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function u2(e){return .375*e*(1+.25*e*(1+.46875*e))}function f2(e){return .05859375*e*e*(1+.75*e)}function d2(e){return e*e*e*(35/3072)}function ku(e,t,r,n,i){return e*i-t*Math.sin(2*i)+r*Math.sin(4*i)-n*Math.sin(6*i)}var m2=20;function fC(e){e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e=Math.sqrt(e.es),e.e0=h2(e.es),e.e1=u2(e.es),e.e2=f2(e.es),e.e3=d2(e.es),e.ml0=e.a*ku(e.e0,e.e1,e.e2,e.e3,e.lat0)}function p2(e,t){var r=t.x,n=t.y,i,o,s,a=O(r-e.long0,e.over);if(s=a*Math.sin(n),e.sphere)Math.abs(n)<=1e-10?(i=e.a*a,o=-1*e.a*e.lat0):(i=e.a*Math.sin(s)/Math.tan(n),o=e.a*(yn(n-e.lat0)+(1-Math.cos(s))/Math.tan(n)));else if(Math.abs(n)<=1e-10)i=e.a*a,o=-1*e.ml0;else{var c=tl(e.a,e.e,Math.sin(n))/Math.tan(n);i=c*Math.sin(s),o=e.a*ku(e.e0,e.e1,e.e2,e.e3,n)-e.ml0+c*(1-Math.cos(s))}return t.x=i+e.x0,t.y=o+e.y0,t}function g2(e,t){var r,n,i,o,s,a,c,l,h;if(i=t.x-e.x0,o=t.y-e.y0,e.sphere)if(Math.abs(o+e.a*e.lat0)<=1e-10)r=O(i/e.a+e.long0,e.over),n=0;else{a=e.lat0+o/e.a,c=i*i/e.a/e.a+a*a,l=a;var u;for(s=m2;s;--s)if(u=Math.tan(l),h=-1*(a*(l*u+1)-l-.5*(l*l+c)*u)/((l-a)/u-1),l+=h,Math.abs(h)<=1e-10){n=l;break}r=O(e.long0+Math.asin(i*Math.tan(l)/e.a)/Math.sin(n),e.over)}else if(Math.abs(o+e.ml0)<=1e-10)n=0,r=O(e.long0+i/e.a,e.over);else{a=(e.ml0+o)/e.a,c=i*i/e.a/e.a+a*a,l=a;var f,d,m,p,g;for(s=m2;s;--s)if(g=e.e*Math.sin(l),f=Math.sqrt(1-g*g)*Math.tan(l),d=e.a*ku(e.e0,e.e1,e.e2,e.e3,l),m=e.e0-2*e.e1*Math.cos(2*l)+4*e.e2*Math.cos(4*l)-6*e.e3*Math.cos(6*l),p=d/e.a,h=(a*(f*p+1)-p-.5*f*(p*p+c))/(e.es*Math.sin(2*l)*(p*p+c-2*a*p)/(4*f)+(a-p)*(f*m-2/Math.sin(2*l))-m),l-=h,Math.abs(h)<=1e-10){n=l;break}f=Math.sqrt(1-e.es*Math.pow(Math.sin(n),2))*Math.tan(n),r=O(e.long0+Math.asin(i*f/e.a)/Math.sin(n),e.over)}return t.x=r,t.y=n,t}function y2(e,t={}){let r={...e,temp:0,e0:0,e1:0,e2:0,e3:0,ml0:0,...t};return fC(r),r}var i0={name:"poly",aliases:["Polyconic","American_Polyconic"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=ht(e),r=y2(t);return ut("poly",e,r,p2,g2)}};var Wt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},Pt={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function dC(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.lat_ts=e.lat_ts||0,e.lat0>=R-Mt/2?e.face=Wt.TOP:e.lat0<=-(R-Mt/2)?e.face=Wt.BOTTOM:Math.abs(e.long0)<=Mt?e.face=Wt.FRONT:Math.abs(e.long0)<=R+Mt?e.face=e.long0>0?Wt.RIGHT:Wt.LEFT:e.face=Wt.BACK,e.es!==0&&(e.one_minus_f=1-(e.a-e.b)/e.a,e.one_minus_f_squared=e.one_minus_f*e.one_minus_f)}function _2(e,t){var r=t,n,i,o,s,a,c,l=0;if(t.x-=e.long0,e.es!==0?n=Math.atan(e.one_minus_f_squared*Math.tan(t.y)):n=t.y,i=t.x,e.face===Wt.TOP)s=R-n,i>=Mt&&i<=R+Mt?(l=Pt.AREA_0,o=i-R):i>R+Mt||i<=-(R+Mt)?(l=Pt.AREA_1,o=i>0?i-jt:i+jt):i>-(R+Mt)&&i<=-Mt?(l=Pt.AREA_2,o=i+R):(l=Pt.AREA_3,o=i);else if(e.face===Wt.BOTTOM)s=R+n,i>=Mt&&i<=R+Mt?(l=Pt.AREA_0,o=-i+R):i<Mt&&i>=-Mt?(l=Pt.AREA_1,o=-i):i<-Mt&&i>=-(R+Mt)?(l=Pt.AREA_2,o=-i-R):(l=Pt.AREA_3,o=i>0?-i+jt:-i-jt);else{var h,u,f,d,m,p,g;e.face===Wt.RIGHT?i=Ta(i,+R):e.face===Wt.BACK?i=Ta(i,+jt):e.face===Wt.LEFT&&(i=Ta(i,-R)),d=Math.sin(n),m=Math.cos(n),p=Math.sin(i),g=Math.cos(i),h=m*g,u=m*p,f=d,e.face===Wt.FRONT?(s=Math.acos(h),o=qu(s,f,u)):e.face===Wt.RIGHT?(s=Math.acos(u),o=qu(s,f,-h)):e.face===Wt.BACK?(s=Math.acos(-h),o=qu(s,f,-u)):e.face===Wt.LEFT?(s=Math.acos(-u),o=qu(s,f,h)):s=o=0,Math.abs(o)<=Mt?l=Pt.AREA_0:o>Mt&&o<=R+Mt?(l=Pt.AREA_1,o-=R):o>R+Mt||o<=-(R+Mt)?(l=Pt.AREA_2,o=o>=0?o-jt:o+jt):(l=Pt.AREA_3,o+=R)}return c=Math.atan(12/jt*(o+Math.acos(Math.sin(o)*Math.cos(Mt))-R)),a=Math.sqrt((1-Math.cos(s))/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(o))))),l===Pt.AREA_1?c+=R:l===Pt.AREA_2?c+=jt:l===Pt.AREA_3&&(c+=1.5*jt),r.x=a*Math.cos(c),r.y=a*Math.sin(c),r.x=r.x*e.a+e.x0,r.y=r.y*e.a+e.y0,t}function w2(e,t){var r=0,n=0,i,o,s,a,c,l,h,u,f,d=0;if(t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,o=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),i=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?d=Pt.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(d=Pt.AREA_1,i-=R):t.x<0&&-t.x>=Math.abs(t.y)?(d=Pt.AREA_2,i=i<0?i+jt:i-jt):(d=Pt.AREA_3,i+=R),f=jt/12*Math.tan(i),c=Math.sin(f)/(Math.cos(f)-1/Math.sqrt(2)),l=Math.atan(c),s=Math.cos(i),a=Math.tan(o),h=1-s*s*a*a*(1-Math.cos(Math.atan(1/Math.cos(l)))),h<-1?h=-1:h>1&&(h=1),e.face===Wt.TOP)u=Math.acos(h),n=R-u,d===Pt.AREA_0?r=l+R:d===Pt.AREA_1?r=l<0?l+jt:l-jt:d===Pt.AREA_2?r=l-R:r=l;else if(e.face===Wt.BOTTOM)u=Math.acos(h),n=u-R,d===Pt.AREA_0?r=-l+R:d===Pt.AREA_1?r=-l:d===Pt.AREA_2?r=-l-R:r=l<0?-l-jt:-l+jt;else{var m,p,g;m=h,f=m*m,f>=1?g=0:g=Math.sqrt(1-f)*Math.sin(l),f+=g*g,f>=1?p=0:p=Math.sqrt(1-f),d===Pt.AREA_1?(f=p,p=-g,g=f):d===Pt.AREA_2?(p=-p,g=-g):d===Pt.AREA_3&&(f=p,p=g,g=-f),e.face===Wt.RIGHT?(f=m,m=-p,p=f):e.face===Wt.BACK?(m=-m,p=-p):e.face===Wt.LEFT&&(f=m,m=p,p=-f),n=Math.acos(-g)-R,r=Math.atan2(p,m),e.face===Wt.RIGHT?r=Ta(r,-R):e.face===Wt.BACK?r=Ta(r,-jt):e.face===Wt.LEFT&&(r=Ta(r,+R))}if(e.es!==0){var y,w,M;y=n<0?1:0,w=Math.tan(n),M=e.b/Math.sqrt(w*w+e.one_minus_f_squared),n=Math.atan(Math.sqrt(e.a*e.a-M*M)/(e.one_minus_f*M)),y&&(n=-n)}return r+=e.long0,t.x=r,t.y=n,t}function qu(e,t,r){return e<1e-10?0:Math.atan2(t,r)}function Ta(e,t){var r=e+t;return r<-jt?r+=Hi:r>+jt&&(r-=Hi),r}function b2(e,t={}){let r={...e,face:0,one_minus_f:0,one_minus_f_squared:0,...t};return dC(r),r}var o0={name:"qsc",aliases:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=ht(e),r=b2(t);return ut("qsc",e,r,_2,w2)}};var Ea=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Yi=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]];Ea=Ea.map(e=>e.map(Math.fround));Yi=Yi.map(e=>e.map(Math.fround));var S2=.8487,x2=1.3523,M2=vp/5,mC=1/M2,ls=18,ju=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},pC=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function gC(e,t,r,n,i){for(var o=r;i;--i){var s=(ju(e,o)-t)/pC(e,o);if(o-=s,Math.abs(s)<n)break}return o}function yC(e){e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.es=0}function v2(e,t){var r=O(t.x-e.long0,e.over),n=Math.abs(t.y),i=Math.floor(n*M2+1e-15);i<0?i=0:i>=ls&&(i=ls),n=vp*(n-mC*i);var o=ju(Ea[i],n)*r,s=ju(Yi[i],n);return t.y<0&&(s=-s),t.x=o*e.a*S2+e.x0,t.y=s*e.a*x2+e.y0,t}function T2(e,t){var r=t.y,n=t;n.x=(n.x-e.x0)/(e.a*S2),n.y=Math.abs(r-e.y0)/(e.a*x2);for(let a=0;a<=ls;a++)if(Math.abs(n.y-Yi[a][0])<=8*Number.EPSILON)return n.x=O(n.x/Ea[a][0]+e.long0,e.over),n.y=(r<e.y0?-1:1)*a*5*Mp,n;if(n.y>=1)n.x/=Ea[ls][0],n.y=r<0?-R:R;else{var i=Math.floor(n.y*ls);for(i<0?i=0:i>=ls&&(i=ls-1);;)if(Yi[i][0]>n.y)--i;else if(Yi[i+1][0]<=n.y)++i;else break;var o=Yi[i],s=5*(n.y-o[0])/(Yi[i+1][0]-o[0]);s=gC(o,n.y,s,1e-10,100),n.x/=ju(Ea[i],s),n.y=(5*i+s)*Mp,r<0&&(n.y=-n.y)}return n.x=O(n.x+e.long0,e.over),n}function E2(e,t={}){let r={...e,...t};return yC(r),r}var s0={name:"robin",aliases:["Robinson"],parameters:["lon_0","x_0","y_0"],create(e){let t=ht(e),r=E2(t);return ut("robin",e,r,v2,T2)}};var a0={name:"sinu",aliases:["Sinusoidal"],parameters:["lon_0","x_0","y_0"],create(e){let t=ht(e),r=Ex(t);return ut("sinu",e,r,zu,Vu)}};function _C(e){e.k0||(e.k0=1);var t=e.lat0;e.lambda0=e.long0;var r=Math.sin(t),n=e.a,i=e.rf,o=1/i,s=2*o-Math.pow(o,2);e.e=Math.sqrt(s);var a=e.e;e.R=e.k0*n*Math.sqrt(1-s)/(1-s*Math.pow(r,2)),e.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(t),4)),e.b0=Math.asin(r/e.alpha);var c=Math.log(Math.tan(Math.PI/4+e.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+a*r)/(1-a*r));e.K=c-e.alpha*l+e.alpha*a/2*h}function I2(e,t){var r=Math.log(Math.tan(Math.PI/4-t.y/2)),n=e.e/2*Math.log((1+e.e*Math.sin(t.y))/(1-e.e*Math.sin(t.y))),i=-e.alpha*(r+n)+e.K,o=2*(Math.atan(Math.exp(i))-Math.PI/4),s=e.alpha*(t.x-e.lambda0),a=Math.atan(Math.sin(s)/(Math.sin(e.b0)*Math.tan(o)+Math.cos(e.b0)*Math.cos(s))),c=Math.asin(Math.cos(e.b0)*Math.sin(o)-Math.sin(e.b0)*Math.cos(o)*Math.cos(s));return t.y=e.R/2*Math.log((1+Math.sin(c))/(1-Math.sin(c)))+e.y0,t.x=e.R*a+e.x0,t}function A2(e,t){for(var r=t.x-e.x0,n=t.y-e.y0,i=r/e.R,o=2*(Math.atan(Math.exp(n/e.R))-Math.PI/4),s=Math.asin(Math.cos(e.b0)*Math.sin(o)+Math.sin(e.b0)*Math.cos(o)*Math.cos(i)),a=Math.atan(Math.sin(i)/(Math.cos(e.b0)*Math.cos(i)-Math.sin(e.b0)*Math.tan(o))),c=e.lambda0+a/e.alpha,l=0,h=s,u=-1e3,f=0;Math.abs(h-u)>1e-7;){if(++f>20)return;l=1/e.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-e.K)+e.e*Math.log(Math.tan(Math.PI/4+Math.asin(e.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=c,t.y=h,t}function R2(e,t={}){let r={...e,lambda0:0,rf:0,R:0,alpha:0,b0:0,K:0,...t};return _C(r),r}var c0={name:"somerc",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=ht(e),r=R2(t,{rf:t.a===t.b?1/0:1/(1-t.b/t.a)});return ut("somerc",e,r,I2,A2)}};var Ae={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3};function wC(e){if(Math.abs(Math.abs(e.lat0)-R)<1e-10?e.mode=e.lat0<0?Ae.S_POLE:Ae.N_POLE:Math.abs(e.lat0)<1e-10?e.mode=Ae.EQUIT:(e.mode=Ae.OBLIQ,e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0)),e.pn1=e.h/e.a,e.pn1<=0||e.pn1>1e10)throw new Error("Invalid height");e.p=1+e.pn1,e.rp=1/e.p,e.h1=1/e.pn1,e.pfact=(e.p+1)*e.h1,e.es=0;var t=e.tilt,r=e.azi;e.cg=Math.cos(r),e.sg=Math.sin(r),e.cw=Math.cos(t),e.sw=Math.sin(t)}function C2(e,t){t.x-=e.long0;var r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o,s;switch(e.mode){case Ae.OBLIQ:s=e.sinph0*r+e.cosph0*n*i;break;case Ae.EQUIT:s=n*i;break;case Ae.S_POLE:s=-r;break;case Ae.N_POLE:s=r;break}switch(s=e.pn1/(e.p-s),o=s*n*Math.sin(t.x),e.mode){case Ae.OBLIQ:s*=e.cosph0*r-e.sinph0*n*i;break;case Ae.EQUIT:s*=r;break;case Ae.N_POLE:s*=-(n*i);break;case Ae.S_POLE:s*=n*i;break}var a,c;return a=s*e.cg+o*e.sg,c=1/(a*e.sw*e.h1+e.cw),o=(o*e.cg-s*e.sg)*e.cw*c,s=a*c,t.x=o*e.a,t.y=s*e.a,t}function P2(e,t){t.x/=e.a,t.y/=e.a;var r=t.x,n=t.y,i,o,s;s=1/(e.pn1-t.y*e.sw),i=e.pn1*t.x*s,o=e.pn1*t.y*e.cw*s,t.x=i*e.cg+o*e.sg,t.y=o*e.cg-i*e.sg;var a=ie(t.x,t.y);if(Math.abs(a)<1e-10)r=0,n=e.lat0;else{var c,l;switch(l=1-a*a*e.pfact,l=(e.p-Math.sqrt(l))/(e.pn1/a+a/e.pn1),c=Math.sqrt(1-l*l),e.mode){case Ae.OBLIQ:n=Math.asin(c*e.sinph0+t.y*l*e.cosph0/a),t.y=(c-e.sinph0*Math.sin(n))*a,t.x*=l*e.cosph0;break;case Ae.EQUIT:n=Math.asin(t.y*l/a),t.y=c*a,t.x*=l;break;case Ae.N_POLE:n=Math.asin(c),t.y=-t.y;break;case Ae.S_POLE:n=-Math.asin(c);break}r=Math.atan2(t.x,t.y)}return t.x=r+e.long0,t.y=n,t}function O2(e,t={}){let r={...e,mode:0,sinph0:0,cosph0:0,pn1:0,h:0,p:0,rp:0,h1:0,pfact:0,tilt:0,azi:0,cg:0,sg:0,cw:0,sw:0,...t};return wC(r),r}var l0={name:"tpers",aliases:["Tilted_Perspective"],parameters:["lon_0","x_0","y_0","lat_0","h","tilt","azi"],create(e){let t=ht(e),r=nt(e.parameters,"h",1e5),n=nt(e.parameters,"tilt",0)*Math.PI/180,i=nt(e.parameters,"azi",0)*Math.PI/180;if(Math.abs(n)>=Math.PI/2)throw new Error("Perspective tilt must be between -90 and 90 degrees");let o=O2(t,{h:r,tilt:n,azi:i});return ut("tpers",e,o,C2,P2,$i(t,1/(1+r/t.a)))}};function bC(e){e.R=e.a}function B2(e,t){var r=t.x,n=t.y,i=O(r-e.long0,e.over),o,s;if(Math.abs(n)<=1e-10)return o=e.x0+e.R*i,s=e.y0,t.x=o,t.y=s,t;var a=lr(2*Math.abs(n/Math.PI));if(Math.abs(i)<=1e-10||Math.abs(Math.abs(n)-R)<=1e-10)return o=e.x0,n>=0?s=e.y0+Math.PI*e.R*Math.tan(.5*a):s=e.y0+Math.PI*e.R*-Math.tan(.5*a),t.x=o,t.y=s,t;var c=.5*Math.abs(Math.PI/i-i/Math.PI),l=c*c,h=Math.sin(a),u=Math.cos(a),f=u/(h-2*Math.sin(a/2)**2),d=f*f,m=f*(2/h-1),p=m*m,g=Math.sqrt(l*(f-p)*(f-p)-(p+l)*(d-p)),y=Math.PI*e.R*(p-d)/(g-c*(f-p));i<0&&(y=-y),o=e.x0+y;var w=l+f;return y=Math.PI*e.R*(l*(2*f-1)+d)/(m*w+c*Math.sqrt((p+l)*(l+1)-w*w)),n>=0?s=e.y0+y:s=e.y0-y,t.x=o,t.y=s,t}function N2(e,t){var r,n,i,o,s,a,c,l,h,u,f,d,m;return t.x-=e.x0,t.y-=e.y0,Math.abs(t.y)<1e-10?(t.x=O(e.long0+t.x/e.R,e.over),t.y=0,t):(f=Math.PI*e.R,i=t.x/f,o=t.y/f,s=i*i+o*o,a=-Math.abs(o)*(1+s),c=a-2*o*o+i*i,l=-2*a+1+2*o*o+s*s,m=o*o/l+(2*c*c*c/l/l/l-9*a*c/l/l)/27,h=(a-c*c/3/l)/l,u=2*Math.sqrt(-h/3),f=3*m/h/u,Math.abs(f)>1&&(f>=0?f=1:f=-1),d=Math.acos(f)/3,t.y>=0?n=(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI:n=-(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI,Math.abs(i)<1e-10?r=e.long0:r=O(e.long0+2*Math.PI*i/(Math.sqrt(1+2*(i*i-o*o)+s*s)+1-s),e.over),t.x=r,t.y=n,t)}function L2(e,t={}){let r={...e,R:0,...t};return bC(r),r}var h0={name:"vandg",aliases:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten"],parameters:["lon_0","x_0","y_0"],create(e){let t=ht(e),r=L2(t);return ut("vandg",e,r,B2,N2)}};var F2=["o_proj","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"],u0=e=>e.toLowerCase().replace(/[ _-]/g,""),f0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_n=(e,t)=>nt(e,t,0)*Math.PI/180;function SC(e){let t=[["o_alpha","o_lon_c","o_lat_c"],["o_lat_p","o_lon_p"],["o_lon_1","o_lat_1","o_lon_2","o_lat_2"]],r=t.find(c=>c.some(l=>f0(e,l)));if(!r)throw new Error("Oblique transformation requires a rotation parameter set");for(let c of r){if(!f0(e,c))throw new Error("Oblique transformation requires "+c);if(c.includes("lat")&&Math.abs(_n(e,c))>Math.PI/2)throw new Error("Invalid rotation latitude: "+c)}if(r===t[0]){let c=_n(e,"o_alpha"),l=_n(e,"o_lon_c"),h=_n(e,"o_lat_c");if(Math.abs(h)>=Math.PI/2-1e-10)throw new Error("Rotation center must be away from the poles");return{lamp:l+Math.atan2(-Math.cos(c),-Math.sin(c)*Math.sin(h)),phip:Math.asin(Math.cos(h)*Math.sin(c))}}if(r===t[1])return{lamp:_n(e,"o_lon_p"),phip:_n(e,"o_lat_p")};let n=_n(e,"o_lon_1"),i=_n(e,"o_lat_1"),o=_n(e,"o_lon_2"),s=_n(e,"o_lat_2");if(Math.abs(i)>=Math.PI/2-1e-10||Math.abs(s)>=Math.PI/2-1e-10||Math.abs(i)<1e-10||Math.abs(i-s)<1e-10)throw new Error("Invalid new-equator reference points");let a=Math.atan2(Math.cos(i)*Math.sin(s)*Math.cos(n)-Math.sin(i)*Math.cos(s)*Math.cos(o),Math.sin(i)*Math.cos(s)*Math.sin(o)-Math.cos(i)*Math.sin(s)*Math.sin(n));return{lamp:a,phip:Math.atan(-Math.cos(a-n)/Math.tan(i))}}function Wu(e){let t=e==="longlat";if(!t&&["obtran","geocent"].includes(u0(e.name)))throw new Error("Cannot wrap a composite or geocentric projection");return{name:"ob_tran",aliases:["General Oblique Transformation","General_Oblique_Transformation"],parameters:[...F2,"lon_0",...t?[]:e.parameters],flags:t?[]:e.flags,create(r){let{parameters:n}=r,i=n.o_proj,o=t?["longlat","latlong","lonlat","latlon","identity"]:[e.name,...e.aliases||[]];if(i&&!o.map(u0).includes(u0(i)))throw new Mr("missing-plugin","Oblique transformation dependency does not match +o_proj="+i);let{lamp:s,phip:a}=SC(n),c=Math.cos(a),l=Math.sin(a),h=Math.abs(a)>1e-10,u=_n(n,"lon_0"),f=f0(n,"over"),d={...n,proj:t?"longlat":i||e.name,lon_0:"0"};for(let w of F2)delete d[w];let m=t?Kr(w=>{w.x*=180/Math.PI,w.y*=180/Math.PI},w=>{w.x*=Math.PI/180,w.y*=Math.PI/180}):e.create({...r,parameters:Object.freeze(d)}),p=ci(m,!1),g=ci(m,!0),y=w=>Math.asin(Math.max(-1,Math.min(1,w)));return Kr(w=>{let M=w.x,x=w.y,v=f?M-u:Xr(M-u),T=Math.cos(v),I=Math.sin(x),A=Math.cos(x),F=Xr(Math.atan2(A*Math.sin(v),h?l*A*T+c*I:I)+s),C=y(h?l*I-c*A*T:-A*T);w.x=F,w.y=C,p(w)},w=>{g(w);let M=w.x,x=w.y,v=M-s,T=Math.cos(v),I=Math.sin(x),A=Math.cos(x),F=Math.atan2(A*Math.sin(v),h?l*A*T-c*I:-I),C=y(h?l*I+c*A*T:A*T);w.x=Xr(F+u),w.y=C})}}}Ac();Um();function Ht(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected a CRS object");return e}function ol(e){return Array.isArray(e)?e:[]}function Re(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]/g,"")}function Er(e){if(typeof e!="number"||!Number.isFinite(e))throw new Error("Expected a finite CRS parameter");return e}function hr(e,t){if(e===void 0)return t;if(typeof e=="object"){let i=Er(Ht(e).conversion_factor);if(i<=0)throw new Error("Unit conversion factor must be positive");return i}let n={metre:1,meter:1,degree:Jt,radian:1,grad:Math.PI/200,gon:Math.PI/200,foot:.3048,ussurveyfoot:1200/3937,kilometre:1e3,arcsecond:Jt/3600,partspermillion:1e-6,unity:1}[Re(e)];return n||pt("Unsupported CRS unit: "+String(e)),n}var xC={hotineobliquemercator:"omerc",hotineobliquemercatorvarianta:"omerc",hotineobliquemercatorvariantb:"omerc",hotineobliquemercatorazimuthnaturalorigin:"omerc",hotineobliquemercatorazimuthcenter:"omerc",obliquemercator:"omerc",krovak:"krovak",krovaknorthorientated:"krovak",quadrilateralizedsphericalcube:"qsc",transversemercator:"tmerc",transversemercatorsouthorientated:"unsupported-south-tmerc",mercator:"merc",mercator1sp:"merc",mercator2sp:"merc",mercatorvarianta:"merc",mercatorvariantb:"merc",mercatorauxiliarysphere:"webmerc",popularvisualisationpseudomercator:"webmerc",lambertconformalconic:"lcc",lambertconformalconic1sp:"lcc",lambertconformalconic2sp:"lcc",lambertconicconformal1sp:"lcc",lambertconicconformal2sp:"lcc",albers:"aea",albersconicequalarea:"aea",albersequalarea:"aea",equidistantconic:"eqdc",lambertazimuthalequalarea:"laea",stereographic:"stere",stereographicnorthpole:"sterea",stereographicsouthpole:"stere",polarstereographic:"stere",polarstereographicvarianta:"stere",polarstereographicvariantb:"stere",obliquestereographic:"sterea",doublestereographic:"sterea",azimuthalequidistant:"aeqd",modifiedazimuthalequidistant:"aeqd",equidistantcylindrical:"eqc",equidistantcylindricalspherical:"eqc",equirectangular:"eqc",platecarree:"eqc",bonne:"bonne",cassinisoldner:"cass",cassini:"cass",cylindricalequalarea:"cea",lambertcylindricalequalarea:"cea",eckertvi:"eck6",equalearth:"eqearth",millercylindrical:"mill",mollweide:"moll",robinson:"robin",sinusoidal:"sinu",vandergrinten:"vandg",vandergrinteni:"vandg",gnomonic:"gnom",orthographic:"ortho",polyconic:"poly",americanpolyconic:"poly",newzealandmapgrid:"nzmg",gaussschreibertransversemercator:"gstmerc"},MC={centralmeridian:"lon_0",longitudeoforigin:"lon_0",longitudeofcenter:"lon_0",longitudeofnaturalorigin:"lon_0",longitudeoffalseorigin:"lon_0",longitudeofprojectioncentre:"lon_0",straightverticalpolelongitude:"lon_0",longitudeoforiginmeridian:"lon_0",latitudeoforigin:"lat_0",latitudeofcenter:"lat_0",latitudeofnaturalorigin:"lat_0",latitudeoffalseorigin:"lat_0",latitudeofprojectioncentre:"lat_0",standardparallel1:"lat_1",latitudeof1ststandardparallel:"lat_1",standardparallel2:"lat_2",latitudeof2ndstandardparallel:"lat_2",latitudeofstandardparallel:"lat_ts",scalefactor:"k_0",scalefactoratnaturalorigin:"k_0",scalefactoratprojectionorigin:"k_0",falseeasting:"x_0",falsenorthing:"y_0",eastingatfalseorigin:"x_0",northingatfalseorigin:"y_0"},vC={omerc:{longitudeofcenter:"lonc",longitudeofprojectioncentre:"lonc",azimuth:"alpha",azimuthatprojectioncentre:"alpha",rectifiedgridangle:"gamma",anglefromrectifiedtoskewgrid:"gamma",scalefactoratprojectioncentre:"k_0",eastingatprojectioncentre:"x_0",northingatprojectioncentre:"y_0"},krovak:{azimuth:"alpha",colatitudeofconeaxis:"alpha",pseudostandardparallel1:"lat_ts",latitudeofpseudostandardparallel:"lat_ts",scalefactoronpseudostandardparallel:"k_0"}},TC={east:"e",west:"w",north:"n",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"};function hs(e,t){let r=String(e.type);if(r==="CompoundCRS"){t.mode!=="horizontal"&&pt("CompoundCRS requires explicit horizontal extraction");let I=ol(e.components).map(Ht).filter(A=>["ProjectedCRS","GeographicCRS","GeodeticCRS","BoundCRS"].includes(String(A.type)));if(I.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");return{...hs(I[0],t),lossy:!0}}if(r==="BoundCRS"){let I=hs(Ht(e.source_crs),t),A=hs(Ht(e.target_crs),t);(A.parameters.datum!=="WGS84"||!["longlat","geocent"].includes(A.parameters.proj)||Number(A.parameters.pm||0)!==0||A.parameters.towgs84||Number(A.parameters.a)!==6378137||!(Math.abs(Number(A.parameters.rf)-298.257223563)<=1e-9||Math.abs(Number(A.parameters.b)-6356752314245179e-9)<=1e-6))&&pt("BoundCRS requires a WGS84 target");let F=Ht(e.transformation),C=Re(Ht(F.method).name),P=C==="geocentrictranslations"||/^geocentrictranslationsgeog[23]ddomain$/.test(C),D=/^positionvector(?:transformation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C),at=/^coordinateframe(?:rotation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C);!P&&!D&&!at&&pt("Unsupported BoundCRS transformation: "+C);let z=["xaxistranslation","yaxistranslation","zaxistranslation","xaxisrotation","yaxisrotation","zaxisrotation","scaledifference"],yt=new Array(P?3:7).fill(void 0);for(let wr of ol(F.parameters)){let jr=Ht(wr),ee=z.indexOf(Re(jr.name));(ee<0||ee>=yt.length||yt[ee]!==void 0)&&pt("Unsupported or duplicate Helmert parameter: "+String(jr.name));let ri=ee<3?1:ee<6?Jt/3600:1e-6;yt[ee]=Er(jr.value)*hr(jr.unit,ri)/ri*(at&&ee>=3&&ee<6?-1:1)}if(yt.some(wr=>wr===void 0))throw new Error("Incomplete BoundCRS Helmert transformation");let St={...I.parameters,towgs84:yt.join(",")};return delete St.datum,{...I,parameters:St}}["ProjectedCRS","GeographicCRS","GeodeticCRS"].includes(r)||pt("Unsupported CRS type: "+r);let n=r==="ProjectedCRS"?Ht(e.base_crs):e,i=Ht(n.datum||n.datum_ensemble);(i.type==="DynamicGeodeticReferenceFrame"||i.frame_reference_epoch!==void 0||e.coordinate_epoch!==void 0)&&pt("Time-dependent datum transformations are not implemented");let o=Ht(i.ellipsoid),s=Er(o.semi_major_axis??o.radius),a={proj:"longlat",a:String(s*hr(o.unit,1))};if(o.inverse_flattening!==void 0)a.rf=String(Er(o.inverse_flattening));else if(o.semi_minor_axis!==void 0)a.b=String(Er(o.semi_minor_axis)*hr(o.unit,1));else if(o.radius!==void 0)a.b=a.a;else throw new Error("Ellipsoid requires inverse flattening or semi-minor axis");let c=ba(t),l=String(i.name||""),h=Re(l),u=Object.keys(c),f=u.find(I=>os(I)===os(l)),d=f?[f]:u.filter(I=>Re(I)===h||Re(I)===h.replace(/^d/,"")),m=d[0],p=c[m];if(p&&d.some(I=>{let A=c[I];return A.ellipse!==p.ellipse||A.towgs84!==p.towgs84||A.nadgrids!==p.nadgrids}))throw new Error("Ambiguous structured datum name: "+l);if(h&&(a.datum=m||l),m&&os(m)==="wgs84"&&(a.datum="WGS84"),m&&["nad83","northamericandatum1983"].includes(os(m))&&(a.datum="NAD83"),!m){["wgs84","worldgeodeticsystem1984","worldgeodeticsystem1984ensemble","dwgs1984","wgs1984"].includes(h)&&(a.datum="WGS84"),["nad83","northamericandatum1983","dnorthamerican1983"].includes(h)&&(a.datum="NAD83"),["nad27","northamericandatum1927","dnorthamerican1927"].includes(h)&&(a.datum="NAD27");let A={newzealand1949:"nzgd49",belge1972:"rnb72"}[h.replace(/^d/,"")];A&&(a.datum=A)}if(r==="ProjectedCRS"&&n.id){let I=Ht(n.id),A=String(I.authority)+"_"+String(I.code);Object.prototype.hasOwnProperty.call(c,A)&&(a.datum=A)}i.towgs84!==void 0&&(a.towgs84=ol(i.towgs84).map(Er).join(","),delete a.datum);let g=e.coordinate_system?Ht(e.coordinate_system):{},y=ol(g.axis).map(Ht),w=Re(g.subtype)==="cartesian"&&r==="GeodeticCRS";r!=="ProjectedCRS"&&!w&&g.subtype&&Re(g.subtype)!=="ellipsoidal"&&pt("Unsupported coordinate system subtype"),w&&(a.proj="geocent");let M=hr(n.angular_unit,Jt),x=hr(y[0]?.unit,r==="ProjectedCRS"||w?1:M);y[1]&&hr(y[1].unit,x)!==x&&pt("Mixed horizontal axis units are not supported"),w&&y[2]&&hr(y[2].unit,x)!==x&&pt("Mixed geocentric axis units are not supported");let v=n.prime_meridian||i.prime_meridian;if(v){let I=Ht(v);a.pm=String(Er(I.longitude)*hr(I.unit,M)/Jt)}if(r==="ProjectedCRS"){let I=Ht(e.conversion),A=Re(Ht(I.method).name),F=ol(I.parameters).map(Ht),C=A==="stereographicnorthpole"&&!F.some(z=>Re(z.name).startsWith("scalefactor")),P=C?"stere":xC[A],D=F.filter(z=>["xscale","yscale","xyplanerotation"].includes(Re(z.name)));if(D.length){let z={xscale:-1,yscale:1,xyplanerotation:90};(P!=="krovak"||D.length!==3||new Set(D.map(yt=>Re(yt.name))).size!==3||D.some(yt=>{let St=Re(yt.name),wr=St==="xyplanerotation"?hr(yt.unit,M)/Jt:hr(yt.unit,1);return Math.abs(Er(yt.value)*wr-z[St])>1e-10}))&&pt("Unsupported ESRI Krovak axis adjustment")}(!P||P.startsWith("unsupported"))&&pt("Unsupported projection method: "+String(Ht(I.method).name)),a.proj=P==="webmerc"?"merc":P;let at=!1;for(let z of F){let yt=Re(z.name);if(D.includes(z)||yt==="auxiliaryspheretype"&&P==="webmerc"&&z.value===0)continue;if(yt==="semiminor"&&P==="webmerc"){if(at)throw new Error("Duplicate conversion parameter: semi_minor");at=!0;let ri=Er(z.value)*hr(z.unit,1);Math.abs(ri-Number(a.a))>4*Number.EPSILON*Number(a.a)&&pt("Pseudo-Mercator semi_minor must equal the semi-major axis");continue}let St=vC[P]?.[yt]||MC[yt];if(St||pt("Unsupported conversion parameter: "+String(z.name)),St==="lat_1"&&A==="stereographicnorthpole"&&!C?St="lat_0":St==="lat_1"&&["merc","webmerc","eqc","stere","cea"].includes(P)&&(St="lat_ts"),a[St]!==void 0)throw new Error("Duplicate conversion parameter: "+St);if(["merc","webmerc"].includes(P)&&St==="lat_0"&&z.value===0)continue;let wr=St.startsWith("lat")||St.startsWith("lon")||St==="alpha"||St==="gamma",jr=St==="x_0"||St==="y_0",ee=Er(z.value)*hr(z.unit,wr?M:jr?x:1)/(wr?Jt:1);St.startsWith("lat")&&Math.abs(Math.abs(ee)-90)<=4*Number.EPSILON*90&&(ee=Math.sign(ee)*90),a[St]=String(ee)}if(P==="omerc"&&["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(A)&&(a.no_uoff=void 0),P==="omerc"&&a.lon_0!==void 0&&a.lonc!==void 0&&(Math.abs(Number(a.lon_0)-Number(a.lonc))>1e-10&&pt("Oblique Mercator central meridian conflicts with projection centre"),delete a.lon_0),A==="stereographicnorthpole"&&Math.abs(Number(a.lat_0))===90&&(a.proj="stere"),P==="lcc"&&a.lat_1===void 0&&(a.lat_1=a.lat_0),A==="polarstereographic"&&a.lat_0!==void 0){if(a.lat_ts!==void 0)throw new Error("Duplicate polar stereographic latitude of true scale");a.lat_ts=a.lat_0,delete a.lat_0}P==="stere"&&(A.includes("polar")||A==="stereographicsouthpole"||C)&&a.lat_0===void 0&&(a.lat_0=Number(a.lat_ts||90)<0?"-90":"90"),P==="webmerc"&&(a.b=a.a,delete a.rf,a.nadgrids="@null")}let T=y.map(I=>EC(I,a,r==="ProjectedCRS")).join("");return T.length===2&&(T+="u"),!w&&/[ud]/.test(T.slice(0,2))&&pt("Structured CRS vertical-first axes require an explicit PROJ axis definition"),T&&(a.axis=T),(r==="ProjectedCRS"||w)&&(a.to_meter=String(x)),{parameters:a,angularUnit:r==="ProjectedCRS"||w?M:x,verticalUnit:w?1:hr(y[2]?.unit,1)}}function EC(e,t,r){let n=String(e.direction),i=e.meridian,o=/^(north|south) along ([+-]?(?:\d+(?:\.\d*)?|\.\d+)) deg(?: (east|west))?$/i.exec(n);if(o){if(i!==void 0)throw new Error("Duplicate axis meridian");n=o[1],i={longitude:Number(o[2])*(o[3]?.toLowerCase()==="west"?-1:1)}}if(i!==void 0){let a=Number(t.lat_0),c=a===90;(!r||t.proj!=="stere"||Math.abs(a)!==90||Re(n)!==(c?"south":"north"))&&pt("Axis meridians require an outward-facing polar stereographic axis");let l=Ht(i).longitude,h=typeof l=="number"?Er(l):Er(Ht(l).value)*hr(Ht(l).unit,Jt)/Jt,u=Er((h-Number(t.lon_0||0))/90);Math.abs(u-Math.round(u))>1e-12&&pt("Non-cardinal axis meridians require an orientation operation");let f=(Math.round(u)%4+4)%4;return(c?"senw":"nesw")[f]}let s=TC[Re(n)];return s||pt("Unsupported axis direction: "+n),s}function Hu(e,...t){return e.values.filter(r=>r.type==="node"&&t.includes(r.keyword.toUpperCase()))}function Gt(e,...t){return Hu(e,...t)[0]}function $t(e,t=0){let r=e.values[t];return r&&r.type!=="node"?r.value:void 0}function us(e){return e?{name:$t(e),conversion_factor:$t(e,1)}:void 0}function IC(e,t){let r=$t(e,1);if(t&&String(r).toLowerCase()==="unknown"){let n=String($t(e)).toLowerCase(),i=/^(easting|northing|westing|southing)(?:\s*\([a-z]\))?$/.exec(n);if(i)return{easting:"east",northing:"north",westing:"west",southing:"south"}[i[1]]}return r}function AC(e){let t=Gt(e,"MERIDIAN");if(t)return{longitude:{value:$t(t),unit:us(Gt(t,"ANGLEUNIT"))}}}function D2(e){let t=Gt(e,"METHOD","PROJECTION");if(!t)throw new Error("WKT conversion requires a METHOD or PROJECTION");return Gt(e,"PARAMETERFILE")&&pt("Grid-based WKT operation is not implemented"),{method:{name:$t(t)},parameters:Hu(e,"PARAMETER").map(r=>({name:$t(r),value:$t(r,1),unit:us(Gt(r,"ANGLEUNIT","LENGTHUNIT","SCALEUNIT"))}))}}function sl(e){let t=e.keyword.toUpperCase();if(t==="COMPD_CS"||t==="COMPOUNDCRS")return{type:"CompoundCRS",components:Hu(e,"PROJCS","PROJCRS","GEOGCS","GEOGCRS","GEODCRS","BOUNDCRS","VERT_CS","VERTCRS").map(sl)};if(t==="BOUNDCRS"){let h=Gt(e,"SOURCECRS"),u=Gt(e,"TARGETCRS"),f=Gt(e,"ABRIDGEDTRANSFORMATION");if(!h||!u||!f)throw new Error("Incomplete WKT BoundCRS");let d=g=>{let y=g.values.find(w=>w.type==="node");if(!y)throw new Error("Missing bound CRS component");return y},m=D2(f),p=m.parameters;for(let g of p)String(g.name).toLowerCase()==="scale difference"&&g.unit===void 0&&(g.value=(Number(g.value)-1)*1e6);return{type:"BoundCRS",source_crs:sl(d(h)),target_crs:sl(d(u)),transformation:m}}if(["VERT_CS","VERTCRS"].includes(t))return{type:"VerticalCRS"};let r=["PROJCS","PROJCRS","PROJECTEDCRS"].includes(t),n=["GEOGCS","GEOGCRS","GEODCRS","GEODETICCRS","GEOGRAPHICCRS","BASEGEOGCRS","BASEGEODCRS","GEOCCS"].includes(t);!r&&!n&&pt("Unsupported WKT CRS: "+t),Gt(e,"DYNAMIC","DERIVINGCONVERSION","VELOCITYGRID","EXTENSION")&&pt("Unsupported WKT dynamic/extension operation");let i=Gt(e,"CS"),o=t==="GEOCCS"||String($t(i||e)).toLowerCase()==="cartesian"&&!r,s=Gt(e,r||o?"LENGTHUNIT":"ANGLEUNIT","UNIT"),a=Hu(e,"AXIS").sort((h,u)=>Number($t(Gt(h,"ORDER")||h))-Number($t(Gt(u,"ORDER")||u))).map((h,u)=>({name:$t(h),direction:t==="GEOCCS"?["geocentricX","geocentricY","geocentricZ"][u]:IC(h,r),unit:us(Gt(h,"ANGLEUNIT","LENGTHUNIT")||(!o&&!r&&/^(up|down)$/i.test(String($t(h,1)))?void 0:s)),meridian:AC(h)}));if(!a.length)for(let h of o?["geocentricX","geocentricY","geocentricZ"]:["east","north"])a.push({name:h,direction:h,unit:us(s),meridian:void 0});let c=t==="GEOGCS"?void 0:Gt(e,"ID"),l={type:r?"ProjectedCRS":o?"GeodeticCRS":"GeographicCRS",name:$t(e),id:c?{authority:$t(c),code:$t(c,1)}:void 0,coordinate_system:{subtype:r||o?"Cartesian":"ellipsoidal",axis:a}};if(r){let h=Gt(e,"GEOGCS","BASEGEOGCRS","BASEGEODCRS","GEODCRS","GEOGCRS");if(!h)throw new Error("Projected WKT requires a base geographic CRS");l.base_crs=sl(h),l.conversion=D2(Gt(e,"CONVERSION")||e)}else{let h=Gt(e,"DATUM","GEODETICDATUM","ENSEMBLE");if(!h)throw new Error("WKT requires a geodetic datum");Gt(h,"EXTENSION","DYNAMIC")&&pt("Unsupported datum extension");let u=Gt(h,"SPHEROID","ELLIPSOID");if(!u)throw new Error("WKT datum requires an ellipsoid");let f=Gt(h,"TOWGS84");l.datum={name:$t(h),ellipsoid:{name:$t(u),semi_major_axis:$t(u,1),inverse_flattening:$t(u,2),unit:us(Gt(u,"LENGTHUNIT"))},towgs84:f?.values.map((m,p)=>$t(f,p))};let d=Gt(e,"PRIMEM");d&&(l.prime_meridian={name:$t(d),longitude:$t(d,1),unit:us(Gt(d,"ANGLEUNIT")||(o?void 0:s))}),l.angular_unit=o?void 0:us(s)}return l}var d0={name:"wkt",canParse:e=>rr(e)==="wkt",parse(e,t){if(typeof e!="string")throw new Error("Expected serialized WKT");return hs(sl(Cc(e).root),t)}};Ac();var m0={name:"projjson",canParse:e=>rr(e)==="projjson",parse:(e,t)=>hs(Ht(e),t)};var p0=1e-12;function $u(e,t,r,n,i=!1){let o=(t-e.origin[0])/e.step[0],s=(r-e.origin[1])/e.step[1],a=e.size[0],c=e.size[1];if(!i&&(o<-1e-10||s<-1e-10||o>a-1+1e-10||s>c-1+1e-10))return!1;o=Math.max(0,Math.min(a-1,o)),s=Math.max(0,Math.min(c-1,s));let l=Math.min(a-2,Math.floor(o)),h=Math.min(c-2,Math.floor(s)),u=o-l,f=s-h,d=0,m=0;for(let p=0;p<4;p++){let g=p%2,y=p>1,w=(g?u:1-u)*(y?f:1-f);if(w===0)continue;let M=((h+(y?1:0))*a+l+g)*2,x=e.shifts[M],v=e.shifts[M+1];if(!Number.isFinite(x)||!Number.isFinite(v))return!1;d+=w*x,m+=w*v}return n.x=d,n.y=m,!0}function RC(e,t,r,n,i){if(!n)return $u(e,t,r,i)?(i.x+=t,i.y+=r,!0):!1;for(let a=0;a<2;a++){let c=a===0?t:r;if(c<e.origin[a]-e.maxShift[a]-p0||c>e.origin[a]+(e.size[a]-1)*e.step[a]+e.maxShift[a]+p0)return!1}if(!$u(e,t,r,i,!0))return!1;let o=t-i.x,s=r-i.y;for(let a=0;a<20;a++){if(!$u(e,o,s,i,!0))return!1;let c=t-o-i.x,l=r-s-i.y;if(o+=c,s+=l,Math.max(Math.abs(c),Math.abs(l))<=p0)return $u(e,o,s,i)?(i.x=Xr(o),i.y=s,!0):!1}throw new Error("Inverse datum grid shift did not converge")}function U2(e){if(!e.length)throw new Error("Datum grid requires at least one subgrid");let t=e.map(i=>{let[o,s]=i.size;if(![o,s].every(c=>Number.isSafeInteger(c)&&c>=2)||o*s*2!==i.shifts.length||!i.origin.every(Number.isFinite)||!i.step.every(c=>Number.isFinite(c)&&c>0))throw new Error("Invalid datum subgrid geometry or node count");let a=[0,0];for(let c=0;c<i.shifts.length;c++){let l=i.shifts[c];Number.isFinite(l)&&(a[c%2]=Math.max(a[c%2],Math.abs(l)))}return{...i,maxShift:a}}),r=(i,o)=>{let s=i.x,a=i.y;if(!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Grid coordinates must be finite");for(let c of t)if(RC(c,-s,a,o,i))return i.x=-i.x,!0;return i.x=s,i.y=a,!1},n={x:NaN,y:NaN};return Object.freeze({subgridCount:t.length,shiftInPlace:r,shift(i,o,s){return n.x=i,n.y=o,r(n,s)?[n.x,n.y]:void 0}})}var Ia=Math.PI/648e3;function g0(e,t={}){let r=new DataView(e);if(r.byteLength<176)throw new Error("Truncated NTv2 overview header");let n=r.getInt32(8,!0)===11;if(!n&&r.getInt32(8,!1)!==11)throw new Error("Invalid NTv2 header or byte order");let i=u=>r.getInt32(u,n),o=u=>r.getFloat64(u,n),s=u=>String.fromCharCode(...new Uint8Array(e,u,8)).replace(/\0/g,"").trim();if(s(0)!=="NUM_OREC"||i(24)!==11||s(56)!=="SECONDS")throw new Error("Unsupported NTv2 header or shift units");let a=i(40),c=t.includeErrorFields===!1?8:16;if(a<1||a>Math.floor((r.byteLength-176)/(176+4*c)))throw new Error("Invalid NTv2 subgrid count");let l=176,h=[];for(let u=0;u<a;u++){if(l+176>r.byteLength)throw new Error("Truncated NTv2 subgrid header");let f=o(l+72),d=o(l+88),m=o(l+104),p=o(l+120),g=o(l+136),y=o(l+152),w=i(l+168),M=1+(p-m)/y,x=1+(d-f)/g;if(![M,x].every(A=>Number.isFinite(A)&&A>=2&&Math.abs(A-Math.round(A))<1e-7)||!(y>0&&g>0)||w!==Math.round(M)*Math.round(x))throw new Error("Invalid NTv2 subgrid dimensions");let v=l+176,T=v+w*c;if(T>r.byteLength)throw new Error("Truncated NTv2 node records");let I=new Float64Array(w*2);for(let A=0;A<w;A++)I[A*2]=r.getFloat32(v+A*c+4,n)*Ia,I[A*2+1]=r.getFloat32(v+A*c,n)*Ia;h.push({origin:[m*Ia,f*Ia],step:[y*Ia,g*Ia],size:[Math.round(M),Math.round(x)],shifts:I}),l=T}return U2(h)}var Yu={ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(let e in Yu){let t=Yu[e];t.datumName&&(Yu[t.datumName]=t)}var z2=Yu;var V2=Object.freeze({name:"regional-datums",datums:Object.freeze(z2)});function CC(e){return{...e,parse(t,r){let n=e.parse(t,r),i=n.parameters.datum,o=s=>s.toLowerCase().replace(/[\s_-]/g,"");if(i&&!Object.keys(ba(r)).some(s=>o(s)===o(i))){let s={...n.parameters};return delete s.datum,{...n,parameters:s}}return n}}}var PC=[d0,m0].map(CC),Ku;function OC(){if(Ku)return Ku;let e=[Sp,xp,Ep,Ip,Ap,Rp,Cp,Pp,Np,Fp,Dp,Up,zp,Vp,qp,jp,Wp,Hp,$p,Yp,Kp,Zp,Jp,Qp,t0,e0,r0,n0,i0,o0,s0,a0,c0,l0,h0],t=i=>i.toLowerCase().replace(/[\s_-]/g,""),r=Wu("longlat"),n={name:r.name,aliases:r.aliases,parameters:[...new Set([...r.parameters,...e.flatMap(i=>i.parameters)])],flags:[...new Set(e.flatMap(i=>i.flags||[]))],create(i){let o=i.parameters.o_proj;if(!o)throw new Error("Oblique transformation requires +o_proj");let s=["longlat","latlong","latlon","lonlat","identity"].includes(t(o))?"longlat":e.find(l=>[l.name,...l.aliases||[]].some(h=>t(h)===t(o)));if(!s)throw new Error("Unknown oblique transformation projection: "+o);let a=Wu(s),c=new Set([...Iu,...a.parameters]);for(let l of Object.keys(i.parameters))if(!c.has(l))throw new Error("Unsupported PROJ parameter: +"+l);return a.create(i)}};return Ku=[...e,n],Ku}var Ki=class extends Nu{constructor(t={}){super({...t,projections:t.projections??OC(),parsers:t.parsers??PC,datumCatalogs:t.datumCatalogs??[V2]})}},BC=new Ki;var G2=new Map,y0={},_0={},w0=new Ki;function k2(){return w0}function b0(e,t){M0(e,"CRS"),y0[e]=t,w0=new Ki({aliases:y0,datumGrids:_0})}function S0(e,t){M0(e,"datum grid"),_0[e]=g0(t),w0=new Ki({aliases:y0,datumGrids:_0})}function Xu(e,t){M0(e,"geoid model"),G2.set(e,t)}function x0(e,t,r={}){let n=fp(t,r);return Xu(e,n),n}function al(e){return G2.get(e)}function M0(e,t){if(!e.trim())throw new Error(`${t} name must not be empty`)}var Ir=class{spatialReference;horizontalProjection;horizontalProjectionBuffer;geographicProjection;heightOutputProjection;sourceIsGeocentric;outputIsGeocentric;sourceIsGeographic;outputIsGeographic;geoid;constructor(t,r={}){this.spatialReference=t;let n=k2();FC(t);let i=t.targetCrs||t.sourceCrs;if(this.sourceIsGeocentric=v0(t.sourceCrs),this.outputIsGeocentric=v0(i),this.sourceIsGeographic=q2(t.sourceCrs),this.outputIsGeographic=q2(i),t.sourceCrs&&t.targetCrs&&!this.sourceIsGeocentric&&!this.outputIsGeocentric&&(this.horizontalProjection=n.createProjection({from:cl(t.sourceCrs),to:cl(t.targetCrs),enforceAxis:!1}),Aa(t)||(this.horizontalProjectionBuffer=new vu({projection:this.horizontalProjection,dimension:3}))),(Aa(t)||this.sourceIsGeocentric||this.outputIsGeocentric)&&(!this.sourceIsGeographic&&!this.sourceIsGeocentric&&(this.geographicProjection=n.createProjection({from:cl(t.sourceCrs),to:ya,enforceAxis:!1})),!this.outputIsGeographic&&!this.outputIsGeocentric&&(this.heightOutputProjection=n.createProjection({from:ya,to:cl(i),enforceAxis:!1}))),Aa(t)&&(this.geoid=DC(r.geoidModel),!this.geoid)){let o=typeof r.geoidModel=="string"?` "${r.geoidModel}"`:"";throw new Error(`Height conversion requires a registered geoid model${o}; call registerGeoidModel() or pass a parsed Geoid instance`)}}transformPosition(t){if(t.length<2)throw new Error("A spatial coordinate must contain at least x and y components");let r=[...t];if(Aa(this.spatialReference)||this.sourceIsGeocentric||this.outputIsGeocentric){if(r.length<3||!Number.isFinite(r[2]))throw new Error("Three-dimensional CRS conversion requires a finite z coordinate");let n=this.toGeographic(r);if(Aa(this.spatialReference)){let o=this.geoid.getHeight(n[1],n[0]);n[2]=UC(n[2],o,this.spatialReference.heightReference,this.spatialReference.targetHeightReference)}let i=this.fromGeographic(n);return r.splice(0,i.length,...i),r}if(this.horizontalProjection){let n=this.horizontalProjection.projectSync(r.slice(0,3));r.splice(0,n.length,...n)}return r}transformPositions(t){if(t.length%3!==0)throw new Error("Packed spatial positions must contain a multiple of three components");let r=new Float64Array(t.length);if(this.horizontalProjectionBuffer&&(r.set(t),r.every(Number.isFinite)))return this.horizontalProjectionBuffer.projectFlatTo(r,r);for(let n=0;n<t.length;n+=3){let i=this.transformPosition([Number(t[n]),Number(t[n+1]),Number(t[n+2])]);r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2]}return r}transformNormals(t,r){if(t.length!==r.length||t.length%3!==0)throw new Error("Spatial normals and positions must have matching xyz component counts");let n=new Float32Array(t.length),i=1e-5;for(let o=0;o<t.length;o+=3){let s=[Number(r[o]),Number(r[o+1]),Number(r[o+2])],a=[Number(t[o]),Number(t[o+1]),Number(t[o+2])],c=NC(this,s,i),l=LC(c,a),h=Math.hypot(...l);h>0&&Number.isFinite(h)?(n[o]=l[0]/h,n[o+1]=l[1]/h,n[o+2]=l[2]/h):(n[o]=a[0],n[o+1]=a[1],n[o+2]=a[2])}return n}toGeographic(t){return this.sourceIsGeocentric?Array.from(rt.WGS84.cartesianToCartographic(new _(t))):this.sourceIsGeographic?t.slice(0,3):this.geographicProjection.projectSync(t.slice(0,3))}fromGeographic(t){return this.outputIsGeocentric?Array.from(rt.WGS84.cartographicToCartesian(new _(t))):this.outputIsGeographic?t.slice(0,3):this.heightOutputProjection.projectSync(t.slice(0,3))}};function NC(e,t,r){let n=[];for(let i=0;i<3;i++){let o=t.slice(),s=t.slice();o[i]+=r,s[i]-=r;let a=e.transformPosition(o),c=e.transformPosition(s);n.push([(a[0]-c[0])/(2*r),(a[1]-c[1])/(2*r),(a[2]-c[2])/(2*r)])}return n}function LC(e,t){let[r,n,i]=e,o=r[0]*(n[1]*i[2]-n[2]*i[1])-n[0]*(r[1]*i[2]-r[2]*i[1])+i[0]*(r[1]*n[2]-r[2]*n[1]);return!Number.isFinite(o)||Math.abs(o)<1e-15?t:[[n[1]*i[2]-n[2]*i[1],r[2]*i[1]-r[1]*i[2],r[1]*n[2]-r[2]*n[1]],[n[2]*i[0]-n[0]*i[2],r[0]*i[2]-r[2]*i[0],r[2]*n[0]-r[0]*n[2]],[n[0]*i[1]-n[1]*i[0],r[1]*i[0]-r[0]*i[1],r[0]*n[1]-r[1]*n[0]]].map(a=>(a[0]*t[0]+a[1]*t[1]+a[2]*t[2])/o)}function cl(e){if(!e)throw new Error("Cannot construct a projection because the CRS is unknown");if(typeof e!="string"&&e.type==="CompoundCRS"){let t=e.components.filter(r=>r.type!=="VerticalCRS");if(t.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");return cl(t[0])}return e}function FC(e){if(e.outputCoordinates==="local-enu")throw new Error("local-enu output requires a dataset-derived local origin and must be created by a tileset source");if(e.outputCoordinates==="target-crs"&&!e.targetCrs)throw new Error("target-crs output requires targetCrs");if(!e.sourceCrs&&e.status==="unresolved")throw new Error("Cannot transform coordinates because the source CRS is unknown");if(Aa(e)&&e.heightReference==="unknown")throw new Error("Cannot convert heights because the source height reference is unknown");if(e.coordinateFrame==="geocentric"&&!v0(e.sourceCrs))throw new Error("Only EPSG:4978 geocentric coordinates are supported by the current spatial transformer");if(e.status==="unresolved")throw new Error("The requested spatial output cannot be resolved from the available metadata")}function v0(e){return typeof e=="string"&&Fc(e)===pu}function q2(e){if(typeof e!="string")return!1;let t=Fc(e);return t===ya||t==="EPSG:4979"||t==="OGC:CRS84"}function Aa(e){let t=e.targetHeightReference;return t!=="native"&&t!==e.heightReference}function DC(e){return typeof e=="string"?al(e):e}function UC(e,t,r,n){if(r===n||n==="native")return e;if(r==="orthometric"&&n==="ellipsoidal")return e+t;if(r==="ellipsoidal"&&n==="orthometric")return e-t;throw new Error(`Unsupported height conversion from ${r} to ${n}`)}var ui=class{spatialReference;coordinateTransformer;geographicCoordinateTransformer;constructor(t,r={}){this.coordinateTransformer=new Ir(t,r);let n={...t,sourceCrs:"EPSG:4326",targetCrs:t.targetCrs||t.sourceCrs,coordinateFrame:"geographic",axisOrder:"xy"};this.geographicCoordinateTransformer=new Ir(n,r),this.spatialReference=t}transformPositions(t){return this.coordinateTransformer.transformPositions(t)}transformNormals(t,r){return this.coordinateTransformer.transformNormals(t,r)}transformBoundingVolume(t,r){let n=r?new ot(Array.from(r)):void 0,i=t.region?zC(t.region):VC(t).map(s=>n?Array.from(n.transformAsPoint(s)):s);if(!i.length)return t;let o=t.region?i.map(s=>this.transformRegionSample(s)):i.map(s=>this.coordinateTransformer.transformPosition(s));return{box:GC(o)}}transformRegionSample(t){return this.geographicCoordinateTransformer.transformPosition(t)}};function zC(e){if(e.length<6||e.some(u=>!Number.isFinite(u)))return[];let[t,r,n,i,o,s]=e,a=n<t?n+Math.PI*2:n,c=j2(t,a),l=j2(r,i),h=[];for(let u of c)for(let f of l)for(let d of[o,s])h.push([u*180/Math.PI,f*180/Math.PI,d]);return h}function j2(e,t){let r=[e,(e+t)/2,t],n=Math.PI/2,i=Math.ceil(e/n),o=Math.floor(t/n);for(let s=i;s<=o;s++)r.push(s*n);return r}function VC(e){if(e.box&&e.box.length>=12){let t=e.box.slice(0,3),r=[e.box.slice(3,6),e.box.slice(6,9),e.box.slice(9,12)],n=[];for(let i=0;i<=4;i++)for(let o=0;o<=4;o++)for(let s=0;s<=4;s++){let a=i/2-1,c=o/2-1,l=s/2-1;n.push([t[0]+a*r[0][0]+c*r[1][0]+l*r[2][0],t[1]+a*r[0][1]+c*r[1][1]+l*r[2][1],t[2]+a*r[0][2]+c*r[1][2]+l*r[2][2]])}return n}if(e.sphere&&e.sphere.length>=4){let[t,r,n,i]=e.sphere,o=[[t-i,r,n],[t+i,r,n],[t,r-i,n],[t,r+i,n],[t,r,n-i],[t,r,n+i]];for(let s=0;s<16;s++){let a=s*Math.PI*2/16;o.push([t+i*Math.cos(a),r+i*Math.sin(a),n])}return o}return[]}function GC(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=[Math.max((r[0]-t[0])*.01,1e-9),Math.max((r[1]-t[1])*.01,1e-9),Math.max((r[2]-t[2])*.01,1e-9)];return[...[(t[0]+r[0])/2,(t[1]+r[1])/2,(t[2]+r[2])/2],(r[0]-t[0])/2+n[0],0,0,0,(r[1]-t[1])/2+n[1],0,0,0,(r[2]-t[2])/2+n[2]]}function W2(e,t){let r=e.map(([c,l])=>[c,l]);if(r.length===0)return r;let n=1/0,i=-1/0;for(let[c]of e)n=Math.min(n,c),i=Math.max(i,c);if(i-n>=360)return r;let o=t??r[0][0];for(let c of r){let l=c[0]-o;l>180?c[0]-=360*Math.ceil((l-180)/360):l<-180&&(c[0]+=360*Math.ceil((-l-180)/360)),o=c[0]}let s=e[0],a=e[e.length-1];if(s[0]===a[0]&&s[1]===a[1]){if(Math.abs(r[r.length-1][0]-r[0][0])>180)return e.map(([c,l])=>[c,l]);r[r.length-1]=[...r[0]]}return r}function kC(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let[o,s]of e)t=Math.min(t,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s);return[[t,r],[n,i]]}function H2(e){let t=(r,n)=>{let i=e.cellToBoundary(r);return n?.unwrap?W2(i,n.referenceLongitude):i};return{...e,cellToBoundary:t,cellToBoundaryFlat:(r,n)=>n?.unwrap?t(r,n).flat():e.cellToBoundaryFlat(r),cellToBounds:(r,n)=>{let i=e.cellToBounds(r);if(!n?.unwrap||i[1][0]-i[0][0]>=360)return i;let o=kC(t(r,n));return o[0][1]=i[0][1],o[1][1]=i[1][1],o}}}var qC=(1n<<64n)-1n,jC=0x1555555555555555n;function Ra(e){if(e==="X")return 0n;if(!$2(e))throw new Error(`Invalid S2 token: ${e}`);let t=e.padEnd(16,"0");return BigInt(`0x${t}`)}function ll(e){if(e===0n)return"X";if(!Ca(e))throw new Error(`Invalid S2 index: ${e}`);let t=WC(e),r=t%4;t=(t-r)/4;let n=t;t*=4;let o=(e>>BigInt(t)).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function Ca(e){if(typeof e!="bigint"||e<=0n||e>qC)return!1;let t=e>>61n,r=e&-e;return t<6n&&(r&jC)!==0n}function $2(e){if(typeof e!="string"||!/^[0-9a-fA-F]{1,16}$/.test(e)||e.endsWith("0"))return!1;let t=e.padEnd(16,"0");return Ca(BigInt(`0x${t}`))}function WC(e){let t=0;for(;e%2n===0n;)e/=2n,t++;return t}function Pa(e){if(!Ca(e))throw new Error(`Invalid S2 index: ${e}`);let t=XC(e);return KC(t)}var HC=3,T0=30,$C=2*T0+1,Y2=180/Math.PI,YC={a:[[0,"d"],[1,"a"],[3,"b"],[2,"a"]],b:[[2,"b"],[1,"b"],[3,"a"],[0,"c"]],c:[[2,"c"],[3,"d"],[1,"c"],[0,"b"]],d:[[0,"a"],[3,"c"],[1,"d"],[2,"d"]]};function KC(e){if(!/^[0-5]\/[0-3]{0,30}$/.test(e))throw new Error(`Invalid S2 Hilbert quadkey: ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1]||"",i=n.length,o=0,s=[0,0];for(let a=i-1;a>=0;a--){o=i-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);ZC(u,s,l,h),s[0]+=u*l,s[1]+=u*h}if(r%2===1){let a=s[0];s[0]=s[1],s[1]=a}return{face:r,ij:s,level:o}}function XC(e){if(!Ca(e))throw new Error(`Invalid S2 index: ${e}`);let t=e.toString(2);for(;t.length<HC+$C;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),i=t.substring(3,r),o=i.length/2,s=BigInt(`0b${n}`).toString(10),a="";if(o!==0)for(a=BigInt(`0b${i}`).toString(4);a.length<o;)a="0"+a;return`${s}/${a}`}function X2(e){let{face:t,ij:r,level:n}=e;if(!Number.isInteger(t)||t<0||t>5)throw new Error(`Invalid S2 face: ${t}`);if(!Number.isInteger(n)||n<0||n>T0)throw new Error(`Invalid S2 level: ${n}`);let i=2**n;if(!Number.isInteger(r[0])||!Number.isInteger(r[1])||r[0]<0||r[1]<0||r[0]>=i||r[1]>=i)throw new Error(`Invalid S2 IJ coordinates: ${r[0]}, ${r[1]}`);let o=JC(r[0],r[1],n,t),s=BigInt(t)<<61n;for(let a=0;a<o.length;a++){let c=59-a*2;s|=BigInt(o[a])<<BigInt(c)}return s|=1n<<BigInt(60-n*2),s}function E0(e,t,r,n){let i=Pa(e);if(!Number.isInteger(t)||t<0||i.level+t>T0)throw new Error(`Invalid S2 relative level: ${t}`);let o=2**t;if(!Number.isInteger(r)||!Number.isInteger(n)||r<0||n<0||r>=o||n>=o)throw new Error(`Invalid S2 descendant coordinates: ${r}, ${n}`);return X2({face:i.face,ij:[i.ij[0]*o+r,i.ij[1]*o+n],level:i.level+t})}function hl(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function K2(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function ul(e){return[K2(e[0]),K2(e[1])]}function fl(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function dl([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Y2,n*Y2]}function ZC(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function JC(e,t,r,n){let i=n%2===1?"d":"a",o=[];for(let s=r-1;s>=0;s--){let a=1<<s,c=(e&a)!==0?1:0,l=(t&a)!==0?1:0,[h,u]=YC[i][c*2+l];o.push(h),i=u}return o}var QC=100;function Z2(e){let t=Pa(e);return t8(t)}function t8({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(QC*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),s=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),h=n[c+1],u=(h[0]-l[0])/i,f=(h[1]-l[1])/i;for(let d=0;d<i;d++){l[0]+=u,l[1]+=f;let m=hl(t,r,l),p=ul(m),g=fl(e,p),y=dl(g);Math.abs(y[1])>89.999&&(y[0]=a);let w=y[0]-a;y[0]+=w>180?-360:w<-180?360:0,o[s++]=y[0],o[s++]=y[1],a=y[0]}}return o[s++]=o[0],o[s++]=o[1],o}var e8=H2({name:"s2",hasNumericRepresentation:!0,cellColumnNames:["s2","s2Token","s2_token","s2Cell","s2_cell","s2CellId","s2_cell_id"],tokenToCell:e=>Ra(e),cellToToken:e=>ll(Ju(e)),cellToLngLat:e=>J2(e),cellToBoundary:e=>r8(e),cellToBoundaryFlat:e=>I0(e),cellToBounds:e=>Zu(e)});function J2(e){let t=Ju(e),r=Pa(t),n=hl(r.ij,r.level,[.5,.5]),i=ul(n),o=fl(r.face,i);return dl(o)}function I0(e){let t=Ju(e),r=Z2(t);return Array.from(r)}function r8(e){let t=I0(e),r=[];for(let n=0;n<t.length;n+=2)r.push([t[n],t[n+1]]);return r}function Zu(e){let t=Pa(Ju(e));if(t.level===0)return n8(t.face);let r=[[0,0],[0,1],[1,1],[1,0]],n=1/0,i=1/0,o=-1/0,s=-1/0,a;for(let l of r){let h=hl(t.ij,t.level,l),u=ul(h),[f,d,m]=fl(t.face,u),[p,g]=dl([f,d,m]);if(f===0&&d===0&&a!==void 0&&(p=a),a!==void 0){let y=p-a;p+=y>180?-360:y<-180?360:0}a=p,n=Math.min(n,p),i=Math.min(i,g),o=Math.max(o,p),s=Math.max(s,g)}let c=2*Number.EPSILON*180/Math.PI;return[[n-c,Math.max(-90,i-c)],[o+c,Math.min(90,s+c)]]}function Ju(e){return typeof e=="bigint"?e:Ra(e)}function n8(e){let t=Math.asin(Math.sqrt(.3333333333333333))*180/Math.PI;switch(e){case 0:return[[-45,-45],[45,45]];case 1:return[[45,-45],[135,45]];case 2:return[[-180,t],[180,90]];case 3:return[[135,-45],[225,45]];case 4:return[[-135,-45],[-45,45]];case 5:return[[-180,-90],[180,-t]];default:throw new Error(`Invalid S2 face: ${e}`)}}function ml(e){let[[t,r],[n,i]]=Zu(e.token),o=wc([t,r,n,i,e.minimumHeight,e.maximumHeight],rt.WGS84,{units:"degrees"});return[...o.center,...o.halfAxes]}var i8=4,o8=8,Q2=new WeakMap;function Qu(e,t){return{coordinates:t,subtreeUrl:Oa(e.subtreesUrlTemplate,t),descriptor:e,resource:aM(e.resourceFiles,Oa(e.subtreesUrlTemplate,t))}}function gl(e,t){let{descriptor:r}=t;d8(r),s8(e,r);let n={tileCount:0,childSubtreeCount:0},i=sM(e,t,{localLevel:0,mortonIndex:0},t.coordinates,n);if(!i)throw new Error(`Invalid 3D Tiles subtree: root tile is unavailable at ${t.subtreeUrl}`);return{root:i,...n}}function s8(e,t){let r=uM(t.subdivisionScheme),n=(r**t.subtreeLevels-1)/(r-1),i=r**t.subtreeLevels;A0(e.tileAvailability,n,"tile");let o=Array.isArray(e.contentAvailability)?e.contentAvailability:e.contentAvailability?[e.contentAvailability]:[];for(let c of o)A0(c,n,"content");A0(e.childSubtreeAvailability,i,"child subtree");let s=tM(e.tileAvailability,n),a=o[0]?tM(o[0],n):0;if(eM(e.tileAttributes,s,"tile"),eM(e.contentAttributes,a,"content"),e.tilePropertyRows&&e.tilePropertyRows.length!==s)throw new Error("3DTILES_subtree: tile property-table count does not match availability");if(e.contentPropertyRows&&e.contentPropertyRows.length!==a)throw new Error("3DTILES_subtree: content property-table count does not match availability")}function A0(e,t,r){if(!(e.constant===0||e.constant===1)&&(!e.explicitBitstream||e.explicitBitstream.byteLength*8<t))throw new Error(`3DTILES_subtree: ${r} availability bitstream is too short`)}function tM(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=0;for(let n=0;n<t;n++)Ba(e,n)&&r++;return r}function eM(e,t,r){let n={TILE_BOUNDING_BOX:16,TILE_BOUNDING_SPHERE:4,TILE_GEOMETRIC_ERROR:1,TILE_REFINE:1,TILE_TRANSFORM:16,CONTENT_BOUNDING_BOX:16,CONTENT_BOUNDING_SPHERE:4};for(let[i,o]of Object.entries(e||{})){let s=n[i];if(s&&o.length!==t*s)throw new Error(`3DTILES_subtree: ${r} attribute ${i} count does not match availability`)}}function Oa(e,t,r={}){let n={level:t.level,x:t.x,y:t.y,z:t.z,...r};return e.replace(/{([^{}]+)}/g,(i,o)=>{let s=Object.hasOwn(n,o)?n[o]:n[o.toLowerCase()];return s===void 0?i:String(s)})}function sM(e,t,r,n,i){let{descriptor:o}=t,s=uM(o.subdivisionScheme),a=h8(s,r.localLevel)+r.mortonIndex;if(!Ba(e.tileAvailability,a))return null;i.tileCount++;let c=l8(e.contentAvailability,a),l=[];if(n.level<o.maximumLevel)if(r.localLevel+1<o.subtreeLevels)for(let h=0;h<s;h++){let u=iM(n,h,o.subdivisionScheme),f=sM(e,t,{localLevel:r.localLevel+1,mortonIndex:r.mortonIndex*s+h},u,i);f&&l.push(f)}else for(let h=0;h<s;h++){let u=r.mortonIndex*s+h;if(Ba(e.childSubtreeAvailability,u)){let f=iM(n,h,o.subdivisionScheme);l.push(a8(e,o,f)),i.childSubtreeCount++}}return c8(e,o,t,n,a,c,l)}function a8(e,t,r){let n=cM(t.resourceFiles,e.resourceFiles),i=n?{...t,resourceFiles:n}:t,o=Qu(i,r);return{id:hM(o,r),children:[],implicitSubtree:o,boundingVolume:fM(t.rootBoundingVolume,r,t.subdivisionScheme),geometricError:t.rootLodMetricValue/2**r.level,lodMetricType:t.lodMetricType,lodMetricValue:t.rootLodMetricValue/2**r.level,refine:t.refine,type:dn.EMPTY,implicitMetadata:lM(e),_scaleGeometricError:t.scaleGeometricError!==!1}}function rM(e,t,r){if(!e||t<0)return{};let n=pl(e[r==="tile"?"TILE_BOUNDING_BOX":"CONTENT_BOUNDING_BOX"],t,16),i=pl(e[r==="tile"?"TILE_BOUNDING_SPHERE":"CONTENT_BOUNDING_SPHERE"],t,4),o=n?{box:[n[12],n[13],n[14],n[0]/2,n[1]/2,n[2]/2,n[4]/2,n[5]/2,n[6]/2,n[8]/2,n[9]/2,n[10]/2]}:i?{sphere:i}:void 0;if(r==="content")return{boundingVolume:o};let s=pl(e.TILE_GEOMETRIC_ERROR,t,1)?.[0];if(s!==void 0&&(!Number.isFinite(s)||s<0))throw new Error("3DTILES_subtree: TILE_GEOMETRIC_ERROR must be nonnegative");let a=pl(e.TILE_REFINE,t,1)?.[0];if(a!==void 0&&a!==0&&a!==1)throw new Error("3DTILES_subtree: TILE_REFINE must be 0 or 1");return{boundingVolume:o,geometricError:s,refine:a===void 0?void 0:a===0?Zt.ADD:Zt.REPLACE,transform:pl(e.TILE_TRANSFORM,t,16)}}function pl(e,t,r){if(!e)return;let n=t*r;if(n+r>e.length)throw new Error("3DTILES_subtree: attribute accessor is shorter than availability");return Array.from({length:r},(i,o)=>Number(e[n+o]))}function nM(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=Q2.get(e);if(!r){let n=(e.explicitBitstream?.byteLength||0)*8;r=new Uint32Array(n+1);for(let i=0;i<n;i++)r[i+1]=r[i]+Number(Ba(e,i));Q2.set(e,r)}return r[t]}function aM(e,t){if(!e?.length)return;let r=t.split("?")[0],n=/^gltf-package:\/\/[^/]+\/(.*)$/.exec(r)?.[1],i=e.findIndex(s=>{let a=s.originalUri||s.name;return s.uri===r||!!(a&&(r===a||n===a))});if(i>=0)return{fileIndex:i,files:e};let o=e.findIndex(s=>{let a=s.originalUri||s.name;return!!(a&&(r.endsWith(`/${a}`)||r.endsWith(`:${a}`)))});return o<0?void 0:{fileIndex:o,files:e}}function cM(e,t){if(!t?.length)return e;if(!e?.length)return t;let r=new Set(t.flatMap(n=>[n.uri,n.originalUri,n.name].filter(Boolean)));return[...t,...e.filter(n=>![n.uri,n.originalUri,n.name].some(i=>i&&r.has(i)))]}function c8(e,t,r,n,i,o,s){let a=nM(e.tileAvailability,i),c=e.tilePropertyRows?.[a],l=Array.isArray(e.contentAvailability)?e.contentAvailability[0]:e.contentAvailability,h=l&&Ba(l,i)?nM(l,i):-1,u=e.contentPropertyRows?.[h],f=e.tileTemplatePropertyRows?.[a]||c,d=e.contentTemplatePropertyRows?.[h]||u,m={...f,...d},p=rM(e.tileAttributes,a,"tile"),g=rM(e.contentAttributes,h,"content"),w=(t.contentUrlTemplates?.length?t.contentUrlTemplates:[t.contentUrlTemplate]).map((C,P)=>{if(!o[P]||!C)return null;let D=Oa(C,n,m);if(/{[^{}]+}/.test(D))throw new Error(`Implicit content URI has unresolved template values: ${D}`);return{contentIndex:P,contentUrl:D}}).filter(C=>!!C),M=w.map(C=>C.contentUrl),x=cM(t.resourceFiles,e.resourceFiles),v=w.map(({contentIndex:C,contentUrl:P})=>{let D=aM(x,P);return{...t.contentHeaders?.[C]||(C===0?t.contentHeader:{})||{},...g,uri:P,...u?{metadata:{properties:u}}:{},...D?{_resource:D}:{}}}),T=M[0],I=t.rootLodMetricValue/2**n.level,A=p.geometricError??I,F=fM(t.rootBoundingVolume,n,t.subdivisionScheme);return{id:hM(r,n),children:s,contentUrl:T,content:v.length>1?v:v[0],contents:t.useCanonicalContents&&v.length?v:void 0,contentUrls:M,refine:p.refine||t.refine,type:f8(T),lodMetricType:t.lodMetricType,lodMetricValue:A,geometricError:A,boundingVolume:p.boundingVolume||F,transform:p.transform,transformMatrix:p.transform,metadata:c?{properties:c}:void 0,implicitMetadata:lM(e,c,u),_scaleGeometricError:t.scaleGeometricError!==!1}}function lM(e,t,r){if(!(!e.propertyTables&&e.tileMetadata===void 0&&!e.contentMetadata&&e.subtreeMetadata===void 0&&!t&&!r))return{propertyTables:e.propertyTables,tileMetadata:e.tileMetadata,contentMetadata:e.contentMetadata,subtreeMetadata:e.subtreeMetadata,tileProperties:t,contentProperties:r}}function hM(e,t){return`${e.subtreeUrl}#implicit=${t.level}/${t.x}/${t.y}/${t.z}`}function Ba(e,t){if(typeof e?.constant=="number")return!!e.constant;let r=e?.explicitBitstream;if(!r)return!1;let n=Math.floor(t/8),i=t%8;return!!(r[n]>>i&1)}function l8(e,t){return(Array.isArray(e)?e:[e]).map(n=>Ba(n||{constant:0},t))}function h8(e,t){return(e**t-1)/(e-1)}function iM(e,t,r){return{level:e.level+1,x:e.x*2+(t&1),y:e.y*2+(t>>1&1),z:r==="OCTREE"?e.z*2+(t>>2&1):0}}function uM(e){return e==="OCTREE"?o8:i8}function fM(e,t,r){if(e.region){let[n,i,o,s,a,c]=e.region,l=2**t.level,u=(o>=n?o-n:o+2*Math.PI-n)/l,f=(s-i)/l,d=oM(n+u*t.x),m=oM(n+u*(t.x+1)),p=i+f*t.y,g=a,y=c;if(r==="OCTREE"){let w=(c-a)/l;g=a+w*t.z,y=g+w}return{region:[d,p,m,p+f,g,y]}}if(e.box){if(e.s2VolumeInfo)return u8(e,t,r);if(e.extensions?.["3DTILES_shape_cylinder_region"])return{...e,box:[...e.box]};let n=e.box,i=2**t.level,o=-1+(2*t.x+1)/i,s=-1+(2*t.y+1)/i,a=-1+(2*t.z+1)/i,c=r==="OCTREE";return{box:[...[n[0]+n[3]*o+n[6]*s+(c?n[9]*a:0),n[1]+n[4]*o+n[7]*s+(c?n[10]*a:0),n[2]+n[5]*o+n[8]*s+(c?n[11]*a:0)],n[3]/i,n[4]/i,n[5]/i,n[6]/i,n[7]/i,n[8]/i,c?n[9]/i:n[9],c?n[10]/i:n[10],c?n[11]/i:n[11]]}}throw new Error(`Unsupported implicit 3D Tiles bounding volume: ${JSON.stringify(e)}`)}function u8(e,t,r){let n=e.s2VolumeInfo,i=Ra(n.token),o=E0(i,t.level,t.x,t.y),s=2**t.level,a=(n.maximumHeight-n.minimumHeight)/s,c={token:ll(o),minimumHeight:n.minimumHeight+(r==="OCTREE"?a*t.z:0),maximumHeight:n.minimumHeight+(r==="OCTREE"?a*(t.z+1):a*s)},l=e.extensions?{...e.extensions}:void 0;return l?.["3DTILES_bounding_volume_S2"]&&(l["3DTILES_bounding_volume_S2"]=c),l?.["3DTILES_shape_s2"]&&(l["3DTILES_shape_s2"]=c),{...e,...l?{extensions:l}:{},s2VolumeInfo:c,box:ml(c)}}function oM(e){let t=e;for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function f8(e){if(!e)return dn.EMPTY;let t=e.split("?")[0].split(".").pop()?.toLowerCase();switch(t){case"pnts":return dn.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return dn.SCENEGRAPH;default:return t||dn.EMPTY}}function d8(e){if(e.subdivisionScheme!=="QUADTREE"&&e.subdivisionScheme!=="OCTREE")throw new Error(`Unsupported implicit subdivision scheme: ${e.subdivisionScheme}`);if(!Number.isInteger(e.subtreeLevels)||e.subtreeLevels<1)throw new Error("Implicit subtreeLevels must be a positive integer");if(!Number.isInteger(e.maximumLevel)||e.maximumLevel<0)throw new Error("Implicit availableLevels must describe at least the root level")}var m8={draco:!1,meshopt:!1,dds:!1,ktx2:!1},p8=32,yl=class{type=he.TILES3D;loader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...m8};asset;properties;extras;credits;metadata;queryParams={};tileUrlCache=new Map;tileContentHeaders=new WeakMap;nestedTilesetRoots=new WeakMap;packageNamespaces=new WeakMap;nextPackageNamespace=0;implicitSubtreeCache;implicitTilingStats={requestedSubtrees:0,loadedSubtrees:0,cacheHits:0,materializedTiles:0};destroyed=!1;extensionsUsed=[];resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=g8(t);this.rootTileset=mM(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.url=n.url,this.basePath=n.basePath||xr.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r;let i=Number(r["3d-tiles"]?.maximumCachedSubtrees),o=Number.isFinite(i)?Math.max(0,Math.floor(i)):p8;this.implicitSubtreeCache=new xc({maxEntries:o})}destroy(){this.destroyed=!0,this.tileUrlCache.clear(),this.implicitSubtreeCache.clear()}async initialize(){if(!this.rootTileset){let t=this.loadOptions[this.loader.id]||{};this.rootTileset=await this.loadRootData(this.url,{...this.loadOptions,[this.loader.id]:{...t,isTileset:!0}})}if(this.tileset=this.rootTileset,this.rootTileset.queryString){let t=new URLSearchParams(this.rootTileset.queryString);for(let[r,n]of t.entries())this.setQueryParameter(r,n)}if(this.asset=this.rootTileset.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.rootTileset.formatVersion!=="2.0-draft"&&this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version 0.0, 1.0, 1.1, or 2.0-draft.");"tilesetVersion"in this.asset&&this.setQueryParameter("v",this.asset.tilesetVersion),this.properties=this.rootTileset.properties,this.extras=this.rootTileset.extras,this.credits={attributions:[]},this.extensionsUsed.splice(0,this.extensionsUsed.length,...this.rootTileset.extensionsUsed||[]),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:jc(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("Tiles3DSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"3D Tiles spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new ui(r,t.options.spatial),t.spatialReference=ns(r),this.preparedRootHeader=this.transformTileHeader(this.getMetadata().tileset.root,new ot))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root,o=new or(t,i,n||void 0);n&&(n.children.push(o),o.depth=n.depth+1);let s=[o];for(;s.length>0;){let a=s.pop();t.stats.get("Tiles In Tileset(s)").incrementCount();let c=a.header.children||[];for(let l of c){let h=new or(t,l,a);if(h.contentUrl?.includes("?session=")){let f=new URL(h.contentUrl).searchParams.get("session");f&&this.setQueryParameter("session",f)}a.children.push(h),h.depth=a.depth+1,s.push(h)}}return o}createTraverser(t){return new xu(t)}async loadTileContent(t){let r=(t.contentUrls||[t.contentUrl]).filter(Boolean),n=this.tileContentHeaders.get(t),i=n||(Array.isArray(t.header?.content)?t.header.content:t.header?.content?[t.header.content]:[]);n||this.tileContentHeaders.set(t,i);let o=this.loadOptions[this.loader.id]||{},s={...this.loadOptions,[this.loader.id]:{...o,isTileset:"auto",assetGltfUpAxis:this.asset&&this.asset.gltfUpAxis||"Y",_tilesetOptions:{spatialReference:t.header?._spatialReference||t.tileset?.spatialReference,spatialOptions:t.tileset?.options.spatial,spatialTransform:t.header?._spatialTransform}}},a=await Promise.all(r.map((l,h)=>{let u=i[h]||{},f=u.extensions?.["3DTILES_content_gltf_vector"],d=u._vectorContent||(f?.vector===!0?{clip:f.clip===!0}:void 0),m=d?{...s,[this.loader.id]:{...s[this.loader.id],vectorContent:d}}:s;return this.loadContentResource(this.getTileUrl(l),u._resource,m)}));t.contents=a,t.content=a[0]||null;let c=a.filter(l=>l?.shape==="tileset3d");return{loaded:!0,contents:a,nestedTileset:c[0],nestedTilesets:c}}transformTileHeader(t,r=new ot){return this.spatialTransformer?this.transformTileHeaderWithTransformer(t,this.spatialTransformer,r):t}transformTileHeaderWithTransformer(t,r,n,i){let o=t.transform?new ot(t.transform):new ot,s=new ot(n).multiplyRight(o),a=Array.isArray(t.content)?t.content.map(c=>this.transformContentHeader(c,s,r)):t.content?this.transformContentHeader(t.content,s,r):t.content;return{...t,transform:void 0,boundingVolume:t.boundingVolume?r.transformBoundingVolume(t.boundingVolume,s):t.boundingVolume,_spatialReference:i,_spatialTransform:s.toArray(),content:a,children:Array.isArray(t.children)?t.children.map(c=>this.transformTileHeaderWithTransformer(c,r,s,i)):t.children}}transformContentHeader(t,r,n){return{...t,boundingVolume:t.boundingVolume?n.transformBoundingVolume(t.boundingVolume,r):t.boundingVolume}}async loadTileChildren(t,r){let n=t.header.implicitSubtree;if(!n)return{loaded:!1,tileCount:0,childSubtreeCount:0};let i=this.getTileUrl(n.subtreeUrl),o=await this.loadImplicitSubtreeResource(i,n.resource);if(this.destroyed||t.isDestroyed())return{loaded:!1,tileCount:0,childSubtreeCount:0};let s=gl(o,{...n,subtreeUrl:i}),a=t.header._spatialReference,c=a?new ui(a,t.tileset.options.spatial):this.spatialTransformer,l=c?this.transformTileHeaderWithTransformer(s.root,c,new ot,a):s.root;t.applyImplicitSubtreeHeader(l);let h=this.initializeMaterializedChildren(t.tileset,t,l.children);return this.implicitTilingStats.loadedSubtrees++,this.implicitTilingStats.materializedTiles+=h,{loaded:!0,tileCount:s.tileCount,childSubtreeCount:s.childSubtreeCount}}async loadTileChildrenForTraversal(t,r){dM(r);let n=await this.loadTileChildren(t,{});return dM(r),n}getImplicitTilingStats(){return{...this.implicitTilingStats,cachedSubtrees:this.implicitSubtreeCache.size-this.implicitSubtreeCache.pendingSize,pendingSubtrees:this.implicitSubtreeCache.pendingSize}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=this.tileUrlCache.get(t);if(r)return r;if(!Object.keys(this.queryParams).length)return this.tileUrlCache.set(t,t),t;let[n,i=""]=t.split("?"),o=new URLSearchParams(i);for(let[c,l]of Object.entries(this.queryParams))o.has(c)||o.set(c,l);let s=o.toString(),a=s?`${n}?${s}`:n;return this.tileUrlCache.set(t,a),a}setQueryParameter(t,r){this.queryParams[t]!==r&&(this.queryParams[t]=r,this.tileUrlCache.clear())}getViewState(t){if(!t)return{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits};let{center:r}=t.boundingVolume,n;return r&&(r[0]!==0||r[1]!==0||r[2]!==0)?(n=new _,rt.WGS84.cartesianToCartographic(r,n)):n=new _(0,0,-rt.WGS84.radii[0]),{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits,boundingVolume:t.boundingVolume,cartographicCenter:n,cartesianCenter:r,zoom:Gb(t.boundingVolume,n)}}hasExtension(t){return this.extensionsUsed.includes(t)}onTileLoaded(t,r,n){let o=(r.contents.length?r.contents:[r.content]).flatMap(c=>c?.gltf?.extensionsRemoved||[]);o.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),o.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),o.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0);let s=n.nestedTilesets||(n.nestedTileset?[n.nestedTileset]:[]),a=this.nestedTilesetRoots.get(r)||[];for(let[c,l]of s.entries()){let h=a[c];if(h&&r.children.includes(h))continue;let u=a.slice(c+1).find(d=>r.children.includes(d)),f=t._initializeTileHeaders(this.prepareNestedTileset(t,l),r);u&&(r.children.splice(r.children.indexOf(f),1),r.children.splice(r.children.indexOf(u),0,f)),a[c]=f,this.nestedTilesetRoots.set(r,a)}}prepareNestedTileset(t,r){let n=r.spatialMetadata,i=t.spatialReference;if(n?.status==="unresolved"||n?.crs.state==="unknown")throw new Error(n.warnings[0]||"Nested 3D Tiles CRS is explicitly unresolved and cannot be placed in the parent frame");if(!n||!n.sourceCrs)return this.spatialTransformer&&(i.status==="transformable"||i.status==="transformed")?{...r,spatialMetadata:i,root:this.transformTileHeaderWithTransformer(r.root,this.spatialTransformer,new ot,i)}:R0(r,i);let o=i.coordinateEpoch,s=n.coordinateEpoch;if(o!==void 0&&s!==void 0&&o!==s)throw new Error(`Nested 3D Tiles coordinate epoch ${s} differs from parent epoch ${o}; epoch-aware transformation is unavailable`);let a=i.targetCrs||i.sourceCrs;if(!a)return R0(r,n);let c=Gi(n,{...t.options.spatial,outputCoordinates:"target-crs",targetCrs:a});if(c.status==="unresolved")throw new Error(c.warnings[0]||"Nested 3D Tiles CRS cannot be resolved in the parent output frame");if(c.status==="native")return R0(r,c);let l=new ui(c,t.options.spatial);return{...r,spatialMetadata:c,root:this.transformTileHeaderWithTransformer(r.root,l,new ot,c)}}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async loadContentResource(t,r,n){if(!r)return await this.loadResourceData(t,n);let i=r.files[r.fileIndex];if(!i)throw new Error(`3D Tiles package references missing file ${r.fileIndex}`);if(i.uri)return await this.loadResourceData(this.getTileUrl(i.uri),n);if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to parse embedded package data");let o=await this.getPackageFileData(i),a=`gltf-package://${this.getPackageNamespace(r.files)}/${r.fileIndex}`,c=i.name||"content",l=c.lastIndexOf("/"),h=l>=0?`${a}/${c.slice(0,l)}`:a;return await this.coreApi.parse(o,this.loader,n,{url:`${a}/${c}`,filename:c,baseUrl:h,loaders:[this.loader],coreApi:this.coreApi,_parse:this.coreApi.parse,_tiles3dPackageFiles:r.files,fetch:async(u,f)=>{let d=u.startsWith(`${a}/`)?u.slice(a.length+1):u,m=r.files.find(g=>g.name===d||g.originalUri===d);if(!m)throw new Error(`3D Tiles glTF package does not contain file ${d}`);if(m.uri)return await this.coreApi.fetchFile(this.getTileUrl(m.uri),f);let p=await this.getPackageFileData(m);return new Response(p,{headers:{"content-type":m.mimeType}})}})}getPackageNamespace(t){let r=this.packageNamespaces.get(t);if(r!==void 0)return r;let n=this.nextPackageNamespace++;return this.packageNamespaces.set(t,n),n}async getPackageFileData(t){if(t.data)return Jh(t.data,t.byteOffset,t.byteLength);if(t.bufferUri&&this.coreApi){let r=await this.coreApi.fetchFile(this.getTileUrl(t.bufferUri));if(!r.ok)throw new Error(`Failed to fetch 3D Tiles package buffer: HTTP ${r.status}`);let n=await r.arrayBuffer();return Jh(n,t.byteOffset,t.byteLength)}throw new Error("3D Tiles package file has no available byte source")}async loadImplicitSubtreeResource(t,r){let n=this.implicitSubtreeCache.get(t);if(n)return this.implicitTilingStats.cacheHits++,await n;this.implicitTilingStats.requestedSubtrees++;let i=this.loadOptions[this.loader.id]||{};return await this.implicitSubtreeCache.getOrLoad(t,async()=>{let o={...this.loadOptions,[this.loader.id]:{...i,isTileset:!1,isSubtree:!0}};return await(r?this.loadContentResource(t,r,o):this.loadResourceData(t,o))})}initializeMaterializedChildren(t,r,n){let i=0,o=[{parentTile:r,childHeaders:n}];for(;o.length>0;){let s=o.pop();for(let a of s.childHeaders){let c=new or(t,a,s.parentTile);s.parentTile.children.push(c),c.depth=s.parentTile.depth+1,t.stats.get("Tiles In Tileset(s)").incrementCount(),i++,a.children?.length&&o.push({parentTile:c,childHeaders:a.children})}}return i}};function dM(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function mM(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function g8(e){return mM(e)?{...e,basePath:e.basePath||xr.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||xr.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}function R0(e,t){let r=n=>({...n,_spatialReference:t,children:Array.isArray(n.children)?n.children.map(r):n.children});return{...e,spatialMetadata:t,root:r(e.root)}}fn();var tf=class{frameNumberMap=new Map;register(t,r){let n=this.frameNumberMap.get(t)||new Map,i=n.get(r)||0;n.set(r,i+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let i=n.get(r)||1;n.set(r,i-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var C0={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},ef=class{_statusMap;pendingTilesRegister=new tf;constructor(){this._statusMap={}}add(t,r,n,i){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:s}}=i;this._statusMap[r]={request:t,callback:n,key:r,frameState:i,status:C0.REQUESTED},this.pendingTilesRegister.register(s,o),t().then(a=>{this._statusMap[r].status=C0.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,i)}).catch(a=>{this._statusMap[r].status=C0.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n);let{frameNumber:o,viewport:{id:s}}=r;this.pendingTilesRegister.register(s,o),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var rf=class extends mn{_tileManager;constructor(t){super(t),this._tileManager=new ef}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Vc(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],i=t.children;for(let o of n){let s=`${o.id}-${r.viewport.id}`,a=i&&i.find(c=>c.id===s||c.header?.id===o.id);if(a)a&&this.updateTile(a,r);else{let c=()=>this._loadTile(t,o.id,r);this._tileManager.find(s)?this._tileManager.update(s,r):this._tileManager.add(c,s,h=>this._onTileLoad(h,t,s),r)}}return!1}async _loadTile(t,r,n){if(!t.tileset.source.loadChildTileHeader)throw new Error("I3S source does not support child tile header loading");return await t.tileset.source.loadChildTileHeader(t,r,n)}_onTileLoad(t,r,n){if(t instanceof Error){r.tileset._onSourceError(t,r);return}let i=new or(r.tileset,t,r,n);r.children.push(i);let o=this._tileManager.find(i.id).frameState;this.updateTile(i,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(i,o)}};var ds=class{spatialReference;targetCoordinateFrame;positionTransformer;sourceToGeographicTransformer;geographicToTargetTransformer;sourceCoordinateFrame;sourceVerticalUnitScale;elevationMode;elevationOffset;elevationProvider;providerUnitScale;providerHeightTransformer;constructor(t,r={}){if(t.status!=="transformable"&&t.status!=="transformed")throw new Error("I3SSpatialTransformer requires a requested, transformable spatial output");let n=t.targetCrs||t.sourceCrs;if(!n)throw new Error("I3S spatial transformation requires a target CRS");if(this.positionTransformer=new Ir(t,r),this.sourceCoordinateFrame=t.coordinateFrame,this.sourceVerticalUnitScale=t.verticalUnitScale,this.elevationMode=t.elevationMode,this.elevationOffset=(t.elevationOffset||0)*t.elevationUnitScale,this.elevationProvider=y8(this.elevationMode,r),this.elevationProvider&&(typeof this.elevationProvider.sampleElevations!="function"||typeof this.elevationProvider.getElevationRange!="function"))throw new Error("An I3S elevation provider must implement sampleElevations() and getElevationRange()");let i=kc(this.elevationProvider?.unit||"meter");if(this.elevationProvider&&i===void 0)throw new Error(`Unsupported elevation-provider unit ${this.elevationProvider.unit}`);this.providerUnitScale=i||1,this.targetCoordinateFrame=nr(n),this.spatialReference=ns(t);let o=ir({sourceCrs:t.sourceCrs,heightReference:t.heightReference,coordinateFrame:t.coordinateFrame,axisOrder:t.axisOrder,provenance:t.provenance},{targetCrs:"EPSG:4326"});if(this.sourceToGeographicTransformer=new Ir(o),Na(this.elevationMode)){if(!this.elevationProvider){let c=this.elevationMode==="relativeToScene"?"scene":"terrain";throw new Error(`I3S elevation mode ${this.elevationMode} requires a ${c} elevation provider`)}if(t.heightReference==="unknown")throw new Error(`I3S elevation mode ${this.elevationMode} requires a known source height reference`);let a=this.elevationProvider.heightReference||t.heightReference;if(a!==t.heightReference){if(t.heightReference!=="ellipsoidal"&&t.heightReference!=="orthometric")throw new Error("Converting elevation-provider heights requires an ellipsoidal or orthometric source height reference");let c=ir({sourceCrs:"EPSG:4326",heightReference:a,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"caller-override"},{targetCrs:"EPSG:4326",targetHeightReference:t.heightReference,geoidModel:r.geoidModel});this.providerHeightTransformer=new Ir(c,r)}}let s=ir({sourceCrs:"EPSG:4326",heightReference:t.heightReference,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"format-default"},{targetCrs:n,targetHeightReference:t.targetHeightReference,geoidModel:r.geoidModel});this.geographicToTargetTransformer=new Ir(s,r)}transformPosition(t){let r=this.placeSourcePositionsSync(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformPositionAsync(t){let r=await this.placeSourcePositions(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPlacedPosition(t){let r=this.positionTransformer.transformPosition([t[0],t[1],t[2]]);return[r[0],r[1],r[2]]}transformSourcePositionToGeographic(t){let r=this.placeSourcePositionsSync(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformSourcePositionToGeographicAsync(t){let r=await this.placeSourcePositions(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPositions(t,r){let n=this.placeSourcePositionsSync(t),i=this.placeSourcePositionsSync(r);return this.transformPlacedPositions(n,i)}async transformPositionsAsync(t,r){let n=new Float64Array(t.length+3);n.set(Array.from(t),0),n.set(Array.from(r).slice(0,3),t.length);let i=await this.placeSourcePositions(n);return this.transformPlacedPositions(i.subarray(0,t.length),i.subarray(t.length))}async transformGeometryAsync(t,r,n="earth-centered"){if(t.length%3||r&&r.length!==t.length)throw new Error("Conversion positions and normals must contain matching finite xyz triples");for(let o=0;o<t.length;o++)if(!Number.isFinite(t[o])||r&&!Number.isFinite(r[o]))throw new Error("Conversion positions and normals must contain matching finite xyz triples");if(!["earth-centered","vertex-reference-frame"].includes(n))throw new Error("Unsupported I3S normal reference frame");let i=await this.placeSourcePositions(t);return{positions:this.positionTransformer.transformPositions(i),normals:r?this.transformNormals(r,i,n):void 0}}transformPlacedPositions(t,r){let n=this.transformPlacedPosition(r),i=new Float32Array(t.length),o=Float64Array.from(t);for(let c=0;c<t.length;c+=3){let l=this.transformPlacedPosition([t[c],t[c+1],t[c+2]]);i[c]=l[0]-n[0],i[c+1]=l[1]-n[1],i[c+2]=l[2]-n[2]}let s=this.targetCoordinateFrame==="geographic",a=s?new ot:new ot().translate(n);return{positions:i,sourcePositions:o,origin:n,cartographicOrigin:s?n:[0,0,0],coordinateSystem:s?"lnglat-offsets":"cartesian",modelMatrix:a}}transformNormals(t,r,n="earth-centered"){if(t.length!==r.length||t.length%3)throw new Error("I3S normals and positions must have matching xyz component counts");let i=new Float32Array(t.length);if(n==="earth-centered"&&(this.spatialReference.targetCrs||this.spatialReference.sourceCrs)==="EPSG:4978"){for(let o=0;o<t.length;o+=3){let s=Math.hypot(t[o],t[o+1],t[o+2]);for(let a=0;a<3;a++)i[o+a]=s?t[o+a]/s:t[o+a]}return i}for(let o=0;o<t.length;o+=3){let s=this.sourceToGeographicTransformer.transformPosition([r[o],r[o+1],r[o+2]]),a=new _([t[o],t[o+1],t[o+2]]).normalize(),c=n==="earth-centered"?a:wM(a,s),l=this.transformEcefNormal(c,s);i.set(l,o)}return i}transformBoundingVolume(t){let n=this.getGeographicBoundSamples(t).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:Xi(n)}:{box:fs(n)}}async transformBoundingVolumeAsync(t){let n=(await this.getGeographicBoundSamplesAsync(t)).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:Xi(n)}:{box:fs(n)}}transformBoundingVolumeToGeographic(t){return{region:Xi(this.getGeographicBoundSamples(t))}}async transformBoundingVolumeToGeographicAsync(t){return{region:Xi(await this.getGeographicBoundSamplesAsync(t))}}transformBoundingVolumeToGeocentric(t){let r=this.getGeographicBoundSamples(t).map(n=>Array.from(rt.WGS84.cartographicToCartesian(new _(n))));return{box:fs(r)}}async transformBoundingVolumeToGeocentricAsync(t){let r=(await this.getGeographicBoundSamplesAsync(t)).map(n=>Array.from(rt.WGS84.cartographicToCartesian(new _(n))));return{box:fs(r)}}transformBoundingSphereToGeographic(t){let r=t.mbs?.length?Array.from(t.mbs).slice(0,3):t.obb?Array.from(t.obb.center).slice(0,3):null;if(!r)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r),i=this.sourceToGeographicTransformer.transformPosition(Array.from(n)),o=t.mbs?.length?t.mbs[3]:Math.hypot(...Array.from(t.obb.halfSize).slice(0,3));return[i[0],i[1],i[2],o]}async transformBoundingSphereToGeographicAsync(t){return pM(await this.getGeographicBoundSamplesAsync(t))}async transformBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(o=>Array.from(rt.WGS84.cartographicToCartesian(new _(o)))),i=r.map(o=>this.geographicToTargetTransformer.transformPosition(o));return{boundingVolume:{box:fs(n)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:Xi(i)}:{box:fs(i)},i3sLodMbs:Na(this.elevationMode)?pM(r):this.transformBoundingSphereToGeographic(t)}}async transformPointCloudBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(i=>this.geographicToTargetTransformer.transformPosition(i));return{boundingVolume:{region:Xi(r)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:Xi(n)}:{box:fs(n)}}}getGeographicBoundSamples(t){let r=gM(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r.flat(),!0),i=P0(n);return this.sourceCoordinateFrame==="geographic"?i:i.map(o=>this.sourceToGeographicTransformer.transformPosition(o))}async getGeographicBoundSamplesAsync(t){let r=gM(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");if(Na(this.elevationMode)){let i=this.sourceCoordinateFrame==="geographic"?r:r.map(o=>this.sourceToGeographicTransformer.transformPosition(o));return await this.placeGeographicBoundSamples(i)}let n=P0(await this.placeSourcePositions(r.flat(),!0));return this.sourceCoordinateFrame==="geographic"?n:n.map(i=>this.sourceToGeographicTransformer.transformPosition(i))}async placeGeographicBoundSamples(t){let n=await this.elevationProvider.getElevationRange(_8(t)),i=n.minimum*this.providerUnitScale,o=n.maximum*this.providerUnitScale;if(!Number.isFinite(i)||!Number.isFinite(o)||i>o)throw new Error("Elevation provider returned an invalid range; minimum and maximum must be finite and ordered");let s=t.map(h=>h[2]),a=Math.min(...s),c=Math.max(...s),l=[];for(let[h,u]of t){let f=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,i])[2]:i,d=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,o])[2]:o,m=Math.min(f,d),p=Math.max(f,d),g=this.elevationMode==="onTheGround"?m:m+a+this.elevationOffset,y=this.elevationMode==="onTheGround"?p:p+c+this.elevationOffset;l.push([h,u,g],[h,u,y])}return l}placeSourcePositionsSync(t,r=!1){if(Na(this.elevationMode))throw new Error(`I3S elevation mode ${this.elevationMode} requires asynchronous surface placement`);let n=Float64Array.from(t),i=this.elevationMode==="absoluteHeight"?this.elevationOffset:0;for(let o=2;o<n.length;o+=3)n[o]=n[o]*(r?1:this.sourceVerticalUnitScale)+i;return n}async placeSourcePositions(t,r=!1){if(!Na(this.elevationMode))return this.placeSourcePositionsSync(t,r);let n=Float64Array.from(t),i=P0(n).map(s=>{let a=this.sourceToGeographicTransformer.transformPosition(s);return[a[0],a[1]]}),o=await this.elevationProvider.sampleElevations(i);if(o.length!==i.length)throw new Error(`Elevation provider returned ${o.length} heights for ${i.length} positions`);for(let s=0;s<i.length;s++){let a=o[s]*this.providerUnitScale;if(!Number.isFinite(a))throw new Error(`Elevation provider returned a non-finite height at index ${s}`);let[c,l]=i[s],h=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([c,l,a])[2]:a,u=n[s*3+2]*(r?1:this.sourceVerticalUnitScale);n[s*3+2]=this.elevationMode==="onTheGround"?h:h+u+this.elevationOffset}return n}transformEcefNormal(t,r){if(this.targetCoordinateFrame==="geocentric")return t.normalize();if(this.targetCoordinateFrame==="geographic")return b8(t,r).normalize();let n=rt.WGS84.cartographicToCartesian(new _(r)),i=[];for(let s of w8()){let a=rt.WGS84.cartesianToCartographic(new _(n).add(s)),c=rt.WGS84.cartesianToCartographic(new _(n).subtract(s)),l=this.geographicToTargetTransformer.transformPosition(a),h=this.geographicToTargetTransformer.transformPosition(c);i.push((l[0]-h[0])/2,(l[1]-h[1])/2,(l[2]-h[2])/2)}let o=new Nt(i);if(Math.abs(o.determinant())<1e-12)throw new Error("Cannot transform an I3S normal through a singular local projection");return o.invert().transpose(),new _(t).transformByMatrix3(o).normalize()}};function y8(e,t){return e==="relativeToScene"?t.sceneElevationProvider:Na(e)?t.terrainElevationProvider:void 0}function Na(e){return e==="onTheGround"||e==="relativeToGround"||e==="relativeToScene"}function P0(e){if(e.length%3!==0)throw new Error("I3S position arrays must contain complete XYZ tuples");let t=[];for(let r=0;r<e.length;r+=3)t.push([e[r],e[r+1],e[r+2]]);return t}function _8(e){let t=Xi(e);return{west:t[0]*180/Math.PI,south:t[1]*180/Math.PI,east:t[2]*180/Math.PI,north:t[3]*180/Math.PI}}function pM(e){if(!e.length)throw new Error("I3S spatial transformation requires at least one bound sample");let t=e.map(o=>rt.WGS84.cartographicToCartesian(new _(o))),r=new _;for(let o of t)r.add(o);r.scale(1/t.length);let n=0;for(let o of t)n=Math.max(n,new _(o).subtract(r).magnitude());let i=rt.WGS84.cartesianToCartographic(r);return[i[0],i[1],i[2],n]}function gM(e,t,r,n){let i=e.obb;if(i){let c=Array.from(i.center).slice(0,3);c[2]*=n;let l=Array.from(i.halfSize).slice(0,3),h=new $r().fromArray(Array.from(i.quaternion)),u=[new _([l[0],0,0]).transformByQuaternion(h),new _([0,l[1],0]).transformByQuaternion(h),new _([0,0,l[2]]).transformByQuaternion(h)];if(t==="geographic"){let f=r.transformPosition(c),d=rt.WGS84.cartographicToCartesian(new _(f)),m=e.normalReferenceFrame==="vertex-reference-frame"?u.map(p=>wM(p,f)):u;return yM().map(p=>{let g=new _(d);for(let y=0;y<3;y++)g.add(new _(m[y]).scale(p[y]));return Array.from(rt.WGS84.cartesianToCartographic(g))})}return yM().map(f=>{let d=new _(c);for(let m=0;m<3;m++)d.add(new _(u[m]).scale(f[m]));return Array.from(d)})}let o=e.mbs?Array.from(e.mbs):[];if(o.length<4)return[];let s=o.slice(0,3);s[2]*=n;let a=o[3];if(t==="geographic"){let c=r.transformPosition(s),l=rt.WGS84.cartographicToCartesian(new _(c));return _M().map(h=>Array.from(rt.WGS84.cartesianToCartographic(new _(l).add(new _(h).scale(a)))))}return _M().map(c=>Array.from(new _(s).add(new _(c).scale(a))))}function yM(){return[-1,1].flatMap(e=>[-1,1].flatMap(t=>[-1,1].map(r=>[e,t,r])))}function _M(){return[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]]}function w8(){return[new _([1,0,0]),new _([0,1,0]),new _([0,0,1])]}function wM(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new _([-Math.sin(r),Math.cos(r),0]),o=new _([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new _([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return i.scale(e[0]).add(o.scale(e[1])).add(s.scale(e[2]))}function b8(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new _([-Math.sin(r),Math.cos(r),0]),o=new _([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new _([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return new _([i.dot(e),o.dot(e),s.dot(e)])}function fs(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=t.map((o,s)=>(o+r[s])/2),i=t.map((o,s)=>(r[s]-o)/2);return[n[0],n[1],n[2],i[0],0,0,0,i[1],0,0,0,i[2]]}function Xi(e){let t=e[0][0],r=1/0,n=-1/0,i=1/0,o=-1/0,s=1/0,a=-1/0;for(let c of e){let l=t+O0(c[0]-t);r=Math.min(r,l),n=Math.max(n,l),i=Math.min(i,c[1]),o=Math.max(o,c[1]),s=Math.min(s,c[2]),a=Math.max(a,c[2])}return[O0(r)*Math.PI/180,i*Math.PI/180,O0(n)*Math.PI/180,o*Math.PI/180,s,a]}function O0(e){return((e+180)%360+360)%360-180}var S8={draco:!1,meshopt:!1,dds:!1,ktx2:!1},_l=class{type=he.I3S;loader;contentLoader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...S8};asset;properties;extras;credits;metadata;queryParams={};resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=M8(t);this.rootTileset=SM(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.contentLoader=x8(n.loader),this.url=n.url,this.basePath=n.basePath||xr.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r,this.initializeQueryParams(r)}async initialize(){this.rootTileset||(this.rootTileset=await this.loadRootData(this.getTileUrl(this.url),{...this.loadOptions,i3s:{...this.loadOptions.i3s,isTileset:!0}})),this.tileset=this.rootTileset,this.rootTileset.root&&typeof this.rootTileset.root.then=="function"&&(this.rootTileset.root=await this.rootTileset.root),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:qc(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("I3SSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"I3S spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new ds(r,t.options.spatial),t.spatialReference=this.spatialTransformer.spatialReference,this.preparedRootHeader=await this.transformTileHeader(this.getMetadata().tileset.root))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root;if(this.spatialTransformer&&!this.preparedRootHeader)throw new Error("I3S spatial root header was not prepared before tile initialization");let o=new or(t,i,n||void 0);return n&&(n.children.push(o),o.depth=n.depth+1),o}createTraverser(t){return new rf(t)}async loadTileContent(t){let r=this.getTileUrl(t.contentUrl),n=this.loader.id,i=this.loadOptions[n]||{},o=this.getMetadata(),s={...this.loadOptions,[n]:{...i,...t.tileset.options.i3s,_tileOptions:{attributeUrls:t.header.attributeUrls,textureUrl:t.header.textureUrl,textureUrls:t.header.textureUrls,textureFormat:t.header.textureFormat,textureLoaderOptions:t.header.textureLoaderOptions,materialDefinition:t.header.materialDefinition,layerType:t.header.layerType,pointRenderer:t.header.pointRenderer,pointSymbol:t.header.pointSymbol,isDracoGeometry:t.header.isDracoGeometry,mbs:t.header.mbs},_tilesetOptions:{store:o.tileset.store,attributeStorageInfo:o.tileset.attributeStorageInfo,fields:o.tileset.fields,spatialReference:t.tileset.spatialReference,spatialOptions:t.tileset.options.spatial},isTileHeader:!1}};t.content=await this.loadResourceData(r,s,this.contentLoader);let a={index:0,uri:t.contentUrl,type:t.header.layerType,payload:t.content,metadata:t.header.metadata||null,boundingVolume:t.boundingVolume,featureIds:t.featureIdSets,renderable:!!t.content};return{loaded:!0,contents:[t.content],contentEntries:[a]}}async loadChildTileHeader(t,r,n){let i=this.getMetadata();if(i.tileset.nodePages||i.tileset.pointNodePages){let l=await i.tileset.nodePagesTile.formTileFromNodePages(r);return await this.transformTileHeader(l)}let o=this.getTileUrl(`${this.url}/nodes/${r}`),s=this.loadOptions.i3s&&typeof this.loadOptions.i3s=="object"?this.loadOptions.i3s:{},a={...this.loadOptions,i3s:{...s,isTileHeader:!0}},c=await this.loadResourceData(o,a);return await this.transformTileHeader(c)}async loadTileChildrenForTraversal(t,r){let n=t.header.children||[],i=0,o=[];for(let a of n){bM(r);let c=a.id;if(typeof c!="string"&&typeof c!="number")throw new Error("I3S child header is missing its node ID");let l=t.children.find(f=>f.id===String(c)||f.header?.id===c);if(l){o.push(l);continue}let h=await this.loadChildTileHeader(t,String(c),null);bM(r);let u=new or(t.tileset,h,t,String(c));o.push(u),i++}let s=new Set(o);return t.children=[...o,...t.children.filter(a=>!s.has(a))],{loaded:!0,tileCount:i,childSubtreeCount:0}}getTileUrl(t){if(t.startsWith("data:")||!Object.keys(this.queryParams).length)return t;let r=t.indexOf("#"),n=r>=0?t.slice(r):"",i=r>=0?t.slice(0,r):t,o=i.indexOf("?"),s=o===-1?i:i.slice(0,o),a=o===-1?"":i.slice(o+1),c=new URLSearchParams(a),l=new URLSearchParams;for(let[u,f]of Object.entries(this.queryParams))c.has(u)||l.set(u,f);let h=l.toString();return`${s}${a?`?${a}`:""}${h?`${a?"&":"?"}${h}`:""}${n}`}getViewState(t){if(this.spatialTransformer&&t){let o=new _(t.boundingVolume.center),s=new _(t.header.i3sLodMbs.slice(0,3));return this.spatialTransformer.targetCoordinateFrame==="geographic"?{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}:{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}}let r=this.getMetadata(),n=r.tileset.fullExtent;if(n){let{xmin:o,xmax:s,ymin:a,ymax:c,zmin:l,zmax:h}=n,u=new _(o+(s-o)/2,a+(c-a)/2,l+(h-l)/2),f=new _;return rt.WGS84.cartographicToCartesian(u,f),{cartographicCenter:u,cartesianCenter:f,zoom:sp(n,u,f)}}let i=r.tileset.store?.extent;if(i){let[o,s,a,c]=i,l=new _(o+(a-o)/2,s+(c-s)/2,0),h=new _;return rt.WGS84.cartographicToCartesian(l,h),{cartographicCenter:l,cartesianCenter:h,zoom:kb(i,l,h)}}return console.warn("Extent is not defined in the tileset header"),{cartographicCenter:new _,zoom:1}}onTileLoaded(t,r){switch(r.header.isDracoGeometry&&(this.contentFormats.draco=!0),r.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}}getTilesTotalCount(){return this.getMetadata().tileset?.nodePagesTile?.nodesInNodePages||null}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("I3SSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}initializeQueryParams(t){for(let[n,i]of Object.entries(t.searchParams||{}))this.queryParams[n]=String(i);let r=t.i3s;if(r&&typeof r=="object"&&"token"in r){let n=r.token;typeof n=="string"&&(this.queryParams.token=n)}}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async transformTileHeader(t){if(!this.spatialTransformer)return t;let r={mbs:t.mbs,obb:t.obb,normalReferenceFrame:this.getMetadata().tileset.store?.normalReferenceFrame},n=await this.spatialTransformer.transformBoundsAsync(r);return{...t,boundingVolume:n.boundingVolume,spatialBoundingVolume:n.spatialBoundingVolume,i3sLodMbs:n.i3sLodMbs}}};function bM(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function x8(e){return e.contentLoader||e}function SM(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function M8(e){return SM(e)?{...e,basePath:e.basePath||xr.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||xr.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}var fi=class{index;parent;children;content;error;id;zoom;userData;boundingBox;_abortController;_loader;_loaderId;_isLoaded;_isCancelled;_needsReload;_bbox;constructor(t){this.index=t,this.parent=null,this.children=[],this.content=null,this.error=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){let t=this._loader;return!this._isCancelled&&t!==void 0?t.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get hasError(){return!!this.error}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)?t:0}async _loadData({getData:t,requestScheduler:r,onLoad:n,onError:i}){let o=(g,y,w)=>{if(w===this._loaderId){if(this._loader=void 0,this.content=g,this.error=y?v8(y):null,this._isCancelled&&!g){this._isLoaded=!1;return}if(this._isLoaded=!0,this._isCancelled=!1,y){i(y,this);return}n(this)}},{index:s,id:a,bbox:c,userData:l,zoom:h}=this,u=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,d=await r.scheduleRequest(this,()=>1);if(!d){this._isCancelled=!0;return}if(this._isCancelled){d.done();return}let m=null,p;try{m=await t({index:s,id:a,bbox:c,userData:l,zoom:h,signal:f})}catch(g){p=g||!0}finally{d.done()}o(m,p,u)}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this.error=null,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};function v8(e){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error("Tile request failed")}fn();Sc();var wl="never",bl="no-overlap",ps="best-available",xM={adapter:null,extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:100,maxCacheByteSize:null,refinementStrategy:ps,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},tileSource:null},ms=class e{stats;sourceMetadata=null;opts;_requestScheduler;_cache;_dirty;_tiles;_cacheByteSize;_unloadedTileCount;_listeners=new Set;_consumers=new Map;_explicitOptionKeys=new Set;_baseOpts={};_sourceMetadataOverrides={};_maxZoom;_minZoom;_lastTileContext=null;constructor(t){if(this.stats=new Yr({id:"Tileset2D",stats:[{name:"Tiles In Cache"},{name:"Cache Size"},{name:"Visible Tiles"},{name:"Selected Tiles"},{name:"Loading Tiles"},{name:"Unloaded Tiles"},{name:"Consumers"}]}),this.opts={...xM,...t,getTileData:t.getTileData||(()=>null),tileSource:t.tileSource},this._requestScheduler=new si({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._unloadedTileCount=0,!this.opts.tileSource&&!t.getTileData)throw new Error("Tileset2D requires either `getTileData` or `tileSource`.");this.setOptions(t),this._updateStats(),this.opts.tileSource&&this._initializeTileSource(this.opts.tileSource).catch(()=>{})}static fromTileSource(t,r={}){return new e({...r,tileSource:t})}get tiles(){return this._tiles}get cacheByteSize(){return this._cacheByteSize}get selectedTiles(){return Array.from(this._getSelectedTilesUnion())}get visibleTiles(){let t=this._getVisibleTilesUnion();for(let r of this._getSelectedTilesUnion())t.add(r);return Array.from(t)}get loadingTiles(){return Array.from(this._cache.values()).filter(t=>t.isLoading)}get unloadedTiles(){return Array.from(this._cache.values()).filter(t=>!t.isLoaded)}get maxZoom(){return this._maxZoom}get minZoom(){return this._minZoom}get refinementStrategy(){return this.opts.refinementStrategy||ps}get adapter(){return this.opts.adapter}subscribe(t){return this._listeners.add(t),()=>this._listeners.delete(t)}attachConsumer(t){this._consumers.set(t,{selectedTiles:new Set,visibleTiles:new Set}),this._updateStats()}detachConsumer(t){this._consumers.delete(t),this._pruneRequests(),this._resizeCache(),this._updateStats()}setOptions(t){this._rememberExplicitOptions(t),this._baseOpts={...this._baseOpts,...t};let r=this.opts.maxRequests,n=this.opts.debounceTime;this._applyResolvedOptions(),(r!==this.opts.maxRequests||n!==this.opts.debounceTime)&&(this._requestScheduler=new si({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._consumers.clear(),this._cacheByteSize=0,this._unloadedTileCount=0,this._updateStats()}reloadAll(){let t=this._getSelectedTilesUnion();for(let r of this._cache.keys()){let n=this._cache.get(r);n&&!t.has(n)?(this._cache.delete(r),this._handleTileUnload(n),this._dirty=!0):n&&n.setNeedsReload()}this._cacheByteSize=this._getCacheByteSize(),this.prepareTiles(),this._updateStats()}updateConsumer(t,r,n){this._consumers.set(t,{selectedTiles:new Set(r),visibleTiles:new Set(n)}),this._pruneRequests(),this._resizeCache(),this._updateStats()}prepareTiles(){this._dirty&&(this._rebuildTree(),this._syncTiles(),this._dirty=!1)}getTileIndices({viewState:t,maxZoom:r,minZoom:n,zRange:i,modelMatrix:o,modelMatrixInverse:s}){let{adapter:a,tileSize:c,extent:l,zoomOffset:h}=this.opts;if(!a)throw new Error("Tileset2D requires an adapter before tile traversal can be used.");return this._lastTileContext={viewState:t,tileSize:c},a.getTileIndices({viewState:t,maxZoom:r,minZoom:n,zRange:i,tileSize:c,extent:T8(l),modelMatrix:o,modelMatrixInverse:s,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){if(!this._lastTileContext)throw new Error("Tileset2D metadata requested before traversal context was set.");if(!this.opts.adapter)throw new Error("Tileset2D requires an adapter before tile metadata can be derived.");return{bbox:this.opts.adapter.getTileBoundingBox(this._lastTileContext,t)}}getParentIndex(t){return{x:Math.floor(t.x/2),y:Math.floor(t.y/2),z:t.z-1}}getTile(t,r){let n=this.getTileId(t),i=this._cache.get(n),o=!1;return!i&&r?(i=new fi(t),Object.assign(i,this.getTileMetadata(i.index)),Object.assign(i,{id:n,zoom:this.getTileZoom(i.index)}),o=!0,this._cache.set(n,i),this._dirty=!0,this._updateStats()):i&&i.needsReload&&(o=!0),i&&this._touchTile(n,i),i&&o&&r&&(i.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this._handleTileLoad.bind(this),onError:this._handleTileError.bind(this)}).catch(()=>{}),this._updateStats()),i}async _initializeTileSource(t){try{this.sourceMetadata=await t.getMetadata(),this._sourceMetadataOverrides=this._getMetadataOverrides(this.sourceMetadata),this._applyResolvedOptions(),this._notifyUpdate()}catch(r){let n=r instanceof Error?r:new Error(`TileSource metadata error: ${String(r)}`);this._notifyError(n)}}_rememberExplicitOptions(t){for(let r of Object.keys(t))this._explicitOptionKeys.add(r)}_applyResolvedOptions(){let t={...xM,...this._sourceMetadataOverrides,...this._baseOpts};if(t.tileSource){let r=t.tileSource;t.getTileData=n=>r.getTileData(n)}this.opts=t,this._maxZoom=typeof this.opts.maxZoom=="number"&&Number.isFinite(this.opts.maxZoom)?Math.floor(this.opts.maxZoom):void 0,this._minZoom=typeof this.opts.minZoom=="number"&&Number.isFinite(this.opts.minZoom)?Math.ceil(this.opts.minZoom):void 0}_getMetadataOverrides(t){if(!t)return{};let r={};return!this._explicitOptionKeys.has("minZoom")&&Number.isFinite(t.minZoom)&&(r.minZoom=t.minZoom),!this._explicitOptionKeys.has("maxZoom")&&Number.isFinite(t.maxZoom)&&(r.maxZoom=t.maxZoom),!this._explicitOptionKeys.has("extent")&&t.boundingBox&&(r.extent=[t.boundingBox[0][0],t.boundingBox[0][1],t.boundingBox[1][0],t.boundingBox[1][1]]),r}_handleTileLoad(t){this.opts.onTileLoad?.(t),this._cacheByteSize=this._getCacheByteSize(),this._resizeCache();for(let r of this._listeners)r.onTileLoad?.(t);this._updateStats()}_handleTileError(t,r){this.opts.onTileError?.(t,r);for(let n of this._listeners)n.onTileError?.(t,r);this._updateStats()}_handleTileUnload(t){this._unloadedTileCount++,this.opts.onTileUnload?.(t);for(let r of this._listeners)r.onTileUnload?.(t);this._updateStats()}_notifyUpdate(){for(let t of this._listeners)t.onUpdate?.()}_notifyError(t){for(let r of this._listeners)r.onError?.(t)}_updateStats(){this._setStatCount("Tiles In Cache",this._cache.size),this._setStatCount("Cache Size",this.cacheByteSize),this._setStatCount("Visible Tiles",this.visibleTiles.length),this._setStatCount("Selected Tiles",this.selectedTiles.length),this._setStatCount("Loading Tiles",this.loadingTiles.length),this._setStatCount("Unloaded Tiles",this._unloadedTileCount),this._setStatCount("Consumers",this._consumers.size);for(let t of this._listeners)t.onStatsChange?.(this.stats)}_setStatCount(t,r){this.stats.get(t).reset().addCount(r)}_getSelectedTilesUnion(){let t=new Set;for(let r of this._consumers.values())for(let n of r.selectedTiles)t.add(n);return t}_getVisibleTilesUnion(){let t=new Set;for(let r of this._consumers.values())for(let n of r.visibleTiles)t.add(n);return t}_touchTile(t,r){this._cache.delete(t),this._cache.set(t,r)}_getCacheByteSize(){let t=0;for(let r of this._cache.values())t+=r.byteLength;return t}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=this._getSelectedTilesUnion(),n=this._getVisibleTilesUnion(),i=[],o=0;for(let s of this._cache.values())s.isLoading&&(o++,!r.has(s)&&!n.has(s)&&i.push(s));for(;t>0&&o>t&&i.length>0;){let s=i.shift();s&&s.abort(),o--}}_rebuildTree(){for(let t of this._cache.values())t.parent=null,t.children&&(t.children.length=0);for(let t of this._cache.values()){let r=this._getNearestAncestor(t);t.parent=r,r?.children&&r.children.push(t)}}_syncTiles(){this._tiles=Array.from(this._cache.values()).sort((t,r)=>t.zoom-r.zoom)}_resizeCache(){let t=this.opts.maxCacheSize??100,r=this.opts.maxCacheByteSize??1/0,n=this._getVisibleTilesUnion(),i=this._getSelectedTilesUnion();if(this._cache.size>t||this._cacheByteSize>r){for(let[s,a]of this._cache)if(!n.has(a)&&!i.has(a)&&(this._cache.delete(s),this._cacheByteSize=this._getCacheByteSize(),this._handleTileUnload(a)),this._cache.size<=t&&this._cacheByteSize<=r)break;this._dirty=!0}this._dirty&&(this._rebuildTree(),this._syncTiles(),this._dirty=!1)}_getNearestAncestor(t){let{_minZoom:r=0}=this,n=t.index;for(;this.getTileZoom(n)>r;){n=this.getParentIndex(n);let i=this.getTile(n);if(i)return i}return null}};function T8(e){return e&&e.length===4?e:void 0}var nf={getMetadata:async()=>({name:"",keywords:[],layers:[]}),getImage:async()=>null,debounceTime:0},Sl=class e{metadata=null;_opts;_listeners=new Set;_currentRequest=null;_lastAcceptedRequestId=-1;_nextRequestId=0;_loadCounter=0;_timeoutId=null;_abortController=null;_finalized=!1;constructor(t){if(this._opts=this._normalizeOptions(t),!this._opts.imageSource&&(!t.getImage||!t.getMetadata))throw new Error("ImageSet requires either `imageSource` or both `getImage` and `getMetadata`.")}static fromImageSource(t,r={}){return new e({...r,imageSource:t})}get isLoaded(){return this._loadCounter===0&&!!this._currentRequest}get image(){return this._currentRequest?.image||null}get currentRequest(){return this._currentRequest}get imageSource(){return this._opts.imageSource}subscribe(t){return this._listeners.add(t),()=>this._listeners.delete(t)}setOptions(t){let r=this._opts.imageSource,n=this._normalizeOptions({...this._opts,...t}),i=r!==n.imageSource||this._opts.getImage!==n.getImage||this._opts.getMetadata!==n.getMetadata;this._opts=n,i&&(this._cancelScheduledImage(),this.metadata=null,this._currentRequest=null,this._lastAcceptedRequestId=-1,this._nextRequestId=0,this._emitUpdate())}async loadMetadata(){this._startLoading();try{let t=await this._opts.getMetadata();if(this._finalized)return t;this.metadata=t;for(let r of this._listeners)r.onMetadataLoad?.(t);return this._emitUpdate(),t}catch(t){let r=MM(t,"Image metadata request failed");if(!this._finalized)for(let n of this._listeners)n.onMetadataLoadError?.(r);throw r}finally{this._finishLoading()}}requestImage(t,r=this._opts.debounceTime){let n=this._nextRequestId++;return this._cancelScheduledImage(),this._abortActiveRequest(),r>0?this._timeoutId=setTimeout(()=>{this._timeoutId=null,this._loadImage(n,t)},r):this._loadImage(n,t),n}finalize(){this._finalized=!0,this._cancelScheduledImage(),this._abortActiveRequest(),this._listeners.clear()}async _loadImage(t,r){if(!this._finalized){this._startLoading();for(let n of this._listeners)n.onImageLoadStart?.(t,r);try{let n=new AbortController;this._abortController=n;let i=await this._opts.getImage({...r,signal:n.signal});if(this._finalized||t<=this._lastAcceptedRequestId)return;this._lastAcceptedRequestId=t,this._currentRequest={requestId:t,parameters:r,image:i};for(let o of this._listeners)o.onImageLoad?.(this._currentRequest);this._emitUpdate()}catch(n){if(E8(n))return;let i=MM(n,"Image request failed");if(!this._finalized)for(let o of this._listeners)o.onImageLoadError?.(t,i,r)}finally{this._abortController?.signal===r.signal&&(this._abortController=null),this._finishLoading()}}}_normalizeOptions(t){let r=t.imageSource||null;return{...nf,...t,imageSource:r,getMetadata:t.getMetadata||(()=>r?r.getMetadata():nf.getMetadata()),getImage:t.getImage||(n=>r?r.getImage(n):nf.getImage(n)),debounceTime:t.debounceTime??nf.debounceTime}}_emitUpdate(){for(let t of this._listeners)t.onUpdate?.()}_startLoading(){let t=this._loadCounter>0;this._loadCounter++,t||(this._emitLoadingStateChange(!0),this._emitUpdate())}_finishLoading(){let t=this._loadCounter>0;this._loadCounter=Math.max(0,this._loadCounter-1),t&&this._loadCounter===0&&(this._emitLoadingStateChange(!1),this._emitUpdate())}_emitLoadingStateChange(t){for(let r of this._listeners)r.onLoadingStateChange?.(t)}_cancelScheduledImage(){this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null)}_abortActiveRequest(){this._abortController?.abort(),this._abortController=null}};function E8(e){return e instanceof Error&&e.name==="AbortError"}function MM(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}fn();var xl={getMetadata:async()=>({width:0,height:0,bandCount:0,dtype:"uint8"}),getRaster:async()=>({data:new Uint8Array(0),width:0,height:0,bandCount:0,dtype:"uint8"}),debounceTime:0,shouldRefetch:()=>!0},Ml=class e{metadata=null;_opts;_listeners=new Set;_currentRequest=null;_nextRequestId=0;_loadCounter=0;_timeoutId=null;_abortController=null;_metadataAbortController=null;_finalized=!1;_sourceGeneration=0;_metadataRequestId=0;constructor(t){if(this._opts=this._normalizeOptions(t),!this._opts.rasterSource&&(!t.getRaster||!t.getMetadata))throw new Error("RasterSet requires either `rasterSource` or both `getRaster` and `getMetadata`.")}static fromRasterSource(t,r={}){return new e({...r,rasterSource:t})}static fromCallbacks(t){return new e(t)}get isLoaded(){return this._loadCounter===0&&!!this._currentRequest}get raster(){return this._currentRequest?.raster||null}get currentRequest(){return this._currentRequest}get rasterSource(){return this._opts.rasterSource}subscribe(t){return this._listeners.add(t),()=>this._listeners.delete(t)}setOptions(t){let r=this._opts.rasterSource,n={...this._opts,...t};t.rasterSource&&t.rasterSource!==r&&(n.getRaster=t.getRaster,n.getMetadata=t.getMetadata);let i=this._normalizeOptions(n),o=r!==i.rasterSource||this._opts.getRaster!==i.getRaster||this._opts.getMetadata!==i.getMetadata;this._opts=i,o&&(this._cancelScheduledRaster(),this._abortActiveRequest(),this._metadataAbortController?.abort(),this._sourceGeneration++,this.metadata=null,this._currentRequest=null,this._emitUpdate())}async loadMetadata(t={}){if(this._finalized)throw new Error("RasterSet is finalized");t.signal?.throwIfAborted(),this._metadataAbortController?.abort();let r=new AbortController;this._metadataAbortController=r;let n=()=>r.abort(t.signal?.reason);t.signal?.addEventListener("abort",n,{once:!0});let i=++this._metadataRequestId,o=this._sourceGeneration;try{this._startLoading(),r.signal.throwIfAborted();let s=await ru(a=>this._opts.getMetadata({signal:a}),[r.signal]);if(r.signal.throwIfAborted(),this._finalized||o!==this._sourceGeneration||i!==this._metadataRequestId)return s;this.metadata=s;for(let a of this._listeners)a.onMetadataLoad?.(s);return this._emitUpdate(),s}catch(s){if(r.signal.aborted)throw r.signal.reason;if(TM(s))throw s;let a=vM(s,"Raster metadata request failed");if(!this._finalized&&o===this._sourceGeneration&&i===this._metadataRequestId)for(let c of this._listeners)c.onMetadataLoadError?.(a);throw a}finally{t.signal?.removeEventListener("abort",n),this._metadataAbortController===r&&(this._metadataAbortController=null),this._finishLoading()}}requestRaster(t,r=this._opts.debounceTime){if(this._finalized)return-1;if(!this.shouldRefetchRaster(t))return this._cancelScheduledRaster(),this._abortActiveRequest(),this._nextRequestId++,this._currentRequest?.requestId??-1;let n=this._nextRequestId++;return this._cancelScheduledRaster(),this._abortActiveRequest(),r>0?this._timeoutId=setTimeout(()=>{this._timeoutId=null,this._loadRaster(n,t)},r):this._loadRaster(n,t),n}shouldRefetchRaster(t){return this._opts.shouldRefetch({currentRequest:this._currentRequest,metadata:this.metadata,nextParameters:t})}finalize(){this._finalized=!0,this._cancelScheduledRaster(),this._abortActiveRequest(),this._metadataAbortController?.abort(),this._metadataAbortController=null,this._loadCounter=0,this._listeners.clear()}async _loadRaster(t,r){if(this._finalized)return;let n=r.signal;if(n?.aborted)return;let i=new AbortController;this._abortController=i;let o=()=>i.abort(n?.reason);n?.addEventListener("abort",o,{once:!0}),this._startLoading();try{i.signal.throwIfAborted();for(let a of this._listeners)a.onRasterLoadStart?.(t,r);i.signal.throwIfAborted();let s=await ru(a=>this._opts.getRaster(I8(r,a)),[i.signal]);if(this._finalized||i.signal.aborted||t!==this._nextRequestId-1)return;this._currentRequest={requestId:t,parameters:r,raster:s};for(let a of this._listeners)a.onRasterLoad?.(this._currentRequest);this._emitUpdate()}catch(s){if(i.signal.aborted||TM(s))return;let a=vM(s,"Raster request failed");if(!this._finalized&&t===this._nextRequestId-1)for(let c of this._listeners)c.onRasterLoadError?.(t,a,r)}finally{n?.removeEventListener("abort",o),this._abortController===i&&(this._abortController=null),this._finishLoading()}}_normalizeOptions(t){let r=t.rasterSource||null;return{...xl,...t,rasterSource:r,getMetadata:t.getMetadata||(n=>r?r.getMetadata(n):xl.getMetadata()),getRaster:t.getRaster||(n=>r?r.getRaster(n):xl.getRaster(n)),debounceTime:t.debounceTime??xl.debounceTime,shouldRefetch:t.shouldRefetch||(n=>xl.shouldRefetch(n))}}_emitUpdate(){if(!this._finalized)for(let t of this._listeners)t.onUpdate?.()}_emitLoadingStateChange(t){if(!this._finalized)for(let r of this._listeners)r.onLoadingStateChange?.(t)}_startLoading(){let t=this._loadCounter>0;this._loadCounter++,t||(this._emitLoadingStateChange(!0),this._emitUpdate())}_finishLoading(){let t=this._loadCounter>0;this._loadCounter=Math.max(0,this._loadCounter-1),t&&this._loadCounter===0&&(this._emitLoadingStateChange(!1),this._emitUpdate())}_cancelScheduledRaster(){this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null)}_abortActiveRequest(){this._abortController?.abort(),this._abortController=null}};function I8(e,t){let r=Object.getOwnPropertyDescriptors(e);delete r.signal;let n=Array.isArray(e)?Object.defineProperties(e.slice(),r):Object.create(Object.getPrototypeOf(e),r);return Object.defineProperty(n,"signal",{configurable:!0,enumerable:!0,value:t,writable:!0}),n}function vM(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}function TM(e){return e instanceof Error&&e.name==="AbortError"}var gs=class{header;parent;children=[];childrenLoaded=!1;childrenPromise=null;selected=!1;viewportIds=[];content=null;contentAvailable=!1;contentFailed=!1;isContentLoading=!1;constructor(t,r=null){this.header=t,this.parent=r}get id(){return this.header.id}get level(){return this.header.level}get pointCount(){return this.header.pointCount}get geometricError(){return this.header.geometricError}get boundingVolume(){return this.header.boundingVolume}setSelected(t){this.selected=!0,this.viewportIds.includes(t)||this.viewportIds.push(t)}clearSelection(){this.selected=!1,this.viewportIds=[]}};var A8={debounceTime:0,minimumNodePixelSize:150,maximumScreenSpaceError:1,lodSelectionMetricType:"maxScreenThresholdSQ",densityThreshold:1,pointBudget:2e6,maxDepth:Number.POSITIVE_INFINITY,onTileLoad:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{}},of=64,vl=class{dataSource;options;root=null;cartographicCenter=null;zoom=1;boundingVolume=null;visibleTilesCount=0;frameNumberValue=0;pendingCount=0;lastUpdatedViewports=null;updatePromise=null;tilesMap=new Map;constructor(t,r={}){this.dataSource=t,this.options={...A8,...r},this.tilesetInitializationPromise=this.initialize()}tilesetInitializationPromise;get isReady(){return this.dataSource.isReady}get frameNumber(){return this.frameNumberValue}get tiles(){return Array.from(this.tilesMap.values())}isLoaded(){return this.frameNumberValue>0&&this.pendingCount===0&&this.selectedTiles.every(t=>t.contentAvailable||t.contentFailed)}selectedTiles=[];update(t=null){this.selectTiles(t).catch(()=>{})}destroy(){this.selectedTiles=[],this.tilesMap.clear(),this.root=null,this.cartographicCenter=null,this.boundingVolume=null,this.visibleTilesCount=0,this.pendingCount=0,this.lastUpdatedViewports=null,this.updatePromise=null}async initialize(){await this.dataSource.initialize();let t=await this.dataSource.getRootTile();this.root=this.getOrCreateTile(t,null);let r=await this.dataSource.getViewState?.();this.boundingVolume=r?.boundingVolume||this.root.boundingVolume;let n=r?.cartographicCenter||this.root.boundingVolume.center;this.cartographicCenter=new _(n),this.zoom=r?.zoom||this.estimateZoom(this.boundingVolume)}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedViewports=t),this.updatePromise||(this.updatePromise=new Promise((r,n)=>{setTimeout(()=>{this.doSelectTiles().then(()=>r(this.frameNumberValue)).catch(n).finally(()=>{this.updatePromise=null})},this.options.debounceTime)})),this.updatePromise}async doSelectTiles(){if(!this.root||!this.lastUpdatedViewports)return;let t=new Set(this.selectedTiles.map(a=>a.id));for(let a of this.tilesMap.values())a.clearSelection();this.frameNumberValue++;let r=Array.isArray(this.lastUpdatedViewports)?this.lastUpdatedViewports:[this.lastUpdatedViewports],n=new Map,i=new Set,o=0;for(let a of r){let c=this.getTraversalContext(a);o=await this.traverseTiles(c,n,o,i)}this.visibleTilesCount=i.size,this.selectedTiles=this.options.onTraversalComplete(Array.from(n.values()));for(let a of this.selectedTiles)this.loadTile(a).catch(()=>{});let s=new Set(this.selectedTiles.map(a=>a.id));this.haveSameIds(t,s)||this.options.onUpdate()}async traverseTiles(t,r,n,i){if(!this.root)return n;let o=n,s=[{tile:this.root,weight:this.estimateScreenRadius(this.root,t.viewport)}];for(;s.length>0;){s.sort((u,f)=>f.weight-u.weight);let a=s.shift();if(!a)break;let{tile:c,weight:l}=a;if(!this.isVisible(c,t))continue;if(i.add(c.id),!r.has(c.id)&&c.pointCount>0){if(o>0&&o+c.pointCount>this.options.pointBudget)break;r.set(c.id,c),o+=c.pointCount}if(r.has(c.id)&&c.setSelected(t.viewport.id),!this.shouldRefine(c,l))continue;let h=await this.getVisibleChildren(c,t);h.length>0&&s.push(...h)}return o}shouldRefine(t,r){if(t.level<this.options.maxDepth&&Number.isFinite(r)&&(t.header.lodSelectionMetricType||this.options.lodSelectionMetricType)==="density-threshold"){let n=Math.max(1,Math.PI*r*r),i=t.pointCount/n,o=t.header.lodThreshold||this.options.densityThreshold;return i<o}return t.level<this.options.maxDepth&&Number.isFinite(r)&&r>=this.options.minimumNodePixelSize}getTraversalContext(t){let r=this.getCullingVolume(t);return{viewport:t,cullingVolume:this.shouldUseCullingVolume(t,r)?r:null}}isVisible(t,r){if(r.cullingVolume){let i=this.getCommonSpaceBoundingSphere(t.boundingVolume,r.viewport);if(i)return this.isBoundingSphereInsideCullingVolume(i,r.cullingVolume)}let n=this.getProjectedFootprint(t.boundingVolume,r.viewport);return n?this.isProjectedFootprintVisible(n,r.viewport):!1}shouldUseCullingVolume(t,r){if(!this.root||!r)return!1;let n=this.getCommonSpaceBoundingSphere(this.root.boundingVolume,t);if(!n)return!1;if(this.isBoundingSphereInsideCullingVolume(n,r))return!0;let i=this.getProjectedFootprint(this.root.boundingVolume,t);return!i||!this.isProjectedFootprintVisible(i,t)}isBoundingSphereInsideCullingVolume(t,r){return r.computeVisibilityWithPlaneMask(t,ge.MASK_INDETERMINATE)!==ge.MASK_OUTSIDE}isProjectedFootprintVisible(t,r){return!(t.x+t.radius<-of||t.x-t.radius>r.width+of||t.y+t.radius<-of||t.y-t.radius>r.height+of)}estimateScreenRadius(t,r){let n=this.getProjectedFootprint(t.boundingVolume,r);return n?n.radius:0}projectBounds(t,r){let n=this.getBoundingVolumeCorners(t),i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;try{for(let c of n){let[l,h]=r.project(c);!Number.isFinite(l)||!Number.isFinite(h)||(i=Math.min(i,l),o=Math.min(o,h),s=Math.max(s,l),a=Math.max(a,h))}}catch{return null}return!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)?null:{minX:i,minY:o,maxX:s,maxY:a}}getProjectedFootprint(t,r){let n=Number.NaN,i=Number.NaN;try{[n,i]=r.project(t.center)}catch{return null}if(!Number.isFinite(n)||!Number.isFinite(i))return null;let o=this.getBoundingVolumeCorners(t),s=0;try{for(let a of o){let[c,l]=r.project(a);!Number.isFinite(c)||!Number.isFinite(l)||(s=Math.max(s,Math.hypot(c-n,l-i)))}}catch{return null}if(s===0){let a=this.projectBounds(t,r);a&&(s=Math.max(a.maxX-a.minX,a.maxY-a.minY)/2)}return{x:n,y:i,radius:s}}async getVisibleChildren(t,r){return t.level>=this.options.maxDepth?[]:(await this.getChildren(t)).map(i=>({tile:i,weight:this.estimateScreenRadius(i,r.viewport)})).filter(i=>this.isVisible(i.tile,r))}async getChildren(t){if(t.childrenLoaded)return t.children;if(!t.childrenPromise){let r=this.dataSource.getChildren(t.header).then(n=>n.map(i=>this.getOrCreateTile(i,t))).then(n=>(t.children=n,t.childrenLoaded=!0,n));t.childrenPromise=r.finally(()=>{t.childrenPromise===r&&(t.childrenPromise=null)})}return t.childrenPromise}getOrCreateTile(t,r){let n=this.tilesMap.get(t.id);if(n)return n.header=t,r&&n.parent!==r&&(n.parent=r),n;let i=new gs(t,r);return this.tilesMap.set(t.id,i),r&&!r.children.find(o=>o.id===i.id)&&r.children.push(i),i}async loadTile(t){if(!(t.contentAvailable||t.isContentLoading||t.contentFailed)){t.isContentLoading=!0,this.pendingCount++;try{let r=await this.dataSource.loadTileContent(t.header);t.content=r,t.contentAvailable=!0,r&&this.options.onTileLoad(t)}catch(r){t.contentFailed=!0,this.options.onTileError(t,r)}finally{t.isContentLoading=!1,this.pendingCount--}}}estimateZoom(t){if(!t||t.coordinateFrame==="cartesian")return 1;let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?360:t.wrapsDateline?360-Math.abs(n[0]-r[0]):Math.abs(n[0]-r[0]),o=Math.max(i,1e-6);return Math.max(1,Math.round(Math.log2(360/o)))}haveSameIds(t,r){if(t.size!==r.size)return!1;for(let n of t)if(!r.has(n))return!1;return!0}getBoundingVolumeCorners(t){let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?[[-180,180]]:t.wrapsDateline?[[r[0],180],[-180,n[0]]]:[[r[0],n[0]]],o=[],s=360-Math.abs(n[0]-r[0]),a=r[0]+s/2;for(let[c,l]of i){let h=d=>{if(!t.wrapsDateline)return d;let m=d;for(;m-a>180;)m-=360;for(;m-a<-180;)m+=360;return m},u=h(c),f=h(l);o.push([u,r[1],r[2]||0],[u,r[1],n[2]||0],[u,n[1],r[2]||0],[u,n[1],n[2]||0],[f,r[1],r[2]||0],[f,r[1],n[2]||0],[f,n[1],r[2]||0],[f,n[1],n[2]||0])}return o}getCullingVolume(t){let r=t.getFrustumPlanes?.bind(t);if(!r)return null;let n=r(),i=["left","right","bottom","top","near","far"],o=[];for(let s of i){let a=n[s];if(!a)return null;o.push(new ne(a.normal,-a.distance))}return new ge(o)}getCommonSpaceBoundingSphere(t,r){let n=r.projectPosition?.bind(r);if(!n)return null;let i=this.getBoundingVolumeCorners(t),o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;try{for(let u of i){let[f,d,m=0]=n(u);!Number.isFinite(f)||!Number.isFinite(d)||!Number.isFinite(m)||(o=Math.min(o,f),s=Math.min(s,d),a=Math.min(a,m),c=Math.max(c,f),l=Math.max(l,d),h=Math.max(h,m))}}catch{return null}return!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(c)||!Number.isFinite(l)||!Number.isFinite(h)?null:new Ee().fromCornerPoints([o,s,a],[c,l,h])}};r1();return hI(RB);})();
7
+ "use strict";var __exports__=(()=>{var ii=Object.create;var zt=Object.defineProperty;var oi=Object.getOwnPropertyDescriptor;var ai=Object.getOwnPropertyNames;var ci=Object.getPrototypeOf,li=Object.prototype.hasOwnProperty;var C=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var hi=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},mr=(e,t)=>{for(var r in t)zt(e,r,{get:t[r],enumerable:!0})},vt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ai(t))!li.call(e,s)&&s!==r&&zt(e,s,{get:()=>t[s],enumerable:!(n=oi(t,s))||n.enumerable});return e},Dt=(e,t,r)=>(vt(e,t,"default"),r&&vt(r,t,"default")),fi=(e,t,r)=>(r=e!=null?ii(ci(e)):{},vt(t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r,e)),ui=e=>vt(zt({},"__esModule",{value:!0}),e);var xr=hi((_a,pr)=>{pr.exports=globalThis.loaders});function qt(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var gr=C(()=>{"use strict"});function pt(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var me=C(()=>{});var it,pe=C(()=>{me();it=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=pt(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(pt()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}});var W,Tr=C(()=>{pe();W=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,s=this.stats[r];return s||(t instanceof it?s=t:s=new it(r,n),this.stats[r]=s),s}}});var Ft=C(()=>{Tr();pe();me()});var mi,pi,xi,gi,Ti,Si,j,Sr=C(()=>{"use strict";Ft();mi="Queued Requests",pi="Active Requests",xi="Cancelled Requests",gi="Queued Requests Ever",Ti="Active Requests Ever",Si={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},j=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...Si,...t},this.stats=new W({id:this.props.id}),this.stats.get(mi),this.stats.get(pi),this.stats.get(xi),this.stats.get(gi),this.stats.get(Ti)}setProps(t){t.throttleRequests!==void 0&&(this.props.throttleRequests=t.throttleRequests),t.maxRequests!==void 0&&(this.props.maxRequests=t.maxRequests),t.debounceTime!==void 0&&(this.props.debounceTime=t.debounceTime)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},s=new Promise(i=>(n.resolve=i,n));return this.requestQueue.push(n),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:r,resolve:n}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}}});function _r(e,t){return t?t.aborted?(e.catch(()=>{}),Promise.reject(t.reason)):new Promise((r,n)=>{let s=()=>{t.removeEventListener("abort",s),n(t.reason)};t.addEventListener("abort",s,{once:!0}),e.then(i=>{t.removeEventListener("abort",s),r(i)},i=>{t.removeEventListener("abort",s),n(i)})}):e}function kt(e,t){let r=new AbortController,n=[],s=()=>{for(let[i,o]of n)i.removeEventListener("abort",o)};for(let i of t){if(!i)continue;let o=()=>r.abort(i.reason);n.push([i,o]),i.addEventListener("abort",o,{once:!0}),i.aborted&&o()}try{return r.signal.throwIfAborted(),_r(e(r.signal),r.signal).catch(i=>{throw r.abort(i),i}).finally(s)}catch(i){return r.abort(i),s(),Promise.reject(i)}}var Mr=C(()=>{"use strict"});function Ut(e={}){if(e.coordinateEpoch!==void 0&&!Number.isFinite(e.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:Er(e.crs||{state:"absent",provenance:"unknown"}),vertical:e.vertical?Er(e.vertical):void 0,coordinateEpoch:e.coordinateEpoch,coordinateFrame:e.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...e.coordinateOrder||[]]),units:e.units?Object.freeze([...e.units]):void 0})}function ot(e){if(typeof e=="object")return"projjson";let t=e.trim();return/^[A-Z][A-Z0-9_]*\s*[\[(]/i.test(t)?"wkt":/(?:^|\s)\+?proj=/i.test(t)?"proj-string":/^[A-Z][A-Z0-9._-]*(?::[A-Z0-9._-]+)+$/i.test(t)||/^urn:ogc:def:crs:/i.test(t)||/^https?:\/\//i.test(t)||/^[A-Z][A-Z0-9._-]*$/i.test(t)?"identifier":"opaque"}function Er(e){return e.state==="explicit"||e.state==="default"?Object.freeze({...e,definition:Rr(e.definition),alternatives:e.alternatives?Object.freeze(e.alternatives.map(t=>Object.freeze({...t,definition:Rr(t.definition)}))):void 0}):Object.freeze({...e})}function Rr(e){return typeof e=="string"?e:xe(e)}function xe(e){return Array.isArray(e)?Object.freeze(e.map(t=>xe(t))):e&&typeof e=="object"?Object.freeze(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,xe(r)]))):e}var yr=C(()=>{});function Se(e,t){let n={type:"wkt-crs",root:new ge(e).parse()};if(t?.strict){let s=Ar(n,{profile:t.profile,allowExtensions:!1});if(s.length>0)throw new Gt(s)}return n}function Ar(e,t){if(!e||e.type!=="wkt-crs"||e.root?.type!=="node")throw new TypeError("validateWKTCRS expects a WKTCRSAst");let r=bi(e.root.keyword,t?.profile||"auto"),n=Ai[r],s=Ii[r],i=[],o=e.root.keyword.toUpperCase();return n.has(o)||i.push({code:"invalid-root",message:`${e.root.keyword} is not a ${r} root keyword`,path:[],keyword:e.root.keyword}),Ir(e.root,[],a=>{let c=a.node.keyword.toUpperCase();!t?.allowExtensions&&!s.has(c)&&i.push({code:"unknown-keyword",message:`${a.node.keyword} is not defined by the ${r} profile`,path:a.path,keyword:a.node.keyword}),a.node.values.length===0&&i.push({code:"empty-node",message:`${a.node.keyword} must contain at least one value`,path:a.path,keyword:a.node.keyword});let l=Ni(a.node);l&&i.push({code:"invalid-value",message:l,path:a.path,keyword:a.node.keyword})}),i}function bi(e,t){return t!=="auto"?t:xt.has(e.toUpperCase())?"wkt1":"wkt2:2019"}function Ni(e){let t=e.keyword.toUpperCase(),r=e.values,n=(i,...o)=>!!(r[i]&&o.includes(r[i].type)),s=(i,...o)=>r.length===i&&o.every((a,c)=>n(c,a));if(["ANGLEUNIT","LENGTHUNIT","PARAMETRICUNIT","SCALEUNIT","TIMEUNIT","TEMPORALQUANTITY","UNIT"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric conversion factor`;if(t==="CS"&&!s(2,"enumeration","number"))return`${e.keyword} must contain a coordinate-system type and dimension`;if(t==="BBOX"&&!s(4,"number","number","number","number"))return`${e.keyword} must contain four numeric bounds`;if(["ENSEMBLEACCURACY","EPOCH","COORDEPOCH","FRAMEEPOCH","OPERATIONACCURACY","ORDER"].includes(t)&&!s(1,"number"))return`${e.keyword} must contain one number`;if(["ANCHOR","AREA","CALENDAR","CITATION","REMARK","SCOPE","URI","VERSION"].includes(t)&&!s(1,"string"))return`${e.keyword} must contain one quoted string`;if(["ELLIPSOID","SPHEROID","TRIAXIAL"].includes(t)&&!(r.length>=3&&n(0,"string")&&n(1,"number")&&n(2,"number")))return`${e.keyword} must start with a quoted name and numeric ellipsoid axes`;if(["PARAMETER"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric value`;if(t==="PARAMETERFILE"&&!s(2,"string","string"))return`${e.keyword} must contain a quoted name and file name`;if(["AUTHORITY","ID"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"string","number")))return`${e.keyword} must start with a quoted authority and identifier`;if(["AXIS"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"enumeration")))return`${e.keyword} must start with a quoted name and axis direction`;if(["METHOD","PROJECTION"].includes(t)&&!(r.length>=1&&n(0,"string")))return`${e.keyword} must start with a quoted name`;if(t==="TIMEEXTENT"){let i=o=>n(o,"enumeration","string");if(r.length!==2||!i(0)||!i(1))return`${e.keyword} must contain two date-time or quoted values`}if(t==="VERTICALEXTENT"&&(r.length<2||r.length>3||!n(0,"number")||!n(1,"number")||r.length===3&&!n(2,"node")))return`${e.keyword} must contain two numeric bounds and an optional unit`;if(t==="COORDINATEMETADATA"&&(r.length<1||r.length>2||!n(0,"node")||r.length===2&&(!n(1,"node")||!["EPOCH","COORDEPOCH"].includes(r[1].keyword.toUpperCase()))))return`${e.keyword} must contain a CRS and an optional coordinate epoch`;if(t==="BOUNDCRS"){let i=r.slice(0,3).map(o=>o.type==="node"?o.keyword.toUpperCase():"");if(i[0]!=="SOURCECRS"||i[1]!=="TARGETCRS"||i[2]!=="ABRIDGEDTRANSFORMATION")return`${e.keyword} must start with SOURCECRS, TARGETCRS, and ABRIDGEDTRANSFORMATION`}return["COMPOUNDCRS","CONCATENATEDOPERATION","COORDINATEOPERATION","DERIVEDPROJCRS","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","GEOGCRS","GEOGRAPHICCRS","PARAMETRICCRS","POINTMOTIONOPERATION","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"].includes(t)&&!n(0,"string")?`${e.keyword} must start with a quoted name`:null}function Ir(e,t,r){r({node:e,path:t});for(let n=0;n<e.values.length;n++){let s=e.values[n];s.type==="node"&&Ir(s,[...t,n],r)}}function Pi(e,t){let r=1,n=1;for(let s=0;s<t&&s<e.length;s++)e[s]===`
8
+ `?(r++,n=1):n++;return{line:r,column:n}}var Bt,Gt,_i,Mi,xt,Te,Ei,Ri,yi,Ci,Cr,wr,Or,wi,Oi,Ai,Ii,ge,br=C(()=>{Bt=class extends SyntaxError{constructor(t,r,n){let s=Pi(r,n);super(`${t} at ${s.line}:${s.column}`),this.name="WKTCRSSyntaxError",this.offset=n,this.line=s.line,this.column=s.column}},Gt=class extends Error{constructor(t){super(t[0]?.message||"WKT validation failed"),this.name="WKTCRSValidationError",this.issues=t}},_i=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?$/,Mi=/^[A-Za-z][A-Za-z0-9_]*/,xt=new Set(["COMPD_CS","CONCAT_MT","FITTED_CS","GEOCCS","GEOGCS","INVERSE_MT","LOCAL_CS","PARAM_MT","PASSTHROUGH_MT","PROJCS","VERT_CS"]),Te=new Set([...xt,"AUTHORITY","AXIS","CONCAT_MT","DATUM","INVERSE_MT","LOCAL_DATUM","PARAMETER","PARAM_MT","PASSTHROUGH_MT","PRIMEM","PROJECTION","SPHEROID","TOWGS84","UNIT","VERT_DATUM"]),Ei=new Set(xt),Ri=new Set([...Te,"EXTENSION"]),yi=new Set([...xt,"COMPDCS","LOCALCS","VERTCS"]),Ci=new Set([...Te,"COMPDCS","LOCALCS","VDATUM","VERTCS"]),Cr=new Set(["BOUNDCRS","COMPOUNDCRS","COORDINATEOPERATION","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","PARAMETRICCRS","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"]),wr=new Set([...Cr,"CONCATENATEDOPERATION","COORDINATEMETADATA","DERIVEDPROJCRS","GEOGCRS","GEOGRAPHICCRS","POINTMOTIONOPERATION"]),Or=new Set([...wr,"ABRIDGEDTRANSFORMATION","ANCHOR","ANGLEUNIT","AREA","AXIS","BASEENGCRS","BASEGEODCRS","BASEGEOGCRS","BASEPARAMCRS","BASEPROJCRS","BASETIMECRS","BASEVERTCRS","BBOX","BEARING","CALENDAR","CITATION","CONVERSION","COORDEPOCH","CS","DATUM","DERIVINGCONVERSION","DYNAMIC","EDATUM","ELLIPSOID","ENGINEERINGDATUM","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEODETICDATUM","GEOIDMODEL","ID","INTERPOLATIONCRS","LENGTHUNIT","MEMBER","MERIDIAN","METHOD","MODEL","OPERATIONACCURACY","ORDER","PARAMETER","PARAMETERFILE","PARAMETRICDATUM","PARAMETRICUNIT","PDATUM","PRIMEM","PRIMEMERIDIAN","REMARK","SCALEUNIT","SCOPE","SOURCECRS","STEP","TARGETCRS","TDATUM","TEMPORALQUANTITY","TIMEEXTENT","TIMEORIGIN","TIMEUNIT","TIMEDATUM","TRIAXIAL","TRF","URI","USAGE","VDATUM","VERSION","VERTICALDATUM","VERTICALEXTENT","VELOCITYGRID","VRF"]),wi=new Set(["BASEGEOGCRS","CALENDAR","CONCATENATEDOPERATION","COORDEPOCH","COORDINATEMETADATA","DERIVEDPROJCRS","DYNAMIC","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEOGCRS","GEOGRAPHICCRS","GEOIDMODEL","MEMBER","MODEL","POINTMOTIONOPERATION","STEP","TEMPORALQUANTITY","TRF","TRIAXIAL","VELOCITYGRID","VRF"]),Oi=new Set([...Or].filter(e=>!wi.has(e))),Ai={wkt1:xt,gdal:Ei,esri:yi,"wkt2:2015":Cr,"wkt2:2019":wr},Ii={wkt1:Te,gdal:Ri,esri:Ci,"wkt2:2015":Oi,"wkt2:2019":Or};ge=class{constructor(t){this.offset=0,this.source=t}parse(){this.skipWhitespace();let t=this.parseNode();return this.skipWhitespace(),this.offset!==this.source.length&&this.fail("Unexpected content after WKT root"),t}parseNode(){let t=this.parseKeyword();return this.parseNodeAfterKeyword(t)}parseNodeAfterKeyword(t){this.skipWhitespace();let r=this.source[this.offset];r!=="["&&r!=="("&&this.fail(`Expected '[' or '(' after ${t}`),this.offset++;let n=r==="["?"bracket":"parenthesis",s=r==="["?"]":")",i=[];if(this.skipWhitespace(),this.source[this.offset]===s)return this.offset++,{type:"node",keyword:t,delimiter:n,values:i};for(;this.offset<this.source.length;){i.push(this.parseValue()),this.skipWhitespace();let o=this.source[this.offset];if(o===","){this.offset++,this.skipWhitespace(),this.source[this.offset]===s&&this.fail("Expected a WKT value after comma");continue}if(o===s)return this.offset++,{type:"node",keyword:t,delimiter:n,values:i};(o==="]"||o===")")&&this.fail(`Expected '${s}' to close ${t}`),this.fail(`Expected ',' or '${s}' in ${t}`)}this.fail(`Unterminated ${t} node`)}parseValue(){if(this.skipWhitespace(),this.source[this.offset]==='"')return this.parseString();let r=this.offset;for(;this.offset<this.source.length&&!/[\s,\[\]()"]/.test(this.source[this.offset]);)this.offset++;r===this.offset&&this.fail("Expected a WKT value");let n=this.source.slice(r,this.offset);return this.source[this.offset]==='"'&&this.fail("Unexpected quote in unquoted WKT value"),this.skipWhitespace(),this.source[this.offset]==="["||this.source[this.offset]==="("?(/^[A-Za-z][A-Za-z0-9_]*$/.test(n)||this.fail(`Invalid WKT keyword '${n}'`),this.parseNodeAfterKeyword(n)):_i.test(n)?{type:"number",value:Number(n),raw:n}:{type:"enumeration",value:n}}parseKeyword(){let t=this.source.slice(this.offset).match(Mi);return t||this.fail("Expected a WKT keyword"),this.offset+=t[0].length,t[0]}parseString(){this.offset++;let t="";for(;this.offset<this.source.length;){let r=this.source[this.offset++];if(r==='"'){if(this.source[this.offset]==='"'){t+='"',this.offset++;continue}return{type:"string",value:t}}t+=r}this.fail("Unterminated WKT string")}skipWhitespace(){for(;this.offset<this.source.length&&/\s/.test(this.source[this.offset]);)this.offset++}fail(t){throw new Bt(t,this.source,this.offset)}}});function _e(e){let t=zi(e);if(t.length===0)throw new H("PROJ string is empty",e,0);return{type:"proj-string",parameters:t.map(n=>vi(n.raw,n.offset,e))}}function vi(e,t,r){let n=e.startsWith("+")?e.slice(1):e;if(!n)throw new H("Expected a parameter after '+'",r,t);let s=n.indexOf("="),i=s<0?n:n.slice(0,s);if(!i||/[\s+=]/.test(i))throw new H(`Invalid PROJ parameter name '${i}'`,r,t);if(s<0)return{type:"parameter",name:i};let o=n.slice(s+1),a=Di(o,r,t+s+1);return{type:"parameter",name:i,value:a,rawValue:o}}function zi(e){let t=[],r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;let n=r,s=null,i=!1;for(;r<e.length;){let o=e[r];if(i){i=!1,r++;continue}if(o==="\\"&&s){i=!0,r++;continue}if(s){o===s&&(s=null),r++;continue}if((o==='"'||o==="'")&&e[r-1]==="="){s=o,r++;continue}if(/\s/.test(o))break;r++}if(s)throw new H("Unterminated quoted PROJ value",e,n);t.push({raw:e.slice(n,r),offset:n})}return t}function Di(e,t,r){if(!e)return"";let n=e[0];if(n!=='"'&&n!=="'"){if((e.includes('"')||e.includes("'"))&&!Li.test(e))throw new H("Quote must begin a PROJ parameter value",t,r);return e}if(e[e.length-1]!==n)throw new H("Unterminated quoted PROJ value",t,r);let s="";for(let i=1;i<e.length-1;i++){let o=e[i];o==="\\"&&i+1<e.length-1?s+=e[++i]:s+=o}return s}function qi(e,t){let r=1,n=1;for(let s=0;s<t&&s<e.length;s++)e[s]===`
9
+ `?(r++,n=1):n++;return{line:r,column:n}}var H,Li,Nr=C(()=>{H=class extends SyntaxError{constructor(t,r,n){let s=qi(r,n);super(`${t} at ${s.line}:${s.column}`),this.name="PROJStringSyntaxError",this.offset=n,this.line=s.line,this.column=s.column}};Li=/^[+-]?\d+(?:\.\d*)?d(?:\d+(?:\.\d*)?'(?:\d+(?:\.\d*)?")?)?[NSEW]?$/i});var Me=C(()=>{yr();br();Nr()});var K={};mr(K,{EPSILON1:()=>Fi,EPSILON10:()=>Zi,EPSILON11:()=>ji,EPSILON12:()=>Hi,EPSILON13:()=>Ki,EPSILON14:()=>Xi,EPSILON15:()=>Ji,EPSILON16:()=>Qi,EPSILON17:()=>to,EPSILON18:()=>eo,EPSILON19:()=>ro,EPSILON2:()=>ki,EPSILON20:()=>no,EPSILON3:()=>Ui,EPSILON4:()=>Bi,EPSILON5:()=>Gi,EPSILON6:()=>Vi,EPSILON7:()=>Wi,EPSILON8:()=>Yi,EPSILON9:()=>$i,PI:()=>ao,PI_OVER_FOUR:()=>io,PI_OVER_SIX:()=>oo,PI_OVER_TWO:()=>so,TWO_PI:()=>co});var Fi,ki,Ui,Bi,Gi,Vi,Wi,Yi,$i,Zi,ji,Hi,Ki,Xi,Ji,Qi,to,eo,ro,no,so,io,oo,ao,co,Pr=C(()=>{Fi=.1,ki=.01,Ui=.001,Bi=1e-4,Gi=1e-5,Vi=1e-6,Wi=1e-7,Yi=1e-8,$i=1e-9,Zi=1e-10,ji=1e-11,Hi=1e-12,Ki=1e-13,Xi=1e-14,Ji=1e-15,Qi=1e-16,to=1e-17,eo=1e-18,ro=1e-19,no=1e-20,so=Math.PI/2,io=Math.PI/4,oo=Math.PI/6,ao=Math.PI,co=Math.PI*2});function Ee(e,{precision:t=L.precision}={}){return e=uo(e),`${parseFloat(e.toPrecision(t))}`}function Y(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Re(e){return Lr(e)}function ye(e){return vr(e)}function Lr(e,t){return Ce(e,r=>r*ho,t)}function vr(e,t){return Ce(e,r=>r*lo,t)}function gt(e,t,r){return Ce(e,n=>Math.max(t,Math.min(r,n)))}function U(e,t,r){let n=L.EPSILON;r&&(L.EPSILON=r);try{if(e===t)return!0;if(Y(e)&&Y(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!U(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=L.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{L.EPSILON=n}}function uo(e){return Math.round(e/L.EPSILON)*L.EPSILON}function mo(e){return e.clone?e.clone():new Array(e.length)}function Ce(e,t,r){if(Y(e)){let n=e;r=r||mo(n);for(let s=0;s<r.length&&s<n.length;++s){let i=typeof e=="number"?e:e[s];r[s]=t(i,s,r)}return r}return t(e)}var lo,ho,fo,L,ct=C(()=>{lo=1/Math.PI*180,ho=1/180*Math.PI,fo={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...fo}};L=globalThis.mathgl.config});var et,Vt=C(()=>{ct();et=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Y(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toString(){return this.formatString(L)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Ee(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!U(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof r=="number"?r:r[s];this[s]=i+n*(o-i)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(L.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}}});function po(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function v(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Wt(e,t,r=""){if(L.debug&&!po(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}var lt=C(()=>{ct()});var Yt,zr=C(()=>{Vt();lt();ct();Yt=class extends et{toString(){let t="[";if(L.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=v(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(t,r){let n=t*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}}});function D(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var we=C(()=>{});var $t,Dr=C(()=>{Vt();lt();we();$t=class extends et{get x(){return this[0]}set x(t){this[0]=v(t)}get y(){return this[1]}set y(t){this[1]=v(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-t[n];r+=s*s}return v(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return v(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return D(t>=0&&t<this.ELEMENTS,"index is out of range"),v(this[t])}setComponent(t,r){return D(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n]*r;return this.check()}}});var Zt,sc,qr=C(()=>{Zt=typeof Float32Array<"u"?Float32Array:Array,sc=Math.PI/180});function Fr(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[4]*s+r[12],e[1]=r[1]*n+r[5]*s+r[13],e}var kr=C(()=>{});function Ur(e,t,r){let n=t[0],s=t[1],i=r[3]*n+r[7]*s||1;return e[0]=(r[0]*n+r[4]*s)/i,e[1]=(r[1]*n+r[5]*s)/i,e}function jt(e,t,r){let n=t[0],s=t[1],i=t[2],o=r[3]*n+r[7]*s+r[11]*i||1;return e[0]=(r[0]*n+r[4]*s+r[8]*i)/o,e[1]=(r[1]*n+r[5]*s+r[9]*i)/o,e[2]=(r[2]*n+r[6]*s+r[10]*i)/o,e}function Br(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e[2]=t[2],e}var Oe=C(()=>{});function Gr(){let e=new Zt(3);return Zt!==Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Ae(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function Ie(e,t,r){let n=new Zt(3);return n[0]=e,n[1]=t,n[2]=r,n}function Vr(e,t){let r=t[0],n=t[1],s=t[2],i=r*r+n*n+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function St(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ht(e,t,r){let n=t[0],s=t[1],i=t[2],o=r[0],a=r[1],c=r[2];return e[0]=s*c-i*a,e[1]=i*o-n*c,e[2]=n*a-s*o,e}function Ht(e,t,r){let n=t[0],s=t[1],i=t[2],o=r[3]*n+r[7]*s+r[11]*i+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*s+r[8]*i+r[12])/o,e[1]=(r[1]*n+r[5]*s+r[9]*i+r[13])/o,e[2]=(r[2]*n+r[6]*s+r[10]*i+r[14])/o,e}function Wr(e,t,r){let n=t[0],s=t[1],i=t[2];return e[0]=n*r[0]+s*r[3]+i*r[6],e[1]=n*r[1]+s*r[4]+i*r[7],e[2]=n*r[2]+s*r[5]+i*r[8],e}function Yr(e,t,r){let n=r[0],s=r[1],i=r[2],o=r[3],a=t[0],c=t[1],l=t[2],h=s*l-i*c,f=i*a-n*l,u=n*c-s*a,d=s*u-i*f,m=i*h-n*u,p=n*f-s*h,g=o*2;return h*=g,f*=g,u*=g,d*=2,m*=2,p*=2,e[0]=a+h+d,e[1]=c+f+m,e[2]=l+u+p,e}function $r(e,t,r,n){let s=[],i=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],i[0]=s[0],i[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),i[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function Zr(e,t,r,n){let s=[],i=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],i[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),i[1]=s[1],i[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function jr(e,t,r,n){let s=[],i=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],i[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),i[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),i[2]=s[2],e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function Hr(e,t){let r=e[0],n=e[1],s=e[2],i=t[0],o=t[1],a=t[2],c=Math.sqrt((r*r+n*n+s*s)*(i*i+o*o+a*a)),l=c&&St(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}var Kr,_t=C(()=>{qr();Kr=Ae});var be,Kt,x,Xr=C(()=>{Dr();ct();lt();_t();Oe();be=[0,0,0],x=class e extends $t{static get ZERO(){return Kt||(Kt=new e(0,0,0),Object.freeze(Kt)),Kt}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Y(t)?this.copy(t):(L.debug&&(v(t),v(r),v(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return L.debug&&(v(t.x),v(t.y),v(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=v(t)}angle(t){return Hr(this,t)}cross(t){return ht(this,this,t),this.check()}rotateX({radians:t,origin:r=be}){return $r(this,this,r,t),this.check()}rotateY({radians:t,origin:r=be}){return Zr(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=be}){return jr(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ht(this,this,t),this.check()}transformAsVector(t){return jt(this,this,t),this.check()}transformByMatrix3(t){return Wr(this,this,t),this.check()}transformByMatrix2(t){return Br(this,this,t),this.check()}transformByQuaternion(t){return Yr(this,this,t),this.check()}}});function To(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Jr(e,t){if(e===t){let r=t[1],n=t[2],s=t[3],i=t[6],o=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Qr(e,t){let r=t[0],n=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],h=t[8],f=t[9],u=t[10],d=t[11],m=t[12],p=t[13],g=t[14],T=t[15],R=r*a-n*o,_=r*c-s*o,M=r*l-i*o,S=n*c-s*a,E=n*l-i*a,O=s*l-i*c,I=h*p-f*m,w=h*g-u*m,y=h*T-d*m,b=f*g-u*p,N=f*T-d*p,P=u*T-d*g,A=R*P-_*N+M*b+S*y-E*w+O*I;return A?(A=1/A,e[0]=(a*P-c*N+l*b)*A,e[1]=(s*N-n*P-i*b)*A,e[2]=(p*O-g*E+T*S)*A,e[3]=(u*E-f*O-d*S)*A,e[4]=(c*y-o*P-l*w)*A,e[5]=(r*P-s*y+i*w)*A,e[6]=(g*M-m*O-T*_)*A,e[7]=(h*O-u*M+d*_)*A,e[8]=(o*N-a*y+l*I)*A,e[9]=(n*y-r*N-i*I)*A,e[10]=(m*E-p*M+T*R)*A,e[11]=(f*M-h*E-d*R)*A,e[12]=(a*w-o*b-c*I)*A,e[13]=(r*b-n*w+s*I)*A,e[14]=(p*_-m*S-g*R)*A,e[15]=(h*S-f*_+u*R)*A,e):null}function tn(e){let t=e[0],r=e[1],n=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],h=e[9],f=e[10],u=e[11],d=e[12],m=e[13],p=e[14],g=e[15],T=t*o-r*i,R=t*a-n*i,_=r*a-n*o,M=l*m-h*d,S=l*p-f*d,E=h*p-f*m,O=t*E-r*S+n*M,I=i*E-o*S+a*M,w=l*_-h*R+f*T,y=d*_-m*R+p*T;return c*O-s*I+g*w-u*y}function Ne(e,t,r){let n=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],h=t[7],f=t[8],u=t[9],d=t[10],m=t[11],p=t[12],g=t[13],T=t[14],R=t[15],_=r[0],M=r[1],S=r[2],E=r[3];return e[0]=_*n+M*a+S*f+E*p,e[1]=_*s+M*c+S*u+E*g,e[2]=_*i+M*l+S*d+E*T,e[3]=_*o+M*h+S*m+E*R,_=r[4],M=r[5],S=r[6],E=r[7],e[4]=_*n+M*a+S*f+E*p,e[5]=_*s+M*c+S*u+E*g,e[6]=_*i+M*l+S*d+E*T,e[7]=_*o+M*h+S*m+E*R,_=r[8],M=r[9],S=r[10],E=r[11],e[8]=_*n+M*a+S*f+E*p,e[9]=_*s+M*c+S*u+E*g,e[10]=_*i+M*l+S*d+E*T,e[11]=_*o+M*h+S*m+E*R,_=r[12],M=r[13],S=r[14],E=r[15],e[12]=_*n+M*a+S*f+E*p,e[13]=_*s+M*c+S*u+E*g,e[14]=_*i+M*l+S*d+E*T,e[15]=_*o+M*h+S*m+E*R,e}function en(e,t,r){let n=r[0],s=r[1],i=r[2],o,a,c,l,h,f,u,d,m,p,g,T;return t===e?(e[12]=t[0]*n+t[4]*s+t[8]*i+t[12],e[13]=t[1]*n+t[5]*s+t[9]*i+t[13],e[14]=t[2]*n+t[6]*s+t[10]*i+t[14],e[15]=t[3]*n+t[7]*s+t[11]*i+t[15]):(o=t[0],a=t[1],c=t[2],l=t[3],h=t[4],f=t[5],u=t[6],d=t[7],m=t[8],p=t[9],g=t[10],T=t[11],e[0]=o,e[1]=a,e[2]=c,e[3]=l,e[4]=h,e[5]=f,e[6]=u,e[7]=d,e[8]=m,e[9]=p,e[10]=g,e[11]=T,e[12]=o*n+h*s+m*i+t[12],e[13]=a*n+f*s+p*i+t[13],e[14]=c*n+u*s+g*i+t[14],e[15]=l*n+d*s+T*i+t[15]),e}function rn(e,t,r){let n=r[0],s=r[1],i=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function nn(e,t,r,n){let s=n[0],i=n[1],o=n[2],a=Math.sqrt(s*s+i*i+o*o),c,l,h,f,u,d,m,p,g,T,R,_,M,S,E,O,I,w,y,b,N,P,A,q;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,l=Math.sin(r),c=Math.cos(r),h=1-c,f=t[0],u=t[1],d=t[2],m=t[3],p=t[4],g=t[5],T=t[6],R=t[7],_=t[8],M=t[9],S=t[10],E=t[11],O=s*s*h+c,I=i*s*h+o*l,w=o*s*h-i*l,y=s*i*h-o*l,b=i*i*h+c,N=o*i*h+s*l,P=s*o*h+i*l,A=i*o*h-s*l,q=o*o*h+c,e[0]=f*O+p*I+_*w,e[1]=u*O+g*I+M*w,e[2]=d*O+T*I+S*w,e[3]=m*O+R*I+E*w,e[4]=f*y+p*b+_*N,e[5]=u*y+g*b+M*N,e[6]=d*y+T*b+S*N,e[7]=m*y+R*b+E*N,e[8]=f*P+p*A+_*q,e[9]=u*P+g*A+M*q,e[10]=d*P+T*A+S*q,e[11]=m*P+R*A+E*q,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function sn(e,t,r){let n=Math.sin(r),s=Math.cos(r),i=t[4],o=t[5],a=t[6],c=t[7],l=t[8],h=t[9],f=t[10],u=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+l*n,e[5]=o*s+h*n,e[6]=a*s+f*n,e[7]=c*s+u*n,e[8]=l*s-i*n,e[9]=h*s-o*n,e[10]=f*s-a*n,e[11]=u*s-c*n,e}function on(e,t,r){let n=Math.sin(r),s=Math.cos(r),i=t[0],o=t[1],a=t[2],c=t[3],l=t[8],h=t[9],f=t[10],u=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-l*n,e[1]=o*s-h*n,e[2]=a*s-f*n,e[3]=c*s-u*n,e[8]=i*n+l*s,e[9]=o*n+h*s,e[10]=a*n+f*s,e[11]=c*n+u*s,e}function an(e,t,r){let n=Math.sin(r),s=Math.cos(r),i=t[0],o=t[1],a=t[2],c=t[3],l=t[4],h=t[5],f=t[6],u=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+l*n,e[1]=o*s+h*n,e[2]=a*s+f*n,e[3]=c*s+u*n,e[4]=l*s-i*n,e[5]=h*s-o*n,e[6]=f*s-a*n,e[7]=u*s-c*n,e}function cn(e,t){let r=t[0],n=t[1],s=t[2],i=t[4],o=t[5],a=t[6],c=t[8],l=t[9],h=t[10];return e[0]=Math.sqrt(r*r+n*n+s*s),e[1]=Math.sqrt(i*i+o*o+a*a),e[2]=Math.sqrt(c*c+l*l+h*h),e}function ln(e,t){let r=t[0],n=t[1],s=t[2],i=t[3],o=r+r,a=n+n,c=s+s,l=r*o,h=n*o,f=n*a,u=s*o,d=s*a,m=s*c,p=i*o,g=i*a,T=i*c;return e[0]=1-f-m,e[1]=h+T,e[2]=u-g,e[3]=0,e[4]=h-T,e[5]=1-l-m,e[6]=d+p,e[7]=0,e[8]=u+g,e[9]=d-p,e[10]=1-l-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function hn(e,t,r,n,s,i,o){let a=1/(r-t),c=1/(s-n),l=1/(i-o);return e[0]=i*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(s+n)*c,e[10]=(o+i)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*l,e[15]=0,e}function So(e,t,r,n,s){let i=1/Math.tan(t/2);if(e[0]=i/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(n-s);e[10]=(s+n)*o,e[14]=2*s*n*o}else e[10]=-1,e[14]=-2*n;return e}function _o(e,t,r,n,s,i,o){let a=1/(t-r),c=1/(n-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(s+n)*c,e[14]=(o+i)*l,e[15]=1,e}function dn(e,t,r,n){let s,i,o,a,c,l,h,f,u,d,m=t[0],p=t[1],g=t[2],T=n[0],R=n[1],_=n[2],M=r[0],S=r[1],E=r[2];return Math.abs(m-M)<1e-6&&Math.abs(p-S)<1e-6&&Math.abs(g-E)<1e-6?To(e):(f=m-M,u=p-S,d=g-E,s=1/Math.sqrt(f*f+u*u+d*d),f*=s,u*=s,d*=s,i=R*d-_*u,o=_*f-T*d,a=T*u-R*f,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=u*a-d*o,l=d*i-f*a,h=f*o-u*i,s=Math.sqrt(c*c+l*l+h*h),s?(s=1/s,c*=s,l*=s,h*=s):(c=0,l=0,h=0),e[0]=i,e[1]=c,e[2]=f,e[3]=0,e[4]=o,e[5]=l,e[6]=u,e[7]=0,e[8]=a,e[9]=h,e[10]=d,e[11]=0,e[12]=-(i*m+o*p+a*g),e[13]=-(c*m+l*p+h*g),e[14]=-(f*m+u*p+d*g),e[15]=1,e)}var fn,un,Pe=C(()=>{fn=So;un=_o});function mn(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function pn(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function xn(e){let t=e[0],r=e[1],n=e[2],s=e[3];return Math.sqrt(t*t+r*r+n*n+s*s)}function gn(e){let t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function Tn(e,t){let r=t[0],n=t[1],s=t[2],i=t[3],o=r*r+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=s*o,e[3]=i*o,e}function Sn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function _n(e,t,r,n){let s=t[0],i=t[1],o=t[2],a=t[3];return e[0]=s+n*(r[0]-s),e[1]=i+n*(r[1]-i),e[2]=o+n*(r[2]-o),e[3]=a+n*(r[3]-a),e}function Mn(e,t,r){let n=t[0],s=t[1],i=t[2],o=t[3];return e[0]=r[0]*n+r[4]*s+r[8]*i+r[12]*o,e[1]=r[1]*n+r[5]*s+r[9]*i+r[13]*o,e[2]=r[2]*n+r[6]*s+r[10]*i+r[14]*o,e[3]=r[3]*n+r[7]*s+r[11]*i+r[15]*o,e}var Le=C(()=>{});function Co(){return Xt||(Xt=new z([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Xt)),Xt}function wo(){return Jt||(Jt=new z,Object.freeze(Jt)),Jt}function En(e){if(e>Math.PI*2)throw Error("expected radians")}function Oo(e,t,r,n,s,i){let o=2*i/(r-t),a=2*i/(s-n),c=(r+t)/(r-t),l=(s+n)/(s-n),h=-1,f=-1,u=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=h,e[11]=f,e[12]=0,e[13]=0,e[14]=u,e[15]=0,e}var De,Eo,Ro,ve,ze,yo,z,Xt,Jt,Rn=C(()=>{zr();lt();Oe();Pe();kr();_t();Le();(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(De||(De={}));Eo=45*Math.PI/180,Ro=1,ve=.1,ze=500,yo=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),z=class extends Yt{static get IDENTITY(){return wo()}static get ZERO(){return Co()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return De}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,s,i,o,a,c,l,h,f,u,d,m,p,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=h,this[10]=f,this[11]=u,this[12]=d,this[13]=m,this[14]=p,this[15]=g,this.check()}setRowMajor(t,r,n,s,i,o,a,c,l,h,f,u,d,m,p,g){return this[0]=t,this[1]=i,this[2]=l,this[3]=d,this[4]=r,this[5]=o,this[6]=h,this[7]=m,this[8]=n,this[9]=a,this[10]=f,this[11]=p,this[12]=s,this[13]=c,this[14]=u,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(yo)}fromObject(t){return this.check()}fromQuaternion(t){return ln(this,t),this.check()}fromMatrix3(t){return this.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1)}frustum(t){let{left:r,right:n,bottom:s,top:i,near:o=ve,far:a=ze}=t;return a===1/0?Oo(this,r,n,s,i,o):hn(this,r,n,s,i,o,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=t;return dn(this,r,n,s),this.check()}ortho(t){let{left:r,right:n,bottom:s,top:i,near:o=ve,far:a=ze}=t;return un(this,r,n,s,i,o,a),this.check()}orthographic(t){let{fovy:r=Eo,aspect:n=Ro,focalDistance:s=1,near:i=ve,far:o=ze}=t;En(r);let a=r/2,c=s*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:i,far:o})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:i=500}=t;return En(r),fn(this,r,n,s,i),this.check()}determinant(){return tn(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return Jr(this,this),this.check()}invert(){return Qr(this,this),this.check()}multiplyLeft(t){return Ne(this,t,this),this.check()}multiplyRight(t){return Ne(this,this,t),this.check()}rotateX(t){return sn(this,this,t),this.check()}rotateY(t){return on(this,this,t),this.check()}rotateZ(t){return an(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return nn(this,this,t,r),this.check()}scale(t){return rn(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return en(this,this,t),this.check()}transform(t,r){return t.length===4?(r=Mn(r||[-0,-0,-0,-0],t,this),Wt(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,s;switch(n){case 2:s=Fr(r||[-0,-0],t,this);break;case 3:s=Ht(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Wt(s,t.length),s}transformAsVector(t,r){let n;switch(t.length){case 2:n=Ur(r||[-0,-0],t,this);break;case 3:n=jt(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Wt(n,t.length),n}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}}});function yn(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function qe(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function Fe(e,t,r){let n=t[0],s=t[1],i=t[2],o=t[3],a=r[0],c=r[1],l=r[2],h=r[3];return e[0]=n*h+o*a+s*l-i*c,e[1]=s*h+o*c+i*a-n*l,e[2]=i*h+o*l+n*c-s*a,e[3]=o*h-n*a-s*c-i*l,e}function Cn(e,t,r){r*=.5;let n=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+o*a,e[1]=s*c+i*a,e[2]=i*c-s*a,e[3]=o*c-n*a,e}function wn(e,t,r){r*=.5;let n=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-i*a,e[1]=s*c+o*a,e[2]=i*c+n*a,e[3]=o*c-s*a,e}function On(e,t,r){r*=.5;let n=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=s*c-n*a,e[2]=i*c+o*a,e[3]=o*c-i*a,e}function An(e,t){let r=t[0],n=t[1],s=t[2];return e[0]=r,e[1]=n,e[2]=s,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),e}function In(e,t,r,n){let s=t[0],i=t[1],o=t[2],a=t[3],c=r[0],l=r[1],h=r[2],f=r[3],u,d,m,p,g;return u=s*c+i*l+o*h+a*f,u<0&&(u=-u,c=-c,l=-l,h=-h,f=-f),1-u>1e-6?(d=Math.acos(u),g=Math.sin(d),m=Math.sin((1-n)*d)/g,p=Math.sin(n*d)/g):(m=1-n,p=n),e[0]=m*s+p*c,e[1]=m*i+p*l,e[2]=m*o+p*h,e[3]=m*a+p*f,e}function bn(e,t){let r=t[0],n=t[1],s=t[2],i=t[3],o=r*r+n*n+s*s+i*i,a=o?1/o:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-s*a,e[3]=i*a,e}function Nn(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Pn(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;n=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*n,n=.5/n,e[3]=(t[i*3+o]-t[o*3+i])*n,e[i]=(t[i*3+s]+t[s*3+i])*n,e[o]=(t[o*3+s]+t[s*3+o])*n}return e}var Ln,vn,zn,Dn,qn,Fn,Ao,kn,Un=C(()=>{_t();Le();Ln=mn,vn=pn,zn=Sn,Dn=_n,qn=xn,Fn=gn,Ao=Tn,kn=(function(){let e=Gr(),t=Ie(1,0,0),r=Ie(0,1,0);return function(n,s,i){let o=St(s,i);return o<-.999999?(ht(e,t,s),Kr(e)<1e-6&&ht(e,r,s),Vr(e,e),qe(n,e,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(ht(e,s,i),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+o,Ao(n,n))}})()});var Mt,Bn=C(()=>{Vt();lt();Un();Mt=class extends et{constructor(t=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,s){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Pn(this,t),this.check()}fromEuler(t){switch(this.identity(),t.order){case"xyz":return this.rotateX(t.x).rotateY(t.y).rotateZ(t.z);case"yxz":return this.rotateY(t.y).rotateX(t.x).rotateZ(t.z);case"zxy":return this.rotateZ(t.z).rotateX(t.x).rotateY(t.y);case"zyx":return this.rotateZ(t.z).rotateY(t.y).rotateX(t.x);case"yzx":return this.rotateY(t.y).rotateZ(t.z).rotateX(t.x);case"xzy":return this.rotateX(t.x).rotateZ(t.z).rotateY(t.y);default:throw new Error("Unknown Euler angle order")}}fromAxisRotation(t,r){return qe(this,t,r),this.check()}identity(){return yn(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=v(t)}get y(){return this[1]}set y(t){this[1]=v(t)}get z(){return this[2]}set z(t){this[2]=v(t)}get w(){return this[3]}set w(t){this[3]=v(t)}len(){return qn(this)}lengthSquared(){return Fn(this)}dot(t){return zn(this,t)}rotationTo(t,r){return kn(this,t,r),this.check()}add(t){return Ln(this,this,t),this.check()}calculateW(){return An(this,this),this.check()}conjugate(){return Nn(this,this),this.check()}invert(){return bn(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(Dn(this,t,r,n),this.check())}multiplyRight(t){return Fe(this,this,t),this.check()}multiplyLeft(t){return Fe(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return Cn(this,this,t),this.check()}rotateY(t){return wn(this,this,t),this.check()}rotateZ(t){return On(this,this,t),this.check()}scale(t){return vn(this,this,t),this.check()}slerp(t,r,n){let s,i,o;return arguments.length===2?(s=this,i=t,o=r):(s=t,i=r,o=n),In(this,s,i,o),this.check()}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}});var B=C(()=>{Xr();Rn();Bn();Pr();we();ct()});function Vn(e,t,r=e){let n=e.x,s=e.y,i=e.z,{semiMajorAxis:o,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.sin(s),h=Math.cos(s),f=a/o,u=c<.9?o/Math.sqrt(1-c*l*l):o/Math.hypot(h,f*l),d=(u+i)*h*Math.cos(n),m=(u+i)*h*Math.sin(n),p=(u*(c<.9?1-c:f*f)+i)*l;return nt(r,d,m,p)}function Wn(e,t,r=e){let n=e.x,s=e.y,i=e.z,{semiMajorAxis:o,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.hypot(n,s),h=Math.hypot(n,s,i);if(!(h>0)||!Number.isFinite(h))return!1;if(c===0)return nt(r,l===0?0:Math.atan2(s,n),Math.atan2(i,l),h-o);if(l===0)return nt(r,0,Math.sign(i)*Math.PI/2,Math.abs(i)-a);let f=l/o,u=i/a;if(f*f+u*u<1-16*Number.EPSILON)return Io(n,s,i,l,o,a,r);if(c>=.9)return Gn(n,s,i,l,o,a,r);let d=i/h,m=l/h,p=1/Math.sqrt(1-c*(2-c)*m*m),g=m*(1-c)*p,T=d*p;for(let R=0;R<30;R++){let _=o/Math.sqrt(1-c*T*T),M=l*g+i*T-_*(1-c*T*T),S=c*_/(_+M);p=1/Math.sqrt(1-S*(2-S)*m*m);let E=m*(1-S)*p,O=d*p;if(Math.abs(O*g-E*T)<=1e-12){if(!Number.isFinite(M)||!Number.isFinite(O)||!Number.isFinite(E))break;return nt(r,Math.atan2(s,n),Math.atan2(O,Math.abs(E)),M)}g=E,T=O}return Gn(n,s,i,l,o,a,r)}function Io(e,t,r,n,s,i,o){let a=i/s,c=a*a,l=n/s,h=r/s,f=1-c;if(!(c>0)||a>1)return!1;if(r===0)return l<f?!1:nt(o,Math.atan2(t,e),0,n-s);let u=s*s,d=i*i,m=Number.isFinite(u)&&u>0?(d-c*u+rt(i,i,d)-c*rt(s,s,u)-rt(c,u,c*u))/u:0,p=n*n,g=e*e,T=t*t,R=g+T,_=Number.isFinite(p)&&p>0?(R-p+ke(g,T,R)+rt(e,e,g)+rt(t,t,T)-rt(n,n,p))/(2*n):0,M=s*c,S=n-s+M,E=_+ke(n-s,M,S)+rt(s,c,M)+s*m,O=Math.abs(h)*a;if(!(O>0))return!1;let I=0,w=c,y=Math.max(O,l-f);y>I&&y<w||(y=w/2);for(let b=0;b<128;b++){let N=f+y,P=l/N,A=O/y,q=s*y,$=S-q,Lt=($+(ke(S,-q,$)+E-rt(s,y,q)))/(s*N)*(P+1),mt=Lt+A*A;if(Math.abs(mt)<=4*Number.EPSILON*(Math.abs(Lt)+A*A)||w-I<=4*Number.EPSILON*y){let Z=Math.atan2(h/y,l/N),ur=Math.sin(Z),dr=Math.cos(Z);return nt(o,Math.atan2(t,e),Z,n*dr+r*ur-s*Math.hypot(dr,a*ur))}mt>0?I=y:w=y;let hr=-2*(P*P/N+A*A/y),Q=y-mt/hr,fr=Number.isFinite(Q)&&Q>I&&Q<w?Q:I+(w-I)/2;if(fr===y){let Z=Math.atan2(h/y,l/N);return nt(o,Math.atan2(t,e),Z,n*Math.cos(Z)+r*Math.sin(Z)-s*Math.hypot(Math.cos(Z),a*Math.sin(Z)))}y=fr}return!1}function ke(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function rt(e,t,r){let n=134217729*e,s=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(s))return 0;let i=n-(n-e),o=s-(s-t),a=e-i,c=t-o;return i*o-r+i*c+a*o+a*c}function Gn(e,t,r,n,s,i,o){let a=i/s,c=a*a,l=n/s,h=r/s,f=Math.hypot(l,r/i);if(!Number.isFinite(f)||f<1-8*Number.EPSILON||!(c>0))return!1;let u=0,d=Math.hypot(l,h*a);if(!Number.isFinite(d))return!1;let m=f<=1+8*Number.EPSILON?0:d/2;for(let p=0;p<96;p++){let g=1+m,T=c+m,R=l/g,_=h*a/T,M=Math.hypot(R,_),S=M-1;if(Math.abs(S)<=4*Number.EPSILON){let I=Math.atan2(h/T,l/g),w=Math.sin(I),y=Math.cos(I),b=n*y+r*w-s*Math.hypot(y,a*w);return nt(o,Math.atan2(t,e),I,b)}S>0?u=m:d=m;let E=-(R*R/g+_*_/T)/M,O=m-S/E;m=Number.isFinite(O)&&O>u&&O<d?O:(u+d)/2}return!1}function nt(e,t,r,n){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)?!1:(e.x=t,e.y=r,e.z=n,!0)}var Yn=C(()=>{});var $n=C(()=>{_t()});var X,Hc,Zn=C(()=>{X=6356752314245179e-9,Hc={radii:[6378137,6378137,X],radiiSquared:[6378137*6378137,6378137*6378137,X*X],oneOverRadii:[1/6378137,1/6378137,1/X],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(X*X)],maximumRadius:Math.max(6378137,6378137,X),centerToleranceSquared:.1}});function Ue(e){return e}function No(e,t=[],r=Ue){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function Be(e,t=[]){return No(e,t,L._cartographicRadians?Ue:Re)}function Ge(e,t,r,n){let s=L._cartographicRadians?Ue:ye,i=s(e),o=s(t);return"longitude"in n?(n.longitude=i,n.latitude=o,n.height=r):"x"in n?(n.x=i,n.y=o,n.z=r):(n[0]=i,n[1]=o,n[2]=r),n}var Jc,jn=C(()=>{B();Jc=new x});function Hn(){return{eastX:0,eastY:1,northZ:1,upX:1,upY:0,upZ:0}}function Kn(e,t,r){let n=e.x,s=e.y,i=e.z,o=t.x,a=t.y,c=t.z;return i!==0?!1:Po(r,n,s,o*s-a*n,o,a,c)}function Xn(e,t,r,n,s,i){let o=Ve(r),a=Ve(n),c=Ve(s),l=Math.abs(o),h=Math.abs(a),f=Math.abs(c);if(!l||!h||!f||l===h||l===f||h===f||(l%3+1===h?1:-1)*Math.sign(o*a*c)!==1||!Array.isArray(i)&&i.length<16)return!1;let d=e.eastX,m=e.eastY,p=e.northZ,g=e.upX,T=e.upY,R=e.upZ,_=-R*m,M=R*d,S=t.x,E=t.y,O=t.z,I=(l===1?d:l===2?_:g)*Math.sign(o),w=(l===1?m:l===2?M:T)*Math.sign(o),y=(l===1?0:l===2?p:R)*Math.sign(o),b=(h===1?d:h===2?_:g)*Math.sign(a),N=(h===1?m:h===2?M:T)*Math.sign(a),P=(h===1?0:h===2?p:R)*Math.sign(a),A=(f===1?d:f===2?_:g)*Math.sign(c),q=(f===1?m:f===2?M:T)*Math.sign(c),$=(f===1?0:f===2?p:R)*Math.sign(c);return!Number.isFinite(I)||!Number.isFinite(w)||!Number.isFinite(y)||!Number.isFinite(b)||!Number.isFinite(N)||!Number.isFinite(P)||!Number.isFinite(A)||!Number.isFinite(q)||!Number.isFinite($)||!Number.isFinite(S)||!Number.isFinite(E)||!Number.isFinite(O)||i instanceof Float32Array&&(!Number.isFinite(Math.fround(I))||!Number.isFinite(Math.fround(w))||!Number.isFinite(Math.fround(y))||!Number.isFinite(Math.fround(b))||!Number.isFinite(Math.fround(N))||!Number.isFinite(Math.fround(P))||!Number.isFinite(Math.fround(A))||!Number.isFinite(Math.fround(q))||!Number.isFinite(Math.fround($))||!Number.isFinite(Math.fround(S))||!Number.isFinite(Math.fround(E))||!Number.isFinite(Math.fround(O)))?!1:(i[0]=I,i[1]=w,i[2]=y,i[3]=0,i[4]=b,i[5]=N,i[6]=P,i[7]=0,i[8]=A,i[9]=q,i[10]=$,i[11]=0,i[12]=S,i[13]=E,i[14]=O,i[15]=1,!0)}function Ve(e){switch(e){case"east":return 1;case"west":return-1;case"north":return 2;case"south":return-2;case"up":return 3;case"down":return-3;default:return 0}}function Po(e,t,r,n,s,i,o){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(i)||!Number.isFinite(o)?!1:(e.eastX=t,e.eastY=r,e.northZ=n,e.upX=s,e.upY=i,e.upZ=o,!0)}var Jn=C(()=>{});function Ye(e,t,r,n,s,i){let o=es[t]&&es[t][r];D(o&&(!n||n===o));let a,c,l,h=Lo.copy(s),f=U(h.x,0,Qn)&&U(h.y,0,Qn),u=e.radii;if(u.x===u.y&&u.x>0&&u.z>0&&u.z<=u.x&&(!f||h.z!==0)){let{east:w,up:y}=ft;if(f?(w.set(0,1,0),y.set(0,0,Math.sign(h.z))):(w.set(-h.y,h.x,0).normalize(),e.geodeticSurfaceNormal(h,y)),!Kn(w,y,ts)||!Xn(ts,h,t,r,n,i))throw new Error("Unsupported local frame");return i}if(f){let w=Math.sign(h.z);a=vo.fromArray(We[t]),t!=="east"&&t!=="west"&&a.scale(w),c=zo.fromArray(We[r]),r!=="east"&&r!=="west"&&c.scale(w),l=Do.fromArray(We[n]),n!=="east"&&n!=="west"&&l.scale(w)}else{let{up:w,east:y,north:b}=ft;y.set(-h.y,h.x,0).normalize(),e.geodeticSurfaceNormal(h,w),b.copy(w).cross(y);let{down:N,west:P,south:A}=ft;N.copy(w).scale(-1),P.copy(y).scale(-1),A.copy(b).scale(-1),a=ft[t],c=ft[r],l=ft[n]}let d=a.x,m=a.y,p=a.z,g=c.x,T=c.y,R=c.z,_=l.x,M=l.y,S=l.z,E=h.x,O=h.y,I=h.z;return i[0]=d,i[1]=m,i[2]=p,i[3]=0,i[4]=g,i[5]=T,i[6]=R,i[7]=0,i[8]=_,i[9]=M,i[10]=S,i[11]=0,i[12]=E,i[13]=O,i[14]=I,i[15]=1,i}var Qn,Lo,ts,es,We,ft,vo,zo,Do,rs=C(()=>{B();Jn();Qn=1e-14,Lo=new x,ts=Hn(),es={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},We={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},ft={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},vo=new x,zo=new x,Do=new x});function ss(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:i}=t,o=e,a="x"in e?o.x:e[0],c="x"in e?o.y:e[1],l="x"in e?o.z:e[2];if(!Number.isFinite(a)||!Number.isFinite(c)||!Number.isFinite(l))return;ns.set(a,c,l);let h=n.x,f=n.y,u=n.z,d=a*a*h*h,m=c*c*f*f,p=l*l*u*u,g=d+m+p,T=Math.sqrt(1/g);if(!Number.isFinite(T)||!Number.isFinite(g))return;let R=qo;if(R.set(a,c,l).scale(T),g<i)return Qt(r,R.x,R.y,R.z);let _=s.x,M=s.y,S=s.z,E=Fo;E.set(R.x*_*2,R.y*M*2,R.z*S*2);let O=(1-T)*ns.len()/(.5*E.len()),I=0,w,y,b,N;for(let P=0;P<64;P++){O-=I,w=1/(1+O*_),y=1/(1+O*M),b=1/(1+O*S);let A=w*w,q=y*y,$=b*b,lr=A*w,Lt=q*y,mt=$*b;if(N=d*A+m*q+p*$-1,!Number.isFinite(N))return;if(Math.abs(N)<=K.EPSILON12)return Qt(r,a*w,c*y,l*b);let Q=-2*(d*lr*_+m*Lt*M+p*mt*S);if(!Number.isFinite(Q)||Q===0||(I=N/Q,!Number.isFinite(I)))return}}function Qt(e,t,r,n){if(Y(e))e[0]=t,e[1]=r,e[2]=n;else{let s=e;s.x=t,s.y=r,s.z=n}return e}var ns,qo,Fo,is=C(()=>{B();ns=new x,qo=new x,Fo=new x});function as(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0||t>e)throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis")}var F,te,os,Bo,V,Go,Et,k,cs=C(()=>{B();Yn();$n();Zn();jn();rs();is();F={x:0,y:0,z:0},te=new x,os=new x,Bo=new x,V=new x,Go=new x,Et=new x,k=class e{static fromSpheroid(t){let{semiMajorAxis:r,semiMinorAxis:n}=t;return as(r,n),new e(r,r,n)}constructor(t=0,r=0,n=0){this.centerToleranceSquared=K.EPSILON1,D(t>=0),D(r>=0),D(n>=0),this.radii=new x(t,r,n),this.radiiSquared=new x(t*t,r*r,n*n),this.radiiToTheFourth=new x(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new x(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new x(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),t===r&&n>0&&n<=t&&Number.isFinite(this.radiiSquared.x)&&this.radiiSquared.z>0&&(this.spheroidGeometry=Object.freeze({semiMajorAxis:t,semiMinorAxis:n,eccentricitySquared:1-this.radiiSquared.z/this.radiiSquared.x})),Object.freeze(this)}toSpheroid(){let{x:t,y:r,z:n}=this.radii;if(t!==r)throw new Error("Spheroid requires equal X/Y radii");return as(t,n),Object.freeze({semiMajorAxis:t,semiMinorAxis:n})}equals(t){return this===t||!!(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){if(this.spheroidGeometry){let a=Be(t,Et);return F.x=a[0],F.y=a[1],F.z=a[2],Vn(F,this.spheroidGeometry)?Qt(r,F.x,F.y,F.z):void 0}let n=os,s=Bo,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,n),s.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(s));return s.scale(1/o),n.scale(i),s.add(n),s.to(r)}cartesianToCartographic(t,r=[0,0,0]){let n=t,s="x"in t?n.x:t[0],i="x"in t?n.y:t[1],o="x"in t?n.z:t[2];if(!Number.isFinite(s)||!Number.isFinite(i)||!Number.isFinite(o))return;if(this.spheroidGeometry&&Number.isFinite(s*s+i*i+o*o)&&Number.isFinite(this.oneOverRadiiSquared.x)&&Number.isFinite(this.oneOverRadiiSquared.z)){if(F.x=s,F.y=i,F.z=o,!Wn(F,this.spheroidGeometry))return;let d=s===0&&i===0?Math.atan2(i,s):F.x;return Ge(d,F.y,F.z,r)}Et.set(s,i,o);let a=this.scaleToGeodeticSurface(Et,V);if(!a)return;let c=this.geodeticSurfaceNormal(a,os),l=Go;l.copy(Et).subtract(a);let h=Math.atan2(c.y,c.x),f=Math.atan2(c.z,Math.hypot(c.x,c.y)),u=Math.sign(St(l,Et))*Ae(l);return Ge(h,f,u,r)}eastNorthUpToFixedFrame(t,r=new z){return Ye(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,s,i=new z){return Ye(this,t,r,n,s,i)}geocentricSurfaceNormal(t,r=[0,0,0]){return te.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=Be(t),s=n[0],i=n[1],o=Math.cos(i);return te.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),te.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return te.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return ss(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){V.from(t);let n=V.x,s=V.y,i=V.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*o.x+s*s*o.y+i*i*o.z);return V.multiplyByScalar(a).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return V.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return V.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){D(U(this.radii.x,this.radii.y,K.EPSILON15)),D(this.radii.z>0),V.from(t);let s=V.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return V.set(0,0,s).to(n)}};k.WGS84=new k(6378137,6378137,X)});var ls=C(()=>{Pe()});var Rt,hs,yt,fs=C(()=>{B();ls();Rt=new x,hs=new x,yt=class e{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new x,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=Rt.from(r),this.center=new x().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,n=this.radius,s=t.center,i=t.radius,o=Rt.copy(s).subtract(r),a=o.magnitude();if(n>=a+i)return this.clone();if(i>=a+n)return t.clone();let c=(n+a+i)*.5;return hs.copy(o).scale((-n+c)/a).add(r),this.center.copy(hs),this.radius=c,this}expand(t){let n=Rt.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=cn(Rt,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=Rt.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,i=t.normal.dot(r)+t.distance;return i<-n?"outside":i<n?"intersecting":"inside"}}});var us,ds,G,$e=C(()=>{B();us=new x,ds=new x,G=class e{constructor(t=[0,0,1],r=0){this.normal=new x,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return D(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=us.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,s){return this.normal.set(t,r,n),D(U(this.normal.len(),1)),this.distance=s,this}clone(){return new e(this.normal,this.distance)}equals(t){return U(this.distance,t.distance)&&U(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=ds.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=us.from(t),s=this.getPointDistance(n),i=ds.copy(this.normal).scale(s);return n.subtract(i).to(r)}intersectWithRay(t,r=new x){let n=t.origin,s=t.direction,i=this.normal,o=i.dot(s);if(Math.abs(o)<K.EPSILON15)return;let a=(-this.distance-i.dot(n))/o;if(!(a<0))return r.copy(s).multiplyByScalar(a).add(n)}}});var ms,ps,Wo,st,xs=C(()=>{B();$e();ms=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],ps=new x,Wo=new x,st=class e{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*ms.length;let r=t.center,n=t.radius,s=0;for(let i of ms){let o=this.planes[s],a=this.planes[s+1];o||(o=this.planes[s]=new G),a||(a=this.planes[s+1]=new G);let c=ps.copy(i).scale(-n).add(r);o.fromPointNormal(c,i);let l=ps.copy(i).scale(n).add(r),h=Wo.copy(i).negate();a.fromPointNormal(l,h),s+=2}return this}computeVisibility(t){let r="inside";for(let n of this.planes)switch(t.intersectPlane(n)){case"outside":return"outside";case"intersecting":r="intersecting";break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(D(Number.isFinite(r),"parentPlaneMask is required."),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let n=e.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&(r&o)===0)continue;let a=s[i],c=t.intersectPlane(a);if(c==="outside")return e.MASK_OUTSIDE;c==="intersecting"&&(n|=o)}return n}};st.MASK_OUTSIDE=4294967295;st.MASK_INSIDE=0;st.MASK_INDETERMINATE=2147483647});var Ze=C(()=>{fs();xs();$e()});var gs=C(()=>{cs()});var Ts=C(()=>{});function He(e){Yo(e)}function Yo(e){if(typeof e.id!="string"||!e.id||e.origin.length!==2||e.tileSize.length!==2||e.matrixSize.length!==2||!Number.isFinite(e.resolution)||e.resolution<=0||e.resolutionY!==void 0&&(!Number.isFinite(e.resolutionY)||e.resolutionY<=0)||!e.origin.every(Number.isFinite)||![...e.tileSize,...e.matrixSize].every(n=>Number.isSafeInteger(n)&&n>0)||!["topLeft","bottomLeft"].includes(e.cornerOfOrigin))throw new RangeError("Invalid tile matrix geometry");let t=[...e.variableMatrixWidths??[]].sort((n,s)=>n.minTileRow-s.minTileRow),r=-1;for(let n of t){if(!Number.isSafeInteger(n.coalesce)||n.coalesce<=1||e.matrixSize[0]%n.coalesce!==0||!Number.isSafeInteger(n.minTileRow)||!Number.isSafeInteger(n.maxTileRow)||n.minTileRow<=r||n.maxTileRow<n.minTileRow||n.maxTileRow>=e.matrixSize[1])throw new RangeError("Invalid variable matrix width");r=n.maxTileRow}for(let n=0;n<2;n++){let i=(n===1?e.resolutionY??e.resolution:e.resolution)*e.tileSize[n],o=i*e.matrixSize[n],a=n===1&&e.cornerOfOrigin==="topLeft"?-1:1,c=e.origin[n]+a*o;if(!Number.isFinite(o)||o<=0||!Number.isFinite(c)||e.origin[n]+a*i===e.origin[n]||c-a*i===c)throw new RangeError("Tile matrix extent must be finite")}return t}function Ke(e,t,r,n){return He(e),n&&Ms(e,n),Number.isSafeInteger(t)&&Number.isSafeInteger(r)&&t>=0&&r>=0&&t<e.matrixSize[0]&&r<e.matrixSize[1]&&(!n||t>=n.minTileColumn&&t<=n.maxTileColumn&&r>=n.minTileRow&&r<=n.maxTileRow)}function _s(e,t,r){if(!Ke(e,t,r))throw new RangeError("Tile index outside matrix");let n=e.resolution*e.tileSize[0],s=(e.resolutionY??e.resolution)*e.tileSize[1],i=Ho(e,r),o=Math.floor(t/i)*i,a=e.origin[0]+o*n,c=e.cornerOfOrigin==="topLeft"?e.origin[1]-(r+1)*s:e.origin[1]+r*s;return[a,c,e.origin[0]+(o+i)*n,e.cornerOfOrigin==="topLeft"?e.origin[1]-r*s:e.origin[1]+(r+1)*s]}function $o(e,t,r,n,s,i=1){let o=e+t*(n*r);return(t===1?s<e||s>=o:s>e||s<=o)?null:(je(e,t,r,n,s,!1,i)-1)*i}function je(e,t,r,n,s,i,o=1){let a=0,c=n/o;for(;a<c;){let l=a+Math.floor((c-a)/2),h=e+t*(l*o*r);(t===1?i?h<s:h<=s:i?h>s:h>=s)?a=l+1:c=l}return a}function Ms(e,t){if(![t.minTileColumn,t.maxTileColumn,t.minTileRow,t.maxTileRow].every(n=>Number.isSafeInteger(n)&&n>=0)||t.minTileColumn>t.maxTileColumn||t.minTileRow>t.maxTileRow||t.maxTileColumn>=e.matrixSize[0]||t.maxTileRow>=e.matrixSize[1])throw new RangeError("Invalid tile matrix limits")}function Zo(e,t,r){jo(t);let n=Ss(e.origin[0],1,e.resolution*e.tileSize[0],e.matrixSize[0],t[0],t[2]),s=e.cornerOfOrigin==="topLeft",i=Ss(e.origin[1],s?-1:1,(e.resolutionY??e.resolution)*e.tileSize[1],e.matrixSize[1],s?t[3]:t[1],s?t[1]:t[3]);if(!n||!i)return null;let o={minTileColumn:Math.max(n[0],r?.minTileColumn??0),maxTileColumn:Math.min(n[1],r?.maxTileColumn??e.matrixSize[0]-1),minTileRow:Math.max(i[0],r?.minTileRow??0),maxTileRow:Math.min(i[1],r?.maxTileRow??e.matrixSize[1]-1)};return o.minTileColumn>o.maxTileColumn||o.minTileRow>o.maxTileRow?null:o}function jo(e){if(e.length!==4||!e.every(Number.isFinite)||e[0]>e[2]||e[1]>e[3])throw new RangeError("Tile query bounds must be finite and ordered")}function Es(e,t,r){if(He(e),e.variableMatrixWidths?.length)throw new RangeError("Use getTileRanges for variable-width matrices");return r&&Ms(e,r),Zo(e,t,r)}function Ho(e,t){return e.variableMatrixWidths?.find(r=>t>=r.minTileRow&&t<=r.maxTileRow)?.coalesce??1}function Ss(e,t,r,n,s,i,o=1){if(s===i){let h=$o(e,t,r,n,s,o);return h===null?null:[h,h]}let a=e+t*(n*r),c=t===1?Math.max(s,e):Math.min(s,e),l=t===1?Math.min(i,a):Math.max(i,a);return(t===1?c>=l:c<=l)?null:[(je(e,t,r,n,c,!1,o)-1)*o,(je(e,t,r,n,l,!0,o)-1)*o]}function Rs(e,t){if(!Number.isFinite(t)||t<=0)throw new RangeError("Target resolution must be positive and finite");let r=null,n=null,s=-1/0,i=1/0,o=new Set;for(let a of e.matrices){if(He(a),o.has(a.id))throw new RangeError("Tile matrix identifiers must be unique");o.add(a.id);let c=Math.max(a.resolution,a.resolutionY??a.resolution);(!n||c<i)&&(n=a,i=c),c<=t&&(!r||c>s)&&(r=a,s=c)}return r??n}var ys=C(()=>{});var Cs=C(()=>{});var ee=C(()=>{gs();Ts();Cs()});var Ct=C(()=>{"use strict";gr();Sr();Mr()});var Pt={};mr(Pt,{ImageSet:()=>ie,LOD_METRIC_TYPE:()=>bt,RasterSet:()=>oe,STRATEGY_DEFAULT:()=>dt,STRATEGY_NEVER:()=>re,STRATEGY_REPLACE:()=>ne,SharedTile2DHeader:()=>tt,TILESET_TYPE:()=>J,TILE_TYPE:()=>It,Tileset2D:()=>ut,Tileset3D:()=>Nt,selectTileMatrixTiles:()=>si});Dt(Pt,fi(xr(),1));var tt=class{index;parent;children;content;error;id;zoom;userData;boundingBox;_abortController;_loader;_loaderId;_isLoaded;_isCancelled;_needsReload;_bbox;constructor(t){this.index=t,this.parent=null,this.children=[],this.content=null,this.error=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){let t=this._loader;return!this._isCancelled&&t!==void 0?t.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get hasError(){return!!this.error}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)?t:0}async _loadData({getData:t,requestScheduler:r,onLoad:n,onError:s}){let i=(g,T,R)=>{if(!(R!==this._loaderId||this._isCancelled)){if(this._loader=void 0,this.content=g,this.error=T?di(T):null,this._isLoaded=!0,this._isCancelled=!1,T){s(T,this);return}n(this)}},{index:o,id:a,bbox:c,userData:l,zoom:h}=this,f=this._loaderId;this._abortController=new AbortController;let{signal:u}=this._abortController,d=await r.scheduleRequest({tile:this,loaderId:f},()=>f===this._loaderId&&!this._isCancelled?1:-1);if(this._isCancelled||f!==this._loaderId){d?.done();return}if(!d){this._isCancelled=!0;return}let m=null,p;try{m=await t({index:o,id:a,bbox:c,userData:l,zoom:h,signal:u})}catch(g){p=g||!0}finally{d.done()}i(m,p,f)}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this.error=null,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._loaderId++,this._loader=void 0,this._abortController?.abort())}};function di(e){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error("Tile request failed")}Ct();Ft();var re="never",ne="no-overlap",dt="best-available",ws={adapter:null,extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:100,maxCacheByteSize:null,refinementStrategy:dt,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},tileSource:null},ut=class e{stats;sourceMetadata=null;opts;_requestScheduler;_cache;_dirty;_tiles;_cacheByteSize;_unloadedTileCount;_listeners=new Set;_consumers=new Map;_explicitOptionKeys=new Set;_baseOpts={};_sourceMetadataOverrides={};_maxZoom;_minZoom;_lastTileContext=null;_statsUpdateScheduled=!1;_lifecycleVersion=0;constructor(t){if(this.stats=new W({id:"Tileset2D",stats:[{name:"Tiles In Cache"},{name:"Cache Size"},{name:"Visible Tiles"},{name:"Selected Tiles"},{name:"Loading Tiles"},{name:"Unloaded Tiles"},{name:"Consumers"}]}),this.opts={...ws,...t,getTileData:t.getTileData||(()=>null),tileSource:t.tileSource},this._requestScheduler=new j({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._unloadedTileCount=0,!this.opts.tileSource&&!t.getTileData)throw new Error("Tileset2D requires either `getTileData` or `tileSource`.");this.setOptions(t),this._updateStats(),this.opts.tileSource&&this._initializeTileSource(this.opts.tileSource).catch(()=>{})}static fromTileSource(t,r={}){return new e({...r,tileSource:t})}get tiles(){return this._tiles}get cacheByteSize(){return this._cacheByteSize}get selectedTiles(){return Array.from(this._getSelectedTilesUnion())}get visibleTiles(){let t=this._getVisibleTilesUnion();for(let r of this._getSelectedTilesUnion())t.add(r);return Array.from(t)}get loadingTiles(){return Array.from(this._cache.values()).filter(t=>t.isLoading)}get unloadedTiles(){return Array.from(this._cache.values()).filter(t=>!t.isLoaded)}get maxZoom(){return this._maxZoom}get minZoom(){return this._minZoom}get refinementStrategy(){return this.opts.refinementStrategy||dt}get adapter(){return this.opts.adapter}subscribe(t){return this._listeners.add(t),()=>this._listeners.delete(t)}attachConsumer(t){this._consumers.set(t,{selectedTiles:new Set,visibleTiles:new Set}),this._updateStats()}detachConsumer(t){this._consumers.delete(t),this._pruneRequests(),this._resizeCache(),this._updateStats()}setOptions(t){this._rememberExplicitOptions(t),this._baseOpts={...this._baseOpts,...t};let r=this.opts.maxRequests,n=this.opts.debounceTime;this._applyResolvedOptions(),(r!==this.opts.maxRequests||n!==this.opts.debounceTime)&&(this._requestScheduler=new j({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}))}finalize(){this._lifecycleVersion++;for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._consumers.clear(),this._cacheByteSize=0,this._unloadedTileCount=0,this._updateStats()}reloadAll(){let t=this._getSelectedTilesUnion(),r=this._getVisibleTilesUnion();for(let n of this._cache.keys()){let s=this._cache.get(n);s&&!t.has(s)&&!r.has(s)?(this._cache.delete(n),this._handleTileUnload(s),this._dirty=!0):s&&s.setNeedsReload()}this._cacheByteSize=this._getCacheByteSize(),this.prepareTiles(),this._updateStats()}updateConsumer(t,r,n){this._consumers.set(t,{selectedTiles:new Set(r),visibleTiles:new Set(n)}),this._pruneRequests(),this._resizeCache(),this._updateStats()}prepareTiles(){this._dirty&&(this._rebuildTree(),this._syncTiles(),this._dirty=!1)}getTileIndices({viewState:t,maxZoom:r,minZoom:n,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{adapter:a,tileSize:c,extent:l,zoomOffset:h}=this.opts;if(!a)throw new Error("Tileset2D requires an adapter before tile traversal can be used.");return this._lastTileContext={viewState:t,tileSize:c},a.getTileIndices({viewState:t,maxZoom:r,minZoom:n,zRange:s,tileSize:c,extent:Ko(l),modelMatrix:i,modelMatrixInverse:o,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){if(!this._lastTileContext)throw new Error("Tileset2D metadata requested before traversal context was set.");if(!this.opts.adapter)throw new Error("Tileset2D requires an adapter before tile metadata can be derived.");return{bbox:this.opts.adapter.getTileBoundingBox(this._lastTileContext,t)}}getParentIndex(t){return{x:Math.floor(t.x/2),y:Math.floor(t.y/2),z:t.z-1}}getTile(t,r){let n=this.getTileId(t),s=this._cache.get(n),i=!1;if(!s&&r?(s=new tt(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:n,zoom:this.getTileZoom(s.index)}),i=!0,this._cache.set(n,s),this._dirty=!0,this._setStatCount("Tiles In Cache",this._cache.size),this._scheduleStatsUpdate()):s&&s.needsReload&&(i=!0),s&&this._touchTile(n,s),s&&i&&r){let o=s.isLoading;s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this._handleTileLoad.bind(this),onError:this._handleTileError.bind(this)}).catch(()=>{}),o||this.stats.get("Loading Tiles").incrementCount(),this._scheduleStatsUpdate()}return s}async _initializeTileSource(t){let r=this._lifecycleVersion;try{let n=await t.getMetadata();if(r!==this._lifecycleVersion)return;this.sourceMetadata=n,this._sourceMetadataOverrides=this._getMetadataOverrides(this.sourceMetadata),this._applyResolvedOptions(),this._notifyUpdate()}catch(n){if(r!==this._lifecycleVersion)return;let s=n instanceof Error?n:new Error(`TileSource metadata error: ${String(n)}`);this._notifyError(s)}}_rememberExplicitOptions(t){for(let r of Object.keys(t))this._explicitOptionKeys.add(r)}_applyResolvedOptions(){let t={...ws,...this._sourceMetadataOverrides,...this._baseOpts};if(t.tileSource){let r=t.tileSource;t.getTileData=n=>r.getTileData(n)}this.opts=t,this._maxZoom=typeof this.opts.maxZoom=="number"&&Number.isFinite(this.opts.maxZoom)?Math.floor(this.opts.maxZoom):void 0,this._minZoom=typeof this.opts.minZoom=="number"&&Number.isFinite(this.opts.minZoom)?Math.ceil(this.opts.minZoom):void 0}_getMetadataOverrides(t){if(!t)return{};let r={};return!this._explicitOptionKeys.has("minZoom")&&Number.isFinite(t.minZoom)&&(r.minZoom=t.minZoom),!this._explicitOptionKeys.has("maxZoom")&&Number.isFinite(t.maxZoom)&&(r.maxZoom=t.maxZoom),!this._explicitOptionKeys.has("extent")&&t.boundingBox&&(r.extent=[t.boundingBox[0][0],t.boundingBox[0][1],t.boundingBox[1][0],t.boundingBox[1][1]]),r}_handleTileLoad(t){let r=this._lifecycleVersion;if(this._cache.get(t.id)===t&&(this.opts.onTileLoad?.(t),this._cache.get(t.id)===t)){this._cacheByteSize=this._getCacheByteSize(),this._resizeCache(),this._updateStats();for(let n of this._listeners){if(r!==this._lifecycleVersion)return;n.onTileLoad?.(t)}}}_handleTileError(t,r){let n=this._lifecycleVersion;if(this._cache.get(r.id)===r&&(this.opts.onTileError?.(t,r),this._cache.get(r.id)===r)){this._cacheByteSize=this._getCacheByteSize(),this._resizeCache(),this._updateStats();for(let s of this._listeners){if(n!==this._lifecycleVersion)return;s.onTileError?.(t,r)}}}_handleTileUnload(t){t.abort(),this._unloadedTileCount++,this.opts.onTileUnload?.(t);for(let r of this._listeners)r.onTileUnload?.(t)}_notifyUpdate(){for(let t of this._listeners)t.onUpdate?.()}_notifyError(t){for(let r of this._listeners)r.onError?.(t)}_scheduleStatsUpdate(){this._statsUpdateScheduled||(this._statsUpdateScheduled=!0,queueMicrotask(()=>{this._statsUpdateScheduled&&this._updateStats()}))}_updateStats(){this._statsUpdateScheduled=!1,this._setStatCount("Tiles In Cache",this._cache.size),this._setStatCount("Cache Size",this.cacheByteSize),this._setStatCount("Visible Tiles",this.visibleTiles.length),this._setStatCount("Selected Tiles",this.selectedTiles.length),this._setStatCount("Loading Tiles",this.loadingTiles.length),this._setStatCount("Unloaded Tiles",this._unloadedTileCount),this._setStatCount("Consumers",this._consumers.size);for(let t of this._listeners)t.onStatsChange?.(this.stats)}_setStatCount(t,r){this.stats.get(t).reset().addCount(r)}_getSelectedTilesUnion(){let t=new Set;for(let r of this._consumers.values())for(let n of r.selectedTiles)t.add(n);return t}_getVisibleTilesUnion(){let t=new Set;for(let r of this._consumers.values())for(let n of r.visibleTiles)t.add(n);return t}_touchTile(t,r){this._cache.delete(t),this._cache.set(t,r)}_getCacheByteSize(){let t=0;for(let r of this._cache.values())t+=r.byteLength;return t}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=this._getSelectedTilesUnion(),n=this._getVisibleTilesUnion(),s=[],i=0;for(let o of this._cache.values())o.isLoading&&(i++,!r.has(o)&&!n.has(o)&&s.push(o));for(;t>0&&i>t&&s.length>0;){let o=s.shift();o&&o.abort(),i--}}_rebuildTree(){for(let t of this._cache.values())t.parent=null,t.children&&(t.children.length=0);for(let t of this._cache.values()){let r=this._getNearestAncestor(t);t.parent=r,r?.children&&r.children.push(t)}}_syncTiles(){this._tiles=Array.from(this._cache.values()).sort((t,r)=>t.zoom-r.zoom)}_resizeCache(){let t=this.opts.maxCacheSize??100,r=this.opts.maxCacheByteSize??1/0,n=this._getVisibleTilesUnion(),s=this._getSelectedTilesUnion();if(this._cache.size>t||this._cacheByteSize>r){for(let[o,a]of this._cache)if(!n.has(a)&&!s.has(a)&&(this._cache.delete(o),this._cacheByteSize-=a.byteLength,this._handleTileUnload(a)),this._cache.size<=t&&this._cacheByteSize<=r)break;this._dirty=!0}this._dirty&&(this._rebuildTree(),this._syncTiles(),this._dirty=!1)}_getNearestAncestor(t){let{_minZoom:r=0}=this,n=t.index;for(;this.getTileZoom(n)>r;){n=this.getParentIndex(n);let s=this._cache.get(this.getTileId(n));if(s)return s}return null}};function Ko(e){return e&&e.length===4?e:void 0}var se={getMetadata:async()=>({name:"",keywords:[],layers:[]}),getImage:async()=>null,debounceTime:0},ie=class e{metadata=null;_opts;_listeners=new Set;_currentRequest=null;_lastAcceptedRequestId=-1;_nextRequestId=0;_loadCounter=0;_timeoutId=null;_abortController=null;_finalized=!1;constructor(t){if(this._opts=this._normalizeOptions(t),!this._opts.imageSource&&(!t.getImage||!t.getMetadata))throw new Error("ImageSet requires either `imageSource` or both `getImage` and `getMetadata`.")}static fromImageSource(t,r={}){return new e({...r,imageSource:t})}get isLoaded(){return this._loadCounter===0&&!!this._currentRequest}get image(){return this._currentRequest?.image||null}get currentRequest(){return this._currentRequest}get imageSource(){return this._opts.imageSource}subscribe(t){return this._listeners.add(t),()=>this._listeners.delete(t)}setOptions(t){let r=this._opts.imageSource,n=this._normalizeOptions({...this._opts,...t}),s=r!==n.imageSource||this._opts.getImage!==n.getImage||this._opts.getMetadata!==n.getMetadata;this._opts=n,s&&(this._cancelScheduledImage(),this.metadata=null,this._currentRequest=null,this._lastAcceptedRequestId=-1,this._nextRequestId=0,this._emitUpdate())}async loadMetadata(){this._startLoading();try{let t=await this._opts.getMetadata();if(this._finalized)return t;this.metadata=t;for(let r of this._listeners)r.onMetadataLoad?.(t);return this._emitUpdate(),t}catch(t){let r=Os(t,"Image metadata request failed");if(!this._finalized)for(let n of this._listeners)n.onMetadataLoadError?.(r);throw r}finally{this._finishLoading()}}requestImage(t,r=this._opts.debounceTime){let n=this._nextRequestId++;return this._cancelScheduledImage(),this._abortActiveRequest(),r>0?this._timeoutId=setTimeout(()=>{this._timeoutId=null,this._loadImage(n,t)},r):this._loadImage(n,t),n}finalize(){this._finalized=!0,this._cancelScheduledImage(),this._abortActiveRequest(),this._listeners.clear()}async _loadImage(t,r){if(!this._finalized){this._startLoading();for(let n of this._listeners)n.onImageLoadStart?.(t,r);try{let n=new AbortController;this._abortController=n;let s=await this._opts.getImage({...r,signal:n.signal});if(this._finalized||t<=this._lastAcceptedRequestId)return;this._lastAcceptedRequestId=t,this._currentRequest={requestId:t,parameters:r,image:s};for(let i of this._listeners)i.onImageLoad?.(this._currentRequest);this._emitUpdate()}catch(n){if(Xo(n))return;let s=Os(n,"Image request failed");if(!this._finalized)for(let i of this._listeners)i.onImageLoadError?.(t,s,r)}finally{this._abortController?.signal===r.signal&&(this._abortController=null),this._finishLoading()}}}_normalizeOptions(t){let r=t.imageSource||null;return{...se,...t,imageSource:r,getMetadata:t.getMetadata||(()=>r?r.getMetadata():se.getMetadata()),getImage:t.getImage||(n=>r?r.getImage(n):se.getImage(n)),debounceTime:t.debounceTime??se.debounceTime}}_emitUpdate(){for(let t of this._listeners)t.onUpdate?.()}_startLoading(){let t=this._loadCounter>0;this._loadCounter++,t||(this._emitLoadingStateChange(!0),this._emitUpdate())}_finishLoading(){let t=this._loadCounter>0;this._loadCounter=Math.max(0,this._loadCounter-1),t&&this._loadCounter===0&&(this._emitLoadingStateChange(!1),this._emitUpdate())}_emitLoadingStateChange(t){for(let r of this._listeners)r.onLoadingStateChange?.(t)}_cancelScheduledImage(){this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null)}_abortActiveRequest(){this._abortController?.abort(),this._abortController=null}};function Xo(e){return e instanceof Error&&e.name==="AbortError"}function Os(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}Ct();var wt={getMetadata:async()=>({width:0,height:0,bandCount:0,dtype:"uint8"}),getRaster:async()=>({data:new Uint8Array(0),width:0,height:0,bandCount:0,dtype:"uint8"}),debounceTime:0,shouldRefetch:()=>!0},oe=class e{metadata=null;_opts;_listeners=new Set;_currentRequest=null;_nextRequestId=0;_loadCounter=0;_timeoutId=null;_abortController=null;_metadataAbortController=null;_finalized=!1;_sourceGeneration=0;_metadataRequestId=0;constructor(t){if(this._opts=this._normalizeOptions(t),!this._opts.rasterSource&&(!t.getRaster||!t.getMetadata))throw new Error("RasterSet requires either `rasterSource` or both `getRaster` and `getMetadata`.")}static fromRasterSource(t,r={}){return new e({...r,rasterSource:t})}static fromCallbacks(t){return new e(t)}get isLoaded(){return this._loadCounter===0&&!!this._currentRequest}get raster(){return this._currentRequest?.raster||null}get currentRequest(){return this._currentRequest}get rasterSource(){return this._opts.rasterSource}subscribe(t){return this._listeners.add(t),()=>this._listeners.delete(t)}setOptions(t){let r=this._opts.rasterSource,n={...this._opts,...t};t.rasterSource&&t.rasterSource!==r&&(n.getRaster=t.getRaster,n.getMetadata=t.getMetadata);let s=this._normalizeOptions(n),i=r!==s.rasterSource||this._opts.getRaster!==s.getRaster||this._opts.getMetadata!==s.getMetadata;this._opts=s,i&&(this._cancelScheduledRaster(),this._abortActiveRequest(),this._metadataAbortController?.abort(),this._sourceGeneration++,this.metadata=null,this._currentRequest=null,this._emitUpdate())}async loadMetadata(t={}){if(this._finalized)throw new Error("RasterSet is finalized");t.signal?.throwIfAborted(),this._metadataAbortController?.abort();let r=new AbortController;this._metadataAbortController=r;let n=()=>r.abort(t.signal?.reason);t.signal?.addEventListener("abort",n,{once:!0});let s=++this._metadataRequestId,i=this._sourceGeneration;try{this._startLoading(),r.signal.throwIfAborted();let o=await kt(a=>this._opts.getMetadata({signal:a}),[r.signal]);if(r.signal.throwIfAborted(),this._finalized||i!==this._sourceGeneration||s!==this._metadataRequestId)return o;this.metadata=o;for(let a of this._listeners)a.onMetadataLoad?.(o);return this._emitUpdate(),o}catch(o){if(r.signal.aborted)throw r.signal.reason;if(Is(o))throw o;let a=As(o,"Raster metadata request failed");if(!this._finalized&&i===this._sourceGeneration&&s===this._metadataRequestId)for(let c of this._listeners)c.onMetadataLoadError?.(a);throw a}finally{t.signal?.removeEventListener("abort",n),this._metadataAbortController===r&&(this._metadataAbortController=null),this._finishLoading()}}requestRaster(t,r=this._opts.debounceTime){if(this._finalized)return-1;if(!this.shouldRefetchRaster(t))return this._cancelScheduledRaster(),this._abortActiveRequest(),this._nextRequestId++,this._currentRequest?.requestId??-1;let n=this._nextRequestId++;return this._cancelScheduledRaster(),this._abortActiveRequest(),r>0?this._timeoutId=setTimeout(()=>{this._timeoutId=null,this._loadRaster(n,t)},r):this._loadRaster(n,t),n}shouldRefetchRaster(t){return this._opts.shouldRefetch({currentRequest:this._currentRequest,metadata:this.metadata,nextParameters:t})}finalize(){this._finalized=!0,this._cancelScheduledRaster(),this._abortActiveRequest(),this._metadataAbortController?.abort(),this._metadataAbortController=null,this._loadCounter=0,this._listeners.clear()}async _loadRaster(t,r){if(this._finalized)return;let n=r.signal;if(n?.aborted)return;let s=new AbortController;this._abortController=s;let i=()=>s.abort(n?.reason);n?.addEventListener("abort",i,{once:!0}),this._startLoading();try{s.signal.throwIfAborted();for(let a of this._listeners)a.onRasterLoadStart?.(t,r);s.signal.throwIfAborted();let o=await kt(a=>this._opts.getRaster(Jo(r,a)),[s.signal]);if(this._finalized||s.signal.aborted||t!==this._nextRequestId-1)return;this._currentRequest={requestId:t,parameters:r,raster:o};for(let a of this._listeners)a.onRasterLoad?.(this._currentRequest);this._emitUpdate()}catch(o){if(s.signal.aborted||Is(o))return;let a=As(o,"Raster request failed");if(!this._finalized&&t===this._nextRequestId-1)for(let c of this._listeners)c.onRasterLoadError?.(t,a,r)}finally{n?.removeEventListener("abort",i),this._abortController===s&&(this._abortController=null),this._finishLoading()}}_normalizeOptions(t){let r=t.rasterSource||null;return{...wt,...t,rasterSource:r,getMetadata:t.getMetadata||(n=>r?r.getMetadata(n):wt.getMetadata()),getRaster:t.getRaster||(n=>r?r.getRaster(n):wt.getRaster(n)),debounceTime:t.debounceTime??wt.debounceTime,shouldRefetch:t.shouldRefetch||(n=>wt.shouldRefetch(n))}}_emitUpdate(){if(!this._finalized)for(let t of this._listeners)t.onUpdate?.()}_emitLoadingStateChange(t){if(!this._finalized)for(let r of this._listeners)r.onLoadingStateChange?.(t)}_startLoading(){let t=this._loadCounter>0;this._loadCounter++,t||(this._emitLoadingStateChange(!0),this._emitUpdate())}_finishLoading(){let t=this._loadCounter>0;this._loadCounter=Math.max(0,this._loadCounter-1),t&&this._loadCounter===0&&(this._emitLoadingStateChange(!1),this._emitUpdate())}_cancelScheduledRaster(){this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null)}_abortActiveRequest(){this._abortController?.abort(),this._abortController=null}};function Jo(e,t){let r=Object.getOwnPropertyDescriptors(e);delete r.signal;let n=Array.isArray(e)?Object.defineProperties(e.slice(),r):Object.create(Object.getPrototypeOf(e),r);return Object.defineProperty(n,"signal",{configurable:!0,enumerable:!0,value:t,writable:!0}),n}function As(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}function Is(e){return e instanceof Error&&e.name==="AbortError"}B();ee();Ft();Ct();var ae=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var ce=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new ae(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var le=class{_list;_sentinel;_trimTiles;constructor(){this._list=new ce,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let s=r._cacheNode;s&&(this._list.remove(s),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let s=this._list,i=this._sentinel,o=s.head;for(;o!==i&&(t.gpuMemoryUsageInBytes>t.cacheBytes||n);){let a=o.item;o=o.next,this.unloadTile(t,a,r)}}trim(){this._trimTiles=!0}};ee();B();Ct();function bs(e,t){qt(e),qt(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:s,boundingVolume:{center:i}}=e,o=new z(s);switch(r&&o.translate(r),n){case"Z":break;case"Y":let u=new z().rotateX(Math.PI/2);o=o.multiplyRight(u);break;case"X":let d=new z().rotateY(-Math.PI/2);o=o.multiplyRight(d);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new x(i);t.cartesianModelMatrix=o,t.cartesianOrigin=a;let c=k.WGS84.cartesianToCartographic(a,new x),h=k.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=h.multiplyRight(o),t.cartographicOrigin=c;let f=ta(t);f&&(t.cartesianModelMatrix=new z(o).multiplyRight(f.matrix),t.cartographicModelMatrix.multiplyRight(f.matrix),f.matrix=z.IDENTITY),t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var Qo=1e6**2;function ta(e){let t=e.gltf;if(!t)return null;let r=typeof t.scene=="number"?t.scene:0,s=t.scenes?.[r]?.nodes?.[0];if(!s?.matrix)return null;let i=s.matrix;return i[12]*i[12]+i[13]*i[13]+i[14]*i[14]<=Qo?null:s}B();Ze();ee();var Ns=new x,Xe=new x,ea=1e-5,ra=1e-7,Je=new st([new G,new G,new G,new G,new G,new G]);function Ps(e,t,r={}){let{cameraUp:n,height:s}=e,i=e.cameraDirection,{metersPerUnit:o}=e.distanceScales,a=Ot(e,e.center),c=k.WGS84.eastNorthUpToFixedFrame(a),l=e.unprojectPosition(e.cameraPosition),h=k.WGS84.cartographicToCartesian(l,new x),f;if(i)f=new x(c.transformAsVector(new x(i).scale(o))).normalize();else{let E=e.getFrustumPlanes().near,O=Qe(E,e.cameraPosition),I=Ot(e,O);f=new x(I).subtract(h).normalize()}let u=new x(c.transformAsVector(new x(n).scale(o))).normalize();na(e);let d=e.constructor,{longitude:m,latitude:p,width:g,bearing:T,zoom:R,position:_}=e,M=new d({longitude:m,latitude:p,height:s,width:g,bearing:T,zoom:R,position:_,pitch:0}),S=Number.isFinite(e.fovy)&&Number(e.fovy)>0&&Number(e.fovy)<180?Number(e.fovy)*Math.PI/180:Math.PI/3;return{camera:{position:h,direction:f,up:u,cartographicPosition:l,verticalFieldOfView:S,timeSinceMovement:r.timeSinceCameraMovement??Number.POSITIVE_INFINITY},viewport:e,topDownViewport:M,height:s,cullingVolume:Je,clippingPlanes:e.clippingPlanes,frameNumber:t,sseDenominator:2*Math.tan(S/2),dynamicScreenSpaceErrorDensity:0}}function Ls(e,t,r,n){let s=Array.from(t),i=Array.from(r),o=e?s.length!==e.position.length||s.some((l,h)=>Math.abs(l-e.position[h])>ea):!1,a=e?i.length!==e.direction.length||i.some((l,h)=>Math.abs(l-e.direction[h])>ra):!1,c=o||a?n:e?.lastMovementTime??Number.NEGATIVE_INFINITY;return{state:{position:s,direction:i,lastMovementTime:c},timeSinceMovement:Math.max((n-c)/1e3,0)}}function vs(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:s,latitude:i}=t.viewport;for(let[l,h]of e.entries()){let[f,u]=h.header.mbs,d=Math.abs(s-f),m=Math.abs(i-u),p=Math.sqrt(m*m+d*d);n.push([l,p])}let o=n.sort((l,h)=>l[1]-h[1]),a=[];for(let l=0;l<r;l++)a.push(e[o[l][0]]);let c=[];for(let l=r;l<o.length;l++)c.push(e[o[l][0]]);return[a,c]}function na(e){let t=e.getFrustumPlanes(),r=Qe(t.near,e.cameraPosition),n=Ot(e,r),s=Ot(e,e.cameraPosition,Xe),i=0;Je.planes[i++].fromPointNormal(n,Ns.copy(n).subtract(s));for(let o in t){if(o==="near")continue;let a=t[o],c=Qe(a,r,Xe),l=Ot(e,c,Xe);Je.planes[i++].fromPointNormal(l,Ns.copy(n).subtract(l))}}function Qe(e,t,r=new x){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Ot(e,t,r=new x){let n=e.unprojectPosition(t);return k.WGS84.cartographicToCartesian(n,r)}B();var ks=new x,sa=new x,at=new x,zs=new x,At=new x,Ds=new x,qs=new x,Fs=new x,he=new Mt,ia=new x(0,0,1);function Us(e,t){e._updateTransform(t)}function Bs(e,t,r){if(!Number.isFinite(r.dynamicScreenSpaceErrorDensity)||r.dynamicScreenSpaceErrorDensity<=0)return 0;let n=oa(e),s=n.region?aa(n.region,t):ca(e,n,t);if(!s)return 0;let i=gt(r.dynamicScreenSpaceErrorHeightFalloff,0,1),o=s.minimumHeight+(s.maximumHeight-s.minimumHeight)*i,a=s.maximumHeight-o,c=a>0?gt((s.cameraHeight-o)/a,0,1):s.cameraHeight>=s.maximumHeight?1:0,h=(1-gt(Math.abs(s.cameraDirection.dot(s.upDirection)),0,1))*(1-c);return r.dynamicScreenSpaceErrorDensity*h}function oa(e){return e.header.content?.boundingVolume||e.header.boundingVolume}function aa(e,t){let r=ks.copy(t.camera.position).normalize(),n=At.copy(t.camera.direction).normalize();return{cameraHeight:t.camera.cartographicPosition[2],minimumHeight:e[4],maximumHeight:e[5],cameraDirection:n,upDirection:r}}function ca(e,t,r){let n=la(t,at);if(n===null)return null;let s=new z(e.computedTransform).invert(),i=e.tileset.ellipsoid;if(Math.hypot(at[0],at[1],at[2])>i.minimumRadius){let a=i.cartesianToCartographic(at,sa),c=ks.copy(r.camera.position).normalize(),l=At.copy(r.camera.direction).normalize();return{cameraHeight:r.camera.cartographicPosition[2],minimumHeight:0,maximumHeight:a[2]*2,cameraDirection:l,upDirection:c}}return s.transformAsPoint(r.camera.position,zs),s.transformAsVector(r.camera.direction,At),At.normalize(),{cameraHeight:zs[2],minimumHeight:at[2]-n,maximumHeight:at[2]+n,cameraDirection:At,upDirection:ia}}function la(e,t){if(e.box){let r=e.box;return t.set(r[0],r[1],r[2]),ha(r)}if(e.sphere){let r=e.sphere;return t.set(r[0],r[1],r[2]),r[3]}return null}function ha(e){return e.length===10?(he.fromArray(e,6),Ds.set(e[3],0,0).transformByQuaternion(he),qs.set(0,e[4],0).transformByQuaternion(he),Fs.set(0,0,e[5]).transformByQuaternion(he),Math.abs(Ds[2])+Math.abs(qs[2])+Math.abs(Fs[2])):Math.abs(e[5])+Math.abs(e[8])+Math.abs(e[11])}B();Ze();var tr;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(tr||(tr={}));var It;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(It||(It={}));var J;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(J||(J={}));var bt;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(bt||(bt={}));var mh=new yt,ph=new x,xh=new x,gh=new x,Th=new x;function Gs(e,t,r){return e+(t-e)*r}Me();Me();var Vs="EPSG:4326",Ws="EPSG:4978";function Ys(e){let t=e.trim().toUpperCase(),r=t.match(/(?:\/DEF\/CRS\/|URN:OGC:DEF:CRS:)([A-Z0-9_-]+)(?:\/|::)(?:[^/:]*[/:])?([A-Z0-9_.-]+)$/);return r?`${r[1]}:${r[2]}`:t}function fe(e){if(typeof e=="string"){let r=ot(e);return r==="wkt"?ua(e):r==="proj-string"?da(e):fa(e)||"projected"}let t=e;return t.type==="BoundCRS"&&t.source_crs?fe(t.source_crs):t.type==="CompoundCRS"&&t.components?.[0]?fe(t.components[0]):String(t.type).includes("Projected")?"projected":String(t.type).includes("Geographic")?"geographic":String(t.type).includes("Geodetic")?t.coordinate_system?.subtype==="Cartesian"?"geocentric":"geographic":"unknown"}function fa(e){if(typeof e!="string")return;let t=Ys(e);if(t===Ws)return"geocentric";if(t===Vs||t==="OGC:CRS84")return"geographic";let r=/^EPSG:(\d+)$/.exec(t);if(!r)return;let n=Number(r[1]);if(n===7789)return"geocentric";if(n===4490||n===4979)return"geographic";if(n===3857||n>=32601&&n<=32660||n>=32701&&n<=32760)return"projected"}function ua(e){let t;try{t=Se(e).root}catch{return"unknown"}switch(t.keyword.toUpperCase()){case"GEOCCS":return"geocentric";case"GEOGCS":case"GEOGCRS":case"GEOGRAPHICCRS":case"GEOGRAPHIC2DCRS":case"GEOGRAPHIC3DCRS":return"geographic";case"PROJCS":case"PROJCRS":case"PROJECTEDCRS":return"projected";case"GEODCRS":case"GEODETICCRS":{let n=t.values.find(s=>s.type==="node"&&s.keyword.toUpperCase()==="CS")?.values[0];return n?.type!=="enumeration"&&n?.type!=="string"?"unknown":n.value.toUpperCase()==="CARTESIAN"?"geocentric":n.value.toUpperCase()==="ELLIPSOIDAL"?"geographic":"unknown"}default:return"unknown"}}function da(e){try{let t=_e(e).parameters.find(r=>r.name.toLowerCase()==="proj")?.value;switch(t?.toLowerCase()){case"longlat":case"latlong":return"geographic";case"geocent":return"geocentric";default:return t?"projected":"unknown"}}catch{return"unknown"}}function rr(e,t={}){let r=t.sourceCrs!==void 0,n=t.sourceCrs||e.sourceCrs,s=t.outputCoordinates||"auto",i=t.targetCrs||(s==="ecef"?"EPSG:4978":void 0),o=t.targetHeightReference||"native",a=e.verticalUnitScale??1,c=e.elevationUnitScale??1,l=e.elevationOffset||0,h=e.elevationMode==="onTheGround"||e.elevationMode==="relativeToGround"||e.elevationMode==="relativeToScene",f=e.elevationMode==="relativeToScene"?!!t.sceneElevationProvider:!h||!!t.terrainElevationProvider,u=a!==1||c!==1||e.elevationMode!==void 0&&(h||e.elevationMode==="absoluteHeight"&&l!==0),d=o!=="native"&&o!==e.heightReference,m=!!i||o!=="native"||s!=="auto"||u,p=s!=="target-crs"||!!i,g=!d||(e.heightReference||"unknown")!=="unknown",T=Number.isFinite(a)&&a>0&&Number.isFinite(c)&&c>0,R=!!n&&m&&p&&g&&T&&f&&s!=="local-enu",_=r?"caller-override":e.provenance||"unknown",M=r&&n?fe(n):e.coordinateFrame,S=r?"explicit":e.sourceCrsState||(n?_==="format-default"?"default":"explicit":"absent"),E=Ut({crs:n?{state:S==="default"?"default":"explicit",definition:n,representation:!r&&e.sourceCrsRepresentation||ot(n),provenance:_,alternatives:r?void 0:e.sourceCrsAlternatives}:{state:S==="unknown"?"unknown":"absent",provenance:_},vertical:e.verticalCrs?{state:"explicit",definition:e.verticalCrs,representation:ot(e.verticalCrs),provenance:e.provenance||"metadata"}:void 0,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,coordinateFrame:M,coordinateOrder:pa(e.axisOrder),units:r?void 0:e.units}),O=er(E.crs),I=E.vertical?er(E.vertical):void 0,w=i?ma(i):void 0;return Object.freeze({...E,sourceCrs:O,verticalCrs:I,verticalUnitScale:a,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,heightReference:e.heightReference||"unknown",elevationMode:e.elevationMode,elevationOffset:e.elevationOffset,elevationUnit:e.elevationUnit,elevationUnitScale:c,coordinateFrame:M||"unknown",axisOrder:e.axisOrder||"unknown",provenance:_,targetCrs:w,targetHeightReference:o,outputCoordinates:s,status:m?R?"transformable":"unresolved":"native",warnings:Object.freeze([...e.warnings||[]])})}function nr(e,t={}){return rr({sourceCrs:e?.sourceCrs,sourceCrsState:e?.crs.state,sourceCrsRepresentation:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.representation:void 0,sourceCrsAlternatives:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.alternatives:void 0,verticalCrs:e?.verticalCrs,units:e?.units,verticalUnitScale:e?.verticalUnitScale,coordinateEpoch:e?.coordinateEpoch,heightReference:e?.heightReference,elevationMode:e?.elevationMode,elevationOffset:e?.elevationOffset,elevationUnit:e?.elevationUnit,elevationUnitScale:e?.elevationUnitScale,coordinateFrame:e?.coordinateFrame,axisOrder:e?.axisOrder,provenance:e?.provenance,warnings:e?.warnings},t)}function er(e){return e.state==="explicit"||e.state==="default"?e.definition:void 0}function ma(e){let t=Ut({crs:{state:"explicit",definition:e,representation:ot(e),provenance:"caller-override"}}),r=er(t.crs);if(!r)throw new Error("Failed to normalize a known target CRS definition");return r}function pa(e){switch(e){case"xy":return["x","y"];case"yx":return["y","x"];case"xyz":return["x","y","z"];default:return[]}}function $s(e){return!!(e&&typeof e=="object"&&"initialize"in e&&"getRootTileset"in e&&"initializeTileHeaders"in e&&"loadTileContent"in e)}var de=1024*1024,ri=512*de,ni=512*de,xa=32*de,ga=de;function ue(e,t){if(!Number.isFinite(e)||e<0)throw new Error(`${t} must be a finite number greater than or equal to 0`);return e}function Zs(e,t){let r=e.cacheBytes??t;return ue(r,"cacheBytes")}function js(e,t){let r=e.maximumCacheOverflowBytes??t;return ue(r,"maximumCacheOverflowBytes")}var sr={description:"",ellipsoid:k.WGS84,modelMatrix:new z,throttleRequests:!0,maxRequests:64,cacheBytes:ri,maximumCacheOverflowBytes:ni,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onSourceError:()=>{},onTilesetError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{},contentLoader:void 0,viewDistanceScale:1,progressiveResolutionHeightFraction:.3,foveatedScreenSpaceError:!0,foveatedConeSize:.1,foveatedMinimumScreenSpaceErrorRelaxation:0,foveatedInterpolationCallback:Gs,foveatedTimeDelay:.2,maximumScreenSpaceError:8,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:2e-4,dynamicScreenSpaceErrorFactor:24,dynamicScreenSpaceErrorHeightFalloff:.25,memoryAdjustedScreenSpaceError:!0,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{},spatial:{}},ir="Tiles In Tileset(s)",or="Tiles In Memory",Hs="Tiles In View",Ks="Tiles To Render",Xs="Tiles Loaded",ar="Tiles Loading",Js="Tiles Unloaded",Qs="Failed Tile Loads",ti="Points/Vertices",cr="Tile Memory Use",ei="Maximum Screen Space Error",Nt=class{options;loadOptions;source;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};schema=null;schemaUri=null;groups=[];metadata=null;statistics=null;spatialReference=rr({});description="";properties;extras=null;attributions={};credits={};stats;contentFormats;cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=ri;_maximumCacheOverflowBytes=ni;_frameNumber=0;_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_cameraMotionStates={};_deferredTraversalTimeout=null;_traverser;_cache=new le;_requestScheduler;_heldTiles=new Set;updatePromise=null;tilesetInitializationPromise;constructor(t,r){if(!$s(t))throw new Error("Tileset3D requires a Tileset3DSource instance");let n=r||{},s=t.type===J.TILES3D,i=s?sr.cacheBytes:xa,o=s?sr.maximumCacheOverflowBytes:ga,a=Zs(n,i),c=js(n,o);this.options={...sr,...n,cacheBytes:a,maximumCacheOverflowBytes:c,skipLevelOfDetail:n.skipLevelOfDetail??t.type===J.TILES3D,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError??s},this.loadOptions=this.options.loadOptions||{},this.source=t,this.tileset=null,this.loader=this.source.loader,this.type=this.source.type,this.url=this.source.url,this.basePath=this.source.basePath,this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType="",this.lodMetricValue=0,this.refine="",this.contentFormats=this.source.contentFormats,this._traverser=this._initializeTraverser(),this._requestScheduler=new j({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=a,this._maximumCacheOverflowBytes=c;let l=this._getSourceMetadata();l&&(this.spatialReference=nr(l.spatialReference,this.options.spatial)),this.stats=new W({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet()}destroy(){this._clearDeferredTraversal(),this.source.destroy?.(),this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get requestedTiles(){return this._requestedTiles.slice()}get emptyTiles(){return this._emptyTiles.slice()}get cacheBytes(){return this._cacheBytes}set cacheBytes(t){this._cacheBytes=ue(t,"cacheBytes"),this.options.cacheBytes=this._cacheBytes}get maximumCacheOverflowBytes(){return this._maximumCacheOverflowBytes}set maximumCacheOverflowBytes(t){this._maximumCacheOverflowBytes=ue(t,"maximumCacheOverflowBytes"),this.options.maximumCacheOverflowBytes=this._maximumCacheOverflowBytes}get queryParams(){let t=this.source.getTileUrl(this.url),r=t.indexOf("?");return r>=0?t.slice(r+1):""}setProps(t){let r=Zs(t,this.cacheBytes),n=js(t,this.maximumCacheOverflowBytes);this.options={...this.options,...t,cacheBytes:r,maximumCacheOverflowBytes:n},this._cacheBytes=r,this._maximumCacheOverflowBytes=n}getTileUrl(t){return this.source.getTileUrl(t)}hasExtension(t){return!!this.source.hasExtension?.(t)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this.cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this.cacheBytes+this.maximumCacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t],n=new Set(r.map(a=>a.id));for(let a of Object.keys(this.frameStateData))n.has(a)||delete this.frameStateData[a];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let s=Date.now(),i=Number.POSITIVE_INFINITY,o=[];for(let a of r){let c=a.id;this._needTraverse(c)?o.push(c):this.traverseCounter--}for(let a of r){let c=a.id;if(this.roots[c]||(this.roots[c]=this._initializeTileHeaders(this.tileset,null)),!o.includes(c))continue;let l=Ps(a,this._frameNumber),h=this.roots[c],f=Ls(this._cameraMotionStates[c],l.camera.position,l.camera.direction,s);this._cameraMotionStates[c]=f.state,l.camera.timeSinceMovement=f.timeSinceMovement,Us(h,this.modelMatrix),l.dynamicScreenSpaceErrorDensity=this.type===J.TILES3D&&this.options.dynamicScreenSpaceError&&!l.viewport.orthographic?Bs(h,l,this.options):0,this.dynamicScreenSpaceErrorComputedDensity=l.dynamicScreenSpaceErrorDensity,this._traverser.traverse(h,l,this.options),Object.keys(this._traverser.deferredTiles).length>0&&(i=Math.min(i,Math.max(this.options.foveatedTimeDelay-f.timeSinceMovement,0)))}Number.isFinite(i)?this._scheduleDeferredTraversal(i):this._clearDeferredTraversal()}_scheduleDeferredTraversal(t){this._clearDeferredTraversal(),this._deferredTraversalTimeout=setTimeout(()=>{this._deferredTraversalTimeout=null,this.selectTiles().catch(r=>{let n=r instanceof Error?r:new Error(String(r));this._onTilesetError(n)})},Math.max(t*1e3,0))}_clearDeferredTraversal(){this._deferredTraversalTimeout!==null&&(clearTimeout(this._deferredTraversalTimeout),this._deferredTraversalTimeout=null)}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],s=Object.values(this._traverser.selectedTiles),[i,o]=vs(s,t,this.options.maximumTilesSelected);n.selectedTiles=i;for(let a of o)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){let t=this.selectedTiles;this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let i in this.frameStateData){let o=this.frameStateData[i];this.selectedTiles=this.selectedTiles.concat(o.selectedTiles),this._requestedTiles=this._requestedTiles.concat(o._requestedTiles),this._emptyTiles=this._emptyTiles.concat(o._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);let r=new Set(this.selectedTiles),n=this.selectedTiles.some(i=>!i.tileDrawn),s=0;if(n){let i=new Set(Object.keys(this.frameStateData).map(a=>this.roots[a])),o=new Map;for(let a of this.selectedTiles)for(let c=a.parent;c;c=c.parent)o.set(c,(o.get(c)??!0)&&a.tileDrawn);for(let a of t)a.tileDrawn&&this._heldTiles.add(a);for(let a of this._heldTiles){let c=a;for(;c.parent;)c=c.parent;if(!i.has(c)){this._heldTiles.delete(a);continue}r.has(a)||(a.contentAvailable&&!this._hasDrawnReplacement(a,r,o)?(a._selectedFrame=this._frameNumber,this.selectedTiles.push(a),s++):this._heldTiles.delete(a))}}else this._heldTiles=r;s>0&&setTimeout(()=>{this.selectTiles()},0);for(let i of this.selectedTiles)this._tiles[i.id]=i;this._loadTiles(),this._unloadTiles(),this._updateStats(),this._tilesChanged(t,this.selectedTiles)&&this.options.onUpdate()}_hasDrawnReplacement(t,r,n){for(let s=t.parent;s;s=s.parent)if(r.has(s))return s.tileDrawn;return n.get(t)===!0}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(o=>o.id)),s=new Set(r.map(o=>o.id)),i=t.some(o=>!s.has(o.id));return i=i||r.some(o=>!n.has(o.id)),i}_loadTiles(){this._requestedTiles.sort((t,r)=>t._priority-r._priority);for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r)),this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)if(n.contentAvailable&&n.content){t++;let s=n.contents.length?n.contents:[n.content];for(let i of s)i.pointCount?r+=i.pointCount:r+=i.vertexCount||0}this.stats.get(Hs).count=this.selectedTiles.length,this.stats.get(Ks).count=t,this.stats.get(ti).count=r,this.stats.get(ei).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(){try{let t=this.source.initialize(),r=this._getSourceMetadata();r&&this._syncSourceState(r),r?.tileset?.root&&typeof r.tileset.root.then!="function"&&(!this.source.prepareTileset||this.spatialReference?.status==="native")&&(this.root=this._initializeTileHeaders(r.tileset,null),this._applyViewState()),await t;let n=this.source.getMetadata();this._syncSourceState(n),await this.source.prepareTileset?.(this),this.root||(this.root=this._initializeTileHeaders(n.tileset,null)),this._applyViewState()}catch(t){let r=t instanceof Error?t:new Error(String(t));throw this._onSourceError(r,this.root),this._onTilesetError(r),r}}_initializeStats(){this.stats.get(ir),this.stats.get(ar),this.stats.get(or),this.stats.get(Hs),this.stats.get(Ks),this.stats.get(Xs),this.stats.get(Js),this.stats.get(Qs),this.stats.get(ti),this.stats.get(cr,"memory"),this.stats.get(ei)}_initializeTileHeaders(t,r){return this.source.initializeTileHeaders(this,t,r)}_initializeTraverser(){return this.source.createTraverser({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r=null;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){let s=n instanceof Error?n:new Error("load failed");this._onSourceError(s,t),this._onTileLoadError(t,s)}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}async _loadTileChildren(t,r){try{this._onStartTileLoading(),await t.loadChildren(r)}catch(n){let s=n instanceof Error?n:new Error("subtree load failed");this._onSourceError(s,t),this._onTileLoadError(t,s)}finally{this._onEndTileLoading()}}_onTileLoadError(t,r){this.stats.get(Qs).incrementCount();let n=r.message||r.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,s)}_onSourceError(t,r=null){this.options.onSourceError(t,this.source,r)}_onTilesetError(t){this.options.onTilesetError(t,this)}_onTileLoad(t,r){if(!r?.loaded)return;t.content&&bs(t,t.content),this.source.onTileLoaded?.(this,t,r),this._syncSourceState(this.source.getMetadata());let n=this.source.getTilesTotalCount?.();n&&(this.stats.get(ir).reset(),this.stats.get(ir).addCount(n)),this._addTileToCache(t),this.options.onTileLoad(t)}_onStartTileLoading(){this._pendingCount++,this.stats.get(ar).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(ar).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Xs).incrementCount(),this.stats.get(or).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(cr).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(or).decrementCount(),this.stats.get(Js).incrementCount(),this.stats.get(cr).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[r];for(;n.length>0;){t=n.pop();for(let s of t.children)n.push(s);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_syncSourceState(t){this.tileset=t.tileset,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.refine,this.contentFormats=this.source.contentFormats,this.asset=this.source.asset||this.asset;let r=t.tileset;this.schema=r.schema||null,this.schemaUri=r.schemaUri||null,this.groups=r.groups||[],this.metadata=r.metadata||null,this.statistics=r.statistics??null;let n=nr(t.spatialReference,this.options.spatial);this.spatialReference=Ta(this.spatialReference,n),this.properties=this.source.properties??this.properties,this.extras=this.source.extras??this.extras,this.options.attributions?.length?this.credits={attributions:this.options.attributions}:this.credits=this.source.credits||this.credits}_applyViewState(){let t=this.source.getViewState(this.root);this.asset=t.asset||this.source.asset||{},this.properties=t.properties??this.source.properties,this.extras=t.extras??this.source.extras??null,this.credits=t.credits||this.source.credits||this.credits||{attributions:this.options.attributions||[]},this.description=t.description||this.options.description||"",this.boundingVolume=t.boundingVolume||this.root?.boundingVolume||null,this.cartographicCenter=t.cartographicCenter||new x,this.cartesianCenter=t.cartesianCenter||null,this.zoom=t.zoom||1,this.geometricError=this.tileset?.geometricError||0}_getSourceMetadata(){try{return this.source.getMetadata()}catch{return null}}};function Ta(e,t){return e?.status==="transformed"&&e.sourceCrs===t.sourceCrs&&e.targetCrs===t.targetCrs&&e.targetHeightReference===t.targetHeightReference&&e.outputCoordinates===t.outputCoordinates?e:t}ys();function si(e,t,r={}){let n=e.tileMatrixSet;if(!n||!n.crs||t.crs!==n.crs)throw new Error("Tile selection requires complete geometry and a frame in the exact grid CRS.");if(t.extent.length!==4||!t.extent.every(Number.isFinite)||t.extent[0]>t.extent[2]||t.extent[1]>t.extent[3])throw new RangeError("Tile frame extent must be finite and ordered.");let s=r.maximumTileCount??4096;if(!Number.isSafeInteger(s)||s<0)throw new RangeError("maximumTileCount must be a nonnegative safe integer.");for(let u of n.matrices){let d=u.variableMatrixWidths;if(d!==void 0&&(!Array.isArray(d)||d.length>0))throw new Error("Regular-grid selection does not support variable-width rows.")}let i=Rs(n,t.resolution),o=new Map;for(let u of e.limits??[]){let d=n.matrices.find(m=>m.id===u.tileMatrix);if(!d||o.has(u.tileMatrix))throw new RangeError("Tile coverage must reference unique, known matrix ids.");Ke(d,u.minTileColumn,u.minTileRow,u),o.set(u.tileMatrix,u)}if(!i||e.limits!==void 0&&!o.has(i.id))return[];let a=Es(i,t.extent,o.get(i.id));if(!a)return[];let c=a.maxTileColumn-a.minTileColumn+1,l=a.maxTileRow-a.minTileRow+1;if(c>s/l)throw new RangeError("Tile selection exceeds maximumTileCount.");let h=n.matrices.indexOf(i),f=[];for(let u=a.minTileRow;u<=a.maxTileRow;u++)for(let d=a.minTileColumn;d<=a.maxTileColumn;d++){let[m,p,g,T]=_s(i,d,u);f.push({index:{x:d,y:u,z:h},tileMatrix:i.id,id:JSON.stringify([n.crs,i.id,d,u]),bbox:{left:m,bottom:p,right:g,top:T},crs:n.crs,tileSize:[i.tileSize[0],i.tileSize[1]]})}return f}return ui(Pt);})();
29
10
  return __exports__;
30
11
  });