@brickkit/cli 0.14.0 → 0.16.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dashboard-dist/{CollapsiblePanel-CbUysOp5.js → CollapsiblePanel-DvJpFahB.js} +2 -2
  2. package/dashboard-dist/Geist-Variable.woff2 +0 -0
  3. package/dashboard-dist/GeistMono-Variable.woff2 +0 -0
  4. package/dashboard-dist/{api-reference-lLhahVJi.js → api-reference-C2_JX174.js} +82 -70
  5. package/dashboard-dist/app.css +2 -2
  6. package/dashboard-dist/app.js +5 -5
  7. package/dashboard-dist/{client-DRtkFydB.js → client-DsITZplk.js} +1 -1
  8. package/dashboard-dist/{core-BSTqZqMg.js → core-sW89OSz5.js} +1 -1
  9. package/dashboard-dist/docs-D3U7gUWq.js +4 -0
  10. package/dashboard-dist/kit.js +1 -1
  11. package/dashboard-dist/{popover-CKxhB1QI.js → popover-Bb2Q3jiK.js} +1 -1
  12. package/dist/bin.d.ts +1 -2
  13. package/dist/bin.js +6 -6
  14. package/dist/bin.js.map +1 -1
  15. package/dist/build.js +5 -1
  16. package/dist/build.js.map +1 -1
  17. package/dist/client-contract-file.js +3 -2
  18. package/dist/client-contract-file.js.map +1 -1
  19. package/dist/compiler.d.ts +1 -2
  20. package/dist/config2.d.ts +1 -2
  21. package/dist/dashboard-extension.d.ts +1 -2
  22. package/dist/dashboard-host.js +26 -7
  23. package/dist/dashboard-host.js.map +1 -1
  24. package/dist/dashboard.d.ts +4 -4
  25. package/dist/definitions.js +1 -0
  26. package/dist/definitions.js.map +1 -1
  27. package/dist/dev-application.js.map +1 -1
  28. package/dist/dev-reporter.d.ts +1 -2
  29. package/dist/dev-reporter.js.map +1 -1
  30. package/dist/dev-telemetry.js.map +1 -1
  31. package/dist/dev-worker.js.map +1 -1
  32. package/dist/index.d.ts +1 -2
  33. package/dist/lint/oxlint.d.ts +1 -2
  34. package/dist/plugin.d.ts +1 -2
  35. package/dist/production-dashboard2.d.ts +1 -2
  36. package/dist/project.js +35 -12
  37. package/dist/project.js.map +1 -1
  38. package/dist/serve.d.ts +1 -2
  39. package/dist/serve2.js.map +1 -1
  40. package/dist/vite.d.ts +1 -2
  41. package/dist/vite.js +2 -1
  42. package/dist/vite.js.map +1 -1
  43. package/dist/workflows.d.ts +1 -2
  44. package/inspector-dist/client/assets/app-Wfnqu2Ic.css +4610 -0
  45. package/inspector-dist/client/assets/{dist-BK8w6xOr.js → dist-CEyPxAJU.js} +2008 -334
  46. package/inspector-dist/client/assets/{entry.client-D9jbgmTR.js → entry.client-Cszf0uLP.js} +4628 -2593
  47. package/inspector-dist/client/assets/highlighted-body-JLMTFACH-CgFt8UnP.js +41 -0
  48. package/inspector-dist/client/assets/{home-hwPlkNhv.js → home-B2m1nnIz.js} +191 -105
  49. package/inspector-dist/client/assets/{jsx-runtime-CPEah4WQ.js → jsx-runtime-DRYYXgdJ.js} +2946 -2001
  50. package/inspector-dist/client/assets/{manifest-0e76e9ac.js → manifest-cfc09adc.js} +1 -1
  51. package/inspector-dist/client/assets/mermaid-WFAXDIZX-BoRESrqm.js +1 -0
  52. package/inspector-dist/client/assets/root-CVescmwt.css +4544 -0
  53. package/inspector-dist/client/assets/{root-SLeEf-sT.js → root-CVhM1JOR.js} +3 -3
  54. package/inspector-dist/client/assets/{run-detail-DYbVkIFH.js → run-detail-BdV01jxD.js} +90 -50
  55. package/inspector-dist/client/assets/tabs-BVrPbzfI.css +66 -0
  56. package/inspector-dist/client/assets/{tabs-CaJisoyb.js → tabs-C2hdi5D4.js} +12496 -8708
  57. package/inspector-dist/client/assets/{zstd-browser-decoder-D94wmfAU.js → zstd-browser-decoder-DQWDmc2d.js} +2 -2
  58. package/inspector-dist/server/assets/{app-DGlfWVUI.js → app-w0nTXgJd.js} +51489 -51478
  59. package/inspector-dist/server/assets/{chunk-RLXIAIE6-F0SJZlei.js → chunk-7TTQLYRW-BO6_qAAU.js} +10986 -7848
  60. package/inspector-dist/server/assets/cjs-DPK66Gxq.js +3600 -0
  61. package/inspector-dist/server/assets/{dist-BCbwm6jl.js → dist-DTHqO9VA.js} +149 -1619
  62. package/inspector-dist/server/assets/{dist-Ce0I2PUv.js → dist-OLuKLJ4s.js} +8 -8
  63. package/inspector-dist/server/assets/{encryption-DdQgC8Rk.js → encryption-DMo4uOFN.js} +5 -5
  64. package/inspector-dist/server/assets/{event-metadata-n7E4zEmT.js → event-metadata-Bx8Ts484.js} +1 -1
  65. package/inspector-dist/server/assets/functions-B9XwHSzK.js +6972 -0
  66. package/inspector-dist/server/assets/{global-singleton-D8sIN5du.js → global-singleton-rNtXNHKV.js} +1 -1
  67. package/inspector-dist/server/assets/highlighted-body-JLMTFACH-B0HDNeQE.js +41 -0
  68. package/inspector-dist/server/assets/mermaid-WFAXDIZX-B-AIJZhh.js +1 -0
  69. package/inspector-dist/server/assets/serialization-DsMds3lJ.js +5716 -0
  70. package/inspector-dist/server/assets/{serialization-format-BbuGfHog.js → serialization-format-B27jSUCM.js} +30 -9
  71. package/inspector-dist/server/assets/state-resolver-DVs_zsEO.js +1422 -0
  72. package/inspector-dist/server/assets/{token-BgMmJNP5.js → token-CvvD8Y5H.js} +1 -1
  73. package/inspector-dist/server/assets/token-CxjWFNNq.js +63 -0
  74. package/inspector-dist/server/assets/token-util-D9IsWeEs.js +3 -0
  75. package/inspector-dist/server/assets/{wrapper-CIC3w0oC.js → wrapper-B_u9Z5Up.js} +58 -26
  76. package/inspector-dist/server/assets/{ws-transport-CxTYB11n.js → ws-transport-CamzQ5O8.js} +24379 -24240
  77. package/inspector-dist/server/assets/{zstd-browser-decoder-D7bCXbGg.js → zstd-browser-decoder-DlGbqUuc.js} +2 -2
  78. package/inspector-dist/server/index.js +1 -1
  79. package/package.json +21 -21
  80. package/dashboard-dist/docs-Cye2p0fM.js +0 -4
  81. package/inspector-dist/client/assets/app-CeSwVsRm.css +0 -2
  82. package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-CfRnuITN.js +0 -34
  83. package/inspector-dist/client/assets/mermaid-3ZIDBTTL-ZDR2PNY_.js +0 -1
  84. package/inspector-dist/client/assets/root-ChBNTZd2.css +0 -2
  85. package/inspector-dist/client/assets/tabs-L5XKzOpP.css +0 -1
  86. package/inspector-dist/server/assets/functions-CNVQtbgg.js +0 -1170
  87. package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-CWRzMxYD.js +0 -34
  88. package/inspector-dist/server/assets/mermaid-3ZIDBTTL-D0v0ngVr.js +0 -1
  89. package/inspector-dist/server/assets/parse-Begau9cA.js +0 -469
