@contentful/f36-multiselect 5.5.0 → 6.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { CommonProps } from '@contentful/f36-core';
3
3
  import { ButtonProps } from '@contentful/f36-button';
4
- import { PopoverProps } from '@contentful/f36-popover';
4
+ import { Placement, OffsetOptions } from '@floating-ui/react';
5
5
 
6
- declare type LabelOrChildren = {
6
+ type LabelOrChildren = {
7
7
  /**
8
8
  * When using React children it is your own responsibility to highlight
9
9
  * the matching part of the item label. Use the `HighlightedItem`
@@ -15,7 +15,7 @@ declare type LabelOrChildren = {
15
15
  children?: never;
16
16
  label: string;
17
17
  };
18
- declare type MultiselectOptionProps = {
18
+ type MultiselectOptionProps = {
19
19
  value: string;
20
20
  itemId: string;
21
21
  searchValue?: string;
@@ -24,15 +24,104 @@ declare type MultiselectOptionProps = {
24
24
  isChecked?: boolean;
25
25
  isDisabled?: boolean;
26
26
  } & LabelOrChildren;
27
- declare const MultiselectOption: ({ children, label, value, itemId, onSelectItem, searchValue, isChecked, isDisabled, className, ...rest }: MultiselectOptionProps) => JSX.Element;
27
+ declare const MultiselectOption: ({ children, label, value, itemId, onSelectItem, isChecked, isDisabled, className, ...rest }: MultiselectOptionProps) => React.JSX.Element;
28
28
  declare function HighlightedItem({ item, inputValue, }: {
29
29
  item: string;
30
30
  inputValue?: string;
31
- }): JSX.Element;
31
+ }): React.JSX.Element;
32
32
  declare namespace HighlightedItem {
33
33
  var displayName: string;
34
34
  }
35
35
 
36
+ interface PopoverProps {
37
+ children: React.ReactNode;
38
+ /**
39
+ * Boolean to determine if the Popover should be the same width as
40
+ * the trigger element
41
+ *
42
+ * @default false
43
+ */
44
+ isFullWidth?: boolean;
45
+ /**
46
+ * Boolean to control whether or not the Popover is open
47
+ *
48
+ * @default false
49
+ */
50
+ isOpen?: boolean;
51
+ /**
52
+ * Callback fired when the popover closes
53
+ */
54
+ onClose?: () => void;
55
+ /**
56
+ * Determines the preferred position of the Popover. This position is not
57
+ * guaranteed, as the Popover might be moved to fit the viewport
58
+ *
59
+ * @default bottom-start
60
+ */
61
+ placement?: Placement | 'auto';
62
+ /**
63
+ * Boolean to control if popover is allowed to change its placement automatically
64
+ * based on available space in the viewport.
65
+ *
66
+ * For example:
67
+ * If you set placement prop to bottom, but there isn't enough space to position the popover in that direction,
68
+ * it will change the popper placement to top. As soon as enough space is detected, the placement will be reverted to the defined one.
69
+ *
70
+ * If you want the popover to strictly follow the placement prop you should set this prop to false.
71
+ *
72
+ * @default true
73
+ */
74
+ isAutoalignmentEnabled?: boolean;
75
+ /**
76
+ * Boolean to control whether or not to render the Popover in a React Portal.
77
+ * Rendering content inside a Portal allows the Popover to escape the bounds
78
+ * of its parent while still being positioned correctly. Using a Portal is
79
+ * necessary if an ancestor of the Popover hides overflow.
80
+ *
81
+ * @default true
82
+ */
83
+ usePortal?: boolean;
84
+ /**
85
+ * If true, the popover will close when you blur out it by clicking outside or tabbing out
86
+ *
87
+ * @default true
88
+ */
89
+ closeOnBlur?: boolean;
90
+ /**
91
+ * If true, the popover will close when you hit the Esc key
92
+ *
93
+ * @default true
94
+ */
95
+ closeOnEsc?: boolean;
96
+ /**
97
+ * If true, the popover will be focused after opening
98
+ *
99
+ * @default true
100
+ */
101
+ autoFocus?: boolean;
102
+ /**
103
+ * Popover id. Will be used as an `id` attribute on popover
104
+ * and as `aria-controls` attribute on trigger
105
+ *
106
+ * @default true
107
+ */
108
+ id?: string;
109
+ /**
110
+ * Single number as short hand for `mainAxis`
111
+ * Or object which can contain `mainAxis`, `crossAxis` or `alignmentAxis`
112
+ *
113
+ * @default 0
114
+ */
115
+ offset?: OffsetOptions;
116
+ /**
117
+ * Defines if popover should be rendered in the DOM only when it's open
118
+ * or all the time (after the component has been mounted)
119
+ *
120
+ * @default true
121
+ */
122
+ renderOnlyWhenOpen?: boolean;
123
+ }
124
+
36
125
  interface MultiselectSearchProps {
37
126
  /**
38
127
  * Function called whenever the search input value changes
@@ -69,7 +158,7 @@ interface MultiselectSearchProps {
69
158
  focusList?: () => void;
70
159
  }
71
160
 
72
- declare type ClearButtonProps = {
161
+ type ClearButtonProps = {
73
162
  /**
74
163
  * Aria label for the clear button
75
164
  * @default 'Clear selection'
@@ -153,16 +242,12 @@ interface MultiselectProps extends CommonProps {
153
242
  */
154
243
  clearButtonProps?: ClearButtonProps;
155
244
  }
156
- /**
157
- * The Multiselect is a component that will allow a user to select multiple items.
158
- * It has an optional
159
- */
160
245
  declare const Multiselect$1: React.ForwardRefExoticComponent<MultiselectProps & React.RefAttributes<HTMLDivElement>>;
161
246
 
162
247
  /**
163
248
  * Labels for the select all option
164
249
  */
165
- declare type SelectAllOptionLabel = {
250
+ type SelectAllOptionLabel = {
166
251
  /**
167
252
  * Label for the select all option when it is checked
168
253
  * @default 'Deselect all'
@@ -179,13 +264,13 @@ interface SelectAllOptionProps extends Omit<MultiselectOptionProps, 'children' |
179
264
  itemId?: string;
180
265
  selectAllOptionLabel?: SelectAllOptionLabel;
181
266
  }
182
- declare const SelectAllOption: ({ label, itemId, onSelectItem, isChecked, selectAllOptionLabel, className, ...otherProps }: SelectAllOptionProps) => JSX.Element;
267
+ declare const SelectAllOption: ({ label, itemId, onSelectItem, isChecked, selectAllOptionLabel, className, ...otherProps }: SelectAllOptionProps) => React.JSX.Element;
183
268
 
184
- declare type CompoundMultiselect = typeof Multiselect$1 & {
269
+ type CompoundMultiselect = typeof Multiselect$1 & {
185
270
  HighlightedItem: typeof HighlightedItem;
186
271
  Option: typeof MultiselectOption;
187
272
  SelectAll: typeof SelectAllOption;
188
273
  };
189
274
  declare const Multiselect: CompoundMultiselect;
190
275
 
191
- export { Multiselect, MultiselectOption, MultiselectOptionProps, MultiselectProps, SelectAllOption, SelectAllOptionProps };
276
+ export { Multiselect, MultiselectOption, type MultiselectOptionProps, type MultiselectProps, SelectAllOption, type SelectAllOptionProps };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { CommonProps } from '@contentful/f36-core';
3
3
  import { ButtonProps } from '@contentful/f36-button';
4
- import { PopoverProps } from '@contentful/f36-popover';
4
+ import { Placement, OffsetOptions } from '@floating-ui/react';
5
5
 
6
- declare type LabelOrChildren = {
6
+ type LabelOrChildren = {
7
7
  /**
8
8
  * When using React children it is your own responsibility to highlight
9
9
  * the matching part of the item label. Use the `HighlightedItem`
@@ -15,7 +15,7 @@ declare type LabelOrChildren = {
15
15
  children?: never;
16
16
  label: string;
17
17
  };
18
- declare type MultiselectOptionProps = {
18
+ type MultiselectOptionProps = {
19
19
  value: string;
20
20
  itemId: string;
21
21
  searchValue?: string;
@@ -24,15 +24,104 @@ declare type MultiselectOptionProps = {
24
24
  isChecked?: boolean;
25
25
  isDisabled?: boolean;
26
26
  } & LabelOrChildren;
27
- declare const MultiselectOption: ({ children, label, value, itemId, onSelectItem, searchValue, isChecked, isDisabled, className, ...rest }: MultiselectOptionProps) => JSX.Element;
27
+ declare const MultiselectOption: ({ children, label, value, itemId, onSelectItem, isChecked, isDisabled, className, ...rest }: MultiselectOptionProps) => React.JSX.Element;
28
28
  declare function HighlightedItem({ item, inputValue, }: {
29
29
  item: string;
30
30
  inputValue?: string;
31
- }): JSX.Element;
31
+ }): React.JSX.Element;
32
32
  declare namespace HighlightedItem {
33
33
  var displayName: string;
34
34
  }
35
35
 
36
+ interface PopoverProps {
37
+ children: React.ReactNode;
38
+ /**
39
+ * Boolean to determine if the Popover should be the same width as
40
+ * the trigger element
41
+ *
42
+ * @default false
43
+ */
44
+ isFullWidth?: boolean;
45
+ /**
46
+ * Boolean to control whether or not the Popover is open
47
+ *
48
+ * @default false
49
+ */
50
+ isOpen?: boolean;
51
+ /**
52
+ * Callback fired when the popover closes
53
+ */
54
+ onClose?: () => void;
55
+ /**
56
+ * Determines the preferred position of the Popover. This position is not
57
+ * guaranteed, as the Popover might be moved to fit the viewport
58
+ *
59
+ * @default bottom-start
60
+ */
61
+ placement?: Placement | 'auto';
62
+ /**
63
+ * Boolean to control if popover is allowed to change its placement automatically
64
+ * based on available space in the viewport.
65
+ *
66
+ * For example:
67
+ * If you set placement prop to bottom, but there isn't enough space to position the popover in that direction,
68
+ * it will change the popper placement to top. As soon as enough space is detected, the placement will be reverted to the defined one.
69
+ *
70
+ * If you want the popover to strictly follow the placement prop you should set this prop to false.
71
+ *
72
+ * @default true
73
+ */
74
+ isAutoalignmentEnabled?: boolean;
75
+ /**
76
+ * Boolean to control whether or not to render the Popover in a React Portal.
77
+ * Rendering content inside a Portal allows the Popover to escape the bounds
78
+ * of its parent while still being positioned correctly. Using a Portal is
79
+ * necessary if an ancestor of the Popover hides overflow.
80
+ *
81
+ * @default true
82
+ */
83
+ usePortal?: boolean;
84
+ /**
85
+ * If true, the popover will close when you blur out it by clicking outside or tabbing out
86
+ *
87
+ * @default true
88
+ */
89
+ closeOnBlur?: boolean;
90
+ /**
91
+ * If true, the popover will close when you hit the Esc key
92
+ *
93
+ * @default true
94
+ */
95
+ closeOnEsc?: boolean;
96
+ /**
97
+ * If true, the popover will be focused after opening
98
+ *
99
+ * @default true
100
+ */
101
+ autoFocus?: boolean;
102
+ /**
103
+ * Popover id. Will be used as an `id` attribute on popover
104
+ * and as `aria-controls` attribute on trigger
105
+ *
106
+ * @default true
107
+ */
108
+ id?: string;
109
+ /**
110
+ * Single number as short hand for `mainAxis`
111
+ * Or object which can contain `mainAxis`, `crossAxis` or `alignmentAxis`
112
+ *
113
+ * @default 0
114
+ */
115
+ offset?: OffsetOptions;
116
+ /**
117
+ * Defines if popover should be rendered in the DOM only when it's open
118
+ * or all the time (after the component has been mounted)
119
+ *
120
+ * @default true
121
+ */
122
+ renderOnlyWhenOpen?: boolean;
123
+ }
124
+
36
125
  interface MultiselectSearchProps {
37
126
  /**
38
127
  * Function called whenever the search input value changes
@@ -69,7 +158,7 @@ interface MultiselectSearchProps {
69
158
  focusList?: () => void;
70
159
  }
71
160
 
72
- declare type ClearButtonProps = {
161
+ type ClearButtonProps = {
73
162
  /**
74
163
  * Aria label for the clear button
75
164
  * @default 'Clear selection'
@@ -153,16 +242,12 @@ interface MultiselectProps extends CommonProps {
153
242
  */
154
243
  clearButtonProps?: ClearButtonProps;
155
244
  }
156
- /**
157
- * The Multiselect is a component that will allow a user to select multiple items.
158
- * It has an optional
159
- */
160
245
  declare const Multiselect$1: React.ForwardRefExoticComponent<MultiselectProps & React.RefAttributes<HTMLDivElement>>;
161
246
 
162
247
  /**
163
248
  * Labels for the select all option
164
249
  */
165
- declare type SelectAllOptionLabel = {
250
+ type SelectAllOptionLabel = {
166
251
  /**
167
252
  * Label for the select all option when it is checked
168
253
  * @default 'Deselect all'
@@ -179,13 +264,13 @@ interface SelectAllOptionProps extends Omit<MultiselectOptionProps, 'children' |
179
264
  itemId?: string;
180
265
  selectAllOptionLabel?: SelectAllOptionLabel;
181
266
  }
182
- declare const SelectAllOption: ({ label, itemId, onSelectItem, isChecked, selectAllOptionLabel, className, ...otherProps }: SelectAllOptionProps) => JSX.Element;
267
+ declare const SelectAllOption: ({ label, itemId, onSelectItem, isChecked, selectAllOptionLabel, className, ...otherProps }: SelectAllOptionProps) => React.JSX.Element;
183
268
 
184
- declare type CompoundMultiselect = typeof Multiselect$1 & {
269
+ type CompoundMultiselect = typeof Multiselect$1 & {
185
270
  HighlightedItem: typeof HighlightedItem;
186
271
  Option: typeof MultiselectOption;
187
272
  SelectAll: typeof SelectAllOption;
188
273
  };
189
274
  declare const Multiselect: CompoundMultiselect;
190
275
 
191
- export { Multiselect, MultiselectOption, MultiselectOptionProps, MultiselectProps, SelectAllOption, SelectAllOptionProps };
276
+ export { Multiselect, MultiselectOption, type MultiselectOptionProps, type MultiselectProps, SelectAllOption, type SelectAllOptionProps };
package/dist/index.js CHANGED
@@ -1,29 +1,9 @@
1
- 'use strict';
2
-
3
- var l = require('react');
4
- var f36Forms = require('@contentful/f36-forms');
5
- var f36Typography = require('@contentful/f36-typography');
6
- var emotion = require('emotion');
7
- var r = require('@contentful/f36-tokens');
8
- var f36Core = require('@contentful/f36-core');
9
- var f36Utils = require('@contentful/f36-utils');
10
- var f36Button = require('@contentful/f36-button');
11
- var f36Icons = require('@contentful/f36-icons');
12
- var f36Skeleton = require('@contentful/f36-skeleton');
13
- var f36Popover = require('@contentful/f36-popover');
14
- var f36Tooltip = require('@contentful/f36-tooltip');
15
- var Xe = require('react-focus-lock');
16
-
17
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
-
19
- var l__default = /*#__PURE__*/_interopDefault(l);
20
- var r__default = /*#__PURE__*/_interopDefault(r);
21
- var Xe__default = /*#__PURE__*/_interopDefault(Xe);
22
-
23
- var me=Object.defineProperty,ue=Object.defineProperties;var ge=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var G=(e,t,o)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,M=(e,t)=>{for(var o in t||(t={}))_.call(t,o)&&G(e,o,t[o]);if(L)for(var o of L(t))q.call(t,o)&&G(e,o,t[o]);return e},w=(e,t)=>ue(e,ge(t));var B=(e,t)=>{var o={};for(var n in e)_.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&L)for(var n of L(e))t.indexOf(n)<0&&q.call(e,n)&&(o[n]=e[n]);return o};var b=()=>({multiselect:emotion.css({position:"relative",width:"100%"}),triggerButton:emotion.css({justifyContent:"space-between"}),currentSelection:emotion.css({display:"inline-block",width:"100%",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",verticalAlign:"bottom",marginRight:r__default.default.spacing2Xs}),currentSelectionWithClearButton:emotion.css({paddingRight:"40px"}),currentSelectionAddition:emotion.css({color:r__default.default.gray600}),searchBar:emotion.css({paddingTop:r__default.default.spacing2Xs,position:"sticky",top:"0px",zIndex:r__default.default.zIndexWorkbenchHeader,backgroundColor:r__default.default.colorWhite}),inputField:emotion.css({padding:`6px ${r__default.default.spacingXl} 10px ${r__default.default.spacingXs}`,textOverflow:"ellipsis",whiteSpace:"nowrap",border:"none",borderRadius:"0px",borderBottom:`1px solid ${r__default.default.gray200}`,boxShadow:"none","&:focus, &:active, &:active:hover":{boxShadow:"none",borderBottom:`1px solid ${r__default.default.gray200}`}}),toggleButton:emotion.css({position:"absolute",top:"1px",right:"1px",zIndex:r__default.default.zIndexDefault,padding:r__default.default.spacing2Xs,height:r__default.default.spacingXl}),content:e=>emotion.css({overflow:"auto",maxHeight:`${e}px`}),container:emotion.css({}),list:emotion.css({listStyle:"none",padding:`${r__default.default.spacing2Xs}`,margin:0}),groupTitle:emotion.css({padding:`6px ${r__default.default.spacingXs}`,lineHeight:r__default.default.lineHeightM}),noMatchesTitle:emotion.css({color:r__default.default.gray500,margin:r__default.default.spacingM,textAlign:"center"}),clearSelectionButton:emotion.css({marginLeft:"-80px"}),selectAll:emotion.css({borderBottom:`1px solid ${r__default.default.gray200}`,marginBottom:r__default.default.spacing2Xs,paddingBottom:r__default.default.spacing2Xs,"label > *":{fontWeight:r__default.default.fontWeightMedium}}),option:emotion.css({listStyleType:"none"}),optionText:emotion.css({alignItems:"center",display:"flex",span:{color:r__default.default.gray900,fontWeight:r__default.default.fontWeightDemiBold}}),optionCheck:({isActive:e,isDisabled:t})=>emotion.css({label:emotion.cx(f36Core.getMenuItemStyles({isActive:e,isDisabled:t}),emotion.css({width:"100%"}))})});var v=C=>{var x=C,{children:e,label:t,value:o,itemId:n,onSelectItem:s,searchValue:a,isChecked:f=!1,isDisabled:h=!1,className:p}=x,g=B(x,["children","label","value","itemId","onSelectItem","searchValue","isChecked","isDisabled","className"]);let m=b();return l__default.default.createElement("li",M({className:emotion.cx(m.option,p)},g),l__default.default.createElement(f36Forms.Checkbox,{id:n,value:o,onChange:S=>s(S),isChecked:f,isDisabled:h,className:m.optionCheck({isActive:f,isDisabled:h})},l__default.default.createElement(f36Typography.Text,{className:m.optionText,"data-test-id":`cf-multiselect-list-item-${n}`},typeof t=="string"?l__default.default.createElement(N,{item:t,inputValue:a}):e)))};function N({item:e,inputValue:t=""}){let{before:o,match:n,after:s}=f36Utils.getStringMatch(e,t.trim());return o.length+n.length+s.length===0?l__default.default.createElement(l__default.default.Fragment,null,e):l__default.default.createElement(l__default.default.Fragment,null,o,l__default.default.createElement("span",{"data-test-id":"cf-multiselect-item-match"},n),s)}N.displayName="HighlightedItem";var Q=({searchValue:e,setSearchValue:t,onSearchValueChange:o,searchInputName:n,searchInputRef:s,resetSearchRef:a,searchPlaceholder:f="Search",focusList:h})=>{let p=b(),g=l.useRef(null),C=l.useCallback(m=>{t(m.target.value),o==null||o(m);},[o,t]),x=l.useCallback(()=>{if(!e)return;h(),Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set.call(g.current,"");let S=new Event("change",{bubbles:!0});g.current.dispatchEvent(S);},[e,h]);return l__default.default.createElement("div",{className:p.searchBar},l__default.default.createElement(f36Forms.TextInput,{"aria-label":"Search",type:"text",value:e,className:p.inputField,testId:"cf-multiselect-search",placeholder:f,onChange:C,ref:f36Core.mergeRefs(s,g),name:n,size:"small"}),l__default.default.createElement(f36Button.IconButton,{ref:a,"aria-label":e?"Clear search":"Search",className:p.toggleButton,variant:"transparent",icon:e?l__default.default.createElement(f36Icons.XIcon,{color:r__default.default.gray600}):l__default.default.createElement(f36Icons.MagnifyingGlassIcon,{color:r__default.default.gray600}),onClick:x,isDisabled:!e,size:"small"}))};var ee=(e,t,o)=>l__default.default.Children.map(e,n=>{if(!l__default.default.isValidElement(n))return n;if(t(n))return o(n);let s=ee(n.props.children,t,o);return l__default.default.cloneElement(n,{children:s})}),te=(e,t)=>{let o=0;return l__default.default.Children.forEach(e,n=>{l__default.default.isValidElement(n)&&(t(n)?o+=1:o+=te(n.props.children,t));}),o};function De(e,t){let{className:o,startIcon:n,placeholder:s="Select one or more Items",currentSelection:a=[],toggleRef:f,toggleButtonAriaLabel:h="Toggle Multiselect",isLoading:p=!1,testId:g="cf-multiselect",noMatchesMessage:C="No matches found",searchProps:x={},popoverProps:m={},children:S,onBlur:E,onClearSelection:P,clearButtonProps:O={tooltip:"Clear selection",ariaLabel:"Clear selection"}}=e,{listMaxHeight:ne=180,listRef:le,onClose:D}=m,c=b(),[T,re]=l.useState(""),[F,$]=l.useState(!1),z=l.useRef(null),A=a.length>1&&typeof P=="function",V=typeof x.onSearchValueChange=="function",H=l.useCallback(()=>{var u;(u=z.current)==null||u.focus();},[]),ie=u=>{P==null||P(),u.stopPropagation();},se=l.useCallback(()=>{if(a.length===0)return l__default.default.createElement(l__default.default.Fragment,null,s);let u=a.length-1,y=emotion.cx(c.currentSelection,A&&c.currentSelectionWithClearButton);return u===0?l__default.default.createElement("span",{"data-test-id":"cf-multiselect-current-selection",className:y},a[0]):l__default.default.createElement("span",{"data-test-id":"cf-multiselect-current-selection",className:y},a[0]," ",l__default.default.createElement("span",{className:c.currentSelectionAddition},"and ",u," more"))},[a,s,A,c.currentSelection,c.currentSelectionAddition,c.currentSelectionWithClearButton]),j=l.useMemo(()=>te(S,u=>u.type===v),[S]),ce=l__default.default.useCallback(u=>ee(u,y=>y.type===v,y=>{let ae=pe=>{var U;H(),(U=y.props)==null||U.onSelectItem(pe);};return l__default.default.cloneElement(y,{searchValue:T,onSelectItem:ae})}),[T,H]);return l__default.default.createElement("div",{"data-test-id":g,className:emotion.cx(c.multiselect,o),ref:t},l__default.default.createElement(f36Popover.Popover,w(M({renderOnlyWhenOpen:!1,isFullWidth:!0},m),{isOpen:F,onClose:()=>{$(!1),D&&D();}}),l__default.default.createElement(f36Core.Flex,{alignItems:"center"},l__default.default.createElement(f36Popover.Popover.Trigger,null,l__default.default.createElement(f36Button.Button,M({"aria-label":h,ref:f,onClick:()=>$(!F),startIcon:n,endIcon:l__default.default.createElement(f36Icons.CaretDownIcon,null),isFullWidth:!0,className:c.triggerButton},e.triggerButtonProps),se())),A&&l__default.default.createElement("div",{className:c.clearSelectionButton},l__default.default.createElement(f36Tooltip.Tooltip,{content:O.tooltip?O.tooltip:"Clear selection",showDelay:800,placement:"top",as:"div"},l__default.default.createElement(f36Button.IconButton,{onClick:ie,icon:l__default.default.createElement(f36Icons.XIcon,null),"aria-label":O.ariaLabel?O.ariaLabel:"Clear selection",size:"small"})))),l__default.default.createElement(f36Popover.Popover.Content,{ref:f36Core.mergeRefs(le,z),className:emotion.cx(c.content(ne),m.className,c.container),testId:"cf-multiselect-container",onBlur:()=>E==null?void 0:E()},l__default.default.createElement(Xe__default.default,{focusOptions:{preventScroll:!0},returnFocus:!0},V&&l__default.default.createElement(Q,w(M({},x),{setSearchValue:re,searchValue:T,focusList:H})),p&&l__default.default.createElement(Fe,null),!p&&j>0&&l__default.default.createElement("ul",{className:c.list,"data-test-id":"cf-multiselect-items"},V?ce(S):S),!p&&j===0&&l__default.default.createElement(f36Typography.Subheading,{className:c.noMatchesTitle},C)))))}var Fe=()=>l__default.default.createElement(f36Skeleton.SkeletonContainer,{svgHeight:16},l__default.default.createElement(f36Skeleton.SkeletonBodyText,{numberOfLines:1})),oe=l__default.default.forwardRef(De);var X=h=>{var p=h,{label:e,itemId:t="SelectAll",onSelectItem:o,isChecked:n=!1,selectAllOptionLabel:s={checked:"Deselect all",unchecked:"Select all"},className:a}=p,f=B(p,["label","itemId","onSelectItem","isChecked","selectAllOptionLabel","className"]);let g=b(),C=e||n?s.checked:s.unchecked;return l__default.default.createElement(v,M({value:"all",label:C,itemId:t,onSelectItem:o,isChecked:n,className:emotion.cx(g.selectAll,a)},f))};var k=oe;k.HighlightedItem=N;k.Option=v;k.SelectAll=X;
24
-
25
- exports.Multiselect = k;
26
- exports.MultiselectOption = v;
27
- exports.SelectAllOption = X;
28
- //# sourceMappingURL=out.js.map
1
+ 'use strict';var R=require('react'),f36Forms=require('@contentful/f36-forms'),f36Typography=require('@contentful/f36-typography'),css=require('@emotion/css'),j=require('@contentful/f36-tokens'),f36Core=require('@contentful/f36-core'),f36Utils=require('@contentful/f36-utils'),f36Button=require('@contentful/f36-button'),f36Icons=require('@contentful/f36-icons'),f36Skeleton=require('@contentful/f36-skeleton'),jsxRuntime=require('react/jsx-runtime'),Dr=require('react-dom'),Bs=require('react-focus-lock');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var R__namespace=/*#__PURE__*/_interopNamespace(R);var j__default=/*#__PURE__*/_interopDefault(j);var Dr__namespace=/*#__PURE__*/_interopNamespace(Dr);var Bs__default=/*#__PURE__*/_interopDefault(Bs);var xo=Object.defineProperty,wo=Object.defineProperties;var Eo=Object.getOwnPropertyDescriptors;var pt=Object.getOwnPropertySymbols;var An=Object.prototype.hasOwnProperty,Ln=Object.prototype.propertyIsEnumerable;var Mn=(e,t,n)=>t in e?xo(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,E=(e,t)=>{for(var n in t||(t={}))An.call(t,n)&&Mn(e,n,t[n]);if(pt)for(var n of pt(t))Ln.call(t,n)&&Mn(e,n,t[n]);return e},N=(e,t)=>wo(e,Eo(t));var Kt=e=>typeof e=="symbol"?e:e+"",me=(e,t)=>{var n={};for(var r in e)An.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pt)for(var r of pt(e))t.indexOf(r)<0&&Ln.call(e,r)&&(n[r]=e[r]);return n};var fe=(e,t,n)=>new Promise((r,o)=>{var i=c=>{try{l(n.next(c));}catch(a){o(a);}},s=c=>{try{l(n.throw(c));}catch(a){o(a);}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,s);l((n=n.apply(e,t)).next());});var Le=()=>({multiselect:css.css({position:"relative",width:"100%"}),triggerButton:css.css({justifyContent:"space-between"}),currentSelection:css.css({display:"inline-block",width:"100%",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",verticalAlign:"bottom",marginRight:j__default.default.spacing2Xs}),currentSelectionWithClearButton:css.css({paddingRight:"40px"}),currentSelectionAddition:css.css({color:j__default.default.gray600}),searchBar:css.css({paddingTop:j__default.default.spacing2Xs,position:"sticky",top:"0px",zIndex:j__default.default.zIndexWorkbenchHeader,backgroundColor:j__default.default.colorWhite}),inputField:css.css({padding:`6px ${j__default.default.spacingXl} 10px ${j__default.default.spacingXs}`,textOverflow:"ellipsis",whiteSpace:"nowrap",border:"none",borderRadius:"0px",borderBottom:`1px solid ${j__default.default.gray200}`,boxShadow:"none","&:focus, &:active, &:active:hover":{boxShadow:"none",borderBottom:`1px solid ${j__default.default.gray200}`}}),toggleButton:css.css({position:"absolute",top:"1px",right:"1px",zIndex:j__default.default.zIndexDefault,padding:j__default.default.spacing2Xs,height:j__default.default.spacingXl}),content:e=>css.css({overflow:"auto",maxHeight:`${e}px`}),container:css.css({}),list:css.css({listStyle:"none",padding:`${j__default.default.spacing2Xs}`,margin:0}),groupTitle:css.css({padding:`6px ${j__default.default.spacingXs}`,lineHeight:j__default.default.lineHeightM}),noMatchesTitle:css.css({color:j__default.default.gray500,margin:j__default.default.spacingM,textAlign:"center"}),clearSelectionButton:css.css({marginLeft:"-80px"}),selectAll:css.css({borderBottom:`1px solid ${j__default.default.gray200}`,marginBottom:j__default.default.spacing2Xs,paddingBottom:j__default.default.spacing2Xs,"label > *":{fontWeight:j__default.default.fontWeightMedium}}),option:css.css({listStyleType:"none"}),optionText:css.css({alignItems:"center",display:"flex",span:{color:j__default.default.gray900,fontWeight:j__default.default.fontWeightDemiBold}}),optionCheck:({isActive:e,isDisabled:t})=>css.css({label:css.cx(f36Core.getMenuItemStyles({isActive:e,isDisabled:t}),css.css({width:"100%"}))})});var kn=R__namespace.default.createContext(void 0),Nn=()=>{let e=R__namespace.default.useContext(kn);if(e===void 0)throw new Error("component must be rendered within a Accordion component");return e},Fn=kn.Provider;var We=a=>{var d=a,{children:e,label:t,value:n,itemId:r,onSelectItem:o,isChecked:i=false,isDisabled:s=false,className:l}=d,c=me(d,["children","label","value","itemId","onSelectItem","isChecked","isDisabled","className"]);let u=Le(),{focusList:p,searchValue:f}=Nn();return R__namespace.default.createElement("li",E({className:css.cx(u.option,l)},c),R__namespace.default.createElement(f36Forms.Checkbox,{id:r,value:n,onChange:h=>{p(),o(h);},isChecked:i,isDisabled:s,className:u.optionCheck({isActive:i,isDisabled:s})},R__namespace.default.createElement(f36Typography.Text,{className:u.optionText,"data-test-id":`cf-multiselect-list-item-${r}`},typeof t=="string"?R__namespace.default.createElement(gt,{item:t,inputValue:f}):e)))};function gt({item:e,inputValue:t=""}){let{before:n,match:r,after:o}=f36Utils.getStringMatch(e,t.trim());return n.length+r.length+o.length===0?R__namespace.default.createElement(R__namespace.default.Fragment,null,e):R__namespace.default.createElement(R__namespace.default.Fragment,null,n,R__namespace.default.createElement("span",{"data-test-id":"cf-multiselect-item-match"},r),o)}gt.displayName="HighlightedItem";function ht(){return typeof window!="undefined"}function we(e){return vt(e)?(e.nodeName||"").toLowerCase():"#document"}function te(e){var t;return (e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ge(e){var t;return (t=(vt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function vt(e){return ht()?e instanceof Node||e instanceof te(e).Node:false}function X(e){return ht()?e instanceof Element||e instanceof te(e).Element:false}function U(e){return ht()?e instanceof HTMLElement||e instanceof te(e).HTMLElement:false}function nt(e){return !ht()||typeof ShadowRoot=="undefined"?false:e instanceof ShadowRoot||e instanceof te(e).ShadowRoot}var Mo=new Set(["inline","contents"]);function ze(e){let{overflow:t,overflowX:n,overflowY:r,display:o}=re(e);return /auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Mo.has(o)}var Ao=new Set(["table","td","th"]);function Bn(e){return Ao.has(we(e))}var Lo=[":popover-open",":modal"];function rt(e){return Lo.some(t=>{try{return e.matches(t)}catch(n){return false}})}var Do=["transform","translate","scale","rotate","perspective"],ko=["transform","translate","scale","rotate","perspective","filter"],No=["paint","layout","strict","content"];function bt(e){let t=je(),n=X(e)?re(e):e;return Do.some(r=>n[r]?n[r]!=="none":false)||(n.containerType?n.containerType!=="normal":false)||!t&&(n.backdropFilter?n.backdropFilter!=="none":false)||!t&&(n.filter?n.filter!=="none":false)||ko.some(r=>(n.willChange||"").includes(r))||No.some(r=>(n.contain||"").includes(r))}function Wn(e){let t=pe(e);for(;U(t)&&!he(t);){if(bt(t))return t;if(rt(t))return null;t=pe(t);}return null}function je(){return typeof CSS=="undefined"||!CSS.supports?false:CSS.supports("-webkit-backdrop-filter","none")}var Fo=new Set(["html","body","#document"]);function he(e){return Fo.has(we(e))}function re(e){return te(e).getComputedStyle(e)}function ot(e){return X(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pe(e){if(we(e)==="html")return e;let t=e.assignedSlot||e.parentNode||nt(e)&&e.host||ge(e);return nt(t)?t.host:t}function Hn(e){let t=pe(e);return he(t)?e.ownerDocument?e.ownerDocument.body:e.body:U(t)&&ze(t)?t:Hn(t)}function se(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=true);let o=Hn(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=te(o);if(i){let l=Rt(s);return t.concat(s,s.visualViewport||[],ze(o)?o:[],l&&n?se(l):[])}return t.concat(o,se(o,[],n))}function Rt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Kn=["top","right","bottom","left"],Vn=["start","end"],zt=Kn.reduce((e,t)=>e.concat(t,t+"-"+Vn[0],t+"-"+Vn[1]),[]),De=Math.min,ne=Math.max,ct=Math.round,lt=Math.floor,ve=e=>({x:e,y:e}),Bo={left:"right",right:"left",bottom:"top",top:"bottom"},Wo={start:"end",end:"start"};function jt(e,t,n){return ne(e,De(t,n))}function He(e,t){return typeof e=="function"?e(t):e}function be(e){return e.split("-")[0]}function Re(e){return e.split("-")[1]}function Xt(e){return e==="x"?"y":"x"}function Ut(e){return e==="y"?"height":"width"}var Ho=new Set(["top","bottom"]);function Ee(e){return Ho.has(be(e))?"y":"x"}function Gt(e){return Xt(Ee(e))}function Yt(e,t,n){n===void 0&&(n=false);let r=Re(e),o=Gt(e),i=Ut(o),s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=st(s)),[s,st(s)]}function zn(e){let t=st(e);return [it(e),t,it(t)]}function it(e){return e.replace(/start|end/g,t=>Wo[t])}var _n=["left","right"],$n=["right","left"],Vo=["top","bottom"],_o=["bottom","top"];function $o(e,t,n){switch(e){case "top":case "bottom":return n?t?$n:_n:t?_n:$n;case "left":case "right":return t?Vo:_o;default:return []}}function jn(e,t,n,r){let o=Re(e),i=$o(be(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(it)))),i}function st(e){return e.replace(/left|right|bottom|top/g,t=>Bo[t])}function Ko(e){return E({top:0,right:0,bottom:0,left:0},e)}function Xn(e){return typeof e!="number"?Ko(e):{top:e,right:e,bottom:e,left:e}}function Ve(e){let{x:t,y:n,width:r,height:o}=e;return {width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}var zo=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],yt=zo.join(","),Gn=typeof Element=="undefined",Xe=Gn?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,xt=!Gn&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},wt=function e(t,n){var r;n===void 0&&(n=true);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",s=i||n&&t&&e(t.parentNode);return s},jo=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Yn=function(t,n,r){if(wt(t))return [];var o=Array.prototype.slice.apply(t.querySelectorAll(yt));return n&&Xe.call(t,yt)&&o.unshift(t),o=o.filter(r),o},qn=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!wt(s,false))if(s.tagName==="SLOT"){var l=s.assignedElements(),c=l.length?l:s.children,a=e(c,true,r);r.flatten?o.push.apply(o,a):o.push({scopeParent:s,candidates:a});}else {var d=Xe.call(s,yt);d&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var u=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!wt(u,false)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(u&&p){var f=e(u===true?s.children:u.children,true,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:s,candidates:f});}else i.unshift.apply(i,s.children);}}return o},Zn=function(t){return !isNaN(parseInt(t.getAttribute("tabindex"),10))},Jn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||jo(t))&&!Zn(t)?0:t.tabIndex},Xo=function(t,n){var r=Jn(t);return r<0&&n&&!Zn(t)?0:r},Uo=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Qn=function(t){return t.tagName==="INPUT"},Go=function(t){return Qn(t)&&t.type==="hidden"},Yo=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},qo=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Zo=function(t){if(!t.name)return true;var n=t.form||xt(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window!="undefined"&&typeof window.CSS!="undefined"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name);}catch(s){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",s.message),false}var i=qo(o,t.form);return !i||i===t},Jo=function(t){return Qn(t)&&t.type==="radio"},Qo=function(t){return Jo(t)&&!Zo(t)},ei=function(t){var n,r=t&&xt(t),o=(n=r)===null||n===void 0?void 0:n.host,i=false;if(r&&r!==t){var s,l,c;for(i=!!((s=o)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(o)||t!=null&&(c=t.ownerDocument)!==null&&c!==void 0&&c.contains(t));!i&&o;){var a,d,u;r=xt(o),o=(a=r)===null||a===void 0?void 0:a.host,i=!!((d=o)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(o));}}return i},Un=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},ti=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return true;var i=Xe.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Xe.call(s,"details:not([open]) *"))return true;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var c=t.parentElement,a=xt(t);if(c&&!c.shadowRoot&&o(c)===true)return Un(t);t.assignedSlot?t=t.assignedSlot:!c&&a!==t.ownerDocument?t=a.host:t=c;}t=l;}if(ei(t))return !t.getClientRects().length;if(r!=="legacy-full")return true}else if(r==="non-zero-area")return Un(t);return false},ni=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Xe.call(n,"fieldset[disabled] *")?true:!o.contains(t)}return true}n=n.parentElement;}return false},qt=function(t,n){return !(n.disabled||wt(n)||Go(n)||ti(n,t)||Yo(n)||ni(n))},Zt=function(t,n){return !(Qo(n)||Jn(n)<0||!qt(t,n))},ri=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return !!(isNaN(n)||n>=0)},oi=function e(t){var n=[],r=[];return t.forEach(function(o,i){var s=!!o.scopeParent,l=s?o.scopeParent:o,c=Xo(l,s),a=s?e(o.candidates):l;c===0?s?n.push.apply(n,a):n.push(l):r.push({documentOrder:i,tabIndex:c,item:o,isScope:s,content:a});}),r.sort(Uo).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},Ue=function(t,n){n=n||{};var r;return n.getShadowRoot?r=qn([t],n.includeContainer,{filter:Zt.bind(null,n),flatten:false,getShadowRoot:n.getShadowRoot,shadowRootFilter:ri}):r=Yn(t,n.includeContainer,Zt.bind(null,n)),oi(r)},er=function(t,n){n=n||{};var r;return n.getShadowRoot?r=qn([t],n.includeContainer,{filter:qt.bind(null,n),flatten:true,getShadowRoot:n.getShadowRoot}):r=Yn(t,n.includeContainer,qt.bind(null,n)),r},Jt=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Xe.call(t,yt)===false?false:Zt(n,t)};function nr(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function en(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function rr(){return /apple/i.test(navigator.vendor)}function Qt(){let e=/android/i;return e.test(nr())||e.test(en())}function si(){return en().includes("jsdom/")}var tr="data-floating-ui-focusable",ci="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function _e(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement;}return t}function oe(e,t){if(!e||!t)return false;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return true;if(n&&nt(n)){let r=t;for(;r;){if(e===r)return true;r=r.parentNode||r.host;}}return false}function Oe(e){return "composedPath"in e?e.composedPath()[0]:e.target}function Et(e,t){if(t==null)return false;if("composedPath"in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function or(e){return e.matches("html,body")}function de(e){return (e==null?void 0:e.ownerDocument)||document}function tn(e){return U(e)&&e.matches(ci)}function nn(e){return e?e.getAttribute("role")==="combobox"&&tn(e):false}function Ct(e){return e?e.hasAttribute(tr)?e:e.querySelector("["+tr+"]")||e:null}function $e(e,t,n){return n===void 0&&(n=true),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...$e(e,o.id,n)])}function rn(e,t){var n;let r=[],o=(n=e.find(i=>i.id===t))==null?void 0:n.parentId;for(;o;){let i=e.find(s=>s.id===o);o=i==null?void 0:i.parentId,i&&(r=r.concat(i));}return r}function St(e){e.preventDefault(),e.stopPropagation();}function ir(e){return "nativeEvent"in e}function sr(e){return e.mozInputSource===0&&e.isTrusted?true:Qt()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function cr(e){return si()?false:!Qt()&&e.width===0&&e.height===0||Qt()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function on(e,t){let n=["mouse","pen"];return n.includes(e)}var li=typeof document!="undefined",ai=function(){},ce=li?R.useLayoutEffect:ai,ui=E({},R__namespace);function It(e){let t=R__namespace.useRef(e);return ce(()=>{t.current=e;}),t}var fi=ui.useInsertionEffect,di=fi||(e=>e());function ye(e){let t=R__namespace.useRef(()=>{});return di(()=>{t.current=e;}),R__namespace.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var Ye=()=>({getShadowRoot:true,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function lr(e,t){let n=Ue(e,Ye()),r=n.length;if(r===0)return;let o=_e(de(e)),i=n.indexOf(o),s=i===-1?t===1?0:r-1:i+t;return n[s]}function sn(e){return lr(de(e).body,1)||e}function cn(e){return lr(de(e).body,-1)||e}function qe(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return !r||!oe(n,r)}function ar(e){Ue(e,Ye()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1");});}function ln(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{let r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex");});}function ur(e,t,n){let{reference:r,floating:o}=e,i=Ee(t),s=Gt(t),l=Ut(s),c=be(t),a=i==="y",d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,p=r[l]/2-o[l]/2,f;switch(c){case "top":f={x:d,y:r.y-o.height};break;case "bottom":f={x:d,y:r.y+r.height};break;case "right":f={x:r.x+r.width,y:u};break;case "left":f={x:r.x-o.width,y:u};break;default:f={x:r.x,y:r.y};}switch(Re(t)){case "start":f[s]-=p*(n&&a?-1:1);break;case "end":f[s]+=p*(n&&a?-1:1);break}return f}var fr=(e,t,n)=>fe(null,null,function*(){let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),c=yield s.isRTL==null?void 0:s.isRTL(t),a=yield s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=ur(a,r,c),p=r,f={},h=0;for(let m=0;m<l.length;m++){let{name:b,fn:y}=l[m],{x:g,y:v,data:x,reset:I}=yield y({x:d,y:u,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:a,platform:s,elements:{reference:e,floating:t}});d=g!=null?g:d,u=v!=null?v:u,f=N(E({},f),{[b]:E(E({},f[b]),x)}),I&&h<=50&&(h++,typeof I=="object"&&(I.placement&&(p=I.placement),I.rects&&(a=I.rects===true?yield s.getElementRects({reference:e,floating:t,strategy:o}):I.rects),{x:d,y:u}=ur(a,p,c)),m=-1);}return {x:d,y:u,placement:p,strategy:o,middlewareData:f}});function at(e,t){return fe(this,null,function*(){var n;t===void 0&&(t={});let{x:r,y:o,platform:i,rects:s,elements:l,strategy:c}=e,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=false,padding:f=0}=He(t,e),h=Xn(f),b=l[p?u==="floating"?"reference":"floating":u],y=Ve(yield i.getClippingRect({element:(n=yield i.isElement==null?void 0:i.isElement(b))==null||n?b:b.contextElement||(yield i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:a,rootBoundary:d,strategy:c})),g=u==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=yield i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating),x=(yield i.isElement==null?void 0:i.isElement(v))?(yield i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},I=Ve(i.convertOffsetParentRelativeRectToViewportRelativeRect?yield i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:v,strategy:c}):g);return {top:(y.top-I.top+h.top)/x.y,bottom:(I.bottom-y.bottom+h.bottom)/x.y,left:(y.left-I.left+h.left)/x.x,right:(I.right-y.right+h.right)/x.x}})}function mi(e,t,n){return (e?[...n.filter(o=>Re(o)===e),...n.filter(o=>Re(o)!==e)]:n.filter(o=>be(o)===o)).filter(o=>e?Re(o)===e||(t?it(o)!==o:false):true)}var dr=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,fn(n){return fe(this,null,function*(){var r,o,i;let{rects:s,middlewareData:l,placement:c,platform:a,elements:d}=n,L=He(e,n),{crossAxis:u=false,alignment:p,allowedPlacements:f=zt,autoAlignment:h=true}=L,m=me(L,["crossAxis","alignment","allowedPlacements","autoAlignment"]),b=p!==void 0||f===zt?mi(p||null,h,f):f,y=yield at(n,m),g=((r=l.autoPlacement)==null?void 0:r.index)||0,v=b[g];if(v==null)return {};let x=Yt(v,s,yield a.isRTL==null?void 0:a.isRTL(d.floating));if(c!==v)return {reset:{placement:b[0]}};let I=[y[be(v)],y[x[0]],y[x[1]]],A=[...((o=l.autoPlacement)==null?void 0:o.overflows)||[],{placement:v,overflows:I}],O=b[g+1];if(O)return {data:{index:g+1,overflows:A},reset:{placement:O}};let W=A.map(V=>{let _=Re(V.placement);return [V.placement,_&&u?V.overflows.slice(0,2).reduce((S,C)=>S+C,0):V.overflows[0],V.overflows]}).sort((V,_)=>V[1]-_[1]),K=((i=W.filter(V=>V[2].slice(0,Re(V[0])?2:3).every(_=>_<=0))[0])==null?void 0:i[0])||W[0][0];return K!==c?{data:{index:g+1,overflows:A},reset:{placement:K}}:{}})}}},mr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,fn(n){return fe(this,null,function*(){var r,o;let{placement:i,middlewareData:s,rects:l,initialPlacement:c,platform:a,elements:d}=n,C=He(e,n),{mainAxis:u=true,crossAxis:p=true,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:b=true}=C,y=me(C,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((r=s.arrow)!=null&&r.alignmentOffset)return {};let g=be(i),v=Ee(c),x=be(c)===c,I=yield a.isRTL==null?void 0:a.isRTL(d.floating),A=f||(x||!b?[st(c)]:zn(c)),O=m!=="none";!f&&O&&A.push(...jn(c,b,m,I));let W=[c,...A],G=yield at(n,y),K=[],L=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&K.push(G[g]),p){let D=Yt(i,l,I);K.push(G[D[0]],G[D[1]]);}if(L=[...L,{placement:i,overflows:K}],!K.every(D=>D<=0)){var V,_;let D=(((V=s.flip)==null?void 0:V.index)||0)+1,k=W[D];if(k&&(!(p==="alignment"?v!==Ee(k):false)||L.every(T=>Ee(T.placement)===v?T.overflows[0]>0:true)))return {data:{index:D,overflows:L},reset:{placement:k}};let w=(_=L.filter(F=>F.overflows[0]<=0).sort((F,T)=>F.overflows[1]-T.overflows[1])[0])==null?void 0:_.placement;if(!w)switch(h){case "bestFit":{var S;let F=(S=L.filter(T=>{if(O){let q=Ee(T.placement);return q===v||q==="y"}return true}).map(T=>[T.placement,T.overflows.filter(q=>q>0).reduce((q,Pe)=>q+Pe,0)]).sort((T,q)=>T[1]-q[1])[0])==null?void 0:S[0];F&&(w=F);break}case "initialPlacement":w=c;break}if(i!==w)return {reset:{placement:w}}}return {}})}}};var pi=new Set(["left","top"]);function gi(e,t){return fe(this,null,function*(){let{placement:n,platform:r,elements:o}=e,i=yield r.isRTL==null?void 0:r.isRTL(o.floating),s=be(n),l=Re(n),c=Ee(n)==="y",a=pi.has(s)?-1:1,d=i&&c?-1:1,u=He(t,e),{mainAxis:p,crossAxis:f,alignmentAxis:h}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof h=="number"&&(f=l==="end"?h*-1:h),c?{x:f*d,y:p*a}:{x:p*a,y:f*d}})}var pr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return fe(this,null,function*(){var r,o;let{x:i,y:s,placement:l,middlewareData:c}=n,a=yield gi(n,e);return l===((r=c.offset)==null?void 0:r.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:N(E({},a),{placement:l})}})}}},gr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,fn(n){return fe(this,null,function*(){let{x:r,y:o,placement:i}=n,y=He(e,n),{mainAxis:s=true,crossAxis:l=false,limiter:c={fn:g=>{let{x:v,y:x}=g;return {x:v,y:x}}}}=y,a=me(y,["mainAxis","crossAxis","limiter"]),d={x:r,y:o},u=yield at(n,a),p=Ee(be(i)),f=Xt(p),h=d[f],m=d[p];if(s){let g=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=h+u[g],I=h-u[v];h=jt(x,h,I);}if(l){let g=p==="y"?"top":"left",v=p==="y"?"bottom":"right",x=m+u[g],I=m-u[v];m=jt(x,m,I);}let b=c.fn(N(E({},n),{[f]:h,[p]:m}));return N(E({},b),{data:{x:b.x-r,y:b.y-o,enabled:{[f]:s,[p]:l}}})})}}};var hr=function(e){return e===void 0&&(e={}),{name:"size",options:e,fn(n){return fe(this,null,function*(){var r,o;let{placement:i,rects:s,platform:l,elements:c}=n,L=He(e,n),{apply:a=()=>{}}=L,d=me(L,["apply"]),u=yield at(n,d),p=be(i),f=Re(i),h=Ee(i)==="y",{width:m,height:b}=s.floating,y,g;p==="top"||p==="bottom"?(y=p,g=f===((yield l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(g=p,y=f==="end"?"top":"bottom");let v=b-u.top-u.bottom,x=m-u.left-u.right,I=De(b-u[y],v),A=De(m-u[g],x),O=!n.middlewareData.shift,W=I,G=A;if((r=n.middlewareData.shift)!=null&&r.enabled.x&&(G=x),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(W=v),O&&!f){let V=ne(u.left,0),_=ne(u.right,0),S=ne(u.top,0),C=ne(u.bottom,0);h?G=m-2*(V!==0||_!==0?V+_:ne(u.left,u.right)):W=b-2*(S!==0||C!==0?S+C:ne(u.top,u.bottom));}yield a(N(E({},n),{availableWidth:G,availableHeight:W}));let K=yield l.getDimensions(c.floating);return m!==K.width||b!==K.height?{reset:{rects:true}}:{}})}}};function yr(e){let t=re(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,o=U(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=ct(n)!==i||ct(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function un(e){return X(e)?e:e.contextElement}function Ze(e){let t=un(e);if(!U(t))return ve(1);let n=t.getBoundingClientRect(),{width:r,height:o,$:i}=yr(t),s=(i?ct(n.width):n.width)/r,l=(i?ct(n.height):n.height)/o;return (!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}var hi=ve(0);function xr(e){let t=te(e);return !je()||!t.visualViewport?hi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vi(e,t,n){return t===void 0&&(t=false),!n||t&&n!==te(e)?false:t}function Ke(e,t,n,r){t===void 0&&(t=false),n===void 0&&(n=false);let o=e.getBoundingClientRect(),i=un(e),s=ve(1);t&&(r?X(r)&&(s=Ze(r)):s=Ze(e));let l=vi(i,n,r)?xr(i):ve(0),c=(o.left+l.x)/s.x,a=(o.top+l.y)/s.y,d=o.width/s.x,u=o.height/s.y;if(i){let p=te(i),f=r&&X(r)?te(r):r,h=p,m=Rt(h);for(;m&&r&&f!==h;){let b=Ze(m),y=m.getBoundingClientRect(),g=re(m),v=y.left+(m.clientLeft+parseFloat(g.paddingLeft))*b.x,x=y.top+(m.clientTop+parseFloat(g.paddingTop))*b.y;c*=b.x,a*=b.y,d*=b.x,u*=b.y,c+=v,a+=x,h=te(m),m=Rt(h);}}return Ve({width:d,height:u,x:c,y:a})}function Ot(e,t){let n=ot(e).scrollLeft;return t?t.left+n:Ke(ge(e)).left+n}function wr(e,t){let n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ot(e,n),o=n.top+t.scrollTop;return {x:r,y:o}}function bi(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e,i=o==="fixed",s=ge(r),l=t?rt(t.floating):false;if(r===s||l&&i)return n;let c={scrollLeft:0,scrollTop:0},a=ve(1),d=ve(0),u=U(r);if((u||!u&&!i)&&((we(r)!=="body"||ze(s))&&(c=ot(r)),U(r))){let f=Ke(r);a=Ze(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop;}let p=s&&!u&&!i?wr(s,c):ve(0);return {width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+d.x+p.x,y:n.y*a.y-c.scrollTop*a.y+d.y+p.y}}function Ri(e){return Array.from(e.getClientRects())}function yi(e){let t=ge(e),n=ot(e),r=e.ownerDocument.body,o=ne(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ne(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+Ot(e),l=-n.scrollTop;return re(r).direction==="rtl"&&(s+=ne(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}var vr=25;function xi(e,t){let n=te(e),r=ge(e),o=n.visualViewport,i=r.clientWidth,s=r.clientHeight,l=0,c=0;if(o){i=o.width,s=o.height;let d=je();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop);}let a=Ot(r);if(a<=0){let d=r.ownerDocument,u=d.body,p=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-u.clientWidth-f);h<=vr&&(i-=h);}else a<=vr&&(i+=a);return {width:i,height:s,x:l,y:c}}var wi=new Set(["absolute","fixed"]);function Ei(e,t){let n=Ke(e,true,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=U(e)?Ze(e):ve(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,c=o*i.x,a=r*i.y;return {width:s,height:l,x:c,y:a}}function br(e,t,n){let r;if(t==="viewport")r=xi(e,n);else if(t==="document")r=yi(ge(e));else if(X(t))r=Ei(t,n);else {let o=xr(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height};}return Ve(r)}function Er(e,t){let n=pe(e);return n===t||!X(n)||he(n)?false:re(n).position==="fixed"||Er(n,t)}function Ci(e,t){let n=t.get(e);if(n)return n;let r=se(e,[],false).filter(l=>X(l)&&we(l)!=="body"),o=null,i=re(e).position==="fixed",s=i?pe(e):e;for(;X(s)&&!he(s);){let l=re(s),c=bt(s);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&wi.has(o.position)||ze(s)&&!c&&Er(e,s))?r=r.filter(d=>d!==s):o=l,s=pe(s);}return t.set(e,r),r}function Si(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e,s=[...n==="clippingAncestors"?rt(t)?[]:Ci(t,this._c):[].concat(n),r],l=s[0],c=s.reduce((a,d)=>{let u=br(t,d,o);return a.top=ne(u.top,a.top),a.right=De(u.right,a.right),a.bottom=De(u.bottom,a.bottom),a.left=ne(u.left,a.left),a},br(t,l,o));return {width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ii(e){let{width:t,height:n}=yr(e);return {width:t,height:n}}function Oi(e,t,n){let r=U(t),o=ge(t),i=n==="fixed",s=Ke(e,true,i,t),l={scrollLeft:0,scrollTop:0},c=ve(0);function a(){c.x=Ot(o);}if(r||!r&&!i)if((we(t)!=="body"||ze(o))&&(l=ot(t)),r){let f=Ke(t,true,i,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop;}else o&&a();i&&!r&&o&&a();let d=o&&!r&&!i?wr(o,l):ve(0),u=s.left+l.scrollLeft-c.x-d.x,p=s.top+l.scrollTop-c.y-d.y;return {x:u,y:p,width:s.width,height:s.height}}function an(e){return re(e).position==="static"}function Rr(e,t){if(!U(e)||re(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ge(e)===n&&(n=n.ownerDocument.body),n}function Cr(e,t){let n=te(e);if(rt(e))return n;if(!U(e)){let o=pe(e);for(;o&&!he(o);){if(X(o)&&!an(o))return o;o=pe(o);}return n}let r=Rr(e,t);for(;r&&Bn(r)&&an(r);)r=Rr(r,t);return r&&he(r)&&an(r)&&!bt(r)?n:r||Wn(e)||n}var Pi=function(e){return fe(this,null,function*(){let t=this.getOffsetParent||Cr,n=this.getDimensions,r=yield n(e.floating);return {reference:Oi(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}})};function Ti(e){return re(e).direction==="rtl"}var fn={convertOffsetParentRelativeRectToViewportRelativeRect:bi,getDocumentElement:ge,getClippingRect:Si,getOffsetParent:Cr,getElementRects:Pi,getClientRects:Ri,getDimensions:Ii,getScale:Ze,isElement:X,isRTL:Ti};function Sr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Mi(e,t){let n=null,r,o=ge(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null;}function s(l,c){l===void 0&&(l=false),c===void 0&&(c=1),i();let a=e.getBoundingClientRect(),{left:d,top:u,width:p,height:f}=a;if(l||t(),!p||!f)return;let h=lt(u),m=lt(o.clientWidth-(d+p)),b=lt(o.clientHeight-(u+f)),y=lt(d),v={rootMargin:-h+"px "+-m+"px "+-b+"px "+-y+"px",threshold:ne(0,De(1,c))||1},x=true;function I(A){let O=A[0].intersectionRatio;if(O!==c){if(!x)return s();O?s(false,O):r=setTimeout(()=>{s(false,1e-7);},1e3);}O===1&&!Sr(a,e.getBoundingClientRect())&&s(),x=false;}try{n=new IntersectionObserver(I,N(E({},v),{root:o.ownerDocument}));}catch(A){n=new IntersectionObserver(I,v);}n.observe(e);}return s(true),i}function Pt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:o=true,ancestorResize:i=true,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=false}=r,a=un(e),d=o||i?[...a?se(a):[],...se(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:true}),i&&y.addEventListener("resize",n);});let u=a&&l?Mi(a,n):null,p=-1,f=null;s&&(f=new ResizeObserver(y=>{let[g]=y;g&&g.target===a&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t);})),n();}),a&&!c&&f.observe(a),f.observe(t));let h,m=c?Ke(e):null;c&&b();function b(){let y=Ke(e);m&&!Sr(m,y)&&n(),m=y,h=requestAnimationFrame(b);}return n(),()=>{var y;d.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n);}),u==null||u(),(y=f)==null||y.disconnect(),f=null,c&&cancelAnimationFrame(h);}}var Ir=pr,Or=dr,Pr=gr,Tr=mr,Mr=hr;var Tt=(e,t,n)=>{let r=new Map,o=E({platform:fn},n),i=N(E({},o.platform),{_c:r});return fr(e,t,N(E({},o),{platform:i}))};var Li=typeof document!="undefined",Di=function(){},Mt=Li?R.useLayoutEffect:Di;function At(e,t){if(e===t)return true;if(typeof e!=typeof t)return false;if(typeof e=="function"&&e.toString()===t.toString())return true;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return false;for(r=n;r--!==0;)if(!At(e[r],t[r]))return false;return true}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return false;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return false;for(r=n;r--!==0;){let i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!At(e[i],t[i]))return false}return true}return e!==e&&t!==t}function kr(e){return typeof window=="undefined"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ar(e,t){let n=kr(e);return Math.round(t*n)/n}function dn(e){let t=R__namespace.useRef(e);return Mt(()=>{t.current=e;}),t}function Nr(e){e===void 0&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=true,whileElementsMounted:c,open:a}=e,[d,u]=R__namespace.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:false}),[p,f]=R__namespace.useState(r);At(p,r)||f(r);let[h,m]=R__namespace.useState(null),[b,y]=R__namespace.useState(null),g=R__namespace.useCallback(w=>{w!==A.current&&(A.current=w,m(w));},[]),v=R__namespace.useCallback(w=>{w!==O.current&&(O.current=w,y(w));},[]),x=i||h,I=s||b,A=R__namespace.useRef(null),O=R__namespace.useRef(null),W=R__namespace.useRef(d),G=c!=null,K=dn(c),L=dn(o),V=dn(a),_=R__namespace.useCallback(()=>{if(!A.current||!O.current)return;let w={placement:t,strategy:n,middleware:p};L.current&&(w.platform=L.current),Tt(A.current,O.current,w).then(F=>{let T=N(E({},F),{isPositioned:V.current!==false});S.current&&!At(W.current,T)&&(W.current=T,Dr__namespace.flushSync(()=>{u(T);}));});},[p,t,n,L,V]);Mt(()=>{a===false&&W.current.isPositioned&&(W.current.isPositioned=false,u(w=>N(E({},w),{isPositioned:false})));},[a]);let S=R__namespace.useRef(false);Mt(()=>(S.current=true,()=>{S.current=false;}),[]),Mt(()=>{if(x&&(A.current=x),I&&(O.current=I),x&&I){if(K.current)return K.current(x,I,_);_();}},[x,I,_,K,G]);let C=R__namespace.useMemo(()=>({reference:A,floating:O,setReference:g,setFloating:v}),[g,v]),D=R__namespace.useMemo(()=>({reference:x,floating:I}),[x,I]),k=R__namespace.useMemo(()=>{let w={position:n,left:0,top:0};if(!D.floating)return w;let F=Ar(D.floating,d.x),T=Ar(D.floating,d.y);return l?E(N(E({},w),{transform:"translate("+F+"px, "+T+"px)"}),kr(D.floating)>=1.5&&{willChange:"transform"}):{position:n,left:F,top:T}},[n,l,D.floating,d.x,d.y]);return R__namespace.useMemo(()=>N(E({},d),{update:_,refs:C,elements:D,floatingStyles:k}),[d,_,C,D,k])}var Lt=(e,t)=>N(E({},Ir(e)),{options:[e,t]}),mn=(e,t)=>N(E({},Pr(e)),{options:[e,t]});var pn=(e,t)=>N(E({},Tr(e)),{options:[e,t]}),gn=(e,t)=>N(E({},Mr(e)),{options:[e,t]}),hn=(e,t)=>N(E({},Or(e)),{options:[e,t]});function wn(e){let t=R__namespace.useRef(void 0),n=R__namespace.useCallback(r=>{let o=e.map(i=>{if(i!=null){if(typeof i=="function"){let s=i,l=s(r);return typeof l=="function"?l:()=>{s(null);}}return i.current=r,()=>{i.current=null;}}});return ()=>{o.forEach(i=>i==null?void 0:i());}},e);return R__namespace.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r));},e)}var Ni="data-floating-ui-focusable",vn="active",bn="selected";var $i=E({},R__namespace),Fr=false,Ki=0,Br=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ki++;function zi(){let[e,t]=R__namespace.useState(()=>Fr?Br():void 0);return ce(()=>{e==null&&t(Br());},[]),R__namespace.useEffect(()=>{Fr=true;},[]),e}var ji=$i.useId,En=ji||zi;function Xi(){let e=new Map;return {emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n));},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n);},off(t,n){var r;(r=e.get(t))==null||r.delete(n);}}}var Ui=R__namespace.createContext(null),Gi=R__namespace.createContext(null),Yr=()=>{var e;return ((e=R__namespace.useContext(Ui))==null?void 0:e.id)||null},Cn=()=>R__namespace.useContext(Gi);function ut(e){return "data-floating-ui-"+e}function Yi(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1);}var Wr=0;function Je(e,t){t===void 0&&(t={});let{preventScroll:n=false,cancelPrevious:r=true,sync:o=false}=t;r&&cancelAnimationFrame(Wr);let i=()=>e==null?void 0:e.focus({preventScroll:n});o?i():Wr=requestAnimationFrame(i);}function qi(e){return (e==null?void 0:e.ownerDocument)||document}var Qe={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Hr(e){return e==="inert"?Qe.inert:e==="aria-hidden"?Qe["aria-hidden"]:Qe.none}var Dt=new WeakSet,kt={},Rn=0,Zi=()=>typeof HTMLElement!="undefined"&&"inert"in HTMLElement.prototype,qr=e=>e&&(e.host||qr(e.parentNode)),Ji=(e,t)=>t.map(n=>{if(e.contains(n))return n;let r=qr(n);return e.contains(r)?r:null}).filter(n=>n!=null);function Qi(e,t,n,r){let o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,s=Ji(t,e),l=new Set,c=new Set(s),a=[];kt[o]||(kt[o]=new WeakMap);let d=kt[o];s.forEach(u),p(t),l.clear();function u(f){!f||l.has(f)||(l.add(f),f.parentNode&&u(f.parentNode));}function p(f){!f||c.has(f)||[].forEach.call(f.children,h=>{if(we(h)!=="script")if(l.has(h))p(h);else {let m=i?h.getAttribute(i):null,b=m!==null&&m!=="false",y=Hr(i),g=(y.get(h)||0)+1,v=(d.get(h)||0)+1;y.set(h,g),d.set(h,v),a.push(h),g===1&&b&&Dt.add(h),v===1&&h.setAttribute(o,""),!b&&i&&h.setAttribute(i,i==="inert"?"":"true");}});}return Rn++,()=>{a.forEach(f=>{let h=Hr(i),b=(h.get(f)||0)-1,y=(d.get(f)||0)-1;h.set(f,b),d.set(f,y),b||(!Dt.has(f)&&i&&f.removeAttribute(i),Dt.delete(f)),y||f.removeAttribute(o);}),Rn--,Rn||(Qe.inert=new WeakMap,Qe["aria-hidden"]=new WeakMap,Qe.none=new WeakMap,Dt=new WeakSet,kt={});}}function Vr(e,t,n){t===void 0&&(t=false),n===void 0&&(n=false);let r=qi(e[0]).body;return Qi(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}var Ft={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},Nt=R__namespace.forwardRef(function(t,n){let[r,o]=R__namespace.useState();ce(()=>{rr()&&o("button");},[]);let i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:true,[ut("focus-guard")]:"",style:Ft};return jsxRuntime.jsx("span",E(E({},t),i))}),Zr=R__namespace.createContext(null),_r=ut("portal");function es(e){e===void 0&&(e={});let{id:t,root:n}=e,r=En(),o=Qr(),[i,s]=R__namespace.useState(null),l=R__namespace.useRef(null);return ce(()=>()=>{i==null||i.remove(),queueMicrotask(()=>{l.current=null;});},[i]),ce(()=>{if(!r||l.current)return;let c=t?document.getElementById(t):null;if(!c)return;let a=document.createElement("div");a.id=r,a.setAttribute(_r,""),c.appendChild(a),l.current=a,s(a);},[t,r]),ce(()=>{if(n===null||!r||l.current)return;let c=n||(o==null?void 0:o.portalNode);c&&!vt(c)&&(c=c.current),c=c||document.body;let a=null;t&&(a=document.createElement("div"),a.id=t,c.appendChild(a));let d=document.createElement("div");d.id=r,d.setAttribute(_r,""),c=a||c,c.appendChild(d),l.current=d,s(d);},[t,n,r,o]),i}function Jr(e){let{children:t,id:n,root:r,preserveTabOrder:o=true}=e,i=es({id:n,root:r}),[s,l]=R__namespace.useState(null),c=R__namespace.useRef(null),a=R__namespace.useRef(null),d=R__namespace.useRef(null),u=R__namespace.useRef(null),p=s==null?void 0:s.modal,f=s==null?void 0:s.open,h=!!s&&!s.modal&&s.open&&o&&!!(r||i);return R__namespace.useEffect(()=>{if(!i||!o||p)return;function m(b){i&&qe(b)&&(b.type==="focusin"?ln:ar)(i);}return i.addEventListener("focusin",m,true),i.addEventListener("focusout",m,true),()=>{i.removeEventListener("focusin",m,true),i.removeEventListener("focusout",m,true);}},[i,o,p]),R__namespace.useEffect(()=>{i&&(f||ln(i));},[f,i]),jsxRuntime.jsxs(Zr.Provider,{value:R__namespace.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:c,afterOutsideRef:a,beforeInsideRef:d,afterInsideRef:u,portalNode:i,setFocusManagerState:l}),[o,i]),children:[h&&i&&jsxRuntime.jsx(Nt,{"data-type":"outside",ref:c,onFocus:m=>{if(qe(m,i)){var b;(b=d.current)==null||b.focus();}else {let y=s?s.domReference:null,g=cn(y);g==null||g.focus();}}}),h&&i&&jsxRuntime.jsx("span",{"aria-owns":i.id,style:Ft}),i&&Dr__namespace.createPortal(t,i),h&&i&&jsxRuntime.jsx(Nt,{"data-type":"outside",ref:a,onFocus:m=>{if(qe(m,i)){var b;(b=u.current)==null||b.focus();}else {let y=s?s.domReference:null,g=sn(y);g==null||g.focus(),s!=null&&s.closeOnFocusOut&&(s==null||s.onOpenChange(false,m.nativeEvent,"focus-out"));}}})]})}var Qr=()=>R__namespace.useContext(Zr);function $r(e){return R__namespace.useMemo(()=>t=>{e.forEach(n=>{n&&(n.current=t);});},e)}var ts=20,ke=[];function Sn(){ke=ke.filter(e=>e.isConnected);}function ns(e){Sn(),e&&we(e)!=="body"&&(ke.push(e),ke.length>ts&&(ke=ke.slice(-20)));}function Kr(){return Sn(),ke[ke.length-1]}function rs(e){let t=Ye();return Jt(e,t)?e:Ue(e,t)[0]||e}function zr(e,t){var n;if(!t.current.includes("floating")&&!((n=e.getAttribute("role"))!=null&&n.includes("dialog")))return;let r=Ye(),i=er(e,r).filter(l=>{let c=l.getAttribute("data-tabindex")||"";return Jt(l,r)||l.hasAttribute("data-tabindex")&&!c.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||i.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"));}var os=R__namespace.forwardRef(function(t,n){return jsxRuntime.jsx("button",N(E({},t),{type:"button",ref:n,tabIndex:-1,style:Ft}))});function eo(e){let{context:t,children:n,disabled:r=false,order:o=["content"],guards:i=true,initialFocus:s=0,returnFocus:l=true,restoreFocus:c=false,modal:a=true,visuallyHiddenDismiss:d=false,closeOnFocusOut:u=true,outsideElementsInert:p=false,getInsideElements:f=()=>[]}=e,{open:h,onOpenChange:m,events:b,dataRef:y,elements:{domReference:g,floating:v}}=t,x=ye(()=>{var P;return (P=y.current.floatingContext)==null?void 0:P.nodeId}),I=ye(f),A=typeof s=="number"&&s<0,O=nn(g)&&A,W=Zi(),G=W?i:true,K=!G||W&&p,L=It(o),V=It(s),_=It(l),S=Cn(),C=Qr(),D=R__namespace.useRef(null),k=R__namespace.useRef(null),w=R__namespace.useRef(false),F=R__namespace.useRef(false),T=R__namespace.useRef(-1),q=R__namespace.useRef(-1),Pe=C!=null,B=Ct(v),xe=ye(function(P){return P===void 0&&(P=B),P?Ue(P,Ye()):[]}),Z=ye(P=>{let H=xe(P);return L.current.map(M=>g&&M==="reference"?g:B&&M==="floating"?B:H).filter(Boolean).flat()});R__namespace.useEffect(()=>{if(r||!a)return;function P(M){if(M.key==="Tab"){oe(B,_e(de(B)))&&xe().length===0&&!O&&St(M);let Y=Z(),ee=Oe(M);L.current[0]==="reference"&&ee===g&&(St(M),M.shiftKey?Je(Y[Y.length-1]):Je(Y[1])),L.current[1]==="floating"&&ee===B&&M.shiftKey&&(St(M),Je(Y[0]));}}let H=de(B);return H.addEventListener("keydown",P),()=>{H.removeEventListener("keydown",P);}},[r,g,B,a,L,O,xe,Z]),R__namespace.useEffect(()=>{if(r||!v)return;function P(H){let M=Oe(H),ee=xe().indexOf(M);ee!==-1&&(T.current=ee);}return v.addEventListener("focusin",P),()=>{v.removeEventListener("focusin",P);}},[r,v,xe]),R__namespace.useEffect(()=>{if(r||!u)return;function P(){F.current=true,setTimeout(()=>{F.current=false;});}function H(ee){let $=ee.relatedTarget,Ce=ee.currentTarget,ue=Oe(ee);queueMicrotask(()=>{let ie=x(),Be=!(oe(g,$)||oe(v,$)||oe($,v)||oe(C==null?void 0:C.portalNode,$)||$!=null&&$.hasAttribute(ut("focus-guard"))||S&&($e(S.nodesRef.current,ie).find(Me=>{var Se,Ae;return oe((Se=Me.context)==null?void 0:Se.elements.floating,$)||oe((Ae=Me.context)==null?void 0:Ae.elements.domReference,$)})||rn(S.nodesRef.current,ie).find(Me=>{var Se,Ae,Tn;return [(Se=Me.context)==null?void 0:Se.elements.floating,Ct((Ae=Me.context)==null?void 0:Ae.elements.floating)].includes($)||((Tn=Me.context)==null?void 0:Tn.elements.domReference)===$})));if(Ce===g&&B&&zr(B,L),c&&Ce!==g&&!(ue!=null&&ue.isConnected)&&_e(de(B))===de(B).body){U(B)&&B.focus();let Me=T.current,Se=xe(),Ae=Se[Me]||Se[Se.length-1]||B;U(Ae)&&Ae.focus();}if(y.current.insideReactTree){y.current.insideReactTree=false;return}(O||!a)&&$&&Be&&!F.current&&$!==Kr()&&(w.current=true,m(false,ee,"focus-out"));});}let M=!!(!S&&C);function Y(){Yi(q),y.current.insideReactTree=true,q.current=window.setTimeout(()=>{y.current.insideReactTree=false;});}if(v&&U(g))return g.addEventListener("focusout",H),g.addEventListener("pointerdown",P),v.addEventListener("focusout",H),M&&v.addEventListener("focusout",Y,true),()=>{g.removeEventListener("focusout",H),g.removeEventListener("pointerdown",P),v.removeEventListener("focusout",H),M&&v.removeEventListener("focusout",Y,true);}},[r,g,v,B,a,S,C,m,u,c,xe,O,x,L,y]);let ae=R__namespace.useRef(null),Te=R__namespace.useRef(null),_t=$r([ae,C==null?void 0:C.beforeInsideRef]),$t=$r([Te,C==null?void 0:C.afterInsideRef]);R__namespace.useEffect(()=>{var P,H;if(r||!v)return;let M=Array.from((C==null||(P=C.portalNode)==null?void 0:P.querySelectorAll("["+ut("portal")+"]"))||[]),ee=(H=(S?rn(S.nodesRef.current,x()):[]).find(ue=>{var ie;return nn(((ie=ue.context)==null?void 0:ie.elements.domReference)||null)}))==null||(H=H.context)==null?void 0:H.elements.domReference,$=[v,ee,...M,...I(),D.current,k.current,ae.current,Te.current,C==null?void 0:C.beforeOutsideRef.current,C==null?void 0:C.afterOutsideRef.current,L.current.includes("reference")||O?g:null].filter(ue=>ue!=null),Ce=a||O?Vr($,!K,K):Vr($);return ()=>{Ce();}},[r,g,v,a,L,C,O,G,K,S,x,I]),ce(()=>{if(r||!U(B))return;let P=de(B),H=_e(P);queueMicrotask(()=>{let M=Z(B),Y=V.current,ee=(typeof Y=="number"?M[Y]:Y.current)||B,$=oe(B,H);!A&&!$&&h&&Je(ee,{preventScroll:ee===B});});},[r,h,B,A,Z,V]),ce(()=>{if(r||!B)return;let P=de(B),H=_e(P);ns(H);function M($){let{reason:Ce,event:ue,nested:ie}=$;if(["hover","safe-polygon"].includes(Ce)&&ue.type==="mouseleave"&&(w.current=true),Ce==="outside-press")if(ie)w.current=false;else if(sr(ue)||cr(ue))w.current=false;else {let Be=false;document.createElement("div").focus({get preventScroll(){return Be=true,false}}),Be?w.current=false:w.current=true;}}b.on("openchange",M);let Y=P.createElement("span");Y.setAttribute("tabindex","-1"),Y.setAttribute("aria-hidden","true"),Object.assign(Y.style,Ft),Pe&&g&&g.insertAdjacentElement("afterend",Y);function ee(){if(typeof _.current=="boolean"){let $=g||Kr();return $&&$.isConnected?$:Y}return _.current.current||Y}return ()=>{b.off("openchange",M);let $=_e(P),Ce=oe(v,$)||S&&$e(S.nodesRef.current,x(),false).some(ie=>{var Be;return oe((Be=ie.context)==null?void 0:Be.elements.floating,$)}),ue=ee();queueMicrotask(()=>{let ie=rs(ue);_.current&&!w.current&&U(ie)&&(!(ie!==$&&$!==P.body)||Ce)&&ie.focus({preventScroll:true}),Y.remove();});}},[r,v,B,_,y,b,S,Pe,g,x]),R__namespace.useEffect(()=>(queueMicrotask(()=>{w.current=false;}),()=>{queueMicrotask(Sn);}),[r]),ce(()=>{if(!r&&C)return C.setFocusManagerState({modal:a,closeOnFocusOut:u,open:h,onOpenChange:m,domReference:g}),()=>{C.setFocusManagerState(null);}},[r,C,a,h,m,u,g]),ce(()=>{r||B&&zr(B,L);},[r,B,L]);function dt(P){return r||!d||!a?null:jsxRuntime.jsx(os,{ref:P==="start"?D:k,onClick:H=>m(false,H.nativeEvent),children:typeof d=="string"?d:"Dismiss"})}let mt=!r&&G&&(a?!O:true)&&(Pe||a);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[mt&&jsxRuntime.jsx(Nt,{"data-type":"inside",ref:_t,onFocus:P=>{if(a){let M=Z();Je(o[0]==="reference"?M[0]:M[M.length-1]);}else if(C!=null&&C.preserveTabOrder&&C.portalNode)if(w.current=false,qe(P,C.portalNode)){let M=sn(g);M==null||M.focus();}else {var H;(H=C.beforeOutsideRef.current)==null||H.focus();}}}),!O&&dt("start"),n,dt("end"),mt&&jsxRuntime.jsx(Nt,{"data-type":"inside",ref:$t,onFocus:P=>{if(a)Je(Z()[0]);else if(C!=null&&C.preserveTabOrder&&C.portalNode)if(u&&(w.current=true),qe(P,C.portalNode)){let M=cn(g);M==null||M.focus();}else {var H;(H=C.afterOutsideRef.current)==null||H.focus();}}})]})}function jr(e){return U(e.target)&&e.target.tagName==="BUTTON"}function is(e){return U(e.target)&&e.target.tagName==="A"}function Xr(e){return tn(e)}function to(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:s=true,event:l="click",toggle:c=true,ignoreMouse:a=false,keyboardHandlers:d=true,stickIfOpen:u=true}=t,p=R__namespace.useRef(),f=R__namespace.useRef(false),h=R__namespace.useMemo(()=>({onPointerDown(m){p.current=m.pointerType;},onMouseDown(m){let b=p.current;m.button===0&&l!=="click"&&(on(b)&&a||(n&&c&&(!(o.current.openEvent&&u)||o.current.openEvent.type==="mousedown")?r(false,m.nativeEvent,"click"):(m.preventDefault(),r(true,m.nativeEvent,"click"))));},onClick(m){let b=p.current;if(l==="mousedown"&&p.current){p.current=void 0;return}on(b)&&a||(n&&c&&(!(o.current.openEvent&&u)||o.current.openEvent.type==="click")?r(false,m.nativeEvent,"click"):r(true,m.nativeEvent,"click"));},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!d||jr(m))&&(m.key===" "&&!Xr(i)&&(m.preventDefault(),f.current=true),!is(m)&&m.key==="Enter"&&r(!(n&&c),m.nativeEvent,"click"));},onKeyUp(m){m.defaultPrevented||!d||jr(m)||Xr(i)||m.key===" "&&f.current&&(f.current=false,r(!(n&&c),m.nativeEvent,"click"));}}),[o,i,l,a,d,r,n,u,c]);return R__namespace.useMemo(()=>s?{reference:h}:{},[s,h])}var ss={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},cs={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ur=e=>{var t,n;return {escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:false,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:true}};function no(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:s=true,escapeKey:l=true,outsidePress:c=true,outsidePressEvent:a="pointerdown",referencePress:d=false,referencePressEvent:u="pointerdown",ancestorScroll:p=false,bubbles:f,capture:h}=t,m=Cn(),b=ye(typeof c=="function"?c:()=>false),y=typeof c=="function"?b:c,g=R__namespace.useRef(false),{escapeKey:v,outsidePress:x}=Ur(f),{escapeKey:I,outsidePress:A}=Ur(h),O=R__namespace.useRef(false),W=ye(S=>{var C;if(!n||!s||!l||S.key!=="Escape"||O.current)return;let D=(C=i.current.floatingContext)==null?void 0:C.nodeId,k=m?$e(m.nodesRef.current,D):[];if(!v&&(S.stopPropagation(),k.length>0)){let w=true;if(k.forEach(F=>{var T;if((T=F.context)!=null&&T.open&&!F.context.dataRef.current.__escapeKeyBubbles){w=false;return}}),!w)return}r(false,ir(S)?S.nativeEvent:S,"escape-key");}),G=ye(S=>{var C;let D=()=>{var k;W(S),(k=Oe(S))==null||k.removeEventListener("keydown",D);};(C=Oe(S))==null||C.addEventListener("keydown",D);}),K=ye(S=>{var C;let D=i.current.insideReactTree;i.current.insideReactTree=false;let k=g.current;if(g.current=false,a==="click"&&k||D||typeof y=="function"&&!y(S))return;let w=Oe(S),F="["+ut("inert")+"]",T=de(o.floating).querySelectorAll(F),q=X(w)?w:null;for(;q&&!he(q);){let Z=pe(q);if(he(Z)||!X(Z))break;q=Z;}if(T.length&&X(w)&&!or(w)&&!oe(w,o.floating)&&Array.from(T).every(Z=>!oe(q,Z)))return;if(U(w)&&_){let Z=he(w),ae=re(w),Te=/auto|scroll/,_t=Z||Te.test(ae.overflowX),$t=Z||Te.test(ae.overflowY),dt=_t&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,mt=$t&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,P=ae.direction==="rtl",H=mt&&(P?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),M=dt&&S.offsetY>w.clientHeight;if(H||M)return}let Pe=(C=i.current.floatingContext)==null?void 0:C.nodeId,B=m&&$e(m.nodesRef.current,Pe).some(Z=>{var ae;return Et(S,(ae=Z.context)==null?void 0:ae.elements.floating)});if(Et(S,o.floating)||Et(S,o.domReference)||B)return;let xe=m?$e(m.nodesRef.current,Pe):[];if(xe.length>0){let Z=true;if(xe.forEach(ae=>{var Te;if((Te=ae.context)!=null&&Te.open&&!ae.context.dataRef.current.__outsidePressBubbles){Z=false;return}}),!Z)return}r(false,S,"outside-press");}),L=ye(S=>{var C;let D=()=>{var k;K(S),(k=Oe(S))==null||k.removeEventListener(a,D);};(C=Oe(S))==null||C.addEventListener(a,D);});R__namespace.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=v,i.current.__outsidePressBubbles=x;let S=-1;function C(T){r(false,T,"ancestor-scroll");}function D(){window.clearTimeout(S),O.current=true;}function k(){S=window.setTimeout(()=>{O.current=false;},je()?5:0);}let w=de(o.floating);l&&(w.addEventListener("keydown",I?G:W,I),w.addEventListener("compositionstart",D),w.addEventListener("compositionend",k)),y&&w.addEventListener(a,A?L:K,A);let F=[];return p&&(X(o.domReference)&&(F=se(o.domReference)),X(o.floating)&&(F=F.concat(se(o.floating))),!X(o.reference)&&o.reference&&o.reference.contextElement&&(F=F.concat(se(o.reference.contextElement)))),F=F.filter(T=>{var q;return T!==((q=w.defaultView)==null?void 0:q.visualViewport)}),F.forEach(T=>{T.addEventListener("scroll",C,{passive:true});}),()=>{l&&(w.removeEventListener("keydown",I?G:W,I),w.removeEventListener("compositionstart",D),w.removeEventListener("compositionend",k)),y&&w.removeEventListener(a,A?L:K,A),F.forEach(T=>{T.removeEventListener("scroll",C);}),window.clearTimeout(S);}},[i,o,l,y,a,n,r,p,s,v,x,W,I,G,K,A,L]),R__namespace.useEffect(()=>{i.current.insideReactTree=false;},[i,y,a]);let V=R__namespace.useMemo(()=>E({onKeyDown:W},d&&E({[ss[u]]:S=>{r(false,S.nativeEvent,"reference-press");}},u!=="click"&&{onClick(S){r(false,S.nativeEvent,"reference-press");}})),[W,r,d,u]),_=R__namespace.useMemo(()=>({onKeyDown:W,onMouseDown(){g.current=true;},onMouseUp(){g.current=true;},[cs[a]]:()=>{i.current.insideReactTree=true;}}),[W,a,i]);return R__namespace.useMemo(()=>s?{reference:V,floating:_}:{},[s,V,_])}function ls(e){let{open:t=false,onOpenChange:n,elements:r}=e,o=En(),i=R__namespace.useRef({}),[s]=R__namespace.useState(()=>Xi()),l=Yr()!=null,[c,a]=R__namespace.useState(r.reference),d=ye((f,h,m)=>{i.current.openEvent=f?h:void 0,s.emit("openchange",{open:f,event:h,reason:m,nested:l}),n==null||n(f,h,m);}),u=R__namespace.useMemo(()=>({setPositionReference:a}),[]),p=R__namespace.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return R__namespace.useMemo(()=>({dataRef:i,open:t,onOpenChange:d,elements:p,events:s,floatingId:o,refs:u}),[t,d,p,s,o,u])}function ro(e){e===void 0&&(e={});let{nodeId:t}=e,n=ls(N(E({},e),{elements:E({reference:null,floating:null},e.elements)})),r=e.rootContext||n,o=r.elements,[i,s]=R__namespace.useState(null),[l,c]=R__namespace.useState(null),d=(o==null?void 0:o.domReference)||i,u=R__namespace.useRef(null),p=Cn();ce(()=>{d&&(u.current=d);},[d]);let f=Nr(N(E({},e),{elements:E(E({},o),l&&{reference:l})})),h=R__namespace.useCallback(v=>{let x=X(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),getClientRects:()=>v.getClientRects(),contextElement:v}:v;c(x),f.refs.setReference(x);},[f.refs]),m=R__namespace.useCallback(v=>{(X(v)||v===null)&&(u.current=v,s(v)),(X(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!X(v))&&f.refs.setReference(v);},[f.refs]),b=R__namespace.useMemo(()=>N(E({},f.refs),{setReference:m,setPositionReference:h,domReference:u}),[f.refs,m,h]),y=R__namespace.useMemo(()=>N(E({},f.elements),{domReference:d}),[f.elements,d]),g=R__namespace.useMemo(()=>N(E(E({},f),r),{refs:b,elements:y,nodeId:t}),[f,b,y,t,r]);return ce(()=>{r.dataRef.current.floatingContext=g;let v=p==null?void 0:p.nodesRef.current.find(x=>x.id===t);v&&(v.context=g);}),R__namespace.useMemo(()=>N(E({},f),{context:g,refs:b,elements:y}),[f,b,y,g])}function yn(e,t,n){let r=new Map,o=n==="item",i=e;if(o&&e){let s=e,{[vn]:l,[bn]:c}=s;i=me(s,[Kt(vn),Kt(bn)]);}return E(E(E({},n==="floating"&&{tabIndex:-1,[Ni]:""}),i),t.map(l=>{let c=l?l[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((l,c)=>(c&&Object.entries(c).forEach(a=>{let[d,u]=a;if(!(o&&[vn,bn].includes(d)))if(d.indexOf("on")===0){if(r.has(d)||r.set(d,[]),typeof u=="function"){var p;(p=r.get(d))==null||p.push(u),l[d]=function(){for(var f,h=arguments.length,m=new Array(h),b=0;b<h;b++)m[b]=arguments[b];return (f=r.get(d))==null?void 0:f.map(y=>y(...m)).find(y=>y!==void 0)};}}else l[d]=u;}),l),{}))}function In(e){e===void 0&&(e=[]);let t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=R__namespace.useCallback(l=>yn(l,e,"reference"),t),i=R__namespace.useCallback(l=>yn(l,e,"floating"),n),s=R__namespace.useCallback(l=>yn(l,e,"item"),r);return R__namespace.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}var as=new Map([["select","listbox"],["combobox","listbox"],["label",false]]);function oo(e,t){var n,r;t===void 0&&(t={});let{open:o,elements:i,floatingId:s}=e,{enabled:l=true,role:c="dialog"}=t,a=En(),d=((n=i.domReference)==null?void 0:n.id)||a,u=R__namespace.useMemo(()=>{var g;return ((g=Ct(i.floating))==null?void 0:g.id)||s},[i.floating,s]),p=(r=as.get(c))!=null?r:c,h=Yr()!=null,m=R__namespace.useMemo(()=>p==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:o?u:void 0}:E(E(E(E(E({"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?u:void 0},p==="listbox"&&{role:"combobox"}),p==="menu"&&{id:d}),p==="menu"&&h&&{role:"menuitem"}),c==="select"&&{"aria-autocomplete":"none"}),c==="combobox"&&{"aria-autocomplete":"list"}),[p,u,h,o,d,c]),b=R__namespace.useMemo(()=>{let g=E({id:u},p&&{role:p});return p==="tooltip"||c==="label"?g:E(E({},g),p==="menu"&&{"aria-labelledby":d})},[p,u,d,c]),y=R__namespace.useCallback(g=>{let{active:v,selected:x}=g,I=E({role:"option"},v&&{id:u+"-fui-option"});switch(c){case "select":case "combobox":return N(E({},I),{"aria-selected":x})}return {}},[u,c]);return R__namespace.useMemo(()=>l?{reference:m,floating:b,item:y}:{},[l,m,b,y])}var ds=Object.defineProperty,ms=Object.defineProperties,ps=Object.getOwnPropertyDescriptors,Bt=Object.getOwnPropertySymbols,so=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,io=(e,t,n)=>t in e?ds(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,Fe=(e,t)=>{for(var n in t||(t={}))so.call(t,n)&&io(e,n,t[n]);if(Bt)for(var n of Bt(t))co.call(t,n)&&io(e,n,t[n]);return e},Wt=(e,t)=>ms(e,ps(t)),Ht=(e,t)=>{var n={};for(var r in e)so.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bt)for(var r of Bt(e))t.indexOf(r)<0&&co.call(e,r)&&(n[r]=e[r]);return n},lo=R__namespace.default.createContext(null),ao=()=>{let e=R__namespace.default.useContext(lo);if(e===void 0)throw new Error("usePopoverContext must be used within a PopoverContextProvider");return e},gs=lo.Provider;function hs({placement:e="bottom-start",isFullWidth:t=false,isAutoalignmentEnabled:n=true,isOpen:r=false,offset:o=0,onClose:i,renderOnlyWhenOpen:s=true,usePortal:l=true,closeOnEsc:c=true,closeOnBlur:a=true,autoFocus:d=true}={}){let[u,p]=R__namespace.default.useState(),[f,h]=R__namespace.default.useState(),m="bottom-start",b=[Lt(o)];e!=="auto"&&n?(m=e,b.push(pn({padding:5}),mn({padding:5}))):e==="auto"?b.push(hn()):m=e,t&&b.push(gn({apply({rects:O,elements:W}){Object.assign(W.floating.style,{minWidth:`${O.reference.width}px`});}}));let y=ro({placement:m,open:r,onOpenChange:i,whileElementsMounted:Pt,middleware:b}),g=y.context,v=to(g,{enabled:false}),x=no(g,{escapeKey:c,outsidePress:a,ancestorScroll:true}),I=oo(g),A=In([v,x,I]);return R__namespace.default.useMemo(()=>Wt(Fe(Fe({isOpen:r,autoFocus:d,dismiss:x,onClose:i},A),y),{renderOnlyWhenOpen:s,usePortal:l,labelId:u,descriptionId:f,setLabelId:p,setDescriptionId:h}),[r,d,x,i,A,y,s,l,u,f])}function vs(e){let t=e,{children:n}=t,r=Ht(t,["children"]),o=hs(Fe({},r));return R__namespace.default.createElement(gs,{value:o},n)}var bs=e=>({container:css.css({display:e?"inital":"none",width:"max-content",position:"absolute",top:0,left:0,background:j__default.default.colorWhite,border:0,borderRadius:j__default.default.borderRadiusMedium,boxShadow:j__default.default.boxShadowDefault,zIndex:j__default.default.zIndexDropdown,"&:focus":{boxShadow:j__default.default.glowPrimary,outline:"none"},"&:focus:not(:focus-visible)":{boxShadow:j__default.default.boxShadowDefault}})}),uo=(e,t)=>{let n=e,{children:r,className:o,testId:i="cf-ui-popover-content",role:s="dialog"}=n,l=Ht(n,["children","className","testId","role"]),c=ao(),{isOpen:a,renderOnlyWhenOpen:d,usePortal:u,autoFocus:p,dismiss:f,context:h}=c,m=Ht(c,["isOpen","renderOnlyWhenOpen","usePortal","autoFocus","dismiss","context"]),b=wn([m.refs.setFloating,t]),y=bs(a),{getFloatingProps:g}=In([f]);if(d&&!a)return null;let v=R__namespace.default.createElement("div",Wt(Fe(Wt(Fe({},l),{className:css.cx(y.container,o),style:Fe({},m.floatingStyles)}),g()),{"aria-labelledby":m.labelId,"aria-describedby":m.descriptionId,"data-test-id":i,tabIndex:-1,role:s,ref:b,"data-position-absolute":true}),r),x=I=>p===false?I:R__namespace.default.createElement(eo,{context:h},I);return u?R__namespace.default.createElement(Jr,null,x(v)):x(v)};uo.displayName="PopoverContent";var Rs=R__namespace.default.forwardRef(uo),ys=R__namespace.default.forwardRef(function(e,t){var n=e,{children:r}=n,o=Ht(n,["children"]),i;let s=ao(),l=r.ref,c=wn([s==null?void 0:s.refs.setReference,t,l]);if(!R__namespace.default.isValidElement(r))return null;let a=r.props,d=(i=a["aria-haspopup"])!=null?i:"dialog",u=s.getReferenceProps(Wt(Fe(Fe({ref:c},o),a),{"aria-haspopup":d,"aria-expanded":s.isOpen}));return R__namespace.default.cloneElement(r,u)}),tt=vs;tt.Content=Rs;tt.Trigger=ys;var po=({searchValue:e,setSearchValue:t,onSearchValueChange:n,searchInputName:r,searchInputRef:o,resetSearchRef:i,searchPlaceholder:s="Search",focusList:l})=>{let c=Le(),a=R.useRef(null),d=R.useCallback(p=>{t(p.target.value),n==null||n(p);},[n,t]),u=R.useCallback(()=>{if(!e)return;l(),Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set.call(a.current,"");let f=new Event("change",{bubbles:true});a.current.dispatchEvent(f);},[e,l]);return R__namespace.default.createElement("div",{className:c.searchBar},R__namespace.default.createElement(f36Forms.TextInput,{"aria-label":"Search",type:"text",value:e,className:c.inputField,testId:"cf-multiselect-search",placeholder:s,onChange:d,ref:f36Core.mergeRefs(o,a),name:r,size:"small"}),R__namespace.default.createElement(f36Button.IconButton,{ref:i,"aria-label":e?"Clear search":"Search",className:c.toggleButton,variant:"transparent",icon:e?R__namespace.default.createElement(f36Icons.XIcon,{color:j__default.default.gray600}):R__namespace.default.createElement(f36Icons.MagnifyingGlassIcon,{color:j__default.default.gray600}),onClick:u,isDisabled:!e,size:"small"}))};var bo=(e,t)=>{let n=0;return R__namespace.default.Children.forEach(e,r=>{if(!R__namespace.default.isValidElement(r))return;let o=r;t(o)?n+=1:n+=bo(o.props.children,t);}),n};function Ro(e,t){let{className:n,startIcon:r,placeholder:o="Select one or more Items",currentSelection:i=[],toggleRef:s,toggleButtonAriaLabel:l="Toggle Multiselect",isLoading:c=false,testId:a="cf-multiselect",noMatchesMessage:d="No matches found",searchProps:u={},popoverProps:p={},children:f,onBlur:h,onClearSelection:m,clearButtonProps:b={tooltip:"Clear selection",ariaLabel:"Clear selection"}}=e,{listMaxHeight:y=180,listRef:g,onClose:v}=p,x=Le(),[I,A]=R.useState(""),[O,W]=R.useState(false),G=R.useRef(null),K=i.length>1&&typeof m=="function",L=typeof u.onSearchValueChange=="function",V=R.useCallback(()=>{var k;(k=G.current)==null||k.focus();},[]),_=k=>{m==null||m(),k.stopPropagation();},S=R.useCallback(()=>{if(i.length===0)return R__namespace.default.createElement(R__namespace.default.Fragment,null,o);let k=i.length-1,w=css.cx(x.currentSelection,K&&x.currentSelectionWithClearButton);return k===0?R__namespace.default.createElement("span",{"data-test-id":"cf-multiselect-current-selection",className:w},i[0]):R__namespace.default.createElement("span",{"data-test-id":"cf-multiselect-current-selection",className:w},i[0]," ",R__namespace.default.createElement("span",{className:x.currentSelectionAddition},"and ",k," more"))},[i,o,K,x.currentSelection,x.currentSelectionAddition,x.currentSelectionWithClearButton]),C=R.useMemo(()=>bo(f,k=>k.type===We),[f]),D=R.useMemo(()=>({focusList:V,searchValue:I}),[V,I]);return R__namespace.default.createElement(Fn,{value:D},R__namespace.default.createElement("div",{"data-test-id":a,className:css.cx(x.multiselect,n),ref:t},R__namespace.default.createElement(tt,N(E({renderOnlyWhenOpen:false,isFullWidth:true},p),{isOpen:O,onClose:()=>{W(false),v&&v();}}),R__namespace.default.createElement(f36Core.Flex,{alignItems:"center"},R__namespace.default.createElement(tt.Trigger,{ref:s},R__namespace.default.createElement(f36Button.Button,E({"aria-label":l,onClick:()=>W(!O),startIcon:r,endIcon:R__namespace.default.createElement(f36Icons.CaretDownIcon,null),isFullWidth:true,className:x.triggerButton},e.triggerButtonProps),S())),K&&R__namespace.default.createElement("div",{className:x.clearSelectionButton},R__namespace.default.createElement(f36Button.IconButton,{onClick:_,icon:R__namespace.default.createElement(f36Icons.XIcon,null),"aria-label":b.ariaLabel?b.ariaLabel:"Clear selection",size:"small",withTooltip:true,tooltipProps:{content:b.tooltip?b.tooltip:"Clear selection",showDelay:800,placement:"top",as:"div"}}))),R__namespace.default.createElement(tt.Content,{ref:f36Core.mergeRefs(g,G),className:css.cx(x.content(y),p.className,x.container),testId:"cf-multiselect-container",onBlur:()=>h==null?void 0:h()},R__namespace.default.createElement(Bs__default.default,{focusOptions:{preventScroll:true},returnFocus:true},L&&R__namespace.default.createElement(po,N(E({},u),{setSearchValue:A,searchValue:I,focusList:V})),c&&R__namespace.default.createElement(Ws,null),!c&&C>0&&R__namespace.default.createElement("ul",{className:x.list,"data-test-id":"cf-multiselect-items"},f),!c&&C===0&&R__namespace.default.createElement(f36Typography.Subheading,{className:x.noMatchesTitle},d))))))}var Ws=()=>R__namespace.default.createElement(f36Skeleton.SkeletonContainer,{svgHeight:16},R__namespace.default.createElement(f36Skeleton.SkeletonBodyText,{numberOfLines:1}));Ro.displayName="Multiselect";var yo=R__namespace.default.forwardRef(Ro);var Pn=l=>{var c=l,{label:e,itemId:t="SelectAll",onSelectItem:n,isChecked:r=false,selectAllOptionLabel:o={checked:"Deselect all",unchecked:"Select all"},className:i}=c,s=me(c,["label","itemId","onSelectItem","isChecked","selectAllOptionLabel","className"]);let a=Le(),d=e||r?o.checked:o.unchecked;return R__namespace.default.createElement(We,E({value:"all",label:d,itemId:t,onSelectItem:n,isChecked:r,className:css.cx(a.selectAll,i)},s))};var Vt=yo;Vt.HighlightedItem=gt;Vt.Option=We;Vt.SelectAll=Pn;/*! Bundled license information:
2
+
3
+ tabbable/dist/index.esm.js:
4
+ (*!
5
+ * tabbable 6.2.0
6
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
7
+ *)
8
+ */exports.Multiselect=Vt;exports.MultiselectOption=We;exports.SelectAllOption=Pn;//# sourceMappingURL=index.js.map
29
9
  //# sourceMappingURL=index.js.map