/*
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/screenUtils","../../renderers/visualVariables/support/visualVariableUtils"],(function(e,r,t){"use strict";const i="simple-marker",n="picture-marker",o="simple-line",a="simple-fill",l="shield-label-symbol",s="text";function u(e,u){const{graphic:y,renderer:f,symbol:c}=u,p=c.type;if(p===s||p===l||!("visualVariables"in f)||!f.visualVariables)return;const d=f.getVisualVariablesForType("size"),g=f.getVisualVariablesForType("color"),m=f.getVisualVariablesForType("opacity"),b=f.getVisualVariablesForType("rotation"),V=d[0],h=g[0],v=m[0],w=b[0];if(V){const a=p===i?c.style:null,l=t.getSize(V,y,{shape:a});null!=l&&(p===i?e.size=r.px2pt(l):p===n?(e.width=r.px2pt(l),e.height=r.px2pt(l)):p===o?e.width=r.px2pt(l):e.outline&&(e.outline.width=r.px2pt(l)))}if(h){const r=t.getColor(h,y);(r&&p===i||p===o||p===a)&&(e.color=r?r.toJSON():void 0)}if(v){const r=t.getOpacity(v,y);null!=r&&e.color&&(e.color[3]=Math.round(255*r))}w&&(e.angle=-t.getRotationAngle(f,y))}function y(){return{layerDefinition:{name:"multipointLayer",geometryType:"esriGeometryMultipoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryMultipoint",features:[]}}}function f(){return{layerDefinition:{name:"polygonLayer",geometryType:"esriGeometryPolygon",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolygon",features:[]}}}function c(){return{layerDefinition:{name:"pointLayer",geometryType:"esriGeometryPoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPoint",features:[]}}}function p(){return{layerDefinition:{name:"polylineLayer",geometryType:"esriGeometryPolyline",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolyline",features:[]}}}function d(e,r=15){const t=e.canvas.width,i=e.canvas.height,n=e.getImageData(0,0,t,i).data;let o,a,l,s,u,y;e:for(a=i;a--;)for(o=t;o--;)if(n[4*(t*a+o)+3]>r){y=a;break e}if(!y)return null;e:for(o=t;o--;)for(a=y+1;a--;)if(n[4*(t*a+o)+3]>r){u=o;break e}e:for(o=0;o<=u;++o)for(a=y+1;a--;)if(n[4*(t*a+o)+3]>r){l=o;break e}e:for(a=0;a<=y;++a)for(o=l;o<=u;++o)if(n[4*(t*a+o)+3]>r){s=a;break e}return{x:l,y:s,width:u-l,height:y-s}}function g(e,r){const t=e.allLayerViews.items;if(r===e.scale)return t.filter((e=>!e.suspended));const i=new Array;for(const n of t)h(n.parent)&&!i.includes(n.parent)||!n.visible||r&&"isVisibleAtScale"in n&&!n.isVisibleAtScale(r)||i.push(n);return i}function m(e){return"bing-maps"===(null==e?void 0:e.type)}function b(e){return e&&"blendMode"in e&&"effect"in e}function V(e){return"csv"===(null==e?void 0:e.type)}function h(e){return"esri.views.2d.layers.GroupLayerView2D"===(null==e?void 0:e.declaredClass)}function v(e){const r=e.layer;if(b(r)){const t=r.blendMode;if((!t||"normal"===t)&&(r.effect||"featureEffect"in e&&e.featureEffect))return!0}return!1}e.applyVisualVariables=u,e.createMultipointLayer=y,e.createPointLayer=c,e.createPolygonLayer=f,e.createPolylineLayer=p,e.getContextBoundingBox=d,e.getVisibleLayerViews=g,e.isBingMapsLayer=m,e.isBlendLayer=b,e.isCSVLayer=V,e.isScreenshotRequired=v,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
