Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/associative

Package Overview
Dependencies
Maintainers
1
Versions
295
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/associative - npm Package Compare versions

Comparing version 4.0.11 to 4.1.0

trie.d.ts

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [4.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@4.0.11...@thi.ng/associative@4.1.0) (2020-06-14)
### Features
* **associative:** add Trie and tests ([84b6517](https://github.com/thi-ng/umbrella/commit/84b6517f8988e5032ac2c7614e62ebf4cf1c9e1b))
## [4.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@4.0.10...@thi.ng/associative@4.0.11) (2020-06-01)

@@ -8,0 +19,0 @@

1

index.d.ts

@@ -23,4 +23,5 @@ export * from "./api";

export * from "./sparse-set";
export * from "./trie";
export * from "./union";
export * from "./without-keys";
//# sourceMappingURL=index.d.ts.map

@@ -23,3 +23,4 @@ export * from "./api";

export * from "./sparse-set";
export * from "./trie";
export * from "./union";
export * from "./without-keys";

2

internal/xform-setop.js

@@ -8,3 +8,3 @@ import { reduce } from "@thi.ng/transducers";

(acc) => acc || new Set(),
(acc, x) => (!acc ? ensureSet(x) : op(acc, ensureSet(x)))
(acc, x) => (!acc ? ensureSet(x) : op(acc, ensureSet(x))),
];

@@ -237,3 +237,3 @@ 'use strict';

(acc) => acc || new Set(),
(acc, x) => (!acc ? ensureSet(x) : op(acc, ensureSet(x)))
(acc, x) => (!acc ? ensureSet(x) : op(acc, ensureSet(x))),
];

@@ -1373,2 +1373,124 @@

