/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../core/Accessor","../../core/HandleOwner","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass"],(function(e,r,t,a,s,o,n,l,i,c){"use strict";const p={visible:"visibleSublayers"};e.ExportWMSImageParameters=function(e){function t(r){var t;return(t=e.call(this,r)||this).scale=0,t}return r._inheritsLoose(t,e),t.prototype.toJSON=function(){const{layer:e,layers:r}=this,{imageFormat:t,imageTransparency:a,version:s}=e;return{format:t,request:"GetMap",service:"WMS",styles:"",transparent:a?"TRUE":"FALSE",version:s,layers:r}},r._createClass(t,[{key:"layer",set:function(e){this._get("layer")!==e&&(this._set("layer",e),this.handles.remove("layer"),e&&this.handles.add([e.sublayers.on("change",(()=>this.notifyChange("visibleSublayers"))),e.on("wms-sublayer-update",(e=>this.notifyChange(p[e.propertyName])))],"layer"))}},{key:"layers",get:function(){const{visibleSublayers:e}=this;return e.filter((e=>e.name)).map((e=>e.name)).join(",")}},{key:"version",get:function(){this.commitProperty("layers");const e=this.layer;return e&&e.commitProperty("imageTransparency"),(this._get("version")||0)+1}},{key:"visibleSublayers",get:function(){const{layer:e,scale:r}=this,t=null==e?void 0:e.sublayers,a=[],s=e=>{const{minScale:t,maxScale:o,sublayers:n,visible:l}=e;l&&(0===r||(0===t||r<=t)&&(0===o||r>=o))&&(n?n.forEach(s):a.unshift(e))};return null==t||t.forEach(s),a}}]),t}(s.HandleOwnerMixin(a)),t.__decorate([o.property()],e.ExportWMSImageParameters.prototype,"layer",null),t.__decorate([o.property({readOnly:!0})],e.ExportWMSImageParameters.prototype,"layers",null),t.__decorate([o.property({type:Number})],e.ExportWMSImageParameters.prototype,"scale",void 0),t.__decorate([o.property({readOnly:!0})],e.ExportWMSImageParameters.prototype,"version",null),t.__decorate([o.property({readOnly:!0})],e.ExportWMSImageParameters.prototype,"visibleSublayers",null),e.ExportWMSImageParameters=t.__decorate([c.subclass("esri.layers.support.ExportWMSImageParameters")],e.ExportWMSImageParameters),Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
