/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import{property as s,subclass as t}from"../../core/accessorSupport/decorators.js";const a={visible:"visibleSublayers"};let o=class extends r{constructor(e){super(e),this.scale=0}set layer(e){this._get("layer")!==e&&(this._set("layer",e),this.removeHandles("layer"),e&&this.addHandles([e.sublayers.on("change",()=>this.notifyChange("visibleSublayers")),e.on("wms-sublayer-update",e=>this.notifyChange(a[e.propertyName]))],"layer"))}get layers(){return this.visibleSublayers.filter(({name:e})=>e).map(({name:e})=>e).join()}get version(){this.commitProperty("layers");const e=this.layer;return e&&e.commitProperty("imageTransparency"),(this._get("version")||0)+1}get visibleSublayers(){const{layer:e,scale:r}=this,s=e?.sublayers,t=[],a=e=>{const{minScale:s,maxScale:o,sublayers:l,visible:i}=e;i&&(0===r||(0===s||r<=s)&&(0===o||r>=o))&&(l?l.forEach(a):t.push(e))};return s?.forEach(a),t}toJSON(){const{layer:e,layers:r}=this,{imageFormat:s,imageTransparency:t,version:a}=e;return{format:s,request:"GetMap",service:"WMS",styles:"",transparent:t?"TRUE":"FALSE",version:a,layers:r}}};e([s()],o.prototype,"layer",null),e([s({readOnly:!0})],o.prototype,"layers",null),e([s({type:Number})],o.prototype,"scale",void 0),e([s({readOnly:!0})],o.prototype,"version",null),e([s({readOnly:!0})],o.prototype,"visibleSublayers",null),o=e([t("esri.layers.support.ExportWMSImageParameters")],o);export{o as ExportWMSImageParameters};
