import { KeyCodes, find } from '@uifabric-vue/utilities';

var KeytipTransitionModifier;
(function(KeytipTransitionModifier2) {
  KeytipTransitionModifier2[KeytipTransitionModifier2["shift"] = KeyCodes.shift] = "shift";
  KeytipTransitionModifier2[KeytipTransitionModifier2["ctrl"] = KeyCodes.ctrl] = "ctrl";
  KeytipTransitionModifier2[KeytipTransitionModifier2["alt"] = KeyCodes.alt] = "alt";
  KeytipTransitionModifier2[KeytipTransitionModifier2["meta"] = KeyCodes.leftWindow] = "meta";
})(KeytipTransitionModifier || (KeytipTransitionModifier = {}));
function transitionKeysAreEqual(key1, key2) {
  if (key1.key !== key2.key) {
    return false;
  }
  var mod1 = key1.modifierKeys;
  var mod2 = key2.modifierKeys;
  if (!mod1 && mod2 || mod1 && !mod2) {
    return false;
  }
  if (mod1 && mod2) {
    if (mod1.length !== mod2.length) {
      return false;
    }
    mod1 = mod1.sort();
    mod2 = mod2.sort();
    for (var i = 0; i < mod1.length; i++) {
      if (mod1[i] !== mod2[i]) {
        return false;
      }
    }
  }
  return true;
}
function transitionKeysContain(keys, key) {
  return !!find(keys, function(transitionKey) {
    return transitionKeysAreEqual(transitionKey, key);
  });
}

export { KeytipTransitionModifier, transitionKeysAreEqual, transitionKeysContain };
