/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{trackAccess as t}from"./accessorSupport/tracking.js";import{SimpleObservable as e}from"./accessorSupport/tracking/SimpleObservable.js";class s{constructor(t){this._observable=new e,this._notifyPending=!1,this._batchDepth=0,this._set=new Set(t)}get size(){return t(this._observable),this._set.size}add(t){const e=this._set.size;return this._set.add(t),this._set.size!==e&&this._notify(),this}batch(t){try{this._batchDepth++,t()}finally{this._batchDepth--,this._notifyPending&&0===this._batchDepth&&(this._notifyPending=!1,this._notify())}}clear(){this._set.size>0&&(this._set.clear(),this._notify())}delete(t){const e=this._set.delete(t);return e&&this._notify(),e}entries(){return t(this._observable),this._set.entries()}forEach(e,s){t(this._observable),this._set.forEach((t,i)=>e.call(s,t,i,this),s)}has(e){return t(this._observable),this._set.has(e)}keys(){return t(this._observable),this._set.keys()}values(){return t(this._observable),this._set.values()}union(e){return t(this._observable),this._set.union(e)}intersection(e){return t(this._observable),this._set.intersection(e)}difference(e){return t(this._observable),this._set.difference(e)}symmetricDifference(e){return t(this._observable),this._set.symmetricDifference(e)}isSubsetOf(e){return t(this._observable),this._set.isSubsetOf(e)}isSupersetOf(e){return t(this._observable),this._set.isSupersetOf(e)}isDisjointFrom(e){return t(this._observable),this._set.isDisjointFrom(e)}[Symbol.iterator](){return t(this._observable),this._set[Symbol.iterator]()}[Symbol.dispose](){this._observable.destroy()}get[Symbol.toStringTag](){return this._set[Symbol.toStringTag]}_notify(){this._batchDepth>0?this._notifyPending=!0:this._observable.notify()}}export{s as default};
