import{X as e,bt as t,et as n,gt as r,vt as i,yt as a}from"./BT3KAag_.js";var o=class extends Map{#e=new Map;#t=t(0);#n=t(0);#r=n||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return n===this.#r?t(e):a(e)}has(t){var n=this.#e,r=n.get(t);if(r===void 0)if(super.has(t))r=this.#i(0),n.set(t,r);else return e(this.#t),!1;return e(r),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(t){var n=this.#e,r=n.get(t);if(r===void 0)if(super.has(t))r=this.#i(0),n.set(t,r);else{e(this.#t);return}return e(r),super.get(t)}set(e,t){var n=this.#e,a=n.get(e),o=super.get(e),s=super.set(e,t),c=this.#t;if(a===void 0)a=this.#i(0),n.set(e,a),i(this.#n,super.size),r(c);else if(o!==t){r(a);var l=c.reactions===null?null:new Set(c.reactions);(l===null||!a.reactions?.every(e=>l.has(e)))&&r(c)}return s}delete(e){var t=this.#e,n=t.get(e),a=super.delete(e);return n!==void 0&&(t.delete(e),i(n,-1)),a&&(i(this.#n,super.size),r(this.#t)),a}clear(){if(super.size!==0){super.clear();var e=this.#e;i(this.#n,0);for(var t of e.values())i(t,-1);r(this.#t),e.clear()}}#a(){e(this.#t);var t=this.#e;if(this.#n.v!==t.size){for(var n of super.keys())if(!t.has(n)){var r=this.#i(0);t.set(n,r)}}for([,r]of this.#e)e(r)}keys(){return e(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return e(this.#n),super.size}};export{o as t};