<commit_before>(function(angular) {
  var indexOf = [].indexOf || function(item) {
    for (var i = 0, l = this.length; i < l; i++) {
      if (i in this && this[i] === item) return i;
    }
    return -1;
  };

  angular.module('pickadate.utils', [])
    .factory('pickadateUtils', ['dateFilter',
      function(dateFilter) {
        return {
          isDate: function(obj) {
            return Object.prototype.toString.call(obj) === '[object Date]';
          },

          stringToDate: function(dateString) {
            if (this.isDate(dateString)) return new Date(dateString);
            var dateParts = dateString.split('-'),
              year = dateParts[0],
              month = dateParts[1],
              day = dateParts[2];

            // set hour to 3am to easily avoid DST change
            return new Date(year, month - 1, day, 3);
          },

          dateRange: function(first, last, initial, format) {
            var date, i, _i, dates = [];

            if (!format) format = 'yyyy-MM-dd';

            for (i = _i = first; first <= last ? _i < last : _i > last; i = first <= last ? ++_i : --_i) {
              date = this.stringToDate(initial);
              date.setDate(date.getDate() + i);
              dates.push(dateFilter(date, format));
            }
            return dates;
          }
        };
      }
  ]);

  angular.module('pickadate', ['pickadate.utils'])

  .factory('offset', function() {

    return function(element, parentWin) {
      if (parentWin === window || parentWin === document) {
        parentWin = document.body;
      }
      parentWin.style.position = 'relative';

      var offsetTop = element.offsetTop;
      var offsetLeft = element.offsetLeft;

      var offset = {
        top: offsetTop,
        left: offsetLeft
      };
      while (element.offsetParent && element.offsetParent !== parentWin) {
        offset.top += element.offsetParent.offsetTop;
        offset.left += element.offsetParent.offsetLeft;
      }

      return offset;

    }

  })

  .directive('input', ['$compile', 'offset', function($compile, offset){
    return {
      scope: {
        ngModel: '=',
        min: '=',
        max: '=',
        disabledDates: '='
      },
      restrict: 'E',
      link: function($scope, $elements, $attrs, controller) {
        if($attrs.type !== 'date'){
          return;
        }
        else{
          if($elements[0].type == 'date')return;
        }

        var pickdateTemp = '<div class="pickadate-container" pickadate ng-model="ngModel" min-date="min" max-date="max" disabled-dates="disabledDates"></div>';
        
        var $div = angular.element(pickdateTemp);

        angular.element(document.body).append($div);

        $compile($div)($scope);

        $div.css({display: 'none'});

        $elements.on('click', function(ev){

          ev.stopPropagation();

          $div.css({display: 'block'});

        })/*.on('blur', function(){
          setTimeout(function(){
            $div.css({display: 'none'});
          }, 200);
        });*/

        angular.element(document).on('click', function(){
          $div.css({display: 'none'});
        });

        angular.element(window).on('resize', setPosition);

        setPosition();

        function setPosition() {
            var offsetPos = offset($elements[0], window);
            var top = (offsetPos.top + $elements[0].offsetHeight + 2) + 'px';
            var left = offsetPos.left + 'px';
<commit_msg>first<commit_after>(function(angular) {
  var indexOf = [].indexOf || function(item) {
    for (var i = 0, l = this.length; i < l; i++) {
      if (i in this && this[i] === item) return i;
    }
    return -1;
  };

  angular.module('pickadate.utils', [])
    .factory('pickadateUtils', ['dateFilter',
      function(dateFilter) {
        return {
          isDate: function(obj) {
            return Object.prototype.toString.call(obj) === '[object Date]';
          },

          stringToDate: function(dateString) {
            if (this.isDate(dateString)) return new Date(dateString);
            var dateParts = dateString.split('-'),
              year = dateParts[0],
              month = dateParts[1],
              day = dateParts[2];

            // set hour to 3am to easily avoid DST change
            return new Date(year, month - 1, day, 3);
          },

          dateRange: function(first, last, initial, format) {
            var date, i, _i, dates = [];

            if (!format) format = 'yyyy-MM-dd';

            for (i = _i = first; first <= last ? _i < last : _i > last; i = first <= last ? ++_i : --_i) {
              date = this.stringToDate(initial);
              date.setDate(date.getDate() + i);
              dates.push(dateFilter(date, format));
            }
            return dates;
          }
        };
      }
  ]);

  angular.module('pickadate', ['pickadate.utils'])

  .factory('offset', function() {

    return function(element, parentWin) {
      if (parentWin === window || parentWin === document) {
        parentWin = document.body;
      }
      parentWin.style.position = 'relative';

      var offsetTop = element.offsetTop;
      var offsetLeft = element.offsetLeft;

      var offset = {
        top: offsetTop,
        left: offsetLeft
      };
      while (element.offsetParent && element.offsetParent !== parentWin) {
        offset.top += element.offsetParent.offsetTop;
        offset.left += element.offsetParent.offsetLeft;
      }

      return offset;

    }

  })

  .directive('input', ['$compile', 'offset', function($compile, offset){
    return {
      scope: {
        ngModel: '=',
        min: '=',
        max: '=',
        disabledDates: '='
      },
      restrict: 'E',
      link: function($scope, $elements, $attrs, controller) {
        if($attrs.type !== 'date'){
          return;
        }
        else{
          if($elements[0].type == 'date')return;
        }

        var pickdateTemp = '<div class="pickadate-container" pickadate ng-model="ngModel" min-date="min" max-date="max" disabled-dates="disabledDates"></div>';
        
        var $div = angular.element(pickdateTemp);

        angular.element(document.body).append($div);

        $compile($div)($scope);

        $div.css({display: 'none'});

        $elements.on('click', function(ev){

          ev.stopPropagation();

          $div.css({display: 'block'});

        });
        
        angular.element(document).on('click', function(){
          $div.css({display: 'none'});
        });

        angular.element(window).on('resize', setPosition);

        setPosition();

        function setPosition() {
            var offsetPos = offset($elements[0], window);
            var top = (offsetPos.top + $elements[0].offsetHeight + 2) + 'px';
            var left = offsetPos.left + 'px';

{'fraction_non_alphanumeric': 0.15797973865805315, 'fraction_numerical': 0.0039641755982968725, 'mean_word_length': 1.9694856146469049, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, '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': '6505968', 'n_tokens_mistral': 2024, 'n_tokens_neox': 1959, 'n_words': 426}