Insane number of adds to setup env and packages

This commit is contained in:
2022-11-07 17:45:54 -05:00
parent 62c2bb73a9
commit 55ecf095a9
3127 changed files with 485223 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
import { ContainerIterator } from "../../ContainerBase";
declare abstract class TreeIterator<K, V> extends ContainerIterator<K | [K, V]> {
pre: () => this;
next: () => this;
/**
* @description Get the sequential index of the iterator in the tree container.<br/>
* <strong>
* Note:
* </strong>
* This function only takes effect when the specified tree container `enableIndex = true`.
*/
get index(): number;
equals(obj: TreeIterator<K, V>): boolean;
}
export default TreeIterator;

View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "t", {
value: true
});
exports.default = void 0;
var _ContainerBase = require("../../ContainerBase");
class TreeIterator extends _ContainerBase.ContainerIterator {
constructor(t, e, r) {
super(r);
this.I = t;
this.S = e;
if (this.iteratorType === 0) {
this.pre = function() {
if (this.I === this.S.U) {
throw new RangeError("Tree iterator access denied!");
}
this.I = this.I.pre();
return this;
};
this.next = function() {
if (this.I === this.S) {
throw new RangeError("Tree iterator access denied!");
}
this.I = this.I.next();
return this;
};
} else {
this.pre = function() {
if (this.I === this.S.J) {
throw new RangeError("Tree iterator access denied!");
}
this.I = this.I.next();
return this;
};
this.next = function() {
if (this.I === this.S) {
throw new RangeError("Tree iterator access denied!");
}
this.I = this.I.pre();
return this;
};
}
}
get index() {
let t = this.I;
const e = this.S.tt;
if (t === this.S) {
if (e) {
return e.et - 1;
}
return 0;
}
let r = 0;
if (t.U) {
r += t.U.et;
}
while (t !== e) {
const e = t.tt;
if (t === e.J) {
r += 1;
if (e.U) {
r += e.U.et;
}
}
t = e;
}
return r;
}
equals(t) {
return this.I === t.I;
}
}
var _default = TreeIterator;
exports.default = _default;

View File

@@ -0,0 +1,36 @@
export declare class TreeNode<K, V> {
constructor(_key?: K, _value?: V);
/**
* @description Get the pre node.
* @return TreeNode about the pre node.
*/
pre(): TreeNode<K, V>;
/**
* @description Get the next node.
* @return TreeNode about the next node.
*/
next(): TreeNode<K, V>;
/**
* @description Rotate _left.
* @return TreeNode about moved to original position after rotation.
*/
rotateLeft(): TreeNode<K, V>;
/**
* @description Rotate _right.
* @return TreeNode about moved to original position after rotation.
*/
rotateRight(): TreeNode<K, V>;
}
export declare class TreeNodeEnableIndex<K, V> extends TreeNode<K, V> {
/**
* @description Rotate _left and do recount.
* @return TreeNode about moved to original position after rotation.
*/
rotateLeft(): TreeNodeEnableIndex<K, V>;
/**
* @description Rotate _right and do recount.
* @return TreeNode about moved to original position after rotation.
*/
rotateRight(): TreeNode<K, V>;
recount(): void;
}

View File

@@ -0,0 +1,113 @@
"use strict";
Object.defineProperty(exports, "t", {
value: true
});
exports.TreeNodeEnableIndex = exports.TreeNode = void 0;
class TreeNode {
constructor(e, t) {
this.se = 1;
this.T = undefined;
this.L = undefined;
this.U = undefined;
this.J = undefined;
this.tt = undefined;
this.T = e;
this.L = t;
}
pre() {
let e = this;
if (e.se === 1 && e.tt.tt === e) {
e = e.J;
} else if (e.U) {
e = e.U;
while (e.J) {
e = e.J;
}
} else {
let t = e.tt;
while (t.U === e) {
e = t;
t = e.tt;
}
e = t;
}
return e;
}
next() {
let e = this;
if (e.J) {
e = e.J;
while (e.U) {
e = e.U;
}
return e;
} else {
let t = e.tt;
while (t.J === e) {
e = t;
t = e.tt;
}
if (e.J !== t) {
return t;
} else return e;
}
}
rotateLeft() {
const e = this.tt;
const t = this.J;
const s = t.U;
if (e.tt === this) e.tt = t; else if (e.U === this) e.U = t; else e.J = t;
t.tt = e;
t.U = this;
this.tt = t;
this.J = s;
if (s) s.tt = this;
return t;
}
rotateRight() {
const e = this.tt;
const t = this.U;
const s = t.J;
if (e.tt === this) e.tt = t; else if (e.U === this) e.U = t; else e.J = t;
t.tt = e;
t.J = this;
this.tt = t;
this.U = s;
if (s) s.tt = this;
return t;
}
}
exports.TreeNode = TreeNode;
class TreeNodeEnableIndex extends TreeNode {
constructor() {
super(...arguments);
this.U = undefined;
this.J = undefined;
this.tt = undefined;
this.et = 1;
}
rotateLeft() {
const e = super.rotateLeft();
this.recount();
e.recount();
return e;
}
rotateRight() {
const e = super.rotateRight();
this.recount();
e.recount();
return e;
}
recount() {
this.et = 1;
if (this.U) this.et += this.U.et;
if (this.J) this.et += this.J.et;
}
}
exports.TreeNodeEnableIndex = TreeNodeEnableIndex;

