@ikatec/nebula-react 0.0.1-alpha.20 → 0.0.1-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React8 = require('react');
3
+ var React36 = require('react');
4
4
  var reactSlot = require('@radix-ui/react-slot');
5
5
  var classVarianceAuthority = require('class-variance-authority');
6
6
  var tailwindMerge = require('tailwind-merge');
@@ -17,7 +17,7 @@ var DialogPrimitive = require('@radix-ui/react-dialog');
17
17
  var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
18
18
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
19
19
  var SwitchPrimitives = require('@radix-ui/react-switch');
20
- var TooltipPrimitive = require('@radix-ui/react-tooltip');
20
+ var ReactDOM = require('react-dom');
21
21
 
22
22
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
23
23
 
@@ -39,7 +39,7 @@ function _interopNamespace(e) {
39
39
  return Object.freeze(n);
40
40
  }
41
41
 
42
- var React8__namespace = /*#__PURE__*/_interopNamespace(React8);
42
+ var React36__namespace = /*#__PURE__*/_interopNamespace(React36);
43
43
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
44
44
  var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
45
45
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
@@ -52,7 +52,7 @@ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive)
52
52
  var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
53
53
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
54
54
  var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
55
- var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
55
+ var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
56
56
 
57
57
  // src/button.tsx
58
58
 
@@ -79,11 +79,11 @@ function cn(...inputs) {
79
79
  return tailwindMerge.twMerge(nebulaClass, clsx(inputs));
80
80
  }