@@ -1,23 +1,1046 @@
1
- import { F as require_react, P as require_react_dom, R as __toESM, t as require_jsx_runtime } from "./jsx-runtime-CPEah4WQ.js";
2
- // ../../node_modules/.bun/@radix-ui+primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.mjs
1
+ import { A as useDataRouterContext, B as DataRouterNavigationContext, F as useNavigate, H as RouteContext, I as useNavigation, M as useHref, N as useLocation, O as escapeHtml, P as useMatches, Q as parseToInfo, R as useResolvedPath, U as ViewTransitionContext, V as NavigationContext, X as joinPaths, Z as matchPath, at as warning, ct as require_react, dt as __toESM, et as resolveTo, f as PrefetchPageLinks, h as usePrefetchBehavior, it as invariant, j as useDataRouterState, k as useCurrentRouteId, l as FrameworkContext, m as mergeRefs, ot as ABSOLUTE_URL_REGEX, r as Router, rt as createPath, st as require_react_dom, t as require_jsx_runtime, tt as stripBasename } from "./jsx-runtime-DRYYXgdJ.js";
2
+ // ../../node_modules/.bun/react-router@8.5.1+b146eb580f4286be/node_modules/react-router/dist/production/lib/dom/dom.js
3
+ /**
4
+ * react-router v8.5.1
5
+ *
6
+ * Copyright (c) Remix Software Inc.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE.md file in the root directory of this source tree.
10
+ *
11
+ * @license MIT
12
+ */
13
+ var defaultEncType = "application/x-www-form-urlencoded";
14
+ function isHtmlElement(object) {
15
+ return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
16
+ }
17
+ function isButtonElement(object) {
18
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
19
+ }
20
+ function isFormElement(object) {
21
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
22
+ }
23
+ function isInputElement(object) {
24
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
25
+ }
26
+ function isModifiedEvent(event) {
27
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
28
+ }
29
+ function shouldProcessLinkClick(event, target) {
30
+ return event.button === 0 && (!target || target === "_self") && !isModifiedEvent(event);
31
+ }
32
+ /**
33
+ * Creates a URLSearchParams object using the given initializer.
34
+ *
35
+ * This is identical to `new URLSearchParams(init)` except it also supports
36
+ * arrays as values in the object form of the initializer instead of just
37
+ * strings. This is convenient when you need multiple values for a given key,
38
+ * but don't want to use an array initializer.
39
+ *
40
+ * @example
41
+ * // Instead of:
42
+ * let searchParams = new URLSearchParams([
43
+ * ["sort", "name"],
44
+ * ["sort", "price"],
45
+ * ]);
46
+ *
47
+ * // You can do:
48
+ * let searchParams = createSearchParams({
49
+ * sort: ["name", "price"],
50
+ * });
51
+ *
52
+ * @public
53
+ * @category Utils
54
+ * @param init The value used to initialize the URL search parameters.
55
+ * @returns A URLSearchParams object containing the initialized search
56
+ * parameters.
57
+ */
58
+ function createSearchParams(init = "") {
59
+ return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
60
+ let value = init[key];
61
+ return memo.concat(Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]);
62
+ }, []));
63
+ }
64
+ function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
65
+ let searchParams = createSearchParams(locationSearch);
66
+ if (defaultSearchParams) defaultSearchParams.forEach((_, key) => {
67
+ if (!searchParams.has(key)) defaultSearchParams.getAll(key).forEach((value) => {
68
+ searchParams.append(key, value);
69
+ });
70
+ });
71
+ return searchParams;
72
+ }
73
+ var _formDataSupportsSubmitter = null;
74
+ function isFormDataSubmitterSupported() {
75
+ if (_formDataSupportsSubmitter === null) try {
76
+ new FormData(document.createElement("form"), 0);
77
+ _formDataSupportsSubmitter = false;
78
+ } catch {
79
+ _formDataSupportsSubmitter = true;
80
+ }
81
+ return _formDataSupportsSubmitter;
82
+ }
83
+ var supportedFormEncTypes = /* @__PURE__ */ new Set([
84
+ "application/x-www-form-urlencoded",
85
+ "multipart/form-data",
86
+ "text/plain"
87
+ ]);
88
+ function getFormEncType(encType) {
89
+ if (encType != null && !supportedFormEncTypes.has(encType)) {
90
+ warning(false, `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`);
91
+ return null;
92
+ }
93
+ return encType;
94
+ }
95
+ function getFormSubmissionInfo(target, basename) {
96
+ let method;
97
+ let action;
98
+ let encType;
99
+ let formData;
100
+ let body;
101
+ if (isFormElement(target)) {
102
+ let attr = target.getAttribute("action");
103
+ action = attr ? stripBasename(attr, basename) : null;
104
+ method = target.getAttribute("method") || "get";
105
+ encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
106
+ formData = new FormData(target);
107
+ } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
108
+ let form = target.form;
109
+ if (form == null) throw new Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);
110
+ let attr = target.getAttribute("formaction") || form.getAttribute("action");
111
+ action = attr ? stripBasename(attr, basename) : null;
112
+ method = target.getAttribute("formmethod") || form.getAttribute("method") || "get";
113
+ encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
114
+ formData = new FormData(form, target);
115
+ if (!isFormDataSubmitterSupported()) {
116
+ let { name, type, value } = target;
117
+ if (type === "image") {
118
+ let prefix = name ? `${name}.` : "";
119
+ formData.append(`${prefix}x`, "0");
120
+ formData.append(`${prefix}y`, "0");
121
+ } else if (name) formData.append(name, value);
122
+ }
123
+ } else if (isHtmlElement(target)) throw new Error("Cannot submit element that is not <form>, <button>, or <input type=\"submit|image\">");
124
+ else {
125
+ method = "get";
126
+ action = null;
127
+ encType = defaultEncType;
128
+ body = target;
129
+ }
130
+ if (formData && encType === "text/plain") {
131
+ body = formData;
132
+ formData = void 0;
133
+ }
134
+ return {
135
+ action,
136
+ method: method.toLowerCase(),
137
+ encType,
138
+ formData,
139
+ body
140
+ };
141
+ }
142
+ // ../../node_modules/.bun/react-router@8.5.1+b146eb580f4286be/node_modules/react-router/dist/production/lib/dom/lib.js
143
+ /**
144
+ * react-router v8.5.1
145
+ *
146
+ * Copyright (c) Remix Software Inc.
147
+ *
148
+ * This source code is licensed under the MIT license found in the
149
+ * LICENSE.md file in the root directory of this source tree.
150
+ *
151
+ * @license MIT
152
+ */
3
153
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
4
- typeof window !== "undefined" && window.document && window.document.createElement;
154
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
155
+ try {
156
+ if (isBrowser) window.__reactRouterVersion = "8";
157
+ } catch {}
158
+ /**
159
+ * A declarative {@link Router | `<Router>`} that accepts a pre-instantiated
160
+ * `history` object.
161
+ * It's important to note that using your own `history` object is highly discouraged
162
+ * and may add two versions of the `history` library to your bundles unless you use
163
+ * the same version of the `history` library that React Router uses internally.
164
+ *
165
+ * @name unstable_HistoryRouter
166
+ * @public
167
+ * @category Declarative Routers
168
+ * @mode declarative
169
+ * @param props Props
170
+ * @param {HistoryRouterProps.basename} props.basename n/a
171
+ * @param {HistoryRouterProps.children} props.children n/a
172
+ * @param {HistoryRouterProps.history} props.history n/a
173
+ * @param {HistoryRouterProps.useTransitions} props.useTransitions n/a
174
+ * @returns A declarative {@link Router | `<Router>`} using the provided history
175
+ * implementation for client-side routing.
176
+ */
177
+ function HistoryRouter({ basename, children, history, useTransitions }) {
178
+ let [state, setStateImpl] = import_react.useState({
179
+ action: history.action,
180
+ location: history.location
181
+ });
182
+ let setState = import_react.useCallback((newState) => {
183
+ if (useTransitions === false) setStateImpl(newState);
184
+ else import_react.startTransition(() => setStateImpl(newState));
185
+ }, [useTransitions]);
186
+ import_react.useLayoutEffect(() => history.listen(setState), [history, setState]);
187
+ return /* @__PURE__ */ import_react.createElement(Router, {
188
+ basename,
189
+ children,
190
+ location: state.location,
191
+ navigationType: state.action,
192
+ navigator: history,
193
+ useTransitions
194
+ });
195
+ }
196
+ HistoryRouter.displayName = "unstable_HistoryRouter";
197
+ /**
198
+ * A progressively enhanced [`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
199
+ * wrapper to enable navigation with client-side routing.
200
+ *
201
+ * @example
202
+ * import { Link } from "react-router";
203
+ *
204
+ * <Link to="/dashboard">Dashboard</Link>;
205
+ *
206
+ * <Link
207
+ * to={{
208
+ * pathname: "/some/path",
209
+ * search: "?query=string",
210
+ * hash: "#hash",
211
+ * }}
212
+ * />;
213
+ *
214
+ * @public
215
+ * @category Components
216
+ * @param {LinkProps.discover} props.discover [modes: framework] n/a
217
+ * @param {LinkProps.prefetch} props.prefetch [modes: framework] n/a
218
+ * @param {LinkProps.preventScrollReset} props.preventScrollReset [modes: framework, data] n/a
219
+ * @param {LinkProps.relative} props.relative n/a
220
+ * @param {LinkProps.reloadDocument} props.reloadDocument n/a
221
+ * @param {LinkProps.replace} props.replace n/a
222
+ * @param {LinkProps.state} props.state n/a
223
+ * @param {LinkProps.to} props.to n/a
224
+ * @param {LinkProps.viewTransition} props.viewTransition [modes: framework, data] n/a
225
+ * @param {LinkProps.defaultShouldRevalidate} props.defaultShouldRevalidate n/a
226
+ * @param {LinkProps.mask} props.mask [modes: framework, data] n/a
227
+ */
228
+ var Link = import_react.forwardRef(function LinkWithRef({ onClick, discover = "render", prefetch = "none", relative, reloadDocument, replace, mask, state, target, to, preventScrollReset, viewTransition, defaultShouldRevalidate, ...rest }, forwardedRef) {
229
+ let { basename, navigator, useTransitions } = import_react.useContext(NavigationContext);
230
+ let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
231
+ let parsed = parseToInfo(to, basename);
232
+ to = parsed.to;
233
+ let href = useHref(to, { relative });
234
+ let location = useLocation();
235
+ let maskedHref = null;
236
+ if (mask) {
237
+ let resolved = resolveTo(mask, [], location.mask ? location.mask.pathname : "/", true);
238
+ if (basename !== "/") resolved.pathname = resolved.pathname === "/" ? basename : joinPaths([basename, resolved.pathname]);
239
+ maskedHref = navigator.createHref(resolved);
240
+ }
241
+ let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(prefetch, rest);
242
+ let internalOnClick = useLinkClickHandler(to, {
243
+ replace,
244
+ mask,
245
+ state,
246
+ target,
247
+ preventScrollReset,
248
+ relative,
249
+ viewTransition,
250
+ defaultShouldRevalidate,
251
+ useTransitions
252
+ });
253
+ function handleClick(event) {
254
+ if (onClick) onClick(event);
255
+ if (!event.defaultPrevented) internalOnClick(event);
256
+ }
257
+ let isSpaLink = !(parsed.isExternal || reloadDocument);
258
+ let link = /* @__PURE__ */ import_react.createElement("a", {
259
+ ...rest,
260
+ ...prefetchHandlers,
261
+ href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
262
+ onClick: isSpaLink ? handleClick : onClick,
263
+ ref: mergeRefs(forwardedRef, prefetchRef),
264
+ target,
265
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
266
+ });
267
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ import_react.createElement(import_react.Fragment, null, link, /* @__PURE__ */ import_react.createElement(PrefetchPageLinks, { page: href })) : link;
268
+ });
269
+ Link.displayName = "Link";
270
+ /**
271
+ * Wraps {@link Link | `<Link>`} with additional props for styling active and
272
+ * pending states.
273
+ *
274
+ * - Automatically applies classes to the link based on its `active` and `pending`
275
+ * states, see {@link NavLinkProps.className}
276
+ * - Note that `pending` is only available with Framework and Data modes.
277
+ * - Automatically applies `aria-current="page"` to the link when the link is active.
278
+ * See [`aria-current`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
279
+ * on MDN.
280
+ * - States are additionally available through the className, style, and children
281
+ * render props. See {@link NavLinkRenderProps}.
282
+ *
283
+ * @example
284
+ * <NavLink to="/message">Messages</NavLink>
285
+ *
286
+ * // Using render props
287
+ * <NavLink
288
+ * to="/messages"
289
+ * className={({ isActive, isPending }) =>
290
+ * isPending ? "pending" : isActive ? "active" : ""
291
+ * }
292
+ * >
293
+ * Messages
294
+ * </NavLink>
295
+ *
296
+ * @public
297
+ * @category Components
298
+ * @param {NavLinkProps.caseSensitive} props.caseSensitive n/a
299
+ * @param {NavLinkProps.children} props.children n/a
300
+ * @param {NavLinkProps.className} props.className n/a
301
+ * @param {NavLinkProps.discover} props.discover [modes: framework] n/a
302
+ * @param {NavLinkProps.end} props.end n/a
303
+ * @param {NavLinkProps.prefetch} props.prefetch [modes: framework] n/a
304
+ * @param {NavLinkProps.preventScrollReset} props.preventScrollReset [modes: framework, data] n/a
305
+ * @param {NavLinkProps.relative} props.relative n/a
306
+ * @param {NavLinkProps.reloadDocument} props.reloadDocument n/a
307
+ * @param {NavLinkProps.replace} props.replace n/a
308
+ * @param {NavLinkProps.state} props.state n/a
309
+ * @param {NavLinkProps.style} props.style n/a
310
+ * @param {NavLinkProps.to} props.to n/a
311
+ * @param {NavLinkProps.viewTransition} props.viewTransition [modes: framework, data] n/a
312
+ */
313
+ var NavLink = import_react.forwardRef(function NavLinkWithRef({ "aria-current": ariaCurrentProp = "page", caseSensitive = false, className: classNameProp = "", end = false, style: styleProp, to, viewTransition, children, ...rest }, ref) {
314
+ let path = useResolvedPath(to, { relative: rest.relative });
315
+ let location = useLocation();
316
+ let routerNavigation = import_react.useContext(DataRouterNavigationContext);
317
+ let { navigator, basename } = import_react.useContext(NavigationContext);
318
+ let isTransitioning = routerNavigation != null && useViewTransitionState(path) && viewTransition === true;
319
+ let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
320
+ let locationPathname = location.pathname;
321
+ let nextLocationPathname = routerNavigation?.navigation.location ? routerNavigation.navigation.location.pathname : null;
322
+ if (!caseSensitive) {
323
+ locationPathname = locationPathname.toLowerCase();
324
+ nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
325
+ toPathname = toPathname.toLowerCase();
326
+ }
327
+ if (nextLocationPathname && basename) nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
328
+ const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
329
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
330
+ let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(endSlashPosition) === "/");
331
+ let renderProps = {
332
+ isActive,
333
+ isPending,
334
+ isTransitioning
335
+ };
336
+ let ariaCurrent = isActive ? ariaCurrentProp : void 0;
337
+ let className;
338
+ if (typeof classNameProp === "function") className = classNameProp(renderProps);
339
+ else className = [
340
+ classNameProp,
341
+ isActive ? "active" : null,
342
+ isPending ? "pending" : null,
343
+ isTransitioning ? "transitioning" : null
344
+ ].filter(Boolean).join(" ");
345
+ let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
346
+ return /* @__PURE__ */ import_react.createElement(Link, {
347
+ ...rest,
348
+ "aria-current": ariaCurrent,
349
+ className,
350
+ ref,
351
+ style,
352
+ to,
353
+ viewTransition
354
+ }, typeof children === "function" ? children(renderProps) : children);
355
+ });
356
+ NavLink.displayName = "NavLink";
357
+ /**
358
+ * A progressively enhanced HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
359
+ * that submits data to actions via [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch),
360
+ * activating pending states in {@link useNavigation} which enables advanced
361
+ * user interfaces beyond a basic HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form).
362
+ * After a form's `action` completes, all data on the page is automatically
363
+ * revalidated to keep the UI in sync with the data.
364
+ *
365
+ * Because it uses the HTML form API, server rendered pages are interactive at a
366
+ * basic level before JavaScript loads. Instead of React Router managing the
367
+ * submission, the browser manages the submission as well as the pending states
368
+ * (like the spinning favicon). After JavaScript loads, React Router takes over
369
+ * enabling web application user experiences.
370
+ *
371
+ * `Form` is most useful for submissions that should also change the URL or
372
+ * otherwise add an entry to the browser history stack. For forms that shouldn't
373
+ * manipulate the browser [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
374
+ * stack, use {@link FetcherWithComponents.Form | `<fetcher.Form>`}.
375
+ *
376
+ * @example
377
+ * import { Form } from "react-router";
378
+ *
379
+ * function NewEvent() {
380
+ * return (
381
+ * <Form action="/events" method="post">
382
+ * <input name="title" type="text" />
383
+ * <input name="description" type="text" />
384
+ * </Form>
385
+ * );
386
+ * }
387
+ *
388
+ * @public
389
+ * @category Components
390
+ * @mode framework
391
+ * @mode data
392
+ * @param {FormProps.action} action n/a
393
+ * @param {FormProps.discover} discover n/a
394
+ * @param {FormProps.encType} encType n/a
395
+ * @param {FormProps.fetcherKey} fetcherKey n/a
396
+ * @param {FormProps.method} method n/a
397
+ * @param {FormProps.navigate} navigate n/a
398
+ * @param {FormProps.preventScrollReset} preventScrollReset n/a
399
+ * @param {FormProps.relative} relative n/a
400
+ * @param {FormProps.reloadDocument} reloadDocument n/a
401
+ * @param {FormProps.replace} replace n/a
402
+ * @param {FormProps.state} state n/a
403
+ * @param {FormProps.viewTransition} viewTransition n/a
404
+ * @param {FormProps.defaultShouldRevalidate} defaultShouldRevalidate n/a
405
+ * @returns A progressively enhanced [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) component
406
+ */
407
+ var Form = import_react.forwardRef(({ discover = "render", fetcherKey, navigate, reloadDocument, replace, state, method = "get", action, onSubmit, relative, preventScrollReset, viewTransition, defaultShouldRevalidate, ...props }, forwardedRef) => {
408
+ let { useTransitions } = import_react.useContext(NavigationContext);
409
+ let submit = useSubmit();
410
+ let formAction = useFormAction(action, { relative });
411
+ let formMethod = method.toLowerCase() === "get" ? "get" : "post";
412
+ let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action);
413
+ let submitHandler = (event) => {
414
+ onSubmit && onSubmit(event);
415
+ if (event.defaultPrevented) return;
416
+ event.preventDefault();
417
+ let submitter = event.nativeEvent.submitter;
418
+ let submitMethod = submitter?.getAttribute("formmethod") || method;
419
+ let doSubmit = () => submit(submitter || event.currentTarget, {
420
+ fetcherKey,
421
+ method: submitMethod,
422
+ navigate,
423
+ replace,
424
+ state,
425
+ relative,
426
+ preventScrollReset,
427
+ viewTransition,
428
+ defaultShouldRevalidate
429
+ });
430
+ if (useTransitions && navigate !== false) import_react.startTransition(() => doSubmit());
431
+ else doSubmit();
432
+ };
433
+ return /* @__PURE__ */ import_react.createElement("form", {
434
+ ref: forwardedRef,
435
+ method: formMethod,
436
+ action: formAction,
437
+ onSubmit: reloadDocument ? onSubmit : submitHandler,
438
+ ...props,
439
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
440
+ });
441
+ });
442
+ Form.displayName = "Form";
443
+ /**
444
+ * Emulates the browser's scroll restoration on location changes. Apps should only render one of these, right before the {@link Scripts} component.
445
+ *
446
+ * ```tsx
447
+ * import { ScrollRestoration } from "react-router";
448
+ *
449
+ * export default function Root() {
450
+ * return (
451
+ * <html>
452
+ * <body>
453
+ * <ScrollRestoration />
454
+ * <Scripts />
455
+ * </body>
456
+ * </html>
457
+ * );
458
+ * }
459
+ * ```
460
+ *
461
+ * This component renders an inline `<script>` to prevent scroll flashing. The
462
+ * `nonce` prop will be passed down to the script tag to allow CSP nonce usage.
463
+ * If not provided in Framework Mode, it will default to any
464
+ * {@link ServerRouter | `<ServerRouter nonce>`} prop.
465
+ *
466
+ * ```tsx
467
+ * <ScrollRestoration nonce={cspNonce} />
468
+ * ```
469
+ *
470
+ * @public
471
+ * @category Components
472
+ * @mode framework
473
+ * @mode data
474
+ * @param props Props
475
+ * @param {ScrollRestorationProps.getKey} props.getKey n/a
476
+ * @param {ScriptsProps.nonce} props.nonce n/a
477
+ * @param {ScrollRestorationProps.storageKey} props.storageKey n/a
478
+ * @returns A [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
479
+ * tag that restores scroll positions on navigation.
480
+ */
481
+ function ScrollRestoration({ getKey, storageKey, ...props }) {
482
+ let remixContext = import_react.useContext(FrameworkContext);
483
+ let { basename } = import_react.useContext(NavigationContext);
484
+ let location = useLocation();
485
+ let matches = useMatches();
486
+ useScrollRestoration({
487
+ getKey,
488
+ storageKey
489
+ });
490
+ let ssrKey = import_react.useMemo(() => {
491
+ if (!remixContext || !getKey) return null;
492
+ let userKey = getScrollRestorationKey(location, matches, basename, getKey);
493
+ return userKey !== location.key ? userKey : null;
494
+ }, []);
495
+ if (!remixContext || remixContext.isSpaMode) return null;
496
+ let restoreScroll = ((storageKey, restoreKey) => {
497
+ if (!window.history.state || !window.history.state.key) {
498
+ let key = Math.random().toString(32).slice(2);
499
+ window.history.replaceState({ key }, "");
500
+ }
501
+ try {
502
+ let storedY = JSON.parse(sessionStorage.getItem(storageKey) || "{}")[restoreKey || window.history.state.key];
503
+ if (typeof storedY === "number") window.scrollTo(0, storedY);
504
+ } catch (error) {
505
+ console.error(error);
506
+ sessionStorage.removeItem(storageKey);
507
+ }
508
+ }).toString();
509
+ if (props.nonce == null && remixContext?.nonce) props.nonce = remixContext.nonce;
510
+ return /* @__PURE__ */ import_react.createElement("script", {
511
+ ...props,
512
+ suppressHydrationWarning: true,
513
+ dangerouslySetInnerHTML: { __html: `(${restoreScroll})(${escapeHtml(JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY))}, ${escapeHtml(JSON.stringify(ssrKey))})` }
514
+ });
515
+ }
516
+ ScrollRestoration.displayName = "ScrollRestoration";
517
+ /**
518
+ * Handles the click behavior for router {@link Link | `<Link>`} components.This
519
+ * is useful if you need to create custom {@link Link | `<Link>`} components with
520
+ * the same click behavior we use in our exported {@link Link | `<Link>`}.
521
+ *
522
+ * @public
523
+ * @category Hooks
524
+ * @param to The URL to navigate to, can be a string or a partial {@link Path}.
525
+ * @param options Options
526
+ * @param options.preventScrollReset Whether to prevent the scroll position from
527
+ * being reset to the top of the viewport on completion of the navigation when
528
+ * using the {@link ScrollRestoration} component. Defaults to `false`.
529
+ * @param options.relative The {@link RelativeRoutingType | relative routing type}
530
+ * to use for the link. Defaults to `"route"`.
531
+ * @param options.replace Whether to replace the current [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
532
+ * entry instead of pushing a new one. Defaults to `false`.
533
+ * @param options.state The state to add to the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
534
+ * entry for this navigation. Defaults to `undefined`.
535
+ * @param options.target The target attribute for the link. Defaults to `undefined`.
536
+ * @param options.viewTransition **Deprecated.** Use React's
537
+ * [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition) component
538
+ * instead. See the [migration guide](../../how-to/view-transitions).
539
+ * @param options.defaultShouldRevalidate Specify the default revalidation
540
+ * behavior for the navigation. When not specified, loaders revalidate
541
+ * according to the router's standard revalidation behavior.
542
+ * @param options.mask Masked location to display in the browser instead
543
+ * of the router location. Defaults to `undefined`.
544
+ * @param options.useTransitions Wraps the navigation in
545
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition)
546
+ * for concurrent rendering. Defaults to `false`.
547
+ * @returns A click handler function that can be used in a custom {@link Link} component.
548
+ */
549
+ function useLinkClickHandler(to, { target, replace: replaceProp, mask, state, preventScrollReset, relative, viewTransition, defaultShouldRevalidate, useTransitions } = {}) {
550
+ let navigate = useNavigate();
551
+ let location = useLocation();
552
+ let path = useResolvedPath(to, { relative });
553
+ return import_react.useCallback((event) => {
554
+ if (shouldProcessLinkClick(event, target)) {
555
+ event.preventDefault();
556
+ let replace = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
557
+ let doNavigate = () => navigate(to, {
558
+ replace,
559
+ mask,
560
+ state,
561
+ preventScrollReset,
562
+ relative,
563
+ viewTransition,
564
+ defaultShouldRevalidate
565
+ });
566
+ if (useTransitions) import_react.startTransition(() => doNavigate());
567
+ else doNavigate();
568
+ }
569
+ }, [
570
+ location,
571
+ navigate,
572
+ path,
573
+ replaceProp,
574
+ mask,
575
+ state,
576
+ target,
577
+ to,
578
+ preventScrollReset,
579
+ relative,
580
+ viewTransition,
581
+ defaultShouldRevalidate,
582
+ useTransitions
583
+ ]);
584
+ }
585
+ /**
586
+ * Returns a tuple of the current URL's [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
587
+ * and a function to update them. Setting the search params causes a navigation.
588
+ *
589
+ * ```tsx
590
+ * import { useSearchParams } from "react-router";
591
+ *
592
+ * export function SomeComponent() {
593
+ * const [searchParams, setSearchParams] = useSearchParams();
594
+ * // ...
595
+ * }
596
+ * ```
597
+ *
598
+ * ### `setSearchParams` function
599
+ *
600
+ * The second element of the tuple is a function that can be used to update the
601
+ * search params. It accepts the same types as `defaultInit` and will cause a
602
+ * navigation to the new URL.
603
+ *
604
+ * ```tsx
605
+ * let [searchParams, setSearchParams] = useSearchParams();
606
+ *
607
+ * // a search param string
608
+ * setSearchParams("?tab=1");
609
+ *
610
+ * // a shorthand object
611
+ * setSearchParams({ tab: "1" });
612
+ *
613
+ * // object keys can be arrays for multiple values on the key
614
+ * setSearchParams({ brand: ["nike", "reebok"] });
615
+ *
616
+ * // an array of tuples
617
+ * setSearchParams([["tab", "1"]]);
618
+ *
619
+ * // a `URLSearchParams` object
620
+ * setSearchParams(new URLSearchParams("?tab=1"));
621
+ * ```
622
+ *
623
+ * It also supports a function callback like React's
624
+ * [`setState`](https://react.dev/reference/react/useState#setstate):
625
+ *
626
+ * ```tsx
627
+ * setSearchParams((searchParams) => {
628
+ * searchParams.set("tab", "2");
629
+ * return searchParams;
630
+ * });
631
+ * ```
632
+ *
633
+ * <docs-warning>The function callback version of `setSearchParams` does not support
634
+ * the [queueing](https://react.dev/reference/react/useState#setstate-parameters)
635
+ * logic that React's `setState` implements. Multiple calls to `setSearchParams`
636
+ * in the same tick will not build on the prior value. If you need this behavior,
637
+ * you can use `setState` manually.</docs-warning>
638
+ *
639
+ * ### Notes
640
+ *
641
+ * Note that `searchParams` is a stable reference, so you can reliably use it
642
+ * as a dependency in React's [`useEffect`](https://react.dev/reference/react/useEffect)
643
+ * hooks.
644
+ *
645
+ * ```tsx
646
+ * useEffect(() => {
647
+ * console.log(searchParams.get("tab"));
648
+ * }, [searchParams]);
649
+ * ```
650
+ *
651
+ * However, this also means it's mutable. If you change the object without
652
+ * calling `setSearchParams`, its values will change between renders if some
653
+ * other state causes the component to re-render and URL will not reflect the
654
+ * values.
655
+ *
656
+ * @public
657
+ * @category Hooks
658
+ * @param defaultInit
659
+ * You can initialize the search params with a default value, though it **will
660
+ * not** change the URL on the first render.
661
+ *
662
+ * ```tsx
663
+ * // a search param string
664
+ * useSearchParams("?tab=1");
665
+ *
666
+ * // a shorthand object
667
+ * useSearchParams({ tab: "1" });
668
+ *
669
+ * // object keys can be arrays for multiple values on the key
670
+ * useSearchParams({ brand: ["nike", "reebok"] });
671
+ *
672
+ * // an array of tuples
673
+ * useSearchParams([["tab", "1"]]);
674
+ *
675
+ * // a `URLSearchParams` object
676
+ * useSearchParams(new URLSearchParams("?tab=1"));
677
+ * ```
678
+ * @returns A tuple of the current [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
679
+ * and a function to update them.
680
+ */
681
+ function useSearchParams(defaultInit) {
682
+ warning(typeof URLSearchParams !== "undefined", "You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");
683
+ let defaultSearchParamsRef = import_react.useRef(createSearchParams(defaultInit));
684
+ let hasSetSearchParamsRef = import_react.useRef(false);
685
+ let location = useLocation();
686
+ let searchParams = import_react.useMemo(() => getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current), [location.search]);
687
+ let navigate = useNavigate();
688
+ return [searchParams, import_react.useCallback((nextInit, navigateOptions) => {
689
+ const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit);
690
+ hasSetSearchParamsRef.current = true;
691
+ navigate("?" + newSearchParams, navigateOptions);
692
+ }, [navigate, searchParams])];
693
+ }
694
+ var fetcherId = 0;
695
+ var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
696
+ /**
697
+ * The imperative version of {@link Form | `<Form>`} that lets you submit a form
698
+ * from code instead of a user interaction.
699
+ *
700
+ * The `viewTransition` submission option is deprecated. Use React's
701
+ * [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition) component
702
+ * instead. See the [migration guide](../../how-to/view-transitions).
703
+ *
704
+ * @example
705
+ * import { useSubmit } from "react-router";
706
+ *
707
+ * function SomeComponent() {
708
+ * const submit = useSubmit();
709
+ * return (
710
+ * <Form onChange={(event) => submit(event.currentTarget)} />
711
+ * );
712
+ * }
713
+ *
714
+ * @public
715
+ * @category Hooks
716
+ * @mode framework
717
+ * @mode data
718
+ * @returns A function that can be called to submit a {@link Form} imperatively.
719
+ */
720
+ function useSubmit() {
721
+ let { router } = useDataRouterContext("useSubmit");
722
+ let { basename } = import_react.useContext(NavigationContext);
723
+ let currentRouteId = useCurrentRouteId("useSubmit");
724
+ let routerFetch = router.fetch;
725
+ let routerNavigate = router.navigate;
726
+ return import_react.useCallback(async (target, options = {}) => {
727
+ let { action, method, encType, formData, body } = getFormSubmissionInfo(target, basename);
728
+ if (options.navigate === false) await routerFetch(options.fetcherKey || getUniqueFetcherId(), currentRouteId, options.action || action, {
729
+ defaultShouldRevalidate: options.defaultShouldRevalidate,
730
+ preventScrollReset: options.preventScrollReset,
731
+ relative: options.relative,
732
+ formData,
733
+ body,
734
+ formMethod: options.method || method,
735
+ formEncType: options.encType || encType,
736
+ flushSync: options.flushSync
737
+ });
738
+ else await routerNavigate(options.action || action, {
739
+ defaultShouldRevalidate: options.defaultShouldRevalidate,
740
+ preventScrollReset: options.preventScrollReset,
741
+ relative: options.relative,
742
+ formData,
743
+ body,
744
+ formMethod: options.method || method,
745
+ formEncType: options.encType || encType,
746
+ replace: options.replace,
747
+ state: options.state,
748
+ fromRouteId: currentRouteId,
749
+ flushSync: options.flushSync,
750
+ viewTransition: options.viewTransition
751
+ });
752
+ }, [
753
+ routerFetch,
754
+ routerNavigate,
755
+ basename,
756
+ currentRouteId
757
+ ]);
758
+ }
759
+ /**
760
+ * Resolves the URL to the closest route in the component hierarchy instead of
761
+ * the current URL of the app.
762
+ *
763
+ * This is used internally by {@link Form} to resolve the `action` to the closest
764
+ * route, but can be used generically as well.
765
+ *
766
+ * ```ts
767
+ * import { useFormAction } from "react-router";
768
+ *
769
+ * function SomeComponent() {
770
+ * // closest route URL
771
+ * let action = useFormAction();
772
+ *
773
+ * // closest route URL + "destroy"
774
+ * let destroyAction = useFormAction("destroy");
775
+ * }
776
+ * ```
777
+ *
778
+ * <docs-info>This hook adds a `basename` if your app specifies one, so that it
779
+ * can be used with raw `<form>` elements in a progressively enhanced way. If
780
+ * you are using this to provide an `action` to `<Form>` or `fetcher.submit`, you
781
+ * will need to remove the `basename` since both of those will prepend it
782
+ * internally.</docs-info>
783
+ *
784
+ *
785
+ * @public
786
+ * @category Hooks
787
+ * @mode framework
788
+ * @mode data
789
+ * @param action The action to append to the closest route URL. Defaults to the
790
+ * closest route URL.
791
+ * @param options Options
792
+ * @param options.relative The relative routing type to use when resolving the
793
+ * action. Defaults to `"route"`.
794
+ * @returns The resolved action URL.
795
+ */
796
+ function useFormAction(action, { relative } = {}) {
797
+ let { basename } = import_react.useContext(NavigationContext);
798
+ let routeContext = import_react.useContext(RouteContext);
799
+ invariant(routeContext, "useFormAction must be used inside a RouteContext");
800
+ let [match] = routeContext.matches.slice(-1);
801
+ let path = { ...useResolvedPath(action ? action : ".", { relative }) };
802
+ let location = useLocation();
803
+ if (action == null) {
804
+ path.search = location.search;
805
+ let params = new URLSearchParams(path.search);
806
+ let indexValues = params.getAll("index");
807
+ if (indexValues.some((v) => v === "")) {
808
+ params.delete("index");
809
+ indexValues.filter((v) => v).forEach((v) => params.append("index", v));
810
+ let qs = params.toString();
811
+ path.search = qs ? `?${qs}` : "";
812
+ }
813
+ }
814
+ if ((!action || action === ".") && match.route.index) path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
815
+ if (basename !== "/") path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
816
+ return createPath(path);
817
+ }
818
+ var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
819
+ var savedScrollPositions = {};
820
+ function getScrollRestorationKey(location, matches, basename, getKey) {
821
+ let key = null;
822
+ if (getKey) if (basename !== "/") key = getKey({
823
+ ...location,
824
+ pathname: stripBasename(location.pathname, basename) || location.pathname
825
+ }, matches);
826
+ else key = getKey(location, matches);
827
+ if (key == null) key = location.key;
828
+ return key;
829
+ }
830
+ /**
831
+ * When rendered inside a {@link RouterProvider}, will restore scroll positions
832
+ * on navigations
833
+ *
834
+ * <!--
835
+ * Not marked `@public` because we only export as UNSAFE_ and therefore we don't
836
+ * maintain an .md file for this hook
837
+ * -->
838
+ *
839
+ * @name UNSAFE_useScrollRestoration
840
+ * @category Hooks
841
+ * @mode framework
842
+ * @mode data
843
+ * @param options Options
844
+ * @param options.getKey A function that returns a key to use for scroll restoration.
845
+ * This is useful for custom scroll restoration logic, such as using only the pathname
846
+ * so that subsequent navigations to prior paths will restore the scroll. Defaults
847
+ * to `location.key`.
848
+ * @param options.storageKey The key to use for storing scroll positions in
849
+ * `sessionStorage`. Defaults to `"react-router-scroll-positions"`.
850
+ * @returns {void}
851
+ */
852
+ function useScrollRestoration({ getKey, storageKey } = {}) {
853
+ let { router } = useDataRouterContext("useScrollRestoration");
854
+ let { restoreScrollPosition, preventScrollReset } = useDataRouterState("useScrollRestoration");
855
+ let { basename } = import_react.useContext(NavigationContext);
856
+ let location = useLocation();
857
+ let matches = useMatches();
858
+ let navigation = useNavigation();
859
+ import_react.useEffect(() => {
860
+ window.history.scrollRestoration = "manual";
861
+ return () => {
862
+ window.history.scrollRestoration = "auto";
863
+ };
864
+ }, []);
865
+ usePageShow(import_react.useCallback((event) => {
866
+ if (event.persisted) window.history.scrollRestoration = "manual";
867
+ }, []));
868
+ usePageHide(import_react.useCallback(() => {
869
+ if (navigation.state === "idle") {
870
+ let key = getScrollRestorationKey(location, matches, basename, getKey);
871
+ savedScrollPositions[key] = window.scrollY;
872
+ }
873
+ try {
874
+ sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));
875
+ } catch (error) {
876
+ warning(false, `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`);
877
+ }
878
+ window.history.scrollRestoration = "auto";
879
+ }, [
880
+ navigation.state,
881
+ getKey,
882
+ basename,
883
+ location,
884
+ matches,
885
+ storageKey
886
+ ]));
887
+ if (typeof document !== "undefined") {
888
+ import_react.useLayoutEffect(() => {
889
+ try {
890
+ let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
891
+ if (sessionPositions) savedScrollPositions = JSON.parse(sessionPositions);
892
+ } catch {}
893
+ }, [storageKey]);
894
+ import_react.useLayoutEffect(() => {
895
+ let disableScrollRestoration = router?.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKey ? (location, matches) => getScrollRestorationKey(location, matches, basename, getKey) : void 0);
896
+ return () => disableScrollRestoration && disableScrollRestoration();
897
+ }, [
898
+ router,
899
+ basename,
900
+ getKey
901
+ ]);
902
+ import_react.useLayoutEffect(() => {
903
+ if (restoreScrollPosition === false) return;
904
+ if (typeof restoreScrollPosition === "number") {
905
+ window.scrollTo(0, restoreScrollPosition);
906
+ return;
907
+ }
908
+ try {
909
+ if (location.hash) {
910
+ let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));
911
+ if (el) {
912
+ el.scrollIntoView();
913
+ return;
914
+ }
915
+ }
916
+ } catch {
917
+ warning(false, `"${location.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`);
918
+ }
919
+ if (preventScrollReset === true) return;
920
+ window.scrollTo(0, 0);
921
+ }, [
922
+ location,
923
+ restoreScrollPosition,
924
+ preventScrollReset
925
+ ]);
926
+ }
927
+ }
928
+ function usePageHide(callback, options) {
929
+ let { capture } = options || {};
930
+ import_react.useEffect(() => {
931
+ let opts = capture != null ? { capture } : void 0;
932
+ window.addEventListener("pagehide", callback, opts);
933
+ return () => {
934
+ window.removeEventListener("pagehide", callback, opts);
935
+ };
936
+ }, [callback, capture]);
937
+ }
938
+ function usePageShow(callback, options) {
939
+ let { capture } = options || {};
940
+ import_react.useEffect(() => {
941
+ let opts = capture != null ? { capture } : void 0;
942
+ window.addEventListener("pageshow", callback, opts);
943
+ return () => {
944
+ window.removeEventListener("pageshow", callback, opts);
945
+ };
946
+ }, [callback, capture]);
947
+ }
948
+ /**
949
+ * **Deprecated.** Use React's [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition)
950
+ * component to style transitions instead. This hook only tracks React Router's
951
+ * legacy view transitions, not transitions started by React. See the
952
+ * [migration guide](../../how-to/view-transitions).
953
+ *
954
+ * This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
955
+ * and the specified location matches either side of the navigation (the URL you are
956
+ * navigating **to** or the URL you are navigating **from**). This can be used to apply finer-grained styles to
957
+ * elements to further customize the view transition. This requires that view
958
+ * transitions have been enabled for the given navigation via {@link LinkProps.viewTransition}
959
+ * (or the `Form`, `submit`, or `navigate` call)
960
+ *
961
+ * @public
962
+ * @category Hooks
963
+ * @mode framework
964
+ * @mode data
965
+ * @param to The {@link To} location to compare against the active transition's current
966
+ * and next URLs.
967
+ * @param options Options
968
+ * @param options.relative The relative routing type to use when resolving the
969
+ * `to` location, defaults to `"route"`. See {@link RelativeRoutingType} for
970
+ * more details.
971
+ * @returns `true` if there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
972
+ * and the resolved path matches the transition's destination or source pathname, otherwise `false`.
973
+ *
974
+ * @deprecated Use React's `<ViewTransition>` component instead.
975
+ */
976
+ function useViewTransitionState(to, { relative } = {}) {
977
+ let vtContext = import_react.useContext(ViewTransitionContext);
978
+ invariant(vtContext != null, "`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");
979
+ let { basename } = useDataRouterContext("useViewTransitionState");
980
+ let path = useResolvedPath(to, { relative });
981
+ if (!vtContext.isTransitioning) return false;
982
+ let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
983
+ let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
984
+ return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
985
+ }
986
+ // ../../node_modules/.bun/@radix-ui+primitive@1.2.0/node_modules/@radix-ui/primitive/dist/index.mjs
987
+ var __defProp$17 = Object.defineProperty;
988
+ var __name$17 = (target, value) => __defProp$17(target, "name", {
989
+ value,
990
+ configurable: true
991
+ });
992
+ var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
5
993
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
6
- return function handleEvent(event) {
994
+ return /* @__PURE__ */ __name$17(function handleEvent(event) {
7
995
  originalEventHandler?.(event);
8
- if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler?.(event);
9
- };
996
+ if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) return ourEventHandler?.(event);
997
+ }, "handleEvent");
10
998
  }