View File

@@ -0,0 +1,55 @@
import type TreeIterator from './TreeIterator';
import { Container } from "../../ContainerBase";
declare abstract class TreeContainer<K, V> extends Container<K | [K, V]> {
/**
* @param cmp The compare function.
* @param enableIndex Whether to enable iterator indexing function.
*/
protected constructor(cmp?: (x: K, y: K) => number, enableIndex?: boolean);
/**
* @param _key The given _key you want to compare.
* @return An iterator to the first element not less than the given _key.
*/
abstract lowerBound(_key: K): TreeIterator<K, V>;
/**
* @param _key The given _key you want to compare.
* @return An iterator to the first element greater than the given _key.
*/
abstract upperBound(_key: K): TreeIterator<K, V>;
/**
* @param _key The given _key you want to compare.
* @return An iterator to the first element not greater than the given _key.
*/
abstract reverseLowerBound(_key: K): TreeIterator<K, V>;
/**
* @param _key The given _key you want to compare.
* @return An iterator to the first element less than the given _key.
*/
abstract reverseUpperBound(_key: K): TreeIterator<K, V>;
/**
* @description Union the other tree to self.
* @param other The other tree container you want to merge.
*/
abstract union(other: TreeContainer<K, V>): void;
clear(): void;
/**
* @description Update node's _key by iterator.
* @param iter The iterator you want to change.
* @param _key The _key you want to update.
* @return Boolean about if the modification is successful.
*/
updateKeyByIterator(iter: TreeIterator<K, V>, _key: K): boolean;
eraseElementByPos(pos: number): void;
/**
* @description Remove the element of the specified _key.
* @param _key The _key you want to remove.
*/
eraseElementByKey(_key: K): void;
eraseElementByIterator(iter: TreeIterator<K, V>): TreeIterator<K, V>;
/**
* @description Get the height of the tree.
* @return Number about the height of the RB-tree.
*/
getHeight(): number;
}
export default TreeContainer;

View File

