{"version":3,"file":"static/js/15408.2e379311.chunk.js","mappings":"0MAOO,MAAMA,EAAqBA,KAChC,MAAMC,GAAYC,EAAAA,EAAAA,IAAYC,EAAAA,IACxBC,GAAeF,EAAAA,EAAAA,IAAYG,EAAAA,IAC3BC,GAAWC,EAAAA,EAAAA,MAiBjB,OAfeC,EAAAA,EAAAA,cACb,CAACC,EAAYC,KACPA,GAAST,IAAcQ,IACX,eAAVC,GAA2BN,EAG7BE,GAASK,EAAAA,EAAAA,IAAgBF,KAFpBG,EAAAA,EAAAA,GAAWH,IAKlBI,EAAAA,EAAAA,GAAcH,GAChB,GAEF,CAACT,EAAWG,GAGD,C","sources":["hooks/betslip/useChangeOddFormat.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { loadLadder } from 'utils/betslip/odd-formats-helper';\nimport { setOddsFormat } from 'utils/betslip/odds-format';\nimport { updateOddFormat } from 'store/actions/betslip';\nimport { getLadderLoaded, getOddFormat } from 'store/selectors/betslip';\n\nexport const useChangeOddFormat = (): ((id: number, value: string) => void) => {\n const oddFormat = useSelector(getOddFormat);\n const ladderLoaded = useSelector(getLadderLoaded);\n const dispatch = useDispatch();\n\n const handle = useCallback(\n (id: number, value: string) => {\n if (value && oddFormat !== id) {\n if (value === 'fractional' && !ladderLoaded) {\n void loadLadder(id);\n } else {\n dispatch(updateOddFormat(id));\n }\n\n setOddsFormat(value);\n }\n },\n [oddFormat, ladderLoaded]\n );\n\n return handle;\n};\n"],"names":["useChangeOddFormat","oddFormat","useSelector","getOddFormat","ladderLoaded","getLadderLoaded","dispatch","useDispatch","useCallback","id","value","updateOddFormat","loadLadder","setOddsFormat"],"sourceRoot":""}