11
- // ../../node_modules/.bun/@radix-ui+react-compose-refs@1.1.2+340ca8aed1dead99/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
12
- function setRef(ref, value) {
999
+ __name$17(composeEventHandlers, "composeEventHandlers");
1000
+ function getOwnerWindow(element) {
1001
+ if (!canUseDOM) throw new Error("Cannot access window outside of the DOM");
1002
+ return element?.ownerDocument?.defaultView ?? window;
1003
+ }
1004
+ __name$17(getOwnerWindow, "getOwnerWindow");
1005
+ function getOwnerDocument(element) {
1006
+ if (!canUseDOM) throw new Error("Cannot access document outside of the DOM");
1007
+ return element?.ownerDocument ?? document;
1008
+ }
1009
+ __name$17(getOwnerDocument, "getOwnerDocument");
1010
+ function getActiveElement(node, activeDescendant = false) {
1011
+ const { activeElement } = getOwnerDocument(node);
1012
+ if (!activeElement?.nodeName) return null;
1013
+ if (isFrame(activeElement) && activeElement.contentDocument) return getActiveElement(activeElement.contentDocument.body, activeDescendant);
1014
+ if (activeDescendant) {
1015
+ const id = activeElement.getAttribute("aria-activedescendant");
1016
+ if (id) {
1017
+ const element = getOwnerDocument(activeElement).getElementById(id);
1018
+ if (element) return element;
1019
+ }
1020
+ }
1021
+ return activeElement;
1022
+ }
1023
+ __name$17(getActiveElement, "getActiveElement");
1024
+ function isFrame(element) {
1025
+ return element.tagName === "IFRAME";
1026
+ }
1027
+ __name$17(isFrame, "isFrame");
1028
+ // ../../node_modules/.bun/@radix-ui+react-compose-refs@1.1.5+c841d34b494ec30a/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
1029
+ var __defProp$16 = Object.defineProperty;
1030
+ var __name$16 = (target, value) => __defProp$16(target, "name", {
1031
+ value,
1032
+ configurable: true
1033
+ });
1034
+ function setRef$1(ref, value) {
13
1035
  if (typeof ref === "function") return ref(value);
14
1036
  else if (ref !== null && ref !== void 0) ref.current = value;
15
1037
  }
1038
+ __name$16(setRef$1, "setRef");
16
1039
  function composeRefs(...refs) {
17
1040
  return (node) => {
18
1041
  let hasCleanup = false;
19
1042
  const cleanups = refs.map((ref) => {
20
- const cleanup = setRef(ref, node);
1043
+ const cleanup = setRef$1(ref, node);
21
1044
  if (!hasCleanup && typeof cleanup == "function") hasCleanup = true;
22
1045
  return cleanup;
23
1046
  });
@@ -25,23 +1048,57 @@ function composeRefs(...refs) {
25
1048
  for (let i = 0; i < cleanups.length; i++) {
26
1049
  const cleanup = cleanups[i];
27
1050
  if (typeof cleanup == "function") cleanup();
28
- else setRef(refs[i], null);
1051
+ else setRef$1(refs[i], null);
29
1052
  }
30
1053
  };
31
1054
  };
32
1055
  }
1056
+ __name$16(composeRefs, "composeRefs");
33
1057
  function useComposedRefs(...refs) {
34
1058
  return import_react.useCallback(composeRefs(...refs), refs);
35
1059
  }
36
- // ../../node_modules/.bun/@radix-ui+react-context@1.1.2+340ca8aed1dead99/node_modules/@radix-ui/react-context/dist/index.mjs
1060
+ __name$16(useComposedRefs, "useComposedRefs");
1061
+ // ../../node_modules/.bun/@radix-ui+react-context@1.3.0+c841d34b494ec30a/node_modules/@radix-ui/react-context/dist/index.mjs
37
1062
  var import_jsx_runtime = require_jsx_runtime();
1063
+ var __defProp$15 = Object.defineProperty;
1064
+ var __name$15 = (target, value) => __defProp$15(target, "name", {
1065
+ value,
1066
+ configurable: true
1067
+ });
1068
+ // @__NO_SIDE_EFFECTS__
1069
+ function createContext2(rootComponentName, defaultContext) {
1070
+ const Context = import_react.createContext(defaultContext);
1071
+ Context.displayName = rootComponentName + "Context";
1072
+ const Provider = /* @__PURE__ */ __name$15((props) => {
1073
+ const { children, ...context } = props;
1074
+ const value = import_react.useMemo(() => context, Object.values(context));
1075
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, {
1076
+ value,
1077
+ children
1078
+ });
1079
+ }, "Provider");
1080
+ Provider.displayName = rootComponentName + "Provider";
1081
+ function useContext2(consumerName, options = {}) {
1082
+ const { optional = false } = options;
1083
+ const context = import_react.useContext(Context);
1084
+ if (context) return context;
1085
+ if (defaultContext !== void 0) return defaultContext;
1086
+ if (optional) return void 0;
1087
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
1088
+ }
1089
+ __name$15(useContext2, "useContext");
1090
+ return [Provider, useContext2];
1091
+ }
1092
+ __name$15(createContext2, "createContext");
1093
+ // @__NO_SIDE_EFFECTS__
38
1094
  function createContextScope(scopeName, createContextScopeDeps = []) {
39
1095
  let defaultContexts = [];
40
1096
  function createContext3(rootComponentName, defaultContext) {
41
1097
  const BaseContext = import_react.createContext(defaultContext);
1098
+ BaseContext.displayName = rootComponentName + "Context";
42
1099
  const index = defaultContexts.length;
43
1100
  defaultContexts = [...defaultContexts, defaultContext];
44
- const Provider = (props) => {
1101
+ const Provider = /* @__PURE__ */ __name$15((props) => {
45
1102
  const { scope, children, ...context } = props;
46
1103
  const Context = scope?.[scopeName]?.[index] || BaseContext;
47
1104
  const value = import_react.useMemo(() => context, Object.values(context));
@@ -49,41 +1106,46 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
49
1106
  value,
50
1107
  children
51
1108
  });
52
- };
1109
+ }, "Provider");
53
1110
  Provider.displayName = rootComponentName + "Provider";
54
- function useContext2(consumerName, scope) {
1111
+ function useContext2(consumerName, scope, options = {}) {
1112
+ const { optional = false } = options;
55
1113
  const Context = scope?.[scopeName]?.[index] || BaseContext;
56
1114
  const context = import_react.useContext(Context);
57
1115
  if (context) return context;
58
1116
  if (defaultContext !== void 0) return defaultContext;
1117
+ if (optional) return void 0;
59
1118
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
60
1119
  }
1120
+ __name$15(useContext2, "useContext");
61
1121
  return [Provider, useContext2];
62
1122
  }
63
- const createScope = () => {
1123
+ __name$15(createContext3, "createContext");
1124
+ const createScope = /* @__PURE__ */ __name$15(() => {
64
1125
  const scopeContexts = defaultContexts.map((defaultContext) => {
65
1126
  return import_react.createContext(defaultContext);
66
1127
  });
67
- return function useScope(scope) {
1128
+ return /* @__PURE__ */ __name$15(function useScope(scope) {
68
1129
  const contexts = scope?.[scopeName] || scopeContexts;
69
1130
  return import_react.useMemo(() => ({ [`__scope${scopeName}`]: {
70
1131
  ...scope,
71
1132
  [scopeName]: contexts
72
1133
  } }), [scope, contexts]);
73
- };
74
- };
1134
+ }, "useScope");
1135
+ }, "createScope");
75
1136
  createScope.scopeName = scopeName;
76
1137
  return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
77
1138
  }
1139
+ __name$15(createContextScope, "createContextScope");
78
1140
  function composeContextScopes(...scopes) {
79
1141
  const baseScope = scopes[0];
80
1142
  if (scopes.length === 1) return baseScope;
81
- const createScope = () => {
1143
+ const createScope = /* @__PURE__ */ __name$15(() => {
82
1144
  const scopeHooks = scopes.map((createScope2) => ({
83
1145
  useScope: createScope2(),
84
1146
  scopeName: createScope2.scopeName
85
1147
  }));
86
- return function useComposedScopes(overrideScopes) {
1148
+ return /* @__PURE__ */ __name$15(function useComposedScopes(overrideScopes) {
87
1149
  const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
88
1150
  const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
89
1151
  return {
@@ -92,71 +1154,71 @@ function composeContextScopes(...scopes) {
92
1154
  };
93
1155
  }, {});
94
1156
  return import_react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
95
- };
96
- };
1157
+ }, "useComposedScopes");
1158
+ }, "createScope");
97
1159
  createScope.scopeName = baseScope.scopeName;
98
1160
  return createScope;
99
1161
  }
100
- // ../../node_modules/.bun/@radix-ui+react-slot@1.2.3+340ca8aed1dead99/node_modules/@radix-ui/react-slot/dist/index.mjs
1162
+ __name$15(composeContextScopes, "composeContextScopes");
1163
+ // ../../node_modules/.bun/@radix-ui+react-slot@1.5.0+c841d34b494ec30a/node_modules/@radix-ui/react-slot/dist/index.mjs
101
1164
  var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1);
1165
+ var __defProp$14 = Object.defineProperty;
1166
+ var __name$14 = (target, value) => __defProp$14(target, "name", {
1167
+ value,
1168
+ configurable: true
1169
+ });
102
1170
  // @__NO_SIDE_EFFECTS__
103
1171
  function createSlot(ownerName) {
104
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
105
1172
  const Slot2 = import_react.forwardRef((props, forwardedRef) => {
106
- const { children, ...slotProps } = props;
107
- const childrenArray = import_react.Children.toArray(children);
108
- const slottable = childrenArray.find(isSlottable);
109
- if (slottable) {
110
- const newElement = slottable.props.children;
111
- const newChildren = childrenArray.map((child) => {
112
- if (child === slottable) {
113
- if (import_react.Children.count(newElement) > 1) return import_react.Children.only(null);
114
- return import_react.isValidElement(newElement) ? newElement.props.children : null;
115
- } else return child;
116
- });
117
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotClone, {
118
- ...slotProps,
119
- ref: forwardedRef,
120
- children: import_react.isValidElement(newElement) ? import_react.cloneElement(newElement, void 0, newChildren) : null
121
- });
122
- }
123
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotClone, {
124
- ...slotProps,
125
- ref: forwardedRef,
126
- children
1173
+ let { children, ...slotProps } = props;
1174
+ let slottableElement = null;
1175
+ let hasSlottable = false;
1176
+ const newChildren = [];
1177
+ children = useUnwrappedLazy(children);
1178
+ import_react.Children.forEach(children, (maybeSlottable) => {
1179
+ if (isSlottable(maybeSlottable)) {
1180
+ hasSlottable = true;
1181
+ const slottable = maybeSlottable;
1182
+ let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
1183
+ while (isLazyComponent(child) && typeof use === "function") child = use(child._payload);
1184
+ slottableElement = getSlottableElementFromSlottable(slottable, child);
1185
+ newChildren.push(slottableElement?.props?.children);
1186
+ } else newChildren.push(maybeSlottable);
127
1187
  });
1188
+ if (slottableElement) slottableElement = import_react.cloneElement(slottableElement, void 0, newChildren);
1189
+ else if (!hasSlottable && import_react.Children.count(children) === 1 && import_react.isValidElement(children)) slottableElement = children;
1190
+ const slottableElementRef = slottableElement ? getElementRef$1(slottableElement) : void 0;
1191
+ const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
1192
+ if (!slottableElement) {
1193
+ if (children || children === 0) throw new Error(hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName));
1194
+ return children;
1195
+ }
1196
+ const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
1197
+ if (slottableElement.type !== import_react.Fragment) mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
1198
+ return import_react.cloneElement(slottableElement, mergedProps);
128
1199
  });
