/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{d as s}from"./DPJE33GY.js";import{c as f,g as C}from"./UG7LOBJE.js";import a from"./AD6GOUND.js";import{n as r}from"./4B3QBH5T.js";import"./FUPYXGG6.js";import"./NKG4FLLR.js";import{F as d,g as c,h as o,m as n,z as h}from"./RPU6VCJ4.js";import"./OR4HXHSY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,{Kc:m,Mc:g,Pc:p}])=>{var u=c`:host{margin-bottom:var(--arcgis-charts-intra-section-margin);margin-top:var(--arcgis-charts-intra-section-margin);height:100%}`,l=class extends h{constructor(){super(...arguments),this.onModelConfigChange=async e=>{let i=e?.detail.config??this.model.config;this.layer===void 0&&await this.updateFetchLayerFieldsInfo(i)},this.activeColorMatch=!1,this.popoverPlacement="leading",this.arcgisChartsConfigNoSeriesUpdate=n()}static{this.properties={layerFieldsInfo:16,activeColorMatch:16,model:0,timeZone:1,popoverPlacement:1,seriesColor:0,calculatedMinMaxBounds:0,page:1,layer:0,usePopupTemplateFieldsInfo:5}}static{this.styles=u}async load(){this.seriesColor!==void 0&&this.seriesColorChange(this.seriesColor),await this.updateFetchLayerFieldsInfo(this.model?.config),this.modelChange(this.model),this.updateDataFilters()}willUpdate(e){let i=!1;e.has("model")&&this.modelChange(this.model,e.get("model")),e.has("layer")&&this.layer!==void 0&&!r(e.get("layer"),this.layer)&&(i=!0),e.has("usePopupTemplateFieldsInfo")&&this.usePopupTemplateFieldsInfo!==void 0&&this.usePopupTemplateFieldsInfo!==e.get("usePopupTemplateFieldsInfo")&&(i=!0),e.has("seriesColor")&&this.seriesColor!==void 0&&this.seriesColorChange(this.seriesColor),this.layerFieldsInfo===void 0&&(i=!0),i&&this.updateFetchLayerFieldsInfo()}disconnectedCallback(){super.disconnectedCallback(),this.model.removeEventListener("arcgisChartsModelConfigChange",this.onModelConfigChange)}modelChange(e,i){i?.removeEventListener("arcgisChartsModelConfigChange",this.onModelConfigChange),e?.addEventListener("arcgisChartsModelConfigChange",this.onModelConfigChange)}seriesColorChange(e){this.activeColorMatch=e?.get(0)===void 0,this.model.colorMatch&&e?.forEach((i,t)=>{f(i)&&e?.get(0)!==void 0&&i?.color!==void 0&&!r(this.model.getSeriesColor(t),i?.color)&&this.model.setSeriesColor(i?.color,t)})}async updateDataFilters(){let e=this.model.getDataFilters(),i=e?.where,t=this.layer?.definitionExpression??void 0;r(i,t)||await this.model.setDataFilters({...e,where:t})}async updateFetchLayerFieldsInfo(e){let i=e??this.model.config,t=this.layer;if(!t){let a=C(i)?i.iLayer:void 0;a&&(t=await m(a))}t&&(this.layerFieldsInfo=await g(t,this.usePopupTemplateFieldsInfo))}render(){let e=this.layerFieldsInfo?.find(a=>a.name===this.model.xAxisField),i=e!==void 0&&p(e),t;switch(this.page){case s.Data:t=o`<arcgis-charts-config-bar-chart-data .model=${this.model} .layerFieldsInfo=${this.layerFieldsInfo}></arcgis-charts-config-bar-chart-data>`;break;case s.Series:t=o`<arcgis-charts-config-bar-chart-series .model=${this.model} .activeColorMatch=${this.activeColorMatch} .popoverPlacement=${this.popoverPlacement}></arcgis-charts-config-bar-chart-series>`;break;case s.Axes:t=o`<arcgis-charts-config-axes .model=${this.model} show-max-y-bound-option .calculatedMinMaxBounds=${this.calculatedMinMaxBounds}></arcgis-charts-config-axes>`;break;case s.Guides:t=o`<arcgis-charts-config-guides .model=${this.model} .timeZone=${this.timeZone} .enableXAxisGuide=${i} enable-y-axis-guide .calculatedMinMaxBounds=${this.calculatedMinMaxBounds}></arcgis-charts-config-guides>`;break;case s.Format:t=o`<arcgis-charts-config-format .model=${this.model}></arcgis-charts-config-format>`;break;case s.General:t=o`<arcgis-charts-config-general .model=${this.model}></arcgis-charts-config-general>`;break;default:t="";break}return t}};d("arcgis-charts-config-bar-chart",l);return l},"Graphic","renderers/support/jsonUtils","symbols/support/symbolUtils","intl","layers/support/FeatureFilter","smartMapping/statistics/histogram","smartMapping/statistics/summaryStatistics","request","core/sql","AttributeBinsGraphic","geometry/support/jsonUtils","rest/support/AttributeBinsQuery","rest/support/StatisticDefinition","time/TimeExtent","core/promiseUtils",a)