numora 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,481 +1,418 @@
1
1
  var re = Object.defineProperty;
2
2
  var ie = (e, t, n) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var w = (e, t, n) => ie(e, typeof t != "symbol" ? t + "" : t, n);
4
- var m = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(m || {}), S = /* @__PURE__ */ ((e) => (e.None = "none", e.Thousand = "thousand", e.Lakh = "lakh", e.Wan = "wan", e))(S || {});
5
- const _ = 2, z = 0, Z = m.Blur, B = ",", W = S.None, N = ".", oe = !1, k = !1, U = !1, G = !1;
3
+ var $ = (e, t, n) => ie(e, typeof t != "symbol" ? t + "" : t, n);
4
+ var b = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(b || {}), p = /* @__PURE__ */ ((e) => (e.None = "none", e.Thousand = "thousand", e.Lakh = "lakh", e.Wan = "wan", e))(p || {});
5
+ const x = 2, G = 0, Z = b.Blur, k = ",", B = p.None, N = ".", P = !1, W = !1, U = !1, z = !1;
6
+ function w(e) {
7
+ return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
8
+ }
9
+ const J = /* @__PURE__ */ new Map();
10
+ function I(e, t = "g") {
11
+ const n = `${e}:${t}`;
12
+ let r = J.get(n);
13
+ return r || (r = new RegExp(e, t), J.set(n, r)), r;
14
+ }
15
+ function se(e, t = "g") {
16
+ const n = w(e);
17
+ return I(n, t);
18
+ }
19
+ const ae = /[.,]/g;
6
20
  function T(e) {
7
21
  return {
8
22
  decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? N,
9
23
  thousandSeparator: e == null ? void 0 : e.thousandSeparator
10
24
  };
11
25
  }
