@livestore/devtools-vite 0.3.0-dev.12 → 0.3.0-dev.13

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