@octaviaflow/core 3.1.0-beta.68 → 3.1.0-beta.70

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 (63) hide show
  1. package/dist/chunk-64R3BAO7.js +2755 -0
  2. package/dist/chunk-64R3BAO7.js.map +1 -0
  3. package/dist/chunk-7S3CSRRV.js +5700 -0
  4. package/dist/chunk-7S3CSRRV.js.map +1 -0
  5. package/dist/chunk-KCA7V5VN.js +5752 -0
  6. package/dist/chunk-KCA7V5VN.js.map +1 -0
  7. package/dist/chunk-KQKD4Z4H.js +1682 -0
  8. package/dist/chunk-KQKD4Z4H.js.map +1 -0
  9. package/dist/chunk-PWCRELX4.js +5700 -0
  10. package/dist/chunk-PWCRELX4.js.map +1 -0
  11. package/dist/chunk-U5T63SPL.js +5695 -0
  12. package/dist/chunk-U5T63SPL.js.map +1 -0
  13. package/dist/chunk-YIPBLM3G.js +2698 -0
  14. package/dist/chunk-YIPBLM3G.js.map +1 -0
  15. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  16. package/dist/index.cjs +5 -0
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +4462 -6007
  19. package/dist/index.js.map +1 -1
  20. package/dist/marketing/components/BackedBy/BackedBy.d.ts +17 -0
  21. package/dist/marketing/components/BackedBy/BackedBy.d.ts.map +1 -0
  22. package/dist/marketing/components/BetaAccessForm/BetaAccessForm.d.ts +36 -0
  23. package/dist/marketing/components/BetaAccessForm/BetaAccessForm.d.ts.map +1 -0
  24. package/dist/marketing/components/BlogGrid/BlogGrid.d.ts +32 -0
  25. package/dist/marketing/components/BlogGrid/BlogGrid.d.ts.map +1 -0
  26. package/dist/marketing/components/ContactForm/ContactForm.d.ts +31 -0
  27. package/dist/marketing/components/ContactForm/ContactForm.d.ts.map +1 -0
  28. package/dist/marketing/components/FaqSection/FaqSection.d.ts +13 -0
  29. package/dist/marketing/components/FaqSection/FaqSection.d.ts.map +1 -0
  30. package/dist/marketing/components/IntegrationsFinder/IntegrationsFinder.d.ts +32 -0
  31. package/dist/marketing/components/IntegrationsFinder/IntegrationsFinder.d.ts.map +1 -0
  32. package/dist/marketing/components/IntegrationsWall/IntegrationsWall.d.ts +5 -3
  33. package/dist/marketing/components/IntegrationsWall/IntegrationsWall.d.ts.map +1 -1
  34. package/dist/marketing/components/LiveConsole/LiveConsole.d.ts.map +1 -1
  35. package/dist/marketing/components/LogoMarquee/LogoMarquee.d.ts +18 -0
  36. package/dist/marketing/components/LogoMarquee/LogoMarquee.d.ts.map +1 -0
  37. package/dist/marketing/components/MarketingFooter/MarketingFooter.d.ts +6 -1
  38. package/dist/marketing/components/MarketingFooter/MarketingFooter.d.ts.map +1 -1
  39. package/dist/marketing/components/PageHero/PageHero.d.ts +12 -0
  40. package/dist/marketing/components/PageHero/PageHero.d.ts.map +1 -0
  41. package/dist/marketing/components/PricingTiers/PricingTiers.d.ts +29 -0
  42. package/dist/marketing/components/PricingTiers/PricingTiers.d.ts.map +1 -0
  43. package/dist/marketing/components/TestimonialStrip/TestimonialStrip.d.ts +24 -0
  44. package/dist/marketing/components/TestimonialStrip/TestimonialStrip.d.ts.map +1 -0
  45. package/dist/marketing/components/WorkflowShowcase/ShowcaseScene.d.ts +4 -2
  46. package/dist/marketing/components/WorkflowShowcase/ShowcaseScene.d.ts.map +1 -1
  47. package/dist/marketing/components/WorkflowShowcase/WorkflowShowcase.d.ts +9 -1
  48. package/dist/marketing/components/WorkflowShowcase/WorkflowShowcase.d.ts.map +1 -1
  49. package/dist/marketing/components/WorkflowShowcase/showcaseEngine.d.ts +3 -1
  50. package/dist/marketing/components/WorkflowShowcase/showcaseEngine.d.ts.map +1 -1
  51. package/dist/marketing/index.d.ts +10 -0
  52. package/dist/marketing/index.d.ts.map +1 -1
  53. package/dist/marketing.cjs +5568 -2972
  54. package/dist/marketing.cjs.map +1 -1
  55. package/dist/marketing.js +1650 -717
  56. package/dist/marketing.js.map +1 -1
  57. package/dist/styles.css +1 -1
  58. package/dist/workflow/components/HttpActionPanel/HttpActionPanel.d.ts.map +1 -1
  59. package/dist/workflow.cjs +51 -4
  60. package/dist/workflow.cjs.map +1 -1
  61. package/dist/workflow.js +51 -9
  62. package/dist/workflow.js.map +1 -1
  63. package/package.json +1 -1
