@sps-woodland/buttons 8.0.2 → 8.0.3

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.es.js CHANGED
@@ -1,281 +1,635 @@
1
1
  import * as d from "react";
2
- import U, { useRef as W, useCallback as R, useEffect as ie, useContext as Ke, useState as je, useMemo as ze } from "react";
3
- import { I18nContext as Ye, Icon as qe, Spinner as Xe, cl as Je, Metadata as Qe } from "@sps-woodland/core";
4
- import { code as m } from "@spscommerce/utils";
5
- function Ie(e) {
6
- var t, n, r = "";
2
+ import ce, { useRef as H, useCallback as K, useEffect as ue, useState as Ve, useMemo as Ge, useContext as De } from "react";
3
+ import { I18nContext as We, Icon as He, Spinner as je, cl as ze, Metadata as Ye } from "@sps-woodland/core";
4
+ import { code as g } from "@spscommerce/utils";
5
+ function Oe(e) {
6
+ var t, n, o = "";
7
7
  if (typeof e == "string" || typeof e == "number")
8
- r += e;
8
+ o += e;
9
9
  else if (typeof e == "object")
10
10
  if (Array.isArray(e))
11
11
  for (t = 0; t < e.length; t++)
12
- e[t] && (n = Ie(e[t])) && (r && (r += " "), r += n);
12
+ e[t] && (n = Oe(e[t])) && (o && (o += " "), o += n);
13
13
  else
14
14
  for (t in e)
15
- e[t] && (r && (r += " "), r += t);
16
- return r;
15
+ e[t] && (o && (o += " "), o += t);
16
+ return o;
17
17
  }
18
- function Me() {
19
- for (var e, t, n = 0, r = ""; n < arguments.length; )
20
- (e = arguments[n++]) && (t = Ie(e)) && (r && (r += " "), r += t);
21
- return r;
18
+ function Xe() {
19
+ for (var e, t, n = 0, o = ""; n < arguments.length; )
20
+ (e = arguments[n++]) && (t = Oe(e)) && (o && (o += " "), o += t);
21
+ return o;
22
22
  }
23
- typeof window < "u" && U.useLayoutEffect;
24
- let pe = /* @__PURE__ */ new Map();
25
- function Ze(e, t) {
23
+ const de = typeof document < "u" ? ce.useLayoutEffect : () => {
24
+ };
25
+ function M(e) {
26
+ const t = H(null);
27
+ return de(() => {
28
+ t.current = e;
29
+ }, [
30
+ e
31
+ ]), K((...n) => {
32
+ const o = t.current;
33
+ return o(...n);
34
+ }, []);
35
+ }
36
+ let ge = /* @__PURE__ */ new Map();
37
+ function qe(e, t) {
26
38
  if (e === t)
27
39
  return e;
28
- let n = pe.get(e);
40
+ let n = ge.get(e);
29
41
  if (n)
30
42
  return n(t), t;
31
- let r = pe.get(t);
32
- return r ? (r(e), e) : t;
43
+ let o = ge.get(t);
44
+ return o ? (o(e), e) : t;
33
45
  }
34
- function et(...e) {
46
+ function Je(...e) {
35
47
  return (...t) => {
36
48
  for (let n of e)
37
49
  typeof n == "function" && n(...t);
38
50
  };
39
51
  }
40
- function me(...e) {
52
+ const N = (e) => {
53
+ var t;
54
+ return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
55
+ }, oe = (e) => e && "window" in e && e.window === e ? e : N(e).defaultView || window;
56
+ function U(...e) {
41
57
  let t = {
42
58
  ...e[0]
43
59
  };
44
60
  for (let n = 1; n < e.length; n++) {
45
- let r = e[n];
46
- for (let s in r) {
47
- let l = t[s], u = r[s];
48
- typeof l == "function" && typeof u == "function" && s[0] === "o" && s[1] === "n" && s.charCodeAt(2) >= 65 && s.charCodeAt(2) <= 90 ? t[s] = et(l, u) : (s === "className" || s === "UNSAFE_className") && typeof l == "string" && typeof u == "string" ? t[s] = Me(l, u) : s === "id" && l && u ? t.id = Ze(l, u) : t[s] = u !== void 0 ? u : l;
61
+ let o = e[n];
62
+ for (let s in o) {
63
+ let u = t[s], c = o[s];
64
+ typeof u == "function" && typeof c == "function" && s[0] === "o" && s[1] === "n" && s.charCodeAt(2) >= 65 && s.charCodeAt(2) <= 90 ? t[s] = Je(u, c) : (s === "className" || s === "UNSAFE_className") && typeof u == "string" && typeof c == "string" ? t[s] = Xe(u, c) : s === "id" && u && c ? t.id = qe(u, c) : t[s] = c !== void 0 ? c : u;
49
65
  }
50
66
  }
51
67
  return t;
52
68
  }
53
- const tt = /* @__PURE__ */ new Set([
69
+ const Qe = /* @__PURE__ */ new Set([
54
70
  "id"
55
- ]), nt = /* @__PURE__ */ new Set([
71
+ ]), Ze = /* @__PURE__ */ new Set([
56
72
  "aria-label",
57
73
  "aria-labelledby",
58
74
  "aria-describedby",
59
75
  "aria-details"
60
- ]), rt = /^(data-.*)$/;
61
- function ot(e, t = {}) {
62
- let { labelable: n, propNames: r } = t, s = {};
63
- for (const l in e)
64
- Object.prototype.hasOwnProperty.call(e, l) && (tt.has(l) || n && nt.has(l) || (r == null ? void 0 : r.has(l)) || rt.test(l)) && (s[l] = e[l]);
65
- return s;
66
- }
67
- let G = /* @__PURE__ */ new Map(), be = /* @__PURE__ */ new Set();
68
- function ge() {
69
- if (typeof window > "u")
70
- return;
71
- let e = (n) => {
72
- let r = G.get(n.target);
73
- r || (r = /* @__PURE__ */ new Set(), G.set(n.target, r), n.target.addEventListener("transitioncancel", t)), r.add(n.propertyName);
74
- }, t = (n) => {
75
- let r = G.get(n.target);
76
- if (!!r && (r.delete(n.propertyName), r.size === 0 && (n.target.removeEventListener("transitioncancel", t), G.delete(n.target)), G.size === 0)) {
77
- for (let s of be)
78
- s();
79
- be.clear();
80
- }
81
- };
82
- document.body.addEventListener("transitionrun", e), document.body.addEventListener("transitionend", t);
83
- }
84
- typeof document < "u" && (document.readyState !== "loading" ? ge() : document.addEventListener("DOMContentLoaded", ge));
85
- const st = typeof window < "u" ? U.useLayoutEffect : () => {
86
- };
87
- let ye = /* @__PURE__ */ new Map();
88
- function at(e, t) {
89
- if (e === t)
90
- return e;
91
- let n = ye.get(e);
92
- if (n)
93
- return n(t), t;
94
- let r = ye.get(t);
95
- return r ? (r(e), e) : t;
96
- }
97
- function it(...e) {
98
- return (...t) => {
99
- for (let n of e)
100
- typeof n == "function" && n(...t);
101
- };
102
- }
103
- function Q(...e) {
104
- let t = {
105
- ...e[0]
106
- };
107
- for (let n = 1; n < e.length; n++) {
108
- let r = e[n];
109
- for (let s in r) {
110
- let l = t[s], u = r[s];
111
- typeof l == "function" && typeof u == "function" && s[0] === "o" && s[1] === "n" && s.charCodeAt(2) >= 65 && s.charCodeAt(2) <= 90 ? t[s] = it(l, u) : (s === "className" || s === "UNSAFE_className") && typeof l == "string" && typeof u == "string" ? t[s] = Me(l, u) : s === "id" && l && u ? t.id = at(l, u) : t[s] = u !== void 0 ? u : l;
112
- }
113
- }
114
- return t;
115
- }
116
- function F(e) {
117
- if (lt())
76
+ ]), et = /* @__PURE__ */ new Set([
77
+ "href",
78
+ "target",
79
+ "rel",
80
+ "download",
81
+ "ping",
82
+ "referrerPolicy"
83
+ ]), tt = /^(data-.*)$/;
84
+ function nt(e, t = {}) {
85
+ let { labelable: n, isLink: o, propNames: s } = t, u = {};
86
+ for (const c in e)
87
+ Object.prototype.hasOwnProperty.call(e, c) && (Qe.has(c) || n && Ze.has(c) || o && et.has(c) || (s == null ? void 0 : s.has(c)) || tt.test(c)) && (u[c] = e[c]);
88
+ return u;
89
+ }
90
+ function _(e) {
91
+ if (rt())
118
92
  e.focus({
119
93
  preventScroll: !0
120
94
  });
121
95
  else {
122
- let t = ct(e);
123
- e.focus(), ut(t);
96
+ let t = ot(e);
97
+ e.focus(), st(t);
124
98
  }
125
99
  }
126
- let q = null;
127
- function lt() {
128
- if (q == null) {
129
- q = !1;
100
+ let X = null;
101
+ function rt() {
102
+ if (X == null) {
103
+ X = !1;
130
104
  try {
131
105
  var e = document.createElement("div");
132
106
  e.focus({
133
107
  get preventScroll() {
134
- return q = !0, !0;
108
+ return X = !0, !0;
135
109
  }
136
110
  });
137
111
  } catch {
138
112
  }
139
113
  }
140
- return q;
114
+ return X;
141
115
  }
142
- function ct(e) {
143
- for (var t = e.parentNode, n = [], r = document.scrollingElement || document.documentElement; t instanceof HTMLElement && t !== r; )
116
+ function ot(e) {
117
+ for (var t = e.parentNode, n = [], o = document.scrollingElement || document.documentElement; t instanceof HTMLElement && t !== o; )
144
118
  (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && n.push({
145
119
  element: t,
146
120
  scrollTop: t.scrollTop,
147
121
  scrollLeft: t.scrollLeft
148
122
  }), t = t.parentNode;
149
- return r instanceof HTMLElement && n.push({
150
- element: r,
151
- scrollTop: r.scrollTop,
152
- scrollLeft: r.scrollLeft
123
+ return o instanceof HTMLElement && n.push({
124
+ element: o,
125
+ scrollTop: o.scrollTop,
126
+ scrollLeft: o.scrollLeft
153
127
  }), n;
154
128
  }
155
- function ut(e) {
156
- for (let { element: t, scrollTop: n, scrollLeft: r } of e)
157
- t.scrollTop = n, t.scrollLeft = r;
129
+ function st(e) {
130
+ for (let { element: t, scrollTop: n, scrollLeft: o } of e)
131
+ t.scrollTop = n, t.scrollLeft = o;
132
+ }
133
+ function ee(e) {
134
+ var t;
135
+ return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent);
136
+ }
137
+ function pe(e) {
138
+ var t;
139
+ return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
140
+ }
141
+ function G() {
142
+ return pe(/^Mac/i);
143
+ }
144
+ function at() {
145
+ return pe(/^iPhone/i);
146
+ }
147
+ function Ce() {
148
+ return pe(/^iPad/i) || G() && navigator.maxTouchPoints > 1;
149
+ }
150
+ function _e() {
151
+ return at() || Ce();
152
+ }
153
+ function it() {
154
+ return ee(/AppleWebKit/i) && !lt();
155
+ }
156
+ function lt() {
157
+ return ee(/Chrome/i);
158
+ }
159
+ function Ke() {
160
+ return ee(/Android/i);
161
+ }
162
+ function ct() {
163
+ return ee(/Firefox/i);
164
+ }
165
+ function W(e, t, n = !0) {
166
+ var o, s;
167
+ let { metaKey: u, ctrlKey: c, altKey: m, shiftKey: p } = t;
168
+ ct() && ((s = window.event) === null || s === void 0 || (o = s.type) === null || o === void 0 ? void 0 : o.startsWith("key")) && e.target === "_blank" && (G() ? u = !0 : c = !0);
169
+ let y = it() && G() && !Ce() ? new KeyboardEvent("keydown", {
170
+ keyIdentifier: "Enter",
171
+ metaKey: u,
172
+ ctrlKey: c,
173
+ altKey: m,
174
+ shiftKey: p
175
+ }) : new MouseEvent("click", {
176
+ metaKey: u,
177
+ ctrlKey: c,
178
+ altKey: m,
179
+ shiftKey: p,
180
+ bubbles: !0,
181
+ cancelable: !0
182
+ });
183
+ W.isOpening = n, _(e), e.dispatchEvent(y), W.isOpening = !1;
158
184
  }
159
- let A = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Set();
160
- function $e() {
185
+ W.isOpening = !1;
186
+ let F = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Set();
187
+ function ve() {
161
188
  if (typeof window > "u")
162
189
  return;
163
190
  let e = (n) => {
164
- let r = A.get(n.target);
165
- r || (r = /* @__PURE__ */ new Set(), A.set(n.target, r), n.target.addEventListener("transitioncancel", t)), r.add(n.propertyName);
191
+ let o = F.get(n.target);
192
+ o || (o = /* @__PURE__ */ new Set(), F.set(n.target, o), n.target.addEventListener("transitioncancel", t)), o.add(n.propertyName);
166
193
  }, t = (n) => {
167
- let r = A.get(n.target);
168
- if (!!r && (r.delete(n.propertyName), r.size === 0 && (n.target.removeEventListener("transitioncancel", t), A.delete(n.target)), A.size === 0)) {
169
- for (let s of te)
194
+ let o = F.get(n.target);
195
+ if (!!o && (o.delete(n.propertyName), o.size === 0 && (n.target.removeEventListener("transitioncancel", t), F.delete(n.target)), F.size === 0)) {
196
+ for (let s of se)
170
197
  s();
171
- te.clear();
198
+ se.clear();
172
199
  }
173
200
  };
174
201
  document.body.addEventListener("transitionrun", e), document.body.addEventListener("transitionend", t);
175
202
  }
176
- typeof document < "u" && (document.readyState !== "loading" ? $e() : document.addEventListener("DOMContentLoaded", $e));
177
- function Ae(e) {
203
+ typeof document < "u" && (document.readyState !== "loading" ? ve() : document.addEventListener("DOMContentLoaded", ve));
204
+ function Le(e) {
178
205
  requestAnimationFrame(() => {
179
- A.size === 0 ? e() : te.add(e);
206
+ F.size === 0 ? e() : se.add(e);
180
207
  });
181
208
  }
182
- function dt() {
183
- let e = W(/* @__PURE__ */ new Map()), t = R((s, l, u, p) => {
184
- let f = p != null && p.once ? (...b) => {
185
- e.current.delete(u), u(...b);
186
- } : u;
187
- e.current.set(u, {
188
- type: l,
209
+ function ut() {
210
+ let e = H(/* @__PURE__ */ new Map()), t = K((s, u, c, m) => {
211
+ let p = m != null && m.once ? (...y) => {
212
+ e.current.delete(c), c(...y);
213
+ } : c;
214
+ e.current.set(c, {
215
+ type: u,
189
216
  eventTarget: s,
190
- fn: f,
191
- options: p
192
- }), s.addEventListener(l, u, p);
193
- }, []), n = R((s, l, u, p) => {
194
- var f;
195
- let b = ((f = e.current.get(u)) === null || f === void 0 ? void 0 : f.fn) || u;
196
- s.removeEventListener(l, b, p), e.current.delete(u);
197
- }, []), r = R(() => {
198
- e.current.forEach((s, l) => {
199
- n(s.eventTarget, s.type, l, s.options);
217
+ fn: p,
218
+ options: m
219
+ }), s.addEventListener(u, c, m);
220
+ }, []), n = K((s, u, c, m) => {
221
+ var p;
222
+ let y = ((p = e.current.get(c)) === null || p === void 0 ? void 0 : p.fn) || c;
223
+ s.removeEventListener(u, y, m), e.current.delete(c);
224
+ }, []), o = K(() => {
225
+ e.current.forEach((s, u) => {
226
+ n(s.eventTarget, s.type, u, s.options);
200
227
  });
201
228
  }, [
202
229
  n
203
230
  ]);
204
- return ie(() => r, [
205
- r
231
+ return ue(() => o, [
232
+ o
206
233
  ]), {
207
234
  addGlobalListener: t,
208
235
  removeGlobalListener: n,
209
- removeAllGlobalListeners: r
236
+ removeAllGlobalListeners: o
210
237
  };
211
238
  }
212
- function Fe(e, t) {
213
- st(() => {
239
+ function Ie(e, t) {
240
+ de(() => {
214
241
  if (e && e.ref && t)
215
242
  return e.ref.current = t.current, () => {
216
243
  e.ref.current = null;
217
244
  };
245
+ });
246
+ }
247
+ function ae(e) {
248
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : Ke() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
249
+ }
250
+ function dt(e) {
251
+ return !Ke() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
252
+ }
253
+ function pt(e, t) {
254
+ return t.get ? t.get.call(e) : t.value;
255
+ }
256
+ function Ae(e, t, n) {
257
+ if (!t.has(e))
258
+ throw new TypeError("attempted to " + n + " private field on non-instance");
259
+ return t.get(e);
260
+ }
261
+ function ft(e, t) {
262
+ var n = Ae(e, t, "get");
263
+ return pt(e, n);
264
+ }
265
+ function mt(e, t) {
266
+ if (t.has(e))
267
+ throw new TypeError("Cannot initialize the same private elements twice on an object");
268
+ }
269
+ function bt(e, t, n) {
270
+ mt(e, t), t.set(e, n);
271
+ }
272
+ function gt(e, t, n) {
273
+ if (t.set)
274
+ t.set.call(e, n);
275
+ else {
276
+ if (!t.writable)
277
+ throw new TypeError("attempted to set read only private field");
278
+ t.value = n;
279
+ }
280
+ }
281
+ function ye(e, t, n) {
282
+ var o = Ae(e, t, "set");
283
+ return gt(e, o, n), n;
284
+ }
285
+ let R = "default", ie = "", Z = /* @__PURE__ */ new WeakMap();
286
+ function he(e) {
287
+ if (_e()) {
288
+ if (R === "default") {
289
+ const t = N(e);
290
+ ie = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
291
+ }
292
+ R = "disabled";
293
+ } else
294
+ (e instanceof HTMLElement || e instanceof SVGElement) && (Z.set(e, e.style.userSelect), e.style.userSelect = "none");
295
+ }
296
+ function q(e) {
297
+ if (_e()) {
298
+ if (R !== "disabled")
299
+ return;
300
+ R = "restoring", setTimeout(() => {
301
+ Le(() => {
302
+ if (R === "restoring") {
303
+ const t = N(e);
304
+ t.documentElement.style.webkitUserSelect === "none" && (t.documentElement.style.webkitUserSelect = ie || ""), ie = "", R = "default";
305
+ }
306
+ });
307
+ }, 300);
308
+ } else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && Z.has(e)) {
309
+ let t = Z.get(e);
310
+ e.style.userSelect === "none" && t && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), Z.delete(e);
311
+ }
312
+ }
313
+ const Me = ce.createContext({
314
+ register: () => {
315
+ }
316
+ });
317
+ Me.displayName = "PressResponderContext";
318
+ function vt(e) {
319
+ let t = De(Me);
320
+ if (t) {
321
+ let { register: n, ...o } = t;
322
+ e = U(o, e), n();
323
+ }
324
+ return Ie(t, e.ref), e;
325
+ }
326
+ var J = /* @__PURE__ */ new WeakMap();
327
+ class Q {
328
+ continuePropagation() {
329
+ ye(this, J, !1);
330
+ }
331
+ get shouldStopPropagation() {
332
+ return ft(this, J);
333
+ }
334
+ constructor(t, n, o) {
335
+ bt(this, J, {
336
+ writable: !0,
337
+ value: void 0
338
+ }), ye(this, J, !0), this.type = t, this.pointerType = n, this.target = o.currentTarget, this.shiftKey = o.shiftKey, this.metaKey = o.metaKey, this.ctrlKey = o.ctrlKey, this.altKey = o.altKey;
339
+ }
340
+ }
341
+ const $e = Symbol("linkClicked");
342
+ function yt(e) {
343
+ let {
344
+ onPress: t,
345
+ onPressChange: n,
346
+ onPressStart: o,
347
+ onPressEnd: s,
348
+ onPressUp: u,
349
+ isDisabled: c,
350
+ isPressed: m,
351
+ preventFocusOnPress: p,
352
+ shouldCancelOnPointerExit: y,
353
+ allowTextSelectionOnPress: $,
354
+ ref: D,
355
+ ...O
356
+ } = vt(e), [V, C] = Ve(!1), T = H({
357
+ isPressed: !1,
358
+ ignoreEmulatedMouseEvents: !1,
359
+ ignoreClickAfterPress: !1,
360
+ didFirePressStart: !1,
361
+ isTriggeringEvent: !1,
362
+ activePointerId: null,
363
+ target: null,
364
+ isOverTarget: !1,
365
+ pointerType: null
366
+ }), { addGlobalListener: w, removeAllGlobalListeners: x } = ut(), k = M((r, f) => {
367
+ let E = T.current;
368
+ if (c || E.didFirePressStart)
369
+ return !1;
370
+ let l = !0;
371
+ if (E.isTriggeringEvent = !0, o) {
372
+ let b = new Q("pressstart", f, r);
373
+ o(b), l = b.shouldStopPropagation;
374
+ }
375
+ return n && n(!0), E.isTriggeringEvent = !1, E.didFirePressStart = !0, C(!0), l;
376
+ }), v = M((r, f, E = !0) => {
377
+ let l = T.current;
378
+ if (!l.didFirePressStart)
379
+ return !1;
380
+ l.ignoreClickAfterPress = !0, l.didFirePressStart = !1, l.isTriggeringEvent = !0;
381
+ let b = !0;
382
+ if (s) {
383
+ let a = new Q("pressend", f, r);
384
+ s(a), b = a.shouldStopPropagation;
385
+ }
386
+ if (n && n(!1), C(!1), t && E && !c) {
387
+ let a = new Q("press", f, r);
388
+ t(a), b && (b = a.shouldStopPropagation);
389
+ }
390
+ return l.isTriggeringEvent = !1, b;
391
+ }), P = M((r, f) => {
392
+ let E = T.current;
393
+ if (c)
394
+ return !1;
395
+ if (u) {
396
+ E.isTriggeringEvent = !0;
397
+ let l = new Q("pressup", f, r);
398
+ return u(l), E.isTriggeringEvent = !1, l.shouldStopPropagation;
399
+ }
400
+ return !0;
401
+ }), B = M((r) => {
402
+ let f = T.current;
403
+ f.isPressed && f.target && (f.isOverTarget && f.pointerType != null && v(S(f.target, r), f.pointerType, !1), f.isPressed = !1, f.isOverTarget = !1, f.activePointerId = null, f.pointerType = null, x(), $ || q(f.target));
404
+ }), Y = M((r) => {
405
+ y && B(r);
406
+ }), Ue = Ge(() => {
407
+ let r = T.current, f = {
408
+ onKeyDown(l) {
409
+ if (ne(l.nativeEvent, l.currentTarget) && l.currentTarget.contains(l.target)) {
410
+ var b;
411
+ we(l.target, l.key) && l.preventDefault();
412
+ let a = !0;
413
+ !r.isPressed && !l.repeat && (r.target = l.currentTarget, r.isPressed = !0, a = k(l, "keyboard"), w(N(l.currentTarget), "keyup", E, !1)), a && l.stopPropagation(), l.metaKey && G() && ((b = r.metaKeyEvents) === null || b === void 0 || b.set(l.key, l.nativeEvent));
414
+ } else
415
+ l.key === "Meta" && (r.metaKeyEvents = /* @__PURE__ */ new Map());
416
+ },
417
+ onKeyUp(l) {
418
+ ne(l.nativeEvent, l.currentTarget) && !l.repeat && l.currentTarget.contains(l.target) && r.target && P(S(r.target, l), "keyboard");
419
+ },
420
+ onClick(l) {
421
+ if (!(l && !l.currentTarget.contains(l.target)) && l && l.button === 0 && !r.isTriggeringEvent && !W.isOpening) {
422
+ let b = !0;
423
+ if (c && l.preventDefault(), !r.ignoreClickAfterPress && !r.ignoreEmulatedMouseEvents && !r.isPressed && (r.pointerType === "virtual" || ae(l.nativeEvent))) {
424
+ !c && !p && _(l.currentTarget);
425
+ let a = k(l, "virtual"), i = P(l, "virtual"), h = v(l, "virtual");
426
+ b = a && i && h;
427
+ }
428
+ r.ignoreEmulatedMouseEvents = !1, r.ignoreClickAfterPress = !1, b && l.stopPropagation();
429
+ }
430
+ }
431
+ }, E = (l) => {
432
+ var b;
433
+ if (r.isPressed && r.target && ne(l, r.target)) {
434
+ var a;
435
+ we(l.target, l.key) && l.preventDefault();
436
+ let h = l.target, te = v(S(r.target, l), "keyboard", r.target.contains(h));
437
+ x(), te && l.stopPropagation(), l.key !== "Enter" && fe(r.target) && r.target.contains(h) && !l[$e] && (l[$e] = !0, W(r.target, l, !1)), r.isPressed = !1, (a = r.metaKeyEvents) === null || a === void 0 || a.delete(l.key);
438
+ } else if (l.key === "Meta" && ((b = r.metaKeyEvents) === null || b === void 0 ? void 0 : b.size)) {
439
+ var i;
440
+ let h = r.metaKeyEvents;
441
+ r.metaKeyEvents = void 0;
442
+ for (let te of h.values())
443
+ (i = r.target) === null || i === void 0 || i.dispatchEvent(new KeyboardEvent("keyup", te));
444
+ }
445
+ };
446
+ if (typeof PointerEvent < "u") {
447
+ f.onPointerDown = (i) => {
448
+ if (i.button !== 0 || !i.currentTarget.contains(i.target))
449
+ return;
450
+ if (dt(i.nativeEvent)) {
451
+ r.pointerType = "virtual";
452
+ return;
453
+ }
454
+ re(i.currentTarget) && i.preventDefault(), r.pointerType = i.pointerType;
455
+ let h = !0;
456
+ r.isPressed || (r.isPressed = !0, r.isOverTarget = !0, r.activePointerId = i.pointerId, r.target = i.currentTarget, !c && !p && _(i.currentTarget), $ || he(r.target), h = k(i, r.pointerType), w(N(i.currentTarget), "pointermove", l, !1), w(N(i.currentTarget), "pointerup", b, !1), w(N(i.currentTarget), "pointercancel", a, !1)), h && i.stopPropagation();
457
+ }, f.onMouseDown = (i) => {
458
+ !i.currentTarget.contains(i.target) || i.button === 0 && (re(i.currentTarget) && i.preventDefault(), i.stopPropagation());
459
+ }, f.onPointerUp = (i) => {
460
+ !i.currentTarget.contains(i.target) || r.pointerType === "virtual" || i.button === 0 && I(i, i.currentTarget) && P(i, r.pointerType || i.pointerType);
461
+ };
462
+ let l = (i) => {
463
+ i.pointerId === r.activePointerId && (r.target && I(i, r.target) ? !r.isOverTarget && r.pointerType != null && (r.isOverTarget = !0, k(S(r.target, i), r.pointerType)) : r.target && r.isOverTarget && r.pointerType != null && (r.isOverTarget = !1, v(S(r.target, i), r.pointerType, !1), Y(i)));
464
+ }, b = (i) => {
465
+ i.pointerId === r.activePointerId && r.isPressed && i.button === 0 && r.target && (I(i, r.target) && r.pointerType != null ? v(S(r.target, i), r.pointerType) : r.isOverTarget && r.pointerType != null && v(S(r.target, i), r.pointerType, !1), r.isPressed = !1, r.isOverTarget = !1, r.activePointerId = null, r.pointerType = null, x(), $ || q(r.target));
466
+ }, a = (i) => {
467
+ B(i);
468
+ };
469
+ f.onDragStart = (i) => {
470
+ !i.currentTarget.contains(i.target) || B(i);
471
+ };
472
+ } else {
473
+ f.onMouseDown = (a) => {
474
+ if (a.button !== 0 || !a.currentTarget.contains(a.target))
475
+ return;
476
+ if (re(a.currentTarget) && a.preventDefault(), r.ignoreEmulatedMouseEvents) {
477
+ a.stopPropagation();
478
+ return;
479
+ }
480
+ r.isPressed = !0, r.isOverTarget = !0, r.target = a.currentTarget, r.pointerType = ae(a.nativeEvent) ? "virtual" : "mouse", !c && !p && _(a.currentTarget), k(a, r.pointerType) && a.stopPropagation(), w(N(a.currentTarget), "mouseup", l, !1);
481
+ }, f.onMouseEnter = (a) => {
482
+ if (!a.currentTarget.contains(a.target))
483
+ return;
484
+ let i = !0;
485
+ r.isPressed && !r.ignoreEmulatedMouseEvents && r.pointerType != null && (r.isOverTarget = !0, i = k(a, r.pointerType)), i && a.stopPropagation();
486
+ }, f.onMouseLeave = (a) => {
487
+ if (!a.currentTarget.contains(a.target))
488
+ return;
489
+ let i = !0;
490
+ r.isPressed && !r.ignoreEmulatedMouseEvents && r.pointerType != null && (r.isOverTarget = !1, i = v(a, r.pointerType, !1), Y(a)), i && a.stopPropagation();
491
+ }, f.onMouseUp = (a) => {
492
+ !a.currentTarget.contains(a.target) || !r.ignoreEmulatedMouseEvents && a.button === 0 && P(a, r.pointerType || "mouse");
493
+ };
494
+ let l = (a) => {
495
+ if (a.button === 0) {
496
+ if (r.isPressed = !1, x(), r.ignoreEmulatedMouseEvents) {
497
+ r.ignoreEmulatedMouseEvents = !1;
498
+ return;
499
+ }
500
+ r.target && I(a, r.target) && r.pointerType != null ? v(S(r.target, a), r.pointerType) : r.target && r.isOverTarget && r.pointerType != null && v(S(r.target, a), r.pointerType, !1), r.isOverTarget = !1;
501
+ }
502
+ };
503
+ f.onTouchStart = (a) => {
504
+ if (!a.currentTarget.contains(a.target))
505
+ return;
506
+ let i = ht(a.nativeEvent);
507
+ if (!i)
508
+ return;
509
+ r.activePointerId = i.identifier, r.ignoreEmulatedMouseEvents = !0, r.isOverTarget = !0, r.isPressed = !0, r.target = a.currentTarget, r.pointerType = "touch", !c && !p && _(a.currentTarget), $ || he(r.target), k(a, r.pointerType) && a.stopPropagation(), w(oe(a.currentTarget), "scroll", b, !0);
510
+ }, f.onTouchMove = (a) => {
511
+ if (!a.currentTarget.contains(a.target))
512
+ return;
513
+ if (!r.isPressed) {
514
+ a.stopPropagation();
515
+ return;
516
+ }
517
+ let i = ke(a.nativeEvent, r.activePointerId), h = !0;
518
+ i && I(i, a.currentTarget) ? !r.isOverTarget && r.pointerType != null && (r.isOverTarget = !0, h = k(a, r.pointerType)) : r.isOverTarget && r.pointerType != null && (r.isOverTarget = !1, h = v(a, r.pointerType, !1), Y(a)), h && a.stopPropagation();
519
+ }, f.onTouchEnd = (a) => {
520
+ if (!a.currentTarget.contains(a.target))
521
+ return;
522
+ if (!r.isPressed) {
523
+ a.stopPropagation();
524
+ return;
525
+ }
526
+ let i = ke(a.nativeEvent, r.activePointerId), h = !0;
527
+ i && I(i, a.currentTarget) && r.pointerType != null ? (P(a, r.pointerType), h = v(a, r.pointerType)) : r.isOverTarget && r.pointerType != null && (h = v(a, r.pointerType, !1)), h && a.stopPropagation(), r.isPressed = !1, r.activePointerId = null, r.isOverTarget = !1, r.ignoreEmulatedMouseEvents = !0, r.target && !$ && q(r.target), x();
528
+ }, f.onTouchCancel = (a) => {
529
+ !a.currentTarget.contains(a.target) || (a.stopPropagation(), r.isPressed && B(a));
530
+ };
531
+ let b = (a) => {
532
+ r.isPressed && a.target.contains(r.target) && B({
533
+ currentTarget: r.target,
534
+ shiftKey: !1,
535
+ ctrlKey: !1,
536
+ metaKey: !1,
537
+ altKey: !1
538
+ });
539
+ };
540
+ f.onDragStart = (a) => {
541
+ !a.currentTarget.contains(a.target) || B(a);
542
+ };
543
+ }
544
+ return f;
218
545
  }, [
219
- e,
220
- t
546
+ w,
547
+ c,
548
+ p,
549
+ x,
550
+ $,
551
+ B,
552
+ Y,
553
+ v,
554
+ k,
555
+ P
221
556
  ]);
557
+ return ue(() => () => {
558
+ var r;
559
+ $ || q((r = T.current.target) !== null && r !== void 0 ? r : void 0);
560
+ }, [
561
+ $
562
+ ]), {
563
+ isPressed: m || V,
564
+ pressProps: U(O, Ue)
565
+ };
222
566
  }
223
- function le(e) {
224
- var t;
225
- return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
567
+ function fe(e) {
568
+ return e.tagName === "A" && e.hasAttribute("href");
226
569
  }
227
- function _e() {
228
- return le(/^Mac/i);
570
+ function ne(e, t) {
571
+ const { key: n, code: o } = e, s = t, u = s.getAttribute("role");
572
+ return (n === "Enter" || n === " " || n === "Spacebar" || o === "Space") && !(s instanceof oe(s).HTMLInputElement && !Fe(s, n) || s instanceof oe(s).HTMLTextAreaElement || s.isContentEditable) && !((u === "link" || !u && fe(s)) && n !== "Enter");
229
573
  }
230
- function ft() {
231
- return le(/^iPhone/i);
574
+ function ht(e) {
575
+ const { targetTouches: t } = e;
576
+ return t.length > 0 ? t[0] : null;
232
577
  }
233
- function pt() {
234
- return le(/^iPad/i) || _e() && navigator.maxTouchPoints > 1;
578
+ function ke(e, t) {
579
+ const n = e.changedTouches;
580
+ for (let o = 0; o < n.length; o++) {
581
+ const s = n[o];
582
+ if (s.identifier === t)
583
+ return s;
584
+ }
585
+ return null;
235
586
  }
236
- function Re() {
237
- return ft() || pt();
587
+ function S(e, t) {
588
+ return {
589
+ currentTarget: e,
590
+ shiftKey: t.shiftKey,
591
+ ctrlKey: t.ctrlKey,
592
+ metaKey: t.metaKey,
593
+ altKey: t.altKey
594
+ };
238
595
  }
239
- const mt = typeof window < "u" ? U.useLayoutEffect : () => {
240
- };
241
- let H = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Set();
242
- function he() {
243
- if (typeof window > "u")
244
- return;
245
- let e = (n) => {
246
- let r = H.get(n.target);
247
- r || (r = /* @__PURE__ */ new Set(), H.set(n.target, r), n.target.addEventListener("transitioncancel", t)), r.add(n.propertyName);
248
- }, t = (n) => {
249
- let r = H.get(n.target);
250
- if (!!r && (r.delete(n.propertyName), r.size === 0 && (n.target.removeEventListener("transitioncancel", t), H.delete(n.target)), H.size === 0)) {
251
- for (let s of ve)
252
- s();
253
- ve.clear();
254
- }
596
+ function $t(e) {
597
+ let t = 0, n = 0;
598
+ return e.width !== void 0 ? t = e.width / 2 : e.radiusX !== void 0 && (t = e.radiusX), e.height !== void 0 ? n = e.height / 2 : e.radiusY !== void 0 && (n = e.radiusY), {
599
+ top: e.clientY - n,
600
+ right: e.clientX + t,
601
+ bottom: e.clientY + n,
602
+ left: e.clientX - t
255
603
  };
256
- document.body.addEventListener("transitionrun", e), document.body.addEventListener("transitionend", t);
257
604
  }
258
- typeof document < "u" && (document.readyState !== "loading" ? he() : document.addEventListener("DOMContentLoaded", he));
259
- function bt(e) {
260
- var t;
261
- return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent);
605
+ function kt(e, t) {
606
+ return !(e.left > t.right || t.left > e.right || e.top > t.bottom || t.top > e.bottom);
262
607
  }
263
- function gt(e) {
264
- var t;
265
- return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
608
+ function I(e, t) {
609
+ let n = t.getBoundingClientRect(), o = $t(e);
610
+ return kt(n, o);
266
611
  }
267
- function yt() {
268
- return gt(/^Mac/i);
612
+ function re(e) {
613
+ return !(e instanceof HTMLElement) || !e.hasAttribute("draggable");
269
614
  }
270
- function $t() {
271
- return bt(/Android/i);
615
+ function we(e, t) {
616
+ return e instanceof HTMLInputElement ? !Fe(e, t) : e instanceof HTMLButtonElement ? e.type !== "submit" && e.type !== "reset" : !fe(e);
272
617
  }
273
- function vt(e) {
274
- return e.mozInputSource === 0 && e.isTrusted ? !0 : $t() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
618
+ const wt = /* @__PURE__ */ new Set([
619
+ "checkbox",
620
+ "radio",
621
+ "range",
622
+ "color",
623
+ "file",
624
+ "image",
625
+ "button",
626
+ "submit",
627
+ "reset"
628
+ ]);
629
+ function Fe(e, t) {
630
+ return e.type === "checkbox" || e.type === "radio" ? t === " " : wt.has(e.type);
275
631
  }
276
- const ht = U.createContext(null);
277
- ht.displayName = "PressResponderContext";
278
- class kt {
632
+ class Tt {
279
633
  isDefaultPrevented() {
280
634
  return this.nativeEvent.defaultPrevented;
281
635
  }
@@ -294,94 +648,106 @@ class kt {
294
648
  this.nativeEvent = n, this.target = n.target, this.currentTarget = n.currentTarget, this.relatedTarget = n.relatedTarget, this.bubbles = n.bubbles, this.cancelable = n.cancelable, this.defaultPrevented = n.defaultPrevented, this.eventPhase = n.eventPhase, this.isTrusted = n.isTrusted, this.timeStamp = n.timeStamp, this.type = t;
295
649
  }
296
650
  }
297
- function wt(e) {
298
- let t = W({
651
+ function Bt(e) {
652
+ let t = H({
299
653
  isFocused: !1,
300
- onBlur: e,
301
654
  observer: null
302
655
  });
303
- return t.current.onBlur = e, mt(() => {
304
- const n = t.current;
656
+ de(() => {
657
+ const o = t.current;
305
658
  return () => {
306
- n.observer && (n.observer.disconnect(), n.observer = null);
659
+ o.observer && (o.observer.disconnect(), o.observer = null);
307
660
  };
308
- }, []), R((n) => {
309
- if (n.target instanceof HTMLButtonElement || n.target instanceof HTMLInputElement || n.target instanceof HTMLTextAreaElement || n.target instanceof HTMLSelectElement) {
661
+ }, []);
662
+ let n = M((o) => {
663
+ e == null || e(o);
664
+ });
665
+ return K((o) => {
666
+ if (o.target instanceof HTMLButtonElement || o.target instanceof HTMLInputElement || o.target instanceof HTMLTextAreaElement || o.target instanceof HTMLSelectElement) {
310
667
  t.current.isFocused = !0;
311
- let r = n.target, s = (l) => {
312
- var u, p;
313
- t.current.isFocused = !1, r.disabled && ((p = (u = t.current).onBlur) === null || p === void 0 || p.call(u, new kt("blur", l))), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
668
+ let s = o.target, u = (c) => {
669
+ t.current.isFocused = !1, s.disabled && n(new Tt("blur", c)), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
314
670
  };
315
- r.addEventListener("focusout", s, {
671
+ s.addEventListener("focusout", u, {
316
672
  once: !0
317
673
  }), t.current.observer = new MutationObserver(() => {
318
- t.current.isFocused && r.disabled && (t.current.observer.disconnect(), r.dispatchEvent(new FocusEvent("blur")), r.dispatchEvent(new FocusEvent("focusout", {
319
- bubbles: !0
320
- })));
321
- }), t.current.observer.observe(r, {
674
+ if (t.current.isFocused && s.disabled) {
675
+ var c;
676
+ (c = t.current.observer) === null || c === void 0 || c.disconnect();
677
+ let m = s === document.activeElement ? null : document.activeElement;
678
+ s.dispatchEvent(new FocusEvent("blur", {
679
+ relatedTarget: m
680
+ })), s.dispatchEvent(new FocusEvent("focusout", {
681
+ bubbles: !0,
682
+ relatedTarget: m
683
+ }));
684
+ }
685
+ }), t.current.observer.observe(s, {
322
686
  attributes: !0,
323
687
  attributeFilter: [
324
688
  "disabled"
325
689
  ]
326
690
  });
327
691
  }
328
- }, []);
692
+ }, [
693
+ n
694
+ ]);
329
695
  }
330
- function Bt(e) {
331
- let { isDisabled: t, onFocus: n, onBlur: r, onFocusChange: s } = e;
332
- const l = R((f) => {
333
- if (f.target === f.currentTarget)
334
- return r && r(f), s && s(!1), !0;
696
+ function Pt(e) {
697
+ let { isDisabled: t, onFocus: n, onBlur: o, onFocusChange: s } = e;
698
+ const u = K((p) => {
699
+ if (p.target === p.currentTarget)
700
+ return o && o(p), s && s(!1), !0;
335
701
  }, [
336
- r,
702
+ o,
337
703
  s
338
- ]), u = wt(l), p = R((f) => {
339
- f.target === f.currentTarget && (n && n(f), s && s(!0), u(f));
704
+ ]), c = Bt(u), m = K((p) => {
705
+ p.target === p.currentTarget && document.activeElement === p.target && (n && n(p), s && s(!0), c(p));
340
706
  }, [
341
707
  s,
342
708
  n,
343
- u
709
+ c
344
710
  ]);
345
711
  return {
346
712
  focusProps: {
347
- onFocus: !t && (n || s || r) ? p : void 0,
348
- onBlur: !t && (r || s) ? l : null
713
+ onFocus: !t && (n || s || o) ? m : void 0,
714
+ onBlur: !t && (o || s) ? u : void 0
349
715
  }
350
716
  };
351
717
  }
352
- let j = null, Et = /* @__PURE__ */ new Set(), ke = !1, D = !1, ne = !1;
353
- function ce(e, t) {
718
+ let j = null, Et = /* @__PURE__ */ new Set(), Te = !1, L = !1, le = !1;
719
+ function me(e, t) {
354
720
  for (let n of Et)
355
721
  n(e, t);
356
722
  }
357
- function Pt(e) {
358
- return !(e.metaKey || !yt() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
723
+ function xt(e) {
724
+ return !(e.metaKey || !G() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
359
725
  }
360
- function we(e) {
361
- D = !0, Pt(e) && (j = "keyboard", ce("keyboard", e));
726
+ function Be(e) {
727
+ L = !0, xt(e) && (j = "keyboard", me("keyboard", e));
362
728
  }
363
- function K(e) {
364
- j = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (D = !0, ce("pointer", e));
729
+ function A(e) {
730
+ j = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (L = !0, me("pointer", e));
365
731
  }
366
- function Tt(e) {
367
- vt(e) && (D = !0, j = "virtual");
732
+ function St(e) {
733
+ ae(e) && (L = !0, j = "virtual");
368
734
  }
369
- function xt(e) {
370
- e.target === window || e.target === document || (!D && !ne && (j = "virtual", ce("virtual", e)), D = !1, ne = !1);
735
+ function Nt(e) {
736
+ e.target === window || e.target === document || (!L && !le && (j = "virtual", me("virtual", e)), L = !1, le = !1);
371
737
  }
372
- function St() {
373
- D = !1, ne = !0;
738
+ function Dt() {
739
+ L = !1, le = !0;
374
740
  }
375
- function Be() {
376
- if (typeof window > "u" || ke)
741
+ function Pe() {
742
+ if (typeof window > "u" || Te)
377
743
  return;
378
744
  let e = HTMLElement.prototype.focus;
379
745
  HTMLElement.prototype.focus = function() {
380
- D = !0, e.apply(this, arguments);
381
- }, document.addEventListener("keydown", we, !0), document.addEventListener("keyup", we, !0), document.addEventListener("click", Tt, !0), window.addEventListener("focus", xt, !0), window.addEventListener("blur", St, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", K, !0), document.addEventListener("pointermove", K, !0), document.addEventListener("pointerup", K, !0)) : (document.addEventListener("mousedown", K, !0), document.addEventListener("mousemove", K, !0), document.addEventListener("mouseup", K, !0)), ke = !0;
746
+ L = !0, e.apply(this, arguments);
747
+ }, document.addEventListener("keydown", Be, !0), document.addEventListener("keyup", Be, !0), document.addEventListener("click", St, !0), window.addEventListener("focus", Nt, !0), window.addEventListener("blur", Dt, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", A, !0), document.addEventListener("pointermove", A, !0), document.addEventListener("pointerup", A, !0)) : (document.addEventListener("mousedown", A, !0), document.addEventListener("mousemove", A, !0), document.addEventListener("mouseup", A, !0)), Te = !0;
382
748
  }
383
- typeof document < "u" && (document.readyState !== "loading" ? Be() : document.addEventListener("DOMContentLoaded", Be));
384
- function Nt() {
749
+ typeof document < "u" && (document.readyState !== "loading" ? Pe() : document.addEventListener("DOMContentLoaded", Pe));
750
+ function Ot() {
385
751
  return j;
386
752
  }
387
753
  function Ee(e) {
@@ -389,7 +755,7 @@ function Ee(e) {
389
755
  return;
390
756
  let t = !0;
391
757
  return (n) => {
392
- let r = {
758
+ let o = {
393
759
  ...n,
394
760
  preventDefault() {
395
761
  n.preventDefault();
@@ -404,10 +770,10 @@ function Ee(e) {
404
770
  t = !1;
405
771
  }
406
772
  };
407
- e(r), t && n.stopPropagation();
773
+ e(o), t && n.stopPropagation();
408
774
  };
409
775
  }
410
- function Dt(e) {
776
+ function Ct(e) {
411
777
  return {
412
778
  keyboardProps: e.isDisabled ? {} : {
413
779
  onKeyDown: Ee(e.onKeyDown),
@@ -415,466 +781,158 @@ function Dt(e) {
415
781
  }
416
782
  };
417
783
  }
418
- function Ct(e) {
419
- if (Nt() === "virtual") {
784
+ function _t(e) {
785
+ if (Ot() === "virtual") {
420
786
  let t = document.activeElement;
421
- Ae(() => {
422
- document.activeElement === t && document.contains(e) && F(e);
787
+ Le(() => {
788
+ document.activeElement === t && document.contains(e) && _(e);
423
789
  });
424
790
  } else
425
- F(e);
791
+ _(e);
426
792
  }
427
- function Ot(e, t) {
428
- return t.some(
429
- (n) => n.contains(e)
430
- );
793
+ function Kt(e, t) {
794
+ return !e || !t ? !1 : t.some((n) => n.contains(e));
431
795
  }
432
- class ue {
796
+ class be {
433
797
  get size() {
434
798
  return this.fastMap.size;
435
799
  }
436
800
  getTreeNode(t) {
437
801
  return this.fastMap.get(t);
438
802
  }
439
- addTreeNode(t, n, r) {
440
- let s = this.fastMap.get(n != null ? n : null), l = new Pe({
803
+ addTreeNode(t, n, o) {
804
+ let s = this.fastMap.get(n != null ? n : null);
805
+ if (!s)
806
+ return;
807
+ let u = new xe({
441
808
  scopeRef: t
442
809
  });
443
- s.addChild(l), l.parent = s, this.fastMap.set(t, l), r && (l.nodeToRestore = r);
810
+ s.addChild(u), u.parent = s, this.fastMap.set(t, u), o && (u.nodeToRestore = o);
811
+ }
812
+ addNode(t) {
813
+ this.fastMap.set(t.scopeRef, t);
444
814
  }
445
815
  removeTreeNode(t) {
446
816
  if (t === null)
447
817
  return;
448
- let n = this.fastMap.get(t), r = n.parent;
449
- for (let l of this.traverse())
450
- l !== n && n.nodeToRestore && l.nodeToRestore && n.scopeRef.current && Ot(l.nodeToRestore, n.scopeRef.current) && (l.nodeToRestore = n.nodeToRestore);
818
+ let n = this.fastMap.get(t);
819
+ if (!n)
820
+ return;
821
+ let o = n.parent;
822
+ for (let u of this.traverse())
823
+ u !== n && n.nodeToRestore && u.nodeToRestore && n.scopeRef && n.scopeRef.current && Kt(u.nodeToRestore, n.scopeRef.current) && (u.nodeToRestore = n.nodeToRestore);
451
824
  let s = n.children;
452
- r.removeChild(n), s.length > 0 && s.forEach(
453
- (l) => r.addChild(l)
454
- ), this.fastMap.delete(n.scopeRef);
825
+ o && (o.removeChild(n), s.size > 0 && s.forEach((u) => o && o.addChild(u))), this.fastMap.delete(n.scopeRef);
455
826
  }
456
827
  *traverse(t = this.root) {
457
- if (t.scopeRef != null && (yield t), t.children.length > 0)
828
+ if (t.scopeRef != null && (yield t), t.children.size > 0)
458
829
  for (let n of t.children)
459
830
  yield* this.traverse(n);
460
831
  }
461
832
  clone() {
462
- let t = new ue();
463
- for (let n of this.traverse())
464
- t.addTreeNode(n.scopeRef, n.parent.scopeRef, n.nodeToRestore);
465
- return t;
833
+ var t;
834
+ let n = new be();
835
+ var o;
836
+ for (let s of this.traverse())
837
+ n.addTreeNode(s.scopeRef, (o = (t = s.parent) === null || t === void 0 ? void 0 : t.scopeRef) !== null && o !== void 0 ? o : null, s.nodeToRestore);
838
+ return n;
466
839
  }
467
840
  constructor() {
468
- this.fastMap = /* @__PURE__ */ new Map(), this.root = new Pe({
841
+ this.fastMap = /* @__PURE__ */ new Map(), this.root = new xe({
469
842
  scopeRef: null
470
843
  }), this.fastMap.set(null, this.root);
471
844
  }
472
845
  }
473
- class Pe {
846
+ class xe {
474
847
  addChild(t) {
475
- this.children.push(t), t.parent = this;
848
+ this.children.add(t), t.parent = this;
476
849
  }
477
850
  removeChild(t) {
478
- this.children.splice(this.children.indexOf(t), 1), t.parent = void 0;
851
+ this.children.delete(t), t.parent = void 0;
479
852
  }
480
853
  constructor(t) {
481
- this.children = [], this.contain = !1, this.scopeRef = t.scopeRef;
854
+ this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = t.scopeRef;
482
855
  }
483
856
  }
484
- new ue();
485
- let Lt = /* @__PURE__ */ U.createContext(null);
486
- function Kt(e) {
487
- let t = Ke(Lt) || {};
488
- Fe(t, e);
489
- let { ref: n, ...r } = t;
490
- return r;
491
- }
492
- function It(e, t) {
493
- let { focusProps: n } = Bt(e), { keyboardProps: r } = Dt(e), s = Q(n, r), l = Kt(t), u = e.isDisabled ? {} : l, p = W(e.autoFocus);
494
- return ie(() => {
495
- p.current && t.current && Ct(t.current), p.current = !1;
857
+ new be();
858
+ let Lt = /* @__PURE__ */ ce.createContext(null);
859
+ function It(e) {
860
+ let t = De(Lt) || {};
861
+ Ie(t, e);
862
+ let { ref: n, ...o } = t;
863
+ return o;
864
+ }
865
+ function At(e, t) {
866
+ let { focusProps: n } = Pt(e), { keyboardProps: o } = Ct(e), s = U(n, o), u = It(t), c = e.isDisabled ? {} : u, m = H(e.autoFocus);
867
+ return ue(() => {
868
+ m.current && t.current && _t(t.current), m.current = !1;
496
869
  }, [
497
870
  t
498
871
  ]), {
499
- focusableProps: Q({
872
+ focusableProps: U({
500
873
  ...s,
501
874
  tabIndex: e.excludeFromTabOrder && !e.isDisabled ? -1 : void 0
502
- }, u)
875
+ }, c)
503
876
  };
504
877
  }
505
- let _ = "default", re = "", J = /* @__PURE__ */ new WeakMap();
506
- function Te(e) {
507
- Re() ? (_ === "default" && (re = document.documentElement.style.webkitUserSelect, document.documentElement.style.webkitUserSelect = "none"), _ = "disabled") : (e instanceof HTMLElement || e instanceof SVGElement) && (J.set(e, e.style.userSelect), e.style.userSelect = "none");
508
- }
509
- function X(e) {
510
- if (Re()) {
511
- if (_ !== "disabled")
512
- return;
513
- _ = "restoring", setTimeout(() => {
514
- Ae(() => {
515
- _ === "restoring" && (document.documentElement.style.webkitUserSelect === "none" && (document.documentElement.style.webkitUserSelect = re || ""), re = "", _ = "default");
516
- });
517
- }, 300);
518
- } else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && J.has(e)) {
519
- let t = J.get(e);
520
- e.style.userSelect === "none" && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), J.delete(e);
521
- }
522
- }
523
- function oe(e) {
524
- return e.mozInputSource === 0 && e.isTrusted ? !0 : e.detail === 0 && !e.pointerType;
525
- }
526
- const Ue = U.createContext(null);
527
- Ue.displayName = "PressResponderContext";
528
- function Mt(e) {
529
- let t = Ke(Ue);
530
- if (t) {
531
- let { register: n, ...r } = t;
532
- e = Q(r, e), n();
533
- }
534
- return Fe(t, e.ref), e;
535
- }
536
- function At(e) {
537
- let {
538
- onPress: t,
539
- onPressChange: n,
540
- onPressStart: r,
541
- onPressEnd: s,
542
- onPressUp: l,
543
- isDisabled: u,
544
- isPressed: p,
545
- preventFocusOnPress: f,
546
- shouldCancelOnPointerExit: b,
547
- allowTextSelectionOnPress: g,
548
- ref: O,
549
- ...x
550
- } = Mt(e), k = W(null);
551
- k.current = {
552
- onPress: t,
553
- onPressChange: n,
554
- onPressStart: r,
555
- onPressEnd: s,
556
- onPressUp: l,
557
- isDisabled: u,
558
- shouldCancelOnPointerExit: b
559
- };
560
- let [S, E] = je(!1), L = W({
561
- isPressed: !1,
562
- ignoreEmulatedMouseEvents: !1,
563
- ignoreClickAfterPress: !1,
564
- didFirePressStart: !1,
565
- activePointerId: null,
566
- target: null,
567
- isOverTarget: !1,
568
- pointerType: null
569
- }), { addGlobalListener: w, removeAllGlobalListeners: $ } = dt(), N = ze(() => {
570
- let o = L.current, B = (i, v) => {
571
- let { onPressStart: a, onPressChange: c, isDisabled: Y } = k.current;
572
- Y || o.didFirePressStart || (a && a({
573
- type: "pressstart",
574
- pointerType: v,
575
- target: i.currentTarget,
576
- shiftKey: i.shiftKey,
577
- metaKey: i.metaKey,
578
- ctrlKey: i.ctrlKey,
579
- altKey: i.altKey
580
- }), c && c(!0), o.didFirePressStart = !0, E(!0));
581
- }, h = (i, v, a = !0) => {
582
- let { onPressEnd: c, onPressChange: Y, onPress: fe, isDisabled: We } = k.current;
583
- !o.didFirePressStart || (o.ignoreClickAfterPress = !0, o.didFirePressStart = !1, c && c({
584
- type: "pressend",
585
- pointerType: v,
586
- target: i.currentTarget,
587
- shiftKey: i.shiftKey,
588
- metaKey: i.metaKey,
589
- ctrlKey: i.ctrlKey,
590
- altKey: i.altKey
591
- }), Y && Y(!1), E(!1), fe && a && !We && fe({
592
- type: "press",
593
- pointerType: v,
594
- target: i.currentTarget,
595
- shiftKey: i.shiftKey,
596
- metaKey: i.metaKey,
597
- ctrlKey: i.ctrlKey,
598
- altKey: i.altKey
599
- }));
600
- }, V = (i, v) => {
601
- let { onPressUp: a, isDisabled: c } = k.current;
602
- c || a && a({
603
- type: "pressup",
604
- pointerType: v,
605
- target: i.currentTarget,
606
- shiftKey: i.shiftKey,
607
- metaKey: i.metaKey,
608
- ctrlKey: i.ctrlKey,
609
- altKey: i.altKey
610
- });
611
- }, T = (i) => {
612
- o.isPressed && (o.isOverTarget && h(P(o.target, i), o.pointerType, !1), o.isPressed = !1, o.isOverTarget = !1, o.activePointerId = null, o.pointerType = null, $(), g || X(o.target));
613
- }, y = {
614
- onKeyDown(i) {
615
- Z(i.nativeEvent, i.currentTarget) && i.currentTarget.contains(i.target) ? (Se(i.target, i.key) && i.preventDefault(), i.stopPropagation(), !o.isPressed && !i.repeat && (o.target = i.currentTarget, o.isPressed = !0, B(i, "keyboard"), w(document, "keyup", He, !1))) : i.key === "Enter" && se(i.currentTarget) && i.stopPropagation();
616
- },
617
- onKeyUp(i) {
618
- Z(i.nativeEvent, i.currentTarget) && !i.repeat && i.currentTarget.contains(i.target) && V(P(o.target, i), "keyboard");
619
- },
620
- onClick(i) {
621
- i && !i.currentTarget.contains(i.target) || i && i.button === 0 && (i.stopPropagation(), u && i.preventDefault(), !o.ignoreClickAfterPress && !o.ignoreEmulatedMouseEvents && (o.pointerType === "virtual" || oe(i.nativeEvent)) && (!u && !f && F(i.currentTarget), B(i, "virtual"), V(i, "virtual"), h(i, "virtual")), o.ignoreEmulatedMouseEvents = !1, o.ignoreClickAfterPress = !1);
622
- }
623
- }, He = (i) => {
624
- if (o.isPressed && Z(i, o.target)) {
625
- Se(i.target, i.key) && i.preventDefault(), i.stopPropagation(), o.isPressed = !1;
626
- let v = i.target;
627
- h(P(o.target, i), "keyboard", o.target.contains(v)), $(), o.target instanceof HTMLElement && o.target.contains(v) && (se(o.target) || o.target.getAttribute("role") === "link") && o.target.click();
628
- }
629
- };
630
- if (typeof PointerEvent < "u") {
631
- y.onPointerDown = (c) => {
632
- if (!(c.button !== 0 || !c.currentTarget.contains(c.target))) {
633
- if (Vt(c.nativeEvent)) {
634
- o.pointerType = "virtual";
635
- return;
636
- }
637
- ee(c.currentTarget) && c.preventDefault(), o.pointerType = c.pointerType, c.stopPropagation(), o.isPressed || (o.isPressed = !0, o.isOverTarget = !0, o.activePointerId = c.pointerId, o.target = c.currentTarget, !u && !f && F(c.currentTarget), g || Te(o.target), B(c, o.pointerType), w(document, "pointermove", i, !1), w(document, "pointerup", v, !1), w(document, "pointercancel", a, !1));
638
- }
639
- }, y.onMouseDown = (c) => {
640
- !c.currentTarget.contains(c.target) || c.button === 0 && (ee(c.currentTarget) && c.preventDefault(), c.stopPropagation());
641
- }, y.onPointerUp = (c) => {
642
- !c.currentTarget.contains(c.target) || o.pointerType === "virtual" || c.button === 0 && I(c, c.currentTarget) && V(c, o.pointerType || c.pointerType);
643
- };
644
- let i = (c) => {
645
- c.pointerId === o.activePointerId && (I(c, o.target) ? o.isOverTarget || (o.isOverTarget = !0, B(P(o.target, c), o.pointerType)) : o.isOverTarget && (o.isOverTarget = !1, h(P(o.target, c), o.pointerType, !1), k.current.shouldCancelOnPointerExit && T(c)));
646
- }, v = (c) => {
647
- c.pointerId === o.activePointerId && o.isPressed && c.button === 0 && (I(c, o.target) ? h(P(o.target, c), o.pointerType) : o.isOverTarget && h(P(o.target, c), o.pointerType, !1), o.isPressed = !1, o.isOverTarget = !1, o.activePointerId = null, o.pointerType = null, $(), g || X(o.target));
648
- }, a = (c) => {
649
- T(c);
650
- };
651
- y.onDragStart = (c) => {
652
- !c.currentTarget.contains(c.target) || T(c);
653
- };
654
- } else {
655
- y.onMouseDown = (a) => {
656
- a.button !== 0 || !a.currentTarget.contains(a.target) || (ee(a.currentTarget) && a.preventDefault(), a.stopPropagation(), !o.ignoreEmulatedMouseEvents && (o.isPressed = !0, o.isOverTarget = !0, o.target = a.currentTarget, o.pointerType = oe(a.nativeEvent) ? "virtual" : "mouse", !u && !f && F(a.currentTarget), B(a, o.pointerType), w(document, "mouseup", i, !1)));
657
- }, y.onMouseEnter = (a) => {
658
- !a.currentTarget.contains(a.target) || (a.stopPropagation(), o.isPressed && !o.ignoreEmulatedMouseEvents && (o.isOverTarget = !0, B(a, o.pointerType)));
659
- }, y.onMouseLeave = (a) => {
660
- !a.currentTarget.contains(a.target) || (a.stopPropagation(), o.isPressed && !o.ignoreEmulatedMouseEvents && (o.isOverTarget = !1, h(a, o.pointerType, !1), k.current.shouldCancelOnPointerExit && T(a)));
661
- }, y.onMouseUp = (a) => {
662
- !a.currentTarget.contains(a.target) || !o.ignoreEmulatedMouseEvents && a.button === 0 && V(a, o.pointerType);
663
- };
664
- let i = (a) => {
665
- if (a.button === 0) {
666
- if (o.isPressed = !1, $(), o.ignoreEmulatedMouseEvents) {
667
- o.ignoreEmulatedMouseEvents = !1;
668
- return;
669
- }
670
- I(a, o.target) ? h(P(o.target, a), o.pointerType) : o.isOverTarget && h(P(o.target, a), o.pointerType, !1), o.isOverTarget = !1;
671
- }
672
- };
673
- y.onTouchStart = (a) => {
674
- if (!a.currentTarget.contains(a.target))
675
- return;
676
- a.stopPropagation();
677
- let c = Ft(a.nativeEvent);
678
- !c || (o.activePointerId = c.identifier, o.ignoreEmulatedMouseEvents = !0, o.isOverTarget = !0, o.isPressed = !0, o.target = a.currentTarget, o.pointerType = "touch", !u && !f && F(a.currentTarget), g || Te(o.target), B(a, o.pointerType), w(window, "scroll", v, !0));
679
- }, y.onTouchMove = (a) => {
680
- if (!a.currentTarget.contains(a.target) || (a.stopPropagation(), !o.isPressed))
681
- return;
682
- let c = xe(a.nativeEvent, o.activePointerId);
683
- c && I(c, a.currentTarget) ? o.isOverTarget || (o.isOverTarget = !0, B(a, o.pointerType)) : o.isOverTarget && (o.isOverTarget = !1, h(a, o.pointerType, !1), k.current.shouldCancelOnPointerExit && T(a));
684
- }, y.onTouchEnd = (a) => {
685
- if (!a.currentTarget.contains(a.target) || (a.stopPropagation(), !o.isPressed))
686
- return;
687
- let c = xe(a.nativeEvent, o.activePointerId);
688
- c && I(c, a.currentTarget) ? (V(a, o.pointerType), h(a, o.pointerType)) : o.isOverTarget && h(a, o.pointerType, !1), o.isPressed = !1, o.activePointerId = null, o.isOverTarget = !1, o.ignoreEmulatedMouseEvents = !0, g || X(o.target), $();
689
- }, y.onTouchCancel = (a) => {
690
- !a.currentTarget.contains(a.target) || (a.stopPropagation(), o.isPressed && T(a));
691
- };
692
- let v = (a) => {
693
- o.isPressed && a.target.contains(o.target) && T({
694
- currentTarget: o.target,
695
- shiftKey: !1,
696
- ctrlKey: !1,
697
- metaKey: !1,
698
- altKey: !1
699
- });
700
- };
701
- y.onDragStart = (a) => {
702
- !a.currentTarget.contains(a.target) || T(a);
703
- };
704
- }
705
- return y;
706
- }, [
707
- w,
708
- u,
709
- f,
710
- $,
711
- g
712
- ]);
713
- return ie(() => () => {
714
- g || X(L.current.target);
715
- }, [
716
- g
717
- ]), {
718
- isPressed: p || S,
719
- pressProps: Q(x, N)
720
- };
721
- }
722
- function se(e) {
723
- return e.tagName === "A" && e.hasAttribute("href");
724
- }
725
- function Z(e, t) {
726
- const { key: n, code: r } = e, s = t, l = s.getAttribute("role");
727
- return (n === "Enter" || n === " " || n === "Spacebar" || r === "Space") && !(s instanceof HTMLInputElement && !Ve(s, n) || s instanceof HTMLTextAreaElement || s.isContentEditable) && (!se(s) || l === "button" && n !== "Enter") && !(l === "link" && n !== "Enter");
728
- }
729
- function Ft(e) {
730
- const { targetTouches: t } = e;
731
- return t.length > 0 ? t[0] : null;
732
- }
733
- function xe(e, t) {
734
- const n = e.changedTouches;
735
- for (let r = 0; r < n.length; r++) {
736
- const s = n[r];
737
- if (s.identifier === t)
738
- return s;
739
- }
740
- return null;
741
- }
742
- function P(e, t) {
743
- return {
744
- currentTarget: e,
745
- shiftKey: t.shiftKey,
746
- ctrlKey: t.ctrlKey,
747
- metaKey: t.metaKey,
748
- altKey: t.altKey
749
- };
750
- }
751
- function _t(e) {
752
- let t = e.width / 2 || e.radiusX || 0, n = e.height / 2 || e.radiusY || 0;
753
- return {
754
- top: e.clientY - n,
755
- right: e.clientX + t,
756
- bottom: e.clientY + n,
757
- left: e.clientX - t
758
- };
759
- }
760
- function Rt(e, t) {
761
- return !(e.left > t.right || t.left > e.right || e.top > t.bottom || t.top > e.bottom);
762
- }
763
- function I(e, t) {
764
- let n = t.getBoundingClientRect(), r = _t(e);
765
- return Rt(n, r);
766
- }
767
- function ee(e) {
768
- return !(e instanceof HTMLElement) || !e.draggable;
769
- }
770
- function Se(e, t) {
771
- return e instanceof HTMLInputElement ? !Ve(e, t) : e instanceof HTMLButtonElement ? e.type !== "submit" : !0;
772
- }
773
- const Ut = /* @__PURE__ */ new Set([
774
- "checkbox",
775
- "radio",
776
- "range",
777
- "color",
778
- "file",
779
- "image",
780
- "button",
781
- "submit",
782
- "reset"
783
- ]);
784
- function Ve(e, t) {
785
- return e.type === "checkbox" || e.type === "radio" ? t === " " : Ut.has(e.type);
786
- }
787
- function Vt(e) {
788
- return e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
789
- }
790
- let Gt = /* @__PURE__ */ new Set(), Ne = !1, C = !1, ae = !1;
791
- function de(e, t) {
792
- for (let n of Gt)
793
- n(e, t);
794
- }
795
- function Ht(e) {
796
- return !(e.metaKey || !_e() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
797
- }
798
- function De(e) {
799
- C = !0, Ht(e) && de("keyboard", e);
800
- }
801
- function M(e) {
802
- (e.type === "mousedown" || e.type === "pointerdown") && (C = !0, de("pointer", e));
803
- }
804
- function Wt(e) {
805
- oe(e) && (C = !0);
806
- }
807
- function jt(e) {
808
- e.target === window || e.target === document || (!C && !ae && de("virtual", e), C = !1, ae = !1);
809
- }
810
- function zt() {
811
- C = !1, ae = !0;
812
- }
813
- function Ce() {
814
- if (typeof window > "u" || Ne)
815
- return;
816
- let e = HTMLElement.prototype.focus;
817
- HTMLElement.prototype.focus = function() {
818
- C = !0, e.apply(this, arguments);
819
- }, document.addEventListener("keydown", De, !0), document.addEventListener("keyup", De, !0), document.addEventListener("click", Wt, !0), window.addEventListener("focus", jt, !0), window.addEventListener("blur", zt, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", M, !0), document.addEventListener("pointermove", M, !0), document.addEventListener("pointerup", M, !0)) : (document.addEventListener("mousedown", M, !0), document.addEventListener("mousemove", M, !0), document.addEventListener("mouseup", M, !0)), Ne = !0;
820
- }
821
- typeof document < "u" && (document.readyState !== "loading" ? Ce() : document.addEventListener("DOMContentLoaded", Ce));
822
- function Yt(e, t) {
878
+ function Mt(e, t) {
823
879
  let {
824
880
  elementType: n = "button",
825
- isDisabled: r,
881
+ isDisabled: o,
826
882
  onPress: s,
827
- onPressStart: l,
828
- onPressEnd: u,
883
+ onPressStart: u,
884
+ onPressEnd: c,
885
+ onPressUp: m,
829
886
  onPressChange: p,
830
- preventFocusOnPress: f,
831
- allowFocusWhenDisabled: b,
832
- onClick: g,
887
+ preventFocusOnPress: y,
888
+ allowFocusWhenDisabled: $,
889
+ onClick: D,
833
890
  href: O,
834
- target: x,
835
- rel: k,
836
- type: S = "button"
837
- } = e, E;
838
- n === "button" ? E = {
839
- type: S,
840
- disabled: r
841
- } : E = {
891
+ target: V,
892
+ rel: C,
893
+ type: T = "button"
894
+ } = e, w;
895
+ n === "button" ? w = {
896
+ type: T,
897
+ disabled: o
898
+ } : w = {
842
899
  role: "button",
843
- tabIndex: r ? void 0 : 0,
844
- href: n === "a" && r ? void 0 : O,
845
- target: n === "a" ? x : void 0,
846
- type: n === "input" ? S : void 0,
847
- disabled: n === "input" ? r : void 0,
848
- "aria-disabled": !r || n === "input" ? void 0 : r,
849
- rel: n === "a" ? k : void 0
900
+ tabIndex: o ? void 0 : 0,
901
+ href: n === "a" && o ? void 0 : O,
902
+ target: n === "a" ? V : void 0,
903
+ type: n === "input" ? T : void 0,
904
+ disabled: n === "input" ? o : void 0,
905
+ "aria-disabled": !o || n === "input" ? void 0 : o,
906
+ rel: n === "a" ? C : void 0
850
907
  };
851
- let { pressProps: L, isPressed: w } = At({
852
- onPressStart: l,
853
- onPressEnd: u,
908
+ let { pressProps: x, isPressed: k } = yt({
909
+ onPressStart: u,
910
+ onPressEnd: c,
854
911
  onPressChange: p,
855
912
  onPress: s,
856
- isDisabled: r,
857
- preventFocusOnPress: f,
913
+ onPressUp: m,
914
+ isDisabled: o,
915
+ preventFocusOnPress: y,
858
916
  ref: t
859
- }), { focusableProps: $ } = It(e, t);
860
- b && ($.tabIndex = r ? -1 : $.tabIndex);
861
- let N = me($, L, ot(e, {
917
+ }), { focusableProps: v } = At(e, t);
918
+ $ && (v.tabIndex = o ? -1 : v.tabIndex);
919
+ let P = U(v, x, nt(e, {
862
920
  labelable: !0
863
921
  }));
864
922
  return {
865
- isPressed: w,
866
- buttonProps: me(E, N, {
923
+ isPressed: k,
924
+ buttonProps: U(w, P, {
867
925
  "aria-haspopup": e["aria-haspopup"],
868
926
  "aria-expanded": e["aria-expanded"],
869
927
  "aria-controls": e["aria-controls"],
870
928
  "aria-pressed": e["aria-pressed"],
871
- onClick: (o) => {
872
- g && (g(o), console.warn("onClick is deprecated, please use onPress"));
929
+ onClick: (B) => {
930
+ D && (D(B), console.warn("onClick is deprecated, please use onPress"));
873
931
  }
874
932
  })
875
933
  };
876
934
  }
877
- function qt(e, t, n) {
935
+ function Ft(e, t, n) {
878
936
  return t in e ? Object.defineProperty(e, t, {
879
937
  value: n,
880
938
  enumerable: !0,
@@ -882,98 +940,98 @@ function qt(e, t, n) {
882
940
  writable: !0
883
941
  }) : e[t] = n, e;
884
942
  }
885
- function Oe(e, t) {
943
+ function Se(e, t) {
886
944
  var n = Object.keys(e);
887
945
  if (Object.getOwnPropertySymbols) {
888
- var r = Object.getOwnPropertySymbols(e);
889
- t && (r = r.filter(function(s) {
946
+ var o = Object.getOwnPropertySymbols(e);
947
+ t && (o = o.filter(function(s) {
890
948
  return Object.getOwnPropertyDescriptor(e, s).enumerable;
891
- })), n.push.apply(n, r);
949
+ })), n.push.apply(n, o);
892
950
  }
893
951
  return n;
894
952
  }
895
- function Le(e) {
953
+ function Ne(e) {
896
954
  for (var t = 1; t < arguments.length; t++) {
897
955
  var n = arguments[t] != null ? arguments[t] : {};
898
- t % 2 ? Oe(Object(n), !0).forEach(function(r) {
899
- qt(e, r, n[r]);
900
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Oe(Object(n)).forEach(function(r) {
901
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
956
+ t % 2 ? Se(Object(n), !0).forEach(function(o) {
957
+ Ft(e, o, n[o]);
958
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Se(Object(n)).forEach(function(o) {
959
+ Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(n, o));
902
960
  });
903
961
  }
904
962
  return e;
905
963
  }
906
- var Xt = (e, t, n) => {
907
- for (var r of Object.keys(e)) {
964
+ var Rt = (e, t, n) => {
965
+ for (var o of Object.keys(e)) {
908
966
  var s;
909
- if (e[r] !== ((s = t[r]) !== null && s !== void 0 ? s : n[r]))
967
+ if (e[o] !== ((s = t[o]) !== null && s !== void 0 ? s : n[o]))
910
968
  return !1;
911
969
  }
912
970
  return !0;
913
971
  }, z = (e) => (t) => {
914
- var n = e.defaultClassName, r = Le(Le({}, e.defaultVariants), t);
915
- for (var s in r) {
916
- var l, u = (l = r[s]) !== null && l !== void 0 ? l : e.defaultVariants[s];
917
- if (u != null) {
918
- var p = u;
919
- typeof p == "boolean" && (p = p === !0 ? "true" : "false");
920
- var f = e.variantClassNames[s][p];
921
- f && (n += " " + f);
972
+ var n = e.defaultClassName, o = Ne(Ne({}, e.defaultVariants), t);
973
+ for (var s in o) {
974
+ var u, c = (u = o[s]) !== null && u !== void 0 ? u : e.defaultVariants[s];
975
+ if (c != null) {
976
+ var m = c;
977
+ typeof m == "boolean" && (m = m === !0 ? "true" : "false");
978
+ var p = e.variantClassNames[s][m];
979
+ p && (n += " " + p);
922
980
  }
923
981
  }
924
- for (var [b, g] of e.compoundVariants)
925
- Xt(b, r, e.defaultVariants) && (n += " " + g);
982
+ for (var [y, $] of e.compoundVariants)
983
+ Rt(y, o, e.defaultVariants) && (n += " " + $);
926
984
  return n;
927
- }, Jt = z({ defaultClassName: "_125pcxy0", variantClassNames: { disabled: { true: "_125pcxy1", false: "_125pcxy2" }, kind: { default: "_125pcxy3", link: "_125pcxy4", confirm: "_125pcxy5", delete: "_125pcxy6", key: "_125pcxy7", icon: "_125pcxy8" }, spinning: { true: "_125pcxy9", false: "_125pcxya" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [[{ kind: "icon", spinning: !0 }, "_125pcxyb"], [{ kind: "default", spinning: !0 }, "_125pcxyc"], [{ kind: "confirm", spinning: !0 }, "_125pcxyd"], [{ kind: "delete", spinning: !0 }, "_125pcxye"], [{ kind: "key", spinning: !0 }, "_125pcxyf"], [{ disabled: !0, spinning: !1 }, "_125pcxyg"]] }), Qt = z({ defaultClassName: "_125pcxyh", variantClassNames: { disabled: { true: "_125pcxyi", false: "_125pcxyj" }, kind: { icon: "_125pcxyk", default: "_125pcxyl", delete: "_125pcxym", key: "_125pcxyn", confirm: "_125pcxyo", link: "_125pcxyp" }, spinning: { true: "_125pcxyq", false: "_125pcxyr" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [] }), Zt = z({ defaultClassName: "_125pcxyv", variantClassNames: { kind: { icon: "_125pcxyw", default: "_125pcxyx", key: "_125pcxyy", delete: "_125pcxyz", confirm: "_125pcxy10", link: "_125pcxy11" } }, defaultVariants: { kind: "default" }, compoundVariants: [] }), en = z({ defaultClassName: "_125pcxy12", variantClassNames: { spinning: { true: "_125pcxy13", false: "_125pcxy14" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] }), tn = z({ defaultClassName: "_125pcxys", variantClassNames: { spinning: { true: "_125pcxyt", false: "_125pcxyu" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] });
928
- const Ge = d.forwardRef(
985
+ }, Ut = z({ defaultClassName: "_125pcxy0", variantClassNames: { disabled: { true: "_125pcxy1", false: "_125pcxy2" }, kind: { default: "_125pcxy3", link: "_125pcxy4", confirm: "_125pcxy5", delete: "_125pcxy6", key: "_125pcxy7", icon: "_125pcxy8" }, spinning: { true: "_125pcxy9", false: "_125pcxya" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [[{ kind: "icon", spinning: !0 }, "_125pcxyb"], [{ kind: "default", spinning: !0 }, "_125pcxyc"], [{ kind: "confirm", spinning: !0 }, "_125pcxyd"], [{ kind: "delete", spinning: !0 }, "_125pcxye"], [{ kind: "key", spinning: !0 }, "_125pcxyf"], [{ disabled: !0, spinning: !1 }, "_125pcxyg"]] }), Vt = z({ defaultClassName: "_125pcxyh", variantClassNames: { disabled: { true: "_125pcxyi", false: "_125pcxyj" }, kind: { icon: "_125pcxyk", default: "_125pcxyl", delete: "_125pcxym", key: "_125pcxyn", confirm: "_125pcxyo", link: "_125pcxyp" }, spinning: { true: "_125pcxyq", false: "_125pcxyr" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [] }), Gt = z({ defaultClassName: "_125pcxyv", variantClassNames: { kind: { icon: "_125pcxyw", default: "_125pcxyx", key: "_125pcxyy", delete: "_125pcxyz", confirm: "_125pcxy10", link: "_125pcxy11" } }, defaultVariants: { kind: "default" }, compoundVariants: [] }), Wt = z({ defaultClassName: "_125pcxy12", variantClassNames: { spinning: { true: "_125pcxy13", false: "_125pcxy14" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] }), Ht = z({ defaultClassName: "_125pcxys", variantClassNames: { spinning: { true: "_125pcxyt", false: "_125pcxyu" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] });
986
+ const Re = d.forwardRef(
929
987
  ({
930
988
  onClick: e,
931
989
  onPress: t,
932
990
  children: n,
933
- className: r,
991
+ className: o,
934
992
  isDisabled: s,
935
- disabled: l,
936
- href: u,
937
- icon: p,
938
- kind: f = "default",
939
- spinning: b,
940
- spinningTitle: g,
941
- ...O
942
- }, x) => {
993
+ disabled: u,
994
+ href: c,
995
+ icon: m,
996
+ kind: p = "default",
997
+ spinning: y,
998
+ spinningTitle: $,
999
+ ...D
1000
+ }, O) => {
943
1001
  var B;
944
- const k = {
1002
+ const V = {
945
1003
  onPress: t != null ? t : e,
946
- isDisabled: (B = l != null ? l : s) != null ? B : b,
947
- ...O
948
- }, { "data-testid": S } = O, E = x != null ? x : d.useRef(null), { buttonProps: L } = Yt(k, E), { t: w } = d.useContext(Ye), $ = p && /* @__PURE__ */ d.createElement(qe, {
949
- className: Zt({ kind: f }),
950
- icon: p,
1004
+ isDisabled: (B = u != null ? u : s) != null ? B : y,
1005
+ ...D
1006
+ }, { "data-testid": C } = D, T = O != null ? O : d.useRef(null), { buttonProps: w } = Mt(V, T), { t: x } = d.useContext(We), k = m && /* @__PURE__ */ d.createElement(He, {
1007
+ className: Gt({ kind: p }),
1008
+ icon: m,
951
1009
  "aria-hidden": "true",
952
- "data-testid": `${S}__${p}-icon`
1010
+ "data-testid": `${C}__${m}-icon`
953
1011
  });
954
- let N;
955
- f === "default" || f === "icon" || f === "link" ? N = "dark" : N = "light";
956
- const o = b && /* @__PURE__ */ d.createElement(Xe, {
957
- color: N,
958
- className: en({ spinning: b }),
959
- title: g || w("design-system:button.spinningTitle"),
960
- "data-testid": `${S}__spinner`
1012
+ let v;
1013
+ p === "default" || p === "icon" || p === "link" ? v = "dark" : v = "light";
1014
+ const P = y && /* @__PURE__ */ d.createElement(je, {
1015
+ color: v,
1016
+ className: Wt({ spinning: y }),
1017
+ title: $ || x("design-system:button.spinningTitle"),
1018
+ "data-testid": `${C}__spinner`
961
1019
  });
962
1020
  return /* @__PURE__ */ d.createElement("div", {
963
- className: Je(Jt({ disabled: s || l, kind: f, spinning: b }), r)
964
- }, u ? /* @__PURE__ */ d.createElement("a", {
965
- className: tn({ spinning: b }),
966
- ...O,
967
- href: u
968
- }, $, n, o) : /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement("button", {
969
- className: Qt({ disabled: s || l, kind: f, spinning: b }),
1021
+ className: ze(Ut({ disabled: s || u, kind: p, spinning: y }), o)
1022
+ }, c ? /* @__PURE__ */ d.createElement("a", {
1023
+ className: Ht({ spinning: y }),
1024
+ ...D,
1025
+ href: c
1026
+ }, k, n, P) : /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement("button", {
1027
+ className: Vt({ disabled: s || u, kind: p, spinning: y }),
970
1028
  disabled: s,
971
- ...L,
972
- ref: E
973
- }, $, n, o)));
1029
+ ...w,
1030
+ ref: T
1031
+ }, k, n, P)));
974
1032
  }
975
1033
  );
976
- Qe.set(Ge, {
1034
+ Ye.set(Re, {
977
1035
  name: "Buttons",
978
1036
  props: {
979
1037
  disabled: "boolean",
@@ -988,8 +1046,8 @@ Qe.set(Ge, {
988
1046
  type: { type: '"button" | "submit"', default: '"button"' }
989
1047
  }
990
1048
  });
991
- const nn = {
992
- components: [Ge],
1049
+ const jt = {
1050
+ components: [Re],
993
1051
  description: () => /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement("div", {
994
1052
  className: "sps-body-14"
995
1053
  }, "Buttons are used to initiate events or actions. The labels and/or icons describe what the button will do."), /* @__PURE__ */ d.createElement("br", null), /* @__PURE__ */ d.createElement("h5", null, "Variants"), /* @__PURE__ */ d.createElement("div", {
@@ -1026,7 +1084,7 @@ const nn = {
1026
1084
  examples: {
1027
1085
  withoutIcons: {
1028
1086
  description: "Without Icons",
1029
- react: m`
1087
+ react: g`
1030
1088
  import { Button } from "@sps-woodland/buttons";
1031
1089
  import { sprinkles } from "@sps-woodland/tokens";
1032
1090
 
@@ -1045,7 +1103,7 @@ const nn = {
1045
1103
  },
1046
1104
  withIcons: {
1047
1105
  description: "With Icons",
1048
- react: m`
1106
+ react: g`
1049
1107
  import { Button } from "@sps-woodland/buttons";
1050
1108
  import { sprinkles } from "@sps-woodland/tokens";
1051
1109
 
@@ -1064,7 +1122,7 @@ const nn = {
1064
1122
  },
1065
1123
  spinning: {
1066
1124
  description: "Spinning",
1067
- react: m`
1125
+ react: g`
1068
1126
  import { Button } from "@sps-woodland/buttons";
1069
1127
  import { sprinkles } from "@sps-woodland/tokens";
1070
1128
 
@@ -1088,7 +1146,7 @@ const nn = {
1088
1146
  examples: {
1089
1147
  withoutIcons: {
1090
1148
  description: "Without Icons",
1091
- react: m`
1149
+ react: g`
1092
1150
  import { SpsDropdown } from "@spscommerce/ds-react";
1093
1151
 
1094
1152
  function Component() {
@@ -1130,7 +1188,7 @@ const nn = {
1130
1188
  },
1131
1189
  withIcons: {
1132
1190
  description: "With Icons",
1133
- react: m`
1191
+ react: g`
1134
1192
  import { SpsDropdown } from "@spscommerce/ds-react";
1135
1193
 
1136
1194
  function Component() {
@@ -1177,7 +1235,7 @@ const nn = {
1177
1235
  },
1178
1236
  spinning: {
1179
1237
  description: "Spinning",
1180
- react: m`
1238
+ react: g`
1181
1239
  import { SpsDropdown } from "@spscommerce/ds-react";
1182
1240
 
1183
1241
  function Component() {
@@ -1223,7 +1281,7 @@ const nn = {
1223
1281
  examples: {
1224
1282
  withoutIcons: {
1225
1283
  description: "Without Icons",
1226
- react: m`
1284
+ react: g`
1227
1285
  import { SpsSplitButton } from "@spscommerce/ds-react";
1228
1286
 
1229
1287
  function Component() {
@@ -1253,7 +1311,7 @@ const nn = {
1253
1311
  },
1254
1312
  withIcons: {
1255
1313
  description: "With Icons",
1256
- react: m`
1314
+ react: g`
1257
1315
  import { SpsSplitButton } from "@spscommerce/ds-react";
1258
1316
 
1259
1317
  function Component() {
@@ -1305,7 +1363,7 @@ const nn = {
1305
1363
  examples: {
1306
1364
  standard: {
1307
1365
  description: "Standard Icon Buttons",
1308
- react: m`
1366
+ react: g`
1309
1367
  import { Button } from "@sps-woodland/buttons";
1310
1368
  import { sprinkles } from "@sps-woodland/tokens";
1311
1369
 
@@ -1330,7 +1388,7 @@ const nn = {
1330
1388
  description: ({ NavigateTo: e }) => /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement("h5", null, "Dropdown Icon Buttons"), /* @__PURE__ */ d.createElement("p", null, "Use these when there are several options available for action. Example: Dropdown Icon Button in a ", /* @__PURE__ */ d.createElement(e, {
1331
1389
  to: "content-rows"
1332
1390
  }, "Content Row"), ".")),
1333
- react: m`
1391
+ react: g`
1334
1392
  import { SpsDropdown } from "@spscommerce/ds-react";
1335
1393
 
1336
1394
  function Component() {
@@ -1348,7 +1406,7 @@ const nn = {
1348
1406
  },
1349
1407
  spinner: {
1350
1408
  description: "Spinner",
1351
- react: m`
1409
+ react: g`
1352
1410
  import { Button } from "@sps-woodland/buttons";
1353
1411
 
1354
1412
  function Component() {
@@ -1370,7 +1428,7 @@ const nn = {
1370
1428
  examples: {
1371
1429
  withoutIcons: {
1372
1430
  description: "Without Icons",
1373
- react: m`
1431
+ react: g`
1374
1432
  import { Button } from "@sps-woodland/buttons";
1375
1433
  import { sprinkles } from "@sps-woodland/tokens";
1376
1434
 
@@ -1387,7 +1445,7 @@ const nn = {
1387
1445
  },
1388
1446
  withIcons: {
1389
1447
  description: "With Icons",
1390
- react: m`
1448
+ react: g`
1391
1449
  import { Button } from "@sps-woodland/buttons";
1392
1450
  import { sprinkles } from "@sps-woodland/tokens";
1393
1451
 
@@ -1404,7 +1462,7 @@ const nn = {
1404
1462
  },
1405
1463
  spinner: {
1406
1464
  description: "Spinner",
1407
- react: m`
1465
+ react: g`
1408
1466
  import { Button } from "@sps-woodland/buttons";
1409
1467
 
1410
1468
  function Component() {
@@ -1425,7 +1483,7 @@ const nn = {
1425
1483
  }, "Modal"), " uses Basic Button (Key) as its Submit Button."),
1426
1484
  examples: {
1427
1485
  basic: {
1428
- react: m`
1486
+ react: g`
1429
1487
  import { Button } from "@sps-woodland/buttons";
1430
1488
  import { sprinkles } from "@sps-woodland/tokens";
1431
1489
 
@@ -1453,7 +1511,7 @@ const nn = {
1453
1511
  description: "Used to link to another page, such as an external website. They may open in the same window or in a new one. It should only be used when a Text Button doesn't provide enough visual emphasis.",
1454
1512
  examples: {
1455
1513
  basic: {
1456
- react: m`
1514
+ react: g`
1457
1515
  import { Button } from "@sps-woodland/buttons";
1458
1516
 
1459
1517
  function Component() {
@@ -1477,7 +1535,7 @@ const nn = {
1477
1535
  examples: {
1478
1536
  basic: {
1479
1537
  description: "Basic Button Groups",
1480
- react: m`
1538
+ react: g`
1481
1539
  import { Button } from "@sps-woodland/buttons";
1482
1540
  import { sprinkles } from "@sps-woodland/tokens";
1483
1541
 
@@ -1493,7 +1551,7 @@ const nn = {
1493
1551
  },
1494
1552
  icon: {
1495
1553
  description: "Icon Button Groups",
1496
- react: m`
1554
+ react: g`
1497
1555
  import { Button } from "@sps-woodland/buttons";
1498
1556
 
1499
1557
  function Component() {
@@ -1508,7 +1566,7 @@ const nn = {
1508
1566
  },
1509
1567
  textAndIcons: {
1510
1568
  description: "Text Buttons + Icon Buttons Group",
1511
- react: m`
1569
+ react: g`
1512
1570
  import { Button } from "@sps-woodland/buttons";
1513
1571
  import { sprinkles } from "@sps-woodland/tokens";
1514
1572
  import { VericalRule } from "@sps-woodland/core";
@@ -1527,7 +1585,7 @@ const nn = {
1527
1585
  },
1528
1586
  textAndBasic: {
1529
1587
  description: "Text Buttons + Basic Buttons Group",
1530
- react: m`
1588
+ react: g`
1531
1589
  import { Button } from "@sps-woodland/buttons";
1532
1590
  import { sprinkles } from "@sps-woodland/tokens";
1533
1591
  import { VericalRule } from "@sps-woodland/core";
@@ -1547,7 +1605,7 @@ const nn = {
1547
1605
  },
1548
1606
  iconsAndBasic: {
1549
1607
  description: "Icon Buttons + Basic Buttons Group",
1550
- react: m`
1608
+ react: g`
1551
1609
  import { Button } from "@sps-woodland/buttons";
1552
1610
  import { sprinkles } from "@sps-woodland/tokens";
1553
1611
  import { VericalRule } from "@sps-woodland/core";
@@ -1568,7 +1626,7 @@ const nn = {
1568
1626
  },
1569
1627
  textIconsAndBasic: {
1570
1628
  description: "Text Buttons + Icon Buttons + Basic Buttons Group",
1571
- react: m`
1629
+ react: g`
1572
1630
  import { Button } from "@sps-woodland/buttons";
1573
1631
  import { sprinkles } from "@sps-woodland/tokens";
1574
1632
  import { VericalRule } from "@sps-woodland/core";
@@ -1592,10 +1650,10 @@ const nn = {
1592
1650
  }
1593
1651
  }
1594
1652
  }
1595
- }, an = {
1596
- Buttons: nn
1653
+ }, qt = {
1654
+ Buttons: jt
1597
1655
  };
1598
1656
  export {
1599
- Ge as Button,
1600
- an as MANIFEST
1657
+ Re as Button,
1658
+ qt as MANIFEST
1601
1659
  };