MIT
+ + + +Jim Palmer (jimpalmer@gmail.com)
Jim Palmer (jimpalmer@gmail.com)
+ You can download this project in either + zip or + tar formats. +
+You can also clone the project with Git + by running: +
$ git clone git://github.com/overset/javascript-natural-sort+ + + + +
{"use strict";var n=r(8227)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},2195:(e,t,r)=>{"use strict";var n=r(9504),i=n({}.toString),o=n("".slice);e.exports=function(e){return o(i(e),8,-1)}},6955:(e,t,r)=>{"use strict";var n=r(2140),i=r(4901),o=r(2195),a=r(8227)("toStringTag"),s=Object,u="Arguments"===o(function(){return arguments}());e.exports=n?o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?r:u?o(t):"Object"===(n=o(t))&&i(t.callee)?"Arguments":n}},7740:(e,t,r)=>{"use strict";var n=r(9297),i=r(5031),o=r(7347),a=r(4913);e.exports=function(e,t,r){for(var s=i(t),u=a.f,c=o.f,l=0;l (a=(o=Math.ceil(s/ht))>a?o+1:a+1)&&(i=a,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((a=c.length)-(i=l.length)<0&&(i=a,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/dt|0,c[i]%=dt;for(t&&(c.unshift(t),++n),a=c.length;0==c[--a];)c.pop();return e.d=c,e.e=Mt(c,n),rt?At(e,s,u):e},xt.precision=xt.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(it+e);return r.d?(t=Dt(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},xt.round=function(){var e=this,t=e.constructor;return At(new t(e),e.e+1,t.rounding)},xt.sine=xt.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+ht,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Pt(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=Pt(e,2,t=t.times(1/jt(5,r)),t);for(var i,o=new e(5),a=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(s))));return t}(n,Ut(n,r)),n.precision=e,n.rounding=t,At(Ye>2?r.neg():r,e,t,!0)):new n(NaN)},xt.squareRoot=xt.sqrt=function(){var e,t,r,n,i,o,a=this,s=a.d,u=a.e,c=a.s,l=a.constructor;if(1!==c||!s||!s[0])return new l(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);for(rt=!1,0==(c=Math.sqrt(+a))||c==1/0?(((t=bt(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=ut((u+1)/2)-(u<0||u%2),n=new l(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new l(c.toString()),r=(u=l.precision)+3;;)if(n=(o=n).plus(Et(a,o,r+2,1)).times(.5),bt(o.d).slice(0,r)===(t=bt(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(At(n,u+1,1),e=!n.times(n).eq(a));break}if(!i&&(At(o,u+1,0),o.times(o).eq(a))){n=o;break}r+=4,i=1}return rt=!0,At(n,u,l.rounding,e)},xt.tangent=xt.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=Et(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,At(2==Ye||4==Ye?r.neg():r,e,t,!0)):new n(NaN)},xt.times=xt.mul=function(e){var t,r,n,i,o,a,s,u,c,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!(p&&p[0]&&m&&m[0]))return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(r=ut(l.e/ht)+ut(e.e/ht),(u=p.length)<(c=m.length)&&(o=p,p=m,m=o,a=u,u=c,c=a),o=[],n=a=u+c;n--;)o.push(0);for(n=c;--n>=0;){for(t=0,i=u+n;i>n;)s=o[i]+m[n]*p[i-n-1]+t,o[i--]=s%dt|0,t=s/dt|0;o[i]=(o[i]+t)%dt|0}for(;!o[--a];)o.pop();return t?++r:o.shift(),e.d=o,e.e=Mt(o,r),rt?At(e,f.precision,f.rounding):e},xt.toBinary=function(e,t){return Lt(this,2,e,t)},xt.toDecimalPlaces=xt.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(vt(e,0,Xe),void 0===t?t=n.rounding:vt(t,0,8),At(r,e+r.e+1,t))},xt.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=St(n,!0):(vt(e,0,Xe),void 0===t?t=i.rounding:vt(t,0,8),r=St(n=At(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},xt.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return void 0===e?r=St(i):(vt(e,0,Xe),void 0===t?t=o.rounding:vt(t,0,8),r=St(n=At(new o(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},xt.toFraction=function(e){var t,r,n,i,o,a,s,u,c,l,f,p,m=this,d=m.d,h=m.constructor;if(!d)return new h(m);if(c=r=new h(1),n=u=new h(0),a=(o=(t=new h(n)).e=Dt(d)-m.e-1)%ht,t.d[0]=ct(10,a<0?ht+a:a),null==e)e=o>0?t:c;else{if(!(s=new h(e)).isInt()||s.lt(c))throw Error(it+s);e=s.gt(t)?o>0?t:c:s}for(rt=!1,s=new h(bt(d)),l=h.precision,h.precision=o=d.length*ht*2;f=Et(s,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=u.plus(f.times(i)),u=i,i=t,t=s.minus(f.times(i)),s=i;return i=Et(e.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=m.s,p=Et(c,n,o,1).minus(m).abs().cmp(Et(u,r,o,1).minus(m).abs())<1?[c,n]:[u,r],h.precision=l,rt=!0,p},xt.toHexadecimal=xt.toHex=function(e,t){return Lt(this,16,e,t)},xt.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:vt(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(rt=!1,r=Et(r,e,0,t,1).times(e),rt=!0,At(r)):(e.s=r.s,r=e),r},xt.toNumber=function(){return+this},xt.toOctal=function(e,t){return Lt(this,8,e,t)},xt.toPower=xt.pow=function(e){var t,r,n,i,o,a,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(ct(+s,c));if((s=new u(s)).eq(1))return s;if(n=u.precision,o=u.rounding,e.eq(1))return At(s,n,o);if((t=ut(e.e/ht))>=e.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=Ot(u,s,r,n),e.s<0?new u(1).div(i):At(i,n,o);if((a=s.s)<0){if(t {let{typed:t,DenseMatrix:r}=e;return function(e,n,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,d=i;"string"==typeof l&&(m=l,n=t.convert(n,m),d=t.find(i,[m,m]));const h=[],g=[],y=[];for(let e=0;e {let{typed:t}=e;return function(e,n,i,o){const a=e._data,s=e._size,u=e._datatype;let c,l=i;"string"==typeof u&&(c=u,n=t.convert(n,c),l=t.find(i,[c,c]));const f=s.length>0?r(l,0,s,s[0],a,n,o):[];return e.createDenseMatrix({data:f,size:ae(s),datatype:c})};function r(e,t,n,i,o,a,s){const u=[];if(t===n.length-1)for(let t=0;t{let{typed:t,config:r,round:n}=e;return t(So,{number:function(e){return _e(e,n(e),r.relTol,r.absTol)?n(e):Math.ceil(e)},"number, number":function(e,t){if(_e(e,n(e,t),r.relTol,r.absTol))return n(e,t);{let[r,n]=`${e}e`.split("e");const i=Math.ceil(Number(`${r}e${Number(n)+t}`));return[r,n]=`${i}e`.split("e"),Number(`${r}e${Number(n)-t}`)}}})})),To=de(So,Mo,(e=>{let{typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=No({typed:t,equalScalar:o}),c=Eo({typed:t,DenseMatrix:s}),l=Ao({typed:t}),f=Co({typed:t,config:r,round:n});return t("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:function(e){return ri(e,n(e),r.relTol,r.absTol)?n(e):e.ceil()},"BigNumber, BigNumber":function(e,t){return ri(e,n(e,t),r.relTol,r.absTol)?n(e,t):e.toDecimalPlaces(t.toNumber(),Or.ROUND_CEIL)},Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>Zn(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,r)=>Zn(t,(t=>e(t,r)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>u(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>l(t,r,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(i(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>o(t,0)?a(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),Do="cube",Fo=de(Do,["typed"],(e=>{let{typed:t}=e;return t(Do,{number:Yi,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},bigint:function(e){return e*e*e},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})})),Oo=de("exp",["typed"],(e=>{let{typed:t}=e;return t("exp",{number:Ji,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})})),Bo="expm1",_o=de(Bo,["typed","Complex"],(e=>{let{typed:t,Complex:r}=e;return t(Bo,{number:Xi,Complex:function(e){const t=Math.exp(e.re);return new r(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})})),zo="fix",Io=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],ko=de(zo,["typed","ceil","floor"],(e=>{let{typed:t,ceil:r,floor:n}=e;return t(zo,{number:function(e){return e>0?n(e):r(e)},"number, number":function(e,t){return e>0?n(e,t):r(e,t)}})})),qo=de(zo,Io,(e=>{let{typed:t,Complex:r,matrix:n,ceil:i,floor:o,equalScalar:a,zeros:s,DenseMatrix:u}=e;const c=Eo({typed:t,DenseMatrix:u}),l=Ao({typed:t}),f=ko({typed:t,ceil:i,floor:o});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new r(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,t){return new r(e.re>0?o(e.re,t):i(e.re,t),e.im>0?o(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){const n=t.toNumber();return new r(e.re>0?o(e.re,n):i(e.re,n),e.im>0?o(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):o(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):o(e,t)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0?i(e,t):o(e,t)},"Array | Matrix":t.referToSelf((e=>t=>Zn(t,e,!0))),"Array | Matrix, number | BigNumber":t.referToSelf((e=>(t,r)=>Zn(t,(t=>e(t,r)),!0))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(n(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>a(t,0)?s(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),Ro="floor",Po=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],jo=de(Ro,["typed","config","round"],(e=>{let{typed:t,config:r,round:n}=e;return t(Ro,{number:function(e){return _e(e,n(e),r.relTol,r.absTol)?n(e):Math.floor(e)},"number, number":function(e,t){if(_e(e,n(e,t),r.relTol,r.absTol))return n(e,t);{let[r,n]=`${e}e`.split("e");const i=Math.floor(Number(`${r}e${Number(n)+t}`));return[r,n]=`${i}e`.split("e"),Number(`${r}e${Number(n)-t}`)}}})})),Uo=de(Ro,Po,(e=>{let{typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=No({typed:t,equalScalar:o}),c=Eo({typed:t,DenseMatrix:s}),l=Ao({typed:t}),f=jo({typed:t,config:r,round:n});return t("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:function(e){return ri(e,n(e),r.relTol,r.absTol)?n(e):e.floor()},"BigNumber, BigNumber":function(e,t){return ri(e,n(e,t),r.relTol,r.absTol)?n(e,t):e.toDecimalPlaces(t.toNumber(),Or.ROUND_FLOOR)},Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>Zn(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,r)=>Zn(t,(t=>e(t,r)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>u(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>l(t,r,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(i(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>o(t,0)?a(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),Lo=de("matAlgo02xDS0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i,o){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=n._values,l=n._index,f=n._ptr,p=n._size,m=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(s.length!==p.length)throw new an(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const d=s[0],h=s[1];let g,y=r,x=0,b=i;"string"==typeof u&&u===m&&"mixed"!==u&&(g=u,y=t.find(r,[g,g]),x=t.convert(0,g),b=t.find(i,[g,g]));const v=[],w=[],N=[];for(let e=0;e Array.isArray(e)))}const ra=de("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,config:n,round:i,equalScalar:o,zeros:a,BigNumber:s,DenseMatrix:u,concat:c}=e;const l=Wo({typed:t,config:n,round:i,matrix:r,equalScalar:o,zeros:a,DenseMatrix:u,concat:c}),f=Yo({typed:t}),p=Jo({typed:t,equalScalar:o}),m=Xo({typed:t,DenseMatrix:u});return t("gcd",{"number, number":function(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function gcd must be integer numbers");let r;for(;0!==t;)r=l(e,t),e=t,t=r;return e<0?-e:e},"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");const r=new s(0);for(;!t.isZero();){const r=l(e,t);e=t,t=r}return e.lt(r)?e.neg():e},"Fraction, Fraction":(e,t)=>e.gcd(t)},Vo({typed:t,matrix:r,concat:c})({SS:p,DS:f,Ss:m}),{[ea]:t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t {let{typed:t,matrix:r,equalScalar:n,concat:i}=e;const o=Lo({typed:t,equalScalar:n}),a=na({typed:t,equalScalar:n}),s=No({typed:t,equalScalar:n}),u=Vo({typed:t,matrix:r,concat:i}),c="number | BigNumber | Fraction | Matrix | Array",l={};return l[`${c}, ${c}, ...${c}`]=t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t!e.has(t.name))))continue}r.push(n)}}if(u=r,0===u.length)break}for(c of u)if(c.params.length<=s)return c;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+x(o,", ")+"))")}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((e=>e.name)).join(t)}function b(e){const t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map((e=>p(e.trim())));let n=!1,i=t?"...":"";return{types:r.map((function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:t}}function v(e){const t=function(e){if(0===e.length)return[];const t=e.map(p);e.length>1&&t.sort(((e,t)=>e.index-t.index));let r=t[0].conversionsTo;if(1===e.length)return r;r=r.concat([]);const n=new Set(e);for(let e=1;er-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}xt.absoluteValue=xt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),At(e)},xt.ceil=function(){return At(new this.constructor(this),this.e+1,2)},xt.clampedTo=xt.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(it+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},xt.comparedTo=xt.cmp=function(e){var t,r,n,i,o=this,a=o.d,s=(e=new o.constructor(e)).d,u=o.s,c=e.s;if(!a||!s)return u&&c?u!==c?u:a===s?0:!a^u<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?u:s[0]?-c:0;if(u!==c)return u;if(o.e!==e.e)return o.e>e.e^u<0?1:-1;for(t=0,r=(n=a.length)<(i=s.length)?n:i;t1&&(B=e(B,p,u),O=e(O,p,u),C=B.length,S=O.length),A=C,v=(b=O.slice(0,C)).length;v