/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../colorUtils","../../core/screenUtils","../../chunks/mat4f32","./colorMatrixFunctions"],(function(t,o,r,e,i,n){"use strict";function s(t){return"colorMatrix"in t}let a=function(){function t(t,o,r){this.strength=t,this.radius=o,this.threshold=r,this.type="bloom"}var o=t.prototype;return o.interpolate=function(t,o,r){this.strength=p(t.strength,o.strength,r),this.radius=p(t.radius,o.radius,r),this.threshold=p(t.threshold,o.threshold,r)},o.clone=function(){return new t(this.strength,this.radius,this.threshold)},o.toJSON=function(){return{type:"bloom",radius:d(this.radius),strength:this.strength,threshold:this.threshold}},t}(),u=function(){function t(t){this.radius=t,this.type="blur"}var o=t.prototype;return o.interpolate=function(t,o,r){this.radius=Math.round(p(t.radius,o.radius,r))},o.clone=function(){return new t(this.radius)},o.toJSON=function(){return{type:"blur",radius:d(this.radius)}},t}(),c=function(){function t(t,o){this.type=t,this.amount=o,"invert"!==this.type&&"grayscale"!==this.type&&"sepia"!==this.type||(this.amount=Math.min(this.amount,1))}var r=t.prototype;return r.interpolate=function(t,o,r){this.amount=p(t.amount,o.amount,r),this._updateMatrix()},r.clone=function(){return new t(this.type,this.amount)},r.toJSON=function(){return{type:this.type,amount:this.amount}},r._updateMatrix=function(){const t=this._colorMatrix||i.create();switch(this.type){case"brightness":this._colorMatrix=n.brightness(t,this.amount);break;case"contrast":this._colorMatrix=n.contrast(t,this.amount);break;case"grayscale":this._colorMatrix=n.grayscale(t,this.amount);break;case"invert":this._colorMatrix=n.invert(t,this.amount);break;case"saturate":this._colorMatrix=n.saturate(t,this.amount);break;case"sepia":this._colorMatrix=n.sepia(t,this.amount)}},o._createClass(t,[{key:"colorMatrix",get:function(){return this._colorMatrix||this._updateMatrix(),this._colorMatrix}}]),t}(),h=function(){function t(t,o,r,e){this.offsetX=t,this.offsetY=o,this.blurRadius=r,this.color=e,this.type="drop-shadow"}var o=t.prototype;return o.interpolate=function(t,o,r){this.offsetX=p(t.offsetX,o.offsetX,r),this.offsetY=p(t.offsetY,o.offsetY,r),this.blurRadius=p(t.blurRadius,o.blurRadius,r),this.color[0]=Math.round(p(t.color[0],o.color[0],r)),this.color[1]=Math.round(p(t.color[1],o.color[1],r)),this.color[2]=Math.round(p(t.color[2],o.color[2],r)),this.color[3]=p(t.color[3],o.color[3],r)},o.clone=function(){return new t(this.offsetX,this.offsetY,this.blurRadius,[...this.color])},o.toJSON=function(){const t=[...this.color];return t[3]*=255,{type:"drop-shadow",xoffset:d(this.offsetX),yoffset:d(this.offsetY),blurRadius:d(this.blurRadius),color:t}},t}(),l=function(){function t(t){this.angle=t,this.type="hue-rotate"}var r=t.prototype;return r.interpolate=function(t,o,r){this.angle=p(t.angle,o.angle,r),this._updateMatrix()},r.clone=function(){return new t(this.angle)},r.toJSON=function(){return{type:"hue-rotate",angle:this.angle}},r._updateMatrix=function(){const t=this._colorMatrix||i.create();this._colorMatrix=n.rotateHue(t,this.angle)},o._createClass(t,[{key:"colorMatrix",get:function(){return this._colorMatrix||this._updateMatrix(),this._colorMatrix}}]),t}(),f=function(){function t(t){this.amount=t,this.type="opacity",this.amount=Math.min(this.amount,1)}var o=t.prototype;return o.interpolate=function(t,o,r){this.amount=p(t.amount,o.amount,r)},o.clone=function(){return new t(this.amount)},o.toJSON=function(){return{type:"opacity",amount:this.amount}},t}();function p(t,o,r){return t+(o-t)*r}function d(t){return Math.round(1e3*e.px2pt(t))/1e3}function y(t){switch(t.type){case"grayscale":case"sepia":case"invert":return new c(t.type,0);case"saturate":case"brightness":case"contrast":return new c(t.type,1);case"opacity":return new f(1);case"hue-rotate":return new l(0);case"blur":return new u(0);case"drop-shadow":return new h(0,0,0,[...r.getNamedColor("transparent")]);case"bloom":return new a(0,0,1)}}t.BloomEffect=a,t.BlurEffect=u,t.ColorMatrixEffect=c,t.DropShadowEffect=h,t.HueRotateEffect=l,t.OpacityEffect=f,t.createEffectWithInitialValues=y,t.isColorMatrixEffect=s,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
