/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports"],(function(e){"use strict";const i={hide:"hide",hideChildren:"hide-children"};function n(e){if(e)return null!=e.listMode?e.listMode:void 0}function t(e){if(e)return null!=e.minScale?e.minScale:void 0}function r(e){if(e)return null!=e.maxScale?e.maxScale:void 0}function l(e){if(!e)return"inherited";const i=e.get("layer.capabilities.exportMap.supportsSublayerVisibility");if("boolean"==typeof i)return i?"independent":"inherited";const n=e.get("capabilities.exportMap.supportsSublayerVisibility");return"boolean"==typeof n?n?"independent":"inherited":null!=e.visibilityMode?e.visibilityMode:"independent"}function o(e){if(!e)return;if(!("type"in e)){return"sublayers"}if(!(e.listMode===i.hideChildren||"wmts"===e.type)){if("group"===e.type){return"layers"}return"sublayers"}}function u(e){const i=e&&(e.get("layer.layer")||e.layer);if(!i)return!1;const n=i.get("capabilities.exportMap.supportsDynamicLayers");return"boolean"!=typeof n||n}function a(e){return n(e)!==i.hide}function s(e,i){if(!e||isNaN(i))return!1;const n=t(e),l=r(e),o=!isNaN(n)&&n>0&&i>n,u=!isNaN(l)&&l>0&&i<l;return o||u}function d(e,i){e&&e.sort(((e,n)=>{const t=i.indexOf(e.uid),r=i.indexOf(n.uid);return t>r?-1:t<r?1:0}))}function y(e,i){const n=null==e?void 0:e.layer;if(!n)return;const t=o(n);if(!t)return;d(n.get(t),i)}function c(e){const i=null==e?void 0:e.layer;return i&&"group"===i.type?i.layers:null}function f(e,i){var n;const t=null==(n=e.layer)?void 0:n.uid;return t&&i.find((e=>{var i;return(null==(i=e.layer)?void 0:i.uid)===t}))}function p(e){const i=b(e)?e:null,n=null==e?void 0:e.parent,t="map-image"===(null==n?void 0:n.type)&&i.source,r="";return t&&n?{layer:n,title:r,sublayerIds:[t.mapLayerId]}:{layer:e,title:r}}function b(e){return!(null==e||!e.layer)}e.canDisplayLayer=a,e.canSortSublayers=u,e.findLayerListMode=n,e.findLayerMaxScale=r,e.findLayerMinScale=t,e.findLayerVisibilityMode=l,e.findSelectedItem=f,e.getItemLayers=c,e.getLegendLayerInfo=p,e.getNormalizedChildLayerProperty=o,e.isLayerOutsideScaleRange=s,e.isSublayer=b,e.sortChildLayersToIds=y,e.sortLayersToIds=d,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
