/*
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","../../../request","../../../core/asyncUtils","../../../core/Error","../../../core/maybe","../../../core/promiseUtils","../../../core/urlUtils"],(function(r,e,t,n,o,a,u,i){"use strict";let s=function(){function r(r){this.streamDataRequester=r}var s=r.prototype;return s.loadJSON=function(){var r=e._asyncToGenerator((function*(r,e){return this._load("json",r,e)}));function t(e,t){return r.apply(this,arguments)}return t}(),s.loadBinary=function(){var r=e._asyncToGenerator((function*(r,e){return i.isDataProtocol(r)?(u.throwIfAborted(e),i.dataToArrayBuffer(r)):this._load("binary",r,e)}));function t(e,t){return r.apply(this,arguments)}return t}(),s.loadImage=function(){var r=e._asyncToGenerator((function*(r,e){return this._load("image",r,e)}));function t(e,t){return r.apply(this,arguments)}return t}(),s._load=function(){var r=e._asyncToGenerator((function*(r,e,i){if(a.isNone(this.streamDataRequester))return(yield t(e,{responseType:l[r]})).data;const s=yield n.result(this.streamDataRequester.request(e,r,i));if(!0===s.ok)return s.value;throw u.throwIfAbortError(s.error),new o("",`Request for resource failed: ${s.error}`)}));function i(e,t,n){return r.apply(this,arguments)}return i}(),r}();const l={image:"image",binary:"array-buffer",json:"json"};r.DefaultLoadingContext=s,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
