class e{#e;constructor(e){if(this.#e=new t,e)for(const t of e)this.add(t)}add(e){return this.#e.set(e,0),this}delete(e){return this.#e.delete(e)}clear(){this.#e.clear()}slice(t){const s=new e;return s.#e=this.#e.slice(t),s}has(e){return this.#e.has(e)}hasAll(e){return this.#e.hasAll(e)}hasAny(e){return this.#e.hasAny(e)}at(e){return this.#e.at(e)?.[0]}get(e){return this.#e.get(e)?.[0]}indexOf(e){return this.#e.indexOf(e)}get size(){return this.#e.size}[Symbol.iterator](){return this.#e.ranges()}keys(){return this.#e.keys()}}class t{#t;constructor(e){if(this.#t=[],e)for(const[t,s]of e)this.set(t,s)}set(e,t){e=s(e),this.#s(e);const i=~this.indexOf(e[0]);this.#t.splice(i,0,[e,t]);const r=i+1;return r=h?this.#t.splice(e,1):i[0]=s+1;else if(s>=h)i[1]=t-1;else{const n=[s+1,h];i[1]=t-1,this.#t.splice(e+1,0,[n,r])}}clear(){this.#t=[]}slice(e){e=s(e);const r=new t,n=this.#r(e);if(!n)return r;const[h,o]=n,a=Array.from({length:o-h+1},((e,t)=>i(this.#t[h+t]))),[f,c]=e,[l]=a[0];l[0]=Math.max(f,l[0]);const[u]=a.at(-1);return u[1]=Math.min(c,u[1]),r.#t=a,r}has(e){return this.indexOf(e)>=0}hasAll(e){const[t,i]=s(e),r=this.indexOf(t);if(r<0)return!1;const n=t===i?r:this.indexOf(i);if(n<0)return!1;for(let e=r+1;e<=n;e++){const[[,t]]=this.#t[e-1],[[s]]=this.#t[e];if(t+1!==s)return!1}return!0}hasAny(e){const[t,i]=s(e),r=this.indexOf(t);if(r>=0)return!0;const n=t===i?r:this.indexOf(i);return n>=0||r!==n}at(e){const t=this.#t.at(e);return t&&i(t)}get(e){const t=this.indexOf(e);return t>=0?i(this.#t[t]):void 0}#r([e,t]){let s=this.indexOf(e),i=e===t?s:this.indexOf(t);if(s<0){if(s===i)return;s=~s}return i<0&&(i=~i-1),[s,i]}indexOf(e){let t=0,s=this.size-1;for(;t<=s;){const i=t+(s-t>>>1),[[r,n]]=this.#t[i];if(e>n)t=i+1;else{if(!(e{const[t,s]=e;if(!Number.isSafeInteger(t)||!Number.isSafeInteger(s)||t>s)throw new TypeError(`[${t}, ${s}] is not integers start <= end`);return[t,s]},i=([e,t])=>[r(e),t],r=([e,t])=>[e,t];exports.SortedRangeMap=t,exports.SortedRangeSet=e;