@linzjs/lui 17.11.0 → 17.11.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.js CHANGED
@@ -786,8 +786,8 @@ function LuiFormikForm(props) {
786
786
  " "))));
787
787
  }
788
788
 
789
- var css_248z$5 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.LuiError {\n font-family: \"Open Sans\", system-ui, sans-serif;\n font-style: normal;\n font-weight: 600;\n margin-bottom: 0.5rem;\n font-size: 0.875rem;\n line-height: 1.5rem;\n color: #2a292c;\n}\n.LuiError-errorIcon {\n vertical-align: middle;\n display: inline-block;\n}\n.LuiError-errorText {\n margin-left: 0.5rem;\n}";
790
- styleInject(css_248z$5);
789
+ var css_248z$8 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.LuiError {\n font-family: \"Open Sans\", system-ui, sans-serif;\n font-style: normal;\n font-weight: 600;\n margin-bottom: 0.5rem;\n font-size: 0.875rem;\n line-height: 1.5rem;\n color: #2a292c;\n}\n.LuiError-errorIcon {\n vertical-align: middle;\n display: inline-block;\n}\n.LuiError-errorText {\n margin-left: 0.5rem;\n}";
790
+ styleInject(css_248z$8);
791
791
 
792
792
  const LuiError = ({ error, className }) => (React__default["default"].createElement("div", { className: `LuiError ${className}-error` },
793
793
  React__default["default"].createElement(LuiIcon, { className: `LuiError-errorIcon ${className}-errorIcon`, alt: 'Error', name: "ic_error", size: "md", status: "error" }),
@@ -24936,8 +24936,8 @@ function isChromatic() {
24936
24936
  window?.location.href.match(/chromatic=true/));
24937
24937
  }
24938
24938
 
24939
- var css_248z$4 = ":export {\n charcoal: #2a292c;\n fuscous: #6b6966;\n gray: #989189;\n silver: #beb9b4;\n lily: #eaeaea;\n hint: #f9f9f9;\n snow: #ffffff;\n white: #ffffff;\n teal: #00425d;\n sea: #007198;\n electric: #0096cc;\n spray: #73c8e1;\n polar: #e2f3f7;\n sherpa: #004b50;\n surfie: #017a76;\n persian: #00a599;\n downy: #73cdc8;\n iceberg: #dcf5f0;\n sacramento: #004e32;\n salem: #08814d;\n pigment: #0aa245;\n granny: #9bd79b;\n panache: #e9fae7;\n brand-primary: #004b50;\n brand-secondary: #017a76;\n error: #cc0000;\n error-bg: #f5cccc;\n error-focus: #5a0000;\n warning: #ea6a2e;\n warning-bg: #fbdfd2;\n warning-focus: #b33a01;\n success: #0aa245;\n success-bg: #e9fae7;\n info: #3a7cdf;\n info-bg: #d8e5f9;\n visited: #00425d;\n green-hover: #107c3a;\n green-active: #094a22;\n green-btn: #0aa245;\n txt-link: #0096cc;\n primary-hover-btn: #005678;\n selection: #c7e9f3;\n heading-color: #017a76;\n heading-color--secondary: #2a292c;\n base-type-color: #2a292c;\n input-text: #2a292c;\n input-placeholder: #6b6966;\n input-placeholder-when-disabled: #989189;\n base-icon-color: #007198;\n disabled-color: #989189;\n disabled-color-dark: #6b6966;\n linz-color-primary: #023d48;\n linz-color-primary-hover: #01818a;\n linz-color-tertiary: #e1e44a;\n linz-color-tertiary-hover: #cdcf59;\n color-test-pink: #f09;\n linz-linear-gradient-blue: linear-gradient(70deg, #00425d 12%, #007198 100%);\n linz-linear-gradient-teal: linear-gradient(270deg, #00a599 1%, #73cdc8 100%);\n}";
24940
- styleInject(css_248z$4);
24939
+ var css_248z$7 = ":export {\n charcoal: #2a292c;\n fuscous: #6b6966;\n gray: #989189;\n silver: #beb9b4;\n lily: #eaeaea;\n hint: #f9f9f9;\n snow: #ffffff;\n white: #ffffff;\n teal: #00425d;\n sea: #007198;\n electric: #0096cc;\n spray: #73c8e1;\n polar: #e2f3f7;\n sherpa: #004b50;\n surfie: #017a76;\n persian: #00a599;\n downy: #73cdc8;\n iceberg: #dcf5f0;\n sacramento: #004e32;\n salem: #08814d;\n pigment: #0aa245;\n granny: #9bd79b;\n panache: #e9fae7;\n brand-primary: #004b50;\n brand-secondary: #017a76;\n error: #cc0000;\n error-bg: #f5cccc;\n error-focus: #5a0000;\n warning: #ea6a2e;\n warning-bg: #fbdfd2;\n warning-focus: #b33a01;\n success: #0aa245;\n success-bg: #e9fae7;\n info: #3a7cdf;\n info-bg: #d8e5f9;\n visited: #00425d;\n green-hover: #107c3a;\n green-active: #094a22;\n green-btn: #0aa245;\n txt-link: #0096cc;\n primary-hover-btn: #005678;\n selection: #c7e9f3;\n heading-color: #017a76;\n heading-color--secondary: #2a292c;\n base-type-color: #2a292c;\n input-text: #2a292c;\n input-placeholder: #6b6966;\n input-placeholder-when-disabled: #989189;\n base-icon-color: #007198;\n disabled-color: #989189;\n disabled-color-dark: #6b6966;\n linz-color-primary: #023d48;\n linz-color-primary-hover: #01818a;\n linz-color-tertiary: #e1e44a;\n linz-color-tertiary-hover: #cdcf59;\n color-test-pink: #f09;\n linz-linear-gradient-blue: linear-gradient(70deg, #00425d 12%, #007198 100%);\n linz-linear-gradient-teal: linear-gradient(270deg, #00a599 1%, #73cdc8 100%);\n}";
24940
+ styleInject(css_248z$7);
24941
24941
 
24942
24942
  var _excluded = ["allowCreateWhileLoading", "createOptionPosition", "formatCreateLabel", "isValidNewOption", "getNewOptionData", "onCreateOption", "options", "onChange"];
24943
24943
 
@@ -25067,22 +25067,22 @@ function LuiComboSelectActual(givenProps, ref) {
25067
25067
  ...theme,
25068
25068
  colors: {
25069
25069
  ...theme.colors,
25070
- primary: css_248z$4['sea'],
25071
- primary75: css_248z$4['electric'],
25072
- primary50: css_248z$4['spray'],
25073
- primary25: css_248z$4['polar'],
25074
- neutral90: css_248z$4['charcoal'],
25075
- neutral80: css_248z$4['charcoal'],
25076
- neutral70: css_248z$4['charcoal'],
25077
- neutral60: css_248z$4['fuscous'],
25078
- neutral50: css_248z$4['fuscous'],
25079
- neutral40: css_248z$4['gray'],
25080
- neutral30: css_248z$4['gray'],
25081
- neutral20: css_248z$4['silver'],
25082
- neutral10: css_248z$4['lily'],
25083
- neutral5: css_248z$4['hint'],
25084
- danger: css_248z$4['error'],
25085
- dangerLight: css_248z$4['error-bg'],
25070
+ primary: css_248z$7['sea'],
25071
+ primary75: css_248z$7['electric'],
25072
+ primary50: css_248z$7['spray'],
25073
+ primary25: css_248z$7['polar'],
25074
+ neutral90: css_248z$7['charcoal'],
25075
+ neutral80: css_248z$7['charcoal'],
25076
+ neutral70: css_248z$7['charcoal'],
25077
+ neutral60: css_248z$7['fuscous'],
25078
+ neutral50: css_248z$7['fuscous'],
25079
+ neutral40: css_248z$7['gray'],
25080
+ neutral30: css_248z$7['gray'],
25081
+ neutral20: css_248z$7['silver'],
25082
+ neutral10: css_248z$7['lily'],
25083
+ neutral5: css_248z$7['hint'],
25084
+ danger: css_248z$7['error'],
25085
+ dangerLight: css_248z$7['error-bg'],
25086
25086
  },
25087
25087
  }),
25088
25088
  styles: {
@@ -25097,7 +25097,7 @@ function LuiComboSelectActual(givenProps, ref) {
25097
25097
  }),
25098
25098
  dropdownIndicator: (provided) => ({
25099
25099
  ...provided,
25100
- color: css_248z$4['fuscous'],
25100
+ color: css_248z$7['fuscous'],
25101
25101
  }),
25102
25102
  indicatorSeparator: (provided) => ({
25103
25103
  ...provided,
@@ -25122,12 +25122,12 @@ function LuiComboSelectActual(givenProps, ref) {
25122
25122
  /* please keep this in sync with FormVars.scss/mixin.formPlaceholder */
25123
25123
  fontWeight: 'normal',
25124
25124
  fontStyle: 'italic',
25125
- color: css_248z$4['input-placeholder'],
25125
+ color: css_248z$7['input-placeholder'],
25126
25126
  }),
25127
25127
  option: (provided, { isSelected }) => ({
25128
25128
  ...provided,
25129
- color: css_248z$4['input-text'],
25130
- backgroundColor: isSelected ? css_248z$4['selection'] : css_248z$4['white'],
25129
+ color: css_248z$7['input-text'],
25130
+ backgroundColor: isSelected ? css_248z$7['selection'] : css_248z$7['white'],
25131
25131
  }),
25132
25132
  },
25133
25133
  };
@@ -28079,8 +28079,8 @@ const LuiModalHeader = (props) => {
28079
28079
  React__default["default"].createElement("i", { className: "material-icons-round lui-modal-header-btn-size" }, "close")))))));
28080
28080
  };
28081
28081
 
28082
- var css_248z$3 = "@keyframes react-loading-skeleton {\n 100% {\n transform: translateX(100%);\n }\n}\n\n.react-loading-skeleton {\n --base-color: #ebebeb;\n --highlight-color: #f5f5f5;\n --animation-duration: 1.5s;\n --animation-direction: normal;\n --pseudo-element-display: block; /* Enable animation */\n\n background-color: var(--base-color);\n\n width: 100%;\n border-radius: 0.25rem;\n display: inline-flex;\n line-height: 1;\n\n position: relative;\n overflow: hidden;\n z-index: 1; /* Necessary for overflow: hidden to work correctly in Safari */\n}\n\n.react-loading-skeleton::after {\n content: ' ';\n display: var(--pseudo-element-display);\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background-repeat: no-repeat;\n background-image: linear-gradient(\n 90deg,\n var(--base-color),\n var(--highlight-color),\n var(--base-color)\n );\n transform: translateX(-100%);\n\n animation-name: react-loading-skeleton;\n animation-direction: var(--animation-direction);\n animation-duration: var(--animation-duration);\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n}\n";
28083
- styleInject(css_248z$3);
28082
+ var css_248z$6 = "@keyframes react-loading-skeleton {\n 100% {\n transform: translateX(100%);\n }\n}\n\n.react-loading-skeleton {\n --base-color: #ebebeb;\n --highlight-color: #f5f5f5;\n --animation-duration: 1.5s;\n --animation-direction: normal;\n --pseudo-element-display: block; /* Enable animation */\n\n background-color: var(--base-color);\n\n width: 100%;\n border-radius: 0.25rem;\n display: inline-flex;\n line-height: 1;\n\n position: relative;\n overflow: hidden;\n z-index: 1; /* Necessary for overflow: hidden to work correctly in Safari */\n}\n\n.react-loading-skeleton::after {\n content: ' ';\n display: var(--pseudo-element-display);\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background-repeat: no-repeat;\n background-image: linear-gradient(\n 90deg,\n var(--base-color),\n var(--highlight-color),\n var(--base-color)\n );\n transform: translateX(-100%);\n\n animation-name: react-loading-skeleton;\n animation-direction: var(--animation-direction);\n animation-duration: var(--animation-duration);\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n}\n";
28083
+ styleInject(css_248z$6);
28084
28084
 
