/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{createStretchRenderer as t}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as e}from"../support/utils.js";async function a(a){const r=[(a=await e(a)).bandId||0],s={bandIds:r,variableName:a.variableName,stretchType:a.stretchType,includeStatisticsInStretch:a.includeStatisticsInStretch},i=a.layer,{rasterInfo:c}=i;let m=t(c,s);if(a.estimateStatistics){a.includeStatisticsInStretch=!0;const e=c.clone();await i.updateRasterInfoWithEstimatedStats(e,{rasterFunction:a.rasterFunction,signal:a.signal}),m=t(e,s)}return n(m,a),{renderer:m,bandId:r[0]}}function n(t,e){const{gamma:a,useGamma:n,dynamicRangeAdjustment:r,colorRamp:s}=e;null!=a&&(t.gamma=[a]),null!=n&&(t.useGamma=n),null!=r&&(t.dynamicRangeAdjustment=r),void 0!==s&&(t.colorRamp=s)}export{a as createRenderer};
