@arcgis/core 4.33.0-next.20250213 → 4.33.0-next.20250214

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 (241) hide show
  1. package/arcade/arcadeAsyncRuntime.js +1 -1
  2. package/arcade/arcadeCompiler.js +1 -1
  3. package/arcade/arcadeEnvironment.js +1 -1
  4. package/arcade/arcadeRuntime.js +1 -1
  5. package/arcade/featureSetUtils.js +1 -1
  6. package/arcade/featureset/actions/GroupBy.js +1 -1
  7. package/arcade/featureset/actions/OrderBy.js +1 -1
  8. package/arcade/functions/date.js +1 -1
  9. package/arcade/functions/feature.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/featuresetgeom.js +1 -1
  12. package/arcade/functions/featuresetstats.js +1 -1
  13. package/arcade/functions/featuresetstring.js +1 -1
  14. package/arcade/functions/fieldStats.js +1 -1
  15. package/arcade/functions/geomasync.js +1 -1
  16. package/arcade/functions/geometry.js +1 -1
  17. package/arcade/functions/geomsync.js +1 -1
  18. package/arcade/functions/knowledgegraph.js +1 -1
  19. package/arcade/functions/maths.js +1 -1
  20. package/arcade/functions/string.js +1 -1
  21. package/arcade/geometry/functions.js +1 -1
  22. package/arcade/languageUtils.js +1 -1
  23. package/arcade.js +1 -1
  24. package/assets/esri/core/workers/RemoteClient.js +1 -1
  25. package/assets/esri/core/workers/chunks/{89960be0e525d42ccffe.js → 01f8f52a3f9e6fb72f64.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{8191dd3d7451b2e7b95e.js → 041eebac192855fbf919.js} +1 -1
  27. package/assets/esri/core/workers/chunks/09cbf45dc7b026957d3e.js +1 -0
  28. package/assets/esri/core/workers/chunks/{1a286d43daa3b811c30d.js → 1661ac4e1b6c6af6ee0f.js} +1 -1
  29. package/assets/esri/core/workers/chunks/197dc75a1c10c0fbf65a.js +1 -0
  30. package/assets/esri/core/workers/chunks/238bcf6514a1f214cc8a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{efded84870064c3d8210.js → 23a045fccc005079bd58.js} +1 -1
  32. package/assets/esri/core/workers/chunks/32fee5446ee0b0a6c4bd.js +1 -0
  33. package/assets/esri/core/workers/chunks/{f429d95eb986f3d215f3.js → 391c200274bbeb92404c.js} +1 -1
  34. package/assets/esri/core/workers/chunks/3c44b4bf7fe407ec1d70.js +1 -0
  35. package/assets/esri/core/workers/chunks/3eacb4d1275f2d87825f.js +1 -0
  36. package/assets/esri/core/workers/chunks/{c0af54cc5938176ce764.js → 3fe7be535affae31de7e.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{c061cad8323f0469e7e4.js → 42f21349f488a14198e4.js} +1 -1
  38. package/assets/esri/core/workers/chunks/48eb5cbb4555acc56984.js +1 -0
  39. package/assets/esri/core/workers/chunks/4927b33f7e9daf059765.js +1 -0
  40. package/assets/esri/core/workers/chunks/50bab11c32bf4001edd7.js +1 -0
  41. package/assets/esri/core/workers/chunks/5c9a7b1dedd146cc65d2.js +1 -0
  42. package/assets/esri/core/workers/chunks/5d8120c84e5a164cb1bc.js +1 -0
  43. package/assets/esri/core/workers/chunks/{7a9e1696dc6120df15b0.js → 60ca6a2e9f1e2c969aab.js} +1 -1
  44. package/assets/esri/core/workers/chunks/679cc23be07ededb3992.js +1 -0
  45. package/assets/esri/core/workers/chunks/{9f122278e917c9ce5f95.js → 67c1e2c17ea3ca27248c.js} +1 -1
  46. package/assets/esri/core/workers/chunks/69b55259f90e8e4bc2aa.js +1 -0
  47. package/assets/esri/core/workers/chunks/69e0ff74e44962d97049.js +1 -0
  48. package/assets/esri/core/workers/chunks/6ca4b5d1a076c6079472.js +1 -0
  49. package/assets/esri/core/workers/chunks/{7058001bf66f9f3d5d45.js → 6d02d66234a7b74e5c14.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{77bfd4f819096cb754ae.js → 6e92569a4a82592b95dc.js} +1 -1
  51. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +1 -0
  52. package/assets/esri/core/workers/chunks/744bdf2bb0cc38e6a7b1.js +1 -0
  53. package/assets/esri/core/workers/chunks/7bf9ebff90bb02bec8e7.js +1 -0
  54. package/assets/esri/core/workers/chunks/{8b6580329e1e35ea4190.js → 7c03489438f51a5170f3.js} +1 -1
  55. package/assets/esri/core/workers/chunks/7e77e4288ed205128b87.js +1 -0
  56. package/assets/esri/core/workers/chunks/80c3e933b43ea79b30de.js +1 -0
  57. package/assets/esri/core/workers/chunks/830844f7fb7557d30f34.js +1 -0
  58. package/assets/esri/core/workers/chunks/8a66d06132c8803033c9.js +1 -0
  59. package/assets/esri/core/workers/chunks/{e9993d4f2bfdc434fbcc.js → 8f4bcca8b0525e19374f.js} +1 -1
  60. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +1 -0
  61. package/assets/esri/core/workers/chunks/9968c6654d048c9add0c.js +1 -0
  62. package/assets/esri/core/workers/chunks/{b50176897ffadc53573e.js → 9bbfa8dc4124b5273d28.js} +1 -1
  63. package/assets/esri/core/workers/chunks/a2b548fbfa2eb5e6f2a7.js +1 -0
  64. package/assets/esri/core/workers/chunks/a37825705e49b60e5d4b.js +1 -0
  65. package/assets/esri/core/workers/chunks/{211c32244e05164dcd38.js → aebbaa7ab7a6b3b1579c.js} +2 -2
  66. package/assets/esri/core/workers/chunks/b90b7ffc1e9363ed18e0.js +1 -0
  67. package/assets/esri/core/workers/chunks/{a39977478a6c57d2e8fb.js → bd2dcc55ac3418421ee5.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{83fe9a8002a4fc96e534.js → bd38717780fffa49d36c.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{c77ade444aa2f3f2b599.js → bdc9dec6a359d2e3705c.js} +1 -1
  70. package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +1 -0
  71. package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +1 -0
  72. package/assets/esri/core/workers/chunks/cb3148cf11a420d6e9ab.js +1 -0
  73. package/assets/esri/core/workers/chunks/{8d8f5f08d730270e1165.js → cb9a27176bd5de2c34ca.js} +1 -1
  74. package/assets/esri/core/workers/chunks/cdf942020b7054628dc9.js +1 -0
  75. package/assets/esri/core/workers/chunks/d6c3df07cfaa6bb639e9.js +1 -0
  76. package/assets/esri/core/workers/chunks/ed89a108b032b982b12f.js +1 -0
  77. package/assets/esri/core/workers/chunks/ee5b82873ff80cb4ba34.js +1 -0
  78. package/assets/esri/core/workers/chunks/{d0656e9d30eb3a66a8db.js → f976233ad5e5b718ba83.js} +1 -1
  79. package/assets/esri/themes/base/widgets/_Directions.scss +30 -9
  80. package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
  81. package/assets/esri/themes/dark/main.css +1 -1
  82. package/assets/esri/themes/light/main.css +1 -1
  83. package/assets/esri/themes/light/view.css +1 -1
  84. package/chunks/arcade.js +1 -1
  85. package/chunks/array.js +1 -1
  86. package/chunks/languageUtils.js +1 -1
  87. package/copyright.txt +26 -19
  88. package/core/colorUtils.js +1 -1
  89. package/core/deprecate.js +1 -1
  90. package/editing/templateUtils.js +1 -1
  91. package/geohash/geohashUtils.js +1 -1
  92. package/interfaces.d.ts +634 -129
  93. package/intl/locale.js +1 -1
  94. package/layers/FeatureLayer.js +1 -1
  95. package/layers/GeoJSONLayer.js +1 -1
  96. package/layers/ImageryTileLayer.js +1 -1
  97. package/layers/OGCFeatureLayer.js +1 -1
  98. package/layers/RouteLayer.js +1 -1
  99. package/layers/SubtypeGroupLayer.js +1 -1
  100. package/layers/WFSLayer.js +1 -1
  101. package/layers/graphics/data/queryUtils.js +1 -1
  102. package/layers/mixins/ArcGISImageService.js +1 -1
  103. package/layers/mixins/ImageryTileMixin.js +1 -1
  104. package/layers/mixins/TrackableLayer.d.ts +4 -0
  105. package/layers/save/imageryUtils.js +1 -1
  106. package/layers/support/ExportImageServiceParameters.js +1 -1
  107. package/layers/support/SubtypeSublayer.js +1 -1
  108. package/layers/support/TitleCreator.js +5 -0
  109. package/layers/support/TrackInfo.d.ts +4 -0
  110. package/layers/support/TrackInfo.js +1 -1
  111. package/layers/support/TrackPartInfo.d.ts +4 -0
  112. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  113. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  114. package/layers/support/rasterDatasets/datasetUtils.js +5 -0
  115. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  116. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  117. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  118. package/layers/support/rasterFunctions/creators/createLocalFunctions.js +1 -1
  119. package/layers/support/rasterFunctions/creators/createStatisticsFunctions.js +1 -1
  120. package/networks/UtilityNetwork.js +1 -1
  121. package/networks/support/networkFieldUtils.js +5 -0
  122. package/package.json +1 -1
  123. package/renderers/support/rasterRendererHelper.js +1 -1
  124. package/rest/query/executeForIds.js +1 -1
  125. package/rest/support/BinParametersBase.js +1 -1
  126. package/support/arcadeUtils.js +1 -1
  127. package/support/revision.js +1 -1
  128. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  129. package/symbols/cim/rasterizingUtils.js +1 -1
  130. package/symbols/support/previewCIMSymbol.js +1 -1
  131. package/symbols/support/previewSymbol2D.js +1 -1
  132. package/symbols/support/symbolUtils.js +1 -1
  133. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  134. package/views/2d/layers/RouteLayerView2D.js +1 -1
  135. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  136. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  137. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  138. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  139. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  140. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  141. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  142. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  143. package/views/3d/layers/I3SMeshView3D.js +1 -1
  144. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  145. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  146. package/views/3d/layers/i3s/BuildingFilterUtil.js +1 -1
  147. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  148. package/views/3d/layers/i3s/SymbologyInfo.js +5 -0
  149. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  150. package/views/3d/state/utils/navigationUtils.js +1 -1
  151. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  152. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  153. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  154. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +14 -14
  155. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  156. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  157. package/views/3d/webgl-engine/core/renderPasses/RenderPassIdentifier.js +5 -0
  158. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  159. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
  160. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  161. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  162. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  163. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  164. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  165. package/views/View.js +1 -1
  166. package/views/draw/DrawAction.js +1 -1
  167. package/views/layers/FeatureLayerView.js +1 -1
  168. package/views/layers/ImageryTileLayerView.js +1 -1
  169. package/views/support/RequiredFieldsOptions.js +5 -0
  170. package/views/webgl/Texture.js +1 -1
  171. package/widgets/BasemapGallery.js +1 -1
  172. package/widgets/BasemapToggle.js +1 -1
  173. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  174. package/widgets/BatchAttributeForm.js +1 -1
  175. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  176. package/widgets/Compass/CompassViewModel.js +1 -1
  177. package/widgets/DirectionalPad.js +1 -1
  178. package/widgets/Directions/DirectionsViewModel.js +1 -1
  179. package/widgets/Directions.js +1 -1
  180. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  181. package/widgets/Editor/EditorViewModel.js +1 -1
  182. package/widgets/Editor.js +1 -1
  183. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  184. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  185. package/widgets/Fullscreen.js +1 -1
  186. package/widgets/Home.js +1 -1
  187. package/widgets/LayerList/LayerListItem.js +1 -1
  188. package/widgets/LayerList/ListItem.js +1 -1
  189. package/widgets/LayerList/support/layerListUtils.js +1 -1
  190. package/widgets/Legend/LegendViewModel.js +1 -1
  191. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  192. package/widgets/Legend.js +1 -1
  193. package/widgets/Locate.js +1 -1
  194. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  195. package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +1 -1
  196. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  197. package/widgets/OrientedImageryViewer/constants.js +1 -1
  198. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  199. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  200. package/widgets/OrientedImageryViewer.js +1 -1
  201. package/widgets/ScaleBar.js +1 -1
  202. package/widgets/Swipe.js +1 -1
  203. package/widgets/TableList/ListItem.js +1 -1
  204. package/widgets/TableList.js +1 -1
  205. package/widgets/Track.js +1 -1
  206. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  207. package/widgets/UtilityNetworkTrace.js +1 -1
  208. package/widgets/support/GoTo.js +1 -1
  209. package/widgets/support/goToUtils.js +5 -0
  210. package/assets/esri/core/workers/chunks/03f51ea011ffbcfb7c7d.js +0 -1
  211. package/assets/esri/core/workers/chunks/122ed10cac9f192e1eec.js +0 -1
  212. package/assets/esri/core/workers/chunks/1249fd2f83caeaefd8ce.js +0 -1
  213. package/assets/esri/core/workers/chunks/144e534d4ac1aafab60d.js +0 -1
  214. package/assets/esri/core/workers/chunks/15ad8036736a32652c9b.js +0 -1
  215. package/assets/esri/core/workers/chunks/177d4c2c10ef7369006f.js +0 -1
  216. package/assets/esri/core/workers/chunks/1d282700e76285a1684c.js +0 -1
  217. package/assets/esri/core/workers/chunks/282c2d52011b331d4704.js +0 -1
  218. package/assets/esri/core/workers/chunks/35392bf8f21005ad6170.js +0 -1
  219. package/assets/esri/core/workers/chunks/37cfd102b6ab5b959f9d.js +0 -1
  220. package/assets/esri/core/workers/chunks/6a9a1cd8134a903dd05a.js +0 -1
  221. package/assets/esri/core/workers/chunks/73d03c208242778e67bf.js +0 -1
  222. package/assets/esri/core/workers/chunks/7485588bd24217669578.js +0 -1
  223. package/assets/esri/core/workers/chunks/80d3aa3f27ad5b2b969b.js +0 -1
  224. package/assets/esri/core/workers/chunks/8939479cd433cc53f6c1.js +0 -1
  225. package/assets/esri/core/workers/chunks/8a2f3ce46eeac853b3a9.js +0 -1
  226. package/assets/esri/core/workers/chunks/8f31fbb1d549230ee3db.js +0 -1
  227. package/assets/esri/core/workers/chunks/91384398f01485631f70.js +0 -1
  228. package/assets/esri/core/workers/chunks/9421ae38fdf986b9b107.js +0 -1
  229. package/assets/esri/core/workers/chunks/94225d92afbdb10dfedb.js +0 -1
  230. package/assets/esri/core/workers/chunks/99c136b800e5fc7e04f4.js +0 -1
  231. package/assets/esri/core/workers/chunks/9b74635d80d029498da1.js +0 -1
  232. package/assets/esri/core/workers/chunks/a9274c9132e7a2691abb.js +0 -1
  233. package/assets/esri/core/workers/chunks/af917f69d9c6e9937263.js +0 -1
  234. package/assets/esri/core/workers/chunks/ca6180e572e69540c183.js +0 -1
  235. package/assets/esri/core/workers/chunks/cccd215b0a4890551957.js +0 -1
  236. package/assets/esri/core/workers/chunks/d074c916b414432a7b6a.js +0 -1
  237. package/assets/esri/core/workers/chunks/de638753a30c9aa41bad.js +0 -1
  238. package/assets/esri/core/workers/chunks/e6633f0326a44477f630.js +0 -1
  239. package/assets/esri/core/workers/chunks/eb0ce7937813d1be1284.js +0 -1
  240. package/assets/esri/core/workers/chunks/f2cf05fbbb51d657d300.js +0 -1
  241. package/assets/esri/core/workers/chunks/f4ba823c8acd60c7c82d.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../Widget.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{globalCss as s}from"../../support/globalCss.js";import"../../support/widgetUtils.js";import{messageBundle as r}from"../../support/decorators/messageBundle.js";import{tsx as c}from"../../support/jsxFactory.js";import{isFromElement as a,getFeatureTitle as l,getAssociationTitle as m}from"../../support/UtilityNetworkAssociations/utilityNetworkUtils.js";const d="esri-feature-form-utility-network-association-settings",u={base:d,infoContainer:`${d}__info-container`};let p=class extends i{constructor(e,t){super(e,t),this.association=null,this.editedAssociation=null,this.headingLevel=5,this.messagesFeature=null,this.messagesCommon=null,this.messagesFeatureForm=null,this.readOnly=!1,this.sourceFeature=null,this.targetFeature=null,this.utilityNetwork=null}loadDependencies(){return n({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}get associationType(){return this.association.associationType}set associationType(e){this.association.associationType=e,"junction-edge-to-connectivity"!==e&&"junction-edge-from-connectivity"!==e||(this.association.percentAlong=void 0)}render(){return c("div",{class:this.classes(u.base,s.widget)},this._renderFromAssociationEndpoint(),this._renderToAssociationEndpoint(),this._renderAdditionalContent())}_renderFromAssociationEndpoint(){const{associationType:e,association:t,sourceFeature:o,targetFeature:i,messagesFeatureForm:n}=this,s=a(o,t)?o:i,r=l(s),c=m(t,"from",n.associations);switch(e){case"connectivity":case"junction-junction-connectivity":return this._renderAssociationEndpoint(r,c,this._renderConnectivityContent(s,t.fromNetworkElement))}return this._renderAssociationEndpoint(r,c)}_renderToAssociationEndpoint(){const{associationType:e,association:t,sourceFeature:o,targetFeature:i,messagesFeatureForm:n}=this,s=a(o,t)?i:o,r=l(s),c=m(t,"to",n.associations);switch(e){case"connectivity":case"junction-junction-connectivity":return this._renderAssociationEndpoint(r,c,this._renderConnectivityContent(s,t.toNetworkElement));case"containment":return this._renderAssociationEndpoint(r,c,this._renderContainmentContent())}return this._renderAssociationEndpoint(r,c)}_renderAssociationEndpoint(e,t,o){return c("calcite-block",{description:t,heading:e,open:!0},o)}_renderContainmentContent(){const{messagesFeatureForm:e,association:t}=this,o=t.isContentVisible??!1;return c("calcite-label",{layout:"inline"},e.associations.visible,c("calcite-switch",{checked:o,onCalciteSwitchChange:({currentTarget:e})=>{t.isContentVisible=e.checked}}))}_renderConnectivityContent(e,t){const{messagesFeatureForm:o,utilityNetwork:i}=this,n=i.getTerminalConfiguration(e),s=n?.terminals.map((e=>this._renderComboboxListItemNumber(e.id,t.terminalId,e.name)))||[];return c("calcite-label",null,o.associations.terminal,c("calcite-combobox",{allowCustomValues:!1,clearDisabled:!0,label:o.associations.terminalComboboxLabel,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{t.terminalId=parseInt(e.value,10)}},...s))}_renderAdditionalContent(){const{associationType:e}=this;switch(e){case"connectivity":case"junction-junction-connectivity":case"attachment":case"containment":return}const t="junction-edge-midspan-connectivity"===e?e:"junction-edge-from-connectivity",{messagesFeatureForm:o}=this,i=[this._renderComboboxListItemString("junction-edge-midspan-connectivity",t,o.associations.midspanEdge),this._renderComboboxListItemString("junction-edge-from-connectivity",t,o.associations.endpointEdge)];return c("div",{class:u.infoContainer},c("calcite-label",{key:"additional-content"},o.associations.connectTo,c("calcite-combobox",{allowCustomValues:!1,clearDisabled:!0,label:o.associations.edgeConnectionComboboxLabel,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{this.associationType=e.value}},...i)),"junction-edge-midspan-connectivity"===t?this._renderMidspanEdgeContent():this._renderEndpointEdgeContent())}_renderMidspanEdgeContent(){const{association:e,messagesFeatureForm:t}=this;return c("calcite-label",{key:"midspan-edge"},t.associations.midspanLocation,c("calcite-input-number",{max:100,min:0,numberButtonType:"vertical",suffixText:"%",value:`${e.percentAlong}`,onCalciteInputNumberInput:({currentTarget:t})=>{e.percentAlong=.01*parseFloat(t.value)}}))}_renderEndpointEdgeContent(){const{associationType:e,messagesFeatureForm:t}=this,o="junction-edge-to-connectivity"===e;return c("calcite-label",{key:"endpoint-edge"},t.associations.edgeSide,c("calcite-label",{layout:"inline"},t.associations.fromSide,c("calcite-switch",{checked:o,onCalciteSwitchChange:({currentTarget:e})=>{const t=e.checked?"junction-edge-to-connectivity":"junction-edge-from-connectivity";this.associationType=t}}),t.associations.toSide))}_renderComboboxListItemNumber(e,t,o){return c("calcite-combobox-item",{heading:o,key:`#${e}`,selected:t===e,value:`${e}`})}_renderComboboxListItemString(e,t,o){return c("calcite-combobox-item",{heading:o,key:`#${e}`,selected:t===e,value:`${e}`})}};e([t()],p.prototype,"association",void 0),e([t()],p.prototype,"associationType",null),e([t()],p.prototype,"editedAssociation",void 0),e([t()],p.prototype,"headingLevel",void 0),e([t(),r("esri/widgets/Feature/t9n/Feature")],p.prototype,"messagesFeature",void 0),e([t(),r("esri/t9n/common")],p.prototype,"messagesCommon",void 0),e([t(),r("esri/widgets/FeatureForm/t9n/FeatureForm")],p.prototype,"messagesFeatureForm",void 0),e([t()],p.prototype,"readOnly",void 0),e([t()],p.prototype,"sourceFeature",void 0),e([t()],p.prototype,"targetFeature",void 0),e([t()],p.prototype,"utilityNetwork",void 0),p=e([o("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationSettings")],p);const g=p;export{g as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../Widget.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{globalCss as s}from"../../support/globalCss.js";import"../../support/widgetUtils.js";import{messageBundle as r}from"../../support/decorators/messageBundle.js";import{tsx as c}from"../../support/jsxFactory.js";import{isFromElement as a,getFeatureTitle as l,getAssociationTitle as m}from"../../support/UtilityNetworkAssociations/utilityNetworkUtils.js";const d="esri-feature-form-utility-network-association-settings",p={base:d,infoContainer:`${d}__info-container`};let u=class extends i{constructor(e,t){super(e,t),this.percentAlong=50,this.headingLevel=5,this.messagesFeature=null,this.messagesCommon=null,this.messagesFeatureForm=null,this.readOnly=!1,this.sourceFeature=null,this.targetFeature=null,this.utilityNetwork=null}loadDependencies(){return n({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}get association(){return this._get("association")}set association(e){this.percentAlong=e.percentAlong?100*e.percentAlong:50,this._set("association",e)}get associationType(){return this.association.associationType}set associationType(e){this.association.associationType=e,"junction-edge-to-connectivity"!==e&&"junction-edge-from-connectivity"!==e||(this.association.percentAlong=void 0)}render(){return c("div",{class:this.classes(p.base,s.widget)},this._renderFromAssociationEndpoint(),this._renderToAssociationEndpoint(),this._renderAdditionalContent())}_renderFromAssociationEndpoint(){const{associationType:e,association:t,sourceFeature:o,targetFeature:i,messagesFeatureForm:n}=this,s=a(o,t)?o:i,r=l(s),c=m(t,"from",n.associations);switch(e){case"connectivity":case"junction-junction-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-from-connectivity":case"junction-edge-to-connectivity":return this._renderAssociationEndpoint(r,c,this._renderConnectivityContent(s,t.fromNetworkElement))}return this._renderAssociationEndpoint(r,c)}_renderToAssociationEndpoint(){const{associationType:e,association:t,sourceFeature:o,targetFeature:i,messagesFeatureForm:n}=this,s=a(o,t)?i:o,r=l(s),c=m(t,"to",n.associations);switch(e){case"connectivity":case"junction-junction-connectivity":return this._renderAssociationEndpoint(r,c,this._renderConnectivityContent(s,t.toNetworkElement));case"containment":return this._renderAssociationEndpoint(r,c,this._renderContainmentContent())}return this._renderAssociationEndpoint(r,c)}_renderAssociationEndpoint(e,t,o){return c("calcite-block",{description:t,heading:e,open:!0},o)}_renderContainmentContent(){const{messagesFeatureForm:e,association:t}=this,o=t.isContentVisible??!1;return c("calcite-label",{layout:"inline"},e.associations.visible,c("calcite-switch",{checked:o,onCalciteSwitchChange:({currentTarget:e})=>{t.isContentVisible=e.checked}}))}_renderConnectivityContent(e,t){const{messagesFeatureForm:o,utilityNetwork:i}=this,n=i.getTerminalConfiguration(e),s=n?.terminals.map((e=>this._renderComboboxListItemNumber(e.id,t.terminalId,e.name)))||[];return c("calcite-label",null,o.associations.terminal,c("calcite-combobox",{allowCustomValues:!1,clearDisabled:!0,label:o.associations.terminalComboboxLabel,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{t.terminalId=parseInt(e.value,10)}},...s))}_renderAdditionalContent(){const{associationType:e}=this;switch(e){case"connectivity":case"junction-junction-connectivity":case"attachment":case"containment":return}const t="junction-edge-midspan-connectivity"===e?e:"junction-edge-from-connectivity",{messagesFeatureForm:o}=this,i=[this._renderComboboxListItemString("junction-edge-midspan-connectivity",t,o.associations.midspanEdge),this._renderComboboxListItemString("junction-edge-from-connectivity",t,o.associations.endpointEdge)];return c("div",{class:p.infoContainer},c("calcite-label",{key:"additional-content"},o.associations.connectTo,c("calcite-combobox",{allowCustomValues:!1,clearDisabled:!0,label:o.associations.edgeConnectionComboboxLabel,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{this.associationType=e.value}},...i)),"junction-edge-midspan-connectivity"===t?this._renderMidspanEdgeContent():this._renderEndpointEdgeContent())}_renderMidspanEdgeContent(){const{messagesFeatureForm:e,percentAlong:t,association:o}=this;return o.percentAlong=t/100,c("calcite-label",{key:"midspan-edge"},e.associations.midspanLocation,c("calcite-input-number",{max:100,min:0,numberButtonType:"vertical",suffixText:"%",value:`${t}`,onCalciteInputNumberInput:({currentTarget:e})=>{this.percentAlong=parseFloat(e.value)}}))}_renderEndpointEdgeContent(){const{associationType:e,messagesFeatureForm:t}=this,o="junction-edge-to-connectivity"===e;return c("calcite-label",{key:"endpoint-edge"},t.associations.edgeSide,c("calcite-label",{layout:"inline"},t.associations.fromSide,c("calcite-switch",{checked:o,onCalciteSwitchChange:({currentTarget:e})=>{const t=e.checked?"junction-edge-to-connectivity":"junction-edge-from-connectivity";this.associationType=t}}),t.associations.toSide))}_renderComboboxListItemNumber(e,t,o){return c("calcite-combobox-item",{heading:o,key:`#${e}`,selected:t===e,value:`${e}`})}_renderComboboxListItemString(e,t,o){return c("calcite-combobox-item",{heading:o,key:`#${e}`,selected:t===e,value:`${e}`})}};e([t()],u.prototype,"association",null),e([t()],u.prototype,"percentAlong",void 0),e([t()],u.prototype,"associationType",null),e([t()],u.prototype,"headingLevel",void 0),e([t(),r("esri/widgets/Feature/t9n/Feature")],u.prototype,"messagesFeature",void 0),e([t(),r("esri/t9n/common")],u.prototype,"messagesCommon",void 0),e([t(),r("esri/widgets/FeatureForm/t9n/FeatureForm")],u.prototype,"messagesFeatureForm",void 0),e([t()],u.prototype,"readOnly",void 0),e([t()],u.prototype,"sourceFeature",void 0),e([t()],u.prototype,"targetFeature",void 0),e([t()],u.prototype,"utilityNetwork",void 0),u=e([o("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationSettings")],u);const g=u;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import s from"../../core/Evented.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as r,when as i,syncAndInitial as a,sync as n}from"../../core/reactiveUtils.js";import{property as p}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{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as d}from"../../editing/templateUtils.js";import{getEffectiveLayerCapabilities as c,isSubtypeGroupLayer as y}from"../../layers/support/layerUtils.js";import{isTemplateItemGroup as h,mapItemsByTemplate as f,isTemplateGroupInfo as g,loadLayerWithTemplates as _,makeTemplateItemInfos as I,makeGroupItemInfos as F,nullGroupBy as b}from"./featureTemplatesUtils.js";import v from"./TemplateItem.js";import T from"./TemplateItemGroup.js";const j=({layer:t})=>({key:t,label:t.title??""}),B=({layer:t})=>({key:t.geometryType,label:t.geometryType??""});let w=class extends s.EventedAccessor{constructor(t){super(t),this._allItems=[],this._updatingHandles=new m,this._updateTask=null,this.disabled=!1,this.disabledItemFunction=null,this.filterFunction=null,this.selectedItem=null,this.templateInfos=null,this.view=null}initialize(){this._get("groupBy")||(this.groupBy="layer"),this.addHandles([r((()=>[this.templateInfos,this.layers]),(([t],e)=>{t&&t===e?.at(0)||(this._updateTask=l(this._updateTask),t?this._updateAllItems(t):this._getTemplatesAndUpdateAllItems())}),a),r((()=>this._groupByFunction),(()=>{null==this.templateInfos&&(this._updateTask=l(this._updateTask),this._getTemplatesAndUpdateAllItems())}),n),r((()=>this.filterFunction),(t=>{for(const e of this._allItems)h(e)&&(e.filterFunction=t)}),n)])}set groupBy(t){if(this._set("groupBy",t),"function"!=typeof t)switch(t){case"layer":this._groupByFunction=j;break;case"geometry":this._groupByFunction=B;break;default:this._groupByFunction=null}else this._groupByFunction=e=>this._ensureGroupByObject(t(e))}get layers(){return this._get("layers")}set layers(t){const e="layers";if(this.removeHandles(e),t){const s=()=>this.notifyChange("state");this.addHandles(t.map((t=>i((()=>t.loadStatus),s))),e)}this._set("layers",t)}get state(){return this.updating?"loading":0===this.layers.length?"disabled":"ready"}get numberOfFeatureTemplates(){return this._allItems.reduce(((t,e)=>h(e)?t+e.items.length:t+1),0)}get items(){const{filterFunction:t}=this;return null==t?this._allItems:this._allItems.filter((e=>h(e)?e.items.length>0:t(e)))}get updating(){return this._updatingHandles.updating}refresh(){this.notifyChange("filterFunction");for(const t of this._allItems)h(t)&&t.reapplyFilter()}select(t,{emit:e=!0}={}){const s=this.selectedItem,l=t?.clone()||null;this._set("selectedItem",l),e&&this.emit("select",{item:l,oldItem:s,template:l?.template??null})}_createItem(t,e){return new v({disabledFunction:this.disabledItemFunction,layer:e,template:t})}_ensureGroupByObject(t){return"string"==typeof t?{key:t,label:t}:t}_updateAllItems(t){const e=this._allItems;if(0===t.length)return k(e),void(this._allItems=[]);const[s,l]=f(e),o=t=>{const e=s.get(t.template);return e?(s.delete(t.template),e):this._createItem(t.template,t.layer)},{filterFunction:r}=this,i=t.map((t=>g(t)?new T({filterFunction:r,label:t.label,allItems:t.templateInfos.map((t=>o(t)))}):o(t)));for(const a of[...s.values(),...l])a.destroy();this._allItems=i}async _getTemplatesFromLayers(t){const e=[],s={signal:t};await Promise.all(this.layers.map((async l=>{await _(l,s),o(t);const r=c(l)?.operations;r?.supportsEditing&&r?.supportsAdd&&(y(l)?e.push(...l.sublayers):e.push(l))})));const l=await d(e,this.view,t);o(t);const r=I(l),i=this._groupByFunction;if(null==i)return r;const a=F(r,i);return 1===a.length&&a[0].label===b.label?a[0].templateInfos:a}async _getTemplatesAndUpdateAllItems(){if(0===this.layers.length)return;const t=e((async t=>{const e=await this._getTemplatesFromLayers(t);o(t),this._updateAllItems(e)}));this._updateTask=t,this._updatingHandles.addPromise(t.promise)}};function k(t){for(const e of t){if(h(e))for(const t of e.items)t.destroy();e.destroy()}}t([p()],w.prototype,"_allItems",void 0),t([p()],w.prototype,"_groupByFunction",void 0),t([p()],w.prototype,"_updatingHandles",void 0),t([p()],w.prototype,"disabled",void 0),t([p()],w.prototype,"disabledItemFunction",void 0),t([p({value:null})],w.prototype,"filterFunction",void 0),t([p()],w.prototype,"groupBy",null),t([p({value:[]})],w.prototype,"layers",null),t([p()],w.prototype,"state",null),t([p({readOnly:!0})],w.prototype,"numberOfFeatureTemplates",null),t([p({readOnly:!0})],w.prototype,"items",null),t([p({readOnly:!0})],w.prototype,"selectedItem",void 0),t([p()],w.prototype,"templateInfos",void 0),t([p()],w.prototype,"updating",null),t([p()],w.prototype,"view",void 0),w=t([u("esri.widgets.FeatureTemplates.FeatureTemplatesViewModel")],w);const A=w;export{A as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import s from"../../core/Evented.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as r,when as i,syncAndInitial as a,sync as n}from"../../core/reactiveUtils.js";import{property as p}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{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as d}from"../../editing/templateUtils.js";import{getEffectiveLayerCapabilities as c,isSubtypeGroupLayer as y}from"../../layers/support/layerUtils.js";import{isTemplateItemGroup as h,mapItemsByTemplate as f,isTemplateGroupInfo as g,loadLayerWithTemplates as _,makeTemplateItemInfos as I,makeGroupItemInfos as F,nullGroupBy as b}from"./featureTemplatesUtils.js";import v from"./TemplateItem.js";import T from"./TemplateItemGroup.js";const j=({layer:t})=>({key:t,label:t.title??""}),B=({layer:t})=>({key:t.geometryType,label:t.geometryType??""});let w=class extends s.EventedAccessor{constructor(t){super(t),this._allItems=[],this._updatingHandles=new m,this._updateTask=null,this.disabled=!1,this.disabledItemFunction=null,this.filterFunction=null,this.selectedItem=null,this.templateInfos=null,this.view=null}initialize(){this._get("groupBy")||(this.groupBy="layer"),this.addHandles([r((()=>[this.templateInfos,this.layers]),(([t],e)=>{t&&t===e?.at(0)||(this._updateTask=l(this._updateTask),t?this._updateAllItems(t):this._getTemplatesAndUpdateAllItems())}),a),r((()=>this._groupByFunction),(()=>{null==this.templateInfos&&(this._updateTask=l(this._updateTask),this._getTemplatesAndUpdateAllItems())}),n),r((()=>this.filterFunction),(t=>{for(const e of this._allItems)h(e)&&(e.filterFunction=t)}),n)])}set groupBy(t){if(this._set("groupBy",t),"function"!=typeof t)switch(t){case"layer":this._groupByFunction=j;break;case"geometry":this._groupByFunction=B;break;default:this._groupByFunction=null}else this._groupByFunction=e=>this._ensureGroupByObject(t(e))}get layers(){return this._get("layers")}set layers(t){const e="layers";if(this.removeHandles(e),t){const s=()=>this.notifyChange("state");this.addHandles(t.map((t=>i((()=>t.loadStatus),s))),e)}this._set("layers",t)}get state(){return this.updating?"loading":0===this.layers.length?"disabled":"ready"}get numberOfFeatureTemplates(){return this._allItems.reduce(((t,e)=>h(e)?t+e.allItems.length:t+1),0)}get items(){const{filterFunction:t}=this;return null==t?this._allItems:this._allItems.filter((e=>h(e)?e.items.length>0:t(e)))}get updating(){return this._updatingHandles.updating}refresh(){this.notifyChange("filterFunction");for(const t of this._allItems)h(t)&&t.reapplyFilter()}select(t,{emit:e=!0}={}){const s=this.selectedItem,l=t?.clone()||null;this._set("selectedItem",l),e&&this.emit("select",{item:l,oldItem:s,template:l?.template??null})}_createItem(t,e){return new v({disabledFunction:this.disabledItemFunction,layer:e,template:t})}_ensureGroupByObject(t){return"string"==typeof t?{key:t,label:t}:t}_updateAllItems(t){const e=this._allItems;if(0===t.length)return k(e),void(this._allItems=[]);const[s,l]=f(e),o=t=>{const e=s.get(t.template);return e?(s.delete(t.template),e):this._createItem(t.template,t.layer)},{filterFunction:r}=this,i=t.map((t=>g(t)?new T({filterFunction:r,label:t.label,allItems:t.templateInfos.map((t=>o(t)))}):o(t)));for(const a of[...s.values(),...l])a.destroy();this._allItems=i}async _getTemplatesFromLayers(t){const e=[],s={signal:t};await Promise.all(this.layers.map((async l=>{await _(l,s),o(t);const r=c(l)?.operations;r?.supportsEditing&&r?.supportsAdd&&(y(l)?e.push(...l.sublayers):e.push(l))})));const l=await d(e,this.view,t);o(t);const r=I(l),i=this._groupByFunction;if(null==i)return r;const a=F(r,i);return 1===a.length&&a[0].label===b.label?a[0].templateInfos:a}async _getTemplatesAndUpdateAllItems(){if(0===this.layers.length)return;const t=e((async t=>{const e=await this._getTemplatesFromLayers(t);o(t),this._updateAllItems(e)}));this._updateTask=t,this._updatingHandles.addPromise(t.promise)}};function k(t){for(const e of t){if(h(e))for(const t of e.items)t.destroy();e.destroy()}}t([p()],w.prototype,"_allItems",void 0),t([p()],w.prototype,"_groupByFunction",void 0),t([p()],w.prototype,"_updatingHandles",void 0),t([p()],w.prototype,"disabled",void 0),t([p()],w.prototype,"disabledItemFunction",void 0),t([p({value:null})],w.prototype,"filterFunction",void 0),t([p()],w.prototype,"groupBy",null),t([p({value:[]})],w.prototype,"layers",null),t([p()],w.prototype,"state",null),t([p({readOnly:!0})],w.prototype,"numberOfFeatureTemplates",null),t([p({readOnly:!0})],w.prototype,"items",null),t([p({readOnly:!0})],w.prototype,"selectedItem",void 0),t([p()],w.prototype,"templateInfos",void 0),t([p()],w.prototype,"updating",null),t([p()],w.prototype,"view",void 0),w=t([u("esri.widgets.FeatureTemplates.FeatureTemplatesViewModel")],w);const A=w;export{A as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{property as t}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"./Widget.js";import r from"./Fullscreen/FullscreenViewModel.js";import{loadCalciteComponents as i}from"./support/componentsUtils.js";import{globalCss as l}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{tsx as p}from"./support/jsxFactory.js";const c={base:"esri-fullscreen"};let a=class extends o{constructor(e,t){super(e,t),this.messages=null,this.viewModel=new r,this._toggle=()=>{this.viewModel.toggle()}}loadDependencies(){return i({button:()=>import("@esri/calcite-components/dist/components/calcite-button")})}get element(){return this.viewModel.element}set element(e){this.viewModel.element=e}get fullscreenTitle(){const e=this.viewModel?.state;return"active"===e?this.messages.exit:"ready"===e?this.messages.enter:""}get icon(){const e=this.viewModel?.state;return"ready"===e||"disabled"===e||"feature-unsupported"===e?"zoom-out-fixed":"zoom-in-fixed"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{fullscreenTitle:e,icon:t}=this,s=this.viewModel?.state,o="feature-unsupported"===s;return p("div",{class:this.classes(c.base,l.widget)},!o&&p("calcite-button",{class:l.widgetButton,disabled:"disabled"===s,iconStart:t,kind:"neutral",label:e,onclick:this._toggle,title:e}))}};e([t()],a.prototype,"element",null),e([t({readOnly:!0})],a.prototype,"fullscreenTitle",null),e([t()],a.prototype,"icon",null),e([t()],a.prototype,"label",null),e([t(),n("esri/widgets/Fullscreen/t9n/Fullscreen")],a.prototype,"messages",void 0),e([t()],a.prototype,"view",null),e([t({type:r})],a.prototype,"viewModel",void 0),a=e([s("esri.widgets.Fullscreen")],a);const d=a;export{d as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import l from"./Fullscreen/FullscreenViewModel.js";import{loadCalciteComponents as n}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import{tsx as a}from"./support/jsxFactory.js";const d={base:"esri-fullscreen"};let u=class extends i{constructor(e,o){super(e,o),this.messages=null,this.viewModel=new l,this._toggle=()=>{this.viewModel.toggle()},t(s.getLogger(this),"Fullscreen","arcgis-fullscreen",{version:"4.32"})}loadDependencies(){return n({button:()=>import("@esri/calcite-components/dist/components/calcite-button")})}get element(){return this.viewModel.element}set element(e){this.viewModel.element=e}get fullscreenTitle(){const e=this.viewModel?.state;return"active"===e?this.messages.exit:"ready"===e?this.messages.enter:""}get icon(){const e=this.viewModel?.state;return"ready"===e||"disabled"===e||"feature-unsupported"===e?"zoom-out-fixed":"zoom-in-fixed"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{fullscreenTitle:e,icon:t}=this,s=this.viewModel?.state,o="feature-unsupported"===s;return a("div",{class:this.classes(d.base,c.widget)},!o&&a("calcite-button",{class:c.widgetButton,disabled:"disabled"===s,iconStart:t,kind:"neutral",label:e,onclick:this._toggle,title:e}))}};e([o()],u.prototype,"element",null),e([o({readOnly:!0})],u.prototype,"fullscreenTitle",null),e([o()],u.prototype,"icon",null),e([o()],u.prototype,"label",null),e([o(),p("esri/widgets/Fullscreen/t9n/Fullscreen")],u.prototype,"messages",void 0),e([o()],u.prototype,"view",null),e([o({type:l})],u.prototype,"viewModel",void 0),u=e([r("esri.widgets.Fullscreen")],u);const m=u;export{m as default};
package/widgets/Home.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import o from"../Viewpoint.js";import{property as t}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 i from"./Widget.js";import r from"./Home/HomeViewModel.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{globalCss as n}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import{vmEvent as m}from"./support/decorators/vmEvent.js";import{tsx as c}from"./support/jsxFactory.js";const a={base:"esri-home"};let d=class extends i{constructor(e,o){super(e,o),this.messages=null,this.messagesCommon=null,this.uiStrings=void 0,this.viewModel=new r,this._go=()=>{const{viewModel:e}=this;"going-home"===e.state?e.cancelGo():e.go()}}loadDependencies(){return l({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"home"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewpoint(){return this.viewModel.viewpoint}set viewpoint(e){this.viewModel.viewpoint=e}cancelGo(){this.viewModel.cancelGo()}go(){return this.viewModel.go()}render(){const{messagesCommon:e,messages:o,icon:t}=this,s=this.viewModel?.state,i="going-home"===s;return c("div",{class:this.classes(a.base,n.widget)},c("calcite-button",{class:n.widgetButton,disabled:"disabled"===s,iconStart:i?void 0:t,kind:"neutral",label:o.widgetLabel,onclick:this._go,scale:i?"s":"m",title:"going-home"===s?e.cancel:o.title},i?c("calcite-loader",{inline:!0,label:""}):null))}};e([t()],d.prototype,"goToOverride",null),e([t()],d.prototype,"icon",null),e([t()],d.prototype,"label",null),e([t(),p("esri/widgets/Home/t9n/Home")],d.prototype,"messages",void 0),e([t(),p("esri/t9n/common")],d.prototype,"messagesCommon",void 0),e([t()],d.prototype,"uiStrings",void 0),e([t()],d.prototype,"view",null),e([t({type:r}),m("go")],d.prototype,"viewModel",void 0),e([t({type:o})],d.prototype,"viewpoint",null),d=e([s("esri.widgets.Home")],d);const g=d;export{g as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import o from"../Viewpoint.js";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import l from"./Widget.js";import n from"./Home/HomeViewModel.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as c}from"./support/decorators/messageBundle.js";import{vmEvent as a}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";const g={base:"esri-home"};let v=class extends l{constructor(e,o){super(e,o),this.messages=null,this.messagesCommon=null,this.uiStrings=void 0,this.viewModel=new n,this._go=()=>{const{viewModel:e}=this;"going-home"===e.state?e.cancelGo():e.go()},t(s.getLogger(this),"Home","arcgis-home",{version:"4.32"})}loadDependencies(){return p({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"home"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewpoint(){return this.viewModel.viewpoint}set viewpoint(e){this.viewModel.viewpoint=e}cancelGo(){this.viewModel.cancelGo()}go(){return this.viewModel.go()}render(){const{messagesCommon:e,messages:o,icon:t}=this,s=this.viewModel?.state,i="going-home"===s;return d("div",{class:this.classes(g.base,m.widget)},d("calcite-button",{class:m.widgetButton,disabled:"disabled"===s,iconStart:i?void 0:t,kind:"neutral",label:o.widgetLabel,onclick:this._go,scale:i?"s":"m",title:"going-home"===s?e.cancel:o.title},i?d("calcite-loader",{inline:!0,label:""}):null))}};e([i()],v.prototype,"goToOverride",null),e([i()],v.prototype,"icon",null),e([i()],v.prototype,"label",null),e([i(),c("esri/widgets/Home/t9n/Home")],v.prototype,"messages",void 0),e([i(),c("esri/t9n/common")],v.prototype,"messagesCommon",void 0),e([i()],v.prototype,"uiStrings",void 0),e([i()],v.prototype,"view",null),e([i({type:n}),a("go")],v.prototype,"viewModel",void 0),e([i({type:o})],v.prototype,"viewpoint",null),v=e([r("esri.widgets.Home")],v);const u=v;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as n,isCatalogSublayer as o}from"../../layers/catalog/catalogUtils.js";import{getActionIcon as s,getActionStyles as a}from"../../support/actions/actionUtils.js";import l from"../Widget.js";import{getStatusIcon as r,listItemHasChildren as c,areChildrenHidden as d,canSortSublayers as p,getSingleAction as m,getItem as u,getVisibilityIcon as g}from"./support/layerListUtils.js";import{loadCalciteComponents as y}from"../support/componentsUtils.js";import{tsx as h}from"../support/jsxFactory.js";import{setFocus as b}from"../support/widgetUtils.js";var v;let _=class extends l{static{v=this}constructor(e){super(e),this.dragEnabled=!1,this.listModeDisabled=!1,this.parent=null,this.parentTitles=null,this.viewModel=null,this._onActionMenuOpen=e=>{this.item.actionsOpen=e.currentTarget.open},this._setTooltipReference=e=>{this.onTooltipReferenceChange?.(this.item.layer?.uid,e)},this._removeTooltipReference=()=>{this.onTooltipReferenceChange?.(this.item.layer?.uid,null)}}loadDependencies(){return y({"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}static{this.vnodeSelector="calcite-list-item"}render(){const e=this.parentTitles??[],{_title:t,item:i,activeItem:n,selectionMode:o,selectedItems:s,messages:a,parent:l,css:r}=this,c="visibleAtCurrentTimeExtent"in i&&"layerInvisibleAtTime"in a&&!i.visibleAtCurrentTimeExtent?`${t} (${a.layerInvisibleAtTime})`:"visibleAtCurrentScale"in i&&"layerInvisibleAtScale"in a&&!i.visibleAtCurrentScale?`${t} (${a.layerInvisibleAtScale})`:t,d="parent"in i&&"catalog"===i.parent?.layer?.type,{layer:p}=i,m="visibleAtCurrentScale"in i&&!i.visibleAtCurrentScale||"visibleAtCurrentTimeExtent"in i&&!i.visibleAtCurrentTimeExtent;return h("calcite-list-item",{afterCreate:e=>this._focusSelectedDragEl(e,i),afterUpdate:e=>this._focusSelectedDragEl(e,i),class:this.classes(r.item,"itemActive"in r&&{[r.itemActive]:n===i}),"data-item":i,"data-layer-id":p?.id,dragDisabled:!i.sortable||d,id:p?.uid,key:`list-item-${p?.uid}`,label:t,metadata:{parentTitles:e,_title:t},open:"open"in i&&i.open,selected:"none"!==o&&s.includes(i),title:c,unavailable:m,value:p?.uid,onCalciteListItemSelect:e=>"visible"in i&&this._handleCalciteListItemSelect(e,i,l),onCalciteListItemToggle:e=>"open"in i&&this._handleCalciteListItemToggle(e,i)},this._renderedCatalogFootprintIcon,this._renderedCatalogDynamicIcon,this._renderedItemStatus,this._renderedItemToggle,this._renderedCatalogSelectNode,this._renderedItemTemporaryIcon,this._renderedChildList,this._renderedItemMessage,this._renderedPanel,this._renderedPanelAction,this._renderedActions)}get _title(){const{messages:e}=this;return this.item.title||("untitledTable"in e?e.untitledTable:e.untitledLayer)}get _renderedItemStatus(){const{item:e,parent:t,visibleElements:i,css:n}=this;if(!i.statusIndicators)return null;const{publishing:o}=e,s="updating"in e&&e.updating&&!t,a="connectionStatus"in e?e.connectionStatus:void 0,l=!!a;return h("calcite-icon",{class:this.classes(n.statusIndicator,{[n.publishing]:o},"updating"in n&&{[n.updating]:s},"connectionStatus"in n&&{[n.connectionStatus]:l},"connectionStatusConnected"in n&&{[n.connectionStatusConnected]:l&&"connected"===a}),icon:r({connectionStatus:a,publishing:o}),key:"layer-item-status",scale:"s",slot:"content-end"})}get _renderedItemTemporaryIcon(){const{item:e,visibleElements:t,css:i}=this,{layer:o}=e,s="temporaryLayerIndicators"in t&&t.temporaryLayerIndicators,a="temporaryTableIndicators"in t&&t.temporaryTableIndicators,l=o&&"persistenceEnabled"in o&&(n(o)||!o.persistenceEnabled);return(s||a)&&l?h("calcite-icon",{class:i.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"content-start",title:this.messages.temporary}):null}get _renderedItemToggle(){const{item:e,parent:t,messages:i,visibilityAppearance:n,css:o}=this;if(!("visible"in e&&"layerVisibility"in i&&"visibleToggle"in o&&n))return null;const{visible:s}=e,a=t?.visibilityMode;if("inherited"===a)return null;const l=g({visible:s,exclusive:"exclusive"===a,visibilityAppearance:n}),r="checkbox"===n,c=i.layerVisibility;return h("calcite-action",{appearance:"transparent",class:o.visibleToggle,icon:r?l:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:c,title:c},r?null:h("calcite-icon",{class:this.classes({[o.visibleIcon]:"exclusive"!==a&&s}),icon:l,scale:"s"}))}get _renderedPanel(){const{panel:e}=this.item;return!e?.open||e.disabled||e.flowEnabled?null:h("div",{class:this.css.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}get _renderedPanelAction(){const{panel:e}=this.item;if(!e?.visible)return null;const{open:t,title:i,disabled:n}=e;return h("calcite-action",{active:t,appearance:"transparent",disabled:n,icon:s(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}get _renderedActions(){switch(this._actionsCount){case 0:return null;case 1:return this._singleAction;default:return this._renderedActionMenu}}get _renderedActionMenu(){const{item:e,messagesCommon:t}=this,i=t.options;return h("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:t.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:this._onActionMenuOpen},h("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),this._renderedActionMenuContent)}get _renderedActionMenuContent(){return this._filteredSections.toArray().map((e=>h("calcite-action-group",{key:`action-section-${e.uid}`},e.toArray().map((e=>this._renderAction({action:e,textEnabled:!0}))))))}get _renderedCatalogFootprintIcon(){const{css:e}=this,t=this.item.layer,i="catalog-footprint"===t?.type,n="sublayer"===t?.type&&o(t,"footprints");return"itemCatalogIcon"in e&&(i||n)?h("calcite-icon",{class:e.itemCatalogIcon,icon:"footprint",key:"footprint",scale:"s",slot:"content-start"}):null}get _renderedCatalogDynamicIcon(){const{css:e}=this,t=this.item.layer,i="catalog-dynamic-group"===t?.type,n="sublayer"===t?.type&&o(t,"layers-in-view");return"itemCatalogIcon"in e&&(i||n)?h("calcite-icon",{class:e.itemCatalogIcon,icon:"catalog-dataset",key:"catalog-dataset",scale:"s",slot:"content-start"}):null}get _renderedCatalogSelectNode(){const{_title:e,item:t,visibleElements:i}=this;if(!("visible"in t))return;const{layer:n}=t,o="catalog-dynamic-group"===n?.type;return"catalogLayerList"in i&&i.catalogLayerList&&o?h("calcite-action",{appearance:"transparent",disabled:!n.visible,icon:"chevron-right",iconFlipRtl:!0,onclick:()=>this._triggerOnCatalogOpen(t),scale:"s",slot:"actions-end",text:e}):null}get _renderedChildList(){const{dragEnabled:e,item:t,rootGroupUid:i,listModeDisabled:n,selectionMode:o,displayMode:s}=this;if(!("visible"in t))return;const a=[...this.parentTitles??[],t.title],{children:l,layer:r}=t,m="catalog-dynamic-group"!==r?.type&&c(t),u=!n&&d(r),g="group"===r?.type;return m||!u&&!m&&e&&g?h("calcite-list",{canPull:e=>!!this.canMove&&this.canMove(e,"pull"),canPut:e=>!!this.canMove&&this.canMove(e,"put"),"data-item":t,"data-layer-type":i,displayMode:s,dragEnabled:!!e&&(t.childrenSortable&&p(t)),group:g?i:`${i}-${r?.uid}`,key:`child-list-${r?.uid}`,label:t.title,selectionAppearance:"border",selectionMode:o},l?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error))).toArray().map((e=>this._renderItem(e,t,a))),this._renderedTablesItem):null}get _hasTables(){const{layerTablesEnabled:e}=this,t=this.item.layer;if(!e||!t)return!1;switch(t.type){case"knowledge-graph":return e.includes(t.type)&&!!t.tables?.length;case"map-image":case"tile":return e.includes(t.type)&&!!t.subtables?.length;default:return!1}}get _renderedTablesItem(){const{item:e,messages:t,css:i}=this,{layer:n}=e;return"itemTableIcon"in i&&"visible"in e&&"tables"in t&&this._hasTables?h("calcite-list-item",{class:i.item,"data-layer-id":n?.id,dragDisabled:!0,key:`list-item-table-list-tables-${n?.uid}`,label:t.tables,title:t.tables,onCalciteListItemSelect:()=>this._triggerOnTablesOpen(e)},h("calcite-icon",{class:i.itemTableIcon,icon:"table",scale:"s",slot:"content-start"}),h("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"})):null}get _renderedItemMessage(){const{item:e,messages:t,css:i}=this;return e.error?h("div",{class:i.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},h("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},h("div",{slot:"message"},"tableError"in t?t.tableError:t.layerError))):"incompatible"in e&&e.incompatible&&"layerIncompatible"in t?h("div",{class:i.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},h("calcite-notice",{afterCreate:this._setTooltipReference,afterRemoved:this._removeTooltipReference,bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},h("div",{slot:"message"},t.layerIncompatible))):null}get _singleAction(){return this._renderAction({action:m(this._filteredSections),textEnabled:!1})}get _filteredSections(){return this.item.actionsSections.map((e=>e.filter((e=>e.visible))))}get _actionsCount(){return this.item.actionsSections.reduce(((e,t)=>e+t.length),0)}_renderAction(e){const{item:t}=this,{action:i,textEnabled:n}=e;if(!i)return null;const{active:o,disabled:a,title:l,type:r,indicator:c}=i;return h("calcite-action",{active:"toggle"===r&&i.value,appearance:"transparent","data-action-id":i.id,disabled:a,icon:s(i),indicator:c,key:`action-${i.uid}`,loading:o,onclick:()=>this._triggerAction(t,i),scale:"s",slot:n?void 0:"actions-end",text:l??"",textEnabled:n,title:l??void 0},this._renderFallbackIcon(i))}_renderFallbackIcon(e){const{css:t}=this,{className:i,icon:n}=e;if(n)return null;const o="image"in e?e.image:void 0,s={[t.itemActionIcon]:!!i,[t.itemActionImage]:!!o};return i&&(s[i]=!0),o||i?h("span",{"aria-hidden":"true",class:this.classes(t.itemActionIcon,s),key:"icon",styles:a(o)}):null}_renderItem(e,t,i=[]){return h(v,{activeItem:this.activeItem,canMove:this.canMove,css:this.css,displayMode:this.displayMode,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this.rootGroupUid,selectedDragItemLayerUid:this.selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this.onAction,onCatalogOpen:this.onCatalogOpen,onPanelOpen:this.onPanelOpen,onSelectedDragItemLayerUidChange:this.onSelectedDragItemLayerUidChange,onTablesOpen:this.onTablesOpen,onTooltipReferenceChange:this.onTooltipReferenceChange})}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.onAction(t,e))}_triggerOnTablesOpen(e){e&&this.onTablesOpen&&this.onTablesOpen(e)}_triggerOnCatalogOpen(e){e&&this.onCatalogOpen?.(e)}_focusSelectedDragEl(e,t){this.selectedDragItemLayerUid===t.layer?.uid&&(b(e),this.onSelectedDragItemLayerUidChange?.(null))}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemSelect(e,t,i){u(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&this.onPanelOpen()}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};e([t()],_.prototype,"activeItem",void 0),e([t()],_.prototype,"canMove",void 0),e([t()],_.prototype,"css",void 0),e([t()],_.prototype,"displayMode",void 0),e([t()],_.prototype,"dragEnabled",void 0),e([t()],_.prototype,"item",void 0),e([t()],_.prototype,"layerTablesEnabled",void 0),e([t()],_.prototype,"listModeDisabled",void 0),e([t()],_.prototype,"messages",void 0),e([t()],_.prototype,"messagesCommon",void 0),e([t()],_.prototype,"onAction",void 0),e([t()],_.prototype,"onPanelOpen",void 0),e([t()],_.prototype,"onCatalogOpen",void 0),e([t()],_.prototype,"onTablesOpen",void 0),e([t()],_.prototype,"onSelectedDragItemLayerUidChange",void 0),e([t()],_.prototype,"onTooltipReferenceChange",void 0),e([t()],_.prototype,"parent",void 0),e([t()],_.prototype,"parentTitles",void 0),e([t()],_.prototype,"rootGroupUid",void 0),e([t()],_.prototype,"selectionMode",void 0),e([t()],_.prototype,"selectedItems",void 0),e([t()],_.prototype,"selectedDragItemLayerUid",void 0),e([t()],_.prototype,"visibleElements",void 0),e([t()],_.prototype,"visibilityAppearance",void 0),e([t()],_.prototype,"_title",null),e([t()],_.prototype,"_renderedItemStatus",null),e([t()],_.prototype,"_renderedItemTemporaryIcon",null),e([t()],_.prototype,"_renderedItemToggle",null),e([t()],_.prototype,"_renderedPanel",null),e([t()],_.prototype,"_renderedPanelAction",null),e([t()],_.prototype,"_renderedActions",null),e([t()],_.prototype,"_renderedActionMenu",null),e([t()],_.prototype,"_renderedActionMenuContent",null),e([t()],_.prototype,"_renderedCatalogFootprintIcon",null),e([t()],_.prototype,"_renderedCatalogDynamicIcon",null),e([t()],_.prototype,"_renderedCatalogSelectNode",null),e([t()],_.prototype,"_renderedChildList",null),e([t()],_.prototype,"_hasTables",null),e([t()],_.prototype,"_renderedTablesItem",null),e([t()],_.prototype,"_renderedItemMessage",null),e([t()],_.prototype,"_singleAction",null),e([t()],_.prototype,"_filteredSections",null),e([t()],_.prototype,"_actionsCount",null),_=v=e([i("esri.widgets.LayerList.LayerListItem")],_);const I=_;export{I as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as n,isCatalogSublayer as o}from"../../layers/catalog/catalogUtils.js";import{getActionIcon as s,getActionStyles as l}from"../../support/actions/actionUtils.js";import a from"../Widget.js";import{getStatusIcon as r,listItemHasChildren as c,areChildrenHidden as d,canSortSublayers as p,getSingleAction as m,getItem as u,getVisibilityIcon as g}from"./support/layerListUtils.js";import{loadCalciteComponents as y}from"../support/componentsUtils.js";import{tsx as h}from"../support/jsxFactory.js";import{setFocus as b}from"../support/widgetUtils.js";var v;let _=class extends a{static{v=this}constructor(e){super(e),this.dragEnabled=!1,this.listModeDisabled=!1,this.parent=null,this.parentTitles=null,this.viewModel=null,this._onActionMenuOpen=e=>{this.item.actionsOpen=e.currentTarget.open},this._setTooltipReference=e=>{this.onTooltipReferenceChange?.(this.item.layer?.uid,e)},this._removeTooltipReference=()=>{this.onTooltipReferenceChange?.(this.item.layer?.uid,null)}}loadDependencies(){return y({"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}static{this.vnodeSelector="calcite-list-item"}render(){const e=this.parentTitles??[],{_title:t,item:i,activeItem:n,selectionMode:o,selectedItems:s,messages:l,parent:a,css:r}=this,c="visibleAtCurrentTimeExtent"in i&&"layerInvisibleAtTime"in l&&!i.visibleAtCurrentTimeExtent?`${t} (${l.layerInvisibleAtTime})`:"visibleAtCurrentScale"in i&&"layerInvisibleAtScale"in l&&!i.visibleAtCurrentScale?`${t} (${l.layerInvisibleAtScale})`:t,d="parent"in i&&"catalog"===i.parent?.layer?.type,{layer:p}=i,m="visibleAtCurrentScale"in i&&!i.visibleAtCurrentScale||"visibleAtCurrentTimeExtent"in i&&!i.visibleAtCurrentTimeExtent;return h("calcite-list-item",{afterCreate:e=>this._focusSelectedDragEl(e,i),afterUpdate:e=>this._focusSelectedDragEl(e,i),class:this.classes(r.item,"itemActive"in r&&{[r.itemActive]:n===i}),"data-item":i,"data-layer-id":p?.id,dragDisabled:!i.sortable||d,id:p?.uid,key:`list-item-${p?.uid}`,label:t,metadata:{parentTitles:e,_title:t},open:"open"in i&&i.open,selected:"none"!==o&&s.includes(i),title:c,unavailable:m,value:p?.uid,onCalciteListItemSelect:e=>"visible"in i&&this._handleCalciteListItemSelect(e,i,a),onCalciteListItemToggle:e=>"open"in i&&this._handleCalciteListItemToggle(e,i)},this._renderedCatalogFootprintIcon,this._renderedCatalogDynamicIcon,this._renderedItemStatus,this._renderedItemToggle,this._renderedCatalogSelectNode,this._renderedItemTemporaryIcon,this._renderedChildList,this._renderedItemMessage,this._renderedPanel,this._renderedPanelAction,this._renderedActions)}get _title(){const{messages:e}=this;return this.item.title||("untitledTable"in e?e.untitledTable:e.untitledLayer)}get _renderedItemStatus(){const{item:e,parent:t,visibleElements:i,css:n}=this;if(!i.statusIndicators)return null;const{publishing:o}=e,s="updating"in e&&e.updating&&!t,l="connectionStatus"in e?e.connectionStatus:void 0,a=!!l;return h("calcite-icon",{class:this.classes(n.statusIndicator,{[n.publishing]:o},"updating"in n&&{[n.updating]:s},"connectionStatus"in n&&{[n.connectionStatus]:a},"connectionStatusConnected"in n&&{[n.connectionStatusConnected]:a&&"connected"===l}),icon:r({connectionStatus:l,publishing:o}),key:"layer-item-status",scale:"s",slot:"content-end"})}get _renderedItemTemporaryIcon(){const{item:e,visibleElements:t,css:i}=this,{layer:o}=e,s="temporaryLayerIndicators"in t&&t.temporaryLayerIndicators,l="temporaryTableIndicators"in t&&t.temporaryTableIndicators,a=o&&"persistenceEnabled"in o&&(n(o)||!o.persistenceEnabled);return(s||l)&&a?h("calcite-icon",{class:i.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"content-start",title:this.messages.temporary}):null}get _renderedItemToggle(){const{item:e,parent:t,messages:i,visibilityAppearance:n,css:o}=this;if(!("visible"in e&&"layerVisibility"in i&&"visibleToggle"in o&&n))return null;const{visible:s}=e,l=this._getParentVisibilityMode(t);if("inherited"===l)return null;const a=g({visible:s,exclusive:"exclusive"===l,visibilityAppearance:n}),r="checkbox"===n,c=i.layerVisibility;return h("calcite-action",{appearance:"transparent",class:o.visibleToggle,icon:r?a:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:c,title:c},r?null:h("calcite-icon",{class:this.classes({[o.visibleIcon]:"exclusive"!==l&&s}),icon:a,scale:"s"}))}get _renderedPanel(){const{panel:e}=this.item;return!e?.open||e.disabled||e.flowEnabled?null:h("div",{class:this.css.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}get _renderedPanelAction(){const{panel:e}=this.item;if(!e?.visible)return null;const{open:t,title:i,disabled:n}=e;return h("calcite-action",{active:t,appearance:"transparent",disabled:n,icon:s(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}get _renderedActions(){switch(this._actionsCount){case 0:return null;case 1:return this._singleAction;default:return this._renderedActionMenu}}get _renderedActionMenu(){const{item:e,messagesCommon:t}=this,i=t.options;return h("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:t.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:this._onActionMenuOpen},h("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),this._renderedActionMenuContent)}get _renderedActionMenuContent(){return this._filteredSections.toArray().map((e=>h("calcite-action-group",{key:`action-section-${e.uid}`},e.toArray().map((e=>this._renderAction({action:e,textEnabled:!0}))))))}get _renderedCatalogFootprintIcon(){const{css:e}=this,t=this.item.layer,i="catalog-footprint"===t?.type,n="sublayer"===t?.type&&o(t,"footprints");return"itemCatalogIcon"in e&&(i||n)?h("calcite-icon",{class:e.itemCatalogIcon,icon:"footprint",key:"footprint",scale:"s",slot:"content-start"}):null}get _renderedCatalogDynamicIcon(){const{css:e}=this,t=this.item.layer,i="catalog-dynamic-group"===t?.type,n="sublayer"===t?.type&&o(t,"layers-in-view");return"itemCatalogIcon"in e&&(i||n)?h("calcite-icon",{class:e.itemCatalogIcon,icon:"catalog-dataset",key:"catalog-dataset",scale:"s",slot:"content-start"}):null}get _renderedCatalogSelectNode(){const{_title:e,item:t,visibleElements:i}=this;if(!("visible"in t))return;const{layer:n}=t,o="catalog-dynamic-group"===n?.type;return"catalogLayerList"in i&&i.catalogLayerList&&o?h("calcite-action",{appearance:"transparent",disabled:!n.visible,icon:"chevron-right",iconFlipRtl:!0,onclick:()=>this._triggerOnCatalogOpen(t),scale:"s",slot:"actions-end",text:e}):null}get _renderedChildList(){const{dragEnabled:e,item:t,rootGroupUid:i,listModeDisabled:n,selectionMode:o,displayMode:s}=this;if(!("children"in t))return;const l=[...this.parentTitles??[],t.title],{children:a,layer:r}=t,m="catalog-dynamic-group"!==r?.type&&c(t),u=!n&&d(r),g="group"===r?.type,y=!u&&!m&&e&&g,b=!!e&&("childrenSortable"in t&&t.childrenSortable&&p(t));return m||y?h("calcite-list",{canPull:e=>!!this.canMove&&this.canMove(e,"pull"),canPut:e=>!!this.canMove&&this.canMove(e,"put"),"data-item":t,"data-layer-type":i,displayMode:s,dragEnabled:b,group:g?i:`${i}-${r?.uid}`,key:`child-list-${r?.uid}`,label:t.title,selectionAppearance:"border",selectionMode:o},a?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error))).toArray().map((e=>this._renderItem(e,t,l))),this._renderedTablesItem):null}get _hasTables(){const{layerTablesEnabled:e}=this,t=this.item.layer;if(!e||!t)return!1;switch(t.type){case"knowledge-graph":return e.includes(t.type)&&"tables"in t&&!!t.tables?.length;case"map-image":case"tile":return e.includes(t.type)&&"subtables"in t&&!!t.subtables?.length;default:return!1}}get _renderedTablesItem(){const{item:e,messages:t,css:i}=this,{layer:n}=e;return"itemTableIcon"in i&&"visible"in e&&"tables"in t&&this._hasTables?h("calcite-list-item",{class:i.item,"data-layer-id":n?.id,dragDisabled:!0,key:`list-item-table-list-tables-${n?.uid}`,label:t.tables,title:t.tables,onCalciteListItemSelect:()=>this._triggerOnTablesOpen(e)},h("calcite-icon",{class:i.itemTableIcon,icon:"table",scale:"s",slot:"content-start"}),h("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"})):null}get _renderedItemMessage(){const{item:e,messages:t,css:i}=this;return e.error?h("div",{class:i.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},h("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},h("div",{slot:"message"},"tableError"in t?t.tableError:t.layerError))):"incompatible"in e&&e.incompatible&&"layerIncompatible"in t?h("div",{class:i.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},h("calcite-notice",{afterCreate:this._setTooltipReference,afterRemoved:this._removeTooltipReference,bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},h("div",{slot:"message"},t.layerIncompatible))):null}get _singleAction(){return this._renderAction({action:m(this._filteredSections),textEnabled:!1})}get _filteredSections(){return this.item.actionsSections.map((e=>e.filter((e=>e.visible))))}get _actionsCount(){return this.item.actionsSections.reduce(((e,t)=>e+t.length),0)}_renderAction(e){const{item:t}=this,{action:i,textEnabled:n}=e;if(!i)return null;const{active:o,disabled:l,title:a,type:r,indicator:c}=i;return h("calcite-action",{active:"toggle"===r&&i.value,appearance:"transparent","data-action-id":i.id,disabled:l,icon:s(i),indicator:c,key:`action-${i.uid}`,loading:o,onclick:()=>this._triggerAction(t,i),scale:"s",slot:n?void 0:"actions-end",text:a??"",textEnabled:n,title:a??void 0},this._renderFallbackIcon(i))}_renderFallbackIcon(e){const{css:t}=this,{className:i,icon:n}=e;if(n)return null;const o="image"in e?e.image:void 0,s={[t.itemActionIcon]:!!i,[t.itemActionImage]:!!o};return i&&(s[i]=!0),o||i?h("span",{"aria-hidden":"true",class:this.classes(t.itemActionIcon,s),key:"icon",styles:l(o)}):null}_renderItem(e,t,i=[]){return h(v,{activeItem:this.activeItem,canMove:this.canMove,css:this.css,displayMode:this.displayMode,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this.rootGroupUid,selectedDragItemLayerUid:this.selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this.onAction,onCatalogOpen:this.onCatalogOpen,onPanelOpen:this.onPanelOpen,onSelectedDragItemLayerUidChange:this.onSelectedDragItemLayerUidChange,onTablesOpen:this.onTablesOpen,onTooltipReferenceChange:this.onTooltipReferenceChange})}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.onAction(t,e))}_triggerOnTablesOpen(e){e&&this.onTablesOpen&&this.onTablesOpen(e)}_triggerOnCatalogOpen(e){e&&this.onCatalogOpen?.(e)}_focusSelectedDragEl(e,t){this.selectedDragItemLayerUid===t.layer?.uid&&(b(e),this.onSelectedDragItemLayerUidChange?.(null))}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_getParentVisibilityMode(e){return e&&"visibilityMode"in e?e.visibilityMode:null}_handleCalciteListItemSelect(e,t,i){if(u(e.target)!==t)return;const n=this._getParentVisibilityMode(i);"none"===this.selectionMode&&"inherited"!==n&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&this.onPanelOpen()}_toggleVisibility(e,t){if(!e||!("visible"in e))return;"exclusive"===this._getParentVisibilityMode(t)&&e.visible||(e.visible=!e.visible)}};e([t()],_.prototype,"activeItem",void 0),e([t()],_.prototype,"canMove",void 0),e([t()],_.prototype,"css",void 0),e([t()],_.prototype,"displayMode",void 0),e([t()],_.prototype,"dragEnabled",void 0),e([t()],_.prototype,"item",void 0),e([t()],_.prototype,"layerTablesEnabled",void 0),e([t()],_.prototype,"listModeDisabled",void 0),e([t()],_.prototype,"messages",void 0),e([t()],_.prototype,"messagesCommon",void 0),e([t()],_.prototype,"onAction",void 0),e([t()],_.prototype,"onPanelOpen",void 0),e([t()],_.prototype,"onCatalogOpen",void 0),e([t()],_.prototype,"onTablesOpen",void 0),e([t()],_.prototype,"onSelectedDragItemLayerUidChange",void 0),e([t()],_.prototype,"onTooltipReferenceChange",void 0),e([t()],_.prototype,"parent",void 0),e([t()],_.prototype,"parentTitles",void 0),e([t()],_.prototype,"rootGroupUid",void 0),e([t()],_.prototype,"selectionMode",void 0),e([t()],_.prototype,"selectedItems",void 0),e([t()],_.prototype,"selectedDragItemLayerUid",void 0),e([t()],_.prototype,"visibleElements",void 0),e([t()],_.prototype,"visibilityAppearance",void 0),e([t()],_.prototype,"_title",null),e([t()],_.prototype,"_renderedItemStatus",null),e([t()],_.prototype,"_renderedItemTemporaryIcon",null),e([t()],_.prototype,"_renderedItemToggle",null),e([t()],_.prototype,"_renderedPanel",null),e([t()],_.prototype,"_renderedPanelAction",null),e([t()],_.prototype,"_renderedActions",null),e([t()],_.prototype,"_renderedActionMenu",null),e([t()],_.prototype,"_renderedActionMenuContent",null),e([t()],_.prototype,"_renderedCatalogFootprintIcon",null),e([t()],_.prototype,"_renderedCatalogDynamicIcon",null),e([t()],_.prototype,"_renderedCatalogSelectNode",null),e([t()],_.prototype,"_renderedChildList",null),e([t()],_.prototype,"_hasTables",null),e([t()],_.prototype,"_renderedTablesItem",null),e([t()],_.prototype,"_renderedItemMessage",null),e([t()],_.prototype,"_singleAction",null),e([t()],_.prototype,"_filteredSections",null),e([t()],_.prototype,"_actionsCount",null),_=v=e([i("esri.widgets.LayerList.LayerListItem")],_);const I=_;export{I as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import l from"../../core/Identifiable.js";import{watch as r,initial as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as a}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{get as d}from"../../core/accessorSupport/get.js";import p from"../../support/actions/ActionBase.js";import c from"../../support/actions/ActionButton.js";import u from"../../support/actions/ActionToggle.js";import y from"./ListItemPanel.js";import{isLayerOutsideScaleRange as b,findLayerVisibilityMode as m,findLayerListMode as v,canDisplayLayer as f,getNormalizedChildLayerProperty as C}from"./support/layerListUtils.js";var g;const w=s.ofType({key:"type",defaultKeyValue:"button",base:p,typeMap:{button:c,toggle:u}}),S=s.ofType(w),_="layer",M="child-list-mode",P="hide";let I=g=class extends(l.IdentifiableMixin(t)){constructor(e){super(e),this.actionsSections=new S,this.actionsOpen=!1,this.checkPublishStatusEnabled=!1,this.children=new(s.ofType(g)),this.childrenSortable=!0,this.hidden=!1,this.layer=null,this.listItemCreatedFunction=null,this.listModeDisabled=!1,this.open=!1,this.panel=null,this.parent=null,this.view=null}initialize(){if(this.addHandles([r((()=>[this.layer,this.layer?.listMode,this.listModeDisabled]),(()=>this._watchLayerProperties(this.layer)),o),r((()=>this.checkPublishStatusEnabled),(e=>this._updateChildrenPublishing(e)),o),r((()=>this.view),(e=>this._updateChildrenView(e)),o),r((()=>this.panel),(e=>this._setListItemOnPanel(e)),o)]),"function"==typeof this.listItemCreatedFunction){const e={item:this};this.listItemCreatedFunction.call(null,e)}}destroy(){this.panel?.destroy(),this.children.destroyAll(),this.view=null}get connectionStatus(){const{layerView:e,publishing:t}=this;if(!t&&e&&"connectionStatus"in e)return e.connectionStatus}get error(){return this.layer?.loadError}get incompatible(){const{layerView:e}=this;return!(!e||!("spatialReferenceSupported"in e))&&!e.spatialReferenceSupported}get layerView(){const{layer:e,view:t}=this;if(!e||!t||"sublayer"===e.type)return null;const i="subtype-sublayer"===e.type?e.parent:e;return t.allLayerViews.find((e=>e.layer===i))??null}castPanel(e){return this.panel?.open&&!e.hasOwnProperty("open")&&(e.open=!0),e?new y(e):null}get sortable(){return"knowledge-graph-sublayer"!==this.layer?.type&&this._get("sortable")}set sortable(e){this._set("sortable",e)}get title(){const e=d(this,"layer.layer");return(!e||e&&d(this,"layer.layer.loaded"))&&d(this,"layer.title")||d(this,"layer.attributes.title")||""}set title(e){this._override("title",e)}get publishing(){const{layer:e,checkPublishStatusEnabled:t}=this;return!!(t&&e&&"publishingInfo"in e&&"publishing"===e.publishingInfo?.status)}get updating(){const{layerView:e,connectionStatus:t,layer:i,publishing:s}=this;return!s&&!t&&(e?e.updating:"loading"===i?.loadStatus||!1)}get visible(){return!!this.layer?.visible}set visible(e){const t=this.layer;t&&(t.visible=e)}get visibleAtCurrentScale(){return this.layerView?.visibleAtCurrentScale??!b(this.layer,this.view?.scale)}get visibleAtCurrentTimeExtent(){return this.layerView?.visibleAtCurrentTimeExtent??!0}get visibilityMode(){return m(this.layer)}clone(){return new g({actionsSections:this.actionsSections.clone(),actionsOpen:this.actionsOpen,checkPublishStatusEnabled:this.checkPublishStatusEnabled,children:this.children.clone(),childrenSortable:this.childrenSortable,hidden:this.hidden,layer:this.layer,listItemCreatedFunction:this.listItemCreatedFunction,listModeDisabled:this.listModeDisabled,open:this.open,panel:this.panel,parent:this.parent,sortable:this.sortable,title:this.title,view:this.view,visible:this.visible})}_setListItemOnPanel(e){e&&(e.listItem=this)}_updateChildrenPublishing(e){const t=this.children;t&&t.forEach((t=>t.checkPublishStatusEnabled=e))}_updateChildrenView(e){const t=this.children;t&&t.forEach((t=>t.view=e))}_createChildren(e){const{listModeDisabled:t,children:i}=this,s=e.filter((e=>!i.some((t=>t.layer===e))));i.addMany(this._createChildItems(s,t))}_destroyChildren(e){const{children:t}=this,i=t.filter((t=>!!t.layer&&!e.includes(t.layer)));t.destroyMany(i)}_sortChildren(e){this.children.sort(((t,i)=>e.indexOf(i.layer)-e.indexOf(t.layer)))}_destroyAllChildren(){this.removeHandles(M),this.children.destroyAll()}_watchChildLayerListMode(e){this.removeHandles(M),this.listModeDisabled||this.addHandles(e.toArray().map((t=>r((()=>t.listMode),(()=>this._compileChildren(e))))),M)}_compileChildren(e){const t=this.listModeDisabled?e:e?.filter((e=>v(e)!==P));e?.length?(this._createChildren(t),this._destroyChildren(t),this._sortChildren(t),this._watchChildLayerListMode(e)):this._destroyAllChildren()}_watchSublayerChanges(e){e&&this.addHandles(e.on("change",(()=>this._compileChildren(e))),_)}_initializeChildLayers(e){this._compileChildren(e),this._watchSublayerChanges(e)}_createChildItems(e,t){return e.map((e=>t||f(e)?new g({layer:e,checkPublishStatusEnabled:this.checkPublishStatusEnabled,listItemCreatedFunction:this.listItemCreatedFunction,listModeDisabled:this.listModeDisabled,parent:this,view:this.view}):null)).filter(i).reverse()}_watchLayerProperties(e){if(this.removeHandles(_),this.removeHandles(M),!e)return;if("hide-children"===(!this.listModeDisabled&&v(e)))return void this.children.destroyAll();const t=C(e);t&&this.addHandles(r((()=>e[t]),(i=>{e.hasOwnProperty(t)&&this._initializeChildLayers(i)}),o),_)}};e([n({type:S})],I.prototype,"actionsSections",void 0),e([n()],I.prototype,"actionsOpen",void 0),e([n()],I.prototype,"checkPublishStatusEnabled",void 0),e([n({type:s.ofType(I)})],I.prototype,"children",void 0),e([n()],I.prototype,"childrenSortable",void 0),e([n({readOnly:!0})],I.prototype,"connectionStatus",null),e([n({readOnly:!0})],I.prototype,"error",null),e([n()],I.prototype,"hidden",void 0),e([n({readOnly:!0})],I.prototype,"incompatible",null),e([n()],I.prototype,"layer",void 0),e([n({readOnly:!0})],I.prototype,"layerView",null),e([n()],I.prototype,"listItemCreatedFunction",void 0),e([n({nonNullable:!0})],I.prototype,"listModeDisabled",void 0),e([n()],I.prototype,"open",void 0),e([n({type:y})],I.prototype,"panel",void 0),e([a("panel")],I.prototype,"castPanel",null),e([n()],I.prototype,"parent",void 0),e([n({value:!0})],I.prototype,"sortable",null),e([n()],I.prototype,"title",null),e([n({readOnly:!0})],I.prototype,"publishing",null),e([n({readOnly:!0})],I.prototype,"updating",null),e([n()],I.prototype,"view",void 0),e([n()],I.prototype,"visible",null),e([n({readOnly:!0})],I.prototype,"visibleAtCurrentScale",null),e([n({readOnly:!0})],I.prototype,"visibleAtCurrentTimeExtent",null),e([n({readOnly:!0})],I.prototype,"visibilityMode",null),I=g=e([h("esri.widgets.LayerList.ListItem")],I);const O=I;export{O as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import l from"../../core/Identifiable.js";import{watch as r,initial as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as a}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{get as d}from"../../core/accessorSupport/get.js";import p from"../../support/actions/ActionBase.js";import c from"../../support/actions/ActionButton.js";import u from"../../support/actions/ActionToggle.js";import y from"./ListItemPanel.js";import{isLayerOutsideScaleRange as b,findLayerVisibilityMode as m,findLayerListMode as v,canDisplayLayer as f,getNormalizedChildLayerProperty as C}from"./support/layerListUtils.js";var g;const w=s.ofType({key:"type",defaultKeyValue:"button",base:p,typeMap:{button:c,toggle:u}}),S=s.ofType(w),_="layer",M="child-list-mode",P="hide";let I=g=class extends(l.IdentifiableMixin(t)){constructor(e){super(e),this.actionsSections=new S,this.actionsOpen=!1,this.checkPublishStatusEnabled=!1,this.children=new(s.ofType(g)),this.childrenSortable=!0,this.hidden=!1,this.layer=null,this.listItemCreatedFunction=null,this.listModeDisabled=!1,this.open=!1,this.panel=null,this.parent=null,this.view=null}initialize(){if(this.addHandles([r((()=>[this.layer,this.layer?.listMode,this.listModeDisabled]),(()=>this._watchLayerProperties(this.layer)),o),r((()=>this.checkPublishStatusEnabled),(e=>this._updateChildrenPublishing(e)),o),r((()=>this.view),(e=>this._updateChildrenView(e)),o),r((()=>this.panel),(e=>this._setListItemOnPanel(e)),o)]),"function"==typeof this.listItemCreatedFunction){const e={item:this};this.listItemCreatedFunction.call(null,e)}}destroy(){this.panel?.destroy(),this.children.destroyAll(),this.view=null}get connectionStatus(){const{layerView:e,publishing:t}=this;if(!t&&e&&"connectionStatus"in e)return e.connectionStatus}get error(){return this.layer?.loadError}get incompatible(){const{layerView:e}=this;return!(!e||!("spatialReferenceSupported"in e))&&!e.spatialReferenceSupported}get layerView(){const{layer:e,view:t}=this;if(!e||!t||"sublayer"===e.type)return null;const i="subtype-sublayer"===e.type?e.parent:e;return t.allLayerViews.find((e=>e.layer===i))??null}castPanel(e){return this.panel?.open&&!e.hasOwnProperty("open")&&(e.open=!0),e?new y(e):null}get sortable(){return"knowledge-graph-sublayer"!==this.layer?.type&&this._get("sortable")}set sortable(e){this._set("sortable",e)}get title(){const e=d(this,"layer.layer");return(!e||e&&d(this,"layer.layer.loaded"))&&d(this,"layer.title")||d(this,"layer.attributes.title")||""}set title(e){this._override("title",e)}get publishing(){const{layer:e,checkPublishStatusEnabled:t}=this;return!!(t&&e&&"publishingInfo"in e&&"publishing"===e.publishingInfo?.status)}get updating(){const{layerView:e,connectionStatus:t,layer:i,publishing:s}=this;return!s&&!t&&(e?e.updating:"loading"===i?.loadStatus||!1)}get visible(){return!!this.layer?.visible}set visible(e){const t=this.layer;t&&(t.visible=e)}get visibleAtCurrentScale(){return this.layerView?.visibleAtCurrentScale??!b(this.layer,this.view?.scale)}get visibleAtCurrentTimeExtent(){return this.layerView?.visibleAtCurrentTimeExtent??!0}get visibilityMode(){return m(this.layer)}clone(){return new g({actionsSections:this.actionsSections.clone(),actionsOpen:this.actionsOpen,checkPublishStatusEnabled:this.checkPublishStatusEnabled,children:this.children.clone(),childrenSortable:this.childrenSortable,hidden:this.hidden,layer:this.layer,listItemCreatedFunction:this.listItemCreatedFunction,listModeDisabled:this.listModeDisabled,open:this.open,panel:this.panel,parent:this.parent,sortable:this.sortable,title:this.title,view:this.view,visible:this.visible})}_setListItemOnPanel(e){e&&(e.listItem=this)}_updateChildrenPublishing(e){this.children?.forEach((t=>t.checkPublishStatusEnabled=e))}_updateChildrenView(e){const t=this.children;t&&t.forEach((t=>t.view=e))}_createChildren(e){const{listModeDisabled:t,children:i}=this,s=e.filter((e=>!i.some((t=>t.layer===e))));i.addMany(this._createChildItems(s,t))}_destroyChildren(e){const{children:t}=this,i=t.filter((t=>!!t.layer&&!e.includes(t.layer)));t.destroyMany(i)}_sortChildren(e){this.children.sort(((t,i)=>e.indexOf(i.layer)-e.indexOf(t.layer)))}_destroyAllChildren(){this.removeHandles(M),this.children.destroyAll()}_watchChildLayerListMode(e){this.removeHandles(M),this.listModeDisabled||this.addHandles(e.toArray().map((t=>r((()=>t.listMode),(()=>this._compileChildren(e))))),M)}_compileChildren(e){const t=this.listModeDisabled?e:e?.filter((e=>v(e)!==P));e?.length?(this._createChildren(t),this._destroyChildren(t),this._sortChildren(t),this._watchChildLayerListMode(e)):this._destroyAllChildren()}_watchSublayerChanges(e){e&&this.addHandles(e.on("change",(()=>this._compileChildren(e))),_)}_initializeChildLayers(e){this._compileChildren(e),this._watchSublayerChanges(e)}_createChildItems(e,t){return e.reverse().map((e=>t||f(e)?new g({layer:e,checkPublishStatusEnabled:this.checkPublishStatusEnabled,listItemCreatedFunction:this.listItemCreatedFunction,listModeDisabled:this.listModeDisabled,parent:this,view:this.view}):null)).filter(i)}_watchLayerProperties(e){if(this.removeHandles(_),this.removeHandles(M),!e)return;if("hide-children"===(!this.listModeDisabled&&v(e)))return void this.children.destroyAll();const t=C(e);t&&this.addHandles(r((()=>e[t]),(i=>{e.hasOwnProperty(t)&&this._initializeChildLayers(i)}),o),_)}};e([n({type:S})],I.prototype,"actionsSections",void 0),e([n()],I.prototype,"actionsOpen",void 0),e([n()],I.prototype,"checkPublishStatusEnabled",void 0),e([n({type:s.ofType(I)})],I.prototype,"children",void 0),e([n()],I.prototype,"childrenSortable",void 0),e([n({readOnly:!0})],I.prototype,"connectionStatus",null),e([n({readOnly:!0})],I.prototype,"error",null),e([n()],I.prototype,"hidden",void 0),e([n({readOnly:!0})],I.prototype,"incompatible",null),e([n()],I.prototype,"layer",void 0),e([n({readOnly:!0})],I.prototype,"layerView",null),e([n()],I.prototype,"listItemCreatedFunction",void 0),e([n({nonNullable:!0})],I.prototype,"listModeDisabled",void 0),e([n()],I.prototype,"open",void 0),e([n({type:y})],I.prototype,"panel",void 0),e([a("panel")],I.prototype,"castPanel",null),e([n()],I.prototype,"parent",void 0),e([n({value:!0})],I.prototype,"sortable",null),e([n()],I.prototype,"title",null),e([n({readOnly:!0})],I.prototype,"publishing",null),e([n({readOnly:!0})],I.prototype,"updating",null),e([n()],I.prototype,"view",void 0),e([n()],I.prototype,"visible",null),e([n({readOnly:!0})],I.prototype,"visibleAtCurrentScale",null),e([n({readOnly:!0})],I.prototype,"visibleAtCurrentTimeExtent",null),e([n({readOnly:!0})],I.prototype,"visibilityMode",null),I=g=e([h("esri.widgets.LayerList.ListItem")],I);const O=I;export{O as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const n={hide:"hide",hideChildren:"hide-children"},i=10,e=2;function t({exclusive:n,visible:i,visibilityAppearance:e}){const t="checkbox"===e;return i?n?"circle-f":t?"check-square-f":"view-visible":n?"circle":t?"square":"view-hide"}function r({connectionStatus:n,publishing:i}){return n?"connected"===n?"beacon":"offline":i?"square":"bullet-point"}function l(i){return i?.listMode===n.hideChildren}function u(n){return n?.listMode??void 0}function o(n){return null!=n&&"minScale"in n&&null!=n.minScale?n.minScale:void 0}function c(n){return null!=n&&"maxScale"in n&&null!=n.maxScale?n.maxScale:void 0}function a(n){if(!n)return"inherited";const i=S(x(n)?n.layer:n);return null!=i?i?"independent":"inherited":"visibilityMode"in n&&null!=n.visibilityMode?n.visibilityMode:"independent"}function s(n){n?.removeMany(n.filter((n=>n?.destroyed)))}function d(n){if(n&&(!("type"in n)||"wmts"!==n.type))return"sublayers"in n?"sublayers":"layers"in n?"layers":void 0}function f(n,i){n&&(n.filterPredicate=i?n=>i(N(n)):void 0)}function y(n){const i=(n?.layer&&x(n.layer)?n.layer.layer:void 0)??n?.layer;return!!i&&("catalog"!==i.type&&(M(i)??!0))}function p(i){return u(i)!==n.hide}function b(n,i){if(!n||null==i||isNaN(i))return!1;const e=o(n),t=c(n),r=null!=e&&!isNaN(e)&&e>0&&i>e,l=null!=t&&!isNaN(t)&&t>0&&i<t;return r||l}function v(n,i){n?.sort(((n,e)=>{const t="uid"in n?i.indexOf(n.uid):-1,r="uid"in e?i.indexOf(e.uid):-1;return t>r?-1:t<r?1:0}))}function h(n,i){const e=n?.layer;if(!e)return;const t=d(e);if(!t)return;let r;"layers"===t&&"layers"in e?r=e.layers:"sublayers"===t&&"sublayers"in e&&(r=e.sublayers),v(r,i)}function m(n){const i=n?.layer;return i&&"layers"in i?i.layers:null}function x(n){return null!=n&&"layer"in n&&null!=n.layer}function S(n){const i=g(n);return null!=i&&"supportsSublayerVisibility"in i?i.supportsSublayerVisibility:void 0}function M(n){const i=g(n);return null!=i&&"supportsDynamicLayers"in i?i.supportsDynamicLayers:void 0}function g(n){return n&&"capabilities"in n&&null!=n.capabilities&&"exportMap"in n.capabilities?n.capabilities.exportMap:void 0}function N(n){return n?.["data-item"]}function q(n){return n?.getAttribute("data-layer-type")}function w({children:n,error:i,incompatible:e}){return!!n?.filter((n=>!n.hidden)).length&&!i&&!e}function k(n){for(const i of n)for(const n of i)if("button"===n.type||"toggle"===n.type)return n}export{l as areChildrenHidden,p as canDisplayLayer,y as canSortSublayers,u as findLayerListMode,c as findLayerMaxScale,o as findLayerMinScale,a as findLayerVisibilityMode,N as getItem,m as getItemLayers,q as getLayerType,d as getNormalizedChildLayerProperty,k as getSingleAction,r as getStatusIcon,t as getVisibilityIcon,b as isLayerOutsideScaleRange,x as isSublayer,w as listItemHasChildren,e as minDragEnabledItems,i as minFilterItems,s as removeDestroyedListItems,f as setFilterPredicate,h as sortChildLayersToIds,v as sortLayersToIds};
5
+ const n={hide:"hide",hideChildren:"hide-children"},i=10,e=2;function t({exclusive:n,visible:i,visibilityAppearance:e}){const t="checkbox"===e;return i?n?"circle-f":t?"check-square-f":"view-visible":n?"circle":t?"square":"view-hide"}function r({connectionStatus:n,publishing:i}){return n?"connected"===n?"beacon":"offline":i?"square":"bullet-point"}function l(i){return i?.listMode===n.hideChildren}function u(n){return n?.listMode??void 0}function o(n){return null!=n&&"minScale"in n&&null!=n.minScale?n.minScale:void 0}function c(n){return null!=n&&"maxScale"in n&&null!=n.maxScale?n.maxScale:void 0}function a(n){if(!n)return"inherited";const i=S(x(n)?n.layer:n);return null!=i?i?"independent":"inherited":"visibilityMode"in n&&null!=n.visibilityMode?n.visibilityMode:"independent"}function s(n){n?.removeMany(n.filter((n=>n?.destroyed)))}function d(n){if(n&&(!("type"in n)||"wmts"!==n.type))return"sublayers"in n?"sublayers":"layers"in n?"layers":void 0}function f(n,i){n&&(n.filterPredicate=i?n=>i(N(n)):void 0)}function y(n){const i=(n?.layer&&x(n.layer)?n.layer.layer:void 0)??n?.layer;return!!i&&("catalog"!==i.type&&(M(i)??!0))}function p(i){return u(i)!==n.hide}function b(n,i){if(!n||null==i||isNaN(i))return!1;const e=o(n),t=c(n),r=null!=e&&!isNaN(e)&&e>0&&i>e,l=null!=t&&!isNaN(t)&&t>0&&i<t;return r||l}function v(n,i){n?.sort(((n,e)=>{const t="uid"in n?i.indexOf(n.uid):-1,r="uid"in e?i.indexOf(e.uid):-1;return t>r?-1:t<r?1:0}))}function h(n,i){const e=n?.layer;if(!e)return;const t=d(e);if(!t)return;let r;"layers"===t&&"layers"in e?r=e.layers:"sublayers"===t&&"sublayers"in e&&(r=e.sublayers),v(r,i)}function m(n){const i=n?.layer;return i&&"layers"in i?i.layers:null}function x(n){return null!=n&&"layer"in n&&null!=n.layer}function S(n){const i=g(n);return null!=i&&"supportsSublayerVisibility"in i?i.supportsSublayerVisibility:void 0}function M(n){const i=g(n);return null!=i&&"supportsDynamicLayers"in i?i.supportsDynamicLayers:void 0}function g(n){return n&&"capabilities"in n&&null!=n.capabilities&&"exportMap"in n.capabilities?n.capabilities.exportMap:void 0}function N(n){return n?.["data-item"]}function q(n){return n?.getAttribute("data-layer-type")}function w(n){const{children:i,error:e}=n,t="incompatible"in n&&n.incompatible;return!!i?.filter((n=>!n.hidden)).length&&!e&&!t}function k(n){for(const i of n)for(const n of i)if("button"===n.type||"toggle"===n.type)return n}export{l as areChildrenHidden,p as canDisplayLayer,y as canSortSublayers,u as findLayerListMode,c as findLayerMaxScale,o as findLayerMinScale,a as findLayerVisibilityMode,N as getItem,m as getItemLayers,q as getLayerType,d as getNormalizedChildLayerProperty,k as getSingleAction,r as getStatusIcon,t as getVisibilityIcon,b as isLayerOutsideScaleRange,x as isSublayer,w as listItemHasChildren,e as minDragEnabledItems,i as minFilterItems,s as removeDestroyedListItems,f as setFilterPredicate,h as sortChildLayersToIds,v as sortLayersToIds};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import i from"../../core/Accessor.js";import r from"../../core/Collection.js";import{watch as t,initial as s,when as a}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{get as l}from"../../core/accessorSupport/get.js";import{getEffectiveFeatureReduction as y}from"../../views/2d/layers/features/layerAdapters/featureReductionUtils.js";import d from"./support/ActiveLayerInfo.js";import{onLocaleChange as c}from"../../intl/locale.js";const h={state:"state",view:"view",allLayerViews:"all-layer-views",legendProperties:"legend-properties"},L=r.ofType(d),p=new Set(["esri.layers.BuildingSceneLayer","esri.layers.CatalogLayer","esri.layers.CSVLayer","esri.layers.FeatureLayer","esri.layers.GeoJSONLayer","esri.layers.GeoRSSLayer","esri.layers.GroupLayer","esri.layers.HeatmapLayer","esri.layers.ImageryLayer","esri.layers.ImageryTileLayer","esri.layers.MapImageLayer","esri.layers.OGCFeatureLayer","esri.layers.OrientedImageryLayer","esri.layers.ParquetLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.SubtypeGroupLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer","esri.layers.LinkChartLayer","esri.layers.catalog.CatalogFootprintLayer","esri.layers.catalog.CatalogDynamicGroupLayer","esri.layers.knowledgeGraph.KnowledgeGraphSublayer","esri.layers.KnowledgeGraphLayer"]),u="view.basemapView.baseLayerViews",f="view.groundView.layerViews",v="view.basemapView.referenceLayerViews",_=[u,f,"view.layerViews",v];let w=class extends i{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this.activeLayerInfos=new L,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerDisplayFilter=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this.addHandles(t((()=>this.view),(()=>this._viewHandles()),s),h.view),this.addHandles(c((()=>this._refresh())))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get state(){return this.view?.ready?"ready":"disabled"}_viewHandles(){this.removeHandles(h.state),this.view&&this.addHandles(t((()=>this.state),(()=>this._stateHandles()),s),h.state)}_stateHandles(){this._resetAll(),"ready"===this.state&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([h.allLayerViews,h.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);const i=this._activeLayerInfosByLayerViewId[e];delete this._activeLayerInfosByLayerViewId[e],i?.parent&&i.parent.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{view:e}=this;if(!e)return;const{allLayerViews:i}=e;i.length&&this._refresh(),this.addHandles(i.on("change",(e=>this._allLayerViewsChangeHandle(e))),h.allLayerViews),this.addHandles(t((()=>[this.layerInfos,this.basemapLegendVisible,this.groundLegendVisible]),(()=>this._propertiesChangeHandle())),h.legendProperties)}_allLayerViewsChangeHandle(e){e.moved.length?this._propertiesChangeHandle():(e.removed.forEach((e=>this._destroyViewActiveLayerInfo(e.uid))),this._refresh())}_propertiesChangeHandle(){this._destroyViewActiveLayerInfos(),this._refresh()}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.removeAll(),this._generateLayerViews().filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this),this._sortActiveLayerInfos(this.activeLayerInfos)}_sortActiveLayerInfos(e){const i=this.view;if(e.length<2||!i)return;const r=[];e.forEach((i=>{if(!i.parent){const t=i.layer.parent,s=t&&"uid"in t&&this._layerViewByLayerId[t.uid],a=s&&this._activeLayerInfosByLayerViewId[s.uid];a&&e.includes(a)&&(r.push(i),i.parent=a,a.children.add(i),this._sortActiveLayerInfos(a.children))}})),e.removeMany(r);const t={};i.allLayerViews.forEach(((e,i)=>t[e.layer.uid]=i)),e.sort(((e,i)=>{const r=t[e.layer.uid]||0;return(t[i.layer.uid]||0)-r}))}_generateLayerViews(){const e=[];return _.filter(this._filterLayerViews,this).map((e=>l(this,e))).filter((e=>null!=e)).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===u||e===v),r=!this.groundLegendVisible&&e===f;return!i&&!r}_collectLayerViews(e,i){const r=t=>(t&&t.forEach((t=>{i.push(t),r(t[e])})),i);return r}_filterLayerViewsByLayerInfos(e){const i=this.layerInfos;return!i||!i.length||i.some((i=>this._hasLayerInfo(i,e)))}_hasLayerInfo(e,i){const r=this._isLayerUIDMatching(e.layer,i.layer.uid);return r&&(this._layerInfosByLayerViewId[i.uid]=e),r}_isLayerUIDMatching(e,i){return e&&(e.uid===i||this._hasLayerUID(e.layers,i))}_hasLayerUID(e,i){return e&&e.some((e=>this._isLayerUIDMatching(e,i)))}_isLayerViewSupported(e){return!!p.has(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this.removeHandles(e.uid),this.addHandles(t((()=>[e.legendEnabled,e.layer?.legendEnabled]),(()=>this._layerActiveHandle(e))),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.layer?.legendEnabled}_buildActiveLayerInfo(e){const i=e.layer,r=e.uid,n=this._layerInfosByLayerViewId[r];let o=this._activeLayerInfosByLayerViewId[r];if(!o){const t=void 0!==n?.title&&n.layer.uid===i.uid;o=new d({layer:i,layerView:e,title:t?n.title:i.title,view:this.view??void 0,respectLayerDefinitionExpression:this.respectLayerDefinitionExpression,respectLayerDisplayFilter:this.respectLayerDisplayFilter,respectLayerVisibility:this.respectLayerVisibility,hideLayersNotInCurrentView:this.hideLayersNotInCurrentView,keepCacheOnDestroy:this.keepCacheOnDestroy,sublayerIds:n?.sublayerIds||[]}),this._activeLayerInfosByLayerViewId[r]=o}const l=i.parent&&"uid"in i.parent?this._layerViewByLayerId[i.parent?.uid]:null;if(o.parent=this._activeLayerInfosByLayerViewId[l?.uid],!this.hasHandles(r)){const n=[t((()=>i.title),(e=>this._titleHandle(e,o))),t((()=>[i.opacity,"renderer"in i&&i.renderer,"pointSymbol"in i&&i.pointSymbol,"lineSymbol"in i&&i.lineSymbol,"polygonSymbol"in i&&i.polygonSymbol]),(()=>this._constructLegendElements(o))),a((()=>!0===this.view?.stationary),(()=>this._scaleHandle(o)),s),t((()=>e.layer?y(e.layer,e.view):null),(()=>this._constructLegendElements(o))),t((()=>e.updating),(()=>{if(null==e.layer)return;null!=y(e.layer,e.view)&&this._constructLegendElements(o)})),t((()=>"effect"in i&&i.effect),(()=>this._constructLegendElements(o))),a((()=>this.view?.timeZone),(()=>this._constructLegendElements(o)),s)];if(this.respectLayerVisibility){const r=t((()=>e.legendEnabled),(e=>this._legendEnabledHandle(e,o))),s=t((()=>i.legendEnabled),(e=>this._legendEnabledHandle(e,o)));n.push(r,s)}if(this.respectLayerDefinitionExpression&&"definitionExpression"in i){const e=t((()=>[i.definitionExpression,this.respectLayerDefinitionExpression]),(()=>{o.respectLayerDefinitionExpression=this.respectLayerDefinitionExpression,this._constructLegendElements(o)}));n.push(e)}if(this.respectLayerDisplayFilter&&"displayFilterInfo"in i){const e=t((()=>this.respectLayerDisplayFilter),(()=>{o.respectLayerDisplayFilter=this.respectLayerDisplayFilter,this._constructLegendElements(o)}));n.push(e)}this.addHandles(n,r)}o.isScaleDriven||this._constructLegendElements(o),this._addActiveLayerInfo(o)}_titleHandle(e,i){i.title=e,this._constructLegendElements(i)}_legendEnabledHandle(e,i){e?this._addActiveLayerInfo(i):this._removeActiveLayerInfo(i)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){const{layerView:i,layer:r}=e;if(this._isLayerActive(i)&&!this.activeLayerInfos.includes(e)){const i=e.parent;if(i)i.children.includes(e)||i.children.push(e),this._sortActiveLayerInfos(i.children);else{const i=this.layerInfos?.some((e=>e.layer.uid===r.uid)),t=r.parent;(t&&"uid"in t?this._layerViewByLayerId[t.uid]:null)&&!i?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){const e=[];this._activeLayerInfosWithNoParent.forEach((i=>{const r=i.layer.parent,t=r&&"uid"in r?this._layerViewByLayerId[r?.uid]:null,s=this._activeLayerInfosByLayerViewId[t?.uid];s&&(e.push(i),i.parent=s)})),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach((e=>this._addActiveLayerInfo(e))))}}}_removeActiveLayerInfo(e){const i=e.parent;i?i.children.remove(e):this.activeLayerInfos.remove(e)}_constructLegendElements(e){const i=e.layer;"featureCollections"in i&&i.featureCollections?e.buildLegendElementsForFeatureCollections(i.featureCollections):"featureReduction"in i&&i.featureReduction&&"renderer"in i.featureReduction&&("binning"===i.featureReduction.type||"cluster"===i.featureReduction.type)&&(!this.view||i.featureReduction.maxScale<=this.view.scale)?e.buildLegendElementsForFeatureReduction(i.featureReduction):"renderer"in i&&i.renderer&&!("sublayers"in i)?e.buildLegendElementsForRenderer(i.renderer):"url"in i&&i.url&&"catalog"!==i.type&&"knowledge-graph"!==i.type?e.buildLegendElementsForTools():e.children.forEach((e=>this._constructLegendElements(e)))}};e([n({type:L})],w.prototype,"activeLayerInfos",void 0),e([n()],w.prototype,"basemapLegendVisible",void 0),e([n()],w.prototype,"groundLegendVisible",void 0),e([n()],w.prototype,"hideLayersNotInCurrentView",void 0),e([n()],w.prototype,"keepCacheOnDestroy",void 0),e([n()],w.prototype,"respectLayerDefinitionExpression",void 0),e([n()],w.prototype,"respectLayerDisplayFilter",void 0),e([n()],w.prototype,"respectLayerVisibility",void 0),e([n()],w.prototype,"layerInfos",void 0),e([n({readOnly:!0})],w.prototype,"state",null),e([n()],w.prototype,"view",void 0),w=e([o("esri.widgets.Legend.LegendViewModel")],w);const I=w;export{I as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import i from"../../core/Accessor.js";import r from"../../core/Collection.js";import{watch as t,initial as s,when as a}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{get as l}from"../../core/accessorSupport/get.js";import{getEffectiveFeatureReduction as y}from"../../views/2d/layers/features/layerAdapters/featureReductionUtils.js";import d from"./support/ActiveLayerInfo.js";import{onLocaleChange as h}from"../../intl/locale.js";const c={state:"state",view:"view",allLayerViews:"all-layer-views",legendProperties:"legend-properties"},L=r.ofType(d),p=new Set(["esri.layers.BuildingSceneLayer","esri.layers.CatalogLayer","esri.layers.CSVLayer","esri.layers.FeatureLayer","esri.layers.GeoJSONLayer","esri.layers.GeoRSSLayer","esri.layers.GroupLayer","esri.layers.HeatmapLayer","esri.layers.ImageryLayer","esri.layers.ImageryTileLayer","esri.layers.MapImageLayer","esri.layers.OGCFeatureLayer","esri.layers.OrientedImageryLayer","esri.layers.ParquetLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.SubtypeGroupLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer","esri.layers.LinkChartLayer","esri.layers.catalog.CatalogFootprintLayer","esri.layers.catalog.CatalogDynamicGroupLayer","esri.layers.knowledgeGraph.KnowledgeGraphSublayer","esri.layers.KnowledgeGraphLayer"]),u="view.basemapView.baseLayerViews",f="view.groundView.layerViews",v="view.basemapView.referenceLayerViews",_=[u,f,"view.layerViews",v];let w=class extends i{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this.activeLayerInfos=new L,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this.addHandles(t((()=>this.view),(()=>this._viewHandles()),s),c.view),this.addHandles(h((()=>this._refresh())))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get state(){return this.view?.ready?"ready":"disabled"}_viewHandles(){this.removeHandles(c.state),this.view&&this.addHandles(t((()=>this.state),(()=>this._stateHandles()),s),c.state)}_stateHandles(){this._resetAll(),"ready"===this.state&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([c.allLayerViews,c.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);const i=this._activeLayerInfosByLayerViewId[e];delete this._activeLayerInfosByLayerViewId[e],i?.parent&&i.parent.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{view:e}=this;if(!e)return;const{allLayerViews:i}=e;i.length&&this._refresh(),this.addHandles(i.on("change",(e=>this._allLayerViewsChangeHandle(e))),c.allLayerViews),this.addHandles(t((()=>[this.layerInfos,this.basemapLegendVisible,this.groundLegendVisible]),(()=>this._propertiesChangeHandle())),c.legendProperties)}_allLayerViewsChangeHandle(e){e.moved.length?this._propertiesChangeHandle():(e.removed.forEach((e=>this._destroyViewActiveLayerInfo(e.uid))),this._refresh())}_propertiesChangeHandle(){this._destroyViewActiveLayerInfos(),this._refresh()}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.removeAll(),this._generateLayerViews().filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this),this._sortActiveLayerInfos(this.activeLayerInfos)}_sortActiveLayerInfos(e){const i=this.view;if(e.length<2||!i)return;const r=[];e.forEach((i=>{if(!i.parent){const t=i.layer.parent,s=t&&"uid"in t&&this._layerViewByLayerId[t.uid],a=s&&this._activeLayerInfosByLayerViewId[s.uid];a&&e.includes(a)&&(r.push(i),i.parent=a,a.children.add(i),this._sortActiveLayerInfos(a.children))}})),e.removeMany(r);const t={};i.allLayerViews.forEach(((e,i)=>t[e.layer.uid]=i)),e.sort(((e,i)=>{const r=t[e.layer.uid]||0;return(t[i.layer.uid]||0)-r}))}_generateLayerViews(){const e=[];return _.filter(this._filterLayerViews,this).map((e=>l(this,e))).filter((e=>null!=e)).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===u||e===v),r=!this.groundLegendVisible&&e===f;return!i&&!r}_collectLayerViews(e,i){const r=t=>(t&&t.forEach((t=>{i.push(t),r(t[e])})),i);return r}_filterLayerViewsByLayerInfos(e){const i=this.layerInfos;return!i||!i.length||i.some((i=>this._hasLayerInfo(i,e)))}_hasLayerInfo(e,i){const r=this._isLayerUIDMatching(e.layer,i.layer.uid);return r&&(this._layerInfosByLayerViewId[i.uid]=e),r}_isLayerUIDMatching(e,i){return e&&(e.uid===i||this._hasLayerUID(e.layers,i))}_hasLayerUID(e,i){return e&&e.some((e=>this._isLayerUIDMatching(e,i)))}_isLayerViewSupported(e){return!!p.has(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this.removeHandles(e.uid),this.addHandles(t((()=>[e.legendEnabled,e.layer?.legendEnabled]),(()=>this._layerActiveHandle(e))),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.layer?.legendEnabled}_buildActiveLayerInfo(e){const i=e.layer,r=e.uid,n=this._layerInfosByLayerViewId[r];let o=this._activeLayerInfosByLayerViewId[r];if(!o){const t=void 0!==n?.title&&n.layer.uid===i.uid;o=new d({layer:i,layerView:e,title:t?n.title:i.title,view:this.view??void 0,respectLayerDefinitionExpression:this.respectLayerDefinitionExpression,respectLayerVisibility:this.respectLayerVisibility,hideLayersNotInCurrentView:this.hideLayersNotInCurrentView,keepCacheOnDestroy:this.keepCacheOnDestroy,sublayerIds:n?.sublayerIds||[]}),this._activeLayerInfosByLayerViewId[r]=o}const l=i.parent&&"uid"in i.parent?this._layerViewByLayerId[i.parent?.uid]:null;if(o.parent=this._activeLayerInfosByLayerViewId[l?.uid],!this.hasHandles(r)){const n=[t((()=>i.title),(e=>this._titleHandle(e,o))),t((()=>[i.opacity,"renderer"in i&&i.renderer,"pointSymbol"in i&&i.pointSymbol,"lineSymbol"in i&&i.lineSymbol,"polygonSymbol"in i&&i.polygonSymbol]),(()=>this._constructLegendElements(o))),a((()=>!0===this.view?.stationary),(()=>this._scaleHandle(o)),s),t((()=>e.layer?y(e.layer,e.view):null),(()=>this._constructLegendElements(o))),t((()=>e.updating),(()=>{if(null==e.layer)return;null!=y(e.layer,e.view)&&this._constructLegendElements(o)})),t((()=>"effect"in i&&i.effect),(()=>this._constructLegendElements(o))),a((()=>this.view?.timeZone),(()=>this._constructLegendElements(o)),s)];if(this.respectLayerVisibility){const r=t((()=>e.legendEnabled),(e=>this._legendEnabledHandle(e,o))),s=t((()=>i.legendEnabled),(e=>this._legendEnabledHandle(e,o)));n.push(r,s)}if(this.respectLayerDefinitionExpression&&"definitionExpression"in i){const e=t((()=>[i.definitionExpression,this.respectLayerDefinitionExpression]),(()=>{o.respectLayerDefinitionExpression=this.respectLayerDefinitionExpression,this._constructLegendElements(o)}));n.push(e)}this.addHandles(n,r)}o.isScaleDriven||this._constructLegendElements(o),this._addActiveLayerInfo(o)}_titleHandle(e,i){i.title=e,this._constructLegendElements(i)}_legendEnabledHandle(e,i){e?this._addActiveLayerInfo(i):this._removeActiveLayerInfo(i)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){const{layerView:i,layer:r}=e;if(this._isLayerActive(i)&&!this.activeLayerInfos.includes(e)){const i=e.parent;if(i)i.children.includes(e)||i.children.push(e),this._sortActiveLayerInfos(i.children);else{const i=this.layerInfos?.some((e=>e.layer.uid===r.uid)),t=r.parent;(t&&"uid"in t?this._layerViewByLayerId[t.uid]:null)&&!i?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){const e=[];this._activeLayerInfosWithNoParent.forEach((i=>{const r=i.layer.parent,t=r&&"uid"in r?this._layerViewByLayerId[r?.uid]:null,s=this._activeLayerInfosByLayerViewId[t?.uid];s&&(e.push(i),i.parent=s)})),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach((e=>this._addActiveLayerInfo(e))))}}}_removeActiveLayerInfo(e){const i=e.parent;i?i.children.remove(e):this.activeLayerInfos.remove(e)}_constructLegendElements(e){const i=e.layer;"featureCollections"in i&&i.featureCollections?e.buildLegendElementsForFeatureCollections(i.featureCollections):"featureReduction"in i&&i.featureReduction&&"renderer"in i.featureReduction&&("binning"===i.featureReduction.type||"cluster"===i.featureReduction.type)&&(!this.view||i.featureReduction.maxScale<=this.view.scale)?e.buildLegendElementsForFeatureReduction(i.featureReduction):"renderer"in i&&i.renderer&&!("sublayers"in i)?e.buildLegendElementsForRenderer(i.renderer):"url"in i&&i.url&&"catalog"!==i.type&&"knowledge-graph"!==i.type?e.buildLegendElementsForTools():e.children.forEach((e=>this._constructLegendElements(e)))}};e([n({type:L})],w.prototype,"activeLayerInfos",void 0),e([n()],w.prototype,"basemapLegendVisible",void 0),e([n()],w.prototype,"groundLegendVisible",void 0),e([n()],w.prototype,"hideLayersNotInCurrentView",void 0),e([n()],w.prototype,"keepCacheOnDestroy",void 0),e([n()],w.prototype,"respectLayerDefinitionExpression",void 0),e([n()],w.prototype,"respectLayerVisibility",void 0),e([n()],w.prototype,"layerInfos",void 0),e([n({readOnly:!0})],w.prototype,"state",null),e([n()],w.prototype,"view",void 0),w=e([o("esri.widgets.Legend.LegendViewModel")],w);const I=w;export{I as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import"../../../intl.js";import{addTokenParameter as s}from"../../../kernel.js";import i from"../../../request.js";import l from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import n from"../../../core/Collection.js";import has from"../../../core/has.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{debounce as u}from"../../../core/promiseUtils.js";import{on as c,watch as d,whenOnce as y,initial as h}from"../../../core/reactiveUtils.js";import{px2pt as m}from"../../../core/screenUtils.js";import{parseWhereClause as p}from"../../../core/sql.js";import{addQueryParameters as f}from"../../../core/urlUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{OriginId as S}from"../../../core/accessorSupport/PropertyOrigin.js";import{EffectView as _}from"../../../layers/effects/EffectView.js";import{effectFunctionsFromJSON as w}from"../../../layers/effects/jsonUtils.js";import{getEffectiveDisplayFilter as v}from"../../../layers/support/displayFilterUtils.js";import{ExportImageParameters as L}from"../../../layers/support/ExportImageParameters.js";import{getRendererFields as E}from"../../../layers/support/fieldUtils.js";import{isFeatureLayer as C}from"../../../layers/support/layerUtils.js";import{getPixelValueRange as I}from"../../../layers/support/rasterFormats/pixelRangeUtils.js";import{fromJSON as F}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as R}from"../../../renderers/support/rendererConversion.js";import V from"../../../renderers/visualVariables/SizeVariable.js";import D from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{updateReferenceSizeSymbol as x}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import z from"../../../symbols/SimpleFillSymbol.js";import T from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as j}from"../../../symbols/support/cimSymbolUtils.js";import{SymbolSizeDefaults as O}from"../../../symbols/support/previewUtils.js";import{renderSymbol as P}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as A,renderDotDensityPreviewHTML as M,renderPieChartPreviewHTML as U,renderPreviewHTML as k}from"../../../symbols/support/symbolUtils.js";import{isVolumetricSymbol as B}from"../../../symbols/support/utils.js";import{getEffectiveClusterSizeVariable as N}from"./clusterUtils.js";import{getColorFromPointCloudStops as q,getRampStopsForPointCloud as $,getStretchRampStops as H,getRampStops as W}from"./colorRampUtils.js";import{getHeatmapRampStops as G}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as J,getRelationshipRampElement as Q}from"./relationshipRampUtils.js";import{getRampStops as Z,realWorldMaxSize as K,realWorldMinSize as X}from"./sizeRampUtils.js";import{specialCharsLessThan as Y,specialCharsGreaterThan as ee,getReferenceSizeAuthoringInfoVisualVariable as te,getSymbolForFlowRenderer as se,getMedianColor as ie,rgbImgSource as le,getDateFormatOptions as re}from"./utils.js";import{formatNumberLabel as ne}from"../../smartMapping/support/utils.js";import{fetchMessageBundle as ae}from"../../../intl/messages.js";import{substitute as oe}from"../../../intl/substitute.js";const ue=16,ce="https://utility.arcgis.com/sharing/tools/legend",de="esri.layers.ImageryLayer",ye="esri.layers.ImageryTileLayer",he="esri.layers.WCSLayer",me=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,pe=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),fe=new T({size:6,outline:{color:[128,128,128,.5],width:.5}}),ge=new z({style:"solid"});function be(e){return"flow"===e.type}function Se(e){return"vector-field"===e.type}function _e(e){return"raster-colormap"===e.type}function we(e){return"raster-stretch"===e.type}function ve(e){return"raster-shaded-relief"===e.type}function Le(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function Ce(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function Ie(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function Fe(e){return Ve(e)||De(e)||xe(e)||Re(e)}function Re(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function Ve(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function De(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function xe(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function ze(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Te(e){return"esri.renderers.PieChartRenderer"===e.declaredClass}function je(e,t){return Le(e)||Ee(e)||Ce(e)||Ie(e)||ze(e)||Te(e)?"2d"===t.type||R(e):we(e)||_e(e)||ve(e)||Ve(e)||De(e)||xe(e)||Se(e)||be(e)}function Oe(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function Pe(e){return"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Ae(e){return"esri.layers.VoxelLayer"===e.declaredClass}function Me(e){return"esri.layers.WMSLayer"===e.declaredClass}function Ue(e){return"esri.layers.WMTSLayer"===e.declaredClass}function ke(e){return"esri.layers.MapImageLayer"===e.declaredClass}function Be(e){return"esri.layers.TileLayer"===e.declaredClass}function Ne(e){return e.declaredClass===de}function qe(e){return e.declaredClass===ye}function $e(e){return e.declaredClass===he}function He(e){return"stretch-ramp"===e.type}function We(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type}function Ge(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type&&"above-and-below"===t?.univariateTheme}function Je(e){return"sublayers"in e}async function Qe(e,t){const s=await ae("esri/widgets/Legend/t9n/Legend");return"previewTemplateAriaLabel"!==e||t||(e="previewAriaLabel"),oe(s[e],{label:t})}function Ze(e,t){const{field:s,field2:i,field3:l,fieldDelimiter:r,valueExpression:n}=e;if(!s)return null;const a=!(!s&&!n||!i&&!l)?t?.toString().split(r||""):[t],o=s?{[s]:a?.[0]}:null;return o&&(i&&(o[i]=a?.[1]),l&&(o[l]=a?.[2])),o}const Ke=new T({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let Xe={},Ye=class extends l{constructor(e){super(e),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._hasClusterSizeVariable=!1,this._layerDefinitionExpression=null,this._layerDefinitionExpressionClause=null,this._layerDisplayFilterId=null,this._layerDisplayFilterClause=null,this.children=new n,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerDisplayFilter=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this.addHandles([c((()=>this.children),"change",(t=>{const{added:s,removed:i}=t;s.forEach((t=>{const s=`activeLayerInfo-ready-watcher-${t.layer.uid}`;this.addHandles(d((()=>t.ready),e,h),s)})),i.forEach((e=>this.removeHandles(e.layer.uid))),e()}))]),this.keepCacheOnDestroy||(Xe={})}destroy(){this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(Xe=null),this._layerDefinitionExpressionClause=null}get effectList(){const e=this.layer;let t=null;return"effect"in e&&e.effect&&(t=new _,t.effect=e.effect,t.endTransition(),t.scale=this.scale),t}get opacity(){const e=this.layer.opacity,t=this.parent?.opacity,s=this.layer.parent,i=s&&"uid"in s?this._getParentLayerOpacity(s):null;return null!=t?t*e:null!=i?i*e:e}get ready(){return null===this.layer||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){return this.view?.scale??0}get isScaleDriven(){const e=this.layer;if(null===e)return!1;if("effect"in e&&e.effect&&Array.isArray(e.effect))return!0;if("featureReduction"in e&&e.featureReduction){if("cluster"===e.featureReduction.type)return!0;if("binning"===e.featureReduction.type&&"renderer"in e.featureReduction&&e.featureReduction.renderer)return this._isRendererScaleDriven(e.featureReduction.renderer)}return"renderer"in e&&e.renderer?this._isRendererScaleDriven(e.renderer):this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(e){if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],void this.notifyChange("ready");const t=Array.from(e,(e=>{if(C(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet?.features.length){const t=e.layerDefinition,s=t?.drawingInfo,i=s&&F(s.renderer),l=pe.read(t.geometryType);return i?this._getRendererLegendElements(i,{title:e.name,geometryType:l}):(o.getLogger(this).warn("drawingInfo not available!"),null)}return null}));try{const e=[],s=await Promise.allSettled(t);for(const t of s)if("fulfilled"===t.status)for(const s of t.value??[])e.push(s);this.legendElements=e,this.notifyChange("ready")}catch(s){o.getLogger(this).warn("error while building legend for layer!",s)}}async buildLegendElementsForRenderer(e){try{const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getRendererLegendElements(e):[],this.notifyChange("ready")}catch(t){o.getLogger(this).warn("error while building legend for layer!",t)}}async buildLegendElementsForFeatureReduction(e){try{const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getLegendElementsForFeatureReduction(e):[],this.notifyChange("ready")}catch(t){o.getLogger(this).warn("error while building legend for layer!",t)}}async buildLegendElementsForTools(){const e=this.layer;if(Ae(e))this._constructLegendElementsForVoxelLayer();else if(Ue(e))this._constructLegendElementsForWMTSlayer();else if(Me(e))await this._constructLegendElementsForWMSSublayers();else if(Oe(e))await this._constructLegendElementsForBuildingSceneLayer();else if(ke(e)||Be(e)||Pe(e))await this._constructLegendElementsForSublayers();else{this.removeHandles("imageryLayers-watcher");let t="default";if(Ne(e)){const s=e;t=(s?.rasterFunction?.functionName||"default")+"_"+(e.bandIds?.length?e.bandIds.join(""):"###")}if(qe(e)||"link-chart"===e.type)return;await this._getLegendLayers(`${e.uid}-${t}`).then((async t=>{this.legendElements=[],this.notifyChange("ready");const s=t.map((async t=>{if(Ne(e)){const t=d((()=>[e.rasterFunction,e.bandIds]),(()=>u((async()=>{Xe.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()}))()));this.addHandles(t,"imageryLayers-watcher")}const s=this._generateSymbolTableElementForLegendLayer(t);s?.infos.length&&(Ne(e)&&(s.title=e.title),this.legendElements.push(s)),this.notifyChange("ready")}));await Promise.allSettled(s)})).catch((e=>{o.getLogger(this).warn("Request to server for legend has failed!",e)}))}}async _isLayerInCurrentView(){const e=this.layer,t=this.layerView,s=t&&"createQuery"in t&&"queryFeatureCount"in t;if(!s&&!(t&&"createQuery"in e&&"queryFeatureCount"in e))return!0;await y((()=>!t.updating));const i=s?"createQuery"in t&&t.createQuery():"createQuery"in e&&e.createQuery();if(!i)return!0;i.geometry=this.view.extent;return 0!==(s?"queryFeatureCount"in t&&await t.queryFeatureCount(i):"queryFeatureCount"in e&&await e.queryFeatureCount(i))}_getParentLayerOpacity(e){let t=1;const s=e.parent;return s&&"uid"in s&&(t=this._getParentLayerOpacity(s)),e.opacity*t}_isGroupActive(){return this.children.some((e=>e.ready))}_isRendererScaleDriven(e){if("dot-density"===e.type)return!0;const t="valueExpression"in e?e.valueExpression:null;if(me.test(t))return!0;const s="visualVariables"in e?e.visualVariables:null;return!!s?.some((e=>this._isScaleDrivenSizeVariable(e)))||this._hasScaleDrivenSymbols(e)}_hasScaleDrivenSymbols(e){switch(e.type){case"simple":return this._isScaleDrivenSymbol(e.symbol);case"class-breaks":return this._isScaleDrivenSymbol(e.defaultSymbol)||e.classBreakInfos.some((e=>this._isScaleDrivenSymbol(e.symbol)));case"unique-value":return this._isScaleDrivenSymbol(e.defaultSymbol)||!!e.uniqueValueInfos?.some((e=>this._isScaleDrivenSymbol(e.symbol)))}return!1}_isScaleDrivenSymbol(e){if("cim"===e?.type){const{primitiveOverrides:t,minScale:s,maxScale:i}=e.data,l=t?.some((e=>/\$view\.scale/.test(e.valueExpressionInfo?.expression||"")))??!1;return null!=s||null!=i||l}return!1}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,s=t.minSize,i=t.maxSize;return!("object"!=typeof s||!s||!this._isScaleDrivenSizeVariable(s))||(!("object"!=typeof i||!i||!this._isScaleDrivenSizeVariable(i))||me.test(t.valueExpression))}_isLayerScaleDriven(e){if("minScale"in e&&e.minScale>0||"maxScale"in e&&e.maxScale>0)return!0;if("sublayers"in e&&e.sublayers)return e.sublayers.some((e=>this._isLayerScaleDriven(e)));const t=e.parent;if(!1===e.loaded&&t&&ke(t)&&"source"in e&&e.source&&"map-layer"===e.source.type)for(const s of t.sourceJSON.layers??[])if(s.id===e.source.mapLayerId&&(s.minScale>0||s.maxScale>0))return!0;return!1}async _constructLegendElementsForVoxelLayer(){this.legendElements=[],this.removeHandles("voxel-style-watcher"),this.removeHandles("voxel-current-variable");const e=this.layer;this.addHandles(d((()=>e.currentVariableId),(()=>this._constructLegendElementsForVoxelLayer())),"voxel-current-variable"),this.addHandles(d((()=>e.getVariableStyles()),(()=>this._constructLegendElementsForVoxelLayer())),"voxel-style-watcher");const t=e.getVariableStyle(null),s=[];if(t)if(t.uniqueValues?.length){const e=[];t.uniqueValues.forEach((t=>{t.enabled&&e.push({label:t.label||`${t.value}`,value:t.value,symbol:new z({color:t.color,outline:null})})})),e.length&&s.push({type:"symbol-table",title:t.label,infos:e})}else if(t.transferFunction){const{colorStops:e,stretchRange:i}=t.transferFunction,l=e.toArray().reverse(),r=i.map(((e,t)=>`${0===t?Y:ee} ${ne(e)}`)).reverse(),n=l.map((e=>({color:e.color,value:null,label:null})));n[0].label=r[0],n[n.length-1].label=r[1],s.push({type:"color-ramp",title:t.label,infos:n,preview:A(l.map((e=>e.color)),{ariaLabel:await Qe("previewColorRampAriaLabel")})})}const i=e.opacity,l=s.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol)).map((e=>this._getSymbolPreview(e,i)));await Promise.allSettled(l),this.legendElements=s,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this.removeHandles("wmts-activeLayer-watcher");const e=this.layer.activeLayer;this.addHandles(d((()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer}),(()=>this._constructLegendElementsForWMTSlayer())),"wmts-activeLayer-watcher");const t=e.styleId?e.styles?.find((({id:t})=>t===e.styleId))?.legendUrl:void 0;t&&(this.legendElements=[{type:"symbol-table",title:e.title,infos:[{src:t,opacity:this.opacity}]}]),this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this.legendElements=[],this.removeHandles("wms-sublayers-watcher");const e=this.layer;let t=null;(e.customParameters||e.customLayerParameters)&&(t={...e.customParameters,...e.customLayerParameters}),this.addHandles(d((()=>{const{layer:e}=this;return e&&"sublayers"in e&&e.sublayers}),(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher"),this.legendElements=await this._generateLegendElementsForWMSSublayers(e.sublayers,t),this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(e,t){const s=this.layer,i=[];this.addHandles(e.on("change",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher");const l=this.sublayerIds?.map((e=>s.findSublayerById(e)))?.filter(r)??[],n=l.length?l:e.toArray();for(const r of n){const e=d((()=>[r.title,r.visible,r.legendEnabled]),(()=>this._constructLegendElementsForWMSSublayers()));if(this.addHandles(e,"wms-sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled){const e=await this._generateSymbolTableElementForWMSSublayer(r,t);e?.infos.length&&i.unshift(e)}}return i}async _generateSymbolTableElementForWMSSublayer(e,t){if(!e.legendUrl&&e.sublayers){const s=(await this._generateLegendElementsForWMSSublayers(e.sublayers,t)).filter((e=>e));return{type:"symbol-table",title:e.title,infos:s}}return this._generateSymbolTableElementForLegendUrl(e,t)}async _generateSymbolTableElementForLegendUrl(e,t){let s=e.legendUrl;if(!s)return;const l={type:"symbol-table",title:e.title||e.name||String(e.id??""),infos:[]};t&&(s=f(s,t));let r=null;const n=e.layer?.opacity;try{r=(await i(s,{responseType:"image"})).data,r&&(r.style.opacity=n)}catch{}return l.infos.push({src:s,preview:r,opacity:n}),l}_getLegendLayers(e,t){const s=Xe&&Xe[e];return s?Promise.resolve(s):this._legendRequest(t).then((t=>{const s=t.layers;return Xe[e]=s,s}))}_legendRequest(e){const t=this.layer;let s={f:"json",dynamicLayers:e};if(Ne(t)){const e=t.exportImageServiceParameters.rasterFunction;if(e&&(s.renderingRule=JSON.stringify(e.functionDefinition?.toJSON()||e.toJSON())),t.bandIds&&(s.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:i,customParameters:l}=t;s={raster:e,viewId:i,...s,...l}}}let l=t.url.replace(/(\/)+$/,"");if("version"in t&&+t.version>=10.01){const e=l.indexOf("?");e>-1?l=l.slice(0,e)+"/legend"+l.slice(e):l+="/legend"}else{const e=l.toLowerCase().indexOf("/rest/"),t=-1===e?l:l.slice(0,e)+l.slice(e+5);l=ce+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return i(l,{query:s}).then((e=>e.data))}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this.removeHandles("sublayers-watcher");const e=this.layer;this.addHandles(d((()=>e.sublayers),(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){o.getLogger(this).warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForBuildingSublayers(e,t){let s=[];this.addHandles(e.on("change",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");const i=e.toArray();for(const l of i){const e=d((()=>["renderer"in l&&l.renderer,l.opacity,l.title,l.visible]),(()=>this._constructLegendElementsForBuildingSceneLayer()));if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||l.visible){const e=null!=l?.opacity?l.opacity:null,i=null!=e?e*t:t;if("building-group"===l.type){const e={type:"symbol-table",title:l.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(l.sublayers,i);e.infos.push(...t),s=[e,...s]}else if(l.renderer){s=[...await this._getRendererLegendElements(l.renderer,{title:l.title,opacity:i,sublayer:l}),...s]}}}return s.filter((e=>!!e&&(!("infos"in e)||!e.infos||e.infos.length>0)))}async _constructLegendElementsForSublayers(){this.legendElements=[],this.removeHandles("sublayers-watcher");const e=this.layer;if(ke(e)||Be(e)||Pe(e)){this.addHandles(d((()=>e.sublayers),(()=>this._constructLegendElementsForSublayers)),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){o.getLogger(this).warn("Request to server for legend has failed!",t)}}}async _generateLegendElementsForSublayers(e,t,s){const i=this.layer;let l=[];this.addHandles(e.on("change",(()=>this._constructLegendElementsForSublayers())),"sublayers-watcher");let n=e.toArray();!s&&this.sublayerIds&&this.sublayerIds.length&&(n=Pe(i)?this.sublayerIds.map((e=>i.findSublayerForSubtypeCode(e))).filter(r):this.sublayerIds.map((e=>i.findSublayerById(e))).filter(r));for(const r of n){const e=d((()=>[r.renderer,r.opacity,r.title,r.visible,r.legendEnabled]),(()=>this._constructLegendElementsForSublayers()));if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled&&this._isSublayerInScale(r)){const e=null!=r?.opacity?r.opacity:null,i=null!=e?e*t:t,n=!Je(r)||r.originIdOf("renderer")>S.SERVICE&&!r.sublayers;if(r.renderer&&n){await r.load();l=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:i,sublayer:r}),...l]}else if(Je(r)){const e=await this._generateSymbolTableElementForSublayer(r,i,s);e&&l.unshift(e)}}}return l.filter((e=>!!e&&(!("infos"in e)||!e.infos||e.infos.length>0)))}async _generateSymbolTableElementForSublayer(e,t,s){if(!s){s=new Map;const t=this.layer,i=e.source;let l=null;if(!(!i||"map-layer"===i.type&&i.mapLayerId===e.id&&(!i.gdbVersion||i.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>S.SERVICE||e.originIdOf("labelingInfo")>S.SERVICE||e.originIdOf("labelsVisible")>S.SERVICE){const e=new L({layer:this.layer});l=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const r=l||`${t.uid}-default`;(await this._getLegendLayers(r,l)).forEach((e=>s.set(e.layerId,e)))}const i=s.get(e.id);if((!i||i?.subLayerIds&&i.defaultVisibility)&&e.sublayers){const i=await this._generateLegendElementsForSublayers(e.sublayers,t,s);return{type:"symbol-table",title:e.title,infos:i}}return this._generateSymbolTableElementForLegendLayer(i,e,t)}_generateSymbolTableElementForLegendLayer(e,t,s){if(!e?.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const i=t?.renderer;let l=t?.title||e.layerName;if(i&&(!t||t?.originIdOf("renderer")>S.SERVICE)){const e=t?.title||this._getRendererTitle(i,t);e&&(l&&"string"!=typeof e&&"title"in e&&(e.title=l),l=e)}const r={type:"symbol-table",title:l,legendType:e.legendType||null,infos:[]},n=t?this._sanitizeLegendForSublayer(e.legend.slice(),t):e.legend;return e.legendGroups&&e.legendGroups.length>0?e.legendGroups.forEach((t=>{const i={type:"symbol-table",title:t.heading,legendType:e.legendType||null,infos:this._generateSymbolTableElementInfosForLegendLayer(n.filter((e=>e.groupId===t.id)),e.layerId,s)};i.infos?.length>0&&r.infos.push(i)})):r.infos=this._generateSymbolTableElementInfosForLegendLayer(n,e.layerId,s),r.infos.length>0?r:null}_generateSymbolTableElementInfosForLegendLayer(e,t,i){return e.map((e=>{let l=e.url;if(e.imageData&&e.imageData.length>0)l=`data:image/png;base64,${e.imageData}`;else{if(0===l.indexOf("http"))return null;l=s(`${this.layer.url}/${t}/images/${l}`)}return{label:e.label,src:l,opacity:i??this.opacity,width:e.width,height:e.height}})).filter(r)}_isSublayerInScale(e){const t=e.minScale||0,s=e.maxScale||0;return!(t>0&&t<this.scale||s>this.scale)}_isLegendLayerInScale(e,t){const s=t||this.layer;let i=null,l=null,r=!0;return!s.minScale&&0!==s.minScale||!s.maxScale&&0!==s.maxScale?(0===e.minScale&&s.tileInfo&&(i=s.tileInfo.lods[0].scale),0===e.maxScale&&s.tileInfo&&(l=s.tileInfo.lods[s.tileInfo.lods.length-1].scale)):(i=Math.min(s.minScale,e.minScale)||s.minScale||e.minScale,l=Math.max(s.maxScale,e.maxScale)),(i>0&&i<this.scale||l>this.scale)&&(r=!1),r}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&+this.layer.version<10.1||0===e.length)return e;const s=t.renderer,i=e.some((e=>e.values));let l=0,r=null;return i&&e.some(((e,t)=>(e.values||(l=t,r=e,r.label||(r.label="others")),null!=r))),s?"unique-value"===s.type?r&&(e.splice(l,1),e.push(r)):"class-breaks"===s.type&&(r&&e.splice(l,1),s.legendOptions?.order||e.reverse(),r&&e.push(r)):r&&(e.splice(l,1),e.push(r)),e}async _getRendererLegendElements(e,t={}){if(!je(e,this.view))return o.getLogger(this).warn(`Renderer of type '${e.type}' not supported!`),[];if(Fe(e))return this._constructPointCloudRendererLegendElements(e,t);if(ze(e))return this._constructDotDensityRendererLegendElements(e);const s=await this._loadRenderer(e);return Te(s)?this._constructPieChartRendererLegendElements(s):this._constructRendererLegendElements(s,t)}async _getLegendElementsForFeatureReduction(e){let t=null;return"binning"===e.type?t=e.renderer:"cluster"===e.type&&(t=this._getClusterRenderer(e)),t?this._getRendererLegendElements(t):[]}_getPointCloudRendererTitle(e){return(e.legendOptions?.title||e.field)??""}async _constructPointCloudRendererLegendElements(e,t={}){const s=t.title,i=[];let l=null,r=null;if(Ve(e))l={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach((e=>{l.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(fe,e.color)})}));else if(De(e)){const t=e.stops;let i=null;if(t?.length&&(1===t.length&&(i=t[0].color),!i)){const e=t[0].value,s=t[t.length-1].value;if(null!=e&&null!=s){i=q(e+(s-e)/2,t)}}l={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(fe,i||fe.color)}]};const n=$(e.stops??[])??[];r={type:"color-ramp",title:s||this._getPointCloudRendererTitle(e),infos:n,preview:A(n.map((e=>e.color)),{ariaLabel:await Qe("previewColorRampAriaLabel")})}}else xe(e)&&(l={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos?.forEach((e=>{l.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(fe,e.color)})})));l?.infos.length&&i.push(l),r?.infos.length&&i.push(r);const n=i.reduce(((e,t)=>[...e,...t.infos??[]]),[]).filter((e=>!!e.symbol)).map((t=>this._getSymbolPreview(t,this.opacity,{symbolConfig:{applyColorModulation:!!e.colorModulation}})));return await Promise.allSettled(n),i}async _getElementInfoForDotDensity(e,t){const{color:s,label:i,valueExpressionTitle:l}=t,{backgroundColor:r,outline:n,dotSize:a}=e,o=this.effectList,u=o?.effects.map((e=>e.toJSON())),c=w(u),d=await Qe("previewTemplateAriaLabel",i||l),y=a+"-"+s+"-"+r+"-"+(n&&JSON.stringify(n.toJSON()))+"-"+c,h=this._dotDensityUrlCache,m=h.has(y)?h.get(y):M(e,s,{ariaLabel:d});h.set(y,m);const p={shape:{type:"image",x:0,y:0,width:m.width,height:m.height,src:m.src},fill:null,stroke:null,offset:[0,0]},f=P([[p]],[m.width,m.height],{effectView:this.effectList,ariaLabel:d});return{opacity:1,src:m.src,preview:f,width:m.width,height:m.height}}async _constructDotDensityRendererLegendElements(e){const t=e.calculateDotValue(this.view.scale),s=e.legendOptions?.unit,i={type:"symbol-table",title:{value:t&&Math.round(t),unit:s||""},infos:[]};for(const l of e.attributes){const t=await this._getElementInfoForDotDensity(e,l);t.label=l.label||l.valueExpressionTitle||l.field,i.infos.push(t)}return[i]}async _constructPieChartRendererLegendElements(e){const t=this.layer.opacity,s=[];let i=null;const l=e.outline;e.attributes.forEach((e=>{const t=new T({color:e.color,outline:l}),i=e.label||e.valueExpressionTitle||e.field;s.push({label:i,symbol:t})}));const r=s.length?[...s]:[];if(e.othersCategory?.color&&0!==e.othersCategory?.threshold){const t=new T({color:e.othersCategory.color,outline:l});i=e.othersCategory.label||"Other",s.push({label:i,symbol:t})}if(e.defaultColor?.a){const t=new T({color:e.defaultColor,outline:l});s.push({label:e.defaultLabel,symbol:t})}const n=await this._getVisualVariableLegendElements(e,this.layer)||[];if(s.length){n.unshift({type:"symbol-table",title:null,infos:s});const t=r.filter((e=>e.label!==i)).map((e=>e.symbol.color)).filter(Boolean),a=U(t,{holePercentage:e.holePercentage,backgroundColor:e.backgroundFillSymbol?.color,effectList:this.effectList,outline:l,ariaLabel:await Qe("previewPieChartAriaLabel")});n.unshift({type:"pie-chart-ramp",title:this._getRendererTitle(e,this.layer),infos:s,preview:a})}const a=n.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol&&!e?.preview)).map((e=>this._getSymbolPreview(e,t,{effectList:this.effectList})));return await Promise.allSettled(a),n}async _getWhereClause(e,t,s,i){const l=await p(e,s),r=await E(t,s),n=new Set(r.map((e=>e.toLowerCase()))),a=l?.fieldNames.map((e=>e.toLowerCase()));return a?.some((e=>!n.has(e)))?(a?.length&&o.getLogger(this).warnOnce(`${i} will be ignored in the Legend, as fields in the expression do not match with renderer fields`),null):l}async _processDefinitionExpression(e,t){if(!("definitionExpression"in e))return;const s=e.definitionExpression;s&&this.respectLayerDefinitionExpression?this._layerDefinitionExpression!==s&&(this._layerDefinitionExpressionClause=await this._getWhereClause(s,t,e.fieldsIndex,"Definition Expression")):this._layerDefinitionExpressionClause=null,this._layerDefinitionExpression=s}async _processDisplayFilter(e,t){if(!("displayFilterInfo"in e))return;const s=e.displayFilterInfo?v(e.displayFilterInfo,this.view):null;s?.where&&this.respectLayerDisplayFilter?this._layerDisplayFilterId!==s?.id&&(this._layerDisplayFilterClause=await this._getWhereClause(s.where,t,e.fieldsIndex,"Display Filter")):this._layerDisplayFilterClause=null,this._layerDisplayFilterId=s?.id}async _constructRendererLegendElements(e,t={}){const{title:s,sublayer:i}=t,l=i||this.layer,r=te(e);Ce(e)&&(await this._processDefinitionExpression(l,e),await this._processDisplayFilter(l,e)),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const n=await this._getVisualVariableLegendElements(e,l)||[],a={type:"symbol-table",title:s||this._getRendererTitle(e,l),infos:[]};let o=null,u=!1;const c=new Set;if(be(e)&&!this._hasSizeRamp){const t=await se(e);a.infos.push({label:null,symbol:t})}else if(We(e)){let t=s;const i=Ge(e)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",l=n.findIndex((e=>"color-ramp"===e.type)),r=-1!==l?n.splice(l,1)[0]:null,a=n.findIndex((e=>"size-ramp"===e.type)),o=-1!==a?n.splice(a,1)[0]:null,u=[];r&&(t=r.title,u.push(r)),o&&(t=o.title,u.push(o)),u.length>0&&n.push({type:i,title:t,infos:u})}else if(Ie(e)){const t=G(e);n.push({type:"heatmap-ramp",title:s||this._getRendererTitle(e,l),infos:t,preview:A(t.map((e=>e.color)),{effectList:this.effectList,ariaLabel:await Qe("previewColorRampAriaLabel")})})}else if(Ce(e)){const t=e.authoringInfo;if(t&&"relationship"===t.type){const{numClasses:s,field1:i,field2:r}=t,o=t.focus;if(s&&i&&r){const t=[i,r];let u=J(o)||0;for(const e of t){const{field:t,normalizationField:s,label:i}=e,r=i||{field:this._getFieldAlias(t,l),normField:s&&this._getFieldAlias(s,l)},n=Ke.clone();n.angle=u,a.infos.push({label:r,symbol:n}),c.add(n),u+=90}const d=Q({focus:o,numClasses:s,infos:e.uniqueValueInfos??[]});n.unshift(d)}}else if(Ne(this.layer)||qe(this.layer))e.uniqueValueInfos?.forEach((t=>{t.symbol&&this._checkClausesForUVR(e,t.value)&&a.infos.push({label:t.label||t.value,value:t.value,symbol:t.symbol})}));else{const{field:t,field2:i,field3:n,fieldDelimiter:o,valueExpression:c,defaultSymbol:d}=e,y=!(!t&&!c||!i&&!n),h=[];if(e.uniqueValueGroups?.forEach((s=>{const a={type:"symbol-table",title:s.heading,infos:[]};s.classes?.forEach((s=>{const{symbol:u,values:d}=s;if(u){const h=[],m=[];for(const e of d??[]){const{value:s,value2:r,value3:a}=e,u=[],d=[];(t||c)&&(u.push(s),d.push(this._getDomainName(t,s,l))),i&&(u.push(r),d.push(this._getDomainName(i,r,l))),n&&(u.push(a),d.push(this._getDomainName(n,a,l))),h.push(y?u.join(o||""):u[0]),m.push(d.join(" - "))}const p=h.join(", ");let f=s.label;if(!f){const e=m.filter(Boolean);f=e.length?e.join(", "):p}const g=u.clone();"cim"===g.type&&r&&x(g,{innerDotSize:.5*ue,outerRingSize:ue}),h.some((t=>this._checkClausesForUVR(e,t)))&&a.infos.push({label:f,value:p,symbol:g})}})),a.infos.length&&h.push(a)})),h.length){const t=h[0];1===h.length&&"title"in t&&!t.title?a.infos.push(...t.infos??[]):(d&&(h.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:d}]}),u=!0),a.infos.push(...h)),s||e.legendOptions?.title||e.valueExpressionTitle||(a.title=null)}}e.defaultSymbol&&!u&&(a.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),u=!0)}else if(Ee(e)){if(!r){o=this._isUnclassedRenderer(e);if(!o||!this._hasSizeRamp){const t=e.classBreakInfos.filter((({symbol:e})=>e)),s="ascending-values"===e.legendOptions?.order;for(const{label:e,minValue:i,maxValue:l,symbol:r}of t){const t={label:e||(o?null:`${i} - ${l}`),value:[i,l],symbol:r};s?a.infos.push(t):a.infos.unshift(t)}o&&(a.title=null),this._updateInfosForClassedSizeRenderer(e,a.infos)}e.defaultSymbol&&!o&&(a.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),u=!0)}}else if(we(e))if(qe(this.layer)||$e(this.layer)){const t=await this._constructTileImageryStretchRendererElements(e);He(t)?n.push(t):a.infos=t}else{const t=this.layer;let s,i;e.customStatistics?.length&&({min:s,max:i}=e.customStatistics[0]);let l=[],r=t.serviceRasterInfo;if(t.rasterFunction)try{r=await t.generateRasterInfo(t.rasterFunction)}catch{}const o=I(r.pixelType);if(1===r.bandCount){const l=t.bandIds?.[0]||0;s=null!=s?s:r.statistics?r.statistics[l].min:o[0],i=null!=i?i:r.statistics?r.statistics[l].max:o[1],s||i?n.push(await this._getStretchLegendElements(e,{min:s,max:i})):this._getServerSideLegend()}else if(t.bandIds&&1===t.bandIds.length)s=null!=s?s:r.statistics?r.statistics[t.bandIds[0]].min:o[0],i=null!=i?i:r.statistics?r.statistics[t.bandIds[0]].max:o[1],s||i?n.push(await this._getStretchLegendElements(e,{min:s,max:i})):this._getServerSideLegend();else if(r.bandCount>=3){const{bandInfos:e}=r,{bandIds:s}=t;e.length>=r.bandCount?3===s?.length?(l=s.map((t=>e[t].name)),a.infos=this._createSymbolTableElementMultiBand(l)):"lerc"===t.format?(l=[0,1,2].map((t=>e[t].name)),a.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend():"lerc"===t.format?(l=["band1","band2","band3"],a.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend()}else this._getServerSideLegend()}else if(_e(e))e.colormapInfos.forEach((e=>{a.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(ge,e.color)})}));else if(Le(e)){let s=e.symbol;switch(t.geometryType){case"point":s="pointSymbol"in l?l.pointSymbol:null;break;case"polyline":s="lineSymbol"in l?l.lineSymbol:null;break;case"polygon":s="polygonSymbol"in l?l.polygonSymbol:null}const i=this._hasClusterSizeVariable&&this._getClusterSymbol()||!this._hasSizeRamp;e.symbol&&i&&a.infos.push({label:e.label,symbol:s})}else if(Se(e)){e.outputUnit&&(this.title="("+e.toJSON().outputUnit+")"),a.title=e.attributeField;const t=e.getClassBreakInfos();t?.length?t.forEach((e=>{a.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})})):a.infos.push({label:e.attributeField,symbol:e.getDefaultSymbol()})}else ve(e)&&n.push(await this._getStretchLegendElements(e,{min:0,max:255}));const d=e.defaultSymbol;!d||u||Le(e)||o&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||n.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:d}]}),a.infos.length&&n.unshift(a);const y=null==t.opacity?this.opacity:t.opacity,h=this._isTallSymbol("visualVariables"in e?e.visualVariables:null),m=Ne(this.layer)||qe(this.layer),p=n.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol)).filter((e=>{if("cim"===e.symbol.type){const{minScale:t,maxScale:s}=e.symbol.data;if(t&&t<this.scale||s&&s>this.scale)return!1}return!0})).map((e=>this._getSymbolPreview(e,y,{isDefault:e.symbol===d,applyScaleDrivenSize:!c.has(e.symbol),symbolConfig:{isTall:h,isSquareFill:m},effectList:c.has(e.symbol)?null:this.effectList})));return e=null,await Promise.allSettled(p),n}_checkClausesForUVR(e,t){const s=Ze(e,t);return!s||(!this._layerDefinitionExpressionClause||this._layerDefinitionExpressionClause.testFeature(s))&&(!this._layerDisplayFilterClause||this._layerDisplayFilterClause.testFeature(s))}_getServerSideLegend(){setTimeout((()=>this.buildLegendElementsForTools()),0)}_getAllInfos(e){const t=e?.infos;return t?t.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]):[e]}async _constructTileImageryStretchRendererElements(e){const t=this.layer,s=t.symbolizer.rasterInfo??t.raster.rasterInfo;let i,l;const r=e?.customStatistics?.length?e.customStatistics:s?.statistics;if(r)({min:i,max:l}=r[0]);else{const e=I(s.pixelType);i=e[0],l=e[1]}if(t.hasStandardTime()&&(i=t.getStandardTimeValue(i),l=t.getStandardTimeValue(l)),1===s.bandCount||1===t.bandIds?.length)return this._getStretchLegendElements(e,{min:i,max:l});const n=(t?.bandIds?.length?t.bandIds:Array.from(Array(Math.min(s.bandCount,3)).keys())).map((e=>s.bandInfos[e].name));return n.length<3?n.push(n[1]):n.length>3&&n.splice(3),this._createSymbolTableElementMultiBand(n)}async _getStretchLegendElements(e,t){const s=e.colorRamp,i=H(s,t);return{type:"stretch-ramp",title:"",infos:i,preview:A(i.map((e=>e.color)),{ariaLabel:await Qe("previewColorRampAriaLabel")})}}_getClusterSymbol(){const e=this.layer,t="featureReduction"in e&&e.featureReduction,s=t&&"symbol"in t&&t.renderer;return s&&!0!==s?.authoringInfo?.isAutoGenerated?null:t&&"symbol"in t?t.symbol:null}async _getSizeLegendElement(e,t,s,i){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(t):e,infos:await Z(s,t,await ie(s),this.scale,this.view,i,this._hasClusterSizeVariable?this._getClusterSymbol():null)}}_createSymbolTableElementMultiBand(e){const t=[],s=["red","green","blue"];return e.forEach(((e,i)=>{t.push({label:{colorName:s[i],bandName:e},src:le[i],opacity:this.opacity??1})})),t}_updateInfosForClassedSizeRenderer(e,t){const s=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,i=e.classBreakInfos.some((e=>B(e.symbol)));if(s&&i){const s=K,i=X,l=e.classBreakInfos.length,r=(s-i)/(l>1?l-1:l);t.forEach(((e,t)=>{e.size=s-r*t}))}}_isTallSymbol(e){let t=!1,s=!1;if(e)for(let i=0;i<e.length&&(!t||!s);i++){const l=e[i];"size"===l.type&&("height"===l.axis&&(t=!0),"width-and-depth"===l.axis&&(s=!0))}return t&&s}async _getSymbolPreview(e,t,s){let i=!s?.isDefault&&null==e.size&&this._hasSizeRamp?m(O.size):e.size;if(this._scaleDrivenSizeVariable&&s?.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");i=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}const l=!s?.isDefault&&this._hasSizeRamp||!(!this._scaleDrivenSizeVariable||!s?.applyScaleDrivenSize);return k(e.symbol,{size:i,opacity:t,scale:!1,symbolConfig:s?.symbolConfig,effectView:s?.effectList,style:"legend",cimOptions:{allowScalingUp:l,viewParams:this.isScaleDriven?{viewingMode:"2d"===this.view?.type?"map":this.view?.viewingMode,scale:this.view?.scale}:null},ariaLabel:e.label&&"string"!=typeof e.label?null:await Qe("previewTemplateAriaLabel",e.label)}).then((t=>(e.preview=t,e))).catch((()=>(e.preview=null,e)))}_getClusterRenderer(e){this._hasClusterSizeVariable=!1;const t="renderer"in this.layer?this.layer.renderer:null,s=e.renderer?.clone()||t?.clone(),i=N(e,this.layerView,this.view);if(i&&null!=s&&"visualVariables"in s){const t=s.visualVariables?.some((e=>"size"===e.type&&"outline"!==e.target&&!me.test(e.valueExpression)));if(!t){if("clusterMinSize"in e&&"clusterMaxSize"in e){const{clusterMinSize:t,clusterMaxSize:s}=e;i.legendOptions=new D({showLegend:t!==s})}const t=s.visualVariables||[];s.visualVariables=t.concat([i]),this._hasClusterSizeVariable=!0}}return s}async _loadRenderer(e){const t=[],s=e.clone(),i=await ie(s);if(Ee(s)||Ce(s)){const e=(s.classBreakInfos||s.uniqueValueInfos).map((e=>this._fetchSymbol(e.symbol,i).then((t=>{e.symbol=t})).catch((()=>{e.symbol=null}))));Array.prototype.push.apply(t,e)}return t.push(this._fetchSymbol(s.symbol||s.defaultSymbol,s.defaultSymbol?null:i).then((e=>{this._applySymbolToRenderer(s,e,Le(s))})).catch((()=>{this._applySymbolToRenderer(s,null,Le(s))}))),await Promise.allSettled(t),s}_applySymbolToRenderer(e,t,s){s?e.symbol=t:e.defaultSymbol=t}async _fetchSymbol(e,t){if(!e)throw new Error;if("web-style"===e.type){const s=this._webStyleSymbolCache;try{const i=await("2d"===this.view.type?e.fetchCIMSymbol({cache:s}):e.fetchSymbol({cache:s}));return this._getAppliedCloneSymbol(i,t)}catch{throw o.getLogger(this).warn("Fetching web-style failed!"),new Error}}return this._getAppliedCloneSymbol(e,t)}_getAppliedCloneSymbol(e,s){if(!e||!s)return e;const i=e.clone(),l=s&&s.toRgba();return i.type.includes("3d")?this._applyColorTo3dSymbol(i,l):"cim"===i.type?j(i,s):i.color&&(i.color=new t(l||i.color)),i}_applyColorTo3dSymbol(e,s){s&&e.symbolLayers.forEach((e=>{e&&(e.material||(e.material={}),e.material.color=new t(s))}))}async _getVisualVariableLegendElements(e,t){if(!("visualVariables"in e)||"vector-field"===e.type)return null;const s=e.visualVariables??[],i=[],l=[],n=[],a=te(e);if(2===a?.sizeStops?.length&&(Ee(e)||Ce(e))){const[e,t]=a.sizeStops;l.push(new V({field:a.field??void 0,normalizationField:a.normalizationField,minSize:e.size,maxSize:t.size,minDataValue:e.value,maxDataValue:t.value}))}for(const r of s)"color"===r.type?i.push(r):"size"===r.type?l.push(r):"opacity"===r.type&&n.push(r);const o=[...i,...l,...n];let u,c;if(0===i.length&&Ee(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];u=t&&t.symbol}if(0===i.length&&Le(e)&&(u=e.symbol),u)if(u.type.includes("3d")){const e=u.symbolLayers.at(0);"water"===e.type?null!=e.color&&(c=e.color):null!=e.material?.color&&(c=e.material.color)}else u.url||(c=u.color);const d=this.effectList;return(await Promise.all(o.map((async s=>{if(!s.legendOptions||!1!==s.legendOptions.showLegend){const i=be(e)?s.field:this._getRampTitle(s,t);let l=null;const r=re(t,s,this.view.timeZone);if("color"===s.type){const e=await W(s,null,r)??[];l={type:"color-ramp",title:i,infos:e,preview:A(e.map((e=>e.color)),{effectList:d,ariaLabel:await Qe("previewColorRampAriaLabel")})},this._hasColorRamp||(this._hasColorRamp=e.length>0)}else if("size"===s.type&&"outline"!==s.target)me.test(s.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=s):(l=await this._getSizeLegendElement(i,s,e,r),this._hasSizeRamp||(this._hasSizeRamp=!(null==l.infos||!l.infos.length)));else if("opacity"===s.type){const e=await W(s,c,r)??[];l={type:"opacity-ramp",title:i,infos:e,preview:A(e.map((e=>e.color)),{effectList:d,ariaLabel:await Qe("previewColorRampAriaLabel")})},this._hasOpacityRamp||(this._hasOpacityRamp=e.length>0)}return l?.infos?l:null}})))).filter(r)}_getDomainName(e,t,s){if(e&&"function"!=typeof e){const i="getField"in s&&s.getField?.(e),l=i&&"getFieldDomain"in s&&s.getFieldDomain?s.getFieldDomain(i.name,{excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")}):null;return"coded-value"===l?.type?l.getName(t):null}return null}_getClusterTitle(e){const t=this.layer,s=e.field;if("featureReduction"in t&&t.featureReduction&&"cluster"===t.featureReduction.type){const e=t.featureReduction,i="popupTemplate"in e&&e.popupTemplate,l=i&&i.fieldInfos;if(l)for(const t of l)if(t.fieldName===s)return"cluster_count"===s?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let s=e.field,i=e.normalizationField,l=!1,r=!1,n=!1,a=null;s="function"==typeof s?null:s,i="function"==typeof i?null:i;const o=e.legendOptions?.title;if(null!=o)a=o;else if(e.valueExpressionTitle)a=e.valueExpressionTitle;else{if("renderer"in t&&t.renderer&&"authoringInfo"in t.renderer&&t.renderer.authoringInfo?.visualVariables){const e=t.renderer.authoringInfo.visualVariables;for(let t=0;t<e.length;t++){const s=e[t];if("color"===s.type){if("ratio"===s.style){l=!0;break}if("percent"===s.style){r=!0;break}if("percent-of-total"===s.style){n=!0;break}}}}a={field:s&&this._getFieldAlias(s,t),normField:i&&this._getFieldAlias(i,t),ratio:l,ratioPercent:r,ratioPercentTotal:n}}return a}_getRendererTitle(e,t){const s=e;if(s.legendOptions?.title)return s.legendOptions.title;if(s.valueExpressionTitle)return s.valueExpressionTitle;let i=s.field,l=null,r=null;if(Ee(s)&&(l=s.normalizationField,r="percent-of-total"===s.normalizationType),i="function"==typeof i?null:i,l="function"==typeof l?null:l,Ce(s)){const{field2:e,field3:l,fieldDelimiter:r}=s;let n=i&&this._getFieldAlias(i,t);return e&&(n=`<${n}>${r}<${this._getFieldAlias(e,t)}>`,l&&(n=`${n}${r}<${this._getFieldAlias(l,t)}>`)),n}let n=null;return(i||l)&&(n={field:i&&this._getFieldAlias(i,t),normField:l&&this._getFieldAlias(l,t),normByPct:r}),n}_getFieldAlias(e,t){const s="popupTemplate"in t?t.popupTemplate:null,i=s?.fieldInfos;let l=i?.find((t=>e===t.fieldName)),r=null;"getField"in t&&t.getField?r=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(r=t.fieldsIndex.get(e));let n=null;const a="featureReduction"in t&&t.featureReduction;a&&(l??="popupTemplate"in a?a.popupTemplate?.fieldInfos?.find((t=>e?.toLowerCase()===t.fieldName?.toLowerCase())):void 0,"fields"in a&&a.fields&&(n=a.fields.find((t=>t.name?.toLowerCase()===e?.toLowerCase()))));const o=l||r||n;let u=null;return o&&(u=l?.label||r?.alias||n?.alias||"name"in o&&o.name||"fieldName"in o&&o.fieldName||null),u}_isUnclassedRenderer(e){const t=e.visualVariables;let s=!1;return Ee(e)&&e.classBreakInfos&&1===e.classBreakInfos.length&&t&&(s=e.field?t.some((t=>!(!t||e.field!==t.field||(e.normalizationField||t.normalizationField)&&e.normalizationField!==t.normalizationField))):!!t.length),s}};e([g()],Ye.prototype,"children",void 0),e([g({readOnly:!0})],Ye.prototype,"effectList",null),e([g()],Ye.prototype,"layerView",void 0),e([g()],Ye.prototype,"layer",void 0),e([g()],Ye.prototype,"legendElements",void 0),e([g({readOnly:!0})],Ye.prototype,"opacity",null),e([g()],Ye.prototype,"parent",void 0),e([g({readOnly:!0,dependsOn:[]})],Ye.prototype,"ready",null),e([g()],Ye.prototype,"hideLayersNotInCurrentView",void 0),e([g()],Ye.prototype,"keepCacheOnDestroy",void 0),e([g()],Ye.prototype,"respectLayerDefinitionExpression",void 0),e([g()],Ye.prototype,"respectLayerDisplayFilter",void 0),e([g()],Ye.prototype,"respectLayerVisibility",void 0),e([g({readOnly:!0})],Ye.prototype,"scale",null),e([g()],Ye.prototype,"sublayerIds",void 0),e([g({readOnly:!0})],Ye.prototype,"isScaleDriven",null),e([g()],Ye.prototype,"title",void 0),e([g({readOnly:!0,dependsOn:["ready"],value:0})],Ye.prototype,"version",null),e([g()],Ye.prototype,"view",void 0),Ye=e([b("esri.widgets.Legend.support.ActiveLayerInfo")],Ye);const et=Ye;export{et as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import"../../../intl.js";import{addTokenParameter as i}from"../../../kernel.js";import s from"../../../request.js";import l from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import n from"../../../core/Collection.js";import has from"../../../core/has.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{debounce as u}from"../../../core/promiseUtils.js";import{on as c,watch as d,whenOnce as y,initial as h}from"../../../core/reactiveUtils.js";import{px2pt as m}from"../../../core/screenUtils.js";import{parseWhereClause as p}from"../../../core/sql.js";import{addQueryParameters as f}from"../../../core/urlUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{OriginId as S}from"../../../core/accessorSupport/PropertyOrigin.js";import{EffectView as _}from"../../../layers/effects/EffectView.js";import{effectFunctionsFromJSON as w}from"../../../layers/effects/jsonUtils.js";import{getEffectiveDisplayFilter as v}from"../../../layers/support/displayFilterUtils.js";import{ExportImageParameters as L}from"../../../layers/support/ExportImageParameters.js";import{getRendererFields as E}from"../../../layers/support/fieldUtils.js";import{isFeatureLayer as C}from"../../../layers/support/layerUtils.js";import{getPixelValueRange as I}from"../../../layers/support/rasterFormats/pixelRangeUtils.js";import{fromJSON as F}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as R}from"../../../renderers/support/rendererConversion.js";import V from"../../../renderers/visualVariables/SizeVariable.js";import D from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{updateReferenceSizeSymbol as x}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import z from"../../../symbols/SimpleFillSymbol.js";import T from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as j}from"../../../symbols/support/cimSymbolUtils.js";import{SymbolSizeDefaults as O}from"../../../symbols/support/previewUtils.js";import{renderSymbol as P}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as A,renderDotDensityPreviewHTML as M,renderPieChartPreviewHTML as U,renderPreviewHTML as k}from"../../../symbols/support/symbolUtils.js";import{isVolumetricSymbol as B}from"../../../symbols/support/utils.js";import{getEffectiveClusterSizeVariable as N}from"./clusterUtils.js";import{getColorFromPointCloudStops as q,getRampStopsForPointCloud as $,getStretchRampStops as H,getRampStops as W}from"./colorRampUtils.js";import{getHeatmapRampStops as G}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as J,getRelationshipRampElement as Q}from"./relationshipRampUtils.js";import{getRampStops as Z,realWorldMaxSize as K,realWorldMinSize as X}from"./sizeRampUtils.js";import{specialCharsLessThan as Y,specialCharsGreaterThan as ee,getReferenceSizeAuthoringInfoVisualVariable as te,getSymbolForFlowRenderer as ie,getMedianColor as se,rgbImgSource as le,getDateFormatOptions as re}from"./utils.js";import{formatNumberLabel as ne}from"../../smartMapping/support/utils.js";import{fetchMessageBundle as ae}from"../../../intl/messages.js";import{substitute as oe}from"../../../intl/substitute.js";const ue=16,ce="https://utility.arcgis.com/sharing/tools/legend",de="esri.layers.ImageryLayer",ye="esri.layers.ImageryTileLayer",he="esri.layers.WCSLayer",me=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,pe=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),fe=new T({size:6,outline:{color:[128,128,128,.5],width:.5}}),ge=new z({style:"solid"});function be(e){return"flow"===e.type}function Se(e){return"vector-field"===e.type}function _e(e){return"raster-colormap"===e.type}function we(e){return"raster-stretch"===e.type}function ve(e){return"raster-shaded-relief"===e.type}function Le(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function Ce(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function Ie(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function Fe(e){return Ve(e)||De(e)||xe(e)||Re(e)}function Re(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function Ve(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function De(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function xe(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function ze(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Te(e){return"esri.renderers.PieChartRenderer"===e.declaredClass}function je(e,t){return Le(e)||Ee(e)||Ce(e)||Ie(e)||ze(e)||Te(e)?"2d"===t.type||R(e):we(e)||_e(e)||ve(e)||Ve(e)||De(e)||xe(e)||Se(e)||be(e)}function Oe(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function Pe(e){return"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Ae(e){return"esri.layers.VoxelLayer"===e.declaredClass}function Me(e){return"esri.layers.WMSLayer"===e.declaredClass}function Ue(e){return"esri.layers.WMTSLayer"===e.declaredClass}function ke(e){return"esri.layers.MapImageLayer"===e.declaredClass}function Be(e){return"esri.layers.TileLayer"===e.declaredClass}function Ne(e){return e.declaredClass===de}function qe(e){return e.declaredClass===ye}function $e(e){return e.declaredClass===he}function He(e){return"stretch-ramp"===e.type}function We(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type}function Ge(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type&&"above-and-below"===t?.univariateTheme}function Je(e){return"sublayers"in e}async function Qe(e,t){const i=await ae("esri/widgets/Legend/t9n/Legend");return"previewTemplateAriaLabel"!==e||t||(e="previewAriaLabel"),oe(i[e],{label:t})}function Ze(e,t){const{field:i,field2:s,field3:l,fieldDelimiter:r,valueExpression:n}=e;if(!i)return null;const a=!(!i&&!n||!s&&!l)?t?.toString().split(r||""):[t],o=i?{[i]:a?.[0]}:null;return o&&(s&&(o[s]=a?.[1]),l&&(o[l]=a?.[2])),o}const Ke=new T({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let Xe={},Ye=class extends l{constructor(e){super(e),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._hasClusterSizeVariable=!1,this._layerDefinitionExpression=null,this._layerDefinitionExpressionClause=null,this._layerDisplayFilterId=null,this._layerDisplayFilterClause=null,this.children=new n,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this.addHandles([c((()=>this.children),"change",(t=>{const{added:i,removed:s}=t;i.forEach((t=>{const i=`activeLayerInfo-ready-watcher-${t.layer.uid}`;this.addHandles(d((()=>t.ready),e,h),i)})),s.forEach((e=>this.removeHandles(e.layer.uid))),e()}))]),this.keepCacheOnDestroy||(Xe={})}destroy(){this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(Xe=null),this._layerDefinitionExpressionClause=null}get effectList(){const e=this.layer;let t=null;return"effect"in e&&e.effect&&(t=new _,t.effect=e.effect,t.endTransition(),t.scale=this.scale),t}get opacity(){const e=this.layer.opacity,t=this.parent?.opacity,i=this.layer.parent,s=i&&"uid"in i?this._getParentLayerOpacity(i):null;return null!=t?t*e:null!=s?s*e:e}get ready(){return null===this.layer||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){return this.view?.scale??0}get isScaleDriven(){const e=this.layer;if(null===e)return!1;if("effect"in e&&e.effect&&Array.isArray(e.effect))return!0;if("featureReduction"in e&&e.featureReduction){if("cluster"===e.featureReduction.type)return!0;if("binning"===e.featureReduction.type&&"renderer"in e.featureReduction&&e.featureReduction.renderer)return this._isRendererScaleDriven(e.featureReduction.renderer)}return"renderer"in e&&e.renderer?!!("displayFilterInfo"in e&&e.displayFilterInfo&&Ce(e.renderer))||this._isRendererScaleDriven(e.renderer):this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(e){if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],void this.notifyChange("ready");const t=Array.from(e,(e=>{if(C(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet?.features.length){const t=e.layerDefinition,i=t?.drawingInfo,s=i&&F(i.renderer),l=pe.read(t.geometryType);return s?this._getRendererLegendElements(s,{title:e.name,geometryType:l}):(o.getLogger(this).warn("drawingInfo not available!"),null)}return null}));try{const e=[],i=await Promise.allSettled(t);for(const t of i)if("fulfilled"===t.status)for(const i of t.value??[])e.push(i);this.legendElements=e,this.notifyChange("ready")}catch(i){o.getLogger(this).warn("error while building legend for layer!",i)}}async buildLegendElementsForRenderer(e){try{const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getRendererLegendElements(e):[],this.notifyChange("ready")}catch(t){o.getLogger(this).warn("error while building legend for layer!",t)}}async buildLegendElementsForFeatureReduction(e){try{const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getLegendElementsForFeatureReduction(e):[],this.notifyChange("ready")}catch(t){o.getLogger(this).warn("error while building legend for layer!",t)}}async buildLegendElementsForTools(){const e=this.layer;if(Ae(e))this._constructLegendElementsForVoxelLayer();else if(Ue(e))this._constructLegendElementsForWMTSlayer();else if(Me(e))await this._constructLegendElementsForWMSSublayers();else if(Oe(e))await this._constructLegendElementsForBuildingSceneLayer();else if(ke(e)||Be(e)||Pe(e))await this._constructLegendElementsForSublayers();else{this.removeHandles("imageryLayers-watcher");let t="default";if(Ne(e)){const i=e;t=(i?.rasterFunction?.functionName||"default")+"_"+(e.bandIds?.length?e.bandIds.join(""):"###")}if(qe(e)||"link-chart"===e.type)return;await this._getLegendLayers(`${e.uid}-${t}`).then((async t=>{this.legendElements=[],this.notifyChange("ready");const i=t.map((async t=>{if(Ne(e)){const t=d((()=>[e.rasterFunction,e.bandIds]),(()=>u((async()=>{Xe.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()}))()));this.addHandles(t,"imageryLayers-watcher")}const i=this._generateSymbolTableElementForLegendLayer(t);i?.infos.length&&(Ne(e)&&(i.title=e.title),this.legendElements.push(i)),this.notifyChange("ready")}));await Promise.allSettled(i)})).catch((e=>{o.getLogger(this).warn("Request to server for legend has failed!",e)}))}}async _isLayerInCurrentView(){const e=this.layer,t=this.layerView,i=t&&"createQuery"in t&&"queryFeatureCount"in t;if(!i&&!(t&&"createQuery"in e&&"queryFeatureCount"in e))return!0;await y((()=>!t.updating));const s=i?"createQuery"in t&&t.createQuery():"createQuery"in e&&e.createQuery();if(!s)return!0;s.geometry=this.view.extent;return 0!==(i?"queryFeatureCount"in t&&await t.queryFeatureCount(s):"queryFeatureCount"in e&&await e.queryFeatureCount(s))}_getParentLayerOpacity(e){let t=1;const i=e.parent;return i&&"uid"in i&&(t=this._getParentLayerOpacity(i)),e.opacity*t}_isGroupActive(){return this.children.some((e=>e.ready))}_isRendererScaleDriven(e){if("dot-density"===e.type)return!0;const t="valueExpression"in e?e.valueExpression:null;if(me.test(t))return!0;const i="visualVariables"in e?e.visualVariables:null;return!!i?.some((e=>this._isScaleDrivenSizeVariable(e)))||this._hasScaleDrivenSymbols(e)}_hasScaleDrivenSymbols(e){switch(e.type){case"simple":return this._isScaleDrivenSymbol(e.symbol);case"class-breaks":return this._isScaleDrivenSymbol(e.defaultSymbol)||e.classBreakInfos.some((e=>this._isScaleDrivenSymbol(e.symbol)));case"unique-value":return this._isScaleDrivenSymbol(e.defaultSymbol)||!!e.uniqueValueInfos?.some((e=>this._isScaleDrivenSymbol(e.symbol)))}return!1}_isScaleDrivenSymbol(e){if("cim"===e?.type){const{primitiveOverrides:t,minScale:i,maxScale:s}=e.data,l=t?.some((e=>/\$view\.scale/.test(e.valueExpressionInfo?.expression||"")))??!1;return null!=i||null!=s||l}return!1}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,i=t.minSize,s=t.maxSize;return!("object"!=typeof i||!i||!this._isScaleDrivenSizeVariable(i))||(!("object"!=typeof s||!s||!this._isScaleDrivenSizeVariable(s))||me.test(t.valueExpression))}_isLayerScaleDriven(e){if("minScale"in e&&e.minScale>0||"maxScale"in e&&e.maxScale>0)return!0;if("sublayers"in e&&e.sublayers)return e.sublayers.some((e=>this._isLayerScaleDriven(e)));const t=e.parent;if(!1===e.loaded&&t&&ke(t)&&"source"in e&&e.source&&"map-layer"===e.source.type)for(const i of t.sourceJSON.layers??[])if(i.id===e.source.mapLayerId&&(i.minScale>0||i.maxScale>0))return!0;return!1}async _constructLegendElementsForVoxelLayer(){this.legendElements=[],this.removeHandles("voxel-style-watcher"),this.removeHandles("voxel-current-variable");const e=this.layer;this.addHandles(d((()=>e.currentVariableId),(()=>this._constructLegendElementsForVoxelLayer())),"voxel-current-variable"),this.addHandles(d((()=>e.getVariableStyles()),(()=>this._constructLegendElementsForVoxelLayer())),"voxel-style-watcher");const t=e.getVariableStyle(null),i=[];if(t)if(t.uniqueValues?.length){const e=[];t.uniqueValues.forEach((t=>{t.enabled&&e.push({label:t.label||`${t.value}`,value:t.value,symbol:new z({color:t.color,outline:null})})})),e.length&&i.push({type:"symbol-table",title:t.label,infos:e})}else if(t.transferFunction){const{colorStops:e,stretchRange:s}=t.transferFunction,l=e.toArray().reverse(),r=s.map(((e,t)=>`${0===t?Y:ee} ${ne(e)}`)).reverse(),n=l.map((e=>({color:e.color,value:null,label:null})));n[0].label=r[0],n[n.length-1].label=r[1],i.push({type:"color-ramp",title:t.label,infos:n,preview:A(l.map((e=>e.color)),{ariaLabel:await Qe("previewColorRampAriaLabel")})})}const s=e.opacity,l=i.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol)).map((e=>this._getSymbolPreview(e,s)));await Promise.allSettled(l),this.legendElements=i,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this.removeHandles("wmts-activeLayer-watcher");const e=this.layer.activeLayer;this.addHandles(d((()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer}),(()=>this._constructLegendElementsForWMTSlayer())),"wmts-activeLayer-watcher");const t=e.styleId?e.styles?.find((({id:t})=>t===e.styleId))?.legendUrl:void 0;t&&(this.legendElements=[{type:"symbol-table",title:e.title,infos:[{src:t,opacity:this.opacity}]}]),this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this.legendElements=[],this.removeHandles("wms-sublayers-watcher");const e=this.layer;let t=null;(e.customParameters||e.customLayerParameters)&&(t={...e.customParameters,...e.customLayerParameters}),this.addHandles(d((()=>{const{layer:e}=this;return e&&"sublayers"in e&&e.sublayers}),(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher"),this.legendElements=await this._generateLegendElementsForWMSSublayers(e.sublayers,t),this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(e,t){const i=this.layer,s=[];this.addHandles(e.on("change",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher");const l=this.sublayerIds?.map((e=>i.findSublayerById(e)))?.filter(r)??[],n=l.length?l:e.toArray();for(const r of n){const e=d((()=>[r.title,r.visible,r.legendEnabled]),(()=>this._constructLegendElementsForWMSSublayers()));if(this.addHandles(e,"wms-sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled){const e=await this._generateSymbolTableElementForWMSSublayer(r,t);e?.infos.length&&s.unshift(e)}}return s}async _generateSymbolTableElementForWMSSublayer(e,t){if(!e.legendUrl&&e.sublayers){const i=(await this._generateLegendElementsForWMSSublayers(e.sublayers,t)).filter((e=>e));return{type:"symbol-table",title:e.title,infos:i}}return this._generateSymbolTableElementForLegendUrl(e,t)}async _generateSymbolTableElementForLegendUrl(e,t){let i=e.legendUrl;if(!i)return;const l={type:"symbol-table",title:e.title||e.name||String(e.id??""),infos:[]};t&&(i=f(i,t));let r=null;const n=e.layer?.opacity;try{r=(await s(i,{responseType:"image"})).data,r&&(r.style.opacity=n)}catch{}return l.infos.push({src:i,preview:r,opacity:n}),l}_getLegendLayers(e,t){const i=Xe&&Xe[e];return i?Promise.resolve(i):this._legendRequest(t).then((t=>{const i=t.layers;return Xe[e]=i,i}))}_legendRequest(e){const t=this.layer;let i={f:"json",dynamicLayers:e};if(Ne(t)){const e=t.exportImageServiceParameters.rasterFunction;if(e&&(i.renderingRule=JSON.stringify(e.functionDefinition?.toJSON()||e.toJSON())),t.bandIds&&(i.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:s,customParameters:l}=t;i={raster:e,viewId:s,...i,...l}}}let l=t.url.replace(/(\/)+$/,"");if("version"in t&&+t.version>=10.01){const e=l.indexOf("?");e>-1?l=l.slice(0,e)+"/legend"+l.slice(e):l+="/legend"}else{const e=l.toLowerCase().indexOf("/rest/"),t=-1===e?l:l.slice(0,e)+l.slice(e+5);l=ce+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return s(l,{query:i}).then((e=>e.data))}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this.removeHandles("sublayers-watcher");const e=this.layer;this.addHandles(d((()=>e.sublayers),(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){o.getLogger(this).warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForBuildingSublayers(e,t){let i=[];this.addHandles(e.on("change",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");const s=e.toArray();for(const l of s){const e=d((()=>["renderer"in l&&l.renderer,l.opacity,l.title,l.visible]),(()=>this._constructLegendElementsForBuildingSceneLayer()));if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||l.visible){const e=null!=l?.opacity?l.opacity:null,s=null!=e?e*t:t;if("building-group"===l.type){const e={type:"symbol-table",title:l.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(l.sublayers,s);e.infos.push(...t),i=[e,...i]}else if(l.renderer){i=[...await this._getRendererLegendElements(l.renderer,{title:l.title,opacity:s,sublayer:l}),...i]}}}return i.filter((e=>!!e&&(!("infos"in e)||!e.infos||e.infos.length>0)))}async _constructLegendElementsForSublayers(){this.legendElements=[],this.removeHandles("sublayers-watcher");const e=this.layer;if(ke(e)||Be(e)||Pe(e)){this.addHandles(d((()=>e.sublayers),(()=>this._constructLegendElementsForSublayers)),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){o.getLogger(this).warn("Request to server for legend has failed!",t)}}}async _generateLegendElementsForSublayers(e,t,i){const s=this.layer;let l=[];this.addHandles(e.on("change",(()=>this._constructLegendElementsForSublayers())),"sublayers-watcher");let n=e.toArray();!i&&this.sublayerIds&&this.sublayerIds.length&&(n=Pe(s)?this.sublayerIds.map((e=>s.findSublayerForSubtypeCode(e))).filter(r):this.sublayerIds.map((e=>s.findSublayerById(e))).filter(r));for(const r of n){const e=d((()=>[r.renderer,r.opacity,r.title,r.visible,r.legendEnabled]),(()=>this._constructLegendElementsForSublayers()));if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled&&this._isSublayerInScale(r)){const e=null!=r?.opacity?r.opacity:null,s=null!=e?e*t:t,n=!Je(r)||r.originIdOf("renderer")>S.SERVICE&&!r.sublayers;if(r.renderer&&n){await r.load();l=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:s,sublayer:r}),...l]}else if(Je(r)){const e=await this._generateSymbolTableElementForSublayer(r,s,i);e&&l.unshift(e)}}}return l.filter((e=>!!e&&(!("infos"in e)||!e.infos||e.infos.length>0)))}async _generateSymbolTableElementForSublayer(e,t,i){if(!i){i=new Map;const t=this.layer,s=e.source;let l=null;if(!(!s||"map-layer"===s.type&&s.mapLayerId===e.id&&(!s.gdbVersion||s.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>S.SERVICE||e.originIdOf("labelingInfo")>S.SERVICE||e.originIdOf("labelsVisible")>S.SERVICE){const e=new L({layer:this.layer});l=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const r=l||`${t.uid}-default`;(await this._getLegendLayers(r,l)).forEach((e=>i.set(e.layerId,e)))}const s=i.get(e.id);if((!s||s?.subLayerIds&&s.defaultVisibility)&&e.sublayers){const s=await this._generateLegendElementsForSublayers(e.sublayers,t,i);return{type:"symbol-table",title:e.title,infos:s}}return this._generateSymbolTableElementForLegendLayer(s,e,t)}_generateSymbolTableElementForLegendLayer(e,t,i){if(!e?.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const s=t?.renderer;let l=t?.title||e.layerName;if(s&&(!t||t?.originIdOf("renderer")>S.SERVICE)){const e=t?.title||this._getRendererTitle(s,t);e&&(l&&"string"!=typeof e&&"title"in e&&(e.title=l),l=e)}const r={type:"symbol-table",title:l,legendType:e.legendType||null,infos:[]},n=t?this._sanitizeLegendForSublayer(e.legend.slice(),t):e.legend;return e.legendGroups&&e.legendGroups.length>0?e.legendGroups.forEach((t=>{const s={type:"symbol-table",title:t.heading,legendType:e.legendType||null,infos:this._generateSymbolTableElementInfosForLegendLayer(n.filter((e=>e.groupId===t.id)),e.layerId,i)};s.infos?.length>0&&r.infos.push(s)})):r.infos=this._generateSymbolTableElementInfosForLegendLayer(n,e.layerId,i),r.infos.length>0?r:null}_generateSymbolTableElementInfosForLegendLayer(e,t,s){return e.map((e=>{let l=e.url;if(e.imageData&&e.imageData.length>0)l=`data:image/png;base64,${e.imageData}`;else{if(0===l.indexOf("http"))return null;l=i(`${this.layer.url}/${t}/images/${l}`)}return{label:e.label,src:l,opacity:s??this.opacity,width:e.width,height:e.height}})).filter(r)}_isSublayerInScale(e){const t=e.minScale||0,i=e.maxScale||0;return!(t>0&&t<this.scale||i>this.scale)}_isLegendLayerInScale(e,t){const i=t||this.layer;let s=null,l=null,r=!0;return!i.minScale&&0!==i.minScale||!i.maxScale&&0!==i.maxScale?(0===e.minScale&&i.tileInfo&&(s=i.tileInfo.lods[0].scale),0===e.maxScale&&i.tileInfo&&(l=i.tileInfo.lods[i.tileInfo.lods.length-1].scale)):(s=Math.min(i.minScale,e.minScale)||i.minScale||e.minScale,l=Math.max(i.maxScale,e.maxScale)),(s>0&&s<this.scale||l>this.scale)&&(r=!1),r}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&+this.layer.version<10.1||0===e.length)return e;const i=t.renderer,s=e.some((e=>e.values));let l=0,r=null;return s&&e.some(((e,t)=>(e.values||(l=t,r=e,r.label||(r.label="others")),null!=r))),i?"unique-value"===i.type?r&&(e.splice(l,1),e.push(r)):"class-breaks"===i.type&&(r&&e.splice(l,1),i.legendOptions?.order||e.reverse(),r&&e.push(r)):r&&(e.splice(l,1),e.push(r)),e}async _getRendererLegendElements(e,t={}){if(!je(e,this.view))return o.getLogger(this).warn(`Renderer of type '${e.type}' not supported!`),[];if(Fe(e))return this._constructPointCloudRendererLegendElements(e,t);if(ze(e))return this._constructDotDensityRendererLegendElements(e);const i=await this._loadRenderer(e);return Te(i)?this._constructPieChartRendererLegendElements(i):this._constructRendererLegendElements(i,t)}async _getLegendElementsForFeatureReduction(e){let t=null;return"binning"===e.type?t=e.renderer:"cluster"===e.type&&(t=this._getClusterRenderer(e)),t?this._getRendererLegendElements(t):[]}_getPointCloudRendererTitle(e){return(e.legendOptions?.title||e.field)??""}async _constructPointCloudRendererLegendElements(e,t={}){const i=t.title,s=[];let l=null,r=null;if(Ve(e))l={type:"symbol-table",title:i||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach((e=>{l.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(fe,e.color)})}));else if(De(e)){const t=e.stops;let s=null;if(t?.length&&(1===t.length&&(s=t[0].color),!s)){const e=t[0].value,i=t[t.length-1].value;if(null!=e&&null!=i){s=q(e+(i-e)/2,t)}}l={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(fe,s||fe.color)}]};const n=$(e.stops??[])??[];r={type:"color-ramp",title:i||this._getPointCloudRendererTitle(e),infos:n,preview:A(n.map((e=>e.color)),{ariaLabel:await Qe("previewColorRampAriaLabel")})}}else xe(e)&&(l={type:"symbol-table",title:i||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos?.forEach((e=>{l.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(fe,e.color)})})));l?.infos.length&&s.push(l),r?.infos.length&&s.push(r);const n=s.reduce(((e,t)=>[...e,...t.infos??[]]),[]).filter((e=>!!e.symbol)).map((t=>this._getSymbolPreview(t,this.opacity,{symbolConfig:{applyColorModulation:!!e.colorModulation}})));return await Promise.allSettled(n),s}async _getElementInfoForDotDensity(e,t){const{color:i,label:s,valueExpressionTitle:l}=t,{backgroundColor:r,outline:n,dotSize:a}=e,o=this.effectList,u=o?.effects.map((e=>e.toJSON())),c=w(u),d=await Qe("previewTemplateAriaLabel",s||l),y=a+"-"+i+"-"+r+"-"+(n&&JSON.stringify(n.toJSON()))+"-"+c,h=this._dotDensityUrlCache,m=h.has(y)?h.get(y):M(e,i,{ariaLabel:d});h.set(y,m);const p={shape:{type:"image",x:0,y:0,width:m.width,height:m.height,src:m.src},fill:null,stroke:null,offset:[0,0]},f=P([[p]],[m.width,m.height],{effectView:this.effectList,ariaLabel:d});return{opacity:1,src:m.src,preview:f,width:m.width,height:m.height}}async _constructDotDensityRendererLegendElements(e){const t=e.calculateDotValue(this.view.scale),i=e.legendOptions?.unit,s={type:"symbol-table",title:{value:t&&Math.round(t),unit:i||""},infos:[]};for(const l of e.attributes){const t=await this._getElementInfoForDotDensity(e,l);t.label=l.label||l.valueExpressionTitle||l.field,s.infos.push(t)}return[s]}async _constructPieChartRendererLegendElements(e){const t=this.layer.opacity,i=[];let s=null;const l=e.outline;e.attributes.forEach((e=>{const t=new T({color:e.color,outline:l}),s=e.label||e.valueExpressionTitle||e.field;i.push({label:s,symbol:t})}));const r=i.length?[...i]:[];if(e.othersCategory?.color&&0!==e.othersCategory?.threshold){const t=new T({color:e.othersCategory.color,outline:l});s=e.othersCategory.label||"Other",i.push({label:s,symbol:t})}if(e.defaultColor?.a){const t=new T({color:e.defaultColor,outline:l});i.push({label:e.defaultLabel,symbol:t})}const n=await this._getVisualVariableLegendElements(e,this.layer)||[];if(i.length){n.unshift({type:"symbol-table",title:null,infos:i});const t=r.filter((e=>e.label!==s)).map((e=>e.symbol.color)).filter(Boolean),a=U(t,{holePercentage:e.holePercentage,backgroundColor:e.backgroundFillSymbol?.color,effectList:this.effectList,outline:l,ariaLabel:await Qe("previewPieChartAriaLabel")});n.unshift({type:"pie-chart-ramp",title:this._getRendererTitle(e,this.layer),infos:i,preview:a})}const a=n.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol&&!e?.preview)).map((e=>this._getSymbolPreview(e,t,{effectList:this.effectList})));return await Promise.allSettled(a),n}async _getWhereClause(e,t,i,s){const l=await p(e,i),r=await E(t,i),n=new Set(r.map((e=>e.toLowerCase()))),a=l?.fieldNames.map((e=>e.toLowerCase()));return a?.some((e=>!n.has(e)))?(a?.length&&o.getLogger(this).warnOnce(`${s} will be ignored in the Legend, as fields in the expression do not match with renderer fields`),null):l}async _processDefinitionExpression(e,t){if(!("definitionExpression"in e))return;const i=e.definitionExpression;i&&this.respectLayerDefinitionExpression?this._layerDefinitionExpression!==i&&(this._layerDefinitionExpressionClause=await this._getWhereClause(i,t,e.fieldsIndex,"Definition Expression")):this._layerDefinitionExpressionClause=null,this._layerDefinitionExpression=i}async _processDisplayFilter(e,t){if(!("displayFilterInfo"in e))return;const i=e.displayFilterInfo?v(e.displayFilterInfo,this.view):null;i?.where?this._layerDisplayFilterId!==i?.id&&(this._layerDisplayFilterClause=await this._getWhereClause(i.where,t,e.fieldsIndex,"Display Filter")):this._layerDisplayFilterClause=null,this._layerDisplayFilterId=i?.id}async _constructRendererLegendElements(e,t={}){const{title:i,sublayer:s}=t,l=s||this.layer,r=te(e);Ce(e)&&(await this._processDefinitionExpression(l,e),await this._processDisplayFilter(l,e)),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const n=await this._getVisualVariableLegendElements(e,l)||[],a={type:"symbol-table",title:i||this._getRendererTitle(e,l),infos:[]};let o=null,u=!1;const c=new Set;if(be(e)&&!this._hasSizeRamp){const t=await ie(e);a.infos.push({label:null,symbol:t})}else if(We(e)){let t=i;const s=Ge(e)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",l=n.findIndex((e=>"color-ramp"===e.type)),r=-1!==l?n.splice(l,1)[0]:null,a=n.findIndex((e=>"size-ramp"===e.type)),o=-1!==a?n.splice(a,1)[0]:null,u=[];r&&(t=r.title,u.push(r)),o&&(t=o.title,u.push(o)),u.length>0&&n.push({type:s,title:t,infos:u})}else if(Ie(e)){const t=G(e);n.push({type:"heatmap-ramp",title:i||this._getRendererTitle(e,l),infos:t,preview:A(t.map((e=>e.color)),{effectList:this.effectList,ariaLabel:await Qe("previewColorRampAriaLabel")})})}else if(Ce(e)){const t=e.authoringInfo;if(t&&"relationship"===t.type){const{numClasses:i,field1:s,field2:r}=t,o=t.focus;if(i&&s&&r){const t=[s,r];let u=J(o)||0;for(const e of t){const{field:t,normalizationField:i,label:s}=e,r=s||{field:this._getFieldAlias(t,l),normField:i&&this._getFieldAlias(i,l)},n=Ke.clone();n.angle=u,a.infos.push({label:r,symbol:n}),c.add(n),u+=90}const d=Q({focus:o,numClasses:i,infos:e.uniqueValueInfos??[]});n.unshift(d)}}else if(Ne(this.layer)||qe(this.layer))e.uniqueValueInfos?.forEach((t=>{t.symbol&&this._checkClausesForUVR(e,t.value)&&a.infos.push({label:t.label||t.value,value:t.value,symbol:t.symbol})}));else{const{field:t,field2:s,field3:n,fieldDelimiter:o,valueExpression:c,defaultSymbol:d}=e,y=!(!t&&!c||!s&&!n),h=[];if(e.uniqueValueGroups?.forEach((i=>{const a={type:"symbol-table",title:("displayFilterInfo"in l&&l.displayFilterInfo?v(l.displayFilterInfo,this.view)?.title:null)||i.heading,infos:[]};i.classes?.forEach((i=>{const{symbol:u,values:d}=i;if(u){const h=[],m=[];for(const e of d??[]){const{value:i,value2:r,value3:a}=e,u=[],d=[];(t||c)&&(u.push(i),d.push(this._getDomainName(t,i,l))),s&&(u.push(r),d.push(this._getDomainName(s,r,l))),n&&(u.push(a),d.push(this._getDomainName(n,a,l))),h.push(y?u.join(o||""):u[0]),m.push(d.join(" - "))}const p=h.join(", ");let f=i.label;if(!f){const e=m.filter(Boolean);f=e.length?e.join(", "):p}const g=u.clone();"cim"===g.type&&r&&x(g,{innerDotSize:.5*ue,outerRingSize:ue}),h.some((t=>this._checkClausesForUVR(e,t)))&&a.infos.push({label:f,value:p,symbol:g})}})),a.infos.length&&h.push(a)})),h.length){const t=h[0];1===h.length&&"title"in t&&!t.title?a.infos.push(...t.infos??[]):(d&&(h.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:d}]}),u=!0),a.infos.push(...h)),i||e.legendOptions?.title||e.valueExpressionTitle||(a.title=null)}}e.defaultSymbol&&!u&&(a.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),u=!0)}else if(Ee(e)){if(!r){o=this._isUnclassedRenderer(e);if(!o||!this._hasSizeRamp){const t=e.classBreakInfos.filter((({symbol:e})=>e)),i="ascending-values"===e.legendOptions?.order;for(const{label:e,minValue:s,maxValue:l,symbol:r}of t){const t={label:e||(o?null:`${s} - ${l}`),value:[s,l],symbol:r};i?a.infos.push(t):a.infos.unshift(t)}o&&(a.title=null),this._updateInfosForClassedSizeRenderer(e,a.infos)}e.defaultSymbol&&!o&&(a.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),u=!0)}}else if(we(e))if(qe(this.layer)||$e(this.layer)){const t=await this._constructTileImageryStretchRendererElements(e);He(t)?n.push(t):a.infos=t}else{const t=this.layer;let i,s;e.customStatistics?.length&&({min:i,max:s}=e.customStatistics[0]);let l=[],r=t.serviceRasterInfo;if(t.rasterFunction)try{r=await t.generateRasterInfo(t.rasterFunction)}catch{}const o=I(r.pixelType);if(1===r.bandCount){const l=t.bandIds?.[0]||0;i=null!=i?i:r.statistics?r.statistics[l].min:o[0],s=null!=s?s:r.statistics?r.statistics[l].max:o[1],i||s?n.push(await this._getStretchLegendElements(e,{min:i,max:s})):this._getServerSideLegend()}else if(t.bandIds&&1===t.bandIds.length)i=null!=i?i:r.statistics?r.statistics[t.bandIds[0]].min:o[0],s=null!=s?s:r.statistics?r.statistics[t.bandIds[0]].max:o[1],i||s?n.push(await this._getStretchLegendElements(e,{min:i,max:s})):this._getServerSideLegend();else if(r.bandCount>=3){const{bandInfos:e}=r,{bandIds:i}=t;e.length>=r.bandCount?3===i?.length?(l=i.map((t=>e[t].name)),a.infos=this._createSymbolTableElementMultiBand(l)):"lerc"===t.format?(l=[0,1,2].map((t=>e[t].name)),a.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend():"lerc"===t.format?(l=["band1","band2","band3"],a.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend()}else this._getServerSideLegend()}else if(_e(e))e.colormapInfos.forEach((e=>{a.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(ge,e.color)})}));else if(Le(e)){let i=e.symbol;switch(t.geometryType){case"point":i="pointSymbol"in l?l.pointSymbol:null;break;case"polyline":i="lineSymbol"in l?l.lineSymbol:null;break;case"polygon":i="polygonSymbol"in l?l.polygonSymbol:null}const s=this._hasClusterSizeVariable&&this._getClusterSymbol()||!this._hasSizeRamp;e.symbol&&s&&a.infos.push({label:e.label,symbol:i})}else if(Se(e)){e.outputUnit&&(this.title="("+e.toJSON().outputUnit+")"),a.title=e.attributeField;const t=e.getClassBreakInfos();t?.length?t.forEach((e=>{a.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})})):a.infos.push({label:e.attributeField,symbol:e.getDefaultSymbol()})}else ve(e)&&n.push(await this._getStretchLegendElements(e,{min:0,max:255}));const d=e.defaultSymbol;!d||u||Le(e)||o&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||n.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:d}]}),a.infos.length&&n.unshift(a);const y=null==t.opacity?this.opacity:t.opacity,h=this._isTallSymbol("visualVariables"in e?e.visualVariables:null),m=Ne(this.layer)||qe(this.layer),p=n.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol)).filter((e=>{if("cim"===e.symbol.type){const{minScale:t,maxScale:i}=e.symbol.data;if(t&&t<this.scale||i&&i>this.scale)return!1}return!0})).map((e=>this._getSymbolPreview(e,y,{isDefault:e.symbol===d,applyScaleDrivenSize:!c.has(e.symbol),symbolConfig:{isTall:h,isSquareFill:m},effectList:c.has(e.symbol)?null:this.effectList})));return e=null,await Promise.allSettled(p),n}_checkClausesForUVR(e,t){const i=Ze(e,t);return!i||(!this._layerDefinitionExpressionClause||this._layerDefinitionExpressionClause.testFeature(i))&&(!this._layerDisplayFilterClause||this._layerDisplayFilterClause.testFeature(i))}_getServerSideLegend(){setTimeout((()=>this.buildLegendElementsForTools()),0)}_getAllInfos(e){const t=e?.infos;return t?t.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]):[e]}async _constructTileImageryStretchRendererElements(e){const t=this.layer,i=t.symbolizer.rasterInfo??t.raster.rasterInfo;let s,l;const r=e?.customStatistics?.length?e.customStatistics:i?.statistics;if(r)({min:s,max:l}=r[0]);else{const e=I(i.pixelType);s=e[0],l=e[1]}if(t.hasStandardTime()&&(s=t.getStandardTimeValue(s),l=t.getStandardTimeValue(l)),1===i.bandCount||1===t.bandIds?.length)return this._getStretchLegendElements(e,{min:s,max:l});const n=(t?.bandIds?.length?t.bandIds:Array.from(Array(Math.min(i.bandCount,3)).keys())).map((e=>i.bandInfos[e].name));return n.length<3?n.push(n[1]):n.length>3&&n.splice(3),this._createSymbolTableElementMultiBand(n)}async _getStretchLegendElements(e,t){const i=e.colorRamp,s=H(i,t);return{type:"stretch-ramp",title:"",infos:s,preview:A(s.map((e=>e.color)),{ariaLabel:await Qe("previewColorRampAriaLabel")})}}_getClusterSymbol(){const e=this.layer,t="featureReduction"in e&&e.featureReduction,i=t&&"symbol"in t&&t.renderer;return i&&!0!==i?.authoringInfo?.isAutoGenerated?null:t&&"symbol"in t?t.symbol:null}async _getSizeLegendElement(e,t,i,s){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(t):e,infos:await Z(i,t,await se(i),this.scale,this.view,s,this._hasClusterSizeVariable?this._getClusterSymbol():null)}}_createSymbolTableElementMultiBand(e){const t=[],i=["red","green","blue"];return e.forEach(((e,s)=>{t.push({label:{colorName:i[s],bandName:e},src:le[s],opacity:this.opacity??1})})),t}_updateInfosForClassedSizeRenderer(e,t){const i=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,s=e.classBreakInfos.some((e=>B(e.symbol)));if(i&&s){const i=K,s=X,l=e.classBreakInfos.length,r=(i-s)/(l>1?l-1:l);t.forEach(((e,t)=>{e.size=i-r*t}))}}_isTallSymbol(e){let t=!1,i=!1;if(e)for(let s=0;s<e.length&&(!t||!i);s++){const l=e[s];"size"===l.type&&("height"===l.axis&&(t=!0),"width-and-depth"===l.axis&&(i=!0))}return t&&i}async _getSymbolPreview(e,t,i){let s=!i?.isDefault&&null==e.size&&this._hasSizeRamp?m(O.size):e.size;if(this._scaleDrivenSizeVariable&&i?.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");s=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}const l=!i?.isDefault&&this._hasSizeRamp||!(!this._scaleDrivenSizeVariable||!i?.applyScaleDrivenSize);return k(e.symbol,{size:s,opacity:t,scale:!1,symbolConfig:i?.symbolConfig,effectView:i?.effectList,style:"legend",cimOptions:{allowScalingUp:l,viewParams:this.isScaleDriven?{viewingMode:"2d"===this.view?.type?"map":this.view?.viewingMode,scale:this.view?.scale}:null},ariaLabel:e.label&&"string"!=typeof e.label?null:await Qe("previewTemplateAriaLabel",e.label)}).then((t=>(e.preview=t,e))).catch((()=>(e.preview=null,e)))}_getClusterRenderer(e){this._hasClusterSizeVariable=!1;const t="renderer"in this.layer?this.layer.renderer:null,i=e.renderer?.clone()||t?.clone(),s=N(e,this.layerView,this.view);if(s&&null!=i&&"visualVariables"in i){const t=i.visualVariables?.some((e=>"size"===e.type&&"outline"!==e.target&&!me.test(e.valueExpression)));if(!t){if("clusterMinSize"in e&&"clusterMaxSize"in e){const{clusterMinSize:t,clusterMaxSize:i}=e;s.legendOptions=new D({showLegend:t!==i})}const t=i.visualVariables||[];i.visualVariables=t.concat([s]),this._hasClusterSizeVariable=!0}}return i}async _loadRenderer(e){const t=[],i=e.clone(),s=await se(i);if(Ee(i)||Ce(i)){const e=(i.classBreakInfos||i.uniqueValueInfos).map((e=>this._fetchSymbol(e.symbol,s).then((t=>{e.symbol=t})).catch((()=>{e.symbol=null}))));Array.prototype.push.apply(t,e)}return t.push(this._fetchSymbol(i.symbol||i.defaultSymbol,i.defaultSymbol?null:s).then((e=>{this._applySymbolToRenderer(i,e,Le(i))})).catch((()=>{this._applySymbolToRenderer(i,null,Le(i))}))),await Promise.allSettled(t),i}_applySymbolToRenderer(e,t,i){i?e.symbol=t:e.defaultSymbol=t}async _fetchSymbol(e,t){if(!e)throw new Error;if("web-style"===e.type){const i=this._webStyleSymbolCache;try{const s=await("2d"===this.view.type?e.fetchCIMSymbol({cache:i}):e.fetchSymbol({cache:i}));return this._getAppliedCloneSymbol(s,t)}catch{throw o.getLogger(this).warn("Fetching web-style failed!"),new Error}}return this._getAppliedCloneSymbol(e,t)}_getAppliedCloneSymbol(e,i){if(!e||!i)return e;const s=e.clone(),l=i&&i.toRgba();return s.type.includes("3d")?this._applyColorTo3dSymbol(s,l):"cim"===s.type?j(s,i):s.color&&(s.color=new t(l||s.color)),s}_applyColorTo3dSymbol(e,i){i&&e.symbolLayers.forEach((e=>{e&&(e.material||(e.material={}),e.material.color=new t(i))}))}async _getVisualVariableLegendElements(e,t){if(!("visualVariables"in e)||"vector-field"===e.type)return null;const i=e.visualVariables??[],s=[],l=[],n=[],a=te(e);if(2===a?.sizeStops?.length&&(Ee(e)||Ce(e))){const[e,t]=a.sizeStops;l.push(new V({field:a.field??void 0,normalizationField:a.normalizationField,minSize:e.size,maxSize:t.size,minDataValue:e.value,maxDataValue:t.value}))}for(const r of i)"color"===r.type?s.push(r):"size"===r.type?l.push(r):"opacity"===r.type&&n.push(r);const o=[...s,...l,...n];let u,c;if(0===s.length&&Ee(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];u=t&&t.symbol}if(0===s.length&&Le(e)&&(u=e.symbol),u)if(u.type.includes("3d")){const e=u.symbolLayers.at(0);"water"===e.type?null!=e.color&&(c=e.color):null!=e.material?.color&&(c=e.material.color)}else u.url||(c=u.color);const d=this.effectList;return(await Promise.all(o.map((async i=>{if(!i.legendOptions||!1!==i.legendOptions.showLegend){const s=be(e)?i.field:this._getRampTitle(i,t);let l=null;const r=re(t,i,this.view.timeZone);if("color"===i.type){const e=await W(i,null,r)??[];l={type:"color-ramp",title:s,infos:e,preview:A(e.map((e=>e.color)),{effectList:d,ariaLabel:await Qe("previewColorRampAriaLabel")})},this._hasColorRamp||(this._hasColorRamp=e.length>0)}else if("size"===i.type&&"outline"!==i.target)me.test(i.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=i):(l=await this._getSizeLegendElement(s,i,e,r),this._hasSizeRamp||(this._hasSizeRamp=!(null==l.infos||!l.infos.length)));else if("opacity"===i.type){const e=await W(i,c,r)??[];l={type:"opacity-ramp",title:s,infos:e,preview:A(e.map((e=>e.color)),{effectList:d,ariaLabel:await Qe("previewColorRampAriaLabel")})},this._hasOpacityRamp||(this._hasOpacityRamp=e.length>0)}return l?.infos?l:null}})))).filter(r)}_getDomainName(e,t,i){if(e&&"function"!=typeof e){const s="getField"in i&&i.getField?.(e),l=s&&"getFieldDomain"in i&&i.getFieldDomain?i.getFieldDomain(s.name,{excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")}):null;return"coded-value"===l?.type?l.getName(t):null}return null}_getClusterTitle(e){const t=this.layer,i=e.field;if("featureReduction"in t&&t.featureReduction&&"cluster"===t.featureReduction.type){const e=t.featureReduction,s="popupTemplate"in e&&e.popupTemplate,l=s&&s.fieldInfos;if(l)for(const t of l)if(t.fieldName===i)return"cluster_count"===i?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let i=e.field,s=e.normalizationField,l=!1,r=!1,n=!1,a=null;i="function"==typeof i?null:i,s="function"==typeof s?null:s;const o=e.legendOptions?.title;if(null!=o)a=o;else if(e.valueExpressionTitle)a=e.valueExpressionTitle;else{if("renderer"in t&&t.renderer&&"authoringInfo"in t.renderer&&t.renderer.authoringInfo?.visualVariables){const e=t.renderer.authoringInfo.visualVariables;for(let t=0;t<e.length;t++){const i=e[t];if("color"===i.type){if("ratio"===i.style){l=!0;break}if("percent"===i.style){r=!0;break}if("percent-of-total"===i.style){n=!0;break}}}}a={field:i&&this._getFieldAlias(i,t),normField:s&&this._getFieldAlias(s,t),ratio:l,ratioPercent:r,ratioPercentTotal:n}}return a}_getRendererTitle(e,t){const i=e;if(i.legendOptions?.title)return i.legendOptions.title;if(i.valueExpressionTitle)return i.valueExpressionTitle;let s=i.field,l=null,r=null;if(Ee(i)&&(l=i.normalizationField,r="percent-of-total"===i.normalizationType),s="function"==typeof s?null:s,l="function"==typeof l?null:l,Ce(i)){const{field2:e,field3:l,fieldDelimiter:r}=i;let n=s&&this._getFieldAlias(s,t);return e&&(n=`<${n}>${r}<${this._getFieldAlias(e,t)}>`,l&&(n=`${n}${r}<${this._getFieldAlias(l,t)}>`)),n}let n=null;return(s||l)&&(n={field:s&&this._getFieldAlias(s,t),normField:l&&this._getFieldAlias(l,t),normByPct:r}),n}_getFieldAlias(e,t){const i="popupTemplate"in t?t.popupTemplate:null,s=i?.fieldInfos;let l=s?.find((t=>e===t.fieldName)),r=null;"getField"in t&&t.getField?r=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(r=t.fieldsIndex.get(e));let n=null;const a="featureReduction"in t&&t.featureReduction;a&&(l??="popupTemplate"in a?a.popupTemplate?.fieldInfos?.find((t=>e?.toLowerCase()===t.fieldName?.toLowerCase())):void 0,"fields"in a&&a.fields&&(n=a.fields.find((t=>t.name?.toLowerCase()===e?.toLowerCase()))));const o=l||r||n;let u=null;return o&&(u=l?.label||r?.alias||n?.alias||"name"in o&&o.name||"fieldName"in o&&o.fieldName||null),u}_isUnclassedRenderer(e){const t=e.visualVariables;let i=!1;return Ee(e)&&e.classBreakInfos&&1===e.classBreakInfos.length&&t&&(i=e.field?t.some((t=>!(!t||e.field!==t.field||(e.normalizationField||t.normalizationField)&&e.normalizationField!==t.normalizationField))):!!t.length),i}};e([g()],Ye.prototype,"children",void 0),e([g({readOnly:!0})],Ye.prototype,"effectList",null),e([g()],Ye.prototype,"layerView",void 0),e([g()],Ye.prototype,"layer",void 0),e([g()],Ye.prototype,"legendElements",void 0),e([g({readOnly:!0})],Ye.prototype,"opacity",null),e([g()],Ye.prototype,"parent",void 0),e([g({readOnly:!0,dependsOn:[]})],Ye.prototype,"ready",null),e([g()],Ye.prototype,"hideLayersNotInCurrentView",void 0),e([g()],Ye.prototype,"keepCacheOnDestroy",void 0),e([g()],Ye.prototype,"respectLayerDefinitionExpression",void 0),e([g()],Ye.prototype,"respectLayerVisibility",void 0),e([g({readOnly:!0})],Ye.prototype,"scale",null),e([g()],Ye.prototype,"sublayerIds",void 0),e([g({readOnly:!0})],Ye.prototype,"isScaleDriven",null),e([g()],Ye.prototype,"title",void 0),e([g({readOnly:!0,dependsOn:["ready"],value:0})],Ye.prototype,"version",null),e([g()],Ye.prototype,"view",void 0),Ye=e([b("esri.widgets.Legend.support.ActiveLayerInfo")],Ye);const et=Ye;export{et as default};