@@ -0,0 +1,2755 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-ZAUUGK2Y.js";
4
+
5
+ // src/components/Accordion/Accordion.tsx
6
+ import { ChevronDownIcon } from "@octaviaflow/icons";
7
+ import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
8
+ import {
9
+ forwardRef,
10
+ useCallback,
11
+ useId,
12
+ useState
13
+ } from "react";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ var Accordion = forwardRef(
16
+ function Accordion2({
17
+ items,
18
+ mode = "single",
19
+ value: controlledValue,
20
+ defaultValue,
21
+ onValueChange,
22
+ collapsible = true,
23
+ variant = "default",
24
+ size = "md",
25
+ disabled = false,
26
+ id: providedId,
27
+ className,
28
+ ...rest
29
+ }, ref) {
30
+ const reactId = useId();
31
+ const baseId = providedId ?? `ods-accordion-${reactId}`;
32
+ const reducedMotion = useReducedMotion();
33
+ const [internalValue, setInternalValue] = useState(
34
+ defaultValue ?? []
35
+ );
36
+ const isControlled = controlledValue !== void 0;
37
+ const value = isControlled ? controlledValue : internalValue;
38
+ const valueSet = new Set(value);
39
+ const setValue = useCallback(
40
+ (next) => {
41
+ if (!isControlled) setInternalValue(next);
42
+ onValueChange?.(next);
43
+ },
44
+ [isControlled, onValueChange]
45
+ );
46
+ const toggleItem = useCallback(
47
+ (id) => {
48
+ const isOpen = valueSet.has(id);
49
+ if (mode === "multiple") {
50
+ const next = isOpen ? value.filter((v) => v !== id) : [...value, id];
51
+ setValue(next);
52
+ return;
53
+ }
54
+ if (isOpen) {
55
+ if (collapsible) setValue([]);
56
+ return;
57
+ }
58
+ setValue([id]);
59
+ },
60
+ [collapsible, mode, setValue, value, valueSet]
61
+ );
62
+ const handleKeyDown = (e, index) => {
63
+ const enabledIdx = items.map((it, i) => it.disabled ? -1 : i).filter((i) => i !== -1);
64
+ const curr = enabledIdx.indexOf(index);
65
+ const focusIdx = (i) => {
66
+ const target = enabledIdx[i];
67
+ if (target === void 0) return;
68
+ const btn = document.getElementById(
69
+ `${baseId}-trigger-${items[target].id}`
70
+ );
71
+ btn?.focus();
72
+ };
73
+ if (e.key === "ArrowDown") {
74
+ e.preventDefault();
75
+ focusIdx((curr + 1) % enabledIdx.length);
76
+ } else if (e.key === "ArrowUp") {
77
+ e.preventDefault();
78
+ focusIdx((curr - 1 + enabledIdx.length) % enabledIdx.length);
79
+ } else if (e.key === "Home") {
80
+ e.preventDefault();
81
+ focusIdx(0);
82
+ } else if (e.key === "End") {
83
+ e.preventDefault();
84
+ focusIdx(enabledIdx.length - 1);
85
+ }
86
+ };
87
+ return /* @__PURE__ */ jsx(
88
+ "div",
89
+ {
90
+ ...rest,
91
+ ref,
92
+ id: baseId,
93
+ className: cn(
94
+ "ods-accordion",
95
+ `ods-accordion--${variant}`,
96
+ `ods-accordion--${size}`,
97
+ disabled && "ods-accordion--disabled",
98
+ className
99
+ ),
100
+ children: items.map((item, i) => {
101
+ const isOpen = valueSet.has(item.id);
102
+ const itemDisabled = item.disabled || disabled;
103
+ const triggerId = `${baseId}-trigger-${item.id}`;
104
+ const panelId = `${baseId}-panel-${item.id}`;
105
+ return /* @__PURE__ */ jsxs(
106
+ "div",
107
+ {
108
+ className: cn(
109
+ "ods-accordion__item",
110
+ isOpen && "ods-accordion__item--open",
111
+ itemDisabled && "ods-accordion__item--disabled"
112
+ ),
113
+ children: [
114
+ /* @__PURE__ */ jsxs(
115
+ "button",
116
+ {
117
+ id: triggerId,
118
+ type: "button",
119
+ className: "ods-accordion__trigger",
120
+ "aria-expanded": isOpen,
121
+ "aria-controls": panelId,
122
+ disabled: itemDisabled,
123
+ onClick: () => toggleItem(item.id),
124
+ onKeyDown: (e) => handleKeyDown(e, i),
125
+ children: [
126
+ item.icon && /* @__PURE__ */ jsx(
127
+ "span",
128
+ {
129
+ className: "ods-accordion__icon",
130
+ "aria-hidden": "true",
131
+ children: item.icon
132
+ }
133
+ ),
134
+ /* @__PURE__ */ jsxs("span", { className: "ods-accordion__label-wrap", children: [
135
+ /* @__PURE__ */ jsx("span", { className: "ods-accordion__label", children: item.label }),
136
+ item.description && /* @__PURE__ */ jsx("span", { className: "ods-accordion__description", children: item.description })
137
+ ] }),
138
+ item.trailing && /* @__PURE__ */ jsx(
139
+ "span",
140
+ {
141
+ className: "ods-accordion__trailing",
142
+ onClick: (e) => e.stopPropagation(),
143
+ children: item.trailing
144
+ }
145
+ ),
146
+ /* @__PURE__ */ jsx(
147
+ "span",
148
+ {
149
+ className: cn(
150
+ "ods-accordion__chevron",
151
+ isOpen && "ods-accordion__chevron--open"
152
+ ),
153
+ "aria-hidden": "true",
154
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "sm", "aria-hidden": true })
155
+ }
156
+ )
157
+ ]
158
+ }
159
+ ),
160
+ /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: isOpen && /* @__PURE__ */ jsx(
161
+ motion.div,
162
+ {
163
+ role: "region",
164
+ id: panelId,
165
+ "aria-labelledby": triggerId,
166
+ className: "ods-accordion__panel",
167
+ initial: reducedMotion ? false : { height: 0, opacity: 0 },
168
+ animate: reducedMotion ? void 0 : { height: "auto", opacity: 1 },
169
+ exit: reducedMotion ? void 0 : { height: 0, opacity: 0 },
170
+ transition: reducedMotion ? { duration: 0 } : { duration: 0.18 },
171
+ style: { overflow: "hidden" },
172
+ children: /* @__PURE__ */ jsx("div", { className: "ods-accordion__content", children: item.content })
173
+ }
174
+ ) })
175
+ ]
176
+ },
177
+ item.id
178
+ );
179
+ })
180
+ }
181
+ );
182
+ }
183
+ );
184
+ Accordion.displayName = "Accordion";
185
+
186
+ // src/components/Button/Button.tsx
187
+ import { motion as motion2, useReducedMotion as useReducedMotion2 } from "framer-motion";
188
+ import {
189
+ forwardRef as forwardRef3,
190
+ useImperativeHandle,
191
+ useRef
192
+ } from "react";
193
+ import { useButton } from "react-aria";
194
+
195
+ // src/utils/a11y.ts
196
+ import { isValidElement } from "react";
197
+ function hasRenderableText(node) {
198
+ if (node === null || node === void 0 || typeof node === "boolean") return false;
199
+ if (typeof node === "string") return node.trim().length > 0;
200
+ if (typeof node === "number") return true;
201
+ if (Array.isArray(node)) return node.some(hasRenderableText);
202
+ if (isValidElement(node)) {
203
+ return hasRenderableText(node.props.children);
204
+ }
205
+ return false;
206
+ }
207
+ function getRenderableText(node) {
208
+ if (node === null || node === void 0 || typeof node === "boolean") return "";
209
+ if (typeof node === "string") return node;
210
+ if (typeof node === "number") return String(node);
211
+ if (Array.isArray(node)) return node.map(getRenderableText).join("");
212
+ if (isValidElement(node)) {
213
+ return getRenderableText(node.props.children);
214
+ }
215
+ return "";
216
+ }
217
+ function resolveAccessibleName(input) {
218
+ if (input.ariaLabelledby) {
219
+ return { "aria-labelledby": input.ariaLabelledby };
220
+ }
221
+ if (input.ariaLabel) {
222
+ return { "aria-label": input.ariaLabel };
223
+ }
224
+ if (typeof input.label === "string" && input.label.trim().length > 0) {
225
+ return { "aria-label": input.label };
226
+ }
227
+ for (const candidate of input.fallbacks ?? []) {
228
+ if (typeof candidate === "string" && candidate.trim().length > 0) {
229
+ return { "aria-label": candidate };
230
+ }
231
+ }
232
+ if (process.env.NODE_ENV !== "production") {
233
+ console.error(
234
+ `[@octaviaflow/core ${input.componentName}] No accessible name. Pass a string \`label\`, or \`aria-label\`, or \`aria-labelledby\` so screen readers can announce this control.`
235
+ );
236
+ }
237
+ return { "aria-label": `Unlabeled ${input.componentName}` };
238
+ }
239
+
240
+ // src/utils/Slot.tsx
241
+ import {
242
+ Children,
243
+ cloneElement,
244
+ forwardRef as forwardRef2,
245
+ isValidElement as isValidElement2
246
+ } from "react";
247
+
248
+ // src/utils/composeRefs.ts
249
+ function composeRefs(...refs) {
250
+ return (node) => {
251
+ for (const ref of refs) {
252
+ if (typeof ref === "function") {
253
+ ref(node);
254
+ } else if (ref != null) {
255
+ ref.current = node;
256
+ }
257
+ }
258
+ };
259
+ }
260
+
261
+ // src/utils/Slot.tsx
262
+ var Slot = forwardRef2(function Slot2({ children, ...slotProps }, forwardedRef) {
263
+ if (!isValidElement2(children)) {
264
+ return null;
265
+ }
266
+ const child = Children.only(children);
267
+ const childProps = child.props ?? {};
268
+ const childRef = child.ref;
269
+ return cloneElement(child, {
270
+ ...mergeProps(slotProps, childProps),
271
+ ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
272
+ });
273
+ });
274
+ function mergeProps(slotProps, childProps) {
275
+ const merged = { ...slotProps, ...childProps };
276
+ for (const key of Object.keys(slotProps)) {
277
+ const slotValue = slotProps[key];
278
+ const childValue = childProps[key];
279
+ if (/^on[A-Z]/.test(key) && typeof slotValue === "function" && typeof childValue === "function") {
280
+ merged[key] = (...args) => {
281
+ slotValue(...args);
282
+ const event = args[0];
283
+ if (event?.defaultPrevented) return;
284
+ childValue(...args);
285
+ };
286
+ continue;
287
+ }
288
+ if (key === "className") {
289
+ merged.className = [slotValue, childValue].filter(Boolean).join(" ");
290
+ continue;
291
+ }
292
+ if (key === "style") {
293
+ merged.style = {
294
+ ...slotValue,
295
+ ...childValue
296
+ };
297
+ continue;
298
+ }
299
+ }
300
+ return merged;
301
+ }
302
+
303
+ // src/components/Button/Button.tsx
304
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
305
+ var Button = forwardRef3(function Button2({
306
+ variant = "primary",
307
+ size = "md",
308
+ loading = false,
309
+ loadingText,
310
+ loadingLabel = "Loading",
311
+ disabled = false,
312
+ leftIcon,
313
+ rightIcon,
314
+ fullWidth = false,
315
+ pressed,
316
+ asChild = false,
317
+ className,
318
+ children,
319
+ type,
320
+ cursor,
321
+ style,
322
+ ...props
323
+ }, forwardedRef) {
324
+ const ref = useRef(null);
325
+ useImperativeHandle(forwardedRef, () => ref.current);
326
+ const isDisabled = disabled || loading;
327
+ const prefersReducedMotion = useReducedMotion2();
328
+ const hasAction = Boolean(props.onClick) || type === "submit" || type === "reset";
329
+ const resolvedCursor = cursor ?? (disabled ? "not-allowed" : loading ? "progress" : hasAction ? "pointer" : "default");
330
+ const resolvedType = type ?? "button";
331
+ const hasVisibleText = hasRenderableText(children);
332
+ const needsAriaName = !hasVisibleText && !asChild;
333
+ const ariaNameProps = needsAriaName ? resolveAccessibleName({
334
+ ariaLabel: props["aria-label"],
335
+ ariaLabelledby: props["aria-labelledby"],
336
+ componentName: "Button"
337
+ }) : void 0;
338
+ const { buttonProps } = useButton(
339
+ {
340
+ isDisabled,
341
+ onPress: props.onClick,
342
+ type: resolvedType,
343
+ ...ariaNameProps ?? {}
344
+ },
345
+ ref
346
+ );
347
+ const { onDrag, onDragStart, onDragEnd, onAnimationStart, ...safeButtonProps } = buttonProps;
348
+ const {
349
+ onClick: _onClick,
350
+ onKeyDown: _onKeyDown,
351
+ onKeyUp: _onKeyUp,
352
+ onMouseDown: _onMouseDown,
353
+ onPointerDown: _onPointerDown,
354
+ onPointerUp: _onPointerUp,
355
+ onFocus: _onFocus,
356
+ onBlur: _onBlur,
357
+ ...passthroughProps
358
+ } = props;
359
+ const rootClassName = cn(
360
+ "ods-btn",
361
+ `ods-btn--${variant}`,
362
+ `ods-btn--${size}`,
363
+ loading && "ods-btn--loading",
364
+ fullWidth && "ods-btn--full",
365
+ pressed && "ods-btn--pressed",
366
+ className
367
+ );
368
+ if (asChild) {
369
+ return /* @__PURE__ */ jsx2(
370
+ Slot,
371
+ {
372
+ ...passthroughProps,
373
+ ref: forwardedRef,
374
+ className: rootClassName,
375
+ style: { cursor: resolvedCursor, ...style },
376
+ "aria-pressed": pressed,
377
+ "aria-disabled": isDisabled || void 0,
378
+ children
379
+ }
380
+ );
381
+ }
382
+ const visibleLabel = loading && loadingText !== void 0 ? loadingText : children;
383
+ return /* @__PURE__ */ jsx2(
384
+ motion2.button,
385
+ {
386
+ ...passthroughProps,
387
+ ...safeButtonProps,
388
+ type: resolvedType,
389
+ ref,
390
+ className: rootClassName,
391
+ style: { cursor: resolvedCursor, ...style },
392
+ "data-loading": loading || void 0,
393
+ "aria-busy": loading || void 0,
394
+ "aria-pressed": pressed,
395
+ whileTap: isDisabled || prefersReducedMotion ? void 0 : { scale: 0.97 },
396
+ transition: { duration: 0.1 },
397
+ children: /* @__PURE__ */ jsxs2("span", { className: "ods-btn__content", children: [
398
+ loading ? /* @__PURE__ */ jsx2(
399
+ "span",
400
+ {
401
+ className: "ods-btn__icon ods-btn__icon--left ods-btn__icon--spinner",
402
+ role: "status",
403
+ "aria-label": loadingLabel,
404
+ children: /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx2(
405
+ "circle",
406
+ {
407
+ cx: "12",
408
+ cy: "12",
409
+ r: "10",
410
+ fill: "none",
411
+ stroke: "currentColor",
412
+ strokeWidth: "2.5",
413
+ strokeLinecap: "round",
414
+ strokeDasharray: "32",
415
+ strokeDashoffset: "12"
416
+ }
417
+ ) })
418
+ }
419
+ ) : leftIcon && /* @__PURE__ */ jsx2("span", { className: "ods-btn__icon ods-btn__icon--left", children: leftIcon }),
420
+ visibleLabel != null && visibleLabel !== false && /* @__PURE__ */ jsx2("span", { className: "ods-btn__label", children: visibleLabel }),
421
+ rightIcon && !loading && /* @__PURE__ */ jsx2("span", { className: "ods-btn__icon ods-btn__icon--right", children: rightIcon })
422
+ ] })
423
+ }
424
+ );
425
+ });
426
+ Button.displayName = "Button";
427
+
428
+ // src/components/Tooltip/Tooltip.tsx
429
+ import { AnimatePresence as AnimatePresence2, motion as motion3 } from "framer-motion";
430
+ import {
431
+ cloneElement as cloneElement2,
432
+ isValidElement as isValidElement3,
433
+ useCallback as useCallback2,
434
+ useEffect,
435
+ useId as useId2,
436
+ useLayoutEffect,
437
+ useRef as useRef2,
438
+ useState as useState2
439
+ } from "react";
440
+ import { useTooltip, useTooltipTrigger } from "react-aria";
441
+ import { createPortal } from "react-dom";
442
+
443
+ // ../../node_modules/react-stately/dist/private/utils/useControlledState.mjs
444
+ import $1CcWn$react, { useState as $1CcWn$useState, useRef as $1CcWn$useRef, useEffect as $1CcWn$useEffect, useReducer as $1CcWn$useReducer, useCallback as $1CcWn$useCallback } from "react";
445
+ var $3e6197669829fe11$var$useEarlyEffect = typeof document !== "undefined" ? (0, $1CcWn$react)["useInsertionEffect"] ?? (0, $1CcWn$react).useLayoutEffect : () => {
446
+ };
447
+ function $3e6197669829fe11$export$40bfa8c7b0832715(value, defaultValue, onChange) {
448
+ let [stateValue, setStateValue] = (0, $1CcWn$useState)(value || defaultValue);
449
+ let valueRef = (0, $1CcWn$useRef)(stateValue);
450
+ let isControlledRef = (0, $1CcWn$useRef)(value !== void 0);
451
+ let isControlled = value !== void 0;
452
+ (0, $1CcWn$useEffect)(() => {
453
+ let wasControlled = isControlledRef.current;
454
+ if (wasControlled !== isControlled && process.env.NODE_ENV !== "production") console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
455
+ isControlledRef.current = isControlled;
456
+ }, [
457
+ isControlled
458
+ ]);
459
+ let currentValue = isControlled ? value : stateValue;
460
+ $3e6197669829fe11$var$useEarlyEffect(() => {
461
+ valueRef.current = currentValue;
462
+ });
463
+ let [, forceUpdate] = (0, $1CcWn$useReducer)(() => ({}), {});
464
+ let setValue = (0, $1CcWn$useCallback)((value2, ...args) => {
465
+ let newValue = typeof value2 === "function" ? value2(valueRef.current) : value2;
466
+ if (!Object.is(valueRef.current, newValue)) {
467
+ valueRef.current = newValue;
468
+ setStateValue(newValue);
469
+ forceUpdate();
470
+ onChange?.(newValue, ...args);
471
+ }
472
+ }, [
473
+ onChange
474
+ ]);
475
+ return [
476
+ currentValue,
477
+ setValue
478
+ ];
479
+ }
480
+
481
+ // ../../node_modules/react-stately/dist/private/form/useFormValidationState.mjs
482
+ import { createContext as $8AuPP$createContext, useMemo as $8AuPP$useMemo, useContext as $8AuPP$useContext, useState as $8AuPP$useState, useRef as $8AuPP$useRef, useEffect as $8AuPP$useEffect } from "react";
483
+ var $fd2148440a13ec26$export$aca958c65c314e6c = {
484
+ badInput: false,
485
+ customError: false,
486
+ patternMismatch: false,
487
+ rangeOverflow: false,
488
+ rangeUnderflow: false,
489
+ stepMismatch: false,
490
+ tooLong: false,
491
+ tooShort: false,
492
+ typeMismatch: false,
493
+ valueMissing: false,
494
+ valid: true
495
+ };
496
+ var $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE = {
497
+ ...$fd2148440a13ec26$export$aca958c65c314e6c,
498
+ customError: true,
499
+ valid: false
500
+ };
501
+ var $fd2148440a13ec26$export$dad6ae84456c676a = {
502
+ isInvalid: false,
503
+ validationDetails: $fd2148440a13ec26$export$aca958c65c314e6c,
504
+ validationErrors: []
505
+ };
506
+ var $fd2148440a13ec26$export$571b5131b7e65c11 = (0, $8AuPP$createContext)({});
507
+ var $fd2148440a13ec26$export$a763b9476acd3eb = "__reactAriaFormValidationState";
508
+ function $fd2148440a13ec26$export$fc1a364ae1f3ff10(props) {
509
+ if (props[$fd2148440a13ec26$export$a763b9476acd3eb]) {
510
+ let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$fd2148440a13ec26$export$a763b9476acd3eb];
511
+ return {
512
+ realtimeValidation,
513
+ displayValidation,
514
+ updateValidation,
515
+ resetValidation,
516
+ commitValidation
517
+ };
518
+ }
519
+ return $fd2148440a13ec26$var$useFormValidationStateImpl(props);
520
+ }
521
+ function $fd2148440a13ec26$var$useFormValidationStateImpl(props) {
522
+ let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
523
+ if (validationState) isInvalid ||= validationState === "invalid";
524
+ let controlledError = isInvalid !== void 0 ? {
525
+ isInvalid,
526
+ validationErrors: [],
527
+ validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
528
+ } : null;
529
+ let clientError = (0, $8AuPP$useMemo)(() => {
530
+ if (!validate || value == null) return null;
531
+ let validateErrors = $fd2148440a13ec26$var$runValidate(validate, value);
532
+ return $fd2148440a13ec26$var$getValidationResult(validateErrors);
533
+ }, [
534
+ validate,
535
+ value
536
+ ]);
537
+ if (builtinValidation?.validationDetails.valid) builtinValidation = void 0;
538
+ let serverErrors = (0, $8AuPP$useContext)($fd2148440a13ec26$export$571b5131b7e65c11);
539
+ let serverErrorMessages = (0, $8AuPP$useMemo)(() => {
540
+ if (name) return Array.isArray(name) ? name.flatMap((name2) => $fd2148440a13ec26$var$asArray(serverErrors[name2])) : $fd2148440a13ec26$var$asArray(serverErrors[name]);
541
+ return [];
542
+ }, [
543
+ serverErrors,
544
+ name
545
+ ]);
546
+ let [lastServerErrors, setLastServerErrors] = (0, $8AuPP$useState)(serverErrors);
547
+ let [isServerErrorCleared, setServerErrorCleared] = (0, $8AuPP$useState)(false);
548
+ if (serverErrors !== lastServerErrors) {
549
+ setLastServerErrors(serverErrors);
550
+ setServerErrorCleared(false);
551
+ }
552
+ let serverError = (0, $8AuPP$useMemo)(() => $fd2148440a13ec26$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
553
+ isServerErrorCleared,
554
+ serverErrorMessages
555
+ ]);
556
+ let nextValidation = (0, $8AuPP$useRef)($fd2148440a13ec26$export$dad6ae84456c676a);
557
+ let [currentValidity, setCurrentValidity] = (0, $8AuPP$useState)($fd2148440a13ec26$export$dad6ae84456c676a);
558
+ let lastError = (0, $8AuPP$useRef)($fd2148440a13ec26$export$dad6ae84456c676a);
559
+ let commitValidation = () => {
560
+ if (!commitQueued) return;
561
+ setCommitQueued(false);
562
+ let error = clientError || builtinValidation || nextValidation.current;
563
+ if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
564
+ lastError.current = error;
565
+ setCurrentValidity(error);
566
+ }
567
+ };
568
+ let [commitQueued, setCommitQueued] = (0, $8AuPP$useState)(false);
569
+ (0, $8AuPP$useEffect)(commitValidation);
570
+ let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $fd2148440a13ec26$export$dad6ae84456c676a;
571
+ let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
572
+ return {
573
+ realtimeValidation,
574
+ displayValidation,
575
+ updateValidation(value2) {
576
+ if (validationBehavior === "aria" && !$fd2148440a13ec26$var$isEqualValidation(currentValidity, value2)) setCurrentValidity(value2);
577
+ else nextValidation.current = value2;
578
+ },
579
+ resetValidation() {
580
+ let error = $fd2148440a13ec26$export$dad6ae84456c676a;
581
+ if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
582
+ lastError.current = error;
583
+ setCurrentValidity(error);
584
+ }
585
+ if (validationBehavior === "native") setCommitQueued(false);
586
+ setServerErrorCleared(true);
587
+ },
588
+ commitValidation() {
589
+ if (validationBehavior === "native") setCommitQueued(true);
590
+ setServerErrorCleared(true);
591
+ }
592
+ };
593
+ }
594
+ function $fd2148440a13ec26$var$asArray(v) {
595
+ if (!v) return [];
596
+ return Array.isArray(v) ? v : [
597
+ v
598
+ ];
599
+ }
600
+ function $fd2148440a13ec26$var$runValidate(validate, value) {
601
+ if (typeof validate === "function") {
602
+ let e = validate(value);
603
+ if (e && typeof e !== "boolean") return $fd2148440a13ec26$var$asArray(e);
604
+ }
605
+ return [];
606
+ }
607
+ function $fd2148440a13ec26$var$getValidationResult(errors) {
608
+ return errors.length ? {
609
+ isInvalid: true,
610
+ validationErrors: errors,
611
+ validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
612
+ } : null;
613
+ }
614
+ function $fd2148440a13ec26$var$isEqualValidation(a, b) {
615
+ if (a === b) return true;
616
+ return !!a && !!b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
617
+ }
618
+
619
+ // ../../node_modules/react-stately/dist/private/collections/getChildNodes.mjs
620
+ function $cd5ea4b915021f1d$export$1005530eda016c13(node, collection) {
621
+ if (typeof collection.getChildren === "function") return collection.getChildren(node.key);
622
+ return node.childNodes;
623
+ }
624
+ function $cd5ea4b915021f1d$export$fbdeaa6a76694f71(iterable) {
625
+ return $cd5ea4b915021f1d$export$5f3398f8733f90e2(iterable, 0);
626
+ }
627
+ function $cd5ea4b915021f1d$export$5f3398f8733f90e2(iterable, index) {
628
+ if (index < 0) return void 0;
629
+ let i = 0;
630
+ for (let item of iterable) {
631
+ if (i === index) return item;
632
+ i++;
633
+ }
634
+ }
635
+ function $cd5ea4b915021f1d$export$8c434b3a7a4dad6(collection, a, b) {
636
+ if (a.parentKey === b.parentKey) return a.index - b.index;
637
+ let aAncestors = [
638
+ ...$cd5ea4b915021f1d$var$getAncestors(collection, a),
639
+ a
640
+ ];
641
+ let bAncestors = [
642
+ ...$cd5ea4b915021f1d$var$getAncestors(collection, b),
643
+ b
644
+ ];
645
+ let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a2, i) => a2 !== bAncestors[i]);
646
+ if (firstNonMatchingAncestor !== -1) {
647
+ a = aAncestors[firstNonMatchingAncestor];
648
+ b = bAncestors[firstNonMatchingAncestor];
649
+ return a.index - b.index;
650
+ }
651
+ if (aAncestors.findIndex((node) => node === b) >= 0) return 1;
652
+ else if (bAncestors.findIndex((node) => node === a) >= 0) return -1;
653
+ return -1;
654
+ }
655
+ function $cd5ea4b915021f1d$var$getAncestors(collection, node) {
656
+ let parents = [];
657
+ let currNode = node;
658
+ while (currNode?.parentKey != null) {
659
+ currNode = collection.getItem(currNode.parentKey);
660
+ if (currNode) parents.unshift(currNode);
661
+ }
662
+ return parents;
663
+ }
664
+
665
+ // ../../node_modules/react-stately/dist/private/list/ListCollection.mjs
666
+ var $f664a81d022446b5$export$d085fb9e920b5ca7 = class {
667
+ constructor(nodes) {
668
+ this.keyMap = /* @__PURE__ */ new Map();
669
+ this.firstKey = null;
670
+ this.lastKey = null;
671
+ this.iterable = nodes;
672
+ let visit = (node) => {
673
+ this.keyMap.set(node.key, node);
674
+ if (node.childNodes && node.type === "section") for (let child of node.childNodes) visit(child);
675
+ };
676
+ for (let node of nodes) visit(node);
677
+ let last = null;
678
+ let index = 0;
679
+ let size = 0;
680
+ for (let [key, node] of this.keyMap) {
681
+ if (last) {
682
+ last.nextKey = key;
683
+ node.prevKey = last.key;
684
+ } else {
685
+ this.firstKey = key;
686
+ node.prevKey = void 0;
687
+ }
688
+ if (node.type === "item") node.index = index++;
689
+ if (node.type === "section" || node.type === "item") size++;
690
+ last = node;
691
+ last.nextKey = void 0;
692
+ }
693
+ this._size = size;
694
+ this.lastKey = last?.key ?? null;
695
+ }
696
+ *[Symbol.iterator]() {
697
+ yield* this.iterable;
698
+ }
699
+ get size() {
700
+ return this._size;
701
+ }
702
+ getKeys() {
703
+ return this.keyMap.keys();
704
+ }
705
+ getKeyBefore(key) {
706
+ let node = this.keyMap.get(key);
707
+ return node ? node.prevKey ?? null : null;
708
+ }
709
+ getKeyAfter(key) {
710
+ let node = this.keyMap.get(key);
711
+ return node ? node.nextKey ?? null : null;
712
+ }
713
+ getFirstKey() {
714
+ return this.firstKey;
715
+ }
716
+ getLastKey() {
717
+ return this.lastKey;
718
+ }
719
+ getItem(key) {
720
+ return this.keyMap.get(key) ?? null;
721
+ }
722
+ at(idx) {
723
+ const keys = [
724
+ ...this.getKeys()
725
+ ];
726
+ return this.getItem(keys[idx]);
727
+ }
728
+ getChildren(key) {
729
+ let node = this.keyMap.get(key);
730
+ return node?.childNodes || [];
731
+ }
732
+ };
733
+
734
+ // ../../node_modules/react-stately/dist/private/selection/Selection.mjs
735
+ var $8b2540e09867b15e$export$52baac22726c72bf = class _$8b2540e09867b15e$export$52baac22726c72bf extends Set {
736
+ constructor(keys, anchorKey, currentKey) {
737
+ super(keys);
738
+ if (keys instanceof _$8b2540e09867b15e$export$52baac22726c72bf) {
739
+ this.anchorKey = anchorKey ?? keys.anchorKey;
740
+ this.currentKey = currentKey ?? keys.currentKey;
741
+ } else {
742
+ this.anchorKey = anchorKey ?? null;
743
+ this.currentKey = currentKey ?? null;
744
+ }
745
+ }
746
+ };
747
+
748
+ // ../../node_modules/react-stately/dist/private/selection/useMultipleSelectionState.mjs
749
+ import { useRef as $7w3VE$useRef, useState as $7w3VE$useState, useMemo as $7w3VE$useMemo, useEffect as $7w3VE$useEffect } from "react";
750
+ function $60f19cefd567a3e4$var$equalSets(setA, setB) {
751
+ if (setA.size !== setB.size) return false;
752
+ for (let item of setA) {
753
+ if (!setB.has(item)) return false;
754
+ }
755
+ return true;
756
+ }
757
+ function $60f19cefd567a3e4$export$253fe78d46329472(props) {
758
+ let { selectionMode = "none", disallowEmptySelection = false, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
759
+ let isFocusedRef = (0, $7w3VE$useRef)(false);
760
+ let [, setFocused] = (0, $7w3VE$useState)(false);
761
+ let focusedKeyRef = (0, $7w3VE$useRef)(null);
762
+ let childFocusStrategyRef = (0, $7w3VE$useRef)(null);
763
+ let [, setFocusedKey] = (0, $7w3VE$useState)(null);
764
+ let selectedKeysProp = (0, $7w3VE$useMemo)(() => $60f19cefd567a3e4$var$convertSelection(props.selectedKeys), [
765
+ props.selectedKeys
766
+ ]);
767
+ let defaultSelectedKeys = (0, $7w3VE$useMemo)(() => $60f19cefd567a3e4$var$convertSelection(props.defaultSelectedKeys, new (0, $8b2540e09867b15e$export$52baac22726c72bf)()), [
768
+ props.defaultSelectedKeys
769
+ ]);
770
+ let [selectedKeys, setSelectedKeys] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
771
+ let disabledKeysProp = (0, $7w3VE$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
772
+ props.disabledKeys
773
+ ]);
774
+ let [selectionBehavior, setSelectionBehavior] = (0, $7w3VE$useState)(selectionBehaviorProp);
775
+ if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0) setSelectionBehavior("replace");
776
+ let lastSelectionBehavior = (0, $7w3VE$useRef)(selectionBehaviorProp);
777
+ (0, $7w3VE$useEffect)(() => {
778
+ if (selectionBehaviorProp !== lastSelectionBehavior.current) {
779
+ setSelectionBehavior(selectionBehaviorProp);
780
+ lastSelectionBehavior.current = selectionBehaviorProp;
781
+ }
782
+ }, [
783
+ selectionBehaviorProp
784
+ ]);
785
+ return {
786
+ selectionMode,
787
+ disallowEmptySelection,
788
+ selectionBehavior,
789
+ setSelectionBehavior,
790
+ get isFocused() {
791
+ return isFocusedRef.current;
792
+ },
793
+ setFocused(f) {
794
+ isFocusedRef.current = f;
795
+ setFocused(f);
796
+ },
797
+ get focusedKey() {
798
+ return focusedKeyRef.current;
799
+ },
800
+ get childFocusStrategy() {
801
+ return childFocusStrategyRef.current;
802
+ },
803
+ setFocusedKey(k, childFocusStrategy = "first") {
804
+ focusedKeyRef.current = k;
805
+ childFocusStrategyRef.current = childFocusStrategy;
806
+ setFocusedKey(k);
807
+ },
808
+ selectedKeys,
809
+ setSelectedKeys(keys) {
810
+ if (allowDuplicateSelectionEvents || !$60f19cefd567a3e4$var$equalSets(keys, selectedKeys)) setSelectedKeys(keys);
811
+ },
812
+ disabledKeys: disabledKeysProp,
813
+ disabledBehavior
814
+ };
815
+ }
816
+ function $60f19cefd567a3e4$var$convertSelection(selection, defaultValue) {
817
+ if (!selection) return defaultValue;
818
+ return selection === "all" ? "all" : new (0, $8b2540e09867b15e$export$52baac22726c72bf)(selection);
819
+ }
820
+
821
+ // ../../node_modules/react-stately/dist/private/selection/SelectionManager.mjs
822
+ var $4a07ac835f260f78$export$6c8a5aaad13c9852 = class _$4a07ac835f260f78$export$6c8a5aaad13c9852 {
823
+ constructor(collection, state, options) {
824
+ this.collection = collection;
825
+ this.state = state;
826
+ this.allowsCellSelection = options?.allowsCellSelection ?? false;
827
+ this._isSelectAll = null;
828
+ this.layoutDelegate = options?.layoutDelegate || null;
829
+ this.fullCollection = options?.fullCollection || null;
830
+ }
831
+ /**
832
+ * The type of selection that is allowed in the collection.
833
+ */
834
+ get selectionMode() {
835
+ return this.state.selectionMode;
836
+ }
837
+ /**
838
+ * Whether the collection allows empty selection.
839
+ */
840
+ get disallowEmptySelection() {
841
+ return this.state.disallowEmptySelection;
842
+ }
843
+ /**
844
+ * The selection behavior for the collection.
845
+ */
846
+ get selectionBehavior() {
847
+ return this.state.selectionBehavior;
848
+ }
849
+ /**
850
+ * Sets the selection behavior for the collection.
851
+ */
852
+ setSelectionBehavior(selectionBehavior) {
853
+ this.state.setSelectionBehavior(selectionBehavior);
854
+ }
855
+ /**
856
+ * Whether the collection is currently focused.
857
+ */
858
+ get isFocused() {
859
+ return this.state.isFocused;
860
+ }
861
+ /**
862
+ * Sets whether the collection is focused.
863
+ */
864
+ setFocused(isFocused) {
865
+ this.state.setFocused(isFocused);
866
+ }
867
+ /**
868
+ * The current focused key in the collection.
869
+ */
870
+ get focusedKey() {
871
+ return this.state.focusedKey;
872
+ }
873
+ /** Whether the first or last child of the focused key should receive focus. */
874
+ get childFocusStrategy() {
875
+ return this.state.childFocusStrategy;
876
+ }
877
+ /**
878
+ * Sets the focused key.
879
+ */
880
+ setFocusedKey(key, childFocusStrategy) {
881
+ if (key == null || this.collection.getItem(key)) this.state.setFocusedKey(key, childFocusStrategy);
882
+ }
883
+ /**
884
+ * The currently selected keys in the collection.
885
+ */
886
+ get selectedKeys() {
887
+ return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
888
+ }
889
+ /**
890
+ * The raw selection value for the collection.
891
+ * Either 'all' for select all, or a set of keys.
892
+ */
893
+ get rawSelection() {
894
+ return this.state.selectedKeys;
895
+ }
896
+ /**
897
+ * Returns whether a key is selected.
898
+ */
899
+ isSelected(key) {
900
+ if (this.state.selectionMode === "none") return false;
901
+ let mappedKey = this.getKey(key);
902
+ if (mappedKey == null) return false;
903
+ return this.state.selectedKeys === "all" ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
904
+ }
905
+ /**
906
+ * Whether the selection is empty.
907
+ */
908
+ get isEmpty() {
909
+ return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
910
+ }
911
+ /**
912
+ * Whether all items in the collection are selected.
913
+ */
914
+ get isSelectAll() {
915
+ if (this.isEmpty) return false;
916
+ if (this.state.selectedKeys === "all") return true;
917
+ if (this._isSelectAll != null) return this._isSelectAll;
918
+ let allKeys = this.getSelectAllKeys();
919
+ let selectedKeys = this.state.selectedKeys;
920
+ this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
921
+ return this._isSelectAll;
922
+ }
923
+ get firstSelectedKey() {
924
+ let first = null;
925
+ for (let key of this.state.selectedKeys) {
926
+ let item = this.collection.getItem(key);
927
+ if (!first || item && (0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, item, first) < 0) first = item;
928
+ }
929
+ return first?.key ?? null;
930
+ }
931
+ get lastSelectedKey() {
932
+ let last = null;
933
+ for (let key of this.state.selectedKeys) {
934
+ let item = this.collection.getItem(key);
935
+ if (!last || item && (0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, item, last) > 0) last = item;
936
+ }
937
+ return last?.key ?? null;
938
+ }
939
+ get disabledKeys() {
940
+ return this.state.disabledKeys;
941
+ }
942
+ get disabledBehavior() {
943
+ return this.state.disabledBehavior;
944
+ }
945
+ /**
946
+ * Extends the selection to the given key.
947
+ */
948
+ extendSelection(toKey) {
949
+ if (this.selectionMode === "none") return;
950
+ if (this.selectionMode === "single") {
951
+ this.replaceSelection(toKey);
952
+ return;
953
+ }
954
+ let mappedToKey = this.getKey(toKey);
955
+ if (mappedToKey == null) return;
956
+ let selection;
957
+ if (this.state.selectedKeys === "all") selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)([
958
+ mappedToKey
959
+ ], mappedToKey, mappedToKey);
960
+ else {
961
+ let selectedKeys = this.state.selectedKeys;
962
+ let anchorKey = selectedKeys.anchorKey ?? mappedToKey;
963
+ selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)(selectedKeys, anchorKey, mappedToKey);
964
+ for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey ?? mappedToKey)) selection.delete(key);
965
+ for (let key of this.getKeyRange(mappedToKey, anchorKey)) if (this.canSelectItem(key)) selection.add(key);
966
+ }
967
+ this.state.setSelectedKeys(selection);
968
+ }
969
+ getKeyRange(from, to) {
970
+ let fromItem = this.collection.getItem(from);
971
+ let toItem = this.collection.getItem(to);
972
+ if (fromItem && toItem) {
973
+ if ((0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, fromItem, toItem) <= 0) return this.getKeyRangeInternal(from, to);
974
+ return this.getKeyRangeInternal(to, from);
975
+ }
976
+ return [];
977
+ }
978
+ getKeyRangeInternal(from, to) {
979
+ if (this.layoutDelegate?.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
980
+ let keys = [];
981
+ let key = from;
982
+ while (key != null) {
983
+ let item = this.collection.getItem(key);
984
+ if (item && (item.type === "item" || item.type === "cell" && this.allowsCellSelection)) keys.push(key);
985
+ if (key === to) return keys;
986
+ key = this.collection.getKeyAfter(key);
987
+ }
988
+ return [];
989
+ }
990
+ getKey(key) {
991
+ let item = this.collection.getItem(key);
992
+ if (!item)
993
+ return key;
994
+ if (item.type === "cell" && this.allowsCellSelection) return key;
995
+ while (item && item.type !== "item" && item.parentKey != null) item = this.collection.getItem(item.parentKey);
996
+ if (!item || item.type !== "item") return null;
997
+ return item.key;
998
+ }
999
+ /**
1000
+ * Toggles whether the given key is selected.
1001
+ */
1002
+ toggleSelection(key) {
1003
+ if (this.selectionMode === "none") return;
1004
+ if (this.selectionMode === "single" && !this.isSelected(key)) {
1005
+ this.replaceSelection(key);
1006
+ return;
1007
+ }
1008
+ let mappedKey = this.getKey(key);
1009
+ if (mappedKey == null) return;
1010
+ let keys = new (0, $8b2540e09867b15e$export$52baac22726c72bf)(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
1011
+ if (keys.has(mappedKey)) keys.delete(mappedKey);
1012
+ else if (this.canSelectItem(mappedKey)) {
1013
+ keys.add(mappedKey);
1014
+ keys.anchorKey = mappedKey;
1015
+ keys.currentKey = mappedKey;
1016
+ }
1017
+ if (this.disallowEmptySelection && keys.size === 0) return;
1018
+ this.state.setSelectedKeys(keys);
1019
+ }
1020
+ /**
1021
+ * Replaces the selection with only the given key.
1022
+ */
1023
+ replaceSelection(key) {
1024
+ if (this.selectionMode === "none") return;
1025
+ let mappedKey = this.getKey(key);
1026
+ if (mappedKey == null) return;
1027
+ let selection = this.canSelectItem(mappedKey) ? new (0, $8b2540e09867b15e$export$52baac22726c72bf)([
1028
+ mappedKey
1029
+ ], mappedKey, mappedKey) : new (0, $8b2540e09867b15e$export$52baac22726c72bf)();
1030
+ this.state.setSelectedKeys(selection);
1031
+ }
1032
+ /**
1033
+ * Replaces the selection with the given keys.
1034
+ */
1035
+ setSelectedKeys(keys) {
1036
+ if (this.selectionMode === "none") return;
1037
+ let selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)();
1038
+ for (let key of keys) {
1039
+ let mappedKey = this.getKey(key);
1040
+ if (mappedKey != null) {
1041
+ selection.add(mappedKey);
1042
+ if (this.selectionMode === "single") break;
1043
+ }
1044
+ }
1045
+ this.state.setSelectedKeys(selection);
1046
+ }
1047
+ getSelectAllKeys() {
1048
+ let collection = this.fullCollection ?? this.collection;
1049
+ let keys = [];
1050
+ let addKeys = (key) => {
1051
+ while (key != null) {
1052
+ if (this.canSelectItemIn(key, collection)) {
1053
+ let item = collection.getItem(key);
1054
+ if (item?.type === "item") keys.push(key);
1055
+ if (item?.hasChildNodes && (this.allowsCellSelection || item.type !== "item")) addKeys((0, $cd5ea4b915021f1d$export$fbdeaa6a76694f71)((0, $cd5ea4b915021f1d$export$1005530eda016c13)(item, collection))?.key ?? null);
1056
+ }
1057
+ key = collection.getKeyAfter(key);
1058
+ }
1059
+ };
1060
+ addKeys(collection.getFirstKey());
1061
+ return keys;
1062
+ }
1063
+ /**
1064
+ * Selects all items in the collection.
1065
+ */
1066
+ selectAll() {
1067
+ if (!this.isSelectAll && this.selectionMode === "multiple") this.state.setSelectedKeys("all");
1068
+ }
1069
+ /**
1070
+ * Removes all keys from the selection.
1071
+ */
1072
+ clearSelection() {
1073
+ if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0)) this.state.setSelectedKeys(new (0, $8b2540e09867b15e$export$52baac22726c72bf)());
1074
+ }
1075
+ /**
1076
+ * Toggles between select all and an empty selection.
1077
+ */
1078
+ toggleSelectAll() {
1079
+ if (this.isSelectAll) this.clearSelection();
1080
+ else this.selectAll();
1081
+ }
1082
+ select(key, e) {
1083
+ if (this.selectionMode === "none") return;
1084
+ if (this.selectionMode === "single") {
1085
+ if (this.isSelected(key) && !this.disallowEmptySelection) this.toggleSelection(key);
1086
+ else this.replaceSelection(key);
1087
+ } else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual"))
1088
+ this.toggleSelection(key);
1089
+ else this.replaceSelection(key);
1090
+ }
1091
+ /**
1092
+ * Returns whether the current selection is equal to the given selection.
1093
+ */
1094
+ isSelectionEqual(selection) {
1095
+ if (selection === this.state.selectedKeys) return true;
1096
+ let selectedKeys = this.selectedKeys;
1097
+ if (selection.size !== selectedKeys.size) return false;
1098
+ for (let key of selection) {
1099
+ if (!selectedKeys.has(key)) return false;
1100
+ }
1101
+ for (let key of selectedKeys) {
1102
+ if (!selection.has(key)) return false;
1103
+ }
1104
+ return true;
1105
+ }
1106
+ canSelectItem(key) {
1107
+ return this.canSelectItemIn(key, this.collection);
1108
+ }
1109
+ canSelectItemIn(key, collection) {
1110
+ if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key)) return false;
1111
+ let item = collection.getItem(key);
1112
+ if (!item || item?.props?.isDisabled || item.type === "cell" && !this.allowsCellSelection) return false;
1113
+ return true;
1114
+ }
1115
+ isDisabled(key) {
1116
+ return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled);
1117
+ }
1118
+ isLink(key) {
1119
+ return !!this.collection.getItem(key)?.props?.href;
1120
+ }
1121
+ getItemProps(key) {
1122
+ return this.collection.getItem(key)?.props;
1123
+ }
1124
+ withCollection(collection) {
1125
+ return new _$4a07ac835f260f78$export$6c8a5aaad13c9852(collection, this.state, {
1126
+ allowsCellSelection: this.allowsCellSelection,
1127
+ layoutDelegate: this.layoutDelegate || void 0,
1128
+ fullCollection: this.fullCollection ?? this.collection
1129
+ });
1130
+ }
1131
+ };
1132
+
1133
+ // ../../node_modules/react-stately/dist/private/collections/CollectionBuilder.mjs
1134
+ import $jO8i1$react from "react";
1135
+ var $bda7a7e55e1ff206$export$bf788dd355e3a401 = class {
1136
+ build(props, context) {
1137
+ this.context = context;
1138
+ return $bda7a7e55e1ff206$var$iterable(() => this.iterateCollection(props));
1139
+ }
1140
+ *iterateCollection(props) {
1141
+ let { children, items } = props;
1142
+ if ((0, $jO8i1$react).isValidElement(children) && children.type === (0, $jO8i1$react).Fragment) yield* this.iterateCollection({
1143
+ children: children.props.children,
1144
+ items
1145
+ });
1146
+ else if (typeof children === "function") {
1147
+ if (!items) throw new Error("props.children was a function but props.items is missing");
1148
+ let index = 0;
1149
+ for (let item of items) {
1150
+ yield* this.getFullNode({
1151
+ value: item,
1152
+ index
1153
+ }, {
1154
+ renderer: children
1155
+ });
1156
+ index++;
1157
+ }
1158
+ } else {
1159
+ let items2 = [];
1160
+ (0, $jO8i1$react).Children.forEach(children, (child) => {
1161
+ if (child) items2.push(child);
1162
+ });
1163
+ let index = 0;
1164
+ for (let item of items2) {
1165
+ let nodes = this.getFullNode({
1166
+ element: item,
1167
+ index
1168
+ }, {});
1169
+ for (let node of nodes) {
1170
+ index++;
1171
+ yield node;
1172
+ }
1173
+ }
1174
+ }
1175
+ }
1176
+ getKey(item, partialNode, state, parentKey) {
1177
+ if (item.key != null) return item.key;
1178
+ if (partialNode.type === "cell" && partialNode.key != null) return `${parentKey}${partialNode.key}`;
1179
+ let v = partialNode.value;
1180
+ if (v != null) {
1181
+ let key = v.key ?? v.id;
1182
+ if (key == null) throw new Error("No key found for item");
1183
+ return key;
1184
+ }
1185
+ return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
1186
+ }
1187
+ getChildState(state, partialNode) {
1188
+ return {
1189
+ renderer: partialNode.renderer || state.renderer
1190
+ };
1191
+ }
1192
+ *getFullNode(partialNode, state, parentKey, parentNode) {
1193
+ if ((0, $jO8i1$react).isValidElement(partialNode.element) && partialNode.element.type === (0, $jO8i1$react).Fragment) {
1194
+ let children = [];
1195
+ (0, $jO8i1$react).Children.forEach(partialNode.element.props.children, (child) => {
1196
+ children.push(child);
1197
+ });
1198
+ let index = partialNode.index ?? 0;
1199
+ for (const child of children) yield* this.getFullNode({
1200
+ element: child,
1201
+ index: index++
1202
+ }, state, parentKey, parentNode);
1203
+ return;
1204
+ }
1205
+ let element = partialNode.element;
1206
+ if (!element && partialNode.value && state && state.renderer) {
1207
+ let cached = this.cache.get(partialNode.value);
1208
+ if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
1209
+ cached.index = partialNode.index;
1210
+ cached.parentKey = parentNode ? parentNode.key : null;
1211
+ yield cached;
1212
+ return;
1213
+ }
1214
+ element = state.renderer(partialNode.value);
1215
+ }
1216
+ if ((0, $jO8i1$react).isValidElement(element)) {
1217
+ let type = element.type;
1218
+ if (typeof type !== "function" && typeof type.getCollectionNode !== "function") {
1219
+ let name = element.type;
1220
+ throw new Error(`Unknown element <${name}> in collection.`);
1221
+ }
1222
+ let childNodes = type.getCollectionNode(element.props, this.context);
1223
+ let index = partialNode.index ?? 0;
1224
+ let result = childNodes.next();
1225
+ while (!result.done && result.value) {
1226
+ let childNode = result.value;
1227
+ partialNode.index = index;
1228
+ let nodeKey = childNode.key ?? null;
1229
+ if (nodeKey == null) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
1230
+ let nodes = this.getFullNode({
1231
+ ...childNode,
1232
+ key: nodeKey,
1233
+ index,
1234
+ wrapper: $bda7a7e55e1ff206$var$compose(partialNode.wrapper, childNode.wrapper)
1235
+ }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
1236
+ let children = [
1237
+ ...nodes
1238
+ ];
1239
+ for (let node2 of children) {
1240
+ node2.value = childNode.value ?? partialNode.value ?? null;
1241
+ if (node2.value) this.cache.set(node2.value, node2);
1242
+ if (partialNode.type && node2.type !== partialNode.type) throw new Error(`Unsupported type <${$bda7a7e55e1ff206$var$capitalize(node2.type)}> in <${$bda7a7e55e1ff206$var$capitalize(parentNode?.type ?? "unknown parent type")}>. Only <${$bda7a7e55e1ff206$var$capitalize(partialNode.type)}> is supported.`);
1243
+ index++;
1244
+ yield node2;
1245
+ }
1246
+ result = childNodes.next(children);
1247
+ }
1248
+ return;
1249
+ }
1250
+ if (partialNode.key == null || partialNode.type == null) return;
1251
+ let builder = this;
1252
+ let node = {
1253
+ type: partialNode.type,
1254
+ props: partialNode.props,
1255
+ key: partialNode.key,
1256
+ parentKey: parentNode ? parentNode.key : null,
1257
+ value: partialNode.value ?? null,
1258
+ level: (parentNode?.level ?? 0) + (parentNode?.type === "item" ? 1 : 0),
1259
+ index: partialNode.index,
1260
+ rendered: partialNode.rendered,
1261
+ textValue: partialNode.textValue ?? "",
1262
+ "aria-label": partialNode["aria-label"],
1263
+ wrapper: partialNode.wrapper,
1264
+ shouldInvalidate: partialNode.shouldInvalidate,
1265
+ hasChildNodes: partialNode.hasChildNodes || false,
1266
+ childNodes: $bda7a7e55e1ff206$var$iterable(function* () {
1267
+ if (!partialNode.hasChildNodes || !partialNode.childNodes) return;
1268
+ let index = 0;
1269
+ for (let child of partialNode.childNodes()) {
1270
+ if (child.key != null)
1271
+ child.key = `${node.key}${child.key}`;
1272
+ let nodes = builder.getFullNode({
1273
+ ...child,
1274
+ index
1275
+ }, builder.getChildState(state, child), node.key, node);
1276
+ for (let node2 of nodes) {
1277
+ index++;
1278
+ yield node2;
1279
+ }
1280
+ }
1281
+ })
1282
+ };
1283
+ yield node;
1284
+ }
1285
+ constructor() {
1286
+ this.cache = /* @__PURE__ */ new WeakMap();
1287
+ }
1288
+ };
1289
+ function $bda7a7e55e1ff206$var$iterable(iterator) {
1290
+ let cache = [];
1291
+ let iterable = null;
1292
+ return {
1293
+ *[Symbol.iterator]() {
1294
+ for (let item of cache) yield item;
1295
+ if (!iterable) iterable = iterator();
1296
+ for (let item of iterable) {
1297
+ cache.push(item);
1298
+ yield item;
1299
+ }
1300
+ }
1301
+ };
1302
+ }
1303
+ function $bda7a7e55e1ff206$var$compose(outer, inner) {
1304
+ if (outer && inner) return (element) => outer(inner(element));
1305
+ if (outer) return outer;
1306
+ if (inner) return inner;
1307
+ }
1308
+ function $bda7a7e55e1ff206$var$capitalize(str) {
1309
+ return str[0].toUpperCase() + str.slice(1);
1310
+ }
1311
+
1312
+ // ../../node_modules/react-stately/dist/private/collections/useCollection.mjs
1313
+ import { useMemo as $emYU7$useMemo } from "react";
1314
+ function $d03379b88399b8c5$export$6cd28814d92fa9c9(props, factory, context) {
1315
+ let builder = (0, $emYU7$useMemo)(() => new (0, $bda7a7e55e1ff206$export$bf788dd355e3a401)(), []);
1316
+ let { children, items, collection } = props;
1317
+ let result = (0, $emYU7$useMemo)(() => {
1318
+ if (collection) return collection;
1319
+ let nodes = builder.build({
1320
+ children,
1321
+ items
1322
+ }, context);
1323
+ return factory(nodes);
1324
+ }, [
1325
+ builder,
1326
+ children,
1327
+ items,
1328
+ collection,
1329
+ context,
1330
+ factory
1331
+ ]);
1332
+ return result;
1333
+ }
1334
+
1335
+ // ../../node_modules/react-stately/dist/private/list/useListState.mjs
1336
+ import { useMemo as $3yt54$useMemo, useCallback as $3yt54$useCallback, useRef as $3yt54$useRef, useEffect as $3yt54$useEffect } from "react";
1337
+ function $b14b6f590b50af39$export$2f645645f7bca764(props) {
1338
+ let { filter, layoutDelegate } = props;
1339
+ let selectionState = (0, $60f19cefd567a3e4$export$253fe78d46329472)(props);
1340
+ let disabledKeys = (0, $3yt54$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
1341
+ props.disabledKeys
1342
+ ]);
1343
+ let factory = (0, $3yt54$useCallback)((nodes) => filter ? new (0, $f664a81d022446b5$export$d085fb9e920b5ca7)(filter(nodes)) : new (0, $f664a81d022446b5$export$d085fb9e920b5ca7)(nodes), [
1344
+ filter
1345
+ ]);
1346
+ let context = (0, $3yt54$useMemo)(() => ({
1347
+ suppressTextValueWarning: props.suppressTextValueWarning
1348
+ }), [
1349
+ props.suppressTextValueWarning
1350
+ ]);
1351
+ let collection = (0, $d03379b88399b8c5$export$6cd28814d92fa9c9)(props, factory, context);
1352
+ let selectionManager = (0, $3yt54$useMemo)(() => new (0, $4a07ac835f260f78$export$6c8a5aaad13c9852)(collection, selectionState, {
1353
+ layoutDelegate
1354
+ }), [
1355
+ collection,
1356
+ selectionState,
1357
+ layoutDelegate
1358
+ ]);
1359
+ $b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager);
1360
+ return {
1361
+ collection,
1362
+ disabledKeys,
1363
+ selectionManager
1364
+ };
1365
+ }
1366
+ function $b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager) {
1367
+ const cachedCollection = (0, $3yt54$useRef)(null);
1368
+ (0, $3yt54$useEffect)(() => {
1369
+ if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
1370
+ let key = cachedCollection.current.getKeyAfter(selectionManager.focusedKey);
1371
+ let nextFocusedKey = null;
1372
+ while (key != null) {
1373
+ let node = collection.getItem(key);
1374
+ if (node && node.type === "item" && !selectionManager.isDisabled(key)) {
1375
+ nextFocusedKey = key;
1376
+ break;
1377
+ }
1378
+ key = cachedCollection.current.getKeyAfter(key);
1379
+ }
1380
+ if (nextFocusedKey == null) {
1381
+ key = cachedCollection.current.getKeyBefore(selectionManager.focusedKey);
1382
+ while (key != null) {
1383
+ let node = collection.getItem(key);
1384
+ if (node && node.type === "item" && !selectionManager.isDisabled(key)) {
1385
+ nextFocusedKey = key;
1386
+ break;
1387
+ }
1388
+ key = cachedCollection.current.getKeyBefore(key);
1389
+ }
1390
+ }
1391
+ selectionManager.setFocusedKey(nextFocusedKey);
1392
+ }
1393
+ cachedCollection.current = collection;
1394
+ }, [
1395
+ collection,
1396
+ selectionManager
1397
+ ]);
1398
+ }
1399
+
1400
+ // ../../node_modules/react-stately/dist/private/overlays/useOverlayTriggerState.mjs
1401
+ import { useCallback as $kE40A$useCallback } from "react";
1402
+ function $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props) {
1403
+ let [isOpen, setOpen] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
1404
+ const open = (0, $kE40A$useCallback)(() => {
1405
+ setOpen(true);
1406
+ }, [
1407
+ setOpen
1408
+ ]);
1409
+ const close = (0, $kE40A$useCallback)(() => {
1410
+ setOpen(false);
1411
+ }, [
1412
+ setOpen
1413
+ ]);
1414
+ const toggle = (0, $kE40A$useCallback)(() => {
1415
+ setOpen(!isOpen);
1416
+ }, [
1417
+ setOpen,
1418
+ isOpen
1419
+ ]);
1420
+ return {
1421
+ isOpen,
1422
+ setOpen,
1423
+ open,
1424
+ close,
1425
+ toggle
1426
+ };
1427
+ }
1428
+
1429
+ // ../../node_modules/react-stately/dist/private/collections/Item.mjs
1430
+ import $dJmKC$react from "react";
1431
+ function $05678f3aee5e7d1a$var$Item(props) {
1432
+ return null;
1433
+ }
1434
+ $05678f3aee5e7d1a$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
1435
+ let { childItems, title, children } = props;
1436
+ let rendered = props.title || props.children;
1437
+ let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
1438
+ if (!textValue && !context?.suppressTextValueWarning && process.env.NODE_ENV !== "production") console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.");
1439
+ yield {
1440
+ type: "item",
1441
+ props,
1442
+ rendered,
1443
+ textValue,
1444
+ "aria-label": props["aria-label"],
1445
+ hasChildNodes: $05678f3aee5e7d1a$var$hasChildItems(props),
1446
+ *childNodes() {
1447
+ if (childItems) for (let child of childItems) yield {
1448
+ type: "item",
1449
+ value: child
1450
+ };
1451
+ else if (title) {
1452
+ let items = [];
1453
+ (0, $dJmKC$react).Children.forEach(children, (child) => {
1454
+ items.push({
1455
+ type: "item",
1456
+ element: child
1457
+ });
1458
+ });
1459
+ yield* items;
1460
+ }
1461
+ }
1462
+ };
1463
+ };
1464
+ function $05678f3aee5e7d1a$var$hasChildItems(props) {
1465
+ if (props.hasChildItems != null) return props.hasChildItems;
1466
+ if (props.childItems) return true;
1467
+ if (props.title && (0, $dJmKC$react).Children.count(props.children) > 0) return true;
1468
+ return false;
1469
+ }
1470
+ var $05678f3aee5e7d1a$export$6d08773d2e66f8f2 = $05678f3aee5e7d1a$var$Item;
1471
+
1472
+ // ../../node_modules/react-stately/dist/private/list/useSingleSelectListState.mjs
1473
+ import { useMemo as $jhfZc$useMemo } from "react";
1474
+ function $0fdb127d377ffd84$export$e7f05e985daf4b5f(props) {
1475
+ let [selectedKey, setSelectedKey] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.selectedKey, props.defaultSelectedKey ?? null, props.onSelectionChange);
1476
+ let selectedKeys = (0, $jhfZc$useMemo)(() => selectedKey != null ? [
1477
+ selectedKey
1478
+ ] : [], [
1479
+ selectedKey
1480
+ ]);
1481
+ let { collection, disabledKeys, selectionManager } = (0, $b14b6f590b50af39$export$2f645645f7bca764)({
1482
+ ...props,
1483
+ selectionMode: "single",
1484
+ disallowEmptySelection: true,
1485
+ allowDuplicateSelectionEvents: true,
1486
+ selectedKeys,
1487
+ onSelectionChange: (keys) => {
1488
+ if (keys === "all") return;
1489
+ let key = keys.values().next().value ?? null;
1490
+ if (key === selectedKey && props.onSelectionChange) props.onSelectionChange(key);
1491
+ setSelectedKey(key);
1492
+ }
1493
+ });
1494
+ let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;
1495
+ return {
1496
+ collection,
1497
+ disabledKeys,
1498
+ selectionManager,
1499
+ selectedKey,
1500
+ setSelectedKey,
1501
+ selectedItem
1502
+ };
1503
+ }
1504
+
1505
+ // ../../node_modules/react-stately/dist/private/menu/useMenuTriggerState.mjs
1506
+ import { useState as $aoDK0$useState } from "react";
1507
+ function $e3403870bfb691da$export$79fefeb1c2091ac3(props) {
1508
+ let overlayTriggerState = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1509
+ let [focusStrategy, setFocusStrategy] = (0, $aoDK0$useState)(null);
1510
+ let [expandedKeysStack, setExpandedKeysStack] = (0, $aoDK0$useState)([]);
1511
+ let closeAll = () => {
1512
+ setExpandedKeysStack([]);
1513
+ overlayTriggerState.close();
1514
+ };
1515
+ let openSubmenu = (triggerKey, level) => {
1516
+ setExpandedKeysStack((oldStack) => {
1517
+ if (level > oldStack.length) return oldStack;
1518
+ return [
1519
+ ...oldStack.slice(0, level),
1520
+ triggerKey
1521
+ ];
1522
+ });
1523
+ };
1524
+ let closeSubmenu = (triggerKey, level) => {
1525
+ setExpandedKeysStack((oldStack) => {
1526
+ let key = oldStack[level];
1527
+ if (key === triggerKey) return oldStack.slice(0, level);
1528
+ else return oldStack;
1529
+ });
1530
+ };
1531
+ return {
1532
+ focusStrategy,
1533
+ ...overlayTriggerState,
1534
+ open(focusStrategy2 = null) {
1535
+ setFocusStrategy(focusStrategy2);
1536
+ overlayTriggerState.open();
1537
+ },
1538
+ toggle(focusStrategy2 = null) {
1539
+ setFocusStrategy(focusStrategy2);
1540
+ overlayTriggerState.toggle();
1541
+ },
1542
+ close() {
1543
+ closeAll();
1544
+ },
1545
+ expandedKeysStack,
1546
+ openSubmenu,
1547
+ closeSubmenu
1548
+ };
1549
+ }
1550
+
1551
+ // ../../node_modules/react-stately/dist/private/radio/useRadioGroupState.mjs
1552
+ import { useMemo as $6Hs9a$useMemo, useState as $6Hs9a$useState } from "react";
1553
+ var $384704861d32dbed$var$instance = Math.round(Math.random() * 1e10);
1554
+ var $384704861d32dbed$var$i = 0;
1555
+ function $384704861d32dbed$export$bca9d026f8e704eb(props) {
1556
+ let name = (0, $6Hs9a$useMemo)(() => props.name || `radio-group-${$384704861d32dbed$var$instance}-${++$384704861d32dbed$var$i}`, [
1557
+ props.name
1558
+ ]);
1559
+ let [selectedValue, setSelected] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.value, props.defaultValue ?? null, props.onChange);
1560
+ let [initialValue] = (0, $6Hs9a$useState)(selectedValue);
1561
+ let [lastFocusedValue, setLastFocusedValue] = (0, $6Hs9a$useState)(null);
1562
+ let validation = (0, $fd2148440a13ec26$export$fc1a364ae1f3ff10)({
1563
+ ...props,
1564
+ value: selectedValue
1565
+ });
1566
+ let setSelectedValue = (value) => {
1567
+ if (!props.isReadOnly && !props.isDisabled) {
1568
+ setSelected(value);
1569
+ validation.commitValidation();
1570
+ }
1571
+ };
1572
+ let isInvalid = validation.displayValidation.isInvalid;
1573
+ return {
1574
+ ...validation,
1575
+ name,
1576
+ selectedValue,
1577
+ defaultSelectedValue: props.value !== void 0 ? initialValue : props.defaultValue ?? null,
1578
+ setSelectedValue,
1579
+ lastFocusedValue,
1580
+ setLastFocusedValue,
1581
+ isDisabled: props.isDisabled || false,
1582
+ isReadOnly: props.isReadOnly || false,
1583
+ isRequired: props.isRequired || false,
1584
+ validationState: props.validationState || (isInvalid ? "invalid" : null),
1585
+ isInvalid
1586
+ };
1587
+ }
1588
+
1589
+ // ../../node_modules/react-stately/dist/private/select/useSelectState.mjs
1590
+ import { useState as $5t5rb$useState, useMemo as $5t5rb$useMemo } from "react";
1591
+ function $29256f53a2edafe9$export$5159ec8b34d4ec12(props) {
1592
+ let { selectionMode = "single", shouldCloseOnSelect = selectionMode === "single" } = props;
1593
+ let triggerState = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1594
+ let [focusStrategy, setFocusStrategy] = (0, $5t5rb$useState)(null);
1595
+ let defaultValue = (0, $5t5rb$useMemo)(() => {
1596
+ return props.defaultValue !== void 0 ? props.defaultValue : selectionMode === "single" ? props.defaultSelectedKey ?? null : [];
1597
+ }, [
1598
+ props.defaultValue,
1599
+ props.defaultSelectedKey,
1600
+ selectionMode
1601
+ ]);
1602
+ let value = (0, $5t5rb$useMemo)(() => {
1603
+ return props.value !== void 0 ? props.value : selectionMode === "single" ? props.selectedKey : void 0;
1604
+ }, [
1605
+ props.value,
1606
+ props.selectedKey,
1607
+ selectionMode
1608
+ ]);
1609
+ let [controlledValue, setControlledValue] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(value, defaultValue, props.onChange);
1610
+ let displayValue = selectionMode === "single" && Array.isArray(controlledValue) ? controlledValue[0] : controlledValue;
1611
+ let setValue = (value2) => {
1612
+ if (selectionMode === "single") {
1613
+ let key = Array.isArray(value2) ? value2[0] ?? null : value2;
1614
+ setControlledValue(key);
1615
+ if (key !== displayValue) props.onSelectionChange?.(key);
1616
+ } else {
1617
+ let keys = [];
1618
+ if (Array.isArray(value2)) keys = value2;
1619
+ else if (value2 != null) keys = [
1620
+ value2
1621
+ ];
1622
+ setControlledValue(keys);
1623
+ }
1624
+ };
1625
+ let listState = (0, $b14b6f590b50af39$export$2f645645f7bca764)({
1626
+ ...props,
1627
+ selectionMode,
1628
+ disallowEmptySelection: selectionMode === "single",
1629
+ allowDuplicateSelectionEvents: true,
1630
+ selectedKeys: (0, $5t5rb$useMemo)(() => $29256f53a2edafe9$var$convertValue(displayValue), [
1631
+ displayValue
1632
+ ]),
1633
+ onSelectionChange: (keys) => {
1634
+ if (keys === "all") return;
1635
+ if (selectionMode === "single") {
1636
+ let key = keys.values().next().value ?? null;
1637
+ setValue(key);
1638
+ } else setValue([
1639
+ ...keys
1640
+ ]);
1641
+ if (shouldCloseOnSelect) triggerState.close();
1642
+ validationState.commitValidation();
1643
+ }
1644
+ });
1645
+ let selectedKey = listState.selectionManager.firstSelectedKey;
1646
+ let selectedItems = (0, $5t5rb$useMemo)(() => {
1647
+ return [
1648
+ ...listState.selectionManager.selectedKeys
1649
+ ].map((key) => listState.collection.getItem(key)).filter((item) => item != null);
1650
+ }, [
1651
+ listState.selectionManager.selectedKeys,
1652
+ listState.collection
1653
+ ]);
1654
+ let validationState = (0, $fd2148440a13ec26$export$fc1a364ae1f3ff10)({
1655
+ ...props,
1656
+ value: Array.isArray(displayValue) && displayValue.length === 0 ? null : displayValue
1657
+ });
1658
+ let [isFocused, setFocused] = (0, $5t5rb$useState)(false);
1659
+ let [initialValue] = (0, $5t5rb$useState)(displayValue);
1660
+ return {
1661
+ ...validationState,
1662
+ ...listState,
1663
+ ...triggerState,
1664
+ value: displayValue,
1665
+ defaultValue: defaultValue ?? initialValue,
1666
+ setValue,
1667
+ selectedKey,
1668
+ setSelectedKey: setValue,
1669
+ selectedItem: selectedItems[0] ?? null,
1670
+ selectedItems,
1671
+ defaultSelectedKey: props.defaultSelectedKey ?? (props.selectionMode === "single" ? initialValue : null),
1672
+ focusStrategy,
1673
+ open(focusStrategy2 = null) {
1674
+ if (listState.collection.size !== 0 || props.allowsEmptyCollection) {
1675
+ setFocusStrategy(focusStrategy2);
1676
+ triggerState.open();
1677
+ }
1678
+ },
1679
+ toggle(focusStrategy2 = null) {
1680
+ if (listState.collection.size !== 0 || props.allowsEmptyCollection) {
1681
+ setFocusStrategy(focusStrategy2);
1682
+ triggerState.toggle();
1683
+ }
1684
+ },
1685
+ isFocused,
1686
+ setFocused
1687
+ };
1688
+ }
1689
+ function $29256f53a2edafe9$var$convertValue(value) {
1690
+ if (value === void 0) return void 0;
1691
+ if (value === null) return [];
1692
+ return Array.isArray(value) ? value : [
1693
+ value
1694
+ ];
1695
+ }
1696
+
1697
+ // ../../node_modules/react-stately/dist/private/tabs/useTabListState.mjs
1698
+ import { useRef as $eOo4G$useRef, useEffect as $eOo4G$useEffect } from "react";
1699
+ function $caeb030f09a278a1$export$4ba071daf4e486(props) {
1700
+ let state = (0, $0fdb127d377ffd84$export$e7f05e985daf4b5f)({
1701
+ ...props,
1702
+ onSelectionChange: props.onSelectionChange ? (key) => {
1703
+ if (key != null) props.onSelectionChange?.(key);
1704
+ } : void 0,
1705
+ suppressTextValueWarning: true,
1706
+ defaultSelectedKey: props.defaultSelectedKey ?? $caeb030f09a278a1$var$findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set()) ?? void 0
1707
+ });
1708
+ let { selectionManager, collection, selectedKey: currentSelectedKey } = state;
1709
+ let lastSelectedKey = (0, $eOo4G$useRef)(currentSelectedKey);
1710
+ (0, $eOo4G$useEffect)(() => {
1711
+ let selectedKey = currentSelectedKey;
1712
+ if (props.selectedKey == null && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {
1713
+ selectedKey = $caeb030f09a278a1$var$findDefaultSelectedKey(collection, state.disabledKeys);
1714
+ if (selectedKey != null)
1715
+ selectionManager.setSelectedKeys([
1716
+ selectedKey
1717
+ ]);
1718
+ }
1719
+ if (selectedKey != null && selectionManager.focusedKey == null || !selectionManager.isFocused && selectedKey !== lastSelectedKey.current) selectionManager.setFocusedKey(selectedKey);
1720
+ lastSelectedKey.current = selectedKey;
1721
+ });
1722
+ return {
1723
+ ...state,
1724
+ isDisabled: props.isDisabled || false
1725
+ };
1726
+ }
1727
+ function $caeb030f09a278a1$var$findDefaultSelectedKey(collection, disabledKeys) {
1728
+ let selectedKey = null;
1729
+ if (collection) {
1730
+ selectedKey = collection.getFirstKey();
1731
+ while (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey !== collection.getLastKey()) selectedKey = collection.getKeyAfter(selectedKey);
1732
+ if (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey === collection.getLastKey()) selectedKey = collection.getFirstKey();
1733
+ }
1734
+ return selectedKey;
1735
+ }
1736
+
1737
+ // ../../node_modules/react-stately/dist/private/toggle/useToggleState.mjs
1738
+ import { useState as $dAajM$useState } from "react";
1739
+ function $fd3c5e01e837dc20$export$8042c6c013fd5226(props = {}) {
1740
+ let { isReadOnly } = props;
1741
+ let [isSelected, setSelected] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.isSelected, props.defaultSelected || false, props.onChange);
1742
+ let [initialValue] = (0, $dAajM$useState)(isSelected);
1743
+ function updateSelected(value) {
1744
+ if (!isReadOnly) setSelected(value);
1745
+ }
1746
+ function toggleState() {
1747
+ if (!isReadOnly) setSelected(!isSelected);
1748
+ }
1749
+ return {
1750
+ isSelected,
1751
+ defaultSelected: props.defaultSelected ?? initialValue,
1752
+ setSelected: updateSelected,
1753
+ toggle: toggleState
1754
+ };
1755
+ }
1756
+
1757
+ // ../../node_modules/react-stately/dist/private/tooltip/useTooltipTriggerState.mjs
1758
+ import { useMemo as $auOuY$useMemo, useRef as $auOuY$useRef, useEffect as $auOuY$useEffect } from "react";
1759
+ var $3834487504f4fc00$var$TOOLTIP_DELAY = 1500;
1760
+ var $3834487504f4fc00$var$TOOLTIP_COOLDOWN = 500;
1761
+ var $3834487504f4fc00$var$tooltips = {};
1762
+ var $3834487504f4fc00$var$tooltipId = 0;
1763
+ var $3834487504f4fc00$var$globalWarmedUp = false;
1764
+ var $3834487504f4fc00$var$globalWarmUpTimeout = null;
1765
+ var $3834487504f4fc00$var$globalCooldownTimeout = null;
1766
+ function $3834487504f4fc00$export$4d40659c25ecb50b(props = {}) {
1767
+ let { delay = $3834487504f4fc00$var$TOOLTIP_DELAY, closeDelay = $3834487504f4fc00$var$TOOLTIP_COOLDOWN } = props;
1768
+ let { isOpen, open, close } = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1769
+ let id = (0, $auOuY$useMemo)(() => `${++$3834487504f4fc00$var$tooltipId}`, []);
1770
+ let closeTimeout = (0, $auOuY$useRef)(null);
1771
+ let closeCallback = (0, $auOuY$useRef)(close);
1772
+ let ensureTooltipEntry = () => {
1773
+ $3834487504f4fc00$var$tooltips[id] = hideTooltip;
1774
+ };
1775
+ let closeOpenTooltips = () => {
1776
+ for (let hideTooltipId in $3834487504f4fc00$var$tooltips) if (hideTooltipId !== id) {
1777
+ $3834487504f4fc00$var$tooltips[hideTooltipId](true);
1778
+ delete $3834487504f4fc00$var$tooltips[hideTooltipId];
1779
+ }
1780
+ };
1781
+ let showTooltip = () => {
1782
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1783
+ closeTimeout.current = null;
1784
+ closeOpenTooltips();
1785
+ ensureTooltipEntry();
1786
+ $3834487504f4fc00$var$globalWarmedUp = true;
1787
+ open();
1788
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) {
1789
+ clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1790
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1791
+ }
1792
+ if ($3834487504f4fc00$var$globalCooldownTimeout) {
1793
+ clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
1794
+ $3834487504f4fc00$var$globalCooldownTimeout = null;
1795
+ }
1796
+ };
1797
+ let hideTooltip = (immediate) => {
1798
+ if (immediate || closeDelay <= 0) {
1799
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1800
+ closeTimeout.current = null;
1801
+ closeCallback.current();
1802
+ } else if (!closeTimeout.current) closeTimeout.current = setTimeout(() => {
1803
+ closeTimeout.current = null;
1804
+ closeCallback.current();
1805
+ }, closeDelay);
1806
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) {
1807
+ clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1808
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1809
+ }
1810
+ if ($3834487504f4fc00$var$globalWarmedUp) {
1811
+ if ($3834487504f4fc00$var$globalCooldownTimeout) clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
1812
+ $3834487504f4fc00$var$globalCooldownTimeout = setTimeout(() => {
1813
+ delete $3834487504f4fc00$var$tooltips[id];
1814
+ $3834487504f4fc00$var$globalCooldownTimeout = null;
1815
+ $3834487504f4fc00$var$globalWarmedUp = false;
1816
+ }, Math.max($3834487504f4fc00$var$TOOLTIP_COOLDOWN, closeDelay));
1817
+ }
1818
+ };
1819
+ let warmupTooltip = () => {
1820
+ closeOpenTooltips();
1821
+ ensureTooltipEntry();
1822
+ if (!isOpen && !$3834487504f4fc00$var$globalWarmedUp) {
1823
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1824
+ $3834487504f4fc00$var$globalWarmUpTimeout = setTimeout(() => {
1825
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1826
+ $3834487504f4fc00$var$globalWarmedUp = true;
1827
+ showTooltip();
1828
+ }, delay);
1829
+ } else if (!isOpen) showTooltip();
1830
+ };
1831
+ (0, $auOuY$useEffect)(() => {
1832
+ closeCallback.current = close;
1833
+ }, [
1834
+ close
1835
+ ]);
1836
+ (0, $auOuY$useEffect)(() => {
1837
+ return () => {
1838
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1839
+ let tooltip = $3834487504f4fc00$var$tooltips[id];
1840
+ if (tooltip) delete $3834487504f4fc00$var$tooltips[id];
1841
+ };
1842
+ }, [
1843
+ id
1844
+ ]);
1845
+ return {
1846
+ isOpen,
1847
+ open: (immediate) => {
1848
+ if (!immediate && delay > 0 && !closeTimeout.current) warmupTooltip();
1849
+ else showTooltip();
1850
+ },
1851
+ close: hideTooltip
1852
+ };
1853
+ }
1854
+
1855
+ // ../../node_modules/react-stately/dist/private/tree/TreeCollection.mjs
1856
+ var $df1fcc684d3b021a$export$863faf230ee2118a = class {
1857
+ constructor(nodes, { expandedKeys } = {}) {
1858
+ this.keyMap = /* @__PURE__ */ new Map();
1859
+ this.firstKey = null;
1860
+ this.lastKey = null;
1861
+ this.iterable = nodes;
1862
+ expandedKeys = expandedKeys || /* @__PURE__ */ new Set();
1863
+ let visit = (node) => {
1864
+ this.keyMap.set(node.key, node);
1865
+ if (node.childNodes && (node.type === "section" || expandedKeys.has(node.key))) for (let child of node.childNodes) visit(child);
1866
+ };
1867
+ for (let node of nodes) visit(node);
1868
+ let last = null;
1869
+ let index = 0;
1870
+ for (let [key, node] of this.keyMap) {
1871
+ if (last) {
1872
+ last.nextKey = key;
1873
+ node.prevKey = last.key;
1874
+ } else {
1875
+ this.firstKey = key;
1876
+ node.prevKey = void 0;
1877
+ }
1878
+ if (node.type === "item") node.index = index++;
1879
+ last = node;
1880
+ last.nextKey = void 0;
1881
+ }
1882
+ this.lastKey = last?.key ?? null;
1883
+ }
1884
+ *[Symbol.iterator]() {
1885
+ yield* this.iterable;
1886
+ }
1887
+ get size() {
1888
+ return this.keyMap.size;
1889
+ }
1890
+ getKeys() {
1891
+ return this.keyMap.keys();
1892
+ }
1893
+ getKeyBefore(key) {
1894
+ let node = this.keyMap.get(key);
1895
+ return node ? node.prevKey ?? null : null;
1896
+ }
1897
+ getKeyAfter(key) {
1898
+ let node = this.keyMap.get(key);
1899
+ return node ? node.nextKey ?? null : null;
1900
+ }
1901
+ getFirstKey() {
1902
+ return this.firstKey;
1903
+ }
1904
+ getLastKey() {
1905
+ return this.lastKey;
1906
+ }
1907
+ getItem(key) {
1908
+ return this.keyMap.get(key) ?? null;
1909
+ }
1910
+ at(idx) {
1911
+ const keys = [
1912
+ ...this.getKeys()
1913
+ ];
1914
+ return this.getItem(keys[idx]);
1915
+ }
1916
+ };
1917
+
1918
+ // ../../node_modules/react-stately/dist/private/tree/useTreeState.mjs
1919
+ import { useMemo as $aXIpm$useMemo, useCallback as $aXIpm$useCallback, useEffect as $aXIpm$useEffect } from "react";
1920
+ function $6b915bde6cd300dd$export$728d6ba534403756(props) {
1921
+ let { onExpandedChange } = props;
1922
+ let [expandedKeys, setExpandedKeys] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.expandedKeys ? new Set(props.expandedKeys) : void 0, props.defaultExpandedKeys ? new Set(props.defaultExpandedKeys) : /* @__PURE__ */ new Set(), onExpandedChange);
1923
+ let selectionState = (0, $60f19cefd567a3e4$export$253fe78d46329472)(props);
1924
+ let disabledKeys = (0, $aXIpm$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
1925
+ props.disabledKeys
1926
+ ]);
1927
+ let tree = (0, $d03379b88399b8c5$export$6cd28814d92fa9c9)(props, (0, $aXIpm$useCallback)((nodes) => new (0, $df1fcc684d3b021a$export$863faf230ee2118a)(nodes, {
1928
+ expandedKeys
1929
+ }), [
1930
+ expandedKeys
1931
+ ]), null);
1932
+ (0, $aXIpm$useEffect)(() => {
1933
+ if (selectionState.focusedKey != null && !tree.getItem(selectionState.focusedKey)) selectionState.setFocusedKey(null);
1934
+ }, [
1935
+ tree,
1936
+ selectionState.focusedKey
1937
+ ]);
1938
+ let onToggle = (key) => {
1939
+ setExpandedKeys($6b915bde6cd300dd$var$toggleKey(expandedKeys, key));
1940
+ };
1941
+ return {
1942
+ collection: tree,
1943
+ expandedKeys,
1944
+ disabledKeys,
1945
+ toggleKey: onToggle,
1946
+ setExpandedKeys,
1947
+ selectionManager: new (0, $4a07ac835f260f78$export$6c8a5aaad13c9852)(tree, selectionState)
1948
+ };
1949
+ }
1950
+ function $6b915bde6cd300dd$var$toggleKey(set, key) {
1951
+ let res = new Set(set);
1952
+ if (res.has(key)) res.delete(key);
1953
+ else res.add(key);
1954
+ return res;
1955
+ }
1956
+
1957
+ // src/components/Tooltip/Tooltip.tsx
1958
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1959
+ var FLIP = {
1960
+ top: "bottom",
1961
+ bottom: "top",
1962
+ left: "right",
1963
+ right: "left"
1964
+ };
1965
+ function placeOn(rect, tipRect, position, offset) {
1966
+ const cx = rect.left + rect.width / 2;
1967
+ const cy = rect.top + rect.height / 2;
1968
+ switch (position) {
1969
+ case "top":
1970
+ return {
1971
+ top: rect.top - tipRect.height - offset,
1972
+ left: cx - tipRect.width / 2
1973
+ };
1974
+ case "bottom":
1975
+ return { top: rect.bottom + offset, left: cx - tipRect.width / 2 };
1976
+ case "left":
1977
+ return {
1978
+ top: cy - tipRect.height / 2,
1979
+ left: rect.left - tipRect.width - offset
1980
+ };
1981
+ case "right":
1982
+ return { top: cy - tipRect.height / 2, left: rect.right + offset };
1983
+ }
1984
+ }
1985
+ function computePosition(rect, tipRect, position, offset, viewport) {
1986
+ const tryAt = (p) => {
1987
+ const c = placeOn(rect, tipRect, p, offset);
1988
+ const fits = c.top >= 0 && c.left >= 0 && c.top + tipRect.height <= viewport.height && c.left + tipRect.width <= viewport.width;
1989
+ return { ...c, position: p, fits };
1990
+ };
1991
+ const preferred = tryAt(position);
1992
+ if (preferred.fits) return preferred;
1993
+ const flipped = tryAt(FLIP[position]);
1994
+ if (flipped.fits) return flipped;
1995
+ const fallback = preferred;
1996
+ const clampedLeft = Math.max(
1997
+ 4,
1998
+ Math.min(fallback.left, viewport.width - tipRect.width - 4)
1999
+ );
2000
+ const clampedTop = Math.max(
2001
+ 4,
2002
+ Math.min(fallback.top, viewport.height - tipRect.height - 4)
2003
+ );
2004
+ return { top: clampedTop, left: clampedLeft, position: fallback.position };
2005
+ }
2006
+ var animVariants = {
2007
+ top: { initial: { opacity: 0, y: 4 }, animate: { opacity: 1, y: 0 } },
2008
+ bottom: { initial: { opacity: 0, y: -4 }, animate: { opacity: 1, y: 0 } },
2009
+ left: { initial: { opacity: 0, x: 4 }, animate: { opacity: 1, x: 0 } },
2010
+ right: { initial: { opacity: 0, x: -4 }, animate: { opacity: 1, x: 0 } }
2011
+ };
2012
+ function TooltipContent({
2013
+ state,
2014
+ content,
2015
+ position,
2016
+ triggerRef,
2017
+ className,
2018
+ offset,
2019
+ tooltipId
2020
+ }) {
2021
+ const { tooltipProps } = useTooltip({ isOpen: state.isOpen }, state);
2022
+ const tipRef = useRef2(null);
2023
+ const [coords, setCoords] = useState2(null);
2024
+ const reposition = useCallback2(() => {
2025
+ if (!triggerRef.current || !tipRef.current) return;
2026
+ const trigRect = triggerRef.current.getBoundingClientRect();
2027
+ const tipRect = tipRef.current.getBoundingClientRect();
2028
+ const viewport = {
2029
+ width: window.innerWidth || document.documentElement.clientWidth,
2030
+ height: window.innerHeight || document.documentElement.clientHeight
2031
+ };
2032
+ setCoords(computePosition(trigRect, tipRect, position, offset, viewport));
2033
+ }, [triggerRef, position, offset]);
2034
+ useLayoutEffect(() => {
2035
+ if (!state.isOpen) return;
2036
+ reposition();
2037
+ const id = requestAnimationFrame(reposition);
2038
+ return () => cancelAnimationFrame(id);
2039
+ }, [state.isOpen, reposition]);
2040
+ useEffect(() => {
2041
+ if (!state.isOpen) return;
2042
+ const handler = () => reposition();
2043
+ window.addEventListener("scroll", handler, true);
2044
+ window.addEventListener("resize", handler);
2045
+ return () => {
2046
+ window.removeEventListener("scroll", handler, true);
2047
+ window.removeEventListener("resize", handler);
2048
+ };
2049
+ }, [state.isOpen, reposition]);
2050
+ const resolvedPos = coords?.position ?? position;
2051
+ const variants = animVariants[resolvedPos];
2052
+ const {
2053
+ onDrag: _onDrag,
2054
+ onDragStart: _onDragStart,
2055
+ onDragEnd: _onDragEnd,
2056
+ onAnimationStart: _onAnimationStart,
2057
+ ...safeTipProps
2058
+ } = tooltipProps;
2059
+ const portalContent = /* @__PURE__ */ jsx3(AnimatePresence2, { children: state.isOpen && /* @__PURE__ */ jsx3(
2060
+ "div",
2061
+ {
2062
+ className: "ods-tooltip__wrapper",
2063
+ style: {
2064
+ position: "fixed",
2065
+ zIndex: 1500,
2066
+ top: coords?.top ?? -9999,
2067
+ left: coords?.left ?? -9999,
2068
+ visibility: coords ? "visible" : "hidden",
2069
+ pointerEvents: "none"
2070
+ },
2071
+ children: /* @__PURE__ */ jsxs3(
2072
+ motion3.div,
2073
+ {
2074
+ ref: tipRef,
2075
+ ...safeTipProps,
2076
+ id: tooltipId,
2077
+ role: "tooltip",
2078
+ "data-position": resolvedPos,
2079
+ className: cn("ods-tooltip", className),
2080
+ initial: variants.initial,
2081
+ animate: variants.animate,
2082
+ exit: { opacity: 0 },
2083
+ transition: { duration: 0.15, ease: "easeOut" },
2084
+ children: [
2085
+ content,
2086
+ /* @__PURE__ */ jsx3("span", { className: "ods-tooltip__arrow", "aria-hidden": "true" })
2087
+ ]
2088
+ }
2089
+ )
2090
+ }
2091
+ ) });
2092
+ if (typeof document === "undefined") return null;
2093
+ return createPortal(portalContent, document.body);
2094
+ }
2095
+ function mergeRefs(...refs) {
2096
+ return (node) => {
2097
+ for (const r of refs) {
2098
+ if (!r) continue;
2099
+ if (typeof r === "function") r(node);
2100
+ else r.current = node;
2101
+ }
2102
+ };
2103
+ }
2104
+ function mergeHandler(childHandler, ariaHandler) {
2105
+ if (!childHandler && !ariaHandler) return void 0;
2106
+ return (e) => {
2107
+ childHandler?.(e);
2108
+ if (!e.defaultPrevented) ariaHandler?.(e);
2109
+ };
2110
+ }
2111
+ function Tooltip({
2112
+ content,
2113
+ position = "top",
2114
+ delay = 200,
2115
+ offset = 8,
2116
+ disabled = false,
2117
+ id: providedId,
2118
+ children,
2119
+ className
2120
+ }) {
2121
+ const reactId = useId2();
2122
+ const tooltipId = providedId ?? `ods-tooltip-${reactId}`;
2123
+ const triggerRef = useRef2(null);
2124
+ const state = $3834487504f4fc00$export$4d40659c25ecb50b({ delay });
2125
+ const { triggerProps } = useTooltipTrigger(
2126
+ { delay, isDisabled: disabled },
2127
+ state,
2128
+ triggerRef
2129
+ );
2130
+ if (!isValidElement3(children)) {
2131
+ return /* @__PURE__ */ jsx3(Fragment, { children });
2132
+ }
2133
+ const childProps = children.props;
2134
+ const childRef = childProps.ref ?? children.ref;
2135
+ const merged = { ...childProps };
2136
+ for (const [key, value] of Object.entries(
2137
+ triggerProps
2138
+ )) {
2139
+ if (key.startsWith("on") && typeof value === "function") {
2140
+ merged[key] = mergeHandler(
2141
+ childProps[key],
2142
+ value
2143
+ );
2144
+ } else {
2145
+ merged[key] = value;
2146
+ }
2147
+ }
2148
+ merged.ref = mergeRefs(triggerRef, childRef);
2149
+ merged["aria-describedby"] = [childProps["aria-describedby"], tooltipId].filter(Boolean).join(" ");
2150
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
2151
+ cloneElement2(children, merged),
2152
+ !disabled && /* @__PURE__ */ jsx3(
2153
+ TooltipContent,
2154
+ {
2155
+ state,
2156
+ content,
2157
+ position,
2158
+ triggerRef,
2159
+ offset,
2160
+ className,
2161
+ tooltipId
2162
+ }
2163
+ )
2164
+ ] });
2165
+ }
2166
+ Tooltip.displayName = "Tooltip";
2167
+
2168
+ // src/components/Select/Select.tsx
2169
+ import { AnimatePresence as AnimatePresence3, motion as motion4 } from "framer-motion";
2170
+ import {
2171
+ forwardRef as forwardRef4,
2172
+ useCallback as useCallback3,
2173
+ useEffect as useEffect2,
2174
+ useId as useId3,
2175
+ useMemo,
2176
+ useRef as useRef3,
2177
+ useState as useState3
2178
+ } from "react";
2179
+ import { HiddenSelect, useButton as useButton2, useListBox, useOption, useSelect } from "react-aria";
2180
+ import { createPortal as createPortal2 } from "react-dom";
2181
+ import { CheckmarkIcon, ChevronDownIcon as ChevronDownIcon2 } from "@octaviaflow/icons";
2182
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
2183
+ function OverflowTooltip({
2184
+ enabled,
2185
+ content,
2186
+ children
2187
+ }) {
2188
+ if (!enabled || content == null || content === "") return children;
2189
+ return /* @__PURE__ */ jsx4(Tooltip, { content, children });
2190
+ }
2191
+ function ListBox(props) {
2192
+ const ref = useRef3(null);
2193
+ const {
2194
+ listBoxRef = ref,
2195
+ state,
2196
+ showCheckmark,
2197
+ showOverflowTooltips
2198
+ } = props;
2199
+ const { listBoxProps } = useListBox(props, state, listBoxRef);
2200
+ return /* @__PURE__ */ jsx4("ul", { ...listBoxProps, ref: listBoxRef, className: "ods-select__options", children: [...state.collection].map((item) => /* @__PURE__ */ jsx4(
2201
+ Option,
2202
+ {
2203
+ item,
2204
+ state,
2205
+ showCheckmark,
2206
+ showOverflowTooltips
2207
+ },
2208
+ item.key
2209
+ )) });
2210
+ }
2211
+ function Option({
2212
+ item,
2213
+ state,
2214
+ showCheckmark,
2215
+ showOverflowTooltips
2216
+ }) {
2217
+ const ref = useRef3(null);
2218
+ const { optionProps, isSelected, isFocused, isDisabled } = useOption(
2219
+ { key: item.key },
2220
+ state,
2221
+ ref
2222
+ );
2223
+ const raw = item.value;
2224
+ const option = raw?.value ?? raw;
2225
+ const tooltipContent = option?.description ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
2226
+ /* @__PURE__ */ jsx4("span", { children: option.label }),
2227
+ /* @__PURE__ */ jsx4("br", {}),
2228
+ /* @__PURE__ */ jsx4("span", { style: { opacity: 0.75 }, children: option.description })
2229
+ ] }) : option?.label;
2230
+ return /* @__PURE__ */ jsx4(
2231
+ OverflowTooltip,
2232
+ {
2233
+ enabled: !!showOverflowTooltips,
2234
+ content: tooltipContent,
2235
+ children: /* @__PURE__ */ jsxs4(
2236
+ "li",
2237
+ {
2238
+ ...optionProps,
2239
+ ref,
2240
+ className: cn(
2241
+ "ods-select__option",
2242
+ isFocused && "ods-select__option--highlighted",
2243
+ isSelected && "ods-select__option--selected",
2244
+ isDisabled && "ods-select__option--disabled"
2245
+ ),
2246
+ children: [
2247
+ option?.icon && /* @__PURE__ */ jsx4("span", { className: "ods-select__option-icon", children: option.icon }),
2248
+ /* @__PURE__ */ jsxs4("span", { className: "ods-select__option-text", children: [
2249
+ /* @__PURE__ */ jsx4("span", { className: "ods-select__option-label", children: item.rendered }),
2250
+ option?.description && /* @__PURE__ */ jsx4("span", { className: "ods-select__option-desc", children: option.description })
2251
+ ] }),
2252
+ isSelected && showCheckmark && /* @__PURE__ */ jsx4("span", { className: "ods-select__check", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(CheckmarkIcon, { size: "xs", tone: "accent" }) })
2253
+ ]
2254
+ }
2255
+ )
2256
+ }
2257
+ );
2258
+ }
2259
+ var DEFAULT_SELECT_PLACEHOLDER = "Select an option...";
2260
+ var Select = forwardRef4(function Select2({
2261
+ options,
2262
+ value,
2263
+ defaultValue,
2264
+ onChange,
2265
+ placeholder = DEFAULT_SELECT_PLACEHOLDER,
2266
+ searchable = false,
2267
+ label,
2268
+ error = false,
2269
+ errorMessage,
2270
+ helperText,
2271
+ disabled = false,
2272
+ size = "md",
2273
+ className,
2274
+ name,
2275
+ required,
2276
+ id: providedId,
2277
+ form,
2278
+ autoFocus,
2279
+ "aria-label": ariaLabel,
2280
+ "aria-labelledby": ariaLabelledBy,
2281
+ "aria-describedby": consumerDescribedBy,
2282
+ showCheckmark = false,
2283
+ closeOnOutsideClick = true,
2284
+ showOverflowTooltips = false,
2285
+ dropdownMinWidth
2286
+ }, forwardedRef) {
2287
+ const triggerRef = useRef3(null);
2288
+ const listBoxRef = useRef3(null);
2289
+ const dropdownRef = useRef3(null);
2290
+ const searchRef = useRef3(null);
2291
+ const [searchQuery, setSearchQuery] = useState3("");
2292
+ const [dropdownPos, setDropdownPos] = useState3({ left: 0, width: 0, maxHeight: 240, direction: "down" });
2293
+ const setTriggerRef = (node) => {
2294
+ triggerRef.current = node;
2295
+ if (typeof forwardedRef === "function") forwardedRef(node);
2296
+ else if (forwardedRef)
2297
+ forwardedRef.current = node;
2298
+ };
2299
+ const reactId = useId3();
2300
+ const baseId = providedId ?? `ods-select-${reactId}`;
2301
+ const hintId = error || helperText ? `${baseId}-hint` : void 0;
2302
+ const describedBy = [consumerDescribedBy, hintId].filter(Boolean).join(" ") || void 0;
2303
+ const filteredOptions = useMemo(() => {
2304
+ if (!searchable || !searchQuery) return options;
2305
+ const q = searchQuery.toLowerCase();
2306
+ return options.filter(
2307
+ (o) => o.label.toLowerCase().includes(q) || o.description?.toLowerCase().includes(q)
2308
+ );
2309
+ }, [options, searchQuery, searchable]);
2310
+ const ariaNameProps = useMemo(
2311
+ () => resolveAccessibleName({
2312
+ label,
2313
+ ariaLabel,
2314
+ ariaLabelledby: ariaLabelledBy,
2315
+ componentName: "Select",
2316
+ fallbacks: [
2317
+ placeholder && placeholder !== DEFAULT_SELECT_PLACEHOLDER ? placeholder : void 0
2318
+ ]
2319
+ }),
2320
+ [label, ariaLabel, ariaLabelledBy, placeholder]
2321
+ );
2322
+ const ariaProps = useMemo(() => {
2323
+ const items = filteredOptions.map((o) => ({
2324
+ key: o.value,
2325
+ label: o.label,
2326
+ value: o,
2327
+ isDisabled: o.disabled
2328
+ }));
2329
+ const props = {
2330
+ // Visible string label when present; otherwise rely on the aria-*
2331
+ // props for screen-reader name.
2332
+ label: typeof label === "string" ? label : void 0,
2333
+ ...ariaNameProps,
2334
+ items,
2335
+ children: (item) => /* @__PURE__ */ jsx4($05678f3aee5e7d1a$export$6d08773d2e66f8f2, { textValue: item.label, children: item.label }, item.key),
2336
+ isDisabled: disabled,
2337
+ onSelectionChange: (key) => {
2338
+ onChange?.(String(key));
2339
+ setSearchQuery("");
2340
+ }
2341
+ };
2342
+ if (value !== void 0) {
2343
+ props.selectedKey = value;
2344
+ }
2345
+ if (defaultValue !== void 0) {
2346
+ props.defaultSelectedKey = defaultValue;
2347
+ }
2348
+ return props;
2349
+ }, [filteredOptions, label, disabled, value, defaultValue, onChange, ariaNameProps]);
2350
+ const state = $29256f53a2edafe9$export$5159ec8b34d4ec12(ariaProps);
2351
+ const { triggerProps, menuProps } = useSelect(ariaProps, state, triggerRef);
2352
+ const { buttonProps } = useButton2(triggerProps, triggerRef);
2353
+ const updatePosition = useCallback3(() => {
2354
+ if (!triggerRef.current) return;
2355
+ const rect = triggerRef.current.getBoundingClientRect();
2356
+ const viewportH = window.innerHeight;
2357
+ const margin = 8;
2358
+ const gap = 4;
2359
+ const spaceBelow = viewportH - rect.bottom - gap - margin;
2360
+ const spaceAbove = rect.top - gap - margin;
2361
+ const PREFERRED_MIN = 200;
2362
+ const openUp = spaceBelow < PREFERRED_MIN && spaceAbove > spaceBelow;
2363
+ setDropdownPos({
2364
+ ...openUp ? { bottom: viewportH - rect.top + gap } : { top: rect.bottom + gap },
2365
+ left: rect.left,
2366
+ width: rect.width,
2367
+ maxHeight: Math.max(120, openUp ? spaceAbove : spaceBelow),
2368
+ direction: openUp ? "up" : "down"
2369
+ });
2370
+ }, []);
2371
+ useEffect2(() => {
2372
+ if (state.isOpen) {
2373
+ updatePosition();
2374
+ window.addEventListener("scroll", updatePosition, true);
2375
+ window.addEventListener("resize", updatePosition);
2376
+ return () => {
2377
+ window.removeEventListener("scroll", updatePosition, true);
2378
+ window.removeEventListener("resize", updatePosition);
2379
+ };
2380
+ }
2381
+ }, [state.isOpen, updatePosition]);
2382
+ useEffect2(() => {
2383
+ if (state.isOpen && searchable && searchRef.current) {
2384
+ requestAnimationFrame(() => searchRef.current?.focus());
2385
+ }
2386
+ }, [state.isOpen, searchable]);
2387
+ useEffect2(() => {
2388
+ if (!state.isOpen || !closeOnOutsideClick) return;
2389
+ const onPointer = (e) => {
2390
+ const target = e.target;
2391
+ if (dropdownRef.current?.contains(target)) return;
2392
+ if (triggerRef.current?.contains(target)) return;
2393
+ state.close();
2394
+ };
2395
+ const onKey = (e) => {
2396
+ if (e.key === "Escape") state.close();
2397
+ };
2398
+ document.addEventListener("mousedown", onPointer);
2399
+ document.addEventListener("keydown", onKey);
2400
+ return () => {
2401
+ document.removeEventListener("mousedown", onPointer);
2402
+ document.removeEventListener("keydown", onKey);
2403
+ };
2404
+ }, [state.isOpen, state.close, closeOnOutsideClick]);
2405
+ const selectedOption = options.find((o) => o.value === String(state.selectedKey ?? ""));
2406
+ const wasOpenBeforePressRef = useRef3(false);
2407
+ const handleTriggerPointerDown = (e) => {
2408
+ wasOpenBeforePressRef.current = state.isOpen;
2409
+ const baseHandler = buttonProps.onPointerDown;
2410
+ baseHandler?.(e);
2411
+ };
2412
+ const handleTriggerClick = (e) => {
2413
+ const baseHandler = buttonProps.onClick;
2414
+ baseHandler?.(e);
2415
+ if (wasOpenBeforePressRef.current && state.isOpen) {
2416
+ state.close();
2417
+ }
2418
+ wasOpenBeforePressRef.current = false;
2419
+ };
2420
+ return /* @__PURE__ */ jsxs4(
2421
+ "div",
2422
+ {
2423
+ className: cn(
2424
+ "ods-select",
2425
+ `ods-select--${size}`,
2426
+ error && "ods-select--error",
2427
+ disabled && "ods-select--disabled",
2428
+ className
2429
+ ),
2430
+ children: [
2431
+ label && /* @__PURE__ */ jsx4("label", { className: "ods-select__label", htmlFor: baseId, children: label }),
2432
+ /* @__PURE__ */ jsx4(HiddenSelect, { state, triggerRef, label, name }),
2433
+ /* @__PURE__ */ jsxs4(
2434
+ "button",
2435
+ {
2436
+ ...buttonProps,
2437
+ onPointerDown: handleTriggerPointerDown,
2438
+ onClick: handleTriggerClick,
2439
+ ref: setTriggerRef,
2440
+ id: baseId,
2441
+ form,
2442
+ autoFocus,
2443
+ "aria-label": ariaLabel,
2444
+ "aria-labelledby": ariaLabelledBy,
2445
+ "aria-describedby": describedBy,
2446
+ "aria-required": required || void 0,
2447
+ "aria-invalid": error ? true : void 0,
2448
+ className: cn("ods-select__trigger", state.isOpen && "ods-select__trigger--open"),
2449
+ children: [
2450
+ /* @__PURE__ */ jsx4("span", { className: "ods-select__value", children: selectedOption ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
2451
+ selectedOption.icon && /* @__PURE__ */ jsx4("span", { className: "ods-select__value-icon", children: selectedOption.icon }),
2452
+ selectedOption.label
2453
+ ] }) : /* @__PURE__ */ jsx4("span", { className: "ods-select__placeholder", children: placeholder }) }),
2454
+ /* @__PURE__ */ jsx4(
2455
+ "span",
2456
+ {
2457
+ className: cn(
2458
+ "ods-select__chevron",
2459
+ state.isOpen && "ods-select__chevron--open"
2460
+ ),
2461
+ "aria-hidden": "true",
2462
+ children: /* @__PURE__ */ jsx4(ChevronDownIcon2, { size: "xs" })
2463
+ }
2464
+ )
2465
+ ]
2466
+ }
2467
+ ),
2468
+ typeof document !== "undefined" && createPortal2(
2469
+ /* @__PURE__ */ jsx4(AnimatePresence3, { children: state.isOpen && /* @__PURE__ */ jsxs4(
2470
+ motion4.div,
2471
+ {
2472
+ ref: dropdownRef,
2473
+ className: "ods-select__dropdown",
2474
+ style: {
2475
+ position: "fixed",
2476
+ ...dropdownPos.top !== void 0 && { top: dropdownPos.top },
2477
+ ...dropdownPos.bottom !== void 0 && { bottom: dropdownPos.bottom },
2478
+ left: dropdownPos.left,
2479
+ // `minWidth` (not `width`) keeps the popover at
2480
+ // least as wide as the trigger — preserves visual
2481
+ // alignment — but allows the consumer to widen it
2482
+ // explicitly when option labels demand more room
2483
+ // (pass `dropdownMinWidth` to set a higher floor).
2484
+ // Avoids the previous `max-content` recipe which
2485
+ // made the popover grow uncomfortably wide on
2486
+ // searchable / long-option menus.
2487
+ minWidth: Math.max(dropdownPos.width, dropdownMinWidth ?? 0),
2488
+ // Bound the popover to the available viewport edge so
2489
+ // it never spills off-screen on tall pages. Pairs with
2490
+ // `overflow-y: auto` from the .ods-select__dropdown
2491
+ // SCSS so long option lists scroll internally.
2492
+ maxHeight: dropdownPos.maxHeight
2493
+ },
2494
+ initial: { opacity: 0, scale: 0.95 },
2495
+ animate: { opacity: 1, scale: 1 },
2496
+ exit: { opacity: 0, scale: 0.95 },
2497
+ transition: { duration: 0.2, ease: [0.16, 1, 0.3, 1] },
2498
+ children: [
2499
+ searchable && /* @__PURE__ */ jsx4("div", { className: "ods-select__search-wrap", children: /* @__PURE__ */ jsx4(
2500
+ "input",
2501
+ {
2502
+ ref: searchRef,
2503
+ className: "ods-select__search",
2504
+ type: "text",
2505
+ placeholder: "Search...",
2506
+ value: searchQuery,
2507
+ onChange: (e) => setSearchQuery(e.target.value),
2508
+ "aria-label": "Search options",
2509
+ onKeyDown: (e) => {
2510
+ if (e.key === "Escape") {
2511
+ state.close();
2512
+ }
2513
+ }
2514
+ }
2515
+ ) }),
2516
+ /* @__PURE__ */ jsx4(
2517
+ ListBox,
2518
+ {
2519
+ ...menuProps,
2520
+ listBoxRef,
2521
+ state,
2522
+ showCheckmark,
2523
+ showOverflowTooltips
2524
+ }
2525
+ ),
2526
+ filteredOptions.length === 0 && /* @__PURE__ */ jsx4("div", { className: "ods-select__empty", children: "No results found" })
2527
+ ]
2528
+ }
2529
+ ) }),
2530
+ document.body
2531
+ ),
2532
+ error && errorMessage ? /* @__PURE__ */ jsx4(
2533
+ "span",
2534
+ {
2535
+ id: hintId,
2536
+ className: "ods-select__error",
2537
+ role: "alert",
2538
+ children: errorMessage
2539
+ }
2540
+ ) : helperText ? /* @__PURE__ */ jsx4("span", { id: hintId, className: "ods-select__hint", children: helperText }) : null
2541
+ ]
2542
+ }
2543
+ );
2544
+ });
2545
+ Select.displayName = "Select";
2546
+
2547
+ // src/components/Spinner/Spinner.tsx
2548
+ import {
2549
+ forwardRef as forwardRef5
2550
+ } from "react";
2551
+ import { jsx as jsx5 } from "react/jsx-runtime";
2552
+ var SIZE_PX = {
2553
+ sm: 16,
2554
+ md: 24,
2555
+ lg: 32,
2556
+ xl: 48
2557
+ };
2558
+ var Spinner = forwardRef5(function Spinner2({
2559
+ size = "md",
2560
+ tone = "accent",
2561
+ label = "Loading",
2562
+ className,
2563
+ style,
2564
+ ...rest
2565
+ }, ref) {
2566
+ const px = typeof size === "number" ? size : SIZE_PX[size];
2567
+ const isKeyword = typeof size === "string";
2568
+ return /* @__PURE__ */ jsx5(
2569
+ "svg",
2570
+ {
2571
+ ...rest,
2572
+ ref,
2573
+ className: cn(
2574
+ "ods-spinner",
2575
+ isKeyword && `ods-spinner--${size}`,
2576
+ `ods-spinner--${tone}`,
2577
+ className
2578
+ ),
2579
+ width: px,
2580
+ height: px,
2581
+ viewBox: "0 0 24 24",
2582
+ fill: "none",
2583
+ role: "status",
2584
+ "aria-label": label,
2585
+ style,
2586
+ children: /* @__PURE__ */ jsx5(
2587
+ "circle",
2588
+ {
2589
+ cx: "12",
2590
+ cy: "12",
2591
+ r: "10",
2592
+ strokeWidth: "3",
2593
+ strokeLinecap: "round",
2594
+ strokeDasharray: "31.4 31.4",
2595
+ className: "ods-spinner__circle"
2596
+ }
2597
+ )
2598
+ }
2599
+ );
2600
+ });
2601
+ Spinner.displayName = "Spinner";
2602
+
2603
+ // src/components/Input/Input.tsx
2604
+ import { CloseIcon } from "@octaviaflow/icons";
2605
+ import {
2606
+ forwardRef as forwardRef6,
2607
+ useId as useId4,
2608
+ useImperativeHandle as useImperativeHandle2,
2609
+ useRef as useRef4
2610
+ } from "react";
2611
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
2612
+ var CLEAR_GLYPH = /* @__PURE__ */ jsx6(CloseIcon, { width: 12, height: 12, "aria-hidden": "true" });
2613
+ var Input = forwardRef6(
2614
+ ({
2615
+ type = "text",
2616
+ size = "md",
2617
+ error = false,
2618
+ errorMessage,
2619
+ label,
2620
+ helperText,
2621
+ leftIcon,
2622
+ rightIcon,
2623
+ clearable,
2624
+ onClear,
2625
+ shortcutHint,
2626
+ disabled = false,
2627
+ required,
2628
+ id,
2629
+ className,
2630
+ value,
2631
+ defaultValue,
2632
+ onChange,
2633
+ onKeyDown,
2634
+ ...props
2635
+ }, forwardedRef) => {
2636
+ const innerRef = useRef4(null);
2637
+ useImperativeHandle2(forwardedRef, () => innerRef.current);
2638
+ const reactId = useId4();
2639
+ const inputId = id ?? `${reactId}-input`;
2640
+ const errorId = `${reactId}-err`;
2641
+ const helperId = `${reactId}-help`;
2642
+ const isControlled = value !== void 0;
2643
+ const isClearable = (clearable ?? type === "search") && !disabled;
2644
+ const isSearch = type === "search";
2645
+ const currentValue = isControlled ? String(value ?? "") : innerRef.current?.value ?? String(defaultValue ?? "");
2646
+ const showClear = isClearable && currentValue.length > 0;
2647
+ const clearValue = () => {
2648
+ const el = innerRef.current;
2649
+ if (el && !isControlled) {
2650
+ const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
2651
+ setter?.call(el, "");
2652
+ el.dispatchEvent(new Event("input", { bubbles: true }));
2653
+ }
2654
+ onClear?.();
2655
+ el?.focus();
2656
+ };
2657
+ const handleClear = (e) => {
2658
+ e.preventDefault();
2659
+ e.stopPropagation();
2660
+ clearValue();
2661
+ };
2662
+ const handleKeyDown = (e) => {
2663
+ onKeyDown?.(e);
2664
+ if (e.defaultPrevented) return;
2665
+ if (isClearable && isSearch && e.key === "Escape" && currentValue) {
2666
+ e.preventDefault();
2667
+ clearValue();
2668
+ }
2669
+ };
2670
+ const describedBy = error && errorMessage ? errorId : helperText ? helperId : void 0;
2671
+ return /* @__PURE__ */ jsxs5(
2672
+ "div",
2673
+ {
2674
+ className: cn(
2675
+ "ods-input",
2676
+ `ods-input--${size}`,
2677
+ error && "ods-input--error",
2678
+ disabled && "ods-input--disabled",
2679
+ isSearch && "ods-input--search",
2680
+ className
2681
+ ),
2682
+ children: [
2683
+ label && /* @__PURE__ */ jsxs5("label", { htmlFor: inputId, className: "ods-input__label", children: [
2684
+ label,
2685
+ required && /* @__PURE__ */ jsx6("span", { className: "ods-input__required", "aria-hidden": "true", children: "*" })
2686
+ ] }),
2687
+ /* @__PURE__ */ jsxs5("div", { className: "ods-input__wrapper", children: [
2688
+ leftIcon && /* @__PURE__ */ jsx6("span", { className: "ods-input__icon--left", "aria-hidden": "true", children: leftIcon }),
2689
+ /* @__PURE__ */ jsx6(
2690
+ "input",
2691
+ {
2692
+ ...props,
2693
+ id: inputId,
2694
+ ref: innerRef,
2695
+ type,
2696
+ disabled,
2697
+ required,
2698
+ value,
2699
+ defaultValue,
2700
+ onChange,
2701
+ onKeyDown: handleKeyDown,
2702
+ className: cn(
2703
+ "ods-input__field",
2704
+ leftIcon && "ods-input__field--with-left-icon",
2705
+ (rightIcon || showClear || shortcutHint) && "ods-input__field--with-right-icon",
2706
+ showClear && shortcutHint && "ods-input__field--with-right-actions"
2707
+ ),
2708
+ "aria-invalid": error || void 0,
2709
+ "aria-required": required || void 0,
2710
+ "aria-describedby": describedBy
2711
+ }
2712
+ ),
2713
+ /* @__PURE__ */ jsxs5("span", { className: "ods-input__right", children: [
2714
+ showClear && /* @__PURE__ */ jsx6(
2715
+ "button",
2716
+ {
2717
+ type: "button",
2718
+ className: "ods-input__clear",
2719
+ onClick: handleClear,
2720
+ "aria-label": "Clear",
2721
+ tabIndex: -1,
2722
+ children: CLEAR_GLYPH
2723
+ }
2724
+ ),
2725
+ shortcutHint && !showClear && /* @__PURE__ */ jsx6("span", { className: "ods-input__kbd", "aria-hidden": "true", children: shortcutHint }),
2726
+ rightIcon && !showClear && !shortcutHint && /* @__PURE__ */ jsx6("span", { className: "ods-input__icon--right", "aria-hidden": "true", children: rightIcon })
2727
+ ] })
2728
+ ] }),
2729
+ error && errorMessage && /* @__PURE__ */ jsx6("div", { id: errorId, className: "ods-input__error-message", role: "alert", children: errorMessage }),
2730
+ !error && helperText && /* @__PURE__ */ jsx6("div", { id: helperId, className: "ods-input__helper", children: helperText })
2731
+ ]
2732
+ }
2733
+ );
2734
+ }
2735
+ );
2736
+ Input.displayName = "Input";
2737
+
2738
+ export {
2739
+ Accordion,
2740
+ Slot,
2741
+ $05678f3aee5e7d1a$export$6d08773d2e66f8f2,
2742
+ $e3403870bfb691da$export$79fefeb1c2091ac3,
2743
+ $384704861d32dbed$export$bca9d026f8e704eb,
2744
+ $caeb030f09a278a1$export$4ba071daf4e486,
2745
+ $fd3c5e01e837dc20$export$8042c6c013fd5226,
2746
+ $6b915bde6cd300dd$export$728d6ba534403756,
2747
+ getRenderableText,
2748
+ resolveAccessibleName,
2749
+ Button,
2750
+ Tooltip,
2751
+ Select,
2752
+ Spinner,
2753
+ Input
2754
+ };
2755
+ //# sourceMappingURL=chunk-64R3BAO7.js.map