csv-sort 7.2.0 → 7.2.1
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/dist/csv-sort.esm.js +2 -2
- package/dist/csv-sort.umd.js +6 -6
- package/package.json +2 -2
package/dist/csv-sort.esm.js
CHANGED
|
@@ -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.
|
|
4
|
+
* @version 7.2.1
|
|
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}from"codsen-utils";import{splitEasy as j}from"csv-split-easy";import w from"currency.js";import{pull as x}from"lodash-es";var k="7.2.
|
|
10
|
+
import{formatDiagnosticValue as O}from"codsen-utils";import{splitEasy as j}from"csv-split-easy";import w from"currency.js";import{pull as x}from"lodash-es";var k="7.2.1";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($=>E(a.replace($,"").replace(/[,.]/g,"")))?"numeric":a.trim()?"text":"empty"}var G=k;function U(a){let $=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:$,msgType:C};let n=j(a),l=[],g=!1,S=!0,v=[],o=null;for(let t=n.length-1;t>=0;t--)if(l.length){t===0&&(g=n[t].every(s=>{let i=R(s);return i==="text"||i==="empty"})),!g&&l.length!==n[t].length&&(S=!1);let e=null;for(let s=0,i=n[t].length;s<i;s++){let u=R(n[t][s].trim());if(e===null&&u==="empty"&&(e=s),e!==null&&u!=="empty"&&(e=null),u!==l[s]&&!g){let c=u;if(Array.isArray(l[s]))l[s].includes(c)||l[s].push(c);else if(l[s]!==c){let f=l[s];l[s]=[],l[s].push(f),l[s].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,s=n[t].length;e<s;e++){let i=R(n[t][e].trim());l.push(i),o===null&&i==="empty"&&(o=e),o!==null&&i!=="empty"&&(o=null)}o||(o=l.length);let D=0;for(let t=0,e=l.length;t<e&&l[t]==="empty";t++)D=t;D!==0&&(n=n.map(t=>t.slice(D+1,o)),l=l.slice(D+1,o));let b=[],p;l.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 s=0,i=t.length;s<i;s++){let u=t[s],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&&v.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(l.reduce((t,e,s)=>((typeof e=="string"&&e==="numeric"||Array.isArray(e)&&e.includes("numeric"))&&t.push(s),t),[])),p,...v),r=[];r.push(n[n.length-1].slice(0,o));let y=[],T=g?1:0;for(let t=n.length-2;t>=T;t--)for(let e=n.length-2;e>=T;e--)if(!y.includes(e)){let s=!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)),y.push(e),s=!0;break}else if(c&&f.subtract(c).format()===h){r.unshift(n[e].slice(0,o)),y.push(e),s=!0;break}else if(d&&m.add(d).format()===f.format()){r.push(n[e].slice(0,o)),y.push(e),s=!0;break}else if(d&&m.subtract(d).format()===f.format()){r.push(n[e].slice(0,o)),y.push(e),s=!0;break}}if(s){s=!1;break}}return g&&(S&&n[0].length>l.length&&(n[0].length=l.length),r.unshift(n[0].slice(0,o))),n.length-(g?2:1)!==y.length&&($="Not all rows were recognised!",C="alert"),{res:r,msgContent:$,msgType:C}}export{R as findType,E as isNumeric,U as sort,G as version};
|
package/dist/csv-sort.umd.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name csv-sort
|
|
3
3
|
* @fileoverview Sort double-entry bookkeeping CSV from internet banking
|
|
4
|
-
* @version 7.2.
|
|
4
|
+
* @version 7.2.1
|
|
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 bt=Object.create;var F=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames,ie=Object.getOwnPropertySymbols,Tt=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var X=(e,t,r)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))fe.call(t,r)&&X(e,r,t[r]);if(ie)for(var r of ie(t))$t.call(t,r)&&X(e,r,t[r]);return e};var At=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},St=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},ue=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wt(t))!fe.call(e,i)&&i!==r&&F(e,i,{get:()=>t[i],enumerable:!(a=vt(t,i))||a.enumerable});return e};var Rt=(e,t,r)=>(r=e!=null?bt(Tt(e)):{},ue(t||!e||!e.__esModule?F(r,"default",{value:e,enumerable:!0}):r,e)),Ot=e=>ue(F({},"__esModule",{value:!0}),e);var V=(e,t,r)=>X(e,typeof t!="symbol"?t+"":t,r);var ht=At((se,le)=>{(function(e,t){typeof se=="object"&&typeof le<"u"?le.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self,e.currency=t())})(se,function(){function e(o,l){if(!(this instanceof e))return new e(o,l);l=Object.assign({},r,l);var f=Math.pow(10,l.precision);this.intValue=o=t(o,l),this.value=o/f,l.increment=l.increment||1/f,l.groups=l.useVedic?i:a,this.s=l,this.p=f}function t(o,l){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,s=l.decimal,n=l.errorOnInvalid,c=l.fromCents,m=Math.pow(10,l.precision),b=o instanceof e;if(b&&c)return o.intValue;if(typeof o=="number"||b)s=b?o.value:o;else if(typeof o=="string")n=new RegExp("[^-\\d"+s+"]","g"),s=new RegExp("\\"+s,"g"),s=(s=o.replace(/\((.*)\)/,"-$1").replace(n,"").replace(s,"."))||0;else{if(n)throw Error("Invalid Input");s=0}return c||(s=(s*m).toFixed(4)),f?Math.round(s):s}var r={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(o,l){var f=l.pattern,s=l.negativePattern,n=l.symbol,c=l.separator,m=l.decimal;l=l.groups;var b=(""+o).replace(/^-/,"").split("."),y=b[0];return b=b[1],(0<=o.value?f:s).replace("!",n).replace("#",y.replace(l,"$1"+c)+(b?m+b:""))},fromCents:!1},a=/(\d)(?=(\d{3})+\b)/g,i=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(o){var l=this.s,f=this.p;return e((this.intValue+t(o,l))/(l.fromCents?1:f),l)},subtract:function(o){var l=this.s,f=this.p;return e((this.intValue-t(o,l))/(l.fromCents?1:f),l)},multiply:function(o){var l=this.s;return e(this.intValue*o/(l.fromCents?1:Math.pow(10,l.precision)),l)},divide:function(o){var l=this.s;return e(this.intValue/t(o,l,!1),l)},distribute:function(o){var l=this.intValue,f=this.p,s=this.s,n=[],c=Math[0<=l?"floor":"ceil"](l/o),m=Math.abs(l-c*o);for(f=s.fromCents?1:f;o!==0;o--){var b=e(c/f,s);0<m--&&(b=b[0<=l?"add":"subtract"](1/f)),n.push(b)}return n},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(o){var l=this.s;return typeof o=="function"?o(this,l):l.format(this,Object.assign({},l,o))},toString:function(){var o=this.s,l=o.increment;return(Math.round(this.intValue/this.p/l)*l).toFixed(o.precision)},toJSON:function(){return this.value}},e})});var No={};St(No,{findType:()=>B,isNumeric:()=>Y,sort:()=>Wo,version:()=>jo});function It(){let e=[],t=0,r=!1;return{append(a){return r?!1:t+a.length>1999?(e.push("\u2026"),t+=1,r=!0,!1):(e.push(a),t+=a.length,!0)},result(){return e.join("")},stopped(){return r}}}function Ct(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function P(e,t){if(e.append('"')){for(let r=0;r<t.length&&!e.stopped();r+=1){let a=t.charCodeAt(r);a===34?e.append('\\"'):a===92?e.append("\\\\"):a===8?e.append("\\b"):a===9?e.append("\\t"):a===10?e.append("\\n"):a===12?e.append("\\f"):a===13?e.append("\\r"):a<32||a===8232||a===8233||a>=55296&&a<=57343?e.append(Ct(a)):e.append(t[r])}e.append('"')}}function Dt(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function me(e,t){e.append("Symbol(");let r=String(t);r.length>8&&P(e,r.slice(7,-1)),e.append(")")}function pe(e,t){typeof t=="symbol"?me(e,t):P(e,String(t))}function g(e,t=0){let r=It(),a=t===4?4:0,i=new WeakSet,o=0;function l(u){a&&r.append(" ".repeat(u*a))}function f(u,x){u&&r.append(","),a&&(r.append("\n"),l(x+1))}function s(u,x,w){a&&x&&(r.append("\n"),l(w)),r.append(u)}function n(u,x){Object.prototype.hasOwnProperty.call(u,"value")?y(u.value,x):r.append(Dt(u))}function c(u,x){let w;try{w=Reflect.getOwnPropertyDescriptor(u,"length")}catch(h){r.append("[Uninspectable]");return}let d=w==null?void 0:w.value;if(!Number.isSafeInteger(d)||d<0){r.append("[Uninspectable]");return}r.append("[");let p=!1;for(let h=0;h<d&&!r.stopped();h+=1){if(f(p,x),p=!0,o>=50){r.append("[MaxEntries]");break}o+=1;let v;try{v=Reflect.getOwnPropertyDescriptor(u,String(h))}catch($){r.append("[Uninspectable]");continue}v!=null&&v.enumerable?n(v,x+1):r.append("[Empty]")}s("]",p,x)}function m(u,x){let w;try{w=Reflect.ownKeys(u)}catch(p){r.append("[Uninspectable]");return}r.append("{");let d=!1;for(let p of w){if(r.stopped())break;if(o>=50){f(d,x),d=!0,P(r,"\u2026"),r.append(a?": ":":"),r.append("[MaxEntries]");break}o+=1;let h;try{h=Reflect.getOwnPropertyDescriptor(u,p)}catch(v){f(d,x),d=!0,pe(r,p),r.append(a?": ":":"),r.append("[Uninspectable]");continue}h!=null&&h.enumerable&&(f(d,x),d=!0,pe(r,p),r.append(a?": ":":"),n(h,x+1))}s("}",d,x)}function b(u,x){if(i.has(u)){r.append("[Circular]");return}if(x>=5){r.append("[MaxDepth]");return}let w;try{w=Array.isArray(u)}catch(d){r.append("[Uninspectable]");return}i.add(u);try{w?c(u,x):m(u,x)}finally{i.delete(u)}}function y(u,x){u===null?r.append("null"):typeof u=="string"?P(r,u):typeof u=="number"?r.append(Object.is(u,-0)?"-0":String(u)):typeof u=="boolean"?r.append(u?"true":"false"):typeof u>"u"?r.append("undefined"):typeof u=="bigint"?r.append("".concat(u,"n")):typeof u=="symbol"?me(r,u):typeof u=="function"?r.append("[Function]"):b(u,x)}try{return y(e,0),r.result()}catch(u){return"[Uninspectable]"}}var Vo=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 de(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 k(e){return typeof e=="string"}function ce(e){return Number.isFinite(e)}function D(e){return Number.isSafeInteger(e)&&e>=0}function I(e){return e!=null}var Et=typeof global=="object"&&global&&global.Object===Object&&global,ge=Et;var kt=typeof self=="object"&&self&&self.Object===Object&&self,jt=ge||kt||Function("return this")(),H=jt;var Wt=H.Symbol,C=Wt;var he=Object.prototype,Nt=he.hasOwnProperty,Ft=he.toString,M=C?C.toStringTag:void 0;function Vt(e){var t=Nt.call(e,M),r=e[M];try{e[M]=void 0;var a=!0}catch(o){}var i=Ft.call(e);return a&&(t?e[M]=r:delete e[M]),i}var ye=Vt;var Mt=Object.prototype,_t=Mt.toString;function Bt(e){return _t.call(e)}var xe=Bt;var Pt="[object Null]",Ht="[object Undefined]",be=C?C.toStringTag:void 0;function Lt(e){return e==null?e===void 0?Ht:Pt:be&&be in Object(e)?ye(e):xe(e)}var L=Lt;function Ut(e){return e!=null&&typeof e=="object"}var ve=Ut;var qt="[object Symbol]";function Kt(e){return typeof e=="symbol"||ve(e)&&L(e)==qt}var we=Kt;function zt(e,t){for(var r=-1,a=e==null?0:e.length,i=Array(a);++r<a;)i[r]=t(e[r],r,e);return i}var U=zt;var Jt=Array.isArray,Te=Jt;var Gt=1/0,$e=C?C.prototype:void 0,Ae=$e?$e.toString:void 0;function Se(e){if(typeof e=="string")return e;if(Te(e))return U(e,Se)+"";if(we(e))return Ae?Ae.call(e):"";var t=e+"";return t=="0"&&1/e==-Gt?"-0":t}var q=Se;var Qt=/\s/;function Zt(e){for(var t=e.length;t--&&Qt.test(e.charAt(t)););return t}var Re=Zt;var Yt=/^\s+/;function Xt(e){return e&&e.slice(0,Re(e)+1).replace(Yt,"")}var Oe=Xt;function er(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var K=er;function tr(e){return e}var z=tr;var rr="[object AsyncFunction]",or="[object Function]",ar="[object GeneratorFunction]",nr="[object Proxy]";function sr(e){if(!K(e))return!1;var t=L(e);return t==or||t==ar||t==rr||t==nr}var Ie=sr;var lr=H["__core-js_shared__"],J=lr;var Ce=(function(){var e=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function ir(e){return!!Ce&&Ce in e}var De=ir;var fr=Function.prototype,ur=fr.toString;function pr(e){if(e!=null){try{return ur.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Ee=pr;var mr=/[\\^$.*+?()[\]{}|]/g,dr=/^\[object .+?Constructor\]$/,cr=Function.prototype,gr=Object.prototype,hr=cr.toString,yr=gr.hasOwnProperty,xr=RegExp("^"+hr.call(yr).replace(mr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function br(e){if(!K(e)||De(e))return!1;var t=Ie(e)?xr:dr;return t.test(Ee(e))}var ke=br;function vr(e,t){return e==null?void 0:e[t]}var je=vr;function wr(e,t){var r=je(e,t);return ke(r)?r:void 0}var We=wr;function Tr(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Ne=Tr;function $r(e,t){var r=-1,a=e.length;for(t||(t=Array(a));++r<a;)t[r]=e[r];return t}var Fe=$r;var Ar=800,Sr=16,Rr=Date.now;function Or(e){var t=0,r=0;return function(){var a=Rr(),i=Sr-(a-r);if(r=a,i>0){if(++t>=Ar)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Ve=Or;function Ir(e){return function(){return e}}var Me=Ir;var Cr=(function(){try{var e=We(Object,"defineProperty");return e({},"",{}),e}catch(t){}})(),ee=Cr;var Dr=ee?function(e,t){return ee(e,"toString",{configurable:!0,enumerable:!1,value:Me(t),writable:!0})}:z,_e=Dr;var Er=Ve(_e),Be=Er;function kr(e,t,r,a){for(var i=e.length,o=r+(a?1:-1);a?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var Pe=kr;function jr(e){return e!==e}var He=jr;function Wr(e,t,r){for(var a=r-1,i=e.length;++a<i;)if(e[a]===t)return a;return-1}var Le=Wr;function Nr(e,t,r){return t===t?Le(e,t,r):Pe(e,He,r)}var j=Nr;var Ue=Math.max;function Fr(e,t,r){return t=Ue(t===void 0?e.length-1:t,0),function(){for(var a=arguments,i=-1,o=Ue(a.length-t,0),l=Array(o);++i<o;)l[i]=a[t+i];i=-1;for(var f=Array(t+1);++i<t;)f[i]=a[i];return f[t]=r(l),Ne(e,this,f)}}var qe=Fr;function Vr(e,t){return Be(qe(e,t,z),e+"")}var Ke=Vr;function Mr(e){return function(t){return e(t)}}var ze=Mr;function _r(e){return e==null?"":q(e)}var Je=_r;function Br(e,t,r){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++a<i;)o[a]=e[a+t];return o}var Ge=Br;function Pr(e,t,r){var a=e.length;return r=r===void 0?a:r,!t&&r>=a?e:Ge(e,t,r)}var Qe=Pr;var Hr="\\ud800-\\udfff",Lr="\\u0300-\\u036f",Ur="\\ufe20-\\ufe2f",qr="\\u20d0-\\u20ff",Kr=Lr+Ur+qr,zr="\\ufe0e\\ufe0f",Jr="\\u200d",Gr=RegExp("["+Jr+Hr+Kr+zr+"]");function Qr(e){return Gr.test(e)}var Ze=Qr;function Zr(e){return e.split("")}var Ye=Zr;var Xe="\\ud800-\\udfff",Yr="\\u0300-\\u036f",Xr="\\ufe20-\\ufe2f",eo="\\u20d0-\\u20ff",to=Yr+Xr+eo,ro="\\ufe0e\\ufe0f",oo="["+Xe+"]",te="["+to+"]",re="\\ud83c[\\udffb-\\udfff]",ao="(?:"+te+"|"+re+")",et="[^"+Xe+"]",tt="(?:\\ud83c[\\udde6-\\uddff]){2}",rt="[\\ud800-\\udbff][\\udc00-\\udfff]",no="\\u200d",ot=ao+"?",at="["+ro+"]?",so="(?:"+no+"(?:"+[et,tt,rt].join("|")+")"+at+ot+")*",lo=at+ot+so,io="(?:"+[et+te+"?",te,tt,rt,oo].join("|")+")",fo=RegExp(re+"(?="+re+")|"+io+lo,"g");function uo(e){return e.match(fo)||[]}var nt=uo;function po(e){return Ze(e)?nt(e):Ye(e)}var oe=po;function mo(e,t,r,a){for(var i=r-1,o=e.length;++i<o;)if(a(e[i],t))return i;return-1}var st=mo;var co=Array.prototype,lt=co.splice;function go(e,t,r,a){var i=a?st:j,o=-1,l=t.length,f=e;for(e===t&&(t=Fe(t)),r&&(f=U(e,ze(r)));++o<l;)for(var s=0,n=t[o],c=r?r(n):n;(s=i(f,c,s,a))>-1;)f!==e&<.call(f,s,1),lt.call(e,s,1);return e}var it=go;function ho(e,t){return e&&e.length&&t&&t.length?it(e,t):e}var ft=ho;var yo=Ke(ft),G=yo;function xo(e,t){for(var r=e.length;r--&&j(t,e[r],0)>-1;);return r}var ut=xo;function bo(e,t){for(var r=-1,a=e.length;++r<a&&j(t,e[r],0)>-1;);return r}var pt=bo;function vo(e,t,r){if(e=Je(e),e&&(r||t===void 0))return Oe(e);if(!e||!(t=q(t)))return e;var a=oe(e),i=oe(t),o=pt(a,i),l=ut(a,i)+1;return Qe(a,o,l).join("")}var ae=vo;var wo={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function W(e,t){if(!Array.isArray(e)||!e.length)return e;let r=T(T({},wo),t),a,i;if(r.strictlyTwoElementsInRangeArrays&&!e.every((f,s)=>!Array.isArray(f)||f.length!==2?(a=s,i=f.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(a,"th range (").concat(g(e[a],4),") has not two but ").concat(i," elements!"));if(!e.every((f,s)=>!Array.isArray(f)||!Number.isInteger(f[0])||f[0]<0||!Number.isInteger(f[1])||f[1]<0?(a=s,!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(a,"th range (").concat(g(e[a],4),") does not consist of only natural numbers!"));let o=e.length**2,l=0;return Array.from(e).sort((f,s)=>(r.progressFn&&(l+=1,r.progressFn(Math.floor(l*100/o))),f[0]===s[0]?f[1]<s[1]?-1:f[1]>s[1]?1:0:f[0]<s[0]?-1:1))}var To={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function ne(e,t){function r(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;if(t&&!r(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(g(t,4)," (type ").concat(typeof t,")"));let a=T(T({},To),t);if(a.progressFn&&r(a.progressFn)&&!Object.keys(a.progressFn).length)a.progressFn=null;else if(a.progressFn&&typeof a.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 a.progressFn,'", equal to ').concat(g(a.progressFn,4)));if(![1,2,"1","2"].includes(a.mergeType))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 a.mergeType,'", equal to ').concat(g(a.mergeType,4)));if(typeof a.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 a.joinRangesThatTouchEdges,'", equal to ').concat(g(a.joinRangesThatTouchEdges,4)));let i=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),o,l,f;a.progressFn?o=W(i,{progressFn:n=>{f=Math.floor(n/5),f!==l&&(l=f,a.progressFn(f))}}):o=W(i);let s=o.length-1;for(let n=s;n>0;n--)a.progressFn&&(f=Math.floor((1-n/s)*78)+21,f!==l&&f>l&&(l=f,a.progressFn(f))),(o[n][0]<=o[n-1][0]||!a.joinRangesThatTouchEdges&&o[n][0]<o[n-1][1]||a.joinRangesThatTouchEdges&&o[n][0]<=o[n-1][1])&&(o[n-1][0]=Math.min(o[n][0],o[n-1][0]),o[n-1][1]=Math.max(o[n][1],o[n-1][1]),o[n][2]!==void 0&&(o[n-1][0]>=o[n][0]||o[n-1][1]<=o[n][1])&&o[n-1][2]!==null&&(o[n][2]===null&&o[n-1][2]!==null?o[n-1][2]=null:o[n-1][2]!=null?+a.mergeType==2&&o[n-1][0]===o[n][0]?o[n-1][2]=o[n][2]:o[n-1][2]+=o[n][2]:o[n-1][2]=o[n][2]),o.splice(n,1),n=o.length);return o.length?o:null}function Q(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 mt(e,t,r){let a=0,i=0;if(e===void 0&&t===void 0&&r===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(g(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(g(t,4)));if(r&&typeof r!="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 r,", equal to: ").concat(g(r,4)));if(!(t!=null&&t.some(Boolean)))return e;let o;Array.isArray(t)&&!Array.isArray(t[0])&&Q(t[0])&&Q(t[1])?o=[Array.from(t)]:o=Array.from(t);let l=o.length,f=0;o.forEach((c,m)=>{if(c){if(r&&(a=Math.floor(f/l*10),a!==i&&(i=a,r(a))),!Array.isArray(c))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(m,"th element not an array: ").concat(g(c,4),", which is ").concat(typeof c));if(!Q(c[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(m,"th element, array ").concat(g(c),". Its first element is not a non-negative integer or string index, but ").concat(typeof c[0],", equal to: ").concat(g(c[0],4),"."));if(typeof c[0]=="string"&&(o[m]=[...c],o[m][0]=Number(c[0])),!Q(c[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(m,"th element, array ").concat(g(c),". Its second element is not a non-negative integer or string index, but ").concat(typeof c[1],", equal to: ").concat(g(c[1],4),"."));typeof c[1]=="string"&&(o[m]===c&&(o[m]=[...c]),o[m][1]=Number(c[1])),f+=1}});let s=r?ne(o,{progressFn:c=>{a=10+Math.floor(c/10),a!==i&&(i=a,r(a))}}):ne(o),n=(s==null?void 0:s.length)||0;if(s&&n>0){let c=e.slice(s[n-1][1]);e=s.reduce((m,b,y,u)=>{r&&(a=20+Math.floor(y/n*80),a!==i&&(i=a,r(a)));let x=y===0?0:u[y-1][1],w=u[y][0];return"".concat(m).concat(e.slice(x,w)).concat(u[y][2]||"")},""),e+=c}return e}function Z(e,t=1){let r="\xA0";function a(o){return Array.from(o).reverse().join("")}function i(o,l,f){let s=f?"\n":"\r",n=f?"\r":"\n";if(!o)return o;let c=0,m=0,b="";for(let y=0,u=o.length;y<u;y++)(o[y]===s||o[y]===n&&o[y-1]!==s)&&m++,"\r\n".includes(o[y])||o[y]===r?(c=0,o[y]===r?b+=o[y]:o[y]===s?m<=l&&(b+=o[y],o[y+1]===n&&(b+=o[y+1],y++)):o[y]===n&&(o==null?void 0:o[y-1])!==s&&m<=l&&(b+=o[y])):(c++,!o[y+1]&&!m&&(b+=" "));return b}if(typeof e=="string"&&e.length){let o=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(o=+t);let l="",f="";if(!e.trim())l=e;else if(!e[0].trim()){for(let s=0,n=e.length;s<n;s++)if(e[s].trim()){l=e.slice(0,s);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===r)){for(let s=e.length;s--;)if(e[s].trim()){f=e.slice(s+1);break}}return"".concat(i(l,o,!1)).concat(e.trim()).concat(a(i(a(f),o,!0)))}return e}var $o={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ao(e,t){function r(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;if(t&&!r(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(g(t,4)," (type ").concat(typeof t,")"));let a=T(T({},$o),t);if(a.progressFn&&r(a.progressFn)&&!Object.keys(a.progressFn).length)a.progressFn=null;else if(a.progressFn&&typeof a.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 a.progressFn,'", equal to ').concat(g(a.progressFn,4)));if(![1,2,"1","2"].includes(a.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 a.mergeType,'", equal to ').concat(g(a.mergeType,4)));if(typeof a.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 a.joinRangesThatTouchEdges,'", equal to ').concat(g(a.joinRangesThatTouchEdges,4)));let i=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),o,l,f;a.progressFn?o=W(i,{progressFn:n=>{f=Math.floor(n/5),f!==l&&(l=f,a.progressFn!=null&&a.progressFn(f))}}):o=W(i);let s=o.length-1;for(let n=s;n>0;n--)a.progressFn&&(f=Math.floor((1-n/s)*78)+21,f!==l&&f>l&&(l=f,a.progressFn(f))),(o[n][0]<=o[n-1][0]||!a.joinRangesThatTouchEdges&&o[n][0]<o[n-1][1]||a.joinRangesThatTouchEdges&&o[n][0]<=o[n-1][1])&&(o[n-1][0]=Math.min(o[n][0],o[n-1][0]),o[n-1][1]=Math.max(o[n][1],o[n-1][1]),o[n][2]!==void 0&&(o[n-1][0]>=o[n][0]||o[n-1][1]<=o[n][1])&&o[n-1][2]!==null&&(o[n][2]===null&&o[n-1][2]!==null?o[n-1][2]=null:o[n-1][2]!=null?+a.mergeType==2&&o[n-1][0]===o[n][0]?o[n-1][2]=o[n][2]:o[n-1][2]+=o[n][2]:o[n-1][2]=o[n][2]),o.splice(n,1),n=o.length);return o.length?o:null}var So={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1};function dt(e){return e[2]===void 0&&e[0]===e[1]}function Ro(e){let t=-1;for(let r=0,a=e.length;r<a;r++){let i=e[r];if(Array.isArray(i)){if(i[0]<t)return!1;t=i[0]}}return!0}var ct=class{constructor(e){V(this,"ranges");V(this,"opts");V(this,"sorted");if(e!=null&&!de(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(g(e,4)," (type ").concat(typeof e,")."));let t=T(T({},So),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(k(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(k(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(g(t.mergeType,4)));this.opts=t,this.ranges=[],this.sorted=!0}add(e,t,r){var o;if(e==null&&t==null)return;if(I(e)&&!I(t)){if(Array.isArray(e)){if(e.length){if(e.some(l=>Array.isArray(l))){e.forEach(l=>{Array.isArray(l)&&this.add(...l)});return}e.length&&D(+e[0])&&D(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_03] the first input argument, "from" is set ('.concat(g(e),') but second-one, "to" is not (').concat(g(t),")"))}else if(!I(e)&&I(t))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_04] the second input argument, "to" is set ('.concat(g(t),') but first-one, "from" is not (').concat(g(e),")"));let a=+e,i=+t;if(D(a)&&D(i)){if(I(r)&&!k(r)&&!ce(r))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 r,", equal to:\n").concat(g(r,4)));if(I(this.ranges)&&Array.isArray(this.last())&&a===this.last()[1]){if(this.last()[1]=i,this.last()[2],this.last()[2]!==null&&I(r)){let l=this.last()[2]&&this.last()[2].length&&(!((o=this.opts)!=null&&o.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(r):r;this.opts.limitToBeAddedWhitespace&&(l=Z(l,this.opts.limitLinebreaksCount)),k(l)&&!l.length||(this.last()[2]=l)}}else{this.ranges||(this.ranges=[]);let l=this.last();l&&a<l[0]&&(this.sorted=!1);let f=r!==void 0&&!(k(r)&&!r.length)?[a,i,r&&this.opts.limitToBeAddedWhitespace?Z(r,this.opts.limitLinebreaksCount):r]:[a,i];this.ranges.push(f)}}else throw D(a)?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(g(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(g(e,4)))}push(e,t,r){this.add(e,t,r)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Ao(this.ranges,{mergeType:this.opts.mergeType}),this.sorted=!0,this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>I(e[2])?[e[0],e[1],Z(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}firstCovers(e){if(!D(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(g(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=null;if(this.sorted){for(let a=0,i=this.ranges.length;a<i;a++){let o=this.ranges[a];if(!(!Array.isArray(o)||dt(o))){if(t===null){if(o[0]!==0)return!1;t=o[1]}else{if(o[0]>t)break;o[1]>t&&(t=o[1])}if(t>=e)return!0}}return t!==null&&t>=e}let r=!0;for(;r;){r=!1;for(let a=0,i=this.ranges.length;a<i;a++){let o=this.ranges[a];if(!(!Array.isArray(o)||dt(o))){if(o[0]<0)return!1;(t===null?o[0]===0:o[0]<=t&&o[1]>t)&&(t=o[1],r=!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])&&D(e[0][0]))this.ranges=Array.from(e),this.sorted=Ro(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(g(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 Oo={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function _(e,t){let r=!0,a=[".",",","'"," "],i;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(g(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(g(t,4)));let o=T(T({},Oo),t),l=ae(e.trim(),'"');if(l==="")return l;if(+e>0&&+e<1)return e;let f=new ct;for(let s=0,n=l.length;s<n;s++){if(o.removeThousandSeparatorsFromNumbers&&l[s].trim()===""&&f.add(s,s+1),o.removeThousandSeparatorsFromNumbers&&l[s]==="'"&&(f.add(s,s+1),l[s+1]==="'")){r=!1;break}if(a.includes(l[s])){if(l[s+1]!==void 0&&/^\d$/.test(l[s+1]))if(l[s+2]!==void 0)if(/^\d$/.test(l[s+2]))if(l[s+3]!==void 0)if(/^\d$/.test(l[s+3])){if(l[s+4]!==void 0&&/^\d$/.test(l[s+4])){r=!1;break}else if(o.removeThousandSeparatorsFromNumbers&&f.add(s,s+1),!i)i=l[s];else if(l[s]!==i){r=!1;break}}else{r=!1;break}else o.removeThousandSeparatorsFromNumbers&&o.forceUKStyle&&l[s]===","&&f.add(s,s+1,".");else{r=!1;break}else o.forceUKStyle&&l[s]===","&&f.add(s,s+1,"."),o.padSingleDecimalPlaceNumbers&&f.add(s+2,s+2,"0")}else if(!/^\d$/.test(l[s])){r=!1;break}}return r&&f.current()?mt(l,f.current()):l}var Io={delimiter:",",removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function Co(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Do(e,t){let r=0,a=e.length;for(;r<a&&e[r]!==t&&e[r].trim()==="";)r+=1;for(;a>r&&e[a-1]!==t&&e[a-1].trim()==="";)a-=1;return e.slice(r,a)}function gt(e,t){let r=0,a=0,i=[],o=[],l=!1,f=!0;if(t&&!Co(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(g(t,4)));let s=T(T({},Io),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(g(e,4)));if(typeof s.delimiter!="string"||s.delimiter.length!==1||s.delimiter==='"'||s.delimiter==="\n"||s.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 s.delimiter,", equal to: ").concat(g(s.delimiter)));if(e==="")return[[""]];e=Do(e,s.delimiter);for(let n=0,c=e.length;n<c;n++){if(f&&e[n]!=='"'&&e[n]!==s.delimiter&&e[n].trim()!==""&&(f=!1),e[n]==='"')if(l&&e[n+1]==='"')n+=1;else if(l){l=!1;let m=e.slice(r,n);m.trim()!==""&&(f=!1);let b=/""/.test(m)?m.replace(/""/g,'"'):_(m,{removeThousandSeparatorsFromNumbers:s.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:s.padSingleDecimalPlaceNumbers,forceUKStyle:s.forceUKStyle});i.push(b)}else l=!0,r=n+1;else if(!l&&e[n]===s.delimiter){if(e[n-1]!=='"'&&!l){let m=e.slice(r,n);m.trim()!==""&&(f=!1),i.push(_(m,{removeThousandSeparatorsFromNumbers:s.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:s.padSingleDecimalPlaceNumbers,forceUKStyle:s.forceUKStyle}))}r=n+1,a&&(a=0)}else if(e[n]==="\n"||e[n]==="\r"){if(!a){if(a=n,!l&&e[n-1]!=='"'){let m=e.slice(r,n);m.trim()!==""&&(f=!1),i.push(_(m,{removeThousandSeparatorsFromNumbers:s.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:s.padSingleDecimalPlaceNumbers,forceUKStyle:s.forceUKStyle}))}f?i.length=0:o.push(i),f=!0,i=[]}r=n+1}else a&&(a=0,r=n);if(n+1===c){if(e[n]!=='"'){let m=e.slice(r,n+1);m.trim()&&(f=!1),i.push(_(m,{removeThousandSeparatorsFromNumbers:s.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:s.padSingleDecimalPlaceNumbers,forceUKStyle:s.forceUKStyle}))}f?i=[]:o.push(i),f=!0}}return o.length===0?[[""]]:o}var N=Rt(ht(),1);var yt="7.2.0";function Y(e){return typeof e=="number"&&!Number.isNaN(e)?!0:(e=(e||"").toString().trim(),e?!Number.isNaN(+e):!1)}var ko=["\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 B(e){return Y(e)||ko.some(t=>Y(e.replace(t,"").replace(/[,.]/g,"")))?"numeric":e.trim()?"text":"empty"}var jo=yt;function Wo(e){let t=null,r=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(g(e,4)));if(!e.trim())return{res:[[""]],msgContent:t,msgType:r};let a=gt(e),i=[],o=!1,l=!0,f=[],s=null;for(let d=a.length-1;d>=0;d--)if(i.length){d===0&&(o=a[d].every(h=>{let v=B(h);return v==="text"||v==="empty"})),!o&&i.length!==a[d].length&&(l=!1);let p=null;for(let h=0,v=a[d].length;h<v;h++){let $=B(a[d][h].trim());if(p===null&&$==="empty"&&(p=h),p!==null&&$!=="empty"&&(p=null),$!==i[h]&&!o){let A=$;if(Array.isArray(i[h]))i[h].includes(A)||i[h].push(A);else if(i[h]!==A){let S=i[h];i[h]=[],i[h].push(S),i[h].push(A)}}}s!==null&&p!==null&&p>s&&(!o||o&&d!==0)&&(s=p)}else if(a[d].length!==1||a[d][0]!=="")for(let p=0,h=a[d].length;p<h;p++){let v=B(a[d][p].trim());i.push(v),s===null&&v==="empty"&&(s=p),s!==null&&v!=="empty"&&(s=null)}s||(s=i.length);let n=0;for(let d=0,p=i.length;d<p&&i[d]==="empty";d++)n=d;n!==0&&(a=a.map(d=>d.slice(n+1,s)),i=i.slice(n+1,s));let c=[],m;i.forEach((d,p)=>{d==="numeric"&&c.push(p)});let b=o?1:0;if(c.length===1)m=c[0];else{if(c.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 d=Array.from(c),p=[];for(let h=0,v=d.length;h<v;h++){let $=d[h],A,S=!0,E,O=!0;for(let R=b,xt=a.length;R<xt&&(S&&(A==null?A=a[R][$]:A===a[R][$]?(p.push($),S=!1):A=a[R][$]),O&&(E==null?E=a[R][$]:a[R][$]!==E&&(O=!1)),!!S);R++);O&&f.push($)}if(d=G(d,...p),d.length===1)m=d[0];else if(d.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(!m)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 y=G(Array.from(i.reduce((d,p,h)=>((typeof p=="string"&&p==="numeric"||Array.isArray(p)&&p.includes("numeric"))&&d.push(h),d),[])),m,...f),u=[];u.push(a[a.length-1].slice(0,s));let x=[],w=o?1:0;for(let d=a.length-2;d>=w;d--)for(let p=a.length-2;p>=w;p--)if(!x.includes(p)){let h=!1;for(let v=0,$=y.length;v<$;v++){let A=null;a[p][y[v]]!==""&&(A=(0,N.default)(a[p][y[v]]));let S=null;a[p][m]!==""&&(S=(0,N.default)(a[p][m]));let E=null;u[0][m]!==""&&(E=(0,N.default)(u[0][m]).format());let O=null;u[u.length-1][y[v]]!==""&&(O=(0,N.default)(u[u.length-1][y[v]]).format());let R=null;if(u[u.length-1][m]!==""&&(R=(0,N.default)(u[u.length-1][m])),A&&S.add(A).format()===E){u.unshift(a[p].slice(0,s)),x.push(p),h=!0;break}else if(A&&S.subtract(A).format()===E){u.unshift(a[p].slice(0,s)),x.push(p),h=!0;break}else if(O&&R.add(O).format()===S.format()){u.push(a[p].slice(0,s)),x.push(p),h=!0;break}else if(O&&R.subtract(O).format()===S.format()){u.push(a[p].slice(0,s)),x.push(p),h=!0;break}}if(h){h=!1;break}}return o&&(l&&a[0].length>i.length&&(a[0].length=i.length),u.unshift(a[0].slice(0,s))),a.length-(o?2:1)!==x.length&&(t="Not all rows were recognised!",r="alert"),{res:u,msgContent:t,msgType:r}}return Ot(No);})();
|
|
10
|
+
"use strict";var csvSort=(()=>{var bt=Object.create;var F=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames,ie=Object.getOwnPropertySymbols,Tt=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var X=(e,t,r)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))fe.call(t,r)&&X(e,r,t[r]);if(ie)for(var r of ie(t))$t.call(t,r)&&X(e,r,t[r]);return e};var At=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},St=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},ue=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wt(t))!fe.call(e,i)&&i!==r&&F(e,i,{get:()=>t[i],enumerable:!(a=vt(t,i))||a.enumerable});return e};var Rt=(e,t,r)=>(r=e!=null?bt(Tt(e)):{},ue(t||!e||!e.__esModule?F(r,"default",{value:e,enumerable:!0}):r,e)),Ot=e=>ue(F({},"__esModule",{value:!0}),e);var V=(e,t,r)=>X(e,typeof t!="symbol"?t+"":t,r);var ht=At((se,le)=>{(function(e,t){typeof se=="object"&&typeof le<"u"?le.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self,e.currency=t())})(se,function(){function e(o,l){if(!(this instanceof e))return new e(o,l);l=Object.assign({},r,l);var f=Math.pow(10,l.precision);this.intValue=o=t(o,l),this.value=o/f,l.increment=l.increment||1/f,l.groups=l.useVedic?i:a,this.s=l,this.p=f}function t(o,l){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,s=l.decimal,n=l.errorOnInvalid,c=l.fromCents,m=Math.pow(10,l.precision),b=o instanceof e;if(b&&c)return o.intValue;if(typeof o=="number"||b)s=b?o.value:o;else if(typeof o=="string")n=new RegExp("[^-\\d"+s+"]","g"),s=new RegExp("\\"+s,"g"),s=(s=o.replace(/\((.*)\)/,"-$1").replace(n,"").replace(s,"."))||0;else{if(n)throw Error("Invalid Input");s=0}return c||(s=(s*m).toFixed(4)),f?Math.round(s):s}var r={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(o,l){var f=l.pattern,s=l.negativePattern,n=l.symbol,c=l.separator,m=l.decimal;l=l.groups;var b=(""+o).replace(/^-/,"").split("."),y=b[0];return b=b[1],(0<=o.value?f:s).replace("!",n).replace("#",y.replace(l,"$1"+c)+(b?m+b:""))},fromCents:!1},a=/(\d)(?=(\d{3})+\b)/g,i=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(o){var l=this.s,f=this.p;return e((this.intValue+t(o,l))/(l.fromCents?1:f),l)},subtract:function(o){var l=this.s,f=this.p;return e((this.intValue-t(o,l))/(l.fromCents?1:f),l)},multiply:function(o){var l=this.s;return e(this.intValue*o/(l.fromCents?1:Math.pow(10,l.precision)),l)},divide:function(o){var l=this.s;return e(this.intValue/t(o,l,!1),l)},distribute:function(o){var l=this.intValue,f=this.p,s=this.s,n=[],c=Math[0<=l?"floor":"ceil"](l/o),m=Math.abs(l-c*o);for(f=s.fromCents?1:f;o!==0;o--){var b=e(c/f,s);0<m--&&(b=b[0<=l?"add":"subtract"](1/f)),n.push(b)}return n},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(o){var l=this.s;return typeof o=="function"?o(this,l):l.format(this,Object.assign({},l,o))},toString:function(){var o=this.s,l=o.increment;return(Math.round(this.intValue/this.p/l)*l).toFixed(o.precision)},toJSON:function(){return this.value}},e})});var No={};St(No,{findType:()=>B,isNumeric:()=>Y,sort:()=>Wo,version:()=>jo});function It(){let e=[],t=0,r=!1;return{append(a){return r?!1:t+a.length>1999?(e.push("\u2026"),t+=1,r=!0,!1):(e.push(a),t+=a.length,!0)},result(){return e.join("")},stopped(){return r}}}function Ct(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function P(e,t){if(e.append('"')){for(let r=0;r<t.length&&!e.stopped();r+=1){let a=t.charCodeAt(r);a===34?e.append('\\"'):a===92?e.append("\\\\"):a===8?e.append("\\b"):a===9?e.append("\\t"):a===10?e.append("\\n"):a===12?e.append("\\f"):a===13?e.append("\\r"):a<32||a===8232||a===8233||a>=55296&&a<=57343?e.append(Ct(a)):e.append(t[r])}e.append('"')}}function Dt(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function me(e,t){e.append("Symbol(");let r=String(t);r.length>8&&P(e,r.slice(7,-1)),e.append(")")}function pe(e,t){typeof t=="symbol"?me(e,t):P(e,String(t))}function g(e,t=0){let r=It(),a=t===4?4:0,i=new WeakSet,o=0;function l(u){a&&r.append(" ".repeat(u*a))}function f(u,x){u&&r.append(","),a&&(r.append("\n"),l(x+1))}function s(u,x,w){a&&x&&(r.append("\n"),l(w)),r.append(u)}function n(u,x){Object.prototype.hasOwnProperty.call(u,"value")?y(u.value,x):r.append(Dt(u))}function c(u,x){let w;try{w=Reflect.getOwnPropertyDescriptor(u,"length")}catch(h){r.append("[Uninspectable]");return}let d=w==null?void 0:w.value;if(!Number.isSafeInteger(d)||d<0){r.append("[Uninspectable]");return}r.append("[");let p=!1;for(let h=0;h<d&&!r.stopped();h+=1){if(f(p,x),p=!0,o>=50){r.append("[MaxEntries]");break}o+=1;let v;try{v=Reflect.getOwnPropertyDescriptor(u,String(h))}catch($){r.append("[Uninspectable]");continue}v!=null&&v.enumerable?n(v,x+1):r.append("[Empty]")}s("]",p,x)}function m(u,x){let w;try{w=Reflect.ownKeys(u)}catch(p){r.append("[Uninspectable]");return}r.append("{");let d=!1;for(let p of w){if(r.stopped())break;if(o>=50){f(d,x),d=!0,P(r,"\u2026"),r.append(a?": ":":"),r.append("[MaxEntries]");break}o+=1;let h;try{h=Reflect.getOwnPropertyDescriptor(u,p)}catch(v){f(d,x),d=!0,pe(r,p),r.append(a?": ":":"),r.append("[Uninspectable]");continue}h!=null&&h.enumerable&&(f(d,x),d=!0,pe(r,p),r.append(a?": ":":"),n(h,x+1))}s("}",d,x)}function b(u,x){if(i.has(u)){r.append("[Circular]");return}if(x>=5){r.append("[MaxDepth]");return}let w;try{w=Array.isArray(u)}catch(d){r.append("[Uninspectable]");return}i.add(u);try{w?c(u,x):m(u,x)}finally{i.delete(u)}}function y(u,x){u===null?r.append("null"):typeof u=="string"?P(r,u):typeof u=="number"?r.append(Object.is(u,-0)?"-0":String(u)):typeof u=="boolean"?r.append(u?"true":"false"):typeof u>"u"?r.append("undefined"):typeof u=="bigint"?r.append("".concat(u,"n")):typeof u=="symbol"?me(r,u):typeof u=="function"?r.append("[Function]"):b(u,x)}try{return y(e,0),r.result()}catch(u){return"[Uninspectable]"}}var Vo=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 de(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 k(e){return typeof e=="string"}function ce(e){return Number.isFinite(e)}function D(e){return Number.isSafeInteger(e)&&e>=0}function I(e){return e!=null}var Et=typeof global=="object"&&global&&global.Object===Object&&global,ge=Et;var kt=typeof self=="object"&&self&&self.Object===Object&&self,jt=ge||kt||Function("return this")(),H=jt;var Wt=H.Symbol,C=Wt;var he=Object.prototype,Nt=he.hasOwnProperty,Ft=he.toString,M=C?C.toStringTag:void 0;function Vt(e){var t=Nt.call(e,M),r=e[M];try{e[M]=void 0;var a=!0}catch(o){}var i=Ft.call(e);return a&&(t?e[M]=r:delete e[M]),i}var ye=Vt;var Mt=Object.prototype,_t=Mt.toString;function Bt(e){return _t.call(e)}var xe=Bt;var Pt="[object Null]",Ht="[object Undefined]",be=C?C.toStringTag:void 0;function Lt(e){return e==null?e===void 0?Ht:Pt:be&&be in Object(e)?ye(e):xe(e)}var L=Lt;function Ut(e){return e!=null&&typeof e=="object"}var ve=Ut;var qt="[object Symbol]";function Kt(e){return typeof e=="symbol"||ve(e)&&L(e)==qt}var we=Kt;function zt(e,t){for(var r=-1,a=e==null?0:e.length,i=Array(a);++r<a;)i[r]=t(e[r],r,e);return i}var U=zt;var Jt=Array.isArray,Te=Jt;var Gt=1/0,$e=C?C.prototype:void 0,Ae=$e?$e.toString:void 0;function Se(e){if(typeof e=="string")return e;if(Te(e))return U(e,Se)+"";if(we(e))return Ae?Ae.call(e):"";var t=e+"";return t=="0"&&1/e==-Gt?"-0":t}var q=Se;var Qt=/\s/;function Zt(e){for(var t=e.length;t--&&Qt.test(e.charAt(t)););return t}var Re=Zt;var Yt=/^\s+/;function Xt(e){return e&&e.slice(0,Re(e)+1).replace(Yt,"")}var Oe=Xt;function er(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var K=er;function tr(e){return e}var z=tr;var rr="[object AsyncFunction]",or="[object Function]",ar="[object GeneratorFunction]",nr="[object Proxy]";function sr(e){if(!K(e))return!1;var t=L(e);return t==or||t==ar||t==rr||t==nr}var Ie=sr;var lr=H["__core-js_shared__"],J=lr;var Ce=(function(){var e=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function ir(e){return!!Ce&&Ce in e}var De=ir;var fr=Function.prototype,ur=fr.toString;function pr(e){if(e!=null){try{return ur.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Ee=pr;var mr=/[\\^$.*+?()[\]{}|]/g,dr=/^\[object .+?Constructor\]$/,cr=Function.prototype,gr=Object.prototype,hr=cr.toString,yr=gr.hasOwnProperty,xr=RegExp("^"+hr.call(yr).replace(mr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function br(e){if(!K(e)||De(e))return!1;var t=Ie(e)?xr:dr;return t.test(Ee(e))}var ke=br;function vr(e,t){return e==null?void 0:e[t]}var je=vr;function wr(e,t){var r=je(e,t);return ke(r)?r:void 0}var We=wr;function Tr(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Ne=Tr;function $r(e,t){var r=-1,a=e.length;for(t||(t=Array(a));++r<a;)t[r]=e[r];return t}var Fe=$r;var Ar=800,Sr=16,Rr=Date.now;function Or(e){var t=0,r=0;return function(){var a=Rr(),i=Sr-(a-r);if(r=a,i>0){if(++t>=Ar)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Ve=Or;function Ir(e){return function(){return e}}var Me=Ir;var Cr=(function(){try{var e=We(Object,"defineProperty");return e({},"",{}),e}catch(t){}})(),ee=Cr;var Dr=ee?function(e,t){return ee(e,"toString",{configurable:!0,enumerable:!1,value:Me(t),writable:!0})}:z,_e=Dr;var Er=Ve(_e),Be=Er;function kr(e,t,r,a){for(var i=e.length,o=r+(a?1:-1);a?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var Pe=kr;function jr(e){return e!==e}var He=jr;function Wr(e,t,r){for(var a=r-1,i=e.length;++a<i;)if(e[a]===t)return a;return-1}var Le=Wr;function Nr(e,t,r){return t===t?Le(e,t,r):Pe(e,He,r)}var j=Nr;var Ue=Math.max;function Fr(e,t,r){return t=Ue(t===void 0?e.length-1:t,0),function(){for(var a=arguments,i=-1,o=Ue(a.length-t,0),l=Array(o);++i<o;)l[i]=a[t+i];i=-1;for(var f=Array(t+1);++i<t;)f[i]=a[i];return f[t]=r(l),Ne(e,this,f)}}var qe=Fr;function Vr(e,t){return Be(qe(e,t,z),e+"")}var Ke=Vr;function Mr(e){return function(t){return e(t)}}var ze=Mr;function _r(e){return e==null?"":q(e)}var Je=_r;function Br(e,t,r){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++a<i;)o[a]=e[a+t];return o}var Ge=Br;function Pr(e,t,r){var a=e.length;return r=r===void 0?a:r,!t&&r>=a?e:Ge(e,t,r)}var Qe=Pr;var Hr="\\ud800-\\udfff",Lr="\\u0300-\\u036f",Ur="\\ufe20-\\ufe2f",qr="\\u20d0-\\u20ff",Kr=Lr+Ur+qr,zr="\\ufe0e\\ufe0f",Jr="\\u200d",Gr=RegExp("["+Jr+Hr+Kr+zr+"]");function Qr(e){return Gr.test(e)}var Ze=Qr;function Zr(e){return e.split("")}var Ye=Zr;var Xe="\\ud800-\\udfff",Yr="\\u0300-\\u036f",Xr="\\ufe20-\\ufe2f",eo="\\u20d0-\\u20ff",to=Yr+Xr+eo,ro="\\ufe0e\\ufe0f",oo="["+Xe+"]",te="["+to+"]",re="\\ud83c[\\udffb-\\udfff]",ao="(?:"+te+"|"+re+")",et="[^"+Xe+"]",tt="(?:\\ud83c[\\udde6-\\uddff]){2}",rt="[\\ud800-\\udbff][\\udc00-\\udfff]",no="\\u200d",ot=ao+"?",at="["+ro+"]?",so="(?:"+no+"(?:"+[et,tt,rt].join("|")+")"+at+ot+")*",lo=at+ot+so,io="(?:"+[et+te+"?",te,tt,rt,oo].join("|")+")",fo=RegExp(re+"(?="+re+")|"+io+lo,"g");function uo(e){return e.match(fo)||[]}var nt=uo;function po(e){return Ze(e)?nt(e):Ye(e)}var oe=po;function mo(e,t,r,a){for(var i=r-1,o=e.length;++i<o;)if(a(e[i],t))return i;return-1}var st=mo;var co=Array.prototype,lt=co.splice;function go(e,t,r,a){var i=a?st:j,o=-1,l=t.length,f=e;for(e===t&&(t=Fe(t)),r&&(f=U(e,ze(r)));++o<l;)for(var s=0,n=t[o],c=r?r(n):n;(s=i(f,c,s,a))>-1;)f!==e&<.call(f,s,1),lt.call(e,s,1);return e}var it=go;function ho(e,t){return e&&e.length&&t&&t.length?it(e,t):e}var ft=ho;var yo=Ke(ft),G=yo;function xo(e,t){for(var r=e.length;r--&&j(t,e[r],0)>-1;);return r}var ut=xo;function bo(e,t){for(var r=-1,a=e.length;++r<a&&j(t,e[r],0)>-1;);return r}var pt=bo;function vo(e,t,r){if(e=Je(e),e&&(r||t===void 0))return Oe(e);if(!e||!(t=q(t)))return e;var a=oe(e),i=oe(t),o=pt(a,i),l=ut(a,i)+1;return Qe(a,o,l).join("")}var ae=vo;var wo={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function W(e,t){if(!Array.isArray(e)||!e.length)return e;let r=T(T({},wo),t),a,i;if(r.strictlyTwoElementsInRangeArrays&&!e.every((f,s)=>!Array.isArray(f)||f.length!==2?(a=s,i=f.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(a,"th range (").concat(g(e[a],4),") has not two but ").concat(i," elements!"));if(!e.every((f,s)=>!Array.isArray(f)||!Number.isInteger(f[0])||f[0]<0||!Number.isInteger(f[1])||f[1]<0?(a=s,!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(a,"th range (").concat(g(e[a],4),") does not consist of only natural numbers!"));let o=e.length**2,l=0;return Array.from(e).sort((f,s)=>(r.progressFn&&(l+=1,r.progressFn(Math.floor(l*100/o))),f[0]===s[0]?f[1]<s[1]?-1:f[1]>s[1]?1:0:f[0]<s[0]?-1:1))}var To={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function ne(e,t){function r(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;if(t&&!r(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(g(t,4)," (type ").concat(typeof t,")"));let a=T(T({},To),t);if(a.progressFn&&r(a.progressFn)&&!Object.keys(a.progressFn).length)a.progressFn=null;else if(a.progressFn&&typeof a.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 a.progressFn,'", equal to ').concat(g(a.progressFn,4)));if(![1,2,"1","2"].includes(a.mergeType))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 a.mergeType,'", equal to ').concat(g(a.mergeType,4)));if(typeof a.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 a.joinRangesThatTouchEdges,'", equal to ').concat(g(a.joinRangesThatTouchEdges,4)));let i=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),o,l,f;a.progressFn?o=W(i,{progressFn:n=>{f=Math.floor(n/5),f!==l&&(l=f,a.progressFn(f))}}):o=W(i);let s=o.length-1;for(let n=s;n>0;n--)a.progressFn&&(f=Math.floor((1-n/s)*78)+21,f!==l&&f>l&&(l=f,a.progressFn(f))),(o[n][0]<=o[n-1][0]||!a.joinRangesThatTouchEdges&&o[n][0]<o[n-1][1]||a.joinRangesThatTouchEdges&&o[n][0]<=o[n-1][1])&&(o[n-1][0]=Math.min(o[n][0],o[n-1][0]),o[n-1][1]=Math.max(o[n][1],o[n-1][1]),o[n][2]!==void 0&&(o[n-1][0]>=o[n][0]||o[n-1][1]<=o[n][1])&&o[n-1][2]!==null&&(o[n][2]===null&&o[n-1][2]!==null?o[n-1][2]=null:o[n-1][2]!=null?+a.mergeType==2&&o[n-1][0]===o[n][0]?o[n-1][2]=o[n][2]:o[n-1][2]+=o[n][2]:o[n-1][2]=o[n][2]),o.splice(n,1),n=o.length);return o.length?o:null}function Q(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 mt(e,t,r){let a=0,i=0;if(e===void 0&&t===void 0&&r===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(g(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(g(t,4)));if(r&&typeof r!="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 r,", equal to: ").concat(g(r,4)));if(!(t!=null&&t.some(Boolean)))return e;let o;Array.isArray(t)&&!Array.isArray(t[0])&&Q(t[0])&&Q(t[1])?o=[Array.from(t)]:o=Array.from(t);let l=o.length,f=0;o.forEach((c,m)=>{if(c){if(r&&(a=Math.floor(f/l*10),a!==i&&(i=a,r(a))),!Array.isArray(c))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(m,"th element not an array: ").concat(g(c,4),", which is ").concat(typeof c));if(!Q(c[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(m,"th element, array ").concat(g(c),". Its first element is not a non-negative integer or string index, but ").concat(typeof c[0],", equal to: ").concat(g(c[0],4),"."));if(typeof c[0]=="string"&&(o[m]=[...c],o[m][0]=Number(c[0])),!Q(c[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(m,"th element, array ").concat(g(c),". Its second element is not a non-negative integer or string index, but ").concat(typeof c[1],", equal to: ").concat(g(c[1],4),"."));typeof c[1]=="string"&&(o[m]===c&&(o[m]=[...c]),o[m][1]=Number(c[1])),f+=1}});let s=r?ne(o,{progressFn:c=>{a=10+Math.floor(c/10),a!==i&&(i=a,r(a))}}):ne(o),n=(s==null?void 0:s.length)||0;if(s&&n>0){let c=e.slice(s[n-1][1]);e=s.reduce((m,b,y,u)=>{r&&(a=20+Math.floor(y/n*80),a!==i&&(i=a,r(a)));let x=y===0?0:u[y-1][1],w=u[y][0];return"".concat(m).concat(e.slice(x,w)).concat(u[y][2]||"")},""),e+=c}return e}function Z(e,t=1){let r="\xA0";function a(o){return Array.from(o).reverse().join("")}function i(o,l,f){let s=f?"\n":"\r",n=f?"\r":"\n";if(!o)return o;let c=0,m=0,b="";for(let y=0,u=o.length;y<u;y++)(o[y]===s||o[y]===n&&o[y-1]!==s)&&m++,"\r\n".includes(o[y])||o[y]===r?(c=0,o[y]===r?b+=o[y]:o[y]===s?m<=l&&(b+=o[y],o[y+1]===n&&(b+=o[y+1],y++)):o[y]===n&&(o==null?void 0:o[y-1])!==s&&m<=l&&(b+=o[y])):(c++,!o[y+1]&&!m&&(b+=" "));return b}if(typeof e=="string"&&e.length){let o=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(o=+t);let l="",f="";if(!e.trim())l=e;else if(!e[0].trim()){for(let s=0,n=e.length;s<n;s++)if(e[s].trim()){l=e.slice(0,s);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===r)){for(let s=e.length;s--;)if(e[s].trim()){f=e.slice(s+1);break}}return"".concat(i(l,o,!1)).concat(e.trim()).concat(a(i(a(f),o,!0)))}return e}var $o={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ao(e,t){function r(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}if(!Array.isArray(e)||!e.length)return null;if(t&&!r(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(g(t,4)," (type ").concat(typeof t,")"));let a=T(T({},$o),t);if(a.progressFn&&r(a.progressFn)&&!Object.keys(a.progressFn).length)a.progressFn=null;else if(a.progressFn&&typeof a.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 a.progressFn,'", equal to ').concat(g(a.progressFn,4)));if(![1,2,"1","2"].includes(a.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 a.mergeType,'", equal to ').concat(g(a.mergeType,4)));if(typeof a.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 a.joinRangesThatTouchEdges,'", equal to ').concat(g(a.joinRangesThatTouchEdges,4)));let i=e.filter(n=>Array.isArray(n)).map(n=>[...n]).filter(n=>n[2]!==void 0||n[0]!==n[1]),o,l,f;a.progressFn?o=W(i,{progressFn:n=>{f=Math.floor(n/5),f!==l&&(l=f,a.progressFn!=null&&a.progressFn(f))}}):o=W(i);let s=o.length-1;for(let n=s;n>0;n--)a.progressFn&&(f=Math.floor((1-n/s)*78)+21,f!==l&&f>l&&(l=f,a.progressFn(f))),(o[n][0]<=o[n-1][0]||!a.joinRangesThatTouchEdges&&o[n][0]<o[n-1][1]||a.joinRangesThatTouchEdges&&o[n][0]<=o[n-1][1])&&(o[n-1][0]=Math.min(o[n][0],o[n-1][0]),o[n-1][1]=Math.max(o[n][1],o[n-1][1]),o[n][2]!==void 0&&(o[n-1][0]>=o[n][0]||o[n-1][1]<=o[n][1])&&o[n-1][2]!==null&&(o[n][2]===null&&o[n-1][2]!==null?o[n-1][2]=null:o[n-1][2]!=null?+a.mergeType==2&&o[n-1][0]===o[n][0]?o[n-1][2]=o[n][2]:o[n-1][2]+=o[n][2]:o[n-1][2]=o[n][2]),o.splice(n,1),n=o.length);return o.length?o:null}var So={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1};function dt(e){return e[2]===void 0&&e[0]===e[1]}function Ro(e){let t=-1;for(let r=0,a=e.length;r<a;r++){let i=e[r];if(Array.isArray(i)){if(i[0]<t)return!1;t=i[0]}}return!0}var ct=class{constructor(e){V(this,"ranges");V(this,"opts");V(this,"sorted");if(e!=null&&!de(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(g(e,4)," (type ").concat(typeof e,")."));let t=T(T({},So),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(k(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(k(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(g(t.mergeType,4)));this.opts=t,this.ranges=[],this.sorted=!0}add(e,t,r){var o;if(e==null&&t==null)return;if(I(e)&&!I(t)){if(Array.isArray(e)){if(e.length){if(e.some(l=>Array.isArray(l))){e.forEach(l=>{Array.isArray(l)&&this.add(...l)});return}e.length&&D(+e[0])&&D(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_03] the first input argument, "from" is set ('.concat(g(e),') but second-one, "to" is not (').concat(g(t),")"))}else if(!I(e)&&I(t))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_04] the second input argument, "to" is set ('.concat(g(t),') but first-one, "from" is not (').concat(g(e),")"));let a=+e,i=+t;if(D(a)&&D(i)){if(I(r)&&!k(r)&&!ce(r))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 r,", equal to:\n").concat(g(r,4)));if(I(this.ranges)&&Array.isArray(this.last())&&a===this.last()[1]){if(this.last()[1]=i,this.last()[2],this.last()[2]!==null&&I(r)){let l=this.last()[2]&&this.last()[2].length&&(!((o=this.opts)!=null&&o.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(r):r;this.opts.limitToBeAddedWhitespace&&(l=Z(l,this.opts.limitLinebreaksCount)),k(l)&&!l.length||(this.last()[2]=l)}}else{this.ranges||(this.ranges=[]);let l=this.last();l&&a<l[0]&&(this.sorted=!1);let f=r!==void 0&&!(k(r)&&!r.length)?[a,i,r&&this.opts.limitToBeAddedWhitespace?Z(r,this.opts.limitLinebreaksCount):r]:[a,i];this.ranges.push(f)}}else throw D(a)?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(g(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(g(e,4)))}push(e,t,r){this.add(e,t,r)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Ao(this.ranges,{mergeType:this.opts.mergeType}),this.sorted=!0,this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>I(e[2])?[e[0],e[1],Z(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}firstCovers(e){if(!D(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(g(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=null;if(this.sorted){for(let a=0,i=this.ranges.length;a<i;a++){let o=this.ranges[a];if(!(!Array.isArray(o)||dt(o))){if(t===null){if(o[0]!==0)return!1;t=o[1]}else{if(o[0]>t)break;o[1]>t&&(t=o[1])}if(t>=e)return!0}}return t!==null&&t>=e}let r=!0;for(;r;){r=!1;for(let a=0,i=this.ranges.length;a<i;a++){let o=this.ranges[a];if(!(!Array.isArray(o)||dt(o))){if(o[0]<0)return!1;(t===null?o[0]===0:o[0]<=t&&o[1]>t)&&(t=o[1],r=!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])&&D(e[0][0]))this.ranges=Array.from(e),this.sorted=Ro(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(g(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 Oo={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function _(e,t){let r=!0,a=[".",",","'"," "],i;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(g(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(g(t,4)));let o=T(T({},Oo),t),l=ae(e.trim(),'"');if(l==="")return l;if(+e>0&&+e<1)return e;let f=new ct;for(let s=0,n=l.length;s<n;s++){if(o.removeThousandSeparatorsFromNumbers&&l[s].trim()===""&&f.add(s,s+1),o.removeThousandSeparatorsFromNumbers&&l[s]==="'"&&(f.add(s,s+1),l[s+1]==="'")){r=!1;break}if(a.includes(l[s])){if(l[s+1]!==void 0&&/^\d$/.test(l[s+1]))if(l[s+2]!==void 0)if(/^\d$/.test(l[s+2]))if(l[s+3]!==void 0)if(/^\d$/.test(l[s+3])){if(l[s+4]!==void 0&&/^\d$/.test(l[s+4])){r=!1;break}else if(o.removeThousandSeparatorsFromNumbers&&f.add(s,s+1),!i)i=l[s];else if(l[s]!==i){r=!1;break}}else{r=!1;break}else o.removeThousandSeparatorsFromNumbers&&o.forceUKStyle&&l[s]===","&&f.add(s,s+1,".");else{r=!1;break}else o.forceUKStyle&&l[s]===","&&f.add(s,s+1,"."),o.padSingleDecimalPlaceNumbers&&f.add(s+2,s+2,"0")}else if(!/^\d$/.test(l[s])){r=!1;break}}return r&&f.current()?mt(l,f.current()):l}var Io={delimiter:",",removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function Co(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Do(e,t){let r=0,a=e.length;for(;r<a&&e[r]!==t&&e[r].trim()==="";)r+=1;for(;a>r&&e[a-1]!==t&&e[a-1].trim()==="";)a-=1;return e.slice(r,a)}function gt(e,t){let r=0,a=0,i=[],o=[],l=!1,f=!0;if(t&&!Co(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(g(t,4)));let s=T(T({},Io),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(g(e,4)));if(typeof s.delimiter!="string"||s.delimiter.length!==1||s.delimiter==='"'||s.delimiter==="\n"||s.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 s.delimiter,", equal to: ").concat(g(s.delimiter)));if(e==="")return[[""]];e=Do(e,s.delimiter);for(let n=0,c=e.length;n<c;n++){if(f&&e[n]!=='"'&&e[n]!==s.delimiter&&e[n].trim()!==""&&(f=!1),e[n]==='"')if(l&&e[n+1]==='"')n+=1;else if(l){l=!1;let m=e.slice(r,n);m.trim()!==""&&(f=!1);let b=/""/.test(m)?m.replace(/""/g,'"'):_(m,{removeThousandSeparatorsFromNumbers:s.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:s.padSingleDecimalPlaceNumbers,forceUKStyle:s.forceUKStyle});i.push(b)}else l=!0,r=n+1;else if(!l&&e[n]===s.delimiter){if(e[n-1]!=='"'&&!l){let m=e.slice(r,n);m.trim()!==""&&(f=!1),i.push(_(m,{removeThousandSeparatorsFromNumbers:s.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:s.padSingleDecimalPlaceNumbers,forceUKStyle:s.forceUKStyle}))}r=n+1,a&&(a=0)}else if(e[n]==="\n"||e[n]==="\r"){if(!a){if(a=n,!l&&e[n-1]!=='"'){let m=e.slice(r,n);m.trim()!==""&&(f=!1),i.push(_(m,{removeThousandSeparatorsFromNumbers:s.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:s.padSingleDecimalPlaceNumbers,forceUKStyle:s.forceUKStyle}))}f?i.length=0:o.push(i),f=!0,i=[]}r=n+1}else a&&(a=0,r=n);if(n+1===c){if(e[n]!=='"'){let m=e.slice(r,n+1);m.trim()&&(f=!1),i.push(_(m,{removeThousandSeparatorsFromNumbers:s.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:s.padSingleDecimalPlaceNumbers,forceUKStyle:s.forceUKStyle}))}f?i=[]:o.push(i),f=!0}}return o.length===0?[[""]]:o}var N=Rt(ht(),1);var yt="7.2.1";function Y(e){return typeof e=="number"&&!Number.isNaN(e)?!0:(e=(e||"").toString().trim(),e?!Number.isNaN(+e):!1)}var ko=["\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 B(e){return Y(e)||ko.some(t=>Y(e.replace(t,"").replace(/[,.]/g,"")))?"numeric":e.trim()?"text":"empty"}var jo=yt;function Wo(e){let t=null,r=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(g(e,4)));if(!e.trim())return{res:[[""]],msgContent:t,msgType:r};let a=gt(e),i=[],o=!1,l=!0,f=[],s=null;for(let d=a.length-1;d>=0;d--)if(i.length){d===0&&(o=a[d].every(h=>{let v=B(h);return v==="text"||v==="empty"})),!o&&i.length!==a[d].length&&(l=!1);let p=null;for(let h=0,v=a[d].length;h<v;h++){let $=B(a[d][h].trim());if(p===null&&$==="empty"&&(p=h),p!==null&&$!=="empty"&&(p=null),$!==i[h]&&!o){let A=$;if(Array.isArray(i[h]))i[h].includes(A)||i[h].push(A);else if(i[h]!==A){let S=i[h];i[h]=[],i[h].push(S),i[h].push(A)}}}s!==null&&p!==null&&p>s&&(!o||o&&d!==0)&&(s=p)}else if(a[d].length!==1||a[d][0]!=="")for(let p=0,h=a[d].length;p<h;p++){let v=B(a[d][p].trim());i.push(v),s===null&&v==="empty"&&(s=p),s!==null&&v!=="empty"&&(s=null)}s||(s=i.length);let n=0;for(let d=0,p=i.length;d<p&&i[d]==="empty";d++)n=d;n!==0&&(a=a.map(d=>d.slice(n+1,s)),i=i.slice(n+1,s));let c=[],m;i.forEach((d,p)=>{d==="numeric"&&c.push(p)});let b=o?1:0;if(c.length===1)m=c[0];else{if(c.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 d=Array.from(c),p=[];for(let h=0,v=d.length;h<v;h++){let $=d[h],A,S=!0,E,O=!0;for(let R=b,xt=a.length;R<xt&&(S&&(A==null?A=a[R][$]:A===a[R][$]?(p.push($),S=!1):A=a[R][$]),O&&(E==null?E=a[R][$]:a[R][$]!==E&&(O=!1)),!!S);R++);O&&f.push($)}if(d=G(d,...p),d.length===1)m=d[0];else if(d.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(!m)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 y=G(Array.from(i.reduce((d,p,h)=>((typeof p=="string"&&p==="numeric"||Array.isArray(p)&&p.includes("numeric"))&&d.push(h),d),[])),m,...f),u=[];u.push(a[a.length-1].slice(0,s));let x=[],w=o?1:0;for(let d=a.length-2;d>=w;d--)for(let p=a.length-2;p>=w;p--)if(!x.includes(p)){let h=!1;for(let v=0,$=y.length;v<$;v++){let A=null;a[p][y[v]]!==""&&(A=(0,N.default)(a[p][y[v]]));let S=null;a[p][m]!==""&&(S=(0,N.default)(a[p][m]));let E=null;u[0][m]!==""&&(E=(0,N.default)(u[0][m]).format());let O=null;u[u.length-1][y[v]]!==""&&(O=(0,N.default)(u[u.length-1][y[v]]).format());let R=null;if(u[u.length-1][m]!==""&&(R=(0,N.default)(u[u.length-1][m])),A&&S.add(A).format()===E){u.unshift(a[p].slice(0,s)),x.push(p),h=!0;break}else if(A&&S.subtract(A).format()===E){u.unshift(a[p].slice(0,s)),x.push(p),h=!0;break}else if(O&&R.add(O).format()===S.format()){u.push(a[p].slice(0,s)),x.push(p),h=!0;break}else if(O&&R.subtract(O).format()===S.format()){u.push(a[p].slice(0,s)),x.push(p),h=!0;break}}if(h){h=!1;break}}return o&&(l&&a[0].length>i.length&&(a[0].length=i.length),u.unshift(a[0].slice(0,s))),a.length-(o?2:1)!==x.length&&(t="Not all rows were recognised!",r="alert"),{res:u,msgContent:t,msgType:r}}return Ot(No);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-utils
|
|
13
13
|
* @fileoverview Various utility functions
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* @name ranges-merge
|
|
29
29
|
* @fileoverview Merge and sort string index ranges
|
|
30
|
-
* @version 9.2.
|
|
30
|
+
* @version 9.2.1
|
|
31
31
|
* @author Roy Revelt
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/ranges-merge/}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
/**
|
|
36
36
|
* @name ranges-apply
|
|
37
37
|
* @fileoverview Take an array of string index ranges, delete/replace the string according to them
|
|
38
|
-
* @version 7.2.
|
|
38
|
+
* @version 7.2.1
|
|
39
39
|
* @author Roy Revelt
|
|
40
40
|
* @license MIT
|
|
41
41
|
* {@link https://codsen.com/os/ranges-apply/}
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
/**
|
|
60
60
|
* @name string-remove-thousand-separators
|
|
61
61
|
* @fileoverview Detects and removes thousand separators (dot/comma/quote/space) from string-type digits
|
|
62
|
-
* @version 7.2.
|
|
62
|
+
* @version 7.2.1
|
|
63
63
|
* @author Roy Revelt
|
|
64
64
|
* @license MIT
|
|
65
65
|
* {@link https://codsen.com/os/string-remove-thousand-separators/}
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
/**
|
|
68
68
|
* @name csv-split-easy
|
|
69
69
|
* @fileoverview Splits the CSV string into array of arrays, each representing a row of columns
|
|
70
|
-
* @version 7.2.
|
|
70
|
+
* @version 7.2.1
|
|
71
71
|
* @author Roy Revelt
|
|
72
72
|
* @license MIT
|
|
73
73
|
* {@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.
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "Sort double-entry bookkeeping CSV from internet banking",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accountancy",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"codsen-utils": "^1.8.0",
|
|
78
|
-
"csv-split-easy": "^7.2.
|
|
78
|
+
"csv-split-easy": "^7.2.1",
|
|
79
79
|
"currency.js": "^2.0.4",
|
|
80
80
|
"lodash-es": "^4.18.1"
|
|
81
81
|
},
|