81
81
  var processChildren = (children) => {
82
- return React8__namespace.default.Children.map(children, (child) => {
82
+ return React36__namespace.default.Children.map(children, (child) => {
83
83
  if (typeof child === "string") {
84
84
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nebula-ds px-2", children: child });
85
85
  }
86
- if (React8__namespace.default.isValidElement(child) && child.type === React8__namespace.default.Fragment) {
86
+ if (React36__namespace.default.isValidElement(child) && child.type === React36__namespace.default.Fragment) {
87
87
  return processChildren(child.props.children);
88
88
  }
89
89
  return child;
@@ -175,11 +175,11 @@ var buttonVariantsConfig = classVarianceAuthority.cva(
175
175
  }
176
176
  }
177
177
  );
178
- var Button = React8__namespace.forwardRef(
178
+ var Button = React36__namespace.forwardRef(
179
179
  ({
180
180
  className,
181
181
  variant: variant3,
182
- size: size4,
182
+ size: size7,
183
183
  icon = false,
184
184
  asChild = false,
185
185
  children,
@@ -191,12 +191,12 @@ var Button = React8__namespace.forwardRef(
191
191
  sm: "h-8 w-8 p-0",
192
192
  md: "h-10 w-10 p-0",
193
193
  lg: "h-12 w-12 p-0"
194
- }[size4 ?? "md"] : "";
194
+ }[size7 ?? "md"] : "";
195
195
  return /* @__PURE__ */ jsxRuntime.jsx(
196
196
  Comp,
197
197
  {
198
198
  className: cn(
199
- buttonVariantsConfig({ variant: variant3, size: size4, className }),
199
+ buttonVariantsConfig({ variant: variant3, size: size7, className }),
200
200
  iconSizeClasses
201
201
  ),
202
202
  ref,
@@ -240,13 +240,13 @@ var badgeVariantsConfig = classVarianceAuthority.cva(
240
240
  }
241
241
  }
242
242
  );
243
- var Badge = React8__namespace.forwardRef(
244
- ({ className, variant: variant3, size: size4, ...props }, ref) => {
243
+ var Badge = React36__namespace.forwardRef(
244
+ ({ className, variant: variant3, size: size7, ...props }, ref) => {
245
245
  return /* @__PURE__ */ jsxRuntime.jsx(
246
246
  "div",
247
247
  {
248
248
  ref,
249
- className: cn(badgeVariantsConfig({ variant: variant3, size: size4 }), className),
249
+ className: cn(badgeVariantsConfig({ variant: variant3, size: size7 }), className),
250
250
  ...props
251
251
  }
252
252
  );
@@ -324,7 +324,7 @@ var alertVariantsConfig = classVarianceAuthority.cva(
324
324
  }
325
325
  );
326
326
  var alertVariants = extractVariants(variants);
327
- var Alert = React8__namespace.forwardRef(
327
+ var Alert = React36__namespace.forwardRef(
328
328
  ({ className, variant: variant3, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
329
329
  "div",
330
330
  {
@@ -336,7 +336,7 @@ var Alert = React8__namespace.forwardRef(
336
336
  )
337
337
  );
338
338
  Alert.displayName = "Alert";
339
- var AlertTitle = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
339
+ var AlertTitle = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
340
340
  "h5",
341
341
  {
342
342
  ref,
@@ -345,7 +345,7 @@ var AlertTitle = React8__namespace.forwardRef(({ className, ...props }, ref) =>
345
345
  }
346
346
  ));
347
347
  AlertTitle.displayName = "AlertTitle";
348
- var AlertDescription = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
348
+ var AlertDescription = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
349
349
  "div",
350
350
  {
351
351
  ref,
@@ -354,7 +354,7 @@ var AlertDescription = React8__namespace.forwardRef(({ className, ...props }, re
354
354
  }
355
355
  ));
356
356
  AlertDescription.displayName = "AlertDescription";
357
- var AlertButton = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
357
+ var AlertButton = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
358
358
  "button",
359
359
  {
360
360
  ref,
@@ -365,9 +365,9 @@ var AlertButton = React8__namespace.forwardRef(({ className, ...props }, ref) =>
365
365
  AlertButton.displayName = "AlertButton";
366
366
  var Popover = PopoverPrimitive__namespace.Root;
367
367
  var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
368
- var PopoverContent = React8__namespace.forwardRef(
368
+ var PopoverContent = React36__namespace.forwardRef(
369
369
  ({ className, align = "center", sideOffset = 4, portal = false, ...props }, ref) => {
370
- const Comp = portal ? PopoverPrimitive__namespace.Portal : React8__namespace.Fragment;
370
+ const Comp = portal ? PopoverPrimitive__namespace.Portal : React36__namespace.Fragment;
371
371
  return /* @__PURE__ */ jsxRuntime.jsx(Comp, { children: /* @__PURE__ */ jsxRuntime.jsx(
372
372
  PopoverPrimitive__namespace.Content,
373
373
  {
@@ -395,7 +395,7 @@ var PopoverContent = React8__namespace.forwardRef(
395
395
  }
396
396
  );
397
397
  PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
398
- var Label = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
398
+ var Label = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
399
399
  LabelPrimitive__namespace.Root,
400
400
  {
401
401
  ref,
@@ -407,7 +407,7 @@ var Label = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @_
407
407
  }
408
408
  ));
409
409
  Label.displayName = LabelPrimitive__namespace.Root.displayName;
410
- var Table = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nebula-ds relative w-full overflow-auto border rounded-2xl border-table-border bg-table-background", children: /* @__PURE__ */ jsxRuntime.jsx(
410
+ var Table = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nebula-ds relative w-full overflow-auto border rounded-2xl border-table-border bg-table-background", children: /* @__PURE__ */ jsxRuntime.jsx(
411
411
  "table",
412
412
  {
413
413
  ref,
@@ -416,9 +416,9 @@ var Table = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @_
416
416
  }
417
417
  ) }));
418
418
  Table.displayName = "Table";
419
- var TableHeader = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
419
+ var TableHeader = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
420
420
  TableHeader.displayName = "TableHeader";
421
- var TableBody = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
421
+ var TableBody = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
422
422
  "tbody",
423
423
  {
424
424
  ref,
@@ -427,7 +427,7 @@ var TableBody = React8__namespace.forwardRef(({ className, ...props }, ref) => /
427
427
  }
428
428
  ));
429
429
  TableBody.displayName = "TableBody";
430
- var TableFooter = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
430
+ var TableFooter = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
431
431
  "tfoot",
432
432
  {
433
433
  ref,
@@ -458,7 +458,7 @@ var tableRowVariantsConfig = classVarianceAuthority.cva(
458
458
  }
459
459
  }
460
460
  );
461
- var TableRow = React8__namespace.forwardRef(
461
+ var TableRow = React36__namespace.forwardRef(
462
462
  ({ className, variant: variant3 = "first", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
463
463
  "tr",
464
464
  {
@@ -469,7 +469,7 @@ var TableRow = React8__namespace.forwardRef(
469
469
  )
470
470
  );
471
471
  TableRow.displayName = "TableRow";
472
- var TableHead = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
472
+ var TableHead = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
473
473
  "th",
474
474
  {
475
475
  ref,
@@ -481,7 +481,7 @@ var TableHead = React8__namespace.forwardRef(({ className, ...props }, ref) => /
481
481
  }
482
482
  ));
483
483
  TableHead.displayName = "TableHead";
484
- var TableCell = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
484
+ var TableCell = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
485
485
  "td",
486
486
  {
487
487
  ref,
@@ -493,13 +493,13 @@ var TableCell = React8__namespace.forwardRef(({ className, ...props }, ref) => /
493
493
  }
494
494
  ));
495
495
  TableCell.displayName = "TableCell";
496
- var TableCaption = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("caption", { ref, className: cn("mt-4 text-sm", className), ...props }));
496
+ var TableCaption = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("caption", { ref, className: cn("mt-4 text-sm", className), ...props }));
497
497
  TableCaption.displayName = "TableCaption";
498
498
 
499
499
  // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
500
500
  var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
501
- var mergeClasses = (...classes) => classes.filter((className, index, array) => {
502
- return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
501
+ var mergeClasses = (...classes) => classes.filter((className, index2, array) => {
502
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
503
503
  }).join(" ").trim();
504
504
 
505
505
  // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
@@ -516,10 +516,10 @@ var defaultAttributes = {
516
516
  };
517
517
 
518
518
  // ../../node_modules/lucide-react/dist/esm/Icon.js
519
- var Icon = React8.forwardRef(
519
+ var Icon = React36.forwardRef(
520
520
  ({
521
521
  color: color2 = "currentColor",
522
- size: size4 = 24,
522
+ size: size7 = 24,
523
523
  strokeWidth = 2,
524
524
  absoluteStrokeWidth,
525
525
  className = "",
@@ -527,20 +527,20 @@ var Icon = React8.forwardRef(
527
527
  iconNode,
528
528
  ...rest
529
529
  }, ref) => {
530
- return React8.createElement(
530
+ return React36.createElement(
531
531
  "svg",
532
532
  {
533
533
  ref,
534
534
  ...defaultAttributes,
535
- width: size4,
536
- height: size4,
535
+ width: size7,
536
+ height: size7,
537
537
  stroke: color2,
538
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size4) : strokeWidth,
538
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size7) : strokeWidth,
539
539
  className: mergeClasses("lucide", className),
540
540
  ...rest
541
541
  },
542
542
  [
543
- ...iconNode.map(([tag, attrs]) => React8.createElement(tag, attrs)),
543
+ ...iconNode.map(([tag, attrs]) => React36.createElement(tag, attrs)),
544
544
  ...Array.isArray(children) ? children : [children]
545
545
  ]
546
546
  );
@@ -549,8 +549,8 @@ var Icon = React8.forwardRef(
549
549
 
550
550
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
551
551
  var createLucideIcon = (iconName, iconNode) => {
552
- const Component = React8.forwardRef(
553
- ({ className, ...props }, ref) => React8.createElement(Icon, {
552
+ const Component = React36.forwardRef(
553
+ ({ className, ...props }, ref) => React36.createElement(Icon, {
554
554
  ref,
555
555
  iconNode,
556
556
  className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
@@ -660,7 +660,7 @@ var DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
660
660
  var DropdownMenuGroup = DropdownMenuPrimitive__namespace.Group;
661
661
  var DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
662
662
  var DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
663
- var DropdownMenuSubTrigger = React8__namespace.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
663
+ var DropdownMenuSubTrigger = React36__namespace.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
664
664
  DropdownMenuPrimitive__namespace.SubTrigger,
665
665
  {
666
666
  ref,
@@ -692,8 +692,8 @@ var DropdownMenuSubTrigger = React8__namespace.forwardRef(({ className, inset, c
692
692
  }
693
693
  ));
694
694
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
695
- var DropdownMenuSubContent = React8__namespace.forwardRef(({ className, portal = false, ...props }, ref) => {
696
- const Comp = portal ? DropdownMenuPrimitive__namespace.Portal : React8__namespace.Fragment;
695
+ var DropdownMenuSubContent = React36__namespace.forwardRef(({ className, portal = false, ...props }, ref) => {
696
+ const Comp = portal ? DropdownMenuPrimitive__namespace.Portal : React36__namespace.Fragment;
697
697
  return /* @__PURE__ */ jsxRuntime.jsx(Comp, { children: /* @__PURE__ */ jsxRuntime.jsx(
698
698
  DropdownMenuPrimitive__namespace.SubContent,
699
699
  {
@@ -718,8 +718,8 @@ var DropdownMenuSubContent = React8__namespace.forwardRef(({ className, portal =
718
718
  ) });
719
719
  });
720
720
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
721
- var DropdownMenuContent = React8__namespace.forwardRef(({ className, sideOffset = 4, portal = false, ...props }, ref) => {
722
- const Comp = portal ? DropdownMenuPrimitive__namespace.Portal : React8__namespace.Fragment;
721
+ var DropdownMenuContent = React36__namespace.forwardRef(({ className, sideOffset = 4, portal = false, ...props }, ref) => {
722
+ const Comp = portal ? DropdownMenuPrimitive__namespace.Portal : React36__namespace.Fragment;
723
723
  return /* @__PURE__ */ jsxRuntime.jsx(Comp, { children: /* @__PURE__ */ jsxRuntime.jsx(
724
724
  DropdownMenuPrimitive__namespace.Content,
725
725
  {
@@ -747,7 +747,7 @@ var DropdownMenuContent = React8__namespace.forwardRef(({ className, sideOffset
747
747
  ) });
748
748
  });
749
749
  DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
750
- var DropdownMenuItem = React8__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
750
+ var DropdownMenuItem = React36__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
751
751
  DropdownMenuPrimitive__namespace.Item,
752
752
  {
753
753
  ref,
@@ -780,7 +780,7 @@ var DropdownMenuItem = React8__namespace.forwardRef(({ className, inset, ...prop
780
780
  }
781
781
  ));
782
782
  DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
783
- var DropdownMenuCheckboxItem = React8__namespace.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
783
+ var DropdownMenuCheckboxItem = React36__namespace.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
784
784
  DropdownMenuPrimitive__namespace.CheckboxItem,
785
785
  {
786
786
  ref,
@@ -818,7 +818,7 @@ var DropdownMenuCheckboxItem = React8__namespace.forwardRef(({ className, childr
818
818
  }
819
819
  ));
820
820
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
821
- var DropdownMenuRadioItem = React8__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
821
+ var DropdownMenuRadioItem = React36__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
822
822
  DropdownMenuPrimitive__namespace.RadioItem,
823
823
  {
824
824
  ref,
@@ -854,7 +854,7 @@ var DropdownMenuRadioItem = React8__namespace.forwardRef(({ className, children,
854
854
  }
855
855
  ));
856
856
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
857
- var DropdownMenuLabel = React8__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
857
+ var DropdownMenuLabel = React36__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
858
858
  DropdownMenuPrimitive__namespace.Label,
859
859
  {
860
860
  ref,
@@ -874,7 +874,7 @@ var DropdownMenuLabel = React8__namespace.forwardRef(({ className, inset, ...pro
874
874
  }
875
875
  ));
876
876
  DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
877
- var DropdownMenuSeparator = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
877
+ var DropdownMenuSeparator = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
878
878
  DropdownMenuPrimitive__namespace.Separator,
879
879
  {
880
880
  ref,
@@ -924,7 +924,7 @@ var separatorVariantsConfig = classVarianceAuthority.cva("shrink-0 bg-separator-
924
924
  }
925
925
  });
926
926
  var separatorVariants = extractVariants(variants3);
927
- var Separator2 = React8__namespace.forwardRef(
927
+ var Separator2 = React36__namespace.forwardRef(
928
928
  ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => {
929
929
  return /* @__PURE__ */ jsxRuntime.jsx(
930
930
  SeparatorPrimitive__namespace.Root,
@@ -973,12 +973,12 @@ var spaceVariantsConfig = classVarianceAuthority.cva("flex items-start justify-s
973
973
  direction: "row"
974
974
  }
975
975
  });
976
- var Space = React8__namespace.default.forwardRef(
977
- ({ size: size4, direction: direction2, className, children }, ref) => {
976
+ var Space = React36__namespace.default.forwardRef(
977
+ ({ size: size7, direction: direction2, className, children }, ref) => {
978
978
  return /* @__PURE__ */ jsxRuntime.jsx(
979
979
  "div",
980
980
  {
981
- className: cn(spaceVariantsConfig({ size: size4, direction: direction2, className })),
981
+ className: cn(spaceVariantsConfig({ size: size7, direction: direction2, className })),
982
982
  ref,
983
983
  children
984
984
  }
@@ -1001,20 +1001,13 @@ var messages = {
1001
1001
  };
1002
1002
  var pagination_default = messages;
1003
1003
 
1004
- // src/i18n/messages/en/input-select.ts
1005
- var messages2 = {
1006
- noOptions: "No options available"
1007
- };
1008
- var input_select_default = messages2;
1009
-
1010
1004
  // src/i18n/messages/en/index.ts
1011
1005
  var enMessages = {
1012
- pagination: pagination_default,
1013
- inputSelect: input_select_default
1006
+ pagination: pagination_default
1014
1007
  };
1015
1008
 
1016
1009
  // src/i18n/messages/es/pagination.ts
1017
- var messages3 = {
1010
+ var messages2 = {
1018
1011
  totalResultsLabel(pagesSize, totalResults) {
1019
1012
  if (totalResults < pagesSize) {
1020
1013
  pagesSize = totalResults;
@@ -1025,22 +1018,15 @@ var messages3 = {
1025
1018
  return `P\xE1gina ${currentPage} de ${totalPages}`;
1026
1019
  }
1027
1020
  };
1028
- var pagination_default2 = messages3;
1029
-
1030
- // src/i18n/messages/es/input-select.ts
1031
- var messages4 = {
1032
- noOptions: "No hay opciones disponibles"
1033
- };
1034
- var input_select_default2 = messages4;
1021
+ var pagination_default2 = messages2;
1035
1022
 
1036
1023
  // src/i18n/messages/es/index.ts
1037
1024
  var esMessages = {
1038
- pagination: pagination_default2,
1039
- inputSelect: input_select_default2
1025
+ pagination: pagination_default2
1040
1026
  };
1041
1027
 
1042
1028
  // src/i18n/messages/pt-br/pagination.ts
1043
- var messages5 = {
1029
+ var messages3 = {
1044
1030
  totalResultsLabel(pagesSize, totalResults) {
1045
1031
  if (totalResults < pagesSize) {
1046
1032
  pagesSize = totalResults;
@@ -1051,18 +1037,11 @@ var messages5 = {
1051
1037
  return `P\xE1gina ${currentPage} de ${totalPages}`;
1052
1038
  }
1053
1039
  };
1054
- var pagination_default3 = messages5;
1055
-
1056
- // src/i18n/messages/pt-br/input-select.ts
1057
- var messages6 = {
1058
- noOptions: "Nenhuma op\xE7\xE3o dispon\xEDvel"
1059
- };
1060
- var input_select_default3 = messages6;
1040
+ var pagination_default3 = messages3;
1061
1041
 
1062
1042
  // src/i18n/messages/pt-br/index.ts
1063
1043
  var ptBrMessages = {
1064
- pagination: pagination_default3,
1065
- inputSelect: input_select_default3
1044
+ pagination: pagination_default3
1066
1045
  };
1067
1046
 
1068
1047
  // src/i18n/messasge-storege-handler.ts
@@ -1087,38 +1066,38 @@ var setNebulaLanguage = (language) => {
1087
1066
  }
1088
1067
  localStorage.setItem(getNebulaI18nStorageKey(), language);
1089
1068
  };
1090
- var messages7 = /* @__PURE__ */ new Map([
1069
+ var messages4 = /* @__PURE__ */ new Map([
1091
1070
  [null, enMessages],
1092
1071
  [void 0, enMessages],
1093
1072
  ["en-US", enMessages],
1094
1073
  ["es", esMessages],
1095
1074
  ["pt-BR", ptBrMessages]
1096
1075
  ]);
1097
- var NebulaI18nContext = React8.createContext(
1076
+ var NebulaI18nContext = React36.createContext(
1098
1077
  null
1099
1078
  );
1100
1079
  var NebulaI18nProvider = ({
1101
1080
  children,
1102
1081
  customI18nStorageKey
1103
1082
  }) => {
1104
- const storageKey = React8.useMemo(
1083
+ const storageKey = React36.useMemo(
1105
1084
  () => customI18nStorageKey ?? localStorageKey,
1106
1085
  [customI18nStorageKey]
1107
1086
  );
1108
- const [messages8, setMessages] = React8.useState(
1109
- messages7.get(getNebulaLanguage()) ?? messages7.get("en-US")
1087
+ const [messages5, setMessages] = React36.useState(
1088
+ messages4.get(getNebulaLanguage()) ?? messages4.get("en-US")
1110
1089
  );
1111
- const handleStorageChange = React8.useCallback(
1090
+ const handleStorageChange = React36.useCallback(
1112
1091
  ({ detail }) => {
1113
1092
  if (detail.key === storageKey) {
1114
1093
  setMessages(
1115
- messages7.get(detail.value) ?? messages7.get("en-US")
1094
+ messages4.get(detail.value) ?? messages4.get("en-US")
1116
1095
  );
1117
1096
  }
1118
1097
  },
1119
1098
  [storageKey]
1120
1099
  );
1121
- React8.useEffect(() => {
1100
+ React36.useEffect(() => {
1122
1101
  if (typeof window === "undefined") {
1123
1102
  return;
1124
1103
  }
@@ -1141,7 +1120,7 @@ var NebulaI18nProvider = ({
1141
1120
  );
1142
1121
  };
1143
1122
  }, [handleStorageChange]);
1144
- React8.useEffect(() => {
1123
+ React36.useEffect(() => {
1145
1124
  if (typeof window === "undefined") {
1146
1125
  return;
1147
1126
  }
@@ -1152,10 +1131,10 @@ var NebulaI18nProvider = ({
1152
1131
  localStorage.removeItem(localStorageKey);
1153
1132
  localStorage.setItem(customNebulaI18nStorageKey, customI18nStorageKey);
1154
1133
  }, [customI18nStorageKey]);
1155
- return /* @__PURE__ */ jsxRuntime.jsx(NebulaI18nContext.Provider, { value: { messages: messages8 }, children });
1134
+ return /* @__PURE__ */ jsxRuntime.jsx(NebulaI18nContext.Provider, { value: { messages: messages5 }, children });
1156
1135
  };
1157
1136
  var useNebulaI18n = () => {
1158
- const context = React8.useContext(NebulaI18nContext);
1137
+ const context = React36.useContext(NebulaI18nContext);
1159
1138
  if (!context) {
1160
1139
  throw new Error("useNebulaI18n must be used within a NebulaI18nProvider");
1161
1140
  }
@@ -1169,11 +1148,11 @@ var Pagination = ({
1169
1148
  onChangePage,
1170
1149
  ...props
1171
1150
  }) => {
1172
- const { messages: messages8 } = useNebulaI18n();
1173
- const totalPages = React8.useMemo(() => {
1151
+ const { messages: messages5 } = useNebulaI18n();
1152
+ const totalPages = React36.useMemo(() => {
1174
1153
  return Math.ceil(total / (pageSize || 1));
1175
1154
  }, [total, pageSize]);
1176
- const handleChangePage = React8.useCallback(
1155
+ const handleChangePage = React36.useCallback(
1177
1156
  (page2) => {
1178
1157
  if (page2 < 1 || page2 > totalPages) {
1179
1158
  return;
@@ -1182,7 +1161,7 @@ var Pagination = ({
1182
1161
  },
1183
1162
  [totalPages, onChangePage]
1184
1163
  );
1185
- const normalizedPage = React8.useMemo(() => {
1164
+ const normalizedPage = React36.useMemo(() => {
1186
1165
  if (page < 1) {
1187
1166
  return 1;
1188
1167
  }
@@ -1193,22 +1172,22 @@ var Pagination = ({
1193
1172
  }, [page, totalPages]);
1194
1173
  const disabledPreviousPage = normalizedPage === 1 || totalPages === 0;
1195
1174
  const disabledNextPage = normalizedPage === totalPages || totalPages === 0;
1196
- const lastPageSize = React8.useMemo(() => {
1175
+ const lastPageSize = React36.useMemo(() => {
1197
1176
  if (totalPages === 0) {
1198
1177
  return 0;
1199
1178
  }
1200
1179
  const lastPageStart = (totalPages - 1) * pageSize;
1201
1180
  return total - lastPageStart;
1202
1181
  }, [totalPages, pageSize, total]);
1203
- const totalResultsLabel = React8.useMemo(() => {
1182
+ const totalResultsLabel = React36.useMemo(() => {
1204
1183
  if (page === totalPages) {
1205
- return messages8.pagination.totalResultsLabel(lastPageSize, total);
1184
+ return messages5.pagination.totalResultsLabel(lastPageSize, total);
1206
1185
  }
1207
- return messages8.pagination.totalResultsLabel(pageSize, total);
1208
- }, [messages8.pagination, pageSize, total, page, totalPages, lastPageSize]);
1209
- const currentPageLabel = React8.useMemo(
1210
- () => messages8.pagination.currentPageLabel(normalizedPage, totalPages),
1211
- [messages8.pagination, normalizedPage, totalPages]
1186
+ return messages5.pagination.totalResultsLabel(pageSize, total);
1187
+ }, [messages5.pagination, pageSize, total, page, totalPages, lastPageSize]);
1188
+ const currentPageLabel = React36.useMemo(
1189
+ () => messages5.pagination.currentPageLabel(normalizedPage, totalPages),
1190
+ [messages5.pagination, normalizedPage, totalPages]
1212
1191
  );
1213
1192
  return /* @__PURE__ */ jsxRuntime.jsxs(
1214
1193
  "nav",
@@ -1255,7 +1234,7 @@ var Pagination = ({
1255
1234
  );
1256
1235
  };
1257
1236
  Pagination.displayName = "Pagination";
1258
- var PaginationContent = React8.forwardRef(
1237
+ var PaginationContent = React36.forwardRef(
1259
1238
  ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1260
1239
  "ul",
1261
1240
  {
@@ -1269,7 +1248,7 @@ var PaginationContent = React8.forwardRef(
1269
1248
  )
1270
1249
  );
1271
1250
  PaginationContent.displayName = "PaginationContent";
1272
- var PaginationItem = React8.forwardRef(
1251
+ var PaginationItem = React36.forwardRef(
1273
1252
  ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1274
1253
  "li",
1275
1254
  {
@@ -1356,7 +1335,7 @@ var tagVariantsConfig = classVarianceAuthority.cva("w-2 h-2 block rounded-sm", {
1356
1335
  color
1357
1336
  }
1358
1337
  });
1359
- var Tag = React8__namespace.forwardRef(
1338
+ var Tag = React36__namespace.forwardRef(
1360
1339
  ({ className, color: color2, children, onDelete, ...props }, ref) => {
1361
1340
  return /* @__PURE__ */ jsxRuntime.jsxs(
1362
1341
  "div",
@@ -1378,7 +1357,14 @@ var Tag = React8__namespace.forwardRef(
1378
1357
  );
1379
1358
  Tag.displayName = "Tag";
1380
1359
  var DropdownIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: "16px" }) });
1381
- var ClearIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: "16px" }) });
1360
+ var ClearIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(
1361
+ Select.components.ClearIndicator,
1362
+ {
1363
+ ...props,
1364
+ className: cn(props.className, "cursor-pointer"),
1365
+ children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: "16px" })
1366
+ }
1367
+ );
1382
1368
  var MultiValueRemove = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueRemove, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(CircleX, { size: "16px" }) });
1383
1369
  var Option = (props) => {
1384
1370
  const { isSelected, data, innerRef, innerProps } = props;
@@ -1398,13 +1384,11 @@ var Option = (props) => {
1398
1384
  hover:text-inputSelect-focus-text
1399
1385
  hover:bg-listItem-background-hover
1400
1386
  bg-listItem-background-default
1401
- `,
1402
- isSelected ? `
1403
- text-inputSelect-focus-text
1404
- font-semibold
1405
- bg-listItem-background-hover` : `
1406
1387
  text-inputSelect-default-text
1407
- `
1388
+ `,
1389
+ {
1390
+ "text-inputSelect-focus-text font-semibold bg-listItem-background-hover": isSelected
1391
+ }
1408
1392
  ),
1409
1393
  children: [
1410
1394
  isSelected && /* @__PURE__ */ jsxRuntime.jsx(Check, { size: "16px" }),
@@ -1413,72 +1397,84 @@ var Option = (props) => {
1413
1397
  }
1414
1398
  );
1415
1399
  };
1416
- var controlStyles = (state) => cn([
1417
- `
1418
- border
1419
- bg-inputSelect-default-background
1420
- rounded-[20px]
1421
- px-4
1422
- w-full
1423
- min-h-10
1424
- transition
1425
- `,
1426
- {
1427
- "border-inputSelect-focus-border text-inputSelect-focus-text ring-[3px] ring-inputSelect-focus-border": state.isFocused,
1428
- "border-inputSelect-default-border text-inputSelect-default-text": !state.isFocused,
1429
- "bg-inputText-background-disabled": state.isDisabled
1430
- }
1431
- ]);
1400
+ var controlStyles = ({ isDisabled, isFocused }, isError) => {
1401
+ return cn(
1402
+ "flex w-full items-center border bg-inputSelect-default-background rounded-[20px] px-4 min-h-10 transition",
1403
+ {
1404
+ "ring-[3px] border-inputSelect-focus-border text-inputSelect-focus-text ring-inputSelect-focus-border": isFocused,
1405
+ "border-inputSelect-danger-border text-inputSelect-danger-icon": isError,
1406
+ "border-inputSelect-default-border text-inputSelect-default-text": !isFocused && !isError,
1407
+ "bg-inputText-background-disabled": isDisabled,
1408
+ "ring-button-danger-border-focus": isError && isFocused
1409
+ }
1410
+ );
1411
+ };
1432
1412
  var placeholderStyles = "text-inputSelect-default-text text-sm";
1433
1413
  var selectInputStyles = "p-0";
1434
1414
  var valueContainerStyles = "gap-1";
1435
1415
  var singleValueStyles = "text-inputSelect-active-text text-sm";
1436
- var multiValueStyles = "border rounded-full items-center px-2 py-0.2 gap-1.5 text-xs border-inputSelect-default-border";
1437
- var multiValueLabelStyles = "leading-6 px-2 py-0.2";
1416
+ var multiValueStyles = "border rounded-full items-center gap-1.5 text-xs border-inputSelect-default-border h-6 px-2";
1417
+ var multiValueLabelStyles = "";
1438
1418
  var indicatorsContainerStyles = "";
1439
1419
  var clearIndicatorStyles = "text-inputSelect-default-icon mr-2";
1440
1420
  var dropdownIndicatorStyles = "text-inputSelect-default-icon";
1441
- var menuStyles = "mt-2 border bg-inputSelect-default-background rounded-2xl overflow-hidden shadow-md shadow-dropdownMenu-shadow";
1421
+ var menuStyles = "mt-2 z-[1000] rounded-2xl border border-dropdownMenu-border bg-dropdownMenu-background shadow-dropdownMenu-shadow shadow-sm outline-none overflow-hidden";
1442
1422
  var groupHeadingStyles = "ml-3 mt-2 mb-1 text-inputSelect-default-text text-sm";
1443
1423
  var noOptionsMessageStyles = "p-2 text-inputSelect-default-text";
1444
1424
  var createStyledSelect = (BaseSelect, displayName) => {
1445
1425
  const StyledSelect2 = ({
1446
1426
  icon,
1447
1427
  disabled = false,
1428
+ isError = false,
1448
1429
  ...props
1449
1430
  }) => {
1450
- const { messages: messages8 } = useNebulaI18n();
1431
+ const customClassNames = React36.useMemo(() => {
1432
+ return {
1433
+ control: (props2) => controlStyles(props2, isError),
1434
+ placeholder: () => placeholderStyles,
1435
+ input: () => selectInputStyles,
1436
+ valueContainer: () => valueContainerStyles,
1437
+ singleValue: () => singleValueStyles,
1438
+ multiValue: () => multiValueStyles,
1439
+ multiValueLabel: () => multiValueLabelStyles,
1440
+ indicatorsContainer: () => indicatorsContainerStyles,
1441
+ clearIndicator: () => clearIndicatorStyles,
1442
+ dropdownIndicator: () => dropdownIndicatorStyles,
1443
+ menu: () => menuStyles,
1444
+ groupHeading: () => groupHeadingStyles,
1445
+ noOptionsMessage: () => noOptionsMessageStyles
1446
+ };
1447
+ }, [isError]);
1448
+ const customComponents = React36.useMemo(
1449
+ () => ({
1450
+ DropdownIndicator,
1451
+ ClearIndicator,
1452
+ MultiValueRemove,
1453
+ Option,
1454
+ Control: ({ children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.Control, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nebula-ds flex w-full items-center", children: [
1455
+ icon && /* @__PURE__ */ jsxRuntime.jsx(
1456
+ "span",
1457
+ {
1458
+ className: cn("mr-2", {
1459
+ "text-inputSelect-default-icon": !isError,
1460
+ "text-inputSelect-danger-icon": isError
1461
+ }),
1462
+ children: icon
1463
+ }
1464
+ ),
1465
+ children
1466
+ ] }) })
1467
+ }),
1468
+ [icon, isError]
1469
+ );
1451
1470
  return /* @__PURE__ */ jsxRuntime.jsx(
1452
1471
  BaseSelect,
1453
1472
  {
1454
1473
  unstyled: true,
1455
1474
  isDisabled: disabled,
1456
- components: {
1457
- DropdownIndicator,
1458
- ClearIndicator,
1459
- MultiValueRemove,
1460
- Option,
1461
- Control: ({ children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.Control, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nebula-ds flex w-full items-center", children: [
1462
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nebula-ds text-inputSelect-default-icon pr-2", children: icon }),
1463
- children
1464
- ] }) })
1465
- },
1466
- classNames: {
1467
- control: (state) => cn(controlStyles(state)),
1468
- placeholder: () => placeholderStyles,
1469
- input: () => selectInputStyles,
1470
- valueContainer: () => valueContainerStyles,
1471
- singleValue: () => singleValueStyles,
1472
- multiValue: () => multiValueStyles,
1473
- multiValueLabel: () => multiValueLabelStyles,
1474
- indicatorsContainer: () => indicatorsContainerStyles,
1475
- clearIndicator: () => clearIndicatorStyles,
1476
- dropdownIndicator: () => dropdownIndicatorStyles,
1477
- menu: () => menuStyles,
1478
- groupHeading: () => groupHeadingStyles,
1479
- noOptionsMessage: () => noOptionsMessageStyles
1480
- },
1481
- noOptionsMessage: () => /* @__PURE__ */ jsxRuntime.jsx("p", { children: messages8.inputSelect.noOptions }),
1475
+ components: customComponents,
1476
+ classNames: customClassNames,
1477
+ noOptionsMessage: () => /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No options available" }),
1482
1478
  ...props
1483
1479
  }
1484
1480
  );
@@ -1493,10 +1489,10 @@ var StyledAsyncCreatable = createStyledSelect(
1493
1489
  AsyncCreatable__default.default,
1494
1490
  "AsyncCreatable"
1495
1491
  );
1496
- var InputText = React8__namespace.forwardRef(
1492
+ var InputText = React36__namespace.forwardRef(
1497
1493
  ({ className, icon, isError = false, onClean, ...props }, ref) => {
1498
1494
  const initialInputType = props.type || "text";
1499
- const [type, setType] = React8__namespace.useState(initialInputType);
1495
+ const [type, setType] = React36__namespace.useState(initialInputType);
1500
1496
  const iconClass = {
1501
1497
  "text-inputText-icon-danger": isError,
1502
1498
  "text-inputText-icon-default focus:text-inputText-icon-focus": !isError && !props.value,
@@ -1563,7 +1559,7 @@ var Dialog = DialogPrimitive__namespace.Root;
1563
1559
  var DialogTrigger = DialogPrimitive__namespace.Trigger;
1564
1560
  var DialogPortal = DialogPrimitive__namespace.Portal;
1565
1561
  var DialogClose = DialogPrimitive__namespace.Close;
1566
- var DialogOverlay = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1562
+ var DialogOverlay = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1567
1563
  DialogPrimitive__namespace.Overlay,
1568
1564
  {
1569
1565
  ref,
@@ -1582,8 +1578,8 @@ var DialogOverlay = React8__namespace.forwardRef(({ className, ...props }, ref)
1582
1578
  }
1583
1579
  ));
1584
1580
  DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1585
- var DialogContent = React8__namespace.forwardRef(({ className, children, portal = false, ...props }, ref) => {
1586
- const Comp = portal ? DialogPortal : React8__namespace.Fragment;
1581
+ var DialogContent = React36__namespace.forwardRef(({ className, children, portal = false, ...props }, ref) => {
1582
+ const Comp = portal ? DialogPortal : React36__namespace.Fragment;
1587
1583
  return /* @__PURE__ */ jsxRuntime.jsxs(Comp, { children: [
1588
1584
  /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
1589
1585
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1661,7 +1657,7 @@ var DialogFooter = ({
1661
1657
  ...props
1662
1658
  }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex gap-2", className), ...props });
1663
1659
  DialogFooter.displayName = "DialogFooter";
1664
- var DialogTitle = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1660
+ var DialogTitle = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1665
1661
  DialogPrimitive__namespace.Title,
1666
1662
  {
1667
1663
  ref,
@@ -1673,7 +1669,7 @@ var DialogTitle = React8__namespace.forwardRef(({ className, ...props }, ref) =>
1673
1669
  }
1674
1670
  ));
1675
1671
  DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
1676
- var DialogDescription = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1672
+ var DialogDescription = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1677
1673
  DialogPrimitive__namespace.Description,
1678
1674
  {
1679
1675
  ref,
@@ -1685,7 +1681,7 @@ DialogDescription.displayName = DialogPrimitive__namespace.Description.displayNa
1685
1681
  var AlertDialog = AlertDialogPrimitive__namespace.Root;
1686
1682
  var AlertDialogTrigger = AlertDialogPrimitive__namespace.Trigger;
1687
1683
  var AlertDialogPortal = AlertDialogPrimitive__namespace.Portal;
1688
- var AlertDialogOverlay = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1684
+ var AlertDialogOverlay = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1689
1685
  AlertDialogPrimitive__namespace.Overlay,
1690
1686
  {
1691
1687
  className: cn(
@@ -1697,8 +1693,8 @@ var AlertDialogOverlay = React8__namespace.forwardRef(({ className, ...props },
1697
1693
  }
1698
1694
  ));
1699
1695
  AlertDialogOverlay.displayName = AlertDialogPrimitive__namespace.Overlay.displayName;
1700
- var AlertDialogContent = React8__namespace.forwardRef(({ className, portal = false, ...props }, ref) => {
1701
- const Comp = portal ? AlertDialogPortal : React8__namespace.Fragment;
1696
+ var AlertDialogContent = React36__namespace.forwardRef(({ className, portal = false, ...props }, ref) => {
1697
+ const Comp = portal ? AlertDialogPortal : React36__namespace.Fragment;
1702
1698
  return /* @__PURE__ */ jsxRuntime.jsxs(Comp, { children: [
1703
1699
  /* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
1704
1700
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1734,7 +1730,7 @@ var AlertDialogFooter = ({
1734
1730
  ...props
1735
1731
  }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex gap-2", className), ...props });
1736
1732
  AlertDialogFooter.displayName = "AlertDialogFooter";
1737
- var AlertDialogTitle = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1733
+ var AlertDialogTitle = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1738
1734
  AlertDialogPrimitive__namespace.Title,
1739
1735
  {
1740
1736
  ref,
@@ -1746,7 +1742,7 @@ var AlertDialogTitle = React8__namespace.forwardRef(({ className, ...props }, re
1746
1742
  }
1747
1743
  ));
1748
1744
  AlertDialogTitle.displayName = AlertDialogPrimitive__namespace.Title.displayName;
1749
- var AlertDialogDescription = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1745
+ var AlertDialogDescription = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1750
1746
  AlertDialogPrimitive__namespace.Description,
1751
1747
  {
1752
1748
  ref,
@@ -1755,7 +1751,7 @@ var AlertDialogDescription = React8__namespace.forwardRef(({ className, ...props
1755
1751
  }
1756
1752
  ));
1757
1753
  AlertDialogDescription.displayName = AlertDialogPrimitive__namespace.Description.displayName;
1758
- var AlertDialogAction = React8__namespace.forwardRef(({ children, className, variant: variant3, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1754
+ var AlertDialogAction = React36__namespace.forwardRef(({ children, className, variant: variant3, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1759
1755
  AlertDialogPrimitive__namespace.Action,
1760
1756
  {
1761
1757
  ref,
@@ -1765,7 +1761,7 @@ var AlertDialogAction = React8__namespace.forwardRef(({ children, className, var
1765
1761
  }
1766
1762
  ));
1767
1763
  AlertDialogAction.displayName = AlertDialogPrimitive__namespace.Action.displayName;
1768
- var AlertDialogCancel = React8__namespace.forwardRef(({ children, className, variant: variant3 = "secondary", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1764
+ var AlertDialogCancel = React36__namespace.forwardRef(({ children, className, variant: variant3 = "secondary", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1769
1765
  AlertDialogPrimitive__namespace.Cancel,
1770
1766
  {
1771
1767
  ref,
@@ -1775,7 +1771,7 @@ var AlertDialogCancel = React8__namespace.forwardRef(({ children, className, var
1775
1771
  }
1776
1772
  ));
1777
1773
  AlertDialogCancel.displayName = AlertDialogPrimitive__namespace.Cancel.displayName;
1778
- var Checkbox = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1774
+ var Checkbox = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1779
1775
  CheckboxPrimitive__namespace.Root,
1780
1776
  {
1781
1777
  ref,
@@ -1830,7 +1826,7 @@ var Drawer = DialogPrimitive__namespace.Root;
1830
1826
  var DrawerTrigger = DialogPrimitive__namespace.Trigger;
1831
1827
  var DrawerClose = DialogPrimitive__namespace.Close;
1832
1828
  var DrawerPortal = DialogPrimitive__namespace.Portal;
1833
- var DrawerOverlay = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1829
+ var DrawerOverlay = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1834
1830
  DialogPrimitive__namespace.Overlay,
1835
1831
  {
1836
1832
  className: cn(
@@ -1858,8 +1854,8 @@ var DrawerVariants = classVarianceAuthority.cva(
1858
1854
  }
1859
1855
  }
1860
1856
  );
1861
- var DrawerContent = React8__namespace.forwardRef(({ side = "right", className, portal = false, children, ...props }, ref) => {
1862
- const Comp = portal ? DrawerPortal : React8__namespace.Fragment;
1857
+ var DrawerContent = React36__namespace.forwardRef(({ side = "right", className, portal = false, children, ...props }, ref) => {
1858
+ const Comp = portal ? DrawerPortal : React36__namespace.Fragment;
1863
1859
  return /* @__PURE__ */ jsxRuntime.jsxs(Comp, { children: [
1864
1860
  /* @__PURE__ */ jsxRuntime.jsx(DrawerOverlay, {}),
1865
1861
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1925,7 +1921,7 @@ var DrawerFooter = ({
1925
1921
  }
1926
1922
  );
1927
1923
  DrawerFooter.displayName = "DrawerFooter";
1928
- var DrawerTitle = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1924
+ var DrawerTitle = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1929
1925
  DialogPrimitive__namespace.Title,
1930
1926
  {
1931
1927
  ref,
@@ -1937,7 +1933,7 @@ var DrawerTitle = React8__namespace.forwardRef(({ className, ...props }, ref) =>
1937
1933
  }
1938
1934
  ));
1939
1935
  DrawerTitle.displayName = DialogPrimitive__namespace.Title.displayName;
1940
- var DrawerDescription = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1936
+ var DrawerDescription = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1941
1937
  DialogPrimitive__namespace.Description,
1942
1938
  {
1943
1939
  ref,
@@ -1946,9 +1942,9 @@ var DrawerDescription = React8__namespace.forwardRef(({ className, ...props }, r
1946
1942
  }
1947
1943
  ));
1948
1944
  DrawerDescription.displayName = DialogPrimitive__namespace.Description.displayName;
1949
- var Breadcrumb = React8__namespace.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("nav", { ref, "aria-label": "breadcrumb", ...props }));
1945
+ var Breadcrumb = React36__namespace.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("nav", { ref, "aria-label": "breadcrumb", ...props }));
1950
1946
  Breadcrumb.displayName = "Breadcrumb";
1951
- var BreadcrumbList = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1947
+ var BreadcrumbList = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1952
1948
  "ol",
1953
1949
  {
1954
1950
  ref,
@@ -1960,7 +1956,7 @@ var BreadcrumbList = React8__namespace.forwardRef(({ className, ...props }, ref)
1960
1956
  }
1961
1957
  ));
1962
1958
  BreadcrumbList.displayName = "BreadcrumbList";
1963
- var BreadcrumbItem = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1959
+ var BreadcrumbItem = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1964
1960
  "li",
1965
1961
  {
1966
1962
  ref,
@@ -1972,7 +1968,7 @@ var BreadcrumbItem = React8__namespace.forwardRef(({ className, ...props }, ref)
1972
1968
  }
1973
1969
  ));
1974
1970
  BreadcrumbItem.displayName = "BreadcrumbItem";
1975
- var BreadcrumbLink = React8__namespace.forwardRef(({ asChild, className, ...props }, ref) => {
1971
+ var BreadcrumbLink = React36__namespace.forwardRef(({ asChild, className, ...props }, ref) => {
1976
1972
  const Comp = asChild ? reactSlot.Slot : "a";
1977
1973
  return /* @__PURE__ */ jsxRuntime.jsx(
1978
1974
  Comp,
@@ -1987,7 +1983,7 @@ var BreadcrumbLink = React8__namespace.forwardRef(({ asChild, className, ...prop
1987
1983
  );
1988
1984
  });
1989
1985
  BreadcrumbLink.displayName = "BreadcrumbLink";
1990
- var BreadcrumbPage = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1986
+ var BreadcrumbPage = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1991
1987
  "span",
1992
1988
  {
1993
1989
  ref,
@@ -2034,7 +2030,7 @@ var BreadcrumbEllipsis = ({
2034
2030
  }
2035
2031
  );
2036
2032
  BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
2037
- var Switch = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2033
+ var Switch = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2038
2034
  SwitchPrimitives__namespace.Root,
2039
2035
  {
2040
2036
  className: cn(
@@ -2093,7 +2089,3274 @@ var Switch = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @
2093
2089
  }
2094
2090
  ));
2095
2091
  Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
2096
- var Tooltip = React8__namespace.forwardRef(
2092
+
2093
+ // ../../node_modules/@radix-ui/primitive/dist/index.mjs
2094
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
2095
+ return function handleEvent(event) {
2096
+ originalEventHandler?.(event);
2097
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
2098
+ return ourEventHandler?.(event);
2099
+ }
2100
+ };
2101
+ }
2102
+ function setRef(ref, value) {
2103
+ if (typeof ref === "function") {
2104
+ return ref(value);
2105
+ } else if (ref !== null && ref !== void 0) {
2106
+ ref.current = value;
2107
+ }
2108
+ }
2109
+ function composeRefs(...refs) {
2110
+ return (node) => {
2111
+ let hasCleanup = false;
2112
+ const cleanups = refs.map((ref) => {
2113
+ const cleanup = setRef(ref, node);
2114
+ if (!hasCleanup && typeof cleanup == "function") {
2115
+ hasCleanup = true;
2116
+ }
2117
+ return cleanup;
2118
+ });
2119
+ if (hasCleanup) {
2120
+ return () => {
2121
+ for (let i = 0; i < cleanups.length; i++) {
2122
+ const cleanup = cleanups[i];
2123
+ if (typeof cleanup == "function") {
2124
+ cleanup();
2125
+ } else {
2126
+ setRef(refs[i], null);
2127
+ }
2128
+ }
2129
+ };
2130
+ }
2131
+ };
2132
+ }
2133
+ function useComposedRefs(...refs) {
2134
+ return React36__namespace.useCallback(composeRefs(...refs), refs);
2135
+ }
2136
+ function createContextScope(scopeName, createContextScopeDeps = []) {
2137
+ let defaultContexts = [];
2138
+ function createContext32(rootComponentName, defaultContext) {
2139
+ const BaseContext = React36__namespace.createContext(defaultContext);
2140
+ const index2 = defaultContexts.length;
2141
+ defaultContexts = [...defaultContexts, defaultContext];
2142
+ const Provider2 = (props) => {
2143
+ const { scope, children, ...context } = props;
2144
+ const Context = scope?.[scopeName]?.[index2] || BaseContext;
2145
+ const value = React36__namespace.useMemo(() => context, Object.values(context));
2146
+ return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
2147
+ };
2148
+ Provider2.displayName = rootComponentName + "Provider";
2149
+ function useContext22(consumerName, scope) {
2150
+ const Context = scope?.[scopeName]?.[index2] || BaseContext;
2151
+ const context = React36__namespace.useContext(Context);
2152
+ if (context) return context;
2153
+ if (defaultContext !== void 0) return defaultContext;
2154
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
2155
+ }
2156
+ return [Provider2, useContext22];
2157
+ }
2158
+ const createScope = () => {
2159
+ const scopeContexts = defaultContexts.map((defaultContext) => {
2160
+ return React36__namespace.createContext(defaultContext);
2161
+ });
2162
+ return function useScope(scope) {
2163
+ const contexts = scope?.[scopeName] || scopeContexts;
2164
+ return React36__namespace.useMemo(
2165
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
2166
+ [scope, contexts]
2167
+ );
2168
+ };
2169
+ };
2170
+ createScope.scopeName = scopeName;
2171
+ return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
2172
+ }
2173
+ function composeContextScopes(...scopes) {
2174
+ const baseScope = scopes[0];
2175
+ if (scopes.length === 1) return baseScope;
2176
+ const createScope = () => {
2177
+ const scopeHooks = scopes.map((createScope2) => ({
2178
+ useScope: createScope2(),
2179
+ scopeName: createScope2.scopeName
2180
+ }));
2181
+ return function useComposedScopes(overrideScopes) {
2182
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
2183
+ const scopeProps = useScope(overrideScopes);
2184
+ const currentScope = scopeProps[`__scope${scopeName}`];
2185
+ return { ...nextScopes2, ...currentScope };
2186
+ }, {});
2187
+ return React36__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
2188
+ };
2189
+ };
2190
+ createScope.scopeName = baseScope.scopeName;
2191
+ return createScope;
2192
+ }
2193
+ var NODES = [
2194
+ "a",
2195
+ "button",
2196
+ "div",
2197
+ "form",
2198
+ "h2",
2199
+ "h3",
2200
+ "img",
2201
+ "input",
2202
+ "label",
2203
+ "li",
2204
+ "nav",
2205
+ "ol",
2206
+ "p",
2207
+ "select",
2208
+ "span",
2209
+ "svg",
2210
+ "ul"
2211
+ ];
2212
+ var Primitive = NODES.reduce((primitive, node) => {
2213
+ const Slot3 = reactSlot.createSlot(`Primitive.${node}`);
2214
+ const Node2 = React36__namespace.forwardRef((props, forwardedRef) => {
2215
+ const { asChild, ...primitiveProps } = props;
2216
+ const Comp = asChild ? Slot3 : node;
2217
+ if (typeof window !== "undefined") {
2218
+ window[Symbol.for("radix-ui")] = true;
2219
+ }
2220
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
2221
+ });
2222
+ Node2.displayName = `Primitive.${node}`;
2223
+ return { ...primitive, [node]: Node2 };
2224
+ }, {});
2225
+ function dispatchDiscreteCustomEvent(target, event) {
2226
+ if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
2227
+ }
2228
+ function useCallbackRef(callback) {
2229
+ const callbackRef = React36__namespace.useRef(callback);
2230
+ React36__namespace.useEffect(() => {
2231
+ callbackRef.current = callback;
2232
+ });
2233
+ return React36__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
2234
+ }
2235
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
2236
+ const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
2237
+ React36__namespace.useEffect(() => {
2238
+ const handleKeyDown = (event) => {
2239
+ if (event.key === "Escape") {
2240
+ onEscapeKeyDown(event);
2241
+ }
2242
+ };
2243
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
2244
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
2245
+ }, [onEscapeKeyDown, ownerDocument]);
2246
+ }
2247
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
2248
+ var CONTEXT_UPDATE = "dismissableLayer.update";
2249
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
2250
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
2251
+ var originalBodyPointerEvents;
2252
+ var DismissableLayerContext = React36__namespace.createContext({
2253
+ layers: /* @__PURE__ */ new Set(),
2254
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
2255
+ branches: /* @__PURE__ */ new Set()
2256
+ });
2257
+ var DismissableLayer = React36__namespace.forwardRef(
2258
+ (props, forwardedRef) => {
2259
+ const {
2260
+ disableOutsidePointerEvents = false,
2261
+ onEscapeKeyDown,
2262
+ onPointerDownOutside,
2263
+ onFocusOutside,
2264
+ onInteractOutside,
2265
+ onDismiss,
2266
+ ...layerProps
2267
+ } = props;
2268
+ const context = React36__namespace.useContext(DismissableLayerContext);
2269
+ const [node, setNode] = React36__namespace.useState(null);
2270
+ const ownerDocument = node?.ownerDocument ?? globalThis?.document;
2271
+ const [, force] = React36__namespace.useState({});
2272
+ const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
2273
+ const layers = Array.from(context.layers);
2274
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
2275
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
2276
+ const index2 = node ? layers.indexOf(node) : -1;
2277
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
2278
+ const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
2279
+ const pointerDownOutside = usePointerDownOutside((event) => {
2280
+ const target = event.target;
2281
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
2282
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
2283
+ onPointerDownOutside?.(event);
2284
+ onInteractOutside?.(event);
2285
+ if (!event.defaultPrevented) onDismiss?.();
2286
+ }, ownerDocument);
2287
+ const focusOutside = useFocusOutside((event) => {
2288
+ const target = event.target;
2289
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
2290
+ if (isFocusInBranch) return;
2291
+ onFocusOutside?.(event);
2292
+ onInteractOutside?.(event);
2293
+ if (!event.defaultPrevented) onDismiss?.();
2294
+ }, ownerDocument);
2295
+ useEscapeKeydown((event) => {
2296
+ const isHighestLayer = index2 === context.layers.size - 1;
2297
+ if (!isHighestLayer) return;
2298
+ onEscapeKeyDown?.(event);
2299
+ if (!event.defaultPrevented && onDismiss) {
2300
+ event.preventDefault();
2301
+ onDismiss();
2302
+ }
2303
+ }, ownerDocument);
2304
+ React36__namespace.useEffect(() => {
2305
+ if (!node) return;
2306
+ if (disableOutsidePointerEvents) {
2307
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
2308
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
2309
+ ownerDocument.body.style.pointerEvents = "none";
2310
+ }
2311
+ context.layersWithOutsidePointerEventsDisabled.add(node);
2312
+ }
2313
+ context.layers.add(node);
2314
+ dispatchUpdate();
2315
+ return () => {
2316
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
2317
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
2318
+ }
2319
+ };
2320
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
2321
+ React36__namespace.useEffect(() => {
2322
+ return () => {
2323
+ if (!node) return;
2324
+ context.layers.delete(node);
2325
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
2326
+ dispatchUpdate();
2327
+ };
2328
+ }, [node, context]);
2329
+ React36__namespace.useEffect(() => {
2330
+ const handleUpdate = () => force({});
2331
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
2332
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
2333
+ }, []);
2334
+ return /* @__PURE__ */ jsxRuntime.jsx(
2335
+ Primitive.div,
2336
+ {
2337
+ ...layerProps,
2338
+ ref: composedRefs,
2339
+ style: {
2340
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
2341
+ ...props.style
2342
+ },
2343
+ onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
2344
+ onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
2345
+ onPointerDownCapture: composeEventHandlers(
2346
+ props.onPointerDownCapture,
2347
+ pointerDownOutside.onPointerDownCapture
2348
+ )
2349
+ }
2350
+ );
2351
+ }
2352
+ );
2353
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
2354
+ var BRANCH_NAME = "DismissableLayerBranch";
2355
+ var DismissableLayerBranch = React36__namespace.forwardRef((props, forwardedRef) => {
2356
+ const context = React36__namespace.useContext(DismissableLayerContext);
2357
+ const ref = React36__namespace.useRef(null);
2358
+ const composedRefs = useComposedRefs(forwardedRef, ref);
2359
+ React36__namespace.useEffect(() => {
2360
+ const node = ref.current;
2361
+ if (node) {
2362
+ context.branches.add(node);
2363
+ return () => {
2364
+ context.branches.delete(node);
2365
+ };
2366
+ }
2367
+ }, [context.branches]);
2368
+ return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
2369
+ });
2370
+ DismissableLayerBranch.displayName = BRANCH_NAME;
2371
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
2372
+ const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
2373
+ const isPointerInsideReactTreeRef = React36__namespace.useRef(false);
2374
+ const handleClickRef = React36__namespace.useRef(() => {
2375
+ });
2376
+ React36__namespace.useEffect(() => {
2377
+ const handlePointerDown = (event) => {
2378
+ if (event.target && !isPointerInsideReactTreeRef.current) {
2379
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
2380
+ handleAndDispatchCustomEvent(
2381
+ POINTER_DOWN_OUTSIDE,
2382
+ handlePointerDownOutside,
2383
+ eventDetail,
2384
+ { discrete: true }
2385
+ );
2386
+ };
2387
+ const eventDetail = { originalEvent: event };
2388
+ if (event.pointerType === "touch") {
2389
+ ownerDocument.removeEventListener("click", handleClickRef.current);
2390
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
2391
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
2392
+ } else {
2393
+ handleAndDispatchPointerDownOutsideEvent2();
2394
+ }
2395
+ } else {
2396
+ ownerDocument.removeEventListener("click", handleClickRef.current);
2397
+ }
2398
+ isPointerInsideReactTreeRef.current = false;
2399
+ };
2400
+ const timerId = window.setTimeout(() => {
2401
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
2402
+ }, 0);
2403
+ return () => {
2404
+ window.clearTimeout(timerId);
2405
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
2406
+ ownerDocument.removeEventListener("click", handleClickRef.current);
2407
+ };
2408
+ }, [ownerDocument, handlePointerDownOutside]);
2409
+ return {
2410
+ // ensures we check React component tree (not just DOM tree)
2411
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
2412
+ };
2413
+ }
2414
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
2415
+ const handleFocusOutside = useCallbackRef(onFocusOutside);
2416
+ const isFocusInsideReactTreeRef = React36__namespace.useRef(false);
2417
+ React36__namespace.useEffect(() => {
2418
+ const handleFocus = (event) => {
2419
+ if (event.target && !isFocusInsideReactTreeRef.current) {
2420
+ const eventDetail = { originalEvent: event };
2421
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
2422
+ discrete: false
2423
+ });
2424
+ }
2425
+ };
2426
+ ownerDocument.addEventListener("focusin", handleFocus);
2427
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
2428
+ }, [ownerDocument, handleFocusOutside]);
2429
+ return {
2430
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
2431
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
2432
+ };
2433
+ }
2434
+ function dispatchUpdate() {
2435
+ const event = new CustomEvent(CONTEXT_UPDATE);
2436
+ document.dispatchEvent(event);
2437
+ }
2438
+ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
2439
+ const target = detail.originalEvent.target;
2440
+ const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
2441
+ if (handler) target.addEventListener(name, handler, { once: true });
2442
+ if (discrete) {
2443
+ dispatchDiscreteCustomEvent(target, event);
2444
+ } else {
2445
+ target.dispatchEvent(event);
2446
+ }
2447
+ }
2448
+ var useLayoutEffect2 = globalThis?.document ? React36__namespace.useLayoutEffect : () => {
2449
+ };
2450
+
2451
+ // ../../node_modules/@radix-ui/react-id/dist/index.mjs
2452
+ var useReactId = React36__namespace[" useId ".trim().toString()] || (() => void 0);
2453
+ var count = 0;
2454
+ function useId(deterministicId) {
2455
+ const [id, setId] = React36__namespace.useState(useReactId());
2456
+ useLayoutEffect2(() => {
2457
+ setId((reactId) => reactId ?? String(count++));
2458
+ }, [deterministicId]);
2459
+ return (id ? `radix-${id}` : "");
2460
+ }
2461
+
2462
+ // ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2463
+ var sides = ["top", "right", "bottom", "left"];
2464
+ var min = Math.min;
2465
+ var max = Math.max;
2466
+ var round = Math.round;
2467
+ var floor = Math.floor;
2468
+ var createCoords = (v) => ({
2469
+ x: v,
2470
+ y: v
2471
+ });
2472
+ var oppositeSideMap = {
2473
+ left: "right",
2474
+ right: "left",
2475
+ bottom: "top",
2476
+ top: "bottom"
2477
+ };
2478
+ var oppositeAlignmentMap = {
2479
+ start: "end",
2480
+ end: "start"
2481
+ };
2482
+ function clamp(start, value, end) {
2483
+ return max(start, min(value, end));
2484
+ }
2485
+ function evaluate(value, param) {
2486
+ return typeof value === "function" ? value(param) : value;
2487
+ }
2488
+ function getSide(placement) {
2489
+ return placement.split("-")[0];
2490
+ }
2491
+ function getAlignment(placement) {
2492
+ return placement.split("-")[1];
2493
+ }
2494
+ function getOppositeAxis(axis) {
2495
+ return axis === "x" ? "y" : "x";
2496
+ }
2497
+ function getAxisLength(axis) {
2498
+ return axis === "y" ? "height" : "width";
2499
+ }
2500
+ function getSideAxis(placement) {
2501
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
2502
+ }
2503
+ function getAlignmentAxis(placement) {
2504
+ return getOppositeAxis(getSideAxis(placement));
2505
+ }
2506
+ function getAlignmentSides(placement, rects, rtl) {
2507
+ if (rtl === void 0) {
2508
+ rtl = false;
2509
+ }
2510
+ const alignment = getAlignment(placement);
2511
+ const alignmentAxis = getAlignmentAxis(placement);
2512
+ const length = getAxisLength(alignmentAxis);
2513
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
2514
+ if (rects.reference[length] > rects.floating[length]) {
2515
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2516
+ }
2517
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2518
+ }
2519
+ function getExpandedPlacements(placement) {
2520
+ const oppositePlacement = getOppositePlacement(placement);
2521
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2522
+ }
2523
+ function getOppositeAlignmentPlacement(placement) {
2524
+ return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
2525
+ }
2526
+ function getSideList(side, isStart, rtl) {
2527
+ const lr = ["left", "right"];
2528
+ const rl = ["right", "left"];
2529
+ const tb = ["top", "bottom"];
2530
+ const bt = ["bottom", "top"];
2531
+ switch (side) {
2532
+ case "top":
2533
+ case "bottom":
2534
+ if (rtl) return isStart ? rl : lr;
2535
+ return isStart ? lr : rl;
2536
+ case "left":
2537
+ case "right":
2538
+ return isStart ? tb : bt;
2539
+ default:
2540
+ return [];
2541
+ }
2542
+ }
2543
+ function getOppositeAxisPlacements(placement, flipAlignment, direction2, rtl) {
2544
+ const alignment = getAlignment(placement);
2545
+ let list = getSideList(getSide(placement), direction2 === "start", rtl);
2546
+ if (alignment) {
2547
+ list = list.map((side) => side + "-" + alignment);
2548
+ if (flipAlignment) {
2549
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
2550
+ }
2551
+ }
2552
+ return list;
2553
+ }
2554
+ function getOppositePlacement(placement) {
2555
+ return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
2556
+ }
2557
+ function expandPaddingObject(padding) {
2558
+ return {
2559
+ top: 0,
2560
+ right: 0,
2561
+ bottom: 0,
2562
+ left: 0,
2563
+ ...padding
2564
+ };
2565
+ }
2566
+ function getPaddingObject(padding) {
2567
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
2568
+ top: padding,
2569
+ right: padding,
2570
+ bottom: padding,
2571
+ left: padding
2572
+ };
2573
+ }
2574
+ function rectToClientRect(rect) {
2575
+ const {
2576
+ x,
2577
+ y,
2578
+ width,
2579
+ height
2580
+ } = rect;
2581
+ return {
2582
+ width,
2583
+ height,
2584
+ top: y,
2585
+ left: x,
2586
+ right: x + width,
2587
+ bottom: y + height,
2588
+ x,
2589
+ y
2590
+ };
2591
+ }
2592
+
2593
+ // ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs
2594
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
2595
+ let {
2596
+ reference,
2597
+ floating
2598
+ } = _ref;
2599
+ const sideAxis = getSideAxis(placement);
2600
+ const alignmentAxis = getAlignmentAxis(placement);
2601
+ const alignLength = getAxisLength(alignmentAxis);
2602
+ const side = getSide(placement);
2603
+ const isVertical = sideAxis === "y";
2604
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
2605
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
2606
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
2607
+ let coords;
2608
+ switch (side) {
2609
+ case "top":
2610
+ coords = {
2611
+ x: commonX,
2612
+ y: reference.y - floating.height
2613
+ };
2614
+ break;
2615
+ case "bottom":
2616
+ coords = {
2617
+ x: commonX,
2618
+ y: reference.y + reference.height
2619
+ };
2620
+ break;
2621
+ case "right":
2622
+ coords = {
2623
+ x: reference.x + reference.width,
2624
+ y: commonY
2625
+ };
2626
+ break;
2627
+ case "left":
2628
+ coords = {
2629
+ x: reference.x - floating.width,
2630
+ y: commonY
2631
+ };
2632
+ break;
2633
+ default:
2634
+ coords = {
2635
+ x: reference.x,
2636
+ y: reference.y
2637
+ };
2638
+ }
2639
+ switch (getAlignment(placement)) {
2640
+ case "start":
2641
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
2642
+ break;
2643
+ case "end":
2644
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
2645
+ break;
2646
+ }
2647
+ return coords;
2648
+ }
2649
+ var computePosition = async (reference, floating, config) => {
2650
+ const {
2651
+ placement = "bottom",
2652
+ strategy = "absolute",
2653
+ middleware = [],
2654
+ platform: platform2
2655
+ } = config;
2656
+ const validMiddleware = middleware.filter(Boolean);
2657
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
2658
+ let rects = await platform2.getElementRects({
2659
+ reference,
2660
+ floating,
2661
+ strategy
2662
+ });
2663
+ let {
2664
+ x,
2665
+ y
2666
+ } = computeCoordsFromPlacement(rects, placement, rtl);
2667
+ let statefulPlacement = placement;
2668
+ let middlewareData = {};
2669
+ let resetCount = 0;
2670
+ for (let i = 0; i < validMiddleware.length; i++) {
2671
+ const {
2672
+ name,
2673
+ fn
2674
+ } = validMiddleware[i];
2675
+ const {
2676
+ x: nextX,
2677
+ y: nextY,
2678
+ data,
2679
+ reset
2680
+ } = await fn({
2681
+ x,
2682
+ y,
2683
+ initialPlacement: placement,
2684
+ placement: statefulPlacement,
2685
+ strategy,
2686
+ middlewareData,
2687
+ rects,
2688
+ platform: platform2,
2689
+ elements: {
2690
+ reference,
2691
+ floating
2692
+ }
2693
+ });
2694
+ x = nextX != null ? nextX : x;
2695
+ y = nextY != null ? nextY : y;
2696
+ middlewareData = {
2697
+ ...middlewareData,
2698
+ [name]: {
2699
+ ...middlewareData[name],
2700
+ ...data
2701
+ }
2702
+ };
2703
+ if (reset && resetCount <= 50) {
2704
+ resetCount++;
2705
+ if (typeof reset === "object") {
2706
+ if (reset.placement) {
2707
+ statefulPlacement = reset.placement;
2708
+ }
2709
+ if (reset.rects) {
2710
+ rects = reset.rects === true ? await platform2.getElementRects({
2711
+ reference,
2712
+ floating,
2713
+ strategy
2714
+ }) : reset.rects;
2715
+ }
2716
+ ({
2717
+ x,
2718
+ y
2719
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
2720
+ }
2721
+ i = -1;
2722
+ }
2723
+ }
2724
+ return {
2725
+ x,
2726
+ y,
2727
+ placement: statefulPlacement,
2728
+ strategy,
2729
+ middlewareData
2730
+ };
2731
+ };
2732
+ async function detectOverflow(state, options) {
2733
+ var _await$platform$isEle;
2734
+ if (options === void 0) {
2735
+ options = {};
2736
+ }
2737
+ const {
2738
+ x,
2739
+ y,
2740
+ platform: platform2,
2741
+ rects,
2742
+ elements,
2743
+ strategy
2744
+ } = state;
2745
+ const {
2746
+ boundary = "clippingAncestors",
2747
+ rootBoundary = "viewport",
2748
+ elementContext = "floating",
2749
+ altBoundary = false,
2750
+ padding = 0
2751
+ } = evaluate(options, state);
2752
+ const paddingObject = getPaddingObject(padding);
2753
+ const altContext = elementContext === "floating" ? "reference" : "floating";
2754
+ const element = elements[altBoundary ? altContext : elementContext];
2755
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
2756
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
2757
+ boundary,
2758
+ rootBoundary,
2759
+ strategy
2760
+ }));
2761
+ const rect = elementContext === "floating" ? {
2762
+ x,
2763
+ y,
2764
+ width: rects.floating.width,
2765
+ height: rects.floating.height
2766
+ } : rects.reference;
2767
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
2768
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
2769
+ x: 1,
2770
+ y: 1
2771
+ } : {
2772
+ x: 1,
2773
+ y: 1
2774
+ };
2775
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
2776
+ elements,
2777
+ rect,
2778
+ offsetParent,
2779
+ strategy
2780
+ }) : rect);
2781
+ return {
2782
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
2783
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
2784
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
2785
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
2786
+ };
2787
+ }
2788
+ var arrow = (options) => ({
2789
+ name: "arrow",
2790
+ options,
2791
+ async fn(state) {
2792
+ const {
2793
+ x,
2794
+ y,
2795
+ placement,
2796
+ rects,
2797
+ platform: platform2,
2798
+ elements,
2799
+ middlewareData
2800
+ } = state;
2801
+ const {
2802
+ element,
2803
+ padding = 0
2804
+ } = evaluate(options, state) || {};
2805
+ if (element == null) {
2806
+ return {};
2807
+ }
2808
+ const paddingObject = getPaddingObject(padding);
2809
+ const coords = {
2810
+ x,
2811
+ y
2812
+ };
2813
+ const axis = getAlignmentAxis(placement);
2814
+ const length = getAxisLength(axis);
2815
+ const arrowDimensions = await platform2.getDimensions(element);
2816
+ const isYAxis = axis === "y";
2817
+ const minProp = isYAxis ? "top" : "left";
2818
+ const maxProp = isYAxis ? "bottom" : "right";
2819
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
2820
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
2821
+ const startDiff = coords[axis] - rects.reference[axis];
2822
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
2823
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
2824
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
2825
+ clientSize = elements.floating[clientProp] || rects.floating[length];
2826
+ }
2827
+ const centerToReference = endDiff / 2 - startDiff / 2;
2828
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
2829
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
2830
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
2831
+ const min$1 = minPadding;
2832
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
2833
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
2834
+ const offset4 = clamp(min$1, center, max2);
2835
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
2836
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
2837
+ return {
2838
+ [axis]: coords[axis] + alignmentOffset,
2839
+ data: {
2840
+ [axis]: offset4,
2841
+ centerOffset: center - offset4 - alignmentOffset,
2842
+ ...shouldAddOffset && {
2843
+ alignmentOffset
2844
+ }
2845
+ },
2846
+ reset: shouldAddOffset
2847
+ };
2848
+ }
2849
+ });
2850
+ var flip = function(options) {
2851
+ if (options === void 0) {
2852
+ options = {};
2853
+ }
2854
+ return {
2855
+ name: "flip",
2856
+ options,
2857
+ async fn(state) {
2858
+ var _middlewareData$arrow, _middlewareData$flip;
2859
+ const {
2860
+ placement,
2861
+ middlewareData,
2862
+ rects,
2863
+ initialPlacement,
2864
+ platform: platform2,
2865
+ elements
2866
+ } = state;
2867
+ const {
2868
+ mainAxis: checkMainAxis = true,
2869
+ crossAxis: checkCrossAxis = true,
2870
+ fallbackPlacements: specifiedFallbackPlacements,
2871
+ fallbackStrategy = "bestFit",
2872
+ fallbackAxisSideDirection = "none",
2873
+ flipAlignment = true,
2874
+ ...detectOverflowOptions
2875
+ } = evaluate(options, state);
2876
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
2877
+ return {};
2878
+ }
2879
+ const side = getSide(placement);
2880
+ const initialSideAxis = getSideAxis(initialPlacement);
2881
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
2882
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
2883
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
2884
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
2885
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
2886
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
2887
+ }
2888
+ const placements2 = [initialPlacement, ...fallbackPlacements];
2889
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2890
+ const overflows = [];
2891
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
2892
+ if (checkMainAxis) {
2893
+ overflows.push(overflow[side]);
2894
+ }
2895
+ if (checkCrossAxis) {
2896
+ const sides2 = getAlignmentSides(placement, rects, rtl);
2897
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
2898
+ }
2899
+ overflowsData = [...overflowsData, {
2900
+ placement,
2901
+ overflows
2902
+ }];
2903
+ if (!overflows.every((side2) => side2 <= 0)) {
2904
+ var _middlewareData$flip2, _overflowsData$filter;
2905
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
2906
+ const nextPlacement = placements2[nextIndex];
2907
+ if (nextPlacement) {
2908
+ return {
2909
+ data: {
2910
+ index: nextIndex,
2911
+ overflows: overflowsData
2912
+ },
2913
+ reset: {
2914
+ placement: nextPlacement
2915
+ }
2916
+ };
2917
+ }
2918
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
2919
+ if (!resetPlacement) {
2920
+ switch (fallbackStrategy) {
2921
+ case "bestFit": {
2922
+ var _overflowsData$filter2;
2923
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
2924
+ if (hasFallbackAxisSideDirection) {
2925
+ const currentSideAxis = getSideAxis(d.placement);
2926
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
2927
+ // reading directions favoring greater width.
2928
+ currentSideAxis === "y";
2929
+ }
2930
+ return true;
2931
+ }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
2932
+ if (placement2) {
2933
+ resetPlacement = placement2;
2934
+ }
2935
+ break;
2936
+ }
2937
+ case "initialPlacement":
2938
+ resetPlacement = initialPlacement;
2939
+ break;
2940
+ }
2941
+ }
2942
+ if (placement !== resetPlacement) {
2943
+ return {
2944
+ reset: {
2945
+ placement: resetPlacement
2946
+ }
2947
+ };
2948
+ }
2949
+ }
2950
+ return {};
2951
+ }
2952
+ };
2953
+ };
2954
+ function getSideOffsets(overflow, rect) {
2955
+ return {
2956
+ top: overflow.top - rect.height,
2957
+ right: overflow.right - rect.width,
2958
+ bottom: overflow.bottom - rect.height,
2959
+ left: overflow.left - rect.width
2960
+ };
2961
+ }
2962
+ function isAnySideFullyClipped(overflow) {
2963
+ return sides.some((side) => overflow[side] >= 0);
2964
+ }
2965
+ var hide = function(options) {
2966
+ if (options === void 0) {
2967
+ options = {};
2968
+ }
2969
+ return {
2970
+ name: "hide",
2971
+ options,
2972
+ async fn(state) {
2973
+ const {
2974
+ rects
2975
+ } = state;
2976
+ const {
2977
+ strategy = "referenceHidden",
2978
+ ...detectOverflowOptions
2979
+ } = evaluate(options, state);
2980
+ switch (strategy) {
2981
+ case "referenceHidden": {
2982
+ const overflow = await detectOverflow(state, {
2983
+ ...detectOverflowOptions,
2984
+ elementContext: "reference"
2985
+ });
2986
+ const offsets = getSideOffsets(overflow, rects.reference);
2987
+ return {
2988
+ data: {
2989
+ referenceHiddenOffsets: offsets,
2990
+ referenceHidden: isAnySideFullyClipped(offsets)
2991
+ }
2992
+ };
2993
+ }
2994
+ case "escaped": {
2995
+ const overflow = await detectOverflow(state, {
2996
+ ...detectOverflowOptions,
2997
+ altBoundary: true
2998
+ });
2999
+ const offsets = getSideOffsets(overflow, rects.floating);
3000
+ return {
3001
+ data: {
3002
+ escapedOffsets: offsets,
3003
+ escaped: isAnySideFullyClipped(offsets)
3004
+ }
3005
+ };
3006
+ }
3007
+ default: {
3008
+ return {};
3009
+ }
3010
+ }
3011
+ }
3012
+ };
3013
+ };
3014
+ async function convertValueToCoords(state, options) {
3015
+ const {
3016
+ placement,
3017
+ platform: platform2,
3018
+ elements
3019
+ } = state;
3020
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
3021
+ const side = getSide(placement);
3022
+ const alignment = getAlignment(placement);
3023
+ const isVertical = getSideAxis(placement) === "y";
3024
+ const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
3025
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
3026
+ const rawValue = evaluate(options, state);
3027
+ let {
3028
+ mainAxis,
3029
+ crossAxis,
3030
+ alignmentAxis
3031
+ } = typeof rawValue === "number" ? {
3032
+ mainAxis: rawValue,
3033
+ crossAxis: 0,
3034
+ alignmentAxis: null
3035
+ } : {
3036
+ mainAxis: rawValue.mainAxis || 0,
3037
+ crossAxis: rawValue.crossAxis || 0,
3038
+ alignmentAxis: rawValue.alignmentAxis
3039
+ };
3040
+ if (alignment && typeof alignmentAxis === "number") {
3041
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
3042
+ }
3043
+ return isVertical ? {
3044
+ x: crossAxis * crossAxisMulti,
3045
+ y: mainAxis * mainAxisMulti
3046
+ } : {
3047
+ x: mainAxis * mainAxisMulti,
3048
+ y: crossAxis * crossAxisMulti
3049
+ };
3050
+ }
3051
+ var offset = function(options) {
3052
+ if (options === void 0) {
3053
+ options = 0;
3054
+ }
3055
+ return {
3056
+ name: "offset",
3057
+ options,
3058
+ async fn(state) {
3059
+ var _middlewareData$offse, _middlewareData$arrow;
3060
+ const {
3061
+ x,
3062
+ y,
3063
+ placement,
3064
+ middlewareData
3065
+ } = state;
3066
+ const diffCoords = await convertValueToCoords(state, options);
3067
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3068
+ return {};
3069
+ }
3070
+ return {
3071
+ x: x + diffCoords.x,
3072
+ y: y + diffCoords.y,
3073
+ data: {
3074
+ ...diffCoords,
3075
+ placement
3076
+ }
3077
+ };
3078
+ }
3079
+ };
3080
+ };
3081
+ var shift = function(options) {
3082
+ if (options === void 0) {
3083
+ options = {};
3084
+ }
3085
+ return {
3086
+ name: "shift",
3087
+ options,
3088
+ async fn(state) {
3089
+ const {
3090
+ x,
3091
+ y,
3092
+ placement
3093
+ } = state;
3094
+ const {
3095
+ mainAxis: checkMainAxis = true,
3096
+ crossAxis: checkCrossAxis = false,
3097
+ limiter = {
3098
+ fn: (_ref) => {
3099
+ let {
3100
+ x: x2,
3101
+ y: y2
3102
+ } = _ref;
3103
+ return {
3104
+ x: x2,
3105
+ y: y2
3106
+ };
3107
+ }
3108
+ },
3109
+ ...detectOverflowOptions
3110
+ } = evaluate(options, state);
3111
+ const coords = {
3112
+ x,
3113
+ y
3114
+ };
3115
+ const overflow = await detectOverflow(state, detectOverflowOptions);
3116
+ const crossAxis = getSideAxis(getSide(placement));
3117
+ const mainAxis = getOppositeAxis(crossAxis);
3118
+ let mainAxisCoord = coords[mainAxis];
3119
+ let crossAxisCoord = coords[crossAxis];
3120
+ if (checkMainAxis) {
3121
+ const minSide = mainAxis === "y" ? "top" : "left";
3122
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
3123
+ const min2 = mainAxisCoord + overflow[minSide];
3124
+ const max2 = mainAxisCoord - overflow[maxSide];
3125
+ mainAxisCoord = clamp(min2, mainAxisCoord, max2);
3126
+ }
3127
+ if (checkCrossAxis) {
3128
+ const minSide = crossAxis === "y" ? "top" : "left";
3129
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
3130
+ const min2 = crossAxisCoord + overflow[minSide];
3131
+ const max2 = crossAxisCoord - overflow[maxSide];
3132
+ crossAxisCoord = clamp(min2, crossAxisCoord, max2);
3133
+ }
3134
+ const limitedCoords = limiter.fn({
3135
+ ...state,
3136
+ [mainAxis]: mainAxisCoord,
3137
+ [crossAxis]: crossAxisCoord
3138
+ });
3139
+ return {
3140
+ ...limitedCoords,
3141
+ data: {
3142
+ x: limitedCoords.x - x,
3143
+ y: limitedCoords.y - y,
3144
+ enabled: {
3145
+ [mainAxis]: checkMainAxis,
3146
+ [crossAxis]: checkCrossAxis
3147
+ }
3148
+ }
3149
+ };
3150
+ }
3151
+ };
3152
+ };
3153
+ var limitShift = function(options) {
3154
+ if (options === void 0) {
3155
+ options = {};
3156
+ }
3157
+ return {
3158
+ options,
3159
+ fn(state) {
3160
+ const {
3161
+ x,
3162
+ y,
3163
+ placement,
3164
+ rects,
3165
+ middlewareData
3166
+ } = state;
3167
+ const {
3168
+ offset: offset4 = 0,
3169
+ mainAxis: checkMainAxis = true,
3170
+ crossAxis: checkCrossAxis = true
3171
+ } = evaluate(options, state);
3172
+ const coords = {
3173
+ x,
3174
+ y
3175
+ };
3176
+ const crossAxis = getSideAxis(placement);
3177
+ const mainAxis = getOppositeAxis(crossAxis);
3178
+ let mainAxisCoord = coords[mainAxis];
3179
+ let crossAxisCoord = coords[crossAxis];
3180
+ const rawOffset = evaluate(offset4, state);
3181
+ const computedOffset = typeof rawOffset === "number" ? {
3182
+ mainAxis: rawOffset,
3183
+ crossAxis: 0
3184
+ } : {
3185
+ mainAxis: 0,
3186
+ crossAxis: 0,
3187
+ ...rawOffset
3188
+ };
3189
+ if (checkMainAxis) {
3190
+ const len = mainAxis === "y" ? "height" : "width";
3191
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
3192
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
3193
+ if (mainAxisCoord < limitMin) {
3194
+ mainAxisCoord = limitMin;
3195
+ } else if (mainAxisCoord > limitMax) {
3196
+ mainAxisCoord = limitMax;
3197
+ }
3198
+ }
3199
+ if (checkCrossAxis) {
3200
+ var _middlewareData$offse, _middlewareData$offse2;
3201
+ const len = mainAxis === "y" ? "width" : "height";
3202
+ const isOriginSide = ["top", "left"].includes(getSide(placement));
3203
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
3204
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
3205
+ if (crossAxisCoord < limitMin) {
3206
+ crossAxisCoord = limitMin;
3207
+ } else if (crossAxisCoord > limitMax) {
3208
+ crossAxisCoord = limitMax;
3209
+ }
3210
+ }
3211
+ return {
3212
+ [mainAxis]: mainAxisCoord,
3213
+ [crossAxis]: crossAxisCoord
3214
+ };
3215
+ }
3216
+ };
3217
+ };
3218
+ var size4 = function(options) {
3219
+ if (options === void 0) {
3220
+ options = {};
3221
+ }
3222
+ return {
3223
+ name: "size",
3224
+ options,
3225
+ async fn(state) {
3226
+ var _state$middlewareData, _state$middlewareData2;
3227
+ const {
3228
+ placement,
3229
+ rects,
3230
+ platform: platform2,
3231
+ elements
3232
+ } = state;
3233
+ const {
3234
+ apply = () => {
3235
+ },
3236
+ ...detectOverflowOptions
3237
+ } = evaluate(options, state);
3238
+ const overflow = await detectOverflow(state, detectOverflowOptions);
3239
+ const side = getSide(placement);
3240
+ const alignment = getAlignment(placement);
3241
+ const isYAxis = getSideAxis(placement) === "y";
3242
+ const {
3243
+ width,
3244
+ height
3245
+ } = rects.floating;
3246
+ let heightSide;
3247
+ let widthSide;
3248
+ if (side === "top" || side === "bottom") {
3249
+ heightSide = side;
3250
+ widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
3251
+ } else {
3252
+ widthSide = side;
3253
+ heightSide = alignment === "end" ? "top" : "bottom";
3254
+ }
3255
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
3256
+ const maximumClippingWidth = width - overflow.left - overflow.right;
3257
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
3258
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
3259
+ const noShift = !state.middlewareData.shift;
3260
+ let availableHeight = overflowAvailableHeight;
3261
+ let availableWidth = overflowAvailableWidth;
3262
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
3263
+ availableWidth = maximumClippingWidth;
3264
+ }
3265
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
3266
+ availableHeight = maximumClippingHeight;
3267
+ }
3268
+ if (noShift && !alignment) {
3269
+ const xMin = max(overflow.left, 0);
3270
+ const xMax = max(overflow.right, 0);
3271
+ const yMin = max(overflow.top, 0);
3272
+ const yMax = max(overflow.bottom, 0);
3273
+ if (isYAxis) {
3274
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
3275
+ } else {
3276
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
3277
+ }
3278
+ }
3279
+ await apply({
3280
+ ...state,
3281
+ availableWidth,
3282
+ availableHeight
3283
+ });
3284
+ const nextDimensions = await platform2.getDimensions(elements.floating);
3285
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
3286
+ return {
3287
+ reset: {
3288
+ rects: true
3289
+ }
3290
+ };
3291
+ }
3292
+ return {};
3293
+ }
3294
+ };
3295
+ };
3296
+
3297
+ // ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
3298
+ function hasWindow() {
3299
+ return typeof window !== "undefined";
3300
+ }
3301
+ function getNodeName(node) {
3302
+ if (isNode(node)) {
3303
+ return (node.nodeName || "").toLowerCase();
3304
+ }
3305
+ return "#document";
3306
+ }
3307
+ function getWindow(node) {
3308
+ var _node$ownerDocument;
3309
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
3310
+ }
3311
+ function getDocumentElement(node) {
3312
+ var _ref;
3313
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
3314
+ }
3315
+ function isNode(value) {
3316
+ if (!hasWindow()) {
3317
+ return false;
3318
+ }
3319
+ return value instanceof Node || value instanceof getWindow(value).Node;
3320
+ }
3321
+ function isElement(value) {
3322
+ if (!hasWindow()) {
3323
+ return false;
3324
+ }
3325
+ return value instanceof Element || value instanceof getWindow(value).Element;
3326
+ }
3327
+ function isHTMLElement(value) {
3328
+ if (!hasWindow()) {
3329
+ return false;
3330
+ }
3331
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
3332
+ }
3333
+ function isShadowRoot(value) {
3334
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
3335
+ return false;
3336
+ }
3337
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
3338
+ }
3339
+ function isOverflowElement(element) {
3340
+ const {
3341
+ overflow,
3342
+ overflowX,
3343
+ overflowY,
3344
+ display
3345
+ } = getComputedStyle2(element);
3346
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
3347
+ }
3348
+ function isTableElement(element) {
3349
+ return ["table", "td", "th"].includes(getNodeName(element));
3350
+ }
3351
+ function isTopLayer(element) {
3352
+ return [":popover-open", ":modal"].some((selector) => {
3353
+ try {
3354
+ return element.matches(selector);
3355
+ } catch (e) {
3356
+ return false;
3357
+ }
3358
+ });
3359
+ }
3360
+ function isContainingBlock(elementOrCss) {
3361
+ const webkit = isWebKit();
3362
+ const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
3363
+ return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
3364
+ }
3365
+ function getContainingBlock(element) {
3366
+ let currentNode = getParentNode(element);
3367
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
3368
+ if (isContainingBlock(currentNode)) {
3369
+ return currentNode;
3370
+ } else if (isTopLayer(currentNode)) {
3371
+ return null;
3372
+ }
3373
+ currentNode = getParentNode(currentNode);
3374
+ }
3375
+ return null;
3376
+ }
3377
+ function isWebKit() {
3378
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
3379
+ return CSS.supports("-webkit-backdrop-filter", "none");
3380
+ }
3381
+ function isLastTraversableNode(node) {
3382
+ return ["html", "body", "#document"].includes(getNodeName(node));
3383
+ }
3384
+ function getComputedStyle2(element) {
3385
+ return getWindow(element).getComputedStyle(element);
3386
+ }
3387
+ function getNodeScroll(element) {
3388
+ if (isElement(element)) {
3389
+ return {
3390
+ scrollLeft: element.scrollLeft,
3391
+ scrollTop: element.scrollTop
3392
+ };
3393
+ }
3394
+ return {
3395
+ scrollLeft: element.scrollX,
3396
+ scrollTop: element.scrollY
3397
+ };
3398
+ }
3399
+ function getParentNode(node) {
3400
+ if (getNodeName(node) === "html") {
3401
+ return node;
3402
+ }
3403
+ const result = (
3404
+ // Step into the shadow DOM of the parent of a slotted node.
3405
+ node.assignedSlot || // DOM Element detected.
3406
+ node.parentNode || // ShadowRoot detected.
3407
+ isShadowRoot(node) && node.host || // Fallback.
3408
+ getDocumentElement(node)
3409
+ );
3410
+ return isShadowRoot(result) ? result.host : result;
3411
+ }
3412
+ function getNearestOverflowAncestor(node) {
3413
+ const parentNode = getParentNode(node);
3414
+ if (isLastTraversableNode(parentNode)) {
3415
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
3416
+ }
3417
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
3418
+ return parentNode;
3419
+ }
3420
+ return getNearestOverflowAncestor(parentNode);
3421
+ }
3422
+ function getOverflowAncestors(node, list, traverseIframes) {
3423
+ var _node$ownerDocument2;
3424
+ if (list === void 0) {
3425
+ list = [];
3426
+ }
3427
+ if (traverseIframes === void 0) {
3428
+ traverseIframes = true;
3429
+ }
3430
+ const scrollableAncestor = getNearestOverflowAncestor(node);
3431
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
3432
+ const win = getWindow(scrollableAncestor);
3433
+ if (isBody) {
3434
+ const frameElement = getFrameElement(win);
3435
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
3436
+ }
3437
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
3438
+ }
3439
+ function getFrameElement(win) {
3440
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
3441
+ }
3442
+
3443
+ // ../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
3444
+ function getCssDimensions(element) {
3445
+ const css = getComputedStyle2(element);
3446
+ let width = parseFloat(css.width) || 0;
3447
+ let height = parseFloat(css.height) || 0;
3448
+ const hasOffset = isHTMLElement(element);
3449
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
3450
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
3451
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
3452
+ if (shouldFallback) {
3453
+ width = offsetWidth;
3454
+ height = offsetHeight;
3455
+ }
3456
+ return {
3457
+ width,
3458
+ height,
3459
+ $: shouldFallback
3460
+ };
3461
+ }
3462
+ function unwrapElement(element) {
3463
+ return !isElement(element) ? element.contextElement : element;
3464
+ }
3465
+ function getScale(element) {
3466
+ const domElement = unwrapElement(element);
3467
+ if (!isHTMLElement(domElement)) {
3468
+ return createCoords(1);
3469
+ }
3470
+ const rect = domElement.getBoundingClientRect();
3471
+ const {
3472
+ width,
3473
+ height,
3474
+ $
3475
+ } = getCssDimensions(domElement);
3476
+ let x = ($ ? round(rect.width) : rect.width) / width;
3477
+ let y = ($ ? round(rect.height) : rect.height) / height;
3478
+ if (!x || !Number.isFinite(x)) {
3479
+ x = 1;
3480
+ }
3481
+ if (!y || !Number.isFinite(y)) {
3482
+ y = 1;
3483
+ }
3484
+ return {
3485
+ x,
3486
+ y
3487
+ };
3488
+ }
3489
+ var noOffsets = /* @__PURE__ */ createCoords(0);
3490
+ function getVisualOffsets(element) {
3491
+ const win = getWindow(element);
3492
+ if (!isWebKit() || !win.visualViewport) {
3493
+ return noOffsets;
3494
+ }
3495
+ return {
3496
+ x: win.visualViewport.offsetLeft,
3497
+ y: win.visualViewport.offsetTop
3498
+ };
3499
+ }
3500
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
3501
+ if (isFixed === void 0) {
3502
+ isFixed = false;
3503
+ }
3504
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
3505
+ return false;
3506
+ }
3507
+ return isFixed;
3508
+ }
3509
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
3510
+ if (includeScale === void 0) {
3511
+ includeScale = false;
3512
+ }
3513
+ if (isFixedStrategy === void 0) {
3514
+ isFixedStrategy = false;
3515
+ }
3516
+ const clientRect = element.getBoundingClientRect();
3517
+ const domElement = unwrapElement(element);
3518
+ let scale = createCoords(1);
3519
+ if (includeScale) {
3520
+ if (offsetParent) {
3521
+ if (isElement(offsetParent)) {
3522
+ scale = getScale(offsetParent);
3523
+ }
3524
+ } else {
3525
+ scale = getScale(element);
3526
+ }
3527
+ }
3528
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
3529
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
3530
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
3531
+ let width = clientRect.width / scale.x;
3532
+ let height = clientRect.height / scale.y;
3533
+ if (domElement) {
3534
+ const win = getWindow(domElement);
3535
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
3536
+ let currentWin = win;
3537
+ let currentIFrame = getFrameElement(currentWin);
3538
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
3539
+ const iframeScale = getScale(currentIFrame);
3540
+ const iframeRect = currentIFrame.getBoundingClientRect();
3541
+ const css = getComputedStyle2(currentIFrame);
3542
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
3543
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
3544
+ x *= iframeScale.x;
3545
+ y *= iframeScale.y;
3546
+ width *= iframeScale.x;
3547
+ height *= iframeScale.y;
3548
+ x += left;
3549
+ y += top;
3550
+ currentWin = getWindow(currentIFrame);
3551
+ currentIFrame = getFrameElement(currentWin);
3552
+ }
3553
+ }
3554
+ return rectToClientRect({
3555
+ width,
3556
+ height,
3557
+ x,
3558
+ y
3559
+ });
3560
+ }
3561
+ function getWindowScrollBarX(element, rect) {
3562
+ const leftScroll = getNodeScroll(element).scrollLeft;
3563
+ if (!rect) {
3564
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
3565
+ }
3566
+ return rect.left + leftScroll;
3567
+ }
3568
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
3569
+ if (ignoreScrollbarX === void 0) {
3570
+ ignoreScrollbarX = false;
3571
+ }
3572
+ const htmlRect = documentElement.getBoundingClientRect();
3573
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
3574
+ // RTL <body> scrollbar.
3575
+ getWindowScrollBarX(documentElement, htmlRect)
3576
+ ));
3577
+ const y = htmlRect.top + scroll.scrollTop;
3578
+ return {
3579
+ x,
3580
+ y
3581
+ };
3582
+ }
3583
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
3584
+ let {
3585
+ elements,
3586
+ rect,
3587
+ offsetParent,
3588
+ strategy
3589
+ } = _ref;
3590
+ const isFixed = strategy === "fixed";
3591
+ const documentElement = getDocumentElement(offsetParent);
3592
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
3593
+ if (offsetParent === documentElement || topLayer && isFixed) {
3594
+ return rect;
3595
+ }
3596
+ let scroll = {
3597
+ scrollLeft: 0,
3598
+ scrollTop: 0
3599
+ };
3600
+ let scale = createCoords(1);
3601
+ const offsets = createCoords(0);
3602
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
3603
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3604
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
3605
+ scroll = getNodeScroll(offsetParent);
3606
+ }
3607
+ if (isHTMLElement(offsetParent)) {
3608
+ const offsetRect = getBoundingClientRect(offsetParent);
3609
+ scale = getScale(offsetParent);
3610
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
3611
+ offsets.y = offsetRect.y + offsetParent.clientTop;
3612
+ }
3613
+ }
3614
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
3615
+ return {
3616
+ width: rect.width * scale.x,
3617
+ height: rect.height * scale.y,
3618
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
3619
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
3620
+ };
3621
+ }
3622
+ function getClientRects(element) {
3623
+ return Array.from(element.getClientRects());
3624
+ }
3625
+ function getDocumentRect(element) {
3626
+ const html = getDocumentElement(element);
3627
+ const scroll = getNodeScroll(element);
3628
+ const body = element.ownerDocument.body;
3629
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
3630
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
3631
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
3632
+ const y = -scroll.scrollTop;
3633
+ if (getComputedStyle2(body).direction === "rtl") {
3634
+ x += max(html.clientWidth, body.clientWidth) - width;
3635
+ }
3636
+ return {
3637
+ width,
3638
+ height,
3639
+ x,
3640
+ y
3641
+ };
3642
+ }
3643
+ function getViewportRect(element, strategy) {
3644
+ const win = getWindow(element);
3645
+ const html = getDocumentElement(element);
3646
+ const visualViewport = win.visualViewport;
3647
+ let width = html.clientWidth;
3648
+ let height = html.clientHeight;
3649
+ let x = 0;
3650
+ let y = 0;
3651
+ if (visualViewport) {
3652
+ width = visualViewport.width;
3653
+ height = visualViewport.height;
3654
+ const visualViewportBased = isWebKit();
3655
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
3656
+ x = visualViewport.offsetLeft;
3657
+ y = visualViewport.offsetTop;
3658
+ }
3659
+ }
3660
+ return {
3661
+ width,
3662
+ height,
3663
+ x,
3664
+ y
3665
+ };
3666
+ }
3667
+ function getInnerBoundingClientRect(element, strategy) {
3668
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
3669
+ const top = clientRect.top + element.clientTop;
3670
+ const left = clientRect.left + element.clientLeft;
3671
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
3672
+ const width = element.clientWidth * scale.x;
3673
+ const height = element.clientHeight * scale.y;
3674
+ const x = left * scale.x;
3675
+ const y = top * scale.y;
3676
+ return {
3677
+ width,
3678
+ height,
3679
+ x,
3680
+ y
3681
+ };
3682
+ }
3683
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
3684
+ let rect;
3685
+ if (clippingAncestor === "viewport") {
3686
+ rect = getViewportRect(element, strategy);
3687
+ } else if (clippingAncestor === "document") {
3688
+ rect = getDocumentRect(getDocumentElement(element));
3689
+ } else if (isElement(clippingAncestor)) {
3690
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
3691
+ } else {
3692
+ const visualOffsets = getVisualOffsets(element);
3693
+ rect = {
3694
+ x: clippingAncestor.x - visualOffsets.x,
3695
+ y: clippingAncestor.y - visualOffsets.y,
3696
+ width: clippingAncestor.width,
3697
+ height: clippingAncestor.height
3698
+ };
3699
+ }
3700
+ return rectToClientRect(rect);
3701
+ }
3702
+ function hasFixedPositionAncestor(element, stopNode) {
3703
+ const parentNode = getParentNode(element);
3704
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
3705
+ return false;
3706
+ }
3707
+ return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
3708
+ }
3709
+ function getClippingElementAncestors(element, cache) {
3710
+ const cachedResult = cache.get(element);
3711
+ if (cachedResult) {
3712
+ return cachedResult;
3713
+ }
3714
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
3715
+ let currentContainingBlockComputedStyle = null;
3716
+ const elementIsFixed = getComputedStyle2(element).position === "fixed";
3717
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
3718
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
3719
+ const computedStyle = getComputedStyle2(currentNode);
3720
+ const currentNodeIsContaining = isContainingBlock(currentNode);
3721
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
3722
+ currentContainingBlockComputedStyle = null;
3723
+ }
3724
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
3725
+ if (shouldDropCurrentNode) {
3726
+ result = result.filter((ancestor) => ancestor !== currentNode);
3727
+ } else {
3728
+ currentContainingBlockComputedStyle = computedStyle;
3729
+ }
3730
+ currentNode = getParentNode(currentNode);
3731
+ }
3732
+ cache.set(element, result);
3733
+ return result;
3734
+ }
3735
+ function getClippingRect(_ref) {
3736
+ let {
3737
+ element,
3738
+ boundary,
3739
+ rootBoundary,
3740
+ strategy
3741
+ } = _ref;
3742
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
3743
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
3744
+ const firstClippingAncestor = clippingAncestors[0];
3745
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
3746
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
3747
+ accRect.top = max(rect.top, accRect.top);
3748
+ accRect.right = min(rect.right, accRect.right);
3749
+ accRect.bottom = min(rect.bottom, accRect.bottom);
3750
+ accRect.left = max(rect.left, accRect.left);
3751
+ return accRect;
3752
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
3753
+ return {
3754
+ width: clippingRect.right - clippingRect.left,
3755
+ height: clippingRect.bottom - clippingRect.top,
3756
+ x: clippingRect.left,
3757
+ y: clippingRect.top
3758
+ };
3759
+ }
3760
+ function getDimensions(element) {
3761
+ const {
3762
+ width,
3763
+ height
3764
+ } = getCssDimensions(element);
3765
+ return {
3766
+ width,
3767
+ height
3768
+ };
3769
+ }
3770
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
3771
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
3772
+ const documentElement = getDocumentElement(offsetParent);
3773
+ const isFixed = strategy === "fixed";
3774
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
3775
+ let scroll = {
3776
+ scrollLeft: 0,
3777
+ scrollTop: 0
3778
+ };
3779
+ const offsets = createCoords(0);
3780
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3781
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
3782
+ scroll = getNodeScroll(offsetParent);
3783
+ }
3784
+ if (isOffsetParentAnElement) {
3785
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
3786
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
3787
+ offsets.y = offsetRect.y + offsetParent.clientTop;
3788
+ } else if (documentElement) {
3789
+ offsets.x = getWindowScrollBarX(documentElement);
3790
+ }
3791
+ }
3792
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
3793
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
3794
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
3795
+ return {
3796
+ x,
3797
+ y,
3798
+ width: rect.width,
3799
+ height: rect.height
3800
+ };
3801
+ }
3802
+ function isStaticPositioned(element) {
3803
+ return getComputedStyle2(element).position === "static";
3804
+ }
3805
+ function getTrueOffsetParent(element, polyfill) {
3806
+ if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
3807
+ return null;
3808
+ }
3809
+ if (polyfill) {
3810
+ return polyfill(element);
3811
+ }
3812
+ let rawOffsetParent = element.offsetParent;
3813
+ if (getDocumentElement(element) === rawOffsetParent) {
3814
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
3815
+ }
3816
+ return rawOffsetParent;
3817
+ }
3818
+ function getOffsetParent(element, polyfill) {
3819
+ const win = getWindow(element);
3820
+ if (isTopLayer(element)) {
3821
+ return win;
3822
+ }
3823
+ if (!isHTMLElement(element)) {
3824
+ let svgOffsetParent = getParentNode(element);
3825
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
3826
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
3827
+ return svgOffsetParent;
3828
+ }
3829
+ svgOffsetParent = getParentNode(svgOffsetParent);
3830
+ }
3831
+ return win;
3832
+ }
3833
+ let offsetParent = getTrueOffsetParent(element, polyfill);
3834
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
3835
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
3836
+ }
3837
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
3838
+ return win;
3839
+ }
3840
+ return offsetParent || getContainingBlock(element) || win;
3841
+ }
3842
+ var getElementRects = async function(data) {
3843
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
3844
+ const getDimensionsFn = this.getDimensions;
3845
+ const floatingDimensions = await getDimensionsFn(data.floating);
3846
+ return {
3847
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
3848
+ floating: {
3849
+ x: 0,
3850
+ y: 0,
3851
+ width: floatingDimensions.width,
3852
+ height: floatingDimensions.height
3853
+ }
3854
+ };
3855
+ };
3856
+ function isRTL(element) {
3857
+ return getComputedStyle2(element).direction === "rtl";
3858
+ }
3859
+ var platform = {
3860
+ convertOffsetParentRelativeRectToViewportRelativeRect,
3861
+ getDocumentElement,
3862
+ getClippingRect,
3863
+ getOffsetParent,
3864
+ getElementRects,
3865
+ getClientRects,
3866
+ getDimensions,
3867
+ getScale,
3868
+ isElement,
3869
+ isRTL
3870
+ };
3871
+ function rectsAreEqual(a, b) {
3872
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
3873
+ }
3874
+ function observeMove(element, onMove) {
3875
+ let io = null;
3876
+ let timeoutId;
3877
+ const root = getDocumentElement(element);
3878
+ function cleanup() {
3879
+ var _io;
3880
+ clearTimeout(timeoutId);
3881
+ (_io = io) == null || _io.disconnect();
3882
+ io = null;
3883
+ }
3884
+ function refresh(skip, threshold) {
3885
+ if (skip === void 0) {
3886
+ skip = false;
3887
+ }
3888
+ if (threshold === void 0) {
3889
+ threshold = 1;
3890
+ }
3891
+ cleanup();
3892
+ const elementRectForRootMargin = element.getBoundingClientRect();
3893
+ const {
3894
+ left,
3895
+ top,
3896
+ width,
3897
+ height
3898
+ } = elementRectForRootMargin;
3899
+ if (!skip) {
3900
+ onMove();
3901
+ }
3902
+ if (!width || !height) {
3903
+ return;
3904
+ }
3905
+ const insetTop = floor(top);
3906
+ const insetRight = floor(root.clientWidth - (left + width));
3907
+ const insetBottom = floor(root.clientHeight - (top + height));
3908
+ const insetLeft = floor(left);
3909
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
3910
+ const options = {
3911
+ rootMargin,
3912
+ threshold: max(0, min(1, threshold)) || 1
3913
+ };
3914
+ let isFirstUpdate = true;
3915
+ function handleObserve(entries) {
3916
+ const ratio = entries[0].intersectionRatio;
3917
+ if (ratio !== threshold) {
3918
+ if (!isFirstUpdate) {
3919
+ return refresh();
3920
+ }
3921
+ if (!ratio) {
3922
+ timeoutId = setTimeout(() => {
3923
+ refresh(false, 1e-7);
3924
+ }, 1e3);
3925
+ } else {
3926
+ refresh(false, ratio);
3927
+ }
3928
+ }
3929
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
3930
+ refresh();
3931
+ }
3932
+ isFirstUpdate = false;
3933
+ }
3934
+ try {
3935
+ io = new IntersectionObserver(handleObserve, {
3936
+ ...options,
3937
+ // Handle <iframe>s
3938
+ root: root.ownerDocument
3939
+ });
3940
+ } catch (e) {
3941
+ io = new IntersectionObserver(handleObserve, options);
3942
+ }
3943
+ io.observe(element);
3944
+ }
3945
+ refresh(true);
3946
+ return cleanup;
3947
+ }
3948
+ function autoUpdate(reference, floating, update, options) {
3949
+ if (options === void 0) {
3950
+ options = {};
3951
+ }
3952
+ const {
3953
+ ancestorScroll = true,
3954
+ ancestorResize = true,
3955
+ elementResize = typeof ResizeObserver === "function",
3956
+ layoutShift = typeof IntersectionObserver === "function",
3957
+ animationFrame = false
3958
+ } = options;
3959
+ const referenceEl = unwrapElement(reference);
3960
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
3961
+ ancestors.forEach((ancestor) => {
3962
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
3963
+ passive: true
3964
+ });
3965
+ ancestorResize && ancestor.addEventListener("resize", update);
3966
+ });
3967
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
3968
+ let reobserveFrame = -1;
3969
+ let resizeObserver = null;
3970
+ if (elementResize) {
3971
+ resizeObserver = new ResizeObserver((_ref) => {
3972
+ let [firstEntry] = _ref;
3973
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
3974
+ resizeObserver.unobserve(floating);
3975
+ cancelAnimationFrame(reobserveFrame);
3976
+ reobserveFrame = requestAnimationFrame(() => {
3977
+ var _resizeObserver;
3978
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
3979
+ });
3980
+ }
3981
+ update();
3982
+ });
3983
+ if (referenceEl && !animationFrame) {
3984
+ resizeObserver.observe(referenceEl);
3985
+ }
3986
+ resizeObserver.observe(floating);
3987
+ }
3988
+ let frameId;
3989
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
3990
+ if (animationFrame) {
3991
+ frameLoop();
3992
+ }
3993
+ function frameLoop() {
3994
+ const nextRefRect = getBoundingClientRect(reference);
3995
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
3996
+ update();
3997
+ }
3998
+ prevRefRect = nextRefRect;
3999
+ frameId = requestAnimationFrame(frameLoop);
4000
+ }
4001
+ update();
4002
+ return () => {
4003
+ var _resizeObserver2;
4004
+ ancestors.forEach((ancestor) => {
4005
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
4006
+ ancestorResize && ancestor.removeEventListener("resize", update);
4007
+ });
4008
+ cleanupIo == null || cleanupIo();
4009
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
4010
+ resizeObserver = null;
4011
+ if (animationFrame) {
4012
+ cancelAnimationFrame(frameId);
4013
+ }
4014
+ };
4015
+ }
4016
+ var offset2 = offset;
4017
+ var shift2 = shift;
4018
+ var flip2 = flip;
4019
+ var size5 = size4;
4020
+ var hide2 = hide;
4021
+ var arrow2 = arrow;
4022
+ var limitShift2 = limitShift;
4023
+ var computePosition2 = (reference, floating, options) => {
4024
+ const cache = /* @__PURE__ */ new Map();
4025
+ const mergedOptions = {
4026
+ platform,
4027
+ ...options
4028
+ };
4029
+ const platformWithCache = {
4030
+ ...mergedOptions.platform,
4031
+ _c: cache
4032
+ };
4033
+ return computePosition(reference, floating, {
4034
+ ...mergedOptions,
4035
+ platform: platformWithCache
4036
+ });
4037
+ };
4038
+ var index = typeof document !== "undefined" ? React36.useLayoutEffect : React36.useEffect;
4039
+ function deepEqual(a, b) {
4040
+ if (a === b) {
4041
+ return true;
4042
+ }
4043
+ if (typeof a !== typeof b) {
4044
+ return false;
4045
+ }
4046
+ if (typeof a === "function" && a.toString() === b.toString()) {
4047
+ return true;
4048
+ }
4049
+ let length;
4050
+ let i;
4051
+ let keys;
4052
+ if (a && b && typeof a === "object") {
4053
+ if (Array.isArray(a)) {
4054
+ length = a.length;
4055
+ if (length !== b.length) return false;
4056
+ for (i = length; i-- !== 0; ) {
4057
+ if (!deepEqual(a[i], b[i])) {
4058
+ return false;
4059
+ }
4060
+ }
4061
+ return true;
4062
+ }
4063
+ keys = Object.keys(a);
4064
+ length = keys.length;
4065
+ if (length !== Object.keys(b).length) {
4066
+ return false;
4067
+ }
4068
+ for (i = length; i-- !== 0; ) {
4069
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
4070
+ return false;
4071
+ }
4072
+ }
4073
+ for (i = length; i-- !== 0; ) {
4074
+ const key = keys[i];
4075
+ if (key === "_owner" && a.$$typeof) {
4076
+ continue;
4077
+ }
4078
+ if (!deepEqual(a[key], b[key])) {
4079
+ return false;
4080
+ }
4081
+ }
4082
+ return true;
4083
+ }
4084
+ return a !== a && b !== b;
4085
+ }
4086
+ function getDPR(element) {
4087
+ if (typeof window === "undefined") {
4088
+ return 1;
4089
+ }
4090
+ const win = element.ownerDocument.defaultView || window;
4091
+ return win.devicePixelRatio || 1;
4092
+ }
4093
+ function roundByDPR(element, value) {
4094
+ const dpr = getDPR(element);
4095
+ return Math.round(value * dpr) / dpr;
4096
+ }
4097
+ function useLatestRef(value) {
4098
+ const ref = React36__namespace.useRef(value);
4099
+ index(() => {
4100
+ ref.current = value;
4101
+ });
4102
+ return ref;
4103
+ }
4104
+ function useFloating(options) {
4105
+ if (options === void 0) {
4106
+ options = {};
4107
+ }
4108
+ const {
4109
+ placement = "bottom",
4110
+ strategy = "absolute",
4111
+ middleware = [],
4112
+ platform: platform2,
4113
+ elements: {
4114
+ reference: externalReference,
4115
+ floating: externalFloating
4116
+ } = {},
4117
+ transform = true,
4118
+ whileElementsMounted,
4119
+ open
4120
+ } = options;
4121
+ const [data, setData] = React36__namespace.useState({
4122
+ x: 0,
4123
+ y: 0,
4124
+ strategy,
4125
+ placement,
4126
+ middlewareData: {},
4127
+ isPositioned: false
4128
+ });
4129
+ const [latestMiddleware, setLatestMiddleware] = React36__namespace.useState(middleware);
4130
+ if (!deepEqual(latestMiddleware, middleware)) {
4131
+ setLatestMiddleware(middleware);
4132
+ }
4133
+ const [_reference, _setReference] = React36__namespace.useState(null);
4134
+ const [_floating, _setFloating] = React36__namespace.useState(null);
4135
+ const setReference = React36__namespace.useCallback((node) => {
4136
+ if (node !== referenceRef.current) {
4137
+ referenceRef.current = node;
4138
+ _setReference(node);
4139
+ }
4140
+ }, []);
4141
+ const setFloating = React36__namespace.useCallback((node) => {
4142
+ if (node !== floatingRef.current) {
4143
+ floatingRef.current = node;
4144
+ _setFloating(node);
4145
+ }
4146
+ }, []);
4147
+ const referenceEl = externalReference || _reference;
4148
+ const floatingEl = externalFloating || _floating;
4149
+ const referenceRef = React36__namespace.useRef(null);
4150
+ const floatingRef = React36__namespace.useRef(null);
4151
+ const dataRef = React36__namespace.useRef(data);
4152
+ const hasWhileElementsMounted = whileElementsMounted != null;
4153
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
4154
+ const platformRef = useLatestRef(platform2);
4155
+ const openRef = useLatestRef(open);
4156
+ const update = React36__namespace.useCallback(() => {
4157
+ if (!referenceRef.current || !floatingRef.current) {
4158
+ return;
4159
+ }
4160
+ const config = {
4161
+ placement,
4162
+ strategy,
4163
+ middleware: latestMiddleware
4164
+ };
4165
+ if (platformRef.current) {
4166
+ config.platform = platformRef.current;
4167
+ }
4168
+ computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
4169
+ const fullData = {
4170
+ ...data2,
4171
+ // The floating element's position may be recomputed while it's closed
4172
+ // but still mounted (such as when transitioning out). To ensure
4173
+ // `isPositioned` will be `false` initially on the next open, avoid
4174
+ // setting it to `true` when `open === false` (must be specified).
4175
+ isPositioned: openRef.current !== false
4176
+ };
4177
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
4178
+ dataRef.current = fullData;
4179
+ ReactDOM__namespace.flushSync(() => {
4180
+ setData(fullData);
4181
+ });
4182
+ }
4183
+ });
4184
+ }, [latestMiddleware, placement, strategy, platformRef, openRef]);
4185
+ index(() => {
4186
+ if (open === false && dataRef.current.isPositioned) {
4187
+ dataRef.current.isPositioned = false;
4188
+ setData((data2) => ({
4189
+ ...data2,
4190
+ isPositioned: false
4191
+ }));
4192
+ }
4193
+ }, [open]);
4194
+ const isMountedRef = React36__namespace.useRef(false);
4195
+ index(() => {
4196
+ isMountedRef.current = true;
4197
+ return () => {
4198
+ isMountedRef.current = false;
4199
+ };
4200
+ }, []);
4201
+ index(() => {
4202
+ if (referenceEl) referenceRef.current = referenceEl;
4203
+ if (floatingEl) floatingRef.current = floatingEl;
4204
+ if (referenceEl && floatingEl) {
4205
+ if (whileElementsMountedRef.current) {
4206
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
4207
+ }
4208
+ update();
4209
+ }
4210
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
4211
+ const refs = React36__namespace.useMemo(() => ({
4212
+ reference: referenceRef,
4213
+ floating: floatingRef,
4214
+ setReference,
4215
+ setFloating
4216
+ }), [setReference, setFloating]);
4217
+ const elements = React36__namespace.useMemo(() => ({
4218
+ reference: referenceEl,
4219
+ floating: floatingEl
4220
+ }), [referenceEl, floatingEl]);
4221
+ const floatingStyles = React36__namespace.useMemo(() => {
4222
+ const initialStyles = {
4223
+ position: strategy,
4224
+ left: 0,
4225
+ top: 0
4226
+ };
4227
+ if (!elements.floating) {
4228
+ return initialStyles;
4229
+ }
4230
+ const x = roundByDPR(elements.floating, data.x);
4231
+ const y = roundByDPR(elements.floating, data.y);
4232
+ if (transform) {
4233
+ return {
4234
+ ...initialStyles,
4235
+ transform: "translate(" + x + "px, " + y + "px)",
4236
+ ...getDPR(elements.floating) >= 1.5 && {
4237
+ willChange: "transform"
4238
+ }
4239
+ };
4240
+ }
4241
+ return {
4242
+ position: strategy,
4243
+ left: x,
4244
+ top: y
4245
+ };
4246
+ }, [strategy, transform, elements.floating, data.x, data.y]);
4247
+ return React36__namespace.useMemo(() => ({
4248
+ ...data,
4249
+ update,
4250
+ refs,
4251
+ elements,
4252
+ floatingStyles
4253
+ }), [data, update, refs, elements, floatingStyles]);
4254
+ }
4255
+ var arrow$1 = (options) => {
4256
+ function isRef(value) {
4257
+ return {}.hasOwnProperty.call(value, "current");
4258
+ }
4259
+ return {
4260
+ name: "arrow",
4261
+ options,
4262
+ fn(state) {
4263
+ const {
4264
+ element,
4265
+ padding
4266
+ } = typeof options === "function" ? options(state) : options;
4267
+ if (element && isRef(element)) {
4268
+ if (element.current != null) {
4269
+ return arrow2({
4270
+ element: element.current,
4271
+ padding
4272
+ }).fn(state);
4273
+ }
4274
+ return {};
4275
+ }
4276
+ if (element) {
4277
+ return arrow2({
4278
+ element,
4279
+ padding
4280
+ }).fn(state);
4281
+ }
4282
+ return {};
4283
+ }
4284
+ };
4285
+ };
4286
+ var offset3 = (options, deps) => ({
4287
+ ...offset2(options),
4288
+ options: [options, deps]
4289
+ });
4290
+ var shift3 = (options, deps) => ({
4291
+ ...shift2(options),
4292
+ options: [options, deps]
4293
+ });
4294
+ var limitShift3 = (options, deps) => ({
4295
+ ...limitShift2(options),
4296
+ options: [options, deps]
4297
+ });
4298
+ var flip3 = (options, deps) => ({
4299
+ ...flip2(options),
4300
+ options: [options, deps]
4301
+ });
4302
+ var size6 = (options, deps) => ({
4303
+ ...size5(options),
4304
+ options: [options, deps]
4305
+ });
4306
+ var hide3 = (options, deps) => ({
4307
+ ...hide2(options),
4308
+ options: [options, deps]
4309
+ });
4310
+ var arrow3 = (options, deps) => ({
4311
+ ...arrow$1(options),
4312
+ options: [options, deps]
4313
+ });
4314
+ var NAME = "Arrow";
4315
+ var Arrow = React36__namespace.forwardRef((props, forwardedRef) => {
4316
+ const { children, width = 10, height = 5, ...arrowProps } = props;
4317
+ return /* @__PURE__ */ jsxRuntime.jsx(
4318
+ Primitive.svg,
4319
+ {
4320
+ ...arrowProps,
4321
+ ref: forwardedRef,
4322
+ width,
4323
+ height,
4324
+ viewBox: "0 0 30 10",
4325
+ preserveAspectRatio: "none",
4326
+ children: props.asChild ? children : /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "0,0 30,0 15,10" })
4327
+ }
4328
+ );
4329
+ });
4330
+ Arrow.displayName = NAME;
4331
+ var Root10 = Arrow;
4332
+ function useSize(element) {
4333
+ const [size7, setSize] = React36__namespace.useState(void 0);
4334
+ useLayoutEffect2(() => {
4335
+ if (element) {
4336
+ setSize({ width: element.offsetWidth, height: element.offsetHeight });
4337
+ const resizeObserver = new ResizeObserver((entries) => {
4338
+ if (!Array.isArray(entries)) {
4339
+ return;
4340
+ }
4341
+ if (!entries.length) {
4342
+ return;
4343
+ }
4344
+ const entry = entries[0];
4345
+ let width;
4346
+ let height;
4347
+ if ("borderBoxSize" in entry) {
4348
+ const borderSizeEntry = entry["borderBoxSize"];
4349
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
4350
+ width = borderSize["inlineSize"];
4351
+ height = borderSize["blockSize"];
4352
+ } else {
4353
+ width = element.offsetWidth;
4354
+ height = element.offsetHeight;
4355
+ }
4356
+ setSize({ width, height });
4357
+ });
4358
+ resizeObserver.observe(element, { box: "border-box" });
4359
+ return () => resizeObserver.unobserve(element);
4360
+ } else {
4361
+ setSize(void 0);
4362
+ }
4363
+ }, [element]);
4364
+ return size7;
4365
+ }
4366
+ var POPPER_NAME = "Popper";
4367
+ var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
4368
+ var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
4369
+ var Popper = (props) => {
4370
+ const { __scopePopper, children } = props;
4371
+ const [anchor, setAnchor] = React36__namespace.useState(null);
4372
+ return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
4373
+ };
4374
+ Popper.displayName = POPPER_NAME;
4375
+ var ANCHOR_NAME = "PopperAnchor";
4376
+ var PopperAnchor = React36__namespace.forwardRef(
4377
+ (props, forwardedRef) => {
4378
+ const { __scopePopper, virtualRef, ...anchorProps } = props;
4379
+ const context = usePopperContext(ANCHOR_NAME, __scopePopper);
4380
+ const ref = React36__namespace.useRef(null);
4381
+ const composedRefs = useComposedRefs(forwardedRef, ref);
4382
+ React36__namespace.useEffect(() => {
4383
+ context.onAnchorChange(virtualRef?.current || ref.current);
4384
+ });
4385
+ return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
4386
+ }
4387
+ );
4388
+ PopperAnchor.displayName = ANCHOR_NAME;
4389
+ var CONTENT_NAME = "PopperContent";
4390
+ var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
4391
+ var PopperContent = React36__namespace.forwardRef(
4392
+ (props, forwardedRef) => {
4393
+ const {
4394
+ __scopePopper,
4395
+ side = "bottom",
4396
+ sideOffset = 0,
4397
+ align = "center",
4398
+ alignOffset = 0,
4399
+ arrowPadding = 0,
4400
+ avoidCollisions = true,
4401
+ collisionBoundary = [],
4402
+ collisionPadding: collisionPaddingProp = 0,
4403
+ sticky = "partial",
4404
+ hideWhenDetached = false,
4405
+ updatePositionStrategy = "optimized",
4406
+ onPlaced,
4407
+ ...contentProps
4408
+ } = props;
4409
+ const context = usePopperContext(CONTENT_NAME, __scopePopper);
4410
+ const [content2, setContent] = React36__namespace.useState(null);
4411
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
4412
+ const [arrow4, setArrow] = React36__namespace.useState(null);
4413
+ const arrowSize = useSize(arrow4);
4414
+ const arrowWidth = arrowSize?.width ?? 0;
4415
+ const arrowHeight = arrowSize?.height ?? 0;
4416
+ const desiredPlacement = side + (align !== "center" ? "-" + align : "");
4417
+ const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
4418
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
4419
+ const hasExplicitBoundaries = boundary.length > 0;
4420
+ const detectOverflowOptions = {
4421
+ padding: collisionPadding,
4422
+ boundary: boundary.filter(isNotNull),
4423
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
4424
+ altBoundary: hasExplicitBoundaries
4425
+ };
4426
+ const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
4427
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
4428
+ strategy: "fixed",
4429
+ placement: desiredPlacement,
4430
+ whileElementsMounted: (...args) => {
4431
+ const cleanup = autoUpdate(...args, {
4432
+ animationFrame: updatePositionStrategy === "always"
4433
+ });
4434
+ return cleanup;
4435
+ },
4436
+ elements: {
4437
+ reference: context.anchor
4438
+ },
4439
+ middleware: [
4440
+ offset3({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
4441
+ avoidCollisions && shift3({
4442
+ mainAxis: true,
4443
+ crossAxis: false,
4444
+ limiter: sticky === "partial" ? limitShift3() : void 0,
4445
+ ...detectOverflowOptions
4446
+ }),
4447
+ avoidCollisions && flip3({ ...detectOverflowOptions }),
4448
+ size6({
4449
+ ...detectOverflowOptions,
4450
+ apply: ({ elements, rects, availableWidth, availableHeight }) => {
4451
+ const { width: anchorWidth, height: anchorHeight } = rects.reference;
4452
+ const contentStyle = elements.floating.style;
4453
+ contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
4454
+ contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
4455
+ contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
4456
+ contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
4457
+ }
4458
+ }),
4459
+ arrow4 && arrow3({ element: arrow4, padding: arrowPadding }),
4460
+ transformOrigin({ arrowWidth, arrowHeight }),
4461
+ hideWhenDetached && hide3({ strategy: "referenceHidden", ...detectOverflowOptions })
4462
+ ]
4463
+ });
4464
+ const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
4465
+ const handlePlaced = useCallbackRef(onPlaced);
4466
+ useLayoutEffect2(() => {
4467
+ if (isPositioned) {
4468
+ handlePlaced?.();
4469
+ }
4470
+ }, [isPositioned, handlePlaced]);
4471
+ const arrowX = middlewareData.arrow?.x;
4472
+ const arrowY = middlewareData.arrow?.y;
4473
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
4474
+ const [contentZIndex, setContentZIndex] = React36__namespace.useState();
4475
+ useLayoutEffect2(() => {
4476
+ if (content2) setContentZIndex(window.getComputedStyle(content2).zIndex);
4477
+ }, [content2]);
4478
+ return /* @__PURE__ */ jsxRuntime.jsx(
4479
+ "div",
4480
+ {
4481
+ ref: refs.setFloating,
4482
+ "data-radix-popper-content-wrapper": "",
4483
+ style: {
4484
+ ...floatingStyles,
4485
+ transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
4486
+ // keep off the page when measuring
4487
+ minWidth: "max-content",
4488
+ zIndex: contentZIndex,
4489
+ ["--radix-popper-transform-origin"]: [
4490
+ middlewareData.transformOrigin?.x,
4491
+ middlewareData.transformOrigin?.y
4492
+ ].join(" "),
4493
+ // hide the content if using the hide middleware and should be hidden
4494
+ // set visibility to hidden and disable pointer events so the UI behaves
4495
+ // as if the PopperContent isn't there at all
4496
+ ...middlewareData.hide?.referenceHidden && {
4497
+ visibility: "hidden",
4498
+ pointerEvents: "none"
4499
+ }
4500
+ },
4501
+ dir: props.dir,
4502
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4503
+ PopperContentProvider,
4504
+ {
4505
+ scope: __scopePopper,
4506
+ placedSide,
4507
+ onArrowChange: setArrow,
4508
+ arrowX,
4509
+ arrowY,
4510
+ shouldHideArrow: cannotCenterArrow,
4511
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4512
+ Primitive.div,
4513
+ {
4514
+ "data-side": placedSide,
4515
+ "data-align": placedAlign,
4516
+ ...contentProps,
4517
+ ref: composedRefs,
4518
+ style: {
4519
+ ...contentProps.style,
4520
+ // if the PopperContent hasn't been placed yet (not all measurements done)
4521
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
4522
+ animation: !isPositioned ? "none" : void 0
4523
+ }
4524
+ }
4525
+ )
4526
+ }
4527
+ )
4528
+ }
4529
+ );
4530
+ }
4531
+ );
4532
+ PopperContent.displayName = CONTENT_NAME;
4533
+ var ARROW_NAME = "PopperArrow";
4534
+ var OPPOSITE_SIDE = {
4535
+ top: "bottom",
4536
+ right: "left",
4537
+ bottom: "top",
4538
+ left: "right"
4539
+ };
4540
+ var PopperArrow = React36__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
4541
+ const { __scopePopper, ...arrowProps } = props;
4542
+ const contentContext = useContentContext(ARROW_NAME, __scopePopper);
4543
+ const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
4544
+ return (
4545
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
4546
+ // doesn't report size as we'd expect on SVG elements.
4547
+ // it reports their bounding box which is effectively the largest path inside the SVG.
4548
+ /* @__PURE__ */ jsxRuntime.jsx(
4549
+ "span",
4550
+ {
4551
+ ref: contentContext.onArrowChange,
4552
+ style: {
4553
+ position: "absolute",
4554
+ left: contentContext.arrowX,
4555
+ top: contentContext.arrowY,
4556
+ [baseSide]: 0,
4557
+ transformOrigin: {
4558
+ top: "",
4559
+ right: "0 0",
4560
+ bottom: "center 0",
4561
+ left: "100% 0"
4562
+ }[contentContext.placedSide],
4563
+ transform: {
4564
+ top: "translateY(100%)",
4565
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
4566
+ bottom: `rotate(180deg)`,
4567
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
4568
+ }[contentContext.placedSide],
4569
+ visibility: contentContext.shouldHideArrow ? "hidden" : void 0
4570
+ },
4571
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4572
+ Root10,
4573
+ {
4574
+ ...arrowProps,
4575
+ ref: forwardedRef,
4576
+ style: {
4577
+ ...arrowProps.style,
4578
+ // ensures the element can be measured correctly (mostly for if SVG)
4579
+ display: "block"
4580
+ }
4581
+ }
4582
+ )
4583
+ }
4584
+ )
4585
+ );
4586
+ });
4587
+ PopperArrow.displayName = ARROW_NAME;
4588
+ function isNotNull(value) {
4589
+ return value !== null;
4590
+ }
4591
+ var transformOrigin = (options) => ({
4592
+ name: "transformOrigin",
4593
+ options,
4594
+ fn(data) {
4595
+ const { placement, rects, middlewareData } = data;
4596
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
4597
+ const isArrowHidden = cannotCenterArrow;
4598
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
4599
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
4600
+ const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
4601
+ const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
4602
+ const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
4603
+ const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
4604
+ let x = "";
4605
+ let y = "";
4606
+ if (placedSide === "bottom") {
4607
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
4608
+ y = `${-arrowHeight}px`;
4609
+ } else if (placedSide === "top") {
4610
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
4611
+ y = `${rects.floating.height + arrowHeight}px`;
4612
+ } else if (placedSide === "right") {
4613
+ x = `${-arrowHeight}px`;
4614
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
4615
+ } else if (placedSide === "left") {
4616
+ x = `${rects.floating.width + arrowHeight}px`;
4617
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
4618
+ }
4619
+ return { data: { x, y } };
4620
+ }
4621
+ });
4622
+ function getSideAndAlignFromPlacement(placement) {
4623
+ const [side, align = "center"] = placement.split("-");
4624
+ return [side, align];
4625
+ }
4626
+ var Root22 = Popper;
4627
+ var Anchor = PopperAnchor;
4628
+ var Content6 = PopperContent;
4629
+ var Arrow2 = PopperArrow;
4630
+ var PORTAL_NAME = "Portal";
4631
+ var Portal6 = React36__namespace.forwardRef((props, forwardedRef) => {
4632
+ const { container: containerProp, ...portalProps } = props;
4633
+ const [mounted, setMounted] = React36__namespace.useState(false);
4634
+ useLayoutEffect2(() => setMounted(true), []);
4635
+ const container = containerProp || mounted && globalThis?.document?.body;
4636
+ return container ? ReactDOM__namespace.default.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
4637
+ });
4638
+ Portal6.displayName = PORTAL_NAME;
4639
+ function useStateMachine(initialState, machine) {
4640
+ return React36__namespace.useReducer((state, event) => {
4641
+ const nextState = machine[state][event];
4642
+ return nextState ?? state;
4643
+ }, initialState);
4644
+ }
4645
+ var Presence = (props) => {
4646
+ const { present, children } = props;
4647
+ const presence = usePresence(present);
4648
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React36__namespace.Children.only(children);
4649
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
4650
+ const forceMount = typeof children === "function";
4651
+ return forceMount || presence.isPresent ? React36__namespace.cloneElement(child, { ref }) : null;
4652
+ };
4653
+ Presence.displayName = "Presence";
4654
+ function usePresence(present) {
4655
+ const [node, setNode] = React36__namespace.useState();
4656
+ const stylesRef = React36__namespace.useRef(null);
4657
+ const prevPresentRef = React36__namespace.useRef(present);
4658
+ const prevAnimationNameRef = React36__namespace.useRef("none");
4659
+ const initialState = present ? "mounted" : "unmounted";
4660
+ const [state, send] = useStateMachine(initialState, {
4661
+ mounted: {
4662
+ UNMOUNT: "unmounted",
4663
+ ANIMATION_OUT: "unmountSuspended"
4664
+ },
4665
+ unmountSuspended: {
4666
+ MOUNT: "mounted",
4667
+ ANIMATION_END: "unmounted"
4668
+ },
4669
+ unmounted: {
4670
+ MOUNT: "mounted"
4671
+ }
4672
+ });
4673
+ React36__namespace.useEffect(() => {
4674
+ const currentAnimationName = getAnimationName(stylesRef.current);
4675
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
4676
+ }, [state]);
4677
+ useLayoutEffect2(() => {
4678
+ const styles = stylesRef.current;
4679
+ const wasPresent = prevPresentRef.current;
4680
+ const hasPresentChanged = wasPresent !== present;
4681
+ if (hasPresentChanged) {
4682
+ const prevAnimationName = prevAnimationNameRef.current;
4683
+ const currentAnimationName = getAnimationName(styles);
4684
+ if (present) {
4685
+ send("MOUNT");
4686
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
4687
+ send("UNMOUNT");
4688
+ } else {
4689
+ const isAnimating = prevAnimationName !== currentAnimationName;
4690
+ if (wasPresent && isAnimating) {
4691
+ send("ANIMATION_OUT");
4692
+ } else {
4693
+ send("UNMOUNT");
4694
+ }
4695
+ }
4696
+ prevPresentRef.current = present;
4697
+ }
4698
+ }, [present, send]);
4699
+ useLayoutEffect2(() => {
4700
+ if (node) {
4701
+ let timeoutId;
4702
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
4703
+ const handleAnimationEnd = (event) => {
4704
+ const currentAnimationName = getAnimationName(stylesRef.current);
4705
+ const isCurrentAnimation = currentAnimationName.includes(event.animationName);
4706
+ if (event.target === node && isCurrentAnimation) {
4707
+ send("ANIMATION_END");
4708
+ if (!prevPresentRef.current) {
4709
+ const currentFillMode = node.style.animationFillMode;
4710
+ node.style.animationFillMode = "forwards";
4711
+ timeoutId = ownerWindow.setTimeout(() => {
4712
+ if (node.style.animationFillMode === "forwards") {
4713
+ node.style.animationFillMode = currentFillMode;
4714
+ }
4715
+ });
4716
+ }
4717
+ }
4718
+ };
4719
+ const handleAnimationStart = (event) => {
4720
+ if (event.target === node) {
4721
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
4722
+ }
4723
+ };
4724
+ node.addEventListener("animationstart", handleAnimationStart);
4725
+ node.addEventListener("animationcancel", handleAnimationEnd);
4726
+ node.addEventListener("animationend", handleAnimationEnd);
4727
+ return () => {
4728
+ ownerWindow.clearTimeout(timeoutId);
4729
+ node.removeEventListener("animationstart", handleAnimationStart);
4730
+ node.removeEventListener("animationcancel", handleAnimationEnd);
4731
+ node.removeEventListener("animationend", handleAnimationEnd);
4732
+ };
4733
+ } else {
4734
+ send("ANIMATION_END");
4735
+ }
4736
+ }, [node, send]);
4737
+ return {
4738
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
4739
+ ref: React36__namespace.useCallback((node2) => {
4740
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
4741
+ setNode(node2);
4742
+ }, [])
4743
+ };
4744
+ }
4745
+ function getAnimationName(styles) {
4746
+ return styles?.animationName || "none";
4747
+ }
4748
+ function getElementRef(element) {
4749
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
4750
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
4751
+ if (mayWarn) {
4752
+ return element.ref;
4753
+ }
4754
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
4755
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
4756
+ if (mayWarn) {
4757
+ return element.props.ref;
4758
+ }
4759
+ return element.props.ref || element.ref;
4760
+ }
4761
+ var useInsertionEffect = React36__namespace[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
4762
+ function useControllableState({
4763
+ prop,
4764
+ defaultProp,
4765
+ onChange = () => {
4766
+ },
4767
+ caller
4768
+ }) {
4769
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
4770
+ defaultProp,
4771
+ onChange
4772
+ });
4773
+ const isControlled = prop !== void 0;
4774
+ const value = isControlled ? prop : uncontrolledProp;
4775
+ {
4776
+ const isControlledRef = React36__namespace.useRef(prop !== void 0);
4777
+ React36__namespace.useEffect(() => {
4778
+ const wasControlled = isControlledRef.current;
4779
+ if (wasControlled !== isControlled) {
4780
+ const from = wasControlled ? "controlled" : "uncontrolled";
4781
+ const to = isControlled ? "controlled" : "uncontrolled";
4782
+ console.warn(
4783
+ `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
4784
+ );
4785
+ }
4786
+ isControlledRef.current = isControlled;
4787
+ }, [isControlled, caller]);
4788
+ }
4789
+ const setValue = React36__namespace.useCallback(
4790
+ (nextValue) => {
4791
+ if (isControlled) {
4792
+ const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
4793
+ if (value2 !== prop) {
4794
+ onChangeRef.current?.(value2);
4795
+ }
4796
+ } else {
4797
+ setUncontrolledProp(nextValue);
4798
+ }
4799
+ },
4800
+ [isControlled, prop, setUncontrolledProp, onChangeRef]
4801
+ );
4802
+ return [value, setValue];
4803
+ }
4804
+ function useUncontrolledState({
4805
+ defaultProp,
4806
+ onChange
4807
+ }) {
4808
+ const [value, setValue] = React36__namespace.useState(defaultProp);
4809
+ const prevValueRef = React36__namespace.useRef(value);
4810
+ const onChangeRef = React36__namespace.useRef(onChange);
4811
+ useInsertionEffect(() => {
4812
+ onChangeRef.current = onChange;
4813
+ }, [onChange]);
4814
+ React36__namespace.useEffect(() => {
4815
+ if (prevValueRef.current !== value) {
4816
+ onChangeRef.current?.(value);
4817
+ prevValueRef.current = value;
4818
+ }
4819
+ }, [value, prevValueRef]);
4820
+ return [value, setValue, onChangeRef];
4821
+ }
4822
+ function isFunction(value) {
4823
+ return typeof value === "function";
4824
+ }
4825
+ var NODES2 = [
4826
+ "a",
4827
+ "button",
4828
+ "div",
4829
+ "form",
4830
+ "h2",
4831
+ "h3",
4832
+ "img",
4833
+ "input",
4834
+ "label",
4835
+ "li",
4836
+ "nav",
4837
+ "ol",
4838
+ "p",
4839
+ "select",
4840
+ "span",
4841
+ "svg",
4842
+ "ul"
4843
+ ];
4844
+ var Primitive2 = NODES2.reduce((primitive, node) => {
4845
+ const Slot3 = reactSlot.createSlot(`Primitive.${node}`);
4846
+ const Node2 = React36__namespace.forwardRef((props, forwardedRef) => {
4847
+ const { asChild, ...primitiveProps } = props;
4848
+ const Comp = asChild ? Slot3 : node;
4849
+ if (typeof window !== "undefined") {
4850
+ window[Symbol.for("radix-ui")] = true;
4851
+ }
4852
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
4853
+ });
4854
+ Node2.displayName = `Primitive.${node}`;
4855
+ return { ...primitive, [node]: Node2 };
4856
+ }, {});
4857
+ var VISUALLY_HIDDEN_STYLES = Object.freeze({
4858
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
4859
+ position: "absolute",
4860
+ border: 0,
4861
+ width: 1,
4862
+ height: 1,
4863
+ padding: 0,
4864
+ margin: -1,
4865
+ overflow: "hidden",
4866
+ clip: "rect(0, 0, 0, 0)",
4867
+ whiteSpace: "nowrap",
4868
+ wordWrap: "normal"
4869
+ });
4870
+ var NAME2 = "VisuallyHidden";
4871
+ var VisuallyHidden = React36__namespace.forwardRef(
4872
+ (props, forwardedRef) => {
4873
+ return /* @__PURE__ */ jsxRuntime.jsx(
4874
+ Primitive2.span,
4875
+ {
4876
+ ...props,
4877
+ ref: forwardedRef,
4878
+ style: { ...VISUALLY_HIDDEN_STYLES, ...props.style }
4879
+ }
4880
+ );
4881
+ }
4882
+ );
4883
+ VisuallyHidden.displayName = NAME2;
4884
+ var Root11 = VisuallyHidden;
4885
+ var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
4886
+ createPopperScope
4887
+ ]);
4888
+ var usePopperScope = createPopperScope();
4889
+ var PROVIDER_NAME = "TooltipProvider";
4890
+ var DEFAULT_DELAY_DURATION = 700;
4891
+ var TOOLTIP_OPEN = "tooltip.open";
4892
+ var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
4893
+ var TooltipProvider = (props) => {
4894
+ const {
4895
+ __scopeTooltip,
4896
+ delayDuration = DEFAULT_DELAY_DURATION,
4897
+ skipDelayDuration = 300,
4898
+ disableHoverableContent = false,
4899
+ children
4900
+ } = props;
4901
+ const isOpenDelayedRef = React36__namespace.useRef(true);
4902
+ const isPointerInTransitRef = React36__namespace.useRef(false);
4903
+ const skipDelayTimerRef = React36__namespace.useRef(0);
4904
+ React36__namespace.useEffect(() => {
4905
+ const skipDelayTimer = skipDelayTimerRef.current;
4906
+ return () => window.clearTimeout(skipDelayTimer);
4907
+ }, []);
4908
+ return /* @__PURE__ */ jsxRuntime.jsx(
4909
+ TooltipProviderContextProvider,
4910
+ {
4911
+ scope: __scopeTooltip,
4912
+ isOpenDelayedRef,
4913
+ delayDuration,
4914
+ onOpen: React36__namespace.useCallback(() => {
4915
+ window.clearTimeout(skipDelayTimerRef.current);
4916
+ isOpenDelayedRef.current = false;
4917
+ }, []),
4918
+ onClose: React36__namespace.useCallback(() => {
4919
+ window.clearTimeout(skipDelayTimerRef.current);
4920
+ skipDelayTimerRef.current = window.setTimeout(
4921
+ () => isOpenDelayedRef.current = true,
4922
+ skipDelayDuration
4923
+ );
4924
+ }, [skipDelayDuration]),
4925
+ isPointerInTransitRef,
4926
+ onPointerInTransitChange: React36__namespace.useCallback((inTransit) => {
4927
+ isPointerInTransitRef.current = inTransit;
4928
+ }, []),
4929
+ disableHoverableContent,
4930
+ children
4931
+ }
4932
+ );
4933
+ };
4934
+ TooltipProvider.displayName = PROVIDER_NAME;
4935
+ var TOOLTIP_NAME = "Tooltip";
4936
+ var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
4937
+ var Tooltip = (props) => {
4938
+ const {
4939
+ __scopeTooltip,
4940
+ children,
4941
+ open: openProp,
4942
+ defaultOpen,
4943
+ onOpenChange,
4944
+ disableHoverableContent: disableHoverableContentProp,
4945
+ delayDuration: delayDurationProp
4946
+ } = props;
4947
+ const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
4948
+ const popperScope = usePopperScope(__scopeTooltip);
4949
+ const [trigger, setTrigger] = React36__namespace.useState(null);
4950
+ const contentId = useId();
4951
+ const openTimerRef = React36__namespace.useRef(0);
4952
+ const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
4953
+ const delayDuration = delayDurationProp ?? providerContext.delayDuration;
4954
+ const wasOpenDelayedRef = React36__namespace.useRef(false);
4955
+ const [open, setOpen] = useControllableState({
4956
+ prop: openProp,
4957
+ defaultProp: defaultOpen ?? false,
4958
+ onChange: (open2) => {
4959
+ if (open2) {
4960
+ providerContext.onOpen();
4961
+ document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
4962
+ } else {
4963
+ providerContext.onClose();
4964
+ }
4965
+ onOpenChange?.(open2);
4966
+ },
4967
+ caller: TOOLTIP_NAME
4968
+ });
4969
+ const stateAttribute = React36__namespace.useMemo(() => {
4970
+ return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
4971
+ }, [open]);
4972
+ const handleOpen = React36__namespace.useCallback(() => {
4973
+ window.clearTimeout(openTimerRef.current);
4974
+ openTimerRef.current = 0;
4975
+ wasOpenDelayedRef.current = false;
4976
+ setOpen(true);
4977
+ }, [setOpen]);
4978
+ const handleClose = React36__namespace.useCallback(() => {
4979
+ window.clearTimeout(openTimerRef.current);
4980
+ openTimerRef.current = 0;
4981
+ setOpen(false);
4982
+ }, [setOpen]);
4983
+ const handleDelayedOpen = React36__namespace.useCallback(() => {
4984
+ window.clearTimeout(openTimerRef.current);
4985
+ openTimerRef.current = window.setTimeout(() => {
4986
+ wasOpenDelayedRef.current = true;
4987
+ setOpen(true);
4988
+ openTimerRef.current = 0;
4989
+ }, delayDuration);
4990
+ }, [delayDuration, setOpen]);
4991
+ React36__namespace.useEffect(() => {
4992
+ return () => {
4993
+ if (openTimerRef.current) {
4994
+ window.clearTimeout(openTimerRef.current);
4995
+ openTimerRef.current = 0;
4996
+ }
4997
+ };
4998
+ }, []);
4999
+ return /* @__PURE__ */ jsxRuntime.jsx(Root22, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
5000
+ TooltipContextProvider,
5001
+ {
5002
+ scope: __scopeTooltip,
5003
+ contentId,
5004
+ open,
5005
+ stateAttribute,
5006
+ trigger,
5007
+ onTriggerChange: setTrigger,
5008
+ onTriggerEnter: React36__namespace.useCallback(() => {
5009
+ if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
5010
+ else handleOpen();
5011
+ }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
5012
+ onTriggerLeave: React36__namespace.useCallback(() => {
5013
+ if (disableHoverableContent) {
5014
+ handleClose();
5015
+ } else {
5016
+ window.clearTimeout(openTimerRef.current);
5017
+ openTimerRef.current = 0;
5018
+ }
5019
+ }, [handleClose, disableHoverableContent]),
5020
+ onOpen: handleOpen,
5021
+ onClose: handleClose,
5022
+ disableHoverableContent,
5023
+ children
5024
+ }
5025
+ ) });
5026
+ };
5027
+ Tooltip.displayName = TOOLTIP_NAME;
5028
+ var TRIGGER_NAME = "TooltipTrigger";
5029
+ var TooltipTrigger = React36__namespace.forwardRef(
5030
+ (props, forwardedRef) => {
5031
+ const { __scopeTooltip, ...triggerProps } = props;
5032
+ const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
5033
+ const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
5034
+ const popperScope = usePopperScope(__scopeTooltip);
5035
+ const ref = React36__namespace.useRef(null);
5036
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
5037
+ const isPointerDownRef = React36__namespace.useRef(false);
5038
+ const hasPointerMoveOpenedRef = React36__namespace.useRef(false);
5039
+ const handlePointerUp = React36__namespace.useCallback(() => isPointerDownRef.current = false, []);
5040
+ React36__namespace.useEffect(() => {
5041
+ return () => document.removeEventListener("pointerup", handlePointerUp);
5042
+ }, [handlePointerUp]);
5043
+ return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
5044
+ Primitive.button,
5045
+ {
5046
+ "aria-describedby": context.open ? context.contentId : void 0,
5047
+ "data-state": context.stateAttribute,
5048
+ ...triggerProps,
5049
+ ref: composedRefs,
5050
+ onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
5051
+ if (event.pointerType === "touch") return;
5052
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
5053
+ context.onTriggerEnter();
5054
+ hasPointerMoveOpenedRef.current = true;
5055
+ }
5056
+ }),
5057
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
5058
+ context.onTriggerLeave();
5059
+ hasPointerMoveOpenedRef.current = false;
5060
+ }),
5061
+ onPointerDown: composeEventHandlers(props.onPointerDown, () => {
5062
+ if (context.open) {
5063
+ context.onClose();
5064
+ }
5065
+ isPointerDownRef.current = true;
5066
+ document.addEventListener("pointerup", handlePointerUp, { once: true });
5067
+ }),
5068
+ onFocus: composeEventHandlers(props.onFocus, () => {
5069
+ if (!isPointerDownRef.current) context.onOpen();
5070
+ }),
5071
+ onBlur: composeEventHandlers(props.onBlur, context.onClose),
5072
+ onClick: composeEventHandlers(props.onClick, context.onClose)
5073
+ }
5074
+ ) });
5075
+ }
5076
+ );
5077
+ TooltipTrigger.displayName = TRIGGER_NAME;
5078
+ var PORTAL_NAME2 = "TooltipPortal";
5079
+ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME2, {
5080
+ forceMount: void 0
5081
+ });
5082
+ var TooltipPortal = (props) => {
5083
+ const { __scopeTooltip, forceMount, children, container } = props;
5084
+ const context = useTooltipContext(PORTAL_NAME2, __scopeTooltip);
5085
+ return /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Portal6, { asChild: true, container, children }) }) });
5086
+ };
5087
+ TooltipPortal.displayName = PORTAL_NAME2;
5088
+ var CONTENT_NAME2 = "TooltipContent";
5089
+ var TooltipContent = React36__namespace.forwardRef(
5090
+ (props, forwardedRef) => {
5091
+ const portalContext = usePortalContext(CONTENT_NAME2, props.__scopeTooltip);
5092
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
5093
+ const context = useTooltipContext(CONTENT_NAME2, props.__scopeTooltip);
5094
+ return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
5095
+ }
5096
+ );
5097
+ var TooltipContentHoverable = React36__namespace.forwardRef((props, forwardedRef) => {
5098
+ const context = useTooltipContext(CONTENT_NAME2, props.__scopeTooltip);
5099
+ const providerContext = useTooltipProviderContext(CONTENT_NAME2, props.__scopeTooltip);
5100
+ const ref = React36__namespace.useRef(null);
5101
+ const composedRefs = useComposedRefs(forwardedRef, ref);
5102
+ const [pointerGraceArea, setPointerGraceArea] = React36__namespace.useState(null);
5103
+ const { trigger, onClose } = context;
5104
+ const content2 = ref.current;
5105
+ const { onPointerInTransitChange } = providerContext;
5106
+ const handleRemoveGraceArea = React36__namespace.useCallback(() => {
5107
+ setPointerGraceArea(null);
5108
+ onPointerInTransitChange(false);
5109
+ }, [onPointerInTransitChange]);
5110
+ const handleCreateGraceArea = React36__namespace.useCallback(
5111
+ (event, hoverTarget) => {
5112
+ const currentTarget = event.currentTarget;
5113
+ const exitPoint = { x: event.clientX, y: event.clientY };
5114
+ const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
5115
+ const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
5116
+ const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
5117
+ const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
5118
+ setPointerGraceArea(graceArea);
5119
+ onPointerInTransitChange(true);
5120
+ },
5121
+ [onPointerInTransitChange]
5122
+ );
5123
+ React36__namespace.useEffect(() => {
5124
+ return () => handleRemoveGraceArea();
5125
+ }, [handleRemoveGraceArea]);
5126
+ React36__namespace.useEffect(() => {
5127
+ if (trigger && content2) {
5128
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content2);
5129
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
5130
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
5131
+ content2.addEventListener("pointerleave", handleContentLeave);
5132
+ return () => {
5133
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
5134
+ content2.removeEventListener("pointerleave", handleContentLeave);
5135
+ };
5136
+ }
5137
+ }, [trigger, content2, handleCreateGraceArea, handleRemoveGraceArea]);
5138
+ React36__namespace.useEffect(() => {
5139
+ if (pointerGraceArea) {
5140
+ const handleTrackPointerGrace = (event) => {
5141
+ const target = event.target;
5142
+ const pointerPosition = { x: event.clientX, y: event.clientY };
5143
+ const hasEnteredTarget = trigger?.contains(target) || content2?.contains(target);
5144
+ const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
5145
+ if (hasEnteredTarget) {
5146
+ handleRemoveGraceArea();
5147
+ } else if (isPointerOutsideGraceArea) {
5148
+ handleRemoveGraceArea();
5149
+ onClose();
5150
+ }
5151
+ };
5152
+ document.addEventListener("pointermove", handleTrackPointerGrace);
5153
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
5154
+ }
5155
+ }, [trigger, content2, pointerGraceArea, onClose, handleRemoveGraceArea]);
5156
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
5157
+ });
5158
+ var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
5159
+ var Slottable = reactSlot.createSlottable("TooltipContent");
5160
+ var TooltipContentImpl = React36__namespace.forwardRef(
5161
+ (props, forwardedRef) => {
5162
+ const {
5163
+ __scopeTooltip,
5164
+ children,
5165
+ "aria-label": ariaLabel,
5166
+ onEscapeKeyDown,
5167
+ onPointerDownOutside,
5168
+ ...contentProps
5169
+ } = props;
5170
+ const context = useTooltipContext(CONTENT_NAME2, __scopeTooltip);
5171
+ const popperScope = usePopperScope(__scopeTooltip);
5172
+ const { onClose } = context;
5173
+ React36__namespace.useEffect(() => {
5174
+ document.addEventListener(TOOLTIP_OPEN, onClose);
5175
+ return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
5176
+ }, [onClose]);
5177
+ React36__namespace.useEffect(() => {
5178
+ if (context.trigger) {
5179
+ const handleScroll = (event) => {
5180
+ const target = event.target;
5181
+ if (target?.contains(context.trigger)) onClose();
5182
+ };
5183
+ window.addEventListener("scroll", handleScroll, { capture: true });
5184
+ return () => window.removeEventListener("scroll", handleScroll, { capture: true });
5185
+ }
5186
+ }, [context.trigger, onClose]);
5187
+ return /* @__PURE__ */ jsxRuntime.jsx(
5188
+ DismissableLayer,
5189
+ {
5190
+ asChild: true,
5191
+ disableOutsidePointerEvents: false,
5192
+ onEscapeKeyDown,
5193
+ onPointerDownOutside,
5194
+ onFocusOutside: (event) => event.preventDefault(),
5195
+ onDismiss: onClose,
5196
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
5197
+ Content6,
5198
+ {
5199
+ "data-state": context.stateAttribute,
5200
+ ...popperScope,
5201
+ ...contentProps,
5202
+ ref: forwardedRef,
5203
+ style: {
5204
+ ...contentProps.style,
5205
+ // re-namespace exposed content custom properties
5206
+ ...{
5207
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
5208
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
5209
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
5210
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
5211
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
5212
+ }
5213
+ },
5214
+ children: [
5215
+ /* @__PURE__ */ jsxRuntime.jsx(Slottable, { children }),
5216
+ /* @__PURE__ */ jsxRuntime.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntime.jsx(Root11, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
5217
+ ]
5218
+ }
5219
+ )
5220
+ }
5221
+ );
5222
+ }
5223
+ );
5224
+ TooltipContent.displayName = CONTENT_NAME2;
5225
+ var ARROW_NAME2 = "TooltipArrow";
5226
+ var TooltipArrow = React36__namespace.forwardRef(
5227
+ (props, forwardedRef) => {
5228
+ const { __scopeTooltip, ...arrowProps } = props;
5229
+ const popperScope = usePopperScope(__scopeTooltip);
5230
+ const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
5231
+ ARROW_NAME2,
5232
+ __scopeTooltip
5233
+ );
5234
+ return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntime.jsx(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
5235
+ }
5236
+ );
5237
+ TooltipArrow.displayName = ARROW_NAME2;
5238
+ function getExitSideFromRect(point, rect) {
5239
+ const top = Math.abs(rect.top - point.y);
5240
+ const bottom = Math.abs(rect.bottom - point.y);
5241
+ const right = Math.abs(rect.right - point.x);
5242
+ const left = Math.abs(rect.left - point.x);
5243
+ switch (Math.min(top, bottom, right, left)) {
5244
+ case left:
5245
+ return "left";
5246
+ case right:
5247
+ return "right";
5248
+ case top:
5249
+ return "top";
5250
+ case bottom:
5251
+ return "bottom";
5252
+ default:
5253
+ throw new Error("unreachable");
5254
+ }
5255
+ }
5256
+ function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
5257
+ const paddedExitPoints = [];
5258
+ switch (exitSide) {
5259
+ case "top":
5260
+ paddedExitPoints.push(
5261
+ { x: exitPoint.x - padding, y: exitPoint.y + padding },
5262
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
5263
+ );
5264
+ break;
5265
+ case "bottom":
5266
+ paddedExitPoints.push(
5267
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
5268
+ { x: exitPoint.x + padding, y: exitPoint.y - padding }
5269
+ );
5270
+ break;
5271
+ case "left":
5272
+ paddedExitPoints.push(
5273
+ { x: exitPoint.x + padding, y: exitPoint.y - padding },
5274
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
5275
+ );
5276
+ break;
5277
+ case "right":
5278
+ paddedExitPoints.push(
5279
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
5280
+ { x: exitPoint.x - padding, y: exitPoint.y + padding }
5281
+ );
5282
+ break;
5283
+ }
5284
+ return paddedExitPoints;
5285
+ }
5286
+ function getPointsFromRect(rect) {
5287
+ const { top, right, bottom, left } = rect;
5288
+ return [
5289
+ { x: left, y: top },
5290
+ { x: right, y: top },
5291
+ { x: right, y: bottom },
5292
+ { x: left, y: bottom }
5293
+ ];
5294
+ }
5295
+ function isPointInPolygon(point, polygon) {
5296
+ const { x, y } = point;
5297
+ let inside = false;
5298
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
5299
+ const ii = polygon[i];
5300
+ const jj = polygon[j];
5301
+ const xi = ii.x;
5302
+ const yi = ii.y;
5303
+ const xj = jj.x;
5304
+ const yj = jj.y;
5305
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
5306
+ if (intersect) inside = !inside;
5307
+ }
5308
+ return inside;
5309
+ }
5310
+ function getHull(points) {
5311
+ const newPoints = points.slice();
5312
+ newPoints.sort((a, b) => {
5313
+ if (a.x < b.x) return -1;
5314
+ else if (a.x > b.x) return 1;
5315
+ else if (a.y < b.y) return -1;
5316
+ else if (a.y > b.y) return 1;
5317
+ else return 0;
5318
+ });
5319
+ return getHullPresorted(newPoints);
5320
+ }
5321
+ function getHullPresorted(points) {
5322
+ if (points.length <= 1) return points.slice();
5323
+ const upperHull = [];
5324
+ for (let i = 0; i < points.length; i++) {
5325
+ const p = points[i];
5326
+ while (upperHull.length >= 2) {
5327
+ const q = upperHull[upperHull.length - 1];
5328
+ const r2 = upperHull[upperHull.length - 2];
5329
+ if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) upperHull.pop();
5330
+ else break;
5331
+ }
5332
+ upperHull.push(p);
5333
+ }
5334
+ upperHull.pop();
5335
+ const lowerHull = [];
5336
+ for (let i = points.length - 1; i >= 0; i--) {
5337
+ const p = points[i];
5338
+ while (lowerHull.length >= 2) {
5339
+ const q = lowerHull[lowerHull.length - 1];
5340
+ const r2 = lowerHull[lowerHull.length - 2];
5341
+ if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) lowerHull.pop();
5342
+ else break;
5343
+ }
5344
+ lowerHull.push(p);
5345
+ }
5346
+ lowerHull.pop();
5347
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
5348
+ return upperHull;
5349
+ } else {
5350
+ return upperHull.concat(lowerHull);
5351
+ }
5352
+ }
5353
+ var Provider = TooltipProvider;
5354
+ var Root32 = Tooltip;
5355
+ var Trigger6 = TooltipTrigger;
5356
+ var Portal7 = TooltipPortal;
5357
+ var Content22 = TooltipContent;
5358
+ var Arrow22 = TooltipArrow;
5359
+ var Tooltip2 = React36__namespace.forwardRef(
2097
5360
  ({
2098
5361
  children,
2099
5362
  content: content2,
@@ -2104,11 +5367,11 @@ var Tooltip = React8__namespace.forwardRef(
2104
5367
  className,
2105
5368
  ...props
2106
5369
  }, ref) => {
2107
- const Comp = portal ? TooltipPrimitive__namespace.Portal : React8__namespace.Fragment;
2108
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Provider, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipPrimitive__namespace.Root, { children: [
2109
- /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Trigger, { children }),
5370
+ const Comp = portal ? Portal7 : React36__namespace.Fragment;
5371
+ return /* @__PURE__ */ jsxRuntime.jsx(Provider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Root32, { children: [
5372
+ /* @__PURE__ */ jsxRuntime.jsx(Trigger6, { children }),
2110
5373
  /* @__PURE__ */ jsxRuntime.jsx(Comp, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2111
- TooltipPrimitive__namespace.Content,
5374
+ Content22,
2112
5375
  {
2113
5376
  ref,
2114
5377
  side,
@@ -2121,14 +5384,14 @@ var Tooltip = React8__namespace.forwardRef(
2121
5384
  ...props,
2122
5385
  children: [
2123
5386
  content2,
2124
- /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Arrow, { className: "nebula-ds fill-tooltip-background" })
5387
+ /* @__PURE__ */ jsxRuntime.jsx(Arrow22, { className: "nebula-ds fill-tooltip-background" })
2125
5388
  ]
2126
5389
  }
2127
5390
  ) })
2128
5391
  ] }) });
2129
5392
  }
2130
5393
  );
2131
- Tooltip.displayName = "Tooltip";
5394
+ Tooltip2.displayName = "Tooltip";
2132
5395
 
2133
5396
  // src/tailwind.ts
2134
5397
  function content({ base = "./" } = {}) {
@@ -2249,7 +5512,7 @@ exports.TableHead = TableHead;
2249
5512
  exports.TableHeader = TableHeader;
2250
5513
  exports.TableRow = TableRow;
2251
5514
  exports.Tag = Tag;
2252
- exports.Tooltip = Tooltip;
5515
+ exports.Tooltip = Tooltip2;
2253
5516
  exports.alertVariants = alertVariants;
2254
5517
  exports.badgeSizeEnum = badgeSizeEnum;
2255
5518
  exports.badgeVariantEnum = badgeVariantEnum;
@@ -2257,7 +5520,7 @@ exports.buttonSizeEnum = buttonSizeEnum;
2257
5520
  exports.buttonVariantEnum = buttonVariantEnum;
2258
5521
  exports.buttonVariantsConfig = buttonVariantsConfig;
2259
5522
  exports.getNebulaLanguage = getNebulaLanguage;
2260
- exports.messages = messages7;
5523
+ exports.messages = messages4;
2261
5524
  exports.separatorVariants = separatorVariants;
2262
5525
  exports.setNebulaLanguage = setNebulaLanguage;
2263
5526
  exports.tagVariantsEnum = tagVariantsEnum;