{"version":3,"file":"stateType.cjs","names":[],"sources":["../../../src/states/functions/stateType.ts"],"sourcesContent":["import type { Fn } from '#bemedev/globals/types';\nimport type { NodeConfig, StateType } from '../types';\n\nexport type StateType_F = Fn<[state: NodeConfig], StateType>;\n\n/**\n * Determines the type of state based on its configuration.\n *\n * @param config - The state configuration object.\n * @returns The type of the state: 'atomic', 'compound', or the specified type.\n *\n * @see {@linkcode StateType_F} for more details.\n */\nexport const stateType: StateType_F = config => {\n  const type = config.type;\n  if (type) return type;\n  const states = (config as any).states;\n  if (states) {\n    const len = Object.keys(states).length;\n    if (len > 0) {\n      return 'compound';\n    }\n  }\n\n  return 'atomic';\n};\n"],"mappings":";;;;;;;;;;AAaA,MAAa,aAAyB,WAAU;CAC9C,MAAM,OAAO,OAAO;AACpB,KAAI,KAAM,QAAO;CACjB,MAAM,SAAU,OAAe;AAC/B,KAAI;MACU,OAAO,KAAK,OAAO,CAAC,SACtB,EACR,QAAO;;AAIX,QAAO"}