// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../chunks/tslib.es6 ../../Color ../../core/Clonable ../../core/Collection ../../core/collectionUtils ../../core/JSONSupport ../../core/mathUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ./VoxelColorStop ./VoxelOpacityStop ./VoxelRangeFilter".split(" "),function(r,B,m,u,C,D,q,v,H,I,J,E,y,z,F){var n;(function(a){a[a.Color=1]="Color";a[a.Alpha=2]="Alpha";a[a.Both=3]="Both"})(n||={}); m=class extends m.ClonableMixin(D.JSONSupport){constructor(a){super(a);this.rangeFilter=this.stretchRange=this.interpolation=null;this._colorMapSize=256;this.colorStops=new (u.ofType(y));this.opacityStops=new (u.ofType(z))}set colorStops(a){this._set("colorStops",C.referenceSetter(a,this._get("colorStops"),u.ofType(y)))}set opacityStops(a){this._set("opacityStops",C.referenceSetter(a,this._get("opacityStops"),u.ofType(z)))}getPreviousNext(a,d,b){let c=a;for(;0<--c&&d[c].type!==b&&d[c].type!==n.Both;); const k=d.length;for(;++athis.colorStops.length)return a;const d=[],b=[];for(var c of this.colorStops){if(!c.color)return a;b.push({color:{r:c.color.r,g:c.color.g,b:c.color.b,a:Math.round(255*(1-c.color.a))},position:c.position,type:n.Color})}if(0===this.opacityStops.length)for(var k of b)d.push({color:k.color,position:k.position});else{for(var g of this.opacityStops){c=q.clamp(g.position,0,1);k=Math.round(255* q.clamp(1-g.opacity,0,1));let f=!1;for(var h of b)if(h.type===n.Color&&1E-5>Math.abs(h.position-c)){h.color.a=k;h.type=n.Both;f=!0;break}f||b.push({color:{r:0,g:0,b:0,a:k},position:g.position,type:n.Alpha})}b.sort((f,e)=>f.position{f.color[A]=Math.round(q.lerp(w[A],G[A],p))})}else-1!==e?x.forEach(p=>{f.color[p]=b[e].color[p]}):x.forEach(p=>{f.color[p]=b[l].color[p]})}}for(var t of b)d.push({color:t.color,position:t.position})}d[0].position=0;d[d.length-1].position=1;t=0;g=1;for(h=0;h d[g].position;)t=g++;const f=(c-d[t].position)/(d[g].position-d[t].position),e=d[t].color,l=d[g].color,p=new B;x.forEach(w=>{p[w]=Math.round(q.lerp(e[w],l[w],f))});p.a=q.clamp(1-q.lerp(e.a,l.a,f)/255,0,1);a.push(p)}return a}getColorForContinuousDataValue(a,d){const b=this.rasterizedTransferFunction;if(2>this.colorStops.length||!Array.isArray(this.stretchRange)||2>this.stretchRange.length||256>b.length)return null;let c=this.stretchRange[0],k=this.stretchRange[1];if(c>k){const g=c;c=k;k=g}a=q.clamp(a, c,k);a=b[Math.round((a-c)/(k-c)*(this._colorMapSize-1))].clone();d||(a.a=1);return a}};r.__decorate([v.property({type:["linear","nearest"],json:{write:!0}})],m.prototype,"interpolation",void 0);r.__decorate([v.property({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],m.prototype,"stretchRange",void 0);r.__decorate([v.property({type:u.ofType(y),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.colorStops&&0