class Trie {
constructor() {
this.next = {};
this.n = 0;
}
*[Symbol.iterator]() {
const queue = [["", this]];
while (queue.length) {
const [prefix, node] = queue.pop();
if (node.vals) {
yield* transducers.map((v) => [prefix, v], node.vals);
}
else {
node.queueChildren(queue, prefix);
}
}
}
*keys(sep = "", prefix = "") {
const queue = [[prefix, this]];
while (queue.length) {
const [key, node] = queue.pop();
if (node.vals) {
yield key;
}
else {
node.queueChildren(queue, key, sep);
}
}
}
*values() {
const queue = [this];
while (queue.length) {
const node = queue.pop();
if (node.vals) {
yield* node.vals;
}
else {
queue.push(...transducers.vals(node.next));
}
}
}
clear() {
this.next = {};
this.n = 0;
this.vals = undefined;
}
has(key) {
return !!this.get(key);
}
hasPrefix(prefix) {
return !!this.find(prefix);
}
*suffixes(prefix, withPrefix = false) {
const node = this.find(prefix);
if (node) {
yield* node.keys("", withPrefix ? prefix.toString() : "");
}
}
get(key) {
const node = this.find(key);
return node ? node.vals : undefined;
}
find(key) {
let node = this;
for (let i = 0, n = key.length; i < n; i++) {
node = node.next[key[i].toString()];
if (!node)
return;
}
return node;
}
add(key, val) {
let node = this;
for (let i = 0, n = key.length; i < n; i++) {
const k = key[i].toString();
const next = node.next[k];
node = !next ? (node.n++, (node.next[k] = new Trie())) : next;
}
if (!node.vals)
node.vals = new Set();
node.vals.add(val);
}
delete(prefix, val) {
const n = prefix.length;
if (n < 1)
return false;
const path = [];
const key = [];
let i = 0;
let node = this;
for (; i < n; i++) {
const k = prefix[i].toString();
key.push(k);
path.push(node);
node = node.next[k];
if (!node)
return false;
}
if (val !== undefined) {
const vals = node.vals;
if (vals && vals.has(val)) {
vals.delete(val);
if (vals.size > 0)
return true;
}
else {
return false;
}
}
while ((node = path[--i])) {
delete node.next[key[i]];
if (--node.n)
break;
}
return true;
}
queueChildren(queue, prefix, sep = "") {
prefix = prefix.length ? prefix + sep : prefix;
queue.push(...transducers.map((k) => [prefix + k, this.next[k]], Object.keys(this.next)));
}
}
const union = (a, b, out) => {

@@ -1415,2 +1537,3 @@ if (a.size < b.size) {

exports.SparseSet8 = SparseSet8;
exports.Trie = Trie;
exports.commonKeysMap = commonKeysMap;

@@ -1417,0 +1540,0 @@ exports.commonKeysObj = commonKeysObj;

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("@thi.ng/api"),require("@thi.ng/equiv"),require("@thi.ng/checks"),require("@thi.ng/transducers"),require("@thi.ng/binary"),require("@thi.ng/dcons"),require("@thi.ng/compare"),require("@thi.ng/errors")):"function"==typeof define&&define.amd?define(["exports","tslib","@thi.ng/api","@thi.ng/equiv","@thi.ng/checks","@thi.ng/transducers","@thi.ng/binary","@thi.ng/dcons","@thi.ng/compare","@thi.ng/errors"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.associative={}),e.thi.ng[""],e.thi.ng.api,e.thi.ng.equiv,e.thi.ng.checks,e.thi.ng.transducers,e.thi.ng.binary,e.thi.ng.dcons,e.thi.ng.compare,e.thi.ng.errors)}(this,(function(e,t,s,r,n,i,o,a,u,h){"use strict";function c(e,t){for(let s of t)e.delete(s);return e}const l=(e,t)=>{if(e===t)return!0;if(!(t instanceof Map)||e.size!==t.size)return!1;for(let s of e.entries())if(!r.equiv(t.get(s[0]),s[1]))return!1;return!0},p=(e,t)=>{if(e===t)return!0;if(!(t instanceof Set)||e.size!==t.size)return!1;for(let s of e.keys())if(!t.has(s))return!1;return!0},g=n.isNode()?require("util").inspect:null,f=(e,t)=>[...i.map(e=>g(e,t),e)].join(", "),d=(e,t)=>[...i.map(([e,s])=>`${g(e,t)} => ${g(s,t)}`,e)].join(", "),y=s.mixin({[Symbol.for("nodejs.util.inspect.custom")](e,t){const s=this[Symbol.toStringTag],r=Object.assign(Object.assign({},t),{depth:null===t.depth?null:t.depth-1});return e>=0?[`${s}(${this.size||0}) {`,g?this instanceof Set?f(this,r):this instanceof Map?d(this,r):"":"","}"].join(" "):t.stylize(`[${s}]`,"special")}});function m(e,t){if(n.isMap(e))for(let s of t)e.set(s[0],s[1]);else for(let s of t)e.add(s);return e}const S=new WeakMap,v=e=>S.get(e).vals;let b=(()=>{var e;let n=e=class extends Set{constructor(e,t={}){super(),S.set(this,{equiv:t.equiv||r.equiv,vals:[]}),e&&this.into(e)}*[Symbol.iterator](){yield*v(this)}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"ArraySet"}get size(){return v(this).length}copy(){const t=S.get(this),s=new e(null,{equiv:t.equiv});return S.get(s).vals=t.vals.slice(),s}empty(){return new e(null,this.opts())}clear(){v(this).length=0}first(){if(this.size)return v(this)[0]}add(e){return!this.has(e)&&v(this).push(e),this}into(e){return m(this,e)}has(e){return this.get(e,s.SEMAPHORE)!==s.SEMAPHORE}get(e,t){const s=S.get(this),r=s.equiv,n=s.vals;for(let t=n.length;--t>=0;)if(r(n[t],e))return n[t];return t}delete(e){const t=S.get(this),s=t.equiv,r=t.vals;for(let t=r.length;--t>=0;)if(s(r[t],e))return r.splice(t,1),!0;return!1}disj(e){return c(this,e)}equiv(e){return p(this,e)}forEach(e,t){const s=v(this);for(let r=s.length;--r>=0;){const n=s[r];e.call(t,n,n,this)}}*entries(){for(let e of v(this))yield[e,e]}*keys(){yield*v(this)}*values(){yield*v(this)}opts(){return{equiv:S.get(this).equiv}}};return n=e=t.__decorate([y],n),n})();const w=(e,t,s=[])=>{for(let r in e)t.hasOwnProperty(r)&&s.push(r);return s},k=(e,t)=>n.implementsFunction(e,"empty")?e.empty():new(e[Symbol.species]||t),M=(e,t)=>n.implementsFunction(e,"copy")?e.copy():new(e[Symbol.species]||t)(e),x=e=>e[Symbol.iterator]().next().value,O=e=>n.isSet(e)?e:new Set(e),q=(e,t,s)=>s?i.reduce(e(),s):[()=>null,e=>e||new Set,(e,s)=>e?t(e,O(s)):O(s)],z=(e,t,s)=>{if(e===t)return s||k(e,Set);s=s?m(s,e):M(e,Set);for(let e of t)s.delete(e);return s};const j=new WeakMap,E=e=>j.get(e).map;let A=(()=>{var e;let n=e=class extends Map{constructor(e,t){super();const s=Object.assign({equiv:r.equiv,keys:b},t);j.set(this,{keys:new s.keys(null,{equiv:s.equiv}),map:new Map,opts:s}),e&&this.into(e)}[Symbol.iterator](){return this.entries()}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"EquivMap"}get size(){return j.get(this).keys.size}clear(){const e=j.get(this);e.keys.clear(),e.map.clear()}empty(){return new e(null,j.get(this).opts)}copy(){const t=j.get(this),s=new e;return j.set(s,{keys:t.keys.copy(),map:new Map(t.map),opts:t.opts}),s}equiv(e){return l(this,e)}delete(e){const t=j.get(this);return(e=t.keys.get(e,s.SEMAPHORE))!==s.SEMAPHORE&&(t.map.delete(e),t.keys.delete(e),!0)}dissoc(e){return c(this,e)}forEach(e,t){for(let s of E(this))e.call(t,s[1],s[0],this)}get(e,t){const r=j.get(this);return(e=r.keys.get(e,s.SEMAPHORE))!==s.SEMAPHORE?r.map.get(e):t}has(e){return j.get(this).keys.has(e)}set(e,t){const r=j.get(this),n=r.keys.get(e,s.SEMAPHORE);return n!==s.SEMAPHORE?r.map.set(n,t):(r.keys.add(e),r.map.set(e,t)),this}into(e){return m(this,e)}entries(){return E(this).entries()}keys(){return E(this).keys()}values(){return E(this).values()}opts(){return j.get(this).opts}};return n=e=t.__decorate([y],n),n})();const P=new WeakMap,_=(e,t)=>function*(){for(let s of P.get(e).bins)s&&(yield s[t])};let T=(()=>{var e;let s=e=class extends Map{constructor(e,t){super();const s=o.ceilPow2(Math.min(t.cap||16,4))-1;P.set(this,{hash:t.hash,equiv:t.equiv||r.equiv,load:t.load||.75,mask:s,bins:new Array(s+1),size:0}),e&&this.into(e)}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"HashMap"}get size(){return P.get(this).size}[Symbol.iterator](){return this.entries()}*entries(){for(let e of P.get(this).bins)e&&(yield[e[0],e[1]])}keys(){return _(this,0)()}values(){return _(this,1)()}forEach(e,t){for(let s of P.get(this).bins)e.call(t,s[1],s[0],this)}clear(){const e=P.get(this);e.bins=new Array(16),e.mask=15,e.size=0}empty(){return new e(null,this.opts({cap:16}))}copy(){const t=P.get(this),s=new e(null,this.opts({cap:4}));return Object.assign(P.get(s),{bins:t.bins.slice(),mask:t.mask,size:t.size}),s}equiv(e){return l(this,e)}has(e){const t=P.get(this),s=this.find(e,t);return s>=0&&null!=t.bins[s]}get(e,t){const s=P.get(this),r=this.find(e,s);return r>=0&&s.bins[r]?s.bins[r][1]:t}set(e,t){const s=P.get(this);let r=this.find(e,s);return r>=0&&s.bins[r]?(s.bins[r][1]=t,this):(s.size>s.mask*s.load&&(this.resize(s),r=this.find(e,s)),s.bins[r]=[e,t],s.size++,this)}delete(e){const t=P.get(this);let s=this.find(e,t);const r=t.bins;if(s>=0&&!r[s])return!1;t.size--;const n=t.mask;let i,o=s;for(;;){delete r[s];do{if(o=o+1&n,!r[o])return!0;i=t.hash(r[o][0])&n}while(s<=o?s<i&&i<=o:s<i||i<=o);r[s]=r[o],s=o}}into(e){return m(this,e)}dissoc(e){return c(this,e)}opts(e){const t=P.get(this);return Object.assign({hash:t.hash,equiv:t.equiv,load:t.load,cap:t.mask+1},e)}find(e,t){const s=t.mask,r=t.bins,n=t.equiv;let i=s,o=t.hash(e)&s;for(;r[o]&&!n(r[o][0],e);){if(i--,i<0)return-1;o=o+1&t.mask}return o}resize(e){const t=e.bins,s=2*(e.mask+1);e.bins=new Array(s),e.mask=s-1,e.size=0;for(let e of t)e&&this.set(e[0],e[1])}};return s=e=t.__decorate([y],s),s})();const H=(e,t)=>{const s={};for(let r of t)e.hasOwnProperty(r)&&(s[r]=e[r]);return s},R=(e,t)=>{const s=new A;let r,n,i;for(r of e)n=H(r,t),i=s.get(n),!i&&s.set(n,i=k(e,Set)),i.add(r);return s},L=(e,t,s)=>{if(s=s||k(e,Set),e===t)return m(s,e);if(t.size<e.size)return L(t,e,s);for(let r of t)e.has(r)&&s.add(r);return s};const U=(e,t={})=>{for(let s in e)t[e[s]]=s;return t},F=(e,...t)=>Object.assign(e,...t),W=(e,t,s={})=>{for(let r in e)s[t.hasOwnProperty(r)?t[r]:r]=e[r];return s},D=(e,t,s)=>{if(e.size&&t.size){let r,n,i;e.size<=t.size?(r=e,n=t,i=U(s)):(r=t,n=e,i=s);const o=R(r,(e=>{const t=[];for(let s in e)e.hasOwnProperty(s)&&t.push(e[s]);return t})(i)),a=Object.keys(i),u=k(e,Set);for(let e of n){const t=o.get(W(H(e,a),i));if(t)for(let s of t)u.add(F(Object.assign({},s),e))}return u}return k(e,Set)};D(new Set([{a:1,b:2}]),new Set([{id:1,c:2}]),{a:"id"});const K=new WeakMap,$=e=>K.get(e).vals;let N=(()=>{var e;let n=e=class extends Set{constructor(e,t={}){super(),K.set(this,{equiv:t.equiv||r.equiv,vals:new a.DCons}),e&&this.into(e)}*[Symbol.iterator](){yield*$(this)}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"LLSet"}get size(){return $(this).length}copy(){const t=K.get(this),s=new e(null,this.opts());return K.get(s).vals=t.vals.copy(),s}empty(){return new e(null,this.opts())}clear(){$(this).clear()}first(){if(this.size)return $(this).head.value}add(e){return!this.has(e)&&$(this).push(e),this}into(e){return m(this,e)}has(e){return this.get(e,s.SEMAPHORE)!==s.SEMAPHORE}get(e,t){const s=K.get(this),r=s.equiv;let n=s.vals.head;for(;n;){if(r(n.value,e))return n.value;n=n.next}return t}delete(e){const t=K.get(this),s=t.equiv;let r=t.vals.head;for(;r;){if(s(r.value,e))return t.vals.splice(r,1),!0;r=r.next}return!1}disj(e){return c(this,e)}equiv(e){return p(this,e)}forEach(e,t){let s=$(this).head;for(;s;)e.call(t,s.value,s.value,this),s=s.next}*entries(){for(let e of $(this))yield[e,e]}*keys(){yield*$(this)}*values(){yield*$(this)}opts(){return{equiv:K.get(this).equiv}}};return n=e=t.__decorate([y],n),n})();const C=(e,t,...s)=>{const r=Object.assign({},t);for(let n of s)for(let s in n){const i=n[s];r[s]=r.hasOwnProperty(s)?e(t[s],i):i}return r},B=(e,...t)=>C((e,t)=>n.isPlainObject(e)&&n.isPlainObject(t)?B(e,t):t,e,...t);class G{constructor(e,t,s){this.k=e,this.v=t,this.next=new Array(s+1)}}const I=new WeakMap;let J=(()=>{var e;let r=e=class extends Map{constructor(t,s={}){super();const r=s.capacity||e.DEFAULT_CAP,n=Math.ceil(Math.log2(r));I.set(this,{head:new G(null,null,0),cap:Math.pow(2,n),cmp:s.compare||u.compare,p:s.probability||e.DEFAULT_P,maxh:n,length:0,h:0}),t&&this.into(t)}get[Symbol.species](){return e}*[Symbol.iterator](){let e=I.get(this).head;for(;e=e.next[0];)yield[e.k,e.v]}*entries(e,t=!1){const s=I.get(this);let r=s.head;const n=s.cmp;let i;if(t){for(;r=r.next[0];)if((void 0===e||(i=n(r.k,e))<=0)&&(yield[r.k,r.v],0===i))return}else for(;r=r.next[0];)(void 0===e||(i=n(r.k,e))>=0)&&(yield[r.k,r.v])}keys(e,t=!1){return i.map(e=>e[0],this.entries(e,t))}values(e,t=!1){return i.map(e=>e[1],this.entries(e,t))}get size(){return I.get(this).length}clear(){const e=I.get(this);e.head=new G(null,null,0),e.length=0,e.h=0}empty(){return new e(null,Object.assign(Object.assign({},this.opts()),{capacity:e.DEFAULT_CAP}))}copy(){return new e(this,this.opts())}compare(e){const t=this.size,s=e.size;if(t<s)return-1;if(t>s)return 1;const r=this.entries(),n=e.entries();let i,o,a;for(;i=r.next(),o=n.next(),!i.done&&!o.done;)if(0!==(a=u.compare(i.value[0],o.value[0]))||0!==(a=u.compare(i.value[1],o.value[1])))return a;return 0}equiv(e){return l(this,e)}first(){const e=I.get(this).head.next[0];return e?[e.k,e.v]:void 0}get(e,t){const s=this.findPredNode(e).next[0];return s&&0===I.get(this).cmp(s.k,e)?s.v:t}has(e){return this.get(e,s.SEMAPHORE)!==s.SEMAPHORE}set(e,t){const s=I.get(this);let r=s.head,n=s.h,i=new Array(n);const o=s.cmp;let a;for(;n>=0;){for(;r.next[n]&&(a=o(r.next[n].k,e))<0;)r=r.next[n];if(r.next[n]&&0===a){do{r.next[n].v=t}while(--n>=0);return this}i[n--]=r}const u=this.pickHeight(s.maxh,s.h,s.p);for(r=new G(e,t,u);s.h<u;)i[++s.h]=s.head;for(let e=0;e<=u;e++)r.next[e]=i[e].next[e],i[e].next[e]=r;return s.length++,s.length>=s.cap&&(s.cap*=2,s.maxh++),this}delete(e){const t=I.get(this);let s=t.head,r=t.h,n=!1;const i=t.cmp;let o;for(;r>=0;){for(;s.next[r]&&(o=i(s.next[r].k,e))<0;)s=s.next[r];s.next[r]&&0===o&&(n=!0,s.next[r]=s.next[r].next[r],s!=t.head||s.next[r]||(t.h=Math.max(0,t.h-1))),r--}return n&&t.length--,n}into(e){return m(this,e)}dissoc(e){return c(this,e)}forEach(e,t){for(let s of this)e.call(t,s[1],s[0],this)}$reduce(e,t){let s=I.get(this).head;for(;(s=s.next[0])&&!i.isReduced(t);)t=e(t,[s.k,s.v]);return t}opts(){const e=I.get(this);return{capacity:e.cap,compare:e.cmp,probability:e.p}}findPredNode(e){const t=I.get(this),s=t.cmp;let r=t.head,n=t.h;for(;n>=0;){for(;r.next[n]&&s(r.next[n].k,e)<0;)r=r.next[n];n--}return r}pickHeight(e,t,s){const r=Math.min(e,t+1);let n=0;for(;Math.random()<s&&n<r;)n++;return n}};return r.DEFAULT_CAP=8,r.DEFAULT_P=1/Math.E,r=e=t.__decorate([y],r),r})();const Q=new WeakMap;let V=(()=>{var e;let s=e=class extends Set{constructor(e,t){super(),Q.set(this,new J(e?i.map(e=>[e,e],e):null,t))}[Symbol.iterator](){return this.keys()}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"SortedSet"}get size(){return Q.get(this).size}copy(){return new e(this.keys(),this.opts())}empty(){return new e(null,Object.assign(Object.assign({},this.opts()),{capacity:J.DEFAULT_CAP}))}compare(e){const t=this.size,s=e.size;if(t<s)return-1;if(t>s)return 1;const r=this.entries(),n=e.entries();let i,o,a;for(;i=r.next(),o=n.next(),!i.done&&!o.done;)if(0!==(a=u.compare(i.value[0],o.value[0])))return a;return 0}equiv(e){return p(this,e)}$reduce(e,t){return Q.get(this).$reduce((t,s)=>e(t,s[0]),t)}entries(e,t=!1){return Q.get(this).entries(e,t)}keys(e,t=!1){return Q.get(this).keys(e,t)}values(e,t=!1){return Q.get(this).values(e,t)}add(e){return Q.get(this).set(e,e),this}into(e){return m(this,e)}clear(){Q.get(this).clear()}first(){const e=Q.get(this).first();return e?e[0]:void 0}delete(e){return Q.get(this).delete(e)}disj(e){return c(this,e)}forEach(e,t){for(let s of this)e.call(t,s,s,this)}has(e){return Q.get(this).has(e)}get(e,t){return Q.get(this).get(e,t)}opts(){return Q.get(this).opts()}};return s=e=t.__decorate([y],s),s})();const X=new WeakMap,Y=()=>h.illegalArgs("dense & sparse arrays must be of same size");let Z=(()=>{let e=class extends Set{constructor(e,t){super(),X.set(this,{dense:e,sparse:t,n:0})}[Symbol.iterator](){return this.keys()}get size(){return X.get(this).n}get capacity(){return X.get(this).dense.length}clear(){X.get(this).n=0}equiv(e){if(this===e)return!0;if(!(e instanceof Set)||this.size!==e.size)return!1;const t=X.get(this),s=t.dense;for(let r=t.n;--r>=0;)if(!e.has(s[r]))return!1;return!0}add(e){const t=X.get(this),s=t.dense,r=t.sparse,n=s.length,i=r[e],o=t.n;return e<n&&o<n&&!(i<o&&s[i]===e)&&(s[o]=e,r[e]=o,t.n++),this}delete(e){const t=X.get(this),s=t.dense,r=t.sparse,n=r[e];if(n<t.n&&s[n]===e){const e=s[--t.n];return s[n]=e,r[e]=n,!0}return!1}has(e){const t=X.get(this),s=t.sparse[e];return s<t.n&&t.dense[s]===e}get(e,t=-1){return this.has(e)?e:t}first(){const e=X.get(this);return e.n?e.dense[0]:void 0}into(e){return m(this,e)}disj(e){return c(this,e)}forEach(e,t){const s=X.get(this),r=s.dense,n=s.n;for(let s=0;s<n;s++){const n=r[s];e.call(t,n,n,this)}}*entries(){const e=X.get(this),t=e.dense,s=e.n;for(let e=0;e<s;e++)yield[t[e],t[e]]}*keys(){const e=X.get(this),t=e.dense,s=e.n;for(let e=0;e<s;e++)yield t[e]}values(){return this.keys()}__copyTo(e){const t=X.get(this),s=X.get(e);return s.dense=t.dense.slice(),s.sparse=t.sparse.slice(),s.n=t.n,e}};return e=t.__decorate([y],e),e})();class ee extends Z{constructor(e,t){n.isNumber(e)?super(new Uint8Array(e),new Uint8Array(e)):e.length===t.length?super(e,t):Y()}get[Symbol.species](){return ee}get[Symbol.toStringTag](){return"SparseSet8"}copy(){return this.__copyTo(new ee(0))}empty(){return new ee(this.capacity)}}class te extends Z{constructor(e,t){n.isNumber(e)?super(new Uint16Array(e),new Uint16Array(e)):e.length===t.length?super(e,t):Y()}get[Symbol.species](){return te}get[Symbol.toStringTag](){return"SparseSet16"}copy(){return this.__copyTo(new te(0))}empty(){return new te(this.capacity)}}class se extends Z{constructor(e,t){n.isNumber(e)?super(new Uint32Array(e),new Uint32Array(e)):e.length===t.length?super(e,t):Y()}get[Symbol.species](){return se}get[Symbol.toStringTag](){return"SparseSet32"}copy(){return this.__copyTo(new se(0))}empty(){return new se(this.capacity)}}const re=(e,t,s)=>{if(e.size<t.size){const s=e;e=t,t=s}return s=s?m(s,e):M(e,Set),e===t?s:m(s,t)};e.ASparseSet=Z,e.ArraySet=b,e.EquivMap=A,e.HashMap=T,e.LLSet=N,e.SortedMap=J,e.SortedSet=V,e.SparseSet16=te,e.SparseSet32=se,e.SparseSet8=ee,e.commonKeysMap=(e,t,s=[])=>{for(let r of e.keys())t.has(r)&&s.push(r);return s},e.commonKeysObj=w,e.defArraySet=(e,t)=>new b(e,t),e.defEquivMap=function(e,t){return new A(n.isPlainObject(e)?i.pairs(e):e,t)},e.defHashMap=function(e,t){if(n.isPlainObject(e)){const s=Object.keys(e);return new T(i.map(t=>[t,e[t]],s),Object.assign({cap:s.length/(t.load||.75)},t))}return new T(e,t)},e.defLLSet=(e,t)=>new N(e,t),e.defSortedMap=function(e,t){if(n.isPlainObject(e)){const s=Object.keys(e);return new J(i.map(t=>[t,e[t]],s),Object.assign({capacity:s.length},t))}return new J(e,t)},e.defSortedSet=(e,t)=>new V(e,t),e.defSparseSet=e=>e<=256?new ee(e):e<=65536?new te(e):new se(e),e.difference=z,e.differenceR=function e(t){return q(e,z,t)},e.dissoc=c,e.dissocObj=(e,t)=>{for(let s of t)delete e[s];return e},e.indexed=R,e.intersection=L,e.intersectionR=function e(t){return q(e,L,t)},e.into=m,e.invertMap=(e,t)=>{t=t||new Map;for(let s of e)t.set(s[1],s[0]);return t},e.invertObj=U,e.join=(e,t)=>{if(e.size&&t.size){const s=w(x(e)||{},x(t)||{});let r,n;e.size<=t.size?(r=e,n=t):(r=t,n=e);const i=R(r,s),o=k(e,Set);for(let e of n){const t=i.get(H(e,s));if(t)for(let s of t)o.add(F(Object.assign({},s),e))}return o}return k(e,Set)},e.joinWith=D,e.mergeApplyMap=(e,t)=>{const s=M(e,Map);for(let[e,r]of t)s.set(e,n.isFunction(r)?r(s.get(e)):r);return s},e.mergeApplyObj=(e,t)=>{const s=Object.assign({},e);for(let e in t){const r=t[e];s[e]=n.isFunction(r)?r(s[e]):r}return s},e.mergeDeepObj=B,e.mergeMap=(e,...t)=>{for(let s of t)for(let t of s)e.set(t[0],t[1]);return e},e.mergeMapWith=(e,t,...s)=>{const r=M(t,Map);for(let t of s)for(let[s,n]of t)r.set(s,r.has(s)?e(r.get(s),n):n);return r},e.mergeObj=F,e.mergeObjWith=C,e.renameKeysMap=(e,t,s)=>{s=s||k(e,Map);for(let[r,n]of e)s.set(t.has(r)?t.get(r):r,n);return s},e.renameKeysObj=W,e.selectKeysMap=(e,t)=>{const s=k(e,Map);for(let r of t)e.has(r)&&s.set(r,e.get(r));return s},e.selectKeysObj=H,e.union=re,e.unionR=function e(t){return q(e,re,t)},e.withoutKeysMap=(e,t)=>{const s=O(t),r=k(e,Map);for(let t of e.entries()){const e=t[0];!s.has(e)&&r.set(e,t[1])}return r},e.withoutKeysObj=(e,t)=>{const s=O(t),r={};for(let t in e)e.hasOwnProperty(t)&&!s.has(t)&&(r[t]=e[t]);return r},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("@thi.ng/api"),require("@thi.ng/equiv"),require("@thi.ng/checks"),require("@thi.ng/transducers"),require("@thi.ng/binary"),require("@thi.ng/dcons"),require("@thi.ng/compare"),require("@thi.ng/errors")):"function"==typeof define&&define.amd?define(["exports","tslib","@thi.ng/api","@thi.ng/equiv","@thi.ng/checks","@thi.ng/transducers","@thi.ng/binary","@thi.ng/dcons","@thi.ng/compare","@thi.ng/errors"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.associative={}),e.thi.ng[""],e.thi.ng.api,e.thi.ng.equiv,e.thi.ng.checks,e.thi.ng.transducers,e.thi.ng.binary,e.thi.ng.dcons,e.thi.ng.compare,e.thi.ng.errors)}(this,(function(e,t,s,r,n,i,o,a,h,u){"use strict";function l(e,t){for(let s of t)e.delete(s);return e}const c=(e,t)=>{if(e===t)return!0;if(!(t instanceof Map)||e.size!==t.size)return!1;for(let s of e.entries())if(!r.equiv(t.get(s[0]),s[1]))return!1;return!0},p=(e,t)=>{if(e===t)return!0;if(!(t instanceof Set)||e.size!==t.size)return!1;for(let s of e.keys())if(!t.has(s))return!1;return!0},g=n.isNode()?require("util").inspect:null,f=(e,t)=>[...i.map(e=>g(e,t),e)].join(", "),d=(e,t)=>[...i.map(([e,s])=>`${g(e,t)} => ${g(s,t)}`,e)].join(", "),y=s.mixin({[Symbol.for("nodejs.util.inspect.custom")](e,t){const s=this[Symbol.toStringTag],r=Object.assign(Object.assign({},t),{depth:null===t.depth?null:t.depth-1});return e>=0?[`${s}(${this.size||0}) {`,g?this instanceof Set?f(this,r):this instanceof Map?d(this,r):"":"","}"].join(" "):t.stylize(`[${s}]`,"special")}});function m(e,t){if(n.isMap(e))for(let s of t)e.set(s[0],s[1]);else for(let s of t)e.add(s);return e}const v=new WeakMap,S=e=>v.get(e).vals;let b=(()=>{var e;let n=e=class extends Set{constructor(e,t={}){super(),v.set(this,{equiv:t.equiv||r.equiv,vals:[]}),e&&this.into(e)}*[Symbol.iterator](){yield*S(this)}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"ArraySet"}get size(){return S(this).length}copy(){const t=v.get(this),s=new e(null,{equiv:t.equiv});return v.get(s).vals=t.vals.slice(),s}empty(){return new e(null,this.opts())}clear(){S(this).length=0}first(){if(this.size)return S(this)[0]}add(e){return!this.has(e)&&S(this).push(e),this}into(e){return m(this,e)}has(e){return this.get(e,s.SEMAPHORE)!==s.SEMAPHORE}get(e,t){const s=v.get(this),r=s.equiv,n=s.vals;for(let t=n.length;--t>=0;)if(r(n[t],e))return n[t];return t}delete(e){const t=v.get(this),s=t.equiv,r=t.vals;for(let t=r.length;--t>=0;)if(s(r[t],e))return r.splice(t,1),!0;return!1}disj(e){return l(this,e)}equiv(e){return p(this,e)}forEach(e,t){const s=S(this);for(let r=s.length;--r>=0;){const n=s[r];e.call(t,n,n,this)}}*entries(){for(let e of S(this))yield[e,e]}*keys(){yield*S(this)}*values(){yield*S(this)}opts(){return{equiv:v.get(this).equiv}}};return n=e=t.__decorate([y],n),n})();const w=(e,t,s=[])=>{for(let r in e)t.hasOwnProperty(r)&&s.push(r);return s},k=(e,t)=>n.implementsFunction(e,"empty")?e.empty():new(e[Symbol.species]||t),x=(e,t)=>n.implementsFunction(e,"copy")?e.copy():new(e[Symbol.species]||t)(e),M=e=>e[Symbol.iterator]().next().value,O=e=>n.isSet(e)?e:new Set(e),q=(e,t,s)=>s?i.reduce(e(),s):[()=>null,e=>e||new Set,(e,s)=>e?t(e,O(s)):O(s)],z=(e,t,s)=>{if(e===t)return s||k(e,Set);s=s?m(s,e):x(e,Set);for(let e of t)s.delete(e);return s};const j=new WeakMap,E=e=>j.get(e).map;let A=(()=>{var e;let n=e=class extends Map{constructor(e,t){super();const s=Object.assign({equiv:r.equiv,keys:b},t);j.set(this,{keys:new s.keys(null,{equiv:s.equiv}),map:new Map,opts:s}),e&&this.into(e)}[Symbol.iterator](){return this.entries()}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"EquivMap"}get size(){return j.get(this).keys.size}clear(){const e=j.get(this);e.keys.clear(),e.map.clear()}empty(){return new e(null,j.get(this).opts)}copy(){const t=j.get(this),s=new e;return j.set(s,{keys:t.keys.copy(),map:new Map(t.map),opts:t.opts}),s}equiv(e){return c(this,e)}delete(e){const t=j.get(this);return(e=t.keys.get(e,s.SEMAPHORE))!==s.SEMAPHORE&&(t.map.delete(e),t.keys.delete(e),!0)}dissoc(e){return l(this,e)}forEach(e,t){for(let s of E(this))e.call(t,s[1],s[0],this)}get(e,t){const r=j.get(this);return(e=r.keys.get(e,s.SEMAPHORE))!==s.SEMAPHORE?r.map.get(e):t}has(e){return j.get(this).keys.has(e)}set(e,t){const r=j.get(this),n=r.keys.get(e,s.SEMAPHORE);return n!==s.SEMAPHORE?r.map.set(n,t):(r.keys.add(e),r.map.set(e,t)),this}into(e){return m(this,e)}entries(){return E(this).entries()}keys(){return E(this).keys()}values(){return E(this).values()}opts(){return j.get(this).opts}};return n=e=t.__decorate([y],n),n})();const P=new WeakMap,_=(e,t)=>function*(){for(let s of P.get(e).bins)s&&(yield s[t])};let T=(()=>{var e;let s=e=class extends Map{constructor(e,t){super();const s=o.ceilPow2(Math.min(t.cap||16,4))-1;P.set(this,{hash:t.hash,equiv:t.equiv||r.equiv,load:t.load||.75,mask:s,bins:new Array(s+1),size:0}),e&&this.into(e)}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"HashMap"}get size(){return P.get(this).size}[Symbol.iterator](){return this.entries()}*entries(){for(let e of P.get(this).bins)e&&(yield[e[0],e[1]])}keys(){return _(this,0)()}values(){return _(this,1)()}forEach(e,t){for(let s of P.get(this).bins)e.call(t,s[1],s[0],this)}clear(){const e=P.get(this);e.bins=new Array(16),e.mask=15,e.size=0}empty(){return new e(null,this.opts({cap:16}))}copy(){const t=P.get(this),s=new e(null,this.opts({cap:4}));return Object.assign(P.get(s),{bins:t.bins.slice(),mask:t.mask,size:t.size}),s}equiv(e){return c(this,e)}has(e){const t=P.get(this),s=this.find(e,t);return s>=0&&null!=t.bins[s]}get(e,t){const s=P.get(this),r=this.find(e,s);return r>=0&&s.bins[r]?s.bins[r][1]:t}set(e,t){const s=P.get(this);let r=this.find(e,s);return r>=0&&s.bins[r]?(s.bins[r][1]=t,this):(s.size>s.mask*s.load&&(this.resize(s),r=this.find(e,s)),s.bins[r]=[e,t],s.size++,this)}delete(e){const t=P.get(this);let s=this.find(e,t);const r=t.bins;if(s>=0&&!r[s])return!1;t.size--;const n=t.mask;let i,o=s;for(;;){delete r[s];do{if(o=o+1&n,!r[o])return!0;i=t.hash(r[o][0])&n}while(s<=o?s<i&&i<=o:s<i||i<=o);r[s]=r[o],s=o}}into(e){return m(this,e)}dissoc(e){return l(this,e)}opts(e){const t=P.get(this);return Object.assign({hash:t.hash,equiv:t.equiv,load:t.load,cap:t.mask+1},e)}find(e,t){const s=t.mask,r=t.bins,n=t.equiv;let i=s,o=t.hash(e)&s;for(;r[o]&&!n(r[o][0],e);){if(i--,i<0)return-1;o=o+1&t.mask}return o}resize(e){const t=e.bins,s=2*(e.mask+1);e.bins=new Array(s),e.mask=s-1,e.size=0;for(let e of t)e&&this.set(e[0],e[1])}};return s=e=t.__decorate([y],s),s})();const H=(e,t)=>{const s={};for(let r of t)e.hasOwnProperty(r)&&(s[r]=e[r]);return s},R=(e,t)=>{const s=new A;let r,n,i;for(r of e)n=H(r,t),i=s.get(n),!i&&s.set(n,i=k(e,Set)),i.add(r);return s},L=(e,t,s)=>{if(s=s||k(e,Set),e===t)return m(s,e);if(t.size<e.size)return L(t,e,s);for(let r of t)e.has(r)&&s.add(r);return s};const U=(e,t={})=>{for(let s in e)t[e[s]]=s;return t},F=(e,...t)=>Object.assign(e,...t),W=(e,t,s={})=>{for(let r in e)s[t.hasOwnProperty(r)?t[r]:r]=e[r];return s},C=(e,t,s)=>{if(e.size&&t.size){let r,n,i;e.size<=t.size?(r=e,n=t,i=U(s)):(r=t,n=e,i=s);const o=R(r,(e=>{const t=[];for(let s in e)e.hasOwnProperty(s)&&t.push(e[s]);return t})(i)),a=Object.keys(i),h=k(e,Set);for(let e of n){const t=o.get(W(H(e,a),i));if(t)for(let s of t)h.add(F(Object.assign({},s),e))}return h}return k(e,Set)};C(new Set([{a:1,b:2}]),new Set([{id:1,c:2}]),{a:"id"});const D=new WeakMap,K=e=>D.get(e).vals;let $=(()=>{var e;let n=e=class extends Set{constructor(e,t={}){super(),D.set(this,{equiv:t.equiv||r.equiv,vals:new a.DCons}),e&&this.into(e)}*[Symbol.iterator](){yield*K(this)}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"LLSet"}get size(){return K(this).length}copy(){const t=D.get(this),s=new e(null,this.opts());return D.get(s).vals=t.vals.copy(),s}empty(){return new e(null,this.opts())}clear(){K(this).clear()}first(){if(this.size)return K(this).head.value}add(e){return!this.has(e)&&K(this).push(e),this}into(e){return m(this,e)}has(e){return this.get(e,s.SEMAPHORE)!==s.SEMAPHORE}get(e,t){const s=D.get(this),r=s.equiv;let n=s.vals.head;for(;n;){if(r(n.value,e))return n.value;n=n.next}return t}delete(e){const t=D.get(this),s=t.equiv;let r=t.vals.head;for(;r;){if(s(r.value,e))return t.vals.splice(r,1),!0;r=r.next}return!1}disj(e){return l(this,e)}equiv(e){return p(this,e)}forEach(e,t){let s=K(this).head;for(;s;)e.call(t,s.value,s.value,this),s=s.next}*entries(){for(let e of K(this))yield[e,e]}*keys(){yield*K(this)}*values(){yield*K(this)}opts(){return{equiv:D.get(this).equiv}}};return n=e=t.__decorate([y],n),n})();const N=(e,t,...s)=>{const r=Object.assign({},t);for(let n of s)for(let s in n){const i=n[s];r[s]=r.hasOwnProperty(s)?e(t[s],i):i}return r},B=(e,...t)=>N((e,t)=>n.isPlainObject(e)&&n.isPlainObject(t)?B(e,t):t,e,...t);class G{constructor(e,t,s){this.k=e,this.v=t,this.next=new Array(s+1)}}const I=new WeakMap;let J=(()=>{var e;let r=e=class extends Map{constructor(t,s={}){super();const r=s.capacity||e.DEFAULT_CAP,n=Math.ceil(Math.log2(r));I.set(this,{head:new G(null,null,0),cap:Math.pow(2,n),cmp:s.compare||h.compare,p:s.probability||e.DEFAULT_P,maxh:n,length:0,h:0}),t&&this.into(t)}get[Symbol.species](){return e}*[Symbol.iterator](){let e=I.get(this).head;for(;e=e.next[0];)yield[e.k,e.v]}*entries(e,t=!1){const s=I.get(this);let r=s.head;const n=s.cmp;let i;if(t){for(;r=r.next[0];)if((void 0===e||(i=n(r.k,e))<=0)&&(yield[r.k,r.v],0===i))return}else for(;r=r.next[0];)(void 0===e||(i=n(r.k,e))>=0)&&(yield[r.k,r.v])}keys(e,t=!1){return i.map(e=>e[0],this.entries(e,t))}values(e,t=!1){return i.map(e=>e[1],this.entries(e,t))}get size(){return I.get(this).length}clear(){const e=I.get(this);e.head=new G(null,null,0),e.length=0,e.h=0}empty(){return new e(null,Object.assign(Object.assign({},this.opts()),{capacity:e.DEFAULT_CAP}))}copy(){return new e(this,this.opts())}compare(e){const t=this.size,s=e.size;if(t<s)return-1;if(t>s)return 1;const r=this.entries(),n=e.entries();let i,o,a;for(;i=r.next(),o=n.next(),!i.done&&!o.done;)if(0!==(a=h.compare(i.value[0],o.value[0]))||0!==(a=h.compare(i.value[1],o.value[1])))return a;return 0}equiv(e){return c(this,e)}first(){const e=I.get(this).head.next[0];return e?[e.k,e.v]:void 0}get(e,t){const s=this.findPredNode(e).next[0];return s&&0===I.get(this).cmp(s.k,e)?s.v:t}has(e){return this.get(e,s.SEMAPHORE)!==s.SEMAPHORE}set(e,t){const s=I.get(this);let r=s.head,n=s.h,i=new Array(n);const o=s.cmp;let a;for(;n>=0;){for(;r.next[n]&&(a=o(r.next[n].k,e))<0;)r=r.next[n];if(r.next[n]&&0===a){do{r.next[n].v=t}while(--n>=0);return this}i[n--]=r}const h=this.pickHeight(s.maxh,s.h,s.p);for(r=new G(e,t,h);s.h<h;)i[++s.h]=s.head;for(let e=0;e<=h;e++)r.next[e]=i[e].next[e],i[e].next[e]=r;return s.length++,s.length>=s.cap&&(s.cap*=2,s.maxh++),this}delete(e){const t=I.get(this);let s=t.head,r=t.h,n=!1;const i=t.cmp;let o;for(;r>=0;){for(;s.next[r]&&(o=i(s.next[r].k,e))<0;)s=s.next[r];s.next[r]&&0===o&&(n=!0,s.next[r]=s.next[r].next[r],s!=t.head||s.next[r]||(t.h=Math.max(0,t.h-1))),r--}return n&&t.length--,n}into(e){return m(this,e)}dissoc(e){return l(this,e)}forEach(e,t){for(let s of this)e.call(t,s[1],s[0],this)}$reduce(e,t){let s=I.get(this).head;for(;(s=s.next[0])&&!i.isReduced(t);)t=e(t,[s.k,s.v]);return t}opts(){const e=I.get(this);return{capacity:e.cap,compare:e.cmp,probability:e.p}}findPredNode(e){const t=I.get(this),s=t.cmp;let r=t.head,n=t.h;for(;n>=0;){for(;r.next[n]&&s(r.next[n].k,e)<0;)r=r.next[n];n--}return r}pickHeight(e,t,s){const r=Math.min(e,t+1);let n=0;for(;Math.random()<s&&n<r;)n++;return n}};return r.DEFAULT_CAP=8,r.DEFAULT_P=1/Math.E,r=e=t.__decorate([y],r),r})();const Q=new WeakMap;let V=(()=>{var e;let s=e=class extends Set{constructor(e,t){super(),Q.set(this,new J(e?i.map(e=>[e,e],e):null,t))}[Symbol.iterator](){return this.keys()}get[Symbol.species](){return e}get[Symbol.toStringTag](){return"SortedSet"}get size(){return Q.get(this).size}copy(){return new e(this.keys(),this.opts())}empty(){return new e(null,Object.assign(Object.assign({},this.opts()),{capacity:J.DEFAULT_CAP}))}compare(e){const t=this.size,s=e.size;if(t<s)return-1;if(t>s)return 1;const r=this.entries(),n=e.entries();let i,o,a;for(;i=r.next(),o=n.next(),!i.done&&!o.done;)if(0!==(a=h.compare(i.value[0],o.value[0])))return a;return 0}equiv(e){return p(this,e)}$reduce(e,t){return Q.get(this).$reduce((t,s)=>e(t,s[0]),t)}entries(e,t=!1){return Q.get(this).entries(e,t)}keys(e,t=!1){return Q.get(this).keys(e,t)}values(e,t=!1){return Q.get(this).values(e,t)}add(e){return Q.get(this).set(e,e),this}into(e){return m(this,e)}clear(){Q.get(this).clear()}first(){const e=Q.get(this).first();return e?e[0]:void 0}delete(e){return Q.get(this).delete(e)}disj(e){return l(this,e)}forEach(e,t){for(let s of this)e.call(t,s,s,this)}has(e){return Q.get(this).has(e)}get(e,t){return Q.get(this).get(e,t)}opts(){return Q.get(this).opts()}};return s=e=t.__decorate([y],s),s})();const X=new WeakMap,Y=()=>u.illegalArgs("dense & sparse arrays must be of same size");let Z=(()=>{let e=class extends Set{constructor(e,t){super(),X.set(this,{dense:e,sparse:t,n:0})}[Symbol.iterator](){return this.keys()}get size(){return X.get(this).n}get capacity(){return X.get(this).dense.length}clear(){X.get(this).n=0}equiv(e){if(this===e)return!0;if(!(e instanceof Set)||this.size!==e.size)return!1;const t=X.get(this),s=t.dense;for(let r=t.n;--r>=0;)if(!e.has(s[r]))return!1;return!0}add(e){const t=X.get(this),s=t.dense,r=t.sparse,n=s.length,i=r[e],o=t.n;return e<n&&o<n&&!(i<o&&s[i]===e)&&(s[o]=e,r[e]=o,t.n++),this}delete(e){const t=X.get(this),s=t.dense,r=t.sparse,n=r[e];if(n<t.n&&s[n]===e){const e=s[--t.n];return s[n]=e,r[e]=n,!0}return!1}has(e){const t=X.get(this),s=t.sparse[e];return s<t.n&&t.dense[s]===e}get(e,t=-1){return this.has(e)?e:t}first(){const e=X.get(this);return e.n?e.dense[0]:void 0}into(e){return m(this,e)}disj(e){return l(this,e)}forEach(e,t){const s=X.get(this),r=s.dense,n=s.n;for(let s=0;s<n;s++){const n=r[s];e.call(t,n,n,this)}}*entries(){const e=X.get(this),t=e.dense,s=e.n;for(let e=0;e<s;e++)yield[t[e],t[e]]}*keys(){const e=X.get(this),t=e.dense,s=e.n;for(let e=0;e<s;e++)yield t[e]}values(){return this.keys()}__copyTo(e){const t=X.get(this),s=X.get(e);return s.dense=t.dense.slice(),s.sparse=t.sparse.slice(),s.n=t.n,e}};return e=t.__decorate([y],e),e})();class ee extends Z{constructor(e,t){n.isNumber(e)?super(new Uint8Array(e),new Uint8Array(e)):e.length===t.length?super(e,t):Y()}get[Symbol.species](){return ee}get[Symbol.toStringTag](){return"SparseSet8"}copy(){return this.__copyTo(new ee(0))}empty(){return new ee(this.capacity)}}class te extends Z{constructor(e,t){n.isNumber(e)?super(new Uint16Array(e),new Uint16Array(e)):e.length===t.length?super(e,t):Y()}get[Symbol.species](){return te}get[Symbol.toStringTag](){return"SparseSet16"}copy(){return this.__copyTo(new te(0))}empty(){return new te(this.capacity)}}class se extends Z{constructor(e,t){n.isNumber(e)?super(new Uint32Array(e),new Uint32Array(e)):e.length===t.length?super(e,t):Y()}get[Symbol.species](){return se}get[Symbol.toStringTag](){return"SparseSet32"}copy(){return this.__copyTo(new se(0))}empty(){return new se(this.capacity)}}class re{constructor(){this.next={},this.n=0}*[Symbol.iterator](){const e=[["",this]];for(;e.length;){const[t,s]=e.pop();s.vals?yield*i.map(e=>[t,e],s.vals):s.queueChildren(e,t)}}*keys(e="",t=""){const s=[[t,this]];for(;s.length;){const[t,r]=s.pop();r.vals?yield t:r.queueChildren(s,t,e)}}*values(){const e=[this];for(;e.length;){const t=e.pop();t.vals?yield*t.vals:e.push(...i.vals(t.next))}}clear(){this.next={},this.n=0,this.vals=void 0}has(e){return!!this.get(e)}hasPrefix(e){return!!this.find(e)}*suffixes(e,t=!1){const s=this.find(e);s&&(yield*s.keys("",t?e.toString():""))}get(e){const t=this.find(e);return t?t.vals:void 0}find(e){let t=this;for(let s=0,r=e.length;s<r;s++)if(t=t.next[e[s].toString()],!t)return;return t}add(e,t){let s=this;for(let t=0,r=e.length;t<r;t++){const r=e[t].toString(),n=s.next[r];s=n||(s.n++,s.next[r]=new re)}s.vals||(s.vals=new Set),s.vals.add(t)}delete(e,t){const s=e.length;if(s<1)return!1;const r=[],n=[];let i=0,o=this;for(;i<s;i++){const t=e[i].toString();if(n.push(t),r.push(o),o=o.next[t],!o)return!1}if(void 0!==t){const e=o.vals;if(!e||!e.has(t))return!1;if(e.delete(t),e.size>0)return!0}for(;(o=r[--i])&&(delete o.next[n[i]],!--o.n););return!0}queueChildren(e,t,s=""){t=t.length?t+s:t,e.push(...i.map(e=>[t+e,this.next[e]],Object.keys(this.next)))}}const ne=(e,t,s)=>{if(e.size<t.size){const s=e;e=t,t=s}return s=s?m(s,e):x(e,Set),e===t?s:m(s,t)};e.ASparseSet=Z,e.ArraySet=b,e.EquivMap=A,e.HashMap=T,e.LLSet=$,e.SortedMap=J,e.SortedSet=V,e.SparseSet16=te,e.SparseSet32=se,e.SparseSet8=ee,e.Trie=re,e.commonKeysMap=(e,t,s=[])=>{for(let r of e.keys())t.has(r)&&s.push(r);return s},e.commonKeysObj=w,e.defArraySet=(e,t)=>new b(e,t),e.defEquivMap=function(e,t){return new A(n.isPlainObject(e)?i.pairs(e):e,t)},e.defHashMap=function(e,t){if(n.isPlainObject(e)){const s=Object.keys(e);return new T(i.map(t=>[t,e[t]],s),Object.assign({cap:s.length/(t.load||.75)},t))}return new T(e,t)},e.defLLSet=(e,t)=>new $(e,t),e.defSortedMap=function(e,t){if(n.isPlainObject(e)){const s=Object.keys(e);return new J(i.map(t=>[t,e[t]],s),Object.assign({capacity:s.length},t))}return new J(e,t)},e.defSortedSet=(e,t)=>new V(e,t),e.defSparseSet=e=>e<=256?new ee(e):e<=65536?new te(e):new se(e),e.difference=z,e.differenceR=function e(t){return q(e,z,t)},e.dissoc=l,e.dissocObj=(e,t)=>{for(let s of t)delete e[s];return e},e.indexed=R,e.intersection=L,e.intersectionR=function e(t){return q(e,L,t)},e.into=m,e.invertMap=(e,t)=>{t=t||new Map;for(let s of e)t.set(s[1],s[0]);return t},e.invertObj=U,e.join=(e,t)=>{if(e.size&&t.size){const s=w(M(e)||{},M(t)||{});let r,n;e.size<=t.size?(r=e,n=t):(r=t,n=e);const i=R(r,s),o=k(e,Set);for(let e of n){const t=i.get(H(e,s));if(t)for(let s of t)o.add(F(Object.assign({},s),e))}return o}return k(e,Set)},e.joinWith=C,e.mergeApplyMap=(e,t)=>{const s=x(e,Map);for(let[e,r]of t)s.set(e,n.isFunction(r)?r(s.get(e)):r);return s},e.mergeApplyObj=(e,t)=>{const s=Object.assign({},e);for(let e in t){const r=t[e];s[e]=n.isFunction(r)?r(s[e]):r}return s},e.mergeDeepObj=B,e.mergeMap=(e,...t)=>{for(let s of t)for(let t of s)e.set(t[0],t[1]);return e},e.mergeMapWith=(e,t,...s)=>{const r=x(t,Map);for(let t of s)for(let[s,n]of t)r.set(s,r.has(s)?e(r.get(s),n):n);return r},e.mergeObj=F,e.mergeObjWith=N,e.renameKeysMap=(e,t,s)=>{s=s||k(e,Map);for(let[r,n]of e)s.set(t.has(r)?t.get(r):r,n);return s},e.renameKeysObj=W,e.selectKeysMap=(e,t)=>{const s=k(e,Map);for(let r of t)e.has(r)&&s.set(r,e.get(r));return s},e.selectKeysObj=H,e.union=ne,e.unionR=function e(t){return q(e,ne,t)},e.withoutKeysMap=(e,t)=>{const s=O(t),r=k(e,Map);for(let t of e.entries()){const e=t[0];!s.has(e)&&r.set(e,t[1])}return r},e.withoutKeysObj=(e,t)=>{const s=O(t),r={};for(let t in e)e.hasOwnProperty(t)&&!s.has(t)&&(r[t]=e[t]);return r},Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@thi.ng/associative",
"version": "4.0.11",
"version": "4.1.0",
"description": "Alternative Map and Set implementations with customizable equality semantics & supporting operations",

