@arcgis/core 4.24.0-next.20220430 → 4.24.0-next.20220503

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 (998) hide show
  1. package/Basemap.js +1 -1
  2. package/Color.js +1 -1
  3. package/Ground.js +1 -1
  4. package/Map.js +1 -1
  5. package/PopupTemplate.js +1 -1
  6. package/WebMap.js +1 -1
  7. package/WebScene.js +1 -1
  8. package/analysis/LinearDimension.js +1 -1
  9. package/analysis/SliceAnalysis.js +1 -1
  10. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  11. package/arcade/Dictionary.js +1 -1
  12. package/arcade/Feature.js +1 -1
  13. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  14. package/arcade/featureset/support/FeatureSet.js +1 -1
  15. package/assets/esri/core/workers/RemoteClient.js +1 -1
  16. package/assets/esri/core/workers/chunks/{e06461703e6f1acfcfdc.js → 076d1b1101b59af0d389.js} +1 -1
  17. package/assets/esri/core/workers/chunks/0b72d123386dc4ec7538.js +1 -0
  18. package/assets/esri/core/workers/chunks/0d53e575f11198867619.js +1 -0
  19. package/assets/esri/core/workers/chunks/0e6e3cf07c84d9f040c0.js +1 -0
  20. package/assets/esri/core/workers/chunks/105728404ddd9e73d5c9.js +1 -0
  21. package/assets/esri/core/workers/chunks/11106873b009b98e4286.js +1 -0
  22. package/assets/esri/core/workers/chunks/11a7b156591d1feca952.js +1 -0
  23. package/assets/esri/core/workers/chunks/{94325f920a125610e1f5.js → 12feeace7215248be23f.js} +1 -1
  24. package/assets/esri/core/workers/chunks/17be5bd0d1c233d73d7a.js +1 -0
  25. package/assets/esri/core/workers/chunks/1b53bd65407ba5c479d7.js +1 -0
  26. package/assets/esri/core/workers/chunks/1d91aa745b49b2ab36cf.js +1 -0
  27. package/assets/esri/core/workers/chunks/{fd35b69872ac9393924f.js → 1db8bfb1731be3ae320c.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{3433361f09c84b31aec4.js → 2290bd6dc2e6bb136e14.js} +1 -1
  29. package/assets/esri/core/workers/chunks/24217129d492e170f0f0.js +1 -0
  30. package/assets/esri/core/workers/chunks/24e194107e0e5090125b.js +1 -0
  31. package/assets/esri/core/workers/chunks/2a1301a1d0cd4c0c17cf.js +1 -0
  32. package/assets/esri/core/workers/chunks/{178831b0d0bdabcc45e7.js → 2a676221ca1fc8e0cf34.js} +1 -1
  33. package/assets/esri/core/workers/chunks/2aede0d1dcac8592436b.js +1 -0
  34. package/assets/esri/core/workers/chunks/2b93ad626f5e75b97692.js +1 -0
  35. package/assets/esri/core/workers/chunks/2d03210fc6b5884c6bf9.js +1 -0
  36. package/assets/esri/core/workers/chunks/{b10c333abe4f4e52841c.js → 2dfd3def105005fc72c7.js} +1 -1
  37. package/assets/esri/core/workers/chunks/2f8ff35b8ab15c0e39c2.js +1 -0
  38. package/assets/esri/core/workers/chunks/36272141b3c33cb19026.js +1 -0
  39. package/assets/esri/core/workers/chunks/36c8e8de9c3f67d32572.js +1 -0
  40. package/assets/esri/core/workers/chunks/3ab8c6ae2f2713f637b0.js +1 -0
  41. package/assets/esri/core/workers/chunks/3c058381adcfdc407aa1.js +1 -0
  42. package/assets/esri/core/workers/chunks/3f39df1dfc0a685e5f9d.js +1 -0
  43. package/assets/esri/core/workers/chunks/3fd52a03b3126556aee6.js +1 -0
  44. package/assets/esri/core/workers/chunks/4082d8573f41f952c72e.js +1 -0
  45. package/assets/esri/core/workers/chunks/40b11eea270f6688ff9c.js +1 -0
  46. package/assets/esri/core/workers/chunks/4281b4b27f4767cdd3ae.js +1 -0
  47. package/assets/esri/core/workers/chunks/43fcaaeb6fd179e9199b.js +1 -0
  48. package/assets/esri/core/workers/chunks/4c65b27d80b23c0c3101.js +1 -0
  49. package/assets/esri/core/workers/chunks/{a6406a248b7b2ed65f35.js → 4ec7d59b0c814dbaa7a4.js} +1 -1
  50. package/assets/esri/core/workers/chunks/4f378ad6f4299183df85.js +1 -0
  51. package/assets/esri/core/workers/chunks/505b0aa5ee3e5a26c351.js +1 -0
  52. package/assets/esri/core/workers/chunks/509a9cdd0228a730bcea.js +1 -0
  53. package/assets/esri/core/workers/chunks/52255ad573cec0a34720.js +1 -0
  54. package/assets/esri/core/workers/chunks/52d4fdc451a58a858af1.js +1 -0
  55. package/assets/esri/core/workers/chunks/5405f478af3563580926.js +1 -0
  56. package/assets/esri/core/workers/chunks/54577c2522ca3ff08f7e.js +1 -0
  57. package/assets/esri/core/workers/chunks/54d67e450da6ce2641b4.js +1 -0
  58. package/assets/esri/core/workers/chunks/56d3cb0ae0069a8eadde.js +1 -0
  59. package/assets/esri/core/workers/chunks/5b4efe0014162f777534.js +1 -0
  60. package/assets/esri/core/workers/chunks/5baa162351551817838b.js +1 -0
  61. package/assets/esri/core/workers/chunks/5cf2064bfd9d0847d9ec.js +1 -0
  62. package/assets/esri/core/workers/chunks/620dc3c13c345d5aa9f6.js +1 -0
  63. package/assets/esri/core/workers/chunks/7c290763920f52a1f504.js +1 -0
  64. package/assets/esri/core/workers/chunks/7dc266be958e34e81007.js +972 -0
  65. package/assets/esri/core/workers/chunks/7dfd70f4fa1096e56641.js +1 -0
  66. package/assets/esri/core/workers/chunks/7f097de06972a68cd08a.js +1 -0
  67. package/assets/esri/core/workers/chunks/8033531b0cc706b40d86.js +1 -0
  68. package/assets/esri/core/workers/chunks/814234844a056d9f1ddc.js +1 -0
  69. package/assets/esri/core/workers/chunks/83700cdd60ceecc639cd.js +1 -0
  70. package/assets/esri/core/workers/chunks/857df84cea67079a91e5.js +1 -0
  71. package/assets/esri/core/workers/chunks/8793070d288878d6f49b.js +1 -0
  72. package/assets/esri/core/workers/chunks/8865c5cc28df60364e60.js +1 -0
  73. package/assets/esri/core/workers/chunks/{e9f786d4ba3143ed9644.js → 8cc85d1d46dda16ad041.js} +1 -1
  74. package/assets/esri/core/workers/chunks/958a7ef2cbf048819988.js +1 -0
  75. package/assets/esri/core/workers/chunks/967af0aa4dc4da032fdc.js +1 -0
  76. package/assets/esri/core/workers/chunks/9722880bd7f455b2bd07.js +1 -0
  77. package/assets/esri/core/workers/chunks/9d738aab0d907cd09a9d.js +1 -0
  78. package/assets/esri/core/workers/chunks/{86b31ae136f931d7884a.js → 9e6df034d7949880471f.js} +1 -1
  79. package/assets/esri/core/workers/chunks/a056a79f31cddb066f15.js +1 -0
  80. package/assets/esri/core/workers/chunks/a2c9fd78d42df7314a3e.js +1 -0
  81. package/assets/esri/core/workers/chunks/a4dcb50f6622cb1444c8.js +1 -0
  82. package/assets/esri/core/workers/chunks/a6bfbe449b8c2fa5334c.js +1 -0
  83. package/assets/esri/core/workers/chunks/a8ed1a938dc164b401d9.js +1 -0
  84. package/assets/esri/core/workers/chunks/a9a73bc4875a5aeaf1b9.js +1 -0
  85. package/assets/esri/core/workers/chunks/ac0df52b2f2a4874e4ea.js +1 -0
  86. package/assets/esri/core/workers/chunks/{431efa172901ab8e4d53.js → acfa8eb19225f7862b1d.js} +1 -1
  87. package/assets/esri/core/workers/chunks/adae54f116f311d72d97.js +1 -0
  88. package/assets/esri/core/workers/chunks/{718073d13d3de67b629b.js → aeeb364b7c1876f6e7db.js} +1 -1
  89. package/assets/esri/core/workers/chunks/afddfe620e6539991e6b.js +1 -0
  90. package/assets/esri/core/workers/chunks/b02a83845d3da4caee9d.js +1 -0
  91. package/assets/esri/core/workers/chunks/{0d21506b7d4f9afdbb09.js → b3847a6bbd45d813f03c.js} +1 -1
  92. package/assets/esri/core/workers/chunks/b4c23630d6c85f7b59c0.js +1 -0
  93. package/assets/esri/core/workers/chunks/{c318b229911b60fc3cbf.js → b50ae3dc7e43ff452568.js} +1 -1
  94. package/assets/esri/core/workers/chunks/b5ede4df4620097c6528.js +1 -0
  95. package/assets/esri/core/workers/chunks/b7d7ad127f8939cbdec2.js +1 -0
  96. package/assets/esri/core/workers/chunks/bf1d1c02d12b526b0750.js +1 -0
  97. package/assets/esri/core/workers/chunks/c0e6dbecdbd30066a82c.js +1 -0
  98. package/assets/esri/core/workers/chunks/c2a36243eb105d570bff.js +1 -0
  99. package/assets/esri/core/workers/chunks/c8a3a28809542396c6fd.js +1 -0
  100. package/assets/esri/core/workers/chunks/cf1047ad176a25dcd2d6.js +1 -0
  101. package/assets/esri/core/workers/chunks/d03de043d43691665a93.js +1 -0
  102. package/assets/esri/core/workers/chunks/d3fecbaca51ef8844026.js +1 -0
  103. package/assets/esri/core/workers/chunks/dafe120243db6648a4ab.js +1 -0
  104. package/assets/esri/core/workers/chunks/dccc33d87cb7d902f5c7.js +1 -0
  105. package/assets/esri/core/workers/chunks/dd43f5647900ee27af22.js +1 -0
  106. package/assets/esri/core/workers/chunks/{52489e2f7748dc610263.js → dfdd853dd6c023089963.js} +1 -1
  107. package/assets/esri/core/workers/chunks/e6f76f62cf58fb1e67c6.js +1 -0
  108. package/assets/esri/core/workers/chunks/ea73a1d9cad5e1a5d861.js +1 -0
  109. package/assets/esri/core/workers/chunks/{4130ea1f5a9f197168d7.js → ed4519ac9533a4d340f1.js} +1 -1
  110. package/assets/esri/core/workers/chunks/f0e462f5a16852f33225.js +1 -0
  111. package/assets/esri/core/workers/chunks/f13c29bcc71aed8f3a2e.js +1 -0
  112. package/assets/esri/core/workers/chunks/f356e505c36397fda3cf.js +1 -0
  113. package/assets/esri/core/workers/chunks/f55cbaf5a1d6ee6ac171.js +1 -0
  114. package/assets/esri/core/workers/chunks/f6e613ae6812a347a26c.js +1 -0
  115. package/assets/esri/core/workers/chunks/fb3279408bd5323ec612.js +1 -0
  116. package/assets/esri/core/workers/chunks/fdf80a371b7b2a45f1ff.js +1 -0
  117. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  118. package/chunks/ChapmanAtmosphere.glsl.js +15 -15
  119. package/chunks/CheckerBoard.glsl.js +3 -3
  120. package/chunks/Clouds.glsl.js +2 -3
  121. package/chunks/CloudsComposition.glsl.js +3 -3
  122. package/chunks/ColorMaterial.glsl.js +11 -11
  123. package/chunks/DefaultMaterial.glsl.js +26 -26
  124. package/chunks/EdgeShader.glsl.js +3 -3
  125. package/chunks/Fog.glsl.js +6 -6
  126. package/chunks/HUDMaterial.glsl.js +48 -48
  127. package/chunks/HeatmapDensity.glsl.js +7 -7
  128. package/chunks/HighlightApply.glsl.js +3 -3
  129. package/chunks/LineCallout.glsl.js +3 -3
  130. package/chunks/LineMarker.glsl.js +22 -22
  131. package/chunks/MeasurementArrow.glsl.js +4 -4
  132. package/chunks/NativeLine.glsl.js +11 -11
  133. package/chunks/Path.glsl.js +16 -16
  134. package/chunks/Pattern.glsl.js +30 -30
  135. package/chunks/RasterColorizer.glsl.js +4 -4
  136. package/chunks/RealisticTree.glsl.js +20 -20
  137. package/chunks/RibbonLine.glsl.js +39 -39
  138. package/chunks/ShadedColorMaterial.glsl.js +10 -10
  139. package/chunks/ShadowCastVisualize.glsl.js +5 -5
  140. package/chunks/ShadowHighlight.glsl.js +2 -2
  141. package/chunks/SlicePlaneMaterial.glsl.js +3 -3
  142. package/chunks/Stars.glsl.js +2 -2
  143. package/chunks/WaterSurface.glsl.js +20 -20
  144. package/chunks/languageUtils.js +1 -1
  145. package/chunks/persistableUrlUtils.js +1 -1
  146. package/chunks/vec22.js +1 -1
  147. package/chunks/vec2f64.js +1 -1
  148. package/chunks/vec3.js +1 -1
  149. package/chunks/vec33.js +1 -1
  150. package/chunks/vec43.js +1 -1
  151. package/colorUtils.js +1 -1
  152. package/config.js +1 -1
  153. package/core/Accessor.js +1 -1
  154. package/core/AsyncUpdate.js +1 -1
  155. package/core/Clonable.js +1 -1
  156. package/core/Collection.js +1 -1
  157. package/core/HandleOwner.js +1 -1
  158. package/core/Loadable.js +1 -1
  159. package/core/NestedMap.js +1 -1
  160. package/core/accessorSupport/DefaultsStore.js +1 -1
  161. package/core/accessorSupport/Properties.js +1 -1
  162. package/core/accessorSupport/decorators/enumeration.js +1 -1
  163. package/core/accessorSupport/extensions/serializableProperty/reader.js +1 -1
  164. package/core/accessorSupport/extensions/serializableProperty/writePolicyUtils.js +1 -1
  165. package/core/accessorSupport/extensions/serializableProperty/writer.js +1 -1
  166. package/core/accessorSupport/read.js +1 -1
  167. package/core/accessorSupport/tracking.js +1 -1
  168. package/core/accessorSupport/write.js +1 -1
  169. package/core/devEnvironmentUtils.js +1 -1
  170. package/core/has.js +1 -1
  171. package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
  172. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  173. package/core/libs/rbush/PooledRBush.js +1 -1
  174. package/core/promiseUtils.js +1 -1
  175. package/core/reactiveUtils.js +1 -1
  176. package/core/scheduling.js +1 -1
  177. package/core/throttle.js +1 -1
  178. package/core/urlUtils.js +1 -1
  179. package/core/watchUtils.js +1 -1
  180. package/core/workers/RemoteClient.js +1 -1
  181. package/core/workers/WorkerOwner.js +1 -1
  182. package/core/workers/loaderConfig.js +1 -1
  183. package/core/workers/workerFactory.js +1 -1
  184. package/geometry/Mesh.js +1 -1
  185. package/geometry/geometryEngine.js +1 -1
  186. package/geometry/geometryEngineAsync.js +1 -1
  187. package/geometry/projection.js +1 -1
  188. package/geometry/support/axisAngleDegrees.js +1 -1
  189. package/geometry/support/meshUtils/centerAt.js +1 -1
  190. package/geometry/support/meshUtils/deduplicate.js +1 -1
  191. package/geometry/support/meshUtils/elevation.js +1 -1
  192. package/geometry/support/meshUtils/geographicUtils.js +1 -1
  193. package/geometry/support/meshUtils/georeference.js +1 -1
  194. package/geometry/support/meshUtils/loadExternal.js +1 -1
  195. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  196. package/geometry/support/meshUtils/offset.js +1 -1
  197. package/geometry/support/meshUtils/rotate.js +1 -1
  198. package/geometry/support/meshUtils/scale.js +1 -1
  199. package/geometry/support/normalizeUtils.js +1 -1
  200. package/geometry/support/normalizeUtilsCommon.js +1 -1
  201. package/geometry/support/offset.js +1 -1
  202. package/geometry/support/rotate.js +1 -1
  203. package/identity/IdentityManagerBase.js +1 -1
  204. package/identity/IdentityModal.js +1 -1
  205. package/interfaces.d.ts +109 -2
  206. package/intl/locale.js +1 -1
  207. package/intl/messages.js +1 -1
  208. package/kernel.js +1 -1
  209. package/layers/AnalysisLayer.js +1 -1
  210. package/layers/CSVLayer.js +1 -1
  211. package/layers/FeatureLayer.js +1 -1
  212. package/layers/GeoJSONLayer.js +1 -1
  213. package/layers/GeoRSSLayer.js +1 -1
  214. package/layers/ImageryLayer.js +1 -1
  215. package/layers/ImageryTileLayer.js +1 -1
  216. package/layers/Layer.js +1 -1
  217. package/layers/MapImageLayer.js +1 -1
  218. package/layers/MapNotesLayer.js +1 -1
  219. package/layers/OGCFeatureLayer.js +1 -1
  220. package/layers/RouteLayer.js +1 -1
  221. package/layers/SceneLayer.js +1 -1
  222. package/layers/StreamLayer.js +1 -1
  223. package/layers/SubtypeGroupLayer.js +1 -1
  224. package/layers/TileLayer.js +1 -1
  225. package/layers/VectorTileLayer.js +1 -1
  226. package/layers/VoxelLayer.js +1 -1
  227. package/layers/VoxelWasmPerScene.js +1 -1
  228. package/layers/WCSLayer.js +1 -1
  229. package/layers/WFSLayer.js +1 -1
  230. package/layers/WMSLayer.js +1 -1
  231. package/layers/WMTSLayer.js +1 -1
  232. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  233. package/layers/effects/EffectView.js +1 -1
  234. package/layers/effects/FeatureEffectView.js +1 -1
  235. package/layers/effects/jsonUtils.js +1 -1
  236. package/layers/graphics/OptimizedGeometry.js +1 -1
  237. package/layers/graphics/centroid.js +1 -1
  238. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  239. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  240. package/layers/graphics/data/QueryEngineResult.js +1 -1
  241. package/layers/graphics/data/StreamFeatureManager.js +1 -1
  242. package/layers/graphics/editingSupport.js +1 -1
  243. package/layers/graphics/objectIdUtils.js +1 -1
  244. package/layers/graphics/sources/CSVSource.js +1 -1
  245. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  246. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  247. package/layers/graphics/sources/MemorySource.js +1 -1
  248. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  249. package/layers/graphics/sources/WFSSource.js +1 -1
  250. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  251. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  252. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  253. package/layers/graphics/sources/geojson/geojson.js +1 -1
  254. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  255. package/layers/graphics/sources/support/QueryTask.js +1 -1
  256. package/layers/mixins/APIKeyMixin.js +1 -1
  257. package/layers/mixins/ArcGISImageService.js +1 -1
  258. package/layers/mixins/ArcGISMapService.js +1 -1
  259. package/layers/mixins/ImageryTileMixin.js +1 -1
  260. package/layers/mixins/OperationalLayer.js +1 -1
  261. package/layers/mixins/PortalLayer.js +1 -1
  262. package/layers/mixins/SceneService.js +1 -1
  263. package/layers/mixins/refresh.js +1 -1
  264. package/layers/ogc/dateUtils.js +1 -1
  265. package/layers/ogc/ogcFeatureUtils.js +1 -1
  266. package/layers/ogc/wfsUtils.js +1 -1
  267. package/layers/save/featureLayerUtils.js +1 -1
  268. package/layers/support/ExportImageParameters.js +1 -1
  269. package/layers/support/ExportImageServiceParameters.js +1 -1
  270. package/layers/support/ExportWMSImageParameters.js +1 -1
  271. package/layers/support/FeatureEffect.js +1 -1
  272. package/layers/support/FeatureType.js +1 -1
  273. package/layers/support/FetchAssociatedFeatureLayer.js +1 -1
  274. package/layers/support/LabelClass.js +1 -1
  275. package/layers/support/LayerContingentValuesCache.js +1 -1
  276. package/layers/support/RasterFunction.js +1 -1
  277. package/layers/support/RasterInfo.js +1 -1
  278. package/layers/support/RasterJobHandler.js +1 -1
  279. package/layers/support/RasterWorker.js +1 -1
  280. package/layers/support/Sublayer.js +1 -1
  281. package/layers/support/SubtypeSublayer.js +1 -1
  282. package/layers/support/TilemapCache.js +1 -1
  283. package/layers/support/TimeReference.d.ts +4 -0
  284. package/layers/support/WMTSSublayer.js +1 -1
  285. package/layers/support/arcgisLayers.js +1 -1
  286. package/layers/support/commonProperties.js +1 -1
  287. package/layers/support/editableLayers.js +1 -1
  288. package/layers/support/fieldUtils.js +1 -1
  289. package/layers/support/floorFilterUtils.js +1 -1
  290. package/layers/support/imageryRendererUtils.js +1 -1
  291. package/layers/support/layerUtils.js +1 -1
  292. package/layers/support/layersCreator.js +1 -1
  293. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  294. package/layers/support/rasterDatasets/CloudRaster.js +1 -1
  295. package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
  296. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  297. package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
  298. package/layers/support/rasterDatasets/MRFRaster.js +1 -1
  299. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  300. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  301. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  302. package/layers/support/rasterDatasets/pamParser.js +1 -1
  303. package/layers/support/rasterDatasets/wcsCapabilitiesParser.js +1 -1
  304. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  305. package/layers/support/rasterDatasets/xmlUtilities.js +1 -1
  306. package/layers/support/rasterFormats/Lerc.js +1 -1
  307. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  308. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  309. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  310. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  311. package/layers/support/rasterFunctions/stretchUtils.js +1 -1
  312. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  313. package/layers/support/rasterTransforms/PolynomialTransform.js +1 -1
  314. package/layers/support/rasterTransforms/utils.js +1 -1
  315. package/layers/support/source/DataLayerSource.js +1 -1
  316. package/layers/support/source/QueryTableDataSource.js +1 -1
  317. package/layers/support/vectorTileLayerLoader.js +1 -1
  318. package/layers/support/wmsUtils.js +1 -1
  319. package/layers/support/wmtsUtils.js +1 -1
  320. package/libs/maquette-advanced-projector/projector.js +1 -1
  321. package/networks/Network.js +1 -1
  322. package/networks/UtilityNetwork.js +1 -1
  323. package/networks/support/utils.js +1 -1
  324. package/package.json +1 -1
  325. package/popup/content/ExpressionContent.js +1 -1
  326. package/portal/Portal.js +1 -1
  327. package/portal/PortalItem.js +1 -1
  328. package/portal/support/geometryServiceUtils.js +1 -1
  329. package/portal/support/layersLoader.js +1 -1
  330. package/portal/support/portalItemUtils.js +1 -1
  331. package/portal/support/portalLayers.js +1 -1
  332. package/renderers/DictionaryRenderer.js +1 -1
  333. package/renderers/FlowRenderer.js +1 -1
  334. package/renderers/RasterColormapRenderer.js +1 -1
  335. package/renderers/RasterStretchRenderer.js +1 -1
  336. package/renderers/VectorFieldRenderer.js +1 -1
  337. package/renderers/support/RasterSymbolizer.js +1 -1
  338. package/renderers/support/UniqueValueInfo.js +1 -1
  339. package/renderers/support/colorRampUtils.js +1 -1
  340. package/renderers/support/heatmapUtils.js +1 -1
  341. package/renderers/support/rasterRendererHelper.js +1 -1
  342. package/request.js +1 -1
  343. package/rest/identify.js +1 -1
  344. package/rest/imageService.js +1 -1
  345. package/rest/networkService.js +1 -1
  346. package/rest/networks/support/SynthesizeAssociationGeometriesParameters.js +1 -1
  347. package/rest/operations/identify.js +1 -1
  348. package/rest/print.js +1 -1
  349. package/rest/query/executeQuery.js +1 -1
  350. package/rest/query/operations/query.js +1 -1
  351. package/rest/query/operations/queryRelatedRecords.js +1 -1
  352. package/rest/query/operations/queryTopFeatures.js +1 -1
  353. package/rest/route.js +1 -1
  354. package/rest/support/DirectionLine.js +1 -1
  355. package/rest/support/DirectionPoint.js +1 -1
  356. package/rest/support/DirectionsFeatureSet.js +1 -1
  357. package/rest/support/FeatureSet.js +1 -1
  358. package/rest/support/ImageSampleParameters.js +1 -1
  359. package/rest/support/PointBarrier.js +1 -1
  360. package/rest/support/PolygonBarrier.js +1 -1
  361. package/rest/support/PolylineBarrier.js +1 -1
  362. package/rest/support/RouteInfo.js +1 -1
  363. package/rest/support/Stop.js +1 -1
  364. package/rest/support/meshFeatureSet.js +1 -1
  365. package/rest/support/printTaskUtils.js +1 -1
  366. package/smartMapping/labels/clusters.js +1 -1
  367. package/smartMapping/raster/renderers/rgb.js +1 -1
  368. package/smartMapping/raster/renderers/uniqueValue.js +1 -1
  369. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  370. package/smartMapping/raster/support/adapters/RasterLayerAdapter.js +1 -1
  371. package/smartMapping/raster/support/utils.js +1 -1
  372. package/smartMapping/renderers/color.js +1 -1
  373. package/smartMapping/renderers/size.js +1 -1
  374. package/smartMapping/renderers/support/utils.js +1 -1
  375. package/smartMapping/renderers/univariateColorSize.js +1 -1
  376. package/smartMapping/statistics/support/WorkerClient.js +1 -1
  377. package/smartMapping/support/adapters/CSVLayerAdapter.js +1 -1
  378. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  379. package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
  380. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  381. package/smartMapping/support/adapters/support/utils.js +1 -1
  382. package/statistics/utils.js +1 -1
  383. package/support/LayersMixin.js +1 -1
  384. package/support/TablesMixin.js +1 -1
  385. package/support/arcadeUtils.js +1 -1
  386. package/support/basemapUtils.js +1 -1
  387. package/support/popupUtils.js +1 -1
  388. package/support/revision.js +1 -1
  389. package/support/timeUtils.js +1 -1
  390. package/symbols/FillSymbol3DLayer.js +1 -1
  391. package/symbols/LineSymbol3DLayer.js +1 -1
  392. package/symbols/LineSymbolMarker.js +1 -1
  393. package/symbols/PictureFillSymbol.js +1 -1
  394. package/symbols/PointSymbol3D.js +1 -1
  395. package/symbols/SimpleLineSymbol.js +1 -1
  396. package/symbols/SimpleMarkerSymbol.js +1 -1
  397. package/symbols/cim/CIMResourceManager.js +1 -1
  398. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  399. package/symbols/cim/CIMSymbolHelper.js +1 -1
  400. package/symbols/cim/ExpandedCIM.js +1 -1
  401. package/symbols/cim/SDFHelper.js +1 -1
  402. package/symbols/cim/cimAnalyzer.js +1 -1
  403. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  404. package/symbols/cim/effects/EffectDashes.js +1 -1
  405. package/symbols/cim/effects/EffectOffset.js +1 -1
  406. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  407. package/symbols/cim/utils.js +1 -1
  408. package/symbols/support/cimSymbolUtils.js +1 -1
  409. package/symbols/support/jsonUtils.js +1 -1
  410. package/symbols/support/previewCIMSymbol.js +1 -1
  411. package/symbols/support/previewSymbol2D.js +1 -1
  412. package/symbols/support/previewSymbol3D.js +1 -1
  413. package/symbols/support/previewWebStyleSymbol.js +1 -1
  414. package/symbols/support/svgUtils.js +1 -1
  415. package/symbols/support/symbolConversion.js +1 -1
  416. package/symbols/support/symbolUtils.js +1 -1
  417. package/tasks/GenerateRendererTask.js +1 -1
  418. package/views/2d/MapViewConstraints.js +1 -1
  419. package/views/2d/constraints/GeometryConstraint.js +1 -1
  420. package/views/2d/engine/Bitmap.js +1 -1
  421. package/views/2d/engine/Container.js +1 -1
  422. package/views/2d/engine/DisplayObject.js +1 -1
  423. package/views/2d/engine/Stage.js +1 -1
  424. package/views/2d/engine/imagery/BrushRasterBitmap.js +1 -1
  425. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  426. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  427. package/views/2d/engine/vectorTiles/TilemapRequest.js +1 -1
  428. package/views/2d/engine/vectorTiles/WorkerTileHandler.js +1 -1
  429. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  430. package/views/2d/engine/vectorTiles/buckets/LineBucket.js +1 -1
  431. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  432. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  433. package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
  434. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  435. package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
  436. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  437. package/views/2d/engine/webgl/GraphicTile.js +1 -1
  438. package/views/2d/engine/webgl/TextureManager.js +1 -1
  439. package/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js +1 -1
  440. package/views/2d/engine/webgl/brushes/WGLBrushVTLCircle.js +1 -1
  441. package/views/2d/engine/webgl/brushes/WGLBrushVTLFill.js +1 -1
  442. package/views/2d/engine/webgl/brushes/WGLBrushVTLLine.js +1 -1
  443. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  444. package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
  445. package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
  446. package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
  447. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  448. package/views/2d/engine/webgl/mesh/templates/WGLBaseLineTemplate.js +1 -1
  449. package/views/2d/engine/webgl/mesh/templates/WGLBaseMarkerTemplate.js +1 -1
  450. package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
  451. package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
  452. package/views/2d/engine/webgl/mesh/templates/WGLLabelTemplate.js +1 -1
  453. package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
  454. package/views/2d/engine/webgl/mesh/templates/WGLMeshTemplate.js +1 -1
  455. package/views/2d/engine/webgl/painter/RenderPass.js +1 -1
  456. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  457. package/views/2d/engine/webgl/techniques/dotDensity/TechniqueDotDensity.js +1 -1
  458. package/views/2d/input/MapViewInputManager.js +1 -1
  459. package/views/2d/input/handlers/GamepadNavigation.js +1 -1
  460. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  461. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  462. package/views/2d/layers/BaseLayerView2D.js +1 -1
  463. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  464. package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
  465. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  466. package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
  467. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  468. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  469. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  470. package/views/2d/layers/KMLLayerView2D.js +1 -1
  471. package/views/2d/layers/LayerView2D.js +1 -1
  472. package/views/2d/layers/SubtypeGroupLayerView2D.js +1 -1
  473. package/views/2d/layers/TileLayerView2D.js +1 -1
  474. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  475. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  476. package/views/2d/layers/features/FeatureStore2D.js +1 -1
  477. package/views/2d/layers/features/Pipeline.js +1 -1
  478. package/views/2d/layers/features/batchUtils.js +1 -1
  479. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  480. package/views/2d/layers/features/controllers/support/sourceAdapters.js +1 -1
  481. package/views/2d/layers/features/createSymbolSchema.js +1 -1
  482. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  483. package/views/2d/layers/features/schemaUtils.js +1 -1
  484. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  485. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  486. package/views/2d/layers/features/sources/DataTileSubscription.js +1 -1
  487. package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
  488. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  489. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  490. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  491. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  492. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  493. package/views/2d/layers/features/support/ResourceManagerProxy.js +1 -1
  494. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  495. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  496. package/views/2d/layers/graphics/graphicsUtils.js +1 -1
  497. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  498. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  499. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  500. package/views/2d/layers/support/ExportStrategy.js +1 -1
  501. package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
  502. package/views/2d/magnifier/MagnifierView2D.js +1 -1
  503. package/views/2d/support/engineHelpers.js +1 -1
  504. package/views/2d/tiling/TileManager.js +1 -1
  505. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  506. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  507. package/views/3d/analysis/Dimensioning/DimensioningVisualization.js +5 -0
  508. package/views/3d/analysis/Dimensioning/LinearDimensionVisualization.js +5 -0
  509. package/views/3d/analysis/DimensioningAnalysisView3D.js +1 -1
  510. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  511. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  512. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  513. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  514. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  515. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  516. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  517. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  518. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  519. package/views/3d/environment/Clouds.glsl.js +1 -1
  520. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  521. package/views/3d/environment/CloudsComposition.js +1 -1
  522. package/views/3d/environment/CloudsCompositionParameters.js +5 -0
  523. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  524. package/views/3d/environment/Fog.glsl.js +1 -1
  525. package/views/3d/environment/Fog.js +1 -1
  526. package/views/3d/environment/Precipitation.js +1 -1
  527. package/views/3d/environment/SceneViewEnvironment.js +1 -1
  528. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  529. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  530. package/views/3d/environment/Stars.glsl.js +1 -1
  531. package/views/3d/environment/Stars.js +1 -1
  532. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  533. package/views/3d/glTF/internal/Resource.js +1 -1
  534. package/views/3d/glTF/loader.js +1 -1
  535. package/views/3d/input/SceneInputManager.js +1 -1
  536. package/views/3d/input/handlers/TwoFingerTilt.js +1 -1
  537. package/views/3d/interactive/Manipulator3D.js +1 -1
  538. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  539. package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
  540. package/views/3d/interactive/editingTools/moveGraphic/isSupportedGraphic.js +1 -1
  541. package/views/3d/interactive/editingTools/reshapeGraphic/GraphicReshapeTool.js +1 -1
  542. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  543. package/views/3d/interactive/editingTools/reshapeGraphic/isSupportedGraphic.js +1 -1
  544. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  545. package/views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js +1 -1
  546. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  547. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  548. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  549. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  550. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  551. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  552. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  553. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  554. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  555. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  556. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  557. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  558. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  559. package/views/3d/layers/GraphicsView3D.js +1 -1
  560. package/views/3d/layers/I3SMeshView3D.js +1 -1
  561. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  562. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  563. package/views/3d/layers/LayerView3D.js +1 -1
  564. package/views/3d/layers/RouteLayerView3D.js +1 -1
  565. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  566. package/views/3d/layers/SceneLayerView3D.js +1 -1
  567. package/views/3d/layers/SceneLayerWorker.js +1 -1
  568. package/views/3d/layers/StreamLayerView3D.js +1 -1
  569. package/views/3d/layers/TiledLayerView3D.js +1 -1
  570. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  571. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  572. package/views/3d/layers/WMSLayerView3D.js +1 -1
  573. package/views/3d/layers/WMTSLayerView3D.js +1 -1
  574. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  575. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  576. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  577. package/views/3d/layers/graphics/Graphics3DFilterVisibility.js +1 -1
  578. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  579. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  580. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  581. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  582. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  583. package/views/3d/layers/graphics/Graphics3DPointSymbol.js +1 -1
  584. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  585. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  586. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  587. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  588. package/views/3d/layers/graphics/Labeler.js +1 -1
  589. package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
  590. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  591. package/views/3d/layers/i3s/I3SStreamDataController.js +1 -1
  592. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  593. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  594. package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
  595. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  596. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  597. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  598. package/views/3d/state/ConstraintsManager.js +1 -1
  599. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  600. package/views/3d/support/ResourceController.js +1 -1
  601. package/views/3d/support/SharedSymbolResources.js +1 -1
  602. package/views/3d/support/TextureCollection.js +1 -1
  603. package/views/3d/support/cameraUtils.js +1 -1
  604. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  605. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  606. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  607. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  608. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  609. package/views/3d/terrain/OverlayManager.js +1 -1
  610. package/views/3d/terrain/OverlayRenderer.js +1 -1
  611. package/views/3d/terrain/PatchGeometry.js +1 -1
  612. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  613. package/views/3d/terrain/PatchRenderData.js +1 -1
  614. package/views/3d/terrain/PlanarPatch.js +1 -1
  615. package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
  616. package/views/3d/terrain/RasterTile.js +1 -1
  617. package/views/3d/terrain/SphericalPatch.js +1 -1
  618. package/views/3d/terrain/TerrainRenderer.js +1 -1
  619. package/views/3d/terrain/TerrainSurface.js +1 -1
  620. package/views/3d/terrain/Tile.js +1 -1
  621. package/views/3d/terrain/TileCompositor.js +1 -1
  622. package/views/3d/terrain/TileRenderer.js +1 -1
  623. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  624. package/views/3d/terrain/terrainUtils.js +1 -1
  625. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  626. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  627. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  628. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +2 -2
  629. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  630. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +1 -1
  631. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +5 -5
  632. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +8 -8
  633. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +6 -6
  634. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +4 -4
  635. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +2 -2
  636. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +5 -5
  637. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +13 -13
  638. package/views/3d/webgl-engine/core/shaderLibrary/raster/BasicGrid.glsl.js +2 -2
  639. package/views/3d/webgl-engine/core/shaderLibrary/raster/Colormap.glsl.js +1 -1
  640. package/views/3d/webgl-engine/core/shaderLibrary/raster/Common.glsl.js +2 -2
  641. package/views/3d/webgl-engine/core/shaderLibrary/raster/Projection.glsl.js +1 -1
  642. package/views/3d/webgl-engine/core/shaderLibrary/raster/RasterColorizer.glsl.js +1 -1
  643. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +1 -1
  644. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +5 -5
  645. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js +3 -3
  646. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +13 -13
  647. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +17 -17
  648. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
  649. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +7 -7
  650. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js +2 -2
  651. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +5 -5
  652. package/views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js +2 -2
  653. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +15 -15
  654. package/views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js +2 -2
  655. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  656. package/views/3d/webgl-engine/core/shaderModules/BooleanPassUniform.js +5 -0
  657. package/views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js +5 -0
  658. package/views/3d/webgl-engine/core/shaderModules/{Matrix3Uniform.js → Float4PassUniform.js} +1 -1
  659. package/views/3d/webgl-engine/core/shaderModules/Float4Uniform.js +1 -1
  660. package/views/3d/webgl-engine/core/shaderModules/Matrix3DrawUniform.js +5 -0
  661. package/views/3d/webgl-engine/core/shaderModules/Matrix3PassUniform.js +5 -0
  662. package/views/3d/webgl-engine/core/shaderModules/{TextureCubeUniform.js → TextureCubePassUniform.js} +1 -1
  663. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js +1 -1
  664. package/views/3d/webgl-engine/lib/AutoDisposable.js +1 -1
  665. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  666. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  667. package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
  668. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  669. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  670. package/views/3d/webgl-engine/lib/ShadowHighlight.js +1 -1
  671. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  672. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  673. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  674. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  675. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  676. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  677. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  678. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  679. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  680. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  681. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  682. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  683. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  684. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  685. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  686. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  687. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  688. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  689. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  690. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  691. package/views/3d/webgl-engine/materials/{VisualVariableMaterialParameters.js → VisualVariablePassParameters.js} +1 -1
  692. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  693. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  694. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  695. package/views/3d/webgl-engine/parts/requireUtils.js +1 -1
  696. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  697. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  698. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  699. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  700. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  701. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  702. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  703. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
  704. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  705. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  706. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
  707. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  708. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  709. package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +3 -3
  710. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  711. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  712. package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
  713. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  714. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  715. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  716. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  717. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  718. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  719. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  720. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  721. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +3 -3
  722. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShader.glsl.js +1 -1
  723. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +5 -5
  724. package/views/BasemapView.js +1 -1
  725. package/views/GroundView.js +1 -1
  726. package/views/LayerViewManager.js +1 -1
  727. package/views/MapView.js +1 -1
  728. package/views/SceneView.js +1 -1
  729. package/views/ToolViewManager.js +1 -1
  730. package/views/View.js +1 -1
  731. package/views/draw/DrawAction.js +1 -1
  732. package/views/draw/DrawGraphicTool.js +1 -1
  733. package/views/draw/DrawOperation.js +1 -1
  734. package/views/draw/DrawTool.js +1 -1
  735. package/views/draw/support/Box.js +1 -1
  736. package/views/draw/support/GraphicMover.js +1 -1
  737. package/views/draw/support/Reshape.js +1 -1
  738. package/views/interactive/coordinateHelper.js +1 -1
  739. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  740. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  741. package/views/interactive/snapping/SnappingManager.js +1 -1
  742. package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
  743. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  744. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  745. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  746. package/views/layers/FeatureLayerView.js +1 -1
  747. package/views/layers/GroupLayerView.js +1 -1
  748. package/views/layers/ImageryLayerView.js +1 -1
  749. package/views/layers/ImageryTileLayerView.js +1 -1
  750. package/views/layers/LayerView.js +1 -1
  751. package/views/layers/MapImageLayerView.js +1 -1
  752. package/views/layers/WMSLayerView.js +1 -1
  753. package/views/support/AllocationTracer.js +1 -1
  754. package/views/support/DefaultsFromMap.js +1 -1
  755. package/views/support/geometry2dUtils.js +1 -1
  756. package/views/support/layerViewUtils.js +1 -1
  757. package/views/support/waitForResources.js +1 -1
  758. package/views/ui/UI.js +1 -1
  759. package/views/webgl/BufferObject.js +1 -1
  760. package/views/webgl/FramebufferObject.js +1 -1
  761. package/views/webgl/RenderingContext.js +1 -1
  762. package/views/webgl/Texture.js +1 -1
  763. package/views/webgl/UniformBufferLayout.js +1 -1
  764. package/views/webgl/VertexArrayObject.js +1 -1
  765. package/views/webgl/capabilities.js +1 -1
  766. package/views/webgl/rasterUtils.js +1 -1
  767. package/views/webgl/testFloatBufferBlend.js +1 -1
  768. package/webdoc/widgets/TimeSlider.js +1 -1
  769. package/webmap/Bookmark.js +1 -1
  770. package/webscene/Slide.js +1 -1
  771. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  772. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  773. package/widgets/AreaMeasurement2D.js +1 -1
  774. package/widgets/AreaMeasurement3D.js +1 -1
  775. package/widgets/Attribution.js +1 -1
  776. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  777. package/widgets/BasemapGallery/support/BasemapGalleryItem.js +1 -1
  778. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  779. package/widgets/BasemapLayerList.js +1 -1
  780. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  781. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  782. package/widgets/Bookmarks.js +1 -1
  783. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  784. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  785. package/widgets/BuildingExplorer/BuildingLevel.js +1 -1
  786. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  787. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  788. package/widgets/BuildingExplorer/BuildingPhase.js +1 -1
  789. package/widgets/BuildingExplorer/support/buildingLayerUtils.js +1 -1
  790. package/widgets/BuildingExplorer.js +1 -1
  791. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  792. package/widgets/CoordinateConversion/support/Format.js +1 -1
  793. package/widgets/Daylight/DaylightViewModel.js +1 -1
  794. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  795. package/widgets/Daylight.js +1 -1
  796. package/widgets/DirectLineMeasurement3D.js +1 -1
  797. package/widgets/Directions/DirectionsViewModel.js +1 -1
  798. package/widgets/Directions.js +1 -1
  799. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  800. package/widgets/DistanceMeasurement2D.js +1 -1
  801. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  802. package/widgets/Editor/CreateWorkflow.js +1 -1
  803. package/widgets/Editor/EditorViewModel.js +1 -1
  804. package/widgets/Editor/UpdateWorkflow.js +1 -1
  805. package/widgets/Editor/workflowUtils.js +1 -1
  806. package/widgets/Editor.js +1 -1
  807. package/widgets/ElevationProfile/ElevationProfileLineGround.js +1 -1
  808. package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
  809. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  810. package/widgets/ElevationProfile/ElevationProfileTool.js +1 -1
  811. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  812. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  813. package/widgets/ElevationProfile/support/elevationQuerySourceUtils.js +1 -1
  814. package/widgets/ElevationProfile/support/profileUtils.js +1 -1
  815. package/widgets/ElevationProfile.js +1 -1
  816. package/widgets/Expand.js +1 -1
  817. package/widgets/Feature/FeatureAttachments.js +1 -1
  818. package/widgets/Feature/FeatureContent.js +1 -1
  819. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  820. package/widgets/Feature/FeatureExpression.js +1 -1
  821. package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
  822. package/widgets/Feature/FeatureFields.js +1 -1
  823. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  824. package/widgets/Feature/FeatureMedia.js +1 -1
  825. package/widgets/Feature/FeatureViewModel.js +1 -1
  826. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  827. package/widgets/Feature/support/featureUtils.js +1 -1
  828. package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
  829. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  830. package/widgets/FeatureForm/InputField.js +1 -1
  831. package/widgets/FeatureForm/support/formTemplateUtils.js +1 -1
  832. package/widgets/FeatureForm.js +1 -1
  833. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  834. package/widgets/FeatureTable/FieldColumn.js +1 -1
  835. package/widgets/FeatureTable/Grid/Column.js +1 -1
  836. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  837. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  838. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  839. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  840. package/widgets/FeatureTable/Grid/support/LocalStore.js +1 -1
  841. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  842. package/widgets/FeatureTable.js +1 -1
  843. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  844. package/widgets/FeatureTemplates/ItemList.js +1 -1
  845. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  846. package/widgets/FeatureTemplates.js +1 -1
  847. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  848. package/widgets/FloorFilter.js +1 -1
  849. package/widgets/Fullscreen.js +1 -1
  850. package/widgets/Home.js +1 -1
  851. package/widgets/LayerList/LayerListViewModel.js +1 -1
  852. package/widgets/LayerList/support/layerListUtils.js +1 -1
  853. package/widgets/LayerList.js +1 -1
  854. package/widgets/Legend/LegendViewModel.js +1 -1
  855. package/widgets/Legend/styles/Card.js +1 -1
  856. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  857. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  858. package/widgets/Legend/support/clusterUtils.js +1 -1
  859. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  860. package/widgets/Locate/LocateViewModel.js +1 -1
  861. package/widgets/Popup/PopupViewModel.js +1 -1
  862. package/widgets/Popup/actionUtils.js +1 -1
  863. package/widgets/Popup.js +1 -1
  864. package/widgets/Print/PrintViewModel.js +1 -1
  865. package/widgets/Print.js +1 -1
  866. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  867. package/widgets/Search/LayerSearchSource.js +1 -1
  868. package/widgets/Search/SearchResultRenderer.js +1 -1
  869. package/widgets/Search/SearchViewModel.js +1 -1
  870. package/widgets/Search/support/geometryUtils.js +1 -1
  871. package/widgets/Search/support/layerSearchUtils.js +1 -1
  872. package/widgets/Search/support/locatorUtils.js +1 -1
  873. package/widgets/Search.js +1 -1
  874. package/widgets/ShadowCast/components/DiscreteConfigurator.js +1 -1
  875. package/widgets/ShadowCast/components/Label.js +1 -1
  876. package/widgets/ShadowCast/components/TimezonePicker.js +1 -1
  877. package/widgets/ShadowCast.js +1 -1
  878. package/widgets/Sketch/SketchViewModel.js +1 -1
  879. package/widgets/Sketch.js +1 -1
  880. package/widgets/Slider.js +1 -1
  881. package/widgets/Swipe/SwipeViewModel.js +1 -1
  882. package/widgets/TableList/TableListViewModel.js +1 -1
  883. package/widgets/TableList/support/tableListUtils.js +1 -1
  884. package/widgets/TableList.js +1 -1
  885. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  886. package/widgets/TimeSlider/utils.js +1 -1
  887. package/widgets/TimeSlider.js +1 -1
  888. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  889. package/widgets/Weather.js +1 -1
  890. package/widgets/Widget.js +1 -1
  891. package/widgets/smartMapping/BinaryColorSizeSlider/BinaryColorSizeSliderViewModel.js +1 -1
  892. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  893. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  894. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  895. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  896. package/widgets/smartMapping/SizeSlider/SizeSliderViewModel.js +1 -1
  897. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  898. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  899. package/widgets/support/AnalysisViewModel.js +1 -1
  900. package/widgets/support/ColorPicker.js +1 -1
  901. package/widgets/support/DatePicker.js +1 -1
  902. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  903. package/widgets/support/Popover.js +1 -1
  904. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  905. package/widgets/support/SelectionToolbar.js +1 -1
  906. package/widgets/support/Selector2D/SelectionOperation2D.js +1 -1
  907. package/widgets/support/Selector2D.js +1 -1
  908. package/widgets/support/SnappingControls/SnappingControlsViewModel.js +1 -1
  909. package/widgets/support/SnappingControls.js +1 -1
  910. package/widgets/support/jsxWidgetSupport.js +1 -1
  911. package/widgets/support/widgetUtils.js +1 -1
  912. package/assets/esri/core/workers/chunks/049c5c30bd37693dddb7.js +0 -1
  913. package/assets/esri/core/workers/chunks/055a0ebf22a82f859474.js +0 -1
  914. package/assets/esri/core/workers/chunks/0b12ff7b2ed2838afbb8.js +0 -1
  915. package/assets/esri/core/workers/chunks/0e25548573baf855e394.js +0 -1
  916. package/assets/esri/core/workers/chunks/0edd4c3ca6e7d749d0e5.js +0 -1
  917. package/assets/esri/core/workers/chunks/0fcbf7e2db58e38ee6d1.js +0 -1
  918. package/assets/esri/core/workers/chunks/133f971e72a1a6277ac4.js +0 -1
  919. package/assets/esri/core/workers/chunks/135a90ae61f3b3cae91b.js +0 -1
  920. package/assets/esri/core/workers/chunks/13fde7fd56c39fa3f2d5.js +0 -1
  921. package/assets/esri/core/workers/chunks/1c90855c3b0e5dcff908.js +0 -1
  922. package/assets/esri/core/workers/chunks/1dbef1919c7ac10a6bcc.js +0 -1
  923. package/assets/esri/core/workers/chunks/1facbda248863cf72cbd.js +0 -1
  924. package/assets/esri/core/workers/chunks/1fb2d7abe6c8efa84695.js +0 -1
  925. package/assets/esri/core/workers/chunks/2068377c2a796d5f2245.js +0 -1
  926. package/assets/esri/core/workers/chunks/28a5878cbe5880476855.js +0 -1
  927. package/assets/esri/core/workers/chunks/2cf3934b3ecabdf207c8.js +0 -1
  928. package/assets/esri/core/workers/chunks/2d42711a629384144625.js +0 -1
  929. package/assets/esri/core/workers/chunks/3021fda52083fc67d18c.js +0 -1
  930. package/assets/esri/core/workers/chunks/30333a95dc0a44e23fb5.js +0 -1
  931. package/assets/esri/core/workers/chunks/30837d93116f0337972f.js +0 -1
  932. package/assets/esri/core/workers/chunks/320543485c8e22485075.js +0 -1
  933. package/assets/esri/core/workers/chunks/3f0f7da92a6e4493686e.js +0 -1
  934. package/assets/esri/core/workers/chunks/42057f252ba4e82a8b45.js +0 -1
  935. package/assets/esri/core/workers/chunks/45a3f6033cdf4bc74a4c.js +0 -1
  936. package/assets/esri/core/workers/chunks/492b65fe99641f5740f0.js +0 -1
  937. package/assets/esri/core/workers/chunks/4d1cd7df617273c489f4.js +0 -1
  938. package/assets/esri/core/workers/chunks/4df9dfa80dbbae9b743d.js +0 -1
  939. package/assets/esri/core/workers/chunks/515c1c055666ff4740f3.js +0 -1
  940. package/assets/esri/core/workers/chunks/541e644fc77dbe527124.js +0 -1
  941. package/assets/esri/core/workers/chunks/59e341b2db44351bf557.js +0 -1
  942. package/assets/esri/core/workers/chunks/5a10b58533b4116115ac.js +0 -1
  943. package/assets/esri/core/workers/chunks/5f940853341d7e2bc852.js +0 -1
  944. package/assets/esri/core/workers/chunks/5ff2cdecf95e0136dd52.js +0 -1
  945. package/assets/esri/core/workers/chunks/6147bfbe2bd7292d6ad0.js +0 -1
  946. package/assets/esri/core/workers/chunks/6467f996fe9f136c370b.js +0 -1
  947. package/assets/esri/core/workers/chunks/682a8f15f352de76df69.js +0 -1
  948. package/assets/esri/core/workers/chunks/6a06635089761ee3e6d4.js +0 -972
  949. package/assets/esri/core/workers/chunks/725828a41917d3d56f2d.js +0 -1
  950. package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +0 -1
  951. package/assets/esri/core/workers/chunks/7fd03a75eb07a09cda35.js +0 -1
  952. package/assets/esri/core/workers/chunks/86ad6b020c01850d9095.js +0 -1
  953. package/assets/esri/core/workers/chunks/86f9d1ce36661781d962.js +0 -1
  954. package/assets/esri/core/workers/chunks/8dcf6c836b53b40dfbf1.js +0 -1
  955. package/assets/esri/core/workers/chunks/8e98ff9404a802352037.js +0 -1
  956. package/assets/esri/core/workers/chunks/94e51fe1c539df6257c2.js +0 -1
  957. package/assets/esri/core/workers/chunks/9519a02b9b8db88a3150.js +0 -1
  958. package/assets/esri/core/workers/chunks/9a8b50ed75219b4a42e1.js +0 -1
  959. package/assets/esri/core/workers/chunks/9f3a094aa4b47e4eb046.js +0 -1
  960. package/assets/esri/core/workers/chunks/a0ebf25c9c9a7f839b93.js +0 -1
  961. package/assets/esri/core/workers/chunks/a25f0a195f9217665530.js +0 -1
  962. package/assets/esri/core/workers/chunks/a2be1e0b632cef87f6a4.js +0 -1
  963. package/assets/esri/core/workers/chunks/a4d8cf9829da9cfc5f36.js +0 -1
  964. package/assets/esri/core/workers/chunks/a562059dbdd1bf1fab66.js +0 -1
  965. package/assets/esri/core/workers/chunks/a59ee7d2b98c85f27dd2.js +0 -1
  966. package/assets/esri/core/workers/chunks/a5dbab94697757c87c49.js +0 -1
  967. package/assets/esri/core/workers/chunks/a5e65d5a7a536759d1cc.js +0 -1
  968. package/assets/esri/core/workers/chunks/a8ac0b6a3eba35e3a5b6.js +0 -1
  969. package/assets/esri/core/workers/chunks/acbd0f4d72d1f5d8e4e8.js +0 -1
  970. package/assets/esri/core/workers/chunks/acc97a210f36bff2d1b0.js +0 -1
  971. package/assets/esri/core/workers/chunks/ad68fe924456d6d7d4f0.js +0 -1
  972. package/assets/esri/core/workers/chunks/b06c949fc7d08e376a5f.js +0 -1
  973. package/assets/esri/core/workers/chunks/b26bd8fde2fc65bb67fb.js +0 -1
  974. package/assets/esri/core/workers/chunks/b4405e9fe6c0cf7250d3.js +0 -1
  975. package/assets/esri/core/workers/chunks/bc08fe3b03767bd694c5.js +0 -1
  976. package/assets/esri/core/workers/chunks/c11501e96ffd81bf39a0.js +0 -1
  977. package/assets/esri/core/workers/chunks/c44116378cc1bc627044.js +0 -1
  978. package/assets/esri/core/workers/chunks/c9b09099488d0e719dfb.js +0 -1
  979. package/assets/esri/core/workers/chunks/cbea4f1eb814115748db.js +0 -1
  980. package/assets/esri/core/workers/chunks/ce262a2accd982988ef1.js +0 -1
  981. package/assets/esri/core/workers/chunks/d15e6662d90718411d62.js +0 -1
  982. package/assets/esri/core/workers/chunks/d16aac3461af9cee0c29.js +0 -1
  983. package/assets/esri/core/workers/chunks/d60dd3e1028f714f2258.js +0 -1
  984. package/assets/esri/core/workers/chunks/d6c150c243ca1f6108f9.js +0 -1
  985. package/assets/esri/core/workers/chunks/d85748b57a71999caf3a.js +0 -1
  986. package/assets/esri/core/workers/chunks/d8c59b1d73650c060dfb.js +0 -1
  987. package/assets/esri/core/workers/chunks/dcb6e1b33402d7fa455b.js +0 -1
  988. package/assets/esri/core/workers/chunks/df653bca2b14dffc82d1.js +0 -1
  989. package/assets/esri/core/workers/chunks/e2a12142439d3037a3a7.js +0 -1
  990. package/assets/esri/core/workers/chunks/e3e1d87b8532bf84a18d.js +0 -1
  991. package/assets/esri/core/workers/chunks/e7744b7e0c16bba93151.js +0 -1
  992. package/assets/esri/core/workers/chunks/ea50effc5c39870dc871.js +0 -1
  993. package/assets/esri/core/workers/chunks/f1665a64564593f2a438.js +0 -1
  994. package/assets/esri/core/workers/chunks/f4c12f3a5e7f89106ae0.js +0 -1
  995. package/assets/esri/core/workers/chunks/fbefdc74b3aab716187f.js +0 -1
  996. package/assets/esri/core/workers/chunks/fc4fd9db056579e09bfe.js +0 -1
  997. package/assets/esri/core/workers/chunks/fd4907fa96f55128764d.js +0 -1
  998. package/views/3d/webgl-engine/core/shaderModules/BooleanUniform.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import t from"../../../geometry/Extent.js";import{getElementValue as r,getElement as i,getElements as o,getSpaceDelimitedNumericValues as n,getElementValues as a,isSameTagIgnoreNS as s,getNodeNameIgnoreNS as l}from"./xmlUtilities.js";function c(e){return e.indexOf("?")===e.length-1?e.substring(0,e.length-1):e}function u(e){var a,s,l;const u=r(e,"Service/name"),m=i(e,"Capability"),p=null!=(a=i(m,"GetCapabilities/Get/OnlineResource").getAttribute("xlink:href"))?a:"",g=null!=(s=i(m,"DescribeCoverage/Get/OnlineResource").getAttribute("xlink:href"))?s:"",f=null!=(l=i(m,"GetCoverage/Get/OnlineResource").getAttribute("xlink:href"))?l:"",v={getCapabilities:c(p),describeCoverage:c(g),getCoverage:c(f)},d=o(e,"CoverageOfferingBrief"),b=[];for(let i=0;i<d.length;i++){const e=d[i],a=r(e,"name"),s=o(e,"pos"),l=n(s[0]),c=n(s[1]),u=new t({xmin:l[0],ymin:l[1],xmax:c[0],ymax:c[1],spatialReference:{wkid:4326}});b.push({id:a,lonLatEnvelope:u})}return{name:u,onlineResources:v,coverages:b,supportedVersions:["1.0.0"]}}function m(e){const i={};for(let o=0;o<e.childNodes.length;o++){const a=e.childNodes[o];if(1!==a.nodeType)continue;const s=l(a).toLowerCase();switch(s){case"title":case"abstract":i[s]=r(a);break;case"identifier":i.id=r(a);break;case"wgs84boundingbox":{const e=n(a,"LowerCorner"),r=n(a,"UpperCorner");i.lonLatEnvelope=new t({xmin:e[0],ymin:e[1],xmax:r[0],ymax:r[1],spatialReference:{wkid:4326}})}break;case"coveragesummary":i.coverageSummaries=i.coverageSummaries||[],i.coverageSummaries.push(m(a))}}return i}function p(e,t){if(e.coverageSummaries)for(let r=0;r<e.coverageSummaries.length;r++)e.coverageSummaries[r].abstract=e.coverageSummaries[r].abstract||e.abstract,e.coverageSummaries[r].lonLatEnvelope=e.coverageSummaries[r].lonLatEnvelope||e.lonLatEnvelope,e.coverageSummaries[r].title=e.coverageSummaries[r].title||e.title,p(e.coverageSummaries[r],t);null!=e.id&&t.push(e)}function g(e){const t=i(e.querySelector("Operation[name=GetCapabilities]"),"Get").getAttribute("xlink:href")||"",r=i(e.querySelector("Operation[name=DescribeCoverage]"),"Get").getAttribute("xlink:href")||"",o=i(e.querySelector("Operation[name=GetCoverage]"),"Get").getAttribute("xlink:href")||"";return{getCapabilities:c(t),describeCoverage:c(r),getCoverage:c(o)}}function f(e){const t=r(e,"ServiceIdentification/Title"),o=a(e,"ServiceIdentification/ServiceTypeVersion"),n=g(i(e,"OperationsMetadata")),l=[],c=i(e,"Contents");for(let r=0;r<c.childNodes.length;r++){const e=c.childNodes[r];1===e.nodeType&&(s(e,"CoverageSummary")&&p(m(e),l))}return{name:t,onlineResources:n,coverages:l,supportedVersions:o,supportedFormats:a(c,"SupportedFormat")}}function v(e){const s=i(e,"ServiceIdentification"),l=r(s,"Title"),c=a(s,"ServiceTypeVersion"),u=a(s,"Profile"),m=g(i(e,"OperationsMetadata")),p=o(e,"Contents/CoverageSummary"),f=[];for(let o=0;o<p.length;o++){const e=p[o],a=r(e,"CoverageId"),s=i(e,"WGS84BoundingBox");let l;if(s){const e=n(s,"LowerCorner"),r=n(s,"UpperCorner");l=new t({xmin:e[0],ymin:e[1],xmax:r[0],ymax:r[1],spatialReference:{wkid:4326}})}f.push({id:a,lonLatEnvelope:l})}const v=i(e,"ServiceMetadata");return{name:l,supportedVersions:c,supportedFormats:a(v,"formatSupported"),supportedInterpolations:a(v,"interpolationSupported"),onlineResources:m,profiles:u,coverages:f}}function d(t,r=null){let i=null;if("string"==typeof t){i=(new DOMParser).parseFromString(t,"text/xml")}else i=t;const o=i.documentElement.getAttribute("version"),n=(o||r||"1.0.0").slice(0,3);let a;if("2.0"===n)a=v(i);else if("1.1"===n)a=f(i);else{if("1.0"!==n)throw new e("wcsraster:parsecapabilities","the capabilities version is not supported");a=u(i)}return a.capabilitiesVersion=o,a}export{d as parseCapabilities};
5
+ import e from"../../../core/Error.js";import t from"../../../geometry/Extent.js";import{getElementValue as r,getElement as i,getElements as o,getSpaceDelimitedNumericValues as n,getElementValues as a,isSameTagIgnoreNS as s,getNodeNameIgnoreNS as c}from"./xmlUtilities.js";function l(e){return e.indexOf("?")===e.length-1?e.substring(0,e.length-1):e}function u(e){const a=r(e,"Service/name"),s=i(e,"Capability"),c=i(s,"GetCapabilities/Get/OnlineResource").getAttribute("xlink:href")??"",u=i(s,"DescribeCoverage/Get/OnlineResource").getAttribute("xlink:href")??"",m=i(s,"GetCoverage/Get/OnlineResource").getAttribute("xlink:href")??"",p={getCapabilities:l(c),describeCoverage:l(u),getCoverage:l(m)},g=o(e,"CoverageOfferingBrief"),f=[];for(let i=0;i<g.length;i++){const e=g[i],a=r(e,"name"),s=o(e,"pos"),c=n(s[0]),l=n(s[1]),u=new t({xmin:c[0],ymin:c[1],xmax:l[0],ymax:l[1],spatialReference:{wkid:4326}});f.push({id:a,lonLatEnvelope:u})}return{name:a,onlineResources:p,coverages:f,supportedVersions:["1.0.0"]}}function m(e){const i={};for(let o=0;o<e.childNodes.length;o++){const a=e.childNodes[o];if(1!==a.nodeType)continue;const s=c(a).toLowerCase();switch(s){case"title":case"abstract":i[s]=r(a);break;case"identifier":i.id=r(a);break;case"wgs84boundingbox":{const e=n(a,"LowerCorner"),r=n(a,"UpperCorner");i.lonLatEnvelope=new t({xmin:e[0],ymin:e[1],xmax:r[0],ymax:r[1],spatialReference:{wkid:4326}})}break;case"coveragesummary":i.coverageSummaries=i.coverageSummaries||[],i.coverageSummaries.push(m(a))}}return i}function p(e,t){if(e.coverageSummaries)for(let r=0;r<e.coverageSummaries.length;r++)e.coverageSummaries[r].abstract=e.coverageSummaries[r].abstract||e.abstract,e.coverageSummaries[r].lonLatEnvelope=e.coverageSummaries[r].lonLatEnvelope||e.lonLatEnvelope,e.coverageSummaries[r].title=e.coverageSummaries[r].title||e.title,p(e.coverageSummaries[r],t);null!=e.id&&t.push(e)}function g(e){const t=i(e.querySelector("Operation[name=GetCapabilities]"),"Get").getAttribute("xlink:href")||"",r=i(e.querySelector("Operation[name=DescribeCoverage]"),"Get").getAttribute("xlink:href")||"",o=i(e.querySelector("Operation[name=GetCoverage]"),"Get").getAttribute("xlink:href")||"";return{getCapabilities:l(t),describeCoverage:l(r),getCoverage:l(o)}}function f(e){const t=r(e,"ServiceIdentification/Title"),o=a(e,"ServiceIdentification/ServiceTypeVersion"),n=g(i(e,"OperationsMetadata")),c=[],l=i(e,"Contents");for(let r=0;r<l.childNodes.length;r++){const e=l.childNodes[r];1===e.nodeType&&(s(e,"CoverageSummary")&&p(m(e),c))}return{name:t,onlineResources:n,coverages:c,supportedVersions:o,supportedFormats:a(l,"SupportedFormat")}}function v(e){const s=i(e,"ServiceIdentification"),c=r(s,"Title"),l=a(s,"ServiceTypeVersion"),u=a(s,"Profile"),m=g(i(e,"OperationsMetadata")),p=o(e,"Contents/CoverageSummary"),f=[];for(let o=0;o<p.length;o++){const e=p[o],a=r(e,"CoverageId"),s=i(e,"WGS84BoundingBox");let c;if(s){const e=n(s,"LowerCorner"),r=n(s,"UpperCorner");c=new t({xmin:e[0],ymin:e[1],xmax:r[0],ymax:r[1],spatialReference:{wkid:4326}})}f.push({id:a,lonLatEnvelope:c})}const v=i(e,"ServiceMetadata");return{name:c,supportedVersions:l,supportedFormats:a(v,"formatSupported"),supportedInterpolations:a(v,"interpolationSupported"),onlineResources:m,profiles:u,coverages:f}}function d(t,r=null){let i=null;if("string"==typeof t){i=(new DOMParser).parseFromString(t,"text/xml")}else i=t;const o=i.documentElement.getAttribute("version"),n=(o||r||"1.0.0").slice(0,3);let a;if("2.0"===n)a=v(i);else if("1.1"===n)a=f(i);else{if("1.0"!==n)throw new e("wcsraster:parsecapabilities","the capabilities version is not supported");a=u(i)}return a.capabilitiesVersion=o,a}export{d as parseCapabilities};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../geometry/Extent.js";import t from"../../../geometry/Polygon.js";import{isAxesOrderReversedForWkid as n}from"../../ogc/crsUtils.js";import i from"../RasterInfo.js";import{getElements as o,isSameTagIgnoreNS as s,getElementValue as a,getElementValues as r,getNodeNameIgnoreNS as l,getElement as u,getSpaceDelimitedNumericValues as p}from"./xmlUtilities.js";function m(e){return{requestResponseCRSs:r(e,"requestResponseCRSs").map((e=>e.split(":")[1])),nativeCRSs:r(e,"nativeCRSs").map((e=>e.split(":")[1]))}}function d(e,t){const n=r(e,"1.0.0"===t?"interpolationMethod":"InterpolationMethod"),i="1.0.0"===t?e.getAttribute("default"):a(e,"InterpolationMethods/Default");return null!=i?[i].concat(n.filter((e=>e.toLowerCase()!==i.toLowerCase()))):n}function c(e){return null==e?["nearest"]:e.map((e=>{const t=e.toLowerCase();return t.includes("nearest")?"nearest":t.includes("linear")?"bilinear":t.includes("cubic")?"cubic":null})).filter((e=>!!e))}function f(t){const n=o(t,"pos"),i=p(n[0]),s=p(n[1]);return new e({xmin:i[0],ymin:i[1],xmax:s[0],ymax:s[1],spatialReference:{wkid:4326}})}function g(e){const t=[],n=o(e,"RangeSet");let i=[];for(let s=0;s<n.length;s++){const e=a(n[s],"name"),l=a(n[s],"label"),u=[],p=o(n[s],"AxisDescription");for(let t=0;t<p.length;t++){const e=a(p[t],"name"),n=a(p[t],"label"),o=r(p[t],"singleValue");if(0===o.length){const e=a(p[t],"min"),n=a(p[t],"max"),i=Number(a(p[t],"res"))||1;if(null!==e&&null!==n)for(let t=parseInt(e,10);t<=parseInt(n,10);t+=i)o.push(t.toString())}"band"===e.toLowerCase()&&(i=o),u.push({name:e,label:n,values:o})}t.push({name:e,label:l,axis:u})}return{rangeSet:t,bandNames:i}}function h(e=null){if(!e)return{resolution:null,units:null};let t=e.toUpperCase();const n=["Y","M","D"],i=["H","M","S"],o=["Years","Months","Days","Hours","Minutes","Seconds"];let s,a,r;return t.includes("PT")?(t=t.slice(2),r=i.findIndex((e=>t.includes(e))),s=o[3+r],a=parseFloat(t.substring(0,t.length-1))):(t=t.slice(1),r=n.findIndex((e=>t.includes(e))),r>-1&&(s=o[r]),a=parseFloat(t.substring(0,t.length-1))),{resolution:a,units:s}}function b(e){const t=o(e,"timeposition");if(t.length>0){const e=[];for(let n=0;n<t.length;n++)e.push(new Date(a(t[n])));return{begin:e[0],end:e[e.length-1],values:e}}const n=u(e,"timePeriod")||u(e,"TimePeriod");if(n){return{begin:new Date(a(n,"beginPosition")||a(n,"BeginPosition")),end:new Date(a(n,"endPosition")||a(n,"EndPosition")),...h(a(n,"timeResolution")||a(n,"TimeResolution"))}}return null}function x(t){const n=u(t,"spatialDomain"),i=u(n,"Envelope")||u(n,"EnvelopeWithTimePeriod"),s=i.getAttribute("srsName").split(":"),r=s[s.length-1],l=o(i,"pos"),m=p(l[0]),d=p(l[1]),c=parseInt(r,10),f=isNaN(c)?null:{wkid:c},g=new e({xmin:m[0],ymin:m[1],xmax:d[0],ymax:d[1],spatialReference:f}),h=u(n,"RectifiedGrid"),x=a(h,"low").split(" "),v=a(h,"high").split(" "),w=parseInt(v[0],10)-parseInt(x[0],10)+1,y=parseInt(v[1],10)-parseInt(x[1],10)+1,D=p(n,"origin/pos"),L=o(n,"offsetVector"),S={envelope:g,columns:w,rows:y,offset:{x:parseFloat(a(L[0]).split(" ")[0]),y:parseFloat(a(L[1]).split(" ")[1])},origin:{x:D[0],y:D[1]}},C=u(t,"temporalDomain")||u(t,"TemporalDomain");return{spatialDomain:S,temporalDomain:C?b(C):null}}function v(e){const t={version:"1.0"};let n=[];for(let i=0;i<e.childNodes.length;i++){const o=e.childNodes[i];if(1===o.nodeType)if(s(o,"description"))t.description=a(o);else if(s(o,"name"))t.name=a(o);else if(s(o,"label"))t.label=a(o);else if(s(o,"supportedFormats"))t.supportedFormats=r(o,"formats");else if(s(o,"supportedCRSs"))t.supportedCRSs=m(o);else if(s(o,"supportedInterpolations"))t.supportedInterpolations=d(o,"1.0.0");else if(s(o,"lonLatEnvelope"))t.lonLatEnvelope=f(o);else if(s(o,"rangeSet")){const e=g(o);t.rangeSet=e.rangeSet,n=e.bandNames}else s(o,"domainSet")&&(t.domainSet=x(o))}const o=c(t.supportedInterpolations),{name:l,description:u,label:p,lonLatEnvelope:h,supportedFormats:b}=t,{spatialDomain:v}=t.domainSet,w={x:Math.abs(v.offset.x),y:Math.abs(v.offset.y)},y=new i({width:v.columns,height:v.rows,pixelSize:w,extent:v.envelope,spatialReference:v.envelope.spatialReference,bandCount:n.length||1});return{id:l,title:t.name,description:u||p,lonLatEnvelope:h,rasterInfo:y,bandNames:n,supportedFormats:b,supportedInterpolations:o,coverageDescription:t,version:"1.0.0",useEPSGAxis:!1}}function w(e){const t=[],n=o(e,"Field");let i=[];for(let s=0;s<n.length;s++){const e=a(n[s],"Identifier"),l=a(n[s],"Description"),u=a(n[s],"Definition"),p=a(n[s],"Abstract"),m=a(n[s],"Title"),c=d(n[s],"1.1.0"),f=[],g=o(n[s],"Axis");for(let t=0;t<g.length;t++){const e=g[t].getAttribute("identifier"),n=a(g[t],"UOM"),o=a(g[t],"DataType"),s=r(g[t],"Key");"band"===e.toLowerCase()&&(i=s),f.push({identifier:e,uom:n,dataType:o,values:s})}t.push({identifier:e,description:l,definition:u,abstract:p,title:m,supportedInterpolations:c,axis:f})}return{rangeSet:t,bandNames:i}}function y(e,t){const n=e.filter((e=>!e.identifier.toLowerCase().includes("field_1")&&!e.axis.some((e=>"band"===e.identifier.toLowerCase())))),i=[];if(n.length&&n.forEach((e=>{var t,n;const o=e.axis.map((e=>{const t=e.values.map((t=>{if("ISO8601"===e.uom){return(t=t.trim()).toLowerCase().includes("z")?new Date(t).getTime():new Date(t+"Z").getTime()}return parseFloat(t.trim())})),n=[Math.min.apply(null,t),Math.max.apply(null,t)];return{name:e.identifier.trim(),description:"",field:e.identifier.trim(),unit:e.uom?e.uom.trim():"",hasRegularIntervals:!1,values:t,extent:n}}));i.push({name:e.identifier.trim(),description:null!=(t=null==(n=e.description)?void 0:n.trim())?t:"",unit:"",dimensions:o})})),t.temporalDomain){const{begin:e,end:n,values:o,units:s,resolution:a}=t.temporalDomain;i.some((e=>e.dimensions.some((e=>"stdtime"===e.name.toLowerCase()))))||i.forEach((t=>{t.dimensions.push({name:"StdTime",description:"",unit:"ISO8601",values:null==o?void 0:o.map((e=>e.getTime())),hasRegularIntervals:!o,interval:a,intervalUnit:s,extent:[e.getTime(),n.getTime()]})}))}return i.length?{variables:i}:null}function D(t){var i;const s=u(t,"SpatialDomain"),r=u(s,"GridCRS"),l=a(r,"GridBaseCRS"),m=a(r,"GridOrigin"),d=null!=(i=null==m?void 0:m.split(" ").map((e=>parseFloat(e))))?i:[0,0],c=p(r,"GridOffsets"),f=o(s,"BoundingBox");let g,h,x,v;for(let n=0;n<f.length;n++){var w;const t=null==(w=f[n].getAttribute("crs"))?void 0:w.toLowerCase();if(null!=t)if(t.includes("imagecrs")){const e=p(f[n],"LowerCorner"),t=p(f[n],"UpperCorner");g=t[0]-e[0]+1,h=t[1]-e[1]+1}else if(t.indexOf("epsg")>0){const i=t.split(":");x=parseInt(i[i.length-1],10);const o=p(f[n],"LowerCorner"),s=p(f[n],"UpperCorner");v=new e({xmin:o[0],ymin:o[1],xmax:s[0],ymax:s[1],spatialReference:{wkid:x}})}}const y=g>h,D=v.xmax-v.xmin>v.ymax-v.ymin;let L=!1;n(x)&&(y===D?L=!1:(L=!0,v=new e({xmin:v.ymin,ymin:v.xmin,xmax:v.ymax,ymax:v.xmax,spatialReference:{wkid:x}})));const S={columns:g,rows:h,origin:{x:d[0],y:d[1]},offset:{x:c[0],y:c[1]},gridBaseCRS:l,envelope:v,useEPSGAxis:L},C=u(t,"temporalDomain")||u(t,"TemporalDomain");return{spatialDomain:S,temporalDomain:C?b(C):null}}function L(e,t){const n=[],o=[],s={supportedFormats:n,supportedCRSs:o,version:"1.1"};let r;for(let i=0;i<e.childNodes.length;i++){const t=e.childNodes[i];if(1!==t.nodeType)continue;const u=l(t).toLowerCase();switch(u){case"title":case"abstract":case"identifier":s[u]=a(t);break;case"supportedformat":{const e=a(t);n.includes(e)||n.push(e)}break;case"supportedcrs":{const e=a(t);o.includes(e)||o.push(e)}break;case"range":{const e=w(t);s.range=e.rangeSet,r=e.bandNames}break;case"domain":s.domain=D(t)}}const u=c(s.range[0].supportedInterpolations),{identifier:p,abstract:m,title:d,domain:f,range:g}=s,h={x:Math.abs(f.spatialDomain.offset.x),y:Math.abs(f.spatialDomain.offset.y)},b=y(g,f),x=new i({width:f.spatialDomain.columns,height:f.spatialDomain.rows,pixelSize:h,extent:f.spatialDomain.envelope,spatialReference:f.spatialDomain.envelope.spatialReference,bandCount:r.length||1,multidimensionalInfo:b});return{id:p,title:s.title,description:m||d,lonLatEnvelope:null,bandNames:r,rasterInfo:x,supportedFormats:n,supportedInterpolations:u,coverageDescription:s,version:t,useEPSGAxis:f.spatialDomain.useEPSGAxis}}function S(t){const n=u(t,"Envelope")||u(t,"EnvelopeWithTimePeriod"),i=n.getAttribute("srsName"),o=i.slice(i.lastIndexOf("/")+1),r=n.getAttribute("axisLabels").split(" ").map((e=>e.trim())).filter((e=>""!==e.trim())),l=p(n,"lowerCorner"),m=p(n,"upperCorner"),d=!["y","lat","latitude","north","nor","n","b"].includes(r[0].toLowerCase());let c;const f=parseInt(o,10),g=isNaN(f)?null:{wkid:f};c=new e(d?{xmin:l[0],ymin:l[1],xmax:m[0],ymax:m[1],spatialReference:g}:{xmin:l[1],ymin:l[0],xmax:m[1],ymax:m[0],spatialReference:g});const h={mins:l,maxs:m},b=n.getAttribute("uomLabels").trim().split(" ");let x,v;return s(n,"EnvelopeWithTimePeriod")&&(x=new Date(a(t,"beginPosition")||a(t,"BeginPosition")),v=new Date(a(t,"endPosition")||a(t,"EndPosition"))),{envelope:c,axisLabels:r,uomLabels:b.length?b:null,envelopeAllDims:h,beginPosition:x,endPosition:v,isEastFirst:d}}function C(e){const t=[],n=o(e,"DataRecord"),i=[];for(let r=0;r<n.length;r++){const e=o(n[r],"field"),l=[];for(let t=0;t<e.length;t++){var s;const n=e[t].getAttribute("name"),o=a(e[t],"description")||"",r=(null==(s=u(e[t],"uom"))?void 0:s.getAttribute("code"))||"",m=p(e[t],"interval");n.toLowerCase().includes("band")&&i.push(n),l.push({name:n,description:o,uom:r,allowedValues:m})}t.push(l)}return{rangeType:t,bandNames:i}}function I(e){let t=1,n="";const i=.01;return Math.abs(e-1/24)<1/24*i?n="Hours":Math.abs(e-1)<1*i?n="Days":e<1?(t=Math.round(24*e),n="Hours"):e>28-i&&e<31+i||Math.round(e/30)<12?n="Months":e>365-i&&e<366+i&&(n="Years"),{interval:t,intervalUnit:n}}function R(e,t,n){const i=[];for(let s=0;s<e.length;s++){const t=e[s];for(let e=0;e<t.length;e++)t[e].name.toLowerCase().includes("band")||i.push(t[e])}const o=[];if(i.length){const e=[];for(let i=2;i<n.axisLabels.length;i++){const o=(t.uomLabels&&t.uomLabels.length)>i?t.uomLabels[i]:"",s=n.axisLabels[i].toLowerCase().includes("time")||"iso8601"===o.toLowerCase()||"oledatetime"===o.toLowerCase();let a,r;if(s){const e=I(n.offset[i]);a=e.interval,r=e.intervalUnit}else a=n.offset[i],r=o;const l=[];s?(l.push((new Date).setTime(24*(t.envelopeAllDims.mins[i]-25569)*3600*1e3)),l.push((new Date).setTime(24*(t.envelopeAllDims.maxs[i]-25569)*3600*1e3))):(l.push(t.envelopeAllDims.mins[i]),l.push(t.envelopeAllDims.maxs[i])),e.push({name:n.axisLabels[i].trim(),description:n.axisLabels[i].trim(),unit:t.uomLabels&&t.uomLabels.length>i?t.uomLabels[i].trim():"",hasRegularIntervals:!0,extent:l,interval:a,intervalUnit:r})}if(i.forEach((t=>{var n,i;return o.push({name:t.name.trim(),description:null!=(n=null==(i=t.description)?void 0:i.trim())?n:"",unit:t.uom.trim(),dimensions:e})})),o.length)return{variables:o}}return null}function T(e,t){const n=u(e,"RectifiedGrid"),i=p(n,"low"),s=p(n,"high"),r=[];for(let o=0;o<i.length;o++)r.push(s[o]-i[o]+1);const l=a(n,"axisLabels").split(" "),m=p(n,"origin/pos"),d=o(n,"offsetVector"),c=[];for(let o=0;o<d.length;o++){const e=p(d[o]),t=e.findIndex((e=>0!==e));c[t]=e[t]}let f,g,h;return["y","lat","latitude","north","nor","n","b"].includes((t||l)[0].toLowerCase())?(f=r[1],g=r[0],h={y:Math.abs(c[0]),x:Math.abs(c[1])}):(f=r[0],g=r[1],h={x:Math.abs(c[0]),y:Math.abs(c[1])}),{columns:f,rows:g,origin:m,offset:c,resolution:h,gridSamples:r,axisLabels:l}}function M(e){const n=u(e,"EarthObservation");if(!n)return null;const i=u(n,"phenomenonTime"),o=i?b(i):null,s=u(n,"phenomenonTime"),r=s?b(s):null,l=a(n,"featureOfInterest/Footprint/multiExtentOf/MultiSurface/surfaceMembers/Polygon/exterior/LinearRing/posList");let p=null;if(l){const e=l.split(" ").map((e=>e.trim())).filter((e=>null!=e&&""!==e));if(e.length){const n=[];for(let t=0;t<e.length/2;t+=2)n.push(e[t],e[t+1]);p=new t({rings:[n],spatialReference:{wkid:4326}})}}return{observation:{phonomenonTime:o,resultTime:r,footprint:p,identifier:a(e,"metaDataProperty/EarthObservationMetaData/identifier"),acquisitionType:a(e,"metaDataProperty/EarthObservationMetaData/acquisitionType"),status:a(e,"metaDataProperty/EarthObservationMetaData/status")}}}function P(e){const t={version:"2.0"};let n=[];for(let i=0;i<e.childNodes.length;i++){const l=e.childNodes[i];if(1===l.nodeType)if(s(l,"coverageId"))t.coverageId=a(l);else if(s(l,"ServiceParameters"))t.serviceParameters={supportedFormats:r(l,"nativeFormat")};else if(s(l,"boundedBy"))t.boundedBy=S(l);else if(s(l,"rangeType")){const e=C(l);t.rangeType=e.rangeType,n=e.bandNames}else if(s(l,"domainSet")){var o;t.domainSet=T(l,null==(o=t.boundedBy)?void 0:o.axisLabels)}else if(s(l,"metadata")){const e=u(l,"EOMetadata");t.eoMetadata=e?M(e):null}}const{coverageId:l,boundedBy:p,domainSet:m,rangeType:d,serviceParameters:c}=t,f=R(d,p,m);return{id:l,title:l,description:l,lonLatEnvelope:null,bandNames:n,rasterInfo:new i({width:m.columns,height:m.rows,pixelSize:m.resolution,extent:p.envelope,spatialReference:p.envelope.spatialReference,bandCount:n.length||1,multidimensionalInfo:f}),supportedFormats:c.supportedFormats,supportedInterpolations:null,coverageDescription:t,version:"2.0.1",useEPSGAxis:!1}}function E(e,t){let n=null;if("string"==typeof e){n=(new DOMParser).parseFromString(e,"text/xml")}else n=e;if("1.0.0"===t){return o(n,"CoverageOffering").map((e=>v(e)))}const i=o(n,"CoverageDescription");return"1.1.0"===t||"1.1.1"===t||"1.1.2"===t?i.map((e=>L(e,t))):i.map((e=>P(e)))}export{E as parseCoverages,c as standardizeInterpolations};
5
+ import e from"../../../geometry/Extent.js";import t from"../../../geometry/Polygon.js";import{isAxesOrderReversedForWkid as n}from"../../ogc/crsUtils.js";import i from"../RasterInfo.js";import{getElements as s,isSameTagIgnoreNS as o,getElementValue as a,getElementValues as r,getNodeNameIgnoreNS as l,getElement as p,getSpaceDelimitedNumericValues as u}from"./xmlUtilities.js";function m(e){return{requestResponseCRSs:r(e,"requestResponseCRSs").map((e=>e.split(":")[1])),nativeCRSs:r(e,"nativeCRSs").map((e=>e.split(":")[1]))}}function c(e,t){const n=r(e,"1.0.0"===t?"interpolationMethod":"InterpolationMethod"),i="1.0.0"===t?e.getAttribute("default"):a(e,"InterpolationMethods/Default");return null!=i?[i].concat(n.filter((e=>e.toLowerCase()!==i.toLowerCase()))):n}function d(e){return null==e?["nearest"]:e.map((e=>{const t=e.toLowerCase();return t.includes("nearest")?"nearest":t.includes("linear")?"bilinear":t.includes("cubic")?"cubic":null})).filter((e=>!!e))}function f(t){const n=s(t,"pos"),i=u(n[0]),o=u(n[1]);return new e({xmin:i[0],ymin:i[1],xmax:o[0],ymax:o[1],spatialReference:{wkid:4326}})}function g(e){const t=[],n=s(e,"RangeSet");let i=[];for(let o=0;o<n.length;o++){const e=a(n[o],"name"),l=a(n[o],"label"),p=[],u=s(n[o],"AxisDescription");for(let t=0;t<u.length;t++){const e=a(u[t],"name"),n=a(u[t],"label"),s=r(u[t],"singleValue");if(0===s.length){const e=a(u[t],"min"),n=a(u[t],"max"),i=Number(a(u[t],"res"))||1;if(null!==e&&null!==n)for(let t=parseInt(e,10);t<=parseInt(n,10);t+=i)s.push(t.toString())}"band"===e.toLowerCase()&&(i=s),p.push({name:e,label:n,values:s})}t.push({name:e,label:l,axis:p})}return{rangeSet:t,bandNames:i}}function h(e=null){if(!e)return{resolution:null,units:null};let t=e.toUpperCase();const n=["Y","M","D"],i=["H","M","S"],s=["Years","Months","Days","Hours","Minutes","Seconds"];let o,a,r;return t.includes("PT")?(t=t.slice(2),r=i.findIndex((e=>t.includes(e))),o=s[3+r],a=parseFloat(t.substring(0,t.length-1))):(t=t.slice(1),r=n.findIndex((e=>t.includes(e))),r>-1&&(o=s[r]),a=parseFloat(t.substring(0,t.length-1))),{resolution:a,units:o}}function b(e){const t=s(e,"timeposition");if(t.length>0){const e=[];for(let n=0;n<t.length;n++)e.push(new Date(a(t[n])));return{begin:e[0],end:e[e.length-1],values:e}}const n=p(e,"timePeriod")||p(e,"TimePeriod");if(n){return{begin:new Date(a(n,"beginPosition")||a(n,"BeginPosition")),end:new Date(a(n,"endPosition")||a(n,"EndPosition")),...h(a(n,"timeResolution")||a(n,"TimeResolution"))}}return null}function x(t){const n=p(t,"spatialDomain"),i=p(n,"Envelope")||p(n,"EnvelopeWithTimePeriod"),o=i.getAttribute("srsName").split(":"),r=o[o.length-1],l=s(i,"pos"),m=u(l[0]),c=u(l[1]),d=parseInt(r,10),f=isNaN(d)?null:{wkid:d},g=new e({xmin:m[0],ymin:m[1],xmax:c[0],ymax:c[1],spatialReference:f}),h=p(n,"RectifiedGrid"),x=a(h,"low").split(" "),v=a(h,"high").split(" "),w=parseInt(v[0],10)-parseInt(x[0],10)+1,y=parseInt(v[1],10)-parseInt(x[1],10)+1,D=u(n,"origin/pos"),L=s(n,"offsetVector"),S={envelope:g,columns:w,rows:y,offset:{x:parseFloat(a(L[0]).split(" ")[0]),y:parseFloat(a(L[1]).split(" ")[1])},origin:{x:D[0],y:D[1]}},C=p(t,"temporalDomain")||p(t,"TemporalDomain");return{spatialDomain:S,temporalDomain:C?b(C):null}}function v(e){const t={version:"1.0"};let n=[];for(let i=0;i<e.childNodes.length;i++){const s=e.childNodes[i];if(1===s.nodeType)if(o(s,"description"))t.description=a(s);else if(o(s,"name"))t.name=a(s);else if(o(s,"label"))t.label=a(s);else if(o(s,"supportedFormats"))t.supportedFormats=r(s,"formats");else if(o(s,"supportedCRSs"))t.supportedCRSs=m(s);else if(o(s,"supportedInterpolations"))t.supportedInterpolations=c(s,"1.0.0");else if(o(s,"lonLatEnvelope"))t.lonLatEnvelope=f(s);else if(o(s,"rangeSet")){const e=g(s);t.rangeSet=e.rangeSet,n=e.bandNames}else o(s,"domainSet")&&(t.domainSet=x(s))}const s=d(t.supportedInterpolations),{name:l,description:p,label:u,lonLatEnvelope:h,supportedFormats:b}=t,{spatialDomain:v}=t.domainSet,w={x:Math.abs(v.offset.x),y:Math.abs(v.offset.y)},y=new i({width:v.columns,height:v.rows,pixelSize:w,extent:v.envelope,spatialReference:v.envelope.spatialReference,bandCount:n.length||1});return{id:l,title:t.name,description:p||u,lonLatEnvelope:h,rasterInfo:y,bandNames:n,supportedFormats:b,supportedInterpolations:s,coverageDescription:t,version:"1.0.0",useEPSGAxis:!1}}function w(e){const t=[],n=s(e,"Field");let i=[];for(let o=0;o<n.length;o++){const e=a(n[o],"Identifier"),l=a(n[o],"Description"),p=a(n[o],"Definition"),u=a(n[o],"Abstract"),m=a(n[o],"Title"),d=c(n[o],"1.1.0"),f=[],g=s(n[o],"Axis");for(let t=0;t<g.length;t++){const e=g[t].getAttribute("identifier"),n=a(g[t],"UOM"),s=a(g[t],"DataType"),o=r(g[t],"Key");"band"===e.toLowerCase()&&(i=o),f.push({identifier:e,uom:n,dataType:s,values:o})}t.push({identifier:e,description:l,definition:p,abstract:u,title:m,supportedInterpolations:d,axis:f})}return{rangeSet:t,bandNames:i}}function y(e,t){const n=e.filter((e=>!e.identifier.toLowerCase().includes("field_1")&&!e.axis.some((e=>"band"===e.identifier.toLowerCase())))),i=[];if(n.length&&n.forEach((e=>{const t=e.axis.map((e=>{const t=e.values.map((t=>{if("ISO8601"===e.uom){return(t=t.trim()).toLowerCase().includes("z")?new Date(t).getTime():new Date(t+"Z").getTime()}return parseFloat(t.trim())})),n=[Math.min.apply(null,t),Math.max.apply(null,t)];return{name:e.identifier.trim(),description:"",field:e.identifier.trim(),unit:e.uom?e.uom.trim():"",hasRegularIntervals:!1,values:t,extent:n}}));i.push({name:e.identifier.trim(),description:e.description?.trim()??"",unit:"",dimensions:t})})),t.temporalDomain){const{begin:e,end:n,values:s,units:o,resolution:a}=t.temporalDomain;i.some((e=>e.dimensions.some((e=>"stdtime"===e.name.toLowerCase()))))||i.forEach((t=>{t.dimensions.push({name:"StdTime",description:"",unit:"ISO8601",values:s?.map((e=>e.getTime())),hasRegularIntervals:!s,interval:a,intervalUnit:o,extent:[e.getTime(),n.getTime()]})}))}return i.length?{variables:i}:null}function D(t){const i=p(t,"SpatialDomain"),o=p(i,"GridCRS"),r=a(o,"GridBaseCRS"),l=a(o,"GridOrigin")?.split(" ").map((e=>parseFloat(e)))??[0,0],m=u(o,"GridOffsets"),c=s(i,"BoundingBox");let d,f,g,h;for(let n=0;n<c.length;n++){const t=c[n].getAttribute("crs")?.toLowerCase();if(null!=t)if(t.includes("imagecrs")){const e=u(c[n],"LowerCorner"),t=u(c[n],"UpperCorner");d=t[0]-e[0]+1,f=t[1]-e[1]+1}else if(t.indexOf("epsg")>0){const i=t.split(":");g=parseInt(i[i.length-1],10);const s=u(c[n],"LowerCorner"),o=u(c[n],"UpperCorner");h=new e({xmin:s[0],ymin:s[1],xmax:o[0],ymax:o[1],spatialReference:{wkid:g}})}}const x=d>f,v=h.xmax-h.xmin>h.ymax-h.ymin;let w=!1;n(g)&&(x===v?w=!1:(w=!0,h=new e({xmin:h.ymin,ymin:h.xmin,xmax:h.ymax,ymax:h.xmax,spatialReference:{wkid:g}})));const y={columns:d,rows:f,origin:{x:l[0],y:l[1]},offset:{x:m[0],y:m[1]},gridBaseCRS:r,envelope:h,useEPSGAxis:w},D=p(t,"temporalDomain")||p(t,"TemporalDomain");return{spatialDomain:y,temporalDomain:D?b(D):null}}function L(e,t){const n=[],s=[],o={supportedFormats:n,supportedCRSs:s,version:"1.1"};let r;for(let i=0;i<e.childNodes.length;i++){const t=e.childNodes[i];if(1!==t.nodeType)continue;const p=l(t).toLowerCase();switch(p){case"title":case"abstract":case"identifier":o[p]=a(t);break;case"supportedformat":{const e=a(t);n.includes(e)||n.push(e)}break;case"supportedcrs":{const e=a(t);s.includes(e)||s.push(e)}break;case"range":{const e=w(t);o.range=e.rangeSet,r=e.bandNames}break;case"domain":o.domain=D(t)}}const p=d(o.range[0].supportedInterpolations),{identifier:u,abstract:m,title:c,domain:f,range:g}=o,h={x:Math.abs(f.spatialDomain.offset.x),y:Math.abs(f.spatialDomain.offset.y)},b=y(g,f),x=new i({width:f.spatialDomain.columns,height:f.spatialDomain.rows,pixelSize:h,extent:f.spatialDomain.envelope,spatialReference:f.spatialDomain.envelope.spatialReference,bandCount:r.length||1,multidimensionalInfo:b});return{id:u,title:o.title,description:m||c,lonLatEnvelope:null,bandNames:r,rasterInfo:x,supportedFormats:n,supportedInterpolations:p,coverageDescription:o,version:t,useEPSGAxis:f.spatialDomain.useEPSGAxis}}function S(t){const n=p(t,"Envelope")||p(t,"EnvelopeWithTimePeriod"),i=n.getAttribute("srsName"),s=i.slice(i.lastIndexOf("/")+1),r=n.getAttribute("axisLabels").split(" ").map((e=>e.trim())).filter((e=>""!==e.trim())),l=u(n,"lowerCorner"),m=u(n,"upperCorner"),c=!["y","lat","latitude","north","nor","n","b"].includes(r[0].toLowerCase());let d;const f=parseInt(s,10),g=isNaN(f)?null:{wkid:f};d=new e(c?{xmin:l[0],ymin:l[1],xmax:m[0],ymax:m[1],spatialReference:g}:{xmin:l[1],ymin:l[0],xmax:m[1],ymax:m[0],spatialReference:g});const h={mins:l,maxs:m},b=n.getAttribute("uomLabels").trim().split(" ");let x,v;return o(n,"EnvelopeWithTimePeriod")&&(x=new Date(a(t,"beginPosition")||a(t,"BeginPosition")),v=new Date(a(t,"endPosition")||a(t,"EndPosition"))),{envelope:d,axisLabels:r,uomLabels:b.length?b:null,envelopeAllDims:h,beginPosition:x,endPosition:v,isEastFirst:c}}function C(e){const t=[],n=s(e,"DataRecord"),i=[];for(let o=0;o<n.length;o++){const e=s(n[o],"field"),r=[];for(let t=0;t<e.length;t++){const n=e[t].getAttribute("name"),s=a(e[t],"description")||"",o=p(e[t],"uom")?.getAttribute("code")||"",l=u(e[t],"interval");n.toLowerCase().includes("band")&&i.push(n),r.push({name:n,description:s,uom:o,allowedValues:l})}t.push(r)}return{rangeType:t,bandNames:i}}function I(e){let t=1,n="";const i=.01;return Math.abs(e-1/24)<1/24*i?n="Hours":Math.abs(e-1)<1*i?n="Days":e<1?(t=Math.round(24*e),n="Hours"):e>28-i&&e<31+i||Math.round(e/30)<12?n="Months":e>365-i&&e<366+i&&(n="Years"),{interval:t,intervalUnit:n}}function R(e,t,n){const i=[];for(let o=0;o<e.length;o++){const t=e[o];for(let e=0;e<t.length;e++)t[e].name.toLowerCase().includes("band")||i.push(t[e])}const s=[];if(i.length){const e=[];for(let i=2;i<n.axisLabels.length;i++){const s=(t.uomLabels&&t.uomLabels.length)>i?t.uomLabels[i]:"",o=n.axisLabels[i].toLowerCase().includes("time")||"iso8601"===s.toLowerCase()||"oledatetime"===s.toLowerCase();let a,r;if(o){const e=I(n.offset[i]);a=e.interval,r=e.intervalUnit}else a=n.offset[i],r=s;const l=[];o?(l.push((new Date).setTime(24*(t.envelopeAllDims.mins[i]-25569)*3600*1e3)),l.push((new Date).setTime(24*(t.envelopeAllDims.maxs[i]-25569)*3600*1e3))):(l.push(t.envelopeAllDims.mins[i]),l.push(t.envelopeAllDims.maxs[i])),e.push({name:n.axisLabels[i].trim(),description:n.axisLabels[i].trim(),unit:t.uomLabels&&t.uomLabels.length>i?t.uomLabels[i].trim():"",hasRegularIntervals:!0,extent:l,interval:a,intervalUnit:r})}if(i.forEach((t=>s.push({name:t.name.trim(),description:t.description?.trim()??"",unit:t.uom.trim(),dimensions:e}))),s.length)return{variables:s}}return null}function T(e,t){const n=p(e,"RectifiedGrid"),i=u(n,"low"),o=u(n,"high"),r=[];for(let s=0;s<i.length;s++)r.push(o[s]-i[s]+1);const l=a(n,"axisLabels").split(" "),m=u(n,"origin/pos"),c=s(n,"offsetVector"),d=[];for(let s=0;s<c.length;s++){const e=u(c[s]),t=e.findIndex((e=>0!==e));d[t]=e[t]}let f,g,h;return["y","lat","latitude","north","nor","n","b"].includes((t||l)[0].toLowerCase())?(f=r[1],g=r[0],h={y:Math.abs(d[0]),x:Math.abs(d[1])}):(f=r[0],g=r[1],h={x:Math.abs(d[0]),y:Math.abs(d[1])}),{columns:f,rows:g,origin:m,offset:d,resolution:h,gridSamples:r,axisLabels:l}}function M(e){const n=p(e,"EarthObservation");if(!n)return null;const i=p(n,"phenomenonTime"),s=i?b(i):null,o=p(n,"phenomenonTime"),r=o?b(o):null,l=a(n,"featureOfInterest/Footprint/multiExtentOf/MultiSurface/surfaceMembers/Polygon/exterior/LinearRing/posList");let u=null;if(l){const e=l.split(" ").map((e=>e.trim())).filter((e=>null!=e&&""!==e));if(e.length){const n=[];for(let t=0;t<e.length/2;t+=2)n.push(e[t],e[t+1]);u=new t({rings:[n],spatialReference:{wkid:4326}})}}return{observation:{phonomenonTime:s,resultTime:r,footprint:u,identifier:a(e,"metaDataProperty/EarthObservationMetaData/identifier"),acquisitionType:a(e,"metaDataProperty/EarthObservationMetaData/acquisitionType"),status:a(e,"metaDataProperty/EarthObservationMetaData/status")}}}function P(e){const t={version:"2.0"};let n=[];for(let i=0;i<e.childNodes.length;i++){const s=e.childNodes[i];if(1===s.nodeType)if(o(s,"coverageId"))t.coverageId=a(s);else if(o(s,"ServiceParameters"))t.serviceParameters={supportedFormats:r(s,"nativeFormat")};else if(o(s,"boundedBy"))t.boundedBy=S(s);else if(o(s,"rangeType")){const e=C(s);t.rangeType=e.rangeType,n=e.bandNames}else if(o(s,"domainSet"))t.domainSet=T(s,t.boundedBy?.axisLabels);else if(o(s,"metadata")){const e=p(s,"EOMetadata");t.eoMetadata=e?M(e):null}}const{coverageId:s,boundedBy:l,domainSet:u,rangeType:m,serviceParameters:c}=t,d=R(m,l,u);return{id:s,title:s,description:s,lonLatEnvelope:null,bandNames:n,rasterInfo:new i({width:u.columns,height:u.rows,pixelSize:u.resolution,extent:l.envelope,spatialReference:l.envelope.spatialReference,bandCount:n.length||1,multidimensionalInfo:d}),supportedFormats:c.supportedFormats,supportedInterpolations:null,coverageDescription:t,version:"2.0.1",useEPSGAxis:!1}}function E(e,t){let n=null;if("string"==typeof e){n=(new DOMParser).parseFromString(e,"text/xml")}else n=e;if("1.0.0"===t){return s(n,"CoverageOffering").map((e=>v(e)))}const i=s(n,"CoverageDescription");return"1.1.0"===t||"1.1.1"===t||"1.1.2"===t?i.map((e=>L(e,t))):i.map((e=>P(e)))}export{E as parseCoverages,d as standardizeInterpolations};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- function n(e,t){if(!e||!t)return[];let l=t;t.includes("/")?(l=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const u=[];if(t){const r=n(e,l);for(let e=0;e<r.length;e++){n(r[e],t).forEach((n=>u.push(n)))}return u}const r=e.getElementsByTagNameNS("*",l);if(!r||0===r.length)return[];for(let n=0;n<r.length;n++)u.push(r[n]||r.item[n]);return u}function e(t,l){if(!t||!l)return null;let u=l;l.includes("/")?(u=l.slice(0,l.indexOf("/")),l=l.slice(l.indexOf("/")+1)):l="";const r=n(t,u);return r.length>0?l?e(r[0],l):r[0]:null}function t(n,t=null){const l=t?e(n,t):n;let u;return l?(u=l.textContent||l.nodeValue,u?u.trim():null):null}function l(e,t){const l=n(e,t),u=[];let r;for(let n=0;n<l.length;n++)r=l[n].textContent||l[n].nodeValue,r&&(r=r.trim(),""!==r&&u.push(r));return u}function u(n,e=null){const l=t(n,e);return null==l?void 0:l.split(" ").map((n=>Number(n)))}function r(n,e){return l(n,e).map((n=>Number(n)))}function o(n,e){const l=t(n,e);return Number(l)}function i(n,e){var t;const l=null==n||null==(t=n.nodeName)?void 0:t.toLowerCase(),u=e.toLowerCase();return l.slice(l.lastIndexOf(":")+1)===u}function c(n){return n.nodeName.slice(n.nodeName.lastIndexOf(":")+1)}export{e as getElement,o as getElementNumericValue,r as getElementNumericValues,t as getElementValue,l as getElementValues,n as getElements,c as getNodeNameIgnoreNS,u as getSpaceDelimitedNumericValues,i as isSameTagIgnoreNS};
5
+ function n(e,t){if(!e||!t)return[];let l=t;t.includes("/")?(l=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const r=[];if(t){const u=n(e,l);for(let e=0;e<u.length;e++){n(u[e],t).forEach((n=>r.push(n)))}return r}const u=e.getElementsByTagNameNS("*",l);if(!u||0===u.length)return[];for(let n=0;n<u.length;n++)r.push(u[n]||u.item[n]);return r}function e(t,l){if(!t||!l)return null;let r=l;l.includes("/")?(r=l.slice(0,l.indexOf("/")),l=l.slice(l.indexOf("/")+1)):l="";const u=n(t,r);return u.length>0?l?e(u[0],l):u[0]:null}function t(n,t=null){const l=t?e(n,t):n;let r;return l?(r=l.textContent||l.nodeValue,r?r.trim():null):null}function l(e,t){const l=n(e,t),r=[];let u;for(let n=0;n<l.length;n++)u=l[n].textContent||l[n].nodeValue,u&&(u=u.trim(),""!==u&&r.push(u));return r}function r(n,e=null){return t(n,e)?.split(" ").map((n=>Number(n)))}function u(n,e){return l(n,e).map((n=>Number(n)))}function o(n,e){const l=t(n,e);return Number(l)}function i(n,e){const t=n?.nodeName?.toLowerCase(),l=e.toLowerCase();return t.slice(t.lastIndexOf(":")+1)===l}function c(n){return n.nodeName.slice(n.nodeName.lastIndexOf(":")+1)}export{e as getElement,o as getElementNumericValue,u as getElementNumericValues,t as getElementValue,l as getElementValues,n as getElements,c as getNodeNameIgnoreNS,r as getSpaceDelimitedNumericValues,i as isSameTagIgnoreNS};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{getAssetUrl as e}from"../../../assets.js";const t=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,128]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let n=null,r=!1;function a(){return n||(n=import("../../../chunks/lerc-wasm.js").then((e=>e.l)).then((({default:t})=>t({locateFile:t=>e(`esri/layers/support/rasterFormats/${t}`)}))).then((e=>{o(e),r=!0})),n)}function l(){return r}const s={getBlobInfo:null,decode:null};function i(e){return 16+(e>>3<<3)}function o(e){const{_malloc:n,_free:r,_lerc_getBlobInfo:a,_lerc_getDataRanges:l,_lerc_decode_4D:o,asm:u}=e;let c;const f=Object.values(u).find((t=>t&&"buffer"in t&&t.buffer===e.HEAPU8.buffer)),y=e=>{const t=e.map((e=>i(e))),r=t.reduce(((e,t)=>e+t)),a=n(r);c=new Uint8Array(f.buffer);let l=t[0];t[0]=a;for(let n=1;n<t.length;n++){const e=t[n];t[n]=t[n-1]+l,l=e}return t};s.getBlobInfo=e=>{const t=12,n=3,s=new Uint8Array(4*t),i=new Uint8Array(8*n),[o,u,h]=y([e.length,s.length,i.length]);c.set(e,o),c.set(s,u),c.set(i,h);let p=a(o,e.length,u,h,t,n);if(p)throw r(o),`lerc-getBlobInfo: error code is ${p}`;c=new Uint8Array(f.buffer),s.set(c.slice(u,u+s.length)),i.set(c.slice(h,h+i.length));const g=new Uint32Array(s.buffer),d=new Float64Array(i.buffer),[b,m,A,w,U,x,T,C,V,,D]=g,z={version:b,dimCount:A,width:w,height:U,validPixelCount:T,bandCount:x,blobSize:C,maskCount:V,dataType:m,minValue:d[0],maxValue:d[1],maxZerror:d[2],statistics:[],bandCountWithNoData:D};if(D)return z;if(1===A&&1===x)return r(o),z.statistics.push({minValue:d[0],maxValue:d[1]}),z;const I=A*x*8,F=new Uint8Array(I),_=new Uint8Array(I);let k,v=o,B=0,S=!1;if(c.byteLength<o+2*I?(r(o),S=!0,[v,B,k]=y([e.length,I,I]),c.set(e,v)):[B,k]=y([I,I]),c.set(F,B),c.set(_,k),p=l(o,e.length,A,x,B,k),p)throw r(v),S||r(B),`lerc-getDataRanges: error code is ${p}`;c=new Uint8Array(f.buffer),F.set(c.slice(B,B+I)),_.set(c.slice(k,k+I));const O=new Float64Array(F.buffer),$=new Float64Array(_.buffer),j=z.statistics;for(let r=0;r<x;r++)if(A>1){const e=O.slice(r*A,(r+1)*A),t=$.slice(r*A,(r+1)*A),n=Math.min.apply(null,e),a=Math.max.apply(null,t);j.push({minValue:n,maxValue:a,dimStats:{minValues:e,maxValues:t}})}else j.push({minValue:O[r],maxValue:$[r]});return r(v),S||r(B),z},s.decode=(e,n)=>{const{maskCount:a,dimCount:l,bandCount:s,width:i,height:u,dataType:h,bandCountWithNoData:p}=n,g=t[h],d=i*u,b=new Uint8Array(d*s),m=d*l*s*g.size,A=new Uint8Array(m),w=new Uint8Array(s),U=8*s,x=new Uint8Array(U),[T,C,V,D,z]=y([e.length,b.length,A.length,w.length,x.length]);c.set(e,T),c.set(b,C),c.set(A,V),c.set(w,D),c.set(x,z);const I=o(T,e.length,a,C,l,i,u,s,h,V,D,z);if(I)throw r(T),`lerc-decode: error code is ${I}`;c=new Uint8Array(f.buffer),A.set(c.slice(V,V+m)),b.set(c.slice(C,C+b.length));let F=null;if(p){w.set(c.slice(D,D+s)),x.set(c.slice(z,z+U)),F=[];for(let e=0;e<w.length;e++)F.push(w[e]?x[e]:null)}return r(T),{data:A,maskData:b,noDataValues:F}}}function u(e,t,n,r,a){if(n<2)return e;const l=new r(t*n);if(a)for(let s=0,i=0;s<t;s++)for(let r=0,a=s;r<n;r++,a+=t)l[a]=e[i++];else for(let s=0,i=0;s<t;s++)for(let r=0,a=s;r<n;r++,a+=t)l[i++]=e[a];return l}function c(e,n={}){var r;const a=null!=(r=n.inputOffset)?r:0,l=e instanceof Uint8Array?e.subarray(a):new Uint8Array(e,a),i=s.getBlobInfo(l),{data:o,maskData:c}=s.decode(l,i),{width:f,height:y,bandCount:h,dimCount:p,dataType:g,maskCount:d,statistics:b}=i,m=t[g],A=new m.ctor(o.buffer),w=[],U=[],x=f*y,T=x*p;for(let t=0;t<h;t++){const e=A.subarray(t*T,(t+1)*T);if(n.returnPixelInterleavedDims)w.push(e);else{const t=u(e,x,p,m.ctor,!0);w.push(t)}U.push(c.subarray(t*T,(t+1)*T))}const C=0===d?null:1===d?U[0]:new Uint8Array(x);if(d>1){C.set(U[0]);for(let e=1;e<U.length;e++){const t=U[e];for(let e=0;e<x;e++)C[e]=C[e]&t[e]}}const{noDataValue:V}=n,D=null!=V&&m.range[0]<=V&&m.range[1]>=V;if(d>0&&D){const{noDataValue:e}=n;for(let t=0;t<h;t++){const n=w[t],r=U[t]||C;for(let t=0;t<x;t++)0===r[t]&&(n[t]=e)}}const z=d===h&&h>1?U:null;return{width:f,height:y,bandCount:h,pixelType:n.pixelType&&0===i.version?n.pixelType:m.pixelType,dimCount:p,statistics:b,pixels:w,mask:C,bandMasks:z}}function f(e,t={}){var n,r;const a=e instanceof Uint8Array?e.subarray(null!=(n=t.inputOffset)?n:0):new Uint8Array(e,null!=(r=t.inputOffset)?r:0);return s.getBlobInfo(a)}export{c as decode,f as getBlobInfo,l as isLoaded,a as load};
5
+ import{getAssetUrl as e}from"../../../assets.js";const t=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,128]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let n=null,r=!1;function a(){return n||(n=import("../../../chunks/lerc-wasm.js").then((e=>e.l)).then((({default:t})=>t({locateFile:t=>e(`esri/layers/support/rasterFormats/${t}`)}))).then((e=>{o(e),r=!0})),n)}function s(){return r}const l={getBlobInfo:null,decode:null};function i(e){return 16+(e>>3<<3)}function o(e){const{_malloc:n,_free:r,_lerc_getBlobInfo:a,_lerc_getDataRanges:s,_lerc_decode_4D:o,asm:u}=e;let c;const f=Object.values(u).find((t=>t&&"buffer"in t&&t.buffer===e.HEAPU8.buffer)),y=e=>{const t=e.map((e=>i(e))),r=t.reduce(((e,t)=>e+t)),a=n(r);c=new Uint8Array(f.buffer);let s=t[0];t[0]=a;for(let n=1;n<t.length;n++){const e=t[n];t[n]=t[n-1]+s,s=e}return t};l.getBlobInfo=e=>{const t=12,n=3,l=new Uint8Array(4*t),i=new Uint8Array(8*n),[o,u,h]=y([e.length,l.length,i.length]);c.set(e,o),c.set(l,u),c.set(i,h);let p=a(o,e.length,u,h,t,n);if(p)throw r(o),`lerc-getBlobInfo: error code is ${p}`;c=new Uint8Array(f.buffer),l.set(c.slice(u,u+l.length)),i.set(c.slice(h,h+i.length));const g=new Uint32Array(l.buffer),d=new Float64Array(i.buffer),[b,m,A,w,U,x,T,C,V,,D]=g,z={version:b,dimCount:A,width:w,height:U,validPixelCount:T,bandCount:x,blobSize:C,maskCount:V,dataType:m,minValue:d[0],maxValue:d[1],maxZerror:d[2],statistics:[],bandCountWithNoData:D};if(D)return z;if(1===A&&1===x)return r(o),z.statistics.push({minValue:d[0],maxValue:d[1]}),z;const I=A*x*8,F=new Uint8Array(I),_=new Uint8Array(I);let k,B=o,v=0,S=!1;if(c.byteLength<o+2*I?(r(o),S=!0,[B,v,k]=y([e.length,I,I]),c.set(e,B)):[v,k]=y([I,I]),c.set(F,v),c.set(_,k),p=s(o,e.length,A,x,v,k),p)throw r(B),S||r(v),`lerc-getDataRanges: error code is ${p}`;c=new Uint8Array(f.buffer),F.set(c.slice(v,v+I)),_.set(c.slice(k,k+I));const O=new Float64Array(F.buffer),$=new Float64Array(_.buffer),j=z.statistics;for(let r=0;r<x;r++)if(A>1){const e=O.slice(r*A,(r+1)*A),t=$.slice(r*A,(r+1)*A),n=Math.min.apply(null,e),a=Math.max.apply(null,t);j.push({minValue:n,maxValue:a,dimStats:{minValues:e,maxValues:t}})}else j.push({minValue:O[r],maxValue:$[r]});return r(B),S||r(v),z},l.decode=(e,n)=>{const{maskCount:a,dimCount:s,bandCount:l,width:i,height:u,dataType:h,bandCountWithNoData:p}=n,g=t[h],d=i*u,b=new Uint8Array(d*l),m=d*s*l*g.size,A=new Uint8Array(m),w=new Uint8Array(l),U=8*l,x=new Uint8Array(U),[T,C,V,D,z]=y([e.length,b.length,A.length,w.length,x.length]);c.set(e,T),c.set(b,C),c.set(A,V),c.set(w,D),c.set(x,z);const I=o(T,e.length,a,C,s,i,u,l,h,V,D,z);if(I)throw r(T),`lerc-decode: error code is ${I}`;c=new Uint8Array(f.buffer),A.set(c.slice(V,V+m)),b.set(c.slice(C,C+b.length));let F=null;if(p){w.set(c.slice(D,D+l)),x.set(c.slice(z,z+U)),F=[];for(let e=0;e<w.length;e++)F.push(w[e]?x[e]:null)}return r(T),{data:A,maskData:b,noDataValues:F}}}function u(e,t,n,r,a){if(n<2)return e;const s=new r(t*n);if(a)for(let l=0,i=0;l<t;l++)for(let r=0,a=l;r<n;r++,a+=t)s[a]=e[i++];else for(let l=0,i=0;l<t;l++)for(let r=0,a=l;r<n;r++,a+=t)s[i++]=e[a];return s}function c(e,n={}){const r=n.inputOffset??0,a=e instanceof Uint8Array?e.subarray(r):new Uint8Array(e,r),s=l.getBlobInfo(a),{data:i,maskData:o}=l.decode(a,s),{width:c,height:f,bandCount:y,dimCount:h,dataType:p,maskCount:g,statistics:d}=s,b=t[p],m=new b.ctor(i.buffer),A=[],w=[],U=c*f,x=U*h;for(let t=0;t<y;t++){const e=m.subarray(t*x,(t+1)*x);if(n.returnPixelInterleavedDims)A.push(e);else{const t=u(e,U,h,b.ctor,!0);A.push(t)}w.push(o.subarray(t*x,(t+1)*x))}const T=0===g?null:1===g?w[0]:new Uint8Array(U);if(g>1){T.set(w[0]);for(let e=1;e<w.length;e++){const t=w[e];for(let e=0;e<U;e++)T[e]=T[e]&t[e]}}const{noDataValue:C}=n,V=null!=C&&b.range[0]<=C&&b.range[1]>=C;if(g>0&&V){const{noDataValue:e}=n;for(let t=0;t<y;t++){const n=A[t],r=w[t]||T;for(let t=0;t<U;t++)0===r[t]&&(n[t]=e)}}const D=g===y&&y>1?w:null;return{width:c,height:f,bandCount:y,pixelType:n.pixelType&&0===s.version?n.pixelType:b.pixelType,dimCount:h,statistics:d,pixels:A,mask:T,bandMasks:D}}function f(e,t={}){const n=e instanceof Uint8Array?e.subarray(t.inputOffset??0):new Uint8Array(e,t.inputOffset??0);return l.getBlobInfo(n)}export{c as decode,f as getBlobInfo,s as isLoaded,a as load};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import e from"../PixelBlock.js";import i from"./ImageCanvasDecoder.js";import a from"./JpgPlus.js";import{load as s,decode as r}from"./Lerc.js";import{decode as n}from"./Lzw.js";import{Z as o}from"../../../chunks/Zlib.js";import h from"./Raw.js";import{decodeTileOrStrip as c,decode as p}from"./TiffDecoder.js";import{isPlatformLittleEndian as l}from"./utils.js";var d=function(t){var e,i,a,s,r,n;function h(t){var e,i,a,s,r,n,o,h,c,p,l,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),a=this.readUInt16()||100,r.delay=1e3*s/a,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,l=0;0<=e?l<e:l>e;0<=e?++l:--l)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(p=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,p.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,p.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,i=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*i,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return h.load=function(t,e,i){var a;return"function"==typeof e&&(i=e),(a=new XMLHttpRequest).open("GET",t,!0),a.responseType="arraybuffer",a.onload=function(){var t;return t=new h(new Uint8Array(a.response||a.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof i?i(t):void 0},a.send(null)},i=1,a=2,e=0,h.prototype.read=function(t){var e,i;for(i=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)i.push(this.data[this.pos++]);return i},h.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},h.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},h.prototype.decodePixels=function(t){var e,i,a,s,r,n,h,c,p,l,d,u,f,m,g,w,y,x,b,k,T,U,v;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new o(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,i=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<w;s=b+=1)f[i++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[i-u],f[i++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],a=(s-s%u)/u,y=g&&f[(g-1)*w+a*u+s%u],f[i++]=(y+e)%256;break;case 3:for(s=U=0;U<w;s=U+=1)e=t[m++],a=(s-s%u)/u,r=s<u?0:f[i-u],y=g&&f[(g-1)*w+a*u+s%u],f[i++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=v=0;v<w;s=v+=1)e=t[m++],a=(s-s%u)/u,r=s<u?0:f[i-u],0===g?y=x=0:(y=f[(g-1)*w+a*u+s%u],x=a&&f[(g-1)*w+(a-1)*u+s%u]),h=r+y-x,c=Math.abs(h-r),l=Math.abs(h-y),d=Math.abs(h-x),p=c<=l&&c<=d?r:l<=d?y:x,f[i++]=(e+p)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},h.prototype.decodePalette=function(){var t,e,i,a,s,r,n,o,h;for(i=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+i.length),a=0,t=0,e=n=0,o=i.length;n<o;e=n+=3)s[a++]=i[e],s[a++]=i[e+1],s[a++]=i[e+2],s[a++]=null!=(h=r[t++])?h:255;return s},h.prototype.copyToImageData=function(t,e){var i,a,s,r,n,o,h,c,p,l,d;if(a=this.colors,p=null,i=this.hasAlphaChannel,this.palette.length&&(p=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),a=4,i=!0),c=(s=t.data||t).length,n=p||e,r=o=0,1===a)for(;r<c;)h=p?4*e[r/4]:o,l=n[h++],s[r++]=l,s[r++]=l,s[r++]=l,s[r++]=i?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===l?0:255,o=h;else for(;r<c;)h=p?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=i?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},h.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},h.prototype.decodeFrames=function(t){var e,i,a,r,n,o,h,c;if(this.animation){for(c=[],i=n=0,o=(h=this.animation.frames).length;n<o;i=++n)e=h[i],a=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(a,r),e.imageData=a,c.push(e.image=s(a));return c}},h.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===i?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===a&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},h.prototype.animate=function(t){var e,i,a,s,r,n,o=this;return i=0,n=this.animation,s=n.numFrames,a=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=i++%s,h=a[n],o.renderFrame(t,n),s>1&&i/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},h.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},h.prototype.render=function(t){var e,i;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(i=e.createImageData(this.width,this.height),this.copyToImageData(i,this.decodePixels()),e.putImageData(i,0,0))},h}(self);const u=new Set(["jpg","png","bmp","gif"]),f=new Set(["S8","U8","S16","U16","S32","U32","F32","F64"]);async function m(i,a){var n;if(!l)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await s();const{offset:o,noDataValue:h}=a;let c=null==(n=a.pixelType)?void 0:n.toUpperCase();c&&!f.has(c)&&(c=null);const{width:p,height:d,pixelType:u,statistics:m,pixels:g,mask:w}=r(i,{inputOffset:o,noDataValue:h,pixelType:c,returnPixelInterleavedDims:a.returnPixelInterleavedDims});return new e({width:p,height:d,pixelType:u.toLowerCase(),pixels:g,mask:w,statistics:m})}async function g(t,i){const a=await p(t,i.pyramidLevel||0),s=new e({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return s.updateStatistics(),s}async function w(t,i){const a=await c(t,i.customOptions),s=new e({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return s.updateStatistics(),s}function y(t,i){const a=i.pixelType||"u8",s=e.getPixelArrayConstructor(a),r="u8"===a?t:new s(t.buffer),n=[],o=i.planes||1;if(1===o)n.push(r);else for(let e=0;e<o;e++){const a=(i.width||1)*(i.height||t.length),h=new s(a);for(let t=0;t<a;t++)h[t]=r[t*o+e];n.push(h)}const h=new e({width:i.width||1,height:i.height||t.length,pixels:n,pixelType:a,statistics:null});return h.updateStatistics(),h}function x(t,e){return y(new o(new Uint8Array(t)).getBytes(),e)}function b(t,e){return y(n(t,e.offset,e.eof,!e.isInputBigEndian),e)}function k(t,i,a){const{pixelTypeCtor:s}=A(i.pixelType),r=(0,h.decode)(t,{width:i.width,height:i.height,pixelType:s,format:a}),n=new e({width:i.width,height:i.height,pixels:r.pixels,pixelType:i.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function T(t){const i=a.decode(t),s=new e({width:i.width,height:i.height,pixels:i.pixels,pixelType:"U8",mask:i.mask,statistics:null});return s.updateStatistics(),s}function U(t,i){const a=new Uint8Array(t),s=new d(a),{width:r,height:n}=i,o=r*n,h=s.decode();let c,p=0,l=0;const u=new Uint8Array(o);for(p=0;p<o;p++)u[p]=h[4*p+3];const f=new e({width:r,height:n,pixels:[],pixelType:"U8",mask:u,statistics:[]});for(p=0;p<3;p++){for(c=new Uint8Array(o),l=0;l<o;l++)c[l]=h[4*l+p];f.addData({pixels:c})}return f.updateStatistics(),f}async function v(t,a,s,r){const n=new i,o={applyJpegMask:!1,format:a,...s},h=await n.decode(t,o,r),c=new e(h);return c.updateStatistics(),c}function I(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const i=new Uint8Array(e,0,10);let a="";return 255===i[0]&&216===i[1]?a="jpg":137===i[0]&&80===i[1]&&78===i[2]&&71===i[3]?a="png":67===i[0]&&110===i[1]&&116===i[2]&&90===i[3]&&73===i[4]&&109===i[5]&&97===i[6]&&103===i[7]&&101===i[8]&&32===i[9]?a="lerc":76===i[0]&&101===i[1]&&114===i[2]&&99===i[3]&&50===i[4]&&32===i[5]?a="lerc2":73===i[0]&&73===i[1]&&42===i[2]&&0===i[3]||77===i[0]&&77===i[1]&&0===i[2]&&42===i[3]||73===i[0]&&73===i[1]&&43===i[2]&&0===i[3]||77===i[0]&&77===i[1]&&0===i[2]&&43===i[3]?a="tiff":71===i[0]&&73===i[1]&&70===i[2]?a="gif":66===i[0]&&77===i[1]?a="bmp":String.fromCharCode.apply(null,i).toLowerCase().includes("error")&&(a="error"),a}function C(e){let i=null;switch(e){case"lerc":case"lerc2":i=m;break;case"jpg":i=T;break;case"png":i=U;break;case"bsq":case"bip":i=(t,i)=>k(t,i,e);break;case"tiff":i=g;break;case"deflate":i=x;break;case"lzw":i=b;break;case"error":i=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:i=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return i}function A(t){let e=null,i=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":i=255,e=Uint8Array;break;case"u16":i=i||65535,e=Uint16Array;break;case"u32":i=i||2**32-1,e=Uint32Array;break;case"s8":i=i||-128,e=Int8Array;break;case"s16":i=i||-32768,e=Int16Array;break;case"s32":i=i||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:i}}function D(t,i=1){if(!t)return;const{pixels:a,width:s,height:r,mask:n}=t;if(!a||0===a.length)return;const o=a.length,h=s-1,c=r-1,p=[];let l,d,u,f,m,g,w;const y=e.getPixelArrayConstructor(t.pixelType);if(0===i){for(l=0;l<o;l++){for(m=a[l],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=m[f+u];p.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=n[f+u]}else{for(l=0;l<o;l++){for(m=a[l],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=(m[f+u]+m[f+u+1]+m[f+s+u]+m[f+s+u+1])/4;p.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=Math.min.apply(null,[n[f+u],n[f+u+1],n[f+s+u],n[f+s+u+1]])}t.width=h,t.height=c,t.mask=w,t.pixels=p}function P(t){let e=I(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function S(e,i={},a){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let s,r,n=i.format&&i.format.toLowerCase();if(!("bsq"!==n&&"bip"!==n||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");return"tiff"===n&&i.customOptions?w(e,i):((!n||"bsq"!==n&&"bip"!==n&&"deflate"!==n&&"lzw"!==n)&&(n=I(e)),i.useCanvas&&u.has(n)?r=await v(e,n,i,a):(s=C(n),i.isPoint&&((i={...i}).width++,i.height++),r=await s(e,i),i.isPoint&&D(r)),r)}export{S as decode,P as getFormat};
5
+ import t from"../../../core/Error.js";import e from"../PixelBlock.js";import i from"./ImageCanvasDecoder.js";import a from"./JpgPlus.js";import{load as s,decode as r}from"./Lerc.js";import{decode as n}from"./Lzw.js";import{Z as o}from"../../../chunks/Zlib.js";import h from"./Raw.js";import{decodeTileOrStrip as c,decode as p}from"./TiffDecoder.js";import{isPlatformLittleEndian as l}from"./utils.js";var d=function(t){var e,i,a,s,r,n;function h(t){var e,i,a,s,r,n,o,h,c,p,l,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),a=this.readUInt16()||100,r.delay=1e3*s/a,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,l=0;0<=e?l<e:l>e;0<=e?++l:--l)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(p=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,p.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,p.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,i=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*i,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return h.load=function(t,e,i){var a;return"function"==typeof e&&(i=e),(a=new XMLHttpRequest).open("GET",t,!0),a.responseType="arraybuffer",a.onload=function(){var t;return t=new h(new Uint8Array(a.response||a.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof i?i(t):void 0},a.send(null)},i=1,a=2,e=0,h.prototype.read=function(t){var e,i;for(i=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)i.push(this.data[this.pos++]);return i},h.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},h.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},h.prototype.decodePixels=function(t){var e,i,a,s,r,n,h,c,p,l,d,u,f,m,g,w,y,x,b,k,T,U,I;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new o(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,i=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<w;s=b+=1)f[i++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[i-u],f[i++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],a=(s-s%u)/u,y=g&&f[(g-1)*w+a*u+s%u],f[i++]=(y+e)%256;break;case 3:for(s=U=0;U<w;s=U+=1)e=t[m++],a=(s-s%u)/u,r=s<u?0:f[i-u],y=g&&f[(g-1)*w+a*u+s%u],f[i++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=I=0;I<w;s=I+=1)e=t[m++],a=(s-s%u)/u,r=s<u?0:f[i-u],0===g?y=x=0:(y=f[(g-1)*w+a*u+s%u],x=a&&f[(g-1)*w+(a-1)*u+s%u]),h=r+y-x,c=Math.abs(h-r),l=Math.abs(h-y),d=Math.abs(h-x),p=c<=l&&c<=d?r:l<=d?y:x,f[i++]=(e+p)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},h.prototype.decodePalette=function(){var t,e,i,a,s,r,n,o,h;for(i=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+i.length),a=0,t=0,e=n=0,o=i.length;n<o;e=n+=3)s[a++]=i[e],s[a++]=i[e+1],s[a++]=i[e+2],s[a++]=null!=(h=r[t++])?h:255;return s},h.prototype.copyToImageData=function(t,e){var i,a,s,r,n,o,h,c,p,l,d;if(a=this.colors,p=null,i=this.hasAlphaChannel,this.palette.length&&(p=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),a=4,i=!0),c=(s=t.data||t).length,n=p||e,r=o=0,1===a)for(;r<c;)h=p?4*e[r/4]:o,l=n[h++],s[r++]=l,s[r++]=l,s[r++]=l,s[r++]=i?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===l?0:255,o=h;else for(;r<c;)h=p?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=i?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},h.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},h.prototype.decodeFrames=function(t){var e,i,a,r,n,o,h,c;if(this.animation){for(c=[],i=n=0,o=(h=this.animation.frames).length;n<o;i=++n)e=h[i],a=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(a,r),e.imageData=a,c.push(e.image=s(a));return c}},h.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===i?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===a&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},h.prototype.animate=function(t){var e,i,a,s,r,n,o=this;return i=0,n=this.animation,s=n.numFrames,a=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=i++%s,h=a[n],o.renderFrame(t,n),s>1&&i/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},h.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},h.prototype.render=function(t){var e,i;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(i=e.createImageData(this.width,this.height),this.copyToImageData(i,this.decodePixels()),e.putImageData(i,0,0))},h}(self);const u=new Set(["jpg","png","bmp","gif"]),f=new Set(["S8","U8","S16","U16","S32","U32","F32","F64"]);async function m(i,a){if(!l)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await s();const{offset:n,noDataValue:o}=a;let h=a.pixelType?.toUpperCase();h&&!f.has(h)&&(h=null);const{width:c,height:p,pixelType:d,statistics:u,pixels:m,mask:g}=r(i,{inputOffset:n,noDataValue:o,pixelType:h,returnPixelInterleavedDims:a.returnPixelInterleavedDims});return new e({width:c,height:p,pixelType:d.toLowerCase(),pixels:m,mask:g,statistics:u})}async function g(t,i){const a=await p(t,i.pyramidLevel||0),s=new e({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return s.updateStatistics(),s}async function w(t,i){const a=await c(t,i.customOptions),s=new e({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return s.updateStatistics(),s}function y(t,i){const a=i.pixelType||"u8",s=e.getPixelArrayConstructor(a),r="u8"===a?t:new s(t.buffer),n=[],o=i.planes||1;if(1===o)n.push(r);else for(let e=0;e<o;e++){const a=(i.width||1)*(i.height||t.length),h=new s(a);for(let t=0;t<a;t++)h[t]=r[t*o+e];n.push(h)}const h=new e({width:i.width||1,height:i.height||t.length,pixels:n,pixelType:a,statistics:null});return h.updateStatistics(),h}function x(t,e){return y(new o(new Uint8Array(t)).getBytes(),e)}function b(t,e){return y(n(t,e.offset,e.eof,!e.isInputBigEndian),e)}function k(t,i,a){const{pixelTypeCtor:s}=A(i.pixelType),r=(0,h.decode)(t,{width:i.width,height:i.height,pixelType:s,format:a}),n=new e({width:i.width,height:i.height,pixels:r.pixels,pixelType:i.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function T(t){const i=a.decode(t),s=new e({width:i.width,height:i.height,pixels:i.pixels,pixelType:"U8",mask:i.mask,statistics:null});return s.updateStatistics(),s}function U(t,i){const a=new Uint8Array(t),s=new d(a),{width:r,height:n}=i,o=r*n,h=s.decode();let c,p=0,l=0;const u=new Uint8Array(o);for(p=0;p<o;p++)u[p]=h[4*p+3];const f=new e({width:r,height:n,pixels:[],pixelType:"U8",mask:u,statistics:[]});for(p=0;p<3;p++){for(c=new Uint8Array(o),l=0;l<o;l++)c[l]=h[4*l+p];f.addData({pixels:c})}return f.updateStatistics(),f}async function I(t,a,s,r){const n=new i,o={applyJpegMask:!1,format:a,...s},h=await n.decode(t,o,r),c=new e(h);return c.updateStatistics(),c}function v(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const i=new Uint8Array(e,0,10);let a="";return 255===i[0]&&216===i[1]?a="jpg":137===i[0]&&80===i[1]&&78===i[2]&&71===i[3]?a="png":67===i[0]&&110===i[1]&&116===i[2]&&90===i[3]&&73===i[4]&&109===i[5]&&97===i[6]&&103===i[7]&&101===i[8]&&32===i[9]?a="lerc":76===i[0]&&101===i[1]&&114===i[2]&&99===i[3]&&50===i[4]&&32===i[5]?a="lerc2":73===i[0]&&73===i[1]&&42===i[2]&&0===i[3]||77===i[0]&&77===i[1]&&0===i[2]&&42===i[3]||73===i[0]&&73===i[1]&&43===i[2]&&0===i[3]||77===i[0]&&77===i[1]&&0===i[2]&&43===i[3]?a="tiff":71===i[0]&&73===i[1]&&70===i[2]?a="gif":66===i[0]&&77===i[1]?a="bmp":String.fromCharCode.apply(null,i).toLowerCase().includes("error")&&(a="error"),a}function C(e){let i=null;switch(e){case"lerc":case"lerc2":i=m;break;case"jpg":i=T;break;case"png":i=U;break;case"bsq":case"bip":i=(t,i)=>k(t,i,e);break;case"tiff":i=g;break;case"deflate":i=x;break;case"lzw":i=b;break;case"error":i=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:i=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return i}function A(t){let e=null,i=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":i=255,e=Uint8Array;break;case"u16":i=i||65535,e=Uint16Array;break;case"u32":i=i||2**32-1,e=Uint32Array;break;case"s8":i=i||-128,e=Int8Array;break;case"s16":i=i||-32768,e=Int16Array;break;case"s32":i=i||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:i}}function D(t,i=1){if(!t)return;const{pixels:a,width:s,height:r,mask:n}=t;if(!a||0===a.length)return;const o=a.length,h=s-1,c=r-1,p=[];let l,d,u,f,m,g,w;const y=e.getPixelArrayConstructor(t.pixelType);if(0===i){for(l=0;l<o;l++){for(m=a[l],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=m[f+u];p.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=n[f+u]}else{for(l=0;l<o;l++){for(m=a[l],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=(m[f+u]+m[f+u+1]+m[f+s+u]+m[f+s+u+1])/4;p.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=Math.min.apply(null,[n[f+u],n[f+u+1],n[f+s+u],n[f+s+u+1]])}t.width=h,t.height=c,t.mask=w,t.pixels=p}function P(t){let e=v(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function S(e,i={},a){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let s,r,n=i.format&&i.format.toLowerCase();if(!("bsq"!==n&&"bip"!==n||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");return"tiff"===n&&i.customOptions?w(e,i):((!n||"bsq"!==n&&"bip"!==n&&"deflate"!==n&&"lzw"!==n)&&(n=v(e)),i.useCanvas&&u.has(n)?r=await I(e,n,i,a):(s=C(n),i.isPoint&&((i={...i}).width++,i.height++),r=await s(e,i),i.isPoint&&D(r)),r)}export{S as decode,P as getFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import s from"./TiffTags.js";import{isPlatformLittleEndian as l}from"./utils.js";import{Z as r}from"../../../chunks/Zlib.js";const o=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],f=4294967296,u=new Set([1,5,6,7,8,34712,34887]);function c(e,t){let n="unknown";return 3===e?n="f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function h(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;default:t=Float32Array}return t}function g(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function w(e,t){var n;return null==(n=e.get(t))?void 0:n.values}function d(e,t){var n;return null==(n=e.get(t))?void 0:n.values}function p(e,t){var n;return null==(n=e.get(t))?void 0:n.values[0]}function I(e,t){var n;return null==(n=e.get(t))?void 0:n.values[0]}function T(e,t,n,a=0,i=s.TIFF_TAGS,l=4){const r=8===l,o=r?U(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),f=4+2*l,u=r?8:2,c=u+o*f;if(n+c>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:c};const h=n+c+4<=e.byteLength?L(new DataView(e,n+c,8===l?8:4),0,t,8===l):null,g=n+u,w=new Map;let d,p,I,T,E,y,m;for(let A=0;A<o;A++){p=new DataView(e,g+f*A,f),I=p.getUint16(0,t),E=p.getUint16(2,t),T=s.getTagName(I,i);const n=[];2===l?(y=p.getUint16(4,t),m=p.getUint16(6,t)):4===l?(y=p.getUint32(4,t),m=p.getUint32(8,t)):8===l&&(y=L(p,4,t,!0),m=L(p,12,t,!0),n.push(p.getUint32(12,t)),n.push(p.getUint32(16,t))),d={id:I,type:E,valueCount:y,valueOffset:m,valueOffsets:n,values:null},x(e,t,d,a,!1,l),w.set(T,d)}return{success:!0,ifd:w,nextIFD:h,requiredBufferSize:c}}const E=(e,t)=>a(e,{inputOffset:t}).pixels[0];async function y(e,a,s,o,f){var u,g;const w=l===a,d=I(s,"BITSPERSAMPLE"),p=c(null!=(u=I(s,"SAMPLEFORMAT"))?u:1,d),T=null!=(g=I(s,"COMPRESSION"))?g:1,y=h(p);let m,A,S,M,x,b,O;if(34887===T)return await n(),E(e,o);if(1===T)S=e.slice(o,o+f),M=new Uint8Array(S);else if(8===T||32946===T)M=new Uint8Array(e,o,f),b=new r(M),O=b.getBytes(),S=new ArrayBuffer(O.length),M=new Uint8Array(S),M.set(O);else if(6===T){M=new Uint8Array(e,o,f);const n=new t;n.parse(M);const a=n.getData(n.width,n.height,!0);S=new ArrayBuffer(a.length),M=new Uint8Array(S),M.set(a)}else if(7===T){const n=s.get("JPEGTABLES").values,a=n.length-2;M=new Uint8Array(a+f-2);for(let e=0;e<a;e++)M[e]=n[e];const i=new Uint8Array(e,o+2,f-2);for(let e=0;e<i.length;e++)M[a+e]=i[e];const l=new t;l.parse(M);const r=l.getData(l.width,l.height,!0);S=new ArrayBuffer(r.length),M=new Uint8Array(S),M.set(r)}else 5===T&&(M=i(e,o,f,a),S=M.buffer);if("u8"===p||"s8"===p||w)A=new y(S);else{switch(S=new ArrayBuffer(M.length),x=new Uint8Array(S),p){case"u16":case"s16":for(m=0;m<M.length;m+=2)x[m]=M[m+1],x[m+1]=M[m];break;case"u32":case"s32":case"f32":for(m=0;m<M.length;m+=4)x[m]=M[m+3],x[m+1]=M[m+2],x[m+2]=M[m+1],x[m+3]=M[m]}A=new y(S)}return A}async function m(e,t,n){var a;const i=d(n,"TILEOFFSETS");if(void 0===i)return null;const s=d(n,"TILEBYTECOUNTS"),{width:l,height:r,pixelType:o,tileWidth:f,tileHeight:u}=b([n]),c=O(n,t),g=t.planes,w=l*r,p=I(n,"BITSPERSAMPLE"),T=34887===(null!=(a=I(n,"COMPRESSION"))?a:1),E=h(o),m=[];for(let h=0;h<g;h++)m.push(new E(w));let A,S,M,x,D,U,v,L,P,N,k,G,R;const C=Math.ceil(l/f);if(p%8==0)if(T&&c&&g>1){const a=Math.round(i.length/g);for(A=0;A<a;A++){U=Math.floor(A/C)*u,v=A%C*f,L=U*l+v;for(let a=0;a<g;a++){const o=A*g+a;for(M=await y(e,t.littleEndian,n,i[o],s[o]),N=0,P=L,G=Math.min(f,l-v),k=Math.min(u,r-U),R=m[a],x=0;x<k;x++)for(P=L+x*l,N=x*f,D=0;D<G;D++,P++,N++)R[P]=M[N]}}}else for(A=0;A<i.length;A++)for(U=Math.floor(A/C)*u,v=A%C*f,L=U*l+v,M=await y(e,t.littleEndian,n,i[A],s[A]),N=0,P=L,G=Math.min(f,l-v),k=Math.min(u,r-U),S=0;S<g;S++)if(R=m[S],c||T)for(x=0;x<k;x++)for(P=L+x*l,N=f*u*S+x*f,D=0;D<G;D++,P++,N++)R[P]=M[N];else for(x=0;x<k;x++)for(P=L+x*l,N=x*f*g+S,D=0;D<G;D++,P++,N+=g)R[P]=M[N];return{width:l,height:r,pixelType:o,pixels:m}}const A=(e,n,a)=>{var s;const o=l===n.littleEndian,f=d(a,"STRIPOFFSETS");if(void 0===f)return null;const{width:u,height:c,pixelType:g}=b([a]),w=n.planes,p=u*c,T=I(a,"BITSPERSAMPLE"),E=h(g),y=new E(p*w),m=d(a,"STRIPBYTECOUNTS"),A=I(a,"ROWSPERSTRIP"),S=null!=(s=I(a,"COMPRESSION"))?s:1;let M,x,O,D,U,v,L,P,N,k,G,R=A;if(T%8==0)for(M=0;M<f.length;M++){if(U=M*(A*u)*w,R=(M+1)*A>c?c-M*A:A,"u8"===g||"s8"===g||o){if(8===S||32946===S)L=new Uint8Array(e,f[M],m[M]),k=new r(L),G=k.getBytes(),v=new ArrayBuffer(G.length),L=new Uint8Array(v),L.set(G),L.length!==R*u*w*T/8&&console.log("strip byte counts is different than expected");else if(6===S){L=new Uint8Array(e,f[M],m[M]);const n=new t;n.parse(L);const a=n.getData(n.width,n.height,!0);v=new ArrayBuffer(a.length),L=new Uint8Array(v),L.set(a)}else 5===S?(L=i(e,f[M],m[M],n.littleEndian),v=L.buffer):1===S&&(m[M]!==R*u*w*T/8&&console.log("strip byte counts is different than expected"),v=e.slice(f[M],f[M]+m[M]));D=new E(v)}else{switch(6===S||8===S||32946===S?(L=new Uint8Array(e,f[M],m[M]),k=new r(L),L=k.getBytes(),v=new ArrayBuffer(L.length),P=new Uint8Array(v),L.length!==R*u*w*T/8&&console.log("strip byte counts is different than expected")):1===S&&(m[M]!==R*u*w*T/8&&console.log("strip byte counts is different than expected"),v=new ArrayBuffer(m[M]),L=new Uint8Array(e,f[M],m[M]),P=new Uint8Array(v)),g){case"u16":case"s16":for(O=0;O<L.length;O+=2)P[O]=L[O+1],P[O+1]=L[O];break;case"u32":case"s32":case"f32":for(O=0;O<L.length;O+=4)P[O]=L[O+3],P[O+1]=L[O+2],P[O+2]=L[O+1],P[O+3]=L[O]}D=new E(v)}y.set(D,U)}const C=[];if(1===w)C.push(y);else for(M=0;M<w;M++){for(N=new E(p),x=0;x<p;x++)N[x]=y[x*w+M];C.push(N)}return{width:u,height:c,pixelType:g,pixels:C}},S=(e,t,n)=>{if(!(e&&e.length>0&&t&&n))return null;let a,i,s;const l=e[0].length,r=e.length,o=new Uint8Array(l);for(let f=0;f<r;f++)if(a=e[f],i=t[f],s=n[f],0===f)for(let e=0;e<l;e++)o[e]=a[e]<i||a[e]>s?0:1;else for(let e=0;e<l;e++)o[e]&&(o[e]=a[e]<i||a[e]>s?0:1);return o},M=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,s,l,r;for(let I=0;I<t.length;I++)a=t[I],i=a.slice("<Item ".length,a.indexOf(">")),l=a.indexOf("sample="),l>-1&&(r=a.slice(l+'sample="'.length,a.indexOf('"',l+'sample="'.length))),l=a.indexOf("name="),l>-1&&(i=a.slice(l+'name="'.length,a.indexOf('"',l+'name="'.length))),i&&(s=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=r?n.has(i)?n.get(i)[r]=s:n.set(i,[s]):n.set(i,s)),r=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),w=n.get("WavelengthMin"),d=n.get("WavelengthMax");let p=null;if(g){p=[];for(let e=0;e<g.length;e++)p.push({BandName:g[e],WavelengthMin:w&&parseFloat(w[e]),WavelengthMax:d&&parseFloat(d[e])})}return{statistics:h,bandProperties:p,dataType:n.get("DataType"),rawMetadata:n}};function x(e,t,n,a=0,i=!1,s=4){if(n.values)return!0;const l=n.type,r=n.valueCount;let u=n.valueOffset,c=[];const h=o[l],g=8*h,w=r*h,d=r*o[l]*8;let p,I;const T=8===s?64:32,E=n.valueOffsets;if(d>T){if(w>(i?e.byteLength:e?e.byteLength-u+a:0))return n.offlineOffsetSize=[u,w],n.values=null,!1}if(d<=T){if(!t)if(T<=32)u>>>=32-d;else{const e=null!=E&&E.length?E[0]:u>>>0,t=null!=E&&E.length?E[1]:Math.round((u-e)/f);d<=32?(u=e>>>32-d,E[0]=u):(u=e*2**(32-d)+(t>>>32-d),E[0]=e,E[1]=t>>>32-d)}if(1===r&&g===T)c=[u];else if(64===T){const e=null!=E&&E.length?E[0]:u>>>0,t=null!=E&&E.length?E[1]:Math.round((u-e)/f);let n=e,a=32;for(I=1;I<=r;I++){const e=32-g*I%32;if(a<g){const i=n<<e>>>32-a,s=t<<32-a>>>32-a;n=t,c.push(i+s*2**(g-a)),a-=32-(g-a)}else c.push(n<<e>>>32-g),a-=g;0===a&&(a=32,n=t)}}else for(I=1;I<=r;I++){const e=32-g*I;c.push(u<<e>>>32-g)}}else{u-=a,i&&(u=0);for(let n=u;n<u+w;n+=h){switch(l){case 1:case 2:case 7:p=new DataView(e,n,1).getUint8(0);break;case 3:p=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:p=new DataView(e,n,4).getUint32(0,t);break;case 5:p=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:p=new DataView(e,n,1).getInt8(0);break;case 8:p=new DataView(e,n,2).getInt16(0,t);break;case 9:p=new DataView(e,n,4).getInt32(0,t);break;case 10:p=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:p=new DataView(e,n,4).getFloat32(0,t);break;case 12:p=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:p=U(new DataView(e,n,8),0,t);break;case 17:p=v(new DataView(e,n,8),0,t);break;default:p=null}c.push(p)}}if(2===l){let e="";const t=c;for(c=[],I=0;I<t.length;I++)0===t[I]&&""!==e?(c.push(e),e=""):e+=String.fromCharCode(t[I]);""===e&&0!==c.length||c.push(e)}return n.values=c,!0}function b(e){var t,n;const a=e[0],i=I(a,"TILEWIDTH"),s=I(a,"TILELENGTH"),l=I(a,"IMAGEWIDTH"),r=I(a,"IMAGELENGTH"),o=I(a,"BITSPERSAMPLE"),f=I(a,"SAMPLESPERPIXEL"),h=null!=(t=I(a,"SAMPLEFORMAT"))?t:1,T=c(h,o),E=O(a),y=w(a,"GDAL_NODATA");let m;null!=y&&y.length&&(m=y.map((e=>parseFloat(e))),m.some((e=>isNaN(e)))&&(m=null));const A=null!=(n=I(a,"COMPRESSION"))?n:1;let S;switch(A){case 1:S="NONE";break;case 2:case 3:case 4:case 32771:S="CCITT";break;case 5:S="LZW";break;case 6:case 7:S="JPEG";break;case 32773:S="PACKBITS";break;case 8:case 32946:S="DEFLATE";break;case 34712:S="JPEG2000";break;case 34887:S="LERC";break;default:S=String(A)}let x=!0,b="";u.has(A)||(x=!1,b+="unsupported tag compression "+A),h>3&&(x=!1,b+="unsupported tag sampleFormat "+h),o%8!=0&&(x=!1,b+="unsupported tag bitsPerSample "+o);const D=p(a,"GEOASCIIPARAMS");let U;if(D){const e=D.split("|").find((e=>e.includes("ESRI PE String = "))),t=e?e.replace("ESRI PE String = ",""):"";U=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const v=d(a,"GEOTIEPOINTS"),L=d(a,"GEOPIXELSCALE"),P=d(a,"GEOTRANSMATRIX"),N=a.has("GEOKEYDIRECTORY")?a.get("GEOKEYDIRECTORY").data:null;let G,R,C=!1;if(N){C=2===I(N,"GTRasterTypeGeoKey");const e=I(N,"GTModelTypeGeoKey");if(2===e){const e=I(N,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(U={wkid:e})}else if(1===e){const e=I(N,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(U={wkid:e})}}if(L&&v&&v.length>=6?(G=[L[0],0,v[3]-v[0]*L[0],0,-Math.abs(L[1]),v[4]-v[1]*L[1]],C&&(G[2]-=.5*G[0]+.5*G[1],G[5]-=.5*G[3]+.5*G[4])):P&&16===P.length&&(G=C?[P[0],P[1],P[3]-.5*P[0],P[4],P[5],P[7]-.5*P[5]]:[P[0],P[1],P[3],P[4],P[5],P[7]]),G){const e=[{x:0,y:r},{x:0,y:0},{x:l,y:r},{x:l,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(let l=0;l<e.length;l++)t=g(e[l],G),n=t.x>n?n:t.x,i=t.x<i?i:t.x,a=t.y>a?a:t.y,s=t.y<s?s:t.y;R={xmin:n,xmax:i,ymin:a,ymax:s,spatialReference:U}}else R={xmin:-.5,ymin:.5-r,xmax:l-.5,ymax:.5,spatialReference:U};const F=e.filter((e=>1===p(e,"NEWSUBFILETYPE")));let B,V,W,H,Y;if(F.length>0){B=Math.round(Math.log(l/I(F[0],"IMAGEWIDTH"))/Math.LN2);const e=F[F.length-1];V=Math.round(Math.log(l/I(e,"IMAGEWIDTH"))/Math.LN2),W=I(e,"TILEWIDTH"),H=I(e,"TILELENGTH")}W=V>0?W||i:null,H=V>0?H||s:null,i&&(Y=[{maxCol:Math.ceil(l/i)-1,maxRow:Math.ceil(r/s)-1,minRow:0,minCol:0}],F.forEach((e=>{Y.push({maxCol:Math.ceil(I(e,"IMAGEWIDTH")/I(e,"TILEWIDTH"))-1,maxRow:Math.ceil(I(e,"IMAGELENGTH")/I(e,"TILELENGTH"))-1,minRow:0,minCol:0})})));const _=p(e[0],"GDAL_METADATA"),K=M(_);return b+=" "+k({width:l,height:r,tileWidth:i,tileHeight:s,planes:f,ifds:e}),{width:l,height:r,tileWidth:i,tileHeight:s,planes:f,isBSQ:E,pixelType:T,compression:S,noData:m,isSupported:x,message:b,extent:R,affine:L?null:G,firstPyramidLevel:B,maximumPyramidLevel:V,pyramidBlockWidth:W,pyramidBlockHeight:H,tileBoundary:Y,metadata:K}}function O(e,t){const n=w(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function D(e){const{littleEndian:t,isBigTiff:n,firstIFD:a}=P(e);let i=a;const l=[];do{const a=N(e,t,i,0,s.TIFF_TAGS,n?8:4);if(!a.success)break;l.push(a.ifd),i=a.nextIFD}while(i>0);return{...b(l),littleEndian:t,isBigTiff:n,ifds:l}}function U(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*f+a:a*f+i}function v(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const s=(n?a:i)>=0?1:-1;n?a*=s:i*=s;return s*(n?i*f+a:a*f+i)}function L(e,t,n,a){return a?U(e,t,n):e.getUint32(t,n)}function P(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw"unexpected endianess byte";a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw"unexpected tiff identifier";let s=4;const l=43===i;if(l){const e=t.getUint16(s,a);if(s+=2,8!==e)throw"unsupported bigtiff version";if(0!==t.getUint16(s,a))throw"unsupported bigtiff version";s+=2}return{littleEndian:a,isBigTiff:l,firstIFD:L(t,s,a,l)}}function N(t,n,a,i=0,l=s.TIFF_TAGS,r=4){const o=T(t,n,a,i,l,r);let f;const u=o.ifd;if(u){if(s.ifdTags.forEach(((e,a)=>{u.has(a)&&(f=u.get(a),f.data=T(t,n,f.valueOffset-i,i,e).ifd)})),u.has("GEOKEYDIRECTORY")){f=u.get("GEOKEYDIRECTORY");const e=f.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];f.data=T(t,n,f.valueOffset+6-i,i,s.GEO_KEYS,2).ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(u.has("XMP")){f=u.get("XMP");const t=f.values;"number"==typeof t[0]&&7===f.type&&(f.values=[e(new Uint8Array(t))])}}return o}function k(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,s=e.planes,l=i?i*a:t*n,r=I(e.ifds[0],"BITSPERSAMPLE");let o="";return l*s>2**30/(r>8?r/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}async function G(e,t){var n;const{headerInfo:a,ifd:i,offsets:s,sizes:l}=t,r=[];for(let h=0;h<s.length;h++){const t=await y(e,a.littleEndian,i,s[h],l[h]||e.byteLength);r.push(t)}const o=O(i,a),{pixelType:f,planes:u}=a,c=h(f),g=I(i,"TILEWIDTH"),w=I(i,"TILELENGTH"),d=null!=(n=I(i,"COMPRESSION"))?n:1,p=g*w;let T;const E=[];let m=r[0];const A=34887===d;for(let h=0;h<u;h++){if(T=new c(p),o&&A){m=r[h];for(let e=0;e<p;e++)T[e]=m[h][e+h]}else if(o||A&&!o)T=m.slice(p*h,p*(h+1));else for(let e=0;e<p;e++)T[e]=m[e*u+h];E.push(T)}const M=a.noData?a.noData[0]:null,x=a.metadata?a.metadata.statistics:null,b=x?x.map((e=>e.min)):null,D=x?x.map((e=>e.max)):null;let U,v;if(null!=M)if(U=new Uint8Array(p),Math.abs(M)>1e24)for(v=0;v<p;v++)Math.abs((E[0][v]-M)/M)<1e-6?U[v]=0:U[v]=1;else for(v=0;v<p;v++)E[0][v]===M?U[v]=0:U[v]=1;else b&&D&&t.applyMinMaxConstraint&&(U=S(E,b,D));return{pixelType:f,width:g,height:w,pixels:E,mask:U,noDataValue:M}}async function R(e,t=0,n){n=n||D(e);const{ifds:a,noData:i}=n;if(0===a.length)throw"no valid image file directory";const s=k(n);if(s)throw s;let l,r;const o=-1===t?a[a.length-1]:a[t],f=i?i[0]:null;if(r=n.tileWidth?await m(e,n,o):await A(e,n,o),null!==f){if(r.mask=new Uint8Array(r.width*r.height),Math.abs(f)>1e24)for(l=0;l<r.width*r.height;l++)Math.abs((r.pixels[0][l]-f)/f)<1e-6?r.mask[l]=0:r.mask[l]=1;else for(l=0;l<r.width*r.height;l++)r.pixels[0][l]===f?r.mask[l]=0:r.mask[l]=1;r.noDataValue=f}return r}export{R as decode,G as decodeTileOrStrip,b as getImageInfo,O as isBSQConfig,x as parseFieldValues,D as parseHeader,N as parseIFD,P as parseSignature};
5
+ import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import s from"./TiffTags.js";import{isPlatformLittleEndian as r}from"./utils.js";import{Z as l}from"../../../chunks/Zlib.js";const o=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],f=4294967296,c=new Set([1,5,6,7,8,34712,34887]);function u(e,t){let n="unknown";return 3===e?n="f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function h(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;default:t=Float32Array}return t}function g(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function w(e,t){return e.get(t)?.values}function p(e,t){return e.get(t)?.values}function d(e,t){return e.get(t)?.values[0]}function I(e,t){return e.get(t)?.values[0]}function T(e,t,n,a=0,i=s.TIFF_TAGS,r=4){const l=8===r,o=l?U(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),f=4+2*r,c=l?8:2,u=c+o*f;if(n+u>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:u};const h=n+u+4<=e.byteLength?P(new DataView(e,n+u,8===r?8:4),0,t,8===r):null,g=n+c,w=new Map;let p,d,I,T,E,y,m;for(let A=0;A<o;A++){d=new DataView(e,g+f*A,f),I=d.getUint16(0,t),E=d.getUint16(2,t),T=s.getTagName(I,i);const n=[];2===r?(y=d.getUint16(4,t),m=d.getUint16(6,t)):4===r?(y=d.getUint32(4,t),m=d.getUint32(8,t)):8===r&&(y=P(d,4,t,!0),m=P(d,12,t,!0),n.push(d.getUint32(12,t)),n.push(d.getUint32(16,t))),p={id:I,type:E,valueCount:y,valueOffset:m,valueOffsets:n,values:null},x(e,t,p,a,!1,r),w.set(T,p)}return{success:!0,ifd:w,nextIFD:h,requiredBufferSize:u}}const E=(e,t)=>a(e,{inputOffset:t}).pixels[0];async function y(e,a,s,o,f){const c=r===a,g=I(s,"BITSPERSAMPLE"),w=u(I(s,"SAMPLEFORMAT")??1,g),p=I(s,"COMPRESSION")??1,d=h(w);let T,y,m,A,S,M,x;if(34887===p)return await n(),E(e,o);if(1===p)m=e.slice(o,o+f),A=new Uint8Array(m);else if(8===p||32946===p)A=new Uint8Array(e,o,f),M=new l(A),x=M.getBytes(),m=new ArrayBuffer(x.length),A=new Uint8Array(m),A.set(x);else if(6===p){A=new Uint8Array(e,o,f);const n=new t;n.parse(A);const a=n.getData(n.width,n.height,!0);m=new ArrayBuffer(a.length),A=new Uint8Array(m),A.set(a)}else if(7===p){const n=s.get("JPEGTABLES").values,a=n.length-2;A=new Uint8Array(a+f-2);for(let e=0;e<a;e++)A[e]=n[e];const i=new Uint8Array(e,o+2,f-2);for(let e=0;e<i.length;e++)A[a+e]=i[e];const r=new t;r.parse(A);const l=r.getData(r.width,r.height,!0);m=new ArrayBuffer(l.length),A=new Uint8Array(m),A.set(l)}else 5===p&&(A=i(e,o,f,a),m=A.buffer);if("u8"===w||"s8"===w||c)y=new d(m);else{switch(m=new ArrayBuffer(A.length),S=new Uint8Array(m),w){case"u16":case"s16":for(T=0;T<A.length;T+=2)S[T]=A[T+1],S[T+1]=A[T];break;case"u32":case"s32":case"f32":for(T=0;T<A.length;T+=4)S[T]=A[T+3],S[T+1]=A[T+2],S[T+2]=A[T+1],S[T+3]=A[T]}y=new d(m)}return y}async function m(e,t,n){const a=p(n,"TILEOFFSETS");if(void 0===a)return null;const i=p(n,"TILEBYTECOUNTS"),{width:s,height:r,pixelType:l,tileWidth:o,tileHeight:f}=b([n]),c=O(n,t),u=t.planes,g=s*r,w=I(n,"BITSPERSAMPLE"),d=34887===(I(n,"COMPRESSION")??1),T=h(l),E=[];for(let h=0;h<u;h++)E.push(new T(g));let m,A,S,M,x,D,U,L,P,N,k,G,R;const C=Math.ceil(s/o);if(w%8==0)if(d&&c&&u>1){const l=Math.round(a.length/u);for(m=0;m<l;m++){D=Math.floor(m/C)*f,U=m%C*o,L=D*s+U;for(let l=0;l<u;l++){const c=m*u+l;for(S=await y(e,t.littleEndian,n,a[c],i[c]),N=0,P=L,G=Math.min(o,s-U),k=Math.min(f,r-D),R=E[l],M=0;M<k;M++)for(P=L+M*s,N=M*o,x=0;x<G;x++,P++,N++)R[P]=S[N]}}}else for(m=0;m<a.length;m++)for(D=Math.floor(m/C)*f,U=m%C*o,L=D*s+U,S=await y(e,t.littleEndian,n,a[m],i[m]),N=0,P=L,G=Math.min(o,s-U),k=Math.min(f,r-D),A=0;A<u;A++)if(R=E[A],c||d)for(M=0;M<k;M++)for(P=L+M*s,N=o*f*A+M*o,x=0;x<G;x++,P++,N++)R[P]=S[N];else for(M=0;M<k;M++)for(P=L+M*s,N=M*o*u+A,x=0;x<G;x++,P++,N+=u)R[P]=S[N];return{width:s,height:r,pixelType:l,pixels:E}}const A=(e,n,a)=>{const s=r===n.littleEndian,o=p(a,"STRIPOFFSETS");if(void 0===o)return null;const{width:f,height:c,pixelType:u}=b([a]),g=n.planes,w=f*c,d=I(a,"BITSPERSAMPLE"),T=h(u),E=new T(w*g),y=p(a,"STRIPBYTECOUNTS"),m=I(a,"ROWSPERSTRIP"),A=I(a,"COMPRESSION")??1;let S,M,x,O,D,U,L,P,N,k,G,R=m;if(d%8==0)for(S=0;S<o.length;S++){if(D=S*(m*f)*g,R=(S+1)*m>c?c-S*m:m,"u8"===u||"s8"===u||s){if(8===A||32946===A)L=new Uint8Array(e,o[S],y[S]),k=new l(L),G=k.getBytes(),U=new ArrayBuffer(G.length),L=new Uint8Array(U),L.set(G),L.length!==R*f*g*d/8&&console.log("strip byte counts is different than expected");else if(6===A){L=new Uint8Array(e,o[S],y[S]);const n=new t;n.parse(L);const a=n.getData(n.width,n.height,!0);U=new ArrayBuffer(a.length),L=new Uint8Array(U),L.set(a)}else 5===A?(L=i(e,o[S],y[S],n.littleEndian),U=L.buffer):1===A&&(y[S]!==R*f*g*d/8&&console.log("strip byte counts is different than expected"),U=e.slice(o[S],o[S]+y[S]));O=new T(U)}else{switch(6===A||8===A||32946===A?(L=new Uint8Array(e,o[S],y[S]),k=new l(L),L=k.getBytes(),U=new ArrayBuffer(L.length),P=new Uint8Array(U),L.length!==R*f*g*d/8&&console.log("strip byte counts is different than expected")):1===A&&(y[S]!==R*f*g*d/8&&console.log("strip byte counts is different than expected"),U=new ArrayBuffer(y[S]),L=new Uint8Array(e,o[S],y[S]),P=new Uint8Array(U)),u){case"u16":case"s16":for(x=0;x<L.length;x+=2)P[x]=L[x+1],P[x+1]=L[x];break;case"u32":case"s32":case"f32":for(x=0;x<L.length;x+=4)P[x]=L[x+3],P[x+1]=L[x+2],P[x+2]=L[x+1],P[x+3]=L[x]}O=new T(U)}E.set(O,D)}const C=[];if(1===g)C.push(E);else for(S=0;S<g;S++){for(N=new T(w),M=0;M<w;M++)N[M]=E[M*g+S];C.push(N)}return{width:f,height:c,pixelType:u,pixels:C}},S=(e,t,n)=>{if(!(e&&e.length>0&&t&&n))return null;let a,i,s;const r=e[0].length,l=e.length,o=new Uint8Array(r);for(let f=0;f<l;f++)if(a=e[f],i=t[f],s=n[f],0===f)for(let e=0;e<r;e++)o[e]=a[e]<i||a[e]>s?0:1;else for(let e=0;e<r;e++)o[e]&&(o[e]=a[e]<i||a[e]>s?0:1);return o},M=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,s,r,l;for(let I=0;I<t.length;I++)a=t[I],i=a.slice("<Item ".length,a.indexOf(">")),r=a.indexOf("sample="),r>-1&&(l=a.slice(r+'sample="'.length,a.indexOf('"',r+'sample="'.length))),r=a.indexOf("name="),r>-1&&(i=a.slice(r+'name="'.length,a.indexOf('"',r+'name="'.length))),i&&(s=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=s:n.set(i,[s]):n.set(i,s)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),c=n.get("STATISTICS_MEAN"),u=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:c&&parseFloat(c[e]),stddev:u&&parseFloat(u[e])})}const g=n.get("BandName"),w=n.get("WavelengthMin"),p=n.get("WavelengthMax");let d=null;if(g){d=[];for(let e=0;e<g.length;e++)d.push({BandName:g[e],WavelengthMin:w&&parseFloat(w[e]),WavelengthMax:p&&parseFloat(p[e])})}return{statistics:h,bandProperties:d,dataType:n.get("DataType"),rawMetadata:n}};function x(e,t,n,a=0,i=!1,s=4){if(n.values)return!0;const r=n.type,l=n.valueCount;let c=n.valueOffset,u=[];const h=o[r],g=8*h,w=l*h,p=l*o[r]*8;let d,I;const T=8===s?64:32,E=n.valueOffsets;if(p>T){if(w>(i?e.byteLength:e?e.byteLength-c+a:0))return n.offlineOffsetSize=[c,w],n.values=null,!1}if(p<=T){if(!t)if(T<=32)c>>>=32-p;else{const e=E?.length?E[0]:c>>>0,t=E?.length?E[1]:Math.round((c-e)/f);p<=32?(c=e>>>32-p,E[0]=c):(c=e*2**(32-p)+(t>>>32-p),E[0]=e,E[1]=t>>>32-p)}if(1===l&&g===T)u=[c];else if(64===T){const e=E?.length?E[0]:c>>>0,t=E?.length?E[1]:Math.round((c-e)/f);let n=e,a=32;for(I=1;I<=l;I++){const e=32-g*I%32;if(a<g){const i=n<<e>>>32-a,s=t<<32-a>>>32-a;n=t,u.push(i+s*2**(g-a)),a-=32-(g-a)}else u.push(n<<e>>>32-g),a-=g;0===a&&(a=32,n=t)}}else for(I=1;I<=l;I++){const e=32-g*I;u.push(c<<e>>>32-g)}}else{c-=a,i&&(c=0);for(let n=c;n<c+w;n+=h){switch(r){case 1:case 2:case 7:d=new DataView(e,n,1).getUint8(0);break;case 3:d=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:d=new DataView(e,n,4).getUint32(0,t);break;case 5:d=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:d=new DataView(e,n,1).getInt8(0);break;case 8:d=new DataView(e,n,2).getInt16(0,t);break;case 9:d=new DataView(e,n,4).getInt32(0,t);break;case 10:d=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:d=new DataView(e,n,4).getFloat32(0,t);break;case 12:d=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:d=U(new DataView(e,n,8),0,t);break;case 17:d=L(new DataView(e,n,8),0,t);break;default:d=null}u.push(d)}}if(2===r){let e="";const t=u;for(u=[],I=0;I<t.length;I++)0===t[I]&&""!==e?(u.push(e),e=""):e+=String.fromCharCode(t[I]);""===e&&0!==u.length||u.push(e)}return n.values=u,!0}function b(e){const t=e[0],n=I(t,"TILEWIDTH"),a=I(t,"TILELENGTH"),i=I(t,"IMAGEWIDTH"),s=I(t,"IMAGELENGTH"),r=I(t,"BITSPERSAMPLE"),l=I(t,"SAMPLESPERPIXEL"),o=I(t,"SAMPLEFORMAT")??1,f=u(o,r),h=O(t),T=w(t,"GDAL_NODATA");let E;T?.length&&(E=T.map((e=>parseFloat(e))),E.some((e=>isNaN(e)))&&(E=null));const y=I(t,"COMPRESSION")??1;let m;switch(y){case 1:m="NONE";break;case 2:case 3:case 4:case 32771:m="CCITT";break;case 5:m="LZW";break;case 6:case 7:m="JPEG";break;case 32773:m="PACKBITS";break;case 8:case 32946:m="DEFLATE";break;case 34712:m="JPEG2000";break;case 34887:m="LERC";break;default:m=String(y)}let A=!0,S="";c.has(y)||(A=!1,S+="unsupported tag compression "+y),o>3&&(A=!1,S+="unsupported tag sampleFormat "+o),r%8!=0&&(A=!1,S+="unsupported tag bitsPerSample "+r);const x=d(t,"GEOASCIIPARAMS");let b;if(x){const e=x.split("|").find((e=>e.includes("ESRI PE String = "))),t=e?e.replace("ESRI PE String = ",""):"";b=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const D=p(t,"GEOTIEPOINTS"),U=p(t,"GEOPIXELSCALE"),L=p(t,"GEOTRANSMATRIX"),P=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let N,k,R=!1;if(P){R=2===I(P,"GTRasterTypeGeoKey");const e=I(P,"GTModelTypeGeoKey");if(2===e){const e=I(P,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(b={wkid:e})}else if(1===e){const e=I(P,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(b={wkid:e})}}if(U&&D&&D.length>=6?(N=[U[0],0,D[3]-D[0]*U[0],0,-Math.abs(U[1]),D[4]-D[1]*U[1]],R&&(N[2]-=.5*N[0]+.5*N[1],N[5]-=.5*N[3]+.5*N[4])):L&&16===L.length&&(N=R?[L[0],L[1],L[3]-.5*L[0],L[4],L[5],L[7]-.5*L[5]]:[L[0],L[1],L[3],L[4],L[5],L[7]]),N){const e=[{x:0,y:s},{x:0,y:0},{x:i,y:s},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=g(e[i],N),n=t.x>n?n:t.x,r=t.x<r?r:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;k={xmin:n,xmax:r,ymin:a,ymax:l,spatialReference:b}}else k={xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:b};const C=e.filter((e=>1===d(e,"NEWSUBFILETYPE")));let F,v,B,V,W;if(C.length>0){F=Math.round(Math.log(i/I(C[0],"IMAGEWIDTH"))/Math.LN2);const e=C[C.length-1];v=Math.round(Math.log(i/I(e,"IMAGEWIDTH"))/Math.LN2),B=I(e,"TILEWIDTH"),V=I(e,"TILELENGTH")}B=v>0?B||n:null,V=v>0?V||a:null,n&&(W=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(s/a)-1,minRow:0,minCol:0}],C.forEach((e=>{W.push({maxCol:Math.ceil(I(e,"IMAGEWIDTH")/I(e,"TILEWIDTH"))-1,maxRow:Math.ceil(I(e,"IMAGELENGTH")/I(e,"TILELENGTH"))-1,minRow:0,minCol:0})})));const H=d(e[0],"GDAL_METADATA"),Y=M(H);return S+=" "+G({width:i,height:s,tileWidth:n,tileHeight:a,planes:l,ifds:e}),{width:i,height:s,tileWidth:n,tileHeight:a,planes:l,isBSQ:h,pixelType:f,compression:m,noData:E,isSupported:A,message:S,extent:k,affine:U?null:N,firstPyramidLevel:F,maximumPyramidLevel:v,pyramidBlockWidth:B,pyramidBlockHeight:V,tileBoundary:W,metadata:Y}}function O(e,t){const n=w(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function D(e){const{littleEndian:t,isBigTiff:n,firstIFD:a}=N(e);let i=a;const r=[];do{const a=k(e,t,i,0,s.TIFF_TAGS,n?8:4);if(!a.success)break;r.push(a.ifd),i=a.nextIFD}while(i>0);return{...b(r),littleEndian:t,isBigTiff:n,ifds:r}}function U(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*f+a:a*f+i}function L(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const s=(n?a:i)>=0?1:-1;n?a*=s:i*=s;return s*(n?i*f+a:a*f+i)}function P(e,t,n,a){return a?U(e,t,n):e.getUint32(t,n)}function N(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw"unexpected endianess byte";a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw"unexpected tiff identifier";let s=4;const r=43===i;if(r){const e=t.getUint16(s,a);if(s+=2,8!==e)throw"unsupported bigtiff version";if(0!==t.getUint16(s,a))throw"unsupported bigtiff version";s+=2}return{littleEndian:a,isBigTiff:r,firstIFD:P(t,s,a,r)}}function k(t,n,a,i=0,r=s.TIFF_TAGS,l=4){const o=T(t,n,a,i,r,l);let f;const c=o.ifd;if(c){if(s.ifdTags.forEach(((e,a)=>{c.has(a)&&(f=c.get(a),f.data=T(t,n,f.valueOffset-i,i,e).ifd)})),c.has("GEOKEYDIRECTORY")){f=c.get("GEOKEYDIRECTORY");const e=f.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];f.data=T(t,n,f.valueOffset+6-i,i,s.GEO_KEYS,2).ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(c.has("XMP")){f=c.get("XMP");const t=f.values;"number"==typeof t[0]&&7===f.type&&(f.values=[e(new Uint8Array(t))])}}return o}function G(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,s=e.planes,r=i?i*a:t*n,l=I(e.ifds[0],"BITSPERSAMPLE");let o="";return r*s>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}async function R(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:s}=t,r=[];for(let h=0;h<i.length;h++){const t=await y(e,n.littleEndian,a,i[h],s[h]||e.byteLength);r.push(t)}const l=O(a,n),{pixelType:o,planes:f}=n,c=h(o),u=I(a,"TILEWIDTH"),g=I(a,"TILELENGTH"),w=I(a,"COMPRESSION")??1,p=u*g;let d;const T=[];let E=r[0];const m=34887===w;for(let h=0;h<f;h++){if(d=new c(p),l&&m){E=r[h];for(let e=0;e<p;e++)d[e]=E[h][e+h]}else if(l||m&&!l)d=E.slice(p*h,p*(h+1));else for(let e=0;e<p;e++)d[e]=E[e*f+h];T.push(d)}const A=n.noData?n.noData[0]:null,M=n.metadata?n.metadata.statistics:null,x=M?M.map((e=>e.min)):null,b=M?M.map((e=>e.max)):null;let D,U;if(null!=A)if(D=new Uint8Array(p),Math.abs(A)>1e24)for(U=0;U<p;U++)Math.abs((T[0][U]-A)/A)<1e-6?D[U]=0:D[U]=1;else for(U=0;U<p;U++)T[0][U]===A?D[U]=0:D[U]=1;else x&&b&&t.applyMinMaxConstraint&&(D=S(T,x,b));return{pixelType:o,width:u,height:g,pixels:T,mask:D,noDataValue:A}}async function C(e,t=0,n){n=n||D(e);const{ifds:a,noData:i}=n;if(0===a.length)throw"no valid image file directory";const s=G(n);if(s)throw s;let r,l;const o=-1===t?a[a.length-1]:a[t],f=i?i[0]:null;if(l=n.tileWidth?await m(e,n,o):await A(e,n,o),null!==f){if(l.mask=new Uint8Array(l.width*l.height),Math.abs(f)>1e24)for(r=0;r<l.width*l.height;r++)Math.abs((l.pixels[0][r]-f)/f)<1e-6?l.mask[r]=0:l.mask[r]=1;else for(r=0;r<l.width*l.height;r++)l.pixels[0][r]===f?l.mask[r]=0:l.mask[r]=1;l.noDataValue=f}return l}export{C as decode,R as decodeTileOrStrip,b as getImageInfo,O as isBSQConfig,x as parseFieldValues,D as parseHeader,k as parseIFD,N as parseSignature};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t,isNone as e}from"../../../core/maybe.js";import n from"../PixelBlock.js";function i(e){return t(e)&&"esri.layers.support.PixelBlock"===e.declaredClass&&e.pixels&&e.pixels.length>0}function l(t,e){if(null==e||!e.length||!i(t))return t;const l=t.pixels.length;return e&&e.some((t=>t>=l))||1===l&&1===e.length&&0===e[0]?t:l!==e.length||e.some(((t,e)=>t!==e))?new n({pixelType:t.pixelType,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:e.map((e=>t.pixels[e])),statistics:t.statistics&&e.map((e=>t.statistics[e]))}):t}function o(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort(((t,e)=>t[0]-e[0]));let i=0;n[0][0]<0&&(i=n[0][0]);const l=Math.max(256,n[n.length-1][0]-i+1),o=new Uint8Array(4*l),r=[];let s,a=0,h=0;const f=5===n[0].length;if(l>65536)return n.forEach((t=>{r[t[0]-i]=f?t.slice(1):t.slice(1).concat([255])})),{indexed2DColormap:r,offset:i,alphaSpecified:f};if(t.fillUnspecified)for(s=n[h],a=s[0]-i;a<l;a++)o[4*a]=s[1],o[4*a+1]=s[2],o[4*a+2]=s[3],o[4*a+3]=f?s[4]:255,a===s[0]-i&&(s=h===n.length-1?s:n[++h]);else for(a=0;a<n.length;a++)s=n[a],h=4*(s[0]-i),o[h]=s[1],o[h+1]=s[2],o[h+2]=s[3],o[h+3]=f?s[4]:255;return{indexedColormap:o,offset:i,alphaSpecified:f}}function r(t,e){if(!i(t))return t;if(!e&&(e.indexedColormap||e.indexed2DColormap))return t;const n=t.clone(),l=n.pixels;let o=n.mask;const r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=s.length-1;let u=0;const p=l[0],x=new Uint8Array(p.length),m=new Uint8Array(p.length),d=new Uint8Array(p.length);let y,g=0;if(s)if(o)for(u=0;u<r;u++)o[u]&&(g=4*(p[u]-h),g<h||g>c?o[u]=0:(x[u]=s[g],m[u]=s[g+1],d[u]=s[g+2],o[u]=s[g+3]));else{for(o=new Uint8Array(r),u=0;u<r;u++)g=4*(p[u]-h),g<h||g>c?o[u]=0:(x[u]=s[g],m[u]=s[g+1],d[u]=s[g+2],o[u]=s[g+3]);n.mask=o}else if(o)for(u=0;u<r;u++)o[u]&&(y=a[p[u]],x[u]=y[0],m[u]=y[1],d[u]=y[2],o[u]=y[3]);else{for(o=new Uint8Array(r),u=0;u<r;u++)y=a[p[u]],x[u]=y[0],m[u]=y[1],d[u]=y[2],o[u]=y[3];n.mask=o}return n.pixels=[x,m,d],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function s(t,e){if(!i(t))return null;const{pixels:l,mask:o}=t,r=t.width*t.height,s=l.length;let a=e.lut;const{offset:h}=e;let f,c;a&&1===a[0].length&&(a=l.map((()=>a)));const u=[];let p,x,m;if(h)if(null==o)for(f=0;f<s;f++){for(p=l[f],x=a[f],m=new Uint8Array(r),c=0;c<r;c++)m[c]=x[p[c]-h];u.push(m)}else for(f=0;f<s;f++){for(p=l[f],x=a[f],m=new Uint8Array(r),c=0;c<r;c++)o[c]&&(m[c]=x[p[c]-h]);u.push(m)}else if(null==o)for(f=0;f<s;f++){for(p=l[f],x=a[f],m=new Uint8Array(r),c=0;c<r;c++)m[c]=x[p[c]];u.push(m)}else for(f=0;f<s;f++){for(p=l[f],x=a[f],m=new Uint8Array(r),c=0;c<r;c++)o[c]&&(m[c]=x[p[c]]);u.push(m)}const d=new n({width:t.width,height:t.height,pixels:u,mask:o,pixelType:"u8"});return d.updateStatistics(),d}function a(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l}=n,o=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],h=l[0];let f,c,u,p,x,m,d=!1;const y=new Uint8Array(o),g=new Uint8Array(o),w=new Uint8Array(o);let k=n.mask;const M=4===e[0].mappedColor.length;for(k||(k=new Uint8Array(o),k.fill(M?255:1),n.mask=k),x=0;x<o;x++)if(k[x]){for(f=h[x],d=!1,m=s,c=a,u=0,p=r-1;p-u>1;){if(f===c.value){d=!0;break}f>c.value?u=m:p=m,m=Math.floor((u+p)/2),c=e[Math.floor(m)]}d||(f===e[u].value?(c=e[u],d=!0):f===e[p].value?(c=e[p],d=!0):f<e[u].value?(d=!1,c=null):f>e[u].value&&(f<e[p].value?(c=e[u],d=!0):p===r-1?(d=!1,c=null):(c=e[p],d=!0))),d?(y[x]=c.mappedColor[0],g[x]=c.mappedColor[1],w[x]=c.mappedColor[2],k[x]=c.mappedColor[3]):y[x]=g[x]=w[x]=k[x]=0}return n.pixels=[y,g,w],n.mask=k,n.pixelType="u8",n.maskIsAlpha=M,n}function h(t,e,n,i,l,o,r,s){return{xmin:l<=n*t?0:l<n*t+t?l-n*t:t,ymin:o<=i*e?0:o<i*e+e?o-i*e:e,xmax:l+r<=n*t?0:l+r<n*t+t?l+r-n*t:t,ymax:o+s<=i*e?0:o+s<i*e+e?o+s-i*e:e}}function f(t,n){if(!t||0===t.length)return null;const i=t.find((t=>t.pixelBlock));if(!i||e(i.pixelBlock))return null;const l=(i.extent.xmax-i.extent.xmin)/i.pixelBlock.width,o=(i.extent.ymax-i.extent.ymin)/i.pixelBlock.height,r=.01*Math.min(l,o),s=t.sort(((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>r?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>r?t.extent.xmin-e.extent.xmin:0)),a=Math.min.apply(null,s.map((t=>t.extent.xmin))),h=Math.min.apply(null,s.map((t=>t.extent.ymin))),f=Math.max.apply(null,s.map((t=>t.extent.xmax))),c=Math.max.apply(null,s.map((t=>t.extent.ymax))),p={x:Math.round((n.xmin-a)/l),y:Math.round((c-n.ymax)/o)},x={width:Math.round((f-a)/l),height:Math.round((c-h)/o)},m={width:Math.round((n.xmax-n.xmin)/l),height:Math.round((n.ymax-n.ymin)/o)};if(Math.round(x.width/i.pixelBlock.width)*Math.round(x.height/i.pixelBlock.height)!==s.length||p.x<0||p.y<0||x.width<m.width||x.height<m.height)return null;return{extent:n,pixelBlock:u(s.map((t=>t.pixelBlock)),x,{clipOffset:p,clipSize:m})}}function c(t,e,n,i,l,o){const{width:r,height:s}=n.block,{x:a,y:f}=n.offset,{width:c,height:u}=n.mosaic,p=h(r,s,i,l,a,f,c,u);let x=0,m=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth,e=r*o.resolutionX,n=o.startX+i*e,l=n+e;n<t&&l>t?m=o.rightPadding:n>=t&&(x=o.leftMargin-o.rightPadding,m=0)}if(p.xmax-=m,"number"!=typeof e)for(let h=p.ymin;h<p.ymax;h++){const n=(l*s+h-f)*c+(i*r-a)+x,o=h*r;for(let i=p.xmin;i<p.xmax;i++)t[n+i]=e[o+i]}else for(let h=p.ymin;h<p.ymax;h++){const n=(l*s+h-f)*c+(i*r-a)+x;for(let i=p.xmin;i<p.xmax;i++)t[n+i]=e}}function u(l,o,r={}){const{clipOffset:s,clipSize:a,alignmentInfo:h,blockWidths:f}=r;if(f)return p(l,o,{blockWidths:f});const u=l.find((t=>i(t)));if(e(u))return null;const x=a?a.width:o.width,m=a?a.height:o.height,d=u.width,y=u.height,g=o.width/d,w=o.height/y,k={offset:s||{x:0,y:0},mosaic:a||o,block:{width:d,height:y}},M=u.pixelType,A=n.getPixelArrayConstructor(M),U=u.pixels.length,C=[];let T,S;for(let t=0;t<U;t++){S=new A(x*m);for(let e=0;e<w;e++)for(let n=0;n<g;n++){const o=l[e*g+n];i(o)&&(T=o.pixels[t],c(S,T,k,n,e,h))}C.push(S)}let B;if(l.some((t=>e(t)||t.mask&&t.mask.length>0))){B=new Uint8Array(x*m);for(let e=0;e<w;e++)for(let n=0;n<g;n++){const i=l[e*g+n],o=t(i)?i.mask:null;c(B,o||(i?1:0),k,n,e,h)}}const v=new n({width:x,height:m,pixels:C,pixelType:M,mask:B});return v.updateStatistics(),v}function p(l,o,r){const s=l.find((e=>t(e)));if(e(s))return null;const a=l.some((e=>!t(e)||!!e.mask)),{width:h,height:f}=o,c=a?new Uint8Array(h*f):null,{blockWidths:u}=r,p=[],x=s.getPlaneCount(),m=n.getPixelArrayConstructor(s.pixelType);if(a)for(let t=0,e=0;t<l.length;e+=u[t],t++){const n=l[t];if(!i(n))continue;const o=n.mask;for(let i=0;i<f;i++)for(let l=0;l<u[t];l++)c[i*h+l+e]=null==o?255:o[i*n.width+l]}for(let t=0;t<x;t++){const e=new m(h*f);for(let n=0,o=0;n<l.length;o+=u[n],n++){const r=l[n];if(!i(r))continue;const s=r.pixels[t];if(null!=s)for(let t=0;t<f;t++)for(let i=0;i<u[n];i++)e[t*h+i+o]=s[t*r.width+i]}p.push(e)}const d=new n({width:h,height:f,mask:c,pixels:p,pixelType:s.pixelType});return d.updateStatistics(),d}function x(t,e,n){if(!i(t))return null;const{width:l,height:o}=t,r=e.x,s=e.y,a=n.width+r,h=n.height+s;if(r<0||s<0||a>l||h>o)return t;if(0===r&&0===s&&a===l&&h===o)return t;t.mask||(t.mask=new Uint8Array(l*o));const f=t.mask;for(let i=0;i<o;i++){const t=i*l;for(let e=0;e<l;e++)f[t+e]=i<s||i>=h||e<r||e>=a?0:1}return t.updateStatistics(),t}function m(t){if(!i(t))return null;const e=t.clone(),{width:n,height:l,pixels:o,mask:r}=t,s=o[0],a=e.pixels[0];for(let i=2;i<l-1;i++){const t=new Map;for(let l=i-2;l<i+2;l++)for(let e=0;e<4;e++){const i=l*n+e;g(t,s[i],r?r[i]:1)}a[i*n]=d(t),a[i*n+1]=a[i*n+2]=a[i*n];let e=3;for(;e<n-1;e++){let l=(i-2)*n+e+1;g(t,s[l],r?r[l]:1),l=(i-1)*n+e+1,g(t,s[l],r?r[l]:1),l=i*n+e+1,g(t,s[l],r?r[l]:1),l=(i+1)*n+e+1,g(t,s[l],r?r[l]:1),l=(i-2)*n+e-3,y(t,s[l],r?r[l]:1),l=(i-1)*n+e-3,y(t,s[l],r?r[l]:1),l=i*n+e-3,y(t,s[l],r?r[l]:1),l=(i+1)*n+e-3,y(t,s[l],r?r[l]:1),a[i*n+e]=d(t)}a[i*n+e+1]=a[i*n+e]}for(let i=0;i<n;i++)a[i]=a[n+i]=a[2*n+i],a[(l-1)*n+i]=a[(l-2)*n+i];return e.updateStatistics(),e}function d(t){if(0===t.size)return 0;let e=0,n=-1,i=0;const l=t.keys();let o=l.next();for(;!o.done;)i=t.get(o.value),i>e&&(n=o.value,e=i),o=l.next();return n}function y(t,e,n){if(0===n)return;const i=t.get(e);1===i?t.delete(e):t.set(e,i-1)}function g(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function w(t,e,l){let{x:o,y:r}=e;const{width:s,height:a}=l;if(0===o&&0===r&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,r),u=Math.max(0,o),p=Math.min(o+s,h),x=Math.min(r+a,f);if(p<0||x<0||!i(t))return null;o=Math.max(0,-o),r=Math.max(0,-r);const{pixels:m,mask:d}=t,y=s*a,g=m.length,w=[];for(let i=0;i<g;i++){const e=m[i],l=n.createEmptyBand(t.pixelType,y);for(let t=c;t<x;t++){const n=t*h;let i=(t+r-c)*s+o;for(let t=u;t<p;t++)l[i++]=e[n+t]}w.push(l)}const k=new Uint8Array(y);for(let n=c;n<x;n++){const t=n*h;let e=(n+r-c)*s+o;for(let n=u;n<p;n++)k[e++]=d?d[t+n]:1}const M=new n({width:l.width,height:l.height,pixelType:t.pixelType,pixels:w,mask:k});return M.updateStatistics(),M}function k(t,e=!0){if(!i(t))return null;const{pixels:l,width:o,height:r,mask:s,pixelType:a}=t,h=[],f=Math.round(o/2),c=Math.round(r/2),u=r-1,p=o-1;for(let i=0;i<l.length;i++){const t=l[i],s=n.createEmptyBand(a,f*c);let x=0;for(let n=0;n<r;n+=2)for(let i=0;i<o;i+=2){const l=t[n*o+i];if(e){const e=i===p?l:t[n*o+i+1],r=n===u?l:t[n*o+i+o],a=i===p?r:n===u?e:t[n*o+i+o+1];s[x++]=(l+e+r+a)/4}else s[x++]=l}h.push(s)}let x=null;if(s){x=new Uint8Array(f*c);let t=0;for(let n=0;n<r;n+=2)for(let i=0;i<o;i+=2){const l=s[n*o+i];if(e){const e=i===p?l:s[n*o+i+1],r=n===u?l:s[n*o+i+o],a=i===p?r:n===u?e:s[n*o+i+o+1];x[t++]=l*e*r*a?1:0}else x[t++]=l}}return new n({width:f,height:c,pixelType:a,pixels:h,mask:x})}function M(t,e,n){if(!i(t))return null;const{width:l,height:o}=e;let{width:r,height:s}=t;const a=new Map,h={x:0,y:0},f=null==n?1:1+n;let c=t;for(let i=0;i<f;i++){const t=Math.ceil(r/l),n=Math.ceil(s/o);for(let r=0;r<n;r++){h.y=r*o;for(let n=0;n<t;n++){h.x=n*l;const t=w(c,h,e);a.set(`${i}/${r}/${n}`,t)}}i<f-1&&(c=k(c)),r=Math.round(r/2),s=Math.round(s/2)}return a}function A(t,e,n,i,l=.5){const{width:o,height:r}=t,{width:s,height:a}=e,h=i.cols,f=i.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,y,g,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),C=new Uint32Array(M),T=new Uint32Array(M);let S,B,v=0;for(let P=0;P<u;P++)for(let t=0;t<c;t++){p=12*(P*c+t),x=n[p],m=n[p+1],d=n[p+2],y=n[p+3],g=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(P*f+e)*k+t*h,B=(e+.5)/f;for(let t=0;t<e;t++)S=(t+.5)/h,A[v+t]=(x*S+m*B+d)*o-l,U[v+t]=(y*S+g*B+w)*r-l,C[v+t]=Math.round(A[v+t]),T[v+t]=Math.round(U[v+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],y=n[p+3],g=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(P*f+e)*k+t*h,B=(e+.5)/f;for(let t=e;t<h;t++)S=(t+.5)/h,A[v+t]=(x*S+m*B+d)*o-l,U[v+t]=(y*S+g*B+w)*r-l,C[v+t]=Math.round(A[v+t]),T[v+t]=Math.round(U[v+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:C,offsets_yi:T,gridWidth:k}}function U(t,e){const{coefficients:n,spacing:i}=e,{offsets_x:l,offsets_y:o,gridWidth:r}=A(t,t,n,{rows:i[0],cols:i[1]},.5),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,i=c===a-1?e:e+r,u=l[n]-l[i],p=o[i]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function C(t,e,l,o,r="nearest"){if(!i(t))return null;"majority"===r&&(t=m(t));const{pixels:s,mask:a,pixelType:h}=t,f=t.width,c=t.height,u=n.getPixelArrayConstructor(h),p=s.length,{width:x,height:d}=e;let y=!1;for(let n=0;n<l.length;n+=3)-1===l[n]&&-1===l[n+1]&&-1===l[n+2]&&(y=!0);const{offsets_x:g,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:U}=A({width:f,height:c},e,l,o,"majority"===r?0:.5);let C;const T=(t,e,n)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let l=0;l<d;l++){C=l*U;for(let o=0;o<x;o++){if(g[C]<0||w[C]<0)t[l*x+o]=0;else if(n)t[l*x+o]=e[k[C]+M[C]*f];else{const n=Math.floor(g[C]),r=Math.floor(w[C]),s=Math.ceil(g[C]),h=Math.ceil(w[C]),c=g[C]-n,u=w[C]-r;if(!a||a[n+r*f]&&a[n+r*f]&&a[n+h*f]&&a[s+h*f]){const a=(1-c)*e[n+r*f]+c*e[s+r*f],p=(1-c)*e[n+h*f]+c*e[s+h*f];t[l*x+o]=(1-u)*a+u*p+i}else t[l*x+o]=e[k[C]+M[C]*f]}C++}}},S=[];let B;for(let n=0;n<p;n++)B=new u(x*d),T(B,s[n],"nearest"===r||"majority"===r),S.push(B);const v=new n({width:x,height:d,pixelType:h,pixels:S});if(a)v.mask=new Uint8Array(x*d),T(v.mask,a,!0);else if(y){v.mask=new Uint8Array(x*d);for(let t=0;t<x*d;t++)v.mask[t]=g[t]<0||w[t]<0?0:1}return v.updateStatistics(),v}export{C as approximateTransform,w as clip,r as colorize,o as createColormapLUT,l as extractBands,h as getClipBounds,U as getLocalArithmeticNorthRotations,i as isValidPixelBlock,s as lookupPixels,u as mosaic,f as mosaicPixelData,a as remapColor,m as resampleByMajority,x as setValidBoundary,M as split};
5
+ import{isSome as t,isNone as e}from"../../../core/maybe.js";import n from"../PixelBlock.js";function i(e){return t(e)&&"esri.layers.support.PixelBlock"===e.declaredClass&&e.pixels&&e.pixels.length>0}function l(t,e){if(!e?.length||!i(t))return t;const l=t.pixels.length;return e&&e.some((t=>t>=l))||1===l&&1===e.length&&0===e[0]?t:l!==e.length||e.some(((t,e)=>t!==e))?new n({pixelType:t.pixelType,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:e.map((e=>t.pixels[e])),statistics:t.statistics&&e.map((e=>t.statistics[e]))}):t}function o(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort(((t,e)=>t[0]-e[0]));let i=0;n[0][0]<0&&(i=n[0][0]);const l=Math.max(256,n[n.length-1][0]-i+1),o=new Uint8Array(4*l),r=[];let s,a=0,h=0;const f=5===n[0].length;if(l>65536)return n.forEach((t=>{r[t[0]-i]=f?t.slice(1):t.slice(1).concat([255])})),{indexed2DColormap:r,offset:i,alphaSpecified:f};if(t.fillUnspecified)for(s=n[h],a=s[0]-i;a<l;a++)o[4*a]=s[1],o[4*a+1]=s[2],o[4*a+2]=s[3],o[4*a+3]=f?s[4]:255,a===s[0]-i&&(s=h===n.length-1?s:n[++h]);else for(a=0;a<n.length;a++)s=n[a],h=4*(s[0]-i),o[h]=s[1],o[h+1]=s[2],o[h+2]=s[3],o[h+3]=f?s[4]:255;return{indexedColormap:o,offset:i,alphaSpecified:f}}function r(t,e){if(!i(t))return t;if(!e&&(e.indexedColormap||e.indexed2DColormap))return t;const n=t.clone(),l=n.pixels;let o=n.mask;const r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=s.length-1;let u=0;const p=l[0],x=new Uint8Array(p.length),m=new Uint8Array(p.length),d=new Uint8Array(p.length);let y,g=0;if(s)if(o)for(u=0;u<r;u++)o[u]&&(g=4*(p[u]-h),g<h||g>c?o[u]=0:(x[u]=s[g],m[u]=s[g+1],d[u]=s[g+2],o[u]=s[g+3]));else{for(o=new Uint8Array(r),u=0;u<r;u++)g=4*(p[u]-h),g<h||g>c?o[u]=0:(x[u]=s[g],m[u]=s[g+1],d[u]=s[g+2],o[u]=s[g+3]);n.mask=o}else if(o)for(u=0;u<r;u++)o[u]&&(y=a[p[u]],x[u]=y[0],m[u]=y[1],d[u]=y[2],o[u]=y[3]);else{for(o=new Uint8Array(r),u=0;u<r;u++)y=a[p[u]],x[u]=y[0],m[u]=y[1],d[u]=y[2],o[u]=y[3];n.mask=o}return n.pixels=[x,m,d],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function s(t,e){if(!i(t))return null;const{pixels:l,mask:o}=t,r=t.width*t.height,s=l.length;let a=e.lut;const{offset:h}=e;let f,c;a&&1===a[0].length&&(a=l.map((()=>a)));const u=[];let p,x,m;if(h)if(null==o)for(f=0;f<s;f++){for(p=l[f],x=a[f],m=new Uint8Array(r),c=0;c<r;c++)m[c]=x[p[c]-h];u.push(m)}else for(f=0;f<s;f++){for(p=l[f],x=a[f],m=new Uint8Array(r),c=0;c<r;c++)o[c]&&(m[c]=x[p[c]-h]);u.push(m)}else if(null==o)for(f=0;f<s;f++){for(p=l[f],x=a[f],m=new Uint8Array(r),c=0;c<r;c++)m[c]=x[p[c]];u.push(m)}else for(f=0;f<s;f++){for(p=l[f],x=a[f],m=new Uint8Array(r),c=0;c<r;c++)o[c]&&(m[c]=x[p[c]]);u.push(m)}const d=new n({width:t.width,height:t.height,pixels:u,mask:o,pixelType:"u8"});return d.updateStatistics(),d}function a(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l}=n,o=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],h=l[0];let f,c,u,p,x,m,d=!1;const y=new Uint8Array(o),g=new Uint8Array(o),w=new Uint8Array(o);let k=n.mask;const M=4===e[0].mappedColor.length;for(k||(k=new Uint8Array(o),k.fill(M?255:1),n.mask=k),x=0;x<o;x++)if(k[x]){for(f=h[x],d=!1,m=s,c=a,u=0,p=r-1;p-u>1;){if(f===c.value){d=!0;break}f>c.value?u=m:p=m,m=Math.floor((u+p)/2),c=e[Math.floor(m)]}d||(f===e[u].value?(c=e[u],d=!0):f===e[p].value?(c=e[p],d=!0):f<e[u].value?(d=!1,c=null):f>e[u].value&&(f<e[p].value?(c=e[u],d=!0):p===r-1?(d=!1,c=null):(c=e[p],d=!0))),d?(y[x]=c.mappedColor[0],g[x]=c.mappedColor[1],w[x]=c.mappedColor[2],k[x]=c.mappedColor[3]):y[x]=g[x]=w[x]=k[x]=0}return n.pixels=[y,g,w],n.mask=k,n.pixelType="u8",n.maskIsAlpha=M,n}function h(t,e,n,i,l,o,r,s){return{xmin:l<=n*t?0:l<n*t+t?l-n*t:t,ymin:o<=i*e?0:o<i*e+e?o-i*e:e,xmax:l+r<=n*t?0:l+r<n*t+t?l+r-n*t:t,ymax:o+s<=i*e?0:o+s<i*e+e?o+s-i*e:e}}function f(t,n){if(!t||0===t.length)return null;const i=t.find((t=>t.pixelBlock));if(!i||e(i.pixelBlock))return null;const l=(i.extent.xmax-i.extent.xmin)/i.pixelBlock.width,o=(i.extent.ymax-i.extent.ymin)/i.pixelBlock.height,r=.01*Math.min(l,o),s=t.sort(((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>r?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>r?t.extent.xmin-e.extent.xmin:0)),a=Math.min.apply(null,s.map((t=>t.extent.xmin))),h=Math.min.apply(null,s.map((t=>t.extent.ymin))),f=Math.max.apply(null,s.map((t=>t.extent.xmax))),c=Math.max.apply(null,s.map((t=>t.extent.ymax))),p={x:Math.round((n.xmin-a)/l),y:Math.round((c-n.ymax)/o)},x={width:Math.round((f-a)/l),height:Math.round((c-h)/o)},m={width:Math.round((n.xmax-n.xmin)/l),height:Math.round((n.ymax-n.ymin)/o)};if(Math.round(x.width/i.pixelBlock.width)*Math.round(x.height/i.pixelBlock.height)!==s.length||p.x<0||p.y<0||x.width<m.width||x.height<m.height)return null;return{extent:n,pixelBlock:u(s.map((t=>t.pixelBlock)),x,{clipOffset:p,clipSize:m})}}function c(t,e,n,i,l,o){const{width:r,height:s}=n.block,{x:a,y:f}=n.offset,{width:c,height:u}=n.mosaic,p=h(r,s,i,l,a,f,c,u);let x=0,m=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth,e=r*o.resolutionX,n=o.startX+i*e,l=n+e;n<t&&l>t?m=o.rightPadding:n>=t&&(x=o.leftMargin-o.rightPadding,m=0)}if(p.xmax-=m,"number"!=typeof e)for(let h=p.ymin;h<p.ymax;h++){const n=(l*s+h-f)*c+(i*r-a)+x,o=h*r;for(let i=p.xmin;i<p.xmax;i++)t[n+i]=e[o+i]}else for(let h=p.ymin;h<p.ymax;h++){const n=(l*s+h-f)*c+(i*r-a)+x;for(let i=p.xmin;i<p.xmax;i++)t[n+i]=e}}function u(l,o,r={}){const{clipOffset:s,clipSize:a,alignmentInfo:h,blockWidths:f}=r;if(f)return p(l,o,{blockWidths:f});const u=l.find((t=>i(t)));if(e(u))return null;const x=a?a.width:o.width,m=a?a.height:o.height,d=u.width,y=u.height,g=o.width/d,w=o.height/y,k={offset:s||{x:0,y:0},mosaic:a||o,block:{width:d,height:y}},M=u.pixelType,A=n.getPixelArrayConstructor(M),U=u.pixels.length,C=[];let T,S;for(let t=0;t<U;t++){S=new A(x*m);for(let e=0;e<w;e++)for(let n=0;n<g;n++){const o=l[e*g+n];i(o)&&(T=o.pixels[t],c(S,T,k,n,e,h))}C.push(S)}let B;if(l.some((t=>e(t)||t.mask&&t.mask.length>0))){B=new Uint8Array(x*m);for(let e=0;e<w;e++)for(let n=0;n<g;n++){const i=l[e*g+n],o=t(i)?i.mask:null;c(B,o||(i?1:0),k,n,e,h)}}const v=new n({width:x,height:m,pixels:C,pixelType:M,mask:B});return v.updateStatistics(),v}function p(l,o,r){const s=l.find((e=>t(e)));if(e(s))return null;const a=l.some((e=>!t(e)||!!e.mask)),{width:h,height:f}=o,c=a?new Uint8Array(h*f):null,{blockWidths:u}=r,p=[],x=s.getPlaneCount(),m=n.getPixelArrayConstructor(s.pixelType);if(a)for(let t=0,e=0;t<l.length;e+=u[t],t++){const n=l[t];if(!i(n))continue;const o=n.mask;for(let i=0;i<f;i++)for(let l=0;l<u[t];l++)c[i*h+l+e]=null==o?255:o[i*n.width+l]}for(let t=0;t<x;t++){const e=new m(h*f);for(let n=0,o=0;n<l.length;o+=u[n],n++){const r=l[n];if(!i(r))continue;const s=r.pixels[t];if(null!=s)for(let t=0;t<f;t++)for(let i=0;i<u[n];i++)e[t*h+i+o]=s[t*r.width+i]}p.push(e)}const d=new n({width:h,height:f,mask:c,pixels:p,pixelType:s.pixelType});return d.updateStatistics(),d}function x(t,e,n){if(!i(t))return null;const{width:l,height:o}=t,r=e.x,s=e.y,a=n.width+r,h=n.height+s;if(r<0||s<0||a>l||h>o)return t;if(0===r&&0===s&&a===l&&h===o)return t;t.mask||(t.mask=new Uint8Array(l*o));const f=t.mask;for(let i=0;i<o;i++){const t=i*l;for(let e=0;e<l;e++)f[t+e]=i<s||i>=h||e<r||e>=a?0:1}return t.updateStatistics(),t}function m(t){if(!i(t))return null;const e=t.clone(),{width:n,height:l,pixels:o,mask:r}=t,s=o[0],a=e.pixels[0];for(let i=2;i<l-1;i++){const t=new Map;for(let l=i-2;l<i+2;l++)for(let e=0;e<4;e++){const i=l*n+e;g(t,s[i],r?r[i]:1)}a[i*n]=d(t),a[i*n+1]=a[i*n+2]=a[i*n];let e=3;for(;e<n-1;e++){let l=(i-2)*n+e+1;g(t,s[l],r?r[l]:1),l=(i-1)*n+e+1,g(t,s[l],r?r[l]:1),l=i*n+e+1,g(t,s[l],r?r[l]:1),l=(i+1)*n+e+1,g(t,s[l],r?r[l]:1),l=(i-2)*n+e-3,y(t,s[l],r?r[l]:1),l=(i-1)*n+e-3,y(t,s[l],r?r[l]:1),l=i*n+e-3,y(t,s[l],r?r[l]:1),l=(i+1)*n+e-3,y(t,s[l],r?r[l]:1),a[i*n+e]=d(t)}a[i*n+e+1]=a[i*n+e]}for(let i=0;i<n;i++)a[i]=a[n+i]=a[2*n+i],a[(l-1)*n+i]=a[(l-2)*n+i];return e.updateStatistics(),e}function d(t){if(0===t.size)return 0;let e=0,n=-1,i=0;const l=t.keys();let o=l.next();for(;!o.done;)i=t.get(o.value),i>e&&(n=o.value,e=i),o=l.next();return n}function y(t,e,n){if(0===n)return;const i=t.get(e);1===i?t.delete(e):t.set(e,i-1)}function g(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function w(t,e,l){let{x:o,y:r}=e;const{width:s,height:a}=l;if(0===o&&0===r&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,r),u=Math.max(0,o),p=Math.min(o+s,h),x=Math.min(r+a,f);if(p<0||x<0||!i(t))return null;o=Math.max(0,-o),r=Math.max(0,-r);const{pixels:m,mask:d}=t,y=s*a,g=m.length,w=[];for(let i=0;i<g;i++){const e=m[i],l=n.createEmptyBand(t.pixelType,y);for(let t=c;t<x;t++){const n=t*h;let i=(t+r-c)*s+o;for(let t=u;t<p;t++)l[i++]=e[n+t]}w.push(l)}const k=new Uint8Array(y);for(let n=c;n<x;n++){const t=n*h;let e=(n+r-c)*s+o;for(let n=u;n<p;n++)k[e++]=d?d[t+n]:1}const M=new n({width:l.width,height:l.height,pixelType:t.pixelType,pixels:w,mask:k});return M.updateStatistics(),M}function k(t,e=!0){if(!i(t))return null;const{pixels:l,width:o,height:r,mask:s,pixelType:a}=t,h=[],f=Math.round(o/2),c=Math.round(r/2),u=r-1,p=o-1;for(let i=0;i<l.length;i++){const t=l[i],s=n.createEmptyBand(a,f*c);let x=0;for(let n=0;n<r;n+=2)for(let i=0;i<o;i+=2){const l=t[n*o+i];if(e){const e=i===p?l:t[n*o+i+1],r=n===u?l:t[n*o+i+o],a=i===p?r:n===u?e:t[n*o+i+o+1];s[x++]=(l+e+r+a)/4}else s[x++]=l}h.push(s)}let x=null;if(s){x=new Uint8Array(f*c);let t=0;for(let n=0;n<r;n+=2)for(let i=0;i<o;i+=2){const l=s[n*o+i];if(e){const e=i===p?l:s[n*o+i+1],r=n===u?l:s[n*o+i+o],a=i===p?r:n===u?e:s[n*o+i+o+1];x[t++]=l*e*r*a?1:0}else x[t++]=l}}return new n({width:f,height:c,pixelType:a,pixels:h,mask:x})}function M(t,e,n){if(!i(t))return null;const{width:l,height:o}=e;let{width:r,height:s}=t;const a=new Map,h={x:0,y:0},f=null==n?1:1+n;let c=t;for(let i=0;i<f;i++){const t=Math.ceil(r/l),n=Math.ceil(s/o);for(let r=0;r<n;r++){h.y=r*o;for(let n=0;n<t;n++){h.x=n*l;const t=w(c,h,e);a.set(`${i}/${r}/${n}`,t)}}i<f-1&&(c=k(c)),r=Math.round(r/2),s=Math.round(s/2)}return a}function A(t,e,n,i,l=.5){const{width:o,height:r}=t,{width:s,height:a}=e,h=i.cols,f=i.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,y,g,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),C=new Uint32Array(M),T=new Uint32Array(M);let S,B,v=0;for(let P=0;P<u;P++)for(let t=0;t<c;t++){p=12*(P*c+t),x=n[p],m=n[p+1],d=n[p+2],y=n[p+3],g=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(P*f+e)*k+t*h,B=(e+.5)/f;for(let t=0;t<e;t++)S=(t+.5)/h,A[v+t]=(x*S+m*B+d)*o-l,U[v+t]=(y*S+g*B+w)*r-l,C[v+t]=Math.round(A[v+t]),T[v+t]=Math.round(U[v+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],y=n[p+3],g=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(P*f+e)*k+t*h,B=(e+.5)/f;for(let t=e;t<h;t++)S=(t+.5)/h,A[v+t]=(x*S+m*B+d)*o-l,U[v+t]=(y*S+g*B+w)*r-l,C[v+t]=Math.round(A[v+t]),T[v+t]=Math.round(U[v+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:C,offsets_yi:T,gridWidth:k}}function U(t,e){const{coefficients:n,spacing:i}=e,{offsets_x:l,offsets_y:o,gridWidth:r}=A(t,t,n,{rows:i[0],cols:i[1]},.5),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,i=c===a-1?e:e+r,u=l[n]-l[i],p=o[i]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function C(t,e,l,o,r="nearest"){if(!i(t))return null;"majority"===r&&(t=m(t));const{pixels:s,mask:a,pixelType:h}=t,f=t.width,c=t.height,u=n.getPixelArrayConstructor(h),p=s.length,{width:x,height:d}=e;let y=!1;for(let n=0;n<l.length;n+=3)-1===l[n]&&-1===l[n+1]&&-1===l[n+2]&&(y=!0);const{offsets_x:g,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:U}=A({width:f,height:c},e,l,o,"majority"===r?0:.5);let C;const T=(t,e,n)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let l=0;l<d;l++){C=l*U;for(let o=0;o<x;o++){if(g[C]<0||w[C]<0)t[l*x+o]=0;else if(n)t[l*x+o]=e[k[C]+M[C]*f];else{const n=Math.floor(g[C]),r=Math.floor(w[C]),s=Math.ceil(g[C]),h=Math.ceil(w[C]),c=g[C]-n,u=w[C]-r;if(!a||a[n+r*f]&&a[n+r*f]&&a[n+h*f]&&a[s+h*f]){const a=(1-c)*e[n+r*f]+c*e[s+r*f],p=(1-c)*e[n+h*f]+c*e[s+h*f];t[l*x+o]=(1-u)*a+u*p+i}else t[l*x+o]=e[k[C]+M[C]*f]}C++}}},S=[];let B;for(let n=0;n<p;n++)B=new u(x*d),T(B,s[n],"nearest"===r||"majority"===r),S.push(B);const v=new n({width:x,height:d,pixelType:h,pixels:S});if(a)v.mask=new Uint8Array(x*d),T(v.mask,a,!0);else if(y){v.mask=new Uint8Array(x*d);for(let t=0;t<x*d;t++)v.mask[t]=g[t]<0||w[t]<0?0:1}return v.updateStatistics(),v}export{C as approximateTransform,w as clip,r as colorize,o as createColormapLUT,l as extractBands,h as getClipBounds,U as getLocalArithmeticNorthRotations,i as isValidPixelBlock,s as lookupPixels,u as mosaic,f as mosaicPixelData,a as remapColor,m as resampleByMajority,x as setValidBoundary,M as split};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import e from"../../../core/Error.js";import{isNone as t,isSome as n}from"../../../core/maybe.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{e as i,f as r,g as s,h as a,j as l}from"../../../chunks/pe.js";import{canProjectWithoutEngine as c,isLoaded as f,load as u,getTransformation as m,project as x}from"../../../geometry/projection.js";import h from"../../../geometry/Extent.js";import p from"../../../geometry/Point.js";import g from"../../../geometry/Polygon.js";import y from"../../../geometry/SpatialReference.js";var d;function M(e,t,n){return!c(e,t,n)}function w(t,n,o){const i=M(t,n,o);if(i&&!f())throw new e("rasterprojectionhelper-project","projection engine is not loaded");return i}!function(e){e[e.None=0]="None",e[e.North=1]="North",e[e.South=2]="South",e[e.Both=3]="Both"}(d||(d={}));const R=(e,t,n,o=0)=>{if(1===n[0])return[0,0];let i=1,r=-1,s=1,a=-1;for(let g=0;g<e.length;g+=2)isNaN(e[g])||(i=i>e[g]?e[g]:i,r=r>e[g]?r:e[g],s=s>e[g+1]?e[g+1]:s,a=a>e[g+1]?a:e[g+1]);const{cols:l,rows:c}=t,f=(r-i)/l/n[0],u=(a-s)/c/n[1],m=2*o;let x=0,h=!1,p=[0,0];for(let g=0;g<l-3;g++){for(let t=0;t<c-3;t++){const n=g*c*2+2*t,o=(e[n]+e[n+4]+e[n+4*c]+e[n+4*c+4])/4,i=(e[n+1]+e[n+5]+e[n+4*c+1]+e[n+4*c+5])/4,r=Math.abs((o-e[n+2*c+2])/f),s=Math.abs((i-e[n+2*c+3])/u);if(r+s>x&&(x=r+s,p=[r,s]),m&&x>m){h=!0;break}}if(h)break}return p},P={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},S=32,b=4,E=b,G=new Map,N=new Map;async function k(){if(f())return null;await u()}function v(e,t,n){if(!w(e.spatialReference,t))return null;return n?m(t,e.spatialReference,e):m(e.spatialReference,t,e)}function T(e,i,r,s=null){const a=e.spatialReference;if(a.equals(i))return e;w(a,i,s);const l=r.center,c=new h({xmin:l.x-e.x/2,xmax:l.x+e.x/2,ymin:l.y-e.y/2,ymax:l.y+e.y/2,spatialReference:a}),f=x(c,i,s),u=X(i);let m;if(t(f)||n(u)&&f.width>=u){const t=o(a)/o(i);m={x:e.x*t,y:e.y*t}}else m={x:f.width,y:f.height};return m}function C(e,t=.01){return o(e)?t/o(e):0}function _(e,t,o=null,i=!0){const r=e.spatialReference;if(r.equals(t))return e;w(r,t,o);const s=x(e,t,o);if(!i||!s)return s;const a=K(r,!0),l=K(t,!0),c=C(r);return c&&n(a)&&n(l)&&(s.x>0&&Math.abs(e.x-a[0])<c?s.x-=l[1]-l[0]:s.x<0&&Math.abs(e.x-a[1])<c&&(s.x+=l[1]-l[0])),s}function j(e){const{inSR:t,outSR:o,datumTransformation:i,preferPE:r}=e;if(t.equals(o)){const{points:t}=B(e,null);return t}if(t.isWebMercator&&o.isWGS84||t.isWGS84&&o.isWebMercator)return O(e);if(w(t,o,i)&&r){if(t.isGeographic)return W(e);const o=L(t);if(n(o))return W(e)}return z(e)}function z(e){const{points:t}=B(e,null),n=t.map((t=>new p(t[0],t[1],e.inSR)));return x(n,e.outSR,e.datumTransformation).map((e=>e?[e.x,e.y]:[NaN,NaN]))}function W(e){const{inSR:t,outSR:o,datumTransformation:l}=e,c=L(t),{points:f,mask:u}=B(e,c);if(!t.isGeographic){const e=t.wkid?i.coordsys(t.wkid):i.fromString(t.isGeographic?r.PE_TYPE_GEOGCS:r.PE_TYPE_PROJCS,t.wkt);s.projToGeog(e,f.length,f)}if(n(l)&&l.steps.length&&l.steps.forEach((e=>{const t=e.wkid?i.geogtran(e.wkid):i.fromString(r.PE_TYPE_GEOGTRAN,e.wkt);a.geogToGeog(t,f.length,f,null,e.isInverse?r.PE_TRANSFORM_2_TO_1:r.PE_TRANSFORM_1_TO_2)})),!o.isGeographic){const e=L(o,!0),t=n(e)&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90];I(f,t);const a=o.wkid?i.coordsys(o.wkid):i.fromString(o.isGeographic?r.PE_TYPE_GEOGCS:r.PE_TYPE_PROJCS,o.wkt);s.geogToProj(a,f.length,f)}let m=f;if(u&&f.length!==u.length){m=[];for(let e=0,t=0;e<u.length;e++)u[e]?m.push(f[t++]):m.push([NaN,NaN])}return m}function O(e){const{cols:t,rows:n,xres:o,yres:i,usePixelCenter:r,inSR:s,outSR:a}=e;let{xmin:l,ymax:c}=e;r&&(l+=o/2,c-=i/2);const f=[],u=[],m=Math.max(t,n);for(let g=0;g<m;g++){const e=l+o*Math.min(t,g),r=c-i*Math.min(n,g),m=x(new p({x:e,y:r,spatialReference:s}),a);g<=t&&f.push(m.x),g<=n&&u.push(m.y)}const h=[];for(let x=0;x<t;x++)for(let e=0;e<n;e++)h.push([f[x],u[e]]);return h}function L(e,t=!1){let n=e.wkid||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),G.has(n)){const e=G.get(n);return t?null==e?void 0:e.gcs:null==e?void 0:e.pcs}const o=e.wkid?i.coordsys(e.wkid):i.fromString(e.isGeographic?r.PE_TYPE_GEOGCS:r.PE_TYPE_PROJCS,e.wkt),s=A(o,C(e,1e-4)),a=A(o,0,!0);return G.set(n,{pcs:s,gcs:a}),t?a:s}function A(e,t=0,n=!1){const o=l.generate(e),i=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(null==i||!i.length)return null;let r=!1,s=i.find((e=>1===e.getInclusive()&&1===e.getKind()));if(!s){if(s=i.find((e=>1===e.getInclusive()&&0===e.getKind())),!s)return null;r=!0}const a=n?0:(2===o.getNorthPoleLocation()?1:0)|(2===o.getSouthPoleLocation()?2:0),c=o.isPannableRectangle(),f=s.getCoord();if(r)return{isEnvelope:r,isPannable:c,vertices:f,coef:null,bbox:[f[0][0]-t,f[0][1]-t,f[1][0]+t,f[1][1]+t],poleLocation:a};let u=0;const m=[];let[x,h]=f[0],[p,g]=f[0];for(let l=0,y=f.length;l<y;l++){u++,u===y&&(u=0);const[e,t]=f[l],[n,o]=f[u];if(o===t)m.push([e,n,t,o,2]);else{const i=(n-e)/(o-t||1e-4),r=e-i*t;t<o?m.push([i,r,t,o,0]):m.push([i,r,o,t,1])}x=x<e?x:e,h=h<t?h:t,p=p>e?p:e,g=g>t?g:t}return{isEnvelope:!1,isPannable:c,vertices:f,coef:m,bbox:[x,h,p,g],poleLocation:a}}function B(e,n){const o=[],{cols:i,rows:r,xres:s,yres:a,usePixelCenter:l}=e;let{xmin:c,ymax:f}=e;if(l&&(c+=s/2,f-=a/2),t(n)){for(let e=0;e<i;e++)for(let t=0;t<r;t++)o.push([c+s*e,f-a*t]);return{points:o}}const u=new Uint8Array(i*r);if(n.isEnvelope){const{bbox:[e,t,l,m]}=n;for(let x=0,h=0;x<i;x++){const i=c+s*x,p=n.isPannable||i>=e&&i<=l;for(let e=0;e<r;e++,h++){const n=f-a*e;p&&n>=t&&n<=m&&(o.push([i,n]),u[h]=1)}}return{points:o,mask:u}}const{coef:m}=n,x=[];for(let t=0;t<r;t++){const e=f-a*t,n=[],o=[];for(let t=0;t<m.length;t++){const[i,r,s,a,l]=m[t];if(e===s&&s===a)n.push(i),n.push(r),o.push(2),o.push(2);else if(e>=s&&e<=a){const t=i*e+r;n.push(t),o.push(l)}}let i=n;if(n.length>2){let e=2===o[0]?0:o[0],t=n[0];i=[];for(let r=1;r<o.length;r++)2===o[r]&&r!==o.length-1||(o[r]!==e&&(i.push(0===e?Math.min(t,n[r-1]):Math.max(t,n[r-1])),e=o[r],t=n[r]),r===o.length-1&&i.push(0===o[r]?Math.min(t,n[r]):Math.max(t,n[r])));i.sort(((e,t)=>e-t))}else n[0]>n[1]&&(i=[n[1],n[0]]);x.push(i)}for(let t=0,h=0;t<i;t++){const e=c+s*t;for(let t=0;t<r;t++,h++){const n=f-a*t,i=x[t];if(2===i.length)e>=i[0]&&e<=i[1]&&(o.push([e,n]),u[h]=1);else if(i.length>2){let t=!1;for(let n=0;n<i.length;n+=2)if(e>=i[n]&&e<=i[n+1]){t=!0;break}t&&(o.push([e,n]),u[h]=1)}}}return{points:o,mask:u}}function I(e,t){const[n,o]=t;for(let i=0;i<e.length;i++){const t=e[i][1];(t<n||t>o)&&(e[i]=[NaN,NaN])}}function Y(e){const n=X(e[0].spatialReference);if(e.length<2||t(n))return e[0];let{xmin:o,xmax:i,ymin:r,ymax:s}=e[0];for(let t=1;t<e.length;t++){const o=e[t];i=o.xmax+n*t,r=Math.min(r,o.ymin),s=Math.max(s,o.ymax)}return new h({xmin:o,xmax:i,ymin:r,ymax:s,spatialReference:e[0].spatialReference})}function F(e,o,i=null,r=!0){const s=e.spatialReference;if(s.equals(o))return e;const a=D(e),l=X(s,!0),c=X(o);if(0===a||t(l)||t(c)){const a=J(e,o,i,r);if(t(l)&&n(c)&&Math.abs(a.width-c)<C(o)&&f()){const t=L(s);if(n(t)&&t.poleLocation===d.None&&e.width<(t.bbox[2]-t.bbox[0])/2)return q(e,o)||a}return a}const u=e.clone().normalize();if(1===u.length&&e.xmax<l&&e.xmax-l/2>C(s)){const{xmin:t,xmax:n}=e;for(let o=0;o<=a;o++){const i=0===o?t:-l/2,r=o===a?n-l*o:l/2;u[o]=new h({xmin:i,xmax:r,ymin:e.ymin,ymax:e.ymax,spatialReference:s})}}return Y(u.map((e=>J(e,o,i,r))).filter((e=>!!e)))}function q(e,n){const o=X(n);if(t(o))return null;let{xmin:i,ymin:r,xmax:s,ymax:a}=e;const l=e.spatialReference,c=new g({spatialReference:l,rings:[[[i,r],[s,r],[s,a],[i,a],[i,r]]]}),f=x(c,n);if(2!==f.rings.length||!f.rings[0].length||!f.rings[1].length)return null;const{rings:u}=f,m=C(l),p=new h({spatialReference:n});for(let t=0;t<2;t++){i=s=u[t][0][0],r=a=u[t][0][1];for(let e=0;e<u[t].length;e++)i=i>u[t][e][0]?u[t][e][0]:i,s=s<u[t][e][0]?u[t][e][0]:s,r=r>u[t][e][1]?u[t][e][1]:r,a=a<u[t][e][1]?u[t][e][1]:a;if(0===t)p.ymin=r,p.ymax=a,p.xmin=i,p.xmax=s;else if(p.ymin=Math.min(p.ymin,r),p.ymax=Math.max(p.ymax,a),Math.abs(s-o/2)<m)p.xmin=i,p.xmax=p.xmax+o;else{if(!(Math.abs(i+o/2)<m))return null;p.xmax=s+o}}return p}function J(e,n,o=null,i=!0,r=!0){const s=e.spatialReference;if(s.equals(n))return e;w(s,n,o);const a=x(e,n,o);if(r&&n.isWebMercator&&a&&(a.ymax=Math.min(20037508.342787,a.ymax),a.ymin=Math.max(-20037508.342787,a.ymin),a.ymin>=a.ymax))return null;if(!i||!a)return a;const l=K(s,!0),c=K(n,!0);if(t(l)||t(c))return a;const f=C(s,.001),u=C(s,500),m=C(n,.001);if(Math.abs(a.xmin-c[0])<m&&Math.abs(a.xmax-c[1])<m){const t=Math.abs(e.xmin-l[0]),i=Math.abs(l[1]-e.xmax);if(t<f&&i>u){a.xmin=c[0];const t=[];t.push(new p(e.xmax,e.ymin,s)),t.push(new p(e.xmax,(e.ymin+e.ymax)/2,s)),t.push(new p(e.xmax,e.ymax,s));const i=t.map((e=>_(e,n,o))).filter((e=>!isNaN(null==e?void 0:e.x))).map((e=>e.x));a.xmax=Math.max.apply(null,i)}if(i<f&&t>u){a.xmax=c[1];const t=[];t.push(new p(e.xmin,e.ymin,s)),t.push(new p(e.xmin,(e.ymin+e.ymax)/2,s)),t.push(new p(e.xmin,e.ymax,s));const i=t.map((e=>_(e,n,o))).filter((e=>!isNaN(null==e?void 0:e.x))).map((e=>e.x));a.xmin=Math.min.apply(null,i)}}else{const e=C(n,.001);Math.abs(a.xmin-c[0])<e&&(a.xmin=c[0]),Math.abs(a.xmax-c[1])<e&&(a.xmax=c[1])}return a}function X(e,t=!1){const n=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*n:e.wkid&&e.isGeographic?360:2*P[e.wkid]||null}function K(e,t=!1){if(e.isGeographic)return[-180,180];const o=X(e,t);return n(o)?[-o/2,o/2]:null}function U(e,t,n,o){let i=(e-t)/n;return i-Math.floor(i)!=0?i=Math.floor(i):o&&(i-=1),i}function D(e,n=!1){const o=X(e.spatialReference);if(t(o))return 0;const i=n?0:-(o/2),r=C(e.spatialReference),s=!n&&Math.abs(e.xmax-o/2)<r?o/2:e.xmax,a=!n&&Math.abs(e.xmin+o/2)<r?-o/2:e.xmin;return U(s,i,o,!0)-U(a,i,o,!1)}function H(e){const o=e.storageInfo.origin.x,i=X(e.spatialReference,!0);if(t(i))return{originX:o,halfWorldWidth:null,pyramidsInfo:null};const r=i/2,{nativePixelSize:s,storageInfo:a,extent:l}=e,{maximumPyramidLevel:c,blockWidth:f,pyramidScalingFactor:u}=a;let m=s.x;const x=[],h=n(e.transform)&&"gcs-shift"===e.transform.type,p=o+(h?0:r),g=h?i-o:r-o;for(let t=0;t<=c;t++){const e=(l.xmax-o)/m/f,t=e-Math.floor(e)==0?e:Math.ceil(e),n=g/m/f,i=n-Math.floor(n)==0?n:Math.ceil(n),r=Math.floor(p/m/f),s=Math.round(p/m)%f,a=(f-Math.round(g/m)%f)%f;x.push({resolutionX:m,blockWidth:f,datsetColumnCount:t,worldColumnCountFromOrigin:i,leftMargin:s,rightPadding:a,originColumnOffset:r}),m*=u}return{originX:o,halfWorldWidth:r,pyramidsInfo:x,hasGCSSShiftTransform:h}}function Q(e){if(!e||e.isGeographic)return e;const t=String(e.wkid||e.wkt);let n;if(N.has(t))n=N.get(t);else{n=(e.wkid?i.coordsys(e.wkid):i.fromString(r.PE_TYPE_PROJCS,e.wkt)).getGeogcs().getCode(),N.set(t,n)}return new y({wkid:n})}function V(e){const t=e.isAdaptive&&null==e.spacing;let o=e.spacing||[S,S],i=Z(e),r={cols:i.size[0]+1,rows:i.size[1]+1};const s=i.outofBoundPointCount>0&&i.outofBoundPointCount<i.offsets.length/2;let a=i.outofBoundPointCount===i.offsets.length/2||t&&s?[0,0]:R(i.offsets,r,o,E);const l=(a[0]+a[1])/2,c=e.projectedExtent.spatialReference,f=e.srcBufferExtent.spatialReference;if(t&&(s||l>E)){M(c,f,e.datumTransformation)&&(c.isGeographic||n(L(c))),o=[b,b],i=Z({...e,spacing:o}),r={cols:i.size[0]+1,rows:i.size[1]+1},a=R(i.offsets,r,o,E)}if(i.error=a,o[0]>1&&(i.coefficients=$(i.offsets,r,s)),e.includeGCSGrid&&!c.isGeographic&&!c.isWebMercator)if(f.isGeographic)i.gcsGrid={offsets:i.offsets,coefficients:i.coefficients,spacing:o};else{const t=L(c);if(n(t)&&!t.isEnvelope){const t=Q(c),n=F(e.projectedExtent,t),{offsets:a}=Z({...e,srcBufferExtent:n,spacing:o}),l=$(a,r,s);i.gcsGrid={offsets:a,coefficients:l,spacing:o}}}return i}function Z(e){const{projectedExtent:t,srcBufferExtent:o,pixelSize:i,datumTransformation:r,rasterTransform:s}=e,a=t.spatialReference,l=o.spatialReference,c=w(a,l),{xmin:f,ymin:u,xmax:m,ymax:x}=t,h=X(l),g=n(h)&&(e.hasWrapAround||"gcs-shift"===(null==s?void 0:s.type)),y=e.spacing||[S,S],d=y[0]*i.x,M=y[1]*i.y,R=1===y[0],P=Math.ceil((m-f)/d-.1/y[0])+(R?0:1),E=Math.ceil((x-u)/M-.1/y[1])+(R?0:1),G=j({cols:P,rows:E,xmin:f,ymax:x,xres:d,yres:M,inSR:a,outSR:l,datumTransformation:r,preferPE:y[0]<=b,usePixelCenter:R}),N=[];let k,v=0;const T=R?-1:NaN,{xmin:_,xmax:z,ymax:W,width:O,height:A}=o,B=C(l,500),I=n(h)&&_>0&&z>h/2;let Y=!1;if(c){const e=L(a);Y=n(e)&&e.poleLocation>0}for(let n=0;n<P;n++){const e=[];for(let t=0;t<E;t++){let o=G[n*E+t];if(g&&o[0]>z&&o[0]>h/2-B?o[0]-=h:g&&0===n&&o[0]<0&&I&&!s&&(o[0]+=h),!o||isNaN(o[0])||isNaN(o[1]))N.push(T),N.push(T),e.push(null),v++;else{if(s){const e=s.inverseTransform(new p({x:o[0],y:o[1],spatialReference:l}));o=[e.x,e.y]}e.push(o),n>0&&g&&k[t]&&o[0]<k[t][0]&&(o[0]+=h,Y&&o[0]>z&&o[0]>h&&(o[0]-=h)),N.push((o[0]-_)/O),N.push((W-o[1])/A)}}k=e}return{offsets:N,error:null,coefficients:null,outofBoundPointCount:v,spacing:y,size:R?[P,E]:[P-1,E-1]}}function $(e,t,n){const{cols:o,rows:i}=t,r=new Float32Array((o-1)*(i-1)*2*6),s=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let l=0;l<o-1;l++){for(let t=0;t<i-1;t++){let n=l*i*2+2*t;const c=e[n],f=e[n+1],u=e[n+2],m=e[n+3];n+=2*i;const x=e[n],h=e[n+1],p=e[n+2],g=e[n+3];let y=0,d=12*(t*(o-1)+l);for(let e=0;e<3;e++)r[d++]=s[y++]*c+s[y++]*u+s[y++]*p;y=0;for(let e=0;e<3;e++)r[d++]=s[y++]*f+s[y++]*m+s[y++]*g;y=0;for(let e=0;e<3;e++)r[d++]=a[y++]*c+a[y++]*x+a[y++]*p;y=0;for(let e=0;e<3;e++)r[d++]=a[y++]*f+a[y++]*h+a[y++]*g}if(n)for(let e=0;e<r.length;e++)isNaN(r[e])&&(r[e]=-1)}return r}function ee(e){const t=e.clone().normalize();return 1===t.length?t[0]:Y(t)}function te(e,t,i){const{storageInfo:r,pixelSize:s}=t;let a,l=!1;const{pyramidResolutions:c}=r;if(n(c)&&c.length){const n=(e.x+e.y)/2,r=c[c.length-1],f=(r.x+r.y)/2,u=(s.x+s.y)/2;if(n<=u)a=0;else if(n>=f)a=c.length,l=n/f>8;else{let e,t=u;for(let o=1;o<=c.length;o++){if(e=(c[o-1].x+c[o-1].y)/2,n<=e){n===e?a=o:"down"===i?(a=o-1,l=n/t>8):a="up"===i||n-t>e-n||n/t>2?o:o-1;break}t=e}}const m=0===a?s:c[a-1];if(l){Math.min(m.x,m.y)*o(t.spatialReference)>19567&&(l=!1)}return{pyramidLevel:a,pyramidResolution:new p({x:m.x,y:m.y,spatialReference:t.spatialReference}),excessiveReading:l}}const f=Math.log(e.x/s.x)/Math.LN2,u=Math.log(e.y/s.y)/Math.LN2,m=t.storageInfo.maximumPyramidLevel||0;a="down"===i?Math.floor(Math.min(f,u)):"up"===i?Math.ceil(Math.max(f,u)):Math.round((f+u)/2),a<0?a=0:a>m&&(l=a>m+3,a=m);const x=2**a;return{pyramidLevel:a,pyramidResolution:new p({x:x*t.nativePixelSize.x,y:x*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:l}}function ne(e,t,n=512,i=!0){const{extent:r,spatialReference:s,pixelSize:a}=e,l=T(new p({x:a.x,y:a.y,spatialReference:s}),t,r);if(null==l)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const c=(l.x+l.y)/2,f=o(t),u=c*f*96*39.37,m=t.isGeographic?256/n*295828763.7958547:256/n*591657527.591555;let x="vector-magdir"===e.dataType||"vector-uv"===e.dataType;const h=F(r,t);x||i&&(t.isGeographic||t.isWebMercator)&&(x=h.xmin*h.xmax<0);let g,y=u;const d=1.001;if(x){y=m;const e=t.isGeographic?1341104507446289e-21:.29858214164761665,n=e*(96*f*39.37),o=t.isGeographic?4326:3857;g=T(new p({x:e,y:e,spatialReference:{wkid:o}}),s,h),g.x*=y/n,g.y*=y/n}else{g={x:a.x,y:a.y};const t=Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2);let n=0;for(;y<m*(d/2)&&n<t;)n++,y*=2,g.x*=2,g.y*=2;Math.max(y,m)/Math.min(y,m)<=d&&(y=m)}const M=[y],w=[{x:g.x,y:g.y}],R=70.5310735,P=Math.min(R,u)/d;for(;y>=P;)y/=2,g.x/=2,g.y/=2,M.push(y),w.push({x:g.x,y:g.y});return{projectedPixelSize:l,scales:M,srcResolutions:w,isCustomTilingScheme:!x}}export{ne as computeProjectedScales,S as defaultGridSpacing,E as defaultProjectionToleranceInPixels,v as getDefaultDatumTransformationForDataset,j as getProjectedGridPoints,V as getProjectionOffsetGrid,H as getRasterDatasetAlignmentInfo,X as getWorldWidth,D as getWorldWrapCount,k as load,b as minimumGridSpacing,F as projectExtent,_ as projectPoint,T as projectResolution,M as requirePE,ee as snapExtent,te as snapPyramid};
5
+ import"../../../geometry.js";import e from"../../../core/Error.js";import{isNone as t,isSome as n}from"../../../core/maybe.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{e as i,f as r,g as s,h as a,j as l}from"../../../chunks/pe.js";import{canProjectWithoutEngine as c,isLoaded as f,load as u,getTransformation as m,project as x}from"../../../geometry/projection.js";import h from"../../../geometry/Extent.js";import p from"../../../geometry/Point.js";import g from"../../../geometry/Polygon.js";import y from"../../../geometry/SpatialReference.js";var d;function M(e,t,n){return!c(e,t,n)}function w(t,n,o){const i=M(t,n,o);if(i&&!f())throw new e("rasterprojectionhelper-project","projection engine is not loaded");return i}!function(e){e[e.None=0]="None",e[e.North=1]="North",e[e.South=2]="South",e[e.Both=3]="Both"}(d||(d={}));const R=(e,t,n,o=0)=>{if(1===n[0])return[0,0];let i=1,r=-1,s=1,a=-1;for(let g=0;g<e.length;g+=2)isNaN(e[g])||(i=i>e[g]?e[g]:i,r=r>e[g]?r:e[g],s=s>e[g+1]?e[g+1]:s,a=a>e[g+1]?a:e[g+1]);const{cols:l,rows:c}=t,f=(r-i)/l/n[0],u=(a-s)/c/n[1],m=2*o;let x=0,h=!1,p=[0,0];for(let g=0;g<l-3;g++){for(let t=0;t<c-3;t++){const n=g*c*2+2*t,o=(e[n]+e[n+4]+e[n+4*c]+e[n+4*c+4])/4,i=(e[n+1]+e[n+5]+e[n+4*c+1]+e[n+4*c+5])/4,r=Math.abs((o-e[n+2*c+2])/f),s=Math.abs((i-e[n+2*c+3])/u);if(r+s>x&&(x=r+s,p=[r,s]),m&&x>m){h=!0;break}}if(h)break}return p},P={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},S=32,b=4,E=b,G=new Map,N=new Map;async function k(){if(f())return null;await u()}function T(e,t,n){if(!w(e.spatialReference,t))return null;return n?m(t,e.spatialReference,e):m(e.spatialReference,t,e)}function v(e,i,r,s=null){const a=e.spatialReference;if(a.equals(i))return e;w(a,i,s);const l=r.center,c=new h({xmin:l.x-e.x/2,xmax:l.x+e.x/2,ymin:l.y-e.y/2,ymax:l.y+e.y/2,spatialReference:a}),f=x(c,i,s),u=X(i);let m;if(t(f)||n(u)&&f.width>=u){const t=o(a)/o(i);m={x:e.x*t,y:e.y*t}}else m={x:f.width,y:f.height};return m}function C(e,t=.01){return o(e)?t/o(e):0}function _(e,t,o=null,i=!0){const r=e.spatialReference;if(r.equals(t))return e;w(r,t,o);const s=x(e,t,o);if(!i||!s)return s;const a=K(r,!0),l=K(t,!0),c=C(r);return c&&n(a)&&n(l)&&(s.x>0&&Math.abs(e.x-a[0])<c?s.x-=l[1]-l[0]:s.x<0&&Math.abs(e.x-a[1])<c&&(s.x+=l[1]-l[0])),s}function j(e){const{inSR:t,outSR:o,datumTransformation:i,preferPE:r}=e;if(t.equals(o)){const{points:t}=B(e,null);return t}if(t.isWebMercator&&o.isWGS84||t.isWGS84&&o.isWebMercator)return O(e);if(w(t,o,i)&&r){if(t.isGeographic)return W(e);const o=L(t);if(n(o))return W(e)}return z(e)}function z(e){const{points:t}=B(e,null),n=t.map((t=>new p(t[0],t[1],e.inSR)));return x(n,e.outSR,e.datumTransformation).map((e=>e?[e.x,e.y]:[NaN,NaN]))}function W(e){const{inSR:t,outSR:o,datumTransformation:l}=e,c=L(t),{points:f,mask:u}=B(e,c);if(!t.isGeographic){const e=t.wkid?i.coordsys(t.wkid):i.fromString(t.isGeographic?r.PE_TYPE_GEOGCS:r.PE_TYPE_PROJCS,t.wkt);s.projToGeog(e,f.length,f)}if(n(l)&&l.steps.length&&l.steps.forEach((e=>{const t=e.wkid?i.geogtran(e.wkid):i.fromString(r.PE_TYPE_GEOGTRAN,e.wkt);a.geogToGeog(t,f.length,f,null,e.isInverse?r.PE_TRANSFORM_2_TO_1:r.PE_TRANSFORM_1_TO_2)})),!o.isGeographic){const e=L(o,!0),t=n(e)&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90];I(f,t);const a=o.wkid?i.coordsys(o.wkid):i.fromString(o.isGeographic?r.PE_TYPE_GEOGCS:r.PE_TYPE_PROJCS,o.wkt);s.geogToProj(a,f.length,f)}let m=f;if(u&&f.length!==u.length){m=[];for(let e=0,t=0;e<u.length;e++)u[e]?m.push(f[t++]):m.push([NaN,NaN])}return m}function O(e){const{cols:t,rows:n,xres:o,yres:i,usePixelCenter:r,inSR:s,outSR:a}=e;let{xmin:l,ymax:c}=e;r&&(l+=o/2,c-=i/2);const f=[],u=[],m=Math.max(t,n);for(let g=0;g<m;g++){const e=l+o*Math.min(t,g),r=c-i*Math.min(n,g),m=x(new p({x:e,y:r,spatialReference:s}),a);g<=t&&f.push(m.x),g<=n&&u.push(m.y)}const h=[];for(let x=0;x<t;x++)for(let e=0;e<n;e++)h.push([f[x],u[e]]);return h}function L(e,t=!1){let n=e.wkid||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),G.has(n)){const e=G.get(n);return t?e?.gcs:e?.pcs}const o=e.wkid?i.coordsys(e.wkid):i.fromString(e.isGeographic?r.PE_TYPE_GEOGCS:r.PE_TYPE_PROJCS,e.wkt),s=A(o,C(e,1e-4)),a=A(o,0,!0);return G.set(n,{pcs:s,gcs:a}),t?a:s}function A(e,t=0,n=!1){const o=l.generate(e),i=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!i?.length)return null;let r=!1,s=i.find((e=>1===e.getInclusive()&&1===e.getKind()));if(!s){if(s=i.find((e=>1===e.getInclusive()&&0===e.getKind())),!s)return null;r=!0}const a=n?0:(2===o.getNorthPoleLocation()?1:0)|(2===o.getSouthPoleLocation()?2:0),c=o.isPannableRectangle(),f=s.getCoord();if(r)return{isEnvelope:r,isPannable:c,vertices:f,coef:null,bbox:[f[0][0]-t,f[0][1]-t,f[1][0]+t,f[1][1]+t],poleLocation:a};let u=0;const m=[];let[x,h]=f[0],[p,g]=f[0];for(let l=0,y=f.length;l<y;l++){u++,u===y&&(u=0);const[e,t]=f[l],[n,o]=f[u];if(o===t)m.push([e,n,t,o,2]);else{const i=(n-e)/(o-t||1e-4),r=e-i*t;t<o?m.push([i,r,t,o,0]):m.push([i,r,o,t,1])}x=x<e?x:e,h=h<t?h:t,p=p>e?p:e,g=g>t?g:t}return{isEnvelope:!1,isPannable:c,vertices:f,coef:m,bbox:[x,h,p,g],poleLocation:a}}function B(e,n){const o=[],{cols:i,rows:r,xres:s,yres:a,usePixelCenter:l}=e;let{xmin:c,ymax:f}=e;if(l&&(c+=s/2,f-=a/2),t(n)){for(let e=0;e<i;e++)for(let t=0;t<r;t++)o.push([c+s*e,f-a*t]);return{points:o}}const u=new Uint8Array(i*r);if(n.isEnvelope){const{bbox:[e,t,l,m]}=n;for(let x=0,h=0;x<i;x++){const i=c+s*x,p=n.isPannable||i>=e&&i<=l;for(let e=0;e<r;e++,h++){const n=f-a*e;p&&n>=t&&n<=m&&(o.push([i,n]),u[h]=1)}}return{points:o,mask:u}}const{coef:m}=n,x=[];for(let t=0;t<r;t++){const e=f-a*t,n=[],o=[];for(let t=0;t<m.length;t++){const[i,r,s,a,l]=m[t];if(e===s&&s===a)n.push(i),n.push(r),o.push(2),o.push(2);else if(e>=s&&e<=a){const t=i*e+r;n.push(t),o.push(l)}}let i=n;if(n.length>2){let e=2===o[0]?0:o[0],t=n[0];i=[];for(let r=1;r<o.length;r++)2===o[r]&&r!==o.length-1||(o[r]!==e&&(i.push(0===e?Math.min(t,n[r-1]):Math.max(t,n[r-1])),e=o[r],t=n[r]),r===o.length-1&&i.push(0===o[r]?Math.min(t,n[r]):Math.max(t,n[r])));i.sort(((e,t)=>e-t))}else n[0]>n[1]&&(i=[n[1],n[0]]);x.push(i)}for(let t=0,h=0;t<i;t++){const e=c+s*t;for(let t=0;t<r;t++,h++){const n=f-a*t,i=x[t];if(2===i.length)e>=i[0]&&e<=i[1]&&(o.push([e,n]),u[h]=1);else if(i.length>2){let t=!1;for(let n=0;n<i.length;n+=2)if(e>=i[n]&&e<=i[n+1]){t=!0;break}t&&(o.push([e,n]),u[h]=1)}}}return{points:o,mask:u}}function I(e,t){const[n,o]=t;for(let i=0;i<e.length;i++){const t=e[i][1];(t<n||t>o)&&(e[i]=[NaN,NaN])}}function Y(e){const n=X(e[0].spatialReference);if(e.length<2||t(n))return e[0];let{xmin:o,xmax:i,ymin:r,ymax:s}=e[0];for(let t=1;t<e.length;t++){const o=e[t];i=o.xmax+n*t,r=Math.min(r,o.ymin),s=Math.max(s,o.ymax)}return new h({xmin:o,xmax:i,ymin:r,ymax:s,spatialReference:e[0].spatialReference})}function F(e,o,i=null,r=!0){const s=e.spatialReference;if(s.equals(o))return e;const a=D(e),l=X(s,!0),c=X(o);if(0===a||t(l)||t(c)){const a=J(e,o,i,r);if(t(l)&&n(c)&&Math.abs(a.width-c)<C(o)&&f()){const t=L(s);if(n(t)&&t.poleLocation===d.None&&e.width<(t.bbox[2]-t.bbox[0])/2)return q(e,o)||a}return a}const u=e.clone().normalize();if(1===u.length&&e.xmax<l&&e.xmax-l/2>C(s)){const{xmin:t,xmax:n}=e;for(let o=0;o<=a;o++){const i=0===o?t:-l/2,r=o===a?n-l*o:l/2;u[o]=new h({xmin:i,xmax:r,ymin:e.ymin,ymax:e.ymax,spatialReference:s})}}return Y(u.map((e=>J(e,o,i,r))).filter((e=>!!e)))}function q(e,n){const o=X(n);if(t(o))return null;let{xmin:i,ymin:r,xmax:s,ymax:a}=e;const l=e.spatialReference,c=new g({spatialReference:l,rings:[[[i,r],[s,r],[s,a],[i,a],[i,r]]]}),f=x(c,n);if(2!==f.rings.length||!f.rings[0].length||!f.rings[1].length)return null;const{rings:u}=f,m=C(l),p=new h({spatialReference:n});for(let t=0;t<2;t++){i=s=u[t][0][0],r=a=u[t][0][1];for(let e=0;e<u[t].length;e++)i=i>u[t][e][0]?u[t][e][0]:i,s=s<u[t][e][0]?u[t][e][0]:s,r=r>u[t][e][1]?u[t][e][1]:r,a=a<u[t][e][1]?u[t][e][1]:a;if(0===t)p.ymin=r,p.ymax=a,p.xmin=i,p.xmax=s;else if(p.ymin=Math.min(p.ymin,r),p.ymax=Math.max(p.ymax,a),Math.abs(s-o/2)<m)p.xmin=i,p.xmax=p.xmax+o;else{if(!(Math.abs(i+o/2)<m))return null;p.xmax=s+o}}return p}function J(e,n,o=null,i=!0,r=!0){const s=e.spatialReference;if(s.equals(n))return e;w(s,n,o);const a=x(e,n,o);if(r&&n.isWebMercator&&a&&(a.ymax=Math.min(20037508.342787,a.ymax),a.ymin=Math.max(-20037508.342787,a.ymin),a.ymin>=a.ymax))return null;if(!i||!a)return a;const l=K(s,!0),c=K(n,!0);if(t(l)||t(c))return a;const f=C(s,.001),u=C(s,500),m=C(n,.001);if(Math.abs(a.xmin-c[0])<m&&Math.abs(a.xmax-c[1])<m){const t=Math.abs(e.xmin-l[0]),i=Math.abs(l[1]-e.xmax);if(t<f&&i>u){a.xmin=c[0];const t=[];t.push(new p(e.xmax,e.ymin,s)),t.push(new p(e.xmax,(e.ymin+e.ymax)/2,s)),t.push(new p(e.xmax,e.ymax,s));const i=t.map((e=>_(e,n,o))).filter((e=>!isNaN(e?.x))).map((e=>e.x));a.xmax=Math.max.apply(null,i)}if(i<f&&t>u){a.xmax=c[1];const t=[];t.push(new p(e.xmin,e.ymin,s)),t.push(new p(e.xmin,(e.ymin+e.ymax)/2,s)),t.push(new p(e.xmin,e.ymax,s));const i=t.map((e=>_(e,n,o))).filter((e=>!isNaN(e?.x))).map((e=>e.x));a.xmin=Math.min.apply(null,i)}}else{const e=C(n,.001);Math.abs(a.xmin-c[0])<e&&(a.xmin=c[0]),Math.abs(a.xmax-c[1])<e&&(a.xmax=c[1])}return a}function X(e,t=!1){const n=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*n:e.wkid&&e.isGeographic?360:2*P[e.wkid]||null}function K(e,t=!1){if(e.isGeographic)return[-180,180];const o=X(e,t);return n(o)?[-o/2,o/2]:null}function U(e,t,n,o){let i=(e-t)/n;return i-Math.floor(i)!=0?i=Math.floor(i):o&&(i-=1),i}function D(e,n=!1){const o=X(e.spatialReference);if(t(o))return 0;const i=n?0:-(o/2),r=C(e.spatialReference),s=!n&&Math.abs(e.xmax-o/2)<r?o/2:e.xmax,a=!n&&Math.abs(e.xmin+o/2)<r?-o/2:e.xmin;return U(s,i,o,!0)-U(a,i,o,!1)}function H(e){const o=e.storageInfo.origin.x,i=X(e.spatialReference,!0);if(t(i))return{originX:o,halfWorldWidth:null,pyramidsInfo:null};const r=i/2,{nativePixelSize:s,storageInfo:a,extent:l}=e,{maximumPyramidLevel:c,blockWidth:f,pyramidScalingFactor:u}=a;let m=s.x;const x=[],h=n(e.transform)&&"gcs-shift"===e.transform.type,p=o+(h?0:r),g=h?i-o:r-o;for(let t=0;t<=c;t++){const e=(l.xmax-o)/m/f,t=e-Math.floor(e)==0?e:Math.ceil(e),n=g/m/f,i=n-Math.floor(n)==0?n:Math.ceil(n),r=Math.floor(p/m/f),s=Math.round(p/m)%f,a=(f-Math.round(g/m)%f)%f;x.push({resolutionX:m,blockWidth:f,datsetColumnCount:t,worldColumnCountFromOrigin:i,leftMargin:s,rightPadding:a,originColumnOffset:r}),m*=u}return{originX:o,halfWorldWidth:r,pyramidsInfo:x,hasGCSSShiftTransform:h}}function Q(e){if(!e||e.isGeographic)return e;const t=String(e.wkid||e.wkt);let n;if(N.has(t))n=N.get(t);else{n=(e.wkid?i.coordsys(e.wkid):i.fromString(r.PE_TYPE_PROJCS,e.wkt)).getGeogcs().getCode(),N.set(t,n)}return new y({wkid:n})}function V(e){const t=e.isAdaptive&&null==e.spacing;let o=e.spacing||[S,S],i=Z(e),r={cols:i.size[0]+1,rows:i.size[1]+1};const s=i.outofBoundPointCount>0&&i.outofBoundPointCount<i.offsets.length/2;let a=i.outofBoundPointCount===i.offsets.length/2||t&&s?[0,0]:R(i.offsets,r,o,E);const l=(a[0]+a[1])/2,c=e.projectedExtent.spatialReference,f=e.srcBufferExtent.spatialReference;if(t&&(s||l>E)){M(c,f,e.datumTransformation)&&(c.isGeographic||n(L(c))),o=[b,b],i=Z({...e,spacing:o}),r={cols:i.size[0]+1,rows:i.size[1]+1},a=R(i.offsets,r,o,E)}if(i.error=a,o[0]>1&&(i.coefficients=$(i.offsets,r,s)),e.includeGCSGrid&&!c.isGeographic&&!c.isWebMercator)if(f.isGeographic)i.gcsGrid={offsets:i.offsets,coefficients:i.coefficients,spacing:o};else{const t=L(c);if(n(t)&&!t.isEnvelope){const t=Q(c),n=F(e.projectedExtent,t),{offsets:a}=Z({...e,srcBufferExtent:n,spacing:o}),l=$(a,r,s);i.gcsGrid={offsets:a,coefficients:l,spacing:o}}}return i}function Z(e){const{projectedExtent:t,srcBufferExtent:o,pixelSize:i,datumTransformation:r,rasterTransform:s}=e,a=t.spatialReference,l=o.spatialReference,c=w(a,l),{xmin:f,ymin:u,xmax:m,ymax:x}=t,h=X(l),g=n(h)&&(e.hasWrapAround||"gcs-shift"===s?.type),y=e.spacing||[S,S],d=y[0]*i.x,M=y[1]*i.y,R=1===y[0],P=Math.ceil((m-f)/d-.1/y[0])+(R?0:1),E=Math.ceil((x-u)/M-.1/y[1])+(R?0:1),G=j({cols:P,rows:E,xmin:f,ymax:x,xres:d,yres:M,inSR:a,outSR:l,datumTransformation:r,preferPE:y[0]<=b,usePixelCenter:R}),N=[];let k,T=0;const v=R?-1:NaN,{xmin:_,xmax:z,ymax:W,width:O,height:A}=o,B=C(l,500),I=n(h)&&_>0&&z>h/2;let Y=!1;if(c){const e=L(a);Y=n(e)&&e.poleLocation>0}for(let n=0;n<P;n++){const e=[];for(let t=0;t<E;t++){let o=G[n*E+t];if(g&&o[0]>z&&o[0]>h/2-B?o[0]-=h:g&&0===n&&o[0]<0&&I&&!s&&(o[0]+=h),!o||isNaN(o[0])||isNaN(o[1]))N.push(v),N.push(v),e.push(null),T++;else{if(s){const e=s.inverseTransform(new p({x:o[0],y:o[1],spatialReference:l}));o=[e.x,e.y]}e.push(o),n>0&&g&&k[t]&&o[0]<k[t][0]&&(o[0]+=h,Y&&o[0]>z&&o[0]>h&&(o[0]-=h)),N.push((o[0]-_)/O),N.push((W-o[1])/A)}}k=e}return{offsets:N,error:null,coefficients:null,outofBoundPointCount:T,spacing:y,size:R?[P,E]:[P-1,E-1]}}function $(e,t,n){const{cols:o,rows:i}=t,r=new Float32Array((o-1)*(i-1)*2*6),s=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let l=0;l<o-1;l++){for(let t=0;t<i-1;t++){let n=l*i*2+2*t;const c=e[n],f=e[n+1],u=e[n+2],m=e[n+3];n+=2*i;const x=e[n],h=e[n+1],p=e[n+2],g=e[n+3];let y=0,d=12*(t*(o-1)+l);for(let e=0;e<3;e++)r[d++]=s[y++]*c+s[y++]*u+s[y++]*p;y=0;for(let e=0;e<3;e++)r[d++]=s[y++]*f+s[y++]*m+s[y++]*g;y=0;for(let e=0;e<3;e++)r[d++]=a[y++]*c+a[y++]*x+a[y++]*p;y=0;for(let e=0;e<3;e++)r[d++]=a[y++]*f+a[y++]*h+a[y++]*g}if(n)for(let e=0;e<r.length;e++)isNaN(r[e])&&(r[e]=-1)}return r}function ee(e){const t=e.clone().normalize();return 1===t.length?t[0]:Y(t)}function te(e,t,i){const{storageInfo:r,pixelSize:s}=t;let a,l=!1;const{pyramidResolutions:c}=r;if(n(c)&&c.length){const n=(e.x+e.y)/2,r=c[c.length-1],f=(r.x+r.y)/2,u=(s.x+s.y)/2;if(n<=u)a=0;else if(n>=f)a=c.length,l=n/f>8;else{let e,t=u;for(let o=1;o<=c.length;o++){if(e=(c[o-1].x+c[o-1].y)/2,n<=e){n===e?a=o:"down"===i?(a=o-1,l=n/t>8):a="up"===i||n-t>e-n||n/t>2?o:o-1;break}t=e}}const m=0===a?s:c[a-1];if(l){Math.min(m.x,m.y)*o(t.spatialReference)>19567&&(l=!1)}return{pyramidLevel:a,pyramidResolution:new p({x:m.x,y:m.y,spatialReference:t.spatialReference}),excessiveReading:l}}const f=Math.log(e.x/s.x)/Math.LN2,u=Math.log(e.y/s.y)/Math.LN2,m=t.storageInfo.maximumPyramidLevel||0;a="down"===i?Math.floor(Math.min(f,u)):"up"===i?Math.ceil(Math.max(f,u)):Math.round((f+u)/2),a<0?a=0:a>m&&(l=a>m+3,a=m);const x=2**a;return{pyramidLevel:a,pyramidResolution:new p({x:x*t.nativePixelSize.x,y:x*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:l}}function ne(e,t,n=512,i=!0){const{extent:r,spatialReference:s,pixelSize:a}=e,l=v(new p({x:a.x,y:a.y,spatialReference:s}),t,r);if(null==l)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const c=(l.x+l.y)/2,f=o(t),u=c*f*96*39.37,m=t.isGeographic?256/n*295828763.7958547:256/n*591657527.591555;let x="vector-magdir"===e.dataType||"vector-uv"===e.dataType;const h=F(r,t);x||i&&(t.isGeographic||t.isWebMercator)&&(x=h.xmin*h.xmax<0);let g,y=u;const d=1.001;if(x){y=m;const e=t.isGeographic?1341104507446289e-21:.29858214164761665,n=e*(96*f*39.37),o=t.isGeographic?4326:3857;g=v(new p({x:e,y:e,spatialReference:{wkid:o}}),s,h),g.x*=y/n,g.y*=y/n}else{g={x:a.x,y:a.y};const t=Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2);let n=0;for(;y<m*(d/2)&&n<t;)n++,y*=2,g.x*=2,g.y*=2;Math.max(y,m)/Math.min(y,m)<=d&&(y=m)}const M=[y],w=[{x:g.x,y:g.y}],R=70.5310735,P=Math.min(R,u)/d;for(;y>=P;)y/=2,g.x/=2,g.y/=2,M.push(y),w.push({x:g.x,y:g.y});return{projectedPixelSize:l,scales:M,srcResolutions:w,isCustomTilingScheme:!x}}export{ne as computeProjectedScales,S as defaultGridSpacing,E as defaultProjectionToleranceInPixels,T as getDefaultDatumTransformationForDataset,j as getProjectedGridPoints,V as getProjectionOffsetGrid,H as getRasterDatasetAlignmentInfo,X as getWorldWidth,D as getWorldWrapCount,k as load,b as minimumGridSpacing,F as projectExtent,_ as projectPoint,v as projectResolution,M as requirePE,ee as snapExtent,te as snapPyramid};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as t,isSome as n,unwrap as e}from"../../../core/maybe.js";const i={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34e38,34e38],f64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function s(t,n=256){n=Math.min(n,256);const{size:e,counts:i}=t,s=new Uint8Array(e),o=i.reduce(((t,e)=>t+e/n),0);let r=0,a=0,f=0,l=o;for(let u=0;u<e;u++)if(f+=i[u],!(u<e-1&&f+i[u+1]<l)){for(;r<n-1&&l<f;)r++,l+=o;for(let t=a;t<=u;t++)s[t]=r;a=u+1}for(let u=a;u<e;u++)s[u]=n-1;return s}function o(t){const{minCutOff:n,maxCutOff:e,gamma:i,pixelType:s}=t,o=t.outMin||0,a=t.outMax||255;if(!["u8","u16","s8","s16"].includes(s))return null;const f=n.length;let l,u,m=0;"s8"===s?m=-127:"s16"===s&&(m=-32767);let c=256;["u16","s16"].includes(s)&&(c=65536);const h=[],g=[],x=a-o;for(l=0;l<f;l++)g[l]=e[l]-n[l],h[l]=x/(e[l]-n[l]);const p=i&&i.length>=f,M=[];if(p)for(l=0;l<f;l++)i[l]>1?i[l]>2?M[l]=6.5+(i[l]-2)**2.5:M[l]=6.5+100*(2-i[l])**4:M[l]=1;let d;const v=[];let b,O,y;if(p)for(l=0;l<f;l++){for(y=[],u=0;u<c;u++)b=u+m,d=(b-n[l])/g[l],O=1,i[l]>1&&(O-=(1/x)**(d*M[l])),b<e[l]&&b>n[l]?y[u]=Math.floor(O*x*d**(1/i[l]))+o:b>=e[l]?y[u]=a:y[u]=o;v[l]=y}else for(l=0;l<f;l++){for(y=[],u=0;u<c;u++)b=u+m,b<=n[l]?y[u]=o:b>=e[l]?y[u]=a:y[u]=Math.floor((b-n[l])/g[l]*x)+o;v[l]=y}if(null!=t.contrastOffset){const n=r(t.contrastOffset,t.brightnessOffset);for(l=0;l<f;l++)for(y=v[l],u=0;u<c;u++)y[u]=n[y[u]]}return{lut:v,offset:m}}function r(t,n){const e=Math.min(Math.max(t,-100),100),i=Math.min(Math.max(n,-100),100),s=255,o=128;let r,a;const f=new Uint8Array(256);for(r=0;r<256;r++)e>0&&e<100?a=(200*r-100*s+2*s*i)/(2*(100-e))+o:e<=0&&e>-100?a=(200*r-100*s+2*s*i)*(100+e)/2e4+o:100===e?(a=200*r-100*s+(s+1)*(100-e)+2*s*i,a=a>0?s:0):-100===e&&(a=o),f[r]=a>s?s:a<0?0:a;return f}function a(n){var e;if(t(n)||null==(e=n.pixels)||!e.length)return null;n.statistics||n.updateStatistics();const{pixels:i,mask:s,pixelType:o,statistics:r}=n,a=n.width*n.height,f=i.length;let l,u,m,c,h;const g=[],x=[];let p,M,d,v,b,O,y,C,z,A;const k=256;for(c=0;c<f;c++){if(p=new Uint32Array(k),d=i[c],"u8"===o)if(l=-.5,u=255.5,s)for(h=0;h<a;h++)s[h]&&p[d[h]]++;else for(h=0;h<a;h++)p[d[h]]++;else{if(l=r[c].minValue,u=r[c].maxValue,m=(u-l)/k,M=new Uint32Array(k+1),s)for(h=0;h<a;h++)s[h]&&M[Math.floor((d[h]-l)/m)]++;else for(h=0;h<a;h++)M[Math.floor((d[h]-l)/m)]++;for(h=0;h<255;h++)p[h]=M[h];p[255]=M[255]+M[256]}for(g.push({min:l,max:u,size:k,counts:p}),v=0,b=0,C=0,h=0;h<k;h++)v+=p[h],b+=h*p[h];for(z=b/v,h=0;h<k;h++)C+=p[h]*(h-z)**2;A=Math.sqrt(C/(v-1)),m=(u-l)/k,O=(z+.5)*m+l,y=A*m,x.push({min:l,max:u,avg:O,stddev:y})}return{statistics:x,histograms:g}}function f(t){const n=[];for(let e=0;e<t.length;e++){const{min:i,max:s,size:o,counts:r}=t[e];let a=0,f=0;for(let t=0;t<o;t++)a+=r[t],f+=t*r[t];const l=f/a;let u=0;for(let t=0;t<o;t++)u+=r[t]*(t-l)**2;const m=(s-i)/o,c=(l+.5)*m+i,h=Math.sqrt(u/(a-1))*m;n.push({min:i,max:s,avg:c,stddev:h})}return n}function l(t,o){var r,f,l;const{pixelBlock:m,bandIds:c,returnHistogramLut:h,rasterInfo:g}=o;let x,p,M=t.stretchType;var d;if(t.dra)if("minMax"===M&&n(m)&&m.statistics)x=m.statistics.map((t=>[t.minValue,t.maxValue,0,0]));else{const t=a(m);x=n(t)?t.statistics:null,p=n(t)?t.histograms:null}else x=(null==(d=t.statistics)?void 0:d.length)>0?t.statistics:e(g.statistics),p=t.histograms||e(g.histograms);"percentClip"!==M&&"histogramEqualization"!==M||null!=(r=p)&&r.length||(M="minMax");const v=(null==(f=x)?void 0:f.length)||(null==(l=p)?void 0:l.length)||g.bandCount,b=[],O=[];let y,C,z,A,k,w,U,L,V,q,E,T;switch(x&&!Array.isArray(x[0])&&(x=x.map((t=>[t.min,t.max,t.avg,t.stddev]))),M){case"none":{const t=i[g.pixelType]||i.f32;for(L=0;L<v;L++)b[L]=t[0],O[L]=t[1]}break;case"minMax":for(L=0;L<v;L++)b[L]=x[L][0],O[L]=x[L][1];break;case"standardDeviation":for(L=0;L<v;L++)b[L]=x[L][2]-t.numberOfStandardDeviations*x[L][3],O[L]=x[L][2]+t.numberOfStandardDeviations*x[L][3],b[L]<x[L][0]&&(b[L]=x[L][0]),O[L]>x[L][1]&&(O[L]=x[L][1]);break;case"histogramEqualization":for(L=0;L<v;L++)b[L]=p[L].min,O[L]=p[L].max;break;case"percentClip":for(L=0;L<p.length;L++){for(y=p[L],k=new Uint32Array(y.size),A=[...y.counts],A.length>=20&&(A[0]=A[1]=A[2]=A[A.length-1]=A[A.length-2]=0),z=0,C=(y.max-y.min)/y.size,U=-.5===y.min&&1===C?.5:0,V=0;V<y.size;V++)z+=A[V],k[V]=z;for(w=(t.minPercent||0)*z/100,V=0;V<y.size;V++)if(k[V]>w){b[L]=y.min+C*(V+U);break}for(w=(1-(t.maxPercent||0)/100)*z,V=y.size-2;V>=0;V--)if(k[V]<w){O[L]=y.min+C*(V+2-U);break}}break;default:for(L=0;L<v;L++)b[L]=x[L][0],O[L]=x[L][1]}"histogramEqualization"===M?(E=p[0].size||256,q=0,h&&(T=p.map((t=>s(t))))):(E=t.max||255,q=t.min||0);return u({minCutOff:b,maxCutOff:O,outMax:E,outMin:q,histogramLut:T},c)}function u(t,n){if(null==n||0===n.length)return t;const e=Math.max.apply(null,n),{minCutOff:i,maxCutOff:s,outMin:o,outMax:r,histogramLut:a}=t;return i.length===n.length||i.length<=e?t:{minCutOff:n.map((t=>i[t])),maxCutOff:n.map((t=>s[t])),histogramLut:a?n.map((t=>a[t])):null,outMin:o,outMax:r}}function m(n,e){var i;if(t(n)||null==(i=n.pixels)||!i.length)return n;const s=n.clone(),{pixels:o,mask:r}=s,{minCutOff:a,maxCutOff:f,gamma:l}=e,u=e.outMin||0,m=e.outMax||255,c=s.width*s.height,h=o.length;let g,x,p,M,d;const v=m-u,b=[],O=[];for(g=0;g<h;g++)O[g]=f[g]-a[g],b[g]=v/(f[g]-a[g]);const y=l&&l.length>=h,C=[];if(y)for(g=0;g<h;g++)l[g]>1?l[g]>2?C[g]=6.5+(l[g]-2)**2.5:C[g]=6.5+100*(2-l[g])**4:C[g]=1;if(y)if(null!=r){for(x=0;x<c;x++)if(r[x])for(g=0;g<h;g++)p=o[g][x],d=(p-a[g])/O[g],M=1,l[g]>1&&(M-=(1/v)**(d*C[g])),p<f[g]&&p>a[g]?o[g][x]=Math.floor(M*v*d**(1/l[g]))+u:p>=f[g]?o[g][x]=m:o[g][x]=u}else for(x=0;x<c;x++)for(g=0;g<h;g++)p=o[g][x],d=(p-a[g])/O[g],M=1,l[g]>1&&(M-=(1/v)**(d*C[g])),p<f[g]&&p>a[g]?o[g][x]=Math.floor(M*v*d**(1/l[g]))+u:p>=f[g]?o[g][x]=m:o[g][x]=u;else if(null!=r){for(x=0;x<c;x++)if(r[x])for(g=0;g<h;g++)p=o[g][x],p<f[g]&&p>a[g]?o[g][x]=Math.floor((p-a[g])/O[g]*v)+u:p>=f[g]?o[g][x]=m:o[g][x]=u}else for(x=0;x<c;x++)for(g=0;g<h;g++)p=o[g][x],p<f[g]&&p>a[g]?o[g][x]=Math.floor((p-a[g])/O[g]*v)+u:p>=f[g]?o[g][x]=m:o[g][x]=u;return s.pixelType="u8",s.updateStatistics(),s}export{r as createContrastBrightnessLUT,s as createHistogramEqualizationLUT,o as createStretchLUT,f as estimateStatisticsFromHistograms,a as estimateStatisticsHistograms,l as getStretchCutoff,m as stretch};
5
+ import{isNone as t,isSome as e,unwrap as n}from"../../../core/maybe.js";const i={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34e38,34e38],f64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function s(t,e=256){e=Math.min(e,256);const{size:n,counts:i}=t,s=new Uint8Array(n),o=i.reduce(((t,n)=>t+n/e),0);let r=0,a=0,f=0,l=o;for(let u=0;u<n;u++)if(f+=i[u],!(u<n-1&&f+i[u+1]<l)){for(;r<e-1&&l<f;)r++,l+=o;for(let t=a;t<=u;t++)s[t]=r;a=u+1}for(let u=a;u<n;u++)s[u]=e-1;return s}function o(t){const{minCutOff:e,maxCutOff:n,gamma:i,pixelType:s}=t,o=t.outMin||0,a=t.outMax||255;if(!["u8","u16","s8","s16"].includes(s))return null;const f=e.length;let l,u,m=0;"s8"===s?m=-127:"s16"===s&&(m=-32767);let c=256;["u16","s16"].includes(s)&&(c=65536);const h=[],g=[],x=a-o;for(l=0;l<f;l++)g[l]=n[l]-e[l],h[l]=x/(n[l]-e[l]);const p=i&&i.length>=f,M=[];if(p)for(l=0;l<f;l++)i[l]>1?i[l]>2?M[l]=6.5+(i[l]-2)**2.5:M[l]=6.5+100*(2-i[l])**4:M[l]=1;let d;const b=[];let O,y,C;if(p)for(l=0;l<f;l++){for(C=[],u=0;u<c;u++)O=u+m,d=(O-e[l])/g[l],y=1,i[l]>1&&(y-=(1/x)**(d*M[l])),O<n[l]&&O>e[l]?C[u]=Math.floor(y*x*d**(1/i[l]))+o:O>=n[l]?C[u]=a:C[u]=o;b[l]=C}else for(l=0;l<f;l++){for(C=[],u=0;u<c;u++)O=u+m,O<=e[l]?C[u]=o:O>=n[l]?C[u]=a:C[u]=Math.floor((O-e[l])/g[l]*x)+o;b[l]=C}if(null!=t.contrastOffset){const e=r(t.contrastOffset,t.brightnessOffset);for(l=0;l<f;l++)for(C=b[l],u=0;u<c;u++)C[u]=e[C[u]]}return{lut:b,offset:m}}function r(t,e){const n=Math.min(Math.max(t,-100),100),i=Math.min(Math.max(e,-100),100),s=255,o=128;let r,a;const f=new Uint8Array(256);for(r=0;r<256;r++)n>0&&n<100?a=(200*r-100*s+2*s*i)/(2*(100-n))+o:n<=0&&n>-100?a=(200*r-100*s+2*s*i)*(100+n)/2e4+o:100===n?(a=200*r-100*s+(s+1)*(100-n)+2*s*i,a=a>0?s:0):-100===n&&(a=o),f[r]=a>s?s:a<0?0:a;return f}function a(e){if(t(e)||!e.pixels?.length)return null;e.statistics||e.updateStatistics();const{pixels:n,mask:i,pixelType:s,statistics:o}=e,r=e.width*e.height,a=n.length;let f,l,u,m,c;const h=[],g=[];let x,p,M,d,b,O,y,C,z,A;const k=256;for(m=0;m<a;m++){if(x=new Uint32Array(k),M=n[m],"u8"===s)if(f=-.5,l=255.5,i)for(c=0;c<r;c++)i[c]&&x[M[c]]++;else for(c=0;c<r;c++)x[M[c]]++;else{if(f=o[m].minValue,l=o[m].maxValue,u=(l-f)/k,p=new Uint32Array(k+1),i)for(c=0;c<r;c++)i[c]&&p[Math.floor((M[c]-f)/u)]++;else for(c=0;c<r;c++)p[Math.floor((M[c]-f)/u)]++;for(c=0;c<255;c++)x[c]=p[c];x[255]=p[255]+p[256]}for(h.push({min:f,max:l,size:k,counts:x}),d=0,b=0,C=0,c=0;c<k;c++)d+=x[c],b+=c*x[c];for(z=b/d,c=0;c<k;c++)C+=x[c]*(c-z)**2;A=Math.sqrt(C/(d-1)),u=(l-f)/k,O=(z+.5)*u+f,y=A*u,g.push({min:f,max:l,avg:O,stddev:y})}return{statistics:g,histograms:h}}function f(t){const e=[];for(let n=0;n<t.length;n++){const{min:i,max:s,size:o,counts:r}=t[n];let a=0,f=0;for(let t=0;t<o;t++)a+=r[t],f+=t*r[t];const l=f/a;let u=0;for(let t=0;t<o;t++)u+=r[t]*(t-l)**2;const m=(s-i)/o,c=(l+.5)*m+i,h=Math.sqrt(u/(a-1))*m;e.push({min:i,max:s,avg:c,stddev:h})}return e}function l(t,o){const{pixelBlock:r,bandIds:f,returnHistogramLut:l,rasterInfo:m}=o;let c,h,g=t.stretchType;if(t.dra)if("minMax"===g&&e(r)&&r.statistics)c=r.statistics.map((t=>[t.minValue,t.maxValue,0,0]));else{const t=a(r);c=e(t)?t.statistics:null,h=e(t)?t.histograms:null}else c=t.statistics?.length>0?t.statistics:n(m.statistics),h=t.histograms||n(m.histograms);"percentClip"!==g&&"histogramEqualization"!==g||h?.length||(g="minMax");const x=c?.length||h?.length||m.bandCount,p=[],M=[];let d,b,O,y,C,z,A,k,v,w,U,L;switch(c&&!Array.isArray(c[0])&&(c=c.map((t=>[t.min,t.max,t.avg,t.stddev]))),g){case"none":{const t=i[m.pixelType]||i.f32;for(k=0;k<x;k++)p[k]=t[0],M[k]=t[1]}break;case"minMax":for(k=0;k<x;k++)p[k]=c[k][0],M[k]=c[k][1];break;case"standardDeviation":for(k=0;k<x;k++)p[k]=c[k][2]-t.numberOfStandardDeviations*c[k][3],M[k]=c[k][2]+t.numberOfStandardDeviations*c[k][3],p[k]<c[k][0]&&(p[k]=c[k][0]),M[k]>c[k][1]&&(M[k]=c[k][1]);break;case"histogramEqualization":for(k=0;k<x;k++)p[k]=h[k].min,M[k]=h[k].max;break;case"percentClip":for(k=0;k<h.length;k++){for(d=h[k],C=new Uint32Array(d.size),y=[...d.counts],y.length>=20&&(y[0]=y[1]=y[2]=y[y.length-1]=y[y.length-2]=0),O=0,b=(d.max-d.min)/d.size,A=-.5===d.min&&1===b?.5:0,v=0;v<d.size;v++)O+=y[v],C[v]=O;for(z=(t.minPercent||0)*O/100,v=0;v<d.size;v++)if(C[v]>z){p[k]=d.min+b*(v+A);break}for(z=(1-(t.maxPercent||0)/100)*O,v=d.size-2;v>=0;v--)if(C[v]<z){M[k]=d.min+b*(v+2-A);break}}break;default:for(k=0;k<x;k++)p[k]=c[k][0],M[k]=c[k][1]}"histogramEqualization"===g?(U=h[0].size||256,w=0,l&&(L=h.map((t=>s(t))))):(U=t.max||255,w=t.min||0);return u({minCutOff:p,maxCutOff:M,outMax:U,outMin:w,histogramLut:L},f)}function u(t,e){if(null==e||0===e.length)return t;const n=Math.max.apply(null,e),{minCutOff:i,maxCutOff:s,outMin:o,outMax:r,histogramLut:a}=t;return i.length===e.length||i.length<=n?t:{minCutOff:e.map((t=>i[t])),maxCutOff:e.map((t=>s[t])),histogramLut:a?e.map((t=>a[t])):null,outMin:o,outMax:r}}function m(e,n){if(t(e)||!e.pixels?.length)return e;const i=e.clone(),{pixels:s,mask:o}=i,{minCutOff:r,maxCutOff:a,gamma:f}=n,l=n.outMin||0,u=n.outMax||255,m=i.width*i.height,c=s.length;let h,g,x,p,M;const d=u-l,b=[],O=[];for(h=0;h<c;h++)O[h]=a[h]-r[h],b[h]=d/(a[h]-r[h]);const y=f&&f.length>=c,C=[];if(y)for(h=0;h<c;h++)f[h]>1?f[h]>2?C[h]=6.5+(f[h]-2)**2.5:C[h]=6.5+100*(2-f[h])**4:C[h]=1;if(y)if(null!=o){for(g=0;g<m;g++)if(o[g])for(h=0;h<c;h++)x=s[h][g],M=(x-r[h])/O[h],p=1,f[h]>1&&(p-=(1/d)**(M*C[h])),x<a[h]&&x>r[h]?s[h][g]=Math.floor(p*d*M**(1/f[h]))+l:x>=a[h]?s[h][g]=u:s[h][g]=l}else for(g=0;g<m;g++)for(h=0;h<c;h++)x=s[h][g],M=(x-r[h])/O[h],p=1,f[h]>1&&(p-=(1/d)**(M*C[h])),x<a[h]&&x>r[h]?s[h][g]=Math.floor(p*d*M**(1/f[h]))+l:x>=a[h]?s[h][g]=u:s[h][g]=l;else if(null!=o){for(g=0;g<m;g++)if(o[g])for(h=0;h<c;h++)x=s[h][g],x<a[h]&&x>r[h]?s[h][g]=Math.floor((x-r[h])/O[h]*d)+l:x>=a[h]?s[h][g]=u:s[h][g]=l}else for(g=0;g<m;g++)for(h=0;h<c;h++)x=s[h][g],x<a[h]&&x>r[h]?s[h][g]=Math.floor((x-r[h])/O[h]*d)+l:x>=a[h]?s[h][g]=u:s[h][g]=l;return i.pixelType="u8",i.updateStatistics(),i}export{r as createContrastBrightnessLUT,s as createHistogramEqualizationLUT,o as createStretchLUT,f as estimateStatisticsFromHistograms,a as estimateStatisticsHistograms,l as getStretchCutoff,m as stretch};