extra-sorted-array.web
Version:
A sorted array is a collection of values, arranged in an order {web}.
1 lines • 72.8 kB
JavaScript
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).extra_sorted_array=e()}}((function(){return function e(n,r,t){function i(o,a){if(!r[o]){if(!n[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(u)return u(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var f=r[o]={exports:{}};n[o][0].call(f.exports,(function(e){return i(n[o][1][e]||e)}),f,f.exports,e,n,r,t)}return r[o].exports}for(var u="function"==typeof require&&require,o=0;o<t.length;o++)i(t[o]);return i}({1:[function(e,n,r){(function(e,r){(function(){"use strict";function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i={},u={};Object.defineProperty(u,"__esModule",{value:!0});var o={};function a(e){return e}function c(e){return e.length}function l(e){return(...n)=>e(...n.reverse())}function f(e,...n){return(...r)=>e(...n,...r)}function s(e,...n){return(...r)=>e(...r,...n)}function h(...e){return(...n)=>{if(0!==e.length){for(var r=e[0](...n),t=1,i=e.length;t<i;t++)r=e[t](r);return r}}}function m(e,n=e.length){return(...r)=>r.length>=n?e(...r):m(((...n)=>e(...r,...n)),n-r.length)}function p(e,n,r=-1){var t=-1;return(...i)=>{if(++t<n!=(t<r||r<0))return e(...i)}}function d(e){return p(e,0,1)}function g(e,n){return p(e,0,n)}function v(e,n){return p(e,n)}Object.defineProperty(o,"__esModule",{value:!0}),u.throttleEarly=o.throttleEarly=u.throttle=o.throttle=u.debounceEarly=o.debounceEarly=u.debounce=o.debounce=u.after=o.after=u.restrictAfter=o.restrictAfter=u.before=o.before=u.restrictBefore=o.restrictBefore=u.once=o.once=u.restrictOnce=o.restrictOnce=u.restrict=o.restrict=u.delay=o.delay=u.defer=o.defer=u.curryRight=o.curryRight=u.curry=o.curry=u.composeRight=o.composeRight=u.compose=o.compose=u.partialRight=o.partialRight=u.attachRight=o.attachRight=u.partial=o.partial=u.attach=o.attach=u.unspread=o.unspread=u.spread=o.spread=u.flip=o.flip=u.reverse=o.reverse=u.memoize=o.memoize=u.negate=o.negate=u.decontextify=o.decontextify=u.contextify=o.contextify=u.isGenerator=o.isGenerator=u.isAsync=o.isAsync=u.is=o.is=u.apply=o.apply=u.call=o.call=u.bind=o.bind=u.arity=o.arity=u.length=o.length=u.name=o.name=u.ARGUMENTS=o.ARGUMENTS=u.COMPARE=o.COMPARE=u.IDENTITY=o.IDENTITY=u.TRUE=o.TRUE=u.FALSE=o.FALSE=u.NOOP=o.NOOP=void 0,u.NOOP=o.NOOP=function(...e){},u.FALSE=o.FALSE=function(...e){return!1},u.TRUE=o.TRUE=function(...e){return!0},u.IDENTITY=o.IDENTITY=a,u.COMPARE=o.COMPARE=function(e,n){return e<n?-1:e>n?1:0},u.ARGUMENTS=o.ARGUMENTS=function(...e){return e},u.name=o.name=function(e){return e.name},u.length=o.length=c,u.arity=o.arity=c,u.bind=o.bind=function(e,n,...r){return e.bind(n,...r)},u.call=o.call=function(e,n=null,...r){return e.call(n,...r)},u.apply=o.apply=function(e,n=null,r){return e.apply(n,r)},u.is=o.is=function(e){return"function"==typeof e},u.isAsync=o.isAsync=function(e){return e instanceof async function(){}.constructor},u.isGenerator=o.isGenerator=function(e){return e instanceof function*(){}.constructor},u.contextify=o.contextify=function(e){return function(...n){return e(this,...n)}},u.decontextify=o.decontextify=function(e){return(n=null,...r)=>e.call(n,...r)},u.negate=o.negate=function(e){return(...n)=>!e(...n)},u.memoize=o.memoize=function(e,n=null,r=null){return n=n||a,r=r||new Map,(...t)=>{var i=n(...t);if(r.has(i))return r.get(i);var u=e(...t);return r.set(i,u),u}},u.reverse=o.reverse=l,u.flip=o.flip=l,u.spread=o.spread=function(e){return(...n)=>e(n)},u.unspread=o.unspread=function(e){return n=>e(...n)},u.attach=o.attach=f,u.partial=o.partial=f,u.attachRight=o.attachRight=s,u.partialRight=o.partialRight=s,u.compose=o.compose=function(...e){return h(...e.reverse())},u.composeRight=o.composeRight=h,u.curry=o.curry=m,u.curryRight=o.curryRight=function(e,n=e.length){return m(l(e),n)},u.defer=o.defer=function(n){return(...t)=>{var i=e(o);function u(){r(i),i=null}function o(){n(...t),u()}return{clear:u,flush:o}}},u.delay=o.delay=function(e,n){return(...r)=>{var t=setTimeout(u,n);function i(){clearTimeout(t),t=null}function u(){e(...r),i()}return{clear:i,flush:u}}},u.restrict=o.restrict=p,u.restrictOnce=o.restrictOnce=d,u.once=o.once=d,u.restrictBefore=o.restrictBefore=g,u.before=o.before=g,u.restrictAfter=o.restrictAfter=v,u.after=o.after=v,u.debounce=o.debounce=function(e,n,r=-1){var t,i=null,u=null;function o(){clearTimeout(i),clearTimeout(u),i=u=null}function a(){e(...t),o()}return(...e)=>(t=e,r>=0&&(u=u||setTimeout(a,r)),(r<0||n<r)&&(clearTimeout(i),i=setTimeout(a,n)),{clear:o,flush:a})},u.debounceEarly=o.debounceEarly=function(e,n,r=-1){var t=null,i=null;function u(){t=i=null}function o(){u()}return(...a)=>(t||i||e(...a),r>=0&&(i=i||setTimeout(o,r)),(r<0||n<r)&&(clearTimeout(t),t=setTimeout(o,n)),{clear:u,flush:o})},u.throttle=o.throttle=function(e,n){var r,t=null;function i(){t=null}function u(){e(...r),i()}return(...e)=>(r=e,t=t||setTimeout(u,n),{clear:i,flush:u})},u.throttleEarly=o.throttleEarly=function(e,n){var r=null;function t(){r=null}function i(){t()}return(...u)=>(r||e(...u),r=r||setTimeout(i,n),{clear:t,flush:i})},u.default=o;var b={};!function(n){Object.defineProperty(n,"__esModule",{value:!0});var t={},i={exports:{}};!function(e){var n={},r={};Object.defineProperty(r,"__esModule",{value:!0});var t={};function i(e,n,r){return Math.min(Math.max(e,n),r)}function u(e,n,r){return(e-n)/(r-n)}function o(e,n,r,t,i){return t+(e-n)/(r-n)*(i-t)}function a(e,n){return 1&n?Math.sign(e)*Math.pow(Math.abs(e),1/n):Math.pow(e,1/n)}function c(e,n=Math.E){return Math.log(e)/Math.log(n)}function l(e){e=Math.abs(e);for(var n=[],r=1;r<e;r++)e%r==0&&n.push(r);return n}function f(e){if((e=Math.abs(e))<=1)return 0;if(e<=3)return e;if(e%2==0)return 2;if(e%3==0)return 3;for(var n=6,r=Math.sqrt(e)+1;n<=r;n+=6){if(e%(n-1)==0)return n-1;if(e%(n+1)==0)return n+1}return e}function s(e){var n=0;if((e=Math.abs(e))<=1)return 0;if(e<=3)return e;for(;e%2==0;n=2)e/=2;for(;e%3==0;n=3)e/=3;for(var r=6,t=Math.sqrt(e)+1;e>1&&r<=t;r+=6){for(;e%(r-1)==0;n=r-1)e/=r-1;for(;e%(r+1)==0;n=r+1)e/=r+1}return e<=1?n:e}function h(e,n,r){if(n%r!=0)return n;do{n/=r}while(n%r==0);return e.push(r),n}function m(e,n,r){if(n%r!=0)return n;var t=0;do{n/=r,++t}while(n%r==0);return e.push([r,t]),n}function p(...e){for(var n=e[0]||1,r=1,t=e.length;r<t;r++)n=d(n,e[r]);return n}function d(e,n){for(;0!==n;){var r=n;n=e%n,e=r}return e}function g(...e){var n=0;for(var r of e)n+=r;return n}function v(...e){var n=1;for(var r of e)n*=r;return n}function b(...e){return 0===e.length?0:g(...e)/e.length}function y(...e){var n=e.length,r=0;for(var t of e)r+=t*t;return Math.sqrt(r/n)}Object.defineProperty(t,"__esModule",{value:!0}),r.mean=t.mean=r.arithmeticMean=t.arithmeticMean=r.variance=t.variance=r.range=t.range=r.modes=t.modes=r.median=t.median=r.product=t.product=r.sum=t.sum=r.radians=t.radians=r.degrees=t.degrees=r.multinomial=t.multinomial=r.binomial=t.binomial=r.factorial=t.factorial=r.lcm=t.lcm=r.hcf=t.hcf=r.gcd=t.gcd=r.isPrime=t.isPrime=r.primeExponentials=t.primeExponentials=r.primeFactors=t.primeFactors=r.greatestPrimeFactor=t.greatestPrimeFactor=r.maxPrimeFactor=t.maxPrimeFactor=r.leastPrimeFactor=t.leastPrimeFactor=r.minPrimeFactor=t.minPrimeFactor=r.aliquotSum=t.aliquotSum=r.aliquotParts=t.aliquotParts=r.properDivisors=t.properDivisors=r.log=t.log=r.root=t.root=r.nextPow=t.nextPow=r.prevPow=t.prevPow=r.isPow=t.isPow=r.lerp=t.lerp=r.map=t.map=r.remap=t.remap=r.norm=t.norm=r.normalize=t.normalize=r.clamp=t.clamp=r.constrain=t.constrain=r.modp=t.modp=r.mod=t.mod=r.rem=t.rem=r.roundDiv=t.roundDiv=r.ceilDiv=t.ceilDiv=r.floorDiv=t.floorDiv=r.round=t.round=r.ceil=t.ceil=r.floor=t.floor=r.compare=t.compare=r.significantDigits=t.significantDigits=r.is=t.is=void 0,r.toRoman=t.toRoman=r.toRomanNumerals=t.toRomanNumerals=r.fromRoman=t.fromRoman=r.fromRomanNumerals=t.fromRomanNumerals=r.cubicMean=t.cubicMean=r.rootMeanSquare=t.rootMeanSquare=r.quadriaticMean=t.quadriaticMean=r.harmonicMean=t.harmonicMean=r.geometricMean=t.geometricMean=void 0,r.is=t.is=function(e){return"number"==typeof e},r.significantDigits=t.significantDigits=function(e){return e.toExponential().replace(/e[\+\-0-9]*$/,"").replace(/^0\.?0*|\./,"").length},r.compare=t.compare=function(e,n){return e-n},r.floor=t.floor=function(e,n=1){return Math.floor(e/n)*n},r.ceil=t.ceil=function(e,n=1){return Math.ceil(e/n)*n},r.round=t.round=function(e,n=1){return Math.round(e/n)*n},r.floorDiv=t.floorDiv=function(e,n){return Math.floor(e/n)},r.ceilDiv=t.ceilDiv=function(e,n){return Math.ceil(e/n)},r.roundDiv=t.roundDiv=function(e,n){return Math.round(e/n)},r.rem=t.rem=function(e,n){return e%n},r.mod=t.mod=function(e,n){return e-n*Math.floor(e/n)},r.modp=t.modp=function(e,n){return e-Math.abs(n)*Math.floor(e/Math.abs(n))},r.constrain=t.constrain=i,r.clamp=t.clamp=i,r.normalize=t.normalize=u,r.norm=t.norm=u,r.remap=t.remap=o,r.map=t.map=o,r.lerp=t.lerp=function(e,n,r){return e+r*(n-e)},r.isPow=t.isPow=function(e,n){if(0===n)return 0===e;var r=c(Math.abs(e),Math.abs(n));return r===Math.floor(r)&&(e<0?n<0&&!(1&~r):n>0||!(1&r))},r.prevPow=t.prevPow=function(e,n){if(e<=1)return 0;var r=Math.floor(Math.log(e)/Math.log(n));return Math.pow(n,r)},r.nextPow=t.nextPow=function(e,n){if(e<=0)return 1;var r=Math.ceil(Math.log(e)/Math.log(n));return Math.pow(n,r)},r.root=t.root=a,r.log=t.log=c,r.properDivisors=t.properDivisors=l,r.aliquotParts=t.aliquotParts=l,r.aliquotSum=t.aliquotSum=function(e){e=Math.abs(e);for(var n=0,r=0;r<e;r++)e%r==0&&(n+=r);return n},r.minPrimeFactor=t.minPrimeFactor=f,r.leastPrimeFactor=t.leastPrimeFactor=f,r.maxPrimeFactor=t.maxPrimeFactor=s,r.greatestPrimeFactor=t.greatestPrimeFactor=s,r.primeFactors=t.primeFactors=function(e){var n=[];if((e=Math.abs(e))<=1)return[];if(e<=3)return[e];e=h(n,e,2),e=h(n,e,3);for(var r=6,t=Math.sqrt(e)+1;e>1&&r<=t;r+=6)e=h(n,e,r-1),e=h(n,e,r+1);return e>1&&n.push(e),n},r.primeExponentials=t.primeExponentials=function(e){var n=[];if((e=Math.abs(e))<=1)return[];if(e<=3)return[[e,1]];e=m(n,e,2),e=m(n,e,3);for(var r=6,t=Math.sqrt(e)+1;e>1&&r<=t;r+=6)e=m(n,e,r-1),e=m(n,e,r+1);return e>1&&n.push([e,1]),n},r.isPrime=t.isPrime=function(e){return 0!==e&&f(e)===Math.abs(e)},r.gcd=t.gcd=p,r.hcf=t.hcf=p,r.lcm=t.lcm=function(...e){for(var n=e[0]||1,r=1,t=e.length;r<t;r++)n=n*e[r]/d(n,e[r]);return n},r.factorial=t.factorial=function(e,n=0){if(e<0)return 0;for(var r=n+1,t=1;r<=e;r++)t*=r;return t},r.binomial=t.binomial=function e(n,r){if(r<0||r>Math.abs(n))return 0;if(n<0)return Math.pow(-1,r)*e(-n,r);r=r>n-r?n-r:r;for(var t=1,i=1;i<=r;i++,n--)t*=n/i;return t},r.multinomial=t.multinomial=function(...e){for(var n=g(...e),r=1,t=0,i=0,u=e.length;t<u;)i<=0?i=e[t++]:r*=n--/i--;return r},r.degrees=t.degrees=function(e){return e*(180/Math.PI)},r.radians=t.radians=function(e){return e*(Math.PI/180)},r.sum=t.sum=g,r.product=t.product=v,r.median=t.median=function(...e){if(0===e.length)return 0;e.sort(((e,n)=>e-n));var n=e.length>>1;return 1&~e.length?(e[n-1]+e[n])/2:e[n]},r.modes=t.modes=function(...e){e.sort(((e,n)=>e-n));var n=function(e){for(var n=Math.min(e.length,1),r=n,t=1,i=e.length;t<i;t++)e[t-1]===e[t]?n++:(r=Math.max(r,n),n=1);return Math.max(r,n)}(e);return function(e,n){var r=[];n--;for(var t=0,i=e.length-n;t<i;t++)e[t]===e[t+n]&&r.push(e[t+=n]);return r}(e,n)},r.range=t.range=function(...e){return[Math.min(...e),Math.max(...e)]},r.variance=t.variance=function(...e){if(0===e.length)return 0;var n=b(...e),r=0;for(var t of e)r+=(t-n)**2;return r/e.length},r.arithmeticMean=t.arithmeticMean=b,r.mean=t.mean=b,r.geometricMean=t.geometricMean=function(...e){var n=e.length;return a(v(...e),n)},r.harmonicMean=t.harmonicMean=function(...e){var n=e.length,r=v(...e),t=0;for(var i of e)t+=r/i;return n*r/t},r.quadriaticMean=t.quadriaticMean=y,r.rootMeanSquare=t.rootMeanSquare=y,r.cubicMean=t.cubicMean=function(...e){var n=e.length,r=0;for(var t of e)r+=t**3;return Math.cbrt(r/n)};const P=["I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M"],x=[1,4,5,9,10,40,50,90,100,400,500,900,1e3];function O(e){for(var n=P.length-1,r=e.search(/^\s*-/)>=0,t=0,i=0,u=(e=e.replace(/\W/g,"").toUpperCase()).length;i<u;i+=P[n].length){for(;n>=0&&e.substring(i,i+P[n].length)!==P[n];)--n;if(n<0)break;t+=x[n]}return r?-t:t}function M(e){for(var n=e<0?"-":"",r=(e=Math.abs(e),P.length-1);r>=0;--r)for(;e>=x[r];)e-=x[r],n+=P[r];return n}r.fromRomanNumerals=t.fromRomanNumerals=O,r.fromRoman=t.fromRoman=O,r.toRomanNumerals=t.toRomanNumerals=M,r.toRoman=t.toRoman=M,r.default=t,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.quadriaticMean=e.harmonicMean=e.geometricMean=e.mean=e.arithmeticMean=e.variance=e.range=e.modes=e.median=e.product=e.sum=e.radians=e.degrees=e.multinomial=e.binomial=e.factorial=e.lcm=e.hcf=e.gcd=e.isPrime=e.primeExponentials=e.primeFactors=e.greatestPrimeFactor=e.maxPrimeFactor=e.leastPrimeFactor=e.minPrimeFactor=e.aliquotSum=e.aliquotParts=e.properDivisors=e.log=e.root=e.nextPow=e.prevPow=e.isPow=e.map=e.remap=e.lerp=e.norm=e.normalize=e.clamp=e.constrain=e.modp=e.mod=e.rem=e.roundDiv=e.ceilDiv=e.floorDiv=e.round=e.ceil=e.floor=void 0,e.distance=e.magnitude=e.cubicMean=e.rootMeanSquare=void 0;var n=r;Object.defineProperty(e,"floor",{enumerable:!0,get:function(){return n.floor}}),Object.defineProperty(e,"ceil",{enumerable:!0,get:function(){return n.ceil}}),Object.defineProperty(e,"round",{enumerable:!0,get:function(){return n.round}}),Object.defineProperty(e,"floorDiv",{enumerable:!0,get:function(){return n.floorDiv}}),Object.defineProperty(e,"ceilDiv",{enumerable:!0,get:function(){return n.ceilDiv}}),Object.defineProperty(e,"roundDiv",{enumerable:!0,get:function(){return n.roundDiv}}),Object.defineProperty(e,"rem",{enumerable:!0,get:function(){return n.rem}}),Object.defineProperty(e,"mod",{enumerable:!0,get:function(){return n.mod}}),Object.defineProperty(e,"modp",{enumerable:!0,get:function(){return n.modp}}),Object.defineProperty(e,"constrain",{enumerable:!0,get:function(){return n.constrain}}),Object.defineProperty(e,"clamp",{enumerable:!0,get:function(){return n.constrain}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}}),Object.defineProperty(e,"norm",{enumerable:!0,get:function(){return n.normalize}}),Object.defineProperty(e,"lerp",{enumerable:!0,get:function(){return n.lerp}}),Object.defineProperty(e,"remap",{enumerable:!0,get:function(){return n.remap}}),Object.defineProperty(e,"map",{enumerable:!0,get:function(){return n.remap}}),Object.defineProperty(e,"isPow",{enumerable:!0,get:function(){return n.isPow}}),Object.defineProperty(e,"prevPow",{enumerable:!0,get:function(){return n.prevPow}}),Object.defineProperty(e,"nextPow",{enumerable:!0,get:function(){return n.nextPow}}),Object.defineProperty(e,"root",{enumerable:!0,get:function(){return n.root}}),Object.defineProperty(e,"log",{enumerable:!0,get:function(){return n.log}}),Object.defineProperty(e,"properDivisors",{enumerable:!0,get:function(){return n.properDivisors}}),Object.defineProperty(e,"aliquotParts",{enumerable:!0,get:function(){return n.properDivisors}}),Object.defineProperty(e,"aliquotSum",{enumerable:!0,get:function(){return n.aliquotSum}}),Object.defineProperty(e,"minPrimeFactor",{enumerable:!0,get:function(){return n.minPrimeFactor}}),Object.defineProperty(e,"leastPrimeFactor",{enumerable:!0,get:function(){return n.minPrimeFactor}}),Object.defineProperty(e,"maxPrimeFactor",{enumerable:!0,get:function(){return n.maxPrimeFactor}}),Object.defineProperty(e,"greatestPrimeFactor",{enumerable:!0,get:function(){return n.maxPrimeFactor}}),Object.defineProperty(e,"primeFactors",{enumerable:!0,get:function(){return n.primeFactors}}),Object.defineProperty(e,"primeExponentials",{enumerable:!0,get:function(){return n.primeExponentials}}),Object.defineProperty(e,"isPrime",{enumerable:!0,get:function(){return n.isPrime}}),Object.defineProperty(e,"gcd",{enumerable:!0,get:function(){return n.gcd}}),Object.defineProperty(e,"hcf",{enumerable:!0,get:function(){return n.gcd}}),Object.defineProperty(e,"lcm",{enumerable:!0,get:function(){return n.lcm}}),Object.defineProperty(e,"factorial",{enumerable:!0,get:function(){return n.factorial}}),Object.defineProperty(e,"binomial",{enumerable:!0,get:function(){return n.binomial}}),Object.defineProperty(e,"multinomial",{enumerable:!0,get:function(){return n.multinomial}}),Object.defineProperty(e,"degrees",{enumerable:!0,get:function(){return n.degrees}}),Object.defineProperty(e,"radians",{enumerable:!0,get:function(){return n.radians}}),Object.defineProperty(e,"sum",{enumerable:!0,get:function(){return n.sum}}),Object.defineProperty(e,"product",{enumerable:!0,get:function(){return n.product}}),Object.defineProperty(e,"median",{enumerable:!0,get:function(){return n.median}}),Object.defineProperty(e,"modes",{enumerable:!0,get:function(){return n.modes}}),Object.defineProperty(e,"range",{enumerable:!0,get:function(){return n.range}}),Object.defineProperty(e,"variance",{enumerable:!0,get:function(){return n.variance}}),Object.defineProperty(e,"arithmeticMean",{enumerable:!0,get:function(){return n.arithmeticMean}}),Object.defineProperty(e,"mean",{enumerable:!0,get:function(){return n.arithmeticMean}}),Object.defineProperty(e,"geometricMean",{enumerable:!0,get:function(){return n.geometricMean}}),Object.defineProperty(e,"harmonicMean",{enumerable:!0,get:function(){return n.harmonicMean}}),Object.defineProperty(e,"quadriaticMean",{enumerable:!0,get:function(){return n.quadriaticMean}}),Object.defineProperty(e,"rootMeanSquare",{enumerable:!0,get:function(){return n.quadriaticMean}}),Object.defineProperty(e,"cubicMean",{enumerable:!0,get:function(){return n.cubicMean}}),e.magnitude=function(e){for(var n=0,r=0,t=e.length;r<t;r++)n+=e[r]**2;return Math.sqrt(n)},e.distance=function(e,n){for(var r=0,t=0,i=e.length;t<i;t++)r+=(e[t]-n[t])**2;return Math.sqrt(r)}}(n);var j,R=(j=n)&&j.__esModule&&Object.prototype.hasOwnProperty.call(j,"default")?j.default:j;e.exports=R}(i);var u,o=i.exports;(u=o)&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")&&u.default;var a={};Object.defineProperty(a,"__esModule",{value:!0});var c={};function l(e){return e}function f(e){return e.length}function s(e){return(...n)=>e(...n.reverse())}function h(e,...n){return(...r)=>e(...n,...r)}function m(e,...n){return(...r)=>e(...r,...n)}function p(...e){return(...n)=>{if(0!==e.length){for(var r=e[0](...n),t=1,i=e.length;t<i;t++)r=e[t](r);return r}}}function d(e,n=e.length){return(...r)=>r.length>=n?e(...r):d(((...n)=>e(...r,...n)),n-r.length)}function g(e,n,r=-1){var t=-1;return(...i)=>{if(++t<n!=(t<r||r<0))return e(...i)}}function v(e){return g(e,0,1)}function b(e,n){return g(e,0,n)}function y(e,n){return g(e,n)}Object.defineProperty(c,"__esModule",{value:!0}),a.throttleEarly=c.throttleEarly=a.throttle=c.throttle=a.debounceEarly=c.debounceEarly=a.debounce=c.debounce=a.after=c.after=a.restrictAfter=c.restrictAfter=a.before=c.before=a.restrictBefore=c.restrictBefore=a.once=c.once=a.restrictOnce=c.restrictOnce=a.restrict=c.restrict=a.delay=c.delay=a.defer=c.defer=a.curryRight=c.curryRight=a.curry=c.curry=a.composeRight=c.composeRight=a.compose=c.compose=a.partialRight=c.partialRight=a.attachRight=c.attachRight=a.partial=c.partial=a.attach=c.attach=a.unspread=c.unspread=a.spread=c.spread=a.flip=c.flip=a.reverse=c.reverse=a.memoize=c.memoize=a.negate=c.negate=a.decontextify=c.decontextify=a.contextify=c.contextify=a.isGenerator=c.isGenerator=a.isAsync=c.isAsync=a.is=c.is=a.apply=c.apply=a.call=c.call=a.bind=c.bind=a.arity=c.arity=a.length=c.length=a.name=c.name=a.ARGUMENTS=c.ARGUMENTS=a.COMPARE=c.COMPARE=a.IDENTITY=c.IDENTITY=a.TRUE=c.TRUE=a.FALSE=c.FALSE=a.NOOP=c.NOOP=void 0,a.NOOP=c.NOOP=function(...e){},a.FALSE=c.FALSE=function(...e){return!1},a.TRUE=c.TRUE=function(...e){return!0},a.IDENTITY=c.IDENTITY=l,a.COMPARE=c.COMPARE=function(e,n){return e<n?-1:e>n?1:0},a.ARGUMENTS=c.ARGUMENTS=function(...e){return e},a.name=c.name=function(e){return e.name},a.length=c.length=f,a.arity=c.arity=f,a.bind=c.bind=function(e,n,...r){return e.bind(n,...r)},a.call=c.call=function(e,n=null,...r){return e.call(n,...r)},a.apply=c.apply=function(e,n=null,r){return e.apply(n,r)},a.is=c.is=function(e){return"function"==typeof e},a.isAsync=c.isAsync=function(e){return e instanceof async function(){}.constructor},a.isGenerator=c.isGenerator=function(e){return e instanceof function*(){}.constructor},a.contextify=c.contextify=function(e){return function(...n){return e(this,...n)}},a.decontextify=c.decontextify=function(e){return(n=null,...r)=>e.call(n,...r)},a.negate=c.negate=function(e){return(...n)=>!e(...n)},a.memoize=c.memoize=function(e,n=null,r=null){return n=n||l,r=r||new Map,(...t)=>{var i=n(...t);if(r.has(i))return r.get(i);var u=e(...t);return r.set(i,u),u}},a.reverse=c.reverse=s,a.flip=c.flip=s,a.spread=c.spread=function(e){return(...n)=>e(n)},a.unspread=c.unspread=function(e){return n=>e(...n)},a.attach=c.attach=h,a.partial=c.partial=h,a.attachRight=c.attachRight=m,a.partialRight=c.partialRight=m,a.compose=c.compose=function(...e){return p(...e.reverse())},a.composeRight=c.composeRight=p,a.curry=c.curry=d,a.curryRight=c.curryRight=function(e,n=e.length){return d(s(e),n)},a.defer=c.defer=function(n){return(...t)=>{var i=e(o);function u(){r(i),i=null}function o(){n(...t),u()}return{clear:u,flush:o}}},a.delay=c.delay=function(e,n){return(...r)=>{var t=setTimeout(u,n);function i(){clearTimeout(t),t=null}function u(){e(...r),i()}return{clear:i,flush:u}}},a.restrict=c.restrict=g,a.restrictOnce=c.restrictOnce=v,a.once=c.once=v,a.restrictBefore=c.restrictBefore=b,a.before=c.before=b,a.restrictAfter=c.restrictAfter=y,a.after=c.after=y,a.debounce=c.debounce=function(e,n,r=-1){var t,i=null,u=null;function o(){clearTimeout(i),clearTimeout(u),i=u=null}function a(){e(...t),o()}return(...e)=>(t=e,r>=0&&(u=u||setTimeout(a,r)),(r<0||n<r)&&(clearTimeout(i),i=setTimeout(a,n)),{clear:o,flush:a})},a.debounceEarly=c.debounceEarly=function(e,n,r=-1){var t=null,i=null;function u(){t=i=null}function o(){u()}return(...a)=>(t||i||e(...a),r>=0&&(i=i||setTimeout(o,r)),(r<0||n<r)&&(clearTimeout(t),t=setTimeout(o,n)),{clear:u,flush:o})},a.throttle=c.throttle=function(e,n){var r,t=null;function i(){t=null}function u(){e(...r),i()}return(...e)=>(r=e,t=t||setTimeout(u,n),{clear:i,flush:u})},a.throttleEarly=c.throttleEarly=function(e,n){var r=null;function t(){r=null}function i(){t()}return(...u)=>(r||e(...u),r=r||setTimeout(i,n),{clear:t,flush:i})},a.default=c,Object.defineProperty(t,"__esModule",{value:!0}),n.rangedSort$=t.rangedSort$=n.rangedSort=t.rangedSort=n.sort$=t.sort$=n.toSorted=t.toSorted=n.sort=t.sort=n.searchUnsortedValue=t.searchUnsortedValue=n.hasUnsortedValue=t.hasUnsortedValue=n.isSorted=t.isSorted=n.removePath$=t.removePath$=n.remove$=t.remove$=n.remove=t.remove=n.swapRanges$=t.swapRanges$=n.swapRanges=t.swapRanges=n.swap$=t.swap$=n.swap=t.swap=n.setPath$=t.setPath$=n.set$=t.set$=n.with=t.with=n.set=t.set=n.hasPath=t.hasPath=n.getPath=t.getPath=n.getAll=t.getAll=n.at=t.at=n.get=t.get=n.clear$=t.clear$=n.resize$=t.resize$=n.size=t.size=n.length=t.length=n.isEmpty=t.isEmpty=n.indexRange=t.indexRange=n.index=t.index=n.ientries=t.ientries=n.entries=t.entries=n.ivalues=t.ivalues=n.values=t.values=n.ikeys=t.ikeys=n.keys=t.keys=n.is=t.is=n.deepClone=t.deepClone=n.clone=t.clone=n.shallowClone=t.shallowClone=n.from$=t.from$=n.fromIterable$=t.fromIterable$=n.from=t.from=n.fromIterable=t.fromIterable=n.fromApply=t.fromApply=n.fromApplication=t.fromApplication=n.fromCall=t.fromCall=n.fromInvocation=t.fromInvocation=n.fromRange=t.fromRange=void 0,n.hasPermutation=t.hasPermutation=n.hasSubsequence=t.hasSubsequence=n.hasInfix=t.hasInfix=n.endsWith=t.endsWith=n.hasSuffix=t.hasSuffix=n.startsWith=t.startsWith=n.hasPrefix=t.hasPrefix=n.searchMismatch=t.searchMismatch=n.searchMismatchedValue=t.searchMismatchedValue=n.searchAdjacentDuplicate=t.searchAdjacentDuplicate=n.searchAdjacentDuplicateValue=t.searchAdjacentDuplicateValue=n.searchValueAll=t.searchValueAll=n.searchValueRight=t.searchValueRight=n.searchValue=t.searchValue=n.hasValue=t.hasValue=n.includes=t.includes=n.slice$=t.slice$=n.slice=t.slice=n.middle=t.middle=n.back=t.back=n.last=t.last=n.init=t.init=n.tail=t.tail=n.first=t.first=n.front=t.front=n.head=t.head=n.compare=t.compare=n.isEqual=t.isEqual=n.searchMaximumValues=t.searchMaximumValues=n.searchMinimumValues=t.searchMinimumValues=n.searchMaximumValue=t.searchMaximumValue=n.searchMinimumValue=t.searchMinimumValue=n.maximumEntries=t.maximumEntries=n.maximums=t.maximums=n.minimumEntries=t.minimumEntries=n.minimums=t.minimums=n.rangeEntries=t.rangeEntries=n.range=t.range=n.maxEntry=t.maxEntry=n.maximumEntry=t.maximumEntry=n.max=t.max=n.maximum=t.maximum=n.minEntry=t.minEntry=n.minimumEntry=t.minimumEntry=n.min=t.min=n.minimum=t.minimum=n.rangedPartialSort$=t.rangedPartialSort$=n.rangedPartialSort=t.rangedPartialSort=n.partialSort$=t.partialSort$=n.partialSort=t.partialSort=void 0,n.findIndex=t.findIndex=n.search=t.search=n.lastIndexOf=t.lastIndexOf=n.indexOf=t.indexOf=n.scanUntilRight=t.scanUntilRight=n.scanUntil=t.scanUntil=n.scanWhileRight=t.scanWhileRight=n.scanWhile=t.scanWhile=n.dropWhileRight=t.dropWhileRight=n.dropWhile=t.dropWhile=n.dropRight=t.dropRight=n.drop=t.drop=n.takeWhileRight=t.takeWhileRight=n.takeWhile=t.takeWhile=n.right=t.right=n.takeRight=t.takeRight=n.left=t.left=n.take=t.take=n.findRight=t.findRight=n.find=t.find=n.shuffle$=t.shuffle$=n.permute$=t.permute$=n.permutation$=t.permutation$=n.randomPermutation$=t.randomPermutation$=n.permutation=t.permutation=n.randomPermutation=t.randomPermutation=n.subsequence=t.subsequence=n.randomSubsequence=t.randomSubsequence=n.infix=t.infix=n.randomInfix=t.randomInfix=n.suffix=t.suffix=n.randomSuffix=t.randomSuffix=n.prefix=t.prefix=n.randomPrefix=t.randomPrefix=n.value=t.value=n.randomValue=t.randomValue=n.searchSubsequence=t.searchSubsequence=n.searchInfixAll=t.searchInfixAll=n.searchInfixRight=t.searchInfixRight=n.searchInfix=t.searchInfix=n.ipermutations=t.ipermutations=n.permutations=t.permutations=n.isubsequences=t.isubsequences=n.subsequences=t.subsequences=n.iinfixes=t.iinfixes=n.infixes=t.infixes=n.isuffixes=t.isuffixes=n.suffixes=t.suffixes=n.iprefixes=t.iprefixes=n.prefixes=t.prefixes=void 0,n.unshift=t.unshift=n.popFront$=t.popFront$=n.shift$=t.shift$=n.popFront=t.popFront=n.shift=t.shift=n.popBack$=t.popBack$=n.pop$=t.pop$=n.popBack=t.popBack=n.pop=t.pop=n.append$=t.append$=n.pushBack$=t.pushBack$=n.push$=t.push$=n.append=t.append=n.pushBack=t.pushBack=n.push=t.push=n.fill$=t.fill$=n.fill=t.fill=n.zip=t.zip=n.interleave=t.interleave=n.intermix=t.intermix=n.interpolate=t.interpolate=n.intersperse=t.intersperse=n.adjacentCombine$=t.adjacentCombine$=n.adjacentCombine=t.adjacentCombine=n.inclusiveScan$=t.inclusiveScan$=n.accumulate=t.accumulate=n.inclusiveScan=t.inclusiveScan=n.exclusiveScan$=t.exclusiveScan$=n.exclusiveScan=t.exclusiveScan=n.flatMap=t.flatMap=n.flat=t.flat=n.rejectAt=t.rejectAt=n.reject$=t.reject$=n.reject=t.reject=n.filterAt=t.filterAt=n.filter$=t.filter$=n.findAll=t.findAll=n.filter=t.filter=n.reduceRight=t.reduceRight=n.reduce=t.reduce=n.map$=t.map$=n.map=t.map=n.allOf=t.allOf=n.every=t.every=n.anyOf=t.anyOf=n.some=t.some=n.forEach=t.forEach=n.searchAll=t.searchAll=n.findLastIndex=t.findLastIndex=n.searchRight=t.searchRight=void 0,n.cartesianProduct=t.cartesianProduct=n.symmetricDifference=t.symmetricDifference=n.difference=t.difference=n.intersection=t.intersection=n.union$=t.union$=n.union=t.union=n.unique=t.unique=n.isDisjoint=t.isDisjoint=n.isUnique=t.isUnique=n.rotate$=t.rotate$=n.rotate=t.rotate=n.reverse$=t.reverse$=n.toReversed=t.toReversed=n.reverse=t.reverse=n.repeat=t.repeat=n.cycle=t.cycle=n.join=t.join=n.concat$=t.concat$=n.concat=t.concat=n.chunk=t.chunk=n.group=t.group=n.cutAtRight=t.cutAtRight=n.cutAt=t.cutAt=n.cutRight=t.cutRight=n.cut=t.cut=n.splitAt=t.splitAt=n.split=t.split=n.partitionAs=t.partitionAs=n.groupToMap=t.groupToMap=n.partitionEach=t.partitionEach=n.partition=t.partition=n.countAs=t.countAs=n.countEach=t.countEach=n.count=t.count=n.splice$=t.splice$=n.toSpliced=t.toSpliced=n.splice=t.splice=n.moveWithin$=t.moveWithin$=n.moveWithin=t.moveWithin=n.copyWithin$=t.copyWithin$=n.copyWithin=t.copyWithin=n.copy$=t.copy$=n.copy=t.copy=n.prepend$=t.prepend$=n.pushFront$=t.pushFront$=n.unshift$=t.unshift$=n.prepend=t.prepend=n.pushFront=t.pushFront=void 0;const P=o,x=a;function O(e,n=null){if(!n)return new Set(e);var r=new Set,t=-1;for(var i of e)r.add(n(i,++t,e));return r}function M(e,n,r=1){for(var t=(n-e)/r,i=[],u=0;u<t;++u,e+=r)i.push(e);return i}function j(e,n){for(var r=[],t=0;t<n;++t)r.push(e());return r}function R(e,n,r){var t=[];0!==r&&t.push(n);for(var i=1;i!==r;++i)t.push(n=e(n,i,null));return t}function E(e){return[...e]}function I(e){return Array.isArray(e)?e:[...e]}function T(e){return e.slice()}function $(e){return Array.isArray(e)}function A(e,n){var r=e.length;return n>=0?Math.min(n,r):Math.max(r+n,0)}function D(e,n=0,r=e.length){var t=e.length;n=n>=0?Math.min(n,t):Math.max(t+n,0),r=r>=0?Math.min(r,t):Math.max(t+r,0);return[n,Math.max(n,r)]}function S(e,n=0,r=e.length){var[n,r]=D(e,n,r);return r-n}function w(e,n){return e[A(e,n)]}function q(e,n){return n.map((n=>w(e,n)))}function N(e,n){for(var r of n)e=$(e)?w(e,r):void 0;return e}function C(e,n,r){return k(e.slice(),n,r)}function k(e,n,r){return e[A(e,n)]=r,e}function V(e,n,r){n=A(e,n),r=A(e,r);var t=e[n];return e[n]=e[r],e[r]=t,e}function W(e,n,r){var t=e[n];return e[n]=e[r],e[r]=t,e}function F(e,n=null,r=null){n=n||x.COMPARE,r=r||x.IDENTITY;var t=e.length;if(t<=1)return-1;for(var i=r(e[0],0,e),u=1;u<t;++u){var o=r(e[u],u,e);if(n(i,o)>0)return u;i=o}return-1}function Y(e,n=null,r=null,t=null){return U(e.slice(),n,r,t)}function U(e,n=null,r=null,t=null){n=n||x.COMPARE;if(!r&&!t)return e.sort(n);var i=e.length;return L(e,0,i,i,n,r=r||x.IDENTITY,t=t||W)}function _(e,n,r,t=null,i=null,u=null){t=t||x.COMPARE,i=i||x.IDENTITY,u=u||W;var[n,r]=D(e,n,r);return L(e,n,r,r-n,t,i,u)}function z(e,n,r=null,t=null,i=null){return B(e,0,e.length,n,r,t,i)}function B(e,n,r,t,i=null,u=null,o=null){i=i||x.COMPARE,u=u||x.IDENTITY,o=o||W;var[n,r]=D(e,n,r);return L(e,n,r,t,i,u,o)}function L(e,n,r,t,i,u,o){return G(e,n,r,Math.floor(2*Math.log2(r-n)),16,t,i,u,o)}function G(e,n,r,t,i,u,o,a,c){if(u<=0||r-n<=1)return e;if(r-n<=i)return function(e,n,r,t,i,u,o){return o===W?function(e,n,r,t,i,u){for(var o=n+1;o<r;++o){for(var a=e[o],c=u(a,o,e),l=o-1;l>=n&&i(u(e[l],l,e),c)>0;--l)e[l+1]=e[l];e[l+1]=a}return e}(e,n,r,0,i,u):function(e,n,r,t,i,u,o){for(var a=n+1;a<r;++a)for(var c=u(e[a],a,e),l=a-1;l>=n&&i(u(e[l],l,e),c)>0;--l)o(e,l,l+1);return e}(e,n,r,0,i,u,o)}(e,n,r,0,o,a,c);if(t<=0)return function(e,n,r,t,i,u,o){!function(e,n,r,t,i,u){for(var o=r-Math.floor((r-n)/2);o<r;++o)X(e,n,r,o,t,i,u)}(e,n,r,i,u,o);for(var a=r-1;t>0&&n<r;++n,--t)o(e,n,a),X(e,n+1,r,a,i,u,o);return e}(e,n,r,u,o,a,c);var l=function(e,n,r,t,i,u,o){var a=u(e[t],t,e),c=n-1;o(e,t,r-1);for(var l=n;l<r-1;++l){i(u(e[l],l,e),a)>0||o(e,++c,l)}return o(e,++c,r-1),c}(e,n,r,l=n+Math.floor((r-n)*Math.random()),o,a,c);return G(e,n,l,t,i,Math.min(l-n,u),o,a,c),G(e,l+1,r,t,i,Math.min(r-l-1,u),o,a,c),e}function X(e,n,r,t,i,u,o){var a=t,c=2*t-r,l=c-1;c>=n&&i(u(e[c],c,e),u(e[a],a,e))<0&&(a=c),l>=n&&i(u(e[l],l,e),u(e[a],a,e))<0&&(a=l),a!==t&&(o(e,a,t),X(e,n,r,a,i,u,o))}function H(e,n,r,t,i,u,o){var a=t,c=2*t-n+1,l=c+1;c<r&&i(u(e[c],c,e),u(e[a],a,e))>0&&(a=c),l<r&&i(u(e[l],l,e),u(e[a],a,e))>0&&(a=l),a!==t&&(o(e,a,t),H(e,n,r,a,i,u,o))}function J(e,n=null,r=null){return e[ne(e,n,r)]}function K(e,n=null,r=null){var t=ne(e,n,r);return[t,e[t]]}function Q(e,n=null,r=null){return e[re(e,n,r)]}function Z(e,n=null,r=null){var t=re(e,n,r);return[t,e[t]]}function ee(e,n=null,r=null){n=n||x.COMPARE,r=r||x.IDENTITY;var t=e.length;if(0===t)return[[-1,void 0],[-1,void 0]];for(var i=0,u=s=e[0],o=h=r(s,0,e),a=0,c=s,l=h,f=1;f<t;++f){var s,h;n(h=r(s=e[f],f,e),o)<0&&(i=f,u=s,o=h),n(h,l)>0&&(a=f,c=s,l=h)}return[[i,u],[a,c]]}function ne(e,n=null,r=null){n=n||x.COMPARE,r=r||x.IDENTITY;var t=e.length;if(0===t)return-1;for(var i=0,u=r(e[0],0,e),o=1;o<t;++o){var a=r(e[o],o,e);n(a,u)<0&&(i=o,u=a)}return i}function re(e,n=null,r=null){n=n||x.COMPARE,r=r||x.IDENTITY;var t=e.length;if(0===t)return-1;for(var i=0,u=r(e[0],0,e),o=1;o<t;++o){var a=r(e[o],o,e);n(a,u)>0&&(i=o,u=a)}return i}function te(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;var i=e.length,u=Math.min(n,i),o=M(0,u);!function(e,n,r,t,i,u){for(var o=n+Math.floor((r-n)/2)-1;o>=n;--o)H(e,n,r,o,t,i,u)}(o,0,u,r,(n=>t(e[n],n,e)),W);for(var a=t(e[o[0]],o[0],e),c=n;c<i;++c){var l=t(e[c],c,e);if(!(r(l,a)>=0)){o[0]=c,H(o,0,u,0,r,(n=>t(e[n],n,e)),W);a=t(e[o[0]],o[0],e)}}return o.sort(((n,i)=>r(t(e[n],n,e),t(e[i],i,e)))),o}function ie(e,n,r=null,t=null){r=r||x.COMPARE;return te(e,n,((e,n)=>-r(e,n)),t)}function ue(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;for(var i=e.length,u=n.length,o=0,a=Math.min(i,u);o<a;++o){var c=r(t(e[o],o,e),t(n[o],o,n));if(0!==c)return c}return Math.sign(i-u)}function oe(e,n){return e.length>0?e[0]:n}function ae(e,n){return e.length>0?e[e.length-1]:n}function ce(e,n,r=null,t=null){r=r||x.COMPARE;var i=(t=t||x.IDENTITY)(n,0,null),u=-1;for(var o of e){if(0===r(t(o,++u,e),i))return u}return-1}function le(e,n=null,r=null){n=n||x.COMPARE,r=r||x.IDENTITY;var t=e.length;if(t<=1)return-1;for(var i=r(e[0],0,e),u=1;u<t;++u){var o=r(e[u],u,e);if(0===n(i,o))return u;i=o}return-1}function fe(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;for(var i=e.length,u=n.length,o=0,a=Math.min(i,u);o<a;++o){if(0!==r(t(e[o],o,e),t(n[o],o,n)))return o}return i===u?-1:a}function se(e,n,r=null,t=null){var i=n.length;return 0===i||0===ue(e.slice(0,i),n,r,t)}function he(e,n,r=null,t=null){var i=n.length;return 0===i||0===ue(e.slice(-i),n,r,t)}function me(e,n,r=null,t=null){return Oe(e,n,r,t)>=0}function*pe(e,n=-1){var r=e.length;if(!(n>r))if(n>=0)yield e.slice(0,n);else for(var t=0;t<=r;++t)yield e.slice(0,t)}function*de(e,n=-1){var r=e.length;if(!(n>r))if(n>=0)yield e.slice(e.length-n);else for(var t=0;t<=r;++t)yield e.slice(t)}function ge(e,n=-1){return n>=0?function*(e,n){var r=e.length;if(n>r)return;if(0===n)return void(yield[]);for(var t=0,i=r-n+1;t<i;++t)yield e.slice(t,t+n)}(e,n):function*(e){var n=e.length;yield[];for(var r=0;r<n;++r)for(var t=r+1;t<=n;++t)yield e.slice(r,t)}(e)}function*ve(e,n=-1){var r=e.length;if(!(n>r))if(n!==r)if(0!==n&&0!==r){var t=e.slice(0,-1);for(var i of(yield*ve(t,n),ve(t,n-1)))i.push(e[r-1]),yield i}else yield[];else yield e}function*be(e,n=-1){var r=e.length;if(!(n>r))for(var t=n<0?0:n,i=n<0?r:n;t<=i;++t)yield*ye(e,t)}function*ye(e,n){var r=e.length;if(0!==r&&0!==n)for(var t=0;t<r;++t){var i=Je(e,t,1);for(var u of ye(i,n-1))yield[e[t],...u]}else yield[]}function Pe(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;for(var i=e.length,u=n.length,o=0;o<=i-u;++o)if(xe(e,n,o,r,t))return o;return-1}function xe(e,n,r,t,i){for(var u=n.length,o=0;o<u;++o){if(0!==t(i(e[r+o],r+o,e),i(n[o],o,n)))return!1}return!0}function Oe(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;var i=[...n].map(t),u=i.length,o=-1,a=-1,c=0;for(var l of e){if(0===r(t(l,++a,e),i[c])&&(o<0&&(o=a),++c>=u))return o}return-1}function Me(e,n=Math.random){return e[Math.floor(n()*e.length)]}function je(e,n=-1,r=Math.random){var t=e.length;if(n>t)return null;n=n>=0?n:Math.floor((t+1)*r());return e.slice(0,n)}function Re(e,n=-1,r=Math.random){var t=e.length;if(n>t)return null;n=n>=0?n:Math.floor((t+1)*r());return e.slice(t-n)}function Ee(e,n=-1,r=Math.random){var t=e.length;if(n>t)return null;n=n>=0?n:function(e,n){var r=.5*e*(e+1)+1,t=.5*Math.sqrt(1+8*n*r)-.5;return e+1-Math.floor(t+1)}(t,r());var i=Math.floor((t+1-n)*r());return e.slice(i,i+n)}function Ie(e,n=-1,r=Math.random){return n>e.length?null:n>=0?function(e,n,r){var t=M(0,e.length);return $e(t,n,r).sort(),q(e,t)}(e,n,r):function(e,n){var r=[];for(var t of e)n()<.5&&r.push(t);return r}(e,r)}function Te(e,n=-1,r=Math.random){return n>e.length?null:$e(e.slice(),n,r)}function $e(e,n=-1,r=Math.random){var t=e.length;if(n>t)return e;n=n>=0?n:Math.floor((t+1)*r());for(var i=0;i<n;++i){var u=i+Math.floor((t-i)*r()),o=e[i];e[i]=e[u],e[u]=o}return e.length=n,e}function Ae(e,n=1){n=Math.max(n,0);return e.slice(0,n)}function De(e,n=1){var r=e.length;n=Math.min(Math.max(n,0),r);return e.slice(r-n)}function Se(e,n){var r=-1;for(var t of e)if(!n(t,++r,e))return r;return++r}function we(e,n){for(var r=e.length-1;r>=0&&n(e[r],r,e);--r);return++r}function qe(e,n){return e.findIndex(n)}function Ne(e,n){for(var r=e.length-1;r>=0;--r)if(n(e[r],r,e))return r;return-1}function Ce(e,n=null){return n?e.some(n):function(e){for(var n=0,r=e.length;n<r;++n)if(e[n])return!0;return!1}(e)}function ke(e,n=null){return n?e.every(n):function(e){for(var n=0,r=e.length;n<r;++n)if(!e[n])return!1;return!0}(e)}function Ve(e,n){return e.filter(n)}function We(e,n,r,t,i){var u=-1;for(var o of n){var a=t(o,++u,n);0!==r&&i(a,u,n)?We(e,o,r-1,t,i):e.push(a)}return e}function Fe(e,n,r){for(var t=arguments.length<=2,i=[],u=0,o=e.length;u<o;++u)r=t?e[u]:n(r,e[u],u,e),i.push(r),t=!1;return i}function Ye(e,...n){return e.concat(n)}function Ue(e,...n){return e.push(...n),e}function _e(e){return e.slice(0,-1)}function ze(e){return e.slice(1)}function Be(e){return e.shift(),e}function Le(e,...n){return Ze(n,e)}function Ge(e,...n){return e.unshift(...n),e}function Xe(e,n,r=0,t=0,i=n.length){r=A(e,r);for(var[t,i]=D(n,t,i);t<i;++t,++r)e[r]=n[t];return e}function He(e,n,r,t){return e.slice(0,n).concat(e.slice(r,t),e.slice(n,r),e.slice(t))}function Je(e,n,r=e.length,...t){n=A(e,n),r=Math.max(r,0);return Ze(e.slice(0,n),t,e.slice(n+r))}function Ke(e,n=null){n=n||x.IDENTITY;var r=-1,t=new Map;for(var i of e){var u=n(i,++r,e);t.set(u,(t.get(u)||0)+1)}return t}function Qe(e,n=null){n=n||x.IDENTITY;var r=-1,t=new Map;for(var i of e){var u=n(i,++r,e);t.has(u)||t.set(u,[]),t.get(u).push(i)}return t}function Ze(e,...n){for(var r of n)e.push(...r);return e}function en(e){return e.slice().reverse()}function nn(e,n,r=null,t=null){return r?function(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;var i=e.map(t),u=-1;e:for(var o of n){var a=t(o,++u,n);for(var c of i)if(0===r(c,a))continue e;e.push(o)}return e}(e,n,r,t):function(e,n,r=null){r=r||x.IDENTITY;var t=O(e,r),i=-1;for(var u of n){var o=r(u,++i,n);t.has(o)||e.push(u)}return e}(e,n,t)}function rn(e,n,r=null,t=null){return r?function(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;var i=[...n].map(t),u=-1,o=[];e:for(var a of e){var c=t(a,++u,e);for(var l of i)if(0===r(c,l))continue e;o.push(a)}return o}(e,n,r,t):function(e,n,r=null){r=r||x.IDENTITY;var t=O(n,r),i=-1,u=[];for(var o of e){var a=r(o,++i,e);t.has(a)||u.push(o)}return u}(e,n,t)}n.fromRange=t.fromRange=M,n.fromInvocation=t.fromInvocation=j,n.fromCall=t.fromCall=j,n.fromApplication=t.fromApplication=R,n.fromApply=t.fromApply=R,n.fromIterable=t.fromIterable=E,n.from=t.from=E,n.fromIterable$=t.fromIterable$=I,n.from$=t.from$=I,n.shallowClone=t.shallowClone=T,n.clone=t.clone=T,n.deepClone=t.deepClone=function(e){return structuredClone(e)},n.is=t.is=$,n.keys=t.keys=function(e){return[...e.keys()]},n.ikeys=t.ikeys=function(e){return e.keys()},n.values=t.values=function(e){return e.slice()},n.ivalues=t.ivalues=function(e){return e.values()},n.entries=t.entries=function(e){return[...e.entries()]},n.ientries=t.ientries=function(e){return e.entries()},n.index=t.index=A,n.indexRange=t.indexRange=D,n.isEmpty=t.isEmpty=function(e){return 0===e.length},n.length=t.length=S,n.size=t.size=S,n.resize$=t.resize$=function(e,n,r){var t=e.length;return e.length=n,n>t&&e.fill(r,t),e},n.clear$=t.clear$=function(e){return e.length=0,e},n.get=t.get=w,n.at=t.at=w,n.getAll=t.getAll=q,n.getPath=t.getPath=N,n.hasPath=t.hasPath=function(e,n){for(var r of n){if(!$(e))return!1;e=w(e,r)}return!0},n.set=t.set=C,n.with=t.with=C,n.set$=t.set$=k,n.setPath$=t.setPath$=function(e,n,r){var t=N(e,n.slice(0,-1));return $(t)&&k(t,ae(n),r),e},n.swap=t.swap=function(e,n,r){return V(e.slice(),n,r)},n.swap$=t.swap$=V,n.swapRanges=t.swapRanges=function(e,n,r,t,i){var[n,r]=D(e,n,r),[t,i]=D(e,t,i);return t<n&&([n,r,t,i]=[t,i,n,r]),t<r?e.slice():e.slice(0,n).concat(e.slice(t,i),e.slice(n,t),e.slice(r))},n.swapRanges$=t.swapRanges$=function(e,n,r,t,i){var[n,r]=D(e,n,r),[t,i]=D(e,t,i);if(t<n&&([n,r,t,i]=[t,i,n,r]),t<r)return e;var u=e.slice(n,r);return e.splice(n,r-n,...e.slice(t,i)),e.splice(t,i-t,...u),e},n.remove=t.remove=function(e,n){return n=A(e,n),e.slice(0,n).concat(e.slice(n+1))},n.remove$=t.remove$=function(e,n){return e.splice(n,1),e},n.removePath$=t.removePath$=function(e,n){var r=N(e,n.slice(0,-1));return $(r)&&r.splice(ae(n),1),e},n.isSorted=t.isSorted=function(e,n=null,r=null){return-1===F(e,n,r)},n.hasUnsortedValue=t.hasUnsortedValue=function(e,n=null,r=null){return F(e,n,r)>=0},n.searchUnsortedValue=t.searchUnsortedValue=F,n.sort=t.sort=Y,n.toSorted=t.toSorted=Y,n.sort$=t.sort$=U,n.rangedSort=t.rangedSort=function(e,n,r,t=null,i=null,u=null){return _(e.slice(),n,r,t,i,u)},n.rangedSort$=t.rangedSort$=_,n.partialSort=t.partialSort=function(e,n,r=null,t=null,i=null){return z(e.slice(),n,r,t,i)},n.partialSort$=t.partialSort$=z,n.rangedPartialSort=t.rangedPartialSort=function(e,n,r,t,i=null,u=null,o=null){return B(e.slice(),n,r,t,i,u,o)},n.rangedPartialSort$=t.rangedPartialSort$=B,n.minimum=t.minimum=J,n.min=t.min=J,n.minimumEntry=t.minimumEntry=K,n.minEntry=t.minEntry=K,n.maximum=t.maximum=Q,n.max=t.max=Q,n.maximumEntry=t.maximumEntry=Z,n.maxEntry=t.maxEntry=Z,n.range=t.range=function(e,n=null,r=null){var[t,i]=ee(e,n,r);return[t[1],i[1]]},n.rangeEntries=t.rangeEntries=ee,n.minimums=t.minimums=function(e,n,r=null,t=null){return te(e,n,r,t).map((n=>e[n]))},n.minimumEntries=t.minimumEntries=function(e,n,r=null,t=null){return te(e,n,r,t).map((n=>[n,e[n]]))},n.maximums=t.maximums=function(e,n,r=null,t=null){return ie(e,n,r,t).map((n=>e[n]))},n.maximumEntries=t.maximumEntries=function(e,n,r=null,t=null){return ie(e,n,r,t).map((n=>[n,e[n]]))},n.searchMinimumValue=t.searchMinimumValue=ne,n.searchMaximumValue=t.searchMaximumValue=re,n.searchMinimumValues=t.searchMinimumValues=te,n.searchMaximumValues=t.searchMaximumValues=ie,n.isEqual=t.isEqual=function(e,n,r=null,t=null){return e.length===n.length&&0===ue(e,n,r,t)},n.compare=t.compare=ue,n.head=t.head=oe,n.front=t.front=oe,n.first=t.first=oe,n.tail=t.tail=function(e){return e.slice(1)},n.init=t.init=function(e){return e.slice(0,-1)},n.last=t.last=ae,n.back=t.back=ae,n.middle=t.middle=function(e,n,r=1){return n=A(e,n),r=Math.max(r,0),e.slice(n,n+r)},n.slice=t.slice=function(e,n=0,r=e.length){return e.slice(n,r)},n.slice$=t.slice$=function(e,n=0,r=e.length){return e.copyWithin(0,n,r),e.length=S(e,n,r),e},n.includes=t.includes=function(e,n,r=0){return e.includes(n,r)},n.hasValue=t.hasValue=function(e,n,r=null,t=null){return ce(e,n,r,t)>=0},n.searchValue=t.searchValue=ce,n.searchValueRight=t.searchValueRight=function(e,n,r=null,t=null){r=r||x.COMPARE;for(var i=(t=t||x.IDENTITY)(n,0,null),u=e.length-1;u>=0;--u){if(0===r(t(e[u],u,e),i))return u}return-1},n.searchValueAll=t.searchValueAll=function(e,n,r=null,t=null){r=r||x.COMPARE;var i=(t=t||x.IDENTITY)(n,0,null),u=-1,o=[];for(var a of e){0===r(t(a,++u,e),i)&&o.push(u)}return o},n.searchAdjacentDuplicateValue=t.searchAdjacentDuplicateValue=le,n.searchAdjacentDuplicate=t.searchAdjacentDuplicate=le,n.searchMismatchedValue=t.searchMismatchedValue=fe,n.searchMismatch=t.searchMismatch=fe,n.hasPrefix=t.hasPrefix=se,n.startsWith=t.startsWith=se,n.hasSuffix=t.hasSuffix=he,n.endsWith=t.endsWith=he,n.hasInfix=t.hasInfix=function(e,n,r=null,t=null){return Pe(e,n,r,t)>=0},n.hasSubsequence=t.hasSubsequence=me,n.hasPermutation=t.hasPermutation=function(e,n,r=null,t=null){var i=t?e.map(t):e.slice(),u=t?n.map(t):n.slice();return me(i.sort(),u.sort(),r,t)},n.prefixes=t.prefixes=function(e,n=-1){return[...pe(e,n)]},n.iprefixes=t.iprefixes=pe,n.suffixes=t.suffixes=function(e,n=-1){return[...de(e,n)]},n.isuffixes=t.isuffixes=de,n.infixes=t.infixes=function(e,n=-1){return[...ge(e,n)]},n.iinfixes=t.iinfixes=ge,n.subsequences=t.subsequences=function(e,n=-1){return[...ve(e,n)]},n.isubsequences=t.isubsequences=ve,n.permutations=t.permutations=function(e,n=-1){return[...be(e,n)]},n.ipermutations=t.ipermutations=be,n.searchInfix=t.searchInfix=Pe,n.searchInfixRight=t.searchInfixRight=function(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;for(var i=e.length-n.length;i>=0;--i)if(xe(e,n,i,r,t))return i;return-1},n.searchInfixAll=t.searchInfixAll=function(e,n,r=null,t=null){r=r||x.COMPARE,t=t||x.IDENTITY;for(var i=e.length,u=n.length,o=[],a=0;a<=i-u;++a)xe(e,n,a,r,t)&&o.push(a);return o},n.searchSubsequence=t.searchSubsequence=Oe,n.randomValue=t.randomValue=Me,n.value=t.value=Me,n.randomPrefix=t.randomPrefix=je,n.prefix=t.prefix=je,n.randomSuffix=t.randomSuffix=Re,n.suffix=t.suffix=Re,n.randomInfix=t.randomInfix=Ee,n.infix=t.infix=Ee,n.randomSubsequence=t.randomSubsequence=Ie,n.subsequence=t.subsequence=Ie,n.randomPermutation=t.randomPermutation=Te,n.permutation=t.permutation=Te,n.randomPermutation$=t.randomPermutation$=$e,n.permutation$=t.permutation$=$e,n.permute$=t.permute$=$e,n.shuffle$=t.shuffle$=$e,n.find=t.find=function(e,n){return e.find(n)},n.findRight=t.findRight=function(e,n){for(var r=e.length-1;r>=0;--r)if(n(e[r],r,e))return e[r]},n.take=t.take=Ae,n.left=t.left=Ae,n.takeRight=t.takeRight=De,n.right=t.right=De,n.takeWhile=t.takeWhile=function(e,n){return e.slice(0,Se(e,n))},n.takeWhileRight=t.takeWhileRight=function(e,n){return e.slice(we(e,n))},n.drop=t.drop=function(e,n=1){return n=Math.max(n,0),e.slice(n)},n.dropRight=t.dropRight=function(e,n=1){var r=e.length;return n=Math.min(Math.max(n,0),r),e.slice(0,r-n)},n.dropWhile=t.dropWhile=function(e,n){return e.slice(Se(e,n))},n.dropWhileRight=t.dropWhileRight=function(e,n){return e.slice(0,we(e,n))},n.scanWhile=t.scanWhile=Se,n.scanWhileRight=t.scanWhileRight=we,n.scanUntil=t.scanUntil=function(e,n){var r=-1;for(var t of e)if(n(t,++r,e))return r;return++r},n.scanUntilRight=t.scanUntilRight=function(e,n){for(var r=e.length-1;r>=0&&!n(e[r],r,e);--r);return++r},n.indexOf=t.indexOf=function(e,n,r=0){return e.indexOf(n,r)},n.lastIndexOf=t.lastIndexOf=function(e,n,r=e.length-1){return e.lastIndexOf(n,r)},n.search=t.search=qe,n.findIndex=t.findIndex=qe,n.searchRight=t.searchRight=Ne,n.findLastIndex=t.findLastIndex=Ne,n.searchAll=t.searchAll=function(e,n){var r=-1,t=[];for(var i of e)n(i,++r,e)&&t.push(r);return t},n.forEach=t.forEach=function(e,n){e.forEach(n)},n.some=t.some=Ce,n.anyOf=t.anyOf=Ce,n.every=t.every=ke,n.allOf=t.allOf=ke,n.map=t.map=function(e,n){return e.map(n)},n.map$=t.map$=function(e,n){for(var r=0,t=e.length;r<t;++r)e[r]=n(e[r],r,e);return e},n.reduce=t.reduce=function(e,n,r){return arguments.length<=2?e.reduce(n):e.reduce(n,r)},n.reduceRight=t.reduceRight=function(e,n,r){for(var t=arguments.length<=2,i=e.length-1;i>=0;--i)t?(r=e[i],t=!1):r=n(r,e[i],i,e);return r},n.filter=t.filter=Ve,n.findAll=t.findAll=Ve,n.filter$=t.filter$=function(e,n){for(var r=0,t=0,i=e.length;r<i;++r)n(e[r],r,e)&&(e[t++]=e[r]);return e.length=t,e},n.filterAt=t.filterAt=function(e,n){var r=e.length,t=[];for(var i of n)i>=0&&i<r&&t.push(e[i]);return t},n.reject=t.reject=function(e,n){var r=-1,t=[];for(var i of e)n(i,++r,e)||t.push(i);return t},n.reject$=t.reject$=function(e,n){for(var r=0,t=0,i=e.length;r<i;++r)n(e[r],r,e)||(e[t++]=e[r]);return e.length=t,e},n.rejectAt=t.rejectAt=function(e,n){var r=-1,t=[];for(var i of e)n.includes(++r)||t.push(i);return t},n.flat=t.flat=function(e,n=-1,r=null,t=null){return We([],e,n,r=r||x.IDENTITY,t=t||$)},n.flatMap=t.flatMap=function(e,n=null,r=null){n=n||x.IDENTITY,r=r||$;var t=-1,i=[];for(var u of e){var o=n(u,++t,e);r(o,t,e)?Ze(i,o):i.push(o)}return i},n.exclusiveScan=t.exclusiveScan=function(e,n,r){for(var t=[],i=0,u=e.length;i<u;++i)t.push(r),r=n(r,e[i],i,e);return t},n.exclusiveScan$=t.exclusiveScan$=function(e,n,r){for(var t=0,i=e.length;t<i;++t){var u=e[t];e[t]=r,r=n(r,u,t,e)}return e},n.inclusiveScan=t.inclusiveScan=Fe,n.accumulate=t.accumulate=Fe,n.inclusiveScan$=t.inclusiveScan$=function(e,n,r){for(var t=0,i=e.length;t<i;++t)r=e[t]=n(r,e[t],t,e);return e},n.adjacentCombine=t.adjacentCombine=function(e,n,r){var t=[];e.length>0&&t.push(n(r,e[0]));for(var i=1,u=e.length;i<u;++i)t.push(n(e[i-1],e[i]));return t},n.adjacentCombine$=t.adjacentCombine$=function(e,n,r){var t=e.length;if(0===t)return e;var i=e[0];e[0]=n(r,i);for(var u=1;u<t;++u){var o=e[u];e[u]=n(i,o),i=o}return e},n.intersperse=t.intersperse=function(e,n){var r=[],t=-1;for(var i of e)++t>0&&r.push(n),r.push(i);return r},n.interpolate=t.interpolate=function(e,n){var r,t=[],i=-1;for(var u of e)++i>0&&t.push(n(r,u)),t.push(r=u);return t},n.intermix=t.intermix=function(e,n,r=1,t=1,i=r,u=t){for(var o=e.length,a=n.length,c=[],l=(r=Math.max(r,0),t=Math.max(t,0),i=Math.max(i,1),u=Math.max(u,1),0),f=0;l<o;l+=i){if(l>0){for(var s=f,h=s+t;s<h;++s)c.push(n[s%a]);f+=u}Ze(c,e.slice(l,l+r))}return c},n.interleave=t.interleave=function(e){for(var n=[],r=0;;++r){var t=0;for(var i of e)r<i.length&&(n.push(i[r]),++t);if(0===t)break}return n},n.zip=t.zip=function(e,n=null,r=null,t){n=n||x.IDENTITY,r=r||Ce;var i=e.length,u=[];if(0===i)return u;for(var o=new Array(i).fill(!1),a=e.map((e=>e.length)),c=0;;++c){for(var l=0,f=[];l<i;++l)o[l]=c>=a[l],f[l]=o[l]?t:e[l][c];if(r(o))break;u.push(n(f,c,null))}return u},n.fill=t.fill=function(e,n,r=0,t=e.length){return e.slice().fill(n,r,t)},n.fill$=t.fill$=function(e,n,r=0,t=e.length){return e.fill(n,r,t)},n.push=t.push=Ye,n.pushBack=t.pushBack=Ye,n.append=t.append=Ye,n.push$=t.push$=Ue,n.pushBack$=t.pushBack$=Ue,n.append$=t.append$=Ue,n.pop=t.pop=_e,n.popBack=t.popBack=_e,n.popBack$=t.popBack$=_e,n.pop$=t.pop$=function(e){return e.pop(),e},n.shift=t.shif