@@ -46,10 +46,10 @@ "module": "./index.js",

"dependencies": {
"@thi.ng/api": "^6.11.0",
"@thi.ng/binary": "^2.0.7",
"@thi.ng/checks": "^2.7.0",
"@thi.ng/compare": "^1.3.7",
"@thi.ng/dcons": "^2.2.19",
"@thi.ng/api": "^6.11.1",
"@thi.ng/binary": "^2.0.8",
"@thi.ng/checks": "^2.7.1",
"@thi.ng/compare": "^1.3.8",
"@thi.ng/dcons": "^2.2.20",
"@thi.ng/equiv": "^1.0.23",
"@thi.ng/errors": "^1.2.14",
"@thi.ng/transducers": "^7.0.0",
"@thi.ng/transducers": "^7.1.0",
"tslib": "^1.12.0"

@@ -92,3 +92,3 @@ },

},
"gitHead": "767acd1e6ad2ac0e52aabfd5edfed615a27cb32c"
"gitHead": "ddf9b8b67d3d60bcca88143528ee33b843cc089e"
}

@@ -175,3 +175,3 @@ <!-- This file is generated - DO NOT EDIT! -->

Package sizes (gzipped, pre-treeshake): ESM: 5.16 KB / CJS: 5.35 KB / UMD: 5.18 KB
Package sizes (gzipped, pre-treeshake): ESM: 5.62 KB / CJS: 5.82 KB / UMD: 5.64 KB

@@ -178,0 +178,0 @@ ## Dependencies

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc