@arcgis/core 4.32.0-next.20250211 → 4.32.0-next.20250213

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 (251) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/04f9fb33fb2e33712290.js +1 -0
  3. package/assets/esri/core/workers/chunks/0b8bf1966653c326e95a.js +1 -0
  4. package/assets/esri/core/workers/chunks/{a4a9b4f792d47566fbf4.js → 17213c3fc63f580e5b73.js} +1 -1
  5. package/assets/esri/core/workers/chunks/1a6b6d43eda7986d2349.js +1 -0
  6. package/assets/esri/core/workers/chunks/{12d6baeffd55a98a7c75.js → 1bf646c9fc352f98d1ca.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1c357cdb067e28aff3f0.js +1 -0
  8. package/assets/esri/core/workers/chunks/{9a237b396518b1c67f19.js → 24964548c6a3e2eb527d.js} +1 -1
  9. package/assets/esri/core/workers/chunks/272662e4e28341419b4f.js +1 -0
  10. package/assets/esri/core/workers/chunks/31f0dd191602b93c02c2.js +1 -0
  11. package/assets/esri/core/workers/chunks/{74844334b3a2100220fc.js → 37cfd102b6ab5b959f9d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/3835c2884c55e73dc202.js +1 -0
  13. package/assets/esri/core/workers/chunks/{f429d95eb986f3d215f3.js → 391c200274bbeb92404c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{8ddd4e2e50b8206564a7.js → 3ebdd0701e77bb28c75d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{c0af54cc5938176ce764.js → 3fe7be535affae31de7e.js} +1 -1
  16. package/assets/esri/core/workers/chunks/401b731c0601f4d84ead.js +1 -0
  17. package/assets/esri/core/workers/chunks/4565cfc85f60960e3ea1.js +1 -0
  18. package/assets/esri/core/workers/chunks/4848a3e31632d15dc4ce.js +1 -0
  19. package/assets/esri/core/workers/chunks/4a4739cda8aac510004b.js +1 -0
  20. package/assets/esri/core/workers/chunks/{d0656e9d30eb3a66a8db.js → 4be39bc2d2edd94bdb75.js} +1 -1
  21. package/assets/esri/core/workers/chunks/5328b2de0d1ac2536ecf.js +1 -0
  22. package/assets/esri/core/workers/chunks/{62a1d60ad4bf6469c4dd.js → 584216b52413cf85fecc.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{76794184ba8c2e66745e.js → 629f4621ba6ffdcaa2f9.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{8191dd3d7451b2e7b95e.js → 637e996209e0d241fbf7.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{77bfd4f819096cb754ae.js → 6e92569a4a82592b95dc.js} +1 -1
  26. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +1 -0
  27. package/assets/esri/core/workers/chunks/{50ae86c23efe709f41cc.js → 6fa1f1e431aae1794ce3.js} +1 -1
  28. package/assets/esri/core/workers/chunks/744bdf2bb0cc38e6a7b1.js +1 -0
  29. package/assets/esri/core/workers/chunks/802a390c67f4cdf3d8d9.js +1 -0
  30. package/assets/esri/core/workers/chunks/82facb23dfaba2819bc7.js +1 -0
  31. package/assets/esri/core/workers/chunks/{c26ffbff1115e76bcb0f.js → 86f3a004addc087ad6c6.js} +1 -1
  32. package/assets/esri/core/workers/chunks/8722d05ae9b0aa5162a4.js +1 -0
  33. package/assets/esri/core/workers/chunks/8de4280080296adb1757.js +1 -0
  34. package/assets/esri/core/workers/chunks/9306bfe7ab58e71b75ea.js +1 -0
  35. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +1 -0
  36. package/assets/esri/core/workers/chunks/{1f443b99653708470f31.js → 96d7f47ea8fbf345101c.js} +1 -1
  37. package/assets/esri/core/workers/chunks/a01213d446be33d203e3.js +1 -0
  38. package/assets/esri/core/workers/chunks/a490a988896b0b02f96b.js +1 -0
  39. package/assets/esri/core/workers/chunks/a60db83cabdf689b923b.js +1 -0
  40. package/assets/esri/core/workers/chunks/{df3d1a8d3f11d52eb30d.js → afdbdc1569b56489c14d.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{89e3f7880abd014a62c0.js → b42d26123784997c66e8.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{b9d9a1dc3c5d799e2685.js → bd3487b587851b20ff2a.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{94490937dca566fe2640.js → bd5e0a11d2a688a65d23.js} +1 -1
  44. package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +1 -0
  45. package/assets/esri/core/workers/chunks/c9aed9a43d9935e7c768.js +314 -0
  46. package/assets/esri/core/workers/chunks/{8d8f5f08d730270e1165.js → cb9a27176bd5de2c34ca.js} +1 -1
  47. package/assets/esri/core/workers/chunks/ceb648604a4b6d316f4b.js +1 -0
  48. package/assets/esri/core/workers/chunks/d31e25a63f967fedb149.js +1 -0
  49. package/assets/esri/core/workers/chunks/{da1157e288dbc6ba842a.js → d3d0c7624eb139994213.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{f198f4ba7d3d52882d98.js → de8044dfab4ad253b126.js} +1 -1
  51. package/assets/esri/core/workers/chunks/ecd66dbc4ff446c64984.js +1 -0
  52. package/assets/esri/core/workers/chunks/f78b63620386b2676f1f.js +1 -0
  53. package/assets/esri/core/workers/chunks/{1cbeac3301b6943bb28a.js → fc07d47d44c04f123650.js} +1 -1
  54. package/assets/esri/core/workers/chunks/fca056536e46aeb98e98.js +1 -0
  55. package/assets/esri/themes/base/_core.scss +4 -0
  56. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +0 -5
  57. package/assets/esri/themes/base/widgets/_Directions.scss +30 -9
  58. package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
  59. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +80 -0
  60. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationList.scss +14 -0
  61. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +41 -0
  62. package/assets/esri/themes/base/widgets/_FilterBuilder.scss +1 -6
  63. package/assets/esri/themes/dark/main.css +1 -1
  64. package/assets/esri/themes/light/main.css +1 -1
  65. package/assets/esri/themes/light/view.css +1 -1
  66. package/chunks/Bufferer-B-V7yYm-.js +5 -0
  67. package/chunks/ComponentShader.glsl.js +6 -6
  68. package/chunks/Distance2DCalculator-Coa0qAFt.js +5 -0
  69. package/chunks/Envelope.js +1 -1
  70. package/chunks/{GeodeticDistanceCalculator-BsWHOuqE.js → GeodeticDistanceCalculator-D4iQ-_NX.js} +1 -1
  71. package/chunks/Geometry.js +1 -1
  72. package/chunks/OperatorClip.js +1 -1
  73. package/chunks/OperatorCut.js +1 -1
  74. package/chunks/OperatorGeneralize.js +1 -1
  75. package/chunks/OperatorGeodesicBuffer.js +1 -1
  76. package/chunks/OperatorGeodeticArea.js +1 -1
  77. package/chunks/OperatorGeodeticDistance.js +1 -1
  78. package/chunks/OperatorProximityGeodesic.js +1 -1
  79. package/chunks/OperatorShapePreservingLength.js +1 -1
  80. package/chunks/OperatorShapePreservingProject.js +1 -1
  81. package/chunks/Point2D.js +1 -1
  82. package/chunks/ProjectionTransformation.js +1 -1
  83. package/chunks/QuadraticBezier.js +1 -1
  84. package/chunks/ShadowHighlight.glsl.js +2 -4
  85. package/chunks/distanceOperator.js +1 -1
  86. package/core/deprecate.js +1 -1
  87. package/editing/templateUtils.js +1 -1
  88. package/geometry/operators/extendOperator.js +1 -1
  89. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  90. package/geometry/operators/gx/operatorBuffer.js +1 -1
  91. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  92. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  93. package/geometry/operators/gx/operatorOffset.js +1 -1
  94. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  95. package/geometry/operators/isNearOperator.js +1 -1
  96. package/geometry/operators/projectOperator.js +1 -1
  97. package/geometry/operators/shapePreservingProjectOperator.js +1 -1
  98. package/geometry/operators/support/jsonConverter.js +1 -1
  99. package/interfaces.d.ts +616 -122
  100. package/layers/FeatureLayer.js +1 -1
  101. package/layers/GeoJSONLayer.js +1 -1
  102. package/layers/OGCFeatureLayer.js +1 -1
  103. package/layers/RouteLayer.js +1 -1
  104. package/layers/SubtypeGroupLayer.js +1 -1
  105. package/layers/WFSLayer.js +1 -1
  106. package/layers/graphics/data/queryUtils.js +1 -1
  107. package/layers/mixins/TrackableLayer.d.ts +4 -0
  108. package/layers/support/SubtypeSublayer.js +1 -1
  109. package/layers/support/TitleCreator.js +5 -0
  110. package/layers/support/TrackInfo.d.ts +4 -0
  111. package/layers/support/TrackPartInfo.d.ts +4 -0
  112. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  113. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  114. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  115. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  116. package/networks/Network.js +1 -1
  117. package/networks/RulesTable.js +1 -1
  118. package/networks/UtilityNetwork.js +1 -1
  119. package/networks/support/networkFieldUtils.js +5 -0
  120. package/networks/support/typeUtils.js +1 -1
  121. package/package.json +1 -1
  122. package/rest/query/executeForIds.js +1 -1
  123. package/rest/support/BinParametersBase.js +1 -1
  124. package/support/revision.js +1 -1
  125. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  126. package/symbols/cim/rasterizingUtils.js +1 -1
  127. package/symbols/support/previewCIMSymbol.js +1 -1
  128. package/symbols/support/previewSymbol2D.js +1 -1
  129. package/symbols/support/symbolUtils.js +1 -1
  130. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  131. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  132. package/views/2d/layers/RouteLayerView2D.js +1 -1
  133. package/views/2d/layers/features/FeatureContainer.js +1 -1
  134. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  135. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  136. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  137. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  138. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  139. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  140. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  141. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  142. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  143. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  144. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  145. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  146. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  147. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  148. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  149. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  150. package/views/SceneView.js +1 -1
  151. package/views/View.js +1 -1
  152. package/views/layers/FeatureLayerView.js +1 -1
  153. package/views/support/RequiredFieldsOptions.js +5 -0
  154. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  155. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  156. package/widgets/AreaMeasurement2D.js +1 -1
  157. package/widgets/BasemapGallery.js +1 -1
  158. package/widgets/BasemapToggle.js +1 -1
  159. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  160. package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
  161. package/widgets/BatchAttributeForm/inputs/EditableInput.js +1 -1
  162. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  163. package/widgets/BatchAttributeForm/inputs/GroupInput.js +1 -1
  164. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  165. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  166. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  167. package/widgets/BatchAttributeForm.js +1 -1
  168. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  169. package/widgets/Compass/CompassViewModel.js +1 -1
  170. package/widgets/DirectionalPad.js +1 -1
  171. package/widgets/Directions/DirectionsViewModel.js +1 -1
  172. package/widgets/Directions.js +1 -1
  173. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  174. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  175. package/widgets/DistanceMeasurement2D.js +1 -1
  176. package/widgets/Editor/AddAssociationWorkflow.js +5 -0
  177. package/widgets/Editor/AddAssociationWorkflowData.js +5 -0
  178. package/widgets/Editor/EditorViewModel.js +1 -1
  179. package/widgets/Editor/UpdateWorkflow.js +1 -1
  180. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  181. package/widgets/Editor.js +1 -1
  182. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  183. package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
  184. package/widgets/Feature/FeatureViewModel.js +1 -1
  185. package/widgets/Feature/support/featureUtils.js +1 -1
  186. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  187. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +5 -0
  188. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +5 -0
  189. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  190. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +5 -0
  191. package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
  192. package/widgets/FeatureForm.js +1 -1
  193. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  194. package/widgets/Fullscreen.js +1 -1
  195. package/widgets/Home.js +1 -1
  196. package/widgets/Legend/LegendViewModel.js +1 -1
  197. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  198. package/widgets/Legend.js +1 -1
  199. package/widgets/Locate.js +1 -1
  200. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  201. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  202. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  203. package/widgets/ScaleBar.js +1 -1
  204. package/widgets/Swipe.js +1 -1
  205. package/widgets/Track.js +1 -1
  206. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.d.ts +2 -2
  207. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  208. package/widgets/UtilityNetworkTrace.js +1 -1
  209. package/widgets/support/FilterBuilder/FilterBuilderViewModel.js +1 -1
  210. package/widgets/support/FilterBuilder.js +1 -1
  211. package/widgets/support/FilterCondition/FilterConditionViewModel.js +1 -1
  212. package/widgets/support/FilterCondition.js +1 -1
  213. package/widgets/support/GoTo.js +1 -1
  214. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +5 -0
  215. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
  216. package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
  217. package/widgets/support/goToUtils.js +5 -0
  218. package/assets/esri/core/workers/chunks/01c3507d78398baaf61b.js +0 -1
  219. package/assets/esri/core/workers/chunks/0ac1399d252f2df670b6.js +0 -1
  220. package/assets/esri/core/workers/chunks/177d4c2c10ef7369006f.js +0 -1
  221. package/assets/esri/core/workers/chunks/26a2bd432e7a1b3870c3.js +0 -1
  222. package/assets/esri/core/workers/chunks/3d5442055e01493efcb2.js +0 -1
  223. package/assets/esri/core/workers/chunks/44abd2cd17aae3299ede.js +0 -1
  224. package/assets/esri/core/workers/chunks/594d923400fd74881833.js +0 -1
  225. package/assets/esri/core/workers/chunks/61795bde00f2e16d04f1.js +0 -1
  226. package/assets/esri/core/workers/chunks/7058001bf66f9f3d5d45.js +0 -1
  227. package/assets/esri/core/workers/chunks/746c964cf07e4306f21f.js +0 -1
  228. package/assets/esri/core/workers/chunks/74f42e46bf551aab14dc.js +0 -1
  229. package/assets/esri/core/workers/chunks/7bf08823f861628144a1.js +0 -1
  230. package/assets/esri/core/workers/chunks/8c32cee395da0a7b9a8e.js +0 -1
  231. package/assets/esri/core/workers/chunks/91384398f01485631f70.js +0 -1
  232. package/assets/esri/core/workers/chunks/946a9890f3621d1dfbc5.js +0 -1
  233. package/assets/esri/core/workers/chunks/9fb45c006d790273e8c1.js +0 -1
  234. package/assets/esri/core/workers/chunks/a2409d4921c02614169a.js +0 -1
  235. package/assets/esri/core/workers/chunks/a6be1105a5e1f9597c5e.js +0 -1
  236. package/assets/esri/core/workers/chunks/af917f69d9c6e9937263.js +0 -1
  237. package/assets/esri/core/workers/chunks/cc75bbfd779f409943a3.js +0 -1
  238. package/assets/esri/core/workers/chunks/d0e9874eb304010305c6.js +0 -1
  239. package/assets/esri/core/workers/chunks/d27a199fd8e2ade69254.js +0 -1
  240. package/assets/esri/core/workers/chunks/d339dee99c4820b63f39.js +0 -1
  241. package/assets/esri/core/workers/chunks/d35efcbe439500bf18bc.js +0 -1
  242. package/assets/esri/core/workers/chunks/d44d210e94406509e980.js +0 -314
  243. package/assets/esri/core/workers/chunks/e5e3b6d00d27b5bb354f.js +0 -1
  244. package/assets/esri/core/workers/chunks/f14b318bab5efcf43419.js +0 -1
  245. package/assets/esri/core/workers/chunks/f29715459ecd46180829.js +0 -1
  246. package/assets/esri/core/workers/chunks/f9070edd8e0b2a57af79.js +0 -1
  247. package/chunks/Bufferer-DjC-SKTJ.js +0 -5
  248. package/chunks/Distance2DCalculator-8-JrFGHH.js +0 -5
  249. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationSettings.js +0 -5
  250. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.d.ts +0 -4
  251. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import"../../core/has.js";import n from"../../core/Error.js";import i from"../../core/Identifiable.js";import{clone as o}from"../../core/lang.js";import s from"../../core/Loadable.js";import a from"../../core/Logger.js";import{MultiOriginJSONMixin as l}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as p}from"../../core/object.js";import{sqlAnd as d}from"../../core/sql.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as f}from"../../core/accessorSupport/layerContainerType.js";import h from"../../form/FormTemplate.js";import b from"../../geometry/SpatialReference.js";import{labelsVisible as g,legendEnabled as v,minScale as j,maxScale as w,popupEnabled as F}from"./commonProperties.js";import{createQuery as I,computeDomainFromSubtypes as T}from"./featureLayerUtils.js";import O from"./FeatureTemplate.js";import{defineFieldProperties as S}from"./fieldProperties.js";import{fixRendererFields as C}from"./fieldUtils.js";import E from"./LabelClass.js";import{reader as q}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as x}from"./subtypeGroupLayerUtils.js";import R from"../../renderers/SimpleRenderer.js";import P from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as D,defaultPolylineSymbol2D as G,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";import V from"../../tables/AttributeTableTemplate.js";const $=S();let M=0;function U(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=f),e}function _(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=f),e?.target&&(t.write.target=e.target)),t}function k(e){return new R({symbol:Q(e)})}function Q(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return G.clone();case"polygon":case"multipatch":return D.clone();default:return null}}function B(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function H(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function J(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const n={},i=H(e,t);if(null!=i){const{defaultValues:e}=i;for(const t in e)n[t]=e[t]}return n[t.subtypeField]=e,new O({name:"New Feature",drawingTool:r,prototype:{attributes:n}})}let W=class extends(l(r.ClonableMixin(i.IdentifiableMixin(s)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${M++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return C(this.renderer,this.fieldsIndex),Promise.resolve(this)}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:n,parent:i}=this;let s;if(n){s=[];let e=0;n.forEach((({name:t,alias:r,editable:n,visible:o})=>{if(!o)return;const a=i?.fields?.find((e=>e.name===t));if(!a)return;const l={name:t};let p=!1;r!==a.alias&&(l.alias=r,p=!0),n!==a.editable&&(l.editable=n,p=!0),s.push(l),p&&e++})),0===e&&s.length===n.length&&(s=null)}else s=o(e);s?.length&&p(r,s,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,n=e?.fields;if(!e||!n?.length)return null;const{subtypes:i,subtypeField:o}=e,s=i?.find((e=>e.code===r)),a=s?.defaultValues,l=s?.domains,p=[];for(const d of n){const e=d.clone(),{name:n}=e,i=t?.find((e=>e.name===n));if(e.visible=!t||!!i,i){const{alias:t,editable:r}=i;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=a?.[n]??null;e.defaultValue=n===o?r:s;const u=l?.[n]??null;e.domain=n===o?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||a.getLogger(this).error(X("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){C(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?k(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const n=t.drawingInfo?.renderer,i=A(n,t,r);let o;const{subtypeCode:s}=this;if(null!=s&&B(i,t.subtypeField)){const e=i.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(s)));e&&(o=new R({symbol:e.symbol}))}else"simple"!==i?.type||i.visualVariables?.length||(o=i);return o}readRenderer(e,t,r){const n=t?.layerDefinition?.drawingInfo?.renderer;if(!n)return;const i=n.visualVariables?.some((e=>"rotationInfo"!==e.type));return i?void 0:A(n,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??b.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[J(this.subtypeCode,t)]}readTitleFromService(e,t){const r=H(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw X("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new n("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw X("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new n("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw X("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new n("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw X("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:n,title:i}=this;if(r){const{displayField:e,editFieldsInfo:o,objectIdField:s}=r;t={displayField:e,editFieldsInfo:o,fields:n,objectIdField:s,title:i}}return L(t,e)}createQuery(){if(!this.parent)throw X("createQuery");const e=I(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=d(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=T(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw X("queryAttachments");const n=e.clone();return n.where=K(n.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatureCount");return r.parent.queryFeatureCount(z(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatures");return r.parent.queryFeatures(z(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw X("queryObjectIds");return r.parent.queryObjectIds(z(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw X("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([u({type:V,json:_({name:"attributeTableInfo"})})],W.prototype,"attributeTableTemplate",void 0),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"capabilities",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"effectiveCapabilities",null),e([u({json:_()})],W.prototype,"charts",void 0),e([u({type:Boolean,nonNullable:!0,json:_({name:"enableEditing"})})],W.prototype,"editingEnabled",void 0),e([u({type:Boolean,readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"elevationInfo",null),e([u({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],W.prototype,"fieldOverrides",void 0),e([m("fieldOverrides")],W.prototype,"writeFieldOverrides",null),e([u({...$.fields,readOnly:!0,json:{read:!1}})],W.prototype,"fields",null),e([u($.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"floorInfo",null),e([u({type:h,json:_({name:"formInfo"})})],W.prototype,"formTemplate",void 0),e([u({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"id",void 0),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"isTable",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"geometryType",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"type",void 0),e([u(U(o(g)))],W.prototype,"labelsVisible",void 0),e([u({type:[E],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:q},write:{ignoreOrigin:!0,layerContainerTypes:f}}})],W.prototype,"labelingInfo",void 0),e([u({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:f}}})],W.prototype,"layerType",void 0),e([u(U(o(v)))],W.prototype,"legendEnabled",void 0),e([u({type:["show","hide"]})],W.prototype,"listMode",void 0),e([u((()=>{const e=o(j);return e.json.origins.service.read=!1,U(e,{spatialOnly:!0})})())],W.prototype,"minScale",void 0),e([u((()=>{const e=o(w);return e.json.origins.service.read=!1,U(e,{spatialOnly:!0})})())],W.prototype,"maxScale",void 0),e([u({readOnly:!0})],W.prototype,"effectiveScaleRange",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"objectIdField",null),e([u({type:Number,range:{min:0,max:1},nonNullable:!0,json:_({spatialOnly:!0})})],W.prototype,"opacity",void 0),e([u({clonable:!1})],W.prototype,"parent",void 0),e([u(U(o(F)))],W.prototype,"popupEnabled",void 0),e([u({type:t,json:_({name:"popupInfo"})})],W.prototype,"popupTemplate",void 0),e([u({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"relationships",null),e([u({types:x,json:_({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],W.prototype,"renderer",null),e([y("service","renderer",["drawingInfo.renderer","subtypeField","type"])],W.prototype,"readRendererFromService",null),e([y("renderer",["layerDefinition.drawingInfo.renderer"])],W.prototype,"readRenderer",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"spatialReference",null),e([u({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"subtypeCode",void 0),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"subtypeField",null),e([u({type:[O],json:_({name:"layerDefinition.templates"})})],W.prototype,"templates",void 0),e([y("service","templates",["geometryType","subtypeField","subtypes","type"])],W.prototype,"readTemplatesFromService",null),e([u({type:String,json:_()})],W.prototype,"title",void 0),e([y("service","title",["subtypes"])],W.prototype,"readTitleFromService",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"url",null),e([u({readOnly:!0})],W.prototype,"userHasUpdateItemPrivileges",null),e([u({type:Boolean,nonNullable:!0,json:_({name:"visibility",spatialOnly:!0})})],W.prototype,"visible",void 0),W=e([c("esri.layers.support.SubtypeSublayer")],W);const z=(e,t,r)=>{if(!r)return t.createQuery();const n=P.from(r);return n.where=K(n.where,e.subtypeField,t.subtypeCode),n},K=(e,t,r)=>{const n=new RegExp(`${t}\\s*=\\s*\\d+`),i=`${t}=${r}`,o=e??"";return n.test(o)?o.replace(n,i):d(i,o)},X=e=>new n(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Y=W;export{Y as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import"../../core/has.js";import i from"../../core/Error.js";import o from"../../core/Identifiable.js";import{clone as n}from"../../core/lang.js";import l from"../../core/Loadable.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{MultiOriginJSONMixin as p}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as d}from"../../core/object.js";import{sqlAnd as u}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as h}from"../../core/accessorSupport/layerContainerType.js";import b from"../../form/FormTemplate.js";import g from"../../geometry/SpatialReference.js";import{labelsVisible as j,legendEnabled as v,minScale as w,maxScale as F,popupEnabled as I}from"./commonProperties.js";import{createQuery as T,computeDomainFromSubtypes as O}from"./featureLayerUtils.js";import S from"./FeatureTemplate.js";import{defineFieldProperties as C}from"./fieldProperties.js";import{fixRendererFields as E}from"./fieldUtils.js";import q from"./LabelClass.js";import{reader as x}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as R}from"./subtypeGroupLayerUtils.js";import P from"./TitleCreator.js";import L from"../../renderers/SimpleRenderer.js";import _ from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as G,defaultPolylineSymbol2D as M,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";import V from"../../tables/AttributeTableTemplate.js";const $=C();let U=0;function k(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=h),e}function Q(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=h),e?.target&&(t.write.target=e.target)),t}function B(e){return new L({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return M.clone();case"polygon":case"multipatch":return G.clone();default:return null}}function J(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function W(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function Z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=W(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new S({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let z=class extends(p(r.ClonableMixin(o.IdentifiableMixin(l)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${U++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return E(this.renderer,this.fieldsIndex),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return a(e),new P({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,displayField:this.parent?.displayField??"",fields:this.fields,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}get featureTitleFields(){return[...this._titleCreator.requiredFields]}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let l;if(i){l=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:n})=>{if(!n)return;const s=o?.fields?.find((e=>e.name===t));if(!s)return;const a={name:t};let p=!1;r!==s.alias&&(a.alias=r,p=!0),i!==s.editable&&(a.editable=i,p=!0),l.push(a),p&&e++})),0===e&&l.length===i.length&&(l=null)}else l=n(e);l?.length&&d(r,l,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,l=o?.find((e=>e.code===r)),s=l?.defaultValues,a=l?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const l=s?.[i]??null;e.defaultValue=i===n?r:l;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(s.getLogger(this).error(Y("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){E(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=A(i,t,r);let n;const{subtypeCode:l}=this;if(null!=l&&J(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(n=new L({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(n=o);return n}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:A(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??g.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[Z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=W(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw Y("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:l}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:l,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=T(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=u(t,this.parent.definitionExpression),e}getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){return this._titleCreator.getTitle(this,e,t)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=O(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatureCount");return r.parent.queryFeatureCount(K(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");return r.parent.queryFeatures(K(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw Y("queryObjectIds");return r.parent.queryObjectIds(K(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([y({clonable:!1,readOnly:!0})],z.prototype,"_titleCreator",null),e([y({type:V,json:Q({name:"attributeTableInfo"})})],z.prototype,"attributeTableTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"capabilities",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"effectiveCapabilities",null),e([y({json:Q()})],z.prototype,"charts",void 0),e([y({type:Boolean,nonNullable:!0,json:Q({name:"enableEditing"})})],z.prototype,"editingEnabled",void 0),e([y({type:Boolean,readOnly:!0})],z.prototype,"effectiveEditingEnabled",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"elevationInfo",null),e([y({clonable:!1,readOnly:!0})],z.prototype,"featureTitleFields",null),e([y({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],z.prototype,"fieldOverrides",void 0),e([f("fieldOverrides")],z.prototype,"writeFieldOverrides",null),e([y({...$.fields,readOnly:!0,json:{read:!1}})],z.prototype,"fields",null),e([y($.fieldsIndex)],z.prototype,"fieldsIndex",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"floorInfo",null),e([y({type:b,json:Q({name:"formInfo"})})],z.prototype,"formTemplate",void 0),e([y({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],z.prototype,"id",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"isTable",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"geometryType",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"globalIdField",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"type",void 0),e([y(k(n(j)))],z.prototype,"labelsVisible",void 0),e([y({type:[q],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:x},write:{ignoreOrigin:!0,layerContainerTypes:h}}})],z.prototype,"labelingInfo",void 0),e([y({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:h}}})],z.prototype,"layerType",void 0),e([y(k(n(v)))],z.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],z.prototype,"listMode",void 0),e([y((()=>{const e=n(w);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],z.prototype,"minScale",void 0),e([y((()=>{const e=n(F);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],z.prototype,"maxScale",void 0),e([y({readOnly:!0})],z.prototype,"effectiveScaleRange",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"objectIdField",null),e([y({type:Number,range:{min:0,max:1},nonNullable:!0,json:Q({spatialOnly:!0})})],z.prototype,"opacity",void 0),e([y({clonable:!1})],z.prototype,"parent",void 0),e([y(k(n(I)))],z.prototype,"popupEnabled",void 0),e([y({type:t,json:Q({name:"popupInfo"})})],z.prototype,"popupTemplate",void 0),e([y({readOnly:!0})],z.prototype,"defaultPopupTemplate",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"relationships",null),e([y({types:R,json:Q({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],z.prototype,"renderer",null),e([c("service","renderer",["drawingInfo.renderer","subtypeField","type"])],z.prototype,"readRendererFromService",null),e([c("renderer",["layerDefinition.drawingInfo.renderer"])],z.prototype,"readRenderer",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"spatialReference",null),e([y({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],z.prototype,"subtypeCode",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"subtypeField",null),e([y({type:[S],json:Q({name:"layerDefinition.templates"})})],z.prototype,"templates",void 0),e([c("service","templates",["geometryType","subtypeField","subtypes","type"])],z.prototype,"readTemplatesFromService",null),e([y({type:String,json:Q()})],z.prototype,"title",void 0),e([c("service","title",["subtypes"])],z.prototype,"readTitleFromService",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"url",null),e([y({readOnly:!0})],z.prototype,"userHasUpdateItemPrivileges",null),e([y({type:Boolean,nonNullable:!0,json:Q({name:"visibility",spatialOnly:!0})})],z.prototype,"visible",void 0),z=e([m("esri.layers.support.SubtypeSublayer")],z);const K=(e,t,r)=>{if(!r)return t.createQuery();const i=_.from(r);return i.where=X(i.where,e.subtypeField,t.subtypeCode),i},X=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):u(o,n)},Y=e=>new i(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),ee=z;export{ee as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{featureHasFields as o,extractSubstitutionTemplatesFromString as n}from"./fieldUtils.js";import{loadArcade as l}from"../../support/arcadeOnDemand.js";const p="relationships/",c="expression/";let d=class extends t{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){if(this.expressionsUsedInTitle.length>0){return this._get("_arcadeTask")||s((()=>l()))}return null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??import("../../widgets/Feature/support/featureUtils.js").then((e=>this._featureUtils=e))}get calculatedExpressions(){const e=new i;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const s=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(s.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:s,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(s,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter((t=>e.includes(`{expression/${t.name.toLowerCase()}}`)))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some((e=>!0===e.invalid))}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const s of this.calculatedExpressions?.toArray()??[])try{const t=this._arcadeTask.value.arcade.extractFieldLiterals(s.syntax);for(const s of t){const t=s.split("."),i=this.fieldsIndex.get(t.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const s of t){const t=this.fieldsIndex.get(s);t&&e.add(t.name)}return e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,s){try{const{attributes:i}=t,r=s?.timeZone??"system",[{substituteFieldsInLinksAndAttributes:a}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);if(s.fetchMissingFields&&(t=await this._checkAndReQueryGraphic(e,t)),this.workingTitle&&this.fieldInfoMap){const s=this._createFormattedAttributes(e,t,r).global;return a({attributes:i,expressionAttributes:null,fieldInfoMap:this.fieldInfoMap,globalAttributes:s,layer:e,text:this.workingTitle})}return""}catch{}return""}async _checkAndReQueryGraphic(e,t){const s=t.getObjectId();if(null==s)return t;if(!o(this.requiredFields,t)){const t=e.createQuery();t.where="1=1",t.outFields=[...this.requiredFields],t.objectIds=[s];const i=await e.queryFeatures(t);if(1===i?.features.length)return i.features[0]}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const s of e){if(!s.fieldName)continue;const e=this.fieldsIndex.get(s.fieldName),i=e?.name??s.fieldName;s.fieldName=i,t.set(i.toLowerCase(),s)}return t}_createFormattedAttributes(e,t,s="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],r={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const s=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{r[`expression/${e.name}`]=e.func({vars:{$feature:s}})}catch{}}const a={...t.attributes,...r};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:a,graphic:t,timeZone:s,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return n(e).filter((e=>!(0===e.indexOf(p)||0===e.indexOf(c))))}};e([r({readOnly:!0})],d.prototype,"_arcadeTask",null),e([r()],d.prototype,"_featureUtils",void 0),e([r({readOnly:!0})],d.prototype,"featureUtilsPromise",null),e([r({readOnly:!0})],d.prototype,"calculatedExpressions",null),e([r()],d.prototype,"displayField",void 0),e([r()],d.prototype,"effectivePopupTemplate",void 0),e([r()],d.prototype,"expressionsUsedInTitle",null),e([r()],d.prototype,"fieldsIndex",void 0),e([r()],d.prototype,"fieldInfoMap",null),e([r()],d.prototype,"fields",void 0),e([r()],d.prototype,"objectIdField",void 0),e([r()],d.prototype,"requiredFields",null),d=e([a("esri.layers.support.TitleCreator")],d);const u=d;export{u as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import TrackInfo = __esri.TrackInfo;
4
+ export default TrackInfo;
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import TrackPartInfo = __esri.TrackPartInfo;
4
+ export default TrackPartInfo;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../geometry/Extent.js";import{isAxesOrderReversedForWkid as r}from"../../ogc/crsUtils.js";import{getCapabilities as a,describeCoverage as l}from"../../ogc/wcsUtils.js";import c from"../DimensionalDefinition.js";import d from"./BaseRaster.js";import{parse as f}from"./multipartParser.js";import{standardizeInterpolations as p,convertOleDateTimeToEpoch as u}from"./wcsCoverageParser.js";import{getFormat as h}from"../rasterFormats/RasterCodec.js";import{clip as m}from"../rasterFunctions/pixelUtils.js";const g=["nearest neighbor","bilinear","bicubic"],w=["nearest","linear","cubic"],v="response is not a supported multipart/related mediaType with inline tiff, switching to compatibility mode",y="response is not a supported multipart mediaType with inline tiff",x="response is base64 encoded which may impact layer display performance",I="server returns an exception",C=new Set(["1.0.0","1.1.0","1.1.1","1.1.2","2.0.1"]);let b=class extends d{constructor(){super(...arguments),this.datasetFormat="WCSServer",this.tileType="Raster"}async fetchRawTile(e,i,n,s={}){if(this.isBlockOutside(e,i,n))return null;const{nativePixelSize:o,spatialReference:r}=this.rasterInfo,a=2**e,l=o.x*a,c=o.y*a,{blockWidth:d,blockHeight:f}=this.getBlockWidthHeight(e),{origin:p}=this.rasterInfo.storageInfo.tileInfo,u=this.getTileExtent({x:l,y:c},i,n,p,r,[d,f]),h=this.rasterInfo.extent,g=u.xmax>h.xmax,w=u.ymin<h.ymin,v=g||w;let y=u,x=d,I=f;if(v&&(y=u.clone().intersection(h),null!=y&&(g&&(x=Math.floor((y.xmax-y.xmin)/l),y.xmax=y.xmin+l*x),w&&(I=Math.floor((y.ymax-y.ymin)/c),y.ymin=y.ymax-c*I))),null==y||x<=1||I<=1)return null;const C=await this._getCoverage(y,x,I,a,s);if(!C)return null;const{coverageDescription:b}=this.coverageInfo,{noDataValue:$,multidimensionalInfo:S}=this.rasterInfo,{multidimensionalDefinition:j}=s;let T;if(null!=S&&null!=j&&j.length){const e=j[0].variableName;if("2.0"===b.version){const t=b.rangeType[0].find((t=>t.name===e));T=t?.nilValue}else if("1.1"===b.version){const t=b.range.find((t=>t.identifier===e));T=t?.nullValues}}const L=T??$,P=await this.decodePixelBlock(C,{width:x,height:I,planes:null,pixelType:null,tiffNoDataValue:Array.isArray(L)?L[0]:L});if(null==P)return null;if(P&&(P.width!==x||P.height!==I))throw new t("wcsraster-fetch",`the response has unexpected dimension width: ${P.width}, height: {pixelBlock.height}`);return v?m(P,{x:0,y:0},{width:f,height:f}):P}async _open(e){const{customFetchParameters:i}=this.ioConfig,n=e?.signal,s=await a(this.url,{version:i?.version??this.version,customParameters:i,signal:n});if(this.capabilities=s,!this.version){let e=s.version.slice(0,3);"2.0"===e||"1.1"===e||"1.0"===e?this.version=s.version:(e=s.supportedVersions.find((e=>"2.0.1"===e))||s.supportedVersions.find((e=>"2.0"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.1"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.0"===e.slice(0,3)))||"1.0.0",this.version=e)}const{version:o}=this;if(!C.has(o))throw new t("wcsraster-open",`unsupported WCS version ${o}`);const{gridCoverages:r}=s;if(!r.length)throw new t("wcsraster-open","cannot find rectified grid coverages");this.coverageId??=r[0].id;const{coverageId:c}=this,d=r.find((e=>e.id===c));if(null==d)throw new t("wcsraster-open",`the coverageId ${c} does not exist in capabilities`);const f=await l(this.url,{coverageIds:[c],version:o,customParameters:i,signal:n});if(this.coverageInfo=f[0],"2.0"===o.slice(0,3)){const{coverageInfo:e}=this;e.lonLatEnvelope=d.lonLatEnvelope,e.supportedInterpolations=p(s.supportedInterpolations),this._patchDimensionValues201(c,n)}this.datasetName=this.coverageInfo.title;const{rasterInfo:u}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(u,512,512),this._set("rasterInfo",u),null==u.spatialReference)throw new t("wcsraster-open",`coverage without spatial reference is not supported: ${c}`);const{pixelType:h,bandCount:m}=await this._getPixelTypeAndBandCount(n);u.pixelType=h,1===u.bandCount&&m>1&&(u.bandCount=m),this.updateTileInfo()}async _patchDimensionValues201(e,t){const{coverageInfo:i}=this,n=i.rasterInfo.multidimensionalInfo?.variables,s=C.has("1.1.2")?"1.1.2":C.has("1.1.1")?"1.1.1":C.has("1.1.0")?"1.1.0":null,{customFetchParameters:o}=this.ioConfig;if(n&&s)try{const i=this.url.includes("/ImageServer/"),r=e.length>8&&e.startsWith("Coverage")&&i?e.slice(8):e,a=await l(this.url,{coverageIds:[r??e],version:s,customParameters:o,signal:t}).catch((()=>{if(r)return l(this.url,{coverageIds:[e],version:s,customParameters:o,signal:t})})),c=a?.[0].rasterInfo.multidimensionalInfo?.variables;if(c)for(const e of n){const t=c.find((({name:t})=>t===e.name));if(t?.dimensions?.length)for(let n=e.dimensions.length-1;n>=0;n--){const s=e.dimensions[n],o=t.dimensions.find((({name:e})=>e===s.name));o?o.values&&o.extent?.join(",")===s.extent?.join(",")&&(e.dimensions[n]={...s,values:o.values}):i&&e.dimensions.splice(n,1)}}}catch{}}async _getPixelTypeAndBandCount(e){const{pixelSize:n,extent:s,multidimensionalInfo:r}=this.rasterInfo,a=s.center,l=new o({xmin:a.x-n.x,xmax:a.x+n.x,ymin:a.y-n.y,ymax:a.y+n.y,spatialReference:s.spatialReference});let d=[];if(null!=r){const e=r.variables[0];d=[],e.dimensions.forEach((t=>{d.push(new c({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent?.[0]:t.values?.[0],isSlice:!0}))}))}const{coverageDescription:f}=this.coverageInfo,p={interpolation:"nearest",multidimensionalDefinition:d,signal:e},{version:u}=f,{ioConfig:h}=this,m="2.0"===u&&null==h.allowAnyMediaType||"1.1"===u&&null==h.use2GridOffsets;let g;try{g=await this._getCoverage(l,2,2,1,p,!0)}catch(y){if(!m)throw y;if("1.1"===u){if(!y.details?.isResolutionMismatch)throw y;h.use2GridOffsets=!0}}if(!g&&m&&("2.0"===u&&(h.allowAnyMediaType=!0),g=await this._getCoverage(l,2,2,1,p),g&&i.getLogger(this).warn("wcsraster:getcoverage",v)),!g)throw new t("wcsraster-open","unable to determine pixel type");const w=await this.decodePixelBlock(g,{width:2,height:2,planes:null,pixelType:null});if(null==w)throw new t("wcsraster-open","unable to determine pixel type");return{pixelType:w.pixelType,bandCount:w.getPlaneCount()??0}}async _getCoverage(e,n,s,o,r,a=!1){const{coverageDescription:l}=this.coverageInfo,{version:c}=l,d="2.0"===c?this._getCoverage201Parameters(e,n,s,o,r,l):"1.1"===c?this._getCoverage110Parameters(e,n,s,r,l):this._getCoverage100Parameters(e,n,s,r),p="2.0"===c?await this.request(this._constructWCS201Url(d),{signal:r.signal,responseType:"array-buffer"}):await this.request(this.url,{query:d,signal:r.signal,responseType:"array-buffer"});if("1.0"===c)return p.data;if("2.0"===c&&!1!==this.ioConfig.allowAnyMediaType){if("tiff"===h(p.data))return a&&(this.ioConfig.allowAnyMediaType=!0,i.getLogger(this).warn("wcsraster:getcoverage",v)),p.data}const u=f(p);if(u.isMultipart&&u.data){const e=u.data.find((e=>e.isValidImage));return a&&"base64"===e?.contentTransferEncoding&&i.getLogger(this).warn("wcsraster:getcoverage",x),e?.contentData}const m=new Uint8Array(p.data,0,Math.min(p.data.byteLength,2e3)),g=String.fromCharCode.apply(null,m).toLowerCase().includes("exception"),w=g&&String.fromCharCode.apply(null,m).includes("A non-zero RESX/RESY or WIDTH/HEIGHT is required but neither was provided");if(g)throw new t("wcsraster:getcoverage",I,{isResolutionMismatch:w});throw new t("wcsraster:getcoverage",y)}_getInterpolationIndex(e){return e&&this.coverageInfo.supportedInterpolations?.includes(e)?"nearest"===e?0:"bilinear"===e?1:"cubic"===e?2:0:0}_getCoverage100Parameters(e,t,i,n){const s=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,o=e.spatialReference.wkid,r=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"GEOTIFF",{bandIds:a,interpolation:l}=n,c=this._getInterpolationIndex(l),d=a?a.map((e=>this.coverageInfo.bandNames[e])):null,f=g[c],{multidimensionalDefinition:p}=n;let u;if(null!=p&&null!=this.rasterInfo.multidimensionalInfo){const e=p.find((e=>"StdTime"===e.dimensionName));let t=e?.values;t&&t.length>0&&(Array.isArray(t[0])&&(t=t[0]),u=t.map((e=>$(e))).join(","))}return{service:"WCS",request:"GetCoverage",version:this.version,coverage:this.coverageId,format:r,crs:`EPSG:${o}`,bbox:s,width:t,height:i,time:u,interpolation:f,band:d?.join(",")}}_getCoverage110Parameters(e,t,i,n,s){const{multidimensionalDefinition:o,bandIds:a,interpolation:l}=n,c=e.spatialReference.wkid,d=`urn:ogc:def:crs:EPSG::${c}`,f=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"image/tiff",p=this._getInterpolationIndex(l),u=w[p],h=null==l||0===this.coverageInfo.supportedInterpolations?.indexOf(l),m=s.domain.spatialDomain,g=m.origin.x<=m.envelope.xmin&&m.origin.y<=m.envelope.ymin,v=e.width/t,y=e.height/i*(g?1:-1),x=g?[e.xmin,e.ymin]:[e.xmin,e.ymax],I=m.useEPSGAxis&&r(c),C=I?`${x[1]},${x[0]}`:`${x[0]},${x[1]}`,b=this.ioConfig.use2GridOffsets,S=I?b?`${y},${v}`:`${y},0,0,${v}`:b?`${v},${y}`:`${v},0,0,${y}`,j=v/2,T=e.xmin+j,L=e.xmax-j,P=Math.abs(y)/2,R=e.ymin+P,_=e.ymax-P,D=I?`${R},${T},${_},${L},${d}`:`${T},${R},${L},${_},${d}`,E=s.range.find((e=>e.axis.some((e=>e.identifier.toLowerCase().includes("band")))));let A,G=E&&u&&a?h?`${E.identifier}[${E.axis[0].identifier}[${a.join(",")}]]`:`${E.identifier}:${u}[${E.axis[0].identifier}[${a.join(",")}]]`:null;if(null!=o&&o.length)for(let r=0;r<o.length;r++){let e=o[r].values;const t=o[r].dimensionName?.toLowerCase(),i=o[r].variableName?.toLowerCase(),n=s.range.find((e=>e.identifier.toLowerCase()===i));if(e.length>0)if(Array.isArray(e[0])&&(e=e[0]),"stdtime"===t)A=e.map((e=>$(e))).join(",");else if(n){const i=n.axis.find((e=>e.identifier.toLowerCase()===t));i&&(G=h?n.identifier+"["+i.identifier+"["+e.join(",")+"]]":n.identifier+":"+u+"["+i.identifier+"["+e.join(",")+"]]")}r===o.length-1&&n&&!G&&(G=h?n.identifier:n.identifier+":"+u)}return{service:"WCS",request:"GetCoverage",version:this.version,identifier:this.coverageId,format:f,crs:`EPSG:${c}`,boundingbox:D,gridCS:"urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS",gridType:"urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs",gridOrigin:C,gridOffsets:S,gridBaseCRS:d,timeSequence:A,rangeSubset:G}}_getCoverage201Parameters(e,t,i,n,s,o){const{multidimensionalDefinition:r,interpolation:a}=s,l=this._getInterpolationIndex(a);let c=null;const{supportedInterpolations:d}=this.capabilities;if(d?.length)switch(l){case 0:c=d.find((e=>e.toLowerCase().includes("nearest")));break;case 1:c=d.find((e=>e.toLowerCase().includes("linear")));break;case 2:c=d.find((e=>e.toLowerCase().includes("cubic")||e.toLowerCase().includes("quadratic")))}const f=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"image/tiff",{bandNames:p}=this.coverageInfo,{boundedBy:u,domainSet:h,rangeType:m}=o,g=u.isEastFirst?0:1,w=1-g,{axisLabels:v}=u,y=v[g],x=v[w],I=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,C=I,b=[];b.push(`${y}(${e.xmin},${e.xmax})`),b.push(`${x}(${e.ymin},${e.ymax})`);const S=[];if(v.length>2)for(let _=2;_<v.length;_++){const e=h.origin[_];if(v[_].toLowerCase().includes("time")){let t=e.toString();u.uomLabels?.[_].toLowerCase().includes("ole")&&(S.push(v[_]),t=$(e,!0)),b.push(v[_]+",http://www.opengis.net("+t+")")}else b.push(v[_]+",http://www.opengis.net("+e+")")}let j=null;if(null!=r&&r.length){const e=[];m.forEach((t=>t.forEach((t=>e.push(t.name)))));const t=[];for(let i=0;i<r.length;i++){const n=v.find((e=>e===r[i].dimensionName)),s=e.find((e=>e===r[i].variableName));if(t.includes(s)||t.push(s),n){let e=r[i].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t="";t=n.toLowerCase().includes("time")?e.map((e=>$(e))).join(","):e.join(",");const i=b.findIndex((e=>0===e.indexOf(n+",http://www.opengis.net")));-1===i&&b.push(n+",http://www.opengis.net("+t+")"),-1===i||b[i].includes("("+t+")")||b.splice(i,1,n+",http://www.opengis.net("+t+")")}}}t.length&&(j=t.join(","))}else if(p?.length>=2){j=(s.bandIds?s.bandIds.map((e=>p[e])):p).join(",")}const T=b.join("&subset="),L=!o.domainSet.hasSameAxisLabelsAsBoundedBy&&!1!==this.ioConfig.allowScaleFactor,P=L?null:`${y}(${t}),${x}(${i})`,R=L?1/n:null;return{service:"WCS",request:"GetCoverage",version:this.version,coverageId:this.coverageId,rangesubset:j,interpolation:c,scaleSize:P,scaleFactor:R,subset:T,format:f,mediaType:this.ioConfig.allowAnyMediaType?null:"multipart/related",outputcrs:I,subsettingcrs:C}}_constructWCS201Url(e){const t={...this.ioConfig.customFetchParameters,...e},i=[];Object.keys(t).forEach((e=>{const n=t[e];null!=n&&("subset"===e?"string"==typeof n&&n.split("&subset=").forEach((e=>{e&&i.push(`subset=${encodeURIComponent(e)}`)})):i.push(`${e}=${encodeURIComponent(n)}`))}));return`${encodeURI(this.url)}?${i.join("&")}`}};function $(e,t=!1){return(t?new Date(u(e)):new Date(e)).toISOString()}e([n({type:String,json:{write:!0}})],b.prototype,"datasetFormat",void 0),e([n({readOnly:!0})],b.prototype,"tileType",void 0),e([n({type:String,json:{write:!0}})],b.prototype,"version",void 0),e([n({type:String,json:{write:!0}})],b.prototype,"coverageId",void 0),b=e([s("esri.layers.support.rasterDatasets.WCSRaster")],b);const S=b;export{S as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../geometry/Extent.js";import{isAxesOrderReversedForWkid as r}from"../../ogc/crsUtils.js";import{getCapabilities as a,describeCoverage as l}from"../../ogc/wcsUtils.js";import c from"../DimensionalDefinition.js";import d from"./BaseRaster.js";import{parse as f}from"./multipartParser.js";import{standardizeInterpolations as p,convertOleDateTimeToEpoch as u}from"./wcsCoverageParser.js";import{getFormat as h}from"../rasterFormats/RasterCodec.js";import{clip as m}from"../rasterFunctions/pixelUtils.js";const g=["nearest neighbor","bilinear","bicubic"],w=["nearest","linear","cubic"],v="response is not a supported multipart/related mediaType with inline tiff, switching to compatibility mode",y="response is not a supported multipart mediaType with inline tiff",x="response is base64 encoded which may impact layer display performance",I="server returns an exception",C=new Set(["1.0.0","1.1.0","1.1.1","1.1.2","2.0.1"]);let b=class extends d{constructor(){super(...arguments),this.datasetFormat="WCSServer",this.tileType="Raster"}get rasterId(){return`${this.url}-${this.coverageId}-${this.version}`}async fetchRawTile(e,i,n,s={}){if(this.isBlockOutside(e,i,n))return null;const{nativePixelSize:o,spatialReference:r}=this.rasterInfo,a=2**e,l=o.x*a,c=o.y*a,{blockWidth:d,blockHeight:f}=this.getBlockWidthHeight(e),{origin:p}=this.rasterInfo.storageInfo.tileInfo,u=this.getTileExtent({x:l,y:c},i,n,p,r,[d,f]),h=this.rasterInfo.extent,g=u.xmax>h.xmax,w=u.ymin<h.ymin,v=g||w;let y=u,x=d,I=f;if(v&&(y=u.clone().intersection(h),null!=y&&(g&&(x=Math.floor((y.xmax-y.xmin)/l),y.xmax=y.xmin+l*x),w&&(I=Math.floor((y.ymax-y.ymin)/c),y.ymin=y.ymax-c*I))),null==y||x<=1||I<=1)return null;const C=await this._getCoverage(y,x,I,a,s);if(!C)return null;const{coverageDescription:b}=this.coverageInfo,{noDataValue:$,multidimensionalInfo:S}=this.rasterInfo,{multidimensionalDefinition:j}=s;let T;if(null!=S&&null!=j&&j.length){const e=j[0].variableName;if("2.0"===b.version){const t=b.rangeType[0].find((t=>t.name===e));T=t?.nilValue}else if("1.1"===b.version){const t=b.range.find((t=>t.identifier===e));T=t?.nullValues}}const L=T??$,P=await this.decodePixelBlock(C,{width:x,height:I,planes:null,pixelType:null,tiffNoDataValue:Array.isArray(L)?L[0]:L,matchAllNoData:!0});if(null==P)return null;if(P&&(P.width!==x||P.height!==I))throw new t("wcsraster-fetch",`the response has unexpected dimension width: ${P.width}, height: {pixelBlock.height}`);return v?m(P,{x:0,y:0},{width:f,height:f}):P}async _open(e){const{customFetchParameters:i}=this.ioConfig,n=e?.signal,s=await a(this.url,{version:i?.version??this.version,customParameters:i,signal:n});if(this.capabilities=s,!this.version){let e=s.version.slice(0,3);"2.0"===e||"1.1"===e||"1.0"===e?this.version=s.version:(e=s.supportedVersions.find((e=>"2.0.1"===e))||s.supportedVersions.find((e=>"2.0"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.1"===e.slice(0,3)))||s.supportedVersions.find((e=>"1.0"===e.slice(0,3)))||"1.0.0",this.version=e)}const{version:o}=this;if(!C.has(o))throw new t("wcsraster-open",`unsupported WCS version ${o}`);const{gridCoverages:r}=s;if(!r.length)throw new t("wcsraster-open","cannot find rectified grid coverages");this.coverageId??=r[0].id;const{coverageId:c}=this,d=r.find((e=>e.id===c));if(null==d)throw new t("wcsraster-open",`the coverageId ${c} does not exist in capabilities`);const f=await l(this.url,{coverageIds:[c],version:o,customParameters:i,signal:n});if(this.coverageInfo=f[0],"2.0"===o.slice(0,3)){const{coverageInfo:e}=this;e.lonLatEnvelope=d.lonLatEnvelope,e.supportedInterpolations=p(s.supportedInterpolations),this._patchDimensionValues201(c,n)}this.datasetName=this.coverageInfo.title;const{rasterInfo:u}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(u,512,512),this._set("rasterInfo",u),null==u.spatialReference)throw new t("wcsraster-open",`coverage without spatial reference is not supported: ${c}`);const{pixelType:h,bandCount:m}=await this._getPixelTypeAndBandCount(n);u.pixelType=h,1===u.bandCount&&m>1&&(u.bandCount=m),this.updateTileInfo()}async _patchDimensionValues201(e,t){const{coverageInfo:i}=this,n=i.rasterInfo.multidimensionalInfo?.variables,s=C.has("1.1.2")?"1.1.2":C.has("1.1.1")?"1.1.1":C.has("1.1.0")?"1.1.0":null,{customFetchParameters:o}=this.ioConfig;if(n&&s)try{const i=this.url.includes("/ImageServer/"),r=e.length>8&&e.startsWith("Coverage")&&i?e.slice(8):e,a=await l(this.url,{coverageIds:[r??e],version:s,customParameters:o,signal:t}).catch((()=>{if(r)return l(this.url,{coverageIds:[e],version:s,customParameters:o,signal:t})})),c=a?.[0].rasterInfo.multidimensionalInfo?.variables;if(c)for(const e of n){const t=c.find((({name:t})=>t===e.name));if(t?.dimensions?.length)for(let n=e.dimensions.length-1;n>=0;n--){const s=e.dimensions[n],o=t.dimensions.find((({name:e})=>e===s.name));o?o.values&&o.extent?.join(",")===s.extent?.join(",")&&(e.dimensions[n]={...s,values:o.values}):i&&e.dimensions.splice(n,1)}}}catch{}}async _getPixelTypeAndBandCount(e){const{pixelSize:n,extent:s,multidimensionalInfo:r}=this.rasterInfo,a=s.center,l=new o({xmin:a.x-n.x,xmax:a.x+n.x,ymin:a.y-n.y,ymax:a.y+n.y,spatialReference:s.spatialReference});let d=[];if(null!=r){const e=r.variables[0];d=[],e.dimensions.forEach((t=>{d.push(new c({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent?.[0]:t.values?.[0],isSlice:!0}))}))}const{coverageDescription:f}=this.coverageInfo,p={interpolation:"nearest",multidimensionalDefinition:d,signal:e},{version:u}=f,{ioConfig:h}=this,m="2.0"===u&&null==h.allowAnyMediaType||"1.1"===u&&null==h.use2GridOffsets;let g;try{g=await this._getCoverage(l,2,2,1,p,!0)}catch(y){if(!m)throw y;if("1.1"===u){if(!y.details?.isResolutionMismatch)throw y;h.use2GridOffsets=!0}}if(!g&&m&&("2.0"===u&&(h.allowAnyMediaType=!0),g=await this._getCoverage(l,2,2,1,p),g&&i.getLogger(this).warn("wcsraster:getcoverage",v)),!g)throw new t("wcsraster-open","unable to determine pixel type");const w=await this.decodePixelBlock(g,{width:2,height:2,planes:null,pixelType:null});if(null==w)throw new t("wcsraster-open","unable to determine pixel type");return{pixelType:w.pixelType,bandCount:w.getPlaneCount()??0}}async _getCoverage(e,n,s,o,r,a=!1){const{coverageDescription:l}=this.coverageInfo,{version:c}=l,d="2.0"===c?this._getCoverage201Parameters(e,n,s,o,r,l):"1.1"===c?this._getCoverage110Parameters(e,n,s,r,l):this._getCoverage100Parameters(e,n,s,r),p="2.0"===c?await this.request(this._constructWCS201Url(d),{signal:r.signal,responseType:"array-buffer"}):await this.request(this.url,{query:d,signal:r.signal,responseType:"array-buffer"});if("1.0"===c)return p.data;if("2.0"===c&&!1!==this.ioConfig.allowAnyMediaType){if("tiff"===h(p.data))return a&&(this.ioConfig.allowAnyMediaType=!0,i.getLogger(this).warn("wcsraster:getcoverage",v)),p.data}const u=f(p);if(u.isMultipart&&u.data){const e=u.data.find((e=>e.isValidImage));return a&&"base64"===e?.contentTransferEncoding&&i.getLogger(this).warn("wcsraster:getcoverage",x),e?.contentData}const m=new Uint8Array(p.data,0,Math.min(p.data.byteLength,2e3)),g=String.fromCharCode.apply(null,m).toLowerCase().includes("exception"),w=g&&String.fromCharCode.apply(null,m).includes("A non-zero RESX/RESY or WIDTH/HEIGHT is required but neither was provided");if(g)throw new t("wcsraster:getcoverage",I,{isResolutionMismatch:w});throw new t("wcsraster:getcoverage",y)}_getInterpolationIndex(e){return e&&this.coverageInfo.supportedInterpolations?.includes(e)?"nearest"===e?0:"bilinear"===e?1:"cubic"===e?2:0:0}_getCoverage100Parameters(e,t,i,n){const s=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,o=e.spatialReference.wkid,r=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"GEOTIFF",{bandIds:a,interpolation:l}=n,c=this._getInterpolationIndex(l),d=a?a.map((e=>this.coverageInfo.bandNames[e])):null,f=g[c],{multidimensionalDefinition:p}=n;let u;if(null!=p&&null!=this.rasterInfo.multidimensionalInfo){const e=p.find((e=>"StdTime"===e.dimensionName));let t=e?.values;t&&t.length>0&&(Array.isArray(t[0])&&(t=t[0]),u=t.map((e=>$(e))).join(","))}return{service:"WCS",request:"GetCoverage",version:this.version,coverage:this.coverageId,format:r,crs:`EPSG:${o}`,bbox:s,width:t,height:i,time:u,interpolation:f,band:d?.join(",")}}_getCoverage110Parameters(e,t,i,n,s){const{multidimensionalDefinition:o,bandIds:a,interpolation:l}=n,c=e.spatialReference.wkid,d=`urn:ogc:def:crs:EPSG::${c}`,f=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"image/tiff",p=this._getInterpolationIndex(l),u=w[p],h=null==l||0===this.coverageInfo.supportedInterpolations?.indexOf(l),m=s.domain.spatialDomain,g=m.origin.x<=m.envelope.xmin&&m.origin.y<=m.envelope.ymin,v=e.width/t,y=e.height/i*(g?1:-1),x=g?[e.xmin,e.ymin]:[e.xmin,e.ymax],I=m.useEPSGAxis&&r(c),C=I?`${x[1]},${x[0]}`:`${x[0]},${x[1]}`,b=this.ioConfig.use2GridOffsets,S=I?b?`${y},${v}`:`${y},0,0,${v}`:b?`${v},${y}`:`${v},0,0,${y}`,j=v/2,T=e.xmin+j,L=e.xmax-j,P=Math.abs(y)/2,R=e.ymin+P,_=e.ymax-P,D=I?`${R},${T},${_},${L},${d}`:`${T},${R},${L},${_},${d}`,A=s.range.find((e=>e.axis.some((e=>e.identifier.toLowerCase().includes("band")))));let E,G=A&&u&&a?h?`${A.identifier}[${A.axis[0].identifier}[${a.join(",")}]]`:`${A.identifier}:${u}[${A.axis[0].identifier}[${a.join(",")}]]`:null;if(null!=o&&o.length)for(let r=0;r<o.length;r++){let e=o[r].values;const t=o[r].dimensionName?.toLowerCase(),i=o[r].variableName?.toLowerCase(),n=s.range.find((e=>e.identifier.toLowerCase()===i));if(e.length>0)if(Array.isArray(e[0])&&(e=e[0]),"stdtime"===t)E=e.map((e=>$(e))).join(",");else if(n){const i=n.axis.find((e=>e.identifier.toLowerCase()===t));i&&(G=h?n.identifier+"["+i.identifier+"["+e.join(",")+"]]":n.identifier+":"+u+"["+i.identifier+"["+e.join(",")+"]]")}r===o.length-1&&n&&!G&&(G=h?n.identifier:n.identifier+":"+u)}return{service:"WCS",request:"GetCoverage",version:this.version,identifier:this.coverageId,format:f,crs:`EPSG:${c}`,boundingbox:D,gridCS:"urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS",gridType:"urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs",gridOrigin:C,gridOffsets:S,gridBaseCRS:d,timeSequence:E,rangeSubset:G}}_getCoverage201Parameters(e,t,i,n,s,o){const{multidimensionalDefinition:r,interpolation:a}=s,l=this._getInterpolationIndex(a);let c=null;const{supportedInterpolations:d}=this.capabilities;if(d?.length)switch(l){case 0:c=d.find((e=>e.toLowerCase().includes("nearest")));break;case 1:c=d.find((e=>e.toLowerCase().includes("linear")));break;case 2:c=d.find((e=>e.toLowerCase().includes("cubic")||e.toLowerCase().includes("quadratic")))}const f=(this.coverageInfo.supportedFormats||[]).find((e=>e.toLowerCase().includes("tiff")))||"image/tiff",{bandNames:p}=this.coverageInfo,{boundedBy:u,domainSet:h,rangeType:m}=o,g=u.isEastFirst?0:1,w=1-g,{axisLabels:v}=u,y=v[g],x=v[w],I=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,C=I,b=[];b.push(`${y}(${e.xmin},${e.xmax})`),b.push(`${x}(${e.ymin},${e.ymax})`);const S=[];if(v.length>2)for(let _=2;_<v.length;_++){const e=h.origin[_];if(v[_].toLowerCase().includes("time")){let t=e.toString();u.uomLabels?.[_].toLowerCase().includes("ole")&&(S.push(v[_]),t=$(e,!0)),b.push(v[_]+",http://www.opengis.net("+t+")")}else b.push(v[_]+",http://www.opengis.net("+e+")")}let j=null;if(null!=r&&r.length){const e=[];m.forEach((t=>t.forEach((t=>e.push(t.name)))));const t=[];for(let i=0;i<r.length;i++){const n=v.find((e=>e===r[i].dimensionName)),s=e.find((e=>e===r[i].variableName));if(t.includes(s)||t.push(s),n){let e=r[i].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t="";t=n.toLowerCase().includes("time")?e.map((e=>$(e))).join(","):e.join(",");const i=b.findIndex((e=>0===e.indexOf(n+",http://www.opengis.net")));-1===i&&b.push(n+",http://www.opengis.net("+t+")"),-1===i||b[i].includes("("+t+")")||b.splice(i,1,n+",http://www.opengis.net("+t+")")}}}t.length&&(j=t.join(","))}else if(p?.length>=2){j=(s.bandIds?s.bandIds.map((e=>p[e])):p).join(",")}const T=b.join("&subset="),L=!o.domainSet.hasSameAxisLabelsAsBoundedBy&&!1!==this.ioConfig.allowScaleFactor,P=L?null:`${y}(${t}),${x}(${i})`,R=L?1/n:null;return{service:"WCS",request:"GetCoverage",version:this.version,coverageId:this.coverageId,rangesubset:j,interpolation:c,scaleSize:P,scaleFactor:R,subset:T,format:f,mediaType:this.ioConfig.allowAnyMediaType?null:"multipart/related",outputcrs:I,subsettingcrs:C}}_constructWCS201Url(e){const t={...this.ioConfig.customFetchParameters,...e},i=[];Object.keys(t).forEach((e=>{const n=t[e];null!=n&&("subset"===e?"string"==typeof n&&n.split("&subset=").forEach((e=>{e&&i.push(`subset=${encodeURIComponent(e)}`)})):i.push(`${e}=${encodeURIComponent(n)}`))}));return`${encodeURI(this.url)}?${i.join("&")}`}};function $(e,t=!1){return(t?new Date(u(e)):new Date(e)).toISOString()}e([n({type:String,json:{write:!0}})],b.prototype,"datasetFormat",void 0),e([n({readOnly:!0})],b.prototype,"tileType",void 0),e([n({type:String,json:{write:!0}})],b.prototype,"version",void 0),e([n({type:String,json:{write:!0}})],b.prototype,"coverageId",void 0),e([n({readOnly:!0})],b.prototype,"rasterId",null),b=e([s("esri.layers.support.rasterDatasets.WCSRaster")],b);const S=b;export{S 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.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import a from"../PixelBlock.js";import{SimpleBandStatistics as i}from"../SimpleBandStatistics.js";import s from"./ImageCanvasDecoder.js";import r from"./JpgPlus.js";import{load as n,decode as o}from"./Lerc.js";import{decode as h}from"./Lzw.js";import{convertNoDataToMask as c}from"./pixelRangeUtils.js";import{Z as l}from"../../../chunks/Zlib.js";import p from"./Raw.js";import{decodeTileOrStrip as d,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as f}from"./utils.js";var m=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,h,c,p,d,u,f,m,g,w,y,x,b,k,T,I,C;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new l(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<w;s=b+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],i=(s-s%u)/u,y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=I=0;I<w;s=I+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=C=0;C<w;s=C+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===g?y=x=0:(y=f[(g-1)*w+i*u+s%u],x=i&&f[(g-1)*w+(i-1)*u+s%u]),o=r+y-x,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-x),c=h<=p&&h<=d?r:p<=d?y:x,f[a++]=(e+c)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const g=new Set(["jpg","png","bmp","gif"]);async function w(e,s){if(!f)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await n();const{offset:r}=s,{width:h,height:c,pixelType:l,statistics:p,depthCount:d,noDataValues:u,bandMasks:m,pixels:g,mask:w}=o(e,{inputOffset:r,returnInterleaved:s.returnInterleaved}),y=new a({width:h,height:c,pixelType:l.toLowerCase(),pixels:g,mask:w,statistics:p.map((({minValue:t,maxValue:e})=>new i(t,e))),bandMasks:m,depthCount:d,noDataValues:u});return p?.length||y.updateStatistics(),y}async function y(t,i){const s=await u(t,{...i,noDataValue:i.tiffNoDataValue});e(s);const r=new a({width:s.width,height:s.height,pixels:s.pixels,pixelType:s.pixelType.toLowerCase(),mask:s.mask,bandMasks:s.bandMasks,statistics:null});return r.updateStatistics(),r}async function x(t,e){const i=await d(t,e.customOptions),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,statistics:null});return s.updateStatistics(),s}function b(t,e){const i=e.pixelType||"u8",s=a.getPixelArrayConstructor(i),r="u8"===i?t:new s(t.buffer),n=[],o=e.planes||1;if(1===o)n.push(r);else for(let a=0;a<o;a++){const i=(e.width||1)*(e.height||t.length),h=new s(i);for(let t=0;t<i;t++)h[t]=r[t*o+a];n.push(h)}const h=new a({width:e.width||1,height:e.height||t.length,pixels:n,pixelType:i,statistics:null});return h.updateStatistics(),h}function k(t,e){return b(new l(new Uint8Array(t)).getBytes(),e)}function T(t,e){return b(h(t,e.offset,e.eof,!e.isInputBigEndian),e)}function I(t,e,i){const{pixelTypeCtor:s}=S(e.pixelType),r=(0,p.decode)(t,{width:e.width,height:e.height,pixelType:s,format:i}),n=new a({width:e.width,height:e.height,pixels:r.pixels,pixelType:e.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function C(t,e){const i=r.decode(t,e.hasNoZlibMask??void 0),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:"u8",mask:i.mask,statistics:null});return s.updateStatistics(),s}function v(t,e){const i=new Uint8Array(t),s=new m(i),{width:r,height:n}=e,o=r*n,h=s.decode();let c,l=0,p=0;const d=new Uint8Array(o);for(l=0;l<o;l++)d[l]=h[4*l+3];const u=new a({width:r,height:n,pixels:[],pixelType:"u8",mask:d,statistics:[]});for(l=0;l<3;l++){for(c=new Uint8Array(o),p=0;p<o;p++)c[p]=h[4*p+l];u.addData({pixels:c})}return u.updateStatistics(),u}async function A(t,e,i,r){const n=new s,o={applyJpegMask:!1,format:e,...i},h=await n.decode(t,o,r),c=new a(h);return c.updateStatistics(),c}function U(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function D(e){let a=null;switch(e){case"lerc":case"lerc2":a=w;break;case"jpg":a=C;break;case"png":a=v;break;case"bsq":case"bip":a=(t,a)=>I(t,a,e);break;case"tiff":a=y;break;case"deflate":a=k;break;case"lzw":a=T;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function S(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function O(t,e=1){if(!t)return;const{pixels:i,width:s,height:r,mask:n}=t;if(!i||0===i.length)return;const o=i.length,h=s-1,c=r-1,l=[];let p,d,u,f,m,g,w=null;const y=a.getPixelArrayConstructor(t.pixelType);if(0===e){for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=m[f+u];l.push(g)}if(null!=n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=n[f+u]}else{for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=(m[f+u]+m[f+u+1]+m[f+s+u]+m[f+s+u+1])/4;l.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=Math.min.apply(null,[n[f+u],n[f+u+1],n[f+s+u],n[f+s+u+1]])}t.width=h,t.height=c,t.mask=w,t.pixels=l}function P(t){let e=U(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function j(e,i={},s){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let r=i.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&i.customOptions)return x(e,i);if((!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r)&&(r=U(e)),i.useCanvas&&g.has(r))return A(e,r,i,s);const n=D(r);let o;i.isPoint&&(null!=(i={...i}).width&&i.width++,null!=i.height&&i.height++);const{offsets:h}=i;if(h&&h.length>1){const t=h.map(((t,a)=>n(e.slice(t,h[a+1]),i))),s=await Promise.all(t);o=s[0],o.pixels=s.map((t=>t.pixels[0]));const r=s.map((t=>t.mask));s.some((t=>null!=t))&&(r.forEach(((t,e)=>{null==t&&(r[e]=new Uint8Array(o.width*o.height).fill(255))})),o.bandMasks=r,o.mask=a.combineBandMasks(r)),o.updateStatistics()}else o=await n(e,{...i,offset:h?.[0]??i.offset});return"jpg"!==r&&null!=i.noDataValue&&1===o.depthCount&&c(o,i.noDataValue,{customFloatTolerance:i.tolerance}),i.isPoint&&O(o),o}export{j as decode,P as getFormat};
5
+ import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import a from"../PixelBlock.js";import{SimpleBandStatistics as i}from"../SimpleBandStatistics.js";import s from"./ImageCanvasDecoder.js";import r from"./JpgPlus.js";import{load as n,decode as o}from"./Lerc.js";import{decode as h}from"./Lzw.js";import{convertNoDataToMask as c}from"./pixelRangeUtils.js";import{Z as l}from"../../../chunks/Zlib.js";import p from"./Raw.js";import{decodeTileOrStrip as d,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as f}from"./utils.js";var m=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,h,c,p,d,u,f,m,g,w,y,x,b,k,T,I,A;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new l(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<w;s=b+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],i=(s-s%u)/u,y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=I=0;I<w;s=I+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=A=0;A<w;s=A+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===g?y=x=0:(y=f[(g-1)*w+i*u+s%u],x=i&&f[(g-1)*w+(i-1)*u+s%u]),o=r+y-x,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-x),c=h<=p&&h<=d?r:p<=d?y:x,f[a++]=(e+c)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const g=new Set(["jpg","png","bmp","gif"]);async function w(e,s){if(!f)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await n();const{offset:r}=s,{width:h,height:c,pixelType:l,statistics:p,depthCount:d,noDataValues:u,bandMasks:m,pixels:g,mask:w}=o(e,{inputOffset:r,returnInterleaved:s.returnInterleaved}),y=new a({width:h,height:c,pixelType:l.toLowerCase(),pixels:g,mask:w,statistics:p.map((({minValue:t,maxValue:e})=>new i(t,e))),bandMasks:m,depthCount:d,noDataValues:u});return p?.length||y.updateStatistics(),y}async function y(t,i){const s=await u(t,{...i,noDataValue:i.tiffNoDataValue,matchAllNoData:i.matchAllNoData});e(s);const r=new a({width:s.width,height:s.height,pixels:s.pixels,pixelType:s.pixelType.toLowerCase(),mask:s.mask,bandMasks:s.bandMasks,statistics:null});return r.updateStatistics(),r}async function x(t,e){const i=await d(t,e.customOptions),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,statistics:null});return s.updateStatistics(),s}function b(t,e){const i=e.pixelType||"u8",s=a.getPixelArrayConstructor(i),r="u8"===i?t:new s(t.buffer),n=[],o=e.planes||1;if(1===o)n.push(r);else for(let a=0;a<o;a++){const i=(e.width||1)*(e.height||t.length),h=new s(i);for(let t=0;t<i;t++)h[t]=r[t*o+a];n.push(h)}const h=new a({width:e.width||1,height:e.height||t.length,pixels:n,pixelType:i,statistics:null});return h.updateStatistics(),h}function k(t,e){return b(new l(new Uint8Array(t)).getBytes(),e)}function T(t,e){return b(h(t,e.offset,e.eof,!e.isInputBigEndian),e)}function I(t,e,i){const{pixelTypeCtor:s}=S(e.pixelType),r=(0,p.decode)(t,{width:e.width,height:e.height,pixelType:s,format:i}),n=new a({width:e.width,height:e.height,pixels:r.pixels,pixelType:e.pixelType,mask:r.mask,statistics:null});return n.updateStatistics(),n}function A(t,e){const i=r.decode(t,e.hasNoZlibMask??void 0),s=new a({width:i.width,height:i.height,pixels:i.pixels,pixelType:"u8",mask:i.mask,statistics:null});return s.updateStatistics(),s}function C(t,e){const i=new Uint8Array(t),s=new m(i),{width:r,height:n}=e,o=r*n,h=s.decode();let c,l=0,p=0;const d=new Uint8Array(o);for(l=0;l<o;l++)d[l]=h[4*l+3];const u=new a({width:r,height:n,pixels:[],pixelType:"u8",mask:d,statistics:[]});for(l=0;l<3;l++){for(c=new Uint8Array(o),p=0;p<o;p++)c[p]=h[4*p+l];u.addData({pixels:c})}return u.updateStatistics(),u}async function v(t,e,i,r){const n=new s,o={applyJpegMask:!1,format:e,...i},h=await n.decode(t,o,r),c=new a(h);return c.updateStatistics(),c}function D(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function U(e){let a=null;switch(e){case"lerc":case"lerc2":a=w;break;case"jpg":a=A;break;case"png":a=C;break;case"bsq":case"bip":a=(t,a)=>I(t,a,e);break;case"tiff":a=y;break;case"deflate":a=k;break;case"lzw":a=T;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function S(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function O(t,e=1){if(!t)return;const{pixels:i,width:s,height:r,mask:n}=t;if(!i||0===i.length)return;const o=i.length,h=s-1,c=r-1,l=[];let p,d,u,f,m,g,w=null;const y=a.getPixelArrayConstructor(t.pixelType);if(0===e){for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=m[f+u];l.push(g)}if(null!=n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=n[f+u]}else{for(p=0;p<o;p++){for(m=i[p],g=new y(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)g[d*h+u]=(m[f+u]+m[f+u+1]+m[f+s+u]+m[f+s+u+1])/4;l.push(g)}if(n)for(w=new Uint8Array(h*c),d=0;d<c;d++)for(f=d*s,u=0;u<h;u++)w[d*h+u]=Math.min.apply(null,[n[f+u],n[f+u+1],n[f+s+u],n[f+s+u+1]])}t.width=h,t.height=c,t.mask=w,t.pixels=l}function P(t){let e=D(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function j(e,i={},s){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let r=i.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&i.customOptions)return x(e,i);if((!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r)&&(r=D(e)),i.useCanvas&&g.has(r))return v(e,r,i,s);const n=U(r);let o;i.isPoint&&(null!=(i={...i}).width&&i.width++,null!=i.height&&i.height++);const{offsets:h}=i;if(h&&h.length>1){const t=h.map(((t,a)=>n(e.slice(t,h[a+1]),i))),s=await Promise.all(t);o=s[0],o.pixels=s.map((t=>t.pixels[0]));const r=s.map((t=>t.mask));s.some((t=>null!=t))&&(r.forEach(((t,e)=>{null==t&&(r[e]=new Uint8Array(o.width*o.height).fill(255))})),o.bandMasks=r,o.mask=a.combineBandMasks(r)),o.updateStatistics()}else o=await n(e,{...i,offset:h?.[0]??i.offset});return"jpg"!==r&&null!=i.noDataValue&&1===o.depthCount&&c(o,i.noDataValue,{customFloatTolerance:i.tolerance}),i.isPoint&&O(o),o}export{j as decode,P as getFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/has.js";import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as s}from"./pixelRangeUtils.js";import r from"./TiffTags.js";import{isPlatformLittleEndian as l}from"./utils.js";import{Z as o}from"../../../chunks/Zlib.js";const f=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],u=4294967296,c=new Set([1,5,6,7,8,34712,34887]);function h(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function g(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function E(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function T(e,t){return e.get(t)?.values}function I(e,t){return e.get(t)?.values}function w(e,t){return e.get(t)?.values?.[0]}function p(e,t){return e.get(t)?.values?.[0]}function d(e,t,n,a=0,i=r.tiffTags,s=4){const l=8===s,o=l?C(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),f=4+2*s,u=l?8:2,c=u+o*f;if(n+c>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:c};const h=n+c+4<=e.byteLength?v(new DataView(e,n+c,8===s?8:4),0,t,8===s):null,g=n+u,E=new Map;let T,I,w,p,d,m=0,y=0;for(let S=0;S<o;S++){I=new DataView(e,g+f*S,f),w=I.getUint16(0,t),d=I.getUint16(2,t),p=r.getTagName(w,i);const n=[];2===s?(m=I.getUint16(4,t),y=I.getUint16(6,t)):4===s?(m=I.getUint32(4,t),y=I.getUint32(8,t)):8===s&&(m=v(I,4,t,!0),y=v(I,12,t,!0),n.push(I.getUint32(12,t)),n.push(I.getUint32(16,t))),T={id:w,type:d,valueCount:m,valueOffset:y,valueOffsets:n,values:null},L(e,t,T,a,!1,s),E.set(p,T)}return{success:!0,ifd:E,nextIFD:h,requiredBufferSize:c}}const m=(e,t)=>a(e,{inputOffset:t}).pixels[0];function y(e,t){if(1!==t&&2!==t&&4!==t)return e;const n=new Uint8Array(e),a=8/t,i=new Uint8Array(e.byteLength*a);let s=0;const r=2**t-1;for(let l=0;l<n.length;l++){const e=n[l];for(let n=0;n<a;n++)i[s++]=e<<t*n>>>8-t&r}return i.buffer}function S(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const s=i.getData(i.width,i.height,1!==n&&4!==n);return new Uint8Array(s.buffer)}function A(e){const t=new o(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}async function M(e,t,a,s,r){const o=l===t,f=p(a,"BITSPERSAMPLE"),u=p(a,"SAMPLESPERPIXEL")??1,c=p(a,"PHOTOMETRICINTERPRETATION"),E=p(a,"SAMPLEFORMAT")??1,T=h(E,f),I=p(a,"COMPRESSION")??1,w=g(T);let d,M,P;if(34887===I)return await n(),m(e,s);if(1===I)d=e.slice(s,s+r),M=new Uint8Array(d);else if(8===I||32946===I)M=new Uint8Array(e,s,r),M=A(M),d=M.buffer;else if(6===I)M=new Uint8Array(e,s,r),M=S(M,u,c),d=M.buffer;else if(7===I){const t=a.get("JPEGTABLES").values,n=t.length-2;M=new Uint8Array(n+r-2);for(let e=0;e<n;e++)M[e]=t[e];const i=new Uint8Array(e,s+2,r-2);for(let e=0;e<i.length;e++)M[n+e]=i[e];M=S(M,u,c),d=M.buffer}else{if(5!==I)throw new Error("tiff-decode: unsupport compression "+I);M=i(e,s,r,t),d=M.buffer}if(d=y(d,f),"u8"===T||"s8"===T||o)P=new w(d);else{d=new ArrayBuffer(M.length);const e=new Uint8Array(d);switch(T){case"u16":case"s16":for(let t=0;t<M.length;t+=2)e[t]=M[t+1],e[t+1]=M[t];break;case"u32":case"s32":case"f32":for(let t=0;t<M.length;t+=4)e[t]=M[t+3],e[t+1]=M[t+2],e[t+2]=M[t+1],e[t+3]=M[t]}P=new w(d)}const O=p(a,"PREDICTOR")??1,b=p(a,"TILEWIDTH"),x=p(a,"TILELENGTH");if(O>1&&(5===I||8===I||32946===I)&&b&&x){const e=D(a),t=new w(P.length);t.set(P),P=W(t,x,b,3===E&&3===O,e?1:u)}return P}async function P(e,t,n){const a=I(n,"TILEOFFSETS");if(void 0===a)return null;const i=I(n,"TILEBYTECOUNTS"),{width:s,height:r,pixelType:l,tileWidth:o,tileHeight:f}=R([n]),u=D(n,t),c=p(n,"SAMPLESPERPIXEL")||t.planes,h=s*r,E=p(n,"BITSPERSAMPLE"),T=34887===(p(n,"COMPRESSION")??1),w=g(l),d=[];for(let g=0;g<c;g++)d.push(new w(h));let m,y,S,A,P,O,b,x,L,U,N,k,C;const G=Math.ceil(s/o),v=new Uint8Array(h).fill(255);let F=!1;if(E%8==0)if(T&&u&&c>1){const l=Math.round(a.length/c);for(m=0;m<l;m++){O=Math.floor(m/G)*f,b=m%G*o,x=O*s+b;for(let l=0;l<c;l++){const u=m*c+l;for(0===i[u]?(S=null,F=!0):S=await M(e,t.littleEndian,n,a[u],i[u]),U=0,L=x,k=Math.min(o,s-b),N=Math.min(f,r-O),C=d[l],A=0;A<N;A++)for(L=x+A*s,U=A*o,P=0;P<k;P++,L++,U++)S?C[L]=S[U]:v[L]=0}}}else for(m=0;m<a.length;m++)for(O=Math.floor(m/G)*f,b=m%G*o,x=O*s+b,0===i[m]?(S=null,F=!0):S=await M(e,t.littleEndian,n,a[m],i[m]),U=0,L=x,k=Math.min(o,s-b),N=Math.min(f,r-O),y=0;y<c;y++)if(C=d[y],u||T)for(A=0;A<N;A++)for(L=x+A*s,U=o*f*y+A*o,P=0;P<k;P++,L++,U++)S?C[L]=S[U]:v[L]=0;else for(A=0;A<N;A++)for(L=x+A*s,U=A*o*c+y,P=0;P<k;P++,L++,U+=c)S?C[L]=S[U]:v[L]=0;return{width:s,height:r,pixelType:l,pixels:d,mask:F?v:void 0}}const O=(e,t,n)=>{const a=l===t.littleEndian,s=I(n,"STRIPOFFSETS");if(void 0===s)return null;const{width:r,height:o,pixelType:f}=R([n]),u=p(n,"SAMPLESPERPIXEL")||t.planes,c=p(n,"PHOTOMETRICINTERPRETATION"),h=r*o,E=p(n,"BITSPERSAMPLE"),T=g(f),w=new T(h*u),d=I(n,"STRIPBYTECOUNTS"),m=p(n,"ROWSPERSTRIP"),M=p(n,"COMPRESSION")??1;let P,O,b,x,L,D,U,N,k;if(E%8==0)for(P=0;P<s.length;P++){if(L=P*(m*r)*u,"u8"===f||"s8"===f||a)8===M||32946===M?(U=new Uint8Array(e,s[P],d[P]),U=A(U),D=U.buffer):6===M?(U=new Uint8Array(e,s[P],d[P]),U=S(U,u,c),D=U.buffer):5===M?(U=i(e,s[P],d[P],t.littleEndian),D=U.buffer):D=e.slice(s[P],s[P]+d[P]),D=y(D,E),x=new T(D);else{switch(6===M||8===M||32946===M?(U=new Uint8Array(e,s[P],d[P]),N=A(U),D=N.buffer):(D=new ArrayBuffer(d[P]),U=new Uint8Array(e,s[P],d[P]),N=new Uint8Array(D)),f){case"u16":case"s16":for(b=0;b<U.length;b+=2)N[b]=U[b+1],N[b+1]=U[b];break;case"u32":case"s32":case"f32":for(b=0;b<U.length;b+=4)N[b]=U[b+3],N[b+1]=U[b+2],N[b+2]=U[b+1],N[b+3]=U[b]}D=y(D,E),x=new T(D)}w.set(x,L)}const C=[];if(1===u)C.push(w);else for(P=0;P<u;P++){for(k=new T(h),O=0;O<h;O++)k[O]=w[O*u+P];C.push(k)}return{width:r,height:o,pixelType:f,pixels:C}},b=(e,t,n)=>{if(!(e.length>0&&t&&n))return null;let a,i,s;const r=e[0].length,l=e.length,o=new Uint8Array(r);for(let f=0;f<l;f++)if(a=e[f],i=t[f],s=n[f],0===f)for(let e=0;e<r;e++)o[e]=a[e]<i||a[e]>s?0:1;else for(let e=0;e<r;e++)o[e]&&(o[e]=a[e]<i||a[e]>s?0:1);return o},x=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,s,r,l;for(let w=0;w<t.length;w++)a=t[w],i=a.slice(6,a.indexOf(">")),r=a.indexOf("sample="),r>-1&&(l=a.slice(r+8,a.indexOf('"',r+8))),r=a.indexOf("name="),r>-1&&(i=a.slice(r+6,a.indexOf('"',r+6))),i&&(s=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=s:n.set(i,[s]):n.set(i,s)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),T=n.get("WavelengthMax");let I=null;if(g){I=[];for(let e=0;e<g.length;e++)I.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:T&&parseFloat(T[e])})}return{statistics:h,bandProperties:I,dataType:n.get("DataType"),rawMetadata:n}};function L(e,t,n,a=0,i=!1,s=4){if(n.values)return!0;const r=n.type,l=n.valueCount;let o=n.valueOffset,c=[];const h=f[r],g=8*h,E=l*h,T=l*f[r]*8;let I,w;const p=8===s?64:32,d=n.valueOffsets;if(T>p){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(T<=p){if(!t)if(p<=32)o>>>=32-T;else{const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);T<=32?(o=e>>>32-T,d[0]=o):(o=e*2**(32-T)+(t>>>32-T),d[0]=e,d[1]=t>>>32-T)}if(1===l&&g===p)c=[o];else if(64===p){const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);let n=e,a=32;for(w=1;w<=l;w++){const e=32-g*w%32;if(a<g){const i=n<<e>>>32-a,s=t<<32-a>>>32-a;n=t,c.push(i+s*2**(g-a)),a-=32-(g-a)}else c.push(n<<e>>>32-g),a-=g;0===a&&(a=32,n=t)}}else for(w=1;w<=l;w++){const e=32-g*w;c.push(o<<e>>>32-g)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=h){switch(r){case 1:case 2:case 7:I=new DataView(e,n,1).getUint8(0);break;case 3:I=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:I=new DataView(e,n,4).getUint32(0,t);break;case 5:I=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:I=new DataView(e,n,1).getInt8(0);break;case 8:I=new DataView(e,n,2).getInt16(0,t);break;case 9:I=new DataView(e,n,4).getInt32(0,t);break;case 10:I=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:I=new DataView(e,n,4).getFloat32(0,t);break;case 12:I=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:I=C(new DataView(e,n,8),0,t);break;case 17:I=G(new DataView(e,n,8),0,t);break;default:I=null}c.push(I)}}if(2===r){let e="";const t=c;for(c=[],w=0;w<t.length;w++)0===t[w]&&""!==e?(c.push(e),e=""):e+=String.fromCharCode(t[w]);""===e&&0!==c.length||c.push(e)}return n.values=c,!0}function R(e){const t=e[0],n=p(t,"TILEWIDTH"),a=p(t,"TILELENGTH"),i=p(t,"IMAGEWIDTH"),s=p(t,"IMAGELENGTH"),r=p(t,"BITSPERSAMPLE"),l=p(t,"SAMPLESPERPIXEL"),o=p(t,"SAMPLEFORMAT")??1,f=h(o,r),u=D(t),g=T(t,"GDAL_NODATA");let d=null;g?.length&&(d=g.map((e=>parseFloat(e))),d.some((e=>isNaN(e)))&&(d=null));const m=p(t,"COMPRESSION")??1;let y;switch(m){case 1:y="NONE";break;case 2:case 3:case 4:case 32771:y="CCITT";break;case 5:y="LZW";break;case 6:case 7:y="JPEG";break;case 32773:y="PACKBITS";break;case 8:case 32946:y="DEFLATE";break;case 34712:y="JPEG2000";break;case 34887:y="LERC";break;default:y=String(m)}let S=!0,A="";c.has(m)||(S=!1,A+="unsupported tag compression "+m),o>3&&(S=!1,A+="unsupported tag sampleFormat "+o),1!==r&&2!==r&&4!==r&&r%8!=0&&(S=!1,A+="unsupported tag bitsPerSample "+r);const M=w(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find((e=>e.includes("ESRI PE String = "))),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=I(t,"GEOTIEPOINTS"),b=I(t,"GEOPIXELSCALE"),L=I(t,"GEOTRANSMATRIX"),R=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let k,C,G=!1,v=!1;if(R){G=2===p(R,"GTRasterTypeGeoKey");const e=p(R,"GTModelTypeGeoKey");if(2===e){const e=p(R,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(v=!0,P={wkid:4326})}else if(1===e){const e=p(R,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(k=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],G&&(k[2]-=.5*k[0]+.5*k[1],k[5]-=.5*k[3]+.5*k[4])):L&&16===L.length&&(k=G?[L[0],L[1],L[3]-.5*L[0],L[4],L[5],L[7]-.5*L[5]]:[L[0],L[1],L[3],L[4],L[5],L[7]]),k){const e=[{x:0,y:s},{x:0,y:0},{x:i,y:s},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=E(e[i],k),n=t.x>n?n:t.x,r=t.x<r?r:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;C={xmin:n,xmax:r,ymin:a,ymax:l,spatialReference:P}}else C={xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:P};v&&(C.xmax-C.xmin>400||Math.max(Math.abs(C.xmin),Math.abs(C.xmax))>361)&&(P=null,C.spatialReference=null);const F=U(e);let B,W,H,Y,_;if(F.length>0){H=Math.round(Math.log(i/p(F[0],"IMAGEWIDTH"))/Math.LN2);const e=F[F.length-1];Y=F.length,B=p(e,"TILEWIDTH"),W=p(e,"TILELENGTH")}B=null!=Y&&Y>0?B||n:null,W=null!=Y&&Y>0?W||a:null,n&&(_=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(s/a)-1,minRow:0,minCol:0}],F.forEach((e=>{_.push({maxCol:Math.ceil(p(e,"IMAGEWIDTH")/p(e,"TILEWIDTH"))-1,maxRow:Math.ceil(p(e,"IMAGELENGTH")/p(e,"TILELENGTH"))-1,minRow:0,minCol:0})})));const j=w(e[0],"GDAL_METADATA"),K=x(j);A+=" "+V({width:i,height:s,tileWidth:n,tileHeight:a,planes:l,ifds:e});const X=N(e).length===F.length+1,J=F?.length?F.map((e=>({x:i/p(e,"IMAGEWIDTH"),y:s/p(e,"IMAGELENGTH")}))):void 0;return{width:i,height:s,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:y,noData:d,hasMaskBand:X,isSupported:S,pyramidResolutions:J,message:A,extent:C,isPseudoGeographic:v,affine:b?null:k,firstPyramidLevel:H,maximumPyramidLevel:Y,pyramidBlockWidth:B,pyramidBlockHeight:W,tileBoundary:_,metadata:K}}function D(e,t){const n=T(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function U(e){return e.filter((e=>1===p(e,"NEWSUBFILETYPE")))}function N(e){return e.filter((e=>{const t=!(4&~(p(e,"NEWSUBFILETYPE")??0)),n=4===p(e,"PHOTOMETRICINTERPRETATION");return t&&n}))}function k(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=F(e);let i=a;const s=[];do{const a=B(e,t,i,0,r.tiffTags,n?8:4);if(!a.success)break;s.push(a.ifd),i=a.nextIFD}while(i>0);return{...R(s),littleEndian:t,isBigTiff:n,ifds:s,pyramidIFDs:U(s),maskIFDs:N(s)}}function C(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*u+a:a*u+i}function G(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const s=(n?a:i)>=0?1:-1;n?a*=s:i*=s;return s*(n?i*u+a:a*u+i)}function v(e,t,n,a){return a?C(e,t,n):e.getUint32(t,n)}function F(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let s=4;const r=43===i;if(r){const e=t.getUint16(s,a);if(s+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(s,a))throw new Error("unsupported bigtiff version");s+=2}return{littleEndian:a,isBigTiff:r,firstIFDPos:v(t,s,a,r)}}function B(t,n,a,i=0,s=r.tiffTags,l=4){const o=d(t,n,a,i,s,l);let f;const u=o.ifd;if(u){if(r.ifdTags.forEach(((e,a)=>{u.has(a)&&(f=u.get(a),f.data=d(t,n,f.valueOffset-i,i,e).ifd)})),u.has("GEOKEYDIRECTORY")){f=u.get("GEOKEYDIRECTORY");const e=f.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];f.data=d(t,n,f.valueOffset+6-i,i,r.geoKeys,2).ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(u.has("XMP")){f=u.get("XMP");const t=f.values;"number"==typeof t[0]&&7===f.type&&(f.values=[e(new Uint8Array(t))])}}return o}function V(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,s=e.planes,r=i?i*a:t*n,l=p(e.ifds[0],"BITSPERSAMPLE");let o="";return r*s>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}function W(e,t,n,a,i){const s=a?4:1,r=n*s*i;a&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*r;for(let n=i;n<r;n++)e[t+n]+=e[t+n-i]}if(!a)return e;const l=new Uint8Array(e.length),o=n*i;for(let f=0;f<t;f++){const t=f*r;for(let n=0;n<o;n++)for(let a=0;a<s;a++)l[t+n*s+a]=e[t+n+(s-a-1)*o]}return new Float32Array(l.buffer)}async function H(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:r}=t,l=[];for(let s=0;s<i.length;s++){r[s];const t=await M(e,n.littleEndian,a,i[s],r[s]||e.byteLength);l.push(t)}const o=D(a,n),f=p(a,"BITSPERSAMPLE"),u=h(p(a,"SAMPLEFORMAT")??1,f),c=p(a,"SAMPLESPERPIXEL")||n.planes,E=g(u),T=p(a,"TILEWIDTH"),I=p(a,"TILELENGTH"),w=p(a,"COMPRESSION")??1,d=T*I;let m;const y=[];let S=l[0];const A=34887===w;for(let s=0;s<c;s++){if(m=new E(d),l.length===c)S=l[s],S.length===d&&(m=S);else if(S.length)if(o||A)m=S.length===d?S:S.slice(d*s,d*(s+1));else for(let e=0;e<d;e++)m[e]=S[e*c+s];y.push(m)}const P=n.noData?n.noData[0]:t.noDataValue,O=n.metadata?n.metadata.statistics:null,x=O?O.map((e=>e.min)):null,L=O?O.map((e=>e.max)):null,R={pixelType:u,width:T,height:I,pixels:y,noDataValue:P};return null!=P?s(R,P):x&&L&&t.applyMinMaxConstraint&&(R.mask=b(y,x,L)),R}async function Y(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||k(e),{ifds:i,noData:r}=a;if(0===i.length)throw new Error("no valid image file directory");const l=V(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=r??t.noDataValue;return o=a.tileWidth?await P(e,a,f):O(e,a,f),o?(null!=u&&s(o,u),o):o}export{Y as decode,H as decodeTileOrStrip,R as getImageInfo,N as getMaskIFDs,U as getPyramidIFDs,D as isBSQConfig,L as parseFieldValues,k as parseHeader,B as parseIFD,F as parseSignature};
5
+ import"../../../core/has.js";import{bytesToUTF8 as e}from"../rasterDatasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as s}from"./pixelRangeUtils.js";import r from"./TiffTags.js";import{isPlatformLittleEndian as l}from"./utils.js";import{Z as o}from"../../../chunks/Zlib.js";const f=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],u=4294967296,c=new Set([1,5,6,7,8,34712,34887]);function h(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function g(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function E(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function T(e,t){return e.get(t)?.values}function I(e,t){return e.get(t)?.values}function w(e,t){return e.get(t)?.values?.[0]}function p(e,t){return e.get(t)?.values?.[0]}function d(e,t,n,a=0,i=r.tiffTags,s=4){const l=8===s,o=l?C(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),f=4+2*s,u=l?8:2,c=u+o*f;if(n+c>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:c};const h=n+c+4<=e.byteLength?v(new DataView(e,n+c,8===s?8:4),0,t,8===s):null,g=n+u,E=new Map;let T,I,w,p,d,m=0,y=0;for(let A=0;A<o;A++){I=new DataView(e,g+f*A,f),w=I.getUint16(0,t),d=I.getUint16(2,t),p=r.getTagName(w,i);const n=[];2===s?(m=I.getUint16(4,t),y=I.getUint16(6,t)):4===s?(m=I.getUint32(4,t),y=I.getUint32(8,t)):8===s&&(m=v(I,4,t,!0),y=v(I,12,t,!0),n.push(I.getUint32(12,t)),n.push(I.getUint32(16,t))),T={id:w,type:d,valueCount:m,valueOffset:y,valueOffsets:n,values:null},L(e,t,T,a,!1,s),E.set(p,T)}return{success:!0,ifd:E,nextIFD:h,requiredBufferSize:c}}const m=(e,t)=>a(e,{inputOffset:t}).pixels[0];function y(e,t){if(1!==t&&2!==t&&4!==t)return e;const n=new Uint8Array(e),a=8/t,i=new Uint8Array(e.byteLength*a);let s=0;const r=2**t-1;for(let l=0;l<n.length;l++){const e=n[l];for(let n=0;n<a;n++)i[s++]=e<<t*n>>>8-t&r}return i.buffer}function A(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const s=i.getData(i.width,i.height,1!==n&&4!==n);return new Uint8Array(s.buffer)}function S(e){const t=new o(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}async function M(e,t,a,s,r){const o=l===t,f=p(a,"BITSPERSAMPLE"),u=p(a,"SAMPLESPERPIXEL")??1,c=p(a,"PHOTOMETRICINTERPRETATION"),E=p(a,"SAMPLEFORMAT")??1,T=h(E,f),I=p(a,"COMPRESSION")??1,w=g(T);let d,M,P;if(34887===I)return await n(),m(e,s);if(1===I)d=e.slice(s,s+r),M=new Uint8Array(d);else if(8===I||32946===I)M=new Uint8Array(e,s,r),M=S(M),d=M.buffer;else if(6===I)M=new Uint8Array(e,s,r),M=A(M,u,c),d=M.buffer;else if(7===I){const t=a.get("JPEGTABLES").values,n=t.length-2;M=new Uint8Array(n+r-2);for(let e=0;e<n;e++)M[e]=t[e];const i=new Uint8Array(e,s+2,r-2);for(let e=0;e<i.length;e++)M[n+e]=i[e];M=A(M,u,c),d=M.buffer}else{if(5!==I)throw new Error("tiff-decode: unsupport compression "+I);M=i(e,s,r,t),d=M.buffer}if(d=y(d,f),"u8"===T||"s8"===T||o)P=new w(d);else{d=new ArrayBuffer(M.length);const e=new Uint8Array(d);switch(T){case"u16":case"s16":for(let t=0;t<M.length;t+=2)e[t]=M[t+1],e[t+1]=M[t];break;case"u32":case"s32":case"f32":for(let t=0;t<M.length;t+=4)e[t]=M[t+3],e[t+1]=M[t+2],e[t+2]=M[t+1],e[t+3]=M[t]}P=new w(d)}const O=p(a,"PREDICTOR")??1,b=p(a,"TILEWIDTH"),x=p(a,"TILELENGTH");if(O>1&&(5===I||8===I||32946===I)&&b&&x){const e=R(a),t=new w(P.length);t.set(P),P=W(t,x,b,3===E&&3===O,e?1:u)}return P}async function P(e,t,n){const a=I(n,"TILEOFFSETS");if(void 0===a)return null;const i=I(n,"TILEBYTECOUNTS"),{width:s,height:r,pixelType:l,tileWidth:o,tileHeight:f}=D([n]),u=R(n,t),c=p(n,"SAMPLESPERPIXEL")||t.planes,h=s*r,E=p(n,"BITSPERSAMPLE"),T=34887===(p(n,"COMPRESSION")??1),w=g(l),d=[];for(let g=0;g<c;g++)d.push(new w(h));let m,y,A,S,P,O,b,x,L,N,U,k,C;const G=Math.ceil(s/o),v=new Uint8Array(h).fill(255);let F=!1;if(E%8==0)if(T&&u&&c>1){const l=Math.round(a.length/c);for(m=0;m<l;m++){O=Math.floor(m/G)*f,b=m%G*o,x=O*s+b;for(let l=0;l<c;l++){const u=m*c+l;for(0===i[u]?(A=null,F=!0):A=await M(e,t.littleEndian,n,a[u],i[u]),N=0,L=x,k=Math.min(o,s-b),U=Math.min(f,r-O),C=d[l],S=0;S<U;S++)for(L=x+S*s,N=S*o,P=0;P<k;P++,L++,N++)A?C[L]=A[N]:v[L]=0}}}else for(m=0;m<a.length;m++)for(O=Math.floor(m/G)*f,b=m%G*o,x=O*s+b,0===i[m]?(A=null,F=!0):A=await M(e,t.littleEndian,n,a[m],i[m]),N=0,L=x,k=Math.min(o,s-b),U=Math.min(f,r-O),y=0;y<c;y++)if(C=d[y],u||T)for(S=0;S<U;S++)for(L=x+S*s,N=o*f*y+S*o,P=0;P<k;P++,L++,N++)A?C[L]=A[N]:v[L]=0;else for(S=0;S<U;S++)for(L=x+S*s,N=S*o*c+y,P=0;P<k;P++,L++,N+=c)A?C[L]=A[N]:v[L]=0;return{width:s,height:r,pixelType:l,pixels:d,mask:F?v:void 0}}const O=(e,t,n)=>{const a=l===t.littleEndian,s=I(n,"STRIPOFFSETS");if(void 0===s)return null;const{width:r,height:o,pixelType:f}=D([n]),u=p(n,"SAMPLESPERPIXEL")||t.planes,c=p(n,"PHOTOMETRICINTERPRETATION"),h=r*o,E=p(n,"BITSPERSAMPLE"),T=g(f),w=new T(h*u),d=I(n,"STRIPBYTECOUNTS"),m=p(n,"ROWSPERSTRIP"),M=p(n,"COMPRESSION")??1;let P,O,b,x,L,R,N,U,k;if(E%8==0)for(P=0;P<s.length;P++){if(L=P*(m*r)*u,"u8"===f||"s8"===f||a)8===M||32946===M?(N=new Uint8Array(e,s[P],d[P]),N=S(N),R=N.buffer):6===M?(N=new Uint8Array(e,s[P],d[P]),N=A(N,u,c),R=N.buffer):5===M?(N=i(e,s[P],d[P],t.littleEndian),R=N.buffer):R=e.slice(s[P],s[P]+d[P]),R=y(R,E),x=new T(R);else{switch(6===M||8===M||32946===M?(N=new Uint8Array(e,s[P],d[P]),U=S(N),R=U.buffer):(R=new ArrayBuffer(d[P]),N=new Uint8Array(e,s[P],d[P]),U=new Uint8Array(R)),f){case"u16":case"s16":for(b=0;b<N.length;b+=2)U[b]=N[b+1],U[b+1]=N[b];break;case"u32":case"s32":case"f32":for(b=0;b<N.length;b+=4)U[b]=N[b+3],U[b+1]=N[b+2],U[b+2]=N[b+1],U[b+3]=N[b]}R=y(R,E),x=new T(R)}w.set(x,L)}const C=[];if(1===u)C.push(w);else for(P=0;P<u;P++){for(k=new T(h),O=0;O<h;O++)k[O]=w[O*u+P];C.push(k)}return{width:r,height:o,pixelType:f,pixels:C}},b=(e,t,n)=>{if(!(e.length>0&&t&&n))return null;let a,i,s;const r=e[0].length,l=e.length,o=new Uint8Array(r);for(let f=0;f<l;f++)if(a=e[f],i=t[f],s=n[f],0===f)for(let e=0;e<r;e++)o[e]=a[e]<i||a[e]>s?0:1;else for(let e=0;e<r;e++)o[e]&&(o[e]=a[e]<i||a[e]>s?0:1);return o},x=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,s,r,l;for(let w=0;w<t.length;w++)a=t[w],i=a.slice(6,a.indexOf(">")),r=a.indexOf("sample="),r>-1&&(l=a.slice(r+8,a.indexOf('"',r+8))),r=a.indexOf("name="),r>-1&&(i=a.slice(r+6,a.indexOf('"',r+6))),i&&(s=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=s:n.set(i,[s]):n.set(i,s)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),T=n.get("WavelengthMax");let I=null;if(g){I=[];for(let e=0;e<g.length;e++)I.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:T&&parseFloat(T[e])})}return{statistics:h,bandProperties:I,dataType:n.get("DataType"),rawMetadata:n}};function L(e,t,n,a=0,i=!1,s=4){if(n.values)return!0;const r=n.type,l=n.valueCount;let o=n.valueOffset,c=[];const h=f[r],g=8*h,E=l*h,T=l*f[r]*8;let I,w;const p=8===s?64:32,d=n.valueOffsets;if(T>p){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(T<=p){if(!t)if(p<=32)o>>>=32-T;else{const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);T<=32?(o=e>>>32-T,d[0]=o):(o=e*2**(32-T)+(t>>>32-T),d[0]=e,d[1]=t>>>32-T)}if(1===l&&g===p)c=[o];else if(64===p){const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/u);let n=e,a=32;for(w=1;w<=l;w++){const e=32-g*w%32;if(a<g){const i=n<<e>>>32-a,s=t<<32-a>>>32-a;n=t,c.push(i+s*2**(g-a)),a-=32-(g-a)}else c.push(n<<e>>>32-g),a-=g;0===a&&(a=32,n=t)}}else for(w=1;w<=l;w++){const e=32-g*w;c.push(o<<e>>>32-g)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=h){switch(r){case 1:case 2:case 7:I=new DataView(e,n,1).getUint8(0);break;case 3:I=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:I=new DataView(e,n,4).getUint32(0,t);break;case 5:I=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:I=new DataView(e,n,1).getInt8(0);break;case 8:I=new DataView(e,n,2).getInt16(0,t);break;case 9:I=new DataView(e,n,4).getInt32(0,t);break;case 10:I=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:I=new DataView(e,n,4).getFloat32(0,t);break;case 12:I=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:I=C(new DataView(e,n,8),0,t);break;case 17:I=G(new DataView(e,n,8),0,t);break;default:I=null}c.push(I)}}if(2===r){let e="";const t=c;for(c=[],w=0;w<t.length;w++)0===t[w]&&""!==e?(c.push(e),e=""):e+=String.fromCharCode(t[w]);""===e&&0!==c.length||c.push(e)}return n.values=c,!0}function D(e){const t=e[0],n=p(t,"TILEWIDTH"),a=p(t,"TILELENGTH"),i=p(t,"IMAGEWIDTH"),s=p(t,"IMAGELENGTH"),r=p(t,"BITSPERSAMPLE"),l=p(t,"SAMPLESPERPIXEL"),o=p(t,"SAMPLEFORMAT")??1,f=h(o,r),u=R(t),g=T(t,"GDAL_NODATA");let d=null;g?.length&&(d=g.map((e=>parseFloat(e))),d.some((e=>isNaN(e)))&&(d=null));const m=p(t,"COMPRESSION")??1;let y;switch(m){case 1:y="NONE";break;case 2:case 3:case 4:case 32771:y="CCITT";break;case 5:y="LZW";break;case 6:case 7:y="JPEG";break;case 32773:y="PACKBITS";break;case 8:case 32946:y="DEFLATE";break;case 34712:y="JPEG2000";break;case 34887:y="LERC";break;default:y=String(m)}let A=!0,S="";c.has(m)||(A=!1,S+="unsupported tag compression "+m),o>3&&(A=!1,S+="unsupported tag sampleFormat "+o),1!==r&&2!==r&&4!==r&&r%8!=0&&(A=!1,S+="unsupported tag bitsPerSample "+r);const M=w(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find((e=>e.includes("ESRI PE String = "))),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=I(t,"GEOTIEPOINTS"),b=I(t,"GEOPIXELSCALE"),L=I(t,"GEOTRANSMATRIX"),D=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let k,C,G=!1,v=!1;if(D){G=2===p(D,"GTRasterTypeGeoKey");const e=p(D,"GTModelTypeGeoKey");if(2===e){const e=p(D,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(v=!0,P={wkid:4326})}else if(1===e){const e=p(D,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(k=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],G&&(k[2]-=.5*k[0]+.5*k[1],k[5]-=.5*k[3]+.5*k[4])):L&&16===L.length&&(k=G?[L[0],L[1],L[3]-.5*L[0],L[4],L[5],L[7]-.5*L[5]]:[L[0],L[1],L[3],L[4],L[5],L[7]]),k){const e=[{x:0,y:s},{x:0,y:0},{x:i,y:s},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=E(e[i],k),n=t.x>n?n:t.x,r=t.x<r?r:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;C={xmin:n,xmax:r,ymin:a,ymax:l,spatialReference:P}}else C={xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:P};v&&(C.xmax-C.xmin>400||Math.max(Math.abs(C.xmin),Math.abs(C.xmax))>361)&&(P=null,C.spatialReference=null);const F=N(e);let B,W,H,Y,_;if(F.length>0){H=Math.round(Math.log(i/p(F[0],"IMAGEWIDTH"))/Math.LN2);const e=F[F.length-1];Y=F.length,B=p(e,"TILEWIDTH"),W=p(e,"TILELENGTH")}B=null!=Y&&Y>0?B||n:null,W=null!=Y&&Y>0?W||a:null,n&&(_=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(s/a)-1,minRow:0,minCol:0}],F.forEach((e=>{_.push({maxCol:Math.ceil(p(e,"IMAGEWIDTH")/p(e,"TILEWIDTH"))-1,maxRow:Math.ceil(p(e,"IMAGELENGTH")/p(e,"TILELENGTH"))-1,minRow:0,minCol:0})})));const j=w(e[0],"GDAL_METADATA"),K=x(j);S+=" "+V({width:i,height:s,tileWidth:n,tileHeight:a,planes:l,ifds:e});const X=U(e).length===F.length+1,J=F?.length?F.map((e=>({x:i/p(e,"IMAGEWIDTH"),y:s/p(e,"IMAGELENGTH")}))):void 0;return{width:i,height:s,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:y,noData:d,hasMaskBand:X,isSupported:A,pyramidResolutions:J,message:S,extent:C,isPseudoGeographic:v,affine:b?null:k,firstPyramidLevel:H,maximumPyramidLevel:Y,pyramidBlockWidth:B,pyramidBlockHeight:W,tileBoundary:_,metadata:K}}function R(e,t){const n=T(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function N(e){return e.filter((e=>1===p(e,"NEWSUBFILETYPE")))}function U(e){return e.filter((e=>{const t=!(4&~(p(e,"NEWSUBFILETYPE")??0)),n=4===p(e,"PHOTOMETRICINTERPRETATION");return t&&n}))}function k(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=F(e);let i=a;const s=[];do{const a=B(e,t,i,0,r.tiffTags,n?8:4);if(!a.success)break;s.push(a.ifd),i=a.nextIFD}while(i>0);return{...D(s),littleEndian:t,isBigTiff:n,ifds:s,pyramidIFDs:N(s),maskIFDs:U(s)}}function C(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*u+a:a*u+i}function G(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const s=(n?a:i)>=0?1:-1;n?a*=s:i*=s;return s*(n?i*u+a:a*u+i)}function v(e,t,n,a){return a?C(e,t,n):e.getUint32(t,n)}function F(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let s=4;const r=43===i;if(r){const e=t.getUint16(s,a);if(s+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(s,a))throw new Error("unsupported bigtiff version");s+=2}return{littleEndian:a,isBigTiff:r,firstIFDPos:v(t,s,a,r)}}function B(t,n,a,i=0,s=r.tiffTags,l=4){const o=d(t,n,a,i,s,l);let f;const u=o.ifd;if(u){if(r.ifdTags.forEach(((e,a)=>{u.has(a)&&(f=u.get(a),f.data=d(t,n,f.valueOffset-i,i,e).ifd)})),u.has("GEOKEYDIRECTORY")){f=u.get("GEOKEYDIRECTORY");const e=f.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];f.data=d(t,n,f.valueOffset+6-i,i,r.geoKeys,2).ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(u.has("XMP")){f=u.get("XMP");const t=f.values;"number"==typeof t[0]&&7===f.type&&(f.values=[e(new Uint8Array(t))])}}return o}function V(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,s=e.planes,r=i?i*a:t*n,l=p(e.ifds[0],"BITSPERSAMPLE");let o="";return r*s>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}function W(e,t,n,a,i){const s=a?4:1,r=n*s*i;a&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*r;for(let n=i;n<r;n++)e[t+n]+=e[t+n-i]}if(!a)return e;const l=new Uint8Array(e.length),o=n*i;for(let f=0;f<t;f++){const t=f*r;for(let n=0;n<o;n++)for(let a=0;a<s;a++)l[t+n*s+a]=e[t+n+(s-a-1)*o]}return new Float32Array(l.buffer)}async function H(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:r}=t,l=[];for(let s=0;s<i.length;s++){r[s];const t=await M(e,n.littleEndian,a,i[s],r[s]||e.byteLength);l.push(t)}const o=R(a,n),f=p(a,"BITSPERSAMPLE"),u=h(p(a,"SAMPLEFORMAT")??1,f),c=p(a,"SAMPLESPERPIXEL")||n.planes,E=g(u),T=p(a,"TILEWIDTH"),I=p(a,"TILELENGTH"),w=p(a,"COMPRESSION")??1,d=T*I;let m;const y=[];let A=l[0];const S=34887===w;for(let s=0;s<c;s++){if(m=new E(d),l.length===c)A=l[s],A.length===d&&(m=A);else if(A.length)if(o||S)m=A.length===d?A:A.slice(d*s,d*(s+1));else for(let e=0;e<d;e++)m[e]=A[e*c+s];y.push(m)}const P=n.noData?n.noData[0]:t.noDataValue,O=n.metadata?n.metadata.statistics:null,x=O?O.map((e=>e.min)):null,L=O?O.map((e=>e.max)):null,D={pixelType:u,width:T,height:I,pixels:y,noDataValue:P};return null!=P?s(D,P,{matchAllNoData:t?.matchAllNoData}):x&&L&&t.applyMinMaxConstraint&&(D.mask=b(y,x,L)),D}async function Y(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||k(e),{ifds:i,noData:r}=a;if(0===i.length)throw new Error("no valid image file directory");const l=V(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=r??t.noDataValue;if(o=a.tileWidth?await P(e,a,f):O(e,a,f),!o)return o;if(null!=u){s(o,u,{matchAllNoData:null==r&&t?.matchAllNoData})}return o}export{Y as decode,H as decodeTileOrStrip,D as getImageInfo,U as getMaskIFDs,N as getPyramidIFDs,R as isBSQConfig,L as parseFieldValues,k as parseHeader,B as parseIFD,F as parseSignature};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- const t=9999999e31,n=2e-7,e={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34028234663852886e22,34028234663852886e22],f64:[-Number.MAX_VALUE,Number.MAX_VALUE],unknown:void 0,c64:void 0,c128:void 0};function s(t){return e[t]??[-34028234663852886e22,34028234663852886e22]}function u(t,n){return null==t||null==n?"s32":t<0?t>=-128&&n<128?"s8":t>=-32768&&n<32768?"s16":"s32":n<256?"u8":n<65536?"u16":"u32"}function o(t){return(t?.startsWith("s")||t?.startsWith("u"))??!1}function i(t,n,e,u){let[i,l]=s(e);const a=o(e);return a&&(i-=1e-5,l+=1e-5),a?e.startsWith("u")?c(t,n,u,[i,l]):f(t,n,u,[i,l]):r(t,n,u,[i,l])}function l(t,n){for(let e=0;e<n.length;e++)n[e]&&isNaN(t[e])&&(n[e]=0,t[e]=0)}function c(t,n,e,s){const[u,o]=s;for(let i=0;i<n.length;i++)if(n[i]){const s=t[i];s<u||s>o?n[i]=0:e[i]=s+.5|0}}function f(t,n,e,s){const[u,o]=s;for(let i=0;i<n.length;i++)if(n[i]){const s=t[i];s<u||s>o?n[i]=0:e[i]=s+(s>0?.5:-.5)|0}}function r(t,n,e,s){const[u,o]=s;for(let i=0;i<n.length;i++)if(n[i]){const s=t[i];s<u||s>o?n[i]=0:e[i]=s}}function a(e,u,o){if(e.depthCount&&e.depthCount>1)return;const{pixels:i,statistics:l,pixelType:c}=e,f=i[0].length,r=e.bandMasks??[],a=e.mask??new Uint8Array(f).fill(255),h="f32"===c||"f64"===c,b=s(c);let m=!1;for(let s=0;s<i.length;s++){const e="number"==typeof u?u:u[s];if(null==e)continue;const f=l?.[s]?.minValue??b[0],d=l?.[s]?.maxValue??b[1];if(f>e+Number.EPSILON||d<e-Number.EPSILON)continue;const p=r[s]||a.slice(),N=i[s],g=o?.customFloatTolerance;if(h&&0!==g){let s=g;s||(s=Math.abs(e)>=t?n*Math.abs(e):"f32"===c?2**-23:Number.EPSILON);for(let t=0;t<N.length;t++)p[t]&&Math.abs(N[t]-e)<s&&(N[t]=0,p[t]=0,a[t]=0,m=!0)}else for(let t=0;t<N.length;t++)p[t]&&N[t]===e&&(N[t]=0,p[t]=0,a[t]=0,m=!0);r[s]=p}m&&(e.bandMasks=e.bandMasks||e.pixels.length>1?r:null,e.mask=a),m&&"updateStatistics"in e&&e.updateStatistics()}export{i as clipBandToPixelTypeRange,a as convertNoDataToMask,l as fixNaN,u as getIntegerPixelType,s as getPixelValueRange,o as isIntegerPixelType};
5
+ const t=9999999e31,n=2e-7,e={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34028234663852886e22,34028234663852886e22],f64:[-Number.MAX_VALUE,Number.MAX_VALUE],unknown:void 0,c64:void 0,c128:void 0};function s(t){return e[t]??[-34028234663852886e22,34028234663852886e22]}function l(t,n){return null==t||null==n?"s32":t<0?t>=-128&&n<128?"s8":t>=-32768&&n<32768?"s16":"s32":n<256?"u8":n<65536?"u16":"u32"}function o(t){return(t?.startsWith("s")||t?.startsWith("u"))??!1}function u(t,n,e,l){let[u,i]=s(e);const a=o(e);return a&&(u-=1e-5,i+=1e-5),a?e.startsWith("u")?r(t,n,l,[u,i]):c(t,n,l,[u,i]):f(t,n,l,[u,i])}function i(t,n){for(let e=0;e<n.length;e++)n[e]&&isNaN(t[e])&&(n[e]=0,t[e]=0)}function r(t,n,e,s){const[l,o]=s;for(let u=0;u<n.length;u++)if(n[u]){const s=t[u];s<l||s>o?n[u]=0:e[u]=s+.5|0}}function c(t,n,e,s){const[l,o]=s;for(let u=0;u<n.length;u++)if(n[u]){const s=t[u];s<l||s>o?n[u]=0:e[u]=s+(s>0?.5:-.5)|0}}function f(t,n,e,s){const[l,o]=s;for(let u=0;u<n.length;u++)if(n[u]){const s=t[u];s<l||s>o?n[u]=0:e[u]=s}}function a(e,l,o){if(e.depthCount&&e.depthCount>1)return;const{pixels:u,statistics:i,pixelType:r}=e,c=u[0].length,f=e.bandMasks??[],a=e.mask??new Uint8Array(c).fill(255),h="f32"===r||"f64"===r,g=s(r);let m=!1;for(let s=0;s<u.length;s++){const e="number"==typeof l?l:l[s];if(null==e)continue;const c=i?.[s]?.minValue??g[0],b=i?.[s]?.maxValue??g[1];if(c>e+Number.EPSILON||b<e-Number.EPSILON)continue;const N=f[s]||a.slice(),d=u[s],p=o?.customFloatTolerance;if(h&&0!==p){let s=p;s||(s=Math.abs(e)>=t?n*Math.abs(e):"f32"===r?2**-23:Number.EPSILON);for(let t=0;t<d.length;t++)N[t]&&Math.abs(d[t]-e)<s&&(d[t]=0,N[t]=0,a[t]=0,m=!0)}else for(let t=0;t<d.length;t++)N[t]&&d[t]===e&&(d[t]=0,N[t]=0,a[t]=0,m=!0);f[s]=N}if(m){const t=e.bandMasks||e.pixels.length>1?f:null;o?.matchAllNoData?e.mask=t&&t.length>1?b(t):a:(e.bandMasks=t,e.mask=a)}function b(t){if(t.length<2)return t[0];const n=t[0].length,e=new Uint8Array(n).fill(0);for(let s=0;s<t.length;s++){const l=t[s];for(let t=0;t<n;t++)l[t]&&(e[t]=255)}return e}m&&"updateStatistics"in e&&e.updateStatistics()}export{u as clipBandToPixelTypeRange,a as convertNoDataToMask,i as fixNaN,l as getIntegerPixelType,s as getPixelValueRange,o as isIntegerPixelType};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../request.js";import o from"../core/Error.js";import s from"../core/Loadable.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{isAbortError as n}from"../core/promiseUtils.js";import{urlToObject as l}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import p from"../geometry/Extent.js";import c from"../geometry/SpatialReference.js";import{fromJSON as m}from"../geometry/support/jsonUtils.js";import{versionMatches as y,onApplyEditsEvent as h,onUpdateMomentEvent as f,emitApplyEditsEvent as g}from"../layers/mixins/EditBusLayer.js";import{parse as v}from"../layers/support/arcgisLayerUrl.js";import w from"./support/TopologyValidationJobInfo.js";import{networkFromPortalItem as S}from"./support/utils.js";import{isVersionInEditSession as j,currentSessionId as b,isSafeToEditVersion as I}from"../versionManagement/support/versionManagementUtils.js";let U=class extends(a(s)){static fromPortalItem(e){return S(e)}constructor(e){super(e),this.id=null,this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null,this.gdbVersion=null,this.historicMoment=null,this._sourceIdByLayerId=new Map,this._layerIdBySourceId=new Map,this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:o}=e,s=t===this.featureServiceUrl,i=y(t,r,this.gdbVersion);s&&i&&o.then((e=>{j(t,r)&&(this.historicMoment=e.historicMoment)}))},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:r,moment:o}=e,s=t===this.featureServiceUrl,i=y(t,r,this.gdbVersion);s&&i&&(this.historicMoment=o)},this.when().then((()=>{this.addHandles([h(this._applyEditsHandler),f(this._updateMomentHandler)])}),(()=>{}))}initialize(){this.when().catch((e=>{n(e)||i.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){return l(this.layerUrl)}get featureServiceUrl(){return v(this.parsedUrl.path).url.path}get networkServiceUrl(){return this.featureServiceUrl.replace(/\/FeatureServer/i,"/UtilityNetworkServer")}get layerId(){return v(this.parsedUrl.path).sublayer}get networkSystemLayers(){return null}async load(e){return this.addResolvingPromise(this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e)),this.addResolvingPromise(this._fetchLayerMetaData(this.layerUrl,e)),this}getLayerIdBySourceId(e){if(!this.dataElement)return null;const t=this._layerIdBySourceId.get(e);if(null!=t)return t;const r=this.dataElement.domainNetworks,o=this._traverseNetworkSources(r,this._layerIdBySourceId,"sourceId","layerId",e);return o>=0?o:null}getSourceIdByLayerId(e){if(!this.dataElement)return null;const t=this._sourceIdByLayerId.get(e);if(null!=t)return t;const r=this.dataElement.domainNetworks,o=this._traverseNetworkSources(r,this._sourceIdByLayerId,"layerId","sourceId",e);return o>=0?o:null}getObjectIdsFromElements(e){const t=[],r=new Map;for(const s of e){const e=this.getLayerIdBySourceId(s.networkSourceId);if(null==e)continue;let t=r.get(e);void 0===t&&(t=[]),t.push(s.objectId),r.set(e,t)}const o=this.featureServiceUrl;return r.forEach(((e,r)=>t.push({layerUrl:`${o}/${r}`,objectIds:e}))),t}async queryNamedTraceConfigurations(e,t){const[{queryNamedTraceConfigurations:r},{default:o}]=await Promise.all([import("../rest/networks/queryNamedTraceConfigurations.js"),import("../rest/networks/support/QueryNamedTraceConfigurationsParameters.js")]),s=this.networkServiceUrl,i=o.from(e);return(await r(s,i,{...t}))?.namedTraceConfigurations}async validateTopology(e,t){if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");const[{validateNetworkTopology:r},{default:s}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),i=s.from(e);j(this.featureServiceUrl,this.gdbVersion||null)?(i.sessionID=b,await I(this.featureServiceUrl,this.gdbVersion,!0)):i.sessionID=null,i.gdbVersion=this.gdbVersion;const a=this.networkServiceUrl,n=this.featureServiceUrl,l=g(n,null,this.gdbVersion,!0),d=await r(a,i,{...t});if(d?.serviceEdits){const e=[];for(const t of d.serviceEdits){const{editedFeatures:r}=t,o=r?.spatialReference?new c(r.spatialReference):null;e.push({layerId:t.layerId,editedFeatures:{adds:r?.adds?.map((e=>k(e,o)))||[],updates:r?.updates?.map((e=>({original:k(e[0],o),current:k(e[1],o)})))||[],deletes:r?.deletes?.map((e=>k(e,o)))||[],spatialReference:o}})}l.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],editedFeatures:e,exceededTransferLimit:!1,historicMoment:d.moment})}return d}async submitTopologyValidationJob(e,t){let s=null;if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");if(!this.gdbVersion){const e=this.layerUrl.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,"");s=(await r(e,{responseType:"json",query:{f:"json"}})).data.defaultVersionName}const[{submitValidateNetworkTopologyJob:i},{default:a}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),n=a.from(e);j(this.featureServiceUrl,this.gdbVersion||null)?(n.sessionID=b,await I(this.featureServiceUrl,this.gdbVersion,!0)):n.sessionID=null,n.gdbVersion=this.gdbVersion||s;const l=this.networkServiceUrl,d=this.featureServiceUrl?g(this.featureServiceUrl,null,this.gdbVersion,!0):void 0,u=await i(l,n,{...t});return new w({statusUrl:u,editsResolver:d})}_traverseNetworkSources(e,t,r,o,s){for(const i of e)for(const e of[i.edgeSources??[],i.junctionSources??[]])for(const i of e)if(i[r]===s)return t.set(s,i[o]),i[o];return-1}async _fetchLayerMetaData(e,t){const o=await r(e,{responseType:"json",query:{f:"json"},...t});this.sourceJSON=o.data,this.read(o.data,{origin:"service"})}async _fetchDataElement(e,t,o){if(this.dataElement)return;const s=await r(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([t]),f:"json"},...o}).then((e=>e.data.layerDataElements?.[0]));s&&this.read(s,{origin:"service"})}};function k(e,r){return new t({attributes:e.attributes,geometry:m({...e.geometry,spatialReference:r})})}e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:!0}},read:!1}})],U.prototype,"id",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:{source:"name"}}},read:!1}})],U.prototype,"title",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:"url"},write:{target:"url",isRequired:!0}}},read:!1}})],U.prototype,"layerUrl",void 0),e([d({type:Object,json:{origins:{service:{read:!0}},read:!1}})],U.prototype,"dataElement",void 0),e([d({type:p,json:{origins:{service:{read:{source:"extent"}}},read:!1}})],U.prototype,"fullExtent",void 0),e([d({type:c,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:!1}})],U.prototype,"spatialReference",void 0),e([d({type:["utility","trace"],readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"type",void 0),e([d({readOnly:!0})],U.prototype,"datasetName",null),e([d({readOnly:!0})],U.prototype,"owner",null),e([d({readOnly:!0})],U.prototype,"schemaGeneration",null),e([d({readOnly:!0})],U.prototype,"parsedUrl",null),e([d({readOnly:!0})],U.prototype,"featureServiceUrl",null),e([d({readOnly:!0})],U.prototype,"networkServiceUrl",null),e([d({readOnly:!0})],U.prototype,"layerId",null),e([d()],U.prototype,"sourceJSON",void 0),e([d({readOnly:!0})],U.prototype,"networkSystemLayers",null),e([d()],U.prototype,"gdbVersion",void 0),e([d({type:Date})],U.prototype,"historicMoment",void 0),U=e([u("esri.networks.Network")],U);const N=U;export{N as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../request.js";import o from"../core/Error.js";import s from"../core/Loadable.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{isAbortError as n}from"../core/promiseUtils.js";import{urlToObject as l}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import c from"../geometry/Extent.js";import p from"../geometry/SpatialReference.js";import{fromJSON as m}from"../geometry/support/jsonUtils.js";import{versionMatches as y,onApplyEditsEvent as h,onUpdateMomentEvent as f,emitApplyEditsEvent as g}from"../layers/mixins/EditBusLayer.js";import{parse as v}from"../layers/support/arcgisLayerUrl.js";import w from"./support/TopologyValidationJobInfo.js";import{networkFromPortalItem as S}from"./support/utils.js";import{isVersionInEditSession as j,currentSessionId as I,isSafeToEditVersion as b}from"../versionManagement/support/versionManagementUtils.js";let U=class extends(a(s)){static fromPortalItem(e){return S(e)}constructor(e){super(e),this.id=null,this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null,this.gdbVersion=null,this.historicMoment=null,this._sourceIdByLayerId=new Map,this._layerIdBySourceId=new Map,this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:o}=e,s=t===this.featureServiceUrl,i=y(t,r,this.gdbVersion);s&&i&&o.then((e=>{j(t,r)&&(this.historicMoment=e.historicMoment)}))},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:r,moment:o}=e,s=t===this.featureServiceUrl,i=y(t,r,this.gdbVersion);s&&i&&(this.historicMoment=o)},this.when().then((()=>{this.addHandles([h(this._applyEditsHandler),f(this._updateMomentHandler)])}),(()=>{}))}initialize(){this.when().catch((e=>{n(e)||i.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){return l(this.layerUrl)}get featureServiceUrl(){return v(this.parsedUrl.path).url.path}get networkServiceUrl(){return this.featureServiceUrl.replace(/\/FeatureServer/i,"/UtilityNetworkServer")}get layerId(){return v(this.parsedUrl.path).sublayer}get networkSystemLayers(){return null}async load(e){return this.addResolvingPromise(this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e)),this.addResolvingPromise(this._fetchLayerMetaData(this.layerUrl,e)),this}getLayerIdBySourceId(e){if(!this.dataElement)return null;const t=this._layerIdBySourceId.get(e);if(null!=t)return t;const r=this.dataElement.domainNetworks,o=this._traverseNetworkSources(r,this._layerIdBySourceId,"sourceId","layerId",e);return o>=0?o:null}getSourceIdByLayerId(e){if(!this.dataElement)return null;const t=this._sourceIdByLayerId.get(e);if(null!=t)return t;const r=this.dataElement.domainNetworks,o=this._traverseNetworkSources(r,this._sourceIdByLayerId,"layerId","sourceId",e);return o>=0?o:null}getObjectIdsFromElements(e){const t=[],r=new Map;for(const s of e){const e=this.getLayerIdBySourceId(s.networkSourceId);if(null==e)continue;let t=r.get(e);void 0===t&&(t=[]),t.push(s.objectId),r.set(e,t)}const o=this.featureServiceUrl;return r.forEach(((e,r)=>t.push({layerUrl:`${o}/${r}`,objectIds:e}))),t}async queryNamedTraceConfigurations(e,t){const[{queryNamedTraceConfigurations:r},{default:o}]=await Promise.all([import("../rest/networks/queryNamedTraceConfigurations.js"),import("../rest/networks/support/QueryNamedTraceConfigurationsParameters.js")]),s=this.networkServiceUrl,i=o.from(e);return(await r(s,i,{...t}))?.namedTraceConfigurations}async validateTopology(e,t){if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");const[{validateNetworkTopology:r},{default:s}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),i=s.from(e);j(this.featureServiceUrl,this.gdbVersion||null)?(i.sessionID=I,await b(this.featureServiceUrl,this.gdbVersion,!0)):i.sessionID=null,i.gdbVersion=this.gdbVersion;const a=this.networkServiceUrl,n=this.featureServiceUrl,l=g(n,null,this.gdbVersion,!0),d=await r(a,i,{...t});if(d?.serviceEdits){const e=[];for(const t of d.serviceEdits){const{editedFeatures:r}=t,o=r?.spatialReference?new p(r.spatialReference):null;e.push({layerId:t.layerId,editedFeatures:{adds:r?.adds?.map((e=>k(e,o)))||[],updates:r?.updates?.map((e=>({original:k(e[0],o),current:k(e[1],o)})))||[],deletes:r?.deletes?.map((e=>k(e,o)))||[],spatialReference:o}})}l.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],editedFeatures:e,exceededTransferLimit:!1,historicMoment:d.moment})}return d}async submitTopologyValidationJob(e,t){let s=null;if(!e.validateArea)throw new o("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");if(!this.gdbVersion){const e=this.layerUrl.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,"");s=(await r(e,{responseType:"json",query:{f:"json"}})).data.defaultVersionName}const[{submitValidateNetworkTopologyJob:i},{default:a}]=await Promise.all([import("../rest/networks/validateNetworkTopology.js"),import("../rest/networks/support/ValidateNetworkTopologyParameters.js")]),n=a.from(e);j(this.featureServiceUrl,this.gdbVersion||null)?(n.sessionID=I,await b(this.featureServiceUrl,this.gdbVersion,!0)):n.sessionID=null,n.gdbVersion=this.gdbVersion||s;const l=this.networkServiceUrl,d=this.featureServiceUrl?g(this.featureServiceUrl,null,this.gdbVersion,!0):void 0,u=await i(l,n,{...t});return new w({statusUrl:u,editsResolver:d})}getSourceTypeById(e){if(!this.dataElement)return null;for(const t of this.dataElement.domainNetworks)for(const r of[t.edgeSources??[],t.junctionSources??[]])for(const o of r)if(o.sourceId===e)return r===t.edgeSources?"edge":"junction";return null}_traverseNetworkSources(e,t,r,o,s){for(const i of e)for(const e of[i.edgeSources??[],i.junctionSources??[]])for(const i of e)if(i[r]===s)return t.set(s,i[o]),i[o];return-1}async _fetchLayerMetaData(e,t){const o=await r(e,{responseType:"json",query:{f:"json"},...t});this.sourceJSON=o.data,this.read(o.data,{origin:"service"})}async _fetchDataElement(e,t,o){if(this.dataElement)return;const s=await r(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([t]),f:"json"},...o}).then((e=>e.data.layerDataElements?.[0]));s&&this.read(s,{origin:"service"})}};function k(e,r){return new t({attributes:e.attributes,geometry:m({...e.geometry,spatialReference:r})})}e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:!0}},read:!1}})],U.prototype,"id",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:{source:"name"}}},read:!1}})],U.prototype,"title",void 0),e([d({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:"url"},write:{target:"url",isRequired:!0}}},read:!1}})],U.prototype,"layerUrl",void 0),e([d({type:Object,json:{origins:{service:{read:!0}},read:!1}})],U.prototype,"dataElement",void 0),e([d({type:c,json:{origins:{service:{read:{source:"extent"}}},read:!1}})],U.prototype,"fullExtent",void 0),e([d({type:p,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:!1}})],U.prototype,"spatialReference",void 0),e([d({type:["utility","trace"],readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"type",void 0),e([d({readOnly:!0})],U.prototype,"datasetName",null),e([d({readOnly:!0})],U.prototype,"owner",null),e([d({readOnly:!0})],U.prototype,"schemaGeneration",null),e([d({readOnly:!0})],U.prototype,"parsedUrl",null),e([d({readOnly:!0})],U.prototype,"featureServiceUrl",null),e([d({readOnly:!0})],U.prototype,"networkServiceUrl",null),e([d({readOnly:!0})],U.prototype,"layerId",null),e([d()],U.prototype,"sourceJSON",void 0),e([d({readOnly:!0})],U.prototype,"networkSystemLayers",null),e([d()],U.prototype,"gdbVersion",void 0),e([d({type:Date})],U.prototype,"historicMoment",void 0),U=e([u("esri.networks.Network")],U);const N=U;export{N 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import o from"../core/JSONSupport.js";import t from"../core/Loadable.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{isFeatureLayer as a,isSubtypeSublayer as n}from"../layers/support/layerUtils.js";import{RuleType as i}from"./support/typeUtils.js";import c from"../rest/support/Query.js";let d=class extends(o.JSONSupportMixin(t)){constructor(e){super(e),this.rulesCategorized={attachment:[],containment:[],connectivity:[]},this.request=r}initialize(){}async load(e){const r=this.rulesLayer.load(e).then((()=>this._initializeRulesTable()));return this.addResolvingPromise(r),this}getFeaturesCanAssociateWithQuery(e,r,o,t){const s=this._getWhereClauseForCompatibleFeatures(r,o,t);return new c({...e,where:e.where?.trim()?`${e.where} AND (${s})`:s})}getFeaturesCanAssociateWith(e,r,o){return e.sourceLayer&&"layerId"in e.sourceLayer?r.filter((r=>this.canAssociateFeatures(e,r,o))):[]}canAssociateFeatures(e,r,o){const[t,s]=this._getFeatureAssetCodes(e),u=this._getFeatureSourceLayerId(e),[a,n]=this._getFeatureAssetCodes(r),i=this._getFeatureSourceLayerId(r);return null!=u&&null!=i&&o.some((e=>{const{type:r,direction:o}=e;return this._getRulesForAssociationType(r).some((e=>{const c=this._getRuleFieldValuesForAssociation(e,r,o);return c?.some((e=>u===e?.ruleLayerIdForSource&&t===e?.ruleAssetGroupCodeForSource&&s===e?.ruleAssetTypeCodeForSource&&a===e?.ruleAssetGroupCodeForTarget&&n===e?.ruleAssetTypeCodeForTarget&&i===e?.ruleLayerIdForTarget))}))}))}getLayersCanAssociateWith(e,r,o){return e.sourceLayer&&"layerId"in e.sourceLayer?r.filter((r=>this.canAssociateFeatureToLayer(e,r,o))):[]}canAssociateFeatureToLayer(e,r,o){if(!("layerId"in r))return!1;const[t,s]=this._getFeatureAssetCodes(e),u=this._getFeatureSourceLayerId(e);return null!=u&&o.some((e=>{const{type:o,direction:a}=e;return this._getRulesForAssociationType(o).some((e=>{const n=this._getRuleFieldValuesForAssociation(e,o,a);return n?.some((e=>{const o=u===e?.ruleLayerIdForSource,a=t===e?.ruleAssetGroupCodeForSource,n=s===e?.ruleAssetTypeCodeForSource,i=r.layerId===e?.ruleLayerIdForTarget;return o&&a&&n&&i}))}))}))}getFeatureSQL(e,r){const o=e.layerId.toString(),t=e.fieldsIndex?.normalizeFieldName("assetGroup"),s=e.fieldsIndex?.normalizeFieldName("assetType"),u=t?r.attributes[t]:null,a=s?r.attributes[s]:null,n=this.rulesHash[o];if(n){const e=n.assetGroupHash[u];if(e){return e.assetTypeHash[a]||null}}return null}async _initializeRulesTable(){const e={};let r;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(r||(r={}));const o=[{networkSourceId:"fromNetworkSource",assetGroupId:"fromAssetGroup",assetTypeId:"fromAssetType"},{networkSourceId:"toNetworkSource",assetGroupId:"toAssetGroup",assetTypeId:"toAssetType"},{networkSourceId:"viaNetworkSource",assetGroupId:"viaAssetGroup",assetTypeId:"viaAssetType"}];this.rulesCategorized={attachment:[],containment:[],connectivity:[]};for(const t of this.rules){if(t.ruleType===i.RTAttachment){this.rulesCategorized.attachment.push(t);continue}if(t.ruleType===i.RTContainment){this.rulesCategorized.containment.push(t);continue}if(t.ruleType===i.RTJunctionJunctionConnectivity){this.rulesCategorized.connectivity.push(t);continue}this.rulesCategorized.connectivity.push(t);let s=[[r.from,r.to],[r.to,r.from]];t.ruleType===i.RTEdgeJunctionEdgeConnectivity&&(s=[[r.from,r.via],[r.via,r.from],[r.to,r.via],[r.via,r.to]]);for(const u of s){const s=u.shift(),a=u.shift();let n=!1;switch(t.ruleType){case i.RTEdgeJunctionEdgeConnectivity:n=s===r.from||s===r.to;break;case i.RTJunctionEdgeConnectivity:n=s===r.to}const c=o[s],d=t[c.networkSourceId]?.layerId.toString()??"",l=t[c.assetGroupId]?.assetGroupCode?.toString(),p=t[c.assetTypeId],y=p?.assetTypeCode?.toString(),T=o[a],A=t[T.networkSourceId]?.layerId.toString()??"",C=t[T.assetGroupId]?.assetGroupCode?.toString(),F=t[T.assetTypeId],g=F?.assetTypeCode?.toString(),m=e[d]??{assetGroupHash:{}};if(!(l&&y&&C&&g))continue;const S=m.assetGroupHash[l]??{assetTypeHash:{}},I=S.assetTypeHash[y]??{};if(I[A]=I[A]??{},n){I[d]=I[d]??{};const e=`(assetgroup = ${l} AND assettype = ${y})`;"esriNECPEndVertex"===F?.connectivityPolicy?I[d].endVertex=I[d]?.endVertex?`${I[d].endVertex}`:`${e}`:I[d].anyVertex=I[d].anyVertex?`${I[d].anyVertex}`:`${e}`}const f=`(assetgroup = ${C} AND assettype = ${g})`;"esriNECPEndVertex"===F?.connectivityPolicy?I[A].endVertex=I[A]?.endVertex?`${I[A].endVertex} OR ${f}`:`${f}`:I[A].anyVertex=I[A]?.anyVertex?`${I[A].anyVertex} OR ${f}`:`${f}`,S.assetTypeHash[y]=I,m.assetGroupHash[l]=S,e[d]=m}}this._set("rulesHash",e)}_getRuleFieldValuesForAssociation(e,r,o="from"){switch(r){case"attachment":case"containment":return"from"===o?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"connectivity":case"junction-junction-connectivity":return[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return e.ruleType===i.RTEdgeJunctionEdgeConnectivity?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];default:return[]}}_getWhereClauseForCompatibleFeatures(e,r,o){const t=new Set,s=new Set,[u,a]=this._getAssetFieldNames(e.sourceLayer),[n,i]=this._getFeatureAssetCodes(e),c=this._getFeatureSourceLayerId(e);o.forEach((e=>{const{type:o,direction:u}=e;this._getRulesForAssociationType(o).forEach((e=>{this._getRuleFieldValuesForAssociation(e,o,u).forEach((e=>{const o=c===e?.ruleLayerIdForSource,u=n===e?.ruleAssetGroupCodeForSource,a=i===e?.ruleAssetTypeCodeForSource,d="layerId"in r&&r.layerId===e?.ruleLayerIdForTarget;o&&u&&a&&d&&(t.add(e.ruleAssetGroupCodeForTarget),s.add(e.ruleAssetTypeCodeForTarget))}))}))}));return[`${u} IN (${Array.from(t).filter(Boolean).join(", ")})`,`${a} IN (${Array.from(s).filter(Boolean).join(", ")})`].join(" AND ")}_getRulesForAssociationType(e){const{rulesCategorized:r}=this;switch(e){case"attachment":return r.attachment;case"containment":return r.containment;case"connectivity":case"junction-junction-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionJunctionConnectivity));case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionEdgeConnectivity||e.ruleType===i.RTEdgeJunctionEdgeConnectivity));default:return[]}}_getFeatureSourceLayerId(e){const{sourceLayer:r}=e;let o;return a(r)?o=r.layerId:n(r)&&(o=r.parent?.layerId),o??null}_getAssetFieldNames(e){if(!e||!("fieldsIndex"in e))return[null,null];return[e.fieldsIndex.normalizeFieldName("assetGroup")??null,e.fieldsIndex.normalizeFieldName("assetType")??null]}_getFeatureAssetCodes(e){const[r,o]=this._getAssetFieldNames(e.sourceLayer);return[r?e.attributes[r]:null,o?e.attributes[o]:null]}};e([s({constructOnly:!0})],d.prototype,"rulesLayer",void 0),e([s({constructOnly:!0})],d.prototype,"rules",void 0),e([s({readOnly:!0})],d.prototype,"rulesHash",void 0),e([s()],d.prototype,"rulesCategorized",void 0),e([s({constructOnly:!0})],d.prototype,"request",void 0),d=e([u("esri.networks.RulesTable")],d);const l=d;export{l as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/JSONSupport.js";import o from"../core/Loadable.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as a,isFeatureLayer as n}from"../layers/support/layerUtils.js";import{RuleType as i}from"./support/typeUtils.js";let c=class extends(t.JSONSupportMixin(o)){constructor(e){super(e),this.rulesCategorized={attachment:[],containment:[],connectivity:[]},this.request=r}initialize(){}async load(e){const r=this.rulesLayer.load(e).then((()=>this._initializeRulesTable()));return this.addResolvingPromise(r),this}getFeaturesCanAssociateWithClause(e,r,t){return this._getWhereClauseForCompatibleFeatures(e,r,t)}getFeaturesCanAssociateWith(e,r,t){return null==this._getFeatureSourceLayerId(e)?[]:r.filter((r=>this.canAssociateFeatures(e,r,t)))}canAssociateFeatures(e,r,t){const[o,s]=this._getFeatureAssetCodes(e),u=this._getFeatureSourceLayerId(e),[a,n]=this._getFeatureAssetCodes(r),i=this._getFeatureSourceLayerId(r);return null!=u&&null!=i&&t.some((e=>{const{type:r,direction:t}=e;return this._getRulesForAssociationType(r).some((e=>{const c=this._getRuleFieldValuesForAssociation(e,r,t);return c?.some((e=>u===e?.ruleLayerIdForSource&&o===e?.ruleAssetGroupCodeForSource&&s===e?.ruleAssetTypeCodeForSource&&i===e?.ruleLayerIdForTarget&&a===e?.ruleAssetGroupCodeForTarget&&n===e?.ruleAssetTypeCodeForTarget))}))}))}getLayersCanAssociateWith(e,r,t){return null==this._getFeatureSourceLayerId(e)?[]:r.filter((r=>this.canAssociateFeatureToLayer(e,r,t)))}canAssociateFeatureToLayer(e,r,t){const o=a(r)?r.parent:r;if(!o)return!1;const s=o.layerId,u=a(r)?r.subtypeCode:null,[n,i]=this._getFeatureAssetCodes(e),c=this._getFeatureSourceLayerId(e);return null!=c&&t.some((e=>{const{type:r,direction:t}=e;return this._getRulesForAssociationType(r).some((e=>{const o=this._getRuleFieldValuesForAssociation(e,r,t);return o?.some((e=>c===e?.ruleLayerIdForSource&&n===e?.ruleAssetGroupCodeForSource&&i===e?.ruleAssetTypeCodeForSource&&s===e?.ruleLayerIdForTarget&&(null==u||u===e?.ruleAssetGroupCodeForTarget)))}))}))}getFeatureSQL(e,r){const t=e.layerId.toString(),o=e.fieldsIndex?.normalizeFieldName("assetGroup"),s=e.fieldsIndex?.normalizeFieldName("assetType"),u=o?r.attributes[o]:null,a=s?r.attributes[s]:null,n=this.rulesHash[t];if(n){const e=n.assetGroupHash[u];if(e){return e.assetTypeHash[a]||null}}return null}async _initializeRulesTable(){const e={};let r;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(r||(r={}));const t=[{networkSourceId:"fromNetworkSource",assetGroupId:"fromAssetGroup",assetTypeId:"fromAssetType"},{networkSourceId:"toNetworkSource",assetGroupId:"toAssetGroup",assetTypeId:"toAssetType"},{networkSourceId:"viaNetworkSource",assetGroupId:"viaAssetGroup",assetTypeId:"viaAssetType"}];this.rulesCategorized={attachment:[],containment:[],connectivity:[]};for(const o of this.rules){if(o.ruleType===i.RTAttachment){this.rulesCategorized.attachment.push(o);continue}if(o.ruleType===i.RTContainment){this.rulesCategorized.containment.push(o);continue}if(o.ruleType===i.RTJunctionJunctionConnectivity){this.rulesCategorized.connectivity.push(o);continue}this.rulesCategorized.connectivity.push(o);let s=[[r.from,r.to],[r.to,r.from]];o.ruleType===i.RTEdgeJunctionEdgeConnectivity&&(s=[[r.from,r.via],[r.via,r.from],[r.to,r.via],[r.via,r.to]]);for(const u of s){const s=u.shift(),a=u.shift();let n=!1;switch(o.ruleType){case i.RTEdgeJunctionEdgeConnectivity:n=s===r.from||s===r.to;break;case i.RTJunctionEdgeConnectivity:n=s===r.to}const c=t[s],d=o[c.networkSourceId]?.layerId.toString()??"",l=o[c.assetGroupId]?.assetGroupCode?.toString(),p=o[c.assetTypeId],y=p?.assetTypeCode?.toString(),T=t[a],C=o[T.networkSourceId]?.layerId.toString()??"",A=o[T.assetGroupId]?.assetGroupCode?.toString(),F=o[T.assetTypeId],g=F?.assetTypeCode?.toString(),m=e[d]??{assetGroupHash:{}};if(!(l&&y&&A&&g))continue;const S=m.assetGroupHash[l]??{assetTypeHash:{}},f=S.assetTypeHash[y]??{};if(f[C]=f[C]??{},n){f[d]=f[d]??{};const e=`(assetgroup = ${l} AND assettype = ${y})`;"esriNECPEndVertex"===F?.connectivityPolicy?f[d].endVertex=f[d]?.endVertex?`${f[d].endVertex}`:`${e}`:f[d].anyVertex=f[d].anyVertex?`${f[d].anyVertex}`:`${e}`}const G=`(assetgroup = ${A} AND assettype = ${g})`;"esriNECPEndVertex"===F?.connectivityPolicy?f[C].endVertex=f[C]?.endVertex?`${f[C].endVertex} OR ${G}`:`${G}`:f[C].anyVertex=f[C]?.anyVertex?`${f[C].anyVertex} OR ${G}`:`${G}`,S.assetTypeHash[y]=f,m.assetGroupHash[l]=S,e[d]=m}}this._set("rulesHash",e)}_getRuleFieldValuesForAssociation(e,r,t="from"){switch(r){case"attachment":case"containment":return"from"===t?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"connectivity":case"junction-junction-connectivity":return[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return e.ruleType===i.RTEdgeJunctionEdgeConnectivity?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];default:return[]}}_getWhereClauseForCompatibleFeatures(e,r,t){const o=new Map,[s,u]=this._getAssetFieldNames(e.sourceLayer),[n,i]=this._getFeatureAssetCodes(e),c=this._getFeatureSourceLayerId(e),d=a(r)?r.parent:r;t.forEach((e=>{const{type:r,direction:t}=e;this._getRulesForAssociationType(r).forEach((e=>{this._getRuleFieldValuesForAssociation(e,r,t).forEach((e=>{if(null!=e.ruleAssetGroupCodeForTarget&&null!=e.ruleAssetTypeCodeForTarget&&c===e?.ruleLayerIdForSource&&n===e?.ruleAssetGroupCodeForSource&&i===e?.ruleAssetTypeCodeForSource&&d.layerId===e?.ruleLayerIdForTarget){const r=o.get(e.ruleAssetGroupCodeForTarget)??new Set;r.add(e.ruleAssetTypeCodeForTarget),o.set(e.ruleAssetGroupCodeForTarget,r)}}))}))}));let l=[];return this._mergeAssetCodes(o).forEach(((e,r)=>l.push(`${s} IN (${r}) AND ${u} IN (${Array.from(e).sort().join(", ")})`))),l.length>1&&(l=l.map((e=>`(${e})`))),l.join(" OR ")}_getRulesForAssociationType(e){const{rulesCategorized:r}=this;switch(e){case"attachment":return r.attachment;case"containment":return r.containment;case"connectivity":case"junction-junction-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionJunctionConnectivity));case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionEdgeConnectivity||e.ruleType===i.RTEdgeJunctionEdgeConnectivity));default:return[]}}_getFeatureSourceLayerId(e){const{sourceLayer:r}=e;let t;return n(r)?t=r.layerId:a(r)&&(t=r.parent?.layerId),t??null}_getAssetFieldNames(e){if(!e||!("fieldsIndex"in e))return[null,null];return[e.fieldsIndex.normalizeFieldName("assetGroup")??null,e.fieldsIndex.normalizeFieldName("assetType")??null]}_getFeatureAssetCodes(e){const[r,t]=this._getAssetFieldNames(e.sourceLayer);return[r?e.attributes[r]:null,t?e.attributes[t]:null]}_areSetsEqual(e,r){if(e.size!==r.size)return!1;for(const t of e)if(!r.has(t))return!1;return!0}_mergeAssetCodes(e){const r=new Map,t=new Set;for(const[o,s]of e){const u=new Set([o]);for(const[r,n]of e)o!==r&&!t.has(r)&&this._areSetsEqual(s,n)&&(u.add(r),t.add(r));const a=Array.from(u).sort().join(", ");r.set(a,s)}return r}};e([s({constructOnly:!0})],c.prototype,"rulesLayer",void 0),e([s({constructOnly:!0})],c.prototype,"rules",void 0),e([s({readOnly:!0})],c.prototype,"rulesHash",void 0),e([s()],c.prototype,"rulesCategorized",void 0),e([s({constructOnly:!0})],c.prototype,"request",void 0),c=e([u("esri.networks.RulesTable")],c);const d=c;export{d 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import m from"./support/TerminalConfiguration.js";import d from"./support/TraceJobInfo.js";import{AssociationTypeEnum as c,RuleType as p}from"./support/typeUtils.js";import y from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>m.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((t=>{e.add(t.layerId)})),t?.junctionSources?.map((t=>{e.add(t.layerId)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?m.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new d({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=(e,t)=>e.fromNetworkSource?.sourceId===t.fromNetworkElement?.networkSourceId&&e.toNetworkSource?.sourceId===t.toNetworkElement?.networkSourceId&&e.fromAssetGroup?.assetGroupCode===t.fromNetworkElement?.assetGroupCode&&e.fromAssetType?.assetTypeCode===t.fromNetworkElement?.assetTypeCode&&e.toAssetGroup?.assetGroupCode===t.toNetworkElement?.assetGroupCode&&e.toAssetType?.assetTypeCode===t.toNetworkElement?.assetTypeCode&&r(e.fromTerminal,t.fromNetworkElement)&&r(e.toTerminal,t.toNetworkElement);if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>s(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>s(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.viaNetworkSource?t.fromNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.viaNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.fromAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.fromAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.viaAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.fromTerminal,e.fromNetworkElement)&&r(t.viaTerminal,e.toNetworkElement)||t.viaNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.toNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.viaAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.toAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.toAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.viaTerminal,e.fromNetworkElement)&&r(t.toTerminal,e.toNetworkElement):s(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:c[e.associationType],iscontentvisible:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await w(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),m=s.get("TONETWORKSOURCEID"),d=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),w=s.get("VIAASSETGROUP"),T=s.get("VIAASSETTYPE"),I=s.get("VIATERMINALID"),h=r.attributes[o.name],g=new Date(r.attributes[a.name]),k=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[m.name],assetGroupId:r.attributes[d.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[w.name],assetTypeId:r.attributes[T.name],terminalId:r.attributes[I.name]}];let b;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(b||(b={}));const N={ruleType:h,creationDate:g};for(const S of[b.from,b.to,b.via]){if(h!==p.RTEdgeJunctionEdgeConnectivity&&S===b.via)continue;const e=k[S],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(S){case b.from:i="from";break;case b.to:i="to";break;case b.via:i="via"}N[`${i}NetworkSource`]=r,N[`${i}AssetGroup`]=s,N[`${i}AssetType`]=o,N[`${i}Terminal`]=a?.toJSON()}return N}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function w(e){const t=new y({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const T=f;export{T as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import d from"./support/TerminalConfiguration.js";import m from"./support/TraceJobInfo.js";import{AssociationTypeEnum as c,RuleType as p}from"./support/typeUtils.js";import y from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>d.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?d.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new m({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=(e,t)=>e.fromNetworkSource?.sourceId===t.fromNetworkElement?.networkSourceId&&e.toNetworkSource?.sourceId===t.toNetworkElement?.networkSourceId&&e.fromAssetGroup?.assetGroupCode===t.fromNetworkElement?.assetGroupCode&&e.fromAssetType?.assetTypeCode===t.fromNetworkElement?.assetTypeCode&&e.toAssetGroup?.assetGroupCode===t.toNetworkElement?.assetGroupCode&&e.toAssetType?.assetTypeCode===t.toNetworkElement?.assetTypeCode&&r(e.fromTerminal,t.fromNetworkElement)&&r(e.toTerminal,t.toNetworkElement);if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>s(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>s(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.viaNetworkSource?t.fromNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.viaNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.fromAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.fromAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.viaAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.fromTerminal,e.fromNetworkElement)&&r(t.viaTerminal,e.toNetworkElement)||t.viaNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.toNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.viaAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.toAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.toAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.viaTerminal,e.fromNetworkElement)&&r(t.toTerminal,e.toNetworkElement):s(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:c[e.associationType],iscontentvisible:null==e.isContentVisible?void 0:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await w(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),w=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),T=s.get("VIATERMINALID"),h=r.attributes[o.name],g=new Date(r.attributes[a.name]),k=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[w.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[T.name]}];let b;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(b||(b={}));const N={ruleType:h,creationDate:g};for(const S of[b.from,b.to,b.via]){if(h!==p.RTEdgeJunctionEdgeConnectivity&&S===b.via)continue;const e=k[S],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(S){case b.from:i="from";break;case b.to:i="to";break;case b.via:i="via"}N[`${i}NetworkSource`]=r,N[`${i}AssetGroup`]=s,N[`${i}AssetType`]=o,N[`${i}Terminal`]=a?.toJSON()}return N}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function w(e){const t=new y({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const I=f;export{I as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ function t(t,e){if("feature"!==e.type&&"subtype-group"!==e.type)return[];if(!e.url)return[];const r="utilityNetworks"in t.map?t.map.utilityNetworks??[]:[];for(const i of r)if(i.isUtilityLayer(e)){const t=e.fieldsIndex.get("assetgroup"),r=e.fieldsIndex.get("assettype");return[t?.name,r?.name].filter((t=>null!=t))}return[]}export{t as getUtilityNetworkFields};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{JSONMap as n}from"../../core/jsonMap.js";var t;!function(n){n[n.RTJunctionJunctionConnectivity=1]="RTJunctionJunctionConnectivity",n[n.RTContainment=2]="RTContainment",n[n.RTAttachment=3]="RTAttachment",n[n.RTJunctionEdgeConnectivity=4]="RTJunctionEdgeConnectivity",n[n.RTEdgeJunctionEdgeConnectivity=5]="RTEdgeJunctionEdgeConnectivity"}(t||(t={}));const o=new n({connected:"connected",upstream:"upstream",downstream:"downstream",shortestPath:"shortest-path",subnetwork:"subnetwork",subnetworkController:"subnetwork-controller",loops:"loops",isolation:"isolation"}),i=new n({junctionJunctionConnectivity:"junction-junction-connectivity",connectivity:"connectivity",attachment:"attachment",containment:"containment",junctionEdgeFromConnectivity:"junction-edge-from-connectivity",junctionEdgeMidspanConnectivity:"junction-edge-midspan-connectivity",junctionEdgeToConnectivity:"junction-edge-to-connectivity"}),e={connectivity:1,"junction-junction-connectivity":1,attachment:2,containment:3,"junction-edge-from-connectivity":4,"junction-edge-midspan-connectivity":5,"junction-edge-to-connectivity":6},c=new n({normal:"normal",rebuild:"rebuild",forceRebuild:"force-rebuild"});export{e as AssociationTypeEnum,t as RuleType,i as associationTypeKebabDict,o as traceTypeKebabDict,c as validationTypeKebabDict};
5
+ import{JSONMap as n}from"../../core/jsonMap.js";var t;!function(n){n[n.RTJunctionJunctionConnectivity=1]="RTJunctionJunctionConnectivity",n[n.RTContainment=2]="RTContainment",n[n.RTAttachment=3]="RTAttachment",n[n.RTJunctionEdgeConnectivity=4]="RTJunctionEdgeConnectivity",n[n.RTEdgeJunctionEdgeConnectivity=5]="RTEdgeJunctionEdgeConnectivity"}(t||(t={}));const o=new n({connected:"connected",upstream:"upstream",downstream:"downstream",shortestPath:"shortest-path",subnetwork:"subnetwork",subnetworkController:"subnetwork-controller",loops:"loops",isolation:"isolation"}),i=new n({junctionJunctionConnectivity:"junction-junction-connectivity",connectivity:"connectivity",attachment:"attachment",containment:"containment",junctionEdgeFromConnectivity:"junction-edge-from-connectivity",junctionEdgeMidspanConnectivity:"junction-edge-midspan-connectivity",junctionEdgeToConnectivity:"junction-edge-to-connectivity"}),e={connectivity:1,"junction-junction-connectivity":1,containment:2,attachment:3,"junction-edge-from-connectivity":4,"junction-edge-midspan-connectivity":5,"junction-edge-to-connectivity":6},c=new n({normal:"normal",rebuild:"rebuild",forceRebuild:"force-rebuild"});export{e as AssociationTypeEnum,t as RuleType,i as associationTypeKebabDict,o as traceTypeKebabDict,c as validationTypeKebabDict};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.32.0-next.20250211",
3
+ "version": "4.32.0-next.20250213",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [