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

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