@arcgis/core 4.27.0-next.20230516 → 4.27.0-next.20230517

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 (148) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/06d5f5e37fd44dc7de06.js +1 -0
  3. package/assets/esri/core/workers/chunks/12714d64a0154688072e.js +1 -0
  4. package/assets/esri/core/workers/chunks/{a507135977d83aea4421.js → 1827a3da6b5b9272ffe1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{395ef46b635f9e9a5643.js → 20e8e18e4bd2fd5da47c.js} +1 -1
  6. package/assets/esri/core/workers/chunks/23f73f81aea461c0c6e6.js +1 -0
  7. package/assets/esri/core/workers/chunks/{15dda462b979e90b58fe.js → 3cebdd77a8401495097f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/48cb634255e39711a720.js +1 -0
  9. package/assets/esri/core/workers/chunks/4d5f71d84c85f45c97ea.js +1 -0
  10. package/assets/esri/core/workers/chunks/6312783626bacf52df7a.js +1 -0
  11. package/assets/esri/core/workers/chunks/6d80f81bf6ad97a7e69e.js +1 -0
  12. package/assets/esri/core/workers/chunks/{a3822a97701890c12d63.js → 7903beee895860c7e3af.js} +1 -1
  13. package/assets/esri/core/workers/chunks/887a630c5c980c5028e1.js +1 -0
  14. package/assets/esri/core/workers/chunks/{522660da4589739a70c3.js → c7fb48ea5d907883bcce.js} +1 -1
  15. package/assets/esri/core/workers/chunks/d0ff968e42116f592065.js +1 -0
  16. package/assets/esri/core/workers/chunks/{fdf64f23529a22c79fbd.js → d52c920acf08c95277c3.js} +19 -19
  17. package/assets/esri/core/workers/chunks/d64c271c173797d98286.js +1 -0
  18. package/assets/esri/core/workers/chunks/e1b2076d0040fcb7d864.js +1 -0
  19. package/assets/esri/core/workers/chunks/{b3013a5a39d038b2d748.js → e4f84c79fe3e7b54b76c.js} +1 -1
  20. package/assets/esri/core/workers/chunks/e6836c84470fb6bd25bf.js +1 -0
  21. package/assets/esri/core/workers/chunks/f3f6035a17f7dcd19675.js +1 -0
  22. package/assets/esri/core/workers/chunks/{bff317b08e91414f6edc.js → f720967ba8c5486a26a2.js} +1 -1
  23. package/assets/esri/themes/base/widgets/_ValuePicker.scss +27 -10
  24. package/assets/esri/themes/dark/main.css +1 -1
  25. package/assets/esri/themes/light/main.css +1 -1
  26. package/assets/esri/themes/light/view.css +1 -1
  27. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
  28. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
  29. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
  30. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
  31. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
  32. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
  33. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
  34. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
  35. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
  36. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
  37. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
  38. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
  39. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
  40. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
  41. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
  42. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
  43. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
  44. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
  45. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
  46. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
  47. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
  48. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
  49. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
  50. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
  51. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
  52. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
  53. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
  54. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
  55. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
  56. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
  57. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
  58. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
  59. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
  60. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
  61. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
  62. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
  63. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
  64. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
  65. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
  66. package/chunks/DefaultMaterial.glsl.js +4 -4
  67. package/chunks/HUDMaterial.glsl.js +22 -22
  68. package/chunks/HeatmapDensity.glsl.js +5 -5
  69. package/chunks/LineMarker.glsl.js +35 -35
  70. package/chunks/RibbonLine.glsl.js +47 -47
  71. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  72. package/core/Queue.js +1 -1
  73. package/interfaces.d.ts +290 -6
  74. package/intl/date.js +1 -1
  75. package/layers/ImageryTileLayer.js +1 -1
  76. package/layers/WMSLayer.js +1 -1
  77. package/layers/graphics/data/QueryEngine.js +1 -1
  78. package/layers/graphics/data/attributeSupport.js +1 -1
  79. package/layers/mixins/ArcGISImageService.js +1 -1
  80. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  81. package/package.json +1 -1
  82. package/popup/FieldInfo.js +1 -1
  83. package/popup/support/FieldInfoFormat.js +1 -1
  84. package/portal/schemas/definitions.js +1 -1
  85. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  86. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  87. package/support/revision.js +1 -1
  88. package/views/2d/layers/MediaLayerView2D.js +1 -1
  89. package/views/2d/layers/TileLayerView2D.js +1 -1
  90. package/views/2d/layers/support/cimSymbolUtils.js +1 -1
  91. package/views/3d/support/DisplayQualityProfile.js +1 -1
  92. package/views/3d/support/QualitySettings.js +1 -1
  93. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  94. package/views/3d/terrain/Overlay.js +1 -1
  95. package/views/3d/terrain/OverlayManager.js +1 -1
  96. package/views/3d/terrain/OverlayRenderer.js +1 -1
  97. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +13 -13
  98. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +18 -18
  99. package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +8 -8
  100. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  101. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  102. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  103. package/views/3d/webgl-engine/lib/RenderTargetHelper.js +1 -1
  104. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  105. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  106. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  107. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  108. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  109. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  110. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  111. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  112. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  113. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  114. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  115. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  116. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  117. package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
  118. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  119. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  120. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  121. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
  122. package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
  123. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  124. package/views/PopupView.js +1 -1
  125. package/views/webgl/ValidatedTextureDescriptor.js +1 -1
  126. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  127. package/widgets/FeatureTable.js +1 -1
  128. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  129. package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
  130. package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
  131. package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
  132. package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
  133. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  134. package/widgets/ValuePicker/ValuePickerViewModel.js +1 -1
  135. package/widgets/ValuePicker.js +1 -1
  136. package/assets/esri/core/workers/chunks/009026614cae60e9505c.js +0 -1
  137. package/assets/esri/core/workers/chunks/415c326d268b1a8fd03f.js +0 -1
  138. package/assets/esri/core/workers/chunks/504e929b686570ee858d.js +0 -1
  139. package/assets/esri/core/workers/chunks/5c811527898eb1c04e67.js +0 -1
  140. package/assets/esri/core/workers/chunks/6164a9c654c38f9cb64e.js +0 -1
  141. package/assets/esri/core/workers/chunks/6dd99db0adce09ac9794.js +0 -1
  142. package/assets/esri/core/workers/chunks/7cec069db0598431829e.js +0 -1
  143. package/assets/esri/core/workers/chunks/8bb3b10a777ae19f57f9.js +0 -1
  144. package/assets/esri/core/workers/chunks/91971a76a4ae0474a878.js +0 -1
  145. package/assets/esri/core/workers/chunks/9ed9e2ad50816a4f937a.js +0 -1
  146. package/assets/esri/core/workers/chunks/b81bb096ccfcea182cc1.js +0 -1
  147. package/assets/esri/core/workers/chunks/d05d9ddf244bb3dcbcaa.js +0 -1
  148. package/assets/esri/core/workers/chunks/d3a6504fbaf555707c58.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.27/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 l from"../../../request.js";import"../../../symbols.js";import r from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import n from"../../../core/Collection.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{eachAlways as u,debounce as c}from"../../../core/promiseUtils.js";import{on as d,watch as y,whenOnce as h,initial as m}from"../../../core/reactiveUtils.js";import{px2pt as p}from"../../../core/screenUtils.js";import{addQueryParameters as f}from"../../../core/urlUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.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 L}from"../../../layers/effects/jsonUtils.js";import{ExportImageParameters as w}from"../../../layers/support/ExportImageParameters.js";import{isDateField as v}from"../../../layers/support/fieldUtils.js";import{getPixelValueRange as E}from"../../../layers/support/rasterFormats/pixelRangeUtils.js";import{fromJSON as C}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as I}from"../../../renderers/support/rendererConversion.js";import R from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{applyCIMSymbolColor as F}from"../../../symbols/support/cimSymbolUtils.js";import{SymbolSizeDefaults as V}from"../../../symbols/support/previewUtils.js";import{renderSymbol as T}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as z,renderDotDensityPreviewHTML as x,renderPieChartPreviewHTML as j,renderPreviewHTML as D}from"../../../symbols/support/symbolUtils.js";import{isVolumetricSymbol as O}from"../../../symbols/support/utils.js";import{getClusterSizeVariable as A}from"./clusterUtils.js";import{getColorFromPointCloudStops as P,getRampStopsForPointCloud as M,getStrectchRampStops as B,getRampStops as k}from"./colorRampUtils.js";import{getHeatmapRampStops as U}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as N,getRelationshipRampElement as q}from"./relationshipRampUtils.js";import{getRampStops as H,REAL_WORLD_MAX_SIZE as $,REAL_WORLD_MIN_SIZE as W}from"./sizeRampUtils.js";import{SPECIAL_CHARS_LESS_THAN as G,SPECIAL_CHARS_GREATER_THAN as J,getSymbolForFlowRenderer as Q,isRasterBandStatistics as K,getMedianColor as X,RGB_IMG_SOURCE as Y}from"./utils.js";import{formatNumberLabel as Z}from"../../smartMapping/support/utils.js";import ee from"../../../symbols/SimpleMarkerSymbol.js";import te from"../../../symbols/SimpleFillSymbol.js";import{fetchMessageBundle as se}from"../../../intl/messages.js";import{substitute as le}from"../../../intl/substitute.js";const re="https://utility.arcgis.com/sharing/tools/legend",ie="esri.layers.ImageryLayer",ne="esri.layers.ImageryTileLayer",ae="esri.layers.WCSLayer",oe=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,ue=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),ce=new ee({size:6,outline:{color:[128,128,128,.5],width:.5}}),de=new te({style:"solid"});function ye(e){return"flow"===e.type}function he(e){return"vector-field"===e.type}function me(e){return"raster-colormap"===e.type}function pe(e){return"raster-stretch"===e.type}function fe(e){return"raster-shaded-relief"===e.type}function ge(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function be(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function Se(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function _e(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function Le(e){return ve(e)||Ee(e)||Ce(e)||we(e)}function we(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function ve(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function Ce(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function Ie(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Re(e){return"esri.renderers.PieChartRenderer"===e.declaredClass}function Fe(e,t){return ge(e)||be(e)||Se(e)||_e(e)||Ie(e)||Re(e)?"2d"===t.type||I(e):pe(e)||me(e)||fe(e)||ve(e)||Ee(e)||Ce(e)||he(e)||ye(e)}function Ve(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function Te(e){return"esri.layers.SubtypeGroupLayer"===e.declaredClass}function ze(e){return"esri.layers.VoxelLayer"===e.declaredClass}function xe(e){return"esri.layers.WMSLayer"===e.declaredClass}function je(e){return"esri.layers.WMTSLayer"===e.declaredClass}function De(e){return"esri.layers.MapImageLayer"===e.declaredClass}function Oe(e){return"esri.layers.TileLayer"===e.declaredClass}function Ae(e){return"esri.layers.FeatureLayer"===e.declaredClass}function Pe(e){return e.declaredClass===ie}function Me(e){return e.declaredClass===ne}function Be(e){return e.declaredClass===ae}function ke(e){return"stretch-ramp"===e.type}function Ue(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type}function Ne(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type&&"above-and-below"===t?.univariateTheme}function qe(e){return"sublayers"in e}async function He(e,t){const s=await se("esri/widgets/Legend/t9n/Legend");return"previewTemplateAriaLabel"!==e||t||(e="previewAriaLabel"),le(s[e],{label:t})}const $e=new ee({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let We={},Ge=class extends r{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.children=new n,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this.addHandles([d((()=>this.children),"change",(t=>{const{added:s,removed:l}=t;s.forEach((t=>{const s=`activeLayerInfo-ready-watcher-${t.layer.uid}`;this.addHandles(y((()=>t.ready),e,m),s)})),l.forEach((e=>this.removeHandles(e.layer.uid))),e()}))]),this.keepCacheOnDestroy||(We={})}destroy(){this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(We=null)}get effectList(){const e=this.layer;let t=null;return"effect"in e&&e.effect&&(t=new _,t.effect=e.effect,t.endTransitions(),t.scale=this.scale),t}get opacity(){const e=this.layer.opacity,t=this.parent?.opacity,s=this.layer.parent,l=s&&"uid"in s?this._getParentLayerOpacity(s):null;return null!=t?t*e:null!=l?l*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(Ae(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet&&e.featureSet.features.length){const t=e.layerDefinition,s=t&&t.drawingInfo,l=s&&C(s.renderer),r=ue.read(t.geometryType);return l?this._getRendererLegendElements(l,{title:e.name,geometryType:r}):(o.getLogger(this).warn("drawingInfo not available!"),null)}return null}));try{const e=[];await u(t).then((t=>{t.forEach((({value:t})=>t&&e.push(...t)))})),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(ze(e))this._constructLegendElementsForVoxellayer();else if(je(e))this._constructLegendElementsForWMTSlayer();else if(xe(e))await this._constructLegendElementsForWMSSublayers();else if(Ve(e))await this._constructLegendElementsForBuildingSceneLayer();else if(De(e)||Oe(e)||Te(e))await this._constructLegendElementsForSublayers();else{this.removeHandles("imageryLayers-watcher");let t="default";if(Pe(e)){const s=e;t=(s?.rasterFunction?.functionName||"default")+"_"+(e.bandIds?.length?e.bandIds.join(""):"###")}await this._getLegendLayers(`${e.uid}-${t}`).then((async t=>{this.legendElements=[],this.notifyChange("ready");const s=t.map((async t=>{if(Pe(e)||Me(e)){const t=y((()=>["renderingRule"in e&&e.rasterFunction,e.bandIds]),(()=>c((async()=>{We.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()}))()));this.addHandles(t,"imageryLayers-watcher")}const s=this._generateSymbolTableElementForLegendLayer(t);s&&s.infos.length&&(Pe(e)&&(s.title=e.title),this.legendElements.push(s)),this.notifyChange("ready")}));await u(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 h((()=>!t.updating));const l=s?"createQuery"in t&&t.createQuery():"createQuery"in e&&e.createQuery();if(!l)return!0;l.geometry=this.view.extent;return 0!==(s?"queryFeatureCount"in t&&await t.queryFeatureCount(l):"queryFeatureCount"in e&&await e.queryFeatureCount(l))}_getParentLayerOpacity(e){let t=1;const s=e.parent;return s&&"uid"in s&&(t=this._getParentLayerOpacity(s)),e.opacity*t}_isGroupActive(){const e=this.children;return!!e.length&&e.some((e=>e.ready))}_isRendererScaleDriven(e){if("dot-density"===e.type)return!0;const t="valueExpression"in e?e.valueExpression:null;if(oe.test(t))return!0;const s="visualVariables"in e?e.visualVariables:null;return!!s&&s.some((e=>this._isScaleDrivenSizeVariable(e)))}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,s=t.minSize,l=t.maxSize;return"object"==typeof s&&s?this._isScaleDrivenSizeVariable(s):"object"==typeof l&&l?this._isScaleDrivenSizeVariable(l):!!t.expression||oe.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&&De(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(y((()=>e.currentVariableId),(()=>this._constructLegendElementsForVoxellayer())),"voxel-current-variable"),this.addHandles(y((()=>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 te({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:l}=t.transferFunction,r=e.toArray().reverse(),i=l.map(((e,t)=>`${0===t?G:J} ${Z(e)}`)).reverse(),n=r.map((e=>({color:e.color,value:null,label:null})));n[0].label=i[0],n[n.length-1].label=i[1],s.push({type:"color-ramp",title:t.label,infos:n,preview:z(r.map((e=>e.color)),{ariaLabel:await He("previewColorRampAriaLabel")})})}const l=e.opacity,r=s.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol)).map((e=>this._getSymbolPreview(e,l)));await u(r),this.legendElements=s,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this.removeHandles("wmts-activeLayer-watcher");const e=this.layer.activeLayer;if(this.addHandles(y((()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer}),(()=>this._constructLegendElementsForWMTSlayer())),"wmts-activeLayer-watcher"),e.styleId&&e.styles){let t=null;e.styles.some((s=>e.styleId===s.id&&(t=s.legendUrl,!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(y((()=>{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.addHandles(e.on("change",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher");const l=e.toArray();for(const r of l){const e=y((()=>[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&&e.infos.length&&s.unshift(e)}}return s}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 r={type:"symbol-table",title:e.title||e.name||String(e.id??""),infos:[]};t&&(s=f(s,t));let i=null;const n=e.layer?.opacity;try{i=(await l(s,{responseType:"image"})).data,i&&(i.style.opacity=n)}catch{}return r.infos.push({src:s,preview:i,opacity:n}),r}_getLegendLayers(e,t){const s=We&&We[e];return s?Promise.resolve(s):this._legendRequest(t).then((t=>{const s=t.layers;return We[e]=s,s}))}_legendRequest(e){const t=this.layer;let s={f:"json",dynamicLayers:e};if(Pe(t)){const e=t.exportImageServiceParameters.rasterFunction;if(e&&(s.renderingRule=JSON.stringify(e.rasterFunctionDefinition||e.toJSON())),t.bandIds&&(s.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:l,customParameters:r}=t;s={raster:e,viewId:l,...s,...r}}}let r=t.url.replace(/(\/)+$/,"");if("version"in t&&+t.version>=10.01){const e=r.indexOf("?");e>-1?r=r.substring(0,e)+"/legend"+r.substring(e):r+="/legend"}else{const e=r.toLowerCase().indexOf("/rest/"),t=r.substring(0,e)+r.substring(e+5,r.length);r=re+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return l(r,{query:s}).then((e=>e.data))}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this.removeHandles("sublayers-watcher");const e=this.layer;this.addHandles(y((()=>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 l=e.toArray();for(const r of l){const e=y((()=>["renderer"in r&&r.renderer,r.opacity,r.title,r.visible]),(()=>this._constructLegendElementsForBuildingSceneLayer()));if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||r.visible){const e=r&&null!=r.opacity?r.opacity:null,l=null!=e?e*t:t;if("building-group"===r.type){const e={type:"symbol-table",title:r.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(r.sublayers,l);e.infos.push(...t),s=[e,...s]}else if(r.renderer){s=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:l,sublayer:r}),...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(De(e)||Oe(e)||Te(e)){this.addHandles(y((()=>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 l=this.layer;let r=[];this.addHandles(e.on("change",(()=>this._constructLegendElementsForSublayers())),"sublayers-watcher");let n=e.toArray();!s&&this.sublayerIds&&this.sublayerIds.length&&(n=Te(l)?this.sublayerIds.map((e=>l.findSublayerForSubtypeCode(e))).filter(i):this.sublayerIds.map((e=>l.findSublayerById(e))).filter(i));for(const i of n){const e=y((()=>[i.renderer,i.opacity,i.title,i.visible,i.legendEnabled]),(()=>this._constructLegendElementsForSublayers()));if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||i.visible&&i.legendEnabled&&this._isSublayerInScale(i)){const e=i&&null!=i.opacity?i.opacity:null,l=null!=e?e*t:t,n=!qe(i)||i.originIdOf("renderer")>S.SERVICE&&!i.sublayers;if(i.renderer&&n){await i.load();r=[...await this._getRendererLegendElements(i.renderer,{title:i.title,opacity:l,sublayer:i}),...r]}else if(qe(i)){const e=await this._generateSymbolTableElementForSublayer(i,l,s);e&&r.unshift(e)}}}return r.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,l=e.source;let r=null;if(!(!l||"map-layer"===l.type&&l.mapLayerId===e.id&&(!l.gdbVersion||l.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>S.SERVICE||e.originIdOf("labelingInfo")>S.SERVICE||e.originIdOf("labelsVisible")>S.SERVICE){const e=new w({layer:this.layer});r=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const i=r||`${t.uid}-default`;(await this._getLegendLayers(i,r)).forEach((e=>s.set(e.layerId,e)))}const l=s.get(e.id);if((!l||l?.subLayerIds&&l.defaultVisibility)&&e.sublayers){const l=await this._generateLegendElementsForSublayers(e.sublayers,t,s);return{type:"symbol-table",title:e.title,infos:l}}return this._generateSymbolTableElementForLegendLayer(l,e,t)}_generateSymbolTableElementForLegendLayer(e,t,s){if(!e||!e.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const l=t?.renderer;let r=t?.title||e.layerName;if(l&&(!t||t?.originIdOf("renderer")>S.SERVICE)){const e=t?.title||this._getRendererTitle(l,t);e&&(r&&"string"!=typeof e&&"title"in e&&(e.title=r),r=e)}const i={type:"symbol-table",title:r,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 l={type:"symbol-table",title:t.heading,legendType:e.legendType||null,infos:this._generateSymbolTableElementInfosForLegendLayer(n.filter((e=>e.groupId===t.id)),e.layerId,s)};l.infos?.length>0&&i.infos.push(l)})):i.infos=this._generateSymbolTableElementInfosForLegendLayer(n,e.layerId,s),i.infos.length>0?i:null}_generateSymbolTableElementInfosForLegendLayer(e,t,l){return e.map((e=>{let r=e.url;if(e.imageData&&e.imageData.length>0)r=`data:image/png;base64,${e.imageData}`;else{if(0===r.indexOf("http"))return null;r=s(`${this.layer.url}/${t}/images/${r}`)}return{label:e.label,src:r,opacity:l??this.opacity,width:e.width,height:e.height}})).filter(i)}_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 l=null,r=null,i=!0;return!s.minScale&&0!==s.minScale||!s.maxScale&&0!==s.maxScale?(0===e.minScale&&s.tileInfo&&(l=s.tileInfo.lods[0].scale),0===e.maxScale&&s.tileInfo&&(r=s.tileInfo.lods[s.tileInfo.lods.length-1].scale)):(l=Math.min(s.minScale,e.minScale)||s.minScale||e.minScale,r=Math.max(s.maxScale,e.maxScale)),(l>0&&l<this.scale||r>this.scale)&&(i=!1),i}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&+this.layer.version<10.1||0===e.length)return e;const s=t.renderer,l=e.some((e=>e.values));let r=0,i=null;return l&&e.some(((e,t)=>(e.values||(r=t,i=e,i.label||(i.label="others")),null!=i))),s?"unique-value"===s.type?i&&(e.splice(r,1),e.push(i)):"class-breaks"===s.type&&(i&&e.splice(r,1),e.reverse(),i&&e.push(i)):i&&(e.splice(r,1),e.push(i)),e}async _getRendererLegendElements(e,t={}){if(!Fe(e,this.view))return o.getLogger(this).warn(`Renderer of type '${e.type}' not supported!`),[];if(Le(e))return this._constructPointCloudRendererLegendElements(e,t);if(Ie(e))return this._constructDotDensityRendererLegendElements(e);const s=await this._loadRenderer(e);return Re(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,l=[];let r=null,i=null;if(ve(e))r={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach((e=>{r.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(ce,e.color)})}));else if(Ee(e)){const t=e.stops;let l=null;if(t?.length&&(1===t.length&&(l=t[0].color),!l)){const e=t[0].value,s=t[t.length-1].value;if(null!=e&&null!=s){l=P(e+(s-e)/2,t)}}r={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(ce,l||ce.color)}]};const n=M(e.stops??[])??[];i={type:"color-ramp",title:s||this._getPointCloudRendererTitle(e),infos:n,preview:z(n.map((e=>e.color)),{ariaLabel:await He("previewColorRampAriaLabel")})}}else Ce(e)&&(r={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos?.forEach((e=>{r.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(ce,e.color)})})));r&&r.infos.length&&l.push(r),i&&i.infos.length&&l.push(i);const n=l.reduce(((e,t)=>[...e,...t.infos??[]]),[]).filter((e=>!!e.symbol)).map((t=>this._getSymbolPreview(t,this.opacity,{symbolConfig:{applyColorModulation:!!e.colorModulation}})));return u(n).then((()=>l))}async _getElementInfoForDotDensity(e,t){const{color:s,label:l,valueExpressionTitle:r}=t,{backgroundColor:i,outline:n,dotSize:a}=e,o=this.effectList,u=o?.effects.map((e=>e.toJSON())),c=L(u),d=await He("previewTemplateAriaLabel",l||r),y=a+"-"+s+"-"+i+"-"+(n&&JSON.stringify(n.toJSON()))+"-"+c,h=this._dotDensityUrlCache,m=h.has(y)?h.get(y):x(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=T([[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&&e.legendOptions.unit,l={type:"symbol-table",title:{value:t&&Math.round(t),unit:s||""},infos:[]};for(const r of e.attributes){const t=await this._getElementInfoForDotDensity(e,r);t.label=r.label||r.valueExpressionTitle||r.field,l.infos.push(t)}return[l]}async _constructPieChartRendererLegendElements(e){const t=this.layer.opacity,s=[];let l=null;const r=e.outline;e.attributes.forEach((e=>{const t=new ee({color:e.color,outline:r}),l=e.label||e.valueExpressionTitle||e.field;s.push({label:l,symbol:t})}));const i=s.length?[...s]:[];if(e.othersCategory?.color&&0!==e.othersCategory?.threshold){const t=new ee({color:e.othersCategory.color,outline:r});l=e.othersCategory.label||"Other",s.push({label:l,symbol:t})}if(e.defaultColor?.a){const t=new ee({color:e.defaultColor,outline:r});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=i.filter((e=>e.label!==l)).map((e=>e.symbol.color)).filter(Boolean),a=j(t,{holePercentage:e.holePercentage,backgroundColor:e.backgroundFillSymbol?.color,effectList:this.effectList,outline:r,ariaLabel:await He("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 u(a),n}async _constructRendererLegendElements(e,t={}){const{title:s,sublayer:l}=t,r=l||this.layer;this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const i=await this._getVisualVariableLegendElements(e,r)||[],n={type:"symbol-table",title:s||this._getRendererTitle(e,r),infos:[]};let a=null,o=!1;const c=new Set;if(ye(e)&&!this._hasSizeRamp){const t=await Q(e);n.infos.push({label:null,symbol:t})}else if(Ue(e)){let t=s;const l=Ne(e)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",r=i.findIndex((e=>"color-ramp"===e.type)),n=-1!==r?i.splice(r,1)[0]:null,a=i.findIndex((e=>"size-ramp"===e.type)),o=-1!==a?i.splice(a,1)[0]:null,u=[];n&&(t=n.title,u.push(n)),o&&(t=o.title,u.push(o)),u.length>0&&i.push({type:l,title:t,infos:u})}else if(_e(e)){const t=U(e);i.push({type:"heatmap-ramp",title:s||this._getRendererTitle(e,r),infos:t,preview:z(t.map((e=>e.color)),{effectList:this.effectList,ariaLabel:await He("previewColorRampAriaLabel")})})}else if(Se(e)){const t=e&&e.authoringInfo;if(t&&"relationship"===t.type){const{numClasses:s,field1:l,field2:a}=t,o=t.focus;if(s&&l&&a){const t=[l,a];let u=N(o)||0;for(const e of t){const{field:t,normalizationField:s,label:l}=e,i=l||{field:this._getFieldAlias(t,r),normField:s&&this._getFieldAlias(s,r)},a=$e.clone();a.angle=u,n.infos.push({label:i,symbol:a}),c.add(a),u+=90}const d=q({focus:o,numClasses:s,infos:e.uniqueValueInfos??[]});i.unshift(d)}}else if(Pe(this.layer)||Me(this.layer))e.uniqueValueInfos?.forEach((e=>{e.symbol&&n.infos.push({label:e.label||e.value,value:e.value,symbol:e.symbol})}));else{const{field:t,field2:l,field3:i,fieldDelimiter:a,valueExpression:u,defaultSymbol:c}=e,d=!(!t&&!u||!l&&!i),y=[];if(e.uniqueValueGroups?.forEach((e=>{const s={type:"symbol-table",title:e.heading,infos:[]};e.classes?.forEach((e=>{const{symbol:n,values:o}=e;if(n){const c=[],y=[];for(const e of o??[]){const{value:s,value2:n,value3:o}=e,h=[],m=[];(t||u)&&(h.push(s),m.push(this._getDomainName(t,s,r))),l&&(h.push(n),m.push(this._getDomainName(l,n,r))),i&&(h.push(o),m.push(this._getDomainName(i,o,r))),c.push(d?h.join(a||""):h[0]),y.push(m.join(" - "))}const h=c.join(", ");let m=e.label;if(!m){const e=y.filter(Boolean);m=e.length?e.join(", "):h}s.infos.push({label:m,value:h,symbol:n})}})),s.infos.length&&y.push(s)})),y.length){const t=y[0];1===y.length&&"title"in t&&!t.title?n.infos.push(...t.infos??[]):(c&&(y.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:c}]}),o=!0),n.infos.push(...y)),s||e.legendOptions&&e.legendOptions.title||e.valueExpressionTitle||(n.title=null)}}e.defaultSymbol&&!o&&(n.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),o=!0)}else if(be(e)){a=this._isUnclassedRenderer(e);(!a||!this._hasSizeRamp)&&(e.classBreakInfos.forEach((e=>{e.symbol&&n.infos.unshift({label:e.label||(a?null:e.minValue+" - "+e.maxValue),value:[e.minValue,e.maxValue],symbol:e.symbol})})),a&&(n.title=null),this._updateInfosforClassedSizeRenderer(e,n.infos)),e.defaultSymbol&&!a&&(n.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),o=!0)}else if(pe(e))if(Me(this.layer)||Be(this.layer)){const t=await this._constructTileImageryStretchRendererElements(e);ke(t)?i.push(t):n.infos=t}else{const t=this.layer;let s,l;if(e.statistics?.length){const t=e.statistics[0];K(t)?(s=t.min,l=t.max):[s,l]=t}let r=[];const a=t.rasterFunction?await t.generateRasterInfo(t.rasterFunction):t.serviceRasterInfo,o=a.keyProperties.BandProperties,u=E(a.pixelType);if(1===a.bandCount){const r=t.bandIds?.[0]||0;s=null!=s?s:a.statistics?a.statistics[r].min:u[0],l=null!=l?l:a.statistics?a.statistics[r].max:u[1],s||l?i.push(await this._getStretchLegendElements(e,{min:s,max:l})):this._getServerSideLegend()}else t.bandIds&&1===t.bandIds.length?(s=null!=s?s:a.statistics?a.statistics[t.bandIds[0]].min:u[0],l=null!=l?l:a.statistics?a.statistics[t.bandIds[0]].max:u[1],s||l?i.push(await this._getStretchLegendElements(e,{min:s,max:l})):this._getServerSideLegend()):a.bandCount>=3?o&&o.length>=a.bandCount?t.bandIds&&3===t.bandIds.length?(r=t.bandIds.map((e=>o[e].BandName)),n.infos=this._createSymbolTableElementMultiBand(r)):"lerc"===t.format?(r=[0,1,2].map((e=>o[e].BandName)),n.infos=this._createSymbolTableElementMultiBand(r)):this._getServerSideLegend():"lerc"===t.format?(r=["band1","band2","band3"],n.infos=this._createSymbolTableElementMultiBand(r)):this._getServerSideLegend():this._getServerSideLegend()}else if(me(e))e.colormapInfos.forEach((e=>{n.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(de,e.color)})}));else if(ge(e)){let s=e.symbol;switch(t.geometryType){case"point":s="pointSymbol"in r?r.pointSymbol:null;break;case"polyline":s="lineSymbol"in r?r.lineSymbol:null;break;case"polygon":s="polygonSymbol"in r?r.polygonSymbol:null}const l=this._hasClusterSizeVariable&&this._getClusterSymbol()||!this._hasSizeRamp;e.symbol&&l&&n.infos.push({label:e.label,symbol:s})}else if(he(e)){e.outputUnit&&(this.title="("+e.toJSON().outputUnit+")"),n.title=e.attributeField;const t=e.getClassBreakInfos();t?.length?t.forEach((e=>{n.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})})):n.infos.push({label:e.attributeField,symbol:e.getDefaultSymbol()})}else fe(e)&&i.push(await this._getStretchLegendElements(e,{min:0,max:255}));const d=e.defaultSymbol;!d||o||ge(e)||a&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||i.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:d}]}),n.infos.length&&i.unshift(n);const y=null==t.opacity?this.opacity:t.opacity,h=this._isTallSymbol("visualVariables"in e?e.visualVariables:null),m=Pe(this.layer)||Me(this.layer),p=i.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol)).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 u(p),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,{rasterInfo:s}=t.raster,l=s.bandCount||e.statistics.length;let r,i,n=[];const a=s.keyProperties&&s.keyProperties.BandProperties,o=e?.statistics?.length?e.statistics:s?.statistics;if(o){const e=o[0];K(e)?(r=e.min,i=e.max):[r,i]=e}else{const e=E(s.pixelType);r=e[0],i=e[1]}if(t.hasStandardTime()&&(r=t.getStandardTimeValue(r),i=t.getStandardTimeValue(i)),1===s.bandCount||1===t.bandIds?.length)return this._getStretchLegendElements(e,{min:r,max:i});function u(e){const l=(t?.bandIds?.length?t.bandIds:Array.from(Array(Math.min(s.bandCount,3)).keys())).map((t=>e&&e[t]&&e[t].BandName||"band"+(t+1)));return l.length<3?l.push(l[1]):l.length>3&&l.splice(3),l}return n=a&&a.length>=l?u(a):u(),this._createSymbolTableElementMultiBand(n)}async _getStretchLegendElements(e,t){const s=e.colorRamp,l=B(s,t);return{type:"stretch-ramp",title:"",infos:l,preview:z(l.map((e=>e.color)),{ariaLabel:await He("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,l){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(t):e,infos:await H(s,t,await X(s),this.scale,this.view.type,!!l,this._hasClusterSizeVariable?this._getClusterSymbol():null)}}_createSymbolTableElementMultiBand(e){const t=[],s=["red","green","blue"];return e.forEach(((e,l)=>{t.push({label:{colorName:s[l],bandName:e},src:Y[l],opacity:this.opacity??1})})),t}_updateInfosforClassedSizeRenderer(e,t){const s=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,l=e.classBreakInfos.some((e=>O(e.symbol)));if(s&&l){const s=$,l=W,r=e.classBreakInfos.length,i=(s-l)/(r>1?r-1:r);t.forEach(((e,t)=>{e.size=s-i*t}))}}_isTallSymbol(e){let t=!1,s=!1;if(e)for(let l=0;l<e.length&&(!t||!s);l++){const r=e[l];"size"===r.type&&("height"===r.axis&&(t=!0),"width-and-depth"===r.axis&&(s=!0))}return t&&s}async _getSymbolPreview(e,t,s){let l=!s?.isDefault&&null==e.size&&this._hasSizeRamp?p(V.size):e.size;if(this._scaleDrivenSizeVariable&&s?.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");l=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}return D(e.symbol,{size:l,opacity:t,scale:!1,symbolConfig:s?.symbolConfig,effectView:s?.effectList,ariaLabel:e.label&&"string"!=typeof e.label?null:await He("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(),l=A(this.layerView._effectiveRenderer,this.view);if(l&&null!=s&&"visualVariables"in s){const t=s.visualVariables?.some((e=>"size"===e.type&&"outline"!==e.target&&!oe.test(e.valueExpression)));if(!t){if("clusterMinSize"in e&&"clusterMaxSize"in e){const{clusterMinSize:t,clusterMaxSize:s}=e;l.legendOptions=new R({showLegend:t!==s})}const t=s.visualVariables||[];s.visualVariables=t.concat([l]),this._hasClusterSizeVariable=!0}}return s}async _loadRenderer(e){const t=[],s=e.clone(),l=await X(s);if(be(s)||Se(s)){const e=(s.classBreakInfos||s.uniqueValueInfos).map((e=>this._fetchSymbol(e.symbol,l).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:l).then((e=>{this._applySymbolToRenderer(s,e,ge(s))})).catch((()=>{this._applySymbolToRenderer(s,null,ge(s))}))),u(t).then((()=>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 l=await("2d"===this.view.type?e.fetchCIMSymbol({cache:s}):e.fetchSymbol({cache:s}));return this._getAppliedCloneSymbol(l,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 l=e.clone(),r=s&&s.toRgba();return l.type.includes("3d")?this._applyColorTo3dSymbol(l,r):"cim"===l.type?F(l,s):l.color&&(l.color=new t(r||l.color)),l}_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)||!e.visualVariables||"vector-field"===e.type)return null;const s=e.visualVariables,l=[],r=[],n=[];for(const i of s)"color"===i.type?l.push(i):"size"===i.type?r.push(i):"opacity"===i.type&&n.push(i);const a=[...l,...r,...n];let o,u;if(0===l.length&&be(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];o=t&&t.symbol}if(0===l.length&&ge(e)&&(o=e.symbol),o)if(o.type.includes("3d")){const e=o.symbolLayers.getItemAt(0);"water"===e.type?null!=e.color&&(u=e.color):null!=e.material&&null!=e.material.color&&(u=e.material.color)}else o.url||(u=o.color);const c=this.effectList;return(await Promise.all(a.map((async s=>{if(!s.legendOptions||!1!==s.legendOptions.showLegend){const l=ye(e)?s.field:this._getRampTitle(s,t);let r=null;const i="getField"in t?t.getField?.(s.field):null,n=i&&v(i);if("color"===s.type){const e=await k(s,null,n)??[];r={type:"color-ramp",title:l,infos:e,preview:z(e.map((e=>e.color)),{effectList:c,ariaLabel:await He("previewColorRampAriaLabel")})},this._hasColorRamp||(this._hasColorRamp=e.length>0)}else if("size"===s.type&&"outline"!==s.target)oe.test(s.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=s):(r=await this._getSizeLegendElement(l,s,e,n),this._hasSizeRamp||(this._hasSizeRamp=!(null==r.infos||!r.infos.length)));else if("opacity"===s.type){const e=await k(s,u,n)??[];r={type:"opacity-ramp",title:l,infos:e,preview:z(e.map((e=>e.color)),{effectList:c,ariaLabel:await He("previewColorRampAriaLabel")})},this._hasOpacityRamp||(this._hasOpacityRamp=e.length>0)}return r&&r.infos?r:null}})))).filter(i)}_getDomainName(e,t,s){if(e&&"function"!=typeof e){const l="getField"in s&&s.getField&&s.getField(e),r=l&&"getFieldDomain"in s&&s.getFieldDomain?s.getFieldDomain(l.name):null;return"coded-value"===r?.type?r.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,l="popupTemplate"in e&&e.popupTemplate,r=l&&l.fieldInfos;if(r)for(const t of r)if(t.fieldName===s)return"cluster_count"===s?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let s=e.field,l=e.normalizationField,r=!1,i=!1,n=!1,a=null;s="function"==typeof s?null:s,l="function"==typeof l?null:l;const o=e.legendOptions&&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&&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){r=!0;break}if("percent"===s.style){i=!0;break}if("percent-of-total"===s.style){n=!0;break}}}}a={field:s&&this._getFieldAlias(s,t),normField:l&&this._getFieldAlias(l,t),ratio:r,ratioPercent:i,ratioPercentTotal:n}}return a}_getRendererTitle(e,t){const s=e;if(s.legendOptions&&s.legendOptions.title)return s.legendOptions.title;if(s.valueExpressionTitle)return s.valueExpressionTitle;let l=s.field,r=null,i=null;if(be(s)&&(r=s.normalizationField,i="percent-of-total"===s.normalizationType),l="function"==typeof l?null:l,r="function"==typeof r?null:r,Se(s)){const{field2:e,field3:r,fieldDelimiter:i}=s;let n=l&&this._getFieldAlias(l,t);return e&&(n=`<${n}>${i}<${this._getFieldAlias(e,t)}>`,r&&(n=`${n}${i}<${this._getFieldAlias(r,t)}>`)),n}let n=null;return(l||r)&&(n={field:l&&this._getFieldAlias(l,t),normField:r&&this._getFieldAlias(r,t),normByPct:i}),n}_getFieldAlias(e,t){const s="popupTemplate"in t?t.popupTemplate:null,l=s?.fieldInfos;let r;l&&l.some((t=>e===t.fieldName&&(r=t,!0)));let i=null;"getField"in t&&t.getField?i=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(i=t.fieldsIndex.get(e));let n=null;const a="featureReduction"in t&&t.featureReduction;a&&(!r&&"popupTemplate"in a&&a.popupTemplate&&a.popupTemplate.fieldInfos&&a.popupTemplate.fieldInfos.some((t=>e?.toLowerCase()===t.fieldName?.toLowerCase()&&(r=t,!0))),"fields"in a&&a.fields&&(n=a.fields.find((t=>t.name?.toLowerCase()===e?.toLowerCase()))));const o=r||i||n;let u=null;return o&&(u=r?.label||i?.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 be(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()],Ge.prototype,"children",void 0),e([g({readOnly:!0})],Ge.prototype,"effectList",null),e([g()],Ge.prototype,"layerView",void 0),e([g()],Ge.prototype,"layer",void 0),e([g()],Ge.prototype,"legendElements",void 0),e([g({readOnly:!0})],Ge.prototype,"opacity",null),e([g()],Ge.prototype,"parent",void 0),e([g({readOnly:!0,dependsOn:[]})],Ge.prototype,"ready",null),e([g()],Ge.prototype,"hideLayersNotInCurrentView",void 0),e([g()],Ge.prototype,"keepCacheOnDestroy",void 0),e([g()],Ge.prototype,"respectLayerVisibility",void 0),e([g({readOnly:!0})],Ge.prototype,"scale",null),e([g()],Ge.prototype,"sublayerIds",void 0),e([g({readOnly:!0})],Ge.prototype,"isScaleDriven",null),e([g()],Ge.prototype,"title",void 0),e([g({readOnly:!0,dependsOn:["ready"],value:0})],Ge.prototype,"version",null),e([g()],Ge.prototype,"view",void 0),Ge=e([b("esri.widgets.Legend.support.ActiveLayerInfo")],Ge);const Je=Ge;export{Je as default};
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 l from"../../../request.js";import"../../../symbols.js";import r from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import n from"../../../core/Collection.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{eachAlways as u,debounce as c}from"../../../core/promiseUtils.js";import{on as d,watch as y,whenOnce as h,initial as m}from"../../../core/reactiveUtils.js";import{px2pt as p}from"../../../core/screenUtils.js";import{addQueryParameters as f}from"../../../core/urlUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.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 L}from"../../../layers/effects/jsonUtils.js";import{ExportImageParameters as w}from"../../../layers/support/ExportImageParameters.js";import{isDateField as v}from"../../../layers/support/fieldUtils.js";import{getPixelValueRange as E}from"../../../layers/support/rasterFormats/pixelRangeUtils.js";import{fromJSON as C}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as I}from"../../../renderers/support/rendererConversion.js";import R from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{applyCIMSymbolColor as F}from"../../../symbols/support/cimSymbolUtils.js";import{SymbolSizeDefaults as V}from"../../../symbols/support/previewUtils.js";import{renderSymbol as T}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as z,renderDotDensityPreviewHTML as x,renderPieChartPreviewHTML as j,renderPreviewHTML as D}from"../../../symbols/support/symbolUtils.js";import{isVolumetricSymbol as O}from"../../../symbols/support/utils.js";import{getClusterSizeVariable as A}from"./clusterUtils.js";import{getColorFromPointCloudStops as P,getRampStopsForPointCloud as M,getStrectchRampStops as B,getRampStops as k}from"./colorRampUtils.js";import{getHeatmapRampStops as U}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as N,getRelationshipRampElement as q}from"./relationshipRampUtils.js";import{getRampStops as H,REAL_WORLD_MAX_SIZE as $,REAL_WORLD_MIN_SIZE as W}from"./sizeRampUtils.js";import{SPECIAL_CHARS_LESS_THAN as G,SPECIAL_CHARS_GREATER_THAN as J,getSymbolForFlowRenderer as Q,isRasterBandStatistics as K,getMedianColor as X,RGB_IMG_SOURCE as Y}from"./utils.js";import{formatNumberLabel as Z}from"../../smartMapping/support/utils.js";import ee from"../../../symbols/SimpleMarkerSymbol.js";import te from"../../../symbols/SimpleFillSymbol.js";import{fetchMessageBundle as se}from"../../../intl/messages.js";import{substitute as le}from"../../../intl/substitute.js";const re="https://utility.arcgis.com/sharing/tools/legend",ie="esri.layers.ImageryLayer",ne="esri.layers.ImageryTileLayer",ae="esri.layers.WCSLayer",oe=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,ue=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),ce=new ee({size:6,outline:{color:[128,128,128,.5],width:.5}}),de=new te({style:"solid"});function ye(e){return"flow"===e.type}function he(e){return"vector-field"===e.type}function me(e){return"raster-colormap"===e.type}function pe(e){return"raster-stretch"===e.type}function fe(e){return"raster-shaded-relief"===e.type}function ge(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function be(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function Se(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function _e(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function Le(e){return ve(e)||Ee(e)||Ce(e)||we(e)}function we(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function ve(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function Ce(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function Ie(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Re(e){return"esri.renderers.PieChartRenderer"===e.declaredClass}function Fe(e,t){return ge(e)||be(e)||Se(e)||_e(e)||Ie(e)||Re(e)?"2d"===t.type||I(e):pe(e)||me(e)||fe(e)||ve(e)||Ee(e)||Ce(e)||he(e)||ye(e)}function Ve(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function Te(e){return"esri.layers.SubtypeGroupLayer"===e.declaredClass}function ze(e){return"esri.layers.VoxelLayer"===e.declaredClass}function xe(e){return"esri.layers.WMSLayer"===e.declaredClass}function je(e){return"esri.layers.WMTSLayer"===e.declaredClass}function De(e){return"esri.layers.MapImageLayer"===e.declaredClass}function Oe(e){return"esri.layers.TileLayer"===e.declaredClass}function Ae(e){return"esri.layers.FeatureLayer"===e.declaredClass}function Pe(e){return e.declaredClass===ie}function Me(e){return e.declaredClass===ne}function Be(e){return e.declaredClass===ae}function ke(e){return"stretch-ramp"===e.type}function Ue(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type}function Ne(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type&&"above-and-below"===t?.univariateTheme}function qe(e){return"sublayers"in e}async function He(e,t){const s=await se("esri/widgets/Legend/t9n/Legend");return"previewTemplateAriaLabel"!==e||t||(e="previewAriaLabel"),le(s[e],{label:t})}const $e=new ee({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let We={},Ge=class extends r{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.children=new n,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this.addHandles([d((()=>this.children),"change",(t=>{const{added:s,removed:l}=t;s.forEach((t=>{const s=`activeLayerInfo-ready-watcher-${t.layer.uid}`;this.addHandles(y((()=>t.ready),e,m),s)})),l.forEach((e=>this.removeHandles(e.layer.uid))),e()}))]),this.keepCacheOnDestroy||(We={})}destroy(){this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(We=null)}get effectList(){const e=this.layer;let t=null;return"effect"in e&&e.effect&&(t=new _,t.effect=e.effect,t.endTransitions(),t.scale=this.scale),t}get opacity(){const e=this.layer.opacity,t=this.parent?.opacity,s=this.layer.parent,l=s&&"uid"in s?this._getParentLayerOpacity(s):null;return null!=t?t*e:null!=l?l*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(Ae(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet&&e.featureSet.features.length){const t=e.layerDefinition,s=t&&t.drawingInfo,l=s&&C(s.renderer),r=ue.read(t.geometryType);return l?this._getRendererLegendElements(l,{title:e.name,geometryType:r}):(o.getLogger(this).warn("drawingInfo not available!"),null)}return null}));try{const e=[];await u(t).then((t=>{t.forEach((({value:t})=>t&&e.push(...t)))})),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(ze(e))this._constructLegendElementsForVoxellayer();else if(je(e))this._constructLegendElementsForWMTSlayer();else if(xe(e))await this._constructLegendElementsForWMSSublayers();else if(Ve(e))await this._constructLegendElementsForBuildingSceneLayer();else if(De(e)||Oe(e)||Te(e))await this._constructLegendElementsForSublayers();else{this.removeHandles("imageryLayers-watcher");let t="default";if(Pe(e)){const s=e;t=(s?.rasterFunction?.functionName||"default")+"_"+(e.bandIds?.length?e.bandIds.join(""):"###")}await this._getLegendLayers(`${e.uid}-${t}`).then((async t=>{this.legendElements=[],this.notifyChange("ready");const s=t.map((async t=>{if(Pe(e)||Me(e)){const t=y((()=>["renderingRule"in e&&e.rasterFunction,e.bandIds]),(()=>c((async()=>{We.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()}))()));this.addHandles(t,"imageryLayers-watcher")}const s=this._generateSymbolTableElementForLegendLayer(t);s&&s.infos.length&&(Pe(e)&&(s.title=e.title),this.legendElements.push(s)),this.notifyChange("ready")}));await u(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 h((()=>!t.updating));const l=s?"createQuery"in t&&t.createQuery():"createQuery"in e&&e.createQuery();if(!l)return!0;l.geometry=this.view.extent;return 0!==(s?"queryFeatureCount"in t&&await t.queryFeatureCount(l):"queryFeatureCount"in e&&await e.queryFeatureCount(l))}_getParentLayerOpacity(e){let t=1;const s=e.parent;return s&&"uid"in s&&(t=this._getParentLayerOpacity(s)),e.opacity*t}_isGroupActive(){const e=this.children;return!!e.length&&e.some((e=>e.ready))}_isRendererScaleDriven(e){if("dot-density"===e.type)return!0;const t="valueExpression"in e?e.valueExpression:null;if(oe.test(t))return!0;const s="visualVariables"in e?e.visualVariables:null;return!!s&&s.some((e=>this._isScaleDrivenSizeVariable(e)))}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,s=t.minSize,l=t.maxSize;return"object"==typeof s&&s?this._isScaleDrivenSizeVariable(s):"object"==typeof l&&l?this._isScaleDrivenSizeVariable(l):!!t.expression||oe.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&&De(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(y((()=>e.currentVariableId),(()=>this._constructLegendElementsForVoxellayer())),"voxel-current-variable"),this.addHandles(y((()=>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 te({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:l}=t.transferFunction,r=e.toArray().reverse(),i=l.map(((e,t)=>`${0===t?G:J} ${Z(e)}`)).reverse(),n=r.map((e=>({color:e.color,value:null,label:null})));n[0].label=i[0],n[n.length-1].label=i[1],s.push({type:"color-ramp",title:t.label,infos:n,preview:z(r.map((e=>e.color)),{ariaLabel:await He("previewColorRampAriaLabel")})})}const l=e.opacity,r=s.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol)).map((e=>this._getSymbolPreview(e,l)));await u(r),this.legendElements=s,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this.removeHandles("wmts-activeLayer-watcher");const e=this.layer.activeLayer;if(this.addHandles(y((()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer}),(()=>this._constructLegendElementsForWMTSlayer())),"wmts-activeLayer-watcher"),e.styleId&&e.styles){let t=null;e.styles.some((s=>e.styleId===s.id&&(t=s.legendUrl,!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(y((()=>{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.addHandles(e.on("change",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher");const l=e.toArray();for(const r of l){const e=y((()=>[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&&e.infos.length&&s.unshift(e)}}return s}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 r={type:"symbol-table",title:e.title||e.name||String(e.id??""),infos:[]};t&&(s=f(s,t));let i=null;const n=e.layer?.opacity;try{i=(await l(s,{responseType:"image"})).data,i&&(i.style.opacity=n)}catch{}return r.infos.push({src:s,preview:i,opacity:n}),r}_getLegendLayers(e,t){const s=We&&We[e];return s?Promise.resolve(s):this._legendRequest(t).then((t=>{const s=t.layers;return We[e]=s,s}))}_legendRequest(e){const t=this.layer;let s={f:"json",dynamicLayers:e};if(Pe(t)){const e=t.exportImageServiceParameters.rasterFunction;if(e&&(s.renderingRule=JSON.stringify(e.rasterFunctionDefinition||e.toJSON())),t.bandIds&&(s.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:l,customParameters:r}=t;s={raster:e,viewId:l,...s,...r}}}let r=t.url.replace(/(\/)+$/,"");if("version"in t&&+t.version>=10.01){const e=r.indexOf("?");e>-1?r=r.substring(0,e)+"/legend"+r.substring(e):r+="/legend"}else{const e=r.toLowerCase().indexOf("/rest/"),t=r.substring(0,e)+r.substring(e+5,r.length);r=re+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return l(r,{query:s}).then((e=>e.data))}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this.removeHandles("sublayers-watcher");const e=this.layer;this.addHandles(y((()=>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 l=e.toArray();for(const r of l){const e=y((()=>["renderer"in r&&r.renderer,r.opacity,r.title,r.visible]),(()=>this._constructLegendElementsForBuildingSceneLayer()));if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||r.visible){const e=r&&null!=r.opacity?r.opacity:null,l=null!=e?e*t:t;if("building-group"===r.type){const e={type:"symbol-table",title:r.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(r.sublayers,l);e.infos.push(...t),s=[e,...s]}else if(r.renderer){s=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:l,sublayer:r}),...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(De(e)||Oe(e)||Te(e)){this.addHandles(y((()=>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 l=this.layer;let r=[];this.addHandles(e.on("change",(()=>this._constructLegendElementsForSublayers())),"sublayers-watcher");let n=e.toArray();!s&&this.sublayerIds&&this.sublayerIds.length&&(n=Te(l)?this.sublayerIds.map((e=>l.findSublayerForSubtypeCode(e))).filter(i):this.sublayerIds.map((e=>l.findSublayerById(e))).filter(i));for(const i of n){const e=y((()=>[i.renderer,i.opacity,i.title,i.visible,i.legendEnabled]),(()=>this._constructLegendElementsForSublayers()));if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||i.visible&&i.legendEnabled&&this._isSublayerInScale(i)){const e=i&&null!=i.opacity?i.opacity:null,l=null!=e?e*t:t,n=!qe(i)||i.originIdOf("renderer")>S.SERVICE&&!i.sublayers;if(i.renderer&&n){await i.load();r=[...await this._getRendererLegendElements(i.renderer,{title:i.title,opacity:l,sublayer:i}),...r]}else if(qe(i)){const e=await this._generateSymbolTableElementForSublayer(i,l,s);e&&r.unshift(e)}}}return r.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,l=e.source;let r=null;if(!(!l||"map-layer"===l.type&&l.mapLayerId===e.id&&(!l.gdbVersion||l.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>S.SERVICE||e.originIdOf("labelingInfo")>S.SERVICE||e.originIdOf("labelsVisible")>S.SERVICE){const e=new w({layer:this.layer});r=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const i=r||`${t.uid}-default`;(await this._getLegendLayers(i,r)).forEach((e=>s.set(e.layerId,e)))}const l=s.get(e.id);if((!l||l?.subLayerIds&&l.defaultVisibility)&&e.sublayers){const l=await this._generateLegendElementsForSublayers(e.sublayers,t,s);return{type:"symbol-table",title:e.title,infos:l}}return this._generateSymbolTableElementForLegendLayer(l,e,t)}_generateSymbolTableElementForLegendLayer(e,t,s){if(!e||!e.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const l=t?.renderer;let r=t?.title||e.layerName;if(l&&(!t||t?.originIdOf("renderer")>S.SERVICE)){const e=t?.title||this._getRendererTitle(l,t);e&&(r&&"string"!=typeof e&&"title"in e&&(e.title=r),r=e)}const i={type:"symbol-table",title:r,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 l={type:"symbol-table",title:t.heading,legendType:e.legendType||null,infos:this._generateSymbolTableElementInfosForLegendLayer(n.filter((e=>e.groupId===t.id)),e.layerId,s)};l.infos?.length>0&&i.infos.push(l)})):i.infos=this._generateSymbolTableElementInfosForLegendLayer(n,e.layerId,s),i.infos.length>0?i:null}_generateSymbolTableElementInfosForLegendLayer(e,t,l){return e.map((e=>{let r=e.url;if(e.imageData&&e.imageData.length>0)r=`data:image/png;base64,${e.imageData}`;else{if(0===r.indexOf("http"))return null;r=s(`${this.layer.url}/${t}/images/${r}`)}return{label:e.label,src:r,opacity:l??this.opacity,width:e.width,height:e.height}})).filter(i)}_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 l=null,r=null,i=!0;return!s.minScale&&0!==s.minScale||!s.maxScale&&0!==s.maxScale?(0===e.minScale&&s.tileInfo&&(l=s.tileInfo.lods[0].scale),0===e.maxScale&&s.tileInfo&&(r=s.tileInfo.lods[s.tileInfo.lods.length-1].scale)):(l=Math.min(s.minScale,e.minScale)||s.minScale||e.minScale,r=Math.max(s.maxScale,e.maxScale)),(l>0&&l<this.scale||r>this.scale)&&(i=!1),i}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&+this.layer.version<10.1||0===e.length)return e;const s=t.renderer,l=e.some((e=>e.values));let r=0,i=null;return l&&e.some(((e,t)=>(e.values||(r=t,i=e,i.label||(i.label="others")),null!=i))),s?"unique-value"===s.type?i&&(e.splice(r,1),e.push(i)):"class-breaks"===s.type&&(i&&e.splice(r,1),e.reverse(),i&&e.push(i)):i&&(e.splice(r,1),e.push(i)),e}async _getRendererLegendElements(e,t={}){if(!Fe(e,this.view))return o.getLogger(this).warn(`Renderer of type '${e.type}' not supported!`),[];if(Le(e))return this._constructPointCloudRendererLegendElements(e,t);if(Ie(e))return this._constructDotDensityRendererLegendElements(e);const s=await this._loadRenderer(e);return Re(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,l=[];let r=null,i=null;if(ve(e))r={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach((e=>{r.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(ce,e.color)})}));else if(Ee(e)){const t=e.stops;let l=null;if(t?.length&&(1===t.length&&(l=t[0].color),!l)){const e=t[0].value,s=t[t.length-1].value;if(null!=e&&null!=s){l=P(e+(s-e)/2,t)}}r={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(ce,l||ce.color)}]};const n=M(e.stops??[])??[];i={type:"color-ramp",title:s||this._getPointCloudRendererTitle(e),infos:n,preview:z(n.map((e=>e.color)),{ariaLabel:await He("previewColorRampAriaLabel")})}}else Ce(e)&&(r={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos?.forEach((e=>{r.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(ce,e.color)})})));r&&r.infos.length&&l.push(r),i&&i.infos.length&&l.push(i);const n=l.reduce(((e,t)=>[...e,...t.infos??[]]),[]).filter((e=>!!e.symbol)).map((t=>this._getSymbolPreview(t,this.opacity,{symbolConfig:{applyColorModulation:!!e.colorModulation}})));return u(n).then((()=>l))}async _getElementInfoForDotDensity(e,t){const{color:s,label:l,valueExpressionTitle:r}=t,{backgroundColor:i,outline:n,dotSize:a}=e,o=this.effectList,u=o?.effects.map((e=>e.toJSON())),c=L(u),d=await He("previewTemplateAriaLabel",l||r),y=a+"-"+s+"-"+i+"-"+(n&&JSON.stringify(n.toJSON()))+"-"+c,h=this._dotDensityUrlCache,m=h.has(y)?h.get(y):x(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=T([[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&&e.legendOptions.unit,l={type:"symbol-table",title:{value:t&&Math.round(t),unit:s||""},infos:[]};for(const r of e.attributes){const t=await this._getElementInfoForDotDensity(e,r);t.label=r.label||r.valueExpressionTitle||r.field,l.infos.push(t)}return[l]}async _constructPieChartRendererLegendElements(e){const t=this.layer.opacity,s=[];let l=null;const r=e.outline;e.attributes.forEach((e=>{const t=new ee({color:e.color,outline:r}),l=e.label||e.valueExpressionTitle||e.field;s.push({label:l,symbol:t})}));const i=s.length?[...s]:[];if(e.othersCategory?.color&&0!==e.othersCategory?.threshold){const t=new ee({color:e.othersCategory.color,outline:r});l=e.othersCategory.label||"Other",s.push({label:l,symbol:t})}if(e.defaultColor?.a){const t=new ee({color:e.defaultColor,outline:r});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=i.filter((e=>e.label!==l)).map((e=>e.symbol.color)).filter(Boolean),a=j(t,{holePercentage:e.holePercentage,backgroundColor:e.backgroundFillSymbol?.color,effectList:this.effectList,outline:r,ariaLabel:await He("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 u(a),n}async _constructRendererLegendElements(e,t={}){const{title:s,sublayer:l}=t,r=l||this.layer;this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const i=await this._getVisualVariableLegendElements(e,r)||[],n={type:"symbol-table",title:s||this._getRendererTitle(e,r),infos:[]};let a=null,o=!1;const c=new Set;if(ye(e)&&!this._hasSizeRamp){const t=await Q(e);n.infos.push({label:null,symbol:t})}else if(Ue(e)){let t=s;const l=Ne(e)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",r=i.findIndex((e=>"color-ramp"===e.type)),n=-1!==r?i.splice(r,1)[0]:null,a=i.findIndex((e=>"size-ramp"===e.type)),o=-1!==a?i.splice(a,1)[0]:null,u=[];n&&(t=n.title,u.push(n)),o&&(t=o.title,u.push(o)),u.length>0&&i.push({type:l,title:t,infos:u})}else if(_e(e)){const t=U(e);i.push({type:"heatmap-ramp",title:s||this._getRendererTitle(e,r),infos:t,preview:z(t.map((e=>e.color)),{effectList:this.effectList,ariaLabel:await He("previewColorRampAriaLabel")})})}else if(Se(e)){const t=e&&e.authoringInfo;if(t&&"relationship"===t.type){const{numClasses:s,field1:l,field2:a}=t,o=t.focus;if(s&&l&&a){const t=[l,a];let u=N(o)||0;for(const e of t){const{field:t,normalizationField:s,label:l}=e,i=l||{field:this._getFieldAlias(t,r),normField:s&&this._getFieldAlias(s,r)},a=$e.clone();a.angle=u,n.infos.push({label:i,symbol:a}),c.add(a),u+=90}const d=q({focus:o,numClasses:s,infos:e.uniqueValueInfos??[]});i.unshift(d)}}else if(Pe(this.layer)||Me(this.layer))e.uniqueValueInfos?.forEach((e=>{e.symbol&&n.infos.push({label:e.label||e.value,value:e.value,symbol:e.symbol})}));else{const{field:t,field2:l,field3:i,fieldDelimiter:a,valueExpression:u,defaultSymbol:c}=e,d=!(!t&&!u||!l&&!i),y=[];if(e.uniqueValueGroups?.forEach((e=>{const s={type:"symbol-table",title:e.heading,infos:[]};e.classes?.forEach((e=>{const{symbol:n,values:o}=e;if(n){const c=[],y=[];for(const e of o??[]){const{value:s,value2:n,value3:o}=e,h=[],m=[];(t||u)&&(h.push(s),m.push(this._getDomainName(t,s,r))),l&&(h.push(n),m.push(this._getDomainName(l,n,r))),i&&(h.push(o),m.push(this._getDomainName(i,o,r))),c.push(d?h.join(a||""):h[0]),y.push(m.join(" - "))}const h=c.join(", ");let m=e.label;if(!m){const e=y.filter(Boolean);m=e.length?e.join(", "):h}s.infos.push({label:m,value:h,symbol:n})}})),s.infos.length&&y.push(s)})),y.length){const t=y[0];1===y.length&&"title"in t&&!t.title?n.infos.push(...t.infos??[]):(c&&(y.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:c}]}),o=!0),n.infos.push(...y)),s||e.legendOptions&&e.legendOptions.title||e.valueExpressionTitle||(n.title=null)}}e.defaultSymbol&&!o&&(n.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),o=!0)}else if(be(e)){a=this._isUnclassedRenderer(e);(!a||!this._hasSizeRamp)&&(e.classBreakInfos.forEach((e=>{e.symbol&&n.infos.unshift({label:e.label||(a?null:e.minValue+" - "+e.maxValue),value:[e.minValue,e.maxValue],symbol:e.symbol})})),a&&(n.title=null),this._updateInfosforClassedSizeRenderer(e,n.infos)),e.defaultSymbol&&!a&&(n.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),o=!0)}else if(pe(e))if(Me(this.layer)||Be(this.layer)){const t=await this._constructTileImageryStretchRendererElements(e);ke(t)?i.push(t):n.infos=t}else{const t=this.layer;let s,l;if(e.statistics?.length){const t=e.statistics[0];K(t)?(s=t.min,l=t.max):[s,l]=t}let r=[],a=t.serviceRasterInfo;if(t.rasterFunction)try{a=await t.generateRasterInfo(t.rasterFunction)}catch{}const o=a.keyProperties.BandProperties,u=E(a.pixelType);if(1===a.bandCount){const r=t.bandIds?.[0]||0;s=null!=s?s:a.statistics?a.statistics[r].min:u[0],l=null!=l?l:a.statistics?a.statistics[r].max:u[1],s||l?i.push(await this._getStretchLegendElements(e,{min:s,max:l})):this._getServerSideLegend()}else t.bandIds&&1===t.bandIds.length?(s=null!=s?s:a.statistics?a.statistics[t.bandIds[0]].min:u[0],l=null!=l?l:a.statistics?a.statistics[t.bandIds[0]].max:u[1],s||l?i.push(await this._getStretchLegendElements(e,{min:s,max:l})):this._getServerSideLegend()):a.bandCount>=3?o&&o.length>=a.bandCount?t.bandIds&&3===t.bandIds.length?(r=t.bandIds.map((e=>o[e].BandName)),n.infos=this._createSymbolTableElementMultiBand(r)):"lerc"===t.format?(r=[0,1,2].map((e=>o[e].BandName)),n.infos=this._createSymbolTableElementMultiBand(r)):this._getServerSideLegend():"lerc"===t.format?(r=["band1","band2","band3"],n.infos=this._createSymbolTableElementMultiBand(r)):this._getServerSideLegend():this._getServerSideLegend()}else if(me(e))e.colormapInfos.forEach((e=>{n.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(de,e.color)})}));else if(ge(e)){let s=e.symbol;switch(t.geometryType){case"point":s="pointSymbol"in r?r.pointSymbol:null;break;case"polyline":s="lineSymbol"in r?r.lineSymbol:null;break;case"polygon":s="polygonSymbol"in r?r.polygonSymbol:null}const l=this._hasClusterSizeVariable&&this._getClusterSymbol()||!this._hasSizeRamp;e.symbol&&l&&n.infos.push({label:e.label,symbol:s})}else if(he(e)){e.outputUnit&&(this.title="("+e.toJSON().outputUnit+")"),n.title=e.attributeField;const t=e.getClassBreakInfos();t?.length?t.forEach((e=>{n.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})})):n.infos.push({label:e.attributeField,symbol:e.getDefaultSymbol()})}else fe(e)&&i.push(await this._getStretchLegendElements(e,{min:0,max:255}));const d=e.defaultSymbol;!d||o||ge(e)||a&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||i.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:d}]}),n.infos.length&&i.unshift(n);const y=null==t.opacity?this.opacity:t.opacity,h=this._isTallSymbol("visualVariables"in e?e.visualVariables:null),m=Pe(this.layer)||Me(this.layer),p=i.reduce(((e,t)=>[...e,...this._getAllInfos(t)]),[]).filter((e=>!!e?.symbol)).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 u(p),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,{rasterInfo:s}=t.raster,l=s.bandCount||e.statistics.length;let r,i,n=[];const a=s.keyProperties&&s.keyProperties.BandProperties,o=e?.statistics?.length?e.statistics:s?.statistics;if(o){const e=o[0];K(e)?(r=e.min,i=e.max):[r,i]=e}else{const e=E(s.pixelType);r=e[0],i=e[1]}if(t.hasStandardTime()&&(r=t.getStandardTimeValue(r),i=t.getStandardTimeValue(i)),1===s.bandCount||1===t.bandIds?.length)return this._getStretchLegendElements(e,{min:r,max:i});function u(e){const l=(t?.bandIds?.length?t.bandIds:Array.from(Array(Math.min(s.bandCount,3)).keys())).map((t=>e&&e[t]&&e[t].BandName||"band"+(t+1)));return l.length<3?l.push(l[1]):l.length>3&&l.splice(3),l}return n=a&&a.length>=l?u(a):u(),this._createSymbolTableElementMultiBand(n)}async _getStretchLegendElements(e,t){const s=e.colorRamp,l=B(s,t);return{type:"stretch-ramp",title:"",infos:l,preview:z(l.map((e=>e.color)),{ariaLabel:await He("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,l){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(t):e,infos:await H(s,t,await X(s),this.scale,this.view.type,!!l,this._hasClusterSizeVariable?this._getClusterSymbol():null)}}_createSymbolTableElementMultiBand(e){const t=[],s=["red","green","blue"];return e.forEach(((e,l)=>{t.push({label:{colorName:s[l],bandName:e},src:Y[l],opacity:this.opacity??1})})),t}_updateInfosforClassedSizeRenderer(e,t){const s=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,l=e.classBreakInfos.some((e=>O(e.symbol)));if(s&&l){const s=$,l=W,r=e.classBreakInfos.length,i=(s-l)/(r>1?r-1:r);t.forEach(((e,t)=>{e.size=s-i*t}))}}_isTallSymbol(e){let t=!1,s=!1;if(e)for(let l=0;l<e.length&&(!t||!s);l++){const r=e[l];"size"===r.type&&("height"===r.axis&&(t=!0),"width-and-depth"===r.axis&&(s=!0))}return t&&s}async _getSymbolPreview(e,t,s){let l=!s?.isDefault&&null==e.size&&this._hasSizeRamp?p(V.size):e.size;if(this._scaleDrivenSizeVariable&&s?.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");l=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}return D(e.symbol,{size:l,opacity:t,scale:!1,symbolConfig:s?.symbolConfig,effectView:s?.effectList,ariaLabel:e.label&&"string"!=typeof e.label?null:await He("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(),l=A(this.layerView._effectiveRenderer,this.view);if(l&&null!=s&&"visualVariables"in s){const t=s.visualVariables?.some((e=>"size"===e.type&&"outline"!==e.target&&!oe.test(e.valueExpression)));if(!t){if("clusterMinSize"in e&&"clusterMaxSize"in e){const{clusterMinSize:t,clusterMaxSize:s}=e;l.legendOptions=new R({showLegend:t!==s})}const t=s.visualVariables||[];s.visualVariables=t.concat([l]),this._hasClusterSizeVariable=!0}}return s}async _loadRenderer(e){const t=[],s=e.clone(),l=await X(s);if(be(s)||Se(s)){const e=(s.classBreakInfos||s.uniqueValueInfos).map((e=>this._fetchSymbol(e.symbol,l).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:l).then((e=>{this._applySymbolToRenderer(s,e,ge(s))})).catch((()=>{this._applySymbolToRenderer(s,null,ge(s))}))),u(t).then((()=>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 l=await("2d"===this.view.type?e.fetchCIMSymbol({cache:s}):e.fetchSymbol({cache:s}));return this._getAppliedCloneSymbol(l,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 l=e.clone(),r=s&&s.toRgba();return l.type.includes("3d")?this._applyColorTo3dSymbol(l,r):"cim"===l.type?F(l,s):l.color&&(l.color=new t(r||l.color)),l}_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)||!e.visualVariables||"vector-field"===e.type)return null;const s=e.visualVariables,l=[],r=[],n=[];for(const i of s)"color"===i.type?l.push(i):"size"===i.type?r.push(i):"opacity"===i.type&&n.push(i);const a=[...l,...r,...n];let o,u;if(0===l.length&&be(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];o=t&&t.symbol}if(0===l.length&&ge(e)&&(o=e.symbol),o)if(o.type.includes("3d")){const e=o.symbolLayers.getItemAt(0);"water"===e.type?null!=e.color&&(u=e.color):null!=e.material&&null!=e.material.color&&(u=e.material.color)}else o.url||(u=o.color);const c=this.effectList;return(await Promise.all(a.map((async s=>{if(!s.legendOptions||!1!==s.legendOptions.showLegend){const l=ye(e)?s.field:this._getRampTitle(s,t);let r=null;const i="getField"in t?t.getField?.(s.field):null,n=i&&v(i);if("color"===s.type){const e=await k(s,null,n)??[];r={type:"color-ramp",title:l,infos:e,preview:z(e.map((e=>e.color)),{effectList:c,ariaLabel:await He("previewColorRampAriaLabel")})},this._hasColorRamp||(this._hasColorRamp=e.length>0)}else if("size"===s.type&&"outline"!==s.target)oe.test(s.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=s):(r=await this._getSizeLegendElement(l,s,e,n),this._hasSizeRamp||(this._hasSizeRamp=!(null==r.infos||!r.infos.length)));else if("opacity"===s.type){const e=await k(s,u,n)??[];r={type:"opacity-ramp",title:l,infos:e,preview:z(e.map((e=>e.color)),{effectList:c,ariaLabel:await He("previewColorRampAriaLabel")})},this._hasOpacityRamp||(this._hasOpacityRamp=e.length>0)}return r&&r.infos?r:null}})))).filter(i)}_getDomainName(e,t,s){if(e&&"function"!=typeof e){const l="getField"in s&&s.getField&&s.getField(e),r=l&&"getFieldDomain"in s&&s.getFieldDomain?s.getFieldDomain(l.name):null;return"coded-value"===r?.type?r.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,l="popupTemplate"in e&&e.popupTemplate,r=l&&l.fieldInfos;if(r)for(const t of r)if(t.fieldName===s)return"cluster_count"===s?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let s=e.field,l=e.normalizationField,r=!1,i=!1,n=!1,a=null;s="function"==typeof s?null:s,l="function"==typeof l?null:l;const o=e.legendOptions&&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&&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){r=!0;break}if("percent"===s.style){i=!0;break}if("percent-of-total"===s.style){n=!0;break}}}}a={field:s&&this._getFieldAlias(s,t),normField:l&&this._getFieldAlias(l,t),ratio:r,ratioPercent:i,ratioPercentTotal:n}}return a}_getRendererTitle(e,t){const s=e;if(s.legendOptions&&s.legendOptions.title)return s.legendOptions.title;if(s.valueExpressionTitle)return s.valueExpressionTitle;let l=s.field,r=null,i=null;if(be(s)&&(r=s.normalizationField,i="percent-of-total"===s.normalizationType),l="function"==typeof l?null:l,r="function"==typeof r?null:r,Se(s)){const{field2:e,field3:r,fieldDelimiter:i}=s;let n=l&&this._getFieldAlias(l,t);return e&&(n=`<${n}>${i}<${this._getFieldAlias(e,t)}>`,r&&(n=`${n}${i}<${this._getFieldAlias(r,t)}>`)),n}let n=null;return(l||r)&&(n={field:l&&this._getFieldAlias(l,t),normField:r&&this._getFieldAlias(r,t),normByPct:i}),n}_getFieldAlias(e,t){const s="popupTemplate"in t?t.popupTemplate:null,l=s?.fieldInfos;let r;l&&l.some((t=>e===t.fieldName&&(r=t,!0)));let i=null;"getField"in t&&t.getField?i=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(i=t.fieldsIndex.get(e));let n=null;const a="featureReduction"in t&&t.featureReduction;a&&(!r&&"popupTemplate"in a&&a.popupTemplate&&a.popupTemplate.fieldInfos&&a.popupTemplate.fieldInfos.some((t=>e?.toLowerCase()===t.fieldName?.toLowerCase()&&(r=t,!0))),"fields"in a&&a.fields&&(n=a.fields.find((t=>t.name?.toLowerCase()===e?.toLowerCase()))));const o=r||i||n;let u=null;return o&&(u=r?.label||i?.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 be(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()],Ge.prototype,"children",void 0),e([g({readOnly:!0})],Ge.prototype,"effectList",null),e([g()],Ge.prototype,"layerView",void 0),e([g()],Ge.prototype,"layer",void 0),e([g()],Ge.prototype,"legendElements",void 0),e([g({readOnly:!0})],Ge.prototype,"opacity",null),e([g()],Ge.prototype,"parent",void 0),e([g({readOnly:!0,dependsOn:[]})],Ge.prototype,"ready",null),e([g()],Ge.prototype,"hideLayersNotInCurrentView",void 0),e([g()],Ge.prototype,"keepCacheOnDestroy",void 0),e([g()],Ge.prototype,"respectLayerVisibility",void 0),e([g({readOnly:!0})],Ge.prototype,"scale",null),e([g()],Ge.prototype,"sublayerIds",void 0),e([g({readOnly:!0})],Ge.prototype,"isScaleDriven",null),e([g()],Ge.prototype,"title",void 0),e([g({readOnly:!0,dependsOn:["ready"],value:0})],Ge.prototype,"version",null),e([g()],Ge.prototype,"view",void 0),Ge=e([b("esri.widgets.Legend.support.ActiveLayerInfo")],Ge);const Je=Ge;export{Je 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{on as o}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import r from"../Widget.js";let i=class extends r{constructor(e,o){super(e,o),this.type=null,this.viewModel=null}initialize(){this.addHandles([o((()=>this.viewModel),"animate",(()=>{this.animate()})),o((()=>this.viewModel),"next",(()=>{this.next()})),o((()=>this.viewModel),"previous",(()=>{this.previous()}))])}};e([s()],i.prototype,"type",void 0),e([s()],i.prototype,"viewModel",void 0),i=e([t("esri.widgets.ValuePicker.BaseComponent")],i);const p=i;export{p as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{on as s}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import r from"../Widget.js";let i=class extends r{constructor(e,s){super(e,s),this.type=null,this.viewModel=null}initialize(){this.addHandles([s((()=>this.viewModel),"animate",(e=>{this.animate(e.first)})),s((()=>this.viewModel),"next",(()=>{this.next()})),s((()=>this.viewModel),"previous",(()=>{this.previous()}))])}};e([o()],i.prototype,"type",void 0),e([o()],i.prototype,"viewModel",void 0),i=e([t("esri.widgets.ValuePicker.BaseComponent")],i);const p=i;export{p 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import"../support/widgetUtils.js";import{tsx as s}from"../support/jsxFactory.js";import l from"./ValuePickerBaseComponent.js";let r=class extends l{constructor(e,t){super(e,t),this.collection=null,this.type="collection"}get canNext(){return!(!this.collection?.length||!this.viewModel)&&this.collection.at(-1)!==this.viewModel.values?.[0]}get canPlay(){return null!=this.viewModel&&!!this.collection?.length}get canPrevious(){return!(!this.collection?.length||!this.viewModel)&&this.collection.at(0)!==this.viewModel.values?.[0]}render(){return s("div",null)}animate(){this._step(1)}next(){this._step(1)}previous(){this._step(-1)}_step(e){if(!this.viewModel||!this.collection?.length)return;if(!this.viewModel.values)return void(this.viewModel.values=[this.collection.at(0)]);if(!this.collection.includes(this.viewModel.values[0]))return void(this.viewModel.values=[this.collection.at(0)]);const t=this.collection.indexOf(this.viewModel.values[0])+e;t<0||t>=this.collection.length?this.viewModel.loop?this.viewModel.values=[this.collection.at(1===e?0:-1)]:"playing"===this.viewModel.state&&this.viewModel.pause():this.viewModel.values=[this.collection.at(t)]}};e([o()],r.prototype,"canNext",null),e([o()],r.prototype,"canPlay",null),e([o()],r.prototype,"canPrevious",null),e([o({type:t})],r.prototype,"collection",void 0),e([o()],r.prototype,"type",void 0),r=e([i("esri.widgets.ValuePicker.ValuePickerCollection")],r);const c=r;export{c as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import"../support/widgetUtils.js";import{tsx as s}from"../support/jsxFactory.js";import l from"./ValuePickerBaseComponent.js";let r=class extends l{constructor(e,t){super(e,t),this.collection=null,this.type="collection"}get canNext(){return!(!this.collection?.length||!this.viewModel)&&this.collection.at(-1)!==this.viewModel.values?.[0]}get canPlay(){return null!=this.viewModel&&!!this.collection?.length}get canPrevious(){return!(!this.collection?.length||!this.viewModel)&&this.collection.at(0)!==this.viewModel.values?.[0]}render(){return s("div",null)}animate(e){this._step(1,e)}next(){this._step(1)}previous(){this._step(-1)}_step(e,t=!1){if(!this.viewModel||!this.collection?.length)return;if(!this.viewModel.values)return void(this.viewModel.values=[this.collection.at(0)]);if(!this.collection.includes(this.viewModel.values[0]))return void(this.viewModel.values=[this.collection.at(0)]);const o=this.collection.indexOf(this.viewModel.values[0])+e;o<0||o>=this.collection.length?this.viewModel.loop||t?this.viewModel.values=[this.collection.at(1===e?0:-1)]:"playing"===this.viewModel.state&&this.viewModel.pause():this.viewModel.values=[this.collection.at(o)]}};e([o()],r.prototype,"canNext",null),e([o()],r.prototype,"canPlay",null),e([o()],r.prototype,"canPrevious",null),e([o({type:t})],r.prototype,"collection",void 0),e([o()],r.prototype,"type",void 0),r=e([i("esri.widgets.ValuePicker.ValuePickerCollection")],r);const c=r;export{c 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.27/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/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{loadCalciteComponents as s}from"../support/componentsUtils.js";import"../support/widgetUtils.js";import{tsx as l}from"../support/jsxFactory.js";import i from"./ValuePickerBaseComponent.js";const r="esri-value-picker__combobox";let a=class extends i{constructor(e,t){super(e,t),this.items=null,this.placeholder=null,this.type="combobox"}loadDependencies(){return s({combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js")})}get canNext(){return!(!this.items||!this.viewModel)&&this.items.findIndex((({value:e})=>e===this.viewModel.values?.[0]))!==this.items.length-1}get canPlay(){return null!=this.viewModel&&!!this.items?.length}get canPrevious(){const{items:e,viewModel:t}=this;return!(!e||!t)&&0!==e.findIndex((({value:e})=>e===t.values?.[0]))}render(){const{viewModel:e}=this;if(null==e)return l("div",null);const t=e.values?.[0];return l("div",{class:r},l("calcite-combobox",{disabled:e.disabled,label:this.label,maxItems:10,placeholder:this.placeholder??void 0,selectionMode:"single",onCalciteComboboxChange:t=>{Array.isArray(t.target.value)||(null!=e.values?e.values[0]!==t.target.value&&(e.values=[t.target.value]):e.values=[t.target.value])}},this.items?.map((({value:e,label:o},s)=>l("calcite-combobox-item",{key:s,selected:e===t,textLabel:o,value:e})))))}animate(){this._step(1)}next(){this._step(1)}previous(){this._step(-1)}_step(e){const{viewModel:t,items:o}=this;if(!o?.length||!t)return;if(!t.values)return void(t.values=[o[0].value]);const s=o.findIndex((({value:e})=>e===t.values[0]));if(-1===s)return void(t.values=[o[0].value]);const l=s+e;l<0||l>=o.length?t.loop?t.values=[o[1===e?0:o.length-1].value]:"playing"===t.state&&t.pause():t.values=[o[l].value]}};e([t()],a.prototype,"canNext",null),e([t()],a.prototype,"canPlay",null),e([t()],a.prototype,"canPrevious",null),e([t()],a.prototype,"items",void 0),e([t()],a.prototype,"placeholder",void 0),e([t()],a.prototype,"type",void 0),a=e([o("esri.widgets.ValuePicker.ValuePickerCombobox")],a);const c=a;export{c as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{loadCalciteComponents as s}from"../support/componentsUtils.js";import"../support/widgetUtils.js";import{tsx as l}from"../support/jsxFactory.js";import i from"./ValuePickerBaseComponent.js";const r="esri-value-picker__combobox";let a=class extends i{constructor(e,t){super(e,t),this.items=null,this.placeholder=null,this.type="combobox"}loadDependencies(){return s({combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js")})}get canNext(){return!(!this.items||!this.viewModel)&&this.items.findIndex((({value:e})=>e===this.viewModel.values?.[0]))!==this.items.length-1}get canPlay(){return null!=this.viewModel&&!!this.items?.length}get canPrevious(){const{items:e,viewModel:t}=this;return!(!e||!t)&&0!==e.findIndex((({value:e})=>e===t.values?.[0]))}render(){const{viewModel:e}=this;if(null==e)return l("div",null);const t=e.values?.[0];return l("div",{class:r},l("calcite-combobox",{disabled:e.disabled,label:this.label,maxItems:10,placeholder:this.placeholder??void 0,selectionMode:"single",onCalciteComboboxChange:t=>{Array.isArray(t.target.value)||(null!=e.values?e.values[0]!==t.target.value&&(e.values=[t.target.value]):e.values=[t.target.value])}},this.items?.map((({value:e,label:o},s)=>l("calcite-combobox-item",{key:s,selected:e===t,textLabel:o,value:e})))))}animate(e){this._step(1,e)}next(){this._step(1)}previous(){this._step(-1)}_step(e,t=!1){const{viewModel:o,items:s}=this;if(!s?.length||!o)return;if(!o.values)return void(o.values=[s[0].value]);const l=s.findIndex((({value:e})=>e===o.values[0]));if(-1===l)return void(o.values=[s[0].value]);const i=l+e;i<0||i>=s.length?o.loop||t?o.values=[s[1===e?0:s.length-1].value]:"playing"===o.state&&o.pause():o.values=[s[i].value]}};e([t()],a.prototype,"canNext",null),e([t()],a.prototype,"canPlay",null),e([t()],a.prototype,"canPrevious",null),e([t()],a.prototype,"items",void 0),e([t()],a.prototype,"placeholder",void 0),e([t()],a.prototype,"type",void 0),a=e([o("esri.widgets.ValuePicker.ValuePickerCombobox")],a);const c=a;export{c 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.27/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/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import"../support/widgetUtils.js";import{tsx as r}from"../support/jsxFactory.js";import o from"./ValuePickerBaseComponent.js";const i="esri-value-picker__label",l={border:`${i}-border`,text:`${i}-text`};let a=class extends o{constructor(e,t){super(e,t),this.items=null,this.type="label"}get canNext(){return!(!this.items||!this.viewModel)&&this.items.findIndex((({value:e})=>e===this.viewModel.values?.[0]))!==this.items.length-1}get canPlay(){return null!=this.viewModel&&!!this.items?.length}get canPrevious(){const{items:e,viewModel:t}=this;return!(!e||!t)&&0!==e.findIndex((({value:e})=>e===t.values?.[0]))}render(){const{viewModel:e}=this;if(null==e)return r("div",null);const t=this.items?.find((({value:t})=>t===e.values?.[0]));return r("div",{class:i},r("div",{class:l.border},r("div",{class:l.text},t?.label)))}animate(){this._step(1)}next(){this._step(1)}previous(){this._step(-1)}_step(e){const{viewModel:t,items:s}=this;if(!s?.length||!t)return;if(!t.values)return void(t.values=[s[0].value]);const r=s.findIndex((({value:e})=>e===t.values[0]));if(-1===r)return void(t.values=[s[0].value]);const o=r+e;o<0||o>=s.length?t.loop?t.values=[s[1===e?0:s.length-1].value]:"playing"===t.state&&t.pause():t.values=[s[o].value]}};e([t()],a.prototype,"canNext",null),e([t()],a.prototype,"canPlay",null),e([t()],a.prototype,"canPrevious",null),e([t()],a.prototype,"items",void 0),e([t()],a.prototype,"type",void 0),a=e([s("esri.widgets.ValuePicker.ValuePickerLabel")],a);const n=a;export{n as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import"../support/widgetUtils.js";import{tsx as r}from"../support/jsxFactory.js";import o from"./ValuePickerBaseComponent.js";const i="esri-value-picker__label",l={border:`${i}-border`,text:`${i}-text`};let a=class extends o{constructor(e,t){super(e,t),this.items=null,this.type="label"}get canNext(){return!(!this.items||!this.viewModel)&&this.items.findIndex((({value:e})=>e===this.viewModel.values?.[0]))!==this.items.length-1}get canPlay(){return null!=this.viewModel&&!!this.items?.length}get canPrevious(){const{items:e,viewModel:t}=this;return!(!e||!t)&&0!==e.findIndex((({value:e})=>e===t.values?.[0]))}render(){const{viewModel:e}=this;if(null==e)return r("div",null);const t=this.items?.find((({value:t})=>t===e.values?.[0]));return r("div",{class:i},r("div",{class:l.border},r("div",{class:l.text},t?.label)))}animate(e){this._step(1,e)}next(){this._step(1)}previous(){this._step(-1)}_step(e,t=!1){const{viewModel:s,items:r}=this;if(!r?.length||!s)return;if(!s.values)return void(s.values=[r[0].value]);const o=r.findIndex((({value:e})=>e===s.values[0]));if(-1===o)return void(s.values=[r[0].value]);const i=o+e;i<0||i>=r.length?s.loop||t?s.values=[r[1===e?0:r.length-1].value]:"playing"===s.state&&s.pause():s.values=[r[i].value]}};e([t()],a.prototype,"canNext",null),e([t()],a.prototype,"canPlay",null),e([t()],a.prototype,"canPrevious",null),e([t()],a.prototype,"items",void 0),e([t()],a.prototype,"type",void 0),a=e([s("esri.widgets.ValuePicker.ValuePickerLabel")],a);const n=a;export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{debounce as t}from"../../core/promiseUtils.js";import{watch as s,initial as i}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import r from"../Slider.js";import{loadCalciteComponents as n}from"../support/componentsUtils.js";import"../support/widgetUtils.js";import{tsx as a}from"../support/jsxFactory.js";import u from"./ValuePickerBaseComponent.js";import p from"./ValuePickerSliderVisibleElements.js";const c="esri-value-picker__slider",d={minorTick:`${c}__tick-minor`,majorTick:`${c}__tick-major`,stepsTick:`${c}__tick-steps`};function h(e){return(t,s)=>{s?.classList.add(e)}}let m=class extends u{constructor(e,s){super(e,s),this._majorTickCreatedFunction=h(d.majorTick),this._minorTickCreatedFunction=h(d.minorTick),this._stepsTickCreatedFunction=h(d.stepsTick),this._thumbNode=null,this._tooltip=null,this._slider=new r({thumbCreatedFunction:(e,t,s)=>{this._thumbNode=s}}),this.labelFormatFunction=null,this.labels=null,this.min=null,this.minorTicks=null,this.majorTicks=null,this.max=null,this.reversed=!1,this.steps=null,this.type="slider",this.visibleElements=new p,this._thumbDragDebounced=t((async e=>{await(this._tooltip?.reposition(!1))}))}initialize(){this.addHandles([s((()=>this.viewModel?.values),(e=>{this._slider.values=e}),i),s((()=>this._slider.values),(e=>{this.viewModel&&this.viewModel.values!==e&&(this.viewModel.values=e)})),this._slider.on("thumb-drag",this._thumbDragDebounced)])}destroy(){this._slider.destroy()}loadDependencies(){return n({tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}get _ascending(){const{reversed:e,viewModel:t}=this;if(!t)return null;const{layout:s}=t;return"horizontal"===s&&!e||"vertical"===s&&e}get canNext(){const{_ascending:e,min:t,max:s,steps:i,viewModel:o}=this;if(null==e||null==t||null==s||!i?.length||!o)return!1;const{values:l}=o,r=l?.[0];return null==r||(e?r!==i[i.length-1]:r!==i[0])}get canPlay(){return null!=this.viewModel&&!!this.steps?.length&&null!=this.min&&null!=this.max}get canPrevious(){const{_ascending:e,min:t,max:s,steps:i,viewModel:o}=this;if(null==e||null==t||null==s||!i?.length||!o)return!1;const{values:l}=o,r=l?.[0];return null==r||(e?r!==i[0]:r!==i[i.length-1])}render(){const{labels:e,labelFormatFunction:t,min:s,max:i,steps:o,minorTicks:l,majorTicks:r,reversed:n,viewModel:u}=this;if(!u)return a("div",null);const{disabled:p,layout:d}=u,h=`${d}${n?"-reversed":""}`,m="position",v=[];return null!=s&&null!=i&&(l&&v.push({mode:m,values:l,tickCreatedFunction:this._minorTickCreatedFunction}),r&&v.push({mode:m,values:r,tickCreatedFunction:this._majorTickCreatedFunction}),e&&v.push({mode:m,values:e,labelsVisible:!0}),this.visibleElements.steps&&this.steps&&v.push({mode:m,values:this.steps,tickCreatedFunction:this._stepsTickCreatedFunction})),this._slider.set({disabled:p,labelFormatFunction:t,layout:h,min:s,max:i,steps:o,tickConfigs:v}),a("div",{class:c},this._slider.render(),this._renderToolTip())}animate(){this._step(this._ascending?1:-1)}next(){this._step(this._ascending?1:-1)}previous(){this._step(this._ascending?-1:1)}_onTooltipAfterCreate(e){this._tooltip=e}_renderToolTip(){if(!this.visibleElements.thumbTooltip||!this._thumbNode||!this._slider.values)return null;const e=this._slider.viewModel.getLabelForValue(this._slider.values[0],"value");return e?a("calcite-tooltip",{afterCreate:this._onTooltipAfterCreate,label:e,referenceElement:this._thumbNode},e):null}_step(e){if(!this.viewModel||!this.steps?.length)return;if(!this.viewModel.values||!this.steps.includes(this.viewModel.values[0]))return void(this.viewModel.values=[this.steps[0]]);const t=this.steps.indexOf(this.viewModel.values[0])+e;t<0||t>=this.steps.length?this.viewModel.loop?this.viewModel.values=[this.steps[1===e?0:this.steps.length-1]]:"playing"===this.viewModel.state&&this.viewModel.pause():this.viewModel.values=[this.steps[t]]}};e([o()],m.prototype,"_ascending",null),e([o()],m.prototype,"canNext",null),e([o()],m.prototype,"canPlay",null),e([o()],m.prototype,"canPrevious",null),e([o()],m.prototype,"labelFormatFunction",void 0),e([o()],m.prototype,"labels",void 0),e([o()],m.prototype,"min",void 0),e([o()],m.prototype,"minorTicks",void 0),e([o()],m.prototype,"majorTicks",void 0),e([o()],m.prototype,"max",void 0),e([o({nonNullable:!0})],m.prototype,"reversed",void 0),e([o()],m.prototype,"steps",void 0),e([o()],m.prototype,"type",void 0),e([o({type:p,nonNullable:!0})],m.prototype,"visibleElements",void 0),m=e([l("esri.widgets.ValuePicker.ValuePickerSlider")],m);const v=m;export{v as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{debounce as t}from"../../core/promiseUtils.js";import{watch as s,initial as i}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import r from"../Slider.js";import{loadCalciteComponents as n}from"../support/componentsUtils.js";import"../support/widgetUtils.js";import{tsx as a}from"../support/jsxFactory.js";import u from"./ValuePickerBaseComponent.js";import p from"./ValuePickerSliderVisibleElements.js";const c="esri-value-picker__slider",d={minorTick:`${c}__tick-minor`,majorTick:`${c}__tick-major`,stepsTick:`${c}__tick-steps`};function h(e){return(t,s)=>{s?.classList.add(e)}}let m=class extends u{constructor(e,s){super(e,s),this._majorTickCreatedFunction=h(d.majorTick),this._minorTickCreatedFunction=h(d.minorTick),this._stepsTickCreatedFunction=h(d.stepsTick),this._thumbNode=null,this._tooltip=null,this._slider=new r({thumbCreatedFunction:(e,t,s)=>{this._thumbNode=s}}),this.labelFormatFunction=null,this.labels=null,this.min=null,this.minorTicks=null,this.majorTicks=null,this.max=null,this.reversed=!1,this.steps=null,this.type="slider",this.visibleElements=new p,this._thumbDragDebounced=t((async e=>{await(this._tooltip?.reposition(!1))}))}initialize(){this.addHandles([s((()=>this.viewModel?.values),(e=>{this._slider.values=e}),i),s((()=>this._slider.values),(e=>{this.viewModel&&this.viewModel.values!==e&&(this.viewModel.values=e)})),this._slider.on("thumb-drag",this._thumbDragDebounced)])}destroy(){this._slider.destroy()}loadDependencies(){return n({tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}get _ascending(){const{reversed:e,viewModel:t}=this;if(!t)return null;const{layout:s}=t;return"horizontal"===s&&!e||"vertical"===s&&e}get canNext(){const{_ascending:e,min:t,max:s,steps:i,viewModel:o}=this;if(null==e||null==t||null==s||!i?.length||!o)return!1;const{values:l}=o,r=l?.[0];return null==r||(e?r!==i[i.length-1]:r!==i[0])}get canPlay(){return null!=this.viewModel&&!!this.steps?.length&&null!=this.min&&null!=this.max}get canPrevious(){const{_ascending:e,min:t,max:s,steps:i,viewModel:o}=this;if(null==e||null==t||null==s||!i?.length||!o)return!1;const{values:l}=o,r=l?.[0];return null==r||(e?r!==i[0]:r!==i[i.length-1])}render(){const{labels:e,labelFormatFunction:t,min:s,max:i,steps:o,minorTicks:l,majorTicks:r,reversed:n,viewModel:u}=this;if(!u)return a("div",null);const{disabled:p,layout:d}=u,h=`${d}${n?"-reversed":""}`,m="position",v=[];return null!=s&&null!=i&&(l&&v.push({mode:m,values:l,tickCreatedFunction:this._minorTickCreatedFunction}),r&&v.push({mode:m,values:r,tickCreatedFunction:this._majorTickCreatedFunction}),e&&v.push({mode:m,values:e,labelsVisible:!0}),this.visibleElements.steps&&this.steps&&v.push({mode:m,values:this.steps,tickCreatedFunction:this._stepsTickCreatedFunction})),this._slider.set({disabled:p,labelFormatFunction:t,layout:h,min:s,max:i,steps:o,tickConfigs:v}),a("div",{class:c},this._slider.render(),this._renderToolTip())}animate(e){this._step(1,e)}next(){this._step(this._ascending?1:-1)}previous(){this._step(this._ascending?-1:1)}_onTooltipAfterCreate(e){this._tooltip=e}_renderToolTip(){if(!this.visibleElements.thumbTooltip||!this._thumbNode||!this._slider.values)return null;const e=this._slider.viewModel.getLabelForValue(this._slider.values[0],"value");return e?a("calcite-tooltip",{afterCreate:this._onTooltipAfterCreate,label:e,referenceElement:this._thumbNode},e):null}_step(e,t=!1){if(!this.viewModel||!this.steps?.length)return;if(!this.viewModel.values||!this.steps.includes(this.viewModel.values[0]))return void(this.viewModel.values=[this.steps[0]]);const s=this.steps.indexOf(this.viewModel.values[0])+e;s<0||s>=this.steps.length?this.viewModel.loop||t?this.viewModel.values=[this.steps[1===e?0:this.steps.length-1]]:"playing"===this.viewModel.state&&this.viewModel.pause():this.viewModel.values=[this.steps[s]]}};e([o()],m.prototype,"_ascending",null),e([o()],m.prototype,"canNext",null),e([o()],m.prototype,"canPlay",null),e([o()],m.prototype,"canPrevious",null),e([o()],m.prototype,"labelFormatFunction",void 0),e([o()],m.prototype,"labels",void 0),e([o()],m.prototype,"min",void 0),e([o()],m.prototype,"minorTicks",void 0),e([o()],m.prototype,"majorTicks",void 0),e([o()],m.prototype,"max",void 0),e([o({nonNullable:!0})],m.prototype,"reversed",void 0),e([o()],m.prototype,"steps",void 0),e([o()],m.prototype,"type",void 0),e([o({type:p,nonNullable:!0})],m.prototype,"visibleElements",void 0),m=e([l("esri.widgets.ValuePicker.ValuePickerSlider")],m);const v=m;export{v 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Evented.js";import e from"../../core/Logger.js";import{after as r,isAbortError as i}from"../../core/promiseUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";let l=class extends o.EventedAccessor{constructor(t){super(t),this._animationController=null,this.disabled=!1,this.layout="horizontal",this.loop=!1,this.playRate=1e3,this.values=null}destroy(){this._pause()}get state(){return this._animationController?"playing":"ready"}next(){this.emit("next")}pause(){this.emit("pause"),this._pause()}play(){this.emit("play"),this._play()}previous(){this.emit("previous")}_pause(){this._animationController?.abort(),this._animationController=null}_play(){this._pause(),this._animationController=new AbortController,this._animate()}async _animate(){if(this.emit("animate"),this._animationController){try{await r(this.playRate,null,this._animationController.signal)}catch(t){return i(t)||e.getLogger(this).error(t),void this._pause()}this._animate()}}};t([s()],l.prototype,"_animationController",void 0),t([s({nonNullable:!0})],l.prototype,"disabled",void 0),t([s({nonNullable:!0})],l.prototype,"layout",void 0),t([s({nonNullable:!0})],l.prototype,"loop",void 0),t([s({nonNullable:!0})],l.prototype,"playRate",void 0),t([s({readOnly:!0})],l.prototype,"state",null),t([s()],l.prototype,"values",void 0),t([s()],l.prototype,"next",null),t([s()],l.prototype,"pause",null),t([s()],l.prototype,"play",null),t([s()],l.prototype,"previous",null),l=t([a("esri.widgets.ValuePicker.ValuePickerViewModel")],l);const p=l;export{p as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/Evented.js";import e from"../../core/Logger.js";import{after as r,isAbortError as s}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";const l={first:!0},n={first:!1};let p=class extends o.EventedAccessor{constructor(t){super(t),this._animationController=null,this.disabled=!1,this.layout="horizontal",this.loop=!1,this.playRate=1e3,this.values=null}destroy(){this._pause()}get state(){return this._animationController?"playing":"ready"}next(){this.emit("next")}pause(){this.emit("pause"),this._pause()}play(){this.emit("play"),this._play()}previous(){this.emit("previous")}_pause(){this._animationController?.abort(),this._animationController=null}_play(){this._pause(),this._animationController=new AbortController,this._animate(l)}async _animate(t){if(this.emit("animate",t),this._animationController){try{await r(this.playRate,null,this._animationController.signal)}catch(o){return s(o)||e.getLogger(this).error(o),void this._pause()}this._animate(n)}}};t([i()],p.prototype,"_animationController",void 0),t([i({nonNullable:!0})],p.prototype,"disabled",void 0),t([i({nonNullable:!0})],p.prototype,"layout",void 0),t([i({nonNullable:!0})],p.prototype,"loop",void 0),t([i({nonNullable:!0})],p.prototype,"playRate",void 0),t([i({readOnly:!0})],p.prototype,"state",null),t([i()],p.prototype,"values",void 0),t([i()],p.prototype,"next",null),t([i()],p.prototype,"pause",null),t([i()],p.prototype,"play",null),t([i()],p.prototype,"previous",null),p=t([a("esri.widgets.ValuePicker.ValuePickerViewModel")],p);const u=p;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.27/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/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import{loadCalciteComponents as s}from"./support/componentsUtils.js";import"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import{vmEvent as a}from"./support/decorators/vmEvent.js";import{tsx as r}from"./support/jsxFactory.js";import n from"./ValuePicker/ValuePickerCollection.js";import p from"./ValuePicker/ValuePickerCombobox.js";import c from"./ValuePicker/ValuePickerLabel.js";import u from"./ValuePicker/ValuePickerSlider.js";import d from"./ValuePicker/ValuePickerViewModel.js";import m from"./ValuePicker/ValuePickerVisibleElements.js";const h="esri-value-picker",y={actionBar:`${h}__action-bar`,caption:`${h}__caption`,captionBorder:`${h}__caption-border`,captionText:`${h}__caption-text`,disabled:"esri-disabled",separator:`${h}__separator`,widget:"esri-widget",widgetIcon:"esri-icon-play-circled"},v={base:null,key:"type",typeMap:{collection:n,combobox:p,label:c,slider:u}};let b=class extends i{constructor(e,t){super(e,t),this.caption=null,this.component=null,this.messages=null,this.messagesCommon=null,this.viewModel=new d,this.visibleElements=new m}loadDependencies(){return s({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js")})}get canNext(){return this.component?.canNext??!0}get canPlay(){return this.component?.canPlay??!0}get canPrevious(){return this.component?.canPrevious??!0}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layout(){return this.viewModel.layout}set layout(e){this.viewModel.layout=e}get loop(){return this.viewModel.loop}set loop(e){this.viewModel.loop=e}get playRate(){return this.viewModel.playRate}set playRate(e){this.viewModel.playRate=e}get values(){return this.viewModel.values}set values(e){this.viewModel.values=e}next(){this.viewModel.next()}pause(){this.viewModel.pause()}play(){this.viewModel.play()}previous(){this.viewModel.previous()}render(){const{disabled:e,state:t}=this.viewModel,o="playing"===t,i="horizontal"===this.layout,{control:s,pagination:l}=this.messagesCommon,{pause:a,play:n}=s,{previous:p,up:c,next:u,down:d}=l;this.component&&(this.component.viewModel??=this.viewModel);const m=this.visibleElements.playButton&&r("calcite-action",{active:o,alignment:"center",bind:this,disabled:e||!this.canPlay,icon:o?"pause":"play",key:"play",onclick:o?this.pause:this.play,text:o?a:n}),v=this.visibleElements.previousButton&&r("calcite-action",{alignment:"center",bind:this,disabled:e||o||!this.canPrevious,icon:i?"chevron-left":"chevron-up",key:"previous",onclick:this.previous,text:i?p:c}),b=this.visibleElements.nextButton&&r("calcite-action",{alignment:"center",bind:this,disabled:e||o||!this.canNext,icon:i?"chevron-right":"chevron-down",key:"next",onclick:this.next,text:i?u:d}),w=this.caption&&r("div",{class:y.caption},r("div",{class:y.captionBorder},r("div",{class:y.captionText},this.caption))),g="combobox"===this.component?.type||"label"===this.component?.type||"slider"===this.component?.type,k=(m||v||b)&&(w||g)&&r("div",{class:y.separator}),x=this.component?.render();return r("div",{"aria-label":this.label,class:this.classes(h,y.widget,`${h}__layout--${this.layout}`,`${h}__type--${this.component?.type}`)},r("calcite-action-bar",{expandDisabled:!0,layout:this.layout,class:y.actionBar},[m,v,b,k,w,x]))}};e([t()],b.prototype,"canNext",null),e([t()],b.prototype,"canPlay",null),e([t()],b.prototype,"canPrevious",null),e([t()],b.prototype,"caption",void 0),e([t({types:v})],b.prototype,"component",void 0),e([t()],b.prototype,"disabled",null),e([t()],b.prototype,"label",null),e([t()],b.prototype,"layout",null),e([t()],b.prototype,"loop",null),e([t(),l("esri/widgets/ValuePicker/t9n/ValuePicker")],b.prototype,"messages",void 0),e([t(),l("esri/t9n/common")],b.prototype,"messagesCommon",void 0),e([t()],b.prototype,"playRate",null),e([t()],b.prototype,"values",null),e([t(),a(["animate","next","pause","play","previous"])],b.prototype,"viewModel",void 0),e([t({type:m,nonNullable:!0})],b.prototype,"visibleElements",void 0),b=e([o("esri.widgets.ValuePicker")],b);const w=b;export{w as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import{loadCalciteComponents as s}from"./support/componentsUtils.js";import"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import{vmEvent as a}from"./support/decorators/vmEvent.js";import{tsx as r}from"./support/jsxFactory.js";import n from"./ValuePicker/ValuePickerCollection.js";import p from"./ValuePicker/ValuePickerCombobox.js";import c from"./ValuePicker/ValuePickerLabel.js";import u from"./ValuePicker/ValuePickerSlider.js";import d from"./ValuePicker/ValuePickerViewModel.js";import m from"./ValuePicker/ValuePickerVisibleElements.js";const h="esri-value-picker",y={actionBar:`${h}__action-bar`,caption:`${h}__caption`,captionBorder:`${h}__caption-border`,captionText:`${h}__caption-text`,disabled:"esri-disabled",separator:`${h}__separator`,widget:"esri-widget",widgetIcon:"esri-icon-play-circled"},v={base:null,key:"type",typeMap:{collection:n,combobox:p,label:c,slider:u}};let b=class extends i{constructor(e,t){super(e,t),this.caption=null,this.component=null,this.messages=null,this.messagesCommon=null,this.viewModel=new d,this.visibleElements=new m}loadDependencies(){return s({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js")})}get canNext(){return this.component?.canNext??!0}get canPlay(){return this.component?.canPlay??!0}get canPrevious(){return this.component?.canPrevious??!0}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get label(){return this.messages.widgetLabel}set label(e){this._overrideIfSome("label",e)}get layout(){return this.viewModel.layout}set layout(e){this.viewModel.layout=e}get loop(){return this.viewModel.loop}set loop(e){this.viewModel.loop=e}get playRate(){return this.viewModel.playRate}set playRate(e){this.viewModel.playRate=e}get values(){return this.viewModel.values}set values(e){this.viewModel.values=e}next(){this.viewModel.next()}pause(){this.viewModel.pause()}play(){this.viewModel.play()}previous(){this.viewModel.previous()}render(){const{disabled:e,state:t}=this.viewModel,o="playing"===t,i="horizontal"===this.layout,{control:s,pagination:l}=this.messagesCommon,{pause:a,play:n}=s,{previous:p,up:c,next:u,down:d}=l;this.component&&(this.component.viewModel??=this.viewModel);const m=this.visibleElements.playButton&&r("calcite-action",{active:o,alignment:"center",bind:this,disabled:e||!this.canPlay,icon:o?"pause":"play",key:"play",onclick:o?this.pause:this.play,text:o?a:n}),v=this.visibleElements.previousButton&&r("calcite-action",{alignment:"center",bind:this,disabled:e||o||!this.canPrevious,icon:i?"chevron-left":"chevron-up",key:"previous",onclick:this.previous,text:i?p:c}),b=this.visibleElements.nextButton&&r("calcite-action",{alignment:"center",bind:this,disabled:e||o||!this.canNext,icon:i?"chevron-right":"chevron-down",key:"next",onclick:this.next,text:i?u:d}),w=this.caption&&r("div",{class:y.caption},r("div",{class:y.captionBorder},r("div",{class:y.captionText},this.caption))),g="combobox"===this.component?.type||"label"===this.component?.type||"slider"===this.component?.type,k=(m||v||b)&&(w||g)&&r("div",{class:y.separator}),x=this.component?.render();return r("div",{"aria-label":this.label,class:this.classes(h,y.widget,`${h}__layout--${this.layout}`,`${h}__type--${this.component?.type}`)},r("calcite-action-bar",{expandDisabled:!0,layout:this.layout,class:y.actionBar},[m,v,b,k,w,x]))}};e([t()],b.prototype,"canNext",null),e([t()],b.prototype,"canPlay",null),e([t()],b.prototype,"canPrevious",null),e([t()],b.prototype,"caption",void 0),e([t({types:v})],b.prototype,"component",void 0),e([t()],b.prototype,"disabled",null),e([t()],b.prototype,"label",null),e([t()],b.prototype,"layout",null),e([t()],b.prototype,"loop",null),e([t(),l("esri/widgets/ValuePicker/t9n/ValuePicker")],b.prototype,"messages",void 0),e([t(),l("esri/t9n/common")],b.prototype,"messagesCommon",void 0),e([t()],b.prototype,"playRate",null),e([t()],b.prototype,"values",null),e([t(),a(["animate","next","pause","play","previous"])],b.prototype,"viewModel",void 0),e([t({type:m,nonNullable:!0})],b.prototype,"visibleElements",void 0),b=e([o("esri.widgets.ValuePicker")],b);const w=b;export{w as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5261],{88764:(e,t,s)=>{s.d(t,{q:()=>l});var i,r,n,a=s(5732),o={exports:{}};i=o,r=function(){function e(s,i,r,n,a){for(;n>r;){if(n-r>600){var o=n-r+1,l=i-r+1,u=Math.log(o),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(o-c)/o)*(l-o/2<0?-1:1);e(s,i,Math.max(r,Math.floor(i-l*c/o+h)),Math.min(n,Math.floor(i+(o-l)*c/o+h)),a)}var d=s[i],f=r,m=n;for(t(s,r,i),a(s[n],d)>0&&t(s,r,n);f<m;){for(t(s,f,m),f++,m--;a(s[f],d)<0;)f++;for(;a(s[m],d)>0;)m--}0===a(s[r],d)?t(s,r,m):t(s,++m,n),m<=i&&(r=m+1),i<=m&&(n=m-1)}}function t(e,t,s){var i=e[t];e[t]=e[s],e[s]=i}function s(e,t){return e<t?-1:e>t?1:0}return function(t,i,r,n,a){e(t,i,r||0,n||t.length-1,a||s)}},void 0!==(n=r())&&(i.exports=n);const l=(0,a.g)(o.exports)},37455:(e,t,s)=>{s.d(t,{N:()=>i});const i={convertToGEGeometry:function(e,t){return null==t?null:e.convertJSONToGeometry(t)},exportPoint:function(e,t,s){const i=new r(e.getPointX(t),e.getPointY(t),s),n=e.hasZ(t),a=e.hasM(t);return n&&(i.z=e.getPointZ(t)),a&&(i.m=e.getPointM(t)),i},exportPolygon:function(e,t,s){return new n(e.exportPaths(t),s,e.hasZ(t),e.hasM(t))},exportPolyline:function(e,t,s){return new a(e.exportPaths(t),s,e.hasZ(t),e.hasM(t))},exportMultipoint:function(e,t,s){return new o(e.exportPoints(t),s,e.hasZ(t),e.hasM(t))},exportExtent:function(e,t,s){const i=e.hasZ(t),r=e.hasM(t),n=new l(e.getXMin(t),e.getYMin(t),e.getXMax(t),e.getYMax(t),s);if(i){const s=e.getZExtent(t);n.zmin=s.vmin,n.zmax=s.vmax}if(r){const s=e.getMExtent(t);n.mmin=s.vmin,n.mmax=s.vmax}return n}};class r{constructor(e,t,s){this.x=e,this.y=t,this.spatialReference=s,this.z=void 0,this.m=void 0}}class n{constructor(e,t,s,i){this.rings=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,s&&(this.hasZ=s),i&&(this.hasM=i)}}class a{constructor(e,t,s,i){this.paths=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,s&&(this.hasZ=s),i&&(this.hasM=i)}}class o{constructor(e,t,s,i){this.points=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,s&&(this.hasZ=s),i&&(this.hasM=i)}}class l{constructor(e,t,s,i,r){this.xmin=e,this.ymin=t,this.xmax=s,this.ymax=i,this.spatialReference=r,this.zmin=void 0,this.zmax=void 0,this.mmin=void 0,this.mmax=void 0}}},29730:(e,t,s)=>{function i(e,t){return e?t?4:3:t?3:2}function r(e,t,s,r,o){if(null==t||!t.lengths.length)return null;const l="upperLeft"===o?.originPosition?-1:1;e.lengths.length&&(e.lengths.length=0),e.coords.length&&(e.coords.length=0);const u=e.coords,c=[],h=s?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],{lengths:d,coords:f}=t,m=i(s,r);let p=0;for(const e of d){const t=n(h,f,p,e,s,r,l);t&&c.push(t),p+=e*m}if(c.sort(((e,t)=>{let i=l*e[2]-l*t[2];return 0===i&&s&&(i=e[4]-t[4]),i})),c.length){let e=6*c[0][2];u[0]=c[0][0]/e,u[1]=c[0][1]/e,s&&(e=6*c[0][4],u[2]=0!==e?c[0][3]/e:0),(u[0]<h[0]||u[0]>h[1]||u[1]<h[2]||u[1]>h[3]||s&&(u[2]<h[4]||u[2]>h[5]))&&(u.length=0)}if(!u.length){const e=t.lengths[0]?a(f,0,d[0],s,r):null;if(!e)return null;u[0]=e[0],u[1]=e[1],s&&e.length>2&&(u[2]=e[2])}return e}function n(e,t,s,r,n,a,o=1){const l=i(n,a);let u=s,c=s+l,h=0,d=0,f=0,m=0,p=0;for(let s=0,i=r-1;s<i;s++,u+=l,c+=l){const s=t[u],i=t[u+1],r=t[u+2],a=t[c],o=t[c+1],l=t[c+2];let g=s*o-a*i;m+=g,h+=(s+a)*g,d+=(i+o)*g,n&&(g=s*l-a*r,f+=(r+l)*g,p+=g),s<e[0]&&(e[0]=s),s>e[1]&&(e[1]=s),i<e[2]&&(e[2]=i),i>e[3]&&(e[3]=i),n&&(r<e[4]&&(e[4]=r),r>e[5]&&(e[5]=r))}if(m*o>0&&(m*=-1),p*o>0&&(p*=-1),!m)return null;const g=[h,d,.5*m];return n&&(g[3]=f,g[4]=.5*p),g}function a(e,t,s,r,n){const a=i(r,n);let h=t,d=t+a,f=0,m=0,p=0,g=0;for(let t=0,i=s-1;t<i;t++,h+=a,d+=a){const t=e[h],s=e[h+1],i=e[h+2],n=e[d],a=e[d+1],_=e[d+2],y=r?l(t,s,i,n,a,_):o(t,s,n,a);if(y)if(f+=y,r){const e=c(t,s,i,n,a,_);m+=y*e[0],p+=y*e[1],g+=y*e[2]}else{const e=u(t,s,n,a);m+=y*e[0],p+=y*e[1]}}return f>0?r?[m/f,p/f,g/f]:[m/f,p/f]:s>0?r?[e[t],e[t+1],e[t+2]]:[e[t],e[t+1]]:null}function o(e,t,s,i){const r=s-e,n=i-t;return Math.sqrt(r*r+n*n)}function l(e,t,s,i,r,n){const a=i-e,o=r-t,l=n-s;return Math.sqrt(a*a+o*o+l*l)}function u(e,t,s,i){return[e+.5*(s-e),t+.5*(i-t)]}function c(e,t,s,i,r,n){return[e+.5*(i-e),t+.5*(r-t),s+.5*(n-s)]}s.d(t,{Y:()=>r})},66202:(e,t,s)=>{s.d(t,{q:()=>Ne});var i=s(67676),r=s(20102),n=s(22974),a=s(70586),o=s(69801),l=s(95330),u=s(67900),c=s(60437),h=s(24470),d=s(20322),f=s(33955),m=s(16306),p=s(8744),g=s(98732),_=s(13867),y=s(41534);const I=new class{constructor(e,t){this._cache=new _.z(e),this._invalidCache=new _.z(t)}get(e,t){const s=`${t.uid}:${e}`,i=this._cache.get(s);if(i)return i;if(void 0!==this._invalidCache.get(s))return null;try{const i=y.WhereClause.create(e,t);return this._cache.put(s,i),i}catch{return this._invalidCache.put(s,null),null}}}(50,500),S="feature-store:unsupported-query",E=" as ",R=new Set(["esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeDate"]);function T(e,t){if(!t)return!0;const s=I.get(t,e);if(!s)throw new r.Z(S,"invalid SQL expression",{where:t});if(!s.isStandardized)throw new r.Z(S,"where clause is not standard",{where:t});return w(e,s.fieldNames,"where clause contains missing fields"),!0}function x(e,t,s){if(!t)return!0;const i=I.get(t,e);if(!i)throw new r.Z(S,"invalid SQL expression",{having:t});if(!i.isAggregate)throw new r.Z(S,"having does not contain a valid aggregate function",{having:t});const n=i.fieldNames;if(w(e,n,"having contains missing fields"),!i.getExpressions().every((t=>{const{aggregateType:i,field:r}=t,n=e.get(r)?.name;return s.some((t=>{const{onStatisticField:s,statisticType:r}=t,a=e.get(s)?.name;return a===n&&r.toLowerCase().trim()===i}))})))throw new r.Z(S,"expressions in having should also exist in outStatistics",{having:t});return!0}function F(e,t){return e?I.get(e,t):null}function w(e,t,s,i=!0){const n=[];for(const s of t)if("*"!==s&&!e.has(s))if(i){const t=A(s);try{const s=F(t,e);if(!s)throw new r.Z(S,"invalid SQL expression",{where:t});if(!s.isStandardized)throw new r.Z(S,"expression is not standard",{clause:s});w(e,s.fieldNames,"expression contains missing fields")}catch(e){const t=e?.details;if(t&&(t.clause||t.where))throw e;t?.missingFields?n.push(...t.missingFields):n.push(s)}}else n.push(s);if(n.length)throw new r.Z(S,s,{missingFields:n})}function A(e){return e.split(E)[0]}function b(e,t){const s=t.get(e);return!!s&&!R.has(s.type)}var v=s(37427),N=s(61159),C=s(35308),P=s(49600),O=s(82397),M=s(11490),k=s(24452),G=s(59266);class D{constructor(e,t,s){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=e.returnDistinctValues??!1,this.fieldsIndex=s,this.featureAdapter=t;const i=e.outFields;if(i&&!i.includes("*")){this.outFields=i;let e=0;for(const t of i){const i=A(t),r=this.fieldsIndex.get(i),n=r?null:F(i,s),a=r?r.name:t.split(E)[1]||"FIELD_EXP_"+e++;this._fieldDataCache.set(t,{alias:a,clause:n})}}}countDistinctValues(e){return this.returnDistinctValues?(e.forEach((e=>this.getAttributes(e))),this._returnDistinctMap.size):e.length}getAttributes(e){const t=this._processAttributesForOutFields(e);return this._processAttributesForDistinctValues(t)}getFieldValue(e,t,s){const i=s?s.name:t;let r=null;return this._fieldDataCache.has(i)?r=this._fieldDataCache.get(i)?.clause:s||(r=F(t,this.fieldsIndex),this._fieldDataCache.set(i,{alias:i,clause:r})),s?this.featureAdapter.getAttribute(e,i):r?.calculateValue(e,this.featureAdapter)}getDataValues(e,t){const s=t.normalizationType,i=t.normalizationTotal;return e.map((e=>{let r=t.field&&this.getFieldValue(e,t.field,this.fieldsIndex.get(t.field));if(t.field2&&(r=`${(0,k.wk)(r)}${t.fieldDelimiter}${(0,k.wk)(this.getFieldValue(e,t.field2,this.fieldsIndex.get(t.field2)))}`,t.field3&&(r=`${r}${t.fieldDelimiter}${(0,k.wk)(this.getFieldValue(e,t.field3,this.fieldsIndex.get(t.field3)))}`)),s&&Number.isFinite(r)){const n="field"===s&&t.normalizationField?this.getFieldValue(e,t.normalizationField,this.fieldsIndex.get(t.normalizationField)):null;r=(0,k.fk)(r,s,n,i)}return r}))}async getExpressionValues(e,t,s,i){const{arcadeUtils:r}=await(0,G.LC)(),n=r.hasGeometryOperations(t);n&&await r.enableGeometryOperations();const a=r.createFunction(t),o=s&&r.getViewInfo(s),l={fields:this.fieldsIndex.fields};return e.map((e=>{const t={attributes:this.featureAdapter.getAttributes(e),layer:l,geometry:n?{...(0,M.Op)(i.geometryType,i.hasZ,i.hasM,this.featureAdapter.getGeometry(e)),spatialReference:s?.spatialReference}:null},u=r.createExecContext(t,o);return r.executeFunction(a,u)}))}validateItem(e,t){return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:F(t,this.fieldsIndex)}),this._fieldDataCache.get(t)?.clause?.testFeature(e,this.featureAdapter)??!1}validateItems(e,t){return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:F(t,this.fieldsIndex)}),this._fieldDataCache.get(t)?.clause?.testSet(e,this.featureAdapter)??!1}_processAttributesForOutFields(e){const t=this.outFields;if(!t||!t.length)return this.featureAdapter.getAttributes(e);const s={};for(const i of t){const{alias:t,clause:r}=this._fieldDataCache.get(i);s[t]=r?r.calculateValue(e,this.featureAdapter):this.featureAdapter.getAttribute(e,t)}return s}_processAttributesForDistinctValues(e){if(null==e||!this.returnDistinctValues)return e;const t=this.outFields,s=[];if(t)for(const i of t){const{alias:t}=this._fieldDataCache.get(i);s.push(e[t])}else for(const t in e)s.push(e[t]);const i=`${(t||["*"]).join(",")}=${s.join(",")}`;let r=this._returnDistinctMap.get(i)||0;return this._returnDistinctMap.set(i,++r),r>1?null:e}}function L(e,t,s){return{objectId:e,target:t,distance:s,type:"vertex"}}function Q(e,t,s,i,r,n=!1){return{objectId:e,target:t,distance:s,type:"edge",start:i,end:r,draped:n}}var V=s(35671);class U{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasM=s.hasM,this.hasZ=s.hasZ,this.fieldsIndex=s.fieldsIndex,this.objectIdField=s.objectIdField,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new D(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,r=t?.length;if(!r)return 1;const n=new Map,a=new Map,o=new Set;for(const r of i){const{statisticType:i}=r,l="exceedslimit"!==i?r.onStatisticField:void 0;if(!a.has(l)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,n);s.push(t)}a.set(l,this._calculateUniqueValues(s,e.returnDistinctValues))}const u=a.get(l);for(const t in u){const{data:i,items:r}=u[t],n=i.join(",");s&&!e.validateItems(r,s)||o.add(n)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse(this.query):await this._createStatisticsQueryResponse(this.query):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){const t=this.query.geometry;(0,p.JY)(this.query.outSR)&&!(0,p.fS)(t.spatialReference,this.query.outSR)?e.queryGeometry=(0,M.S2)({spatialReference:this.query.outSR,...(0,v.iV)(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=(0,M.S2)({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t){const s=this.featureAdapter,i=q(this.hasZ,this.hasM),{point:r,mode:n}=e,a="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y,l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,c=this._getPointCreator(n,this.spatialReference,t),h=new Z(null,0),d=new Z(null,0),f={x:0,y:0,z:0};for(const t of this.items){const n=s.getGeometry(t);if(null==n)continue;const{coords:m,lengths:p}=n;if(h.coords=m,d.coords=m,e.returnEdge){let e=0;for(let n=0;n<p.length;n++){const u=p[n];for(let n=0;n<u;n++,e+=i){const m=h;if(m.coordsIndex=e,n!==u-1){const n=d;n.coordsIndex=e+i;const u=f;z(f,r,m,n);const h=(r.x-u.x)/a,p=(r.y-u.y)/o,g=h*h+p*p;g<=1&&l.candidates.push(Q(s.getObjectId(t),c(u),Math.sqrt(g),c(m),c(n)))}}}}if(e.returnVertex){const e=u?m.length-i:m.length;for(let n=0;n<e;n+=i){const e=h;e.coordsIndex=n;const i=(r.x-e.x)/a,u=(r.y-e.y)/o,d=i*i+u*u;d<=1&&l.candidates.push(L(s.getObjectId(t),c(e),Math.sqrt(d)))}}}return l.candidates.sort(((e,t)=>e.distance-t.distance)),l}_getPointCreator(e,t,s){const i=null==s||(0,p.fS)(t,s)?e=>e:e=>(0,v.iV)(e,t,s),{hasZ:r}=this;return"3d"===e?r?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:0}):({x:e,y:t})=>i({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,minValue:a,maxValue:o,scale:l}=e,u=this.fieldsIndex.isDateField(t),c=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,scale:l}),h=(0,k.S5)({normalizationType:r,normalizationField:i,minValue:a,maxValue:o}),d=this.fieldsIndex.get(t),f={value:.5,fieldType:d?.type},m=(0,V.qN)(d)?(0,k.H0)({values:c,supportsNullCount:h,percentileParams:f}):(0,k.i5)({values:c,minValue:a,maxValue:o,useSampleStdDev:!r,supportsNullCount:h,percentileParams:f});return(0,k.F_)(m,u)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:r,scale:n}=e,a=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:n}),o=(0,k.eT)(a);return(0,k.Qm)(o,i,r,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:h}=e,d=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,scale:h}),f=(0,k.G2)(d,{field:t,normalizationField:i,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return(0,k.DL)(f,a)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:h}=e,d=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:r,normalizationTotal:n,scale:h});return(0,k.oF)(d,{field:t,normalizationField:i,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t&&t.length)for(const i of t.reverse()){const t=i.split(" "),r=t[0],n=this.fieldsIndex.get(r),a=!!t[1]&&"desc"===t[1].toLowerCase(),o=(0,k.Lq)(n?.type,a);e.sort(((e,t)=>{const i=s(e,r,n),a=s(t,r,n);return o(i,a)}))}}_createFeatureQueryResponse(e){const t=this.items,{geometryType:s,hasM:i,hasZ:r,objectIdField:n,spatialReference:a}=this,{outFields:o,outSR:l,quantizationParameters:u,resultRecordCount:c,resultOffset:h,returnZ:d,returnM:f}=e,m=null!=c&&t.length>(h||0)+c,p=o&&(o.includes("*")?[...this.fieldsIndex.fields]:o.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:m,features:this._createFeatures(e,t),fields:p,geometryType:s,hasM:i&&f,hasZ:r&&d,objectIdFieldName:n,spatialReference:(0,M.S2)(l||a),transform:u&&(0,O.vY)(u)||null}}_createFeatures(e,t){const s=new D(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:r}=this,{orderByFields:n,quantizationParameters:a,returnGeometry:o,returnCentroid:l,maxAllowableOffset:u,resultOffset:c,resultRecordCount:h,returnZ:d=!1,returnM:f=!1}=e,m=r&&d,p=i&&f;let g=[],_=0;const y=[...t];if(this._sortFeatures(y,n,((e,t,i)=>s.getFieldValue(e,t,i))),o||l){const e=(0,O.vY)(a)??void 0;if(o&&!l)for(const t of y)g[_++]={attributes:s.getAttributes(t),geometry:(0,M.Op)(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),u,e,m,p)};else if(!o&&l)for(const t of y)g[_++]={attributes:s.getAttributes(t),centroid:(0,M.EG)(this,this.featureAdapter.getCentroid(t,this),e)};else for(const t of y)g[_++]={attributes:s.getAttributes(t),centroid:(0,M.EG)(this,this.featureAdapter.getCentroid(t,this),e),geometry:(0,M.Op)(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),u,e,m,p)}}else for(const e of y){const t=s.getAttributes(e);t&&(g[_++]={attributes:t})}const I=c||0;if(null!=h){const e=I+h;g=g.slice(I,Math.min(g.length,e))}return g}_createExceedsLimitQueryResponse(e){let t=!1,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(const t of e.outStatistics??[])if("exceedslimit"===t.statisticType){s=null!=t.maxPointCount?t.maxPointCount:Number.POSITIVE_INFINITY,i=null!=t.maxRecordCount?t.maxRecordCount:Number.POSITIVE_INFINITY,r=null!=t.maxVertexCount?t.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)t=this.items.length>s;else if(this.items.length>i)t=!0;else{const e=q(this.hasZ,this.hasM),s=this.featureAdapter;t=this.items.reduce(((e,t)=>{const i=s.getGeometry(t);return e+(null!=i&&i.coords.length||0)}),0)/e>r}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(t)}}]}}async _createStatisticsQueryResponse(e){const t={attributes:{}},s=[],i=new Map,r=new Map,n=new Map,a=new Map,o=new D(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:c,orderByFields:h}=e,d=u&&u.length,f=!!d,m=f?u[0]:null,p=f&&!this.fieldsIndex.get(m);for(const e of l??[]){const{outStatisticFieldName:l,statisticType:h}=e,g=e,_="exceedslimit"!==h?e.onStatisticField:void 0,y="percentile_disc"===h||"percentile_cont"===h,I="EnvelopeAggregate"===h||"CentroidAggregate"===h||"ConvexHullAggregate"===h,S=f&&1===d&&(_===m||p)&&"count"===h;if(f){if(!n.has(_)){const e=[];for(const t of u){const s=this._getAttributeValues(o,t,i);e.push(s)}n.set(_,this._calculateUniqueValues(e,!I&&o.returnDistinctValues))}const e=n.get(_);for(const t in e){const{count:s,data:r,items:n,itemPositions:h}=e[t],d=r.join(",");if(!c||o.validateItems(n,c)){const e=a.get(d)||{attributes:{}};if(I){e.aggregateGeometries||(e.aggregateGeometries={});const{aggregateGeometries:t,outStatisticFieldName:s}=await this._getAggregateGeometry(g,n);e.aggregateGeometries[s]=t}else{let t=null;if(S)t=s;else{const e=this._getAttributeValues(o,_,i),s=h.map((t=>e[t]));t=y&&"statisticParameters"in g?this._getPercentileValue(g,s):this._getStatisticValue(g,s,null,o.returnDistinctValues)}e.attributes[l]=t}let t=0;u.forEach(((s,i)=>e.attributes[this.fieldsIndex.get(s)?s:"EXPR_"+ ++t]=r[i])),a.set(d,e)}}}else if(I){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(g,this.items);t.aggregateGeometries[s]=e}else{const e=this._getAttributeValues(o,_,i);t.attributes[l]=y&&"statisticParameters"in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,r,o.returnDistinctValues)}s.push({name:l,alias:l,type:"esriFieldTypeDouble"})}const g=f?Array.from(a.values()):[t];return this._sortFeatures(g,h,((e,t)=>e.attributes[t])),{fields:s,features:g}}async _getAggregateGeometry(e,t){const{convexHull:i,union:r}=await Promise.all([s.e(5837),s.e(247)]).then(s.bind(s,30247)),{statisticType:n,outStatisticFieldName:a}=e,{featureAdapter:o,spatialReference:l,geometryType:u,hasZ:c,hasM:h}=this,d=t.map((e=>(0,M.Op)(u,c,h,o.getGeometry(e)))),f=i(l,d,!0)[0],m={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===n){const e=f?(0,P._w)(f):(0,P.aO)(r(l,d));m.aggregateGeometries={...e,spatialReference:l},m.outStatisticFieldName=a||"extent"}else if("CentroidAggregate"===n){const e=f?(0,C.tO)(f):(0,C.$G)((0,P.aO)(r(l,d)));m.aggregateGeometries={x:e[0],y:e[1],spatialReference:l},m.outStatisticFieldName=a||"centroid"}else"ConvexHullAggregate"===n&&(m.aggregateGeometries=f,m.outStatisticFieldName=a||"convexHull");return m}_getStatisticValue(e,t,s,i){const{onStatisticField:r,statisticType:n}=e;let a=null;return a=s?.has(r)?s.get(r):(0,V.qN)(this.fieldsIndex.get(r))?(0,k.H0)({values:t,returnDistinct:i}):(0,k.i5)({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(r,a),a["var"===n?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:r}=e,{value:n,orderBy:a}=i,o=this.fieldsIndex.get(s);return(0,k.XL)(t,{value:n,orderBy:a,fieldType:o?.type,isDiscrete:"percentile_disc"===r})}_getAttributeValues(e,t,s){if(s.has(t))return s.get(t);const i=this.fieldsIndex.get(t),r=this.items.map((s=>e.getFieldValue(s,t,i)));return s.set(t,r),r}_calculateUniqueValues(e,t){const s={},i=this.items,r=i.length;for(let n=0;n<r;n++){const r=i[n],a=[];for(const t of e)a.push(t[n]);const o=a.join(",");null==s[o]?s[o]={count:1,data:a,items:[r],itemPositions:[n]}:(t||s[o].count++,s[o].items.push(r),s[o].itemPositions.push(n))}return s}async _getDataValues(e){const t=new D(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:s,scale:i}=e,r=s?{viewingMode:"map",scale:i,spatialReference:this.query.outSR||this.spatialReference}:null;return s?t.getExpressionValues(this.items,s,r,{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM}):t.getDataValues(this.items,{field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal})}}function z(e,t,s,i){const r=i.x-s.x,n=i.y-s.y,a=r*r+n*n,o=(t.x-s.x)*r+(t.y-s.y)*n,l=Math.min(1,Math.max(0,o/a));e.x=s.x+r*l,e.y=s.y+n*l}function q(e,t){return e?t?4:3:t?3:2}class Z{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}var B=s(10402),Y=s(17590),j=s(99514),H=s(61247),W=(s(80442),s(92604)),X=s(54790),J=s(44553),$=s(17445),K=s(58971),ee=s(10661);class te{constructor(e,t){this._observable=new ee.s,this._value=e,this._equalityFunction=t}get value(){return(0,K.it)(this._observable),this._value}set value(e){this._equalityFunction(e,this._value)||(this._value=e,this._observable.notify())}mutate(e){e(this._value),this._observable.notify()}}function se(e,t=n.y7){return new te(e,t)}var ie=s(76882);class re{constructor(){this._tasks=new Array,this._running=se(!1)}get length(){return this._tasks.length}get running(){return this._running.value}destroy(){this.cancelAll()}runTask(e){for(;!e.done&&this._process(e);)e.madeProgress()}push(e,t,s){return this._running.value=!0,new Promise(((i,r)=>this._tasks.push(new ne(i,r,e,t,s))))}unshift(e,t,s){return this._running.value=!0,new Promise(((i,r)=>this._tasks.unshift(new ne(i,r,e,t,s))))}_process(e){if(0===this._tasks.length)return!1;const t=this._tasks.shift();try{const s=(0,l.Hc)(t.signal);if(s&&!t.abortCallback)t.reject((0,l.zE)());else{const i=s?t.abortCallback?.((0,l.zE)()):t.callback(e);(0,l.y8)(i)?i.then(t.resolve,t.reject):t.resolve(i)}}catch(e){t.reject(e)}return this._running.value=this._tasks.length>0,!0}cancelAll(){const e=(0,l.zE)();for(const t of this._tasks)if(t.abortCallback){const s=t.abortCallback(e);t.resolve(s)}else t.reject(e);this._tasks.length=0,this._running.value=!1}}class ne{constructor(e,t,s,i=void 0,r=void 0){this.resolve=e,this.reject=t,this.callback=s,this.signal=i,this.abortCallback=r}}var ae=s(43697),oe=s(92036),le=s(5600),ue=(s(75215),s(52011));let ce=class extends oe.Z{constructor(){super(...arguments),this.SCHEDULER_LOG_SLOW_TASKS=!1,this.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES=!1}};(0,ae._)([(0,le.Cb)()],ce.prototype,"SCHEDULER_LOG_SLOW_TASKS",void 0),(0,ae._)([(0,le.Cb)()],ce.prototype,"FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES",void 0),ce=(0,ae._)([(0,ue.j)("esri.views.support.DebugFlags")],ce);const he=new ce;var de,fe,me,pe;!function(e){e[e.ANIMATING=0]="ANIMATING",e[e.INTERACTING=1]="INTERACTING",e[e.IDLE=2]="IDLE"}(de||(de={})),(pe=fe||(fe={}))[pe.YIELD=1]="YIELD",function(e){e.RESOURCE_CONTROLLER_IMMEDIATE="immediate",e.RESOURCE_CONTROLLER="schedule",e.SLIDE="slide",e.STREAM_DATA_LOADER="stream loader",e.ELEVATION_QUERY="elevation query",e.TERRAIN_SURFACE="terrain",e.SURFACE_GEOMETRY_UPDATES="surface geometry updates",e.LOD_RENDERER="LoD renderer",e.GRAPHICS_CORE="Graphics3D",e.I3S_CONTROLLER="I3S",e.POINT_CLOUD_LAYER="point cloud",e.FEATURE_TILE_FETCHER="feature fetcher",e.OVERLAY="overlay",e.STAGE="stage",e.GRAPHICS_DECONFLICTOR="graphics deconflictor",e.FILTER_VISIBILITY="Graphics3D filter visibility",e.SCALE_VISIBILITY="Graphics3D scale visibility",e.FRUSTUM_VISIBILITY="Graphics3D frustum visibility",e.POINT_OF_INTEREST_FREQUENT="POI frequent",e.POINT_OF_INTEREST_INFREQUENT="POI infrequent",e.LABELER="labeler",e.FEATURE_QUERY_ENGINE="feature query",e.FEATURE_TILE_TREE="feature tile tree",e.FEATURE_TILE_TREE_ACTIVE="fast feature tile tree",e.ELEVATION_ALIGNMENT="elevation alignment",e.TEXT_TEXTURE_ATLAS="text texture atlas",e.TEXTURE_UNLOAD="texture unload",e.LINE_OF_SIGHT_TOOL="line of sight tool",e.LINE_OF_SIGHT_TOOL_INTERACTIVE="interactive line of sight tool",e.ELEVATION_PROFILE="elevation profile",e.SNAPPING="snapping",e.SHADOW_ACCUMULATOR="shadow accumulator",e.CLOUDS_GENERATOR="clouds generator",e[e.NONE=0]="NONE",e[e.TEST_PRIO=1]="TEST_PRIO"}(me||(me={}));const ge=new Map([[me.RESOURCE_CONTROLLER_IMMEDIATE,0],[me.RESOURCE_CONTROLLER,4],[me.SLIDE,0],[me.STREAM_DATA_LOADER,0],[me.ELEVATION_QUERY,0],[me.TERRAIN_SURFACE,1],[me.SURFACE_GEOMETRY_UPDATES,1],[me.LOD_RENDERER,2],[me.GRAPHICS_CORE,2],[me.I3S_CONTROLLER,2],[me.POINT_CLOUD_LAYER,2],[me.FEATURE_TILE_FETCHER,2],[me.OVERLAY,4],[me.STAGE,4],[me.GRAPHICS_DECONFLICTOR,4],[me.FILTER_VISIBILITY,4],[me.SCALE_VISIBILITY,4],[me.FRUSTUM_VISIBILITY,4],[me.CLOUDS_GENERATOR,4],[me.POINT_OF_INTEREST_FREQUENT,6],[me.POINT_OF_INTEREST_INFREQUENT,30],[me.LABELER,8],[me.FEATURE_QUERY_ENGINE,8],[me.FEATURE_TILE_TREE,16],[me.FEATURE_TILE_TREE_ACTIVE,0],[me.ELEVATION_ALIGNMENT,12],[me.TEXT_TEXTURE_ATLAS,12],[me.TEXTURE_UNLOAD,12],[me.LINE_OF_SIGHT_TOOL,16],[me.LINE_OF_SIGHT_TOOL_INTERACTIVE,0],[me.SNAPPING,0],[me.SHADOW_ACCUMULATOR,30]]);function _e(e){return ge.has(e)?ge.get(e):"number"==typeof e?e:1}const ye=(0,ie.HA)(6.5),Ie=(0,ie.HA)(1),Se=(0,ie.HA)(30),Ee=(0,ie.HA)(1e3/30),Re=(0,ie.HA)(100);var Te,xe;!function(e){e.Scheduler=class{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some((e=>e.needsUpdate))}constructor(){this._updating=se(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new X.Z("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new s,this._state=de.INTERACTING,this._tasks=new J.Z,this._runQueue=new J.Z,this._load=0,this._idleStateCallbacks=new J.Z,this._idleUpdatesStartFired=!1,this._forceTask=!1,this._debug=!1,this._debugHandle=(0,$.YP)((()=>he.SCHEDULER_LOG_SLOW_TASKS),(e=>this._debug=e),$.nn);for(const e of Object.keys(me))this.performanceInfo.tasks.set(me[e],new X.Z(me[e]));const e=this;this._test={FRAME_SAFETY_BUDGET:ye,INTERACTING_BUDGET:Ee,IDLE_BUDGET:Re,get availableBudget(){return e._budget.budget},usedBudget:0,getBudget:()=>e._budget,setBudget:t=>e._budget=t,updateTask:e=>this._updateTask(e),getState:e=>this._getState(e),getRuntime:e=>this._getRuntime(e),frameTaskTimes:this._frameTaskTimes,resetRuntimes:()=>this._resetRuntimes(),getRunning:()=>this._getRunning()}}destroy(){this._tasks.toArray().forEach((e=>e.remove())),this._tasks.clear(),(0,a.hw)(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask((()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this.frame())})))}registerTask(e,s){const i=_e(e),r=new t(this,e,s,i);return this._tasks.push(r),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new X.Z(e)),r}registerIdleStateCallbacks(e,t){const s={idleBegin:e,idleEnd:t};this._idleStateCallbacks.push(s),this.state===de.IDLE&&this._idleUpdatesStartFired&&s.idleBegin();const i=this;return{remove:()=>this._removeIdleStateCallbacks(s),set idleBegin(e){i._idleUpdatesStartFired&&(s.idleEnd(),i._state===de.IDLE&&e()),s.idleBegin=e},set idleEnd(e){s.idleEnd=e}}}get load(){return this._load}set state(e){this._state!==e&&(this._state=e,this.state!==de.IDLE&&this._idleUpdatesStartFired&&(this._idleUpdatesStartFired=!1,this._idleStateCallbacks.forAll((e=>e.idleEnd()))))}get state(){return this._state}updateBudget(e){this._test.usedBudget=0,++this._frameNumber;let t=ye,s=e.frameDuration,i=Ie;switch(this.state){case de.IDLE:t=(0,ie.HA)(0),s=(0,ie.HA)(Math.max(Re,e.frameDuration)),i=Se;break;case de.INTERACTING:s=(0,ie.HA)(Math.max(Ee,e.frameDuration));case de.ANIMATING:}return s=(0,ie.HA)(s-e.elapsedFrameTime-t),this.state!==de.IDLE&&s<Ie&&!this._forceTask?(this._forceTask=!0,!1):(s=(0,ie.HA)(Math.max(s,i)),this._budget.reset(s,this.state),this._updateLoad(),this._schedule())}frame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case de.IDLE:this._idleUpdatesStartFired||(this._idleUpdatesStartFired=!0,this._idleStateCallbacks.forAll((e=>e.idleBegin()))),this._runIdle();break;case de.INTERACTING:this._runInteracting();break;default:this._runAnimating()}this._test.usedBudget=this._budget.elapsed}stopFrame(){this._budget.reset((0,ie.HA)(0),this._state),this._budget.madeProgress()}_removeIdleStateCallbacks(e){this._idleUpdatesStartFired&&e.idleEnd(),this._idleStateCallbacks.removeUnordered(e)}removeTask(e){this._tasks.removeUnordered(e),this._runQueue.removeUnordered(e),this._updatingChanged()}_updateTask(e){this._tasks.forAll((t=>{t.name===e&&t.setPriority(e)}))}_getState(e){if(this._runQueue.some((t=>t.name===e)))return xe.SCHEDULED;let t=xe.IDLE;return this._tasks.forAll((s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t=xe.READY:t!==xe.READY&&(t=xe.WAITING))})),t}_getRuntime(e){let t=0;return this._tasks.forAll((s=>{s.name===e&&(t+=s.runtime)})),t}_resetRuntimes(){this._tasks.forAll((e=>e.runtime=0))}_getRunning(){const e=new Map;if(this._tasks.forAll((t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)})),0===e.size)return null;let t="";return e.forEach(((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`})),t}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const e=this._tasks.reduce(((e,t)=>t.needsUpdate?++e:e),0);this._load=.9*this._load+e*(1-.9)}_schedule(){for(this._runQueue.filterInPlace((e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1))),this._tasks.forAll((e=>{0===e.basePriority&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)}));0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forAll((s=>{s.needsUpdate&&0!==s.schedulePriority&&0!==s.basePriority&&s.blockFrame!==this._frameNumber&&(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority?(s.schedulePriority=0,this._runQueue.push(s)):--s.schedulePriority)})),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){const e=this._budget.now();this._startFrameTaskTimes();do{for(;this._runQueue.length>0;){const t=this._budget.now(),s=this._runQueue.pop();this._budget.resetProgress();try{s.task.runTask(this._budget)===fe.YIELD&&(s.blockFrame=this._frameNumber)}catch(e){W.Z.getLogger("esri.views.support.Scheduler").error(`Exception in task "${s.name}"`,e)}!this._budget.hasProgressed&&s.blockFrame!==this._frameNumber&&s.needsUpdate&&(s.name,me.I3S_CONTROLLER,s.blockFrame=this._frameNumber),s.schedulePriority=s.basePriority;const i=this._budget.now()-t;if(s.runtime+=i,this._frameTaskTimes.set(s.priority,this._frameTaskTimes.get(s.priority)+i),this._debug&&i>2*this._budget.budget&&console.log("Task",s.name,"used",i,"of max",this._budget.budget,"ms"),this._budget.remaining<=0)return this._updatingChanged(),void this._recordFrameTaskTimes(this._budget.now()-e)}}while(this._schedule());this._updatingChanged(),this._recordFrameTaskTimes(this._budget.now()-e)}_startFrameTaskTimes(){for(const e of Object.keys(me))this._frameTaskTimes.set(me[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach(((e,t)=>this.performanceInfo.tasks.get(t).record(e))),this.performanceInfo.total.record(e)}get test(){return this._test}};class t{get task(){return this._task.value}get updating(){return this._queue.running}constructor(e,t,s,i){this._scheduler=e,this.name=t,this._basePriority=i,this.blockFrame=0,this.runtime=0,this._queue=new re,this._handles=new H.Z,this.schedulePriority=this._basePriority,this._task=se(null!=s?s:this._queue),this._handles.add((0,$.gx)((()=>this.task.running),(t=>e.taskRunningChanged(t))))}remove(){this.processQueue(Fe),this._scheduler.removeTask(this),this.schedule=we.schedule,this.reschedule=we.reschedule,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){this.name=e;const t=_e(e);0!==this._basePriority&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.updating||this.task.running}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}processQueue(e){this._queue.runTask(e)}}class s{constructor(){this._begin="undefined"!=typeof performance?performance.now():0,this._budget=0,this._state=de.IDLE,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get state(){return this._state}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e,t){this._begin=this.now(),this._budget=e,this._state=t,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return performance.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}e.Budget=s}(Te||(Te={})),function(e){e.SCHEDULED="s",e.READY="r",e.WAITING="w",e.IDLE="i"}(xe||(xe={}));const Fe=(()=>{const e=new Te.Budget;return e.enabled=!1,e})(),we=new class{remove(){}processQueue(){}schedule(e,t,s){try{if((0,l.Hc)(t)){const e=(0,l.zE)();return s?Promise.resolve(s(e)):Promise.reject(e)}return(0,l.gx)(e(Fe))}catch(e){return Promise.reject(e)}}reschedule(e,t,s){return this.schedule(e,t,s)}},Ae="feature-store:unsupported-query",be=new o.WJ(2e6);let ve=0;class Ne{constructor(e){this._geometryQueryCache=null,this._changeHandle=null,this.capabilities={query:N.g},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._changeHandle=this.featureStore.events.on("changed",(()=>this.clearCache())),this.timeInfo=e.timeInfo,e.cacheSpatialQueries&&(this._geometryQueryCache=new o.Xq(ve+++"$$",be)),this.fieldsIndex=new j.Z(e.fields),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._frameTask=(0,a.hw)(this._frameTask),this.clearCache(),(0,a.SC)(this._geometryQueryCache),this._changeHandle=(0,a.hw)(this._changeHandle),(0,a.SC)(this.fieldsIndex)}get featureAdapter(){return this.featureStore.featureAdapter}clearCache(){this._geometryQueryCache?.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null}async executeQuery(e,t){try{return(await this._executeQuery(e,{},t)).createQueryResponse()}catch(t){if(t!==M.vF)throw t;return new U([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},t)).createQueryResponseForCount()}catch(e){if(e!==M.vF)throw e;return 0}}async executeQueryForExtent(e,t){const s=e.outSR;try{const i=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),r=i.size;return r?{count:r,extent:await this._getBounds(i.items,i.spatialReference,s||this.spatialReference)}:{count:0,extent:null}}catch(e){if(e===M.vF)return{count:0,extent:null};throw e}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then((e=>Array.from(e)))}async executeQueryForIdSet(e,t){try{const s=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),i=s.items,r=new Set;return await this._reschedule((()=>{for(const e of i)r.add(s.featureAdapter.getObjectId(e))}),t),r}catch(e){if(e===M.vF)return new Set;throw e}}async executeQueryForSnapping(e,t){const{point:s,distance:i,returnEdge:r,returnVertex:n}=e;if(!r&&!n)return{candidates:[]};const a=await this._reschedule((()=>this._checkQuerySupport(e.query)),t),o=!(0,p.fS)(s.spatialReference,this.spatialReference);o&&await(0,v._W)(s.spatialReference,this.spatialReference);const l="number"==typeof i?i:i.x,u="number"==typeof i?i:i.y,c={xmin:s.x-l,xmax:s.x+l,ymin:s.y-u,ymax:s.y+u,spatialReference:s.spatialReference},h=o?(0,v.iV)(c,this.spatialReference):c;if(!h)return{candidates:[]};const d=(await(0,m.aX)((0,f.im)(s),null,{signal:t}))[0],g=(await(0,m.aX)((0,f.im)(h),null,{signal:t}))[0];if(null==d||null==g)return{candidates:[]};const _=new U(await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(g.toJSON()))),t),a,this);await this._reschedule((()=>this._executeObjectIdsQuery(_)),t),await this._reschedule((()=>this._executeTimeQuery(_)),t),await this._reschedule((()=>this._executeAttributesQuery(_)),t);const y=d.toJSON(),I=o?(0,v.iV)(y,this.spatialReference):y,S=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:i;return _.createSnappingResponse({...e,point:I,distance:S},s.spatialReference)}async executeQueryForLatestObservations(e,t){if(!this.timeInfo||!this.timeInfo.trackIdField)throw new r.Z(Ae,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const s=await this._executeQuery(e,{},t);return await this._reschedule((()=>this._filterLatest(s)),t),s.createQueryResponse()}catch(t){if(t!==M.vF)throw t;return new U([],e,this).createQueryResponse()}}async executeQueryForSummaryStatistics(e={},t,s){const{field:i,normalizationField:r,valueExpression:n}=t;return(await this._getQueryEngineResultForStats(e,{field:i,normalizationField:r,valueExpression:n},s)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,s){const{field:i,field2:r,field3:n,valueExpression:a}=t;return(await this._getQueryEngineResultForStats(e,{field:i,field2:r,field3:n,valueExpression:a},s)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,s){const{field:i,normalizationField:r,valueExpression:n}=t;return(await this._getQueryEngineResultForStats(e,{field:i,normalizationField:r,valueExpression:n},s)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,s){const{field:i,normalizationField:r,valueExpression:n}=t;return(await this._getQueryEngineResultForStats(e,{field:i,normalizationField:r,valueExpression:n},s)).createHistogramResponse(t)}async fetchRecomputedExtents(e){const[t,s]=await Promise.all(["getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getBounds(await this._getAllFeatures(),this.spatialReference,this.spatialReference),null!=this._timeExtentPromise?this._timeExtentPromise:this._timeExtentPromise=(0,Y.R)(this.timeInfo,this.featureStore)]);return(0,l.k_)(e),{fullExtent:t,timeExtent:s}}async _getBounds(e,t,s){const i=(0,c.t8)((0,c.Ue)(),c.Gv);await this.featureStore.forEachBounds(e,(e=>(0,c.TC)(i,e)));const r={xmin:i[0],ymin:i[1],xmax:i[3],ymax:i[4],spatialReference:(0,M.S2)(this.spatialReference)};this.hasZ&&isFinite(i[2])&&isFinite(i[5])&&(r.zmin=i[2],r.zmax=i[5]);const n=(0,v.iV)(r,t,s);if(n.spatialReference=(0,M.S2)(s),n.xmax-n.xmin==0){const e=(0,u.c9)(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin==0){const e=(0,u.c9)(n.spatialReference);n.ymin-=e,n.ymax+=e}if(this.hasZ&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin==0){const e=(0,u.c9)(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}async _schedule(e,t){return null!=this._frameTask?this._frameTask.schedule(e,t):e(Fe)}async _reschedule(e,t){return null!=this._frameTask?this._frameTask.reschedule(e,t):e(Fe)}async _getAllFeaturesQueryEngineResult(e){return new U(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>{await this.featureStore.forEach((t=>e.push(t)))})().then((()=>e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,s){e=(0,n.d9)(e),e=await this._schedule((()=>(0,M.Up)(e,this.definitionExpression,this.spatialReference)),s),e=await this._reschedule((()=>this._checkQuerySupport(e)),s),e={...e,...t};const i=await this._reschedule((()=>this._executeSceneFilterQuery(e,s)),s),r=await this._reschedule((()=>this._executeGeometryQuery(e,i,s)),s);return await this._reschedule((()=>this._executeAggregateIdsQuery(r)),s),await this._reschedule((()=>this._executeObjectIdsQuery(r)),s),await this._reschedule((()=>this._executeTimeQuery(r)),s),await this._reschedule((()=>this._executeAttributesQuery(r)),s),r}async _executeSceneFilterQuery(e,t){if(null==e.sceneFilter)return null;const{outSR:s,returnGeometry:i,returnCentroid:r}=e,n=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,o=null==n||(0,p.fS)(n,a.spatialReference)?a:(0,v.iV)(a,n);if(!o)return null;const l=i||r,u=(0,p.JY)(s)&&!(0,p.fS)(this.spatialReference,s)&&l?async e=>this._project(e,s):e=>e,c=this.featureAdapter,h=await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(o))),t);if("disjoint"===e.sceneFilter.spatialRelationship){if(!h.length)return null;const s=new Set;for(const e of h)s.add(c.getObjectId(e));const i=await this._reschedule((()=>this._getAllFeatures()),t),r=await this._reschedule((async()=>{const r=await(0,B.cW)("esriSpatialRelDisjoint",o,this.geometryType,this.hasZ,this.hasM),n=await this._runSpatialFilter(i,(e=>!s.has(c.getObjectId(e))||r(c.getGeometry(e))),t);return new U(n,e,this)}),t);return u(r)}if(!h.length)return new U([],e,this);if(this._canExecuteSinglePass(o,e))return u(new U(h,e,this));const d=await(0,B.cW)("esriSpatialRelContains",o,this.geometryType,this.hasZ,this.hasM),f=await this._runSpatialFilter(h,(e=>d(c.getGeometry(e))),t);return u(new U(f,e,this))}async _executeGeometryQuery(e,t,s){if(null!=t&&0===t.items.length)return t;e=null!=t?t.query:e;const{geometry:r,outSR:n,spatialRel:a,returnGeometry:o,returnCentroid:l}=e,u=this.featureStore.featureSpatialReference,c=!r||null==u||(0,p.fS)(u,r.spatialReference)?r:(0,v.iV)(r,u),h=o||l,d=(0,p.JY)(n)&&!(0,p.fS)(this.spatialReference,n),f=this._geometryQueryCache&&null==t?d&&h?JSON.stringify({originalFilterGeometry:r,spatialRelationship:a,outSpatialReference:n}):JSON.stringify({originalFilterGeometry:r,spatialRelationship:a}):null,m=f?this._geometryQueryCache.get(f):null;if(null!=m)return new U(m,e,this);const g=async e=>(d&&h&&await this._project(e,n),f&&this._geometryQueryCache.put(f,e.items,e.items.length+1),e);if(!c)return g(null!=t?t:await this._getAllFeaturesQueryEngineResult(e));const _=this.featureAdapter;let y=await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(r))),s);if("esriSpatialRelDisjoint"===a){if(!y.length)return g(null!=t?t:await this._getAllFeaturesQueryEngineResult(e));const i=new Set;for(const e of y)i.add(_.getObjectId(e));const r=null!=t?t.items:await this._reschedule((()=>this._getAllFeatures()),s),n=await this._reschedule((async()=>{const t=await(0,B.cW)(a,c,this.geometryType,this.hasZ,this.hasM),n=await this._runSpatialFilter(r,(e=>!i.has(_.getObjectId(e))||t(_.getGeometry(e))),s);return new U(n,e,this)}),s);return g(n)}if(null!=t){const e=new i.SO;y=y.filter((s=>(0,i.cq)(t.items,s,t.items.length,e)>=0))}if(!y.length){const t=new U([],e,this);return f&&this._geometryQueryCache.put(f,t.items,1),t}if(this._canExecuteSinglePass(c,e))return g(new U(y,e,this));const I=await(0,B.cW)(a,c,this.geometryType,this.hasZ,this.hasM),S=await this._runSpatialFilter(y,(e=>I(_.getGeometry(e))),s);return g(new U(S,e,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds||!e.query.aggregateIds.length||null==this.aggregateAdapter)return;const t=new Set;for(const s of e.query.aggregateIds)this.aggregateAdapter.getFeatureObjectIds(s).forEach((e=>t.add(e)));const s=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(s(e))))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds||!e.query.objectIds.length)return;const t=new Set(e.query.objectIds),s=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(s(e))))}_executeTimeQuery(e){if(0===e.items.length)return;const t=(0,Y.y)(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=F(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter((e=>t.testFeature(e,this.featureAdapter)))}}async _runSpatialFilter(e,t,s){if(!t)return e;if(null==this._frameTask)return e.filter((e=>t(e)));let i=0;const r=new Array,n=async a=>{for(;i<e.length;){const o=e[i++];t(o)&&(r.push(o),a.madeProgress()),a.done&&await this._reschedule((e=>n(e)),s)}};return this._reschedule((e=>n(e)),s).then((()=>r))}_filterLatest(e){const{trackIdField:t,startTimeField:s,endTimeField:i}=this.timeInfo,r=i||s,n=new Map,a=this.featureAdapter.getAttribute;for(const s of e.items){const e=a(s,t),i=a(s,r),o=n.get(e);(!o||i>a(o,r))&&n.set(e,s)}e.items=Array.from(n.values())}_canExecuteSinglePass(e,t){const{spatialRel:s}=t;return(0,B.hN)(e)&&("esriSpatialRelEnvelopeIntersects"===s||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===s||"esriSpatialRelContains"===s||"esriSpatialRelWithin"===s))}async _project(e,t){if(!t||(0,p.fS)(this.spatialReference,t))return e;const s=this.featureAdapter,i=await(0,v.oj)(e.items.map((e=>(0,M.Op)(this.geometryType,this.hasZ,this.hasM,s.getGeometry(e)))),this.spatialReference,t);return e.items=i.map(((t,i)=>s.cloneWithGeometry(e.items[i],(0,g.GH)(t,this.hasZ,this.hasM)))),e}_getQueryBBoxes(e){if((0,B.hN)(e)){if((0,f.YX)(e))return[(0,h.al)(e.xmin,e.ymin,e.xmax,e.ymax)];if((0,f.oU)(e))return e.rings.map((e=>(0,h.al)(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1]))))}return[(0,d.$P)((0,h.Ue)(),e)]}async _searchFeatures(e){const t=new Set;await Promise.all(e.map((e=>this.featureStore.forEachInBounds(e,(e=>t.add(e))))));const s=Array.from(t.values());return t.clear(),s}async _checkStatisticsSupport(e,t){if((e.distance??0)<0||null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text||e.outStatistics||e.groupByFieldsForStatistics||e.having||e.orderByFields)throw new r.Z(Ae,"Unsupported query options",{query:e});return this._checkAttributesQuerySupport(e),Promise.all([this._checkStatisticsParamsSupport(t),(0,B.P0)(e,this.geometryType,this.spatialReference),(0,v._W)(this.spatialReference,e.outSR)]).then((()=>e))}async _checkStatisticsParamsSupport(e){let t=[];if(e.valueExpression){const{arcadeUtils:s}=await(0,G.LC)();t=s.extractFieldNames(e.valueExpression)}if(e.field&&t.push(e.field),e.field2&&t.push(e.field2),e.field3&&t.push(e.field3),e.normalizationField&&t.push(e.normalizationField),!t.length&&!e.valueExpression)throw new r.Z(Ae,"params should have at least a field or valueExpression",{params:e});w(this.fieldsIndex,t,"params contains missing fields")}async _checkQuerySupport(e){if((e.distance??0)<0||null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text)throw new r.Z(Ae,"Unsupported query options",{query:e});return this._checkAttributesQuerySupport(e),this._checkStatisticsQuerySupport(e),Promise.all([(0,B.P0)(e,this.geometryType,this.spatialReference),(0,v._W)(this.spatialReference,e.outSR)]).then((()=>e))}_checkAttributesQuerySupport(e){const{outFields:t,orderByFields:s,returnDistinctValues:i,outStatistics:n}=e,a=n?n.map((e=>e.outStatisticFieldName&&e.outStatisticFieldName.toLowerCase())).filter(Boolean):[];if(s&&s.length>0){const e=" asc",t=" desc",i=s.map((s=>{const i=s.toLowerCase();return i.includes(e)?i.split(e)[0]:i.includes(t)?i.split(t)[0]:s})).filter((e=>!a.includes(e)));w(this.fieldsIndex,i,"orderByFields contains missing fields")}if(t&&t.length>0)w(this.fieldsIndex,t,"outFields contains missing fields");else if(i)throw new r.Z(Ae,"outFields should be specified for returnDistinctValues",{query:e});T(this.fieldsIndex,e.where)}_checkStatisticsQuerySupport(e){const{outStatistics:t,groupByFieldsForStatistics:s,having:i}=e,n=s&&s.length,a=t&&t.length;if(i){if(!n||!a)throw new r.Z(Ae,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:e});x(this.fieldsIndex,i,t)}if(a){if(!function(e){return null!=e&&e.every((e=>"exceedslimit"!==e.statisticType))}(t))return;const i=t.map((e=>e.onStatisticField)).filter(Boolean);w(this.fieldsIndex,i,"onStatisticFields contains missing fields"),n&&w(this.fieldsIndex,s,"groupByFieldsForStatistics contains missing fields");for(const s of t){const{onStatisticField:t,statisticType:i}=s;if("percentile_disc"!==i&&"percentile_cont"!==i||!("statisticParameters"in s)){if("count"!==i&&t&&b(t,this.fieldsIndex))throw new r.Z(Ae,"outStatistics contains non-numeric fields",{definition:s,query:e})}else{const{statisticParameters:t}=s;if(!t)throw new r.Z(Ae,"statisticParamters should be set for percentile type",{definition:s,query:e})}}}}async _getQueryEngineResultForStats(e,t,s){e=(0,n.d9)(e);try{e=await this._schedule((()=>(0,M.Up)(e,this.definitionExpression,this.spatialReference)),s),e=await this._reschedule((()=>this._checkStatisticsSupport(e,t)),s);const i=await this._reschedule((()=>this._executeSceneFilterQuery(e,s)),s),r=await this._reschedule((()=>this._executeGeometryQuery(e,i,s)),s);return await this._reschedule((()=>this._executeAggregateIdsQuery(r)),s),await this._reschedule((()=>this._executeObjectIdsQuery(r)),s),await this._reschedule((()=>this._executeTimeQuery(r)),s),await this._reschedule((()=>this._executeAttributesQuery(r)),s),r}catch(t){if(t!==M.vF)throw t;return new U([],e,this)}}}},61159:(e,t,s)=>{s.d(t,{g:()=>i});const i={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!0,supportsCacheHint:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}},37427:(e,t,s)=>{s.d(t,{_W:()=>d,iV:()=>p,oj:()=>_});var i=s(67676),r=s(44547),n=s(37455),a=s(8744),o=s(40488);const l=[0,0];function u(e,t){if(!t)return null;if("x"in t){const s={x:0,y:0};return[s.x,s.y]=e(t.x,t.y,l),null!=t.z&&(s.z=t.z),null!=t.m&&(s.m=t.m),s}if("xmin"in t){const s={xmin:0,ymin:0,xmax:0,ymax:0};return[s.xmin,s.ymin]=e(t.xmin,t.ymin,l),[s.xmax,s.ymax]=e(t.xmax,t.ymax,l),t.hasZ&&(s.zmin=t.zmin,s.zmax=t.zmax,s.hasZ=!0),t.hasM&&(s.mmin=t.mmin,s.mmax=t.mmax,s.hasM=!0),s}return"rings"in t?{rings:c(t.rings,e),hasM:t.hasM,hasZ:t.hasZ}:"paths"in t?{paths:c(t.paths,e),hasM:t.hasM,hasZ:t.hasZ}:"points"in t?{points:h(t.points,e),hasM:t.hasM,hasZ:t.hasZ}:null}function c(e,t){const s=[];for(const i of e)s.push(h(i,t));return s}function h(e,t){const s=[];for(const i of e){const e=t(i[0],i[1],[0,0]);s.push(e),i.length>2&&e.push(i[2]),i.length>3&&e.push(i[3])}return s}async function d(e,t){if(!e||!t)return;const s=Array.isArray(e)?e.map((e=>null!=e.geometry?e.geometry.spatialReference:null)).filter(i.pC):[e];await(0,r.iQ)(s.map((e=>({source:e,dest:t}))))}const f=u.bind(null,o.hG),m=u.bind(null,o.R6);function p(e,t,s,i){if(!e)return e;if(s||(s=t,t=e.spatialReference),!(0,a.JY)(t)||!(0,a.JY)(s)||(0,a.fS)(t,s))return e;if((0,o.Q8)(t,s)){const t=(0,a.sS)(s)?f(e):m(e);return t.spatialReference=s,t}return(0,r.oj)(n.N,[e],t,s,null,i)[0]}const g=new class{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(e,t,s){if(!e||!e.length||!t||!s||(0,a.fS)(t,s))return e;const i={geometries:e,inSpatialReference:t,outSpatialReference:s,resolve:null};return this._jobs.push(i),new Promise((e=>{i.resolve=e,null===this._timer&&(this._timer=setTimeout(this._process,10))}))}_process(){this._timer=null;const e=this._jobs.shift();if(!e)return;const{geometries:t,inSpatialReference:s,outSpatialReference:i,resolve:l}=e;(0,o.Q8)(s,i)?(0,a.sS)(i)?l(t.map(f)):l(t.map(m)):l((0,r.oj)(n.N,t,s,i,null,null)),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}};function _(e,t,s){return g.push(e,t,s)}},10402:(e,t,s)=>{s.d(t,{hN:()=>E,P0:()=>S,cW:()=>I});var i=s(20102),r=s(54102),n=s(87416),a=s(33955),o=s(8744);function l(e,t){return e?t?4:3:t?3:2}function u(e,t,s,i,r,n){const a=l(r,n),{coords:o,lengths:u}=i;if(!u)return!1;for(let i=0,r=0;i<u.length;i++,r+=a)if(!c(e,t,s,o[r],o[r+1]))return!1;return!0}function c(e,t,s,i,r){if(!e)return!1;const n=l(t,s),{coords:a,lengths:o}=e;let u=!1,c=0;for(const e of o)u=h(u,a,n,c,e,i,r),c+=e*n;return u}function h(e,t,s,i,r,n,a){let o=e,l=i;for(let e=i,u=i+r*s;e<u;e+=s){l=e+s,l===u&&(l=i);const r=t[e],c=t[e+1],h=t[l],d=t[l+1];(c<a&&d>=a||d<a&&c>=a)&&r+(a-c)/(d-c)*(h-r)<n&&(o=!o)}return o}var d=s(98732),f=s(5428),m=s(37427),p=s(11490);const g="feature-store:unsupported-query",_={esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"intersects",esriSpatialRelIndexIntersects:null,esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:null},y={spatialRelationship:{esriSpatialRelIntersects:!0,esriSpatialRelContains:!0,esriSpatialRelWithin:!0,esriSpatialRelCrosses:!0,esriSpatialRelDisjoint:!0,esriSpatialRelTouches:!0,esriSpatialRelOverlaps:!0,esriSpatialRelEnvelopeIntersects:!0,esriSpatialRelIndexIntersects:!1,esriSpatialRelRelation:!1},queryGeometry:{esriGeometryPoint:!0,esriGeometryMultipoint:!0,esriGeometryPolyline:!0,esriGeometryPolygon:!0,esriGeometryEnvelope:!0},layerGeometry:{esriGeometryPoint:!0,esriGeometryMultipoint:!0,esriGeometryPolyline:!0,esriGeometryPolygon:!0,esriGeometryEnvelope:!1}};function I(e,t,i,o,l){if((0,a.oU)(t)&&"esriGeometryPoint"===i&&("esriSpatialRelIntersects"===e||"esriSpatialRelContains"===e)){const e=(0,d.Uy)(new f.Z,t,!1,!1);return Promise.resolve((t=>function(e,t,s,i){return c(e,!1,!1,i.coords[0],i.coords[1])}(e,0,0,t)))}if((0,a.oU)(t)&&"esriGeometryMultipoint"===i){const s=(0,d.Uy)(new f.Z,t,!1,!1);if("esriSpatialRelContains"===e)return Promise.resolve((e=>u(s,!1,!1,e,o,l)))}if((0,a.YX)(t)&&"esriGeometryPoint"===i&&("esriSpatialRelIntersects"===e||"esriSpatialRelContains"===e))return Promise.resolve((e=>(0,r.aV)(t,(0,p.Op)(i,o,l,e))));if((0,a.YX)(t)&&"esriGeometryMultipoint"===i&&"esriSpatialRelContains"===e)return Promise.resolve((e=>(0,r.lQ)(t,(0,p.Op)(i,o,l,e))));if((0,a.YX)(t)&&"esriSpatialRelIntersects"===e){const e="mesh"===(h=i)?n.h_:(0,n.IY)(h);return Promise.resolve((s=>e(t,(0,p.Op)(i,o,l,s))))}var h;return Promise.all([s.e(5837),s.e(247)]).then(s.bind(s,30247)).then((s=>{const r=s[_[e]].bind(null,t.spatialReference,t);return e=>r((0,p.Op)(i,o,l,e))}))}async function S(e,t,s){const{spatialRel:r,geometry:n}=e;if(n){if(!function(e){return null!=e&&!0===y.spatialRelationship[e]}(r))throw new i.Z(g,"Unsupported query spatial relationship",{query:e});if((0,o.JY)(n.spatialReference)&&(0,o.JY)(s)){if(!function(e){return null!=e&&!0===y.queryGeometry[(0,a.Ji)(e)]}(n))throw new i.Z(g,"Unsupported query geometry type",{query:e});if(!function(e){return null!=e&&!0===y.layerGeometry[e]}(t))throw new i.Z(g,"Unsupported layer geometry type",{query:e});if(e.outSR)return(0,m._W)(e.geometry&&e.geometry.spatialReference,e.outSR)}}}function E(e){if((0,a.YX)(e))return!0;if((0,a.oU)(e)){for(const t of e.rings){if(5!==t.length)return!1;if(t[0][0]!==t[1][0]||t[0][0]!==t[4][0]||t[2][0]!==t[3][0]||t[0][1]!==t[3][1]||t[0][1]!==t[4][1]||t[1][1]!==t[2][1])return!1}return!0}return!1}},17590:(e,t,s)=>{async function i(e,t){if(!e)return null;const s=t.featureAdapter,{startTimeField:i,endTimeField:r}=e;let n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;if(i&&r)await t.forEach((e=>{const t=s.getAttribute(e,i),o=s.getAttribute(e,r);null==t||isNaN(t)||(n=Math.min(n,t)),null==o||isNaN(o)||(a=Math.max(a,o))}));else{const e=i||r;await t.forEach((t=>{const i=s.getAttribute(t,e);null==i||isNaN(i)||(n=Math.min(n,i),a=Math.max(a,i))}))}return{start:n,end:a}}function r(e,t,s){if(!t||!e)return null;const{startTimeField:i,endTimeField:r}=e;if(!i&&!r)return null;const{start:n,end:a}=t;return null===n&&null===a?null:void 0===n&&void 0===a?()=>!1:i&&r?function(e,t,s,i,r){return null!=i&&null!=r?n=>{const a=e.getAttribute(n,t),o=e.getAttribute(n,s);return(null==a||a<=r)&&(null==o||o>=i)}:null!=i?t=>{const r=e.getAttribute(t,s);return null==r||r>=i}:null!=r?s=>{const i=e.getAttribute(s,t);return null==i||i<=r}:void 0}(s,i,r,n,a):function(e,t,s,i){return null!=s&&null!=i&&s===i?i=>e.getAttribute(i,t)===s:null!=s&&null!=i?r=>{const n=e.getAttribute(r,t);return n>=s&&n<=i}:null!=s?i=>e.getAttribute(i,t)>=s:null!=i?s=>e.getAttribute(s,t)<=i:void 0}(s,i||r,n,a)}s.d(t,{R:()=>i,y:()=>r})},11490:(e,t,s)=>{s.d(t,{EG:()=>I,Op:()=>S,S2:()=>x,Up:()=>E,j6:()=>R,vF:()=>m});var i=s(35454),r=s(67900),n=s(44547),a=s(49600),o=s(33955),l=s(16306),u=s(8744),c=s(98732),h=s(5428),d=s(37427);const f=new i.X({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),m=Object.freeze({}),p=new h.Z,g=new h.Z,_=new h.Z,y={esriGeometryPoint:c.fQ,esriGeometryPolyline:c.J6,esriGeometryPolygon:c.eG,esriGeometryMultipoint:c.Iv};function I(e,t,s,i=e.hasZ,r=e.hasM){if(null==t)return null;const n=e.hasZ&&i,a=e.hasM&&r;if(s){const o=(0,c.Nh)(_,t,e.hasZ,e.hasM,"esriGeometryPoint",s,i,r);return(0,c.fQ)(o,n,a)}return(0,c.fQ)(t,n,a)}function S(e,t,s,i,r,n,a=t,o=s){const l=t&&a,u=s&&o,h=null!=i?"coords"in i?i:i.geometry:null;if(null==h)return null;if(r){let i=(0,c.zj)(g,h,t,s,e,r,a,o);return n&&(i=(0,c.Nh)(_,i,l,u,e,n)),y[e]?.(i,l,u)??null}if(n){const i=(0,c.Nh)(_,h,t,s,e,n,a,o);return y[e]?.(i,l,u)??null}return(0,c.hY)(p,h,t,s,a,o),y[e]?.(p,l,u)??null}async function E(e,t,s){const{outFields:i,orderByFields:r,groupByFieldsForStatistics:n,outStatistics:a}=e;if(i)for(let e=0;e<i.length;e++)i[e]=i[e].trim();if(r)for(let e=0;e<r.length;e++)r[e]=r[e].trim();if(n)for(let e=0;e<n.length;e++)n[e]=n[e].trim();if(a)for(let e=0;e<a.length;e++)a[e].onStatisticField&&(a[e].onStatisticField=a[e].onStatisticField.trim());return e.geometry&&!e.outSR&&(e.outSR=e.geometry.spatialReference),R(e,t,s)}async function R(e,t,i){if(!e)return null;let{where:n}=e;if(e.where=n=n&&n.trim(),(!n||/^1 *= *1$/.test(n)||t&&t===n)&&(e.where=null),!e.geometry)return e;let c=await async function(e){const{distance:t,units:i}=e,n=e.geometry;if(null==t||"vertexAttributes"in n)return n;const a=n.spatialReference,o=i?f.fromJSON(i):(0,r.qE)(a),l=a&&((0,u.sT)(a)||(0,u.sS)(a))?n:await(0,d._W)(a,u.Zn).then((()=>(0,d.iV)(n,u.Zn)));return(await async function(){return(await Promise.all([s.e(5837),s.e(247)]).then(s.bind(s,30247))).geodesicBuffer}())(l.spatialReference,l,t,o)}(e);if(e.distance=0,e.units=null,"esriSpatialRelEnvelopeIntersects"===e.spatialRel){const{spatialReference:t}=e.geometry;c=(0,a.aO)(c),c.spatialReference=t}if(c){await(0,d._W)(c.spatialReference,i),c=function(e,t){const s=e.spatialReference;return T(e,t)&&(0,o.YX)(e)?{spatialReference:s,rings:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}:e}(c,i);const t=(await(0,l.aX)((0,o.im)(c)))[0];if(null==t)throw m;const s="quantizationParameters"in e&&e.quantizationParameters?.tolerance||"maxAllowableOffset"in e&&e.maxAllowableOffset||0,r=s&&T(c,i)?{densificationStep:8*s}:void 0,n=t.toJSON(),a=await(0,d.iV)(n,n.spatialReference,i,r);if(!a)throw m;a.spatialReference=i,e.geometry=a}return e}function T(e,t){if(!e)return!1;const s=e.spatialReference;return((0,o.YX)(e)||(0,o.oU)(e)||(0,o.l9)(e))&&!(0,u.fS)(s,t)&&!(0,n.Up)(s,t)}function x(e){return e&&F in e?JSON.parse(JSON.stringify(e,w)):e}const F="_geVersion",w=(e,t)=>e!==F?t:void 0}}]);