@@ -0,0 +1,483 @@
"use strict";
Object.defineProperty(exports, "t", {
value: true
});
exports.default = void 0;
var _ContainerBase = require("../../ContainerBase");
var _TreeNode = require("./TreeNode");
class TreeContainer extends _ContainerBase.Container {
constructor(e = ((e, t) => {
if (e < t) return -1;
if (e > t) return 1;
return 0;
}), t = false) {
super();
this.X = undefined;
this.ie = (e, t) => {
if (e === undefined) return false;
const i = this.ie(e.U, t);
if (i) return true;
if (t(e)) return true;
return this.ie(e.J, t);
};
this.p = e;
if (t) {
this.ne = _TreeNode.TreeNodeEnableIndex;
this.ee = function(e, t, i) {
const s = this.he(e, t, i);
if (s) {
let e = s.tt;
while (e !== this.S) {
e.et += 1;
e = e.tt;
}
const t = this.fe(s);
if (t) {
const {parentNode: e, grandParent: i, curNode: s} = t;
e.recount();
i.recount();
s.recount();
}
}
};
this.ue = function(e) {
let t = this.le(e);
while (t !== this.S) {
t.et -= 1;
t = t.tt;
}
};
} else {
this.ne = _TreeNode.TreeNode;
this.ee = function(e, t, i) {
const s = this.he(e, t, i);
if (s) this.fe(s);
};
this.ue = this.le;
}
this.S = new this.ne;
}
W(e, t) {
let i;
while (e) {
const s = this.p(e.T, t);
if (s < 0) {
e = e.J;
} else if (s > 0) {
i = e;
e = e.U;
} else return e;
}
return i === undefined ? this.S : i;
}
Y(e, t) {
let i;
while (e) {
const s = this.p(e.T, t);
if (s <= 0) {
e = e.J;
} else {
i = e;
e = e.U;
}
}
return i === undefined ? this.S : i;
}
Z(e, t) {
let i;
while (e) {
const s = this.p(e.T, t);
if (s < 0) {
i = e;
e = e.J;
} else if (s > 0) {
e = e.U;
} else return e;
}
return i === undefined ? this.S : i;
}
$(e, t) {
let i;
while (e) {
const s = this.p(e.T, t);
if (s < 0) {
i = e;
e = e.J;
} else {
e = e.U;
}
}
return i === undefined ? this.S : i;
}
oe(e) {
while (true) {
const t = e.tt;
if (t === this.S) return;
if (e.se === 1) {
e.se = 0;
return;
}
if (e === t.U) {
const i = t.J;
if (i.se === 1) {
i.se = 0;
t.se = 1;
if (t === this.X) {
this.X = t.rotateLeft();
} else t.rotateLeft();
} else {
if (i.J && i.J.se === 1) {
i.se = t.se;
t.se = 0;
i.J.se = 0;
if (t === this.X) {
this.X = t.rotateLeft();
} else t.rotateLeft();
return;
} else if (i.U && i.U.se === 1) {
i.se = 1;
i.U.se = 0;
i.rotateRight();
} else {
i.se = 1;
e = t;
}
}
} else {
const i = t.U;
if (i.se === 1) {
i.se = 0;
t.se = 1;
if (t === this.X) {
this.X = t.rotateRight();
} else t.rotateRight();
} else {
if (i.U && i.U.se === 1) {
i.se = t.se;
t.se = 0;
i.U.se = 0;
if (t === this.X) {
this.X = t.rotateRight();
} else t.rotateRight();
return;
} else if (i.J && i.J.se === 1) {
i.se = 1;
i.J.se = 0;
i.rotateLeft();
} else {
i.se = 1;
e = t;
}
}
}
}
}
le(e) {
if (this.o === 1) {
this.clear();
return this.S;
}
let t = e;
while (t.U || t.J) {
if (t.J) {
t = t.J;
while (t.U) t = t.U;
} else {
t = t.U;
}
[e.T, t.T] = [ t.T, e.T ];
[e.L, t.L] = [ t.L, e.L ];
e = t;
}
if (this.S.U === t) {
this.S.U = t.tt;
} else if (this.S.J === t) {
this.S.J = t.tt;
}
this.oe(t);
const i = t.tt;
if (t === i.U) {
i.U = undefined;
} else i.J = undefined;
this.o -= 1;
this.X.se = 0;
return i;
}
fe(e) {
while (true) {
const t = e.tt;
if (t.se === 0) return;
const i = t.tt;
if (t === i.U) {
const s = i.J;
if (s && s.se === 1) {
s.se = t.se = 0;
if (i === this.X) return;
i.se = 1;
e = i;
continue;
} else if (e === t.J) {
e.se = 0;
if (e.U) e.U.tt = t;
if (e.J) e.J.tt = i;
t.J = e.U;
i.U = e.J;
e.U = t;
e.J = i;
if (i === this.X) {
this.X = e;
this.S.tt = e;
} else {
const t = i.tt;
if (t.U === i) {
t.U = e;
} else t.J = e;
}
e.tt = i.tt;
t.tt = e;
i.tt = e;
i.se = 1;
return {
parentNode: t,
grandParent: i,
curNode: e
};
} else {
t.se = 0;
if (i === this.X) {
this.X = i.rotateRight();
} else i.rotateRight();
i.se = 1;
}
} else {
const s = i.U;
if (s && s.se === 1) {
s.se = t.se = 0;
if (i === this.X) return;
i.se = 1;
e = i;
continue;
} else if (e === t.U) {
e.se = 0;
if (e.U) e.U.tt = i;
if (e.J) e.J.tt = t;
i.J = e.U;
t.U = e.J;
e.U = i;
e.J = t;
if (i === this.X) {
this.X = e;
this.S.tt = e;
} else {
const t = i.tt;
if (t.U === i) {
t.U = e;
} else t.J = e;
}
e.tt = i.tt;
t.tt = e;
i.tt = e;
i.se = 1;
return {
parentNode: t,
grandParent: i,
curNode: e
};
} else {
t.se = 0;
if (i === this.X) {
this.X = i.rotateLeft();
} else i.rotateLeft();
i.se = 1;
}
}
return;
}
}
he(e, t, i) {
if (this.X === undefined) {
this.o += 1;
this.X = new this.ne(e, t);
this.X.se = 0;
this.X.tt = this.S;
this.S.tt = this.X;
this.S.U = this.X;
this.S.J = this.X;
return;
}
let s;
const r = this.S.U;
const n = this.p(r.T, e);
if (n === 0) {
r.L = t;
return;
} else if (n > 0) {
r.U = new this.ne(e, t);
r.U.tt = r;
s = r.U;
this.S.U = s;
} else {
const r = this.S.J;
const n = this.p(r.T, e);
if (n === 0) {
r.L = t;
return;
} else if (n < 0) {
r.J = new this.ne(e, t);
r.J.tt = r;
s = r.J;
this.S.J = s;
} else {
if (i !== undefined) {
const r = i.I;
if (r !== this.S) {
const i = this.p(r.T, e);
if (i === 0) {
r.L = t;
return;
} else if (i > 0) {
const i = r.pre();
const n = this.p(i.T, e);
if (n === 0) {
i.L = t;
return;
} else if (n < 0) {
s = new this.ne(e, t);
if (i.J === undefined) {
i.J = s;
s.tt = i;
} else {
r.U = s;
s.tt = r;
}
}
}
}
}
if (s === undefined) {
s = this.X;
while (true) {
const i = this.p(s.T, e);
if (i > 0) {
if (s.U === undefined) {
s.U = new this.ne(e, t);
s.U.tt = s;
s = s.U;
break;
}
s = s.U;
} else if (i < 0) {
if (s.J === undefined) {
s.J = new this.ne(e, t);
s.J.tt = s;
s = s.J;
break;
}
s = s.J;
} else {
s.L = t;
return;
}
}
}
}
}
this.o += 1;
return s;
}
clear() {
this.o = 0;
this.X = undefined;
this.S.tt = undefined;
this.S.U = this.S.J = undefined;
}
updateKeyByIterator(e, t) {
const i = e.I;
if (i === this.S) {
throw new TypeError("Invalid iterator!");
}
if (this.o === 1) {
i.T = t;
return true;
}
if (i === this.S.U) {
if (this.p(i.next().T, t) > 0) {
i.T = t;
return true;
}
return false;
}
if (i === this.S.J) {
if (this.p(i.pre().T, t) < 0) {
i.T = t;
return true;
}
return false;
}
const s = i.pre().T;
if (this.p(s, t) >= 0) return false;
const r = i.next().T;
if (this.p(r, t) <= 0) return false;
i.T = t;
return true;
}
eraseElementByPos(e) {
if (e < 0 || e > this.o - 1) {
throw new RangeError;
}
let t = 0;
this.ie(this.X, (i => {
if (e === t) {
this.ue(i);
return true;
}
t += 1;
return false;
}));
}
re(e, t) {
while (e) {
const i = this.p(e.T, t);
if (i < 0) {
e = e.J;
} else if (i > 0) {
e = e.U;
} else return e;
}
return e;
}
eraseElementByKey(e) {
if (!this.o) return;
const t = this.re(this.X, e);
if (t === undefined) return;
this.ue(t);
}
eraseElementByIterator(e) {
const t = e.I;
if (t === this.S) {
throw new RangeError("Invalid iterator");
}
if (t.J === undefined) {
e = e.next();
}
this.ue(t);
return e;
}
getHeight() {
if (!this.o) return 0;
const traversal = e => {
if (!e) return 0;
return Math.max(traversal(e.U), traversal(e.J)) + 1;
};
return traversal(this.X);
}
}
var _default = TreeContainer;
exports.default = _default;

