/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../core/Collection","../../chunks/_rollupPluginBabelHelpers","../../core/has","../../core/Error","../../core/Logger","../../core/accessorSupport/watch","../../core/accessorSupport/trackingUtils"],(function(e,r,t,n,o,s,c,i){"use strict";const l=new r,a=new WeakMap;function u(e){h(e)&&l.push(e)}function f(e){h(e)&&l.includes(e)&&l.remove(e)}function h(e){return e&&"object"==typeof e&&"refreshInterval"in e&&"refresh"in e}function v(e,r){return Number.isFinite(e)&&Number.isFinite(r)?r<=0?e:v(r,e%r):0}let g=0,p=0;function d(){const e=Date.now();for(const t of l)if(t.refreshInterval){var r;e-(null!=(r=a.get(t))?r:0)+5>=6e4*t.refreshInterval&&(a.set(t,e),t.refresh(e))}}i.autorun((()=>{const e=Date.now();let r=0;for(const t of l)r=v(Math.round(6e4*t.refreshInterval),r),t.refreshInterval?a.get(t)||a.set(t,e):a.delete(t);if(r!==p){if(p=r,clearInterval(g),0===p)return void(g=0);g=setInterval(d,p)}}));const I={get hasRefreshTimer(){return g>0},get tickInterval(){return p},forceRefresh(){d()},hasLayer:e=>h(e)&&l.includes(e),clear(){for(const e of l)a.delete(e);l.removeAll()}};e.registerLayer=u,e.test=I,e.unregisterLayer=f,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