129
1200
  Slot2.displayName = `${ownerName}.Slot`;
130
1201
  return Slot2;
131
1202
  }
132
- // @__NO_SIDE_EFFECTS__
133
- function createSlotClone(ownerName) {
134
- const SlotClone = import_react.forwardRef((props, forwardedRef) => {
135
- const { children, ...slotProps } = props;
136
- if (import_react.isValidElement(children)) {
137
- const childrenRef = getElementRef$1(children);
138
- const props2 = mergeProps(slotProps, children.props);
139
- if (children.type !== import_react.Fragment) props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
140
- return import_react.cloneElement(children, props2);
141
- }
142
- return import_react.Children.count(children) > 1 ? import_react.Children.only(null) : null;
143
- });
144
- SlotClone.displayName = `${ownerName}.SlotClone`;
145
- return SlotClone;
146
- }
147
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
1203
+ __name$14(createSlot, "createSlot");
1204
+ var Slot = /* @__PURE__ */ createSlot("Slot");
1205
+ var SLOTTABLE_IDENTIFIER = Symbol.for("radix.slottable");
148
1206
  // @__NO_SIDE_EFFECTS__
149
1207
  function createSlottable(ownerName) {
150
- const Slottable2 = ({ children }) => {
151
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
152
- };
1208
+ const Slottable2 = /* @__PURE__ */ __name$14((props) => "child" in props ? props.children(props.child) : props.children, "Slottable");
153
1209
  Slottable2.displayName = `${ownerName}.Slottable`;
154
1210
  Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
155
1211
  return Slottable2;
156
1212
  }
157
- function isSlottable(child) {
158
- return import_react.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
159
- }
1213
+ __name$14(createSlottable, "createSlottable");
1214
+ var Slottable$1 = /* @__PURE__ */ createSlottable("Slottable");
1215
+ var getSlottableElementFromSlottable = /* @__PURE__ */ __name$14((slottable, child) => {
1216
+ if ("child" in slottable.props) {
1217
+ if (!import_react.isValidElement(child)) return null;
1218
+ return import_react.cloneElement(child, void 0, slottable.props.children(child.props.children));
1219
+ }
1220
+ return import_react.isValidElement(child) ? child : null;
1221
+ }, "getSlottableElementFromSlottable");
160
1222
  function mergeProps(slotProps, childProps) {
161
1223
  const overrideProps = { ...childProps };
162
1224
  for (const propName in childProps) {
@@ -174,12 +1236,14 @@ function mergeProps(slotProps, childProps) {
174
1236
  ...childPropValue
175
1237
  };
176
1238
  else if (propName === "className") overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
1239
+ else if (propName === "aria-describedby") overrideProps[propName] = concatAriaDescribedby$1(childPropValue, slotPropValue);
177
1240
  }
178
1241
  return {
179
1242
  ...slotProps,
180
1243
  ...overrideProps
181
1244
  };
182
1245
  }
1246
+ __name$14(mergeProps, "mergeProps");
183
1247
  function getElementRef$1(element) {
184
1248
  let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
185
1249
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
@@ -189,7 +1253,48 @@ function getElementRef$1(element) {
189
1253
  if (mayWarn) return element.props.ref;
190
1254
  return element.props.ref || element.ref;
191
1255
  }
192
- // ../../node_modules/.bun/@radix-ui+react-primitive@2.1.3+a68cb332b68cb125/node_modules/@radix-ui/react-primitive/dist/index.mjs
1256
+ __name$14(getElementRef$1, "getElementRef");
1257
+ function isSlottable(child) {
1258
+ return import_react.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
1259
+ }
1260
+ __name$14(isSlottable, "isSlottable");
1261
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
1262
+ function isLazyComponent(element) {
1263
+ return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
1264
+ }
1265
+ __name$14(isLazyComponent, "isLazyComponent");
1266
+ function isPromiseLike(value) {
1267
+ return typeof value === "object" && value !== null && "then" in value;
1268
+ }
1269
+ __name$14(isPromiseLike, "isPromiseLike");
1270
+ function useUnwrappedLazy(value) {
1271
+ let unwrapped = value;
1272
+ while (isLazyComponent(unwrapped) && typeof use === "function") unwrapped = use(unwrapped._payload);
1273
+ return unwrapped;
1274
+ }
1275
+ __name$14(useUnwrappedLazy, "useUnwrappedLazy");
1276
+ function concatAriaDescribedby$1(...values) {
1277
+ const ids = /* @__PURE__ */ new Set();
1278
+ for (const value of values) {
1279
+ if (typeof value !== "string") continue;
1280
+ for (const id of String(value).trim().split(/\s+/)) if (id) ids.add(id);
1281
+ }
1282
+ return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
1283
+ }
1284
+ __name$14(concatAriaDescribedby$1, "concatAriaDescribedby");
1285
+ var createSlotError = /* @__PURE__ */ __name$14((ownerName) => {
1286
+ return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
1287
+ }, "createSlotError");
1288
+ var createSlottableError = /* @__PURE__ */ __name$14((ownerName) => {
1289
+ return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
1290
+ }, "createSlottableError");
1291
+ var use = import_react[" use ".trim().toString()];
1292
+ // ../../node_modules/.bun/@radix-ui+react-primitive@2.2.0+b146eb580f4286be/node_modules/@radix-ui/react-primitive/dist/index.mjs
1293
+ var __defProp$13 = Object.defineProperty;
1294
+ var __name$13 = (target, value) => __defProp$13(target, "name", {
1295
+ value,
1296
+ configurable: true
1297
+ });
193
1298
  var Primitive = [
194
1299
  "a",
195
1300
  "button",
@@ -228,27 +1333,33 @@ var Primitive = [
228
1333
  function dispatchDiscreteCustomEvent(target, event) {
229
1334
  if (target) import_react_dom.flushSync(() => target.dispatchEvent(event));
230
1335
  }
231
- // ../../node_modules/.bun/@radix-ui+react-use-callback-ref@1.1.1+340ca8aed1dead99/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
1336
+ __name$13(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
1337
+ // ../../node_modules/.bun/@radix-ui+react-use-layout-effect@1.1.4+c841d34b494ec30a/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
1338
+ var useLayoutEffect2 = globalThis?.document ? import_react.useLayoutEffect : () => {};
1339
+ // ../../node_modules/.bun/@radix-ui+react-use-callback-ref@1.1.5+c841d34b494ec30a/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
1340
+ var __defProp$12 = Object.defineProperty;
1341
+ var __name$12 = (target, value) => __defProp$12(target, "name", {
1342
+ value,
1343
+ configurable: true
1344
+ });
1345
+ var useReactInsertionEffect$1 = import_react[" useInsertionEffect ".trim().toString()];
232
1346
  function useCallbackRef(callback) {
233
1347
  const callbackRef = import_react.useRef(callback);
234
- import_react.useEffect(() => {
1348
+ if (typeof useReactInsertionEffect$1 === "function") useReactInsertionEffect$1(() => {
235
1349
  callbackRef.current = callback;
236
1350
  });
237
- return import_react.useMemo(() => (...args) => callbackRef.current?.(...args), []);
238
- }
239
- // ../../node_modules/.bun/@radix-ui+react-use-escape-keydown@1.1.1+340ca8aed1dead99/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
240
- function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
241
- const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
242
- import_react.useEffect(() => {
243
- const handleKeyDown = (event) => {
244
- if (event.key === "Escape") onEscapeKeyDown(event);
245
- };
246
- ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
247
- return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
248
- }, [onEscapeKeyDown, ownerDocument]);
1351
+ else useLayoutEffect2(() => {
1352
+ callbackRef.current = callback;
1353
+ });
1354
+ return import_react.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
249
1355
  }
250
- // ../../node_modules/.bun/@radix-ui+react-dismissable-layer@1.1.11+a68cb332b68cb125/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
251
- var DISMISSABLE_LAYER_NAME = "DismissableLayer";
1356
+ __name$12(useCallbackRef, "useCallbackRef");
1357
+ // ../../node_modules/.bun/@radix-ui+react-dismissable-layer@1.2.1+b146eb580f4286be/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
1358
+ var __defProp$11 = Object.defineProperty;
1359
+ var __name$11 = (target, value) => __defProp$11(target, "name", {
1360
+ value,
1361
+ configurable: true
1362
+ });
252
1363
  var CONTEXT_UPDATE = "dismissableLayer.update";
253
1364
  var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
254
1365
  var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
@@ -256,44 +1367,64 @@ var originalBodyPointerEvents;
256
1367
  var DismissableLayerContext = import_react.createContext({
257
1368
  layers: /* @__PURE__ */ new Set(),
258
1369
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
259
- branches: /* @__PURE__ */ new Set()
1370
+ branches: /* @__PURE__ */ new Set(),
1371
+ dismissableSurfaces: /* @__PURE__ */ new Set()
260
1372
  });
261
- var DismissableLayer = import_react.forwardRef((props, forwardedRef) => {
262
- const { disableOutsidePointerEvents = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props;
1373
+ var DismissableLayer = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$11(function DismissableLayer2(props, forwardedRef) {
1374
+ const { disableOutsidePointerEvents = false, deferPointerDownOutside = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props;
263
1375
  const context = import_react.useContext(DismissableLayerContext);
264
1376
  const [node, setNode] = import_react.useState(null);
265
1377
  const ownerDocument = node?.ownerDocument ?? globalThis?.document;
266
1378
  const [, force] = import_react.useState({});
267
- const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
1379
+ const composedRefs = useComposedRefs(forwardedRef, setNode);
268
1380
  const layers = Array.from(context.layers);
269
1381
  const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
270
- const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
1382
+ const highestLayerWithOutsidePointerEventsDisabledIndex = highestLayerWithOutsidePointerEventsDisabled ? layers.indexOf(highestLayerWithOutsidePointerEventsDisabled) : -1;
271
1383
  const index = node ? layers.indexOf(node) : -1;
272
1384
  const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
273
1385
  const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
1386
+ const isDeferredPointerDownOutsideRef = import_react.useRef(false);
274
1387
  const pointerDownOutside = usePointerDownOutside((event) => {
275
- const target = event.target;
276
- const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
277
- if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
278
1388
  onPointerDownOutside?.(event);
279
1389
  onInteractOutside?.(event);
280
1390
  if (!event.defaultPrevented) onDismiss?.();
281
- }, ownerDocument);
1391
+ }, {
1392
+ ownerDocument,
1393
+ deferPointerDownOutside,
1394
+ isDeferredPointerDownOutsideRef,
1395
+ dismissableSurfaces: context.dismissableSurfaces,
1396
+ shouldHandlePointerDownOutside: import_react.useCallback((target) => {
1397
+ if (!(target instanceof Node)) return false;
1398
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
1399
+ return isPointerEventsEnabled && !isPointerDownOnBranch;
1400
+ }, [context.branches, isPointerEventsEnabled])
1401
+ });
282
1402
  const focusOutside = useFocusOutside((event) => {
1403
+ if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) return;
283
1404
  const target = event.target;
284
1405
  if ([...context.branches].some((branch) => branch.contains(target))) return;
285
1406
  onFocusOutside?.(event);
286
1407
  onInteractOutside?.(event);
287
1408
  if (!event.defaultPrevented) onDismiss?.();
288
1409
  }, ownerDocument);
289
- useEscapeKeydown((event) => {
290
- if (!(index === context.layers.size - 1)) return;
1410
+ const isHighestLayer = node ? index === layers.length - 1 : false;
1411
+ const handleKeyDown = useCallbackRef((event) => {
1412
+ if (event.key !== "Escape") return;
291
1413
  onEscapeKeyDown?.(event);
292
1414
  if (!event.defaultPrevented && onDismiss) {
293
1415
  event.preventDefault();
294
1416
  onDismiss();
295
1417
  }
296
- }, ownerDocument);
1418
+ });
1419
+ import_react.useEffect(() => {
1420
+ if (!isHighestLayer) return;
1421
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
1422
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
1423
+ }, [
1424
+ ownerDocument,
1425
+ isHighestLayer,
1426
+ handleKeyDown
1427
+ ]);
297
1428
  import_react.useEffect(() => {
298
1429
  if (!node) return;
299
1430
  if (disableOutsidePointerEvents) {
@@ -306,7 +1437,10 @@ var DismissableLayer = import_react.forwardRef((props, forwardedRef) => {
306
1437
  context.layers.add(node);
307
1438
  dispatchUpdate();
308
1439
  return () => {
309
- if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
1440
+ if (disableOutsidePointerEvents) {
1441
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
1442
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
1443
+ }
310
1444
  };
311
1445
  }, [
312
1446
  node,
@@ -323,7 +1457,7 @@ var DismissableLayer = import_react.forwardRef((props, forwardedRef) => {
323
1457
  };
324
1458
  }, [node, context]);
325
1459
  import_react.useEffect(() => {
326
- const handleUpdate = () => force({});
1460
+ const handleUpdate = /* @__PURE__ */ __name$11(() => force({}), "handleUpdate");
327
1461
  document.addEventListener(CONTEXT_UPDATE, handleUpdate);
328
1462
  return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
329
1463
  }, []);
@@ -338,47 +1472,95 @@ var DismissableLayer = import_react.forwardRef((props, forwardedRef) => {
338
1472
  onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
339
1473
  onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
340
1474
  });
341
- });
342
- DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
343
- var BRANCH_NAME = "DismissableLayerBranch";
344
- var DismissableLayerBranch = import_react.forwardRef((props, forwardedRef) => {
1475
+ }, "DismissableLayer"));
1476
+ function useDismissableLayerSurface() {
345
1477
  const context = import_react.useContext(DismissableLayerContext);
346
- const ref = import_react.useRef(null);
347
- const composedRefs = useComposedRefs(forwardedRef, ref);
1478
+ const [node, setNode] = import_react.useState(null);
348
1479
  import_react.useEffect(() => {
349
- const node = ref.current;
350
- if (node) {
351
- context.branches.add(node);
352
- return () => {
353
- context.branches.delete(node);
354
- };
355
- }
356
- }, [context.branches]);
357
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
358
- ...props,
359
- ref: composedRefs
360
- });
361
- });
362
- DismissableLayerBranch.displayName = BRANCH_NAME;
363
- function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
1480
+ if (!node) return;
1481
+ context.dismissableSurfaces.add(node);
1482
+ return () => {
1483
+ context.dismissableSurfaces.delete(node);
1484
+ };
1485
+ }, [node, context.dismissableSurfaces]);
1486
+ return setNode;
1487
+ }
1488
+ __name$11(useDismissableLayerSurface, "useDismissableLayerSurface");
1489
+ var IS_TRUE = /* @__PURE__ */ __name$11(() => true, "IS_TRUE");
1490
+ function usePointerDownOutside(onPointerDownOutside, args) {
1491
+ const { ownerDocument = globalThis?.document, deferPointerDownOutside = false, isDeferredPointerDownOutsideRef, dismissableSurfaces, shouldHandlePointerDownOutside = IS_TRUE } = args;
364
1492
  const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
365
1493
  const isPointerInsideReactTreeRef = import_react.useRef(false);
1494
+ const isPointerDownOutsideRef = import_react.useRef(false);
1495
+ const interceptedOutsideInteractionEventsRef = import_react.useRef(/* @__PURE__ */ new Map());
366
1496
  const handleClickRef = import_react.useRef(() => {});
367
1497
  import_react.useEffect(() => {
368
- const handlePointerDown = (event) => {
1498
+ function resetOutsideInteraction() {
1499
+ isPointerDownOutsideRef.current = false;
1500
+ isDeferredPointerDownOutsideRef.current = false;
1501
+ interceptedOutsideInteractionEventsRef.current.clear();
1502
+ }
1503
+ __name$11(resetOutsideInteraction, "resetOutsideInteraction");
1504
+ function isOutsideInteractionIntercepted() {
1505
+ return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);
1506
+ }
1507
+ __name$11(isOutsideInteractionIntercepted, "isOutsideInteractionIntercepted");
1508
+ function handleInteractionCapture(event) {
1509
+ if (!isPointerDownOutsideRef.current) return;
1510
+ const target = event.target;
1511
+ if (!(target instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target)))) interceptedOutsideInteractionEventsRef.current.set(event.type, true);
1512
+ if (event.type === "click") window.setTimeout(() => {
1513
+ if (isPointerDownOutsideRef.current) handleClickRef.current();
1514
+ }, 0);
1515
+ }
1516
+ __name$11(handleInteractionCapture, "handleInteractionCapture");
1517
+ function handleInteractionBubble(event) {
1518
+ if (isPointerDownOutsideRef.current) interceptedOutsideInteractionEventsRef.current.set(event.type, false);
1519
+ }
1520
+ __name$11(handleInteractionBubble, "handleInteractionBubble");
1521
+ const handlePointerDown = /* @__PURE__ */ __name$11((event) => {
369
1522
  if (event.target && !isPointerInsideReactTreeRef.current) {
370
1523
  let handleAndDispatchPointerDownOutsideEvent2 = function() {
371
- handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true });
1524
+ ownerDocument.removeEventListener("click", handleClickRef.current);
1525
+ const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted();
1526
+ resetOutsideInteraction();
1527
+ if (!wasOutsideInteractionIntercepted) handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true });
372
1528
  };
1529
+ __name$11(handleAndDispatchPointerDownOutsideEvent2, "handleAndDispatchPointerDownOutsideEvent");
1530
+ if (!shouldHandlePointerDownOutside(event.target)) {
1531
+ ownerDocument.removeEventListener("click", handleClickRef.current);
1532
+ resetOutsideInteraction();
1533
+ isPointerInsideReactTreeRef.current = false;
1534
+ return;
1535
+ }
373
1536
  const eventDetail = { originalEvent: event };
374
- if (event.pointerType === "touch") {
1537
+ isPointerDownOutsideRef.current = true;
1538
+ isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;
1539
+ interceptedOutsideInteractionEventsRef.current.clear();
1540
+ if (!deferPointerDownOutside || event.button !== 0) handleAndDispatchPointerDownOutsideEvent2();
1541
+ else {
375
1542
  ownerDocument.removeEventListener("click", handleClickRef.current);
376
1543
  handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
377
1544
  ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
378
- } else handleAndDispatchPointerDownOutsideEvent2();
379
- } else ownerDocument.removeEventListener("click", handleClickRef.current);
1545
+ }
1546
+ } else {
1547
+ ownerDocument.removeEventListener("click", handleClickRef.current);
1548
+ resetOutsideInteraction();
1549
+ }
380
1550
  isPointerInsideReactTreeRef.current = false;
381
- };
1551
+ }, "handlePointerDown");
1552
+ const outsideInteractionEvents = [
1553
+ "pointerup",
1554
+ "mousedown",
1555
+ "mouseup",
1556
+ "touchstart",
1557
+ "touchend",
1558
+ "click"
1559
+ ];
1560
+ for (const eventName of outsideInteractionEvents) {
1561
+ ownerDocument.addEventListener(eventName, handleInteractionCapture, true);
1562
+ ownerDocument.addEventListener(eventName, handleInteractionBubble);
1563
+ }
382
1564
  const timerId = window.setTimeout(() => {
383
1565
  ownerDocument.addEventListener("pointerdown", handlePointerDown);
384
1566
  }, 0);
@@ -386,29 +1568,43 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
386
1568
  window.clearTimeout(timerId);
387
1569
  ownerDocument.removeEventListener("pointerdown", handlePointerDown);
388
1570
  ownerDocument.removeEventListener("click", handleClickRef.current);
1571
+ for (const eventName of outsideInteractionEvents) {
1572
+ ownerDocument.removeEventListener(eventName, handleInteractionCapture, true);
1573
+ ownerDocument.removeEventListener(eventName, handleInteractionBubble);
1574
+ }
389
1575
  };
390
- }, [ownerDocument, handlePointerDownOutside]);
391
- return { onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true };
1576
+ }, [
1577
+ ownerDocument,
1578
+ handlePointerDownOutside,
1579
+ deferPointerDownOutside,
1580
+ isDeferredPointerDownOutsideRef,
1581
+ dismissableSurfaces,
1582
+ shouldHandlePointerDownOutside
1583
+ ]);
1584
+ return { onPointerDownCapture: /* @__PURE__ */ __name$11(() => isPointerInsideReactTreeRef.current = true, "onPointerDownCapture") };
392
1585
  }
1586
+ __name$11(usePointerDownOutside, "usePointerDownOutside");
393
1587
  function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
394
1588
  const handleFocusOutside = useCallbackRef(onFocusOutside);
395
1589
  const isFocusInsideReactTreeRef = import_react.useRef(false);
