/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../request.js";import r from"../core/Error.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import i from"./Layer.js";import{BlendLayer as o}from"./mixins/BlendLayer.js";import{RefreshableLayer as m}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as n}from"./mixins/ScaleRangeLayer.js";import{createBitmapResult as p}from"./support/imageBitmapUtils.js";var c;let l=c=class extends(o(n(m(i)))){constructor(e){super(e),this.type="base-dynamic"}getImageUrl(){throw new r("basedynamiclayer:getImageUrl-not-implemented","getImageUrl() is not implemented")}addResolvingPromise(e){super.addResolvingPromise(e)}async fetchImage(e,r,a,s){const i=this.getImageUrl(e,r,a),o={responseType:"image",signal:s?.signal,query:{...this.refreshParameters}};if("string"==typeof i){const{data:e}=await t(i,o);return e}const m=await i,{data:n}=await t(m,o);return n}async fetchImageBitmap(e,a,s,i={}){if(this.fetchImage!==c.prototype.fetchImage){const t=await this.fetchImage(e,a,s,i);try{return await p(t,i)}catch(g){throw new r("request:server","Unable to load image",{error:g,extent:e,width:a,height:s})}}const o=this.getImageUrl(e,a,s),m={responseType:"blob",signal:i?.signal,query:{...this.refreshParameters}};if("string"==typeof o){const{data:e}=await t(o,m);return p(e,i)}const n=await o,{data:l}=await t(n,m);return p(l,i)}};e([a({readOnly:!0,value:"base-dynamic"})],l.prototype,"type",void 0),e([a({type:["show","hide"]})],l.prototype,"listMode",void 0),l=c=e([s("esri.layers.BaseDynamicLayer")],l);const g=l;export{g as default};
