@yoopta/ui 6.0.0-beta.7 → 6.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/action-menu-list/action-menu-list.d.ts +49 -13
  2. package/dist/action-menu-list/action-menu-list.d.ts.map +1 -1
  3. package/dist/action-menu-list/context.d.ts +25 -0
  4. package/dist/action-menu-list/context.d.ts.map +1 -0
  5. package/dist/action-menu-list/index.d.ts +5 -5
  6. package/dist/action-menu-list/index.d.ts.map +1 -1
  7. package/dist/action-menu-list/utils.d.ts +1 -1
  8. package/dist/action-menu-list/utils.d.ts.map +1 -1
  9. package/dist/action-menu-list.js +1 -1
  10. package/dist/block-options/block-options.d.ts.map +1 -1
  11. package/dist/block-options.js +1 -1
  12. package/dist/chunks/{floating-ui.react-33212df0.js → floating-ui.react-727e4287.js} +1 -1
  13. package/dist/chunks/{highlight-color-picker-ea799f50.js → highlight-color-picker-ce0b19ac.js} +1 -1
  14. package/dist/element-options/context/element-options-context.d.ts +2 -2
  15. package/dist/element-options.js +18 -5
  16. package/dist/floating-block-actions/context.d.ts +15 -0
  17. package/dist/floating-block-actions/context.d.ts.map +1 -0
  18. package/dist/floating-block-actions/floating-block-actions.d.ts +30 -7
  19. package/dist/floating-block-actions/floating-block-actions.d.ts.map +1 -1
  20. package/dist/floating-block-actions/hooks.d.ts +1 -29
  21. package/dist/floating-block-actions/hooks.d.ts.map +1 -1
  22. package/dist/floating-block-actions/index.d.ts +3 -4
  23. package/dist/floating-block-actions/index.d.ts.map +1 -1
  24. package/dist/floating-block-actions.js +1 -1
  25. package/dist/floating-toolbar/context.d.ts +12 -0
  26. package/dist/floating-toolbar/context.d.ts.map +1 -0
  27. package/dist/floating-toolbar/floating-toolbar.d.ts +44 -0
  28. package/dist/floating-toolbar/floating-toolbar.d.ts.map +1 -0
  29. package/dist/floating-toolbar/index.d.ts +5 -0
  30. package/dist/floating-toolbar/index.d.ts.map +1 -0
  31. package/dist/floating-toolbar.js +1 -0
  32. package/dist/highlight-color-picker.js +1 -1
  33. package/dist/index.d.ts +3 -5
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/overlay.js +1 -1
  37. package/dist/portal.js +1 -1
  38. package/dist/slash-command-menu.js +1 -1
  39. package/package.json +7 -14
  40. package/dist/action-menu-list/hooks.d.ts +0 -912
  41. package/dist/action-menu-list/hooks.d.ts.map +0 -1
  42. package/dist/action-menu-list/store.d.ts +0 -22
  43. package/dist/action-menu-list/store.d.ts.map +0 -1
  44. package/dist/action-menu-list/store.test.d.ts +0 -2
  45. package/dist/action-menu-list/store.test.d.ts.map +0 -1
  46. package/dist/chunks/hooks-814f49b9.js +0 -1
  47. package/dist/chunks/hooks-ad9169d0.js +0 -1
  48. package/dist/chunks/index-06d5c4e7.js +0 -10
  49. package/dist/floating-block-actions/store.d.ts +0 -19
  50. package/dist/floating-block-actions/store.d.ts.map +0 -1
  51. package/dist/floating-block-actions/store.test.d.ts +0 -2
  52. package/dist/floating-block-actions/store.test.d.ts.map +0 -1
  53. package/dist/theme/ThemeProvider.d.ts +0 -16
  54. package/dist/theme/ThemeProvider.d.ts.map +0 -1
  55. package/dist/theme/ThemeToggle.d.ts +0 -6
  56. package/dist/theme/ThemeToggle.d.ts.map +0 -1
  57. package/dist/theme/index.d.ts +0 -5
  58. package/dist/theme/index.d.ts.map +0 -1
  59. package/dist/theme/useTheme.d.ts +0 -8
  60. package/dist/theme/useTheme.d.ts.map +0 -1
  61. package/dist/theme.js +0 -1
  62. package/dist/toolbar/hooks.d.ts +0 -879
  63. package/dist/toolbar/hooks.d.ts.map +0 -1
  64. package/dist/toolbar/index.d.ts +0 -6
  65. package/dist/toolbar/index.d.ts.map +0 -1
  66. package/dist/toolbar/store.d.ts +0 -12
  67. package/dist/toolbar/store.d.ts.map +0 -1
  68. package/dist/toolbar/store.test.d.ts +0 -2
  69. package/dist/toolbar/store.test.d.ts.map +0 -1
  70. package/dist/toolbar/toolbar.d.ts +0 -20
  71. package/dist/toolbar/toolbar.d.ts.map +0 -1
  72. package/dist/toolbar.js +0 -1
@@ -1,27 +1,63 @@
1
- import type { CSSProperties, HTMLAttributes, ReactNode } from 'react';
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ import type { Placement } from '@floating-ui/react';
2
3
  import type { ActionMenuItem } from './types';