396
1590
  import_react.useEffect(() => {
397
- const handleFocus = (event) => {
1591
+ const handleFocus = /* @__PURE__ */ __name$11((event) => {
398
1592
  if (event.target && !isFocusInsideReactTreeRef.current) handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, { originalEvent: event }, { discrete: false });
399
- };
1593
+ }, "handleFocus");
400
1594
  ownerDocument.addEventListener("focusin", handleFocus);
401
1595
  return () => ownerDocument.removeEventListener("focusin", handleFocus);
402
1596
  }, [ownerDocument, handleFocusOutside]);
403
1597
  return {
404
- onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
405
- onBlurCapture: () => isFocusInsideReactTreeRef.current = false
1598
+ onFocusCapture: /* @__PURE__ */ __name$11(() => isFocusInsideReactTreeRef.current = true, "onFocusCapture"),
1599
+ onBlurCapture: /* @__PURE__ */ __name$11(() => isFocusInsideReactTreeRef.current = false, "onBlurCapture")
406
1600
  };
407
1601
  }
1602
+ __name$11(useFocusOutside, "useFocusOutside");
408
1603
  function dispatchUpdate() {
409
1604
  const event = new CustomEvent(CONTEXT_UPDATE);
410
1605
  document.dispatchEvent(event);
411
1606
  }
1607
+ __name$11(dispatchUpdate, "dispatchUpdate");
412
1608
  function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
413
1609
  const target = detail.originalEvent.target;
414
1610
  const event = new CustomEvent(name, {
@@ -420,9 +1616,259 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
420
1616
  if (discrete) dispatchDiscreteCustomEvent(target, event);
421
1617
  else target.dispatchEvent(event);
422
1618
  }
423
- // ../../node_modules/.bun/@radix-ui+react-use-layout-effect@1.1.1+340ca8aed1dead99/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
424
- var useLayoutEffect2 = globalThis?.document ? import_react.useLayoutEffect : () => {};
425
- // ../../node_modules/.bun/@radix-ui+react-id@1.1.1+340ca8aed1dead99/node_modules/@radix-ui/react-id/dist/index.mjs
1619
+ __name$11(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent");
1620
+ // ../../node_modules/.bun/@radix-ui+react-focus-scope@1.3.1+b146eb580f4286be/node_modules/@radix-ui/react-focus-scope/dist/index.mjs
1621
+ var __defProp$10 = Object.defineProperty;
1622
+ var __name$10 = (target, value) => __defProp$10(target, "name", {
1623
+ value,
1624
+ configurable: true
1625
+ });
1626
+ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
1627
+ var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
1628
+ var EVENT_OPTIONS = {
1629
+ bubbles: false,
1630
+ cancelable: true
1631
+ };
1632
+ var FocusScope = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$10(function FocusScope2(props, forwardedRef) {
1633
+ const { loop = false, trapped = false, branches, onMountAutoFocus: onMountAutoFocusProp, onUnmountAutoFocus: onUnmountAutoFocusProp, ...scopeProps } = props;
1634
+ const [container, setContainer] = import_react.useState(null);
1635
+ const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
1636
+ const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
1637
+ const lastFocusedElementRef = import_react.useRef(null);
1638
+ const composedRefs = useComposedRefs(forwardedRef, setContainer);
1639
+ const branchesRef = import_react.useRef(branches);
1640
+ import_react.useEffect(() => {
1641
+ branchesRef.current = branches;
1642
+ });
1643
+ const isTargetInScope = import_react.useCallback((target) => {
1644
+ if (!target) return false;
1645
+ if (container?.contains(target)) return true;
1646
+ return Boolean(branchesRef.current?.some((branch) => branch.contains(target)));
1647
+ }, [container]);
1648
+ const focusScope = import_react.useRef({
1649
+ paused: false,
1650
+ pause() {
1651
+ this.paused = true;
1652
+ },
1653
+ resume() {
1654
+ this.paused = false;
1655
+ }
1656
+ }).current;
1657
+ import_react.useEffect(() => {
1658
+ if (trapped) {
1659
+ let handleFocusIn2 = function(event) {
1660
+ if (focusScope.paused || !container) return;
1661
+ const target = event.target;
1662
+ if (isTargetInScope(target)) lastFocusedElementRef.current = target;
1663
+ else focus(lastFocusedElementRef.current, { select: true });
1664
+ }, handleFocusOut2 = function(event) {
1665
+ if (focusScope.paused || !container) return;
1666
+ const relatedTarget = event.relatedTarget;
1667
+ if (relatedTarget === null) return;
1668
+ if (!isTargetInScope(relatedTarget)) focus(lastFocusedElementRef.current, { select: true });
1669
+ }, handleMutations2 = function(mutations) {
1670
+ if (document.activeElement !== document.body) return;
1671
+ for (const mutation of mutations) if (mutation.removedNodes.length > 0) focus(container);
1672
+ };
1673
+ __name$10(handleFocusIn2, "handleFocusIn");
1674
+ __name$10(handleFocusOut2, "handleFocusOut");
1675
+ __name$10(handleMutations2, "handleMutations");
1676
+ document.addEventListener("focusin", handleFocusIn2);
1677
+ document.addEventListener("focusout", handleFocusOut2);
1678
+ const mutationObserver = new MutationObserver(handleMutations2);
1679
+ if (container) mutationObserver.observe(container, {
1680
+ childList: true,
1681
+ subtree: true
1682
+ });
1683
+ return () => {
1684
+ document.removeEventListener("focusin", handleFocusIn2);
1685
+ document.removeEventListener("focusout", handleFocusOut2);
1686
+ mutationObserver.disconnect();
1687
+ };
1688
+ }
1689
+ }, [
1690
+ trapped,
1691
+ container,
1692
+ focusScope.paused,
1693
+ isTargetInScope
1694
+ ]);
1695
+ import_react.useEffect(() => {
1696
+ if (container) {
1697
+ focusScopesStack.add(focusScope);
1698
+ const previouslyFocusedElement = document.activeElement;
1699
+ if (!container.contains(previouslyFocusedElement)) {
1700
+ const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
1701
+ container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
1702
+ container.dispatchEvent(mountEvent);
1703
+ if (!mountEvent.defaultPrevented) {
1704
+ focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
1705
+ if (document.activeElement === previouslyFocusedElement) focus(container);
1706
+ }
1707
+ }
1708
+ return () => {
1709
+ container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
1710
+ const ownerDocument = container.ownerDocument;
1711
+ const UnmountEvent = CustomEvent;
1712
+ setTimeout(() => {
1713
+ const unmountEvent = new UnmountEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
1714
+ container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
1715
+ container.dispatchEvent(unmountEvent);
1716
+ if (!unmountEvent.defaultPrevented) focus(previouslyFocusedElement ?? ownerDocument.body, { select: true });
1717
+ container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
1718
+ focusScopesStack.remove(focusScope);
1719
+ }, 0);
1720
+ };
1721
+ }
1722
+ }, [
1723
+ container,
1724
+ onMountAutoFocus,
1725
+ onUnmountAutoFocus,
1726
+ focusScope
1727
+ ]);
1728
+ const handleKeyDown = import_react.useCallback((event) => {
1729
+ if (!loop && !trapped) return;
1730
+ if (focusScope.paused) return;
1731
+ const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
1732
+ const focusedElement = document.activeElement;
1733
+ if (isTabKey && focusedElement) {
1734
+ const container2 = event.currentTarget;
1735
+ const [first, last] = getTabbableEdges(container2);
1736
+ if (!(first && last)) {
1737
+ if (focusedElement === container2) event.preventDefault();
1738
+ } else if (!event.shiftKey && focusedElement === last) {
1739
+ event.preventDefault();
1740
+ if (loop) focus(first, { select: true });
1741
+ } else if (event.shiftKey && focusedElement === first) {
1742
+ event.preventDefault();
1743
+ if (loop) focus(last, { select: true });
1744
+ }
1745
+ }
1746
+ }, [
1747
+ loop,
1748
+ trapped,
1749
+ focusScope.paused
1750
+ ]);
1751
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
1752
+ tabIndex: -1,
1753
+ ...scopeProps,
1754
+ ref: composedRefs,
1755
+ onKeyDown: handleKeyDown
1756
+ });
1757
+ }, "FocusScope"));
1758
+ var FocusScopeBranchContext = import_react.createContext(null);
1759
+ function FocusScopeBranchProvider({ registry, children }) {
1760
+ if (!registry) return children;
1761
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FocusScopeBranchContext.Provider, {
1762
+ value: registry,
1763
+ children
1764
+ });
1765
+ }
1766
+ __name$10(FocusScopeBranchProvider, "FocusScopeBranchProvider");
1767
+ function useFocusScopeBranchRegistry() {
1768
+ const [nodes, setNodes] = import_react.useState([]);
1769
+ return {
1770
+ nodes,
1771
+ registry: import_react.useMemo(() => ({
1772
+ add: /* @__PURE__ */ __name$10((node) => setNodes((prev) => prev.includes(node) ? prev : [...prev, node]), "add"),
1773
+ remove: /* @__PURE__ */ __name$10((node) => setNodes((prev) => prev.filter((current) => current !== node)), "remove")
1774
+ }), [])
1775
+ };
1776
+ }
1777
+ __name$10(useFocusScopeBranchRegistry, "useFocusScopeBranchRegistry");
1778
+ function useFocusScopeBranch(node) {
1779
+ const registry = import_react.useContext(FocusScopeBranchContext);
1780
+ import_react.useEffect(() => {
1781
+ if (!node || !registry) return;
1782
+ registry.add(node);
1783
+ return () => registry.remove(node);
1784
+ }, [node, registry]);
1785
+ }
1786
+ __name$10(useFocusScopeBranch, "useFocusScopeBranch");
1787
+ function focusFirst(candidates, { select = false } = {}) {
1788
+ const previouslyFocusedElement = document.activeElement;
1789
+ for (const candidate of candidates) {
1790
+ focus(candidate, { select });
1791
+ if (document.activeElement !== previouslyFocusedElement) return;
1792
+ }
1793
+ }
1794
+ __name$10(focusFirst, "focusFirst");
1795
+ function getTabbableEdges(container) {
1796
+ const candidates = getTabbableCandidates(container);
1797
+ return [findVisible(candidates, container), findVisible(candidates.reverse(), container)];
1798
+ }
1799
+ __name$10(getTabbableEdges, "getTabbableEdges");
1800
+ function getTabbableCandidates(container) {
1801
+ const nodes = [];
1802
+ const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode: /* @__PURE__ */ __name$10((node) => {
1803
+ const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
1804
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
1805
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
1806
+ }, "acceptNode") });
1807
+ while (walker.nextNode()) nodes.push(walker.currentNode);
1808
+ return nodes;
1809
+ }
1810
+ __name$10(getTabbableCandidates, "getTabbableCandidates");
1811
+ function findVisible(elements, container) {
1812
+ const canUseCheckVisibility = typeof container.checkVisibility === "function" && container.checkVisibility({ checkVisibilityCSS: true });
1813
+ for (const element of elements) if (!(canUseCheckVisibility ? !element.checkVisibility({ checkVisibilityCSS: true }) : isHidden(element, { upTo: container }))) return element;
1814
+ }
1815
+ __name$10(findVisible, "findVisible");
1816
+ function isHidden(node, { upTo }) {
1817
+ if (getComputedStyle(node).visibility === "hidden") return true;
1818
+ while (node) {
1819
+ if (upTo !== void 0 && node === upTo) return false;
1820
+ if (getComputedStyle(node).display === "none") return true;
1821
+ node = node.parentElement;
1822
+ }
1823
+ return false;
1824
+ }
1825
+ __name$10(isHidden, "isHidden");
1826
+ function isSelectableInput(element) {
1827
+ return element.tagName === "INPUT" && typeof element.select === "function";
1828
+ }
1829
+ __name$10(isSelectableInput, "isSelectableInput");
1830
+ function focus(element, { select = false } = {}) {
1831
+ if (element && element.focus) {
1832
+ const previouslyFocusedElement = (element.ownerDocument ?? document).activeElement;
1833
+ element.focus({ preventScroll: true });
1834
+ if (element !== previouslyFocusedElement && isSelectableInput(element) && select) element.select();
1835
+ }
1836
+ }
1837
+ __name$10(focus, "focus");
1838
+ var focusScopesStack = createFocusScopesStack();
1839
+ function createFocusScopesStack() {
1840
+ let stack = [];
1841
+ return {
1842
+ add(focusScope) {
1843
+ const activeFocusScope = stack[0];
1844
+ if (focusScope !== activeFocusScope) activeFocusScope?.pause();
1845
+ stack = arrayRemove(stack, focusScope);
1846
+ stack.unshift(focusScope);
1847
+ },
1848
+ remove(focusScope) {
1849
+ stack = arrayRemove(stack, focusScope);
1850
+ stack[0]?.resume();
1851
+ }
1852
+ };
1853
+ }
1854
+ __name$10(createFocusScopesStack, "createFocusScopesStack");
1855
+ function arrayRemove(array, item) {
1856
+ const updatedArray = [...array];
1857
+ const index = updatedArray.indexOf(item);
1858
+ if (index !== -1) updatedArray.splice(index, 1);
1859
+ return updatedArray;
1860
+ }
1861
+ __name$10(arrayRemove, "arrayRemove");
1862
+ function removeLinks(items) {
1863
+ return items.filter((item) => item.tagName !== "A");
1864
+ }
1865
+ __name$10(removeLinks, "removeLinks");
1866
+ // ../../node_modules/.bun/@radix-ui+react-id@1.1.4+c841d34b494ec30a/node_modules/@radix-ui/react-id/dist/index.mjs
1867
+ var __defProp$9 = Object.defineProperty;
1868
+ var __name$9 = (target, value) => __defProp$9(target, "name", {
1869
+ value,
1870
+ configurable: true
1871
+ });
426
1872
  var useReactId = import_react[" useId ".trim().toString()] || (() => void 0);
427
1873
  var count = 0;
428
1874
  function useId(deterministicId) {
@@ -432,6 +1878,7 @@ function useId(deterministicId) {
432
1878
  }, [deterministicId]);
433
1879
  return deterministicId || (id ? `radix-${id}` : "");
434
1880
  }
1881
+ __name$9(useId, "useId");
435
1882
  // ../../node_modules/.bun/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
436
1883
  /**
437
1884
  * Custom positioning reference element.
@@ -1745,7 +3192,7 @@ var computePosition = (reference, floating, options) => {
1745
3192
  platform: platformWithCache
1746
3193
  });
1747
3194
  };
1748
- // ../../node_modules/.bun/@floating-ui+react-dom@2.1.9+dfc90389513bb65c/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
3195
+ // ../../node_modules/.bun/@floating-ui+react-dom@2.1.9+ab9c01e4ccdf52df/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
1749
3196
  var index = typeof document !== "undefined" ? import_react.useLayoutEffect : function noop() {};
1750
3197
  function deepEqual(a, b) {
1751
3198
  if (a === b) return true;
@@ -2058,9 +3505,13 @@ var arrow = (options, deps) => {
2058
3505
  options: [options, deps]
2059
3506
  };
2060
3507
  };
2061
- // ../../node_modules/.bun/@radix-ui+react-arrow@1.1.7+a68cb332b68cb125/node_modules/@radix-ui/react-arrow/dist/index.mjs
2062
- var NAME$1 = "Arrow";
2063
- var Arrow$1 = import_react.forwardRef((props, forwardedRef) => {
3508
+ // ../../node_modules/.bun/@radix-ui+react-arrow@1.1.17+b146eb580f4286be/node_modules/@radix-ui/react-arrow/dist/index.mjs
3509
+ var __defProp$8 = Object.defineProperty;
3510
+ var __name$8 = (target, value) => __defProp$8(target, "name", {
3511
+ value,
3512
+ configurable: true
3513
+ });
3514
+ var Arrow = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$8(function Arrow2(props, forwardedRef) {
2064
3515
  const { children, width = 10, height = 5, ...arrowProps } = props;
2065
3516
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.svg, {
2066
3517
  ...arrowProps,
@@ -2071,10 +3522,13 @@ var Arrow$1 = import_react.forwardRef((props, forwardedRef) => {
2071
3522
  preserveAspectRatio: "none",
2072
3523
  children: props.asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polygon", { points: "0,0 30,0 15,10" })
2073
3524
  });
3525
+ }, "Arrow"));
3526
+ // ../../node_modules/.bun/@radix-ui+react-use-size@1.1.5+c841d34b494ec30a/node_modules/@radix-ui/react-use-size/dist/index.mjs
3527
+ var __defProp$7 = Object.defineProperty;
3528
+ var __name$7 = (target, value) => __defProp$7(target, "name", {
3529
+ value,
3530
+ configurable: true
2074
3531
  });
2075
- Arrow$1.displayName = NAME$1;
2076
- var Root$1 = Arrow$1;
2077
- // ../../node_modules/.bun/@radix-ui+react-use-size@1.1.1+340ca8aed1dead99/node_modules/@radix-ui/react-use-size/dist/index.mjs
2078
3532
  function useSize(element) {
2079
3533
  const [size, setSize] = import_react.useState(void 0);
2080
3534
  useLayoutEffect2(() => {
@@ -2083,72 +3537,104 @@ function useSize(element) {
2083
3537
  width: element.offsetWidth,
2084
3538
  height: element.offsetHeight
2085
3539
  });
3540
+ let rAF = 0;
2086
3541
  const resizeObserver = new ResizeObserver((entries) => {
2087
3542
  if (!Array.isArray(entries)) return;
2088
3543
  if (!entries.length) return;
2089
3544
  const entry = entries[0];
2090
- let width;
2091
- let height;
2092
- if ("borderBoxSize" in entry) {
2093
- const borderSizeEntry = entry["borderBoxSize"];
2094
- const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
2095
- width = borderSize["inlineSize"];
2096
- height = borderSize["blockSize"];
2097
- } else {
2098
- width = element.offsetWidth;
2099
- height = element.offsetHeight;
2100
- }
2101
- setSize({
2102
- width,
2103
- height
3545
+ window.cancelAnimationFrame(rAF);
3546
+ rAF = window.requestAnimationFrame(() => {
3547
+ let width;
3548
+ let height;
3549
+ if ("borderBoxSize" in entry) {
3550
+ const borderSizeEntry = entry["borderBoxSize"];
3551
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
3552
+ width = borderSize["inlineSize"];
3553
+ height = borderSize["blockSize"];
3554
+ } else {
3555
+ width = element.offsetWidth;
3556
+ height = element.offsetHeight;
3557
+ }
3558
+ setSize({
3559
+ width,
3560
+ height
3561
+ });
2104
3562
  });
2105
3563
  });
2106
3564
  resizeObserver.observe(element, { box: "border-box" });
2107
- return () => resizeObserver.unobserve(element);
3565
+ return () => {
3566
+ window.cancelAnimationFrame(rAF);
3567
+ resizeObserver.unobserve(element);
3568
+ };
2108
3569
  } else setSize(void 0);
2109
3570
  }, [element]);
2110
3571
  return size;
2111
3572
  }
2112
- // ../../node_modules/.bun/@radix-ui+react-popper@1.2.8+a68cb332b68cb125/node_modules/@radix-ui/react-popper/dist/index.mjs
3573
+ __name$7(useSize, "useSize");
3574
+ // ../../node_modules/.bun/@radix-ui+react-popper@1.4.0+b146eb580f4286be/node_modules/@radix-ui/react-popper/dist/index.mjs
3575
+ var __defProp$6 = Object.defineProperty;
3576
+ var __name$6 = (target, value) => __defProp$6(target, "name", {
3577
+ value,
3578
+ configurable: true
3579
+ });
3580
+ var Sticky = {
3581
+ Partial: "partial",
3582
+ Always: "always"
3583
+ };
3584
+ var UpdatePositionStrategy = {
3585
+ Optimized: "optimized",
3586
+ Always: "always"
3587
+ };
2113
3588
  var POPPER_NAME = "Popper";
2114
- var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
3589
+ var [createPopperContext, createPopperScope] = /* @__PURE__ */ createContextScope(POPPER_NAME);
2115
3590
  var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
2116
- var Popper = (props) => {
3591
+ var Popper = /* @__PURE__ */ __name$6((props) => {
2117
3592
  const { __scopePopper, children } = props;
2118
3593
  const [anchor, setAnchor] = import_react.useState(null);
3594
+ const [placementState, setPlacementState] = import_react.useState(void 0);
2119
3595
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperProvider, {
2120
3596
  scope: __scopePopper,
2121
3597
  anchor,
2122
3598
  onAnchorChange: setAnchor,
3599
+ placementState,
3600
+ setPlacementState,
2123
3601
  children
2124
3602
  });
2125
- };
2126
- Popper.displayName = POPPER_NAME;
3603
+ }, "Popper");
2127
3604
  var ANCHOR_NAME = "PopperAnchor";
