<commit_before>/*!
 * viewport-units-buggyfill v0.3.1
 * @web: https://github.com/rodneyrehm/viewport-units-buggyfill/
 * @author: <NAME> - http://rodneyrehm.de/en/
 */

(function (root, factory) {
  'use strict';
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define([], factory);
  } else if (typeof exports === 'object') {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like enviroments that support module.exports,
    // like Node.
    module.exports = factory();
  } else {
    // Browser globals (root is window)
    root.viewportUnitsBuggyfill = factory();
  }
}(this, function () {
  'use strict';
  /*global document, window, location, XMLHttpRequest, XDomainRequest*/

  var initialized = false;
  var options;
  var refreshDebounce;
  var viewportUnitExpression = /([+-]?[0-9.]+)(vh|vw|vmin|vmax)/g;
  var calcExpression = /calc\(/g;
  var quoteExpression = /[\"\']/g;
  var urlExpression = /url\([^\)]*\)/g;
  var forEach = [].forEach;
  var dimensions;
  var declarations;
  var styleNode;
  var is_safari_or_uiwebview = /(iPhone|iPod|iPad).+AppleWebKit/i.test(window.navigator.userAgent);
  var is_bad_IE = false;
  var no_vmin_vmax = false;
  var no_vmin_in_calc = false;
  var use_css_content_hack = false;
  var use_css_behavior_hack = false;

  /*
   * Do not remove this comment before.  It is used by IE to test what version
   * we are running.
   */

  /*@cc_on

  @if (@_jscript_version <= 10)
    is_bad_IE = true;
    no_vmin_in_calc = true;
    no_vmin_vmax = true;
  @end

  @*/

  // Debounce function from http://davidwalsh.name/javascript-debounce-function
  // Returns a function, that, as long as it continues to be invoked, will not
  // be triggered. The function will be called after it stops being called for
  // N milliseconds. If `immediate` is passed, trigger the function on the
  // leading edge, instead of the trailing.
  function debounce(func, wait, immediate) {
    var timeout;
    return function() {
      var context = this;
      var args = arguments;
      clearTimeout(timeout);
      timeout = setTimeout(function() {
        timeout = null;
        if (!immediate) {
          func.apply(context, args);
        }
      }, wait);

      if (immediate && !timeout) {
        func.apply(context, args);
      }
    };
  }

  function initialize(initOptions) {
    options = initOptions || {};
    if (initialized || (!options.force && !is_safari_or_uiwebview && !is_bad_IE)) {
      // this buggyfill only applies to mobile safari
      return;
    }

    /*
     * Test to see if viewport units can be used in calc() expressions
     */
    var div = document.createElement('div');
    div.style.width = '1vmax';
    if (div.style.width === '') {
      no_vmin_vmax = true;
    }

    // there is no accurate way to detect this programmatically.
    no_vmin_in_calc = no_vmin_in_calc || is_safari_or_uiwebview;
    use_css_behavior_hack = !! options.use_css_behavior_hack;
    use_css_content_hack = !! options.use_css_content_hack;
    initialized = true;
    styleNode = document.createElement('style');
    styleNode.id = 'patched-viewport';
    document.head.appendChild(styleNode);

    // Issue #6: Cross Origin Stylesheets are not accessible through CSSOM,
    // therefore download and inject them as <style> to circumvent SOP.
    importCrossOriginLinks(function() {
      // doing a full refresh rather than updateStyles because an orientationchange
      // could activate different stylesheets
      window.addEventListener('orientationchange', refresh, true);
      // we must add a pageShow event here, since a user could have gone to a
      // different page, rotated the device, and then went back to the original
      // page, which doesn't update the viewport units.
      window.addEventListener('pageshow', refresh, true);
      if (is_bad_IE || inIframe() || options.force) {
        if (options.use_resize_debounce) {
          if (typeof options.use_resize_debounce === 'number') {
            refreshDebounce = debounce(refresh, options.use_resize_debounce);
          } else {
            refreshDebounce = debounce(refresh, 250);
          }

          window.addEventListener('resize', refreshDebounce, true);
        } else {
          window.addEventListener('resize', refresh, true);
        }
      }

      refresh();
    });
  }

  /*
   * code to detect if document is in an iframe from
   * http://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t
   */
  function inIframe() {
    try {
      return window.self !== window.top;
    } catch (e) {
      return true;<commit_msg>no need to run that function first<commit_after>/*!
 * viewport-units-buggyfill v0.3.1
 * @web: https://github.com/rodneyrehm/viewport-units-buggyfill/
 * @author: <NAME> - http://rodneyrehm.de/en/
 */

(function (root, factory) {
  'use strict';
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define([], factory);
  } else if (typeof exports === 'object') {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like enviroments that support module.exports,
    // like Node.
    module.exports = factory();
  } else {
    // Browser globals (root is window)
    root.viewportUnitsBuggyfill = factory();
  }
}(this, function () {
  'use strict';
  /*global document, window, location, XMLHttpRequest, XDomainRequest*/

  var initialized = false;
  var options;
  var refreshDebounce;
  var viewportUnitExpression = /([+-]?[0-9.]+)(vh|vw|vmin|vmax)/g;
  var calcExpression = /calc\(/g;
  var quoteExpression = /[\"\']/g;
  var urlExpression = /url\([^\)]*\)/g;
  var forEach = [].forEach;
  var dimensions;
  var declarations;
  var styleNode;
  var is_safari_or_uiwebview = /(iPhone|iPod|iPad).+AppleWebKit/i.test(window.navigator.userAgent);
  var is_bad_IE = false;
  var no_vmin_vmax = false;
  var no_vmin_in_calc = false;
  var use_css_content_hack = false;
  var use_css_behavior_hack = false;

  /*
   * Do not remove this comment before.  It is used by IE to test what version
   * we are running.
   */

  /*@cc_on

  @if (@_jscript_version <= 10)
    is_bad_IE = true;
    no_vmin_in_calc = true;
    no_vmin_vmax = true;
  @end

  @*/

  // Debounce function from http://davidwalsh.name/javascript-debounce-function
  // Returns a function, that, as long as it continues to be invoked, will not
  // be triggered. The function will be called after it stops being called for
  // N milliseconds. If `immediate` is passed, trigger the function on the
  // leading edge, instead of the trailing.
  function debounce(func, wait, immediate) {
    var timeout;
    return function() {
      var context = this;
      var args = arguments;
      clearTimeout(timeout);
      timeout = setTimeout(function() {
        timeout = null;
        if (!immediate) {
          func.apply(context, args);
        }
      }, wait);

      if (immediate && !timeout) {
        func.apply(context, args);
      }
    };
  }

  function initialize(initOptions) {
    options = initOptions || {};
    if (initialized || (!options.force && !is_safari_or_uiwebview && !is_bad_IE)) {
      // this buggyfill only applies to mobile safari
      return;
    }

    /*
     * Test to see if viewport units can be used in calc() expressions
     */
    var div = document.createElement('div');
    div.style.width = '1vmax';
    if (div.style.width === '') {
      no_vmin_vmax = true;
    }

    // there is no accurate way to detect this programmatically.
    no_vmin_in_calc = no_vmin_in_calc || is_safari_or_uiwebview;
    use_css_behavior_hack = !! options.use_css_behavior_hack;
    use_css_content_hack = !! options.use_css_content_hack;
    initialized = true;
    styleNode = document.createElement('style');
    styleNode.id = 'patched-viewport';
    document.head.appendChild(styleNode);

    // Issue #6: Cross Origin Stylesheets are not accessible through CSSOM,
    // therefore download and inject them as <style> to circumvent SOP.
    importCrossOriginLinks(function() {
      // doing a full refresh rather than updateStyles because an orientationchange
      // could activate different stylesheets
      window.addEventListener('orientationchange', refresh, true);
      // we must add a pageShow event here, since a user could have gone to a
      // different page, rotated the device, and then went back to the original
      // page, which doesn't update the viewport units.
      window.addEventListener('pageshow', refresh, true);
      if (is_bad_IE || options.force || inIframe()) {
        if (options.use_resize_debounce) {
          if (typeof options.use_resize_debounce === 'number') {
            refreshDebounce = debounce(refresh, options.use_resize_debounce);
          } else {
            refreshDebounce = debounce(refresh, 250);
          }

          window.addEventListener('resize', refreshDebounce, true);
        } else {
          window.addEventListener('resize', refresh, true);
        }
      }

      refresh();
    });
  }

  /*
   * code to detect if document is in an iframe from
   * http://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t
   */
  function inIframe() {
    try {
      return window.self !== window.top;
    } catch (e) {
      return true;
{'fraction_non_alphanumeric': 0.11972501322051825, 'fraction_numerical': 0.003807509254362771, 'mean_word_length': 2.820606060606061, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '490263', 'n_tokens_mistral': 2992, 'n_tokens_neox': 2898, 'n_words': 807}