"use strict";{const t={},e=!0,r=!1;t.RBnode=function(t){this.tree=t,this.right=this.tree.sentinel,this.left=this.tree.sentinel,this.parent=null,this.color=!1,this.key=null},t.RedBlackSet=function(e){this.size=0,this.sentinel=new t.RBnode(this),this.sentinel.color=r,this.root=this.sentinel,this.root.parent=this.sentinel,this.compare=e||this.default_compare},t.RedBlackSet.prototype.default_compare=function(t,e){return t0){var e=this.get_(t);if(e==this.sentinel)return null;if(e.right!=this.sentinel)return this.min(e.right).key;for(var r=e.parent;r!=this.sentinel&&e==r.right;)e=r,r=r.parent;return r!=this.sentinel?r.key:null}return null},t.RedBlackSet.prototype.predecessor=function(t){if(this.size>0){var e=this.get_(t);if(e==this.sentinel)return null;if(e.left!=this.sentinel)return this.max(e.left).key;for(var r=e.parent;r!=this.sentinel&&e==r.left;)e=r,r=r.parent;return r!=this.sentinel?r.key:null}return null},t.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key},t.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key},t.RedBlackSet.prototype.get_=function(t){for(var e=this.root;e!=this.sentinel&&0!=this.compare(e.key,t);)e=this.compare(t,e.key)<0?e.left:e.right;return e},t.RedBlackSet.prototype.contains=function(t){return null!=this.get_(t).key},t.RedBlackSet.prototype.getValues=function(){var t=[];return this.forEach((function(e){t.push(e)})),t},t.RedBlackSet.prototype.insertAll=function(e){if("array"==t.typeOf(e))for(var r=0;rr)return!1;var i=0;if(this.isEmpty())return!0;for(var n=this.min(this.root);n!=this.sentinel;n=this.successor_(n))t.contains.call(e,e,n.key)&&i++;return i==this.getCount()},t.RedBlackSet.prototype.intersection=function(e){var r=new t.RedBlackSet(this.compare);if(this.isEmpty())return r;for(var i=this.min(this.root);i!=this.sentinel;i=this.successor_(i))e.contains.call(e,i.key,i.key,this)&&r.insert(i.key);return r},self.RedBlackSet=class{constructor(e){this._rbSet=new t.RedBlackSet(e)}Add(t){this._rbSet.insert(t)}Remove(t){this._rbSet.remove(t)}Has(t){return this._rbSet.contains(t)}Clear(){this._rbSet.clear()}toArray(){return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()}IsEmpty(){return this._rbSet.isEmpty()}ForEach(t){this._rbSet.forEach(t)}Front(){if(this.IsEmpty())throw new Error("empty set");const t=this._rbSet;return t.min(t.root).key}Shift(){if(this.IsEmpty())throw new Error("empty set");const t=this.Front();return this.Remove(t),t}*values(){if(this.IsEmpty())return;const t=this._rbSet;for(let e=t.min(t.root);e!=t.sentinel;e=t.successor_(e))yield e.key}[Symbol.iterator](){return this.values()}}}