Socket
Socket
Sign inDemoInstall

@js-sdsl/ordered-map

Package Overview
Dependencies
0
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.4.1 to 4.4.2

10

CHANGELOG.md

@@ -7,2 +7,12 @@ # Change Log

## [4.4.2] - 2023.07.21
### Fixed
- The pointer of Adapter container's iterator cannot as array to be deconstructed.
### Added
- Add `isAccessible` function to iterators for iterable containers.
## [4.4.1] - 2023.06.05

@@ -9,0 +19,0 @@

2

dist/cjs/index.d.ts

@@ -73,2 +73,3 @@ /**

abstract copy(): ContainerIterator<T>;
abstract isAccessible(): boolean;
}

@@ -223,2 +224,3 @@ declare abstract class Base {

get index(): number;
isAccessible(): boolean;
// @ts-ignore

@@ -225,0 +227,0 @@ pre(): this;

52

dist/cjs/index.js

@@ -150,6 +150,6 @@ "use strict";

this.v = undefined;
this.N = t;
this.A = t;
this.enableIndex = e;
this.A = e ? TreeNodeEnableIndex : TreeNode;
this.C = new this.A;
this.N = e ? TreeNodeEnableIndex : TreeNode;
this.C = new this.N;
}

@@ -159,3 +159,3 @@ R(t, e) {

while (t) {
const i = this.N(t.u, e);
const i = this.A(t.u, e);
if (i < 0) {

@@ -173,3 +173,3 @@ t = t.h;

while (t) {
const i = this.N(t.u, e);
const i = this.A(t.u, e);
if (i <= 0) {

@@ -187,3 +187,3 @@ t = t.h;

while (t) {
const i = this.N(t.u, e);
const i = this.A(t.u, e);
if (i < 0) {

@@ -201,3 +201,3 @@ s = t;

while (t) {
const i = this.N(t.u, e);
const i = this.A(t.u, e);
if (i < 0) {

@@ -436,3 +436,3 @@ s = t;

this.m += 1;
this.v = new this.A(t, e, 0);
this.v = new this.N(t, e, 0);
this.v.o = this.C;

@@ -444,3 +444,3 @@ this.C.o = this.C.i = this.C.h = this.v;

const r = this.C.i;
const n = this.N(r.u, t);
const n = this.A(r.u, t);
if (n === 0) {

@@ -450,3 +450,3 @@ r.l = e;

} else if (n > 0) {
r.i = new this.A(t, e);
r.i = new this.N(t, e);
r.i.o = r;

@@ -457,3 +457,3 @@ i = r.i;

const r = this.C.h;
const n = this.N(r.u, t);
const n = this.A(r.u, t);
if (n === 0) {

@@ -463,3 +463,3 @@ r.l = e;

} else if (n < 0) {
r.h = new this.A(t, e);
r.h = new this.N(t, e);
r.h.o = r;

@@ -472,3 +472,3 @@ i = r.h;

if (r !== this.C) {
const s = this.N(r.u, t);
const s = this.A(r.u, t);
if (s === 0) {

@@ -479,3 +479,3 @@ r.l = e;

const s = r.I();
const n = this.N(s.u, t);
const n = this.A(s.u, t);
if (n === 0) {

@@ -485,3 +485,3 @@ s.l = e;

} else if (n < 0) {
i = new this.A(t, e);
i = new this.N(t, e);
if (s.h === undefined) {

@@ -501,6 +501,6 @@ s.h = i;

while (true) {
const s = this.N(i.u, t);
const s = this.A(i.u, t);
if (s > 0) {
if (i.i === undefined) {
i.i = new this.A(t, e);
i.i = new this.N(t, e);
i.i.o = i;

@@ -513,3 +513,3 @@ i = i.i;

if (i.h === undefined) {
i.h = new this.A(t, e);
i.h = new this.N(t, e);
i.h.o = i;

@@ -541,3 +541,3 @@ i = i.h;

while (t) {
const s = this.N(t.u, e);
const s = this.A(t.u, e);
if (s < 0) {

@@ -568,3 +568,3 @@ t = t.h;

if (s === this.C.i) {
if (this.N(i, e) > 0) {
if (this.A(i, e) > 0) {
s.u = e;

@@ -577,3 +577,3 @@ return true;

if (s === this.C.h) {
if (this.N(r, e) < 0) {
if (this.A(r, e) < 0) {
s.u = e;

@@ -584,3 +584,3 @@ return true;

}
if (this.N(r, e) >= 0 || this.N(i, e) <= 0) return false;
if (this.A(r, e) >= 0 || this.A(i, e) <= 0) return false;
s.u = e;

@@ -691,2 +691,5 @@ return true;

}
isAccessible() {
return this.T !== this.C;
}
}

@@ -707,6 +710,9 @@

if (s === "0") return t.T.u; else if (s === "1") return t.T.l;
e[0] = t.T.u;
e[1] = t.T.l;
return e[s];
},
set(e, s, i) {
if (s !== "1") {
throw new TypeError("props must be 1");
throw new TypeError("prop must be 1");
}

@@ -713,0 +719,0 @@ t.T.l = i;

@@ -73,2 +73,3 @@ /**

abstract copy(): ContainerIterator<T>;
abstract isAccessible(): boolean;
}

@@ -223,2 +224,3 @@ declare abstract class Base {

get index(): number;
isAccessible(): boolean;
// @ts-ignore

@@ -225,0 +227,0 @@ pre(): this;

@@ -111,2 +111,7 @@ var extendStatics = function(e, r) {

typeof SuppressedError === "function" ? SuppressedError : function(e, r, t) {
var i = new Error(t);
return i.name = "SuppressedError", i.error = e, i.suppressed = r, i;
};
var TreeNode = function() {

@@ -286,8 +291,8 @@ function TreeNode(e, r, t) {

i.enableIndex = t;
i.A = t ? TreeNodeEnableIndex : TreeNode;
i.m = new i.A;
i.S = t ? TreeNodeEnableIndex : TreeNode;
i.A = new i.S;
return i;
}
TreeContainer.prototype.S = function(e, r) {
var t = this.m;
TreeContainer.prototype.m = function(e, r) {
var t = this.A;
while (e) {

@@ -305,3 +310,3 @@ var i = this.g(e.u, r);

TreeContainer.prototype.B = function(e, r) {
var t = this.m;
var t = this.A;
while (e) {

@@ -319,3 +324,3 @@ var i = this.g(e.u, r);

TreeContainer.prototype.j = function(e, r) {
var t = this.m;
var t = this.A;
while (e) {

@@ -333,3 +338,3 @@ var i = this.g(e.u, r);

TreeContainer.prototype.k = function(e, r) {
var t = this.m;
var t = this.A;
while (e) {

@@ -349,3 +354,3 @@ var i = this.g(e.u, r);

var r = e.h;
if (r === this.m) return;
if (r === this.A) return;
if (e.l === 1) {

@@ -431,6 +436,6 @@ e.l = 0;

}
if (this.m.t === r) {
this.m.t = r.h;
} else if (this.m.i === r) {
this.m.i = r.h;
if (this.A.t === r) {
this.A.t = r.h;
} else if (this.A.i === r) {
this.A.i = r.h;
}

@@ -445,3 +450,3 @@ this.R(r);

if (this.enableIndex) {
while (n !== this.m) {
while (n !== this.A) {
n.O -= 1;

@@ -501,3 +506,3 @@ n = n.h;

this.N = e;
this.m.h = e;
this.A.h = e;
} else {

@@ -543,3 +548,3 @@ var n = t.h;

this.N = e;
this.m.h = e;
this.A.h = e;
} else {

@@ -575,9 +580,9 @@ var n = t.h;

this._ += 1;
this.N = new this.A(e, r, 0);
this.N.h = this.m;
this.m.h = this.m.t = this.m.i = this.N;
this.N = new this.S(e, r, 0);
this.N.h = this.A;
this.A.h = this.A.t = this.A.i = this.N;
return this._;
}
var i;
var n = this.m.t;
var n = this.A.t;
var s = this.g(n.u, e);

@@ -588,8 +593,8 @@ if (s === 0) {

} else if (s > 0) {
n.t = new this.A(e, r);
n.t = new this.S(e, r);
n.t.h = n;
i = n.t;
this.m.t = i;
this.A.t = i;
} else {
var h = this.m.i;
var h = this.A.i;
var a = this.g(h.u, e);

@@ -600,10 +605,10 @@ if (a === 0) {

} else if (a < 0) {
h.i = new this.A(e, r);
h.i = new this.S(e, r);
h.i.h = h;
i = h.i;
this.m.i = i;
this.A.i = i;
} else {
if (t !== undefined) {
var u = t.C;
if (u !== this.m) {
if (u !== this.A) {
var f = this.g(u.u, e);

@@ -620,3 +625,3 @@ if (f === 0) {

} else if (d < 0) {
i = new this.A(e, r);
i = new this.S(e, r);
if (o.i === undefined) {

@@ -639,3 +644,3 @@ o.i = i;

if (i.t === undefined) {
i.t = new this.A(e, r);
i.t = new this.S(e, r);
i.t.h = i;

@@ -648,3 +653,3 @@ i = i.t;

if (i.i === undefined) {
i.i = new this.A(e, r);
i.i = new this.S(e, r);
i.i.h = i;

@@ -665,3 +670,3 @@ i = i.i;

var l = i.h;
while (l !== this.m) {
while (l !== this.A) {
l.O += 1;

@@ -684,3 +689,3 @@ l = l.h;

}
return e || this.m;
return e || this.A;
};

@@ -690,8 +695,8 @@ TreeContainer.prototype.clear = function() {

this.N = undefined;
this.m.h = undefined;
this.m.t = this.m.i = undefined;
this.A.h = undefined;
this.A.t = this.A.i = undefined;
};
TreeContainer.prototype.updateKeyByIterator = function(e, r) {
var t = e.C;
if (t === this.m) {
if (t === this.A) {
throwIteratorAccessError();

@@ -704,3 +709,3 @@ }

var i = t.p().u;
if (t === this.m.t) {
if (t === this.A.t) {
if (this.g(i, r) > 0) {

@@ -713,3 +718,3 @@ t.u = r;

var n = t.v().u;
if (t === this.m.i) {
if (t === this.A.i) {
if (this.g(n, r) < 0) {

@@ -736,3 +741,3 @@ t.u = r;

var r = this.F(this.N, e);
if (r === this.m) return false;
if (r === this.A) return false;
this.G(r);

@@ -743,3 +748,3 @@ return true;

var r = e.C;
if (r === this.m) {
if (r === this.A) {
throwIteratorAccessError();

@@ -773,6 +778,6 @@ }

n.C = r;
n.m = t;
n.A = t;
if (n.iteratorType === 0) {
n.pre = function() {
if (this.C === this.m.t) {
if (this.C === this.A.t) {
throwIteratorAccessError();

@@ -784,3 +789,3 @@ }

n.next = function() {
if (this.C === this.m) {
if (this.C === this.A) {
throwIteratorAccessError();

@@ -793,3 +798,3 @@ }

n.pre = function() {
if (this.C === this.m.i) {
if (this.C === this.A.i) {
throwIteratorAccessError();

@@ -801,3 +806,3 @@ }

n.next = function() {
if (this.C === this.m) {
if (this.C === this.A) {
throwIteratorAccessError();

@@ -814,4 +819,4 @@ }

var e = this.C;
var r = this.m.h;
if (e === this.m) {
var r = this.A.h;
if (e === this.A) {
if (r) {

@@ -841,2 +846,5 @@ return r.O - 1;

});
TreeIterator.prototype.isAccessible = function() {
return this.C !== this.A;
};
return TreeIterator;

@@ -854,3 +862,3 @@ }(ContainerIterator);

get: function() {
if (this.C === this.m) {
if (this.C === this.A) {
throwIteratorAccessError();

@@ -862,6 +870,9 @@ }

if (t === "0") return e.C.u; else if (t === "1") return e.C.o;
r[0] = e.C.u;
r[1] = e.C.o;
return r[t];
},
set: function(r, t, i) {
if (t !== "1") {
throw new TypeError("props must be 1");
throw new TypeError("prop must be 1");
}

@@ -877,3 +888,3 @@ e.C.o = i;

OrderedMapIterator.prototype.copy = function() {
return new OrderedMapIterator(this.C, this.m, this.container, this.iteratorType);
return new OrderedMapIterator(this.C, this.A, this.container, this.iteratorType);
};

@@ -897,16 +908,16 @@ return OrderedMapIterator;

OrderedMap.prototype.begin = function() {
return new OrderedMapIterator(this.m.t || this.m, this.m, this);
return new OrderedMapIterator(this.A.t || this.A, this.A, this);
};
OrderedMap.prototype.end = function() {
return new OrderedMapIterator(this.m, this.m, this);
return new OrderedMapIterator(this.A, this.A, this);
};
OrderedMap.prototype.rBegin = function() {
return new OrderedMapIterator(this.m.i || this.m, this.m, this, 1);
return new OrderedMapIterator(this.A.i || this.A, this.A, this, 1);
};
OrderedMap.prototype.rEnd = function() {
return new OrderedMapIterator(this.m, this.m, this, 1);
return new OrderedMapIterator(this.A, this.A, this, 1);
};
OrderedMap.prototype.front = function() {
if (this._ === 0) return;
var e = this.m.t;
var e = this.A.t;
return [ e.u, e.o ];

@@ -916,20 +927,20 @@ };

if (this._ === 0) return;
var e = this.m.i;
var e = this.A.i;
return [ e.u, e.o ];
};
OrderedMap.prototype.lowerBound = function(e) {
var r = this.S(this.N, e);
return new OrderedMapIterator(r, this.m, this);
var r = this.m(this.N, e);
return new OrderedMapIterator(r, this.A, this);
};
OrderedMap.prototype.upperBound = function(e) {
var r = this.B(this.N, e);
return new OrderedMapIterator(r, this.m, this);
return new OrderedMapIterator(r, this.A, this);
};
OrderedMap.prototype.reverseLowerBound = function(e) {
var r = this.j(this.N, e);
return new OrderedMapIterator(r, this.m, this);
return new OrderedMapIterator(r, this.A, this);
};
OrderedMap.prototype.reverseUpperBound = function(e) {
var r = this.k(this.N, e);
return new OrderedMapIterator(r, this.m, this);
return new OrderedMapIterator(r, this.A, this);
};

@@ -953,3 +964,3 @@ OrderedMap.prototype.forEach = function(e) {

var r = this.F(this.N, e);
return new OrderedMapIterator(r, this.m, this);
return new OrderedMapIterator(r, this.A, this);
};

@@ -956,0 +967,0 @@ OrderedMap.prototype.getElementByKey = function(e) {

/*!
* @js-sdsl/ordered-map v4.4.1
* @js-sdsl/ordered-map v4.4.2
* https://github.com/js-sdsl/js-sdsl

@@ -28,3 +28,3 @@ * (c) 2021-present ZLY201 <zilongyao1366@gmail.com>

***************************************************************************** */
/* global Reflect, Promise */
/* global Reflect, Promise, SuppressedError, Symbol */

