/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import e from"../../Color.js";import r from"../../symbols/SimpleFillSymbol.js";import t from"../../symbols/SimpleLineSymbol.js";import n from"../../symbols/SimpleMarkerSymbol.js";import{isInEffectiveScaleRange as o}from"../../views/support/layerViewUtils.js";function i(){return{layerDefinition:{name:"multipointLayer",geometryType:"esriGeometryMultipoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryMultipoint",features:[]}}}function l(){return{layerDefinition:{name:"polygonLayer",geometryType:"esriGeometryPolygon",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolygon",features:[]}}}function f(){return{layerDefinition:{name:"pointLayer",geometryType:"esriGeometryPoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPoint",features:[]}}}function a(){return{layerDefinition:{name:"polylineLayer",geometryType:"esriGeometryPolyline",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolyline",features:[]}}}function u(e,r=15){const t=e.canvas.width,n=e.canvas.height,o=e.getImageData(0,0,t,n).data;let i,l,f,a,u,y;e:for(l=n;l--;)for(i=t;i--;)if(o[4*(t*l+i)+3]>r){y=l;break e}if(!y)return null;e:for(i=t;i--;)for(l=y+1;l--;)if(o[4*(t*l+i)+3]>r){u=i;break e}e:for(i=0;i<=u;++i)for(l=y+1;l--;)if(o[4*(t*l+i)+3]>r){f=i;break e}e:for(l=0;l<=y;++l)for(i=f;i<=u;++i)if(o[4*(t*l+i)+3]>r){a=l;break e}return{x:f,y:a,width:u-f,height:y-a}}function y(e){if(!e.attributionVisible)return;let r;return"function"==typeof e.originOf&&"user"===e.originOf("copyright")&&(r=e.copyright),r||!e.hasAttributionData?(r??=e.portalItem?.accessInformation,r??=e.copyright,r??void 0):void 0}function s(o,i){const l=i.color?.clone()??new e([0,255,255]),f=i.haloColor?.clone()??l.clone();switch(o){case"envelope":case"polygon":return l.a*=i.fillOpacity??.25,new r({color:l,outline:new t({color:f}),style:"solid"});case"polyline":return new t({color:f});default:return f.a=1,new n({color:f,outline:null})}}function c(e,r){const t=e.allLayerViews.items;if(r===e.scale)return t.filter(e=>!e.suspended);const n=new Array;for(const i of t){const e=i.parent;e&&e!==i.view&&(g(e)||d(e))&&!n.includes(e)||i.visible&&i.visibleAtCurrentTimeExtent&&o(i.layer.effectiveScaleRange,r)&&n.push(i)}return n}function m(e){return"bing-maps"===e?.type}function p(e){return e&&"blendMode"in e&&"effect"in e}function g(e){return"catalog"===e.layer.type}function d(e){return"group"===e.layer.type}function b(e){return e&&"trackInfo"in e}function w(e){const r=e.layer;if(p(r)){const t=r.blendMode;if((!t||"normal"===t)&&(r.effect||"featureEffect"in e&&e.featureEffect))return!0}return!(!b(r)||!r.trackInfo?.enabled)}export{i as createMultipointLayer,f as createPointLayer,l as createPolygonLayer,a as createPolylineLayer,u as getContextBoundingBox,y as getCopyright,s as getSelectionSymbol,c as getVisibleLayerViews,m as isBingMapsLayer,p as isBlendLayer,w as isScreenshotRequired};