12
- function K(e, t) {
13
- const n = e.startsWith("-"), s = n ? e.slice(1) : e, [o = "", r = ""] = s.split(t);
26
+ function Y(e, t) {
27
+ const n = e.startsWith("-"), r = n ? e.slice(1) : e, [i = "", s = ""] = r.split(t);
14
28
  return {
15
29
  sign: n ? "-" : "",
16
- integer: o,
17
- decimal: r
30
+ integer: i,
31
+ decimal: s
18
32
  };
19
33
  }
20
- function ae(e, t) {
34
+ function ce(e, t) {
21
35
  if (!e.value.includes(t)) return !1;
22
- const { selectionStart: n, selectionEnd: s, value: o } = e;
23
- return !o.slice(n ?? 0, s ?? 0).includes(t);
36
+ const { selectionStart: n, selectionEnd: r, value: i } = e;
37
+ return !i.slice(n ?? 0, r ?? 0).includes(t);
24
38
  }
25
- function ce(e, t, n) {
26
- const { key: s } = e;
27
- if (s !== "," && s !== ".") return !1;
28
- if (ae(t, n))
39
+ function oe(e, t, n) {
40
+ const { key: r } = e;
41
+ if (r !== "," && r !== ".") return !1;
42
+ if (ce(t, n))
29
43
  return !0;
30
- if (s !== n) {
31
- const { selectionStart: o, selectionEnd: r, value: i } = t, a = o ?? 0, c = r ?? a;
32
- t.value = i.slice(0, a) + n + i.slice(c);
33
- const l = a + 1;
34
- return t.setSelectionRange(l, l), !0;
44
+ if (r !== n) {
45
+ const { selectionStart: i, selectionEnd: s, value: a } = t, c = i ?? 0, l = s ?? c;
46
+ t.value = a.slice(0, c) + n + a.slice(l);
47
+ const o = c + 1;
48
+ return t.setSelectionRange(o, o), !0;
35
49
  }
36
50
  return !1;
37
51
  }
38
52
  const le = (e, t, n = N) => {
39
- const { sign: s, integer: o, decimal: r } = K(e, n);
40
- if (!e.includes(n)) return e;
41
- const a = r.slice(0, t);
42
- return `${s}${o}${n}${a}`;
53
+ const { sign: r, integer: i, decimal: s } = Y(e, n);
54
+ if (!s) return e;
55
+ const a = s.slice(0, t);
56
+ return `${r}${i}${n}${a}`;
43
57
  }, he = (e, t = N) => {
44
58
  const n = e.indexOf(t);
45
- if (n === -1) return e;
46
- const s = e.slice(0, n + 1), r = e.slice(n + 1).split(",").join("").split(".").join("").split(t).join("");
47
- return s + r;
59
+ if (n === -1 || n === e.length - 1) return e;
60
+ const r = e.slice(0, n + 1), i = e.slice(n + 1), a = t === "." || t === "," ? ae : I("[,\\." + w(t) + "]", "g");
61
+ return r + i.replace(a, "");
48
62
  }, ue = (e, t = 0, n = N) => {
49
63
  if (t <= 0) return e;
50
- const { sign: s, integer: o, decimal: r } = K(e, n);
51
- if (r.length >= t)
52
- return e.includes(n) ? e : `${s}${o}${n}${r}`;
53
- const i = r.padEnd(t, "0");
54
- return `${s}${o}${n}${i}`;
55
- }, L = {
64
+ const { sign: r, integer: i, decimal: s } = Y(e, n);
65
+ if (s.length >= t)
66
+ return e;
67
+ const a = s.padEnd(t, "0");
68
+ return `${r}${i}${n}${a}`;
69
+ }, v = {
56
70
  thousand: { size: 3 },
57
71
  lakh: { firstGroup: 3, restGroup: 2 },
58
72
  wan: { size: 4 }
59
- };
60
- function y(e, t, n = S.Thousand, s = !1, o = ".") {
61
- if (!e || e === "0" || e === o || e === "-" || e === `-${o}`)
73
+ }, de = /^(0+)/;
74
+ function Q(e, t, n = p.Thousand, r = !1, i = ".") {
75
+ if (!e || e === "0" || e === i || e === "-" || e === `-${i}`)
62
76
  return e;
63
- const r = e.includes(o), i = e.startsWith("-"), a = i ? e.slice(1) : e, [c, l] = a.split(o);
64
- if (!c) {
65
- const f = l ? `${o}${l}` : a;
66
- return i ? `-${f}` : f;
77
+ const s = e.includes(i), a = e.startsWith("-"), c = a ? e.slice(1) : e, [l, o] = c.split(i);
78
+ if (!l) {
79
+ const u = o ? `${i}${o}` : c;
80
+ return a ? `-${u}` : u;
67
81
  }
68
- if (s && c.startsWith("0") && c.length > 1) {
69
- const f = c.match(/^(0+)/);
70
- if (f) {
71
- const d = f[1], g = c.slice(d.length);
72
- if (g) {
73
- const p = j(g, t, n), $ = d + p, D = i ? "-" : "";
74
- return r ? l ? `${D}${$}${o}${l}` : `${D}${$}${o}` : `${D}${$}`;
82
+ if (r && l.startsWith("0") && l.length > 1) {
83
+ const u = l.match(de);
84
+ if (u) {
85
+ const g = u[1], f = l.slice(g.length);
86
+ if (f) {
87
+ const S = X(f, t, n), E = g + S, m = a ? "-" : "";
88
+ return s ? o ? `${m}${E}${i}${o}` : `${m}${E}${i}` : `${m}${E}`;
75
89
  }
76
90
  }
77
91
  }
78
- const h = j(c, t, n), u = i ? "-" : "";
79
- return r ? l ? `${u}${h}${o}${l}` : `${u}${h}${o}` : `${u}${h}`;
92
+ const h = X(l, t, n), d = a ? "-" : "";
93
+ return s ? o ? `${d}${h}${i}${o}` : `${d}${h}${i}` : `${d}${h}`;
80
94
  }
81
- function j(e, t, n) {
95
+ function X(e, t, n) {
82
96
  if (e === "0" || e === "")
83
97
  return e;
84
98
  switch (n) {
85
- case S.None:
99
+ case p.None:
86
100
  return e;
87
- case S.Thousand:
101
+ case p.Thousand:
102
+ return j(e, t, v.thousand.size);
103
+ case p.Lakh:
88
104
  return fe(e, t);
89
- case S.Lakh:
90
- return de(e, t);
91
- case S.Wan:
92
- return ge(e, t);
105
+ case p.Wan:
106
+ return j(e, t, v.wan.size);
93
107
  default:
94
108
  return e;
95
109
  }
96
110
  }
97
111
  function fe(e, t) {
98
- return q(e, t, L.thousand.size);
99
- }
100
- function de(e, t) {
101
- if (e.length <= L.lakh.firstGroup)
112
+ if (e.length <= v.lakh.firstGroup)
102
113
  return e;
103
- const n = e.split("").reverse(), s = [], o = n.slice(0, L.lakh.firstGroup).reverse().join("");
104
- s.push(o);
105
- for (let r = L.lakh.firstGroup; r < n.length; r += L.lakh.restGroup)
106
- s.push(n.slice(r, r + L.lakh.restGroup).reverse().join(""));
107
- return s.reverse().join(t);
108
- }
109
- function ge(e, t) {
110
- return q(e, t, L.wan.size);
114
+ const n = [], r = e.length - v.lakh.firstGroup;
115
+ n.unshift(e.slice(r));
116
+ for (let i = r; i > 0; i -= v.lakh.restGroup)
117
+ n.unshift(e.slice(Math.max(0, i - v.lakh.restGroup), i));
118
+ return n.join(t);
111
119
  }
112
- function q(e, t, n) {
113
- const s = e.split("").reverse(), o = [];
114
- for (let r = 0; r < s.length; r += n)
115
- o.push(s.slice(r, r + n).reverse().join(""));
116
- return o.reverse().join(t);
120
+ function j(e, t, n) {
121
+ const r = [];
122
+ for (let i = e.length; i > 0; i -= n)
123
+ r.unshift(e.slice(Math.max(0, i - n), i));
124
+ return r.join(t);
117
125
  }
118
- function pe(e, t, n) {
119
- return (t == null ? void 0 : t.formatOn) === m.Change && t.thousandSeparator ? y(
126
+ function ge(e, t, n) {
127
+ return (t == null ? void 0 : t.formatOn) === b.Change && t.thousandSeparator ? Q(
120
128
  e,
121
129
  t.thousandSeparator,
122
- t.ThousandStyle ?? S.None,
130
+ t.ThousandStyle ?? p.None,
123
131
  t.enableLeadingZeros,
124
132
  (n == null ? void 0 : n.decimalSeparator) ?? N
125
133
  ) : e;
126
134
  }
127
- function b(e, t, n, s = ".") {
128
- let o = 0;
129
- for (let r = 0; r < t && r < e.length; r++)
130
- e[r] !== n && o++;
131
- return o;
135
+ function L(e, t, n) {
136
+ let r = 0;
137
+ for (let i = 0; i < t && i < e.length; i++)
138
+ e[i] !== n && r++;
139
+ return r;
132
140
  }
133
- function Se(e, t, n, s = ".") {
141
+ function Se(e, t, n) {
134
142
  if (t === 0)
135
143
  return 0;
136
- let o = 0;
137
- for (let r = 0; r < e.length; r++)
138
- if (e[r] !== n) {
139
- if (o === t - 1)
140
- return r + 1;
141
- o++;
144
+ let r = 0;
145
+ for (let i = 0; i < e.length; i++)
146
+ if (e[i] !== n) {
147
+ if (r === t - 1)
148
+ return i + 1;
149
+ r++;
142
150
  }
143
151
  return e.length;
144
152
  }
145
- function A(e, t, n, s = ".") {
153
+ function y(e, t, n) {
146
154
  if (t === 0)
147
155
  return 0;
148
- let o = 0;
149
- for (let r = 0; r < e.length; r++)
150
- if (e[r] !== n) {
151
- if (o++, o === t)
152
- return r + 1;
153
- if (o > t)
154
- return r;
156
+ let r = 0;
157
+ for (let i = 0; i < e.length; i++)
158
+ if (e[i] !== n) {
159
+ if (r++, r === t)
160
+ return i + 1;
161
+ if (r > t)
162
+ return i;
155
163
  }
156
164
  return e.length;
157
165
  }
158
- function Q(e, t, n) {
166
+ function V(e, t, n) {
159
167
  return t < 0 || t >= e.length ? !1 : e[t] === n;
160
168
  }
161
- function $e(e, t = {}) {
169
+ const Ee = /\d/;
170
+ function pe(e, t = {}) {
162
171
  const {
163
172
  thousandSeparator: n,
164
- decimalSeparator: s = ".",
165
- prefix: o = "",
166
- suffix: r = ""
167
- } = t, i = Array.from({ length: e.length + 1 }).map(() => !0);
168
- if (o && i.fill(!1, 0, o.length), r) {
169
- const a = e.length - r.length;
170
- i.fill(!1, a + 1, e.length + 1);
173
+ decimalSeparator: r = ".",
174
+ prefix: i = "",
175
+ suffix: s = ""
176
+ } = t, a = new Array(e.length + 1).fill(!0);
177
+ if (i && a.fill(!1, 0, i.length), s) {
178
+ const c = e.length - s.length;
179
+ a.fill(!1, c + 1, e.length + 1);
171
180
  }
172
- for (let a = 0; a < e.length; a++) {
173
- const c = e[a];
174
- (n && c === n || c === s) && (i[a] = !1, a + 1 < e.length && !/\d/.test(e[a + 1]) && (i[a + 1] = !1));
181
+ for (let c = 0; c < e.length; c++) {
182
+ const l = e[c];
183
+ (n && l === n || l === r) && (a[c] = !1, c + 1 < e.length && !Ee.test(e[c + 1]) && (a[c + 1] = !1));
175
184
  }
176
- return i.some((a) => a) || i.fill(!0), i;
177
- }
178
- function I(e, t, n, s) {
179
- const o = e.length;
180
- if (t = Math.max(0, Math.min(t, o)), !n[t]) {
181
- let r = t;
182
- for (; r <= o && !n[r]; )
183
- r++;
184
- let i = t;
185
- for (; i >= 0 && !n[i]; )
186
- i--;
187
- r <= o && i >= 0 ? t = t - i < r - t ? i : r : r <= o ? t = r : i >= 0 && (t = i);
185
+ return a.some((c) => c) || a.fill(!0), a;
186
+ }
187
+ function _(e, t, n, r) {
188
+ const i = e.length;
189
+ if (t = Math.max(0, Math.min(t, i)), !n[t]) {
190
+ let s = t;
191
+ for (; s <= i && !n[s]; )
192
+ s++;
193
+ let a = t;
194
+ for (; a >= 0 && !n[a]; )
195
+ a--;
196
+ s <= i && a >= 0 ? t = t - a < s - t ? a : s : s <= i ? t = s : a >= 0 && (t = a);
188
197
  }
189
- return (t === -1 || t > o) && (t = o), t;
198
+ return (t === -1 || t > i) && (t = i), t;
190
199
  }
191
- const H = (e, t) => e === t;
192
- function me(e, t, n, s, o, r, i = ".", a = {}) {
200
+ const K = /(\d+\.?\d*)\s*[kmbt]$/i, F = (e, t) => e === t;
201
+ function be(e, t, n, r, i, s, a = ".", c = {}) {
193
202
  if (n < 0)
194
203
  return 0;
195
- if (n > e.length || e === "" || t === "")
196
- return t.length;
197
- const c = /(\d+\.?\d*)\s*[kmbMTOQaqiSxsxSpOoNn]$/i;
198
- if (c.test(e) && !c.test(t) && t.length > e.length && n >= e.length - 1)
204
+ if (n > e.length || e === "" || t === "" || K.test(e) && !K.test(t) && t.length > e.length && n >= e.length - 1)
199
205
  return t.length;
200
- const l = t.length < e.length, h = Q(
206
+ const l = t.length < e.length, o = V(
201
207
  e,
202
208
  n,
203
- s
204
- ), u = e.indexOf(i), f = t.indexOf(i);
205
- if (a.isCharacterEquivalent && e !== t) {
206
- const p = be(
209
+ r
210
+ ), h = e.indexOf(a), d = t.indexOf(a);
211
+ if (c.isCharacterEquivalent && e !== t) {
212
+ const E = me(
207
213
  e,
208
214
  t,
209
215
  n,
210
- a.isCharacterEquivalent || H,
211
- r,
212
- a
216
+ c.isCharacterEquivalent || F,
217
+ s,
218
+ c
213
219
  );
214
- if (p !== void 0)
215
- return p;
220
+ if (E !== void 0)
221
+ return E;
216
222
  }
223
+ const g = /* @__PURE__ */ new Map(), f = (E, m, te) => {
224
+ const C = `${E === e ? "o" : "n"}:${m}`;
225
+ return g.has(C) || g.set(C, L(E, m, r)), g.get(C);
226
+ };
217
227
  if (l)
218
228
  return Ne(
219
229
  e,
220
230
  t,
221
231
  n,
222
- s,
223
- h,
224
- u,
225
- f,
226
232
  r,
227
- i,
228
- a
233
+ o,
234
+ h,
235
+ d,
236
+ s,
237
+ c,
238
+ f
229
239
  );
230
- const g = we(
240
+ const S = ve(
231
241
  e,
232
242
  t,
233
243
  n,
234
- s,
235
- h,
236
- i
244
+ r,
245
+ o,
246
+ f
237
247
  );
238
- return a.boundary ? I(t, g, a.boundary) : g;
239
- }
240
- function be(e, t, n, s, o, r) {
241
- const i = e.length, a = t.length, c = {}, l = new Array(i);
242
- for (let g = 0; g < i; g++) {
243
- l[g] = -1;
244
- for (let p = 0; p < a; p++) {
245
- if (c[p]) continue;
246
- if (s(
247
- e[g],
248
- t[p],
248
+ return c.boundary ? _(t, S, c.boundary) : S;
249
+ }
250
+ function me(e, t, n, r, i, s) {
251
+ const a = e.length, c = t.length;
252
+ let l = 0, o = 0, h = c;
253
+ for (let u = 0; u < a; u++) {
254
+ let g = -1;
255
+ for (let f = l; f < c; f++)
256
+ if (r(
257
+ e[u],
258
+ t[f],
249
259
  {
250
260
  oldValue: e,
251
261
  newValue: t,
252
- typedRange: o,
253
- oldIndex: g,
254
- newIndex: p
262
+ typedRange: i,
263
+ oldIndex: u,
264
+ newIndex: f
255
265
  }
256
266
  )) {
257
- l[g] = p, c[p] = !0;
267
+ g = f;
258
268
  break;
259
269
  }
260
- }
270
+ g !== -1 && (l = g + 1, u < n ? o = g + 1 : h === c && /\d/.test(e[u]) && (h = g));
261
271
  }
262
- let h = n;
263
- for (; h < i && (l[h] === -1 || !/\d/.test(e[h])); )
264
- h++;
265
- const u = h === i || l[h] === -1 ? a : l[h];
266
- for (h = n - 1; h >= 0 && l[h] === -1; ) h--;
267
- const f = h === -1 || l[h] === -1 ? 0 : l[h] + 1;
268
- if (f > u) return u;
269
- const d = n - f < u - n ? f : u;
270
- return r.boundary ? I(t, d, r.boundary) : d;
272
+ if (o > h) return h;
273
+ const d = n - o < h - n ? o : h;
274
+ return s.boundary ? _(t, d, s.boundary) : d;
271
275
  }
272
- function Ne(e, t, n, s, o, r, i, a, c, l = {}) {
273
- if (o)
274
- return De(
276
+ function Ne(e, t, n, r, i, s, a, c, l = {}, o = L) {
277
+ if (i)
278
+ return Le(
275
279
  e,
276
280
  t,
277
281
  n,
278
- s,
279
- i,
280
- c
282
+ r,
283
+ a,
284
+ o
281
285
  );
282
- const h = b(
286
+ const h = o(e, n, r), d = o(e, e.length, r), u = o(t, t.length, r), g = d - u, f = $e(
283
287
  e,
284
288
  n,
289
+ r,
290
+ h,
291
+ g,
285
292
  s,
286
- c
287
- ), u = b(
288
- e,
289
- e.length,
290
- s,
291
- c
292
- ), f = b(
293
+ c,
294
+ o
295
+ ), S = s === -1 || n <= s, E = De(
293
296
  t,
294
- t.length,
295
- s,
296
- c
297
- ), d = u - f, g = Ee(
298
- e,
299
- n,
300
- s,
301
- h,
302
- d,
297
+ f,
303
298
  r,
304
- a,
305
- c
306
- ), p = r === -1 || n <= r, $ = Le(
307
- t,
308
299
  g,
309
- s,
310
- d,
311
- a,
312
300
  c,
313
- p,
314
- i
301
+ S,
302
+ a,
303
+ o
315
304
  );
316
- return l.boundary ? I(t, $, l.boundary) : $;
305
+ return l.boundary ? _(t, E, l.boundary) : E;
317
306
  }
318
- function De(e, t, n, s, o, r) {
319
- const i = n + 1;
320
- if (i < e.length) {
321
- const a = b(
322
- e,
323
- i,
324
- s,
325
- r
326
- ), c = Se(
307
+ function Le(e, t, n, r, i, s = L) {
308
+ const a = n + 1;
309
+ if (a < e.length) {
310
+ const c = s(e, a, r), l = Se(
327
311
  t,
328
- a,
329
- s,
312
+ c,
330
313
  r
331
314
  );
332
- return c < t.length && t[c] !== s ? c + 1 : c;
315
+ return l < t.length && t[l] !== r ? l + 1 : l;
333
316
  }
334
317
  return n;
335
318
  }
336
- function Ee(e, t, n, s, o, r, i, a) {
337
- if (i) {
338
- const { start: l, isDelete: h } = i;
339
- return h ? b(
340
- e,
341
- l,
342
- n,
343
- a
344
- ) : Math.max(0, b(
345
- e,
346
- l,
347
- n,
348
- a
349
- ));
319
+ function $e(e, t, n, r, i, s, a, c = L) {
320
+ if (a) {
321
+ const { start: o, isDelete: h } = a;
322
+ return h ? c(e, o, n) : Math.max(0, c(e, o, n));
350
323
  }
351
- return t > 0 && e[t - 1] === n && o > 0 ? s + 1 : s;
324
+ return t > 0 && e[t - 1] === n && i > 0 ? r + 1 : r;
325
+ }
326
+ function q(e, t, n, r, i, s, a = L) {
327
+ if (t > 0 && t < e.length && a(e, t, r) === n) {
328
+ if (e[t] === r && s && i > 0 && t < e.length - 1)
329
+ return t + 1;
330
+ if (!s && i > 0 && t < e.length - 1)
331
+ return Math.min(t + 1, e.length);
332
+ }
333
+ return t;
352
334
  }
353
- function Le(e, t, n, s, o, r, i, a) {
354
- if (i && a !== -1) {
355
- const l = e.substring(0, a), h = b(
356
- l,
357
- l.length,
358
- n,
359
- r
360
- );
335
+ function De(e, t, n, r, i, s, a, c = L) {
336
+ if (s && a !== -1) {
337
+ const o = e.substring(0, a), h = c(o, o.length, n);
361
338
  if (t <= h) {
362
- const u = A(
363
- l,
339
+ const d = y(
340
+ o,
364
341
  t,
365
- n,
366
- r
342
+ n
367
343
  );
368
- if (u > 0 && u < l.length && b(
369
- l,
370
- u,
371
- n,
372
- r
373
- ) === t) {
374
- if (l[u] === n && o && s > 0 && u < l.length - 1)
375
- return u + 1;
376
- if (!o && s > 0 && u < l.length - 1)
377
- return Math.min(u + 1, l.length);
378
- }
379
- return u;
344
+ return q(o, d, t, n, r, i, c);
380
345
  }
381
346
  }
382
- const c = A(
347
+ const l = y(
383
348
  e,
384
349
  t,
385
- n,
386
- r
350
+ n
387
351
  );
388
- if (c > 0 && c < e.length && b(
389
- e,
390
- c,
391
- n,
392
- r
393
- ) === t) {
394
- if (e[c] === n && o && s > 0 && c < e.length - 1)
395
- return c + 1;
396
- if (!o && s > 0 && c < e.length - 1)
397
- return Math.min(c + 1, e.length);
398
- }
399
- return c;
352
+ return q(e, l, t, n, r, i, c);
400
353
  }
401
- function we(e, t, n, s, o, r) {
402
- const i = n >= e.length, a = b(
403
- e,
404
- n,
405
- s,
406
- r
407
- ), c = b(
408
- e,
409
- e.length,
410
- s,
411
- r
412
- ), l = b(
413
- t,
414
- t.length,
415
- s,
416
- r
417
- );
418
- if (i || a === c)
354
+ function ve(e, t, n, r, i, s = L) {
355
+ const a = n >= e.length, c = s(e, n, r), l = s(e, e.length, r), o = s(t, t.length, r);
356
+ if (a || c === l)
419
357
  return t.length;
420
- const h = l - c;
421
- let u = a;
422
- h > 0 && !i && a < c && (u = a + 1);
423
- const f = A(
358
+ const h = o - l;
359
+ let d = c;
360
+ h > 0 && !a && c < l && (d = c + 1);
361
+ const u = y(
424
362
  t,
425
- u,
426
- s,
363
+ d,
427
364
  r
428
365
  );
429
- return o && !Q(t, f, s) ? Math.max(0, f - 1) : f;
366
+ return i && !V(t, u, r) ? Math.max(0, u - 1) : u;
430
367
  }
431
- function ve(e, t, n) {
432
- const { selectionStart: s, selectionEnd: o, endOffset: r = 0 } = e;
433
- if (s !== o) {
434
- const h = o - s;
368
+ function we(e, t, n) {
369
+ const { selectionStart: r, selectionEnd: i, endOffset: s = 0 } = e;
370
+ if (r !== i) {
371
+ const h = i - r;
435
372
  return {
436
- start: s,
437
- end: o,
373
+ start: r,
374
+ end: i,
438
375
  deletedLength: h,
439
376
  isDelete: !1
440
377
  };
441
378
  }
442
- if (r > 0) {
443
- const h = r;
379
+ if (s > 0) {
380
+ const h = s;
444
381
  return {
445
- start: s,
446
- end: s + h,
382
+ start: r,
383
+ end: r + h,
447
384
  deletedLength: h,
448
385
  isDelete: !0
449
386
  };
450
387
  }
451
- const a = t.length, c = n.length, l = a - c;
452
- if (!(l <= 0))
388
+ const c = t.length, l = n.length, o = c - l;
389
+ if (!(o <= 0))
453
390
  return {
454
- start: s,
455
- end: s + l,
456
- deletedLength: l,
391
+ start: r,
392
+ end: r + o,
393
+ deletedLength: o,
457
394
  isDelete: !1
458
395
  };
459
396
  }
460
- function ye(e, t) {
397
+ function Ce(e, t) {
461
398
  if (e === t)
462
399
  return;
463
400
  let n = 0;
464
401
  for (; n < e.length && n < t.length && e[n] === t[n]; )
465
402
  n++;
466
- let s = e.length - 1, o = t.length - 1;
467
- for (; s >= n && o >= n && e[s] === t[o]; )
468
- s--, o--;
469
- const r = s - n + 1, i = o - n + 1;
470
- if (!(r === 0 && i === 0))
403
+ let r = e.length - 1, i = t.length - 1;
404
+ for (; r >= n && i >= n && e[r] === t[i]; )
405
+ r--, i--;
406
+ const s = r - n + 1, a = i - n + 1;
407
+ if (!(s === 0 && a === 0))
471
408
  return {
472
409
  start: n,
473
- end: s + 1,
474
- deletedLength: r,
475
- isDelete: r > i
410
+ end: r + 1,
411
+ deletedLength: s,
412
+ isDelete: s > a
476
413
  };
477
414
  }
478
- function J(e, t) {
415
+ function H(e, t) {
479
416
  if (e.value = e.value, e === null)
480
417
  return !1;
481
418
  if (e.createTextRange) {
@@ -485,442 +422,172 @@ function J(e, t) {
485
422
  return e.selectionStart !== null || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
486
423
  }
487
424
  function Me(e, t, n) {
488
- return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (J(e, t), setTimeout(() => {
489
- e.value === n && e.selectionStart !== t && J(e, t);
425
+ return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (H(e, t), setTimeout(() => {
426
+ e.value === n && e.selectionStart !== t && H(e, t);
490
427
  }, 0));
491
428
  }
492
- function xe(e) {
429
+ function Ae(e) {
493
430
  return Math.max(e.selectionStart, e.selectionEnd);
494
431
  }
495
- function Ce(e, t, n) {
496
- if ((n == null ? void 0 : n.formatOn) !== m.Change || !n.thousandSeparator)
432
+ function Re(e, t, n) {
433
+ if ((n == null ? void 0 : n.formatOn) !== b.Change || !n.thousandSeparator)
497
434
  return;
498
- const { selectionStart: s, selectionEnd: o, value: r } = t;
499
- if (s === null || o === null || s !== o)
435
+ const { selectionStart: r, selectionEnd: i, value: s } = t;
436
+ if (r === null || i === null || r !== i)
500
437
  return;
501
- const { key: i } = e, a = n.thousandSeparator;
502
- i === "Backspace" && s > 0 && r[s - 1] === a && t.setSelectionRange(s - 1, s - 1), i === "Delete" && r[s] === a && t.setSelectionRange(s + 1, s + 1);
503
- }
504
- function Ae(e, t, n, s, o, r, i) {
505
- if (!o) return;
506
- const { selectionStart: a = 0, selectionEnd: c = 0, endOffset: l = 0 } = o;
507
- let h = ve(
508
- { selectionStart: a, selectionEnd: c, endOffset: l },
438
+ const { key: a } = e, c = n.thousandSeparator;
439
+ a === "Backspace" && r > 0 && s[r - 1] === c && t.setSelectionRange(r - 1, r - 1), a === "Delete" && s[r] === c && t.setSelectionRange(r + 1, r + 1);
440
+ }
441
+ function ye(e, t, n, r, i, s, a) {
442
+ if (!i) return;
443
+ const { selectionStart: c = 0, selectionEnd: l = 0, endOffset: o = 0 } = i;
444
+ let h = we(
445
+ { selectionStart: c, selectionEnd: l, endOffset: o },
509
446
  t,
510
447
  n
511
448
  );
512
- if (h || (h = ye(t, n)), !h) return;
513
- const u = $e(n, {
514
- thousandSeparator: (i == null ? void 0 : i.thousandSeparator) ?? r.thousandSeparator,
515
- decimalSeparator: r.decimalSeparator
516
- }), f = {
517
- thousandSeparator: (i == null ? void 0 : i.thousandSeparator) ?? r.thousandSeparator,
518
- isCharacterEquivalent: H,
519
- boundary: u
520
- }, d = (i == null ? void 0 : i.thousandSeparator) ?? r.thousandSeparator ?? ",", g = (i == null ? void 0 : i.ThousandStyle) ?? S.None, p = me(
449
+ if (h || (h = Ce(t, n)), !h) return;
450
+ const d = pe(n, {
451
+ thousandSeparator: (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator,
452
+ decimalSeparator: s.decimalSeparator
453
+ }), u = {
454
+ thousandSeparator: (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator,
455
+ isCharacterEquivalent: F,
456
+ boundary: d
457
+ }, g = (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator ?? ",", f = (a == null ? void 0 : a.ThousandStyle) ?? p.None, S = be(
521
458
  t,
522
459
  n,
523
- s,
524
- d,
460
+ r,
525
461
  g,
526
- h,
527
- r.decimalSeparator,
528
- f
529
- );
530
- Me(e, p, n);
531
- }
532
- function X(e) {
533
- const [t, n = ""] = e.split(".");
534
- return t.length + n.length > 30;
535
- }
536
- function Y(e, t) {
537
- const n = e.replace(".", ""), s = t.replace(".", ""), o = Math.max(n.length, s.length), r = n.padStart(o, "0"), i = s.padStart(o, "0");
538
- for (let a = 0; a < o; a++) {
539
- const c = parseInt(r[a], 10), l = parseInt(i[a], 10);
540
- if (c !== l)
541
- return c - l;
542
- }
543
- return 0;
544
- }
545
- const Te = [
546
- { suffix: "N", zeros: 30 },
547
- // Nonillion
548
- { suffix: "O", zeros: 27 },
549
- // Octillion
550
- { suffix: "Sp", zeros: 24 },
551
- // Septillion
552
- { suffix: "Sx", zeros: 21 },
553
- // Sextillion
554
- { suffix: "Qi", zeros: 18 },
555
- // Quintillion
556
- { suffix: "Qa", zeros: 15 },
557
- // Quadrillion
558
- { suffix: "T", zeros: 12 },
559
- // Trillion
560
- { suffix: "B", zeros: 9 },
561
- // Billion
562
- { suffix: "M", zeros: 6 },
563
- // Million
564
- { suffix: "k", zeros: 3 }
565
- // Thousand
566
- ];
567
- function V(e, t, n = 0) {
568
- const [s, o = ""] = e.split(t), r = s.replace(/^0+/, "") || "0";
569
- for (const i of Te)
570
- if (i.zeros >= n && (r.length > i.zeros || r.length === i.zeros && o.length > 0)) {
571
- const a = i.zeros;
572
- if (r.length > a) {
573
- const c = r.slice(0, -a), u = (r.slice(-a) + o).replace(/0+$/, "");
574
- return { scaledValue: u ? `${c}${t}${u}` : c, scaleSuffix: i.suffix };
575
- } else {
576
- const c = a - r.length, l = "0", u = ("0".repeat(c) + r + o).replace(/0+$/, "");
577
- return { scaledValue: u ? `${l}${t}${u}` : l, scaleSuffix: i.suffix };
578
- }
579
- }
580
- return { scaledValue: e, scaleSuffix: "" };
581
- }
582
- function P(e, t, n, s, o = !1, r = !1) {
583
- if (r && o && n > 0)
584
- return `0${s}${"0".repeat(n)}`;
585
- const [i, a = ""] = e.split(s);
586
- let c;
587
- if (t === 0)
588
- c = i;
589
- else if (a.length === 0) {
590
- const l = "0".repeat(Math.max(t, n));
591
- c = `${i}${s}${l}`;
592
- } else if (a.length < t) {
593
- const l = Math.max(t - a.length, n - a.length);
594
- c = `${i}${s}${a}${"0".repeat(l)}`;
595
- } else
596
- c = `${i}${s}${a.slice(0, t)}`;
597
- if (n > 0) {
598
- const [l, h = ""] = c.split(s);
599
- if (h.length < n) {
600
- const u = n - h.length;
601
- c = `${l}${s}${h}${"0".repeat(u)}`;
602
- }
603
- }
604
- if (n === 0)
605
- c = c.replace(/(\.[0-9]*?)0+$/, "$1").replace(/\.$/, "");
606
- else {
607
- const [l, h = ""] = c.split(s);
608
- if (h) {
609
- const u = h.replace(/0+$/, ""), f = u.length >= n ? u : h.slice(0, n);
610
- c = f ? `${l}${s}${f}` : l;
611
- }
612
- }
613
- return c;
614
- }
615
- function F(e, t) {
616
- return !e || e === "0" || e === t || e === "-" || e === `-${t}`;
617
- }
618
- function ee(e) {
619
- const t = e.startsWith("-");
620
- return { isNegative: t, absoluteValue: t ? e.slice(1) : e };
621
- }
622
- function te(e, t) {
623
- if (!e || e === "0")
624
- return "0";
625
- const n = e.includes(t), [s, o = ""] = n ? e.split(t) : [e, ""];
626
- let r;
627
- if (o.length <= 2) {
628
- const a = 2 - o.length;
629
- r = s + o + "0".repeat(a);
630
- } else
631
- r = s + o.slice(0, 2) + t + o.slice(2);
632
- let i = r.replace(/^0+/, "") || "0";
633
- if (i.startsWith(t) && (i = "0" + i), i.includes(t)) {
634
- const [a, c] = i.split(t);
635
- return a === "0" && !c ? "0" : i;
636
- }
637
- return i;
638
- }
639
- function Ie(e, t) {
640
- const { decimals: n, decimalSeparator: s, thousandSeparator: o, thousandStyle: r, decimalsMin: i = 0 } = t;
641
- if (F(e, s))
642
- return "0";
643
- const { isNegative: a, absoluteValue: c } = ee(e), l = te(c, s);
644
- let h = l;
645
- o && r !== S.None && (h = y(l, o, r, !1, s));
646
- const u = P(
647
- h,
648
- n,
649
- i,
650
- s,
651
- !1,
652
- e === "0"
653
- );
654
- return `${a ? "-" : ""}${u}`;
655
- }
656
- function ot(e, t = 2, n = N, s, o = S.None) {
657
- const r = Ie(e, {
658
- decimals: t,
659
- decimalSeparator: n,
660
- thousandSeparator: s,
661
- thousandStyle: o,
662
- decimalsMin: t
663
- // Use decimals as decimalsMin to ensure trailing zeros are shown
664
- });
665
- return r === "0" ? "0%" : `${r}%`;
666
- }
667
- function at(e, t = 2, n = {}) {
668
- const {
669
- missingPlaceholder: s = "?",
670
- veryLargePlaceholder: o = "🔥",
671
- decimalsUnder: r = 1e3,
672
- decimalSeparator: i = N,
673
- thousandSeparator: a,
674
- thousandStyle: c = S.None
675
- } = n;
676
- if (e == null || e === "")
677
- return s;
678
- if (F(e, i))
679
- return "0%";
680
- const { isNegative: l, absoluteValue: h } = ee(e), u = te(h, i);
681
- if (X(u))
682
- return o;
683
- const { scaledValue: f, scaleSuffix: d } = V(u, i), p = Y(f, r.toString()) < 0 ? t : 0;
684
- let $ = f;
685
- a && c !== S.None && ($ = y(f, a, c, !1, i));
686
- const D = P(
687
- $,
688
- p,
689
- p,
690
- i,
691
- !1,
692
- !1
693
- );
694
- return `${l ? "-" : ""}${D}${d}%`;
695
- }
696
- function Pe(e) {
697
- const t = "₀₁₂₃₄₅₆₇₈₉";
698
- return e.replace(/[0-9]/g, (n) => t[+n]);
699
- }
700
- function ct(e, t = 8, n = N) {
701
- if (!e || !e.includes(n))
702
- return e;
703
- const s = e.startsWith("-"), o = s ? e.slice(1) : e, [r, i] = o.split(n);
704
- if (!i || !i.length)
705
- return e;
706
- const a = i.match(/^(0{3,})/);
707
- if (!a)
708
- return e;
709
- const l = a[1].length, h = i.slice(l), u = r === "0" && l >= 5 ? l + 1 : l, f = Pe(u.toString());
710
- let d = `0${f}${h}`;
711
- const g = f.length, p = Math.max(0, t - g - 1);
712
- h.length > p && (d = `0${f}${h.slice(0, p)}`), d = d.replace(/0+$/, "");
713
- const $ = r === "0" ? d : `${r}${d}`;
714
- return s ? `-${$}` : $;
715
- }
716
- const E = {
717
- minScale: 0,
718
- decimalsUnder: 1e3,
719
- decimals: 2,
720
- decimalsMin: 0,
721
- decimalsMinAppliesToZero: !1,
722
- veryLargePlaceholder: "🔥",
723
- decimalSeparator: N
724
- };
725
- function lt(e, t = {}) {
726
- const {
727
- minScale: n = E.minScale,
728
- decimalsUnder: s = E.decimalsUnder,
729
- decimals: o = E.decimals,
730
- decimalsMin: r = E.decimalsMin,
731
- decimalsMinAppliesToZero: i = E.decimalsMinAppliesToZero,
732
- veryLargePlaceholder: a = E.veryLargePlaceholder,
733
- decimalSeparator: c = E.decimalSeparator,
734
- thousandSeparator: l,
735
- thousandStyle: h = S.None
736
- } = t;
737
- if (!e || e === "0" || e === c || e === "-" || e === `-${c}`)
738
- return i && r > 0 ? `0${c}${"0".repeat(r)}` : "0";
739
- const u = e.startsWith("-"), f = u ? e.slice(1) : e;
740
- if (X(f))
741
- return a;
742
- const { scaledValue: d, scaleSuffix: g } = V(
743
462
  f,
744
- c,
745
- n
746
- ), $ = Y(d, s.toString()) < 0 ? o : 0;
747
- let D = d;
748
- l && h !== S.None && (D = y(
749
- d,
750
- l,
751
463
  h,
752
- !1,
753
- c
754
- ));
755
- const R = P(
756
- D,
757
- $,
758
- r,
759
- c,
760
- i,
761
- e === "0"
762
- // Pass whether the original value is '0'
464
+ s.decimalSeparator,
465
+ u
763
466
  );
764
- return `${u ? "-" : ""}${R}${g}`;
467
+ Me(e, S, n);
765
468
  }
766
- function x(e) {
767
- return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
768
- }
769
- const Oe = (e, t = !1, n = ".") => {
770
- const s = x(n), o = new RegExp(`[^0-9${s}]`, "g");
469
+ const Ie = (e, t = !1, n = ".") => {
470
+ const r = w(n), i = I(`[^0-9${r}]`, "g");
771
471
  if (!t)
772
- return e.replace(o, "");
773
- const r = e.startsWith("-"), i = e.replace(o, "");
774
- if (r) {
775
- if (i.length > 0)
776
- return "-" + i;
777
- if (e === "-")
778
- return "-";
779
- }
780
- return i;
781
- };
782
- function Re(e) {
783
- const t = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g;
784
- let n = e, s;
785
- const o = [];
786
- for (; (s = t.exec(e)) !== null; ) {
787
- const r = s[0], i = s[1], a = parseInt(s[2], 10);
788
- let c;
789
- if (a === 0)
790
- c = i;
791
- else {
792
- const l = i.startsWith("-"), h = l ? i.slice(1) : i, [u, f = ""] = h.split(".");
793
- a > 0 ? c = _e(u, f, a) : c = ze(u, f, Math.abs(a)), l && (c = "-" + c);
794
- }
795
- o.push({ full: r, expanded: c });
796
- }
797
- for (const { full: r, expanded: i } of o)
798
- n = n.replace(r, i);
799
- return n;
472
+ return e.replace(i, "");
473
+ const s = e.startsWith("-"), a = e.replace(i, "");
474
+ return s && (a.length > 0 || e === "-") ? "-" + a : a;
475
+ }, Te = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g, ee = /^0+$/, A = /\.?0+$/;
476
+ function _e(e) {
477
+ return !e.includes("e") && !e.includes("E") ? e : e.replace(Te, (t, n, r) => {
478
+ const i = parseInt(r, 10);
479
+ if (i === 0) return n;
480
+ const s = n.startsWith("-"), a = s ? n.slice(1) : n, [c, l = ""] = a.split("."), o = i > 0 ? Oe(c, l, i) : xe(c, l, Math.abs(i));
481
+ return s ? "-" + o : o;
482
+ });
800
483
  }
801
- function _e(e, t, n) {
802
- const s = e + t;
803
- if (s === "0" || s.match(/^0+$/))
484
+ function Oe(e, t, n) {
485
+ const r = e + t;
486
+ if (r === "0" || ee.test(r))
804
487
  return "0";
805
- const o = t.length;
806
- if (n <= o) {
807
- const i = s.slice(0, e.length + n), a = s.slice(e.length + n);
808
- return a ? `${i}.${a}` : i;
488
+ const i = t.length;
489
+ if (n <= i) {
490
+ const a = r.slice(0, e.length + n), c = r.slice(e.length + n);
491
+ return c ? `${a}.${c}` : a;
809
492
  }
810
- const r = n - o;
811
- return s + "0".repeat(r);
493
+ const s = n - i;
494
+ return r + "0".repeat(s);
812
495
  }
813
- function ze(e, t, n) {
814
- const s = e + t;
815
- if (s === "0" || s.match(/^0+$/))
496
+ function xe(e, t, n) {
497
+ const r = e + t;
498
+ if (r === "0" || ee.test(r))
816
499
  return "0";
817
- const i = e.length - n;
818
- if (i <= 0) {
819
- const a = Math.abs(i), c = `0.${"0".repeat(a)}${s}`;
820
- return C(c);
500
+ const s = e.length - n;
501
+ if (s <= 0) {
502
+ const a = Math.abs(s), c = `0.${"0".repeat(a)}${r}`;
503
+ return R(c);
821
504
  }
822
- if (i < e.length) {
823
- const a = s.slice(0, i), c = s.slice(i), l = `${a}.${c}`;
824
- return C(l);
505
+ if (s < e.length) {
506
+ const a = r.slice(0, s), c = r.slice(s), l = `${a}.${c}`;
507
+ return R(l);
825
508
  }
826
- return C(s);
509
+ return R(r);
827
510
  }
828
- function C(e) {
511
+ function R(e) {
829
512
  if (!e.includes("."))
830
513
  return e;
831
- if (e === "0" || e === "0.")
514
+ if (e === "0.")
832
515
  return "0";
833
516
  if (e.startsWith("0.")) {
834
- const t = e.replace(/\.?0+$/, "");
517
+ const t = e.replace(A, "");
835
518
  return t === "0" ? "0" : t || "0";
836
519
  }
837
520
  if (e.startsWith("-0.")) {
838
- const t = e.replace(/\.?0+$/, "");
521
+ const t = e.replace(A, "");
839
522
  return t === "-0" || t === "0" ? "0" : t || "0";
840
523
  }
841
- return e.replace(/\.?0+$/, "") || e;
524
+ return e.replace(A, "") || e;
842
525
  }
843
- function Ze(e) {
844
- const t = /(\d+\.?\d*)\s*(Qa|Qi|Sx|Sp|[kmbMTO]|N)/gi;
845
- return e.replace(t, (n, s, o) => {
846
- const r = {
847
- k: 3,
848
- // Thousand
849
- K: 3,
850
- // Thousand
851
- m: 6,
852
- // Million (lowercase)
853
- M: 6,
854
- // Million (uppercase)
855
- b: 9,
856
- // Billion
857
- B: 9,
858
- // Billion
859
- T: 12,
860
- // Trillion
861
- t: 12
862
- // Trillion
863
- };
864
- let i;
865
- if (o.length > 1) {
866
- const d = o.charAt(0).toUpperCase() + o.slice(1).toLowerCase();
867
- i = r[o] || r[d];
868
- } else {
869
- const d = o.toLowerCase();
870
- i = r[o] || r[d];
871
- }
872
- if (!i)
873
- return n;
874
- const a = s.startsWith("-"), c = a ? s.slice(1) : s, [l, h = ""] = c.split("."), u = l.replace(/^0+/, "") || "0";
875
- let f;
876
- if (h.length === 0)
877
- f = u + "0".repeat(i);
878
- else if (h.length <= i) {
879
- const d = i - h.length;
880
- f = u + h + "0".repeat(d);
526
+ const Ge = /(\d+\.?\d*)\s*([kmbt])/gi, Ze = /^0+/, ke = /^(-?)0+([1-9])/, Be = /^-?0+$/, Pe = /\.?0+$/, We = {
527
+ k: 3,
528
+ // Thousand
529
+ m: 6,
530
+ // Million
531
+ b: 9,
532
+ // Billion
533
+ t: 12
534
+ // Trillion
535
+ };
536
+ function Ue(e) {
537
+ return e.replace(Ge, (t, n, r) => {
538
+ const i = r.toLowerCase(), s = We[i];
539
+ if (!s)
540
+ return t;
541
+ const [a, c = ""] = n.split("."), l = a.replace(Ze, "") || "0";
542
+ let o;
543
+ if (c.length === 0)
544
+ o = l + "0".repeat(s);
545
+ else if (c.length <= s) {
546
+ const h = s - c.length;
547
+ o = l + c + "0".repeat(h);
881
548
  } else {
882
- const d = h.slice(0, i), g = h.slice(i);
883
- f = u + d + "." + g;
549
+ const h = c.slice(0, s), d = c.slice(s);
550
+ o = l + h + "." + d;
884
551
  }
885
- return f = f.replace(/^(-?)0+([1-9])/, "$1$2"), f.match(/^-?0+$/) && (f = a ? "-0" : "0"), f.includes(".") && (f = f.replace(/\.?0+$/, "")), a && !f.startsWith("-") ? "-" + f : f;
552
+ return o = o.replace(ke, "$1$2"), Be.test(o) && (o = "0"), o.includes(".") && (o = o.replace(Pe, "")), o;
886
553
  });
887
554
  }
888
- function Be(e) {
555
+ function ze(e) {
889
556
  if (!e || e === "0" || e === "-0" || e === "-" || e === ".")
890
557
  return e;
891
558
  const t = e.startsWith("-"), n = t ? e.slice(1) : e;
892
- if (!n || n === "0" || n === ".")
559
+ if (n === ".")
893
560
  return e;
894
561
  if (n.includes(".")) {
895
- const [o, r] = n.split(".");
896
- if (o && o.length > 0) {
897
- const a = (o.replace(/^0+/, "") || "0") + "." + r;
898
- return t ? "-" + a : a;
562
+ const [i, s] = n.split(".");
563
+ if (i) {
564
+ const c = (i.replace(/^0+/, "") || "0") + "." + s;
565
+ return t ? "-" + c : c;
899
566
  }
900
567
  return e;
901
568
  }
902
- if (n.startsWith("0") && n.length > 1) {
903
- const o = n.replace(/^0+/, "") || "0";
904
- return t ? "-" + o : o;
569
+ if (n.startsWith("0")) {
570
+ const i = n.replace(/^0+/, "") || "0";
571
+ return t ? "-" + i : i;
905
572
  }
906
573
  return e;
907
574
  }
908
- function We(e) {
909
- return e.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000]/g, " ").replace(/\s/g, "");
575
+ function Je(e) {
576
+ return e.replace(/[\s\u200B]/g, "");
910
577
  }
911
- function v(e, t) {
912
- const n = x(t);
913
- return e.replace(new RegExp(n, "g"), "");
578
+ function D(e, t) {
579
+ const n = se(t);
580
+ return e.replace(n, "");
914
581
  }
915
- const ke = (e, t) => {
916
- let n = We(e);
917
- return t != null && t.thousandSeparator && (n = v(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = Ze(n)), n = Re(n), n = Oe(
582
+ const Xe = (e, t) => {
583
+ let n = Je(e);
584
+ return t != null && t.thousandSeparator && (n = D(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = Ue(n)), n = _e(n), n = Ie(
918
585
  n,
919
586
  t == null ? void 0 : t.enableNegative,
920
587
  t == null ? void 0 : t.decimalSeparator
921
- ), n = he(n, (t == null ? void 0 : t.decimalSeparator) || N), t != null && t.enableLeadingZeros || (n = Be(n)), n;
588
+ ), n = he(n, t == null ? void 0 : t.decimalSeparator), t != null && t.enableLeadingZeros || (n = ze(n)), n;
922
589
  };
923
- function Ue(e, t, n) {
590
+ function je(e, t, n) {
924
591
  return {
925
592
  enableCompactNotation: e == null ? void 0 : e.enableCompactNotation,
926
593
  enableNegative: e == null ? void 0 : e.enableNegative,
@@ -929,31 +596,31 @@ function Ue(e, t, n) {
929
596
  thousandSeparator: n ? t.thousandSeparator : void 0
930
597
  };
931
598
  }
932
- function O(e, t, n, s) {
933
- const o = T(n), r = s ?? (n == null ? void 0 : n.formatOn) === m.Change, i = ke(
599
+ function O(e, t, n, r) {
600
+ const i = T(n), s = r ?? (n == null ? void 0 : n.formatOn) === b.Change, a = Xe(
934
601
  e,
935
- Ue(n, o, r)
936
- ), a = le(
937
- i,
938
- t,
939
- o.decimalSeparator
940
- ), c = (n == null ? void 0 : n.decimalMinLength) ?? 0, l = ue(
602
+ je(n, i, s)
603
+ ), c = le(
941
604
  a,
605
+ t,
606
+ i.decimalSeparator
607
+ ), l = (n == null ? void 0 : n.decimalMinLength) ?? 0, o = ue(
942
608
  c,
943
- o.decimalSeparator
944
- ), h = l;
945
- return { formatted: pe(l, n, o), raw: h };
609
+ l,
610
+ i.decimalSeparator
611
+ );
612
+ return { formatted: ge(o, n, i), raw: o };
946
613
  }
947
614
  function ht(e, t, n) {
948
- const s = !!(n != null && n.thousandSeparator);
615
+ const r = !!(n != null && n.thousandSeparator);
949
616
  return O(
950
617
  e,
951
618
  t,
952
619
  n,
953
- s
620
+ r
954
621
  );
955
622
  }
956
- function Ge(e, t, n) {
623
+ function Ke(e, t, n) {
957
624
  if (e === "Backspace" || e === "Delete")
958
625
  return e === "Delete" && t === n ? {
959
626
  endOffset: 1
@@ -961,61 +628,61 @@ function Ge(e, t, n) {
961
628
  endOffset: 0
962
629
  };
963
630
  }
964
- function je(e, t) {
965
- const { decimalSeparator: n } = T(t), s = e.target;
966
- if (ce(e, s, n)) {
631
+ function qe(e, t) {
632
+ const { decimalSeparator: n } = T(t), r = e.target;
633
+ if (oe(e, r, n)) {
967
634
  e.preventDefault();
968
635
  return;
969
636
  }
970
- return Ce(e, s, t), Ge(e.key, s.selectionStart, s.selectionEnd);
637
+ return Re(e, r, t), Ke(e.key, r.selectionStart, r.selectionEnd);
971
638
  }
972
- function Je(e, t, n, s) {
973
- const o = e.target, r = o.value, i = xe(o), a = T(s), c = (s == null ? void 0 : s.formatOn) === m.Change, { formatted: l, raw: h } = O(
974
- r,
975
- t,
639
+ function He(e, t, n, r) {
640
+ const i = e.target, s = i.value, a = Ae(i), c = T(r), l = (r == null ? void 0 : r.formatOn) === b.Change, { formatted: o, raw: h } = O(
976
641
  s,
977
- c
978
- );
979
- return o.value = l, r !== l && Ae(
980
- o,
642
+ t,
981
643
  r,
982
- l,
644
+ l
645
+ );
646
+ return i.value = o, s !== o && ye(
983
647
  i,
984
- n,
648
+ s,
649
+ o,
985
650
  a,
986
- s
987
- ), { formatted: l, raw: h };
651
+ n,
652
+ c,
653
+ r
654
+ ), { formatted: o, raw: h };
988
655
  }
989
- function Ke(e, t, n, s) {
990
- const o = s - n;
991
- return e + t + o;
656
+ function Ye(e, t, n, r) {
657
+ const i = r - n;
658
+ return e + t + i;
992
659
  }
993
- function qe(e, t, n) {
994
- var f;
660
+ function Qe(e, t, n) {
661
+ var u;
995
662
  e.preventDefault();
996
- const s = e.target, { value: o, selectionStart: r, selectionEnd: i } = s, a = ((f = e.clipboardData) == null ? void 0 : f.getData("text/plain")) || "", c = o.slice(0, r || 0) + a + o.slice(i || 0), { formatted: l, raw: h } = O(
997
- c,
663
+ const r = e.target, { value: i, selectionStart: s, selectionEnd: a } = r, c = ((u = e.clipboardData) == null ? void 0 : u.getData("text/plain")) || "", l = i.slice(0, s || 0) + c + i.slice(a || 0), { formatted: o, raw: h } = O(
664
+ l,
998
665
  t,
999
666
  n,
1000
667
  !0
1001
668
  );
1002
- s.value = l;
1003
- const u = Ke(
1004
- r || 0,
1005
- a.length,
669
+ r.value = o;
670
+ const d = Ye(
671
+ s || 0,
1006
672
  c.length,
1007
- l.length
673
+ l.length,
674
+ o.length
1008
675
  );
1009
- return s.setSelectionRange(u, u), { formatted: l, raw: h };
676
+ return r.setSelectionRange(d, d), { formatted: o, raw: h };
1010
677
  }
1011
- function Qe(e, t) {
1012
- const n = x(e);
678
+ function Ve(e, t) {
679
+ const n = w(e);
1013
680
  return t ? `^-?[0-9]*[${n}]?[0-9]*$` : `^[0-9]*[${n}]?[0-9]*$`;
1014
681
  }
1015
- function He(e) {
1016
- Xe(e.decimalMaxLength), Ye(e.decimalMinLength), Ve(e.decimalMinLength, e.decimalMaxLength), Fe(e.formatOn), et(e.thousandSeparator), tt(e.thousandStyle), nt(e.decimalSeparator), st(e.thousandSeparator, e.decimalSeparator), M("enableCompactNotation", e.enableCompactNotation), M("enableNegative", e.enableNegative), M("enableLeadingZeros", e.enableLeadingZeros), M("rawValueMode", e.rawValueMode), rt(e.onChange);
682
+ function Fe(e) {
683
+ et(e.decimalMaxLength), tt(e.decimalMinLength), nt(e.decimalMinLength, e.decimalMaxLength), rt(e.formatOn), it(e.thousandSeparator), st(e.thousandStyle), at(e.decimalSeparator), ct(e.thousandSeparator, e.decimalSeparator), M("enableCompactNotation", e.enableCompactNotation), M("enableNegative", e.enableNegative), M("enableLeadingZeros", e.enableLeadingZeros), M("rawValueMode", e.rawValueMode), ot(e.onChange);
1017
684
  }
1018
- function Xe(e) {
685
+ function et(e) {
1019
686
  if (e !== void 0) {
1020
687
  if (typeof e != "number")
1021
688
  throw new Error(
@@ -1031,7 +698,7 @@ function Xe(e) {
1031
698
  );
1032
699
  }
1033
700
  }
1034
- function Ye(e) {
701
+ function tt(e) {
1035
702
  if (e !== void 0) {
1036
703
  if (typeof e != "number")
1037
704
  throw new Error(
@@ -1047,19 +714,19 @@ function Ye(e) {
1047
714
  );
1048
715
  }
1049
716
  }
1050
- function Ve(e, t) {
717
+ function nt(e, t) {
1051
718
  if (!(e === void 0 || t === void 0) && e > t)
1052
719
  throw new Error(
1053
720
  `decimalMinLength (${e}) cannot be greater than decimalMaxLength (${t}).`
1054
721
  );
1055
722
  }
1056
- function Fe(e) {
1057
- if (e !== void 0 && e !== m.Blur && e !== m.Change)
723
+ function rt(e) {
724
+ if (e !== void 0 && e !== b.Blur && e !== b.Change)
1058
725
  throw new Error(
1059
- `formatOn must be either ${m.Blur} or ${m.Change}. Received: ${JSON.stringify(e)}`
726
+ `formatOn must be either ${b.Blur} or ${b.Change}. Received: ${JSON.stringify(e)}`
1060
727
  );
1061
728
  }
1062
- function et(e) {
729
+ function it(e) {
1063
730
  if (e !== void 0) {
1064
731
  if (typeof e != "string")
1065
732
  throw new Error(
@@ -1075,13 +742,13 @@ function et(e) {
1075
742
  );
1076
743
  }
1077
744
  }
1078
- function tt(e) {
1079
- if (e !== void 0 && !Object.values(S).includes(e))
745
+ function st(e) {
746
+ if (e !== void 0 && !Object.values(p).includes(e))
1080
747
  throw new Error(
1081
- `ThousandStyle must be one of: ${Object.values(S).map((t) => `'${t}'`).join(", ")}. Received: ${JSON.stringify(e)}`
748
+ `ThousandStyle must be one of: ${Object.values(p).map((t) => `'${t}'`).join(", ")}. Received: ${JSON.stringify(e)}`
1082
749
  );
1083
750
  }
1084
- function nt(e) {
751
+ function at(e) {
1085
752
  if (e !== void 0) {
1086
753
  if (typeof e != "string")
1087
754
  throw new Error(
@@ -1097,7 +764,7 @@ function nt(e) {
1097
764
  );
1098
765
  }
1099
766
  }
1100
- function st(e, t) {
767
+ function ct(e, t) {
1101
768
  if (!(e === void 0 || t === void 0) && e === t)
1102
769
  throw new Error(
1103
770
  `Decimal separator can't be same as thousand separator. thousandSeparator: ${e}, decimalSeparator: ${t}`
@@ -1109,7 +776,7 @@ function M(e, t) {
1109
776
  `${e} must be a boolean. Received: ${typeof t} (${JSON.stringify(t)})`
1110
777
  );
1111
778
  }
1112
- function rt(e) {
779
+ function ot(e) {
1113
780
  if (e !== void 0 && typeof e != "function")
1114
781
  throw new Error(
1115
782
  `onChange must be a function or undefined. Received: ${typeof e} (${JSON.stringify(e)})`
@@ -1117,99 +784,98 @@ function rt(e) {
1117
784
  }
1118
785
  class ut {
1119
786
  constructor(t, {
1120
- decimalMaxLength: n = _,
1121
- decimalMinLength: s = z,
1122
- formatOn: o = Z,
1123
- thousandSeparator: r = B,
1124
- thousandStyle: i = W,
1125
- decimalSeparator: a = N,
1126
- enableCompactNotation: c = !0,
1127
- enableNegative: l = k,
787
+ decimalMaxLength: n = x,
788
+ decimalMinLength: r = G,
789
+ formatOn: i = Z,
790
+ thousandSeparator: s = k,
791
+ thousandStyle: a = B,
792
+ decimalSeparator: c = N,
793
+ enableCompactNotation: l = P,
794
+ enableNegative: o = W,
1128
795
  enableLeadingZeros: h = U,
1129
- rawValueMode: u = G,
1130
- onChange: f,
1131
- ...d
796
+ rawValueMode: d = z,
797
+ onChange: u,
798
+ ...g
1132
799
  }) {
1133
- w(this, "element");
1134
- w(this, "options");
1135
- w(this, "resolvedOptions");
1136
- w(this, "rawValue", "");
1137
- w(this, "caretPositionBeforeChange");
1138
- if (He({
800
+ $(this, "element");
801
+ $(this, "options");
802
+ $(this, "resolvedOptions");
803
+ $(this, "rawValue", "");
804
+ $(this, "caretPositionBeforeChange");
805
+ if (Fe({
1139
806
  decimalMaxLength: n,
1140
- decimalMinLength: s,
1141
- formatOn: o,
1142
- thousandSeparator: r,
1143
- thousandStyle: i,
1144
- decimalSeparator: a,
1145
- enableCompactNotation: c,
1146
- enableNegative: l,
807
+ decimalMinLength: r,
808
+ formatOn: i,
809
+ thousandSeparator: s,
810
+ thousandStyle: a,
811
+ decimalSeparator: c,
812
+ enableCompactNotation: l,
813
+ enableNegative: o,
1147
814
  enableLeadingZeros: h,
1148
- rawValueMode: u,
1149
- onChange: f
815
+ rawValueMode: d,
816
+ onChange: u
1150
817
  }), this.options = {
1151
818
  decimalMaxLength: n,
1152
- decimalMinLength: s,
1153
- onChange: f,
1154
- formatOn: o,
1155
- thousandSeparator: r,
1156
- thousandStyle: i,
1157
- decimalSeparator: a,
1158
- enableCompactNotation: c,
1159
- enableNegative: l,
819
+ decimalMinLength: r,
820
+ onChange: u,
821
+ formatOn: i,
822
+ thousandSeparator: s,
823
+ thousandStyle: a,
824
+ decimalSeparator: c,
825
+ enableCompactNotation: l,
826
+ enableNegative: o,
1160
827
  enableLeadingZeros: h,
1161
- rawValueMode: u,
1162
- ...d
828
+ rawValueMode: d,
829
+ ...g
1163
830
  }, this.resolvedOptions = this.getResolvedOptions(), this.createInputElement(t), this.setupEventListeners(), this.resolvedOptions.rawValueMode && this.element.value) {
1164
- const g = this.element.value, p = this.resolvedOptions.thousandSeparator ? v(g, this.resolvedOptions.thousandSeparator) : g;
1165
- this.rawValue = p, this.element.value = this.formatValueForDisplay(p);
831
+ const f = this.element.value, S = this.resolvedOptions.thousandSeparator ? D(f, this.resolvedOptions.thousandSeparator) : f;
832
+ this.rawValue = S, this.element.value = this.formatValueForDisplay(S);
1166
833
  } else if (this.element.value) {
1167
- const g = this.element.value;
1168
- this.element.value = this.formatValueForDisplay(g);
834
+ const f = this.element.value;
835
+ this.element.value = this.formatValueForDisplay(f);
1169
836
  }
1170
837
  }
1171
838
  createInputElement(t) {
1172
- if (this.element = document.createElement("input"), this.element.setAttribute("type", "text"), this.element.setAttribute("inputmode", "decimal"), this.element.setAttribute("spellcheck", "false"), this.element.setAttribute("autocomplete", "off"), this.resolvedOptions.decimalSeparator !== void 0 && this.resolvedOptions.enableNegative !== void 0) {
1173
- const se = Qe(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
1174
- this.element.setAttribute("pattern", se);
1175
- }
839
+ this.element = document.createElement("input"), this.element.setAttribute("type", "text"), this.element.setAttribute("inputmode", "decimal"), this.element.setAttribute("spellcheck", "false"), this.element.setAttribute("autocomplete", "off");
840
+ const n = Ve(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
841
+ this.element.setAttribute("pattern", n);
1176
842
  const {
1177
- decimalMaxLength: n,
1178
- decimalMinLength: s,
1179
- formatOn: o,
1180
- thousandSeparator: r,
1181
- thousandStyle: i,
1182
- decimalSeparator: a,
1183
- enableCompactNotation: c,
1184
- enableNegative: l,
1185
- enableLeadingZeros: h,
843
+ decimalMaxLength: r,
844
+ decimalMinLength: i,
845
+ formatOn: s,
846
+ thousandSeparator: a,
847
+ thousandStyle: c,
848
+ decimalSeparator: l,
849
+ enableCompactNotation: o,
850
+ enableNegative: h,
851
+ enableLeadingZeros: d,
1186
852
  rawValueMode: u,
1187
- onChange: f,
1188
- value: d,
1189
- defaultValue: g,
1190
- type: p,
1191
- inputMode: $,
1192
- spellcheck: D,
1193
- autocomplete: R,
853
+ onChange: g,
854
+ value: f,
855
+ defaultValue: S,
856
+ type: E,
857
+ inputMode: m,
858
+ spellcheck: te,
859
+ autocomplete: C,
1194
860
  ...ne
1195
861
  } = this.options;
1196
- Object.assign(this.element, ne), d !== void 0 ? this.element.value = d : g !== void 0 && (this.element.defaultValue = g, this.element.value = g), t.appendChild(this.element);
862
+ Object.assign(this.element, ne), f !== void 0 ? this.element.value = f : S !== void 0 && (this.element.defaultValue = S, this.element.value = S), t.appendChild(this.element);
1197
863
  }
1198
864
  setupEventListeners() {
1199
- this.element.addEventListener("input", this.handleChange.bind(this)), this.element.addEventListener("keydown", this.handleKeyDown.bind(this)), this.element.addEventListener("paste", this.handlePaste.bind(this)), this.resolvedOptions.formatOn === m.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)));
865
+ this.element.addEventListener("input", this.handleChange.bind(this)), this.element.addEventListener("keydown", this.handleKeyDown.bind(this)), this.element.addEventListener("paste", this.handlePaste.bind(this)), this.resolvedOptions.formatOn === b.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)));
1200
866
  }
1201
867
  getResolvedOptions() {
1202
868
  return {
1203
- decimalMaxLength: this.options.decimalMaxLength ?? _,
1204
- decimalMinLength: this.options.decimalMinLength ?? z,
869
+ decimalMaxLength: this.options.decimalMaxLength ?? x,
870
+ decimalMinLength: this.options.decimalMinLength ?? G,
1205
871
  formatOn: this.options.formatOn ?? Z,
1206
- thousandSeparator: this.options.thousandSeparator ?? B,
1207
- thousandStyle: this.options.thousandStyle ?? W,
872
+ thousandSeparator: this.options.thousandSeparator ?? k,
873
+ thousandStyle: this.options.thousandStyle ?? B,
1208
874
  decimalSeparator: this.options.decimalSeparator ?? N,
1209
- enableCompactNotation: this.options.enableCompactNotation ?? oe,
1210
- enableNegative: this.options.enableNegative ?? k,
875
+ enableCompactNotation: this.options.enableCompactNotation ?? P,
876
+ enableNegative: this.options.enableNegative ?? W,
1211
877
  enableLeadingZeros: this.options.enableLeadingZeros ?? U,
1212
- rawValueMode: this.options.rawValueMode ?? G,
878
+ rawValueMode: this.options.rawValueMode ?? z,
1213
879
  onChange: this.options.onChange
1214
880
  };
1215
881
  }
@@ -1228,67 +894,66 @@ class ut {
1228
894
  }
1229
895
  handleValueChange(t, n) {
1230
896
  if (this.resolvedOptions.rawValueMode && n !== void 0 && (this.rawValue = n), this.resolvedOptions.onChange) {
1231
- const s = this.resolvedOptions.rawValueMode ? this.rawValue : t;
1232
- this.resolvedOptions.onChange(s);
897
+ const r = this.resolvedOptions.rawValueMode ? this.rawValue : t;
898
+ this.resolvedOptions.onChange(r);
1233
899
  }
1234
900
  }
1235
901
  formatValueForDisplay(t) {
1236
902
  if (!t)
1237
903
  return t;
1238
- const { thousandSeparator: n, thousandStyle: s, enableLeadingZeros: o, decimalSeparator: r } = this.resolvedOptions;
1239
- return n && s !== S.None ? y(
904
+ const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros: i, decimalSeparator: s } = this.resolvedOptions;
905
+ return n && r !== p.None ? Q(
1240
906
  t,
1241
907
  n,
1242
- s,
1243
- o,
1244
- r
908
+ r,
909
+ i,
910
+ s
1245
911
  ) : t;
1246
912
  }
1247
913
  handleChange(t) {
1248
- const { formatted: n, raw: s } = Je(
914
+ const { formatted: n, raw: r } = He(
1249
915
  t,
1250
916
  this.resolvedOptions.decimalMaxLength,
1251
917
  this.caretPositionBeforeChange,
1252
918
  this.buildFormattingOptions()
1253
919
  );
1254
- this.caretPositionBeforeChange = void 0, this.handleValueChange(n, s);
920
+ this.caretPositionBeforeChange = void 0, this.handleValueChange(n, r);
1255
921
  }
1256
922
  handleKeyDown(t) {
1257
- const n = t.target, { selectionStart: s, selectionEnd: o } = n, r = this.buildFormattingOptions(), i = je(t, {
1258
- formatOn: r.formatOn,
1259
- thousandSeparator: r.thousandSeparator,
1260
- ThousandStyle: r.ThousandStyle,
1261
- decimalSeparator: r.decimalSeparator
923
+ const n = t.target, { selectionStart: r, selectionEnd: i } = n, s = this.buildFormattingOptions(), a = qe(t, {
924
+ formatOn: s.formatOn,
925
+ thousandSeparator: s.thousandSeparator,
926
+ ThousandStyle: s.ThousandStyle,
927
+ decimalSeparator: s.decimalSeparator
1262
928
  });
1263
- i ? this.caretPositionBeforeChange = {
1264
- selectionStart: s ?? 0,
1265
- selectionEnd: o ?? 0,
1266
- endOffset: i.endOffset
929
+ a ? this.caretPositionBeforeChange = {
930
+ selectionStart: r ?? 0,
931
+ selectionEnd: i ?? 0,
932
+ endOffset: a.endOffset
1267
933
  } : this.caretPositionBeforeChange = {
1268
- selectionStart: s ?? 0,
1269
- selectionEnd: o ?? 0
934
+ selectionStart: r ?? 0,
935
+ selectionEnd: i ?? 0
1270
936
  };
1271
937
  }
1272
938
  handlePaste(t) {
1273
- const { formatted: n, raw: s } = qe(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
1274
- this.handleValueChange(n, s);
1275
- const o = new Event("input", { bubbles: !0, cancelable: !0 });
1276
- this.element.dispatchEvent(o);
939
+ const { formatted: n, raw: r } = Qe(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
940
+ this.handleValueChange(n, r);
941
+ const i = new Event("input", { bubbles: !0, cancelable: !0 });
942
+ this.element.dispatchEvent(i);
1277
943
  }
1278
944
  handleFocus(t) {
1279
- if (this.resolvedOptions.formatOn === m.Blur && this.resolvedOptions.thousandSeparator) {
945
+ if (this.resolvedOptions.formatOn === b.Blur && this.resolvedOptions.thousandSeparator) {
1280
946
  const n = t.target;
1281
- n.value = v(n.value, this.resolvedOptions.thousandSeparator);
947
+ n.value = D(n.value, this.resolvedOptions.thousandSeparator);
1282
948
  }
1283
949
  }
1284
950
  handleBlur(t) {
1285
- const n = t.target, { thousandSeparator: s, thousandStyle: o } = this.resolvedOptions;
1286
- if (s && o !== S.None && n.value) {
1287
- n.value;
1288
- const r = this.formatValueForDisplay(n.value);
1289
- n.value = r;
1290
- const i = this.resolvedOptions.rawValueMode ? v(r, s) : void 0;
1291
- this.handleValueChange(r, i);
951
+ const n = t.target, { thousandSeparator: r, thousandStyle: i } = this.resolvedOptions;
952
+ if (r && i !== p.None && n.value) {
953
+ const s = this.formatValueForDisplay(n.value);
954
+ n.value = s;
955
+ const a = this.resolvedOptions.rawValueMode ? D(s, r) : void 0;
956
+ this.handleValueChange(s, a);
1292
957
  }
1293
958
  }
1294
959
  getValue() {
@@ -1296,7 +961,7 @@ class ut {
1296
961
  }
1297
962
  setValue(t) {
1298
963
  if (this.resolvedOptions.rawValueMode) {
1299
- const n = this.resolvedOptions.thousandSeparator ? v(t, this.resolvedOptions.thousandSeparator) : t;
964
+ const n = this.resolvedOptions.thousandSeparator ? D(t, this.resolvedOptions.thousandSeparator) : t;
1300
965
  this.rawValue = n, this.element.value = this.formatValueForDisplay(n);
1301
966
  } else
1302
967
  this.element.value = t;
@@ -1344,8 +1009,8 @@ class ut {
1344
1009
  const t = this.getValue();
1345
1010
  if (!t)
1346
1011
  return NaN;
1347
- const n = this.resolvedOptions.thousandSeparator ? v(t, this.resolvedOptions.thousandSeparator) : t, s = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(x(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
1348
- return parseFloat(s);
1012
+ const n = this.resolvedOptions.thousandSeparator ? D(t, this.resolvedOptions.thousandSeparator) : t, r = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(w(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
1013
+ return parseFloat(r);
1349
1014
  }
1350
1015
  /**
1351
1016
  * Sets the value from a number, similar to HTMLInputElement.valueAsNumber.
@@ -1360,17 +1025,15 @@ class ut {
1360
1025
  }
1361
1026
  }
1362
1027
  export {
1363
- m as FormatOn,
1028
+ b as FormatOn,
1364
1029
  ut as NumoraInput,
1365
- S as ThousandStyle,
1366
- ct as condenseDecimalZeros,
1030
+ p as ThousandStyle,
1367
1031
  O as formatInputValue,
1368
- lt as formatLargeNumber,
1369
- at as formatLargePercent,
1370
- ot as formatPercent,
1371
1032
  ht as formatValueForDisplay,
1372
- Je as handleOnChangeNumoraInput,
1373
- je as handleOnKeyDownNumoraInput,
1374
- qe as handleOnPasteNumoraInput,
1375
- v as removeThousandSeparators
1033
+ Ve as getNumoraPattern,
1034
+ He as handleOnChangeNumoraInput,
1035
+ qe as handleOnKeyDownNumoraInput,
1036
+ Qe as handleOnPasteNumoraInput,
1037
+ D as removeThousandSeparators,
1038
+ Fe as validateNumoraInputOptions
1376
1039
  };