2128
- var PopperAnchor = import_react.forwardRef((props, forwardedRef) => {
3605
+ var PopperAnchor = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$6(function PopperAnchor2(props, forwardedRef) {
2129
3606
  const { __scopePopper, virtualRef, ...anchorProps } = props;
2130
3607
  const context = usePopperContext(ANCHOR_NAME, __scopePopper);
2131
3608
  const ref = import_react.useRef(null);
2132
- const composedRefs = useComposedRefs(forwardedRef, ref);
3609
+ const onAnchorChange = context.onAnchorChange;
3610
+ const composedRefs = useComposedRefs(forwardedRef, import_react.useCallback((node) => {
3611
+ ref.current = node;
3612
+ if (node) onAnchorChange(node);
3613
+ }, [onAnchorChange]));
2133
3614
  const anchorRef = import_react.useRef(null);
2134
3615
  import_react.useEffect(() => {
3616
+ if (!virtualRef) return;
2135
3617
  const previousAnchor = anchorRef.current;
2136
- anchorRef.current = virtualRef?.current || ref.current;
2137
- if (previousAnchor !== anchorRef.current) context.onAnchorChange(anchorRef.current);
3618
+ anchorRef.current = virtualRef.current;
3619
+ if (previousAnchor !== anchorRef.current) onAnchorChange(anchorRef.current);
2138
3620
  });
3621
+ const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState);
3622
+ const placedSide = sideAndAlign?.[0];
3623
+ const placedAlign = sideAndAlign?.[1];
2139
3624
  return virtualRef ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
3625
+ "data-radix-popper-side": placedSide,
3626
+ "data-radix-popper-align": placedAlign,
2140
3627
  ...anchorProps,
2141
3628
  ref: composedRefs
2142
3629
  });
2143
- });
2144
- PopperAnchor.displayName = ANCHOR_NAME;
3630
+ }, "PopperAnchor"));
2145
3631
  var CONTENT_NAME$1 = "PopperContent";
2146
3632
  var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$1);
