/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../core/Error","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../layers/support/commonProperties","../../layers/support/ExportWMSImageParameters"],(function(e,r,t,o,s,a,p,i,n,c){"use strict";const u=s=>{let a=function(r){function o(){return r.apply(this,arguments)||this}e._inheritsLoose(o,r);var s=o.prototype;return s.initialize=function(){this.exportImageParameters=new c.ExportWMSImageParameters({layer:this.layer})},s.destroy=function(){this.exportImageParameters.destroy(),this.exportImageParameters=null},s.fetchPopupFeatures=function(e){const{layer:r}=this;if(!e)return Promise.reject(new t("wmslayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:r}));const{popupEnabled:o}=r;if(!o)return Promise.reject(new t("wmslayerview:fetchPopupFeatures","popupEnabled should be true",{popupEnabled:o}));const s=this.createFetchPopupFeaturesQuery(e);if(!s)return Promise.resolve([]);const{extent:a,width:p,height:i,x:n,y:c}=s;if(!(a&&p&&i))throw new t("wmslayerview:fetchPopupFeatures","WMSLayer does not support fetching features.",{extent:a,width:p,height:i});const u=r.fetchFeatureInfo(a,p,i,n,c);return Promise.resolve(u?[u]:[])},e._createClass(o,[{key:"exportImageVersion",get:function(){var e;return null==(e=this.exportImageParameters)||e.commitProperty("version"),this.commitProperty("timeExtent"),(this._get("exportImageVersion")||0)+1}}]),o}(s);return r.__decorate([o.property()],a.prototype,"exportImageParameters",void 0),r.__decorate([o.property({readOnly:!0})],a.prototype,"exportImageVersion",null),r.__decorate([o.property()],a.prototype,"layer",void 0),r.__decorate([o.property(n.combinedViewLayerTimeExtentProperty)],a.prototype,"timeExtent",void 0),a=r.__decorate([i.subclass("esri.layers.mixins.WMSLayerView")],a),a};return u}));