View File

@@ -0,0 +1,42 @@
import TreeContainer from './Base';
import TreeIterator from './Base/TreeIterator';
import { initContainer } from "../ContainerBase";
export declare class OrderedMapIterator<K, V> extends TreeIterator<K, V> {
get pointer(): [K, V];
copy(): OrderedMapIterator<K, V>;
}
declare class OrderedMap<K, V> extends TreeContainer<K, V> {
/**
* @param container The initialization container.
* @param cmp The compare function.
* @param enableIndex Whether to enable iterator indexing function.
*/
constructor(container?: initContainer<[K, V]>, cmp?: (x: K, y: K) => number, enableIndex?: boolean);
begin(): OrderedMapIterator<K, V>;
end(): OrderedMapIterator<K, V>;
rBegin(): OrderedMapIterator<K, V>;
rEnd(): OrderedMapIterator<K, V>;
front(): [K, V] | undefined;
back(): [K, V] | undefined;
forEach(callback: (element: [K, V], index: number) => void): void;
lowerBound(_key: K): OrderedMapIterator<K, V>;
upperBound(_key: K): OrderedMapIterator<K, V>;
reverseLowerBound(_key: K): OrderedMapIterator<K, V>;
reverseUpperBound(_key: K): OrderedMapIterator<K, V>;
/**
* @description Insert a _key-_value pair or set _value by the given _key.
* @param _key The _key want to insert.
* @param _value The _value want to set.
* @param hint You can give an iterator hint to improve insertion efficiency.
*/
setElement(_key: K, _value: V, hint?: OrderedMapIterator<K, V>): void;
find(_key: K): OrderedMapIterator<K, V>;
/**
* @description Get the _value of the element of the specified _key.
*/
getElementByKey(_key: K): V | undefined;
getElementByPos(pos: number): [K, V];
union(other: OrderedMap<K, V>): void;
[Symbol.iterator](): Generator<[K, V], void, undefined>;
}
export default OrderedMap;