28085
28085
  /**
28086
28086
  * @internal
@@ -32572,11 +32572,11 @@ tippy.setDefaultProps({
32572
32572
  render: render
32573
32573
  });
32574
32574
 
32575
- var css_248z$2 = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
32576
- styleInject(css_248z$2);
32575
+ var css_248z$5 = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
32576
+ styleInject(css_248z$5);
32577
32577
 
32578
- var css_248z$1 = ".tippy-box{border:1px transparent}.tippy-box[data-placement^=top]>.tippy-arrow:after{border-top-color:inherit;border-width:8px 8px 0;bottom:-8px;left:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:after{border-bottom-color:inherit;border-width:0 8px 8px;top:-8px;left:0}.tippy-box[data-placement^=left]>.tippy-arrow:after{border-left-color:inherit;border-width:8px 0 8px 8px;right:-8px;top:0}.tippy-box[data-placement^=right]>.tippy-arrow:after{border-width:8px 8px 8px 0;left:-8px;top:0;border-right-color:inherit}.tippy-box[data-placement^=top]>.tippy-svg-arrow>svg:first-child:not(:last-child){top:17px}.tippy-box[data-placement^=bottom]>.tippy-svg-arrow>svg:first-child:not(:last-child){bottom:17px}.tippy-box[data-placement^=left]>.tippy-svg-arrow>svg:first-child:not(:last-child){left:12px}.tippy-box[data-placement^=right]>.tippy-svg-arrow>svg:first-child:not(:last-child){right:12px}.tippy-arrow{border-color:inherit}.tippy-arrow:after{content:\"\";z-index:-1;position:absolute;border-color:transparent;border-style:solid}";
32579
- styleInject(css_248z$1);
32578
+ var css_248z$4 = ".tippy-box{border:1px transparent}.tippy-box[data-placement^=top]>.tippy-arrow:after{border-top-color:inherit;border-width:8px 8px 0;bottom:-8px;left:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:after{border-bottom-color:inherit;border-width:0 8px 8px;top:-8px;left:0}.tippy-box[data-placement^=left]>.tippy-arrow:after{border-left-color:inherit;border-width:8px 0 8px 8px;right:-8px;top:0}.tippy-box[data-placement^=right]>.tippy-arrow:after{border-width:8px 8px 8px 0;left:-8px;top:0;border-right-color:inherit}.tippy-box[data-placement^=top]>.tippy-svg-arrow>svg:first-child:not(:last-child){top:17px}.tippy-box[data-placement^=bottom]>.tippy-svg-arrow>svg:first-child:not(:last-child){bottom:17px}.tippy-box[data-placement^=left]>.tippy-svg-arrow>svg:first-child:not(:last-child){left:12px}.tippy-box[data-placement^=right]>.tippy-svg-arrow>svg:first-child:not(:last-child){right:12px}.tippy-arrow{border-color:inherit}.tippy-arrow:after{content:\"\";z-index:-1;position:absolute;border-color:transparent;border-style:solid}";
32579
+ styleInject(css_248z$4);
32580
32580
 
32581
32581
  let id = 0;
32582
32582
  const getKey = () => id++;
@@ -32680,8 +32680,8 @@ const LuiSidePanelProvider = ({ children }) => {
32680
32680
  React__default["default"].createElement(LuiSidePanelContainer, { ...props })));
32681
32681
  };
32682
32682
 
32683
- var css_248z = ".lui-switch-checkbox {\n height: 0;\n width: 0;\n visibility: hidden;\n}\n\n.lui-switch-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n width: 40px;\n height: 20px;\n background: grey;\n border-radius: 40px;\n position: relative;\n transition: background-color 0.2s;\n}\n\n.lui-switch-label .lui-switch-button {\n content: \"\";\n position: absolute;\n top: 2px;\n left: 2px;\n width: 18px;\n height: 16px;\n border-radius: 18px;\n transition: 0.2s;\n background: #fff;\n box-shadow: 0 0 2px 0 rgba(10, 10, 10, 0.29);\n}\n\n.lui-switch-checkbox:checked + .lui-switch-label .lui-switch-button {\n left: calc(100% - 2px);\n transform: translateX(-100%);\n}\n\n.lui-switch-label:active .lui-switch-button {\n width: 20px;\n}";
32684
- styleInject(css_248z);
32683
+ var css_248z$3 = ".lui-switch-checkbox {\n height: 0;\n width: 0;\n visibility: hidden;\n}\n\n.lui-switch-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n width: 40px;\n height: 20px;\n background: grey;\n border-radius: 40px;\n position: relative;\n transition: background-color 0.2s;\n}\n\n.lui-switch-label .lui-switch-button {\n content: \"\";\n position: absolute;\n top: 2px;\n left: 2px;\n width: 18px;\n height: 16px;\n border-radius: 18px;\n transition: 0.2s;\n background: #fff;\n box-shadow: 0 0 2px 0 rgba(10, 10, 10, 0.29);\n}\n\n.lui-switch-checkbox:checked + .lui-switch-label .lui-switch-button {\n left: calc(100% - 2px);\n transform: translateX(-100%);\n}\n\n.lui-switch-label:active .lui-switch-button {\n width: 20px;\n}";
32684
+ styleInject(css_248z$3);
32685
32685
 
32686
32686
  const LuiSwitchButton = (props) => {
32687
32687
  const generatedId = useGenerateOrDefaultId();
@@ -40393,6 +40393,3430 @@ const LuiAccordicardStatic = (props) => {
40393
40393
  React__default["default"].createElement(LuiIcon, { className: clsx('LuiAccordicardStatic-chevron', isOpen ? 'LuiAccordicardStatic-chevron--isOpen' : null), name: 'ic_expand_more', alt: "expand", title: "Expand and collapse panel", size: "md" }))));
40394
40394
  };
40395
40395
 
40396
+ var css_248z$2 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.LuiListBox {\n padding: 0;\n list-style: none;\n}\n.LuiListBox .LuiListBoxItem {\n font-family: \"Open Sans\", system-ui, sans-serif;\n font-style: normal;\n font-weight: normal;\n user-select: none;\n color: #2a292c;\n line-height: 24px;\n outline: none;\n padding: 0.5rem 0.75rem;\n border: 2px solid transparent;\n}\n.LuiListBox .LuiListBoxItem:focus-visible {\n border-color: #007198;\n}\n.LuiListBox .LuiListBoxItem.LuiListBoxItem-selected {\n background: #e2f3f7;\n}\n.LuiListBox .LuiListBoxItem:hover, .LuiListBox .LuiListBoxItem.LuiListBoxItem-selected:hover {\n background: #d6eef4;\n}\n.LuiListBox .LuiListBoxItem.LuiListBoxItem-disabled {\n background: #eaeaea;\n}\n.LuiListBox .LuiListBox-emptyIndicator, .LuiListBox .LuiListBox-loadingIndicator {\n padding: 0.5rem 0.75rem;\n}";
40397
+ styleInject(css_248z$2);
40398
+
40399
+ function $c1d7fb2ec91bae71$var$Item(props) {
40400
+ return null;
40401
+ }
40402
+ $c1d7fb2ec91bae71$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
40403
+ let { childItems: childItems , title: title , children: children } = props;
40404
+ let rendered = props.title || props.children;
40405
+ let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'] || '';
40406
+ // suppressTextValueWarning is used in components like Tabs, which don't have type to select support.
40407
+ if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning)) console.warn('<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.');
40408
+ yield {
40409
+ type: 'item',
40410
+ props: props,
40411
+ rendered: rendered,
40412
+ textValue: textValue,
40413
+ 'aria-label': props['aria-label'],
40414
+ hasChildNodes: $c1d7fb2ec91bae71$var$hasChildItems(props),
40415
+ *childNodes () {
40416
+ if (childItems) for (let child1 of childItems)yield {
40417
+ type: 'item',
40418
+ value: child1
40419
+ };
40420
+ else if (title) {
40421
+ let items = [];
40422
+ React__default["default"].Children.forEach(children, (child)=>{
40423
+ items.push({
40424
+ type: 'item',
40425
+ element: child
40426
+ });
40427
+ });
40428
+ yield* items;
40429
+ }
40430
+ }
40431
+ };
40432
+ };
40433
+ function $c1d7fb2ec91bae71$var$hasChildItems(props) {
40434
+ if (props.hasChildItems != null) return props.hasChildItems;
40435
+ if (props.childItems) return true;
40436
+ if (props.title && React__default["default"].Children.count(props.children) > 0) return true;
40437
+ return false;
40438
+ }
40439
+ // We don't want getCollectionNode to show up in the type definition
40440
+ let $c1d7fb2ec91bae71$export$6d08773d2e66f8f2 = $c1d7fb2ec91bae71$var$Item;
40441
+
40442
+
40443
+
40444
+ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
40445
+ build(props, context) {
40446
+ this.context = context;
40447
+ return $eb2240fc39a57fa5$var$iterable(()=>this.iterateCollection(props)
40448
+ );
40449
+ }
40450
+ *iterateCollection(props) {
40451
+ let { children: children , items: items } = props;
40452
+ if (typeof children === 'function') {
40453
+ if (!items) throw new Error('props.children was a function but props.items is missing');
40454
+ for (let item of props.items)yield* this.getFullNode({
40455
+ value: item
40456
+ }, {
40457
+ renderer: children
40458
+ });
40459
+ } else {
40460
+ let items = [];
40461
+ React__default["default"].Children.forEach(children, (child)=>{
40462
+ items.push(child);
40463
+ });
40464
+ let index = 0;
40465
+ for (let item of items){
40466
+ let nodes = this.getFullNode({
40467
+ element: item,
40468
+ index: index
40469
+ }, {
40470
+ });
40471
+ for (let node of nodes){
40472
+ index++;
40473
+ yield node;
40474
+ }
40475
+ }
40476
+ }
40477
+ }
40478
+ getKey(item, partialNode, state, parentKey) {
40479
+ if (item.key != null) return item.key;
40480
+ if (partialNode.type === 'cell' && partialNode.key != null) return `${parentKey}${partialNode.key}`;
40481
+ let v = partialNode.value;
40482
+ if (v != null) {
40483
+ var _key;
40484
+ let key = (_key = v.key) !== null && _key !== void 0 ? _key : v.id;
40485
+ if (key == null) throw new Error('No key found for item');
40486
+ return key;
40487
+ }
40488
+ return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
40489
+ }
40490
+ getChildState(state, partialNode) {
40491
+ return {
40492
+ renderer: partialNode.renderer || state.renderer
40493
+ };
40494
+ }
40495
+ *getFullNode(partialNode, state, parentKey, parentNode) {
40496
+ // If there's a value instead of an element on the node, and a parent renderer function is available,
40497
+ // use it to render an element for the value.
40498
+ let element = partialNode.element;
40499
+ if (!element && partialNode.value && state && state.renderer) {
40500
+ let cached = this.cache.get(partialNode.value);
40501
+ if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
40502
+ cached.index = partialNode.index;
40503
+ cached.parentKey = parentNode ? parentNode.key : null;
40504
+ yield cached;
40505
+ return;
40506
+ }
40507
+ element = state.renderer(partialNode.value);
40508
+ }
40509
+ // If there's an element with a getCollectionNode function on its type, then it's a supported component.
40510
+ // Call this function to get a partial node, and recursively build a full node from there.
40511
+ if (React__default["default"].isValidElement(element)) {
40512
+ let type = element.type;
40513
+ if (typeof type !== 'function' && typeof type.getCollectionNode !== 'function') {
40514
+ let name = typeof element.type === 'function' ? element.type.name : element.type;
40515
+ throw new Error(`Unknown element <${name}> in collection.`);
40516
+ }
40517
+ let childNodes = type.getCollectionNode(element.props, this.context);
40518
+ let index = partialNode.index;
40519
+ let result = childNodes.next();
40520
+ while(!result.done && result.value){
40521
+ let childNode = result.value;
40522
+ partialNode.index = index;
40523
+ let nodeKey = childNode.key;
40524
+ if (!nodeKey) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
40525
+ let nodes = this.getFullNode({
40526
+ ...childNode,
40527
+ key: nodeKey,
40528
+ index: index,
40529
+ wrapper: $eb2240fc39a57fa5$var$compose(partialNode.wrapper, childNode.wrapper)
40530
+ }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
40531
+ let children = [
40532
+ ...nodes
40533
+ ];
40534
+ for (let node of children){
40535
+ // Cache the node based on its value
40536
+ node.value = childNode.value || partialNode.value;
40537
+ if (node.value) this.cache.set(node.value, node);
40538
+ // The partial node may have specified a type for the child in order to specify a constraint.
40539
+ // Verify that the full node that was built recursively matches this type.
40540
+ if (partialNode.type && node.type !== partialNode.type) throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node.type)}> in <${$eb2240fc39a57fa5$var$capitalize(parentNode.type)}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
40541
+ index++;
40542
+ yield node;
40543
+ }
40544
+ result = childNodes.next(children);
40545
+ }
40546
+ return;
40547
+ }
40548
+ // Ignore invalid elements
40549
+ if (partialNode.key == null) return;
40550
+ // Create full node
40551
+ let builder = this;
40552
+ let node = {
40553
+ type: partialNode.type,
40554
+ props: partialNode.props,
40555
+ key: partialNode.key,
40556
+ parentKey: parentNode ? parentNode.key : null,
40557
+ value: partialNode.value,
40558
+ level: parentNode ? parentNode.level + 1 : 0,
40559
+ index: partialNode.index,
40560
+ rendered: partialNode.rendered,
40561
+ textValue: partialNode.textValue,
40562
+ 'aria-label': partialNode['aria-label'],
40563
+ wrapper: partialNode.wrapper,
40564
+ shouldInvalidate: partialNode.shouldInvalidate,
40565
+ hasChildNodes: partialNode.hasChildNodes,
40566
+ childNodes: $eb2240fc39a57fa5$var$iterable(function*() {
40567
+ if (!partialNode.hasChildNodes) return;
40568
+ let index = 0;
40569
+ for (let child of partialNode.childNodes()){
40570
+ // Ensure child keys are globally unique by prepending the parent node's key
40571
+ if (child.key != null) // TODO: Remove this line entirely and enforce that users always provide unique keys.
40572
+ // Currently this line will have issues when a parent has a key `a` and a child with key `bc`
40573
+ // but another parent has key `ab` and its child has a key `c`. The combined keys would result in both
40574
+ // children having a key of `abc`.
40575
+ child.key = `${node.key}${child.key}`;
40576
+ child.index = index;
40577
+ let nodes = builder.getFullNode(child, builder.getChildState(state, child), node.key, node);
40578
+ for (let node1 of nodes){
40579
+ index++;
40580
+ yield node1;
40581
+ }
40582
+ }
40583
+ })
40584
+ };
40585
+ yield node;
40586
+ }
40587
+ constructor(){
40588
+ this.cache = new WeakMap();
40589
+ }
40590
+ }
40591
+ // Wraps an iterator function as an iterable object, and caches the results.
40592
+ function $eb2240fc39a57fa5$var$iterable(iterator) {
40593
+ let cache = [];
40594
+ let iterable = null;
40595
+ return {
40596
+ *[Symbol.iterator] () {
40597
+ for (let item of cache)yield item;
40598
+ if (!iterable) iterable = iterator();
40599
+ for (let item1 of iterable){
40600
+ cache.push(item1);
40601
+ yield item1;
40602
+ }
40603
+ }
40604
+ };
40605
+ }
40606
+ function $eb2240fc39a57fa5$var$compose(outer, inner) {
40607
+ if (outer && inner) return (element)=>outer(inner(element))
40608
+ ;
40609
+ if (outer) return outer;
40610
+ if (inner) return inner;
40611
+ }
40612
+ function $eb2240fc39a57fa5$var$capitalize(str) {
40613
+ return str[0].toUpperCase() + str.slice(1);
40614
+ }
40615
+
40616
+
40617
+
40618
+ function $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context, invalidators = []) {
40619
+ let builder = React.useMemo(()=>new $eb2240fc39a57fa5$export$bf788dd355e3a401()
40620
+ , []);
40621
+ let prev = React.useRef(null);
40622
+ return React.useMemo(()=>{
40623
+ let nodes = builder.build(props, context);
40624
+ prev.current = factory(nodes, prev.current);
40625
+ return prev.current;
40626
+ // Don't invalidate when any prop changes, just the two we care about.
40627
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40628
+ }, [
40629
+ builder,
40630
+ props.children,
40631
+ props.items,
40632
+ context,
40633
+ ...invalidators
40634
+ ]);
40635
+ }
40636
+
40637
+
40638
+ const $453cc9f0df89c0a5$var$cache = new WeakMap();
40639
+ function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
40640
+ let count = $453cc9f0df89c0a5$var$cache.get(collection);
40641
+ if (count != null) return count;
40642
+ count = 0;
40643
+ for (let item of collection)if (item.type === 'section') count += $453cc9f0df89c0a5$export$77d5aafae4e095b2(item.childNodes);
40644
+ else count++;
40645
+ $453cc9f0df89c0a5$var$cache.set(collection, count);
40646
+ return count;
40647
+ }
40648
+
40649
+ function mapToAriaListBoxProps({ selectionMode, selectionBehavior, items = [], value, onChange, ariaProps, getKey = (item) => {
40650
+ if (!item.hasOwnProperty('key')) {
40651
+ throw Error('Could not find `key` property on item, please provide a custom `getKey` function');
40652
+ }
40653
+ return item.key;
40654
+ }, }) {
40655
+ return {
40656
+ ...ariaProps,
40657
+ items: items?.map((item) => {
40658
+ if (item.hasOwnProperty('key')) {
40659
+ return item;
40660
+ }
40661
+ return { ...item, key: getKey(item) };
40662
+ }),
40663
+ selectionMode,
40664
+ selectionBehavior,
40665
+ selectedKeys: (Array.isArray(value) ? value : [value]).filter(Boolean),
40666
+ children: (item) => React__default["default"].createElement($c1d7fb2ec91bae71$export$6d08773d2e66f8f2, null, String(item.key)),
40667
+ ...(onChange
40668
+ ? {
40669
+ onSelectionChange: (keys) => {
40670
+ const selectedItems = keys === 'all'
40671
+ ? items
40672
+ : items.filter((item) => keys.has(getKey(item)));
40673
+ const selectedKeys = keys === 'all'
40674
+ ? items.map((item) => getKey(item))
40675
+ : Array.from(keys);
40676
+ onChange(selectedKeys, selectedItems);
40677
+ },
40678
+ }
40679
+ : {}),
40680
+ };
40681
+ }
40682
+
40683
+ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value1, defaultValue, onChange) {
40684
+ let [stateValue, setStateValue] = React.useState(value1 || defaultValue);
40685
+ let ref = React.useRef(value1 !== undefined);
40686
+ let wasControlled = ref.current;
40687
+ let isControlled = value1 !== undefined;
40688
+ // Internal state reference for useCallback
40689
+ let stateRef = React.useRef(stateValue);
40690
+ if (wasControlled !== isControlled) console.warn(`WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`);
40691
+ ref.current = isControlled;
40692
+ let setValue = React.useCallback((value2, ...args)=>{
40693
+ let onChangeCaller = (value, ...onChangeArgs)=>{
40694
+ if (onChange) {
40695
+ if (!Object.is(stateRef.current, value)) onChange(value, ...onChangeArgs);
40696
+ }
40697
+ if (!isControlled) stateRef.current = value;
40698
+ };
40699
+ if (typeof value2 === 'function') {
40700
+ console.warn('We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320');
40701
+ // this supports functional updates https://reactjs.org/docs/hooks-reference.html#functional-updates
40702
+ // when someone using useControlledState calls setControlledState(myFunc)
40703
+ // this will call our useState setState with a function as well which invokes myFunc and calls onChange with the value from myFunc
40704
+ // if we're in an uncontrolled state, then we also return the value of myFunc which to setState looks as though it was just called with myFunc from the beginning
40705
+ // otherwise we just return the controlled value, which won't cause a rerender because React knows to bail out when the value is the same
40706
+ let updateFunction = (oldValue, ...functionArgs)=>{
40707
+ let interceptedValue = value2(isControlled ? stateRef.current : oldValue, ...functionArgs);
40708
+ onChangeCaller(interceptedValue, ...args);
40709
+ if (!isControlled) return interceptedValue;
40710
+ return oldValue;
40711
+ };
40712
+ setStateValue(updateFunction);
40713
+ } else {
40714
+ if (!isControlled) setStateValue(value2);
40715
+ onChangeCaller(value2, ...args);
40716
+ }
40717
+ }, [
40718
+ isControlled,
40719
+ onChange
40720
+ ]);
40721
+ // If a controlled component's value prop changes, we need to update stateRef
40722
+ if (isControlled) stateRef.current = value1;
40723
+ else value1 = stateValue;
40724
+ return [
40725
+ value1,
40726
+ setValue
40727
+ ];
40728
+ }
40729
+
40730
+ // Default context value to use in case there is no SSRProvider. This is fine for
40731
+ // client-only apps. In order to support multiple copies of React Aria potentially
40732
+ // being on the page at once, the prefix is set to a random number. SSRProvider
40733
+ // will reset this to zero for consistency between server and client, so in the
40734
+ // SSR case multiple copies of React Aria is not supported.
40735
+ const $704cf1d3b684cc5c$var$defaultContext = {
40736
+ prefix: String(Math.round(Math.random() * 10000000000)),
40737
+ current: 0
40738
+ };
40739
+ const $704cf1d3b684cc5c$var$SSRContext = /*#__PURE__*/ React__default["default"].createContext($704cf1d3b684cc5c$var$defaultContext);
40740
+ let $704cf1d3b684cc5c$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
40741
+ function $704cf1d3b684cc5c$export$619500959fc48b26(defaultId) {
40742
+ let ctx = React.useContext($704cf1d3b684cc5c$var$SSRContext);
40743
+ // If we are rendering in a non-DOM environment, and there's no SSRProvider,
40744
+ // provide a warning to hint to the developer to add one.
40745
+ if (ctx === $704cf1d3b684cc5c$var$defaultContext && !$704cf1d3b684cc5c$var$canUseDOM) console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
40746
+ return React.useMemo(()=>defaultId || `react-aria${ctx.prefix}-${++ctx.current}`
40747
+ , [
40748
+ defaultId
40749
+ ]);
40750
+ }
40751
+ function $704cf1d3b684cc5c$export$535bd6ca7f90a273() {
40752
+ let cur = React.useContext($704cf1d3b684cc5c$var$SSRContext);
40753
+ let isInSSRContext = cur !== $704cf1d3b684cc5c$var$defaultContext;
40754
+ let [isSSR, setIsSSR] = React.useState(isInSSRContext);
40755
+ // If on the client, and the component was initially server rendered,
40756
+ // then schedule a layout effect to update the component after hydration.
40757
+ if (typeof window !== 'undefined' && isInSSRContext) // This if statement technically breaks the rules of hooks, but is safe
40758
+ // because the condition never changes after mounting.
40759
+ // eslint-disable-next-line react-hooks/rules-of-hooks
40760
+ React.useLayoutEffect(()=>{
40761
+ setIsSSR(false);
40762
+ }, []);
40763
+ return isSSR;
40764
+ }
40765
+
40766
+ const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof window !== 'undefined' ? React__default["default"].useLayoutEffect : ()=>{
40767
+ };
40768
+
40769
+
40770
+
40771
+
40772
+ let $bdb11010cef70236$var$idsUpdaterMap = new Map();
40773
+ function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
40774
+ let [value, setValue] = React.useState(defaultId);
40775
+ let nextId = React.useRef(null);
40776
+ let res = $704cf1d3b684cc5c$export$619500959fc48b26(value);
40777
+ let updateValue = React.useCallback((val)=>{
40778
+ nextId.current = val;
40779
+ }, []);
40780
+ $bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
40781
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
40782
+ let r = res;
40783
+ return ()=>{
40784
+ $bdb11010cef70236$var$idsUpdaterMap.delete(r);
40785
+ };
40786
+ }, [
40787
+ res
40788
+ ]);
40789
+ // This cannot cause an infinite loop because the ref is updated first.
40790
+ // eslint-disable-next-line
40791
+ React.useEffect(()=>{
40792
+ let newId = nextId.current;
40793
+ if (newId) {
40794
+ nextId.current = null;
40795
+ setValue(newId);
40796
+ }
40797
+ });
40798
+ return res;
40799
+ }
40800
+ function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
40801
+ if (idA === idB) return idA;
40802
+ let setIdA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
40803
+ if (setIdA) {
40804
+ setIdA(idB);
40805
+ return idB;
40806
+ }
40807
+ let setIdB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
40808
+ if (setIdB) {
40809
+ setIdB(idA);
40810
+ return idA;
40811
+ }
40812
+ return idB;
40813
+ }
40814
+ function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
40815
+ let id = $bdb11010cef70236$export$f680877a34711e37();
40816
+ let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25(id);
40817
+ let updateId = React.useCallback(()=>{
40818
+ setResolvedId(function*() {
40819
+ yield id;
40820
+ yield document.getElementById(id) ? id : null;
40821
+ });
40822
+ }, [
40823
+ id,
40824
+ setResolvedId
40825
+ ]);
40826
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(updateId, [
40827
+ id,
40828
+ updateId,
40829
+ ...depArray
40830
+ ]);
40831
+ return resolvedId;
40832
+ }
40833
+
40834
+
40835
+ function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
40836
+ return (...args)=>{
40837
+ for (let callback of callbacks)if (typeof callback === 'function') callback(...args);
40838
+ };
40839
+ }
40840
+
40841
+
40842
+
40843
+
40844
+
40845
+ function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
40846
+ // Start with a base clone of the first argument. This is a lot faster than starting
40847
+ // with an empty object and adding properties as we go.
40848
+ let result = {
40849
+ ...args[0]
40850
+ };
40851
+ for(let i = 1; i < args.length; i++){
40852
+ let props = args[i];
40853
+ for(let key in props){
40854
+ let a = result[key];
40855
+ let b = props[key];
40856
+ // Chain events
40857
+ if (typeof a === 'function' && typeof b === 'function' && // This is a lot faster than a regex.
40858
+ key[0] === 'o' && key[1] === 'n' && key.charCodeAt(2) >= /* 'A' */ 65 && key.charCodeAt(2) <= /* 'Z' */ 90) result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e(a, b);
40859
+ else if ((key === 'className' || key === 'UNSAFE_className') && typeof a === 'string' && typeof b === 'string') result[key] = clsx(a, b);
40860
+ else if (key === 'id' && a && b) result.id = $bdb11010cef70236$export$cd8c9cb68f842629(a, b);
40861
+ else result[key] = b !== undefined ? b : a;
40862
+ }
40863
+ }
40864
+ return result;
40865
+ }
40866
+
40867
+
40868
+ const $65484d02dcb7eb3e$var$DOMPropNames = new Set([
40869
+ 'id'
40870
+ ]);
40871
+ const $65484d02dcb7eb3e$var$labelablePropNames = new Set([
40872
+ 'aria-label',
40873
+ 'aria-labelledby',
40874
+ 'aria-describedby',
40875
+ 'aria-details'
40876
+ ]);
40877
+ const $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
40878
+ function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {
40879
+ }) {
40880
+ let { labelable: labelable , propNames: propNames } = opts;
40881
+ let filteredProps = {
40882
+ };
40883
+ for(const prop in props)if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop))) filteredProps[prop] = props[prop];
40884
+ return filteredProps;
40885
+ }
40886
+
40887
+
40888
+ function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
40889
+ if ($7215afc6de606d6b$var$supportsPreventScroll()) element.focus({
40890
+ preventScroll: true
40891
+ });
40892
+ else {
40893
+ let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element);
40894
+ element.focus();
40895
+ $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
40896
+ }
40897
+ }
40898
+ let $7215afc6de606d6b$var$supportsPreventScrollCached = null;
40899
+ function $7215afc6de606d6b$var$supportsPreventScroll() {
40900
+ if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
40901
+ $7215afc6de606d6b$var$supportsPreventScrollCached = false;
40902
+ try {
40903
+ var focusElem = document.createElement('div');
40904
+ focusElem.focus({
40905
+ get preventScroll () {
40906
+ $7215afc6de606d6b$var$supportsPreventScrollCached = true;
40907
+ return true;
40908
+ }
40909
+ });
40910
+ } catch (e) {
40911
+ // Ignore
40912
+ }
40913
+ }
40914
+ return $7215afc6de606d6b$var$supportsPreventScrollCached;
40915
+ }
40916
+ function $7215afc6de606d6b$var$getScrollableElements(element) {
40917
+ var parent = element.parentNode;
40918
+ var scrollableElements = [];
40919
+ var rootScrollingElement = document.scrollingElement || document.documentElement;
40920
+ while(parent instanceof HTMLElement && parent !== rootScrollingElement){
40921
+ if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) scrollableElements.push({
40922
+ element: parent,
40923
+ scrollTop: parent.scrollTop,
40924
+ scrollLeft: parent.scrollLeft
40925
+ });
40926
+ parent = parent.parentNode;
40927
+ }
40928
+ if (rootScrollingElement instanceof HTMLElement) scrollableElements.push({
40929
+ element: rootScrollingElement,
40930
+ scrollTop: rootScrollingElement.scrollTop,
40931
+ scrollLeft: rootScrollingElement.scrollLeft
40932
+ });
40933
+ return scrollableElements;
40934
+ }
40935
+ function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
40936
+ for (let { element: element , scrollTop: scrollTop , scrollLeft: scrollLeft } of scrollableElements){
40937
+ element.scrollTop = scrollTop;
40938
+ element.scrollLeft = scrollLeft;
40939
+ }
40940
+ }
40941
+
40942
+
40943
+ /*
40944
+ * Copyright 2020 Adobe. All rights reserved.
40945
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
40946
+ * you may not use this file except in compliance with the License. You may obtain a copy
40947
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
40948
+ *
40949
+ * Unless required by applicable law or agreed to in writing, software distributed under
40950
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
40951
+ * OF ANY KIND, either express or implied. See the License for the specific language
40952
+ * governing permissions and limitations under the License.
40953
+ */ // We store a global list of elements that are currently transitioning,
40954
+ // mapped to a set of CSS properties that are transitioning for that element.
40955
+ // This is necessary rather than a simple count of transitions because of browser
40956
+ // bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
40957
+ // than one or the other. So we need to track what's actually transitioning so that
40958
+ // we can ignore these duplicate events.
40959
+ let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
40960
+ // A list of callbacks to call once there are no transitioning elements.
40961
+ let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
40962
+ function $bbed8b41f857bcc0$var$setupGlobalEvents() {
40963
+ if (typeof window === 'undefined') return;
40964
+ let onTransitionStart = (e)=>{
40965
+ // Add the transitioning property to the list for this element.
40966
+ let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
40967
+ if (!transitions) {
40968
+ transitions = new Set();
40969
+ $bbed8b41f857bcc0$var$transitionsByElement.set(e.target, transitions);
40970
+ // The transitioncancel event must be registered on the element itself, rather than as a global
40971
+ // event. This enables us to handle when the node is deleted from the document while it is transitioning.
40972
+ // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
40973
+ e.target.addEventListener('transitioncancel', onTransitionEnd);
40974
+ }
40975
+ transitions.add(e.propertyName);
40976
+ };
40977
+ let onTransitionEnd = (e)=>{
40978
+ // Remove property from list of transitioning properties.
40979
+ let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
40980
+ if (!properties) return;
40981
+ properties.delete(e.propertyName);
40982
+ // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
40983
+ if (properties.size === 0) {
40984
+ e.target.removeEventListener('transitioncancel', onTransitionEnd);
40985
+ $bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
40986
+ }
40987
+ // If no transitioning elements, call all of the queued callbacks.
40988
+ if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
40989
+ for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)cb();
40990
+ $bbed8b41f857bcc0$var$transitionCallbacks.clear();
40991
+ }
40992
+ };
40993
+ document.body.addEventListener('transitionrun', onTransitionStart);
40994
+ document.body.addEventListener('transitionend', onTransitionEnd);
40995
+ }
40996
+ if (typeof document !== 'undefined') {
40997
+ if (document.readyState !== 'loading') $bbed8b41f857bcc0$var$setupGlobalEvents();
40998
+ else document.addEventListener('DOMContentLoaded', $bbed8b41f857bcc0$var$setupGlobalEvents);
40999
+ }
41000
+ function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
41001
+ // Wait one frame to see if an animation starts, e.g. a transition on mount.
41002
+ requestAnimationFrame(()=>{
41003
+ // If no transitions are running, call the function immediately.
41004
+ // Otherwise, add it to a list of callbacks to run at the end of the animation.
41005
+ if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) fn();
41006
+ else $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
41007
+ });
41008
+ }
41009
+
41010
+
41011
+
41012
+ function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
41013
+ let globalListeners = React.useRef(new Map());
41014
+ let addGlobalListener = React.useCallback((eventTarget, type, listener, options)=>{
41015
+ // Make sure we remove the listener after it is called with the `once` option.
41016
+ let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args)=>{
41017
+ globalListeners.current.delete(listener);
41018
+ listener(...args);
41019
+ } : listener;
41020
+ globalListeners.current.set(listener, {
41021
+ type: type,
41022
+ eventTarget: eventTarget,
41023
+ fn: fn,
41024
+ options: options
41025
+ });
41026
+ eventTarget.addEventListener(type, listener, options);
41027
+ }, []);
41028
+ let removeGlobalListener = React.useCallback((eventTarget, type, listener, options)=>{
41029
+ var ref;
41030
+ let fn = ((ref = globalListeners.current.get(listener)) === null || ref === void 0 ? void 0 : ref.fn) || listener;
41031
+ eventTarget.removeEventListener(type, fn, options);
41032
+ globalListeners.current.delete(listener);
41033
+ }, []);
41034
+ let removeAllGlobalListeners = React.useCallback(()=>{
41035
+ globalListeners.current.forEach((value, key)=>{
41036
+ removeGlobalListener(value.eventTarget, value.type, key, value.options);
41037
+ });
41038
+ }, [
41039
+ removeGlobalListener
41040
+ ]);
41041
+ // eslint-disable-next-line arrow-body-style
41042
+ React.useEffect(()=>{
41043
+ return removeAllGlobalListeners;
41044
+ }, [
41045
+ removeAllGlobalListeners
41046
+ ]);
41047
+ return {
41048
+ addGlobalListener: addGlobalListener,
41049
+ removeGlobalListener: removeGlobalListener,
41050
+ removeAllGlobalListeners: removeAllGlobalListeners
41051
+ };
41052
+ }
41053
+
41054
+
41055
+
41056
+ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
41057
+ let { id: id , 'aria-label': label , 'aria-labelledby': labelledBy } = props;
41058
+ // If there is both an aria-label and aria-labelledby,
41059
+ // combine them by pointing to the element itself.
41060
+ id = $bdb11010cef70236$export$f680877a34711e37(id);
41061
+ if (labelledBy && label) {
41062
+ let ids = new Set([
41063
+ ...labelledBy.trim().split(/\s+/),
41064
+ id
41065
+ ]);
41066
+ labelledBy = [
41067
+ ...ids
41068
+ ].join(' ');
41069
+ } else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(' ');
41070
+ // If no labels are provided, use the default
41071
+ if (!label && !labelledBy && defaultLabel) label = defaultLabel;
41072
+ return {
41073
+ id: id,
41074
+ 'aria-label': label,
41075
+ 'aria-labelledby': labelledBy
41076
+ };
41077
+ }
41078
+
41079
+
41080
+
41081
+ function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
41082
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
41083
+ if (context && context.ref && ref) {
41084
+ context.ref.current = ref.current;
41085
+ return ()=>{
41086
+ context.ref.current = null;
41087
+ };
41088
+ }
41089
+ }, [
41090
+ context,
41091
+ ref
41092
+ ]);
41093
+ }
41094
+
41095
+
41096
+
41097
+
41098
+ let $ef06256079686ba0$var$descriptionId = 0;
41099
+ const $ef06256079686ba0$var$descriptionNodes = new Map();
41100
+ function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
41101
+ let [id1, setId] = React.useState(null);
41102
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
41103
+ if (!description) return;
41104
+ let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
41105
+ if (!desc) {
41106
+ let id = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
41107
+ setId(id);
41108
+ let node = document.createElement('div');
41109
+ node.id = id;
41110
+ node.style.display = 'none';
41111
+ node.textContent = description;
41112
+ document.body.appendChild(node);
41113
+ desc = {
41114
+ refCount: 0,
41115
+ element: node
41116
+ };
41117
+ $ef06256079686ba0$var$descriptionNodes.set(description, desc);
41118
+ } else setId(desc.element.id);
41119
+ desc.refCount++;
41120
+ return ()=>{
41121
+ if (--desc.refCount === 0) {
41122
+ desc.element.remove();
41123
+ $ef06256079686ba0$var$descriptionNodes.delete(description);
41124
+ }
41125
+ };
41126
+ }, [
41127
+ description
41128
+ ]);
41129
+ return {
41130
+ 'aria-describedby': description ? id1 : undefined
41131
+ };
41132
+ }
41133
+
41134
+
41135
+ /*
41136
+ * Copyright 2020 Adobe. All rights reserved.
41137
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
41138
+ * you may not use this file except in compliance with the License. You may obtain a copy
41139
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
41140
+ *
41141
+ * Unless required by applicable law or agreed to in writing, software distributed under
41142
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
41143
+ * OF ANY KIND, either express or implied. See the License for the specific language
41144
+ * governing permissions and limitations under the License.
41145
+ */ function $c87311424ea30a05$var$testUserAgent(re) {
41146
+ var ref;
41147
+ if (typeof window === 'undefined' || window.navigator == null) return false;
41148
+ return ((ref = window.navigator['userAgentData']) === null || ref === void 0 ? void 0 : ref.brands.some((brand)=>re.test(brand.brand)
41149
+ )) || re.test(window.navigator.userAgent);
41150
+ }
41151
+ function $c87311424ea30a05$var$testPlatform(re) {
41152
+ var ref;
41153
+ return typeof window !== 'undefined' && window.navigator != null ? re.test(((ref = window.navigator['userAgentData']) === null || ref === void 0 ? void 0 : ref.platform) || window.navigator.platform) : false;
41154
+ }
41155
+ function $c87311424ea30a05$export$9ac100e40613ea10() {
41156
+ return $c87311424ea30a05$var$testPlatform(/^Mac/i);
41157
+ }
41158
+ function $c87311424ea30a05$export$186c6964ca17d99() {
41159
+ return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
41160
+ }
41161
+ function $c87311424ea30a05$export$7bef049ce92e4224() {
41162
+ return $c87311424ea30a05$var$testPlatform(/^iPad/i) || $c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
41163
+ }
41164
+ function $c87311424ea30a05$export$fedb369cb70207f1() {
41165
+ return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
41166
+ }
41167
+ function $c87311424ea30a05$export$e1865c3bedcd822b() {
41168
+ return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
41169
+ }
41170
+ function $c87311424ea30a05$export$78551043582a6a98() {
41171
+ return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
41172
+ }
41173
+ function $c87311424ea30a05$export$6446a186d09e379e() {
41174
+ return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
41175
+ }
41176
+
41177
+
41178
+
41179
+ function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler1, options) {
41180
+ let handlerRef = React.useRef(handler1);
41181
+ handlerRef.current = handler1;
41182
+ let isDisabled = handler1 == null;
41183
+ React.useEffect(()=>{
41184
+ if (isDisabled) return;
41185
+ let element = ref.current;
41186
+ let handler = (e)=>handlerRef.current.call(this, e)
41187
+ ;
41188
+ element.addEventListener(event, handler, options);
41189
+ return ()=>{
41190
+ element.removeEventListener(event, handler, options);
41191
+ };
41192
+ }, [
41193
+ ref,
41194
+ event,
41195
+ options,
41196
+ isDisabled
41197
+ ]);
41198
+ }
41199
+
41200
+
41201
+
41202
+
41203
+ function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
41204
+ let [value, setValue] = React.useState(defaultValue);
41205
+ let valueRef = React.useRef(value);
41206
+ let effect = React.useRef(null);
41207
+ valueRef.current = value;
41208
+ // Store the function in a ref so we can always access the current version
41209
+ // which has the proper `value` in scope.
41210
+ let nextRef = React.useRef(null);
41211
+ nextRef.current = ()=>{
41212
+ // Run the generator to the next yield.
41213
+ let newValue = effect.current.next();
41214
+ // If the generator is done, reset the effect.
41215
+ if (newValue.done) {
41216
+ effect.current = null;
41217
+ return;
41218
+ }
41219
+ // If the value is the same as the current value,
41220
+ // then continue to the next yield. Otherwise,
41221
+ // set the value in state and wait for the next layout effect.
41222
+ if (value === newValue.value) nextRef.current();
41223
+ else setValue(newValue.value);
41224
+ };
41225
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
41226
+ // If there is an effect currently running, continue to the next yield.
41227
+ if (effect.current) nextRef.current();
41228
+ });
41229
+ let queue = React.useCallback((fn)=>{
41230
+ effect.current = fn(valueRef.current);
41231
+ nextRef.current();
41232
+ }, [
41233
+ effect,
41234
+ nextRef
41235
+ ]);
41236
+ return [
41237
+ value,
41238
+ queue
41239
+ ];
41240
+ }
41241
+
41242
+
41243
+ function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
41244
+ let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'left');
41245
+ let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'top');
41246
+ let width = element.offsetWidth;
41247
+ let height = element.offsetHeight;
41248
+ let x = scrollView.scrollLeft;
41249
+ let y = scrollView.scrollTop;
41250
+ let maxX = x + scrollView.offsetWidth;
41251
+ let maxY = y + scrollView.offsetHeight;
41252
+ if (offsetX <= x) x = offsetX;
41253
+ else if (offsetX + width > maxX) x += offsetX + width - maxX;
41254
+ if (offsetY <= y) y = offsetY;
41255
+ else if (offsetY + height > maxY) y += offsetY + height - maxY;
41256
+ scrollView.scrollLeft = x;
41257
+ scrollView.scrollTop = y;
41258
+ }
41259
+ /**
41260
+ * Computes the offset left or top from child to ancestor by accumulating
41261
+ * offsetLeft or offsetTop through intervening offsetParents.
41262
+ */ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
41263
+ const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';
41264
+ let sum = 0;
41265
+ while(child.offsetParent){
41266
+ sum += child[prop];
41267
+ if (child.offsetParent === ancestor) break;
41268
+ else if (child.offsetParent.contains(ancestor)) {
41269
+ // If the ancestor is not `position:relative`, then we stop at
41270
+ // _its_ offset parent, and we subtract off _its_ offset, so that
41271
+ // we end up with the proper offset from child to ancestor.
41272
+ sum -= ancestor[prop];
41273
+ break;
41274
+ }
41275
+ child = child.offsetParent;
41276
+ }
41277
+ return sum;
41278
+ }
41279
+
41280
+ // Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
41281
+ // rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
41282
+ let $14c0b72509d70225$var$state = 'default';
41283
+ let $14c0b72509d70225$var$savedUserSelect = '';
41284
+ let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
41285
+ function $14c0b72509d70225$export$16a4697467175487(target) {
41286
+ if ($c87311424ea30a05$export$fedb369cb70207f1()) {
41287
+ if ($14c0b72509d70225$var$state === 'default') {
41288
+ $14c0b72509d70225$var$savedUserSelect = document.documentElement.style.webkitUserSelect;
41289
+ document.documentElement.style.webkitUserSelect = 'none';
41290
+ }
41291
+ $14c0b72509d70225$var$state = 'disabled';
41292
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) {
41293
+ // If not iOS, store the target's original user-select and change to user-select: none
41294
+ // Ignore state since it doesn't apply for non iOS
41295
+ $14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
41296
+ target.style.userSelect = 'none';
41297
+ }
41298
+ }
41299
+ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
41300
+ if ($c87311424ea30a05$export$fedb369cb70207f1()) {
41301
+ // If the state is already default, there's nothing to do.
41302
+ // If it is restoring, then there's no need to queue a second restore.
41303
+ if ($14c0b72509d70225$var$state !== 'disabled') return;
41304
+ $14c0b72509d70225$var$state = 'restoring';
41305
+ // There appears to be a delay on iOS where selection still might occur
41306
+ // after pointer up, so wait a bit before removing user-select.
41307
+ setTimeout(()=>{
41308
+ // Wait for any CSS transitions to complete so we don't recompute style
41309
+ // for the whole page in the middle of the animation and cause jank.
41310
+ $bbed8b41f857bcc0$export$24490316f764c430(()=>{
41311
+ // Avoid race conditions
41312
+ if ($14c0b72509d70225$var$state === 'restoring') {
41313
+ if (document.documentElement.style.webkitUserSelect === 'none') document.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
41314
+ $14c0b72509d70225$var$savedUserSelect = '';
41315
+ $14c0b72509d70225$var$state = 'default';
41316
+ }
41317
+ });
41318
+ }, 300);
41319
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
41320
+ // Ignore state since it doesn't apply for non iOS
41321
+ {
41322
+ if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
41323
+ let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
41324
+ if (target.style.userSelect === 'none') target.style.userSelect = targetOldUserSelect;
41325
+ if (target.getAttribute('style') === '') target.removeAttribute('style');
41326
+ $14c0b72509d70225$var$modifiedElementMap.delete(target);
41327
+ }
41328
+ }
41329
+ }
41330
+
41331
+
41332
+
41333
+
41334
+
41335
+ function $8a9cb279dc87e130$export$60278871457622de(event) {
41336
+ // JAWS/NVDA with Firefox.
41337
+ if (event.mozInputSource === 0 && event.isTrusted) return true;
41338
+ return event.detail === 0 && !event.pointerType;
41339
+ }
41340
+ class $8a9cb279dc87e130$export$905e7fc544a71f36 {
41341
+ isDefaultPrevented() {
41342
+ return this.nativeEvent.defaultPrevented;
41343
+ }
41344
+ preventDefault() {
41345
+ this.defaultPrevented = true;
41346
+ this.nativeEvent.preventDefault();
41347
+ }
41348
+ stopPropagation() {
41349
+ this.nativeEvent.stopPropagation();
41350
+ this.isPropagationStopped = ()=>true
41351
+ ;
41352
+ }
41353
+ isPropagationStopped() {
41354
+ return false;
41355
+ }
41356
+ persist() {
41357
+ }
41358
+ constructor(type, nativeEvent){
41359
+ this.nativeEvent = nativeEvent;
41360
+ this.target = nativeEvent.target;
41361
+ this.currentTarget = nativeEvent.currentTarget;
41362
+ this.relatedTarget = nativeEvent.relatedTarget;
41363
+ this.bubbles = nativeEvent.bubbles;
41364
+ this.cancelable = nativeEvent.cancelable;
41365
+ this.defaultPrevented = nativeEvent.defaultPrevented;
41366
+ this.eventPhase = nativeEvent.eventPhase;
41367
+ this.isTrusted = nativeEvent.isTrusted;
41368
+ this.timeStamp = nativeEvent.timeStamp;
41369
+ this.type = type;
41370
+ }
41371
+ }
41372
+ function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
41373
+ let stateRef = React.useRef({
41374
+ isFocused: false,
41375
+ onBlur: onBlur,
41376
+ observer: null
41377
+ });
41378
+ stateRef.current.onBlur = onBlur;
41379
+ // Clean up MutationObserver on unmount. See below.
41380
+ // eslint-disable-next-line arrow-body-style
41381
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
41382
+ const state = stateRef.current;
41383
+ return ()=>{
41384
+ if (state.observer) {
41385
+ state.observer.disconnect();
41386
+ state.observer = null;
41387
+ }
41388
+ };
41389
+ }, []);
41390
+ // This function is called during a React onFocus event.
41391
+ return React.useCallback((e1)=>{
41392
+ // React does not fire onBlur when an element is disabled. https://github.com/facebook/react/issues/9142
41393
+ // Most browsers fire a native focusout event in this case, except for Firefox. In that case, we use a
41394
+ // MutationObserver to watch for the disabled attribute, and dispatch these events ourselves.
41395
+ // For browsers that do, focusout fires before the MutationObserver, so onBlur should not fire twice.
41396
+ if (e1.target instanceof HTMLButtonElement || e1.target instanceof HTMLInputElement || e1.target instanceof HTMLTextAreaElement || e1.target instanceof HTMLSelectElement) {
41397
+ stateRef.current.isFocused = true;
41398
+ let target = e1.target;
41399
+ let onBlurHandler = (e)=>{
41400
+ var // For backward compatibility, dispatch a (fake) React synthetic event.
41401
+ _current, ref;
41402
+ stateRef.current.isFocused = false;
41403
+ if (target.disabled) (ref = (_current = stateRef.current).onBlur) === null || ref === void 0 ? void 0 : ref.call(_current, new $8a9cb279dc87e130$export$905e7fc544a71f36('blur', e));
41404
+ // We no longer need the MutationObserver once the target is blurred.
41405
+ if (stateRef.current.observer) {
41406
+ stateRef.current.observer.disconnect();
41407
+ stateRef.current.observer = null;
41408
+ }
41409
+ };
41410
+ target.addEventListener('focusout', onBlurHandler, {
41411
+ once: true
41412
+ });
41413
+ stateRef.current.observer = new MutationObserver(()=>{
41414
+ if (stateRef.current.isFocused && target.disabled) {
41415
+ stateRef.current.observer.disconnect();
41416
+ target.dispatchEvent(new FocusEvent('blur'));
41417
+ target.dispatchEvent(new FocusEvent('focusout', {
41418
+ bubbles: true
41419
+ }));
41420
+ }
41421
+ });
41422
+ stateRef.current.observer.observe(target, {
41423
+ attributes: true,
41424
+ attributeFilter: [
41425
+ 'disabled'
41426
+ ]
41427
+ });
41428
+ }
41429
+ }, []);
41430
+ }
41431
+
41432
+
41433
+
41434
+ const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = React__default["default"].createContext(null);
41435
+ $ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
41436
+
41437
+
41438
+
41439
+ function $f6c31cce2adf654f$var$usePressResponderContext(props) {
41440
+ // Consume context from <PressResponder> and merge with props.
41441
+ let context = React.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5);
41442
+ if (context) {
41443
+ let { register: register , ...contextProps } = context;
41444
+ props = $3ef42575df84b30b$export$9d1611c77c2fe928(contextProps, props);
41445
+ register();
41446
+ }
41447
+ $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, props.ref);
41448
+ return props;
41449
+ }
41450
+ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
41451
+ let { onPress: onPress1 , onPressChange: onPressChange1 , onPressStart: onPressStart1 , onPressEnd: onPressEnd1 , onPressUp: onPressUp1 , isDisabled: isDisabled1 , isPressed: isPressedProp , preventFocusOnPress: preventFocusOnPress , shouldCancelOnPointerExit: shouldCancelOnPointerExit , allowTextSelectionOnPress: allowTextSelectionOnPress , // eslint-disable-next-line @typescript-eslint/no-unused-vars
41452
+ ref: _ , ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props);
41453
+ let propsRef = React.useRef(null);
41454
+ propsRef.current = {
41455
+ onPress: onPress1,
41456
+ onPressChange: onPressChange1,
41457
+ onPressStart: onPressStart1,
41458
+ onPressEnd: onPressEnd1,
41459
+ onPressUp: onPressUp1,
41460
+ isDisabled: isDisabled1,
41461
+ shouldCancelOnPointerExit: shouldCancelOnPointerExit
41462
+ };
41463
+ let [isPressed, setPressed] = React.useState(false);
41464
+ let ref = React.useRef({
41465
+ isPressed: false,
41466
+ ignoreEmulatedMouseEvents: false,
41467
+ ignoreClickAfterPress: false,
41468
+ didFirePressStart: false,
41469
+ activePointerId: null,
41470
+ target: null,
41471
+ isOverTarget: false,
41472
+ pointerType: null
41473
+ });
41474
+ let { addGlobalListener: addGlobalListener , removeAllGlobalListeners: removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
41475
+ let pressProps1 = React.useMemo(()=>{
41476
+ let state = ref.current;
41477
+ let triggerPressStart = (originalEvent, pointerType)=>{
41478
+ let { onPressStart: onPressStart , onPressChange: onPressChange , isDisabled: isDisabled } = propsRef.current;
41479
+ if (isDisabled || state.didFirePressStart) return;
41480
+ if (onPressStart) onPressStart({
41481
+ type: 'pressstart',
41482
+ pointerType: pointerType,
41483
+ target: originalEvent.currentTarget,
41484
+ shiftKey: originalEvent.shiftKey,
41485
+ metaKey: originalEvent.metaKey,
41486
+ ctrlKey: originalEvent.ctrlKey,
41487
+ altKey: originalEvent.altKey
41488
+ });
41489
+ if (onPressChange) onPressChange(true);
41490
+ state.didFirePressStart = true;
41491
+ setPressed(true);
41492
+ };
41493
+ let triggerPressEnd = (originalEvent, pointerType, wasPressed = true)=>{
41494
+ let { onPressEnd: onPressEnd , onPressChange: onPressChange , onPress: onPress , isDisabled: isDisabled } = propsRef.current;
41495
+ if (!state.didFirePressStart) return;
41496
+ state.ignoreClickAfterPress = true;
41497
+ state.didFirePressStart = false;
41498
+ if (onPressEnd) onPressEnd({
41499
+ type: 'pressend',
41500
+ pointerType: pointerType,
41501
+ target: originalEvent.currentTarget,
41502
+ shiftKey: originalEvent.shiftKey,
41503
+ metaKey: originalEvent.metaKey,
41504
+ ctrlKey: originalEvent.ctrlKey,
41505
+ altKey: originalEvent.altKey
41506
+ });
41507
+ if (onPressChange) onPressChange(false);
41508
+ setPressed(false);
41509
+ if (onPress && wasPressed && !isDisabled) onPress({
41510
+ type: 'press',
41511
+ pointerType: pointerType,
41512
+ target: originalEvent.currentTarget,
41513
+ shiftKey: originalEvent.shiftKey,
41514
+ metaKey: originalEvent.metaKey,
41515
+ ctrlKey: originalEvent.ctrlKey,
41516
+ altKey: originalEvent.altKey
41517
+ });
41518
+ };
41519
+ let triggerPressUp = (originalEvent, pointerType)=>{
41520
+ let { onPressUp: onPressUp , isDisabled: isDisabled } = propsRef.current;
41521
+ if (isDisabled) return;
41522
+ if (onPressUp) onPressUp({
41523
+ type: 'pressup',
41524
+ pointerType: pointerType,
41525
+ target: originalEvent.currentTarget,
41526
+ shiftKey: originalEvent.shiftKey,
41527
+ metaKey: originalEvent.metaKey,
41528
+ ctrlKey: originalEvent.ctrlKey,
41529
+ altKey: originalEvent.altKey
41530
+ });
41531
+ };
41532
+ let cancel = (e)=>{
41533
+ if (state.isPressed) {
41534
+ if (state.isOverTarget) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
41535
+ state.isPressed = false;
41536
+ state.isOverTarget = false;
41537
+ state.activePointerId = null;
41538
+ state.pointerType = null;
41539
+ removeAllGlobalListeners();
41540
+ if (!allowTextSelectionOnPress) $14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
41541
+ }
41542
+ };
41543
+ let pressProps = {
41544
+ onKeyDown (e) {
41545
+ if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent) && e.currentTarget.contains(e.target)) {
41546
+ if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target)) e.preventDefault();
41547
+ e.stopPropagation();
41548
+ // If the event is repeating, it may have started on a different element
41549
+ // after which focus moved to the current element. Ignore these events and
41550
+ // only handle the first key down event.
41551
+ if (!state.isPressed && !e.repeat) {
41552
+ state.target = e.currentTarget;
41553
+ state.isPressed = true;
41554
+ triggerPressStart(e, 'keyboard');
41555
+ // Focus may move before the key up event, so register the event on the document
41556
+ // instead of the same element where the key down event occurred.
41557
+ addGlobalListener(document, 'keyup', onKeyUp, false);
41558
+ }
41559
+ }
41560
+ },
41561
+ onKeyUp (e) {
41562
+ if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent) && !e.repeat && e.currentTarget.contains(e.target)) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard');
41563
+ },
41564
+ onClick (e) {
41565
+ if (e && !e.currentTarget.contains(e.target)) return;
41566
+ if (e && e.button === 0) {
41567
+ e.stopPropagation();
41568
+ if (isDisabled1) e.preventDefault();
41569
+ // If triggered from a screen reader or by using element.click(),
41570
+ // trigger as if it were a keyboard click.
41571
+ if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && (state.pointerType === 'virtual' || $8a9cb279dc87e130$export$60278871457622de(e.nativeEvent))) {
41572
+ // Ensure the element receives focus (VoiceOver on iOS does not do this)
41573
+ if (!isDisabled1 && !preventFocusOnPress) $7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
41574
+ triggerPressStart(e, 'virtual');
41575
+ triggerPressUp(e, 'virtual');
41576
+ triggerPressEnd(e, 'virtual');
41577
+ }
41578
+ state.ignoreEmulatedMouseEvents = false;
41579
+ state.ignoreClickAfterPress = false;
41580
+ }
41581
+ }
41582
+ };
41583
+ let onKeyUp = (e)=>{
41584
+ if (state.isPressed && $f6c31cce2adf654f$var$isValidKeyboardEvent(e)) {
41585
+ if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target)) e.preventDefault();
41586
+ e.stopPropagation();
41587
+ state.isPressed = false;
41588
+ let target = e.target;
41589
+ triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard', state.target.contains(target));
41590
+ removeAllGlobalListeners();
41591
+ // If the target is a link, trigger the click method to open the URL,
41592
+ // but defer triggering pressEnd until onClick event handler.
41593
+ if (state.target instanceof HTMLElement && (state.target.contains(target) && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) || state.target.getAttribute('role') === 'link')) state.target.click();
41594
+ }
41595
+ };
41596
+ if (typeof PointerEvent !== 'undefined') {
41597
+ pressProps.onPointerDown = (e)=>{
41598
+ // Only handle left clicks, and ignore events that bubbled through portals.
41599
+ if (e.button !== 0 || !e.currentTarget.contains(e.target)) return;
41600
+ // iOS safari fires pointer events from VoiceOver with incorrect coordinates/target.
41601
+ // Ignore and let the onClick handler take care of it instead.
41602
+ // https://bugs.webkit.org/show_bug.cgi?id=222627
41603
+ // https://bugs.webkit.org/show_bug.cgi?id=223202
41604
+ if ($f6c31cce2adf654f$var$isVirtualPointerEvent(e.nativeEvent)) {
41605
+ state.pointerType = 'virtual';
41606
+ return;
41607
+ }
41608
+ // Due to browser inconsistencies, especially on mobile browsers, we prevent
41609
+ // default on pointer down and handle focusing the pressable element ourselves.
41610
+ if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
41611
+ state.pointerType = e.pointerType;
41612
+ e.stopPropagation();
41613
+ if (!state.isPressed) {
41614
+ state.isPressed = true;
41615
+ state.isOverTarget = true;
41616
+ state.activePointerId = e.pointerId;
41617
+ state.target = e.currentTarget;
41618
+ if (!isDisabled1 && !preventFocusOnPress) $7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
41619
+ if (!allowTextSelectionOnPress) $14c0b72509d70225$export$16a4697467175487(state.target);
41620
+ triggerPressStart(e, state.pointerType);
41621
+ addGlobalListener(document, 'pointermove', onPointerMove, false);
41622
+ addGlobalListener(document, 'pointerup', onPointerUp, false);
41623
+ addGlobalListener(document, 'pointercancel', onPointerCancel, false);
41624
+ }
41625
+ };
41626
+ pressProps.onMouseDown = (e)=>{
41627
+ if (!e.currentTarget.contains(e.target)) return;
41628
+ if (e.button === 0) {
41629
+ // Chrome and Firefox on touch Windows devices require mouse down events
41630
+ // to be canceled in addition to pointer events, or an extra asynchronous
41631
+ // focus event will be fired.
41632
+ if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
41633
+ e.stopPropagation();
41634
+ }
41635
+ };
41636
+ pressProps.onPointerUp = (e)=>{
41637
+ // iOS fires pointerup with zero width and height, so check the pointerType recorded during pointerdown.
41638
+ if (!e.currentTarget.contains(e.target) || state.pointerType === 'virtual') return;
41639
+ // Only handle left clicks
41640
+ // Safari on iOS sometimes fires pointerup events, even
41641
+ // when the touch isn't over the target, so double check.
41642
+ if (e.button === 0 && $f6c31cce2adf654f$var$isOverTarget(e, e.currentTarget)) triggerPressUp(e, state.pointerType || e.pointerType);
41643
+ };
41644
+ // Safari on iOS < 13.2 does not implement pointerenter/pointerleave events correctly.
41645
+ // Use pointer move events instead to implement our own hit testing.
41646
+ // See https://bugs.webkit.org/show_bug.cgi?id=199803
41647
+ let onPointerMove = (e)=>{
41648
+ if (e.pointerId !== state.activePointerId) return;
41649
+ if ($f6c31cce2adf654f$var$isOverTarget(e, state.target)) {
41650
+ if (!state.isOverTarget) {
41651
+ state.isOverTarget = true;
41652
+ triggerPressStart($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
41653
+ }
41654
+ } else if (state.isOverTarget) {
41655
+ state.isOverTarget = false;
41656
+ triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
41657
+ if (propsRef.current.shouldCancelOnPointerExit) cancel(e);
41658
+ }
41659
+ };
41660
+ let onPointerUp = (e)=>{
41661
+ if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0) {
41662
+ if ($f6c31cce2adf654f$var$isOverTarget(e, state.target)) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
41663
+ else if (state.isOverTarget) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
41664
+ state.isPressed = false;
41665
+ state.isOverTarget = false;
41666
+ state.activePointerId = null;
41667
+ state.pointerType = null;
41668
+ removeAllGlobalListeners();
41669
+ if (!allowTextSelectionOnPress) $14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
41670
+ }
41671
+ };
41672
+ let onPointerCancel = (e)=>{
41673
+ cancel(e);
41674
+ };
41675
+ pressProps.onDragStart = (e)=>{
41676
+ if (!e.currentTarget.contains(e.target)) return;
41677
+ // Safari does not call onPointerCancel when a drag starts, whereas Chrome and Firefox do.
41678
+ cancel(e);
41679
+ };
41680
+ } else {
41681
+ pressProps.onMouseDown = (e)=>{
41682
+ // Only handle left clicks
41683
+ if (e.button !== 0 || !e.currentTarget.contains(e.target)) return;
41684
+ // Due to browser inconsistencies, especially on mobile browsers, we prevent
41685
+ // default on mouse down and handle focusing the pressable element ourselves.
41686
+ if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
41687
+ e.stopPropagation();
41688
+ if (state.ignoreEmulatedMouseEvents) return;
41689
+ state.isPressed = true;
41690
+ state.isOverTarget = true;
41691
+ state.target = e.currentTarget;
41692
+ state.pointerType = $8a9cb279dc87e130$export$60278871457622de(e.nativeEvent) ? 'virtual' : 'mouse';
41693
+ if (!isDisabled1 && !preventFocusOnPress) $7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
41694
+ triggerPressStart(e, state.pointerType);
41695
+ addGlobalListener(document, 'mouseup', onMouseUp, false);
41696
+ };
41697
+ pressProps.onMouseEnter = (e)=>{
41698
+ if (!e.currentTarget.contains(e.target)) return;
41699
+ e.stopPropagation();
41700
+ if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
41701
+ state.isOverTarget = true;
41702
+ triggerPressStart(e, state.pointerType);
41703
+ }
41704
+ };
41705
+ pressProps.onMouseLeave = (e)=>{
41706
+ if (!e.currentTarget.contains(e.target)) return;
41707
+ e.stopPropagation();
41708
+ if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
41709
+ state.isOverTarget = false;
41710
+ triggerPressEnd(e, state.pointerType, false);
41711
+ if (propsRef.current.shouldCancelOnPointerExit) cancel(e);
41712
+ }
41713
+ };
41714
+ pressProps.onMouseUp = (e)=>{
41715
+ if (!e.currentTarget.contains(e.target)) return;
41716
+ if (!state.ignoreEmulatedMouseEvents && e.button === 0) triggerPressUp(e, state.pointerType);
41717
+ };
41718
+ let onMouseUp = (e)=>{
41719
+ // Only handle left clicks
41720
+ if (e.button !== 0) return;
41721
+ state.isPressed = false;
41722
+ removeAllGlobalListeners();
41723
+ if (state.ignoreEmulatedMouseEvents) {
41724
+ state.ignoreEmulatedMouseEvents = false;
41725
+ return;
41726
+ }
41727
+ if ($f6c31cce2adf654f$var$isOverTarget(e, state.target)) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
41728
+ else if (state.isOverTarget) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
41729
+ state.isOverTarget = false;
41730
+ };
41731
+ pressProps.onTouchStart = (e)=>{
41732
+ if (!e.currentTarget.contains(e.target)) return;
41733
+ e.stopPropagation();
41734
+ let touch = $f6c31cce2adf654f$var$getTouchFromEvent(e.nativeEvent);
41735
+ if (!touch) return;
41736
+ state.activePointerId = touch.identifier;
41737
+ state.ignoreEmulatedMouseEvents = true;
41738
+ state.isOverTarget = true;
41739
+ state.isPressed = true;
41740
+ state.target = e.currentTarget;
41741
+ state.pointerType = 'touch';
41742
+ // Due to browser inconsistencies, especially on mobile browsers, we prevent default
41743
+ // on the emulated mouse event and handle focusing the pressable element ourselves.
41744
+ if (!isDisabled1 && !preventFocusOnPress) $7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
41745
+ if (!allowTextSelectionOnPress) $14c0b72509d70225$export$16a4697467175487(state.target);
41746
+ triggerPressStart(e, state.pointerType);
41747
+ addGlobalListener(window, 'scroll', onScroll, true);
41748
+ };
41749
+ pressProps.onTouchMove = (e)=>{
41750
+ if (!e.currentTarget.contains(e.target)) return;
41751
+ e.stopPropagation();
41752
+ if (!state.isPressed) return;
41753
+ let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
41754
+ if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
41755
+ if (!state.isOverTarget) {
41756
+ state.isOverTarget = true;
41757
+ triggerPressStart(e, state.pointerType);
41758
+ }
41759
+ } else if (state.isOverTarget) {
41760
+ state.isOverTarget = false;
41761
+ triggerPressEnd(e, state.pointerType, false);
41762
+ if (propsRef.current.shouldCancelOnPointerExit) cancel(e);
41763
+ }
41764
+ };
41765
+ pressProps.onTouchEnd = (e)=>{
41766
+ if (!e.currentTarget.contains(e.target)) return;
41767
+ e.stopPropagation();
41768
+ if (!state.isPressed) return;
41769
+ let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
41770
+ if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
41771
+ triggerPressUp(e, state.pointerType);
41772
+ triggerPressEnd(e, state.pointerType);
41773
+ } else if (state.isOverTarget) triggerPressEnd(e, state.pointerType, false);
41774
+ state.isPressed = false;
41775
+ state.activePointerId = null;
41776
+ state.isOverTarget = false;
41777
+ state.ignoreEmulatedMouseEvents = true;
41778
+ if (!allowTextSelectionOnPress) $14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
41779
+ removeAllGlobalListeners();
41780
+ };
41781
+ pressProps.onTouchCancel = (e)=>{
41782
+ if (!e.currentTarget.contains(e.target)) return;
41783
+ e.stopPropagation();
41784
+ if (state.isPressed) cancel(e);
41785
+ };
41786
+ let onScroll = (e)=>{
41787
+ if (state.isPressed && e.target.contains(state.target)) cancel({
41788
+ currentTarget: state.target,
41789
+ shiftKey: false,
41790
+ ctrlKey: false,
41791
+ metaKey: false,
41792
+ altKey: false
41793
+ });
41794
+ };
41795
+ pressProps.onDragStart = (e)=>{
41796
+ if (!e.currentTarget.contains(e.target)) return;
41797
+ cancel(e);
41798
+ };
41799
+ }
41800
+ return pressProps;
41801
+ }, [
41802
+ addGlobalListener,
41803
+ isDisabled1,
41804
+ preventFocusOnPress,
41805
+ removeAllGlobalListeners,
41806
+ allowTextSelectionOnPress
41807
+ ]);
41808
+ // Remove user-select: none in case component unmounts immediately after pressStart
41809
+ // eslint-disable-next-line arrow-body-style
41810
+ React.useEffect(()=>{
41811
+ return ()=>{
41812
+ if (!allowTextSelectionOnPress) $14c0b72509d70225$export$b0d6fa1ab32e3295(ref.current.target);
41813
+ };
41814
+ }, [
41815
+ allowTextSelectionOnPress
41816
+ ]);
41817
+ return {
41818
+ isPressed: isPressedProp || isPressed,
41819
+ pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, pressProps1)
41820
+ };
41821
+ }
41822
+ function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
41823
+ return target.tagName === 'A' && target.hasAttribute('href');
41824
+ }
41825
+ function $f6c31cce2adf654f$var$isValidKeyboardEvent(event) {
41826
+ const { key: key , code: code , target: target } = event;
41827
+ const element = target;
41828
+ const { tagName: tagName , isContentEditable: isContentEditable } = element;
41829
+ const role = element.getAttribute('role');
41830
+ // Accessibility for keyboards. Space and Enter only.
41831
+ // "Spacebar" is for IE 11
41832
+ return (key === 'Enter' || key === ' ' || key === 'Spacebar' || code === 'Space') && tagName !== 'INPUT' && tagName !== 'TEXTAREA' && isContentEditable !== true && (!$f6c31cce2adf654f$var$isHTMLAnchorLink(element) || role === 'button' && key !== 'Enter') && // An element with role='link' should only trigger with Enter key
41833
+ !(role === 'link' && key !== 'Enter');
41834
+ }
41835
+ function $f6c31cce2adf654f$var$getTouchFromEvent(event) {
41836
+ const { targetTouches: targetTouches } = event;
41837
+ if (targetTouches.length > 0) return targetTouches[0];
41838
+ return null;
41839
+ }
41840
+ function $f6c31cce2adf654f$var$getTouchById(event, pointerId) {
41841
+ const changedTouches = event.changedTouches;
41842
+ for(let i = 0; i < changedTouches.length; i++){
41843
+ const touch = changedTouches[i];
41844
+ if (touch.identifier === pointerId) return touch;
41845
+ }
41846
+ return null;
41847
+ }
41848
+ function $f6c31cce2adf654f$var$createEvent(target, e) {
41849
+ return {
41850
+ currentTarget: target,
41851
+ shiftKey: e.shiftKey,
41852
+ ctrlKey: e.ctrlKey,
41853
+ metaKey: e.metaKey,
41854
+ altKey: e.altKey
41855
+ };
41856
+ }
41857
+ function $f6c31cce2adf654f$var$getPointClientRect(point) {
41858
+ let offsetX = point.width / 2 || point.radiusX || 0;
41859
+ let offsetY = point.height / 2 || point.radiusY || 0;
41860
+ return {
41861
+ top: point.clientY - offsetY,
41862
+ right: point.clientX + offsetX,
41863
+ bottom: point.clientY + offsetY,
41864
+ left: point.clientX - offsetX
41865
+ };
41866
+ }
41867
+ function $f6c31cce2adf654f$var$areRectanglesOverlapping(a, b) {
41868
+ // check if they cannot overlap on x axis
41869
+ if (a.left > b.right || b.left > a.right) return false;
41870
+ // check if they cannot overlap on y axis
41871
+ if (a.top > b.bottom || b.top > a.bottom) return false;
41872
+ return true;
41873
+ }
41874
+ function $f6c31cce2adf654f$var$isOverTarget(point, target) {
41875
+ let rect = target.getBoundingClientRect();
41876
+ let pointRect = $f6c31cce2adf654f$var$getPointClientRect(point);
41877
+ return $f6c31cce2adf654f$var$areRectanglesOverlapping(rect, pointRect);
41878
+ }
41879
+ function $f6c31cce2adf654f$var$shouldPreventDefault(target) {
41880
+ // We cannot prevent default if the target is a draggable element.
41881
+ return !(target instanceof HTMLElement) || !target.draggable;
41882
+ }
41883
+ function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target) {
41884
+ return !((target.tagName === 'INPUT' || target.tagName === 'BUTTON') && target.type === 'submit');
41885
+ }
41886
+ function $f6c31cce2adf654f$var$isVirtualPointerEvent(event) {
41887
+ // If the pointer size is zero, then we assume it's from a screen reader.
41888
+ // Android TalkBack double tap will sometimes return a event with width and height of 1
41889
+ // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.
41890
+ // Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
41891
+ // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
41892
+ // Talkback double tap from Windows Firefox touch screen press
41893
+ return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse';
41894
+ }
41895
+
41896
+
41897
+
41898
+
41899
+ function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
41900
+ let { isDisabled: isDisabled , onFocus: onFocusProp , onBlur: onBlurProp , onFocusChange: onFocusChange } = props;
41901
+ const onBlur = React.useCallback((e)=>{
41902
+ if (e.target === e.currentTarget) {
41903
+ if (onBlurProp) onBlurProp(e);
41904
+ if (onFocusChange) onFocusChange(false);
41905
+ return true;
41906
+ }
41907
+ }, [
41908
+ onBlurProp,
41909
+ onFocusChange
41910
+ ]);
41911
+ const onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
41912
+ const onFocus = React.useCallback((e)=>{
41913
+ if (e.target === e.currentTarget) {
41914
+ if (onFocusProp) onFocusProp(e);
41915
+ if (onFocusChange) onFocusChange(true);
41916
+ onSyntheticFocus(e);
41917
+ }
41918
+ }, [
41919
+ onFocusChange,
41920
+ onFocusProp,
41921
+ onSyntheticFocus
41922
+ ]);
41923
+ return {
41924
+ focusProps: {
41925
+ onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : undefined,
41926
+ onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : null
41927
+ }
41928
+ };
41929
+ }
41930
+
41931
+
41932
+
41933
+
41934
+
41935
+ let $507fabe10e71c6fb$var$currentModality = null;
41936
+ let $507fabe10e71c6fb$var$changeHandlers = new Set();
41937
+ let $507fabe10e71c6fb$var$hasSetupGlobalListeners = false;
41938
+ let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
41939
+ let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
41940
+ // Only Tab or Esc keys will make focus visible on text input elements
41941
+ const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS = {
41942
+ Tab: true,
41943
+ Escape: true
41944
+ };
41945
+ function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
41946
+ for (let handler of $507fabe10e71c6fb$var$changeHandlers)handler(modality, e);
41947
+ }
41948
+ /**
41949
+ * Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
41950
+ */ function $507fabe10e71c6fb$var$isValidKey(e) {
41951
+ // Control and Shift keys trigger when navigating back to the tab with keyboard.
41952
+ return !(e.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
41953
+ }
41954
+ function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
41955
+ $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
41956
+ if ($507fabe10e71c6fb$var$isValidKey(e)) {
41957
+ $507fabe10e71c6fb$var$currentModality = 'keyboard';
41958
+ $507fabe10e71c6fb$var$triggerChangeHandlers('keyboard', e);
41959
+ }
41960
+ }
41961
+ function $507fabe10e71c6fb$var$handlePointerEvent(e) {
41962
+ $507fabe10e71c6fb$var$currentModality = 'pointer';
41963
+ if (e.type === 'mousedown' || e.type === 'pointerdown') {
41964
+ $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
41965
+ $507fabe10e71c6fb$var$triggerChangeHandlers('pointer', e);
41966
+ }
41967
+ }
41968
+ function $507fabe10e71c6fb$var$handleClickEvent(e) {
41969
+ if ($8a9cb279dc87e130$export$60278871457622de(e)) {
41970
+ $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
41971
+ $507fabe10e71c6fb$var$currentModality = 'virtual';
41972
+ }
41973
+ }
41974
+ function $507fabe10e71c6fb$var$handleFocusEvent(e) {
41975
+ // Firefox fires two extra focus events when the user first clicks into an iframe:
41976
+ // first on the window, then on the document. We ignore these events so they don't
41977
+ // cause keyboard focus rings to appear.
41978
+ if (e.target === window || e.target === document) return;
41979
+ // If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
41980
+ // This occurs, for example, when navigating a form with the next/previous buttons on iOS.
41981
+ if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
41982
+ $507fabe10e71c6fb$var$currentModality = 'virtual';
41983
+ $507fabe10e71c6fb$var$triggerChangeHandlers('virtual', e);
41984
+ }
41985
+ $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
41986
+ $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
41987
+ }
41988
+ function $507fabe10e71c6fb$var$handleWindowBlur() {
41989
+ // When the window is blurred, reset state. This is necessary when tabbing out of the window,
41990
+ // for example, since a subsequent focus event won't be fired.
41991
+ $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
41992
+ $507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
41993
+ }
41994
+ /**
41995
+ * Setup global event listeners to control when keyboard focus style should be visible.
41996
+ */ function $507fabe10e71c6fb$var$setupGlobalFocusEvents() {
41997
+ if (typeof window === 'undefined' || $507fabe10e71c6fb$var$hasSetupGlobalListeners) return;
41998
+ // Programmatic focus() calls shouldn't affect the current input modality.
41999
+ // However, we need to detect other cases when a focus event occurs without
42000
+ // a preceding user event (e.g. screen reader focus). Overriding the focus
42001
+ // method on HTMLElement.prototype is a bit hacky, but works.
42002
+ let focus = HTMLElement.prototype.focus;
42003
+ HTMLElement.prototype.focus = function() {
42004
+ $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
42005
+ focus.apply(this, arguments);
42006
+ };
42007
+ document.addEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
42008
+ document.addEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
42009
+ document.addEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
42010
+ // Register focus events on the window so they are sure to happen
42011
+ // before React's event listeners (registered on the document).
42012
+ window.addEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
42013
+ window.addEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
42014
+ if (typeof PointerEvent !== 'undefined') {
42015
+ document.addEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
42016
+ document.addEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
42017
+ document.addEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
42018
+ } else {
42019
+ document.addEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
42020
+ document.addEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
42021
+ document.addEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
42022
+ }
42023
+ $507fabe10e71c6fb$var$hasSetupGlobalListeners = true;
42024
+ }
42025
+ if (typeof document !== 'undefined') {
42026
+ if (document.readyState !== 'loading') $507fabe10e71c6fb$var$setupGlobalFocusEvents();
42027
+ else document.addEventListener('DOMContentLoaded', $507fabe10e71c6fb$var$setupGlobalFocusEvents);
42028
+ }
42029
+ function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
42030
+ return $507fabe10e71c6fb$var$currentModality !== 'pointer';
42031
+ }
42032
+ function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
42033
+ return $507fabe10e71c6fb$var$currentModality;
42034
+ }
42035
+ /**
42036
+ * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
42037
+ * focus visible style can be properly set.
42038
+ */ function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
42039
+ return !(isTextInput && modality === 'keyboard' && e instanceof KeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
42040
+ }
42041
+ function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
42042
+ $507fabe10e71c6fb$var$setupGlobalFocusEvents();
42043
+ React.useEffect(()=>{
42044
+ let handler = (modality, e)=>{
42045
+ if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(opts === null || opts === void 0 ? void 0 : opts.isTextInput, modality, e)) return;
42046
+ fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
42047
+ };
42048
+ $507fabe10e71c6fb$var$changeHandlers.add(handler);
42049
+ return ()=>{
42050
+ $507fabe10e71c6fb$var$changeHandlers.delete(handler);
42051
+ };
42052
+ }, deps);
42053
+ }
42054
+
42055
+
42056
+
42057
+
42058
+ function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
42059
+ let { isDisabled: isDisabled , onBlurWithin: onBlurWithin , onFocusWithin: onFocusWithin , onFocusWithinChange: onFocusWithinChange } = props;
42060
+ let state = React.useRef({
42061
+ isFocusWithin: false
42062
+ });
42063
+ let onBlur = React.useCallback((e)=>{
42064
+ // We don't want to trigger onBlurWithin and then immediately onFocusWithin again
42065
+ // when moving focus inside the element. Only trigger if the currentTarget doesn't
42066
+ // include the relatedTarget (where focus is moving).
42067
+ if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
42068
+ state.current.isFocusWithin = false;
42069
+ if (onBlurWithin) onBlurWithin(e);
42070
+ if (onFocusWithinChange) onFocusWithinChange(false);
42071
+ }
42072
+ }, [
42073
+ onBlurWithin,
42074
+ onFocusWithinChange,
42075
+ state
42076
+ ]);
42077
+ let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
42078
+ let onFocus = React.useCallback((e)=>{
42079
+ if (!state.current.isFocusWithin) {
42080
+ if (onFocusWithin) onFocusWithin(e);
42081
+ if (onFocusWithinChange) onFocusWithinChange(true);
42082
+ state.current.isFocusWithin = true;
42083
+ onSyntheticFocus(e);
42084
+ }
42085
+ }, [
42086
+ onFocusWithin,
42087
+ onFocusWithinChange,
42088
+ onSyntheticFocus
42089
+ ]);
42090
+ if (isDisabled) return {
42091
+ focusWithinProps: {
42092
+ onFocus: null,
42093
+ onBlur: null
42094
+ }
42095
+ };
42096
+ return {
42097
+ focusWithinProps: {
42098
+ onFocus: onFocus,
42099
+ onBlur: onBlur
42100
+ }
42101
+ };
42102
+ }
42103
+
42104
+
42105
+
42106
+ // iOS fires onPointerEnter twice: once with pointerType="touch" and again with pointerType="mouse".
42107
+ // We want to ignore these emulated events so they do not trigger hover behavior.
42108
+ // See https://bugs.webkit.org/show_bug.cgi?id=214609.
42109
+ let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
42110
+ let $6179b936705e76d3$var$hoverCount = 0;
42111
+ function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents() {
42112
+ $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = true;
42113
+ // Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter
42114
+ // with pointerType="mouse" immediately after onPointerUp and before onFocus. On other
42115
+ // devices that don't have this quirk, we don't want to ignore a mouse hover sometime in
42116
+ // the distant future because a user previously touched the element.
42117
+ setTimeout(()=>{
42118
+ $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
42119
+ }, 50);
42120
+ }
42121
+ function $6179b936705e76d3$var$handleGlobalPointerEvent(e) {
42122
+ if (e.pointerType === 'touch') $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents();
42123
+ }
42124
+ function $6179b936705e76d3$var$setupGlobalTouchEvents() {
42125
+ if (typeof document === 'undefined') return;
42126
+ if (typeof PointerEvent !== 'undefined') document.addEventListener('pointerup', $6179b936705e76d3$var$handleGlobalPointerEvent);
42127
+ else document.addEventListener('touchend', $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
42128
+ $6179b936705e76d3$var$hoverCount++;
42129
+ return ()=>{
42130
+ $6179b936705e76d3$var$hoverCount--;
42131
+ if ($6179b936705e76d3$var$hoverCount > 0) return;
42132
+ if (typeof PointerEvent !== 'undefined') document.removeEventListener('pointerup', $6179b936705e76d3$var$handleGlobalPointerEvent);
42133
+ else document.removeEventListener('touchend', $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
42134
+ };
42135
+ }
42136
+ function $6179b936705e76d3$export$ae780daf29e6d456(props) {
42137
+ let { onHoverStart: onHoverStart , onHoverChange: onHoverChange , onHoverEnd: onHoverEnd , isDisabled: isDisabled } = props;
42138
+ let [isHovered, setHovered] = React.useState(false);
42139
+ let state = React.useRef({
42140
+ isHovered: false,
42141
+ ignoreEmulatedMouseEvents: false,
42142
+ pointerType: '',
42143
+ target: null
42144
+ }).current;
42145
+ React.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents, []);
42146
+ let { hoverProps: hoverProps1 , triggerHoverEnd: triggerHoverEnd1 } = React.useMemo(()=>{
42147
+ let triggerHoverStart = (event, pointerType)=>{
42148
+ state.pointerType = pointerType;
42149
+ if (isDisabled || pointerType === 'touch' || state.isHovered || !event.currentTarget.contains(event.target)) return;
42150
+ state.isHovered = true;
42151
+ let target = event.currentTarget;
42152
+ state.target = target;
42153
+ if (onHoverStart) onHoverStart({
42154
+ type: 'hoverstart',
42155
+ target: target,
42156
+ pointerType: pointerType
42157
+ });
42158
+ if (onHoverChange) onHoverChange(true);
42159
+ setHovered(true);
42160
+ };
42161
+ let triggerHoverEnd = (event, pointerType)=>{
42162
+ state.pointerType = '';
42163
+ state.target = null;
42164
+ if (pointerType === 'touch' || !state.isHovered) return;
42165
+ state.isHovered = false;
42166
+ let target = event.currentTarget;
42167
+ if (onHoverEnd) onHoverEnd({
42168
+ type: 'hoverend',
42169
+ target: target,
42170
+ pointerType: pointerType
42171
+ });
42172
+ if (onHoverChange) onHoverChange(false);
42173
+ setHovered(false);
42174
+ };
42175
+ let hoverProps = {
42176
+ };
42177
+ if (typeof PointerEvent !== 'undefined') {
42178
+ hoverProps.onPointerEnter = (e)=>{
42179
+ if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents && e.pointerType === 'mouse') return;
42180
+ triggerHoverStart(e, e.pointerType);
42181
+ };
42182
+ hoverProps.onPointerLeave = (e)=>{
42183
+ if (!isDisabled && e.currentTarget.contains(e.target)) triggerHoverEnd(e, e.pointerType);
42184
+ };
42185
+ } else {
42186
+ hoverProps.onTouchStart = ()=>{
42187
+ state.ignoreEmulatedMouseEvents = true;
42188
+ };
42189
+ hoverProps.onMouseEnter = (e)=>{
42190
+ if (!state.ignoreEmulatedMouseEvents && !$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents) triggerHoverStart(e, 'mouse');
42191
+ state.ignoreEmulatedMouseEvents = false;
42192
+ };
42193
+ hoverProps.onMouseLeave = (e)=>{
42194
+ if (!isDisabled && e.currentTarget.contains(e.target)) triggerHoverEnd(e, 'mouse');
42195
+ };
42196
+ }
42197
+ return {
42198
+ hoverProps: hoverProps,
42199
+ triggerHoverEnd: triggerHoverEnd
42200
+ };
42201
+ }, [
42202
+ onHoverStart,
42203
+ onHoverChange,
42204
+ onHoverEnd,
42205
+ isDisabled,
42206
+ state
42207
+ ]);
42208
+ React.useEffect(()=>{
42209
+ // Call the triggerHoverEnd as soon as isDisabled changes to true
42210
+ // Safe to call triggerHoverEnd, it will early return if we aren't currently hovering
42211
+ if (isDisabled) triggerHoverEnd1({
42212
+ currentTarget: state.target
42213
+ }, state.pointerType);
42214
+ }, [
42215
+ isDisabled
42216
+ ]);
42217
+ return {
42218
+ hoverProps: hoverProps1,
42219
+ isHovered: isHovered
42220
+ };
42221
+ }
42222
+
42223
+
42224
+
42225
+
42226
+
42227
+ const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
42228
+ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
42229
+ let { isDisabled: isDisabled , onLongPressStart: onLongPressStart , onLongPressEnd: onLongPressEnd , onLongPress: onLongPress , threshold: threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD , accessibilityDescription: accessibilityDescription } = props;
42230
+ const timeRef = React.useRef(null);
42231
+ let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
42232
+ let { pressProps: pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21({
42233
+ isDisabled: isDisabled,
42234
+ onPressStart (e1) {
42235
+ if (e1.pointerType === 'mouse' || e1.pointerType === 'touch') {
42236
+ if (onLongPressStart) onLongPressStart({
42237
+ ...e1,
42238
+ type: 'longpressstart'
42239
+ });
42240
+ timeRef.current = setTimeout(()=>{
42241
+ // Prevent other usePress handlers from also handling this event.
42242
+ e1.target.dispatchEvent(new PointerEvent('pointercancel', {
42243
+ bubbles: true
42244
+ }));
42245
+ if (onLongPress) onLongPress({
42246
+ ...e1,
42247
+ type: 'longpress'
42248
+ });
42249
+ timeRef.current = null;
42250
+ }, threshold);
42251
+ // Prevent context menu, which may be opened on long press on touch devices
42252
+ if (e1.pointerType === 'touch') {
42253
+ let onContextMenu = (e)=>{
42254
+ e.preventDefault();
42255
+ };
42256
+ addGlobalListener(e1.target, 'contextmenu', onContextMenu, {
42257
+ once: true
42258
+ });
42259
+ addGlobalListener(window, 'pointerup', ()=>{
42260
+ // If no contextmenu event is fired quickly after pointerup, remove the handler
42261
+ // so future context menu events outside a long press are not prevented.
42262
+ setTimeout(()=>{
42263
+ removeGlobalListener(e1.target, 'contextmenu', onContextMenu);
42264
+ }, 30);
42265
+ }, {
42266
+ once: true
42267
+ });
42268
+ }
42269
+ }
42270
+ },
42271
+ onPressEnd (e) {
42272
+ if (timeRef.current) clearTimeout(timeRef.current);
42273
+ if (onLongPressEnd && (e.pointerType === 'mouse' || e.pointerType === 'touch')) onLongPressEnd({
42274
+ ...e,
42275
+ type: 'longpressend'
42276
+ });
42277
+ }
42278
+ });
42279
+ let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(onLongPress && !isDisabled ? accessibilityDescription : null);
42280
+ return {
42281
+ longPressProps: $3ef42575df84b30b$export$9d1611c77c2fe928(pressProps, descriptionProps)
42282
+ };
42283
+ }
42284
+
42285
+ function $d191a55c9702f145$export$8467354a121f1b9f(props) {
42286
+ let { id: id , label: label , 'aria-labelledby': ariaLabelledby , 'aria-label': ariaLabel , labelElementType: labelElementType = 'label' } = props;
42287
+ id = $bdb11010cef70236$export$f680877a34711e37(id);
42288
+ let labelId = $bdb11010cef70236$export$f680877a34711e37();
42289
+ let labelProps = {
42290
+ };
42291
+ if (label) {
42292
+ ariaLabelledby = ariaLabelledby ? `${ariaLabelledby} ${labelId}` : labelId;
42293
+ labelProps = {
42294
+ id: labelId,
42295
+ htmlFor: labelElementType === 'label' ? id : undefined
42296
+ };
42297
+ } else if (!ariaLabelledby && !ariaLabel) console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
42298
+ let fieldProps = $313b98861ee5dd6c$export$d6875122194c7b44({
42299
+ id: id,
42300
+ 'aria-label': ariaLabel,
42301
+ 'aria-labelledby': ariaLabelledby
42302
+ });
42303
+ return {
42304
+ labelProps: labelProps,
42305
+ fieldProps: fieldProps
42306
+ };
42307
+ }
42308
+
42309
+ function $6a99195332edec8b$export$80f3e147d781571c(element) {
42310
+ // If the user is interacting with a virtual cursor, e.g. screen reader, then
42311
+ // wait until after any animated transitions that are currently occurring on
42312
+ // the page before shifting focus. This avoids issues with VoiceOver on iOS
42313
+ // causing the page to scroll when moving focus if the element is transitioning
42314
+ // from off the screen.
42315
+ if ($507fabe10e71c6fb$export$630ff653c5ada6a9() === 'virtual') {
42316
+ let lastFocusedElement = document.activeElement;
42317
+ $bbed8b41f857bcc0$export$24490316f764c430(()=>{
42318
+ // If focus did not move and the element is still in the document, focus it.
42319
+ if (document.activeElement === lastFocusedElement && document.contains(element)) $7215afc6de606d6b$export$de79e2c695e052f3(element);
42320
+ });
42321
+ } else $7215afc6de606d6b$export$de79e2c695e052f3(element);
42322
+ }
42323
+
42324
+
42325
+ /*
42326
+ * Copyright 2021 Adobe. All rights reserved.
42327
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
42328
+ * you may not use this file except in compliance with the License. You may obtain a copy
42329
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
42330
+ *
42331
+ * Unless required by applicable law or agreed to in writing, software distributed under
42332
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
42333
+ * OF ANY KIND, either express or implied. See the License for the specific language
42334
+ * governing permissions and limitations under the License.
42335
+ */ function $645f2e67b85a24c9$var$isStyleVisible(element) {
42336
+ if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) return false;
42337
+ let { display: display , visibility: visibility } = element.style;
42338
+ let isVisible = display !== 'none' && visibility !== 'hidden' && visibility !== 'collapse';
42339
+ if (isVisible) {
42340
+ const { getComputedStyle: getComputedStyle } = element.ownerDocument.defaultView;
42341
+ let { display: computedDisplay , visibility: computedVisibility } = getComputedStyle(element);
42342
+ isVisible = computedDisplay !== 'none' && computedVisibility !== 'hidden' && computedVisibility !== 'collapse';
42343
+ }
42344
+ return isVisible;
42345
+ }
42346
+ function $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) {
42347
+ return !element.hasAttribute('hidden') && (element.nodeName === 'DETAILS' && childElement && childElement.nodeName !== 'SUMMARY' ? element.hasAttribute('open') : true);
42348
+ }
42349
+ function $645f2e67b85a24c9$export$e989c0fffaa6b27a(element, childElement) {
42350
+ return element.nodeName !== '#comment' && $645f2e67b85a24c9$var$isStyleVisible(element) && $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) && (!element.parentElement || $645f2e67b85a24c9$export$e989c0fffaa6b27a(element.parentElement, element));
42351
+ }
42352
+ const $9bf71ea28793e738$var$focusableElements = [
42353
+ 'input:not([disabled]):not([type=hidden])',
42354
+ 'select:not([disabled])',
42355
+ 'textarea:not([disabled])',
42356
+ 'button:not([disabled])',
42357
+ 'a[href]',
42358
+ 'area[href]',
42359
+ 'summary',
42360
+ 'iframe',
42361
+ 'object',
42362
+ 'embed',
42363
+ 'audio[controls]',
42364
+ 'video[controls]',
42365
+ '[contenteditable]'
42366
+ ];
42367
+ const $9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR = $9bf71ea28793e738$var$focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';
42368
+ $9bf71ea28793e738$var$focusableElements.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
42369
+ const $9bf71ea28793e738$var$TABBABLE_ELEMENT_SELECTOR = $9bf71ea28793e738$var$focusableElements.join(':not([hidden]):not([tabindex="-1"]),');
42370
+ function $9bf71ea28793e738$var$isElementInScope(element, scope) {
42371
+ return scope.some((node)=>node.contains(element)
42372
+ );
42373
+ }
42374
+ function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
42375
+ let selector = (opts === null || opts === void 0 ? void 0 : opts.tabbable) ? $9bf71ea28793e738$var$TABBABLE_ELEMENT_SELECTOR : $9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR;
42376
+ let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
42377
+ acceptNode (node) {
42378
+ var ref;
42379
+ // Skip nodes inside the starting node.
42380
+ if (opts === null || opts === void 0 ? void 0 : (ref = opts.from) === null || ref === void 0 ? void 0 : ref.contains(node)) return NodeFilter.FILTER_REJECT;
42381
+ if (node.matches(selector) && $645f2e67b85a24c9$export$e989c0fffaa6b27a(node) && (!scope || $9bf71ea28793e738$var$isElementInScope(node, scope)) && (!(opts === null || opts === void 0 ? void 0 : opts.accept) || opts.accept(node))) return NodeFilter.FILTER_ACCEPT;
42382
+ return NodeFilter.FILTER_SKIP;
42383
+ }
42384
+ });
42385
+ if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
42386
+ return walker;
42387
+ }
42388
+
42389
+
42390
+
42391
+
42392
+
42393
+
42394
+
42395
+
42396
+ function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {
42397
+ }) {
42398
+ let { autoFocus: autoFocus = false , isTextInput: isTextInput , within: within } = props;
42399
+ let state = React.useRef({
42400
+ isFocused: false,
42401
+ isFocusVisible: autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27()
42402
+ });
42403
+ let [isFocused1, setFocused] = React.useState(false);
42404
+ let [isFocusVisibleState, setFocusVisible] = React.useState(()=>state.current.isFocused && state.current.isFocusVisible
42405
+ );
42406
+ let updateState = React.useCallback(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible)
42407
+ , []);
42408
+ let onFocusChange = React.useCallback((isFocused)=>{
42409
+ state.current.isFocused = isFocused;
42410
+ setFocused(isFocused);
42411
+ updateState();
42412
+ }, [
42413
+ updateState
42414
+ ]);
42415
+ $507fabe10e71c6fb$export$ec71b4b83ac08ec3((isFocusVisible)=>{
42416
+ state.current.isFocusVisible = isFocusVisible;
42417
+ updateState();
42418
+ }, [], {
42419
+ isTextInput: isTextInput
42420
+ });
42421
+ let { focusProps: focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6({
42422
+ isDisabled: within,
42423
+ onFocusChange: onFocusChange
42424
+ });
42425
+ let { focusWithinProps: focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
42426
+ isDisabled: !within,
42427
+ onFocusWithinChange: onFocusChange
42428
+ });
42429
+ return {
42430
+ isFocused: isFocused1,
42431
+ isFocusVisible: state.current.isFocused && isFocusVisibleState,
42432
+ focusProps: within ? focusWithinProps : focusProps
42433
+ };
42434
+ }
42435
+
42436
+ /*
42437
+ * Copyright 2020 Adobe. All rights reserved.
42438
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
42439
+ * you may not use this file except in compliance with the License. You may obtain a copy
42440
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
42441
+ *
42442
+ * Unless required by applicable law or agreed to in writing, software distributed under
42443
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
42444
+ * OF ANY KIND, either express or implied. See the License for the specific language
42445
+ * governing permissions and limitations under the License.
42446
+ */ // https://en.wikipedia.org/wiki/Right-to-left
42447
+ const $148a7a147e38ea7f$var$RTL_SCRIPTS = new Set([
42448
+ 'Arab',
42449
+ 'Syrc',
42450
+ 'Samr',
42451
+ 'Mand',
42452
+ 'Thaa',
42453
+ 'Mend',
42454
+ 'Nkoo',
42455
+ 'Adlm',
42456
+ 'Rohg',
42457
+ 'Hebr'
42458
+ ]);
42459
+ const $148a7a147e38ea7f$var$RTL_LANGS = new Set([
42460
+ 'ae',
42461
+ 'ar',
42462
+ 'arc',
42463
+ 'bcc',
42464
+ 'bqi',
42465
+ 'ckb',
42466
+ 'dv',
42467
+ 'fa',
42468
+ 'glk',
42469
+ 'he',
42470
+ 'ku',
42471
+ 'mzn',
42472
+ 'nqo',
42473
+ 'pnb',
42474
+ 'ps',
42475
+ 'sd',
42476
+ 'ug',
42477
+ 'ur',
42478
+ 'yi'
42479
+ ]);
42480
+ function $148a7a147e38ea7f$export$702d680b21cbd764(locale) {
42481
+ // If the Intl.Locale API is available, use it to get the script for the locale.
42482
+ // This is more accurate than guessing by language, since languages can be written in multiple scripts.
42483
+ // @ts-ignore
42484
+ if (Intl.Locale) {
42485
+ // @ts-ignore
42486
+ let script = new Intl.Locale(locale).maximize().script;
42487
+ return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(script);
42488
+ }
42489
+ // If not, just guess by the language (first part of the locale)
42490
+ let lang = locale.split('-')[0];
42491
+ return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
42492
+ }
42493
+
42494
+
42495
+
42496
+
42497
+
42498
+ function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
42499
+ // @ts-ignore
42500
+ let locale = typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
42501
+ try {
42502
+ // @ts-ignore
42503
+ Intl.DateTimeFormat.supportedLocalesOf([
42504
+ locale
42505
+ ]);
42506
+ } catch (_err) {
42507
+ locale = 'en-US';
42508
+ }
42509
+ return {
42510
+ locale: locale,
42511
+ direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale) ? 'rtl' : 'ltr'
42512
+ };
42513
+ }
42514
+ let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
42515
+ let $1e5a04cdaf7d1af8$var$listeners = new Set();
42516
+ function $1e5a04cdaf7d1af8$var$updateLocale() {
42517
+ $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
42518
+ for (let listener of $1e5a04cdaf7d1af8$var$listeners)listener($1e5a04cdaf7d1af8$var$currentLocale);
42519
+ }
42520
+ function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
42521
+ let isSSR = $704cf1d3b684cc5c$export$535bd6ca7f90a273();
42522
+ let [defaultLocale, setDefaultLocale] = React.useState($1e5a04cdaf7d1af8$var$currentLocale);
42523
+ React.useEffect(()=>{
42524
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
42525
+ $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
42526
+ return ()=>{
42527
+ $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
42528
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
42529
+ };
42530
+ }, []);
42531
+ // We cannot determine the browser's language on the server, so default to
42532
+ // en-US. This will be updated after hydration on the client to the correct value.
42533
+ if (isSSR) return {
42534
+ locale: 'en-US',
42535
+ direction: 'ltr'
42536
+ };
42537
+ return defaultLocale;
42538
+ }
42539
+
42540
+
42541
+
42542
+ const $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ React__default["default"].createContext(null);
42543
+ function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
42544
+ let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a();
42545
+ let context = React.useContext($18f2051aff69b9bf$var$I18nContext);
42546
+ return context || defaultLocale;
42547
+ }
42548
+
42549
+
42550
+
42551
+ let $325a3faab7a68acd$var$cache = new Map();
42552
+ function $325a3faab7a68acd$export$a16aca283550c30d(options) {
42553
+ let { locale: locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
42554
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1
42555
+ ).join() : '');
42556
+ if ($325a3faab7a68acd$var$cache.has(cacheKey)) return $325a3faab7a68acd$var$cache.get(cacheKey);
42557
+ let formatter = new Intl.Collator(locale, options);
42558
+ $325a3faab7a68acd$var$cache.set(cacheKey, formatter);
42559
+ return formatter;
42560
+ }
42561
+
42562
+ function $feb5ffebff200149$export$d3e3bd3e26688c04(e) {
42563
+ // Ctrl + Arrow Up/Arrow Down has a system wide meaning on macOS, so use Alt instead.
42564
+ // On Windows and Ubuntu, Alt + Space has a system wide meaning.
42565
+ return $c87311424ea30a05$export$e1865c3bedcd822b() ? e.altKey : e.ctrlKey;
42566
+ }
42567
+ function $feb5ffebff200149$export$16792effe837dba3(e) {
42568
+ if ($c87311424ea30a05$export$9ac100e40613ea10()) return e.metaKey;
42569
+ return e.ctrlKey;
42570
+ }
42571
+
42572
+
42573
+
42574
+
42575
+ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
42576
+ let { keyboardDelegate: keyboardDelegate , selectionManager: selectionManager , onTypeSelect: onTypeSelect } = options;
42577
+ let state = React.useRef({
42578
+ search: '',
42579
+ timeout: null
42580
+ }).current;
42581
+ let onKeyDown = (e)=>{
42582
+ let character = $fb3050f43d946246$var$getStringForKey(e.key);
42583
+ if (!character || e.ctrlKey || e.metaKey) return;
42584
+ // Do not propagate the Spacebar event if it's meant to be part of the search.
42585
+ // When we time out, the search term becomes empty, hence the check on length.
42586
+ // Trimming is to account for the case of pressing the Spacebar more than once,
42587
+ // which should cycle through the selection/deselection of the focused item.
42588
+ if (character === ' ' && state.search.trim().length > 0) {
42589
+ e.preventDefault();
42590
+ if (!('continuePropagation' in e)) e.stopPropagation();
42591
+ }
42592
+ state.search += character;
42593
+ // Use the delegate to find a key to focus.
42594
+ // Prioritize items after the currently focused item, falling back to searching the whole list.
42595
+ let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
42596
+ // If no key found, search from the top.
42597
+ if (key == null) key = keyboardDelegate.getKeyForSearch(state.search);
42598
+ if (key != null) {
42599
+ selectionManager.setFocusedKey(key);
42600
+ if (onTypeSelect) onTypeSelect(key);
42601
+ }
42602
+ clearTimeout(state.timeout);
42603
+ state.timeout = setTimeout(()=>{
42604
+ state.search = '';
42605
+ }, 500);
42606
+ };
42607
+ return {
42608
+ typeSelectProps: {
42609
+ // Using a capturing listener to catch the keydown event before
42610
+ // other hooks in order to handle the Spacebar event.
42611
+ onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null
42612
+ }
42613
+ };
42614
+ }
42615
+ function $fb3050f43d946246$var$getStringForKey(key) {
42616
+ // If the key is of length 1, it is an ASCII value.
42617
+ // Otherwise, if there are no ASCII characters in the key name,
42618
+ // it is a Unicode character.
42619
+ // See https://www.w3.org/TR/uievents-key/
42620
+ if (key.length === 1 || !/^[A-Z]/i.test(key)) return key;
42621
+ return '';
42622
+ }
42623
+
42624
+
42625
+ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
42626
+ let { selectionManager: manager , keyboardDelegate: delegate , ref: ref , autoFocus: autoFocus = false , shouldFocusWrap: shouldFocusWrap = false , disallowEmptySelection: disallowEmptySelection = false , disallowSelectAll: disallowSelectAll = false , selectOnFocus: selectOnFocus = manager.selectionBehavior === 'replace' , disallowTypeAhead: disallowTypeAhead = false , shouldUseVirtualFocus: shouldUseVirtualFocus , allowsTabNavigation: allowsTabNavigation = false , isVirtualized: isVirtualized , scrollRef: // If no scrollRef is provided, assume the collection ref is the scrollable region
42627
+ scrollRef = ref } = options;
42628
+ let { direction: direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
42629
+ let onKeyDown = (e)=>{
42630
+ // Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes
42631
+ if (e.altKey && e.key === 'Tab') e.preventDefault();
42632
+ // Keyboard events bubble through portals. Don't handle keyboard events
42633
+ // for elements outside the collection (e.g. menus).
42634
+ if (!ref.current.contains(e.target)) return;
42635
+ const navigateToKey = (key, childFocus)=>{
42636
+ if (key != null) {
42637
+ manager.setFocusedKey(key, childFocus);
42638
+ if (e.shiftKey && manager.selectionMode === 'multiple') manager.extendSelection(key);
42639
+ else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e)) manager.replaceSelection(key);
42640
+ }
42641
+ };
42642
+ switch(e.key){
42643
+ case 'ArrowDown':
42644
+ if (delegate.getKeyBelow) {
42645
+ var ref4, ref1;
42646
+ e.preventDefault();
42647
+ let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : (ref4 = delegate.getFirstKey) === null || ref4 === void 0 ? void 0 : ref4.call(delegate);
42648
+ if (nextKey == null && shouldFocusWrap) nextKey = (ref1 = delegate.getFirstKey) === null || ref1 === void 0 ? void 0 : ref1.call(delegate, manager.focusedKey);
42649
+ navigateToKey(nextKey);
42650
+ }
42651
+ break;
42652
+ case 'ArrowUp':
42653
+ if (delegate.getKeyAbove) {
42654
+ var ref2, ref3;
42655
+ e.preventDefault();
42656
+ let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : (ref2 = delegate.getLastKey) === null || ref2 === void 0 ? void 0 : ref2.call(delegate);
42657
+ if (nextKey == null && shouldFocusWrap) nextKey = (ref3 = delegate.getLastKey) === null || ref3 === void 0 ? void 0 : ref3.call(delegate, manager.focusedKey);
42658
+ navigateToKey(nextKey);
42659
+ }
42660
+ break;
42661
+ case 'ArrowLeft':
42662
+ if (delegate.getKeyLeftOf) {
42663
+ e.preventDefault();
42664
+ let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
42665
+ navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');
42666
+ }
42667
+ break;
42668
+ case 'ArrowRight':
42669
+ if (delegate.getKeyRightOf) {
42670
+ e.preventDefault();
42671
+ let nextKey = delegate.getKeyRightOf(manager.focusedKey);
42672
+ navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');
42673
+ }
42674
+ break;
42675
+ case 'Home':
42676
+ if (delegate.getFirstKey) {
42677
+ e.preventDefault();
42678
+ let firstKey = delegate.getFirstKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
42679
+ manager.setFocusedKey(firstKey);
42680
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === 'multiple') manager.extendSelection(firstKey);
42681
+ else if (selectOnFocus) manager.replaceSelection(firstKey);
42682
+ }
42683
+ break;
42684
+ case 'End':
42685
+ if (delegate.getLastKey) {
42686
+ e.preventDefault();
42687
+ let lastKey = delegate.getLastKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
42688
+ manager.setFocusedKey(lastKey);
42689
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === 'multiple') manager.extendSelection(lastKey);
42690
+ else if (selectOnFocus) manager.replaceSelection(lastKey);
42691
+ }
42692
+ break;
42693
+ case 'PageDown':
42694
+ if (delegate.getKeyPageBelow) {
42695
+ e.preventDefault();
42696
+ let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
42697
+ navigateToKey(nextKey);
42698
+ }
42699
+ break;
42700
+ case 'PageUp':
42701
+ if (delegate.getKeyPageAbove) {
42702
+ e.preventDefault();
42703
+ let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
42704
+ navigateToKey(nextKey);
42705
+ }
42706
+ break;
42707
+ case 'a':
42708
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && manager.selectionMode === 'multiple' && disallowSelectAll !== true) {
42709
+ e.preventDefault();
42710
+ manager.selectAll();
42711
+ }
42712
+ break;
42713
+ case 'Escape':
42714
+ e.preventDefault();
42715
+ if (!disallowEmptySelection) manager.clearSelection();
42716
+ break;
42717
+ case 'Tab':
42718
+ if (!allowsTabNavigation) {
42719
+ // There may be elements that are "tabbable" inside a collection (e.g. in a grid cell).
42720
+ // However, collections should be treated as a single tab stop, with arrow key navigation internally.
42721
+ // We don't control the rendering of these, so we can't override the tabIndex to prevent tabbing.
42722
+ // Instead, we handle the Tab key, and move focus manually to the first/last tabbable element
42723
+ // in the collection, so that the browser default behavior will apply starting from that element
42724
+ // rather than the currently focused one.
42725
+ if (e.shiftKey) ref.current.focus();
42726
+ else {
42727
+ let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ref.current, {
42728
+ tabbable: true
42729
+ });
42730
+ let next;
42731
+ let last;
42732
+ do {
42733
+ last = walker.lastChild();
42734
+ if (last) next = last;
42735
+ }while (last)
42736
+ if (next && !next.contains(document.activeElement)) $7215afc6de606d6b$export$de79e2c695e052f3(next);
42737
+ }
42738
+ break;
42739
+ }
42740
+ }
42741
+ };
42742
+ // Store the scroll position so we can restore it later.
42743
+ let scrollPos = React.useRef({
42744
+ top: 0,
42745
+ left: 0
42746
+ });
42747
+ $e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, 'scroll', isVirtualized ? null : ()=>{
42748
+ scrollPos.current = {
42749
+ top: scrollRef.current.scrollTop,
42750
+ left: scrollRef.current.scrollLeft
42751
+ };
42752
+ });
42753
+ let onFocus = (e)=>{
42754
+ if (manager.isFocused) {
42755
+ // If a focus event bubbled through a portal, reset focus state.
42756
+ if (!e.currentTarget.contains(e.target)) manager.setFocused(false);
42757
+ return;
42758
+ }
42759
+ // Focus events can bubble through portals. Ignore these events.
42760
+ if (!e.currentTarget.contains(e.target)) return;
42761
+ manager.setFocused(true);
42762
+ if (manager.focusedKey == null) {
42763
+ let navigateToFirstKey = (key)=>{
42764
+ if (key != null) {
42765
+ manager.setFocusedKey(key);
42766
+ if (selectOnFocus) manager.replaceSelection(key);
42767
+ }
42768
+ };
42769
+ // If the user hasn't yet interacted with the collection, there will be no focusedKey set.
42770
+ // Attempt to detect whether the user is tabbing forward or backward into the collection
42771
+ // and either focus the first or last item accordingly.
42772
+ let relatedTarget = e.relatedTarget;
42773
+ var _lastSelectedKey, _firstSelectedKey;
42774
+ if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToFirstKey((_lastSelectedKey = manager.lastSelectedKey) !== null && _lastSelectedKey !== void 0 ? _lastSelectedKey : delegate.getLastKey());
42775
+ else navigateToFirstKey((_firstSelectedKey = manager.firstSelectedKey) !== null && _firstSelectedKey !== void 0 ? _firstSelectedKey : delegate.getFirstKey());
42776
+ } else if (!isVirtualized) {
42777
+ // Restore the scroll position to what it was before.
42778
+ scrollRef.current.scrollTop = scrollPos.current.top;
42779
+ scrollRef.current.scrollLeft = scrollPos.current.left;
42780
+ // Refocus and scroll the focused item into view if it exists within the scrollable region.
42781
+ let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
42782
+ if (element) {
42783
+ // This prevents a flash of focus on the first/last element in the collection
42784
+ $7215afc6de606d6b$export$de79e2c695e052f3(element);
42785
+ $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
42786
+ }
42787
+ }
42788
+ };
42789
+ let onBlur = (e)=>{
42790
+ // Don't set blurred and then focused again if moving focus within the collection.
42791
+ if (!e.currentTarget.contains(e.relatedTarget)) manager.setFocused(false);
42792
+ };
42793
+ const autoFocusRef = React.useRef(autoFocus);
42794
+ React.useEffect(()=>{
42795
+ if (autoFocusRef.current) {
42796
+ let focusedKey = null;
42797
+ // Check focus strategy to determine which item to focus
42798
+ if (autoFocus === 'first') focusedKey = delegate.getFirstKey();
42799
+ if (autoFocus === 'last') focusedKey = delegate.getLastKey();
42800
+ // If there are any selected keys, make the first one the new focus target
42801
+ let selectedKeys = manager.selectedKeys;
42802
+ if (selectedKeys.size) focusedKey = selectedKeys.values().next().value;
42803
+ manager.setFocused(true);
42804
+ manager.setFocusedKey(focusedKey);
42805
+ // If no default focus key is selected, focus the collection itself.
42806
+ if (focusedKey == null && !shouldUseVirtualFocus) $6a99195332edec8b$export$80f3e147d781571c(ref.current);
42807
+ }
42808
+ autoFocusRef.current = false;
42809
+ // eslint-disable-next-line react-hooks/exhaustive-deps
42810
+ }, []);
42811
+ // If not virtualized, scroll the focused element into view when the focusedKey changes.
42812
+ // When virtualized, Virtualizer handles this internally.
42813
+ React.useEffect(()=>{
42814
+ if (!isVirtualized && manager.focusedKey && (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
42815
+ let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
42816
+ if (element) $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
42817
+ }
42818
+ }, [
42819
+ isVirtualized,
42820
+ scrollRef,
42821
+ manager.focusedKey
42822
+ ]);
42823
+ let handlers = {
42824
+ onKeyDown: onKeyDown,
42825
+ onFocus: onFocus,
42826
+ onBlur: onBlur,
42827
+ onMouseDown (e) {
42828
+ // Ignore events that bubbled through portals.
42829
+ if (e.currentTarget.contains(e.target)) // Prevent focus going to the collection when clicking on the scrollbar.
42830
+ e.preventDefault();
42831
+ }
42832
+ };
42833
+ let { typeSelectProps: typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8({
42834
+ keyboardDelegate: delegate,
42835
+ selectionManager: manager
42836
+ });
42837
+ if (!disallowTypeAhead) handlers = $3ef42575df84b30b$export$9d1611c77c2fe928(typeSelectProps, handlers);
42838
+ // If nothing is focused within the collection, make the collection itself tabbable.
42839
+ // This will be marshalled to either the first or last item depending on where focus came from.
42840
+ // If using virtual focus, don't set a tabIndex at all so that VoiceOver on iOS 14 doesn't try
42841
+ // to move real DOM focus to the element anyway.
42842
+ let tabIndex;
42843
+ if (!shouldUseVirtualFocus) tabIndex = manager.focusedKey == null ? 0 : -1;
42844
+ return {
42845
+ collectionProps: {
42846
+ ...handlers,
42847
+ tabIndex: tabIndex
42848
+ }
42849
+ };
42850
+ }
42851
+
42852
+
42853
+
42854
+
42855
+
42856
+
42857
+
42858
+ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
42859
+ let { selectionManager: manager , key: key , ref: ref , shouldSelectOnPressUp: shouldSelectOnPressUp , isVirtualized: isVirtualized , shouldUseVirtualFocus: shouldUseVirtualFocus , focus: focus , isDisabled: isDisabled , onAction: onAction , allowsDifferentPressOrigin: allowsDifferentPressOrigin } = options;
42860
+ let onSelect = (e)=>{
42861
+ if (e.pointerType === 'keyboard' && $feb5ffebff200149$export$d3e3bd3e26688c04(e)) manager.toggleSelection(key);
42862
+ else {
42863
+ if (manager.selectionMode === 'none') return;
42864
+ if (manager.selectionMode === 'single') {
42865
+ if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);
42866
+ else manager.replaceSelection(key);
42867
+ } else if (e && e.shiftKey) manager.extendSelection(key);
42868
+ else if (manager.selectionBehavior === 'toggle' || e && ($feb5ffebff200149$export$16792effe837dba3(e) || e.pointerType === 'touch' || e.pointerType === 'virtual')) // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys
42869
+ manager.toggleSelection(key);
42870
+ else manager.replaceSelection(key);
42871
+ }
42872
+ };
42873
+ // Focus the associated DOM node when this item becomes the focusedKey
42874
+ React.useEffect(()=>{
42875
+ let isFocused = key === manager.focusedKey;
42876
+ if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {
42877
+ if (focus) focus();
42878
+ else $6a99195332edec8b$export$80f3e147d781571c(ref.current);
42879
+ }
42880
+ }, [
42881
+ ref,
42882
+ key,
42883
+ manager.focusedKey,
42884
+ manager.childFocusStrategy,
42885
+ manager.isFocused,
42886
+ shouldUseVirtualFocus
42887
+ ]);
42888
+ // Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused
42889
+ // item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver
42890
+ // on iOS 14 doesn't try to move real DOM focus to the item anyway.
42891
+ let itemProps = {
42892
+ };
42893
+ if (!shouldUseVirtualFocus) itemProps = {
42894
+ tabIndex: key === manager.focusedKey ? 0 : -1,
42895
+ onFocus (e) {
42896
+ if (e.target === ref.current) manager.setFocusedKey(key);
42897
+ }
42898
+ };
42899
+ // With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.
42900
+ // Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.
42901
+ // With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.
42902
+ // With touch, onAction occurs on single tap, and long press enters selection mode.
42903
+ isDisabled = isDisabled || manager.isDisabled(key);
42904
+ let allowsSelection = !isDisabled && manager.canSelectItem(key);
42905
+ let allowsActions = onAction && !isDisabled;
42906
+ let hasPrimaryAction = allowsActions && (manager.selectionBehavior === 'replace' ? !allowsSelection : manager.isEmpty);
42907
+ let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';
42908
+ let hasAction = hasPrimaryAction || hasSecondaryAction;
42909
+ let modality = React.useRef(null);
42910
+ let longPressEnabled = hasAction && allowsSelection;
42911
+ let longPressEnabledOnPressStart = React.useRef(false);
42912
+ let hadPrimaryActionOnPressStart = React.useRef(false);
42913
+ // By default, selection occurs on pointer down. This can be strange if selecting an
42914
+ // item causes the UI to disappear immediately (e.g. menus).
42915
+ // If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.
42916
+ // onPress requires a pointer down event on the same element as pointer up. For menus,
42917
+ // we want to be able to have the pointer down on the trigger that opens the menu and
42918
+ // the pointer up on the menu item rather than requiring a separate press.
42919
+ // For keyboard events, selection still occurs on key down.
42920
+ let itemPressProps = {
42921
+ };
42922
+ if (shouldSelectOnPressUp) {
42923
+ itemPressProps.onPressStart = (e)=>{
42924
+ modality.current = e.pointerType;
42925
+ longPressEnabledOnPressStart.current = longPressEnabled;
42926
+ if (e.pointerType === 'keyboard' && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey())) onSelect(e);
42927
+ };
42928
+ // If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)
42929
+ // Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)
42930
+ if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e)=>{
42931
+ if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== 'mouse') {
42932
+ if (e.pointerType === 'keyboard' && !$880e95eb8b93ba9a$var$isActionKey()) return;
42933
+ onAction();
42934
+ } else if (e.pointerType !== 'keyboard') onSelect(e);
42935
+ };
42936
+ else {
42937
+ itemPressProps.onPressUp = (e)=>{
42938
+ if (e.pointerType !== 'keyboard') onSelect(e);
42939
+ };
42940
+ itemPressProps.onPress = hasPrimaryAction ? ()=>onAction()
42941
+ : null;
42942
+ }
42943
+ } else {
42944
+ itemPressProps.onPressStart = (e)=>{
42945
+ modality.current = e.pointerType;
42946
+ longPressEnabledOnPressStart.current = longPressEnabled;
42947
+ hadPrimaryActionOnPressStart.current = hasPrimaryAction;
42948
+ // Select on mouse down unless there is a primary action which will occur on mouse up.
42949
+ // For keyboard, select on key down. If there is an action, the Space key selects on key down,
42950
+ // and the Enter key performs onAction on key up.
42951
+ if (e.pointerType === 'mouse' && !hasPrimaryAction || e.pointerType === 'keyboard' && (!onAction || $880e95eb8b93ba9a$var$isSelectionKey())) onSelect(e);
42952
+ };
42953
+ itemPressProps.onPress = (e)=>{
42954
+ // Selection occurs on touch up. Primary actions always occur on pointer up.
42955
+ // Both primary and secondary actions occur on Enter key up. The only exception
42956
+ // is secondary actions, which occur on double click with a mouse.
42957
+ if (e.pointerType === 'touch' || e.pointerType === 'pen' || e.pointerType === 'virtual' || e.pointerType === 'keyboard' && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current) {
42958
+ if (hasAction) onAction();
42959
+ else onSelect(e);
42960
+ }
42961
+ };
42962
+ }
42963
+ if (!isVirtualized) itemProps['data-key'] = key;
42964
+ itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
42965
+ let { pressProps: pressProps , isPressed: isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21(itemPressProps);
42966
+ // Double clicking with a mouse with selectionBehavior = 'replace' performs an action.
42967
+ let onDoubleClick = hasSecondaryAction ? (e)=>{
42968
+ if (modality.current === 'mouse') {
42969
+ e.stopPropagation();
42970
+ e.preventDefault();
42971
+ onAction();
42972
+ }
42973
+ } : undefined;
42974
+ // Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior
42975
+ // to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to
42976
+ // selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.
42977
+ let { longPressProps: longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
42978
+ isDisabled: !longPressEnabled,
42979
+ onLongPress (e) {
42980
+ if (e.pointerType === 'touch') {
42981
+ onSelect(e);
42982
+ manager.setSelectionBehavior('toggle');
42983
+ }
42984
+ }
42985
+ });
42986
+ // Prevent native drag and drop on long press if we also select on long press.
42987
+ // Once the user is in selection mode, they can long press again to drag.
42988
+ let onDragStart = (e)=>{
42989
+ if (modality.current === 'touch' && longPressEnabledOnPressStart.current) e.preventDefault();
42990
+ };
42991
+ return {
42992
+ itemProps: $3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, allowsSelection || hasPrimaryAction ? pressProps : {
42993
+ }, longPressEnabled ? longPressProps : {
42994
+ }, {
42995
+ onDoubleClick: onDoubleClick,
42996
+ onDragStart: onDragStart
42997
+ }),
42998
+ isPressed: isPressed,
42999
+ isSelected: manager.isSelected(key),
43000
+ isDisabled: isDisabled,
43001
+ allowsSelection: allowsSelection,
43002
+ hasAction: hasAction
43003
+ };
43004
+ }
43005
+ function $880e95eb8b93ba9a$var$isActionKey() {
43006
+ let event = window.event;
43007
+ return (event === null || event === void 0 ? void 0 : event.key) === 'Enter';
43008
+ }
43009
+ function $880e95eb8b93ba9a$var$isSelectionKey() {
43010
+ let event = window.event;
43011
+ return (event === null || event === void 0 ? void 0 : event.key) === ' ' || (event === null || event === void 0 ? void 0 : event.code) === 'Space';
43012
+ }
43013
+
43014
+
43015
+
43016
+ class $2a25aae57d74318e$export$a05409b8bb224a5a {
43017
+ getKeyBelow(key) {
43018
+ key = this.collection.getKeyAfter(key);
43019
+ while(key != null){
43020
+ let item = this.collection.getItem(key);
43021
+ if (item.type === 'item' && !this.disabledKeys.has(key)) return key;
43022
+ key = this.collection.getKeyAfter(key);
43023
+ }
43024
+ }
43025
+ getKeyAbove(key) {
43026
+ key = this.collection.getKeyBefore(key);
43027
+ while(key != null){
43028
+ let item = this.collection.getItem(key);
43029
+ if (item.type === 'item' && !this.disabledKeys.has(key)) return key;
43030
+ key = this.collection.getKeyBefore(key);
43031
+ }
43032
+ }
43033
+ getFirstKey() {
43034
+ let key = this.collection.getFirstKey();
43035
+ while(key != null){
43036
+ let item = this.collection.getItem(key);
43037
+ if (item.type === 'item' && !this.disabledKeys.has(key)) return key;
43038
+ key = this.collection.getKeyAfter(key);
43039
+ }
43040
+ }
43041
+ getLastKey() {
43042
+ let key = this.collection.getLastKey();
43043
+ while(key != null){
43044
+ let item = this.collection.getItem(key);
43045
+ if (item.type === 'item' && !this.disabledKeys.has(key)) return key;
43046
+ key = this.collection.getKeyBefore(key);
43047
+ }
43048
+ }
43049
+ getItem(key) {
43050
+ return this.ref.current.querySelector(`[data-key="${key}"]`);
43051
+ }
43052
+ getKeyPageAbove(key) {
43053
+ let menu = this.ref.current;
43054
+ let item = this.getItem(key);
43055
+ if (!item) return null;
43056
+ let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);
43057
+ while(item && item.offsetTop > pageY){
43058
+ key = this.getKeyAbove(key);
43059
+ item = this.getItem(key);
43060
+ }
43061
+ return key;
43062
+ }
43063
+ getKeyPageBelow(key) {
43064
+ let menu = this.ref.current;
43065
+ let item = this.getItem(key);
43066
+ if (!item) return null;
43067
+ let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);
43068
+ while(item && item.offsetTop < pageY){
43069
+ key = this.getKeyBelow(key);
43070
+ item = this.getItem(key);
43071
+ }
43072
+ return key;
43073
+ }
43074
+ getKeyForSearch(search, fromKey) {
43075
+ if (!this.collator) return null;
43076
+ let collection = this.collection;
43077
+ let key = fromKey || this.getFirstKey();
43078
+ while(key != null){
43079
+ let item = collection.getItem(key);
43080
+ let substring = item.textValue.slice(0, search.length);
43081
+ if (item.textValue && this.collator.compare(substring, search) === 0) return key;
43082
+ key = this.getKeyBelow(key);
43083
+ }
43084
+ return null;
43085
+ }
43086
+ constructor(collection, disabledKeys, ref, collator){
43087
+ this.collection = collection;
43088
+ this.disabledKeys = disabledKeys;
43089
+ this.ref = ref;
43090
+ this.collator = collator;
43091
+ }
43092
+ }
43093
+
43094
+
43095
+
43096
+
43097
+ function $982254629710d113$export$b95089534ab7c1fd(props) {
43098
+ let { selectionManager: selectionManager , collection: collection , disabledKeys: disabledKeys , ref: ref , keyboardDelegate: keyboardDelegate , autoFocus: autoFocus , shouldFocusWrap: shouldFocusWrap , isVirtualized: isVirtualized , disallowEmptySelection: disallowEmptySelection , selectOnFocus: selectOnFocus = selectionManager.selectionBehavior === 'replace' , disallowTypeAhead: disallowTypeAhead , shouldUseVirtualFocus: shouldUseVirtualFocus , allowsTabNavigation: allowsTabNavigation } = props;
43099
+ // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
43100
+ // When virtualized, the layout object will be passed in as a prop and override this.
43101
+ let collator = $325a3faab7a68acd$export$a16aca283550c30d({
43102
+ usage: 'search',
43103
+ sensitivity: 'base'
43104
+ });
43105
+ let delegate = React.useMemo(()=>keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a(collection, disabledKeys, ref, collator)
43106
+ , [
43107
+ keyboardDelegate,
43108
+ collection,
43109
+ disabledKeys,
43110
+ ref,
43111
+ collator
43112
+ ]);
43113
+ let { collectionProps: collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
43114
+ ref: ref,
43115
+ selectionManager: selectionManager,
43116
+ keyboardDelegate: delegate,
43117
+ autoFocus: autoFocus,
43118
+ shouldFocusWrap: shouldFocusWrap,
43119
+ disallowEmptySelection: disallowEmptySelection,
43120
+ selectOnFocus: selectOnFocus,
43121
+ disallowTypeAhead: disallowTypeAhead,
43122
+ shouldUseVirtualFocus: shouldUseVirtualFocus,
43123
+ allowsTabNavigation: allowsTabNavigation,
43124
+ isVirtualized: isVirtualized,
43125
+ scrollRef: ref
43126
+ });
43127
+ return {
43128
+ listProps: collectionProps
43129
+ };
43130
+ }
43131
+
43132
+ const $b1f0cad8af73213b$export$3585ede4d035bf14 = new WeakMap();
43133
+ function $b1f0cad8af73213b$var$normalizeKey(key) {
43134
+ if (typeof key === 'string') return key.replace(/\s*/g, '');
43135
+ return '' + key;
43136
+ }
43137
+ function $b1f0cad8af73213b$export$9145995848b05025(state, itemKey) {
43138
+ let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
43139
+ if (!data) throw new Error('Unknown list');
43140
+ return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey(itemKey)}`;
43141
+ }
43142
+
43143
+
43144
+
43145
+
43146
+
43147
+
43148
+ function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
43149
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
43150
+ labelable: true
43151
+ });
43152
+ let { listProps: listProps } = $982254629710d113$export$b95089534ab7c1fd({
43153
+ ...props,
43154
+ ref: ref,
43155
+ selectionManager: state.selectionManager,
43156
+ collection: state.collection,
43157
+ disabledKeys: state.disabledKeys
43158
+ });
43159
+ let { focusWithinProps: focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
43160
+ onFocusWithin: props.onFocus,
43161
+ onBlurWithin: props.onBlur,
43162
+ onFocusWithinChange: props.onFocusChange
43163
+ });
43164
+ // Share list id and some props with child options.
43165
+ let id = $bdb11010cef70236$export$f680877a34711e37(props.id);
43166
+ $b1f0cad8af73213b$export$3585ede4d035bf14.set(state, {
43167
+ id: id,
43168
+ shouldUseVirtualFocus: props.shouldUseVirtualFocus,
43169
+ shouldSelectOnPressUp: props.shouldSelectOnPressUp,
43170
+ shouldFocusOnHover: props.shouldFocusOnHover,
43171
+ isVirtualized: props.isVirtualized
43172
+ });
43173
+ let { labelProps: labelProps , fieldProps: fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f({
43174
+ ...props,
43175
+ id: id,
43176
+ // listbox is not an HTML input element so it
43177
+ // shouldn't be labeled by a <label> element.
43178
+ labelElementType: 'span'
43179
+ });
43180
+ return {
43181
+ labelProps: labelProps,
43182
+ listBoxProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, focusWithinProps, state.selectionManager.selectionMode === 'multiple' ? {
43183
+ 'aria-multiselectable': 'true'
43184
+ } : {
43185
+ }, {
43186
+ role: 'listbox',
43187
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(fieldProps, listProps)
43188
+ })
43189
+ };
43190
+ }
43191
+
43192
+
43193
+
43194
+
43195
+
43196
+
43197
+
43198
+ function $293f70390ea03370$export$497855f14858aa34(props, state, ref) {
43199
+ let { key: key } = props;
43200
+ let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
43201
+ var _isDisabled;
43202
+ let isDisabled = (_isDisabled = props.isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : state.disabledKeys.has(key);
43203
+ var _isSelected;
43204
+ let isSelected = (_isSelected = props.isSelected) !== null && _isSelected !== void 0 ? _isSelected : state.selectionManager.isSelected(key);
43205
+ let isFocused = state.selectionManager.focusedKey === key;
43206
+ var _shouldSelectOnPressUp;
43207
+ let shouldSelectOnPressUp = (_shouldSelectOnPressUp = props.shouldSelectOnPressUp) !== null && _shouldSelectOnPressUp !== void 0 ? _shouldSelectOnPressUp : data.shouldSelectOnPressUp;
43208
+ var _shouldFocusOnHover;
43209
+ let shouldFocusOnHover = (_shouldFocusOnHover = props.shouldFocusOnHover) !== null && _shouldFocusOnHover !== void 0 ? _shouldFocusOnHover : data.shouldFocusOnHover;
43210
+ var _shouldUseVirtualFocus;
43211
+ let shouldUseVirtualFocus = (_shouldUseVirtualFocus = props.shouldUseVirtualFocus) !== null && _shouldUseVirtualFocus !== void 0 ? _shouldUseVirtualFocus : data.shouldUseVirtualFocus;
43212
+ var _isVirtualized;
43213
+ let isVirtualized = (_isVirtualized = props.isVirtualized) !== null && _isVirtualized !== void 0 ? _isVirtualized : data.isVirtualized;
43214
+ let labelId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
43215
+ let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
43216
+ let optionProps = {
43217
+ role: 'option',
43218
+ 'aria-disabled': isDisabled,
43219
+ 'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined
43220
+ };
43221
+ // Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply "text".
43222
+ // We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.
43223
+ // https://bugs.webkit.org/show_bug.cgi?id=209279
43224
+ if (!($c87311424ea30a05$export$9ac100e40613ea10() && $c87311424ea30a05$export$78551043582a6a98())) {
43225
+ optionProps['aria-label'] = props['aria-label'];
43226
+ optionProps['aria-labelledby'] = labelId;
43227
+ optionProps['aria-describedby'] = descriptionId;
43228
+ }
43229
+ if (isVirtualized) {
43230
+ optionProps['aria-posinset'] = state.collection.getItem(key).index + 1;
43231
+ optionProps['aria-setsize'] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
43232
+ }
43233
+ let { itemProps: itemProps , isPressed: isPressed } = $880e95eb8b93ba9a$export$ecf600387e221c37({
43234
+ selectionManager: state.selectionManager,
43235
+ key: key,
43236
+ ref: ref,
43237
+ shouldSelectOnPressUp: shouldSelectOnPressUp,
43238
+ allowsDifferentPressOrigin: shouldSelectOnPressUp,
43239
+ isVirtualized: isVirtualized,
43240
+ shouldUseVirtualFocus: shouldUseVirtualFocus,
43241
+ isDisabled: isDisabled
43242
+ });
43243
+ let { hoverProps: hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
43244
+ isDisabled: isDisabled || !shouldFocusOnHover,
43245
+ onHoverStart () {
43246
+ if (!$507fabe10e71c6fb$export$b9b3dfddab17db27()) {
43247
+ state.selectionManager.setFocused(true);
43248
+ state.selectionManager.setFocusedKey(key);
43249
+ }
43250
+ }
43251
+ });
43252
+ return {
43253
+ optionProps: {
43254
+ ...optionProps,
43255
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, hoverProps),
43256
+ id: $b1f0cad8af73213b$export$9145995848b05025(state, key)
43257
+ },
43258
+ labelProps: {
43259
+ id: labelId
43260
+ },
43261
+ descriptionProps: {
43262
+ id: descriptionId
43263
+ },
43264
+ isFocused: isFocused,
43265
+ isSelected: isSelected,
43266
+ isDisabled: isDisabled,
43267
+ isPressed: isPressed
43268
+ };
43269
+ }
43270
+
43271
+ function LuiListBoxItem({ node, state, renderer, }) {
43272
+ const ref = React.useRef(null);
43273
+ const { optionProps, isSelected, isDisabled } = $293f70390ea03370$export$497855f14858aa34({ key: node.key }, state, ref);
43274
+ const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f();
43275
+ return (React__default["default"].createElement("li", { ref: ref, ...$3ef42575df84b30b$export$9d1611c77c2fe928(optionProps, focusProps), className: clsx('LuiListBoxItem', isSelected && 'LuiListBoxItem-selected', isDisabled && 'LuiListBoxItem-disabled') }, renderer
43276
+ ? renderer({ item: node.value, isDisabled, isSelected, isFocusVisible })
43277
+ : node.rendered));
43278
+ }
43279
+
43280
+ function DefaultItemRenderer({ item, }) {
43281
+ if (!item.hasOwnProperty('label')) {
43282
+ throw Error('Could not find `label` property on item, please provide a custom `itemRenderer`');
43283
+ }
43284
+ return React__default["default"].createElement(React__default["default"].Fragment, null, item.label);
43285
+ }
43286
+
43287
+ class $e40ea825a81a3709$export$52baac22726c72bf extends Set {
43288
+ constructor(keys, anchorKey, currentKey){
43289
+ super(keys);
43290
+ if (keys instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
43291
+ this.anchorKey = anchorKey || keys.anchorKey;
43292
+ this.currentKey = currentKey || keys.currentKey;
43293
+ } else {
43294
+ this.anchorKey = anchorKey;
43295
+ this.currentKey = currentKey;
43296
+ }
43297
+ }
43298
+ }
43299
+
43300
+
43301
+
43302
+ function $7af3f5b51489e0b5$var$equalSets(setA, setB) {
43303
+ if (setA.size !== setB.size) return false;
43304
+ for (let item of setA){
43305
+ if (!setB.has(item)) return false;
43306
+ }
43307
+ return true;
43308
+ }
43309
+ function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
43310
+ let { selectionMode: selectionMode = 'none' , disallowEmptySelection: disallowEmptySelection , allowDuplicateSelectionEvents: allowDuplicateSelectionEvents , selectionBehavior: selectionBehaviorProp = 'toggle' , disabledBehavior: disabledBehavior = 'all' } = props;
43311
+ // We want synchronous updates to `isFocused` and `focusedKey` after their setters are called.
43312
+ // But we also need to trigger a react re-render. So, we have both a ref (sync) and state (async).
43313
+ let isFocusedRef = React.useRef(false);
43314
+ let [, setFocused] = React.useState(false);
43315
+ let focusedKeyRef = React.useRef(null);
43316
+ let childFocusStrategyRef = React.useRef(null);
43317
+ let [, setFocusedKey] = React.useState(null);
43318
+ let selectedKeysProp = React.useMemo(()=>$7af3f5b51489e0b5$var$convertSelection(props.selectedKeys)
43319
+ , [
43320
+ props.selectedKeys
43321
+ ]);
43322
+ let defaultSelectedKeys = React.useMemo(()=>$7af3f5b51489e0b5$var$convertSelection(props.defaultSelectedKeys, new $e40ea825a81a3709$export$52baac22726c72bf())
43323
+ , [
43324
+ props.defaultSelectedKeys
43325
+ ]);
43326
+ let [selectedKeys, setSelectedKeys] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
43327
+ let disabledKeysProp = React.useMemo(()=>props.disabledKeys ? new Set(props.disabledKeys) : new Set()
43328
+ , [
43329
+ props.disabledKeys
43330
+ ]);
43331
+ let [selectionBehavior, setSelectionBehavior] = React.useState(selectionBehaviorProp);
43332
+ // If the selectionBehavior prop is set to replace, but the current state is toggle (e.g. due to long press
43333
+ // to enter selection mode on touch), and the selection becomes empty, reset the selection behavior.
43334
+ if (selectionBehaviorProp === 'replace' && selectionBehavior === 'toggle' && typeof selectedKeys === 'object' && selectedKeys.size === 0) setSelectionBehavior('replace');
43335
+ // If the selectionBehavior prop changes, update the state as well.
43336
+ let lastSelectionBehavior = React.useRef(selectionBehaviorProp);
43337
+ React.useEffect(()=>{
43338
+ if (selectionBehaviorProp !== lastSelectionBehavior.current) {
43339
+ setSelectionBehavior(selectionBehaviorProp);
43340
+ lastSelectionBehavior.current = selectionBehaviorProp;
43341
+ }
43342
+ }, [
43343
+ selectionBehaviorProp
43344
+ ]);
43345
+ return {
43346
+ selectionMode: selectionMode,
43347
+ disallowEmptySelection: disallowEmptySelection,
43348
+ selectionBehavior: selectionBehavior,
43349
+ setSelectionBehavior: setSelectionBehavior,
43350
+ get isFocused () {
43351
+ return isFocusedRef.current;
43352
+ },
43353
+ setFocused (f) {
43354
+ isFocusedRef.current = f;
43355
+ setFocused(f);
43356
+ },
43357
+ get focusedKey () {
43358
+ return focusedKeyRef.current;
43359
+ },
43360
+ get childFocusStrategy () {
43361
+ return childFocusStrategyRef.current;
43362
+ },
43363
+ setFocusedKey (k, childFocusStrategy = 'first') {
43364
+ focusedKeyRef.current = k;
43365
+ childFocusStrategyRef.current = childFocusStrategy;
43366
+ setFocusedKey(k);
43367
+ },
43368
+ selectedKeys: selectedKeys,
43369
+ setSelectedKeys (keys) {
43370
+ if (allowDuplicateSelectionEvents || !$7af3f5b51489e0b5$var$equalSets(keys, selectedKeys)) setSelectedKeys(keys);
43371
+ },
43372
+ disabledKeys: disabledKeysProp,
43373
+ disabledBehavior: disabledBehavior
43374
+ };
43375
+ }
43376
+ function $7af3f5b51489e0b5$var$convertSelection(selection, defaultValue) {
43377
+ if (!selection) return defaultValue;
43378
+ return selection === 'all' ? 'all' : new $e40ea825a81a3709$export$52baac22726c72bf(selection);
43379
+ }
43380
+
43381
+
43382
+
43383
+ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
43384
+ /**
43385
+ * The type of selection that is allowed in the collection.
43386
+ */ get selectionMode() {
43387
+ return this.state.selectionMode;
43388
+ }
43389
+ /**
43390
+ * Whether the collection allows empty selection.
43391
+ */ get disallowEmptySelection() {
43392
+ return this.state.disallowEmptySelection;
43393
+ }
43394
+ /**
43395
+ * The selection behavior for the collection.
43396
+ */ get selectionBehavior() {
43397
+ return this.state.selectionBehavior;
43398
+ }
43399
+ /**
43400
+ * Sets the selection behavior for the collection.
43401
+ */ setSelectionBehavior(selectionBehavior) {
43402
+ this.state.setSelectionBehavior(selectionBehavior);
43403
+ }
43404
+ /**
43405
+ * Whether the collection is currently focused.
43406
+ */ get isFocused() {
43407
+ return this.state.isFocused;
43408
+ }
43409
+ /**
43410
+ * Sets whether the collection is focused.
43411
+ */ setFocused(isFocused) {
43412
+ this.state.setFocused(isFocused);
43413
+ }
43414
+ /**
43415
+ * The current focused key in the collection.
43416
+ */ get focusedKey() {
43417
+ return this.state.focusedKey;
43418
+ }
43419
+ /** Whether the first or last child of the focused key should receive focus. */ get childFocusStrategy() {
43420
+ return this.state.childFocusStrategy;
43421
+ }
43422
+ /**
43423
+ * Sets the focused key.
43424
+ */ setFocusedKey(key, childFocusStrategy) {
43425
+ this.state.setFocusedKey(key, childFocusStrategy);
43426
+ }
43427
+ /**
43428
+ * The currently selected keys in the collection.
43429
+ */ get selectedKeys() {
43430
+ return this.state.selectedKeys === 'all' ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
43431
+ }
43432
+ /**
43433
+ * The raw selection value for the collection.
43434
+ * Either 'all' for select all, or a set of keys.
43435
+ */ get rawSelection() {
43436
+ return this.state.selectedKeys;
43437
+ }
43438
+ /**
43439
+ * Returns whether a key is selected.
43440
+ */ isSelected(key) {
43441
+ if (this.state.selectionMode === 'none') return false;
43442
+ key = this.getKey(key);
43443
+ return this.state.selectedKeys === 'all' ? this.canSelectItem(key) : this.state.selectedKeys.has(key);
43444
+ }
43445
+ /**
43446
+ * Whether the selection is empty.
43447
+ */ get isEmpty() {
43448
+ return this.state.selectedKeys !== 'all' && this.state.selectedKeys.size === 0;
43449
+ }
43450
+ /**
43451
+ * Whether all items in the collection are selected.
43452
+ */ get isSelectAll() {
43453
+ if (this.isEmpty) return false;
43454
+ if (this.state.selectedKeys === 'all') return true;
43455
+ if (this._isSelectAll != null) return this._isSelectAll;
43456
+ let allKeys = this.getSelectAllKeys();
43457
+ let selectedKeys = this.state.selectedKeys;
43458
+ this._isSelectAll = allKeys.every((k)=>selectedKeys.has(k)
43459
+ );
43460
+ return this._isSelectAll;
43461
+ }
43462
+ get firstSelectedKey() {
43463
+ let first = null;
43464
+ for (let key of this.state.selectedKeys){
43465
+ let item = this.collection.getItem(key);
43466
+ if (!first || (item === null || item === void 0 ? void 0 : item.index) < first.index) first = item;
43467
+ }
43468
+ return first === null || first === void 0 ? void 0 : first.key;
43469
+ }
43470
+ get lastSelectedKey() {
43471
+ let last = null;
43472
+ for (let key of this.state.selectedKeys){
43473
+ let item = this.collection.getItem(key);
43474
+ if (!last || (item === null || item === void 0 ? void 0 : item.index) > last.index) last = item;
43475
+ }
43476
+ return last === null || last === void 0 ? void 0 : last.key;
43477
+ }
43478
+ get disabledKeys() {
43479
+ return this.state.disabledKeys;
43480
+ }
43481
+ get disabledBehavior() {
43482
+ return this.state.disabledBehavior;
43483
+ }
43484
+ /**
43485
+ * Extends the selection to the given key.
43486
+ */ extendSelection(toKey) {
43487
+ if (this.selectionMode === 'none') return;
43488
+ if (this.selectionMode === 'single') {
43489
+ this.replaceSelection(toKey);
43490
+ return;
43491
+ }
43492
+ toKey = this.getKey(toKey);
43493
+ let selection;
43494
+ // Only select the one key if coming from a select all.
43495
+ if (this.state.selectedKeys === 'all') selection = new $e40ea825a81a3709$export$52baac22726c72bf([
43496
+ toKey
43497
+ ], toKey, toKey);
43498
+ else {
43499
+ let selectedKeys = this.state.selectedKeys;
43500
+ let anchorKey = selectedKeys.anchorKey || toKey;
43501
+ selection = new $e40ea825a81a3709$export$52baac22726c72bf(selectedKeys, anchorKey, toKey);
43502
+ for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey))selection.delete(key);
43503
+ for (let key1 of this.getKeyRange(toKey, anchorKey))if (this.canSelectItem(key1)) selection.add(key1);
43504
+ }
43505
+ this.state.setSelectedKeys(selection);
43506
+ }
43507
+ getKeyRange(from, to) {
43508
+ let fromItem = this.collection.getItem(from);
43509
+ let toItem = this.collection.getItem(to);
43510
+ if (fromItem && toItem) {
43511
+ if (fromItem.index <= toItem.index) return this.getKeyRangeInternal(from, to);
43512
+ return this.getKeyRangeInternal(to, from);
43513
+ }
43514
+ return [];
43515
+ }
43516
+ getKeyRangeInternal(from, to) {
43517
+ let keys = [];
43518
+ let key = from;
43519
+ while(key){
43520
+ let item = this.collection.getItem(key);
43521
+ if (item && item.type === 'item' || item.type === 'cell' && this.allowsCellSelection) keys.push(key);
43522
+ if (key === to) return keys;
43523
+ key = this.collection.getKeyAfter(key);
43524
+ }
43525
+ return [];
43526
+ }
43527
+ getKey(key) {
43528
+ let item = this.collection.getItem(key);
43529
+ if (!item) // ¯\_(ツ)_/¯
43530
+ return key;
43531
+ // If cell selection is allowed, just return the key.
43532
+ if (item.type === 'cell' && this.allowsCellSelection) return key;
43533
+ // Find a parent item to select
43534
+ while(item.type !== 'item' && item.parentKey != null)item = this.collection.getItem(item.parentKey);
43535
+ if (!item || item.type !== 'item') return null;
43536
+ return item.key;
43537
+ }
43538
+ /**
43539
+ * Toggles whether the given key is selected.
43540
+ */ toggleSelection(key) {
43541
+ if (this.selectionMode === 'none') return;
43542
+ if (this.selectionMode === 'single' && !this.isSelected(key)) {
43543
+ this.replaceSelection(key);
43544
+ return;
43545
+ }
43546
+ key = this.getKey(key);
43547
+ if (key == null) return;
43548
+ let keys = new $e40ea825a81a3709$export$52baac22726c72bf(this.state.selectedKeys === 'all' ? this.getSelectAllKeys() : this.state.selectedKeys);
43549
+ if (keys.has(key)) keys.delete(key);
43550
+ else if (this.canSelectItem(key)) {
43551
+ keys.add(key);
43552
+ keys.anchorKey = key;
43553
+ keys.currentKey = key;
43554
+ }
43555
+ if (this.disallowEmptySelection && keys.size === 0) return;
43556
+ this.state.setSelectedKeys(keys);
43557
+ }
43558
+ /**
43559
+ * Replaces the selection with only the given key.
43560
+ */ replaceSelection(key) {
43561
+ if (this.selectionMode === 'none') return;
43562
+ key = this.getKey(key);
43563
+ if (key == null) return;
43564
+ let selection = this.canSelectItem(key) ? new $e40ea825a81a3709$export$52baac22726c72bf([
43565
+ key
43566
+ ], key, key) : new $e40ea825a81a3709$export$52baac22726c72bf();
43567
+ this.state.setSelectedKeys(selection);
43568
+ }
43569
+ /**
43570
+ * Replaces the selection with the given keys.
43571
+ */ setSelectedKeys(keys) {
43572
+ if (this.selectionMode === 'none') return;
43573
+ let selection = new $e40ea825a81a3709$export$52baac22726c72bf();
43574
+ for (let key of keys){
43575
+ key = this.getKey(key);
43576
+ if (key != null) {
43577
+ selection.add(key);
43578
+ if (this.selectionMode === 'single') break;
43579
+ }
43580
+ }
43581
+ this.state.setSelectedKeys(selection);
43582
+ }
43583
+ getSelectAllKeys() {
43584
+ let keys = [];
43585
+ let addKeys = (key)=>{
43586
+ while(key){
43587
+ if (this.canSelectItem(key)) {
43588
+ let item = this.collection.getItem(key);
43589
+ if (item.type === 'item') keys.push(key);
43590
+ // Add child keys. If cell selection is allowed, then include item children too.
43591
+ if (item.hasChildNodes && (this.allowsCellSelection || item.type !== 'item')) addKeys([
43592
+ ...item.childNodes
43593
+ ][0].key);
43594
+ }
43595
+ key = this.collection.getKeyAfter(key);
43596
+ }
43597
+ };
43598
+ addKeys(this.collection.getFirstKey());
43599
+ return keys;
43600
+ }
43601
+ /**
43602
+ * Selects all items in the collection.
43603
+ */ selectAll() {
43604
+ if (this.selectionMode === 'multiple') this.state.setSelectedKeys('all');
43605
+ }
43606
+ /**
43607
+ * Removes all keys from the selection.
43608
+ */ clearSelection() {
43609
+ if (!this.disallowEmptySelection && (this.state.selectedKeys === 'all' || this.state.selectedKeys.size > 0)) this.state.setSelectedKeys(new $e40ea825a81a3709$export$52baac22726c72bf());
43610
+ }
43611
+ /**
43612
+ * Toggles between select all and an empty selection.
43613
+ */ toggleSelectAll() {
43614
+ if (this.isSelectAll) this.clearSelection();
43615
+ else this.selectAll();
43616
+ }
43617
+ select(key, e) {
43618
+ if (this.selectionMode === 'none') return;
43619
+ if (this.selectionMode === 'single') {
43620
+ if (this.isSelected(key) && !this.disallowEmptySelection) this.toggleSelection(key);
43621
+ else this.replaceSelection(key);
43622
+ } else if (this.selectionBehavior === 'toggle' || e && (e.pointerType === 'touch' || e.pointerType === 'virtual')) // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys
43623
+ this.toggleSelection(key);
43624
+ else this.replaceSelection(key);
43625
+ }
43626
+ /**
43627
+ * Returns whether the current selection is equal to the given selection.
43628
+ */ isSelectionEqual(selection) {
43629
+ if (selection === this.state.selectedKeys) return true;
43630
+ // Check if the set of keys match.
43631
+ let selectedKeys = this.selectedKeys;
43632
+ if (selection.size !== selectedKeys.size) return false;
43633
+ for (let key of selection){
43634
+ if (!selectedKeys.has(key)) return false;
43635
+ }
43636
+ for (let key2 of selectedKeys){
43637
+ if (!selection.has(key2)) return false;
43638
+ }
43639
+ return true;
43640
+ }
43641
+ canSelectItem(key) {
43642
+ if (this.state.selectionMode === 'none' || this.state.disabledKeys.has(key)) return false;
43643
+ let item = this.collection.getItem(key);
43644
+ if (!item || item.type === 'cell' && !this.allowsCellSelection) return false;
43645
+ return true;
43646
+ }
43647
+ isDisabled(key) {
43648
+ return this.state.disabledKeys.has(key) && this.state.disabledBehavior === 'all';
43649
+ }
43650
+ constructor(collection, state, options){
43651
+ this.collection = collection;
43652
+ this.state = state;
43653
+ var ref;
43654
+ this.allowsCellSelection = (ref = options === null || options === void 0 ? void 0 : options.allowsCellSelection) !== null && ref !== void 0 ? ref : false;
43655
+ this._isSelectAll = null;
43656
+ }
43657
+ }
43658
+
43659
+ var tmp = Symbol.iterator;
43660
+ class $a02d57049d202695$export$d085fb9e920b5ca7 {
43661
+ *[tmp]() {
43662
+ yield* this.iterable;
43663
+ }
43664
+ get size() {
43665
+ return this.keyMap.size;
43666
+ }
43667
+ getKeys() {
43668
+ return this.keyMap.keys();
43669
+ }
43670
+ getKeyBefore(key) {
43671
+ let node = this.keyMap.get(key);
43672
+ return node ? node.prevKey : null;
43673
+ }
43674
+ getKeyAfter(key) {
43675
+ let node = this.keyMap.get(key);
43676
+ return node ? node.nextKey : null;
43677
+ }
43678
+ getFirstKey() {
43679
+ return this.firstKey;
43680
+ }
43681
+ getLastKey() {
43682
+ return this.lastKey;
43683
+ }
43684
+ getItem(key) {
43685
+ return this.keyMap.get(key);
43686
+ }
43687
+ at(idx) {
43688
+ const keys = [
43689
+ ...this.getKeys()
43690
+ ];
43691
+ return this.getItem(keys[idx]);
43692
+ }
43693
+ constructor(nodes){
43694
+ this.keyMap = new Map();
43695
+ this.iterable = nodes;
43696
+ let visit = (node)=>{
43697
+ this.keyMap.set(node.key, node);
43698
+ if (node.childNodes && node.type === 'section') for (let child of node.childNodes)visit(child);
43699
+ };
43700
+ for (let node2 of nodes)visit(node2);
43701
+ let last;
43702
+ let index = 0;
43703
+ for (let [key, node1] of this.keyMap){
43704
+ if (last) {
43705
+ last.nextKey = key;
43706
+ node1.prevKey = last.key;
43707
+ } else {
43708
+ this.firstKey = key;
43709
+ node1.prevKey = undefined;
43710
+ }
43711
+ if (node1.type === 'item') node1.index = index++;
43712
+ last = node1;
43713
+ // Set nextKey as undefined since this might be the last node
43714
+ // If it isn't the last node, last.nextKey will properly set at start of new loop
43715
+ last.nextKey = undefined;
43716
+ }
43717
+ this.lastKey = last === null || last === void 0 ? void 0 : last.key;
43718
+ }
43719
+ }
43720
+
43721
+
43722
+
43723
+
43724
+ function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
43725
+ let { filter: filter } = props;
43726
+ let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
43727
+ let disabledKeys = React.useMemo(()=>props.disabledKeys ? new Set(props.disabledKeys) : new Set()
43728
+ , [
43729
+ props.disabledKeys
43730
+ ]);
43731
+ let factory = (nodes)=>filter ? new $a02d57049d202695$export$d085fb9e920b5ca7(filter(nodes)) : new $a02d57049d202695$export$d085fb9e920b5ca7(nodes)
43732
+ ;
43733
+ let context = React.useMemo(()=>({
43734
+ suppressTextValueWarning: props.suppressTextValueWarning
43735
+ })
43736
+ , [
43737
+ props.suppressTextValueWarning
43738
+ ]);
43739
+ let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context, [
43740
+ filter
43741
+ ]);
43742
+ // Reset focused key if that item is deleted from the collection.
43743
+ React.useEffect(()=>{
43744
+ if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey)) selectionState.setFocusedKey(null);
43745
+ }, [
43746
+ collection,
43747
+ selectionState.focusedKey
43748
+ ]);
43749
+ return {
43750
+ collection: collection,
43751
+ disabledKeys: disabledKeys,
43752
+ selectionManager: new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState)
43753
+ };
43754
+ }
43755
+
43756
+ function LuiListBox({ ariaLabel, ariaLabelledBy, itemRenderer = DefaultItemRenderer, loadingIndicator = DefaultLoadingIndicator, emptyIndicator = DefaultEmptyIndicator, selectionMode = 'single', selectionBehavior = 'toggle', disabled = false, items, value, onChange = () => {
43757
+ /* noop */
43758
+ }, getKey, ariaProps, className, ...ulProps }) {
43759
+ const listProps = React.useMemo(() => mapToAriaListBoxProps({
43760
+ selectionMode,
43761
+ selectionBehavior,
43762
+ items,
43763
+ value,
43764
+ onChange,
43765
+ getKey,
43766
+ ariaProps,
43767
+ disabled,
43768
+ }), [
43769
+ selectionMode,
43770
+ selectionBehavior,
43771
+ items,
43772
+ value,
43773
+ onChange,
43774
+ getKey,
43775
+ ariaProps,
43776
+ ]);
43777
+ const ariaListBoxProps = React.useMemo(() => ({
43778
+ 'aria-label': ariaLabel,
43779
+ 'aria-labelledby': ariaLabelledBy,
43780
+ ...listProps,
43781
+ }), [listProps, ariaLabel, ariaLabelledBy]);
43782
+ const ref = React.useRef(null);
43783
+ const state = $e72dd72e1c76a225$export$2f645645f7bca764(listProps);
43784
+ const { listBoxProps } = $c132121280ec012d$export$50eacbbf140a3141(ariaListBoxProps, state, ref);
43785
+ return (React__default["default"].createElement("ul", { ...ulProps, ...listBoxProps, ref: ref, className: clsx('LuiListBox', className) },
43786
+ !items && loadingIndicator(),
43787
+ items?.length === 0 && emptyIndicator(),
43788
+ [...state.collection].map((node) => (React__default["default"].createElement(LuiListBoxItem, { key: node.key, node: node, state: state, renderer: itemRenderer })))));
43789
+ }
43790
+ function DefaultLoadingIndicator() {
43791
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
43792
+ React__default["default"].createElement("li", { className: "LuiListBox-loadingIndicator" },
43793
+ React__default["default"].createElement(Skeleton, null)),
43794
+ React__default["default"].createElement("li", { className: "LuiListBox-loadingIndicator" },
43795
+ React__default["default"].createElement(Skeleton, null)),
43796
+ React__default["default"].createElement("li", { className: "LuiListBox-loadingIndicator" },
43797
+ React__default["default"].createElement(Skeleton, null))));
43798
+ }
43799
+ function DefaultEmptyIndicator() {
43800
+ return React__default["default"].createElement("li", { className: "LuiListBox-emptyIndicator" }, "Nothing to Display");
43801
+ }
43802
+
43803
+ var css_248z$1 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.RadioItemRenderer {\n display: flex;\n align-items: center;\n position: relative;\n padding: 0 0 0 2rem;\n}\n.RadioItemRenderer::before {\n content: \"\";\n height: 1.5rem;\n min-width: 1.5rem;\n width: 1.5rem;\n border: 2px solid #007198;\n border-radius: 50%;\n background-color: transparent;\n position: absolute;\n left: 0;\n top: 0;\n margin-right: 0.75rem;\n}\n.RadioItemRenderer:after {\n content: \"\";\n position: absolute;\n left: 5px;\n top: 5px;\n background-color: #007198;\n height: 14px;\n min-width: 14px;\n width: 14px;\n border-radius: 50%;\n opacity: 0;\n transition: opacity 0.3s ease-in-out;\n}\n.RadioItemRenderer-isSelected:after {\n opacity: 1;\n}";
43804
+ styleInject(css_248z$1);
43805
+
43806
+ function RadioItemRenderer({ item, isSelected, }) {
43807
+ return (React__default["default"].createElement("div", { className: `RadioItemRenderer ${isSelected ? 'RadioItemRenderer-isSelected' : ''}` }, item.label));
43808
+ }
43809
+
43810
+ var css_248z = ".CheckboxRenderer {\n display: flex;\n align-items: center;\n}";
43811
+ styleInject(css_248z);
43812
+
43813
+ function CheckboxItemRenderer({ item, isSelected, }) {
43814
+ return (React__default["default"].createElement("div", { className: `CheckboxRenderer ${isSelected ? 'LuiCheckboxInput--isChecked' : ''}`, style: {} },
43815
+ React__default["default"].createElement(LuiIcon, { size: "md", name: isSelected ? 'ic_check' : 'ic_zoom_out', alt: isSelected ? 'Checked' : 'Indeterminate Check', className: `LuiCheckboxInput-labelCheck ${isSelected ? 'LuiCheckboxInput--isChecked' : ''}` }),
43816
+ item.label));
43817
+ }
43818
+
43819
+ exports.CheckboxItemRenderer = CheckboxItemRenderer;
40396
43820
  exports.FIRM_KEY = FIRM_KEY;
40397
43821
  exports.FIRM_NAME_KEY = FIRM_NAME_KEY;
40398
43822
  exports.GLOBAL_CLIENT_REFERENCE_KEY = GLOBAL_CLIENT_REFERENCE_KEY;
@@ -40449,6 +43873,7 @@ exports.LuiFormikTextInput = LuiFormikTextInput;
40449
43873
  exports.LuiHeader = LuiHeader;
40450
43874
  exports.LuiHeaderMenuItem = LuiHeaderMenuItem;
40451
43875
  exports.LuiIcon = LuiIcon;
43876
+ exports.LuiListBox = LuiListBox;
40452
43877
  exports.LuiLoadingSpinner = LuiLoadingSpinner;
40453
43878
  exports.LuiLoadingSpinnerChristmas = LuiLoadingSpinnerChristmas;
40454
43879
  exports.LuiLoadingSpinnerEaster = LuiLoadingSpinnerEaster;
@@ -40482,6 +43907,7 @@ exports.LuiTextInput = LuiTextInput;
40482
43907
  exports.LuiToastMessage = LuiToastMessage;
40483
43908
  exports.LuiTooltip = LuiTooltip;
40484
43909
  exports.LuiUpdatesSplashModal = LuiUpdatesSplashModal;
43910
+ exports.RadioItemRenderer = RadioItemRenderer;
40485
43911
  exports.getDefaultSearchMenuOptions = getDefaultSearchMenuOptions;
40486
43912
  exports.isChromatic = isChromatic;
40487
43913
  exports.useClickedOutsideElement = useClickedOutsideElement;