/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../core/maybe","../../../../core/screenUtils"],(function(e,t,n){"use strict";function i(e){const t=o(l(e)),i=t,s=!0,a=Math.max(t/2,5),r=Math.round(n.pt2px(e.maxPathLength)/a)+1,u=10,{density:c}=e;return{smoothing:n.pt2px(e.smoothing),interpolate:!0,velocityScale:"flow-from"===e.flowRepresentation?1:-1,verticesPerLine:r,minSpeedThreshold:.001,segmentLength:a,maxTurnAngle:1,collisions:s,lineCollisionWidth:i,lineSpacing:u,density:c}}function o(e){return"constant"===e.kind?e.value[0]:e.values[e.values.length-1]}function s(e){const t=e.toRgba();return[t[0]/255,t[1]/255,t[2]/255,t[3]]}function a(e){return{kind:"constant",value:[.1,.1,.1,1]}}function l(e){if(!e.hasVisualVariables("size"))return{kind:"constant",value:[n.pt2px(e.trailWidth)]};const t=e.getVisualVariablesForType("size")[0],i=[],o=[];let s;if(t.stops){for(const e of t.stops)i.push(e.value),o.push(n.pt2px(e.size));s=t.stops.length}else i.push(t.minDataValue,t.maxDataValue),o.push(n.pt2px(t.minSize),n.pt2px(t.maxSize)),s=2;return{kind:"ramp",stops:i,values:o,count:s}}function r(e){if(!e.hasVisualVariables("color"))return{kind:"constant",value:s(e.color)};const t=e.getVisualVariablesForType("color")[0],n=[],i=[];for(const o of t.stops)n.push(o.value),Array.prototype.push.apply(i,s(o.color));return{kind:"ramp",stops:n,values:i,count:t.stops.length}}function u(e){if(!e.hasVisualVariables("opacity"))return{kind:"constant",value:[1]};const t=e.getVisualVariablesForType("opacity")[0],n=[],i=[];for(const o of t.stops)n.push(o.value),i.push(o.opacity);return{kind:"ramp",stops:n,values:i,count:t.stops.length}}function c(e,t,n,i){switch(t){case"int":e.setUniform1iv(n,i);break;case"float":e.setUniform1fv(n,i);break;case"vec2":e.setUniform2fv(n,i);break;case"vec3":e.setUniform3fv(n,i);break;case"vec4":e.setUniform4fv(n,i)}}function p(e,t,n,i){"constant"===i.kind?c(e,n,`u_${t}`,i.value):(c(e,"float",`u_${t}_stops`,i.stops),c(e,n,`u_${t}_values`,i.values),e.setUniform1i(`u_${t}_count`,i.count))}function m(e,t){let n=!0;return n=n&&e.collisions===t.collisions,n=n&&e.density===t.density,n=n&&e.interpolate===t.interpolate,n=n&&e.lineCollisionWidth===t.lineCollisionWidth,n=n&&e.lineSpacing===t.lineSpacing,n=n&&e.maxTurnAngle===t.maxTurnAngle,n=n&&e.minSpeedThreshold===t.minSpeedThreshold,n=n&&e.segmentLength===t.segmentLength,n=n&&e.smoothing===t.smoothing,n=n&&e.velocityScale===t.velocityScale,n=n&&e.verticesPerLine===t.verticesPerLine,n}function f(e,n){return e===n||!(!t.isSome(e)||!t.isSome(n))&&e.equals(n)}function g(e,t){if(!m(e.simulationSettings,t.simulationSettings))return!1;if(!f(e.timeExtent,t.timeExtent))return!1;let n=!0;return n=n&&e.loadImagery===t.loadImagery,n=n&&e.createFlowMesh===t.createFlowMesh,n=n&&e.color.kind===t.color.kind,n=n&&e.opacity.kind===t.opacity.kind,n=n&&e.size.kind===t.size.kind,n}e.areStreamlinesCompatible=g,e.getColor=r,e.getFlowSimulationSettings=i,e.getForegroundColor=a,e.getMax=o,e.getOpacity=u,e.getSize=l,e.setUniform=c,e.setUniforms=p,e.timeExtentsEqual=f,e.toRgba=s,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
