/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import b from"./AD6GOUND.js";import{e as l}from"./4B3QBH5T.js";import{a as o,c as A,e as h}from"./KUVOINJC.js";import{a,b as g,h as c,v as n,y as f}from"./NKG4FLLR.js";export default $arcgis.t(([,,,,,,,{Dc:b,E:L,Nc:_,Wc:S,Ya:T,d:O,e:$,f:B,g:F,gd:N,yb:D}])=>{function w(e,r){let s;return r===n.Category&&Array.isArray(e)?s=o.customSort:r===n.Category?s=e===c.Ascending?o.xAxisAsc:o.xAxisDesc:e===c.Ascending?s=o.yAxisAsc:s=o.yAxisDesc,s}function ie(e,r){let s;return r===n.Category&&Array.isArray(e)?s=A.customSort:s=e===c.Ascending?A.Asc:A.Desc,s}var P=e=>{let r=e.orderOptions?.data&&"orderBy"in e.orderOptions.data?e.orderOptions.data.orderBy:c.Ascending;return w(r,e.orderOptions?.data?.orderType??n.Category)},R=e=>{let r=f(e.series),s=!1;return(r===a.BarSeries||r===a.LineSeries)&&(s=P(e)===o.customSort),s},te=e=>{let r=[],s=e.orderOptions?.data?.orderType;return R(e)&&s===n.Category&&(r=e.orderOptions?.data?.orderBy),r},oe=(e,r,s,i)=>{let t=f(r.series),y=T(r);r.orderOptions??={};let d=y?[""]:c.Ascending;if(y)e===A.customSort&&s!==void 0?d=[...s]:d=e===A.Desc?c.Descending:c.Ascending,i?r.orderOptions.data={...r.orderOptions.data,orderByY:d,orderType:n.MultiAxes}:r.orderOptions.data={...r.orderOptions.data,orderByX:d,orderType:n.MultiAxes};else if(t===a.BarSeries||t===a.LineSeries){let p=n.Category;e===o.customSort&&s!==void 0?(d=[...s],r.orderOptions.data={orderType:p,orderBy:d}):(p=e===o.xAxisAsc||e===o.xAxisDesc?n.Category:n.YValue,d=e===o.xAxisAsc||e===o.yAxisAsc?c.Ascending:c.Descending,r.orderOptions.data={orderType:p,orderBy:d})}},ae=e=>e?.series?.[0]?.x??"",ne=e=>{let{config:r,xAxisField:s,numericFields:i,aggregationType:t,mode:y,layer:d,numericFieldIndex:p,seriesIndex:v,splitByField:I="",fieldList:M}=e,U=f(r.series),H=N(r.series),{idField:Y,isTraditionalTypeOID:k}=_(b(d)),x=k&&i.length===1&&i[0]===Y,m="y",u="y";switch(U){case a.PieSeries:{t!==g.NoAggregation?y===h.Category?(m=`${t}_${i[0]}_0`.toUpperCase(),u=x?l(g.Count):l(`${t} of ${i[0]}`)):m=$:m=i[0];break}case a.BarSeries:case a.LineSeries:case a.ComboLineAndBarSeries:case a.RadarSeries:case a.HeatSeries:{if(I===""||i.length>1)W({fieldName:s,numericFields:i,fieldList:M??[]})||H===D.BarAndLineFromFields?m=F:(m=`${t}_${i[p??0]}_${p??0}`.toUpperCase(),u=x?l(g.Count):l(`${t} of ${i[p??0]}`));else{let C=i[0];m=`${t}_${C}_${v??0}`.toUpperCase(),u=x?l(g.Count):l(`${t} of ${C}`)}break}}return{name:m,description:u}};function V(e){let{fieldName:r,fieldList:s}=e,i=S(s??[],r);return r===B||r===O||r===L||r===void 0||r.trim()===""||i===void 0}function W(e){let{fieldName:r,fieldList:s,numericFields:i}=e,t=i.filter(y=>S(s??[],y)?.type!=="esriFieldTypeOID");return V({fieldName:r,fieldList:s})&&(t?.length??0)>0}return{a:w,b:ie,c:P,d:te,e:oe,f:ae,g:ne,h:V,i:W}},"geometry/support/jsonUtils","rest/support/AttributeBinsQuery","rest/support/StatisticDefinition","time/TimeExtent","core/promiseUtils","request","intl",b)