{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { ListActionTypes } from './listActions.types';\n/**\n * Looks up the next valid item to highlight within the list.\n *\n * @param currentIndex The index of the start of the search.\n * @param lookupDirection Whether to look for the next or previous item.\n * @param items The array of items to search.\n * @param includeDisabledItems Whether to include disabled items in the search.\n * @param isItemDisabled A function that determines whether an item is disabled.\n * @param wrapAround Whether to wrap around the list when searching.\n * @returns The index of the next valid item to highlight or -1 if no valid item is found.\n */\nfunction findValidItemToHighlight(currentIndex, lookupDirection, items, includeDisabledItems, isItemDisabled, wrapAround) {\n if (items.length === 0 || !includeDisabledItems && items.every((item, itemIndex) => isItemDisabled(item, itemIndex))) {\n return -1;\n }\n let nextFocus = currentIndex;\n for (;;) {\n // No valid items found\n if (!wrapAround && lookupDirection === 'next' && nextFocus === items.length || !wrapAround && lookupDirection === 'previous' && nextFocus === -1) {\n return -1;\n }\n const nextFocusDisabled = includeDisabledItems ? false : isItemDisabled(items[nextFocus], nextFocus);\n if (nextFocusDisabled) {\n nextFocus += lookupDirection === 'next' ? 1 : -1;\n if (wrapAround) {\n nextFocus = (nextFocus + items.length) % items.length;\n }\n } else {\n return nextFocus;\n }\n }\n}\n\n/**\n * Gets the next item to highlight based on the current highlighted item and the search direction.\n *\n * @param previouslyHighlightedValue The item from which to start the search for the next candidate.\n * @param offset The offset from the previously highlighted item to search for the next candidate or a special named value ('reset', 'start', 'end').\n * @param context The list action context.\n *\n * @returns The next item to highlight or null if no item is valid.\n */\nexport function moveHighlight(previouslyHighlightedValue, offset, context) {\n var _items$nextIndex;\n const {\n items,\n isItemDisabled,\n disableListWrap,\n disabledItemsFocusable,\n itemComparer,\n focusManagement\n } = context;\n\n // TODO: make this configurable\n // The always should be an item highlighted when focus is managed by the DOM\n // so that it's accessible by the `tab` key.\n const defaultHighlightedIndex = focusManagement === 'DOM' ? 0 : -1;\n const maxIndex = items.length - 1;\n const previouslyHighlightedIndex = previouslyHighlightedValue == null ? -1 : items.findIndex(item => itemComparer(item, previouslyHighlightedValue));\n let nextIndexCandidate;\n let lookupDirection;\n let wrapAround = !disableListWrap;\n switch (offset) {\n case 'reset':\n if (defaultHighlightedIndex === -1) {\n return null;\n }\n nextIndexCandidate = 0;\n lookupDirection = 'next';\n wrapAround = false;\n break;\n case 'start':\n nextIndexCandidate = 0;\n lookupDirection = 'next';\n wrapAround = false;\n break;\n case 'end':\n nextIndexCandidate = maxIndex;\n lookupDirection = 'previous';\n wrapAround = false;\n break;\n default:\n {\n const newIndex = previouslyHighlightedIndex + offset;\n if (newIndex < 0) {\n if (!wrapAround && previouslyHighlightedIndex !== -1 || Math.abs(offset) > 1) {\n nextIndexCandidate = 0;\n lookupDirection = 'next';\n } else {\n nextIndexCandidate = maxIndex;\n lookupDirection = 'previous';\n }\n } else if (newIndex > maxIndex) {\n if (!wrapAround || Math.abs(offset) > 1) {\n nextIndexCandidate = maxIndex;\n lookupDirection = 'previous';\n } else {\n nextIndexCandidate = 0;\n lookupDirection = 'next';\n }\n } else {\n nextIndexCandidate = newIndex;\n lookupDirection = offset >= 0 ? 'next' : 'previous';\n }\n }\n }\n const nextIndex = findValidItemToHighlight(nextIndexCandidate, lookupDirection, items, disabledItemsFocusable, isItemDisabled, wrapAround);\n\n // If there are no valid items to highlight, return the previously highlighted item (if it's still valid).\n if (nextIndex === -1 && previouslyHighlightedValue !== null && !isItemDisabled(previouslyHighlightedValue, previouslyHighlightedIndex)) {\n return previouslyHighlightedValue;\n }\n return (_items$nextIndex = items[nextIndex]) != null ? _items$nextIndex : null;\n}\n\n/**\n * Toggles the selection of an item.\n *\n * @param item Item to toggle.\n * @param selectedValues Already selected items.\n * @param selectionMode The number of items that can be simultanously selected.\n * @param itemComparer A custom item comparer function.\n *\n * @returns The new array of selected items.\n */\nexport function toggleSelection(item, selectedValues, selectionMode, itemComparer) {\n if (selectionMode === 'none') {\n return [];\n }\n if (selectionMode === 'single') {\n // if the item to select has already been selected, return the original array\n if (itemComparer(selectedValues[0], item)) {\n return selectedValues;\n }\n return [item];\n }\n\n // The toggled item is selected; remove it from the selection.\n if (selectedValues.some(sv => itemComparer(sv, item))) {\n return selectedValues.filter(sv => !itemComparer(sv, item));\n }\n\n // The toggled item is not selected - add it to the selection.\n return [...selectedValues, item];\n}\n\n/**\n * Handles item selection in a list.\n *\n * @param item - The item to be selected.\n * @param state - The current state of the list.\n * @param context - The context of the list action.\n * @returns The new state of the list after the item has been selected, or the original state if the item is disabled.\n */\nexport function handleItemSelection(item, state, context) {\n const {\n itemComparer,\n isItemDisabled,\n selectionMode,\n items\n } = context;\n const {\n selectedValues\n } = state;\n const itemIndex = items.findIndex(i => itemComparer(item, i));\n if (isItemDisabled(item, itemIndex)) {\n return state;\n }\n\n // if the item is already selected, remove it from the selection, otherwise add it\n const newSelectedValues = toggleSelection(item, selectedValues, selectionMode, itemComparer);\n return _extends({}, state, {\n selectedValues: newSelectedValues,\n highlightedValue: item\n });\n}\nfunction handleKeyDown(key, state, context) {\n const previouslySelectedValue = state.highlightedValue;\n const {\n orientation,\n pageSize\n } = context;\n switch (key) {\n case 'Home':\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, 'start', context)\n });\n case 'End':\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, 'end', context)\n });\n case 'PageUp':\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, -pageSize, context)\n });\n case 'PageDown':\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, pageSize, context)\n });\n case 'ArrowUp':\n if (orientation !== 'vertical') {\n break;\n }\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, -1, context)\n });\n case 'ArrowDown':\n if (orientation !== 'vertical') {\n break;\n }\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, 1, context)\n });\n case 'ArrowLeft':\n {\n if (orientation === 'vertical') {\n break;\n }\n const offset = orientation === 'horizontal-ltr' ? -1 : 1;\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, offset, context)\n });\n }\n case 'ArrowRight':\n {\n if (orientation === 'vertical') {\n break;\n }\n const offset = orientation === 'horizontal-ltr' ? 1 : -1;\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, offset, context)\n });\n }\n case 'Enter':\n case ' ':\n if (state.highlightedValue === null) {\n return state;\n }\n return handleItemSelection(state.highlightedValue, state, context);\n default:\n break;\n }\n return state;\n}\nfunction handleBlur(state, context) {\n if (context.focusManagement === 'DOM') {\n return state;\n }\n return _extends({}, state, {\n highlightedValue: null\n });\n}\nfunction textCriteriaMatches(nextFocus, searchString, stringifyItem) {\n var _stringifyItem;\n const text = (_stringifyItem = stringifyItem(nextFocus)) == null ? void 0 : _stringifyItem.trim().toLowerCase();\n if (!text || text.length === 0) {\n // Make item not navigable if stringification fails or results in empty string.\n return false;\n }\n return text.indexOf(searchString) === 0;\n}\nfunction handleTextNavigation(state, searchString, context) {\n const {\n items,\n isItemDisabled,\n disabledItemsFocusable,\n getItemAsString\n } = context;\n const startWithCurrentItem = searchString.length > 1;\n let nextItem = startWithCurrentItem ? state.highlightedValue : moveHighlight(state.highlightedValue, 1, context);\n for (let index = 0; index < items.length; index += 1) {\n // Return un-mutated state if looped back to the currently highlighted value\n if (!nextItem || !startWithCurrentItem && state.highlightedValue === nextItem) {\n return state;\n }\n if (textCriteriaMatches(nextItem, searchString, getItemAsString) && (!isItemDisabled(nextItem, items.indexOf(nextItem)) || disabledItemsFocusable)) {\n // The nextItem is the element to be highlighted\n return _extends({}, state, {\n highlightedValue: nextItem\n });\n }\n // Move to the next element.\n nextItem = moveHighlight(nextItem, 1, context);\n }\n\n // No item matches the text search criteria\n return state;\n}\nfunction handleItemsChange(items, previousItems, state, context) {\n var _state$selectedValues;\n const {\n itemComparer,\n focusManagement\n } = context;\n let newHighlightedValue = null;\n if (state.highlightedValue != null) {\n var _items$find;\n newHighlightedValue = (_items$find = items.find(item => itemComparer(item, state.highlightedValue))) != null ? _items$find : null;\n } else if (focusManagement === 'DOM' && previousItems.length === 0) {\n newHighlightedValue = moveHighlight(null, 'reset', context);\n }\n\n // exclude selected values that are no longer in the items list\n const selectedValues = (_state$selectedValues = state.selectedValues) != null ? _state$selectedValues : [];\n const newSelectedValues = selectedValues.filter(selectedValue => items.some(item => itemComparer(item, selectedValue)));\n return _extends({}, state, {\n highlightedValue: newHighlightedValue,\n selectedValues: newSelectedValues\n });\n}\nfunction handleResetHighlight(state, context) {\n return _extends({}, state, {\n highlightedValue: moveHighlight(null, 'reset', context)\n });\n}\nfunction handleHighlightLast(state, context) {\n return _extends({}, state, {\n highlightedValue: moveHighlight(null, 'end', context)\n });\n}\nfunction handleClearSelection(state, context) {\n return _extends({}, state, {\n selectedValues: [],\n highlightedValue: moveHighlight(null, 'reset', context)\n });\n}\nexport function listReducer(state, action) {\n const {\n type,\n context\n } = action;\n switch (type) {\n case ListActionTypes.keyDown:\n return handleKeyDown(action.key, state, context);\n case ListActionTypes.itemClick:\n return handleItemSelection(action.item, state, context);\n case ListActionTypes.blur:\n return handleBlur(state, context);\n case ListActionTypes.textNavigation:\n return handleTextNavigation(state, action.searchString, context);\n case ListActionTypes.itemsChange:\n return handleItemsChange(action.items, action.previousItems, state, context);\n case ListActionTypes.resetHighlight:\n return handleResetHighlight(state, context);\n case ListActionTypes.highlightLast:\n return handleHighlightLast(state, context);\n case ListActionTypes.clearSelection:\n return handleClearSelection(state, context);\n default:\n return state;\n }\n}","map":{"version":3,"names":["_extends","ListActionTypes","findValidItemToHighlight","currentIndex","lookupDirection","items","includeDisabledItems","isItemDisabled","wrapAround","length","every","item","itemIndex","nextFocus","nextFocusDisabled","moveHighlight","previouslyHighlightedValue","offset","context","_items$nextIndex","disableListWrap","disabledItemsFocusable","itemComparer","focusManagement","defaultHighlightedIndex","maxIndex","previouslyHighlightedIndex","findIndex","nextIndexCandidate","newIndex","Math","abs","nextIndex","toggleSelection","selectedValues","selectionMode","some","sv","filter","handleItemSelection","state","i","newSelectedValues","highlightedValue","handleKeyDown","key","previouslySelectedValue","orientation","pageSize","handleBlur","textCriteriaMatches","searchString","stringifyItem","_stringifyItem","text","trim","toLowerCase","indexOf","handleTextNavigation","getItemAsString","startWithCurrentItem","nextItem","index","handleItemsChange","previousItems","_state$selectedValues","newHighlightedValue","_items$find","find","selectedValue","handleResetHighlight","handleHighlightLast","handleClearSelection","listReducer","action","type","keyDown","itemClick","blur","textNavigation","itemsChange","resetHighlight","highlightLast","clearSelection"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/base/useList/listReducer.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { ListActionTypes } from './listActions.types';\n/**\n * Looks up the next valid item to highlight within the list.\n *\n * @param currentIndex The index of the start of the search.\n * @param lookupDirection Whether to look for the next or previous item.\n * @param items The array of items to search.\n * @param includeDisabledItems Whether to include disabled items in the search.\n * @param isItemDisabled A function that determines whether an item is disabled.\n * @param wrapAround Whether to wrap around the list when searching.\n * @returns The index of the next valid item to highlight or -1 if no valid item is found.\n */\nfunction findValidItemToHighlight(currentIndex, lookupDirection, items, includeDisabledItems, isItemDisabled, wrapAround) {\n if (items.length === 0 || !includeDisabledItems && items.every((item, itemIndex) => isItemDisabled(item, itemIndex))) {\n return -1;\n }\n let nextFocus = currentIndex;\n for (;;) {\n // No valid items found\n if (!wrapAround && lookupDirection === 'next' && nextFocus === items.length || !wrapAround && lookupDirection === 'previous' && nextFocus === -1) {\n return -1;\n }\n const nextFocusDisabled = includeDisabledItems ? false : isItemDisabled(items[nextFocus], nextFocus);\n if (nextFocusDisabled) {\n nextFocus += lookupDirection === 'next' ? 1 : -1;\n if (wrapAround) {\n nextFocus = (nextFocus + items.length) % items.length;\n }\n } else {\n return nextFocus;\n }\n }\n}\n\n/**\n * Gets the next item to highlight based on the current highlighted item and the search direction.\n *\n * @param previouslyHighlightedValue The item from which to start the search for the next candidate.\n * @param offset The offset from the previously highlighted item to search for the next candidate or a special named value ('reset', 'start', 'end').\n * @param context The list action context.\n *\n * @returns The next item to highlight or null if no item is valid.\n */\nexport function moveHighlight(previouslyHighlightedValue, offset, context) {\n var _items$nextIndex;\n const {\n items,\n isItemDisabled,\n disableListWrap,\n disabledItemsFocusable,\n itemComparer,\n focusManagement\n } = context;\n\n // TODO: make this configurable\n // The always should be an item highlighted when focus is managed by the DOM\n // so that it's accessible by the `tab` key.\n const defaultHighlightedIndex = focusManagement === 'DOM' ? 0 : -1;\n const maxIndex = items.length - 1;\n const previouslyHighlightedIndex = previouslyHighlightedValue == null ? -1 : items.findIndex(item => itemComparer(item, previouslyHighlightedValue));\n let nextIndexCandidate;\n let lookupDirection;\n let wrapAround = !disableListWrap;\n switch (offset) {\n case 'reset':\n if (defaultHighlightedIndex === -1) {\n return null;\n }\n nextIndexCandidate = 0;\n lookupDirection = 'next';\n wrapAround = false;\n break;\n case 'start':\n nextIndexCandidate = 0;\n lookupDirection = 'next';\n wrapAround = false;\n break;\n case 'end':\n nextIndexCandidate = maxIndex;\n lookupDirection = 'previous';\n wrapAround = false;\n break;\n default:\n {\n const newIndex = previouslyHighlightedIndex + offset;\n if (newIndex < 0) {\n if (!wrapAround && previouslyHighlightedIndex !== -1 || Math.abs(offset) > 1) {\n nextIndexCandidate = 0;\n lookupDirection = 'next';\n } else {\n nextIndexCandidate = maxIndex;\n lookupDirection = 'previous';\n }\n } else if (newIndex > maxIndex) {\n if (!wrapAround || Math.abs(offset) > 1) {\n nextIndexCandidate = maxIndex;\n lookupDirection = 'previous';\n } else {\n nextIndexCandidate = 0;\n lookupDirection = 'next';\n }\n } else {\n nextIndexCandidate = newIndex;\n lookupDirection = offset >= 0 ? 'next' : 'previous';\n }\n }\n }\n const nextIndex = findValidItemToHighlight(nextIndexCandidate, lookupDirection, items, disabledItemsFocusable, isItemDisabled, wrapAround);\n\n // If there are no valid items to highlight, return the previously highlighted item (if it's still valid).\n if (nextIndex === -1 && previouslyHighlightedValue !== null && !isItemDisabled(previouslyHighlightedValue, previouslyHighlightedIndex)) {\n return previouslyHighlightedValue;\n }\n return (_items$nextIndex = items[nextIndex]) != null ? _items$nextIndex : null;\n}\n\n/**\n * Toggles the selection of an item.\n *\n * @param item Item to toggle.\n * @param selectedValues Already selected items.\n * @param selectionMode The number of items that can be simultanously selected.\n * @param itemComparer A custom item comparer function.\n *\n * @returns The new array of selected items.\n */\nexport function toggleSelection(item, selectedValues, selectionMode, itemComparer) {\n if (selectionMode === 'none') {\n return [];\n }\n if (selectionMode === 'single') {\n // if the item to select has already been selected, return the original array\n if (itemComparer(selectedValues[0], item)) {\n return selectedValues;\n }\n return [item];\n }\n\n // The toggled item is selected; remove it from the selection.\n if (selectedValues.some(sv => itemComparer(sv, item))) {\n return selectedValues.filter(sv => !itemComparer(sv, item));\n }\n\n // The toggled item is not selected - add it to the selection.\n return [...selectedValues, item];\n}\n\n/**\n * Handles item selection in a list.\n *\n * @param item - The item to be selected.\n * @param state - The current state of the list.\n * @param context - The context of the list action.\n * @returns The new state of the list after the item has been selected, or the original state if the item is disabled.\n */\nexport function handleItemSelection(item, state, context) {\n const {\n itemComparer,\n isItemDisabled,\n selectionMode,\n items\n } = context;\n const {\n selectedValues\n } = state;\n const itemIndex = items.findIndex(i => itemComparer(item, i));\n if (isItemDisabled(item, itemIndex)) {\n return state;\n }\n\n // if the item is already selected, remove it from the selection, otherwise add it\n const newSelectedValues = toggleSelection(item, selectedValues, selectionMode, itemComparer);\n return _extends({}, state, {\n selectedValues: newSelectedValues,\n highlightedValue: item\n });\n}\nfunction handleKeyDown(key, state, context) {\n const previouslySelectedValue = state.highlightedValue;\n const {\n orientation,\n pageSize\n } = context;\n switch (key) {\n case 'Home':\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, 'start', context)\n });\n case 'End':\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, 'end', context)\n });\n case 'PageUp':\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, -pageSize, context)\n });\n case 'PageDown':\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, pageSize, context)\n });\n case 'ArrowUp':\n if (orientation !== 'vertical') {\n break;\n }\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, -1, context)\n });\n case 'ArrowDown':\n if (orientation !== 'vertical') {\n break;\n }\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, 1, context)\n });\n case 'ArrowLeft':\n {\n if (orientation === 'vertical') {\n break;\n }\n const offset = orientation === 'horizontal-ltr' ? -1 : 1;\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, offset, context)\n });\n }\n case 'ArrowRight':\n {\n if (orientation === 'vertical') {\n break;\n }\n const offset = orientation === 'horizontal-ltr' ? 1 : -1;\n return _extends({}, state, {\n highlightedValue: moveHighlight(previouslySelectedValue, offset, context)\n });\n }\n case 'Enter':\n case ' ':\n if (state.highlightedValue === null) {\n return state;\n }\n return handleItemSelection(state.highlightedValue, state, context);\n default:\n break;\n }\n return state;\n}\nfunction handleBlur(state, context) {\n if (context.focusManagement === 'DOM') {\n return state;\n }\n return _extends({}, state, {\n highlightedValue: null\n });\n}\nfunction textCriteriaMatches(nextFocus, searchString, stringifyItem) {\n var _stringifyItem;\n const text = (_stringifyItem = stringifyItem(nextFocus)) == null ? void 0 : _stringifyItem.trim().toLowerCase();\n if (!text || text.length === 0) {\n // Make item not navigable if stringification fails or results in empty string.\n return false;\n }\n return text.indexOf(searchString) === 0;\n}\nfunction handleTextNavigation(state, searchString, context) {\n const {\n items,\n isItemDisabled,\n disabledItemsFocusable,\n getItemAsString\n } = context;\n const startWithCurrentItem = searchString.length > 1;\n let nextItem = startWithCurrentItem ? state.highlightedValue : moveHighlight(state.highlightedValue, 1, context);\n for (let index = 0; index < items.length; index += 1) {\n // Return un-mutated state if looped back to the currently highlighted value\n if (!nextItem || !startWithCurrentItem && state.highlightedValue === nextItem) {\n return state;\n }\n if (textCriteriaMatches(nextItem, searchString, getItemAsString) && (!isItemDisabled(nextItem, items.indexOf(nextItem)) || disabledItemsFocusable)) {\n // The nextItem is the element to be highlighted\n return _extends({}, state, {\n highlightedValue: nextItem\n });\n }\n // Move to the next element.\n nextItem = moveHighlight(nextItem, 1, context);\n }\n\n // No item matches the text search criteria\n return state;\n}\nfunction handleItemsChange(items, previousItems, state, context) {\n var _state$selectedValues;\n const {\n itemComparer,\n focusManagement\n } = context;\n let newHighlightedValue = null;\n if (state.highlightedValue != null) {\n var _items$find;\n newHighlightedValue = (_items$find = items.find(item => itemComparer(item, state.highlightedValue))) != null ? _items$find : null;\n } else if (focusManagement === 'DOM' && previousItems.length === 0) {\n newHighlightedValue = moveHighlight(null, 'reset', context);\n }\n\n // exclude selected values that are no longer in the items list\n const selectedValues = (_state$selectedValues = state.selectedValues) != null ? _state$selectedValues : [];\n const newSelectedValues = selectedValues.filter(selectedValue => items.some(item => itemComparer(item, selectedValue)));\n return _extends({}, state, {\n highlightedValue: newHighlightedValue,\n selectedValues: newSelectedValues\n });\n}\nfunction handleResetHighlight(state, context) {\n return _extends({}, state, {\n highlightedValue: moveHighlight(null, 'reset', context)\n });\n}\nfunction handleHighlightLast(state, context) {\n return _extends({}, state, {\n highlightedValue: moveHighlight(null, 'end', context)\n });\n}\nfunction handleClearSelection(state, context) {\n return _extends({}, state, {\n selectedValues: [],\n highlightedValue: moveHighlight(null, 'reset', context)\n });\n}\nexport function listReducer(state, action) {\n const {\n type,\n context\n } = action;\n switch (type) {\n case ListActionTypes.keyDown:\n return handleKeyDown(action.key, state, context);\n case ListActionTypes.itemClick:\n return handleItemSelection(action.item, state, context);\n case ListActionTypes.blur:\n return handleBlur(state, context);\n case ListActionTypes.textNavigation:\n return handleTextNavigation(state, action.searchString, context);\n case ListActionTypes.itemsChange:\n return handleItemsChange(action.items, action.previousItems, state, context);\n case ListActionTypes.resetHighlight:\n return handleResetHighlight(state, context);\n case ListActionTypes.highlightLast:\n return handleHighlightLast(state, context);\n case ListActionTypes.clearSelection:\n return handleClearSelection(state, context);\n default:\n return state;\n }\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,SAASC,eAAe,QAAQ,qBAAqB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,wBAAwBA,CAACC,YAAY,EAAEC,eAAe,EAAEC,KAAK,EAAEC,oBAAoB,EAAEC,cAAc,EAAEC,UAAU,EAAE;EACxH,IAAIH,KAAK,CAACI,MAAM,KAAK,CAAC,IAAI,CAACH,oBAAoB,IAAID,KAAK,CAACK,KAAK,CAAC,CAACC,IAAI,EAAEC,SAAS,KAAKL,cAAc,CAACI,IAAI,EAAEC,SAAS,CAAC,CAAC,EAAE;IACpH,OAAO,CAAC,CAAC;EACX;EACA,IAAIC,SAAS,GAAGV,YAAY;EAC5B,SAAS;IACP;IACA,IAAI,CAACK,UAAU,IAAIJ,eAAe,KAAK,MAAM,IAAIS,SAAS,KAAKR,KAAK,CAACI,MAAM,IAAI,CAACD,UAAU,IAAIJ,eAAe,KAAK,UAAU,IAAIS,SAAS,KAAK,CAAC,CAAC,EAAE;MAChJ,OAAO,CAAC,CAAC;IACX;IACA,MAAMC,iBAAiB,GAAGR,oBAAoB,GAAG,KAAK,GAAGC,cAAc,CAACF,KAAK,CAACQ,SAAS,CAAC,EAAEA,SAAS,CAAC;IACpG,IAAIC,iBAAiB,EAAE;MACrBD,SAAS,IAAIT,eAAe,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;MAChD,IAAII,UAAU,EAAE;QACdK,SAAS,GAAG,CAACA,SAAS,GAAGR,KAAK,CAACI,MAAM,IAAIJ,KAAK,CAACI,MAAM;MACvD;IACF,CAAC,MAAM;MACL,OAAOI,SAAS;IAClB;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,aAAaA,CAACC,0BAA0B,EAAEC,MAAM,EAAEC,OAAO,EAAE;EACzE,IA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