@arcgis/core 4.33.0-next.20250514 → 4.33.0-next.20250516

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 (474) hide show
  1. package/Basemap.js +1 -1
  2. package/Graphic.js +1 -1
  3. package/Map.js +1 -1
  4. package/WebScene.js +1 -1
  5. package/applications/Components/SelectionOperation.js +1 -1
  6. package/applications/Components/baUtils.js +1 -1
  7. package/arcade/functions/featuresetbase.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/009730713ed9bc7c7388.js +1 -0
  10. package/assets/esri/core/workers/chunks/02853ab923245459b32e.js +1 -0
  11. package/assets/esri/core/workers/chunks/0624ae07d3af8d5f1ac8.js +1 -0
  12. package/assets/esri/core/workers/chunks/{6e8c6c9112ecb867b7be.js → 0817ddd885ce8b2459cb.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{69e8aabe5a1eb2d1e414.js → 0832bd5195b5791dd803.js} +1 -1
  14. package/assets/esri/core/workers/chunks/0c50ee1f3cdd30d96479.js +1 -0
  15. package/assets/esri/core/workers/chunks/0d23610475c85385fbff.js +1 -0
  16. package/assets/esri/core/workers/chunks/{b4f38fe9cc948a39ad87.js → 0fd6d80393722132e044.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{b4f38fe9cc948a39ad87.js.LICENSE.txt → 0fd6d80393722132e044.js.LICENSE.txt} +1 -1
  18. package/assets/esri/core/workers/chunks/1051a5a57b2fb843a555.js +1 -0
  19. package/assets/esri/core/workers/chunks/133e4bde346828d4510b.js +1 -0
  20. package/assets/esri/core/workers/chunks/19a58adc75a34f84b0ef.js +1 -0
  21. package/assets/esri/core/workers/chunks/{7e8f78b96d43c224c7b6.js → 19c50f052eba0553bf4d.js} +1 -1
  22. package/assets/esri/core/workers/chunks/1d7f2abfccc54659d6f2.js +1 -0
  23. package/assets/esri/core/workers/chunks/{339e7a900e2bba9d3647.js → 1f19bd3ef795c6765384.js} +1 -1
  24. package/assets/esri/core/workers/chunks/1f9c6fbcd4d0eae1e574.js +1 -0
  25. package/assets/esri/core/workers/chunks/234117cc5cb7c6863313.js +1 -0
  26. package/assets/esri/core/workers/chunks/{1c025beaaac5ec7c04fb.js → 2adf558cd8d8155d07d7.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{837f886f759fc6f0489d.js → 2b1486a466760d2152f5.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{47f64a340b5d56bf9e59.js → 2cf82d3645c75d311e99.js} +1 -1
  29. package/assets/esri/core/workers/chunks/320e821af81138fe12ac.js +1 -0
  30. package/assets/esri/core/workers/chunks/{f7ab3511f6627f467796.js → 377a7f0f7d304ff9fe5b.js} +1 -1
  31. package/assets/esri/core/workers/chunks/3bf1cf6c3cba172e2f6d.js +1 -0
  32. package/assets/esri/core/workers/chunks/{b3ca65d6112079fb1d00.js → 3ce5d7ad16e41eea05be.js} +1 -1
  33. package/assets/esri/core/workers/chunks/465f2db4ab8aa9c9f907.js +1 -0
  34. package/assets/esri/core/workers/chunks/{1e13e03aad422f9e871e.js → 47fe2379f2214bf50036.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{b8b5dfd2d73a8410fba2.js → 4954e0cf4a40e45d237f.js} +1 -1
  36. package/assets/esri/core/workers/chunks/4a362a35bcdb8405a53a.js +1 -0
  37. package/assets/esri/core/workers/chunks/4f8ebd9f0758b801835c.js +1 -0
  38. package/assets/esri/core/workers/chunks/5228d39c05d660a135b6.js +1 -0
  39. package/assets/esri/core/workers/chunks/523046e04679e301797d.js +1 -0
  40. package/assets/esri/core/workers/chunks/{736cb9f74bf050b70f4c.js → 52a3d0e041717da7697e.js} +1 -1
  41. package/assets/esri/core/workers/chunks/54ea93f416ab52b413c1.js +1 -0
  42. package/assets/esri/core/workers/chunks/554a8bf4626336e68798.js +1 -0
  43. package/assets/esri/core/workers/chunks/55f087bca75c3f2a4515.js +1 -0
  44. package/assets/esri/core/workers/chunks/{bbaadce582df7e20397b.js → 56d2a20c1b143697aa19.js} +1 -1
  45. package/assets/esri/core/workers/chunks/57211c35a9646f088d86.js +1 -0
  46. package/assets/esri/core/workers/chunks/58526def64536b6581ab.js +1 -0
  47. package/assets/esri/core/workers/chunks/5890740d5a761b038560.js +1 -0
  48. package/assets/esri/core/workers/chunks/{9a641fb94819574e48f6.js → 5a73d8b7b01758ed4fdd.js} +1 -1
  49. package/assets/esri/core/workers/chunks/5dbd8d81d94cfda5bb32.js +1 -0
  50. package/assets/esri/core/workers/chunks/{a0d2bd5d4ed3c90f6b1c.js → 5f766bcb751d66fbf1c8.js} +1 -1
  51. package/assets/esri/core/workers/chunks/609c7c9b7046b3a7acde.js +1 -0
  52. package/assets/esri/core/workers/chunks/{d21d9e8b8c8a2e0485d5.js → 612f6739c9399fbae4d0.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{30f3014c0ac6e2bc14bf.js → 622c0552ca3cd674d46c.js} +1 -1
  54. package/assets/esri/core/workers/chunks/6409160d226a0bea5ac6.js +1 -0
  55. package/assets/esri/core/workers/chunks/65fd971d0574d69cbc26.js +1 -0
  56. package/assets/esri/core/workers/chunks/6993a59cbb78bc26f029.js +1 -0
  57. package/assets/esri/core/workers/chunks/6b23ca6570357f9fb724.js +1 -0
  58. package/assets/esri/core/workers/chunks/6c37a5bd00d255d1337a.js +1 -0
  59. package/assets/esri/core/workers/chunks/6ce4327f63e6eb92bba8.js +1 -0
  60. package/assets/esri/core/workers/chunks/6f9b8df290b0ce09beae.js +1 -0
  61. package/assets/esri/core/workers/chunks/{e0247252c6a0f3340e33.js → 6fa1a5b7276a037dbd6a.js} +84 -106
  62. package/assets/esri/core/workers/chunks/7a9a0383f27f4967bcfa.js +1 -0
  63. package/assets/esri/core/workers/chunks/7c819b3e6d69c526f4b2.js +1 -0
  64. package/assets/esri/core/workers/chunks/7df147da40474b028705.js +1 -0
  65. package/assets/esri/core/workers/chunks/{0766ecb677d667e5fb83.js → 7e1dc8e5e18f18dd21e2.js} +2 -2
  66. package/assets/esri/core/workers/chunks/{0766ecb677d667e5fb83.js.LICENSE.txt → 7e1dc8e5e18f18dd21e2.js.LICENSE.txt} +1 -1
  67. package/assets/esri/core/workers/chunks/{e662c86b8bafc5512d3d.js → 847e88e1d6da1e74cdc8.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{6f5ec9bf7cf8a36d8e8b.js → 87eca6de502d18d8b7eb.js} +1 -1
  69. package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.js +1 -0
  70. package/assets/esri/core/workers/chunks/{10e6dffa57aa1a626708.js → 8a6aac37b3133de74cce.js} +1 -1
  71. package/assets/esri/core/workers/chunks/8a87c181b85d0b86b9bb.js.LICENSE.txt +1 -1
  72. package/assets/esri/core/workers/chunks/91cd29f53f07bc38fe75.js +1 -0
  73. package/assets/esri/core/workers/chunks/{5583d18032ed8bc17c74.js → 938f1eebc48871be64e9.js} +1 -1
  74. package/assets/esri/core/workers/chunks/97c148adf0347c69a79c.js +1 -0
  75. package/assets/esri/core/workers/chunks/9839309d0cd804fe52c2.js +1 -0
  76. package/assets/esri/core/workers/chunks/{029a118e6dfb3f544a5c.js → 98ef17d15517368d2383.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{c10885b3a0739708e9e0.js → 9a06476b834584d00d5c.js} +1 -1
  78. package/assets/esri/core/workers/chunks/9c8224ca29475556e5ea.js +1 -0
  79. package/assets/esri/core/workers/chunks/{fd24dd602a3fed88d90e.js → 9d5eac3bd1526e2b33e3.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{38f5e6a202ce292edd9f.js → 9eb9c8db2510154c09cc.js} +1 -1
  81. package/assets/esri/core/workers/chunks/a036503087baa1f9fd00.js +1 -0
  82. package/assets/esri/core/workers/chunks/{6e64ce0958c3432004b6.js → a70a86ba4e487f62f683.js} +2 -2
  83. package/assets/esri/core/workers/chunks/a937076d2f8c2b6a5d8a.js +1 -0
  84. package/assets/esri/core/workers/chunks/{90ae15ce22a49bd84876.js → ab9614555a15f04396f6.js} +2 -2
  85. package/assets/esri/core/workers/chunks/{90ae15ce22a49bd84876.js.LICENSE.txt → ab9614555a15f04396f6.js.LICENSE.txt} +1 -1
  86. package/assets/esri/core/workers/chunks/ae733c963d61065faa54.js +1 -0
  87. package/assets/esri/core/workers/chunks/{8e82acd1f730571680f4.js → aeb5bbe861f65544d504.js} +1 -1
  88. package/assets/esri/core/workers/chunks/b0522dffa5600345c07e.js +1 -0
  89. package/assets/esri/core/workers/chunks/{d1f7bfb8daf11ecada9f.js → b4273381dc069f4e1fa2.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{fb2e28e6a87956267d1c.js → b92a34f88569c481ed10.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{352b7dcd1633e0c98194.js → ba940ebdae84b174a7be.js} +1 -1
  92. package/assets/esri/core/workers/chunks/be2c8c0a8b2bce7979b6.js +1 -0
  93. package/assets/esri/core/workers/chunks/bf9b6b74654d303a6dae.js +1 -0
  94. package/assets/esri/core/workers/chunks/c07c1bb7ae09136dc1f6.js +1 -0
  95. package/assets/esri/core/workers/chunks/c938f5d269ba202d10ef.js +1 -0
  96. package/assets/esri/core/workers/chunks/cbbca011f8b176d4b5db.js +1 -0
  97. package/assets/esri/core/workers/chunks/{c604fefedccfd4db9953.js → ce321fd8fc5551e190ec.js} +1 -1
  98. package/assets/esri/core/workers/chunks/ce53ddda04e09ba2f860.js +1 -0
  99. package/assets/esri/core/workers/chunks/d9a23fb0c6c936d5e8ec.js +1 -0
  100. package/assets/esri/core/workers/chunks/db3f710d770adf631b28.js +2 -0
  101. package/assets/esri/core/workers/chunks/{6394ab6f629aa90292e6.js.LICENSE.txt → db3f710d770adf631b28.js.LICENSE.txt} +1 -1
  102. package/assets/esri/core/workers/chunks/{6805e7b43d6ecf3ea93c.js → dcf5719f38ad40b92941.js} +1 -1
  103. package/assets/esri/core/workers/chunks/e2cada6644c49b1b6e79.js +1 -0
  104. package/assets/esri/core/workers/chunks/e2fb4bebce3aee406efa.js +1 -0
  105. package/assets/esri/core/workers/chunks/e3638f9d4c0fda238f4b.js +1 -0
  106. package/assets/esri/core/workers/chunks/e85f892ea44d67d53ff0.js +2 -0
  107. package/assets/esri/core/workers/chunks/{3596540ef49e5330ceb2.js.LICENSE.txt → e85f892ea44d67d53ff0.js.LICENSE.txt} +1 -1
  108. package/assets/esri/core/workers/chunks/e89345c7af9d3d4d8452.js +1 -0
  109. package/assets/esri/core/workers/chunks/{a31658f544ac6e1801d6.js → ead5d4e271effc04def3.js} +1 -1
  110. package/assets/esri/core/workers/chunks/ece68a25651ef03fc95d.js +1 -0
  111. package/assets/esri/core/workers/chunks/f218a190015de1444018.js +1 -0
  112. package/assets/esri/core/workers/chunks/f229044615af3142bcb0.js +1 -0
  113. package/assets/esri/core/workers/chunks/f2692f25ef693cf12ce0.js +1 -0
  114. package/assets/esri/core/workers/chunks/f4c6ea630cecf0f260d7.js +2 -0
  115. package/assets/esri/core/workers/chunks/{e0dc8794343c2a949ffb.js.LICENSE.txt → f4c6ea630cecf0f260d7.js.LICENSE.txt} +1 -1
  116. package/assets/esri/core/workers/chunks/f718cb847c4eb1e43ad9.js +1 -0
  117. package/assets/esri/core/workers/chunks/faa40ef04604c7cce706.js +1 -0
  118. package/assets/esri/core/workers/chunks/{218a66d53f7cf4f285aa.js → fbd2f45d5adce4ca323f.js} +2 -2
  119. package/assets/esri/core/workers/chunks/{218a66d53f7cf4f285aa.js.LICENSE.txt → fbd2f45d5adce4ca323f.js.LICENSE.txt} +1 -1
  120. package/assets/esri/core/workers/chunks/{498886c321a2501658bc.js → ffaa977cd97a2b7190c5.js} +1 -1
  121. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  122. package/assets/esri/themes/base/widgets/_Editor.scss +2 -1
  123. package/assets/esri/themes/base/widgets/_SearchResultRenderer.scss +5 -30
  124. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +5 -0
  125. package/assets/esri/themes/dark/main.css +1 -1
  126. package/assets/esri/themes/light/main.css +1 -1
  127. package/assets/esri/themes/light/view.css +1 -1
  128. package/assets/esri/widgets/Search/t9n/Search.json +1 -1
  129. package/assets/esri/widgets/Search/t9n/Search_en.json +1 -1
  130. package/chunks/Envelope.js +1 -1
  131. package/chunks/Jpg.js +1 -1
  132. package/chunks/LineSeries.js +1 -1
  133. package/chunks/ProjectionTransformation.js +1 -1
  134. package/chunks/QuadraticBezier.js +1 -1
  135. package/chunks/ShadowCastAccumulate.glsl.js +7 -5
  136. package/chunks/ShadowCastClear.glsl.js +5 -0
  137. package/chunks/ShadowCastVisualize.glsl.js +1 -1
  138. package/chunks/ShadowHighlight.glsl.js +8 -7
  139. package/chunks/Transformation2D.js +1 -1
  140. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  141. package/chunks/arcgis-knowledge-client-core.js +1 -1
  142. package/chunks/basis_encoder.js +1 -1
  143. package/chunks/basis_transcoder.js +1 -1
  144. package/chunks/bundle.js +1 -1
  145. package/chunks/chartUtilsAm5.js +1 -1
  146. package/chunks/dxt_encoder.js +1 -1
  147. package/chunks/geometryEngineBase.js +1 -1
  148. package/chunks/i3s.js +1 -1
  149. package/chunks/lclayout.js +1 -1
  150. package/chunks/libtess-asm.js +1 -1
  151. package/chunks/lyr3DMain.js +1 -1
  152. package/chunks/lyr3DWorker.js +1 -1
  153. package/chunks/vec4.js +1 -1
  154. package/chunks/vxlLayer.js +1 -1
  155. package/config.js +1 -1
  156. package/core/arrayUtils.js +1 -1
  157. package/core/image/apng.js +1 -1
  158. package/core/image/gif.js +1 -1
  159. package/core/mathUtils.js +1 -1
  160. package/core/workers/Connection.js +1 -1
  161. package/geometry/operators/densifyOperator.d.ts +0 -1
  162. package/geometry/operators/gx/operatorOffset.js +1 -1
  163. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  164. package/geometry/support/aaBoundingBox.js +1 -1
  165. package/geometry/support/meshProperties.js +1 -1
  166. package/geometry/support/normalizeUtilsSync.js +1 -1
  167. package/interfaces.d.ts +313 -163
  168. package/intl/date.js +1 -1
  169. package/intl/number.js +1 -1
  170. package/layers/BingMapsLayer.js +1 -1
  171. package/layers/graphics/OptimizedFeatureSet.js +1 -1
  172. package/layers/graphics/controllers/StreamController.js +1 -1
  173. package/layers/graphics/data/FeatureIdInfo.js +5 -0
  174. package/layers/graphics/data/QueryEngine.js +1 -1
  175. package/layers/graphics/data/StreamFeatureManager.js +1 -1
  176. package/layers/graphics/data/createFeatureId.js +5 -0
  177. package/layers/graphics/featureConversionUtils.js +1 -1
  178. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  179. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  180. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  181. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  182. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  183. package/layers/ogc/ogcFeatureUtils.js +1 -1
  184. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  185. package/layers/orientedImagery/core/utils.js +1 -1
  186. package/layers/orientedImagery/queries.js +1 -1
  187. package/layers/orientedImagery/transformations/utils.js +1 -1
  188. package/layers/support/LercWorker.js +1 -1
  189. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  190. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  191. package/layers/support/rasterFunctions/stretchUtils.js +1 -1
  192. package/layers/support/wmsUtils.js +1 -1
  193. package/layers/video/VideoController.js +1 -1
  194. package/package.json +2 -2
  195. package/portal/Portal.js +1 -1
  196. package/request.js +1 -1
  197. package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +1 -1
  198. package/rest/knowledgeGraph/GraphAddPropertyResult.js +5 -0
  199. package/rest/knowledgeGraph/GraphApplyEditsResult.js +1 -1
  200. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
  201. package/rest/knowledgeGraph/GraphDeletePropertyResult.js +5 -0
  202. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.js +5 -0
  203. package/rest/knowledgeGraph/GraphUpdatePropertyResult.js +5 -0
  204. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  205. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  206. package/rest/knowledgeGraphService.js +1 -1
  207. package/rest/networks/support/Association.js +1 -1
  208. package/rest/networks/support/NetworkElement.js +1 -1
  209. package/rest/networks/support/QueryAssociationsParameters.js +1 -1
  210. package/rest/networks/support/TelecomNetworkElement.js +1 -1
  211. package/rest/networks/support/TraceResult.js +1 -1
  212. package/rest/networks/unitIdentifiers/insertGap.js +5 -0
  213. package/rest/networks/unitIdentifiers/queryUnitIdentifiers.js +5 -0
  214. package/rest/networks/unitIdentifiers/reset.js +5 -0
  215. package/rest/networks/unitIdentifiers/resize.js +5 -0
  216. package/rest/networks/unitIdentifiers/support/InsertGapParameters.js +5 -0
  217. package/rest/networks/unitIdentifiers/support/QueryUnitIdentifiersParamters.js +5 -0
  218. package/rest/networks/unitIdentifiers/support/ResetParameters.js +5 -0
  219. package/rest/networks/unitIdentifiers/support/ResizeParameters.js +5 -0
  220. package/rest/networks/unitIdentifiers/support/UnitQueryResult.js +5 -0
  221. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  222. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  223. package/rest/query/operations/queryRelatedRecords.js +1 -1
  224. package/rest/utils.js +1 -1
  225. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  226. package/support/apiKeyUtils.js +1 -1
  227. package/support/basemapEnsureType.js +1 -1
  228. package/support/revision.js +1 -1
  229. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  230. package/unionTypes.d.ts +2 -0
  231. package/views/2d/engine/ManagedCanvas.js +1 -1
  232. package/views/2d/engine/Stage.js +1 -1
  233. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  234. package/views/2d/engine/webgl/TileContainer.js +1 -1
  235. package/views/2d/engine/webgl/grouping.js +1 -1
  236. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  237. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  238. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  239. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  240. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  241. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  242. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  243. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  244. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  245. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  246. package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
  247. package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
  248. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  249. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  250. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  251. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  252. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  253. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  254. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  255. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  256. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  257. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  258. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  259. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  260. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  261. package/views/3d/FocusAreasView.js +1 -1
  262. package/views/3d/analysis/AnalysisViewManager3D.js +1 -1
  263. package/views/3d/analysis/DimensionAnalysisView3D.d.ts +4 -0
  264. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  265. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  266. package/views/3d/camera/constraintUtils/common.js +1 -1
  267. package/views/3d/interactive/Manipulator3D.js +1 -1
  268. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  269. package/views/3d/layers/ContentGeometryLayerView.js +5 -0
  270. package/views/3d/layers/DimensionLayerView3D.js +1 -1
  271. package/views/3d/layers/FlowSubView3D.js +1 -1
  272. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  273. package/views/3d/layers/I3SMeshView3D.js +1 -1
  274. package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
  275. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  276. package/views/3d/layers/RouteLayerView3D.js +1 -1
  277. package/views/3d/layers/ViewshedLayerView3D.js +1 -1
  278. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  279. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  280. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  281. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  282. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  283. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  284. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  285. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  286. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  287. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  288. package/views/3d/layers/graphics/Labeler.js +1 -1
  289. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  290. package/views/3d/layers/graphics/focusAreaStyle.js +5 -0
  291. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  292. package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
  293. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  294. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  295. package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
  296. package/views/3d/layers/i3s/PagedNodeIndex.js +1 -1
  297. package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
  298. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  299. package/views/3d/layers/support/LayerViewAnalysisViewManager.js +5 -0
  300. package/views/3d/support/pointsOfInterest/ContentGeometryUpdates.js +1 -1
  301. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  302. package/views/3d/terrain/PatchRenderData.js +1 -1
  303. package/views/3d/terrain/TerrainRenderer.js +1 -1
  304. package/views/3d/terrain/TerrainSurface.js +1 -1
  305. package/views/3d/terrain/TileAgent.js +1 -1
  306. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +1 -1
  307. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  308. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +3 -3
  309. package/views/3d/webgl-engine/core/shaderLibrary/shading/ShadowmapFiltering.glsl.js +3 -25
  310. package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadow.glsl.js +1 -1
  311. package/views/3d/webgl-engine/core/shaderModules/Texture2DShadowBindUniform.js +5 -0
  312. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  313. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +3 -3
  314. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  315. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  316. package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
  317. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  318. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  319. package/views/3d/webgl-engine/lib/Material.js +1 -1
  320. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  321. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  322. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  323. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  324. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  325. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  326. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  327. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  328. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  329. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  330. package/views/3d/webgl-engine/shaders/ShadowCastClear.glsl.js +5 -0
  331. package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +5 -0
  332. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  333. package/views/3d/webgl.js +1 -1
  334. package/views/FocusArea.js +1 -1
  335. package/views/FocusAreas.js +1 -1
  336. package/views/GroundView.js +1 -1
  337. package/views/SceneView.js +1 -1
  338. package/views/View.js +1 -1
  339. package/views/draw/support/Box.js +1 -1
  340. package/views/draw/support/GraphicMover.js +1 -1
  341. package/views/draw/support/Reshape.js +1 -1
  342. package/views/input/InputManager.js +1 -1
  343. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  344. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  345. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  346. package/views/layers/FeatureLayerView.js +1 -1
  347. package/views/support/LayerViewManager.js +1 -1
  348. package/views/webgl/RenderingContext.js +1 -1
  349. package/views/webgl/ShaderBuilder.js +1 -1
  350. package/views/webgl/Texture.js +1 -1
  351. package/views/webgl/TextureDescriptor.js +1 -1
  352. package/views/webgl/textureUtils.js +1 -1
  353. package/webscene/Slide.js +1 -1
  354. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  355. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  356. package/widgets/BatchAttributeForm/VisibleElements.js +1 -1
  357. package/widgets/BatchAttributeForm.js +1 -1
  358. package/widgets/CoordinateConversion.js +1 -1
  359. package/widgets/Directions.js +1 -1
  360. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  361. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  362. package/widgets/Editor/EditorViewModel.js +1 -1
  363. package/widgets/Editor/UpdateFeaturesWorkflow.d.ts +4 -0
  364. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  365. package/widgets/Editor/UpdateFeaturesWorkflowData.d.ts +4 -0
  366. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  367. package/widgets/Editor/UpdateWorkflow.js +1 -1
  368. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  369. package/widgets/Editor/support/SketchController.js +1 -1
  370. package/widgets/Editor/workflowUtils.js +1 -1
  371. package/widgets/Editor.js +1 -1
  372. package/widgets/ElevationProfile/support/profileUtils.js +1 -1
  373. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  374. package/widgets/FeatureForm.js +1 -1
  375. package/widgets/LayerList/LayerListItem.js +1 -1
  376. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  377. package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
  378. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  379. package/widgets/OrientedImageryViewer/components/NavigationUI.js +1 -1
  380. package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +5 -0
  381. package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +1 -1
  382. package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +1 -1
  383. package/widgets/OrientedImageryViewer/constants.js +1 -1
  384. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +5 -0
  385. package/widgets/OrientedImageryViewer/navigation/NavigationManagerPanoramic.js +5 -0
  386. package/widgets/OrientedImageryViewer/navigation/errors.js +5 -0
  387. package/widgets/OrientedImageryViewer/navigation/queries.js +5 -0
  388. package/widgets/OrientedImageryViewer/navigation/utils.js +5 -0
  389. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  390. package/widgets/PanoramicViewer.js +1 -1
  391. package/widgets/Search/SearchResultRenderer.js +1 -1
  392. package/widgets/Search/SearchViewModel.js +1 -1
  393. package/widgets/Search/searchResultRendererCSS.js +1 -1
  394. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  395. package/widgets/Sketch/SketchViewModel.js +1 -1
  396. package/widgets/Sketch.js +1 -1
  397. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  398. package/widgets/support/SelectionList/selectionListUtils.js +1 -1
  399. package/widgets/support/SelectionList.js +1 -1
  400. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  401. package/widgets/support/SelectionToolbar.js +1 -1
  402. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  403. package/widgets/support/SnappingControls.js +1 -1
  404. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  405. package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
  406. package/assets/esri/core/workers/chunks/0516bd18334d3af6c555.js +0 -1
  407. package/assets/esri/core/workers/chunks/0d8a635c1f9aeaf7564c.js +0 -1
  408. package/assets/esri/core/workers/chunks/191a45a594ecaf7f1abb.js +0 -1
  409. package/assets/esri/core/workers/chunks/1abd026ed12c863e1d94.js +0 -1
  410. package/assets/esri/core/workers/chunks/1c6542315390037053a6.js +0 -1
  411. package/assets/esri/core/workers/chunks/201db423e3c6f947b77c.js +0 -1
  412. package/assets/esri/core/workers/chunks/23de8aeed5b82c682cbe.js +0 -1
  413. package/assets/esri/core/workers/chunks/297d2c0a9d3f1e978318.js +0 -1
  414. package/assets/esri/core/workers/chunks/2e0af748eba93f3ea6cb.js +0 -1
  415. package/assets/esri/core/workers/chunks/3596540ef49e5330ceb2.js +0 -2
  416. package/assets/esri/core/workers/chunks/3604a77c93cf2927787b.js +0 -1
  417. package/assets/esri/core/workers/chunks/391b1c3e736a62befbaf.js +0 -1
  418. package/assets/esri/core/workers/chunks/40e556a0645af8658658.js +0 -1
  419. package/assets/esri/core/workers/chunks/4402336db7210cd583e0.js +0 -1
  420. package/assets/esri/core/workers/chunks/4899cdc8bb5085c356f9.js +0 -1
  421. package/assets/esri/core/workers/chunks/4bd5cbf6e0be2fc7e84d.js +0 -1
  422. package/assets/esri/core/workers/chunks/4c8052e81916579841f4.js +0 -1
  423. package/assets/esri/core/workers/chunks/4c9aa1dafdc0d9537231.js +0 -1
  424. package/assets/esri/core/workers/chunks/4feb774f123da26e9f2a.js +0 -1
  425. package/assets/esri/core/workers/chunks/51b5dfc7085272d26b89.js +0 -1
  426. package/assets/esri/core/workers/chunks/566c2ce50af225e556ac.js +0 -1
  427. package/assets/esri/core/workers/chunks/5ddf463c85c33428e807.js +0 -1
  428. package/assets/esri/core/workers/chunks/61032b5050464cb48056.js +0 -1
  429. package/assets/esri/core/workers/chunks/6394ab6f629aa90292e6.js +0 -2
  430. package/assets/esri/core/workers/chunks/63dade3e1cc7f5b76846.js +0 -1
  431. package/assets/esri/core/workers/chunks/64af433e88d4dd21a2ff.js +0 -1
  432. package/assets/esri/core/workers/chunks/6b42bcfbb60432e3ed1f.js +0 -1
  433. package/assets/esri/core/workers/chunks/6e12900a9f4c3c9941ec.js +0 -1
  434. package/assets/esri/core/workers/chunks/6e5d8a6b29c06a27998c.js +0 -1
  435. package/assets/esri/core/workers/chunks/6f506303017903b9a06f.js +0 -1
  436. package/assets/esri/core/workers/chunks/71e46e866c23372b0b58.js +0 -1
  437. package/assets/esri/core/workers/chunks/75fa861b5757551f8fdc.js +0 -1
  438. package/assets/esri/core/workers/chunks/7c49a8877bd744daa3d5.js +0 -1
  439. package/assets/esri/core/workers/chunks/7ea5bbb52e84be9a608e.js +0 -1
  440. package/assets/esri/core/workers/chunks/82c395d8649096609a8a.js +0 -1
  441. package/assets/esri/core/workers/chunks/86138c297095af1ac604.js +0 -1
  442. package/assets/esri/core/workers/chunks/8c21cc9af4ce9652cc5c.js +0 -1
  443. package/assets/esri/core/workers/chunks/8e6301006abdf47cc88d.js +0 -1
  444. package/assets/esri/core/workers/chunks/90f93091fe088875f80f.js +0 -1
  445. package/assets/esri/core/workers/chunks/91a02ee91f61cf841111.js +0 -1
  446. package/assets/esri/core/workers/chunks/9baeb3b5733acdda4e7c.js +0 -1
  447. package/assets/esri/core/workers/chunks/a1d697e2be1e892a666a.js +0 -1
  448. package/assets/esri/core/workers/chunks/a1f27c4f4b5ef3e359f7.js +0 -1
  449. package/assets/esri/core/workers/chunks/a348ff2dd936c6bf9399.js +0 -1
  450. package/assets/esri/core/workers/chunks/a9b1f4bf5eaa937943be.js +0 -1
  451. package/assets/esri/core/workers/chunks/b64f708f821dd2bb51cd.js +0 -1
  452. package/assets/esri/core/workers/chunks/bf453744067267e84d1b.js +0 -1
  453. package/assets/esri/core/workers/chunks/c1175477dfcdee90a453.js +0 -1
  454. package/assets/esri/core/workers/chunks/c4e2b75b9135920babc3.js +0 -1
  455. package/assets/esri/core/workers/chunks/cb80b7ddc9acf625d754.js +0 -1
  456. package/assets/esri/core/workers/chunks/d22f91bc16a7641bcbef.js +0 -1
  457. package/assets/esri/core/workers/chunks/d52cf7b795ee52034f9e.js +0 -1
  458. package/assets/esri/core/workers/chunks/d971571a957de70d5a8d.js +0 -1
  459. package/assets/esri/core/workers/chunks/d9d9d4f99140e579eabb.js +0 -1
  460. package/assets/esri/core/workers/chunks/dc3a6beb3028009b3c23.js +0 -1
  461. package/assets/esri/core/workers/chunks/e0dc8794343c2a949ffb.js +0 -2
  462. package/assets/esri/core/workers/chunks/e483d2f169e51a361742.js +0 -1
  463. package/assets/esri/core/workers/chunks/e5608e5232e983531f72.js +0 -1
  464. package/assets/esri/core/workers/chunks/e613df03ceb39e29befa.js +0 -1
  465. package/assets/esri/core/workers/chunks/e697dd4508f02dcfe329.js +0 -1
  466. package/assets/esri/core/workers/chunks/eabfab23246d4a052ea3.js +0 -1
  467. package/assets/esri/core/workers/chunks/ec8e8048b3df2c92008d.js +0 -1
  468. package/assets/esri/core/workers/chunks/ed6d0fea159dea638c2f.js +0 -1
  469. package/assets/esri/core/workers/chunks/f5fcba6ca6f43bf1d65d.js +0 -1
  470. package/assets/esri/core/workers/chunks/f92d76b694ff0cdb212c.js +0 -1
  471. package/chunks/NetworkElement.js +0 -5
  472. package/views/FocusAreasUtils.js +0 -5
  473. package/views/analysis/DimensionAnalysisView.d.ts +0 -4
  474. package/views/analysis/DimensionAnalysisView.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import{clone as r}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as i}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as p}from"../../core/accessorSupport/PropertyOrigin.js";import l from"../../geometry/Extent.js";import y from"../../geometry/Point.js";import u from"../../geometry/Polygon.js";import m from"../../geometry/Polyline.js";import{initializeProjection as d,project as h}from"../../geometry/projection.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as f}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as g}from"../../geometry/support/typeUtils.js";import j from"../Layer.js";import b from"../graphics/data/FeatureStore.js";import{QueryEngine as w}from"../graphics/data/QueryEngine.js";import{createCapabilities as T,createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as S,systemAggregationCountFieldName as v,systemIsSpatialFieldName as O,systemLayoutGeometryFieldName as E,systemOriginIdFieldName as x,systemDestinationIdFieldName as N}from"./constants.js";import{KnowledgeGraphSublayerBase as L}from"./KnowledgeGraphSublayerBase.js";import{getDisplayLabelProperty as F,getLinkChartDefaultLabelingInfo as _,getMapDefaultLabelingInfo as R,getKGSublayerSymbolColor as Q,getDefaultLCRelationshipSublayerSymbol as C}from"./layerUtils.js";import{BlendLayer as M,blendModeProperty as k,effectProperty as J}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as D,displayFilterEnabledProperty as P,displayFilterInfoProperty as q}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as G,featureEffectProperty as U}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as A}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Z,orderByProperty as B}from"../mixins/OrderedLayer.js";import{RefreshableLayer as V}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as K}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as W,useViewTimeProperty as Y}from"../mixins/TemporalLayer.js";import{legendEnabled as z,maxScale as H,minScale as X,opacity as $,popupEnabled as ee}from"../support/commonProperties.js";import{featureReductionProperty as te}from"../support/featureReductionUtils.js";import re from"../support/Field.js";import{fixRendererFields as oe,fixTimeInfoFields as ie}from"../support/fieldUtils.js";import ne from"../support/LabelClass.js";import{reader as se}from"../support/labelingInfo.js";import ae from"../support/TimeInfo.js";import pe from"../../renderers/SimpleRenderer.js";import{fromJSON as le}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ye}from"../../renderers/support/typeUtils.js";import ue from"../../rest/support/FeatureSet.js";import me from"../../rest/support/Query.js";import{createPopupTemplate as de}from"../../support/popupUtils.js";import{applyColorToSymbol as he}from"../../symbols/support/utils.js";import ce from"../../core/workers/RemoteClient.js";function fe(e){if(!e.json)return e;e.json.write=ge(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ge(e.write))}return e}function ge(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=je(e)),e):!0===e?be():e}function je(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=we.call(this,e,t);return r.enabled?{...i,...r}:r}}function be(){return{overridePolicy:we}}function we(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...Te.call(this,e,t)}),o}function Te(e,t){return{ignoreOrigin:this.originIdOf(t)>p.DEFAULTS}}let Ie=class extends(L(D(A(G(M(Z(W(K(V(i(j))))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=T(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=S,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new ce(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=me.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(re.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(re.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),re.fromJSON({name:v,type:"esriFieldTypeInteger",alias:v,editable:!1}),re.fromJSON({name:O,type:"esriFieldTypeInteger",alias:O,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?g.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return E;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");const e=this.objectType.properties?F(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?_(this.graphType,this.graphTypeName,e):R(this.graphTypeName,this.geometryType,e)}set renderer(e){oe(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map((e=>e.name)).indexOf(this.graphTypeName),r=Q(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new pe({type:"simple",symbol:C(r)});const e=le(I(g.toJSON("point")).renderer);return he(e.symbol,r),e}const o=le(I(g.toJSON(this.geometryType)).renderer);return he(o.symbol,r),o}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return de(this,e)}createQuery(){return new me({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=ue.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new l(n.extent):new l,{count:n.count,extent:s}}async queryObjectIds(e,t){await this.load();const r=me.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return await o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new b({geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new w({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new me({where:"1=1",outFields:[S]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then((()=>ie(this.timeInfo,this.fieldsIndex)))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=me.from(e),o=r.geometry;if(o&&!o.spatialReference?.isWGS84&&(await d(o.spatialReference,f),r.geometry=h(o instanceof u||o instanceof m||o instanceof y?o:o.extent,f)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const i=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(i)}}};function Se(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",v],["ESRI__ORIGIN_ID",x],["ESRI__DESTINATION_ID",N],["ESRI__LAYOUT_GEOMETRY",E]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(n){o.getLogger(this).warn("Error updating labelingInfo",n)}return se(e,t,r)}e([n(fe(r(k)))],Ie.prototype,"blendMode",void 0),e([n()],Ie.prototype,"capabilities",void 0),e([n({json:{origins:{"web-scene":{write:!1}},write:be()}})],Ie.prototype,"charts",void 0),e([n({readOnly:!0})],Ie.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ie.prototype,"definitionExpression",void 0),e([n()],Ie.prototype,"displayField",void 0),e([n(fe(r(P)))],Ie.prototype,"displayFilterEnabled",void 0),e([n(fe(r(q)))],Ie.prototype,"displayFilterInfo",void 0),e([n(fe(r(J)))],Ie.prototype,"effect",void 0),e([n()],Ie.prototype,"elevationInfo",void 0),e([n(fe(r(U)))],Ie.prototype,"featureEffect",void 0),e([n(fe(r(te)))],Ie.prototype,"featureReduction",null),e([n()],Ie.prototype,"fields",null),e([n()],Ie.prototype,"geometryType",null),e([n()],Ie.prototype,"geometryFieldName",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphTypeName",null),e([n()],Ie.prototype,"hasM",null),e([n()],Ie.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ie.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ie.prototype,"labelsVisible",void 0),e([n({type:[ne],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:Se,write:be()}})],Ie.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"layerType",void 0),e([n(fe(r(z)))],Ie.prototype,"legendEnabled",void 0),e([n(fe(r(H)))],Ie.prototype,"maxScale",void 0),e([n(fe(r(X)))],Ie.prototype,"minScale",void 0),e([n()],Ie.prototype,"objectIdField",void 0),e([n()],Ie.prototype,"objectType",void 0),e([n(fe(r($)))],Ie.prototype,"opacity",void 0),e([n(fe(r(B)))],Ie.prototype,"orderBy",void 0),e([n({clonable:!1})],Ie.prototype,"parent",void 0),e([n()],Ie.prototype,"parentCompositeLayer",void 0),e([n(fe(r(ee)))],Ie.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ie.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:Te}}})],Ie.prototype,"refreshInterval",void 0),e([n({types:ye,json:{name:"layerDefinition.drawingInfo.renderer",write:be()}})],Ie.prototype,"renderer",null),e([n()],Ie.prototype,"source",void 0),e([n()],Ie.prototype,"spatialReference",null),e([n({type:ae,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],Ie.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"title",null),e([a("title")],Ie.prototype,"writeTitle",null),e([n({json:{read:!1}})],Ie.prototype,"type",void 0),e([n(fe(r(Y)))],Ie.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:be()}})],Ie.prototype,"visible",void 0),Ie=e([s("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ie);export{Ie as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import{clone as r}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as i}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as p}from"../../core/accessorSupport/PropertyOrigin.js";import l from"../../geometry/Extent.js";import y from"../../geometry/Point.js";import u from"../../geometry/Polygon.js";import m from"../../geometry/Polyline.js";import{initializeProjection as d,project as h}from"../../geometry/projection.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as f}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as g}from"../../geometry/support/typeUtils.js";import j from"../Layer.js";import b from"../graphics/data/FeatureStore.js";import{QueryEngine as w}from"../graphics/data/QueryEngine.js";import{createCapabilities as T,createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as S,systemAggregationCountFieldName as v,systemIsSpatialFieldName as O,systemLayoutGeometryFieldName as E,systemOriginIdFieldName as x,systemDestinationIdFieldName as N}from"./constants.js";import{KnowledgeGraphSublayerBase as L}from"./KnowledgeGraphSublayerBase.js";import{getDisplayLabelProperty as F,getLinkChartDefaultLabelingInfo as _,getMapDefaultLabelingInfo as R,getKGSublayerSymbolColor as Q,getDefaultLCRelationshipSublayerSymbol as C}from"./layerUtils.js";import{BlendLayer as M,blendModeProperty as k,effectProperty as J}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as D,displayFilterEnabledProperty as P,displayFilterInfoProperty as q}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as G,featureEffectProperty as U}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as A}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Z,orderByProperty as B}from"../mixins/OrderedLayer.js";import{RefreshableLayer as V}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as K}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as W,useViewTimeProperty as Y}from"../mixins/TemporalLayer.js";import{legendEnabled as z,maxScale as H,minScale as X,opacity as $,popupEnabled as ee}from"../support/commonProperties.js";import{featureReductionProperty as te}from"../support/featureReductionUtils.js";import re from"../support/Field.js";import{fixRendererFields as oe,fixTimeInfoFields as ie}from"../support/fieldUtils.js";import ne from"../support/LabelClass.js";import{reader as se}from"../support/labelingInfo.js";import ae from"../support/TimeInfo.js";import pe from"../../renderers/SimpleRenderer.js";import{fromJSON as le}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ye}from"../../renderers/support/typeUtils.js";import ue from"../../rest/support/FeatureSet.js";import me from"../../rest/support/Query.js";import{createPopupTemplate as de}from"../../support/popupUtils.js";import{applyColorToSymbol as he}from"../../symbols/support/utils.js";import ce from"../../core/workers/RemoteClient.js";function fe(e){if(!e.json)return e;e.json.write=ge(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ge(e.write))}return e}function ge(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=je(e)),e):!0===e?be():e}function je(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=we.call(this,e,t);return r.enabled?{...i,...r}:r}}function be(){return{overridePolicy:we}}function we(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...Te.call(this,e,t)}),o}function Te(e,t){return{ignoreOrigin:this.originIdOf(t)>p.DEFAULTS}}let Ie=class extends(L(D(A(G(M(Z(W(K(V(i(j))))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=T(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=S,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new ce(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=me.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(re.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(re.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),re.fromJSON({name:v,type:"esriFieldTypeInteger",alias:v,editable:!1}),re.fromJSON({name:O,type:"esriFieldTypeInteger",alias:O,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?g.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return E;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");const e=this.objectType.properties?F(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?_(this.graphType,this.graphTypeName,e):R(this.graphTypeName,this.geometryType,e)}set renderer(e){oe(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map((e=>e.name)).indexOf(this.graphTypeName),r=Q(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new pe({type:"simple",symbol:C(r)});const e=le(I(g.toJSON("point")).renderer);return he(e.symbol,r),e}const o=le(I(g.toJSON(this.geometryType)).renderer);return he(o.symbol,r),o}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return de(this,e)}createQuery(){return new me({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=ue.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new l(n.extent):new l,{count:n.count,extent:s}}async queryObjectIds(e,t){await this.load();const r=me.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return await o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new b({geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new w({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new me({where:"1=1",outFields:[S]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then((()=>ie(this.timeInfo,this.fieldsIndex)))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=me.from(e),o=r.geometry;if(o&&!o.spatialReference?.isWGS84&&(await d(o.spatialReference,f),r.geometry=h(o instanceof u||o instanceof m||o instanceof y?o:o.extent,f)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const i=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(i)}}};function Se(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",v],["ESRI__ORIGIN_ID",x],["ESRI__DESTINATION_ID",N],["ESRI__LAYOUT_GEOMETRY",E]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(n){o.getLogger(this).warn("Error updating labelingInfo",n)}return se(e,t,r)}e([n(fe(r(k)))],Ie.prototype,"blendMode",void 0),e([n()],Ie.prototype,"capabilities",void 0),e([n({json:{origins:{"web-scene":{write:!1}},write:be()}})],Ie.prototype,"charts",void 0),e([n({readOnly:!0})],Ie.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ie.prototype,"definitionExpression",void 0),e([n()],Ie.prototype,"displayField",void 0),e([n(fe(r(P)))],Ie.prototype,"displayFilterEnabled",void 0),e([n(fe(r(q)))],Ie.prototype,"displayFilterInfo",void 0),e([n(fe(r(J)))],Ie.prototype,"effect",void 0),e([n()],Ie.prototype,"elevationInfo",void 0),e([n(fe(r(U)))],Ie.prototype,"featureEffect",void 0),e([n(fe(r(te)))],Ie.prototype,"featureReduction",null),e([n()],Ie.prototype,"fields",null),e([n()],Ie.prototype,"geometryType",null),e([n()],Ie.prototype,"geometryFieldName",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphTypeName",null),e([n()],Ie.prototype,"hasM",null),e([n()],Ie.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ie.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ie.prototype,"labelsVisible",void 0),e([n({type:[ne],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:Se,write:be()}})],Ie.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"layerType",void 0),e([n(fe(r(z)))],Ie.prototype,"legendEnabled",void 0),e([n(fe(r(H)))],Ie.prototype,"maxScale",void 0),e([n(fe(r(X)))],Ie.prototype,"minScale",void 0),e([n()],Ie.prototype,"objectIdField",void 0),e([n()],Ie.prototype,"objectType",void 0),e([n(fe(r($)))],Ie.prototype,"opacity",void 0),e([n(fe(r(B)))],Ie.prototype,"orderBy",void 0),e([n({clonable:!1})],Ie.prototype,"parent",void 0),e([n()],Ie.prototype,"parentCompositeLayer",void 0),e([n(fe(r(ee)))],Ie.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ie.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:Te}}})],Ie.prototype,"refreshInterval",void 0),e([n({types:ye,json:{name:"layerDefinition.drawingInfo.renderer",write:be()}})],Ie.prototype,"renderer",null),e([n()],Ie.prototype,"source",void 0),e([n()],Ie.prototype,"spatialReference",null),e([n({type:ae,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],Ie.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"title",null),e([a("title")],Ie.prototype,"writeTitle",null),e([n({json:{read:!1}})],Ie.prototype,"type",void 0),e([n(fe(r(Y)))],Ie.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:be()}})],Ie.prototype,"visible",void 0),Ie=e([s("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ie);export{Ie as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../request.js";import t from"../../core/Error.js";import n from"../../core/Logger.js";import{makeAbsolute as i,addQueryParameters as r,urlToObject as o}from"../../core/urlUtils.js";import s from"../../geometry/SpatialReference.js";import{wgs84 as a}from"../../geometry/support/spatialReferenceUtils.js";import{project as l}from"../../geometry/support/webMercatorUtils.js";import{convertToFeatureSet as c,convertToGeometry as u,convertFromGeometry as d}from"../graphics/featureConversionUtils.js";import f from"../graphics/OptimizedFeatureSet.js";import{validateGeoJSON as m,inferLayerProperties as p,createOptimizedFeatures as g}from"../graphics/sources/geojson/geojson.js";import{createDrawingInfo as y}from"../graphics/sources/support/clientSideDefaults.js";import{mixAttributes as w}from"../graphics/sources/support/sourceUtils.js";import j from"../support/FieldsIndex.js";import{kebabDict as b}from"../support/fieldType.js";import{utc as h}from"../../time/constants.js";const F=()=>n.getLogger("esri.layers.ogc.ogcFeatureUtils"),I="startindex",T=new Set([I,"offset"]),k="http://www.opengis.net/def/crs/",x=`${k}OGC/1.3/CRS84`;var S;async function v(n,o,s={},a=5){const{links:l}=n,c=U(l,"items",S.geojson)||U(l,"http://www.opengis.net/def/rel/ogc/1.0/items",S.geojson);if(null==c)throw new t("ogc-feature-layer:missing-items-page","Missing items url");const{apiKey:u,customParameters:d,signal:f}=s,g=i(c.href,n.landingPage.url),w={limit:a,...d,token:u},T=r(g,w),k={accept:S.geojson},{data:x}=await e(T,{signal:f,headers:k}),v=A(T,a,x.links)??I;m(x);const N=p(x,{geometryType:o.geometryType}),O=o.fields||N.fields||[],P=null!=o.hasZ?o.hasZ:N.hasZ,q=N.geometryType,C=o.objectIdField||N.objectIdFieldName||"OBJECTID";let R=o.timeInfo;const $=O.find((({name:e})=>e===C));if($)$.editable=!1,$.nullable=!1;else{if(!N.objectIdFieldType)throw new t("ogc-feature-layer:missing-feature-id","Collection geojson require a feature id as a unique identifier");O.unshift({name:C,alias:C,type:"number"===N.objectIdFieldType?"esriFieldTypeOID":"esriFieldTypeString",editable:!1,nullable:!1})}if(C!==N.objectIdFieldName){const e=O.find((({name:e})=>e===N.objectIdFieldName));e&&(e.type="esriFieldTypeInteger")}O===N.fields&&N.unknownFields.length>0&&F().warn({name:"ogc-feature-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:N.unknownFields}});for(const e of O){if(null==e.name&&(e.name=e.alias),null==e.alias&&(e.alias=e.name),"esriFieldTypeOID"!==e.type&&"esriFieldTypeGlobalID"!==e.type&&(e.editable=null==e.editable||!!e.editable,e.nullable=null==e.nullable||!!e.nullable),!e.name)throw new t("ogc-feature-layer:invalid-field-name","field name is missing",{field:e});if(!b.jsonValues.includes(e.type))throw new t("ogc-feature-layer:invalid-field-type",`invalid type for field "${e.name}"`,{field:e})}if(R){const e=new j(O);if(R.startTimeField){const t=e.get(R.startTimeField);t?(R.startTimeField=t.name,t.type="esriFieldTypeDate"):R.startTimeField=null}if(R.endTimeField){const t=e.get(R.endTimeField);t?(R.endTimeField=t.name,t.type="esriFieldTypeDate"):R.endTimeField=null}if(R.trackIdField){const t=e.get(R.trackIdField);t?R.trackIdField=t.name:(R.trackIdField=null,F().warn({name:"ogc-feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:R}}))}R.timeReference||={timeZoneIANA:h},R.startTimeField||R.endTimeField||(F().warn({name:"ogc-feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:R}}),R=void 0)}return{drawingInfo:q?y(q):null,extent:L(n),geometryType:q,fields:O,hasZ:!!P,objectIdField:C,paginationParameter:v,timeInfo:R}}async function N(n,r={}){const{links:o,url:s}=n,a=U(o,"data",S.json)||U(o,"http://www.opengis.net/def/rel/ogc/1.0/data",S.json);if(null==a)throw new t("ogc-feature-layer:missing-collections-page","Missing collections url");const{apiKey:l,customParameters:c,signal:u}=r,d=i(a.href,s),{data:f}=await e(d,{signal:u,headers:{accept:S.json},query:{...c,token:l}});for(const e of f.collections)e.landingPage=n;return f}async function O(n,r={}){const{links:o,url:s}=n,a=U(o,"conformance",S.json)||U(o,"http://www.opengis.net/def/rel/ogc/1.0/conformance",S.json);if(null==a)throw new t("ogc-feature-layer:missing-conformance-page","Missing conformance url");const{apiKey:l,customParameters:c,signal:u}=r,d=i(a.href,s),{data:f}=await e(d,{signal:u,headers:{accept:S.json},query:{...c,token:l}});return f}async function P(t,n={}){const{apiKey:i,customParameters:r,signal:o}=n,{data:s}=await e(t,{signal:o,headers:{accept:S.json},query:{...r,token:i}});return s.url=t,s}async function q(t,n={}){const{links:r,url:o}=t,s=U(r,"service-desc",S.openapi);if(null==s)return F().warn("ogc-feature-layer:missing-openapi-page","The OGC API-Features server does not have an OpenAPI page."),null;const{apiKey:a,customParameters:l,signal:c}=n,u=i(s.href,o),{data:d}=await e(u,{signal:c,headers:{accept:S.openapi},query:{...l,token:a}});return d}function C(e){const t=/^http:\/\/www\.opengis.net\/def\/crs\/(?<authority>.*)\/(?<version>.*)\/(?<code>.*)$/i.exec(e),n=t?.groups;if(!n)return null;const{authority:i,code:r}=n;switch(i.toLowerCase()){case"ogc":switch(r.toLowerCase()){case"crs27":return s.GCS_NAD_1927.wkid;case"crs83":return 4269;case"crs84":case"crs84h":return s.WGS84.wkid;default:return null}case"esri":case"epsg":{const e=Number.parseInt(r,10);return Number.isNaN(e)?null:e}default:return null}}async function R(e,t,n){const i=await $(e,t,n);return c(i)}async function $(n,r,o){const{collection:{links:c,landingPage:{url:m}},layerDefinition:p,maxRecordCount:y,queryParameters:{apiKey:b,customParameters:h},spatialReference:F,supportedCrs:I}=n,T=U(c,"items",S.geojson)||U(c,"http://www.opengis.net/def/rel/ogc/1.0/items",S.geojson);if(null==T)throw new t("ogc-feature-layer:missing-items-page","Missing items url");const{geometry:k,num:x,start:v,timeExtent:N,where:O}=r;if(r.objectIds)throw new t("ogc-feature-layer:query-by-objectids-not-supported","Queries with object ids are not supported");const P=s.fromJSON(F),q=r.outSpatialReference??P,C=q.isWGS84?null:W(q,I),R=K(k,I),$=M(N),G=Z(O),D=x??(null==v?y:10),L=0===v?void 0:v,{fields:A,geometryType:J,hasZ:z,objectIdField:E,paginationParameter:_}=p,B=i(T.href,m),{data:Q}=await e(B,{...o,query:{...h,...R,crs:C,datetime:$,query:G,limit:D,[_]:L,token:b},headers:{accept:S.geojson}}),V=g(Q,{geometryType:J,hasZ:z,objectIdField:E}),H=V.length===D&&!!U(Q.links??[],"next",S.geojson),X=new j(A);for(const e of V){const t={};w(X,t,e.attributes,!0);for(const e of X.fields)e.nullable&&!(e.name in t)&&(t[e.name]=null);t[E]=e.attributes[E],e.attributes=t}if(!C&&q.isWebMercator)for(const e of V)if(null!=e.geometry&&null!=J){const t=u(e.geometry,J,z,!1);t.spatialReference=s.WGS84,e.geometry=d(l(t,q))}for(const e of V)e.objectId=e.attributes[E];const Y=C||!C&&q.isWebMercator?q.toJSON():a,ee=new f;return ee.exceededTransferLimit=H,ee.features=V,ee.fields=A,ee.geometryType=J,ee.hasZ=z,ee.objectIdFieldName=E,ee.spatialReference=Y,ee}function G(e){return null!=e&&"extent"===e.type}function W(e,t){const{isWebMercator:n,wkid:i}=e;if(!i)return null;const r=n?t[3857]??t[102100]??t[102113]??t[900913]:t[e.wkid];return r?`${k}${r}`:null}function D(e){if(null==e)return"";const{xmin:t,ymin:n,xmax:i,ymax:r}=e;return`${t},${n},${i},${r}`}function M(e){if(null==e)return null;const{start:t,end:n}=e;return`${null!=t?t.toISOString():".."}/${null!=n?n.toISOString():".."}`}function Z(e){return null!=e&&e&&"1=1"!==e?e:null}function K(e,t){if(!G(e))return null;const{spatialReference:n}=e;if(!n||n.isWGS84)return{bbox:D(e)};const i=W(n,t);return null!=i?{bbox:D(e),"bbox-crs":i}:n.isWebMercator?{bbox:D(l(e,s.WGS84))}:null}function L(e){const t=e.extent?.spatial;if(!t)return null;const n=t.bbox[0],i=4===n.length,[r,o]=n,a=i?void 0:n[2];return{xmin:r,ymin:o,xmax:i?n[2]:n[3],ymax:i?n[3]:n[4],zmin:a,zmax:i?void 0:n[5],spatialReference:s.WGS84.toJSON()}}function U(e,t,n){return e.find((({rel:e,type:i})=>e===t&&i===n))??e.find((({rel:e,type:n})=>e===t&&!n))}function A(e,t,n){if(!n)return;const i=U(n,"next",S.geojson),r=o(i?.href)?.query;if(!r)return;const s=o(e).query,a=Object.keys(s??{}),l=Object.entries(r).filter((([e])=>!a.includes(e))).find((([e,n])=>T.has(e.toLowerCase())&&Number.parseInt(n,10)===t)),c=l?.[0];return c}!function(e){e.json="application/json",e.geojson="application/geo+json",e.openapi="application/vnd.oai.openapi+json;version=3.0"}(S||(S={}));export{x as crsDefault,k as crsPrefix,v as getCollectionDefinition,N as getServerCollections,O as getServerConformance,P as getServerLandingPage,q as getServerOpenApi,C as getSpatialReferenceWkid,R as queryFeatureSetJSON,$ as queryOptimizedFeatureSet};
5
+ import e from"../../request.js";import t from"../../core/Error.js";import n from"../../core/Logger.js";import{makeAbsolute as i,addQueryParameters as r,urlToObject as o}from"../../core/urlUtils.js";import s from"../../geometry/SpatialReference.js";import{wgs84 as a}from"../../geometry/support/spatialReferenceUtils.js";import{project as l}from"../../geometry/support/webMercatorUtils.js";import{convertToFeatureSet as c,convertToGeometry as u,convertFromGeometry as d}from"../graphics/featureConversionUtils.js";import f from"../graphics/OptimizedFeatureSet.js";import{validateGeoJSON as m,inferLayerProperties as p,createOptimizedFeatures as g}from"../graphics/sources/geojson/geojson.js";import{createDrawingInfo as y}from"../graphics/sources/support/clientSideDefaults.js";import{mixAttributes as w}from"../graphics/sources/support/sourceUtils.js";import j from"../support/FieldsIndex.js";import{kebabDict as h}from"../support/fieldType.js";import{utc as b}from"../../time/constants.js";const F=()=>n.getLogger("esri.layers.ogc.ogcFeatureUtils"),I="startindex",T=new Set([I,"offset"]),k="http://www.opengis.net/def/crs/",x=`${k}OGC/1.3/CRS84`;var S;async function v(n,o,s={},a=5){const{links:l}=n,c=U(l,"items",S.geojson)||U(l,"http://www.opengis.net/def/rel/ogc/1.0/items",S.geojson);if(null==c)throw new t("ogc-feature-layer:missing-items-page","Missing items url");const{apiKey:u,customParameters:d,signal:f}=s,g=i(c.href,n.landingPage.url),w={limit:a,...d,token:u},T=r(g,w),k={accept:S.geojson},{data:x}=await e(T,{signal:f,headers:k}),v=A(T,a,x.links)??I;m(x);const O=p(x,{geometryType:o.geometryType}),P=o.fields||O.fields||[],q=null!=o.hasZ?o.hasZ:O.hasZ,N=O.geometryType,C=o.objectIdField||O.objectIdFieldName||"OBJECTID";let R=o.timeInfo;const $=P.find((({name:e})=>e===C));if($)$.editable=!1,$.nullable=!1;else{if(!O.objectIdFieldType)throw new t("ogc-feature-layer:missing-feature-id","Collection geojson require a feature id as a unique identifier");P.unshift({name:C,alias:C,type:"number"===O.objectIdFieldType?"esriFieldTypeOID":"esriFieldTypeString",editable:!1,nullable:!1})}if(C!==O.objectIdFieldName){const e=P.find((({name:e})=>e===O.objectIdFieldName));e&&(e.type="esriFieldTypeInteger")}P===O.fields&&O.unknownFields.length>0&&F().warn({name:"ogc-feature-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:O.unknownFields}});for(const e of P){if(null==e.name&&(e.name=e.alias),null==e.alias&&(e.alias=e.name),"esriFieldTypeOID"!==e.type&&"esriFieldTypeGlobalID"!==e.type&&(e.editable=null==e.editable||!!e.editable,e.nullable=null==e.nullable||!!e.nullable),!e.name)throw new t("ogc-feature-layer:invalid-field-name","field name is missing",{field:e});if(!h.jsonValues.includes(e.type))throw new t("ogc-feature-layer:invalid-field-type",`invalid type for field "${e.name}"`,{field:e})}if(R){const e=new j(P);if(R.startTimeField){const t=e.get(R.startTimeField);t?(R.startTimeField=t.name,t.type="esriFieldTypeDate"):R.startTimeField=null}if(R.endTimeField){const t=e.get(R.endTimeField);t?(R.endTimeField=t.name,t.type="esriFieldTypeDate"):R.endTimeField=null}if(R.trackIdField){const t=e.get(R.trackIdField);t?R.trackIdField=t.name:(R.trackIdField=null,F().warn({name:"ogc-feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:R}}))}R.timeReference||={timeZoneIANA:b},R.startTimeField||R.endTimeField||(F().warn({name:"ogc-feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:R}}),R=void 0)}return{drawingInfo:N?y(N):null,extent:L(n),geometryType:N,fields:P,hasZ:!!q,objectIdField:C,paginationParameter:v,timeInfo:R}}async function O(n,r={}){const{links:o,url:s}=n,a=U(o,"data",S.json)||U(o,"http://www.opengis.net/def/rel/ogc/1.0/data",S.json);if(null==a)throw new t("ogc-feature-layer:missing-collections-page","Missing collections url");const{apiKey:l,customParameters:c,signal:u}=r,d=i(a.href,s),{data:f}=await e(d,{signal:u,headers:{accept:S.json},query:{...c,token:l}});for(const e of f.collections)e.landingPage=n;return f}async function P(n,r={}){const{links:o,url:s}=n,a=U(o,"conformance",S.json)||U(o,"http://www.opengis.net/def/rel/ogc/1.0/conformance",S.json);if(null==a)throw new t("ogc-feature-layer:missing-conformance-page","Missing conformance url");const{apiKey:l,customParameters:c,signal:u}=r,d=i(a.href,s),{data:f}=await e(d,{signal:u,headers:{accept:S.json},query:{...c,token:l}});return f}async function q(t,n={}){const{apiKey:i,customParameters:r,signal:o}=n,{data:s}=await e(t,{signal:o,headers:{accept:S.json},query:{...r,token:i}});return s.url=t,s}async function N(t,n={}){const{links:r,url:o}=t,s=U(r,"service-desc",S.openapi);if(null==s)return F().warn("ogc-feature-layer:missing-openapi-page","The OGC API-Features server does not have an OpenAPI page."),null;const{apiKey:a,customParameters:l,signal:c}=n,u=i(s.href,o),{data:d}=await e(u,{signal:c,headers:{accept:S.openapi},query:{...l,token:a}});return d}function C(e){const t=/^http:\/\/www\.opengis.net\/def\/crs\/(?<authority>.*)\/(?<version>.*)\/(?<code>.*)$/i.exec(e),n=t?.groups;if(!n)return null;const{authority:i,code:r}=n;switch(i.toLowerCase()){case"ogc":switch(r.toLowerCase()){case"crs27":return s.GCS_NAD_1927.wkid;case"crs83":return 4269;case"crs84":case"crs84h":return s.WGS84.wkid;default:return null}case"esri":case"epsg":{const e=Number.parseInt(r,10);return Number.isNaN(e)?null:e}default:return null}}async function R(e,t,n){const i=await $(e,t,n);return c(i)}async function $(n,r,o){const{collection:{links:c,landingPage:{url:m}},layerDefinition:p,maxRecordCount:y,queryParameters:{apiKey:h,customParameters:b},spatialReference:F,supportedCrs:I}=n,T=U(c,"items",S.geojson)||U(c,"http://www.opengis.net/def/rel/ogc/1.0/items",S.geojson);if(null==T)throw new t("ogc-feature-layer:missing-items-page","Missing items url");const{geometry:k,num:x,start:v,timeExtent:O,where:P}=r;if(r.objectIds)throw new t("ogc-feature-layer:query-by-objectids-not-supported","Queries with object ids are not supported");const q=s.fromJSON(F),N=r.outSpatialReference??q,C=N.isWGS84?null:W(N,I),R=K(k,I),$=M(O),G=Z(P),D=x??(null==v?y:10),L=0===v?void 0:v,{fields:A,geometryType:J,hasZ:z,objectIdField:E,paginationParameter:_}=p,B=i(T.href,m),{data:Q}=await e(B,{...o,query:{...b,...R,crs:C,datetime:$,query:G,limit:D,[_]:L,token:h},headers:{accept:S.geojson}}),V=g(Q,{geometryType:J,hasZ:z,objectIdField:E}),H=V.length===D&&!!U(Q.links??[],"next",S.geojson),X=new j(A);for(const e of V){const t={};w(X,t,e.attributes,!0);for(const e of X.fields)e.nullable&&!(e.name in t)&&(t[e.name]=null);t[E]=e.attributes[E],e.attributes=t}if(!C&&N.isWebMercator)for(const e of V)if(null!=e.geometry&&null!=J){const t=u(e.geometry,J,z,!1);t.spatialReference=s.WGS84,e.geometry=d(l(t,N))}for(const e of V)e.objectId=e.attributes[E];const Y=C||!C&&N.isWebMercator?N.toJSON():a,ee=new f;return ee.exceededTransferLimit=H,ee.features=V,ee.fields=A,ee.geometryType=J,ee.hasZ=z,ee.spatialReference=Y,ee}function G(e){return null!=e&&"extent"===e.type}function W(e,t){const{isWebMercator:n,wkid:i}=e;if(!i)return null;const r=n?t[3857]??t[102100]??t[102113]??t[900913]:t[e.wkid];return r?`${k}${r}`:null}function D(e){if(null==e)return"";const{xmin:t,ymin:n,xmax:i,ymax:r}=e;return`${t},${n},${i},${r}`}function M(e){if(null==e)return null;const{start:t,end:n}=e;return`${null!=t?t.toISOString():".."}/${null!=n?n.toISOString():".."}`}function Z(e){return null!=e&&e&&"1=1"!==e?e:null}function K(e,t){if(!G(e))return null;const{spatialReference:n}=e;if(!n||n.isWGS84)return{bbox:D(e)};const i=W(n,t);return null!=i?{bbox:D(e),"bbox-crs":i}:n.isWebMercator?{bbox:D(l(e,s.WGS84))}:null}function L(e){const t=e.extent?.spatial;if(!t)return null;const n=t.bbox[0],i=4===n.length,[r,o]=n,a=i?void 0:n[2];return{xmin:r,ymin:o,xmax:i?n[2]:n[3],ymax:i?n[3]:n[4],zmin:a,zmax:i?void 0:n[5],spatialReference:s.WGS84.toJSON()}}function U(e,t,n){return e.find((({rel:e,type:i})=>e===t&&i===n))??e.find((({rel:e,type:n})=>e===t&&!n))}function A(e,t,n){if(!n)return;const i=U(n,"next",S.geojson),r=o(i?.href)?.query;if(!r)return;const s=o(e).query,a=Object.keys(s??{}),l=Object.entries(r).filter((([e])=>!a.includes(e))).find((([e,n])=>T.has(e.toLowerCase())&&Number.parseInt(n,10)===t)),c=l?.[0];return c}!function(e){e.json="application/json",e.geojson="application/geo+json",e.openapi="application/vnd.oai.openapi+json;version=3.0"}(S||(S={}));export{x as crsDefault,k as crsPrefix,v as getCollectionDefinition,O as getServerCollections,P as getServerConformance,q as getServerLandingPage,N as getServerOpenApi,C as getSpatialReferenceWkid,R as queryFeatureSetJSON,$ as queryOptimizedFeatureSet};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as n}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{a,f as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import c from"../../../geometry/Mesh.js";import s from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectWithZConversion as l}from"../../../geometry/projection.js";import m from"../../../geometry/SpatialReference.js";import{earth as u}from"../../../geometry/support/Ellipsoid.js";import h from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as p}from"../../../geometry/support/MeshVertexAttributes.js";import{create as y,fromArray as g,intersectRay as x}from"../../../geometry/support/plane.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{computeHFOVAndVFOV as w,scaleWithFactor as M,scaleAndAddWithFactor as R,projectiveTransform as j,getWebMercatorScalingFactor as v,createRotationMatrixFromHPR as P,transformMat3 as D}from"../transformations/utils.js";const b=Math.PI/180;function A(e){return e.isSpherical?H(e):I(e)}function I(e){const{horizontalFieldOfView:t,verticalFieldOfView:r,geometry:n,cameraHeading:a}=e,o=v(n.y,n.spatialReference);let i=e.cameraPitch,c=e.cameraRoll??0,s=150;t>150&&(i=90,c=0,s=5);const l=Math.ceil(t/s),m=z(l,a,t);let u=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*b);e.cameraPitch+r/2>=90&&(u=(e.farDistance||20)*o);const h=new f({spatialReference:n?.spatialReference});h.imageID=e.objectId;let p=null;for(const f of m)p=V(f,i,e.cameraHeight,n,u,o,r,t,l,h,c,e.nearDistance);return p.imageID=e.objectId,{polygon:h,frustum:p}}function z(e,t,r){const n=[];if(e%2==0)for(let a=0;a<e/2;a++)n.push(t-r/e*(a+.5),t+r/e*(a+.5));else{n.push(t);for(let a=1;a<e/2;a++)n.push(t-r/e*a,t+r/e*a)}return n.sort(),n}function V(e,i,c,s,f,l,m,u,h,p,y=0,g=0){const x=n(t(),P([e,i,y??0])),d=q({cameraHeight:c,cameraPitch:i,farDistance:f,location:s,horizontalFieldOfView:u,nearDistance:g,verticalFieldOfView:m},x),w=D([0,0,-1],x),{x:j,y:v}=s,A=R([j,v,c],w,f,l),I=2*Math.tan(m*b/2)*f,z=2*Math.tan(u/h*b/2)*f,V=D([0,1,0],x),H=D([1,0,0],x),O=M(V,I/2,l),S=M(H,z/2,l),C=a(r(),O,S),U=o(r(),O,S),E=F([o(r(),A,C),o(r(),A,U),a(r(),A,C),a(r(),A,U)],c,s,l);return E.push(E[0]),p.addRing(E),d}function F(e,t,r,n){return e.map((e=>C(e,t,r,n)))}function H(e){const{geometry:t,farDistance:r,objectId:n,nearDistance:a,cameraHeight:o}=e,s=v(t.y,t.spatialReference),f=new i({center:t.clone(),radius:r*s});if(f.imageID=n,a){const e=new i({center:t.clone(),radius:a*s});f.addRing(e.rings[0])}const l=t.clone();l.z=o-r*s;const m=c.createSphere(l,{size:2*r*s});return m.imageID=n,{polygon:f,frustum:m}}function O(e,t){return e.contains(t)}function S(e,t){return Math.sign(e)!==Math.sign(t)}function q(e,t,n){const{cameraHeight:i,cameraPitch:s,farDistance:f,location:l,horizontalFieldOfView:m,nearDistance:u,verticalFieldOfView:h}=e,y=E(l),g=s+h/2>=90==!1,x=2*Math.tan(h*b/2)*u,d=2*Math.tan(m*b/2)*u,w=2*Math.tan(h*b/2)*f,j=2*Math.tan(m*b/2)*f;let v,P;P=[0,0,-1],P=D(P,t),v=R([l.x,l.y,i],P,f,y),g&&(v[2]=0);const A=R([l.x,l.y,i],P,u,y);let I=[0,1,0];I=D(I,t);let z=[1,0,0];z=D(z,t);let V=[],F=[];u?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(o(r(),A,a(r(),M(I,x/2,y),M(z,d/2,y)))),V=V.concat(o(r(),A,o(r(),M(I,x/2,y),M(z,d/2,y)))),V=V.concat(a(r(),A,a(r(),M(I,x/2,y),M(z,d/2,y)))),V=V.concat(a(r(),A,o(r(),M(I,x/2,y),M(z,d/2,y))))):(V=[l.x,l.y,i],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(o(r(),v,a(r(),M(I,w/2,y),M(z,j/2,y)))),V=V.concat(o(r(),v,o(r(),M(I,w/2,y),M(z,j/2,y)))),V=V.concat(a(r(),v,a(r(),M(I,w/2,y),M(z,j/2,y)))),V=V.concat(a(r(),v,o(r(),M(I,w/2,y),M(z,j/2,y))));const H=new p({position:Float64Array.from(V)});return new c({vertexAttributes:H,components:F,spatialReference:l.spatialReference})}function C(e,t,n,o){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/o)**2)*o,c=M(a(r(),[e[0],e[1],e[2]],[n.x,n.y,t]),1/i,1/o),s=t/(t-e[2]),f={x:(1-s)*n.x+s*e[0],y:(1-s)*n.y+s*e[1],z:(1-s)*t+s*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/o)**2)*o,m=M(a(r(),[f.x,f.y,f.z],[n.x,n.y,t]),1/l,1/o);return S(c[0],m[0])&&S(c[1],m[1])&&S(c[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function U(e){const{spatialReference:t,x:r,y:n}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:c}=e,s=E(e.geometry),l=new f({spatialReference:t}),m=Math.abs(1.44*i*s);let u=Math.abs(1.44*c*s);(o<20||null==a)&&(u=m);const h=[];return h[0]={x:r+m*Math.sin((a-45)*b),y:n+m*Math.cos((a-45)*b)},h[1]={x:r+m*Math.sin((a+45)*b),y:n+m*Math.cos((a+45)*b)},h[2]={x:r+u*Math.sin((a+135)*b),y:n+u*Math.cos((a+135)*b)},h[3]={x:r+u*Math.sin((a+225)*b),y:n+u*Math.cos((a+225)*b)},l.addRing([[h[0].x,h[0].y,0],[h[1].x,h[1].y,0],[h[2].x,h[2].y,0],[h[3].x,h[3].y,0],[h[0].x,h[0].y,0]]),l}function E(e){return e&&d(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/u.radius))):1}function k(e,t){const n=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:r}=e,a=new i({radius:t*n,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if("esri.geometry.Polygon"===e.declaredClass){const t=new f({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let t=0;t<e.rings[0].length;t++){const c=Math.sqrt((o.x-e.rings[0][t][0])**2+(o.y-e.rings[0][t][1])**2),s=M(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[o.x,o.y,0]),1/c,1),f=R([o.x,o.y,0],s,c*n,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function L(e,t,r){const{cameraHeight:n,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:c,imageHeight:s,imageWidth:f,inSRS:l,outSRS:u,verticalFieldOfView:h,cameraRoll:p,options:y}=r,g=new m(l),x=new m(u),d=w(c,h,p??0),M=i.length>15;return o+d.vfov/2>=90?await K(i,e,f,s,g,x,M,y):await W(i,e,t,a,n,M,g,x,y)}async function W(e,t,r,n,a,o,i,s,f){const l=B(e,t,r,n,a);if(!l)return;const{farPlane:m,nearPlane:u}=l,h=await N([...u?.vertexPositions??e.slice(0,3),...m.vertexPositions],i,s,f),y=Z(h);return new c({vertexAttributes:new p({position:h}),components:Y(o?T(y,!0):X(y,!0)),spatialReference:s})}function B(e,t,r,n,a){const o=Q(e),i=Q(e,"near");if(!o)return;const c=t.length;for(let s=0;s<c;s++){const e=Array.from(r[s]),t=[e[0]-n[0],e[1]-n[1],e[2]-(n[2]??a)];J(n,t,s,i),G(n,t,s,o)}return{farPlane:o,nearPlane:i}}function G(e,t,n,a){const{coefficients:o,vertexPositions:i}=a,c=r();x(o,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function J(e,t,n,a){if(!a)return;const o=r();x(a.coefficients,{origin:e,direction:t},o)&&a.vertexPositions.splice(3*n,3,...o)}async function K(e,t,r,n,a,o,i,s){let f,l=i?new Array:[e[0],e[1],e[2]],m=new Array;for(const c of t)i?(f=j([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),l=l.concat(...f),f=j([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),m=m.concat(...f)):(f=j([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),l=l.concat(...f));l=l.concat(m);const u=await N(l,a,o,s),h=Z(u);return new c({vertexAttributes:new p({position:u}),components:Y(i?T(h,!0):X(h,!0)),spatialReference:o})}async function N(t,r,n,a){if(r.equals(n))return t;const o=t.reduce(((e,t,r)=>{const n=Math.floor(r/3);return e[n]||(e[n]=new Array),e[n].push(t),e}),new Array),{points:i}=await l(new s(o,r),n,a);return e(a),i.flat()}function Q(e,t="far"){const r=y();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),g(r,n,!1))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!g(r,n,!1))return;return{coefficients:r,vertexPositions:n}}}const T=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw new Error("Invalid number of vertices");const r=[],n=e/2,a=Math.round((t?e-2:e)/2);for(let o=0;o<a;o++){const a=o+n,i=t?a+1:a,c=i%e,s=(t?a:i+1)%e;r.push({faces:new Uint32Array([o,s,c,o,o+1,c])})}return r};function X(e,t=!1){if(e<3||t&&e-1<3)throw new Error("Invalid number of vertices");const r=[],n=t?e-2:e-1;for(let a=0;a<n;a++)r.push({faces:new Uint32Array([0,a+1,a+2])});return r}const Y=e=>e.map((e=>new h(e))),Z=e=>e.length/3;export{O as checkIfPolygonContainsSelectedPoint,U as computePolygonForInspection,A as createCoveragePolygon,F as limitZToGround,N as projectVertices,k as resizePolygon,L as updateFrustum};
5
+ import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as n}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{a,f as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import c from"../../../geometry/Mesh.js";import s from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectWithZConversion as l}from"../../../geometry/projection.js";import m from"../../../geometry/SpatialReference.js";import{earth as u}from"../../../geometry/support/Ellipsoid.js";import h from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as p}from"../../../geometry/support/MeshVertexAttributes.js";import{create as y,fromArray as g,intersectRay as x}from"../../../geometry/support/plane.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as w,createRotationMatrixFromHPR as M,transformMat3 as R,scaleAndAddWithFactor as j,scaleWithFactor as v,computeHFOVAndVFOV as P,projectiveTransform as D}from"../transformations/utils.js";const b=Math.PI/180;function A(e){return e.isSpherical?H(e):I(e)}function I(e){const{horizontalFieldOfView:t,verticalFieldOfView:r,geometry:n,cameraHeading:a}=e,o=w(n.y,n.spatialReference);let i=e.cameraPitch,c=e.cameraRoll??0,s=150;t>150&&(i=90,c=0,s=5);const l=Math.ceil(t/s),m=z(l,a,t);let u=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*b);e.cameraPitch+r/2>=90&&(u=(e.farDistance||20)*o);const h=new f({spatialReference:n?.spatialReference});h.imageID=e.objectId;let p=null;for(const f of m)p=V(f,i,e.cameraHeight,n,u,o,r,t,l,h,c,e.nearDistance);return p.imageID=e.objectId,{polygon:h,frustum:p}}function z(e,t,r){const n=[];if(e%2==0)for(let a=0;a<e/2;a++)n.push(t-r/e*(a+.5),t+r/e*(a+.5));else{n.push(t);for(let a=1;a<e/2;a++)n.push(t-r/e*a,t+r/e*a)}return n.sort(),n}function V(e,i,c,s,f,l,m,u,h,p,y=0,g=0){const x=n(t(),M([e,i,y??0])),d=q({cameraHeight:c,cameraPitch:i,farDistance:f,location:s,horizontalFieldOfView:u,nearDistance:g,verticalFieldOfView:m},x),w=R([0,0,-1],x),{x:P,y:D}=s,A=j([P,D,c],w,f,l),I=2*Math.tan(m*b/2)*f,z=2*Math.tan(u/h*b/2)*f,V=R([0,1,0],x),H=R([1,0,0],x),O=v(V,I/2,l),S=v(H,z/2,l),C=a(r(),O,S),U=o(r(),O,S),E=F([o(r(),A,C),o(r(),A,U),a(r(),A,C),a(r(),A,U)],c,s,l);return E.push(E[0]),p.addRing(E),d}function F(e,t,r,n){return e.map((e=>C(e,t,r,n)))}function H(e){const{geometry:t,farDistance:r,objectId:n,nearDistance:a,cameraHeight:o}=e,s=w(t.y,t.spatialReference),f=new i({center:t.clone(),radius:r*s});if(f.imageID=n,a){const e=new i({center:t.clone(),radius:a*s});f.addRing(e.rings[0])}const l=t.clone();l.z=o-r*s;const m=c.createSphere(l,{size:2*r*s});return m.imageID=n,{polygon:f,frustum:m}}function O(e,t){return e.contains(t)}function S(e,t){return Math.sign(e)!==Math.sign(t)}function q(e,t,n){const{cameraHeight:i,cameraPitch:s,farDistance:f,location:l,horizontalFieldOfView:m,nearDistance:u,verticalFieldOfView:h}=e,y=E(l),g=s+h/2>=90==!1,x=2*Math.tan(h*b/2)*u,d=2*Math.tan(m*b/2)*u,w=2*Math.tan(h*b/2)*f,M=2*Math.tan(m*b/2)*f;let P,D;D=[0,0,-1],D=R(D,t),P=j([l.x,l.y,i],D,f,y),g&&(P[2]=0);const A=j([l.x,l.y,i],D,u,y);let I=[0,1,0];I=R(I,t);let z=[1,0,0];z=R(z,t);let V=[],F=[];u?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(o(r(),A,a(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(o(r(),A,o(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(a(r(),A,a(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(a(r(),A,o(r(),v(I,x/2,y),v(z,d/2,y))))):(V=[l.x,l.y,i],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(o(r(),P,a(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(o(r(),P,o(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(a(r(),P,a(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(a(r(),P,o(r(),v(I,w/2,y),v(z,M/2,y))));const H=new p({position:Float64Array.from(V)});return new c({vertexAttributes:H,components:F,spatialReference:l.spatialReference})}function C(e,t,n,o){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/o)**2)*o,c=v(a(r(),[e[0],e[1],e[2]],[n.x,n.y,t]),1/i,1/o),s=t/(t-e[2]),f={x:(1-s)*n.x+s*e[0],y:(1-s)*n.y+s*e[1],z:(1-s)*t+s*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/o)**2)*o,m=v(a(r(),[f.x,f.y,f.z],[n.x,n.y,t]),1/l,1/o);return S(c[0],m[0])&&S(c[1],m[1])&&S(c[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function U(e){const{spatialReference:t,x:r,y:n}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:c}=e,s=E(e.geometry),l=new f({spatialReference:t}),m=Math.abs(1.44*i*s);let u=Math.abs(1.44*c*s);(o<20||null==a)&&(u=m);const h=[];return h[0]={x:r+m*Math.sin((a-45)*b),y:n+m*Math.cos((a-45)*b)},h[1]={x:r+m*Math.sin((a+45)*b),y:n+m*Math.cos((a+45)*b)},h[2]={x:r+u*Math.sin((a+135)*b),y:n+u*Math.cos((a+135)*b)},h[3]={x:r+u*Math.sin((a+225)*b),y:n+u*Math.cos((a+225)*b)},l.addRing([[h[0].x,h[0].y,0],[h[1].x,h[1].y,0],[h[2].x,h[2].y,0],[h[3].x,h[3].y,0],[h[0].x,h[0].y,0]]),l}function E(e){return e&&d(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/u.radius))):1}function k(e,t){const n=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:r}=e,a=new i({radius:t*n,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if("esri.geometry.Polygon"===e.declaredClass){const t=new f({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let t=0;t<e.rings[0].length;t++){const c=Math.sqrt((o.x-e.rings[0][t][0])**2+(o.y-e.rings[0][t][1])**2),s=v(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[o.x,o.y,0]),1/c,1),f=j([o.x,o.y,0],s,c*n,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function L(e,t,r){const{cameraHeight:n,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:c,imageHeight:s,imageWidth:f,inSRS:l,outSRS:u,verticalFieldOfView:h,cameraRoll:p,options:y}=r,g=new m(l),x=new m(u),d=P(c,h,p??0),w=i.length>15;return o+d.vfov/2>=90?await K(i,e,f,s,g,x,w,y):await W(i,e,t,a,n,w,g,x,y)}async function W(e,t,r,n,a,o,i,s,f){const l=B(e,t,r,n,a);if(!l)return;const{farPlane:m,nearPlane:u}=l,h=await N([...u?.vertexPositions??e.slice(0,3),...m.vertexPositions],i,s,f),y=Z(h);return new c({vertexAttributes:new p({position:h}),components:Y(o?T(y,!0):X(y,!0)),spatialReference:s})}function B(e,t,r,n,a){const o=Q(e),i=Q(e,"near");if(!o)return;const c=t.length;for(let s=0;s<c;s++){const e=Array.from(r[s]),t=[e[0]-n[0],e[1]-n[1],e[2]-(n[2]??a)];J(n,t,s,i),G(n,t,s,o)}return{farPlane:o,nearPlane:i}}function G(e,t,n,a){const{coefficients:o,vertexPositions:i}=a,c=r();x(o,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function J(e,t,n,a){if(!a)return;const o=r();x(a.coefficients,{origin:e,direction:t},o)&&a.vertexPositions.splice(3*n,3,...o)}async function K(e,t,r,n,a,o,i,s){let f,l=i?new Array:[e[0],e[1],e[2]],m=new Array;for(const c of t)i?(f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),l=l.concat(...f),f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),m=m.concat(...f)):(f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),l=l.concat(...f));l=l.concat(m);const u=await N(l,a,o,s),h=Z(u);return new c({vertexAttributes:new p({position:u}),components:Y(i?T(h,!0):X(h,!0)),spatialReference:o})}async function N(t,r,n,a){if(r.equals(n))return t;const o=t.reduce(((e,t,r)=>{const n=Math.floor(r/3);return e[n]||(e[n]=new Array),e[n].push(t),e}),new Array),{points:i}=await l(new s(o,r),n,a);return e(a),i.flat()}function Q(e,t="far"){const r=y();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),g(r,n,!1))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!g(r,n,!1))return;return{coefficients:r,vertexPositions:n}}}const T=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw new Error("Invalid number of vertices");const r=[],n=e/2,a=Math.round((t?e-2:e)/2);for(let o=0;o<a;o++){const a=o+n,i=t?a+1:a,c=i%e,s=(t?a:i+1)%e;r.push({faces:new Uint32Array([o,s,c,o,o+1,c])})}return r};function X(e,t=!1){if(e<3||t&&e-1<3)throw new Error("Invalid number of vertices");const r=[],n=t?e-2:e-1;for(let a=0;a<n;a++)r.push({faces:new Uint32Array([0,a+1,a+2])});return r}const Y=e=>e.map((e=>new h(e))),Z=e=>e.length/3;export{O as checkIfPolygonContainsSelectedPoint,U as computePolygonForInspection,A as createCoveragePolygon,F as limitZToGround,N as projectVertices,k as resizePolygon,L as updateFrustum};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{JSONMap as t}from"../../../core/jsonMap.js";import n from"./cameraOrientationRegistry.js";import{isConstantElevation as e,ConstantElevation as r,ElevationSource as i}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as o}from"../enums/CameraOrientationType.js";function s(t,n,e){return n&&(t=`${n}${t}`),e&&(t+=`${e}`),t}function l(t,n,e){let{url:r}=t;return r?(r=s(r,n,e),new i({...t,url:r})):null}function a(t,n,i){return t?e(t)?new r(t):l(t,n,i):t}const u=new t({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),c=new t({Feet:"feet",Meter:"meter"}),f=new t({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique","":null}),p=new Map;function h(t){const[n,e,r,i,o,s,l,a,u,c,f,p,h,g,d,y,w,D,z,$,I,K]=t.slice(1);return{horizontalWKID:n,verticalWKID:e,x:r,y:i,z:o,omega:s,phi:l,kappa:a,...m([u,c,f,p,h,g],[y,w],[D,z,$],[I,K],d)}}p.set(`${o.HPR}`,d),p.set(`${o.YPR}`,y),p.set(`${o.OPK}`,h),p.set(`${o.LTP}`,w);const g=t=>{const n=t.map((t=>parseFloat(t))).filter((t=>!isNaN(t)));if(n.length===t.length)return n};function m(t,n,e,r,i){const o=g(t),s=g(n),l=g(e),a=g(r);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function d(t){const[n,e,r,i,o,s,l,a,u,c,f,p,h,g,d,y,w,D,z,$,I,K]=t.slice(1);return{horizontalWKID:n,verticalWKID:e,x:r,y:i,z:o,heading:s,pitch:l,roll:a,...m([u,c,f,p,h,g],[y,w],[D,z,$],[I,K],d)}}function y(t){const[n,e,r,i,o,s,l,a,u,c,f,p,h,g,d,y,w,D,z,$,I,K]=t.slice(1);return{horizontalWKID:n,verticalWKID:e,x:r,y:i,z:o,yaw:s,pitch:l,roll:a,...m([u,c,f,p,h,g],[y,w],[D,z,$],[I,K],d)}}function w(t){const[e,r,i,o,s,...l]=t.slice(1),a=p.get(s),u=n.get(s)?.constructor;if(!a||!u)return null;return{latitude:e,longitude:r,ellipsoidRadius:i,squaredEccentricity:o,properties:new u(a([s,"",...l]))}}function D(t){if(!t)return null;const e=`${t}`.split("|");if(0===e.length)return null;const r=n.get(e[0]);if(!r)return null;const i=p.get(e[0]);if(!i)return null;return new(0,r.constructor)(i(e))}function z(t){return Array.isArray(t)&&9===t?.length&&!t.some(isNaN)}export{s as appendPrefixAndSuffix,D as createCameraOrientation,a as getEffectiveElevationSource,z as isOrientationAccuracy,f as orientedImageryTypeMap,l as processElevationSource,u as timeIntervalUnitTypeMap,p as transformersRegistry,c as verticalMeasurementTypeMap};
5
+ import{JSONMap as t}from"../../../core/jsonMap.js";import{geographicToWebMercator as n}from"../../../geometry/support/webMercatorUtils.js";import e from"./cameraOrientationRegistry.js";import{isConstantElevation as r,ConstantElevation as i,ElevationSource as o}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as s}from"../enums/CameraOrientationType.js";function l(t,n,e){return n&&(t=`${n}${t}`),e&&(t+=`${e}`),t}function a(t,n,e){let{url:r}=t;return r?(r=l(r,n,e),new o({...t,url:r})):null}function u(t,n,e){return t?r(t)?new i(t):a(t,n,e):t}const c=new t({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),f=new t({Feet:"feet",Meter:"meter"}),p=new t({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique","":null}),h=new Map;function g(t){const[n,e,r,i,o,s,l,a,u,c,f,p,h,g,m,d,w,D,z,$,I,K]=t.slice(1);return{horizontalWKID:n,verticalWKID:e,x:r,y:i,z:o,omega:s,phi:l,kappa:a,...y([u,c,f,p,h,g],[d,w],[D,z,$],[I,K],m)}}h.set(`${s.HPR}`,d),h.set(`${s.YPR}`,w),h.set(`${s.OPK}`,g),h.set(`${s.LTP}`,D);const m=t=>{const n=t.map((t=>parseFloat(t))).filter((t=>!isNaN(t)));if(n.length===t.length)return n};function y(t,n,e,r,i){const o=m(t),s=m(n),l=m(e),a=m(r);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function d(t){const[n,e,r,i,o,s,l,a,u,c,f,p,h,g,m,d,w,D,z,$,I,K]=t.slice(1);return{horizontalWKID:n,verticalWKID:e,x:r,y:i,z:o,heading:s,pitch:l,roll:a,...y([u,c,f,p,h,g],[d,w],[D,z,$],[I,K],m)}}function w(t){const[n,e,r,i,o,s,l,a,u,c,f,p,h,g,m,d,w,D,z,$,I,K]=t.slice(1);return{horizontalWKID:n,verticalWKID:e,x:r,y:i,z:o,yaw:s,pitch:l,roll:a,...y([u,c,f,p,h,g],[d,w],[D,z,$],[I,K],m)}}function D(t){const[n,r,i,o,s,...l]=t.slice(1),a=h.get(s),u=e.get(s)?.constructor;if(!a||!u)return null;return{latitude:n,longitude:r,ellipsoidRadius:i,squaredEccentricity:o,properties:new u(a([s,"",...l]))}}function z(t){if(!t)return null;const n=`${t}`.split("|");if(0===n.length)return null;const r=e.get(n[0]);if(!r)return null;const i=h.get(n[0]);if(!i)return null;return new(0,r.constructor)(i(n))}function $(t){return Array.isArray(t)&&9===t?.length&&!t.some(isNaN)}function I(t){return t.spatialReference.isGeographic?n(t):t.clone()}export{l as appendPrefixAndSuffix,I as convertGeographicToWebMercator,z as createCameraOrientation,u as getEffectiveElevationSource,$ as isOrientationAccuracy,p as orientedImageryTypeMap,a as processElevationSource,c as timeIntervalUnitTypeMap,h as transformersRegistry,f as verticalMeasurementTypeMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfNotAbortError as e}from"../../core/promiseUtils.js";import r from"../../geometry/Extent.js";import{geographicToWebMercator as t}from"../../geometry/support/webMercatorUtils.js";import o from"../OrientedImageryLayer.js";import a from"./core/ExposurePoint.js";import n from"../../rest/support/Query.js";const s={},i=1e3;async function c(r,a){const{point:c,queryParams:l}=r;if(null==c)return null;const y={};let p=r.layerInstanceOrURL;const f=c.spatialReference.isGeographic?t(c.clone()):c.clone();if(y.outSpatialReference=f.spatialReference,l&&(y.maxRecordCountFactor=l.maxRecordCountFactor??5,y.outFields=l.outFields??["*"],y.where=l.where??"1=1",y.returnGeometry=l.returnGeometry??!0,y.outSpatialReference=l.outSpatialReference),"string"==typeof p&&(s.layer&&s.layer.url===p?p=s.layer:(s.layer?.destroy(),p=s.layer=new o({url:p}))),p)try{await p.load();const e=p,r=u(f,l?.maximumDistance??e.maximumDistance??i);y.returnZ=e.hasZ;const t=new n({geometry:r,...y}),o=await e.queryFeatures(t,a);return m(e)(o)}catch(x){e(x)}return null}function m(e){return r=>{const{features:t,spatialReference:o}=r;return t.forEach((r=>{r.geometry&&(r.geometry.spatialReference=o);const t=a.fromJSON({...r.toJSON(),layer:e});t&&(r.attributes=t),r.layer=e,r.spatialReference=o})),r}}function u(e,t){const o=e.x-t,a=e.x+t,n=e.y-t,s=e.y+t;return new r({xmin:o,xmax:a,ymin:n,ymax:s,spatialReference:e.spatialReference})}export{u as createExtentFromPointAtDistance,c as searchImages};
5
+ import e from"../../core/Error.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import t from"../../geometry/SpatialReference.js";import{isPoint as o}from"../../geometry/support/typeUtils.js";import a from"../OrientedImageryLayer.js";import i from"./core/ExposurePoint.js";import{convertGeographicToWebMercator as n}from"./core/utils.js";import s from"../../rest/support/Query.js";import{createExtentAroundPoint as m}from"../../widgets/OrientedImageryViewer/navigation/utils.js";const u={},c=1e3;async function l(e,t){const{point:o,queryParams:a}=e;p(o,a);const i=d(e.layerInstanceOrURL);await i.load(t);const n=y(i,o,a),s=await i.queryFeatures(n,t);return r(t),f(i)(s)}function p(r,t){if(!o(r)&&null==t?.geometry)throw new e("invalid-parameters","searchImages requires a point and query parameters to be provided.");return!0}function y(e,r,o){const a=r?n(r):null,i=o?.maximumDistance??e.maximumDistance??c,u=o?.geometry??(a?m(a,i):null);return new s({outSpatialReference:o?.outSpatialReference??e.spatialReference.isGeographic?t.WebMercator:e.spatialReference,returnGeometry:o?.returnGeometry??!0,outFields:o?.outFields??["*"],geometry:u,where:o?.where??"1=1",returnZ:e.hasZ,orderByFields:o?.orderByFields,maxRecordCountFactor:o?.maxRecordCountFactor??5})}function f(e){return r=>(r.features.forEach((r=>{const t=i.fromJSON({...r.toJSON(),layer:e});t&&(r.attributes=t)})),r)}function d(e){return"string"!=typeof e?e:(u.layer?.url!==e&&(u.layer?.destroy(),u.layer=new a({url:e})),u.layer)}export{l as searchImages};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import{rad2deg as n,deg2rad as a}from"../../../core/mathUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as e,fromValues as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as r}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as s,multiply as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as f,mul as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as u,f as m}from"../../../chunks/vec32.js";import{isSerializable as p}from"../../../core/support/jsonUtils.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isConstantElevation as w,isElevationSource as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function z(t,n,a){const[i,o,r,c]=n,[s,l,u,m]=a;F(i,o,r,c);const p=F(s,l,u,m),M=V(i,o,r,c),g=V(s,l,u,m),v=f(e(),M),d=h(e(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function F(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function S(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=S(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const c=D(r([...i,1]),f(new Array(16),o(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=c[0],l=c[1],h=c[2],u=e();return u[0]=s*t[0],u[1]=l*n[0],u[2]=h*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=h*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=h*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=h,u[15]=1,u}function C(t,n,a,i,e=c()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=c();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=c();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,e,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=i();switch(e){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const H={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function N(n,a,e=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=i();for(let t=0;t<3;t++){const[i,r]=a[t],c=I(n[t],i,r,e);l(o,c,o)}return o}function q(t,n=!0){return N(t,H.OPK,n)}function k(t,n=!0){return N(t,H.HPR,n)}function A(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),h=a(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function U(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=i,h=a(c),u=a(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=n(O);return[n(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function W(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=Y(t,i);return X(e,o,n,a)}function X(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function Y(t,a){const i=n(Math.acos(-t.z/a));return{heading:n(Math.atan2(t.x,t.y)),pitch:i}}function Z(t,n,i=E/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}function J(t,n,a,i=E/2){const{heading:e,pitch:o}=W(t,n,a);return Z(e,o,i)}async function $(t,a,i){const e=await g(a,t.spatialReference,i);let o=n(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const G=t=>t.toArray(),Q=(...t)=>t.some((t=>t));function _(t,n){if(Q(0===t.length,t.some((({x:t,y:n})=>Q(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function tt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function nt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function at(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const it=t=>n=>new M(n,t),et=t=>null!=t&&"queryExtent"in t;function ot(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>z(x(c(),a,[n,e,0]),i,t)))}function rt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(ct);return null!=s&&st(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function ct(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function st(t){return null!=t[1]&&null!=t[5]}function lt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ut(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ft(t,n,a,i){return wt(i)?q([i.omega,i.phi,i.kappa]):yt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ut(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=rt({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??ft(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const mt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,pt=t=>y(t?.elevationSource)&&null!=t?.extent,Mt=t=>w(t?.elevationSource),gt=async(t,n,a)=>null!=n&&(mt(n)||Mt(n))?n:pt(n)?{elevationSample:await b({...p(n.elevationSource)?n.elevationSource.toJSON():n.elevationSource,extent:n.extent},a),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},vt=t=>j(t?.heading)&&j(t?.pitch),dt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function xt(t){const{cameraLocation:n,farDistance:e,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:l,verticalFieldOfView:f}=t,h=i();s(h,r);const p=2*Math.tan(a(f)/2)*e*l,M=2*Math.tan(a(o)/2)*e*l,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*l,l),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,p/2,l),y=R(x,M/2,l),O=u(c(),w,y),b=m(c(),w,y);return[m(c(),v,O),m(c(),v,b),u(c(),v,O),u(c(),v,b)]}const wt=t=>2===t?.type,yt=t=>1===t?.type;function Ot(t){const n=t%360;return n<-180?n+360:n}function bt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var jt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(jt||(jt={}));export{xt as computeFarplaneVertices,A as computeHFOVAndVFOV,ot as computeNewReferenceCoordinates,Z as convertHeadingPitchToSphereVertex,X as convertOrientationToPixelLocation,J as convertPixelLocationToSphereVertex,W as convertPixelToHeadingPitch,Y as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,N as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,rt as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,lt as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,at as getWebMercatorScalingFactor,ut as getWorldToImageProperties,vt as hasAngles,yt as hasHeadingPitchRoll,wt as hasOmegaPhiKappa,et as isElevationSampler,mt as isUpdateElevationWithElevationSampler,pt as isUpdateElevationWithElevationSource,Mt as isUpdateUsingConstantElevation,st as isValidAffines,V as linearEquationSolve,U as ltpToGeographic,Ot as normalizeHeading,Q as or,G as pointToArray,z as projectiveTransform,dt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,bt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,_ as validatePixelsToTransform,tt as validatePointsToTransform,nt as validateRotationMatrix,it as vecToPoint};
5
+ import t from"../../../core/Error.js";import{rad2deg as n,deg2rad as a}from"../../../core/mathUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as e,fromValues as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as r}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as s,transpose as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as f,mul as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as u,f as m}from"../../../chunks/vec32.js";import{isSerializable as p}from"../../../core/support/jsonUtils.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isConstantElevation as w,isElevationSource as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function z(t,n,a){const[i,o,r,c]=n,[s,l,u,m]=a;F(i,o,r,c);const p=F(s,l,u,m),M=V(i,o,r,c),g=V(s,l,u,m),v=f(e(),M),d=h(e(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function F(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function S(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=S(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const c=D(r([...i,1]),f(new Array(16),o(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=c[0],l=c[1],h=c[2],u=e();return u[0]=s*t[0],u[1]=l*n[0],u[2]=h*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=h*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=h*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=h,u[15]=1,u}function C(t,n,a,i,e=c()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=c();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=c();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,e,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=i();switch(e){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const H={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function N(n,a,e=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=i();for(let t=0;t<3;t++){const[i,r]=a[t],c=I(n[t],i,r,e);s(o,c,o)}return o}function q(t,n=!0){return N(t,H.OPK,n)}function k(t,n=!0){return N(t,H.HPR,n)}function A(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),h=a(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function U(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=i,h=a(c),u=a(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=n(O);return[n(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function W(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=Y(t,i);return X(e,o,n,a)}function X(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function Y(t,a){const i=n(Math.acos(-t.z/a));return{heading:n(Math.atan2(t.x,t.y)),pitch:i}}function Z(t,n,i=E/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}function J(t,n,a,i=E/2){const{heading:e,pitch:o}=W(t,n,a);return Z(e,o,i)}async function $(t,a,i){const e=await g(a,t.spatialReference,i);let o=n(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const G=t=>t.toArray(),Q=(...t)=>t.some((t=>t));function _(t,n){if(Q(0===t.length,t.some((({x:t,y:n})=>Q(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function tt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function nt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function at(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const it=t=>n=>new M(n,t),et=t=>null!=t&&"queryExtent"in t;function ot(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>z(x(c(),a,[n,e,0]),i,t)))}function rt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(ct);return null!=s&&st(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function ct(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function st(t){return null!=t[1]&&null!=t[5]}function lt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ut(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ft(t,n,a,i){return wt(i)?q([i.omega,i.phi,i.kappa]):yt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ut(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=rt({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??ft(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const mt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,pt=t=>y(t?.elevationSource)&&null!=t?.extent,Mt=t=>w(t?.elevationSource),gt=async(t,n,a)=>null!=n&&(mt(n)||Mt(n))?n:pt(n)?{elevationSample:await b({...p(n.elevationSource)?n.elevationSource.toJSON():n.elevationSource,extent:n.extent},a),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},vt=t=>j(t?.heading)&&j(t?.pitch),dt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function xt(t){const{cameraLocation:n,farDistance:e,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:s,verticalFieldOfView:f}=t,h=i();l(h,r);const p=2*Math.tan(a(f)/2)*e*s,M=2*Math.tan(a(o)/2)*e*s,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*s,s),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,p/2,s),y=R(x,M/2,s),O=u(c(),w,y),b=m(c(),w,y);return[m(c(),v,O),m(c(),v,b),u(c(),v,O),u(c(),v,b)]}const wt=t=>2===t?.type,yt=t=>1===t?.type;function Ot(t){const n=t%360;return n<-180?n+360:n}function bt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var jt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(jt||(jt={}));export{xt as computeFarplaneVertices,A as computeHFOVAndVFOV,ot as computeNewReferenceCoordinates,Z as convertHeadingPitchToSphereVertex,X as convertOrientationToPixelLocation,J as convertPixelLocationToSphereVertex,W as convertPixelToHeadingPitch,Y as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,N as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,rt as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,lt as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,at as getWebMercatorScalingFactor,ut as getWorldToImageProperties,vt as hasAngles,yt as hasHeadingPitchRoll,wt as hasOmegaPhiKappa,et as isElevationSampler,mt as isUpdateElevationWithElevationSampler,pt as isUpdateElevationWithElevationSource,Mt as isUpdateUsingConstantElevation,st as isValidAffines,V as linearEquationSolve,U as ltpToGeographic,Ot as normalizeHeading,Q as or,G as pointToArray,z as projectiveTransform,dt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,bt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,_ as validatePixelsToTransform,tt as validatePointsToTransform,nt as validateRotationMatrix,it as vecToPoint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clampFloat32 as e}from"../../core/mathUtils.js";var t={};t.defaultNoDataValue=e(-1/0),t.decode=function(s,r){var o=(r=r||{}).encodedMaskData||null===r.encodedMaskData,f=l(s,r.inputOffset||0,o),u=null!=r.noDataValue?e(r.noDataValue):t.defaultNoDataValue,m=i(f,r.pixelType||Float32Array,r.encodedMaskData,u,r.returnMask),d={width:f.width,height:f.height,pixelData:m.resultPixels,minValue:f.pixels.minValue,maxValue:f.pixels.maxValue,noDataValue:u};return m.resultMask&&(d.maskData=m.resultMask),r.returnEncodedMask&&f.mask&&(d.encodedMaskData=f.mask.bitset?f.mask.bitset:null),r.returnFileInfo&&(d.fileInfo=n(f,u),r.computeUsedBitDepths&&(d.fileInfo.bitDepths=a(f))),d};var i=function(e,t,i,n,a){var l,r,o=0,f=e.pixels.numBlocksX,u=e.pixels.numBlocksY,m=Math.floor(e.width/f),d=Math.floor(e.height/u),c=2*e.maxZError;i=i||(e.mask?e.mask.bitset:null),l=new t(e.width*e.height),a&&i&&(r=new Uint8Array(e.width*e.height));for(var g,h,k=new Float32Array(m*d),x=0;x<=u;x++){var p=x!==u?d:e.height%u;if(0!==p)for(var w=0;w<=f;w++){var y=w!==f?m:e.width%f;if(0!==y){var V,B,v,U,D=x*e.width*d+w*m,M=e.width-y,b=e.pixels.blocks[o];if(b.encoding<2?(0===b.encoding?V=b.rawData:(s(b.stuffedData,b.bitsPerPixel,b.numValidPixels,b.offset,c,k,e.pixels.maxValue),V=k),B=0):v=2===b.encoding?0:b.offset,i)for(h=0;h<p;h++){for(7&D&&(U=i[D>>3],U<<=7&D),g=0;g<y;g++)7&D||(U=i[D>>3]),128&U?(r&&(r[D]=1),l[D++]=b.encoding<2?V[B++]:v):(r&&(r[D]=0),l[D++]=n),U<<=1;D+=M}else if(b.encoding<2)for(h=0;h<p;h++){for(g=0;g<y;g++)l[D++]=V[B++];D+=M}else for(h=0;h<p;h++)if(l.fill)l.fill(v,D,D+y),D+=y+M;else{for(g=0;g<y;g++)l[D++]=v;D+=M}if(1===b.encoding&&B!==b.numValidPixels)throw"Block and Mask do not match";o++}}}return{resultPixels:l,resultMask:r}},n=function(e,t){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,minValue:e.pixels.minValue,noDataValue:t}}},a=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,i={},n=0;n<t;n++){var a=e.pixels.blocks[n];0===a.encoding?i.float32=!0:1===a.encoding?i[a.bitsPerPixel]=!0:i[0]=!0}return Object.keys(i)},l=function(e,t,i){var n={},a=new Uint8Array(e,t,10);if(n.fileIdentifierString=String.fromCharCode.apply(null,a),"CntZImage"!=n.fileIdentifierString.trim())throw"Unexpected file identifier string: "+n.fileIdentifierString;t+=10;var l=new DataView(e,t,24);if(n.fileVersion=l.getInt32(0,!0),n.imageType=l.getInt32(4,!0),n.height=l.getUint32(8,!0),n.width=l.getUint32(12,!0),n.maxZError=l.getFloat64(16,!0),t+=24,!i)if(l=new DataView(e,t,16),n.mask={},n.mask.numBlocksY=l.getUint32(0,!0),n.mask.numBlocksX=l.getUint32(4,!0),n.mask.numBytes=l.getUint32(8,!0),n.mask.maxValue=l.getFloat32(12,!0),t+=16,n.mask.numBytes>0){var s=new Uint8Array(Math.ceil(n.width*n.height/8)),r=(l=new DataView(e,t,n.mask.numBytes)).getInt16(0,!0),o=2,f=0;do{if(r>0)for(;r--;)s[f++]=l.getUint8(o++);else{var u=l.getUint8(o++);for(r=-r;r--;)s[f++]=u}r=l.getInt16(o,!0),o+=2}while(o<n.mask.numBytes);if(-32768!==r||f<s.length)throw"Unexpected end of mask RLE encoding";n.mask.bitset=s,t+=n.mask.numBytes}else if(!(n.mask.numBytes|n.mask.numBlocksY|n.mask.maxValue)){s=new Uint8Array(Math.ceil(n.width*n.height/8));n.mask.bitset=s}l=new DataView(e,t,16),n.pixels={},n.pixels.numBlocksY=l.getUint32(0,!0),n.pixels.numBlocksX=l.getUint32(4,!0),n.pixels.numBytes=l.getUint32(8,!0),n.pixels.maxValue=l.getFloat32(12,!0),t+=16;var m=n.pixels.numBlocksX,d=n.pixels.numBlocksY,c=m+(n.width%m>0?1:0),g=d+(n.height%d>0?1:0);n.pixels.blocks=new Array(c*g);for(var h=1e9,k=0,x=0;x<g;x++)for(var p=0;p<c;p++){var w=0,y=e.byteLength-t;l=new DataView(e,t,Math.min(10,y));var V={};n.pixels.blocks[k++]=V;var B=l.getUint8(0);if(w++,V.encoding=63&B,V.encoding>3)throw"Invalid block encoding ("+V.encoding+")";if(2!==V.encoding){if(0!==B&&2!==B){if(B>>=6,V.offsetType=B,2===B)V.offset=l.getInt8(1),w++;else if(1===B)V.offset=l.getInt16(1,!0),w+=2;else{if(0!==B)throw"Invalid block offset type";V.offset=l.getFloat32(1,!0),w+=4}if(h=Math.min(V.offset,h),1===V.encoding)if(B=l.getUint8(w),w++,V.bitsPerPixel=63&B,B>>=6,V.numValidPixelsType=B,2===B)V.numValidPixels=l.getUint8(w),w++;else if(1===B)V.numValidPixels=l.getUint16(w,!0),w+=2;else{if(0!==B)throw"Invalid valid pixel count type";V.numValidPixels=l.getUint32(w,!0),w+=4}}var v;if(t+=w,3!=V.encoding)if(0===V.encoding){var U=(n.pixels.numBytes-1)/4;if(U!==Math.floor(U))throw"uncompressed block has invalid length";v=new ArrayBuffer(4*U),new Uint8Array(v).set(new Uint8Array(e,t,4*U));for(var D=new Float32Array(v),M=0;M<D.length;M++)h=Math.min(h,D[M]);V.rawData=D,t+=4*U}else if(1===V.encoding){var b=Math.ceil(V.numValidPixels*V.bitsPerPixel/8),I=Math.ceil(b/4);v=new ArrayBuffer(4*I),new Uint8Array(v).set(new Uint8Array(e,t,b)),V.stuffedData=new Uint32Array(v),t+=b}}else t++,h=Math.min(h,0)}return n.pixels.minValue=h,n.eofOffset=t,n},s=function(e,t,i,n,a,l,s){var r,o,f,u=(1<<t)-1,m=0,d=0,c=Math.ceil((s-n)/a),g=4*e.length-Math.ceil(t*i/8);for(e[e.length-1]<<=8*g,r=0;r<i;r++){if(0===d&&(f=e[m++],d=32),d>=t)o=f>>>d-t&u,d-=t;else{var h=t-d;o=(f&u)<<h&u,o+=(f=e[m++])>>>(d=32-h)}l[r]=o<c?n+o*a:s}return l};const r=t.decode;class o{_decode(e){const t=r(e.buffer,e.options);return Promise.resolve({result:t,transferList:[t.pixelData.buffer]})}}function f(){return new o}export{f as default};
5
+ import{clampFloat32 as e}from"../../core/mathUtils.js";var t={};t.defaultNoDataValue=e(-1/0),t.decode=function(s,r){var o=(r=r||{}).encodedMaskData||null===r.encodedMaskData,f=l(s,r.inputOffset||0,o),u=null!=r.noDataValue?e(r.noDataValue):t.defaultNoDataValue,m=i(f,r.pixelType||Float32Array,r.encodedMaskData,u,r.returnMask),d={width:f.width,height:f.height,pixelData:m.resultPixels,minValue:f.pixels.minValue,maxValue:f.pixels.maxValue,noDataValue:u};return m.resultMask&&(d.maskData=m.resultMask),r.returnEncodedMask&&f.mask&&(d.encodedMaskData=f.mask.bitset?f.mask.bitset:null),r.returnFileInfo&&(d.fileInfo=n(f,u),r.computeUsedBitDepths&&(d.fileInfo.bitDepths=a(f))),d};var i=function(e,t,i,n,a){var l,r,o=0,f=e.pixels.numBlocksX,u=e.pixels.numBlocksY,m=Math.floor(e.width/f),d=Math.floor(e.height/u),c=2*e.maxZError;i=i||(e.mask?e.mask.bitset:null),l=new t(e.width*e.height),a&&i&&(r=new Uint8Array(e.width*e.height));for(var g,h,k=new Float32Array(m*d),x=0;x<=u;x++){var p=x!==u?d:e.height%u;if(0!==p)for(var w=0;w<=f;w++){var y=w!==f?m:e.width%f;if(0!==y){var V,B,v,U,D=x*e.width*d+w*m,M=e.width-y,b=e.pixels.blocks[o];if(b.encoding<2?(0===b.encoding?V=b.rawData:(s(b.stuffedData,b.bitsPerPixel,b.numValidPixels,b.offset,c,k,e.pixels.maxValue),V=k),B=0):v=2===b.encoding?0:b.offset,i)for(h=0;h<p;h++){for(7&D&&(U=i[D>>3],U<<=7&D),g=0;g<y;g++)7&D||(U=i[D>>3]),128&U?(r&&(r[D]=1),l[D++]=b.encoding<2?V[B++]:v):(r&&(r[D]=0),l[D++]=n),U<<=1;D+=M}else if(b.encoding<2)for(h=0;h<p;h++){for(g=0;g<y;g++)l[D++]=V[B++];D+=M}else for(h=0;h<p;h++)if(l.fill)l.fill(v,D,D+y),D+=y+M;else{for(g=0;g<y;g++)l[D++]=v;D+=M}if(1===b.encoding&&B!==b.numValidPixels)throw"Block and Mask do not match";o++}}}return{resultPixels:l,resultMask:r}},n=function(e,t){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,minValue:e.pixels.minValue,noDataValue:t}}},a=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,i={},n=0;n<t;n++){var a=e.pixels.blocks[n];0===a.encoding?i.float32=!0:1===a.encoding?i[a.bitsPerPixel]=!0:i[0]=!0}return Object.keys(i)},l=function(e,t,i){var n={},a=new Uint8Array(e,t,10);if(n.fileIdentifierString=String.fromCharCode.apply(null,a),"CntZImage"!=n.fileIdentifierString.trim())throw"Unexpected file identifier string: "+n.fileIdentifierString;t+=10;var l=new DataView(e,t,24);if(n.fileVersion=l.getInt32(0,!0),n.imageType=l.getInt32(4,!0),n.height=l.getUint32(8,!0),n.width=l.getUint32(12,!0),n.maxZError=l.getFloat64(16,!0),t+=24,!i)if(l=new DataView(e,t,16),n.mask={},n.mask.numBlocksY=l.getUint32(0,!0),n.mask.numBlocksX=l.getUint32(4,!0),n.mask.numBytes=l.getUint32(8,!0),n.mask.maxValue=l.getFloat32(12,!0),t+=16,n.mask.numBytes>0){var s=new Uint8Array(Math.ceil(n.width*n.height/8)),r=(l=new DataView(e,t,n.mask.numBytes)).getInt16(0,!0),o=2,f=0;do{if(r>0)for(;r--;)s[f++]=l.getUint8(o++);else{var u=l.getUint8(o++);for(r=-r;r--;)s[f++]=u}r=l.getInt16(o,!0),o+=2}while(o<n.mask.numBytes);if(-32768!==r||f<s.length)throw"Unexpected end of mask RLE encoding";n.mask.bitset=s,t+=n.mask.numBytes}else if(0===(n.mask.numBytes|n.mask.numBlocksY|n.mask.maxValue)){s=new Uint8Array(Math.ceil(n.width*n.height/8));n.mask.bitset=s}l=new DataView(e,t,16),n.pixels={},n.pixels.numBlocksY=l.getUint32(0,!0),n.pixels.numBlocksX=l.getUint32(4,!0),n.pixels.numBytes=l.getUint32(8,!0),n.pixels.maxValue=l.getFloat32(12,!0),t+=16;var m=n.pixels.numBlocksX,d=n.pixels.numBlocksY,c=m+(n.width%m>0?1:0),g=d+(n.height%d>0?1:0);n.pixels.blocks=new Array(c*g);for(var h=1e9,k=0,x=0;x<g;x++)for(var p=0;p<c;p++){var w=0,y=e.byteLength-t;l=new DataView(e,t,Math.min(10,y));var V={};n.pixels.blocks[k++]=V;var B=l.getUint8(0);if(w++,V.encoding=63&B,V.encoding>3)throw"Invalid block encoding ("+V.encoding+")";if(2!==V.encoding){if(0!==B&&2!==B){if(B>>=6,V.offsetType=B,2===B)V.offset=l.getInt8(1),w++;else if(1===B)V.offset=l.getInt16(1,!0),w+=2;else{if(0!==B)throw"Invalid block offset type";V.offset=l.getFloat32(1,!0),w+=4}if(h=Math.min(V.offset,h),1===V.encoding)if(B=l.getUint8(w),w++,V.bitsPerPixel=63&B,B>>=6,V.numValidPixelsType=B,2===B)V.numValidPixels=l.getUint8(w),w++;else if(1===B)V.numValidPixels=l.getUint16(w,!0),w+=2;else{if(0!==B)throw"Invalid valid pixel count type";V.numValidPixels=l.getUint32(w,!0),w+=4}}var v;if(t+=w,3!=V.encoding)if(0===V.encoding){var U=(n.pixels.numBytes-1)/4;if(U!==Math.floor(U))throw"uncompressed block has invalid length";v=new ArrayBuffer(4*U),new Uint8Array(v).set(new Uint8Array(e,t,4*U));for(var D=new Float32Array(v),M=0;M<D.length;M++)h=Math.min(h,D[M]);V.rawData=D,t+=4*U}else if(1===V.encoding){var b=Math.ceil(V.numValidPixels*V.bitsPerPixel/8),I=Math.ceil(b/4);v=new ArrayBuffer(4*I),new Uint8Array(v).set(new Uint8Array(e,t,b)),V.stuffedData=new Uint32Array(v),t+=b}}else t++,h=Math.min(h,0)}return n.pixels.minValue=h,n.eofOffset=t,n},s=function(e,t,i,n,a,l,s){var r,o,f,u=(1<<t)-1,m=0,d=0,c=Math.ceil((s-n)/a),g=4*e.length-Math.ceil(t*i/8);for(e[e.length-1]<<=8*g,r=0;r<i;r++){if(0===d&&(f=e[m++],d=32),d>=t)o=f>>>d-t&u,d-=t;else{var h=t-d;o=(f&u)<<h&u,o+=(f=e[m++])>>>(d=32-h)}l[r]=o<c?n+o*a:s}return l};const r=t.decode;class o{_decode(e){const t=r(e.buffer,e.options);return Promise.resolve({result:t,transferList:[t.pixelData.buffer]})}}function f(){return new o}export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../request.js";import i from"../../../core/Error.js";import o from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{onAbort as n}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import m from"../../../geometry/Point.js";import u from"../../../geometry/SpatialReference.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as p}from"../commonProperties.js";import d from"../DimensionalDefinition.js";import x from"../LOD.js";import y from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{isFunctionRaster as I}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as R,getSliceIndex as w,createSlices as S,getSliceIds as k}from"./multidimensionalUtils.js";import{getRasterId as v,getBlock as T,putBlock as b,deleteBlock as P,decreaseRefCount as B}from"./RawBlockCache.js";import{convertNoDataToMask as _}from"../rasterFormats/pixelRangeUtils.js";import{decode as M}from"../rasterFormats/RasterCodec.js";import{mosaic as C,approximateTransform as W,getLocalArithmeticNorthRotations as j}from"../rasterFunctions/pixelUtils.js";import{getWorldWidth as z,load as H,projectPoint as L,snapPyramid as E,shiftExtent as D,getWorldWrapCount as O,projectExtent as F,getProjectionOffsetGrid as A,getRasterDatasetAlignmentInfo as G,projectResolution as q}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as N,uvComponentToVector as J}from"../rasterFunctions/vectorFieldUtils.js";const V=8,U=256;let Q=0,$=class extends o{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=z(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),I(this)&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}get rasterId(){return this.url||"rasterId-"+Q++}set url(e){this._set("url",h(e,r.getLogger(this)))}async open(e){return this._openPromise??=H().then((()=>this._open(e))),this._openPromise}async fetchTile(e,t,i,o={}){const r=o.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,r);return o={noClip:!0,...o},this.fetchPixels(n,r.size[0],r.size[1],o)}async identify(e,t={}){e=a(m,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:o}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=r;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=o||R(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:u,extent:h}=r,{datumTransformation:p}=t;let d=L(e,u,p);if(!h.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let x=0;const y=null!=l&&null!=s&&r.hasMultidimensionalTranspose;if(I(this)){const e=this.primaryRasters.rasters[0];if(y)return e.identify(d,t);const{pixelSize:o}=r,n=3,s=o.x*n/2,l=o.y*n/2,a=new f({xmin:d.x-s,xmax:d.x+s,ymin:d.y-l,ymax:d.y+l,spatialReference:u}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId},{pixelBlock:m}=await e.fetchPixels(a,n,n,c),{pixelBlock:h}=await this.fetchPixels(a,n,n,c);if(null==m)return{location:d,value:null};const p=Math.floor(n*n*.5),x=!m.mask||m.mask[p]?m.pixels.map((e=>e[p])):null;let g;return null!=h&&(g=!h.mask||h.mask[p]?h.pixels.map((e=>e[p])):void 0),{location:d,value:x,processedValue:g,pyramidLevel:0}}if(!y)if(t.srcResolution){x=E(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel}else if(x=await this.computeBestPyramidLevelForLocation(e,t),null==x)return{location:d,value:null};const g=this.identifyPixelLocation(d,x,null,y);if(null===g)return{location:d,value:null};const{row:w,col:S,rowOffset:k,colOffset:v,blockWidth:T}=g,b=await this._tileFetchQueue.push({pyramidLevel:x,row:w,col:S,options:t},{signal:t.signal});if(!b?.pixels?.length)return{location:d,value:null};const P=k*T+v;return this._processIdentifyResult(b,{srcLocation:d,position:P,pyramidLevel:x,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,o={}){e=D(e),o=this._getRequestOptionsWithSliceId(o);const{_hasNoneOrGCSShiftTransform:r}=this;if(o.requestRawData&&r)return this._fetchPixels(e,t,i,o);const n=z(e.spatialReference),s=O(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,o);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),u=m-Math.round((n/2-a)/(c-a)*t);let h=0;const p=[];for(let g=0;g<=s;g++){const r=new f({xmin:0===g?a:-n/2,xmax:g===s?c-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),d=0===g?m-u:g===s?t-h:m;h+=d,p.push(d);const x=o.disableWrapAround&&g>0?null:this._fetchPixels(r,d,i,o);l.push(x)}const d=(await Promise.all(l)).map((e=>e?.pixelBlock));let x=null;const y={width:t,height:i};if(this.rasterJobHandler){x=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},o)).pixelBlock}else x=C(d,y,{blockWidths:p});return{extent:e,srcExtent:F(e,this.rasterInfo.spatialReference,o.datumTransformation),pixelBlock:x}}async fetchRawPixels(e,t,i,o={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,o),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,u=new f({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!r)return{extent:u,srcExtent:u,pixelBlock:null};const{pixelBlocks:h,mosaicSize:p}=r;if(1===h.length&&null!=h[0]&&h[0].width===i.width&&h[0].height===i.height)return{extent:u,srcExtent:u,pixelBlock:r.pixelBlocks[0]};const d=e>0?l.pyramidBlockWidth:l.blockWidth,x=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%d,y:t.y%x};let g;if(this.rasterJobHandler){g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:o.interpolation,alignmentInfo:null,blockWidths:null},o)).pixelBlock}else g=C(h,p,{clipOffset:y,clipSize:i});return{extent:u,srcExtent:u,pixelBlock:g}}fetchRawTile(e,t,o,r){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return F(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?M(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,o=0){const{customFetchParameters:r}=this.ioConfig,{range:n,query:s,headers:l}=i;o=o??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...r},headers:{...l,...a}})}catch(c){if(o>0)return o--,this.request(e,i,o);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:w(e,t)}getTileExtentFromTileInfo(e,t,i,o){const r=o.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,o.origin,o.spatialReference,o.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:o}=this.rasterInfo,{pyramidResolutions:r}=e;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let l=(o.x+o.y)/2,a=1/.0254*96*l;for(let e=0;e<=s&&(n.unshift(new x({level:s-e,resolution:l,scale:a})),e!==s);e++)if(r){const t=(r[e].x+r[e].y)/2;a*=t/l,l=t}else l*=2,a*=2;const c=new m({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new g({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,o){const{width:r,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new m({x:s.xmin,y:s.ymax,spatialReference:a});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],o);e.storageInfo=new y({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,o,r,n=0,s=2){if(1===r.length&&n>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<n;i++)e*=s,t*=s,r.push({x:e,y:t})}const l=[],{x:a,y:c}=o;for(let f=0;f<r.length;f++){const{x:o,y:n}=r[f];l.push({minCol:Math.floor((e.xmin-a+.1*o)/t/o),maxCol:Math.floor((e.xmax-a-.1*o)/t/o),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=o**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,o){const{spatialReference:r,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,f=o&&null!=c?c.tileSize[0]:s.blockWidth,m=o&&null!=c?c.tileSize[1]:s.blockHeight,u=L(e,r,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/m,y=(u.x-a.x)/p/f,g=Math.min(m-1,Math.floor((x-Math.floor(x))*m)),I=Math.min(f-1,Math.floor((y-Math.floor(y))*f));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:f,srcLocation:u}}getTileExtent(e,t,i,o,r,n){const[s,l]=n,a=o.x+i*s*e.x,c=a+s*e.x,m=o.y-t*l*e.y,u=m-l*e.y;return new f({xmin:a,xmax:c,ymin:u,ymax:m,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i}updateImageSpaceRasterInfo(e){const{pixelSize:t}=e,{width:i,height:o}=e,r=u.WebMercator;e.spatialReference=r,e.extent=e.nativeExtent=new f({xmin:-.5,ymax:.5,xmax:i-.5,ymin:.5-o,spatialReference:r}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new m({x:1,y:1,spatialReference:r});const{extent:n,storageInfo:s}=e;if(s){s.origin=new m({x:n.xmin,y:n.ymax,spatialReference:r});const{pyramidResolutions:i,tileInfo:o}=s;if(i&&i.forEach((e=>{e.x/=t.x,e.y/=t.y})),o){o.origin=s.origin;const t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;o.lods.forEach(((e,i)=>{e.resolution=t*2**i,e.scale=96*e.resolution/.0254}))}}}async _fetchPixels(e,t,i,o={}){let r=O(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,o),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:f,ul:u}=n;if(0===c||0===f)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:h}=this,p=h.transform,d="gcs-shift"===p?.type,x=null!=z(e.spatialReference);!d&&x||(r=O(n.srcExtent,d));const y=await this._fetchRawTiles(s,u,{width:c,height:f,wrapCount:r},o);if(!y)return{extent:e,srcExtent:a,pixelBlock:null};const g=h.storageInfo,I=s>0?g.pyramidBlockWidth:g.blockWidth,R=s>0?g.pyramidBlockHeight:g.blockHeight;let{x:w,y:S}=h.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[s-1])({x:w,y:S}=e[s-1]);else{const e=t**s;w*=e,S*=e}}const k=h.spatialReference,v=new m({x:w,y:S,spatialReference:k}),T=I===c&&R===f&&u.x%I==0&&u.y%R==0,b=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),P=!e.spatialReference.equals(k),B=k.isGeographic?1e-9:1e-4,{datumTransformation:_}=o;if(!P&&T&&1===y.pixelBlocks.length&&I===t&&R===i&&X(l,b,B))return{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:y.pixelBlocks[0]};const M=x&&null!=z(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,L=o.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");L&&!this.rasterJobHandler&&await H();const E=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:b.toJSON(),datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:L},o):A({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:b,datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1,includeGCSGrid:L});let D;const F=!o.requestRawData,G={rows:E.spacing[0],cols:E.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,y.extent.xmin):void 0,{pixelBlocks:J,mosaicSize:V,isPartiallyFilled:U}=y;let Q=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:J,srcMosaicSize:V,destDimension:F?{width:t,height:i}:null,coefs:F?E.coefficients:null,sampleSpacing:F?G:null,projectDirections:L,gcsGrid:L?E.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:o.interpolation,alignmentInfo:q,blockWidths:null},o);({pixelBlock:D,localNorthDirections:Q}=e)}else{const e=C(J,V,{alignmentInfo:q});D=F?W(e,{width:t,height:i},E.coefficients,G,o.interpolation):e,L&&E.gcsGrid&&(Q=j({width:t,height:i},E.gcsGrid),D=N(D,this.rasterInfo.dataType,Q))}return o.requestRawData||L?{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:D,transformGrid:E,localNorthDirections:Q,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:D}}async _fetchRawTiles(e,t,i,o){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:u,wrapCount:h}=i;const p=this._getRasterTileAlignmentInfo(e,0);o.buffer&&(a-=o.buffer.cols,c-=o.buffer.rows,m+=2*o.buffer.cols,u+=2*o.buffer.rows);let d=0,x=0,y=0;if(h&&null!=p){({worldColumnCountFromOrigin:x,originColumnOffset:y,rightPadding:d}=p);x*p.blockWidth-d>=a+m&&(d=0)}const g=Math.floor(a/s),I=Math.floor(c/l),R=Math.floor((a+m+d-1)/s),w=Math.floor((c+u+d-1)/l),S=n[e];if(!S)return null;const{minRow:k,minCol:v,maxCol:T,maxRow:b}=S;if(0===h&&(w<k||R<v||I>b||g>T))return null;const P=new Array;let B=!1;const _=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let f=I;f<=w;f++)for(let t=g;t<=R;t++){let i=t;if(!o.disableWrapAround&&h&&null!=p&&x<=t&&(i=t-x-y),f>=k&&i>=v&&b>=f&&T>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:f,col:i,options:o},{signal:o.signal});_?P.push(new Promise((e=>{t.then((t=>e(t))).catch((()=>{B=!0,e(null)}))}))):P.push(t)}else P.push(Promise.resolve(null))}if(0===P.length)return null;const M=await Promise.all(P),C={height:(w-I+1)*l,width:(R-g+1)*s},{spatialReference:W}=this.rasterInfo,j=this.getPyramidPixelSize(e),{x:z,y:H}=j;return{extent:new f({xmin:r.x+g*s*z,xmax:r.x+(R+1)*s*z,ymin:r.y-(w+1)*l*H,ymax:r.y-I*l*H,spatialReference:W}),pixelBlocks:M,mosaicSize:C,isPartiallyFilled:B}}_fetchRawTile(e,t,i,o){const{storageInfo:r}=this.rasterInfo,s=null!=r.transposeInfo&&!!o.transposedVariableName;if(!s){const o=r.blockBoundary[e];if(!o)return Promise.resolve(null);const{minRow:n,minCol:s,maxCol:l,maxRow:a}=o;if(t<n||i<s||t>a||i>l)return Promise.resolve(null)}const l=s?o.transposeVariableName:o.sliceId,a=this.rasterInfo.storageInfo.isBsqTile?o.bandIds:null,c=v(this.rasterId,l,a),f=`${e}/${t}/${i}`;let m=T(c,o.registryId,f);if(null==m){const r=new AbortController;m=this.fetchRawTile(e,t,i,{...o,signal:r.signal}),b(c,o.registryId,f,m,r),m.catch((()=>P(c,o.registryId,f)))}return o.signal&&n(o,(()=>{B(c,o.registryId,f)})),m}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const o=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[r,n]=e,s=[],l=[];for(let a=0;a<o;a++){const[e,t]=J([r[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=G(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,o={}){const r={datumTransformation:o.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};o.srcResolution&&(r.srcResolution=o.srcResolution,this._updateSourceDataInfo(e,r));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=r,c=s/t,f=l/i,u=a<n&&c*f>=16,h=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(u||h||(0===s||0===l)){const s=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=q(s,this.rasterInfo.spatialReference,e,r.datumTransformation);const h=!l||o.srcResolution&&l.x+l.y<o.srcResolution.x+o.srcResolution.y;if(u&&o.srcResolution&&h){const e=Math.round(Math.log(Math.max(c,f))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:o.srcResolution.x*t,y:o.srcResolution.y*t}}}l&&(r.srcResolution=l,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,o){const{tileInfo:r}=this.rasterInfo.storageInfo,n=Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1]),s=e/i,l=t/o,a=Math.max(1,(i+o)/1024);return n>=U*a||s>V||l>V}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,o=i.spatialReference,{srcResolution:r,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=E(r,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||F(e,o,n);if(null==c)return;const f=i.transform;f&&(c=f.inverseTransform(c)),t.srcExtent=c;const{x:m,y:u}=i.storageInfo.origin,h=Math.floor((c.xmin-m)/l.x+.1),p=Math.floor((u-c.ymax)/l.y+.1),d=Math.floor((c.xmax-m)/l.x-.1),x=Math.floor((u-c.ymin)/l.y-.1),y=c.width<.1*l.x?0:d-h+1,g=c.height<.1*l.y?0:x-p+1;t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=y,t.srcHeight=g,t.ul={x:h,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:o,pyramidLevel:r,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[o]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map((e=>e[o])),n={location:i,value:t,pyramidLevel:r},s=this._computeMagDirValues(t.map((e=>[e])));return s?.length&&(n.magdirValue=s.map((e=>e[0]))),n}let a=e.pixels.map((e=>e.slice(o*s,o*s+s))),c=this._computeMagDirValues(a);const{requestSomeSlices:f,identifyOptions:m}=t;let u=S(l,m.transposedVariableName);if(f){const e=k(u,m.multidimensionalDefinition,m.timeExtent);a=a.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),u=e.map((e=>u[e]))}const h=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:a,pixelType:e.pixelType};let x;null!=h&&(_(p,h),x=p.mask);return{location:i,value:null,dataSeries:u.map(((e,t)=>{const i={value:0===x?.[t]?null:a.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new d({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:r}}};function X(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}e([l()],$.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],$.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],$.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],$.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],$.prototype,"_openPromise",void 0),e([l()],$.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],$.prototype,"rasterId",null),e([l(p)],$.prototype,"url",null),e([l({type:String,json:{write:!0}})],$.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],$.prototype,"datasetFormat",void 0),e([l()],$.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],$.prototype,"rasterInfo",void 0),e([l()],$.prototype,"ioConfig",void 0),e([l()],$.prototype,"sourceJSON",void 0),$=e([c("esri.layers.support.rasterDatasets.BaseRaster")],$);export{$ as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../request.js";import i from"../../../core/Error.js";import o from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{onAbort as n}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import m from"../../../geometry/Point.js";import u from"../../../geometry/SpatialReference.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as p}from"../commonProperties.js";import d from"../DimensionalDefinition.js";import x from"../LOD.js";import y from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{isFunctionRaster as I}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as R,getSliceIndex as w,createSlices as S,getSliceIds as k}from"./multidimensionalUtils.js";import{getRasterId as v,getBlock as T,putBlock as b,deleteBlock as P,decreaseRefCount as B}from"./RawBlockCache.js";import{convertNoDataToMask as _}from"../rasterFormats/pixelRangeUtils.js";import{decode as M}from"../rasterFormats/RasterCodec.js";import{mosaic as C,approximateTransform as W,getLocalArithmeticNorthRotations as j}from"../rasterFunctions/pixelUtils.js";import{getWorldWidth as z,load as H,projectPoint as L,snapPyramid as E,shiftExtent as D,getWorldWrapCount as O,projectExtent as F,getProjectionOffsetGrid as A,getRasterDatasetAlignmentInfo as G,projectResolution as q}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as N,uvComponentToVector as J}from"../rasterFunctions/vectorFieldUtils.js";const V=8,U=256;let Q=0,$=class extends o{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=z(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),I(this)&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}get rasterId(){return this.url||"rasterId-"+Q++}set url(e){this._set("url",h(e,r.getLogger(this)))}async open(e){return this._openPromise??=H().then((()=>this._open(e))),this._openPromise}async fetchTile(e,t,i,o={}){const r=o.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,r);return o={noClip:!0,...o},this.fetchPixels(n,r.size[0],r.size[1],o)}async identify(e,t={}){e=a(m,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:o}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=r;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=o||R(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:u,extent:h}=r,{datumTransformation:p}=t;let d=L(e,u,p);if(!h.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let x=0;const y=null!=l&&null!=s&&r.hasMultidimensionalTranspose;if(I(this)){const e=this.primaryRasters.rasters[0];if(y)return e.identify(d,t);const{pixelSize:o}=r,n=3,s=o.x*n/2,l=o.y*n/2,a=new f({xmin:d.x-s,xmax:d.x+s,ymin:d.y-l,ymax:d.y+l,spatialReference:u}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId},{pixelBlock:m}=await e.fetchPixels(a,n,n,c),{pixelBlock:h}=await this.fetchPixels(a,n,n,c);if(null==m)return{location:d,value:null};const p=Math.floor(n*n*.5),x=!m.mask||m.mask[p]?m.pixels.map((e=>e[p])):null;let g;return null!=h&&(g=!h.mask||h.mask[p]?h.pixels.map((e=>e[p])):void 0),{location:d,value:x,processedValue:g,pyramidLevel:0}}if(!y)if(t.srcResolution){x=E(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel}else if(x=await this.computeBestPyramidLevelForLocation(e,t),null==x)return{location:d,value:null};const g=this.identifyPixelLocation(d,x,null,y);if(null===g)return{location:d,value:null};const{row:w,col:S,rowOffset:k,colOffset:v,blockWidth:T}=g,b=await this._tileFetchQueue.push({pyramidLevel:x,row:w,col:S,options:t},{signal:t.signal});if(!b?.pixels?.length)return{location:d,value:null};const P=k*T+v;return this._processIdentifyResult(b,{srcLocation:d,position:P,pyramidLevel:x,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,o={}){e=D(e),o=this._getRequestOptionsWithSliceId(o);const{_hasNoneOrGCSShiftTransform:r}=this;if(o.requestRawData&&r)return this._fetchPixels(e,t,i,o);const n=z(e.spatialReference),s=O(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,o);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),u=m-Math.round((n/2-a)/(c-a)*t);let h=0;const p=[];for(let g=0;g<=s;g++){const r=new f({xmin:0===g?a:-n/2,xmax:g===s?c-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),d=0===g?m-u:g===s?t-h:m;h+=d,p.push(d);const x=o.disableWrapAround&&g>0?null:this._fetchPixels(r,d,i,o);l.push(x)}const d=(await Promise.all(l)).map((e=>e?.pixelBlock));let x=null;const y={width:t,height:i};if(this.rasterJobHandler){x=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},o)).pixelBlock}else x=C(d,y,{blockWidths:p});return{extent:e,srcExtent:F(e,this.rasterInfo.spatialReference,o.datumTransformation),pixelBlock:x}}async fetchRawPixels(e,t,i,o={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,o),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,u=new f({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!r)return{extent:u,srcExtent:u,pixelBlock:null};const{pixelBlocks:h,mosaicSize:p}=r;if(1===h.length&&null!=h[0]&&h[0].width===i.width&&h[0].height===i.height)return{extent:u,srcExtent:u,pixelBlock:r.pixelBlocks[0]};const d=e>0?l.pyramidBlockWidth:l.blockWidth,x=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%d,y:t.y%x};let g;if(this.rasterJobHandler){g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:o.interpolation,alignmentInfo:null,blockWidths:null},o)).pixelBlock}else g=C(h,p,{clipOffset:y,clipSize:i});return{extent:u,srcExtent:u,pixelBlock:g}}fetchRawTile(e,t,o,r){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return F(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?M(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,o=0){const{customFetchParameters:r}=this.ioConfig,{range:n,query:s,headers:l}=i;o=o??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...r},headers:{...l,...a}})}catch(c){if(o>0)return o--,this.request(e,i,o);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:w(e,t)}getTileExtentFromTileInfo(e,t,i,o){const r=o.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,o.origin,o.spatialReference,o.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:o}=this.rasterInfo,{pyramidResolutions:r}=e;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let l=(o.x+o.y)/2,a=1/.0254*96*l;for(let e=0;e<=s&&(n.unshift(new x({level:s-e,resolution:l,scale:a})),e!==s);e++)if(r){const t=(r[e].x+r[e].y)/2;a*=t/l,l=t}else l*=2,a*=2;const c=new m({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new g({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,o){const{width:r,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new m({x:s.xmin,y:s.ymax,spatialReference:a});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],o);e.storageInfo=new y({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,o,r,n=0,s=2){if(1===r.length&&n>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<n;i++)e*=s,t*=s,r.push({x:e,y:t})}const l=[],{x:a,y:c}=o;for(let f=0;f<r.length;f++){const{x:o,y:n}=r[f];l.push({minCol:Math.floor((e.xmin-a+.1*o)/t/o),maxCol:Math.floor((e.xmax-a-.1*o)/t/o),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=o**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,o){const{spatialReference:r,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,f=o&&null!=c?c.tileSize[0]:s.blockWidth,m=o&&null!=c?c.tileSize[1]:s.blockHeight,u=L(e,r,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/m,y=(u.x-a.x)/p/f,g=Math.min(m-1,Math.floor((x-Math.floor(x))*m)),I=Math.min(f-1,Math.floor((y-Math.floor(y))*f));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:f,srcLocation:u}}getTileExtent(e,t,i,o,r,n){const[s,l]=n,a=o.x+i*s*e.x,c=a+s*e.x,m=o.y-t*l*e.y,u=m-l*e.y;return new f({xmin:a,xmax:c,ymin:u,ymax:m,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i}updateImageSpaceRasterInfo(e){const{pixelSize:t}=e,{width:i,height:o}=e,r=u.WebMercator;e.spatialReference=r,e.extent=e.nativeExtent=new f({xmin:-.5,ymax:.5,xmax:i-.5,ymin:.5-o,spatialReference:r}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new m({x:1,y:1,spatialReference:r});const{extent:n,storageInfo:s}=e;if(s){s.origin=new m({x:n.xmin,y:n.ymax,spatialReference:r});const{pyramidResolutions:i,tileInfo:o}=s;if(i&&i.forEach((e=>{e.x/=t.x,e.y/=t.y})),o){o.origin=s.origin;const t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;o.lods.forEach(((e,i)=>{e.resolution=t*2**i,e.scale=96*e.resolution/.0254}))}}}async _fetchPixels(e,t,i,o={}){let r=O(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,o),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:f,ul:u}=n;if(0===c||0===f)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:h}=this,p=h.transform,d="gcs-shift"===p?.type,x=null!=z(e.spatialReference);!d&&x||(r=O(n.srcExtent,d));const y=await this._fetchRawTiles(s,u,{width:c,height:f,wrapCount:r},o);if(!y)return{extent:e,srcExtent:a,pixelBlock:null};const g=h.storageInfo,I=s>0?g.pyramidBlockWidth:g.blockWidth,R=s>0?g.pyramidBlockHeight:g.blockHeight;let{x:w,y:S}=h.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[s-1])({x:w,y:S}=e[s-1]);else{const e=t**s;w*=e,S*=e}}const k=h.spatialReference,v=new m({x:w,y:S,spatialReference:k}),T=I===c&&R===f&&u.x%I===0&&u.y%R===0,b=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),P=!e.spatialReference.equals(k),B=k.isGeographic?1e-9:1e-4,{datumTransformation:_}=o;if(!P&&T&&1===y.pixelBlocks.length&&I===t&&R===i&&X(l,b,B))return{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:y.pixelBlocks[0]};const M=x&&null!=z(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,L=o.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");L&&!this.rasterJobHandler&&await H();const E=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:b.toJSON(),datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:L},o):A({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:b,datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1,includeGCSGrid:L});let D;const F=!o.requestRawData,G={rows:E.spacing[0],cols:E.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,y.extent.xmin):void 0,{pixelBlocks:J,mosaicSize:V,isPartiallyFilled:U}=y;let Q=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:J,srcMosaicSize:V,destDimension:F?{width:t,height:i}:null,coefs:F?E.coefficients:null,sampleSpacing:F?G:null,projectDirections:L,gcsGrid:L?E.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:o.interpolation,alignmentInfo:q,blockWidths:null},o);({pixelBlock:D,localNorthDirections:Q}=e)}else{const e=C(J,V,{alignmentInfo:q});D=F?W(e,{width:t,height:i},E.coefficients,G,o.interpolation):e,L&&E.gcsGrid&&(Q=j({width:t,height:i},E.gcsGrid),D=N(D,this.rasterInfo.dataType,Q))}return o.requestRawData||L?{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:D,transformGrid:E,localNorthDirections:Q,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:D}}async _fetchRawTiles(e,t,i,o){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:u,wrapCount:h}=i;const p=this._getRasterTileAlignmentInfo(e,0);o.buffer&&(a-=o.buffer.cols,c-=o.buffer.rows,m+=2*o.buffer.cols,u+=2*o.buffer.rows);let d=0,x=0,y=0;if(h&&null!=p){({worldColumnCountFromOrigin:x,originColumnOffset:y,rightPadding:d}=p);x*p.blockWidth-d>=a+m&&(d=0)}const g=Math.floor(a/s),I=Math.floor(c/l),R=Math.floor((a+m+d-1)/s),w=Math.floor((c+u+d-1)/l),S=n[e];if(!S)return null;const{minRow:k,minCol:v,maxCol:T,maxRow:b}=S;if(0===h&&(w<k||R<v||I>b||g>T))return null;const P=new Array;let B=!1;const _=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let f=I;f<=w;f++)for(let t=g;t<=R;t++){let i=t;if(!o.disableWrapAround&&h&&null!=p&&x<=t&&(i=t-x-y),f>=k&&i>=v&&b>=f&&T>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:f,col:i,options:o},{signal:o.signal});_?P.push(new Promise((e=>{t.then((t=>e(t))).catch((()=>{B=!0,e(null)}))}))):P.push(t)}else P.push(Promise.resolve(null))}if(0===P.length)return null;const M=await Promise.all(P),C={height:(w-I+1)*l,width:(R-g+1)*s},{spatialReference:W}=this.rasterInfo,j=this.getPyramidPixelSize(e),{x:z,y:H}=j;return{extent:new f({xmin:r.x+g*s*z,xmax:r.x+(R+1)*s*z,ymin:r.y-(w+1)*l*H,ymax:r.y-I*l*H,spatialReference:W}),pixelBlocks:M,mosaicSize:C,isPartiallyFilled:B}}_fetchRawTile(e,t,i,o){const{storageInfo:r}=this.rasterInfo,s=null!=r.transposeInfo&&!!o.transposedVariableName;if(!s){const o=r.blockBoundary[e];if(!o)return Promise.resolve(null);const{minRow:n,minCol:s,maxCol:l,maxRow:a}=o;if(t<n||i<s||t>a||i>l)return Promise.resolve(null)}const l=s?o.transposeVariableName:o.sliceId,a=this.rasterInfo.storageInfo.isBsqTile?o.bandIds:null,c=v(this.rasterId,l,a),f=`${e}/${t}/${i}`;let m=T(c,o.registryId,f);if(null==m){const r=new AbortController;m=this.fetchRawTile(e,t,i,{...o,signal:r.signal}),b(c,o.registryId,f,m,r),m.catch((()=>P(c,o.registryId,f)))}return o.signal&&n(o,(()=>{B(c,o.registryId,f)})),m}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const o=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[r,n]=e,s=[],l=[];for(let a=0;a<o;a++){const[e,t]=J([r[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=G(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,o={}){const r={datumTransformation:o.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};o.srcResolution&&(r.srcResolution=o.srcResolution,this._updateSourceDataInfo(e,r));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=r,c=s/t,f=l/i,u=a<n&&c*f>=16,h=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(u||h||(0===s||0===l)){const s=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=q(s,this.rasterInfo.spatialReference,e,r.datumTransformation);const h=!l||o.srcResolution&&l.x+l.y<o.srcResolution.x+o.srcResolution.y;if(u&&o.srcResolution&&h){const e=Math.round(Math.log(Math.max(c,f))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:o.srcResolution.x*t,y:o.srcResolution.y*t}}}l&&(r.srcResolution=l,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,o){const{tileInfo:r}=this.rasterInfo.storageInfo,n=Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1]),s=e/i,l=t/o,a=Math.max(1,(i+o)/1024);return n>=U*a||s>V||l>V}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,o=i.spatialReference,{srcResolution:r,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=E(r,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||F(e,o,n);if(null==c)return;const f=i.transform;f&&(c=f.inverseTransform(c)),t.srcExtent=c;const{x:m,y:u}=i.storageInfo.origin,h=Math.floor((c.xmin-m)/l.x+.1),p=Math.floor((u-c.ymax)/l.y+.1),d=Math.floor((c.xmax-m)/l.x-.1),x=Math.floor((u-c.ymin)/l.y-.1),y=c.width<.1*l.x?0:d-h+1,g=c.height<.1*l.y?0:x-p+1;t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=y,t.srcHeight=g,t.ul={x:h,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:o,pyramidLevel:r,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[o]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map((e=>e[o])),n={location:i,value:t,pyramidLevel:r},s=this._computeMagDirValues(t.map((e=>[e])));return s?.length&&(n.magdirValue=s.map((e=>e[0]))),n}let a=e.pixels.map((e=>e.slice(o*s,o*s+s))),c=this._computeMagDirValues(a);const{requestSomeSlices:f,identifyOptions:m}=t;let u=S(l,m.transposedVariableName);if(f){const e=k(u,m.multidimensionalDefinition,m.timeExtent);a=a.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),u=e.map((e=>u[e]))}const h=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:a,pixelType:e.pixelType};let x;null!=h&&(_(p,h),x=p.mask);return{location:i,value:null,dataSeries:u.map(((e,t)=>{const i={value:0===x?.[t]?null:a.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new d({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:r}}};function X(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}e([l()],$.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],$.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],$.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],$.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],$.prototype,"_openPromise",void 0),e([l()],$.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],$.prototype,"rasterId",null),e([l(p)],$.prototype,"url",null),e([l({type:String,json:{write:!0}})],$.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],$.prototype,"datasetFormat",void 0),e([l()],$.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],$.prototype,"rasterInfo",void 0),e([l()],$.prototype,"ioConfig",void 0),e([l()],$.prototype,"sourceJSON",void 0),$=e([c("esri.layers.support.rasterDatasets.BaseRaster")],$);export{$ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{createResolver as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import i from"../../../geometry/Extent.js";import{P as r,a as s,g as a,h as l,j as c}from"../../../chunks/pe.js";import f from"../../../geometry/Point.js";import u from"../../../geometry/Polygon.js";import{projectWithoutEngine as m}from"../../../geometry/projection.js";import x from"../../../geometry/SpatialReference.js";import{getInfo as h}from"../../../geometry/support/spatialReferenceUtils.js";var p;function g(){if(!j)throw new t("rasterprojectionhelper-project","projection operator is not loaded")}!function(e){e[e.None=0]="None",e[e.North=1]="North",e[e.South=2]="South",e[e.Both=3]="Both"}(p||(p={}));const y=(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},d={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},w=32,M=4,R=M,S=new Map,P=new Map,b=500,G=39.37,k=96;let N,E,T,j=!1;async function v(){return N||(N=n(),E=await import("../../../geometry/operators/projectOperator.js"),T=await import("../../../geometry/operators/support/geographicTransformationUtils.js"),E.isLoaded()||await E.load(),T.isLoaded()||await T.load(),j=!0,N.resolve()),N.promise}function C(e,t,n){if(g(),n){const n=E.execute(e,t);return T.getTransformation(t,e.spatialReference,n)}return T.getTransformation(e.spatialReference,t,e)}function _(e,t,n,o){const r=e.spatialReference;if(!r||!t||r.equals(t))return e;g();const s=n.center,a=new i({xmin:s.x-e.x/2,xmax:s.x+e.x/2,ymin:s.y-e.y/2,ymax:s.y+e.y/2,spatialReference:r}),l=E.execute(a,t,{geographicTransformation:o}),c=ee(t);return null==l||null!=c&&l.width>=c?z(e,r,t):{x:l.width,y:l.height}}function z(e,t,n){const i=o(t)/o(n);return{x:e.x*i,y:e.y*i}}function L(e,n,i){const{spatialReference:r}=i;if(!r||!n||r.equals(n))return e;if(r.isGeographic&&n.isGeographic)return z(e,r,n);if(g(),!j)throw new t("raster-projection-helper:project-dataset-resolution","geometry engine is not loaded");let{x:s,y:a}=e;const l=(s+a)/2*o(r);let c=1;l>30&&(c=30/l,s*=c,a*=c);const f=256,m=s*f/2,x=a*f/2,{x:h,y:p}=i.center,y=[];for(let t=0;t<=f;t++)y.push([h-m,p-x+t*a]);for(let t=1;t<=f;t++)y.push([h-m+t*s,p+x]);for(let t=1;t<=f;t++)y.push([h+m,p+x-t*a]);for(let t=1;t<f;t++)y.push([h+m-t*s,p-x]);y.push(y[0]);const d=new u({rings:[y],spatialReference:r}),w=E.execute(d,n);if(!w)return z(e,r,n);const M=w.extent,R=ee(n);if(null==M||null!=R&&M.width>=R)return z(e,r,n);const S=he(w.rings),P=s*a*f*f,b=Math.sqrt(S/P)/c,G={x:M.width/c/f,y:M.height/c/f},k={x:s*b,y:a*b},N=G.x*G.y;return Math.abs(N-k.x*k.y)/N<.1?G:k}function I(e,t){return("number"==typeof e?e:(e.x+e.y)/2)*o(t)*k*G}function O(e,t){const{pixelSize:n,extent:o}=e;return I(L(n,t,o),t)}function W(e,t=.01){return o(e)?t/o(e):0}function A(e,t,n,o=!0){const i=e.spatialReference;if(i.equals(t))return e;g();const r=E.execute(e,t,{geographicTransformation:n});return o&&r?(B([e],[r],i,t),r):r}function B(e,t,n,o){const i=te(n,!0),r=te(o,!0),s=W(n,b),a=W(o,b);if(s&&null!=i&&null!=r)for(let l=0;l<e.length;l++){const n=t[l];if(!n)continue;const{x:o}=e[l],{x:c}=n;c>=r[1]-a&&Math.abs(o-i[0])<s?n.x-=r[1]-r[0]:c<=r[0]+a&&Math.abs(o-i[1])<s&&(n.x+=r[1]-r[0])}}function F(e){const{inSR:t,outSR:n,preferPE:o}=e;if(t.equals(n)){const{points:t}=K(e,null);return t}if(t.isWebMercator&&n.isWGS84||t.isWGS84&&n.isWebMercator)return U(e);if(o){if(t.isGeographic)return Y(e);if(null!=J(t))return Y(e)}return q(e)}function q(e){const{points:t}=K(e,null),{inSR:n,outSR:o,datumTransformation:i}=e,r=t.map((e=>new f(e[0],e[1],n))),s=E.executeMany(r,o,{geographicTransformation:i});return i&&B(r,s,n,o),s.map((e=>e?[e.x,e.y]:[NaN,NaN]))}function Y(e){const{inSR:t,outSR:n,datumTransformation:o}=e,i=J(t),{points:a,mask:f}=K(e,i);if(!t.isGeographic){const e=t.wkid?r.coordsys(t.wkid):r.fromString(t.isGeographic?s.PE_TYPE_GEOGCS:s.PE_TYPE_PROJCS,t.wkt2||t.wkt);l.projToGeog(e,a.length,a)}if(null!=o&&o.steps.length){let e;const t=179.9955;if(n.isGeographic&&(e=a.map((([e])=>e>t?1:e<-179.9955?-1:0))),o.steps.forEach((e=>{const t=e.wkid?r.geogtran(e.wkid):r.fromString(s.PE_TYPE_GEOGTRAN,e.wkt);c.geogToGeog(t,a.length,a,null,e.isInverse?s.PE_TRANSFORM_2_TO_1:s.PE_TRANSFORM_1_TO_2)})),e)for(let n=0;n<a.length;n++){const o=e[n],i=a[n][0],r=i>t?1:i<-179.9955?-1:0;o&&r&&o!==r&&(a[n][0]=o>0?i+360:i-360)}}if(!n.isGeographic){const e=J(n,!0),t=null!=e&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90];D(a,t);const o=n.wkid?r.coordsys(n.wkid):r.fromString(n.isGeographic?s.PE_TYPE_GEOGCS:s.PE_TYPE_PROJCS,n.wkt2||n.wkt);l.geogToProj(o,a.length,a)}let u=a;if(f&&a.length!==f.length){u=[];for(let e=0,t=0;e<f.length;e++)f[e]?u.push(a[t++]):u.push([NaN,NaN])}return u}function U(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 u=[],x=[],h=Math.max(t,n);for(let g=0;g<h;g++){const e=l+o*Math.min(t,g),r=c-i*Math.min(n,g),h=m(new f({x:e,y:r,spatialReference:s}),s,a);g<=t&&u.push(h.x),g<=n&&x.push(h.y)}const p=[];for(let f=0;f<t;f++)for(let e=0;e<n;e++)p.push([u[f],x[e]]);return p}function J(e,t=!1){let n=e.wkid||e.wkt2||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),S.has(n)){const e=S.get(n);return t?e?.gcs:e?.pcs}const o=e.wkid?r.coordsys(e.wkid):r.fromString(e.isGeographic?s.PE_TYPE_GEOGCS:s.PE_TYPE_PROJCS,e.wkt2||e.wkt),i=X(o,W(e,1e-4)),a=X(o,0,!0);return S.set(n,{pcs:i,gcs:a}),t?a:i}function X(e,t=0,n=!1){const o=a.generate(e),i=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!o||!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 l=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:l};let u=0;const m=[];let[x,h]=f[0],[p,g]=f[0];for(let a=0,y=f.length;a<y;a++){u++,u===y&&(u=0);const[e,t]=f[a],[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:l}}function K(e,t){const n=[],{cols:o,rows:i,xres:r,yres:s,usePixelCenter:a}=e;let{xmin:l,ymax:c}=e;if(a&&(l+=r/2,c-=s/2),null==t){for(let e=0;e<o;e++)for(let t=0;t<i;t++)n.push([l+r*e,c-s*t]);return{points:n}}const f=new Uint8Array(o*i);if(t.isEnvelope){const{bbox:[e,a,u,m]}=t;for(let x=0,h=0;x<o;x++){const o=l+r*x,p=t.isPannable||o>=e&&o<=u;for(let e=0;e<i;e++,h++){const t=c-s*e;p&&t>=a&&t<=m&&(n.push([o,t]),f[h]=1)}}return{points:n,mask:f}}const u=t.coef,m=[];for(let x=0;x<i;x++){const e=c-s*x,t=[],n=[];for(let i=0;i<u.length;i++){const[o,r,s,a,l]=u[i];if(e===s&&s===a)t.push(o),t.push(r),n.push(2),n.push(2);else if(e>=s&&e<=a){const i=o*e+r;t.push(i),n.push(l)}}let o=t;if(t.length>2){let e=2===n[0]?0:n[0],i=t[0];o=[];for(let r=1;r<n.length;r++)2===n[r]&&r!==n.length-1||(n[r]!==e&&(o.push(0===e?Math.min(i,t[r-1]):Math.max(i,t[r-1])),e=n[r],i=t[r]),r===n.length-1&&o.push(0===n[r]?Math.min(i,t[r]):Math.max(i,t[r])));o.sort(((e,t)=>e-t))}else t[0]>t[1]&&(o=[t[1],t[0]]);m.push(o)}for(let x=0,h=0;x<o;x++){const e=l+r*x;for(let t=0;t<i;t++,h++){const o=c-s*t,i=m[t];if(2===i.length)e>=i[0]&&e<=i[1]&&(n.push([e,o]),f[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&&(n.push([e,o]),f[h]=1)}}}return{points:n,mask:f}}function D(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 H(e,t){const n=ee(e[0].spatialReference);if(e.length<2||null==n)return e[0];if(t=t??W(e[0].spatialReference),1===(e=e.filter((e=>e.width>t))).length)return e[0];let{xmin:o,xmax:r,ymin:s,ymax:a}=e[0];for(let i=1;i<e.length;i++){const t=e[i];r=t.xmax+n*i,s=Math.min(s,t.ymin),a=Math.max(a,t.ymax)}return new i({xmin:o,xmax:r,ymin:s,ymax:a,spatialReference:e[0].spatialReference})}function Q(t,n,o=null,r=!0){const s=t.spatialReference;if(s.equals(n)||!n)return t;const a=oe(t),l=ee(s,!0),c=ee(n);if(0===a||null==l||null==c){const e=$(t,n,o,r);if(e&&null==l&&null!=c&&Math.abs(e.width-c)<W(n)&&E.isLoaded()){const o=J(s);if(null!=o&&o.poleLocation===p.None&&t.width<(o.bbox[2]-o.bbox[0])/2)return Z(t,n)||e}return e}const f=t.clone().normalize();if(1===f.length&&t.xmax<l&&t.xmax-l/2>W(s)){const{xmin:e,xmax:n}=t;for(let o=0;o<=a;o++){const r=0===o?e:-l/2,c=o===a?n-l*o:l/2;f[o]=new i({xmin:r,xmax:c,ymin:t.ymin,ymax:t.ymax,spatialReference:s})}}const u=f.map((e=>$(e,n,o,r))).filter(e);return 0===u.length?null:H(u)}function V(e,t,n){if("extent"===e.type){const{xmin:t,ymin:n,xmax:o,ymax:i,spatialReference:r}=e;e=new u({rings:[[[t,i],[o,i],[o,n],[t,n],[t,i]]],spatialReference:r})}return e.spatialReference.equals(t)?e:(g(),E.execute(e,t,{geographicTransformation:n}))}function Z(e,t){const n=ee(t);if(null==n)return null;let{xmin:o,ymin:r,xmax:s,ymax:a}=e;const l=e.spatialReference,c=new u({spatialReference:l,rings:[[[o,r],[s,r],[s,a],[o,a],[o,r]]]}),f=E.execute(c,t);if(2!==f.rings.length||!f.rings[0].length||!f.rings[1].length)return null;const{rings:m}=f,x=W(l),h=new i({spatialReference:t});for(let i=0;i<2;i++){o=s=m[i][0][0],r=a=m[i][0][1];for(let e=0;e<m[i].length;e++)o=o>m[i][e][0]?m[i][e][0]:o,s=s<m[i][e][0]?m[i][e][0]:s,r=r>m[i][e][1]?m[i][e][1]:r,a=a<m[i][e][1]?m[i][e][1]:a;if(0===i)h.ymin=r,h.ymax=a,h.xmin=o,h.xmax=s;else if(h.ymin=Math.min(h.ymin,r),h.ymax=Math.max(h.ymax,a),Math.abs(s-n/2)<x)h.xmin=o,h.xmax=h.xmax+n;else{if(!(Math.abs(o+n/2)<x))return null;h.xmax=s+n}}return h}function $(e,t,n,o=!0,i=!0){const r=e.spatialReference;if(r.equals(t)||!t)return e;g();const s=E.execute(e,t,{geographicTransformation:n});if(i&&t.isWebMercator&&s&&(s.ymax=Math.min(20037508.342787,s.ymax),s.ymin=Math.max(-20037508.342787,s.ymin),s.ymin>=s.ymax))return null;if(!o||!s)return s;const a=te(r,!0),l=te(t,!0);if(null==a||null==l)return s;const c=W(r,.001),u=W(r,b),m=W(t,.001);if(Math.abs(s.xmin-l[0])<m&&Math.abs(s.xmax-l[1])<m){const o=Math.abs(e.xmin-a[0]),i=Math.abs(a[1]-e.xmax);if(o<c&&i>u){s.xmin=l[0];const o=[];o.push(new f(e.xmax,e.ymin,r)),o.push(new f(e.xmax,(e.ymin+e.ymax)/2,r)),o.push(new f(e.xmax,e.ymax,r));const i=o.map((e=>A(e,t,n))).filter((e=>!isNaN(e?.x))).map((e=>e.x));s.xmax=Math.max.apply(null,i)}if(i<c&&o>u){s.xmax=l[1];const o=[];o.push(new f(e.xmin,e.ymin,r)),o.push(new f(e.xmin,(e.ymin+e.ymax)/2,r)),o.push(new f(e.xmin,e.ymax,r));const i=o.map((e=>A(e,t,n))).filter((e=>!isNaN(e?.x))).map((e=>e.x));s.xmin=Math.min.apply(null,i)}}else{const e=W(t,.001);Math.abs(s.xmin-l[0])<e&&(s.xmin=l[0]),Math.abs(s.xmax-l[1])<e&&(s.xmax=l[1])}return s}function ee(e,t=!1){if(!e)return null;const n=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*n:e.wkid&&e.isGeographic?360:2*d[e.wkid]||null}function te(e,t=!1){if(e.isGeographic)return[-180,180];const n=ee(e,t);return null!=n?[-n/2,n/2]:null}function ne(e,t,n,o){let i=(e-t)/n;return i-Math.floor(i)!=0?i=Math.floor(i):o&&(i-=1),i}function oe(e,t=!1){const n=ee(e.spatialReference);if(null==n)return 0;const o=t?0:-(n/2),i=W(e.spatialReference),r=!t&&Math.abs(e.xmax-n/2)<i?n/2:e.xmax,s=!t&&Math.abs(e.xmin+n/2)<i?-n/2:e.xmin;return ne(r,o,n,!0)-ne(s,o,n,!1)}function ie(e){const t=e.storageInfo.origin.x,n=ee(e.spatialReference,!0);if(null==n)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};const o=n/2,{nativePixelSize:i,storageInfo:r,extent:s}=e,{maximumPyramidLevel:a,blockWidth:l,pyramidScalingFactor:c}=r;let f=i.x;const u=[],m=null!=e.transform&&"gcs-shift"===e.transform.type,x=t+(m?0:o),h=m?n-t:o-t;for(let p=0;p<=a;p++){const e=(s.xmax-t)/f/l,n=e-Math.floor(e)==0?e:Math.ceil(e),o=h/f/l,i=o-Math.floor(o)==0?o:Math.ceil(o),r=Math.floor(x/f/l),a=Math.round(x/f)%l,m=(l-Math.round(h/f)%l)%l;u.push({resolutionX:f,blockWidth:l,datasetColumnCount:n,worldColumnCountFromOrigin:i,leftMargin:a,rightPadding:m,originColumnOffset:r}),f*=c}return{originX:t,halfWorldWidth:o,pyramidsInfo:u,hasGCSSShiftTransform:m}}function re(e){if(!e||e.isGeographic)return e;const t=String(e.wkid||e.wkt2||e.wkt);let n;if(P.has(t))n=P.get(t);else{n=(e.wkid?r.coordsys(e.wkid):r.fromString(s.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),P.set(t,n)}return new x({wkid:n})}function se(e){const t=e.isAdaptive&&null==e.spacing;let n=e.spacing||[w,w],o=ae(e),i={cols:o.size[0]+1,rows:o.size[1]+1};const r=o.outofBoundPointCount>0&&o.outofBoundPointCount<o.offsets.length/2;let s=o.outofBoundPointCount===o.offsets.length/2||t&&r?[0,0]:y(o.offsets,i,n,R);const a=(s[0]+s[1])/2,l=e.projectedExtent.spatialReference,c=e.srcBufferExtent.spatialReference;if(t&&(r||a>R)&&(l.isGeographic||J(l),n=[M,M],o=ae({...e,spacing:n}),i={cols:o.size[0]+1,rows:o.size[1]+1},s=y(o.offsets,i,n,R)),o.error=s,n[0]>1&&(o.coefficients=le(o.offsets,i,r)),e.includeGCSGrid&&!l.isGeographic&&!l.isWebMercator)if(c.isGeographic)o.gcsGrid={offsets:o.offsets,coefficients:o.coefficients,spacing:n};else{const t=J(l);if(null!=t&&!t.isEnvelope){const t=re(l),s=Q(e.projectedExtent,t),{offsets:a}=ae({...e,srcBufferExtent:s,spacing:n}),c=le(a,i,r);o.gcsGrid={offsets:a,coefficients:c,spacing:n}}}return o}function ae(e){const{projectedExtent:t,srcBufferExtent:n,pixelSize:o,datumTransformation:i,rasterTransform:r}=e,s=t.spatialReference,a=n.spatialReference;g();const{xmin:l,ymin:c,xmax:u,ymax:m}=t,x=ee(a),h=null!=x&&(e.hasWrapAround||"gcs-shift"===r?.type),p=e.spacing||[w,w],y=p[0]*o.x,d=p[1]*o.y,R=1===p[0],S=Math.ceil((u-l)/y-.1/p[0])+(R?0:1),P=Math.ceil((m-c)/d-.1/p[1])+(R?0:1),G=F({cols:S,rows:P,xmin:l,ymax:m,xres:y,yres:d,inSR:s,outSR:a,datumTransformation:i,preferPE:p[0]<=M,usePixelCenter:R}),k=[];let N,E=0;const T=R?-1:NaN,{xmin:j,xmax:v,ymax:C,width:_,height:z}=n,L=W(a,b),I=null!=x&&j>0&&v>x/2,O=J(s),A=null!=O&&O.poleLocation>0;for(let g=0;g<S;g++){const e=[];for(let t=0;t<P;t++){let n=G[g*P+t];if(h&&n[0]>v&&n[0]>x/2-L?n[0]-=x:h&&0===g&&n[0]<0&&I&&!r&&(n[0]+=x),!n||isNaN(n[0])||isNaN(n[1]))k.push(T),k.push(T),e.push(null),E++;else{if(r){const e=r.inverseTransform(new f({x:n[0],y:n[1],spatialReference:a}));n=[e.x,e.y]}e.push(n),g>0&&h&&N[t]&&n[0]<N[t][0]&&(n[0]+=x,A&&n[0]>v&&n[0]>x&&(n[0]-=x)),k.push((n[0]-j)/_),k.push((C-n[1])/z)}}N=e}return{offsets:k,error:null,coefficients:null,outofBoundPointCount:E,spacing:p,size:R?[S,P]:[S-1,P-1]}}function le(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 ce(e,t){const n=e.clone().normalize();return 1===n.length?n[0]:H(n,t)}function fe(e){const{spatialReference:t}=e,n=h(t);if(!n)return e;const[o,r]=n.valid,s=r-o;let a=0;if(e.xmin<o){const t=o-e.xmin;a=Math.ceil(t/s)}else if(e.xmin>r){const t=e.xmin-r;a=-Math.ceil(t/s)}return new i({spatialReference:e.spatialReference,xmin:e.xmin+a*s,ymin:e.ymin,xmax:e.xmax+a*s,ymax:e.ymax})}function ue(e,t,n){const{storageInfo:i,pixelSize:r}=t;let s=0,a=!1;const{pyramidResolutions:l}=i,c="mixed"===i.tileInfo.format?.toLowerCase()?Math.max(1,Math.min(3,i.tileInfo.dpi/96)):1,u=(e.x+e.y)/2/c;if(null!=l&&l.length){const e=l[l.length-1],i=(e.x+e.y)/2,c=(r.x+r.y)/2;if(u<=c)s=0;else if(u>=i)s=l.length,a=u/i>8;else{let e,t=c;for(let o=1;o<=l.length;o++){if(e=(l[o-1].x+l[o-1].y)/2,u<=e){u===e?s=o:"down"===n?(s=o-1,a=u/t>8):s="up"===n||u-t>e-u||u/t>2?o:o-1;break}t=e}}const m=0===s?r:l[s-1];if(a){Math.min(m.x,m.y)*o(t.spatialReference)>19567&&(a=!1)}return{pyramidLevel:s,pyramidResolution:new f({x:m.x,y:m.y,spatialReference:t.spatialReference}),excessiveReading:a}}const m=Math.log(e.x/r.x)/Math.LN2,x=Math.log(e.y/r.y)/Math.LN2,h=t.storageInfo.maximumPyramidLevel||0;s="down"===n?Math.floor(Math.min(m,x)):"up"===n?Math.ceil(Math.max(m,x)):Math.round((m+x)/2),s<0?s=0:s>h&&(a=s>h+3,s=h);const p=2**s;return{pyramidLevel:s,pyramidResolution:new f({x:p*t.nativePixelSize.x,y:p*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:a}}function me(e,t,n=!1){const{pixelSize:o,extent:i}=e,r=C(i,t,!1),s=Q(ce(i,(o.x+o.y)/16),t,r);return!s||n||0===oe(s)?s:$(i,t,r)}function xe(e,t,n){const o=n?.tileSize??512,i=n?.alignGlobalDatasetWithAGOL??!0,r=!!n?.limitToSrcResolution,{extent:s,spatialReference:a,pixelSize:l}=e,c=L(l,t,s);if(null==c)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const f=(c.x+c.y)/2,u=I(f,t),m=t.isGeographic?256/o*295828763.7958547:256/o*591657527.591555;let h="vector-magdir"===e.dataType||"vector-uv"===e.dataType;const p=me(e,t,!0),g=Math.min(Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2),Math.ceil(Math.log(m/2/u)/Math.LN2));if(!h&&p&&i&&(t.isGeographic||t.isWebMercator)){const n=ee(t);if(h=oe(p)>0||null!=n&&p.width>n/4,!h&&null!=n){let t=-1;if(g<3)t=2**g*f*o;else if(e.storageInfo){const{maximumPyramidLevel:n=0,pyramidScalingFactor:i=2}=e.storageInfo;t=i**n*f*o}const i=Math.ceil(n/t);h=1===i||2===i&&n/2-p.xmax<t}}let y,d=u;const w=1.001,M=Math.min(2,Math.max(1.414,e.storageInfo?.pyramidScalingFactor||2));if(h){d=m;const n=t.isGeographic?1341104507446289e-21:.29858214164761665,o=I(n,t),i=t.isGeographic?4326:3857;y=L({x:n,y:n},a,me(e,new x({wkid:i}),!0)),y.x*=d/o,y.y*=d/o}else{y={x:l.x,y:l.y};let e=0;for(;d<m*(w/2)&&e<g;)e++,d*=M,y.x*=M,y.y*=M;Math.max(d,m)/Math.min(d,m)<=w&&(d=m)}const R=[d],S=[{x:y.x,y:y.y}],P=70.5310735,b=Math.min(P,u)/w;for(;d>=b;)d/=M,y.x/=M,y.y/=M,R.push(d),S.push({x:y.x,y:y.y});if(r){const e=.001*l.x;let t=S.findIndex((t=>t.x>=l.x-e&&t.x<=l.x+e));t>-1?(S.length=t+1,R.length=t+1):(t=S.findIndex((t=>t.x<=l.x+e)),t>0&&(S.length=t,R.length=t))}return{projectedPixelSize:c,scales:R,srcResolutions:S,isCustomTilingScheme:!h}}function he(e){let t=0;for(const n of e){const e=n.length;let o=n[0][0]*(n[1][1]-n[e-2][1]);for(let t=1;t<e-1;t++)o+=n[t][0]*(n[t+1][1]-n[t-1][1]);t+=o/2}return Math.abs(t)}export{xe as computeProjectedScales,w as defaultGridSpacing,R as defaultProjectionToleranceInPixels,C as getDefaultDatumTransformationForDataset,F as getProjectedGridPoints,se as getProjectionOffsetGrid,ie as getRasterDatasetAlignmentInfo,O as getSourceScale,ee as getWorldWidth,oe as getWorldWrapCount,v as load,M as minimumGridSpacing,me as projectDatasetExtent,L as projectDatasetResolution,Q as projectExtent,A as projectPoint,V as projectPolygon,_ as projectResolution,fe as shiftExtent,ce as snapExtent,ue as snapPyramid};
5
+ import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{createResolver as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import i from"../../../geometry/Extent.js";import{P as r,a as s,g as a,h as l,j as c}from"../../../chunks/pe.js";import f from"../../../geometry/Point.js";import u from"../../../geometry/Polygon.js";import{projectWithoutEngine as m}from"../../../geometry/projection.js";import x from"../../../geometry/SpatialReference.js";import{getInfo as h}from"../../../geometry/support/spatialReferenceUtils.js";var p;function g(){if(!j)throw new t("rasterprojectionhelper-project","projection operator is not loaded")}!function(e){e[e.None=0]="None",e[e.North=1]="North",e[e.South=2]="South",e[e.Both=3]="Both"}(p||(p={}));const y=(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},d={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},w=32,M=4,R=M,S=new Map,P=new Map,b=500,G=39.37,k=96;let N,E,T,j=!1;async function v(){return N||(N=n(),E=await import("../../../geometry/operators/projectOperator.js"),T=await import("../../../geometry/operators/support/geographicTransformationUtils.js"),E.isLoaded()||await E.load(),T.isLoaded()||await T.load(),j=!0,N.resolve()),N.promise}function C(e,t,n){if(g(),n){const n=E.execute(e,t);return T.getTransformation(t,e.spatialReference,n)}return T.getTransformation(e.spatialReference,t,e)}function _(e,t,n,o){const r=e.spatialReference;if(!r||!t||r.equals(t))return e;g();const s=n.center,a=new i({xmin:s.x-e.x/2,xmax:s.x+e.x/2,ymin:s.y-e.y/2,ymax:s.y+e.y/2,spatialReference:r}),l=E.execute(a,t,{geographicTransformation:o}),c=ee(t);return null==l||null!=c&&l.width>=c?z(e,r,t):{x:l.width,y:l.height}}function z(e,t,n){const i=o(t)/o(n);return{x:e.x*i,y:e.y*i}}function L(e,n,i){const{spatialReference:r}=i;if(!r||!n||r.equals(n))return e;if(r.isGeographic&&n.isGeographic)return z(e,r,n);if(g(),!j)throw new t("raster-projection-helper:project-dataset-resolution","geometry engine is not loaded");let{x:s,y:a}=e;const l=(s+a)/2*o(r);let c=1;l>30&&(c=30/l,s*=c,a*=c);const f=256,m=s*f/2,x=a*f/2,{x:h,y:p}=i.center,y=[];for(let t=0;t<=f;t++)y.push([h-m,p-x+t*a]);for(let t=1;t<=f;t++)y.push([h-m+t*s,p+x]);for(let t=1;t<=f;t++)y.push([h+m,p+x-t*a]);for(let t=1;t<f;t++)y.push([h+m-t*s,p-x]);y.push(y[0]);const d=new u({rings:[y],spatialReference:r}),w=E.execute(d,n);if(!w)return z(e,r,n);const M=w.extent,R=ee(n);if(null==M||null!=R&&M.width>=R)return z(e,r,n);const S=he(w.rings),P=s*a*f*f,b=Math.sqrt(S/P)/c,G={x:M.width/c/f,y:M.height/c/f},k={x:s*b,y:a*b},N=G.x*G.y;return Math.abs(N-k.x*k.y)/N<.1?G:k}function I(e,t){return("number"==typeof e?e:(e.x+e.y)/2)*o(t)*k*G}function O(e,t){const{pixelSize:n,extent:o}=e;return I(L(n,t,o),t)}function W(e,t=.01){return o(e)?t/o(e):0}function A(e,t,n,o=!0){const i=e.spatialReference;if(i.equals(t))return e;g();const r=E.execute(e,t,{geographicTransformation:n});return o&&r?(B([e],[r],i,t),r):r}function B(e,t,n,o){const i=te(n,!0),r=te(o,!0),s=W(n,b),a=W(o,b);if(s&&null!=i&&null!=r)for(let l=0;l<e.length;l++){const n=t[l];if(!n)continue;const{x:o}=e[l],{x:c}=n;c>=r[1]-a&&Math.abs(o-i[0])<s?n.x-=r[1]-r[0]:c<=r[0]+a&&Math.abs(o-i[1])<s&&(n.x+=r[1]-r[0])}}function F(e){const{inSR:t,outSR:n,preferPE:o}=e;if(t.equals(n)){const{points:t}=K(e,null);return t}if(t.isWebMercator&&n.isWGS84||t.isWGS84&&n.isWebMercator)return U(e);if(o){if(t.isGeographic)return Y(e);if(null!=J(t))return Y(e)}return q(e)}function q(e){const{points:t}=K(e,null),{inSR:n,outSR:o,datumTransformation:i}=e,r=t.map((e=>new f(e[0],e[1],n))),s=E.executeMany(r,o,{geographicTransformation:i});return i&&B(r,s,n,o),s.map((e=>e?[e.x,e.y]:[NaN,NaN]))}function Y(e){const{inSR:t,outSR:n,datumTransformation:o}=e,i=J(t),{points:a,mask:f}=K(e,i);if(!t.isGeographic){const e=t.wkid?r.coordsys(t.wkid):r.fromString(t.isGeographic?s.PE_TYPE_GEOGCS:s.PE_TYPE_PROJCS,t.wkt2||t.wkt);l.projToGeog(e,a.length,a)}if(null!=o&&o.steps.length){let e;const t=179.9955;if(n.isGeographic&&(e=a.map((([e])=>e>t?1:e<-179.9955?-1:0))),o.steps.forEach((e=>{const t=e.wkid?r.geogtran(e.wkid):r.fromString(s.PE_TYPE_GEOGTRAN,e.wkt);c.geogToGeog(t,a.length,a,null,e.isInverse?s.PE_TRANSFORM_2_TO_1:s.PE_TRANSFORM_1_TO_2)})),e)for(let n=0;n<a.length;n++){const o=e[n],i=a[n][0],r=i>t?1:i<-179.9955?-1:0;o&&r&&o!==r&&(a[n][0]=o>0?i+360:i-360)}}if(!n.isGeographic){const e=J(n,!0),t=null!=e&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90];D(a,t);const o=n.wkid?r.coordsys(n.wkid):r.fromString(n.isGeographic?s.PE_TYPE_GEOGCS:s.PE_TYPE_PROJCS,n.wkt2||n.wkt);l.geogToProj(o,a.length,a)}let u=a;if(f&&a.length!==f.length){u=[];for(let e=0,t=0;e<f.length;e++)f[e]?u.push(a[t++]):u.push([NaN,NaN])}return u}function U(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 u=[],x=[],h=Math.max(t,n);for(let g=0;g<h;g++){const e=l+o*Math.min(t,g),r=c-i*Math.min(n,g),h=m(new f({x:e,y:r,spatialReference:s}),s,a);g<=t&&u.push(h.x),g<=n&&x.push(h.y)}const p=[];for(let f=0;f<t;f++)for(let e=0;e<n;e++)p.push([u[f],x[e]]);return p}function J(e,t=!1){let n=e.wkid||e.wkt2||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),S.has(n)){const e=S.get(n);return t?e?.gcs:e?.pcs}const o=e.wkid?r.coordsys(e.wkid):r.fromString(e.isGeographic?s.PE_TYPE_GEOGCS:s.PE_TYPE_PROJCS,e.wkt2||e.wkt),i=X(o,W(e,1e-4)),a=X(o,0,!0);return S.set(n,{pcs:i,gcs:a}),t?a:i}function X(e,t=0,n=!1){const o=a.generate(e),i=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!o||!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 l=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:l};let u=0;const m=[];let[x,h]=f[0],[p,g]=f[0];for(let a=0,y=f.length;a<y;a++){u++,u===y&&(u=0);const[e,t]=f[a],[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:l}}function K(e,t){const n=[],{cols:o,rows:i,xres:r,yres:s,usePixelCenter:a}=e;let{xmin:l,ymax:c}=e;if(a&&(l+=r/2,c-=s/2),null==t){for(let e=0;e<o;e++)for(let t=0;t<i;t++)n.push([l+r*e,c-s*t]);return{points:n}}const f=new Uint8Array(o*i);if(t.isEnvelope){const{bbox:[e,a,u,m]}=t;for(let x=0,h=0;x<o;x++){const o=l+r*x,p=t.isPannable||o>=e&&o<=u;for(let e=0;e<i;e++,h++){const t=c-s*e;p&&t>=a&&t<=m&&(n.push([o,t]),f[h]=1)}}return{points:n,mask:f}}const u=t.coef,m=[];for(let x=0;x<i;x++){const e=c-s*x,t=[],n=[];for(let i=0;i<u.length;i++){const[o,r,s,a,l]=u[i];if(e===s&&s===a)t.push(o),t.push(r),n.push(2),n.push(2);else if(e>=s&&e<=a){const i=o*e+r;t.push(i),n.push(l)}}let o=t;if(t.length>2){let e=2===n[0]?0:n[0],i=t[0];o=[];for(let r=1;r<n.length;r++)2===n[r]&&r!==n.length-1||(n[r]!==e&&(o.push(0===e?Math.min(i,t[r-1]):Math.max(i,t[r-1])),e=n[r],i=t[r]),r===n.length-1&&o.push(0===n[r]?Math.min(i,t[r]):Math.max(i,t[r])));o.sort(((e,t)=>e-t))}else t[0]>t[1]&&(o=[t[1],t[0]]);m.push(o)}for(let x=0,h=0;x<o;x++){const e=l+r*x;for(let t=0;t<i;t++,h++){const o=c-s*t,i=m[t];if(2===i.length)e>=i[0]&&e<=i[1]&&(n.push([e,o]),f[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&&(n.push([e,o]),f[h]=1)}}}return{points:n,mask:f}}function D(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 H(e,t){const n=ee(e[0].spatialReference);if(e.length<2||null==n)return e[0];if(t=t??W(e[0].spatialReference),1===(e=e.filter((e=>e.width>t))).length)return e[0];let{xmin:o,xmax:r,ymin:s,ymax:a}=e[0];for(let i=1;i<e.length;i++){const t=e[i];r=t.xmax+n*i,s=Math.min(s,t.ymin),a=Math.max(a,t.ymax)}return new i({xmin:o,xmax:r,ymin:s,ymax:a,spatialReference:e[0].spatialReference})}function Q(t,n,o=null,r=!0){const s=t.spatialReference;if(s.equals(n)||!n)return t;const a=oe(t),l=ee(s,!0),c=ee(n);if(0===a||null==l||null==c){const e=$(t,n,o,r);if(e&&null==l&&null!=c&&Math.abs(e.width-c)<W(n)&&E.isLoaded()){const o=J(s);if(null!=o&&o.poleLocation===p.None&&t.width<(o.bbox[2]-o.bbox[0])/2)return Z(t,n)||e}return e}const f=t.clone().normalize();if(1===f.length&&t.xmax<l&&t.xmax-l/2>W(s)){const{xmin:e,xmax:n}=t;for(let o=0;o<=a;o++){const r=0===o?e:-l/2,c=o===a?n-l*o:l/2;f[o]=new i({xmin:r,xmax:c,ymin:t.ymin,ymax:t.ymax,spatialReference:s})}}const u=f.map((e=>$(e,n,o,r))).filter(e);return 0===u.length?null:H(u)}function V(e,t,n){if("extent"===e.type){const{xmin:t,ymin:n,xmax:o,ymax:i,spatialReference:r}=e;e=new u({rings:[[[t,i],[o,i],[o,n],[t,n],[t,i]]],spatialReference:r})}return e.spatialReference.equals(t)?e:(g(),E.execute(e,t,{geographicTransformation:n}))}function Z(e,t){const n=ee(t);if(null==n)return null;let{xmin:o,ymin:r,xmax:s,ymax:a}=e;const l=e.spatialReference,c=new u({spatialReference:l,rings:[[[o,r],[s,r],[s,a],[o,a],[o,r]]]}),f=E.execute(c,t);if(2!==f.rings.length||!f.rings[0].length||!f.rings[1].length)return null;const{rings:m}=f,x=W(l),h=new i({spatialReference:t});for(let i=0;i<2;i++){o=s=m[i][0][0],r=a=m[i][0][1];for(let e=0;e<m[i].length;e++)o=o>m[i][e][0]?m[i][e][0]:o,s=s<m[i][e][0]?m[i][e][0]:s,r=r>m[i][e][1]?m[i][e][1]:r,a=a<m[i][e][1]?m[i][e][1]:a;if(0===i)h.ymin=r,h.ymax=a,h.xmin=o,h.xmax=s;else if(h.ymin=Math.min(h.ymin,r),h.ymax=Math.max(h.ymax,a),Math.abs(s-n/2)<x)h.xmin=o,h.xmax=h.xmax+n;else{if(!(Math.abs(o+n/2)<x))return null;h.xmax=s+n}}return h}function $(e,t,n,o=!0,i=!0){const r=e.spatialReference;if(r.equals(t)||!t)return e;g();const s=E.execute(e,t,{geographicTransformation:n});if(i&&t.isWebMercator&&s&&(s.ymax=Math.min(20037508.342787,s.ymax),s.ymin=Math.max(-20037508.342787,s.ymin),s.ymin>=s.ymax))return null;if(!o||!s)return s;const a=te(r,!0),l=te(t,!0);if(null==a||null==l)return s;const c=W(r,.001),u=W(r,b),m=W(t,.001);if(Math.abs(s.xmin-l[0])<m&&Math.abs(s.xmax-l[1])<m){const o=Math.abs(e.xmin-a[0]),i=Math.abs(a[1]-e.xmax);if(o<c&&i>u){s.xmin=l[0];const o=[];o.push(new f(e.xmax,e.ymin,r)),o.push(new f(e.xmax,(e.ymin+e.ymax)/2,r)),o.push(new f(e.xmax,e.ymax,r));const i=o.map((e=>A(e,t,n))).filter((e=>!isNaN(e?.x))).map((e=>e.x));s.xmax=Math.max.apply(null,i)}if(i<c&&o>u){s.xmax=l[1];const o=[];o.push(new f(e.xmin,e.ymin,r)),o.push(new f(e.xmin,(e.ymin+e.ymax)/2,r)),o.push(new f(e.xmin,e.ymax,r));const i=o.map((e=>A(e,t,n))).filter((e=>!isNaN(e?.x))).map((e=>e.x));s.xmin=Math.min.apply(null,i)}}else{const e=W(t,.001);Math.abs(s.xmin-l[0])<e&&(s.xmin=l[0]),Math.abs(s.xmax-l[1])<e&&(s.xmax=l[1])}return s}function ee(e,t=!1){if(!e)return null;const n=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*n:e.wkid&&e.isGeographic?360:2*d[e.wkid]||null}function te(e,t=!1){if(e.isGeographic)return[-180,180];const n=ee(e,t);return null!=n?[-n/2,n/2]:null}function ne(e,t,n,o){let i=(e-t)/n;return i-Math.floor(i)!==0?i=Math.floor(i):o&&(i-=1),i}function oe(e,t=!1){const n=ee(e.spatialReference);if(null==n)return 0;const o=t?0:-(n/2),i=W(e.spatialReference),r=!t&&Math.abs(e.xmax-n/2)<i?n/2:e.xmax,s=!t&&Math.abs(e.xmin+n/2)<i?-n/2:e.xmin;return ne(r,o,n,!0)-ne(s,o,n,!1)}function ie(e){const t=e.storageInfo.origin.x,n=ee(e.spatialReference,!0);if(null==n)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};const o=n/2,{nativePixelSize:i,storageInfo:r,extent:s}=e,{maximumPyramidLevel:a,blockWidth:l,pyramidScalingFactor:c}=r;let f=i.x;const u=[],m=null!=e.transform&&"gcs-shift"===e.transform.type,x=t+(m?0:o),h=m?n-t:o-t;for(let p=0;p<=a;p++){const e=(s.xmax-t)/f/l,n=e-Math.floor(e)===0?e:Math.ceil(e),o=h/f/l,i=o-Math.floor(o)===0?o:Math.ceil(o),r=Math.floor(x/f/l),a=Math.round(x/f)%l,m=(l-Math.round(h/f)%l)%l;u.push({resolutionX:f,blockWidth:l,datasetColumnCount:n,worldColumnCountFromOrigin:i,leftMargin:a,rightPadding:m,originColumnOffset:r}),f*=c}return{originX:t,halfWorldWidth:o,pyramidsInfo:u,hasGCSSShiftTransform:m}}function re(e){if(!e||e.isGeographic)return e;const t=String(e.wkid||e.wkt2||e.wkt);let n;if(P.has(t))n=P.get(t);else{n=(e.wkid?r.coordsys(e.wkid):r.fromString(s.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),P.set(t,n)}return new x({wkid:n})}function se(e){const t=e.isAdaptive&&null==e.spacing;let n=e.spacing||[w,w],o=ae(e),i={cols:o.size[0]+1,rows:o.size[1]+1};const r=o.outofBoundPointCount>0&&o.outofBoundPointCount<o.offsets.length/2;let s=o.outofBoundPointCount===o.offsets.length/2||t&&r?[0,0]:y(o.offsets,i,n,R);const a=(s[0]+s[1])/2,l=e.projectedExtent.spatialReference,c=e.srcBufferExtent.spatialReference;if(t&&(r||a>R)&&(l.isGeographic||J(l),n=[M,M],o=ae({...e,spacing:n}),i={cols:o.size[0]+1,rows:o.size[1]+1},s=y(o.offsets,i,n,R)),o.error=s,n[0]>1&&(o.coefficients=le(o.offsets,i,r)),e.includeGCSGrid&&!l.isGeographic&&!l.isWebMercator)if(c.isGeographic)o.gcsGrid={offsets:o.offsets,coefficients:o.coefficients,spacing:n};else{const t=J(l);if(null!=t&&!t.isEnvelope){const t=re(l),s=Q(e.projectedExtent,t),{offsets:a}=ae({...e,srcBufferExtent:s,spacing:n}),c=le(a,i,r);o.gcsGrid={offsets:a,coefficients:c,spacing:n}}}return o}function ae(e){const{projectedExtent:t,srcBufferExtent:n,pixelSize:o,datumTransformation:i,rasterTransform:r}=e,s=t.spatialReference,a=n.spatialReference;g();const{xmin:l,ymin:c,xmax:u,ymax:m}=t,x=ee(a),h=null!=x&&(e.hasWrapAround||"gcs-shift"===r?.type),p=e.spacing||[w,w],y=p[0]*o.x,d=p[1]*o.y,R=1===p[0],S=Math.ceil((u-l)/y-.1/p[0])+(R?0:1),P=Math.ceil((m-c)/d-.1/p[1])+(R?0:1),G=F({cols:S,rows:P,xmin:l,ymax:m,xres:y,yres:d,inSR:s,outSR:a,datumTransformation:i,preferPE:p[0]<=M,usePixelCenter:R}),k=[];let N,E=0;const T=R?-1:NaN,{xmin:j,xmax:v,ymax:C,width:_,height:z}=n,L=W(a,b),I=null!=x&&j>0&&v>x/2,O=J(s),A=null!=O&&O.poleLocation>0;for(let g=0;g<S;g++){const e=[];for(let t=0;t<P;t++){let n=G[g*P+t];if(h&&n[0]>v&&n[0]>x/2-L?n[0]-=x:h&&0===g&&n[0]<0&&I&&!r&&(n[0]+=x),!n||isNaN(n[0])||isNaN(n[1]))k.push(T),k.push(T),e.push(null),E++;else{if(r){const e=r.inverseTransform(new f({x:n[0],y:n[1],spatialReference:a}));n=[e.x,e.y]}e.push(n),g>0&&h&&N[t]&&n[0]<N[t][0]&&(n[0]+=x,A&&n[0]>v&&n[0]>x&&(n[0]-=x)),k.push((n[0]-j)/_),k.push((C-n[1])/z)}}N=e}return{offsets:k,error:null,coefficients:null,outofBoundPointCount:E,spacing:p,size:R?[S,P]:[S-1,P-1]}}function le(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 ce(e,t){const n=e.clone().normalize();return 1===n.length?n[0]:H(n,t)}function fe(e){const{spatialReference:t}=e,n=h(t);if(!n)return e;const[o,r]=n.valid,s=r-o;let a=0;if(e.xmin<o){const t=o-e.xmin;a=Math.ceil(t/s)}else if(e.xmin>r){const t=e.xmin-r;a=-Math.ceil(t/s)}return new i({spatialReference:e.spatialReference,xmin:e.xmin+a*s,ymin:e.ymin,xmax:e.xmax+a*s,ymax:e.ymax})}function ue(e,t,n){const{storageInfo:i,pixelSize:r}=t;let s=0,a=!1;const{pyramidResolutions:l}=i,c="mixed"===i.tileInfo.format?.toLowerCase()?Math.max(1,Math.min(3,i.tileInfo.dpi/96)):1,u=(e.x+e.y)/2/c;if(null!=l&&l.length){const e=l[l.length-1],i=(e.x+e.y)/2,c=(r.x+r.y)/2;if(u<=c)s=0;else if(u>=i)s=l.length,a=u/i>8;else{let e,t=c;for(let o=1;o<=l.length;o++){if(e=(l[o-1].x+l[o-1].y)/2,u<=e){u===e?s=o:"down"===n?(s=o-1,a=u/t>8):s="up"===n||u-t>e-u||u/t>2?o:o-1;break}t=e}}const m=0===s?r:l[s-1];if(a){Math.min(m.x,m.y)*o(t.spatialReference)>19567&&(a=!1)}return{pyramidLevel:s,pyramidResolution:new f({x:m.x,y:m.y,spatialReference:t.spatialReference}),excessiveReading:a}}const m=Math.log(e.x/r.x)/Math.LN2,x=Math.log(e.y/r.y)/Math.LN2,h=t.storageInfo.maximumPyramidLevel||0;s="down"===n?Math.floor(Math.min(m,x)):"up"===n?Math.ceil(Math.max(m,x)):Math.round((m+x)/2),s<0?s=0:s>h&&(a=s>h+3,s=h);const p=2**s;return{pyramidLevel:s,pyramidResolution:new f({x:p*t.nativePixelSize.x,y:p*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:a}}function me(e,t,n=!1){const{pixelSize:o,extent:i}=e,r=C(i,t,!1),s=Q(ce(i,(o.x+o.y)/16),t,r);return!s||n||0===oe(s)?s:$(i,t,r)}function xe(e,t,n){const o=n?.tileSize??512,i=n?.alignGlobalDatasetWithAGOL??!0,r=!!n?.limitToSrcResolution,{extent:s,spatialReference:a,pixelSize:l}=e,c=L(l,t,s);if(null==c)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const f=(c.x+c.y)/2,u=I(f,t),m=t.isGeographic?256/o*295828763.7958547:256/o*591657527.591555;let h="vector-magdir"===e.dataType||"vector-uv"===e.dataType;const p=me(e,t,!0),g=Math.min(Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2),Math.ceil(Math.log(m/2/u)/Math.LN2));if(!h&&p&&i&&(t.isGeographic||t.isWebMercator)){const n=ee(t);if(h=oe(p)>0||null!=n&&p.width>n/4,!h&&null!=n){let t=-1;if(g<3)t=2**g*f*o;else if(e.storageInfo){const{maximumPyramidLevel:n=0,pyramidScalingFactor:i=2}=e.storageInfo;t=i**n*f*o}const i=Math.ceil(n/t);h=1===i||2===i&&n/2-p.xmax<t}}let y,d=u;const w=1.001,M=Math.min(2,Math.max(1.414,e.storageInfo?.pyramidScalingFactor||2));if(h){d=m;const n=t.isGeographic?1341104507446289e-21:.29858214164761665,o=I(n,t),i=t.isGeographic?4326:3857;y=L({x:n,y:n},a,me(e,new x({wkid:i}),!0)),y.x*=d/o,y.y*=d/o}else{y={x:l.x,y:l.y};let e=0;for(;d<m*(w/2)&&e<g;)e++,d*=M,y.x*=M,y.y*=M;Math.max(d,m)/Math.min(d,m)<=w&&(d=m)}const R=[d],S=[{x:y.x,y:y.y}],P=70.5310735,b=Math.min(P,u)/w;for(;d>=b;)d/=M,y.x/=M,y.y/=M,R.push(d),S.push({x:y.x,y:y.y});if(r){const e=.001*l.x;let t=S.findIndex((t=>t.x>=l.x-e&&t.x<=l.x+e));t>-1?(S.length=t+1,R.length=t+1):(t=S.findIndex((t=>t.x<=l.x+e)),t>0&&(S.length=t,R.length=t))}return{projectedPixelSize:c,scales:R,srcResolutions:S,isCustomTilingScheme:!h}}function he(e){let t=0;for(const n of e){const e=n.length;let o=n[0][0]*(n[1][1]-n[e-2][1]);for(let t=1;t<e-1;t++)o+=n[t][0]*(n[t+1][1]-n[t-1][1]);t+=o/2}return Math.abs(t)}export{xe as computeProjectedScales,w as defaultGridSpacing,R as defaultProjectionToleranceInPixels,C as getDefaultDatumTransformationForDataset,F as getProjectedGridPoints,se as getProjectionOffsetGrid,ie as getRasterDatasetAlignmentInfo,O as getSourceScale,ee as getWorldWidth,oe as getWorldWrapCount,v as load,M as minimumGridSpacing,me as projectDatasetExtent,L as projectDatasetResolution,Q as projectExtent,A as projectPoint,V as projectPolygon,_ as projectResolution,fe as shiftExtent,ce as snapExtent,ue as snapPyramid};