3
- export type ActionMenuListRootProps = HTMLAttributes<HTMLDivElement> & {
4
- children: ReactNode;
5
- style?: CSSProperties;
4
+ import './action-menu-list.css';
5
+ type ActionMenuListApi = {
6
+ /** Available actions from editor plugins */
7
+ actions: ActionMenuItem[];
8
+ /** Currently selected action */
9
+ selectedAction: ActionMenuItem | null;
10
+ /** Execute action (toggle block type) */
11
+ onSelect: (type: string) => void;
12
+ /** Whether actions list is empty */
13
+ empty: boolean;
6
14
  };
7
- export type ActionMenuListGroupProps = HTMLAttributes<HTMLDivElement>;
8
- export type ActionMenuListItemProps = HTMLAttributes<HTMLButtonElement> & {
9
- action: ActionMenuItem;
15
+ type ActionMenuListRootProps = {
16
+ children: ReactNode | ((api: ActionMenuListApi) => ReactNode);
17
+ /** Controlled open state */
18
+ open?: boolean;
19
+ /** Callback when open state changes */
20
+ onOpenChange?: (open: boolean) => void;
21
+ /** Default open state for uncontrolled usage */
22
+ defaultOpen?: boolean;
23
+ /** Anchor element for positioning */
24
+ anchor?: HTMLElement | null;
25
+ /** View mode - 'small' for compact, 'default' for full */
26
+ view?: 'small' | 'default';
27
+ /** Placement relative to anchor */
28
+ placement?: Placement;
29
+ className?: string;
30
+ };
31
+ type ActionMenuListContentProps = {
32
+ children?: ReactNode;
33
+ className?: string;
34
+ } & HTMLAttributes<HTMLDivElement>;
35
+ type ActionMenuListGroupProps = HTMLAttributes<HTMLDivElement>;
36
+ type ActionMenuListItemProps = HTMLAttributes<HTMLButtonElement> & {
37
+ action?: ActionMenuItem;
10
38
  selected?: boolean;
11
39
  icon?: string | ReactNode;
12
40
  };
13
- export type ActionMenuListEmptyProps = HTMLAttributes<HTMLDivElement>;
41
+ type ActionMenuListEmptyProps = HTMLAttributes<HTMLDivElement>;
14
42
  export declare const ActionMenuList: {
15
- Root: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
16
- children: ReactNode;
17
- style?: CSSProperties | undefined;
18
- } & import("react").RefAttributes<HTMLDivElement>>;
43
+ ({ children, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, anchor, view, placement, className, }: ActionMenuListRootProps): import("react/jsx-runtime").JSX.Element;
44
+ displayName: string;
45
+ } & {
46
+ Root: {
47
+ ({ children, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, anchor, view, placement, className, }: ActionMenuListRootProps): import("react/jsx-runtime").JSX.Element;
48
+ displayName: string;
49
+ };
50
+ Content: import("react").ForwardRefExoticComponent<{
51
+ children?: ReactNode;
52
+ className?: string | undefined;
53
+ } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
19
54
  Group: import("react").ForwardRefExoticComponent<ActionMenuListGroupProps & import("react").RefAttributes<HTMLDivElement>>;
20
55
  Item: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & {
21
- action: ActionMenuItem;
56
+ action?: ActionMenuItem | undefined;
22
57
  selected?: boolean | undefined;
23
58
  icon?: string | ReactNode;
24
59
  } & import("react").RefAttributes<HTMLButtonElement>>;
25
60
  Empty: import("react").ForwardRefExoticComponent<ActionMenuListEmptyProps & import("react").RefAttributes<HTMLDivElement>>;
26
61
  };
62
+ export type { ActionMenuListRootProps, ActionMenuListContentProps, ActionMenuListGroupProps, ActionMenuListItemProps, ActionMenuListEmptyProps, ActionMenuListApi, };
27
63
  //# sourceMappingURL=action-menu-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-menu-list.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/action-menu-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACrE,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAsBF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AActE,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,iBAAiB,CAAC,GAAG;IACxE,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AA0CF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAWtE,eAAO,MAAM,cAAc;;kBA/Ff,SAAS;;;;;gBAuCX,cAAc;;eAEf,MAAM,GAAG,SAAS;;;CA2D1B,CAAC"}
1
+ {"version":3,"file":"action-menu-list.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/action-menu-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,OAAO,wBAAwB,CAAC;AAEhC,KAAK,iBAAiB,GAAG;IACvB,4CAA4C;IAC5C,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,gCAAgC;IAChC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,yCAAyC;IACzC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,oCAAoC;IACpC,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,iBAAiB,KAAK,SAAS,CAAC,CAAC;IAC9D,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qCAAqC;IACrC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,mCAAmC;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA+GF,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAuDnC,KAAK,wBAAwB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAY/D,KAAK,uBAAuB,GAAG,cAAc,CAAC,iBAAiB,CAAC,GAAG;IACjE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAgDF,KAAK,wBAAwB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAY/D,eAAO,MAAM,cAAc;iIA1OxB,uBAAuB;;;;qIAAvB,uBAAuB;;;;mBAqGb,SAAS;;;;;;;eAwEb,MAAM,GAAG,SAAS;;;CAmEzB,CAAC;AAEH,YAAY,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,GAClB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { ActionMenuItem } from './types';
3
+ export type ActionMenuListContextValue = {
4
+ /** Whether menu is open */
5
+ isOpen: boolean;
6
+ /** Current view mode */
7
+ view: 'small' | 'default';
8
+ /** Available actions from editor plugins */
9
+ actions: ActionMenuItem[];
10
+ /** Currently selected/hovered action */
11
+ selectedAction: ActionMenuItem | null;
12
+ /** Select an action (hover) */
13
+ setSelectedAction: (action: ActionMenuItem) => void;
14
+ /** Execute action (toggle block) */
15
+ onSelect: (type: string) => void;
16
+ /** Close the menu */
17
+ close: () => void;
18
+ /** Floating styles for positioning */
19
+ floatingStyles: CSSProperties;
20
+ /** Ref setter for floating element */
21
+ setFloatingRef: (node: HTMLElement | null) => void;
22
+ };
23
+ export declare const ActionMenuListContext: import("react").Context<ActionMenuListContextValue | null>;
24
+ export declare const useActionMenuListContext: () => ActionMenuListContextValue;
25
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,0BAA0B,GAAG;IACvC,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,wBAAwB;IACxB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,4CAA4C;IAC5C,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,wCAAwC;IACxC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,+BAA+B;IAC/B,iBAAiB,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACpD,oCAAoC;IACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,qBAAqB;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,sCAAsC;IACtC,cAAc,EAAE,aAAa,CAAC;IAC9B,sCAAsC;IACtC,cAAc,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,qBAAqB,4DAAyD,CAAC;AAE5F,eAAO,MAAM,wBAAwB,kCAQpC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export { ActionMenuList } from './action-menu-list';
2
- export { useActionMenuList, useActionMenuListActions } from './hooks';
3
- export { useActionMenuListStore } from './store';
4
- export type { ActionMenuListStore, ActionMenuListState } from './store';
5
- export type { ActionMenuItem, ActionMenuListProps, ActionMenuRenderProps } from './types';
6
- import './action-menu-list.css';
2
+ export type { ActionMenuListApi, ActionMenuListContentProps, ActionMenuListEmptyProps, ActionMenuListGroupProps, ActionMenuListItemProps, ActionMenuListRootProps, } from './action-menu-list';
3
+ export { useActionMenuListContext } from './context';
4
+ export type { ActionMenuItem } from './types';
5
+ export type { ActionMenuListContextValue } from './context';
6
+ export { filterToggleActions, mapActionMenuItems } from './utils';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACxE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE1F,OAAO,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAGrD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,YAAY,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAG5D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Plugin, SlateElement, YooEditor } from '@yoopta/editor';
1
+ import type { YooEditor } from '@yoopta/editor';
2
2
  import type { ActionMenuItem } from './types';
3
3
  export declare const filterActionMenuItems: (blockPlugin: Plugin<Record<string, SlateElement>, unknown>, searchText: string) => boolean;
4
4
  export declare function mapActionMenuItems(editor: YooEditor): ActionMenuItem[];
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAgC,MAAM,gBAAgB,CAAC;AAEpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsB9C,eAAO,MAAM,qBAAqB,gBACnB,OAAO,OAAO,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,cAC9C,MAAM,KACjB,OAuBF,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,EAAE,CAkCtE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAOlE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAS5D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/action-menu-list/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,SAAS,EAAgC,MAAM,gBAAgB,CAAC;AAEpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsB9C,eAAO,MAAM,qBAAqB,2EAEpB,MAAM,KACjB,OAuBF,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,EAAE,CAkCtE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAOlE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAS5D"}
@@ -1 +1 @@
1
- export{A as ActionMenuList,u as useActionMenuList,a as useActionMenuListActions,b as useActionMenuListStore}from"./chunks/hooks-814f49b9.js";import{s as o}from"./chunks/style-inject.es-e87a8d02.js";import"./chunks/_tslib-5e145dfd.js";import"react/jsx-runtime";import"react";import"./chunks/floating-ui.react-33212df0.js";import"react-dom";import"@yoopta/editor";import"./chunks/index-06d5c4e7.js";o(".yoopta-ui-action-menu-list{bottom:auto;left:0;margin:0;position:absolute;right:auto;top:0;z-index:var(--yoopta-ui-action-menu-z-index,9999)}.yoopta-ui-action-menu-list-content{background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-radius,.5rem);box-shadow:var(\n --yoopta-ui-action-menu-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)\n );max-height:var(--yoopta-ui-action-menu-max-height,330px);overflow-x:hidden;overflow-y:auto;padding:var(--yoopta-ui-action-menu-padding,.5rem);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-ui-action-menu-list-group{color:hsl(var(--yoopta-ui-foreground));overflow:hidden;padding:0}.yoopta-ui-action-menu-list-item{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-action-menu-item-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:flex;font-size:var(--yoopta-ui-action-menu-item-font-size,.875rem);gap:var(--yoopta-ui-action-menu-item-gap,.5rem);margin-bottom:.125rem;outline:none;padding:var(--yoopta-ui-action-menu-item-padding,.5rem);text-align:left;transition:background-color .15s ease-out;width:100%}.yoopta-ui-action-menu-list-item:last-child{margin-bottom:0}.yoopta-ui-action-menu-list-item:hover,.yoopta-ui-action-menu-list-item[aria-selected=true]{background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-action-menu-list-item:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:2px}.yoopta-ui-action-menu-list-item-icon{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-icon-radius,.375rem);display:flex;flex-shrink:0;justify-content:center}.yoopta-ui-action-menu-list-item-icon img,.yoopta-ui-action-menu-list-item-icon svg{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.yoopta-ui-action-menu-list-item-content{flex:1;min-width:0}.yoopta-ui-action-menu-list-item-title{font-weight:500;line-height:1.25}.yoopta-ui-action-menu-list-item-description{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-item-description-font-size,.75rem);line-height:1.25;margin-top:.125rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yoopta-ui-action-menu-list-empty{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-empty-font-size,.75rem);padding:var(--yoopta-ui-action-menu-empty-padding,.5rem);text-align:left}.yoopta-ui-action-menu-list-content::-webkit-scrollbar{width:8px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-track{background:transparent}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb{background:hsl(var(--yoopta-ui-border));border-radius:4px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb:hover{background:hsl(var(--yoopta-ui-muted-foreground))}");
1
+ import{_ as t}from"./chunks/_tslib-5e145dfd.js";import{jsx as i,jsxs as e,Fragment as o}from"react/jsx-runtime";import{createContext as n,useContext as a,forwardRef as s,useState as l,useMemo as r,useCallback as c,isValidElement as u,cloneElement as p}from"react";import{d as m,u as d,f as y,s as g,o as h,a as v,c as f}from"./chunks/floating-ui.react-727e4287.js";import{Blocks as b,getAllowedPluginsFromElement as x,getRootBlockElement as w,useYooptaEditor as k}from"@yoopta/editor";import{s as j}from"./chunks/style-inject.es-e87a8d02.js";import{Portal as N}from"./portal.js";import{Overlay as O}from"./overlay.js";import"react-dom";const A=n(null),z=()=>{const t=a(A);if(!t)throw new Error("ActionMenuList components must be used within <ActionMenuList>");return t};function M(t){const i=Object.keys(t.plugins);let e=null;if("number"==typeof t.path.current){const i=b.getBlockSlate(t,{at:t.path.current});i&&(e=x(t,i))}let o=i;return e&&e.length>0&&(o="string"==typeof i[0]?i.filter(t=>e.includes(t)):i.filter(t=>e.includes(t.type))),o.map(i=>{var e,o,n,a,s,l;if("string"==typeof i){return{type:i,title:(null===(o=null===(e=t.plugins[i].options)||void 0===e?void 0:e.display)||void 0===o?void 0:o.title)||i,description:null===(a=null===(n=t.plugins[i].options)||void 0===n?void 0:n.display)||void 0===a?void 0:a.description,icon:null===(l=null===(s=t.plugins[i].options)||void 0===s?void 0:s.display)||void 0===l?void 0:l.icon}}return i})}function S(t,i){var e;const o=t.plugins[i];if(!o)return!1;const n=w(o.elements);return"void"!==(null===(e=null==n?void 0:n.props)||void 0===e?void 0:e.nodeType)}j(".yoopta-ui-action-menu-list-overlay{background:transparent;z-index:var(--yoopta-ui-action-menu-z-index,9999)}.yoopta-ui-action-menu-list{bottom:auto;left:0;margin:0;position:absolute;right:auto;top:0;z-index:var(--yoopta-ui-action-menu-z-index,9999)}.yoopta-ui-action-menu-list-content{background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-radius,.5rem);box-shadow:var(\n --yoopta-ui-action-menu-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)\n );max-height:var(--yoopta-ui-action-menu-max-height,330px);overflow-x:hidden;overflow-y:auto;padding:var(--yoopta-ui-action-menu-padding,.5rem);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-ui-action-menu-list-group{color:hsl(var(--yoopta-ui-foreground));overflow:hidden;padding:0}.yoopta-ui-action-menu-list-item{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-action-menu-item-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:flex;font-size:var(--yoopta-ui-action-menu-item-font-size,.875rem);gap:var(--yoopta-ui-action-menu-item-gap,.5rem);margin-bottom:.125rem;outline:none;padding:var(--yoopta-ui-action-menu-item-padding,.5rem);text-align:left;transition:background-color .15s ease-out;width:100%}.yoopta-ui-action-menu-list-item:last-child{margin-bottom:0}.yoopta-ui-action-menu-list-item:hover,.yoopta-ui-action-menu-list-item[data-selected=true]{background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-action-menu-list-item:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:2px}.yoopta-ui-action-menu-list-item-icon{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-icon-radius,.375rem);display:flex;flex-shrink:0;justify-content:center}.yoopta-ui-action-menu-list-item-icon img,.yoopta-ui-action-menu-list-item-icon svg{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.yoopta-ui-action-menu-list-item-content{flex:1;min-width:0}.yoopta-ui-action-menu-list-item-title{font-weight:500;line-height:1.25}.yoopta-ui-action-menu-list-item-description{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-item-description-font-size,.75rem);line-height:1.25;margin-top:.125rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yoopta-ui-action-menu-list-empty{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-empty-font-size,.75rem);padding:var(--yoopta-ui-action-menu-empty-padding,.5rem);text-align:left}.yoopta-ui-action-menu-list-small{max-height:280px;min-width:180px;padding:.375rem}.yoopta-ui-action-menu-list-small .yoopta-ui-action-menu-list-item{font-size:.8125rem;gap:.375rem;padding:.375rem .5rem}.yoopta-ui-action-menu-list-small .yoopta-ui-action-menu-list-item-icon{height:20px;padding:2px;width:20px}.yoopta-ui-action-menu-list-small .yoopta-ui-action-menu-list-item-title{font-size:.8125rem}.yoopta-ui-action-menu-list-small .yoopta-ui-action-menu-list-item-description{display:none}.yoopta-ui-action-menu-list-default{min-width:244px}.yoopta-ui-action-menu-list-default .yoopta-ui-action-menu-list-item-icon{height:40px;padding:6px;width:40px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar{width:8px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-track{background:transparent}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb{background:hsl(var(--yoopta-ui-border));border-radius:4px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb:hover{background:hsl(var(--yoopta-ui-muted-foreground))}");const C=({children:t,open:e,onOpenChange:o,defaultOpen:n=!1,anchor:a=null,view:s="default",placement:u="bottom-start",className:p=""})=>{var m;const b=k(),[x,w]=l(n),j=void 0!==e,N=j?e:x,O=r(()=>M(b).filter(t=>S(b,t.type)),[b]),[z,C]=l(null!==(m=O[0])&&void 0!==m?m:null),{refs:L,floatingStyles:E,context:$}=d({elements:{reference:a},placement:u,open:N,middleware:[y(),g(),h(10)],whileElementsMounted:v}),{isMounted:F,styles:B}=f($,{duration:100}),I=r(()=>Object.assign(Object.assign(Object.assign({},E),B),{minWidth:"small"===s?200:244}),[E,B,s]),P=c(()=>{var t;j||w(!1),null==o||o(!1),C(null!==(t=O[0])&&void 0!==t?t:null)},[j,o,O]),R=c(t=>{Array.isArray(b.path.selected)&&b.path.selected.length>0?b.batchOperations(()=>{b.path.selected.forEach(i=>{b.toggleBlock(t,{preserveContent:!0,focus:!0,at:i})})}):b.toggleBlock(t,{preserveContent:!0,focus:!0,at:b.path.current}),P()},[b,P]),G=r(()=>({isOpen:F,view:s,actions:O,selectedAction:z,setSelectedAction:C,onSelect:R,close:P,floatingStyles:I,setFloatingRef:L.setFloating}),[F,s,O,z,R,P,I,L.setFloating]),_={actions:O,selectedAction:z,onSelect:R,empty:0===O.length},D="function"==typeof t?t(_):t;return i(A.Provider,Object.assign({value:G},{children:i("div",Object.assign({className:p},{children:D}))}))};C.displayName="ActionMenuList";const L=s((e,o)=>{var{children:n,className:a=""}=e,s=t(e,["children","className"]);const{isOpen:l,floatingStyles:r,setFloatingRef:c,actions:u,selectedAction:p,setSelectedAction:d,onSelect:y,view:g,close:h}=z(),v=m([o,c]);if(!l)return null;const f=null!=n?n:0===u.length?i(F,{}):i(E,{children:u.map(t=>i($,{action:t,selected:t.type===(null==p?void 0:p.type),onMouseEnter:()=>d(t),onClick:()=>y(t.type)},t.type))});return i(N,Object.assign({id:"yoopta-ui-action-menu-list-portal"},{children:i(O,Object.assign({lockScroll:!1,onClick:h,className:"yoopta-ui-action-menu-list-overlay"},{children:i("div",Object.assign({ref:v,role:"listbox",tabIndex:0,className:`yoopta-ui-action-menu-list-content yoopta-ui-action-menu-list-${g} ${a}`,style:r,onMouseDown:t=>t.stopPropagation(),onClick:t=>t.stopPropagation()},s,{children:f}))}))}))});L.displayName="ActionMenuList.Content";const E=s((e,o)=>{var{children:n,className:a=""}=e,s=t(e,["children","className"]);return i("div",Object.assign({ref:o,className:`yoopta-ui-action-menu-list-group ${a}`},s,{children:n}))});E.displayName="ActionMenuList.Group";const $=s((n,a)=>{var{action:s,selected:l,icon:r,className:c="",children:m}=n,d=t(n,["action","selected","icon","className","children"]);const y=null!=r?r:null==s?void 0:s.icon;return e("button",Object.assign({ref:a,type:"button",className:`yoopta-ui-action-menu-list-item ${l?"selected":""} ${c}`,"data-action-menu-item-type":null==s?void 0:s.type,"data-selected":l,"aria-pressed":l},d,{children:[s&&e(o,{children:[y&&i("div",Object.assign({className:"yoopta-ui-action-menu-list-item-icon"},{children:(t=>{if(!t)return null;if("string"==typeof t)return i("img",{src:t,alt:"icon"});if(u(t))return p(t);return i(t,{})})(y)})),e("div",Object.assign({className:"yoopta-ui-action-menu-list-item-content"},{children:[i("div",Object.assign({className:"yoopta-ui-action-menu-list-item-title"},{children:null==s?void 0:s.title})),(null==s?void 0:s.description)&&i("div",Object.assign({className:"yoopta-ui-action-menu-list-item-description"},{children:null==s?void 0:s.description}))]}))]}),m]}))});$.displayName="ActionMenuList.Item";const F=s((e,o)=>{var{children:n,className:a=""}=e,s=t(e,["children","className"]);return i("div",Object.assign({ref:o,className:`yoopta-ui-action-menu-list-empty ${a}`},s,{children:null!=n?n:"No actions available"}))});F.displayName="ActionMenuList.Empty";const B=Object.assign(C,{Root:C,Content:L,Group:E,Item:$,Empty:F});export{B as ActionMenuList,S as filterToggleActions,M as mapActionMenuItems,z as useActionMenuListContext};
@@ -1 +1 @@
1
- {"version":3,"file":"block-options.d.ts","sourceRoot":"","sources":["../../src/block-options/block-options.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAkBpE,OAAO,qBAAqB,CAAC;AAM7B,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AACrD,KAAK,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExC,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B,CAAC;AAiDF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA0CF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAYF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,oCAAoC;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oCAAoC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAuEF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAgBF,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qBAAqB;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACpC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,CAAC;AA8CpE,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAcF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAgBF,eAAO,MAAM,YAAY;qGAtStB,qBAAqB;;;;yGAArB,qBAAqB;;;;;uBA4FkB,uBAAuB;;;;;;kBA+GrD,SAAS;QACnB,mCAAmC;4BAChB,gBAAgB,KAAK,IAAI;;;eAGrC,SAAS;QAChB,qBAAqB;;QAErB,qCAAqC;;;;;CA4FrC,CAAC;AAEH,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,GACvB,CAAC"}
1
+ {"version":3,"file":"block-options.d.ts","sourceRoot":"","sources":["../../src/block-options/block-options.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAkBpE,OAAO,qBAAqB,CAAC;AAE7B,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AACrD,KAAK,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExC,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B,CAAC;AA6CF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsCF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAQF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,oCAAoC;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oCAAoC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAmEF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAYF,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qBAAqB;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACpC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,CAAC;AA0CpE,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAUF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAYF,eAAO,MAAM,YAAY;qGAtQtB,qBAAqB;;;;yGAArB,qBAAqB;;;;;uBAoFkB,uBAAuB;;;;;;kBAmGrD,SAAS;QACnB,mCAAmC;4BAChB,gBAAgB,KAAK,IAAI;;;eAGrC,SAAS;QAChB,qBAAqB;;QAErB,qCAAqC;;;;;CAgFrC,CAAC;AAEH,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,GACvB,CAAC"}
@@ -1 +1 @@
1
- import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{createContext as n,useContext as e,forwardRef as a,useCallback as r,isValidElement as s,cloneElement as p,useState as c,useMemo as l}from"react";import{d as u,u as b,b as d,e as y,g as k,F as g,h,o as m,f as v,s as x,a as f}from"./chunks/floating-ui.react-33212df0.js";import{s as O}from"./chunks/style-inject.es-e87a8d02.js";import{Overlay as w}from"./overlay.js";import{Portal as j}from"./portal.js";import{useYooptaEditor as N}from"@yoopta/editor";import"react-dom";const B=n(null),C=()=>{const o=e(B);if(!o)throw new Error("BlockOptions components must be used within <BlockOptions>");return o};O(":root{--yoopta-ui-block-options-bg:var(--yoopta-ui-background);--yoopta-ui-block-options-border:var(--yoopta-ui-border);--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--yoopta-ui-block-options-radius:0.5rem;--yoopta-ui-block-options-padding:4px;--yoopta-ui-block-options-min-width:220px;--yoopta-ui-block-options-z-index:200;--yoopta-ui-block-options-group-gap:1px;--yoopta-ui-block-options-button-padding-y:8px;--yoopta-ui-block-options-button-padding-x:12px;--yoopta-ui-block-options-button-font-size:0.875rem;--yoopta-ui-block-options-button-line-height:1.25rem;--yoopta-ui-block-options-button-color:var(--yoopta-ui-foreground);--yoopta-ui-block-options-button-bg:transparent;--yoopta-ui-block-options-button-hover:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-active:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-radius:0.375rem;--yoopta-ui-destructive:0 84.2% 60.2%;--yoopta-ui-destructive-foreground:210 40% 98%;--yoopta-ui-block-options-button-destructive-color:hsl(var(--yoopta-ui-destructive));--yoopta-ui-block-options-button-destructive-hover:hsl(var(--yoopta-ui-destructive)/0.1);--yoopta-ui-block-options-icon-size:1rem;--yoopta-ui-block-options-icon-gap:8px;--yoopta-ui-block-options-separator-color:var(--yoopta-ui-border);--yoopta-ui-block-options-separator-height:1px;--yoopta-ui-block-options-separator-margin:4px 0;--yoopta-ui-block-options-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out}.dark,[data-theme=dark],[data-yoopta-theme=dark]{--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}.yoopta-ui-block-options{background-color:hsl(var(--yoopta-ui-block-options-bg));border:1px solid hsl(var(--yoopta-ui-block-options-border));border-radius:var(--yoopta-ui-block-options-radius);box-shadow:var(--yoopta-ui-block-options-shadow);min-width:var(--yoopta-ui-block-options-min-width);padding:var(--yoopta-ui-block-options-padding);position:fixed;z-index:var(--yoopta-ui-block-options-z-index)}.yoopta-ui-block-options-content{display:flex;flex-direction:column;gap:var(--yoopta-ui-block-options-group-gap)}.yoopta-ui-block-options-group{display:flex;flex-direction:column;gap:1px}.yoopta-ui-block-options-button{align-items:center;background-color:var(--yoopta-ui-block-options-button-bg);border:none;border-radius:var(--yoopta-ui-block-options-button-radius);color:hsl(var(--yoopta-ui-block-options-button-color));cursor:pointer;display:flex;font-size:var(--yoopta-ui-block-options-button-font-size);font-weight:400;line-height:var(--yoopta-ui-block-options-button-line-height);outline:none;padding:var(--yoopta-ui-block-options-button-padding-y) var(--yoopta-ui-block-options-button-padding-x);text-align:left;transition:var(--yoopta-ui-block-options-transition);-moz-user-select:none;user-select:none;-webkit-user-select:none;width:100%}.yoopta-ui-block-options-button:hover{background-color:hsl(var(--yoopta-ui-block-options-button-hover));color:hsl(var(--yoopta-ui-accent-foreground))}.yoopta-ui-block-options-button:active{background-color:hsl(var(--yoopta-ui-block-options-button-active))}.yoopta-ui-block-options-button:focus-visible{box-shadow:0 0 0 2px hsl(var(--yoopta-ui-background)),0 0 0 4px hsl(var(--yoopta-ui-ring));outline:none}.yoopta-ui-block-options-button:disabled{opacity:.5;pointer-events:none}.yoopta-ui-block-options-button-destructive{color:var(--yoopta-ui-block-options-button-destructive-color)}.yoopta-ui-block-options-button-destructive:hover{background-color:var(--yoopta-ui-block-options-button-destructive-hover);color:hsl(var(--yoopta-ui-destructive))}.yoopta-ui-block-options-button-icon{align-items:center;display:inline-flex;flex-shrink:0;justify-content:center;margin-right:var(--yoopta-ui-block-options-icon-gap)}.yoopta-ui-block-options-button-icon svg{height:var(--yoopta-ui-block-options-icon-size);width:var(--yoopta-ui-block-options-icon-size)}.yoopta-ui-block-options-button-text{flex:1}.yoopta-ui-block-options-separator{background-color:hsl(var(--yoopta-ui-block-options-separator-color));height:var(--yoopta-ui-block-options-separator-height);margin:var(--yoopta-ui-block-options-separator-margin)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}}");const $=({children:o,open:i,onOpenChange:n,defaultOpen:e=!1,anchor:a=null})=>{const[s,p]=c(e),[u,b]=c(null),d=h(),y=void 0!==i,k=y?i:s,g=null!=a?a:u,m=r(o=>{y||p(o),null==n||n(o)},[y,n]),v=l(()=>({open:k,onOpenChange:m,triggerRef:g,setTriggerRef:b,contentId:d}),[k,m,g,d]);return t(B.Provider,Object.assign({value:v},{children:o}))};$.displayName="BlockOptions";const z=a(({children:o,asChild:i=!1,className:n=""},e)=>{const{open:a,onOpenChange:c,setTriggerRef:l,contentId:b}=C(),d=r(o=>{o.stopPropagation(),c(!a)},[a,c]),y={ref:u([e,l]),onClick:d,"aria-expanded":a,"aria-haspopup":"menu","aria-controls":a?b:void 0};return i&&s(o)?p(o,y):t("button",Object.assign({type:"button",className:`yoopta-ui-block-options-trigger ${n}`},y,{children:o}))});z.displayName="BlockOptions.Trigger";const I=({children:o})=>t(j,Object.assign({id:"yoopta-ui-block-options-portal"},{children:o}));I.displayName="BlockOptions.Portal";const P=a(({children:o,className:i="",style:n,side:e="right",align:a="start",sideOffset:r=5},s)=>{const{open:p,onOpenChange:c,triggerRef:l,contentId:h}=C(),O="center"===a?e:`${e}-${a}`,{refs:j,floatingStyles:N,context:B}=b({elements:{reference:l},placement:O,open:p,onOpenChange:c,middleware:[m(r),v(),x({padding:8})],whileElementsMounted:f,strategy:"fixed"}),{isMounted:$,styles:z}=d(B,{duration:150,initial:{opacity:0},open:{opacity:1},close:{opacity:0}}),P=y(B,{outsidePress:!0,escapeKey:!0}),{getFloatingProps:E}=k([P]),S=u([j.setFloating,s]);return $?t(I,{children:t(w,Object.assign({lockScroll:!1,onClick:()=>c(!1)},{children:t(g,Object.assign({context:B,modal:!1},{children:t("div",Object.assign({ref:S,id:h,role:"menu","aria-orientation":"vertical",className:`yoopta-ui-block-options ${i}`,style:Object.assign(Object.assign(Object.assign({},N),z),n),contentEditable:!1},E({onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()}),{children:o}))}))}))}):null});P.displayName="BlockOptions.Content";const E=a(({children:o,className:i=""},n)=>t("div",Object.assign({ref:n,role:"group",className:`yoopta-ui-block-options-group ${i}`},{children:o})));E.displayName="BlockOptions.Group";const S=a((n,e)=>{var{children:a,onSelect:s,className:p="",disabled:c,icon:l,variant:u="default",keepOpen:b=!1}=n,d=o(n,["children","onSelect","className","disabled","icon","variant","keepOpen"]);const{onOpenChange:y}=C(),k=r(o=>{c||(null==s||s(o),b||y(!1))},[c,s,y,b]);return i("button",Object.assign({ref:e,type:"button",role:"menuitem",disabled:c,className:`yoopta-ui-block-options-button yoopta-ui-block-options-button-${u} ${p}`,onClick:k},d,{children:[l&&t("span",Object.assign({className:"yoopta-ui-block-options-button-icon"},{children:l})),t("span",Object.assign({className:"yoopta-ui-block-options-button-text"},{children:a}))]}))});S.displayName="BlockOptions.Item";const T=a(({className:o=""},i)=>t("div",{ref:i,role:"separator",className:`yoopta-ui-block-options-separator ${o}`}));T.displayName="BlockOptions.Separator";const R=a(({children:o,className:i=""},n)=>t("div",Object.assign({ref:n,className:`yoopta-ui-block-options-label ${i}`},{children:o})));R.displayName="BlockOptions.Label";const D=Object.assign($,{Root:$,Trigger:z,Portal:I,Content:P,Group:E,Item:S,Separator:T,Label:R}),q=()=>{const o=N();return{duplicateBlock:r(t=>{if(!t)throw new Error("Block ID is required to duplicate block");o.duplicateBlock({blockId:t,focus:!0})},[o]),copyBlockLink:r(t=>{var i;if(!t)throw new Error("Block ID is required to copy block link");const n=o.children[t];if(n){const t=`${window.location.origin}${window.location.pathname}#${n.id}`;if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t);else{const o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}null===(i=o.emit)||void 0===i||i.call(o,"block:copy",n)}},[o]),deleteBlock:r(t=>{if(!t)throw new Error("Block ID is required to delete block");o.deleteBlock({blockId:t}),o.setPath({current:null})},[o])}};export{D as BlockOptions,q as useBlockActions,C as useBlockOptionsContext};
1
+ import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{createContext as n,useContext as e,forwardRef as a,useCallback as r,isValidElement as s,cloneElement as p,useState as c,useMemo as l}from"react";import{d as u,u as b,c as d,e as y,g as k,F as g,h,o as m,f as v,s as x,a as f}from"./chunks/floating-ui.react-727e4287.js";import{s as O}from"./chunks/style-inject.es-e87a8d02.js";import{Overlay as w}from"./overlay.js";import{Portal as j}from"./portal.js";import{useYooptaEditor as N}from"@yoopta/editor";import"react-dom";const B=n(null),C=()=>{const o=e(B);if(!o)throw new Error("BlockOptions components must be used within <BlockOptions>");return o};O(":root{--yoopta-ui-block-options-bg:var(--yoopta-ui-background);--yoopta-ui-block-options-border:var(--yoopta-ui-border);--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--yoopta-ui-block-options-radius:0.5rem;--yoopta-ui-block-options-padding:4px;--yoopta-ui-block-options-min-width:220px;--yoopta-ui-block-options-z-index:200;--yoopta-ui-block-options-group-gap:1px;--yoopta-ui-block-options-button-padding-y:8px;--yoopta-ui-block-options-button-padding-x:12px;--yoopta-ui-block-options-button-font-size:0.875rem;--yoopta-ui-block-options-button-line-height:1.25rem;--yoopta-ui-block-options-button-color:var(--yoopta-ui-foreground);--yoopta-ui-block-options-button-bg:transparent;--yoopta-ui-block-options-button-hover:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-active:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-radius:0.375rem;--yoopta-ui-destructive:0 84.2% 60.2%;--yoopta-ui-destructive-foreground:210 40% 98%;--yoopta-ui-block-options-button-destructive-color:hsl(var(--yoopta-ui-destructive));--yoopta-ui-block-options-button-destructive-hover:hsl(var(--yoopta-ui-destructive)/0.1);--yoopta-ui-block-options-icon-size:1rem;--yoopta-ui-block-options-icon-gap:8px;--yoopta-ui-block-options-separator-color:var(--yoopta-ui-border);--yoopta-ui-block-options-separator-height:1px;--yoopta-ui-block-options-separator-margin:4px 0;--yoopta-ui-block-options-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out}.dark,[data-theme=dark],[data-yoopta-theme=dark]{--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}.yoopta-ui-block-options{background-color:hsl(var(--yoopta-ui-block-options-bg));border:1px solid hsl(var(--yoopta-ui-block-options-border));border-radius:var(--yoopta-ui-block-options-radius);box-shadow:var(--yoopta-ui-block-options-shadow);min-width:var(--yoopta-ui-block-options-min-width);padding:var(--yoopta-ui-block-options-padding);position:fixed;z-index:var(--yoopta-ui-block-options-z-index)}.yoopta-ui-block-options-content{display:flex;flex-direction:column;gap:var(--yoopta-ui-block-options-group-gap)}.yoopta-ui-block-options-group{display:flex;flex-direction:column;gap:1px}.yoopta-ui-block-options-button{align-items:center;background-color:var(--yoopta-ui-block-options-button-bg);border:none;border-radius:var(--yoopta-ui-block-options-button-radius);color:hsl(var(--yoopta-ui-block-options-button-color));cursor:pointer;display:flex;font-size:var(--yoopta-ui-block-options-button-font-size);font-weight:400;line-height:var(--yoopta-ui-block-options-button-line-height);outline:none;padding:var(--yoopta-ui-block-options-button-padding-y) var(--yoopta-ui-block-options-button-padding-x);text-align:left;transition:var(--yoopta-ui-block-options-transition);-moz-user-select:none;user-select:none;-webkit-user-select:none;width:100%}.yoopta-ui-block-options-button:hover{background-color:hsl(var(--yoopta-ui-block-options-button-hover));color:hsl(var(--yoopta-ui-accent-foreground))}.yoopta-ui-block-options-button:active{background-color:hsl(var(--yoopta-ui-block-options-button-active))}.yoopta-ui-block-options-button:focus-visible{box-shadow:0 0 0 2px hsl(var(--yoopta-ui-background)),0 0 0 4px hsl(var(--yoopta-ui-ring));outline:none}.yoopta-ui-block-options-button:disabled{opacity:.5;pointer-events:none}.yoopta-ui-block-options-button-destructive{color:var(--yoopta-ui-block-options-button-destructive-color)}.yoopta-ui-block-options-button-destructive:hover{background-color:var(--yoopta-ui-block-options-button-destructive-hover);color:hsl(var(--yoopta-ui-destructive))}.yoopta-ui-block-options-button-icon{align-items:center;display:inline-flex;flex-shrink:0;justify-content:center;margin-right:var(--yoopta-ui-block-options-icon-gap)}.yoopta-ui-block-options-button-icon svg{height:var(--yoopta-ui-block-options-icon-size);width:var(--yoopta-ui-block-options-icon-size)}.yoopta-ui-block-options-button-text{flex:1}.yoopta-ui-block-options-separator{background-color:hsl(var(--yoopta-ui-block-options-separator-color));height:var(--yoopta-ui-block-options-separator-height);margin:var(--yoopta-ui-block-options-separator-margin)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}}");const $=({children:o,open:i,onOpenChange:n,defaultOpen:e=!1,anchor:a=null})=>{const[s,p]=c(e),[u,b]=c(null),d=h(),y=void 0!==i,k=y?i:s,g=null!=a?a:u,m=r(o=>{y||p(o),null==n||n(o)},[y,n]),v=l(()=>({open:k,onOpenChange:m,triggerRef:g,setTriggerRef:b,contentId:d}),[k,m,g,d]);return t(B.Provider,Object.assign({value:v},{children:o}))};$.displayName="BlockOptions";const z=a(({children:o,asChild:i=!1,className:n=""},e)=>{const{open:a,onOpenChange:c,setTriggerRef:l,contentId:b}=C(),d=r(o=>{o.stopPropagation(),c(!a)},[a,c]),y={ref:u([e,l]),onClick:d,"aria-expanded":a,"aria-haspopup":"menu","aria-controls":a?b:void 0};return i&&s(o)?p(o,y):t("button",Object.assign({type:"button",className:`yoopta-ui-block-options-trigger ${n}`},y,{children:o}))});z.displayName="BlockOptions.Trigger";const I=({children:o})=>t(j,Object.assign({id:"yoopta-ui-block-options-portal"},{children:o}));I.displayName="BlockOptions.Portal";const P=a(({children:o,className:i="",style:n,side:e="right",align:a="start",sideOffset:r=5},s)=>{const{open:p,onOpenChange:c,triggerRef:l,contentId:h}=C(),O="center"===a?e:`${e}-${a}`,{refs:j,floatingStyles:N,context:B}=b({elements:{reference:l},placement:O,open:p,onOpenChange:c,middleware:[m(r),v(),x({padding:8})],whileElementsMounted:f,strategy:"fixed"}),{isMounted:$,styles:z}=d(B,{duration:150,initial:{opacity:0},open:{opacity:1},close:{opacity:0}}),P=y(B,{outsidePress:!0,escapeKey:!0}),{getFloatingProps:E}=k([P]),S=u([j.setFloating,s]);return $?t(I,{children:t(w,Object.assign({lockScroll:!1,onClick:()=>c(!1)},{children:t(g,Object.assign({context:B,modal:!1},{children:t("div",Object.assign({ref:S,id:h,role:"menu","aria-orientation":"vertical",className:`yoopta-ui-block-options ${i}`,style:Object.assign(Object.assign(Object.assign({},N),z),n),contentEditable:!1},E({onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()}),{children:o}))}))}))}):null});P.displayName="BlockOptions.Content";const E=a(({children:o,className:i=""},n)=>t("div",Object.assign({ref:n,role:"group",className:`yoopta-ui-block-options-group ${i}`},{children:o})));E.displayName="BlockOptions.Group";const S=a((n,e)=>{var{children:a,onSelect:s,className:p="",disabled:c,icon:l,variant:u="default",keepOpen:b=!1}=n,d=o(n,["children","onSelect","className","disabled","icon","variant","keepOpen"]);const{onOpenChange:y}=C(),k=r(o=>{c||(null==s||s(o),b||y(!1))},[c,s,y,b]);return i("button",Object.assign({ref:e,type:"button",role:"menuitem",disabled:c,className:`yoopta-ui-block-options-button yoopta-ui-block-options-button-${u} ${p}`,onClick:k},d,{children:[l&&t("span",Object.assign({className:"yoopta-ui-block-options-button-icon"},{children:l})),t("span",Object.assign({className:"yoopta-ui-block-options-button-text"},{children:a}))]}))});S.displayName="BlockOptions.Item";const T=a(({className:o=""},i)=>t("div",{ref:i,role:"separator",className:`yoopta-ui-block-options-separator ${o}`}));T.displayName="BlockOptions.Separator";const R=a(({children:o,className:i=""},n)=>t("div",Object.assign({ref:n,className:`yoopta-ui-block-options-label ${i}`},{children:o})));R.displayName="BlockOptions.Label";const D=Object.assign($,{Root:$,Trigger:z,Portal:I,Content:P,Group:E,Item:S,Separator:T,Label:R}),q=()=>{const o=N();return{duplicateBlock:r(t=>{if(!t)throw new Error("Block ID is required to duplicate block");o.duplicateBlock({blockId:t,focus:!0})},[o]),copyBlockLink:r(t=>{var i;if(!t)throw new Error("Block ID is required to copy block link");const n=o.children[t];if(n){const t=`${window.location.origin}${window.location.pathname}#${n.id}`;if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t);else{const o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}null===(i=o.emit)||void 0===i||i.call(o,"block:copy",n)}},[o]),deleteBlock:r(t=>{if(!t)throw new Error("Block ID is required to delete block");o.deleteBlock({blockId:t}),o.setPath({current:null})},[o])}};export{D as BlockOptions,q as useBlockActions,C as useBlockOptionsContext};
@@ -2,4 +2,4 @@ import*as e from"react";import{useLayoutEffect as t,useEffect as n,useRef as o}f
2
2
  /*!
3
3
  * tabbable 6.4.0
4
4
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
- */var me=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),he="undefined"==typeof Element,ge=he?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ve=!he&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},ye=function(e,t){var n;void 0===t&&(t=!0);var o=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===o||"true"===o||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):ye(e.parentNode))},we=function(e,t,n){for(var o=[],r=Array.from(e);r.length;){var i=r.shift();if(!ye(i,!1))if("SLOT"===i.tagName){var l=i.assignedElements(),c=l.length?l:i.children,u=we(c,!0,n);n.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{ge.call(i,me)&&n.filter(i)&&(t||!e.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!ye(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&a){var f=we(!0===s?i.children:s.children,!0,n);n.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else r.unshift.apply(r,i.children)}}return o},be=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},xe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!be(e)?0:e.tabIndex},Re=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ee=function(e){return"INPUT"===e.tagName},Se=function(e){return function(e){return Ee(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ve(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!r||r===e}(e)},Ae=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},Ce=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(e).visibility)return!0;var r=ge.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ge.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Ae(e)}else{if("function"==typeof o){for(var i=e;e;){var l=e.parentElement,c=ve(e);if(l&&!l.shadowRoot&&!0===o(l))return Ae(e);e=e.assignedSlot?e.assignedSlot:l||c===e.ownerDocument?l:c.host}e=i}if(function(e){var t,n,o,r,i=e&&ve(e),l=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&l;){var u,s,a;c=!(null===(s=l=null===(u=i=ve(l))||void 0===u?void 0:u.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Le=function(e,t){return!(t.disabled||function(e){return Ee(e)&&"hidden"===e.type}(t)||Ce(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some(function(e){return"SUMMARY"===e.tagName})}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var o=t.children.item(n);if("LEGEND"===o.tagName)return!!ge.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},ke=function(e,t){return!(Se(t)||xe(t)<0||!Le(e,t))},Te=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Oe=function(e){var t=[],n=[];return e.forEach(function(e,o){var r=!!e.scopeParent,i=r?e.scopeParent:e,l=function(e,t){var n=xe(e);return n<0&&t&&!be(e)?0:n}(i,r),c=r?Oe(e.candidates):i;0===l?r?t.push.apply(t,c):t.push(i):n.push({documentOrder:o,tabIndex:l,item:e,isScope:r,content:c})}),n.sort(Re).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Me=function(e,t){var n;return n=(t=t||{}).getShadowRoot?we([e],t.includeContainer,{filter:ke.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Te}):function(e,t,n){if(ye(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(me));return t&&ge.call(e,me)&&o.unshift(e),o.filter(n)}(e,t.includeContainer,ke.bind(null,t)),Oe(n)};function Pe(e,t,n){let{reference:o,floating:r}=e;const i=oe(t),l=re(t),c=te(l),u=J(t),s="y"===i,a=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,d=o[c]/2-r[c]/2;let p;switch(u){case"top":p={x:a,y:o.y-r.height};break;case"bottom":p={x:a,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(Q(t)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function De(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:c,strategy:u}=e,{boundary:s="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=G(t,e),m=de(p),h=c[d?"floating"===f?"reference":"floating":f],g=pe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:a,strategy:u})),v="floating"===f?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=pe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:y,strategy:u}):v);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function Fe(e){const t=z(...e.map(e=>e.left)),n=z(...e.map(e=>e.top));return{x:t,y:n,width:K(...e.map(e=>e.right))-t,height:K(...e.map(e=>e.bottom))-n}}const Ie=new Set(["left","top"]);function Ne(e){const t=C(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=f(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,c=_(n)!==i||_(o)!==l;return c&&(n=i,o=l),{width:n,height:o,$:c}}function We(e){return a(e)?e:e.contextElement}function je(e){const t=We(e);if(!f(t))return X(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Ne(t);let l=(i?_(n.width):n.width)/o,c=(i?_(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const Be=X(0);function Ve(e){const t=c(e);return E()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Be}function He(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=We(e);let l=X(1);t&&(o?a(o)&&(l=je(o)):l=je(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==c(e))&&t}(i,n,o)?Ve(i):X(0);let s=(r.left+u.x)/l.x,f=(r.top+u.y)/l.y,d=r.width/l.x,p=r.height/l.y;if(i){const e=c(i),t=o&&a(o)?c(o):o;let n=e,r=M(n);for(;r&&o&&t!==n;){const e=je(r),t=r.getBoundingClientRect(),o=C(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;s*=e.x,f*=e.y,d*=e.x,p*=e.y,s+=i,f+=l,n=c(r),r=M(n)}}return pe({width:d,height:p,x:s,y:f})}function qe(e,t){const n=L(e).scrollLeft;return t?t.left+n:He(u(e)).left+n}function ze(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qe(e,n),y:n.top+t.scrollTop}}const Ke=new Set(["absolute","fixed"]);function _e(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=c(e),o=u(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,s=0,a=0;if(r){i=r.width,l=r.height;const e=E();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,a=r.offsetTop)}const f=qe(o);if(f<=0){const e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-t.clientWidth-r);l<=25&&(i-=l)}else f<=25&&(i+=f);return{width:i,height:l,x:s,y:a}}(e,n);else if("document"===t)o=function(e){const t=u(e),n=L(e),o=e.ownerDocument.body,r=K(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=K(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+qe(e);const c=-n.scrollTop;return"rtl"===C(o).direction&&(l+=K(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:c}}(u(e));else if(a(t))o=function(e,t){const n=He(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=f(e)?je(e):X(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=Ve(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pe(o)}function Ue(e,t){const n=k(e);return!(n===t||!a(n)||A(n))&&("fixed"===C(n).position||Ue(n,t))}function Xe(e,t,n){const o=f(t),r=u(t),i="fixed"===n,c=He(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=X(0);function d(){a.x=qe(r)}if(o||!o&&!i)if(("body"!==l(t)||m(r))&&(s=L(t)),o){const e=He(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else r&&d();i&&!o&&r&&d();const p=!r||o||i?X(0):ze(r,s);return{x:c.left+s.scrollLeft-a.x-p.x,y:c.top+s.scrollTop-a.y-p.y,width:c.width,height:c.height}}function $e(e){return"static"===C(e).position}function Ye(e,t){if(!f(e)||"fixed"===C(e).position)return null;if(t)return t(e);let n=e.offsetParent;return u(e)===n&&(n=n.ownerDocument.body),n}function Ze(e,t){const n=c(e);if(y(e))return n;if(!f(e)){let t=k(e);for(;t&&!A(t);){if(a(t)&&!$e(t))return t;t=k(t)}return n}let o=Ye(e,t);for(;o&&g(o)&&$e(o);)o=Ye(o,t);return o&&A(o)&&$e(o)&&!R(o)?n:o||function(e){let t=k(e);for(;f(t)&&!A(t);){if(R(t))return t;if(y(t))return null;t=k(t)}return null}(e)||n}const Ge={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,c=u(o),s=!!t&&y(t.floating);if(o===c||s&&i)return n;let a={scrollLeft:0,scrollTop:0},d=X(1);const p=X(0),h=f(o);if((h||!h&&!i)&&(("body"!==l(o)||m(c))&&(a=L(o)),f(o))){const e=He(o);d=je(o),p.x=e.x+o.clientLeft,p.y=e.y+o.clientTop}const g=!c||h||i?X(0):ze(c,a);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+p.x+g.x,y:n.y*d.y-a.scrollTop*d.y+p.y+g.y}},getDocumentElement:u,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?y(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=O(e,[],!1).filter(e=>a(e)&&"body"!==l(e)),r=null;const i="fixed"===C(e).position;let c=i?k(e):e;for(;a(c)&&!A(c);){const t=C(c),n=R(c);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&Ke.has(r.position)||m(c)&&!n&&Ue(e,c))?o=o.filter(e=>e!==c):r=t,c=k(c)}return t.set(e,o),o}(t,this._c):[].concat(n),o],c=i[0],u=i.reduce((e,n)=>{const o=_e(t,n,r);return e.top=K(o.top,e.top),e.right=z(o.right,e.right),e.bottom=z(o.bottom,e.bottom),e.left=K(o.left,e.left),e},_e(t,c,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:Ze,getElementRects:async function(e){const t=this.getOffsetParent||Ze,n=this.getDimensions,o=await n(e.floating);return{reference:Xe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Ne(e);return{width:t,height:n}},getScale:je,isElement:a,isRTL:function(e){return"rtl"===C(e).direction}};function Je(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qe(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,a=We(e),f=r||i?[...a?O(a):[],...O(t)]:[];f.forEach(e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=a&&c?function(e,t){let n,o=null;const r=u(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(c,u){void 0===c&&(c=!1),void 0===u&&(u=1),i();const s=e.getBoundingClientRect(),{left:a,top:f,width:d,height:p}=s;if(c||t(),!d||!p)return;const m={rootMargin:-U(f)+"px "+-U(r.clientWidth-(a+d))+"px "+-U(r.clientHeight-(f+p))+"px "+-U(a)+"px",threshold:K(0,z(1,u))||1};let h=!0;function g(t){const o=t[0].intersectionRatio;if(o!==u){if(!h)return l();o?l(!1,o):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==o||Je(s,e.getBoundingClientRect())||l(),h=!1}try{o=new IntersectionObserver(g,{...m,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(g,m)}o.observe(e)}(!0),i}(a,n):null;let p,m=-1,h=null;l&&(h=new ResizeObserver(e=>{let[o]=e;o&&o.target===a&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),a&&!s&&h.observe(a),h.observe(t));let g=s?He(e):null;return s&&function t(){const o=He(e);g&&!Je(g,o)&&n();g=o,p=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(p)}}const et=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:c}=t,u=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=J(n),c=Q(n),u="y"===oe(n),s=Ie.has(l)?-1:1,a=i&&u?-1:1,f=G(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),u?{x:p*a,y:d*s}:{x:d*s,y:p*a}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(o=c.arrow)&&o.alignmentOffset?{}:{x:r+u.x,y:i+u.y,data:{...u,placement:l}}}}},tt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=G(e,t),s={x:n,y:o},a=await De(t,u),f=oe(J(r)),d=ee(f);let p=s[d],m=s[f];if(i){const e="y"===d?"bottom":"right";p=Z(p+a["y"===d?"top":"left"],p,p-a[e])}if(l){const e="y"===f?"bottom":"right";m=Z(m+a["y"===f?"top":"left"],m,m-a[e])}const h=c.fn({...t,[d]:p,[f]:m});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:i,[f]:l}}}}}},nt=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:c,platform:u,elements:s}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=G(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=J(r),y=oe(c),w=J(c)===c,b=await(null==u.isRTL?void 0:u.isRTL(s.floating)),x=d||(w||!h?[fe(c)]:function(e){const t=fe(e);return[ie(e),t,ie(t)]}(c)),R="none"!==m;!d&&R&&x.push(...ae(c,h,m,b));const E=[c,...x],S=await De(t,g),A=[];let C=(null==(o=i.flip)?void 0:o.overflows)||[];if(a&&A.push(S[v]),f){const e=function(e,t,n){void 0===n&&(n=!1);const o=Q(e),r=re(e),i=te(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=fe(l)),[l,fe(l)]}(r,l,b);A.push(S[e[0]],S[e[1]])}if(C=[...C,{placement:r,overflows:A}],!A.every(e=>e<=0)){var L,k;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=E[e];if(t){if(!("alignment"===f&&y!==oe(t))||C.every(e=>oe(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let n=null==(k=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:k.placement;if(!n)switch(p){case"bestFit":{var T;const e=null==(T=C.filter(e=>{if(R){const t=oe(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=c}if(r!==n)return{reset:{placement:n}}}return{}}}},ot=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:l,elements:c}=t,{apply:u=()=>{},...s}=G(e,t),a=await De(t,s),f=J(r),d=Q(r),p="y"===oe(r),{width:m,height:h}=i.floating;let g,v;"top"===f||"bottom"===f?(g=f,v=d===(await(null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(v=f,g="end"===d?"top":"bottom");const y=h-a.top-a.bottom,w=m-a.left-a.right,b=z(h-a[g],y),x=z(m-a[v],w),R=!t.middlewareData.shift;let E=b,S=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=w),null!=(o=t.middlewareData.shift)&&o.enabled.y&&(E=y),R&&!d){const e=K(a.left,0),t=K(a.right,0),n=K(a.top,0),o=K(a.bottom,0);p?S=m-2*(0!==e||0!==t?e+t:K(a.left,a.right)):E=h-2*(0!==n||0!==o?n+o:K(a.top,a.bottom))}await u({...t,availableWidth:S,availableHeight:E});const A=await l.getDimensions(c.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}},rt=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:o,rects:r,platform:i,strategy:l}=t,{padding:c=2,x:u,y:s}=G(e,t),a=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),f=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let o=null;for(let e=0;e<t.length;e++){const r=t[e];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(e=>pe(Fe(e)))}(a),d=pe(Fe(a)),p=de(c);const m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=u&&null!=s)return f.find(e=>u>e.left-p.left&&u<e.right+p.right&&s>e.top-p.top&&s<e.bottom+p.bottom)||d;if(f.length>=2){if("y"===oe(n)){const e=f[0],t=f[f.length-1],o="top"===J(n),r=e.top,i=t.bottom,l=o?e.left:t.left,c=o?e.right:t.right;return{top:r,bottom:i,left:l,right:c,width:c-l,height:i-r,x:l,y:r}}const e="left"===J(n),t=K(...f.map(e=>e.right)),o=z(...f.map(e=>e.left)),r=f.filter(n=>e?n.left===o:n.right===t),i=r[0].top,l=r[r.length-1].bottom;return{top:i,bottom:l,left:o,right:t,width:t-o,height:l-i,x:o,y:i}}return d}},floating:o.floating,strategy:l});return r.reference.x!==m.reference.x||r.reference.y!==m.reference.y||r.reference.width!==m.reference.width||r.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},it=(e,t,n)=>{const o=new Map,r={platform:Ge,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),u=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:a,y:f}=Pe(s,o,u),d=o,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:h}=c[n],{x:g,y:v,data:y,reset:w}=await h({x:a,y:f,initialPlacement:o,placement:d,strategy:r,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=g?g:a,f=null!=v?v:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:r}):w.rects),({x:a,y:f}=Pe(s,d,u))),n=-1)}return{x:a,y:f,placement:d,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var lt="undefined"!=typeof document?t:function(){};function ct(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;0!==o--;)if(!ct(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;0!==o--;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;0!==o--;){const n=r[o];if(("_owner"!==n||!e.$$typeof)&&!ct(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ut(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function st(e,t){const n=ut(e);return Math.round(t*n)/n}function at(t){const n=e.useRef(t);return lt(()=>{n.current=t}),n}const ft=(e,t)=>({...et(e),options:[e,t]}),dt=(e,t)=>({...tt(e),options:[e,t]}),pt=(e,t)=>({...nt(e),options:[e,t]}),mt=(e,t)=>({...ot(e),options:[e,t]}),ht=(e,t)=>({...rt(e),options:[e,t]});function gt(t){return e.useMemo(()=>t.every(e=>null==e)?null:e=>{t.forEach(t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)})},t)}const vt={...e},yt=vt.useInsertionEffect||(e=>e());function wt(t){const n=e.useRef(()=>{});return yt(()=>{n.current=t}),e.useCallback(function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return null==n.current?void 0:n.current(...t)},[])}var bt="undefined"!=typeof document?t:n;function xt(){return xt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},xt.apply(this,arguments)}let Rt=!1,Et=0;const St=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Et++;const At=vt.useId||function(){const[t,n]=e.useState(()=>Rt?St():void 0);return bt(()=>{null==t&&n(St())},[]),e.useEffect(()=>{Rt=!0},[]),t};const Ct=e.createContext(null),Lt=e.createContext(null),kt=()=>e.useContext(Lt);function Tt(e){return"data-floating-ui-"+e}function Ot(e){const t=o(e);return bt(()=>{t.current=e}),t}let Mt=0;function Pt(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Mt);const i=()=>null==e?void 0:e.focus({preventScroll:n});r?i():Mt=requestAnimationFrame(i)}function Dt(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),o=n;for(;o.length;)o=e.filter(e=>{var t;return null==(t=o)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(o);return n}let Ft=new WeakMap,It=new WeakSet,Nt={},Wt=0;const jt=e=>e&&(e.host||jt(e.parentNode));function Bt(e,t,n,o){const r="data-floating-ui-inert",i=o?"inert":n?"aria-hidden":null,c=(u=t,e.map(e=>{if(u.contains(e))return e;const t=jt(e);return u.contains(t)?t:null}).filter(e=>null!=e));var u;const s=new Set,a=new Set(c),f=[];Nt[r]||(Nt[r]=new WeakMap);const d=Nt[r];return c.forEach(function e(t){if(!t||s.has(t))return;s.add(t),t.parentNode&&e(t.parentNode)}),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,t=>{if("script"!==l(t))if(s.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,o=(Ft.get(t)||0)+1,l=(d.get(t)||0)+1;Ft.set(t,o),d.set(t,l),f.push(t),1===o&&n&&It.add(t),1===l&&t.setAttribute(r,""),!n&&i&&t.setAttribute(i,"true")}})}(t),s.clear(),Wt++,()=>{f.forEach(e=>{const t=(Ft.get(e)||0)-1,n=(d.get(e)||0)-1;Ft.set(e,t),d.set(e,n),t||(!It.has(e)&&i&&e.removeAttribute(i),It.delete(e)),n||e.removeAttribute(r)}),Wt--,Wt||(Ft=new WeakMap,Ft=new WeakMap,It=new WeakSet,Nt={})}}function Vt(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=j(e[0]).body;return Bt(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const Ht=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function qt(e,t){const n=Me(e,Ht());"prev"===t&&n.reverse();const o=n.indexOf(P(j(e)));return n.slice(o+1)[0]}function zt(){return qt(document.body,"next")}function Kt(){return qt(document.body,"prev")}function _t(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!D(n,o)}function Ut(e){Me(e,Ht()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function Xt(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}const $t={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function Yt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Zt=e.forwardRef(function(t,n){const[o,r]=e.useState();bt(()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Yt),()=>{document.removeEventListener("keydown",Yt)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,[Tt("focus-guard")]:"",style:$t};return e.createElement("span",xt({},t,i))}),Gt=e.createContext(null),Jt=Tt("portal");function Qt(t){const{children:n,id:o,root:i,preserveTabOrder:l=!0}=t,c=function(t){void 0===t&&(t={});const{id:n,root:o}=t,r=At(),i=en(),[l,c]=e.useState(null),u=e.useRef(null);return bt(()=>()=>{null==l||l.remove(),queueMicrotask(()=>{u.current=null})},[l]),bt(()=>{if(!r)return;if(u.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=r,t.setAttribute(Jt,""),e.appendChild(t),u.current=t,c(t)},[n,r]),bt(()=>{if(null===o)return;if(!r)return;if(u.current)return;let e=o||(null==i?void 0:i.portalNode);e&&!a(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const l=document.createElement("div");l.id=r,l.setAttribute(Jt,""),e=t||e,e.appendChild(l),u.current=l,c(l)},[n,o,r,i]),l}({id:o,root:i}),[u,s]=e.useState(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=null==u?void 0:u.modal,g=null==u?void 0:u.open,v=!!u&&!u.modal&&u.open&&l&&!(!i&&!c);return e.useEffect(()=>{if(c&&l&&!h)return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&_t(e)){("focusin"===e.type?Xt:Ut)(c)}}},[c,l,h]),e.useEffect(()=>{c&&(g||Xt(c))},[g,c]),e.createElement(Gt.Provider,{value:e.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:s}),[l,c])},v&&c&&e.createElement(Zt,{"data-type":"outside",ref:f,onFocus:e=>{if(_t(e,c)){var t;null==(t=p.current)||t.focus()}else{const e=Kt()||(null==u?void 0:u.refs.domReference.current);null==e||e.focus()}}}),v&&c&&e.createElement("span",{"aria-owns":c.id,style:$t}),c&&r.createPortal(n,c),v&&c&&e.createElement(Zt,{"data-type":"outside",ref:d,onFocus:e=>{if(_t(e,c)){var t;null==(t=m.current)||t.focus()}else{const t=zt()||(null==u?void 0:u.refs.domReference.current);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))}const en=()=>e.useContext(Gt),tn="data-floating-ui-focusable";let nn=[];function on(e){nn=nn.filter(e=>e.isConnected);let t=e;if(t&&"body"!==l(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ge.call(e,me)&&ke(t,e)}(t,Ht())){const e=Me(t,Ht())[0];e&&(t=e)}nn.push(t),nn.length>20&&(nn=nn.slice(-20))}}function rn(){return nn.slice().reverse().find(e=>e.isConnected)}const ln=e.forwardRef(function(t,n){return e.createElement("button",xt({},t,{type:"button",ref:n,tabIndex:-1,style:$t}))});function cn(t){const{context:n,children:o,disabled:r=!1,order:i=["content"],guards:l=!0,initialFocus:c=0,returnFocus:u=!0,restoreFocus:s=!1,modal:a=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0}=t,{open:m,refs:h,nodeId:g,onOpenChange:v,events:y,dataRef:w,floatingId:b,elements:{domReference:x,floating:R}}=n,E="number"==typeof c&&c<0,S=q(x)&&E,A="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,C=Ot(i),L=Ot(c),k=Ot(u),T=kt(),O=en(),M=e.useRef(null),F=e.useRef(null),I=e.useRef(!1),B=e.useRef(!1),z=e.useRef(-1),K=null!=O,_=(U=R)?U.hasAttribute(tn)?U:U.querySelector("["+tn+"]")||U:null;var U;const X=wt(function(e){return void 0===e&&(e=_),e?Me(e,Ht()):[]}),$=wt(e=>{const t=X(e);return C.current.map(e=>x&&"reference"===e?x:_&&"floating"===e?_:t).filter(Boolean).flat()});function Y(t){return!r&&d&&a?e.createElement(ln,{ref:"start"===t?M:F,onClick:e=>v(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}e.useEffect(()=>{if(r)return;if(!a)return;function e(e){if("Tab"===e.key){D(_,P(j(_)))&&0===X().length&&!S&&H(e);const t=$(),n=V(e);"reference"===C.current[0]&&n===x&&(H(e),e.shiftKey?Pt(t[t.length-1]):Pt(t[1])),"floating"===C.current[1]&&n===_&&e.shiftKey&&(H(e),Pt(t[0]))}}const t=j(_);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,x,_,a,C,S,X,$]),e.useEffect(()=>{if(!r&&R)return R.addEventListener("focusin",e),()=>{R.removeEventListener("focusin",e)};function e(e){const t=V(e),n=X().indexOf(t);-1!==n&&(z.current=n)}},[r,R,X]),e.useEffect(()=>{if(!r&&p)return R&&f(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),R.addEventListener("focusout",t),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),R.removeEventListener("focusout",t)}):void 0;function e(){B.current=!0,setTimeout(()=>{B.current=!1})}function t(e){const t=e.relatedTarget;queueMicrotask(()=>{const n=!(D(x,t)||D(R,t)||D(t,R)||D(null==O?void 0:O.portalNode,t)||null!=t&&t.hasAttribute(Tt("focus-guard"))||T&&(Dt(T.nodesRef.current,g).find(e=>{var n,o;return D(null==(n=e.context)?void 0:n.elements.floating,t)||D(null==(o=e.context)?void 0:o.elements.domReference,t)})||function(e,t){var n;let o=[],r=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;r;){const t=e.find(e=>e.id===r);r=null==t?void 0:t.parentId,t&&(o=o.concat(t))}return o}(T.nodesRef.current,g).find(e=>{var n,o;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(s&&n&&P(j(_))===j(_).body){f(_)&&_.focus();const e=z.current,t=X(),n=t[e]||t[t.length-1]||_;f(n)&&n.focus()}!S&&a||!t||!n||B.current||t===rn()||(I.current=!0,v(!1,e,"focus-out"))})}},[r,x,R,_,a,g,T,O,v,p,s,X,S]),e.useEffect(()=>{var e;if(r)return;const t=Array.from((null==O||null==(e=O.portalNode)?void 0:e.querySelectorAll("["+Tt("portal")+"]"))||[]);if(R){const e=[R,...t,M.current,F.current,C.current.includes("reference")||S?x:null].filter(e=>null!=e),n=a||S?Vt(e,A,!A):Vt(e);return()=>{n()}}},[r,x,R,a,C,O,S,A]),bt(()=>{if(r||!f(_))return;const e=P(j(_));queueMicrotask(()=>{const t=$(_),n=L.current,o=("number"==typeof n?t[n]:n.current)||_,r=D(_,e);E||r||!m||Pt(o,{preventScroll:o===_})})},[r,m,_,E,$,L]),bt(()=>{if(r||!_)return;let e=!1;const t=j(_),n=P(t);let o=w.current.openEvent;function i(t){let{open:n,reason:r,event:i,nested:l}=t;n&&(o=i),"escape-key"===r&&h.domReference.current&&on(h.domReference.current),"hover"===r&&"mouseleave"===i.type&&(I.current=!0),"outside-press"===r&&(l?(I.current=!1,e=!0):I.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(W()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||N(i)))}on(n),y.on("openchange",i);const l=t.createElement("span");return l.setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),Object.assign(l.style,$t),K&&x&&x.insertAdjacentElement("afterend",l),()=>{y.off("openchange",i);const n=P(t),r=D(R,n)||T&&Dt(T.nodesRef.current,g).some(e=>{var t;return D(null==(t=e.context)?void 0:t.elements.floating,n)});(r||o&&["click","mousedown"].includes(o.type))&&h.domReference.current&&on(h.domReference.current);const c="boolean"==typeof k.current?rn()||l:k.current.current||l;queueMicrotask(()=>{k.current&&!I.current&&f(c)&&(c===n||n===t.body||r)&&c.focus({preventScroll:e}),l.remove()})}},[r,R,_,k,w,h,y,T,g,K,x]),e.useEffect(()=>{queueMicrotask(()=>{I.current=!1})},[r]),bt(()=>{if(!r&&O)return O.setFocusManagerState({modal:a,closeOnFocusOut:p,open:m,onOpenChange:v,refs:h}),()=>{O.setFocusManagerState(null)}},[r,O,a,m,v,h,p]),bt(()=>{if(r)return;if(!_)return;if("function"!=typeof MutationObserver)return;if(E)return;const e=()=>{const e=_.getAttribute("tabindex"),t=X(),n=P(j(R)),o=t.indexOf(n);-1!==o&&(z.current=o),C.current.includes("floating")||n!==h.domReference.current&&0===t.length?"0"!==e&&_.setAttribute("tabindex","0"):"-1"!==e&&_.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(_,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[r,R,_,h,C,X,E]);const Z=!r&&A&&(!a||!S)&&(K||a);return e.createElement(e.Fragment,null,Z&&e.createElement(Zt,{"data-type":"inside",ref:null==O?void 0:O.beforeInsideRef,onFocus:e=>{if(a){const e=$();Pt("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=O&&O.preserveTabOrder&&O.portalNode)if(I.current=!1,_t(e,O.portalNode)){const e=zt()||x;null==e||e.focus()}else{var t;null==(t=O.beforeOutsideRef.current)||t.focus()}}}),!S&&Y("start"),o,Y("end"),Z&&e.createElement(Zt,{"data-type":"inside",ref:null==O?void 0:O.afterInsideRef,onFocus:e=>{if(a)Pt($()[0]);else if(null!=O&&O.preserveTabOrder&&O.portalNode)if(p&&(I.current=!0),_t(e,O.portalNode)){const e=Kt()||x;null==e||e.focus()}else{var t;null==(t=O.afterOutsideRef.current)||t.focus()}}}))}let un=0;let sn=()=>{};const an=e.forwardRef(function(t,n){const{lockScroll:o=!1,...r}=t;return bt(()=>{if(o)return un++,1===un&&(sn=function(){const e=/iP(hone|ad|od)|iOS/.test(F()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,r=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var l,c;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(r-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(r,i))}}()),()=>{un--,0===un&&sn()}},[o]),e.createElement("div",xt({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}),fn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},pn=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function mn(t,n){void 0===n&&(n={});const{open:o,onOpenChange:r,elements:i,dataRef:l}=t,{enabled:c=!0,escapeKey:u=!0,outsidePress:s=!0,outsidePressEvent:d="pointerdown",referencePress:p=!1,referencePressEvent:m="pointerdown",ancestorScroll:h=!1,bubbles:g,capture:v}=n,y=kt(),w=wt("function"==typeof s?s:()=>!1),b="function"==typeof s?w:s,x=e.useRef(!1),R=e.useRef(!1),{escapeKey:S,outsidePress:L}=pn(g),{escapeKey:T,outsidePress:M}=pn(v),P=e.useRef(!1),F=wt(e=>{var t;if(!o||!c||!u||"Escape"!==e.key)return;if(P.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=y?Dt(y.nodesRef.current,n):[];if(!S&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),I=wt(e=>{var t;const n=()=>{var t;F(e),null==(t=V(e))||t.removeEventListener("keydown",n)};null==(t=V(e))||t.addEventListener("keydown",n)}),N=wt(e=>{var t;const n=x.current;x.current=!1;const o=R.current;if(R.current=!1,"click"===d&&o)return;if(n)return;if("function"==typeof b&&!b(e))return;const c=V(e),u="["+Tt("inert")+"]",s=j(i.floating).querySelectorAll(u);let p=a(c)?c:null;for(;p&&!A(p);){const e=k(p);if(A(e)||!a(e))break;p=e}if(s.length&&a(c)&&!c.matches("html,body")&&!D(c,i.floating)&&Array.from(s).every(e=>!D(p,e)))return;if(f(c)&&q){const t=c.clientWidth>0&&c.scrollWidth>c.clientWidth,n=c.clientHeight>0&&c.scrollHeight>c.clientHeight;let o=n&&e.offsetX>c.clientWidth;if(n){"rtl"===C(c).direction&&(o=e.offsetX<=c.offsetWidth-c.clientWidth)}if(o||t&&e.offsetY>c.clientHeight)return}const m=null==(t=l.current.floatingContext)?void 0:t.nodeId,h=y&&Dt(y.nodesRef.current,m).some(t=>{var n;return B(e,null==(n=t.context)?void 0:n.elements.floating)});if(B(e,i.floating)||B(e,i.domReference)||h)return;const g=y?Dt(y.nodesRef.current,m):[];if(g.length>0){let e=!0;if(g.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),W=wt(e=>{var t;const n=()=>{var t;N(e),null==(t=V(e))||t.removeEventListener(d,n)};null==(t=V(e))||t.addEventListener(d,n)});e.useEffect(()=>{if(!o||!c)return;l.current.__escapeKeyBubbles=S,l.current.__outsidePressBubbles=L;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),P.current=!0}function s(){e=window.setTimeout(()=>{P.current=!1},E()?5:0)}const f=j(i.floating);u&&(f.addEventListener("keydown",T?I:F,T),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",s)),b&&f.addEventListener(d,M?W:N,M);let p=[];return h&&(a(i.domReference)&&(p=O(i.domReference)),a(i.floating)&&(p=p.concat(O(i.floating))),!a(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(O(i.reference.contextElement)))),p=p.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)}),p.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{u&&(f.removeEventListener("keydown",T?I:F,T),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",s)),b&&f.removeEventListener(d,M?W:N,M),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[l,i,u,b,d,o,r,h,c,S,L,F,T,I,N,M,W]),e.useEffect(()=>{x.current=!1},[b,d]);const H=e.useMemo(()=>({onKeyDown:F,[fn[m]]:e=>{p&&r(!1,e.nativeEvent,"reference-press")}}),[F,r,p,m]),q=e.useMemo(()=>({onKeyDown:F,onMouseDown(){R.current=!0},onMouseUp(){R.current=!0},[dn[d]]:()=>{x.current=!0}}),[F,d]);return e.useMemo(()=>c?{reference:H,floating:q}:{},[c,H,q])}function hn(t){const{open:n=!1,onOpenChange:o,elements:r}=t,i=At(),l=e.useRef({}),[c]=e.useState(()=>function(){const e=new Map;return{emit(t,n){var o;null==(o=e.get(t))||o.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,(null==(o=e.get(t))?void 0:o.filter(e=>e!==n))||[])}}}()),u=null!=((null==(s=e.useContext(Ct))?void 0:s.id)||null);var s;const[a,f]=e.useState(r.reference),d=wt((e,t,n)=>{l.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==o||o(e,t,n)}),p=e.useMemo(()=>({setPositionReference:f}),[]),m=e.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return e.useMemo(()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:c,floatingId:i,refs:p}),[n,d,m,c,i,p])}function gn(t){void 0===t&&(t={});const{nodeId:n}=t,o=hn({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||o,l=i.elements,[c,u]=e.useState(null),[s,f]=e.useState(null),d=(null==l?void 0:l.domReference)||c,p=e.useRef(null),m=kt();bt(()=>{d&&(p.current=d)},[d]);const h=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:c,floating:u}={},transform:s=!0,whileElementsMounted:a,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(i);ct(m,i)||h(i);const[g,v]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),x=e.useCallback(e=>{e!==A.current&&(A.current=e,w(e))},[]),R=c||g,E=u||y,S=e.useRef(null),A=e.useRef(null),C=e.useRef(d),L=null!=a,k=at(a),T=at(l),O=at(f),M=e.useCallback(()=>{if(!S.current||!A.current)return;const e={placement:n,strategy:o,middleware:m};T.current&&(e.platform=T.current),it(S.current,A.current,e).then(e=>{const t={...e,isPositioned:!1!==O.current};P.current&&!ct(C.current,t)&&(C.current=t,r.flushSync(()=>{p(t)}))})},[m,n,o,T,O]);lt(()=>{!1===f&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[f]);const P=e.useRef(!1);lt(()=>(P.current=!0,()=>{P.current=!1}),[]),lt(()=>{if(R&&(S.current=R),E&&(A.current=E),R&&E){if(k.current)return k.current(R,E,M);M()}},[R,E,M,k,L]);const D=e.useMemo(()=>({reference:S,floating:A,setReference:b,setFloating:x}),[b,x]),F=e.useMemo(()=>({reference:R,floating:E}),[R,E]),I=e.useMemo(()=>{const e={position:o,left:0,top:0};if(!F.floating)return e;const t=st(F.floating,d.x),n=st(F.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...ut(F.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:t,top:n}},[o,s,F.floating,d.x,d.y]);return e.useMemo(()=>({...d,update:M,refs:D,elements:F,floatingStyles:I}),[d,M,D,F,I])}({...t,elements:{...l,...s&&{reference:s}}}),g=e.useCallback(e=>{const t=a(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f(t),h.refs.setReference(t)},[h.refs]),v=e.useCallback(e=>{(a(e)||null===e)&&(p.current=e,u(e)),(a(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!a(e))&&h.refs.setReference(e)},[h.refs]),y=e.useMemo(()=>({...h.refs,setReference:v,setPositionReference:g,domReference:p}),[h.refs,v,g]),w=e.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=e.useMemo(()=>({...h,...i,refs:y,elements:w,nodeId:n}),[h,y,w,n,i]);return bt(()=>{i.dataRef.current.floatingContext=b;const e=null==m?void 0:m.nodesRef.current.find(e=>e.id===n);e&&(e.context=b)}),e.useMemo(()=>({...h,context:b,refs:y,elements:w}),[h,y,w,b])}const vn="active",yn="selected";function wn(e,t,n){const o=new Map,r="item"===n;let i=e;if(r&&e){const{[vn]:t,[yn]:n,...o}=e;i=o}return{..."floating"===n&&{tabIndex:-1,[tn]:""},...i,...t.map(t=>{const o=t?t[n]:null;return"function"==typeof o?e?o(e):null:o}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,i]=t;var l;r&&[vn,yn].includes(n)||(0===n.indexOf("on")?(o.has(n)||o.set(n,[]),"function"==typeof i&&(null==(l=o.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return null==(e=o.get(n))?void 0:e.map(e=>e(...r)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}function bn(t){void 0===t&&(t=[]);const n=t.map(e=>null==e?void 0:e.reference),o=t.map(e=>null==e?void 0:e.floating),r=t.map(e=>null==e?void 0:e.item),i=e.useCallback(e=>wn(e,t,"reference"),n),l=e.useCallback(e=>wn(e,t,"floating"),o),c=e.useCallback(e=>wn(e,t,"item"),r);return e.useMemo(()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c}),[i,l,c])}const xn=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function Rn(e,t){return"function"==typeof e?e(t):e}function En(t,n){void 0===n&&(n={});const{open:o,elements:{floating:r}}=t,{duration:i=250}=n,l=("number"==typeof i?i:i.close)||0,[c,u]=e.useState("unmounted"),s=function(t,n){const[o,r]=e.useState(t);return t&&!o&&r(!0),e.useEffect(()=>{if(!t&&o){const e=setTimeout(()=>r(!1),n);return()=>clearTimeout(e)}},[t,o,n]),o}(o,l);return s||"close"!==c||u("unmounted"),bt(()=>{if(r){if(o){u("initial");const e=requestAnimationFrame(()=>{u("open")});return()=>{cancelAnimationFrame(e)}}u("close")}},[o,r]),{isMounted:s,status:c}}function Sn(t,n){void 0===n&&(n={});const{initial:o={opacity:0},open:r,close:i,common:l,duration:c=250}=n,u=t.placement,s=u.split("-")[0],a=e.useMemo(()=>({side:s,placement:u}),[s,u]),f="number"==typeof c,d=(f?c:c.open)||0,p=(f?c:c.close)||0,[m,h]=e.useState(()=>({...Rn(l,a),...Rn(o,a)})),{isMounted:g,status:v}=En(t,{duration:c}),y=Ot(o),w=Ot(r),b=Ot(i),x=Ot(l);return bt(()=>{const e=Rn(y.current,a),t=Rn(b.current,a),n=Rn(x.current,a),o=Rn(w.current,a)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===v&&h(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===v&&h({transitionProperty:Object.keys(o).map(xn).join(","),transitionDuration:d+"ms",...n,...o}),"close"===v){const o=t||e;h({transitionProperty:Object.keys(o).map(xn).join(","),transitionDuration:p+"ms",...n,...o})}},[p,b,y,w,x,d,v,a]),{isMounted:g,styles:m}}export{cn as F,Qe as a,Sn as b,mt as c,gt as d,mn as e,pt as f,bn as g,At as h,ht as i,Qt as j,an as k,ft as o,dt as s,gn as u};
5
+ */var me=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),he="undefined"==typeof Element,ge=he?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ve=!he&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},ye=function(e,t){var n;void 0===t&&(t=!0);var o=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===o||"true"===o||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):ye(e.parentNode))},we=function(e,t,n){for(var o=[],r=Array.from(e);r.length;){var i=r.shift();if(!ye(i,!1))if("SLOT"===i.tagName){var l=i.assignedElements(),c=l.length?l:i.children,u=we(c,!0,n);n.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{ge.call(i,me)&&n.filter(i)&&(t||!e.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!ye(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&a){var f=we(!0===s?i.children:s.children,!0,n);n.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else r.unshift.apply(r,i.children)}}return o},be=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},xe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!be(e)?0:e.tabIndex},Re=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ee=function(e){return"INPUT"===e.tagName},Se=function(e){return function(e){return Ee(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ve(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!r||r===e}(e)},Ae=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},Ce=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(e).visibility)return!0;var r=ge.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ge.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Ae(e)}else{if("function"==typeof o){for(var i=e;e;){var l=e.parentElement,c=ve(e);if(l&&!l.shadowRoot&&!0===o(l))return Ae(e);e=e.assignedSlot?e.assignedSlot:l||c===e.ownerDocument?l:c.host}e=i}if(function(e){var t,n,o,r,i=e&&ve(e),l=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&l;){var u,s,a;c=!(null===(s=l=null===(u=i=ve(l))||void 0===u?void 0:u.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Le=function(e,t){return!(t.disabled||function(e){return Ee(e)&&"hidden"===e.type}(t)||Ce(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some(function(e){return"SUMMARY"===e.tagName})}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var o=t.children.item(n);if("LEGEND"===o.tagName)return!!ge.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},ke=function(e,t){return!(Se(t)||xe(t)<0||!Le(e,t))},Te=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Oe=function(e){var t=[],n=[];return e.forEach(function(e,o){var r=!!e.scopeParent,i=r?e.scopeParent:e,l=function(e,t){var n=xe(e);return n<0&&t&&!be(e)?0:n}(i,r),c=r?Oe(e.candidates):i;0===l?r?t.push.apply(t,c):t.push(i):n.push({documentOrder:o,tabIndex:l,item:e,isScope:r,content:c})}),n.sort(Re).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Me=function(e,t){var n;return n=(t=t||{}).getShadowRoot?we([e],t.includeContainer,{filter:ke.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Te}):function(e,t,n){if(ye(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(me));return t&&ge.call(e,me)&&o.unshift(e),o.filter(n)}(e,t.includeContainer,ke.bind(null,t)),Oe(n)};function Pe(e,t,n){let{reference:o,floating:r}=e;const i=oe(t),l=re(t),c=te(l),u=J(t),s="y"===i,a=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,d=o[c]/2-r[c]/2;let p;switch(u){case"top":p={x:a,y:o.y-r.height};break;case"bottom":p={x:a,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(Q(t)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function De(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:c,strategy:u}=e,{boundary:s="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=G(t,e),m=de(p),h=c[d?"floating"===f?"reference":"floating":f],g=pe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:a,strategy:u})),v="floating"===f?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=pe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:y,strategy:u}):v);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function Fe(e){const t=z(...e.map(e=>e.left)),n=z(...e.map(e=>e.top));return{x:t,y:n,width:K(...e.map(e=>e.right))-t,height:K(...e.map(e=>e.bottom))-n}}const Ie=new Set(["left","top"]);function Ne(e){const t=C(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=f(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,c=_(n)!==i||_(o)!==l;return c&&(n=i,o=l),{width:n,height:o,$:c}}function We(e){return a(e)?e:e.contextElement}function je(e){const t=We(e);if(!f(t))return X(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Ne(t);let l=(i?_(n.width):n.width)/o,c=(i?_(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const Be=X(0);function Ve(e){const t=c(e);return E()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Be}function He(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=We(e);let l=X(1);t&&(o?a(o)&&(l=je(o)):l=je(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==c(e))&&t}(i,n,o)?Ve(i):X(0);let s=(r.left+u.x)/l.x,f=(r.top+u.y)/l.y,d=r.width/l.x,p=r.height/l.y;if(i){const e=c(i),t=o&&a(o)?c(o):o;let n=e,r=M(n);for(;r&&o&&t!==n;){const e=je(r),t=r.getBoundingClientRect(),o=C(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;s*=e.x,f*=e.y,d*=e.x,p*=e.y,s+=i,f+=l,n=c(r),r=M(n)}}return pe({width:d,height:p,x:s,y:f})}function qe(e,t){const n=L(e).scrollLeft;return t?t.left+n:He(u(e)).left+n}function ze(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qe(e,n),y:n.top+t.scrollTop}}const Ke=new Set(["absolute","fixed"]);function _e(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=c(e),o=u(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,s=0,a=0;if(r){i=r.width,l=r.height;const e=E();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,a=r.offsetTop)}const f=qe(o);if(f<=0){const e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-t.clientWidth-r);l<=25&&(i-=l)}else f<=25&&(i+=f);return{width:i,height:l,x:s,y:a}}(e,n);else if("document"===t)o=function(e){const t=u(e),n=L(e),o=e.ownerDocument.body,r=K(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=K(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+qe(e);const c=-n.scrollTop;return"rtl"===C(o).direction&&(l+=K(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:c}}(u(e));else if(a(t))o=function(e,t){const n=He(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=f(e)?je(e):X(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=Ve(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pe(o)}function Ue(e,t){const n=k(e);return!(n===t||!a(n)||A(n))&&("fixed"===C(n).position||Ue(n,t))}function Xe(e,t,n){const o=f(t),r=u(t),i="fixed"===n,c=He(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=X(0);function d(){a.x=qe(r)}if(o||!o&&!i)if(("body"!==l(t)||m(r))&&(s=L(t)),o){const e=He(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else r&&d();i&&!o&&r&&d();const p=!r||o||i?X(0):ze(r,s);return{x:c.left+s.scrollLeft-a.x-p.x,y:c.top+s.scrollTop-a.y-p.y,width:c.width,height:c.height}}function $e(e){return"static"===C(e).position}function Ye(e,t){if(!f(e)||"fixed"===C(e).position)return null;if(t)return t(e);let n=e.offsetParent;return u(e)===n&&(n=n.ownerDocument.body),n}function Ze(e,t){const n=c(e);if(y(e))return n;if(!f(e)){let t=k(e);for(;t&&!A(t);){if(a(t)&&!$e(t))return t;t=k(t)}return n}let o=Ye(e,t);for(;o&&g(o)&&$e(o);)o=Ye(o,t);return o&&A(o)&&$e(o)&&!R(o)?n:o||function(e){let t=k(e);for(;f(t)&&!A(t);){if(R(t))return t;if(y(t))return null;t=k(t)}return null}(e)||n}const Ge={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,c=u(o),s=!!t&&y(t.floating);if(o===c||s&&i)return n;let a={scrollLeft:0,scrollTop:0},d=X(1);const p=X(0),h=f(o);if((h||!h&&!i)&&(("body"!==l(o)||m(c))&&(a=L(o)),f(o))){const e=He(o);d=je(o),p.x=e.x+o.clientLeft,p.y=e.y+o.clientTop}const g=!c||h||i?X(0):ze(c,a);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+p.x+g.x,y:n.y*d.y-a.scrollTop*d.y+p.y+g.y}},getDocumentElement:u,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?y(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=O(e,[],!1).filter(e=>a(e)&&"body"!==l(e)),r=null;const i="fixed"===C(e).position;let c=i?k(e):e;for(;a(c)&&!A(c);){const t=C(c),n=R(c);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&Ke.has(r.position)||m(c)&&!n&&Ue(e,c))?o=o.filter(e=>e!==c):r=t,c=k(c)}return t.set(e,o),o}(t,this._c):[].concat(n),o],c=i[0],u=i.reduce((e,n)=>{const o=_e(t,n,r);return e.top=K(o.top,e.top),e.right=z(o.right,e.right),e.bottom=z(o.bottom,e.bottom),e.left=K(o.left,e.left),e},_e(t,c,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:Ze,getElementRects:async function(e){const t=this.getOffsetParent||Ze,n=this.getDimensions,o=await n(e.floating);return{reference:Xe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Ne(e);return{width:t,height:n}},getScale:je,isElement:a,isRTL:function(e){return"rtl"===C(e).direction}};function Je(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qe(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,a=We(e),f=r||i?[...a?O(a):[],...O(t)]:[];f.forEach(e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=a&&c?function(e,t){let n,o=null;const r=u(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(c,u){void 0===c&&(c=!1),void 0===u&&(u=1),i();const s=e.getBoundingClientRect(),{left:a,top:f,width:d,height:p}=s;if(c||t(),!d||!p)return;const m={rootMargin:-U(f)+"px "+-U(r.clientWidth-(a+d))+"px "+-U(r.clientHeight-(f+p))+"px "+-U(a)+"px",threshold:K(0,z(1,u))||1};let h=!0;function g(t){const o=t[0].intersectionRatio;if(o!==u){if(!h)return l();o?l(!1,o):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==o||Je(s,e.getBoundingClientRect())||l(),h=!1}try{o=new IntersectionObserver(g,{...m,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(g,m)}o.observe(e)}(!0),i}(a,n):null;let p,m=-1,h=null;l&&(h=new ResizeObserver(e=>{let[o]=e;o&&o.target===a&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),a&&!s&&h.observe(a),h.observe(t));let g=s?He(e):null;return s&&function t(){const o=He(e);g&&!Je(g,o)&&n();g=o,p=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(p)}}const et=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:c}=t,u=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=J(n),c=Q(n),u="y"===oe(n),s=Ie.has(l)?-1:1,a=i&&u?-1:1,f=G(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),u?{x:p*a,y:d*s}:{x:d*s,y:p*a}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(o=c.arrow)&&o.alignmentOffset?{}:{x:r+u.x,y:i+u.y,data:{...u,placement:l}}}}},tt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=G(e,t),s={x:n,y:o},a=await De(t,u),f=oe(J(r)),d=ee(f);let p=s[d],m=s[f];if(i){const e="y"===d?"bottom":"right";p=Z(p+a["y"===d?"top":"left"],p,p-a[e])}if(l){const e="y"===f?"bottom":"right";m=Z(m+a["y"===f?"top":"left"],m,m-a[e])}const h=c.fn({...t,[d]:p,[f]:m});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:i,[f]:l}}}}}},nt=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:c,platform:u,elements:s}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=G(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=J(r),y=oe(c),w=J(c)===c,b=await(null==u.isRTL?void 0:u.isRTL(s.floating)),x=d||(w||!h?[fe(c)]:function(e){const t=fe(e);return[ie(e),t,ie(t)]}(c)),R="none"!==m;!d&&R&&x.push(...ae(c,h,m,b));const E=[c,...x],S=await De(t,g),A=[];let C=(null==(o=i.flip)?void 0:o.overflows)||[];if(a&&A.push(S[v]),f){const e=function(e,t,n){void 0===n&&(n=!1);const o=Q(e),r=re(e),i=te(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=fe(l)),[l,fe(l)]}(r,l,b);A.push(S[e[0]],S[e[1]])}if(C=[...C,{placement:r,overflows:A}],!A.every(e=>e<=0)){var L,k;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=E[e];if(t){if(!("alignment"===f&&y!==oe(t))||C.every(e=>oe(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let n=null==(k=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:k.placement;if(!n)switch(p){case"bestFit":{var T;const e=null==(T=C.filter(e=>{if(R){const t=oe(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=c}if(r!==n)return{reset:{placement:n}}}return{}}}},ot=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:l,elements:c}=t,{apply:u=()=>{},...s}=G(e,t),a=await De(t,s),f=J(r),d=Q(r),p="y"===oe(r),{width:m,height:h}=i.floating;let g,v;"top"===f||"bottom"===f?(g=f,v=d===(await(null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(v=f,g="end"===d?"top":"bottom");const y=h-a.top-a.bottom,w=m-a.left-a.right,b=z(h-a[g],y),x=z(m-a[v],w),R=!t.middlewareData.shift;let E=b,S=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=w),null!=(o=t.middlewareData.shift)&&o.enabled.y&&(E=y),R&&!d){const e=K(a.left,0),t=K(a.right,0),n=K(a.top,0),o=K(a.bottom,0);p?S=m-2*(0!==e||0!==t?e+t:K(a.left,a.right)):E=h-2*(0!==n||0!==o?n+o:K(a.top,a.bottom))}await u({...t,availableWidth:S,availableHeight:E});const A=await l.getDimensions(c.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}},rt=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:o,rects:r,platform:i,strategy:l}=t,{padding:c=2,x:u,y:s}=G(e,t),a=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),f=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let o=null;for(let e=0;e<t.length;e++){const r=t[e];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(e=>pe(Fe(e)))}(a),d=pe(Fe(a)),p=de(c);const m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=u&&null!=s)return f.find(e=>u>e.left-p.left&&u<e.right+p.right&&s>e.top-p.top&&s<e.bottom+p.bottom)||d;if(f.length>=2){if("y"===oe(n)){const e=f[0],t=f[f.length-1],o="top"===J(n),r=e.top,i=t.bottom,l=o?e.left:t.left,c=o?e.right:t.right;return{top:r,bottom:i,left:l,right:c,width:c-l,height:i-r,x:l,y:r}}const e="left"===J(n),t=K(...f.map(e=>e.right)),o=z(...f.map(e=>e.left)),r=f.filter(n=>e?n.left===o:n.right===t),i=r[0].top,l=r[r.length-1].bottom;return{top:i,bottom:l,left:o,right:t,width:t-o,height:l-i,x:o,y:i}}return d}},floating:o.floating,strategy:l});return r.reference.x!==m.reference.x||r.reference.y!==m.reference.y||r.reference.width!==m.reference.width||r.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},it=(e,t,n)=>{const o=new Map,r={platform:Ge,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),u=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:a,y:f}=Pe(s,o,u),d=o,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:h}=c[n],{x:g,y:v,data:y,reset:w}=await h({x:a,y:f,initialPlacement:o,placement:d,strategy:r,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=g?g:a,f=null!=v?v:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:r}):w.rects),({x:a,y:f}=Pe(s,d,u))),n=-1)}return{x:a,y:f,placement:d,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var lt="undefined"!=typeof document?t:function(){};function ct(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;0!==o--;)if(!ct(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;0!==o--;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;0!==o--;){const n=r[o];if(("_owner"!==n||!e.$$typeof)&&!ct(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ut(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function st(e,t){const n=ut(e);return Math.round(t*n)/n}function at(t){const n=e.useRef(t);return lt(()=>{n.current=t}),n}const ft=(e,t)=>({...et(e),options:[e,t]}),dt=(e,t)=>({...tt(e),options:[e,t]}),pt=(e,t)=>({...nt(e),options:[e,t]}),mt=(e,t)=>({...ot(e),options:[e,t]}),ht=(e,t)=>({...rt(e),options:[e,t]});function gt(t){return e.useMemo(()=>t.every(e=>null==e)?null:e=>{t.forEach(t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)})},t)}const vt={...e},yt=vt.useInsertionEffect||(e=>e());function wt(t){const n=e.useRef(()=>{});return yt(()=>{n.current=t}),e.useCallback(function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return null==n.current?void 0:n.current(...t)},[])}var bt="undefined"!=typeof document?t:n;function xt(){return xt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},xt.apply(this,arguments)}let Rt=!1,Et=0;const St=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Et++;const At=vt.useId||function(){const[t,n]=e.useState(()=>Rt?St():void 0);return bt(()=>{null==t&&n(St())},[]),e.useEffect(()=>{Rt=!0},[]),t};const Ct=e.createContext(null),Lt=e.createContext(null),kt=()=>e.useContext(Lt);function Tt(e){return"data-floating-ui-"+e}function Ot(e){const t=o(e);return bt(()=>{t.current=e}),t}let Mt=0;function Pt(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Mt);const i=()=>null==e?void 0:e.focus({preventScroll:n});r?i():Mt=requestAnimationFrame(i)}function Dt(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),o=n;for(;o.length;)o=e.filter(e=>{var t;return null==(t=o)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(o);return n}let Ft=new WeakMap,It=new WeakSet,Nt={},Wt=0;const jt=e=>e&&(e.host||jt(e.parentNode));function Bt(e,t,n,o){const r="data-floating-ui-inert",i=o?"inert":n?"aria-hidden":null,c=(u=t,e.map(e=>{if(u.contains(e))return e;const t=jt(e);return u.contains(t)?t:null}).filter(e=>null!=e));var u;const s=new Set,a=new Set(c),f=[];Nt[r]||(Nt[r]=new WeakMap);const d=Nt[r];return c.forEach(function e(t){if(!t||s.has(t))return;s.add(t),t.parentNode&&e(t.parentNode)}),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,t=>{if("script"!==l(t))if(s.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,o=(Ft.get(t)||0)+1,l=(d.get(t)||0)+1;Ft.set(t,o),d.set(t,l),f.push(t),1===o&&n&&It.add(t),1===l&&t.setAttribute(r,""),!n&&i&&t.setAttribute(i,"true")}})}(t),s.clear(),Wt++,()=>{f.forEach(e=>{const t=(Ft.get(e)||0)-1,n=(d.get(e)||0)-1;Ft.set(e,t),d.set(e,n),t||(!It.has(e)&&i&&e.removeAttribute(i),It.delete(e)),n||e.removeAttribute(r)}),Wt--,Wt||(Ft=new WeakMap,Ft=new WeakMap,It=new WeakSet,Nt={})}}function Vt(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=j(e[0]).body;return Bt(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const Ht=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function qt(e,t){const n=Me(e,Ht());"prev"===t&&n.reverse();const o=n.indexOf(P(j(e)));return n.slice(o+1)[0]}function zt(){return qt(document.body,"next")}function Kt(){return qt(document.body,"prev")}function _t(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!D(n,o)}function Ut(e){Me(e,Ht()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function Xt(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}const $t={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function Yt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Zt=e.forwardRef(function(t,n){const[o,r]=e.useState();bt(()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Yt),()=>{document.removeEventListener("keydown",Yt)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,[Tt("focus-guard")]:"",style:$t};return e.createElement("span",xt({},t,i))}),Gt=e.createContext(null),Jt=Tt("portal");function Qt(t){const{children:n,id:o,root:i,preserveTabOrder:l=!0}=t,c=function(t){void 0===t&&(t={});const{id:n,root:o}=t,r=At(),i=en(),[l,c]=e.useState(null),u=e.useRef(null);return bt(()=>()=>{null==l||l.remove(),queueMicrotask(()=>{u.current=null})},[l]),bt(()=>{if(!r)return;if(u.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=r,t.setAttribute(Jt,""),e.appendChild(t),u.current=t,c(t)},[n,r]),bt(()=>{if(null===o)return;if(!r)return;if(u.current)return;let e=o||(null==i?void 0:i.portalNode);e&&!a(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const l=document.createElement("div");l.id=r,l.setAttribute(Jt,""),e=t||e,e.appendChild(l),u.current=l,c(l)},[n,o,r,i]),l}({id:o,root:i}),[u,s]=e.useState(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=null==u?void 0:u.modal,g=null==u?void 0:u.open,v=!!u&&!u.modal&&u.open&&l&&!(!i&&!c);return e.useEffect(()=>{if(c&&l&&!h)return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&_t(e)){("focusin"===e.type?Xt:Ut)(c)}}},[c,l,h]),e.useEffect(()=>{c&&(g||Xt(c))},[g,c]),e.createElement(Gt.Provider,{value:e.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:s}),[l,c])},v&&c&&e.createElement(Zt,{"data-type":"outside",ref:f,onFocus:e=>{if(_t(e,c)){var t;null==(t=p.current)||t.focus()}else{const e=Kt()||(null==u?void 0:u.refs.domReference.current);null==e||e.focus()}}}),v&&c&&e.createElement("span",{"aria-owns":c.id,style:$t}),c&&r.createPortal(n,c),v&&c&&e.createElement(Zt,{"data-type":"outside",ref:d,onFocus:e=>{if(_t(e,c)){var t;null==(t=m.current)||t.focus()}else{const t=zt()||(null==u?void 0:u.refs.domReference.current);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))}const en=()=>e.useContext(Gt),tn="data-floating-ui-focusable";let nn=[];function on(e){nn=nn.filter(e=>e.isConnected);let t=e;if(t&&"body"!==l(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ge.call(e,me)&&ke(t,e)}(t,Ht())){const e=Me(t,Ht())[0];e&&(t=e)}nn.push(t),nn.length>20&&(nn=nn.slice(-20))}}function rn(){return nn.slice().reverse().find(e=>e.isConnected)}const ln=e.forwardRef(function(t,n){return e.createElement("button",xt({},t,{type:"button",ref:n,tabIndex:-1,style:$t}))});function cn(t){const{context:n,children:o,disabled:r=!1,order:i=["content"],guards:l=!0,initialFocus:c=0,returnFocus:u=!0,restoreFocus:s=!1,modal:a=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0}=t,{open:m,refs:h,nodeId:g,onOpenChange:v,events:y,dataRef:w,floatingId:b,elements:{domReference:x,floating:R}}=n,E="number"==typeof c&&c<0,S=q(x)&&E,A="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,C=Ot(i),L=Ot(c),k=Ot(u),T=kt(),O=en(),M=e.useRef(null),F=e.useRef(null),I=e.useRef(!1),B=e.useRef(!1),z=e.useRef(-1),K=null!=O,_=(U=R)?U.hasAttribute(tn)?U:U.querySelector("["+tn+"]")||U:null;var U;const X=wt(function(e){return void 0===e&&(e=_),e?Me(e,Ht()):[]}),$=wt(e=>{const t=X(e);return C.current.map(e=>x&&"reference"===e?x:_&&"floating"===e?_:t).filter(Boolean).flat()});function Y(t){return!r&&d&&a?e.createElement(ln,{ref:"start"===t?M:F,onClick:e=>v(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}e.useEffect(()=>{if(r)return;if(!a)return;function e(e){if("Tab"===e.key){D(_,P(j(_)))&&0===X().length&&!S&&H(e);const t=$(),n=V(e);"reference"===C.current[0]&&n===x&&(H(e),e.shiftKey?Pt(t[t.length-1]):Pt(t[1])),"floating"===C.current[1]&&n===_&&e.shiftKey&&(H(e),Pt(t[0]))}}const t=j(_);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,x,_,a,C,S,X,$]),e.useEffect(()=>{if(!r&&R)return R.addEventListener("focusin",e),()=>{R.removeEventListener("focusin",e)};function e(e){const t=V(e),n=X().indexOf(t);-1!==n&&(z.current=n)}},[r,R,X]),e.useEffect(()=>{if(!r&&p)return R&&f(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),R.addEventListener("focusout",t),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),R.removeEventListener("focusout",t)}):void 0;function e(){B.current=!0,setTimeout(()=>{B.current=!1})}function t(e){const t=e.relatedTarget;queueMicrotask(()=>{const n=!(D(x,t)||D(R,t)||D(t,R)||D(null==O?void 0:O.portalNode,t)||null!=t&&t.hasAttribute(Tt("focus-guard"))||T&&(Dt(T.nodesRef.current,g).find(e=>{var n,o;return D(null==(n=e.context)?void 0:n.elements.floating,t)||D(null==(o=e.context)?void 0:o.elements.domReference,t)})||function(e,t){var n;let o=[],r=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;r;){const t=e.find(e=>e.id===r);r=null==t?void 0:t.parentId,t&&(o=o.concat(t))}return o}(T.nodesRef.current,g).find(e=>{var n,o;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(s&&n&&P(j(_))===j(_).body){f(_)&&_.focus();const e=z.current,t=X(),n=t[e]||t[t.length-1]||_;f(n)&&n.focus()}!S&&a||!t||!n||B.current||t===rn()||(I.current=!0,v(!1,e,"focus-out"))})}},[r,x,R,_,a,g,T,O,v,p,s,X,S]),e.useEffect(()=>{var e;if(r)return;const t=Array.from((null==O||null==(e=O.portalNode)?void 0:e.querySelectorAll("["+Tt("portal")+"]"))||[]);if(R){const e=[R,...t,M.current,F.current,C.current.includes("reference")||S?x:null].filter(e=>null!=e),n=a||S?Vt(e,A,!A):Vt(e);return()=>{n()}}},[r,x,R,a,C,O,S,A]),bt(()=>{if(r||!f(_))return;const e=P(j(_));queueMicrotask(()=>{const t=$(_),n=L.current,o=("number"==typeof n?t[n]:n.current)||_,r=D(_,e);E||r||!m||Pt(o,{preventScroll:o===_})})},[r,m,_,E,$,L]),bt(()=>{if(r||!_)return;let e=!1;const t=j(_),n=P(t);let o=w.current.openEvent;function i(t){let{open:n,reason:r,event:i,nested:l}=t;n&&(o=i),"escape-key"===r&&h.domReference.current&&on(h.domReference.current),"hover"===r&&"mouseleave"===i.type&&(I.current=!0),"outside-press"===r&&(l?(I.current=!1,e=!0):I.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(W()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||N(i)))}on(n),y.on("openchange",i);const l=t.createElement("span");return l.setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),Object.assign(l.style,$t),K&&x&&x.insertAdjacentElement("afterend",l),()=>{y.off("openchange",i);const n=P(t),r=D(R,n)||T&&Dt(T.nodesRef.current,g).some(e=>{var t;return D(null==(t=e.context)?void 0:t.elements.floating,n)});(r||o&&["click","mousedown"].includes(o.type))&&h.domReference.current&&on(h.domReference.current);const c="boolean"==typeof k.current?rn()||l:k.current.current||l;queueMicrotask(()=>{k.current&&!I.current&&f(c)&&(c===n||n===t.body||r)&&c.focus({preventScroll:e}),l.remove()})}},[r,R,_,k,w,h,y,T,g,K,x]),e.useEffect(()=>{queueMicrotask(()=>{I.current=!1})},[r]),bt(()=>{if(!r&&O)return O.setFocusManagerState({modal:a,closeOnFocusOut:p,open:m,onOpenChange:v,refs:h}),()=>{O.setFocusManagerState(null)}},[r,O,a,m,v,h,p]),bt(()=>{if(r)return;if(!_)return;if("function"!=typeof MutationObserver)return;if(E)return;const e=()=>{const e=_.getAttribute("tabindex"),t=X(),n=P(j(R)),o=t.indexOf(n);-1!==o&&(z.current=o),C.current.includes("floating")||n!==h.domReference.current&&0===t.length?"0"!==e&&_.setAttribute("tabindex","0"):"-1"!==e&&_.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(_,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[r,R,_,h,C,X,E]);const Z=!r&&A&&(!a||!S)&&(K||a);return e.createElement(e.Fragment,null,Z&&e.createElement(Zt,{"data-type":"inside",ref:null==O?void 0:O.beforeInsideRef,onFocus:e=>{if(a){const e=$();Pt("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=O&&O.preserveTabOrder&&O.portalNode)if(I.current=!1,_t(e,O.portalNode)){const e=zt()||x;null==e||e.focus()}else{var t;null==(t=O.beforeOutsideRef.current)||t.focus()}}}),!S&&Y("start"),o,Y("end"),Z&&e.createElement(Zt,{"data-type":"inside",ref:null==O?void 0:O.afterInsideRef,onFocus:e=>{if(a)Pt($()[0]);else if(null!=O&&O.preserveTabOrder&&O.portalNode)if(p&&(I.current=!0),_t(e,O.portalNode)){const e=Kt()||x;null==e||e.focus()}else{var t;null==(t=O.afterOutsideRef.current)||t.focus()}}}))}let un=0;let sn=()=>{};const an=e.forwardRef(function(t,n){const{lockScroll:o=!1,...r}=t;return bt(()=>{if(o)return un++,1===un&&(sn=function(){const e=/iP(hone|ad|od)|iOS/.test(F()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,r=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var l,c;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(r-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(r,i))}}()),()=>{un--,0===un&&sn()}},[o]),e.createElement("div",xt({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}),fn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},pn=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function mn(t,n){void 0===n&&(n={});const{open:o,onOpenChange:r,elements:i,dataRef:l}=t,{enabled:c=!0,escapeKey:u=!0,outsidePress:s=!0,outsidePressEvent:d="pointerdown",referencePress:p=!1,referencePressEvent:m="pointerdown",ancestorScroll:h=!1,bubbles:g,capture:v}=n,y=kt(),w=wt("function"==typeof s?s:()=>!1),b="function"==typeof s?w:s,x=e.useRef(!1),R=e.useRef(!1),{escapeKey:S,outsidePress:L}=pn(g),{escapeKey:T,outsidePress:M}=pn(v),P=e.useRef(!1),F=wt(e=>{var t;if(!o||!c||!u||"Escape"!==e.key)return;if(P.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=y?Dt(y.nodesRef.current,n):[];if(!S&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),I=wt(e=>{var t;const n=()=>{var t;F(e),null==(t=V(e))||t.removeEventListener("keydown",n)};null==(t=V(e))||t.addEventListener("keydown",n)}),N=wt(e=>{var t;const n=x.current;x.current=!1;const o=R.current;if(R.current=!1,"click"===d&&o)return;if(n)return;if("function"==typeof b&&!b(e))return;const c=V(e),u="["+Tt("inert")+"]",s=j(i.floating).querySelectorAll(u);let p=a(c)?c:null;for(;p&&!A(p);){const e=k(p);if(A(e)||!a(e))break;p=e}if(s.length&&a(c)&&!c.matches("html,body")&&!D(c,i.floating)&&Array.from(s).every(e=>!D(p,e)))return;if(f(c)&&q){const t=c.clientWidth>0&&c.scrollWidth>c.clientWidth,n=c.clientHeight>0&&c.scrollHeight>c.clientHeight;let o=n&&e.offsetX>c.clientWidth;if(n){"rtl"===C(c).direction&&(o=e.offsetX<=c.offsetWidth-c.clientWidth)}if(o||t&&e.offsetY>c.clientHeight)return}const m=null==(t=l.current.floatingContext)?void 0:t.nodeId,h=y&&Dt(y.nodesRef.current,m).some(t=>{var n;return B(e,null==(n=t.context)?void 0:n.elements.floating)});if(B(e,i.floating)||B(e,i.domReference)||h)return;const g=y?Dt(y.nodesRef.current,m):[];if(g.length>0){let e=!0;if(g.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),W=wt(e=>{var t;const n=()=>{var t;N(e),null==(t=V(e))||t.removeEventListener(d,n)};null==(t=V(e))||t.addEventListener(d,n)});e.useEffect(()=>{if(!o||!c)return;l.current.__escapeKeyBubbles=S,l.current.__outsidePressBubbles=L;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),P.current=!0}function s(){e=window.setTimeout(()=>{P.current=!1},E()?5:0)}const f=j(i.floating);u&&(f.addEventListener("keydown",T?I:F,T),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",s)),b&&f.addEventListener(d,M?W:N,M);let p=[];return h&&(a(i.domReference)&&(p=O(i.domReference)),a(i.floating)&&(p=p.concat(O(i.floating))),!a(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(O(i.reference.contextElement)))),p=p.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)}),p.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{u&&(f.removeEventListener("keydown",T?I:F,T),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",s)),b&&f.removeEventListener(d,M?W:N,M),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[l,i,u,b,d,o,r,h,c,S,L,F,T,I,N,M,W]),e.useEffect(()=>{x.current=!1},[b,d]);const H=e.useMemo(()=>({onKeyDown:F,[fn[m]]:e=>{p&&r(!1,e.nativeEvent,"reference-press")}}),[F,r,p,m]),q=e.useMemo(()=>({onKeyDown:F,onMouseDown(){R.current=!0},onMouseUp(){R.current=!0},[dn[d]]:()=>{x.current=!0}}),[F,d]);return e.useMemo(()=>c?{reference:H,floating:q}:{},[c,H,q])}function hn(t){const{open:n=!1,onOpenChange:o,elements:r}=t,i=At(),l=e.useRef({}),[c]=e.useState(()=>function(){const e=new Map;return{emit(t,n){var o;null==(o=e.get(t))||o.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,(null==(o=e.get(t))?void 0:o.filter(e=>e!==n))||[])}}}()),u=null!=((null==(s=e.useContext(Ct))?void 0:s.id)||null);var s;const[a,f]=e.useState(r.reference),d=wt((e,t,n)=>{l.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==o||o(e,t,n)}),p=e.useMemo(()=>({setPositionReference:f}),[]),m=e.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return e.useMemo(()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:c,floatingId:i,refs:p}),[n,d,m,c,i,p])}function gn(t){void 0===t&&(t={});const{nodeId:n}=t,o=hn({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||o,l=i.elements,[c,u]=e.useState(null),[s,f]=e.useState(null),d=(null==l?void 0:l.domReference)||c,p=e.useRef(null),m=kt();bt(()=>{d&&(p.current=d)},[d]);const h=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:c,floating:u}={},transform:s=!0,whileElementsMounted:a,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(i);ct(m,i)||h(i);const[g,v]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),x=e.useCallback(e=>{e!==A.current&&(A.current=e,w(e))},[]),R=c||g,E=u||y,S=e.useRef(null),A=e.useRef(null),C=e.useRef(d),L=null!=a,k=at(a),T=at(l),O=at(f),M=e.useCallback(()=>{if(!S.current||!A.current)return;const e={placement:n,strategy:o,middleware:m};T.current&&(e.platform=T.current),it(S.current,A.current,e).then(e=>{const t={...e,isPositioned:!1!==O.current};P.current&&!ct(C.current,t)&&(C.current=t,r.flushSync(()=>{p(t)}))})},[m,n,o,T,O]);lt(()=>{!1===f&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[f]);const P=e.useRef(!1);lt(()=>(P.current=!0,()=>{P.current=!1}),[]),lt(()=>{if(R&&(S.current=R),E&&(A.current=E),R&&E){if(k.current)return k.current(R,E,M);M()}},[R,E,M,k,L]);const D=e.useMemo(()=>({reference:S,floating:A,setReference:b,setFloating:x}),[b,x]),F=e.useMemo(()=>({reference:R,floating:E}),[R,E]),I=e.useMemo(()=>{const e={position:o,left:0,top:0};if(!F.floating)return e;const t=st(F.floating,d.x),n=st(F.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...ut(F.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:t,top:n}},[o,s,F.floating,d.x,d.y]);return e.useMemo(()=>({...d,update:M,refs:D,elements:F,floatingStyles:I}),[d,M,D,F,I])}({...t,elements:{...l,...s&&{reference:s}}}),g=e.useCallback(e=>{const t=a(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f(t),h.refs.setReference(t)},[h.refs]),v=e.useCallback(e=>{(a(e)||null===e)&&(p.current=e,u(e)),(a(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!a(e))&&h.refs.setReference(e)},[h.refs]),y=e.useMemo(()=>({...h.refs,setReference:v,setPositionReference:g,domReference:p}),[h.refs,v,g]),w=e.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=e.useMemo(()=>({...h,...i,refs:y,elements:w,nodeId:n}),[h,y,w,n,i]);return bt(()=>{i.dataRef.current.floatingContext=b;const e=null==m?void 0:m.nodesRef.current.find(e=>e.id===n);e&&(e.context=b)}),e.useMemo(()=>({...h,context:b,refs:y,elements:w}),[h,y,w,b])}const vn="active",yn="selected";function wn(e,t,n){const o=new Map,r="item"===n;let i=e;if(r&&e){const{[vn]:t,[yn]:n,...o}=e;i=o}return{..."floating"===n&&{tabIndex:-1,[tn]:""},...i,...t.map(t=>{const o=t?t[n]:null;return"function"==typeof o?e?o(e):null:o}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,i]=t;var l;r&&[vn,yn].includes(n)||(0===n.indexOf("on")?(o.has(n)||o.set(n,[]),"function"==typeof i&&(null==(l=o.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return null==(e=o.get(n))?void 0:e.map(e=>e(...r)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}function bn(t){void 0===t&&(t=[]);const n=t.map(e=>null==e?void 0:e.reference),o=t.map(e=>null==e?void 0:e.floating),r=t.map(e=>null==e?void 0:e.item),i=e.useCallback(e=>wn(e,t,"reference"),n),l=e.useCallback(e=>wn(e,t,"floating"),o),c=e.useCallback(e=>wn(e,t,"item"),r);return e.useMemo(()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c}),[i,l,c])}const xn=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function Rn(e,t){return"function"==typeof e?e(t):e}function En(t,n){void 0===n&&(n={});const{open:o,elements:{floating:r}}=t,{duration:i=250}=n,l=("number"==typeof i?i:i.close)||0,[c,u]=e.useState("unmounted"),s=function(t,n){const[o,r]=e.useState(t);return t&&!o&&r(!0),e.useEffect(()=>{if(!t&&o){const e=setTimeout(()=>r(!1),n);return()=>clearTimeout(e)}},[t,o,n]),o}(o,l);return s||"close"!==c||u("unmounted"),bt(()=>{if(r){if(o){u("initial");const e=requestAnimationFrame(()=>{u("open")});return()=>{cancelAnimationFrame(e)}}u("close")}},[o,r]),{isMounted:s,status:c}}function Sn(t,n){void 0===n&&(n={});const{initial:o={opacity:0},open:r,close:i,common:l,duration:c=250}=n,u=t.placement,s=u.split("-")[0],a=e.useMemo(()=>({side:s,placement:u}),[s,u]),f="number"==typeof c,d=(f?c:c.open)||0,p=(f?c:c.close)||0,[m,h]=e.useState(()=>({...Rn(l,a),...Rn(o,a)})),{isMounted:g,status:v}=En(t,{duration:c}),y=Ot(o),w=Ot(r),b=Ot(i),x=Ot(l);return bt(()=>{const e=Rn(y.current,a),t=Rn(b.current,a),n=Rn(x.current,a),o=Rn(w.current,a)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===v&&h(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===v&&h({transitionProperty:Object.keys(o).map(xn).join(","),transitionDuration:d+"ms",...n,...o}),"close"===v){const o=t||e;h({transitionProperty:Object.keys(o).map(xn).join(","),transitionDuration:p+"ms",...n,...o})}},[p,b,y,w,x,d,v,a]),{isMounted:g,styles:m}}export{cn as F,Qe as a,mt as b,Sn as c,gt as d,mn as e,pt as f,bn as g,At as h,ht as i,Qt as j,an as k,ft as o,dt as s,gn as u};
@@ -1 +1 @@
1
- import{jsxs as o,Fragment as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useState as a,useEffect as c,cloneElement as l}from"react";import{u as n,o as i,f as s,s as g,a as h}from"./floating-ui.react-33212df0.js";import{Z as p,O as d}from"./index-e0185864.js";const u=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],m=r(({value:r={backgroundColor:"#FFFF00"},onChange:m,presets:b=u,showInput:k=!0,className:C,children:F,placement:f="bottom",offset:y=8},_)=>{const[v,j]=a(!1),[N,O]=a("backgroundColor"),[w,x]=a(r.backgroundColor),[E,L]=a(r.color),{refs:P,floatingStyles:B}=n({open:v,onOpenChange:j,placement:f,middleware:[i(y),s(),g()],whileElementsMounted:h});c(()=>{r.backgroundColor&&x(r.backgroundColor),r.color&&L(r.color)},[r]),c(()=>{if(!v)return;const o=o=>{const e=o.target,t=P.reference.current,r=P.floating.current;t&&t instanceof Element&&t.contains(e)||(null==r?void 0:r.contains(e))||j(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[v,P.floating,P.reference]);const H=o=>{"backgroundColor"===N?(x(o),null==m||m(Object.assign(Object.assign({},r),{backgroundColor:o}))):(L(o),null==m||m(Object.assign(Object.assign({},r),{color:o})))},M="backgroundColor"===N?w:E,S=l(F,{ref:P.setReference,onClick:o=>{var e,t;o.stopPropagation(),j(o=>!o),null===(t=(e=F.props).onClick)||void 0===t||t.call(e,o)}});return o(e,{children:[S,v&&o("div",Object.assign({ref:o=>{P.setFloating(o),_&&("function"==typeof _?_(o):_.current=o)},style:B,className:`yoopta-highlight-color-picker ${null!=C?C:""}`,onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()},{children:[o("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[t("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===N,onClick:()=>O("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),t("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===N,onClick:()=>O("color"),"aria-label":"Text color"},{children:"Text"}))]})),t("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:t(p,{color:M,onChange:H,className:"yoopta-highlight-color-picker__react-colorful"})})),b.length>0&&t("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:b.map(o=>{const e=(null==M?void 0:M.toLowerCase())===o.toLowerCase();return t("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":e,style:{backgroundColor:o},onClick:()=>H(o),"aria-label":`Select color ${o}`},o)})})),k&&o("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[t("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:M}}),t(d,{color:M,onChange:H,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});m.displayName="HighlightColorPicker";export{m as H};
1
+ import{jsxs as o,Fragment as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useState as a,useEffect as c,cloneElement as l}from"react";import{u as n,o as i,f as s,s as g,a as h}from"./floating-ui.react-727e4287.js";import{Z as p,O as d}from"./index-e0185864.js";const u=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],m=r(({value:r={backgroundColor:"#FFFF00"},onChange:m,presets:b=u,showInput:k=!0,className:C,children:F,placement:f="bottom",offset:y=8},_)=>{const[v,j]=a(!1),[N,O]=a("backgroundColor"),[w,x]=a(r.backgroundColor),[E,L]=a(r.color),{refs:P,floatingStyles:B}=n({open:v,onOpenChange:j,placement:f,middleware:[i(y),s(),g()],whileElementsMounted:h});c(()=>{r.backgroundColor&&x(r.backgroundColor),r.color&&L(r.color)},[r]),c(()=>{if(!v)return;const o=o=>{const e=o.target,t=P.reference.current,r=P.floating.current;t&&t instanceof Element&&t.contains(e)||(null==r?void 0:r.contains(e))||j(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[v,P.floating,P.reference]);const H=o=>{"backgroundColor"===N?(x(o),null==m||m(Object.assign(Object.assign({},r),{backgroundColor:o}))):(L(o),null==m||m(Object.assign(Object.assign({},r),{color:o})))},M="backgroundColor"===N?w:E,S=l(F,{ref:P.setReference,onClick:o=>{var e,t;o.stopPropagation(),j(o=>!o),null===(t=(e=F.props).onClick)||void 0===t||t.call(e,o)}});return o(e,{children:[S,v&&o("div",Object.assign({ref:o=>{P.setFloating(o),_&&("function"==typeof _?_(o):_.current=o)},style:B,className:`yoopta-highlight-color-picker ${null!=C?C:""}`,onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()},{children:[o("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[t("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===N,onClick:()=>O("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),t("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===N,onClick:()=>O("color"),"aria-label":"Text color"},{children:"Text"}))]})),t("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:t(p,{color:M,onChange:H,className:"yoopta-highlight-color-picker__react-colorful"})})),b.length>0&&t("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:b.map(o=>{const e=(null==M?void 0:M.toLowerCase())===o.toLowerCase();return t("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":e,style:{backgroundColor:o},onClick:()=>H(o),"aria-label":`Select color ${o}`},o)})})),k&&o("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[t("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:M}}),t(d,{color:M,onChange:H,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});m.displayName="HighlightColorPicker";export{m as H};
@@ -4,8 +4,8 @@ export declare const ElementOptionsContext: import("react").Context<ElementOptio
4
4
  export declare function useElementOptionsContext(): ElementOptionsContextValue;
5
5
  export declare function useElementOptions(): {
6
6
  blockId: string;
7
- element: import("@yoopta/editor").SlateElement<string, any>;
8
- editor: import("@yoopta/editor").BaseYooEditor;
7
+ element: SlateElement;
8
+ editor: YooEditor;
9
9
  isOpen: boolean;
10
10
  setIsOpen: (open: boolean) => void;
11
11
  };