/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import{a as d,b as f}from"./VJVKFKSG.js";import{p as c}from"./IXZEUVT2.js";export default $arcgis.t(([b,{property:s,subclass:h},m])=>{var w=Object.defineProperty,_=Object.getOwnPropertyDescriptor,a=(r,t,o,e)=>{for(var n=e>1?void 0:e?_(t,o):t,l=r.length-1,u;l>=0;l--)(u=r[l])&&(n=(e?u(t,o,n):u(n))||n);return e&&n&&w(t,o,n),n};function q(r,t,o){if(r&&typeof r=="object"&&!Array.isArray(r)){let e="details"in r&&r.details&&typeof r.details=="object"&&!Array.isArray(r.details)?{detail:r.details}:void 0,n=o?`${o} - ${String(r)}`:String(r);c("error",t,n,e)}}function y(r="Aborted"){return new m("AbortError",r)}function L(r,t="Aborted"){if(v(r))throw y(t)}function p(r){return r instanceof AbortSignal?r:r?.signal??void 0}function v(r){return p(r)?.aborted??!1}function g(r){return r?.name==="AbortError"}function A(r){return{ok:!0,value:r}}function C(r){return{ok:!1,error:r}}function k(r){return r?.ok?r.value:null}function j(r){return r!=null&&!r.ok?r.error:null}function E(r,t){let o=p(r);if(o==null)return;if(o.aborted){t();return}let e=()=>t();return o.addEventListener("abort",e,{once:!0}),{remove:()=>o.removeEventListener("abort",e)}}function O(r,t){return new i(r,t)}var i=class extends b{constructor(r,t){super({}),this._abortHandle=null,this.abort=()=>{this._abortController=d(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;let{signal:o}=this._abortController;this.promise=r(o),this.promise.then(e=>{this._result=A(e),this._cleanup()},e=>{this._result=C(e),this._cleanup()}),this._abortHandle=E(t,this.abort)}get value(){return k(this._result)}get error(){return j(this._result)}get finished(){return this._result!=null}destroy(){this.abort()}_cleanup(){this._abortHandle=f(this._abortHandle),this._abortController=null}[Symbol.dispose](){this._cleanup()}};a([s()],i.prototype,"value",1);a([s()],i.prototype,"error",1);a([s()],i.prototype,"finished",1);a([s()],i.prototype,"promise",2);a([s()],i.prototype,"_result",2);i=a([h("esri.components.asyncUtils.ReactiveTask")],i);function P(r){return r.catch(t=>{if(!g(t))throw t})}function D(r,t={}){if("requestIdleCallback"in window)return window.requestIdleCallback(r,t);let o=t.timeout!=null?t.timeout:50,e=typeof performance<"u"&&performance.now?performance.now.bind(performance):Date.now,n=e();return window.setTimeout(()=>{r({didTimeout:!1,timeRemaining(){return Math.max(0,o-(e()-n))}})},1)}function R(r){"cancelIdleCallback"in window&&window.cancelIdleCallback(r),window.clearTimeout(r)}return{a:q,b:L,c:v,d:g,e:O,f:P,g:D,h:R}},"core/Accessor","core/accessorSupport/decorators","core/Error")