text: var jssort=jssort||{};!function(e){"use strict";e.less=function(e,r,n){return n(e,r)<0},e.exchange=function(e,r,n){var t=e[r];e[r]=e[n],e[n]=t},e.selectionSort=function(r,n,t,o){n||(n=0),t||(t=r.length-1),o||(o=function(e,r){return e-r});for(var i=n;i<=t;++i){for(var f=r[i],s=-1,a=i+1;a<=t;++a)e.less(r[a],f,o)&&(s=a,f=r[a]);-1!=s&&e.exchange(r,i,s)}},e.insertionSort=function(r,n,t,o){n||(n=0),t||(t=r.length-1),o||(o=function(e,r){return e-r});for(var i=n+1;i<=t;++i)for(var f=i;f>n&&e.less(r[f],r[f-1],o);--f)e.exchange(r,f-1,f)},e.shellSort=function(r,n,t,o){n||(n=0),t||(t=r.length-1),o||(o=function(e,r){return e-r});for(var i=0;i-n<(t-n)/3;)i=3*i+1;for(var f=i;f>=1;){for(var s=n+f;s<=t;s++)for(var a=s;a>=n+f&&e.less(r[a],r[a-f],o);a-=f)e.exchange(r,a,a-f);f-=1}},e.mergeSort=function(r,n,t,o,i){if(n||(n=0),t||(t=r.length-1),o||(o=function(e,r){return e-r}),!i){i=[];for(var f=0;f<r.length;++f)i.push(r[f])}if(!(n>=t))if(t-n<=7)e.insertionSort(r,n,t,o);else{var s=Math.floor(n+(t-n)/2);e.mergeSort(r,n,s,o,i),e.mergeSort(r,s+1,t,o,i),e.merge(r,i,n,s,t,o)}},e.merge=function(r,n,t,o,i,f){for(u=t;u<=i;++u)n[u]=r[u];for(var s=t,a=o+1,u=t;u<=i;++u)s>o?r[u]=n[a++]:a>i?r[u]=n[s++]:e.less(n[s],n[a],f)?r[u]=n[s++]:r[u]=n[a++]},e.quickSort=function(r,n,t,o){if(n||(n=0),t||(t=r.length-1),o||(o=function(e,r){return e-r}),!(n>=t))if(t-n<=7)e.insertionSort(r,n,t,o);else{var i=e.partition(r,n,t,o);e.quickSort(r,n,i-1,o),e.quickSort(r,i+1,t,o)}},e.partition=function(r,n,t,o){for(var i=r[n],f=n,s=t+1;;){for(;e.less(r[++f],i,o)&&!(f>=t););for(;e.less(i,r[--s],o)&&!(s<=n););if(f>=s)break;e.exchange(r,f,s)}return e.exchange(r,n,s),s},e.threeWaysQuickSort=function(r,n,t,o){if(n||(n=0),t||(t=r.length-1),o||(o=function(e,r){return e-r}),!(n>=t))if(t-n<=7)e.insertionSort(r,n,t,o);else{for(var i=n,f=n,s=t,a=r[n];i<=s;)e.less(r[i],a,o)?e.exchange(r,i++,f++):e.less(a,r[i],o)?e.exchange(r,i,s--):i++;e.threeWaysQuickSort(r,n,f-1,o),e.threeWaysQuickSort(r,s+1,t,o)}},e.heapSort=function(r,n){n||(n=function(e,r){return e-r});for(var t=r.length,o=Math.floor(t/2);o>=1;--o)e.sink(r,o,t,n);for(;t>1;)e.exchange(r,e.heapIndex(1),e.heapIndex(t)),t--,e.sink(r,1,t,n)},e.sink=function(r,n,t,o){for(;2*n<=t;){var i=2*n;if(i<t&&e.less(r[e.heapIndex(i)],r[e.heapIndex(i+1)],o)&&i++,!e.less(r[e.heapIndex(n)],r[e.heapIndex(i)],o))break;e.exchange(r,e.heapIndex(n),e.heapIndex(i)),n=i}},e.heapIndex=function(e){return e-1}}(jssort);var module=module||{};module&&(module.exports=jssort);