csv-sort 7.2.2 → 7.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,6 +21,8 @@
21
21
  <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
22
22
  </p>
23
23
 
24
+ **Powered by currency.js.** No other dependencies.
25
+
24
26
  ## Install
25
27
 
26
28
  This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 5.1.0 (`npm i csv-sort@5.1.0`).
@@ -66,7 +68,7 @@ assert.deepEqual(
66
68
 
67
69
  ## Documentation
68
70
 
69
- Please [visit codsen.com](https://codsen.com/os/csv-sort/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/csv-sort/CHANGELOG.md).
71
+ Please [visit codsen.com](https://codsen.com/os/csv-sort/) for a full description of the API. For **Changelog**, see [raw md on GitHub](https://github.com/codsen/codsen/blob/main/packages/csv-sort/CHANGELOG.md) or [the website](https://codsen.com/os/csv-sort/changelog).
70
72
 
71
73
  ## Contributing
72
74
 
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @name csv-sort
3
3
  * @fileoverview Sort double-entry bookkeeping CSV from internet banking
4
- * @version 7.2.2
4
+ * @version 7.2.4
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/csv-sort/}
8
8
  */
9
9
 
10
- import{formatDiagnosticValue as O,pullAll as x}from"codsen-utils";import{splitEasy as j}from"csv-split-easy";import w from"currency.js";var k="7.2.2";function E(a){return typeof a=="number"&&!Number.isNaN(a)?!0:(a=(a||"").toString().trim(),a?!Number.isNaN(+a):!1)}var A=["\u062F.\u0625","\u060B","L","\u058F","\u0192","Kz","$","\u0192","\u20BC","KM","\u09F3","\u043B\u0432",".\u062F.\u0628","FBu","$b","R$","\u0E3F","Nu.","P","p.","BZ$","FC","CHF","\xA5","\u20A1","\u20B1","K\u010D","Fdj","kr","RD$","\u062F\u062C","kr","Nfk","Br","\u039E","\u20AC","\u20BE","\u20B5","GH\u20B5","D","FG","Q","L","kn","G","Ft","Rp","\u20AA","\u20B9","\u0639.\u062F","\uFDFC","kr","J$","JD","\xA5","KSh","\u043B\u0432","\u17DB","CF","\u20A9","\u20A9","KD","\u043B\u0432","\u20AD","\u20A8","M","\u0141","Lt","Ls","LD","MAD","lei","Ar","\u0434\u0435\u043D","K","\u20AE","MOP$","UM","\u20A8","Rf","MK","RM","MT","\u20A6","C$","kr","\u20A8","\uFDFC","B/.","S/.","K","\u20B1","\u20A8","z\u0142","Gs","\uFDFC","\uFFE5","lei","\u0414\u0438\u043D.","\u20BD","R\u20A3","\uFDFC","\u20A8","\u062C.\u0633.","kr","\xA3","Le","S","Db","E","\u0E3F","SM","T","\u062F.\u062A","T$","\u20A4","\u20BA","TT$","NT$","TSh","\u20B4","USh","$U","\u043B\u0432","Bs","\u20AB","VT","WS$","FCFA","\u0243","CFA","\u20A3","\uFDFC","R","Z$"];function R(a){return E(a)||A.some(y=>E(a.replace(y,"").replace(/[,.]/g,"")))?"numeric":a.trim()?"text":"empty"}var _=k;function G(a){let y=null,C=null;if(typeof a!="string")throw new TypeError(`csv-sort/sort(): [THROW_ID_01] The input is of a wrong type! We accept either string of array of arrays. We got instead: ${typeof a}, equal to:
10
+ import{formatDiagnosticValue as O,pullAll as x}from"codsen-utils";import{splitEasy as j}from"csv-split-easy";import w from"currency.js";var k="7.2.4";function E(a){return typeof a=="number"&&!Number.isNaN(a)?!0:(a=(a||"").toString().trim(),a?!Number.isNaN(+a):!1)}var A=["\u062F.\u0625","\u060B","L","\u058F","\u0192","Kz","$","\u0192","\u20BC","KM","\u09F3","\u043B\u0432",".\u062F.\u0628","FBu","$b","R$","\u0E3F","Nu.","P","p.","BZ$","FC","CHF","\xA5","\u20A1","\u20B1","K\u010D","Fdj","kr","RD$","\u062F\u062C","kr","Nfk","Br","\u039E","\u20AC","\u20BE","\u20B5","GH\u20B5","D","FG","Q","L","kn","G","Ft","Rp","\u20AA","\u20B9","\u0639.\u062F","\uFDFC","kr","J$","JD","\xA5","KSh","\u043B\u0432","\u17DB","CF","\u20A9","\u20A9","KD","\u043B\u0432","\u20AD","\u20A8","M","\u0141","Lt","Ls","LD","MAD","lei","Ar","\u0434\u0435\u043D","K","\u20AE","MOP$","UM","\u20A8","Rf","MK","RM","MT","\u20A6","C$","kr","\u20A8","\uFDFC","B/.","S/.","K","\u20B1","\u20A8","z\u0142","Gs","\uFDFC","\uFFE5","lei","\u0414\u0438\u043D.","\u20BD","R\u20A3","\uFDFC","\u20A8","\u062C.\u0633.","kr","\xA3","Le","S","Db","E","\u0E3F","SM","T","\u062F.\u062A","T$","\u20A4","\u20BA","TT$","NT$","TSh","\u20B4","USh","$U","\u043B\u0432","Bs","\u20AB","VT","WS$","FCFA","\u0243","CFA","\u20A3","\uFDFC","R","Z$"];function R(a){return E(a)||A.some(y=>E(a.replace(y,"").replace(/[,.]/g,"")))?"numeric":a.trim()?"text":"empty"}var _=k;function G(a){let y=null,C=null;if(typeof a!="string")throw new TypeError(`csv-sort/sort(): [THROW_ID_01] The input is of a wrong type! We accept either string of array of arrays. We got instead: ${typeof a}, equal to:
11
11
  ${O(a,4)}`);if(!a.trim())return{res:[[""]],msgContent:y,msgType:C};let n=j(a),s=[],g=!1,S=!0,T=[],o=null;for(let t=n.length-1;t>=0;t--)if(s.length){t===0&&(g=n[t].every(l=>{let i=R(l);return i==="text"||i==="empty"})),!g&&s.length!==n[t].length&&(S=!1);let e=null;for(let l=0,i=n[t].length;l<i;l++){let u=R(n[t][l].trim());if(e===null&&u==="empty"&&(e=l),e!==null&&u!=="empty"&&(e=null),u!==s[l]&&!g){let c=u;if(Array.isArray(s[l]))s[l].includes(c)||s[l].push(c);else if(s[l]!==c){let f=s[l];s[l]=[],s[l].push(f),s[l].push(c)}}}o!==null&&e!==null&&e>o&&(!g||g&&t!==0)&&(o=e)}else if(n[t].length!==1||n[t][0]!=="")for(let e=0,l=n[t].length;e<l;e++){let i=R(n[t][e].trim());s.push(i),o===null&&i==="empty"&&(o=e),o!==null&&i!=="empty"&&(o=null)}o||(o=s.length);let D=0;for(let t=0,e=s.length;t<e&&s[t]==="empty";t++)D=t;D!==0&&(n=n.map(t=>t.slice(D+1,o)),s=s.slice(D+1,o));let b=[],p;s.forEach((t,e)=>{t==="numeric"&&b.push(e)});let B=g?1:0;if(b.length===1)p=b[0];else{if(b.length===0)throw new Error('csv-sort/sort(): [THROW_ID_02] Your CSV file does not contain numeric-only columns and computer was not able to detect the "Balance" column!');{let t=Array.from(b),e=[];for(let l=0,i=t.length;l<i;l++){let u=t[l],c,f=!0,h,d=!0;for(let m=B,N=n.length;m<N&&(f&&(c==null?c=n[m][u]:c===n[m][u]?(e.push(u),f=!1):c=n[m][u]),d&&(h==null?h=n[m][u]:n[m][u]!==h&&(d=!1)),!!f);m++);d&&T.push(u)}if(t=x(t,e),t.length===1)p=t[0];else if(t.length===0)throw new Error(`csv-sort/sort(): [THROW_ID_03] The computer can't find the "Balance" column! It saw some numeric-only columns, but they all seem to have certain rows with the same values as rows right below/above them!`)}}if(!p)throw new Error("csv-sort/sort(): [THROW_ID_04] Sadly computer couldn't find its way in this CSV and had to stop working on it.");let V=x(Array.from(s.reduce((t,e,l)=>((typeof e=="string"&&e==="numeric"||Array.isArray(e)&&e.includes("numeric"))&&t.push(l),t),[])),[p,...T]),r=[];r.push(n[n.length-1].slice(0,o));let $=[],v=g?1:0;for(let t=n.length-2;t>=v;t--)for(let e=n.length-2;e>=v;e--)if(!$.includes(e)){let l=!1;for(let i=0,u=V.length;i<u;i++){let c=null;n[e][V[i]]!==""&&(c=w(n[e][V[i]]));let f=null;n[e][p]!==""&&(f=w(n[e][p]));let h=null;r[0][p]!==""&&(h=w(r[0][p]).format());let d=null;r[r.length-1][V[i]]!==""&&(d=w(r[r.length-1][V[i]]).format());let m=null;if(r[r.length-1][p]!==""&&(m=w(r[r.length-1][p])),c&&f.add(c).format()===h){r.unshift(n[e].slice(0,o)),$.push(e),l=!0;break}else if(c&&f.subtract(c).format()===h){r.unshift(n[e].slice(0,o)),$.push(e),l=!0;break}else if(d&&m.add(d).format()===f.format()){r.push(n[e].slice(0,o)),$.push(e),l=!0;break}else if(d&&m.subtract(d).format()===f.format()){r.push(n[e].slice(0,o)),$.push(e),l=!0;break}}if(l){l=!1;break}}return g&&(S&&n[0].length>s.length&&(n[0].length=s.length),r.unshift(n[0].slice(0,o))),n.length-(g?2:1)!==$.length&&(y="Not all rows were recognised!",C="alert"),{res:r,msgContent:y,msgType:C}}export{R as findType,E as isNumeric,G as sort,_ as version};
@@ -1,17 +1,25 @@
1
1
  /**
2
2
  * @name csv-sort
3
3
  * @fileoverview Sort double-entry bookkeeping CSV from internet banking
4
- * @version 7.2.2
4
+ * @version 7.2.4
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/csv-sort/}
8
8
  */
9
9
 
10
- "use strict";var csvSort=(()=>{var ue=Object.create;var j=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames,J=Object.getOwnPropertySymbols,ce=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var P=(e,t,s)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,T=(e,t)=>{for(var s in t||(t={}))G.call(t,s)&&P(e,s,t[s]);if(J)for(var s of J(t))ge.call(t,s)&&P(e,s,t[s]);return e};var he=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(s){throw t=0,s}},me=(e,t)=>{for(var s in t)j(e,s,{get:t[s],enumerable:!0})},z=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of pe(t))!G.call(e,f)&&f!==s&&j(e,f,{get:()=>t[f],enumerable:!(r=fe(t,f))||r.enumerable});return e};var de=(e,t,s)=>(s=e!=null?ue(ce(e)):{},z(t||!e||!e.__esModule?j(s,"default",{value:e,enumerable:!0}):s,e)),ye=e=>z(j({},"__esModule",{value:!0}),e);var F=(e,t,s)=>P(e,typeof t!="symbol"?t+"":t,s);var ie=he((q,K)=>{(function(e,t){typeof q=="object"&&typeof K<"u"?K.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self,e.currency=t())})(q,function(){function e(n,i){if(!(this instanceof e))return new e(n,i);i=Object.assign({},s,i);var a=Math.pow(10,i.precision);this.intValue=n=t(n,i),this.value=n/a,i.increment=i.increment||1/a,i.groups=i.useVedic?f:r,this.s=i,this.p=a}function t(n,i){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,o=i.decimal,l=i.errorOnInvalid,h=i.fromCents,g=Math.pow(10,i.precision),v=n instanceof e;if(v&&h)return n.intValue;if(typeof n=="number"||v)o=v?n.value:n;else if(typeof n=="string")l=new RegExp("[^-\\d"+o+"]","g"),o=new RegExp("\\"+o,"g"),o=(o=n.replace(/\((.*)\)/,"-$1").replace(l,"").replace(o,"."))||0;else{if(l)throw Error("Invalid Input");o=0}return h||(o=(o*g).toFixed(4)),a?Math.round(o):o}var s={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(n,i){var a=i.pattern,o=i.negativePattern,l=i.symbol,h=i.separator,g=i.decimal;i=i.groups;var v=(""+n).replace(/^-/,"").split("."),b=v[0];return v=v[1],(0<=n.value?a:o).replace("!",l).replace("#",b.replace(i,"$1"+h)+(v?g+v:""))},fromCents:!1},r=/(\d)(?=(\d{3})+\b)/g,f=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(n){var i=this.s,a=this.p;return e((this.intValue+t(n,i))/(i.fromCents?1:a),i)},subtract:function(n){var i=this.s,a=this.p;return e((this.intValue-t(n,i))/(i.fromCents?1:a),i)},multiply:function(n){var i=this.s;return e(this.intValue*n/(i.fromCents?1:Math.pow(10,i.precision)),i)},divide:function(n){var i=this.s;return e(this.intValue/t(n,i,!1),i)},distribute:function(n){var i=this.intValue,a=this.p,o=this.s,l=[],h=Math[0<=i?"floor":"ceil"](i/n),g=Math.abs(i-h*n);for(a=o.fromCents?1:a;n!==0;n--){var v=e(h/a,o);0<g--&&(v=v[0<=i?"add":"subtract"](1/a)),l.push(v)}return l},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(n){var i=this.s;return typeof n=="function"?n(this,i):i.format(this,Object.assign({},i,n))},toString:function(){var n=this.s,i=n.increment;return(Math.round(this.intValue/this.p/i)*i).toFixed(n.precision)},toJSON:function(){return this.value}},e})});var Fe={};me(Fe,{findType:()=>_,isNumeric:()=>H,sort:()=>je,version:()=>Ve});function be(){let e=[],t=0,s=!1;return{append(r){return s?!1:t+r.length>1999?(e.push("\u2026"),t+=1,s=!0,!1):(e.push(r),t+=r.length,!0)},result(){return e.join("")},stopped(){return s}}}function ve(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function N(e,t){if(e.append('"')){for(let s=0;s<t.length&&!e.stopped();s+=1){let r=t.charCodeAt(s);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(ve(r)):e.append(t[s])}e.append('"')}}function we(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function Y(e,t){e.append("Symbol(");let s=String(t);s.length>8&&N(e,s.slice(7,-1)),e.append(")")}function Q(e,t){typeof t=="symbol"?Y(e,t):N(e,String(t))}function d(e,t=0){let s=be(),r=t===4?4:0,f=new WeakSet,n=0;function i(u){r&&s.append(" ".repeat(u*r))}function a(u,m){u&&s.append(","),r&&(s.append("\n"),i(m+1))}function o(u,m,w){r&&m&&(s.append("\n"),i(w)),s.append(u)}function l(u,m){Object.prototype.hasOwnProperty.call(u,"value")?b(u.value,m):s.append(we(u))}function h(u,m){let w;try{w=Reflect.getOwnPropertyDescriptor(u,"length")}catch(y){s.append("[Uninspectable]");return}let p=w==null?void 0:w.value;if(!Number.isSafeInteger(p)||p<0){s.append("[Uninspectable]");return}s.append("[");let c=!1;for(let y=0;y<p&&!s.stopped();y+=1){if(a(c,m),c=!0,n>=50){s.append("[MaxEntries]");break}n+=1;let $;try{$=Reflect.getOwnPropertyDescriptor(u,String(y))}catch(A){s.append("[Uninspectable]");continue}$!=null&&$.enumerable?l($,m+1):s.append("[Empty]")}o("]",c,m)}function g(u,m){let w;try{w=Reflect.ownKeys(u)}catch(c){s.append("[Uninspectable]");return}s.append("{");let p=!1;for(let c of w){if(s.stopped())break;if(n>=50){a(p,m),p=!0,N(s,"\u2026"),s.append(r?": ":":"),s.append("[MaxEntries]");break}n+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(u,c)}catch($){a(p,m),p=!0,Q(s,c),s.append(r?": ":":"),s.append("[Uninspectable]");continue}y!=null&&y.enumerable&&(a(p,m),p=!0,Q(s,c),s.append(r?": ":":"),l(y,m+1))}o("}",p,m)}function v(u,m){if(f.has(u)){s.append("[Circular]");return}if(m>=5){s.append("[MaxDepth]");return}let w;try{w=Array.isArray(u)}catch(p){s.append("[Uninspectable]");return}f.add(u);try{w?h(u,m):g(u,m)}finally{f.delete(u)}}function b(u,m){u===null?s.append("null"):typeof u=="string"?N(s,u):typeof u=="number"?s.append(Object.is(u,-0)?"-0":String(u)):typeof u=="boolean"?s.append(u?"true":"false"):typeof u>"u"?s.append("undefined"):typeof u=="bigint"?s.append("".concat(u,"n")):typeof u=="symbol"?Y(s,u):typeof u=="function"?s.append("[Function]"):v(u,m)}try{return b(e,0),s.result()}catch(u){return"[Uninspectable]"}}var _e=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);function X(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function x(e){return typeof e=="string"}function ee(e){return Number.isFinite(e)}function O(e){return Number.isSafeInteger(e)&&e>=0}var Z,Ne=(Z=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:Z.get;var Me=Date.prototype.getTime;function te(e,t){if(!e||!t)return e;let s=!0;for(let a=t.length;a--;)if(t.charCodeAt(a)>127){s=!1;break}if(s){let a=0,o=e.length;if(t.length===1){let l=t.charCodeAt(0);for(;a<o&&e.charCodeAt(a)===l;)a++;for(;o>a&&e.charCodeAt(o-1)===l;)o--}else{for(;a<o&&t.includes(e[a]);)a++;for(;o>a&&t.includes(e[o-1]);)o--}return a===0&&o===e.length?e:e.slice(a,o)}let r=Array.from(e),f=new Set(t),n=0,i=r.length;for(;n<i&&f.has(r[n]);)n++;for(;i>n&&f.has(r[i-1]);)i--;return n===0&&i===r.length?e:r.slice(n,i).join("")}function L(e=[],t=[]){if(!e||!Array.isArray(e)||!e.length)return[];if(!t||!Array.isArray(t)||!t.length)return e;if(e.length*t.length<400)return e.filter(r=>!t.includes(r));let s=new Set(t);return e.filter(r=>!s.has(r))}function E(e){return e!=null}var $e={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function k(e,t){if(!Array.isArray(e)||!e.length)return e;let s=T(T({},$e),t),r,f;if(s.strictlyTwoElementsInRangeArrays&&!e.every((a,o)=>!Array.isArray(a)||a.length!==2?(r=o,f=a.length,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_01] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ".concat(r,"th range (").concat(d(e[r],4),") has not two but ").concat(f," elements!"));if(!e.every((a,o)=>!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(r=o,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(r,"th range (").concat(d(e[r],4),") does not consist of only natural numbers!"));let n=e.length**2,i=0;return Array.from(e).sort((a,o)=>(s.progressFn&&(i+=1,s.progressFn(Math.floor(i*100/n))),a[0]===o[0]?a[1]<o[1]?-1:a[1]>o[1]?1:0:a[0]<o[0]?-1:1))}var Te={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function U(e,t){function s(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}if(!Array.isArray(e)||!e.length)return null;if(t&&!s(t))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(d(t,4)," (type ").concat(typeof t,")"));let r=T(T({},Te),t);if(r.progressFn&&s(r.progressFn)&&!Object.keys(r.progressFn).length)r.progressFn=null;else if(r.progressFn&&typeof r.progressFn!="function")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_02] opts.progressFn must be a function! It was given of a type: "'.concat(typeof r.progressFn,'", equal to ').concat(d(r.progressFn,4)));if(r.mergeType!==1&&r.mergeType!==2&&r.mergeType!=="1"&&r.mergeType!=="2")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_03] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof r.mergeType,'", equal to ').concat(d(r.mergeType,4)));if(typeof r.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof r.joinRangesThatTouchEdges,'", equal to ').concat(d(r.joinRangesThatTouchEdges,4)));let f=r.progressFn,n=r.joinRangesThatTouchEdges,i=[];for(let u of e)Array.isArray(u)&&(u[2]!==void 0||u[0]!==u[1])&&i.push([...u]);let a,o,l;f?a=k(i,{progressFn:u=>{l=Math.floor(u/5),l!==o&&(o=l,f(l))}}):a=k(i);let h=a.length-1,g=r.mergeType===2||r.mergeType==="2",v=a.length;for(let u=h;u>=0;u--){let m=a[u];for(f&&u<h&&(l=Math.floor((1-(u+1)/h)*78)+21,l!==o&&l>o&&(o=l,f(l)));v<a.length;){let w=a[v],p=w[0]===m[0];if(!p&&(n?w[0]>m[1]:w[0]>=m[1]))break;let c=w[1]>=m[1];c&&(m[1]=w[1]),w[2]!==void 0&&(p||c)&&m[2]!==null&&(w[2]===null&&m[2]!==null?m[2]=null:m[2]!=null?g&&p?m[2]=w[2]:m[2]+=w[2]:m[2]=w[2]),v+=1}v-=1,a[v]=m}let b=a.length-v;for(let u=0;u<b;u++)a[u]=a[v+u];return a.length=b,a.length?a:null}function M(e){if(typeof e=="number")return Number.isInteger(e)&&e>=0;if(typeof e!="string"||!e.trim())return!1;let t=Number(e);return Number.isInteger(t)&&t>=0}function re(e,t,s){let r=0,f=0;if(e===void 0&&t===void 0&&s===void 0)throw new Error("ranges-apply/rApply(): [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError("ranges-apply/rApply(): [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(typeof e,", equal to: ").concat(d(e,4)));if(t!=null&&!Array.isArray(t))throw new TypeError("ranges-apply/rApply(): [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof t,", equal to: ").concat(d(t,4)));if(s&&typeof s!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function (or falsy)! Currently it's: ".concat(typeof s,", equal to: ").concat(d(s,4)));if(!(t!=null&&t.some(Boolean)))return e;let n;Array.isArray(t)&&!Array.isArray(t[0])&&M(t[0])&&M(t[1])?n=[Array.from(t)]:n=Array.from(t);let i=n.length,a=0;n.forEach((h,g)=>{if(h){if(s&&(r=Math.floor(a/i*10),r!==f&&(f=r,s(r))),!Array.isArray(h))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(g,"th element not an array: ").concat(d(h,4),", which is ").concat(typeof h));if(!M(h[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(g,"th element, array ").concat(d(h),". Its first element is not a non-negative integer or string index, but ").concat(typeof h[0],", equal to: ").concat(d(h[0],4),"."));if(typeof h[0]=="string"&&(n[g]=[...h],n[g][0]=Number(h[0])),!M(h[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(g,"th element, array ").concat(d(h),". Its second element is not a non-negative integer or string index, but ").concat(typeof h[1],", equal to: ").concat(d(h[1],4),"."));typeof h[1]=="string"&&(n[g]===h&&(n[g]=[...h]),n[g][1]=Number(h[1])),a+=1}});let o=s?U(n,{progressFn:h=>{r=10+Math.floor(h/10),r!==f&&(f=r,s(r))}}):U(n),l=(o==null?void 0:o.length)||0;if(o&&l>0){let h=e.slice(o[l-1][1]);e=o.reduce((g,v,b,u)=>{s&&(r=20+Math.floor(b/l*80),r!==f&&(f=r,s(r)));let m=b===0?0:u[b-1][1],w=u[b][0];return"".concat(g).concat(e.slice(m,w)).concat(u[b][2]||"")},""),e+=h}return e}function B(e,t=1){let s="\xA0";function r(n){return Array.from(n).reverse().join("")}function f(n,i,a){let o=a?"\n":"\r",l=a?"\r":"\n";if(!n)return n;let h=0,g=0,v="";for(let b=0,u=n.length;b<u;b++)(n[b]===o||n[b]===l&&n[b-1]!==o)&&g++,"\r\n".includes(n[b])||n[b]===s?(h=0,n[b]===s?v+=n[b]:n[b]===o?g<=i&&(v+=n[b],n[b+1]===l&&(v+=n[b+1],b++)):n[b]===l&&(n==null?void 0:n[b-1])!==o&&g<=i&&(v+=n[b])):(h++,!n[b+1]&&!g&&(v+=" "));return v}if(typeof e=="string"&&e.length){let n=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(n=+t);let i="",a="";if(!e.trim())i=e;else if(!e[0].trim()){for(let o=0,l=e.length;o<l;o++)if(e[o].trim()){i=e.slice(0,o);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===s)){for(let o=e.length;o--;)if(e[o].trim()){a=e.slice(o+1);break}}return"".concat(f(i,n,!1)).concat(e.trim()).concat(r(f(r(a),n,!0)))}return e}var Ae={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Re(e,t){function s(l){return!!l&&typeof l=="object"&&!Array.isArray(l)}if(!Array.isArray(e)||!e.length)return null;if(t&&!s(t))throw new TypeError("ranges-push/rMerge(): [THROW_ID_10] the second input argument must be a plain object. It was given as:\n".concat(d(t,4)," (type ").concat(typeof t,")"));let r=T(T({},Ae),t);if(r.progressFn&&s(r.progressFn)&&!Object.keys(r.progressFn).length)r.progressFn=null;else if(r.progressFn&&typeof r.progressFn!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_11] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof r.progressFn,'", equal to ').concat(d(r.progressFn,4)));if(![1,2,"1","2"].includes(r.mergeType))throw new TypeError('ranges-push/rMerge(): [THROW_ID_12] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof r.mergeType,'", equal to ').concat(d(r.mergeType,4)));if(typeof r.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_13] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof r.joinRangesThatTouchEdges,'", equal to ').concat(d(r.joinRangesThatTouchEdges,4)));let f=e.filter(l=>Array.isArray(l)).map(l=>[...l]).filter(l=>l[2]!==void 0||l[0]!==l[1]),n,i,a;r.progressFn?n=k(f,{progressFn:l=>{a=Math.floor(l/5),a!==i&&(i=a,r.progressFn!=null&&r.progressFn(a))}}):n=k(f);let o=n.length-1;for(let l=o;l>0;l--)r.progressFn&&(a=Math.floor((1-l/o)*78)+21,a!==i&&a>i&&(i=a,r.progressFn(a))),(n[l][0]<=n[l-1][0]||!r.joinRangesThatTouchEdges&&n[l][0]<n[l-1][1]||r.joinRangesThatTouchEdges&&n[l][0]<=n[l-1][1])&&(n[l-1][0]=Math.min(n[l][0],n[l-1][0]),n[l-1][1]=Math.max(n[l][1],n[l-1][1]),n[l][2]!==void 0&&(n[l-1][0]>=n[l][0]||n[l-1][1]<=n[l][1])&&n[l-1][2]!==null&&(n[l][2]===null&&n[l-1][2]!==null?n[l-1][2]=null:n[l-1][2]!=null?+r.mergeType==2&&n[l-1][0]===n[l][0]?n[l-1][2]=n[l][2]:n[l-1][2]+=n[l][2]:n[l-1][2]=n[l][2]),n.splice(l,1),l=n.length);return n.length?n:null}var Se={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1};function ne(e){return e[2]===void 0&&e[0]===e[1]}function De(e){let t=-1;for(let s=0,r=e.length;s<r;s++){let f=e[s];if(Array.isArray(f)){if(f[0]<t)return!1;t=f[0]}}return!0}var se=class{constructor(e){F(this,"ranges");F(this,"opts");F(this,"sorted");if(e!=null&&!X(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(d(e,4)," (type ").concat(typeof e,")."));let t=T(T({},Se),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(x(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(x(t.mergeType)&&t.mergeType.trim()==="2")t.mergeType=2;else throw new Error('ranges-push/Ranges/constructor(): [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof t.mergeType,'", equal to ').concat(d(t.mergeType,4)));this.opts=t,this.ranges=[],this.sorted=!0}add(e,t,s){var n;if(e==null&&t==null)return;if(E(e)&&!E(t)){if(Array.isArray(e)){if(e.length){if(e.some(i=>Array.isArray(i))){e.forEach(i=>{Array.isArray(i)&&this.add(...i)});return}e.length&&O(+e[0])&&O(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_03] the first input argument, "from" is set ('.concat(d(e),') but second-one, "to" is not (').concat(d(t),")"))}else if(!E(e)&&E(t))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_04] the second input argument, "to" is set ('.concat(d(t),') but first-one, "from" is not (').concat(d(e),")"));let r=+e,f=+t;if(O(r)&&O(f)){if(E(s)&&!x(s)&&!ee(s))throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_05] The third argument, the value to add, was given not as string but ".concat(typeof s,", equal to:\n").concat(d(s,4)));if(E(this.ranges)&&Array.isArray(this.last())&&r===this.last()[1]){if(this.last()[1]=f,this.last()[2],this.last()[2]!==null&&E(s)){let i=this.last()[2]&&this.last()[2].length&&(!((n=this.opts)!=null&&n.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(s):s;this.opts.limitToBeAddedWhitespace&&(i=B(i,this.opts.limitLinebreaksCount)),x(i)&&!i.length||(this.last()[2]=i)}}else{this.ranges||(this.ranges=[]);let i=this.last();i&&r<i[0]&&(this.sorted=!1);let a=s!==void 0&&!(x(s)&&!s.length)?[r,f,s&&this.opts.limitToBeAddedWhitespace?B(s,this.opts.limitLinebreaksCount):s]:[r,f];this.ranges.push(a)}}else throw O(r)?new TypeError('ranges-push/Ranges/add(): [THROW_ID_07] "to" value, the second input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof t,'" equal to: ').concat(d(t,4))):new TypeError('ranges-push/Ranges/add(): [THROW_ID_06] "from" value, the first input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof e,'" equal to: ').concat(d(e,4)))}push(e,t,s){this.add(e,t,s)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Re(this.ranges,{mergeType:this.opts.mergeType}),this.sorted=!0,this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>E(e[2])?[e[0],e[1],B(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}firstCovers(e){if(!O(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_08] the input argument must be a natural number or zero! It was given as ".concat(d(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=null;if(this.sorted){for(let r=0,f=this.ranges.length;r<f;r++){let n=this.ranges[r];if(!(!Array.isArray(n)||ne(n))){if(t===null){if(n[0]!==0)return!1;t=n[1]}else{if(n[0]>t)break;n[1]>t&&(t=n[1])}if(t>=e)return!0}}return t!==null&&t>=e}let s=!0;for(;s;){s=!1;for(let r=0,f=this.ranges.length;r<f;r++){let n=this.ranges[r];if(!(!Array.isArray(n)||ne(n))){if(n[0]<0)return!1;(t===null?n[0]===0:n[0]<=t&&n[1]>t)&&(t=n[1],s=!0)}}}return t!==null&&t>=e}wipe(){this.ranges=[],this.sorted=!0}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&O(e[0][0]))this.ranges=Array.from(e),this.sorted=De(this.ranges);else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_09] Single range was given but we expected array of arrays! The first element, ".concat(d(e[0],4)," should be an array and its first element should be an integer, a string index."));else this.ranges=[],this.sorted=!0}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var Ce={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function W(e,t){let s=!0,r=[".",",","'"," "],f;if(typeof e!="string")throw new TypeError("string-remove-thousand-separators/remSep(): [THROW_ID_01] Input must be string! Currently it's: ".concat(typeof e,", equal to:\n").concat(d(e,4)));if(t&&typeof t!="object")throw new TypeError("string-remove-thousand-separators/remSep(): [THROW_ID_02] Options object must be a plain object! Currently it's: ".concat(typeof t,", equal to:\n").concat(d(t,4)));let n=T(T({},Ce),t),i=te(e.trim(),'"');if(i==="")return i;if(+e>0&&+e<1)return e;let a=new se;for(let o=0,l=i.length;o<l;o++){if(n.removeThousandSeparatorsFromNumbers&&i[o].trim()===""&&a.add(o,o+1),n.removeThousandSeparatorsFromNumbers&&i[o]==="'"&&(a.add(o,o+1),i[o+1]==="'")){s=!1;break}if(r.includes(i[o])){if(i[o+1]!==void 0&&/^\d$/.test(i[o+1]))if(i[o+2]!==void 0)if(/^\d$/.test(i[o+2]))if(i[o+3]!==void 0)if(/^\d$/.test(i[o+3])){if(i[o+4]!==void 0&&/^\d$/.test(i[o+4])){s=!1;break}else if(n.removeThousandSeparatorsFromNumbers&&a.add(o,o+1),!f)f=i[o];else if(i[o]!==f){s=!1;break}}else{s=!1;break}else n.removeThousandSeparatorsFromNumbers&&n.forceUKStyle&&i[o]===","&&a.add(o,o+1,".");else{s=!1;break}else n.forceUKStyle&&i[o]===","&&a.add(o,o+1,"."),n.padSingleDecimalPlaceNumbers&&a.add(o+2,o+2,"0")}else if(!/^\d$/.test(i[o])){s=!1;break}}return s&&a.current()?re(i,a.current()):i}var Ee={delimiter:",",removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function Oe(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Ie(e,t){let s=0,r=e.length;for(;s<r&&e[s]!==t&&e[s].trim()==="";)s+=1;for(;r>s&&e[r-1]!==t&&e[r-1].trim()==="";)r-=1;return e.slice(s,r)}function oe(e,t){let s=0,r=0,f=[],n=[],i=!1,a=!0;if(t&&!Oe(t))throw new Error("csv-split-easy/splitEasy(): [THROW_ID_01] Options object must be a plain object! Currently it's of a type ".concat(typeof t," equal to:\n").concat(d(t,4)));let o=T(T({},Ee),t);if(typeof e!="string")throw new TypeError("csv-split-easy/splitEasy(): [THROW_ID_02] input must be string! Currently it's: ".concat(typeof e,", equal to: ").concat(d(e,4)));if(typeof o.delimiter!="string"||o.delimiter.length!==1||o.delimiter==='"'||o.delimiter==="\n"||o.delimiter==="\r")throw new TypeError('csv-split-easy/splitEasy(): [THROW_ID_03] The "delimiter" option must be a single character other than a double quote or a line break! Currently it\'s: '.concat(typeof o.delimiter,", equal to: ").concat(d(o.delimiter)));if(e==="")return[[""]];e=Ie(e,o.delimiter);for(let l=0,h=e.length;l<h;l++){if(a&&e[l]!=='"'&&e[l]!==o.delimiter&&e[l].trim()!==""&&(a=!1),e[l]==='"')if(i&&e[l+1]==='"')l+=1;else if(i){i=!1;let g=e.slice(s,l);g.trim()!==""&&(a=!1);let v=/""/.test(g)?g.replace(/""/g,'"'):W(g,{removeThousandSeparatorsFromNumbers:o.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:o.padSingleDecimalPlaceNumbers,forceUKStyle:o.forceUKStyle});f.push(v)}else i=!0,s=l+1;else if(!i&&e[l]===o.delimiter){if(e[l-1]!=='"'&&!i){let g=e.slice(s,l);g.trim()!==""&&(a=!1),f.push(W(g,{removeThousandSeparatorsFromNumbers:o.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:o.padSingleDecimalPlaceNumbers,forceUKStyle:o.forceUKStyle}))}s=l+1,r&&(r=0)}else if(e[l]==="\n"||e[l]==="\r"){if(!r){if(r=l,!i&&e[l-1]!=='"'){let g=e.slice(s,l);g.trim()!==""&&(a=!1),f.push(W(g,{removeThousandSeparatorsFromNumbers:o.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:o.padSingleDecimalPlaceNumbers,forceUKStyle:o.forceUKStyle}))}a?f.length=0:n.push(f),a=!0,f=[]}s=l+1}else r&&(r=0,s=l);if(l+1===h){if(e[l]!=='"'){let g=e.slice(s,l+1);g.trim()&&(a=!1),f.push(W(g,{removeThousandSeparatorsFromNumbers:o.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:o.padSingleDecimalPlaceNumbers,forceUKStyle:o.forceUKStyle}))}a?f=[]:n.push(f),a=!0}}return n.length===0?[[""]]:n}var V=de(ie(),1);var le="7.2.2";function H(e){return typeof e=="number"&&!Number.isNaN(e)?!0:(e=(e||"").toString().trim(),e?!Number.isNaN(+e):!1)}var ke=["\u062F.\u0625","\u060B","L","\u058F","\u0192","Kz","$","\u0192","\u20BC","KM","\u09F3","\u043B\u0432",".\u062F.\u0628","FBu","$b","R$","\u0E3F","Nu.","P","p.","BZ$","FC","CHF","\xA5","\u20A1","\u20B1","K\u010D","Fdj","kr","RD$","\u062F\u062C","kr","Nfk","Br","\u039E","\u20AC","\u20BE","\u20B5","GH\u20B5","D","FG","Q","L","kn","G","Ft","Rp","\u20AA","\u20B9","\u0639.\u062F","\uFDFC","kr","J$","JD","\xA5","KSh","\u043B\u0432","\u17DB","CF","\u20A9","\u20A9","KD","\u043B\u0432","\u20AD","\u20A8","M","\u0141","Lt","Ls","LD","MAD","lei","Ar","\u0434\u0435\u043D","K","\u20AE","MOP$","UM","\u20A8","Rf","MK","RM","MT","\u20A6","C$","kr","\u20A8","\uFDFC","B/.","S/.","K","\u20B1","\u20A8","z\u0142","Gs","\uFDFC","\uFFE5","lei","\u0414\u0438\u043D.","\u20BD","R\u20A3","\uFDFC","\u20A8","\u062C.\u0633.","kr","\xA3","Le","S","Db","E","\u0E3F","SM","T","\u062F.\u062A","T$","\u20A4","\u20BA","TT$","NT$","TSh","\u20B4","USh","$U","\u043B\u0432","Bs","\u20AB","VT","WS$","FCFA","\u0243","CFA","\u20A3","\uFDFC","R","Z$"];function _(e){return H(e)||ke.some(t=>H(e.replace(t,"").replace(/[,.]/g,"")))?"numeric":e.trim()?"text":"empty"}var Ve=le;function je(e){let t=null,s=null;if(typeof e!="string")throw new TypeError("csv-sort/sort(): [THROW_ID_01] The input is of a wrong type! We accept either string of array of arrays. We got instead: ".concat(typeof e,", equal to:\n").concat(d(e,4)));if(!e.trim())return{res:[[""]],msgContent:t,msgType:s};let r=oe(e),f=[],n=!1,i=!0,a=[],o=null;for(let p=r.length-1;p>=0;p--)if(f.length){p===0&&(n=r[p].every(y=>{let $=_(y);return $==="text"||$==="empty"})),!n&&f.length!==r[p].length&&(i=!1);let c=null;for(let y=0,$=r[p].length;y<$;y++){let A=_(r[p][y].trim());if(c===null&&A==="empty"&&(c=y),c!==null&&A!=="empty"&&(c=null),A!==f[y]&&!n){let R=A;if(Array.isArray(f[y]))f[y].includes(R)||f[y].push(R);else if(f[y]!==R){let S=f[y];f[y]=[],f[y].push(S),f[y].push(R)}}}o!==null&&c!==null&&c>o&&(!n||n&&p!==0)&&(o=c)}else if(r[p].length!==1||r[p][0]!=="")for(let c=0,y=r[p].length;c<y;c++){let $=_(r[p][c].trim());f.push($),o===null&&$==="empty"&&(o=c),o!==null&&$!=="empty"&&(o=null)}o||(o=f.length);let l=0;for(let p=0,c=f.length;p<c&&f[p]==="empty";p++)l=p;l!==0&&(r=r.map(p=>p.slice(l+1,o)),f=f.slice(l+1,o));let h=[],g;f.forEach((p,c)=>{p==="numeric"&&h.push(c)});let v=n?1:0;if(h.length===1)g=h[0];else{if(h.length===0)throw new Error('csv-sort/sort(): [THROW_ID_02] Your CSV file does not contain numeric-only columns and computer was not able to detect the "Balance" column!');{let p=Array.from(h),c=[];for(let y=0,$=p.length;y<$;y++){let A=p[y],R,S=!0,I,C=!0;for(let D=v,ae=r.length;D<ae&&(S&&(R==null?R=r[D][A]:R===r[D][A]?(c.push(A),S=!1):R=r[D][A]),C&&(I==null?I=r[D][A]:r[D][A]!==I&&(C=!1)),!!S);D++);C&&a.push(A)}if(p=L(p,c),p.length===1)g=p[0];else if(p.length===0)throw new Error('csv-sort/sort(): [THROW_ID_03] The computer can\'t find the "Balance" column! It saw some numeric-only columns, but they all seem to have certain rows with the same values as rows right below/above them!')}}if(!g)throw new Error("csv-sort/sort(): [THROW_ID_04] Sadly computer couldn't find its way in this CSV and had to stop working on it.");let b=L(Array.from(f.reduce((p,c,y)=>((typeof c=="string"&&c==="numeric"||Array.isArray(c)&&c.includes("numeric"))&&p.push(y),p),[])),[g,...a]),u=[];u.push(r[r.length-1].slice(0,o));let m=[],w=n?1:0;for(let p=r.length-2;p>=w;p--)for(let c=r.length-2;c>=w;c--)if(!m.includes(c)){let y=!1;for(let $=0,A=b.length;$<A;$++){let R=null;r[c][b[$]]!==""&&(R=(0,V.default)(r[c][b[$]]));let S=null;r[c][g]!==""&&(S=(0,V.default)(r[c][g]));let I=null;u[0][g]!==""&&(I=(0,V.default)(u[0][g]).format());let C=null;u[u.length-1][b[$]]!==""&&(C=(0,V.default)(u[u.length-1][b[$]]).format());let D=null;if(u[u.length-1][g]!==""&&(D=(0,V.default)(u[u.length-1][g])),R&&S.add(R).format()===I){u.unshift(r[c].slice(0,o)),m.push(c),y=!0;break}else if(R&&S.subtract(R).format()===I){u.unshift(r[c].slice(0,o)),m.push(c),y=!0;break}else if(C&&D.add(C).format()===S.format()){u.push(r[c].slice(0,o)),m.push(c),y=!0;break}else if(C&&D.subtract(C).format()===S.format()){u.push(r[c].slice(0,o)),m.push(c),y=!0;break}}if(y){y=!1;break}}return n&&(i&&r[0].length>f.length&&(r[0].length=f.length),u.unshift(r[0].slice(0,o))),r.length-(n?2:1)!==m.length&&(t="Not all rows were recognised!",s="alert"),{res:u,msgContent:t,msgType:s}}return ye(Fe);})();
10
+ "use strict";var csvSort=(()=>{var ve=Object.create;var I=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,Ae=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable;var q=(e,r,t)=>r in e?I(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,R=(e,r)=>{for(var t in r||(r={}))ee.call(r,t)&&q(e,t,r[t]);if(X)for(var t of X(r))Te.call(r,t)&&q(e,t,r[t]);return e};var Ce=(e,r)=>()=>{try{return r||e((r={exports:{}}).exports,r),r.exports}catch(t){throw r=0,t}},Se=(e,r)=>{for(var t in r)I(e,t,{get:r[t],enumerable:!0})},te=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of we(r))!ee.call(e,o)&&o!==t&&I(e,o,{get:()=>r[o],enumerable:!(n=$e(r,o))||n.enumerable});return e};var Re=(e,r,t)=>(t=e!=null?ve(Ae(e)):{},te(r||!e||!e.__esModule?I(t,"default",{value:e,enumerable:!0}):t,e)),Oe=e=>te(I({},"__esModule",{value:!0}),e);var V=(e,r,t)=>q(e,typeof r!="symbol"?r+"":r,t);var me=Ce((Z,Y)=>{(function(e,r){typeof Z=="object"&&typeof Y<"u"?Y.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self,e.currency=r())})(Z,function(){function e(s,l){if(!(this instanceof e))return new e(s,l);l=Object.assign({},t,l);var a=Math.pow(10,l.precision);this.intValue=s=r(s,l),this.value=s/a,l.increment=l.increment||1/a,l.groups=l.useVedic?o:n,this.s=l,this.p=a}function r(s,l){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,i=l.decimal,_=l.errorOnInvalid,p=l.fromCents,c=Math.pow(10,l.precision),d=s instanceof e;if(d&&p)return s.intValue;if(typeof s=="number"||d)i=d?s.value:s;else if(typeof s=="string")_=new RegExp("[^-\\d"+i+"]","g"),i=new RegExp("\\"+i,"g"),i=(i=s.replace(/\((.*)\)/,"-$1").replace(_,"").replace(i,"."))||0;else{if(_)throw Error("Invalid Input");i=0}return p||(i=(i*c).toFixed(4)),a?Math.round(i):i}var t={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(s,l){var a=l.pattern,i=l.negativePattern,_=l.symbol,p=l.separator,c=l.decimal;l=l.groups;var d=(""+s).replace(/^-/,"").split("."),b=d[0];return d=d[1],(0<=s.value?a:i).replace("!",_).replace("#",b.replace(l,"$1"+p)+(d?c+d:""))},fromCents:!1},n=/(\d)(?=(\d{3})+\b)/g,o=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(s){var l=this.s,a=this.p;return e((this.intValue+r(s,l))/(l.fromCents?1:a),l)},subtract:function(s){var l=this.s,a=this.p;return e((this.intValue-r(s,l))/(l.fromCents?1:a),l)},multiply:function(s){var l=this.s;return e(this.intValue*s/(l.fromCents?1:Math.pow(10,l.precision)),l)},divide:function(s){var l=this.s;return e(this.intValue/r(s,l,!1),l)},distribute:function(s){var l=this.intValue,a=this.p,i=this.s,_=[],p=Math[0<=l?"floor":"ceil"](l/s),c=Math.abs(l-p*s);for(a=i.fromCents?1:a;s!==0;s--){var d=e(p/a,i);0<c--&&(d=d[0<=l?"add":"subtract"](1/a)),_.push(d)}return _},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(s){var l=this.s;return typeof s=="function"?s(this,l):l.format(this,Object.assign({},l,s))},toString:function(){var s=this.s,l=s.increment;return(Math.round(this.intValue/this.p/l)*l).toFixed(s.precision)},toJSON:function(){return this.value}},e})});var Ge={};Se(Ge,{findType:()=>F,isNumeric:()=>U,sort:()=>Je,version:()=>Ke});function De(){let e=[],r=0,t=!1;return{append(n){return t?!1:r+n.length>1999?(e.push("\u2026"),r+=1,t=!0,!1):(e.push(n),r+=n.length,!0)},result(){return e.join("")},stopped(){return t}}}function xe(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function M(e,r){if(e.append('"')){for(let t=0;t<r.length&&!e.stopped();t+=1){let n=r.charCodeAt(t);n===34?e.append('\\"'):n===92?e.append("\\\\"):n===8?e.append("\\b"):n===9?e.append("\\t"):n===10?e.append("\\n"):n===12?e.append("\\f"):n===13?e.append("\\r"):n<32||n===8232||n===8233||n>=55296&&n<=57343?e.append(xe(n)):e.append(r[t])}e.append('"')}}function Ee(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function ne(e,r){e.append("Symbol(");let t=String(r);t.length>8&&M(e,t.slice(7,-1)),e.append(")")}function re(e,r){typeof r=="symbol"?ne(e,r):M(e,String(r))}function h(e,r=0){let t=De(),n=r===4?4:0,o=new WeakSet,s=0;function l(u){n&&t.append(" ".repeat(u*n))}function a(u,y){u&&t.append(","),n&&(t.append("\n"),l(y+1))}function i(u,y,$){n&&y&&(t.append("\n"),l($)),t.append(u)}function _(u,y){Object.prototype.hasOwnProperty.call(u,"value")?b(u.value,y):t.append(Ee(u))}function p(u,y){let $;try{$=Reflect.getOwnPropertyDescriptor(u,"length")}catch(m){t.append("[Uninspectable]");return}let f=$==null?void 0:$.value;if(!Number.isSafeInteger(f)||f<0){t.append("[Uninspectable]");return}t.append("[");let g=!1;for(let m=0;m<f&&!t.stopped();m+=1){if(a(g,y),g=!0,s>=50){t.append("[MaxEntries]");break}s+=1;let v;try{v=Reflect.getOwnPropertyDescriptor(u,String(m))}catch(w){t.append("[Uninspectable]");continue}v!=null&&v.enumerable?_(v,y+1):t.append("[Empty]")}i("]",g,y)}function c(u,y){let $;try{$=Reflect.ownKeys(u)}catch(g){t.append("[Uninspectable]");return}t.append("{");let f=!1;for(let g of $){if(t.stopped())break;if(s>=50){a(f,y),f=!0,M(t,"\u2026"),t.append(n?": ":":"),t.append("[MaxEntries]");break}s+=1;let m;try{m=Reflect.getOwnPropertyDescriptor(u,g)}catch(v){a(f,y),f=!0,re(t,g),t.append(n?": ":":"),t.append("[Uninspectable]");continue}m!=null&&m.enumerable&&(a(f,y),f=!0,re(t,g),t.append(n?": ":":"),_(m,y+1))}i("}",f,y)}function d(u,y){if(o.has(u)){t.append("[Circular]");return}if(y>=5){t.append("[MaxDepth]");return}let $;try{$=Array.isArray(u)}catch(f){t.append("[Uninspectable]");return}o.add(u);try{$?p(u,y):c(u,y)}finally{o.delete(u)}}function b(u,y){u===null?t.append("null"):typeof u=="string"?M(t,u):typeof u=="number"?t.append(Object.is(u,-0)?"-0":String(u)):typeof u=="boolean"?t.append(u?"true":"false"):typeof u>"u"?t.append("undefined"):typeof u=="bigint"?t.append("".concat(u,"n")):typeof u=="symbol"?ne(t,u):typeof u=="function"?t.append("[Function]"):d(u,y)}try{return b(e,0),t.result()}catch(u){return"[Uninspectable]"}}var je=["_16_0_a_0_4_0_5_m_1_u_1_cp_4_b_e_4_7_0_1_0_3l_4_1_1_2_3_1_0_6_0_1_2_1_0_1_j_1_2a_1_3u_8_4l_1_11_2_0_","6_14_1z_q_4_3_19_16_z_1_1_2q_1_0_f_1_7_1_a_2_2_0_g_0_1_t_t_2g_b_0_o_w_9_1_4_0_5_l_4_0_9_0_3_0_n_o_7_","a_5_n_1_6_g_15_1m_1h_3_0_i_0_7_9_f_f_4_7_2_1_2_l_1_6_1_0_3_3_3_0_g_0_d_1_1_2_e_1_a_0_8_5_4_1_2_l_1_6","_1_1_1_1_1_1_v_3_1_0_j_2_g_8_1_2_1_l_1_6_1_1_1_4_3_0_i_0_f_1_n_0_b_7_2_1_2_l_1_6_1_1_1_4_3_0_u_1_1_2","_f_0_h_0_1_5_3_2_1_3_3_1_1_0_1_1_3_1_3_2_3_b_m_0_1g_7_1_2_1_m_1_f_3_0_q_2_1_1_2_1_u_0_4_7_1_2_1_m_1_","9_1_4_3_0_u_2_1_1_f_1_h_8_1_2_1_14_2_0_g_0_5_2_8_2_o_5_5_h_3_n_1_8_1_0_2_6_1m_1b_1_1_c_6_1m_1_1_0_1_","4_1_n_1_0_1_9_1_1_9_0_2_4_1_0_l_3_w_0_1r_7_1_z_r_4_37_16_k_0_g_5_4_3_3_0_3_1_7_2_4_c_c_0_h_11_1_0_5_","0_2_16_1_98_1_3_2_6_1_0_1_3_2_14_1_3_2_w_1_3_2_6_1_0_1_3_2_e_1_1k_1_3_2_1u_11_f_g_2d_2_5_3_h7_2_g_1_","p_5_22_6_7_7_h_d_i_e_h_e_c_1_2_f_1f_z_0_4_0_1v_2g_7_4_2_x_1_0_5_1x_a_u_1d_t_2_4_b_17_4_p_1i_m_9_1g_2","a_0_2l_1a_h_7_1i_t_d_1_a_17_q_z_15_2_a_z_2_a_5_16_2_2_15_3_1_5_1_1_3_0_5_5b_1s_7p_2_5_2_11_2_5_2_7_1","_0_1_0_1_0_1_u_2_1g_1_6_1_0_3_2_1_6_3_3_2_5_4_c_5_2_1_6_38_0_d_0_g_c_2t_0_4_0_2_9_1_0_3_4_6_0_1_0_1_","0_1_3_1_a_2_3_5_4_4_0_1g_1_22j_6c_6_3_3_1_c_11_1_0_5_0_2_1j_7_0_g_m_9_6_1_6_1_6_1_6_1_6_1_6_1_6_1_6_","28_0_d1_1_16_4_5_1_4_2d_6_2_1_2h_1_3_5_16_1_2l_h_v_1c_f_e8_533_1s_h3g_1v_19_2_7g_3_f_a_1_k_1a_g_u_2_","1x_1d_8_2_2u_2_29_k_g_1_2_1_3_1_m_t_1f_e_1d_1q_5_3_0_1_1_b_r_a_m_p_s_7_1a_s_0_g_4_1_9_a_4_1_14_n_2_1","_7_k_m_3_0_3_1d_1_0_3_1_2_4_2_0_1_0_o_2_2_a_7_2_c_5_2_5_2_5_9_6_1_6_1_16_1_d_6_36_t_8mb_c_m_4_1c_6is","_a5_2_2x_12_6_c_4_5_0_1_9_1_c_1_4_1_0_1_1_1_1_1_2z_x_a2_i_1r_2_1h_14_b_38_4_1_3q_10_p_6_p_b_2g_3_5_2","_5_2_5_2_2_z_b_1_p_1_i_1_1_1_e_2_d_y_3e_at_s_3_1c_1b_v_d_j_1_7_6_11_a_t_2_z_4_7_1c_4d_i_z_4_z_4_13_8","_1f_c_a_1_e_1_6_1_1_1_a_1_e_1_6_1_1_3_1f_c_8m_9_l_a_7_o_5_1_15_1_8_1x_5_2_0_1_17_1_1_3_0_2_m_a_m_9_u","_1t_i_1_1_a_l_a_p_6_p_12_1j_6_1_1s_0_f_3_1_2_1_s_16_s_3_s_z_7_1_r_r_1h_a_l_a_i_d_h_32_20_1j_1e_d_1e_","d_z_12_r_9_m_6y_15_6_1_g_5_1k_s_a_0_8_l_16_h_1a_k_r_m_c_1g_1l_1_2_0_d_18_w_o_q_z_t_0_2_0_8_y_3_0_c_1","b_e_3_l_0_1_0_z_h_1_o_j_1_1r_6_1_0_1_3_1_e_1_9_7_1a_12_7_2_1_2_l_1_6_1_1_1_4_3_0_i_0_c_4_u_9_1_0_2_0","_1_11_1_0_p_0_1_0_18_1g_i_3_k_2_u_1b_k_1_1_0_54_1a_15_3_10_1b_k_0_1n_16_d_0_1z_q_11_6_55_17_38_1r_v_","7_2_0_2_7_1_1_1_n_f_0_1_0_2m_7_2_12_g_0_1_0_s_0_a_13_7_0_l_0_b_19_j_0_i_20_5j_w_v_8_1_10_h_0_1d_t_34","_6_1_1_1_11_l_0_p_5_1_1_1_v_e_0_n_17_78_i_f_0_1_c_1_x_3g_0_27_pl_6e_5f_218_2o_f_tr_h_5_p_32y_5_g6_5a","1_t_1cy_fs_7_u_h_26_h_t_i_1b_g_3_v_k_5_i_c0_18_5v_1r_w_o_2_o_18_22_5_0_1u_c_1s_1_1_0_e_1_c_5p1_15_v_","2p_36_6pp_3_1_6_1_1_1_82_f_0_t_2_2_0_e_3_8_az_1s4_2y_5_c_3_8_7_9_4me_2c_1_1y_1_1_2_0_2_1_2_3_1_b_1_0","_1_6_1_1s_1_3_2_7_1_6_1_r_1_3_1_4_1_0_3_6_1_9f_2_o_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_7_1f8_u_6_5","_79_1p_42_18_a_6_g_0_8x_t_i_17_dg_r_6c_t_2_0_5r_u_1_2_1_1_1_6_2_4_9_1_68_6_1_3_1_1_1_e_1_5g_1n_1v_7_","0_xg_3_1_q_1_1_1_0_2_0_1_9_1_3_1_0_1_0_6_0_4_0_1_0_1_0_1_2_1_1_1_0_2_0_1_0_1_0_1_0_1_0_1_1_1_0_2_3_1","_6_1_3_1_3_1_0_1_9_1_g_5_2_1_4_1_g_3es_wyn_w_3dp_2_4gd_2_5rk_f_h9_1wi_f1_15u_3t6_5_6jt"].join(""),z=je.slice(1).split("_"),ke=[],se=127;for(let e=0;e<z.length;e+=2){let r=se+1+Number.parseInt(z[e],36),t=r+Number.parseInt(z[e+1],36);ke.push([r,t]),se=t}var Xe=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var _e=Function.prototype.toString,Ie=_e.call(Object);var et=Map.prototype.entries,tt=Set.prototype.values;var ie,rt=(ie=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:ie.get,le,nt=(le=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:le.get,oe,st=(oe=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:oe.get,ae,it=(ae=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:ae.get,lt=RegExp.prototype.test;function E(e){var n;if(e==null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);if(r===null||r===Object.prototype)return!0;let t=Object.getOwnPropertyDescriptor(r,"constructor");return!t||!("value"in t)||typeof t.value!="function"?!1:((n=Object.getOwnPropertyDescriptor(t.value,"prototype"))==null?void 0:n.value)===r&&_e.call(t.value)===Ie}function O(e){return typeof e=="string"}function K(e){return Number.isFinite(e)}function W(e){return Number.isSafeInteger(e)&&e>=0}var ot=Date.prototype.getTime;function ue(e,r){if(!e||!r)return e;let t=!0;for(let a=r.length;a--;)if(r.charCodeAt(a)>127){t=!1;break}if(t){let a=0,i=e.length;if(r.length===1){let _=r.charCodeAt(0);for(;a<i&&e.charCodeAt(a)===_;)a++;for(;i>a&&e.charCodeAt(i-1)===_;)i--}else{for(;a<i&&r.includes(e[a]);)a++;for(;i>a&&r.includes(e[i-1]);)i--}return a===0&&i===e.length?e:e.slice(a,i)}let n=Array.from(e),o=new Set(r),s=0,l=n.length;for(;s<l&&o.has(n[s]);)s++;for(;l>s&&o.has(n[l-1]);)l--;return s===0&&l===n.length?e:n.slice(s,l).join("")}function J(e=[],r=[]){if(!e||!Array.isArray(e)||!e.length)return[];if(!r||!Array.isArray(r)||!r.length)return e.slice();if(e.length*r.length<400)return e.filter(n=>!r.includes(n));let t=new Set(r);return e.filter(n=>!t.has(n))}function B(e){return e!=null}var fe={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Ve(e,r){let t,n=0;for(;n<e.length;){let o=n+1;for(;o<e.length&&e[n][0]===e[o][0]&&e[n][1]===e[o][1];)o+=1;if(o-n>1){t||(t=new Map(r.map((a,i)=>[a,i])));let s=t,l=e.slice(n,o).sort((a,i)=>s.get(a)-s.get(i));e.splice(n,l.length,...l)}n=o}return e}function j(e,r){var a;if(!Array.isArray(e)||!e.length)return e;let t=r===void 0?!0:E(r);if(r!==void 0&&t&&(r==null?void 0:r.strictlyTwoElementsInRangeArrays)===!0)for(let i=0;i<e.length;i+=1){let _=e[i];if(!Array.isArray(_)||_.length!==2)throw new TypeError("ranges-sort/rSort(): [THROW_ID_01] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, range at index ".concat(i," (").concat(h(_,4),") is ").concat(Array.isArray(_)?"an array with ".concat(_.length," elements"):"not an array","!"));if(!Number.isInteger(_[0])||_[0]<0||!Number.isInteger(_[1])||_[1]<0)throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, range at index ".concat(i," (").concat(h(_,4),") does not consist of only natural numbers!"))}else for(let i=0;i<e.length;i+=1){let _=e[i];if(!Array.isArray(_)||!Number.isInteger(_[0])||_[0]<0||!Number.isInteger(_[1])||_[1]<0)throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, range at index ".concat(i," (").concat(h(_,4),") does not consist of only natural numbers!"))}if(r!==void 0&&!t)throw new TypeError("ranges-sort/rSort(): [THROW_ID_03] The second argument must be a plain options object; received ".concat(h(r,4)," (type ").concat(typeof r,")!"));let n=fe.progressFn;if(r!==void 0){let i=r.strictlyTwoElementsInRangeArrays;if(i!==void 0&&typeof i!="boolean")throw new TypeError("ranges-sort/rSort(): [THROW_ID_04] opts.strictlyTwoElementsInRangeArrays must be a boolean; received ".concat(h(i,4)," (type ").concat(typeof i,")!"));if(n=(a=r.progressFn)!=null?a:fe.progressFn,n!==!1&&n!==null&&typeof n!="function")throw new TypeError("ranges-sort/rSort(): [THROW_ID_05] opts.progressFn must be a function, false, null, or undefined; received ".concat(h(n,4)," (type ").concat(typeof n,")!"))}let o,s;if(n){let i=e.length**2,_=0,p;s=c=>{c!==p&&(p=c,n(c))},o=Array.from(e).sort((c,d)=>(_+=1,s==null||s(Math.min(99,Math.floor(_*100/i))),c[0]===d[0]?c[1]<d[1]?-1:c[1]>d[1]?1:0:c[0]<d[0]?-1:1))}else o=Array.from(e).sort((i,_)=>i[0]===_[0]?i[1]<_[1]?-1:i[1]>_[1]?1:0:i[0]<_[0]?-1:1);let l=o.length>10?Ve(o,e):o;return s==null||s(100),l}var We={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function G(e,r){if(!Array.isArray(e)||!e.length)return null;if(r!==void 0&&!E(r))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(h(r,4)," (type ").concat(typeof r,")"));let t=R(R({},We),r);if(t.progressFn&&E(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_02] opts.progressFn must be a function! It was given of a type: "'.concat(typeof t.progressFn,'", equal to ').concat(h(t.progressFn,4)));if(t.mergeType!==1&&t.mergeType!==2&&t.mergeType!=="1"&&t.mergeType!=="2")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_03] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof t.mergeType,'", equal to ').concat(h(t.mergeType,4)));if(typeof t.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof t.joinRangesThatTouchEdges,'", equal to ').concat(h(t.joinRangesThatTouchEdges,4)));let n=t.progressFn,o=t.joinRangesThatTouchEdges,s=[];for(let b of e)Array.isArray(b)&&(b[2]!==void 0||b[0]!==b[1])&&s.push([...b]);let l,a,i;n?l=j(s,{progressFn:b=>{i=Math.floor(b/5),i!==a&&(a=i,n(i))}}):l=j(s);let _=l.length-1,p=t.mergeType===2||t.mergeType==="2",c=l.length;for(let b=_;b>=0;b--){let u=l[b];for(n&&b<_&&(i=Math.floor((1-(b+1)/_)*78)+21,i!==a&&i>a&&(a=i,n(i)));c<l.length;){let y=l[c],$=y[0]===u[0];if(!$&&(o?y[0]>u[1]:y[0]>=u[1]))break;let f=y[1]>=u[1];f&&(u[1]=y[1]),y[2]===null?u[2]=null:y[2]!==void 0&&($||f)&&u[2]!==null&&(u[2]!=null?p&&$?u[2]=y[2]:u[2]+=y[2]:u[2]=y[2]),c+=1}c-=1,l[c]=u}let d=l.length-c;for(let b=0;b<d;b++)l[b]=l[c+b];return l.length=d,n&&a!==99&&n(99),l.length?l:null}function P(e){if(typeof e=="number")return Number.isInteger(e)&&e>=0;if(typeof e!="string"||!e.trim())return!1;let r=Number(e);return Number.isInteger(r)&&r>=0}function ce(e,r,t){let n=0,o=0;if(e===void 0&&r===void 0&&t===void 0)throw new Error("ranges-apply/rApply(): [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError("ranges-apply/rApply(): [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(typeof e,", equal to: ").concat(h(e,4)));if(r!=null&&!Array.isArray(r))throw new TypeError("ranges-apply/rApply(): [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof r,", equal to: ").concat(h(r,4)));if(t!=null&&t!==!1&&t!==0&&t!==""&&typeof t!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function, false, null, undefined, 0, or an empty string! Currently it's: ".concat(typeof t,", equal to: ").concat(h(t,4)));if(r==null||!r.length||r.every(p=>p==null))return t&&t(100),e;let s;Array.isArray(r)&&!Array.isArray(r[0])&&P(r[0])&&P(r[1])?s=[Array.from(r)]:s=Array.from(r);let l=s.length,a=0;s.forEach((p,c)=>{if(p){if(t&&(n=Math.floor(a/l*10),n!==o&&(o=n,t(n))),!Array.isArray(p))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(c,"th element not an array: ").concat(h(p,4),", which is ").concat(typeof p));if(!P(p[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(c,"th element, array ").concat(h(p),". Its first element is not a non-negative integer or string index, but ").concat(typeof p[0],", equal to: ").concat(h(p[0],4),"."));if(typeof p[0]=="string"&&(s[c]=[...p],s[c][0]=Number(p[0])),!P(p[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(c,"th element, array ").concat(h(p),". Its second element is not a non-negative integer or string index, but ").concat(typeof p[1],", equal to: ").concat(h(p[1],4),"."));if(typeof p[1]=="string"&&(s[c]===p&&(s[c]=[...p]),s[c][1]=Number(p[1])),s[c][0]>s[c][1])throw new RangeError("ranges-apply/rApply(): [THROW_ID_08] ranges array, second input arg. has ".concat(c,"th element, array ").concat(h(p),". Its first index (").concat(s[c][0],") must not be greater than its second index (").concat(s[c][1],")."));a+=1}});let i=t?G(s,{progressFn:p=>{n=10+Math.floor(p/10),n!==o&&(o=n,t(n))}}):G(s),_=(i==null?void 0:i.length)||0;if(i&&_>0){let p=e.slice(i[_-1][1]);e=i.reduce((c,d,b,u)=>{var f;t&&(n=20+Math.floor(b/_*80),n!==o&&(o=n,t(n)));let y=b===0?0:u[b-1][1],$=u[b][0];return"".concat(c).concat(e.slice(y,$)).concat((f=u[b][2])!=null?f:"")},""),e+=p}return t&&o!==100&&t(100),e}function H(e,r=1){let t="\xA0";function n(s){return s.length<2?s:Array.from(s).reverse().join("")}function o(s,l,a){let i=a?"\n":"\r",_=a?"\r":"\n";if(!s)return s;let p=0,c="";for(let d=0,b=s.length;d<b;d++)(s[d]===i||s[d]===_&&s[d-1]!==i)&&p++,"\r\n".includes(s[d])||s[d]===t?s[d]===t?c+=s[d]:s[d]===i?p<=l&&(c+=s[d],s[d+1]===_&&(c+=s[d+1],d++)):s[d]===_&&(s==null?void 0:s[d-1])!==i&&p<=l&&(c+=s[d]):!s[d+1]&&!p&&(c+=" ");return c}if(typeof e=="string"&&e.length){let s=e.trim();if(s.length===e.length)return e;let l=1;typeof r=="number"&&Number.isInteger(r)&&r>=0&&(l=r);let a="",i="";if(!s)a=e;else if(!e[0].trim()){for(let p=0,c=e.length;p<c;p++)if(e[p].trim()){a=e.slice(0,p);break}}let _=e[e.length-1];if(s&&(_.trim()===""||_===t)){for(let p=e.length;p--;)if(e[p].trim()){i=e.slice(p+1);break}}return"".concat(o(a,l,!1)).concat(s).concat(n(o(n(i),l,!0)))}return e}var Q={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function pe(e,r,t){return r===void 0||e===null?e:r===null?null:e===void 0||t?r:e+r}function Ne(e,r){var u,y,$;function t(f){return!!f&&typeof f=="object"&&!Array.isArray(f)}if(!Array.isArray(e)||!e.length)return null;if(r&&!t(r))throw new TypeError("ranges-push/rMerge(): [THROW_ID_07] the second input argument must be a plain object. It was given as:\n".concat(h(r,4)," (type ").concat(typeof r,")"));let n=(u=r==null?void 0:r.progressFn)!=null?u:Q.progressFn,o=(y=r==null?void 0:r.mergeType)!=null?y:Q.mergeType,s=($=r==null?void 0:r.joinRangesThatTouchEdges)!=null?$:Q.joinRangesThatTouchEdges;if(n&&t(n)&&!Object.keys(n).length)n=null;else if(n&&typeof n!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_08] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof n,'", equal to ').concat(h(n,4)));if(o!==1&&o!==2&&o!=="1"&&o!=="2")throw new TypeError('ranges-push/rMerge(): [THROW_ID_09] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof o,'", equal to ').concat(h(o,4)));if(typeof s!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_10] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof s,'", equal to ').concat(h(s,4)));let l=[];for(let f of e)Array.isArray(f)&&(f[2]!==void 0||f[0]!==f[1])&&l.push([...f]);let a,i,_;n?a=j(l,{progressFn:f=>{_=Math.floor(f/5),_!==i&&(i=_,n==null||n(_))}}):a=j(l);let p=a.length-1,c=+o==2,d=a.length;for(let f=p;f>=0;f--){let g=a[f];for(n&&f<p&&(_=Math.floor((1-(f+1)/p)*78)+21,_!==i&&_>i&&(i=_,n(_)));d<a.length;){let m=a[d],v=m[0]===g[0];if(!v&&(s?m[0]>g[1]:m[0]>=g[1]))break;let w=m[1]>=g[1];w&&(g[1]=m[1]),m[2]===null?g[2]=null:m[2]!==void 0&&(v||w)&&(g[2]=pe(g[2],m[2],c&&v)),d+=1}d-=1,a[d]=g}let b=a.length-d;for(let f=0;f<b;f++)a[f]=a[d+f];return a.length=b,a.length?a:null}var L=Object.freeze({limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1});function D(e){if(W(e))return e;if(typeof e=="string"&&/^\d+$/.test(e)){let r=Number(e);return W(r)?r:null}return null}function he(e){if(!Array.isArray(e))return"a ranges batch must contain only range arrays; received ".concat(h(e,4));if(e.length>3)return"a range must contain at most three values; received ".concat(h(e,4));let[r,t,n]=e;if(r==null&&t==null)return;if(r!=null&&t==null)return"the first index is set (".concat(h(r),") but the second index is not (").concat(h(t),")");if(r==null&&t!=null)return"the second index is set (".concat(h(t),") but the first index is not (").concat(h(r),")");let o=D(r),s=D(t);if(o===null)return"the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(h(r,4)," (type ").concat(typeof r,")");if(s===null)return"the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(h(t,4)," (type ").concat(typeof t,")");if(B(n)&&!O(n)&&!K(n))return"the third value must be a string, number, null, or undefined; received ".concat(h(n,4)," (type ").concat(typeof n,")");if(o>s)return"the first index (".concat(o,") must not be greater than the second index (").concat(s,")")}function Fe(e){if(e.length>3)return{error:"expected at most three arguments but received ".concat(e.length),ranges:[]};if(e.length<=1&&Array.isArray(e[0])){let t=e[0];if(!t.length)return{ranges:[]};e=Array.isArray(t[0])?t:[t]}else e=[e];let r=[];for(let t of e){let n=he(t);if(n)return{error:n,ranges:[]};let[o,s,l]=t;if(o==null&&s==null)continue;let a=D(o),i=D(s);r.push(l!==void 0&&!(O(l)&&!l.length)?[a,i,l]:[a,i])}return{ranges:r}}function Me(e){return e[2]===void 0&&e[0]===e[1]}function Be(e){let r=-1;for(let t=0,n=e.length;t<n;t++){let o=e[t];if(Array.isArray(o)){if(o[0]<r)return!1;r=o[0]}}return!0}var ge=class{constructor(e){V(this,"ranges");V(this,"opts");V(this,"currentCache",null);if(e!=null&&!E(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(h(e,4)," (type ").concat(typeof e,")."));if(e===void 0){this.opts=L,this.ranges=[];return}let r=e,t=r.limitToBeAddedWhitespace===void 0?L.limitToBeAddedWhitespace:r.limitToBeAddedWhitespace,n=r.limitLinebreaksCount===void 0?L.limitLinebreaksCount:r.limitLinebreaksCount,o=r.mergeType===void 0?L.mergeType:r.mergeType,s=o==="1"?1:o==="2"?2:o,l;if(typeof t!="boolean"?l="opts.limitToBeAddedWhitespace must be a boolean; received ".concat(h(t,4)," (type ").concat(typeof t,")"):W(n)?s!==1&&s!==2&&(l='opts.mergeType must be 1, 2, "1", or "2"; received '.concat(h(o,4)," (type ").concat(typeof o,")")):l="opts.limitLinebreaksCount must be a natural number or zero; received ".concat(h(n,4)," (type ").concat(typeof n,")"),l)throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_02] ".concat(l,"."));let a=Object.freeze({limitToBeAddedWhitespace:t,limitLinebreaksCount:n,mergeType:s});this.opts=a,this.ranges=[]}rangeListsMatch(e,r){if(!Array.isArray(e))return r===null;if(!Array.isArray(r)||e.length!==r[0])return!1;let t=1;for(let n=0,o=e.length;n<o;n++){let s=e[n];if(!Array.isArray(s)){if(r[t++]!==-1||s!==r[t++])return!1;continue}if(s.length!==r[t++])return!1;for(let l=0;l<s.length;l++)if(s[l]!==r[t++])return!1}return t===r.length}snapshotRanges(e){if(!Array.isArray(e))return null;let r=new Array(1+e.length*4);r[0]=e.length;let t=1;for(let n=0,o=e.length;n<o;n++){let s=e[n];if(Array.isArray(s)){r[t++]=s.length;for(let l=0;l<s.length;l++)r[t++]=s[l]}else r[t++]=-1,r[t++]=s}return r.length=t,r}currentStateMatchesSnapshot(){let e=this.currentCache;return e!==null&&this.rangeListsMatch(this.ranges,e.rangesSnapshot)&&this.rangeListsMatch(e.result,e.resultSnapshot)}recordCurrentSnapshot(e){let r=this.snapshotRanges(this.ranges);this.currentCache={rangesSnapshot:r,result:e,resultSnapshot:e===this.ranges?r:this.snapshotRanges(e)}}invalidateCurrentCache(){this.currentCache=null}addValidated(e,r,t){this.invalidateCurrentCache();let n=this.last();if(B(this.ranges)&&Array.isArray(n)&&e===n[1]){if(n[1]=r,t!==void 0&&!(O(t)&&!t.length)){let s=pe(n[2],t,this.opts.mergeType===2&&n[0]===e);this.opts.limitToBeAddedWhitespace&&typeof s=="string"&&(s=H(s,this.opts.limitLinebreaksCount)),O(s)&&!s.length||(n[2]=s)}return}this.ranges||(this.ranges=[]);let o=t!==void 0?[e,r,typeof t=="string"&&this.opts.limitToBeAddedWhitespace?H(t,this.opts.limitLinebreaksCount):t]:[e,r];this.ranges.push(o)}add(e,r,t){let n=arguments.length,o;if(n>3)o="expected at most three arguments but received ".concat(n);else if(n===1&&Array.isArray(e)){let s=Array.isArray(e[0])?e:[e];for(let l=0,a=s.length;l<a&&(o=he(s[l]),!o);l++);if(!o)for(let l=0,a=s.length;l<a;l++){let[i,_,p]=s[l];i==null&&_==null||this.addValidated(D(i),D(_),O(p)&&!p.length?void 0:p)}}else{if(e==null&&r==null)return;if(e!=null&&r==null)o="the first index is set (".concat(h(e),") but the second index is not (").concat(h(r),")");else if(e==null&&r!=null)o="the second index is set (".concat(h(r),") but the first index is not (").concat(h(e),")");else{let s=D(e),l=D(r);s===null?o="the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(h(e,4)," (type ").concat(typeof e,")"):l===null?o="the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(h(r,4)," (type ").concat(typeof r,")"):B(t)&&!O(t)&&!K(t)?o="the third value must be a string, number, null, or undefined; received ".concat(h(t,4)," (type ").concat(typeof t,")"):s>l?o="the first index (".concat(s,") must not be greater than the second index (").concat(l,")"):this.addValidated(s,l,O(t)&&!t.length?void 0:t)}}if(o)throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_03] ".concat(o,"."))}push(e,r,t){this.add.apply(this,arguments)}current(){var e,r;if(this.currentStateMatchesSnapshot())return(r=(e=this.currentCache)==null?void 0:e.result)!=null?r:null;if(Array.isArray(this.ranges)&&this.ranges.length){this.ranges=Ne(this.ranges,this.opts.mergeType===1?void 0:{mergeType:2});let t=this.ranges;return t&&this.opts.limitToBeAddedWhitespace&&(t=t.map(n=>typeof n[2]=="string"?[n[0],n[1],H(n[2],this.opts.limitLinebreaksCount)]:n)),this.recordCurrentSnapshot(t),t}return this.recordCurrentSnapshot(null),null}firstCovers(e){if(!W(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_04] the input argument must be a natural number or zero! It was given as ".concat(h(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let r=Be(this.ranges)?this.ranges:this.ranges.filter(n=>Array.isArray(n)).slice().sort((n,o)=>n[0]-o[0]||n[1]-o[1]),t=null;for(let n=0,o=r.length;n<o;n++){let s=r[n];if(!(!Array.isArray(s)||Me(s))){if(t===null){if(s[0]!==0)return!1;t=s[1]}else{if(s[0]>t)break;s[1]>t&&(t=s[1])}if(t>=e)return!0}}return t!==null&&t>=e}wipe(){this.ranges=[],this.invalidateCurrentCache()}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])){let r=Fe([e]);if(r.error)throw new TypeError("ranges-push/Ranges/replace(): [THROW_ID_06] ".concat(r.error,"."));this.ranges=r.ranges,this.invalidateCurrentCache()}else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_05] Single range was given but we expected array of arrays! The first element, ".concat(h(e[0],4)," should be an array."));else this.ranges=[],this.invalidateCurrentCache()}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var Pe={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function N(e,r){let t=!0,n=[".",",","'"," "],o;if(typeof e!="string")throw new TypeError("string-remove-thousand-separators/remSep(): [THROW_ID_01] Input must be string! Currently it's: ".concat(typeof e,", equal to:\n").concat(h(e,4)));if(r&&typeof r!="object")throw new TypeError("string-remove-thousand-separators/remSep(): [THROW_ID_02] Options object must be a plain object! Currently it's: ".concat(typeof r,", equal to:\n").concat(h(r,4)));let s=R(R({},Pe),r),l=ue(e.trim(),'"');if(l==="")return l;if(+e>0&&+e<1)return e;let a=new ge;for(let i=0,_=l.length;i<_;i++){if(s.removeThousandSeparatorsFromNumbers&&l[i].trim()===""&&a.add(i,i+1),s.removeThousandSeparatorsFromNumbers&&l[i]==="'"&&(a.add(i,i+1),l[i+1]==="'")){t=!1;break}if(n.includes(l[i])){if(l[i+1]!==void 0&&/^\d$/.test(l[i+1]))if(l[i+2]!==void 0)if(/^\d$/.test(l[i+2]))if(l[i+3]!==void 0)if(/^\d$/.test(l[i+3])){if(l[i+4]!==void 0&&/^\d$/.test(l[i+4])){t=!1;break}else if(s.removeThousandSeparatorsFromNumbers&&a.add(i,i+1),!o)o=l[i];else if(l[i]!==o){t=!1;break}}else{t=!1;break}else s.removeThousandSeparatorsFromNumbers&&s.forceUKStyle&&l[i]===","&&a.add(i,i+1,".");else{t=!1;break}else s.forceUKStyle&&l[i]===","&&a.add(i,i+1,"."),s.padSingleDecimalPlaceNumbers&&a.add(i+2,i+2,"0")}else if(!/^\d$/.test(l[i])){t=!1;break}}return t&&a.current()?ce(l,a.current()):l}var He={delimiter:",",removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function Le(e){if(e===null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function Ue(e,r){let t=0,n=e.length;for(;t<n&&e[t]!==r&&e[t].trim()==="";)t+=1;for(;n>t&&e[n-1]!==r&&e[n-1].trim()==="";)n-=1;return e.slice(t,n)}function de(e,r){let t=0,n=0,o=[],s=[],l=!1,a=!0;if(r&&!Le(r))throw new Error("csv-split-easy/splitEasy(): [THROW_ID_01] Options object must be a plain object! Currently it's of a type ".concat(typeof r," equal to:\n").concat(h(r,4)));let i=R(R({},He),r);if(typeof e!="string")throw new TypeError("csv-split-easy/splitEasy(): [THROW_ID_02] input must be string! Currently it's: ".concat(typeof e,", equal to: ").concat(h(e,4)));if(typeof i.delimiter!="string"||i.delimiter.length!==1||i.delimiter==='"'||i.delimiter==="\n"||i.delimiter==="\r")throw new TypeError('csv-split-easy/splitEasy(): [THROW_ID_03] The "delimiter" option must be a single character other than a double quote or a line break! Currently it\'s: '.concat(typeof i.delimiter,", equal to: ").concat(h(i.delimiter)));if(e==="")return[[""]];e=Ue(e,i.delimiter);for(let _=0,p=e.length;_<p;_++){if(a&&e[_]!=='"'&&e[_]!==i.delimiter&&e[_].trim()!==""&&(a=!1),e[_]==='"')if(l&&e[_+1]==='"')_+=1;else if(l){l=!1;let c=e.slice(t,_);c.trim()!==""&&(a=!1);let d=/""/.test(c)?c.replace(/""/g,'"'):N(c,{removeThousandSeparatorsFromNumbers:i.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:i.padSingleDecimalPlaceNumbers,forceUKStyle:i.forceUKStyle});o.push(d)}else l=!0,t=_+1;else if(!l&&e[_]===i.delimiter){if(e[_-1]!=='"'&&!l){let c=e.slice(t,_);c.trim()!==""&&(a=!1),o.push(N(c,{removeThousandSeparatorsFromNumbers:i.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:i.padSingleDecimalPlaceNumbers,forceUKStyle:i.forceUKStyle}))}t=_+1,n&&(n=0)}else if(e[_]==="\n"||e[_]==="\r"){if(!n){if(n=_,!l&&e[_-1]!=='"'){let c=e.slice(t,_);c.trim()!==""&&(a=!1),o.push(N(c,{removeThousandSeparatorsFromNumbers:i.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:i.padSingleDecimalPlaceNumbers,forceUKStyle:i.forceUKStyle}))}a?o.length=0:s.push(o),a=!0,o=[]}t=_+1}else n&&(n=0,t=_);if(_+1===p){if(e[_]!=='"'){let c=e.slice(t,_+1);c.trim()&&(a=!1),o.push(N(c,{removeThousandSeparatorsFromNumbers:i.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:i.padSingleDecimalPlaceNumbers,forceUKStyle:i.forceUKStyle}))}a?o=[]:s.push(o),a=!0}}return s.length===0?[[""]]:s}var k=Re(me(),1);var ye="7.2.4";function U(e){return typeof e=="number"&&!Number.isNaN(e)?!0:(e=(e||"").toString().trim(),e?!Number.isNaN(+e):!1)}var ze=["\u062F.\u0625","\u060B","L","\u058F","\u0192","Kz","$","\u0192","\u20BC","KM","\u09F3","\u043B\u0432",".\u062F.\u0628","FBu","$b","R$","\u0E3F","Nu.","P","p.","BZ$","FC","CHF","\xA5","\u20A1","\u20B1","K\u010D","Fdj","kr","RD$","\u062F\u062C","kr","Nfk","Br","\u039E","\u20AC","\u20BE","\u20B5","GH\u20B5","D","FG","Q","L","kn","G","Ft","Rp","\u20AA","\u20B9","\u0639.\u062F","\uFDFC","kr","J$","JD","\xA5","KSh","\u043B\u0432","\u17DB","CF","\u20A9","\u20A9","KD","\u043B\u0432","\u20AD","\u20A8","M","\u0141","Lt","Ls","LD","MAD","lei","Ar","\u0434\u0435\u043D","K","\u20AE","MOP$","UM","\u20A8","Rf","MK","RM","MT","\u20A6","C$","kr","\u20A8","\uFDFC","B/.","S/.","K","\u20B1","\u20A8","z\u0142","Gs","\uFDFC","\uFFE5","lei","\u0414\u0438\u043D.","\u20BD","R\u20A3","\uFDFC","\u20A8","\u062C.\u0633.","kr","\xA3","Le","S","Db","E","\u0E3F","SM","T","\u062F.\u062A","T$","\u20A4","\u20BA","TT$","NT$","TSh","\u20B4","USh","$U","\u043B\u0432","Bs","\u20AB","VT","WS$","FCFA","\u0243","CFA","\u20A3","\uFDFC","R","Z$"];function F(e){return U(e)||ze.some(r=>U(e.replace(r,"").replace(/[,.]/g,"")))?"numeric":e.trim()?"text":"empty"}var Ke=ye;function Je(e){let r=null,t=null;if(typeof e!="string")throw new TypeError("csv-sort/sort(): [THROW_ID_01] The input is of a wrong type! We accept either string of array of arrays. We got instead: ".concat(typeof e,", equal to:\n").concat(h(e,4)));if(!e.trim())return{res:[[""]],msgContent:r,msgType:t};let n=de(e),o=[],s=!1,l=!0,a=[],i=null;for(let f=n.length-1;f>=0;f--)if(o.length){f===0&&(s=n[f].every(m=>{let v=F(m);return v==="text"||v==="empty"})),!s&&o.length!==n[f].length&&(l=!1);let g=null;for(let m=0,v=n[f].length;m<v;m++){let w=F(n[f][m].trim());if(g===null&&w==="empty"&&(g=m),g!==null&&w!=="empty"&&(g=null),w!==o[m]&&!s){let A=w;if(Array.isArray(o[m]))o[m].includes(A)||o[m].push(A);else if(o[m]!==A){let T=o[m];o[m]=[],o[m].push(T),o[m].push(A)}}}i!==null&&g!==null&&g>i&&(!s||s&&f!==0)&&(i=g)}else if(n[f].length!==1||n[f][0]!=="")for(let g=0,m=n[f].length;g<m;g++){let v=F(n[f][g].trim());o.push(v),i===null&&v==="empty"&&(i=g),i!==null&&v!=="empty"&&(i=null)}i||(i=o.length);let _=0;for(let f=0,g=o.length;f<g&&o[f]==="empty";f++)_=f;_!==0&&(n=n.map(f=>f.slice(_+1,i)),o=o.slice(_+1,i));let p=[],c;o.forEach((f,g)=>{f==="numeric"&&p.push(g)});let d=s?1:0;if(p.length===1)c=p[0];else{if(p.length===0)throw new Error('csv-sort/sort(): [THROW_ID_02] Your CSV file does not contain numeric-only columns and computer was not able to detect the "Balance" column!');{let f=Array.from(p),g=[];for(let m=0,v=f.length;m<v;m++){let w=f[m],A,T=!0,x,S=!0;for(let C=d,be=n.length;C<be&&(T&&(A==null?A=n[C][w]:A===n[C][w]?(g.push(w),T=!1):A=n[C][w]),S&&(x==null?x=n[C][w]:n[C][w]!==x&&(S=!1)),!!T);C++);S&&a.push(w)}if(f=J(f,g),f.length===1)c=f[0];else if(f.length===0)throw new Error('csv-sort/sort(): [THROW_ID_03] The computer can\'t find the "Balance" column! It saw some numeric-only columns, but they all seem to have certain rows with the same values as rows right below/above them!')}}if(!c)throw new Error("csv-sort/sort(): [THROW_ID_04] Sadly computer couldn't find its way in this CSV and had to stop working on it.");let b=J(Array.from(o.reduce((f,g,m)=>((typeof g=="string"&&g==="numeric"||Array.isArray(g)&&g.includes("numeric"))&&f.push(m),f),[])),[c,...a]),u=[];u.push(n[n.length-1].slice(0,i));let y=[],$=s?1:0;for(let f=n.length-2;f>=$;f--)for(let g=n.length-2;g>=$;g--)if(!y.includes(g)){let m=!1;for(let v=0,w=b.length;v<w;v++){let A=null;n[g][b[v]]!==""&&(A=(0,k.default)(n[g][b[v]]));let T=null;n[g][c]!==""&&(T=(0,k.default)(n[g][c]));let x=null;u[0][c]!==""&&(x=(0,k.default)(u[0][c]).format());let S=null;u[u.length-1][b[v]]!==""&&(S=(0,k.default)(u[u.length-1][b[v]]).format());let C=null;if(u[u.length-1][c]!==""&&(C=(0,k.default)(u[u.length-1][c])),A&&T.add(A).format()===x){u.unshift(n[g].slice(0,i)),y.push(g),m=!0;break}else if(A&&T.subtract(A).format()===x){u.unshift(n[g].slice(0,i)),y.push(g),m=!0;break}else if(S&&C.add(S).format()===T.format()){u.push(n[g].slice(0,i)),y.push(g),m=!0;break}else if(S&&C.subtract(S).format()===T.format()){u.push(n[g].slice(0,i)),y.push(g),m=!0;break}}if(m){m=!1;break}}return s&&(l&&n[0].length>o.length&&(n[0].length=o.length),u.unshift(n[0].slice(0,i))),n.length-(s?2:1)!==y.length&&(r="Not all rows were recognised!",t="alert"),{res:u,msgContent:r,msgType:t}}return Oe(Ge);})();
11
+ /**
12
+ * @name codsen-format-diagnostic-value
13
+ * @fileoverview Safely format untrusted JavaScript values for diagnostics
14
+ * @version 1.1.1
15
+ * @author Roy Revelt
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-format-diagnostic-value/}
18
+ */
11
19
  /**
12
20
  * @name codsen-utils
13
21
  * @fileoverview Various utility functions
14
- * @version 1.9.0
22
+ * @version 1.10.1
15
23
  * @author Roy Revelt
16
24
  * @license MIT
17
25
  * {@link https://codsen.com/os/codsen-utils/}
@@ -19,7 +27,7 @@
19
27
  /**
20
28
  * @name ranges-sort
21
29
  * @fileoverview Sort string index ranges
22
- * @version 6.2.1
30
+ * @version 6.2.3
23
31
  * @author Roy Revelt
24
32
  * @license MIT
25
33
  * {@link https://codsen.com/os/ranges-sort/}
@@ -27,7 +35,7 @@
27
35
  /**
28
36
  * @name ranges-merge
29
37
  * @fileoverview Merge and sort string index ranges
30
- * @version 9.2.2
38
+ * @version 9.2.4
31
39
  * @author Roy Revelt
32
40
  * @license MIT
33
41
  * {@link https://codsen.com/os/ranges-merge/}
@@ -35,7 +43,7 @@
35
43
  /**
36
44
  * @name ranges-apply
37
45
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
38
- * @version 7.2.2
46
+ * @version 7.2.4
39
47
  * @author Roy Revelt
40
48
  * @license MIT
41
49
  * {@link https://codsen.com/os/ranges-apply/}
@@ -43,7 +51,7 @@
43
51
  /**
44
52
  * @name string-collapse-leading-whitespace
45
53
  * @fileoverview Collapse the leading and trailing whitespace of a string
46
- * @version 7.2.0
54
+ * @version 7.3.1
47
55
  * @author Roy Revelt
48
56
  * @license MIT
49
57
  * {@link https://codsen.com/os/string-collapse-leading-whitespace/}
@@ -51,7 +59,7 @@
51
59
  /**
52
60
  * @name ranges-push
53
61
  * @fileoverview Gather string index ranges
54
- * @version 7.2.1
62
+ * @version 7.3.1
55
63
  * @author Roy Revelt
56
64
  * @license MIT
57
65
  * {@link https://codsen.com/os/ranges-push/}
@@ -59,7 +67,7 @@
59
67
  /**
60
68
  * @name string-remove-thousand-separators
61
69
  * @fileoverview Detects and removes thousand separators (dot/comma/quote/space) from string-type digits
62
- * @version 7.2.2
70
+ * @version 7.2.4
63
71
  * @author Roy Revelt
64
72
  * @license MIT
65
73
  * {@link https://codsen.com/os/string-remove-thousand-separators/}
@@ -67,7 +75,7 @@
67
75
  /**
68
76
  * @name csv-split-easy
69
77
  * @fileoverview Splits the CSV string into array of arrays, each representing a row of columns
70
- * @version 7.2.2
78
+ * @version 7.2.4
71
79
  * @author Roy Revelt
72
80
  * @license MIT
73
81
  * {@link https://codsen.com/os/csv-split-easy/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "csv-sort",
3
- "version": "7.2.2",
3
+ "version": "7.2.4",
4
4
  "description": "Sort double-entry bookkeeping CSV from internet banking",
5
5
  "keywords": [
6
6
  "accountancy",
@@ -68,14 +68,13 @@
68
68
  "lect": {
69
69
  "licence": {
70
70
  "extras": [
71
- "",
72
71
  "List of [currency signs](https://github.com/bengourley/currency-symbol-map) - Copyright © 2017 Ben Gourley - see its [BSD-2-Clause disclaimer](https://opensource.org/licenses/BSD-2-Clause)"
73
72
  ]
74
73
  }
75
74
  },
76
75
  "dependencies": {
77
- "codsen-utils": "^1.9.0",
78
- "csv-split-easy": "^7.2.2",
76
+ "codsen-utils": "^1.10.1",
77
+ "csv-split-easy": "^7.2.4",
79
78
  "currency.js": "^2.0.4"
80
79
  },
81
80
  "engines": {