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BACFlF,EAAEmD,iBACFmB,EAActE,GAClB,OACAmF,GAIEC,eAAgBA,IAAmB,EAAI/E,EAA6BgF,cAAc,CACpFrE,YAAamD,EACb,WAAAmB,CAAatF,GACa,UAAlBA,EAAEuB,cACFD,EAAStB,GACTU,EAAQ6E,qBAAqB,UAErC,IAWAC,EAAU9E,EAAQiB,OAAOhB,GAAQX,IACxBI,EAAsBqF,SAAUC,WAAW1F,EAAEmD,gBAAgB,OACtEgC,EACJ,MAAO,CACHvD,WAAW,EAAIxB,EAAsBuF,YAAY/D,EAAW8B,GAAmBG,GAAoB/C,EAAwBgE,EAAa,CAAC,EAAGX,EAAmBiB,EAAiB,CAAC,EAAG,CAChLH,cAAeA,EACfW,mBAXkB5F,IACG,UAArBiE,EAASlC,SAAuBqC,EAA6BrC,SAAS/B,EAAEmD,gBAAgB,EAWxFqC,QAASA,EACTiB,GAAIA,GAER3F,EAAwB,CACpBoC,YAAclD,GAAIA,EAAEmD,uBACpBgC,GACJJ,UAAWA,EACX3C,WAAY1B,EAAQ0B,WAAWzB,GAC/BkC,UAAWnC,EAAQmC,WAAanC,EAAQkC,aAAejC,EACvDK,WAAYA,EACZ0C,gBAAiBA,EACjBM,UAAWA,EAEnB,CACA,SAASY,IACL,IAAIiB,EAAQC,OAAOD,MACnB,MAAqE,WAA7DA,aAAqC,EAASA,EAAMlF,IAChE,CACA,SAAS8D,IACL,IAAIoB,EAAQC,OAAOD,MACnB,MAAqE,OAA7DA,aAAqC,EAASA,EAAMlF,MAA+E,WAA9DkF,aAAqC,EAASA,EAAME,KACrI,CAtOwB/F,EAITgG,EAAOC,QAJQhG,EAIsB,IAAMM,EAHxD2F,OAAOC,eAAenG,EAGO,oBAHD,CAACoG,IAAKnG,EAAGoG,IADNC,UACcC,YAAY,EAAMC,cAAc,G","sources":["webpack://typescript/./node_modules/@react-aria/selection/dist/useSelectableItem.main.js","webpack://typescript/./node_modules/@react-aria/grid/node_modules/@react-aria/selection/dist/useSelectableItem.main.js"],"sourcesContent":["var $ee0bdf4faa47f2a8$exports = require(\"./utils.main.js\");\nvar $i4XHw$reactariafocus = require(\"@react-aria/focus\");\nvar $i4XHw$reactariautils = require(\"@react-aria/utils\");\nvar $i4XHw$reactariainteractions = require(\"@react-aria/interactions\");\nvar $i4XHw$react = require(\"react\");\n\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n$parcel$export(module.exports, \"useSelectableItem\", () => $433b1145b0781e10$export$ecf600387e221c37);\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */ \n\n\n\n\nfunction $433b1145b0781e10$export$ecf600387e221c37(options) {\n let { selectionManager: manager, key: key, ref: ref, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldUseVirtualFocus: shouldUseVirtualFocus, focus: focus, isDisabled: isDisabled, onAction: onAction, allowsDifferentPressOrigin: allowsDifferentPressOrigin, linkBehavior: linkBehavior = 'action' } = options;\n let router = (0, $i4XHw$reactariautils.useRouter)();\n let onSelect = (e)=>{\n if (e.pointerType === 'keyboard' && (0, $ee0bdf4faa47f2a8$exports.isNonContiguousSelectionModifier)(e)) manager.toggleSelection(key);\n else {\n if (manager.selectionMode === 'none') return;\n if (manager.isLink(key)) {\n if (linkBehavior === 'selection') {\n let itemProps = manager.getItemProps(key);\n router.open(ref.current, e, itemProps.href, itemProps.routerOptions);\n // Always set selected keys back to what they were so that select and combobox close.\n manager.setSelectedKeys(manager.selectedKeys);\n return;\n } else if (linkBehavior === 'override' || linkBehavior === 'none') return;\n }\n if (manager.selectionMode === 'single') {\n if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);\n else manager.replaceSelection(key);\n } else if (e && e.shiftKey) manager.extendSelection(key);\n else if (manager.selectionBehavior === 'toggle' || e && ((0, $ee0bdf4faa47f2a8$exports.isCtrlKeyPressed)(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\n manager.toggleSelection(key);\n else manager.replaceSelection(key);\n }\n };\n // Focus the associated DOM node when this item becomes the focusedKey\n (0, $i4XHw$react.useEffect)(()=>{\n let isFocused = key === manager.focusedKey;\n if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {\n if (focus) focus();\n else if (document.activeElement !== ref.current) (0, $i4XHw$reactariafocus.focusSafely)(ref.current);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n ref,\n key,\n manager.focusedKey,\n manager.childFocusStrategy,\n manager.isFocused,\n shouldUseVirtualFocus\n ]);\n isDisabled = isDisabled || manager.isDisabled(key);\n // Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused\n // item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver\n // on iOS 14 doesn't try to move real DOM focus to the item anyway.\n let itemProps = {};\n if (!shouldUseVirtualFocus && !isDisabled) itemProps = {\n tabIndex: key === manager.focusedKey ? 0 : -1,\n onFocus (e) {\n if (e.target === ref.current) manager.setFocusedKey(key);\n }\n };\n else if (isDisabled) itemProps.onMouseDown = (e)=>{\n // Prevent focus going to the body when clicking on a disabled item.\n e.preventDefault();\n };\n // With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.\n // Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.\n // With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.\n // With touch, onAction occurs on single tap, and long press enters selection mode.\n let isLinkOverride = manager.isLink(key) && linkBehavior === 'override';\n let hasLinkAction = manager.isLink(key) && linkBehavior !== 'selection' && linkBehavior !== 'none';\n let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;\n let allowsActions = (onAction || hasLinkAction) && !isDisabled;\n let hasPrimaryAction = allowsActions && (manager.selectionBehavior === 'replace' ? !allowsSelection : !allowsSelection || manager.isEmpty);\n let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';\n let hasAction = hasPrimaryAction || hasSecondaryAction;\n let modality = (0, $i4XHw$react.useRef)(null);\n let longPressEnabled = hasAction && allowsSelection;\n let longPressEnabledOnPressStart = (0, $i4XHw$react.useRef)(false);\n let hadPrimaryActionOnPressStart = (0, $i4XHw$react.useRef)(false);\n let performAction = (e)=>{\n if (onAction) onAction();\n if (hasLinkAction) {\n let itemProps = manager.getItemProps(key);\n router.open(ref.current, e, itemProps.href, itemProps.routerOptions);\n }\n };\n // By default, selection occurs on pointer down. This can be strange if selecting an\n // item causes the UI to disappear immediately (e.g. menus).\n // If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.\n // onPress requires a pointer down event on the same element as pointer up. For menus,\n // we want to be able to have the pointer down on the trigger that opens the menu and\n // the pointer up on the menu item rather than requiring a separate press.\n // For keyboard events, selection still occurs on key down.\n let itemPressProps = {};\n if (shouldSelectOnPressUp) {\n itemPressProps.onPressStart = (e)=>{\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n if (e.pointerType === 'keyboard' && (!hasAction || $433b1145b0781e10$var$isSelectionKey())) onSelect(e);\n };\n // If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)\n // Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)\n if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e)=>{\n if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== 'mouse') {\n if (e.pointerType === 'keyboard' && !$433b1145b0781e10$var$isActionKey()) return;\n performAction(e);\n } else if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);\n };\n else {\n itemPressProps.onPressUp = hasPrimaryAction ? null : (e)=>{\n if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);\n };\n itemPressProps.onPress = hasPrimaryAction ? performAction : null;\n }\n } else {\n itemPressProps.onPressStart = (e)=>{\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n hadPrimaryActionOnPressStart.current = hasPrimaryAction;\n // Select on mouse down unless there is a primary action which will occur on mouse up.\n // For keyboard, select on key down. If there is an action, the Space key selects on key down,\n // and the Enter key performs onAction on key up.\n if (allowsSelection && (e.pointerType === 'mouse' && !hasPrimaryAction || e.pointerType === 'keyboard' && (!allowsActions || $433b1145b0781e10$var$isSelectionKey()))) onSelect(e);\n };\n itemPressProps.onPress = (e)=>{\n // Selection occurs on touch up. Primary actions always occur on pointer up.\n // Both primary and secondary actions occur on Enter key up. The only exception\n // is secondary actions, which occur on double click with a mouse.\n if (e.pointerType === 'touch' || e.pointerType === 'pen' || e.pointerType === 'virtual' || e.pointerType === 'keyboard' && hasAction && $433b1145b0781e10$var$isActionKey() || e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current) {\n if (hasAction) performAction(e);\n else if (allowsSelection) onSelect(e);\n }\n };\n }\n itemProps['data-key'] = key;\n itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;\n let { pressProps: pressProps, isPressed: isPressed } = (0, $i4XHw$reactariainteractions.usePress)(itemPressProps);\n // Double clicking with a mouse with selectionBehavior = 'replace' performs an action.\n let onDoubleClick = hasSecondaryAction ? (e)=>{\n if (modality.current === 'mouse') {\n e.stopPropagation();\n e.preventDefault();\n performAction(e);\n }\n } : undefined;\n // Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior\n // to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to\n // selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.\n let { longPressProps: longPressProps } = (0, $i4XHw$reactariainteractions.useLongPress)({\n isDisabled: !longPressEnabled,\n onLongPress (e) {\n if (e.pointerType === 'touch') {\n onSelect(e);\n manager.setSelectionBehavior('toggle');\n }\n }\n });\n // Prevent native drag and drop on long press if we also select on long press.\n // Once the user is in selection mode, they can long press again to drag.\n // Use a capturing listener to ensure this runs before useDrag, regardless of\n // the order the props get merged.\n let onDragStartCapture = (e)=>{\n if (modality.current === 'touch' && longPressEnabledOnPressStart.current) e.preventDefault();\n };\n // Prevent default on link clicks so that we control exactly\n // when they open (to match selection behavior).\n let onClick = manager.isLink(key) ? (e)=>{\n if (!(0, $i4XHw$reactariautils.openLink).isOpening) e.preventDefault();\n } : undefined;\n return {\n itemProps: (0, $i4XHw$reactariautils.mergeProps)(itemProps, allowsSelection || hasPrimaryAction ? pressProps : {}, longPressEnabled ? longPressProps : {}, {\n onDoubleClick: onDoubleClick,\n onDragStartCapture: onDragStartCapture,\n onClick: onClick\n }),\n isPressed: isPressed,\n isSelected: manager.isSelected(key),\n isFocused: manager.isFocused && manager.focusedKey === key,\n isDisabled: isDisabled,\n allowsSelection: allowsSelection,\n hasAction: hasAction\n };\n}\nfunction $433b1145b0781e10$var$isActionKey() {\n let event = window.event;\n return (event === null || event === void 0 ? void 0 : event.key) === 'Enter';\n}\nfunction $433b1145b0781e10$var$isSelectionKey() {\n let event = window.event;\n return (event === null || event === void 0 ? void 0 : event.key) === ' ' || (event === null || event === void 0 ? void 0 : event.code) === 'Space';\n}\n\n\n//# sourceMappingURL=useSelectableItem.main.js.map\n","var $ee0bdf4faa47f2a8$exports = require(\"./utils.main.js\");\nvar $i4XHw$reactariainteractions = require(\"@react-aria/interactions\");\nvar $i4XHw$reactariautils = require(\"@react-aria/utils\");\nvar $i4XHw$reactariafocus = require(\"@react-aria/focus\");\nvar $i4XHw$react = require(\"react\");\n\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n$parcel$export(module.exports, \"useSelectableItem\", () => $433b1145b0781e10$export$ecf600387e221c37);\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */ \n\n\n\n\nfunction $433b1145b0781e10$export$ecf600387e221c37(options) {\n let { id: id, selectionManager: manager, key: key, ref: ref, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldUseVirtualFocus: shouldUseVirtualFocus, focus: focus, isDisabled: isDisabled, onAction: onAction, allowsDifferentPressOrigin: allowsDifferentPressOrigin, linkBehavior: linkBehavior = 'action' } = options;\n let router = (0, $i4XHw$reactariautils.useRouter)();\n id = (0, $i4XHw$reactariautils.useId)(id);\n let onSelect = (e)=>{\n if (e.pointerType === 'keyboard' && (0, $ee0bdf4faa47f2a8$exports.isNonContiguousSelectionModifier)(e)) manager.toggleSelection(key);\n else {\n if (manager.selectionMode === 'none') return;\n if (manager.isLink(key)) {\n if (linkBehavior === 'selection' && ref.current) {\n let itemProps = manager.getItemProps(key);\n router.open(ref.current, e, itemProps.href, itemProps.routerOptions);\n // Always set selected keys back to what they were so that select and combobox close.\n manager.setSelectedKeys(manager.selectedKeys);\n return;\n } else if (linkBehavior === 'override' || linkBehavior === 'none') return;\n }\n if (manager.selectionMode === 'single') {\n if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);\n else manager.replaceSelection(key);\n } else if (e && e.shiftKey) manager.extendSelection(key);\n else if (manager.selectionBehavior === 'toggle' || e && ((0, $i4XHw$reactariautils.isCtrlKeyPressed)(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\n manager.toggleSelection(key);\n else manager.replaceSelection(key);\n }\n };\n // Focus the associated DOM node when this item becomes the focusedKey\n // TODO: can't make this useLayoutEffect bacause it breaks menus inside dialogs\n // However, if this is a useEffect, it runs twice and dispatches two blur events and immediately sets\n // aria-activeDescendant in useAutocomplete... I've worked around this for now\n (0, $i4XHw$react.useEffect)(()=>{\n let isFocused = key === manager.focusedKey;\n if (isFocused && manager.isFocused) {\n if (!shouldUseVirtualFocus) {\n if (focus) focus();\n else if (document.activeElement !== ref.current && ref.current) (0, $i4XHw$reactariainteractions.focusSafely)(ref.current);\n } else (0, $i4XHw$reactariafocus.moveVirtualFocus)(ref.current);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n ref,\n key,\n manager.focusedKey,\n manager.childFocusStrategy,\n manager.isFocused,\n shouldUseVirtualFocus\n ]);\n isDisabled = isDisabled || manager.isDisabled(key);\n // Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused\n // item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver\n // on iOS 14 doesn't try to move real DOM focus to the item anyway.\n let itemProps = {};\n if (!shouldUseVirtualFocus && !isDisabled) itemProps = {\n tabIndex: key === manager.focusedKey ? 0 : -1,\n onFocus (e) {\n if (e.target === ref.current) manager.setFocusedKey(key);\n }\n };\n else if (isDisabled) itemProps.onMouseDown = (e)=>{\n // Prevent focus going to the body when clicking on a disabled item.\n e.preventDefault();\n };\n // With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.\n // Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.\n // With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.\n // With touch, onAction occurs on single tap, and long press enters selection mode.\n let isLinkOverride = manager.isLink(key) && linkBehavior === 'override';\n let hasLinkAction = manager.isLink(key) && linkBehavior !== 'selection' && linkBehavior !== 'none';\n let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;\n let allowsActions = (onAction || hasLinkAction) && !isDisabled;\n let hasPrimaryAction = allowsActions && (manager.selectionBehavior === 'replace' ? !allowsSelection : !allowsSelection || manager.isEmpty);\n let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';\n let hasAction = hasPrimaryAction || hasSecondaryAction;\n let modality = (0, $i4XHw$react.useRef)(null);\n let longPressEnabled = hasAction && allowsSelection;\n let longPressEnabledOnPressStart = (0, $i4XHw$react.useRef)(false);\n let hadPrimaryActionOnPressStart = (0, $i4XHw$react.useRef)(false);\n let performAction = (e)=>{\n if (onAction) onAction();\n if (hasLinkAction && ref.current) {\n let itemProps = manager.getItemProps(key);\n router.open(ref.current, e, itemProps.href, itemProps.routerOptions);\n }\n };\n // By default, selection occurs on pointer down. This can be strange if selecting an\n // item causes the UI to disappear immediately (e.g. menus).\n // If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.\n // onPress requires a pointer down event on the same element as pointer up. For menus,\n // we want to be able to have the pointer down on the trigger that opens the menu and\n // the pointer up on the menu item rather than requiring a separate press.\n // For keyboard events, selection still occurs on key down.\n let itemPressProps = {};\n if (shouldSelectOnPressUp) {\n itemPressProps.onPressStart = (e)=>{\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n if (e.pointerType === 'keyboard' && (!hasAction || $433b1145b0781e10$var$isSelectionKey())) onSelect(e);\n };\n // If allowsDifferentPressOrigin and interacting with mouse, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)\n // Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)\n if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e)=>{\n if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== 'mouse') {\n if (e.pointerType === 'keyboard' && !$433b1145b0781e10$var$isActionKey()) return;\n performAction(e);\n } else if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);\n };\n else {\n itemPressProps.onPressUp = hasPrimaryAction ? undefined : (e)=>{\n if (e.pointerType === 'mouse' && allowsSelection) onSelect(e);\n };\n itemPressProps.onPress = hasPrimaryAction ? performAction : (e)=>{\n if (e.pointerType !== 'keyboard' && e.pointerType !== 'mouse' && allowsSelection) onSelect(e);\n };\n }\n } else {\n itemPressProps.onPressStart = (e)=>{\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n hadPrimaryActionOnPressStart.current = hasPrimaryAction;\n // Select on mouse down unless there is a primary action which will occur on mouse up.\n // For keyboard, select on key down. If there is an action, the Space key selects on key down,\n // and the Enter key performs onAction on key up.\n if (allowsSelection && (e.pointerType === 'mouse' && !hasPrimaryAction || e.pointerType === 'keyboard' && (!allowsActions || $433b1145b0781e10$var$isSelectionKey()))) onSelect(e);\n };\n itemPressProps.onPress = (e)=>{\n // Selection occurs on touch up. Primary actions always occur on pointer up.\n // Both primary and secondary actions occur on Enter key up. The only exception\n // is secondary actions, which occur on double click with a mouse.\n if (e.pointerType === 'touch' || e.pointerType === 'pen' || e.pointerType === 'virtual' || e.pointerType === 'keyboard' && hasAction && $433b1145b0781e10$var$isActionKey() || e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current) {\n if (hasAction) performAction(e);\n else if (allowsSelection) onSelect(e);\n }\n };\n }\n itemProps['data-collection'] = (0, $ee0bdf4faa47f2a8$exports.getCollectionId)(manager.collection);\n itemProps['data-key'] = key;\n itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;\n // When using virtual focus, make sure the focused key gets updated on press.\n if (shouldUseVirtualFocus) itemPressProps = (0, $i4XHw$reactariautils.mergeProps)(itemPressProps, {\n onPressStart (e) {\n if (e.pointerType !== 'touch') {\n manager.setFocused(true);\n manager.setFocusedKey(key);\n }\n },\n onPress (e) {\n if (e.pointerType === 'touch') {\n manager.setFocused(true);\n manager.setFocusedKey(key);\n }\n }\n });\n let { pressProps: pressProps, isPressed: isPressed } = (0, $i4XHw$reactariainteractions.usePress)(itemPressProps);\n // Double clicking with a mouse with selectionBehavior = 'replace' performs an action.\n let onDoubleClick = hasSecondaryAction ? (e)=>{\n if (modality.current === 'mouse') {\n e.stopPropagation();\n e.preventDefault();\n performAction(e);\n }\n } : undefined;\n // Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior\n // to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to\n // selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.\n let { longPressProps: longPressProps } = (0, $i4XHw$reactariainteractions.useLongPress)({\n isDisabled: !longPressEnabled,\n onLongPress (e) {\n if (e.pointerType === 'touch') {\n onSelect(e);\n manager.setSelectionBehavior('toggle');\n }\n }\n });\n // Prevent native drag and drop on long press if we also select on long press.\n // Once the user is in selection mode, they can long press again to drag.\n // Use a capturing listener to ensure this runs before useDrag, regardless of\n // the order the props get merged.\n let onDragStartCapture = (e)=>{\n if (modality.current === 'touch' && longPressEnabledOnPressStart.current) e.preventDefault();\n };\n // Prevent default on link clicks so that we control exactly\n // when they open (to match selection behavior).\n let onClick = manager.isLink(key) ? (e)=>{\n if (!(0, $i4XHw$reactariautils.openLink).isOpening) e.preventDefault();\n } : undefined;\n return {\n itemProps: (0, $i4XHw$reactariautils.mergeProps)(itemProps, allowsSelection || hasPrimaryAction || shouldUseVirtualFocus ? pressProps : {}, longPressEnabled ? longPressProps : {}, {\n onDoubleClick: onDoubleClick,\n onDragStartCapture: onDragStartCapture,\n onClick: onClick,\n id: id\n }, // Prevent DOM focus from moving on mouse down when using virtual focus\n shouldUseVirtualFocus ? {\n onMouseDown: (e)=>e.preventDefault()\n } : undefined),\n isPressed: isPressed,\n isSelected: manager.isSelected(key),\n isFocused: manager.isFocused && manager.focusedKey === key,\n isDisabled: isDisabled,\n allowsSelection: allowsSelection,\n hasAction: hasAction\n };\n}\nfunction $433b1145b0781e10$var$isActionKey() {\n let event = window.event;\n return (event === null || event === void 0 ? void 0 : event.key) === 'Enter';\n}\nfunction $433b1145b0781e10$var$isSelectionKey() {\n let event = window.event;\n return (event === null || event === void 0 ? void 0 : event.key) === ' ' || (event === null || event === void 0 ? void 0 : event.code) === 'Space';\n}\n\n\n//# sourceMappingURL=useSelectableItem.main.js.map\n"],"names":["e","v","$ee0bdf4faa47f2a8$exports","$i4XHw$reactariafocus","$i4XHw$reactariautils","$i4XHw$reactariainteractions","$i4XHw$react","$433b1145b0781e10$export$ecf600387e221c37","options","selectionManager","manager","key","ref","shouldSelectOnPressUp","shouldUseVirtualFocus","focus","isDisabled","onAction","allowsDifferentPressOrigin","linkBehavior","router","useRouter","onSelect","pointerType","isNonContiguousSelectionModifier","toggleSelection","selectionMode","isLink","itemProps","getItemProps","open","current","href","routerOptions","setSelectedKeys","selectedKeys","isSelected","disallowEmptySelection","replaceSelection","shiftKey","extendSelection","selectionBehavior","isCtrlKeyPressed","useEffect","focusedKey","isFocused","document","activeElement","focusSafely","childFocusStrategy","onMouseDown","preventDefault","tabIndex","onFocus","target","setFocusedKey","isLinkOverride","hasLinkAction","allowsSelection","canSelectItem","allowsActions","hasPrimaryAction","isEmpty","hasSecondaryAction","hasAction","modality","useRef","longPressEnabled","longPressEnabledOnPressStart","hadPrimaryActionOnPressStart","performAction","itemPressProps","onPressStart","$433b1145b0781e10$var$isSelectionKey","onPressUp","onPress","$433b1145b0781e10$var$isActionKey","preventFocusOnPress","pressProps","isPressed","usePress","onDoubleClick","stopPropagation","undefined","longPressProps","useLongPress","onLongPress","setSelectionBehavior","onClick","openLink","isOpening","mergeProps","onDragStartCapture","event","window","code","module","exports","Object","defineProperty","get","set","s","enumerable","configurable","id","useId","moveVirtualFocus","getCollectionId","collection","setFocused"],"sourceRoot":""}