string-remove-thousand-separators
Version:
Detects and removes thousand separators (dot/comma/quote/space) from string-type digits
72 lines (69 loc) • 22.7 kB
JavaScript
/**
* @name string-remove-thousand-separators
* @fileoverview Detects and removes thousand separators (dot/comma/quote/space) from string-type digits
* @version 7.1.0
* @author Roy Revelt
* @license MIT
* {@link https://codsen.com/os/string-remove-thousand-separators/}
*/
;var stringRemoveThousandSeparators=(()=>{var Re=Object.create;var A=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols,ke=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;var j=(e,r,a)=>r in e?A(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,g=(e,r)=>{for(var a in r||(r={}))C.call(r,a)&&j(e,a,r[a]);if(F)for(var a of F(r))We.call(r,a)&&j(e,a,r[a]);return e};var Fe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Ce=(e,r)=>{for(var a in r)A(e,a,{get:r[a],enumerable:!0})},_=(e,r,a,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of Ne(r))!C.call(e,u)&&u!==a&&A(e,u,{get:()=>r[u],enumerable:!(s=De(r,u))||s.enumerable});return e};var _e=(e,r,a)=>(a=e!=null?Re(ke(e)):{},_(r||!e||!e.__esModule?A(a,"default",{value:e,enumerable:!0}):a,e)),Be=e=>_(A({},"__esModule",{value:!0}),e);var E=(e,r,a)=>j(e,typeof r!="symbol"?r+"":r,a);var q=Fe((it,L)=>{"use strict";L.exports=Je;function T(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Je(e){if(e=e||{},e.circles)return Le(e);let r=new Map;if(r.set(Date,n=>new Date(n)),r.set(Map,(n,i)=>new Map(s(Array.from(n),i))),r.set(Set,(n,i)=>new Set(s(Array.from(n),i))),e.constructorHandlers)for(let n of e.constructorHandlers)r.set(n[0],n[1]);let a=null;return e.proto?t:u;function s(n,i){let l=Object.keys(n),o=new Array(l.length);for(let f=0;f<l.length;f++){let p=l[f],d=n[p];typeof d!="object"||d===null?o[p]=d:d.constructor!==Object&&(a=r.get(d.constructor))?o[p]=a(d,i):ArrayBuffer.isView(d)?o[p]=T(d):o[p]=i(d)}return o}function u(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return s(n,u);if(n.constructor!==Object&&(a=r.get(n.constructor)))return a(n,u);let i={};for(let l in n){if(Object.hasOwnProperty.call(n,l)===!1)continue;let o=n[l];typeof o!="object"||o===null?i[l]=o:o.constructor!==Object&&(a=r.get(o.constructor))?i[l]=a(o,u):ArrayBuffer.isView(o)?i[l]=T(o):i[l]=u(o)}return i}function t(n){if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return s(n,t);if(n.constructor!==Object&&(a=r.get(n.constructor)))return a(n,t);let i={};for(let l in n){let o=n[l];typeof o!="object"||o===null?i[l]=o:o.constructor!==Object&&(a=r.get(o.constructor))?i[l]=a(o,t):ArrayBuffer.isView(o)?i[l]=T(o):i[l]=t(o)}return i}}function Le(e){let r=[],a=[],s=new Map;if(s.set(Date,l=>new Date(l)),s.set(Map,(l,o)=>new Map(t(Array.from(l),o))),s.set(Set,(l,o)=>new Set(t(Array.from(l),o))),e.constructorHandlers)for(let l of e.constructorHandlers)s.set(l[0],l[1]);let u=null;return e.proto?i:n;function t(l,o){let f=Object.keys(l),p=new Array(f.length);for(let d=0;d<f.length;d++){let m=f[d],c=l[m];if(typeof c!="object"||c===null)p[m]=c;else if(c.constructor!==Object&&(u=s.get(c.constructor)))p[m]=u(c,o);else if(ArrayBuffer.isView(c))p[m]=T(c);else{let O=r.indexOf(c);O!==-1?p[m]=a[O]:p[m]=o(c)}}return p}function n(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return t(l,n);if(l.constructor!==Object&&(u=s.get(l.constructor)))return u(l,n);let o={};r.push(l),a.push(o);for(let f in l){if(Object.hasOwnProperty.call(l,f)===!1)continue;let p=l[f];if(typeof p!="object"||p===null)o[f]=p;else if(p.constructor!==Object&&(u=s.get(p.constructor)))o[f]=u(p,n);else if(ArrayBuffer.isView(p))o[f]=T(p);else{let d=r.indexOf(p);d!==-1?o[f]=a[d]:o[f]=n(p)}}return r.pop(),a.pop(),o}function i(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return t(l,i);if(l.constructor!==Object&&(u=s.get(l.constructor)))return u(l,i);let o={};r.push(l),a.push(o);for(let f in l){let p=l[f];if(typeof p!="object"||p===null)o[f]=p;else if(p.constructor!==Object&&(u=s.get(p.constructor)))o[f]=u(p,i);else if(ArrayBuffer.isView(p))o[f]=T(p);else{let d=r.indexOf(p);d!==-1?o[f]=a[d]:o[f]=i(p)}}return r.pop(),a.pop(),o}}});var Zr={};Ce(Zr,{defaults:()=>je,remSep:()=>Gr,version:()=>Qr});var Me={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function b(e,r){if(!Array.isArray(e)||!e.length)return e;let a=g(g({},Me),r),s,u;if(a.strictlyTwoElementsInRangeArrays&&!e.every((i,l)=>!Array.isArray(i)||i.length!==2?(s=l,u=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, ".concat(s,"th range (").concat(JSON.stringify(e[s],null,4),") has not two but ").concat(u," elements!"));if(!e.every((i,l)=>!Array.isArray(i)||!Number.isInteger(i[0])||i[0]<0||!Number.isInteger(i[1])||i[1]<0?(s=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, ".concat(s,"th range (").concat(JSON.stringify(e[s],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 B={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function M(e,r){function a(o){return!!o&&typeof o=="object"&&!Array.isArray(o)}if(!Array.isArray(e)||!e.length)return null;let s;if(r)if(a(r)){if(s=g(g({},B),r),s.progressFn&&a(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error('ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "'.concat(typeof s.progressFn,'", equal to ').concat(JSON.stringify(s.progressFn,null,4)));if(![1,2,"1","2"].includes(s.mergeType))throw new Error('ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof s.mergeType,'", equal to ').concat(JSON.stringify(s.mergeType,null,4)));if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error('ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof s.joinRangesThatTouchEdges,'", equal to ').concat(JSON.stringify(s.joinRangesThatTouchEdges,null,4)))}else throw new Error("emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n".concat(JSON.stringify(r,null,4)," (type ").concat(typeof r,")"));else s=g({},B);let u=e.filter(o=>Array.isArray(o)).map(o=>[...o]).filter(o=>o[2]!==void 0||o[0]!==o[1]),t,n,i;s.progressFn?t=b(u,{progressFn:o=>{i=Math.floor(o/5),i!==n&&(n=i,s.progressFn(i))}}):t=b(u);let l=t.length-1;for(let o=l;o>0;o--)s.progressFn&&(i=Math.floor((1-o/l)*78)+21,i!==n&&i>n&&(n=i,s.progressFn(i))),(t[o][0]<=t[o-1][0]||!s.joinRangesThatTouchEdges&&t[o][0]<t[o-1][1]||s.joinRangesThatTouchEdges&&t[o][0]<=t[o-1][1])&&(t[o-1][0]=Math.min(t[o][0],t[o-1][0]),t[o-1][1]=Math.max(t[o][1],t[o-1][1]),t[o][2]!==void 0&&(t[o-1][0]>=t[o][0]||t[o-1][1]<=t[o][1])&&t[o-1][2]!==null&&(t[o][2]===null&&t[o-1][2]!==null?t[o-1][2]=null:t[o-1][2]!=null?+s.mergeType==2&&t[o-1][0]===t[o][0]?t[o-1][2]=t[o][2]:t[o-1][2]+=t[o][2]:t[o-1][2]=t[o][2]),t.splice(o,1),o=t.length);return t.length?t:null}var He=!0,R="Invariant failed";function H(e,r){if(!e){if(He)throw new Error(R);var a=typeof r=="function"?r():r,s=a?"".concat(R,": ").concat(a):R;throw new Error(s)}}function J(e,r,a){let s=0,u=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: ".concat(typeof e,", equal to: ").concat(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: ".concat(typeof r,", equal to: ").concat(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: ".concat(typeof a,", equal to: ").concat(JSON.stringify(a,null,4)));if(!(r!=null&&r.filter(f=>f).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(f=>f).forEach((f,p)=>{if(a&&(s=Math.floor(i/n*10),s!==u&&(u=s,a(s))),!Array.isArray(f))throw new TypeError("ranges-apply: [THROW_ID_05] ranges array, second input arg., has ".concat(p,"th element not an array: ").concat(JSON.stringify(f,null,4),", which is ").concat(typeof f));if(!Number.isInteger(f[0])){if(!Number.isInteger(+f[0])||+f[0]<0)throw new TypeError("ranges-apply: [THROW_ID_06] ranges array, second input arg. has ".concat(p,"th element, array ").concat(JSON.stringify(f,null,0),". Its first element is not an integer, string index, but ").concat(typeof f[0],", equal to: ").concat(JSON.stringify(f[0],null,4),"."));t[p][0]=+t[p][0]}if(!Number.isInteger(f[1])){if(!Number.isInteger(+f[1])||+f[1]<0)throw new TypeError("ranges-apply: [THROW_ID_07] ranges array, second input arg. has ".concat(p,"th element, array ").concat(JSON.stringify(f,null,0),". Its second element is not an integer, string index, but ").concat(typeof f[1],", equal to: ").concat(JSON.stringify(f[1],null,4),"."));t[p][1]=+t[p][1]}i+=1});let l=M(t,{progressFn:f=>{a&&(s=10+Math.floor(f/10),s!==u&&(u=s,a(s)))}});H(l);let o=l.length;if(o>0){let f=e.slice(l[o-1][1]);e=l.reduce((p,d,m,c)=>{a&&(s=20+Math.floor(m/o*80),s!==u&&(u=s,a(s)));let O=m===0?0:c[m-1][1],Ee=c[m][0];return"".concat(p).concat(e.slice(O,Ee)).concat(c[m][2]||"")},""),e+=f}return e}function S(e,r=1){let a="\xA0";function s(t){return Array.from(t).reverse().join("")}function u(t,n,i){let l=i?"\n":"\r",o=i?"\r":"\n";if(!t)return t;let f=0,p=0,d="";for(let m=0,c=t.length;m<c;m++)(t[m]===l||t[m]===o&&t[m-1]!==l)&&p++,"\r\n".includes(t[m])||t[m]===a?(f=0,t[m]===a?d+=t[m]:t[m]===l?p<=n&&(d+=t[m],t[m+1]===o&&(d+=t[m+1],m++)):t[m]===o&&(t==null?void 0:t[m-1])!==l&&p<=n&&(d+=t[m])):(f++,!t[m+1]&&!p&&(d+=" "));return d}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,o=e.length;l<o;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"".concat(u(n,t,!1)).concat(e.trim()).concat(s(u(s(i),t,!0)))}return e}var P=_e(q(),1);var ut=(0,P.default)();function w(e){return typeof e=="string"}function V(e){return Number.isFinite(e)}function h(e){return Number.isSafeInteger(e)&&e>=0}function x(e){return e!=null}var U={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function qe(e,r){var o;function a(f){return!!f&&typeof f=="object"&&!Array.isArray(f)}if(!Array.isArray(e)||!e.length)return null;let s;if(r)if(a(r)){if(s=g(g({},U),r),s.progressFn&&a(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error('ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof s.progressFn,'", equal to ').concat(JSON.stringify(s.progressFn,null,4)));if(![1,2,"1","2"].includes(s.mergeType))throw new Error('ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof s.mergeType,'", equal to ').concat(JSON.stringify(s.mergeType,null,4)));if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error('ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof s.joinRangesThatTouchEdges,'", equal to ').concat(JSON.stringify(s.joinRangesThatTouchEdges,null,4)))}else throw new Error("ranges-merge: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n".concat(JSON.stringify(r,null,4)," (type ").concat(typeof r,")"));else s=g({},U);let u=e.filter(f=>Array.isArray(f)).map(f=>[...f]).filter(f=>f[2]!==void 0||f[0]!==f[1]),t,n,i;s.progressFn?t=b(u,{progressFn:f=>{i=Math.floor(f/5),i!==n&&(n=i,s.progressFn!=null&&s.progressFn(i))}}):t=b(u);let l=t.length-1;for(let f=l;f>0;f--)s.progressFn&&(i=Math.floor((1-f/l)*78)+21,i!==n&&i>n&&(n=i,s.progressFn(i))),(t[f][0]<=t[f-1][0]||!s.joinRangesThatTouchEdges&&t[f][0]<t[f-1][1]||s.joinRangesThatTouchEdges&&t[f][0]<=t[f-1][1])&&(t[f-1][0]=Math.min(t[f][0],t[f-1][0]),t[f-1][1]=Math.max(t[f][1],t[f-1][1]),t[f][2]!==void 0&&(t[f-1][0]>=t[f][0]||t[f-1][1]<=t[f][1])&&t[f-1][2]!==null&&(t[f][2]===null&&t[f-1][2]!==null?t[f-1][2]=null:t[f-1][2]!=null?+((o=s||{})==null?void 0:o.mergeType)==2&&t[f-1][0]===t[f][0]?t[f-1][2]=t[f][2]:t[f-1][2]+=t[f][2]:t[f-1][2]=t[f][2]),t.splice(f,1),f=t.length);return t.length?t:null}var Pe={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},K=class{constructor(e){E(this,"ranges");E(this,"opts");let r=g(g({},Pe),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(w(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(w(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: "'.concat(typeof r.mergeType,'", equal to ').concat(JSON.stringify(r.mergeType,null,4)));this.opts=r,this.ranges=[]}add(e,r,a){var t;if(e==null&&r==null)return;if(x(e)&&!x(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&&h(+e[0])&&h(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set ('.concat(JSON.stringify(e,null,0),') but second-one, "to" is not (').concat(JSON.stringify(r,null,0),")"))}else if(!x(e)&&x(r))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set ('.concat(JSON.stringify(r,null,0),') but first-one, "from" is not (').concat(JSON.stringify(e,null,0),")"));let s=+e,u=+r;if(h(s)&&h(u)){if(x(a)&&!w(a)&&!V(a))throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ".concat(typeof a,", equal to:\n").concat(JSON.stringify(a,null,4)));if(x(this.ranges)&&Array.isArray(this.last())&&s===this.last()[1]){if(this.last()[1]=u,this.last()[2],this.last()[2]!==null&&x(a)){let n=this.last()[2]&&this.last()[2].length&&(!((t=this.opts)!=null&&t.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(a):a;this.opts.limitToBeAddedWhitespace&&(n=S(n,this.opts.limitLinebreaksCount)),w(n)&&!n.length||(this.last()[2]=n)}}else{this.ranges||(this.ranges=[]);let n=a!==void 0&&!(w(a)&&!a.length)?[s,u,a&&this.opts.limitToBeAddedWhitespace?S(a,this.opts.limitLinebreaksCount):a]:[s,u];this.ranges.push(n)}}else throw h(s)&&s>=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 "'.concat(typeof u,'" equal to: ').concat(JSON.stringify(u,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 "'.concat(typeof s,'" equal to: ').concat(JSON.stringify(s,null,4)))}push(e,r,a){this.add(e,r,a)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=qe(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>x(e[2])?[e[0],e[1],S(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])&&h(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, ".concat(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 Ve=typeof global=="object"&&global&&global.Object===Object&&global,z=Ve;var Ue=typeof self=="object"&&self&&self.Object===Object&&self,Ke=z||Ue||Function("return this")(),Q=Ke;var ze=Q.Symbol,y=ze;var G=Object.prototype,Qe=G.hasOwnProperty,Ge=G.toString,$=y?y.toStringTag:void 0;function Ze(e){var r=Qe.call(e,$),a=e[$];try{e[$]=void 0;var s=!0}catch(t){}var u=Ge.call(e);return s&&(r?e[$]=a:delete e[$]),u}var Z=Ze;var Ye=Object.prototype,Xe=Ye.toString;function er(e){return Xe.call(e)}var Y=er;var rr="[object Null]",tr="[object Undefined]",X=y?y.toStringTag:void 0;function or(e){return e==null?e===void 0?tr:rr:X&&X in Object(e)?Z(e):Y(e)}var ee=or;function ar(e){return e!=null&&typeof e=="object"}var re=ar;var sr="[object Symbol]";function nr(e){return typeof e=="symbol"||re(e)&&ee(e)==sr}var te=nr;function fr(e,r){for(var a=-1,s=e==null?0:e.length,u=Array(s);++a<s;)u[a]=r(e[a],a,e);return u}var oe=fr;var lr=Array.isArray,ae=lr;var ir=1/0,se=y?y.prototype:void 0,ne=se?se.toString:void 0;function fe(e){if(typeof e=="string")return e;if(ae(e))return oe(e,fe)+"";if(te(e))return ne?ne.call(e):"";var r=e+"";return r=="0"&&1/e==-ir?"-0":r}var v=fe;var ur=/\s/;function pr(e){for(var r=e.length;r--&&ur.test(e.charAt(r)););return r}var le=pr;var mr=/^\s+/;function dr(e){return e&&e.slice(0,le(e)+1).replace(mr,"")}var ie=dr;function cr(e,r,a,s){for(var u=e.length,t=a+(s?1:-1);s?t--:++t<u;)if(r(e[t],t,e))return t;return-1}var ue=cr;function gr(e){return e!==e}var pe=gr;function xr(e,r,a){for(var s=a-1,u=e.length;++s<u;)if(e[s]===r)return s;return-1}var me=xr;function yr(e,r,a){return r===r?me(e,r,a):ue(e,pe,a)}var I=yr;function hr(e){return e==null?"":v(e)}var de=hr;function br(e,r,a){var s=-1,u=e.length;r<0&&(r=-r>u?0:u+r),a=a>u?u:a,a<0&&(a+=u),u=r>a?0:a-r>>>0,r>>>=0;for(var t=Array(u);++s<u;)t[s]=e[s+r];return t}var ce=br;function Tr(e,r,a){var s=e.length;return a=a===void 0?s:a,!r&&a>=s?e:ce(e,r,a)}var ge=Tr;var wr="\\ud800-\\udfff",Ar="\\u0300-\\u036f",$r="\\ufe20-\\ufe2f",Or="\\u20d0-\\u20ff",Sr=Ar+$r+Or,vr="\\ufe0e\\ufe0f",Ir="\\u200d",jr=RegExp("["+Ir+wr+Sr+vr+"]");function Er(e){return jr.test(e)}var xe=Er;function Rr(e){return e.split("")}var ye=Rr;var he="\\ud800-\\udfff",Dr="\\u0300-\\u036f",Nr="\\ufe20-\\ufe2f",kr="\\u20d0-\\u20ff",Wr=Dr+Nr+kr,Fr="\\ufe0e\\ufe0f",Cr="["+he+"]",D="["+Wr+"]",N="\\ud83c[\\udffb-\\udfff]",_r="(?:"+D+"|"+N+")",be="[^"+he+"]",Te="(?:\\ud83c[\\udde6-\\uddff]){2}",we="[\\ud800-\\udbff][\\udc00-\\udfff]",Br="\\u200d",Ae=_r+"?",$e="["+Fr+"]?",Mr="(?:"+Br+"(?:"+[be,Te,we].join("|")+")"+$e+Ae+")*",Hr=$e+Ae+Mr,Jr="(?:"+[be+D+"?",D,Te,we,Cr].join("|")+")",Lr=RegExp(N+"(?="+N+")|"+Jr+Hr,"g");function qr(e){return e.match(Lr)||[]}var Oe=qr;function Pr(e){return xe(e)?Oe(e):ye(e)}var k=Pr;function Vr(e,r){for(var a=e.length;a--&&I(r,e[a],0)>-1;);return a}var Se=Vr;function Ur(e,r){for(var a=-1,s=e.length;++a<s&&I(r,e[a],0)>-1;);return a}var ve=Ur;function Kr(e,r,a){if(e=de(e),e&&(a||r===void 0))return ie(e);if(!e||!(r=v(r)))return e;var s=k(e),u=k(r),t=ve(s,u),n=Se(s,u)+1;return ge(s,t,n).join("")}var W=Kr;var Ie="7.1.0";var Qr=Ie,je={removeThousandSeparatorsFromNumbers:!0,padSingleDecimalPlaceNumbers:!0,forceUKStyle:!1};function Gr(e,r){let a=!0,s=[".",",","'"," "],u;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(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: ".concat(typeof r,", equal to:\n").concat(JSON.stringify(r,null,4)));let t=g(g({},je),r),n=W(e.trim(),'"');if(n==="")return n;if(+e>0&&+e<1)return e;let i=new K;for(let o=0,f=n.length;o<f;o++){if(t.removeThousandSeparatorsFromNumbers&&n[o].trim()===""&&i.add(o,o+1),t.removeThousandSeparatorsFromNumbers&&n[o]==="'"&&(i.add(o,o+1),n[o+1]==="'")){a=!1;break}if(s.includes(n[o])){if(n[o+1]!==void 0&&/^\d$/.test(n[o+1]))if(n[o+2]!==void 0)if(/^\d$/.test(n[o+2]))if(n[o+3]!==void 0)if(/^\d$/.test(n[o+3])){if(n[o+4]!==void 0&&/^\d$/.test(n[o+4])){a=!1;break}else if(t.removeThousandSeparatorsFromNumbers&&i.add(o,o+1),!u)u=n[o];else if(n[o]!==u){a=!1;break}}else{a=!1;break}else t.removeThousandSeparatorsFromNumbers&&t.forceUKStyle&&n[o]===","&&i.add(o,o+1,".");else{a=!1;break}else t.forceUKStyle&&n[o]===","&&i.add(o,o+1,"."),t.padSingleDecimalPlaceNumbers&&i.add(o+2,o+2,"0")}else if(!/^\d$/.test(n[o])){a=!1;break}}return a&&i.current()?J(n,i.current()):n}return Be(Zr);})();
/**
* @name ranges-sort
* @fileoverview Sort string index ranges
* @version 6.1.0
* @author Roy Revelt
* @license MIT
* {@link https://codsen.com/os/ranges-sort/}
*/
/**
* @name ranges-merge
* @fileoverview Merge and sort string index ranges
* @version 9.1.0
* @author Roy Revelt
* @license MIT
* {@link https://codsen.com/os/ranges-merge/}
*/
/**
* @name ranges-apply
* @fileoverview Take an array of string index ranges, delete/replace the string according to them
* @version 7.1.0
* @author Roy Revelt
* @license MIT
* {@link https://codsen.com/os/ranges-apply/}
*/
/**
* @name string-collapse-leading-whitespace
* @fileoverview Collapse the leading and trailing whitespace of a string
* @version 7.1.0
* @author Roy Revelt
* @license MIT
* {@link https://codsen.com/os/string-collapse-leading-whitespace/}
*/
/**
* @name codsen-utils
* @fileoverview Various utility functions
* @version 1.7.0
* @author Roy Revelt
* @license MIT
* {@link https://codsen.com/os/codsen-utils/}
*/
/**
* @name ranges-push
* @fileoverview Gather string index ranges
* @version 7.1.0
* @author Roy Revelt
* @license MIT
* {@link https://codsen.com/os/ranges-push/}
*/
/*! Bundled license information:
lodash-es/lodash.js:
(**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
*/