xduce
Version:
Composable algorithmic transformations library for JavaScript
1,591 lines (1,589 loc) • 49.2 kB
JavaScript
/*!
* Copyright (c) 2017 Thomas Otterson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
!(function(t, n) {
'object' == typeof exports && 'object' == typeof module
? (module.exports = n())
: 'function' == typeof define && define.amd
? define([], n)
: 'object' == typeof exports
? (exports.xduce = n())
: (t.xduce = n());
})(window, function() {
return (function(t) {
var n = {};
function r(e) {
if (n[e]) return n[e].exports;
var u = (n[e] = { i: e, l: !1, exports: {} });
return t[e].call(u.exports, u, u.exports, r), (u.l = !0), u.exports;
}
return (
(r.m = t),
(r.c = n),
(r.d = function(t, n, e) {
r.o(t, n) || Object.defineProperty(t, n, { enumerable: !0, get: e });
}),
(r.r = function(t) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(t, '__esModule', { value: !0 });
}),
(r.t = function(t, n) {
if ((1 & n && (t = r(t)), 8 & n)) return t;
if (4 & n && 'object' == typeof t && t && t.__esModule) return t;
var e = Object.create(null);
if ((r.r(e), Object.defineProperty(e, 'default', { enumerable: !0, value: t }), 2 & n && 'string' != typeof t))
for (var u in t)
r.d(
e,
u,
function(n) {
return t[n];
}.bind(null, u)
);
return e;
}),
(r.n = function(t) {
var n =
t && t.__esModule
? function() {
return t.default;
}
: function() {
return t;
};
return r.d(n, 'a', n), n;
}),
(r.o = function(t, n) {
return Object.prototype.hasOwnProperty.call(t, n);
}),
(r.p = ''),
r((r.s = 8))
);
})([
function(t, n, r) {
var e = r(3),
u = Object.prototype.toString,
i = Array.isArray;
t.exports = {
isArray: i,
isObject: function(t) {
if ('[object Object]' !== u.call(t)) return !1;
var n = Object.getPrototypeOf(t);
if (null === n) return !0;
var r = Object.prototype.hasOwnProperty.call(n, 'constructor') && n.constructor;
return 'function' == typeof r && r === Object;
},
isFunction: function(t) {
return '[object Function]' === u.call(t);
},
isString: function(t) {
return '[object String]' === u.call(t);
},
isNumber: function(t) {
return '[object Number]' === u.call(t) && isFinite(t);
},
bmpCharAt: function(t, n) {
for (
var r = t + '', e = n, u = r.length, i = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
i.exec(r) && i.lastIndex - 2 < e;
)
e++;
if (e >= u || e < 0) return '';
var o = r.charAt(e);
return /[\uD800-\uDBFF]/.test(o) && /[\uDC00-\uDFFF]/.test(r.charAt(e + 1)) && (o += r.charAt(e + 1)), o;
},
bmpLength: function(t) {
var n = t + '',
r = n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g),
e = r ? r.length : 0;
return n.length - e;
},
range: function(t, n, r) {
var u = e(null == n ? [0, t] : [t, n], 2),
i = u[0],
o = u[1],
c = r || (i > o ? -1 : 1);
if (Math.sign(c) !== Math.sign(o - i)) return [i];
for (var a = [], s = i; c < 0 ? s > o : s < o; s += c) a.push(s);
return a;
},
complement: function(t) {
return function() {
return !t.apply(void 0, arguments);
};
}
};
},
function(t, n, r) {
var e = r(0).isFunction,
u = !0,
i = 'undefined' != typeof Symbol;
function o(t) {
return u && i ? Symbol.for(t) : '@@'.concat(t);
}
var c = {
iterator: i ? Symbol.iterator : '@@iterator',
init: o('transducer/init'),
step: o('transducer/step'),
result: o('transducer/result'),
reduced: o('transducer/reduced'),
value: o('transducer/value')
};
t.exports = {
protocols: c,
isImplemented: function(t, n) {
if (null == t) return !1;
switch (n) {
case 'iterator':
return e(t[c.iterator] || t.next);
case 'reduced':
case 'value':
return c[n] in t;
default:
return e(t[c[n]]);
}
}
};
},
function(t, n) {
t.exports = function(t, n, r) {
return (
n in t
? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 })
: (t[n] = r),
t
);
};
},
function(t, n, r) {
var e = r(9),
u = r(10),
i = r(11);
t.exports = function(t, n) {
return e(t) || u(t, n) || i();
};
},
function(t, n, r) {
var e = r(2),
u = r(1),
i = u.protocols,
o = u.isImplemented,
c = r(7),
a = c.isKvFormObject,
s = c.iterator,
f = r(5),
l = f.isCompleted,
p = f.reduce,
h = f.arrayReducer,
d = f.objectReducer,
v = f.stringReducer,
m = f.toReducer,
y = r(0),
b = y.isArray,
g = y.isObject,
x = y.isString,
w = y.isFunction,
j = i;
function O(t, n, r, e) {
var u = w(r) ? m(r) : r,
i = void 0 === e ? u[j.init]() : e,
o = n ? n(u) : u;
return p(t, o, i);
}
function F(t, n) {
return O(t, n, h);
}
function k(t, n) {
return O(t, n, d);
}
function L(t, n) {
return O(t, n, v);
}
function E(t, n) {
return n
? (function(t, n) {
var r,
u,
i = (e((r = {}), j.step, function(t, n) {
var r = a(n) ? e({}, n.k, n.v) : n;
return t.items.unshift(r), t;
}),
e(r, j.result, function(t) {
return t;
}),
r),
o = s(t, null, !0),
c = n(i),
f = !1;
return (
e((u = { items: [] }), j.iterator, function() {
return this;
}),
e(u, 'next', function() {
return (
0 === this.items.length && this.step(),
0 === this.items.length ? { done: !0 } : { value: this.items.pop(), done: !1 }
);
}),
e(u, 'step', function() {
for (var t = this.items.length; this.items.length === t; ) {
var n = o.next();
if (n.done || f) {
c[j.result](this);
break;
}
f = l(c[j.step](this, n.value));
}
}),
u
);
})(t, n)
: s(t);
}
t.exports = {
transduce: O,
asArray: F,
asObject: k,
asString: L,
asIterator: E,
sequence: function(t, n) {
switch (!0) {
case b(t):
return F(t, n);
case g(t):
return k(t, n);
case x(t):
return L(t, n);
case o(t, 'step'):
return O(t, n, t);
case o(t, 'iterator'):
return E(t, n);
default:
throw Error('Cannot sequence collection: '.concat(t));
}
},
into: function(t, n, r) {
switch (!0) {
case b(t):
return O(n, r, h, t);
case g(t):
return O(n, r, d, t);
case x(t):
return O(n, r, v, t);
case o(t, 'step'):
return O(n, r, t, t);
default:
throw Error('Cannot reduce collection into '.concat(t, ': ').concat(n));
}
},
compose: function() {
for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r];
var e = n.reverse();
return function(t) {
return e.reduce(function(t, n) {
return n(t);
}, t);
};
}
};
},
function(t, n, r) {
var e = r(2),
u = r(0),
i = u.isArray,
o = u.isFunction,
c = u.isObject,
a = u.isString,
s = r(7),
f = s.isKvFormObject,
l = s.iterator,
p = r(1),
h = p.protocols,
d = p.isImplemented,
v = h;
function m(t) {
switch (!0) {
case d(t, 'init'):
return t[v.init];
case a(t):
return function() {
return '';
};
case i(t):
return function() {
return [];
};
case c(t):
return function() {
return {};
};
case o(t):
return function() {
throw Error('init not available');
};
default:
return null;
}
}
function y(t) {
switch (!0) {
case d(t, 'step'):
return t[v.step];
case a(t):
return function(t, n) {
return t + (f(n) ? n.v : n);
};
case i(t):
return function(t, n) {
var r = f(n) ? e({}, n.k, n.v) : n;
return t.push(r), t;
};
case c(t):
return function(t, n) {
var r = n;
if (f(n)) r = e({}, n.k, n.v);
else if (!c(n)) {
var u = -1;
for (var i in t) {
var o = parseInt(i);
o > u && (u = o);
}
r = e({}, u + 1, n);
}
for (var a in r) r.hasOwnProperty(a) && (t[a] = r[a]);
return t;
};
case o(t):
return function(n, r) {
return t(n, r);
};
default:
return null;
}
}
function b(t) {
switch (!0) {
case d(t, 'result'):
return t[v.result];
case a(t):
case i(t):
case c(t):
case o(t):
return function(t) {
return t;
};
default:
return null;
}
}
function g(t) {
var n;
return e((n = {}), v.init, m(t)), e(n, v.step, y(t)), e(n, v.result, b(t)), n;
}
var x = g([]),
w = g({}),
j = g('');
function O(t) {
var n;
return e((n = {}), v.reduced, !0), e(n, v.value, t), n;
}
function F(t) {
if (null != t) return t[v.value];
}
function k(t) {
return null != t && !!t[v.reduced];
}
t.exports = {
init: m,
step: y,
result: b,
toReducer: g,
arrayReducer: x,
objectReducer: w,
stringReducer: j,
toFunction: function(t, n) {
var r = t('function' == typeof n ? g(n) : n);
return r[v.step].bind(r);
},
complete: O,
uncomplete: F,
isCompleted: k,
ensureCompleted: function(t) {
return k(t) ? t : O(t);
},
ensureUncompleted: function(t) {
return k(t) ? F(t) : t;
},
reduce: function(t, n, r) {
if (null == t) return null;
var e = l(t, null, !0);
if (!e) throw Error('Cannot reduce an instance of '.concat(t.constructor.name));
for (var u = r, i = e.next(); !i.done; ) {
if (k((u = n[v.step](u, i.value)))) {
u = F(u);
break;
}
i = e.next();
}
return n[v.result](u);
}
};
},
function(t, n, r) {
var e = r(3),
u = r(2),
i = r(1).protocols,
o = r(4).sequence,
c = r(7).isIterable,
a = r(0).isNumber,
s = r(5),
f = s.isCompleted,
l = s.complete,
p = s.reduce,
h = i;
t.exports = {
sameValueZero: function(t, n) {
return t === n || (isNaN(t) && isNaN(n));
},
identity: function t(n) {
return n
? o(n, t())
: function(t) {
return (function(t) {
var n;
return (
u((n = {}), h.init, function() {
return t[h.init]();
}),
u(n, h.step, function(n, r) {
return t[h.step](n, r);
}),
u(n, h.result, function(n) {
return t[h.result](n);
}),
n
);
})(t);
};
},
flatten: function t(n) {
return n
? o(n, t())
: function(t) {
return (function(t) {
var n;
return (
u((n = {}), h.init, function() {
return t[h.init]();
}),
u(n, h.step, function(n, r) {
var e,
i = (u((e = {}), h.init, function() {
return t[h.init]();
}),
u(e, h.step, function(n, r) {
var e = t[h.step](n, r);
return f(e) ? l(e) : e;
}),
u(e, h.result, function(n) {
return t[h.result](n);
}),
e);
return c(r) ? p(r, i, n) : i[h.step](n, r);
}),
u(n, h.result, function(n) {
return t[h.result](n);
}),
n
);
})(t);
};
},
repeat: function t(n, r) {
var i = a(n) ? [null, n] : [n, r],
c = e(i, 2),
s = c[0],
l = c[1];
return s
? o(s, t(l))
: function(t) {
return (function(t, n) {
var r;
return (
u((r = {}), h.init, function() {
return n[h.init]();
}),
u(r, h.step, function(r, e) {
for (var u = r, i = 0; i < t && ((u = n[h.step](u, e)), !f(u)); ++i);
return u;
}),
u(r, h.result, function(t) {
return n[h.result](t);
}),
r
);
})(l, t);
};
}
};
},
function(t, n, r) {
var e = r(12),
u = r(0),
i = u.bmpCharAt,
o = u.bmpLength,
c = u.isArray,
a = u.isFunction,
s = u.isObject,
f = u.isString,
l = r(1),
p = l.protocols,
h = l.isImplemented,
d = p;
t.exports = {
isKvFormObject: function(t) {
var n = Object.keys(t);
return 2 === n.length && !!~n.indexOf('k') && !!~n.indexOf('v');
},
iterator: function(t, n, r) {
switch (!0) {
case a(t[d.iterator]):
return t[d.iterator]();
case a(t.next):
return t;
case a(t):
return (function(t) {
return e.mark(function n() {
var r, u;
return e.wrap(
function(n) {
for (;;)
switch ((n.prev = n.next)) {
case 0:
u = 0;
case 1:
if (void 0 !== (r = t(u++, r))) {
n.next = 4;
break;
}
return n.abrupt('break', 8);
case 4:
return (n.next = 6), r;
case 6:
n.next = 1;
break;
case 8:
case 'end':
return n.stop();
}
},
n,
this
);
})();
})(t);
case f(t):
return (function(t) {
var n = 0;
return {
next: function() {
return n < o(t) ? { value: i(t, n++), done: !1 } : { done: !0 };
}
};
})(t);
case c(t):
return (function(t) {
var n = 0;
return {
next: function() {
return n < t.length ? { value: t[n++], done: !1 } : { done: !0 };
}
};
})(t);
case s(t):
return (function(t, n) {
var r = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
e = Object.keys(t);
e = 'function' == typeof n ? e.sort(n) : e.sort();
var u = 0;
return {
next: function() {
if (u < e.length) {
var n = e[u++],
i = {};
return r ? ((i.k = n), (i.v = t[n])) : (i[n] = t[n]), { value: i, done: !1 };
}
return { done: !0 };
}
};
})(t, n, r);
default:
return null;
}
},
isIterable: function(t) {
return h(t, 'iterator') || f(t) || c(t) || s(t);
}
};
},
function(t, n, r) {
var e = r(0),
u = e.bmpCharAt,
i = e.bmpLength,
o = e.range,
c = e.complement,
a = e.isArray,
s = e.isFunction,
f = e.isNumber,
l = e.isObject,
p = e.isString,
h = r(5),
d = h.complete,
v = h.uncomplete,
m = h.isCompleted,
y = h.ensureCompleted,
b = h.ensureUncompleted,
g = h.toReducer,
x = h.toFunction,
w = h.reduce,
j = r(1).protocols,
O = r(7).iterator,
F = r(4),
k = F.transduce,
L = F.into,
E = F.sequence,
S = F.asArray,
N = F.asIterator,
A = F.asObject,
_ = F.asString,
q = F.compose,
R = r(15),
C = R.chunk,
P = R.chunkBy,
I = r(6),
B = I.identity,
D = I.flatten,
W = I.repeat,
M = r(16),
G = M.distinct,
T = M.distinctBy,
U = M.distinctWith,
V = r(17),
Z = V.drop,
K = V.dropWhile,
Y = r(18),
z = Y.filter,
H = Y.reject,
J = Y.compact,
Q = r(19),
X = Q.map,
$ = Q.flatMap,
tt = r(20),
nt = tt.take,
rt = tt.takeWhile,
et = tt.takeNth,
ut = r(21),
it = ut.unique,
ot = ut.uniqueBy,
ct = ut.uniqueWith;
t.exports = {
util: {
bmp: { charAt: u, length: i },
range: o,
complement: c,
isArray: a,
isFunction: s,
isNumber: f,
isObject: l,
isString: p,
status: { complete: d, uncomplete: v, isCompleted: m, ensureCompleted: y, ensureUncompleted: b }
},
protocols: j,
iterator: O,
toReducer: g,
toFunction: x,
reduce: w,
transduce: k,
into: L,
sequence: E,
asArray: S,
asIterator: N,
asObject: A,
asString: _,
compose: q,
transducers: {
chunk: C,
chunkBy: P,
identity: B,
flatten: D,
repeat: W,
distinct: G,
distinctBy: T,
distinctWith: U,
drop: Z,
dropWhile: K,
filter: z,
reject: H,
compact: J,
map: X,
flatMap: $,
take: nt,
takeWhile: rt,
takeNth: et,
unique: it,
uniqueBy: ot,
uniqueWith: ct
}
};
},
function(t, n) {
t.exports = function(t) {
if (Array.isArray(t)) return t;
};
},
function(t, n) {
t.exports = function(t, n) {
var r = [],
e = !0,
u = !1,
i = void 0;
try {
for (
var o, c = t[Symbol.iterator]();
!(e = (o = c.next()).done) && (r.push(o.value), !n || r.length !== n);
e = !0
);
} catch (t) {
(u = !0), (i = t);
} finally {
try {
e || null == c.return || c.return();
} finally {
if (u) throw i;
}
}
return r;
};
},
function(t, n) {
t.exports = function() {
throw new TypeError('Invalid attempt to destructure non-iterable instance');
};
},
function(t, n, r) {
t.exports = r(13);
},
function(t, n, r) {
var e =
(function() {
return this || ('object' == typeof self && self);
})() || Function('return this')(),
u = e.regeneratorRuntime && Object.getOwnPropertyNames(e).indexOf('regeneratorRuntime') >= 0,
i = u && e.regeneratorRuntime;
if (((e.regeneratorRuntime = void 0), (t.exports = r(14)), u)) e.regeneratorRuntime = i;
else
try {
delete e.regeneratorRuntime;
} catch (t) {
e.regeneratorRuntime = void 0;
}
},
function(t, n) {
!(function(n) {
'use strict';
var r,
e = Object.prototype,
u = e.hasOwnProperty,
i = 'function' == typeof Symbol ? Symbol : {},
o = i.iterator || '@@iterator',
c = i.asyncIterator || '@@asyncIterator',
a = i.toStringTag || '@@toStringTag',
s = 'object' == typeof t,
f = n.regeneratorRuntime;
if (f) s && (t.exports = f);
else {
(f = n.regeneratorRuntime = s ? t.exports : {}).wrap = x;
var l = 'suspendedStart',
p = 'suspendedYield',
h = 'executing',
d = 'completed',
v = {},
m = {};
m[o] = function() {
return this;
};
var y = Object.getPrototypeOf,
b = y && y(y(_([])));
b && b !== e && u.call(b, o) && (m = b);
var g = (F.prototype = j.prototype = Object.create(m));
(O.prototype = g.constructor = F),
(F.constructor = O),
(F[a] = O.displayName = 'GeneratorFunction'),
(f.isGeneratorFunction = function(t) {
var n = 'function' == typeof t && t.constructor;
return !!n && (n === O || 'GeneratorFunction' === (n.displayName || n.name));
}),
(f.mark = function(t) {
return (
Object.setPrototypeOf
? Object.setPrototypeOf(t, F)
: ((t.__proto__ = F), a in t || (t[a] = 'GeneratorFunction')),
(t.prototype = Object.create(g)),
t
);
}),
(f.awrap = function(t) {
return { __await: t };
}),
k(L.prototype),
(L.prototype[c] = function() {
return this;
}),
(f.AsyncIterator = L),
(f.async = function(t, n, r, e) {
var u = new L(x(t, n, r, e));
return f.isGeneratorFunction(n)
? u
: u.next().then(function(t) {
return t.done ? t.value : u.next();
});
}),
k(g),
(g[a] = 'Generator'),
(g[o] = function() {
return this;
}),
(g.toString = function() {
return '[object Generator]';
}),
(f.keys = function(t) {
var n = [];
for (var r in t) n.push(r);
return (
n.reverse(),
function r() {
for (; n.length; ) {
var e = n.pop();
if (e in t) return (r.value = e), (r.done = !1), r;
}
return (r.done = !0), r;
}
);
}),
(f.values = _),
(A.prototype = {
constructor: A,
reset: function(t) {
if (
((this.prev = 0),
(this.next = 0),
(this.sent = this._sent = r),
(this.done = !1),
(this.delegate = null),
(this.method = 'next'),
(this.arg = r),
this.tryEntries.forEach(N),
!t)
)
for (var n in this) 't' === n.charAt(0) && u.call(this, n) && !isNaN(+n.slice(1)) && (this[n] = r);
},
stop: function() {
this.done = !0;
var t = this.tryEntries[0].completion;
if ('throw' === t.type) throw t.arg;
return this.rval;
},
dispatchException: function(t) {
if (this.done) throw t;
var n = this;
function e(e, u) {
return (c.type = 'throw'), (c.arg = t), (n.next = e), u && ((n.method = 'next'), (n.arg = r)), !!u;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var o = this.tryEntries[i],
c = o.completion;
if ('root' === o.tryLoc) return e('end');
if (o.tryLoc <= this.prev) {
var a = u.call(o, 'catchLoc'),
s = u.call(o, 'finallyLoc');
if (a && s) {
if (this.prev < o.catchLoc) return e(o.catchLoc, !0);
if (this.prev < o.finallyLoc) return e(o.finallyLoc);
} else if (a) {
if (this.prev < o.catchLoc) return e(o.catchLoc, !0);
} else {
if (!s) throw new Error('try statement without catch or finally');
if (this.prev < o.finallyLoc) return e(o.finallyLoc);
}
}
}
},
abrupt: function(t, n) {
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
var e = this.tryEntries[r];
if (e.tryLoc <= this.prev && u.call(e, 'finallyLoc') && this.prev < e.finallyLoc) {
var i = e;
break;
}
}
i && ('break' === t || 'continue' === t) && i.tryLoc <= n && n <= i.finallyLoc && (i = null);
var o = i ? i.completion : {};
return (
(o.type = t),
(o.arg = n),
i ? ((this.method = 'next'), (this.next = i.finallyLoc), v) : this.complete(o)
);
},
complete: function(t, n) {
if ('throw' === t.type) throw t.arg;
return (
'break' === t.type || 'continue' === t.type
? (this.next = t.arg)
: 'return' === t.type
? ((this.rval = this.arg = t.arg), (this.method = 'return'), (this.next = 'end'))
: 'normal' === t.type && n && (this.next = n),
v
);
},
finish: function(t) {
for (var n = this.tryEntries.length - 1; n >= 0; --n) {
var r = this.tryEntries[n];
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), N(r), v;
}
},
catch: function(t) {
for (var n = this.tryEntries.length - 1; n >= 0; --n) {
var r = this.tryEntries[n];
if (r.tryLoc === t) {
var e = r.completion;
if ('throw' === e.type) {
var u = e.arg;
N(r);
}
return u;
}
}
throw new Error('illegal catch attempt');
},
delegateYield: function(t, n, e) {
return (
(this.delegate = { iterator: _(t), resultName: n, nextLoc: e }),
'next' === this.method && (this.arg = r),
v
);
}
});
}
function x(t, n, r, e) {
var u = n && n.prototype instanceof j ? n : j,
i = Object.create(u.prototype),
o = new A(e || []);
return (
(i._invoke = (function(t, n, r) {
var e = l;
return function(u, i) {
if (e === h) throw new Error('Generator is already running');
if (e === d) {
if ('throw' === u) throw i;
return q();
}
for (r.method = u, r.arg = i; ; ) {
var o = r.delegate;
if (o) {
var c = E(o, r);
if (c) {
if (c === v) continue;
return c;
}
}
if ('next' === r.method) r.sent = r._sent = r.arg;
else if ('throw' === r.method) {
if (e === l) throw ((e = d), r.arg);
r.dispatchException(r.arg);
} else 'return' === r.method && r.abrupt('return', r.arg);
e = h;
var a = w(t, n, r);
if ('normal' === a.type) {
if (((e = r.done ? d : p), a.arg === v)) continue;
return { value: a.arg, done: r.done };
}
'throw' === a.type && ((e = d), (r.method = 'throw'), (r.arg = a.arg));
}
};
})(t, r, o)),
i
);
}
function w(t, n, r) {
try {
return { type: 'normal', arg: t.call(n, r) };
} catch (t) {
return { type: 'throw', arg: t };
}
}
function j() {}
function O() {}
function F() {}
function k(t) {
['next', 'throw', 'return'].forEach(function(n) {
t[n] = function(t) {
return this._invoke(n, t);
};
});
}
function L(t) {
var n;
this._invoke = function(r, e) {
function i() {
return new Promise(function(n, i) {
!(function n(r, e, i, o) {
var c = w(t[r], t, e);
if ('throw' !== c.type) {
var a = c.arg,
s = a.value;
return s && 'object' == typeof s && u.call(s, '__await')
? Promise.resolve(s.__await).then(
function(t) {
n('next', t, i, o);
},
function(t) {
n('throw', t, i, o);
}
)
: Promise.resolve(s).then(
function(t) {
(a.value = t), i(a);
},
function(t) {
return n('throw', t, i, o);
}
);
}
o(c.arg);
})(r, e, n, i);
});
}
return (n = n ? n.then(i, i) : i());
};
}
function E(t, n) {
var e = t.iterator[n.method];
if (e === r) {
if (((n.delegate = null), 'throw' === n.method)) {
if (t.iterator.return && ((n.method = 'return'), (n.arg = r), E(t, n), 'throw' === n.method)) return v;
(n.method = 'throw'), (n.arg = new TypeError("The iterator does not provide a 'throw' method"));
}
return v;
}
var u = w(e, t.iterator, n.arg);
if ('throw' === u.type) return (n.method = 'throw'), (n.arg = u.arg), (n.delegate = null), v;
var i = u.arg;
return i
? i.done
? ((n[t.resultName] = i.value),
(n.next = t.nextLoc),
'return' !== n.method && ((n.method = 'next'), (n.arg = r)),
(n.delegate = null),
v)
: i
: ((n.method = 'throw'),
(n.arg = new TypeError('iterator result is not an object')),
(n.delegate = null),
v);
}
function S(t) {
var n = { tryLoc: t[0] };
1 in t && (n.catchLoc = t[1]),
2 in t && ((n.finallyLoc = t[2]), (n.afterLoc = t[3])),
this.tryEntries.push(n);
}
function N(t) {
var n = t.completion || {};
(n.type = 'normal'), delete n.arg, (t.completion = n);
}
function A(t) {
(this.tryEntries = [{ tryLoc: 'root' }]), t.forEach(S, this), this.reset(!0);
}
function _(t) {
if (t) {
var n = t[o];
if (n) return n.call(t);
if ('function' == typeof t.next) return t;
if (!isNaN(t.length)) {
var e = -1,
i = function n() {
for (; ++e < t.length; ) if (u.call(t, e)) return (n.value = t[e]), (n.done = !1), n;
return (n.value = r), (n.done = !0), n;
};
return (i.next = i);
}
}
return { next: q };
}
function q() {
return { value: r, done: !0 };
}
})(
(function() {
return this || ('object' == typeof self && self);
})() || Function('return this')()
);
},
function(t, n, r) {
var e = r(3),
u = r(2),
i = r(1).protocols,
o = r(4).sequence,
c = r(5).ensureUncompleted,
a = r(0),
s = a.isFunction,
f = a.isNumber,
l = r(6).sameValueZero,
p = i,
h = Symbol('NO_VALUE');
t.exports = {
chunk: function t(n, r) {
var i = f(n) ? [null, n] : [n, r],
a = e(i, 2),
s = a[0],
l = a[1];
return s
? o(s, t(l))
: function(t) {
return (function(t, n) {
var r,
e = 0,
i = [];
return (
u((r = {}), p.init, function() {
return n[p.init]();
}),
u(r, p.step, function(r, u) {
if (((i[e++] = u), e === t)) {
var o = i.slice(0, t);
return (i = []), (e = 0), n[p.step](r, o);
}
return r;
}),
u(r, p.result, function(t) {
return e > 0 ? c(n[p.step](t, i.slice(0, e))) : n[p.result](t);
}),
r
);
})(l, t);
};
},
chunkBy: function t(n, r, i) {
var a = s(n) ? [null, n.bind(r)] : [n, r.bind(i)],
f = e(a, 2),
d = f[0],
v = f[1];
return d
? o(d, t(v))
: function(t) {
return (function(t, n) {
var r,
e = [],
i = h;
return (
u((r = {}), p.init, function() {
return n[p.init]();
}),
u(r, p.step, function(r, u) {
var o = t(u),
c = r;
return i === h || l(o, i) ? e.push(u) : ((c = n[p.step](c, e)), (e = [u])), (i = o), c;
}),
u(r, p.result, function(t) {
var r = e.length;
return r > 0 ? c(n[p.step](t, e.slice(0, r))) : n[p.result](t);
}),
r
);
})(v, t);
};
}
};
},
function(t, n, r) {
var e = r(3),
u = r(2),
i = r(1).protocols,
o = r(4).sequence,
c = r(0).isFunction,
a = r(6).sameValueZero,
s = i,
f = Symbol('NO_VALUE');
function l(t, n, r) {
var i = c(t) ? [null, t.bind(n)] : [t, n.bind(r)],
a = e(i, 2),
p = a[0],
h = a[1];
return p
? o(p, l(h))
: function(t) {
return (function(t, n) {
var r,
e = f;
return (
u((r = {}), s.init, function() {
return n[s.init]();
}),
u(r, s.step, function(r, u) {
return e !== f && t(u, e) ? r : ((e = u), n[s.step](r, u));
}),
u(r, s.result, function(t) {
return n[s.result](t);
}),
r
);
})(h, t);
};
}
t.exports = {
distinct: function(t) {
return l(t, a);
},
distinctBy: function(t, n, r) {
var u = c(t) ? [null, t.bind(n)] : [t, n.bind(r)],
i = e(u, 2),
o = i[0],
s = i[1];
return l(o, function(t, n) {
return a(s(t), s(n));
});
},
distinctWith: l
};
},
function(t, n, r) {
var e = r(3),
u = r(2),
i = r(1).protocols,
o = r(4).sequence,
c = r(0),
a = c.isNumber,
s = c.isFunction,
f = i;
t.exports = {
drop: function t(n, r) {
var i = a(n) ? [null, n] : [n, r],
c = e(i, 2),
s = c[0],
l = c[1];
return s
? o(s, t(l))
: function(t) {
return (function(t, n) {
var r,
e = 0;
return (
u((r = {}), f.init, function() {
return n[f.init]();
}),
u(r, f.step, function(r, u) {
return e++ < t ? r : n[f.step](r, u);
}),
u(r, f.result, function(t) {
return n[f.result](t);
}),
r
);
})(l, t);
};
},
dropWhile: function t(n, r, i) {
var c = s(n) ? [null, n.bind(r)] : [n, r.bind(i)],
a = e(c, 2),
l = a[0],
p = a[1];
return l
? o(l, t(p))
: function(t) {
return (function(t, n) {
var r,
e = !0;
return (
u((r = {}), f.init, function() {
return n[f.init]();
}),
u(r, f.step, function(r, u) {
if (e) {
if (t(u)) return r;
e = !1;
}
return n[f.step](r, u);
}),
u(r, f.result, function(t) {
return n[f.result](t);
}),
r
);
})(p, t);
};
}
};
},
function(t, n, r) {
var e = r(3),
u = r(2),
i = r(1).protocols,
o = r(4).sequence,
c = r(0),
a = c.isFunction,
s = c.complement,
f = i;
function l(t, n, r) {
var i = a(t) ? [null, t.bind(n)] : [t, n.bind(r)],
c = e(i, 2),
s = c[0],
p = c[1];
return s
? o(s, l(p))
: function(t) {
return (function(t, n) {
var r;
return (
u((r = {}), f.init, function() {
return n[f.init]();
}),
u(r, f.step, function(r, e) {
return t(e) ? n[f.step](r, e) : r;
}),
u(r, f.result, function(t) {
return n[f.result](t);
}),
r
);
})(p, t);
};
}
t.exports = {
filter: l,
reject: function(t, n, r) {
var u = a(t) ? [null, t.bind(n)] : [t, n.bind(r)],
i = e(u, 2),
o = i[0],
c = i[1];
return l(o, s(c));
},
compact: function(t) {
return l(t, function(t) {
return !!t;
});
}
};
},
function(t, n, r) {
var e = r(3),
u = r(2),
i = r(1).protocols,
o = r(4),
c = o.sequence,
a = o.compose,
s = r(0).isFunction,
f = r(6).flatten,
l = i;
function p(t, n, r) {
var i = s(t) ? [null, t.bind(n)] : [t, n.bind(r)],
o = e(i, 2),
a = o[0],
f = o[1];
return a
? c(a, p(f))
: function(t) {
return (function(t, n) {
var r;
return (
u((r = {}), l.init, function() {
return n[l.init]();
}),
u(r, l.step, function(r, e) {
return n[l.step](r, t(e));
}),
u(r, l.result, function(t) {
return n[l.result](t);
}),
r
);
})(f, t);
};
}
t.exports = {
map: p,
flatMap: function(t, n, r) {
var u = s(t) ? [null, t.bind(n)] : [t, n.bind(r)],
i = e(u, 2),
o = i[0],
l = i[1];
return o ? c(o, a(p(l), f())) : a(p(l), f());
}
};
},
function(t, n, r) {
var e = r(3),
u = r(2),
i = r(1).protocols,
o = r(5).ensureCompleted,
c = r(4).sequence,
a = r(0),
s = a.isNumber,
f = a.isFunction,
l = i;
t.exports = {
take: function t(n, r) {
var i = s(n) ? [null, n] : [n, r],
a = e(i, 2),
f = a[0],
p = a[1];
return f
? c(f, t(p))
: function(t) {
return (function(t, n) {
var r,
e = 0;
return (
u((r = {}), l.init, function() {
return n[l.init]();
}),
u(r, l.step, function(r, u) {
var i = r;
return e < t && ((i = n[l.step](r, u)), e === t - 1 && (i = o(i))), e++, i;
}),
u(r, l.result, function(t) {
return n[l.result](t);
}),
r
);
})(p, t);
};
},
takeWhile: function t(n, r, i) {
var a = f(n) ? [null, n.bind(r)] : [n, r.bind(i)],
s = e(a, 2),
p = s[0],
h = s[1];
return p
? c(p, t(h))
: function(t) {
return (function(t, n) {
var r;
return (
u((r = {}), l.init, function() {
return n[l.init]();
}),
u(r, l.step, function(r, e) {
return t(e) ? n[l.step](r, e) : o(r);
}),
u(r, l.result, function(t) {
return n[l.result](t);
}),
r
);
})(h, t);
};
},
takeNth: function t(n, r) {
var i = s(n) ? [null, n] : [n, r],
o = e(i, 2),
a = o[0],
f = o[1];
return a
? c(a, t(f))
: function(t) {
return (function(t, n) {
var r,
e = -1;
return (
u((r = {}), l.init, function() {
return n[l.init]();
}),
u(r, l.step, function(r, u) {
return ++e % t == 0 ? n[l.step](r, u) : r;
}),
u(r, l.result, function(t) {
return n[l.result](t);
}),
r
);
})(f, t);
};
}
};
},
function(t, n, r) {
var e = r(3),
u = r(2),
i = r(1).protocols,
o = r(4).sequence,
c = r(0).isFunction,
a = r(6).sameValueZero,
s = i;
function f(t, n, r) {
var i = c(t) ? [null, t.bind(n)] : [t, n.bind(r)],
a = e(i, 2),
l = a[0],
p = a[1];
return l
? o(l, f(p))
: function(t) {
return (function(t, n) {
var r,
e = [];
return (
u((r = {}), s.init, function() {
return n[s.init]();
}),
u(r, s.step, function(r, u) {
return e.some(function(n) {
return t(u, n);
})
? r
: (e.push(u), n[s.step](r, u));
}),
u(r, s.result, function(t) {
return n[s.result](t);
}),
r
);
})(p, t);
};
}
t.exports = {
unique: function(t) {
return f(t, a);
},
uniqueBy: function(t, n, r) {
var u = c(t) ? [null, t.bind(n)] : [t, n.bind(r)],
i = e(u, 2),
o = i[0],
s = i[1];
return f(o, function(t, n) {
return a(s(t), s(n));
});
},
uniqueWith: f
};
}
]);
});