<commit_before>/*eslint-disable */
var animateScroll = require('./animate-scroll');

var __mapped = {};
var __activeLink;

module.exports = {

  unmount: function() {
    __mapped = [];
  },

  register: function(name, element, parent, relativePosition){
    __mapped[name] = {
      element: element,
      parent: parent,
      position: relativePosition
    };

  },

  unregister: function(name) {
    delete __mapped[name];
  },

  get: function(name) {
    return __mapped[name].element;
  },

  setActiveLink: function(link) {
    __activeLink = link;
  },

  getActiveLink: function() {
    return __activeLink;
  },

  scrollTo: function(to, animate, duration, offset) {
    console.log(offset);

     /*
     * get the mapped DOM element
     */


      //check to make sure that the scrollable parent div exists
      if (__mapped[to].parent){
        var relativePosition = __mapped[to].position;
        var parent = __mapped[to].parent;
        //set the target equal to the Dom of the parent div
        var target = parent;
      }
      else {
        var target = __mapped[to].element;
      }

      if(!target) {
        throw new Error("target Element not found");
      }

      var rect = target.getBoundingClientRect();
      var coordinates = {
        left: rect.left,
        top: rect.top,
        width: rect.width,
        height: rect.height
      };

      /*
       * if animate is not provided just scroll into the view
       */

      if(!animate) {
        //if parent div exists just set the scrolTop of the div to the relativePosition of the element (no animation or duration)
        if (parent){
          parent.scrollTop = relativePosition;
          return;
        }
        //if parent div doesn't exist run normally
        var bodyRect = document.body.getBoundingClientRect();
        var scrollOffset = coordinates.top - bodyRect.top;
        window.scrollTo(0, scrollOffset + (offset || 0));
        return;
      }

      /*
       * Animate scrolling
       */

      var options = {
        duration : duration
      };

      var currentScrollPosition = parent.scrollTop;
      //added parentQ parameter and relativePosition
      animateScroll.animateTopScroll((offset || 0), options, parent, relativePosition, currentScrollPosition, coordinates.height)

  }
};
<commit_msg>need to uprev and use as dependency<commit_after>/*eslint-disable */
var animateScroll = require('./animate-scroll');

var __mapped = {};
var __activeLink;

module.exports = {

  unmount: function() {
    __mapped = [];
  },

  register: function(name, element, parent, relativePosition){
    __mapped[name] = {
      element: element,
      parent: parent,
      position: relativePosition
    };

  },

  unregister: function(name) {
    delete __mapped[name];
  },

  get: function(name) {
    return __mapped[name].element;
  },

  setActiveLink: function(link) {
    __activeLink = link;
  },

  getActiveLink: function() {
    return __activeLink;
  },

  scrollTo: function(to, animate, duration, offset) {

     /*
     * get the mapped DOM element
     */


      //check to make sure that the scrollable parent div exists
      if (__mapped[to].parent){
        var relativePosition = __mapped[to].position;
        var parent = __mapped[to].parent;
        //set the target equal to the Dom of the parent div
        var target = parent;
      }
      else {
        var target = __mapped[to].element;
      }

      if(!target) {
        throw new Error("target Element not found");
      }

      var rect = target.getBoundingClientRect();
      var coordinates = {
        left: rect.left,
        top: rect.top,
        width: rect.width,
        height: rect.height
      };

      /*
       * if animate is not provided just scroll into the view
       */

      if(!animate) {
        //if parent div exists just set the scrolTop of the div to the relativePosition of the element (no animation or duration)
        if (parent){
          parent.scrollTop = relativePosition;
          return;
        }
        //if parent div doesn't exist run normally
        var bodyRect = document.body.getBoundingClientRect();
        var scrollOffset = coordinates.top - bodyRect.top;
        window.scrollTo(0, scrollOffset + (offset || 0));
        return;
      }

      /*
       * Animate scrolling
       */

      var options = {
        duration : duration
      };

      var currentScrollPosition = parent.scrollTop;
      //added parentQ parameter and relativePosition
      animateScroll.animateTopScroll((offset || 0), options, parent, relativePosition, currentScrollPosition)

  }
};

{'fraction_non_alphanumeric': 0.10355987055016182, 'fraction_numerical': 0.0012944983818770227, 'mean_word_length': 2.2261656228253304, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4646822', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1261, 'n_words': 372}