/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as o}from"tslib";import{JSONSupport as r}from"../core/JSONSupport.js";import{property as t,subclass as e}from"../core/accessorSupport/decorators.js";import s from"./support/ColormapInfo.js";import{convertColorRampToColormap as a}from"./support/colorRampUtils.js";import{enumeration as p}from"../core/accessorSupport/decorators/enumeration.js";var c;let m=c=class extends r{constructor(o){super(o),this.colormapInfos=null,this.type="raster-colormap"}static createFromColormap(o,r){if(!o)return null;const t=5===o[0].length,e=[...o].sort((o,r)=>o[0]-r[0]).map(o=>s.fromJSON({value:o[0],color:t?o.slice(1,5):o.slice(1,4).concat([255]),label:r?r[o[0]]??"":o[0]}));return new c({colormapInfos:e})}static createFromColorramp(o){const r=a(o);return c.createFromColormap(r)}clone(){return new c({colormapInfos:this.colormapInfos.map(o=>o.toJSON())})}extractColormap(){return this.colormapInfos.map(({value:o,color:r})=>[o,r.r,r.g,r.b,r.a>1?r.a:255*r.a&255]).sort((o,r)=>o[0]-r[0])}};o([t({type:[s],json:{write:{isRequired:!0}}})],m.prototype,"colormapInfos",void 0),o([p({rasterColormap:"raster-colormap"}),t({json:{write:{isRequired:!0}}})],m.prototype,"type",void 0),m=c=o([e("esri.renderers.RasterColormapRenderer")],m);export{m as default};
