{"version":3,"file":"flatMap.cjs","names":["flatByKey"],"sources":["../../../src/states/functions/flatMap.ts"],"sourcesContent":["import { DEFAULT_DELIMITER } from '#constants';\nimport { flatByKey } from '@bemedev/decompose';\nimport type { FlatMapN, NodeConfig } from '../types';\n\nexport type FlatMap_F<T extends NodeConfig = NodeConfig> = <\n  const SN extends T,\n  Wc extends boolean = false,\n>(\n  config: SN,\n  children?: Wc,\n  sep?: string,\n) => FlatMapN<SN, Wc>;\n\n/**\n * Flattens a state node configuration into a map structure.\n *\n * @param node - The state node configuration to flatten.\n * @param withChildren - Whether to include child states in the output.\n * @param delimiter - The delimiter to use for paths in the output map. Defaults to {@linkcode DEFAULT_DELIMITER}.\n * @param path - The current path in the output map (used for recursion).\n * @returns A flat map of the state node configuration.\n *\n * @see {@linkcode FlatMap_F} for more details.\n */\nexport const flatMap: FlatMap_F = (\n  node,\n  children,\n  sep = DEFAULT_DELIMITER,\n) => {\n  return flatByKey.low(node, 'states', {\n    children,\n    sep,\n  });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAa,WACX,MACA,UACA,MAAA,QACG;AACH,QAAOA,mBAAAA,UAAU,IAAI,MAAM,UAAU;EACnC;EACA;EACD,CAAC"}