2147
- var PopperContent = import_react.forwardRef((props, forwardedRef) => {
2148
- const { __scopePopper, side = "bottom", sideOffset = 0, align = "center", alignOffset = 0, arrowPadding = 0, avoidCollisions = true, collisionBoundary = [], collisionPadding: collisionPaddingProp = 0, sticky = "partial", hideWhenDetached = false, updatePositionStrategy = "optimized", onPlaced, ...contentProps } = props;
3633
+ var PopperContent = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$6(function PopperContent2(props, forwardedRef) {
3634
+ const { __scopePopper, side = "bottom", sideOffset = 0, align = "center", alignOffset = 0, arrowPadding = 0, avoidCollisions = true, collisionBoundary = [], collisionPadding: collisionPaddingProp = 0, sticky = Sticky.Partial, hideWhenDetached = false, updatePositionStrategy = UpdatePositionStrategy.Optimized, onPlaced, ...contentProps } = props;
2149
3635
  const context = usePopperContext(CONTENT_NAME$1, __scopePopper);
2150
3636
  const [content, setContent] = import_react.useState(null);
2151
- const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
3637
+ const composedRefs = useComposedRefs(forwardedRef, setContent);
2152
3638
  const [arrow$4, setArrow] = import_react.useState(null);
2153
3639
  const arrowSize = useSize(arrow$4);
2154
3640
  const arrowWidth = arrowSize?.width ?? 0;
@@ -2171,9 +3657,9 @@ var PopperContent = import_react.forwardRef((props, forwardedRef) => {
2171
3657
  const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
2172
3658
  strategy: "fixed",
2173
3659
  placement: desiredPlacement,
2174
- whileElementsMounted: (...args) => {
2175
- return autoUpdate(...args, { animationFrame: updatePositionStrategy === "always" });
2176
- },
3660
+ whileElementsMounted: /* @__PURE__ */ __name$6((...args) => {
3661
+ return autoUpdate(...args, { animationFrame: updatePositionStrategy === UpdatePositionStrategy.Always });
3662
+ }, "whileElementsMounted"),
2177
3663
  elements: { reference: context.anchor },
2178
3664
  middleware: [
2179
3665
  offset({
@@ -2183,20 +3669,20 @@ var PopperContent = import_react.forwardRef((props, forwardedRef) => {
2183
3669
  avoidCollisions && shift({
2184
3670
  mainAxis: true,
2185
3671
  crossAxis: false,
2186
- limiter: sticky === "partial" ? limitShift() : void 0,
3672
+ ...sticky === Sticky.Partial ? { limiter: limitShift() } : {},
2187
3673
  ...detectOverflowOptions
2188
3674
  }),
2189
3675
  avoidCollisions && flip({ ...detectOverflowOptions }),
2190
3676
  size({
2191
3677
  ...detectOverflowOptions,
2192
- apply: ({ elements, rects, availableWidth, availableHeight }) => {
3678
+ apply: /* @__PURE__ */ __name$6(({ elements, rects, availableWidth, availableHeight }) => {
2193
3679
  const { width: anchorWidth, height: anchorHeight } = rects.reference;
2194
3680
  const contentStyle = elements.floating.style;
2195
3681
  contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
2196
3682
  contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
2197
3683
  contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
2198
3684
  contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
2199
- }
3685
+ }, "apply")
2200
3686
  }),
2201
3687
  arrow$4 && arrow({
2202
3688
  element: arrow$4,
@@ -2206,12 +3692,23 @@ var PopperContent = import_react.forwardRef((props, forwardedRef) => {
2206
3692
  arrowWidth,
2207
3693
  arrowHeight
2208
3694
  }),
2209
- hideWhenDetached && hide({
3695
+ hideWhenDetached && hide(hasExplicitBoundaries ? {
2210
3696
  strategy: "referenceHidden",
2211
3697
  ...detectOverflowOptions
3698
+ } : {
3699
+ strategy: "referenceHidden",
3700
+ padding: detectOverflowOptions.padding,
3701
+ altBoundary: detectOverflowOptions.altBoundary
2212
3702
  })
2213
3703
  ]
2214
3704
  });
3705
+ const setPlacementState = context.setPlacementState;
3706
+ useLayoutEffect2(() => {
3707
+ setPlacementState(placement);
3708
+ return () => {
3709
+ setPlacementState(void 0);
3710
+ };
3711
+ }, [placement, setPlacementState]);
2215
3712
  const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
2216
3713
  const handlePlaced = useCallbackRef(onPlaced);
2217
3714
  useLayoutEffect2(() => {
@@ -2232,7 +3729,7 @@ var PopperContent = import_react.forwardRef((props, forwardedRef) => {
2232
3729
  transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
2233
3730
  minWidth: "max-content",
2234
3731
  zIndex: contentZIndex,
2235
- ["--radix-popper-transform-origin"]: [middlewareData.transformOrigin?.x, middlewareData.transformOrigin?.y].join(" "),
3732
+ "--radix-popper-transform-origin": [middlewareData.transformOrigin?.x, middlewareData.transformOrigin?.y].join(" "),
2236
3733
  ...middlewareData.hide?.referenceHidden && {
2237
3734
  visibility: "hidden",
2238
3735
  pointerEvents: "none"
@@ -2242,6 +3739,7 @@ var PopperContent = import_react.forwardRef((props, forwardedRef) => {
2242
3739
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperContentProvider, {
2243
3740
  scope: __scopePopper,
2244
3741
  placedSide,
3742
+ placedAlign,
2245
3743
  onArrowChange: setArrow,
2246
3744
  arrowX,
2247
3745
  arrowY,
@@ -2253,23 +3751,22 @@ var PopperContent = import_react.forwardRef((props, forwardedRef) => {
2253
3751
  ref: composedRefs,
2254
3752
  style: {
2255
3753
  ...contentProps.style,
2256
- animation: !isPositioned ? "none" : void 0
3754
+ animation: !isPositioned ? "none" : contentProps.style?.animation
2257
3755
  }
2258
3756
  })
2259
3757
  })
2260
3758
  });
2261
- });
2262
- PopperContent.displayName = CONTENT_NAME$1;
2263
- var ARROW_NAME$1 = "PopperArrow";
3759
+ }, "PopperContent"));
3760
+ var ARROW_NAME = "PopperArrow";
2264
3761
  var OPPOSITE_SIDE = {
2265
3762
  top: "bottom",
2266
3763
  right: "left",
2267
3764
  bottom: "top",
2268
3765
  left: "right"
2269
3766
  };
2270
- var PopperArrow = import_react.forwardRef(function PopperArrow2(props, forwardedRef) {
3767
+ var PopperArrow = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$6(function PopperArrow2(props, forwardedRef) {
2271
3768
  const { __scopePopper, ...arrowProps } = props;
2272
- const contentContext = useContentContext(ARROW_NAME$1, __scopePopper);
3769
+ const contentContext = useContentContext(ARROW_NAME, __scopePopper);
2273
3770
  const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
2274
3771
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
2275
3772
  ref: contentContext.onArrowChange,
@@ -2292,7 +3789,7 @@ var PopperArrow = import_react.forwardRef(function PopperArrow2(props, forwarded
2292
3789
  }[contentContext.placedSide],
2293
3790
  visibility: contentContext.shouldHideArrow ? "hidden" : void 0
2294
3791
  },
2295
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root$1, {
3792
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {
2296
3793
  ...arrowProps,
2297
3794
  ref: forwardedRef,
2298
3795
  style: {
@@ -2301,12 +3798,12 @@ var PopperArrow = import_react.forwardRef(function PopperArrow2(props, forwarded
2301
3798
  }
2302
3799
  })
2303
3800
  });
2304
- });
2305
- PopperArrow.displayName = ARROW_NAME$1;
3801
+ }, "PopperArrow"));
2306
3802
  function isNotNull(value) {
2307
3803
  return value !== null;
2308
3804
  }
2309
- var transformOrigin = (options) => ({
3805
+ __name$6(isNotNull, "isNotNull");
3806
+ var transformOrigin = /* @__PURE__ */ __name$6((options) => ({
2310
3807
  name: "transformOrigin",
2311
3808
  options,
2312
3809
  fn(data) {
@@ -2342,18 +3839,19 @@ var transformOrigin = (options) => ({
2342
3839
  y
2343
3840
  } };
2344
3841
  }
2345
- });
3842
+ }), "transformOrigin");
2346
3843
  function getSideAndAlignFromPlacement(placement) {
2347
3844
  const [side, align = "center"] = placement.split("-");
2348
3845
  return [side, align];
2349
3846
  }
2350
- var Root2 = Popper;
2351
- var Anchor = PopperAnchor;
2352
- var Content = PopperContent;
2353
- var Arrow = PopperArrow;
2354
- // ../../node_modules/.bun/@radix-ui+react-portal@1.1.9+a68cb332b68cb125/node_modules/@radix-ui/react-portal/dist/index.mjs
2355
- var PORTAL_NAME$1 = "Portal";
2356
- var Portal$1 = import_react.forwardRef((props, forwardedRef) => {
3847
+ __name$6(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
3848
+ // ../../node_modules/.bun/@radix-ui+react-portal@1.2.0+b146eb580f4286be/node_modules/@radix-ui/react-portal/dist/index.mjs
3849
+ var __defProp$5 = Object.defineProperty;
3850
+ var __name$5 = (target, value) => __defProp$5(target, "name", {
3851
+ value,
3852
+ configurable: true
3853
+ });
3854
+ var Portal = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$5(function Portal2(props, forwardedRef) {
2357
3855
  const { container: containerProp, ...portalProps } = props;
2358
3856
  const [mounted, setMounted] = import_react.useState(false);
2359
3857
  useLayoutEffect2(() => setMounted(true), []);
@@ -2362,27 +3860,32 @@ var Portal$1 = import_react.forwardRef((props, forwardedRef) => {
2362
3860
  ...portalProps,
2363
3861
  ref: forwardedRef
2364
3862
  }), container) : null;
3863
+ }, "Portal"));
3864
+ // ../../node_modules/.bun/@radix-ui+react-presence@1.1.11+b146eb580f4286be/node_modules/@radix-ui/react-presence/dist/index.mjs
3865
+ var __defProp$4 = Object.defineProperty;
3866
+ var __name$4 = (target, value) => __defProp$4(target, "name", {
3867
+ value,
3868
+ configurable: true
2365
3869
  });
2366
- Portal$1.displayName = PORTAL_NAME$1;
2367
- // ../../node_modules/.bun/@radix-ui+react-presence@1.1.5+a68cb332b68cb125/node_modules/@radix-ui/react-presence/dist/index.mjs
2368
3870
  function useStateMachine(initialState, machine) {
2369
3871
  return import_react.useReducer((state, event) => {
2370
3872
  return machine[state][event] ?? state;
2371
3873
  }, initialState);
2372
3874
  }
2373
- var Presence = (props) => {
3875
+ __name$4(useStateMachine, "useStateMachine");
3876
+ var Presence = /* @__PURE__ */ __name$4((props) => {
2374
3877
  const { present, children } = props;
2375
3878
  const presence = usePresence(present);
2376
3879
  const child = typeof children === "function" ? children({ present: presence.isPresent }) : import_react.Children.only(children);
2377
- const ref = useComposedRefs(presence.ref, getElementRef(child));
3880
+ const ref = useStableComposedRefs(presence.ref, getElementRef(child));
2378
3881
  return typeof children === "function" || presence.isPresent ? import_react.cloneElement(child, { ref }) : null;
2379
- };
2380
- Presence.displayName = "Presence";
3882
+ }, "Presence");
2381
3883
  function usePresence(present) {
2382
3884
  const [node, setNode] = import_react.useState();
2383
3885
  const stylesRef = import_react.useRef(null);
2384
3886
  const prevPresentRef = import_react.useRef(present);
2385
3887
  const prevAnimationNameRef = import_react.useRef("none");
3888
+ const mountAnimationNameRef = import_react.useRef(void 0);
2386
3889
  const [state, send] = useStateMachine(present ? "mounted" : "unmounted", {
2387
3890
  mounted: {
2388
3891
  UNMOUNT: "unmounted",
@@ -2395,8 +3898,10 @@ function usePresence(present) {
2395
3898
  unmounted: { MOUNT: "mounted" }
2396
3899
  });
2397
3900
  import_react.useEffect(() => {
2398
- const currentAnimationName = getAnimationName(stylesRef.current);
2399
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
3901
+ if (state === "mounted") {
3902
+ prevAnimationNameRef.current = mountAnimationNameRef.current ?? getAnimationName(stylesRef.current);
3903
+ mountAnimationNameRef.current = void 0;
3904
+ } else prevAnimationNameRef.current = "none";
2400
3905
  }, [state]);
2401
3906
  useLayoutEffect2(() => {
2402
3907
  const styles = stylesRef.current;
@@ -2404,8 +3909,10 @@ function usePresence(present) {
2404
3909
  if (wasPresent !== present) {
2405
3910
  const prevAnimationName = prevAnimationNameRef.current;
2406
3911
  const currentAnimationName = getAnimationName(styles);
2407
- if (present) send("MOUNT");
2408
- else if (currentAnimationName === "none" || styles?.display === "none") send("UNMOUNT");
3912
+ if (present) {
3913
+ mountAnimationNameRef.current = currentAnimationName;
3914
+ send("MOUNT");
3915
+ } else if (currentAnimationName === "none" || styles?.display === "none") send("UNMOUNT");
2409
3916
  else if (wasPresent && prevAnimationName !== currentAnimationName) send("ANIMATION_OUT");
2410
3917
  else send("UNMOUNT");
2411
3918
  prevPresentRef.current = present;
@@ -2415,7 +3922,7 @@ function usePresence(present) {
2415
3922
  if (node) {
2416
3923
  let timeoutId;
2417
3924
  const ownerWindow = node.ownerDocument.defaultView ?? window;
2418
- const handleAnimationEnd = (event) => {
3925
+ const handleAnimationEnd = /* @__PURE__ */ __name$4((event) => {
2419
3926
  const isCurrentAnimation = getAnimationName(stylesRef.current).includes(CSS.escape(event.animationName));
2420
3927
  if (event.target === node && isCurrentAnimation) {
2421
3928
  send("ANIMATION_END");
@@ -2427,10 +3934,10 @@ function usePresence(present) {
2427
3934
  });
2428
3935
  }
2429
3936
  }
2430
- };
2431
- const handleAnimationStart = (event) => {
3937
+ }, "handleAnimationEnd");
3938
+ const handleAnimationStart = /* @__PURE__ */ __name$4((event) => {
2432
3939
  if (event.target === node) prevAnimationNameRef.current = getAnimationName(stylesRef.current);
2433
- };
3940
+ }, "handleAnimationStart");
2434
3941
  node.addEventListener("animationstart", handleAnimationStart);
2435
3942
  node.addEventListener("animationcancel", handleAnimationEnd);
2436
3943
  node.addEventListener("animationend", handleAnimationEnd);
@@ -2445,14 +3952,46 @@ function usePresence(present) {
2445
3952
  return {
2446
3953
  isPresent: ["mounted", "unmountSuspended"].includes(state),
2447
3954
  ref: import_react.useCallback((node2) => {
2448
- stylesRef.current = node2 ? getComputedStyle(node2) : null;
3955
+ if (node2) {
3956
+ const styles = getComputedStyle(node2);
3957
+ stylesRef.current = styles;
3958
+ mountAnimationNameRef.current = getAnimationName(styles);
3959
+ } else stylesRef.current = null;
2449
3960
  setNode(node2);
2450
3961
  }, [])
2451
3962
  };
2452
3963
  }
3964
+ __name$4(usePresence, "usePresence");
3965
+ function setRef(ref, value) {
3966
+ if (typeof ref === "function") return ref(value);
3967
+ else if (ref !== null && ref !== void 0) ref.current = value;
3968
+ }
3969
+ __name$4(setRef, "setRef");
3970
+ function useStableComposedRefs(...refs) {
3971
+ const refsRef = import_react.useRef(refs);
3972
+ refsRef.current = refs;
3973
+ return import_react.useCallback((node) => {
3974
+ const currentRefs = refsRef.current;
3975
+ let hasCleanup = false;
3976
+ const cleanups = currentRefs.map((ref) => {
3977
+ const cleanup = setRef(ref, node);
3978
+ if (!hasCleanup && typeof cleanup === "function") hasCleanup = true;
3979
+ return cleanup;
3980
+ });
3981
+ if (hasCleanup) return () => {
3982
+ for (let i = 0; i < cleanups.length; i++) {
3983
+ const cleanup = cleanups[i];
3984
+ if (typeof cleanup === "function") cleanup();
3985
+ else setRef(currentRefs[i], null);
3986
+ }
3987
+ };
3988
+ }, []);
3989
+ }
3990
+ __name$4(useStableComposedRefs, "useStableComposedRefs");
2453
3991
  function getAnimationName(styles) {
2454
3992
  return styles?.animationName || "none";
2455
3993
  }
3994
+ __name$4(getAnimationName, "getAnimationName");
2456
3995
  function getElementRef(element) {
2457
3996
  let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
2458
3997
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
@@ -2462,24 +4001,43 @@ function getElementRef(element) {
2462
4001
  if (mayWarn) return element.props.ref;
2463
4002
  return element.props.ref || element.ref;
2464
4003
  }
2465
- // ../../node_modules/.bun/@radix-ui+react-use-controllable-state@1.2.2+340ca8aed1dead99/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
4004
+ __name$4(getElementRef, "getElementRef");
4005
+ // ../../node_modules/.bun/@radix-ui+react-use-effect-event@0.0.5+c841d34b494ec30a/node_modules/@radix-ui/react-use-effect-event/dist/index.mjs
4006
+ var __defProp$3 = Object.defineProperty;
4007
+ var __name$3 = (target, value) => __defProp$3(target, "name", {
4008
+ value,
4009
+ configurable: true
4010
+ });
4011
+ var useReactEffectEvent = import_react[" useEffectEvent ".trim().toString()];
4012
+ var useReactInsertionEffect = import_react[" useInsertionEffect ".trim().toString()];
4013
+ function useEffectEvent(callback) {
4014
+ if (typeof useReactEffectEvent === "function") return useReactEffectEvent(callback);
4015
+ const ref = import_react.useRef(() => {
4016
+ throw new Error("Cannot call an event handler while rendering.");
4017
+ });
4018
+ if (typeof useReactInsertionEffect === "function") useReactInsertionEffect(() => {
4019
+ ref.current = callback;
4020
+ });
4021
+ else useLayoutEffect2(() => {
4022
+ ref.current = callback;
4023
+ });
4024
+ return import_react.useMemo(() => ((...args) => ref.current?.(...args)), []);
4025
+ }
4026
+ __name$3(useEffectEvent, "useEffectEvent");
4027
+ // ../../node_modules/.bun/@radix-ui+react-use-controllable-state@1.3.0+c841d34b494ec30a/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
4028
+ var __defProp$2 = Object.defineProperty;
4029
+ var __name$2 = (target, value) => __defProp$2(target, "name", {
4030
+ value,
4031
+ configurable: true
4032
+ });
2466
4033
  var useInsertionEffect = import_react[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
2467
- function useControllableState({ prop, defaultProp, onChange = () => {}, caller }) {
4034
+ function useControllableState({ prop, defaultProp, onChange = /* @__PURE__ */ __name$2(() => {}, "onChange"), caller }) {
2468
4035
  const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
2469
4036
  defaultProp,
2470
4037
  onChange
2471
4038
  });
2472
4039
  const isControlled = prop !== void 0;
2473
- const value = isControlled ? prop : uncontrolledProp;
2474
- {
2475
- const isControlledRef = import_react.useRef(prop !== void 0);
2476
- import_react.useEffect(() => {
2477
- const wasControlled = isControlledRef.current;
2478
- if (wasControlled !== isControlled) console.warn(`${caller} is changing from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);
2479
- isControlledRef.current = isControlled;
2480
- }, [isControlled, caller]);
2481
- }
2482
- return [value, import_react.useCallback((nextValue) => {
4040
+ return [isControlled ? prop : uncontrolledProp, import_react.useCallback((nextValue) => {
2483
4041
  if (isControlled) {
2484
4042
  const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
2485
4043
  if (value2 !== prop) onChangeRef.current?.(value2);
@@ -2491,6 +4049,7 @@ function useControllableState({ prop, defaultProp, onChange = () => {}, caller }
2491
4049
  onChangeRef
2492
4050
  ])];
2493
4051
  }
4052
+ __name$2(useControllableState, "useControllableState");
2494
4053
  function useUncontrolledState({ defaultProp, onChange }) {
2495
4054
  const [value, setValue] = import_react.useState(defaultProp);
2496
4055
  const prevValueRef = import_react.useRef(value);
@@ -2510,10 +4069,68 @@ function useUncontrolledState({ defaultProp, onChange }) {
2510
4069
  onChangeRef
2511
4070
  ];
2512
4071
  }
4072
+ __name$2(useUncontrolledState, "useUncontrolledState");
2513
4073
  function isFunction(value) {
2514
4074
  return typeof value === "function";
2515
4075
  }
2516
- // ../../node_modules/.bun/@radix-ui+react-visually-hidden@1.2.3+a68cb332b68cb125/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
4076
+ __name$2(isFunction, "isFunction");
4077
+ var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
4078
+ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
4079
+ const { prop: controlledState, defaultProp, onChange: onChangeProp, caller } = userArgs;
4080
+ const isControlled = controlledState !== void 0;
4081
+ const onChange = useEffectEvent(onChangeProp);
4082
+ const args = [{
4083
+ ...initialArg,
4084
+ state: defaultProp
4085
+ }];
4086
+ if (init) args.push(init);
4087
+ const [internalState, dispatch] = import_react.useReducer((state2, action) => {
4088
+ if (action.type === SYNC_STATE) return {
4089
+ ...state2,
4090
+ state: action.state
4091
+ };
4092
+ const next = reducer(state2, action);
4093
+ if (isControlled && !Object.is(next.state, state2.state)) onChange(next.state);
4094
+ return next;
4095
+ }, ...args);
4096
+ const uncontrolledState = internalState.state;
4097
+ const prevValueRef = import_react.useRef(uncontrolledState);
4098
+ import_react.useEffect(() => {
4099
+ if (prevValueRef.current !== uncontrolledState) {
4100
+ prevValueRef.current = uncontrolledState;
4101
+ if (!isControlled) onChange(uncontrolledState);
4102
+ }
4103
+ }, [
4104
+ uncontrolledState,
4105
+ prevValueRef,
4106
+ isControlled
4107
+ ]);
4108
+ const state = import_react.useMemo(() => {
4109
+ if (controlledState !== void 0) return {
4110
+ ...internalState,
4111
+ state: controlledState
4112
+ };
4113
+ return internalState;
4114
+ }, [internalState, controlledState]);
4115
+ import_react.useEffect(() => {
4116
+ if (isControlled && !Object.is(controlledState, internalState.state)) dispatch({
4117
+ type: SYNC_STATE,
4118
+ state: controlledState
4119
+ });
4120
+ }, [
4121
+ controlledState,
4122
+ internalState.state,
4123
+ isControlled
4124
+ ]);
4125
+ return [state, dispatch];
4126
+ }
4127
+ __name$2(useControllableStateReducer, "useControllableStateReducer");
4128
+ // ../../node_modules/.bun/@radix-ui+react-visually-hidden@1.2.13+b146eb580f4286be/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
4129
+ var __defProp$1 = Object.defineProperty;
4130
+ var __name$1 = (target, value) => __defProp$1(target, "name", {
4131
+ value,
4132
+ configurable: true
4133
+ });
2517
4134
  var VISUALLY_HIDDEN_STYLES = Object.freeze({
2518
4135
  position: "absolute",
2519
4136
  border: 0,
@@ -2526,8 +4143,7 @@ var VISUALLY_HIDDEN_STYLES = Object.freeze({
2526
4143
  whiteSpace: "nowrap",
2527
4144
  wordWrap: "normal"
2528
4145
  });
2529
- var NAME = "VisuallyHidden";
2530
- var VisuallyHidden = import_react.forwardRef((props, forwardedRef) => {
4146
+ var VisuallyHidden = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function VisuallyHidden2(props, forwardedRef) {
2531
4147
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
2532
4148
  ...props,
2533
4149
  ref: forwardedRef,
@@ -2536,17 +4152,20 @@ var VisuallyHidden = import_react.forwardRef((props, forwardedRef) => {
2536
4152
  ...props.style
2537
4153
  }
2538
4154
  });
4155
+ }, "VisuallyHidden"));
4156
+ // ../../node_modules/.bun/@radix-ui+react-tooltip@1.4.1+b146eb580f4286be/node_modules/@radix-ui/react-tooltip/dist/index.mjs
4157
+ var __defProp = Object.defineProperty;
4158
+ var __name = (target, value) => __defProp(target, "name", {
4159
+ value,
4160
+ configurable: true
2539
4161
  });
2540
- VisuallyHidden.displayName = NAME;
2541
- var Root = VisuallyHidden;
2542
- // ../../node_modules/.bun/@radix-ui+react-tooltip@1.2.8+a68cb332b68cb125/node_modules/@radix-ui/react-tooltip/dist/index.mjs
2543
- var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [createPopperScope]);
4162
+ var [createTooltipContext, createTooltipScope] = /* @__PURE__ */ createContextScope("Tooltip", [createPopperScope]);
2544
4163
  var usePopperScope = createPopperScope();
2545
4164
  var PROVIDER_NAME = "TooltipProvider";
2546
4165
  var DEFAULT_DELAY_DURATION = 700;
2547
4166
  var TOOLTIP_OPEN = "tooltip.open";
2548
4167
  var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
2549
- var TooltipProvider = (props) => {
4168
+ var TooltipProvider = /* @__PURE__ */ __name((props) => {
2550
4169
  const { __scopeTooltip, delayDuration = DEFAULT_DELAY_DURATION, skipDelayDuration = 300, disableHoverableContent = false, children } = props;
2551
4170
  const isOpenDelayedRef = import_react.useRef(true);
2552
4171
  const isPointerInTransitRef = import_react.useRef(false);
@@ -2560,10 +4179,12 @@ var TooltipProvider = (props) => {
2560
4179
  isOpenDelayedRef,
2561
4180
  delayDuration,
2562
4181
  onOpen: import_react.useCallback(() => {
4182
+ if (skipDelayDuration <= 0) return;
2563
4183
  window.clearTimeout(skipDelayTimerRef.current);
2564
4184
  isOpenDelayedRef.current = false;
2565
- }, []),
4185
+ }, [skipDelayDuration]),
2566
4186
  onClose: import_react.useCallback(() => {
4187
+ if (skipDelayDuration <= 0) return;
2567
4188
  window.clearTimeout(skipDelayTimerRef.current);
2568
4189
  skipDelayTimerRef.current = window.setTimeout(() => isOpenDelayedRef.current = true, skipDelayDuration);
2569
4190
  }, [skipDelayDuration]),
@@ -2574,16 +4195,16 @@ var TooltipProvider = (props) => {
2574
4195
  disableHoverableContent,
2575
4196
  children
2576
4197
  });
2577
- };
2578
- TooltipProvider.displayName = PROVIDER_NAME;
4198
+ }, "TooltipProvider");
2579
4199
  var TOOLTIP_NAME = "Tooltip";
2580
4200
  var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
2581
- var Tooltip = (props) => {
4201
+ var Tooltip = /* @__PURE__ */ __name((props) => {
2582
4202
  const { __scopeTooltip, children, open: openProp, defaultOpen, onOpenChange, disableHoverableContent: disableHoverableContentProp, delayDuration: delayDurationProp } = props;
2583
4203
  const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
2584
4204
  const popperScope = usePopperScope(__scopeTooltip);
2585
4205
  const [trigger, setTrigger] = import_react.useState(null);
2586
- const contentId = useId();
4206
+ const [contentIdState, setContentId] = import_react.useState(void 0);
4207
+ const generatedContentId = useId();
2587
4208
  const openTimerRef = import_react.useRef(0);
2588
4209
  const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
2589
4210
  const delayDuration = delayDurationProp ?? providerContext.delayDuration;
@@ -2591,13 +4212,13 @@ var Tooltip = (props) => {
2591
4212
  const [open, setOpen] = useControllableState({
2592
4213
  prop: openProp,
2593
4214
  defaultProp: defaultOpen ?? false,
2594
- onChange: (open2) => {
4215
+ onChange: /* @__PURE__ */ __name((open2) => {
2595
4216
  if (open2) {
2596
4217
  providerContext.onOpen();
2597
4218
  document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
2598
4219
  } else providerContext.onClose();
2599
4220
  onOpenChange?.(open2);
2600
- },
4221
+ }, "onChange"),
2601
4222
  caller: TOOLTIP_NAME
2602
4223
  });
2603
4224
  const stateAttribute = import_react.useMemo(() => {
@@ -2630,11 +4251,13 @@ var Tooltip = (props) => {
2630
4251
  }
2631
4252
  };
2632
4253
  }, []);
2633
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root2, {
4254
+ const contentId = contentIdState ?? generatedContentId;
4255
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Popper, {
2634
4256
  ...popperScope,
2635
4257
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContextProvider, {
2636
4258
  scope: __scopeTooltip,
2637
4259
  contentId,
4260
+ setContentId,
2638
4261
  open,
2639
4262
  stateAttribute,
2640
4263
  trigger,
@@ -2660,11 +4283,10 @@ var Tooltip = (props) => {
2660
4283
  children
2661
4284
  })
2662
4285
  });
2663
- };
2664
- Tooltip.displayName = TOOLTIP_NAME;
4286
+ }, "Tooltip");
2665
4287
  var TRIGGER_NAME = "TooltipTrigger";
2666
- var TooltipTrigger = import_react.forwardRef((props, forwardedRef) => {
2667
- const { __scopeTooltip, ...triggerProps } = props;
4288
+ var TooltipTrigger = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function TooltipTrigger2(props, forwardedRef) {
4289
+ const { __scopeTooltip, "aria-describedby": ariaDescribedby, ...triggerProps } = props;
2668
4290
  const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
2669
4291
  const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
2670
4292
  const popperScope = usePopperScope(__scopeTooltip);
@@ -2675,11 +4297,11 @@ var TooltipTrigger = import_react.forwardRef((props, forwardedRef) => {
2675
4297
  import_react.useEffect(() => {
2676
4298
  return () => document.removeEventListener("pointerup", handlePointerUp);
2677
4299
  }, [handlePointerUp]);
2678
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Anchor, {
4300
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperAnchor, {
2679
4301
  asChild: true,
2680
4302
  ...popperScope,
2681
4303
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.button, {
2682
- "aria-describedby": context.open ? context.contentId : void 0,
4304
+ "aria-describedby": context.open ? concatAriaDescribedby(ariaDescribedby, context.contentId) : ariaDescribedby,
2683
4305
  "data-state": context.stateAttribute,
2684
4306
  ...triggerProps,
2685
4307
  ref: composedRefs,
@@ -2706,11 +4328,10 @@ var TooltipTrigger = import_react.forwardRef((props, forwardedRef) => {
2706
4328
  onClick: composeEventHandlers(props.onClick, context.onClose)
2707
4329
  })
2708
4330
  });
2709
- });
2710
- TooltipTrigger.displayName = TRIGGER_NAME;
4331
+ }, "TooltipTrigger"));
2711
4332
  var PORTAL_NAME = "TooltipPortal";
2712
4333
  var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, { forceMount: void 0 });
2713
- var TooltipPortal = (props) => {
4334
+ var TooltipPortal = /* @__PURE__ */ __name((props) => {
2714
4335
  const { __scopeTooltip, forceMount, children, container } = props;
2715
4336
  const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
2716
4337
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, {
@@ -2718,17 +4339,16 @@ var TooltipPortal = (props) => {
2718
4339
  forceMount,
2719
4340
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Presence, {
2720
4341
  present: forceMount || context.open,
2721
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal$1, {
4342
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal, {
2722
4343
  asChild: true,
2723
4344
  container,
2724
4345
  children
2725
4346
  })
2726
4347
  })
2727
4348
  });
2728
- };
2729
- TooltipPortal.displayName = PORTAL_NAME;
4349
+ }, "TooltipPortal");
2730
4350
  var CONTENT_NAME = "TooltipContent";
2731
- var TooltipContent = import_react.forwardRef((props, forwardedRef) => {
4351
+ var TooltipContent = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function TooltipContent2(props, forwardedRef) {
2732
4352
  const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
2733
4353
  const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
2734
4354
  const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
@@ -2744,8 +4364,8 @@ var TooltipContent = import_react.forwardRef((props, forwardedRef) => {
2744
4364
  ref: forwardedRef
2745
4365
  })
2746
4366
  });
2747
- });
2748
- var TooltipContentHoverable = import_react.forwardRef((props, forwardedRef) => {
4367
+ }, "TooltipContent"));
4368
+ var TooltipContentHoverable = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function TooltipContentHoverable2(props, forwardedRef) {
2749
4369
  const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
2750
4370
  const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
2751
4371
  const ref = import_react.useRef(null);
@@ -2775,8 +4395,8 @@ var TooltipContentHoverable = import_react.forwardRef((props, forwardedRef) => {
2775
4395
  }, [handleRemoveGraceArea]);
2776
4396
  import_react.useEffect(() => {
2777
4397
  if (trigger && content) {
2778
- const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
2779
- const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
4398
+ const handleTriggerLeave = /* @__PURE__ */ __name((event) => handleCreateGraceArea(event, content), "handleTriggerLeave");
4399
+ const handleContentLeave = /* @__PURE__ */ __name((event) => handleCreateGraceArea(event, trigger), "handleContentLeave");
2780
4400
  trigger.addEventListener("pointerleave", handleTriggerLeave);
2781
4401
  content.addEventListener("pointerleave", handleContentLeave);
2782
4402
  return () => {
@@ -2792,7 +4412,7 @@ var TooltipContentHoverable = import_react.forwardRef((props, forwardedRef) => {
2792
4412
  ]);
2793
4413
  import_react.useEffect(() => {
2794
4414
  if (pointerGraceArea) {
2795
- const handleTrackPointerGrace = (event) => {
4415
+ const handleTrackPointerGrace = /* @__PURE__ */ __name((event) => {
2796
4416
  const target = event.target;
2797
4417
  const pointerPosition = {
2798
4418
  x: event.clientX,
@@ -2805,7 +4425,7 @@ var TooltipContentHoverable = import_react.forwardRef((props, forwardedRef) => {
2805
4425
  handleRemoveGraceArea();
2806
4426
  onClose();
2807
4427
  }
2808
- };
4428
+ }, "handleTrackPointerGrace");
2809
4429
  document.addEventListener("pointermove", handleTrackPointerGrace);
2810
4430
  return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
2811
4431
  }
@@ -2820,27 +4440,36 @@ var TooltipContentHoverable = import_react.forwardRef((props, forwardedRef) => {
2820
4440
  ...props,
2821
4441
  ref: composedRefs
2822
4442
  });
2823
- });
2824
- var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
4443
+ }, "TooltipContentHoverable"));
2825
4444
  var Slottable = /* @__PURE__ */ createSlottable("TooltipContent");
2826
- var TooltipContentImpl = import_react.forwardRef((props, forwardedRef) => {
2827
- const { __scopeTooltip, children, "aria-label": ariaLabel, onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;
4445
+ var TooltipContentImpl = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function TooltipContentImpl2(props, forwardedRef) {
4446
+ const { __scopeTooltip, children, "aria-label": ariaLabel, id: idProp, onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;
2828
4447
  const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
2829
4448
  const popperScope = usePopperScope(__scopeTooltip);
2830
4449
  const { onClose } = context;
4450
+ const [contentNode, setContentNode] = import_react.useState(null);
4451
+ const composedRefs = useComposedRefs(forwardedRef, setContentNode);
4452
+ useFocusScopeBranch(contentNode);
2831
4453
  import_react.useEffect(() => {
2832
4454
  document.addEventListener(TOOLTIP_OPEN, onClose);
2833
4455
  return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
2834
4456
  }, [onClose]);
2835
4457
  import_react.useEffect(() => {
2836
4458
  if (context.trigger) {
2837
- const handleScroll = (event) => {
2838
- if (event.target?.contains(context.trigger)) onClose();
2839
- };
4459
+ const handleScroll = /* @__PURE__ */ __name((event) => {
4460
+ if (event.target instanceof Node && event.target.contains(context.trigger)) onClose();
4461
+ }, "handleScroll");
2840
4462
  window.addEventListener("scroll", handleScroll, { capture: true });
2841
4463
  return () => window.removeEventListener("scroll", handleScroll, { capture: true });
2842
4464
  }
2843
4465
  }, [context.trigger, onClose]);
4466
+ const { setContentId } = context;
4467
+ useLayoutEffect2(() => {
4468
+ setContentId(idProp);
4469
+ return () => {
4470
+ setContentId(void 0);
4471
+ };
4472
+ }, [idProp, setContentId]);
2844
4473
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DismissableLayer, {
2845
4474
  asChild: true,
2846
4475
  disableOutsidePointerEvents: false,
@@ -2848,11 +4477,13 @@ var TooltipContentImpl = import_react.forwardRef((props, forwardedRef) => {
2848
4477
  onPointerDownOutside,
2849
4478
  onFocusOutside: (event) => event.preventDefault(),
2850
4479
  onDismiss: onClose,
2851
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Content, {
4480
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PopperContent, {
2852
4481
  "data-state": context.stateAttribute,
4482
+ role: ariaLabel ? void 0 : "tooltip",
4483
+ id: ariaLabel ? void 0 : context.contentId,
2853
4484
  ...popperScope,
2854
4485
  ...contentProps,
2855
- ref: forwardedRef,
4486
+ ref: composedRefs,
2856
4487
  style: {
2857
4488
  ...contentProps.style,
2858
4489
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
@@ -2861,30 +4492,23 @@ var TooltipContentImpl = import_react.forwardRef((props, forwardedRef) => {
2861
4492
  "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
2862
4493
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
2863
4494
  },
2864
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slottable, { children }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VisuallyHiddenContentContextProvider, {
2865
- scope: __scopeTooltip,
2866
- isInside: true,
2867
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root, {
2868
- id: context.contentId,
2869
- role: "tooltip",
2870
- children: ariaLabel || children
2871
- })
2872
- })]
4495
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slottable, { children }), ariaLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VisuallyHidden, {
4496
+ id: context.contentId,
4497
+ role: "tooltip",
4498
+ children: ariaLabel
4499
+ }) : null]
2873
4500
  })
2874
4501
  });
2875
- });
2876
- TooltipContent.displayName = CONTENT_NAME;
2877
- var ARROW_NAME = "TooltipArrow";
2878
- var TooltipArrow = import_react.forwardRef((props, forwardedRef) => {
4502
+ }, "TooltipContentImpl"));
4503
+ var TooltipArrow = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function TooltipArrow2(props, forwardedRef) {
2879
4504
  const { __scopeTooltip, ...arrowProps } = props;
2880
4505
  const popperScope = usePopperScope(__scopeTooltip);
2881
- return useVisuallyHiddenContentContext(ARROW_NAME, __scopeTooltip).isInside ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {
4506
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperArrow, {
2882
4507
  ...popperScope,
2883
4508
  ...arrowProps,
2884
4509
  ref: forwardedRef
2885
4510
  });
2886
- });
2887
- TooltipArrow.displayName = ARROW_NAME;
4511
+ }, "TooltipArrow"));
2888
4512
  function getExitSideFromRect(point, rect) {
2889
4513
  const top = Math.abs(rect.top - point.y);
2890
4514
  const bottom = Math.abs(rect.bottom - point.y);
@@ -2898,6 +4522,7 @@ function getExitSideFromRect(point, rect) {
2898
4522
  default: throw new Error("unreachable");
2899
4523
  }
2900
4524
  }
4525
+ __name(getExitSideFromRect, "getExitSideFromRect");
2901
4526
  function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
2902
4527
  const paddedExitPoints = [];
2903
4528
  switch (exitSide) {
@@ -2938,6 +4563,7 @@ function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
2938
4563
  }
2939
4564
  return paddedExitPoints;
2940
4565
  }
4566
+ __name(getPaddedExitPoints, "getPaddedExitPoints");
2941
4567
  function getPointsFromRect(rect) {
2942
4568
  const { top, right, bottom, left } = rect;
2943
4569
  return [
@@ -2959,6 +4585,7 @@ function getPointsFromRect(rect) {
2959
4585
  }
2960
4586
  ];
2961
4587
  }
4588
+ __name(getPointsFromRect, "getPointsFromRect");
2962
4589
  function isPointInPolygon(point, polygon) {
2963
4590
  const { x, y } = point;
2964
4591
  let inside = false;
@@ -2973,6 +4600,7 @@ function isPointInPolygon(point, polygon) {
2973
4600
  }
2974
4601
  return inside;
2975
4602
  }
4603
+ __name(isPointInPolygon, "isPointInPolygon");
2976
4604
  function getHull(points) {
2977
4605
  const newPoints = points.slice();
2978
4606
  newPoints.sort((a, b) => {
@@ -2984,6 +4612,7 @@ function getHull(points) {
2984
4612
  });
2985
4613
  return getHullPresorted(newPoints);
2986
4614
  }
4615
+ __name(getHull, "getHull");
2987
4616
  function getHullPresorted(points) {
2988
4617
  if (points.length <= 1) return points.slice();
2989
4618
  const upperHull = [];
@@ -3013,13 +4642,17 @@ function getHullPresorted(points) {
3013
4642
  if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) return upperHull;
3014
4643
  else return upperHull.concat(lowerHull);
3015
4644
  }
3016
- var Provider = TooltipProvider;
3017
- var Root3 = Tooltip;
3018
- var Trigger = TooltipTrigger;
3019
- var Portal = TooltipPortal;
3020
- var Content2 = TooltipContent;
3021
- var Arrow2 = TooltipArrow;
3022
- // ../../node_modules/.bun/sonner@2.0.7+dfc90389513bb65c/node_modules/sonner/dist/index.mjs
4645
+ __name(getHullPresorted, "getHullPresorted");
4646
+ function concatAriaDescribedby(...values) {
4647
+ const ids = /* @__PURE__ */ new Set();
4648
+ for (const value of values) {
4649
+ if (typeof value !== "string") continue;
4650
+ for (const id of String(value).trim().split(/\s+/)) if (id) ids.add(id);
4651
+ }
4652
+ return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
4653
+ }
4654
+ __name(concatAriaDescribedby, "concatAriaDescribedby");
4655
+ // ../../node_modules/.bun/sonner@2.0.8+2fde69a3fd50c568/node_modules/sonner/dist/index.mjs
3023
4656
  function __insertCSS(code) {
3024
4657
  if (!code || typeof document == "undefined") return;
3025
4658
  let head = document.head || document.getElementsByTagName("head")[0];
@@ -3052,7 +4685,8 @@ var SuccessIcon = /*#__PURE__*/ import_react.createElement("svg", {
3052
4685
  viewBox: "0 0 20 20",
3053
4686
  fill: "currentColor",
3054
4687
  height: "20",
3055
- width: "20"
4688
+ width: "20",
4689
+ "aria-hidden": "true"
3056
4690
  }, /*#__PURE__*/ import_react.createElement("path", {
3057
4691
  fillRule: "evenodd",
3058
4692
  d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
@@ -3063,7 +4697,8 @@ var WarningIcon = /*#__PURE__*/ import_react.createElement("svg", {
3063
4697
  viewBox: "0 0 24 24",
3064
4698
  fill: "currentColor",
3065
4699
  height: "20",
3066
- width: "20"
4700
+ width: "20",
4701
+ "aria-hidden": "true"
3067
4702
  }, /*#__PURE__*/ import_react.createElement("path", {
3068
4703
  fillRule: "evenodd",
3069
4704
  d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
@@ -3074,7 +4709,8 @@ var InfoIcon = /*#__PURE__*/ import_react.createElement("svg", {
3074
4709
  viewBox: "0 0 20 20",
3075
4710
  fill: "currentColor",
3076
4711
  height: "20",
3077
- width: "20"
4712
+ width: "20",
4713
+ "aria-hidden": "true"
3078
4714
  }, /*#__PURE__*/ import_react.createElement("path", {
3079
4715
  fillRule: "evenodd",
3080
4716
  d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
@@ -3085,7 +4721,8 @@ var ErrorIcon = /*#__PURE__*/ import_react.createElement("svg", {
3085
4721
  viewBox: "0 0 20 20",
3086
4722
  fill: "currentColor",
3087
4723
  height: "20",
3088
- width: "20"
4724
+ width: "20",
4725
+ "aria-hidden": "true"
3089
4726
  }, /*#__PURE__*/ import_react.createElement("path", {
3090
4727
  fillRule: "evenodd",
3091
4728
  d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
@@ -3100,7 +4737,8 @@ var CloseIcon = /*#__PURE__*/ import_react.createElement("svg", {
3100
4737
  stroke: "currentColor",
3101
4738
  strokeWidth: "1.5",
3102
4739
  strokeLinecap: "round",
3103
- strokeLinejoin: "round"
4740
+ strokeLinejoin: "round",
4741
+ "aria-hidden": "true"
3104
4742
  }, /*#__PURE__*/ import_react.createElement("line", {
3105
4743
  x1: "18",
3106
4744
  y1: "6",
@@ -3119,15 +4757,21 @@ var useIsDocumentHidden = () => {
3119
4757
  setIsDocumentHidden(document.hidden);
3120
4758
  };
3121
4759
  document.addEventListener("visibilitychange", callback);
3122
- return () => window.removeEventListener("visibilitychange", callback);
4760
+ return () => document.removeEventListener("visibilitychange", callback);
3123
4761
  }, []);
3124
4762
  return isDocumentHidden;
3125
4763
  };
3126
4764
  var toastsCounter = 1;
4765
+ var MAX_HISTORY_SIZE = 100;
4766
+ var getToastId = (data) => {
4767
+ var _data_id;
4768
+ return typeof (data == null ? void 0 : data.id) === "number" || (data == null ? void 0 : (_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
4769
+ };
3127
4770
  var Observer = class {
3128
4771
  constructor() {
3129
4772
  this.subscribe = (subscriber) => {
3130
4773
  this.subscribers.push(subscriber);
4774
+ this.getActiveToasts().forEach((toast) => subscriber(toast));
3131
4775
  return () => {
3132
4776
  const index = this.subscribers.indexOf(subscriber);
3133
4777
  this.subscribers.splice(index, 1);
@@ -3139,17 +4783,38 @@ var Observer = class {
3139
4783
  this.addToast = (data) => {
3140
4784
  this.publish(data);
3141
4785
  this.toasts = [...this.toasts, data];
4786
+ this.trimHistory();
4787
+ };
4788
+ this.trimHistory = () => {
4789
+ let toRemove = this.toasts.length - MAX_HISTORY_SIZE;
4790
+ if (toRemove <= 0) return;
4791
+ this.toasts = this.toasts.filter((toast) => {
4792
+ if (toRemove > 0 && this.dismissedToasts.has(toast.id)) {
4793
+ this.dismissedToasts.delete(toast.id);
4794
+ toRemove--;
4795
+ return false;
4796
+ }
4797
+ return true;
4798
+ });
3142
4799
  };
3143
4800
  this.create = (data) => {
3144
- var _data_id;
3145
4801
  const { message, ...rest } = data;
3146
- const id = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
3147
- const alreadyExists = this.toasts.find((toast) => {
3148
- return toast.id === id;
3149
- });
4802
+ const id = getToastId(data);
4803
+ const pendingDismissal = this.pendingDismissals.get(id);
4804
+ if (pendingDismissal !== void 0) {
4805
+ cancelAnimationFrame(pendingDismissal);
4806
+ this.pendingDismissals.delete(id);
4807
+ this.dismissedToasts.delete(id);
4808
+ }
4809
+ const wasDismissed = this.dismissedToasts.has(id);
3150
4810
  const dismissible = data.dismissible === void 0 ? true : data.dismissible;
3151
- if (this.dismissedToasts.has(id)) this.dismissedToasts.delete(id);
3152
- if (alreadyExists) this.toasts = this.toasts.map((toast) => {
4811
+ if (wasDismissed) {
4812
+ this.dismissedToasts.delete(id);
4813
+ this.toasts = this.toasts.filter((toast) => toast.id !== id);
4814
+ }
4815
+ if (wasDismissed ? void 0 : this.toasts.find((toast) => {
4816
+ return toast.id === id;
4817
+ })) this.toasts = this.toasts.map((toast) => {
3153
4818
  if (toast.id === id) {
3154
4819
  this.publish({
3155
4820
  ...toast,
@@ -3176,24 +4841,33 @@ var Observer = class {
3176
4841
  return id;
3177
4842
  };
3178
4843
  this.dismiss = (id) => {
3179
- if (id) {
3180
- this.dismissedToasts.add(id);
3181
- requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({
3182
- id,
3183
- dismiss: true
3184
- })));
3185
- } else this.toasts.forEach((toast) => {
4844
+ if (id === void 0 || id === null) {
4845
+ this.getActiveToasts().forEach((toast) => {
4846
+ this.dismissedToasts.add(toast.id);
4847
+ this.subscribers.forEach((subscriber) => subscriber({
4848
+ id: toast.id,
4849
+ dismiss: true
4850
+ }));
4851
+ });
4852
+ return id;
4853
+ }
4854
+ this.dismissedToasts.add(id);
4855
+ const alreadyPending = this.pendingDismissals.get(id);
4856
+ if (alreadyPending !== void 0) cancelAnimationFrame(alreadyPending);
4857
+ this.pendingDismissals.set(id, requestAnimationFrame(() => {
4858
+ this.pendingDismissals.delete(id);
3186
4859
  this.subscribers.forEach((subscriber) => subscriber({
3187
- id: toast.id,
4860
+ id,
3188
4861
  dismiss: true
3189
4862
  }));
3190
- });
4863
+ }));
3191
4864
  return id;
3192
4865
  };
3193
4866
  this.message = (message, data) => {
3194
4867
  return this.create({
3195
4868
  ...data,
3196
- message
4869
+ message,
4870
+ type: void 0
3197
4871
  });
3198
4872
  };
3199
4873
  this.error = (message, data) => {
@@ -3313,11 +4987,12 @@ var Observer = class {
3313
4987
  else return Object.assign(id, { unwrap });
3314
4988
  };
3315
4989
  this.custom = (jsx, data) => {
3316
- const id = (data == null ? void 0 : data.id) || toastsCounter++;
4990
+ const id = getToastId(data);
3317
4991
  this.create({
4992
+ ...data,
3318
4993
  jsx: jsx(id),
3319
4994
  id,
3320
- ...data
4995
+ type: void 0
3321
4996
  });
3322
4997
  return id;
3323
4998
  };
@@ -3327,17 +5002,12 @@ var Observer = class {
3327
5002
  this.subscribers = [];
3328
5003
  this.toasts = [];
3329
5004
  this.dismissedToasts = /* @__PURE__ */ new Set();
5005
+ this.pendingDismissals = /* @__PURE__ */ new Map();
3330
5006
  }
3331
5007
  };
3332
5008
  var ToastState = new Observer();
3333
5009
  var toastFunction = (message, data) => {
3334
- const id = (data == null ? void 0 : data.id) || toastsCounter++;
3335
- ToastState.addToast({
3336
- title: message,
3337
- ...data,
3338
- id
3339
- });
3340
- return id;
5010
+ return ToastState.message(message, data);
3341
5011
  };
3342
5012
  var isHttpResponse = (data) => {
3343
5013
  return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
@@ -3359,7 +5029,7 @@ var toast = Object.assign(basicToast, {
3359
5029
  getHistory,
3360
5030
  getToasts
3361
5031
  });
3362
- __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
5032
+ __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
3363
5033
  function isAction(action) {
3364
5034
  return action.label !== void 0;
3365
5035
  }
@@ -3399,6 +5069,7 @@ var Toast = (props) => {
3399
5069
  const isFront = index === 0;
3400
5070
  const isVisible = index + 1 <= visibleToasts;
3401
5071
  const toastType = toast.type;
5072
+ const toastTypeKey = toastType != null ? toastType : "default";
3402
5073
  const dismissible = toast.dismissible !== false;
3403
5074
  const toastClassname = toast.className || "";
3404
5075
  const toastDescriptionClassname = toast.descriptionClassName || "";
@@ -3420,6 +5091,10 @@ var Toast = (props) => {
3420
5091
  }, 0);
3421
5092
  }, [heights, heightIndex]);
3422
5093
  const isDocumentHidden = useIsDocumentHidden();
5094
+ const swipeDirections = import_react.useMemo(() => {
5095
+ var _props_swipeDirections;
5096
+ return (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
5097
+ }, [props.swipeDirections, position]);
3423
5098
  const invert = toast.invert || ToasterInvert;
3424
5099
  const disabled = toastType === "loading";
3425
5100
  offset.current = import_react.useMemo(() => heightIndex * gap + toastsHeightBefore, [heightIndex, toastsHeightBefore]);
@@ -3538,7 +5213,7 @@ var Toast = (props) => {
3538
5213
  return /*#__PURE__*/ import_react.createElement("li", {
3539
5214
  tabIndex: 0,
3540
5215
  ref: toastRef,
3541
- className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastType]),
5216
+ className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames[toastTypeKey], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastTypeKey]),
3542
5217
  "data-sonner-toast": "",
3543
5218
  "data-rich-colors": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors,
3544
5219
  "data-styled": !Boolean(toast.jsx || toast.unstyled || unstyled),
@@ -3595,7 +5270,7 @@ var Toast = (props) => {
3595
5270
  const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
3596
5271
  const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
3597
5272
  const velocity = Math.abs(swipeAmount) / timeTaken;
3598
- if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > .11) {
5273
+ if ((swipeDirection === "x" ? swipeDirections.includes(swipeAmountX > 0 ? "right" : "left") : swipeDirections.includes(swipeAmountY > 0 ? "bottom" : "top")) && (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > .11)) {
3599
5274
  setOffsetBeforeRemove(offset.current);
3600
5275
  toast.onDismiss == null || toast.onDismiss.call(toast, toast);
3601
5276
  if (swipeDirection === "x") setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
@@ -3618,8 +5293,6 @@ var Toast = (props) => {
3618
5293
  if (((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0) return;
3619
5294
  const yDelta = event.clientY - pointerStartRef.current.y;
3620
5295
  const xDelta = event.clientX - pointerStartRef.current.x;
3621
- var _props_swipeDirections;
3622
- const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
3623
5296
  if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
3624
5297
  let swipeAmount = {
3625
5298
  x: 0,
@@ -3661,7 +5334,7 @@ var Toast = (props) => {
3661
5334
  }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ? /*#__PURE__*/ import_react.createElement("div", {
3662
5335
  "data-icon": "",
3663
5336
  className: cn(classNames == null ? void 0 : classNames.icon, toast == null ? void 0 : (_toast_classNames3 = toast.classNames) == null ? void 0 : _toast_classNames3.icon)
3664
- }, toast.promise || toast.type === "loading" && !toast.icon ? toast.icon || getLoadingIcon() : null, toast.type !== "loading" ? icon : null) : null, /*#__PURE__*/ import_react.createElement("div", {
5337
+ }, toastType === "loading" ? toast.icon || getLoadingIcon() : toast.promise ? getLoadingIcon() : null, toastType !== "loading" ? icon : null) : null, /*#__PURE__*/ import_react.createElement("div", {
3665
5338
  "data-content": "",
3666
5339
  className: cn(classNames == null ? void 0 : classNames.content, toast == null ? void 0 : (_toast_classNames4 = toast.classNames) == null ? void 0 : _toast_classNames4.content)
3667
5340
  }, /*#__PURE__*/ import_react.createElement("div", {
@@ -3732,7 +5405,7 @@ function assignOffset(defaultOffset, mobileOffset) {
3732
5405
  return styles;
3733
5406
  }
3734
5407
  var Toaster = /*#__PURE__*/ import_react.forwardRef(function Toaster(props, ref) {
3735
- const { id, invert, position = "bottom-right", hotkey = ["altKey", "KeyT"], expand, closeButton, className, offset, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
5408
+ const { id, invert, position = "bottom-right", hotkey = ["altKey", "KeyT"], expand, closeButton, className, offset, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, customAriaLabel, containerAriaLabel = "Notifications" } = props;
3736
5409
  const [toasts, setToasts] = import_react.useState([]);
3737
5410
  const filteredToasts = import_react.useMemo(() => {
3738
5411
  if (id) return toasts.filter((toast) => toast.toasterId === id);
@@ -3784,7 +5457,7 @@ var Toaster = /*#__PURE__*/ import_react.forwardRef(function Toaster(props, ref)
3784
5457
  });
3785
5458
  });
3786
5459
  });
3787
- }, [toasts]);
5460
+ }, []);
3788
5461
  import_react.useEffect(() => {
3789
5462
  if (theme !== "system") {
3790
5463
  setActualTheme(theme);
@@ -3818,7 +5491,7 @@ var Toaster = /*#__PURE__*/ import_react.forwardRef(function Toaster(props, ref)
3818
5491
  import_react.useEffect(() => {
3819
5492
  const handleKeyDown = (event) => {
3820
5493
  var _listRef_current;
3821
- if (hotkey.every((key) => event[key] || event.code === key)) {
5494
+ if (hotkey.length > 0 && hotkey.every((key) => event[key] || event.code === key)) {
3822
5495
  var _listRef_current1;
3823
5496
  setExpanded(true);
3824
5497
  (_listRef_current1 = listRef.current) == null || _listRef_current1.focus();
@@ -3839,12 +5512,13 @@ var Toaster = /*#__PURE__*/ import_react.forwardRef(function Toaster(props, ref)
3839
5512
  }, [listRef.current]);
3840
5513
  return /*#__PURE__*/ import_react.createElement("section", {
3841
5514
  ref,
3842
- "aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
5515
+ "aria-label": customAriaLabel != null ? customAriaLabel : `${containerAriaLabel} ${hotkeyLabel}`,
3843
5516
  tabIndex: -1,
3844
5517
  "aria-live": "polite",
3845
5518
  "aria-relevant": "additions text",
3846
5519
  "aria-atomic": "false",
3847
- suppressHydrationWarning: true
5520
+ suppressHydrationWarning: true,
5521
+ "data-react-aria-top-layer": true
3848
5522
  }, possiblePositions.map((position, index) => {
3849
5523
  var _heights_;
3850
5524
  const [y, x] = position.split("-");
@@ -3927,4 +5601,4 @@ var Toaster = /*#__PURE__*/ import_react.forwardRef(function Toaster(props, ref)
3927
5601
  }));
3928
5602
  }));
3929
5603
  });
3930
- export { useFloating as _, Portal as a, TooltipProvider as c, flip as d, hide as f, size as g, shift as h, Content2 as i, Trigger as l, offset as m, toast as n, Provider as o, limitShift as p, Arrow2 as r, Root3 as s, Toaster as t, arrow as u, autoUpdate as v };
5604
+ export { Slottable$1 as A, DismissableLayer as C, Primitive as D, useLayoutEffect2 as E, Link as F, ScrollRestoration as I, useSearchParams as L, createContextScope as M, useComposedRefs as N, dispatchDiscreteCustomEvent as O, composeEventHandlers as P, useFocusScopeBranchRegistry as S, useCallbackRef as T, useSize as _, TooltipContent as a, FocusScopeBranchProvider as b, TooltipTrigger as c, Presence as d, Portal as f, createPopperScope as g, PopperContent as h, TooltipArrow as i, createSlot as j, Slot as k, VISUALLY_HIDDEN_STYLES as l, PopperAnchor as m, toast as n, TooltipPortal as o, Popper as p, Tooltip as r, TooltipProvider as s, Toaster as t, useControllableState as u, useId as v, useDismissableLayerSurface as w, useFocusScopeBranch as x, FocusScope as y };