View File

@@ -0,0 +1,136 @@
"use strict";
Object.defineProperty(exports, "t", {
value: true
});
exports.default = exports.OrderedMapIterator = void 0;
var _Base = _interopRequireDefault(require("./Base"));
var _TreeIterator = _interopRequireDefault(require("./Base/TreeIterator"));
function _interopRequireDefault(e) {
return e && e.t ? e : {
default: e
};
}
class OrderedMapIterator extends _TreeIterator.default {
get pointer() {
if (this.I === this.S) {
throw new RangeError("OrderedMap iterator access denied");
}
return new Proxy([], {
get: (e, r) => {
if (r === "0") return this.I.T; else if (r === "1") return this.I.L;
},
set: (e, r, t) => {
if (r !== "1") {
throw new TypeError("props must be 1");
}
this.I.L = t;
return true;
}
});
}
copy() {
return new OrderedMapIterator(this.I, this.S, this.iteratorType);
}
}
exports.OrderedMapIterator = OrderedMapIterator;
class OrderedMap extends _Base.default {
constructor(e = [], r, t) {
super(r, t);
this.K = function*(e) {
if (e === undefined) return;
yield* this.K(e.U);
yield [ e.T, e.L ];
yield* this.K(e.J);
};
e.forEach((([e, r]) => this.setElement(e, r)));
}
begin() {
return new OrderedMapIterator(this.S.U || this.S, this.S);
}
end() {
return new OrderedMapIterator(this.S, this.S);
}
rBegin() {
return new OrderedMapIterator(this.S.J || this.S, this.S, 1);
}
rEnd() {
return new OrderedMapIterator(this.S, this.S, 1);
}
front() {
if (!this.o) return undefined;
const e = this.S.U;
return [ e.T, e.L ];
}
back() {
if (!this.o) return undefined;
const e = this.S.J;
return [ e.T, e.L ];
}
forEach(e) {
let r = 0;
for (const t of this) e(t, r++);
}
lowerBound(e) {
const r = this.W(this.X, e);
return new OrderedMapIterator(r, this.S);
}
upperBound(e) {
const r = this.Y(this.X, e);
return new OrderedMapIterator(r, this.S);
}
reverseLowerBound(e) {
const r = this.Z(this.X, e);
return new OrderedMapIterator(r, this.S);
}
reverseUpperBound(e) {
const r = this.$(this.X, e);
return new OrderedMapIterator(r, this.S);
}
setElement(e, r, t) {
this.ee(e, r, t);
}
find(e) {
const r = this.re(this.X, e);
if (r !== undefined) {
return new OrderedMapIterator(r, this.S);
}
return this.end();
}
getElementByKey(e) {
const r = this.re(this.X, e);
return r ? r.L : undefined;
}
getElementByPos(e) {
if (e < 0 || e > this.o - 1) {
throw new RangeError;
}
let r;
let t = 0;
for (const s of this) {
if (t === e) {
r = s;
break;
}
t += 1;
}
return r;
}
union(e) {
e.forEach((([e, r]) => this.setElement(e, r)));
}
[Symbol.iterator]() {
return this.K(this.X);
}
}
var _default = OrderedMap;
exports.default = _default;

