csv-sort 7.0.9 → 7.0.10

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.
@@ -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.0.9
4
+ * @version 7.0.10
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/csv-sort/}
8
8
  */
9
9
 
10
- import{pull as B}from"lodash-es";import{splitEasy as O}from"csv-split-easy";import R from"currency.js";function E(i){return typeof i=="number"&&!isNaN(i)?!0:(i=(i||"").toString().trim(),i?!isNaN(+i):!1)}var N=["\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(i){return E(i)||N.some(b=>E(i.replace(b,"").replace(/[,.]/g,"")))?"numeric":i.trim()?"text":"empty"}var T="7.0.9";var K=T;function _(i){let b=null,C=null;if(typeof i!="string")throw new TypeError(`csv-sort/csvSort(): [THROW_ID_01] The input is of a wrong type! We accept either string of array of arrays. We got instead: ${typeof i}, equal to:
10
+ import{pull as B}from"lodash-es";import{splitEasy as O}from"csv-split-easy";import R from"currency.js";function E(i){return typeof i=="number"&&!isNaN(i)?!0:(i=(i||"").toString().trim(),i?!isNaN(+i):!1)}var N=["\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(i){return E(i)||N.some(b=>E(i.replace(b,"").replace(/[,.]/g,"")))?"numeric":i.trim()?"text":"empty"}var T="7.0.10";var K=T;function _(i){let b=null,C=null;if(typeof i!="string")throw new TypeError(`csv-sort/csvSort(): [THROW_ID_01] The input is of a wrong type! We accept either string of array of arrays. We got instead: ${typeof i}, equal to:
11
11
  ${JSON.stringify(i,null,4)}`);if(!i.trim())return{res:[[""]],msgContent:b,msgType:C};let n=O(i),s=[],d=!1,S=!0,v=[],o=null;for(let t=n.length-1;t>=0;t--)if(s.length){t===0&&(d=n[t].every(l=>f(l)==="text"||f(l)==="empty")),!d&&s.length!==n[t].length&&(S=!1);let e=null;for(let l=0,p=n[t].length;l<p;l++)if(e===null&&f(n[t][l].trim())==="empty"&&(e=l),e!==null&&f(n[t][l].trim())!=="empty"&&(e=null),f(n[t][l].trim())!==s[l]&&!d){let a=f(n[t][l].trim());if(Array.isArray(s[l]))s[l].includes(a)||s[l].push(f(n[t][l].trim()));else if(s[l]!==a){let u=s[l];s[l]=[],s[l].push(u),s[l].push(a)}}o!==null&&e!==null&&e>o&&(!d||d&&t!==0)&&(o=e)}else if(n[t].length!==1||n[t][0]!=="")for(let e=0,l=n[t].length;e<l;e++)s.push(f(n[t][e].trim())),o===null&&f(n[t][e].trim())==="empty"&&(o=e),o!==null&&f(n[t][e].trim())!=="empty"&&(o=null);o||(o=s.length);let w=0;for(let t=0,e=s.length;t<e&&s[t]==="empty";t++)w=t;w!==0&&(n=n.map(t=>t.slice(w+1,o)),s=s.slice(w+1,o));let V=[],m;s.forEach((t,e)=>{t==="numeric"&&V.push(e)});let k=d?1:0;if(V.length===1)m=V[0];else{if(V.length===0)throw new Error('csv-sort/csvSort(): [THROW_ID_03] Your CSV file does not contain numeric-only columns and computer was not able to detect the "Balance" column!');{let t=Array.from(V),e=[];for(let l=0,p=t.length;l<p;l++){let a=t[l],u,g=!0,$,h=!0;for(let c=k,I=n.length;c<I&&(g&&(u==null?u=n[c][a]:u===n[c][a]?(e.push(a),g=!1):u=n[c][a]),h&&($==null?$=n[c][a]:n[c][a]!==$&&(h=!1)),!!g);c++);h&&v.push(a)}if(t=B(t,...e),t.length===1)m=t[0];else if(t.length===0)throw new Error(`csv-sort/csvSort(): [THROW_ID_04] 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/csvSort(): [THROW_ID_05] Sadly computer couldn't find its way in this CSV and had to stop working on it.");let D=B(Array.from(s.reduce((t,e,l)=>((typeof e=="string"&&e==="numeric"||Array.isArray(e)&&e.includes("numeric"))&&t.push(l),t),[])),m,...v),r=[];r.push(n[n.length-1].slice(0,o));let y=[],x=d?1:0;for(let t=n.length-2;t>=x;t--)for(let e=n.length-2;e>=x;e--)if(!y.includes(e)){let l=!1;for(let p=0,a=D.length;p<a;p++){let u=null;n[e][D[p]]!==""&&(u=R(n[e][D[p]]));let g=null;n[e][m]!==""&&(g=R(n[e][m]));let $=null;r[0][m]!==""&&($=R(r[0][m]).format());let h=null;r[r.length-1][D[p]]!==""&&(h=R(r[r.length-1][D[p]]).format());let c=null;if(r[r.length-1][m]!==""&&(c=R(r[r.length-1][m])),u&&g.add(u).format()===$){r.unshift(n[e].slice(0,o)),y.push(e),l=!0;break}else if(u&&g.subtract(u).format()===$){r.unshift(n[e].slice(0,o)),y.push(e),l=!0;break}else if(h&&c.add(h).format()===g.format()){r.push(n[e].slice(0,o)),y.push(e),l=!0;break}else if(h&&c.subtract(h).format()===g.format()){r.push(n[e].slice(0,o)),y.push(e),l=!0;break}}if(l){l=!1;break}}return d&&(S&&n[0].length>s.length&&(n[0].length=s.length),r.unshift(n[0].slice(0,o))),n.length-(d?2:1)!==y.length&&(b="Not all rows were recognised!",C="alert"),{res:r,msgContent:b,msgType:C}}export{f as findType,E as isNumeric,_ as sort,K as version};
@@ -1,24 +1,24 @@
1
1
  /**
2
2
  * @name csv-sort
3
3
  * @fileoverview Sort double-entry bookkeeping CSV from internet banking
4
- * @version 7.0.9
4
+ * @version 7.0.10
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/csv-sort/}
8
8
  */
9
9
 
10
- "use strict";var csvSort=(()=>{var gr=Object.create;var k=Object.defineProperty;var hr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames,se=Object.getOwnPropertySymbols,yr=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty,br=Object.prototype.propertyIsEnumerable;var G=(e,r,a)=>r in e?k(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,y=(e,r)=>{for(var a in r||(r={}))ne.call(r,a)&&G(e,a,r[a]);if(se)for(var a of se(r))br.call(r,a)&&G(e,a,r[a]);return e};var vr=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Tr=(e,r)=>{for(var a in r)k(e,a,{get:r[a],enumerable:!0})},le=(e,r,a,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let f of xr(r))!ne.call(e,f)&&f!==a&&k(e,f,{get:()=>r[f],enumerable:!(o=hr(r,f))||o.enumerable});return e};var wr=(e,r,a)=>(a=e!=null?gr(yr(e)):{},le(r||!e||!e.__esModule?k(a,"default",{value:e,enumerable:!0}):a,e)),Sr=e=>le(k({},"__esModule",{value:!0}),e);var Q=(e,r,a)=>(G(e,typeof r!="symbol"?r+"":r,a),a);var mr=vr((oe,ae)=>{(function(e,r){typeof oe=="object"&&typeof ae<"u"?ae.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self,e.currency=r())})(oe,function(){function e(t,n){if(!(this instanceof e))return new e(t,n);n=Object.assign({},a,n);var i=Math.pow(10,n.precision);this.intValue=t=r(t,n),this.value=t/i,n.increment=n.increment||1/i,n.groups=n.useVedic?f:o,this.s=n,this.p=i}function r(t,n){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,l=n.decimal,s=n.errorOnInvalid,u=n.fromCents,p=Math.pow(10,n.precision),h=t instanceof e;if(h&&u)return t.intValue;if(typeof t=="number"||h)l=h?t.value:t;else if(typeof t=="string")s=new RegExp("[^-\\d"+l+"]","g"),l=new RegExp("\\"+l,"g"),l=(l=t.replace(/\((.*)\)/,"-$1").replace(s,"").replace(l,"."))||0;else{if(s)throw Error("Invalid Input");l=0}return u||(l=(l*p).toFixed(4)),i?Math.round(l):l}var a={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(t,n){var i=n.pattern,l=n.negativePattern,s=n.symbol,u=n.separator,p=n.decimal;n=n.groups;var h=(""+t).replace(/^-/,"").split("."),g=h[0];return h=h[1],(0<=t.value?i:l).replace("!",s).replace("#",g.replace(n,"$1"+u)+(h?p+h:""))},fromCents:!1},o=/(\d)(?=(\d{3})+\b)/g,f=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(t){var n=this.s,i=this.p;return e((this.intValue+r(t,n))/(n.fromCents?1:i),n)},subtract:function(t){var n=this.s,i=this.p;return e((this.intValue-r(t,n))/(n.fromCents?1:i),n)},multiply:function(t){var n=this.s;return e(this.intValue*t/(n.fromCents?1:Math.pow(10,n.precision)),n)},divide:function(t){var n=this.s;return e(this.intValue/r(t,n,!1),n)},distribute:function(t){var n=this.intValue,i=this.p,l=this.s,s=[],u=Math[0<=n?"floor":"ceil"](n/t),p=Math.abs(n-u*t);for(i=l.fromCents?1:i;t!==0;t--){var h=e(u/i,l);0<p--&&(h=h[0<=n?"add":"subtract"](1/i)),s.push(h)}return s},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(t){var n=this.s;return typeof t=="function"?t(this,n):n.format(this,Object.assign({},n,t))},toString:function(){var t=this.s,n=t.increment;return(Math.round(this.intValue/this.p/n)*n).toFixed(t.precision)},toJSON:function(){return this.value}},e})});var $o={};Tr($o,{findType:()=>T,isNumeric:()=>z,sort:()=>So,version:()=>wo});var $r=typeof global=="object"&&global&&global.Object===Object&&global,fe=$r;var Or=typeof self=="object"&&self&&self.Object===Object&&self,Rr=fe||Or||Function("return this")(),B=Rr;var Ar=B.Symbol,R=Ar;var ie=Object.prototype,Ir=ie.hasOwnProperty,Er=ie.toString,W=R?R.toStringTag:void 0;function Nr(e){var r=Ir.call(e,W),a=e[W];try{e[W]=void 0;var o=!0}catch(t){}var f=Er.call(e);return o&&(r?e[W]=a:delete e[W]),f}var ue=Nr;var Dr=Object.prototype,Cr=Dr.toString;function jr(e){return Cr.call(e)}var pe=jr;var Fr="[object Null]",kr="[object Undefined]",me=R?R.toStringTag:void 0;function Wr(e){return e==null?e===void 0?kr:Fr:me&&me in Object(e)?ue(e):pe(e)}var M=Wr;function Vr(e){return e!=null&&typeof e=="object"}var de=Vr;var _r="[object Symbol]";function Br(e){return typeof e=="symbol"||de(e)&&M(e)==_r}var ce=Br;function Mr(e,r){for(var a=-1,o=e==null?0:e.length,f=Array(o);++a<o;)f[a]=r(e[a],a,e);return f}var P=Mr;var Pr=Array.isArray,ge=Pr;var Jr=1/0,he=R?R.prototype:void 0,xe=he?he.toString:void 0;function ye(e){if(typeof e=="string")return e;if(ge(e))return P(e,ye)+"";if(ce(e))return xe?xe.call(e):"";var r=e+"";return r=="0"&&1/e==-Jr?"-0":r}var J=ye;var Hr=/\s/;function Lr(e){for(var r=e.length;r--&&Hr.test(e.charAt(r)););return r}var be=Lr;var qr=/^\s+/;function Ur(e){return e&&e.slice(0,be(e)+1).replace(qr,"")}var ve=Ur;function Kr(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var H=Kr;function zr(e){return e}var L=zr;var Gr="[object AsyncFunction]",Qr="[object Function]",Zr="[object GeneratorFunction]",Yr="[object Proxy]";function Xr(e){if(!H(e))return!1;var r=M(e);return r==Qr||r==Zr||r==Gr||r==Yr}var Te=Xr;var et=B["__core-js_shared__"],q=et;var we=function(){var e=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function rt(e){return!!we&&we in e}var Se=rt;var tt=Function.prototype,ot=tt.toString;function at(e){if(e!=null){try{return ot.call(e)}catch(r){}try{return e+""}catch(r){}}return""}var $e=at;var st=/[\\^$.*+?()[\]{}|]/g,nt=/^\[object .+?Constructor\]$/,lt=Function.prototype,ft=Object.prototype,it=lt.toString,ut=ft.hasOwnProperty,pt=RegExp("^"+it.call(ut).replace(st,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mt(e){if(!H(e)||Se(e))return!1;var r=Te(e)?pt:nt;return r.test($e(e))}var Oe=mt;function dt(e,r){return e==null?void 0:e[r]}var Re=dt;function ct(e,r){var a=Re(e,r);return Oe(a)?a:void 0}var Ae=ct;function gt(e,r,a){switch(a.length){case 0:return e.call(r);case 1:return e.call(r,a[0]);case 2:return e.call(r,a[0],a[1]);case 3:return e.call(r,a[0],a[1],a[2])}return e.apply(r,a)}var Ie=gt;function ht(e,r){var a=-1,o=e.length;for(r||(r=Array(o));++a<o;)r[a]=e[a];return r}var Ee=ht;var xt=800,yt=16,bt=Date.now;function vt(e){var r=0,a=0;return function(){var o=bt(),f=yt-(o-a);if(a=o,f>0){if(++r>=xt)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}var Ne=vt;function Tt(e){return function(){return e}}var De=Tt;var wt=function(){try{var e=Ae(Object,"defineProperty");return e({},"",{}),e}catch(r){}}(),Z=wt;var St=Z?function(e,r){return Z(e,"toString",{configurable:!0,enumerable:!1,value:De(r),writable:!0})}:L,Ce=St;var $t=Ne(Ce),je=$t;function Ot(e,r,a,o){for(var f=e.length,t=a+(o?1:-1);o?t--:++t<f;)if(r(e[t],t,e))return t;return-1}var Fe=Ot;function Rt(e){return e!==e}var ke=Rt;function At(e,r,a){for(var o=a-1,f=e.length;++o<f;)if(e[o]===r)return o;return-1}var We=At;function It(e,r,a){return r===r?We(e,r,a):Fe(e,ke,a)}var D=It;var Ve=Math.max;function Et(e,r,a){return r=Ve(r===void 0?e.length-1:r,0),function(){for(var o=arguments,f=-1,t=Ve(o.length-r,0),n=Array(t);++f<t;)n[f]=o[r+f];f=-1;for(var i=Array(r+1);++f<r;)i[f]=o[f];return i[r]=a(n),Ie(e,this,i)}}var _e=Et;function Nt(e,r){return je(_e(e,r,L),e+"")}var Be=Nt;function Dt(e){return function(r){return e(r)}}var Me=Dt;function Ct(e){return e==null?"":J(e)}var Pe=Ct;function jt(e,r,a){var o=-1,f=e.length;r<0&&(r=-r>f?0:f+r),a=a>f?f:a,a<0&&(a+=f),f=r>a?0:a-r>>>0,r>>>=0;for(var t=Array(f);++o<f;)t[o]=e[o+r];return t}var Je=jt;function Ft(e,r,a){var o=e.length;return a=a===void 0?o:a,!r&&a>=o?e:Je(e,r,a)}var He=Ft;var kt="\\ud800-\\udfff",Wt="\\u0300-\\u036f",Vt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",Bt=Wt+Vt+_t,Mt="\\ufe0e\\ufe0f",Pt="\\u200d",Jt=RegExp("["+Pt+kt+Bt+Mt+"]");function Ht(e){return Jt.test(e)}var Le=Ht;function Lt(e){return e.split("")}var qe=Lt;var Ue="\\ud800-\\udfff",qt="\\u0300-\\u036f",Ut="\\ufe20-\\ufe2f",Kt="\\u20d0-\\u20ff",zt=qt+Ut+Kt,Gt="\\ufe0e\\ufe0f",Qt="["+Ue+"]",Y="["+zt+"]",X="\\ud83c[\\udffb-\\udfff]",Zt="(?:"+Y+"|"+X+")",Ke="[^"+Ue+"]",ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Ge="[\\ud800-\\udbff][\\udc00-\\udfff]",Yt="\\u200d",Qe=Zt+"?",Ze="["+Gt+"]?",Xt="(?:"+Yt+"(?:"+[Ke,ze,Ge].join("|")+")"+Ze+Qe+")*",eo=Ze+Qe+Xt,ro="(?:"+[Ke+Y+"?",Y,ze,Ge,Qt].join("|")+")",to=RegExp(X+"(?="+X+")|"+ro+eo,"g");function oo(e){return e.match(to)||[]}var Ye=oo;function ao(e){return Le(e)?Ye(e):qe(e)}var ee=ao;function so(e,r,a,o){for(var f=a-1,t=e.length;++f<t;)if(o(e[f],r))return f;return-1}var Xe=so;var no=Array.prototype,er=no.splice;function lo(e,r,a,o){var f=o?Xe:D,t=-1,n=r.length,i=e;for(e===r&&(r=Ee(r)),a&&(i=P(e,Me(a)));++t<n;)for(var l=0,s=r[t],u=a?a(s):s;(l=f(i,u,l,o))>-1;)i!==e&&er.call(i,l,1),er.call(e,l,1);return e}var rr=lo;function fo(e,r){return e&&e.length&&r&&r.length?rr(e,r):e}var tr=fo;var io=Be(tr),U=io;function uo(e,r){for(var a=e.length;a--&&D(r,e[a],0)>-1;);return a}var or=uo;function po(e,r){for(var a=-1,o=e.length;++a<o&&D(r,e[a],0)>-1;);return a}var ar=po;function mo(e,r,a){if(e=Pe(e),e&&(a||r===void 0))return ve(e);if(!e||!(r=J(r)))return e;var o=ee(e),f=ee(r),t=ar(o,f),n=or(o,f)+1;return He(o,t,n).join("")}var re=mo;var co={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function C(e,r){if(!Array.isArray(e)||!e.length)return e;let a=y(y({},co),r),o,f;if(a.strictlyTwoElementsInRangeArrays&&!e.every((i,l)=>!Array.isArray(i)||i.length!==2?(o=l,f=i.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${o}th range (${JSON.stringify(e[o],null,4)}) has not two but ${f} elements!`);if(!e.every((i,l)=>!Array.isArray(i)||!Number.isInteger(i[0])||i[0]<0||!Number.isInteger(i[1])||i[1]<0?(o=l,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${o}th range (${JSON.stringify(e[o],null,4)}) does not consist of only natural numbers!`);let t=e.length**2,n=0;return Array.from(e).sort((i,l)=>(a.progressFn&&(n+=1,a.progressFn(Math.floor(n*100/t))),i[0]===l[0]?i[1]<l[1]?-1:i[1]>l[1]?1:0:i[0]<l[0]?-1:1))}var sr={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function nr(e,r){function a(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let o;if(r)if(a(r)){if(o=y(y({},sr),r),o.progressFn&&a(o.progressFn)&&!Object.keys(o.progressFn).length)o.progressFn=null;else if(o.progressFn&&typeof o.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof o.progressFn}", equal to ${JSON.stringify(o.progressFn,null,4)}`);if(![1,2,"1","2"].includes(o.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);if(typeof o.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof o.joinRangesThatTouchEdges}", equal to ${JSON.stringify(o.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
11
- ${JSON.stringify(r,null,4)} (type ${typeof r})`);else o=y({},sr);let f=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),t,n,i;o.progressFn?t=C(f,{progressFn:s=>{i=Math.floor(s/5),i!==n&&(n=i,o.progressFn(i))}}):t=C(f);let l=t.length-1;for(let s=l;s>0;s--)o.progressFn&&(i=Math.floor((1-s/l)*78)+21,i!==n&&i>n&&(n=i,o.progressFn(i))),(t[s][0]<=t[s-1][0]||!o.joinRangesThatTouchEdges&&t[s][0]<t[s-1][1]||o.joinRangesThatTouchEdges&&t[s][0]<=t[s-1][1])&&(t[s-1][0]=Math.min(t[s][0],t[s-1][0]),t[s-1][1]=Math.max(t[s][1],t[s-1][1]),t[s][2]!==void 0&&(t[s-1][0]>=t[s][0]||t[s-1][1]<=t[s][1])&&t[s-1][2]!==null&&(t[s][2]===null&&t[s-1][2]!==null?t[s-1][2]=null:t[s-1][2]!=null?+o.mergeType==2&&t[s-1][0]===t[s][0]?t[s-1][2]=t[s][2]:t[s-1][2]+=t[s][2]:t[s-1][2]=t[s][2]),t.splice(s,1),s=t.length);return t.length?t:null}var go=!0,te="Invariant failed";function lr(e,r){if(!e){if(go)throw new Error(te);var a=typeof r=="function"?r():r,o=a?"".concat(te,": ").concat(a):te;throw new Error(o)}}function fr(e,r,a){let o=0,f=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(r&&!Array.isArray(r))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(a&&typeof a!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof a}, equal to: ${JSON.stringify(a,null,4)}`);if(!(r!=null&&r.filter(u=>u).length))return e;let t;Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?t=[Array.from(r)]:t=Array.from(r);let n=t.length,i=0;t.filter(u=>u).forEach((u,p)=>{if(a&&(o=Math.floor(i/n*10),o!==f&&(f=o,a(o))),!Array.isArray(u))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${p}th element not an array: ${JSON.stringify(u,null,4)}, which is ${typeof u}`);if(!Number.isInteger(u[0])){if(!Number.isInteger(+u[0])||+u[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(u,null,0)}. Its first element is not an integer, string index, but ${typeof u[0]}, equal to: ${JSON.stringify(u[0],null,4)}.`);t[p][0]=+t[p][0]}if(!Number.isInteger(u[1])){if(!Number.isInteger(+u[1])||+u[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(u,null,0)}. Its second element is not an integer, string index, but ${typeof u[1]}, equal to: ${JSON.stringify(u[1],null,4)}.`);t[p][1]=+t[p][1]}i+=1});let l=nr(t,{progressFn:u=>{a&&(o=10+Math.floor(u/10),o!==f&&(f=o,a(o)))}});lr(l);let s=l.length;if(s>0){let u=e.slice(l[s-1][1]);e=l.reduce((p,h,g,x)=>{a&&(o=20+Math.floor(g/s*80),o!==f&&(f=o,a(o)));let E=g===0?0:x[g-1][1],_=x[g][0];return`${p}${e.slice(E,_)}${x[g][2]||""}`},""),e+=u}return e}function K(e,r=1){let a="\xA0";function o(t){return Array.from(t).reverse().join("")}function f(t,n,i){let l=i?`
12
- `:"\r",s=i?"\r":`
13
- `;if(!t)return t;let u=0,p=0,h="";for(let g=0,x=t.length;g<x;g++)(t[g]===l||t[g]===s&&t[g-1]!==l)&&p++,`\r
14
- `.includes(t[g])||t[g]===a?(u=0,t[g]===a?h+=t[g]:t[g]===l?p<=n&&(h+=t[g],t[g+1]===s&&(h+=t[g+1],g++)):t[g]===s&&(t==null?void 0:t[g-1])!==l&&p<=n&&(h+=t[g])):(u++,!t[g+1]&&!p&&(h+=" "));return h}if(typeof e=="string"&&e.length){let t=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(t=+r);let n="",i="";if(!e.trim())n=e;else if(!e[0].trim()){for(let l=0,s=e.length;l<s;l++)if(e[l].trim()){n=e.slice(0,l);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===a)){for(let l=e.length;l--;)if(e[l].trim()){i=e.slice(l+1);break}}return`${f(n,t,!1)}${e.trim()}${o(f(o(i),t,!0))}`}return e}function j(e){return typeof e=="string"}function A(e){return Number.isSafeInteger(e)&&e>=0}function I(e){return e!=null}var ir={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function ho(e,r){function a(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let o;if(r)if(a(r)){if(o=y(y({},ir),r),o.progressFn&&a(o.progressFn)&&!Object.keys(o.progressFn).length)o.progressFn=null;else if(o.progressFn&&typeof o.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof o.progressFn}", equal to ${JSON.stringify(o.progressFn,null,4)}`);if(![1,2,"1","2"].includes(o.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);if(typeof o.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof o.joinRangesThatTouchEdges}", equal to ${JSON.stringify(o.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
15
- ${JSON.stringify(r,null,4)} (type ${typeof r})`);else o=y({},ir);let f=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),t,n,i;o.progressFn?t=C(f,{progressFn:s=>{i=Math.floor(s/5),i!==n&&(n=i,o.progressFn(i))}}):t=C(f);let l=t.length-1;for(let s=l;s>0;s--)o.progressFn&&(i=Math.floor((1-s/l)*78)+21,i!==n&&i>n&&(n=i,o.progressFn(i))),(t[s][0]<=t[s-1][0]||!o.joinRangesThatTouchEdges&&t[s][0]<t[s-1][1]||o.joinRangesThatTouchEdges&&t[s][0]<=t[s-1][1])&&(t[s-1][0]=Math.min(t[s][0],t[s-1][0]),t[s-1][1]=Math.max(t[s][1],t[s-1][1]),t[s][2]!==void 0&&(t[s-1][0]>=t[s][0]||t[s-1][1]<=t[s][1])&&t[s-1][2]!==null&&(t[s][2]===null&&t[s-1][2]!==null?t[s-1][2]=null:t[s-1][2]!=null?+o.mergeType==2&&t[s-1][0]===t[s][0]?t[s-1][2]=t[s][2]:t[s-1][2]+=t[s][2]:t[s-1][2]=t[s][2]),t.splice(s,1),s=t.length);return t.length?t:null}var xo={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},ur=class{constructor(e){Q(this,"ranges");Q(this,"opts");let r=y(y({},xo),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(j(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(j(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof r.mergeType}", equal to ${JSON.stringify(r.mergeType,null,4)}`);this.opts=r,this.ranges=[]}add(e,r,a){var t;if(e==null&&r==null)return;if(I(e)&&!I(r)){if(Array.isArray(e)){if(e.length){if(e.some(n=>Array.isArray(n))){e.forEach(n=>{Array.isArray(n)&&this.add(...n)});return}e.length&&A(+e[0])&&A(+e[1])&&this.add(...e)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e,null,0)}) but second-one, "to" is not (${JSON.stringify(r,null,0)})`)}else if(!I(e)&&I(r))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(r,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let o=+e,f=+r;if(A(a)&&(a=String(a)),A(o)&&A(f)){if(I(a)&&!j(a)&&!A(a))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof a}, equal to:
16
- ${JSON.stringify(a,null,4)}`);if(I(this.ranges)&&Array.isArray(this.last())&&o===this.last()[1]){if(this.last()[1]=f,this.last()[2],this.last()[2]!==null&&I(a)){let n=this.last()[2]&&this.last()[2].length&&(!((t=this.opts)!=null&&t.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${a}`:a;this.opts.limitToBeAddedWhitespace&&(n=K(n,this.opts.limitLinebreaksCount)),j(n)&&!n.length||(this.last()[2]=n)}}else{this.ranges||(this.ranges=[]);let n=a!==void 0&&!(j(a)&&!a.length)?[o,f,a&&this.opts.limitToBeAddedWhitespace?K(a,this.opts.limitLinebreaksCount):a]:[o,f];this.ranges.push(n)}}else throw A(o)&&o>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof f}" equal to: ${JSON.stringify(f,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof o}" equal to: ${JSON.stringify(o,null,4)}`)}push(e,r,a){this.add(e,r,a)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=ho(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>I(e[2])?[e[0],e[1],K(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&A(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var yo={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function V(e,r){let a=!0,o=[".",",","'"," "],f;if(typeof e!="string")throw new TypeError(`string-remove-thousand-separators/remSep(): [THROW_ID_01] Input must be string! Currently it's: ${typeof e}, equal to:
10
+ "use strict";var csvSort=(()=>{var wr=Object.create;var W=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames,se=Object.getOwnPropertySymbols,$r=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable;var Q=(e,r,s)=>r in e?W(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,x=(e,r)=>{for(var s in r||(r={}))fe.call(r,s)&&Q(e,s,r[s]);if(se)for(var s of se(r))Ar.call(r,s)&&Q(e,s,r[s]);return e};var le=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Or=(e,r)=>{for(var s in r)W(e,s,{get:r[s],enumerable:!0})},ie=(e,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let f of Tr(r))!fe.call(e,f)&&f!==s&&W(e,f,{get:()=>r[f],enumerable:!(o=Sr(r,f))||o.enumerable});return e};var ue=(e,r,s)=>(s=e!=null?wr($r(e)):{},ie(r||!e||!e.__esModule?W(s,"default",{value:e,enumerable:!0}):s,e)),Rr=e=>ie(W({},"__esModule",{value:!0}),e);var Z=(e,r,s)=>(Q(e,typeof r!="symbol"?r+"":r,s),s);var dr=le((Un,mr)=>{"use strict";mr.exports=vo;function j(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function vo(e){if(e=e||{},e.circles)return wo(e);return e.proto?o:s;function r(f,t){for(var n=Object.keys(f),l=new Array(n.length),i=0;i<n.length;i++){var a=n[i],u=f[a];typeof u!="object"||u===null?l[a]=u:u instanceof Date?l[a]=new Date(u):ArrayBuffer.isView(u)?l[a]=j(u):l[a]=t(u)}return l}function s(f){if(typeof f!="object"||f===null)return f;if(f instanceof Date)return new Date(f);if(Array.isArray(f))return r(f,s);if(f instanceof Map)return new Map(r(Array.from(f),s));if(f instanceof Set)return new Set(r(Array.from(f),s));var t={};for(var n in f)if(Object.hasOwnProperty.call(f,n)!==!1){var l=f[n];typeof l!="object"||l===null?t[n]=l:l instanceof Date?t[n]=new Date(l):l instanceof Map?t[n]=new Map(r(Array.from(l),s)):l instanceof Set?t[n]=new Set(r(Array.from(l),s)):ArrayBuffer.isView(l)?t[n]=j(l):t[n]=s(l)}return t}function o(f){if(typeof f!="object"||f===null)return f;if(f instanceof Date)return new Date(f);if(Array.isArray(f))return r(f,o);if(f instanceof Map)return new Map(r(Array.from(f),o));if(f instanceof Set)return new Set(r(Array.from(f),o));var t={};for(var n in f){var l=f[n];typeof l!="object"||l===null?t[n]=l:l instanceof Date?t[n]=new Date(l):l instanceof Map?t[n]=new Map(r(Array.from(l),o)):l instanceof Set?t[n]=new Set(r(Array.from(l),o)):ArrayBuffer.isView(l)?t[n]=j(l):t[n]=o(l)}return t}}function wo(e){var r=[],s=[];return e.proto?t:f;function o(n,l){for(var i=Object.keys(n),a=new Array(i.length),u=0;u<i.length;u++){var p=i[u],c=n[p];if(typeof c!="object"||c===null)a[p]=c;else if(c instanceof Date)a[p]=new Date(c);else if(ArrayBuffer.isView(c))a[p]=j(c);else{var g=r.indexOf(c);g!==-1?a[p]=s[g]:a[p]=l(c)}}return a}function f(n){if(typeof n!="object"||n===null)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return o(n,f);if(n instanceof Map)return new Map(o(Array.from(n),f));if(n instanceof Set)return new Set(o(Array.from(n),f));var l={};r.push(n),s.push(l);for(var i in n)if(Object.hasOwnProperty.call(n,i)!==!1){var a=n[i];if(typeof a!="object"||a===null)l[i]=a;else if(a instanceof Date)l[i]=new Date(a);else if(a instanceof Map)l[i]=new Map(o(Array.from(a),f));else if(a instanceof Set)l[i]=new Set(o(Array.from(a),f));else if(ArrayBuffer.isView(a))l[i]=j(a);else{var u=r.indexOf(a);u!==-1?l[i]=s[u]:l[i]=f(a)}}return r.pop(),s.pop(),l}function t(n){if(typeof n!="object"||n===null)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return o(n,t);if(n instanceof Map)return new Map(o(Array.from(n),t));if(n instanceof Set)return new Set(o(Array.from(n),t));var l={};r.push(n),s.push(l);for(var i in n){var a=n[i];if(typeof a!="object"||a===null)l[i]=a;else if(a instanceof Date)l[i]=new Date(a);else if(a instanceof Map)l[i]=new Map(o(Array.from(a),t));else if(a instanceof Set)l[i]=new Set(o(Array.from(a),t));else if(ArrayBuffer.isView(a))l[i]=j(a);else{var u=r.indexOf(a);u!==-1?l[i]=s[u]:l[i]=t(a)}}return r.pop(),s.pop(),l}}});var xr=le((ae,ne)=>{(function(e,r){typeof ae=="object"&&typeof ne<"u"?ne.exports=r():typeof define=="function"&&define.amd?define(r):(e=e||self,e.currency=r())})(ae,function(){function e(t,n){if(!(this instanceof e))return new e(t,n);n=Object.assign({},s,n);var l=Math.pow(10,n.precision);this.intValue=t=r(t,n),this.value=t/l,n.increment=n.increment||1/l,n.groups=n.useVedic?f:o,this.s=n,this.p=l}function r(t,n){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,i=n.decimal,a=n.errorOnInvalid,u=n.fromCents,p=Math.pow(10,n.precision),c=t instanceof e;if(c&&u)return t.intValue;if(typeof t=="number"||c)i=c?t.value:t;else if(typeof t=="string")a=new RegExp("[^-\\d"+i+"]","g"),i=new RegExp("\\"+i,"g"),i=(i=t.replace(/\((.*)\)/,"-$1").replace(a,"").replace(i,"."))||0;else{if(a)throw Error("Invalid Input");i=0}return u||(i=(i*p).toFixed(4)),l?Math.round(i):i}var s={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(t,n){var l=n.pattern,i=n.negativePattern,a=n.symbol,u=n.separator,p=n.decimal;n=n.groups;var c=(""+t).replace(/^-/,"").split("."),g=c[0];return c=c[1],(0<=t.value?l:i).replace("!",a).replace("#",g.replace(n,"$1"+u)+(c?p+c:""))},fromCents:!1},o=/(\d)(?=(\d{3})+\b)/g,f=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(t){var n=this.s,l=this.p;return e((this.intValue+r(t,n))/(n.fromCents?1:l),n)},subtract:function(t){var n=this.s,l=this.p;return e((this.intValue-r(t,n))/(n.fromCents?1:l),n)},multiply:function(t){var n=this.s;return e(this.intValue*t/(n.fromCents?1:Math.pow(10,n.precision)),n)},divide:function(t){var n=this.s;return e(this.intValue/r(t,n,!1),n)},distribute:function(t){var n=this.intValue,l=this.p,i=this.s,a=[],u=Math[0<=n?"floor":"ceil"](n/t),p=Math.abs(n-u*t);for(l=i.fromCents?1:l;t!==0;t--){var c=e(u/l,i);0<p--&&(c=c[0<=n?"add":"subtract"](1/l)),a.push(c)}return a},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(t){var n=this.s;return typeof t=="function"?t(this,n):n.format(this,Object.assign({},n,t))},toString:function(){var t=this.s,n=t.increment;return(Math.round(this.intValue/this.p/n)*n).toFixed(t.precision)},toJSON:function(){return this.value}},e})});var Eo={};Or(Eo,{findType:()=>w,isNumeric:()=>G,sort:()=>Io,version:()=>Do});var Dr=typeof global=="object"&&global&&global.Object===Object&&global,pe=Dr;var Ir=typeof self=="object"&&self&&self.Object===Object&&self,Er=pe||Ir||Function("return this")(),P=Er;var Nr=P.Symbol,O=Nr;var me=Object.prototype,Cr=me.hasOwnProperty,jr=me.toString,B=O?O.toStringTag:void 0;function Fr(e){var r=Cr.call(e,B),s=e[B];try{e[B]=void 0;var o=!0}catch(t){}var f=jr.call(e);return o&&(r?e[B]=s:delete e[B]),f}var de=Fr;var Vr=Object.prototype,Wr=Vr.toString;function Br(e){return Wr.call(e)}var ce=Br;var _r="[object Null]",Mr="[object Undefined]",ge=O?O.toStringTag:void 0;function Pr(e){return e==null?e===void 0?Mr:_r:ge&&ge in Object(e)?de(e):ce(e)}var J=Pr;function Jr(e){return e!=null&&typeof e=="object"}var he=Jr;var kr="[object Symbol]";function Hr(e){return typeof e=="symbol"||he(e)&&J(e)==kr}var ye=Hr;function Lr(e,r){for(var s=-1,o=e==null?0:e.length,f=Array(o);++s<o;)f[s]=r(e[s],s,e);return f}var k=Lr;var qr=Array.isArray,xe=qr;var Ur=1/0,be=O?O.prototype:void 0,ve=be?be.toString:void 0;function we(e){if(typeof e=="string")return e;if(xe(e))return k(e,we)+"";if(ye(e))return ve?ve.call(e):"";var r=e+"";return r=="0"&&1/e==-Ur?"-0":r}var H=we;var Kr=/\s/;function zr(e){for(var r=e.length;r--&&Kr.test(e.charAt(r)););return r}var Se=zr;var Gr=/^\s+/;function Qr(e){return e&&e.slice(0,Se(e)+1).replace(Gr,"")}var Te=Qr;function Zr(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var L=Zr;function Yr(e){return e}var q=Yr;var Xr="[object AsyncFunction]",et="[object Function]",rt="[object GeneratorFunction]",tt="[object Proxy]";function ot(e){if(!L(e))return!1;var r=J(e);return r==et||r==rt||r==Xr||r==tt}var $e=ot;var at=P["__core-js_shared__"],U=at;var Ae=function(){var e=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function nt(e){return!!Ae&&Ae in e}var Oe=nt;var st=Function.prototype,ft=st.toString;function lt(e){if(e!=null){try{return ft.call(e)}catch(r){}try{return e+""}catch(r){}}return""}var Re=lt;var it=/[\\^$.*+?()[\]{}|]/g,ut=/^\[object .+?Constructor\]$/,pt=Function.prototype,mt=Object.prototype,dt=pt.toString,ct=mt.hasOwnProperty,gt=RegExp("^"+dt.call(ct).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ht(e){if(!L(e)||Oe(e))return!1;var r=$e(e)?gt:ut;return r.test(Re(e))}var De=ht;function yt(e,r){return e==null?void 0:e[r]}var Ie=yt;function xt(e,r){var s=Ie(e,r);return De(s)?s:void 0}var Ee=xt;function bt(e,r,s){switch(s.length){case 0:return e.call(r);case 1:return e.call(r,s[0]);case 2:return e.call(r,s[0],s[1]);case 3:return e.call(r,s[0],s[1],s[2])}return e.apply(r,s)}var Ne=bt;function vt(e,r){var s=-1,o=e.length;for(r||(r=Array(o));++s<o;)r[s]=e[s];return r}var Ce=vt;var wt=800,St=16,Tt=Date.now;function $t(e){var r=0,s=0;return function(){var o=Tt(),f=St-(o-s);if(s=o,f>0){if(++r>=wt)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}var je=$t;function At(e){return function(){return e}}var Fe=At;var Ot=function(){try{var e=Ee(Object,"defineProperty");return e({},"",{}),e}catch(r){}}(),Y=Ot;var Rt=Y?function(e,r){return Y(e,"toString",{configurable:!0,enumerable:!1,value:Fe(r),writable:!0})}:q,Ve=Rt;var Dt=je(Ve),We=Dt;function It(e,r,s,o){for(var f=e.length,t=s+(o?1:-1);o?t--:++t<f;)if(r(e[t],t,e))return t;return-1}var Be=It;function Et(e){return e!==e}var _e=Et;function Nt(e,r,s){for(var o=s-1,f=e.length;++o<f;)if(e[o]===r)return o;return-1}var Me=Nt;function Ct(e,r,s){return r===r?Me(e,r,s):Be(e,_e,s)}var N=Ct;var Pe=Math.max;function jt(e,r,s){return r=Pe(r===void 0?e.length-1:r,0),function(){for(var o=arguments,f=-1,t=Pe(o.length-r,0),n=Array(t);++f<t;)n[f]=o[r+f];f=-1;for(var l=Array(r+1);++f<r;)l[f]=o[f];return l[r]=s(n),Ne(e,this,l)}}var Je=jt;function Ft(e,r){return We(Je(e,r,q),e+"")}var ke=Ft;function Vt(e){return function(r){return e(r)}}var He=Vt;function Wt(e){return e==null?"":H(e)}var Le=Wt;function Bt(e,r,s){var o=-1,f=e.length;r<0&&(r=-r>f?0:f+r),s=s>f?f:s,s<0&&(s+=f),f=r>s?0:s-r>>>0,r>>>=0;for(var t=Array(f);++o<f;)t[o]=e[o+r];return t}var qe=Bt;function _t(e,r,s){var o=e.length;return s=s===void 0?o:s,!r&&s>=o?e:qe(e,r,s)}var Ue=_t;var Mt="\\ud800-\\udfff",Pt="\\u0300-\\u036f",Jt="\\ufe20-\\ufe2f",kt="\\u20d0-\\u20ff",Ht=Pt+Jt+kt,Lt="\\ufe0e\\ufe0f",qt="\\u200d",Ut=RegExp("["+qt+Mt+Ht+Lt+"]");function Kt(e){return Ut.test(e)}var Ke=Kt;function zt(e){return e.split("")}var ze=zt;var Ge="\\ud800-\\udfff",Gt="\\u0300-\\u036f",Qt="\\ufe20-\\ufe2f",Zt="\\u20d0-\\u20ff",Yt=Gt+Qt+Zt,Xt="\\ufe0e\\ufe0f",eo="["+Ge+"]",X="["+Yt+"]",ee="\\ud83c[\\udffb-\\udfff]",ro="(?:"+X+"|"+ee+")",Qe="[^"+Ge+"]",Ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Ye="[\\ud800-\\udbff][\\udc00-\\udfff]",to="\\u200d",Xe=ro+"?",er="["+Xt+"]?",oo="(?:"+to+"(?:"+[Qe,Ze,Ye].join("|")+")"+er+Xe+")*",ao=er+Xe+oo,no="(?:"+[Qe+X+"?",X,Ze,Ye,eo].join("|")+")",so=RegExp(ee+"(?="+ee+")|"+no+ao,"g");function fo(e){return e.match(so)||[]}var rr=fo;function lo(e){return Ke(e)?rr(e):ze(e)}var re=lo;function io(e,r,s,o){for(var f=s-1,t=e.length;++f<t;)if(o(e[f],r))return f;return-1}var tr=io;var uo=Array.prototype,or=uo.splice;function po(e,r,s,o){var f=o?tr:N,t=-1,n=r.length,l=e;for(e===r&&(r=Ce(r)),s&&(l=k(e,He(s)));++t<n;)for(var i=0,a=r[t],u=s?s(a):a;(i=f(l,u,i,o))>-1;)l!==e&&or.call(l,i,1),or.call(e,i,1);return e}var ar=po;function mo(e,r){return e&&e.length&&r&&r.length?ar(e,r):e}var nr=mo;var co=ke(nr),K=co;function go(e,r){for(var s=e.length;s--&&N(r,e[s],0)>-1;);return s}var sr=go;function ho(e,r){for(var s=-1,o=e.length;++s<o&&N(r,e[s],0)>-1;);return s}var fr=ho;function yo(e,r,s){if(e=Le(e),e&&(s||r===void 0))return Te(e);if(!e||!(r=H(r)))return e;var o=re(e),f=re(r),t=fr(o,f),n=sr(o,f)+1;return Ue(o,t,n).join("")}var te=yo;var xo={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function C(e,r){if(!Array.isArray(e)||!e.length)return e;let s=x(x({},xo),r),o,f;if(s.strictlyTwoElementsInRangeArrays&&!e.every((l,i)=>!Array.isArray(l)||l.length!==2?(o=i,f=l.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${o}th range (${JSON.stringify(e[o],null,4)}) has not two but ${f} elements!`);if(!e.every((l,i)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(o=i,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${o}th range (${JSON.stringify(e[o],null,4)}) does not consist of only natural numbers!`);let t=e.length**2,n=0;return Array.from(e).sort((l,i)=>(s.progressFn&&(n+=1,s.progressFn(Math.floor(n*100/t))),l[0]===i[0]?l[1]<i[1]?-1:l[1]>i[1]?1:0:l[0]<i[0]?-1:1))}var lr={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function ir(e,r){function s(a){return!!a&&typeof a=="object"&&!Array.isArray(a)}if(!Array.isArray(e)||!e.length)return null;let o;if(r)if(s(r)){if(o=x(x({},lr),r),o.progressFn&&s(o.progressFn)&&!Object.keys(o.progressFn).length)o.progressFn=null;else if(o.progressFn&&typeof o.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof o.progressFn}", equal to ${JSON.stringify(o.progressFn,null,4)}`);if(![1,2,"1","2"].includes(o.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);if(typeof o.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof o.joinRangesThatTouchEdges}", equal to ${JSON.stringify(o.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
11
+ ${JSON.stringify(r,null,4)} (type ${typeof r})`);else o=x({},lr);let f=e.filter(a=>Array.isArray(a)).map(a=>[...a]).filter(a=>a[2]!==void 0||a[0]!==a[1]),t,n,l;o.progressFn?t=C(f,{progressFn:a=>{l=Math.floor(a/5),l!==n&&(n=l,o.progressFn(l))}}):t=C(f);let i=t.length-1;for(let a=i;a>0;a--)o.progressFn&&(l=Math.floor((1-a/i)*78)+21,l!==n&&l>n&&(n=l,o.progressFn(l))),(t[a][0]<=t[a-1][0]||!o.joinRangesThatTouchEdges&&t[a][0]<t[a-1][1]||o.joinRangesThatTouchEdges&&t[a][0]<=t[a-1][1])&&(t[a-1][0]=Math.min(t[a][0],t[a-1][0]),t[a-1][1]=Math.max(t[a][1],t[a-1][1]),t[a][2]!==void 0&&(t[a-1][0]>=t[a][0]||t[a-1][1]<=t[a][1])&&t[a-1][2]!==null&&(t[a][2]===null&&t[a-1][2]!==null?t[a-1][2]=null:t[a-1][2]!=null?+o.mergeType==2&&t[a-1][0]===t[a][0]?t[a-1][2]=t[a][2]:t[a-1][2]+=t[a][2]:t[a-1][2]=t[a][2]),t.splice(a,1),a=t.length);return t.length?t:null}var bo=!0,oe="Invariant failed";function ur(e,r){if(!e){if(bo)throw new Error(oe);var s=typeof r=="function"?r():r,o=s?"".concat(oe,": ").concat(s):oe;throw new Error(o)}}function pr(e,r,s){let o=0,f=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(r&&!Array.isArray(r))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(s&&typeof s!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof s}, equal to: ${JSON.stringify(s,null,4)}`);if(!(r!=null&&r.filter(u=>u).length))return e;let t;Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?t=[Array.from(r)]:t=Array.from(r);let n=t.length,l=0;t.filter(u=>u).forEach((u,p)=>{if(s&&(o=Math.floor(l/n*10),o!==f&&(f=o,s(o))),!Array.isArray(u))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${p}th element not an array: ${JSON.stringify(u,null,4)}, which is ${typeof u}`);if(!Number.isInteger(u[0])){if(!Number.isInteger(+u[0])||+u[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(u,null,0)}. Its first element is not an integer, string index, but ${typeof u[0]}, equal to: ${JSON.stringify(u[0],null,4)}.`);t[p][0]=+t[p][0]}if(!Number.isInteger(u[1])){if(!Number.isInteger(+u[1])||+u[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${p}th element, array ${JSON.stringify(u,null,0)}. Its second element is not an integer, string index, but ${typeof u[1]}, equal to: ${JSON.stringify(u[1],null,4)}.`);t[p][1]=+t[p][1]}l+=1});let i=ir(t,{progressFn:u=>{s&&(o=10+Math.floor(u/10),o!==f&&(f=o,s(o)))}});ur(i);let a=i.length;if(a>0){let u=e.slice(i[a-1][1]);e=i.reduce((p,c,g,y)=>{s&&(o=20+Math.floor(g/a*80),o!==f&&(f=o,s(o)));let I=g===0?0:y[g-1][1],M=y[g][0];return`${p}${e.slice(I,M)}${y[g][2]||""}`},""),e+=u}return e}function z(e,r=1){let s="\xA0";function o(t){return Array.from(t).reverse().join("")}function f(t,n,l){let i=l?`
12
+ `:"\r",a=l?"\r":`
13
+ `;if(!t)return t;let u=0,p=0,c="";for(let g=0,y=t.length;g<y;g++)(t[g]===i||t[g]===a&&t[g-1]!==i)&&p++,`\r
14
+ `.includes(t[g])||t[g]===s?(u=0,t[g]===s?c+=t[g]:t[g]===i?p<=n&&(c+=t[g],t[g+1]===a&&(c+=t[g+1],g++)):t[g]===a&&(t==null?void 0:t[g-1])!==i&&p<=n&&(c+=t[g])):(u++,!t[g+1]&&!p&&(c+=" "));return c}if(typeof e=="string"&&e.length){let t=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(t=+r);let n="",l="";if(!e.trim())n=e;else if(!e[0].trim()){for(let i=0,a=e.length;i<a;i++)if(e[i].trim()){n=e.slice(0,i);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===s)){for(let i=e.length;i--;)if(e[i].trim()){l=e.slice(i+1);break}}return`${f(n,t,!1)}${e.trim()}${o(f(o(l),t,!0))}`}return e}var cr=ue(dr(),1);var Kn=(0,cr.default)();function F(e){return typeof e=="string"}function R(e){return Number.isSafeInteger(e)&&e>=0}function D(e){return e!=null}var gr={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function So(e,r){function s(a){return!!a&&typeof a=="object"&&!Array.isArray(a)}if(!Array.isArray(e)||!e.length)return null;let o;if(r)if(s(r)){if(o=x(x({},gr),r),o.progressFn&&s(o.progressFn)&&!Object.keys(o.progressFn).length)o.progressFn=null;else if(o.progressFn&&typeof o.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof o.progressFn}", equal to ${JSON.stringify(o.progressFn,null,4)}`);if(![1,2,"1","2"].includes(o.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);if(typeof o.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof o.joinRangesThatTouchEdges}", equal to ${JSON.stringify(o.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
15
+ ${JSON.stringify(r,null,4)} (type ${typeof r})`);else o=x({},gr);let f=e.filter(a=>Array.isArray(a)).map(a=>[...a]).filter(a=>a[2]!==void 0||a[0]!==a[1]),t,n,l;o.progressFn?t=C(f,{progressFn:a=>{l=Math.floor(a/5),l!==n&&(n=l,o.progressFn(l))}}):t=C(f);let i=t.length-1;for(let a=i;a>0;a--)o.progressFn&&(l=Math.floor((1-a/i)*78)+21,l!==n&&l>n&&(n=l,o.progressFn(l))),(t[a][0]<=t[a-1][0]||!o.joinRangesThatTouchEdges&&t[a][0]<t[a-1][1]||o.joinRangesThatTouchEdges&&t[a][0]<=t[a-1][1])&&(t[a-1][0]=Math.min(t[a][0],t[a-1][0]),t[a-1][1]=Math.max(t[a][1],t[a-1][1]),t[a][2]!==void 0&&(t[a-1][0]>=t[a][0]||t[a-1][1]<=t[a][1])&&t[a-1][2]!==null&&(t[a][2]===null&&t[a-1][2]!==null?t[a-1][2]=null:t[a-1][2]!=null?+o.mergeType==2&&t[a-1][0]===t[a][0]?t[a-1][2]=t[a][2]:t[a-1][2]+=t[a][2]:t[a-1][2]=t[a][2]),t.splice(a,1),a=t.length);return t.length?t:null}var To={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},hr=class{constructor(e){Z(this,"ranges");Z(this,"opts");let r=x(x({},To),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(F(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(F(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof r.mergeType}", equal to ${JSON.stringify(r.mergeType,null,4)}`);this.opts=r,this.ranges=[]}add(e,r,s){var t;if(e==null&&r==null)return;if(D(e)&&!D(r)){if(Array.isArray(e)){if(e.length){if(e.some(n=>Array.isArray(n))){e.forEach(n=>{Array.isArray(n)&&this.add(...n)});return}e.length&&R(+e[0])&&R(+e[1])&&this.add(...e)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e,null,0)}) but second-one, "to" is not (${JSON.stringify(r,null,0)})`)}else if(!D(e)&&D(r))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(r,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let o=+e,f=+r;if(R(s)&&(s=String(s)),R(o)&&R(f)){if(D(s)&&!F(s)&&!R(s))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof s}, equal to:
16
+ ${JSON.stringify(s,null,4)}`);if(D(this.ranges)&&Array.isArray(this.last())&&o===this.last()[1]){if(this.last()[1]=f,this.last()[2],this.last()[2]!==null&&D(s)){let n=this.last()[2]&&this.last()[2].length&&(!((t=this.opts)!=null&&t.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${s}`:s;this.opts.limitToBeAddedWhitespace&&(n=z(n,this.opts.limitLinebreaksCount)),F(n)&&!n.length||(this.last()[2]=n)}}else{this.ranges||(this.ranges=[]);let n=s!==void 0&&!(F(s)&&!s.length)?[o,f,s&&this.opts.limitToBeAddedWhitespace?z(s,this.opts.limitLinebreaksCount):s]:[o,f];this.ranges.push(n)}}else throw R(o)&&o>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof f}" equal to: ${JSON.stringify(f,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof o}" equal to: ${JSON.stringify(o,null,4)}`)}push(e,r,s){this.add(e,r,s)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=So(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>D(e[2])?[e[0],e[1],z(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&R(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var $o={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function _(e,r){let s=!0,o=[".",",","'"," "],f;if(typeof e!="string")throw new TypeError(`string-remove-thousand-separators/remSep(): [THROW_ID_01] Input must be string! Currently it's: ${typeof e}, equal to:
17
17
  ${JSON.stringify(e,null,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: ${typeof r}, equal to:
18
- ${JSON.stringify(r,null,4)}`);let t=y(y({},yo),r),n=re(e.trim(),'"');if(n==="")return n;if(+e>0&&+e<1)return e;let i=new ur;for(let l=0,s=n.length;l<s;l++){if(t.removeThousandSeparatorsFromNumbers&&n[l].trim()===""&&i.add(l,l+1),t.removeThousandSeparatorsFromNumbers&&n[l]==="'"&&(i.add(l,l+1),n[l+1]==="'")){a=!1;break}if(o.includes(n[l])){if(n[l+1]!==void 0&&/^\d$/.test(n[l+1]))if(n[l+2]!==void 0)if(/^\d$/.test(n[l+2]))if(n[l+3]!==void 0)if(/^\d$/.test(n[l+3])){if(n[l+4]!==void 0&&/^\d$/.test(n[l+4])){a=!1;break}else if(t.removeThousandSeparatorsFromNumbers&&i.add(l,l+1),!f)f=n[l];else if(n[l]!==f){a=!1;break}}else{a=!1;break}else t.removeThousandSeparatorsFromNumbers&&t.forceUKStyle&&n[l]===","&&i.add(l,l+1,".");else{a=!1;break}else t.forceUKStyle&&n[l]===","&&i.add(l,l+1,"."),t.padSingleDecimalPlaceNumbers&&i.add(l+2,l+2,"0")}else if(!/^\d$/.test(n[l])){a=!1;break}}return a&&i.current()?fr(n,i.current()):n}var bo={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function pr(e,r){let a=0,o=0,f=[],t=[],n=!1,i=!0;if(r&&typeof r!="object")throw new Error(`csv-split-easy/split(): [THROW_ID_02] Options object must be a plain object! Currently it's of a type ${typeof r} equal to:
19
- ${JSON.stringify(r,null,4)}`);let l=y(y({},bo),r);if(typeof e!="string")throw new TypeError(`csv-split-easy/split(): [THROW_ID_04] input must be string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(e==="")return[[""]];e=e.trim();for(let s=0,u=e.length;s<u;s++){if(i&&e[s]!=='"'&&e[s]!==","&&e[s].trim()!==""&&(i=!1),e[s]==='"')if(n&&e[s+1]==='"')s+=1;else if(n){n=!1;let p=e.slice(a,s);p.trim()!==""&&(i=!1);let h=/""/.test(p)?p.replace(/""/g,'"'):V(p,{removeThousandSeparatorsFromNumbers:l.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:l.padSingleDecimalPlaceNumbers,forceUKStyle:l.forceUKStyle});f.push(h)}else n=!0,a=s+1;else if(!n&&e[s]===","){if(e[s-1]!=='"'&&!n){let p=e.slice(a,s);p.trim()!==""&&(i=!1),f.push(V(p,{removeThousandSeparatorsFromNumbers:l.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:l.padSingleDecimalPlaceNumbers,forceUKStyle:l.forceUKStyle}))}a=s+1,o&&(o=0)}else if(e[s]===`
20
- `||e[s]==="\r"){if(!o){if(o=s,!n&&e[s-1]!=='"'){let p=e.slice(a,s);p.trim()!==""&&(i=!1),f.push(V(p,{removeThousandSeparatorsFromNumbers:l.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:l.padSingleDecimalPlaceNumbers,forceUKStyle:l.forceUKStyle}))}i?f.length=0:t.push(f),i=!0,f=[]}a=s+1}else o&&(o=0,a=s);if(s+1===u){if(e[s]!=='"'){let p=e.slice(a,s+1);p.trim()&&(i=!1),f.push(V(p,{removeThousandSeparatorsFromNumbers:l.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:l.padSingleDecimalPlaceNumbers,forceUKStyle:l.forceUKStyle}))}i?f=[]:t.push(f),i=!0}}return t.length===0?[[""]]:t}var F=wr(mr(),1);function z(e){return typeof e=="number"&&!isNaN(e)?!0:(e=(e||"").toString().trim(),e?!isNaN(+e):!1)}var vo=["\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 T(e){return z(e)||vo.some(r=>z(e.replace(r,"").replace(/[,.]/g,"")))?"numeric":e.trim()?"text":"empty"}var dr="7.0.9";var wo=dr;function So(e){let r=null,a=null;if(typeof e!="string")throw new TypeError(`csv-sort/csvSort(): [THROW_ID_01] The input is of a wrong type! We accept either string of array of arrays. We got instead: ${typeof e}, equal to:
21
- ${JSON.stringify(e,null,4)}`);if(!e.trim())return{res:[[""]],msgContent:r,msgType:a};let o=pr(e),f=[],t=!1,n=!0,i=[],l=null;for(let d=o.length-1;d>=0;d--)if(f.length){d===0&&(t=o[d].every(c=>T(c)==="text"||T(c)==="empty")),!t&&f.length!==o[d].length&&(n=!1);let m=null;for(let c=0,S=o[d].length;c<S;c++)if(m===null&&T(o[d][c].trim())==="empty"&&(m=c),m!==null&&T(o[d][c].trim())!=="empty"&&(m=null),T(o[d][c].trim())!==f[c]&&!t){let b=T(o[d][c].trim());if(Array.isArray(f[c]))f[c].includes(b)||f[c].push(T(o[d][c].trim()));else if(f[c]!==b){let v=f[c];f[c]=[],f[c].push(v),f[c].push(b)}}l!==null&&m!==null&&m>l&&(!t||t&&d!==0)&&(l=m)}else if(o[d].length!==1||o[d][0]!=="")for(let m=0,c=o[d].length;m<c;m++)f.push(T(o[d][m].trim())),l===null&&T(o[d][m].trim())==="empty"&&(l=m),l!==null&&T(o[d][m].trim())!=="empty"&&(l=null);l||(l=f.length);let s=0;for(let d=0,m=f.length;d<m&&f[d]==="empty";d++)s=d;s!==0&&(o=o.map(d=>d.slice(s+1,l)),f=f.slice(s+1,l));let u=[],p;f.forEach((d,m)=>{d==="numeric"&&u.push(m)});let h=t?1:0;if(u.length===1)p=u[0];else{if(u.length===0)throw new Error('csv-sort/csvSort(): [THROW_ID_03] Your CSV file does not contain numeric-only columns and computer was not able to detect the "Balance" column!');{let d=Array.from(u),m=[];for(let c=0,S=d.length;c<S;c++){let b=d[c],v,$=!0,N,O=!0;for(let w=h,cr=o.length;w<cr&&($&&(v==null?v=o[w][b]:v===o[w][b]?(m.push(b),$=!1):v=o[w][b]),O&&(N==null?N=o[w][b]:o[w][b]!==N&&(O=!1)),!!$);w++);O&&i.push(b)}if(d=U(d,...m),d.length===1)p=d[0];else if(d.length===0)throw new Error(`csv-sort/csvSort(): [THROW_ID_04] 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/csvSort(): [THROW_ID_05] Sadly computer couldn't find its way in this CSV and had to stop working on it.");let g=U(Array.from(f.reduce((d,m,c)=>((typeof m=="string"&&m==="numeric"||Array.isArray(m)&&m.includes("numeric"))&&d.push(c),d),[])),p,...i),x=[];x.push(o[o.length-1].slice(0,l));let E=[],_=t?1:0;for(let d=o.length-2;d>=_;d--)for(let m=o.length-2;m>=_;m--)if(!E.includes(m)){let c=!1;for(let S=0,b=g.length;S<b;S++){let v=null;o[m][g[S]]!==""&&(v=(0,F.default)(o[m][g[S]]));let $=null;o[m][p]!==""&&($=(0,F.default)(o[m][p]));let N=null;x[0][p]!==""&&(N=(0,F.default)(x[0][p]).format());let O=null;x[x.length-1][g[S]]!==""&&(O=(0,F.default)(x[x.length-1][g[S]]).format());let w=null;if(x[x.length-1][p]!==""&&(w=(0,F.default)(x[x.length-1][p])),v&&$.add(v).format()===N){x.unshift(o[m].slice(0,l)),E.push(m),c=!0;break}else if(v&&$.subtract(v).format()===N){x.unshift(o[m].slice(0,l)),E.push(m),c=!0;break}else if(O&&w.add(O).format()===$.format()){x.push(o[m].slice(0,l)),E.push(m),c=!0;break}else if(O&&w.subtract(O).format()===$.format()){x.push(o[m].slice(0,l)),E.push(m),c=!0;break}}if(c){c=!1;break}}return t&&(n&&o[0].length>f.length&&(o[0].length=f.length),x.unshift(o[0].slice(0,l))),o.length-(t?2:1)!==E.length&&(r="Not all rows were recognised!",a="alert"),{res:x,msgContent:r,msgType:a}}return Sr($o);})();
18
+ ${JSON.stringify(r,null,4)}`);let t=x(x({},$o),r),n=te(e.trim(),'"');if(n==="")return n;if(+e>0&&+e<1)return e;let l=new hr;for(let i=0,a=n.length;i<a;i++){if(t.removeThousandSeparatorsFromNumbers&&n[i].trim()===""&&l.add(i,i+1),t.removeThousandSeparatorsFromNumbers&&n[i]==="'"&&(l.add(i,i+1),n[i+1]==="'")){s=!1;break}if(o.includes(n[i])){if(n[i+1]!==void 0&&/^\d$/.test(n[i+1]))if(n[i+2]!==void 0)if(/^\d$/.test(n[i+2]))if(n[i+3]!==void 0)if(/^\d$/.test(n[i+3])){if(n[i+4]!==void 0&&/^\d$/.test(n[i+4])){s=!1;break}else if(t.removeThousandSeparatorsFromNumbers&&l.add(i,i+1),!f)f=n[i];else if(n[i]!==f){s=!1;break}}else{s=!1;break}else t.removeThousandSeparatorsFromNumbers&&t.forceUKStyle&&n[i]===","&&l.add(i,i+1,".");else{s=!1;break}else t.forceUKStyle&&n[i]===","&&l.add(i,i+1,"."),t.padSingleDecimalPlaceNumbers&&l.add(i+2,i+2,"0")}else if(!/^\d$/.test(n[i])){s=!1;break}}return s&&l.current()?pr(n,l.current()):n}var Ao={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function yr(e,r){let s=0,o=0,f=[],t=[],n=!1,l=!0;if(r&&typeof r!="object")throw new Error(`csv-split-easy/split(): [THROW_ID_02] Options object must be a plain object! Currently it's of a type ${typeof r} equal to:
19
+ ${JSON.stringify(r,null,4)}`);let i=x(x({},Ao),r);if(typeof e!="string")throw new TypeError(`csv-split-easy/split(): [THROW_ID_04] input must be string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(e==="")return[[""]];e=e.trim();for(let a=0,u=e.length;a<u;a++){if(l&&e[a]!=='"'&&e[a]!==","&&e[a].trim()!==""&&(l=!1),e[a]==='"')if(n&&e[a+1]==='"')a+=1;else if(n){n=!1;let p=e.slice(s,a);p.trim()!==""&&(l=!1);let c=/""/.test(p)?p.replace(/""/g,'"'):_(p,{removeThousandSeparatorsFromNumbers:i.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:i.padSingleDecimalPlaceNumbers,forceUKStyle:i.forceUKStyle});f.push(c)}else n=!0,s=a+1;else if(!n&&e[a]===","){if(e[a-1]!=='"'&&!n){let p=e.slice(s,a);p.trim()!==""&&(l=!1),f.push(_(p,{removeThousandSeparatorsFromNumbers:i.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:i.padSingleDecimalPlaceNumbers,forceUKStyle:i.forceUKStyle}))}s=a+1,o&&(o=0)}else if(e[a]===`
20
+ `||e[a]==="\r"){if(!o){if(o=a,!n&&e[a-1]!=='"'){let p=e.slice(s,a);p.trim()!==""&&(l=!1),f.push(_(p,{removeThousandSeparatorsFromNumbers:i.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:i.padSingleDecimalPlaceNumbers,forceUKStyle:i.forceUKStyle}))}l?f.length=0:t.push(f),l=!0,f=[]}s=a+1}else o&&(o=0,s=a);if(a+1===u){if(e[a]!=='"'){let p=e.slice(s,a+1);p.trim()&&(l=!1),f.push(_(p,{removeThousandSeparatorsFromNumbers:i.removeThousandSeparatorsFromNumbers,padSingleDecimalPlaceNumbers:i.padSingleDecimalPlaceNumbers,forceUKStyle:i.forceUKStyle}))}l?f=[]:t.push(f),l=!0}}return t.length===0?[[""]]:t}var V=ue(xr(),1);function G(e){return typeof e=="number"&&!isNaN(e)?!0:(e=(e||"").toString().trim(),e?!isNaN(+e):!1)}var Oo=["\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 w(e){return G(e)||Oo.some(r=>G(e.replace(r,"").replace(/[,.]/g,"")))?"numeric":e.trim()?"text":"empty"}var br="7.0.10";var Do=br;function Io(e){let r=null,s=null;if(typeof e!="string")throw new TypeError(`csv-sort/csvSort(): [THROW_ID_01] The input is of a wrong type! We accept either string of array of arrays. We got instead: ${typeof e}, equal to:
21
+ ${JSON.stringify(e,null,4)}`);if(!e.trim())return{res:[[""]],msgContent:r,msgType:s};let o=yr(e),f=[],t=!1,n=!0,l=[],i=null;for(let d=o.length-1;d>=0;d--)if(f.length){d===0&&(t=o[d].every(h=>w(h)==="text"||w(h)==="empty")),!t&&f.length!==o[d].length&&(n=!1);let m=null;for(let h=0,T=o[d].length;h<T;h++)if(m===null&&w(o[d][h].trim())==="empty"&&(m=h),m!==null&&w(o[d][h].trim())!=="empty"&&(m=null),w(o[d][h].trim())!==f[h]&&!t){let b=w(o[d][h].trim());if(Array.isArray(f[h]))f[h].includes(b)||f[h].push(w(o[d][h].trim()));else if(f[h]!==b){let v=f[h];f[h]=[],f[h].push(v),f[h].push(b)}}i!==null&&m!==null&&m>i&&(!t||t&&d!==0)&&(i=m)}else if(o[d].length!==1||o[d][0]!=="")for(let m=0,h=o[d].length;m<h;m++)f.push(w(o[d][m].trim())),i===null&&w(o[d][m].trim())==="empty"&&(i=m),i!==null&&w(o[d][m].trim())!=="empty"&&(i=null);i||(i=f.length);let a=0;for(let d=0,m=f.length;d<m&&f[d]==="empty";d++)a=d;a!==0&&(o=o.map(d=>d.slice(a+1,i)),f=f.slice(a+1,i));let u=[],p;f.forEach((d,m)=>{d==="numeric"&&u.push(m)});let c=t?1:0;if(u.length===1)p=u[0];else{if(u.length===0)throw new Error('csv-sort/csvSort(): [THROW_ID_03] Your CSV file does not contain numeric-only columns and computer was not able to detect the "Balance" column!');{let d=Array.from(u),m=[];for(let h=0,T=d.length;h<T;h++){let b=d[h],v,$=!0,E,A=!0;for(let S=c,vr=o.length;S<vr&&($&&(v==null?v=o[S][b]:v===o[S][b]?(m.push(b),$=!1):v=o[S][b]),A&&(E==null?E=o[S][b]:o[S][b]!==E&&(A=!1)),!!$);S++);A&&l.push(b)}if(d=K(d,...m),d.length===1)p=d[0];else if(d.length===0)throw new Error(`csv-sort/csvSort(): [THROW_ID_04] 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/csvSort(): [THROW_ID_05] Sadly computer couldn't find its way in this CSV and had to stop working on it.");let g=K(Array.from(f.reduce((d,m,h)=>((typeof m=="string"&&m==="numeric"||Array.isArray(m)&&m.includes("numeric"))&&d.push(h),d),[])),p,...l),y=[];y.push(o[o.length-1].slice(0,i));let I=[],M=t?1:0;for(let d=o.length-2;d>=M;d--)for(let m=o.length-2;m>=M;m--)if(!I.includes(m)){let h=!1;for(let T=0,b=g.length;T<b;T++){let v=null;o[m][g[T]]!==""&&(v=(0,V.default)(o[m][g[T]]));let $=null;o[m][p]!==""&&($=(0,V.default)(o[m][p]));let E=null;y[0][p]!==""&&(E=(0,V.default)(y[0][p]).format());let A=null;y[y.length-1][g[T]]!==""&&(A=(0,V.default)(y[y.length-1][g[T]]).format());let S=null;if(y[y.length-1][p]!==""&&(S=(0,V.default)(y[y.length-1][p])),v&&$.add(v).format()===E){y.unshift(o[m].slice(0,i)),I.push(m),h=!0;break}else if(v&&$.subtract(v).format()===E){y.unshift(o[m].slice(0,i)),I.push(m),h=!0;break}else if(A&&S.add(A).format()===$.format()){y.push(o[m].slice(0,i)),I.push(m),h=!0;break}else if(A&&S.subtract(A).format()===$.format()){y.push(o[m].slice(0,i)),I.push(m),h=!0;break}}if(h){h=!1;break}}return t&&(n&&o[0].length>f.length&&(o[0].length=f.length),y.unshift(o[0].slice(0,i))),o.length-(t?2:1)!==I.length&&(r="Not all rows were recognised!",s="alert"),{res:y,msgContent:r,msgType:s}}return Rr(Eo);})();
22
22
  /**
23
23
  * @name ranges-sort
24
24
  * @fileoverview Sort string index ranges
@@ -30,7 +30,7 @@ ${JSON.stringify(e,null,4)}`);if(!e.trim())return{res:[[""]],msgContent:r,msgTyp
30
30
  /**
31
31
  * @name ranges-merge
32
32
  * @fileoverview Merge and sort string index ranges
33
- * @version 9.0.9
33
+ * @version 9.0.10
34
34
  * @author Roy Revelt, Codsen Ltd
35
35
  * @license MIT
36
36
  * {@link https://codsen.com/os/ranges-merge/}
@@ -38,7 +38,7 @@ ${JSON.stringify(e,null,4)}`);if(!e.trim())return{res:[[""]],msgContent:r,msgTyp
38
38
  /**
39
39
  * @name ranges-apply
40
40
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
41
- * @version 7.0.9
41
+ * @version 7.0.10
42
42
  * @author Roy Revelt, Codsen Ltd
43
43
  * @license MIT
44
44
  * {@link https://codsen.com/os/ranges-apply/}
@@ -54,7 +54,7 @@ ${JSON.stringify(e,null,4)}`);if(!e.trim())return{res:[[""]],msgContent:r,msgTyp
54
54
  /**
55
55
  * @name codsen-utils
56
56
  * @fileoverview Various utility functions
57
- * @version 1.5.0
57
+ * @version 1.6.0
58
58
  * @author Roy Revelt, Codsen Ltd
59
59
  * @license MIT
60
60
  * {@link https://codsen.com/os/codsen-utils/}
@@ -62,7 +62,7 @@ ${JSON.stringify(e,null,4)}`);if(!e.trim())return{res:[[""]],msgContent:r,msgTyp
62
62
  /**
63
63
  * @name ranges-push
64
64
  * @fileoverview Gather string index ranges
65
- * @version 7.0.9
65
+ * @version 7.0.10
66
66
  * @author Roy Revelt, Codsen Ltd
67
67
  * @license MIT
68
68
  * {@link https://codsen.com/os/ranges-push/}
@@ -70,7 +70,7 @@ ${JSON.stringify(e,null,4)}`);if(!e.trim())return{res:[[""]],msgContent:r,msgTyp
70
70
  /**
71
71
  * @name string-remove-thousand-separators
72
72
  * @fileoverview Detects and removes thousand separators (dot/comma/quote/space) from string-type digits
73
- * @version 7.0.9
73
+ * @version 7.0.10
74
74
  * @author Roy Revelt, Codsen Ltd
75
75
  * @license MIT
76
76
  * {@link https://codsen.com/os/string-remove-thousand-separators/}
@@ -78,7 +78,7 @@ ${JSON.stringify(e,null,4)}`);if(!e.trim())return{res:[[""]],msgContent:r,msgTyp
78
78
  /**
79
79
  * @name csv-split-easy
80
80
  * @fileoverview Splits the CSV string into array of arrays, each representing a row of columns
81
- * @version 7.0.9
81
+ * @version 7.0.10
82
82
  * @author Roy Revelt, Codsen Ltd
83
83
  * @license MIT
84
84
  * {@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.0.9",
3
+ "version": "7.0.10",
4
4
  "description": "Sort double-entry bookkeeping CSV from internet banking",
5
5
  "keywords": [
6
6
  "accountancy",
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "dependencies": {
79
79
  "@types/lodash-es": "^4.17.7",
80
- "csv-split-easy": "^7.0.9",
80
+ "csv-split-easy": "^7.0.10",
81
81
  "currency.js": "^2.0.4",
82
82
  "lodash-es": "^4.17.21"
83
83
  }