/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../chunks/_rollupPluginBabelHelpers","../chunks/tslib.es6","../core/JSONSupport","../core/accessorSupport/decorators/property","../core/arrayUtils","../core/has","../core/accessorSupport/ensureType","../core/accessorSupport/decorators/enumeration","../core/accessorSupport/decorators/subclass","./support/ColormapInfo","./support/colorRampUtils"],(function(r,o,e,t,a,c,s,n,p,l,u){"use strict";var i;let m=i=function(o){function e(r){var e;return(e=o.call(this,r)||this).colormapInfos=null,e.type="raster-colormap",e}r._inheritsLoose(e,o),e.createFromColormap=function(r,o){if(!r)return null;const e=5===r[0].length,t=[...r].sort((r=>r[0][0]-r[1][0])).map((r=>{var t;return l.fromJSON({value:r[0],color:e?r.slice(1,5):r.slice(1,4).concat([255]),label:o?null!=(t=o[r[0]])?t:"":r[0]})}));return new i({colormapInfos:t})},e.createFromColorramp=function(r){const o=u.convertColorRampToColormap(r,256);return i.createFromColormap(o)};var t=e.prototype;return t.clone=function(){return new i({colormapInfos:this.colormapInfos.map((r=>r.toJSON()))})},t.extractColormap=function(){return this.colormapInfos.map((({value:r,color:o})=>[r,o.r,o.g,o.b,o.a>1?o.a:255*o.a&255])).sort(((r,o)=>r[0]-o[0]))},e}(e.JSONSupport);o.__decorate([t.property({type:[l],json:{write:!0}})],m.prototype,"colormapInfos",void 0),o.__decorate([n.enumeration({rasterColormap:"raster-colormap"})],m.prototype,"type",void 0),m=i=o.__decorate([p.subclass("esri.renderers.RasterColormapRenderer")],m);return m}));