View File

@@ -0,0 +1,37 @@
import TreeContainer from './Base';
import TreeIterator from './Base/TreeIterator';
import { initContainer } from "../ContainerBase";
export declare class OrderedSetIterator<K> extends TreeIterator<K, undefined> {
get pointer(): K;
copy(): OrderedSetIterator<K>;
}
declare class OrderedSet<K> extends TreeContainer<K, undefined> {
/**
* @param container The initialization container.
* @param cmp The compare function.
* @param enableIndex Whether to enable iterator indexing function.
*/
constructor(container?: initContainer<K>, cmp?: (x: K, y: K) => number, enableIndex?: boolean);
begin(): OrderedSetIterator<K>;
end(): OrderedSetIterator<K>;
rBegin(): OrderedSetIterator<K>;
rEnd(): OrderedSetIterator<K>;
front(): K | undefined;
back(): K | undefined;
forEach(callback: (element: K, index: number) => void): void;
getElementByPos(pos: number): K;
/**
* @description Insert element to set.
* @param _key The _key want to insert.
* @param hint You can give an iterator hint to improve insertion efficiency.
*/
insert(_key: K, hint?: OrderedSetIterator<K>): void;
find(element: K): OrderedSetIterator<K>;
lowerBound(_key: K): OrderedSetIterator<K>;
upperBound(_key: K): OrderedSetIterator<K>;
reverseLowerBound(_key: K): OrderedSetIterator<K>;
reverseUpperBound(_key: K): OrderedSetIterator<K>;
union(other: OrderedSet<K>): void;
[Symbol.iterator](): Generator<K, void, undefined>;
}
export default OrderedSet;

View File

@@ -0,0 +1,117 @@
"use strict";
Object.defineProperty(exports, "t", {
value: true
});
exports.default = exports.OrderedSetIterator = void 0;
var _Base = _interopRequireDefault(require("./Base"));
var _TreeIterator = _interopRequireDefault(require("./Base/TreeIterator"));
function _interopRequireDefault(e) {
return e && e.t ? e : {
default: e
};
}
class OrderedSetIterator extends _TreeIterator.default {
get pointer() {
if (this.I === this.S) {
throw new RangeError("OrderedSet iterator access denied!");
}
return this.I.T;
}
copy() {
return new OrderedSetIterator(this.I, this.S, this.iteratorType);
}
}
exports.OrderedSetIterator = OrderedSetIterator;
class OrderedSet extends _Base.default {
constructor(e = [], t, r) {
super(t, r);
this.K = function*(e) {
if (e === undefined) return;
yield* this.K(e.U);
yield e.T;
yield* this.K(e.J);
};
e.forEach((e => this.insert(e)));
}
begin() {
return new OrderedSetIterator(this.S.U || this.S, this.S);
}
end() {
return new OrderedSetIterator(this.S, this.S);
}
rBegin() {
return new OrderedSetIterator(this.S.J || this.S, this.S, 1);
}
rEnd() {
return new OrderedSetIterator(this.S, this.S, 1);
}
front() {
return this.S.U ? this.S.U.T : undefined;
}
back() {
return this.S.J ? this.S.J.T : undefined;
}
forEach(e) {
let t = 0;
for (const r of this) e(r, t++);
}
getElementByPos(e) {
if (e < 0 || e > this.o - 1) {
throw new RangeError;
}
let t;
let r = 0;
for (const i of this) {
if (r === e) {
t = i;
break;
}
r += 1;
}
return t;
}
insert(e, t) {
this.ee(e, undefined, t);
}
find(e) {
const t = this.re(this.X, e);
if (t !== undefined) {
return new OrderedSetIterator(t, this.S);
}
return this.end();
}
lowerBound(e) {
const t = this.W(this.X, e);
return new OrderedSetIterator(t, this.S);
}
upperBound(e) {
const t = this.Y(this.X, e);
return new OrderedSetIterator(t, this.S);
}
reverseLowerBound(e) {
const t = this.Z(this.X, e);
return new OrderedSetIterator(t, this.S);
}
reverseUpperBound(e) {
const t = this.$(this.X, e);
return new OrderedSetIterator(t, this.S);
}
union(e) {
e.forEach((e => this.insert(e)));
}
[Symbol.iterator]() {
return this.K(this.X);
}
}
var _default = OrderedSet;
exports.default = _default;