function aappend (a, ...b) {
for (let i = 0; i < b.length; i++) {
let x = b[i];
if (x instanceof Array) {
Array.prototype.push.apply (a, x);
} else {
a.push (x);
}
}
return a;
}
function apush (a, ...b) {
Array.prototype.push.apply (a, b);
return a;
}
function ainsert (a, x, l, r, c) {
l || (l = 0);
r !== undefined || (r = a.length);
c || (c = cmp);
while (l < r) {
let m = (l + r) >> 1;
c (a[m], x) <= 0 ? l = m + 1 : r = m;
}
a.splice (l, 0, x);
return l;
}
function asearch (a, x, l, r, c) {
l || (l = 0);
r !== undefined || (r = a.length);
c || (c = cmp);
while (l < r) {
let m = (l + r) >> 1;
c (a[m], x) < 0 ? l = m + 1 : r = m;
}
return l;
}
let inferentialSortWork1 = null;
let inferentialSortWork2 = null;
function inferentialSort (array, incompleteComparator) {
let n = array.length;
if (n <= 1) {
return;
}
if (inferentialSortWork1 == null || inferentialSortWork1.length < n * n) {
inferentialSortWork1 = new Int8Array (n * n);
}
let f = inferentialSortWork1;
for (let a = 0; a < n; a++) {
for (let b = 0; b < n; b++) {
f[n * a + b] = a == b ? 0 : 2;
}
}
for (let b0 = 1; b0 < n; b0++) {
for (let a0 = 0; a0 < b0; a0++) {
if (f[n * a0 + b0] === 2) {
let h = incompleteComparator (array[a0], array[b0]);
if (h !== 0) {
let a;
let b;
if (h < 0) {
a = a0;
b = b0;
} else {
a = b0;
b = a0;
}
f[n * a + b] = -1;
f[n * b + a] = 1;
for (let c = 0; c < n; c++) {
if (f[n * b + c] === -1) {
f[n * a + c] = -1;
f[n * c + a] = 1;
}
if (f[n * c + a] === -1) {
f[n * c + b] = -1;
f[n * b + c] = 1;
for (let d = 0; d < n; d++) {
if (f[n * b + d] === -1) {
f[n * c + d] = -1;
f[n * d + c] = 1;
}
}
}
}
}
}
}
}
if (inferentialSortWork2 == null || inferentialSortWork2.length < n) {
inferentialSortWork2 = new Int32Array (n);
}
let g = inferentialSortWork2;
for (let i = 0; i < n; i++) {
g[i] = i;
}
for (let j = 1; j < n; j++) {
let b = g[j];
let i = 0;
while (i < j) {
let a = g[i];
if (f[n * a + b] === 1) {
break;
}
i++;
}
if (i < j) {
for (let k = i + 1; k < j; k++) {
let c = g[k];
if (f[n * c + b] === -1) {
let e = array[k];
for (let l = k; i < l; l--) {
g[l] = g[l - 1];
array[l] = array[l - 1];
}
g[i] = c;
array[i] = e;
i++;
}
}
if (i < j) {
let e = array[j];
for (let l = j; i < l; l--) {
g[l] = g[l - 1];
array[l] = array[l - 1];
}
g[i] = b;
array[i] = e;
}
}
}
}
function getElementById (id) {
return document.getElementById (id);
}
function createNode (t) {
return document.createElement (t);
}
function nsCreateNode (n, t) {
return document.createElementNS (n, t);
}
function createNodeA () { return createNode ("a"); }
function createNodeAbbr () { return createNode ("abbr"); }
function createNodeAddress () { return createNode ("address"); }
function createNodeApplet () { return createNode ("applet"); }
function createNodeArea () { return createNode ("area"); }
function createNodeArticle () { return createNode ("article"); }
function createNodeAside () { return createNode ("aside"); }
function createNodeAudio () { return createNode ("audio"); }
function createNodeB () { return createNode ("b"); }
function createNodeBase () { return createNode ("base"); }
function createNodeBdo () { return createNode ("bdo"); }
function createNodeBlockquote () { return createNode ("blockquote"); }
function createNodeBody () { return createNode ("body"); }
function createNodeBr () { return createNode ("br"); }
function createNodeButton () { return createNode ("button"); }
function createNodeCanvas () { return createNode ("canvas"); }
function createNodeCaption () { return createNode ("caption"); }
function createNodeCite () { return createNode ("cite"); }
function createNodeCode () { return createNode ("code"); }
function createNodeCol () { return createNode ("col"); }
function createNodeColgroup () { return createNode ("colgroup"); }
function createNodeCommand () { return createNode ("command"); }
function createNodeDatalist () { return createNode ("datalist"); }
function createNodeDel () { return createNode ("del"); }
function createNodeDetails () { return createNode ("details"); }
function createNodeDfn () { return createNode ("dfn"); }
function createNodeDiv () { return createNode ("div"); }
function createNodeDd () { return createNode ("dd"); }
function createNodeDl () { return createNode ("dl"); }
function createNodeDt () { return createNode ("dt"); }
function createNodeEm () { return createNode ("em"); }
function createNodeEmbed () { return createNode ("embed"); }
function createNodeFieldset () { return createNode ("fieldset"); }
function createNodeFigcaption () { return createNode ("figcaption"); }
function createNodeFigure () { return createNode ("figure"); }
function createNodeFooter () { return createNode ("footer"); }
function createNodeForm () { return createNode ("form"); }
function createNodeH1 () { return createNode ("h1"); }
function createNodeH2 () { return createNode ("h2"); }
function createNodeH3 () { return createNode ("h3"); }
function createNodeH4 () { return createNode ("h4"); }
function createNodeH5 () { return createNode ("h5"); }
function createNodeH6 () { return createNode ("h6"); }
function createNodeHead () { return createNode ("head"); }
function createNodeHeader () { return createNode ("header"); }
function createNodeHr () { return createNode ("hr"); }
function createNodeHtml () { return createNode ("html"); }
function createNodeI () { return createNode ("i"); }
function createNodeIframe () { return createNode ("iframe"); }
function createNodeImg () { return createNode ("img"); }
function createNodeInput () { return createNode ("input"); }
function createNodeIns () { return createNode ("ins"); }
function createNodeKbd () { return createNode ("kbd"); }
function createNodeKeygen () { return createNode ("keygen"); }
function createNodeLabel () { return createNode ("label"); }
function createNodeLegend () { return createNode ("legend"); }
function createNodeLi () { return createNode ("li"); }
function createNodeLink () { return createNode ("link"); }
function createNodeMap () { return createNode ("map"); }
function createNodeMark () { return createNode ("mark"); }
function createNodeMenu () { return createNode ("menu"); }
function createNodeMeta () { return createNode ("meta"); }
function createNodeMeter () { return createNode ("meter"); }
function createNodeNav () { return createNode ("nav"); }
function createNodeNoscript () { return createNode ("noscript"); }
function createNodeObject () { return createNode ("object"); }
function createNodeOl () { return createNode ("ol"); }
function createNodeOptgroup () { return createNode ("optgroup"); }
function createNodeOption () { return createNode ("option"); }
function createNodeOutput () { return createNode ("output"); }
function createNodeP () { return createNode ("p"); }
function createNodeParam () { return createNode ("param"); }
function createNodeProgress () { return createNode ("progress"); }
function createNodePre () { return createNode ("pre"); }
function createNodeQ () { return createNode ("q"); }
function createNodeRp () { return createNode ("rp"); }
function createNodeRt () { return createNode ("rt"); }
function createNodeRuby () { return createNode ("ruby"); }
function createNodeS () { return createNode ("s"); }
function createNodeSamp () { return createNode ("samp"); }
function createNodeScript () { return createNode ("script"); }
function createNodeSection () { return createNode ("section"); }
function createNodeSelect () { return createNode ("select"); }
function createNodeSmall () { return createNode ("small"); }
function createNodeSource () { return createNode ("source"); }
function createNodeSpan () { return createNode ("span"); }
function createNodeStrong () { return createNode ("strong"); }
function createNodeStyle () { return createNode ("style"); }
function createNodeSub () { return createNode ("sub"); }
function createNodeSummary () { return createNode ("summary"); }
function createNodeSup () { return createNode ("sup"); }
function createNodeTable () { return createNode ("table"); }
function createNodeTbody () { return createNode ("tbody"); }
function createNodeTd () { return createNode ("td"); }
function createNodeTextarea () { return createNode ("textarea"); }
function createNodeTfoot () { return createNode ("tfoot"); }
function createNodeTh () { return createNode ("th"); }
function createNodeThead () { return createNode ("thead"); }
function createNodeTime () { return createNode ("time"); }
function createNodeTitle () { return createNode ("title"); }
function createNodeTr () { return createNode ("tr"); }
function createNodeU () { return createNode ("u"); }
function createNodeUl () { return createNode ("ul"); }
function createNodeVar () { return createNode ("var"); }
function createNodeVideo () { return createNode ("video"); }
function createNodeWbr () { return createNode ("wbr"); }
function createTextNode (t) {
return document.createTextNode ("" + t);
}
function setStyle () {
let o = arguments[0];
let s = o.style;
let l = arguments.length;
for (let i = 1; i + 1 < l; i += 2) {
let k = arguments[i];
if (k) {
let v = arguments[i + 1];
s[k] = v;
if (k === "borderRadius") {
s.WebkitBorderRadius = v;
} else if (k === "boxSizing") {
s.MozBoxSizing = v;
s.WebkitBoxSizing = v;
s.msBoxSizing = v;
} else if (k === "cssFloat") {
s.styleFloat = v;
} else if (k === "transform") {
s.msTransform = v;
}
}
}
return o;
}
function setAttr () {
let o = arguments[0];
let l = arguments.length;
for (let i = 1; i + 1 < l; i += 2) {
let a = arguments[i];
if (a) {
o[a] = arguments[i + 1];
}
}
return o;
}
function nsSetAttr () {
let o = arguments[0];
let n = arguments[1];
let l = arguments.length;
for (let i = 2; i + 1 < l; i += 2) {
let a = arguments[i];
if (a) {
o.setAttributeNS (n, a, arguments[i + 1]);
}
}
return o;
}
function appendNode () {
let o = arguments[0];
let l = arguments.length;
for (let i = 1; i < l; i++) {
let p = arguments[i];
if (typeof (p) !== "object") {
o.appendChild (createTextNode (p));
} else if (p) {
o.appendChild (p);
}
}
return o;
}
function removeNode () {
let o = arguments[0];
let l = arguments.length;
for (let i = 1; i < l; i++) {
let p = arguments[i];
if (p) {
o.removeChild (p);
}
}
return o;
}
function addDragEvent (element, dragStart, dragMove, dragEnd) {
if (dragStart) {
addEvent (element, "mousedown", function (e) {
dragStart (e.clientX, e.clientY);
consumeEvent (e);
});
addEvent (element, "touchstart", function (e) {
let touch = e.touches[0];
dragStart (touch.clientX, touch.clientY);
consumeEvent (e);
});
}
if (dragMove) {
addEvent (element, "mousemove", function (e) {
dragMove (e.clientX, e.clientY);
consumeEvent (e);
});
addEvent (element, "touchmove", function (e) {
let touch = e.touches[0];
dragMove (touch.clientX, touch.clientY);
consumeEvent (e);
});
}
if (dragEnd) {
addEvent (element, "mouseup", function (e) {
dragEnd ();
consumeEvent (e);
});
addEvent (element, "touchend", function (e) {
dragEnd ();
consumeEvent (e);
});
}
return element;
}
function addDropEvent (element, dragover, drop) {
if (dragover) {
addEvent (element, "dragover", function (e) {
dragover (e);
consumeEvent (e);
});
}
if (drop) {
addEvent (element, "drop", function (e) {
drop (e);
consumeEvent (e);
});
}
return element;
}
function getWindowWidth () {
return window.innerWidth || document.documentElement.offsetWidth || 0;
}
function getWindowHeight () {
return window.innerHeight || document.documentElement.offsetHeight || 0;
}
function getWindowScrollX () {
return (defined (window.pageXOffset) ? window.pageXOffset :
(document.documentElement || document.body.parentNode || document.body).scrollLeft);
}
function getWindowScrollY () {
return (defined (window.pageYOffset) ? window.pageYOffset :
(document.documentElement || document.body.parentNode || document.body).scrollTop);
}
let E = Math.E;
let LN10 = Math.LN10;
let LN2 = Math.LN2;
let LOG10E = Math.LOG10E;
let LOG2E = Math.LOG2E;
let PI = Math.PI;
let SQRT1_2 = Math.SQRT1_2;
let SQRT2 = Math.SQRT2;
let ONE_3 = 1 / 3;
let TWO_3 = 2 / 3;
let FOUR_3 = 4 / 3;
let TWOPI = 2 * PI;
let PI_2 = 0.5 * PI;
let PI_4 = 0.25 * PI;
let DEG_RAD = 180 / PI;
let RAD_DEG = PI / 180;
let abs = Math.abs;
let acos = Math.acos;
function builtin_acosh (x) {
return log (x + sqrt (x * x - 1.0));
}
let acosh = Math.acosh || builtin_acosh;
function acot (x) {
return atan (1.0 / x);
}
function acoth (x) {
return 0.5 * sgn (x) * log1p (2.0 / (abs (x) - 1.0));
}
function acsc (x) {
return asin (1.0 / x);
}
function acsch (x) {
return asinh (1.0 / x);
}
function asec (x) {
return atan2 (sqrt (x * x - 1), sgn (x));
}
function asech (x) {
return acosh (1.0 / x);
}
let asin = Math.asin;
function builtin_asinh (x) {
return sgn (x) * log (abs (x) + sqrt (x * x + 1.0));
}
let asinh = Math.asinh || builtin_asinh;
let atan = Math.atan;
let atan2 = Math.atan2;
function builtin_atanh (x) {
return x == 0.0 ? x : 0.5 * log ((1.0 + x) / (1.0 - x));
}
let atanh = Math.atanh || builtin_atanh;
function builtin_cbrt (x) {
return sgn (x) * pow (abs (x), ONE_3);
}
let cbrt = Math.cbrt || builtin_cbrt;
let ceil = Math.ceil;
function builtin_clz32 (x) {
let n = ((x >>> 16) - 1) >> 12 & 16;
n += ((x >>> (24 - n)) - 1) >> 5 & 8;
n += ((x >>> (28 - n)) - 1) >> 2 & 4;
x >>>= 28 - n;
return n + ((0x55af >>> (x << 1) & 3) - ((x - 1) >> 4));
}
let clz32 = Math.clz32 || builtin_clz32;
function cmp (x, y) {
return y < x ? 1.0 : x < y ? -1.0 : 0.0;
}
function cmpnum (x, y) {
x = +x;
y = +y;
return isNaN (x) || isNaN (y) || x === y ? 0.0 : y < x ? 1.0 : -1.0;
}
function copysign (x, y) {
x = abs (x);
return y < 0.0 || y == 0.0 && 1.0 / y < 0.0 ? -x : x;
}
let cos = Math.cos;
function builtin_cosh (x) {
x = exp (x);
return 0.5 * (x + 1.0 / x);
}
let cosh = Math.cosh || builtin_cosh;
function cot (x) {
return cos (x) / sin (x);
}
function coth (x) {
return cosh (x) / sinh (x);
}
function csc (x) {
return 1.0 / sin (x);
}
function csch (x) {
return 1.0 / sinh (x);
}
const CTZ32_HASH = [0, 1, 2, 5, 3, 9, 6, 11, 15, 4, 8, 10, 14, 7, 13, 12];
function builtin_ctz32 (x) {
x >>>= 0;
if (0 < x) {
let n = ((x & 65535) - 1) >> 12 & 16;
x >>>= n;
return n + CTZ32_HASH[(x & -x) * 2479 >>> 12 & 15];
} else {
return 32;
}
}
let ctz32 = Math.ctz32 || builtin_ctz32;
function cub (x) {
return x * x * x;
}
function cubic (a, b, c, d) {
return (a != 0.0 ? (a = 1.0 / a,
b *= a * ONE_3,
c *= a,
d *= a,
a = b * b - c * ONE_3,
c = 0.5 * (b * c - 2.0 * b * b * b - d),
d = c * c - a * a * a,
(0.0 <= d ? (d = sqrt (d),
cbrt (c - d) + cbrt (c + d)) :
2.0 * sqrt (a) * cos (atan2 (sqrt (-d), c) * ONE_3)) - b) :
b != 0.0 ? (b = 1.0 / b,
c *= 0.5 * b,
d = c * c - b * d,
0.0 <= d ? sqrt (d) - c : NaN) :
c != 0.0 ? -d / c :
d != 0.0 ? NaN :
0.0);
}
function defined (x) {
return x !== undefined;
}
function deg (x) {
return DEG_RAD * x;
}
let exp = Math.exp;
function exp10 (x) {
return exp (LN10 * x);
}
function exp2 (x) {
return exp (LN2 * x);
}
function exp2m1 (x) {
return exp2 (x) - 1.0;
}
function builtin_expm1 (x) {
return x == 0 ? x : exp (x) - 1.0;
}
let expm1 = Math.expm1 || builtin_expm1;
function ext16s (x) {
x = trunc (x) + 2 ** 15;
return x - floor (x * 2 ** -16) * 2 ** 16 - 2 ** 15;
}
function ext16u (x) {
x = trunc (x);
return x - floor (x * 2 ** -16) * 2 ** 16;
}
function ext32s (x) {
x = trunc (x) + 2 ** 31;
return x - floor (x * 2 ** -32) * 2 ** 32 - 2 ** 31;
}
function ext32u (x) {
x = trunc (x);
return x - floor (x * 2 ** -32) * 2 ** 32;
}
function ext64s (x) {
x = trunc (x) + 2 ** 63;
return x - floor (x * 2 ** -64) * 2 ** 64 - 2 ** 63;
}
function ext64u (x) {
x = trunc (x);
return x - floor (x * 2 ** -64) * 2 ** 64;
}
function ext8s (x) {
x = trunc (x) + 2 ** 7;
return x - floor (x * 2 ** -8) * 2 ** 8 - 2 ** 7;
}
function ext8u (x) {
x = trunc (x);
return x - floor (x * 2 ** -8) * 2 ** 8;
}
function fdiv (x, y) {
return floor (x / y);
}
let floor = Math.floor;
function floor2 (x, y) {
return floor (x / y) * y;
}
function fracf (x) {
return x - floor (x);
}
function fract (x) {