@@ -137,2 +137,6 @@ var extendStatics = function (d, b) {

}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};

@@ -969,2 +973,5 @@ var TreeNode = /** @class */function () {

});
TreeIterator.prototype.isAccessible = function () {
return this._node !== this._header;
};
return TreeIterator;

@@ -987,8 +994,11 @@ }(ContainerIterator);

return new Proxy([], {
get: function (_, props) {
if (props === '0') return self._node._key;else if (props === '1') return self._node._value;
get: function (target, prop) {
if (prop === '0') return self._node._key;else if (prop === '1') return self._node._value;
target[0] = self._node._key;
target[1] = self._node._value;
return target[prop];
},
set: function (_, props, newValue) {
if (props !== '1') {
throw new TypeError('props must be 1');
set: function (_, prop, newValue) {
if (prop !== '1') {
throw new TypeError('prop must be 1');
}

@@ -995,0 +1005,0 @@ self._node._value = newValue;

/*!
* @js-sdsl/ordered-map v4.4.1
* @js-sdsl/ordered-map v4.4.2
* https://github.com/js-sdsl/js-sdsl

@@ -7,3 +7,3 @@ * (c) 2021-present ZLY201 <zilongyao1366@gmail.com>

*/
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).sdsl={})}(this,function(t){"use strict";var r=function(t,i){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,i){t.__proto__=i}:function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])}))(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function e(){this.constructor=t}r(t,i),t.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e)}function o(r,n){var o,s,h,u={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(e){return function(t){var i=[e,t];if(o)throw new TypeError("Generator is already executing.");for(;u=f&&i[f=0]?0:u;)try{if(o=1,s&&(h=2&i[0]?s.return:i[0]?s.throw||((h=s.return)&&h.call(s),0):s.next)&&!(h=h.call(s,i[1])).done)return h;switch(s=0,(i=h?[2&i[0],h.value]:i)[0]){case 0:case 1:h=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,s=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(h=0<(h=u.trys).length&&h[h.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!h||i[1]>h[0]&&i[1]<h[3]))u.label=i[1];else if(6===i[0]&&u.label<h[1])u.label=h[1],h=i;else{if(!(h&&u.label<h[2])){h[2]&&u.ops.pop(),u.trys.pop();continue}u.label=h[2],u.ops.push(i)}}i=n.call(r,u)}catch(t){i=[6,t],s=0}finally{o=h=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}e.prototype.v=function(){var t=this,i=t.h.h===t;if(i&&1===t.l)t=t.i;else if(t.t)for(t=t.t;t.i;)t=t.i;else{if(i)return t.h;for(var e=t.h;e.t===t;)e=(t=e).h;t=e}return t},e.prototype.p=function(){var t=this;if(t.i){for(t=t.i;t.t;)t=t.t;return t}for(var i=t.h;i.i===t;)i=(t=i).h;return t.i!==i?i:t},e.prototype.T=function(){var t=this.h,i=this.i,e=i.t;return t.h===this?t.h=i:t.t===this?t.t=i:t.i=i,i.h=t,(i.t=this).h=i,(this.i=e)&&(e.h=this),i},e.prototype.O=function(){var t=this.h,i=this.t,e=i.i;return t.h===this?t.h=i:t.t===this?t.t=i:t.i=i,i.h=t,(i.i=this).h=i,(this.t=e)&&(e.h=this),i};var n=e;function e(t,i,e){void 0===e&&(e=1),this.t=void 0,this.i=void 0,this.h=void 0,this.u=t,this.o=i,this.l=e}i(u,s=n),u.prototype.T=function(){var t=s.prototype.T.call(this);return this.I(),t.I(),t},u.prototype.O=function(){var t=s.prototype.O.call(this);return this.I(),t.I(),t},u.prototype.I=function(){this._=1,this.t&&(this._+=this.t._),this.i&&(this._+=this.i._)};var s,h=u;function u(){var t=null!==s&&s.apply(this,arguments)||this;return t._=1,t}p.prototype.equals=function(t){return this.M===t.M};var f=p;function p(t){this.iteratorType=t=void 0===t?0:t}function l(){this.C=0}Object.defineProperty(l.prototype,"length",{get:function(){return this.C},enumerable:!1,configurable:!0}),l.prototype.size=function(){return this.C},l.prototype.empty=function(){return 0===this.C};i(y,a=l);var a,c=y;function y(){return null!==a&&a.apply(this,arguments)||this}function v(){throw new RangeError("Iterator access denied!")}i(g,d=c),g.prototype.j=function(t,i){for(var e=this.A;t;){var r=this.N(t.u,i);if(r<0)t=t.i;else{if(!(0<r))return t;t=(e=t).t}}return e},g.prototype.k=function(t,i){for(var e=this.A;t;)t=this.N(t.u,i)<=0?t.i:(e=t).t;return e},g.prototype.B=function(t,i){for(var e=this.A;t;){var r=this.N(t.u,i);if(r<0)t=(e=t).i;else{if(!(0<r))return t;t=t.t}}return e},g.prototype.S=function(t,i){for(var e=this.A;t;)t=this.N(t.u,i)<0?(e=t).i:t.t;return e},g.prototype.R=function(t){for(;;){var i,e=t.h;if(e===this.A)return;if(1===t.l)return void(t.l=0);if(t===e.t)if(1===(i=e.i).l)i.l=0,e.l=1,e===this.g?this.g=e.T():e.T();else{if(i.i&&1===i.i.l)return i.l=e.l,e.l=0,i.i.l=0,void(e===this.g?this.g=e.T():e.T());i.t&&1===i.t.l?(i.l=1,i.t.l=0,i.O()):(i.l=1,t=e)}else if(1===(i=e.t).l)i.l=0,e.l=1,e===this.g?this.g=e.O():e.O();else{if(i.t&&1===i.t.l)return i.l=e.l,e.l=0,i.t.l=0,void(e===this.g?this.g=e.O():e.O());i.i&&1===i.i.l?(i.l=1,i.i.l=0,i.T()):(i.l=1,t=e)}}},g.prototype.G=function(t){if(1===this.C)this.clear();else{for(var i=t;i.t||i.i;){if(i.i)for(i=i.i;i.t;)i=i.t;else i=i.t;var e=t.u,e=(t.u=i.u,i.u=e,t.o);t.o=i.o,i.o=e,t=i}this.A.t===i?this.A.t=i.h:this.A.i===i&&(this.A.i=i.h),this.R(i);var r=i.h;if(i===r.t?r.t=void 0:r.i=void 0,--this.C,this.g.l=0,this.enableIndex)for(;r!==this.A;)--r._,r=r.h}},g.prototype.P=function(t){for(var i="number"==typeof t?t:void 0,e="function"==typeof t?t:void 0,r=void 0===t?[]:void 0,n=0,o=this.g,s=[];s.length||o;)if(o)s.push(o),o=o.t;else{if(o=s.pop(),n===i)return o;r&&r.push(o),e&&e(o,n,this),n+=1,o=o.i}return r},g.prototype.q=function(t){for(;;){var i=t.h;if(0===i.l)return;var e,r,n=i.h;if(i===n.t){if((e=n.i)&&1===e.l){if(e.l=i.l=0,n===this.g)return;n.l=1,t=n;continue}if(t!==i.i)return i.l=0,n===this.g?this.g=n.O():n.O(),void(n.l=1);t.l=0,t.t&&(t.t.h=i),t.i&&(t.i.h=n),i.i=t.t,n.t=t.i,t.t=i,(t.i=n)===this.g?(this.g=t,this.A.h=t):(r=n.h).t===n?r.t=t:r.i=t}else{if((e=n.t)&&1===e.l){if(e.l=i.l=0,n===this.g)return;n.l=1,t=n;continue}if(t!==i.t)return i.l=0,n===this.g?this.g=n.T():n.T(),void(n.l=1);t.l=0,t.t&&(t.t.h=n),t.i&&(t.i.h=i),n.i=t.t,i.t=t.i,t.t=n,t.i=i,n===this.g?(this.g=t,this.A.h=t):(r=n.h).t===n?r.t=t:r.i=t}return t.h=n.h,i.h=t,n.h=t,n.l=1,void(this.enableIndex&&(i.I(),n.I(),t.I()))}},g.prototype.D=function(t,i,e){if(void 0===this.g)this.C+=1,this.g=new this.m(t,i,0),this.g.h=this.A,this.A.h=this.A.t=this.A.i=this.g;else{var r,n=this.A.t,o=this.N(n.u,t);if(0===o)n.o=i;else{if(0<o)n.t=new this.m(t,i),r=(n.t.h=n).t,this.A.t=r;else{o=this.A.i,n=this.N(o.u,t);if(0===n)return o.o=i,this.C;if(n<0)o.i=new this.m(t,i),r=(o.i.h=o).i,this.A.i=r;else{if(void 0!==e){n=e.M;if(n!==this.A){o=this.N(n.u,t);if(0===o)return n.o=i,this.C;if(0<o){e=n.v(),o=this.N(e.u,t);if(0===o)return e.o=i,this.C;o<0&&(r=new this.m(t,i),void 0===e.i?(e.i=r).h=e:(n.t=r).h=n)}}}if(void 0===r)for(r=this.g;;){var s=this.N(r.u,t);if(0<s){if(void 0===r.t){r.t=new this.m(t,i),r=(r.t.h=r).t;break}r=r.t}else{if(!(s<0))return r.o=i,this.C;if(void 0===r.i){r.i=new this.m(t,i),r=(r.i.h=r).i;break}r=r.i}}}}if(this.enableIndex)for(var h=r.h;h!==this.A;)h._+=1,h=h.h;this.q(r),this.C+=1}}return this.C},g.prototype.F=function(t,i){for(;t;){var e=this.N(t.u,i);if(e<0)t=t.i;else{if(!(0<e))return t;t=t.t}}return t||this.A},g.prototype.clear=function(){this.C=0,this.g=void 0,this.A.h=void 0,this.A.t=this.A.i=void 0},g.prototype.updateKeyByIterator=function(t,i){t=t.M;if(t===this.A&&v(),1!==this.C){var e=t.p().u;if(t===this.A.t)return 0<this.N(e,i)&&(t.u=i,!0);var r=t.v().u;if(t===this.A.i)return this.N(r,i)<0&&(t.u=i,!0);if(0<=this.N(r,i)||this.N(e,i)<=0)return!1}return t.u=i,!0},g.prototype.eraseElementByPos=function(t){if(t<0||t>this.C-1)throw new RangeError;t=this.P(t);return this.G(t),this.C},g.prototype.eraseElementByKey=function(t){return 0!==this.C&&(t=this.F(this.g,t))!==this.A&&(this.G(t),!0)},g.prototype.eraseElementByIterator=function(t){var i=t.M,e=(i===this.A&&v(),void 0===i.i);return 0===t.iteratorType?e&&t.next():e&&void 0!==i.t||t.next(),this.G(i),t},g.prototype.getHeight=function(){return 0===this.C?0:function t(i){return i?Math.max(t(i.t),t(i.i))+1:0}(this.g)};var d,c=g;function g(t,i){void 0===t&&(t=function(t,i){return t<i?-1:i<t?1:0}),void 0===i&&(i=!1);var e=d.call(this)||this;return e.g=void 0,e.N=t,e.enableIndex=i,e.m=i?h:n,e.A=new e.m,e}i(b,A=f),Object.defineProperty(b.prototype,"index",{get:function(){var t=this.M,i=this.A.h;if(t===this.A)return i?i._-1:0;var e=0;for(t.t&&(e+=t.t._);t!==i;){var r=t.h;t===r.i&&(e+=1,r.t)&&(e+=r.t._),t=r}return e},enumerable:!1,configurable:!0});var A,f=b;function b(t,i,e){e=A.call(this,e)||this;return e.M=t,e.A=i,0===e.iteratorType?(e.pre=function(){return this.M===this.A.t&&v(),this.M=this.M.v(),this},e.next=function(){return this.M===this.A&&v(),this.M=this.M.p(),this}):(e.pre=function(){return this.M===this.A.i&&v(),this.M=this.M.p(),this},e.next=function(){return this.M===this.A&&v(),this.M=this.M.v(),this}),e}i(M,w=f),Object.defineProperty(M.prototype,"pointer",{get:function(){this.M===this.A&&v();var r=this;return new Proxy([],{get:function(t,i){return"0"===i?r.M.u:"1"===i?r.M.o:void 0},set:function(t,i,e){if("1"!==i)throw new TypeError("props must be 1");return r.M.o=e,!0}})},enumerable:!1,configurable:!0}),M.prototype.copy=function(){return new M(this.M,this.A,this.container,this.iteratorType)};var w,m=M;function M(t,i,e,r){t=w.call(this,t,i,r)||this;return t.container=e,t}i(O,C=c),O.prototype.begin=function(){return new m(this.A.t||this.A,this.A,this)},O.prototype.end=function(){return new m(this.A,this.A,this)},O.prototype.rBegin=function(){return new m(this.A.i||this.A,this.A,this,1)},O.prototype.rEnd=function(){return new m(this.A,this.A,this,1)},O.prototype.front=function(){var t;if(0!==this.C)return[(t=this.A.t).u,t.o]},O.prototype.back=function(){var t;if(0!==this.C)return[(t=this.A.i).u,t.o]},O.prototype.lowerBound=function(t){t=this.j(this.g,t);return new m(t,this.A,this)},O.prototype.upperBound=function(t){t=this.k(this.g,t);return new m(t,this.A,this)},O.prototype.reverseLowerBound=function(t){t=this.B(this.g,t);return new m(t,this.A,this)},O.prototype.reverseUpperBound=function(t){t=this.S(this.g,t);return new m(t,this.A,this)},O.prototype.forEach=function(r){this.P(function(t,i,e){r([t.u,t.o],i,e)})},O.prototype.setElement=function(t,i,e){return this.D(t,i,e)},O.prototype.getElementByPos=function(t){if(t<0||t>this.C-1)throw new RangeError;t=this.P(t);return[t.u,t.o]},O.prototype.find=function(t){t=this.F(this.g,t);return new m(t,this.A,this)},O.prototype.getElementByKey=function(t){return this.F(this.g,t).o},O.prototype.union=function(t){var i=this;return t.forEach(function(t){i.setElement(t[0],t[1])}),this.C},O.prototype[Symbol.iterator]=function(){var i,e,r,n;return o(this,function(t){switch(t.label){case 0:i=this.C,e=this.P(),r=0,t.label=1;case 1:return r<i?[4,[(n=e[r]).u,n.o]]:[3,4];case 2:t.sent(),t.label=3;case 3:return++r,[3,1];case 4:return[2]}})};var C,f=O;function O(t,i,e){void 0===t&&(t=[]);var i=C.call(this,i,e)||this,r=i;return t.forEach(function(t){r.setElement(t[0],t[1])}),i}t.OrderedMap=f,Object.defineProperty(t,"H",{value:!0})});
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).sdsl={})}(this,function(t){"use strict";var r=function(t,i){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,i){t.__proto__=i}:function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])}))(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function e(){this.constructor=t}r(t,i),t.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e)}function o(r,n){var o,s,h,u={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(e){return function(t){var i=[e,t];if(o)throw new TypeError("Generator is already executing.");for(;u=f&&i[f=0]?0:u;)try{if(o=1,s&&(h=2&i[0]?s.return:i[0]?s.throw||((h=s.return)&&h.call(s),0):s.next)&&!(h=h.call(s,i[1])).done)return h;switch(s=0,(i=h?[2&i[0],h.value]:i)[0]){case 0:case 1:h=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,s=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(h=0<(h=u.trys).length&&h[h.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!h||i[1]>h[0]&&i[1]<h[3]))u.label=i[1];else if(6===i[0]&&u.label<h[1])u.label=h[1],h=i;else{if(!(h&&u.label<h[2])){h[2]&&u.ops.pop(),u.trys.pop();continue}u.label=h[2],u.ops.push(i)}}i=n.call(r,u)}catch(t){i=[6,t],s=0}finally{o=h=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}e.prototype.v=function(){var t=this,i=t.u.u===t;if(i&&1===t.l)t=t.i;else if(t.t)for(t=t.t;t.i;)t=t.i;else{if(i)return t.u;for(var e=t.u;e.t===t;)e=(t=e).u;t=e}return t},e.prototype.p=function(){var t=this;if(t.i){for(t=t.i;t.t;)t=t.t;return t}for(var i=t.u;i.i===t;)i=(t=i).u;return t.i!==i?i:t},e.prototype.T=function(){var t=this.u,i=this.i,e=i.t;return t.u===this?t.u=i:t.t===this?t.t=i:t.i=i,i.u=t,(i.t=this).u=i,(this.i=e)&&(e.u=this),i},e.prototype.O=function(){var t=this.u,i=this.t,e=i.i;return t.u===this?t.u=i:t.t===this?t.t=i:t.i=i,i.u=t,(i.i=this).u=i,(this.t=e)&&(e.u=this),i};var n=e;function e(t,i,e){void 0===e&&(e=1),this.t=void 0,this.i=void 0,this.u=void 0,this.h=t,this.o=i,this.l=e}i(u,s=n),u.prototype.T=function(){var t=s.prototype.T.call(this);return this.I(),t.I(),t},u.prototype.O=function(){var t=s.prototype.O.call(this);return this.I(),t.I(),t},u.prototype.I=function(){this._=1,this.t&&(this._+=this.t._),this.i&&(this._+=this.i._)};var s,h=u;function u(){var t=null!==s&&s.apply(this,arguments)||this;return t._=1,t}p.prototype.equals=function(t){return this.M===t.M};var f=p;function p(t){this.iteratorType=t=void 0===t?0:t}function l(){this.C=0}Object.defineProperty(l.prototype,"length",{get:function(){return this.C},enumerable:!1,configurable:!0}),l.prototype.size=function(){return this.C},l.prototype.empty=function(){return 0===this.C};i(y,c=l);var c,a=y;function y(){return null!==c&&c.apply(this,arguments)||this}function v(){throw new RangeError("Iterator access denied!")}i(A,d=a),A.prototype.j=function(t,i){for(var e=this.A;t;){var r=this.N(t.h,i);if(r<0)t=t.i;else{if(!(0<r))return t;t=(e=t).t}}return e},A.prototype.S=function(t,i){for(var e=this.A;t;)t=this.N(t.h,i)<=0?t.i:(e=t).t;return e},A.prototype.k=function(t,i){for(var e=this.A;t;){var r=this.N(t.h,i);if(r<0)t=(e=t).i;else{if(!(0<r))return t;t=t.t}}return e},A.prototype.B=function(t,i){for(var e=this.A;t;)t=this.N(t.h,i)<0?(e=t).i:t.t;return e},A.prototype.R=function(t){for(;;){var i,e=t.u;if(e===this.A)return;if(1===t.l)return void(t.l=0);if(t===e.t)if(1===(i=e.i).l)i.l=0,e.l=1,e===this.g?this.g=e.T():e.T();else{if(i.i&&1===i.i.l)return i.l=e.l,e.l=0,i.i.l=0,void(e===this.g?this.g=e.T():e.T());i.t&&1===i.t.l?(i.l=1,i.t.l=0,i.O()):(i.l=1,t=e)}else if(1===(i=e.t).l)i.l=0,e.l=1,e===this.g?this.g=e.O():e.O();else{if(i.t&&1===i.t.l)return i.l=e.l,e.l=0,i.t.l=0,void(e===this.g?this.g=e.O():e.O());i.i&&1===i.i.l?(i.l=1,i.i.l=0,i.T()):(i.l=1,t=e)}}},A.prototype.G=function(t){if(1===this.C)this.clear();else{for(var i=t;i.t||i.i;){if(i.i)for(i=i.i;i.t;)i=i.t;else i=i.t;var e=t.h,e=(t.h=i.h,i.h=e,t.o);t.o=i.o,i.o=e,t=i}this.A.t===i?this.A.t=i.u:this.A.i===i&&(this.A.i=i.u),this.R(i);var r=i.u;if(i===r.t?r.t=void 0:r.i=void 0,--this.C,this.g.l=0,this.enableIndex)for(;r!==this.A;)--r._,r=r.u}},A.prototype.P=function(t){for(var i="number"==typeof t?t:void 0,e="function"==typeof t?t:void 0,r=void 0===t?[]:void 0,n=0,o=this.g,s=[];s.length||o;)if(o)s.push(o),o=o.t;else{if(o=s.pop(),n===i)return o;r&&r.push(o),e&&e(o,n,this),n+=1,o=o.i}return r},A.prototype.q=function(t){for(;;){var i=t.u;if(0===i.l)return;var e,r,n=i.u;if(i===n.t){if((e=n.i)&&1===e.l){if(e.l=i.l=0,n===this.g)return;n.l=1,t=n;continue}if(t!==i.i)return i.l=0,n===this.g?this.g=n.O():n.O(),void(n.l=1);t.l=0,t.t&&(t.t.u=i),t.i&&(t.i.u=n),i.i=t.t,n.t=t.i,t.t=i,(t.i=n)===this.g?(this.g=t,this.A.u=t):(r=n.u).t===n?r.t=t:r.i=t}else{if((e=n.t)&&1===e.l){if(e.l=i.l=0,n===this.g)return;n.l=1,t=n;continue}if(t!==i.t)return i.l=0,n===this.g?this.g=n.T():n.T(),void(n.l=1);t.l=0,t.t&&(t.t.u=n),t.i&&(t.i.u=i),n.i=t.t,i.t=t.i,t.t=n,t.i=i,n===this.g?(this.g=t,this.A.u=t):(r=n.u).t===n?r.t=t:r.i=t}return t.u=n.u,i.u=t,n.u=t,n.l=1,void(this.enableIndex&&(i.I(),n.I(),t.I()))}},A.prototype.D=function(t,i,e){if(void 0===this.g)this.C+=1,this.g=new this.m(t,i,0),this.g.u=this.A,this.A.u=this.A.t=this.A.i=this.g;else{var r,n=this.A.t,o=this.N(n.h,t);if(0===o)n.o=i;else{if(0<o)n.t=new this.m(t,i),r=(n.t.u=n).t,this.A.t=r;else{o=this.A.i,n=this.N(o.h,t);if(0===n)return o.o=i,this.C;if(n<0)o.i=new this.m(t,i),r=(o.i.u=o).i,this.A.i=r;else{if(void 0!==e){n=e.M;if(n!==this.A){o=this.N(n.h,t);if(0===o)return n.o=i,this.C;if(0<o){e=n.v(),o=this.N(e.h,t);if(0===o)return e.o=i,this.C;o<0&&(r=new this.m(t,i),void 0===e.i?(e.i=r).u=e:(n.t=r).u=n)}}}if(void 0===r)for(r=this.g;;){var s=this.N(r.h,t);if(0<s){if(void 0===r.t){r.t=new this.m(t,i),r=(r.t.u=r).t;break}r=r.t}else{if(!(s<0))return r.o=i,this.C;if(void 0===r.i){r.i=new this.m(t,i),r=(r.i.u=r).i;break}r=r.i}}}}if(this.enableIndex)for(var h=r.u;h!==this.A;)h._+=1,h=h.u;this.q(r),this.C+=1}}return this.C},A.prototype.F=function(t,i){for(;t;){var e=this.N(t.h,i);if(e<0)t=t.i;else{if(!(0<e))return t;t=t.t}}return t||this.A},A.prototype.clear=function(){this.C=0,this.g=void 0,this.A.u=void 0,this.A.t=this.A.i=void 0},A.prototype.updateKeyByIterator=function(t,i){t=t.M;if(t===this.A&&v(),1!==this.C){var e=t.p().h;if(t===this.A.t)return 0<this.N(e,i)&&(t.h=i,!0);var r=t.v().h;if(t===this.A.i)return this.N(r,i)<0&&(t.h=i,!0);if(0<=this.N(r,i)||this.N(e,i)<=0)return!1}return t.h=i,!0},A.prototype.eraseElementByPos=function(t){if(t<0||t>this.C-1)throw new RangeError;t=this.P(t);return this.G(t),this.C},A.prototype.eraseElementByKey=function(t){return 0!==this.C&&(t=this.F(this.g,t))!==this.A&&(this.G(t),!0)},A.prototype.eraseElementByIterator=function(t){var i=t.M,e=(i===this.A&&v(),void 0===i.i);return 0===t.iteratorType?e&&t.next():e&&void 0!==i.t||t.next(),this.G(i),t},A.prototype.getHeight=function(){return 0===this.C?0:function t(i){return i?Math.max(t(i.t),t(i.i))+1:0}(this.g)};var d,a=A;function A(t,i){void 0===t&&(t=function(t,i){return t<i?-1:i<t?1:0}),void 0===i&&(i=!1);var e=d.call(this)||this;return e.g=void 0,e.N=t,e.enableIndex=i,e.m=i?h:n,e.A=new e.m,e}i(b,g=f),Object.defineProperty(b.prototype,"index",{get:function(){var t=this.M,i=this.A.u;if(t===this.A)return i?i._-1:0;var e=0;for(t.t&&(e+=t.t._);t!==i;){var r=t.u;t===r.i&&(e+=1,r.t)&&(e+=r.t._),t=r}return e},enumerable:!1,configurable:!0}),b.prototype.isAccessible=function(){return this.M!==this.A};var g,f=b;function b(t,i,e){e=g.call(this,e)||this;return e.M=t,e.A=i,0===e.iteratorType?(e.pre=function(){return this.M===this.A.t&&v(),this.M=this.M.v(),this},e.next=function(){return this.M===this.A&&v(),this.M=this.M.p(),this}):(e.pre=function(){return this.M===this.A.i&&v(),this.M=this.M.p(),this},e.next=function(){return this.M===this.A&&v(),this.M=this.M.v(),this}),e}i(m,w=f),Object.defineProperty(m.prototype,"pointer",{get:function(){this.M===this.A&&v();var r=this;return new Proxy([],{get:function(t,i){return"0"===i?r.M.h:"1"===i?r.M.o:(t[0]=r.M.h,t[1]=r.M.o,t[i])},set:function(t,i,e){if("1"!==i)throw new TypeError("prop must be 1");return r.M.o=e,!0}})},enumerable:!1,configurable:!0}),m.prototype.copy=function(){return new m(this.M,this.A,this.container,this.iteratorType)};var w,M=m;function m(t,i,e,r){t=w.call(this,t,i,r)||this;return t.container=e,t}i(O,C=a),O.prototype.begin=function(){return new M(this.A.t||this.A,this.A,this)},O.prototype.end=function(){return new M(this.A,this.A,this)},O.prototype.rBegin=function(){return new M(this.A.i||this.A,this.A,this,1)},O.prototype.rEnd=function(){return new M(this.A,this.A,this,1)},O.prototype.front=function(){var t;if(0!==this.C)return[(t=this.A.t).h,t.o]},O.prototype.back=function(){var t;if(0!==this.C)return[(t=this.A.i).h,t.o]},O.prototype.lowerBound=function(t){t=this.j(this.g,t);return new M(t,this.A,this)},O.prototype.upperBound=function(t){t=this.S(this.g,t);return new M(t,this.A,this)},O.prototype.reverseLowerBound=function(t){t=this.k(this.g,t);return new M(t,this.A,this)},O.prototype.reverseUpperBound=function(t){t=this.B(this.g,t);return new M(t,this.A,this)},O.prototype.forEach=function(r){this.P(function(t,i,e){r([t.h,t.o],i,e)})},O.prototype.setElement=function(t,i,e){return this.D(t,i,e)},O.prototype.getElementByPos=function(t){if(t<0||t>this.C-1)throw new RangeError;t=this.P(t);return[t.h,t.o]},O.prototype.find=function(t){t=this.F(this.g,t);return new M(t,this.A,this)},O.prototype.getElementByKey=function(t){return this.F(this.g,t).o},O.prototype.union=function(t){var i=this;return t.forEach(function(t){i.setElement(t[0],t[1])}),this.C},O.prototype[Symbol.iterator]=function(){var i,e,r,n;return o(this,function(t){switch(t.label){case 0:i=this.C,e=this.P(),r=0,t.label=1;case 1:return r<i?[4,[(n=e[r]).h,n.o]]:[3,4];case 2:t.sent(),t.label=3;case 3:return++r,[3,1];case 4:return[2]}})};var C,f=O;function O(t,i,e){void 0===t&&(t=[]);var i=C.call(this,i,e)||this,r=i;return t.forEach(function(t){r.setElement(t[0],t[1])}),i}t.OrderedMap=f,Object.defineProperty(t,"H",{value:!0})});
//# sourceMappingURL=ordered-map.min.js.map
{
"name": "@js-sdsl/ordered-map",
"version": "4.4.1",
"version": "4.4.2",
"description": "javascript standard data structure library which benchmark against C++ STL",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc