hoodini-viz 0.1.0 → 0.1.2

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,12 +1,10 @@
1
- import * as ie from "react";
2
- import Q, { useRef as X, useState as xe, useEffect as ve, useMemo as Fe, useLayoutEffect as je } from "react";
3
- import { s as Le } from "./index-CLh4oIT4.js";
4
- const Me = /* @__PURE__ */ Le("div")({
1
+ import { s as Te, R as X, r as T } from "./index-CgEGAnfh.js";
2
+ const Be = /* @__PURE__ */ Te("div")({
5
3
  name: "NumberOverlayEditorStyle",
6
4
  class: "gdg-n15fjm3e",
7
5
  propsAsIs: !1
8
6
  });
9
- function ye(e, t) {
7
+ function Se(e, t) {
10
8
  var r = {};
11
9
  for (var n in e)
12
10
  Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
@@ -19,9 +17,9 @@ var re;
19
17
  (function(e) {
20
18
  e.event = "event", e.props = "prop";
21
19
  })(re || (re = {}));
22
- function Z() {
20
+ function q() {
23
21
  }
24
- function ke(e) {
22
+ function Fe(e) {
25
23
  var t, r = void 0;
26
24
  return function() {
27
25
  for (var n = [], a = arguments.length; a--; ) n[a] = arguments[a];
@@ -36,16 +34,16 @@ function ae(e) {
36
34
  function Y(e) {
37
35
  return e == null;
38
36
  }
39
- function Pe(e) {
37
+ function _e(e) {
40
38
  return typeof e == "number" && isNaN(e);
41
39
  }
42
- function be(e) {
43
- return Y(e) || Pe(e) || typeof e == "number" && !isFinite(e);
40
+ function pe(e) {
41
+ return Y(e) || _e(e) || typeof e == "number" && !isFinite(e);
44
42
  }
45
- function Ve(e) {
43
+ function xe(e) {
46
44
  return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
47
45
  }
48
- function Ke(e) {
46
+ function je(e) {
49
47
  switch (e) {
50
48
  case "lakh":
51
49
  return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
@@ -55,20 +53,20 @@ function Ke(e) {
55
53
  return /(\d)(?=(\d{3})+(?!\d))/g;
56
54
  }
57
55
  }
58
- function We(e, t, r) {
59
- var n = Ke(r), a = e.search(/[1-9]/);
56
+ function Le(e, t, r) {
57
+ var n = je(r), a = e.search(/[1-9]/);
60
58
  return a = a === -1 ? e.length : a, e.substring(0, a) + e.substring(a, e.length).replace(n, "$1" + t);
61
59
  }
62
- function Ue(e) {
63
- var t = X(e);
60
+ function Me(e) {
61
+ var t = T.useRef(e);
64
62
  t.current = e;
65
- var r = X(function() {
63
+ var r = T.useRef(function() {
66
64
  for (var n = [], a = arguments.length; a--; ) n[a] = arguments[a];
67
65
  return t.current.apply(t, n);
68
66
  });
69
67
  return r.current;
70
68
  }
71
- function de(e, t) {
69
+ function se(e, t) {
72
70
  t === void 0 && (t = !0);
73
71
  var r = e[0] === "-", n = r && t;
74
72
  e = e.replace("-", "");
@@ -80,7 +78,7 @@ function de(e, t) {
80
78
  addNegation: n
81
79
  };
82
80
  }
83
- function $e(e) {
81
+ function ke(e) {
84
82
  if (!e)
85
83
  return e;
86
84
  var t = e[0] === "-";
@@ -88,15 +86,15 @@ function $e(e) {
88
86
  var r = e.split("."), n = r[0].replace(/^0+/, "") || "0", a = r[1] || "";
89
87
  return (t ? "-" : "") + n + (a ? "." + a : "");
90
88
  }
91
- function Ne(e, t, r) {
89
+ function ye(e, t, r) {
92
90
  for (var n = "", a = r ? "0" : "", i = 0; i <= t - 1; i++)
93
91
  n += e[i] || a;
94
92
  return n;
95
93
  }
96
- function me(e, t) {
94
+ function de(e, t) {
97
95
  return Array(t + 1).join(e);
98
96
  }
99
- function we(e) {
97
+ function be(e) {
100
98
  var t = e + "", r = t[0] === "-" ? "-" : "";
101
99
  r && (t = t.substring(1));
102
100
  var n = t.split(/[eE]/g), a = n[0], i = n[1];
@@ -104,19 +102,19 @@ function we(e) {
104
102
  return r + a;
105
103
  a = a.replace(".", "");
106
104
  var l = 1 + i, m = a.length;
107
- return l < 0 ? a = "0." + me("0", Math.abs(l)) + a : l >= m ? a = a + me("0", l - m) : a = (a.substring(0, l) || "0") + "." + a.substring(l), r + a;
105
+ return l < 0 ? a = "0." + de("0", Math.abs(l)) + a : l >= m ? a = a + de("0", l - m) : a = (a.substring(0, l) || "0") + "." + a.substring(l), r + a;
108
106
  }
109
- function he(e, t, r) {
107
+ function ge(e, t, r) {
110
108
  if (["", "-"].indexOf(e) !== -1)
111
109
  return e;
112
- var n = (e.indexOf(".") !== -1 || r) && t, a = de(e), i = a.beforeDecimal, l = a.afterDecimal, m = a.hasNegation, S = parseFloat("0." + (l || "0")), p = l.length <= t ? "0." + l : S.toFixed(t), h = p.split("."), c = i;
110
+ var n = (e.indexOf(".") !== -1 || r) && t, a = se(e), i = a.beforeDecimal, l = a.afterDecimal, m = a.hasNegation, S = parseFloat("0." + (l || "0")), p = l.length <= t ? "0." + l : S.toFixed(t), h = p.split("."), c = i;
113
111
  i && Number(h[0]) && (c = i.split("").reverse().reduce(function(I, C, g) {
114
112
  return I.length > g ? (Number(I[0]) + Number(C)).toString() + I.substring(1, I.length) : C + I;
115
113
  }, h[0]));
116
- var x = Ne(h[1] || "", t, r), y = m ? "-" : "", v = n ? "." : "";
117
- return "" + y + c + v + x;
114
+ var x = ye(h[1] || "", t, r), y = m ? "-" : "", s = n ? "." : "";
115
+ return "" + y + c + s + x;
118
116
  }
119
- function z(e, t) {
117
+ function H(e, t) {
120
118
  if (e.value = e.value, e !== null) {
121
119
  if (e.createTextRange) {
122
120
  var r = e.createTextRange();
@@ -125,7 +123,7 @@ function z(e, t) {
125
123
  return e.selectionStart || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
126
124
  }
127
125
  }
128
- var De = ke(function(e, t) {
126
+ var Ve = Fe(function(e, t) {
129
127
  for (var r = 0, n = 0, a = e.length, i = t.length; e[r] === t[r] && r < a; )
130
128
  r++;
131
129
  for (; e[a - 1 - n] === t[i - 1 - n] && i - n > r && a - n > r; )
@@ -134,23 +132,23 @@ var De = ke(function(e, t) {
134
132
  from: { start: r, end: a - n },
135
133
  to: { start: r, end: i - n }
136
134
  };
137
- }), Ge = function(e, t) {
135
+ }), Pe = function(e, t) {
138
136
  var r = Math.min(e.selectionStart, t);
139
137
  return {
140
138
  from: { start: r, end: e.selectionEnd },
141
139
  to: { start: r, end: t }
142
140
  };
143
141
  };
144
- function Ze(e, t, r) {
142
+ function Ke(e, t, r) {
145
143
  return Math.min(Math.max(e, t), r);
146
144
  }
147
- function se(e) {
145
+ function ce(e) {
148
146
  return Math.max(e.selectionStart, e.selectionEnd);
149
147
  }
150
- function qe() {
148
+ function We() {
151
149
  return typeof navigator < "u" && !(navigator.platform && /iPhone|iPod/.test(navigator.platform));
152
150
  }
153
- function ze(e) {
151
+ function Ue(e) {
154
152
  return {
155
153
  from: {
156
154
  start: 0,
@@ -163,43 +161,43 @@ function ze(e) {
163
161
  lastValue: ""
164
162
  };
165
163
  }
166
- function He(e) {
164
+ function $e(e) {
167
165
  var t = e.currentValue, r = e.formattedValue, n = e.currentValueIndex, a = e.formattedValueIndex;
168
166
  return t[n] === r[a];
169
167
  }
170
- function Je(e, t, r, n, a, i, l) {
171
- l === void 0 && (l = He);
172
- var m = a.findIndex(function(M) {
173
- return M;
168
+ function Ge(e, t, r, n, a, i, l) {
169
+ l === void 0 && (l = $e);
170
+ var m = a.findIndex(function(k) {
171
+ return k;
174
172
  }), S = e.slice(0, m);
175
173
  !t && !r.startsWith(S) && (t = S, r = S + r, n = n + S.length);
176
174
  for (var p = r.length, h = e.length, c = {}, x = new Array(p), y = 0; y < p; y++) {
177
175
  x[y] = -1;
178
- for (var v = 0, I = h; v < I; v++) {
176
+ for (var s = 0, I = h; s < I; s++) {
179
177
  var C = l({
180
178
  currentValue: r,
181
179
  lastValue: t,
182
180
  formattedValue: e,
183
181
  currentValueIndex: y,
184
- formattedValueIndex: v
182
+ formattedValueIndex: s
185
183
  });
186
- if (C && c[v] !== !0) {
187
- x[y] = v, c[v] = !0;
184
+ if (C && c[s] !== !0) {
185
+ x[y] = s, c[s] = !0;
188
186
  break;
189
187
  }
190
188
  }
191
189
  }
192
190
  for (var g = n; g < p && (x[g] === -1 || !i(r[g])); )
193
191
  g++;
194
- var T = g === p || x[g] === -1 ? h : x[g];
192
+ var B = g === p || x[g] === -1 ? h : x[g];
195
193
  for (g = n - 1; g > 0 && x[g] === -1; )
196
194
  g--;
197
- var B = g === -1 || x[g] === -1 ? 0 : x[g] + 1;
198
- return B > T ? T : n - B < T - n ? B : T;
195
+ var F = g === -1 || x[g] === -1 ? 0 : x[g] + 1;
196
+ return F > B ? B : n - F < B - n ? F : B;
199
197
  }
200
- function Se(e, t, r, n) {
198
+ function me(e, t, r, n) {
201
199
  var a = e.length;
202
- if (t = Ze(t, 0, a), n === "left") {
200
+ if (t = Ke(t, 0, a), n === "left") {
203
201
  for (; t >= 0 && !r[t]; )
204
202
  t--;
205
203
  t === -1 && (t = r.indexOf(!0));
@@ -210,192 +208,192 @@ function Se(e, t, r, n) {
210
208
  }
211
209
  return t === -1 && (t = a), t;
212
210
  }
213
- function Qe(e) {
211
+ function Ze(e) {
214
212
  for (var t = Array.from({ length: e.length + 1 }).map(function() {
215
213
  return !0;
216
214
  }), r = 0, n = t.length; r < n; r++)
217
215
  t[r] = !!(ae(e[r]) || ae(e[r - 1]));
218
216
  return t;
219
217
  }
220
- function Ie(e, t, r, n, a, i) {
221
- i === void 0 && (i = Z);
222
- var l = Ue(function(v, I) {
218
+ function Ne(e, t, r, n, a, i) {
219
+ i === void 0 && (i = q);
220
+ var l = Me(function(s, I) {
223
221
  var C, g;
224
- return be(v) ? (g = "", C = "") : typeof v == "number" || I ? (g = typeof v == "number" ? we(v) : v, C = n(g)) : (g = a(v, void 0), C = n(g)), { formattedValue: C, numAsString: g };
225
- }), m = xe(function() {
222
+ return pe(s) ? (g = "", C = "") : typeof s == "number" || I ? (g = typeof s == "number" ? be(s) : s, C = n(g)) : (g = a(s, void 0), C = n(g)), { formattedValue: C, numAsString: g };
223
+ }), m = T.useState(function() {
226
224
  return l(Y(e) ? t : e, r);
227
- }), S = m[0], p = m[1], h = function(v, I) {
228
- v.formattedValue !== S.formattedValue && p({
229
- formattedValue: v.formattedValue,
230
- numAsString: v.value
231
- }), i(v, I);
225
+ }), S = m[0], p = m[1], h = function(s, I) {
226
+ s.formattedValue !== S.formattedValue && p({
227
+ formattedValue: s.formattedValue,
228
+ numAsString: s.value
229
+ }), i(s, I);
232
230
  }, c = e, x = r;
233
231
  Y(e) && (c = S.numAsString, x = !0);
234
232
  var y = l(c, x);
235
- return Fe(function() {
233
+ return T.useMemo(function() {
236
234
  p(y);
237
235
  }, [y.formattedValue]), [S, h];
238
236
  }
239
- function Xe(e) {
237
+ function qe(e) {
240
238
  return e.replace(/[^0-9]/g, "");
241
239
  }
242
- function Ye(e) {
240
+ function ze(e) {
243
241
  return e;
244
242
  }
245
- function et(e) {
243
+ function He(e) {
246
244
  var t = e.type;
247
245
  t === void 0 && (t = "text");
248
246
  var r = e.displayType;
249
247
  r === void 0 && (r = "input");
250
248
  var n = e.customInput, a = e.renderText, i = e.getInputRef, l = e.format;
251
- l === void 0 && (l = Ye);
249
+ l === void 0 && (l = ze);
252
250
  var m = e.removeFormatting;
253
- m === void 0 && (m = Xe);
251
+ m === void 0 && (m = qe);
254
252
  var S = e.defaultValue, p = e.valueIsNumericString, h = e.onValueChange, c = e.isAllowed, x = e.onChange;
255
- x === void 0 && (x = Z);
253
+ x === void 0 && (x = q);
256
254
  var y = e.onKeyDown;
257
- y === void 0 && (y = Z);
258
- var v = e.onMouseUp;
259
- v === void 0 && (v = Z);
255
+ y === void 0 && (y = q);
256
+ var s = e.onMouseUp;
257
+ s === void 0 && (s = q);
260
258
  var I = e.onFocus;
261
- I === void 0 && (I = Z);
259
+ I === void 0 && (I = q);
262
260
  var C = e.onBlur;
263
- C === void 0 && (C = Z);
264
- var g = e.value, T = e.getCaretBoundary;
265
- T === void 0 && (T = Qe);
266
- var B = e.isValidInputCharacter;
267
- B === void 0 && (B = ae);
268
- var M = e.isCharacterSame, F = ye(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]), q = Ie(g, S, !!p, l, m, h), k = q[0], V = k.formattedValue, j = k.numAsString, K = q[1], L = X(), W = X({ formattedValue: V, numAsString: j }), U = function(o, u) {
269
- W.current = { formattedValue: o.formattedValue, numAsString: o.value }, K(o, u);
270
- }, H = xe(!1), ee = H[0], d = H[1], f = X(null), N = X({
261
+ C === void 0 && (C = q);
262
+ var g = e.value, B = e.getCaretBoundary;
263
+ B === void 0 && (B = Ze);
264
+ var F = e.isValidInputCharacter;
265
+ F === void 0 && (F = ae);
266
+ var k = e.isCharacterSame, j = Se(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]), z = Ne(g, S, !!p, l, m, h), P = z[0], V = P.formattedValue, L = P.numAsString, W = z[1], M = T.useRef(), U = T.useRef({ formattedValue: V, numAsString: L }), $ = function(o, u) {
267
+ U.current = { formattedValue: o.formattedValue, numAsString: o.value }, W(o, u);
268
+ }, J = T.useState(!1), ee = J[0], d = J[1], f = T.useRef(null), N = T.useRef({
271
269
  setCaretTimeout: null,
272
270
  focusTimeout: null
273
271
  });
274
- ve(function() {
272
+ T.useEffect(function() {
275
273
  return d(!0), function() {
276
274
  clearTimeout(N.current.setCaretTimeout), clearTimeout(N.current.focusTimeout);
277
275
  };
278
276
  }, []);
279
- var A = l, O = function(o, u) {
280
- var s = parseFloat(u);
277
+ var R = l, A = function(o, u) {
278
+ var v = parseFloat(u);
281
279
  return {
282
280
  formattedValue: o,
283
281
  value: u,
284
- floatValue: isNaN(s) ? void 0 : s
282
+ floatValue: isNaN(v) ? void 0 : v
285
283
  };
286
- }, E = function(o, u, s) {
287
- o.selectionStart === 0 && o.selectionEnd === o.value.length || (z(o, u), N.current.setCaretTimeout = setTimeout(function() {
288
- o.value === s && o.selectionStart !== u && z(o, u);
284
+ }, E = function(o, u, v) {
285
+ o.selectionStart === 0 && o.selectionEnd === o.value.length || (H(o, u), N.current.setCaretTimeout = setTimeout(function() {
286
+ o.value === v && o.selectionStart !== u && H(o, u);
289
287
  }, 0));
290
- }, R = function(o, u, s) {
291
- return Se(o, u, T(o), s);
292
- }, J = function(o, u, s) {
293
- var w = T(u), _ = Je(u, V, o, s, w, B, M);
294
- return _ = Se(u, _, w), _;
295
- }, ue = function(o) {
288
+ }, O = function(o, u, v) {
289
+ return me(o, u, B(o), v);
290
+ }, Q = function(o, u, v) {
291
+ var w = B(u), _ = Ge(u, V, o, v, w, F, k);
292
+ return _ = me(u, _, w), _;
293
+ }, oe = function(o) {
296
294
  var u = o.formattedValue;
297
295
  u === void 0 && (u = "");
298
- var s = o.input, w = o.source, _ = o.event, D = o.numAsString, b;
299
- if (s) {
300
- var P = o.inputValue || s.value, $ = se(s);
301
- s.value = u, b = J(P, u, $), b !== void 0 && E(s, b, u);
296
+ var v = o.input, w = o.source, _ = o.event, D = o.numAsString, b;
297
+ if (v) {
298
+ var K = o.inputValue || v.value, G = ce(v);
299
+ v.value = u, b = Q(K, u, G), b !== void 0 && E(v, b, u);
302
300
  }
303
- u !== V && U(O(u, D), { event: _, source: w });
301
+ u !== V && $(A(u, D), { event: _, source: w });
304
302
  };
305
- ve(function() {
306
- var o = W.current, u = o.formattedValue, s = o.numAsString;
307
- (V !== u || j !== s) && U(O(V, j), {
303
+ T.useEffect(function() {
304
+ var o = U.current, u = o.formattedValue, v = o.numAsString;
305
+ (V !== u || L !== v) && $(A(V, L), {
308
306
  event: void 0,
309
307
  source: re.props
310
308
  });
311
- }, [V, j]);
312
- var te = f.current ? se(f.current) : void 0, ne = typeof window < "u" ? je : ve;
309
+ }, [V, L]);
310
+ var te = f.current ? ce(f.current) : void 0, ne = typeof window < "u" ? T.useLayoutEffect : T.useEffect;
313
311
  ne(function() {
314
312
  var o = f.current;
315
- if (V !== W.current.formattedValue && o) {
316
- var u = J(W.current.formattedValue, V, te);
313
+ if (V !== U.current.formattedValue && o) {
314
+ var u = Q(U.current.formattedValue, V, te);
317
315
  o.value = V, E(o, u, V);
318
316
  }
319
317
  }, [V]);
320
- var le = function(o, u, s) {
321
- var w = u.target, _ = L.current ? Ge(L.current, w.selectionEnd) : De(V, o), D = Object.assign(Object.assign({}, _), { lastValue: V }), b = m(o, D), P = A(b);
322
- if (b = m(P, void 0), c && !c(O(P, b))) {
323
- var $ = u.target, G = se($), ce = J(o, V, G);
324
- return $.value = V, E($, ce, V), !1;
318
+ var ue = function(o, u, v) {
319
+ var w = u.target, _ = M.current ? Pe(M.current, w.selectionEnd) : Ve(V, o), D = Object.assign(Object.assign({}, _), { lastValue: V }), b = m(o, D), K = R(b);
320
+ if (b = m(K, void 0), c && !c(A(K, b))) {
321
+ var G = u.target, Z = ce(G), fe = Q(o, V, Z);
322
+ return G.value = V, E(G, fe, V), !1;
325
323
  }
326
- return ue({
327
- formattedValue: P,
324
+ return oe({
325
+ formattedValue: K,
328
326
  numAsString: b,
329
327
  inputValue: o,
330
328
  event: u,
331
- source: s,
329
+ source: v,
332
330
  input: u.target
333
331
  }), !0;
334
- }, fe = function(o, u) {
332
+ }, le = function(o, u) {
335
333
  u === void 0 && (u = 0);
336
- var s = o.selectionStart, w = o.selectionEnd;
337
- L.current = { selectionStart: s, selectionEnd: w + u };
338
- }, Ee = function(o) {
339
- var u = o.target, s = u.value, w = le(s, o, re.event);
340
- w && x(o), L.current = void 0;
341
- }, Ae = function(o) {
342
- var u = o.target, s = o.key, w = u.selectionStart, _ = u.selectionEnd, D = u.value;
334
+ var v = o.selectionStart, w = o.selectionEnd;
335
+ M.current = { selectionStart: v, selectionEnd: w + u };
336
+ }, De = function(o) {
337
+ var u = o.target, v = u.value, w = ue(v, o, re.event);
338
+ w && x(o), M.current = void 0;
339
+ }, Ie = function(o) {
340
+ var u = o.target, v = o.key, w = u.selectionStart, _ = u.selectionEnd, D = u.value;
343
341
  D === void 0 && (D = "");
344
342
  var b;
345
- s === "ArrowLeft" || s === "Backspace" ? b = Math.max(w - 1, 0) : s === "ArrowRight" ? b = Math.min(w + 1, D.length) : s === "Delete" && (b = w);
346
- var P = 0;
347
- s === "Delete" && w === _ && (P = 1);
348
- var $ = s === "ArrowLeft" || s === "ArrowRight";
349
- if (b === void 0 || w !== _ && !$) {
350
- y(o), fe(u, P);
343
+ v === "ArrowLeft" || v === "Backspace" ? b = Math.max(w - 1, 0) : v === "ArrowRight" ? b = Math.min(w + 1, D.length) : v === "Delete" && (b = w);
344
+ var K = 0;
345
+ v === "Delete" && w === _ && (K = 1);
346
+ var G = v === "ArrowLeft" || v === "ArrowRight";
347
+ if (b === void 0 || w !== _ && !G) {
348
+ y(o), le(u, K);
351
349
  return;
352
350
  }
353
- var G = b;
354
- if ($) {
355
- var ce = s === "ArrowLeft" ? "left" : "right";
356
- G = R(D, b, ce), G !== b && o.preventDefault();
357
- } else s === "Delete" && !B(D[b]) ? G = R(D, b, "right") : s === "Backspace" && !B(D[b]) && (G = R(D, b, "left"));
358
- G !== b && E(u, G, D), y(o), fe(u, P);
359
- }, Oe = function(o) {
360
- var u = o.target, s = function() {
351
+ var Z = b;
352
+ if (G) {
353
+ var fe = v === "ArrowLeft" ? "left" : "right";
354
+ Z = O(D, b, fe), Z !== b && o.preventDefault();
355
+ } else v === "Delete" && !F(D[b]) ? Z = O(D, b, "right") : v === "Backspace" && !F(D[b]) && (Z = O(D, b, "left"));
356
+ Z !== b && E(u, Z, D), y(o), le(u, K);
357
+ }, Ce = function(o) {
358
+ var u = o.target, v = function() {
361
359
  var w = u.selectionStart, _ = u.selectionEnd, D = u.value;
362
360
  if (D === void 0 && (D = ""), w === _) {
363
- var b = R(D, w);
361
+ var b = O(D, w);
364
362
  b !== w && E(u, b, D);
365
363
  }
366
364
  };
367
- s(), requestAnimationFrame(function() {
368
- s();
369
- }), v(o), fe(u);
370
- }, Re = function(o) {
365
+ v(), requestAnimationFrame(function() {
366
+ v();
367
+ }), s(o), le(u);
368
+ }, Ee = function(o) {
371
369
  o.persist && o.persist();
372
- var u = o.target, s = o.currentTarget;
370
+ var u = o.target, v = o.currentTarget;
373
371
  f.current = u, N.current.focusTimeout = setTimeout(function() {
374
372
  var w = u.selectionStart, _ = u.selectionEnd, D = u.value;
375
373
  D === void 0 && (D = "");
376
- var b = R(D, w);
377
- b !== w && !(w === 0 && _ === D.length) && E(u, b, D), I(Object.assign(Object.assign({}, o), { currentTarget: s }));
374
+ var b = O(D, w);
375
+ b !== w && !(w === 0 && _ === D.length) && E(u, b, D), I(Object.assign(Object.assign({}, o), { currentTarget: v }));
378
376
  }, 0);
379
- }, Te = function(o) {
377
+ }, Re = function(o) {
380
378
  f.current = null, clearTimeout(N.current.focusTimeout), clearTimeout(N.current.setCaretTimeout), C(o);
381
- }, Be = ee && qe() ? "numeric" : void 0, ge = Object.assign({ inputMode: Be }, F, {
379
+ }, Ae = ee && We() ? "numeric" : void 0, ve = Object.assign({ inputMode: Ae }, j, {
382
380
  type: t,
383
381
  value: V,
384
- onChange: Ee,
385
- onKeyDown: Ae,
386
- onMouseUp: Oe,
387
- onFocus: Re,
388
- onBlur: Te
382
+ onChange: De,
383
+ onKeyDown: Ie,
384
+ onMouseUp: Ce,
385
+ onFocus: Ee,
386
+ onBlur: Re
389
387
  });
390
388
  if (r === "text")
391
- return a ? Q.createElement(Q.Fragment, null, a(V, F) || null) : Q.createElement("span", Object.assign({}, F, { ref: i }), V);
389
+ return a ? X.createElement(X.Fragment, null, a(V, j) || null) : X.createElement("span", Object.assign({}, j, { ref: i }), V);
392
390
  if (n) {
393
- var _e = n;
394
- return Q.createElement(_e, Object.assign({}, ge, { ref: i }));
391
+ var Oe = n;
392
+ return X.createElement(Oe, Object.assign({}, ve, { ref: i }));
395
393
  }
396
- return Q.createElement("input", Object.assign({}, ge, { ref: i }));
394
+ return X.createElement("input", Object.assign({}, ve, { ref: i }));
397
395
  }
398
- function pe(e, t) {
396
+ function he(e, t) {
399
397
  var r = t.decimalScale, n = t.fixedDecimalScale, a = t.prefix;
400
398
  a === void 0 && (a = "");
401
399
  var i = t.suffix;
@@ -403,10 +401,10 @@ function pe(e, t) {
403
401
  var l = t.allowNegative, m = t.thousandsGroupStyle;
404
402
  if (m === void 0 && (m = "thousand"), e === "" || e === "-")
405
403
  return e;
406
- var S = oe(t), p = S.thousandSeparator, h = S.decimalSeparator, c = r !== 0 && e.indexOf(".") !== -1 || r && n, x = de(e, l), y = x.beforeDecimal, v = x.afterDecimal, I = x.addNegation;
407
- return r !== void 0 && (v = Ne(v, r, !!n)), p && (y = We(y, p, m)), a && (y = a + y), i && (v = v + i), I && (y = "-" + y), e = y + (c && h || "") + v, e;
404
+ var S = ie(t), p = S.thousandSeparator, h = S.decimalSeparator, c = r !== 0 && e.indexOf(".") !== -1 || r && n, x = se(e, l), y = x.beforeDecimal, s = x.afterDecimal, I = x.addNegation;
405
+ return r !== void 0 && (s = ye(s, r, !!n)), p && (y = Le(y, p, m)), a && (y = a + y), i && (s = s + i), I && (y = "-" + y), e = y + (c && h || "") + s, e;
408
406
  }
409
- function oe(e) {
407
+ function ie(e) {
410
408
  var t = e.decimalSeparator;
411
409
  t === void 0 && (t = ".");
412
410
  var r = e.thousandSeparator, n = e.allowedDecimalSeparators;
@@ -416,52 +414,52 @@ function oe(e) {
416
414
  allowedDecimalSeparators: n
417
415
  };
418
416
  }
419
- function tt(e, t) {
417
+ function Je(e, t) {
420
418
  e === void 0 && (e = "");
421
419
  var r = new RegExp("(-)"), n = new RegExp("(-)(.)*(-)"), a = r.test(e), i = n.test(e);
422
420
  return e = e.replace(/-/g, ""), a && !i && t && (e = "-" + e), e;
423
421
  }
424
- function rt(e, t) {
425
- return new RegExp("(^-)|[0-9]|" + Ve(e), "g");
422
+ function Qe(e, t) {
423
+ return new RegExp("(^-)|[0-9]|" + xe(e), "g");
426
424
  }
427
- function at(e, t, r) {
425
+ function Xe(e, t, r) {
428
426
  return e === "" ? !0 : !t?.match(/\d/) && !r?.match(/\d/) && typeof e == "string" && !isNaN(Number(e));
429
427
  }
430
- function nt(e, t, r) {
428
+ function Ye(e, t, r) {
431
429
  var n;
432
- t === void 0 && (t = ze(e));
430
+ t === void 0 && (t = Ue(e));
433
431
  var a = r.allowNegative, i = r.prefix;
434
432
  i === void 0 && (i = "");
435
433
  var l = r.suffix;
436
434
  l === void 0 && (l = "");
437
- var m = r.decimalScale, S = t.from, p = t.to, h = p.start, c = p.end, x = oe(r), y = x.allowedDecimalSeparators, v = x.decimalSeparator, I = e[c] === v;
435
+ var m = r.decimalScale, S = t.from, p = t.to, h = p.start, c = p.end, x = ie(r), y = x.allowedDecimalSeparators, s = x.decimalSeparator, I = e[c] === s;
438
436
  if (ae(e) && (e === i || e === l) && t.lastValue === "")
439
437
  return e;
440
438
  if (c - h === 1 && y.indexOf(e[h]) !== -1) {
441
- var C = m === 0 ? "" : v;
439
+ var C = m === 0 ? "" : s;
442
440
  e = e.substring(0, h) + C + e.substring(h + 1, e.length);
443
441
  }
444
- var g = function(f, N, A) {
445
- var O = !1, E = !1;
446
- i.startsWith("-") ? O = !1 : f.startsWith("--") ? (O = !1, E = !0) : l.startsWith("-") && f.length === l.length ? O = !1 : f[0] === "-" && (O = !0);
447
- var R = O ? 1 : 0;
448
- return E && (R = 2), R && (f = f.substring(R), N -= R, A -= R), { value: f, start: N, end: A, hasNegation: O };
449
- }, T = g(e, h, c), B = T.hasNegation;
450
- n = T, e = n.value, h = n.start, c = n.end;
451
- var M = g(t.lastValue, S.start, S.end), F = M.start, q = M.end, k = M.value, V = e.substring(h, c);
452
- e.length && k.length && (F > k.length - l.length || q < i.length) && !(V && l.startsWith(V)) && (e = k);
453
- var j = 0;
454
- e.startsWith(i) ? j += i.length : h < i.length && (j = h), e = e.substring(j), c -= j;
455
- var K = e.length, L = e.length - l.length;
456
- e.endsWith(l) ? K = L : (c > L || c > e.length - l.length) && (K = c), e = e.substring(0, K), e = tt(B ? "-" + e : e, a), e = (e.match(rt(v)) || []).join("");
457
- var W = e.indexOf(v);
458
- e = e.replace(new RegExp(Ve(v), "g"), function(f, N) {
459
- return N === W ? "." : "";
442
+ var g = function(f, N, R) {
443
+ var A = !1, E = !1;
444
+ i.startsWith("-") ? A = !1 : f.startsWith("--") ? (A = !1, E = !0) : l.startsWith("-") && f.length === l.length ? A = !1 : f[0] === "-" && (A = !0);
445
+ var O = A ? 1 : 0;
446
+ return E && (O = 2), O && (f = f.substring(O), N -= O, R -= O), { value: f, start: N, end: R, hasNegation: A };
447
+ }, B = g(e, h, c), F = B.hasNegation;
448
+ n = B, e = n.value, h = n.start, c = n.end;
449
+ var k = g(t.lastValue, S.start, S.end), j = k.start, z = k.end, P = k.value, V = e.substring(h, c);
450
+ e.length && P.length && (j > P.length - l.length || z < i.length) && !(V && l.startsWith(V)) && (e = P);
451
+ var L = 0;
452
+ e.startsWith(i) ? L += i.length : h < i.length && (L = h), e = e.substring(L), c -= L;
453
+ var W = e.length, M = e.length - l.length;
454
+ e.endsWith(l) ? W = M : (c > M || c > e.length - l.length) && (W = c), e = e.substring(0, W), e = Je(F ? "-" + e : e, a), e = (e.match(Qe(s)) || []).join("");
455
+ var U = e.indexOf(s);
456
+ e = e.replace(new RegExp(xe(s), "g"), function(f, N) {
457
+ return N === U ? "." : "";
460
458
  });
461
- var U = de(e, a), H = U.beforeDecimal, ee = U.afterDecimal, d = U.addNegation;
462
- return p.end - p.start < S.end - S.start && H === "" && I && !parseFloat(ee) && (e = d ? "-" : ""), e;
459
+ var $ = se(e, a), J = $.beforeDecimal, ee = $.afterDecimal, d = $.addNegation;
460
+ return p.end - p.start < S.end - S.start && J === "" && I && !parseFloat(ee) && (e = d ? "-" : ""), e;
463
461
  }
464
- function it(e, t) {
462
+ function et(e, t) {
465
463
  var r = t.prefix;
466
464
  r === void 0 && (r = "");
467
465
  var n = t.suffix;
@@ -473,8 +471,8 @@ function it(e, t) {
473
471
  var l = e.length;
474
472
  return a.fill(!1, l - n.length + 1, l + 1), a;
475
473
  }
476
- function ot(e) {
477
- var t = oe(e), r = t.thousandSeparator, n = t.decimalSeparator, a = e.prefix;
474
+ function tt(e) {
475
+ var t = ie(e), r = t.thousandSeparator, n = t.decimalSeparator, a = e.prefix;
478
476
  a === void 0 && (a = "");
479
477
  var i = e.allowNegative;
480
478
  if (i === void 0 && (i = !0), r === n)
@@ -489,40 +487,40 @@ function ot(e) {
489
487
  allowNegative: ` + i + `
490
488
  `), i = !1), Object.assign(Object.assign({}, e), { allowNegative: i });
491
489
  }
492
- function ut(e) {
493
- e = ot(e), e.decimalSeparator, e.allowedDecimalSeparators, e.thousandsGroupStyle;
490
+ function rt(e) {
491
+ e = tt(e), e.decimalSeparator, e.allowedDecimalSeparators, e.thousandsGroupStyle;
494
492
  var t = e.suffix, r = e.allowNegative, n = e.allowLeadingZeros, a = e.onKeyDown;
495
- a === void 0 && (a = Z);
493
+ a === void 0 && (a = q);
496
494
  var i = e.onBlur;
497
- i === void 0 && (i = Z);
495
+ i === void 0 && (i = q);
498
496
  var l = e.thousandSeparator, m = e.decimalScale, S = e.fixedDecimalScale, p = e.prefix;
499
497
  p === void 0 && (p = "");
500
- var h = e.defaultValue, c = e.value, x = e.valueIsNumericString, y = e.onValueChange, v = ye(e, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]), I = oe(e), C = I.decimalSeparator, g = I.allowedDecimalSeparators, T = function(d) {
501
- return pe(d, e);
502
- }, B = function(d, f) {
503
- return nt(d, f, e);
504
- }, M = Y(c) ? h : c, F = x ?? at(M, p, t);
505
- Y(c) ? Y(h) || (F = F || typeof h == "number") : F = F || typeof c == "number";
506
- var q = function(d) {
507
- return be(d) ? d : (typeof d == "number" && (d = we(d)), F && typeof m == "number" ? he(d, m, !!S) : d);
508
- }, k = Ie(q(c), q(h), !!F, T, B, y), V = k[0], j = V.numAsString, K = V.formattedValue, L = k[1], W = function(d) {
509
- var f = d.target, N = d.key, A = f.selectionStart, O = f.selectionEnd, E = f.value;
510
- if (E === void 0 && (E = ""), (N === "Backspace" || N === "Delete") && O < p.length) {
498
+ var h = e.defaultValue, c = e.value, x = e.valueIsNumericString, y = e.onValueChange, s = Se(e, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]), I = ie(e), C = I.decimalSeparator, g = I.allowedDecimalSeparators, B = function(d) {
499
+ return he(d, e);
500
+ }, F = function(d, f) {
501
+ return Ye(d, f, e);
502
+ }, k = Y(c) ? h : c, j = x ?? Xe(k, p, t);
503
+ Y(c) ? Y(h) || (j = j || typeof h == "number") : j = j || typeof c == "number";
504
+ var z = function(d) {
505
+ return pe(d) ? d : (typeof d == "number" && (d = be(d)), j && typeof m == "number" ? ge(d, m, !!S) : d);
506
+ }, P = Ne(z(c), z(h), !!j, B, F, y), V = P[0], L = V.numAsString, W = V.formattedValue, M = P[1], U = function(d) {
507
+ var f = d.target, N = d.key, R = f.selectionStart, A = f.selectionEnd, E = f.value;
508
+ if (E === void 0 && (E = ""), (N === "Backspace" || N === "Delete") && A < p.length) {
511
509
  d.preventDefault();
512
510
  return;
513
511
  }
514
- if (A !== O) {
512
+ if (R !== A) {
515
513
  a(d);
516
514
  return;
517
515
  }
518
- N === "Backspace" && E[0] === "-" && A === p.length + 1 && r && z(f, 1), m && S && (N === "Backspace" && E[A - 1] === C ? (z(f, A - 1), d.preventDefault()) : N === "Delete" && E[A] === C && d.preventDefault()), g?.includes(N) && E[A] === C && z(f, A + 1);
519
- var R = l === !0 ? "," : l;
520
- N === "Backspace" && E[A - 1] === R && z(f, A - 1), N === "Delete" && E[A] === R && z(f, A + 1), a(d);
521
- }, U = function(d) {
522
- var f = j;
523
- if (f.match(/\d/g) || (f = ""), n || (f = $e(f)), S && m && (f = he(f, m, S)), f !== j) {
524
- var N = pe(f, e);
525
- L({
516
+ N === "Backspace" && E[0] === "-" && R === p.length + 1 && r && H(f, 1), m && S && (N === "Backspace" && E[R - 1] === C ? (H(f, R - 1), d.preventDefault()) : N === "Delete" && E[R] === C && d.preventDefault()), g?.includes(N) && E[R] === C && H(f, R + 1);
517
+ var O = l === !0 ? "," : l;
518
+ N === "Backspace" && E[R - 1] === O && H(f, R - 1), N === "Delete" && E[R] === O && H(f, R + 1), a(d);
519
+ }, $ = function(d) {
520
+ var f = L;
521
+ if (f.match(/\d/g) || (f = ""), n || (f = ke(f)), S && m && (f = ge(f, m, S)), f !== L) {
522
+ var N = he(f, e);
523
+ M({
526
524
  formattedValue: N,
527
525
  value: f,
528
526
  floatValue: parseFloat(f)
@@ -532,50 +530,50 @@ function ut(e) {
532
530
  });
533
531
  }
534
532
  i(d);
535
- }, H = function(d) {
533
+ }, J = function(d) {
536
534
  return d === C ? !0 : ae(d);
537
535
  }, ee = function(d) {
538
- var f = d.currentValue, N = d.lastValue, A = d.formattedValue, O = d.currentValueIndex, E = d.formattedValueIndex, R = f[O], J = A[E], ue = De(N, f), te = ue.to, ne = function(le) {
539
- return B(le).indexOf(".") + p.length;
536
+ var f = d.currentValue, N = d.lastValue, R = d.formattedValue, A = d.currentValueIndex, E = d.formattedValueIndex, O = f[A], Q = R[E], oe = Ve(N, f), te = oe.to, ne = function(ue) {
537
+ return F(ue).indexOf(".") + p.length;
540
538
  };
541
- return c === 0 && S && m && f[te.start] === C && ne(f) < O && ne(A) > E ? !1 : O >= te.start && O < te.end && g && g.includes(R) && J === C ? !0 : R === J;
539
+ return c === 0 && S && m && f[te.start] === C && ne(f) < A && ne(R) > E ? !1 : A >= te.start && A < te.end && g && g.includes(O) && Q === C ? !0 : O === Q;
542
540
  };
543
- return Object.assign(Object.assign({}, v), {
544
- value: K,
541
+ return Object.assign(Object.assign({}, s), {
542
+ value: W,
545
543
  valueIsNumericString: !1,
546
- isValidInputCharacter: H,
544
+ isValidInputCharacter: J,
547
545
  isCharacterSame: ee,
548
- onValueChange: L,
549
- format: T,
550
- removeFormatting: B,
546
+ onValueChange: M,
547
+ format: B,
548
+ removeFormatting: F,
551
549
  getCaretBoundary: function(d) {
552
- return it(d, e);
550
+ return et(d, e);
553
551
  },
554
- onKeyDown: W,
555
- onBlur: U
552
+ onKeyDown: U,
553
+ onBlur: $
556
554
  });
557
555
  }
558
- function lt(e) {
559
- var t = ut(e);
560
- return Q.createElement(et, Object.assign({}, t));
556
+ function at(e) {
557
+ var t = rt(e);
558
+ return X.createElement(He, Object.assign({}, t));
561
559
  }
562
- function Ce() {
560
+ function we() {
563
561
  return Intl.NumberFormat()?.formatToParts(1.1)?.find((r) => r.type === "decimal")?.value ?? ".";
564
562
  }
565
- function ft() {
566
- return Ce() === "." ? "," : ".";
563
+ function nt() {
564
+ return we() === "." ? "," : ".";
567
565
  }
568
- const st = (e) => {
569
- const { value: t, onChange: r, disabled: n, highlight: a, validatedSelection: i, fixedDecimals: l, allowNegative: m, thousandSeparator: S, decimalSeparator: p } = e, h = ie.useRef();
570
- return ie.useLayoutEffect(() => {
566
+ const ot = (e) => {
567
+ const { value: t, onChange: r, disabled: n, highlight: a, validatedSelection: i, fixedDecimals: l, allowNegative: m, thousandSeparator: S, decimalSeparator: p } = e, h = T.useRef();
568
+ return T.useLayoutEffect(() => {
571
569
  if (i !== void 0) {
572
570
  const c = typeof i == "number" ? [i, null] : i;
573
571
  h.current?.setSelectionRange(c[0], c[1]);
574
572
  }
575
- }, [i]), ie.createElement(
576
- Me,
573
+ }, [i]), T.createElement(
574
+ Be,
577
575
  null,
578
- ie.createElement(lt, {
576
+ T.createElement(at, {
579
577
  autoFocus: !0,
580
578
  getInputRef: h,
581
579
  className: "gdg-input",
@@ -583,8 +581,8 @@ const st = (e) => {
583
581
  disabled: n === !0,
584
582
  decimalScale: l,
585
583
  allowNegative: m,
586
- thousandSeparator: S ?? ft(),
587
- decimalSeparator: p ?? Ce(),
584
+ thousandSeparator: S ?? nt(),
585
+ decimalSeparator: p ?? we(),
588
586
  value: Object.is(t, -0) ? "-" : t ?? "",
589
587
  // decimalScale={3}
590
588
  // prefix={"$"}
@@ -593,5 +591,5 @@ const st = (e) => {
593
591
  );
594
592
  };
595
593
  export {
596
- st as default
594
+ ot as default
597
595
  };