{"ast":null,"code":"import { useCallback, useState } from 'react';\n/**\n * @title multipleSelect hooks\n * @description multipleSelect by hold down shift key\n */\nexport const useMultipleSelect = getKey => {\n  const [prevSelectedIndex, setPrevSelectedIndex] = useState(null);\n  const multipleSelect = useCallback((currentSelectedIndex, data, selectedKeys) => {\n    const configPrevSelectedIndex = prevSelectedIndex !== null && prevSelectedIndex !== void 0 ? prevSelectedIndex : currentSelectedIndex;\n    // add/delete the selected range\n    const startIndex = Math.min(configPrevSelectedIndex || 0, currentSelectedIndex);\n    const endIndex = Math.max(configPrevSelectedIndex || 0, currentSelectedIndex);\n    const rangeKeys = data.slice(startIndex, endIndex + 1).map(getKey);\n    const shouldSelected = rangeKeys.some(rangeKey => !selectedKeys.has(rangeKey));\n    const changedKeys = [];\n    rangeKeys.forEach(item => {\n      if (shouldSelected) {\n        if (!selectedKeys.has(item)) {\n          changedKeys.push(item);\n        }\n        selectedKeys.add(item);\n      } else {\n        selectedKeys.delete(item);\n        changedKeys.push(item);\n      }\n    });\n    setPrevSelectedIndex(shouldSelected ? endIndex : null);\n    return changedKeys;\n  }, [prevSelectedIndex]);\n  return [multipleSelect, setPrevSelectedIndex];\n};","map":{"version":3,"names":["useCallback","useState","useMultipleSelect","getKey","prevSelectedIndex","setPrevSelectedIndex","multipleSelect","currentSelectedIndex","data","selectedKeys","configPrevSelectedIndex","startIndex","Math","min","endIndex","max","rangeKeys","slice","map","shouldSelected","some","rangeKey","has","changedKeys","forEach","item","push","add","delete"],"sources":["/Users/nili/Documents/trae_projects/client/node_modules/antd/es/_util/hooks/useMultipleSelect.js"],"sourcesContent":["import { useCallback, useState } from 'react';\n/**\n * @title multipleSelect hooks\n * @description multipleSelect by hold down shift key\n */\nexport const useMultipleSelect = getKey => {\n  const [prevSelectedIndex, setPrevSelectedIndex] = useState(null);\n  const multipleSelect = useCallback((currentSelectedIndex, data, selectedKeys) => {\n    const configPrevSelectedIndex = prevSelectedIndex !== null && prevSelectedIndex !== void 0 ? prevSelectedIndex : currentSelectedIndex;\n    // add/delete the selected range\n    const startIndex = Math.min(configPrevSelectedIndex || 0, currentSelectedIndex);\n    const endIndex = Math.max(configPrevSelectedIndex || 0, currentSelectedIndex);\n    const rangeKeys = data.slice(startIndex, endIndex + 1).map(getKey);\n    const shouldSelected = rangeKeys.some(rangeKey => !selectedKeys.has(rangeKey));\n    const changedKeys = [];\n    rangeKeys.forEach(item => {\n      if (shouldSelected) {\n        if (!selectedKeys.has(item)) {\n          changedKeys.push(item);\n        }\n        selectedKeys.add(item);\n      } else {\n        selectedKeys.delete(item);\n        changedKeys.push(item);\n      }\n    });\n    setPrevSelectedIndex(shouldSelected ? endIndex : null);\n    return changedKeys;\n  }, [prevSelectedIndex]);\n  return [multipleSelect, setPrevSelectedIndex];\n};"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAC7C;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGC,MAAM,IAAI;EACzC,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGJ,QAAQ,CAAC,IAAI,CAAC;EAChE,MAAMK,cAAc,GAAGN,WAAW,CAAC,CAACO,oBAAoB,EAAEC,IAAI,EAAEC,YAAY,KAAK;IAC/E,MAAMC,uBAAuB,GAAGN,iBAAiB,KAAK,IAAI,IAAIA,iBAAiB,KAAK,KAAK,CAAC,GAAGA,iBAAiB,GAAGG,oBAAoB;IACrI;IACA,MAAMI,UAAU,GAAGC,IAAI,CAACC,GAAG,CAACH,uBAAuB,IAAI,CAAC,EAAEH,oBAAoB,CAAC;IAC/E,MAAMO,QAAQ,GAAGF,IAAI,CAACG,GAAG,CAACL,uBAAuB,IAAI,CAAC,EAAEH,oBAAoB,CAAC;IAC7E,MAAMS,SAAS,GAAGR,IAAI,CAACS,KAAK,CAACN,UAAU,EAAEG,QAAQ,GAAG,CAAC,CAAC,CAACI,GAAG,CAACf,MAAM,CAAC;IAClE,MAAMgB,cAAc,GAAGH,SAAS,CA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