/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
function r(r,e,n){const o=e.flatten(({sublayers:r})=>r).length;if(o!==r.length)return!0;return!!r.some(r=>r.originIdOf("minScale")>n||r.originIdOf("maxScale")>n||r.originIdOf("renderer")>n||r.originIdOf("labelingInfo")>n||r.originIdOf("opacity")>n||r.originIdOf("labelsVisible")>n||r.originIdOf("source")>n)||!i(r,e)}function e(r,e,n){return!!r.some(r=>{const e=r.source,i=!e||"map-layer"===e.type&&e.mapLayerId===r.id&&(null==e.gdbVersion||e.gdbVersion===n);r.commitProperty("renderer"),r.commitProperty("labelingInfo"),r.commitProperty("opacity"),r.commitProperty("labelsVisible"),r.commitProperty("orderBy");const o=r.layer?.capabilities?.exportMap?.supportsSublayerOrderBy??!1;return!i||r.originIdOf("renderer")>2||r.originIdOf("labelingInfo")>2||r.originIdOf("opacity")>2||r.originIdOf("labelsVisible")>2||o&&r.originIdOf("orderBy")>2})||!i(r,e)}function i(r,e){if(!r?.length||null==e)return!0;const i=e.slice().reverse().flatten(({sublayers:r})=>r&&r.toArray().reverse()).map(r=>r.id).toArray();if(r.length>i.length)return!1;let n=0;const o=i.length;for(const{id:t}of r){for(;n<o&&i[n]!==t;)n++;if(n>=o)return!1}return!0}function n(r){return!!r&&r.some(r=>null!=r.minScale||null!=r.layerDefinition?.minScale)}export{e as isExportDynamic,n as isSublayerOverhaul,r as shouldWriteSublayerStructure};
