{"version":3,"file":"possibleEvents.cjs","names":["isDefined"],"sources":["../../../src/events/functions/possibleEvents.ts"],"sourcesContent":["import isDefined from '#bemedev/features/common/castings/is/defined';\nimport type { NodeConfig } from '#states';\nimport type { RecordS } from '~types';\n\n/**\n * Returns a list of all possible events from a flat record of NodeConfig.\n * @param flat of type {@linkcode RecordS}<{@linkcode NodeConfig}>, a flat record of NodeConfig.\n * @returns An array of event names.\n *\n * @see {@linkcode castings} for the utility function to check if a value is defined.\n */\nexport const possibleEvents = (flat: RecordS<NodeConfig>) => {\n  const events: string[] = [];\n\n  const values = Object.values(flat);\n  values.forEach(value => {\n    const on = value.on;\n    const check = isDefined(on);\n\n    if (check) {\n      events.push(...Object.keys(on));\n    }\n  });\n\n  return events;\n};\n"],"mappings":";;;;;;;;;;AAWA,MAAa,kBAAkB,SAA8B;CAC3D,MAAM,SAAmB,EAAE;AAEZ,QAAO,OAAO,KAAK,CAC3B,SAAQ,UAAS;EACtB,MAAM,KAAK,MAAM;AAGjB,MAFcA,yDAAU,GAAG,CAGzB,QAAO,KAAK,GAAG,OAAO,KAAK,GAAG,CAAC;GAEjC;AAEF,QAAO"}