@spscommerce/ds-react 8.36.0 → 8.37.1
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/lib/index.js +80 -78
- package/lib/index.umd.cjs +1 -1
- package/lib/utils/useDidUpdateEffect.d.ts +9 -0
- package/package.json +14 -14
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as a from "react";
|
|
2
|
-
import Z, { useRef as fe, useEffect as
|
|
2
|
+
import Z, { useRef as fe, useEffect as $e, useState as je, useCallback as $t, useMemo as et, createContext as Qd, useContext as rn, useReducer as ai, useLayoutEffect as eu } from "react";
|
|
3
3
|
import { getPath as Gr, setPath as jg, deepFreeze as Yl, diff as qg, DiffChange as $n, debounce as Jg, flatten as Zg, code as y, crumblePath as Xg, traversePath as Qg, forEachNestedObject as eb, constrain as tb, lockToAnimationFrames as nb } from "@spscommerce/utils";
|
|
4
4
|
import * as br from "moment-timezone";
|
|
5
5
|
import vt from "moment-timezone";
|
|
@@ -35,7 +35,7 @@ function Jn(e) {
|
|
|
35
35
|
}
|
|
36
36
|
function Nt(e, t) {
|
|
37
37
|
const n = Jn(e), r = fe(`${n.current}_ctrl`);
|
|
38
|
-
return
|
|
38
|
+
return $e(() => {
|
|
39
39
|
t && (t.id = r.current, t.update());
|
|
40
40
|
}, [t]), {
|
|
41
41
|
wrapperId: n.current || void 0,
|
|
@@ -1448,13 +1448,13 @@ const la = a.forwardRef((e, t) => {
|
|
|
1448
1448
|
[G]
|
|
1449
1449
|
), [Q, le] = a.useState(-1), [ie, q] = a.useState(x), ae = t || a.useRef(null), we = a.useRef(null), Re = a.useRef(null), pt = ia("sps-option-list-portal"), Xe = a.useContext(Jt), [it, tt] = J || [Te.BOTTOM_LEFT, Te.TOP_LEFT], [[Lt, nt], Ve] = a.useState([{}, !1]), Se = a.useRef(null), [
|
|
1450
1450
|
We,
|
|
1451
|
-
|
|
1451
|
+
Ke,
|
|
1452
1452
|
Ee
|
|
1453
1453
|
] = cv(
|
|
1454
1454
|
{ ...e, searchInputRef: Se }
|
|
1455
1455
|
), [ve, St] = iv(
|
|
1456
1456
|
e,
|
|
1457
|
-
|
|
1457
|
+
Ke,
|
|
1458
1458
|
Ee
|
|
1459
1459
|
);
|
|
1460
1460
|
a.useEffect(() => {
|
|
@@ -1489,12 +1489,12 @@ const la = a.forwardRef((e, t) => {
|
|
|
1489
1489
|
};
|
|
1490
1490
|
}, [ie]), a.useEffect(() => {
|
|
1491
1491
|
le(-1);
|
|
1492
|
-
}, [
|
|
1492
|
+
}, [Ke]);
|
|
1493
1493
|
const Xt = W(
|
|
1494
1494
|
K || "sps-option-list",
|
|
1495
1495
|
"z-stratum-dropdown",
|
|
1496
1496
|
ie && "sps-option-list--open",
|
|
1497
|
-
|
|
1497
|
+
Ke.isAsync && "sps-option-list--searchable",
|
|
1498
1498
|
nt && "sps-option-list--opens-upward",
|
|
1499
1499
|
G && G.label && "sps-option-list--has-special-action",
|
|
1500
1500
|
D
|
|
@@ -1622,9 +1622,9 @@ const la = a.forwardRef((e, t) => {
|
|
|
1622
1622
|
"data-testid": `${U}-options`,
|
|
1623
1623
|
style: gt
|
|
1624
1624
|
},
|
|
1625
|
-
!re &&
|
|
1626
|
-
(re ||
|
|
1627
|
-
!re &&
|
|
1625
|
+
!re && !Ke.pending && f && ve.length === 0 && /* @__PURE__ */ a.createElement("div", { className: "sps-option-list__zero-state" }, f),
|
|
1626
|
+
(re || Ke.pending) && /* @__PURE__ */ a.createElement("div", { className: "sps-option-list__loading" }, /* @__PURE__ */ a.createElement(ou, null)),
|
|
1627
|
+
!re && !Ke.pending && ve.map((me, be) => {
|
|
1628
1628
|
const at = `${k}-option-${be}`, Bt = pv(me.value, O, r), ue = nc(
|
|
1629
1629
|
rt.current,
|
|
1630
1630
|
r || "",
|
|
@@ -1663,8 +1663,8 @@ const la = a.forwardRef((e, t) => {
|
|
|
1663
1663
|
}
|
|
1664
1664
|
),
|
|
1665
1665
|
(!me.value || !me.value.icon && St) && /* @__PURE__ */ a.createElement("span", { className: "sps-option-list__option-icon-spacer" }),
|
|
1666
|
-
/* @__PURE__ */ a.createElement("span", null, Dn(me.text,
|
|
1667
|
-
me.caption && /* @__PURE__ */ a.createElement("div", { className: "sps-option-list__option-caption" }, /* @__PURE__ */ a.createElement("span", null, Dn(me.caption,
|
|
1666
|
+
/* @__PURE__ */ a.createElement("span", null, Dn(me.text, Ke.replacementPattern)),
|
|
1667
|
+
me.caption && /* @__PURE__ */ a.createElement("div", { className: "sps-option-list__option-caption" }, /* @__PURE__ */ a.createElement("span", null, Dn(me.caption, Ke.replacementPattern)))
|
|
1668
1668
|
);
|
|
1669
1669
|
})
|
|
1670
1670
|
),
|
|
@@ -1756,7 +1756,9 @@ function fv(e, t, n) {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
function du(e, t) {
|
|
1758
1758
|
const n = fe(!1);
|
|
1759
|
-
|
|
1759
|
+
$e(() => () => {
|
|
1760
|
+
n.current = !1;
|
|
1761
|
+
}, []), $e(() => {
|
|
1760
1762
|
if (n.current)
|
|
1761
1763
|
return e();
|
|
1762
1764
|
n.current = !0;
|
|
@@ -3566,7 +3568,7 @@ function gu(e, t) {
|
|
|
3566
3568
|
};
|
|
3567
3569
|
return p;
|
|
3568
3570
|
}
|
|
3569
|
-
var bu = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? eu :
|
|
3571
|
+
var bu = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? eu : $e;
|
|
3570
3572
|
function vu(e) {
|
|
3571
3573
|
var t = e.store, n = e.context, r = e.children, s = et(function() {
|
|
3572
3574
|
var c = gu(t);
|
|
@@ -3935,8 +3937,8 @@ function ny(e, t) {
|
|
|
3935
3937
|
};
|
|
3936
3938
|
function J(K) {
|
|
3937
3939
|
var re = et(function() {
|
|
3938
|
-
var We = K.reactReduxForwardedRef,
|
|
3939
|
-
return [K.context, We,
|
|
3940
|
+
var We = K.reactReduxForwardedRef, Ke = es(K, jv);
|
|
3941
|
+
return [K.context, We, Ke];
|
|
3940
3942
|
}, [K]), te = re[0], P = re[1], Y = re[2], ne = et(function() {
|
|
3941
3943
|
return te && te.Consumer && kc.isContextConsumer(/* @__PURE__ */ Z.createElement(te.Consumer, null)) ? te : x;
|
|
3942
3944
|
}, [te, x]), se = rn(ne), U = !!K.store && !!K.store.getState && !!K.store.dispatch, F = !!se && !!se.store;
|
|
@@ -3946,8 +3948,8 @@ function ny(e, t) {
|
|
|
3946
3948
|
return z($);
|
|
3947
3949
|
}, [$]), Q = et(function() {
|
|
3948
3950
|
if (!p) return Jv;
|
|
3949
|
-
var We = gu($, U ? null : se.subscription),
|
|
3950
|
-
return [We,
|
|
3951
|
+
var We = gu($, U ? null : se.subscription), Ke = We.notifyNestedSubs.bind(We);
|
|
3952
|
+
return [We, Ke];
|
|
3951
3953
|
}, [$, U, se]), le = Q[0], ie = Q[1], q = et(function() {
|
|
3952
3954
|
return U ? se : ge({}, se, {
|
|
3953
3955
|
subscription: le
|
|
@@ -4197,7 +4199,7 @@ function Cu(e, t) {
|
|
|
4197
4199
|
inputs: t,
|
|
4198
4200
|
result: e()
|
|
4199
4201
|
};
|
|
4200
|
-
return
|
|
4202
|
+
return $e(function() {
|
|
4201
4203
|
r.current = !1, s.current = l;
|
|
4202
4204
|
}, [l]), l.result;
|
|
4203
4205
|
}
|
|
@@ -4365,7 +4367,7 @@ function xu(e, t) {
|
|
|
4365
4367
|
var n;
|
|
4366
4368
|
Ry || typeof window < "u" && window[Ay] || (n = console)[e].apply(n, By(t));
|
|
4367
4369
|
}
|
|
4368
|
-
var
|
|
4370
|
+
var He = xu.bind(null, "warn"), Lo = xu.bind(null, "error");
|
|
4369
4371
|
function _n() {
|
|
4370
4372
|
}
|
|
4371
4373
|
function Fy(e, t) {
|
|
@@ -4401,7 +4403,7 @@ var $y = function(e) {
|
|
|
4401
4403
|
o[l] = arguments[l];
|
|
4402
4404
|
return r = e.call.apply(e, [this].concat(o)) || this, r.callbacks = null, r.unbind = _n, r.onWindowError = function(c) {
|
|
4403
4405
|
var u = r.getCallbacks();
|
|
4404
|
-
u.isDragging() && (u.tryAbort(), process.env.NODE_ENV !== "production" &&
|
|
4406
|
+
u.isDragging() && (u.tryAbort(), process.env.NODE_ENV !== "production" && He(`
|
|
4405
4407
|
An error was caught by our window 'error' event listener while a drag was occurring.
|
|
4406
4408
|
The active drag has been aborted.
|
|
4407
4409
|
`));
|
|
@@ -6123,7 +6125,7 @@ function pT(e) {
|
|
|
6123
6125
|
var u = !!n[c];
|
|
6124
6126
|
return u ? "[🔥" + c + "]" : "" + c;
|
|
6125
6127
|
}).join(", ");
|
|
6126
|
-
process.env.NODE_ENV !== "production" &&
|
|
6128
|
+
process.env.NODE_ENV !== "production" && He(`
|
|
6127
6129
|
Detected non-consecutive <Draggable /> indexes.
|
|
6128
6130
|
|
|
6129
6131
|
(This can cause unexpected bugs)
|
|
@@ -6383,11 +6385,11 @@ var CT = function(t) {
|
|
|
6383
6385
|
n = !0;
|
|
6384
6386
|
}), s = function(l) {
|
|
6385
6387
|
if (t) {
|
|
6386
|
-
process.env.NODE_ENV !== "production" &&
|
|
6388
|
+
process.env.NODE_ENV !== "production" && He("Announcement already made. Not making a second announcement");
|
|
6387
6389
|
return;
|
|
6388
6390
|
}
|
|
6389
6391
|
if (n) {
|
|
6390
|
-
process.env.NODE_ENV !== "production" &&
|
|
6392
|
+
process.env.NODE_ENV !== "production" && He(`
|
|
6391
6393
|
Announcements cannot be made asynchronously.
|
|
6392
6394
|
Default message has already been announced.
|
|
6393
6395
|
`);
|
|
@@ -6772,7 +6774,7 @@ function jc(e, t, n) {
|
|
|
6772
6774
|
if (n.descriptor.id === t.id || n.descriptor.type !== t.type)
|
|
6773
6775
|
return !1;
|
|
6774
6776
|
var r = e.droppable.getById(n.descriptor.droppableId);
|
|
6775
|
-
return r.descriptor.mode !== "virtual" ? (process.env.NODE_ENV !== "production" &&
|
|
6777
|
+
return r.descriptor.mode !== "virtual" ? (process.env.NODE_ENV !== "production" && He(`
|
|
6776
6778
|
You are attempting to add or remove a Draggable [id: ` + n.descriptor.id + `]
|
|
6777
6779
|
while a drag is occurring. This is only supported for virtual lists.
|
|
6778
6780
|
|
|
@@ -6879,7 +6881,7 @@ var YT = function(e, t) {
|
|
|
6879
6881
|
}, op = function(e) {
|
|
6880
6882
|
var t = e.startOfRange, n = e.endOfRange, r = e.current, s = n - t;
|
|
6881
6883
|
if (s === 0)
|
|
6882
|
-
return process.env.NODE_ENV !== "production" &&
|
|
6884
|
+
return process.env.NODE_ENV !== "production" && He(`
|
|
6883
6885
|
Detected distance range of 0 in the fluid auto scroller
|
|
6884
6886
|
This is unexpected and would cause a divide by 0 issue.
|
|
6885
6887
|
Not allowing an auto scroll
|
|
@@ -7252,7 +7254,7 @@ var YT = function(e, t) {
|
|
|
7252
7254
|
dropAnimating: Kr(l, "dropAnimating"),
|
|
7253
7255
|
userCancel: Kr(l, "userCancel")
|
|
7254
7256
|
};
|
|
7255
|
-
}, Ot = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? eu :
|
|
7257
|
+
}, Ot = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? eu : $e, po = function() {
|
|
7256
7258
|
var t = document.querySelector("head");
|
|
7257
7259
|
return t || (process.env.NODE_ENV !== "production" ? V(!1, "Cannot find the head to append a style to") : V()), t;
|
|
7258
7260
|
}, td = function(t) {
|
|
@@ -7308,11 +7310,11 @@ function ha(e) {
|
|
|
7308
7310
|
function dp(e, t) {
|
|
7309
7311
|
var n = "[" + Cr.contextId + '="' + e + '"]', r = _u(document.querySelectorAll(n));
|
|
7310
7312
|
if (!r.length)
|
|
7311
|
-
return process.env.NODE_ENV !== "production" &&
|
|
7313
|
+
return process.env.NODE_ENV !== "production" && He('Unable to find any drag handles in the context "' + e + '"'), null;
|
|
7312
7314
|
var s = Pn(r, function(o) {
|
|
7313
7315
|
return o.getAttribute(Cr.draggableId) === t;
|
|
7314
7316
|
});
|
|
7315
|
-
return s ? ha(s) ? s : (process.env.NODE_ENV !== "production" &&
|
|
7317
|
+
return s ? ha(s) ? s : (process.env.NODE_ENV !== "production" && He("drag handle needs to be a HTMLElement"), null) : (process.env.NODE_ENV !== "production" && He('Unable to find drag handle with id "' + t + '" as no handle with a matching id was found'), null);
|
|
7316
7318
|
}
|
|
7317
7319
|
function fw(e) {
|
|
7318
7320
|
var t = fe({}), n = fe(null), r = fe(null), s = fe(!1), o = he(function(h, S) {
|
|
@@ -7447,7 +7449,7 @@ function hw() {
|
|
|
7447
7449
|
}
|
|
7448
7450
|
function Sw() {
|
|
7449
7451
|
var e = Ie(hw, []);
|
|
7450
|
-
return
|
|
7452
|
+
return $e(function() {
|
|
7451
7453
|
return function() {
|
|
7452
7454
|
requestAnimationFrame(e.clean);
|
|
7453
7455
|
};
|
|
@@ -7473,7 +7475,7 @@ function vw(e) {
|
|
|
7473
7475
|
var t = Ie(function() {
|
|
7474
7476
|
return bw(e);
|
|
7475
7477
|
}, [e]), n = fe(null);
|
|
7476
|
-
|
|
7478
|
+
$e(function() {
|
|
7477
7479
|
var o = document.createElement("div");
|
|
7478
7480
|
return n.current = o, o.id = t, o.setAttribute("aria-live", "assertive"), o.setAttribute("aria-atomic", "true"), ge(o.style, gw), aa().appendChild(o), function() {
|
|
7479
7481
|
setTimeout(function() {
|
|
@@ -7488,7 +7490,7 @@ function vw(e) {
|
|
|
7488
7490
|
o.textContent = s;
|
|
7489
7491
|
return;
|
|
7490
7492
|
}
|
|
7491
|
-
process.env.NODE_ENV !== "production" &&
|
|
7493
|
+
process.env.NODE_ENV !== "production" && He(`
|
|
7492
7494
|
A screen reader message was trying to be announced but it was unable to do so.
|
|
7493
7495
|
This can occur if you unmount your <DragDropContext /> in your onDragEnd.
|
|
7494
7496
|
Consider calling provided.announce() before the unmount so that the instruction will
|
|
@@ -7525,7 +7527,7 @@ function ww(e) {
|
|
|
7525
7527
|
uniqueId: r
|
|
7526
7528
|
});
|
|
7527
7529
|
}, [r, t]);
|
|
7528
|
-
return
|
|
7530
|
+
return $e(function() {
|
|
7529
7531
|
var l = document.createElement("div");
|
|
7530
7532
|
return l.id = s, l.textContent = n, l.style.display = "none", aa().appendChild(l), function() {
|
|
7531
7533
|
var u = aa();
|
|
@@ -7550,7 +7552,7 @@ var bs = Z.createContext(null), Cw = {
|
|
|
7550
7552
|
return n.major > t.major ? !0 : n.major < t.major ? !1 : n.minor > t.minor ? !0 : n.minor < t.minor ? !1 : n.patch >= t.patch;
|
|
7551
7553
|
}, xw = function(e, t) {
|
|
7552
7554
|
var n = nd(e), r = nd(t);
|
|
7553
|
-
Nw(n, r) || process.env.NODE_ENV !== "production" &&
|
|
7555
|
+
Nw(n, r) || process.env.NODE_ENV !== "production" && He(`
|
|
7554
7556
|
React version: [` + r.raw + `]
|
|
7555
7557
|
does not satisfy expected peer dependency version: [` + n.raw + `]
|
|
7556
7558
|
|
|
@@ -7564,18 +7566,18 @@ var bs = Z.createContext(null), Cw = {
|
|
|
7564
7566
|
`, kw = function(e) {
|
|
7565
7567
|
var t = e.doctype;
|
|
7566
7568
|
if (!t) {
|
|
7567
|
-
process.env.NODE_ENV !== "production" &&
|
|
7569
|
+
process.env.NODE_ENV !== "production" && He(`
|
|
7568
7570
|
No <!doctype html> found.
|
|
7569
7571
|
|
|
7570
7572
|
` + mo + `
|
|
7571
7573
|
`);
|
|
7572
7574
|
return;
|
|
7573
7575
|
}
|
|
7574
|
-
t.name.toLowerCase() !== "html" && process.env.NODE_ENV !== "production" &&
|
|
7576
|
+
t.name.toLowerCase() !== "html" && process.env.NODE_ENV !== "production" && He(`
|
|
7575
7577
|
Unexpected <!doctype> found: (` + t.name + `)
|
|
7576
7578
|
|
|
7577
7579
|
` + mo + `
|
|
7578
|
-
`), t.publicId !== "" && process.env.NODE_ENV !== "production" &&
|
|
7580
|
+
`), t.publicId !== "" && process.env.NODE_ENV !== "production" && He(`
|
|
7579
7581
|
Unexpected <!doctype> publicId found: (` + t.publicId + `)
|
|
7580
7582
|
A html5 doctype does not have a publicId
|
|
7581
7583
|
|
|
@@ -7587,7 +7589,7 @@ function Pi(e) {
|
|
|
7587
7589
|
}
|
|
7588
7590
|
function Sa(e, t) {
|
|
7589
7591
|
Pi(function() {
|
|
7590
|
-
|
|
7592
|
+
$e(function() {
|
|
7591
7593
|
try {
|
|
7592
7594
|
e();
|
|
7593
7595
|
} catch (n) {
|
|
@@ -7607,7 +7609,7 @@ function Iw() {
|
|
|
7607
7609
|
}
|
|
7608
7610
|
function Bi(e) {
|
|
7609
7611
|
var t = fe(e);
|
|
7610
|
-
return
|
|
7612
|
+
return $e(function() {
|
|
7611
7613
|
t.current = e;
|
|
7612
7614
|
}), t;
|
|
7613
7615
|
}
|
|
@@ -8180,9 +8182,9 @@ function iC(e) {
|
|
|
8180
8182
|
function lC(e, t) {
|
|
8181
8183
|
var n = t.target;
|
|
8182
8184
|
if (!aC(n))
|
|
8183
|
-
return process.env.NODE_ENV !== "production" &&
|
|
8185
|
+
return process.env.NODE_ENV !== "production" && He("event.target must be a Element"), null;
|
|
8184
8186
|
var r = iC(e), s = oC(n, r);
|
|
8185
|
-
return s ? ha(s) ? s : (process.env.NODE_ENV !== "production" &&
|
|
8187
|
+
return s ? ha(s) ? s : (process.env.NODE_ENV !== "production" && He("drag handle must be a HTMLElement"), null) : null;
|
|
8186
8188
|
}
|
|
8187
8189
|
function cC(e, t) {
|
|
8188
8190
|
var n = lC(e, t);
|
|
@@ -8192,14 +8194,14 @@ function dC(e, t) {
|
|
|
8192
8194
|
var n = "[" + Vo.contextId + '="' + e + '"]', r = _u(document.querySelectorAll(n)), s = Pn(r, function(o) {
|
|
8193
8195
|
return o.getAttribute(Vo.id) === t;
|
|
8194
8196
|
});
|
|
8195
|
-
return s ? ha(s) ? s : (process.env.NODE_ENV !== "production" &&
|
|
8197
|
+
return s ? ha(s) ? s : (process.env.NODE_ENV !== "production" && He("Draggable element is not a HTMLElement"), null) : null;
|
|
8196
8198
|
}
|
|
8197
8199
|
function uC(e) {
|
|
8198
8200
|
e.preventDefault();
|
|
8199
8201
|
}
|
|
8200
8202
|
function Ka(e) {
|
|
8201
8203
|
var t = e.expected, n = e.phase, r = e.isLockActive, s = e.shouldWarn;
|
|
8202
|
-
return r() ? t !== n ? (s && process.env.NODE_ENV !== "production" &&
|
|
8204
|
+
return r() ? t !== n ? (s && process.env.NODE_ENV !== "production" && He(`
|
|
8203
8205
|
Cannot perform action.
|
|
8204
8206
|
The actions you used belong to an outdated phase
|
|
8205
8207
|
|
|
@@ -8209,7 +8211,7 @@ function Ka(e) {
|
|
|
8209
8211
|
Tips:
|
|
8210
8212
|
|
|
8211
8213
|
- Do not use preDragActions actions after calling preDragActions.lift()
|
|
8212
|
-
`), !1) : !0 : (s && process.env.NODE_ENV !== "production" &&
|
|
8214
|
+
`), !1) : !0 : (s && process.env.NODE_ENV !== "production" && He(`
|
|
8213
8215
|
Cannot perform action.
|
|
8214
8216
|
The sensor no longer has an action lock.
|
|
8215
8217
|
|
|
@@ -8224,7 +8226,7 @@ function gp(e) {
|
|
|
8224
8226
|
if (t.isClaimed())
|
|
8225
8227
|
return !1;
|
|
8226
8228
|
var o = r.draggable.findById(s);
|
|
8227
|
-
return o ? !(!o.options.isEnabled || !sp(n.getState(), s)) : (process.env.NODE_ENV !== "production" &&
|
|
8229
|
+
return o ? !(!o.options.isEnabled || !sp(n.getState(), s)) : (process.env.NODE_ENV !== "production" && He("Unable to find draggable with id: " + s), !1);
|
|
8228
8230
|
}
|
|
8229
8231
|
function pC(e) {
|
|
8230
8232
|
var t = e.lockAPI, n = e.contextId, r = e.store, s = e.registry, o = e.draggableId, l = e.forceSensorStop, c = e.sourceEvent, u = gp({
|
|
@@ -8237,7 +8239,7 @@ function pC(e) {
|
|
|
8237
8239
|
return null;
|
|
8238
8240
|
var f = s.draggable.getById(o), p = dC(n, f.descriptor.id);
|
|
8239
8241
|
if (!p)
|
|
8240
|
-
return process.env.NODE_ENV !== "production" &&
|
|
8242
|
+
return process.env.NODE_ENV !== "production" && He("Unable to find draggable element with id: " + o), null;
|
|
8241
8243
|
if (c && !f.options.canDragInteractiveElements && nC(p, c))
|
|
8242
8244
|
return null;
|
|
8243
8245
|
var m = t.claim(l || _n), h = "PRE_DRAG";
|
|
@@ -8475,7 +8477,7 @@ function SC(e) {
|
|
|
8475
8477
|
styleMarshal: m
|
|
8476
8478
|
});
|
|
8477
8479
|
}, [f, E, T, D, u, m]);
|
|
8478
|
-
process.env.NODE_ENV !== "production" && l.current && l.current !== w && process.env.NODE_ENV !== "production" &&
|
|
8480
|
+
process.env.NODE_ENV !== "production" && l.current && l.current !== w && process.env.NODE_ENV !== "production" && He("unexpected store change"), l.current = w;
|
|
8479
8481
|
var k = he(function() {
|
|
8480
8482
|
var A = Hr(l), R = A.getState();
|
|
8481
8483
|
R.phase !== "IDLE" && A.dispatch(Di());
|
|
@@ -8510,7 +8512,7 @@ function SC(e) {
|
|
|
8510
8512
|
registry: v,
|
|
8511
8513
|
customSensors: r,
|
|
8512
8514
|
enableDefaultSensors: e.enableDefaultSensors !== !1
|
|
8513
|
-
}),
|
|
8515
|
+
}), $e(function() {
|
|
8514
8516
|
return k;
|
|
8515
8517
|
}, [k]), Z.createElement(bs.Provider, {
|
|
8516
8518
|
value: C
|
|
@@ -8573,7 +8575,7 @@ var Fi = function(t) {
|
|
|
8573
8575
|
overflowX: r.overflowX,
|
|
8574
8576
|
overflowY: r.overflowY
|
|
8575
8577
|
};
|
|
8576
|
-
return wC(s, TC) || process.env.NODE_ENV !== "production" &&
|
|
8578
|
+
return wC(s, TC) || process.env.NODE_ENV !== "production" && He(`
|
|
8577
8579
|
We have detected that your <body> element might be a scroll container.
|
|
8578
8580
|
We have found no reliable way of detecting whether the <body> element is a scroll container.
|
|
8579
8581
|
Under most circumstances a <body> scroll bar will be on the <html> element (document.documentElement)
|
|
@@ -8588,7 +8590,7 @@ var Fi = function(t) {
|
|
|
8588
8590
|
}, DC = function(e) {
|
|
8589
8591
|
if (e) {
|
|
8590
8592
|
var t = yp(e.parentElement);
|
|
8591
|
-
t && process.env.NODE_ENV !== "production" &&
|
|
8593
|
+
t && process.env.NODE_ENV !== "production" && He(`
|
|
8592
8594
|
Droppable: unsupported nested scroll container detected.
|
|
8593
8595
|
A Droppable can only have one scroll parent (which can be itself)
|
|
8594
8596
|
Nested scroll containers are currently not supported.
|
|
@@ -8794,7 +8796,7 @@ function OC(e) {
|
|
|
8794
8796
|
}, [w, c, r]);
|
|
8795
8797
|
Ot(function() {
|
|
8796
8798
|
return u.current = k.descriptor, s.droppable.register(k), function() {
|
|
8797
|
-
t.current && (process.env.NODE_ENV !== "production" &&
|
|
8799
|
+
t.current && (process.env.NODE_ENV !== "production" && He("Unsupported: changing the droppableId or type of a Droppable during a drag"), E()), s.droppable.unregister(k);
|
|
8798
8800
|
};
|
|
8799
8801
|
}, [w, c, E, k, o, s.droppable]), Ot(function() {
|
|
8800
8802
|
t.current && o.updateDroppableIsEnabled(u.current.id, !e.isDropDisabled);
|
|
@@ -8840,7 +8842,7 @@ function BC(e) {
|
|
|
8840
8842
|
var t = fe(null), n = he(function() {
|
|
8841
8843
|
t.current && (clearTimeout(t.current), t.current = null);
|
|
8842
8844
|
}, []), r = e.animate, s = e.onTransitionEnd, o = e.onClose, l = e.contextId, c = je(e.animate === "open"), u = c[0], f = c[1];
|
|
8843
|
-
|
|
8845
|
+
$e(function() {
|
|
8844
8846
|
return u ? r !== "open" ? (n(), f(!1), ho) : t.current ? ho : (t.current = setTimeout(function() {
|
|
8845
8847
|
t.current = null, f(!1);
|
|
8846
8848
|
}), n) : ho;
|
|
@@ -8889,7 +8891,7 @@ var FC = [function(t) {
|
|
|
8889
8891
|
var n = t.props, r = t.getPlaceholderRef;
|
|
8890
8892
|
if (n.placeholder) {
|
|
8891
8893
|
var s = r();
|
|
8892
|
-
s || process.env.NODE_ENV !== "production" &&
|
|
8894
|
+
s || process.env.NODE_ENV !== "production" && He(`
|
|
8893
8895
|
Droppable setup issue [droppableId: "` + n.droppableId + `"]:
|
|
8894
8896
|
DroppableProvided > placeholder could not be found.
|
|
8895
8897
|
|
|
@@ -9992,7 +9994,7 @@ function jM(e, t) {
|
|
|
9992
9994
|
}
|
|
9993
9995
|
function qM(e, t = null) {
|
|
9994
9996
|
const [n, r] = je(t), s = fe(() => null);
|
|
9995
|
-
return
|
|
9997
|
+
return $e(() => {
|
|
9996
9998
|
const o = () => n;
|
|
9997
9999
|
if (e.validators) {
|
|
9998
10000
|
const l = e.validators.indexOf(s.current);
|
|
@@ -12275,7 +12277,7 @@ const BD = {
|
|
|
12275
12277
|
}
|
|
12276
12278
|
function Lt(Se) {
|
|
12277
12279
|
ee({
|
|
12278
|
-
optionIds: new Array(Se).fill("").map((We,
|
|
12280
|
+
optionIds: new Array(Se).fill("").map((We, Ke) => `${P}-options-option-${Ke}`).join(",")
|
|
12279
12281
|
});
|
|
12280
12282
|
}
|
|
12281
12283
|
a.useEffect(() => (document.addEventListener("click", we), document.addEventListener("DropdownOpened", tt), () => {
|
|
@@ -13011,7 +13013,7 @@ function Bp({
|
|
|
13011
13013
|
ie(me);
|
|
13012
13014
|
}
|
|
13013
13015
|
}
|
|
13014
|
-
function
|
|
13016
|
+
function Ke(ce) {
|
|
13015
13017
|
X.validateTimeString(ce ?? te, p) && (P(
|
|
13016
13018
|
X.padIncompleteTimeString(ce ?? te, p)
|
|
13017
13019
|
), setTimeout(() => We(void 0, ce), 0));
|
|
@@ -13020,7 +13022,7 @@ function Bp({
|
|
|
13020
13022
|
U(ce.target.value);
|
|
13021
13023
|
}
|
|
13022
13024
|
function ve(ce) {
|
|
13023
|
-
X.validateTimeString(ce, p) && (P(ce), setTimeout(() =>
|
|
13025
|
+
X.validateTimeString(ce, p) && (P(ce), setTimeout(() => Ke(ce), 0));
|
|
13024
13026
|
}
|
|
13025
13027
|
a.useEffect(() => {
|
|
13026
13028
|
se !== z[2] && We();
|
|
@@ -13219,7 +13221,7 @@ function Bp({
|
|
|
13219
13221
|
zeroState: "Custom time",
|
|
13220
13222
|
value: te,
|
|
13221
13223
|
onChange: Se,
|
|
13222
|
-
onBlur: () =>
|
|
13224
|
+
onBlur: () => Ke(),
|
|
13223
13225
|
onSelectionChange: ve,
|
|
13224
13226
|
disabled: t,
|
|
13225
13227
|
inputNotClearable: !0,
|
|
@@ -13234,7 +13236,7 @@ function Bp({
|
|
|
13234
13236
|
zeroState: "Custom time",
|
|
13235
13237
|
value: te,
|
|
13236
13238
|
onChange: Se,
|
|
13237
|
-
onBlur: () =>
|
|
13239
|
+
onBlur: () => Ke(),
|
|
13238
13240
|
onSelectionChange: ve,
|
|
13239
13241
|
disabled: t,
|
|
13240
13242
|
inputNotClearable: !0,
|
|
@@ -13865,7 +13867,7 @@ Arguments: ` + Array.prototype.slice.call(b).join("") + `
|
|
|
13865
13867
|
isoWeek: 5,
|
|
13866
13868
|
year: 1
|
|
13867
13869
|
};
|
|
13868
|
-
function
|
|
13870
|
+
function Ke(i) {
|
|
13869
13871
|
var d = [], g;
|
|
13870
13872
|
for (g in i)
|
|
13871
13873
|
c(i, g) && d.push({ unit: g, priority: We[g] });
|
|
@@ -14008,7 +14010,7 @@ Arguments: ` + Array.prototype.slice.call(b).join("") + `
|
|
|
14008
14010
|
function Tf(i, d) {
|
|
14009
14011
|
if (typeof i == "object") {
|
|
14010
14012
|
i = Se(i);
|
|
14011
|
-
var g =
|
|
14013
|
+
var g = Ke(i), b, N = g.length;
|
|
14012
14014
|
for (b = 0; b < N; b++)
|
|
14013
14015
|
this[g[b].unit](i[g[b].unit]);
|
|
14014
14016
|
} else if (i = Ve(i), M(this[i]))
|
|
@@ -22716,7 +22718,7 @@ function nm({
|
|
|
22716
22718
|
P.opensUpward && "sps-multi-select--opens-upward",
|
|
22717
22719
|
c && "sps-form-control--disabled",
|
|
22718
22720
|
n
|
|
22719
|
-
),
|
|
22721
|
+
), Ke = new Array(G.length).fill(0).map((Ee, ve) => `${re}_tag-${ve}`);
|
|
22720
22722
|
return a.useEffect(() => {
|
|
22721
22723
|
let Ee;
|
|
22722
22724
|
return Q && (Ee = () => {
|
|
@@ -22737,7 +22739,7 @@ function nm({
|
|
|
22737
22739
|
onKeyDown: tt,
|
|
22738
22740
|
role: "listbox",
|
|
22739
22741
|
"aria-multiselectable": !0,
|
|
22740
|
-
"aria-activedescendant":
|
|
22742
|
+
"aria-activedescendant": Ke[P.activeTagIndex || 0],
|
|
22741
22743
|
"aria-owns": P.optionIds
|
|
22742
22744
|
},
|
|
22743
22745
|
/* @__PURE__ */ a.createElement(
|
|
@@ -22758,11 +22760,11 @@ function nm({
|
|
|
22758
22760
|
/* @__PURE__ */ a.createElement("div", { className: "sps-multi-select__tags-and-input", ref: $ }, h ? null : G.map((Ee, ve) => /* @__PURE__ */ a.createElement(
|
|
22759
22761
|
ms,
|
|
22760
22762
|
{
|
|
22761
|
-
id:
|
|
22763
|
+
id: Ke[ve],
|
|
22762
22764
|
role: "option",
|
|
22763
22765
|
disabled: c,
|
|
22764
22766
|
"aria-selected": "true",
|
|
22765
|
-
key:
|
|
22767
|
+
key: Ke[ve],
|
|
22766
22768
|
onRemove: () => Xe(ve),
|
|
22767
22769
|
wrap: J
|
|
22768
22770
|
},
|
|
@@ -22784,7 +22786,7 @@ function nm({
|
|
|
22784
22786
|
disabled: c,
|
|
22785
22787
|
role: "listbox",
|
|
22786
22788
|
"aria-multiselectable": "true",
|
|
22787
|
-
"aria-owns":
|
|
22789
|
+
"aria-owns": Ke.join(" "),
|
|
22788
22790
|
...O
|
|
22789
22791
|
}
|
|
22790
22792
|
)),
|
|
@@ -29552,7 +29554,7 @@ function Rm(e) {
|
|
|
29552
29554
|
};
|
|
29553
29555
|
}, [
|
|
29554
29556
|
s
|
|
29555
|
-
]),
|
|
29557
|
+
]), $e(() => {
|
|
29556
29558
|
let l = r.current;
|
|
29557
29559
|
l && (r.current = null, n(l));
|
|
29558
29560
|
}), s;
|
|
@@ -29786,7 +29788,7 @@ function Am() {
|
|
|
29786
29788
|
}, [
|
|
29787
29789
|
n
|
|
29788
29790
|
]);
|
|
29789
|
-
return
|
|
29791
|
+
return $e(() => r, [
|
|
29790
29792
|
r
|
|
29791
29793
|
]), {
|
|
29792
29794
|
addGlobalListener: t,
|
|
@@ -29854,7 +29856,7 @@ function xk(e) {
|
|
|
29854
29856
|
}
|
|
29855
29857
|
function Ad(e, t, n, r) {
|
|
29856
29858
|
let s = ur(n), o = n == null;
|
|
29857
|
-
|
|
29859
|
+
$e(() => {
|
|
29858
29860
|
if (o || !e.current) return;
|
|
29859
29861
|
let l = e.current;
|
|
29860
29862
|
return l.addEventListener(t, s, r), () => {
|
|
@@ -29917,7 +29919,7 @@ function kk(e) {
|
|
|
29917
29919
|
}
|
|
29918
29920
|
function $m(e, t, n) {
|
|
29919
29921
|
let [r, s] = je(e || t), o = fe(e !== void 0), l = e !== void 0;
|
|
29920
|
-
|
|
29922
|
+
$e(() => {
|
|
29921
29923
|
let f = o.current;
|
|
29922
29924
|
f !== l && console.warn(`WARN: A component changed from ${f ? "controlled" : "uncontrolled"} to ${l ? "controlled" : "uncontrolled"}.`), o.current = l;
|
|
29923
29925
|
}, [
|
|
@@ -30273,7 +30275,7 @@ function Wm(e) {
|
|
|
30273
30275
|
w,
|
|
30274
30276
|
I
|
|
30275
30277
|
]);
|
|
30276
|
-
return
|
|
30278
|
+
return $e(() => () => {
|
|
30277
30279
|
var C;
|
|
30278
30280
|
p || Ga((C = T.current.target) !== null && C !== void 0 ? C : void 0);
|
|
30279
30281
|
}, [
|
|
@@ -30663,7 +30665,7 @@ function zd() {
|
|
|
30663
30665
|
}
|
|
30664
30666
|
function nI() {
|
|
30665
30667
|
let e = _m(), [t, n] = je(ri);
|
|
30666
|
-
return
|
|
30668
|
+
return $e(() => (Ur.size === 0 && window.addEventListener("languagechange", zd), Ur.add(n), () => {
|
|
30667
30669
|
Ur.delete(n), Ur.size === 0 && window.removeEventListener("languagechange", zd);
|
|
30668
30670
|
}), []), e ? {
|
|
30669
30671
|
locale: "en-US",
|
|
@@ -30802,7 +30804,7 @@ function aI(e) {
|
|
|
30802
30804
|
R.currentTarget.contains(R.relatedTarget) || t.setFocused(!1);
|
|
30803
30805
|
};
|
|
30804
30806
|
const x = fe(s);
|
|
30805
|
-
|
|
30807
|
+
$e(() => {
|
|
30806
30808
|
if (x.current) {
|
|
30807
30809
|
let R = null;
|
|
30808
30810
|
s === "first" && (R = n.getFirstKey()), s === "last" && (R = n.getLastKey());
|
|
@@ -30817,7 +30819,7 @@ function aI(e) {
|
|
|
30817
30819
|
}
|
|
30818
30820
|
}, []);
|
|
30819
30821
|
let _ = fe(t.focusedKey);
|
|
30820
|
-
|
|
30822
|
+
$e(() => {
|
|
30821
30823
|
if (t.isFocused && t.focusedKey != null && (t.focusedKey !== _.current || x.current) && S?.current) {
|
|
30822
30824
|
let R = ti(), L = r.current.querySelector(`[data-key="${CSS.escape(t.focusedKey.toString())}"]`);
|
|
30823
30825
|
if (!L)
|
|
@@ -30865,7 +30867,7 @@ function sI(e) {
|
|
|
30865
30867
|
t.selectionMode === "single" ? t.isSelected(n) && !t.disallowEmptySelection ? t.toggleSelection(n) : t.replaceSelection(n) : K && K.shiftKey ? t.extendSelection(n) : t.selectionBehavior === "toggle" || K && (mr(K) || K.pointerType === "touch" || K.pointerType === "virtual") ? t.toggleSelection(n) : t.replaceSelection(n);
|
|
30866
30868
|
}
|
|
30867
30869
|
};
|
|
30868
|
-
|
|
30870
|
+
$e(() => {
|
|
30869
30871
|
n === t.focusedKey && t.isFocused && !o && (l ? l() : document.activeElement !== r.current && ni(r.current));
|
|
30870
30872
|
}, [
|
|
30871
30873
|
r,
|
|
@@ -31161,7 +31163,7 @@ function mI(e) {
|
|
|
31161
31163
|
]), [E, D] = je(s);
|
|
31162
31164
|
s === "replace" && E === "toggle" && typeof S == "object" && S.size === 0 && D("replace");
|
|
31163
31165
|
let w = fe(s);
|
|
31164
|
-
return
|
|
31166
|
+
return $e(() => {
|
|
31165
31167
|
s !== w.current && (D(s), w.current = s);
|
|
31166
31168
|
}, [
|
|
31167
31169
|
s
|
|
@@ -31473,7 +31475,7 @@ function hI(e) {
|
|
|
31473
31475
|
n
|
|
31474
31476
|
]);
|
|
31475
31477
|
const f = fe(null);
|
|
31476
|
-
return
|
|
31478
|
+
return $e(() => {
|
|
31477
31479
|
if (r.focusedKey != null && !c.getItem(r.focusedKey) && f.current) {
|
|
31478
31480
|
const D = f.current.getItem(r.focusedKey), w = [
|
|
31479
31481
|
...f.current.getKeys()
|
|
@@ -31551,7 +31553,7 @@ function gI(e) {
|
|
|
31551
31553
|
suppressTextValueWarning: !0,
|
|
31552
31554
|
defaultSelectedKey: (t = e.defaultSelectedKey) !== null && t !== void 0 ? t : Xd(e.collection, e.disabledKeys ? new Set(e.disabledKeys) : /* @__PURE__ */ new Set())
|
|
31553
31555
|
}), { selectionManager: r, collection: s, selectedKey: o } = n, l = fe(o);
|
|
31554
|
-
return
|
|
31556
|
+
return $e(() => {
|
|
31555
31557
|
let c = o;
|
|
31556
31558
|
(r.isEmpty || !s.getItem(c)) && (c = Xd(s, n.disabledKeys), c != null && r.setSelectedKeys([
|
|
31557
31559
|
c
|
|
@@ -34514,7 +34516,7 @@ const u0 = () => {
|
|
|
34514
34516
|
const p = [...e];
|
|
34515
34517
|
p.pop()?.resolve(f), t(p);
|
|
34516
34518
|
}, [s, o] = je(!1), [l, c] = je();
|
|
34517
|
-
|
|
34519
|
+
$e(() => {
|
|
34518
34520
|
s && (r(l), o(!1));
|
|
34519
34521
|
}, [s]);
|
|
34520
34522
|
const u = (f) => {
|
package/lib/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(_,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("@spscommerce/utils"),require("moment-timezone"),require("@spscommerce/ds-shared"),require("@spscommerce/i18n"),require("react-dom"),require("@spscommerce/ds-colors"),require("@sps-woodland/tabs"),require("@react-stately/collections"),require("@sps-woodland/illustrations")):typeof define=="function"&&define.amd?define(["exports","react","@spscommerce/utils","moment-timezone","@spscommerce/ds-shared","@spscommerce/i18n","react-dom","@spscommerce/ds-colors","@sps-woodland/tabs","@react-stately/collections","@sps-woodland/illustrations"],x):(_=typeof globalThis<"u"?globalThis:_||self,x(_.DSReact={},_.React,_.utils,_.moment$5,_.dsShared,_.i18n,_.ReactDOM,_.dsColors,_.tabs,_.collections,_.illustrations))})(this,function(_,x,v,lt,Y,Oe,mo,Ma,Rh,Xn,Wl){"use strict";function Gl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=Gl(x),Qn=Gl(lt);function Yl(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Yl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function U(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Yl(e))&&(r&&(r+=" "),r+=t);return r}const Ph="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ht=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Ph[n[e]&63];return t};function hn(e){return x.useRef(e||ht())}function St(e,t){const n=hn(e),r=x.useRef(`${n.current}_ctrl`);return x.useEffect(()=>{t&&(t.id=r.current,t.update())},[t]),{wrapperId:n.current||void 0,controlId:r.current}}function _a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var La,Ul;function Bh(){if(Ul)return La;Ul=1;var e="[object Object]";function t(h){var S=!1;if(h!=null&&typeof h.toString!="function")try{S=!!(h+"")}catch{}return S}function n(h,S){return function(y){return h(S(y))}}var r=Function.prototype,a=Object.prototype,s=r.toString,l=a.hasOwnProperty,c=s.call(Object),p=a.toString,f=n(Object.getPrototypeOf,Object);function u(h){return!!h&&typeof h=="object"}function m(h){if(!u(h)||p.call(h)!=e||t(h))return!1;var S=f(h);if(S===null)return!0;var y=l.call(S,"constructor")&&S.constructor;return typeof y=="function"&&y instanceof y&&s.call(y)==c}return La=m,La}var Ah=Bh();const zl=_a(Ah),Ct=new Set,er=new Set,zt=new Set,fo=new Set;function jl(e){Ct.has(e)||zt.has(e)||fo.has(e)||er.add(e)}function ql(e){Ct.has(e)||zt.has(e)||er.has(e)||fo.add(e)}const ct=Qn.default||Qn,tr="MM/DD/YYYY",Fh="MM/DD/YYYY hh:mm A",Vh="MM/DD/YYYY HH:mm",$h="hh:mm A",Kh="HH:mm",Hh=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,Dr=Symbol("Date Parse Error");function nr(e){return ct.isMoment(e)?e.year()*1e4+(e.month()+1)*100+e.date():e.year*1e4+e.month*100+e.date}const ee=Object.freeze({createFrom(e,t){if(!e)return null;if(typeof e=="string"){if(t){const n=ct(e,t,!0);if(n.isValid())return Object.freeze({year:n.year(),month:n.month()+1,date:n.date()})}else{const n=Hh.exec(e);if(n){const[,r,a,s]=n;return Object.freeze({year:Number(s),month:Number(r),date:Number(a)})}}return Object.freeze({[Dr]:!0,year:void 0,month:void 0,date:void 0})}return Object.freeze({year:e.year(),month:e.month()+1,date:e.date()})},createMomentFrom(e,t){if(!e)return null;let n=null;return typeof e=="string"?t?n=ct(e,t,!0):n=ct(e):ct.isMoment(e)?n=e:n=ee.toMoment(e),n!==null&&ct.isMoment(n)&&n.isValid()?n:Object.freeze({[Dr]:!0,year:void 0,month:void 0,date:void 0})},getRangeSeparator(e){return e?.includes("-")?"/":"-"},createRangeFrom(e,t){if(!e)return null;if(t){const n=ee.getRangeSeparator(t),r=new RegExp(`[^\\d]*${n}[^\\d]*`);return e.split(r).slice(0,2).map(a=>ee.createFrom(a,t))}else return e.split(/[^\d]*-[^\d]*/).slice(0,2).map(n=>ee.createFrom(n))},isValid(e){return e?ct.isMoment(e)?e.isValid():typeof e=="object"&&typeof e.year=="number"&&typeof e.month=="number"&&typeof e.date=="number"&&ee.toMoment(e)?.isValid():!1},nullifyInvalidDate(e){return ee.isValid(e)?e:null},toMoment(e){return e?ct.isMoment(e)?e:ct({...e,month:e.month-1}):null},toString(e,t){const n=ee.toMoment(e);return n&&n.isValid()?n.format(t||tr):""},toStringRange(e,t){if(!e)return"";const n=ee.getRangeSeparator(t);return e.slice(0,2).map(r=>ee.toString(r,t)).join(n)},toDateTimeString(e,t=!1,n){return e&&ct.isMoment(e)&&e.isValid()?n?t?e.format(`${n} ${Kh}`):e.format(`${n} ${$h}`):t?e.format(Vh):e.format(Fh):""},toDateTimeStringRange(e,t=!1,n){if(!e)return"";const r=ee.getRangeSeparator(n);return e.map(a=>ee.toDateTimeString(a,t,n)).join(r)},create(){const e=new Date;return Object.freeze({year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate()})},isSameDate(e,t){return e&&t&&e.year===t.year&&e.month===t.month&&e.date===t.date},isSameMonth(e,t){return e&&t&&e.year===t.year&&e.month===t.month},isAfter(e,t){return!e||!t?null:nr(e)>nr(t)},isBefore(e,t){return!e||!t?null:nr(e)<nr(t)},isInRange(e,t,n=!0){if(!e||!t||!t[0]||!t[1])return null;const r=nr(e),[a,s]=t.map(nr);return a&&s&&(n&&r>=a&&r<=s||!n&&r>a&&r<s)},prevMonth(e){return Object.freeze({year:e.month===1?e.year-1:e.year,month:e.month-1||12,date:e.date})},nextMonth(e){return Object.freeze({year:e.month===12?e.year+1:e.year,month:e.month+1>12?1:e.month+1,date:e.date})},createRangeFromPreset(e,t){if(typeof e.definition=="function")return e.definition();const n=ct(),r=n.clone().subtract(ct.duration(e.definition));return[ee.createFrom(r,t),ee.createFrom(n,t)]},createDateTimeRangeFromPreset(e){if(typeof e.definition=="function")return e.definition();const t=ct().subtract(ct.duration(e.definition)).startOf("day"),n=ct().endOf("day");return[t,n]},splitMomentInDateTimeParts(e,t=!1,n,r=!1){let a="";t?a=r?"23:59":"00:00":a=r?"11:59":"12:00";const s=r?"PM":"AM";return e&&ct.isMoment(e)&&e.isValid()?ee.toDateTimeString(e,t,n).split(" "):["",a,t?void 0:s]},getCurrentMoment(){return ct()},validateTimeString(e,t=!1){if(!e)return!0;const n=e.split(":"),r=n[0]||"0",a=n[1]||"0",s=Number.isNaN(Number(r))?NaN:parseInt(r,10),l=Number.isNaN(Number(a))?NaN:parseInt(a,10),c=n.length<=2&&r.length<=2&&a.length<=2;return t?c&&s>=0&&s<=23&&l>=0&&l<=59:c&&(!Number.isNaN(s)&&r.length===1||s>=1)&&s<=12&&l>=0&&l<=59},padIncompleteTimeString(e,t=!1){if(!e)return"";const n=e.split(":"),r=parseInt(n[0]||"0",10),a=parseInt(n[1]||"0",10);if(t){const s=r<10?`0${r}`:`${r}`,l=a<10?`0${a}`:`${a}`;return`${s}:${l}`}else{const s=r===0?"12":r<10?`0${r}`:`${r}`,l=a<10?`0${a}`:`${a}`;return`${s}:${l}`}}}),Oa=["01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00"],Ra=["00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"];let ho=tr;function Jl(e){ho=e}const Nr=function(t){if(Array.isArray(t)){const n=Nr(t[0]),r=Nr(t[1]);return n||r}if(t&&t.hasOwnProperty("year")){if(t[Dr])return{dateFormat:ho};if(!ee.isValid(t))return{dateValidity:!0}}return null};Ct.add("dateFormat"),Ct.add("dateValidity");const Zl=function(t){if(Array.isArray(t)){const n=Nr(t);if(n)return n;if(t&&ee.isBefore(t[1],t[0]))return{dateRangeOrder:!0}}return null};Ct.add("dateRangeOrder");const Xl=function({minDate:t,maxDate:n}){function r(a){const s=ee.isBefore(a,t),l=ee.isAfter(a,n),c={minExceeded:s?ee.toString(t,ho):null,maxExceeded:l?ee.toString(n,ho):null};return s||l?{dateConstraint:c}:null}return function(s){if(!s)return null;if(Array.isArray(s)){const l=r(s[0]),c=r(s[1]);return l||c}return s.hasOwnProperty("year")?r(s):null}};Ct.add("dateConstraint");const Wh=Object.freeze(Object.defineProperty({__proto__:null,date:Nr,dateConstraint:Xl,dateRange:Zl,setDateFormat:Jl},Symbol.toStringTag,{value:"Module"}));function en(e,t){for(const n of[].concat(e)){const r=t(n);if(r)return r}return null}const Gh=function(t){function n(r){return Number(r)>=t?null:{min:t}}return r=>en(r,n)};Ct.add("min");const Yh=function(t){function n(r){return Number(r)<=t?null:{max:t}}return r=>en(r,n)};er.add("max");const Uh=function(t){return typeof t>"u"||t===null||t===""||Number.isNaN(t)||t?.length===0?{required:!0}:null};er.add("required");const zh=function(t){function n(r){return r===void 0||r.toString().length<t?{minLength:t}:null}return r=>en(r,n)};Ct.add("minLength");const jh=function(t){function n(r){return r==null||Array.isArray(r)&&r.length<t?{minLengthArray:t}:null}return r=>n(r)};Ct.add("minLengthArray");const qh=function(t){function n(r){return r===void 0||r.toString().length<=t?null:{maxLength:t}}return r=>en(r,n)};zt.add("maxLength");const Jh=function(t){function n(r){return r==null||Array.isArray(r)&&r.length<=t?null:{maxLengthArray:t}}return r=>n(r)};Ct.add("maxLengthArray");const Zh=function(t){const n=t instanceof RegExp?t:new RegExp(t);function r(a){return n.test(a)?null:{pattern:t}}return a=>en(a,r)};Ct.add("pattern");const Xh=function(e){function t(n){return new RegExp("^\\p{L}*$","u").test(n)?null:{alpha:!0}}return en(e,t)};zt.add("alpha");const Qh=function(e){function t(n){return/^[0-9,. ]*$/.test(n)?null:{numeric:!0}}return en(e,t)};zt.add("numeric");const eS=function(e){function t(n){return/^-?[0-9,. ]*$/.test(n)?null:{positiveOrNegativeNumber:!0}}return en(e,t)};zt.add("positiveOrNegativeNumber");const tS=function(e){function t(n){return/^[^0-9]*$/.test(n)?null:{nonNumeric:!0}}return en(e,t)};zt.add("nonNumeric");const So=Object.freeze({...Wh,min:Gh,max:Yh,required:Uh,minLength:zh,minLengthArray:jh,maxLength:qh,maxLengthArray:Jh,pattern:Zh,alpha:Xh,numeric:Qh,nonNumeric:tS,positiveOrNegativeNumber:eS,OnBlurErrorKeys:Ct});function go(e,t=[]){const n=t.reduce((r,a)=>Object.assign(r,a(e)||{}),{});return Object.keys(n).length?n:null}var jt=(e=>(e[e.ON_CHANGE=0]="ON_CHANGE",e[e.ON_BLUR=1]="ON_BLUR",e[e.ON_SUBMIT=2]="ON_SUBMIT",e))(jt||{});function nS(e,t={},n=[]){for(const[r,a]of Object.entries(t))a===0?jl(r):a===2&&ql(r);return o.useCallback(e,n)}class _n{constructor(t,n){this.path=t,this.update=n,this.validators=[],this.#n=null,this.#e=null,this.#t=null,this.preventativeErrors=[],this.submitted=!1}#n;#e;#t;get errors(){return this.#n===null&&this.#e===null&&this.#t===null?null:{...this.#n??{},...this.#e??{},...this.#t??{}}}setValidators(t){return this.update(this.path,null,void 0,t),this}validate(t,n,r=!1){if(this.validators&&this.validators.length>0){const a=go(t,this.validators);let s={onSubmit:{},onChange:{},onBlur:{}};a&&(s=Object.keys(a).reduce((l,c)=>(fo.has(c)?l.onSubmit[c]=a[c]:er.has(c)?l.onChange[c]=a[c]:l.onBlur[c]=a[c],l),s)),(typeof n>"u"||n===jt.ON_CHANGE)&&(this.#e=Object.keys(s.onChange).length===0?null:s.onChange),(typeof n>"u"||n===jt.ON_BLUR)&&(this.#t=Object.keys(s.onBlur).length===0?null:s.onBlur),(typeof n>"u"||n===jt.ON_SUBMIT)&&(this.#n=Object.keys(s.onSubmit).length===0?null:s.onSubmit,this.#e=Object.keys(s.onChange).length===0?null:s.onChange,this.#t=Object.keys(s.onBlur).length===0?null:s.onBlur),r||this.update(),this.isFocused()&&this.onFocus&&this.onFocus()}else this.errors&&(this.#n=null,this.#t=null,this.#e=null,r||this.update());return this}isValid(){return!this.errors||this.isPristine()}hasErrors(){return!!this.errors}isVisibilyInvalid(){return!this.isValid()}hasError(t){return this.errors&&Object.prototype.hasOwnProperty.call(this.errors,t)}hasPreventativeError(t){return this.preventativeErrors.includes(t)}hasPreventativeErrors(){return this.preventativeErrors.length>0}isRequired(){return this.validators&&this.validators.indexOf(So.required)>-1}isSubmitted(){return this.submitted}onFocus(){}onBlur(){}}class kr extends _n{constructor(){super(...arguments),this.id=ht(),this.focused=!1,this.pristine=!0}setValue(t){if(this.preventativeErrors=[],this.validators&&this.validators.length>0){const n=go(t,this.validators);if(n&&Object.keys(n).filter(a=>zt.has(a)).length>0){this.preventativeErrors=Object.keys(n);return}}this.update(this.path,t)}isPristine(){return this.pristine}markAsPristine(){return this.pristine=!0,this.update(),this}markAsDirty(){return this.pristine=!1,this.update(),this}isFocused(){return this.focused}markAsFocused(){return this.focused=!0,this.update(),this.onFocus&&this.onFocus(),this}markAsBlurred(){return this.update(this.path,null,!0),this.onBlur&&this.onBlur(),this.preventativeErrors=[],this}markAsSubmitted(){return this.submitted=!0,this.update(this.path,null,!1,void 0,!0),this}}class Ln extends kr{constructor(t,n,r){const a=r?n:t,s=r||n;super(a,s),r&&this.inferMembers(t)}isFocused(){return super.isFocused()||this.rollup("isFocused")}isValid(){return super.isValid()&&this.rollup("isValid")}hasErrors(){return super.hasErrors()||Object.keys(this.fields).some(t=>this.fields[t].hasErrors())}contentsAreValid(){return this.rollup("isValid")&&this.rollup("contentsAreValid")}isPristine(){return super.isPristine()&&this.rollup("isPristine")}markAsPristine(){super.markAsPristine();for(const t of Object.keys(this.fields))this.fields[t].markAsPristine();return this}markAsDirty(){super.markAsDirty();for(const t of Object.keys(this.fields))this.fields[t].markAsDirty();return this}markAsBlurred(){super.markAsBlurred();for(const t of Object.keys(this.fields))this.fields[t].markAsBlurred();return this}markAsSubmitted(){super.markAsSubmitted();for(const t of Object.keys(this.fields))this.fields[t].markAsSubmitted();return this}inferSpsControl(t,n){return bo(t,[...this.path,n],this.update)}rollup(t){return Object.keys(this.fields).reduce((n,r)=>n&&(!this.fields[r][t]||this.fields[r][t]()),!0)}}class Ql extends Ln{inferMembers(t){this.fields={};for(const n of Object.keys(t))this.fields[n]=this.inferSpsControl(t[n],n)}}class ec extends Ln{inferMembers(t){this.fields=t.map((n,r)=>this.inferSpsControl(n,String(r)))}}function bo(e,t,n){return e instanceof _n?(e.path=t,e.update=n,e):Array.isArray(e)?new ec(e,t,n):zl(e)?new Ql(e,t,n):new kr(t,n)}function Ir(e,t){return t.length===0||!e?e:Ir(e.fields[t[0]],t.slice(1,t.length))}function Pa(e,t){if(t.length===0||!e)return[e];const n=t[0];if(t=t.slice(1,t.length),n==="*"){const r=Array.isArray(e.fields)?e.fields:Object.keys(e.fields).map(a=>e.fields[a]);return t.length===0?r:r.reduce((a,s)=>[...a,...Pa(s,t)],[])}return Pa(e.fields[n],t)}function Ba(e,t,n){for(const r of Object.keys(t)){const a=t[r];for(const s of Pa(e,r.split(".")))s&&a&&n(s,a)}}function vo(e,t,n,r=!1,a=!1){Ba(t,n,(s,l)=>{s.validators=typeof l=="function"?l(e):l,r&&s.validate(v.getPath(e,s.path),void 0,a)})}function Aa(e,t){const n=t[0];return t=t.slice(1),Array.isArray(e)?e.map((r,a)=>a===Number(n)?Aa(r,t):r):zl(e)?Object.keys(e).reduce((r,a)=>Object.assign(r,{[a]:a===n?Aa(e[a],t):e[a]}),{}):e}function rS(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("The initial value of useSpsForm() hook must be an object.")}function tc(e,t={}){rS(e);const[,n]=x.useState({}),r=x.useRef(!1);r.current=!1;const a=x.useRef(t),s=x.useCallback(h=>{const S=m.current;let y;if(h)if(h.path)if(h.markAsBlurred){const E=Ir(S.formMeta,h.path);if(E){E.focused=!1;const T=v.getPath(S.formValue,h.path);E.validate(T,jt.ON_BLUR)}}else if(h.newValidators){if(a.current){const E=h.path.join(".");a.current={...a.current,[E]:h.newValidators},vo(S.formValue,S.formMeta,a.current,!0)}}else if(h.markAsSubmitted){const E=Ir(S.formMeta,h.path);if(E){E.submitted=!0;const T=v.getPath(S.formValue,h.path);E.validate(T,jt.ON_SUBMIT)}}else y=Aa(S.formValue,h.path),v.setPath(y,h.path,h.value);else y=h.value;if(h?.updateFormOptions?.validators&&(a.current={...a.current,...h.updateFormOptions.validators},vo(S.formValue,S.formMeta,a.current,h.updateFormOptions?.runValidators??!0)),y){S.formMeta.submitted=!1,v.deepFreeze(y);const E=v.diff(S.formValue,y);for(const{type:D,key:w,parentPath:I,objects:[,M]}of E){const k=Ir(S.formMeta,I);if(typeof w!="symbol"&&k){let O;switch(D){case v.DiffChange.ADDITION:k.fields[w]=bo(M[w],[...I,w],c);break;case v.DiffChange.DELETION:Array.isArray(k.fields)?k.fields[w]=void 0:delete k.fields[w];break;case v.DiffChange.ALTERATION:O=bo(M[w],[...I,w],c),(O instanceof Ln&&!(k.fields[w]instanceof Ln)||!(O instanceof Ln)&&k.fields[w]instanceof Ln)&&(O.pristine=!1,k.fields[w]=O);break}}}const T=new Set;if(E.filter(D=>D.type===v.DiffChange.DELETION).reduce((D,w)=>(D.has(w.parentPath)||D.add(w.parentPath),D),T),Array.from(T).forEach(D=>{const w=Ir(S.formMeta,D);Array.isArray(w.fields)&&(w.fields=w.fields.filter(I=>I!==void 0))}),a.current){vo(y,S.formMeta,a.current);const D=new Set;t&&Ba(S.formMeta,t,(w,I)=>{typeof I=="function"&&(w.validate(v.getPath(y,w.path)),D.add(w))});for(const{type:w,key:I,parentPath:M,objects:[,k]}of E)if(typeof I!="symbol"){let O=S.formMeta,G=y;if(O){for(const C of M)O=O.fields[C],G=G[C],D.has(O)||O.validate(G,jt.ON_CHANGE);if(w===v.DiffChange.ADDITION||w===v.DiffChange.ALTERATION){const C=O.fields[I];if(!D.has(C)&&(O.fields[I].validate(k[I],jt.ON_CHANGE),w===v.DiffChange.ADDITION&&C.fields))for(const[V,R]of Object.entries(C.fields))R.validate(k[I][V],jt.ON_CHANGE)}}}}}m.current={...S,formValue:y||S.formValue},r.current||n({})},[]),l=x.useCallback((h,S)=>{h||S?s({value:h,updateFormOptions:S}):s()},[s]),c=x.useCallback((h,S,y=!1,E,T=!1)=>{h?s({path:h,value:S,markAsBlurred:y,newValidators:E,markAsSubmitted:T}):l()},[s,l]),p=x.useMemo(()=>{v.deepFreeze(e);const h=bo(e,[],c);return t&&vo(e,h,t,!1,!0),h},[]),f=x.useCallback(()=>(m.current.formMeta.markAsDirty(),a.current&&Ba(m.current.formMeta,a.current,(h,S)=>{(typeof S=="function"||Array.isArray(S))&&h.validate(v.getPath(m.current.formValue,h.path))}),m.current.formMeta.isValid()),[]),u=x.useCallback(()=>m.current.formValue,[]),m=x.useRef({formValue:e,formMeta:p,updateForm:l,validateForm:f,getCurrentFormValue:u});return m.current}const tt=o.forwardRef((e,t)=>{const{className:n,children:r,focusInputOnClick:a,formControl:s,formMeta:l,inputRef:c,onClick:p,...f}=e,u=o.useRef(),h=c||(t||u);function S(){h&&h!==t&&h.current&&h.current.focus()}function y(){h&&h!==t&&h.current&&l&&l instanceof kr&&l.markAsFocused()}function E(){h&&h!==t&&h.current&&l&&l instanceof kr&&l.markAsBlurred()}const T=U("sps-form-group",(s&&s.isRequired()||l&&l.isRequired())&&"sps-form-group--required",(s&&!s.isValid()||l&&l.isVisibilyInvalid())&&"sps-form-group--error",l&&l.hasPreventativeErrors()&&"sps-form-group--preventative-error",n);function D(w){a&&S(),p&&p(w)}return o.useEffect(()=>{function w(I){I.target.classList.contains("sps-form-control__clear-btn")&&I.preventDefault()}return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[]),o.createElement("div",{...f,className:T,ref:t,tabIndex:-1,onClick:D,onFocus:y,onBlur:E},r)});Object.assign(tt,{displayName:"SpsFormComponentWrapper"});const nc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,rc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",yo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return rc(n.overflowY,t)||rc(n.overflowX,t)||(r=>{const a=(s=>{if(!s.ownerDocument||!s.ownerDocument.defaultView)return null;try{return s.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},To=(e,t,n,r,a,s,l,c)=>s<e&&l>t||s>e&&l<t?0:s<=e&&c<=n||l>=t&&c>=n?s-e-r:l>t&&c<n||s<e&&c>n?l-t+a:0,oS=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},oc=(e,t)=>{var n,r,a,s;if(typeof document>"u")return[];const{scrollMode:l,block:c,inline:p,boundary:f,skipOverflowHiddenElements:u}=t,m=typeof f=="function"?f:z=>z!==f;if(!nc(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,S=[];let y=e;for(;nc(y)&&m(y);){if(y=oS(y),y===h){S.push(y);break}y!=null&&y===document.body&&yo(y)&&!yo(document.documentElement)||y!=null&&yo(y,u)&&S.push(y)}const E=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,T=(s=(a=window.visualViewport)==null?void 0:a.height)!=null?s:innerHeight,{scrollX:D,scrollY:w}=window,{height:I,width:M,top:k,right:O,bottom:G,left:C}=e.getBoundingClientRect(),{top:V,right:R,bottom:B,left:J}=(z=>{const W=window.getComputedStyle(z);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let L=c==="start"||c==="nearest"?k-V:c==="end"?G+B:k+I/2-V+B,Q=p==="center"?C+M/2-J+R:p==="end"?O+R:C-J;const P=[];for(let z=0;z<S.length;z++){const W=S[z],{height:ae,width:re,top:A,right:j,bottom:oe,left:ie}=W.getBoundingClientRect();if(l==="if-needed"&&k>=0&&C>=0&&G<=T&&O<=E&&(W===h&&!yo(W)||k>=A&&G<=oe&&C>=ie&&O<=j))return P;const q=getComputedStyle(W),$=parseInt(q.borderLeftWidth,10),H=parseInt(q.borderTopWidth,10),ne=parseInt(q.borderRightWidth,10),te=parseInt(q.borderBottomWidth,10);let de=0,ce=0;const X="offsetWidth"in W?W.offsetWidth-W.clientWidth-$-ne:0,se="offsetHeight"in W?W.offsetHeight-W.clientHeight-H-te:0,we="offsetWidth"in W?W.offsetWidth===0?0:re/W.offsetWidth:0,Le="offsetHeight"in W?W.offsetHeight===0?0:ae/W.offsetHeight:0;if(h===W)de=c==="start"?L:c==="end"?L-T:c==="nearest"?To(w,w+T,T,H,te,w+L,w+L+I,I):L-T/2,ce=p==="start"?Q:p==="center"?Q-E/2:p==="end"?Q-E:To(D,D+E,E,$,ne,D+Q,D+Q+M,M),de=Math.max(0,de+w),ce=Math.max(0,ce+D);else{de=c==="start"?L-A-H:c==="end"?L-oe+te+se:c==="nearest"?To(A,oe,ae,H,te+se,L,L+I,I):L-(A+ae/2)+se/2,ce=p==="start"?Q-ie-$:p==="center"?Q-(ie+re/2)+X/2:p==="end"?Q-j+ne+X:To(ie,j,re,$,ne+X,Q,Q+M,M);const{scrollLeft:pt,scrollTop:qe}=W;de=Le===0?0:Math.max(0,Math.min(qe+de/Le,W.scrollHeight-ae/Le+se)),ce=we===0?0:Math.max(0,Math.min(pt+ce/we,W.scrollWidth-re/we+X)),L+=qe-de,Q+=pt-ce}P.push({el:W,top:de,left:ce})}return P},aS=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Eo(e,t){if(!e.isConnected||!(a=>{let s=a;for(;s&&s.parentNode;){if(s.parentNode===document)return!0;s=s.parentNode instanceof ShadowRoot?s.parentNode.host:s.parentNode}return!1})(e))return;const n=(a=>{const s=window.getComputedStyle(a);return{top:parseFloat(s.scrollMarginTop)||0,right:parseFloat(s.scrollMarginRight)||0,bottom:parseFloat(s.scrollMarginBottom)||0,left:parseFloat(s.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(oc(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:s,left:l}of oc(e,aS(t))){const c=s-n.top+n.bottom,p=l-n.left+n.right;a.scroll({top:c,left:p,behavior:r})}}const Fa=Object.freeze(Object.defineProperty({__proto__:null,default:Eo},Symbol.toStringTag,{value:"Module"})),sS={alt:"string",size:"SpinnerSize",title:"string"};function Va(e){const{alt:t,className:n,size:r=Y.SpinnerSize.MEDIUM,"data-testid":a,title:s,unsafelyReplaceClassName:l,...c}=e,{t:p}=Oe.useWoodlandLanguage(),f=t||s||p("spinner.defaultAltText",{defaultValue:"Loading..."}),u=U(l||"sps-spinner",`sps-spinner--${r}`,n);return o.createElement("i",{className:u,"data-testid":a,title:f,...c})}Object.assign(Va,{props:sS,displayName:"SpsSpinner"});const iS=60;function wo(e){return typeof e>"u"?"inherit":`${e}px`}function $a(e){switch(e){case Y.Position.TOP_LEFT:return Y.Position.BOTTOM_LEFT;case Y.Position.TOP_MIDDLE:return Y.Position.BOTTOM_MIDDLE;case Y.Position.TOP_RIGHT:return Y.Position.BOTTOM_RIGHT;case Y.Position.RIGHT_TOP:return Y.Position.LEFT_TOP;case Y.Position.RIGHT_MIDDLE:return Y.Position.LEFT_MIDDLE;case Y.Position.RIGHT_BOTTOM:return Y.Position.LEFT_BOTTOM;case Y.Position.BOTTOM_RIGHT:return Y.Position.TOP_RIGHT;case Y.Position.BOTTOM_MIDDLE:return Y.Position.TOP_MIDDLE;case Y.Position.BOTTOM_LEFT:return Y.Position.TOP_LEFT;case Y.Position.LEFT_BOTTOM:return Y.Position.RIGHT_BOTTOM;case Y.Position.LEFT_MIDDLE:return Y.Position.RIGHT_MIDDLE;case Y.Position.LEFT_TOP:return Y.Position.RIGHT_TOP}}function lS(e,t,n,r,a,s,l,c){const p=l&&l.current,f=p?p.scrollTop:window.pageYOffset,u=c?0:f,m=p?p.scrollLeft:window.pageXOffset,h=c?0:m,[S,y]=e.split(" ");let E,T,D,w;switch(S){case"top":D=t.height-n.top-u-s[0];break;case"left":T=t.width-n.left-h-s[0];break;case"right":w=n.right+h-s[0];break;case"bottom":E=n.bottom+u-s[0];break;default:throw new Error(`Invalid position ${e}`)}switch(y){case"left":w=n.left+h+s[1];break;case"top":E=n.top+u+s[1];break;case"middle":S==="top"||S==="bottom"?w=n.left+h+n.width/2-a/2+s[1]:(S==="left"||S==="right")&&(E=n.top+u+n.height/2-r.height/2+s[1]);break;case"bottom":D=t.height-n.bottom-u+s[1];break;case"right":T=t.width-n.right-h+s[1];break;default:throw new Error(`Invalid position ${e}`)}return[E,T,D,w]}function On(e,t,n,{altPosition:r,setMinWidth:a=!1,setWidth:s=!1,parentElementRef:l,fixed:c=!1,offsets:p=[0,0]}){if(e.current&&t.current){const f=e.current.getBoundingClientRect(),u=t.current.getBoundingClientRect(),m=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=document.documentElement.getBoundingClientRect().width;let y=(l?.current??document.documentElement).getBoundingClientRect();c&&(y={x:0,y:0,width:h,height:m,top:0,left:0,bottom:m,right:h,toJSON(){return{width:h,height:m,top:0,left:0,bottom:m,right:h}}});const[E,T]=n.split(" ");let D=n;if(r&&(E==="top"&&u.top-f.height<iS||E==="right"&&u.right+f.width>h||E==="bottom"&&u.bottom+f.height>m||E==="left"&&u.left-f.width<0)&&(D=r),T==="left"&&u.left+f.width+(p?.[1]??0)>document.documentElement.getBoundingClientRect().right)switch(E){case"bottom":D=Y.Position.BOTTOM_RIGHT;break;case"top":D=Y.Position.TOP_RIGHT;break}const w=a?Math.max(u.width,f.width):f.width,I=s?u.width:w,[M,k,O,G]=lS(D,y,u,f,I,p,l,c),C={top:wo(M),right:wo(k),bottom:wo(O),left:wo(G)};return c&&(C.position="fixed",C.zIndex=Y.ZStratum.BAR),a&&(C.minWidth=`${u.width}px`),s&&(C.width=`${u.width}px`),[C,D===r]}return[{},!1]}const xt=x.createContext(null);function rr(e,t=[]){const n=x.useContext(xt);return x.useMemo(()=>r=>{const s=n&&n.parentElementRef&&n.parentElementRef.current||document.body;let l=null,c=s.lastElementChild;for(;c&&c!==s.firstElementChild;){if(c.hasAttribute("data-portalid")&&c.getAttribute("data-portalid")===e){l=c;break}c=c.previousElementSibling}if(l)s.contains(l)||s.appendChild(l);else{l=document.createElement("div"),l.setAttribute("data-portalid",e);for(const p of t)l.classList.add(p);s.appendChild(l)}return mo.createPortal(r,l)},[n])}const Ka=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0"];async function ac(e,t,n,r,a,s){const l=typeof e.options=="function"?e.options(t.value):e.options||[],c=l instanceof Promise,p=m=>m.replace(/([.?*+^$[\]\\(){}|-])/g,"");n({pending:c}),s.current=c?l:null;const f=c?await l||[]:l||[];if(c&&s.current!==l)return;let u=Array.from(f).filter(Boolean).map(m=>new Y.SpsOptionListOption(m,typeof m=="function"?{textKey:"label",captionKey:"caption"}:{textKey:e.textKey,captionKey:e.captionKey}));if(e.nullOption&&u.unshift(new Y.SpsOptionListOption(null,{text:e.nullOption})),t.value&&!e.disableDefaultOptionsFiltering){const m=p(t.value);n({replacementPattern:new RegExp(`(${m})`,"ig")}),u=u.filter(h=>{const S=new RegExp(m,"i"),y=p(h.text);return e.filterByTextAndCaptionKey?S.test(y)||S.test(p(h.caption)):S.test(y)})}else n({replacementPattern:null});if(e.disabledOptions)for(const m of u)e.disabledOptions.includes(m.value)&&(m.disabled=!0);r(Object.freeze(u)),e.onOptionListChanged&&e.onOptionListChanged(u.length),a(u.some(m=>m.value&&!!m.value.icon)),n({pending:!1})}function cS(e,t,n){const[r,a]=o.useState(Object.freeze([])),[s,l]=o.useState(!1),c=o.useRef(null),p=o.useRef(e.options);(typeof e.options!="function"||e.disableOptionsMemoization)&&(p.current=e.options);const f=o.useMemo(()=>typeof p.current=="function"?v.debounce(ac,typeof e.searchDebounce<"u"?e.searchDebounce:500):ac,[p.current,e.disabledOptions]);return o.useEffect(()=>{f(e,t,n,a,l,c)},[p.current,t.value,e.disabledOptions]),[r,s]}class Sn{constructor(t,n){this.target=t,this.isPgStoppedInternal=!1,this.currentTarget=t,this.nativeEvent=new CustomEvent("change",n),Object.defineProperty(this.nativeEvent,"target",{value:t,writable:!1,configurable:!1,enumerable:!0})}get bubbles(){return this.nativeEvent.bubbles}get cancelable(){return this.nativeEvent.cancelable}get defaultPrevented(){return this.nativeEvent.defaultPrevented}get eventPhase(){return this.nativeEvent.eventPhase}get isTrusted(){return this.nativeEvent.isTrusted}get timeStamp(){return this.nativeEvent.timeStamp}get type(){return this.nativeEvent.type}preventDefault(){this.nativeEvent.preventDefault()}isDefaultPrevented(){return this.defaultPrevented}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPgStoppedInternal=!0}isPropagationStopped(){return this.isPgStoppedInternal}persist(){throw new Error("This is not a real React ChangeEvent. React does not permit the creation of SyntheticEvents in userland.")}}function dS(e,t){return{...e,...t}}function qt(e){return x.useReducer(dS,e)}function pS({hideInlineSearch:e,options:t,onSearchChange:n,search:r="",searchPlaceholder:a="Search…",searchInputRef:s}){const[l,c]=qt({isAsync:typeof t=="function",pending:!1,value:r,replacementPattern:null}),p=o.useCallback(S=>{c({value:S.target.value}),n&&n(S)},[n]),f=o.useCallback(S=>{S.nativeEvent.stopImmediatePropagation(),S.stopPropagation()},[]),u=o.useCallback(S=>{S.nativeEvent.stopImmediatePropagation(),c({value:""}),s?.current&&(n&&n(new Sn(s.current)),s.current.focus())},[n]),m=S=>{S&&(["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"].includes(S.key)||S.stopPropagation())};return o.useEffect(()=>{c({value:r})},[r]),[l.isAsync&&!e?o.createElement("div",{className:"sps-option-list__search sps-form-group sps-text-input"},o.createElement("div",{className:"sps-form-control"},!l.value&&o.createElement("i",{className:"sps-icon sps-icon-filter sps-text-input__icon"}),o.createElement("input",{type:"text",className:"sps-text-input__input",placeholder:a,ref:s,value:l.value,onChange:p,onClick:f,onKeyDown:m}),l.value&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:u}))):o.createElement(o.Fragment,null),l,c]}const uS=Eo||Fa,mS=["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"];function fS(e,t,n){return n?(e&&e[n])===(t&&t[n]):e===t}function sc(e,t,n){return typeof n.value=="function"&&n.disabled?!0:t?!!e?.find(r=>r[t]&&r[t]===n?.value?.[t]):!1}const xr=o.forwardRef((e,t)=>{const{captionKey:n,comparisonKey:r,disabledOptions:a,options:s,tall:l,textKey:c,valueKey:p,zeroState:f,hideInlineSearch:u,onSearchChange:m,search:h,searchDebounce:S,searchPlaceholder:y,onSpecialActionSelect:E,attachTo:T,className:D,conformWidth:w,id:I,ignoreWidthStyles:M,isOpen:k,keepOpen:O,keyDown:G,nullOption:C,onOptionListChanged:V,onOptionSelected:R,onPositionFlip:B,onSelfToggle:J,optionRole:L,positionOverride:Q,selectedOption:P,specialAction:z,unsafelyReplaceClassName:W,loading:ae,filterByTextAndCaptionKey:re,maxHeightPx:A,maxHeightRem:j,disableOptionsMemoization:oe,disableDefaultOptionsFiltering:ie,"data-testid":q,typeaheadEvent:$,...H}=e,ne=o.useMemo(()=>z?new Y.SpsOptionListOption(z,{textKey:"label",captionKey:"caption"}):null,[z]),[te,de]=o.useState(-1),[ce,X]=o.useState(k),se=t||o.useRef(null),we=o.useRef(null),Le=o.useRef(null),pt=rr("sps-option-list-portal"),qe=o.useContext(xt),[st,Ze]=Q||[Y.Position.BOTTOM_LEFT,Y.Position.TOP_LEFT],[[Bt,Xe],Ve]=o.useState([{},!1]),ge=o.useRef(null),[We,Ke,Ee]=pS({...e,searchInputRef:ge}),[ye,ut]=cS(e,Ke,Ee);o.useEffect(()=>{$&&vt($)},[$]),o.useEffect(()=>{Ve(ce?On(se,T,st,{altPosition:Ze,setMinWidth:!M,setWidth:!M&&w,...qe}):[{},!1])},[ce,st,Ze,ye]),o.useEffect(()=>{let he;return ce&&(he=()=>{ce&&Ve(On(se,T,st,{altPosition:Ze,setMinWidth:!M,setWidth:!M&&w,...qe}))},document.addEventListener("scroll",he)),()=>{he&&document.removeEventListener("scroll",he)}},[ce]),o.useEffect(()=>{de(-1)},[Ke]);const Xt=U(W||"sps-option-list","z-stratum-dropdown",ce&&"sps-option-list--open",Ke.isAsync&&"sps-option-list--searchable",Xe&&"sps-option-list--opens-upward",z&&z.label&&"sps-option-list--has-special-action",D),At=U(W||"sps-option-list__options",l&&"sps-option-list__options--tall"),ke=o.useCallback(()=>{ce||(X(!0),ge.current&&ge.current.focus(),de(-1),J&&J(!0))},[ce,J]),pe=o.useCallback(()=>{ce&&(X(!1),de(-1),J&&J(!1))},[ce,J]),De=o.useCallback((he,ve)=>{ve||he&&!he.disabled&&(typeof he.value=="function"?(he.value(),E&&E()):typeof R=="function"&&R(he.value),O||pe())},[R,pe]),je=o.useCallback((he,ve,et)=>{he.stopPropagation(),De(ve,et)},[De]),Qe=o.useRef(a||[]);Qe.current=a||[];const Ge=o.useCallback(he=>{switch(he.key){case"Tab":case"Escape":pe();break;case"Enter":if(te>-1){const ve=ye[te]||ne;he.preventDefault();const et=!!ve&&sc(Qe.current,r||"",ve);!et&&ve&&typeof R=="function"&&typeof ve.value=="function"?ve.value():ve&&De(ve,et)}break;case"Up":case"ArrowUp":{let ve=te;Xe?te<=-1?ve=ye.length-1:te===0?z&&(ve=ye.length):te<ye.length&&(ve=te-1):te>-1&&(ve=te-1),ve!==te&&(he.preventDefault(),de(ve));break}case"Down":case"ArrowDown":{ke();let ve=te;Xe?te!==-1&&(te>=ye.length?ve=0:te===ye.length-1?ve=-1:ve=te+1):te<ye.length-1+ +!!z&&(ve=te+1),ve!==te&&(he.preventDefault(),de(ve));break}default:ke()}},[pe,ke,te,De,R,Xe,ye]),it=o.useCallback(he=>{ke();const ve=ye.findIndex(et=>{if(et.textKey){const Ft=et.textKey;return et.value[Ft].toLowerCase().charAt([0])===he.key.toLocaleLowerCase()}return et.value.toString().toLowerCase().charAt([0])===he.key.toLocaleLowerCase()});ve>-1&&de(ve)},[ye]),vt=o.useCallback(he=>{he&&(mS.includes(he.key)?Ge(he):Ka.includes(he.key)&&!u&&it(he))},[pe,ke,te,De,R,Xe,ye]);o.useEffect(()=>{if(qe!==null&&document.getElementsByClassName("sps-modal__body").length>0){const he=()=>{J&&J(!1)},ve=document.getElementsByClassName("sps-modal__body")[0];return ve.addEventListener("scroll",he),()=>{ve.removeEventListener("scroll",he)}}},[]),o.useEffect(()=>{ce&&Le.current&&uS(Le.current,{scrollMode:"if-needed",block:"nearest",inline:"nearest"})},[te,ce]),o.useEffect(()=>{X(k),k?ge.current&&ge.current.focus():de(-1)},[k]),o.useEffect(()=>{G&&vt(G)},[G]),o.useEffect(()=>{!ce&&we.current&&(Ee({value:""}),we.current.scrollTop=0),ce&&B&&B(Xe)},[ce]);const wt=A?A/16:j,mt=wt?{maxHeight:`${wt}rem`}:{};function kn(he,ve){return ve?o.createElement(o.Fragment,null,he.split(ve).map((et,Ft)=>ve.test(et)?o.createElement("u",{key:Ft},et):o.createElement(o.Fragment,{key:Ft},et))):o.createElement(o.Fragment,null,he)}return pt(o.createElement("div",{className:Xt,id:I,"aria-activedescendant":te>-1?`${I}-option-${te}`:"",tabIndex:-1,ref:se,style:Bt,onMouseLeave:()=>de(-1),"data-testid":q,...H},We,o.createElement("div",{className:At,ref:we,"data-testid":`${q}-options`,style:mt},!ae&&!Ke.pending&&f&&ye.length===0&&o.createElement("div",{className:"sps-option-list__zero-state"},f),(ae||Ke.pending)&&o.createElement("div",{className:"sps-option-list__loading"},o.createElement(Va,null)),!ae&&!Ke.pending&&ye.map((he,ve)=>{const et=`${I}-option-${ve}`,Ft=fS(he.value,P,r),me=sc(Qe.current,r||"",he);return o.createElement("a",{key:et,id:et,role:L,"aria-selected":Ft,href:he.href,className:U("sps-option-list__option",he.caption&&"sps-option-list__option--has-caption",he.disabled&&"sps-option-list__option--disabled",he.bold&&"sps-option-list__option--bold",(Ft||me)&&"sps-option-list__option--selected",te===ve&&"sps-option-list__option--highlighted"),onClick:wl=>je(wl,he,me),onMouseOver:()=>de(ve),tabIndex:-1,ref:te===ve?Le:null,"data-testid":`${q}-option-${ve}`},he.value&&he.value.icon&&o.createElement("i",{className:U("sps-icon","sps-option-list__option-icon",`sps-icon-${String(he.value.icon)}`)}),(!he.value||!he.value.icon&&ut)&&o.createElement("span",{className:"sps-option-list__option-icon-spacer"}),o.createElement("span",null,kn(he.text,Ke.replacementPattern)),he.caption&&o.createElement("div",{className:"sps-option-list__option-caption"},o.createElement("span",null,kn(he.caption,Ke.replacementPattern))))})),ne&&z?.label&&o.createElement("a",{className:U("sps-option-list__option","sps-option-list__special-action",te===ye.length&&"sps-option-list__option--highlighted",z.disabled&&"sps-option-list__special-action--disabled"),href:ne.href,target:ne.href&&z.newTab?"_blank":"_self",onClick:he=>je(he,ne),onMouseOver:()=>de(ye.length),"data-testid":`${q}-special-action`},z.icon&&o.createElement("i",{className:U("sps-icon","sps-option-list__option-icon",`sps-icon-${String(z.icon)}`)}),!z.icon&&ut&&o.createElement("span",{className:"sps-option-list__option-icon-spacer"}),o.createElement("span",null,z.label))))});Object.assign(xr,{displayName:"SpsOptionList"});function hS(e,t,n=[]){return o.useMemo(()=>{function r(a){return o.createElement(e,{...a,...t},a.children)}return r},n)}function Tt(e){return typeof e=="function"?e():e}const ic=function({children:e,elements:t}){if(t.length===0)return o.createElement(o.Fragment,null,e);const[n,r]=Array.isArray(t[0])?t[0]:[t[0]];return o.createElement(n,{...r??{}},o.createElement(ic,{elements:t.slice(1)},e))},lc=function({children:e,providers:t=[],...n}){return o.createElement("div",{...n},o.createElement(ic,{elements:t},e))},SS=function({children:e,className:t,...n}){return o.createElement(lc,{className:`sps-app ${t}`,...n},e)};function Mt(e=[],t=[]){const n=Array.isArray(e)?v.flatten(e):[e],r=t.map(s=>Array.isArray(s)?s:[s]),a=new Array(r.length+1).fill(null).map(()=>[]);for(const s of n){let l=!1;for(let c=0;c<r.length;c+=1)for(const{type:p,props:f={}}of r[c])if(s.type===p&&Object.keys(f).every(m=>f[m]===s.props[m])){l=!0,a[c].push(s);break}l||a[a.length-1].push(s)}return a}function cc(e,t,n){const r=Object.entries(t).filter(([,s])=>typeof s!="string"&&s.deprecated).map(([s])=>s),a=r.map(s=>n[s]);o.useEffect(()=>{a.find(s=>typeof s<"u")&&console.warn(`The following prop(s) of ${e} are deprecated: ${r.join(", ")}`)},a)}function Ha(e,t){const n=x.useRef(!1);x.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function Wa(e,t,n){const r=o.useRef(t(...n));o.useEffect(()=>(document.addEventListener(e,r.current,{capture:!0}),()=>document.removeEventListener(e,r.current)),[]),o.useEffect(()=>{document.removeEventListener(e,r.current),r.current=t(...n),document.addEventListener(e,r.current,{capture:!0})},n)}function dc(e,t,n){return function(a){!e.current?.contains(a.target)&&!t.current?.contains(a.target)&&n()}}function or(e,t,n){const r=o.useRef(!1),[a,s]=o.useState(!1),l=o.useCallback(()=>{r.current?r.current=!1:s(!0)},[]),c=o.useCallback((p=!1)=>{s(!1),r.current=p,n&&n()},[]);return Wa("mousedown",dc,[e,t,c]),Wa("pointerdown",dc,[e,t,c]),{showPopup:a,doShowPopup:l,doHidePopup:c}}const pc=e=>{const t=/(auto|scroll)/,n=(c,p)=>c.parentNode===null?p:n(c.parentNode,p.concat([c])),r=(c,p)=>getComputedStyle(c,null).getPropertyValue(p),a=c=>r(c,"overflow")+r(c,"overflow-y"),s=c=>t.test(a(c));return(c=>{if(!(c instanceof HTMLElement||c instanceof SVGElement))return;const p=n(c.parentNode,[]);for(let f=0;f<p.length;f+=1)if(s(p[f]))return p[f];return null})(e)};let Ga=0;function Mr({isOpen:e,rootRef:t}){o.useLayoutEffect(()=>{let n,r,a;if(e&&t.current){Ga+=1,n=pc(t.current)||document.body,r=n===document.body?window.innerWidth-document.documentElement.clientWidth:n.offsetWidth-n.clientWidth,n.style.overflow="hidden";const s=window.getComputedStyle(n).paddingRight;if(n.style.paddingRight=s&&s!=="0px"?`calc(${s} + ${r}px)`:`${r}px`,n===document.body){if(a=document.getElementsByClassName("sps-navbar-container").item(0),a&&window.getComputedStyle(a).position==="fixed"){const l=window.getComputedStyle(a).paddingRight;a.style.paddingRight=l&&l!=="0px"?`calc(${l} + ${r}px)`:`${r}px`}else if(a=document.getElementsByTagName("nav").item(0)?.parentElement,a&&window.getComputedStyle(a).position==="fixed"){const c=window.getComputedStyle(a).paddingRight;a.style.paddingRight=c&&c!=="0px"?`calc(${c} + ${r}px)`:`${r}px`}}}return()=>{n&&(Ga-=1,Ga===0&&(n.style.overflow=null,n.style.paddingRight=null,a&&(a.style.paddingRight=null)))}},[e])}const gS={debounce:"number",disabled:"boolean",conformWidth:"boolean",formMeta:"SpsFormFieldMeta<string>",icon:"SpsIcon",onChange:"React.ChangeEventHandler",onSelectionChange:"(newValue: string) => void",placeholder:"string",suggestions:{type:`
|
|
1
|
+
(function(_,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("@spscommerce/utils"),require("moment-timezone"),require("@spscommerce/ds-shared"),require("@spscommerce/i18n"),require("react-dom"),require("@spscommerce/ds-colors"),require("@sps-woodland/tabs"),require("@react-stately/collections"),require("@sps-woodland/illustrations")):typeof define=="function"&&define.amd?define(["exports","react","@spscommerce/utils","moment-timezone","@spscommerce/ds-shared","@spscommerce/i18n","react-dom","@spscommerce/ds-colors","@sps-woodland/tabs","@react-stately/collections","@sps-woodland/illustrations"],x):(_=typeof globalThis<"u"?globalThis:_||self,x(_.DSReact={},_.React,_.utils,_.moment$5,_.dsShared,_.i18n,_.ReactDOM,_.dsColors,_.tabs,_.collections,_.illustrations))})(this,function(_,x,v,lt,Y,Oe,mo,Ma,Rh,Xn,Wl){"use strict";function Gl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=Gl(x),Qn=Gl(lt);function Yl(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Yl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function U(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Yl(e))&&(r&&(r+=" "),r+=t);return r}const Ph="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ht=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Ph[n[e]&63];return t};function hn(e){return x.useRef(e||ht())}function St(e,t){const n=hn(e),r=x.useRef(`${n.current}_ctrl`);return x.useEffect(()=>{t&&(t.id=r.current,t.update())},[t]),{wrapperId:n.current||void 0,controlId:r.current}}function _a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var La,Ul;function Bh(){if(Ul)return La;Ul=1;var e="[object Object]";function t(h){var S=!1;if(h!=null&&typeof h.toString!="function")try{S=!!(h+"")}catch{}return S}function n(h,S){return function(y){return h(S(y))}}var r=Function.prototype,a=Object.prototype,s=r.toString,l=a.hasOwnProperty,c=s.call(Object),p=a.toString,f=n(Object.getPrototypeOf,Object);function u(h){return!!h&&typeof h=="object"}function m(h){if(!u(h)||p.call(h)!=e||t(h))return!1;var S=f(h);if(S===null)return!0;var y=l.call(S,"constructor")&&S.constructor;return typeof y=="function"&&y instanceof y&&s.call(y)==c}return La=m,La}var Ah=Bh();const zl=_a(Ah),Ct=new Set,er=new Set,zt=new Set,fo=new Set;function jl(e){Ct.has(e)||zt.has(e)||fo.has(e)||er.add(e)}function ql(e){Ct.has(e)||zt.has(e)||er.has(e)||fo.add(e)}const ct=Qn.default||Qn,tr="MM/DD/YYYY",Fh="MM/DD/YYYY hh:mm A",Vh="MM/DD/YYYY HH:mm",$h="hh:mm A",Kh="HH:mm",Hh=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,Dr=Symbol("Date Parse Error");function nr(e){return ct.isMoment(e)?e.year()*1e4+(e.month()+1)*100+e.date():e.year*1e4+e.month*100+e.date}const ee=Object.freeze({createFrom(e,t){if(!e)return null;if(typeof e=="string"){if(t){const n=ct(e,t,!0);if(n.isValid())return Object.freeze({year:n.year(),month:n.month()+1,date:n.date()})}else{const n=Hh.exec(e);if(n){const[,r,a,s]=n;return Object.freeze({year:Number(s),month:Number(r),date:Number(a)})}}return Object.freeze({[Dr]:!0,year:void 0,month:void 0,date:void 0})}return Object.freeze({year:e.year(),month:e.month()+1,date:e.date()})},createMomentFrom(e,t){if(!e)return null;let n=null;return typeof e=="string"?t?n=ct(e,t,!0):n=ct(e):ct.isMoment(e)?n=e:n=ee.toMoment(e),n!==null&&ct.isMoment(n)&&n.isValid()?n:Object.freeze({[Dr]:!0,year:void 0,month:void 0,date:void 0})},getRangeSeparator(e){return e?.includes("-")?"/":"-"},createRangeFrom(e,t){if(!e)return null;if(t){const n=ee.getRangeSeparator(t),r=new RegExp(`[^\\d]*${n}[^\\d]*`);return e.split(r).slice(0,2).map(a=>ee.createFrom(a,t))}else return e.split(/[^\d]*-[^\d]*/).slice(0,2).map(n=>ee.createFrom(n))},isValid(e){return e?ct.isMoment(e)?e.isValid():typeof e=="object"&&typeof e.year=="number"&&typeof e.month=="number"&&typeof e.date=="number"&&ee.toMoment(e)?.isValid():!1},nullifyInvalidDate(e){return ee.isValid(e)?e:null},toMoment(e){return e?ct.isMoment(e)?e:ct({...e,month:e.month-1}):null},toString(e,t){const n=ee.toMoment(e);return n&&n.isValid()?n.format(t||tr):""},toStringRange(e,t){if(!e)return"";const n=ee.getRangeSeparator(t);return e.slice(0,2).map(r=>ee.toString(r,t)).join(n)},toDateTimeString(e,t=!1,n){return e&&ct.isMoment(e)&&e.isValid()?n?t?e.format(`${n} ${Kh}`):e.format(`${n} ${$h}`):t?e.format(Vh):e.format(Fh):""},toDateTimeStringRange(e,t=!1,n){if(!e)return"";const r=ee.getRangeSeparator(n);return e.map(a=>ee.toDateTimeString(a,t,n)).join(r)},create(){const e=new Date;return Object.freeze({year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate()})},isSameDate(e,t){return e&&t&&e.year===t.year&&e.month===t.month&&e.date===t.date},isSameMonth(e,t){return e&&t&&e.year===t.year&&e.month===t.month},isAfter(e,t){return!e||!t?null:nr(e)>nr(t)},isBefore(e,t){return!e||!t?null:nr(e)<nr(t)},isInRange(e,t,n=!0){if(!e||!t||!t[0]||!t[1])return null;const r=nr(e),[a,s]=t.map(nr);return a&&s&&(n&&r>=a&&r<=s||!n&&r>a&&r<s)},prevMonth(e){return Object.freeze({year:e.month===1?e.year-1:e.year,month:e.month-1||12,date:e.date})},nextMonth(e){return Object.freeze({year:e.month===12?e.year+1:e.year,month:e.month+1>12?1:e.month+1,date:e.date})},createRangeFromPreset(e,t){if(typeof e.definition=="function")return e.definition();const n=ct(),r=n.clone().subtract(ct.duration(e.definition));return[ee.createFrom(r,t),ee.createFrom(n,t)]},createDateTimeRangeFromPreset(e){if(typeof e.definition=="function")return e.definition();const t=ct().subtract(ct.duration(e.definition)).startOf("day"),n=ct().endOf("day");return[t,n]},splitMomentInDateTimeParts(e,t=!1,n,r=!1){let a="";t?a=r?"23:59":"00:00":a=r?"11:59":"12:00";const s=r?"PM":"AM";return e&&ct.isMoment(e)&&e.isValid()?ee.toDateTimeString(e,t,n).split(" "):["",a,t?void 0:s]},getCurrentMoment(){return ct()},validateTimeString(e,t=!1){if(!e)return!0;const n=e.split(":"),r=n[0]||"0",a=n[1]||"0",s=Number.isNaN(Number(r))?NaN:parseInt(r,10),l=Number.isNaN(Number(a))?NaN:parseInt(a,10),c=n.length<=2&&r.length<=2&&a.length<=2;return t?c&&s>=0&&s<=23&&l>=0&&l<=59:c&&(!Number.isNaN(s)&&r.length===1||s>=1)&&s<=12&&l>=0&&l<=59},padIncompleteTimeString(e,t=!1){if(!e)return"";const n=e.split(":"),r=parseInt(n[0]||"0",10),a=parseInt(n[1]||"0",10);if(t){const s=r<10?`0${r}`:`${r}`,l=a<10?`0${a}`:`${a}`;return`${s}:${l}`}else{const s=r===0?"12":r<10?`0${r}`:`${r}`,l=a<10?`0${a}`:`${a}`;return`${s}:${l}`}}}),Oa=["01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00"],Ra=["00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"];let ho=tr;function Jl(e){ho=e}const Nr=function(t){if(Array.isArray(t)){const n=Nr(t[0]),r=Nr(t[1]);return n||r}if(t&&t.hasOwnProperty("year")){if(t[Dr])return{dateFormat:ho};if(!ee.isValid(t))return{dateValidity:!0}}return null};Ct.add("dateFormat"),Ct.add("dateValidity");const Zl=function(t){if(Array.isArray(t)){const n=Nr(t);if(n)return n;if(t&&ee.isBefore(t[1],t[0]))return{dateRangeOrder:!0}}return null};Ct.add("dateRangeOrder");const Xl=function({minDate:t,maxDate:n}){function r(a){const s=ee.isBefore(a,t),l=ee.isAfter(a,n),c={minExceeded:s?ee.toString(t,ho):null,maxExceeded:l?ee.toString(n,ho):null};return s||l?{dateConstraint:c}:null}return function(s){if(!s)return null;if(Array.isArray(s)){const l=r(s[0]),c=r(s[1]);return l||c}return s.hasOwnProperty("year")?r(s):null}};Ct.add("dateConstraint");const Wh=Object.freeze(Object.defineProperty({__proto__:null,date:Nr,dateConstraint:Xl,dateRange:Zl,setDateFormat:Jl},Symbol.toStringTag,{value:"Module"}));function en(e,t){for(const n of[].concat(e)){const r=t(n);if(r)return r}return null}const Gh=function(t){function n(r){return Number(r)>=t?null:{min:t}}return r=>en(r,n)};Ct.add("min");const Yh=function(t){function n(r){return Number(r)<=t?null:{max:t}}return r=>en(r,n)};er.add("max");const Uh=function(t){return typeof t>"u"||t===null||t===""||Number.isNaN(t)||t?.length===0?{required:!0}:null};er.add("required");const zh=function(t){function n(r){return r===void 0||r.toString().length<t?{minLength:t}:null}return r=>en(r,n)};Ct.add("minLength");const jh=function(t){function n(r){return r==null||Array.isArray(r)&&r.length<t?{minLengthArray:t}:null}return r=>n(r)};Ct.add("minLengthArray");const qh=function(t){function n(r){return r===void 0||r.toString().length<=t?null:{maxLength:t}}return r=>en(r,n)};zt.add("maxLength");const Jh=function(t){function n(r){return r==null||Array.isArray(r)&&r.length<=t?null:{maxLengthArray:t}}return r=>n(r)};Ct.add("maxLengthArray");const Zh=function(t){const n=t instanceof RegExp?t:new RegExp(t);function r(a){return n.test(a)?null:{pattern:t}}return a=>en(a,r)};Ct.add("pattern");const Xh=function(e){function t(n){return new RegExp("^\\p{L}*$","u").test(n)?null:{alpha:!0}}return en(e,t)};zt.add("alpha");const Qh=function(e){function t(n){return/^[0-9,. ]*$/.test(n)?null:{numeric:!0}}return en(e,t)};zt.add("numeric");const eS=function(e){function t(n){return/^-?[0-9,. ]*$/.test(n)?null:{positiveOrNegativeNumber:!0}}return en(e,t)};zt.add("positiveOrNegativeNumber");const tS=function(e){function t(n){return/^[^0-9]*$/.test(n)?null:{nonNumeric:!0}}return en(e,t)};zt.add("nonNumeric");const So=Object.freeze({...Wh,min:Gh,max:Yh,required:Uh,minLength:zh,minLengthArray:jh,maxLength:qh,maxLengthArray:Jh,pattern:Zh,alpha:Xh,numeric:Qh,nonNumeric:tS,positiveOrNegativeNumber:eS,OnBlurErrorKeys:Ct});function go(e,t=[]){const n=t.reduce((r,a)=>Object.assign(r,a(e)||{}),{});return Object.keys(n).length?n:null}var jt=(e=>(e[e.ON_CHANGE=0]="ON_CHANGE",e[e.ON_BLUR=1]="ON_BLUR",e[e.ON_SUBMIT=2]="ON_SUBMIT",e))(jt||{});function nS(e,t={},n=[]){for(const[r,a]of Object.entries(t))a===0?jl(r):a===2&&ql(r);return o.useCallback(e,n)}class _n{constructor(t,n){this.path=t,this.update=n,this.validators=[],this.#n=null,this.#e=null,this.#t=null,this.preventativeErrors=[],this.submitted=!1}#n;#e;#t;get errors(){return this.#n===null&&this.#e===null&&this.#t===null?null:{...this.#n??{},...this.#e??{},...this.#t??{}}}setValidators(t){return this.update(this.path,null,void 0,t),this}validate(t,n,r=!1){if(this.validators&&this.validators.length>0){const a=go(t,this.validators);let s={onSubmit:{},onChange:{},onBlur:{}};a&&(s=Object.keys(a).reduce((l,c)=>(fo.has(c)?l.onSubmit[c]=a[c]:er.has(c)?l.onChange[c]=a[c]:l.onBlur[c]=a[c],l),s)),(typeof n>"u"||n===jt.ON_CHANGE)&&(this.#e=Object.keys(s.onChange).length===0?null:s.onChange),(typeof n>"u"||n===jt.ON_BLUR)&&(this.#t=Object.keys(s.onBlur).length===0?null:s.onBlur),(typeof n>"u"||n===jt.ON_SUBMIT)&&(this.#n=Object.keys(s.onSubmit).length===0?null:s.onSubmit,this.#e=Object.keys(s.onChange).length===0?null:s.onChange,this.#t=Object.keys(s.onBlur).length===0?null:s.onBlur),r||this.update(),this.isFocused()&&this.onFocus&&this.onFocus()}else this.errors&&(this.#n=null,this.#t=null,this.#e=null,r||this.update());return this}isValid(){return!this.errors||this.isPristine()}hasErrors(){return!!this.errors}isVisibilyInvalid(){return!this.isValid()}hasError(t){return this.errors&&Object.prototype.hasOwnProperty.call(this.errors,t)}hasPreventativeError(t){return this.preventativeErrors.includes(t)}hasPreventativeErrors(){return this.preventativeErrors.length>0}isRequired(){return this.validators&&this.validators.indexOf(So.required)>-1}isSubmitted(){return this.submitted}onFocus(){}onBlur(){}}class kr extends _n{constructor(){super(...arguments),this.id=ht(),this.focused=!1,this.pristine=!0}setValue(t){if(this.preventativeErrors=[],this.validators&&this.validators.length>0){const n=go(t,this.validators);if(n&&Object.keys(n).filter(a=>zt.has(a)).length>0){this.preventativeErrors=Object.keys(n);return}}this.update(this.path,t)}isPristine(){return this.pristine}markAsPristine(){return this.pristine=!0,this.update(),this}markAsDirty(){return this.pristine=!1,this.update(),this}isFocused(){return this.focused}markAsFocused(){return this.focused=!0,this.update(),this.onFocus&&this.onFocus(),this}markAsBlurred(){return this.update(this.path,null,!0),this.onBlur&&this.onBlur(),this.preventativeErrors=[],this}markAsSubmitted(){return this.submitted=!0,this.update(this.path,null,!1,void 0,!0),this}}class Ln extends kr{constructor(t,n,r){const a=r?n:t,s=r||n;super(a,s),r&&this.inferMembers(t)}isFocused(){return super.isFocused()||this.rollup("isFocused")}isValid(){return super.isValid()&&this.rollup("isValid")}hasErrors(){return super.hasErrors()||Object.keys(this.fields).some(t=>this.fields[t].hasErrors())}contentsAreValid(){return this.rollup("isValid")&&this.rollup("contentsAreValid")}isPristine(){return super.isPristine()&&this.rollup("isPristine")}markAsPristine(){super.markAsPristine();for(const t of Object.keys(this.fields))this.fields[t].markAsPristine();return this}markAsDirty(){super.markAsDirty();for(const t of Object.keys(this.fields))this.fields[t].markAsDirty();return this}markAsBlurred(){super.markAsBlurred();for(const t of Object.keys(this.fields))this.fields[t].markAsBlurred();return this}markAsSubmitted(){super.markAsSubmitted();for(const t of Object.keys(this.fields))this.fields[t].markAsSubmitted();return this}inferSpsControl(t,n){return bo(t,[...this.path,n],this.update)}rollup(t){return Object.keys(this.fields).reduce((n,r)=>n&&(!this.fields[r][t]||this.fields[r][t]()),!0)}}class Ql extends Ln{inferMembers(t){this.fields={};for(const n of Object.keys(t))this.fields[n]=this.inferSpsControl(t[n],n)}}class ec extends Ln{inferMembers(t){this.fields=t.map((n,r)=>this.inferSpsControl(n,String(r)))}}function bo(e,t,n){return e instanceof _n?(e.path=t,e.update=n,e):Array.isArray(e)?new ec(e,t,n):zl(e)?new Ql(e,t,n):new kr(t,n)}function Ir(e,t){return t.length===0||!e?e:Ir(e.fields[t[0]],t.slice(1,t.length))}function Pa(e,t){if(t.length===0||!e)return[e];const n=t[0];if(t=t.slice(1,t.length),n==="*"){const r=Array.isArray(e.fields)?e.fields:Object.keys(e.fields).map(a=>e.fields[a]);return t.length===0?r:r.reduce((a,s)=>[...a,...Pa(s,t)],[])}return Pa(e.fields[n],t)}function Ba(e,t,n){for(const r of Object.keys(t)){const a=t[r];for(const s of Pa(e,r.split(".")))s&&a&&n(s,a)}}function vo(e,t,n,r=!1,a=!1){Ba(t,n,(s,l)=>{s.validators=typeof l=="function"?l(e):l,r&&s.validate(v.getPath(e,s.path),void 0,a)})}function Aa(e,t){const n=t[0];return t=t.slice(1),Array.isArray(e)?e.map((r,a)=>a===Number(n)?Aa(r,t):r):zl(e)?Object.keys(e).reduce((r,a)=>Object.assign(r,{[a]:a===n?Aa(e[a],t):e[a]}),{}):e}function rS(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("The initial value of useSpsForm() hook must be an object.")}function tc(e,t={}){rS(e);const[,n]=x.useState({}),r=x.useRef(!1);r.current=!1;const a=x.useRef(t),s=x.useCallback(h=>{const S=m.current;let y;if(h)if(h.path)if(h.markAsBlurred){const E=Ir(S.formMeta,h.path);if(E){E.focused=!1;const T=v.getPath(S.formValue,h.path);E.validate(T,jt.ON_BLUR)}}else if(h.newValidators){if(a.current){const E=h.path.join(".");a.current={...a.current,[E]:h.newValidators},vo(S.formValue,S.formMeta,a.current,!0)}}else if(h.markAsSubmitted){const E=Ir(S.formMeta,h.path);if(E){E.submitted=!0;const T=v.getPath(S.formValue,h.path);E.validate(T,jt.ON_SUBMIT)}}else y=Aa(S.formValue,h.path),v.setPath(y,h.path,h.value);else y=h.value;if(h?.updateFormOptions?.validators&&(a.current={...a.current,...h.updateFormOptions.validators},vo(S.formValue,S.formMeta,a.current,h.updateFormOptions?.runValidators??!0)),y){S.formMeta.submitted=!1,v.deepFreeze(y);const E=v.diff(S.formValue,y);for(const{type:D,key:w,parentPath:I,objects:[,M]}of E){const k=Ir(S.formMeta,I);if(typeof w!="symbol"&&k){let O;switch(D){case v.DiffChange.ADDITION:k.fields[w]=bo(M[w],[...I,w],c);break;case v.DiffChange.DELETION:Array.isArray(k.fields)?k.fields[w]=void 0:delete k.fields[w];break;case v.DiffChange.ALTERATION:O=bo(M[w],[...I,w],c),(O instanceof Ln&&!(k.fields[w]instanceof Ln)||!(O instanceof Ln)&&k.fields[w]instanceof Ln)&&(O.pristine=!1,k.fields[w]=O);break}}}const T=new Set;if(E.filter(D=>D.type===v.DiffChange.DELETION).reduce((D,w)=>(D.has(w.parentPath)||D.add(w.parentPath),D),T),Array.from(T).forEach(D=>{const w=Ir(S.formMeta,D);Array.isArray(w.fields)&&(w.fields=w.fields.filter(I=>I!==void 0))}),a.current){vo(y,S.formMeta,a.current);const D=new Set;t&&Ba(S.formMeta,t,(w,I)=>{typeof I=="function"&&(w.validate(v.getPath(y,w.path)),D.add(w))});for(const{type:w,key:I,parentPath:M,objects:[,k]}of E)if(typeof I!="symbol"){let O=S.formMeta,G=y;if(O){for(const C of M)O=O.fields[C],G=G[C],D.has(O)||O.validate(G,jt.ON_CHANGE);if(w===v.DiffChange.ADDITION||w===v.DiffChange.ALTERATION){const C=O.fields[I];if(!D.has(C)&&(O.fields[I].validate(k[I],jt.ON_CHANGE),w===v.DiffChange.ADDITION&&C.fields))for(const[V,R]of Object.entries(C.fields))R.validate(k[I][V],jt.ON_CHANGE)}}}}}m.current={...S,formValue:y||S.formValue},r.current||n({})},[]),l=x.useCallback((h,S)=>{h||S?s({value:h,updateFormOptions:S}):s()},[s]),c=x.useCallback((h,S,y=!1,E,T=!1)=>{h?s({path:h,value:S,markAsBlurred:y,newValidators:E,markAsSubmitted:T}):l()},[s,l]),p=x.useMemo(()=>{v.deepFreeze(e);const h=bo(e,[],c);return t&&vo(e,h,t,!1,!0),h},[]),f=x.useCallback(()=>(m.current.formMeta.markAsDirty(),a.current&&Ba(m.current.formMeta,a.current,(h,S)=>{(typeof S=="function"||Array.isArray(S))&&h.validate(v.getPath(m.current.formValue,h.path))}),m.current.formMeta.isValid()),[]),u=x.useCallback(()=>m.current.formValue,[]),m=x.useRef({formValue:e,formMeta:p,updateForm:l,validateForm:f,getCurrentFormValue:u});return m.current}const tt=o.forwardRef((e,t)=>{const{className:n,children:r,focusInputOnClick:a,formControl:s,formMeta:l,inputRef:c,onClick:p,...f}=e,u=o.useRef(),h=c||(t||u);function S(){h&&h!==t&&h.current&&h.current.focus()}function y(){h&&h!==t&&h.current&&l&&l instanceof kr&&l.markAsFocused()}function E(){h&&h!==t&&h.current&&l&&l instanceof kr&&l.markAsBlurred()}const T=U("sps-form-group",(s&&s.isRequired()||l&&l.isRequired())&&"sps-form-group--required",(s&&!s.isValid()||l&&l.isVisibilyInvalid())&&"sps-form-group--error",l&&l.hasPreventativeErrors()&&"sps-form-group--preventative-error",n);function D(w){a&&S(),p&&p(w)}return o.useEffect(()=>{function w(I){I.target.classList.contains("sps-form-control__clear-btn")&&I.preventDefault()}return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[]),o.createElement("div",{...f,className:T,ref:t,tabIndex:-1,onClick:D,onFocus:y,onBlur:E},r)});Object.assign(tt,{displayName:"SpsFormComponentWrapper"});const nc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,rc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",yo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return rc(n.overflowY,t)||rc(n.overflowX,t)||(r=>{const a=(s=>{if(!s.ownerDocument||!s.ownerDocument.defaultView)return null;try{return s.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},To=(e,t,n,r,a,s,l,c)=>s<e&&l>t||s>e&&l<t?0:s<=e&&c<=n||l>=t&&c>=n?s-e-r:l>t&&c<n||s<e&&c>n?l-t+a:0,oS=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},oc=(e,t)=>{var n,r,a,s;if(typeof document>"u")return[];const{scrollMode:l,block:c,inline:p,boundary:f,skipOverflowHiddenElements:u}=t,m=typeof f=="function"?f:z=>z!==f;if(!nc(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,S=[];let y=e;for(;nc(y)&&m(y);){if(y=oS(y),y===h){S.push(y);break}y!=null&&y===document.body&&yo(y)&&!yo(document.documentElement)||y!=null&&yo(y,u)&&S.push(y)}const E=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,T=(s=(a=window.visualViewport)==null?void 0:a.height)!=null?s:innerHeight,{scrollX:D,scrollY:w}=window,{height:I,width:M,top:k,right:O,bottom:G,left:C}=e.getBoundingClientRect(),{top:V,right:R,bottom:B,left:J}=(z=>{const W=window.getComputedStyle(z);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let L=c==="start"||c==="nearest"?k-V:c==="end"?G+B:k+I/2-V+B,Q=p==="center"?C+M/2-J+R:p==="end"?O+R:C-J;const P=[];for(let z=0;z<S.length;z++){const W=S[z],{height:ae,width:re,top:A,right:j,bottom:oe,left:ie}=W.getBoundingClientRect();if(l==="if-needed"&&k>=0&&C>=0&&G<=T&&O<=E&&(W===h&&!yo(W)||k>=A&&G<=oe&&C>=ie&&O<=j))return P;const q=getComputedStyle(W),$=parseInt(q.borderLeftWidth,10),H=parseInt(q.borderTopWidth,10),ne=parseInt(q.borderRightWidth,10),te=parseInt(q.borderBottomWidth,10);let de=0,ce=0;const X="offsetWidth"in W?W.offsetWidth-W.clientWidth-$-ne:0,se="offsetHeight"in W?W.offsetHeight-W.clientHeight-H-te:0,we="offsetWidth"in W?W.offsetWidth===0?0:re/W.offsetWidth:0,Le="offsetHeight"in W?W.offsetHeight===0?0:ae/W.offsetHeight:0;if(h===W)de=c==="start"?L:c==="end"?L-T:c==="nearest"?To(w,w+T,T,H,te,w+L,w+L+I,I):L-T/2,ce=p==="start"?Q:p==="center"?Q-E/2:p==="end"?Q-E:To(D,D+E,E,$,ne,D+Q,D+Q+M,M),de=Math.max(0,de+w),ce=Math.max(0,ce+D);else{de=c==="start"?L-A-H:c==="end"?L-oe+te+se:c==="nearest"?To(A,oe,ae,H,te+se,L,L+I,I):L-(A+ae/2)+se/2,ce=p==="start"?Q-ie-$:p==="center"?Q-(ie+re/2)+X/2:p==="end"?Q-j+ne+X:To(ie,j,re,$,ne+X,Q,Q+M,M);const{scrollLeft:pt,scrollTop:qe}=W;de=Le===0?0:Math.max(0,Math.min(qe+de/Le,W.scrollHeight-ae/Le+se)),ce=we===0?0:Math.max(0,Math.min(pt+ce/we,W.scrollWidth-re/we+X)),L+=qe-de,Q+=pt-ce}P.push({el:W,top:de,left:ce})}return P},aS=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Eo(e,t){if(!e.isConnected||!(a=>{let s=a;for(;s&&s.parentNode;){if(s.parentNode===document)return!0;s=s.parentNode instanceof ShadowRoot?s.parentNode.host:s.parentNode}return!1})(e))return;const n=(a=>{const s=window.getComputedStyle(a);return{top:parseFloat(s.scrollMarginTop)||0,right:parseFloat(s.scrollMarginRight)||0,bottom:parseFloat(s.scrollMarginBottom)||0,left:parseFloat(s.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(oc(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:s,left:l}of oc(e,aS(t))){const c=s-n.top+n.bottom,p=l-n.left+n.right;a.scroll({top:c,left:p,behavior:r})}}const Fa=Object.freeze(Object.defineProperty({__proto__:null,default:Eo},Symbol.toStringTag,{value:"Module"})),sS={alt:"string",size:"SpinnerSize",title:"string"};function Va(e){const{alt:t,className:n,size:r=Y.SpinnerSize.MEDIUM,"data-testid":a,title:s,unsafelyReplaceClassName:l,...c}=e,{t:p}=Oe.useWoodlandLanguage(),f=t||s||p("spinner.defaultAltText",{defaultValue:"Loading..."}),u=U(l||"sps-spinner",`sps-spinner--${r}`,n);return o.createElement("i",{className:u,"data-testid":a,title:f,...c})}Object.assign(Va,{props:sS,displayName:"SpsSpinner"});const iS=60;function wo(e){return typeof e>"u"?"inherit":`${e}px`}function $a(e){switch(e){case Y.Position.TOP_LEFT:return Y.Position.BOTTOM_LEFT;case Y.Position.TOP_MIDDLE:return Y.Position.BOTTOM_MIDDLE;case Y.Position.TOP_RIGHT:return Y.Position.BOTTOM_RIGHT;case Y.Position.RIGHT_TOP:return Y.Position.LEFT_TOP;case Y.Position.RIGHT_MIDDLE:return Y.Position.LEFT_MIDDLE;case Y.Position.RIGHT_BOTTOM:return Y.Position.LEFT_BOTTOM;case Y.Position.BOTTOM_RIGHT:return Y.Position.TOP_RIGHT;case Y.Position.BOTTOM_MIDDLE:return Y.Position.TOP_MIDDLE;case Y.Position.BOTTOM_LEFT:return Y.Position.TOP_LEFT;case Y.Position.LEFT_BOTTOM:return Y.Position.RIGHT_BOTTOM;case Y.Position.LEFT_MIDDLE:return Y.Position.RIGHT_MIDDLE;case Y.Position.LEFT_TOP:return Y.Position.RIGHT_TOP}}function lS(e,t,n,r,a,s,l,c){const p=l&&l.current,f=p?p.scrollTop:window.pageYOffset,u=c?0:f,m=p?p.scrollLeft:window.pageXOffset,h=c?0:m,[S,y]=e.split(" ");let E,T,D,w;switch(S){case"top":D=t.height-n.top-u-s[0];break;case"left":T=t.width-n.left-h-s[0];break;case"right":w=n.right+h-s[0];break;case"bottom":E=n.bottom+u-s[0];break;default:throw new Error(`Invalid position ${e}`)}switch(y){case"left":w=n.left+h+s[1];break;case"top":E=n.top+u+s[1];break;case"middle":S==="top"||S==="bottom"?w=n.left+h+n.width/2-a/2+s[1]:(S==="left"||S==="right")&&(E=n.top+u+n.height/2-r.height/2+s[1]);break;case"bottom":D=t.height-n.bottom-u+s[1];break;case"right":T=t.width-n.right-h+s[1];break;default:throw new Error(`Invalid position ${e}`)}return[E,T,D,w]}function On(e,t,n,{altPosition:r,setMinWidth:a=!1,setWidth:s=!1,parentElementRef:l,fixed:c=!1,offsets:p=[0,0]}){if(e.current&&t.current){const f=e.current.getBoundingClientRect(),u=t.current.getBoundingClientRect(),m=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=document.documentElement.getBoundingClientRect().width;let y=(l?.current??document.documentElement).getBoundingClientRect();c&&(y={x:0,y:0,width:h,height:m,top:0,left:0,bottom:m,right:h,toJSON(){return{width:h,height:m,top:0,left:0,bottom:m,right:h}}});const[E,T]=n.split(" ");let D=n;if(r&&(E==="top"&&u.top-f.height<iS||E==="right"&&u.right+f.width>h||E==="bottom"&&u.bottom+f.height>m||E==="left"&&u.left-f.width<0)&&(D=r),T==="left"&&u.left+f.width+(p?.[1]??0)>document.documentElement.getBoundingClientRect().right)switch(E){case"bottom":D=Y.Position.BOTTOM_RIGHT;break;case"top":D=Y.Position.TOP_RIGHT;break}const w=a?Math.max(u.width,f.width):f.width,I=s?u.width:w,[M,k,O,G]=lS(D,y,u,f,I,p,l,c),C={top:wo(M),right:wo(k),bottom:wo(O),left:wo(G)};return c&&(C.position="fixed",C.zIndex=Y.ZStratum.BAR),a&&(C.minWidth=`${u.width}px`),s&&(C.width=`${u.width}px`),[C,D===r]}return[{},!1]}const xt=x.createContext(null);function rr(e,t=[]){const n=x.useContext(xt);return x.useMemo(()=>r=>{const s=n&&n.parentElementRef&&n.parentElementRef.current||document.body;let l=null,c=s.lastElementChild;for(;c&&c!==s.firstElementChild;){if(c.hasAttribute("data-portalid")&&c.getAttribute("data-portalid")===e){l=c;break}c=c.previousElementSibling}if(l)s.contains(l)||s.appendChild(l);else{l=document.createElement("div"),l.setAttribute("data-portalid",e);for(const p of t)l.classList.add(p);s.appendChild(l)}return mo.createPortal(r,l)},[n])}const Ka=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0"];async function ac(e,t,n,r,a,s){const l=typeof e.options=="function"?e.options(t.value):e.options||[],c=l instanceof Promise,p=m=>m.replace(/([.?*+^$[\]\\(){}|-])/g,"");n({pending:c}),s.current=c?l:null;const f=c?await l||[]:l||[];if(c&&s.current!==l)return;let u=Array.from(f).filter(Boolean).map(m=>new Y.SpsOptionListOption(m,typeof m=="function"?{textKey:"label",captionKey:"caption"}:{textKey:e.textKey,captionKey:e.captionKey}));if(e.nullOption&&u.unshift(new Y.SpsOptionListOption(null,{text:e.nullOption})),t.value&&!e.disableDefaultOptionsFiltering){const m=p(t.value);n({replacementPattern:new RegExp(`(${m})`,"ig")}),u=u.filter(h=>{const S=new RegExp(m,"i"),y=p(h.text);return e.filterByTextAndCaptionKey?S.test(y)||S.test(p(h.caption)):S.test(y)})}else n({replacementPattern:null});if(e.disabledOptions)for(const m of u)e.disabledOptions.includes(m.value)&&(m.disabled=!0);r(Object.freeze(u)),e.onOptionListChanged&&e.onOptionListChanged(u.length),a(u.some(m=>m.value&&!!m.value.icon)),n({pending:!1})}function cS(e,t,n){const[r,a]=o.useState(Object.freeze([])),[s,l]=o.useState(!1),c=o.useRef(null),p=o.useRef(e.options);(typeof e.options!="function"||e.disableOptionsMemoization)&&(p.current=e.options);const f=o.useMemo(()=>typeof p.current=="function"?v.debounce(ac,typeof e.searchDebounce<"u"?e.searchDebounce:500):ac,[p.current,e.disabledOptions]);return o.useEffect(()=>{f(e,t,n,a,l,c)},[p.current,t.value,e.disabledOptions]),[r,s]}class Sn{constructor(t,n){this.target=t,this.isPgStoppedInternal=!1,this.currentTarget=t,this.nativeEvent=new CustomEvent("change",n),Object.defineProperty(this.nativeEvent,"target",{value:t,writable:!1,configurable:!1,enumerable:!0})}get bubbles(){return this.nativeEvent.bubbles}get cancelable(){return this.nativeEvent.cancelable}get defaultPrevented(){return this.nativeEvent.defaultPrevented}get eventPhase(){return this.nativeEvent.eventPhase}get isTrusted(){return this.nativeEvent.isTrusted}get timeStamp(){return this.nativeEvent.timeStamp}get type(){return this.nativeEvent.type}preventDefault(){this.nativeEvent.preventDefault()}isDefaultPrevented(){return this.defaultPrevented}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPgStoppedInternal=!0}isPropagationStopped(){return this.isPgStoppedInternal}persist(){throw new Error("This is not a real React ChangeEvent. React does not permit the creation of SyntheticEvents in userland.")}}function dS(e,t){return{...e,...t}}function qt(e){return x.useReducer(dS,e)}function pS({hideInlineSearch:e,options:t,onSearchChange:n,search:r="",searchPlaceholder:a="Search…",searchInputRef:s}){const[l,c]=qt({isAsync:typeof t=="function",pending:!1,value:r,replacementPattern:null}),p=o.useCallback(S=>{c({value:S.target.value}),n&&n(S)},[n]),f=o.useCallback(S=>{S.nativeEvent.stopImmediatePropagation(),S.stopPropagation()},[]),u=o.useCallback(S=>{S.nativeEvent.stopImmediatePropagation(),c({value:""}),s?.current&&(n&&n(new Sn(s.current)),s.current.focus())},[n]),m=S=>{S&&(["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"].includes(S.key)||S.stopPropagation())};return o.useEffect(()=>{c({value:r})},[r]),[l.isAsync&&!e?o.createElement("div",{className:"sps-option-list__search sps-form-group sps-text-input"},o.createElement("div",{className:"sps-form-control"},!l.value&&o.createElement("i",{className:"sps-icon sps-icon-filter sps-text-input__icon"}),o.createElement("input",{type:"text",className:"sps-text-input__input",placeholder:a,ref:s,value:l.value,onChange:p,onClick:f,onKeyDown:m}),l.value&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:u}))):o.createElement(o.Fragment,null),l,c]}const uS=Eo||Fa,mS=["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"];function fS(e,t,n){return n?(e&&e[n])===(t&&t[n]):e===t}function sc(e,t,n){return typeof n.value=="function"&&n.disabled?!0:t?!!e?.find(r=>r[t]&&r[t]===n?.value?.[t]):!1}const xr=o.forwardRef((e,t)=>{const{captionKey:n,comparisonKey:r,disabledOptions:a,options:s,tall:l,textKey:c,valueKey:p,zeroState:f,hideInlineSearch:u,onSearchChange:m,search:h,searchDebounce:S,searchPlaceholder:y,onSpecialActionSelect:E,attachTo:T,className:D,conformWidth:w,id:I,ignoreWidthStyles:M,isOpen:k,keepOpen:O,keyDown:G,nullOption:C,onOptionListChanged:V,onOptionSelected:R,onPositionFlip:B,onSelfToggle:J,optionRole:L,positionOverride:Q,selectedOption:P,specialAction:z,unsafelyReplaceClassName:W,loading:ae,filterByTextAndCaptionKey:re,maxHeightPx:A,maxHeightRem:j,disableOptionsMemoization:oe,disableDefaultOptionsFiltering:ie,"data-testid":q,typeaheadEvent:$,...H}=e,ne=o.useMemo(()=>z?new Y.SpsOptionListOption(z,{textKey:"label",captionKey:"caption"}):null,[z]),[te,de]=o.useState(-1),[ce,X]=o.useState(k),se=t||o.useRef(null),we=o.useRef(null),Le=o.useRef(null),pt=rr("sps-option-list-portal"),qe=o.useContext(xt),[st,Ze]=Q||[Y.Position.BOTTOM_LEFT,Y.Position.TOP_LEFT],[[Bt,Xe],Ve]=o.useState([{},!1]),ge=o.useRef(null),[We,Ke,Ee]=pS({...e,searchInputRef:ge}),[ye,ut]=cS(e,Ke,Ee);o.useEffect(()=>{$&&vt($)},[$]),o.useEffect(()=>{Ve(ce?On(se,T,st,{altPosition:Ze,setMinWidth:!M,setWidth:!M&&w,...qe}):[{},!1])},[ce,st,Ze,ye]),o.useEffect(()=>{let he;return ce&&(he=()=>{ce&&Ve(On(se,T,st,{altPosition:Ze,setMinWidth:!M,setWidth:!M&&w,...qe}))},document.addEventListener("scroll",he)),()=>{he&&document.removeEventListener("scroll",he)}},[ce]),o.useEffect(()=>{de(-1)},[Ke]);const Xt=U(W||"sps-option-list","z-stratum-dropdown",ce&&"sps-option-list--open",Ke.isAsync&&"sps-option-list--searchable",Xe&&"sps-option-list--opens-upward",z&&z.label&&"sps-option-list--has-special-action",D),At=U(W||"sps-option-list__options",l&&"sps-option-list__options--tall"),ke=o.useCallback(()=>{ce||(X(!0),ge.current&&ge.current.focus(),de(-1),J&&J(!0))},[ce,J]),pe=o.useCallback(()=>{ce&&(X(!1),de(-1),J&&J(!1))},[ce,J]),De=o.useCallback((he,ve)=>{ve||he&&!he.disabled&&(typeof he.value=="function"?(he.value(),E&&E()):typeof R=="function"&&R(he.value),O||pe())},[R,pe]),je=o.useCallback((he,ve,et)=>{he.stopPropagation(),De(ve,et)},[De]),Qe=o.useRef(a||[]);Qe.current=a||[];const Ge=o.useCallback(he=>{switch(he.key){case"Tab":case"Escape":pe();break;case"Enter":if(te>-1){const ve=ye[te]||ne;he.preventDefault();const et=!!ve&&sc(Qe.current,r||"",ve);!et&&ve&&typeof R=="function"&&typeof ve.value=="function"?ve.value():ve&&De(ve,et)}break;case"Up":case"ArrowUp":{let ve=te;Xe?te<=-1?ve=ye.length-1:te===0?z&&(ve=ye.length):te<ye.length&&(ve=te-1):te>-1&&(ve=te-1),ve!==te&&(he.preventDefault(),de(ve));break}case"Down":case"ArrowDown":{ke();let ve=te;Xe?te!==-1&&(te>=ye.length?ve=0:te===ye.length-1?ve=-1:ve=te+1):te<ye.length-1+ +!!z&&(ve=te+1),ve!==te&&(he.preventDefault(),de(ve));break}default:ke()}},[pe,ke,te,De,R,Xe,ye]),it=o.useCallback(he=>{ke();const ve=ye.findIndex(et=>{if(et.textKey){const Ft=et.textKey;return et.value[Ft].toLowerCase().charAt([0])===he.key.toLocaleLowerCase()}return et.value.toString().toLowerCase().charAt([0])===he.key.toLocaleLowerCase()});ve>-1&&de(ve)},[ye]),vt=o.useCallback(he=>{he&&(mS.includes(he.key)?Ge(he):Ka.includes(he.key)&&!u&&it(he))},[pe,ke,te,De,R,Xe,ye]);o.useEffect(()=>{if(qe!==null&&document.getElementsByClassName("sps-modal__body").length>0){const he=()=>{J&&J(!1)},ve=document.getElementsByClassName("sps-modal__body")[0];return ve.addEventListener("scroll",he),()=>{ve.removeEventListener("scroll",he)}}},[]),o.useEffect(()=>{ce&&Le.current&&uS(Le.current,{scrollMode:"if-needed",block:"nearest",inline:"nearest"})},[te,ce]),o.useEffect(()=>{X(k),k?ge.current&&ge.current.focus():de(-1)},[k]),o.useEffect(()=>{G&&vt(G)},[G]),o.useEffect(()=>{!ce&&we.current&&(Ee({value:""}),we.current.scrollTop=0),ce&&B&&B(Xe)},[ce]);const wt=A?A/16:j,mt=wt?{maxHeight:`${wt}rem`}:{};function kn(he,ve){return ve?o.createElement(o.Fragment,null,he.split(ve).map((et,Ft)=>ve.test(et)?o.createElement("u",{key:Ft},et):o.createElement(o.Fragment,{key:Ft},et))):o.createElement(o.Fragment,null,he)}return pt(o.createElement("div",{className:Xt,id:I,"aria-activedescendant":te>-1?`${I}-option-${te}`:"",tabIndex:-1,ref:se,style:Bt,onMouseLeave:()=>de(-1),"data-testid":q,...H},We,o.createElement("div",{className:At,ref:we,"data-testid":`${q}-options`,style:mt},!ae&&!Ke.pending&&f&&ye.length===0&&o.createElement("div",{className:"sps-option-list__zero-state"},f),(ae||Ke.pending)&&o.createElement("div",{className:"sps-option-list__loading"},o.createElement(Va,null)),!ae&&!Ke.pending&&ye.map((he,ve)=>{const et=`${I}-option-${ve}`,Ft=fS(he.value,P,r),me=sc(Qe.current,r||"",he);return o.createElement("a",{key:et,id:et,role:L,"aria-selected":Ft,href:he.href,className:U("sps-option-list__option",he.caption&&"sps-option-list__option--has-caption",he.disabled&&"sps-option-list__option--disabled",he.bold&&"sps-option-list__option--bold",(Ft||me)&&"sps-option-list__option--selected",te===ve&&"sps-option-list__option--highlighted"),onClick:wl=>je(wl,he,me),onMouseOver:()=>de(ve),tabIndex:-1,ref:te===ve?Le:null,"data-testid":`${q}-option-${ve}`},he.value&&he.value.icon&&o.createElement("i",{className:U("sps-icon","sps-option-list__option-icon",`sps-icon-${String(he.value.icon)}`)}),(!he.value||!he.value.icon&&ut)&&o.createElement("span",{className:"sps-option-list__option-icon-spacer"}),o.createElement("span",null,kn(he.text,Ke.replacementPattern)),he.caption&&o.createElement("div",{className:"sps-option-list__option-caption"},o.createElement("span",null,kn(he.caption,Ke.replacementPattern))))})),ne&&z?.label&&o.createElement("a",{className:U("sps-option-list__option","sps-option-list__special-action",te===ye.length&&"sps-option-list__option--highlighted",z.disabled&&"sps-option-list__special-action--disabled"),href:ne.href,target:ne.href&&z.newTab?"_blank":"_self",onClick:he=>je(he,ne),onMouseOver:()=>de(ye.length),"data-testid":`${q}-special-action`},z.icon&&o.createElement("i",{className:U("sps-icon","sps-option-list__option-icon",`sps-icon-${String(z.icon)}`)}),!z.icon&&ut&&o.createElement("span",{className:"sps-option-list__option-icon-spacer"}),o.createElement("span",null,z.label))))});Object.assign(xr,{displayName:"SpsOptionList"});function hS(e,t,n=[]){return o.useMemo(()=>{function r(a){return o.createElement(e,{...a,...t},a.children)}return r},n)}function Tt(e){return typeof e=="function"?e():e}const ic=function({children:e,elements:t}){if(t.length===0)return o.createElement(o.Fragment,null,e);const[n,r]=Array.isArray(t[0])?t[0]:[t[0]];return o.createElement(n,{...r??{}},o.createElement(ic,{elements:t.slice(1)},e))},lc=function({children:e,providers:t=[],...n}){return o.createElement("div",{...n},o.createElement(ic,{elements:t},e))},SS=function({children:e,className:t,...n}){return o.createElement(lc,{className:`sps-app ${t}`,...n},e)};function Mt(e=[],t=[]){const n=Array.isArray(e)?v.flatten(e):[e],r=t.map(s=>Array.isArray(s)?s:[s]),a=new Array(r.length+1).fill(null).map(()=>[]);for(const s of n){let l=!1;for(let c=0;c<r.length;c+=1)for(const{type:p,props:f={}}of r[c])if(s.type===p&&Object.keys(f).every(m=>f[m]===s.props[m])){l=!0,a[c].push(s);break}l||a[a.length-1].push(s)}return a}function cc(e,t,n){const r=Object.entries(t).filter(([,s])=>typeof s!="string"&&s.deprecated).map(([s])=>s),a=r.map(s=>n[s]);o.useEffect(()=>{a.find(s=>typeof s<"u")&&console.warn(`The following prop(s) of ${e} are deprecated: ${r.join(", ")}`)},a)}function Ha(e,t){const n=x.useRef(!1);x.useEffect(()=>()=>{n.current=!1},[]),x.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function Wa(e,t,n){const r=o.useRef(t(...n));o.useEffect(()=>(document.addEventListener(e,r.current,{capture:!0}),()=>document.removeEventListener(e,r.current)),[]),o.useEffect(()=>{document.removeEventListener(e,r.current),r.current=t(...n),document.addEventListener(e,r.current,{capture:!0})},n)}function dc(e,t,n){return function(a){!e.current?.contains(a.target)&&!t.current?.contains(a.target)&&n()}}function or(e,t,n){const r=o.useRef(!1),[a,s]=o.useState(!1),l=o.useCallback(()=>{r.current?r.current=!1:s(!0)},[]),c=o.useCallback((p=!1)=>{s(!1),r.current=p,n&&n()},[]);return Wa("mousedown",dc,[e,t,c]),Wa("pointerdown",dc,[e,t,c]),{showPopup:a,doShowPopup:l,doHidePopup:c}}const pc=e=>{const t=/(auto|scroll)/,n=(c,p)=>c.parentNode===null?p:n(c.parentNode,p.concat([c])),r=(c,p)=>getComputedStyle(c,null).getPropertyValue(p),a=c=>r(c,"overflow")+r(c,"overflow-y"),s=c=>t.test(a(c));return(c=>{if(!(c instanceof HTMLElement||c instanceof SVGElement))return;const p=n(c.parentNode,[]);for(let f=0;f<p.length;f+=1)if(s(p[f]))return p[f];return null})(e)};let Ga=0;function Mr({isOpen:e,rootRef:t}){o.useLayoutEffect(()=>{let n,r,a;if(e&&t.current){Ga+=1,n=pc(t.current)||document.body,r=n===document.body?window.innerWidth-document.documentElement.clientWidth:n.offsetWidth-n.clientWidth,n.style.overflow="hidden";const s=window.getComputedStyle(n).paddingRight;if(n.style.paddingRight=s&&s!=="0px"?`calc(${s} + ${r}px)`:`${r}px`,n===document.body){if(a=document.getElementsByClassName("sps-navbar-container").item(0),a&&window.getComputedStyle(a).position==="fixed"){const l=window.getComputedStyle(a).paddingRight;a.style.paddingRight=l&&l!=="0px"?`calc(${l} + ${r}px)`:`${r}px`}else if(a=document.getElementsByTagName("nav").item(0)?.parentElement,a&&window.getComputedStyle(a).position==="fixed"){const c=window.getComputedStyle(a).paddingRight;a.style.paddingRight=c&&c!=="0px"?`calc(${c} + ${r}px)`:`${r}px`}}}return()=>{n&&(Ga-=1,Ga===0&&(n.style.overflow=null,n.style.paddingRight=null,a&&(a.style.paddingRight=null)))}},[e])}const gS={debounce:"number",disabled:"boolean",conformWidth:"boolean",formMeta:"SpsFormFieldMeta<string>",icon:"SpsIcon",onChange:"React.ChangeEventHandler",onSelectionChange:"(newValue: string) => void",placeholder:"string",suggestions:{type:`
|
|
2
2
|
Eventually<Iterable<string>>
|
|
3
3
|
| ((filter?: string) => Eventually<Iterable<string>>)
|
|
4
4
|
`,required:!0},tallOptionList:"boolean",value:"string",zeroState:"string",loading:"boolean",maxHeightOptionListPx:"number",maxHeightOptionListRem:"number",disableOptionsMemoization:"boolean",inputNotClearable:"boolean",autoFocusOnSelection:"boolean"};function Jt({className:e,debounce:t=0,disabled:n,conformWidth:r,formControl:a,formMeta:s,onChange:l,onSelectionChange:c,icon:p,id:f,placeholder:u="",suggestions:m,unsafelyReplaceClassName:h,tallOptionList:S,value:y="",zeroState:E,loading:T,maxHeightOptionListPx:D,maxHeightOptionListRem:w,disableOptionsMemoization:I,inputNotClearable:M,autoFocusOnSelection:k,"data-testid":O,...G}){const C=s||a,{wrapperId:V,controlId:R}=St(f,C),[B,J]=qt({keyDown:null,opensUpward:!1}),L=o.useRef(null),Q=o.useRef(null),P=o.useRef(null),{showPopup:z,doShowPopup:W,doHidePopup:ae}=or(L,P);function re(H,ne,te=!1){C&&(C.setValue(H),C.markAsDirty()),c&&te?c(H):l&&l(ne||new Sn({value:H}))}function A(H){Q.current&&(Q.current.value="",re("")),H.stopPropagation()}function j(H){re(H.target.value,H)}function oe(H){n||(["Up","ArrowUp","Down","ArrowDown","Enter"].indexOf(H.key)>-1&&(H.preventDefault(),H.persist()),H.stopPropagation(),J({keyDown:H})),H.key==="Tab"&&ae()}function ie(H){H?W():ae()}function q(H){J({opensUpward:H})}const $=U(h||"sps-autocomplete",z&&"sps-autocomplete--open",z&&"z-stratum-dropdown",B.opensUpward&&"sps-autocomplete--opens-upward",n&&"sps-form-control--disabled",e);return o.useEffect(()=>{let H;return z&&(H=()=>{ae()},window.addEventListener("resize",H)),()=>{H&&window.removeEventListener("resize",H)}},[z]),Mr({isOpen:z,rootRef:L}),o.createElement(tt,{id:V,className:$,formControl:a,formMeta:s,inputRef:Q,ref:L,focusInputOnClick:!0,onClick:H=>H.nativeEvent.stopImmediatePropagation(),"data-testid":`${O}`},o.createElement("div",{className:"sps-text-input"},o.createElement("div",{className:"sps-form-control"},p&&o.createElement("i",{className:U("sps-text-input__icon","sps-icon",`sps-icon-${p}`)}),o.createElement("input",{type:"text",ref:Q,value:y,className:"sps-text-input__input",placeholder:u,onFocus:W,onClick:W,onChange:j,onKeyDown:oe,disabled:n,id:R,"data-testid":`${O}__input`,...G}),y&&!n&&!M&&o.createElement("i",{"aria-label":"clear",className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:H=>A(H)}))),o.createElement(xr,{id:`${V}_options`,ref:P,attachTo:L,isOpen:z,options:m,hideInlineSearch:!0,keyDown:B.keyDown,onOptionSelected:H=>{re(H,void 0,!0),k&&Q.current?.focus()},onPositionFlip:q,onSelfToggle:ie,offsets:[1,0],search:y,searchDebounce:t,tall:S,zeroState:E,loading:T,maxHeightPx:D,maxHeightRem:w,disableOptionsMemoization:I,conformWidth:r}))}Object.assign(Jt,{props:gS,displayName:"SpsAutocomplete"});const uc={basic:{label:"Basic",examples:{basic:{react:v.code`
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import type { EffectCallback } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Like useEffect, but skips the initial mount and only runs on subsequent updates.
|
|
4
|
+
*
|
|
5
|
+
* React Strict Mode compatibility:
|
|
6
|
+
* Strict Mode simulates unmount/remount cycles in development. Without the cleanup
|
|
7
|
+
* effect below, the ref would persist as `true` across the simulated remount,
|
|
8
|
+
* causing the callback to fire on what should still be the initial mount.
|
|
9
|
+
* The empty-deps effect resets the ref on unmount, ensuring correct behavior.
|
|
10
|
+
*/
|
|
2
11
|
export declare function useDidUpdateEffect(cb: EffectCallback, deps?: any[]): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/ds-react",
|
|
3
3
|
"description": "SPS Design System React components",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.37.1",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-react",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"moment-timezone": "^0.5.28",
|
|
47
47
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
48
48
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
49
|
-
"@sps-woodland/illustrations": "8.
|
|
50
|
-
"@
|
|
51
|
-
"@spscommerce/
|
|
52
|
-
"@
|
|
53
|
-
"@spscommerce/
|
|
54
|
-
"@spscommerce/
|
|
49
|
+
"@sps-woodland/illustrations": "8.37.1",
|
|
50
|
+
"@spscommerce/i18n": "8.37.1",
|
|
51
|
+
"@spscommerce/positioning": "8.37.1",
|
|
52
|
+
"@sps-woodland/tabs": "8.37.1",
|
|
53
|
+
"@spscommerce/ds-shared": "8.37.1",
|
|
54
|
+
"@spscommerce/ds-colors": "8.37.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@react-spectrum/provider": "^3.4.1",
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"raf-stub": "^3.0.0",
|
|
74
74
|
"react": "^16.9.0",
|
|
75
75
|
"react-dom": "^16.9.0",
|
|
76
|
-
"@sps-woodland/illustrations": "8.
|
|
77
|
-
"@
|
|
78
|
-
"@spscommerce/ds-
|
|
79
|
-
"@spscommerce/i18n": "8.
|
|
80
|
-
"@spscommerce/positioning": "8.
|
|
81
|
-
"@
|
|
82
|
-
"test": "8.
|
|
76
|
+
"@sps-woodland/illustrations": "8.37.1",
|
|
77
|
+
"@spscommerce/ds-colors": "8.37.1",
|
|
78
|
+
"@spscommerce/ds-shared": "8.37.1",
|
|
79
|
+
"@spscommerce/i18n": "8.37.1",
|
|
80
|
+
"@spscommerce/positioning": "8.37.1",
|
|
81
|
+
"@sps-woodland/tabs": "8.37.1",
|
|
82
|
+
"test": "8.37.1"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "pnpm run build:js && pnpm run build:types",
|