<commit_before>import global from './global';

const Controller = function Controller ($element, $scope) {
  'ngInject';

  let ctrl = this;
  let removeResetListener;
  const resetDefault = () => {
    ctrl.default = true;
    $scope.$digest();
    removeResetListener();
  };
  removeResetListener = () => global
    .removeEventListener('mouseup', resetDefault);

  const componentmouseup = (e) => e.stopPropagation();
  $element[0].addEventListener('mouseup', componentmouseup, true);
  const removeComponentListener = () => $element[0]
    .removeEventListener('mouseup', componentmouseup, true);

  Object.assign(ctrl, {
    default: true,
    onDefault () {
      ctrl.default = false;
      global.addEventListener('mouseup', resetDefault);
    },
    onConfirm () {
      ctrl.confirmClick();
      removeResetListener();
      removeComponentListener();
    },
    $onDestroy () {
      removeResetListener();
      removeComponentListener();
    }
  });
};


export default {
  controller: Controller,
  bindings: {
    confirmClick: '&'
  },
  transclude: {
    default: 'defaultButton',
    verify: 'verifyButton'
  },
  template: `
  <span ng-transclude="default" ng-if="$ctrl.default" ng-click="$ctrl.onDefault()"></span>
  <span ng-transclude="verify" ng-if="!$ctrl.default" ng-click="$ctrl.onConfirm()"></span>
  `
};
<commit_msg>CR Updates<commit_after>import global from './global';

const Controller = function Controller ($element, $scope) {
  'ngInject';

  let ctrl = this;
  let removeResetListener, removeComponentListener, removeListeners;
  const resetDefault = () => {
    ctrl.default = true;
    $scope.$digest();
    removeListeners();
  };
  removeResetListener = () => global
    .removeEventListener('mouseup', resetDefault);

  const componentmouseup = (e) => e.stopPropagation();
  removeComponentListener = () => $element[0]
    .removeEventListener('mouseup', componentmouseup, true);

  removeListeners = () => {
    removeResetListener();
    removeComponentListener();
  };

  Object.assign(ctrl, {
    default: true,
    onDefault () {
      ctrl.default = false;
      $element[0].addEventListener('mouseup', componentmouseup, true);
      global.addEventListener('mouseup', resetDefault);
    },
    onConfirm () {
      ctrl.confirmClick();
      removeListeners();
    },
    $onDestroy: removeListeners
  });
};


export default {
  controller: Controller,
  bindings: {
    confirmClick: '&'
  },
  transclude: {
    default: 'defaultButton',
    verify: 'verifyButton'
  },
  template: `
  <span ng-transclude="default" ng-if="$ctrl.default" ng-click="$ctrl.onDefault()"></span>
  <span ng-transclude="verify" ng-if="!$ctrl.default" ng-click="$ctrl.onConfirm()"></span>
  `
};

{'fraction_non_alphanumeric': 0.15920763022743947, 'fraction_numerical': 0.001467351430667645, 'mean_word_length': 3.775831873905429, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7122463', 'n_tokens_mistral': 807, 'n_tokens_neox': 804, 'n_words': 151}