Skip to content

Instantly share code, notes, and snippets.

@trashhalo
Created March 30, 2019 16:30
Show Gist options
  • Save trashhalo/d02c1dda8978202efed11a0af17bc4e7 to your computer and use it in GitHub Desktop.
Save trashhalo/d02c1dda8978202efed11a0af17bc4e7 to your computer and use it in GitHub Desktop.
(function() {
var jb = ["Out_of_memory", 0],
$a = ["Sys_error", -1],
Q = ["Failure", -2],
$ = ["Invalid_argument", -3],
Ea = ["End_of_file", -4],
Y = ["Division_by_zero", -5],
V = ["Not_found", -6],
Fa = ["Match_failure", -7],
Pa = ["Stack_overflow", -8],
ib = ["Sys_blocked_io", -9],
ma = ["Assert_failure", -10],
Ca = ["Undefined_recursive_module", -11];
(jb.tag = 248),
($a.tag = 248),
(Q.tag = 248),
($.tag = 248),
(Ea.tag = 248),
(Y.tag = 248),
(V.tag = 248),
(Fa.tag = 248),
(Pa.tag = 248),
(ib.tag = 248),
(ma.tag = 248),
(Ca.tag = 248);
var x = Q;
var F = $;
var Ha = Y;
var t = V;
var Sa = ma;
function Va(a, r, $) {
for (var n = new Array($), t = 0, _ = r; t < $; )
(n[t] = a[_]), (t = (t + 1) | 0), (_ = (_ + 1) | 0);
return n;
}
var _ = Va;
function l(r, c) {
for (;;) {
var $ = c,
t = r,
e = t.length,
a = 0 === e ? 1 : e,
n = (a - $.length) | 0;
if (0 === n) return t.apply(null, $);
if (!(n < 0))
return (function(r, c) {
return function($) {
return l(r, c.concat([$]));
};
})(t, $);
(c = _($, a, 0 | -n)), (r = t.apply(null, _($, 0, a)));
}
}
function kb(r, c, $) {
switch ($) {
case 1:
return r(c);
case 2:
return function($) {
return r(c, $);
};
case 3:
return function($, t) {
return r(c, $, t);
};
case 4:
return function($, t, e) {
return r(c, $, t, e);
};
case 5:
return function($, t, e, a) {
return r(c, $, t, e, a);
};
case 6:
return function($, t, e, a, n) {
return r(c, $, t, e, a, n);
};
case 7:
return function($, t, e, a, n, u) {
return r(c, $, t, e, a, n, u);
};
default:
return l(r, [c]);
}
}
function xa(r, c) {
var $ = r.length;
return 1 === $ ? r(c) : kb(r, c, $);
}
function ya(r, c, $, t) {
switch (t) {
case 1:
return l(r(c), [$]);
case 2:
return r(c, $);
case 3:
return function(t) {
return r(c, $, t);
};
case 4:
return function(t, e) {
return r(c, $, t, e);
};
case 5:
return function(t, e, a) {
return r(c, $, t, e, a);
};
case 6:
return function(t, e, a, n) {
return r(c, $, t, e, a, n);
};
case 7:
return function(t, e, a, n, u) {
return r(c, $, t, e, a, n, u);
};
default:
return l(r, [c, $]);
}
}
function za(r, c, $) {
var t = r.length;
return 2 === t ? r(c, $) : ya(r, c, $, t);
}
function Aa(r, c, $, t, e) {
switch (e) {
case 1:
return l(r(c), [$, t]);
case 2:
return l(r(c, $), [t]);
case 3:
return r(c, $, t);
case 4:
return function(e) {
return r(c, $, t, e);
};
case 5:
return function(e, a) {
return r(c, $, t, e, a);
};
case 6:
return function(e, a, n) {
return r(c, $, t, e, a, n);
};
case 7:
return function(e, a, n, u) {
return r(c, $, t, e, a, n, u);
};
default:
return l(r, [c, $, t]);
}
}
function Ba(r, c, $, t) {
var e = r.length;
return 3 === e ? r(c, $, t) : Aa(r, c, $, t, e);
}
var j = xa;
var D = za;
var Z = Ba;
function Ga(r, a) {
return (a.tag = r), a;
}
var b = Ga;
function Ja(m, $) {
return m < $ ? -1 : m === $ ? 0 : 1;
}
function Ka(m, $) {
return m ? ($ ? 0 : 1) : $ ? -1 : 0;
}
function La(m, $) {
return m === $ ? 0 : m < $ ? -1 : 1;
}
function Na(m, $) {
return m > $ ? m : $;
}
var K = Ja;
var Qa = Ka;
var T = La;
var Ta = Na;
var d = {};
function Wa(a, r) {
var $ = new Array(r);
return ($.tag = a), $;
}
function bb(a) {
for (
var r = 0 | a.length, $ = new Array(r), e = 0, t = (r - 1) | 0;
e <= t;
++e
)
$[e] = a[e];
return ($.tag = 0 | a.tag), $;
}
function cb(a, r) {
var $ = 0 | a.length;
if (r <= 0 || r > $) throw [F, "Obj.truncate"];
if ($ !== r) {
for (var e = r, t = ($ - 1) | 0; e <= t; ++e) a[e] = 0;
return (a.length = r), 0;
}
return 0;
}
function db(a) {
return b(250, [a]);
}
function eb(a, r) {
for (var $ = 0, e = ((0 | r.length) - 1) | 0; $ <= e; ++$) a[$] = r[$];
var t = 0 | r.tag;
return 0 !== t ? ((a.tag = t), 0) : 0;
}
function J(a, r) {
for (var $ in a) r($);
}
function I(a, r) {
for (;;) {
var $ = r,
e = a;
if (e === $) return 0;
var t = typeof e,
l = typeof $,
n = 0;
switch (t) {
case "boolean":
if ("boolean" === l) return Qa(e, $);
n = 1;
break;
case "function":
if ("function" === l) throw [F, "compare: functional value"];
n = 1;
break;
case "number":
if ("number" === l) return K(e, $);
n = 1;
break;
case "string":
return "string" === l ? T(e, $) : 1;
case "undefined":
return -1;
default:
n = 1;
}
if (1 === n)
switch (l) {
case "string":
return -1;
case "undefined":
return 1;
default:
if ("boolean" === t) return 1;
if ("boolean" === l) return -1;
if ("function" === t) return 1;
if ("function" === l) return -1;
if ("number" === t) return null === $ || 256 === $.tag ? 1 : -1;
if ("number" === l) return null === e || 256 === e.tag ? -1 : 1;
if (null === e) return 256 === $.tag ? 1 : -1;
if (null === $) return 256 === e.tag ? -1 : 1;
var u = 0 | e.tag,
c = 0 | $.tag;
if (250 === u) {
a = e[0];
continue;
}
if (250 === c) {
r = $[0];
continue;
}
if (256 === u) return 256 === c ? K(e[1], $[1]) : -1;
if (248 === u) return K(e[1], $[1]);
if (251 === u) throw [F, "equal: abstract value"];
if (u !== c) return u < c ? -1 : 1;
var _ = 0 | e.length,
o = 0 | $.length;
if (_ === o) {
if (!Array.isArray(e)) {
var m = e,
i = $,
v = [void 0],
G = [void 0],
H = function(a, r) {
var $ = a[2],
e = a[1];
if (!e.hasOwnProperty(r) || I(a[0][r], e[r]) > 0) {
var t = $[0];
return void 0 !== t && r >= t ? 0 : (($[0] = r), 0);
}
return 0;
},
W = (function(a) {
return function(r) {
return H(a, r);
};
})([m, i, G]),
f = (function(a) {
return function(r) {
return H(a, r);
};
})([i, m, v]);
J(m, W), J(i, f);
var p = v[0],
s = G[0];
return void 0 !== p
? void 0 !== s
? T(p, s)
: -1
: void 0 !== s
? 1
: 0;
}
for (var x = e, b = $, d = 0, g = _; ; ) {
var q = d;
if (q === g) return 0;
var h = I(x[q], b[q]);
if (0 !== h) return h;
d = (q + 1) | 0;
}
} else if (_ < o)
for (var j = e, y = $, w = 0, k = _; ; ) {
var C = w;
if (C === k) return -1;
var A = I(j[C], y[C]);
if (0 !== A) return A;
w = (C + 1) | 0;
}
else
for (var z = e, O = $, P = 0, B = o; ; ) {
var D = P;
if (D === B) return 1;
var E = I(z[D], O[D]);
if (0 !== E) return E;
P = (D + 1) | 0;
}
}
}
}
function q(a, r) {
for (;;) {
var $ = r,
e = a;
if (e === $) return !0;
var t = typeof e;
if (
"string" === t ||
"number" === t ||
"boolean" === t ||
"undefined" === t ||
null === e
)
return !1;
var l = typeof $;
if ("function" === t || "function" === l)
throw [F, "equal: functional value"];
if ("number" === l || "undefined" === l || null === $) return !1;
var n = 0 | e.tag,
u = 0 | $.tag;
if (250 !== n) {
if (250 !== u) {
if (248 === n) return e[1] === $[1];
if (251 === n) throw [F, "equal: abstract value"];
if (n !== u) return !1;
if (256 === n) return e[1] === $[1];
var c = 0 | e.length;
if (c !== (0 | $.length)) return !1;
if (!Array.isArray(e)) {
var _ = e,
o = $,
m = [!0],
i = (function(a, r) {
return function($) {
return a.hasOwnProperty($) ? 0 : ((r[0] = !1), 0);
};
})(o, m),
v = (function(a, r, $) {
return function(e) {
return a.hasOwnProperty(e) && q(r[e], a[e])
? 0
: (($[0] = !1), 0);
};
})(_, o, m);
return J(_, i), m[0] && J(o, v), m[0];
}
for (var G = e, H = $, W = 0, f = c; ; ) {
var p = W;
if (p === f) return !0;
if (!q(G[p], H[p])) return !1;
W = (p + 1) | 0;
}
} else r = $[0];
} else a = e[0];
}
}
function mb(a, r) {
return null !== r ? q(a, r) : a === r;
}
function nb(a, r) {
return void 0 !== r ? q(a, r) : a === r;
}
function ob(a, r) {
return null == r ? a === r : q(a, r);
}
function pb(a, r) {
return !q(a, r);
}
function tb(a, r) {
return I(a, r) >= 0;
}
function vb(a, r) {
return I(a, r) > 0;
}
function wb(a, r) {
return I(a, r) <= 0;
}
function xb(a, r) {
return I(a, r) < 0;
}
function Db(a, r) {
return I(a, r) <= 0 ? a : r;
}
function Eb(a, r) {
return I(a, r) >= 0 ? a : r;
}
function Ib(a, r) {
return (a.tag = r), 0;
}
var Tb = Wa;
d.caml_obj_block = Tb;
var Ub = bb;
d.caml_obj_dup = Ub;
var Wb = cb;
d.caml_obj_truncate = Wb;
var Yb = db;
d.caml_lazy_make_forward = Yb;
var Zb = eb;
d.caml_update_dummy = Zb;
var $b = I;
d.caml_compare = $b;
var _b = q;
d.caml_equal = _b;
var ac = mb;
d.caml_equal_null = ac;
var na = nb;
d.caml_equal_undefined = na;
var oa = ob;
d.caml_equal_nullable = oa;
var pa = pb;
d.caml_notequal = pa;
var qa = tb;
d.caml_greaterequal = qa;
var ra = vb;
d.caml_greaterthan = ra;
var sa = xb;
d.caml_lessthan = sa;
var ta = wb;
d.caml_lessequal = ta;
var ua = Db;
d.caml_min = ua;
var va = Eb;
d.caml_max = va;
var wa = Ib;
d.caml_obj_set_tag = wa;
var n,
o,
e = {};
function u() {
throw new Error("setTimeout has not been defined");
}
function y() {
throw new Error("clearTimeout has not been defined");
}
function R($) {
if (n === setTimeout) return setTimeout($, 0);
if ((n === u || !n) && setTimeout)
return (n = setTimeout), setTimeout($, 0);
try {
return n($, 0);
} catch (e) {
try {
return n.call(null, $, 0);
} catch (e) {
return n.call(this, $, 0);
}
}
}
function Da($) {
if (o === clearTimeout) return clearTimeout($);
if ((o === y || !o) && clearTimeout)
return (o = clearTimeout), clearTimeout($);
try {
return o($);
} catch (e) {
try {
return o.call(null, $);
} catch (e) {
return o.call(this, $);
}
}
}
!(function() {
try {
n = "function" == typeof setTimeout ? setTimeout : u;
} catch ($) {
n = u;
}
try {
o = "function" == typeof clearTimeout ? clearTimeout : y;
} catch ($) {
o = y;
}
})();
var r,
m = [],
s = !1,
U = -1;
function Ia() {
s &&
r &&
((s = !1), r.length ? (m = r.concat(m)) : (U = -1), m.length && ka());
}
function ka() {
if (!s) {
var $ = R(Ia);
s = !0;
for (var e = m.length; e; ) {
for (r = m, m = []; ++U < e; ) r && r[U].run();
(U = -1), (e = m.length);
}
(r = null), (s = !1), Da($);
}
}
function la($, e) {
(this.fun = $), (this.array = e);
}
function i() {}
(e.nextTick = function($) {
var e = new Array(arguments.length - 1);
if (arguments.length > 1)
for (var r = 1; r < arguments.length; r++) e[r - 1] = arguments[r];
m.push(new la($, e)), 1 !== m.length || s || R(ka);
}),
(la.prototype.run = function() {
this.fun.apply(null, this.array);
}),
(e.title = "browser"),
(e.env = {}),
(e.argv = []),
(e.version = ""),
(e.versions = {}),
(e.on = i),
(e.addListener = i),
(e.once = i),
(e.off = i),
(e.removeListener = i),
(e.removeAllListeners = i),
(e.emit = i),
(e.prependListener = i),
(e.prependOnceListener = i),
(e.listeners = function($) {
return [];
}),
(e.binding = function($) {
throw new Error("process.binding is not supported");
}),
(e.cwd = function() {
return "/";
}),
(e.chdir = function($) {
throw new Error("process.chdir is not supported");
}),
(e.umask = function() {
return 0;
});
var Yc =
Math.imul ||
function($, n) {
return (((($ >> 16) * (n |= 0)) << 16) + (65535 & $) * n) | 0;
};
var A = [-2147483648, 0],
Oa = [2147483647, 1],
w = [0, 1],
k = [0, 0],
Ra = [-1, 4294967295];
function p($) {
return 0 != (2147483648 & $);
}
function z($, a) {
var r = a[1],
e = $[1],
t = (e + r) & 4294967295,
o = (p(e) && (p(r) || !p(t))) || (p(r) && !p(t)) ? 1 : 0;
return [($[0] + a[0] + o) & 4294967295, t >>> 0];
}
function Ua($) {
return [-1 ^ $[0], (-1 ^ $[1]) >>> 0];
}
function C($, a) {
return $[0] === a[0] && $[1] === a[1];
}
function h($) {
return C($, A) ? A : z(Ua($), w);
}
function Xa($, a) {
if (0 === a) return $;
var r = $[1];
return a >= 32
? [r << ((a - 32) | 0), 0]
: [(r >>> ((32 - a) | 0)) | ($[0] << a), (r << a) >>> 0];
}
function Ya($, a) {
if (0 === a) return $;
var r = $[0];
return a < 32
? [r >> a, ((r << ((32 - a) | 0)) | ($[1] >>> a)) >>> 0]
: [r >= 0 ? 0 : -1, (r >> ((a - 32) | 0)) >>> 0];
}
function Za($) {
return 0 === $[0] && 0 === $[1];
}
function B($, a) {
for (;;) {
var r,
e = a,
t = $,
o = 0,
y = t[0],
n = 0,
v = 0;
if (0 === y && 0 === t[1]) return k;
if (4 === 4) {
if (0 === e[0] && 0 === e[1]) return k;
v = 3;
}
if (
(3 === v &&
(-2147483648 !== y || 0 !== t[1] ? (n = 2) : ((r = e[1]), (o = 1))),
2 === n)
) {
var i = e[0],
_ = t[1],
u = 0;
if (
(-2147483648 !== i || 0 !== e[1] ? (u = 3) : ((r = _), (o = 1)),
3 === u)
) {
var p = e[1];
if (y < 0) {
if (i < 0) {
(a = h(e)), ($ = h(t));
continue;
}
return h(B(h(t), e));
}
if (i < 0) return h(B(t, h(e)));
var x = 65535 & y,
l = _ >>> 16,
f = 65535 & _,
s = 65535 & i,
d = p >>> 16,
m = 65535 & p,
c = 0,
g = 0,
q = 0,
b = f * m;
return (
(c =
(g =
(g = (q = (b >>> 16) + l * m) >>> 16) +
((q = (65535 & q) + f * d) >>> 16) +
x * m) >>> 16),
(c += (g = (65535 & g) + l * d) >>> 16),
(c += (g = (65535 & g) + f * s) >>> 16),
[
(g &= 65535) |
((c =
(c + ((y >>> 16) * m + x * d + l * s + f * (i >>> 16))) &
65535) <<
16),
((65535 & b) | ((65535 & q) << 16)) >>> 0
]
);
}
}
if (1 === o) return 0 == (1 & r) ? k : A;
}
}
function _a($, a) {
var r = a[0],
e = $[0];
return e > r || (!(e < r) && $[1] >= a[1]);
}
function ab($, a) {
return $[0] > a[0] || (!($[0] < a[0]) && $[1] > a[1]);
}
function P($) {
return 4294967296 * $[0] + $[1];
}
function O($) {
return isNaN($) || !isFinite($)
? k
: $ <= -0x8000000000000000
? A
: $ + 1 >= 0x8000000000000000
? Oa
: $ < 0
? h(O(-$))
: [($ / 4294967296) | 0, ($ % 4294967296 | 0) >>> 0];
}
function H($, a) {
for (;;) {
var r = a,
e = $,
t = e[0],
o = 0;
if (0 === r[0] && 0 === r[1]) throw Ha;
if (2 === 2)
if (-2147483648 !== t) {
if (0 === t && 0 === e[1]) return k;
o = 1;
} else if (0 !== e[1]) o = 1;
else {
if (C(r, w) || C(r, Ra)) return e;
if (C(r, A)) return w;
var y = r[0],
n = Xa(H(Ya(e, 1), r), 1);
if (0 === n[0] && 0 === n[1]) return y < 0 ? w : h(w);
if (3 === 3) {
var v = z(e, h(B(r, n)));
return z(n, H(v, r));
}
}
if (1 === o) {
var i = r[0];
if (-2147483648 === i && 0 === r[1]) return k;
if (2 === 2) {
if (t < 0) {
if (i < 0) {
(a = h(r)), ($ = h(e));
continue;
}
return h(H(h(e), r));
}
if (i < 0) return h(H(e, h(r)));
for (var _ = k, u = e; _a(u, r); ) {
for (
var p = Ta(1, Math.floor(P(u) / P(r))),
x = Math.ceil(Math.log(p) / Math.LN2),
l = x <= 48 ? 1 : Math.pow(2, x - 48),
f = O(p),
s = B(f, r);
s[0] < 0 || ab(s, u);
)
s = B((f = O((p -= l))), r);
Za(f) && (f = w), (_ = z(_, f)), (u = z(u, h(s)));
}
return _;
}
}
}
}
var S = [0];
function fb($) {
return (S[0] += 1), S[0];
}
function gb($) {
var r = [$, fb(0)];
return (r.tag = 248), r;
}
var hb = gb;
function f($) {
if ("number" == typeof $) return 0;
switch (0 | $.tag) {
case 0:
return b(0, [f($[0])]);
case 1:
return b(1, [f($[0])]);
case 2:
return b(2, [f($[0])]);
case 3:
return b(3, [f($[0])]);
case 4:
return b(4, [f($[0])]);
case 5:
return b(5, [f($[0])]);
case 6:
return b(6, [f($[0])]);
case 7:
return b(7, [f($[0])]);
case 8:
return b(8, [$[0], f($[1])]);
case 9:
var r = $[0];
return b(9, [r, r, f($[2])]);
case 10:
return b(10, [f($[0])]);
case 11:
return b(11, [f($[0])]);
case 12:
return b(12, [f($[0])]);
case 13:
return b(13, [f($[0])]);
case 14:
return b(14, [f($[0])]);
}
}
function g($, r) {
if ("number" == typeof $) return r;
switch (0 | $.tag) {
case 0:
return b(0, [g($[0], r)]);
case 1:
return b(1, [g($[0], r)]);
case 2:
return b(2, [g($[0], r)]);
case 3:
return b(3, [g($[0], r)]);
case 4:
return b(4, [g($[0], r)]);
case 5:
return b(5, [g($[0], r)]);
case 6:
return b(6, [g($[0], r)]);
case 7:
return b(7, [g($[0], r)]);
case 8:
return b(8, [$[0], g($[1], r)]);
case 9:
return b(9, [$[0], $[1], g($[2], r)]);
case 10:
return b(10, [g($[0], r)]);
case 11:
return b(11, [g($[0], r)]);
case 12:
return b(12, [g($[0], r)]);
case 13:
return b(13, [g($[0], r)]);
case 14:
return b(14, [g($[0], r)]);
}
}
function c($, r) {
if ("number" == typeof $) return r;
switch (0 | $.tag) {
case 0:
return b(0, [c($[0], r)]);
case 1:
return b(1, [c($[0], r)]);
case 2:
return b(2, [$[0], c($[1], r)]);
case 3:
return b(3, [$[0], c($[1], r)]);
case 4:
return b(4, [$[0], $[1], $[2], c($[3], r)]);
case 5:
return b(5, [$[0], $[1], $[2], c($[3], r)]);
case 6:
return b(6, [$[0], $[1], $[2], c($[3], r)]);
case 7:
return b(7, [$[0], $[1], $[2], c($[3], r)]);
case 8:
return b(8, [$[0], $[1], $[2], c($[3], r)]);
case 9:
return b(9, [c($[0], r)]);
case 10:
return b(10, [c($[0], r)]);
case 11:
return b(11, [$[0], c($[1], r)]);
case 12:
return b(12, [$[0], c($[1], r)]);
case 13:
return b(13, [$[0], $[1], c($[2], r)]);
case 14:
return b(14, [$[0], $[1], c($[2], r)]);
case 15:
return b(15, [c($[0], r)]);
case 16:
return b(16, [c($[0], r)]);
case 17:
return b(17, [$[0], c($[1], r)]);
case 18:
return b(18, [$[0], c($[1], r)]);
case 19:
return b(19, [c($[0], r)]);
case 20:
return b(20, [$[0], $[1], c($[2], r)]);
case 21:
return b(21, [$[0], c($[1], r)]);
case 22:
return b(22, [c($[0], r)]);
case 23:
return b(23, [$[0], c($[1], r)]);
case 24:
return b(24, [$[0], $[1], c($[2], r)]);
}
}
var Xc = hb("Pervasives.Exit");
function W($, r) {
return $ ? [$[0], W($[1], r)] : r;
}
var X = W;
var a = {};
function L($) {
for (var r = 0, f = $; ; ) {
var a = r;
if (!f) return a;
(f = f[1]), (r = (a + 1) | 0);
}
}
function qb($) {
if ($) return $[0];
throw [x, "hd"];
}
function rb($) {
if ($) return $[1];
throw [x, "tl"];
}
function sb($, r) {
if (r < 0) throw [F, "List.nth"];
for (var f = $, a = r; ; ) {
var e = a,
t = f;
if (!t) throw [x, "nth"];
if (0 === e) return t[0];
(a = (e - 1) | 0), (f = t[1]);
}
}
function E($, r) {
for (;;) {
var f = r,
a = $;
if (!a) return f;
(r = [a[0], f]), ($ = a[1]);
}
}
function ub($) {
return E($, 0);
}
function M($) {
return $ ? X($[0], M($[1])) : 0;
}
function aa($, r) {
return r ? [j($, r[0]), aa($, r[1])] : 0;
}
function ba($, r, f) {
return f ? [D(r, $, f[0]), ba(($ + 1) | 0, r, f[1])] : 0;
}
function yb($, r) {
return ba(0, $, r);
}
function zb($, r) {
for (var f = 0, a = r; ; ) {
var e = a,
t = f;
if (!e) return t;
(a = e[1]), (f = [j($, e[0]), t]);
}
}
function Ab($, r) {
for (;;) {
var f = r;
if (!f) return 0;
j($, f[0]), (r = f[1]);
}
}
function Bb($, r) {
for (var f = 0, a = $, e = r; ; ) {
var t = e,
i = f;
if (!t) return 0;
D(a, i, t[0]), (e = t[1]), (f = (i + 1) | 0);
}
}
function Cb($, r, f) {
for (;;) {
var a = f,
e = r;
if (!a) return e;
(f = a[1]), (r = D($, e, a[0]));
}
}
function ca($, r, f) {
return r ? D($, r[0], ca($, r[1], f)) : f;
}
function da($, r, f) {
if (r) {
if (f) return [D($, r[0], f[0]), da($, r[1], f[1])];
throw [F, "List.map2"];
}
if (f) throw [F, "List.map2"];
return 0;
}
function Fb($, r, f) {
for (var a = 0, e = r, t = f; ; ) {
var i = t,
v = e,
o = a;
if (v) {
if (i) {
(t = i[1]), (e = v[1]), (a = [D($, v[0], i[0]), o]);
continue;
}
throw [F, "List.rev_map2"];
}
if (i) throw [F, "List.rev_map2"];
return o;
}
}
function Gb($, r, f) {
for (;;) {
var a = f,
e = r;
if (e) {
if (a) {
D($, e[0], a[0]), (f = a[1]), (r = e[1]);
continue;
}
throw [F, "List.iter2"];
}
if (a) throw [F, "List.iter2"];
return 0;
}
}
function Hb($, r, f, a) {
for (;;) {
var e = a,
t = f,
i = r;
if (t) {
if (e) {
(a = e[1]), (f = t[1]), (r = Z($, i, t[0], e[0]));
continue;
}
throw [F, "List.fold_left2"];
}
if (e) throw [F, "List.fold_left2"];
return i;
}
}
function ea($, r, f, a) {
if (r) {
if (f) return Z($, r[0], f[0], ea($, r[1], f[1], a));
throw [F, "List.fold_right2"];
}
if (f) throw [F, "List.fold_right2"];
return a;
}
function Jb($, r) {
for (;;) {
var f = r;
if (f) {
if (j($, f[0])) {
r = f[1];
continue;
}
return !1;
}
return !0;
}
}
function Kb($, r) {
for (;;) {
var f = r;
if (!f) return !1;
if (j($, f[0])) return !0;
r = f[1];
}
}
function Lb($, r, f) {
for (;;) {
var a = f,
e = r;
if (e) {
if (a) {
if (D($, e[0], a[0])) {
(f = a[1]), (r = e[1]);
continue;
}
return !1;
}
throw [F, "List.for_all2"];
}
if (a) throw [F, "List.for_all2"];
return !0;
}
}
function Mb($, r, f) {
for (;;) {
var a = f,
e = r;
if (e) {
if (a) {
if (D($, e[0], a[0])) return !0;
(f = a[1]), (r = e[1]);
continue;
}
throw [F, "List.exists2"];
}
if (a) throw [F, "List.exists2"];
return !1;
}
}
function Nb($, r) {
for (;;) {
var f = r;
if (!f) return !1;
if (d.caml_equal(f[0], $)) return !0;
r = f[1];
}
}
function Ob($, r) {
for (;;) {
var f = r;
if (!f) return !1;
if (f[0] === $) return !0;
r = f[1];
}
}
function Pb($, r) {
for (;;) {
var f = r;
if (!f) throw t;
var a = f[0];
if (d.caml_equal(a[0], $)) return a[1];
r = f[1];
}
}
function Qb($, r) {
for (;;) {
var f = r;
if (!f) throw t;
var a = f[0];
if (a[0] === $) return a[1];
r = f[1];
}
}
function Rb($, r) {
for (;;) {
var f = r;
if (!f) return !1;
if (d.caml_equal(f[0][0], $)) return !0;
r = f[1];
}
}
function Sb($, r) {
for (;;) {
var f = r;
if (!f) return !1;
if (f[0][0] === $) return !0;
r = f[1];
}
}
function fa($, r) {
if (r) {
var f = r[1],
a = r[0];
return d.caml_equal(a[0], $) ? f : [a, fa($, f)];
}
return 0;
}
function ga($, r) {
if (r) {
var f = r[1],
a = r[0];
return a[0] === $ ? f : [a, ga($, f)];
}
return 0;
}
function Vb($, r) {
for (;;) {
var f = r;
if (!f) throw t;
var a = f[0];
if (j($, a)) return a;
r = f[1];
}
}
function ha($) {
return function(r) {
for (var f = 0, a = r; ; ) {
var e = a,
t = f;
if (!e) return E(t, 0);
var i = e[1],
v = e[0];
j($, v) ? ((a = i), (f = [v, t])) : (a = i);
}
};
}
function Xb($, r) {
for (var f = 0, a = 0, e = r; ; ) {
var t = e,
i = a,
v = f;
if (!t) return [E(v, 0), E(i, 0)];
var o = t[1],
n = t[0];
j($, n) ? ((e = o), (f = [n, v])) : ((e = o), (a = [n, i]));
}
}
function ia($) {
if ($) {
var r = $[0],
f = ia($[1]);
return [[r[0], f[0]], [r[1], f[1]]];
}
return [0, 0];
}
function ja($, r) {
if ($) {
if (r) return [[$[0], r[0]], ja($[1], r[1])];
throw [F, "List.combine"];
}
if (r) throw [F, "List.combine"];
return 0;
}
function N($, r, f) {
if (r) {
if (f) {
var a = f[0],
e = r[0];
return D($, e, a) <= 0 ? [e, N($, r[1], f)] : [a, N($, r, f[1])];
}
return r;
}
return f;
}
function G($, r) {
for (;;) {
var f = r,
a = $;
if (0 === a) return f;
if (!f) throw [Sa, ["list.ml", 223, 11]];
(r = f[1]), ($ = (a - 1) | 0);
}
}
function v($, r) {
var f = function(r, f) {
var e = 0;
if (2 !== r) {
if (3 === r && f) {
var t = f[1];
if (t) {
var i = t[1];
if (i) {
var v = i[0],
o = t[0],
n = f[0];
return D($, n, o) <= 0
? D($, o, v) <= 0
? [n, [o, [v, 0]]]
: D($, n, v) <= 0
? [n, [v, [o, 0]]]
: [v, [n, [o, 0]]]
: D($, n, v) <= 0
? [o, [n, [v, 0]]]
: D($, o, v) <= 0
? [o, [v, [n, 0]]]
: [v, [o, [n, 0]]];
}
e = 1;
} else e = 1;
} else e = 1;
} else if (f) {
var W = f[1];
if (W) {
var u = W[0],
p = f[0];
return D($, p, u) <= 0 ? [p, [u, 0]] : [u, [p, 0]];
}
e = 1;
} else e = 1;
if (1 === e)
for (
var s = r >> 1,
_ = (r - s) | 0,
l = G(s, f),
x = a(s, f),
m = a(_, l),
c = 0;
;
) {
var d = c,
C = m,
h = x;
if (h) {
if (C) {
var y = C[0],
b = h[0];
if (D($, b, y) > 0) {
(c = [b, d]), (x = h[1]);
continue;
}
(c = [y, d]), (m = C[1]);
continue;
}
return E(h, d);
}
return E(C, d);
}
},
a = function(r, a) {
var e = 0;
if (2 !== r) {
if (3 === r && a) {
var t = a[1];
if (t) {
var i = t[1];
if (i) {
var v = i[0],
o = t[0],
n = a[0];
return D($, n, o) > 0
? D($, o, v) > 0
? [n, [o, [v, 0]]]
: D($, n, v) > 0
? [n, [v, [o, 0]]]
: [v, [n, [o, 0]]]
: D($, n, v) > 0
? [o, [n, [v, 0]]]
: D($, o, v) > 0
? [o, [v, [n, 0]]]
: [v, [o, [n, 0]]];
}
e = 1;
} else e = 1;
} else e = 1;
} else if (a) {
var W = a[1];
if (W) {
var u = W[0],
p = a[0];
return D($, p, u) > 0 ? [p, [u, 0]] : [u, [p, 0]];
}
e = 1;
} else e = 1;
if (1 === e)
for (
var s = r >> 1,
_ = (r - s) | 0,
l = G(s, a),
x = f(s, a),
m = f(_, l),
c = 0;
;
) {
var d = c,
C = m,
h = x;
if (h) {
if (C) {
var y = C[0],
b = h[0];
if (D($, b, y) <= 0) {
(c = [b, d]), (x = h[1]);
continue;
}
(c = [y, d]), (m = C[1]);
continue;
}
return E(h, d);
}
return E(C, d);
}
},
e = L(r);
return e < 2 ? r : f(e, r);
}
function bc($, r) {
var f = function(r, f) {
var e = 0;
if (2 !== r) {
if (3 === r && f) {
var t = f[1];
if (t) {
var i = t[1];
if (i) {
var v = i[0],
o = t[0],
n = f[0],
W = D($, n, o);
if (0 === W) {
var u = D($, o, v);
return 0 === u ? [o, 0] : u < 0 ? [o, [v, 0]] : [v, [o, 0]];
}
if (W < 0) {
var p = D($, o, v);
if (0 === p) return [n, [o, 0]];
if (p < 0) return [n, [o, [v, 0]]];
var s = D($, n, v);
return 0 === s
? [n, [o, 0]]
: s < 0
? [n, [v, [o, 0]]]
: [v, [n, [o, 0]]];
}
var _ = D($, n, v);
if (0 === _) return [o, [n, 0]];
if (_ < 0) return [o, [n, [v, 0]]];
var l = D($, o, v);
return 0 === l
? [o, [n, 0]]
: l < 0
? [o, [v, [n, 0]]]
: [v, [o, [n, 0]]];
}
e = 1;
} else e = 1;
} else e = 1;
} else if (f) {
var x = f[1];
if (x) {
var m = x[0],
c = f[0],
d = D($, c, m);
return 0 === d ? [c, 0] : d < 0 ? [c, [m, 0]] : [m, [c, 0]];
}
e = 1;
} else e = 1;
if (1 === e)
for (
var C = r >> 1,
h = (r - C) | 0,
y = G(C, f),
b = a(C, f),
g = a(h, y),
q = 0;
;
) {
var w = q,
L = g,
j = b;
if (j) {
if (L) {
var P = L[1],
k = L[0],
z = j[1],
A = j[0],
B = D($, A, k);
if (0 === B) {
(q = [A, w]), (g = P), (b = z);
continue;
}
if (B > 0) {
(q = [A, w]), (b = z);
continue;
}
(q = [k, w]), (g = P);
continue;
}
return E(j, w);
}
return E(L, w);
}
},
a = function(r, a) {
var e = 0;
if (2 !== r) {
if (3 === r && a) {
var t = a[1];
if (t) {
var i = t[1];
if (i) {
var v = i[0],
o = t[0],
n = a[0],
W = D($, n, o);
if (0 === W) {
var u = D($, o, v);
return 0 === u ? [o, 0] : u > 0 ? [o, [v, 0]] : [v, [o, 0]];
}
if (W > 0) {
var p = D($, o, v);
if (0 === p) return [n, [o, 0]];
if (p > 0) return [n, [o, [v, 0]]];
var s = D($, n, v);
return 0 === s
? [n, [o, 0]]
: s > 0
? [n, [v, [o, 0]]]
: [v, [n, [o, 0]]];
}
var _ = D($, n, v);
if (0 === _) return [o, [n, 0]];
if (_ > 0) return [o, [n, [v, 0]]];
var l = D($, o, v);
return 0 === l
? [o, [n, 0]]
: l > 0
? [o, [v, [n, 0]]]
: [v, [o, [n, 0]]];
}
e = 1;
} else e = 1;
} else e = 1;
} else if (a) {
var x = a[1];
if (x) {
var m = x[0],
c = a[0],
d = D($, c, m);
return 0 === d ? [c, 0] : d > 0 ? [c, [m, 0]] : [m, [c, 0]];
}
e = 1;
} else e = 1;
if (1 === e)
for (
var C = r >> 1,
h = (r - C) | 0,
y = G(C, a),
b = f(C, a),
g = f(h, y),
q = 0;
;
) {
var w = q,
L = g,
j = b;
if (j) {
if (L) {
var P = L[1],
k = L[0],
z = j[1],
A = j[0],
B = D($, A, k);
if (0 === B) {
(q = [A, w]), (g = P), (b = z);
continue;
}
if (B < 0) {
(q = [A, w]), (b = z);
continue;
}
(q = [k, w]), (g = P);
continue;
}
return E(j, w);
}
return E(L, w);
}
},
e = L(r);
return e < 2 ? r : f(e, r);
}
var cc = X,
dc = M,
ec = ha,
fc = v,
gc = v,
hc = L;
a.length = hc;
var ic = qb;
a.hd = ic;
var jc = rb;
a.tl = jc;
var kc = sb;
a.nth = kc;
var lc = ub;
a.rev = lc;
var mc = cc;
a.append = mc;
var nc = E;
a.rev_append = nc;
var oc = dc;
a.concat = oc;
var pc = M;
a.flatten = pc;
var qc = Ab;
a.iter = qc;
var rc = Bb;
a.iteri = rc;
var sc = aa;
a.map = sc;
var tc = yb;
a.mapi = tc;
var uc = zb;
a.rev_map = uc;
var vc = Cb;
a.fold_left = vc;
var wc = ca;
a.fold_right = wc;
var xc = Gb;
a.iter2 = xc;
var yc = da;
a.map2 = yc;
var zc = Fb;
a.rev_map2 = zc;
var Ac = Hb;
a.fold_left2 = Ac;
var Bc = ea;
a.fold_right2 = Bc;
var Cc = Jb;
a.for_all = Cc;
var Dc = Kb;
a.exists = Dc;
var Ec = Lb;
a.for_all2 = Ec;
var Fc = Mb;
a.exists2 = Fc;
var Gc = Nb;
a.mem = Gc;
var Hc = Ob;
a.memq = Hc;
var Ic = Vb;
a.find = Ic;
var Jc = ec;
a.filter = Jc;
var Kc = ha;
a.find_all = Kc;
var Lc = Xb;
a.partition = Lc;
var Mc = Pb;
a.assoc = Mc;
var Nc = Qb;
a.assq = Nc;
var Oc = Rb;
a.mem_assoc = Oc;
var Pc = Sb;
a.mem_assq = Pc;
var Qc = fa;
a.remove_assoc = Qc;
var Rc = ga;
a.remove_assq = Rc;
var Sc = ia;
a.split = Sc;
var Tc = ja;
a.combine = Tc;
var Uc = fc;
a.sort = Uc;
var Vc = v;
a.stable_sort = Vc;
var lb = gc;
a.fast_sort = lb;
var Ma = bc;
a.sort_uniq = Ma;
var Wc = N;
a.merge = Wc;
console.log(a.nth([1, [2, [3, 0]]], 1));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment