import { __assign } from 'tslib';

function buildKeytipConfigMap(config) {
  var configMap = {};
  for (var _i = 0, _a = config.keytips; _i < _a.length; _i++) {
    var keytip = _a[_i];
    constructKeytip(configMap, [], keytip);
  }
  return configMap;
}
function constructKeytip(configMap, parentSequence, keytip) {
  var sequence = keytip.sequence ? keytip.sequence : keytip.content.toLocaleLowerCase();
  var keytipSequence = parentSequence.concat(sequence);
  var keytipProps = __assign(__assign({}, keytip.optionalProps), { keySequences: keytipSequence, content: keytip.content });
  configMap[keytip.id] = keytipProps;
  if (keytip.children) {
    for (var _i = 0, _a = keytip.children; _i < _a.length; _i++) {
      var child = _a[_i];
      constructKeytip(configMap, keytipSequence, child);
    }
  }
}

export { buildKeytipConfigMap, constructKeytip };
